uplot-plus 0.1.1 → 0.1.3

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.
Files changed (151) hide show
  1. package/dist/annotations.d.ts +22 -0
  2. package/dist/annotations.d.ts.map +1 -0
  3. package/dist/axes/layout.d.ts +30 -0
  4. package/dist/axes/layout.d.ts.map +1 -0
  5. package/dist/axes/ticks.d.ts +47 -0
  6. package/dist/axes/ticks.d.ts.map +1 -0
  7. package/dist/colors.d.ts +32 -0
  8. package/dist/colors.d.ts.map +1 -0
  9. package/dist/components/Axis.d.ts +14 -0
  10. package/dist/components/Axis.d.ts.map +1 -0
  11. package/dist/components/Band.d.ts +10 -0
  12. package/dist/components/Band.d.ts.map +1 -0
  13. package/dist/components/Chart.d.ts +8 -0
  14. package/dist/components/Chart.d.ts.map +1 -0
  15. package/dist/components/Legend.d.ts +12 -0
  16. package/dist/components/Legend.d.ts.map +1 -0
  17. package/dist/components/Scale.d.ts +11 -0
  18. package/dist/components/Scale.d.ts.map +1 -0
  19. package/dist/components/Series.d.ts +11 -0
  20. package/dist/components/Series.d.ts.map +1 -0
  21. package/dist/components/Sparkline.d.ts +28 -0
  22. package/dist/components/Sparkline.d.ts.map +1 -0
  23. package/dist/components/Timeline.d.ts +8 -0
  24. package/dist/components/Timeline.d.ts.map +1 -0
  25. package/dist/components/Tooltip.d.ts +9 -0
  26. package/dist/components/Tooltip.d.ts.map +1 -0
  27. package/dist/components/ZoomRanger.d.ts +26 -0
  28. package/dist/components/ZoomRanger.d.ts.map +1 -0
  29. package/dist/components/annotations/AnnotationLabel.d.ts +26 -0
  30. package/dist/components/annotations/AnnotationLabel.d.ts.map +1 -0
  31. package/dist/components/annotations/HLine.d.ts +22 -0
  32. package/dist/components/annotations/HLine.d.ts.map +1 -0
  33. package/dist/components/annotations/Region.d.ts +22 -0
  34. package/dist/components/annotations/Region.d.ts.map +1 -0
  35. package/dist/components/annotations/VLine.d.ts +22 -0
  36. package/dist/components/annotations/VLine.d.ts.map +1 -0
  37. package/dist/components/annotations/index.d.ts +9 -0
  38. package/dist/components/annotations/index.d.ts.map +1 -0
  39. package/dist/core/BlockMinMax.d.ts +42 -0
  40. package/dist/core/BlockMinMax.d.ts.map +1 -0
  41. package/dist/core/CursorManager.d.ts +43 -0
  42. package/dist/core/CursorManager.d.ts.map +1 -0
  43. package/dist/core/DataStore.d.ts +51 -0
  44. package/dist/core/DataStore.d.ts.map +1 -0
  45. package/dist/core/RenderScheduler.d.ts +28 -0
  46. package/dist/core/RenderScheduler.d.ts.map +1 -0
  47. package/dist/core/Scale.d.ts +23 -0
  48. package/dist/core/Scale.d.ts.map +1 -0
  49. package/dist/core/ScaleManager.d.ts +45 -0
  50. package/dist/core/ScaleManager.d.ts.map +1 -0
  51. package/dist/formatters.d.ts +39 -0
  52. package/dist/formatters.d.ts.map +1 -0
  53. package/dist/hooks/useChart.d.ts +5 -0
  54. package/dist/hooks/useChart.d.ts.map +1 -0
  55. package/dist/hooks/useChartStore.d.ts +69 -0
  56. package/dist/hooks/useChartStore.d.ts.map +1 -0
  57. package/dist/hooks/useDrawHook.d.ts +26 -0
  58. package/dist/hooks/useDrawHook.d.ts.map +1 -0
  59. package/dist/hooks/useInteraction.d.ts +14 -0
  60. package/dist/hooks/useInteraction.d.ts.map +1 -0
  61. package/dist/hooks/useStreamingData.d.ts +48 -0
  62. package/dist/hooks/useStreamingData.d.ts.map +1 -0
  63. package/dist/index.cjs +1 -0
  64. package/dist/index.d.ts +45 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +3245 -0
  67. package/dist/math/align.d.ts +10 -0
  68. package/dist/math/align.d.ts.map +1 -0
  69. package/dist/math/increments.d.ts +9 -0
  70. package/dist/math/increments.d.ts.map +1 -0
  71. package/dist/math/stack.d.ts +16 -0
  72. package/dist/math/stack.d.ts.map +1 -0
  73. package/dist/math/utils.d.ts +74 -0
  74. package/dist/math/utils.d.ts.map +1 -0
  75. package/dist/paths/bars.d.ts +9 -0
  76. package/dist/paths/bars.d.ts.map +1 -0
  77. package/dist/paths/candlestick.d.ts +35 -0
  78. package/dist/paths/candlestick.d.ts.map +1 -0
  79. package/dist/paths/catmullRom.d.ts +9 -0
  80. package/dist/paths/catmullRom.d.ts.map +1 -0
  81. package/dist/paths/linear.d.ts +10 -0
  82. package/dist/paths/linear.d.ts.map +1 -0
  83. package/dist/paths/monotoneCubic.d.ts +10 -0
  84. package/dist/paths/monotoneCubic.d.ts.map +1 -0
  85. package/dist/paths/points.d.ts +10 -0
  86. package/dist/paths/points.d.ts.map +1 -0
  87. package/dist/paths/spline.d.ts +9 -0
  88. package/dist/paths/spline.d.ts.map +1 -0
  89. package/dist/paths/stepped.d.ts +9 -0
  90. package/dist/paths/stepped.d.ts.map +1 -0
  91. package/dist/paths/types.d.ts +32 -0
  92. package/dist/paths/types.d.ts.map +1 -0
  93. package/dist/paths/utils.d.ts +19 -0
  94. package/dist/paths/utils.d.ts.map +1 -0
  95. package/dist/rendering/CanvasRenderer.d.ts +86 -0
  96. package/dist/rendering/CanvasRenderer.d.ts.map +1 -0
  97. package/dist/rendering/drawAxes.d.ts +8 -0
  98. package/dist/rendering/drawAxes.d.ts.map +1 -0
  99. package/dist/rendering/drawBands.d.ts +12 -0
  100. package/dist/rendering/drawBands.d.ts.map +1 -0
  101. package/dist/rendering/drawCursor.d.ts +22 -0
  102. package/dist/rendering/drawCursor.d.ts.map +1 -0
  103. package/dist/rendering/drawPoints.d.ts +13 -0
  104. package/dist/rendering/drawPoints.d.ts.map +1 -0
  105. package/dist/rendering/drawSelect.d.ts +14 -0
  106. package/dist/rendering/drawSelect.d.ts.map +1 -0
  107. package/dist/rendering/drawSeries.d.ts +7 -0
  108. package/dist/rendering/drawSeries.d.ts.map +1 -0
  109. package/dist/sync/SyncGroup.d.ts +33 -0
  110. package/dist/sync/SyncGroup.d.ts.map +1 -0
  111. package/dist/sync/useSyncGroup.d.ts +8 -0
  112. package/dist/sync/useSyncGroup.d.ts.map +1 -0
  113. package/dist/time/fmtDate.d.ts +15 -0
  114. package/dist/time/fmtDate.d.ts.map +1 -0
  115. package/dist/time/timeIncrs.d.ts +17 -0
  116. package/dist/time/timeIncrs.d.ts.map +1 -0
  117. package/dist/time/timeSplits.d.ts +6 -0
  118. package/dist/time/timeSplits.d.ts.map +1 -0
  119. package/dist/time/timeVals.d.ts +16 -0
  120. package/dist/time/timeVals.d.ts.map +1 -0
  121. package/dist/types/axes.d.ts +84 -0
  122. package/dist/types/axes.d.ts.map +1 -0
  123. package/dist/types/bands.d.ts +12 -0
  124. package/dist/types/bands.d.ts.map +1 -0
  125. package/dist/types/chart.d.ts +53 -0
  126. package/dist/types/chart.d.ts.map +1 -0
  127. package/dist/types/common.d.ts +62 -0
  128. package/dist/types/common.d.ts.map +1 -0
  129. package/dist/types/cursor.d.ts +22 -0
  130. package/dist/types/cursor.d.ts.map +1 -0
  131. package/dist/types/data.d.ts +32 -0
  132. package/dist/types/data.d.ts.map +1 -0
  133. package/dist/types/events.d.ts +57 -0
  134. package/dist/types/events.d.ts.map +1 -0
  135. package/dist/types/hooks.d.ts +28 -0
  136. package/dist/types/hooks.d.ts.map +1 -0
  137. package/dist/types/index.d.ts +10 -0
  138. package/dist/types/index.d.ts.map +1 -0
  139. package/dist/types/legend.d.ts +8 -0
  140. package/dist/types/legend.d.ts.map +1 -0
  141. package/dist/types/scales.d.ts +60 -0
  142. package/dist/types/scales.d.ts.map +1 -0
  143. package/dist/types/series.d.ts +76 -0
  144. package/dist/types/series.d.ts.map +1 -0
  145. package/dist/types/timeline.d.ts +30 -0
  146. package/dist/types/timeline.d.ts.map +1 -0
  147. package/dist/types/tooltip.d.ts +33 -0
  148. package/dist/types/tooltip.d.ts.map +1 -0
  149. package/dist/utils/shallowEqual.d.ts +10 -0
  150. package/dist/utils/shallowEqual.d.ts.map +1 -0
  151. package/package.json +1 -1
package/dist/index.js ADDED
@@ -0,0 +1,3245 @@
1
+ import { jsx as E, jsxs as Q, Fragment as Pe } from "react/jsx-runtime";
2
+ import { useRef as X, useContext as Le, createContext as De, useEffect as Y, useState as St, useCallback as q, useSyncExternalStore as fe, memo as ze, useLayoutEffect as zt } from "react";
3
+ var U = /* @__PURE__ */ ((t) => (t[t.Top = 0] = "Top", t[t.Right = 1] = "Right", t[t.Bottom = 2] = "Bottom", t[t.Left = 3] = "Left", t))(U || {}), G = /* @__PURE__ */ ((t) => (t[t.Horizontal = 0] = "Horizontal", t[t.Vertical = 1] = "Vertical", t))(G || {}), K = /* @__PURE__ */ ((t) => (t[t.Forward = 1] = "Forward", t[t.Backward = -1] = "Backward", t))(K || {}), N = /* @__PURE__ */ ((t) => (t[t.Linear = 1] = "Linear", t[t.Ordinal = 2] = "Ordinal", t[t.Log = 3] = "Log", t[t.Asinh = 4] = "Asinh", t))(N || {}), yt = /* @__PURE__ */ ((t) => (t[t.Ascending = 1] = "Ascending", t[t.Descending = -1] = "Descending", t[t.Unsorted = 0] = "Unsorted", t))(yt || {});
4
+ function xt(t) {
5
+ return t % 2;
6
+ }
7
+ var tt = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.Scales = 1] = "Scales", t[t.Axes = 2] = "Axes", t[t.Paths = 4] = "Paths", t[t.Cursor = 8] = "Cursor", t[t.Select = 16] = "Select", t[t.Size = 32] = "Size", t[t.Full = 63] = "Full", t))(tt || {});
8
+ const J = Math, Ht = J.PI, gt = J.abs, st = J.floor, $ = J.round, Tt = J.ceil, qt = J.min, kt = J.max, wt = J.pow, Ot = J.sign, et = J.log10, Mt = J.log2, Fe = (t, e = 1) => J.sinh(t) * e, Wt = (t, e = 1) => J.asinh(t / e), O = 1 / 0, he = Number.isInteger;
9
+ function Vt(t, e) {
10
+ return t[e] ?? 0;
11
+ }
12
+ function ct(t, e, n = 0, s = e.length - 1) {
13
+ let o;
14
+ const i = s <= 2147483647;
15
+ for (; s - n > 1; )
16
+ o = i ? n + s >> 1 : st((n + s) / 2), Vt(e, o) < t ? n = o : s = o;
17
+ return t - Vt(e, n) <= Vt(e, s) - t ? n : s;
18
+ }
19
+ const de = (t) => t != null, ge = (t) => t != null && t > 0;
20
+ function pe(t) {
21
+ return (e, n, s) => {
22
+ let o = -1, i = -1;
23
+ for (let l = n; l <= s; l++)
24
+ if (t(e[l])) {
25
+ o = l;
26
+ break;
27
+ }
28
+ for (let l = s; l >= n; l--)
29
+ if (t(e[l])) {
30
+ i = l;
31
+ break;
32
+ }
33
+ return [o, i];
34
+ };
35
+ }
36
+ const Ft = pe(de), me = pe(ge);
37
+ function _e(t, e, n, s = yt.Unsorted, o = !1) {
38
+ const i = o ? me : Ft, l = o ? ge : de, [r, a] = i(t, e, n);
39
+ let c = t[r] ?? O, u = t[r] ?? -O;
40
+ if (r > -1)
41
+ if (s === yt.Ascending)
42
+ c = t[r] ?? O, u = t[a] ?? -O;
43
+ else if (s === yt.Descending)
44
+ c = t[a] ?? O, u = t[r] ?? -O;
45
+ else
46
+ for (let d = r; d <= a; d++) {
47
+ const f = t[d];
48
+ f != null && l(f) && (f < c ? c = f : f > u && (u = f));
49
+ }
50
+ return [c, u];
51
+ }
52
+ function ut(t, e = 0) {
53
+ if (he(t))
54
+ return t;
55
+ const n = 10 ** e, s = t * n * (1 + Number.EPSILON);
56
+ return $(s) / n;
57
+ }
58
+ const vt = /* @__PURE__ */ new Map();
59
+ function Re(t) {
60
+ return (String(t).split(".")[1] ?? "").length;
61
+ }
62
+ const Ge = /\.\d*?(?=9{6,}|0{6,})/gm;
63
+ function It(t) {
64
+ if (he(t) || vt.has(t))
65
+ return t;
66
+ const e = `${t}`, n = e.match(Ge);
67
+ if (n == null)
68
+ return t;
69
+ const s = n[0].length - 1;
70
+ if (e.indexOf("e-") !== -1) {
71
+ const o = e.split("e"), i = o[0] ?? "0", l = o[1] ?? "0";
72
+ return +`${It(+i)}e${l}`;
73
+ }
74
+ return ut(t, s);
75
+ }
76
+ function Et(t, e, n = !0) {
77
+ return n ? It(Tt(It(t / e)) * e) : Tt(t / e) * e;
78
+ }
79
+ function we(t, e, n = !0) {
80
+ return n ? It(st(It(t / e)) * e) : st(t / e) * e;
81
+ }
82
+ function ve(t, e, n, s) {
83
+ const o = [], i = s.map(Re);
84
+ for (let l = e; l < n; l++) {
85
+ const r = gt(l);
86
+ for (let a = 0; a < s.length; a++) {
87
+ const c = s[a] ?? 0, u = i[a] ?? 0, d = +`${c}e${l}`, f = (l >= 0 ? 0 : r) + (l >= u ? 0 : u), g = d;
88
+ o.push(g), vt.set(g, f);
89
+ }
90
+ }
91
+ return o;
92
+ }
93
+ const He = new Intl.NumberFormat(), xe = (t) => He.format(t), Ve = 0.1, lt = {
94
+ mode: 3,
95
+ pad: Ve,
96
+ soft: null
97
+ }, Ct = { pad: 0, soft: null, mode: 0 }, $e = { min: Ct, max: Ct };
98
+ function bt(t, e, n, s) {
99
+ let o;
100
+ typeof n == "number" ? (Ct.pad = n, Ct.soft = null, Ct.mode = 0, o = $e) : o = n;
101
+ const i = o.min, l = o.max, r = i.pad, a = l.pad, c = i.hard ?? -O, u = l.hard ?? O, d = i.soft ?? O, f = l.soft ?? -O, g = i.mode, M = l.mode;
102
+ let S = e - t;
103
+ const P = et(S), h = kt(gt(t), gt(e)), C = et(h), I = gt(C - P);
104
+ (S < 1e-24 || I > 10) && (S = 0, (t === 0 || e === 0) && (S = 1e-24));
105
+ const L = S || h || 1e3, T = et(L), x = wt(10, st(T)), m = L * (S === 0 ? t === 0 ? 0.1 : 1 : r), b = ut(we(t - m, x / 10), 24), y = t >= d && (g === 1 || g === 3 && b <= d || g === 2 && b >= d) ? d : O, D = kt(c, b < y && t >= y ? y : qt(y, b)), p = L * (S === 0 ? e === 0 ? 0.1 : 1 : a), w = ut(Et(e + p, x / 10), 24), v = e <= f && (M === 1 || M === 3 && w >= f || M === 2 && w <= f) ? f : -O, k = qt(u, w > v && e <= v ? v : kt(v, w));
106
+ return D === k && D === 0 ? [-1, 1] : [D, k];
107
+ }
108
+ function Be(t, e, n, s) {
109
+ n === 2 && (s = !0);
110
+ const o = Ot(t), i = Ot(e);
111
+ t === e && (o === -1 ? (t *= n, e /= n) : (t /= n, e *= n));
112
+ const l = n === 10 ? et : Mt, r = o === 1 ? st : Tt, a = i === 1 ? Tt : st, c = l(gt(t)), u = l(gt(e)), d = r(c), f = a(u);
113
+ let g = wt(n, d), M = wt(n, f);
114
+ return n === 10 && (d < 0 && (g = ut(g, -d)), f < 0 && (M = ut(M, -f))), s ? (t = g * o, e = M * i) : (t = we(t, wt(n, st(c)), !1), e = Et(e, wt(n, st(u)), !1)), [t, e];
115
+ }
116
+ function Zt(t) {
117
+ return (et((t ^ t >> 31) - (t >> 31)) | 0) + 1;
118
+ }
119
+ function We(t, e, n, s, o) {
120
+ const i = kt(Zt(t), Zt(e)), l = e - t;
121
+ let r = kt(0, ct(o / s * l, n) - 1);
122
+ do {
123
+ const a = n[r] ?? 0, c = s * a / l;
124
+ if (c >= o * 0.9 && i + (a < 5 ? vt.get(a) ?? 0 : 0) <= 17)
125
+ return [a, c];
126
+ } while (++r < n.length);
127
+ return [0, 0];
128
+ }
129
+ function Ee(t) {
130
+ return {
131
+ id: t.id,
132
+ min: t.min ?? null,
133
+ max: t.max ?? null,
134
+ distr: t.distr ?? N.Linear,
135
+ log: t.log ?? 10,
136
+ asinh: t.asinh ?? 1,
137
+ ori: t.ori ?? (t.id === "x" ? G.Horizontal : G.Vertical),
138
+ dir: t.dir ?? K.Forward,
139
+ time: t.time ?? !1,
140
+ auto: t.auto ?? !0,
141
+ range: t.range ?? null,
142
+ _min: null,
143
+ _max: null
144
+ };
145
+ }
146
+ function at(t) {
147
+ t._min = null, t._max = null;
148
+ }
149
+ function Me(t) {
150
+ if (t._min != null) return t._min;
151
+ const { min: e, distr: n } = t;
152
+ if (e == null) return 0;
153
+ if (n === N.Log) {
154
+ const s = e > 0 ? e : 1e-10;
155
+ t._min = (t.log === 10 ? et : Mt)(s);
156
+ } else n === N.Asinh ? t._min = Wt(e, t.asinh) : t._min = e;
157
+ return t._min;
158
+ }
159
+ function be(t) {
160
+ if (t._max != null) return t._max;
161
+ const { max: e, distr: n } = t;
162
+ if (e == null) return 0;
163
+ if (n === N.Log) {
164
+ const s = e > 0 ? e : 1e-10;
165
+ t._max = (t.log === 10 ? et : Mt)(s);
166
+ } else n === N.Asinh ? t._max = Wt(e, t.asinh) : t._max = e;
167
+ return t._max;
168
+ }
169
+ function Xe(t, e) {
170
+ if (e.min == null || e.max == null) return 0;
171
+ const n = Me(e), o = be(e) - n;
172
+ if (o === 0) return 0;
173
+ const { distr: i } = e;
174
+ if (i === N.Log) {
175
+ const l = e.log === 10 ? et : Mt, r = t > 0 ? t : 1e-10;
176
+ return (l(r) - n) / o;
177
+ }
178
+ return i === N.Asinh ? (Wt(t, e.asinh) - n) / o : (t - n) / o;
179
+ }
180
+ function Ye(t, e) {
181
+ if (e.min == null || e.max == null) return 0;
182
+ const n = Me(e), s = be(e);
183
+ if (s === n) return e.min;
184
+ const { distr: o } = e;
185
+ return o === N.Log ? Math.pow(e.log, n + t * (s - n)) : o === N.Asinh ? Fe(n + t * (s - n), e.asinh) : n + t * (s - n);
186
+ }
187
+ function H(t, e, n, s) {
188
+ const o = Xe(t, e);
189
+ let i;
190
+ return e.ori === G.Horizontal ? i = e.dir === K.Forward ? o : 1 - o : i = e.dir === K.Forward ? 1 - o : o, s + i * n;
191
+ }
192
+ function it(t, e, n, s) {
193
+ if (n === 0) return e.min ?? 0;
194
+ let o = (t - s) / n;
195
+ return e.ori === G.Horizontal ? e.dir === K.Backward && (o = 1 - o) : e.dir !== K.Backward && (o = 1 - o), Ye(o, e);
196
+ }
197
+ class Ue {
198
+ constructor() {
199
+ this.scales = /* @__PURE__ */ new Map(), this.groupXScales = /* @__PURE__ */ new Map();
200
+ }
201
+ addScale(e) {
202
+ this.scales.set(e.id, Ee(e));
203
+ }
204
+ removeScale(e) {
205
+ this.scales.delete(e);
206
+ }
207
+ getScale(e) {
208
+ return this.scales.get(e);
209
+ }
210
+ /** Get all scale states (for zoom reset, iteration) */
211
+ getAllScales() {
212
+ return this.scales.values();
213
+ }
214
+ /** Assign a group index to an x-scale */
215
+ setGroupXScale(e, n) {
216
+ this.groupXScales.set(e, n);
217
+ }
218
+ /** Get the x-scale key for a group */
219
+ getGroupXScaleKey(e) {
220
+ return this.groupXScales.get(e);
221
+ }
222
+ /**
223
+ * Set a scale's range directly (e.g., for zoom).
224
+ */
225
+ setRange(e, n, s) {
226
+ const o = this.scales.get(e);
227
+ o && (o.min = n, o.max = s, at(o));
228
+ }
229
+ /**
230
+ * Auto-range only x-scales from data (cheap: just reads first/last x values).
231
+ * Call before updateWindows() so the x-scale range is set for window clipping.
232
+ */
233
+ autoRangeX(e) {
234
+ var s, o, i, l, r, a;
235
+ const n = /* @__PURE__ */ new Map();
236
+ for (const [c, u] of this.groupXScales) {
237
+ const d = this.scales.get(u);
238
+ if (!d || !d.auto) continue;
239
+ const f = e[c];
240
+ if (!f || f.x.length === 0) continue;
241
+ const g = f.x[0], M = f.x[f.x.length - 1];
242
+ if (g == null || M == null) continue;
243
+ const S = n.get(u);
244
+ S ? (S.dataMin = Math.min(S.dataMin, g), S.dataMax = Math.max(S.dataMax, M)) : n.set(u, { dataMin: g, dataMax: M });
245
+ }
246
+ for (const [c, { dataMin: u, dataMax: d }] of n) {
247
+ const f = this.scales.get(c);
248
+ if (f) {
249
+ if (f.range) {
250
+ const [g, M] = bt(u, d, {
251
+ min: { pad: ((s = f.range.min) == null ? void 0 : s.pad) ?? 0, soft: ((o = f.range.min) == null ? void 0 : o.soft) ?? null, mode: ((i = f.range.min) == null ? void 0 : i.mode) ?? 0 },
252
+ max: { pad: ((l = f.range.max) == null ? void 0 : l.pad) ?? 0, soft: ((r = f.range.max) == null ? void 0 : r.soft) ?? null, mode: ((a = f.range.max) == null ? void 0 : a.mode) ?? 0 }
253
+ });
254
+ f.min = g, f.max = M;
255
+ } else
256
+ u === d ? [f.min, f.max] = bt(u, d, {
257
+ min: { pad: 0.1, soft: null, mode: 0 },
258
+ max: { pad: 0.1, soft: null, mode: 0 }
259
+ }) : (f.min = u, f.max = d);
260
+ at(f);
261
+ }
262
+ }
263
+ }
264
+ /**
265
+ * Auto-range scales from data.
266
+ * For each x-scale: range from its group's x values.
267
+ * For each y-scale: range from all series that reference it, within the visible x-window.
268
+ */
269
+ autoRange(e, n, s) {
270
+ var r, a, c, u, d, f, g, M, S, P, h, C;
271
+ const o = /* @__PURE__ */ new Map();
272
+ for (const [I, L] of this.groupXScales) {
273
+ const T = this.scales.get(L);
274
+ if (!T || !T.auto) continue;
275
+ const x = e[I];
276
+ if (!x || x.x.length === 0) continue;
277
+ const m = x.x[0], b = x.x[x.x.length - 1];
278
+ if (m == null || b == null) continue;
279
+ const y = o.get(L);
280
+ y ? (y.dataMin = Math.min(y.dataMin, m), y.dataMax = Math.max(y.dataMax, b)) : o.set(L, { dataMin: m, dataMax: b });
281
+ }
282
+ for (const [I, { dataMin: L, dataMax: T }] of o) {
283
+ const x = this.scales.get(I);
284
+ if (x) {
285
+ if (x.range) {
286
+ const [m, b] = bt(L, T, {
287
+ min: { pad: ((r = x.range.min) == null ? void 0 : r.pad) ?? 0, soft: ((a = x.range.min) == null ? void 0 : a.soft) ?? null, mode: ((c = x.range.min) == null ? void 0 : c.mode) ?? 0 },
288
+ max: { pad: ((u = x.range.max) == null ? void 0 : u.pad) ?? 0, soft: ((d = x.range.max) == null ? void 0 : d.soft) ?? null, mode: ((f = x.range.max) == null ? void 0 : f.mode) ?? 0 }
289
+ });
290
+ x.min = m, x.max = b;
291
+ } else
292
+ L === T ? [x.min, x.max] = bt(L, T, {
293
+ min: { pad: 0.1, soft: null, mode: 0 },
294
+ max: { pad: 0.1, soft: null, mode: 0 }
295
+ }) : (x.min = L, x.max = T);
296
+ at(x);
297
+ }
298
+ }
299
+ const i = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
300
+ for (const { group: I, index: L, yScale: T } of n) {
301
+ const x = e[I];
302
+ if (!x) continue;
303
+ const m = x.series[L];
304
+ if (!m || m.length === 0) continue;
305
+ const b = s.windows.get(I), y = b ? b[0] : 0, D = b ? b[1] : m.length - 1, p = this.scales.get(T), w = (p == null ? void 0 : p.distr) === N.Log, [v, k] = s.getCachedMinMax(I, L, y, D, 0, w), z = i.get(T), A = l.get(T);
306
+ i.set(T, z != null ? Math.min(z, v) : v), l.set(T, A != null ? Math.max(A, k) : k);
307
+ }
308
+ for (const [I, L] of i) {
309
+ const T = this.scales.get(I);
310
+ if (!T || !T.auto) continue;
311
+ const x = l.get(I) ?? -O;
312
+ if (L === O) continue;
313
+ let m, b;
314
+ if (T.distr === N.Log)
315
+ [m, b] = Be(L, x, T.log, !1);
316
+ else {
317
+ const y = T.range ?? { min: lt, max: lt };
318
+ [m, b] = bt(L, x, {
319
+ min: { pad: ((g = y.min) == null ? void 0 : g.pad) ?? lt.pad, soft: ((M = y.min) == null ? void 0 : M.soft) ?? lt.soft, mode: ((S = y.min) == null ? void 0 : S.mode) ?? lt.mode },
320
+ max: { pad: ((P = y.max) == null ? void 0 : P.pad) ?? lt.pad, soft: ((h = y.max) == null ? void 0 : h.soft) ?? lt.soft, mode: ((C = y.max) == null ? void 0 : C.mode) ?? lt.mode }
321
+ });
322
+ }
323
+ T.min = m, T.max = b, at(T);
324
+ }
325
+ }
326
+ }
327
+ const Ke = 1024;
328
+ class Ne {
329
+ constructor(e, n = Ke) {
330
+ this.data = e, this.len = e.length, this.blockSize = n, this.nBlocks = Math.ceil(e.length / n), this.blocks = new Float64Array(this.nBlocks * 2), this.buildAll();
331
+ }
332
+ /** Build min/max for all blocks */
333
+ buildAll() {
334
+ const { data: e, blockSize: n, nBlocks: s, blocks: o, len: i } = this;
335
+ for (let l = 0; l < s; l++) {
336
+ const r = l * n, a = Math.min(r + n, i);
337
+ let c = 1 / 0, u = -1 / 0;
338
+ for (let d = r; d < a; d++) {
339
+ const f = e[d];
340
+ f != null && (f < c && (c = f), f > u && (u = f));
341
+ }
342
+ o[l * 2] = c, o[l * 2 + 1] = u;
343
+ }
344
+ }
345
+ /**
346
+ * Query min/max over index range [i0, i1] (inclusive).
347
+ * Returns [Infinity, -Infinity] if no valid data in range.
348
+ */
349
+ rangeMinMax(e, n) {
350
+ const { data: s, blockSize: o, blocks: i } = this;
351
+ let l = 1 / 0, r = -1 / 0;
352
+ const a = Math.floor(e / o), c = Math.floor(n / o);
353
+ if (a === c) {
354
+ for (let f = e; f <= n; f++) {
355
+ const g = s[f];
356
+ g != null && (g < l && (l = g), g > r && (r = g));
357
+ }
358
+ return [l, r];
359
+ }
360
+ const u = (a + 1) * o - 1;
361
+ for (let f = e; f <= u; f++) {
362
+ const g = s[f];
363
+ g != null && (g < l && (l = g), g > r && (r = g));
364
+ }
365
+ for (let f = a + 1; f < c; f++) {
366
+ const g = i[f * 2] ?? 1 / 0, M = i[f * 2 + 1] ?? -1 / 0;
367
+ g < l && (l = g), M > r && (r = M);
368
+ }
369
+ const d = c * o;
370
+ for (let f = d; f <= n; f++) {
371
+ const g = s[f];
372
+ g != null && (g < l && (l = g), g > r && (r = g));
373
+ }
374
+ return [l, r];
375
+ }
376
+ /**
377
+ * Rebuild a single block (for incremental append).
378
+ * @param blockIdx - index of the block to rebuild
379
+ */
380
+ updateBlock(e) {
381
+ const { data: n, blockSize: s, blocks: o, len: i } = this;
382
+ if (e >= this.nBlocks) return;
383
+ const l = e * s, r = Math.min(l + s, i);
384
+ let a = 1 / 0, c = -1 / 0;
385
+ for (let u = l; u < r; u++) {
386
+ const d = n[u];
387
+ d != null && (d < a && (a = d), d > c && (c = d));
388
+ }
389
+ o[e * 2] = a, o[e * 2 + 1] = c;
390
+ }
391
+ /**
392
+ * Grow the tree to accommodate new data length.
393
+ * Only rebuilds newly added blocks.
394
+ */
395
+ grow(e) {
396
+ const n = this.nBlocks;
397
+ if (this.len = e, this.nBlocks = Math.ceil(e / this.blockSize), this.nBlocks > n) {
398
+ const o = new Float64Array(this.nBlocks * 2);
399
+ o.set(this.blocks), this.blocks = o;
400
+ }
401
+ const s = Math.max(0, n - 1);
402
+ for (let o = s; o < this.nBlocks; o++)
403
+ this.updateBlock(o);
404
+ }
405
+ /** Update data reference (for when the backing array changes, e.g. append with realloc) */
406
+ setData(e) {
407
+ this.data = e;
408
+ }
409
+ }
410
+ class je {
411
+ constructor() {
412
+ this.data = [], this.windows = /* @__PURE__ */ new Map(), this.minMaxCache = /* @__PURE__ */ new Map(), this.blockTrees = /* @__PURE__ */ new Map();
413
+ }
414
+ setData(e) {
415
+ this.data = e, this.windows.clear();
416
+ for (const n of this.minMaxCache.values()) n.clear();
417
+ this.minMaxCache.clear(), this.blockTrees.clear();
418
+ }
419
+ /** Get or lazily build a block min-max tree for a series */
420
+ getOrBuildTree(e, n) {
421
+ const s = `${e}:${n}`;
422
+ let o = this.blockTrees.get(s);
423
+ if (o) return o;
424
+ const i = this.data[e];
425
+ if (!i) return;
426
+ const l = i.series[n];
427
+ if (!(!l || l.length === 0))
428
+ return o = new Ne(l), this.blockTrees.set(s, o), o;
429
+ }
430
+ /**
431
+ * Update the visible window for each xGroup based on its x-scale range.
432
+ * @param getXScale - function to look up the x-scale for a group index
433
+ */
434
+ /** Update windows and return true if any window actually changed */
435
+ updateWindows(e) {
436
+ var s;
437
+ let n = !1;
438
+ for (let o = 0; o < this.data.length; o++) {
439
+ const i = this.data[o], l = e(o), r = this.windows.get(o);
440
+ let a, c;
441
+ if (!i || !l || l.min == null || l.max == null)
442
+ a = 0, c = Math.max(0, ((i == null ? void 0 : i.x.length) ?? 1) - 1);
443
+ else {
444
+ const u = i.x;
445
+ if (u.length === 0)
446
+ a = 0, c = 0;
447
+ else {
448
+ a = ct(l.min, u), c = ct(l.max, u);
449
+ const d = u[a], f = u[c];
450
+ a > 0 && d != null && d > l.min && a--, c < u.length - 1 && f != null && f < l.max && c++;
451
+ }
452
+ }
453
+ (!r || r[0] !== a || r[1] !== c) && (n = !0, (s = this.minMaxCache.get(o)) == null || s.clear()), this.windows.set(o, [a, c]);
454
+ }
455
+ return n;
456
+ }
457
+ /** Get the visible window for a group */
458
+ getWindow(e) {
459
+ var n;
460
+ return this.windows.get(e) ?? [0, (((n = this.data[e]) == null ? void 0 : n.x.length) || 1) - 1];
461
+ }
462
+ /** Get x values for a group */
463
+ getXValues(e) {
464
+ var n;
465
+ return ((n = this.data[e]) == null ? void 0 : n.x) ?? [];
466
+ }
467
+ /** Get y values for a specific series */
468
+ getYValues(e, n) {
469
+ var s;
470
+ return ((s = this.data[e]) == null ? void 0 : s.series[n]) ?? [];
471
+ }
472
+ /** Get cached min/max for a series within a window range */
473
+ getCachedMinMax(e, n, s, o, i, l) {
474
+ let r = this.minMaxCache.get(e);
475
+ const a = `${n}:${s}:${o}`;
476
+ if (r) {
477
+ const g = r.get(a);
478
+ if (g != null) return g;
479
+ } else
480
+ r = /* @__PURE__ */ new Map(), this.minMaxCache.set(e, r);
481
+ const c = this.data[e];
482
+ if (!c) return [1 / 0, -1 / 0];
483
+ const u = c.series[n];
484
+ if (!u || u.length === 0) return [1 / 0, -1 / 0];
485
+ let d;
486
+ const f = !l && i === yt.Unsorted ? this.getOrBuildTree(e, n) : void 0;
487
+ return f ? d = f.rangeMinMax(s, o) : d = _e(u, s, o, i, l), r.set(a, d), d;
488
+ }
489
+ /** Get block tree for a series (exposed for incremental append) */
490
+ getBlockTree(e, n) {
491
+ return this.getOrBuildTree(e, n);
492
+ }
493
+ /**
494
+ * Append new data points to an existing group.
495
+ * Much cheaper than setData() for streaming scenarios — O(newPoints) instead of O(totalPoints).
496
+ *
497
+ * Only works with regular arrays (not Float64Array) since arrays need to grow.
498
+ * Block trees are incrementally updated, and only the affected group's cache is invalidated.
499
+ */
500
+ appendData(e, n, s) {
501
+ var l;
502
+ const o = this.data[e];
503
+ if (!o) return;
504
+ const i = o.x;
505
+ if (Array.isArray(i)) {
506
+ for (let r = 0; r < n.length; r++) {
507
+ const a = n[r];
508
+ a != null && i.push(a);
509
+ }
510
+ for (let r = 0; r < o.series.length; r++) {
511
+ const a = o.series[r];
512
+ if (!a || !Array.isArray(a)) continue;
513
+ const c = s[r];
514
+ if (c)
515
+ for (let d = 0; d < c.length; d++)
516
+ a.push(c[d] ?? null);
517
+ const u = this.blockTrees.get(`${e}:${r}`);
518
+ u && (u.setData(a), u.grow(a.length));
519
+ }
520
+ (l = this.minMaxCache.get(e)) == null || l.clear();
521
+ }
522
+ }
523
+ /**
524
+ * Convert x-arrays in chart data to Float64Array for optimal memory layout.
525
+ * Call before setData() when not using appendData() (Float64Array is fixed-length).
526
+ */
527
+ static toTypedX(e) {
528
+ for (const n of e)
529
+ Array.isArray(n.x) && (n.x = Float64Array.from(n.x));
530
+ return e;
531
+ }
532
+ }
533
+ class qe {
534
+ constructor() {
535
+ this.state = {
536
+ left: -10,
537
+ top: -10,
538
+ activeGroup: -1,
539
+ activeSeriesIdx: -1,
540
+ activeDataIdx: -1
541
+ };
542
+ }
543
+ /** Hide the cursor (move off-screen) */
544
+ hide() {
545
+ this.state.left = -10, this.state.top = -10, this.state.activeGroup = -1, this.state.activeSeriesIdx = -1, this.state.activeDataIdx = -1;
546
+ }
547
+ /**
548
+ * Update cursor position and snap to nearest data point.
549
+ *
550
+ * @param cssX - cursor X in CSS pixels relative to plot area left
551
+ * @param cssY - cursor Y in CSS pixels relative to plot area top
552
+ * @param plotBox - current plot bounding box
553
+ * @param data - chart data groups
554
+ * @param seriesConfigs - all series configs
555
+ * @param getScale - scale lookup
556
+ */
557
+ update(e, n, s, o, i, l, r, a) {
558
+ this.state.left = e, this.state.top = n;
559
+ let c = 1 / 0, u = -1, d = -1, f = -1;
560
+ const g = /* @__PURE__ */ new Map();
561
+ for (const M of i) {
562
+ if (M.show === !1) continue;
563
+ let S = g.get(M.group);
564
+ S == null && (S = [], g.set(M.group, S)), S.push(M);
565
+ }
566
+ for (let M = 0; M < o.length; M++) {
567
+ const S = o[M];
568
+ if (S == null) continue;
569
+ const P = S.x;
570
+ if (P.length === 0) continue;
571
+ const h = a(M);
572
+ if (h == null) continue;
573
+ const C = l(h);
574
+ if (C == null || C.min == null || C.max == null) continue;
575
+ const [I, L] = r(M), T = s.width, x = s.left, m = it(e + x, C, T, x), b = ct(m, P, I, L), y = [b];
576
+ b > I && y.push(b - 1), b < L && y.push(b + 1);
577
+ const D = /* @__PURE__ */ new Map();
578
+ for (const p of y) {
579
+ const w = P[p];
580
+ if (w == null) continue;
581
+ const v = H(w, C, T, x);
582
+ for (const k of g.get(M) ?? []) {
583
+ const z = S.series[k.index];
584
+ if (z == null) continue;
585
+ const A = z[p];
586
+ if (A == null) continue;
587
+ let F = D.get(k.yScale);
588
+ if (F == null && !D.has(k.yScale) && (F = l(k.yScale), D.set(k.yScale, F)), F == null || F.min == null || F.max == null) continue;
589
+ const _ = s.height, R = s.top, V = H(A, F, _, R), B = e + x - v, W = n + R - V, j = B * B + W * W;
590
+ if (j < c && (c = j, u = M, d = k.index, f = p, j === 0))
591
+ break;
592
+ }
593
+ if (c === 0) break;
594
+ }
595
+ }
596
+ this.state.activeGroup = u, this.state.activeSeriesIdx = d, this.state.activeDataIdx = f;
597
+ }
598
+ /**
599
+ * Sync cursor to a specific x-value (from another chart in a sync group).
600
+ * Finds the closest data index and positions the cursor there.
601
+ */
602
+ syncToValue(e, n) {
603
+ const s = n.dataStore.data;
604
+ if (s.length === 0) return;
605
+ const o = s[0];
606
+ if (o == null) return;
607
+ const i = n.scaleManager.getGroupXScaleKey(0);
608
+ if (i == null) return;
609
+ const l = n.scaleManager.getScale(i);
610
+ if (l == null || l.min == null || l.max == null) return;
611
+ const [r, a] = n.dataStore.getWindow(0), c = ct(e, o.x, r, a), u = o.x[c];
612
+ if (u == null) return;
613
+ const d = H(u, l, n.plotBox.width, n.plotBox.left);
614
+ this.state.left = d - n.plotBox.left, this.state.activeGroup = 0, this.state.activeDataIdx = c;
615
+ let f = 0, g = n.plotBox.height / 2;
616
+ for (const M of n.seriesConfigs) {
617
+ if (M.group !== 0 || M.show === !1) continue;
618
+ const S = o.series[M.index];
619
+ if (S == null) continue;
620
+ const P = S[c];
621
+ if (P == null) continue;
622
+ const h = n.scaleManager.getScale(M.yScale);
623
+ if (!(h == null || h.min == null || h.max == null)) {
624
+ g = H(P, h, n.plotBox.height, n.plotBox.top) - n.plotBox.top, f = M.index;
625
+ break;
626
+ }
627
+ }
628
+ this.state.top = g, this.state.activeSeriesIdx = f;
629
+ }
630
+ }
631
+ class Oe {
632
+ constructor() {
633
+ this.flags = tt.None, this.frameId = null, this.callback = null;
634
+ }
635
+ /** Mark one or more dirty flags */
636
+ mark(e) {
637
+ this.flags |= e, this.scheduleFrame();
638
+ }
639
+ /** Check if a specific flag is set */
640
+ has(e) {
641
+ return (this.flags & e) !== 0;
642
+ }
643
+ /** Get current flags value */
644
+ get dirty() {
645
+ return this.flags;
646
+ }
647
+ /** Clear all flags (called after a redraw) */
648
+ clear() {
649
+ this.flags = tt.None;
650
+ }
651
+ /** Set the redraw callback */
652
+ onRedraw(e) {
653
+ this.callback = e;
654
+ }
655
+ /** Schedule a frame if not already pending */
656
+ scheduleFrame() {
657
+ this.frameId == null && (this.frameId = requestAnimationFrame(() => {
658
+ this.frameId = null;
659
+ const e = this.callback;
660
+ e != null && e(), this.clear();
661
+ }));
662
+ }
663
+ /** Cancel any pending frame */
664
+ cancel() {
665
+ this.frameId != null && (cancelAnimationFrame(this.frameId), this.frameId = null);
666
+ }
667
+ /** Clean up */
668
+ dispose() {
669
+ this.cancel(), this.callback = null, this.flags = tt.None;
670
+ }
671
+ }
672
+ function _t(t, e, n) {
673
+ t.lineTo(e, n);
674
+ }
675
+ function Rt(t, e, n) {
676
+ t.lineTo(n, e);
677
+ }
678
+ function Xt(t, e, n, s, o, i) {
679
+ const l = [];
680
+ let r = -1;
681
+ const a = o === K.Forward ? n : s, c = o === K.Forward ? s : n, u = o;
682
+ for (let d = a; o === K.Forward ? d <= c : d >= c; d += u)
683
+ if (e[d] === null || e[d] === void 0) {
684
+ if (r === -1) {
685
+ const f = Math.max(n, Math.min(d - o, s));
686
+ r = i(t[f]);
687
+ }
688
+ } else
689
+ r !== -1 && (l.push([r, i(t[d])]), r = -1);
690
+ return r !== -1 && l.push([r, i(t[s])]), l;
691
+ }
692
+ function Yt(t, e, n, s, o, i) {
693
+ const l = new Path2D();
694
+ let r = e === G.Horizontal ? n : s;
695
+ const a = e === G.Horizontal ? n + o : s + i, c = e === G.Horizontal ? s : n, u = e === G.Horizontal ? i : o;
696
+ for (const [d, f] of t)
697
+ d > r && (e === G.Horizontal ? l.rect(r, c, d - r, u) : l.rect(c, r, u, d - r)), r = f;
698
+ return r < a && (e === G.Horizontal ? l.rect(r, c, a - r, u) : l.rect(c, r, u, a - r)), l;
699
+ }
700
+ function Se(t) {
701
+ return (e, n, s, o, i, l) => {
702
+ s !== o && (i !== s && l !== s && t(e, n, s), i !== o && l !== o && t(e, n, o), t(e, n, l));
703
+ };
704
+ }
705
+ const Ze = Se(_t), Je = Se(Rt);
706
+ function Qe() {
707
+ return (t, e, n, s, o, i, l, r, a, c, u, d, f) => {
708
+ const g = (f == null ? void 0 : f.spanGaps) ?? !1;
709
+ if ([a, c] = (s.distr === N.Log ? me : Ft)(e, a, c), a === -1)
710
+ return {
711
+ stroke: new Path2D(),
712
+ fill: null,
713
+ clip: null,
714
+ band: null,
715
+ gaps: null
716
+ };
717
+ const S = (m) => d(H(m, n, o, l)), P = (m) => d(H(m, s, i, r));
718
+ let h, C;
719
+ n.ori === G.Horizontal ? (h = _t, C = Ze) : (h = Rt, C = Je);
720
+ const I = {
721
+ stroke: new Path2D(),
722
+ fill: null,
723
+ clip: null,
724
+ band: null,
725
+ gaps: null
726
+ }, L = I.stroke;
727
+ let T = !1;
728
+ if (c - a >= o * 4) {
729
+ const m = (A) => it(A, n, o, l);
730
+ let b = null, y = 0, D = 0, p = 0, w = S(t[u === K.Forward ? a : c]);
731
+ const v = S(t[a]), k = S(t[c]);
732
+ let z = m(u === K.Forward ? v + 1 : k - 1);
733
+ for (let A = u === K.Forward ? a : c; A >= a && A <= c; A += u) {
734
+ const F = t[A], R = (u === K.Forward ? F < z : F > z) ? w : S(F), V = e[A];
735
+ R === w ? V != null ? (p = V, b == null ? (h(L, R, P(p)), D = b = y = p) : p < b ? b = p : p > y && (y = p)) : V === null && !g && (T = !0) : (b != null && C(L, w, P(b), P(y), P(D), P(p)), V != null ? (p = V, h(L, R, P(p)), b = y = D = p) : (b = null, y = 0, V === null && !g && (T = !0)), w = R, z = m(w + u));
736
+ }
737
+ b != null && (b !== y ? C(L, w, P(b), P(y), P(D), P(p)) : h(L, w, P(p)));
738
+ } else
739
+ for (let m = u === K.Forward ? a : c; m >= a && m <= c; m += u) {
740
+ const b = e[m];
741
+ b === null && !g ? T = !0 : b != null && h(L, S(t[m]), P(b));
742
+ }
743
+ {
744
+ const m = I.fill = new Path2D(L), b = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, y = P(b);
745
+ let D = l, p = l + o;
746
+ u === K.Backward && ([p, D] = [D, p]), h(m, p, y), h(m, D, y);
747
+ }
748
+ if (T) {
749
+ const m = Xt(t, e, a, c, u, S);
750
+ I.gaps = m, I.clip = Yt(m, n.ori, l, r, o, i);
751
+ }
752
+ return I;
753
+ };
754
+ }
755
+ const Jt = /* @__PURE__ */ new WeakMap();
756
+ function Qt(t, e, n) {
757
+ return typeof e == "string" ? e : tn(t, e, n);
758
+ }
759
+ function tn(t, e, n) {
760
+ const s = Jt.get(e);
761
+ if (s != null && s.top === n.top && s.height === n.height)
762
+ return s.grad;
763
+ const o = t.createLinearGradient(0, n.top, 0, n.top + n.height);
764
+ for (const [i, l] of e.stops)
765
+ o.addColorStop(i, l);
766
+ return Jt.set(e, { grad: o, top: n.top, height: n.height }), o;
767
+ }
768
+ function en(t, e, n, s, o) {
769
+ if (e.show === !1) return;
770
+ const i = e.alpha ?? 1;
771
+ t.save(), i < 1 && (t.globalAlpha = i), n.clip && t.clip(n.clip);
772
+ const l = o ?? { top: 0, width: t.canvas.width / s, height: t.canvas.height / s };
773
+ if (e.fill && n.fill && (t.fillStyle = Qt(t, e.fill, l), t.fill(n.fill)), e.stroke) {
774
+ const r = (e.width ?? 1) * s;
775
+ t.strokeStyle = Qt(t, e.stroke, l), t.lineWidth = r, t.lineJoin = e.join ?? "round", t.lineCap = e.cap ?? "butt", e.dash && t.setLineDash(e.dash.map((d) => d * s));
776
+ const a = e.pxAlign ?? 1, c = r % 2 / 2;
777
+ a === 1 && c > 0 && t.translate(c, c), t.stroke(n.stroke);
778
+ }
779
+ t.restore();
780
+ }
781
+ const nn = Qe(), te = 64;
782
+ class sn {
783
+ constructor() {
784
+ this.ctx = null, this.pxRatio = 1, this.pathCache = /* @__PURE__ */ new Map(), this.pathCacheSize = 0, this.bandCache = /* @__PURE__ */ new Map(), this.lruHead = null, this.lruTail = null, this.lruMap = /* @__PURE__ */ new Map(), this.snapshotCanvas = null, this.snapshotValid = !1, this.cachedFillStyle = "", this.cachedStrokeStyle = "", this.cachedLineWidth = -1, this.cachedFont = "", this.cachedTextAlign = "", this.cachedTextBaseline = "", this.cachedGlobalAlpha = -1;
785
+ }
786
+ lruKey(e, n, s) {
787
+ return `${e}:${n}:${s}`;
788
+ }
789
+ /** Unlink a node from the doubly-linked list */
790
+ lruUnlink(e) {
791
+ e.prev != null ? e.prev.next = e.next : this.lruHead = e.next, e.next != null ? e.next.prev = e.prev : this.lruTail = e.prev, e.prev = null, e.next = null;
792
+ }
793
+ /** Append a node to the tail (most-recently-used) */
794
+ lruAppend(e) {
795
+ e.prev = this.lruTail, e.next = null, this.lruTail != null ? this.lruTail.next = e : this.lruHead = e, this.lruTail = e;
796
+ }
797
+ setContext(e, n) {
798
+ this.ctx = e, this.pxRatio = n, this.resetPropertyCache();
799
+ }
800
+ /** Reset cached property values (after context change) */
801
+ resetPropertyCache() {
802
+ this.cachedFillStyle = "", this.cachedStrokeStyle = "", this.cachedLineWidth = -1, this.cachedFont = "", this.cachedTextAlign = "", this.cachedTextBaseline = "", this.cachedGlobalAlpha = -1;
803
+ }
804
+ /** Set fillStyle only if changed */
805
+ setFillStyle(e, n) {
806
+ n !== this.cachedFillStyle && (e.fillStyle = n, this.cachedFillStyle = n);
807
+ }
808
+ /** Set strokeStyle only if changed */
809
+ setStrokeStyle(e, n) {
810
+ n !== this.cachedStrokeStyle && (e.strokeStyle = n, this.cachedStrokeStyle = n);
811
+ }
812
+ /** Set lineWidth only if changed */
813
+ setLineWidth(e, n) {
814
+ n !== this.cachedLineWidth && (e.lineWidth = n, this.cachedLineWidth = n);
815
+ }
816
+ /** Set font only if changed */
817
+ setFont(e, n) {
818
+ n !== this.cachedFont && (e.font = n, this.cachedFont = n);
819
+ }
820
+ /** Set textAlign only if changed */
821
+ setTextAlign(e, n) {
822
+ n !== this.cachedTextAlign && (e.textAlign = n, this.cachedTextAlign = n);
823
+ }
824
+ /** Set textBaseline only if changed */
825
+ setTextBaseline(e, n) {
826
+ n !== this.cachedTextBaseline && (e.textBaseline = n, this.cachedTextBaseline = n);
827
+ }
828
+ /** Set globalAlpha only if changed */
829
+ setGlobalAlpha(e, n) {
830
+ n !== this.cachedGlobalAlpha && (e.globalAlpha = n, this.cachedGlobalAlpha = n);
831
+ }
832
+ // --- Offscreen canvas snapshot ---
833
+ /** Save a snapshot of the current canvas using an offscreen canvas (much cheaper than getImageData) */
834
+ saveSnapshot(e, n, s) {
835
+ const o = e.canvas;
836
+ (this.snapshotCanvas == null || this.snapshotCanvas.width !== n || this.snapshotCanvas.height !== s) && (this.snapshotCanvas = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(n, s) : document.createElement("canvas"), this.snapshotCanvas.width = n, this.snapshotCanvas.height = s);
837
+ const i = this.snapshotCanvas.getContext("2d");
838
+ i != null && typeof i.drawImage == "function" && (i.clearRect(0, 0, n, s), i.drawImage(o, 0, 0), this.snapshotValid = !0);
839
+ }
840
+ /** Restore a previously saved snapshot. Returns false if no snapshot exists. */
841
+ restoreSnapshot(e) {
842
+ return !this.snapshotValid || this.snapshotCanvas == null || typeof e.drawImage != "function" ? !1 : (e.clearRect(0, 0, e.canvas.width, e.canvas.height), e.drawImage(this.snapshotCanvas, 0, 0), !0);
843
+ }
844
+ /** Invalidate the saved snapshot */
845
+ invalidateSnapshot() {
846
+ this.snapshotValid = !1;
847
+ }
848
+ // --- Two-level path cache ---
849
+ windowKey(e, n) {
850
+ return `${e}:${n}`;
851
+ }
852
+ /** Get cached paths for a series, promoting to most-recently-used */
853
+ getCachedPaths(e, n, s, o) {
854
+ const i = this.pathCache.get(e);
855
+ if (i == null) return;
856
+ const l = i.get(n);
857
+ if (l == null) return;
858
+ const r = this.windowKey(s, o), a = l.get(r);
859
+ if (a != null) {
860
+ const c = this.lruMap.get(this.lruKey(e, n, r));
861
+ c != null && c !== this.lruTail && (this.lruUnlink(c), this.lruAppend(c));
862
+ }
863
+ return a;
864
+ }
865
+ /** Store paths in cache, evicting oldest 25% when at capacity */
866
+ setCachedPaths(e, n, s, o, i) {
867
+ if (this.pathCacheSize >= te) {
868
+ const u = te >> 2;
869
+ let d = this.lruHead;
870
+ for (let f = 0; f < u && d != null; f++) {
871
+ const g = d.next, M = this.pathCache.get(d.group);
872
+ if (M != null) {
873
+ const S = M.get(d.index);
874
+ S != null && (S.delete(d.key), this.pathCacheSize--, S.size === 0 && M.delete(d.index), M.size === 0 && this.pathCache.delete(d.group));
875
+ }
876
+ this.lruMap.delete(this.lruKey(d.group, d.index, d.key)), d = g;
877
+ }
878
+ this.lruHead = d, d != null ? d.prev = null : this.lruTail = null;
879
+ }
880
+ let l = this.pathCache.get(e);
881
+ l == null && (l = /* @__PURE__ */ new Map(), this.pathCache.set(e, l));
882
+ let r = l.get(n);
883
+ r == null && (r = /* @__PURE__ */ new Map(), l.set(n, r));
884
+ const a = this.windowKey(s, o), c = this.lruKey(e, n, a);
885
+ if (!r.has(a)) {
886
+ this.pathCacheSize++;
887
+ const u = { group: e, index: n, key: a, prev: null, next: null };
888
+ this.lruAppend(u), this.lruMap.set(c, u);
889
+ }
890
+ r.set(a, i);
891
+ }
892
+ /** Invalidate paths for a specific series (all windows) */
893
+ invalidateSeries(e, n) {
894
+ const s = this.pathCache.get(e);
895
+ if (s == null) return;
896
+ const o = s.get(n);
897
+ if (o != null) {
898
+ this.pathCacheSize -= o.size;
899
+ for (const i of o.keys()) {
900
+ const l = this.lruKey(e, n, i), r = this.lruMap.get(l);
901
+ r != null && (this.lruUnlink(r), this.lruMap.delete(l));
902
+ }
903
+ s.delete(n);
904
+ }
905
+ }
906
+ /** Invalidate cached paths for a specific group */
907
+ clearGroupCache(e) {
908
+ const n = this.pathCache.get(e);
909
+ if (n != null) {
910
+ for (const [s, o] of n.entries()) {
911
+ this.pathCacheSize -= o.size;
912
+ for (const i of o.keys()) {
913
+ const l = this.lruKey(e, s, i), r = this.lruMap.get(l);
914
+ r != null && (this.lruUnlink(r), this.lruMap.delete(l));
915
+ }
916
+ }
917
+ this.pathCache.delete(e);
918
+ }
919
+ for (const s of this.bandCache.keys())
920
+ s.startsWith(`${e}:`) && this.bandCache.delete(s);
921
+ this.snapshotValid = !1;
922
+ }
923
+ /** Invalidate all cached paths (e.g. on scale change) */
924
+ clearCache() {
925
+ this.pathCache.clear(), this.pathCacheSize = 0, this.lruHead = null, this.lruTail = null, this.lruMap.clear(), this.bandCache.clear(), this.snapshotValid = !1;
926
+ }
927
+ // --- Band path cache ---
928
+ bandKey(e, n, s, o, i) {
929
+ return `${e}:${n}:${s}:${o}:${i}`;
930
+ }
931
+ getCachedBandPath(e, n, s, o, i) {
932
+ return this.bandCache.get(this.bandKey(e, n, s, o, i));
933
+ }
934
+ setCachedBandPath(e, n, s, o, i, l) {
935
+ this.bandCache.set(this.bandKey(e, n, s, o, i), l);
936
+ }
937
+ /**
938
+ * Draw a single series onto the canvas (assumes context is already clipped).
939
+ * Builds/caches paths and delegates to drawSeriesPath.
940
+ */
941
+ drawSeries(e, n, s) {
942
+ const o = this.ctx;
943
+ if (o == null || e.config.show === !1) return;
944
+ const i = e.config.group, l = e.config.index, [r, a] = e.window;
945
+ let c = this.getCachedPaths(i, l, r, a);
946
+ if (c == null) {
947
+ const u = e.config.paths ?? nn, d = e.xScale.dir, f = (S) => $(S), g = e.config.fillTo, M = typeof g == "function" ? g(e.yScale.min ?? 0, e.yScale.max ?? 0) : g;
948
+ c = u(
949
+ e.dataX,
950
+ e.dataY,
951
+ e.xScale,
952
+ e.yScale,
953
+ n.width,
954
+ n.height,
955
+ n.left,
956
+ n.top,
957
+ r,
958
+ a,
959
+ d,
960
+ f,
961
+ { fillTo: M, spanGaps: e.config.spanGaps }
962
+ ), this.setCachedPaths(i, l, r, a, c);
963
+ }
964
+ en(o, e.config, c, s, n);
965
+ }
966
+ /**
967
+ * Full draw cycle: clear canvas and draw all series.
968
+ */
969
+ draw(e, n, s, o) {
970
+ const i = this.ctx;
971
+ if (i == null) return;
972
+ const l = this.pxRatio;
973
+ i.clearRect(0, 0, e * l, n * l), i.save(), i.scale(l, l), i.beginPath(), i.rect(s.left, s.top, s.width, s.height), i.clip();
974
+ for (const r of o)
975
+ this.drawSeries(r, s, 1);
976
+ i.restore(), this.resetPropertyCache();
977
+ }
978
+ }
979
+ const ye = [1, 2, 2.5, 5], on = ve(10, -32, 0, ye), ln = ve(10, 0, 32, ye), ft = on.concat(ln);
980
+ function rn(t, e, n, s, o) {
981
+ if (n <= 0 || e < t) return [];
982
+ const i = [], l = vt.get(n) ?? 0, r = o ? t : ut(Et(t, n), l);
983
+ for (let a = r; a <= e; a = ut(a + n, l))
984
+ i.push(Object.is(a, -0) ? 0 : a);
985
+ return i;
986
+ }
987
+ function ee(t) {
988
+ return t.map((e) => xe(e));
989
+ }
990
+ function an(t, e, n) {
991
+ if (t <= 0 || e <= 0 || t >= e) return [];
992
+ const s = [], i = st((n === 10 ? et : Mt)(t));
993
+ let l = wt(n, i);
994
+ n === 10 && (l = ft[ct(l, ft)] ?? l);
995
+ let r = l, a = l * n;
996
+ n === 10 && (a = ft[ct(a, ft)] ?? a);
997
+ let c = 0;
998
+ do {
999
+ if (r >= t && s.push(r), r = r + l, n === 10 && !vt.has(r)) {
1000
+ const u = vt.get(l) ?? 0;
1001
+ r = ut(r, u);
1002
+ }
1003
+ r >= a * (1 - 1e-10) && (l = r, a = l * n, n === 10 && (a = ft[ct(a, ft)] ?? a));
1004
+ } while (r <= e && ++c < 1e4);
1005
+ return s;
1006
+ }
1007
+ function cn(t, e) {
1008
+ const n = e === 10 ? et : Mt;
1009
+ return t.map((s) => {
1010
+ if (s === 0) return !0;
1011
+ if (s < 0) return !1;
1012
+ const o = n(s);
1013
+ return gt(o - Math.round(o)) < 1e-10;
1014
+ });
1015
+ }
1016
+ function un(t, e) {
1017
+ const s = xe(Math.max(Math.abs(t), Math.abs(e))).length * 7;
1018
+ return Math.max(50, s + 16);
1019
+ }
1020
+ function fn(t, e, n, s) {
1021
+ if (s <= 0)
1022
+ return [0, 0];
1023
+ const o = xt(t.side) === G.Vertical, i = t.space ?? (o ? 30 : un(e, n)), l = t.incrs ?? ft;
1024
+ return We(e, n, l, s, i);
1025
+ }
1026
+ const hn = 50;
1027
+ function dn(t, e, n) {
1028
+ var r, a;
1029
+ if (t.size != null)
1030
+ return t.size;
1031
+ const s = ((r = t.ticks) == null ? void 0 : r.show) !== !1 ? ((a = t.ticks) == null ? void 0 : a.size) ?? 10 : 0, o = t.gap ?? 5, i = 12;
1032
+ if (xt(t.side) === G.Vertical && e != null) {
1033
+ let c = 0;
1034
+ for (const d of e)
1035
+ d.length > c && (c = d.length);
1036
+ const u = c * 7;
1037
+ return Math.max(50, s + o + u + 4);
1038
+ }
1039
+ return Math.max(50, s + o + i + 3);
1040
+ }
1041
+ function gn(t) {
1042
+ return {
1043
+ config: t,
1044
+ _show: t.show !== !1,
1045
+ _size: t.size ?? hn,
1046
+ _pos: 0,
1047
+ _lpos: 0,
1048
+ _splits: null,
1049
+ _values: null,
1050
+ _incr: 0,
1051
+ _space: 0,
1052
+ _rotate: 0
1053
+ };
1054
+ }
1055
+ const mt = 60, ht = 3600, rt = 86400, dt = 2592e3, At = 31536e3, pn = [
1056
+ // Seconds
1057
+ 1,
1058
+ 5,
1059
+ 10,
1060
+ 15,
1061
+ 30,
1062
+ // Minutes
1063
+ mt,
1064
+ 5 * mt,
1065
+ 10 * mt,
1066
+ 15 * mt,
1067
+ 30 * mt,
1068
+ // Hours
1069
+ ht,
1070
+ 2 * ht,
1071
+ 3 * ht,
1072
+ 4 * ht,
1073
+ 6 * ht,
1074
+ 12 * ht,
1075
+ // Days
1076
+ rt,
1077
+ 2 * rt,
1078
+ 3 * rt,
1079
+ 7 * rt,
1080
+ 14 * rt,
1081
+ // Months (approximate)
1082
+ dt,
1083
+ 2 * dt,
1084
+ 3 * dt,
1085
+ 6 * dt,
1086
+ // Years
1087
+ At
1088
+ ];
1089
+ function mn(t, e, n, s) {
1090
+ const o = [];
1091
+ if (n <= 0 || t >= e) return o;
1092
+ let i;
1093
+ if (n >= At) {
1094
+ const l = new Date(t * 1e3);
1095
+ for (l.setUTCMonth(0, 1), l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (l.setUTCFullYear(l.getUTCFullYear() + 1), i = l.getTime() / 1e3); i <= e; )
1096
+ o.push(i), l.setUTCFullYear(l.getUTCFullYear() + Math.round(n / At)), i = l.getTime() / 1e3;
1097
+ return o;
1098
+ }
1099
+ if (n >= dt) {
1100
+ const l = new Date(t * 1e3);
1101
+ l.setUTCDate(1), l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3;
1102
+ const r = Math.max(1, Math.round(n / dt));
1103
+ if (i < t && (l.setUTCMonth(l.getUTCMonth() + 1), i = l.getTime() / 1e3), r > 1) {
1104
+ const a = l.getUTCMonth(), c = Math.ceil((a + 1) / r) * r;
1105
+ l.setUTCMonth(c - 1), i = l.getTime() / 1e3;
1106
+ }
1107
+ for (; i <= e; )
1108
+ o.push(i), l.setUTCMonth(l.getUTCMonth() + r), i = l.getTime() / 1e3;
1109
+ return o;
1110
+ }
1111
+ if (n >= rt) {
1112
+ const l = new Date(t * 1e3);
1113
+ l.setUTCHours(0, 0, 0, 0), i = l.getTime() / 1e3, i < t && (i += rt);
1114
+ } else
1115
+ i = Math.ceil(t / n) * n;
1116
+ for (let l = 0; ; l++) {
1117
+ const r = i + l * n;
1118
+ if (r > e) break;
1119
+ o.push(r);
1120
+ }
1121
+ return o;
1122
+ }
1123
+ const ne = /* @__PURE__ */ new Map();
1124
+ function wn(t, e) {
1125
+ const n = JSON.stringify(t) + (e ?? "");
1126
+ let s = ne.get(n);
1127
+ return s == null && (s = new Intl.DateTimeFormat(void 0, { ...t, timeZone: e }), ne.set(n, s)), s;
1128
+ }
1129
+ function nt(t, e, n) {
1130
+ const s = new Date(t * 1e3);
1131
+ return wn(e, n).format(s);
1132
+ }
1133
+ function vn(t, e) {
1134
+ return nt(t, { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
1135
+ }
1136
+ function xn(t, e) {
1137
+ return nt(t, { hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: !1 }, e);
1138
+ }
1139
+ function Mn(t, e) {
1140
+ return nt(t, { hour: "2-digit", minute: "2-digit", hour12: !1 }, e);
1141
+ }
1142
+ function bn(t, e) {
1143
+ return nt(t, { month: "short", day: "numeric" }, e);
1144
+ }
1145
+ function Sn(t, e) {
1146
+ return nt(t, { year: "numeric" }, e);
1147
+ }
1148
+ function yn(t, e) {
1149
+ return nt(t, { year: "numeric", month: "short" }, e);
1150
+ }
1151
+ function kn(t, e, n) {
1152
+ let s;
1153
+ return e >= At ? s = Sn : e >= dt ? s = yn : e >= rt ? s = bn : e >= ht ? s = Mn : e >= mt ? s = xn : s = vn, t.map((o) => s(o, n));
1154
+ }
1155
+ function Cn(t, e, n, s, o) {
1156
+ const i = e - t;
1157
+ if (i <= 0 || s <= 0) return [0, 0];
1158
+ for (const r of n) {
1159
+ const a = i / r, c = s / a;
1160
+ if (c >= o)
1161
+ return [r, c];
1162
+ }
1163
+ const l = n[n.length - 1] ?? At;
1164
+ return [l, s / (i / l)];
1165
+ }
1166
+ const Tn = 3;
1167
+ function In(t, e, n, s, o) {
1168
+ let i = !0;
1169
+ for (const l of t) {
1170
+ const r = l.config;
1171
+ if (r.show === !1)
1172
+ continue;
1173
+ const a = e(r.scale);
1174
+ if (!a || a.min == null || a.max == null) {
1175
+ l._show && (i = !1, l._show = !1);
1176
+ continue;
1177
+ } else
1178
+ l._show || (i = !1, l._show = !0);
1179
+ const c = r.side, d = xt(c) === G.Horizontal ? n : s, { min: f, max: g } = a;
1180
+ let M, S;
1181
+ if (a.time) {
1182
+ const h = r.space ?? 80;
1183
+ [M, S] = Cn(f, g, pn, d, h);
1184
+ } else
1185
+ [M, S] = fn(r, f, g, d);
1186
+ if (l._incr = M, l._space = S, S === 0)
1187
+ continue;
1188
+ if (r.splits)
1189
+ l._splits = r.splits(f, g, M, S);
1190
+ else if (a.time)
1191
+ l._splits = mn(f, g, M);
1192
+ else if (a.distr === N.Log)
1193
+ l._splits = an(f, g, a.log);
1194
+ else {
1195
+ const h = a.distr === N.Ordinal;
1196
+ l._splits = rn(f, g, M, S, h);
1197
+ }
1198
+ if (r.values)
1199
+ l._values = r.values(l._splits, S, M);
1200
+ else if (a.time)
1201
+ l._values = kn(l._splits, M);
1202
+ else if (a.distr === N.Log) {
1203
+ const h = cn(l._splits, a.log), C = ee(l._splits);
1204
+ l._values = C.map((I, L) => h[L] ? I : "");
1205
+ } else
1206
+ l._values = ee(l._splits);
1207
+ l._rotate = c === U.Bottom ? r.rotate ?? 0 : 0;
1208
+ const P = l._size;
1209
+ l._size = Tt(dn(r, l._values)), P !== l._size && (i = !1);
1210
+ }
1211
+ return i;
1212
+ }
1213
+ function se(t, e, n) {
1214
+ let s = t, o = e, i = 0, l = 0;
1215
+ for (const r of n) {
1216
+ if (!r._show)
1217
+ continue;
1218
+ const a = r.config.side, c = xt(a) === G.Vertical, u = r.config.label != null ? r.config.labelSize ?? 20 : 0, d = r._size + u;
1219
+ d > 0 && (c ? (s -= d, a === U.Left && (i += d)) : (o -= d, a === U.Top && (l += d)));
1220
+ }
1221
+ return {
1222
+ left: i,
1223
+ top: l,
1224
+ width: Math.max(s, 0),
1225
+ height: Math.max(o, 0)
1226
+ };
1227
+ }
1228
+ function An(t, e) {
1229
+ let n = e.top, s = e.left + e.width, o = e.top + e.height, i = e.left;
1230
+ function l(r, a) {
1231
+ switch (r) {
1232
+ case U.Top:
1233
+ return n -= a, n + a;
1234
+ case U.Right: {
1235
+ const c = s;
1236
+ return s += a, c;
1237
+ }
1238
+ case U.Bottom: {
1239
+ const c = o;
1240
+ return o += a, c;
1241
+ }
1242
+ case U.Left:
1243
+ return i -= a, i + a;
1244
+ default:
1245
+ return 0;
1246
+ }
1247
+ }
1248
+ for (const r of t) {
1249
+ if (!r._show)
1250
+ continue;
1251
+ const a = r.config.side;
1252
+ if (r._pos = l(a, r._size), r.config.label != null) {
1253
+ const c = r.config.labelSize ?? 20;
1254
+ r._lpos = l(a, c);
1255
+ }
1256
+ }
1257
+ }
1258
+ function Pn(t, e, n, s) {
1259
+ for (const r of n)
1260
+ r._size = 0;
1261
+ let o = !1, i = 0, l = { left: 0, top: 0, width: t, height: e };
1262
+ for (; !o; ) {
1263
+ i++;
1264
+ const r = In(
1265
+ n,
1266
+ s,
1267
+ l.width,
1268
+ l.height
1269
+ );
1270
+ o = i === Tn || r, o || (l = se(t, e, n));
1271
+ }
1272
+ return l = se(t, e, n), An(n, l), l;
1273
+ }
1274
+ const oe = "top", le = "bottom", Ln = "left", Dn = "right";
1275
+ function ie(t, e) {
1276
+ return e === 1 ? t : t.replace(/(\d+(?:\.\d+)?)px/, (n, s) => `${Math.round(Number(s) * e)}px`);
1277
+ }
1278
+ function re(t, e, n, s, o, i, l, r, a, c, u) {
1279
+ const d = r % 2 / 2;
1280
+ t.save(), t.translate(d, d), t.strokeStyle = a, t.lineWidth = r, c.length > 0 && t.setLineDash(c), t.beginPath();
1281
+ let f = 0, g = 0, M = 0, S = 0;
1282
+ const P = i + (o === U.Top || o === U.Left ? -l : l);
1283
+ s === G.Horizontal ? (g = i, S = P) : (f = i, M = P);
1284
+ for (let h = 0; h < e.length; h++)
1285
+ n[h] != null && (s === G.Horizontal ? f = M = e[h] ?? 0 : g = S = e[h] ?? 0, t.moveTo(f, g), t.lineTo(M, S));
1286
+ t.stroke(), t.restore();
1287
+ }
1288
+ function zn(t, e, n, s, o) {
1289
+ const i = $(s.left * o), l = $(s.top * o), r = $(s.width * o), a = $(s.height * o);
1290
+ for (const c of e) {
1291
+ if (!c._show)
1292
+ continue;
1293
+ const u = c.config, d = u.side, f = xt(d), g = n(u.scale);
1294
+ if (!g || g.min == null || g.max == null)
1295
+ continue;
1296
+ const M = u.stroke ?? "#000", S = d === U.Top || d === U.Left ? -1 : 1, P = c._splits, h = c._values;
1297
+ if (!P || !h || c._space === 0)
1298
+ continue;
1299
+ const C = f === G.Horizontal ? s.width : s.height, I = f === G.Horizontal ? s.left : s.top, L = P.map((y) => $(H(y, g, C, I) * o)), T = h.map((y) => y === "" ? null : y), x = u.grid;
1300
+ if ((x == null ? void 0 : x.show) !== !1) {
1301
+ const y = (x == null ? void 0 : x.stroke) ?? "rgba(0,0,0,0.12)", D = $(((x == null ? void 0 : x.width) ?? 2) * o), p = ((x == null ? void 0 : x.dash) ?? []).map((k) => k * o), w = f === G.Horizontal ? l : i, v = f === G.Horizontal ? a : r;
1302
+ re(t, L, T, f, 2, w, v, D, y, p);
1303
+ }
1304
+ const m = u.ticks;
1305
+ if ((m == null ? void 0 : m.show) !== !1) {
1306
+ const y = (m == null ? void 0 : m.stroke) ?? M, D = $(((m == null ? void 0 : m.width) ?? 1) * o), p = $(((m == null ? void 0 : m.size) ?? 10) * o), w = ((m == null ? void 0 : m.dash) ?? []).map((k) => k * o), v = $(c._pos * o);
1307
+ re(t, L, T, f, d, v, p, D, y, w);
1308
+ }
1309
+ {
1310
+ const y = (m == null ? void 0 : m.show) !== !1 ? ((m == null ? void 0 : m.size) ?? 10) * o : 0, D = $((u.gap ?? 5) * o), p = $(c._pos * o), w = (y + D) * S, v = p + w, k = ie(u.font ?? "12px system-ui, sans-serif", o), z = f === G.Horizontal ? "center" : d === U.Left ? Dn : Ln, A = f === G.Horizontal ? d === U.Bottom ? oe : le : "middle";
1311
+ t.font = k, t.fillStyle = M, t.textAlign = z, t.textBaseline = A;
1312
+ const F = c._rotate * -Ht / 180;
1313
+ if (F !== 0) {
1314
+ const _ = Math.cos(F), R = Math.sin(F);
1315
+ for (let V = 0; V < h.length; V++) {
1316
+ const B = h[V];
1317
+ if (B == null || B === "")
1318
+ continue;
1319
+ const W = L[V] ?? 0;
1320
+ t.setTransform(_, R, -R, _, W, v), t.fillText(B, 0, 0);
1321
+ }
1322
+ t.setTransform(1, 0, 0, 1, 0, 0);
1323
+ } else
1324
+ for (let _ = 0; _ < h.length; _++) {
1325
+ const R = h[_];
1326
+ if (R == null || R === "")
1327
+ continue;
1328
+ const V = L[_] ?? 0, B = f === G.Horizontal ? V : v, W = f === G.Horizontal ? v : V;
1329
+ t.fillText(R, B, W);
1330
+ }
1331
+ }
1332
+ if (u.label != null) {
1333
+ const y = ie(u.labelFont ?? "bold 12px system-ui, sans-serif", o);
1334
+ t.font = y, t.fillStyle = M, t.textAlign = "center", t.textBaseline = d === U.Bottom ? oe : le;
1335
+ const D = $((c._lpos + (u.labelGap ?? 0) * S) * o);
1336
+ f === G.Vertical ? (t.save(), t.translate(
1337
+ D,
1338
+ $(l + a / 2)
1339
+ ), t.rotate((d === U.Left ? -Ht : Ht) / 2), t.fillText(u.label, 0, 0), t.restore()) : t.fillText(u.label, $(i + r / 2), D);
1340
+ }
1341
+ const b = u.border;
1342
+ if ((b == null ? void 0 : b.show) !== !1 && b != null) {
1343
+ const y = b.stroke ?? M, D = $((b.width ?? 1) * o), p = (b.dash ?? []).map((v) => v * o), w = $(c._pos * o);
1344
+ t.strokeStyle = y, t.lineWidth = D, p.length > 0 && t.setLineDash(p), t.beginPath(), f === G.Horizontal ? (t.moveTo(i, w), t.lineTo(i + r, w)) : (t.moveTo(w, l), t.lineTo(w, l + a)), t.stroke(), p.length > 0 && t.setLineDash([]);
1345
+ }
1346
+ }
1347
+ }
1348
+ const Fn = {
1349
+ stroke: "#607D8B",
1350
+ width: 1,
1351
+ dash: [5, 3],
1352
+ pointRadius: 4,
1353
+ showX: !0,
1354
+ showY: !0
1355
+ };
1356
+ function ae(t, e, n, s, o, i, l, r, a) {
1357
+ var I;
1358
+ if (e.left < 0 || e.top < 0) return;
1359
+ const c = { ...Fn, ...a }, u = s, d = $(n.left * u), f = $(n.top * u), g = $(n.width * u), M = $(n.height * u), S = $(c.width * u), P = S % 2 / 2, h = $((n.left + e.left) * u) + P, C = $((n.top + e.top) * u) + P;
1360
+ if (t.save(), t.strokeStyle = c.stroke, t.lineWidth = S, t.setLineDash(c.dash.map((L) => L * u)), c.showX && (t.beginPath(), t.moveTo(h, f), t.lineTo(h, f + M), t.stroke()), c.showY && (t.beginPath(), t.moveTo(d, C), t.lineTo(d + g, C), t.stroke()), t.setLineDash([]), e.activeGroup >= 0 && e.activeDataIdx >= 0) {
1361
+ const L = e.activeGroup, T = e.activeSeriesIdx, x = e.activeDataIdx, m = o[L];
1362
+ if (m != null && T >= 0 && T < m.series.length && x < m.x.length) {
1363
+ const b = m.x[x], y = m.series[T], D = y != null ? y[x] : null;
1364
+ if (b != null && D != null) {
1365
+ let p = c.stroke, w = !0;
1366
+ for (const v of i)
1367
+ if (v.group === L && v.index === T) {
1368
+ const k = v.stroke;
1369
+ p = (typeof k == "string" ? k : void 0) ?? c.stroke, w = ((I = v.cursor) == null ? void 0 : I.show) !== !1;
1370
+ break;
1371
+ }
1372
+ if (w) {
1373
+ const v = r(L), k = v != null ? l(v) : void 0, z = _n(i, L, T), A = z != null ? l(z) : void 0;
1374
+ if (k != null && A != null && k.min != null && k.max != null && A.min != null && A.max != null) {
1375
+ const F = $(H(b, k, n.width, n.left) * u), _ = $(H(D, A, n.height, n.top) * u), R = c.pointRadius * u, V = $(2 * u);
1376
+ t.beginPath(), t.arc(F, _, R, 0, Math.PI * 2), t.fillStyle = "#fff", t.fill(), t.strokeStyle = p, t.lineWidth = V, t.stroke();
1377
+ }
1378
+ }
1379
+ }
1380
+ }
1381
+ }
1382
+ t.restore();
1383
+ }
1384
+ function _n(t, e, n) {
1385
+ for (const s of t)
1386
+ if (s.group === e && s.index === n)
1387
+ return s.yScale;
1388
+ }
1389
+ const Rn = {
1390
+ fill: "rgba(0,0,0,0.07)",
1391
+ stroke: "rgba(0,0,0,0.15)",
1392
+ width: 1
1393
+ };
1394
+ function ce(t, e, n, s, o) {
1395
+ if (!e.show || e.width <= 0) return;
1396
+ const i = { ...Rn, ...o }, l = s, r = $((n.left + e.left) * l), a = $((n.top + e.top) * l), c = $(e.width * l), u = $(e.height * l);
1397
+ t.save(), t.fillStyle = i.fill, t.fillRect(r, a, c, u), i.width > 0 && (t.strokeStyle = i.stroke, t.lineWidth = $(i.width * l), t.strokeRect(r, a, c, u)), t.restore();
1398
+ }
1399
+ function Gn(t, e, n, s, o, i, l, r, a, c, u, d) {
1400
+ const f = u / 2 * l, g = Math.max(1, $(u * 0.2)) * l, M = (c == null ? void 0 : c.stroke) ?? d, S = (c == null ? void 0 : c.fill) ?? "#fff";
1401
+ t.save(), t.strokeStyle = M, t.fillStyle = S, t.lineWidth = g, (c == null ? void 0 : c.dash) != null && t.setLineDash(c.dash.map((P) => P * l));
1402
+ for (let P = r; P <= a; P++) {
1403
+ const h = n[P];
1404
+ if (h == null) continue;
1405
+ const C = e[P];
1406
+ if (C == null) continue;
1407
+ const I = $(H(C, s, i.width, i.left) * l), L = $(H(h, o, i.height, i.top) * l);
1408
+ t.beginPath(), t.arc(I, L, f, 0, Math.PI * 2), t.fill(), t.stroke();
1409
+ }
1410
+ t.restore();
1411
+ }
1412
+ function Hn(t, e, n, s, o, i, l) {
1413
+ if (typeof t == "function")
1414
+ return t(e, n, s, o, i);
1415
+ if (t === !0) return !0;
1416
+ if (t === !1) return !1;
1417
+ const r = o - s;
1418
+ return r > 0 && r <= i / l;
1419
+ }
1420
+ function Vn(t, e, n, s, o, i, l, r, a) {
1421
+ if (r > a || r < 0) return null;
1422
+ const c = (g) => H(g, s, i.width, i.left) * l, u = (g) => H(g, o, i.height, i.top) * l, d = new Path2D();
1423
+ let f = !1;
1424
+ for (let g = r; g <= a; g++) {
1425
+ const M = e[g], S = t[g];
1426
+ if (M == null || S == null) continue;
1427
+ const P = c(S), h = u(M);
1428
+ f ? d.lineTo(P, h) : (d.moveTo(P, h), f = !0);
1429
+ }
1430
+ if (!f) return null;
1431
+ for (let g = a; g >= r; g--) {
1432
+ const M = n[g], S = t[g];
1433
+ M == null || S == null || d.lineTo(c(S), u(M));
1434
+ }
1435
+ return d.closePath(), d;
1436
+ }
1437
+ function $n(t, e, n) {
1438
+ t.save(), t.fillStyle = e.fill ?? "rgba(0, 120, 255, 0.1)", t.fill(n), t.restore();
1439
+ }
1440
+ function $t(t, e, n, s) {
1441
+ return { ctx: t, plotBox: e, pxRatio: n, getScale: s, valToX: (l, r = "x") => {
1442
+ const a = s(r);
1443
+ return a == null || a.min == null || a.max == null ? null : H(l, a, e.width, e.left);
1444
+ }, valToY: (l, r) => {
1445
+ const a = s(r);
1446
+ return a == null || a.min == null || a.max == null ? null : H(l, a, e.height, e.top);
1447
+ } };
1448
+ }
1449
+ function Bn() {
1450
+ const t = {
1451
+ scaleManager: new Ue(),
1452
+ dataStore: new je(),
1453
+ renderer: new sn(),
1454
+ cursorManager: new qe(),
1455
+ selectState: { show: !1, left: 0, top: 0, width: 0, height: 0 },
1456
+ scaleConfigs: [],
1457
+ seriesConfigs: [],
1458
+ axisConfigs: [],
1459
+ bandConfigs: [],
1460
+ axisStates: [],
1461
+ width: 0,
1462
+ height: 0,
1463
+ pxRatio: typeof window < "u" && window.devicePixelRatio || 1,
1464
+ plotBox: { left: 0, top: 0, width: 0, height: 0 },
1465
+ canvas: null,
1466
+ listeners: /* @__PURE__ */ new Set(),
1467
+ scheduler: new Oe(),
1468
+ drawHooks: /* @__PURE__ */ new Set(),
1469
+ cursorDrawHooks: /* @__PURE__ */ new Set(),
1470
+ focusedSeries: null,
1471
+ focusAlpha: 0.15,
1472
+ wheelZoom: !1,
1473
+ revision: 0,
1474
+ eventCallbacks: {},
1475
+ _prevScaleRanges: /* @__PURE__ */ new Map(),
1476
+ registerScale(e) {
1477
+ t.scaleConfigs = t.scaleConfigs.filter((n) => n.id !== e.id), t.scaleConfigs.push(e), t.scaleManager.addScale(e);
1478
+ },
1479
+ unregisterScale(e) {
1480
+ t.scaleConfigs = t.scaleConfigs.filter((n) => n.id !== e), t.scaleManager.removeScale(e);
1481
+ },
1482
+ registerSeries(e) {
1483
+ t.seriesConfigs = t.seriesConfigs.filter(
1484
+ (n) => !(n.group === e.group && n.index === e.index)
1485
+ ), t.seriesConfigs.push(e);
1486
+ },
1487
+ unregisterSeries(e, n) {
1488
+ t.seriesConfigs = t.seriesConfigs.filter(
1489
+ (s) => !(s.group === e && s.index === n)
1490
+ );
1491
+ },
1492
+ toggleSeries(e, n) {
1493
+ const s = t.seriesConfigs.find((o) => o.group === e && o.index === n);
1494
+ s != null && (s.show = s.show === !1, t.revision++, t.renderer.invalidateSeries(e, n), t.scheduleRedraw());
1495
+ },
1496
+ setFocus(e) {
1497
+ t.focusedSeries = e, t.scheduleRedraw();
1498
+ },
1499
+ setSize(e, n) {
1500
+ t.width = e, t.height = n, t.canvas && (t.canvas.width = e * t.pxRatio, t.canvas.height = n * t.pxRatio, t.canvas.style.width = `${e}px`, t.canvas.style.height = `${n}px`), t.renderer.clearCache(), t.scheduleRedraw();
1501
+ },
1502
+ scheduleRedraw() {
1503
+ t.scheduler.mark(tt.Full);
1504
+ },
1505
+ scheduleCursorRedraw() {
1506
+ t.scheduler.mark(tt.Cursor);
1507
+ },
1508
+ subscribe(e) {
1509
+ return t.listeners.add(e), () => {
1510
+ t.listeners.delete(e);
1511
+ };
1512
+ },
1513
+ redraw() {
1514
+ const { scaleManager: e, dataStore: n, renderer: s, seriesConfigs: o, width: i, height: l, pxRatio: r, canvas: a, scheduler: c } = t;
1515
+ if (a == null || i === 0 || l === 0) return;
1516
+ const u = a.getContext("2d");
1517
+ if (u == null) return;
1518
+ s.setContext(u, r);
1519
+ const f = (c.dirty & ~(tt.Cursor | tt.Select)) === 0, g = (h) => e.getScale(h);
1520
+ if (f && s.restoreSnapshot(u)) {
1521
+ if (ae(
1522
+ u,
1523
+ t.cursorManager.state,
1524
+ t.plotBox,
1525
+ r,
1526
+ n.data,
1527
+ o,
1528
+ g,
1529
+ (h) => e.getGroupXScaleKey(h)
1530
+ ), ce(u, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1531
+ u.save(), u.scale(r, r);
1532
+ const h = $t(u, t.plotBox, r, g);
1533
+ for (const C of t.cursorDrawHooks)
1534
+ try {
1535
+ C(h, t.cursorManager.state);
1536
+ } catch (I) {
1537
+ console.warn("[uPlot+] draw hook error:", I);
1538
+ }
1539
+ u.restore();
1540
+ }
1541
+ for (const h of t.listeners) h();
1542
+ return;
1543
+ }
1544
+ e.autoRangeX(n.data), n.updateWindows((h) => {
1545
+ const C = e.getGroupXScaleKey(h);
1546
+ return C != null ? e.getScale(C) : void 0;
1547
+ });
1548
+ const M = o.map((h) => ({
1549
+ group: h.group,
1550
+ index: h.index,
1551
+ yScale: h.yScale
1552
+ }));
1553
+ e.autoRange(n.data, M, n), Wn(t), t.axisStates.length > 0 ? t.plotBox = Pn(i, l, t.axisStates, g) : t.plotBox = {
1554
+ left: 10,
1555
+ top: 10,
1556
+ width: i - 20,
1557
+ height: l - 20
1558
+ }, u.clearRect(0, 0, i * r, l * r), t.axisStates.length > 0 && zn(u, t.axisStates, g, t.plotBox, r);
1559
+ const S = [];
1560
+ for (const h of o) {
1561
+ const C = e.getGroupXScaleKey(h.group), I = C != null ? e.getScale(C) : void 0, L = e.getScale(h.yScale);
1562
+ I == null || L == null || S.push({
1563
+ config: h,
1564
+ dataX: n.getXValues(h.group),
1565
+ dataY: n.getYValues(h.group, h.index),
1566
+ xScale: I,
1567
+ yScale: L,
1568
+ window: n.getWindow(h.group)
1569
+ });
1570
+ }
1571
+ u.save(), u.scale(r, r), u.beginPath(), u.rect(t.plotBox.left, t.plotBox.top, t.plotBox.width, t.plotBox.height), u.clip();
1572
+ for (let h = 0; h < S.length; h++) {
1573
+ const C = S[h];
1574
+ C != null && (t.focusedSeries != null && h !== t.focusedSeries ? (u.globalAlpha = t.focusAlpha, s.drawSeries(C, t.plotBox, 1), u.globalAlpha = 1) : s.drawSeries(C, t.plotBox, 1));
1575
+ }
1576
+ const P = /* @__PURE__ */ new Map();
1577
+ for (const h of o)
1578
+ P.set(`${h.group}-${h.index}`, h);
1579
+ for (const h of t.bandConfigs) {
1580
+ const C = e.getGroupXScaleKey(h.group), I = C != null ? e.getScale(C) : void 0, L = P.get(`${h.group}-${h.series[0]}`), T = P.get(`${h.group}-${h.series[1]}`);
1581
+ if (I == null || L == null || T == null) continue;
1582
+ const x = e.getScale(L.yScale);
1583
+ if (x == null) continue;
1584
+ const [m, b] = n.getWindow(h.group), y = h.series[0], D = h.series[1];
1585
+ let p = s.getCachedBandPath(h.group, y, D, m, b);
1586
+ p == null && (p = Vn(
1587
+ n.getXValues(h.group),
1588
+ n.getYValues(h.group, y),
1589
+ n.getYValues(h.group, D),
1590
+ I,
1591
+ x,
1592
+ t.plotBox,
1593
+ r,
1594
+ m,
1595
+ b
1596
+ ) ?? void 0, p != null && s.setCachedBandPath(h.group, y, D, m, b, p)), p != null && $n(u, h, p);
1597
+ }
1598
+ for (const h of S) {
1599
+ const C = h.config;
1600
+ if (C.show === !1) continue;
1601
+ const I = C.points, L = C.width ?? 1, T = (I == null ? void 0 : I.size) ?? 3 + L * 2, x = (I == null ? void 0 : I.space) ?? T * 2, [m, b] = h.window;
1602
+ Hn(I == null ? void 0 : I.show, C.group, C.index, m, b, t.plotBox.width, x) && Gn(
1603
+ u,
1604
+ h.dataX,
1605
+ h.dataY,
1606
+ h.xScale,
1607
+ h.yScale,
1608
+ t.plotBox,
1609
+ r,
1610
+ m,
1611
+ b,
1612
+ I,
1613
+ T,
1614
+ (typeof C.stroke == "string" ? C.stroke : null) ?? "#000"
1615
+ );
1616
+ }
1617
+ if (u.restore(), t.drawHooks.size > 0) {
1618
+ u.save(), u.beginPath(), u.rect(
1619
+ t.plotBox.left * r,
1620
+ t.plotBox.top * r,
1621
+ t.plotBox.width * r,
1622
+ t.plotBox.height * r
1623
+ ), u.clip(), u.scale(r, r);
1624
+ const h = $t(u, t.plotBox, r, g);
1625
+ for (const C of t.drawHooks)
1626
+ try {
1627
+ C(h);
1628
+ } catch (I) {
1629
+ console.warn("[uPlot+] draw hook error:", I);
1630
+ }
1631
+ u.restore();
1632
+ }
1633
+ if (t.cursorManager.state.left >= 0 && (s.saveSnapshot(u, i * r, l * r), t.cursorManager.update(
1634
+ t.cursorManager.state.left,
1635
+ t.cursorManager.state.top,
1636
+ t.plotBox,
1637
+ n.data,
1638
+ o,
1639
+ g,
1640
+ (h) => n.getWindow(h),
1641
+ (h) => e.getGroupXScaleKey(h)
1642
+ )), ae(
1643
+ u,
1644
+ t.cursorManager.state,
1645
+ t.plotBox,
1646
+ r,
1647
+ n.data,
1648
+ o,
1649
+ g,
1650
+ (h) => e.getGroupXScaleKey(h)
1651
+ ), ce(u, t.selectState, t.plotBox, r), t.cursorDrawHooks.size > 0) {
1652
+ u.save(), u.scale(r, r);
1653
+ const h = $t(u, t.plotBox, r, g);
1654
+ for (const C of t.cursorDrawHooks)
1655
+ try {
1656
+ C(h, t.cursorManager.state);
1657
+ } catch (I) {
1658
+ console.warn("[uPlot+] draw hook error:", I);
1659
+ }
1660
+ u.restore();
1661
+ }
1662
+ for (const h of t.listeners) h();
1663
+ if (t._prevScaleRanges.size > 0 && t.eventCallbacks.onScaleChange != null)
1664
+ for (const h of e.getAllScales()) {
1665
+ if (h.min == null || h.max == null) continue;
1666
+ const C = t._prevScaleRanges.get(h.id);
1667
+ if (C == null || C.min !== h.min || C.max !== h.max)
1668
+ try {
1669
+ t.eventCallbacks.onScaleChange(h.id, h.min, h.max);
1670
+ } catch (I) {
1671
+ console.warn("[uPlot+] event callback error:", I);
1672
+ }
1673
+ }
1674
+ t._prevScaleRanges.clear();
1675
+ for (const h of e.getAllScales())
1676
+ h.min != null && h.max != null && t._prevScaleRanges.set(h.id, { min: h.min, max: h.max });
1677
+ }
1678
+ };
1679
+ return t.scheduler.onRedraw(() => t.redraw()), t;
1680
+ }
1681
+ function Wn(t) {
1682
+ const { axisConfigs: e, axisStates: n } = t, s = /* @__PURE__ */ new Map();
1683
+ for (const o of n)
1684
+ s.set(`${o.config.scale}:${o.config.side}`, o);
1685
+ t.axisStates = e.map((o) => {
1686
+ const i = `${o.scale}:${o.side}`, l = s.get(i);
1687
+ return l != null ? (l.config = o, l) : gn(o);
1688
+ });
1689
+ }
1690
+ function En() {
1691
+ const t = X(null);
1692
+ return t.current === null && (t.current = Bn()), t.current;
1693
+ }
1694
+ const ke = De(null);
1695
+ function ot() {
1696
+ const t = Le(ke);
1697
+ if (!t)
1698
+ throw new Error("useChart must be used within a <Chart> component");
1699
+ return t;
1700
+ }
1701
+ function Xn(t, e) {
1702
+ Y(() => {
1703
+ if (e != null)
1704
+ return Yn(t, e);
1705
+ }, [t, e]);
1706
+ }
1707
+ function Yn(t, e) {
1708
+ let n = null;
1709
+ const s = { show: !1, left: 0, top: 0, width: 0, height: 0 };
1710
+ let o = null, i = null, l = !1;
1711
+ function r(p) {
1712
+ const w = e.getBoundingClientRect(), v = t.plotBox, k = p.clientX - w.left - v.left, z = p.clientY - w.top - v.top;
1713
+ return { cx: k, cy: z };
1714
+ }
1715
+ function a(p, w) {
1716
+ const v = t.plotBox;
1717
+ return p >= 0 && p <= v.width && w >= 0 && w <= v.height;
1718
+ }
1719
+ function c(p, w) {
1720
+ const v = e.getBoundingClientRect(), k = p - v.left, z = w - v.top, A = t.plotBox;
1721
+ for (const F of t.axisStates) {
1722
+ const _ = F.config, R = _.side;
1723
+ if (F._size <= 0) continue;
1724
+ const B = z >= A.top && z <= A.top + A.height, W = k >= A.left && k <= A.left + A.width;
1725
+ if (R === U.Left && k < A.left && B || R === U.Right && k > A.left + A.width && B || R === U.Top && z < A.top && W || R === U.Bottom && z > A.top + A.height && W) {
1726
+ const Z = xt(R);
1727
+ return { scaleId: _.scale, ori: Z };
1728
+ }
1729
+ }
1730
+ return null;
1731
+ }
1732
+ function u(p, w, v) {
1733
+ const k = t.cursorManager.state;
1734
+ let z = null;
1735
+ if (k.activeGroup >= 0 && k.activeDataIdx >= 0) {
1736
+ const A = t.dataStore.data[k.activeGroup];
1737
+ if (A != null) {
1738
+ const F = A.x[k.activeDataIdx], _ = A.series[k.activeSeriesIdx], R = _ != null ? _[k.activeDataIdx] : void 0;
1739
+ if (F != null && R != null) {
1740
+ const V = t.plotBox, B = t.scaleManager.getGroupXScaleKey(k.activeGroup), W = B != null ? t.scaleManager.getScale(B) : void 0, j = t.seriesConfigs.find(
1741
+ (jt) => jt.group === k.activeGroup && jt.index === k.activeSeriesIdx
1742
+ ), Z = j != null ? t.scaleManager.getScale(j.yScale) : void 0;
1743
+ let pt = w, Gt = v;
1744
+ (W == null ? void 0 : W.min) != null && W.max != null && (pt = H(F, W, V.width, V.left) - V.left), (Z == null ? void 0 : Z.min) != null && Z.max != null && (Gt = H(R, Z, V.height, V.top) - V.top);
1745
+ const Kt = w - pt, Nt = v - Gt;
1746
+ z = {
1747
+ group: k.activeGroup,
1748
+ seriesIdx: k.activeSeriesIdx,
1749
+ dataIdx: k.activeDataIdx,
1750
+ xVal: F,
1751
+ yVal: R,
1752
+ pxX: pt,
1753
+ pxY: Gt,
1754
+ dist: Math.sqrt(Kt * Kt + Nt * Nt)
1755
+ };
1756
+ }
1757
+ }
1758
+ }
1759
+ return { plotX: w, plotY: v, point: z, srcEvent: p };
1760
+ }
1761
+ function d(p) {
1762
+ const w = t.plotBox, v = p.left / w.width, k = (p.left + p.width) / w.width, z = {};
1763
+ for (const A of t.scaleManager.getAllScales()) {
1764
+ if (A.ori !== G.Horizontal || A.min == null || A.max == null) continue;
1765
+ const F = it(
1766
+ w.left + v * w.width,
1767
+ A,
1768
+ w.width,
1769
+ w.left
1770
+ ), _ = it(
1771
+ w.left + k * w.width,
1772
+ A,
1773
+ w.width,
1774
+ w.left
1775
+ );
1776
+ z[A.id] = {
1777
+ min: Math.min(F, _),
1778
+ max: Math.max(F, _)
1779
+ };
1780
+ }
1781
+ return { left: v, right: k, ranges: z };
1782
+ }
1783
+ function f() {
1784
+ const p = t.eventCallbacks.onScaleChange;
1785
+ if (p != null)
1786
+ for (const w of t.scaleManager.getAllScales()) {
1787
+ if (w.min == null || w.max == null) continue;
1788
+ const v = t._prevScaleRanges.get(w.id);
1789
+ (v == null || v.min !== w.min || v.max !== w.max) && p(w.id, w.min, w.max);
1790
+ }
1791
+ }
1792
+ function g(p, w) {
1793
+ if (i != null) {
1794
+ const A = e.getBoundingClientRect(), F = p.clientY - A.top, _ = t.plotBox, R = (F - i.startY) / _.height, V = i.startMax - i.startMin, B = t.scaleManager.getScale(i.scaleId);
1795
+ B != null && (B.min = i.startMin + R * V, B.max = i.startMax + R * V, B.auto = !1, at(B), t.renderer.clearCache(), t.scheduleRedraw());
1796
+ return;
1797
+ }
1798
+ const v = r(p);
1799
+ if (v == null) return;
1800
+ const { cx: k, cy: z } = v;
1801
+ if (!a(k, z) && n == null) {
1802
+ t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), t.scheduleCursorRedraw();
1803
+ return;
1804
+ }
1805
+ if (t.cursorManager.update(
1806
+ k,
1807
+ z,
1808
+ t.plotBox,
1809
+ t.dataStore.data,
1810
+ t.seriesConfigs,
1811
+ (A) => t.scaleManager.getScale(A),
1812
+ (A) => t.dataStore.getWindow(A),
1813
+ (A) => t.scaleManager.getGroupXScaleKey(A)
1814
+ ), t.focusAlpha < 1) {
1815
+ const A = t.cursorManager.state;
1816
+ if (A.activeGroup >= 0 && A.activeSeriesIdx >= 0) {
1817
+ const F = t.seriesConfigs.findIndex(
1818
+ (_) => _.group === A.activeGroup && _.index === A.activeSeriesIdx
1819
+ );
1820
+ F >= 0 && t.focusedSeries !== F && (t.focusedSeries = F, t.scheduleRedraw());
1821
+ }
1822
+ }
1823
+ if (w != null && t.eventCallbacks.onCursorMove != null && a(k, z))
1824
+ try {
1825
+ t.eventCallbacks.onCursorMove(u(w, k, z));
1826
+ } catch (A) {
1827
+ console.warn("[uPlot+] event callback error:", A);
1828
+ }
1829
+ if (n != null) {
1830
+ const A = n.x, F = t.plotBox, _ = Math.max(0, Math.min(k, F.width));
1831
+ s.show = !0, s.left = Math.min(A, _), s.top = 0, s.width = Math.abs(_ - A), s.height = F.height, t.selectState = s;
1832
+ }
1833
+ n != null ? t.scheduler.mark(tt.Cursor | tt.Select) : t.scheduleCursorRedraw();
1834
+ }
1835
+ function M(p) {
1836
+ g(p, p);
1837
+ }
1838
+ function S(p) {
1839
+ if (p.button !== 0) return;
1840
+ const w = c(p.clientX, p.clientY);
1841
+ if (w != null && w.ori === G.Vertical) {
1842
+ const k = t.scaleManager.getScale(w.scaleId);
1843
+ if (k != null && k.min != null && k.max != null) {
1844
+ const z = e.getBoundingClientRect();
1845
+ i = {
1846
+ scaleId: w.scaleId,
1847
+ startY: p.clientY - z.top,
1848
+ startMin: k.min,
1849
+ startMax: k.max
1850
+ }, p.preventDefault();
1851
+ return;
1852
+ }
1853
+ }
1854
+ const v = r(p);
1855
+ v != null && a(v.cx, v.cy) && (n = { x: v.cx, y: v.cy }, l = !1, s.show = !1, s.left = 0, s.width = 0, t.selectState = s);
1856
+ }
1857
+ function P(p) {
1858
+ if (i != null) {
1859
+ f(), i = null;
1860
+ return;
1861
+ }
1862
+ if (n != null) {
1863
+ if (s.width > 5) {
1864
+ l = !0;
1865
+ let w = !0;
1866
+ if (t.eventCallbacks.onSelect != null) {
1867
+ const v = d(s);
1868
+ let k;
1869
+ try {
1870
+ k = t.eventCallbacks.onSelect(v);
1871
+ } catch (z) {
1872
+ console.warn("[uPlot+] event callback error:", z);
1873
+ }
1874
+ k === !1 && (w = !1);
1875
+ }
1876
+ w && (m(s), f());
1877
+ }
1878
+ n = null, s.show = !1, s.left = 0, s.width = 0, t.selectState = s, t.scheduleRedraw();
1879
+ }
1880
+ }
1881
+ function h(p) {
1882
+ P();
1883
+ }
1884
+ function C(p) {
1885
+ if (l) {
1886
+ l = !1;
1887
+ return;
1888
+ }
1889
+ const w = t.eventCallbacks.onClick;
1890
+ if (w == null) return;
1891
+ const v = r(p);
1892
+ if (v != null && a(v.cx, v.cy))
1893
+ try {
1894
+ w(u(p, v.cx, v.cy));
1895
+ } catch (k) {
1896
+ console.warn("[uPlot+] event callback error:", k);
1897
+ }
1898
+ }
1899
+ function I(p) {
1900
+ const w = t.eventCallbacks.onContextMenu;
1901
+ if (w == null) return;
1902
+ const v = r(p);
1903
+ if (v != null && a(v.cx, v.cy)) {
1904
+ p.preventDefault();
1905
+ try {
1906
+ w(u(p, v.cx, v.cy));
1907
+ } catch (k) {
1908
+ console.warn("[uPlot+] event callback error:", k);
1909
+ }
1910
+ }
1911
+ }
1912
+ function L(p) {
1913
+ var w, v;
1914
+ t.cursorManager.hide(), t.focusedSeries != null && t.setFocus(null), n != null && (n = null, s.show = !1, s.width = 0, t.selectState = s), i != null && (i = null), t.scheduleCursorRedraw();
1915
+ try {
1916
+ (v = (w = t.eventCallbacks).onCursorLeave) == null || v.call(w);
1917
+ } catch (k) {
1918
+ console.warn("[uPlot+] event callback error:", k);
1919
+ }
1920
+ }
1921
+ function T(p) {
1922
+ if (t.eventCallbacks.onDblClick != null) {
1923
+ const w = r(p);
1924
+ if (w != null && a(w.cx, w.cy)) {
1925
+ let v;
1926
+ try {
1927
+ v = t.eventCallbacks.onDblClick(u(p, w.cx, w.cy));
1928
+ } catch (k) {
1929
+ console.warn("[uPlot+] event callback error:", k);
1930
+ }
1931
+ if (v === !1)
1932
+ return;
1933
+ }
1934
+ }
1935
+ for (const w of t.scaleConfigs)
1936
+ t.scaleManager.addScale(w);
1937
+ t.renderer.clearCache(), t.scheduleRedraw();
1938
+ }
1939
+ function x(p) {
1940
+ if (!t.wheelZoom) return;
1941
+ const w = r(p);
1942
+ if (w == null || !a(w.cx, w.cy)) return;
1943
+ p.preventDefault();
1944
+ const v = Math.max(0.1, Math.min(10, 1 - p.deltaY * 1e-3)), k = t.plotBox;
1945
+ for (const z of t.scaleManager.getAllScales()) {
1946
+ if (z.ori !== G.Horizontal || z.min == null || z.max == null) continue;
1947
+ const A = it(w.cx + k.left, z, k.width, k.left), F = A - (A - z.min) * v, _ = A + (z.max - A) * v;
1948
+ z.min = Math.min(F, _), z.max = Math.max(F, _), z.auto = !1, at(z);
1949
+ }
1950
+ t.renderer.clearCache(), t.scheduleRedraw(), f();
1951
+ }
1952
+ function m(p) {
1953
+ const w = t.plotBox, v = p.left / w.width, k = (p.left + p.width) / w.width;
1954
+ for (const z of t.scaleManager.getAllScales()) {
1955
+ if (z.ori !== G.Horizontal || z.min == null || z.max == null) continue;
1956
+ const A = it(
1957
+ w.left + v * w.width,
1958
+ z,
1959
+ w.width,
1960
+ w.left
1961
+ ), F = it(
1962
+ w.left + k * w.width,
1963
+ z,
1964
+ w.width,
1965
+ w.left
1966
+ );
1967
+ z.min = Math.min(A, F), z.max = Math.max(A, F), z.auto = !1, at(z);
1968
+ }
1969
+ t.renderer.clearCache();
1970
+ }
1971
+ function b(p) {
1972
+ if (p.touches.length === 2) {
1973
+ const k = p.touches[0], z = p.touches[1], A = z.clientX - k.clientX, F = z.clientY - k.clientY;
1974
+ o = {
1975
+ dist: Math.sqrt(A * A + F * F),
1976
+ midX: (k.clientX + z.clientX) / 2,
1977
+ midY: (k.clientY + z.clientY) / 2
1978
+ }, n = null;
1979
+ return;
1980
+ }
1981
+ const w = p.touches[0];
1982
+ if (w == null) return;
1983
+ const v = r(w);
1984
+ v != null && a(v.cx, v.cy) && (n = { x: v.cx, y: v.cy }, l = !1);
1985
+ }
1986
+ function y(p) {
1987
+ if (p.touches.length === 2 && o != null) {
1988
+ p.preventDefault();
1989
+ const v = p.touches[0], k = p.touches[1], z = k.clientX - v.clientX, A = k.clientY - v.clientY, F = Math.sqrt(z * z + A * A), _ = F / o.dist, R = e.getBoundingClientRect(), V = t.plotBox, B = o.midX - R.left - V.left;
1990
+ for (const W of t.scaleManager.getAllScales()) {
1991
+ if (W.ori !== G.Horizontal || W.min == null || W.max == null) continue;
1992
+ const j = it(B + V.left, W, V.width, V.left), Z = j - (j - W.min) / _, pt = j + (W.max - j) / _;
1993
+ W.min = Math.min(Z, pt), W.max = Math.max(Z, pt), W.auto = !1, at(W);
1994
+ }
1995
+ o.dist = F, t.renderer.clearCache(), t.scheduleRedraw(), f();
1996
+ return;
1997
+ }
1998
+ const w = p.touches[0];
1999
+ w != null && (g(w, p), n != null && p.preventDefault());
2000
+ }
2001
+ function D(p) {
2002
+ if (o != null) {
2003
+ o = null;
2004
+ return;
2005
+ }
2006
+ p.changedTouches[0] != null && P();
2007
+ }
2008
+ return e.addEventListener("mousemove", M), e.addEventListener("mousedown", S), e.addEventListener("mouseup", h), e.addEventListener("click", C), e.addEventListener("contextmenu", I), e.addEventListener("mouseleave", L), e.addEventListener("dblclick", T), e.addEventListener("wheel", x, { passive: !1 }), e.addEventListener("touchstart", b, { passive: !0 }), e.addEventListener("touchmove", y, { passive: !1 }), e.addEventListener("touchend", D), () => {
2009
+ e.removeEventListener("mousemove", M), e.removeEventListener("mousedown", S), e.removeEventListener("mouseup", h), e.removeEventListener("click", C), e.removeEventListener("contextmenu", I), e.removeEventListener("mouseleave", L), e.removeEventListener("dblclick", T), e.removeEventListener("wheel", x), e.removeEventListener("touchstart", b), e.removeEventListener("touchmove", y), e.removeEventListener("touchend", D);
2010
+ };
2011
+ }
2012
+ const Bt = /* @__PURE__ */ new Map();
2013
+ function Un(t) {
2014
+ let e = Bt.get(t);
2015
+ return e == null && (e = new Kn(t), Bt.set(t, e)), e;
2016
+ }
2017
+ class Kn {
2018
+ constructor(e) {
2019
+ this.members = /* @__PURE__ */ new Set(), this.publishing = !1, this.syncedStores = /* @__PURE__ */ new WeakSet(), this.key = e;
2020
+ }
2021
+ /** Add a chart to this sync group. */
2022
+ join(e) {
2023
+ this.members.add(e);
2024
+ }
2025
+ /** Remove a chart from this sync group. Cleans up empty groups. */
2026
+ leave(e) {
2027
+ this.members.delete(e), this.members.size === 0 && Bt.delete(this.key);
2028
+ }
2029
+ /**
2030
+ * Publish cursor position from one chart to all others in the group.
2031
+ * Skips if the source was just synced-to (prevents async echo loops).
2032
+ */
2033
+ pub(e) {
2034
+ if (this.publishing) return;
2035
+ if (this.syncedStores.has(e)) {
2036
+ this.syncedStores.delete(e);
2037
+ return;
2038
+ }
2039
+ this.publishing = !0;
2040
+ const n = e.cursorManager.state, { activeGroup: s, activeDataIdx: o } = n;
2041
+ if (s < 0 || o < 0) {
2042
+ for (const r of this.members)
2043
+ r !== e && (this.syncedStores.add(r), r.cursorManager.hide(), r.scheduleCursorRedraw());
2044
+ this.publishing = !1;
2045
+ return;
2046
+ }
2047
+ const l = e.dataStore.getXValues(s)[o];
2048
+ if (l == null) {
2049
+ this.publishing = !1;
2050
+ return;
2051
+ }
2052
+ for (const r of this.members)
2053
+ r !== e && (this.syncedStores.add(r), r.cursorManager.syncToValue(l, r), r.scheduleCursorRedraw());
2054
+ this.publishing = !1;
2055
+ }
2056
+ }
2057
+ function Nn(t, e) {
2058
+ Y(() => {
2059
+ if (e == null) return;
2060
+ const n = Un(e);
2061
+ n.join(t);
2062
+ let s = -1, o = -1;
2063
+ const i = t.subscribe(() => {
2064
+ const { activeGroup: l, activeDataIdx: r } = t.cursorManager.state;
2065
+ l === s && r === o || (s = l, o = r, n.pub(t));
2066
+ });
2067
+ return () => {
2068
+ i(), n.leave(t);
2069
+ };
2070
+ }, [t, e]);
2071
+ }
2072
+ function Ce({
2073
+ width: t,
2074
+ height: e,
2075
+ data: n,
2076
+ children: s,
2077
+ className: o,
2078
+ pxRatio: i,
2079
+ onDraw: l,
2080
+ onCursorDraw: r,
2081
+ syncKey: a,
2082
+ cursor: c,
2083
+ onClick: u,
2084
+ onContextMenu: d,
2085
+ onDblClick: f,
2086
+ onCursorMove: g,
2087
+ onCursorLeave: M,
2088
+ onScaleChange: S,
2089
+ onSelect: P
2090
+ }) {
2091
+ var w;
2092
+ const h = En(), [C, I] = St(null), L = i ?? (typeof window < "u" && window.devicePixelRatio || 1), T = (c == null ? void 0 : c.wheelZoom) ?? !1, x = ((w = c == null ? void 0 : c.focus) == null ? void 0 : w.alpha) ?? ((c == null ? void 0 : c.focus) != null ? 0.15 : 1);
2093
+ Y(() => {
2094
+ h.wheelZoom = T, h.focusAlpha = x;
2095
+ }, [h, T, x]), h.eventCallbacks.onClick = u, h.eventCallbacks.onContextMenu = d, h.eventCallbacks.onDblClick = f, h.eventCallbacks.onCursorMove = g, h.eventCallbacks.onCursorLeave = M, h.eventCallbacks.onScaleChange = S, h.eventCallbacks.onSelect = P, Xn(h, C), Nn(h, a);
2096
+ const m = q((v) => {
2097
+ h.canvas = v, v && h.scheduleRedraw();
2098
+ }, [h]), b = q((v) => {
2099
+ I(v);
2100
+ }, []);
2101
+ Y(() => {
2102
+ h.pxRatio = L, h.setSize(t, e);
2103
+ }, [h, t, e, L]), Y(() => () => {
2104
+ h.canvas = null, h.scheduler.cancel(), h.focusedSeries = null;
2105
+ }, [h]), Y(() => {
2106
+ if (C == null || typeof ResizeObserver > "u") return;
2107
+ const v = new ResizeObserver((k) => {
2108
+ const z = k[0];
2109
+ if (z == null) return;
2110
+ const { width: A, height: F } = z.contentRect;
2111
+ A > 0 && F > 0 && (A !== h.width || F !== h.height) && h.setSize(Math.round(A), Math.round(F));
2112
+ });
2113
+ return v.observe(C), () => {
2114
+ v.disconnect();
2115
+ };
2116
+ }, [h, C]);
2117
+ const y = X(n);
2118
+ Y(() => {
2119
+ if (n === y.current && h.dataStore.data.length > 0) return;
2120
+ y.current = n, h.dataStore.setData(n), h.renderer.clearCache();
2121
+ const v = "x";
2122
+ h.scaleManager.getScale(v) || h.registerScale({
2123
+ id: v,
2124
+ auto: !0
2125
+ });
2126
+ for (let k = 0; k < n.length; k++)
2127
+ h.scaleManager.setGroupXScale(k, v);
2128
+ h.scheduleRedraw();
2129
+ }, [h, n]);
2130
+ const D = X(l);
2131
+ D.current = l, Y(() => {
2132
+ const v = (k) => {
2133
+ var z;
2134
+ (z = D.current) == null || z.call(D, k);
2135
+ };
2136
+ return h.drawHooks.add(v), () => {
2137
+ h.drawHooks.delete(v);
2138
+ };
2139
+ }, [h]);
2140
+ const p = X(r);
2141
+ return p.current = r, Y(() => {
2142
+ const v = (k, z) => {
2143
+ var A;
2144
+ (A = p.current) == null || A.call(p, k, z);
2145
+ };
2146
+ return h.cursorDrawHooks.add(v), () => {
2147
+ h.cursorDrawHooks.delete(v);
2148
+ };
2149
+ }, [h]), /* @__PURE__ */ E(ke.Provider, { value: h, children: /* @__PURE__ */ Q(
2150
+ "div",
2151
+ {
2152
+ className: o,
2153
+ style: {
2154
+ position: "relative",
2155
+ display: "flex",
2156
+ flexDirection: "column",
2157
+ width: `${t}px`
2158
+ },
2159
+ children: [
2160
+ /* @__PURE__ */ E(
2161
+ "div",
2162
+ {
2163
+ ref: b,
2164
+ style: {
2165
+ position: "relative",
2166
+ width: `${t}px`,
2167
+ height: `${e}px`,
2168
+ cursor: "crosshair",
2169
+ order: 0
2170
+ },
2171
+ children: /* @__PURE__ */ E(
2172
+ "canvas",
2173
+ {
2174
+ ref: m,
2175
+ style: {
2176
+ position: "absolute",
2177
+ left: 0,
2178
+ top: 0
2179
+ }
2180
+ }
2181
+ )
2182
+ }
2183
+ ),
2184
+ s
2185
+ ]
2186
+ }
2187
+ ) });
2188
+ }
2189
+ function ue(t) {
2190
+ return t != null && typeof t == "object" && !Array.isArray(t);
2191
+ }
2192
+ function jn(t, e) {
2193
+ const n = Object.keys(t), s = Object.keys(e);
2194
+ if (n.length !== s.length) return !1;
2195
+ for (const o of s)
2196
+ if (t[o] !== e[o]) return !1;
2197
+ return !0;
2198
+ }
2199
+ function Ut(t, e) {
2200
+ if (t === null) return !1;
2201
+ const n = t, s = e, o = Object.keys(n), i = Object.keys(s);
2202
+ if (o.length !== i.length) return !1;
2203
+ for (const l of i) {
2204
+ const r = n[l], a = s[l];
2205
+ if (r !== a)
2206
+ if (ue(r) && ue(a)) {
2207
+ if (!jn(r, a)) return !1;
2208
+ } else
2209
+ return !1;
2210
+ }
2211
+ return !0;
2212
+ }
2213
+ function Lt(t) {
2214
+ const e = ot(), n = X(t);
2215
+ n.current = t, Y(() => {
2216
+ const o = n.current;
2217
+ return e.registerScale({ ...o }), e.scheduleRedraw(), () => {
2218
+ e.unregisterScale(o.id), e.scheduleRedraw();
2219
+ };
2220
+ }, [e, t.id]);
2221
+ const s = X(null);
2222
+ return Y(() => {
2223
+ Ut(s.current, t) || (s.current = t, e.scaleConfigs = e.scaleConfigs.map(
2224
+ (o) => o.id === t.id ? { ...t } : o
2225
+ ), e.scaleManager.addScale({ ...t }), e.renderer.clearCache(), e.scheduleRedraw());
2226
+ }), null;
2227
+ }
2228
+ function Te(t) {
2229
+ const e = ot(), n = X(t);
2230
+ n.current = t, Y(() => {
2231
+ const o = n.current;
2232
+ return e.registerSeries({ ...o, show: o.show ?? !0 }), e.renderer.clearCache(), e.scheduleRedraw(), () => {
2233
+ e.unregisterSeries(o.group, o.index), e.renderer.clearCache(), e.scheduleRedraw();
2234
+ };
2235
+ }, [e, t.group, t.index]);
2236
+ const s = X(null);
2237
+ return Y(() => {
2238
+ Ut(s.current, t) || (s.current = t, e.seriesConfigs = e.seriesConfigs.map(
2239
+ (o) => o.group === t.group && o.index === t.index ? { ...t, show: t.show ?? !0 } : o
2240
+ ), e.renderer.invalidateSeries(t.group, t.index), e.scheduleRedraw());
2241
+ }), null;
2242
+ }
2243
+ function qn(t) {
2244
+ return { ...t, side: t.side ?? (t.scale === "x" ? U.Bottom : U.Left), show: t.show ?? !0 };
2245
+ }
2246
+ function Dt(t) {
2247
+ const e = ot(), n = qn(t), s = X(n);
2248
+ s.current = n, Y(() => {
2249
+ const i = s.current;
2250
+ return e.axisConfigs = e.axisConfigs.filter(
2251
+ (l) => !(l.scale === i.scale && l.side === i.side)
2252
+ ), e.axisConfigs.push(i), e.scheduleRedraw(), () => {
2253
+ e.axisConfigs = e.axisConfigs.filter(
2254
+ (l) => !(l.scale === i.scale && l.side === i.side)
2255
+ ), e.scheduleRedraw();
2256
+ };
2257
+ }, [e, n.scale, n.side]);
2258
+ const o = X(null);
2259
+ return Y(() => {
2260
+ Ut(o.current, t) || (o.current = t, e.axisConfigs = e.axisConfigs.map(
2261
+ (i) => i.scale === n.scale && i.side === n.side ? n : i
2262
+ ), e.scheduleRedraw());
2263
+ }), null;
2264
+ }
2265
+ function cs({ series: t, group: e, fill: n, dir: s }) {
2266
+ const o = ot(), i = X(null), l = t[0], r = t[1];
2267
+ return Y(() => {
2268
+ const a = { series: [l, r], group: e, fill: n, dir: s };
2269
+ return i.current != null && (o.bandConfigs = o.bandConfigs.filter((c) => c !== i.current)), i.current = a, o.bandConfigs.push(a), o.scheduleRedraw(), () => {
2270
+ o.bandConfigs = o.bandConfigs.filter((c) => c !== i.current), i.current = null, o.scheduleRedraw();
2271
+ };
2272
+ }, [o, l, r, e, n, s]), null;
2273
+ }
2274
+ const On = {
2275
+ width: 12,
2276
+ height: 3,
2277
+ borderRadius: 1,
2278
+ display: "inline-block"
2279
+ }, Zn = { fontWeight: 600 }, Jn = {
2280
+ display: "inline-flex",
2281
+ alignItems: "center",
2282
+ gap: 4,
2283
+ padding: "2px 8px",
2284
+ cursor: "pointer",
2285
+ fontSize: 12,
2286
+ fontFamily: "sans-serif"
2287
+ }, Qn = ze(function({ group: e, index: n, label: s, color: o, isHidden: i, valueStr: l, store: r }) {
2288
+ const a = q(() => {
2289
+ r.toggleSeries(e, n);
2290
+ }, [r, e, n]);
2291
+ return /* @__PURE__ */ Q(
2292
+ "span",
2293
+ {
2294
+ onClick: a,
2295
+ style: { ...Jn, opacity: i ? 0.4 : 1 },
2296
+ children: [
2297
+ /* @__PURE__ */ E("span", { style: { ...On, backgroundColor: o } }),
2298
+ /* @__PURE__ */ E("span", { children: s }),
2299
+ l && /* @__PURE__ */ E("span", { style: Zn, children: l })
2300
+ ]
2301
+ }
2302
+ );
2303
+ });
2304
+ function us({ show: t = !0, position: e = "bottom", className: n }) {
2305
+ const s = ot(), o = X({ activeGroup: -1, activeDataIdx: -1, seriesCount: 0, revision: -1 }), i = q(
2306
+ (u) => s.subscribe(u),
2307
+ [s]
2308
+ ), l = q(() => {
2309
+ const { activeGroup: u, activeDataIdx: d } = s.cursorManager.state, f = s.seriesConfigs.length, { revision: g } = s, M = o.current;
2310
+ if (M.activeGroup === u && M.activeDataIdx === d && M.seriesCount === f && M.revision === g)
2311
+ return M;
2312
+ const S = { activeGroup: u, activeDataIdx: d, seriesCount: f, revision: g };
2313
+ return o.current = S, S;
2314
+ }, [s]), r = fe(i, l);
2315
+ if (!t) return null;
2316
+ const { activeGroup: a, activeDataIdx: c } = r;
2317
+ return /* @__PURE__ */ E(
2318
+ "div",
2319
+ {
2320
+ className: n,
2321
+ style: {
2322
+ display: "flex",
2323
+ flexWrap: "wrap",
2324
+ justifyContent: "center",
2325
+ order: e === "top" ? -1 : 1,
2326
+ padding: "4px 0"
2327
+ },
2328
+ children: s.seriesConfigs.map((u) => {
2329
+ const d = typeof u.stroke == "string" ? u.stroke : "#000";
2330
+ let f = "";
2331
+ if (c >= 0 && a >= 0) {
2332
+ const M = s.dataStore.getYValues(u.group, u.index)[c];
2333
+ M != null && (f = typeof M == "number" ? M.toPrecision(4) : String(M));
2334
+ }
2335
+ return /* @__PURE__ */ E(
2336
+ Qn,
2337
+ {
2338
+ group: u.group,
2339
+ index: u.index,
2340
+ label: u.label ?? `Series ${u.index}`,
2341
+ color: d,
2342
+ isHidden: u.show === !1,
2343
+ valueStr: f,
2344
+ store: s
2345
+ },
2346
+ `${u.group}:${u.index}`
2347
+ );
2348
+ })
2349
+ }
2350
+ );
2351
+ }
2352
+ const ts = 160;
2353
+ function fs({
2354
+ show: t = !0,
2355
+ className: e,
2356
+ children: n,
2357
+ offset: s = {}
2358
+ }) {
2359
+ const o = ot(), i = X({ left: -10, top: -10, activeGroup: -1, activeDataIdx: -1, revision: -1 }), l = q(
2360
+ (m) => o.subscribe(m),
2361
+ [o]
2362
+ ), r = q(() => {
2363
+ const m = o.cursorManager.state, { revision: b } = o, y = i.current;
2364
+ if (y.left === m.left && y.top === m.top && y.activeGroup === m.activeGroup && y.activeDataIdx === m.activeDataIdx && y.revision === b)
2365
+ return y;
2366
+ const D = {
2367
+ left: m.left,
2368
+ top: m.top,
2369
+ activeGroup: m.activeGroup,
2370
+ activeDataIdx: m.activeDataIdx,
2371
+ revision: b
2372
+ };
2373
+ return i.current = D, D;
2374
+ }, [o]), a = fe(l, r);
2375
+ if (!t || a.activeDataIdx < 0 || a.activeGroup < 0 || a.left < 0) return null;
2376
+ const { activeGroup: c, activeDataIdx: u } = a, d = o.plotBox, f = o.dataStore.data[c], g = f != null ? f.x[u] ?? null : null, M = g != null ? parseFloat(g.toPrecision(6)).toString() : "", S = [];
2377
+ for (const m of o.seriesConfigs) {
2378
+ if (m.show === !1) continue;
2379
+ const b = o.dataStore.getYValues(m.group, m.index), y = m.group === c ? b[u] : null;
2380
+ S.push({
2381
+ label: m.label ?? `Series ${m.index}`,
2382
+ value: y,
2383
+ color: typeof m.stroke == "string" ? m.stroke : "#000",
2384
+ group: m.group,
2385
+ index: m.index
2386
+ });
2387
+ }
2388
+ const P = {
2389
+ x: g,
2390
+ xLabel: M,
2391
+ items: S,
2392
+ left: a.left + d.left,
2393
+ top: a.top + d.top
2394
+ }, h = s.x ?? 12, C = s.y ?? -12, I = a.left + d.left + h + ts > d.left + d.width, L = a.top + d.top + C < d.top, T = I ? P.left - h : P.left + h, x = L ? P.top + Math.abs(C) : P.top + C;
2395
+ return n ? /* @__PURE__ */ E(
2396
+ "div",
2397
+ {
2398
+ className: e,
2399
+ style: {
2400
+ position: "absolute",
2401
+ left: T,
2402
+ top: x,
2403
+ transform: I ? "translateX(-100%)" : void 0,
2404
+ pointerEvents: "none",
2405
+ zIndex: 100
2406
+ },
2407
+ children: n(P)
2408
+ }
2409
+ ) : /* @__PURE__ */ Q(
2410
+ "div",
2411
+ {
2412
+ className: e,
2413
+ style: {
2414
+ position: "absolute",
2415
+ left: T,
2416
+ top: x,
2417
+ transform: I ? "translateX(-100%)" : void 0,
2418
+ pointerEvents: "none",
2419
+ zIndex: 100,
2420
+ background: "rgba(0,0,0,0.85)",
2421
+ color: "#fff",
2422
+ padding: "6px 10px",
2423
+ borderRadius: 4,
2424
+ fontSize: 12,
2425
+ fontFamily: "sans-serif",
2426
+ whiteSpace: "nowrap",
2427
+ lineHeight: 1.5
2428
+ },
2429
+ children: [
2430
+ /* @__PURE__ */ E("div", { style: { fontWeight: 600, marginBottom: 2 }, children: M }),
2431
+ S.map((m) => /* @__PURE__ */ Q("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2432
+ /* @__PURE__ */ E("span", { style: { width: 8, height: 8, borderRadius: "50%", backgroundColor: m.color, display: "inline-block" } }),
2433
+ /* @__PURE__ */ Q("span", { children: [
2434
+ m.label,
2435
+ ":"
2436
+ ] }),
2437
+ /* @__PURE__ */ E("span", { style: { fontWeight: 600 }, children: m.value != null ? m.value.toPrecision(4) : "—" })
2438
+ ] }, `${m.group}:${m.index}`))
2439
+ ]
2440
+ }
2441
+ );
2442
+ }
2443
+ function hs({
2444
+ width: t,
2445
+ height: e,
2446
+ data: n,
2447
+ onRangeChange: s,
2448
+ initialRange: o,
2449
+ className: i,
2450
+ colors: l,
2451
+ grips: r = !1
2452
+ }) {
2453
+ const a = X(null), [c, u] = St(() => {
2454
+ if (o != null && n.length > 0) {
2455
+ const T = n[0];
2456
+ if (T != null && T.x.length > 1) {
2457
+ const x = T.x[0], b = T.x[T.x.length - 1] - x;
2458
+ if (b > 0)
2459
+ return [
2460
+ Math.max(0, (o[0] - x) / b),
2461
+ Math.min(1, (o[1] - x) / b)
2462
+ ];
2463
+ }
2464
+ }
2465
+ return [0.25, 0.75];
2466
+ }), d = X(null);
2467
+ Y(() => {
2468
+ if (s == null || n.length === 0) return;
2469
+ const T = n[0];
2470
+ if (T == null || T.x.length < 2) return;
2471
+ const x = T.x[0], b = T.x[T.x.length - 1] - x, y = x + c[0] * b, D = x + c[1] * b, p = d.current, w = Math.max(1e-10, Math.abs(D - y) * 1e-12);
2472
+ p != null && Math.abs(p[0] - y) < w && Math.abs(p[1] - D) < w || (d.current = [y, D], s(y, D));
2473
+ }, [c, n, s]);
2474
+ const f = X(null), g = q((T) => {
2475
+ const x = a.current;
2476
+ if (x == null) return 0;
2477
+ const m = x.getBoundingClientRect();
2478
+ return Math.max(0, Math.min(1, (T - m.left) / m.width));
2479
+ }, []), M = q((T) => {
2480
+ const x = a.current;
2481
+ if (x == null) return;
2482
+ const m = g(T.clientX), b = x.getBoundingClientRect().width, y = b > 0 ? 8 / b : 0;
2483
+ let D;
2484
+ if (Math.abs(m - c[0]) < y)
2485
+ D = "left";
2486
+ else if (Math.abs(m - c[1]) < y)
2487
+ D = "right";
2488
+ else if (m >= c[0] && m <= c[1])
2489
+ D = "move";
2490
+ else {
2491
+ const p = c[1] - c[0], w = p / 2, v = Math.max(0, Math.min(1 - p, m - w));
2492
+ u([v, v + p]), D = "move";
2493
+ }
2494
+ f.current = {
2495
+ mode: D,
2496
+ startX: T.clientX,
2497
+ startFrac: [...c]
2498
+ }, x.setPointerCapture(T.pointerId), T.preventDefault();
2499
+ }, [c, g]), S = q((T) => {
2500
+ const x = f.current;
2501
+ if (x == null) return;
2502
+ const m = g(T.clientX), b = g(x.startX), y = m - b;
2503
+ if (x.mode === "move") {
2504
+ const D = x.startFrac[1] - x.startFrac[0];
2505
+ let p = x.startFrac[0] + y;
2506
+ p = Math.max(0, Math.min(1 - D, p)), u([p, p + D]);
2507
+ } else if (x.mode === "left") {
2508
+ const D = Math.max(0, Math.min(x.startFrac[1] - 0.01, x.startFrac[0] + y));
2509
+ u([D, x.startFrac[1]]);
2510
+ } else {
2511
+ const D = Math.min(1, Math.max(x.startFrac[0] + 0.01, x.startFrac[1] + y));
2512
+ u([x.startFrac[0], D]);
2513
+ }
2514
+ }, [g]), P = q((T) => {
2515
+ f.current = null;
2516
+ const x = a.current;
2517
+ x != null && x.releasePointerCapture(T.pointerId);
2518
+ }, []), h = `${c[0] * 100}%`, C = `${(c[1] - c[0]) * 100}%`, I = n[0], L = I != null ? I.series.length : 0;
2519
+ return /* @__PURE__ */ Q("div", { className: i, style: { position: "relative", width: t, height: e }, children: [
2520
+ /* @__PURE__ */ Q(Ce, { width: t, height: e, data: n, children: [
2521
+ /* @__PURE__ */ E(Lt, { id: "x" }),
2522
+ /* @__PURE__ */ E(Lt, { id: "y" }),
2523
+ /* @__PURE__ */ E(Dt, { scale: "x", show: !1 }),
2524
+ /* @__PURE__ */ E(Dt, { scale: "y", show: !1 }),
2525
+ Array.from({ length: L }, (T, x) => /* @__PURE__ */ E(
2526
+ Te,
2527
+ {
2528
+ group: 0,
2529
+ index: x,
2530
+ yScale: "y",
2531
+ stroke: l != null && l[x] != null ? l[x] : `hsl(${x * 137}, 60%, 50%)`,
2532
+ width: 1
2533
+ },
2534
+ x
2535
+ ))
2536
+ ] }),
2537
+ /* @__PURE__ */ Q(
2538
+ "div",
2539
+ {
2540
+ ref: a,
2541
+ onPointerDown: M,
2542
+ onPointerMove: S,
2543
+ onPointerUp: P,
2544
+ style: {
2545
+ position: "absolute",
2546
+ top: 0,
2547
+ left: 0,
2548
+ width: "100%",
2549
+ height: "100%",
2550
+ cursor: "default",
2551
+ touchAction: "none"
2552
+ },
2553
+ children: [
2554
+ /* @__PURE__ */ E(
2555
+ "div",
2556
+ {
2557
+ style: {
2558
+ position: "absolute",
2559
+ top: 0,
2560
+ left: 0,
2561
+ width: h,
2562
+ height: "100%",
2563
+ background: "rgba(0,0,0,0.3)",
2564
+ pointerEvents: "none"
2565
+ }
2566
+ }
2567
+ ),
2568
+ /* @__PURE__ */ E(
2569
+ "div",
2570
+ {
2571
+ style: {
2572
+ position: "absolute",
2573
+ top: 0,
2574
+ left: `${c[1] * 100}%`,
2575
+ right: 0,
2576
+ height: "100%",
2577
+ background: "rgba(0,0,0,0.3)",
2578
+ pointerEvents: "none"
2579
+ }
2580
+ }
2581
+ ),
2582
+ /* @__PURE__ */ E(
2583
+ "div",
2584
+ {
2585
+ style: {
2586
+ position: "absolute",
2587
+ top: 0,
2588
+ left: h,
2589
+ width: C,
2590
+ height: "100%",
2591
+ borderLeft: "2px solid rgba(0,100,255,0.8)",
2592
+ borderRight: "2px solid rgba(0,100,255,0.8)",
2593
+ boxSizing: "border-box",
2594
+ cursor: "grab",
2595
+ pointerEvents: "none"
2596
+ },
2597
+ children: r && /* @__PURE__ */ Q(Pe, { children: [
2598
+ /* @__PURE__ */ E("div", { style: {
2599
+ position: "absolute",
2600
+ left: -5,
2601
+ top: "50%",
2602
+ transform: "translateY(-50%)",
2603
+ width: 8,
2604
+ height: 24,
2605
+ borderRadius: 3,
2606
+ background: "rgba(0,100,255,0.8)",
2607
+ cursor: "ew-resize",
2608
+ pointerEvents: "auto"
2609
+ } }),
2610
+ /* @__PURE__ */ E("div", { style: {
2611
+ position: "absolute",
2612
+ right: -5,
2613
+ top: "50%",
2614
+ transform: "translateY(-50%)",
2615
+ width: 8,
2616
+ height: 24,
2617
+ borderRadius: 3,
2618
+ background: "rgba(0,100,255,0.8)",
2619
+ cursor: "ew-resize",
2620
+ pointerEvents: "auto"
2621
+ } })
2622
+ ] })
2623
+ }
2624
+ )
2625
+ ]
2626
+ }
2627
+ )
2628
+ ] });
2629
+ }
2630
+ function Pt(t) {
2631
+ const e = ot(), n = X(t);
2632
+ n.current = t, Y(() => {
2633
+ const s = (o) => n.current(o);
2634
+ return e.drawHooks.add(s), () => {
2635
+ e.drawHooks.delete(s);
2636
+ };
2637
+ }, [e]);
2638
+ }
2639
+ function ds(t) {
2640
+ const e = ot(), n = X(t);
2641
+ n.current = t, Y(() => {
2642
+ const s = (o, i) => n.current(o, i);
2643
+ return e.cursorDrawHooks.add(s), () => {
2644
+ e.cursorDrawHooks.delete(s);
2645
+ };
2646
+ }, [e]);
2647
+ }
2648
+ function gs({
2649
+ lanes: t,
2650
+ laneHeight: e = 24,
2651
+ gap: n = 2,
2652
+ scaleId: s = "x"
2653
+ }) {
2654
+ const o = ot();
2655
+ return Pt(({ ctx: i, plotBox: l, pxRatio: r }) => {
2656
+ const a = o.scaleManager.getScale(s);
2657
+ if (a == null || a.min == null || a.max == null) return;
2658
+ i.save(), i.beginPath(), i.rect(
2659
+ l.left * r,
2660
+ l.top * r,
2661
+ l.width * r,
2662
+ l.height * r
2663
+ ), i.clip();
2664
+ const c = (e + n) * r, u = e * r, d = l.top * r;
2665
+ for (let f = 0; f < t.length; f++) {
2666
+ const g = t[f];
2667
+ if (g == null) continue;
2668
+ const M = d + f * c;
2669
+ i.fillStyle = "#666", i.font = `${11 * r}px sans-serif`, i.textAlign = "right", i.textBaseline = "middle", i.fillText(g.label, (l.left - 6) * r, M + u / 2);
2670
+ for (const S of g.segments) {
2671
+ const P = H(S.start, a, l.width, l.left) * r, C = H(S.end, a, l.width, l.left) * r - P;
2672
+ C <= 0 || (i.fillStyle = S.color ?? "#4dabf7", i.fillRect(P, M, C, u), S.label != null && C > 20 * r && (i.fillStyle = "#fff", i.font = `${10 * r}px sans-serif`, i.textAlign = "center", i.textBaseline = "middle", i.fillText(S.label, P + C / 2, M + u / 2, C - 4 * r)));
2673
+ }
2674
+ }
2675
+ i.restore();
2676
+ }), null;
2677
+ }
2678
+ function ps({
2679
+ data: t,
2680
+ width: e = 150,
2681
+ height: n = 30,
2682
+ stroke: s = "#03a9f4",
2683
+ fill: o,
2684
+ lineWidth: i = 1,
2685
+ paths: l,
2686
+ fillTo: r,
2687
+ className: a
2688
+ }) {
2689
+ return /* @__PURE__ */ E("div", { style: { pointerEvents: "none" }, className: a, children: /* @__PURE__ */ Q(Ce, { width: e, height: n, data: t, children: [
2690
+ /* @__PURE__ */ E(Lt, { id: "x" }),
2691
+ /* @__PURE__ */ E(Lt, { id: "y" }),
2692
+ /* @__PURE__ */ E(Dt, { scale: "x", show: !1 }),
2693
+ /* @__PURE__ */ E(Dt, { scale: "y", show: !1 }),
2694
+ /* @__PURE__ */ E(
2695
+ Te,
2696
+ {
2697
+ group: 0,
2698
+ index: 0,
2699
+ yScale: "y",
2700
+ stroke: s,
2701
+ fill: o,
2702
+ width: i,
2703
+ paths: l,
2704
+ fillTo: r
2705
+ }
2706
+ )
2707
+ ] }) });
2708
+ }
2709
+ function es(t, e, n, s = {}) {
2710
+ const { ctx: o, plotBox: i } = t, l = H(n, e, i.height, i.top);
2711
+ o.beginPath(), o.moveTo(i.left, l), o.lineTo(i.left + i.width, l), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
2712
+ }
2713
+ function ns(t, e, n, s = {}) {
2714
+ const { ctx: o, plotBox: i } = t, l = H(n, e, i.width, i.left);
2715
+ o.beginPath(), o.moveTo(l, i.top), o.lineTo(l, i.top + i.height), o.strokeStyle = s.stroke ?? "red", o.lineWidth = s.width ?? 1, s.dash && o.setLineDash(s.dash), o.stroke(), s.dash && o.setLineDash([]);
2716
+ }
2717
+ function ms(t, e, n, s, o, i, l = {}) {
2718
+ const { ctx: r, plotBox: a } = t, c = H(s, e, a.width, a.left), u = H(o, n, a.height, a.top);
2719
+ r.font = l.font ?? "12px sans-serif", r.fillStyle = l.fill ?? "#000", r.textBaseline = "bottom", r.fillText(i, c, u - 4);
2720
+ }
2721
+ function ss(t, e, n, s, o = {}) {
2722
+ const { ctx: i, plotBox: l } = t, r = H(s, e, l.height, l.top), a = H(n, e, l.height, l.top);
2723
+ i.fillStyle = o.fill ?? "rgba(255,0,0,0.1)", i.fillRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.stroke && (i.strokeStyle = o.stroke, i.lineWidth = o.width ?? 1, o.dash && i.setLineDash(o.dash), i.strokeRect(l.left, Math.min(r, a), l.width, Math.abs(a - r)), o.dash && i.setLineDash([]));
2724
+ }
2725
+ function ws(t) {
2726
+ const e = X(t);
2727
+ return zt(() => {
2728
+ e.current = t;
2729
+ }), Pt((n) => {
2730
+ const s = e.current, o = s.yScale ?? "y", i = n.getScale(o);
2731
+ if (i != null && (es(n, i, s.value, {
2732
+ stroke: s.stroke,
2733
+ width: s.width,
2734
+ dash: s.dash
2735
+ }), s.label != null)) {
2736
+ const l = n.valToY(s.value, o);
2737
+ if (l == null) return;
2738
+ const { ctx: r, plotBox: a } = n;
2739
+ r.font = s.labelFont ?? "11px sans-serif", r.fillStyle = s.stroke ?? "red", r.textAlign = "left", r.textBaseline = "bottom", r.fillText(s.label, a.left + 4, l - 4);
2740
+ }
2741
+ }), null;
2742
+ }
2743
+ function vs(t) {
2744
+ const e = X(t);
2745
+ return zt(() => {
2746
+ e.current = t;
2747
+ }), Pt((n) => {
2748
+ const s = e.current, o = s.xScale ?? "x", i = n.getScale(o);
2749
+ if (i != null && (ns(n, i, s.value, {
2750
+ stroke: s.stroke,
2751
+ width: s.width,
2752
+ dash: s.dash
2753
+ }), s.label != null)) {
2754
+ const l = n.valToX(s.value, o);
2755
+ if (l == null) return;
2756
+ const { ctx: r, plotBox: a } = n;
2757
+ r.font = s.labelFont ?? "11px sans-serif", r.fillStyle = s.stroke ?? "red", r.textAlign = "center", r.textBaseline = "bottom", r.fillText(s.label, l, a.top - 4);
2758
+ }
2759
+ }), null;
2760
+ }
2761
+ function xs(t) {
2762
+ const e = X(t);
2763
+ return zt(() => {
2764
+ e.current = t;
2765
+ }), Pt((n) => {
2766
+ const s = e.current, o = n.getScale(s.yScale ?? "y");
2767
+ o != null && ss(n, o, s.yMin, s.yMax, {
2768
+ fill: s.fill,
2769
+ stroke: s.stroke,
2770
+ width: s.strokeWidth,
2771
+ dash: s.dash
2772
+ });
2773
+ }), null;
2774
+ }
2775
+ function Ms(t) {
2776
+ const e = X(t);
2777
+ return zt(() => {
2778
+ e.current = t;
2779
+ }), Pt((n) => {
2780
+ const s = e.current, o = n.valToX(s.x, s.xScale ?? "x"), i = n.valToY(s.y, s.yScale ?? "y");
2781
+ if (o == null || i == null) return;
2782
+ const { ctx: l } = n;
2783
+ l.font = s.font ?? "12px sans-serif", l.fillStyle = s.fill ?? "#000", l.textAlign = s.align ?? "left", l.textBaseline = s.baseline ?? "bottom", l.fillText(s.text, o, i - 4);
2784
+ }), null;
2785
+ }
2786
+ function bs(t, e) {
2787
+ const { window: n, batchSize: s = 1 } = e, o = e.autoStart ?? !0, [i, l] = St(t), [r, a] = St(!1), [c, u] = St(0), d = X(0), f = X(0), g = X(0), M = X(/* @__PURE__ */ new Map()), S = X(0), P = X(n);
2788
+ P.current = n;
2789
+ const h = q(
2790
+ (T, x, ...m) => {
2791
+ let b = M.current.get(T);
2792
+ b == null && (b = { x: [], series: m.map(() => []) }, M.current.set(T, b)), b.x.push(...x);
2793
+ for (let y = 0; y < m.length; y++) {
2794
+ let D = b.series[y];
2795
+ D == null && (D = [], b.series[y] = D), D.push(...m[y] ?? []);
2796
+ }
2797
+ S.current === 0 && (S.current = requestAnimationFrame(() => {
2798
+ S.current = 0;
2799
+ const y = M.current;
2800
+ M.current = /* @__PURE__ */ new Map();
2801
+ const D = P.current;
2802
+ l((p) => {
2803
+ const w = p.slice();
2804
+ for (const [v, { x: k, series: z }] of y) {
2805
+ const A = w[v];
2806
+ if (A == null) continue;
2807
+ const F = A.x, _ = Math.max(0, F.length + k.length - D), R = _ > 0 ? F.slice(_).concat(k) : F.concat(k), V = A.series.map((B, W) => {
2808
+ const j = B, Z = z[W] ?? [];
2809
+ return _ > 0 ? j.slice(_).concat(Z) : j.concat(Z);
2810
+ });
2811
+ w[v] = { x: R, series: V };
2812
+ }
2813
+ return w;
2814
+ });
2815
+ }));
2816
+ },
2817
+ []
2818
+ ), C = q(
2819
+ (T, ...x) => {
2820
+ h(0, T, ...x);
2821
+ },
2822
+ [h]
2823
+ ), I = q(() => {
2824
+ a(!0);
2825
+ }, []), L = q(() => {
2826
+ a(!1);
2827
+ }, []);
2828
+ return Y(() => {
2829
+ if (!r) {
2830
+ d.current !== 0 && (cancelAnimationFrame(d.current), d.current = 0);
2831
+ return;
2832
+ }
2833
+ g.current = performance.now(), f.current = 0;
2834
+ const T = (x) => {
2835
+ f.current++;
2836
+ const m = x - g.current;
2837
+ m >= 1e3 && (u(Math.round(f.current * 1e3 / m)), f.current = 0, g.current = x), d.current = requestAnimationFrame(T);
2838
+ };
2839
+ return d.current = requestAnimationFrame(T), () => {
2840
+ d.current !== 0 && (cancelAnimationFrame(d.current), d.current = 0);
2841
+ };
2842
+ }, [r]), Y(() => () => {
2843
+ S.current !== 0 && cancelAnimationFrame(S.current);
2844
+ }, []), Y(() => {
2845
+ o && a(!0);
2846
+ }, [o]), { data: i, push: C, pushGroup: h, start: I, stop: L, running: r, fps: c };
2847
+ }
2848
+ function Ss(t) {
2849
+ return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
2850
+ const M = (g == null ? void 0 : g.align) ?? t ?? 1, S = (g == null ? void 0 : g.spanGaps) ?? !1;
2851
+ if ([c, u] = Ft(n, c, u), c === -1)
2852
+ return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
2853
+ const P = (y) => f(H(y, s, i, r)), h = (y) => f(H(y, o, l, a)), C = s.ori === G.Horizontal ? _t : Rt, I = { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null }, L = I.stroke;
2854
+ let T = !1;
2855
+ const x = d === K.Forward ? c : u;
2856
+ let m = h(n[x]), b = P(e[x]);
2857
+ C(L, b, m);
2858
+ for (let y = x; y >= c && y <= u; y += d) {
2859
+ const D = n[y];
2860
+ if (D == null) {
2861
+ D === null && !S && (T = !0);
2862
+ continue;
2863
+ }
2864
+ const p = P(e[y]), w = h(D);
2865
+ if (M === 1)
2866
+ C(L, p, m);
2867
+ else if (M === -1)
2868
+ C(L, b, w);
2869
+ else {
2870
+ const v = f((b + p) / 2);
2871
+ C(L, v, m), C(L, v, w);
2872
+ }
2873
+ C(L, p, w), m = w, b = p;
2874
+ }
2875
+ {
2876
+ const y = I.fill = new Path2D(L), D = (g == null ? void 0 : g.fillTo) ?? o.min ?? 0, p = h(D);
2877
+ let w = r, v = r + i;
2878
+ d === K.Backward && ([v, w] = [w, v]), C(y, v, p), C(y, w, p);
2879
+ }
2880
+ if (T) {
2881
+ const y = Xt(e, n, c, u, d, P);
2882
+ I.gaps = y, I.clip = Yt(y, s.ori, r, a, i, l);
2883
+ }
2884
+ return I;
2885
+ };
2886
+ }
2887
+ function ys() {
2888
+ return (t, e, n, s, o, i, l, r, a, c, u, d, f) => {
2889
+ const g = (f == null ? void 0 : f.barWidth) ?? 0.6, M = (f == null ? void 0 : f.barGap) ?? 0, S = (f == null ? void 0 : f.barRadius) ?? 0, P = (f == null ? void 0 : f.barGroupIdx) ?? 0, h = (f == null ? void 0 : f.barGroupCount) ?? 1, C = (v) => d(H(v, n, o, l)), I = (v) => d(H(v, s, i, r));
2890
+ let L = o;
2891
+ if (c > a) {
2892
+ let v = 1 / 0, k = -1;
2893
+ for (let z = a; z <= c; z++)
2894
+ if (e[z] != null) {
2895
+ if (k >= 0) {
2896
+ const A = t[z], F = t[k], _ = Math.abs(C(A) - C(F));
2897
+ _ < v && (v = _);
2898
+ }
2899
+ k = z;
2900
+ }
2901
+ v < 1 / 0 && (L = v);
2902
+ }
2903
+ const T = L * (1 - g), x = Math.max(0, T + M), m = Math.max(1, d(L - x)), b = h > 1 ? Math.max(1, d(m / Math.max(1, h))) : m, y = (f == null ? void 0 : f.fillTo) ?? s.min ?? 0, D = I(y), p = new Path2D(), w = n.ori === G.Horizontal;
2904
+ for (let v = u === K.Forward ? a : c; v >= a && v <= c; v += u) {
2905
+ const k = e[v];
2906
+ if (k == null) continue;
2907
+ const z = C(t[v]), A = I(k), F = h > 1 ? (P - (h - 1) / 2) * b : 0, _ = d(z - b / 2 + F), R = Math.min(A, D), B = Math.max(A, D) - R;
2908
+ if (B !== 0)
2909
+ if (S > 0) {
2910
+ const W = Math.min(S * b, B / 2);
2911
+ os(p, w, _, R, b, B, W, k < y);
2912
+ } else
2913
+ w ? p.rect(_, R, b, B) : p.rect(R, _, B, b);
2914
+ }
2915
+ return {
2916
+ stroke: p,
2917
+ fill: p,
2918
+ // bars are filled with the same path
2919
+ clip: null,
2920
+ band: null,
2921
+ gaps: null
2922
+ };
2923
+ };
2924
+ }
2925
+ function os(t, e, n, s, o, i, l, r) {
2926
+ l = Math.min(l, o / 2, i / 2), e ? r ? (t.moveTo(n, s), t.lineTo(n + o, s), t.lineTo(n + o, s + i - l), t.arc(n + o - l, s + i - l, l, 0, Math.PI / 2), t.lineTo(n + l, s + i), t.arc(n + l, s + i - l, l, Math.PI / 2, Math.PI), t.closePath()) : (t.moveTo(n, s + i), t.lineTo(n, s + l), t.arc(n + l, s + l, l, Math.PI, Math.PI * 1.5), t.lineTo(n + o - l, s), t.arc(n + o - l, s + l, l, Math.PI * 1.5, 0), t.lineTo(n + o, s + i), t.closePath()) : r ? (t.moveTo(s, n), t.lineTo(s, n + o), t.lineTo(s + i - l, n + o), t.arc(s + i - l, n + o - l, l, Math.PI / 2, 0, !0), t.lineTo(s + i, n + l), t.arc(s + i - l, n + l, l, 0, -Math.PI / 2, !0), t.closePath()) : (t.moveTo(s + i, n), t.lineTo(s + l, n), t.arc(s + l, n + l, l, -Math.PI / 2, Math.PI, !0), t.lineTo(s, n + o - l), t.arc(s + l, n + o - l, l, Math.PI, Math.PI / 2, !0), t.lineTo(s + i, n + o), t.closePath());
2927
+ }
2928
+ function Ie(t) {
2929
+ return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
2930
+ const M = (g == null ? void 0 : g.spanGaps) ?? !1;
2931
+ if ([c, u] = Ft(n, c, u), c === -1)
2932
+ return { stroke: new Path2D(), fill: null, clip: null, band: null, gaps: null };
2933
+ const S = (b) => f(H(b, s, i, r)), P = (b) => f(H(b, o, l, a)), h = s.ori === G.Horizontal ? _t : Rt, C = [], I = [];
2934
+ let L = !1;
2935
+ for (let b = d === K.Forward ? c : u; b >= c && b <= u; b += d) {
2936
+ const y = n[b];
2937
+ y != null ? (C.push(S(e[b])), I.push(P(y))) : y === null && !M && (L = !0);
2938
+ }
2939
+ const T = s.ori === G.Horizontal, x = t(C, I, T, f), m = {
2940
+ stroke: x ?? new Path2D(),
2941
+ fill: null,
2942
+ clip: null,
2943
+ band: null,
2944
+ gaps: null
2945
+ };
2946
+ if (x != null) {
2947
+ const b = m.fill = new Path2D(x), y = (g == null ? void 0 : g.fillTo) ?? o.min ?? 0, D = P(y);
2948
+ let p = r, w = r + i;
2949
+ d === K.Backward && ([w, p] = [p, w]), h(b, w, D), h(b, p, D);
2950
+ }
2951
+ if (L) {
2952
+ const b = Xt(e, n, c, u, d, S);
2953
+ m.gaps = b, m.clip = Yt(b, s.ori, r, a, i, l);
2954
+ }
2955
+ return m;
2956
+ };
2957
+ }
2958
+ function ks() {
2959
+ return Ie(ls);
2960
+ }
2961
+ const ls = (t, e, n, s) => {
2962
+ const o = t.length;
2963
+ if (o < 2) return null;
2964
+ const i = new Path2D(), l = t[0] ?? 0, r = e[0] ?? 0;
2965
+ if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
2966
+ const f = t[1] ?? 0, g = e[1] ?? 0;
2967
+ return n ? i.lineTo(f, g) : i.lineTo(g, f), i;
2968
+ }
2969
+ const a = new Array(o), c = new Array(o - 1), u = new Array(o - 1), d = new Array(o - 1);
2970
+ for (let f = 0; f < o - 1; f++)
2971
+ u[f] = (e[f + 1] ?? 0) - (e[f] ?? 0), d[f] = (t[f + 1] ?? 0) - (t[f] ?? 0), c[f] = d[f] !== 0 ? (u[f] ?? 0) / (d[f] ?? 1) : 0;
2972
+ a[0] = c[0] ?? 0;
2973
+ for (let f = 1; f < o - 1; f++) {
2974
+ const g = c[f] ?? 0, M = c[f - 1] ?? 0;
2975
+ if (g === 0 || M === 0 || M > 0 != g > 0)
2976
+ a[f] = 0;
2977
+ else {
2978
+ const S = d[f] ?? 1, P = d[f - 1] ?? 1;
2979
+ a[f] = 3 * (P + S) / ((2 * S + P) / M + (S + 2 * P) / g), isFinite(a[f] ?? 0) || (a[f] = 0);
2980
+ }
2981
+ }
2982
+ a[o - 1] = c[o - 2] ?? 0;
2983
+ for (let f = 0; f < o - 1; f++) {
2984
+ const g = d[f] ?? 1, M = t[f] ?? 0, S = e[f] ?? 0, P = t[f + 1] ?? 0, h = e[f + 1] ?? 0, C = a[f] ?? 0, I = a[f + 1] ?? 0, L = M + g / 3, T = S + C * g / 3, x = P - g / 3, m = h - I * g / 3;
2985
+ n ? i.bezierCurveTo(L, T, x, m, P, h) : i.bezierCurveTo(T, L, m, x, h, P);
2986
+ }
2987
+ return i;
2988
+ };
2989
+ function Cs() {
2990
+ return Ie(is);
2991
+ }
2992
+ const is = (t, e, n, s) => {
2993
+ const o = t.length;
2994
+ if (o < 2) return null;
2995
+ const i = new Path2D(), l = s(t[0] ?? 0), r = s(e[0] ?? 0);
2996
+ if (n ? i.moveTo(l, r) : i.moveTo(r, l), o === 2) {
2997
+ const a = s(t[1] ?? 0), c = s(e[1] ?? 0);
2998
+ return n ? i.lineTo(a, c) : i.lineTo(c, a), i;
2999
+ }
3000
+ for (let a = 0; a < o - 1; a++) {
3001
+ const c = a === 0 ? 0 : a - 1, u = t[c] ?? 0, d = e[c] ?? 0, f = t[a] ?? 0, g = e[a] ?? 0, M = t[a + 1] ?? 0, S = e[a + 1] ?? 0, P = a + 2 < o ? t[a + 2] ?? 0 : M, h = a + 2 < o ? e[a + 2] ?? 0 : S, C = Math.hypot(u - f, d - g), I = Math.hypot(f - M, g - S), L = Math.hypot(M - P, S - h), T = Math.sqrt(L), x = L, m = Math.sqrt(I), b = I, y = Math.sqrt(C), D = C, p = 2 * D + 3 * y * m + b, w = 2 * x + 3 * T * m + b, v = 3 * y * (y + m), k = 3 * T * (T + m);
3002
+ let z, A, F, _;
3003
+ if (v > 0) {
3004
+ const R = 1 / v;
3005
+ z = (-b * u + p * f + D * M) * R, A = (-b * d + p * g + D * S) * R;
3006
+ } else
3007
+ z = f, A = g;
3008
+ if (k > 0) {
3009
+ const R = 1 / k;
3010
+ F = (x * f + w * M - b * P) * R, _ = (x * g + w * S - b * h) * R;
3011
+ } else
3012
+ F = M, _ = S;
3013
+ n ? i.bezierCurveTo(z, A, F, _, M, S) : i.bezierCurveTo(A, z, _, F, S, M);
3014
+ }
3015
+ return i;
3016
+ };
3017
+ function Ts(t = 4) {
3018
+ return (e, n, s, o, i, l, r, a, c, u, d, f, g) => {
3019
+ const M = (I) => f(H(I, s, i, r)), S = (I) => f(H(I, o, l, a)), P = t / 2, h = new Path2D(), C = s.ori === G.Horizontal;
3020
+ for (let I = d === K.Forward ? c : u; I >= c && I <= u; I += d) {
3021
+ const L = n[I];
3022
+ if (L == null) continue;
3023
+ const T = M(e[I]), x = S(L);
3024
+ C ? (h.moveTo(T + P, x), h.arc(T, x, P, 0, Math.PI * 2)) : (h.moveTo(x + P, T), h.arc(x, T, P, 0, Math.PI * 2));
3025
+ }
3026
+ return {
3027
+ stroke: h,
3028
+ fill: h,
3029
+ clip: null,
3030
+ band: null,
3031
+ gaps: null
3032
+ };
3033
+ };
3034
+ }
3035
+ function Is(t) {
3036
+ return ({ ctx: e, plotBox: n, pxRatio: s }) => {
3037
+ const {
3038
+ xValues: o,
3039
+ open: i,
3040
+ high: l,
3041
+ low: r,
3042
+ close: a,
3043
+ xScale: c,
3044
+ yScale: u,
3045
+ upColor: d = "#26a69a",
3046
+ downColor: f = "#ef5350",
3047
+ bodyWidth: g = 0.6,
3048
+ wickWidth: M = 1
3049
+ } = t;
3050
+ if (c.min == null || c.max == null || u.min == null || u.max == null) return;
3051
+ const S = o.length;
3052
+ if (S === 0) return;
3053
+ const h = Math.max(2, n.width / S * g) * s / 2;
3054
+ e.save();
3055
+ for (let C = 0; C < S; C++) {
3056
+ const I = o[C], L = i[C], T = l[C], x = r[C], m = a[C];
3057
+ if (I == null || L == null || T == null || x == null || m == null) continue;
3058
+ const b = H(I, c, n.width, n.left) * s, y = H(L, u, n.height, n.top) * s, D = H(T, u, n.height, n.top) * s, p = H(x, u, n.height, n.top) * s, w = H(m, u, n.height, n.top) * s, k = m >= L ? d : f;
3059
+ e.strokeStyle = k, e.lineWidth = M * s, e.beginPath(), e.moveTo(b, D), e.lineTo(b, p), e.stroke();
3060
+ const z = Math.min(y, w), A = Math.abs(w - y);
3061
+ e.fillStyle = k, e.fillRect(b - h, z, h * 2, Math.max(A, 1 * s));
3062
+ }
3063
+ e.restore();
3064
+ };
3065
+ }
3066
+ function As(t, e, n = 0) {
3067
+ const s = e ?? t.series.map((c, u) => u), o = t.x.length, i = [], l = new Float64Array(o);
3068
+ for (let c = 0; c < s.length; c++) {
3069
+ const u = s[c];
3070
+ if (u == null) continue;
3071
+ const d = t.series[u];
3072
+ if (d == null) continue;
3073
+ const f = new Array(o);
3074
+ for (let g = 0; g < o; g++) {
3075
+ const M = d[g];
3076
+ M != null ? (l[g] = l[g] + M, f[g] = l[g]) : f[g] = null;
3077
+ }
3078
+ i.push(f);
3079
+ }
3080
+ const r = [];
3081
+ for (let c = 0; c < t.series.length; c++) {
3082
+ const u = s.indexOf(c), d = u >= 0 ? i[u] : void 0;
3083
+ d != null ? r.push(d) : r.push(t.series[c] ?? []);
3084
+ }
3085
+ const a = [];
3086
+ for (let c = s.length - 1; c > 0; c--) {
3087
+ const u = s[c], d = s[c - 1];
3088
+ u != null && d != null && a.push({
3089
+ group: n,
3090
+ series: [u, d]
3091
+ });
3092
+ }
3093
+ return {
3094
+ group: { x: t.x, series: r },
3095
+ bands: a
3096
+ };
3097
+ }
3098
+ function Ps(t) {
3099
+ const e = /* @__PURE__ */ new Set();
3100
+ for (const [i] of t)
3101
+ for (let l = 0; l < i.length; l++) {
3102
+ const r = i[l];
3103
+ r != null && e.add(r);
3104
+ }
3105
+ const n = Float64Array.from([...e].sort((i, l) => i - l)), s = /* @__PURE__ */ new Map();
3106
+ for (let i = 0; i < n.length; i++) {
3107
+ const l = n[i];
3108
+ l != null && s.set(l, i);
3109
+ }
3110
+ const o = [];
3111
+ for (const [i, l] of t) {
3112
+ const r = new Array(n.length).fill(null);
3113
+ for (let a = 0; a < i.length; a++) {
3114
+ const c = i[a];
3115
+ if (c == null) continue;
3116
+ const u = s.get(c);
3117
+ u != null && (r[u] = l[a] ?? null);
3118
+ }
3119
+ o.push(r);
3120
+ }
3121
+ return [{ x: n, series: o }];
3122
+ }
3123
+ function Ls(t) {
3124
+ const e = (t == null ? void 0 : t.decimals) ?? 1;
3125
+ return (n) => n.map((s) => {
3126
+ const o = Math.abs(s);
3127
+ return o >= 1e9 ? (s / 1e9).toFixed(e) + "B" : o >= 1e6 ? (s / 1e6).toFixed(e) + "M" : o >= 1e3 ? (s / 1e3).toFixed(e) + "K" : s.toFixed(o >= 1 ? 0 : e);
3128
+ });
3129
+ }
3130
+ function Ds(t, e = 0) {
3131
+ return (n) => n.map((s) => s.toFixed(e) + t);
3132
+ }
3133
+ function zs(t) {
3134
+ const e = (t == null ? void 0 : t.utc) ?? !1;
3135
+ return (n) => n.map((s) => e ? nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }, "UTC") : nt(s, { hour: "2-digit", minute: "2-digit", hour12: !1 }));
3136
+ }
3137
+ function Fs(t) {
3138
+ const e = t != null && t.utc ? "UTC" : void 0, n = (t == null ? void 0 : t.format) ?? "short";
3139
+ return (s) => s.map((o) => nt(o, { month: n }, e));
3140
+ }
3141
+ function _s(t) {
3142
+ const { tz: e, ...n } = t ?? {};
3143
+ return (s) => s.map((o) => nt(o, n, e));
3144
+ }
3145
+ function Rs(t, e = 0) {
3146
+ return (n) => n.map((s) => {
3147
+ const o = Math.round(s) - e;
3148
+ return t[o] ?? String(s);
3149
+ });
3150
+ }
3151
+ function Ae(t) {
3152
+ const e = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})/i.exec(t);
3153
+ if (e)
3154
+ return [
3155
+ parseInt(e[1], 16),
3156
+ parseInt(e[2], 16),
3157
+ parseInt(e[3], 16)
3158
+ ];
3159
+ const n = /^#([0-9a-f])([0-9a-f])([0-9a-f])/i.exec(t);
3160
+ if (n)
3161
+ return [
3162
+ parseInt(n[1] + n[1], 16),
3163
+ parseInt(n[2] + n[2], 16),
3164
+ parseInt(n[3] + n[3], 16)
3165
+ ];
3166
+ const s = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);
3167
+ return s ? [Number(s[1]), Number(s[2]), Number(s[3])] : null;
3168
+ }
3169
+ function Gs(t, e = 0.8, n = 0) {
3170
+ const s = Ae(t);
3171
+ if (s == null)
3172
+ return { type: "linear", stops: [[0, t], [1, t]] };
3173
+ const [o, i, l] = s;
3174
+ return {
3175
+ type: "linear",
3176
+ stops: [
3177
+ [0, `rgba(${o},${i},${l},${e})`],
3178
+ [1, `rgba(${o},${i},${l},${n})`]
3179
+ ]
3180
+ };
3181
+ }
3182
+ function Hs(t, e) {
3183
+ const n = Ae(t);
3184
+ if (n == null) return t;
3185
+ const [s, o, i] = n;
3186
+ return `rgba(${s},${o},${i},${e})`;
3187
+ }
3188
+ function Vs(t, e = 65, n = 50) {
3189
+ const s = [];
3190
+ for (let i = 0; i < t; i++) {
3191
+ const l = i * 137.508 % 360;
3192
+ s.push(`hsl(${l.toFixed(1)},${e}%,${n}%)`);
3193
+ }
3194
+ return s;
3195
+ }
3196
+ export {
3197
+ Ms as AnnotationLabel,
3198
+ Dt as Axis,
3199
+ cs as Band,
3200
+ Ce as Chart,
3201
+ K as Direction,
3202
+ N as Distribution,
3203
+ ws as HLine,
3204
+ us as Legend,
3205
+ G as Orientation,
3206
+ xs as Region,
3207
+ Lt as Scale,
3208
+ Te as Series,
3209
+ U as Side,
3210
+ yt as SortOrder,
3211
+ ps as Sparkline,
3212
+ gs as Timeline,
3213
+ fs as Tooltip,
3214
+ vs as VLine,
3215
+ hs as ZoomRanger,
3216
+ Ps as alignData,
3217
+ ys as bars,
3218
+ Cs as catmullRom,
3219
+ Is as drawCandlesticks,
3220
+ es as drawHLine,
3221
+ ms as drawLabel,
3222
+ ss as drawRegion,
3223
+ ns as drawVLine,
3224
+ Gs as fadeGradient,
3225
+ Ls as fmtCompact,
3226
+ _s as fmtDateStr,
3227
+ zs as fmtHourMin,
3228
+ Rs as fmtLabels,
3229
+ Fs as fmtMonthName,
3230
+ Ds as fmtSuffix,
3231
+ Qe as linear,
3232
+ ks as monotoneCubic,
3233
+ Vs as palette,
3234
+ Ts as points,
3235
+ it as posToVal,
3236
+ xt as sideOrientation,
3237
+ As as stackGroup,
3238
+ Ss as stepped,
3239
+ ot as useChart,
3240
+ ds as useCursorDrawHook,
3241
+ Pt as useDrawHook,
3242
+ bs as useStreamingData,
3243
+ H as valToPos,
3244
+ Hs as withAlpha
3245
+ };