@umriss-ui/charts 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/charts.js CHANGED
@@ -1,22 +1,22 @@
1
1
  import "./charts.css";
2
- var be = Object.defineProperty;
3
- var xe = (n, t, e) => t in n ? be(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
4
- var g = (n, t, e) => xe(n, typeof t != "symbol" ? t + "" : t, e);
5
- import { jsx as S, jsxs as _, Fragment as Nt } from "react/jsx-runtime";
6
- import { useRef as Z, useEffect as $, createContext as ve, useContext as ke, useSyncExternalStore as Et, useCallback as Ne, useState as we, useMemo as E } from "react";
7
- function Ie() {
2
+ var He = Object.defineProperty;
3
+ var Ve = (i, t, e) => t in i ? He(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
4
+ var x = (i, t, e) => Ve(i, typeof t != "symbol" ? t + "" : t, e);
5
+ import { jsxs as G, jsx as I, Fragment as bt } from "react/jsx-runtime";
6
+ import { useRef as Q, useEffect as C, createContext as _e, useContext as Ye, useSyncExternalStore as Kt, useCallback as ze, useState as be, useMemo as P } from "react";
7
+ function Be() {
8
8
  var t;
9
- const n = import.meta;
10
- return typeof ((t = n.env) == null ? void 0 : t.DEV) == "boolean" ? n.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
9
+ const i = import.meta;
10
+ return typeof ((t = i.env) == null ? void 0 : t.DEV) == "boolean" ? i.env.DEV : typeof process < "u" && (process != null && process.env) ? process.env.NODE_ENV !== "production" : !1;
11
11
  }
12
- const rt = Ie();
13
- function ut(n, t) {
14
- if (rt && !n)
12
+ const ht = Be();
13
+ function ut(i, t) {
14
+ if (ht && !i)
15
15
  throw new Error(`@umriss-ui/charts: ${t}`);
16
16
  }
17
- const Wt = /* @__PURE__ */ new Set();
18
- function q(n, t) {
19
- !rt || Wt.has(n) || (Wt.add(n), console.warn(`@umriss-ui/charts: ${t}`));
17
+ const Jt = /* @__PURE__ */ new Set();
18
+ function J(i, t) {
19
+ !ht || Jt.has(i) || (Jt.add(i), console.warn(`@umriss-ui/charts: ${t}`));
20
20
  }
21
21
  const O = {
22
22
  colorAxis: "rgba(23, 23, 23, 0.17)",
@@ -29,85 +29,85 @@ const O = {
29
29
  font: "system-ui, sans-serif",
30
30
  fontMono: "ui-monospace, monospace",
31
31
  series: ["#2563eb", "#db2777", "#059669", "#d97706", "#7c3aed", "#0891b2"]
32
- }, Ht = /* @__PURE__ */ new WeakMap();
33
- let wt = 0;
34
- const It = /* @__PURE__ */ new Set();
35
- let gt = null;
36
- function bt(n, t, e) {
37
- const i = n.getPropertyValue(t).trim();
38
- return i === "" ? e : i;
39
- }
40
- function ie(n, t) {
41
- const e = n.ownerDocument.createElement("span");
42
- e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.visibility = "hidden", n.appendChild(e);
32
+ }, Qt = /* @__PURE__ */ new WeakMap();
33
+ let Ht = 0;
34
+ const Vt = /* @__PURE__ */ new Set();
35
+ let Lt = null;
36
+ function Ft(i, t, e) {
37
+ const n = i.getPropertyValue(t).trim();
38
+ return n === "" ? e : n;
39
+ }
40
+ function ve(i, t) {
41
+ const e = i.ownerDocument.createElement("span");
42
+ e.setAttribute("aria-hidden", "true"), e.style.position = "absolute", e.style.visibility = "hidden", i.appendChild(e);
43
43
  try {
44
- return t((i) => {
45
- e.style.color = "", e.style.color = i;
46
- const r = getComputedStyle(e).color;
47
- return r === "" || r.startsWith("var(") ? i : r;
44
+ return t((n) => {
45
+ e.style.color = "", e.style.color = n;
46
+ const s = getComputedStyle(e).color;
47
+ return s === "" || s.startsWith("var(") ? n : s;
48
48
  });
49
49
  } finally {
50
50
  e.remove();
51
51
  }
52
52
  }
53
- function Se(n) {
54
- const t = getComputedStyle(n);
55
- return ie(n, (e) => {
56
- const i = (o, s) => {
57
- const a = bt(t, o, s);
58
- if (a === s) return s;
53
+ function Ge(i) {
54
+ const t = getComputedStyle(i);
55
+ return ve(i, (e) => {
56
+ const n = (o, r) => {
57
+ const a = Ft(t, o, r);
58
+ if (a === r) return r;
59
59
  const l = e(`var(${o})`);
60
60
  return l === `var(${o})` ? a : l;
61
- }, r = [];
61
+ }, s = [];
62
62
  for (let o = 1; o <= 6; o++)
63
- r.push(i(`--uc-series-${o}`, O.series[o - 1] ?? "#2563eb"));
63
+ s.push(n(`--uc-series-${o}`, O.series[o - 1] ?? "#2563eb"));
64
64
  return {
65
- colorAxis: i("--uc-color-axis", O.colorAxis),
66
- colorGrid: i("--uc-color-grid", O.colorGrid),
67
- colorText: i("--uc-color-text", O.colorText),
68
- colorBg: i("--uc-color-bg", O.colorBg),
69
- colorWarning: i("--uc-color-warning", O.colorWarning),
70
- colorAlarm: i("--uc-color-alarm", O.colorAlarm),
71
- colorOk: i("--uc-color-ok", O.colorOk),
72
- font: bt(t, "--uc-font", O.font),
73
- fontMono: bt(t, "--uc-font-mono", O.fontMono),
74
- series: r
65
+ colorAxis: n("--uc-color-axis", O.colorAxis),
66
+ colorGrid: n("--uc-color-grid", O.colorGrid),
67
+ colorText: n("--uc-color-text", O.colorText),
68
+ colorBg: n("--uc-color-bg", O.colorBg),
69
+ colorWarning: n("--uc-color-warning", O.colorWarning),
70
+ colorAlarm: n("--uc-color-alarm", O.colorAlarm),
71
+ colorOk: n("--uc-color-ok", O.colorOk),
72
+ font: Ft(t, "--uc-font", O.font),
73
+ fontMono: Ft(t, "--uc-font-mono", O.fontMono),
74
+ series: s
75
75
  };
76
76
  });
77
77
  }
78
- function re() {
79
- var n, t;
80
- gt === null && (typeof MutationObserver > "u" || typeof document > "u" || (gt = new MutationObserver(() => Rt()), gt.observe(document.documentElement, { attributes: !0 }), typeof window < "u" && typeof window.matchMedia == "function" && ((t = (n = window.matchMedia("(prefers-color-scheme: dark)")).addEventListener) == null || t.call(n, "change", () => Rt()))));
78
+ function Ne() {
79
+ var i, t;
80
+ Lt === null && (typeof MutationObserver > "u" || typeof document > "u" || (Lt = new MutationObserver(() => jt()), Lt.observe(document.documentElement, { attributes: !0 }), typeof window < "u" && typeof window.matchMedia == "function" && ((t = (i = window.matchMedia("(prefers-color-scheme: dark)")).addEventListener) == null || t.call(i, "change", () => jt()))));
81
81
  }
82
- function jn(n, t) {
83
- return re(), ie(n, (e) => {
84
- const i = {};
85
- for (const r of Object.keys(t)) i[r] = e(t[r]);
86
- return i;
82
+ function qe(i, t) {
83
+ return Ne(), ve(i, (e) => {
84
+ const n = {};
85
+ for (const s of Object.keys(t)) n[s] = e(t[s]);
86
+ return n;
87
87
  });
88
88
  }
89
- function Me(n) {
90
- re();
91
- const t = Ht.get(n);
92
- if (t !== void 0 && t.generation === wt) return t.theme;
93
- const e = Se(n);
94
- return Ht.set(n, { generation: wt, theme: e }), e;
89
+ function Ke(i) {
90
+ Ne();
91
+ const t = Qt.get(i);
92
+ if (t !== void 0 && t.generation === Ht) return t.theme;
93
+ const e = Ge(i);
94
+ return Qt.set(i, { generation: Ht, theme: e }), e;
95
95
  }
96
- function Rt() {
97
- wt++;
98
- for (const n of It) n();
96
+ function jt() {
97
+ Ht++;
98
+ for (const i of Vt) i();
99
99
  }
100
- function Le(n) {
101
- return It.add(n), () => {
102
- It.delete(n);
100
+ function Ue(i) {
101
+ return Vt.add(i), () => {
102
+ Vt.delete(i);
103
103
  };
104
104
  }
105
- const Te = { width: 0, height: 0 };
106
- class Ae {
105
+ const Xe = { width: 0, height: 0 };
106
+ class Ze {
107
107
  constructor(t) {
108
- g(this, "span", null);
109
- g(this, "root");
110
- g(this, "cache", /* @__PURE__ */ new Map());
108
+ x(this, "span", null);
109
+ x(this, "root");
110
+ x(this, "cache", /* @__PURE__ */ new Map());
111
111
  this.root = t;
112
112
  }
113
113
  ensure() {
@@ -118,13 +118,13 @@ class Ae {
118
118
  }
119
119
  /** Width and height of a text in the presentation of the given class. */
120
120
  measure(t, e) {
121
- const i = `${e}|${t}`, r = this.cache.get(i);
122
- if (r !== void 0) return r;
121
+ const n = `${e}|${t}`, s = this.cache.get(n);
122
+ if (s !== void 0) return s;
123
123
  const o = this.ensure();
124
- if (o === null) return Te;
124
+ if (o === null) return Xe;
125
125
  o.className = `uc-measure ${e}`, o.textContent = t;
126
- const s = o.getBoundingClientRect(), a = { width: s.width, height: s.height };
127
- return this.cache.set(i, a), a;
126
+ const r = o.getBoundingClientRect(), a = { width: r.width, height: r.height };
127
+ return this.cache.set(n, a), a;
128
128
  }
129
129
  clear() {
130
130
  this.cache.clear();
@@ -134,59 +134,79 @@ class Ae {
134
134
  (t = this.span) == null || t.remove(), this.span = null, this.cache.clear();
135
135
  }
136
136
  }
137
- function St(n) {
138
- return Object.is(n, -0) ? 0 : n;
137
+ function vt(i) {
138
+ return Object.is(i, -0) ? 0 : i;
139
139
  }
140
- function mt(n, t) {
141
- if (!Number.isFinite(n) || n <= 0) return 1;
142
- const e = Math.max(1, Math.floor(t)), i = n / e, r = Math.pow(10, Math.floor(Math.log10(i))), o = i / r, s = 1e-9;
143
- return (o <= 1 + s ? 1 : o <= 2 + s ? 2 : o <= 5 + s ? 5 : 10) * r;
140
+ function et(i, t) {
141
+ if (!Number.isFinite(i) || i <= 0) return 1;
142
+ const e = Math.max(1, Math.floor(t)), n = i / e, s = Math.pow(10, Math.floor(Math.log10(n))), o = n / s, r = 1e-9;
143
+ return (o <= 1 + r ? 1 : o <= 2 + r ? 2 : o <= 5 + r ? 5 : 10) * s;
144
144
  }
145
- function Dt(n) {
146
- const t = Math.abs(n);
145
+ function At(i) {
146
+ const t = Math.abs(i);
147
147
  if (!Number.isFinite(t) || t === 0) return 0;
148
148
  const e = Math.floor(Math.log10(t));
149
- let i = e < 0 ? -e : 0;
150
- const r = t * 1e-9;
151
- for (; i < 12 && Math.abs(Number(t.toFixed(i)) - t) > r; )
152
- i++;
153
- return i;
154
- }
155
- function Mt(n, t) {
156
- return t <= 0 || !Number.isFinite(n) || Math.abs(n) >= 1e21 ? St(n) : St(Number(n.toFixed(Math.min(20, t))));
157
- }
158
- function Fe(n, t, e) {
159
- if (!Number.isFinite(n) || !Number.isFinite(t)) return [0, 1];
160
- if (n === t) return [n - 1, t + 1];
161
- const i = mt(t - n, e), r = Dt(i);
149
+ let n = e < 0 ? -e : 0;
150
+ const s = t * 1e-9;
151
+ for (; n < 12 && Math.abs(Number(t.toFixed(n)) - t) > s; )
152
+ n++;
153
+ return n;
154
+ }
155
+ function Nt(i, t) {
156
+ return t <= 0 || !Number.isFinite(i) || Math.abs(i) >= 1e21 ? vt(i) : vt(Number(i.toFixed(Math.min(20, t))));
157
+ }
158
+ function Je(i, t, e) {
159
+ if (!Number.isFinite(i) || !Number.isFinite(t)) return [0, 1];
160
+ if (i === t) return [i - 1, t + 1];
161
+ const n = et(t - i, e), s = At(n);
162
162
  return [
163
- Mt(Math.floor(n / i) * i, r),
164
- Mt(Math.ceil(t / i) * i, r)
163
+ Nt(Math.floor(i / n) * n, s),
164
+ Nt(Math.ceil(t / n) * n, s)
165
165
  ];
166
166
  }
167
- function Vt(n, t) {
168
- return !Number.isFinite(n) || !Number.isFinite(t) ? [0, 1] : n === t ? [n - 1, t + 1] : [n, t];
169
- }
170
- function oe(n, t, e) {
171
- if (!Number.isFinite(n) || !Number.isFinite(t)) return [];
172
- if (n === t) return [St(n)];
173
- const [i, r] = n < t ? [n, t] : [t, n], o = mt(r - i, e), s = Dt(o), a = o * 1e-9, l = Math.ceil((i - a) / o), c = Math.floor((r + a) / o);
174
- if (!Number.isFinite(l) || !Number.isFinite(c)) return [];
175
- const u = [];
176
- for (let h = l; h <= c; h++)
177
- u.push(Mt(h * o, s));
178
- return u;
167
+ function Dt(i, t) {
168
+ return !Number.isFinite(i) || !Number.isFinite(t) ? [0, 1] : i === t ? [i - 1, t + 1] : [i, t];
169
+ }
170
+ function ke(i, t, e) {
171
+ if (!Number.isFinite(i) || !Number.isFinite(t)) return [];
172
+ if (i === t) return [vt(i)];
173
+ const [n, s] = i < t ? [i, t] : [t, i], o = et(s - n, e), r = At(o), a = o * 1e-9, l = Math.ceil((n - a) / o), u = Math.floor((s + a) / o);
174
+ if (!Number.isFinite(l) || !Number.isFinite(u)) return [];
175
+ const d = [];
176
+ for (let f = l; f <= u; f++)
177
+ d.push(Nt(f * o, r));
178
+ return d;
179
+ }
180
+ function Qe(i, t, e, n) {
181
+ const s = n.length, o = n[0], r = n[s - 1];
182
+ if (s < 2 || o === void 0 || r === void 0 || !Number.isFinite(i) || !Number.isFinite(t))
183
+ return null;
184
+ const [a, l] = i === t ? [i - 1, t + 1] : [i, t], u = (r - o) / (s - 1), d = (o - e[0]) / u, f = (e[1] - r) / u, h = s - 1 + d + f, m = (p) => vt(Number(p.toPrecision(12)));
185
+ let c = et((l - a) / h, 1);
186
+ for (let p = 0; p < 64; p++) {
187
+ const y = c * 1e-9, g = Math.floor((a + d * c + y) / c) * c, b = g - d * c;
188
+ if (b + h * c >= l - y) {
189
+ const N = At(c);
190
+ return {
191
+ domain: [m(b), m(b + h * c)],
192
+ ticks: Array.from({ length: s }, (A, $) => Nt(g + $ * c, N)),
193
+ step: c
194
+ };
195
+ }
196
+ c = et(c * 1.5, 1);
197
+ }
198
+ return null;
179
199
  }
180
- class _t {
200
+ class te {
181
201
  constructor(t, e) {
182
- g(this, "domain");
183
- g(this, "range");
202
+ x(this, "domain");
203
+ x(this, "range");
184
204
  /** Pre-computed line equation px = v·m + b - the draw loop uses it directly. */
185
- g(this, "m");
186
- g(this, "b");
205
+ x(this, "m");
206
+ x(this, "b");
187
207
  this.domain = t, this.range = e;
188
- const i = t[1] - t[0];
189
- i === 0 || !Number.isFinite(i) ? (this.m = 0, this.b = (e[0] + e[1]) / 2) : (this.m = (e[1] - e[0]) / i, this.b = e[0] - t[0] * this.m);
208
+ const n = t[1] - t[0];
209
+ n === 0 || !Number.isFinite(n) ? (this.m = 0, this.b = (e[0] + e[1]) / 2) : (this.m = (e[1] - e[0]) / n, this.b = e[0] - t[0] * this.m);
190
210
  }
191
211
  toPx(t) {
192
212
  return t * this.m + this.b;
@@ -195,899 +215,1078 @@ class _t {
195
215
  return this.m === 0 ? this.domain[0] : (t - this.b) / this.m;
196
216
  }
197
217
  ticks(t) {
198
- return oe(this.domain[0], this.domain[1], t);
199
- }
200
- }
201
- let at = null;
202
- function se() {
203
- if (at !== null) return at;
204
- const n = typeof navigator > "u" ? void 0 : navigator.language;
205
- return at = typeof n == "string" && n !== "" ? n : "en-US", at;
206
- }
207
- const ht = /* @__PURE__ */ new Map();
208
- function Pe(n) {
209
- const t = se(), e = `${t}|${n}`;
210
- let i = ht.get(e);
211
- return i === void 0 && (i = new Intl.NumberFormat(t, {
212
- minimumFractionDigits: n,
213
- maximumFractionDigits: n,
218
+ return ke(this.domain[0], this.domain[1], t);
219
+ }
220
+ }
221
+ let mt = null;
222
+ function we() {
223
+ if (mt !== null) return mt;
224
+ const i = typeof navigator > "u" ? void 0 : navigator.language;
225
+ return mt = typeof i == "string" && i !== "" ? i : "en-US", mt;
226
+ }
227
+ const kt = /* @__PURE__ */ new Map();
228
+ function je(i) {
229
+ const t = we(), e = `${t}|${i}`;
230
+ let n = kt.get(e);
231
+ return n === void 0 && (n = new Intl.NumberFormat(t, {
232
+ minimumFractionDigits: i,
233
+ maximumFractionDigits: i,
214
234
  useGrouping: !0
215
- }), ht.set(e, i)), i;
235
+ }), kt.set(e, n)), n;
216
236
  }
217
- function Ee(n, t) {
218
- return Pe(Math.min(6, Dt(t))).format(n);
237
+ function Ie(i, t) {
238
+ return je(Math.min(6, At(t))).format(i);
219
239
  }
220
- function Bt(n) {
221
- if (!Number.isFinite(n)) return "–";
222
- const t = se(), e = `${t}|value`;
223
- let i = ht.get(e);
224
- return i === void 0 && (i = new Intl.NumberFormat(t, { maximumFractionDigits: 3, useGrouping: !0 }), ht.set(e, i)), i.format(n);
240
+ function ee(i) {
241
+ if (!Number.isFinite(i)) return "–";
242
+ const t = we(), e = `${t}|value`;
243
+ let n = kt.get(e);
244
+ return n === void 0 && (n = new Intl.NumberFormat(t, { maximumFractionDigits: 3, useGrouping: !0 }), kt.set(e, n)), n.format(i);
225
245
  }
226
- const K = 1e3, U = 60 * K, Q = 60 * U, X = 24 * Q;
227
- function De(n) {
228
- const t = n.filter((o) => Number.isFinite(o.from) && Number.isFinite(o.to) && o.to > o.from).sort((o, s) => o.from - s.from), e = [];
246
+ const j = 1e3, q = 60 * j, tt = 60 * q, K = 24 * tt;
247
+ function tn(i) {
248
+ const t = i.filter((o) => Number.isFinite(o.from) && Number.isFinite(o.to) && o.to > o.from).sort((o, r) => o.from - r.from), e = [];
229
249
  for (const o of t) {
230
- const s = e[e.length - 1];
231
- s !== void 0 && o.from <= s.to ? o.to > s.to && (e[e.length - 1] = { from: s.from, to: o.to }) : e.push({ from: o.from, to: o.to });
250
+ const r = e[e.length - 1];
251
+ r !== void 0 && o.from <= r.to ? o.to > r.to && (e[e.length - 1] = { from: r.from, to: o.to }) : e.push({ from: o.from, to: o.to });
232
252
  }
233
- const i = [];
234
- let r = 0;
253
+ const n = [];
254
+ let s = 0;
235
255
  for (const o of e)
236
- i.push(r), r += o.to - o.from;
237
- return { intervals: e, offsets: i, total: r };
256
+ n.push(s), s += o.to - o.from;
257
+ return { intervals: e, offsets: n, total: s };
238
258
  }
239
- const Yt = /* @__PURE__ */ new WeakMap();
240
- function G(n) {
241
- if (!Array.isArray(n)) return n;
242
- const t = n, e = Yt.get(t);
259
+ const ne = /* @__PURE__ */ new WeakMap();
260
+ function Z(i) {
261
+ if (!Array.isArray(i)) return i;
262
+ const t = i, e = ne.get(t);
243
263
  if (e !== void 0) return e;
244
- const i = De(t);
245
- return Yt.set(t, i), i;
264
+ const n = tn(t);
265
+ return ne.set(t, n), n;
246
266
  }
247
- function $e(n, t) {
248
- const e = n.intervals;
249
- let i = 0, r = e.length - 1, o = -1;
250
- for (; i <= r; ) {
251
- const s = i + r >> 1;
252
- e[s].from <= t ? (o = s, i = s + 1) : r = s - 1;
267
+ function en(i, t) {
268
+ const e = i.intervals;
269
+ let n = 0, s = e.length - 1, o = -1;
270
+ for (; n <= s; ) {
271
+ const r = n + s >> 1;
272
+ e[r].from <= t ? (o = r, n = r + 1) : s = r - 1;
253
273
  }
254
274
  return o < 0 ? -1 : t <= e[o].to ? o : -1;
255
275
  }
256
- function pt(n, t) {
257
- const e = G(t);
258
- if (e.intervals.length === 0) return n;
259
- const i = $e(e, n);
260
- return i < 0 ? Number.NaN : e.offsets[i] + (n - e.intervals[i].from);
261
- }
262
- function dt(n, t) {
263
- const e = G(t), i = e.intervals;
264
- if (i.length === 0) return n;
265
- if (!(n >= 0) || n > e.total) return Number.NaN;
266
- if (n === e.total)
267
- return i[i.length - 1].to;
268
- let r = 0, o = i.length - 1, s = 0;
269
- for (; r <= o; ) {
270
- const a = r + o >> 1;
271
- e.offsets[a] <= n ? (s = a, r = a + 1) : o = a - 1;
272
- }
273
- return i[s].from + (n - e.offsets[s]);
274
- }
275
- function Jn(n, t, e, i) {
276
- const r = G(n);
276
+ function st(i, t) {
277
+ const e = Z(t);
278
+ if (e.intervals.length === 0) return i;
279
+ const n = en(e, i);
280
+ return n < 0 ? Number.NaN : e.offsets[n] + (i - e.intervals[n].from);
281
+ }
282
+ function ot(i, t) {
283
+ const e = Z(t), n = e.intervals;
284
+ if (n.length === 0) return i;
285
+ if (!(i >= 0) || i > e.total) return Number.NaN;
286
+ if (i === e.total)
287
+ return n[n.length - 1].to;
288
+ let s = 0, o = n.length - 1, r = 0;
289
+ for (; s <= o; ) {
290
+ const a = s + o >> 1;
291
+ e.offsets[a] <= i ? (r = a, s = a + 1) : o = a - 1;
292
+ }
293
+ return n[r].from + (i - e.offsets[r]);
294
+ }
295
+ function Si(i, t, e, n) {
296
+ const s = Z(i);
277
297
  for (let o = 0; o < e; o++)
278
- i[o] = pt(t[o], r);
279
- }
280
- function Ce(n, t) {
281
- const e = G(t);
282
- if (e.intervals.length === 0) return n;
283
- const i = pt(n, e);
284
- if (!Number.isNaN(i)) return i;
285
- if (!Number.isFinite(n)) return Number.NaN;
286
- for (let r = 0; r < e.intervals.length; r++) {
287
- const o = e.intervals[r];
288
- if (n < o.from) return e.offsets[r];
298
+ n[o] = st(t[o], s);
299
+ }
300
+ function nn(i, t) {
301
+ const e = Z(t);
302
+ if (e.intervals.length === 0) return i;
303
+ const n = st(i, e);
304
+ if (!Number.isNaN(n)) return n;
305
+ if (!Number.isFinite(i)) return Number.NaN;
306
+ for (let s = 0; s < e.intervals.length; s++) {
307
+ const o = e.intervals[s];
308
+ if (i < o.from) return e.offsets[s];
289
309
  }
290
310
  return e.total;
291
311
  }
292
- function Oe(n, t) {
293
- const e = G(t);
294
- return e.intervals.length === 0 ? !1 : Number.isNaN(pt(n, e));
312
+ function sn(i, t) {
313
+ const e = Z(t);
314
+ return e.intervals.length === 0 ? !1 : Number.isNaN(st(i, e));
295
315
  }
296
- function We(n) {
297
- const t = G(n), e = [];
298
- for (let i = 1; i < t.intervals.length; i++)
316
+ function on(i) {
317
+ const t = Z(i), e = [];
318
+ for (let n = 1; n < t.intervals.length; n++)
299
319
  e.push({
300
- from: t.intervals[i - 1].to,
301
- to: t.intervals[i].from,
302
- operatingTime: t.offsets[i]
320
+ from: t.intervals[n - 1].to,
321
+ to: t.intervals[n].from,
322
+ operatingTime: t.offsets[n]
303
323
  });
304
324
  return e;
305
325
  }
306
- function He(n, t, e) {
307
- return We(n).map((i) => i.operatingTime).filter((i) => i >= t && i <= e);
308
- }
309
- const zt = [
326
+ function rn(i, t, e) {
327
+ return on(i).map((n) => n.operatingTime).filter((n) => n >= t && n <= e);
328
+ }
329
+ const ie = [
330
+ j,
331
+ 2 * j,
332
+ 5 * j,
333
+ 10 * j,
334
+ 15 * j,
335
+ 30 * j,
336
+ q,
337
+ 2 * q,
338
+ 5 * q,
339
+ 10 * q,
340
+ 15 * q,
341
+ 30 * q,
342
+ tt,
343
+ 2 * tt,
344
+ 3 * tt,
345
+ 6 * tt,
346
+ 12 * tt,
310
347
  K,
311
348
  2 * K,
312
- 5 * K,
313
- 10 * K,
314
- 15 * K,
315
- 30 * K,
316
- U,
317
- 2 * U,
318
- 5 * U,
319
- 10 * U,
320
- 15 * U,
321
- 30 * U,
322
- Q,
323
- 2 * Q,
324
- 3 * Q,
325
- 6 * Q,
326
- 12 * Q,
327
- X,
328
- 2 * X,
329
- 7 * X,
330
- 14 * X,
331
- 28 * X
349
+ 7 * K,
350
+ 14 * K,
351
+ 28 * K
332
352
  ];
333
- function Re(n, t) {
334
- const e = zt[0];
335
- if (!Number.isFinite(n) || n <= 0) return e;
336
- const i = n / Math.max(1, Math.floor(t));
337
- for (const r of zt) if (r >= i) return r;
338
- return X * mt(i / X, 1);
339
- }
340
- function Ve(n, t, e, i, r = 0) {
341
- const o = G(n), s = [];
342
- if (!Number.isFinite(t) || !Number.isFinite(e) || !(i > 0)) return s;
343
- const a = Math.ceil((t - r) / i), l = Math.floor((e - r) / i);
344
- if (!Number.isFinite(a) || !Number.isFinite(l)) return s;
345
- let c = Number.NaN;
346
- for (let u = a; u <= l; u++) {
347
- const h = r + u * i, p = pt(h, o);
348
- Number.isNaN(p) || p === c || (s.push({ wallClock: h, operatingTime: p }), c = p);
353
+ function an(i, t) {
354
+ const e = ie[0];
355
+ if (!Number.isFinite(i) || i <= 0) return e;
356
+ const n = i / Math.max(1, Math.floor(t));
357
+ for (const s of ie) if (s >= n) return s;
358
+ return K * et(n / K, 1);
359
+ }
360
+ function Ti(i) {
361
+ return new Date(i).getTimezoneOffset() * q;
362
+ }
363
+ function ln(i, t, e, n, s = 0) {
364
+ const o = Z(i), r = [];
365
+ if (!Number.isFinite(t) || !Number.isFinite(e) || !(n > 0)) return r;
366
+ const a = Math.ceil((t - s) / n), l = Math.floor((e - s) / n);
367
+ if (!Number.isFinite(a) || !Number.isFinite(l)) return r;
368
+ let u = Number.NaN;
369
+ for (let d = a; d <= l; d++) {
370
+ const f = s + d * n, h = st(f, o);
371
+ Number.isNaN(h) || h === u || (r.push({ wallClock: f, operatingTime: h }), u = h);
349
372
  }
350
- return s;
373
+ return r;
351
374
  }
352
- function _e(n, t, e, i, r = 0) {
353
- const o = G(n);
375
+ function Li(i, t, e, n, s = 0) {
376
+ const o = Z(i);
354
377
  if (o.intervals.length === 0 || !(e > t)) return [];
355
- const s = Math.max(0, Math.min(o.total, t)), a = Math.max(0, Math.min(o.total, e)), l = Re(e - t, i);
356
- return Ve(
378
+ const r = Math.max(0, Math.min(o.total, t)), a = Math.max(0, Math.min(o.total, e)), l = an(e - t, n);
379
+ return ln(
357
380
  o,
358
- dt(s, o),
359
- dt(a, o),
381
+ ot(r, o),
382
+ ot(a, o),
360
383
  l,
361
- r
362
- ).map((u) => u.operatingTime).filter((u) => u >= t && u <= e);
384
+ s
385
+ ).map((d) => d.operatingTime).filter((d) => d >= t && d <= e);
386
+ }
387
+ const se = 365 * K, cn = [
388
+ ...[1, 2, 5, 10, 15, 30].map((i) => ({ unit: "minute", n: i, ms: i * q })),
389
+ ...[1, 2, 3, 6, 12].map((i) => ({ unit: "hour", n: i, ms: i * tt })),
390
+ ...[1, 2, 7, 14].map((i) => ({ unit: "day", n: i, ms: i * K })),
391
+ ...[1, 2, 3, 6].map((i) => ({ unit: "month", n: i, ms: i * 30 * K }))
392
+ ];
393
+ function un(i, t) {
394
+ const e = i / Math.max(1, Math.floor(t));
395
+ for (const s of cn) if (s.ms >= e) return s;
396
+ const n = Math.max(1, et(e / se, 1));
397
+ return { unit: "year", n, ms: n * se };
398
+ }
399
+ const wt = { year: 0, month: 1, day: 2, hour: 3, minute: 4 };
400
+ function _t(i, t) {
401
+ const e = new Date(i), n = [e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes()], s = wt[t.unit];
402
+ for (let r = s + 1; r < n.length; r++) n[r] = r === wt.day ? 1 : 0;
403
+ const o = n[s];
404
+ if (t.unit === "day") {
405
+ const r = Math.round(Date.UTC(n[0], n[1], o) / K);
406
+ n[s] = o - ((r + 3) % t.n + t.n) % t.n;
407
+ } else
408
+ n[s] = Math.floor(o / t.n) * t.n;
409
+ return n;
410
+ }
411
+ function xt(i, t, e) {
412
+ const n = i.slice();
413
+ return n[wt[t.unit]] = n[wt[t.unit]] + e * t.n, new Date(n[0], n[1], n[2], n[3], n[4]).getTime();
414
+ }
415
+ function oe(i, t, e) {
416
+ const n = [];
417
+ if (!Number.isFinite(i) || !Number.isFinite(t)) return n;
418
+ const s = _t(i, e);
419
+ for (let o = 0; o < 1e3; o++) {
420
+ const r = xt(s, e, o);
421
+ if (r > t) break;
422
+ r >= i && !(r <= n[n.length - 1]) && n.push(r);
423
+ }
424
+ return n;
425
+ }
426
+ function hn(i, t, e) {
427
+ const n = _t(t, e), s = xt(n, e, 0);
428
+ return [xt(_t(i, e), e, 0), s < t ? xt(n, e, 1) : s];
429
+ }
430
+ const Me = new Intl.DateTimeFormat("en-GB", { hour: "2-digit", minute: "2-digit", hourCycle: "h23" }), dn = new Intl.DateTimeFormat("en-GB", {
431
+ hour: "2-digit",
432
+ minute: "2-digit",
433
+ second: "2-digit",
434
+ hourCycle: "h23"
435
+ }), Ae = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short" }), fn = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric" }), mn = new Intl.DateTimeFormat("en-GB", { month: "short", year: "numeric" }), pn = new Intl.DateTimeFormat("en-GB", { year: "numeric" });
436
+ function Yt(i, t = !1) {
437
+ return Number.isFinite(i) ? `${Ae.format(i)} ${(t ? dn : Me).format(i)}` : "";
438
+ }
439
+ function yn(i, t) {
440
+ return i.map((e, n) => {
441
+ const s = n === 0 ? void 0 : new Date(i[n - 1]), o = new Date(e);
442
+ switch (t.unit) {
443
+ case "minute":
444
+ case "hour":
445
+ return s === void 0 || s.toDateString() !== o.toDateString() ? Yt(e) : Me.format(e);
446
+ case "day":
447
+ return s === void 0 || s.getFullYear() !== o.getFullYear() ? fn.format(e) : Ae.format(e);
448
+ case "month":
449
+ return mn.format(e);
450
+ default:
451
+ return pn.format(e);
452
+ }
453
+ });
363
454
  }
364
- const Lt = 5, Tt = 4, xt = 8, Gt = 4, Be = 8, it = "uc-tick-label", lt = "uc-axis-title", ae = {
455
+ const zt = 5, Bt = 4, Et = 8, re = 4, gn = 8, it = "uc-tick-label", pt = "uc-axis-title", Se = {
365
456
  width: 0,
366
457
  height: 0,
367
458
  plot: { x: 0, y: 0, width: 0, height: 0 },
368
459
  axes: []
369
460
  };
370
- function qt(n, t, e) {
371
- const i = Math.ceil(t), r = e.get(n);
372
- return r === void 0 || i > r || r - i >= Be ? (e.set(n, i), i) : r;
461
+ function ae(i, t, e) {
462
+ const n = Math.ceil(t), s = e.get(i);
463
+ return s === void 0 || n > s || s - n >= gn ? (e.set(i, n), n) : s;
464
+ }
465
+ function St(i) {
466
+ return i.calendar !== void 0 && i.calendar.length > 0 ? i.calendar : void 0;
467
+ }
468
+ function Te(i) {
469
+ return i[1] - i[0] >= q;
470
+ }
471
+ function It(i, t) {
472
+ return un(i[1] - i[0], t);
373
473
  }
374
- function Kt(n, t) {
375
- const e = n.domainMode;
474
+ function Pt(i, t) {
475
+ const e = i.domainMode;
376
476
  if (Array.isArray(e)) {
377
477
  const o = e;
378
478
  return o[0] === o[1] ? [o[0] - 1, o[1] + 1] : o;
379
479
  }
380
- const [i, r] = n.extent;
381
- return n.calendar !== void 0 && n.calendar.length > 0 || e === "data" ? Vt(i, r) : Fe(i, r, t);
382
- }
383
- function Ye(n) {
384
- if (!Number.isFinite(n)) return "";
385
- const t = new Date(n), e = (i) => String(i).padStart(2, "0");
386
- return `${e(t.getDate())}.${e(t.getMonth() + 1)}. ${e(t.getHours())}:${e(t.getMinutes())}`;
387
- }
388
- function Ut(n, t, e) {
389
- if (n.tickValues !== void 0)
390
- return n.tickValues.filter((r) => r >= t[0] && r <= t[1]);
391
- const i = n.calendar;
392
- return i !== void 0 && i.length > 0 ? _e(i, t[0], t[1], e) : oe(t[0], t[1], e);
393
- }
394
- function Xt(n, t, e) {
395
- const i = n.calendar;
396
- if (i !== void 0 && i.length > 0) {
397
- const o = n.tickFormat;
398
- return o === void 0 ? (s) => Ye(dt(s, i)) : (s) => o(dt(s, i));
399
- }
400
- if (n.tickFormat !== void 0) return n.tickFormat;
401
- const r = mt(Math.abs(t[1] - t[0]), e);
402
- return (o) => Ee(o, r);
403
- }
404
- function ze(n) {
405
- const { width: t, height: e, padding: i, axes: r, measure: o, hysteresis: s } = n, a = r.filter((v) => v.position === "left"), l = r.filter((v) => v.position === "right"), c = r.filter((v) => v.position === "top"), u = r.filter((v) => v.position === "bottom"), h = Math.ceil(o("0", it).height) || 14, p = /* @__PURE__ */ new Map();
406
- for (const v of [...c, ...u]) {
407
- const M = v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, lt).height) + Gt;
408
- p.set(v.key, qt(v.key, Lt + Tt + h + M, s));
409
- }
410
- const d = (v, M) => {
411
- let x = 0;
412
- for (let T = 0; T < v.length; T++) {
413
- const C = v[T];
414
- C !== void 0 && (x += M.get(C.key) ?? 0, T > 0 && (x += xt));
480
+ const [n, s] = i.extent;
481
+ return St(i) !== void 0 || e === "data" ? Dt(n, s) : i.time === !0 ? Te([n, s]) ? hn(n, s, It([n, s], t)) : Dt(n, s) : Je(n, s, t);
482
+ }
483
+ function le(i, t, e) {
484
+ const n = St(i);
485
+ if (i.tickValues !== void 0)
486
+ return (n !== void 0 ? i.tickValues.map((o) => st(o, n)) : i.tickValues).filter((o) => o >= t[0] && o <= t[1]);
487
+ if (n !== void 0) {
488
+ const s = Z(n), o = (a) => ot(Math.min(Math.max(a, 0), s.total), s), r = [];
489
+ for (const a of oe(o(t[0]), o(t[1]), It(t, e))) {
490
+ const l = st(a, s);
491
+ Number.isNaN(l) || l === r[r.length - 1] || l >= t[0] && l <= t[1] && r.push(l);
415
492
  }
416
- return x;
417
- }, m = i.top + d(c, p), y = e - i.bottom - d(u, p), f = Math.max(0, y - m), b = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
418
- for (const v of [...a, ...l]) {
419
- const M = v.tickCount ?? Math.max(2, Math.round(f / 50)), x = Kt(v, M), T = Ut(v, x, M), C = Xt(v, x, M), L = T.map(C), W = L.map((R) => o(R, it).width);
420
- let D = 0;
421
- for (const R of W) R > D && (D = R);
422
- for (const R of v.limitLabels ?? []) D = Math.max(D, o(R, it).width + 4);
423
- const B = v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, lt).height) + Gt;
424
- b.set(v.key, { axis: v, domain: x, values: T, labels: L, widths: W, format: C }), k.set(
425
- v.key,
426
- qt(v.key, Lt + Tt + D + B, s)
493
+ return r;
494
+ }
495
+ return i.time === !0 ? Te(t) ? oe(t[0], t[1], It(t, e)) : [] : ke(t[0], t[1], e);
496
+ }
497
+ function ce(i, t, e) {
498
+ const n = i.tickFormat, s = St(i);
499
+ if (s !== void 0)
500
+ return n !== void 0 ? (r) => n(ot(r, s)) : (r, a) => Yt(ot(r, s), a);
501
+ if (n !== void 0) return (r) => n(r);
502
+ if (i.time === !0) return Yt;
503
+ const o = et(Math.abs(t[1] - t[0]), e);
504
+ return (r) => Ie(r, o);
505
+ }
506
+ function ue(i, t, e, n, s) {
507
+ const o = St(i);
508
+ if (i.tickFormat !== void 0 || i.time !== !0 && o === void 0) return n.map(s);
509
+ const r = o === void 0 ? n : n.map((a) => ot(a, o));
510
+ return yn(r, It(t, e));
511
+ }
512
+ function Le(i, t, e) {
513
+ return Math.min(Math.max(i, 0), Math.max(0, e - t));
514
+ }
515
+ function xn(i) {
516
+ const { width: t, height: e, padding: n, axes: s, measure: o, hysteresis: r } = i, a = s.filter((k) => k.position === "left"), l = s.filter((k) => k.position === "right"), u = s.filter((k) => k.position === "top"), d = s.filter((k) => k.position === "bottom"), f = Math.ceil(o("0", it).height) || 14, h = /* @__PURE__ */ new Map();
517
+ for (const k of [...u, ...d]) {
518
+ const D = k.label === void 0 || k.label === "" ? 0 : Math.ceil(o(k.label, pt).height) + re;
519
+ h.set(k.key, ae(k.key, zt + Bt + f + D, r));
520
+ }
521
+ const m = (k, D) => {
522
+ let v = 0;
523
+ for (let F = 0; F < k.length; F++) {
524
+ const R = k[F];
525
+ R !== void 0 && (v += D.get(R.key) ?? 0, F > 0 && (v += Et));
526
+ }
527
+ return v;
528
+ }, c = n.top + m(u, h), p = e - n.bottom - m(d, h), y = Math.max(0, p - c), g = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), N = s.find((k) => k.orientation === "y");
529
+ for (const k of [...a, ...l].sort((D, v) => D === N ? -1 : v === N ? 1 : 0)) {
530
+ const D = k.tickCount ?? Math.max(2, Math.round(y / 50)), v = N === void 0 ? void 0 : g.get(N.key), [F, R] = Array.isArray(k.domainMode) ? Pt(k, D) : k.extent, M = k.alignTicks === !0 && k !== N && v !== void 0 ? Qe(F, R, v.domain, v.values) : null, V = (M == null ? void 0 : M.domain) ?? Pt(k, D), E = (M == null ? void 0 : M.ticks) ?? le(k, V, D), z = M === null ? ce(k, V, D) : k.tickFormat ?? ((Y) => Ie(Y, M.step)), B = ue(k, V, D, E, z), U = B.map((Y) => o(Y, it).width);
531
+ let _ = 0;
532
+ for (const Y of U) Y > _ && (_ = Y);
533
+ for (const Y of k.limitLabels ?? []) _ = Math.max(_, o(Y, it).width + 4);
534
+ const nt = k.label === void 0 || k.label === "" ? 0 : Math.ceil(o(k.label, pt).height) + re;
535
+ g.set(k.key, { axis: k, domain: V, values: E, labels: B, widths: U, format: z }), b.set(
536
+ k.key,
537
+ ae(k.key, zt + Bt + _ + nt, r)
427
538
  );
428
539
  }
429
- const w = i.left + d(a, k), I = t - i.right - d(l, k), A = Math.max(0, I - w), F = { x: w, y: m, width: A, height: f }, P = (v, M, x, T) => {
430
- switch (v.position) {
540
+ const A = n.left + m(a, b), $ = t - n.right - m(l, b), w = Math.max(0, $ - A), W = { x: A, y: c, width: w, height: y }, L = (k, D, v, F) => {
541
+ switch (k.position) {
431
542
  case "left":
432
- return { x: w - x - T, y: m, width: T, height: f };
543
+ return { x: A - v - F, y: c, width: F, height: y };
433
544
  case "right":
434
- return { x: I + x, y: m, width: T, height: f };
545
+ return { x: $ + v, y: c, width: F, height: y };
435
546
  case "top":
436
- return { x: w, y: m - x - T, width: A, height: T };
547
+ return { x: A, y: c - v - F, width: w, height: F };
437
548
  default:
438
- return { x: w, y: y + x, width: A, height: T };
549
+ return { x: A, y: p + v, width: w, height: F };
439
550
  }
440
- }, N = [], H = (v) => {
441
- let M = 0;
442
- v.forEach((x, T) => {
443
- const C = k.get(x.key) ?? 0, L = b.get(x.key), W = P(x, T, M, C);
444
- M += C + xt;
445
- const D = (L == null ? void 0 : L.domain) ?? [0, 1], B = (L == null ? void 0 : L.format) ?? ((J) => String(J)), R = new _t(D, [m + f, m]), et = ((L == null ? void 0 : L.values) ?? []).map((J, Y) => ({
446
- value: J,
447
- label: (L == null ? void 0 : L.labels[Y]) ?? "",
448
- px: R.toPx(J),
551
+ }, S = [], T = (k) => {
552
+ let D = 0;
553
+ k.forEach((v, F) => {
554
+ const R = b.get(v.key) ?? 0, M = g.get(v.key), V = L(v, F, D, R);
555
+ D += R + Et;
556
+ const E = (M == null ? void 0 : M.domain) ?? [0, 1], z = (M == null ? void 0 : M.format) ?? ((_) => String(_)), B = new te(E, [c + y, c]), U = ((M == null ? void 0 : M.values) ?? []).map((_, nt) => ({
557
+ value: _,
558
+ label: (M == null ? void 0 : M.labels[nt]) ?? "",
559
+ px: B.toPx(_),
449
560
  labelLeft: 0,
450
- labelWidth: (L == null ? void 0 : L.widths[Y]) ?? 0
561
+ labelWidth: (M == null ? void 0 : M.widths[nt]) ?? 0
451
562
  }));
452
- N.push({
453
- key: x.key,
454
- id: x.id,
563
+ S.push({
564
+ key: v.key,
565
+ id: v.id,
455
566
  orientation: "y",
456
- position: x.position,
457
- label: x.label,
458
- grid: x.grid,
459
- band: W,
460
- size: C,
461
- stack: T,
462
- domain: D,
463
- scale: R,
464
- ticks: et,
465
- format: B,
466
- titleSize: x.label === void 0 || x.label === "" ? 0 : Math.ceil(o(x.label, lt).height),
567
+ position: v.position,
568
+ label: v.label,
569
+ grid: v.grid,
570
+ band: V,
571
+ size: R,
572
+ stack: F,
573
+ domain: E,
574
+ scale: B,
575
+ ticks: U,
576
+ format: z,
577
+ titleSize: v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, pt).height),
467
578
  breaks: []
468
579
  });
469
580
  });
470
581
  };
471
- H(a), H(l);
472
- const V = (v) => {
473
- let M = 0;
474
- v.forEach((x, T) => {
475
- const C = p.get(x.key) ?? 0, L = P(x, T, M, C);
476
- M += C + xt;
477
- const W = x.tickCount ?? Math.max(2, Math.round(A / 80)), D = Kt(x, W), B = Ut(x, D, W), R = Xt(x, D, W), et = new _t(D, [w, w + A]), J = B.map((Y) => {
478
- const Ct = R(Y), yt = o(Ct, it).width, Ot = et.toPx(Y), ye = Ot - yt / 2, ge = Math.min(Math.max(ye, 0), Math.max(0, t - yt));
479
- return { value: Y, label: Ct, px: Ot, labelLeft: ge, labelWidth: yt };
582
+ T(a), T(l);
583
+ const H = (k) => {
584
+ let D = 0;
585
+ k.forEach((v, F) => {
586
+ const R = h.get(v.key) ?? 0, M = L(v, F, D, R);
587
+ D += R + Et;
588
+ const V = v.tickCount ?? Math.max(2, Math.round(w / 80)), E = Pt(v, V), z = le(v, E, V), B = ce(v, E, V), U = ue(v, E, V, z, B), _ = new te(E, [A, A + w]), nt = z.map((Y, We) => {
589
+ const Xt = U[We] ?? "", Tt = o(Xt, it).width, Zt = _.toPx(Y), Re = Le(Zt - Tt / 2, Tt, t);
590
+ return { value: Y, label: Xt, px: Zt, labelLeft: Re, labelWidth: Tt };
480
591
  });
481
- N.push({
482
- key: x.key,
483
- id: x.id,
592
+ S.push({
593
+ key: v.key,
594
+ id: v.id,
484
595
  orientation: "x",
485
- position: x.position,
486
- label: x.label,
487
- grid: x.grid,
488
- band: L,
489
- size: C,
490
- stack: T,
491
- domain: D,
492
- scale: et,
493
- ticks: J,
494
- format: R,
495
- titleSize: x.label === void 0 || x.label === "" ? 0 : Math.ceil(o(x.label, lt).height),
496
- breaks: x.calendar === void 0 || x.calendar.length === 0 ? [] : He(x.calendar, D[0], D[1]).map((Y) => et.toPx(Y))
596
+ position: v.position,
597
+ label: v.label,
598
+ grid: v.grid,
599
+ band: M,
600
+ size: R,
601
+ stack: F,
602
+ domain: E,
603
+ scale: _,
604
+ ticks: nt,
605
+ format: B,
606
+ titleSize: v.label === void 0 || v.label === "" ? 0 : Math.ceil(o(v.label, pt).height),
607
+ breaks: v.calendar === void 0 || v.calendar.length === 0 ? [] : rn(v.calendar, E[0], E[1]).map((Y) => _.toPx(Y))
497
608
  });
498
609
  });
499
610
  };
500
- return V(c), V(u), { width: t, height: e, plot: F, axes: N };
501
- }
502
- function Ge(n, t, e) {
503
- if (t <= 0 || !(e >= n[0])) return -1;
504
- let i = 0, r = t - 1;
505
- if (n[r] <= e) return r;
506
- for (; r - i > 1; ) {
507
- const o = i + r >> 1;
508
- n[o] <= e ? i = o : r = o;
509
- }
510
- return i;
511
- }
512
- function le(n, t, e, i) {
513
- return e + 1 < t ? n[e + 1] : i;
514
- }
515
- const ce = 0.28;
516
- function ot(n, t) {
517
- return Number.isFinite(n) ? n : t;
518
- }
519
- function ue(n) {
520
- return !Number.isFinite(n);
521
- }
522
- function Zt(n, t) {
523
- return n < t;
524
- }
525
- function qe(n, t, e, i) {
526
- const r = new Int32Array(e);
527
- for (let o = 0; o < e; o++) {
528
- const s = n[o], a = ot(t[o], i);
529
- if (!Zt(s, a)) continue;
530
- let l = 0;
531
- for (let c = 0; c < o; c++) {
532
- const u = n[c], h = ot(t[c], i);
533
- Zt(u, h) && s < h && u < a && l++;
534
- }
535
- r[o] = l;
536
- }
537
- return r;
611
+ return H(u), H(d), { width: t, height: e, plot: W, axes: S };
538
612
  }
539
- function Ke(n, t, e, i, r, o, s, a, l = null, c = 0) {
540
- const u = s / 2;
541
- for (let h = i - 1; h >= 0; h--) {
542
- const p = e[h] + (l === null ? 0 : l[h] * c);
543
- if (!(Math.abs(p - o) <= u)) continue;
544
- const d = n[h], m = ot(t[h], a);
545
- if (r >= d && r < m) return h;
613
+ function he(i, t, e) {
614
+ if (t <= 0 || !(e >= i[0])) return -1;
615
+ let n = 0, s = t - 1;
616
+ if (i[s] <= e) return s;
617
+ for (; s - n > 1; ) {
618
+ const o = n + s >> 1;
619
+ i[o] <= e ? n = o : s = o;
546
620
  }
547
- return -1;
621
+ return n;
548
622
  }
549
- function st(n) {
550
- return Math.round(n) + 0.5;
551
- }
552
- function Ue(n, t) {
553
- const { plot: e, axes: i, theme: r } = t, o = e.x, s = e.x + e.width, a = e.y, l = e.y + e.height;
554
- n.lineWidth = 1;
555
- for (const c of i)
556
- if (c.grid)
557
- for (const u of [0, 1]) {
558
- const h = u === 1;
559
- n.beginPath();
560
- let p = !1;
561
- for (const d of c.ticks)
562
- if ((c.orientation === "y" && d.value === 0) === h)
563
- if (p = !0, c.orientation === "y") {
564
- const y = st(d.px);
565
- n.moveTo(o, y), n.lineTo(s, y);
623
+ function Fe(i, t, e, n) {
624
+ return e + 1 < t ? i[e + 1] : n;
625
+ }
626
+ function bn(i, t, e, n, s) {
627
+ const o = i[t - 1], r = e > o ? e : n > 0 ? o + n : s;
628
+ return Math.min(r, s);
629
+ }
630
+ function vn(i, t) {
631
+ const e = [];
632
+ for (let n = 1; n < t; n++) {
633
+ const s = i[n] - i[n - 1];
634
+ s > 0 && e.push(s);
635
+ }
636
+ return e.length === 0 ? 0 : (e.sort((n, s) => n - s), e[e.length - 1 >> 1]);
637
+ }
638
+ function dt(i) {
639
+ return Math.round(i) + 0.5;
640
+ }
641
+ function Nn(i, t) {
642
+ const { plot: e, axes: n, theme: s } = t, o = e.x, r = e.x + e.width, a = e.y, l = e.y + e.height;
643
+ i.lineWidth = 1;
644
+ for (const u of n)
645
+ if (u.grid)
646
+ for (const d of [0, 1]) {
647
+ const f = d === 1;
648
+ i.beginPath();
649
+ let h = !1;
650
+ for (const m of u.ticks)
651
+ if ((u.orientation === "y" && m.value === 0) === f)
652
+ if (h = !0, u.orientation === "y") {
653
+ const p = dt(m.px);
654
+ i.moveTo(o, p), i.lineTo(r, p);
566
655
  } else {
567
- const y = st(d.px);
568
- n.moveTo(y, a), n.lineTo(y, l);
656
+ const p = dt(m.px);
657
+ i.moveTo(p, a), i.lineTo(p, l);
569
658
  }
570
- p && (n.strokeStyle = h ? r.colorAxis : r.colorGrid, n.stroke());
659
+ h && (i.strokeStyle = f ? s.colorAxis : s.colorGrid, i.stroke());
571
660
  }
572
661
  }
573
- function Xe(n, t) {
574
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = new Path2D();
575
- let u = !1;
576
- for (let h = 0; h < e; h++) {
577
- const p = l[h];
578
- if (Number.isNaN(p)) {
579
- u = !1;
662
+ const kn = 60;
663
+ function wn(i, t, e) {
664
+ return (e === 0 || Number.isNaN(i[e - 1])) && (e === t - 1 || Number.isNaN(i[e + 1]));
665
+ }
666
+ function In(i, t) {
667
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.step === !0, d = new Path2D();
668
+ let f = !1, h = 0;
669
+ for (let m = 0; m < e; m++) {
670
+ const c = l[m], p = a[m] * n + s;
671
+ if (Number.isNaN(c)) {
672
+ u && f && d.lineTo(p, h), f = !1;
580
673
  continue;
581
674
  }
582
- const d = a[h] * i + r, m = p * o + s;
583
- u ? c.lineTo(d, m) : (c.moveTo(d, m), u = !0);
584
- }
585
- if (n.strokeStyle = t.color, n.lineWidth = t.strokeWidth, t.dash !== void 0 && t.dash.length > 0 ? n.setLineDash(t.dash) : n.setLineDash([]), n.stroke(c), n.setLineDash([]), t.marker) {
586
- const h = t.strokeWidth + 1.5, p = new Path2D();
587
- for (let d = 0; d < e; d++) {
588
- const m = l[d];
589
- if (Number.isNaN(m)) continue;
590
- const y = a[d] * i + r, f = m * o + s;
591
- p.moveTo(y + h, f), p.arc(y, f, h, 0, Math.PI * 2);
675
+ const y = c * o + r;
676
+ f ? (u && d.lineTo(p, h), d.lineTo(p, y)) : (d.moveTo(p, y), f = !0), h = y;
677
+ }
678
+ if (i.strokeStyle = t.color, i.lineWidth = t.strokeWidth, t.dash !== void 0 && t.dash.length > 0 ? i.setLineDash(t.dash) : i.setLineDash([]), i.stroke(d), i.setLineDash([]), t.markers !== "never") {
679
+ const m = t.markers === "always" || e <= kn, c = t.strokeWidth + 1.5, p = new Path2D();
680
+ for (let y = 0; y < e; y++) {
681
+ const g = l[y];
682
+ if (Number.isNaN(g) || !m && !wn(l, e, y)) continue;
683
+ const b = a[y] * n + s, N = g * o + r;
684
+ p.moveTo(b + c, N), p.arc(b, N, c, 0, Math.PI * 2);
592
685
  }
593
- n.fillStyle = t.color, n.fill(p);
594
- }
595
- }
596
- function Ze(n, t) {
597
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.y0, u = t.baseline * o + s, h = new Path2D(), p = new Path2D();
598
- let d = 0;
599
- for (; d < e; ) {
600
- for (; d < e && (Number.isNaN(l[d]) || c !== null && Number.isNaN(c[d])); )
601
- d++;
602
- if (d >= e) break;
603
- const m = d;
604
- for (; d < e && !Number.isNaN(l[d]) && (c === null || !Number.isNaN(c[d])); )
605
- d++;
606
- const y = d - 1;
607
- for (let f = m; f <= y; f++) {
608
- const b = a[f] * i + r, k = l[f] * o + s;
609
- f === m ? (h.moveTo(b, k), p.moveTo(b, k)) : (h.lineTo(b, k), p.lineTo(b, k));
686
+ i.fillStyle = t.color, i.fill(p);
687
+ }
688
+ }
689
+ function Mn(i, t) {
690
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.y0, d = t.baseline * o + r, f = new Path2D(), h = new Path2D(), m = new Path2D();
691
+ let c = 0;
692
+ for (; c < e; ) {
693
+ for (; c < e && (Number.isNaN(l[c]) || u !== null && Number.isNaN(u[c])); )
694
+ c++;
695
+ if (c >= e) break;
696
+ const p = c;
697
+ for (; c < e && !Number.isNaN(l[c]) && (u === null || !Number.isNaN(u[c])); )
698
+ c++;
699
+ const y = c - 1;
700
+ if (p === y) {
701
+ const g = a[p] * n + s;
702
+ m.moveTo(g, u === null ? d : u[p] * o + r), m.lineTo(g, l[p] * o + r);
703
+ continue;
704
+ }
705
+ for (let g = p; g <= y; g++) {
706
+ const b = a[g] * n + s, N = l[g] * o + r;
707
+ g === p ? (f.moveTo(b, N), h.moveTo(b, N)) : (f.lineTo(b, N), h.lineTo(b, N));
610
708
  }
611
- if (c === null)
612
- h.lineTo(a[y] * i + r, u), h.lineTo(a[m] * i + r, u);
709
+ if (u === null)
710
+ f.lineTo(a[y] * n + s, d), f.lineTo(a[p] * n + s, d);
613
711
  else
614
- for (let f = y; f >= m; f--)
615
- h.lineTo(a[f] * i + r, c[f] * o + s);
616
- h.closePath();
712
+ for (let g = y; g >= p; g--)
713
+ f.lineTo(a[g] * n + s, u[g] * o + r);
714
+ f.closePath();
617
715
  }
618
- n.globalAlpha = t.alpha * t.fillOpacity, n.fillStyle = t.color, n.fill(h), t.strokeWidth > 0 && (n.globalAlpha = t.alpha, n.strokeStyle = t.color, n.lineWidth = t.strokeWidth, n.setLineDash([]), n.stroke(p));
716
+ i.globalAlpha = t.alpha * t.fillOpacity, i.fillStyle = t.color, i.fill(f), i.globalAlpha = t.alpha, i.strokeStyle = t.color, t.strokeWidth > 0 && (i.setLineDash(t.dash ?? []), i.lineWidth = t.strokeWidth, i.stroke(h)), i.setLineDash([]), i.lineWidth = Math.max(1, t.strokeWidth), i.stroke(m);
619
717
  }
620
- function je(n, t) {
621
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.baseline * o + s, u = t.offset * i, h = t.width * i, p = new Path2D();
622
- for (let d = 0; d < e; d++) {
623
- const m = l[d];
718
+ function An(i, t) {
719
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.baseline * o + r, d = t.offset * n, f = t.width * n, h = new Path2D();
720
+ for (let m = 0; m < e; m++) {
721
+ const c = l[m];
722
+ if (Number.isNaN(c)) continue;
723
+ const p = a[m] * n + s + d, y = c * o + r;
724
+ h.rect(p, y, f, u - y);
725
+ }
726
+ i.fillStyle = t.color, i.fill(h);
727
+ }
728
+ function Sn(i, t) {
729
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.radius, d = new Path2D();
730
+ for (let f = 0; f < e; f++) {
731
+ const h = l[f];
732
+ if (Number.isNaN(h)) continue;
733
+ const m = a[f] * n + s, c = h * o + r;
734
+ d.moveTo(m + u, c), d.arc(m, c, u, 0, Math.PI * 2);
735
+ }
736
+ i.fillStyle = t.color, i.fill(d);
737
+ }
738
+ function Tn(i, t) {
739
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.x, r = t.y, a = t.laneTop, l = t.laneBottom - t.laneTop, u = t.colors.length;
740
+ if (u === 0 || l <= 0) return;
741
+ const d = [];
742
+ for (let h = 0; h < u; h++) d.push(new Path2D());
743
+ let f = !1;
744
+ for (let h = 0; h < e; h++) {
745
+ const m = r[h];
624
746
  if (Number.isNaN(m)) continue;
625
- const y = a[d] * i + r + u, f = m * o + s;
626
- p.rect(y, f, h, c - f);
747
+ const c = m | 0, p = d[c];
748
+ if (p === void 0) continue;
749
+ const y = o[h], g = Fe(o, e, h, t.lastEnd);
750
+ g > y && (p.rect(y * n + s, a, (g - y) * n, l), f = !0);
751
+ }
752
+ if (f)
753
+ for (let h = 0; h < u; h++)
754
+ i.fillStyle = t.colors[h], i.fill(d[h]);
755
+ }
756
+ function Ln(i, t) {
757
+ const e = t.length, n = t.xScale.m, s = t.xScale.b, o = t.yScale.m, r = t.yScale.b, a = t.x, l = t.y, u = t.buckets, d = t.colors.length;
758
+ if (d === 0) return;
759
+ const f = t.width * n, h = Math.abs(t.height * o), m = [];
760
+ for (let c = 0; c < d; c++) m.push(new Path2D());
761
+ for (let c = 0; c < e; c++) {
762
+ const p = u[c];
763
+ if (p < 0) continue;
764
+ const y = m[p];
765
+ if (y === void 0) continue;
766
+ const g = a[c] * n + s - f / 2, b = l[c] * o + r - h / 2;
767
+ y.rect(g, b, f, h);
627
768
  }
628
- n.fillStyle = t.color, n.fill(p);
769
+ for (let c = 0; c < d; c++)
770
+ i.fillStyle = t.colors[c], i.fill(m[c]);
629
771
  }
630
- function Je(n, t) {
631
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.radius, u = new Path2D();
632
- for (let h = 0; h < e; h++) {
633
- const p = l[h];
634
- if (Number.isNaN(p)) continue;
635
- const d = a[h] * i + r, m = p * o + s;
636
- u.moveTo(d + c, m), u.arc(d, m, c, 0, Math.PI * 2);
637
- }
638
- n.fillStyle = t.color, n.fill(u);
639
- }
640
- function Qe(n, t) {
641
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.x, s = t.y, a = t.laneTop, l = t.laneBottom - t.laneTop, c = t.colors.length;
642
- if (c === 0 || l <= 0) return;
643
- const u = [];
644
- for (let p = 0; p < c; p++) u.push(new Path2D());
645
- let h = !1;
646
- for (let p = 0; p < e; p++) {
647
- const d = s[p];
648
- if (Number.isNaN(d)) continue;
649
- const m = d | 0, y = u[m];
650
- if (y === void 0) continue;
651
- const f = o[p], b = le(o, e, p, t.domainEnd);
652
- b > f && (y.rect(f * i + r, a, (b - f) * i, l), h = !0);
653
- }
654
- if (h)
655
- for (let p = 0; p < c; p++)
656
- n.fillStyle = t.colors[p], n.fill(u[p]);
657
- }
658
- function tn(n, t) {
659
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.buckets, u = t.colors.length;
660
- if (u === 0) return;
661
- const h = t.width * i, p = Math.abs(t.height * o), d = [];
662
- for (let m = 0; m < u; m++) d.push(new Path2D());
663
- for (let m = 0; m < e; m++) {
664
- const y = c[m];
665
- if (y < 0) continue;
666
- const f = d[y];
667
- if (f === void 0) continue;
668
- const b = a[m] * i + r - h / 2, k = l[m] * o + s - p / 2;
669
- f.rect(b, k, h, p);
670
- }
671
- for (let m = 0; m < u; m++)
672
- n.fillStyle = t.colors[m], n.fill(d[m]);
673
- }
674
- function en(n, t) {
675
- const e = t.length, i = t.xScale.m, r = t.xScale.b, o = t.yScale.m, s = t.yScale.b, a = t.x, l = t.y, c = t.x1, u = t.depth, h = Math.abs(t.height * o), p = h * ce, d = new Path2D(), m = new Path2D();
676
- for (let y = 0; y < e; y++) {
677
- const f = l[y];
678
- if (Number.isNaN(f)) continue;
679
- const b = a[y];
680
- if (Number.isNaN(b)) continue;
681
- const k = c[y], w = ot(k, t.domainEnd);
682
- if (!(w >= b)) continue;
683
- const I = b * i + r, A = Math.max(1, (w - b) * i), F = f * o + s + u[y] * p;
684
- (ue(k) ? m : d).rect(I, F - h / 2, A, h);
685
- }
686
- n.fillStyle = t.color, n.fill(d), n.save(), n.globalAlpha = n.globalAlpha * 0.45, n.fill(m), n.restore(), n.strokeStyle = t.color, n.lineWidth = 1, n.setLineDash([3, 2]), n.stroke(m), n.setLineDash([]);
687
- }
688
- function jt(n, t, e) {
689
- for (const i of e) {
690
- if (i.band) {
691
- const r = Math.min(i.fromPx, i.toPx), o = Math.max(i.fromPx, i.toPx);
692
- n.fillStyle = i.color, n.save(), n.globalAlpha = 0.12, i.orientation === "y" ? n.fillRect(t.x, r, t.width, o - r) : n.fillRect(r, t.y, o - r, t.height), n.restore();
772
+ function de(i, t, e) {
773
+ for (const n of e) {
774
+ if (n.band) {
775
+ const s = Math.min(n.fromPx, n.toPx), o = Math.max(n.fromPx, n.toPx);
776
+ i.fillStyle = n.color, i.save(), i.globalAlpha = 0.12, n.orientation === "y" ? i.fillRect(t.x, s, t.width, o - s) : i.fillRect(s, t.y, o - s, t.height), i.restore();
693
777
  continue;
694
778
  }
695
- if (n.beginPath(), i.orientation === "y") {
696
- const r = st(i.fromPx);
697
- n.moveTo(t.x, r), n.lineTo(t.x + t.width, r);
779
+ if (i.beginPath(), n.orientation === "y") {
780
+ const s = dt(n.fromPx);
781
+ i.moveTo(t.x, s), i.lineTo(t.x + t.width, s);
698
782
  } else {
699
- const r = st(i.fromPx);
700
- n.moveTo(r, t.y), n.lineTo(r, t.y + t.height);
783
+ const s = dt(n.fromPx);
784
+ i.moveTo(s, t.y), i.lineTo(s, t.y + t.height);
701
785
  }
702
- n.strokeStyle = i.color, n.lineWidth = 1, n.setLineDash(i.dash), n.stroke(), n.setLineDash([]);
786
+ i.strokeStyle = n.color, i.lineWidth = 1, i.setLineDash(n.dash), i.stroke(), i.setLineDash([]);
703
787
  }
704
788
  }
705
- function nn(n, t) {
706
- const { width: e, height: i, plot: r, series: o } = t;
707
- if (n.clearRect(0, 0, e, i), !(r.width <= 0 || r.height <= 0)) {
708
- Ue(n, t), n.save(), n.beginPath(), n.rect(r.x, r.y, r.width, r.height), n.clip(), n.lineJoin = "round", n.lineCap = "round", n.globalAlpha = 1, jt(n, r, t.limitBands);
709
- for (const s of o)
710
- if (s.length !== 0)
711
- switch (n.globalAlpha = s.alpha, s.kind) {
789
+ function Fn(i, t) {
790
+ const { width: e, height: n, plot: s, series: o } = t;
791
+ if (i.clearRect(0, 0, e, n), !(s.width <= 0 || s.height <= 0)) {
792
+ Nn(i, t), i.save(), i.beginPath(), i.rect(s.x, s.y, s.width, s.height), i.clip(), i.lineJoin = "round", i.lineCap = "round", i.globalAlpha = 1, de(i, s, t.limitBands);
793
+ for (const r of o)
794
+ if (r.length !== 0)
795
+ switch (i.globalAlpha = r.alpha, r.kind) {
712
796
  case "line":
713
- Xe(n, s);
797
+ In(i, r);
714
798
  break;
715
799
  case "area":
716
- Ze(n, s);
800
+ Mn(i, r);
717
801
  break;
718
802
  case "bar":
719
- je(n, s);
803
+ An(i, r);
720
804
  break;
721
805
  case "scatter":
722
- Je(n, s);
806
+ Sn(i, r);
723
807
  break;
724
808
  case "state":
725
- Qe(n, s);
809
+ Tn(i, r);
726
810
  break;
727
811
  case "matrix":
728
- tn(n, s);
729
- break;
730
- case "span":
731
- en(n, s);
812
+ Ln(i, r);
732
813
  break;
733
814
  }
734
- n.globalAlpha = 1, jt(n, r, t.limitLines), n.restore();
815
+ i.globalAlpha = 1, de(i, s, t.limitLines), i.restore();
735
816
  }
736
817
  }
737
- function rn(n, t) {
738
- const { width: e, height: i, plot: r, theme: o, hover: s } = t;
739
- if (n.clearRect(0, 0, e, i), s === null || r.width <= 0 || r.height <= 0) return;
740
- const a = st(s.hit.xPx);
741
- a >= r.x && a <= r.x + r.width && (n.beginPath(), n.moveTo(a, r.y), n.lineTo(a, r.y + r.height), n.lineWidth = 1, n.strokeStyle = o.colorAxis, n.setLineDash([]), n.stroke());
742
- for (const l of s.marker)
743
- n.beginPath(), n.arc(l.x, l.y, 5.5, 0, Math.PI * 2), n.fillStyle = o.colorBg, n.fill(), n.beginPath(), n.arc(l.x, l.y, 3.5, 0, Math.PI * 2), n.fillStyle = l.color, n.fill();
818
+ function Dn(i, t) {
819
+ const { width: e, height: n, plot: s, theme: o, hover: r } = t;
820
+ i.clearRect(0, 0, e, n);
821
+ const a = (r == null ? void 0 : r.hit.xPx) ?? t.syncPx;
822
+ if (a === null || s.width <= 0 || s.height <= 0) return;
823
+ const l = dt(a);
824
+ l >= s.x && l <= s.x + s.width && (i.beginPath(), i.moveTo(l, s.y), i.lineTo(l, s.y + s.height), i.lineWidth = 1, i.strokeStyle = o.colorAxis, i.setLineDash([]), i.stroke());
825
+ for (const u of (r == null ? void 0 : r.marker) ?? [])
826
+ u.x < s.x || u.x > s.x + s.width || u.y < s.y || u.y > s.y + s.height || (i.beginPath(), i.arc(u.x, u.y, 5.5, 0, Math.PI * 2), i.fillStyle = o.colorBg, i.fill(), i.beginPath(), i.arc(u.x, u.y, 3.5, 0, Math.PI * 2), i.fillStyle = u.color, i.fill());
744
827
  }
745
- function on(n, t, e) {
828
+ function De(i, t, e) {
746
829
  if (t <= 0) return -1;
747
830
  if (t === 1) return 0;
748
- let i = 0, r = t - 1;
749
- if (e <= n[i]) return i;
750
- if (e >= n[r]) return r;
751
- for (; r - i > 1; ) {
752
- const a = i + r >> 1;
753
- n[a] <= e ? i = a : r = a;
754
- }
755
- const o = e - n[i];
756
- return n[r] - e < o ? r : i;
831
+ let n = 0, s = t - 1;
832
+ if (e <= i[n]) return n;
833
+ if (e >= i[s]) return s;
834
+ for (; s - n > 1; ) {
835
+ const a = n + s >> 1;
836
+ i[a] <= e ? n = a : s = a;
837
+ }
838
+ const o = e - i[n];
839
+ return i[s] - e < o ? s : n;
840
+ }
841
+ function Gt(i, t, e) {
842
+ let n = 0, s = t;
843
+ for (; n < s; ) {
844
+ const o = n + s >> 1;
845
+ i[o] < e ? n = o + 1 : s = o;
846
+ }
847
+ return n;
848
+ }
849
+ function En(i, t, e, n, s, o, r) {
850
+ const a = De(i, e, n);
851
+ if (a < 0) return -1;
852
+ const l = o.toPx(n), u = r.toPx(s);
853
+ let d = -1, f = Number.POSITIVE_INFINITY;
854
+ for (let h = a; h >= 0; h--) {
855
+ const m = o.toPx(i[h]) - l;
856
+ if (m * m > f) break;
857
+ const c = t[h];
858
+ if (Number.isNaN(c)) continue;
859
+ const p = r.toPx(c) - u, y = m * m + p * p;
860
+ y < f && (f = y, d = h);
861
+ }
862
+ for (let h = a + 1; h < e; h++) {
863
+ const m = o.toPx(i[h]) - l;
864
+ if (m * m > f) break;
865
+ const c = t[h];
866
+ if (Number.isNaN(c)) continue;
867
+ const p = r.toPx(c) - u, y = m * m + p * p;
868
+ y < f && (f = y, d = h);
869
+ }
870
+ return d;
871
+ }
872
+ function Pn(i, t, e, n, s, o) {
873
+ const { x: r, y: a, y0: l, length: u } = i, d = Math.max(0, Gt(r, u, t) - 1), f = Math.min(u - 1, Gt(r, u, e));
874
+ if (f < d) return { x: r.subarray(0, 0), y: a.subarray(0, 0), y0: null, length: 0 };
875
+ if (f - d + 1 <= 2 * o)
876
+ return {
877
+ x: r.subarray(d, f + 1),
878
+ y: a.subarray(d, f + 1),
879
+ y0: l === null ? null : l.subarray(d, f + 1),
880
+ length: f - d + 1
881
+ };
882
+ const h = [], m = new Array(6);
883
+ let c = d;
884
+ for (; c <= f; ) {
885
+ const y = Math.floor(r[c] * n + s);
886
+ let g = -1, b = -1, N = -1, A = -1, $ = -1, w = -1;
887
+ for (; c <= f && Math.floor(r[c] * n + s) === y; c++) {
888
+ const L = a[c];
889
+ if (Number.isNaN(L) || l !== null && Number.isNaN(l[c])) {
890
+ $ < 0 && ($ = c), w < 0 && (w = c);
891
+ continue;
892
+ }
893
+ w = -1, g < 0 && (g = c), b = c, (N < 0 || L < a[N]) && (N = c), (A < 0 || L > a[A]) && (A = c);
894
+ }
895
+ m[0] = g, m[1] = N, m[2] = A, m[3] = b, m[4] = $, m[5] = w, m.sort((L, S) => L - S);
896
+ let W = -1;
897
+ for (const L of m)
898
+ L < 0 || L === W || (h.push(L), W = L);
899
+ }
900
+ const p = {
901
+ x: new Float64Array(h.length),
902
+ y: new Float64Array(h.length),
903
+ y0: l === null ? null : new Float64Array(h.length),
904
+ length: h.length
905
+ };
906
+ return h.forEach((y, g) => {
907
+ p.x[g] = r[y], p.y[g] = a[y], p.y0 !== null && (p.y0[g] = l[y]);
908
+ }), p;
757
909
  }
758
- function Jt(n, t) {
910
+ function fe(i, t) {
759
911
  if (t < 2) return 0;
760
- const e = n.slice(0, t).sort();
761
- let i = Number.POSITIVE_INFINITY;
762
- for (let r = 1; r < t; r++) {
763
- const o = e[r] - e[r - 1];
764
- o > 0 && o < i && (i = o);
765
- }
766
- return Number.isFinite(i) ? i : 0;
767
- }
768
- function ct(n, t) {
769
- return n > 0 ? n : t;
770
- }
771
- function sn(n, t, e, i, r, o, s) {
772
- const a = o / 2, l = s / 2;
773
- for (let c = 0; c < e; c++) {
774
- const u = i - n[c];
775
- if (!(u >= -a && u < a)) continue;
776
- const h = r - t[c];
777
- if (h >= -l && h < l)
778
- return c;
912
+ const e = i.slice(0, t).sort();
913
+ let n = Number.POSITIVE_INFINITY;
914
+ for (let s = 1; s < t; s++) {
915
+ const o = e[s] - e[s - 1];
916
+ o > 0 && o < n && (n = o);
917
+ }
918
+ return Number.isFinite(n) ? n : 0;
919
+ }
920
+ function yt(i, t) {
921
+ return i > 0 ? i : t;
922
+ }
923
+ function Cn(i, t, e, n, s, o, r) {
924
+ const a = o / 2, l = r / 2;
925
+ for (let u = 0; u < e; u++) {
926
+ const d = n - i[u];
927
+ if (!(d >= -a && d < a)) continue;
928
+ const f = s - t[u];
929
+ if (f >= -l && f < l)
930
+ return u;
779
931
  }
780
932
  return -1;
781
933
  }
782
- const an = {
934
+ const $n = {
783
935
  ok: 0,
784
936
  unknown: 1,
785
937
  warning: 2,
786
938
  alarm: 3
787
939
  };
788
- function Qn(n) {
789
- return an[n];
940
+ function Fi(i) {
941
+ return $n[i];
790
942
  }
791
- const Qt = { warning: 2, alarm: 3 };
792
- function ln(n, t = {}) {
793
- if (n == null || !Number.isFinite(n))
943
+ const me = { warning: 2, alarm: 3 };
944
+ function On(i, t = {}) {
945
+ if (i == null || !Number.isFinite(i))
794
946
  return { verdict: "unknown" };
795
- const e = t.target, i = e !== void 0 && Number.isFinite(e) ? n - e : void 0;
796
- let r, o = 0;
947
+ const e = t.target, n = e !== void 0 && Number.isFinite(e) ? i - e : void 0;
948
+ let s, o = 0;
797
949
  for (const a of t.limits ?? []) {
798
- const l = a.side === "upper" ? n - a.value : a.value - n;
799
- l > 0 && (r === void 0 || Qt[a.severity] > Qt[r.severity] || a.severity === r.severity && l > o) && (r = a, o = l);
800
- }
801
- if (r === void 0)
802
- return i === void 0 ? { verdict: "ok" } : { verdict: "ok", deviation: i };
803
- const s = {
804
- verdict: r.severity,
805
- limit: r,
950
+ const l = a.side === "upper" ? i - a.value : a.value - i;
951
+ l > 0 && (s === void 0 || me[a.severity] > me[s.severity] || a.severity === s.severity && l > o) && (s = a, o = l);
952
+ }
953
+ if (s === void 0)
954
+ return n === void 0 ? { verdict: "ok" } : { verdict: "ok", deviation: n };
955
+ const r = {
956
+ verdict: s.severity,
957
+ limit: s,
806
958
  excess: o
807
959
  };
808
- return i === void 0 ? s : { ...s, deviation: i };
809
- }
810
- function cn(n, t, e, i, r) {
811
- const o = n.length, s = new Float64Array(o), a = new Float64Array(o), l = typeof i == "function" ? i : null, c = l === null ? null : new Float64Array(o), u = (r == null ? void 0 : r.value) ?? null, h = u === null ? null : new Float64Array(o), p = (r == null ? void 0 : r.xEnd) ?? null, d = p === null ? null : new Float64Array(o), m = (r == null ? void 0 : r.xMap) ?? null, y = (r == null ? void 0 : r.xGap) ?? null;
812
- let f = Number.POSITIVE_INFINITY, b = Number.NEGATIVE_INFINITY, k = Number.POSITIVE_INFINITY, w = Number.NEGATIVE_INFINITY;
813
- typeof i == "number" && o > 0 && (k = i, w = i);
814
- for (let I = 0; I < o; I++) {
815
- const A = n[I], F = t(A, I), P = m === null ? F : m(F);
816
- s[I] = P;
817
- const N = y !== null && y(F);
818
- if (N || (P < f && (f = P), P > b && (b = P)), p !== null) {
819
- const v = p(A, I), M = v ?? Number.NaN, x = !Number.isFinite(M) || m === null ? M : m(M);
820
- d[I] = x, Number.isFinite(x) && (x < f && (f = x), x > b && (b = x));
821
- }
822
- const H = N ? null : e(A, I), V = H ?? Number.NaN;
823
- if (a[I] = V, V < k && (k = V), V > w && (w = V), u !== null) {
824
- const v = N ? null : u(A, I);
825
- h[I] = v ?? Number.NaN;
826
- }
827
- if (l !== null) {
828
- const v = N ? null : l(A, I), M = v ?? Number.NaN;
829
- c[I] = M, M < k && (k = M), M > w && (w = M);
960
+ return n === void 0 ? r : { ...r, deviation: n };
961
+ }
962
+ function Ct(i) {
963
+ return i == null || !Number.isFinite(i) ? Number.NaN : i;
964
+ }
965
+ function Wn(i, t, e, n, s) {
966
+ const o = i.length, r = new Float64Array(o), a = new Float64Array(o), l = typeof n == "function" ? n : null, u = l === null ? null : new Float64Array(o), d = (s == null ? void 0 : s.value) ?? null, f = d === null ? null : new Float64Array(o), h = (s == null ? void 0 : s.xMap) ?? null, m = (s == null ? void 0 : s.xGap) ?? null;
967
+ let c = Number.POSITIVE_INFINITY, p = Number.NEGATIVE_INFINITY, y = Number.POSITIVE_INFINITY, g = Number.NEGATIVE_INFINITY;
968
+ typeof n == "number" && o > 0 && (y = n, g = n);
969
+ for (let b = 0; b < o; b++) {
970
+ const N = i[b], A = t(N, b), $ = !Number.isFinite(A), w = $ ? b > 0 ? r[b - 1] : Number.NEGATIVE_INFINITY : h === null ? A : h(A);
971
+ r[b] = w;
972
+ const W = $ || m !== null && m(A);
973
+ W || (w < c && (c = w), w > p && (p = w));
974
+ const L = W ? Number.NaN : Ct(e(N, b));
975
+ if (a[b] = L, L < y && (y = L), L > g && (g = L), d !== null && (f[b] = W ? Number.NaN : Ct(d(N, b))), l !== null) {
976
+ const S = W ? Number.NaN : Ct(l(N, b));
977
+ u[b] = S, S < y && (y = S), S > g && (g = S);
830
978
  }
831
979
  }
832
- return { series: { x: s, y: a, y0: c, w: h, x1: d, length: o }, extent: { xMin: f, xMax: b, yMin: k, yMax: w } };
980
+ return { series: { x: r, y: a, y0: u, w: f, length: o }, extent: { xMin: c, xMax: p, yMin: y, yMax: g } };
833
981
  }
834
- function un(n, t) {
982
+ function Rn(i, t) {
835
983
  for (let e = 1; e < t; e++)
836
- if (n[e] < n[e - 1]) return e;
984
+ if (i[e] < i[e - 1]) return e;
837
985
  return -1;
838
986
  }
839
- function hn(n, t, e, i) {
840
- let r = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY;
841
- for (const s of e) {
842
- const a = s.extent;
843
- if (a === null || !(n === "x" ? s.xAxisId === t : s.yAxisId === t)) continue;
844
- const c = n === "x" ? a.xMin : a.yMin, u = n === "x" ? a.xMax : a.yMax;
845
- c < r && (r = c), u > o && (o = u);
987
+ function Hn(i, t, e) {
988
+ const { x: n, y: s, y0: o, length: r } = i;
989
+ let a = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY;
990
+ for (let u = Gt(n, r, t); u < r && n[u] <= e; u++) {
991
+ const d = s[u];
992
+ if (d < a && (a = d), d > l && (l = d), o !== null) {
993
+ const f = o[u];
994
+ f < a && (a = f), f > l && (l = f);
995
+ }
996
+ }
997
+ return [a, l];
998
+ }
999
+ function Vn(i, t, e, n) {
1000
+ let s = Number.POSITIVE_INFINITY, o = Number.NEGATIVE_INFINITY;
1001
+ for (const r of e) {
1002
+ const a = r.extent;
1003
+ if (a === null || !(i === "x" ? r.xAxisId === t : r.yAxisId === t)) continue;
1004
+ const u = i === "x" ? a.xMin : a.yMin, d = i === "x" ? a.xMax : a.yMax;
1005
+ u < s && (s = u), d > o && (o = d);
846
1006
  }
847
- if (i !== void 0)
848
- for (const s of i)
849
- Number.isFinite(s) && (s < r && (r = s), s > o && (o = s));
850
- return !Number.isFinite(r) || !Number.isFinite(o) ? [0, 1] : [r, o];
1007
+ if (n !== void 0)
1008
+ for (const r of n)
1009
+ Number.isFinite(r) && (r < s && (s = r), r > o && (o = r));
1010
+ return !Number.isFinite(s) || !Number.isFinite(o) ? [0, 1] : [s, o];
851
1011
  }
852
- function dn(n, t) {
1012
+ function _n(i, t) {
853
1013
  let e = Number.POSITIVE_INFINITY;
854
- for (let i = 1; i < t; i++) {
855
- const r = n[i] - n[i - 1];
856
- r > 0 && r < e && (e = r);
1014
+ for (let n = 1; n < t; n++) {
1015
+ const s = i[n] - i[n - 1];
1016
+ s > 0 && s < e && (e = s);
857
1017
  }
858
1018
  return Number.isFinite(e) ? e : 0;
859
1019
  }
860
- function fn(n, t) {
861
- return n > 0 ? n : t;
1020
+ function Yn(i, t) {
1021
+ return i > 0 ? i : t;
862
1022
  }
863
- function mn(n, t, e, i) {
864
- const r = n * t, o = r / i;
865
- return { offset: -r / 2 + e * o, width: o };
1023
+ function zn(i, t, e, n) {
1024
+ const s = i * t, o = s / n;
1025
+ return { offset: -s / 2 + e * o, width: o };
866
1026
  }
867
- function pn(n) {
1027
+ function Bn(i) {
868
1028
  const t = /* @__PURE__ */ new Map();
869
- for (const i of n) {
870
- if (i.kind !== "bar") continue;
871
- const r = t.get(i.xAxisId);
872
- r === void 0 ? t.set(i.xAxisId, [i]) : r.push(i);
1029
+ for (const n of i) {
1030
+ if (n.kind !== "bar") continue;
1031
+ const s = t.get(n.xAxisId);
1032
+ s === void 0 ? t.set(n.xAxisId, [n]) : s.push(n);
873
1033
  }
874
1034
  const e = /* @__PURE__ */ new Map();
875
- for (const i of t.values()) {
876
- let r = Number.POSITIVE_INFINITY;
877
- for (const a of i)
878
- a.step > 0 && a.step < r && (r = a.step);
879
- const o = Number.isFinite(r) ? r : 0, s = i[0].fraction;
880
- i.forEach((a, l) => {
1035
+ for (const n of t.values()) {
1036
+ let s = Number.POSITIVE_INFINITY;
1037
+ for (const a of n)
1038
+ a.step > 0 && a.step < s && (s = a.step);
1039
+ const o = Number.isFinite(s) ? s : 0, r = n[0].fraction;
1040
+ n.forEach((a, l) => {
881
1041
  e.set(a.order, {
882
1042
  index: l,
883
- size: i.length,
1043
+ size: n.length,
884
1044
  step: o,
885
- fraction: s
1045
+ fraction: r
886
1046
  });
887
1047
  });
888
1048
  }
889
1049
  return e;
890
1050
  }
891
- const te = {
1051
+ const pe = {
892
1052
  version: 0,
893
- layout: ae,
1053
+ layout: Se,
894
1054
  legend: null,
895
1055
  series: [],
896
- limits: []
897
- }, ee = {
1056
+ limits: [],
1057
+ // Unknown before the first frame: saying "No data" there would flash.
1058
+ empty: !1
1059
+ }, ye = {
898
1060
  version: 0,
899
1061
  hover: null,
900
1062
  tooltip: null,
901
- xLabel: ""
902
- }, yn = 4, gn = 60;
903
- let vt = 0;
904
- const bn = new Float64Array(0), xn = new Int32Array(0);
905
- function z(n, t) {
906
- return n === t ? !0 : typeof n != "function" || typeof t != "function" ? !1 : String(n) === String(t);
907
- }
908
- function ft(n, t) {
909
- if (n === t) return !0;
910
- if (n === void 0 || t === void 0 || n.length !== t.length) return !1;
911
- for (let e = 0; e < n.length; e++) if (n[e] !== t[e]) return !1;
1063
+ xLabel: "",
1064
+ rows: []
1065
+ }, Gn = 4, ge = 12;
1066
+ let $t = 0;
1067
+ const lt = /* @__PURE__ */ new Map();
1068
+ function X(i, t) {
1069
+ if (i === t) return !0;
1070
+ if (typeof i != "function" || typeof t != "function") return !1;
1071
+ const e = String(i);
1072
+ return e.includes("[native code]") ? !1 : e === String(t);
1073
+ }
1074
+ function qn(i, t) {
1075
+ var e, n, s, o;
1076
+ if (i === t) return !0;
1077
+ if (i === void 0 || t === void 0 || i.length !== t.length) return !1;
1078
+ for (let r = 0; r < i.length; r++)
1079
+ if (((e = i[r]) == null ? void 0 : e.from) !== ((n = t[r]) == null ? void 0 : n.from) || ((s = i[r]) == null ? void 0 : s.to) !== ((o = t[r]) == null ? void 0 : o.to)) return !1;
912
1080
  return !0;
913
1081
  }
914
- function vn(n, t) {
915
- return n.kind === t.kind && z(n.accessor, t.accessor) && n.data === t.data && z(Pt(n), Pt(t)) && z(At(n), At(t)) && z(Ft(n), Ft(t)) && // The height of a span widens its y extent, and the extent is made here.
916
- ne(n) === ne(t);
1082
+ function gt(i) {
1083
+ return i.kind !== "state" && i.kind !== "matrix";
917
1084
  }
918
- function ne(n) {
919
- return n.kind === "span" ? n.height : void 0;
1085
+ function Kn(i) {
1086
+ const t = i.entry.materialized;
1087
+ if (t === null) return !1;
1088
+ const e = t.x[i.index], n = (s) => s > 0 && s < q;
1089
+ return i.index > 0 && n(e - t.x[i.index - 1]) || i.index + 1 < t.length && n(t.x[i.index + 1] - e);
1090
+ }
1091
+ function ft(i, t) {
1092
+ if (i === t) return !0;
1093
+ if (i === void 0 || t === void 0 || i.length !== t.length) return !1;
1094
+ for (let e = 0; e < i.length; e++) if (i[e] !== t[e]) return !1;
1095
+ return !0;
920
1096
  }
921
- function At(n) {
922
- return n.kind === "matrix" ? n.value : void 0;
1097
+ function Un(i, t) {
1098
+ return i.kind === t.kind && X(i.accessor, t.accessor) && i.data === t.data && X(Mt(i), Mt(t)) && X(qt(i), qt(t));
923
1099
  }
924
- function Ft(n) {
925
- return n.kind === "span" ? n.to : void 0;
1100
+ function qt(i) {
1101
+ return i.kind === "matrix" ? i.value : void 0;
926
1102
  }
927
- function Pt(n) {
928
- switch (n.kind) {
1103
+ function Mt(i) {
1104
+ switch (i.kind) {
929
1105
  case "line":
930
1106
  case "scatter":
931
1107
  return;
932
1108
  case "area":
933
- return n.baseline ?? 0;
1109
+ return i.baseline ?? 0;
934
1110
  case "bar":
935
1111
  return 0;
936
1112
  case "state":
937
1113
  case "matrix":
938
- case "span":
939
1114
  return;
940
1115
  }
941
1116
  }
942
- function kn(n, t) {
943
- if (n.kind !== t.kind) return !1;
1117
+ function Xn(i, t) {
1118
+ if (i.kind !== t.kind) return !1;
944
1119
  switch (t.kind) {
945
1120
  case "line": {
946
- const e = n;
947
- return e.strokeWidth === t.strokeWidth && e.markers === t.markers && ft(e.dash, t.dash);
1121
+ const e = i;
1122
+ return e.strokeWidth === t.strokeWidth && e.markers === t.markers && e.step === t.step && ft(e.dash, t.dash);
948
1123
  }
949
1124
  case "area": {
950
- const e = n;
951
- return z(e.baseline, t.baseline) && e.fillOpacity === t.fillOpacity && e.strokeWidth === t.strokeWidth;
1125
+ const e = i;
1126
+ return X(e.baseline, t.baseline) && e.fillOpacity === t.fillOpacity && e.strokeWidth === t.strokeWidth && ft(e.dash, t.dash);
952
1127
  }
953
1128
  case "bar":
954
- return n.barWidth === t.barWidth;
1129
+ return i.barWidth === t.barWidth;
955
1130
  case "scatter":
956
- return n.radius === t.radius;
1131
+ return i.radius === t.radius;
957
1132
  case "state": {
958
- const e = n;
959
- return e.laneFrom === t.laneFrom && e.laneTo === t.laneTo && Nn(e.states, t.states);
1133
+ const e = i;
1134
+ return e.laneFrom === t.laneFrom && e.laneTo === t.laneTo && Zn(e.states, t.states);
960
1135
  }
961
1136
  case "matrix":
962
- return wn(n.coloring, t.coloring);
963
- case "span":
964
- return n.height === t.height;
1137
+ return Jn(i.coloring, t.coloring);
965
1138
  }
966
1139
  }
967
- function Nn(n, t) {
968
- var e, i, r, o;
969
- if (n === t) return !0;
970
- if (n.length !== t.length) return !1;
971
- for (let s = 0; s < n.length; s++)
972
- if (((e = n[s]) == null ? void 0 : e.label) !== ((i = t[s]) == null ? void 0 : i.label) || ((r = n[s]) == null ? void 0 : r.color) !== ((o = t[s]) == null ? void 0 : o.color)) return !1;
1140
+ function Zn(i, t) {
1141
+ var e, n, s, o;
1142
+ if (i === t) return !0;
1143
+ if (i.length !== t.length) return !1;
1144
+ for (let r = 0; r < i.length; r++)
1145
+ if (((e = i[r]) == null ? void 0 : e.label) !== ((n = t[r]) == null ? void 0 : n.label) || ((s = i[r]) == null ? void 0 : s.color) !== ((o = t[r]) == null ? void 0 : o.color)) return !1;
973
1146
  return !0;
974
1147
  }
975
- function wn(n, t) {
976
- return n === t ? !0 : n.kind !== t.kind ? !1 : n.kind === "assessment" && t.kind === "assessment" ? n.limits === t.limits : n.kind === "gradient" && t.kind === "gradient" ? ft(n.stops, t.stops) && ft(n.range, t.range) : !1;
1148
+ function Jn(i, t) {
1149
+ return i === t ? !0 : i.kind !== t.kind ? !1 : i.kind === "assessment" && t.kind === "assessment" ? i.limits === t.limits : i.kind === "gradient" && t.kind === "gradient" ? ft(i.stops, t.stops) && ft(i.range, t.range) : !1;
977
1150
  }
978
- function In(n, t) {
979
- return n.kind === "assessment" ? [t.colorOk, t.colorWarning, t.colorAlarm] : n.stops;
1151
+ function Ot(i, t) {
1152
+ return i.kind === "assessment" ? [t.colorOk, t.colorWarning, t.colorAlarm] : i.stops;
980
1153
  }
981
- function Sn(n, t, e) {
982
- var c, u;
983
- const i = n.length, r = new Int32Array(i), o = n.w;
984
- if (o === null || e === 0)
985
- return r.fill(-1), r;
986
- if (t.kind === "assessment") {
987
- for (let h = 0; h < i; h++) {
988
- const p = ln(o[h], t.limits);
989
- r[h] = p.verdict === "alarm" ? 2 : p.verdict === "warning" ? 1 : p.verdict === "ok" ? 0 : -1;
990
- }
991
- return r;
992
- }
993
- let s = (c = t.range) == null ? void 0 : c[0], a = (u = t.range) == null ? void 0 : u[1];
994
- if (s === void 0 || a === void 0) {
995
- s = Number.POSITIVE_INFINITY, a = Number.NEGATIVE_INFINITY;
996
- for (let h = 0; h < i; h++) {
997
- const p = o[h];
998
- Number.isFinite(p) && (p < s && (s = p), p > a && (a = p));
1154
+ function Qn(i) {
1155
+ const t = 100 / Math.max(1, i.length);
1156
+ return `linear-gradient(to right, ${i.map((n, s) => `${n} ${s * t}% ${(s + 1) * t}%`).join(", ")})`;
1157
+ }
1158
+ function jn(i, t, e) {
1159
+ let n = e == null ? void 0 : e[0], s = e == null ? void 0 : e[1];
1160
+ if (n === void 0 || s === void 0) {
1161
+ n = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
1162
+ for (let o = 0; o < t; o++) {
1163
+ const r = i[o];
1164
+ Number.isFinite(r) && (r < n && (n = r), r > s && (s = r));
999
1165
  }
1000
1166
  }
1001
- const l = a - s;
1002
- for (let h = 0; h < i; h++) {
1003
- const p = o[h];
1004
- if (!Number.isFinite(p)) {
1005
- r[h] = -1;
1006
- continue;
1007
- }
1008
- const d = l > 0 ? (p - s) / l : 0.5, m = Math.floor(d * e);
1009
- r[h] = m < 0 ? 0 : m >= e ? e - 1 : m;
1167
+ return [n, s];
1168
+ }
1169
+ function ti(i, t, e, n, s) {
1170
+ if (t.kind === "assessment") {
1171
+ const l = On(i, t.limits);
1172
+ return l.verdict === "alarm" ? 2 : l.verdict === "warning" ? 1 : l.verdict === "ok" ? 0 : -1;
1010
1173
  }
1011
- return r;
1174
+ if (!Number.isFinite(i)) return -1;
1175
+ const o = s - n, r = o > 0 ? (i - n) / o : 0.5, a = Math.floor(r * e);
1176
+ return a < 0 ? 0 : a >= e ? e - 1 : a;
1012
1177
  }
1013
- function Mn(n, t) {
1014
- return n === t ? !0 : Array.isArray(n) && Array.isArray(t) ? n[0] === t[0] && n[1] === t[1] : !1;
1178
+ function xe(i, t, e) {
1179
+ const n = i.length, s = new Int32Array(n), o = i.w;
1180
+ if (o === null || e === 0)
1181
+ return s.fill(-1), s;
1182
+ const [r, a] = t.kind === "gradient" ? jn(o, n, t.range) : [0, 0];
1183
+ for (let l = 0; l < n; l++) s[l] = ti(o[l], t, e, r, a);
1184
+ return s;
1185
+ }
1186
+ function ei(i, t) {
1187
+ return i === t ? !0 : Array.isArray(i) && Array.isArray(t) ? i[0] === t[0] && i[1] === t[1] : !1;
1015
1188
  }
1016
- class he {
1189
+ class Ee {
1017
1190
  constructor() {
1018
1191
  /* ---------- Registration ---------- */
1019
- g(this, "series", /* @__PURE__ */ new Map());
1020
- g(this, "axes", /* @__PURE__ */ new Map());
1021
- g(this, "legend", null);
1022
- g(this, "tooltip", null);
1023
- g(this, "limits", /* @__PURE__ */ new Map());
1192
+ x(this, "series", /* @__PURE__ */ new Map());
1193
+ x(this, "axes", /* @__PURE__ */ new Map());
1194
+ x(this, "legend", null);
1195
+ x(this, "tooltip", null);
1196
+ x(this, "limits", /* @__PURE__ */ new Map());
1024
1197
  /* ---------- Data and layout inputs ---------- */
1025
- g(this, "data", []);
1026
- g(this, "padding", { top: 8, right: 8, bottom: 8, left: 8 });
1198
+ x(this, "data", []);
1199
+ x(this, "padding", { top: 8, right: 8, bottom: 8, left: 8 });
1027
1200
  /* ---------- DOM binding ---------- */
1028
- g(this, "container", null);
1029
- g(this, "seriesCanvas", null);
1030
- g(this, "overlayCanvas", null);
1031
- g(this, "seriesCtx", null);
1032
- g(this, "overlayCtx", null);
1033
- g(this, "tooltipEl", null);
1034
- g(this, "measurer", null);
1201
+ x(this, "container", null);
1202
+ x(this, "seriesCanvas", null);
1203
+ x(this, "overlayCanvas", null);
1204
+ x(this, "seriesCtx", null);
1205
+ x(this, "overlayCtx", null);
1206
+ x(this, "tooltipEl", null);
1207
+ x(this, "measurer", null);
1035
1208
  /* ---------- Size and DPR ---------- */
1036
- g(this, "cssWidth", 0);
1037
- g(this, "cssHeight", 0);
1038
- g(this, "pendingWidth", null);
1039
- g(this, "pendingHeight", null);
1040
- g(this, "dpr", 1);
1041
- g(this, "dprMedia", null);
1042
- g(this, "onDprChange", () => {
1209
+ x(this, "cssWidth", 0);
1210
+ x(this, "cssHeight", 0);
1211
+ x(this, "pendingWidth", null);
1212
+ x(this, "pendingHeight", null);
1213
+ x(this, "dpr", 1);
1214
+ x(this, "dprMedia", null);
1215
+ x(this, "onDprChange", () => {
1043
1216
  this.rebindDprWatch(), this.pendingWidth = this.cssWidth, this.pendingHeight = this.cssHeight, this.markLayoutDirty();
1044
1217
  });
1045
1218
  /* ---------- Scheduling ---------- */
1046
- g(this, "seriesDirty", !1);
1047
- g(this, "overlayDirty", !1);
1048
- g(this, "layoutDirty", !0);
1049
- g(this, "materialsDirty", !1);
1050
- g(this, "frameHandle", null);
1219
+ x(this, "seriesDirty", !1);
1220
+ x(this, "overlayDirty", !1);
1221
+ x(this, "layoutDirty", !0);
1222
+ x(this, "materialsDirty", !1);
1223
+ x(this, "frameHandle", null);
1051
1224
  /* ---------- Theme ---------- */
1052
- g(this, "theme", null);
1053
- g(this, "unsubscribeTheme", null);
1225
+ x(this, "theme", null);
1226
+ x(this, "unsubscribeTheme", null);
1227
+ /** A caller's colours - `color`, a state's, a gradient stop - resolved
1228
+ through the theme's probe, once per colour and theme: a canvas ignores a
1229
+ `var(--…)` or a `light-dark(…)` and keeps the previous fillStyle. */
1230
+ x(this, "painted", /* @__PURE__ */ new Map());
1054
1231
  /* ---------- Layout and interaction ---------- */
1055
- g(this, "layout", ae);
1056
- g(this, "hysteresis", /* @__PURE__ */ new Map());
1057
- g(this, "hover", null);
1058
- g(this, "hoverKey", "");
1059
- g(this, "hoverXLabel", "");
1060
- g(this, "highlight", null);
1232
+ x(this, "layout", Se);
1233
+ x(this, "hysteresis", /* @__PURE__ */ new Map());
1234
+ x(this, "hover", null);
1235
+ x(this, "hoverKey", "");
1236
+ x(this, "hoverXLabel", "");
1237
+ x(this, "hoverRows", []);
1238
+ x(this, "highlight", null);
1061
1239
  /* ---------- Snapshots for the HTML layer ---------- */
1062
- g(this, "layoutSnapshot", te);
1063
- g(this, "hoverSnapshot", ee);
1064
- g(this, "layoutSubscribers", /* @__PURE__ */ new Set());
1065
- g(this, "hoverSubscribers", /* @__PURE__ */ new Set());
1240
+ x(this, "layoutSnapshot", pe);
1241
+ x(this, "hoverSnapshot", ye);
1242
+ x(this, "layoutSubscribers", /* @__PURE__ */ new Set());
1243
+ x(this, "hoverSubscribers", /* @__PURE__ */ new Set());
1066
1244
  /* ---------- Instrumentation (R-5.1) ---------- */
1067
- g(this, "perf", { materializeMs: 0, seriesDrawMs: 0, points: 0 });
1245
+ x(this, "perf", { materializeMs: 0, seriesDrawMs: 0, points: 0 });
1068
1246
  /* The palette follows the name (library-audit 05). The table only grows: a name
1069
1247
  that goes away keeps its place, so that it finds it again on its return and
1070
1248
  no other name gets it in the meantime. */
1071
- g(this, "slotsByName", /* @__PURE__ */ new Map());
1072
- g(this, "nextSlot", 0);
1073
- g(this, "onPerf", null);
1074
- /* ================= Materialisation (R-2.6, R-2.7) ================= */
1075
- g(this, "sortednessChecked", !1);
1076
- g(this, "onFontsLoaded", () => {
1249
+ x(this, "slotsByName", /* @__PURE__ */ new Map());
1250
+ x(this, "nextSlot", 0);
1251
+ x(this, "onPerf", null);
1252
+ x(this, "onFontsLoaded", () => {
1077
1253
  var t;
1078
1254
  (t = this.measurer) == null || t.clear(), this.markLayoutDirty();
1079
1255
  });
1080
- g(this, "themeRoot", null);
1081
- g(this, "subscribeLayout", (t) => (this.layoutSubscribers.add(t), () => {
1256
+ x(this, "themeRoot", null);
1257
+ /* ---------- Cursor sync (charts-long-series 04) ----------
1258
+
1259
+ Only the x position travels, in domain units: each chart draws its own
1260
+ crosshair there, on its x axis of the same id - or its first -, and the
1261
+ tooltip stays with the chart under the pointer. Zoom is not shared; the
1262
+ caller gives every chart the same controlled domain. */
1263
+ x(this, "syncId", null);
1264
+ /** Where another chart's pointer stands; null while none does. */
1265
+ x(this, "synced", null);
1266
+ x(this, "sent", null);
1267
+ /* ---------- Zoom and pan (charts-long-series 01) ----------
1268
+
1269
+ The schedule's model, not its code: Ctrl or ⌘ with the wheel zooms - a
1270
+ trackpad pinch arrives as exactly that -, a horizontal wheel or Shift pans,
1271
+ the plain wheel is the page's. A drag pans, two fingers pinch, a double
1272
+ click asks for everything. Nothing here changes a domain: each gesture
1273
+ proposes one to the axis' handler, and the caller passes it back. */
1274
+ /** What was last proposed per axis, until a layout has taken the answer: a
1275
+ second wheel step in the same frame builds on the first, not on the
1276
+ domain still drawn. */
1277
+ x(this, "proposed", /* @__PURE__ */ new Map());
1278
+ x(this, "pointers", /* @__PURE__ */ new Map());
1279
+ x(this, "pinch", 0);
1280
+ x(this, "subscribeLayout", (t) => (this.layoutSubscribers.add(t), () => {
1082
1281
  this.layoutSubscribers.delete(t);
1083
1282
  }));
1084
- g(this, "getLayoutSnapshot", () => this.layoutSnapshot);
1085
- g(this, "getLayoutServerSnapshot", () => te);
1086
- g(this, "subscribeHover", (t) => (this.hoverSubscribers.add(t), () => {
1283
+ x(this, "getLayoutSnapshot", () => this.layoutSnapshot);
1284
+ x(this, "getLayoutServerSnapshot", () => pe);
1285
+ x(this, "subscribeHover", (t) => (this.hoverSubscribers.add(t), () => {
1087
1286
  this.hoverSubscribers.delete(t);
1088
1287
  }));
1089
- g(this, "getHoverSnapshot", () => this.hoverSnapshot);
1090
- g(this, "getHoverServerSnapshot", () => ee);
1288
+ x(this, "getHoverSnapshot", () => this.hoverSnapshot);
1289
+ x(this, "getHoverServerSnapshot", () => ye);
1091
1290
  }
1092
1291
  setOnPerf(t) {
1093
1292
  this.onPerf = t;
@@ -1100,57 +1299,59 @@ class he {
1100
1299
  if (t === void 0) return this.nextSlot++;
1101
1300
  const e = this.slotsByName.get(t);
1102
1301
  if (e !== void 0 && !this.slotTaken(e)) return e;
1103
- const i = this.nextSlot++;
1104
- return e === void 0 && this.slotsByName.set(t, i), i;
1302
+ const n = this.nextSlot++;
1303
+ return e === void 0 && this.slotsByName.set(t, n), n;
1105
1304
  }
1106
1305
  /** Is a named series currently standing on this palette place? A taken place is
1107
1306
  not assigned a second time: two series of the same name standing at once
1108
1307
  share no colour, and a name that a rename has left behind does not get the
1109
1308
  colour of the renamed series. */
1110
1309
  slotTaken(t, e) {
1111
- for (const i of this.series.values())
1112
- if (i !== e && i.config.name !== void 0 && i.slot === t) return !0;
1310
+ for (const n of this.series.values())
1311
+ if (n !== e && n.config.name !== void 0 && n.slot === t) return !0;
1113
1312
  return !1;
1114
1313
  }
1115
1314
  registerSeries(t) {
1116
- const e = vt++;
1315
+ const e = $t++;
1117
1316
  return this.series.set(e, {
1118
1317
  order: e,
1119
1318
  config: t,
1120
- slot: this.slotFor(t.name),
1319
+ slot: gt(t) ? this.slotFor(t.name) : -1,
1121
1320
  lastSlot: null,
1122
1321
  materialized: null,
1123
1322
  extent: null,
1124
1323
  step: null,
1125
1324
  cellHeight: null,
1126
- depth: null
1325
+ buckets: null
1127
1326
  }), this.materialsDirty = !0, this.markLayoutDirty(), e;
1128
1327
  }
1129
1328
  updateSeries(t, e) {
1130
- const i = this.series.get(t);
1131
- if (i === void 0) return;
1132
- const r = i.config, o = vn(r, e), s = o && r.xAxisId === e.xAxisId && r.yAxisId === e.yAxisId && r.name === e.name && r.color === e.color && r.tone === e.tone && kn(r, e);
1133
- if (r.name !== e.name && e.name !== void 0) {
1329
+ const n = this.series.get(t);
1330
+ if (n === void 0) return;
1331
+ const s = n.config, o = Un(s, e), r = o && s.xAxisId === e.xAxisId && s.yAxisId === e.yAxisId && s.name === e.name && X(s.format, e.format) && s.color === e.color && s.tone === e.tone && s.hidden === e.hidden && Xn(s, e);
1332
+ if (n.slot < 0 && gt(e))
1333
+ n.slot = this.slotFor(e.name);
1334
+ else if (s.name !== e.name && e.name !== void 0 && n.slot >= 0) {
1134
1335
  const a = this.slotsByName.get(e.name);
1135
- a === void 0 ? this.slotsByName.set(e.name, i.slot) : this.slotTaken(a, i) || (i.slot = a);
1336
+ a === void 0 ? this.slotsByName.set(e.name, n.slot) : this.slotTaken(a, n) || (n.slot = a);
1136
1337
  }
1137
- i.config = e, !s && (o || (i.materialized = null, i.extent = null, i.step = null, i.cellHeight = null, i.depth = null, this.materialsDirty = !0), this.markLayoutDirty());
1338
+ n.config = e, !r && (n.buckets = null, o || (n.materialized = null, n.extent = null, n.step = null, n.cellHeight = null, n.buckets = null, this.materialsDirty = !0), this.markLayoutDirty());
1138
1339
  }
1139
1340
  unregisterSeries(t) {
1140
1341
  this.series.delete(t) && (this.materialsDirty = !0, this.markLayoutDirty());
1141
1342
  }
1142
1343
  registerAxis(t) {
1143
- const e = vt++;
1344
+ const e = $t++;
1144
1345
  return this.axes.set(e, { order: e, config: t }), this.materialsDirty = !0, this.markLayoutDirty(), e;
1145
1346
  }
1146
1347
  updateAxis(t, e) {
1147
- const i = this.axes.get(t);
1148
- if (i === void 0) return;
1149
- const r = i.config, o = z(r.accessor, e.accessor) && r.calendar === e.calendar, s = o && r.id === e.id && r.orientation === e.orientation && r.position === e.position && r.label === e.label && r.tickCount === e.tickCount && r.grid === e.grid && ft(r.ticks, e.ticks) && Mn(r.domain, e.domain) && z(r.tickFormat, e.tickFormat);
1150
- if (i.config = e, !s) {
1151
- if (!o || r.id !== e.id) {
1348
+ const n = this.axes.get(t);
1349
+ if (n === void 0) return;
1350
+ const s = n.config, o = X(s.accessor, e.accessor) && qn(s.calendar, e.calendar), r = o && s.id === e.id && s.orientation === e.orientation && s.position === e.position && s.label === e.label && s.tickCount === e.tickCount && s.grid === e.grid && s.time === e.time && s.alignTicks === e.alignTicks && ft(s.ticks, e.ticks) && ei(s.domain, e.domain) && s.onDomainChange === void 0 == (e.onDomainChange === void 0) && X(s.tickFormat, e.tickFormat);
1351
+ if (n.config = e, !r) {
1352
+ if (!o || s.id !== e.id) {
1152
1353
  for (const a of this.series.values())
1153
- a.materialized = null, a.extent = null, a.step = null, a.cellHeight = null, a.depth = null;
1354
+ a.materialized = null, a.extent = null, a.step = null, a.cellHeight = null, a.buckets = null;
1154
1355
  this.materialsDirty = !0;
1155
1356
  }
1156
1357
  this.markLayoutDirty();
@@ -1163,14 +1364,14 @@ class he {
1163
1364
  anything in this library. They are therefore not series: no accessor, no
1164
1365
  data, no legend entry, no hit. */
1165
1366
  registerLimit(t) {
1166
- const e = vt++;
1367
+ const e = $t++;
1167
1368
  return this.limits.set(e, { order: e, config: t }), this.markLayoutDirty(), e;
1168
1369
  }
1169
1370
  updateLimit(t, e) {
1170
- const i = this.limits.get(t);
1171
- if (i === void 0) return;
1172
- const r = i.config;
1173
- i.config = e, !(r.kind === e.kind && r.axisId === e.axisId && r.orientation === e.orientation && r.severity === e.severity && r.role === e.role && r.label === e.label && r.color === e.color && r.inExtent === e.inExtent && (r.kind === "line" && e.kind === "line" ? r.value === e.value : r.kind === "band" && e.kind === "band" && r.from === e.from && r.to === e.to)) && this.markLayoutDirty();
1371
+ const n = this.limits.get(t);
1372
+ if (n === void 0) return;
1373
+ const s = n.config;
1374
+ n.config = e, !(s.kind === e.kind && s.axisId === e.axisId && s.orientation === e.orientation && s.severity === e.severity && s.role === e.role && s.label === e.label && s.color === e.color && s.inExtent === e.inExtent && (s.kind === "line" && e.kind === "line" ? s.value === e.value : s.kind === "band" && e.kind === "band" && s.from === e.from && s.to === e.to)) && this.markLayoutDirty();
1174
1375
  }
1175
1376
  unregisterLimit(t) {
1176
1377
  this.limits.delete(t) && this.markLayoutDirty();
@@ -1192,7 +1393,7 @@ class he {
1192
1393
  }
1193
1394
  updateTooltip(t) {
1194
1395
  const e = this.tooltip;
1195
- if (e !== null && e.mode === t.mode && z(e.render, t.render)) {
1396
+ if (e !== null && e.mode === t.mode && X(e.render, t.render)) {
1196
1397
  this.tooltip = t;
1197
1398
  return;
1198
1399
  }
@@ -1212,9 +1413,9 @@ class he {
1212
1413
  /* ================= Data and container configuration ================= */
1213
1414
  setData(t) {
1214
1415
  if (t !== this.data) {
1215
- this.data = t, this.materialsDirty = !0, this.sortednessChecked = !1;
1416
+ this.data = t, this.materialsDirty = !0;
1216
1417
  for (const e of this.series.values())
1217
- e.materialized = null, e.extent = null, e.step = null, e.cellHeight = null, e.depth = null;
1418
+ e.materialized = null, e.extent = null, e.step = null, e.cellHeight = null, e.buckets = null;
1218
1419
  this.markLayoutDirty();
1219
1420
  }
1220
1421
  }
@@ -1225,14 +1426,14 @@ class he {
1225
1426
  /* ================= Checks (R-4.12, R-4.13) ================= */
1226
1427
  /** Called from the Chart after the child effects; DEV only. */
1227
1428
  validate() {
1228
- if (!rt) return;
1429
+ if (!ht) return;
1229
1430
  const t = /* @__PURE__ */ new Set();
1230
1431
  for (const { config: o } of this.axesInOrder()) {
1231
- const s = `${o.orientation}:${o.id}`, a = o.orientation === "x" ? "XAxis" : "YAxis";
1432
+ const r = `${o.orientation}:${o.id}`, a = o.orientation === "x" ? "XAxis" : "YAxis";
1232
1433
  ut(
1233
- !t.has(s),
1434
+ !t.has(r),
1234
1435
  `Two <${a}> with the same id "${o.id}". A second ${a} needs an own id (R-4.12).`
1235
- ), t.add(s);
1436
+ ), t.add(r);
1236
1437
  }
1237
1438
  const e = /* @__PURE__ */ new Set();
1238
1439
  for (const { config: o } of this.series.values())
@@ -1243,122 +1444,122 @@ class he {
1243
1444
  t.has(`y:${o.yAxisId}`),
1244
1445
  `Series "${o.name ?? "?"}" refers to the unknown y axis "${o.yAxisId}" (R-4.12).`
1245
1446
  ), e.add(`x:${o.xAxisId}`), e.add(`y:${o.yAxisId}`);
1447
+ for (const { config: o } of this.limits.values())
1448
+ ut(
1449
+ t.has(`${o.orientation}:${this.limitAxisId(o)}`),
1450
+ `A limit refers to the unknown ${o.orientation} axis "${this.limitAxisId(o)}" (R-4.12).`
1451
+ );
1246
1452
  for (const o of t)
1247
- !e.has(o) && this.series.size > 0 && q(
1453
+ !e.has(o) && this.series.size > 0 && J(
1248
1454
  `axis-without-series-${o}`,
1249
1455
  `Axis "${o}" has no bound series; it is drawn with the domain [0, 1] (R-4.13).`
1250
1456
  );
1251
- const i = /* @__PURE__ */ new Map();
1457
+ const n = /* @__PURE__ */ new Map();
1252
1458
  for (const { config: o } of this.seriesInOrder()) {
1253
1459
  if (o.kind !== "bar") continue;
1254
- const s = i.get(o.xAxisId);
1255
- s === void 0 ? i.set(o.xAxisId, o.barWidth) : s !== o.barWidth && q(
1460
+ const r = n.get(o.xAxisId);
1461
+ r === void 0 ? n.set(o.xAxisId, o.barWidth) : r !== o.barWidth && J(
1256
1462
  `bar-width-${o.xAxisId}`,
1257
- `Bars on the x axis "${o.xAxisId}" give different barWidth. A group shares one width fraction; that of the first (${s}) applies (ADR-0002).`
1463
+ `Bars on the x axis "${o.xAxisId}" give different barWidth. A group shares one width fraction; that of the first (${r}) applies (ADR-0002).`
1258
1464
  );
1259
1465
  }
1260
- let r = 0;
1261
- for (const o of this.axesInOrder()) o.config.grid === !0 && r++;
1262
- r > 1 && q(
1466
+ let s = 0;
1467
+ for (const o of this.axesInOrder()) o.config.grid === !0 && s++;
1468
+ s > 1 && J(
1263
1469
  "multiple-grids",
1264
- "More than one axis draws grid. Unaligned grids compete visually; there is no tick alignment between axes in V0 (R-4.15)."
1470
+ "More than one axis draws grid. Unaligned grids compete visually; `alignTicks` puts a further y axis' ticks on the first one's grid instead (R-4.15)."
1265
1471
  );
1266
1472
  }
1267
- findXAxis(t) {
1473
+ /* ================= Materialisation (R-2.6, R-2.7) ================= */
1474
+ /** A limit's axis: the one it names, or the first of its orientation. */
1475
+ limitAxisId(t) {
1476
+ if (t.axisId !== void 0) return t.axisId;
1268
1477
  for (const { config: e } of this.axes.values())
1269
- if (e.orientation === "x" && e.id === t) return e;
1478
+ if (e.orientation === t.orientation) return e.id;
1479
+ return t.orientation;
1480
+ }
1481
+ findAxisConfig(t, e) {
1482
+ for (const { config: n } of this.axes.values())
1483
+ if (n.orientation === t && n.id === e) return n;
1270
1484
  return null;
1271
1485
  }
1272
1486
  materialize() {
1273
1487
  const t = typeof performance > "u" ? 0 : performance.now();
1274
1488
  let e = 0;
1275
- for (const i of this.series.values()) {
1276
- if (i.materialized !== null) {
1277
- e += i.materialized.length;
1489
+ for (const n of this.series.values()) {
1490
+ if (n.materialized !== null) {
1491
+ e += n.materialized.length;
1278
1492
  continue;
1279
1493
  }
1280
- const r = i.config, o = r.data ?? this.data, s = this.findXAxis(r.xAxisId);
1281
- if (s === null) continue;
1282
- const a = cn(
1494
+ const s = n.config, o = s.data ?? this.data, r = this.findAxisConfig("x", s.xAxisId);
1495
+ if (r === null) continue;
1496
+ const a = Wn(
1283
1497
  o,
1284
- s.accessor,
1285
1498
  r.accessor,
1286
- Pt(r),
1499
+ s.accessor,
1500
+ Mt(s),
1287
1501
  {
1288
- value: At(r),
1289
- xEnd: Ft(r),
1290
- xMap: this.mapFor(s),
1291
- xGap: this.gapFor(s)
1502
+ value: qt(s),
1503
+ xMap: this.mapFor(r),
1504
+ xGap: this.gapFor(r)
1292
1505
  }
1293
1506
  );
1294
- if (i.materialized = a.series, e += a.series.length, r.kind === "bar") {
1295
- const l = dn(a.series.x, a.series.length);
1296
- i.step = l;
1297
- const c = l / 2;
1298
- i.extent = {
1507
+ if (n.materialized = a.series, e += a.series.length, s.kind === "bar") {
1508
+ const l = _n(a.series.x, a.series.length);
1509
+ n.step = l;
1510
+ const u = l / 2;
1511
+ n.extent = {
1299
1512
  ...a.extent,
1300
- xMin: a.extent.xMin - c,
1301
- xMax: a.extent.xMax + c
1513
+ xMin: a.extent.xMin - u,
1514
+ xMax: a.extent.xMax + u
1302
1515
  };
1303
- } else if (r.kind === "matrix") {
1304
- const l = Jt(a.series.x, a.series.length), c = Jt(a.series.y, a.series.length);
1305
- i.step = l, i.cellHeight = c, i.extent = {
1516
+ } else if (s.kind === "matrix") {
1517
+ const l = fe(a.series.x, a.series.length), u = fe(a.series.y, a.series.length);
1518
+ n.step = l, n.cellHeight = u, n.extent = {
1306
1519
  xMin: a.extent.xMin - l / 2,
1307
1520
  xMax: a.extent.xMax + l / 2,
1308
- yMin: a.extent.yMin - c / 2,
1309
- yMax: a.extent.yMax + c / 2
1521
+ yMin: a.extent.yMin - u / 2,
1522
+ yMax: a.extent.yMax + u / 2
1310
1523
  };
1311
- } else if (r.kind === "state")
1312
- i.step = null, i.extent = {
1524
+ } else if (s.kind === "state") {
1525
+ const l = vn(a.series.x, a.series.length);
1526
+ n.step = l, n.extent = {
1313
1527
  ...a.extent,
1528
+ xMax: a.extent.xMax + l,
1314
1529
  yMin: Number.POSITIVE_INFINITY,
1315
1530
  yMax: Number.NEGATIVE_INFINITY
1316
1531
  };
1317
- else if (r.kind === "span") {
1318
- i.depth = qe(
1319
- a.series.x,
1320
- a.series.x1 ?? new Float64Array(a.series.length),
1321
- a.series.length,
1322
- // The end of the domain is not yet fixed at materialisation time. The
1323
- // covering of an open span reaches to the end of everything there is -
1324
- // and that is exactly the value it gets here.
1325
- a.extent.xMax
1326
- );
1327
- const l = (r.height ?? 0.6) / 2;
1328
- i.step = null, i.extent = {
1329
- ...a.extent,
1330
- yMin: a.extent.yMin - l,
1331
- yMax: a.extent.yMax + l
1332
- };
1333
1532
  } else
1334
- i.step = null, i.extent = a.extent;
1335
- if (!this.sortednessChecked && rt) {
1336
- this.sortednessChecked = !0;
1337
- const l = un(a.series.x, a.series.length);
1338
- l >= 0 && q(
1339
- "x-unsorted",
1340
- `X values are not sorted ascending (index ${l}). Binary search and path building assume sortedness; there is no automatic sorting (R-2.6).`
1341
- );
1533
+ n.step = null, n.extent = a.extent;
1534
+ if (ht && s.kind !== "matrix") {
1535
+ const l = Rn(a.series.x, a.series.length);
1536
+ if (l >= 0) {
1537
+ const u = s.name ?? "?";
1538
+ J(
1539
+ `x-unsorted-${u}`,
1540
+ `Series "${u}": x values are not sorted ascending (index ${l}). Binary search and path building assume sortedness; there is no automatic sorting (R-2.6).`
1541
+ );
1542
+ }
1342
1543
  }
1343
1544
  }
1344
1545
  this.materialsDirty = !1, this.perf.materializeMs = (typeof performance > "u" ? 0 : performance.now()) - t, this.perf.points = e;
1345
1546
  }
1346
1547
  /* ================= DOM binding, DPR, resize ================= */
1347
- bind(t, e, i, r) {
1348
- var s;
1349
- this.container = t, this.themeRoot = r, this.seriesCanvas = e, this.overlayCanvas = i, this.seriesCtx = e.getContext("2d"), this.overlayCtx = i.getContext("2d"), this.measurer = new Ae(r), this.dpr = typeof devicePixelRatio == "number" ? devicePixelRatio : 1, this.rebindDprWatch(), this.unsubscribeTheme = Le(() => {
1548
+ bind(t, e, n, s) {
1549
+ var r;
1550
+ this.container = t, this.themeRoot = s, this.seriesCanvas = e, this.overlayCanvas = n, this.seriesCtx = e.getContext("2d"), this.overlayCtx = n.getContext("2d"), this.measurer = new Ze(s), this.dpr = typeof devicePixelRatio == "number" ? devicePixelRatio : 1, this.rebindDprWatch(), this.unsubscribeTheme = Ue(() => {
1350
1551
  var a;
1351
- this.theme = null, (a = this.measurer) == null || a.clear(), this.markLayoutDirty();
1552
+ this.theme = null, this.painted.clear(), (a = this.measurer) == null || a.clear(), this.markLayoutDirty();
1352
1553
  });
1353
1554
  const o = typeof document > "u" ? void 0 : document.fonts;
1354
- (s = o == null ? void 0 : o.addEventListener) == null || s.call(o, "loadingdone", this.onFontsLoaded), this.theme = null, this.markLayoutDirty();
1555
+ (r = o == null ? void 0 : o.addEventListener) == null || r.call(o, "loadingdone", this.onFontsLoaded), this.theme = null, this.painted.clear(), this.markLayoutDirty();
1355
1556
  }
1356
1557
  bindTooltip(t) {
1357
1558
  this.tooltipEl = t;
1358
1559
  }
1359
1560
  unbind() {
1360
- var t, e, i, r, o;
1361
- this.frameHandle !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.frameHandle), this.frameHandle = null), (t = this.dprMedia) == null || t.removeEventListener("change", this.onDprChange), this.dprMedia = null, (e = this.unsubscribeTheme) == null || e.call(this), this.unsubscribeTheme = null, typeof document < "u" && ((r = (i = document.fonts) == null ? void 0 : i.removeEventListener) == null || r.call(i, "loadingdone", this.onFontsLoaded)), (o = this.measurer) == null || o.remove(), this.measurer = null, this.container = null, this.themeRoot = null, this.seriesCanvas = null, this.overlayCanvas = null, this.seriesCtx = null, this.overlayCtx = null, this.tooltipEl = null;
1561
+ var t, e, n, s, o;
1562
+ this.frameHandle !== null && typeof cancelAnimationFrame == "function" && (cancelAnimationFrame(this.frameHandle), this.frameHandle = null), (t = this.dprMedia) == null || t.removeEventListener("change", this.onDprChange), this.dprMedia = null, (e = this.unsubscribeTheme) == null || e.call(this), this.unsubscribeTheme = null, typeof document < "u" && ((s = (n = document.fonts) == null ? void 0 : n.removeEventListener) == null || s.call(n, "loadingdone", this.onFontsLoaded)), (o = this.measurer) == null || o.remove(), this.measurer = null, this.container = null, this.themeRoot = null, this.seriesCanvas = null, this.overlayCanvas = null, this.seriesCtx = null, this.overlayCtx = null, this.tooltipEl = null;
1362
1563
  }
1363
1564
  /** Detect a change of DPR (a change of monitor): rebind matchMedia (R-2.9). */
1364
1565
  rebindDprWatch() {
@@ -1372,12 +1573,12 @@ class he {
1372
1573
  applyPendingSize() {
1373
1574
  if (this.pendingWidth === null || this.pendingHeight === null) return;
1374
1575
  this.cssWidth = this.pendingWidth, this.cssHeight = this.pendingHeight, this.pendingWidth = null, this.pendingHeight = null;
1375
- const { seriesCanvas: t, overlayCanvas: e, seriesCtx: i, overlayCtx: r, dpr: o } = this;
1376
- if (!t || !e || !i || !r) return;
1377
- const s = Math.max(0, Math.round(this.cssWidth * o)), a = Math.max(0, Math.round(this.cssHeight * o));
1576
+ const { seriesCanvas: t, overlayCanvas: e, seriesCtx: n, overlayCtx: s, dpr: o } = this;
1577
+ if (!t || !e || !n || !s) return;
1578
+ const r = Math.max(0, Math.round(this.cssWidth * o)), a = Math.max(0, Math.round(this.cssHeight * o));
1378
1579
  for (const l of [t, e])
1379
- l.width = s, l.height = a, l.style.width = `${this.cssWidth}px`, l.style.height = `${this.cssHeight}px`;
1380
- i.setTransform(o, 0, 0, o, 0, 0), r.setTransform(o, 0, 0, o, 0, 0);
1580
+ l.width = r, l.height = a, l.style.width = `${this.cssWidth}px`, l.style.height = `${this.cssHeight}px`;
1581
+ n.setTransform(o, 0, 0, o, 0, 0), s.setTransform(o, 0, 0, o, 0, 0);
1381
1582
  }
1382
1583
  /* ================= Scheduling (R-2.11) ================= */
1383
1584
  markSeriesDirty() {
@@ -1397,7 +1598,7 @@ class he {
1397
1598
  }));
1398
1599
  }
1399
1600
  frame() {
1400
- if (this.applyPendingSize(), this.theme === null && this.themeRoot !== null && (this.theme = Me(this.themeRoot)), this.cssWidth <= 0 || this.cssHeight <= 0) {
1601
+ if (this.applyPendingSize(), this.theme === null && this.themeRoot !== null && (this.theme = Ke(this.themeRoot)), this.cssWidth <= 0 || this.cssHeight <= 0) {
1401
1602
  this.layoutDirty && this.pushLayoutSnapshot();
1402
1603
  return;
1403
1604
  }
@@ -1412,10 +1613,10 @@ class he {
1412
1613
  (R-4.15). */
1413
1614
  gridDefault() {
1414
1615
  const t = /* @__PURE__ */ new Map();
1415
- let e = !0, i = !0;
1416
- for (const [r, o] of [...this.axes.entries()].sort((s, a) => s[1].order - a[1].order)) {
1417
- const s = o.config.orientation === "x" ? e : i;
1418
- t.set(r, o.config.grid ?? s), o.config.orientation === "x" ? e = !1 : i = !1;
1616
+ let e = !0, n = !0;
1617
+ for (const [s, o] of [...this.axes.entries()].sort((r, a) => r[1].order - a[1].order)) {
1618
+ const r = o.config.orientation === "x" ? e : n;
1619
+ t.set(s, o.config.grid ?? r), o.config.orientation === "x" ? e = !1 : n = !1;
1419
1620
  }
1420
1621
  return t;
1421
1622
  }
@@ -1425,20 +1626,42 @@ class he {
1425
1626
  which extents across series kinds can be tested without asking a canvas.
1426
1627
  The layout path calls extentFor directly. */
1427
1628
  axisExtent(t, e) {
1629
+ var o;
1428
1630
  this.materialsDirty && this.materialize();
1429
- const i = [...this.series.values()].map((r) => ({
1631
+ const n = t === "y" && ((o = this.findAxisConfig("y", e)) == null ? void 0 : o.domain) === "visible", s = [...this.series.values()].map((r) => ({
1430
1632
  xAxisId: r.config.xAxisId,
1431
1633
  yAxisId: r.config.yAxisId,
1432
- extent: r.extent
1634
+ // A hidden series has no say: the axis fits what is shown.
1635
+ extent: r.config.hidden === !0 ? null : n ? this.visibleExtentOf(r) : r.extent
1433
1636
  }));
1434
- return hn(t, e, i, this.limitValues(t, e));
1637
+ return Vn(t, e, s, this.limitValues(t, e));
1638
+ }
1639
+ /** The extent of what a fixed x domain shows. A domain that is not fixed
1640
+ shows every point - "nice" and "data" both contain the data -, and a band
1641
+ and a cell keep theirs: a lane is no value, a cell's edge no point. */
1642
+ visibleExtentOf(t) {
1643
+ var u;
1644
+ const e = (u = this.findAxisConfig("x", t.config.xAxisId)) == null ? void 0 : u.domain, n = t.config.kind;
1645
+ if (!Array.isArray(e) || t.materialized === null || n === "state" || n === "matrix")
1646
+ return t.extent;
1647
+ const [s, o] = e;
1648
+ let [r, a] = Hn(t.materialized, s, o);
1649
+ const l = Mt(t.config);
1650
+ return typeof l == "number" && r <= a && (r = Math.min(r, l), a = Math.max(a, l)), { xMin: s, xMax: o, yMin: r, yMax: a };
1435
1651
  }
1436
1652
  /** The values of the limits that are to pull this axis along. */
1437
1653
  limitValues(t, e) {
1438
- const i = [];
1439
- for (const { config: r } of this.limits.values())
1440
- r.inExtent && (r.orientation !== t || r.axisId !== e || (r.kind === "line" ? i.push(r.value) : i.push(r.from, r.to)));
1441
- return i;
1654
+ const n = [];
1655
+ for (const { config: s } of this.limits.values())
1656
+ s.inExtent && (s.orientation !== t || this.limitAxisId(s) !== e || (s.kind === "line" ? n.push(this.limitAt(s, s.value)) : n.push(this.limitAt(s, s.from), this.limitAt(s, s.to))));
1657
+ return n;
1658
+ }
1659
+ /** A limit's value in the units of its axis. An x limit on an operating-time
1660
+ axis is named on the wall clock, like the data, and mapped as they are. */
1661
+ limitAt(t, e) {
1662
+ if (t.orientation !== "x") return e;
1663
+ const n = this.findAxisConfig("x", this.limitAxisId(t)), s = n === null ? void 0 : this.mapFor(n);
1664
+ return s === void 0 ? e : s(e);
1442
1665
  }
1443
1666
  /** Pre-mapping of the x values of an axis with an operating calendar. The scale
1444
1667
  stays affine; the mapping happens beforehand, once per point, in
@@ -1447,103 +1670,127 @@ class he {
1447
1670
  mapFor(t) {
1448
1671
  const e = t.calendar;
1449
1672
  if (!(e === void 0 || e.length === 0))
1450
- return (i) => Ce(i, e);
1673
+ return (n) => nn(n, e);
1451
1674
  }
1452
1675
  gapFor(t) {
1453
1676
  const e = t.calendar;
1454
1677
  if (!(e === void 0 || e.length === 0))
1455
- return (i) => Oe(i, e);
1678
+ return (n) => sn(n, e);
1456
1679
  }
1457
1680
  extentFor(t) {
1458
1681
  return this.axisExtent(t.orientation, t.id);
1459
1682
  }
1460
1683
  updateLayout() {
1461
- const t = this.measurer, e = this.gridDefault(), i = [];
1462
- for (const [r, o] of [...this.axes.entries()].sort((s, a) => s[1].order - a[1].order)) {
1463
- const s = o.config;
1464
- i.push({
1465
- key: `${s.orientation}:${s.id}`,
1466
- id: s.id,
1467
- orientation: s.orientation,
1468
- position: s.position,
1469
- label: s.label,
1470
- grid: e.get(r) ?? !1,
1471
- extent: this.extentFor(s),
1472
- domainMode: s.domain,
1473
- tickCount: s.tickCount,
1474
- tickFormat: s.tickFormat,
1475
- tickValues: s.ticks,
1476
- calendar: s.calendar,
1477
- limitLabels: s.orientation === "y" ? this.limitsInOrder().map((a) => a.config).filter((a) => a.orientation === "y" && a.axisId === s.id && a.label !== void 0 && a.label !== "").map((a) => a.label) : void 0
1684
+ const t = this.measurer;
1685
+ this.proposed.clear(), this.container !== null && (this.container.style.touchAction = this.hasZoom() ? "pan-y" : "");
1686
+ const e = this.gridDefault(), n = [];
1687
+ for (const [s, o] of [...this.axes.entries()].sort((r, a) => r[1].order - a[1].order)) {
1688
+ const r = o.config;
1689
+ n.push({
1690
+ key: `${r.orientation}:${r.id}`,
1691
+ id: r.id,
1692
+ orientation: r.orientation,
1693
+ position: r.position,
1694
+ label: r.label,
1695
+ grid: e.get(s) ?? !1,
1696
+ extent: this.extentFor(r),
1697
+ domainMode: r.domain,
1698
+ tickCount: r.tickCount,
1699
+ tickFormat: r.tickFormat,
1700
+ tickValues: r.ticks,
1701
+ time: r.time,
1702
+ calendar: r.calendar,
1703
+ alignTicks: r.alignTicks,
1704
+ limitLabels: r.orientation === "y" ? this.limitsInOrder().map((a) => a.config).filter((a) => a.orientation === "y" && this.limitAxisId(a) === r.id && a.label !== void 0 && a.label !== "").map((a) => a.label) : void 0
1478
1705
  });
1479
1706
  }
1480
- this.layout = ze({
1707
+ this.layout = xn({
1481
1708
  width: this.cssWidth,
1482
1709
  height: this.cssHeight,
1483
1710
  padding: this.padding,
1484
- axes: i,
1485
- measure: (r, o) => t === null ? { width: 0, height: 0 } : t.measure(r, o),
1711
+ axes: n,
1712
+ measure: (s, o) => t === null ? { width: 0, height: 0 } : t.measure(s, o),
1486
1713
  hysteresis: this.hysteresis
1487
1714
  });
1488
1715
  }
1489
1716
  findAxis(t, e) {
1490
- for (const i of this.layout.axes)
1491
- if (i.orientation === t && i.id === e) return i;
1717
+ for (const n of this.layout.axes)
1718
+ if (n.orientation === t && n.id === e) return n;
1492
1719
  return null;
1493
1720
  }
1494
1721
  /* ================= Series colours and legend entries ================= */
1495
- colorFor(t, e) {
1496
- var o;
1497
- if (t.config.color !== void 0) return t.config.color;
1498
- const i = t.config.tone;
1499
- if (i !== void 0) {
1500
- const s = this.theme ?? O;
1501
- return i === "alarm" ? s.colorAlarm : i === "warning" ? s.colorWarning : s.colorOk;
1722
+ /** A caller's CSS colour as the canvas can draw it (finding 15). */
1723
+ paint(t) {
1724
+ const e = this.themeRoot;
1725
+ if (e === null) return t;
1726
+ let n = this.painted.get(t);
1727
+ return n === void 0 && (n = qe(e, { color: t }).color, this.painted.set(t, n)), n;
1728
+ }
1729
+ colorFor(t) {
1730
+ var s;
1731
+ if (t.config.color !== void 0) return this.paint(t.config.color);
1732
+ if (!gt(t.config)) return "";
1733
+ const e = t.config.tone;
1734
+ if (e !== void 0) {
1735
+ const o = this.theme ?? O;
1736
+ return e === "alarm" ? o.colorAlarm : e === "warning" ? o.colorWarning : o.colorOk;
1502
1737
  }
1503
- const r = ((o = this.theme) == null ? void 0 : o.series) ?? O.series;
1504
- return r[this.paletteSlot(t, e) % Math.max(1, r.length)] ?? O.series[0] ?? "#2563eb";
1505
- }
1506
- /** Named: the place of the name. Nameless: the index in the registration, as
1507
- before - and a warning as soon as that shifts underneath it. */
1508
- paletteSlot(t, e) {
1509
- return t.config.name !== void 0 ? t.slot : (t.lastSlot !== null && t.lastSlot !== e && q(
1738
+ const n = ((s = this.theme) == null ? void 0 : s.series) ?? O.series;
1739
+ return n[this.paletteSlot(t) % Math.max(1, n.length)] ?? O.series[0] ?? "#2563eb";
1740
+ }
1741
+ /** Named: the place of the name. Nameless: the position among the series that
1742
+ take a palette place, as before - and a warning as soon as that shifts
1743
+ underneath it. */
1744
+ paletteSlot(t) {
1745
+ if (t.config.name !== void 0) return t.slot;
1746
+ let e = 0;
1747
+ for (const n of this.series.values())
1748
+ n.order < t.order && gt(n.config) && e++;
1749
+ return t.lastSlot !== null && t.lastSlot !== e && J(
1510
1750
  "series-without-name-colour",
1511
1751
  "a series without a name has changed its colour, because a series before it went away - with `name` it keeps it."
1512
- ), t.lastSlot = e, e);
1752
+ ), t.lastSlot = e, e;
1513
1753
  }
1514
1754
  nameFor(t, e) {
1515
- return t.config.name !== void 0 ? t.config.name : (q(
1755
+ return t.config.name !== void 0 ? t.config.name : (J(
1516
1756
  "series-without-name",
1517
1757
  `a series without a name is called "Series ${e + 1}" in the legend and the tooltip - the name belongs in \`name\`.`
1518
1758
  ), `Series ${e + 1}`);
1519
1759
  }
1520
1760
  legendItems() {
1521
- const t = [], e = /* @__PURE__ */ new Set();
1522
- return this.seriesInOrder().forEach((i, r) => {
1523
- const o = i.config;
1761
+ const t = [], e = /* @__PURE__ */ new Map();
1762
+ return this.seriesInOrder().forEach((n, s) => {
1763
+ const o = n.config;
1524
1764
  if (o.kind === "state") {
1525
- o.states.forEach((s, a) => {
1526
- const l = `${s.label}\0${s.color}`;
1527
- e.has(l) || (e.add(l), t.push({
1528
- id: `${i.order}:${a}`,
1529
- name: s.label,
1530
- color: s.color,
1531
- seriesId: i.order
1532
- }));
1765
+ o.states.forEach((r, a) => {
1766
+ const l = `${r.label}\0${r.color}`, u = e.get(l);
1767
+ if (u !== void 0) {
1768
+ u.seriesIds.includes(n.order) || u.seriesIds.push(n.order), u.hidden && (u.hidden = o.hidden === !0);
1769
+ return;
1770
+ }
1771
+ const d = {
1772
+ id: `${n.order}:${a}`,
1773
+ name: r.label,
1774
+ hidden: o.hidden === !0,
1775
+ color: r.color,
1776
+ seriesIds: [n.order]
1777
+ };
1778
+ e.set(l, d), t.push(d);
1533
1779
  });
1534
1780
  return;
1535
1781
  }
1536
1782
  t.push({
1537
- id: String(i.order),
1538
- name: this.nameFor(i, r),
1539
- color: this.colorFor(i, r),
1540
- seriesId: i.order
1783
+ id: String(n.order),
1784
+ name: this.nameFor(n, s),
1785
+ hidden: o.hidden === !0,
1786
+ color: o.kind === "matrix" ? Qn(Ot(o.coloring, this.theme ?? O)) : this.colorFor(n),
1787
+ seriesIds: [n.order]
1541
1788
  });
1542
1789
  }), t;
1543
1790
  }
1544
1791
  /* ---------- Limits, ready in pixels ---------- */
1545
1792
  limitColor(t, e) {
1546
- return t.color !== void 0 ? t.color : t.role === "control" ? e.colorAxis : t.role === "zone" ? e.colorGrid : t.severity === "alarm" ? e.colorAlarm : e.colorWarning;
1793
+ return t.color !== void 0 ? this.paint(t.color) : t.role === "control" ? e.colorAxis : t.role === "zone" ? e.colorGrid : t.severity === "alarm" ? e.colorAlarm : e.colorWarning;
1547
1794
  }
1548
1795
  /** Dash pattern per role. The reader has to be able to see at a glance whether
1549
1796
  the problem is the process or the tolerance. */
@@ -1558,57 +1805,59 @@ class he {
1558
1805
  }
1559
1806
  }
1560
1807
  limitItems(t) {
1561
- const e = this.theme ?? O, i = [];
1562
- for (const { config: r } of this.limitsInOrder()) {
1563
- if (r.kind === "band" !== t) continue;
1564
- const o = this.findAxis(r.orientation, r.axisId);
1808
+ const e = this.theme ?? O, n = [];
1809
+ for (const { config: s } of this.limitsInOrder()) {
1810
+ if (s.kind === "band" !== t) continue;
1811
+ const o = this.findAxis(s.orientation, this.limitAxisId(s));
1565
1812
  if (o === null) continue;
1566
- const s = this.limitColor(r, e), a = this.limitDash(r);
1567
- if (r.kind === "band")
1568
- i.push({
1569
- orientation: r.orientation,
1570
- fromPx: o.scale.toPx(r.from),
1571
- toPx: o.scale.toPx(r.to),
1572
- color: s,
1813
+ const r = this.limitColor(s, e), a = this.limitDash(s);
1814
+ if (s.kind === "band")
1815
+ n.push({
1816
+ orientation: s.orientation,
1817
+ fromPx: o.scale.toPx(this.limitAt(s, s.from)),
1818
+ toPx: o.scale.toPx(this.limitAt(s, s.to)),
1819
+ color: r,
1573
1820
  band: !0,
1574
1821
  dash: a
1575
1822
  });
1576
1823
  else {
1577
- const l = o.scale.toPx(r.value);
1578
- i.push({
1579
- orientation: r.orientation,
1824
+ const l = o.scale.toPx(this.limitAt(s, s.value));
1825
+ n.push({
1826
+ orientation: s.orientation,
1580
1827
  fromPx: l,
1581
1828
  toPx: l,
1582
- color: s,
1829
+ color: r,
1583
1830
  band: !1,
1584
1831
  dash: a
1585
1832
  });
1586
1833
  }
1587
1834
  }
1588
- return i;
1835
+ return n;
1589
1836
  }
1590
1837
  /** Labelled limits for the HTML layer: position and colour, ready. */
1591
1838
  limitLabels() {
1839
+ var e;
1592
1840
  const t = [];
1593
- for (const { order: e, config: i } of this.limitsInOrder()) {
1594
- if (i.label === void 0 || i.label === "") continue;
1595
- const r = this.findAxis(i.orientation, i.axisId);
1596
- if (r === null) continue;
1597
- const o = i.kind === "line" ? i.value : (i.from + i.to) / 2;
1841
+ for (const { order: n, config: s } of this.limitsInOrder()) {
1842
+ if (s.label === void 0 || s.label === "") continue;
1843
+ const o = this.findAxis(s.orientation, this.limitAxisId(s));
1844
+ if (o === null) continue;
1845
+ const r = s.kind === "line" ? this.limitAt(s, s.value) : (this.limitAt(s, s.from) + this.limitAt(s, s.to)) / 2, a = o.scale.toPx(r), l = (((e = this.measurer) == null ? void 0 : e.measure(s.label, it).width) ?? 0) + 4;
1598
1846
  t.push({
1599
- id: e,
1600
- axisKey: r.key,
1601
- px: r.scale.toPx(o),
1602
- label: i.label,
1603
- severity: i.severity,
1604
- role: i.role
1847
+ id: n,
1848
+ axisKey: o.key,
1849
+ px: a,
1850
+ labelLeft: Le(a, l, this.cssWidth),
1851
+ label: s.label,
1852
+ severity: s.severity,
1853
+ role: s.role
1605
1854
  });
1606
1855
  }
1607
1856
  return t;
1608
1857
  }
1609
1858
  /* ================= Drawing ================= */
1610
1859
  drawItems() {
1611
- const t = [], e = this.seriesInOrder(), i = pn(
1860
+ const t = [], e = this.seriesInOrder().filter((r) => r.config.hidden !== !0), n = this.highlight, s = n !== null && e.some((r) => n.includes(r.order)) ? n : null, o = Bn(
1612
1861
  e.map((r) => ({
1613
1862
  order: r.order,
1614
1863
  kind: r.config.kind,
@@ -1617,124 +1866,125 @@ class he {
1617
1866
  fraction: r.config.kind === "bar" ? r.config.barWidth : 0
1618
1867
  }))
1619
1868
  );
1620
- return e.forEach((r, o) => {
1621
- const s = r.materialized;
1622
- if (s === null) return;
1623
- const a = this.findAxis("x", r.config.xAxisId), l = this.findAxis("y", r.config.yAxisId);
1624
- if (a === null || l === null) return;
1625
- const c = this.highlight !== null && this.highlight !== r.order, u = {
1626
- x: s.x,
1627
- y: s.y,
1628
- length: s.length,
1629
- xScale: a.scale,
1630
- yScale: l.scale,
1631
- color: this.colorFor(r, o),
1632
- alpha: c ? 0.25 : 1
1633
- }, h = r.config;
1634
- switch (h.kind) {
1869
+ return e.forEach((r) => {
1870
+ const a = r.materialized;
1871
+ if (a === null) return;
1872
+ const l = this.findAxis("x", r.config.xAxisId), u = this.findAxis("y", r.config.yAxisId);
1873
+ if (l === null || u === null) return;
1874
+ const d = s !== null && !s.includes(r.order), f = {
1875
+ x: a.x,
1876
+ y: a.y,
1877
+ length: a.length,
1878
+ xScale: l.scale,
1879
+ yScale: u.scale,
1880
+ color: this.colorFor(r),
1881
+ alpha: d ? 0.25 : 1
1882
+ }, h = r.config, m = h.kind === "line" || h.kind === "area" ? Pn(a, l.scale.domain[0], l.scale.domain[1], l.scale.m, l.scale.b, this.layout.plot.width) : a;
1883
+ switch (f.x = m.x, f.y = m.y, f.length = m.length, h.kind) {
1635
1884
  case "line":
1636
1885
  t.push({
1637
- ...u,
1886
+ ...f,
1638
1887
  kind: "line",
1639
1888
  strokeWidth: h.strokeWidth,
1640
1889
  dash: h.dash,
1641
- marker: h.markers === "always" || h.markers === "auto" && s.length <= gn
1890
+ markers: h.markers,
1891
+ step: h.step
1642
1892
  });
1643
1893
  break;
1644
1894
  case "area":
1645
1895
  t.push({
1646
- ...u,
1896
+ ...f,
1647
1897
  kind: "area",
1648
- y0: s.y0,
1898
+ y0: m.y0,
1649
1899
  baseline: 0,
1650
1900
  fillOpacity: h.fillOpacity,
1651
- strokeWidth: h.strokeWidth
1901
+ strokeWidth: h.strokeWidth,
1902
+ dash: h.dash
1652
1903
  });
1653
1904
  break;
1654
1905
  case "bar": {
1655
- const p = i.get(r.order) ?? {
1906
+ const c = o.get(r.order) ?? {
1656
1907
  index: 0,
1657
1908
  size: 1,
1658
1909
  step: r.step ?? 0,
1659
1910
  fraction: h.barWidth
1660
- }, d = a.scale.domain, m = mn(
1661
- fn(p.step, d[1] - d[0]),
1662
- p.fraction,
1663
- p.index,
1664
- p.size
1911
+ }, p = l.scale.domain, y = zn(
1912
+ Yn(c.step, p[1] - p[0]),
1913
+ c.fraction,
1914
+ c.index,
1915
+ c.size
1665
1916
  );
1666
1917
  t.push({
1667
- ...u,
1918
+ ...f,
1668
1919
  kind: "bar",
1669
1920
  baseline: 0,
1670
- offset: m.offset,
1671
- width: m.width
1921
+ offset: y.offset,
1922
+ width: y.width
1672
1923
  });
1673
1924
  break;
1674
1925
  }
1675
1926
  case "scatter":
1676
- t.push({ ...u, kind: "scatter", radius: h.radius });
1927
+ t.push({ ...f, kind: "scatter", radius: h.radius });
1677
1928
  break;
1678
1929
  case "state": {
1679
- const p = this.lanePx(h, l);
1930
+ const c = this.lanePx(h, u);
1680
1931
  t.push({
1681
- ...u,
1932
+ ...f,
1682
1933
  kind: "state",
1683
- colors: h.states.map((d) => d.color),
1684
- laneTop: p.top,
1685
- laneBottom: p.bottom,
1686
- domainEnd: a.scale.domain[1]
1934
+ colors: h.states.map((p) => this.paint(p.color)),
1935
+ laneTop: c.top,
1936
+ laneBottom: c.bottom,
1937
+ lastEnd: this.lastEnd(r, a, l)
1687
1938
  });
1688
1939
  break;
1689
1940
  }
1690
1941
  case "matrix": {
1691
- const p = In(h.coloring, this.theme ?? O);
1942
+ const c = Ot(h.coloring, this.theme ?? O).map((p) => this.paint(p));
1692
1943
  t.push({
1693
- ...u,
1944
+ ...f,
1694
1945
  kind: "matrix",
1695
- buckets: Sn(s, h.coloring, p.length),
1696
- colors: p,
1697
- width: ct(
1946
+ buckets: r.buckets ?? (r.buckets = xe(a, h.coloring, c.length)),
1947
+ colors: c,
1948
+ width: yt(
1698
1949
  r.step ?? 0,
1699
- a.scale.domain[1] - a.scale.domain[0]
1950
+ l.scale.domain[1] - l.scale.domain[0]
1700
1951
  ),
1701
- height: ct(
1952
+ height: yt(
1702
1953
  r.cellHeight ?? 0,
1703
- l.scale.domain[1] - l.scale.domain[0]
1954
+ u.scale.domain[1] - u.scale.domain[0]
1704
1955
  )
1705
1956
  });
1706
1957
  break;
1707
1958
  }
1708
- case "span": {
1709
- t.push({
1710
- ...u,
1711
- kind: "span",
1712
- x1: s.x1 ?? bn,
1713
- // Computed once per materialisation, not per frame: the calculation
1714
- // is quadratic, and a schedule with five hundred spans is pushed and
1715
- // pulled like any other chart.
1716
- depth: r.depth ?? xn,
1717
- height: h.height ?? 0.6,
1718
- domainEnd: a.scale.domain[1]
1719
- });
1720
- break;
1721
- }
1722
1959
  }
1723
1960
  }), t;
1724
1961
  }
1962
+ /** Where a band's last state ends: the latest x of the visible series on its
1963
+ x axis, one step past its own last point where that is the latest, never
1964
+ beyond the domain (lastSegmentEnd). */
1965
+ lastEnd(t, e, n) {
1966
+ let s = Number.NEGATIVE_INFINITY;
1967
+ for (const o of this.series.values()) {
1968
+ const r = o.materialized;
1969
+ if (r === null || r.length === 0 || o.config.hidden === !0 || o.config.xAxisId !== t.config.xAxisId) continue;
1970
+ const a = r.x[r.length - 1];
1971
+ a > s && (s = a);
1972
+ }
1973
+ return bn(e.x, e.length, s, t.step ?? 0, n.scale.domain[1]);
1974
+ }
1725
1975
  /** Lane of a state series in pixels. Without a value the whole domain of its y
1726
1976
  axis: a single series fills its band, a stack gets a domain with one unit per
1727
1977
  machine from the caller. */
1728
1978
  lanePx(t, e) {
1729
- const i = e.scale.domain, r = e.scale.toPx(t.laneFrom ?? i[0]), o = e.scale.toPx(t.laneTo ?? i[1]);
1730
- return { top: Math.min(r, o), bottom: Math.max(r, o) };
1979
+ const n = e.scale.domain, s = e.scale.toPx(t.laneFrom ?? n[0]), o = e.scale.toPx(t.laneTo ?? n[1]);
1980
+ return { top: Math.min(s, o), bottom: Math.max(s, o) };
1731
1981
  }
1732
1982
  drawSeriesLayer() {
1733
- var r;
1983
+ var s;
1734
1984
  const t = this.seriesCtx, e = this.theme;
1735
1985
  if (!t || !e) return;
1736
- const i = typeof performance > "u" ? 0 : performance.now();
1737
- nn(t, {
1986
+ const n = typeof performance > "u" ? 0 : performance.now();
1987
+ Fn(t, {
1738
1988
  width: this.cssWidth,
1739
1989
  height: this.cssHeight,
1740
1990
  plot: this.layout.plot,
@@ -1743,16 +1993,17 @@ class he {
1743
1993
  series: this.drawItems(),
1744
1994
  limitBands: this.limitItems(!0),
1745
1995
  limitLines: this.limitItems(!1)
1746
- }), this.perf.seriesDrawMs = (typeof performance > "u" ? 0 : performance.now()) - i, (r = this.onPerf) == null || r.call(this, { ...this.perf });
1996
+ }), this.perf.seriesDrawMs = (typeof performance > "u" ? 0 : performance.now()) - n, (s = this.onPerf) == null || s.call(this, { ...this.perf });
1747
1997
  }
1748
1998
  drawOverlayLayer() {
1749
1999
  const t = this.overlayCtx, e = this.theme;
1750
- !t || !e || (rn(t, {
2000
+ !t || !e || (Dn(t, {
1751
2001
  width: this.cssWidth,
1752
2002
  height: this.cssHeight,
1753
2003
  plot: this.layout.plot,
1754
2004
  theme: e,
1755
- hover: this.hover
2005
+ hover: this.hover,
2006
+ syncPx: this.syncedPx()
1756
2007
  }), this.positionTooltip());
1757
2008
  }
1758
2009
  /* ================= Interaction (4.4) ================= */
@@ -1760,173 +2011,287 @@ class he {
1760
2011
  this.highlight !== t && (this.highlight = t, this.markSeriesDirty());
1761
2012
  }
1762
2013
  inPlot(t, e) {
1763
- const i = this.layout.plot;
1764
- return t >= i.x && t <= i.x + i.width && e >= i.y && e <= i.y + i.height;
2014
+ const n = this.layout.plot;
2015
+ return t >= n.x && t <= n.x + n.width && e >= n.y && e <= n.y + n.height;
1765
2016
  }
1766
2017
  pointerMove(t, e) {
1767
- if (this.tooltip === null) return;
1768
2018
  if (!this.inPlot(t, e)) {
1769
2019
  this.pointerLeave();
1770
2020
  return;
1771
2021
  }
1772
- const i = this.hitTest(t, e);
1773
- if (i === null) {
2022
+ if (this.tooltip === null) {
2023
+ const r = this.layout.axes.find((a) => a.orientation === "x");
2024
+ r !== void 0 && this.share({ axisId: r.id, value: r.scale.fromPx(t) });
2025
+ return;
2026
+ }
2027
+ const n = this.hitTest(t, e);
2028
+ if (n === null) {
1774
2029
  this.pointerLeave();
1775
2030
  return;
1776
2031
  }
1777
- const r = i.key;
1778
- this.hover = i.state, this.hover.mouseX = t, this.hover.mouseY = e, this.markOverlayDirty(), r !== this.hoverKey && (this.hoverKey = r, this.hoverXLabel = i.xLabel, this.pushHoverSnapshot());
2032
+ const s = n.key;
2033
+ this.hover = n.state, this.hover.mouseX = t, this.hover.mouseY = e, this.markOverlayDirty();
2034
+ const o = this.findAxis("x", n.primary.entry.config.xAxisId);
2035
+ if (o !== null && this.share({ axisId: o.id, value: o.scale.fromPx(n.state.hit.xPx) }), s !== this.hoverKey) {
2036
+ const r = n.primary.entry.config.xAxisId;
2037
+ this.hoverKey = s, this.hoverXLabel = this.xLabel(r, n.primary.xValue, Kn(n.primary)), this.hoverRows = n.chosen.map((a) => this.tooltipRow(a, r)), this.pushHoverSnapshot();
2038
+ }
1779
2039
  }
1780
2040
  pointerLeave() {
1781
- this.hover === null && this.hoverKey === "" || (this.hover = null, this.hoverKey = "", this.markOverlayDirty(), this.pushHoverSnapshot());
2041
+ this.share(null), !(this.hover === null && this.hoverKey === "") && (this.hover = null, this.hoverKey = "", this.markOverlayDirty(), this.pushHoverSnapshot());
1782
2042
  }
1783
2043
  hitTest(t, e) {
1784
- var y;
1785
- const i = ((y = this.tooltip) == null ? void 0 : y.mode) ?? "x", r = [];
1786
- if (this.seriesInOrder().forEach((f, b) => {
1787
- const k = f.materialized;
1788
- if (k === null || k.length === 0) return;
1789
- const w = f.config, I = this.findAxis("x", w.xAxisId), A = this.findAxis("y", w.yAxisId);
1790
- if (I === null || A === null) return;
1791
- const F = I.scale.fromPx(t), P = A.scale.fromPx(e), N = this.hitIn(f, k, I, A, e, F, P);
1792
- N !== null && r.push({
1793
- entry: f,
1794
- index: N.index,
1795
- color: N.color ?? this.colorFor(f, b),
1796
- name: this.nameFor(f, b),
1797
- px: N.px,
1798
- py: N.py,
1799
- xValue: N.xValue,
1800
- yValue: N.yValue,
1801
- marked: N.marked,
1802
- areal: N.areal,
1803
- value: N.value,
1804
- segment: N.segment
2044
+ var m;
2045
+ const n = ((m = this.tooltip) == null ? void 0 : m.mode) ?? "x", s = [];
2046
+ if (this.seriesInOrder().forEach((c, p) => {
2047
+ const y = c.materialized;
2048
+ if (y === null || y.length === 0 || c.config.hidden === !0) return;
2049
+ const g = c.config, b = this.findAxis("x", g.xAxisId), N = this.findAxis("y", g.yAxisId);
2050
+ if (b === null || N === null) return;
2051
+ const A = b.scale.fromPx(t), $ = N.scale.fromPx(e), w = this.hitIn(c, y, b, N, e, A, $, n);
2052
+ w !== null && s.push({
2053
+ entry: c,
2054
+ index: w.index,
2055
+ color: w.color ?? this.colorFor(c),
2056
+ name: this.nameFor(c, p),
2057
+ px: w.px,
2058
+ py: w.py,
2059
+ xValue: w.xValue,
2060
+ yValue: w.yValue,
2061
+ marked: w.marked,
2062
+ areal: w.areal,
2063
+ value: w.value,
2064
+ segment: w.segment
1805
2065
  });
1806
- }), r.length === 0) return null;
1807
- const o = r.filter((f) => !f.areal), s = o.length > 0 ? o : r;
1808
- let a = s[0];
1809
- if (i === "nearest") {
1810
- let f = Number.POSITIVE_INFINITY;
1811
- for (const b of r) {
1812
- const k = b.areal ? 0 : b.px - t, w = b.areal ? 0 : b.py - e, I = k * k + w * w;
1813
- I < f && (f = I, a = b);
2066
+ }), s.length === 0) return null;
2067
+ const o = s.filter((c) => !c.areal), r = o.length > 0 ? o : s;
2068
+ let a = r[0];
2069
+ if (n === "nearest") {
2070
+ let c = Number.POSITIVE_INFINITY;
2071
+ for (const p of o) {
2072
+ const y = p.px - t, g = p.py - e, b = y * y + g * g;
2073
+ b < c && (c = b, a = p);
2074
+ }
2075
+ if (c > ge * ge) {
2076
+ for (const p of s)
2077
+ if (p.areal) {
2078
+ a = p;
2079
+ break;
2080
+ }
1814
2081
  }
1815
2082
  } else {
1816
- let f = Number.POSITIVE_INFINITY;
1817
- for (const b of s) {
1818
- const k = Math.abs(b.px - t);
1819
- k < f && (f = k, a = b);
2083
+ let c = Number.POSITIVE_INFINITY;
2084
+ for (const p of r) {
2085
+ const y = Math.abs(p.px - t);
2086
+ y < c && (c = y, a = p);
1820
2087
  }
1821
2088
  }
1822
- const l = i === "nearest" ? [a] : r.filter(
2089
+ const l = n === "nearest" ? [a] : s.filter(
1823
2090
  // An area is always included: it covers the pointer, otherwise it
1824
2091
  // would not have reported a hit at all. Only points have to share the
1825
2092
  // x position.
1826
- (f) => f.areal || Math.abs(f.px - a.px) <= yn
1827
- ), c = l.map((f) => ({
1828
- seriesName: f.name,
1829
- color: f.color,
1830
- yValue: f.yValue,
1831
- datum: (f.entry.config.data ?? this.data)[f.index],
1832
- index: f.index,
1833
- value: f.value,
1834
- segment: f.segment
1835
- })), h = {
2093
+ (c) => c.areal || Math.abs(c.px - a.px) <= Gn
2094
+ ), u = l.map((c) => ({
2095
+ seriesName: c.name,
2096
+ color: c.color,
2097
+ xValue: c.xValue,
2098
+ yValue: c.yValue,
2099
+ datum: (c.entry.config.data ?? this.data)[c.index],
2100
+ index: c.index,
2101
+ value: c.value,
2102
+ segment: c.segment
2103
+ })), f = {
1836
2104
  hit: {
1837
2105
  xValue: a.xValue,
1838
- points: c,
1839
- xPx: a.px,
2106
+ points: u,
2107
+ // An area's px is the beginning of its section; the crosshair and the
2108
+ // tooltip stay with the pointer instead.
2109
+ xPx: a.areal ? t : a.px,
1840
2110
  yPx: a.py
1841
2111
  },
1842
- marker: l.filter((f) => f.marked).map((f) => ({ x: f.px, y: f.py, color: f.color })),
2112
+ marker: l.filter((c) => c.marked).map((c) => ({ x: c.px, y: c.py, color: c.color })),
1843
2113
  mouseX: t,
1844
2114
  mouseY: e
1845
- }, p = l.map((f) => `${f.entry.order}:${f.index}`).join("|"), d = this.findAxis("x", a.entry.config.xAxisId), m = d === null ? String(a.xValue) : d.format(a.xValue);
1846
- return { key: p, state: h, xLabel: m };
2115
+ };
2116
+ return { key: l.map((c) => `${c.entry.order}:${c.index}`).join("|"), state: f, primary: a, chosen: l };
2117
+ }
2118
+ setSyncId(t) {
2119
+ if (t !== this.syncId) {
2120
+ if (this.syncId !== null) {
2121
+ this.share(null);
2122
+ const e = lt.get(this.syncId);
2123
+ e == null || e.delete(this), (e == null ? void 0 : e.size) === 0 && lt.delete(this.syncId), this.synced = null, this.markOverlayDirty();
2124
+ }
2125
+ if (this.syncId = t, t !== null) {
2126
+ const e = lt.get(t) ?? /* @__PURE__ */ new Set();
2127
+ e.add(this), lt.set(t, e);
2128
+ }
2129
+ }
2130
+ }
2131
+ share(t) {
2132
+ var e, n;
2133
+ if (!(this.syncId === null || (t == null ? void 0 : t.value) === ((e = this.sent) == null ? void 0 : e.value) && (t == null ? void 0 : t.axisId) === ((n = this.sent) == null ? void 0 : n.axisId))) {
2134
+ this.sent = t;
2135
+ for (const s of lt.get(this.syncId) ?? [])
2136
+ s !== this && (s.synced = t, s.markOverlayDirty());
2137
+ }
2138
+ }
2139
+ /** The crosshair a synced position asks for, in this chart's pixels. */
2140
+ syncedPx() {
2141
+ const t = this.synced;
2142
+ if (t === null) return null;
2143
+ const e = this.findAxis("x", t.axisId) ?? this.layout.axes.find((n) => n.orientation === "x") ?? null;
2144
+ return e === null ? null : e.scale.toPx(t.value);
2145
+ }
2146
+ hasZoom() {
2147
+ for (const { config: t } of this.axes.values())
2148
+ if (t.orientation === "x" && t.onDomainChange !== void 0) return !0;
2149
+ return !1;
2150
+ }
2151
+ /** The x axes a gesture speaks to. */
2152
+ zoomAxes() {
2153
+ const t = [];
2154
+ for (const { config: e } of this.axesInOrder()) {
2155
+ if (e.orientation !== "x" || e.onDomainChange === void 0) continue;
2156
+ const n = this.findAxis("x", e.id);
2157
+ n !== null && t.push({ config: e, layout: n });
2158
+ }
2159
+ return t;
2160
+ }
2161
+ propose(t) {
2162
+ var e;
2163
+ for (const { config: n, layout: s } of this.zoomAxes()) {
2164
+ const o = t(this.proposed.get(n.id) ?? s.scale.domain, n.id);
2165
+ !(o[1] - o[0] > 0) || !Number.isFinite(o[1] - o[0]) || (this.proposed.set(n.id, o), (e = n.onDomainChange) == null || e.call(n, o));
2166
+ }
2167
+ }
2168
+ /** Zoom by `factor` (below 1 is closer) around a pixel, which keeps its
2169
+ value. */
2170
+ zoomAt(t, e) {
2171
+ const n = this.layout.plot, s = n.width > 0 ? Math.min(1, Math.max(0, (t - n.x) / n.width)) : 0.5;
2172
+ this.propose(([o, r]) => {
2173
+ const a = o + s * (r - o), l = (r - o) * e;
2174
+ return [a - s * l, a - s * l + l];
2175
+ });
2176
+ }
2177
+ /** Pan by a distance in pixels; positive moves the content right. */
2178
+ panBy(t) {
2179
+ const e = this.layout.plot.width;
2180
+ e <= 0 || t === 0 || this.propose(([n, s]) => {
2181
+ const o = -t / e * (s - n);
2182
+ return [n + o, s + o];
2183
+ });
2184
+ }
2185
+ wheel(t) {
2186
+ if (!this.hasZoom()) return;
2187
+ const e = t.deltaMode === 1 ? 16 : t.deltaMode === 2 ? this.layout.plot.width : 1, n = t.deltaX * e, s = t.deltaY * e;
2188
+ t.ctrlKey || t.metaKey ? (t.preventDefault(), this.zoomAt(t.offsetX, Math.exp(s * (Math.abs(s) < 50 ? 0.01 : 15e-4)))) : (Math.abs(n) > Math.abs(s) || t.shiftKey) && (t.preventDefault(), this.panBy(-(t.shiftKey && n === 0 ? s : n)));
2189
+ }
2190
+ pointerDown(t) {
2191
+ var e, n;
2192
+ this.hasZoom() && (t.pointerType !== "touch" && t.button !== 0 || (this.pointers.set(t.pointerId, t.offsetX), (n = (e = this.container) == null ? void 0 : e.setPointerCapture) == null || n.call(e, t.pointerId), this.pointers.size === 2 && (this.pinch = this.pinchWidth())));
2193
+ }
2194
+ /** A drag pans, two fingers pinch. */
2195
+ drag(t) {
2196
+ const e = this.pointers.get(t.pointerId);
2197
+ if (e === void 0) return;
2198
+ if (this.pointers.set(t.pointerId, t.offsetX), this.pointers.size === 1) {
2199
+ this.panBy(t.offsetX - e);
2200
+ return;
2201
+ }
2202
+ const n = this.pinchWidth();
2203
+ if (this.pinch > 0 && n > 0) {
2204
+ const [s = 0, o = 0] = this.pointers.values();
2205
+ this.zoomAt((s + o) / 2, this.pinch / n);
2206
+ }
2207
+ this.pinch = n;
2208
+ }
2209
+ pointerUp(t) {
2210
+ this.pointers.delete(t.pointerId), this.pinch = this.pinchWidth();
2211
+ }
2212
+ pinchWidth() {
2213
+ const [t, e] = this.pointers.values();
2214
+ return t === void 0 || e === void 0 ? 0 : Math.abs(t - e);
2215
+ }
2216
+ /** The whole data range: the extent the axis has without a domain. */
2217
+ doubleClick() {
2218
+ this.propose((t, e) => {
2219
+ const [n, s] = this.axisExtent("x", e);
2220
+ return [n, s];
2221
+ });
2222
+ }
2223
+ /** An x value in the format of its x axis - the header's, or a point's own. */
2224
+ xLabel(t, e, n = !1) {
2225
+ const s = this.findAxis("x", t);
2226
+ return s === null ? String(e) : s.format(e, n);
2227
+ }
2228
+ /** What the built-in tooltip writes for one hit. A state has a name and no
2229
+ meaningful number; a cell has a number that is not its y position, and so
2230
+ no y axis' format; every other value is read against its y axis and
2231
+ written in its format. A series' own `format` comes before either. */
2232
+ tooltipRow(t, e) {
2233
+ var a, l;
2234
+ const n = t.entry.config, s = (a = t.segment) == null ? void 0 : a.label;
2235
+ let o;
2236
+ if (s !== void 0 && s !== "") o = s;
2237
+ else if (t.value !== void 0) o = (n.format ?? ee)(t.value);
2238
+ else {
2239
+ const u = n.format ?? ((l = this.findAxisConfig("y", n.yAxisId)) == null ? void 0 : l.tickFormat);
2240
+ o = u === void 0 ? ee(t.yValue) : u(t.yValue);
2241
+ }
2242
+ const r = n.xAxisId === e ? "" : this.xLabel(n.xAxisId, t.xValue);
2243
+ return { value: o, x: r };
1847
2244
  }
1848
2245
  /** The hit of one series - one different question per kind.
1849
2246
 
1850
- Every mark that is a point asks "which point lies nearest". A band, a cell
1851
- and a span ask "what lies under the pointer", and that is not the same
1852
- question: for the right half of every segment the nearest point gives the
1853
- wrong answer. */
1854
- hitIn(t, e, i, r, o, s, a) {
1855
- const l = t.config, c = e.length;
1856
- if (l.kind === "state") {
1857
- const d = this.lanePx(l, r);
1858
- if (o < d.top || o > d.bottom) return null;
1859
- const m = Ge(e.x, c, s);
1860
- if (m < 0) return null;
1861
- const y = e.y[m];
2247
+ Every mark that is a point asks "which point lies nearest". A band and a
2248
+ cell ask "what lies under the pointer", and that is not the same question:
2249
+ for the right half of every segment the nearest point gives the wrong
2250
+ answer. */
2251
+ hitIn(t, e, n, s, o, r, a, l) {
2252
+ const u = t.config, d = e.length;
2253
+ if (u.kind === "state") {
2254
+ const c = this.lanePx(u, s);
2255
+ if (o < c.top || o > c.bottom) return null;
2256
+ const p = he(e.x, d, r);
2257
+ if (p < 0) return null;
2258
+ const y = e.y[p];
1862
2259
  if (Number.isNaN(y)) return null;
1863
- const f = e.x[m], b = le(e.x, c, m, i.scale.domain[1]), k = l.states[y | 0];
2260
+ const g = e.x[p], b = Fe(e.x, d, p, this.lastEnd(t, e, n));
2261
+ if (p === d - 1 && !(r < b)) return null;
2262
+ const N = u.states[y | 0];
1864
2263
  return {
1865
- index: m,
1866
- px: i.scale.toPx(f),
1867
- py: (d.top + d.bottom) / 2,
1868
- xValue: f,
2264
+ index: p,
2265
+ px: n.scale.toPx(g),
2266
+ py: (c.top + c.bottom) / 2,
2267
+ xValue: g,
1869
2268
  yValue: y,
1870
2269
  marked: !1,
1871
2270
  areal: !0,
1872
- color: k == null ? void 0 : k.color,
1873
- segment: { from: f, to: b, label: (k == null ? void 0 : k.label) ?? "", open: !1 }
2271
+ color: N == null ? void 0 : N.color,
2272
+ segment: { from: g, to: b, label: (N == null ? void 0 : N.label) ?? "" }
1874
2273
  };
1875
2274
  }
1876
- if (l.kind === "span") {
1877
- const d = e.x1;
1878
- if (d === null) return null;
1879
- const m = i.scale.domain[1], y = l.height ?? 0.6, f = Ke(
2275
+ if (u.kind === "matrix") {
2276
+ const c = Cn(
1880
2277
  e.x,
1881
- d,
1882
2278
  e.y,
1883
- c,
1884
- s,
1885
- a,
1886
- y,
1887
- m,
1888
- t.depth,
1889
- // The drawing moves a covering span down the screen; in lane units that
1890
- // way carries the sign of the y scale's slope.
1891
- ce * y * Math.sign(r.scale.m)
1892
- );
1893
- if (f < 0) return null;
1894
- const b = e.x[f], k = e.y[f], w = d[f];
1895
- return {
1896
- index: f,
1897
- px: i.scale.toPx(b),
1898
- py: r.scale.toPx(k),
1899
- xValue: b,
1900
- yValue: k,
1901
- marked: !1,
1902
- areal: !0,
1903
- segment: {
1904
- from: b,
1905
- to: ot(w, m),
1906
- label: "",
1907
- open: ue(w)
1908
- }
1909
- };
1910
- }
1911
- if (l.kind === "matrix") {
1912
- const d = sn(
1913
- e.x,
1914
- e.y,
1915
- c,
1916
- s,
2279
+ d,
2280
+ r,
1917
2281
  a,
1918
- ct(t.step ?? 0, i.scale.domain[1] - i.scale.domain[0]),
1919
- ct(t.cellHeight ?? 0, r.scale.domain[1] - r.scale.domain[0])
2282
+ yt(t.step ?? 0, n.scale.domain[1] - n.scale.domain[0]),
2283
+ yt(t.cellHeight ?? 0, s.scale.domain[1] - s.scale.domain[0])
1920
2284
  );
1921
- if (d < 0) return null;
1922
- const m = e.w, y = m === null ? Number.NaN : m[d];
2285
+ if (c < 0) return null;
2286
+ const p = e.w, y = p === null ? Number.NaN : p[c];
1923
2287
  if (!Number.isFinite(y)) return null;
1924
- const f = e.x[d], b = e.y[d];
1925
- return {
1926
- index: d,
1927
- px: i.scale.toPx(f),
1928
- py: r.scale.toPx(b),
1929
- xValue: f,
2288
+ const g = e.x[c], b = e.y[c], N = Ot(u.coloring, this.theme ?? O);
2289
+ return t.buckets ?? (t.buckets = xe(e, u.coloring, N.length)), {
2290
+ index: c,
2291
+ px: n.scale.toPx(g),
2292
+ py: s.scale.toPx(b),
2293
+ color: N[t.buckets[c]],
2294
+ xValue: g,
1930
2295
  // yValue stays the position on the y axis; the value that carries the
1931
2296
  // colour stands in a field of its own. Colour alone can transport no
1932
2297
  // number - which is why the tooltip has to carry it.
@@ -1936,16 +2301,16 @@ class he {
1936
2301
  areal: !0
1937
2302
  };
1938
2303
  }
1939
- const u = on(e.x, c, s);
1940
- if (u < 0) return null;
1941
- const h = e.y[u];
2304
+ const f = u.kind === "scatter" && l === "nearest" ? En(e.x, e.y, d, r, a, n.scale, s.scale) : u.kind === "line" && u.step === !0 ? he(e.x, d, r) : De(e.x, d, r);
2305
+ if (f < 0) return null;
2306
+ const h = e.y[f];
1942
2307
  if (Number.isNaN(h)) return null;
1943
- const p = e.x[u];
2308
+ const m = e.x[f];
1944
2309
  return {
1945
- index: u,
1946
- px: i.scale.toPx(p),
1947
- py: r.scale.toPx(h),
1948
- xValue: p,
2310
+ index: f,
2311
+ px: n.scale.toPx(m),
2312
+ py: s.scale.toPx(h),
2313
+ xValue: m,
1949
2314
  yValue: h,
1950
2315
  marked: !0,
1951
2316
  areal: !1
@@ -1961,20 +2326,34 @@ class he {
1961
2326
  t.style.opacity = "0";
1962
2327
  return;
1963
2328
  }
1964
- const i = t.offsetWidth, r = t.offsetHeight;
2329
+ const n = t.offsetWidth, s = t.offsetHeight;
1965
2330
  let o = e.hit.xPx + 12;
1966
- o + i > this.cssWidth && (o = e.hit.xPx - 12 - i), o < 0 && (o = 0);
1967
- let s = e.mouseY - r / 2;
1968
- s = Math.min(Math.max(s, 0), Math.max(0, this.cssHeight - r)), t.style.transform = `translate3d(${Math.round(o)}px, ${Math.round(s)}px, 0)`, t.style.opacity = "1";
2331
+ o + n > this.cssWidth && (o = e.hit.xPx - 12 - n), o < 0 && (o = 0);
2332
+ let r = e.mouseY - s / 2;
2333
+ r = Math.min(Math.max(r, 0), Math.max(0, this.cssHeight - s)), t.style.transform = `translate3d(${Math.round(o)}px, ${Math.round(r)}px, 0)`, t.style.opacity = "1";
1969
2334
  }
1970
2335
  /* ================= Snapshots for the HTML layer ================= */
2336
+ /** Does a visible series have a point to show - a y that is no gap, and for
2337
+ a cell a value? A chart without one says so rather than draw an empty
2338
+ frame on [0, 1]. Stops at the first point found. */
2339
+ showsAPoint() {
2340
+ for (const t of this.series.values()) {
2341
+ const e = t.materialized;
2342
+ if (!(e === null || t.config.hidden === !0)) {
2343
+ for (let n = 0; n < e.length; n++)
2344
+ if (!Number.isNaN(e.y[n]) && (e.w === null || Number.isFinite(e.w[n]))) return !0;
2345
+ }
2346
+ }
2347
+ return !1;
2348
+ }
1971
2349
  pushLayoutSnapshot() {
1972
2350
  this.layoutSnapshot = {
1973
2351
  version: this.layoutSnapshot.version + 1,
1974
2352
  layout: this.layout,
1975
2353
  legend: this.legend,
1976
2354
  series: this.legendItems(),
1977
- limits: this.limitLabels()
2355
+ limits: this.limitLabels(),
2356
+ empty: !this.showsAPoint()
1978
2357
  };
1979
2358
  for (const t of this.layoutSubscribers) t();
1980
2359
  }
@@ -1983,121 +2362,122 @@ class he {
1983
2362
  version: this.hoverSnapshot.version + 1,
1984
2363
  hover: this.hover,
1985
2364
  tooltip: this.tooltip,
1986
- xLabel: this.hoverXLabel
2365
+ xLabel: this.hoverXLabel,
2366
+ rows: this.hoverRows
1987
2367
  };
1988
2368
  for (const t of this.hoverSubscribers) t();
1989
2369
  }
1990
2370
  }
1991
2371
  /** Class name of the measuring span for tick labels - keeps the CSS and the
1992
2372
  layout in step. */
1993
- g(he, "classTick", it);
1994
- const de = ve(null);
1995
- function tt(n) {
1996
- const t = ke(de);
1997
- if (t === null && rt)
2373
+ x(Ee, "classTick", it);
2374
+ const Pe = _e(null);
2375
+ function rt(i) {
2376
+ const t = Ye(Pe);
2377
+ if (t === null && ht)
1998
2378
  throw new Error(
1999
- `@umriss-ui/charts: <${n}> must be used inside a <Chart>.`
2379
+ `@umriss-ui/charts: <${i}> must be used inside a <Chart>.`
2000
2380
  );
2001
2381
  return t;
2002
2382
  }
2003
- function j(n, t) {
2004
- const e = tt(n), i = Z(null);
2005
- $(() => {
2383
+ function at(i, t) {
2384
+ const e = rt(i), n = Q(null);
2385
+ C(() => {
2006
2386
  if (e !== null)
2007
- return i.current = e.registerSeries(t), () => {
2008
- i.current !== null && e.unregisterSeries(i.current), i.current = null;
2387
+ return n.current = e.registerSeries(t), () => {
2388
+ n.current !== null && e.unregisterSeries(n.current), n.current = null;
2009
2389
  };
2010
- }, [e]), $(() => {
2011
- e !== null && i.current !== null && e.updateSeries(i.current, t);
2390
+ }, [e]), C(() => {
2391
+ e !== null && n.current !== null && e.updateSeries(n.current, t);
2012
2392
  });
2013
2393
  }
2014
- function fe(n, t) {
2015
- const e = tt(n), i = Z(null);
2016
- $(() => {
2394
+ function Ce(i, t) {
2395
+ const e = rt(i), n = Q(null);
2396
+ C(() => {
2017
2397
  if (e !== null)
2018
- return i.current = e.registerAxis(t), () => {
2019
- i.current !== null && e.unregisterAxis(i.current), i.current = null;
2398
+ return n.current = e.registerAxis(t), () => {
2399
+ n.current !== null && e.unregisterAxis(n.current), n.current = null;
2020
2400
  };
2021
- }, [e]), $(() => {
2022
- e !== null && i.current !== null && e.updateAxis(i.current, t);
2401
+ }, [e]), C(() => {
2402
+ e !== null && n.current !== null && e.updateAxis(n.current, t);
2023
2403
  });
2024
2404
  }
2025
- function me(n, t) {
2026
- const e = tt(n), i = Z(null);
2027
- $(() => {
2405
+ function $e(i, t) {
2406
+ const e = rt(i), n = Q(null);
2407
+ C(() => {
2028
2408
  if (e !== null)
2029
- return i.current = e.registerLimit(t), () => {
2030
- i.current !== null && e.unregisterLimit(i.current), i.current = null;
2409
+ return n.current = e.registerLimit(t), () => {
2410
+ n.current !== null && e.unregisterLimit(n.current), n.current = null;
2031
2411
  };
2032
- }, [e]), $(() => {
2033
- e !== null && i.current !== null && e.updateLimit(i.current, t);
2412
+ }, [e]), C(() => {
2413
+ e !== null && n.current !== null && e.updateLimit(n.current, t);
2034
2414
  });
2035
2415
  }
2036
- function Ln(n, t) {
2037
- const e = tt(n);
2038
- $(() => {
2416
+ function ni(i, t) {
2417
+ const e = rt(i);
2418
+ C(() => {
2039
2419
  if (e !== null)
2040
2420
  return e.registerLegend(t), () => e.unregisterLegend();
2041
- }, [e]), $(() => {
2421
+ }, [e]), C(() => {
2042
2422
  e == null || e.updateLegend(t);
2043
2423
  });
2044
2424
  }
2045
- function Tn(n, t) {
2046
- const e = tt(n);
2047
- $(() => {
2425
+ function ii(i, t) {
2426
+ const e = rt(i);
2427
+ C(() => {
2048
2428
  if (e !== null)
2049
2429
  return e.registerTooltip(t), () => e.unregisterTooltip();
2050
- }, [e]), $(() => {
2430
+ }, [e]), C(() => {
2051
2431
  e == null || e.updateTooltip(t);
2052
2432
  });
2053
2433
  }
2054
- function An(n, t) {
2055
- const { band: e, position: i, orientation: r } = n, o = {
2434
+ function si(i, t) {
2435
+ const { band: e, position: n, orientation: s } = i, o = {
2056
2436
  left: `${e.x}px`,
2057
2437
  top: `${e.y}px`,
2058
2438
  width: `${e.width}px`,
2059
2439
  height: `${e.height}px`
2060
- }, s = Lt + Tt;
2061
- return /* @__PURE__ */ _(
2440
+ }, r = zt + Bt;
2441
+ return /* @__PURE__ */ G(
2062
2442
  "div",
2063
2443
  {
2064
- className: `uc-axis uc-axis-${r} uc-axis-${i}`,
2444
+ className: `uc-axis uc-axis-${s} uc-axis-${n}`,
2065
2445
  style: o,
2066
- "data-axis": n.id,
2446
+ "data-axis": i.id,
2067
2447
  children: [
2068
- /* @__PURE__ */ S("span", { className: "uc-axis-line" }),
2069
- n.ticks.map((a) => {
2070
- if (r === "y") {
2071
- const c = Math.round(a.px - e.y);
2072
- return /* @__PURE__ */ _("span", { className: "uc-tick", style: { top: `${c}px` }, children: [
2073
- /* @__PURE__ */ S("span", { className: "uc-tick-mark" }),
2074
- /* @__PURE__ */ S(
2448
+ /* @__PURE__ */ I("span", { className: "uc-axis-line" }),
2449
+ i.ticks.map((a) => {
2450
+ if (s === "y") {
2451
+ const u = Math.round(a.px - e.y);
2452
+ return /* @__PURE__ */ G("span", { className: "uc-tick", style: { top: `${u}px` }, children: [
2453
+ /* @__PURE__ */ I("span", { className: "uc-tick-mark" }),
2454
+ /* @__PURE__ */ I(
2075
2455
  "span",
2076
2456
  {
2077
2457
  className: "uc-tick-label",
2078
- style: { [i === "left" ? "right" : "left"]: `${s}px` },
2458
+ style: { [n === "left" ? "right" : "left"]: `${r}px` },
2079
2459
  children: a.label
2080
2460
  }
2081
2461
  )
2082
2462
  ] }, a.value);
2083
2463
  }
2084
2464
  const l = Math.round(a.px - e.x);
2085
- return /* @__PURE__ */ _("span", { className: "uc-tick", style: { left: `${l}px` }, children: [
2086
- /* @__PURE__ */ S("span", { className: "uc-tick-mark" }),
2087
- /* @__PURE__ */ S(
2465
+ return /* @__PURE__ */ G("span", { className: "uc-tick", style: { left: `${l}px` }, children: [
2466
+ /* @__PURE__ */ I("span", { className: "uc-tick-mark" }),
2467
+ /* @__PURE__ */ I(
2088
2468
  "span",
2089
2469
  {
2090
2470
  className: "uc-tick-label",
2091
2471
  style: {
2092
2472
  left: `${Math.round(a.labelLeft - e.x) - l}px`,
2093
- [i === "top" ? "bottom" : "top"]: `${s}px`
2473
+ [n === "top" ? "bottom" : "top"]: `${r}px`
2094
2474
  },
2095
2475
  children: a.label
2096
2476
  }
2097
2477
  )
2098
2478
  ] }, a.value);
2099
2479
  }),
2100
- n.breaks.map((a, l) => /* @__PURE__ */ S(
2480
+ i.breaks.map((a, l) => /* @__PURE__ */ I(
2101
2481
  "span",
2102
2482
  {
2103
2483
  className: "uc-break",
@@ -2107,7 +2487,7 @@ function An(n, t) {
2107
2487
  `break-${l}`
2108
2488
  )),
2109
2489
  t.map(
2110
- (a) => r === "y" ? /* @__PURE__ */ S(
2490
+ (a) => s === "y" ? /* @__PURE__ */ I(
2111
2491
  "span",
2112
2492
  {
2113
2493
  className: "uc-limit-label",
@@ -2117,297 +2497,345 @@ function An(n, t) {
2117
2497
  children: a.label
2118
2498
  },
2119
2499
  `limit-${a.id}`
2120
- ) : /* @__PURE__ */ S(
2500
+ ) : /* @__PURE__ */ I(
2121
2501
  "span",
2122
2502
  {
2123
2503
  className: "uc-limit-label",
2124
2504
  "data-severity": a.severity,
2125
2505
  "data-role": a.role,
2126
2506
  style: {
2127
- left: `${Math.round(a.px - e.x)}px`,
2128
- [i === "top" ? "bottom" : "top"]: `${s}px`
2507
+ left: `${Math.round(a.labelLeft - e.x)}px`,
2508
+ [n === "top" ? "bottom" : "top"]: `${r}px`
2129
2509
  },
2130
2510
  children: a.label
2131
2511
  },
2132
2512
  `limit-${a.id}`
2133
2513
  )
2134
2514
  ),
2135
- n.label !== void 0 && n.label !== "" && /* @__PURE__ */ S("span", { className: "uc-axis-title", children: n.label })
2515
+ i.label !== void 0 && i.label !== "" && /* @__PURE__ */ I("span", { className: "uc-axis-title", children: i.label })
2136
2516
  ]
2137
2517
  },
2138
- n.key
2518
+ i.key
2139
2519
  );
2140
2520
  }
2141
- function Fn({ scene: n }) {
2142
- const t = Et(
2143
- n.subscribeLayout,
2144
- n.getLayoutSnapshot,
2145
- n.getLayoutServerSnapshot
2146
- ), { layout: e } = t;
2147
- return e.plot.width <= 0 || e.plot.height <= 0 ? null : /* @__PURE__ */ S("div", { className: "uc-axes", children: e.axes.map(
2148
- (i) => An(
2149
- i,
2150
- t.limits.filter((r) => r.axisKey === i.key)
2521
+ function oi({ scene: i, empty: t }) {
2522
+ const e = Kt(
2523
+ i.subscribeLayout,
2524
+ i.getLayoutSnapshot,
2525
+ i.getLayoutServerSnapshot
2526
+ ), { layout: n } = e;
2527
+ if (n.plot.width <= 0 || n.plot.height <= 0) return null;
2528
+ const { plot: s } = n;
2529
+ return /* @__PURE__ */ G("div", { className: "uc-axes", children: [
2530
+ e.empty && /* @__PURE__ */ I(
2531
+ "div",
2532
+ {
2533
+ className: "uc-empty",
2534
+ style: { left: `${s.x}px`, top: `${s.y}px`, width: `${s.width}px`, height: `${s.height}px` },
2535
+ children: t
2536
+ }
2537
+ ),
2538
+ n.axes.map(
2539
+ (o) => si(
2540
+ o,
2541
+ e.limits.filter((r) => r.axisKey === o.key)
2542
+ )
2151
2543
  )
2152
- ) });
2544
+ ] });
2153
2545
  }
2154
- function Pn(n) {
2155
- var e;
2156
- const t = (e = n.segment) == null ? void 0 : e.label;
2157
- return t !== void 0 && t !== "" ? t : n.value !== void 0 ? Bt(n.value) : Bt(n.yValue);
2158
- }
2159
- function En({ scene: n }) {
2160
- const t = Et(
2161
- n.subscribeHover,
2162
- n.getHoverSnapshot,
2163
- n.getHoverServerSnapshot
2164
- ), e = Ne(
2165
- (r) => {
2166
- n.bindTooltip(r);
2546
+ function ri({ scene: i }) {
2547
+ const t = Kt(
2548
+ i.subscribeHover,
2549
+ i.getHoverSnapshot,
2550
+ i.getHoverServerSnapshot
2551
+ ), e = ze(
2552
+ (s) => {
2553
+ i.bindTooltip(s);
2167
2554
  },
2168
- [n]
2555
+ [i]
2169
2556
  );
2170
- if ($(() => {
2171
- n.markOverlayDirty();
2172
- }, [n, t.version]), t.tooltip === null) return null;
2173
- const i = t.hover;
2174
- return /* @__PURE__ */ S("div", { className: "uc-tooltip", ref: e, role: "presentation", children: i === null ? null : t.tooltip.render !== void 0 ? t.tooltip.render(i.hit) : /* @__PURE__ */ _(Nt, { children: [
2175
- /* @__PURE__ */ S("div", { className: "uc-tooltip-head", children: t.xLabel }),
2176
- /* @__PURE__ */ S("div", { className: "uc-tooltip-list", children: i.hit.points.map((r) => /* @__PURE__ */ _("div", { className: "uc-tooltip-row", children: [
2177
- /* @__PURE__ */ S("span", { className: "uc-tooltip-chip", style: { background: r.color } }),
2178
- /* @__PURE__ */ S("span", { className: "uc-tooltip-name", children: r.seriesName }),
2179
- /* @__PURE__ */ S("span", { className: "uc-tooltip-value", children: Pn(r) })
2180
- ] }, `${r.seriesName}-${r.index}`)) })
2557
+ if (C(() => {
2558
+ i.markOverlayDirty();
2559
+ }, [i, t.version]), t.tooltip === null) return null;
2560
+ const n = t.hover;
2561
+ return /* @__PURE__ */ I("div", { className: "uc-tooltip", ref: e, role: "presentation", children: n === null ? null : t.tooltip.render !== void 0 ? t.tooltip.render(n.hit) : /* @__PURE__ */ G(bt, { children: [
2562
+ /* @__PURE__ */ I("div", { className: "uc-tooltip-head", children: t.xLabel }),
2563
+ /* @__PURE__ */ I("div", { className: "uc-tooltip-list", children: n.hit.points.map((s, o) => {
2564
+ const r = t.rows[o];
2565
+ return /* @__PURE__ */ G("div", { className: "uc-tooltip-row", children: [
2566
+ /* @__PURE__ */ I("span", { className: "uc-tooltip-chip", style: { background: s.color } }),
2567
+ /* @__PURE__ */ G("span", { className: "uc-tooltip-name", children: [
2568
+ s.seriesName,
2569
+ r !== void 0 && r.x !== "" ? /* @__PURE__ */ I("span", { className: "uc-tooltip-x", children: r.x }) : null
2570
+ ] }),
2571
+ /* @__PURE__ */ I("span", { className: "uc-tooltip-value", children: r == null ? void 0 : r.value })
2572
+ ] }, `${s.seriesName}-${s.index}`);
2573
+ }) })
2181
2574
  ] }) });
2182
2575
  }
2183
- function ti(n) {
2576
+ function Di(i) {
2184
2577
  const {
2185
2578
  data: t,
2186
2579
  width: e = "100%",
2187
- height: i = 300,
2188
- padding: r = 8,
2580
+ height: n = 300,
2581
+ padding: s = 8,
2189
2582
  ariaLabel: o,
2190
- className: s,
2583
+ className: r,
2191
2584
  style: a,
2192
2585
  onPerf: l,
2193
- children: c
2194
- } = n, [u] = we(() => new he()), h = Z(null), p = Z(null), d = Z(null), m = Z(null), y = typeof r == "number" ? void 0 : r, f = typeof r == "number" ? r : void 0, b = f ?? (y == null ? void 0 : y.top), k = f ?? (y == null ? void 0 : y.right), w = f ?? (y == null ? void 0 : y.bottom), I = f ?? (y == null ? void 0 : y.left), A = E(
2586
+ syncId: u,
2587
+ empty: d = "No data",
2588
+ children: f
2589
+ } = i, [h] = be(() => new Ee()), m = Q(null), c = Q(null), p = Q(null), y = Q(null), g = typeof s == "number" ? void 0 : s, b = typeof s == "number" ? s : void 0, N = b ?? (g == null ? void 0 : g.top), A = b ?? (g == null ? void 0 : g.right), $ = b ?? (g == null ? void 0 : g.bottom), w = b ?? (g == null ? void 0 : g.left), W = P(
2195
2590
  () => ({
2196
- top: b ?? 8,
2197
- right: k ?? 8,
2198
- bottom: w ?? 8,
2199
- left: I ?? 8
2591
+ top: N ?? 8,
2592
+ right: A ?? 8,
2593
+ bottom: $ ?? 8,
2594
+ left: w ?? 8
2200
2595
  }),
2201
- [b, k, w, I]
2596
+ [N, A, $, w]
2202
2597
  );
2203
- o === void 0 && q(
2598
+ o === void 0 && J(
2204
2599
  "chart-arialabel",
2205
2600
  "Chart without ariaLabel - please set a meaningful description (R-7.6)."
2206
- ), $(() => {
2207
- const N = h.current, H = p.current, V = d.current, v = m.current;
2208
- if (!N || !H || !V || !v) return;
2209
- u.bind(H, V, v, N);
2210
- const M = H.getBoundingClientRect();
2211
- u.requestResize(M.width, M.height);
2212
- const x = new ResizeObserver((L) => {
2213
- var B;
2214
- const W = L[L.length - 1];
2215
- if (W === void 0) return;
2216
- const D = (B = W.contentBoxSize) == null ? void 0 : B[0];
2217
- D !== void 0 ? u.requestResize(D.inlineSize, D.blockSize) : u.requestResize(W.contentRect.width, W.contentRect.height);
2601
+ ), C(() => {
2602
+ const T = m.current, H = c.current, k = p.current, D = y.current;
2603
+ if (!T || !H || !k || !D) return;
2604
+ h.bind(H, k, D, T);
2605
+ const v = H.getBoundingClientRect();
2606
+ h.requestResize(v.width, v.height);
2607
+ const F = new ResizeObserver((E) => {
2608
+ var U;
2609
+ const z = E[E.length - 1];
2610
+ if (z === void 0) return;
2611
+ const B = (U = z.contentBoxSize) == null ? void 0 : U[0];
2612
+ B !== void 0 ? h.requestResize(B.inlineSize, B.blockSize) : h.requestResize(z.contentRect.width, z.contentRect.height);
2218
2613
  });
2219
- x.observe(H);
2220
- const T = () => u.pointerLeave();
2221
- window.addEventListener("blur", T);
2222
- const C = (L) => {
2223
- H.contains(L.target) || u.pointerLeave();
2614
+ F.observe(H);
2615
+ const R = () => h.pointerLeave();
2616
+ window.addEventListener("blur", R);
2617
+ const M = (E) => {
2618
+ H.contains(E.target) || h.pointerLeave();
2224
2619
  };
2225
- return document.addEventListener("pointerdown", C), () => {
2226
- window.removeEventListener("blur", T), document.removeEventListener("pointerdown", C), x.disconnect(), u.unbind();
2620
+ document.addEventListener("pointerdown", M);
2621
+ const V = (E) => h.wheel(E);
2622
+ return H.addEventListener("wheel", V, { passive: !1 }), () => {
2623
+ H.removeEventListener("wheel", V), window.removeEventListener("blur", R), document.removeEventListener("pointerdown", M), F.disconnect(), h.unbind();
2227
2624
  };
2228
- }, [u]), $(() => {
2229
- u.setData(t);
2230
- }, [u, t]), $(() => {
2231
- u.setPadding(A);
2232
- }, [u, A]), $(() => {
2233
- u.setOnPerf(l ?? null);
2234
- }, [u, l]), $(() => {
2235
- u.validate();
2625
+ }, [h]), C(() => {
2626
+ h.setData(t);
2627
+ }, [h, t]), C(() => {
2628
+ h.setPadding(W);
2629
+ }, [h, W]), C(() => {
2630
+ h.setOnPerf(l ?? null);
2631
+ }, [h, l]), C(() => (h.setSyncId(u ?? null), () => h.setSyncId(null)), [h, u]), C(() => {
2632
+ h.validate();
2236
2633
  });
2237
- const F = {
2634
+ const L = {
2238
2635
  width: e === "100%" ? "100%" : `${e}px`,
2239
- height: `${i}px`,
2636
+ height: `${n}px`,
2240
2637
  ...a
2241
- }, P = (N) => {
2242
- u.pointerMove(N.nativeEvent.offsetX, N.nativeEvent.offsetY);
2638
+ }, S = (T) => {
2639
+ h.drag(T.nativeEvent), h.pointerMove(T.nativeEvent.offsetX, T.nativeEvent.offsetY);
2243
2640
  };
2244
- return /* @__PURE__ */ S(de.Provider, { value: u, children: /* @__PURE__ */ _(
2641
+ return /* @__PURE__ */ I(Pe.Provider, { value: h, children: /* @__PURE__ */ G(
2245
2642
  "div",
2246
2643
  {
2247
- ref: h,
2248
- className: s ? `uc-root ${s}` : "uc-root",
2249
- style: F,
2644
+ ref: m,
2645
+ className: r ? `uc-root ${r}` : "uc-root",
2646
+ style: L,
2250
2647
  children: [
2251
- /* @__PURE__ */ _(
2648
+ /* @__PURE__ */ G(
2252
2649
  "div",
2253
2650
  {
2254
- ref: p,
2651
+ ref: c,
2255
2652
  className: "uc-plot",
2256
2653
  role: "img",
2257
2654
  "aria-label": o,
2258
- onPointerMove: P,
2259
- onPointerDown: P,
2260
- onPointerLeave: (N) => {
2261
- N.pointerType !== "touch" && u.pointerLeave();
2655
+ onPointerMove: S,
2656
+ onPointerDown: (T) => {
2657
+ h.pointerDown(T.nativeEvent), S(T);
2658
+ },
2659
+ onPointerUp: (T) => h.pointerUp(T.nativeEvent),
2660
+ onPointerCancel: (T) => h.pointerUp(T.nativeEvent),
2661
+ onDoubleClick: () => h.doubleClick(),
2662
+ onPointerLeave: (T) => {
2663
+ T.pointerType !== "touch" && h.pointerLeave();
2262
2664
  },
2263
2665
  children: [
2264
- /* @__PURE__ */ S("canvas", { ref: d, className: "uc-layer-series", "aria-hidden": "true" }),
2265
- /* @__PURE__ */ S("canvas", { ref: m, className: "uc-layer-overlay", "aria-hidden": "true" }),
2266
- /* @__PURE__ */ S(Fn, { scene: u }),
2267
- /* @__PURE__ */ S(En, { scene: u })
2666
+ /* @__PURE__ */ I("canvas", { ref: p, className: "uc-layer-series", "aria-hidden": "true" }),
2667
+ /* @__PURE__ */ I("canvas", { ref: y, className: "uc-layer-overlay", "aria-hidden": "true" }),
2668
+ /* @__PURE__ */ I(oi, { scene: h, empty: d }),
2669
+ /* @__PURE__ */ I(ri, { scene: h })
2268
2670
  ]
2269
2671
  }
2270
2672
  ),
2271
- c
2673
+ f
2272
2674
  ]
2273
2675
  }
2274
2676
  ) });
2275
2677
  }
2276
- function ei(n) {
2678
+ function Ei(i) {
2277
2679
  const {
2278
2680
  accessor: t,
2279
2681
  baseline: e,
2280
- xAxisId: i = "x",
2281
- yAxisId: r = "y",
2682
+ xAxisId: n = "x",
2683
+ yAxisId: s = "y",
2282
2684
  data: o,
2283
- name: s,
2284
- color: a,
2285
- fillOpacity: l = 0.18,
2286
- strokeWidth: c = 1.5
2287
- } = n, u = E(
2685
+ name: r,
2686
+ hidden: a,
2687
+ format: l,
2688
+ color: u,
2689
+ tone: d,
2690
+ fillOpacity: f = 0.18,
2691
+ strokeWidth: h = 1.5,
2692
+ dash: m
2693
+ } = i, c = P(
2288
2694
  () => ({
2289
2695
  kind: "area",
2290
2696
  accessor: t,
2291
2697
  baseline: e,
2292
- xAxisId: i,
2293
- yAxisId: r,
2698
+ xAxisId: n,
2699
+ yAxisId: s,
2294
2700
  data: o,
2295
- name: s,
2296
- color: a,
2297
- fillOpacity: l,
2298
- strokeWidth: c
2701
+ name: r,
2702
+ hidden: a,
2703
+ format: l,
2704
+ color: u,
2705
+ tone: d,
2706
+ fillOpacity: f,
2707
+ strokeWidth: h,
2708
+ dash: m
2299
2709
  }),
2300
- [t, e, i, r, o, s, a, l, c]
2710
+ [t, e, n, s, o, r, a, l, u, d, f, h, m]
2301
2711
  );
2302
- return j("Area", u), null;
2712
+ return at("Area", c), null;
2303
2713
  }
2304
- function ni(n) {
2714
+ function Pi(i) {
2305
2715
  const {
2306
2716
  accessor: t,
2307
2717
  xAxisId: e = "x",
2308
- yAxisId: i = "y",
2309
- data: r,
2718
+ yAxisId: n = "y",
2719
+ data: s,
2310
2720
  name: o,
2311
- color: s,
2312
- barWidth: a = 0.8
2313
- } = n, l = E(
2721
+ hidden: r,
2722
+ format: a,
2723
+ color: l,
2724
+ tone: u,
2725
+ barWidth: d = 0.8
2726
+ } = i, f = P(
2314
2727
  () => ({
2315
2728
  kind: "bar",
2316
2729
  accessor: t,
2317
2730
  xAxisId: e,
2318
- yAxisId: i,
2319
- data: r,
2731
+ yAxisId: n,
2732
+ data: s,
2320
2733
  name: o,
2321
- color: s,
2322
- barWidth: a
2734
+ hidden: r,
2735
+ format: a,
2736
+ color: l,
2737
+ tone: u,
2738
+ barWidth: d
2323
2739
  }),
2324
- [t, e, i, r, o, s, a]
2740
+ [t, e, n, s, o, r, a, l, u, d]
2325
2741
  );
2326
- return j("Bar", l), null;
2742
+ return at("Bar", f), null;
2327
2743
  }
2328
- function Dn(n) {
2744
+ function ai(i) {
2329
2745
  const {
2330
2746
  accessor: t,
2331
2747
  xAxisId: e = "x",
2332
- yAxisId: i = "y",
2333
- data: r,
2748
+ yAxisId: n = "y",
2749
+ data: s,
2334
2750
  name: o,
2335
- color: s,
2336
- tone: a,
2337
- strokeWidth: l = 1.5,
2338
- dash: c,
2339
- markers: u = "auto"
2340
- } = n, h = E(
2751
+ hidden: r,
2752
+ format: a,
2753
+ color: l,
2754
+ tone: u,
2755
+ strokeWidth: d = 1.5,
2756
+ dash: f,
2757
+ markers: h = "auto",
2758
+ step: m
2759
+ } = i, c = P(
2341
2760
  () => ({
2342
2761
  kind: "line",
2343
2762
  accessor: t,
2344
2763
  xAxisId: e,
2345
- yAxisId: i,
2346
- data: r,
2764
+ yAxisId: n,
2765
+ data: s,
2347
2766
  name: o,
2348
- color: s,
2349
- tone: a,
2350
- strokeWidth: l,
2351
- dash: c,
2352
- markers: u
2767
+ hidden: r,
2768
+ format: a,
2769
+ color: l,
2770
+ tone: u,
2771
+ strokeWidth: d,
2772
+ dash: f,
2773
+ markers: h,
2774
+ step: m
2353
2775
  }),
2354
- [t, e, i, r, o, s, a, l, c, u]
2776
+ [t, e, n, s, o, r, a, l, u, d, f, h, m]
2355
2777
  );
2356
- return j("Line", h), null;
2778
+ return at("Line", c), null;
2357
2779
  }
2358
- function $n(n) {
2780
+ function li(i) {
2359
2781
  const {
2360
2782
  accessor: t,
2361
2783
  xAxisId: e = "x",
2362
- yAxisId: i = "y",
2363
- data: r,
2784
+ yAxisId: n = "y",
2785
+ data: s,
2364
2786
  name: o,
2365
- color: s,
2366
- tone: a,
2367
- radius: l = 3
2368
- } = n, c = E(
2787
+ hidden: r,
2788
+ format: a,
2789
+ color: l,
2790
+ tone: u,
2791
+ radius: d = 3
2792
+ } = i, f = P(
2369
2793
  () => ({
2370
2794
  kind: "scatter",
2371
2795
  accessor: t,
2372
2796
  xAxisId: e,
2373
- yAxisId: i,
2374
- data: r,
2797
+ yAxisId: n,
2798
+ data: s,
2375
2799
  name: o,
2376
- color: s,
2377
- tone: a,
2378
- radius: l
2800
+ hidden: r,
2801
+ format: a,
2802
+ color: l,
2803
+ tone: u,
2804
+ radius: d
2379
2805
  }),
2380
- [t, e, i, r, o, s, a, l]
2806
+ [t, e, n, s, o, r, a, l, u, d]
2381
2807
  );
2382
- return j("Scatter", c), null;
2808
+ return at("Scatter", f), null;
2383
2809
  }
2384
- function ii(n) {
2810
+ function Ci(i) {
2385
2811
  const {
2386
2812
  accessor: t,
2387
2813
  states: e,
2388
- xAxisId: i = "x",
2389
- yAxisId: r = "y",
2814
+ xAxisId: n = "x",
2815
+ yAxisId: s = "y",
2390
2816
  data: o,
2391
- name: s,
2392
- laneFrom: a,
2393
- laneTo: l
2394
- } = n, c = E(
2817
+ name: r,
2818
+ hidden: a,
2819
+ laneFrom: l,
2820
+ laneTo: u
2821
+ } = i, d = P(
2395
2822
  () => ({
2396
2823
  kind: "state",
2397
2824
  accessor: t,
2398
2825
  states: e,
2399
- xAxisId: i,
2400
- yAxisId: r,
2826
+ xAxisId: n,
2827
+ yAxisId: s,
2401
2828
  data: o,
2402
- name: s,
2403
- laneFrom: a,
2404
- laneTo: l
2829
+ name: r,
2830
+ hidden: a,
2831
+ laneFrom: l,
2832
+ laneTo: u
2405
2833
  }),
2406
- [t, e, i, r, o, s, a, l]
2834
+ [t, e, n, s, o, r, a, l, u]
2407
2835
  );
2408
- return j("StateBand", c), null;
2836
+ return at("StateBand", d), null;
2409
2837
  }
2410
- const Cn = [
2838
+ const ci = [
2411
2839
  "#eef2ff",
2412
2840
  "#c7d2fe",
2413
2841
  "#a5b4fc",
@@ -2416,167 +2844,145 @@ const Cn = [
2416
2844
  "#4f46e5",
2417
2845
  "#4338ca"
2418
2846
  ];
2419
- function ri(n) {
2847
+ function $i(i) {
2420
2848
  const {
2421
2849
  accessor: t,
2422
2850
  value: e,
2423
- coloring: i,
2424
- xAxisId: r = "x",
2851
+ coloring: n,
2852
+ xAxisId: s = "x",
2425
2853
  yAxisId: o = "y",
2426
- data: s,
2427
- name: a
2428
- } = n, l = E(
2429
- () => i ?? { kind: "gradient", stops: Cn },
2430
- [i]
2431
- ), c = E(
2854
+ data: r,
2855
+ name: a,
2856
+ hidden: l,
2857
+ format: u
2858
+ } = i, d = P(
2859
+ () => n ?? { kind: "gradient", stops: ci },
2860
+ [n]
2861
+ ), f = P(
2432
2862
  () => ({
2433
2863
  kind: "matrix",
2434
2864
  accessor: t,
2435
2865
  value: e,
2436
- coloring: l,
2437
- xAxisId: r,
2866
+ coloring: d,
2867
+ xAxisId: s,
2438
2868
  yAxisId: o,
2439
- data: s,
2440
- name: a
2441
- }),
2442
- [t, e, l, r, o, s, a]
2443
- );
2444
- return j("Matrix", c), null;
2445
- }
2446
- function oi(n) {
2447
- const {
2448
- accessor: t,
2449
- to: e,
2450
- xAxisId: i = "x",
2451
- yAxisId: r = "y",
2452
- data: o,
2453
- name: s,
2454
- color: a,
2455
- height: l = 0.6
2456
- } = n, c = E(
2457
- () => ({
2458
- kind: "span",
2459
- accessor: t,
2460
- to: e,
2461
- xAxisId: i,
2462
- yAxisId: r,
2463
- data: o,
2464
- name: s,
2465
- color: a,
2466
- height: l
2869
+ data: r,
2870
+ name: a,
2871
+ hidden: l,
2872
+ format: u
2467
2873
  }),
2468
- [t, e, i, r, o, s, a, l]
2874
+ [t, e, d, s, o, r, a, l, u]
2469
2875
  );
2470
- return j("Span", c), null;
2876
+ return at("Matrix", f), null;
2471
2877
  }
2472
- function nt(n) {
2878
+ function ct(i) {
2473
2879
  const {
2474
2880
  value: t,
2475
- axisId: e = "y",
2476
- orientation: i = "y",
2477
- severity: r = "alarm",
2881
+ orientation: e = "y",
2882
+ axisId: n,
2883
+ severity: s = "alarm",
2478
2884
  label: o,
2479
- color: s,
2885
+ color: r,
2480
2886
  inExtent: a = !0,
2481
2887
  role: l = "specification"
2482
- } = n, c = E(
2888
+ } = i, u = P(
2483
2889
  () => ({
2484
2890
  kind: "line",
2485
2891
  value: t,
2486
- axisId: e,
2487
- orientation: i,
2488
- severity: r,
2892
+ axisId: n,
2893
+ orientation: e,
2894
+ severity: s,
2489
2895
  role: l,
2490
2896
  label: o,
2491
- color: s,
2897
+ color: r,
2492
2898
  inExtent: a
2493
2899
  }),
2494
- [t, e, i, r, l, o, s, a]
2900
+ [t, n, e, s, l, o, r, a]
2495
2901
  );
2496
- return me("LimitLine", c), null;
2902
+ return $e("LimitLine", u), null;
2497
2903
  }
2498
- function si(n) {
2904
+ function Oi(i) {
2499
2905
  const {
2500
2906
  from: t,
2501
2907
  to: e,
2502
- axisId: i = "y",
2503
- orientation: r = "y",
2908
+ orientation: n = "y",
2909
+ axisId: s,
2504
2910
  severity: o = "warning",
2505
- label: s,
2911
+ label: r,
2506
2912
  color: a,
2507
2913
  inExtent: l = !0,
2508
- role: c = "specification"
2509
- } = n, u = E(
2914
+ role: u = "specification"
2915
+ } = i, d = P(
2510
2916
  () => ({
2511
2917
  kind: "band",
2512
2918
  from: t,
2513
2919
  to: e,
2514
- axisId: i,
2515
- orientation: r,
2920
+ axisId: s,
2921
+ orientation: n,
2516
2922
  severity: o,
2517
- role: c,
2518
- label: s,
2923
+ role: u,
2924
+ label: r,
2519
2925
  color: a,
2520
2926
  inExtent: l
2521
2927
  }),
2522
- [t, e, i, r, o, c, s, a, l]
2928
+ [t, e, s, n, o, u, r, a, l]
2523
2929
  );
2524
- return me("LimitBand", u), null;
2930
+ return $e("LimitBand", d), null;
2525
2931
  }
2526
- const On = 1.128;
2527
- function kt(n, t) {
2932
+ const ui = 1.128;
2933
+ function Wt(i, t) {
2528
2934
  return {
2529
- center: n,
2935
+ center: i,
2530
2936
  sigma: t,
2531
- upper: n + 3 * t,
2532
- lower: n - 3 * t
2937
+ upper: i + 3 * t,
2938
+ lower: i - 3 * t
2533
2939
  };
2534
2940
  }
2535
- function ai(n, t) {
2536
- return (t - n) / 3;
2941
+ function Wi(i, t) {
2942
+ return (t - i) / 3;
2537
2943
  }
2538
- function Wn(n, t) {
2944
+ function hi(i, t) {
2539
2945
  if (t.kind === "given")
2540
- return kt(t.center, t.sigma);
2541
- const e = Math.max(0, Math.trunc(t.from)), i = Math.min(n.length, Math.trunc(t.to));
2542
- let r = 0, o = 0, s = 0, a = 0, l = Number.NaN;
2543
- for (let u = e; u < i; u++) {
2544
- const h = n[u];
2545
- if (!Number.isFinite(h)) {
2946
+ return Wt(t.center, t.sigma);
2947
+ const e = Math.max(0, Math.trunc(t.from)), n = Math.min(i.length, Math.trunc(t.to));
2948
+ let s = 0, o = 0, r = 0, a = 0, l = Number.NaN;
2949
+ for (let d = e; d < n; d++) {
2950
+ const f = i[d];
2951
+ if (!Number.isFinite(f)) {
2546
2952
  l = Number.NaN;
2547
2953
  continue;
2548
2954
  }
2549
- r += h, o++, Number.isFinite(l) && (s += Math.abs(h - l), a++), l = h;
2955
+ s += f, o++, Number.isFinite(l) && (r += Math.abs(f - l), a++), l = f;
2550
2956
  }
2551
- if (o === 0) return kt(Number.NaN, Number.NaN);
2552
- const c = a === 0 ? 0 : s / a / On;
2553
- return kt(r / o, c);
2957
+ if (o === 0) return Wt(Number.NaN, Number.NaN);
2958
+ const u = a === 0 ? 0 : r / a / ui;
2959
+ return Wt(s / o, u);
2554
2960
  }
2555
- function Hn(n, t = [1, 2]) {
2961
+ function di(i, t = [1, 2]) {
2556
2962
  return t.map((e) => ({
2557
2963
  k: e,
2558
- upper: n.center + e * n.sigma,
2559
- lower: n.center - e * n.sigma
2964
+ upper: i.center + e * i.sigma,
2965
+ lower: i.center - e * i.sigma
2560
2966
  }));
2561
2967
  }
2562
- function Rn(n, t) {
2563
- return Number.isFinite(n) ? n > t ? 1 : n < t ? -1 : 0 : 0;
2968
+ function fi(i, t) {
2969
+ return Number.isFinite(i) ? i > t ? 1 : i < t ? -1 : 0 : 0;
2564
2970
  }
2565
- function pe(n, t) {
2971
+ function Oe(i, t) {
2566
2972
  const e = [];
2567
2973
  if (t < 1) return e;
2568
- let i = 0;
2569
- for (let r = 1; r <= n.length; r++) {
2570
- const o = r < n.length ? n[r] : Number.NaN, s = n[i];
2571
- if (o !== s) {
2572
- if (s !== 0 && r - i >= t)
2573
- for (let a = i; a < r; a++) e.push(a);
2574
- i = r;
2974
+ let n = 0;
2975
+ for (let s = 1; s <= i.length; s++) {
2976
+ const o = s < i.length ? i[s] : Number.NaN, r = i[n];
2977
+ if (o !== r) {
2978
+ if (r !== 0 && s - n >= t)
2979
+ for (let a = n; a < s; a++) e.push(a);
2980
+ n = s;
2575
2981
  }
2576
2982
  }
2577
2983
  return e;
2578
2984
  }
2579
- const $t = {
2985
+ const Ut = {
2580
2986
  outlier: !0,
2581
2987
  run: !0,
2582
2988
  trend: !0,
@@ -2584,299 +2990,342 @@ const $t = {
2584
2990
  runLength: 9,
2585
2991
  trendLength: 6
2586
2992
  };
2587
- function Vn(n, t) {
2993
+ function mi(i, t) {
2588
2994
  const e = [];
2589
- for (let i = 0; i < n.length; i++) {
2590
- const r = n[i];
2591
- (r > t.upper || r < t.lower) && e.push(i);
2995
+ if (!(t.sigma > 0)) return e;
2996
+ for (let n = 0; n < i.length; n++) {
2997
+ const s = i[n];
2998
+ (s > t.upper || s < t.lower) && e.push(n);
2592
2999
  }
2593
3000
  return e;
2594
3001
  }
2595
- function _n(n, t, e = $t.runLength) {
2596
- return pe(
2597
- n.map((i) => Rn(i, t.center)),
3002
+ function pi(i, t, e = Ut.runLength) {
3003
+ return Oe(
3004
+ i.map((n) => fi(n, t.center)),
2598
3005
  e
2599
3006
  );
2600
3007
  }
2601
- function Bn(n, t = $t.trendLength) {
3008
+ function yi(i, t = Ut.trendLength) {
2602
3009
  const e = [];
2603
- for (let r = 1; r < n.length; r++) {
2604
- const o = n[r - 1], s = n[r];
2605
- e.push(Number.isFinite(o) && Number.isFinite(s) ? Math.sign(s - o) : 0);
2606
- }
2607
- const i = [];
2608
- for (const r of pe(e, Math.max(1, t - 1)))
2609
- i[i.length - 1] !== r && i.push(r), i.push(r + 1);
2610
- return i;
2611
- }
2612
- function Yn(n, t) {
2613
- const e = t.center + 2 * t.sigma, i = t.center - 2 * t.sigma, r = /* @__PURE__ */ new Set();
2614
- for (let o = 0; o + 2 < n.length; o++)
2615
- for (const s of [
2616
- [o, o + 1, o + 2].filter((a) => n[a] > e),
2617
- [o, o + 1, o + 2].filter((a) => n[a] < i)
3010
+ for (let s = 1; s < i.length; s++) {
3011
+ const o = i[s - 1], r = i[s];
3012
+ e.push(Number.isFinite(o) && Number.isFinite(r) ? Math.sign(r - o) : 0);
3013
+ }
3014
+ const n = [];
3015
+ for (const s of Oe(e, Math.max(1, t - 1)))
3016
+ n[n.length - 1] !== s && n.push(s), n.push(s + 1);
3017
+ return n;
3018
+ }
3019
+ function gi(i, t) {
3020
+ if (!(t.sigma > 0)) return [];
3021
+ const e = t.center + 2 * t.sigma, n = t.center - 2 * t.sigma, s = /* @__PURE__ */ new Set();
3022
+ for (let o = 0; o + 2 < i.length; o++)
3023
+ for (const r of [
3024
+ [o, o + 1, o + 2].filter((a) => i[a] > e),
3025
+ [o, o + 1, o + 2].filter((a) => i[a] < n)
2618
3026
  ])
2619
- if (s.length >= 2) for (const a of s) r.add(a);
2620
- return [...r].sort((o, s) => o - s);
2621
- }
2622
- function zn(n, t, e = {}) {
2623
- const i = { ...$t, ...e }, r = [], o = (s, a) => {
2624
- a.length > 0 && r.push({ rule: s, indices: a });
3027
+ if (r.length >= 2) for (const a of r) s.add(a);
3028
+ return [...s].sort((o, r) => o - r);
3029
+ }
3030
+ function xi(i, t, e = {}) {
3031
+ const n = { ...Ut, ...e };
3032
+ t.sigma > 0 || J(
3033
+ "control-sigma-zero",
3034
+ `control limits with sigma ${t.sigma} span no band - a constant reference window, or a given sigma not above 0. Rules 1 and 4 find nothing there; take a window with spread, or a positive given sigma.`
3035
+ );
3036
+ const s = [], o = (r, a) => {
3037
+ a.length > 0 && s.push({ rule: r, indices: a });
2625
3038
  };
2626
- return i.outlier && o("outlier", Vn(n, t)), i.run && o("run", _n(n, t, i.runLength)), i.trend && o("trend", Bn(n, i.trendLength)), i.twoOfThree && o("twoOfThree", Yn(n, t)), r;
3039
+ return n.outlier && o("outlier", mi(i, t)), n.run && o("run", pi(i, t, n.runLength)), n.trend && o("trend", yi(i, n.trendLength)), n.twoOfThree && o("twoOfThree", gi(i, t)), s;
2627
3040
  }
2628
- function Gn(n) {
3041
+ function bi(i) {
2629
3042
  const t = /* @__PURE__ */ new Set();
2630
- for (const e of n) for (const i of e.indices) t.add(i);
2631
- return [...t].sort((e, i) => e - i);
3043
+ for (const e of i) for (const n of e.indices) t.add(n);
3044
+ return [...t].sort((e, n) => e - n);
3045
+ }
3046
+ function Rt(i, t) {
3047
+ const [e, n] = be({ value: i });
3048
+ return e.value === i || t(e.value, i) ? e.value : (n({ value: i }), i);
3049
+ }
3050
+ function vi(i, t) {
3051
+ return i.kind === "given" && t.kind === "given" ? i.center === t.center && i.sigma === t.sigma : i.kind === "referenceWindow" && t.kind === "referenceWindow" ? i.from === t.from && i.to === t.to : !1;
3052
+ }
3053
+ function Ni(i, t) {
3054
+ if (i.length !== t.length) return !1;
3055
+ for (let e = 0; e < i.length; e++) {
3056
+ const n = i[e], s = t[e];
3057
+ if (n.rule !== s.rule || n.indices.length !== s.indices.length) return !1;
3058
+ for (let o = 0; o < n.indices.length; o++) if (n.indices[o] !== s.indices[o]) return !1;
3059
+ }
3060
+ return !0;
2632
3061
  }
2633
- function li(n) {
3062
+ function Ri(i) {
2634
3063
  const {
2635
- accessor: t,
2636
- data: e,
2637
- origin: i,
2638
- xAxisId: r = "x",
2639
- yAxisId: o = "y",
3064
+ data: t,
3065
+ xAxisId: e = "x",
3066
+ yAxisId: n = "y",
2640
3067
  name: s,
2641
- color: a,
3068
+ format: o,
3069
+ color: r,
3070
+ tone: a,
2642
3071
  rules: l,
2643
- zoneLines: c = !0,
2644
- labelUpper: u,
2645
- labelLower: h,
2646
- violationName: p,
2647
- onViolations: d
2648
- } = n, m = E(() => {
2649
- const F = [];
2650
- for (let P = 0; P < e.length; P++) {
2651
- const N = t(e[P], P);
2652
- F.push(N ?? Number.NaN);
3072
+ zoneLines: u = !0,
3073
+ labelUpper: d,
3074
+ labelLower: f,
3075
+ violationName: h,
3076
+ onViolations: m
3077
+ } = i, c = Rt(i.accessor, X), p = Rt(i.origin, vi), y = P(() => {
3078
+ const S = [];
3079
+ for (let T = 0; T < t.length; T++) {
3080
+ const H = c(t[T], T);
3081
+ S.push(H ?? Number.NaN);
2653
3082
  }
2654
- return F;
2655
- }, [e, t]), y = E(() => Wn(m, i), [m, i]), f = E(
2656
- () => zn(m, y, l ?? {}),
2657
- [m, y, l]
2658
- ), b = E(() => new Set(Gn(f)), [f]);
2659
- $(() => {
2660
- d == null || d(f);
2661
- }, [f, d]);
2662
- const k = E(
2663
- () => (F, P) => b.has(P) ? t(F, P) : null,
2664
- [b, t]
2665
- ), w = E(
2666
- () => b.size === 0 ? e : e.slice(),
2667
- [e, b]
2668
- ), I = E(
2669
- () => c ? Hn(y, [1, 2]) : [],
2670
- [c, y]
2671
- ), A = Number.isFinite(y.center);
2672
- return /* @__PURE__ */ _(Nt, { children: [
2673
- /* @__PURE__ */ S(Dn, { accessor: t, data: e, xAxisId: r, yAxisId: o, name: s, color: a }),
2674
- A && /* @__PURE__ */ _(Nt, { children: [
2675
- I.map((F) => /* @__PURE__ */ S(
2676
- nt,
3083
+ return S;
3084
+ }, [t, c]), g = P(() => hi(y, p), [y, p]), b = Rt(
3085
+ P(() => xi(y, g, l ?? {}), [y, g, l]),
3086
+ Ni
3087
+ ), N = P(() => new Set(bi(b)), [b]), A = Q(m);
3088
+ C(() => {
3089
+ A.current = m;
3090
+ }, [m]), C(() => {
3091
+ var S;
3092
+ (S = A.current) == null || S.call(A, b);
3093
+ }, [b]);
3094
+ const $ = P(
3095
+ () => (S, T) => N.has(T) ? c(S, T) : null,
3096
+ [N, c]
3097
+ ), w = P(
3098
+ () => N.size === 0 ? t : t.slice(),
3099
+ [t, N]
3100
+ ), W = P(
3101
+ () => u ? di(g, [1, 2]) : [],
3102
+ [u, g]
3103
+ ), L = Number.isFinite(g.center);
3104
+ return /* @__PURE__ */ G(bt, { children: [
3105
+ /* @__PURE__ */ I(ai, { accessor: c, data: t, xAxisId: e, yAxisId: n, name: s, format: o, color: r, tone: a }),
3106
+ L && /* @__PURE__ */ G(bt, { children: [
3107
+ W.map((S) => /* @__PURE__ */ I(
3108
+ ct,
2677
3109
  {
2678
- value: F.upper,
2679
- axisId: o,
3110
+ value: S.upper,
3111
+ axisId: n,
2680
3112
  role: "zone",
2681
3113
  inExtent: !1
2682
3114
  },
2683
- `zone-${F.k}-upper`
3115
+ `zone-${S.k}-upper`
2684
3116
  )),
2685
- I.map((F) => /* @__PURE__ */ S(
2686
- nt,
3117
+ W.map((S) => /* @__PURE__ */ I(
3118
+ ct,
2687
3119
  {
2688
- value: F.lower,
2689
- axisId: o,
3120
+ value: S.lower,
3121
+ axisId: n,
2690
3122
  role: "zone",
2691
3123
  inExtent: !1
2692
3124
  },
2693
- `zone-${F.k}-lower`
3125
+ `zone-${S.k}-lower`
2694
3126
  )),
2695
- /* @__PURE__ */ S(nt, { value: y.center, axisId: o, role: "control" }),
2696
- /* @__PURE__ */ S(nt, { value: y.upper, axisId: o, role: "control", label: u }),
2697
- /* @__PURE__ */ S(nt, { value: y.lower, axisId: o, role: "control", label: h })
3127
+ /* @__PURE__ */ I(ct, { value: g.center, axisId: n, role: "control" }),
3128
+ /* @__PURE__ */ I(ct, { value: g.upper, axisId: n, role: "control", label: d }),
3129
+ /* @__PURE__ */ I(ct, { value: g.lower, axisId: n, role: "control", label: f })
2698
3130
  ] }),
2699
- /* @__PURE__ */ S(
2700
- $n,
3131
+ /* @__PURE__ */ I(
3132
+ li,
2701
3133
  {
2702
- accessor: k,
3134
+ accessor: $,
2703
3135
  data: w,
2704
- xAxisId: r,
2705
- yAxisId: o,
2706
- name: p,
3136
+ xAxisId: e,
3137
+ yAxisId: n,
3138
+ name: h,
3139
+ format: o,
2707
3140
  tone: "alarm",
2708
3141
  radius: 4
2709
3142
  }
2710
3143
  )
2711
3144
  ] });
2712
3145
  }
2713
- function ci(n) {
3146
+ function Hi(i) {
2714
3147
  const {
2715
3148
  id: t = "x",
2716
3149
  position: e = "bottom",
2717
- accessor: i,
2718
- label: r,
3150
+ accessor: n,
3151
+ label: s,
2719
3152
  tickCount: o,
2720
- tickFormat: s,
3153
+ tickFormat: r,
2721
3154
  domain: a = "nice",
2722
3155
  grid: l,
2723
- ticks: c,
2724
- calendar: u
2725
- } = n, h = E(
3156
+ ticks: u,
3157
+ time: d,
3158
+ calendar: f,
3159
+ onDomainChange: h
3160
+ } = i, m = P(
2726
3161
  () => ({
2727
3162
  id: t,
2728
3163
  orientation: "x",
2729
3164
  position: e,
2730
- accessor: i,
2731
- label: r,
3165
+ accessor: n,
3166
+ label: s,
2732
3167
  tickCount: o,
2733
- tickFormat: s,
3168
+ tickFormat: r,
2734
3169
  domain: a,
2735
3170
  grid: l,
2736
- ticks: c,
2737
- calendar: u
3171
+ ticks: u,
3172
+ time: d,
3173
+ calendar: f,
3174
+ onDomainChange: h
2738
3175
  }),
2739
- [t, e, i, r, o, s, a, l, c, u]
3176
+ [t, e, n, s, o, r, a, l, u, d, f, h]
2740
3177
  );
2741
- return fe("XAxis", h), null;
3178
+ return Ce("XAxis", m), null;
2742
3179
  }
2743
- function ui(n) {
3180
+ function Vi(i) {
2744
3181
  const {
2745
3182
  id: t = "y",
2746
3183
  position: e = "left",
2747
- accessor: i,
2748
- label: r,
3184
+ accessor: n,
3185
+ label: s,
2749
3186
  tickCount: o,
2750
- tickFormat: s,
3187
+ tickFormat: r,
2751
3188
  domain: a = "nice",
2752
3189
  grid: l,
2753
- ticks: c
2754
- } = n, u = E(
3190
+ ticks: u,
3191
+ alignTicks: d
3192
+ } = i, f = P(
2755
3193
  () => ({
2756
3194
  id: t,
2757
3195
  orientation: "y",
2758
3196
  position: e,
2759
- accessor: i,
2760
- label: r,
3197
+ accessor: n,
3198
+ label: s,
2761
3199
  tickCount: o,
2762
- tickFormat: s,
3200
+ tickFormat: r,
2763
3201
  domain: a,
2764
3202
  grid: l,
2765
- ticks: c
3203
+ ticks: u,
3204
+ alignTicks: d
2766
3205
  }),
2767
- [t, e, i, r, o, s, a, l, c]
3206
+ [t, e, n, s, o, r, a, l, u, d]
2768
3207
  );
2769
- return fe("YAxis", u), null;
3208
+ return Ce("YAxis", f), null;
2770
3209
  }
2771
- function qn({
2772
- scene: n,
2773
- placement: t
3210
+ function ki({
3211
+ scene: i,
3212
+ placement: t,
3213
+ onToggle: e
2774
3214
  }) {
2775
- Ln("Legend", { placement: t });
2776
- const e = Et(
2777
- n.subscribeLayout,
2778
- n.getLayoutSnapshot,
2779
- n.getLayoutServerSnapshot
3215
+ ni("Legend", { placement: t });
3216
+ const n = Kt(
3217
+ i.subscribeLayout,
3218
+ i.getLayoutSnapshot,
3219
+ i.getLayoutServerSnapshot
2780
3220
  );
2781
- return e.series.length === 0 ? null : /* @__PURE__ */ S("div", { className: `uc-legend uc-legend-${t}`, children: e.series.map((i) => /* @__PURE__ */ _(
2782
- "span",
2783
- {
3221
+ return n.series.length === 0 ? null : /* @__PURE__ */ I("div", { className: `uc-legend uc-legend-${t}`, children: n.series.map((s) => {
3222
+ const o = {
2784
3223
  className: "uc-legend-item",
2785
- onPointerEnter: () => n.setHighlight(i.seriesId),
2786
- onPointerLeave: () => n.setHighlight(null),
2787
- children: [
2788
- /* @__PURE__ */ S("span", { className: "uc-legend-chip", style: { background: i.color } }),
2789
- i.name
2790
- ]
2791
- },
2792
- i.id
2793
- )) });
3224
+ "data-hidden": s.hidden ? "" : void 0,
3225
+ onPointerEnter: () => i.setHighlight(s.seriesIds),
3226
+ onPointerLeave: () => i.setHighlight(null)
3227
+ }, r = /* @__PURE__ */ G(bt, { children: [
3228
+ /* @__PURE__ */ I("span", { className: "uc-legend-chip", style: { background: s.color } }),
3229
+ s.name
3230
+ ] });
3231
+ return e === void 0 ? /* @__PURE__ */ I("span", { ...o, children: r }, s.id) : /* @__PURE__ */ I(
3232
+ "button",
3233
+ {
3234
+ type: "button",
3235
+ "aria-pressed": !s.hidden,
3236
+ onClick: () => e(s.name),
3237
+ ...o,
3238
+ children: r
3239
+ },
3240
+ s.id
3241
+ );
3242
+ }) });
2794
3243
  }
2795
- function hi({ placement: n = "top" }) {
2796
- const t = tt("Legend");
2797
- return t === null ? null : /* @__PURE__ */ S(qn, { scene: t, placement: n });
3244
+ function _i({ placement: i = "top", onToggle: t }) {
3245
+ const e = rt("Legend");
3246
+ return e === null ? null : /* @__PURE__ */ I(ki, { scene: e, placement: i, onToggle: t });
2798
3247
  }
2799
- function di(n) {
2800
- const { mode: t = "x", render: e } = n, i = E(
3248
+ function Yi(i) {
3249
+ const { mode: t = "x", render: e } = i, n = P(
2801
3250
  () => ({ mode: t, render: e }),
2802
3251
  [t, e]
2803
3252
  );
2804
- return Tn("Tooltip", i), null;
3253
+ return ii("Tooltip", n), null;
2805
3254
  }
2806
- const Kn = {
3255
+ const wi = {
2807
3256
  cutoff: 0.8,
2808
3257
  collectRank: Number.POSITIVE_INFINITY
2809
3258
  };
2810
- function fi(n, t = {}) {
2811
- const e = { ...Kn, ...t };
3259
+ function zi(i, t = {}) {
3260
+ const e = { ...wi, ...t };
2812
3261
  ut(
2813
3262
  !Number.isFinite(e.collectRank) || e.remainderName !== void 0,
2814
3263
  "pareto: a collect rank needs `remainderName` - the package brings no name for the remainder."
2815
3264
  );
2816
- const i = n.map((d, m) => ({ item: d, inputIndex: m })).sort((d, m) => m.item.value - d.item.value || d.inputIndex - m.inputIndex).map(({ item: d }) => d), r = Math.max(0, Math.min(i.length, Math.floor(e.collectRank))), o = i.slice(0, r), s = i.slice(r), a = s.length === 0 ? o : [...o, { name: e.remainderName ?? "", value: s.reduce((d, m) => d + m.value, 0) }], l = a.reduce((d, m) => d + m.value, 0), c = [];
2817
- let u = 0;
2818
- for (let d = 0; d < a.length; d++) {
2819
- const m = a[d];
2820
- u += m.value, c.push({
2821
- name: m.name,
2822
- value: m.value,
2823
- index: d,
2824
- share: l === 0 ? 0 : m.value / l,
2825
- cumulative: l === 0 ? 0 : u / l,
2826
- remainder: s.length > 0 && d === a.length - 1
3265
+ const n = i.map((m, c) => ({ item: m, inputIndex: c })).sort((m, c) => c.item.value - m.item.value || m.inputIndex - c.inputIndex).map(({ item: m }) => m), s = Math.max(0, Math.min(n.length, Math.floor(e.collectRank))), o = n.slice(0, s), r = n.slice(s), a = r.length === 0 ? o : [...o, { name: e.remainderName ?? "", value: r.reduce((m, c) => m + c.value, 0) }], l = a.reduce((m, c) => m + c.value, 0), u = [];
3266
+ let d = 0;
3267
+ for (let m = 0; m < a.length; m++) {
3268
+ const c = a[m];
3269
+ d += c.value, u.push({
3270
+ name: c.name,
3271
+ value: c.value,
3272
+ index: m,
3273
+ share: l === 0 ? 0 : c.value / l,
3274
+ cumulative: l === 0 ? 0 : d / l,
3275
+ remainder: r.length > 0 && m === a.length - 1
2827
3276
  });
2828
3277
  }
2829
- const h = Math.abs(e.cutoff) * 1e-12, p = c.findIndex((d) => d.cumulative >= e.cutoff - h);
2830
- return { entries: c, total: l, cutoffIndex: p };
3278
+ const f = Math.abs(e.cutoff) * 1e-12, h = u.findIndex((m) => m.cumulative >= e.cutoff - f);
3279
+ return { entries: u, total: l, cutoffIndex: h };
2831
3280
  }
2832
3281
  export {
2833
- ei as Area,
2834
- ni as Bar,
2835
- ti as Chart,
2836
- li as ControlChart,
2837
- X as DAY,
2838
- Cn as DEFAULT_GRADIENT,
2839
- Q as HOUR,
2840
- hi as Legend,
2841
- si as LimitBand,
2842
- nt as LimitLine,
2843
- Dn as Line,
2844
- _t as LinearScale,
2845
- U as MINUTE,
2846
- ri as Matrix,
2847
- K as SECOND,
2848
- $n as Scatter,
2849
- oi as Span,
2850
- ii as StateBand,
2851
- di as Tooltip,
2852
- ci as XAxis,
2853
- ui as YAxis,
2854
- ln as assess,
2855
- He as breaks,
2856
- G as calendarFrom,
2857
- Wn as controlLimits,
2858
- $t as defaultRules,
2859
- Rt as invalidateTheme,
2860
- Jn as mapSeries,
2861
- De as operatingCalendar,
2862
- _e as operatingTicks,
2863
- Ve as operatingTimeTicks,
2864
- fi as pareto,
2865
- Kn as paretoDefaults,
2866
- We as removedIntervals,
2867
- jn as resolveColours,
2868
- Vn as ruleOutlier,
2869
- _n as ruleRun,
2870
- Bn as ruleTrend,
2871
- Yn as ruleTwoOfThree,
2872
- ai as sigmaFromLimit,
2873
- Le as subscribeTheme,
2874
- Re as timeStep,
2875
- pt as toOperatingTime,
2876
- Ce as toOperatingTimeClamped,
2877
- dt as toWallClock,
2878
- Qn as verdictWeight,
2879
- Gn as violatedIndices,
2880
- zn as violations,
2881
- Hn as zones
3282
+ Ei as Area,
3283
+ Pi as Bar,
3284
+ Di as Chart,
3285
+ Ri as ControlChart,
3286
+ K as DAY,
3287
+ ci as DEFAULT_GRADIENT,
3288
+ tt as HOUR,
3289
+ _i as Legend,
3290
+ Oi as LimitBand,
3291
+ ct as LimitLine,
3292
+ ai as Line,
3293
+ te as LinearScale,
3294
+ q as MINUTE,
3295
+ $i as Matrix,
3296
+ j as SECOND,
3297
+ li as Scatter,
3298
+ Ci as StateBand,
3299
+ Yi as Tooltip,
3300
+ Hi as XAxis,
3301
+ Vi as YAxis,
3302
+ On as assess,
3303
+ rn as breaks,
3304
+ Z as calendarFrom,
3305
+ hi as controlLimits,
3306
+ Ut as defaultRules,
3307
+ jt as invalidateTheme,
3308
+ Ti as localOffset,
3309
+ Si as mapSeries,
3310
+ tn as operatingCalendar,
3311
+ Li as operatingTicks,
3312
+ ln as operatingTimeTicks,
3313
+ zi as pareto,
3314
+ wi as paretoDefaults,
3315
+ on as removedIntervals,
3316
+ qe as resolveColours,
3317
+ mi as ruleOutlier,
3318
+ pi as ruleRun,
3319
+ yi as ruleTrend,
3320
+ gi as ruleTwoOfThree,
3321
+ Wi as sigmaFromLimit,
3322
+ Ue as subscribeTheme,
3323
+ an as timeStep,
3324
+ st as toOperatingTime,
3325
+ nn as toOperatingTimeClamped,
3326
+ ot as toWallClock,
3327
+ Fi as verdictWeight,
3328
+ bi as violatedIndices,
3329
+ xi as violations,
3330
+ di as zones
2882
3331
  };