ml-time-graph 1.9.1 → 1.11.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.
@@ -1,7 +1,8 @@
1
- import { T as Theme, M as Marker } from './slug-aDUz3wBN.js';
2
- export { f as Layout, h as LayoutConfig, b as LayoutResult, i as LegendConfig, a as LegendItem, L as LegendOrientation, R as Renderer, m as measureLegend, j as renderArea, k as renderLegend, l as renderLine, n as renderSeriesMarkers, o as renderSplitLine, p as renderStep, q as renderZonedArea, e as slugify, t as toStepData, u as toStepPoints } from './slug-aDUz3wBN.js';
3
- import { D as DrawCommand, T as Threshold, e as LinearScale, G as Gap, d as TimeScale, g as HatchVariant, H as Highlight, b as Annotation, l as DataPoint, U as Point, E as EnumMap, V as BandScale, P as PointStyleType, j as AggregatedPoint, i as AnnotationBandItem, L as LineVariant, F as FillSpec, x as GapStyle, f as TimeSeries } from './scale-CQhADkWB.js';
4
- export { W as AxisOrientation, X as AxisPosition, Y as BandScaleConfig, Z as CircleParams, _ as Dashstyle_t, $ as DomainScaleConfig, a0 as DrawCircle, a1 as DrawGap, a2 as DrawGapType_t, a3 as DrawGroup, a4 as DrawLine, a5 as DrawPath, a6 as DrawRect, a7 as DrawText, a8 as LabelAnchor, a9 as LineParams, aa as LinearScaleConfig, ab as PathParams, ac as RectParams, ad as Scale, ae as ScaleConfig, af as TIME_INTERVALS, ag as TextParams, ah as TimeScaleConfig, ai as getHatch } from './scale-CQhADkWB.js';
1
+ import { k as Theme, t as RenderingContext, S as SeriesStyle, f as Marker, T as TextMetrics } from './marker_renderer-CiccLy7h.js';
2
+ export { u as Layout, v as LayoutConfig, a as LayoutResult, w as LegendConfig, L as LegendItem, e as LegendOrientation, R as Renderer, x as measureLegend, y as renderLegend, z as renderSeriesMarkers, q as slugify } from './marker_renderer-CiccLy7h.js';
3
+ import { D as DataPoint, a as DrawCommand, t as AggregatedPoint, j as HatchVariant, e as Threshold, L as LinearScale, f as Gap, T as TimeScale, R as RangeLabelPosition, H as Highlight, h as Annotation, a7 as LineParams, a8 as PathParams, a9 as RectParams, aa as CircleParams, ab as TextParams, ac as GapParams, c as DrawGroup, z as AxisOrientation, A as AxisPosition, Y as MovingAverageType, ad as Point, E as EnumMap, ae as BandScale, S as SmoothingType, P as PointStyleType, J as FillSide, r as AnnotationBandItem, b as LineVariant, V as LineShape, F as FillSpec, U as GapStyle, l as TimeSeries } from './scale-DQ-IdB6t.js';
4
+ export { af as BandScaleConfig, ag as Dashstyle_t, ah as DomainScaleConfig, ai as DrawCircle, aj as DrawGap, ak as DrawGapType_t, al as DrawLine, am as DrawPath, an as DrawRect, ao as DrawText, q as LabelAnchor, ap as LinearScaleConfig, aq as Scale, ar as ScaleConfig, as as TIME_INTERVALS, at as TimeScaleConfig, au as getHatch } from './scale-DQ-IdB6t.js';
5
+ import { DataPoint as DataPoint$1 } from './analyze/index.js';
5
6
 
6
7
  /*!
7
8
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
@@ -11,6 +12,79 @@ export { W as AxisOrientation, X as AxisPosition, Y as BandScaleConfig, Z as Cir
11
12
 
12
13
  declare const theme: Theme;
13
14
 
15
+ /**
16
+ * Render a line series split by a threshold value, allowing different styles
17
+ * for parts above and below that value.
18
+ */
19
+ declare function renderSplitLine(run: DataPoint[], threshold: number, ctx: RenderingContext, styles: {
20
+ above?: SeriesStyle;
21
+ below?: SeriesStyle;
22
+ }): DrawCommand[];
23
+
24
+ /** Render segments as step-functions. */
25
+
26
+ /**
27
+ * Punktfolge einer Treppe: vor jeden Punkt kommt die Ecke auf seiner X- und
28
+ * der vorigen Y-Hoehe. Steht hier und nicht nur in renderStep, weil
29
+ * MLTimeGraph seine Pfade selbst zusammenbaut und `style.line.shape: "step"`
30
+ * sonst wirkungslos bliebe -- so war es bis hierher.
31
+ */
32
+ declare function toStepPoints(pts: {
33
+ x: number;
34
+ y: number;
35
+ }[]): {
36
+ x: number;
37
+ y: number;
38
+ }[];
39
+ /**
40
+ * Dieselbe Treppe, aber im *Daten*raum: vor jeden Punkt kommt ein Punkt auf
41
+ * seiner Zeit und dem vorigen Wert. Erst damit wird die Stufe zu Daten, die
42
+ * jeder weitere Schritt -- Zonenteilung an einer Grenze, Flaeche unter der
43
+ * Kurve -- ohne eigenes Wissen ueber Treppen richtig behandelt.
44
+ *
45
+ * In Pixeln (toStepPoints) war die Stufe dafuer zu spaet: die Flaeche wurde
46
+ * aus den rohen Messwerten gebaut und lief als Rampe unter einer Treppe her,
47
+ * und eine Zonengrenze schnitt den senkrechten Sprung an der interpolierten
48
+ * Zeit statt am Zeitstempel des naechsten Wertes.
49
+ */
50
+ declare function toStepData(data: DataPoint$1[]): DataPoint$1[];
51
+
52
+ /*!
53
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
54
+ * MIT with Attribution: free use incl. commercial requires visible credit to
55
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
56
+ */
57
+
58
+ /** Render segments as continuous lines (standard or smoothed). */
59
+ declare function renderLine(segments: {
60
+ data: DataPoint[];
61
+ color?: string;
62
+ }[], ctx: RenderingContext, style: SeriesStyle): DrawCommand[];
63
+ declare function renderStep(segments: {
64
+ data: DataPoint[];
65
+ color?: string;
66
+ }[], ctx: RenderingContext, style: SeriesStyle): DrawCommand[];
67
+ /** Render segments as a filled area between two values (e.g. min/max band). */
68
+ declare function renderArea(segments: {
69
+ data: AggregatedPoint[];
70
+ color?: string;
71
+ }[], ctx: RenderingContext, style: SeriesStyle, yLow: (p: AggregatedPoint) => number, yHigh: (p: AggregatedPoint) => number): DrawCommand[];
72
+ /**
73
+ * Complex area renderer that splits a run by value boundaries (thresholds)
74
+ * and renders the resulting zones as separate filled areas.
75
+ */
76
+ declare function renderZonedArea<T extends {
77
+ time: number;
78
+ }>(run: T[], ctx: RenderingContext, options: {
79
+ boundaries: number[];
80
+ yLow: (p: T) => number;
81
+ yHigh: (p: T) => number;
82
+ getValue: (p: T) => number;
83
+ interpolate: (p1: T, p2: T, t: number) => T;
84
+ getColor: (zoneIndex: number) => string | undefined;
85
+ getHatch?: (zoneIndex: number) => HatchVariant | undefined;
86
+ }, style?: SeriesStyle): DrawCommand[];
87
+
14
88
  /*!
15
89
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
16
90
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -53,37 +127,6 @@ interface ThresholdRenderConfig {
53
127
  /** Flat-list variant: lines / fills / labels in one array (legacy callers). */
54
128
  declare function renderThresholds(config: ThresholdRenderConfig): DrawCommand[];
55
129
 
56
- /*!
57
- * MLTimeGraph — Copyright (c) 2026 Michael Lechner
58
- * MIT with Attribution: free use incl. commercial requires visible credit to
59
- * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
60
- */
61
- /**
62
- * Wo die Beschriftung eines Zeitbereichs sitzt — Highlight wie Datenluecke.
63
- *
64
- * Fuenf Werte, und die Unterscheidung ist der ganze Punkt:
65
- *
66
- * - `top` / `center` / `bottom` liegen INNERHALB der Zeichenflaeche. Sie
67
- * brauchen keinen Rand und koennen die Kurve ueberdecken.
68
- * - `above` / `below` liegen im Rand DES BILDES — oben ueber der Flaeche,
69
- * unten unter der Zeitachse. Sie ueberdecken nie Daten, brauchen dafuer
70
- * aber Platz: `margin.top` bzw. `margin.bottom`.
71
- *
72
- * `below` rechnet deshalb von der Gesamthoehe her, nicht von der Unterkante
73
- * der Zeichenflaeche. Ohne diese Zahl gibt es keinen unteren Rand, in den die
74
- * Schrift gehoeren koennte, und der Aufrufer bekaeme Text ausserhalb des SVG —
75
- * sichtbar in keinem Betrachter, aber vorhanden in jeder Datei.
76
- *
77
- * `middle` ist der alte Name der Datenluecken fuer `center` und bleibt
78
- * gueltig: Ein Name, der einmal in einer Datei stand, verschwindet nicht,
79
- * weil zwei Bauteile sich auf eine gemeinsame Schreibweise einigen.
80
- *
81
- * Dieselben Zahlen stehen im Go-Port (pkg/renderer/range_label.go). Laufen sie
82
- * auseinander, sitzt dieselbe Beschriftung im Browser und auf dem Server
83
- * verschieden hoch.
84
- */
85
- type RangeLabelPosition = "top" | "center" | "middle" | "bottom" | "above" | "below";
86
-
87
130
  /*!
88
131
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
89
132
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -195,6 +238,11 @@ interface AnnotationRenderConfig {
195
238
  timeScale: TimeScale;
196
239
  /** Value scales per y-axis index (0 = left, 1 = right). */
197
240
  valueScales: Map<number, LinearScale>;
241
+ /**
242
+ * Textbreiten. Nur damit kann eine Beschriftung am Rand ihre Ausrichtung
243
+ * nach innen kippen -- ohne sie bleibt es bei `middle`.
244
+ */
245
+ metrics?: TextMetrics;
198
246
  }
199
247
  /**
200
248
  * Render free-form annotations (arrow, line, rect, point, label) given in
@@ -208,6 +256,51 @@ interface AnnotationRenderConfig {
208
256
  */
209
257
  declare function renderAnnotations(config: AnnotationRenderConfig): DrawCommand[];
210
258
 
259
+ /*!
260
+ * MLTimeGraph — Copyright (c) 2026 Michael Lechner
261
+ * MIT with Attribution: free use incl. commercial requires visible credit to
262
+ * "Michael Lechner". Commercial license (no attribution) on request. See LICENSE.
263
+ */
264
+
265
+ /** Alles ausser `commands` an einer Gruppe. */
266
+ type GroupParams = Omit<DrawGroup, "type" | "commands">;
267
+ declare class CommandBuilder {
268
+ #private;
269
+ /** Die gesammelten Befehle. Eine Kopie -- sonst schreibt der Aufrufer mit. */
270
+ get commands(): DrawCommand[];
271
+ /** Wieviele Befehle bisher gesammelt sind. */
272
+ get length(): number;
273
+ line(params: LineParams): this;
274
+ path(params: PathParams): this;
275
+ rect(params: RectParams): this;
276
+ circle(params: CircleParams): this;
277
+ text(params: TextParams): this;
278
+ gap(params: GapParams): this;
279
+ /**
280
+ * Fertige Befehle uebernehmen -- etwa das Ergebnis einer der freien
281
+ * Renderfunktionen (`renderLine`, `renderThresholds`, …).
282
+ */
283
+ push(...commands: DrawCommand[]): this;
284
+ /**
285
+ * Eine Gruppe anlegen und mit einem eigenen Sammler fuellen.
286
+ *
287
+ * Der Rueckruf bekommt einen NEUEN Sammler; was er hineinschreibt, wird der
288
+ * Inhalt der Gruppe. Eine leere Gruppe entsteht nicht: schreibt der Rueckruf
289
+ * nichts, wird auch nichts angehaengt. Das ist die Regel, die die Renderer
290
+ * ohnehin alle von Hand befolgen (`if (cmds.length > 0) …`), und wer sie
291
+ * vergisst, erzeugt ein leeres `<g>` im SVG.
292
+ */
293
+ group(params: GroupParams, fuellen: (b: CommandBuilder) => void): this;
294
+ /**
295
+ * Alles als EINE Gruppe -- was die meisten Renderfunktionen zurueckgeben.
296
+ *
297
+ * Anders als `group` entsteht sie auch leer: eine Funktion, die eine Gruppe
298
+ * verspricht, muss eine liefern, sonst muesste jeder Aufrufer auf `undefined`
299
+ * pruefen.
300
+ */
301
+ toGroup(params?: GroupParams): DrawGroup;
302
+ }
303
+
211
304
  /*!
212
305
  * MLTimeGraph — Copyright (c) 2026 Michael Lechner
213
306
  * MIT with Attribution: free use incl. commercial requires visible credit to
@@ -273,6 +366,22 @@ interface TimeAxisConfig {
273
366
  domain: [number, number];
274
367
  /** Optional axis colours */
275
368
  colors?: AxisColorspec;
369
+ /**
370
+ * Breite der Leinwand und Textmetrik -- beides zusammen haelt die erste und
371
+ * die letzte Beschriftung IN der Zeichenflaeche.
372
+ *
373
+ * Beide Angaben sind freiwillig: ohne sie bleibt es beim alten Verhalten,
374
+ * die Beschriftung mittig unter ihrem Strich. Mit ihnen ruecken die beiden
375
+ * Randbeschriftungen so weit nach innen, dass sie vollstaendig sichtbar sind.
376
+ */
377
+ gesamtbreite?: number;
378
+ metrics?: TextMetrics;
379
+ /**
380
+ * Zwischenstriche je Hauptabstand (0 = keine). Ohne Beschriftung und halb so
381
+ * lang; gerechnet wird zwischen den PIXELpositionen der Hauptstriche, nicht
382
+ * im Kalender -- zwischen zwei Monatsstrichen liegt nicht "ein halber Monat".
383
+ */
384
+ minorTicks?: number;
276
385
  }
277
386
  /** Tick information for time axis with computed pixel positions and labels. */
278
387
  interface TickInfo {
@@ -303,6 +412,8 @@ declare class TimeAxis {
303
412
  antiOverlap(ticks: TickInfo[]): TickInfo[];
304
413
  /** Render axis baseline + tick marks as draw commands. */
305
414
  render(): DrawCommand[];
415
+ /** Positionen der Zwischenstriche in Pixeln. */
416
+ generateMinorTicks(): number[];
306
417
  }
307
418
 
308
419
  /*!
@@ -322,9 +433,9 @@ interface ValueAxisConfig {
322
433
  /** Pixel X-coordinate where axis is drawn */
323
434
  x?: number;
324
435
  /** Orientation: vertical (left/right) or horizontal (bottom) */
325
- orientation?: "vertical" | "horizontal";
436
+ orientation?: AxisOrientation;
326
437
  /** Position for vertical orientation */
327
- position?: "left" | "right";
438
+ position?: AxisPosition;
328
439
  colors?: AxisColorspec;
329
440
  /**
330
441
  * Pixel positions (Y for vertical, X for horizontal) where a tick LABEL
@@ -335,6 +446,32 @@ interface ValueAxisConfig {
335
446
  suppressLabelsNear?: number[];
336
447
  /** Pixel tolerance for `suppressLabelsNear`. Default 8. */
337
448
  suppressTolerancePx?: number;
449
+ /**
450
+ * Feste Strichwerte statt der automatischen Schrittweite.
451
+ *
452
+ * Dafuer gibt es einen Fall: eine Reihe mit `enumMap` -- Zustaende wie
453
+ * "Aus"/"An"/"Stoerung". Dort ist nicht die Schrittweite gefragt, sondern
454
+ * GENAU die vorhandenen Zustaende, jeder mit seinem Namen. Ohne das stuenden
455
+ * dort "0, 0.5, 1" und dazwischen Werte, die es nicht gibt.
456
+ */
457
+ tickValues?: number[];
458
+ /**
459
+ * Zwischenstriche je Hauptabstand (0 = keine). Sie tragen keine
460
+ * Beschriftung und sind halb so lang -- ein Zwischenstrich, der aussieht wie
461
+ * ein Hauptstrich, ist eine Behauptung ueber die Skala, die nicht stimmt.
462
+ */
463
+ minorTicks?: number;
464
+ /**
465
+ * Breite der Leinwand und Textmetrik -- beides zusammen haelt die
466
+ * Tick-Beschriftungen IN der Zeichenflaeche.
467
+ *
468
+ * Ohne sie bleibt es beim alten Verhalten. Mit ihnen rutscht eine
469
+ * Beschriftung, fuer die der Rand zu schmal bestellt ist, nach innen statt
470
+ * aus dem Bild: dort ueberdeckt sie etwas und ist zu sehen, draussen ist sie
471
+ * weg. Dieselbe Entscheidung wie bei den Schwellwert-Beschriftungen.
472
+ */
473
+ gesamtbreite?: number;
474
+ metrics?: TextMetrics;
338
475
  }
339
476
  /** Tick information for value axis with computed positions and formatted labels. */
340
477
  interface ValueTickInfo {
@@ -356,6 +493,8 @@ declare class ValueAxis {
356
493
  get textSize(): number;
357
494
  /** Generate nicely-spaced tick values. */
358
495
  generateTicks(): ValueTickInfo[];
496
+ /** Positionen der Zwischenstriche in Pixeln. */
497
+ generateMinorTicks(): number[];
359
498
  /** Render axis as draw commands. */
360
499
  render(): DrawCommand[];
361
500
  }
@@ -367,7 +506,7 @@ declare class ValueAxis {
367
506
  */
368
507
 
369
508
  /** Moving average type */
370
- type MovingAvgType = "simple" | "exponential";
509
+ type MovingAvgType = MovingAverageType;
371
510
  interface MovingAvgConfig {
372
511
  /** Data points */
373
512
  data: DataPoint[];
@@ -477,8 +616,10 @@ interface LineSeriesConfig {
477
616
  timeScale: TimeScale;
478
617
  /** Value scale for Y-axis mapping */
479
618
  valueScale: LinearScale;
480
- /** Enable curve smoothing (Catmull-Rom spline) */
619
+ /** Enable curve smoothing */
481
620
  smoothing?: boolean;
621
+ /** Which spline when `smoothing` is on. Default `"catmull-rom"`. */
622
+ smoothingType?: SmoothingType;
482
623
  /** Stroke color */
483
624
  stroke?: string;
484
625
  /** Stroke width in pixels */
@@ -557,7 +698,7 @@ interface BandSeriesConfig extends BaseConfig {
557
698
  /** Fill color for the band */
558
699
  fill?: string;
559
700
  /** Hatch pattern for the band fill */
560
- hatch?: string;
701
+ hatch?: HatchVariant;
561
702
  /** Opacity based on count (0-1) */
562
703
  countOpacity?: boolean;
563
704
  /** Show average line inside band */
@@ -607,8 +748,10 @@ interface MinMaxAvgConfig {
607
748
  fillToMin?: string;
608
749
  /** Hatch pattern for fillToMin */
609
750
  fillToMinHatch?: HatchVariant;
610
- /** Catmull-Rom smoothing for the lines */
751
+ /** Curve smoothing for the lines */
611
752
  smoothing?: boolean;
753
+ /** Which spline when `smoothing` is on. Default `"catmull-rom"`. */
754
+ smoothingType?: SmoothingType;
612
755
  /** Stroke width in px (default 2) */
613
756
  strokeWidth?: number;
614
757
  /** SVG id prefix for elements. Generated ids: `<id>-max`, `<id>-min`, `<id>-avg`, `<id>-fillToMax`, `<id>-fillToMin`. */
@@ -639,9 +782,9 @@ interface Zone {
639
782
  /** Fill the area between the line and a threshold value, on one side. */
640
783
  interface ZonedFill {
641
784
  value: number;
642
- side: "above" | "below";
785
+ side: FillSide;
643
786
  color: string;
644
- hatch?: string;
787
+ hatch?: HatchVariant;
645
788
  }
646
789
  /** Configuration for rendering zoned line charts with per-segment colors and optional fills. */
647
790
  interface ZonedLineConfig {
@@ -656,6 +799,8 @@ interface ZonedLineConfig {
656
799
  fill?: ZonedFill;
657
800
  strokeWidth?: number;
658
801
  smoothing?: boolean;
802
+ /** Which spline when `smoothing` is on. Default `"catmull-rom"`. */
803
+ smoothingType?: SmoothingType;
659
804
  /** Max time gap (ms) before the line breaks; 0 = off. */
660
805
  gapThreshold?: number;
661
806
  pointStyle?: PointStyleType;
@@ -856,7 +1001,8 @@ interface ResolvedLine {
856
1001
  width: number;
857
1002
  style: LineVariant;
858
1003
  smoothing: boolean;
859
- shape: "line" | "step";
1004
+ smoothingType?: SmoothingType;
1005
+ shape: LineShape;
860
1006
  gapThreshold: number;
861
1007
  opacity: number;
862
1008
  }
@@ -906,4 +1052,4 @@ declare function resolveFill(series: TimeSeries): FillSpec | undefined;
906
1052
  */
907
1053
  declare function resolveSeriesStyle(series: TimeSeries): ResolvedSeriesStyle;
908
1054
 
909
- export { AnnotationBandSeries, type AnnotationRenderConfig, BandScale, BandSeries, type BandSeriesConfig, Clip, type ClipRegion, DrawCommand, EnumAxis, type EnumAxisConfig, EnumFormatter, type EnumFormatterOptions, type EnumTickInfo, Formatters, type GapRenderConfig, type GridConfig, type HighlightRenderConfig, LineSeries, type LineSeriesConfig, LinearScale, type MarkerRenderConfig, type MinMaxAvgConfig, MinMaxAvgSeries, MovingAvg, type MovingAvgConfig, type MovingAvgType, type ResolvedLine, type ResolvedMarker, type ResolvedSeriesStyle, type ResolvedShadow, type StatLabelPosition, StatsOverlay, type StatsOverlayConfig, StepSeries, type StepSeriesConfig, type ThresholdRenderConfig, type TickInfo, TimeAxis, type TimeAxisConfig, type TimeFormatOptions, TimeFormatter, TimeScale, ValueAxis, type ValueAxisConfig, type ValueFormatOptions, ValueFormatter, type ValueTickInfo, type Zone, type ZonedFill, type ZonedLineConfig, ZonedLineSeries, renderAnnotations, renderGaps, renderGrid, renderHighlights, renderMarkers, renderThresholds, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, theme };
1055
+ export { AnnotationBandSeries, type AnnotationRenderConfig, AxisOrientation, AxisPosition, BandScale, BandSeries, type BandSeriesConfig, CircleParams, Clip, type ClipRegion, CommandBuilder, DrawCommand, DrawGroup, EnumAxis, type EnumAxisConfig, EnumFormatter, type EnumFormatterOptions, type EnumTickInfo, Formatters, GapParams, type GapRenderConfig, type GridConfig, type GroupParams, type HighlightRenderConfig, LineParams, LineSeries, type LineSeriesConfig, LinearScale, type MarkerRenderConfig, type MinMaxAvgConfig, MinMaxAvgSeries, MovingAvg, type MovingAvgConfig, type MovingAvgType, PathParams, RectParams, type ResolvedLine, type ResolvedMarker, type ResolvedSeriesStyle, type ResolvedShadow, type StatLabelPosition, StatsOverlay, type StatsOverlayConfig, StepSeries, type StepSeriesConfig, TextParams, type ThresholdRenderConfig, type TickInfo, TimeAxis, type TimeAxisConfig, type TimeFormatOptions, TimeFormatter, TimeScale, ValueAxis, type ValueAxisConfig, type ValueFormatOptions, ValueFormatter, type ValueTickInfo, type Zone, type ZonedFill, type ZonedLineConfig, ZonedLineSeries, renderAnnotations, renderArea, renderGaps, renderGrid, renderHighlights, renderLine, renderMarkers, renderSplitLine, renderStep, renderThresholds, renderZonedArea, resolveFill, resolveGap, resolveLines, resolveMarkers, resolveSeriesStyle, resolveShadow, theme, toStepData, toStepPoints };
package/dist/internals.js CHANGED
@@ -1,30 +1,30 @@
1
- var N=class{};var x=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))}}static interpolateAggregatedPoint(i,e,t){let n=(o,r)=>o!==null&&r!==null?o+t*(r-o):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((l,a)=>l.time-a.time),o=[],r=[],s=null;for(let l of n){let a=e(l),m=t>0&&s&&l.time-s.time>t;(a||m)&&r.length&&(o.push(r),r=[]),a||r.push(l),s=l;}return r.length&&o.push(r),o}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 o=[...e].sort((m,u)=>m-u),r=[],s=m=>m<=0?Number.NEGATIVE_INFINITY:o[m-1],l=m=>{let u=0;for(let c=0;c<o.length&&m>=o[c];c++)u=c+1;return u},a=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],c=i[m],d=t(u),h=t(c),f;h>d?f=o.filter(y=>y>d&&y<=h):h<d?f=o.filter(y=>y>=h&&y<d).reverse():f=[];let g=d;for(let y of f){let b=(y-d)/(h-d),S=n(u,c,b);a.push(S);let T=l((g+y)/2);r.push({data:a,zoneIndex:T,zoneLow:s(T)}),a=[S],g=y;}(f.length===0||f[f.length-1]!==h)&&a.push(c);}if(a.length>1||i.length===1){let m=t(a[0]),u=t(a[a.length-1]),c=l((m+u)/2);r.push({data:a,zoneIndex:c,zoneLow:s(c)});}return r}static splitByThreshold(i,e,t,n){let o=this.splitByBoundaries(i,[e],t,n),r={above:[],below:[]};for(let s of o)s.zoneIndex===0?r.below.push(s.data):r.above.push(s.data);return r}};var ue=class{static compute(i){let e=i.map(l=>l.value).filter(l=>l!==null).sort((l,a)=>l-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((l,a)=>l+a,0)/t,o=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,r=e.reduce((l,a)=>l+Math.pow(a-n,2),0)/t,s=Math.sqrt(r);return {min:e[0],max:e[t-1],avg:n,mean:n,median:o,stdDev:s,count:t}}static computeInRange(i,e,t){let n=i.filter(o=>o.time>=e&&o.time<=t);return this.compute(n)}};var ce={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,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 ve={...ce};function C(){return ve}function ke(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 we(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function de(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,o=2){let r=n??ke(t),s=we(t)?"":' fill-opacity="0.3"';if(e==="none")return `
1
+ var Y=class{};var x=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((l,s)=>l.time-s.time),r=[],o=[],a=null;for(let l of n){let s=e(l),m=t>0&&a&&l.time-a.time>t;(s||m)&&o.length&&(r.push(o),o=[]),s||o.push(l),a=l;}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,u)=>m-u),o=[],a=m=>m<=0?Number.NEGATIVE_INFINITY:r[m-1],l=m=>{let u=0;for(let c=0;c<r.length&&m>=r[c];c++)u=c+1;return u},s=[i[0]];for(let m=1;m<i.length;m++){let u=i[m-1],c=i[m],h=t(u),f=t(c),d;f>h?d=r.filter(y=>y>h&&y<=f):f<h?d=r.filter(y=>y>=f&&y<h).reverse():d=[];let g=h;for(let y of d){let b=(y-h)/(f-h),S=n(u,c,b);s.push(S);let C=l((g+y)/2);o.push({data:s,zoneIndex:C,zoneLow:a(C)}),s=[S],g=y;}(d.length===0||d[d.length-1]!==f)&&s.push(c);}if(s.length>1||i.length===1){let m=t(s[0]),u=t(s[s.length-1]),c=l((m+u)/2);o.push({data:s,zoneIndex:c,zoneLow:a(c)});}return o}static splitByThreshold(i,e,t,n){let r=this.splitByBoundaries(i,[e],t,n),o={above:[],below:[]};for(let a of r)a.zoneIndex===0?o.below.push(a.data):o.above.push(a.data);return o}};var fe=class{static compute(i){let e=i.map(l=>l.value).filter(l=>l!==null).sort((l,s)=>l-s);if(e.length===0)return {min:NaN,max:NaN,avg:NaN,mean:NaN,median:NaN,stdDev:NaN,count:0};let t=e.length,n=e.reduce((l,s)=>l+s,0)/t,r=t%2===1?e[Math.floor(t/2)]:(e[t/2-1]+e[t/2])/2,o=e.reduce((l,s)=>l+Math.pow(s-n,2),0)/t,a=Math.sqrt(o);return {min:e[0],max:e[t-1],avg:n,mean:n,median:r,stdDev:a,count:t}}static computeInRange(i,e,t){let n=i.filter(r=>r.time>=e&&r.time<=t);return this.compute(n)}};function U(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 Pe(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 D(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,smoothingType:i.smoothingType,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function $e(i,e,t,n){let r=x.splitByThreshold(i,e,a=>a.value,x.interpolateDataPoint),o=[];return n.below&&o.push(...v(r.below.map(a=>({data:a})),t,n.below)),n.above&&o.push(...v(r.above.map(a=>({data:a})),t,n.above)),o}function v(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];a.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:a.data.map(l=>({x:e.timeScale.map(l.time),y:e.valueScale.map(l.value)})),stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):a.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${o}`:void 0,cx:e.timeScale.map(a.data[0].time),cy:e.valueScale.map(a.data[0].value),r:Math.max(r.markers.size,r.line.strokeWidth),fill:a.color??r.line.stroke,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur});}return n}function q(i,e,t){let n=[],r=D(t);for(let o=0;o<i.length;o++){let a=i[o];if(a.data.length<2)continue;let l=U(a.data.map(s=>({x:e.timeScale.map(s.time),y:e.valueScale.map(s.value)})));n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${o}`:void 0,points:l,stroke:a.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Ae(i,e,t,n,r){let o=[],a=D(t);for(let l=0;l<i.length;l++){let s=i[l];if(s.data.length<2)continue;let m=s.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=s.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-${l}`:void 0,points:[...m,...u],fill:s.color??a.fill,hatch:t.hatch,stroke:"none"});}return o}function z(i,e,t,n){if(i.length<2)return [];let r=x.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),o=[];for(let a=0;a<r.length;a++){let l=r[a];if(l.data.length<2)continue;let s=t.getColor(l.zoneIndex);if(!s)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();o.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${a}`:void 0,points:[...m,...u],fill:s,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return o}function R(i,e,t,n){let r=D(t);if(!r.markers.type||r.markers.type==="none")return [];let o=[];for(let a=0;a<i.length;a++){let l=i[a],s=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,h=t.pointFill??u,f=t.pointStrokeWidth??1.5,d=t.id?`${t.id}-marker-${a}`:void 0;K(o,d,r.markers.type,s,m,r.markers.size,c,h,f);}return o}function K(i,e,t,n,r,o,a,l,s){let m=u=>e===void 0?void 0:`${e}-${u}`;switch(t){case "circle":i.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:a,strokeWidth:s,id:e});break;case "square":i.push({type:"rect",x:n-o,y:r-o,w:o*2,h:o*2,fill:l,stroke:a,strokeWidth:s,id:e});break;case "cross":i.push({type:"line",x1:n-o,y1:r-o,x2:n+o,y2:r+o,stroke:a,strokeWidth:s,id:e},{type:"line",x1:n-o,y1:r+o,x2:n+o,y2:r-o,stroke:a,strokeWidth:s,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:l,stroke:a,strokeWidth:s,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:l,stroke:a,strokeWidth:s,id:e});break;case "star":{let u=[];for(let c=0;c<10;c++){let h=c%2===0?o:o*.5,f=Math.PI/2*3+c*Math.PI/5;u.push({x:n+h*Math.cos(f),y:r+h*Math.sin(f)});}i.push({type:"path",points:u,closed:true,fill:l,stroke:a,strokeWidth:s,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:a,strokeWidth:s,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:s,id:e},{type:"line",x1:n,y1:r-o,x2:n,y2:r+o,stroke:a,strokeWidth:s,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:l,stroke:a,strokeWidth:s,id:e});break;case "hexagon":{let u=[];for(let c=0;c<6;c++){let h=c*(Math.PI/3);u.push({x:n+o*Math.cos(h),y:r+o*Math.sin(h)});}i.push({type:"path",points:u,closed:true,fill:l,stroke:a,strokeWidth:s,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:l,stroke:a,strokeWidth:s,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-o,y1:r,x2:n+o,y2:r,stroke:a,strokeWidth:s,id:e});break;default:i.push({type:"circle",cx:n,cy:r,r:o,fill:l,stroke:a,strokeWidth:s,id:e});}}var Fe=[[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"]],ge=.6,Re=(()=>{let i=new Map;for(let[e,,t]of Fe){let n=t.split(",");for(let r=0;r<n.length;r++)i.set(e+r,Number(n[r])/1e3);}return i})();function ye(i){return Re.get(i)??ge}var J=(i,e)=>{let t=0;for(let n of i)t+=ye(n.codePointAt(0)??0);return t*e};var be={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 We={...be};function M(){return We}function je(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 Oe(i){let e=i.trim().toLowerCase();return e.startsWith("#")?e.length===9||e.length===5:e.startsWith("rgba(")||e.startsWith("hsla(")}function xe(i,e="classic-diagonal",t="rgba(200, 220, 255, 0.3)",n,r=2){let o=n??je(t),a=Oe(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 l=12,a=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":l=12,a=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "dense-steep":l=6,a=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />`;break;case "crosshatch":l=14,a=14,m="rotate(45)",u=`
6
- <line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
7
- <line x1="0" y1="0" x2="${l}" y2="0" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
8
- `;break;case "dots":l=12,a=12,u=`<circle cx="${l/2}" cy="${a/2}" r="${o*1.2}" fill="${r}" />`;break;case "waves":l=16,a=16,u=`
9
- <path d="M 0 ${a/2} Q ${l/4} 0, ${l/2} ${a/2} T ${l} ${a/2}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linecap="round" />
10
- `;break;case "dashed":l=12,a=12,m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,a=16,u=`
11
- <path d="M 0 0 L ${l/2} ${a/2} L 0 ${a} M ${l} 0 L ${l/2} ${a/2} L ${l} ${a}" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
12
- `;break;case "brick":l=20,a=20,u=`
13
- <path d="M 0 ${a/2} L ${l} ${a/2} M 0 ${a} L ${l} ${a} M ${l/2} 0 L ${l/2} ${a/2} M 0 ${a/2} L 0 ${a}" fill="none" stroke="${r}" stroke-width="${o}" />
14
- `;break;case "double-stripe":l=16,a=16,m="rotate(45)",u=`
15
- <line x1="0" y1="0" x2="0" y2="${a}" stroke="${r}" stroke-width="${o}" stroke-linecap="square" />
16
- <line x1="${l/2}" y1="0" x2="${l/2}" y2="${a}" stroke="${r}" stroke-width="${o/2}" stroke-linecap="square" />
17
- `;break;case "honeycomb":l=18,a=32,u=`
18
- <path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${r}" stroke-width="${o}" stroke-linejoin="round" stroke-linecap="round" />
19
- `;break}let c=`<rect width="${l}" height="${a}" fill="${t}"${s} />`;return `
20
- <pattern id="${i}" width="${l}" height="${a}" patternTransform="${m}" patternUnits="userSpaceOnUse">
5
+ `.trim();let l=12,s=12,m="rotate(0)",u="";switch(e){case "classic-diagonal":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${s}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "dense-steep":l=6,s=6,m="rotate(30)",u=`<line x1="0" y1="0" x2="0" y2="${s}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />`;break;case "crosshatch":l=14,s=14,m="rotate(45)",u=`
6
+ <line x1="0" y1="0" x2="0" y2="${s}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
7
+ <line x1="0" y1="0" x2="${l}" y2="0" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
8
+ `;break;case "dots":u=`<circle cx="${l/2}" cy="${s/2}" r="${r*1.2}" fill="${o}" />`;break;case "waves":l=16,s=16,u=`
9
+ <path d="M 0 ${s/2} Q ${l/4} 0, ${l/2} ${s/2} T ${l} ${s/2}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linecap="round" />
10
+ `;break;case "dashed":m="rotate(45)",u=`<line x1="0" y1="0" x2="0" y2="${s}" stroke="${o}" stroke-width="${r}" stroke-dasharray="3,3" />`;break;case "herringbone":l=16,s=16,u=`
11
+ <path d="M 0 0 L ${l/2} ${s/2} L 0 ${s} M ${l} 0 L ${l/2} ${s/2} L ${l} ${s}" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
12
+ `;break;case "brick":l=20,s=20,u=`
13
+ <path d="M 0 ${s/2} L ${l} ${s/2} M 0 ${s} L ${l} ${s} M ${l/2} 0 L ${l/2} ${s/2} M 0 ${s/2} L 0 ${s}" fill="none" stroke="${o}" stroke-width="${r}" />
14
+ `;break;case "double-stripe":l=16,s=16,m="rotate(45)",u=`
15
+ <line x1="0" y1="0" x2="0" y2="${s}" stroke="${o}" stroke-width="${r}" stroke-linecap="square" />
16
+ <line x1="${l/2}" y1="0" x2="${l/2}" y2="${s}" stroke="${o}" stroke-width="${r/2}" stroke-linecap="square" />
17
+ `;break;case "honeycomb":l=18,s=32,u=`
18
+ <path d="M 0 0 L ${l/2} 5 L ${l} 0 M 0 16 L ${l/2} 11 L ${l} 16 M 0 16 L 0 32 M ${l/2} 5 L ${l/2} 11 M ${l} 16 L ${l} 32 M 0 32 L ${l/2} 27 L ${l} 32 M ${l/2} 27 L ${l/2} 32" fill="none" stroke="${o}" stroke-width="${r}" stroke-linejoin="round" stroke-linecap="round" />
19
+ `;break}let c=`<rect width="${l}" height="${s}" fill="${t}"${a} />`;return `
20
+ <pattern id="${i}" width="${l}" height="${s}" patternTransform="${m}" patternUnits="userSpaceOnUse">
21
21
  ${c}
22
22
  ${u}
23
23
  </pattern>
24
- `.trim()}var p=new Proxy({},{get:(i,e)=>C()[e],has:(i,e)=>e in C(),ownKeys:()=>Reflect.ownKeys(C()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(C(),e)});function B(i){return {id:i.id,line:{stroke:i.stroke??p.stroke,strokeWidth:i.strokeWidth??p.strokeWidth,smoothing:i.smoothing??false,dashed:i.dashed??false},fill:i.fill??p.areaFillAlpha,markers:{type:i.pointStyle??"none",size:i.pointSize??p.pointSize,stroke:i.stroke??p.stroke,fill:"#ffffff"},shadow:{color:i.shadowColor??"transparent",blur:i.shadowBlur??0,offsetX:i.shadowOffsetX??0,offsetY:i.shadowOffsetY??0}}}function w(i,e,t){let n=[];i.reduce((s,l)=>s+l.data.length,0);let r=B(t);for(let s=0;s<i.length;s++){let l=i[s];l.data.length>=2?n.push({type:"path",cssClass:"series-line",id:t.id?`${t.id}-line-${s}`:void 0,points:l.data.map(a=>({x:e.timeScale.map(a.time),y:e.valueScale.map(a.value)})),stroke:l.color??r.line.stroke,strokeWidth:r.line.strokeWidth,smoothing:r.line.smoothing,dashed:r.line.dashed,shadowColor:r.shadow.color,shadowBlur:r.shadow.blur,shadowOffsetX:r.shadow.offsetX,shadowOffsetY:r.shadow.offsetY,fill:"none"}):l.data.length===1&&n.push({type:"circle",id:t.id?`${t.id}-dot-${s}`: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 he(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 Ce(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 z(i,e,t){let n=[],o=B(t);for(let r=0;r<i.length;r++){let s=i[r];if(s.data.length<2)continue;let l=he(s.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-${r}`:void 0,points:l,stroke:s.color??o.line.stroke,strokeWidth:o.line.strokeWidth,smoothing:false,fill:"none"});}return n}function Te(i,e,t,n,o){let r=[],s=B(t);for(let l=0;l<i.length;l++){let a=i[l];if(a.data.length<2)continue;let m=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(n(c))})),u=a.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(o(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:t.id?`${t.id}-fill-${l}`:void 0,points:[...m,...u],fill:a.color??s.fill,hatch:t.hatch,stroke:"none"});}return r}function H(i,e,t,n){if(i.length<2)return [];let o=x.splitByBoundaries(i,t.boundaries,t.getValue,t.interpolate),r=[];for(let s=0;s<o.length;s++){let l=o[s];if(l.data.length<2)continue;let a=t.getColor(l.zoneIndex);if(!a)continue;let m=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yLow(c))})),u=l.data.map(c=>({x:e.timeScale.map(c.time),y:e.valueScale.map(t.yHigh(c))})).reverse();r.push({type:"path",cssClass:"series-fill",id:n?.id?`${n.id}-fill-${s}`:void 0,points:[...m,...u],fill:a,hatch:t.getHatch?.(l.zoneIndex),stroke:"none"});}return r}function Le(i,e,t,n){let o=x.splitByThreshold(i,e,s=>s.value,x.interpolateDataPoint),r=[];return n.below&&r.push(...w(o.below.map(s=>({data:s})),t,n.below)),n.above&&r.push(...w(o.above.map(s=>({data:s})),t,n.above)),r}function P(i,e,t,n){let o=B(t);if(!o.markers.type||o.markers.type==="none")return [];let r=[];for(let s=0;s<i.length;s++){let l=i[s],a=e.timeScale.map(l.time),m=e.valueScale.map(l.value),u=n(l),c=t.pointStroke??u,d=t.pointFill??u,h=t.pointStrokeWidth??1.5,f=t.id?`${t.id}-marker-${s}`:void 0;G(r,f,o.markers.type,a,m,o.markers.size,c,d,h);}return r}function G(i,e,t,n,o,r,s,l,a){switch(t){case "circle":i.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:a,id:e});break;case "square":i.push({type:"rect",x:n-r,y:o-r,w:r*2,h:r*2,fill:l,stroke:s,strokeWidth:a,id:e});break;case "cross":i.push({type:"line",x1:n-r,y1:o-r,x2:n+r,y2:o+r,stroke:s,strokeWidth:a,id:e},{type:"line",x1:n-r,y1:o+r,x2:n+r,y2:o-r,stroke:s,strokeWidth:a,id:e});break;case "diamond":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o},{x:n,y:o+r},{x:n-r,y:o}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "triangle":i.push({type:"path",points:[{x:n,y:o-r},{x:n+r,y:o+r},{x:n-r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "star":{let m=[];for(let u=0;u<10;u++){let c=u%2===0?r:r*.5,d=Math.PI/2*3+u*Math.PI/5;m.push({x:n+c*Math.cos(d),y:o+c*Math.sin(d)});}i.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break}case "arrow":i.push({type:"path",points:[{x:n-r,y:o+r},{x:n,y:o-r},{x:n+r,y:o+r}],stroke:s,strokeWidth:a,fill:"none",id:e});break;case "plus":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:a,id:e},{type:"line",x1:n,y1:o-r,x2:n,y2:o+r,stroke:s,strokeWidth:a,id:e});break;case "triangle-down":i.push({type:"path",points:[{x:n,y:o+r},{x:n+r,y:o-r},{x:n-r,y:o-r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "hexagon":{let m=[];for(let u=0;u<6;u++){let c=u*(Math.PI/3);m.push({x:n+r*Math.cos(c),y:o+r*Math.sin(c)});}i.push({type:"path",points:m,closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break}case "hourglass":i.push({type:"path",points:[{x:n-r,y:o-r},{x:n+r,y:o-r},{x:n-r,y:o+r},{x:n+r,y:o+r}],closed:true,fill:l,stroke:s,strokeWidth:a,id:e});break;case "line-horizontal":i.push({type:"line",x1:n-r,y1:o,x2:n+r,y2:o,stroke:s,strokeWidth:a,id:e});break;default:i.push({type:"circle",cx:n,cy:o,r,fill:l,stroke:s,strokeWidth:a,id:e});}}var L=12,V=8,Y=20,Me=11,Z=18,X=i=>[...i].length*Me*.6;function De(i,e="vertical"){if(e==="horizontal"){let n=0;for(let o of i)n+=L+V+X(o.name)+Z;return {width:Math.max(0,n-Z),height:Y}}let t=0;for(let n of i)t=Math.max(t,X(n.name));return {width:L+V+t,height:i.length*Y}}function _e(i){let{items:e,x:t,y:n,orientation:o="vertical"}=i,r=[],s=t;return e.forEach((l,a)=>{let m=o==="horizontal"?s:t,u=o==="horizontal"?n:n+a*Y;r.push({type:"rect",x:m,y:u,w:L,h:L,fill:l.color,stroke:p.legendStroke,strokeWidth:1},{type:"text",content:l.name,x:m+L+V,y:u+L-2,fontSize:p.legendFont,fill:p.legendText}),o==="horizontal"&&(s+=L+V+X(l.name)+Z);}),{type:"group",cssClass:"chart-legend",commands:r}}function $e(i){let{xTicks:e,yTicks:t,xRange:n,yRange:o,stroke:r=p.gridStroke,strokeWidth:s=p.gridStrokeWidth,dashed:l=false,opacity:a=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:r,strokeWidth:s,dashed:l,opacity:a});if(e)for(let u of e)m.push({type:"line",x1:u,y1:o[0],x2:u,y2:o[1],stroke:r,strokeWidth:s,dashed:l,opacity:a});return m}var pe=new Map;function Pe(i,e){return `${i}|${JSON.stringify(e??{})}`}function F(i,e){let t=Pe(i,e),n=pe.get(t);return n||(n=new Intl.DateTimeFormat(i,e),pe.set(t,n)),n}var M=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,o]=this.#e,[r,s]=this.#t;return o===n?r:r+(t-n)/(o-n)*(s-r)}invert(e){let[t,n]=this.#e,[o,r]=this.#t;return r===o?t:t+(e-o)/(r-o)*(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}],R=class{#e;#t;#n;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[o,r]=this.#e.domain(),s=r-o;if(s<=0)return {interval:v[0].ms};let l=s/e,a=v[0].ms;for(let c of v)if(c.ms>=l){a=c.ms;break}let m=a,u=Math.round(s/m);for(;u>n&&m<v[v.length-1].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.min(c+1,v.length-1)].ms,u=Math.round(s/m);}for(;u<t&&m>v[0].ms;){let c=v.findIndex(d=>d.ms===m);m=v[Math.max(c-1,0)].ms,u=Math.round(s/m);}return {interval:m}}ticks(e){let t=e?.minTicks??5,n=e?.maxTicks??12,{interval:o}=this.tickInterval((t+n)/2,t,n),[r,s]=this.#e.domain(),l=[],a=Math.ceil(r/o)*o;for(let m=a;m<=s;m+=o)l.push(m);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return F(this.#t,n).format(new Date(e))}},A=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 o=this.#r*2*Math.abs(t-e);return (Math.abs(t-e)-o)/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,o]=this.#t,r=this.#e.length;if(r<=1)return (n+o)/2;let s=this.#r*2*Math.abs(o-n),l=Math.abs(o-n)-s,a=o>=n?1:-1,m=l/r;return n+this.#r*Math.abs(o-n)*a+t*m}invert(e){let t=0,n=1/0;for(let o=0;o<this.#e.length;o++){let r=this.map(this.#e[o]),s=Math.abs(e-r);s<n&&(n=s,t=o);}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 Fe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Re(i){let{thresholds:e,valueScale:t,xRange:n}=i,[o,r]=n,[s,l]=t.range(),a=Math.min(s,l),m=Math.max(s,l),u=[],c=[];for(let d of e){let h=d.color??p.thresholdColor,f=t.map(d.value);d.fill==="above"?u.push({type:"rect",x:o,y:a,w:r-o,h:Math.max(0,f-a),fill:h,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0}):d.fill==="below"&&u.push({type:"rect",x:o,y:f,w:r-o,h:Math.max(0,m-f),fill:h,hatch:d.fillHatch,opacity:d.fillOpacity??.12,id:d.id?`${d.id}-fill`:void 0});let g=d.line??p.thresholdLine;if(g!=="none"){let y=Fe(g),b={type:"line",x1:o,y1:f,x2:r,y2:f,stroke:h,strokeWidth:1,...y,id:d.id?`${d.id}-line`:void 0};d.shadowColor&&(b.shadowColor=d.shadowColor,b.shadowBlur=d.shadowBlur??4,b.shadowOffsetX=d.shadowOffsetX??0,b.shadowOffsetY=d.shadowOffsetY??2),u.push(b);}if(d.label!==void 0&&d.label!==null&&d.label!==false){let y=typeof d.label=="object"?d.label:void 0,b=typeof d.label=="string"?d.label:y?.text??d.name,S=y?.position??"right",T=je(b,S,o,r,f,h,y);c.push({...T,y:We(T.y,Math.min(s,l),Math.max(s,l),p.thresholdFontSize),id:d.id?`${d.id}-label`:void 0});}}return {inside:u,labels:c}}function Ae(i){let e=Re(i);return [...e.inside,...e.labels]}function We(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function je(i,e,t,n,o,r,s){let l=(t+n)/2,a={type:"text",content:i,fontSize:p.thresholdFontSize,fill:r},m=s?{...s.rotate!==void 0&&{rotate:s.rotate},...s.textBaseline!==void 0&&{textBaseline:s.textBaseline}}:{};switch(e){case "left":return {...a,...m,x:t+4,y:o-4,anchor:"start"};case "above":return {...a,...m,x:l,y:o-6,anchor:"middle"};case "below":return {...a,...m,x:l,y:o+14,anchor:"middle"};case "center":return {...a,...m,x:l,y:o-4,anchor:"middle"};case "outside-left":return {...a,...m,x:t-6,y:o+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...a,...m,x:n+6,y:o+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...a,...m,x:n-4,y:o-4,anchor:"end"}}}function fe(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 E(i){let{ranges:e,timeScale:t,yRange:n,height:o}=i,[r,s]=n,l=[],[a,m]=t.range(),u=Math.min(a,m),c=Math.max(a,m),d=h=>Math.max(u,Math.min(c,h));for(let h of e){let f=d(t.map(h.startTime)),g=d(t.map(h.endTime));if(h.fill!==void 0&&l.push({type:"rect",x:f,y:r,w:g-f,h:s-r,fill:h.fill,hatch:h.hatch,opacity:h.opacity}),h.edges)for(let y of [f,g])l.push({type:"line",x1:y,y1:r,x2:y,y2:s,stroke:h.edges.stroke,strokeWidth:h.edges.strokeWidth,dash:"dashed"});h.label&&l.push({type:"text",content:h.label,x:(f+g)/2,y:fe(h.labelPosition??"middle",r,s,o),anchor:"middle",fontSize:h.fontSize,fill:h.labelColor,rotate:h.rotate});}return l}function Oe(i){let{gaps:e,timeScale:t,yRange:n,height:o,fill:r=p.gapFill,hatch:s,fillOpacity:l=p.gapFillOpacity??.15,stroke:a=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:c=p.gapFontSize,fontFill:d=p.gapFontColor,labelBaseline:h="middle",labelRotate:f}=i;return E({timeScale:t,yRange:n,height:o,ranges:e.map(g=>{let y=g.style??"dashed_border",b=y==="filled"||y==="dashed_border",S=y==="dashed_border"&&u!==false;return {startTime:g.startTime,endTime:g.endTime,...b&&{fill:g.fill??r,hatch:g.hatch??s,opacity:g.fillOpacity??l},...S&&{edges:{stroke:a,strokeWidth:m}},label:g.label,labelPosition:g.labelBaseline??h,labelColor:d,fontSize:c,rotate:g.rotate??f}})})}function Ie(i){let{markers:e,timeScale:t,valueScale:n,yRange:o=[0,300]}=i,[r,s]=o,l=[];for(let a of e){let m=t.map(a.time),u=a.color??p.markerColor,c=a.pointStyle??(a.value!==void 0?"circle":"none"),d=a.lineStyle??"full";if(a.value!==void 0){let h=n.map(a.value);if(d==="to-value"?l.push({type:"line",x1:m,y1:s,x2:m,y2:h,stroke:u,strokeWidth:1,dashed:true}):d==="to-top"?l.push({type:"line",x1:m,y1:r,x2:m,y2:h,stroke:u,strokeWidth:1,dashed:true}):d==="full"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),c!=="none"&&G(l,void 0,c,m,h,p.markerSize,u,u,1.5),a.label){let f=d==="to-value"?h-10:r-6;l.push({type:"text",content:a.label,x:m,y:f,anchor:"middle",fontSize:11,fill:u});}}else d!=="none"&&l.push({type:"line",x1:m,y1:r,x2:m,y2:s,stroke:u,strokeWidth:1}),a.label&&l.push({type:"text",content:a.label,x:m,y:r-6,anchor:"middle",fontSize:11,fill:u});}return l}function Be(i){let{highlights:e,timeScale:t,yRange:n,height:o}=i;return E({timeScale:t,yRange:n,height:o,ranges:e.map(r=>({startTime:r.startTime,endTime:r.endTime,fill:r.color??p.highlightColor,opacity:r.opacity??p.highlightOpacity,label:r.label,labelPosition:r.labelPosition??"top",labelColor:r.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:r.rotate}))})}function U(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function He(i){let{annotations:e,timeScale:t,valueScales:n}=i,o=[],r=s=>{let l=n.get(s.axis??0)??n.values().next().value;return {x:t.map(s.time),y:l?l.map(s.value):0}};for(let s of e){let l=[],a=m=>l.push(m);switch(s.type){case "line":{let m=r(s.from),u=r(s.to);a({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:s.color??p.annotationColor,strokeWidth:s.width??p.annotationWidth,dash:s.dash});break}case "arrow":{let m=r(s.from),u=r(s.to),c=s.color??p.annotationColor,d=s.headSize??p.annotationHead;a({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:s.width??p.annotationWidth});let h=Math.hypot(u.x-m.x,u.y-m.y)||1,f=(u.x-m.x)/h,g=(u.y-m.y)/h,y=u.x-f*d,b=u.y-g*d;a({type:"path",points:[{x:u.x,y:u.y},{x:y-g*d*.5,y:b+f*d*.5},{x:y+g*d*.5,y:b-f*d*.5}],fill:c,stroke:"none"});break}case "rect":{let m=r(s.from),u=r(s.to);a({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:s.fill??"none",hatch:s.hatch,stroke:s.stroke,opacity:s.opacity});break}case "point":{let m=r(s.at),u=s.color??"#334155",c=s.radius??p.annotationRadius,d=s.shape??"circle";d==="circle"?a({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):d==="square"?a({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(a({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),a({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=r(s.at);a({type:"text",content:s.text,x:m.x+(s.dx??0),y:m.y+(s.dy??0),anchor:s.anchor??"middle",fontSize:p.annotationFontSize,fill:s.color??p.annotationColor,rotate:s.rotate});break}}if(s.id&&l.length>0){let m=U(s.id);o.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else o.push(...l);}return o}var q=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 K=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 p=new Proxy({},{get:(i,e)=>M()[e],has:(i,e)=>e in M(),ownKeys:()=>Reflect.ownKeys(M()),getOwnPropertyDescriptor:(i,e)=>Reflect.getOwnPropertyDescriptor(M(),e)});var W=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 Ie="#ffffff",Be="#cccccc",He=6,Ee=.85,L=12,G=8,j=20,Ve=11,N=18,Q=(i,e)=>e(i,Ve);function Se(i,e,t){let n=l=>L+G+Q(l.name,e);if(t===void 0){let l=i.reduce((s,m)=>s+n(m)+N,0)-N;return [{items:i,breite:Math.max(0,l)}]}let r=[],o=[],a=0;for(let l of i){let s=n(l),m=o.length===0?s:a+N+s;o.length>0&&m>t?(r.push({items:o,breite:a}),o=[l],a=s):(o=[...o,l],a=m);}return o.length>0&&r.push({items:o,breite:a}),r}function ke(i,e="vertical",t=J,n){if(e==="horizontal"){let o=Se(i,t,n);return {width:o.reduce((a,l)=>Math.max(a,l.breite),0),height:o.length*j}}let r=0;for(let o of i)r=Math.max(r,Q(o.name,t));return {width:L+G+r,height:i.length*j}}function ze(i){let{items:e,x:t,y:n,orientation:r="vertical",metrics:o=J,maxBreite:a,box:l}=i,s=new W;if(l&&e.length>0){let c=ke(e,r,o,a),f=((r==="horizontal"?c.height/j:e.length)-1)*j+L,d=l.padding??He,g=l.stroke??Be;s.rect({x:t-d,y:n-d,w:c.width+2*d,h:f+2*d,fill:l.fill??Ie,...g==="none"?{}:{stroke:g,strokeWidth:l.strokeWidth??1},opacity:l.opacity??Ee});}let m=r==="horizontal"?Se(e,o,a):e.map(c=>({items:[c],breite:0})),u=new Map;return m.forEach((c,h)=>{let f=t;for(let d of c.items)u.set(d,{x:f,y:n+h*j}),f+=L+G+Q(d.name,o)+N;}),e.forEach(c=>{let h=u.get(c)??{x:t,y:n},f=h.x,d=h.y;s.rect({x:f,y:d,w:L,h:L,fill:c.color,stroke:p.legendStroke,strokeWidth:1}).text({content:c.name,x:f+L+G,y:d+L-2,fontSize:p.legendFont,fill:p.legendText});}),s.toGroup({cssClass:"chart-legend"})}function Ne(i){let{xTicks:e,yTicks:t,xRange:n,yRange:r,stroke:o=p.gridStroke,strokeWidth:a=p.gridStrokeWidth,dashed:l=false,opacity:s=p.gridOpacity}=i,m=[];if(t)for(let u of t)m.push({type:"line",x1:n[0],y1:u,x2:n[1],y2:u,stroke:o,strokeWidth:a,dashed:l,opacity:s});if(e)for(let u of e)m.push({type:"line",x1:u,y1:r[0],x2:u,y2:r[1],stroke:o,strokeWidth:a,dashed:l,opacity:s});return m}var ve=new Map;function Ge(i,e){return `${i}|${JSON.stringify(e??{})}`}function O(i,e){let t=Ge(i,e),n=ve.get(t);return n||(n=new Intl.DateTimeFormat(i,e),ve.set(t,n)),n}var _=class{#e;#t;constructor(e){this.#e=[...e.domain],this.#t=[...e.range];}map(e){let t=Number(e),[n,r]=this.#e,[o,a]=this.#t;return r===n?o:o+(t-n)/(r-n)*(a-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]}},T=[{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}],I=class{#e;#t;#n;constructor(e){this.#e=new _({domain:e.domain,range:e.range}),this.#t=e.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#n=e.timeZone;}map(e){return this.#e.map(Number(e))}invert(e){return this.#e.invert(e)}domain(){return this.#e.domain()}range(){return this.#e.range()}get timeZone(){return this.#n}get locale(){return this.#t}tickInterval(e,t=3,n=12){let[r,o]=this.#e.domain(),a=o-r;if(a<=0)return {interval:T[0].ms};let l=a/e,s=T[0].ms;for(let c of T)if(c.ms>=l){s=c.ms;break}let m=s,u=Math.round(a/m);for(;u>n&&m<T[T.length-1].ms;){let c=T.findIndex(h=>h.ms===m);m=T[Math.min(c+1,T.length-1)].ms,u=Math.round(a/m);}for(;u<t&&m>T[0].ms;){let c=T.findIndex(h=>h.ms===m);m=T[Math.max(c-1,0)].ms,u=Math.round(a/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,a]=this.#e.domain(),l=[],s=Math.ceil(o/r)*r;for(let m=s;m<=a;m+=r)l.push(m);return l}format(e,t){let n=this.#n?{...t,timeZone:this.#n}:t;return O(this.#t,n).format(new Date(e))}},B=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 a=this.#r*2*Math.abs(r-n),l=Math.abs(r-n)-a,s=r>=n?1:-1,m=l/o;return n+this.#r*Math.abs(r-n)*s+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]),a=Math.abs(e-o);a<n&&(n=a,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 Xe(i){return i==="dotted"?{dash:"dotted"}:i==="dashed"?{dash:"dashed"}:{}}function Ze(i){let{thresholds:e,valueScale:t,xRange:n}=i,[r,o]=n,[a,l]=t.range(),s=Math.min(a,l),m=Math.max(a,l),u=[],c=[];for(let h of e){let f=h.color??p.thresholdColor,d=t.map(h.value);h.fill==="above"?u.push({type:"rect",x:r,y:s,w:o-r,h:Math.max(0,d-s),fill:f,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0}):h.fill==="below"&&u.push({type:"rect",x:r,y:d,w:o-r,h:Math.max(0,m-d),fill:f,hatch:h.fillHatch,opacity:h.fillOpacity??.12,id:h.id?`${h.id}-fill`:void 0});let g=h.line??p.thresholdLine;if(g!=="none"){let C=Xe(g),k={type:"line",x1:r,y1:d,x2:o,y2:d,stroke:f,strokeWidth:1,...C,id:h.id?`${h.id}-line`:void 0};h.shadowColor&&(k.shadowColor=h.shadowColor,k.shadowBlur=h.shadowBlur??4,k.shadowOffsetX=h.shadowOffsetX??0,k.shadowOffsetY=h.shadowOffsetY??2),u.push(k);}let[y,b]=t.domain();if(h.value>=Math.min(y,b)&&h.value<=Math.max(y,b)&&h.label!==void 0&&h.label!==null&&h.label!==false){let C=typeof h.label=="object"?h.label:void 0,k=typeof h.label=="string"?h.label:C?.text??h.name,V=C?.position??"right",pe=qe(k,V,r,o,d,f,C);c.push({...pe,y:Ue(pe.y,Math.min(a,l),Math.max(a,l),p.thresholdFontSize),id:h.id?`${h.id}-label`:void 0});}}return {inside:u,labels:c}}function Ye(i){let e=Ze(i);return [...e.inside,...e.labels]}function Ue(i,e,t,n){return Math.max(e+n,Math.min(t-n/2,i))}function qe(i,e,t,n,r,o,a){let l=(t+n)/2,s={type:"text",content:i,fontSize:p.thresholdFontSize,fill:o},m=a?{...a.rotate!==void 0&&{rotate:a.rotate},...a.textBaseline!==void 0&&{textBaseline:a.textBaseline}}:{};switch(e){case "left":return {...s,...m,x:t+4,y:r-4,anchor:"start"};case "above":return {...s,...m,x:l,y:r-6,anchor:"middle"};case "below":return {...s,...m,x:l,y:r+14,anchor:"middle"};case "center":return {...s,...m,x:l,y:r-4,anchor:"middle"};case "outside-left":return {...s,...m,x:t-6,y:r+3,anchor:"end",textBaseline:m.textBaseline??"middle"};case "outside-right":return {...s,...m,x:n+6,y:r+3,anchor:"start",textBaseline:m.textBaseline??"middle"};default:return {...s,...m,x:n-4,y:r-4,anchor:"end"}}}function Te(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 X(i){let{ranges:e,timeScale:t,yRange:n,height:r}=i,[o,a]=n,l=[],[s,m]=t.range(),u=Math.min(s,m),c=Math.max(s,m),h=f=>Math.max(u,Math.min(c,f));for(let f of e){let d=h(t.map(f.startTime)),g=h(t.map(f.endTime));if(f.fill!==void 0&&l.push({type:"rect",x:d,y:o,w:g-d,h:a-o,fill:f.fill,hatch:f.hatch,opacity:f.opacity}),f.edges)for(let y of [d,g])l.push({type:"line",x1:y,y1:o,x2:y,y2:a,stroke:f.edges.stroke,strokeWidth:f.edges.strokeWidth,dash:"dashed"});f.label&&l.push({type:"text",content:f.label,x:(d+g)/2,y:Te(f.labelPosition??"middle",o,a,r),anchor:"middle",fontSize:f.fontSize,fill:f.labelColor,rotate:f.rotate});}return l}function Ke(i){let{gaps:e,timeScale:t,yRange:n,height:r,fill:o=p.gapFill,hatch:a,fillOpacity:l=p.gapFillOpacity??.15,stroke:s=p.gapStroke,strokeWidth:m=p.gapStrokeWidth,dashed:u=true,fontSize:c=p.gapFontSize,fontFill:h=p.gapFontColor,labelBaseline:f="middle",labelRotate:d}=i;return X({timeScale:t,yRange:n,height:r,ranges:e.map(g=>{let y=g.style??"dashed_border",b=y==="filled"||y==="dashed_border",S=y==="dashed_border"&&u!==false;return {startTime:g.startTime,endTime:g.endTime,...b&&{fill:g.fill??o,hatch:g.hatch??a,opacity:g.fillOpacity??l},...S&&{edges:{stroke:s,strokeWidth:m}},label:g.label,labelPosition:g.labelBaseline??f,labelColor:h,fontSize:c,rotate:g.rotate??d}})})}function Je(i){let{markers:e,timeScale:t,valueScale:n,yRange:r=[0,300]}=i,[o,a]=r,l=[];for(let s of e){let m=t.map(s.time),u=s.color??p.markerColor,c=s.pointStyle??(s.value!==void 0?"circle":"none"),h=s.lineStyle??"full";if(s.value!==void 0){let f=n.map(s.value);if(h==="to-value"?l.push({type:"line",x1:m,y1:a,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):h==="to-top"?l.push({type:"line",x1:m,y1:o,x2:m,y2:f,stroke:u,strokeWidth:1,dashed:true}):h==="full"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),c!=="none"&&K(l,void 0,c,m,f,p.markerSize,u,u,1.5),s.label){let d=h==="to-value"?f-10:o-6;l.push({type:"text",content:s.label,x:m,y:d,anchor:"middle",fontSize:p.markerFontSize,fill:u});}}else h!=="none"&&l.push({type:"line",x1:m,y1:o,x2:m,y2:a,stroke:u,strokeWidth:1}),s.label&&l.push({type:"text",content:s.label,x:m,y:o-6,anchor:"middle",fontSize:p.markerFontSize,fill:u});}return l}function Qe(i){let{highlights:e,timeScale:t,yRange:n,height:r}=i;return X({timeScale:t,yRange:n,height:r,ranges:e.map(o=>({startTime:o.startTime,endTime:o.endTime,fill:o.color??p.highlightColor,opacity:o.opacity??p.highlightOpacity,label:o.label,labelPosition:o.labelPosition??"top",labelColor:o.color??p.highlightLabelColor,fontSize:p.annotationFontSize,rotate:o.rotate}))})}function ee(i){return i&&i.toString().normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,50)||"unnamed"}function et(i){let{annotations:e,timeScale:t,valueScales:n}=i,r=[],o=a=>{let l=n.get(a.axis??0)??n.values().next().value;return {x:t.map(a.time),y:l?l.map(a.value):0}};for(let a of e){let l=[],s=m=>l.push(m);switch(a.type){case "line":{let m=o(a.from),u=o(a.to);s({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:a.color??p.annotationColor,strokeWidth:a.width??p.annotationWidth,dash:a.dash});break}case "arrow":{let m=o(a.from),u=o(a.to),c=a.color??p.annotationColor,h=a.headSize??p.annotationHead;s({type:"line",x1:m.x,y1:m.y,x2:u.x,y2:u.y,stroke:c,strokeWidth:a.width??p.annotationWidth});let f=Math.hypot(u.x-m.x,u.y-m.y)||1,d=(u.x-m.x)/f,g=(u.y-m.y)/f,y=u.x-d*h,b=u.y-g*h;s({type:"path",points:[{x:u.x,y:u.y},{x:y-g*h*.5,y:b+d*h*.5},{x:y+g*h*.5,y:b-d*h*.5}],fill:c,stroke:"none"});break}case "rect":{let m=o(a.from),u=o(a.to);s({type:"rect",x:Math.min(m.x,u.x),y:Math.min(m.y,u.y),w:Math.abs(u.x-m.x),h:Math.abs(u.y-m.y),fill:a.fill??"none",hatch:a.hatch,stroke:a.stroke,opacity:a.opacity});break}case "point":{let m=o(a.at),u=a.color??"#334155",c=a.radius??p.annotationRadius,h=a.shape??"circle";h==="circle"?s({type:"circle",cx:m.x,cy:m.y,r:c,fill:u}):h==="square"?s({type:"rect",x:m.x-c,y:m.y-c,w:c*2,h:c*2,fill:u}):(s({type:"line",x1:m.x-c,y1:m.y-c,x2:m.x+c,y2:m.y+c,stroke:u,strokeWidth:1.5}),s({type:"line",x1:m.x-c,y1:m.y+c,x2:m.x+c,y2:m.y-c,stroke:u,strokeWidth:1.5}));break}case "label":{let m=o(a.at);s({type:"text",content:a.text,x:m.x+(a.dx??0),y:m.y+(a.dy??0),anchor:a.anchor??tt(m.x+(a.dx??0),a.text,i),fontSize:p.annotationFontSize,fill:a.color??p.annotationColor,rotate:a.rotate});break}}if(a.id&&l.length>0){let m=ee(a.id);r.push({type:"group",cssClass:`annotation annotation--${m}`,commands:l});}else r.push(...l);}return r}function tt(i,e,t){let{metrics:n,timeScale:r}=t;if(!n)return "middle";let[o,a]=r.range(),l=n(e,p.annotationFontSize)/2;return i-l<o?"start":i+l>a?"end":"middle"}var te=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 ne=class{#e;constructor(){this.#e=[];}add(e){this.#e.push(e);}clear(){this.#e=[];}isInside(e,t){return this.#e.length===0?true:this.#e.some(n=>e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height)}toSVGClipPath(e="clip"){if(this.#e.length===0)return "";let t=this.#e.map(n=>`<rect x="${n.x}" y="${n.y}" width="${n.width}" height="${n.height}" />`).join(`
25
25
  `);return `<clipPath id="${e}">
26
26
  ${t}
27
- </clipPath>`}get regions(){return [...this.#e]}};var W={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},j=class{#e;#t;constructor(e){this.#e=new R({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??W).axisColor}get tickColor(){return (this.#t.colors??W).tickColor}get textColor(){return (this.#t.colors??W).textColor}get textSize(){return (this.#t.colors??W).textSize}generateTicks(){let e=this.#t.minTicks??5,t=this.#t.maxTicks??12,o=this.#e.ticks({minTicks:e,maxTicks:t}).map(r=>({time:r,x:this.#e.map(r),label:this.tickLabel(r)}));return this.antiOverlap(o)}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:o}=this.#e.tickInterval((t+n)/2,t,n),r={};return o<6e4?(r.hour="2-digit",r.minute="2-digit",r.second="2-digit"):o<36e5||o<864e5?(r.hour="2-digit",r.minute="2-digit"):o<31536e6?(r.day="numeric",r.month="short",o>=2592e6&&(r.day=void 0,r.month="long")):(r.year="numeric",o<2*31536e6&&(r.month="short")),this.#e.format(e,r)}antiOverlap(e){if(e.length<=1)return e;let t=60,n=[e[0]];for(let o=1;o<e.length;o++){let r=n[n.length-1].x;Math.abs(e[o].x-r)>=t&&n.push(e[o]);}return n}render(){let e=this.generateTicks(),t=this.#t.colors??W,n=this.#t.y??0,o=[],[r,s]=this.#e.range();o.push({type:"line",x1:r,y1:n,x2:s,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of e)o.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),o.push({type:"text",content:l.label,x:l.x,y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return o}};var O={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function Ve(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function Ee(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 o=t+1;o<n;o++)e[o]=true;t=n+1;}return e}var J=class{#e;#t;constructor(e){this.#e=new M({domain:e.domain,range:e.range}),this.#t=e;}get scale(){return this.#e}get axisColor(){return (this.#t.colors??O).axisColor}get tickColor(){return (this.#t.colors??O).tickColor}get textColor(){return (this.#t.colors??O).textColor}get textSize(){return (this.#t.colors??O).textSize}generateTicks(){let e=this.#t.format??Ve,t=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[n,o]=this.#e.domain(),r=Math.min(n,o),s=Math.max(n,o),l=s-r;if(l===0)return [{value:n,position:this.#e.map(n),label:e(n)}];let a=l/t,m=Math.pow(10,Math.floor(Math.log10(a))),u=a/m,c;if(u<=1.5?c=m:u<=3?c=2*m:u<=7?c=5*m:c=10*m,c<=0||!Number.isFinite(c))return [{value:n,position:this.#e.map(n),label:e(n)}];let d=[],h=Math.ceil(r/c)*c;for(let f=h;f<=s;f+=c)d.push({value:f,position:this.#e.map(f),label:e(f)});return d}render(){let e=this.generateTicks(),t=this.#t.colors??O,n=this.#t.x??0,o=this.#t.orientation??"vertical",r=this.#t.position??"left",s=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,a=u=>s.some(c=>Math.abs(c-u)<=l),m=[];if(o==="vertical"){let[u,c]=this.#e.range();m.push({type:"line",x1:n,y1:u,x2:n,y2:c,stroke:t.axisColor,strokeWidth:t.axisWidth});let d=Ee(e);e.forEach((h,f)=>{let g=a(h.position),y=d[f]?{opacity:0}:{};r==="left"?(m.push({type:"line",x1:n-4,y1:h.position,x2:n,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:h.label,x:n-8,y:h.position+4,anchor:"end",fontSize:11,fill:t.textColor,...y})):(m.push({type:"line",x1:n,y1:h.position,x2:n+4,y2:h.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),g||m.push({type:"text",content:h.label,x:n+8,y:h.position+4,anchor:"start",fontSize:11,fill:t.textColor,...y}));});}else {let[u,c]=this.#e.range();m.push({type:"line",x1:u,y1:n,x2:c,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let d of e)m.push({type:"line",x1:d.position,y1:n,x2:d.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:d.label,x:d.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}return m}};var Q=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(r=>r.value!==null).sort((r,s)=>r.time-s.time),o=[];for(let r=0;r<n.length;r++){let s=Math.max(0,r-t+1),l=n.slice(s,r+1),a=l.reduce((m,u)=>m+u.value,0)/l.length;o.push({time:n[r].time,value:a});}return o}static exponential(e,t){let n=[...e].filter(l=>l.value!==null).sort((l,a)=>l.time-a.time);if(n.length===0)return [];let o=2/(t+1),r=[],s=n[0].value;r.push({time:n[0].time,value:s});for(let l=1;l<n.length;l++)s=n[l].value*o+s*(1-o),r.push({time:n[l].time,value:s});return r}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 ee=class{#e;#t;#n;constructor(e){let t=Object.keys(e.enumMap).map(Number).sort((n,o)=>n-o).map(String);this.#t=t,this.#e=new A({domain:t,range:e.range}),this.#n=e;}get scale(){return this.#e}generateTicks(){let{enumMap:e,showLabels:t=true,autoColor:n=true,gapValues:o}=this.#n,r=new Set(o??[]);return this.#t.map((s,l)=>{let a=Number(s),m=t?e[a]??String(a):String(a),u=this.#e.map(a),c=n?p.palette[l%p.palette.length]:void 0;return {value:a,label:m,y:u,color:c,isGap:r.has(a)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.palette.length]}render(){let e=this.generateTicks(),t=this.#n.x??0,n=[];for(let o of e)o.isGap||n.push({type:"text",content:o.label,x:t,y:o.y+4,anchor:"end",fontSize:11,fill:o.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var k=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 te=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale;return this.data.filter(t=>t.value!==null).map(t=>({x:this.timeScale.map(t.time),y:e.map(t.value),time:t.time})).sort((t,n)=>t.x-n.x)}render(){let e=this.#e,t={smoothing:e.smoothing??false,stroke:e.stroke??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,o=e.gapThreshold??p.gapThreshold,r=e.id,s=x.getRuns(this.data,c=>c.value===null,o),l=s.reduce((c,d)=>c+d.length,0);if(l===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=s.map(c=>({data:c})),u=[];if(u.push(...w(m,a,{...t,id:r?`${r}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of s)u.push(...P(c,a,{...t,id:r?`${r}-marker`:void 0},()=>t.stroke));return u}};var ne=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}points(){let e=this.#e.valueScale,t=[...this.data].filter(o=>o.value!==null).sort((o,r)=>o.time-r.time),n=[];for(let o=0;o<t.length;o++){let r=this.timeScale.map(t[o].time),s=e.map(t[o].value);o===0?n.push({x:r,y:s}):n.push({x:r,y:n[n.length-1].y},{x:r,y:s});}return n}render(){let e=x.getRuns(this.data,o=>o.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(o=>({data:o}));return z(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var re=class extends k{#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??p.bandFill,n=e.hatch,o=e.avgLine??false,r=e.avgLineColor??p.bandAvgLine,s=e.bandWidth??10,l=[];for(let a of this.data){if(a.min===null||a.max===null)continue;let m=this.timeScale.map(a.time),u=e.valueScale.map(a.max),c=e.valueScale.map(a.min),d=s,h=this.data.indexOf(a);if(l.push({type:"rect",x:m-d/2,y:u,w:d,h:c-u,fill:t,hatch:n,opacity:this.opacity(a.count),id:this.id?`${this.id}-slot-${h}`:void 0}),o&&a.avg!==null){let f=e.valueScale.map(a.avg);l.push({type:"line",x1:m-d/2,y1:f,x2:m+d/2,y2:f,stroke:r,strokeWidth:1,id:this.id?`${this.id}-avg-${h}`:void 0});}}return l}};var oe=class extends k{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,o=e.avgColor??p.avgColor,r=e.avgDashed??true,s=e.smoothing??false,l=e.strokeWidth??p.strokeWidth,a=x.getRuns(this.data,h=>h.min===null||h.max===null||h.avg===null);if(a.length===0)return [];let m={timeScale:this.timeScale,valueScale:e.valueScale},u=[];a.forEach((h,f)=>{h.length<2||(e.fillToMax&&u.push(...H(h,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.max,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${f}`:void 0})),e.fillToMin&&u.push(...H(h,m,{boundaries:[],yLow:g=>g.avg,yHigh:g=>g.min,getValue:g=>g.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${f}`:void 0})));});let c=a.filter(h=>h.length>=2),d=h=>c.map(f=>({data:f.map(g=>({time:g.time,value:h(g)}))}));return u.push(...w(d(h=>h.max),m,{stroke:n,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-max`:void 0}),...w(d(h=>h.min),m,{stroke:t,strokeWidth:l,smoothing:s,id:this.id?`${this.id}-min`:void 0}),...w(d(h=>h.avg),m,{stroke:o,strokeWidth:l,smoothing:s,dashed:r,id:this.id?`${this.id}-avg`:void 0})),u}};var ie=class extends k{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??p.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??p.stroke,n={stroke:t,strokeWidth:e.strokeWidth??p.strokeWidth,smoothing:e.smoothing??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize},o=e.gapThreshold??p.gapThreshold,r=e.pointThreshold??p.pointThreshold,s=x.getRuns(this.data,u=>u.value===null,o),l=s.reduce((u,c)=>u+c.length,0);if(l===0)return [];let a={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of s){if(u.length<2)continue;if(e.fill){let f=e.fill.value,g=x.splitByBoundaries(u,[f],b=>b.value,x.interpolateDataPoint),y=e.valueScale.map(f);for(let b=0;b<g.length;b++){let S=g[b];if(S.data.length<2)continue;let T=S.zoneIndex>0;if(e.fill.side==="above"===T){let I=S.data.map(me=>({x:this.timeScale.map(me.time),y:e.valueScale.map(me.value)}));m.push({type:"path",cssClass:"series-fill",id:this.id?`${this.id}-fill-${b}`:void 0,points:[...I,{x:I[I.length-1].x,y},{x:I[0].x,y}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(f=>f.value),h=x.splitByBoundaries(u,c,f=>f.value,x.interpolateDataPoint).map(f=>({data:f.data,color:this.#n(f.zoneIndex)}));m.push(...w(h,a,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=r&&m.push(...P(u,a,{...n,id:this.id?`${this.id}-marker`:void 0},f=>{let g=t;for(let y of this.#t)f.value>=y.value&&(g=y.color);return g}));}return m}};var Ne=1,ae=class{#e;constructor(e,t,n,o){this.#e={...e,xRange:t,y:n,height:o};}render(){let{items:e,timeScale:t,background:n,hatch:o,showAxis:r,xRange:s,y:l,height:a}=this.#e,m=[];n&&m.push({type:"rect",x:s[0],y:l,w:s[1]-s[0],h:a,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),d=t.map(u.endTime);if(d<s[0]||c>s[1])continue;let h=Math.max(s[0],Math.min(s[1],c)),f=Math.max(s[0],Math.min(s[1],d)),g=Math.max(f-h,Ne);h+g>s[1]&&(h=Math.max(s[0],s[1]-g));let y=h+g/2;if(m.push({type:"rect",x:h,y:l,w:g,h:a,hatch:u.hatch??o,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(r){let u=new j({domain:t.domain(),xRange:s,y:l+a+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:o}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+o-t*.25;default:return n+o/2+t*.35}}};var se=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:o=false,showMax:r=false,showAvg:s=true,showMedian:l=false,labelPosition:a="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,c=ue.compute(e),d=[{name:"min",value:c.min,enabled:o},{name:"max",value:c.max,enabled:r},{name:"avg",value:c.avg,enabled:s},{name:"median",value:c.median,enabled:l}],h=[],[f,g]=n;for(let y of d.filter(b=>b.enabled)){let b=t.map(y.value);h.push({type:"line",x1:f,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let S=`${y.name}: ${y.value.toFixed(1)}`;(a==="start"||a==="both")&&h.push({type:"text",content:S,x:f+4,y:b-4,anchor:"start",fontSize:10,fill:u}),(a==="end"||a==="both")&&h.push({type:"text",content:S,x:g-4,y:b-4,anchor:"end",fontSize:10,fill:u}),a==="center"&&h.push({type:"text",content:S,x:(f+g)/2,y:b-4,anchor:"middle",fontSize:10,fill:u});}return h}};var D=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let o=this.#n&&n?this.#r(e,n,t):t;return F(this.#e,o).format(new Date(e))}catch{for(let o of this.#t)try{return F(o,t).format(new Date(e))}catch{}return new Date(e).toISOString()}}formatRange(e,t){let n=this.format(e),o=this.format(t);return `${n} \u2014 ${o}`}#r(e,t,n){let o=Math.abs(e-t),r=864e5,s=36e5,l=6e4,a={};return o<l?(a.second="2-digit",a.minute="2-digit",a.hour="2-digit"):o<s?(a.minute="2-digit",a.hour="2-digit"):o<r?(a.hour="2-digit",a.minute="2-digit"):o<7*r?(a.weekday="short",a.day="numeric"):o<365*r?(a.month="short",a.day="numeric"):(a.month="short",a.year="numeric"),{...n,...a}}};var _=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 $=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((o,r)=>{n[r]=o;}),new i({map:n,showValue:t})}};var ze={time:new D,value:new _,enum:new $};function le(i,e){let t=C();return {color:i.color??t.stroke,width:i.width??t.strokeWidth,style:i.style??"solid",smoothing:i.smoothing??false,shape:i.shape??(e.seriesType==="step"?"step":"line"),gapThreshold:i.gapThreshold??t.gapThreshold,opacity:i.opacity??1}}function ge(i){let e=i.style?.line;return e===false?[]:e===void 0?[le({},i)]:Array.isArray(e)?e.map(t=>le(t,i)):[le(e,i)]}function ye(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=C(),o=(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??o,fill:e.fill??"#ffffff",strokeWidth:e.strokeWidth??1,threshold:e.threshold}}function be(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 xe(i){return i.style?.gap}function Se(i){return i.style?.fill}function Ge(i){return {lines:ge(i),fill:Se(i),markers:ye(i),shadow:be(i),gap:xe(i),id:i.style?.id??i.id}}/*!
27
+ </clipPath>`}get regions(){return [...this.#e]}};function Z(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 a=1;a<=e;a++)t.push(r+(o-r)*a/(e+1));}return t}var H={axisColor:p.axisColor,tickColor:p.tickColor,textColor:p.textColor,textSize:p.textSize},E=class{#e;#t;constructor(e){this.#e=new I({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??H).axisColor}get tickColor(){return (this.#t.colors??H).tickColor}get textColor(){return (this.#t.colors??H).textColor}get textSize(){return (this.#t.colors??H).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??H,n=this.#t.y??0,r=[],[o,a]=this.#e.range();r.push({type:"line",x1:o,y1:n,x2:a,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let l of this.generateMinorTicks())r.push({type:"line",x1:l,y1:n,x2:l,y2:n+3,stroke:t.tickColor,strokeWidth:t.axisWidth});for(let l of e)r.push({type:"line",x1:l.x,y1:n,x2:l.x,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),r.push({type:"text",content:l.label,x:this.#n(l.x,l.label,t.textSize),y:n+t.textSize+6,anchor:"middle",fontSize:t.textSize,fill:t.textColor});return r}generateMinorTicks(){return Z(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 a=o(t,n)/2;return Math.max(a+2,Math.min(r-a-2,e))}};var P={axisColor:"#ccc",tickColor:"#ddd",textColor:"#777",textSize:12};function we(i){return Math.abs(i)>=1e6?`${(i/1e6).toFixed(1)}M`:Math.abs(i)>=1e3?`${(i/1e3).toFixed(1)}k`:Number.isInteger(i)?String(i):i.toFixed(1)}function nt(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 re=class{#e;#t;constructor(e){this.#e=new _({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 g=this.#t.format??we;return e.map(y=>({value:y,position:this.#e.map(y),label:g(y)}))}let t=this.#t.format??we,n=this.#t.ticks&&this.#t.ticks>0?this.#t.ticks:6,[r,o]=this.#e.domain(),a=Math.min(r,o),l=Math.max(r,o),s=l-a;if(s===0)return [{value:r,position:this.#e.map(r),label:t(r)}];let m=s/n,u=Math.pow(10,Math.floor(Math.log10(m))),c=m/u,h;if(c<=1.5?h=u:c<=3?h=2*u:c<=7?h=5*u:h=10*u,h<=0||!Number.isFinite(h))return [{value:r,position:this.#e.map(r),label:t(r)}];let f=[],d=Math.ceil(a/h)*h;for(let g=d;g<=l;g+=h)f.push({value:g,position:this.#e.map(g),label:t(g)});return f}generateMinorTicks(){return Z(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",a=this.#t.suppressLabelsNear??[],l=this.#t.suppressTolerancePx??8,s=c=>a.some(h=>Math.abs(h-c)<=l),m=[];if(r==="vertical"){let[c,h]=this.#e.range();m.push({type:"line",x1:n,y1:c,x2:n,y2:h,stroke:t.axisColor,strokeWidth:t.axisWidth});let f=nt(e);e.forEach((d,g)=>{let y=s(d.position),b=f[g]?{opacity:0}:{};o==="left"?(m.push({type:"line",x1:n-4,y1:d.position,x2:n,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n-8,d.label,"end"),y:d.position+4,anchor:"end",fontSize:t.textSize,fill:t.textColor,...b})):(m.push({type:"line",x1:n,y1:d.position,x2:n+4,y2:d.position,stroke:t.tickColor,strokeWidth:t.axisWidth}),y||m.push({type:"text",content:d.label,x:this.#n(n+8,d.label,"start"),y:d.position+4,anchor:"start",fontSize:t.textSize,fill:t.textColor,...b}));});}else {let[c,h]=this.#e.range();m.push({type:"line",x1:c,y1:n,x2:h,y2:n,stroke:t.axisColor,strokeWidth:t.axisWidth});for(let f of e)m.push({type:"line",x1:f.position,y1:n,x2:f.position,y2:n+6,stroke:t.tickColor,strokeWidth:t.axisWidth}),m.push({type:"text",content:f.label,x:f.position,y:n+18,anchor:"middle",fontSize:t.textSize,fill:t.textColor});}let u=(this.#t.orientation??"vertical")==="vertical";for(let c of this.generateMinorTicks())m.push(u?{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 a=o(t,(this.#t.colors??P).textSize);return n==="end"?Math.max(a+2,Math.min(r-2,e)):Math.min(r-a-2,Math.max(2,e))}};var oe=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,a)=>o.time-a.time),r=[];for(let o=0;o<n.length;o++){let a=Math.max(0,o-t+1),l=n.slice(a,o+1),s=l.reduce((m,u)=>m+u.value,0)/l.length;r.push({time:n[o].time,value:s});}return r}static exponential(e,t){let n=[...e].filter(l=>l.value!==null).sort((l,s)=>l.time-s.time);if(n.length===0)return [];let r=2/(t+1),o=[],a=n[0].value;o.push({time:n[0].time,value:a});for(let l=1;l<n.length;l++)a=n[l].value*r+a*(1-r),o.push({time:n[l].time,value:a});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 ie=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 B({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((a,l)=>{let s=Number(a),m=t?e[s]??String(s):String(s),u=this.#e.map(s),c=n?p.palette[l%p.palette.length]:void 0;return {value:s,label:m,y:u,color:c,isGap:o.has(s)}})}colorFor(e){let t=this.#t.indexOf(String(e));if(!(t===-1||!(this.#n.autoColor??true)))return p.palette[t%p.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:p.textSize,fill:r.color??p.textColor});return n}map(e){return this.#e.map(e)}isGap(e){return new Set(this.#n.gapValues??[]).has(e)}};var w=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 ae=class extends w{#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??p.stroke,strokeWidth:e.strokeWidth??p.strokeWidth,dashed:e.dashed??false,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize,shadowColor:e.shadowColor,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY},n=e.pointThreshold??p.pointThreshold,r=e.gapThreshold??p.gapThreshold,o=e.id,a=x.getRuns(this.data,c=>c.value===null,r),l=a.reduce((c,h)=>c+h.length,0);if(l===0)return [];let s={timeScale:this.timeScale,valueScale:e.valueScale},m=a.map(c=>({data:c})),u=[];if(u.push(...v(m,s,{...t,id:o?`${o}-line`:void 0})),t.pointStyle&&t.pointStyle!=="none"&&l<=n)for(let c of a)u.push(...R(c,s,{...t,id:o?`${o}-marker`:void 0},()=>t.stroke));return u}};var se=class extends w{#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),a=e.map(t[r].value);r===0?n.push({x:o,y:a}):n.push({x:o,y:n[n.length-1].y},{x:o,y:a});}return n}render(){let e=x.getRuns(this.data,r=>r.value===null);if(e.length===0)return [];let t={timeScale:this.timeScale,valueScale:this.#e.valueScale},n=e.map(r=>({data:r}));return q(n,t,{stroke:this.#e.stroke??p.stroke,strokeWidth:this.#e.strokeWidth??p.strokeWidth,id:this.id?`${this.id}-line`:void 0})}};var le=class extends w{#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??p.bandFill,n=e.hatch,r=e.avgLine??false,o=e.avgLineColor??p.bandAvgLine,a=e.bandWidth??10,l=[];for(let s of this.data){if(s.min===null||s.max===null)continue;let m=this.timeScale.map(s.time),u=e.valueScale.map(s.max),c=e.valueScale.map(s.min),h=a,f=this.data.indexOf(s);if(l.push({type:"rect",x:m-h/2,y:u,w:h,h:c-u,fill:t,hatch:n,opacity:this.opacity(s.count),id:this.id?`${this.id}-slot-${f}`:void 0}),r&&s.avg!==null){let d=e.valueScale.map(s.avg);l.push({type:"line",x1:m-h/2,y1:d,x2:m+h/2,y2:d,stroke:o,strokeWidth:1,id:this.id?`${this.id}-avg-${f}`:void 0});}}return l}};var me=class extends w{#e;constructor(e){super(e,e.data),this.#e=e;}render(){let e=this.#e,t=e.minColor??p.minColor,n=e.maxColor??p.maxColor,r=e.avgColor??p.avgColor,o=e.avgDashed??true,a=e.smoothing??false,l=e.smoothingType,s=e.strokeWidth??p.strokeWidth,m=x.getRuns(this.data,d=>d.min===null||d.max===null||d.avg===null);if(m.length===0)return [];let u={timeScale:this.timeScale,valueScale:e.valueScale},c=[];m.forEach((d,g)=>{d.length<2||(e.fillToMax&&c.push(...z(d,u,{boundaries:[],yLow:y=>y.avg,yHigh:y=>y.max,getValue:y=>y.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMax,getHatch:()=>e.fillToMaxHatch},{id:this.id?`${this.id}-fillToMax-${g}`:void 0})),e.fillToMin&&c.push(...z(d,u,{boundaries:[],yLow:y=>y.avg,yHigh:y=>y.min,getValue:y=>y.avg,interpolate:x.interpolateAggregatedPoint,getColor:()=>e.fillToMin,getHatch:()=>e.fillToMinHatch},{id:this.id?`${this.id}-fillToMin-${g}`:void 0})));});let h=m.filter(d=>d.length>=2),f=d=>h.map(g=>({data:g.map(y=>({time:y.time,value:d(y)}))}));return c.push(...v(f(d=>d.max),u,{stroke:n,strokeWidth:s,smoothing:a,smoothingType:l,id:this.id?`${this.id}-max`:void 0}),...v(f(d=>d.min),u,{stroke:t,strokeWidth:s,smoothing:a,id:this.id?`${this.id}-min`:void 0}),...v(f(d=>d.avg),u,{stroke:r,strokeWidth:s,smoothing:a,dashed:o,id:this.id?`${this.id}-avg`:void 0})),c}};var ue=class extends w{#e;#t;constructor(e){super(e,e.data),this.#e=e,this.#t=[...e.zones??[]].sort((t,n)=>t.value-n.value);}#n(e){return e===0?this.#e.baseColor??p.stroke:this.#t[e-1].color}render(){let e=this.#e,t=e.baseColor??p.stroke,n={stroke:t,strokeWidth:e.strokeWidth??p.strokeWidth,smoothing:e.smoothing??false,smoothingType:e.smoothingType,pointStyle:e.pointStyle??"none",pointSize:e.pointSize??p.pointSize},r=e.gapThreshold??p.gapThreshold,o=e.pointThreshold??p.pointThreshold,a=x.getRuns(this.data,u=>u.value===null,r),l=a.reduce((u,c)=>u+c.length,0);if(l===0)return [];let s={timeScale:this.timeScale,valueScale:e.valueScale},m=[];for(let u of a){if(u.length<2)continue;if(e.fill){let d=e.fill.value,g=x.splitByBoundaries(u,[d],b=>b.value,x.interpolateDataPoint),y=e.valueScale.map(d);for(let b=0;b<g.length;b++){let S=g[b];if(S.data.length<2)continue;let C=S.zoneIndex>0;if(e.fill.side==="above"===C){let k=S.data.map(V=>({x:this.timeScale.map(V.time),y:e.valueScale.map(V.value)}));m.push({type:"path",cssClass:"series-fill",id:this.id?`${this.id}-fill-${b}`:void 0,points:[...k,{x:k[k.length-1].x,y},{x:k[0].x,y}],fill:e.fill.color,hatch:e.fill.hatch,stroke:"none"});}}}let c=this.#t.map(d=>d.value),f=x.splitByBoundaries(u,c,d=>d.value,x.interpolateDataPoint).map(d=>({data:d.data,color:this.#n(d.zoneIndex)}));m.push(...v(f,s,{...n,id:this.id?`${this.id}-line`:void 0})),n.pointStyle&&n.pointStyle!=="none"&&l<=o&&m.push(...R(u,s,{...n,id:this.id?`${this.id}-marker`:void 0},d=>{let g=t;for(let y of this.#t)d.value>=y.value&&(g=y.color);return g}));}return m}};var rt=1,ce=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:a,y:l,height:s}=this.#e,m=[];n&&m.push({type:"rect",x:a[0],y:l,w:a[1]-a[0],h:s,fill:n,opacity:.04,stroke:"#ddd",strokeWidth:.25});for(let u of e){let c=t.map(u.startTime),h=t.map(u.endTime);if(h<a[0]||c>a[1])continue;let f=Math.max(a[0],Math.min(a[1],c)),d=Math.max(a[0],Math.min(a[1],h)),g=Math.max(d-f,rt);f+g>a[1]&&(f=Math.max(a[0],a[1]-g));let y=f+g/2;if(m.push({type:"rect",x:f,y:l,w:g,h:s,hatch:u.hatch??r,fill:u.fill??"#6b728044",stroke:u.stroke,strokeWidth:u.strokeWidth??0,title:u.title}),u.label){let b=u.labelFontSize??10;m.push({type:"text",content:u.label,x:y,y:this.#t(u.labelBaseline,b),anchor:"middle",fontSize:b,fill:u.labelFill??"#333"});}}if(o){let u=new E({domain:t.domain(),xRange:a,y:l+s+4});m.push({type:"group",cssClass:"annotation-band-axis",commands:u.render()});}return m}#t(e,t){let{y:n,height:r}=this.#e;switch(e){case "top":return n+t*.9;case "bottom":return n+r-t*.25;default:return n+r/2+t*.35}}};var he=class{#e;constructor(e){this.#e=e;}render(){let{data:e,valueScale:t,xRange:n,showMin:r=false,showMax:o=false,showAvg:a=true,showMedian:l=false,labelPosition:s="end",lineColor:m=p.statsLineColor,labelColor:u=p.statsLabelColor}=this.#e,c=fe.compute(e),h=[{name:"min",value:c.min,enabled:r},{name:"max",value:c.max,enabled:o},{name:"avg",value:c.avg,enabled:a},{name:"median",value:c.median,enabled:l}],f=[],[d,g]=n;for(let y of h.filter(b=>b.enabled)){let b=t.map(y.value);f.push({type:"line",x1:d,y1:b,x2:g,y2:b,stroke:m,strokeWidth:1});let S=`${y.name}: ${y.value.toFixed(1)}`;(s==="start"||s==="both")&&f.push({type:"text",content:S,x:d+4,y:b-4,anchor:"start",fontSize:p.statFontSize,fill:u}),(s==="end"||s==="both")&&f.push({type:"text",content:S,x:g-4,y:b-4,anchor:"end",fontSize:p.statFontSize,fill:u}),s==="center"&&f.push({type:"text",content:S,x:(d+g)/2,y:b-4,anchor:"middle",fontSize:p.statFontSize,fill:u});}return f}};var $=class{#e;#t;#n;constructor(e){this.#e=e?.locale||(typeof navigator<"u"?navigator.language:"en-US"),this.#t=e?.fallbackLocales??["en-US"],this.#n=e?.autoFormat??true;}format(e,t,n){try{let r=this.#n&&n?this.#r(e,n,t):t;return 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,a=36e5,l=6e4,s={};return r<l?(s.second="2-digit",s.minute="2-digit",s.hour="2-digit"):r<a?(s.minute="2-digit",s.hour="2-digit"):r<o?(s.hour="2-digit",s.minute="2-digit"):r<7*o?(s.weekday="short",s.day="numeric"):r<365*o?(s.month="short",s.day="numeric"):(s.month="short",s.year="numeric"),{...n,...s}}};var A=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 F=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 ot={time:new $,value:new A,enum:new F};function de(i,e){let t=M();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 Ce(i){let e=i.style?.line;return e===false?[]:e===void 0?[de({},i)]:Array.isArray(e)?e.map(t=>de(t,i)):[de(e,i)]}function Me(i){let e=i.style?.markers;if(!e?.type||e.type==="none")return;let t=M(),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 Le(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 De(i){return i.style?.gap}function _e(i){return i.style?.fill}function it(i){return {lines:Ce(i),fill:_e(i),markers:Me(i),shadow:Le(i),gap:De(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 N=class{};var x=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{ae as AnnotationBandSeries,A as BandScale,re as BandSeries,K as Clip,ee as EnumAxis,$ as EnumFormatter,ze as Formatters,q as Layout,te as LineSeries,M as LinearScale,oe as MinMaxAvgSeries,Q as MovingAvg,N as Renderer,se as StatsOverlay,ne as StepSeries,v as TIME_INTERVALS,j as TimeAxis,D as TimeFormatter,R as TimeScale,J as ValueAxis,_ as ValueFormatter,ie as ZonedLineSeries,de as getHatch,De as measureLegend,He as renderAnnotations,Te as renderArea,Oe as renderGaps,$e as renderGrid,Be as renderHighlights,_e as renderLegend,w as renderLine,Ie as renderMarkers,P as renderSeriesMarkers,Le as renderSplitLine,z as renderStep,Ae as renderThresholds,H as renderZonedArea,Se as resolveFill,xe as resolveGap,ge as resolveLines,ye as resolveMarkers,Ge as resolveSeriesStyle,be as resolveShadow,U as slugify,p as theme,Ce as toStepData,he as toStepPoints};
46
+ */export{ce as AnnotationBandSeries,B as BandScale,le as BandSeries,ne as Clip,W as CommandBuilder,ie as EnumAxis,F as EnumFormatter,ot as Formatters,te as Layout,ae as LineSeries,_ as LinearScale,me as MinMaxAvgSeries,oe as MovingAvg,Y as Renderer,he as StatsOverlay,se as StepSeries,T as TIME_INTERVALS,E as TimeAxis,$ as TimeFormatter,I as TimeScale,re as ValueAxis,A as ValueFormatter,ue as ZonedLineSeries,xe as getHatch,ke as measureLegend,et as renderAnnotations,Ae as renderArea,Ke as renderGaps,Ne as renderGrid,Qe as renderHighlights,ze as renderLegend,v as renderLine,Je as renderMarkers,R as renderSeriesMarkers,$e as renderSplitLine,q as renderStep,Ye as renderThresholds,z as renderZonedArea,_e as resolveFill,De as resolveGap,Ce as resolveLines,Me as resolveMarkers,it as resolveSeriesStyle,Le as resolveShadow,ee as slugify,p as theme,Pe as toStepData,U as toStepPoints};