@mechane-ai/elements 0.42.0 → 0.44.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.
Files changed (54) hide show
  1. package/README.md +32 -32
  2. package/dist/ai.js +1 -1
  3. package/dist/catalog.json +89 -1
  4. package/dist/{categorical-values-B6lGI7BH.js → categorical-values-ByvFLaNE.js} +3 -3
  5. package/dist/{chart-frame-D0enjyj9.js → chart-frame-Bcd9Tpt5.js} +75 -23
  6. package/dist/{chart-input-D4_Awave.js → chart-input-B6_HXFDP.js} +2 -2
  7. package/dist/{chart-navigation-D4-pdgpj.js → chart-navigation-BAbb5PV9.js} +56 -32
  8. package/dist/charts/cartesian.js +1701 -551
  9. package/dist/charts/distribution.js +41 -28
  10. package/dist/charts/graph.js +443 -76
  11. package/dist/charts/hierarchy.js +5 -5
  12. package/dist/charts/matrix.js +232 -63
  13. package/dist/charts/timeline.js +2 -2
  14. package/dist/charts.js +2 -2
  15. package/dist/collections.js +2 -2
  16. package/dist/{constants.stylex-BILvnwUk.js → constants.stylex-CaVa9yGN.js} +9 -9
  17. package/dist/content/tree.js +1 -1
  18. package/dist/feedback.js +1 -1
  19. package/dist/label-spacing-BncjePGb.js +6 -0
  20. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +15 -3
  21. package/dist/packages/charts/src/cartesian/bar-data.d.ts +43 -0
  22. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +32 -0
  23. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +29 -0
  24. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +40 -0
  25. package/dist/packages/charts/src/cartesian/index.d.ts +7 -2
  26. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +34 -0
  27. package/dist/packages/charts/src/cartesian/sparkline.d.ts +10 -1
  28. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +66 -0
  29. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +11 -1
  30. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +35 -0
  31. package/dist/packages/charts/src/cartesian/time-series.d.ts +6 -1
  32. package/dist/packages/charts/src/chart-inspection.d.ts +3 -1
  33. package/dist/packages/charts/src/chart-navigation.d.ts +3 -1
  34. package/dist/packages/charts/src/chart-series-marker.d.ts +8 -1
  35. package/dist/packages/charts/src/chart-surface.d.ts +2 -0
  36. package/dist/packages/charts/src/chart-theme.d.ts +29 -2
  37. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -1
  38. package/dist/packages/charts/src/graph/flow-diagram.d.ts +26 -0
  39. package/dist/packages/charts/src/graph/flow-layout.d.ts +70 -0
  40. package/dist/packages/charts/src/graph/index.d.ts +2 -0
  41. package/dist/packages/charts/src/index.d.ts +1 -1
  42. package/dist/packages/charts/src/label-spacing.d.ts +15 -0
  43. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +4 -0
  44. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +20 -0
  45. package/dist/packages/charts/src/matrix/matrix-types.d.ts +21 -0
  46. package/dist/packages/charts/src/matrix/matrix.d.ts +8 -19
  47. package/dist/{plot-width-BQQS-mw9.js → plot-width-8cXdAjoD.js} +31 -2
  48. package/dist/{src-BpvnBWrF.js → src-CDp1JtwC.js} +1 -1
  49. package/dist/styles2.css +141 -18
  50. package/dist/tokens.js +1 -1
  51. package/package.json +1 -1
  52. package/packages/foundations/src/constants.stylex.ts +9 -9
  53. package/packages/foundations/src/tokens.stylex.ts +9 -9
  54. package/recipes/allocation-report.tsx +115 -0
@@ -1,31 +1,32 @@
1
- import { c as e, d as t, f as n } from "../src-BpvnBWrF.js";
2
- import { i as r, n as i, r as a, t as o } from "../categorical-values-B6lGI7BH.js";
3
- import { a as s, n as c, r as l, t as u } from "../chart-navigation-D4-pdgpj.js";
4
- import { a as d, i as f, n as p } from "../chart-frame-D0enjyj9.js";
5
- import { n as m, r as h, t as g } from "../chart-input-D4_Awave.js";
1
+ import { c as e, d as t, f as n } from "../src-CDp1JtwC.js";
2
+ import { i as r, n as i, r as a, t as o } from "../categorical-values-ByvFLaNE.js";
3
+ import { a as s, n as c, r as l, t as u } from "../chart-navigation-BAbb5PV9.js";
4
+ import { a as d, i as f, n as p } from "../chart-frame-Bcd9Tpt5.js";
5
+ import { n as m, r as h, t as g } from "../chart-input-B6_HXFDP.js";
6
6
  import { r as _ } from "../tokens.stylex-dF5CACEJ.js";
7
- import { n as v, t as ee } from "../plot-width-BQQS-mw9.js";
8
- import { O as y } from "../src-DcW_gMX8.js";
9
- import { h as b } from "../src-gqEebHEa.js";
10
- import * as x from "@stylexjs/stylex";
11
- import { Button as te } from "@ui-sdk/react/button";
12
- import { useEffect as S, useId as C, useMemo as ne, useRef as w, useState as T } from "react";
13
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
14
- import { bindDrag as k } from "@ui-sdk/core";
15
- import { scaleBand as A, scaleLinear as j } from "@visx/scale";
16
- import { AreaClosed as re, Bar as M, LinePath as ie } from "@visx/shape";
7
+ import { n as v, t as ee } from "../plot-width-8cXdAjoD.js";
8
+ import { t as y } from "../label-spacing-BncjePGb.js";
9
+ import { O as b } from "../src-DcW_gMX8.js";
10
+ import { h as x } from "../src-gqEebHEa.js";
11
+ import * as S from "@stylexjs/stylex";
12
+ import { Button as C } from "@ui-sdk/react/button";
13
+ import { useEffect as te, useId as w, useMemo as T, useRef as ne, useState as E } from "react";
14
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
15
+ import { bindDrag as A } from "@ui-sdk/core";
16
+ import { scaleBand as re, scaleLinear as j } from "@visx/scale";
17
+ import { Area as ie, AreaClosed as M, Bar as N, LinePath as P } from "@visx/shape";
17
18
  // packages/charts/src/chart-cursor.tsx
18
19
  function ae({ x: e, top: t, bottom: n, width: r }) {
19
- return /* @__PURE__ */ O("g", {
20
+ return /* @__PURE__ */ k("g", {
20
21
  "aria-hidden": !0,
21
22
  className: "xlshs6z xgs60n x17y187c xbabvq0 x47corl",
22
- children: [/* @__PURE__ */ D("line", {
23
+ children: [/* @__PURE__ */ O("line", {
23
24
  x1: e,
24
25
  x2: e,
25
26
  y1: t,
26
27
  y2: n,
27
28
  className: "xnpr05h x1ntoi03 x13efnbd"
28
- }), /* @__PURE__ */ D("line", {
29
+ }), /* @__PURE__ */ O("line", {
29
30
  x1: e - r / 2,
30
31
  x2: e + r / 2,
31
32
  y1: n + 4,
@@ -35,14 +36,14 @@ function ae({ x: e, top: t, bottom: n, width: r }) {
35
36
  });
36
37
  }
37
38
  // packages/charts/src/chart-inspection.tsx
38
- var N = {
39
+ var F = {
39
40
  kzqmXN: "x1xc55vz",
40
41
  kZKoxP: "xdk7pt",
41
42
  kmuXW: "x2lah0s",
42
43
  $$css: !0
43
- }, P = {
44
+ }, I = {
44
45
  swatch: (e) => [
45
- N,
46
+ F,
46
47
  {
47
48
  kWkggS: e == null ? e : "xl8spv7",
48
49
  $$css: !0
@@ -84,43 +85,43 @@ var N = {
84
85
  }]
85
86
  }, oe = 4;
86
87
  function se() {
87
- return /* @__PURE__ */ D("ul", {
88
+ return /* @__PURE__ */ O("ul", {
88
89
  "aria-hidden": !0,
89
90
  inert: !0,
90
91
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k",
91
- children: Array.from({ length: oe }, (e, t) => /* @__PURE__ */ O("li", {
92
+ children: Array.from({ length: oe }, (e, t) => /* @__PURE__ */ k("li", {
92
93
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe x1f394nn x43dure",
93
- children: [/* @__PURE__ */ D("span", { ...x.props(P.swatch(_.line)) }), /* @__PURE__ */ O("span", {
94
+ children: [/* @__PURE__ */ O("span", { ...S.props(I.swatch(_.line)) }), /* @__PURE__ */ k("span", {
94
95
  className: "x1cqoux5 xeuugli",
95
96
  children: [
96
- /* @__PURE__ */ D(n, {}),
97
- /* @__PURE__ */ D("span", {
97
+ /* @__PURE__ */ O(n, {}),
98
+ /* @__PURE__ */ O("span", {
98
99
  className: "x1s85apg xannxpe",
99
- children: /* @__PURE__ */ D(n, {})
100
+ children: /* @__PURE__ */ O(n, {})
100
101
  }),
101
- /* @__PURE__ */ D("span", {
102
+ /* @__PURE__ */ O("span", {
102
103
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
103
- children: /* @__PURE__ */ D(n, {})
104
+ children: /* @__PURE__ */ O(n, {})
104
105
  })
105
106
  ]
106
107
  })]
107
108
  }, t))
108
109
  });
109
110
  }
110
- function F({ title: e, detail: t }) {
111
- return t === void 0 ? e : /* @__PURE__ */ O("span", {
111
+ function ce({ title: e, detail: t }) {
112
+ return t === void 0 ? e : /* @__PURE__ */ k("span", {
112
113
  "aria-label": e,
113
114
  className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
114
- children: [/* @__PURE__ */ D("span", {
115
+ children: [/* @__PURE__ */ O("span", {
115
116
  className: "xt0psk2 x1boff50",
116
117
  children: e
117
- }), /* @__PURE__ */ D("span", {
118
+ }), /* @__PURE__ */ O("span", {
118
119
  className: "x1s85apg xfodcyb",
119
120
  children: t
120
121
  })]
121
122
  });
122
123
  }
123
- function ce({ label: e, summary: t, rows: n, notes: r = [] }) {
124
+ function le({ label: e, summary: t, rows: n, notes: r = [] }) {
124
125
  if (e !== void 0) return [
125
126
  e,
126
127
  t,
@@ -128,32 +129,38 @@ function ce({ label: e, summary: t, rows: n, notes: r = [] }) {
128
129
  ...r
129
130
  ].filter((e) => e !== void 0).join(" · ");
130
131
  }
131
- function le({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [], hasSeriesSummary: f = !1 }) {
132
- let p = Math.min(260, s), m = o > s / 2 ? o - p - c : o + c, h = Math.max(0, Math.min(s - p, m));
133
- return /* @__PURE__ */ O("div", {
132
+ function ue({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [], hasSeriesSummary: f = !1, hasLegend: p = !0 }) {
133
+ let m = p && !f, h = Math.min(260, s), g = o > s / 2 ? o - h - c : o + c, _ = Math.max(0, Math.min(s - h, g));
134
+ return /* @__PURE__ */ k("div", {
134
135
  className: "xeuugli",
135
136
  children: [
136
- !f && /* @__PURE__ */ O("div", {
137
+ m && /* @__PURE__ */ k("div", {
137
138
  className: "xrvj5dj xeuugli",
138
- children: [i !== void 0 && /* @__PURE__ */ D("ul", {
139
+ children: [i !== void 0 && /* @__PURE__ */ O("ul", {
139
140
  "aria-hidden": !0,
140
141
  inert: !0,
141
142
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
142
- children: i.map((e) => /* @__PURE__ */ O("li", {
143
+ children: i.map((e) => /* @__PURE__ */ k("li", {
143
144
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
144
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
145
+ children: [/* @__PURE__ */ O(d, {
146
+ tone: e.tone,
147
+ shape: e.shape
148
+ }), /* @__PURE__ */ k("span", {
145
149
  className: "xeuugli",
146
- children: [e.label, /* @__PURE__ */ D("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
150
+ children: [e.label, /* @__PURE__ */ O("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
147
151
  })]
148
152
  }, e.id))
149
- }), /* @__PURE__ */ D("ul", {
153
+ }), /* @__PURE__ */ O("ul", {
150
154
  "aria-label": "Legend",
151
155
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
152
- children: r.map((e) => /* @__PURE__ */ O("li", {
156
+ children: r.map((e) => /* @__PURE__ */ k("li", {
153
157
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
154
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
158
+ children: [/* @__PURE__ */ O(d, {
159
+ tone: e.tone,
160
+ shape: e.shape
161
+ }), /* @__PURE__ */ k("span", {
155
162
  className: "xeuugli",
156
- children: [e.label, /* @__PURE__ */ D("span", {
163
+ children: [e.label, /* @__PURE__ */ O("span", {
157
164
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
158
165
  children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
159
166
  })]
@@ -161,41 +168,44 @@ function le({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a,
161
168
  }, e.id))
162
169
  })]
163
170
  }),
164
- /* @__PURE__ */ D("span", {
171
+ /* @__PURE__ */ O("span", {
165
172
  id: e,
166
173
  "aria-live": l === "keyboard" ? "polite" : "off",
167
174
  className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
168
- children: ce({
175
+ children: le({
169
176
  label: t,
170
177
  summary: n,
171
178
  rows: a,
172
179
  notes: u
173
180
  })
174
181
  }),
175
- t !== void 0 && /* @__PURE__ */ D("div", {
182
+ t !== void 0 && /* @__PURE__ */ O("div", {
176
183
  "aria-hidden": !0,
177
184
  className: "x1n2onr6 xqtp20y x1vjfegm",
178
- children: /* @__PURE__ */ O("div", {
179
- ...x.props(P.inspector, f && P.summaryInspector, P.position(h, p)),
185
+ children: /* @__PURE__ */ k("div", {
186
+ ...S.props(I.inspector, !m && I.summaryInspector, I.position(_, h)),
180
187
  children: [
181
- /* @__PURE__ */ O("div", {
188
+ /* @__PURE__ */ k("div", {
182
189
  className: "x78zum5 x1qughib x1hnptsi xk4h15q",
183
- children: [/* @__PURE__ */ D("span", { children: t }), n !== void 0 && /* @__PURE__ */ D("span", { children: n })]
190
+ children: [/* @__PURE__ */ O("span", { children: t }), n !== void 0 && /* @__PURE__ */ O("span", { children: n })]
184
191
  }),
185
- /* @__PURE__ */ D("dl", {
192
+ /* @__PURE__ */ O("dl", {
186
193
  className: "xrvj5dj xunmzkg x1ghz6dp",
187
- children: a.map((e) => /* @__PURE__ */ O("div", {
194
+ children: a.map((e) => /* @__PURE__ */ k("div", {
188
195
  className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
189
- children: [/* @__PURE__ */ O("dt", {
196
+ children: [/* @__PURE__ */ k("dt", {
190
197
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
191
- children: [/* @__PURE__ */ D(d, { tone: e.tone }), e.label]
192
- }), /* @__PURE__ */ D("dd", {
198
+ children: [/* @__PURE__ */ O(d, {
199
+ tone: e.tone,
200
+ shape: e.shape
201
+ }), e.label]
202
+ }), /* @__PURE__ */ O("dd", {
193
203
  className: "x1ghz6dp xuxw1ft",
194
204
  children: e.value
195
205
  })]
196
206
  }, e.id))
197
207
  }),
198
- u.map((e) => /* @__PURE__ */ D("span", { children: e }, e))
208
+ u.map((e) => /* @__PURE__ */ O("span", { children: e }, e))
199
209
  ]
200
210
  })
201
211
  })
@@ -203,7 +213,7 @@ function le({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a,
203
213
  });
204
214
  }
205
215
  // packages/charts/src/cartesian/bar-data.ts
206
- function ue({ composition: e, series: t, categoryIds: n, domain: r }) {
216
+ function de({ composition: e, series: t, categoryIds: n, domain: r }) {
207
217
  if (e === void 0) return;
208
218
  if (e.buckets.length !== n.length) return "Composition requires one explicit bucket per category.";
209
219
  let i = e.annotation;
@@ -220,28 +230,157 @@ function ue({ composition: e, series: t, categoryIds: n, domain: r }) {
220
230
  }
221
231
  }
222
232
  }
233
+ var L = 6;
234
+ function fe(e, t) {
235
+ return e === null ? !0 : e === void 0 || !Number.isFinite(e) ? !1 : e >= t[0] && e <= t[1];
236
+ }
237
+ function R({ marker: e, categoryCount: t, domain: n }) {
238
+ let r = e.kind === "tick" ? [e.values] : [e.lower, e.upper];
239
+ if (r.some((e) => e.length !== t)) return "Every bar marker requires one explicit value per category.";
240
+ if (r.some((e) => e.some((e) => !fe(e, n)))) return "Bar marker values must be finite and within the supplied domain.";
241
+ if (e.kind === "range") for (let [t, n] of e.lower.entries()) {
242
+ let r = e.upper[t] ?? null;
243
+ if (n === null != (r === null) || n !== null && r !== null && n > r) return "A range marker needs both bounds, with the lower bound at most the upper bound, or neither.";
244
+ }
245
+ }
246
+ function pe({ markers: e, annotations: t, emphasizedCategoryIds: n, seriesIds: r, categoryIds: i, domain: a }) {
247
+ if (e.length > L) return `Supply at most ${L} bar markers.`;
248
+ let o = [...e, ...t];
249
+ if (new Set(o.map((e) => e.id)).size !== o.length || r.some((e) => o.some((t) => t.id === e))) return "Bar series, markers, and annotations require distinct identifiers.";
250
+ for (let t of e) {
251
+ if (!r.includes(t.seriesId)) return "Each bar marker must refer to a supplied series.";
252
+ let e = R({
253
+ marker: t,
254
+ categoryCount: i.length,
255
+ domain: a
256
+ });
257
+ if (e !== void 0) return e;
258
+ }
259
+ for (let e of t) {
260
+ let t = e.seriesId === void 0 || r.includes(e.seriesId), n = e.label.trim() !== "";
261
+ if (!(i.includes(e.categoryId) && t && n)) return "Each bar annotation needs a label, a supplied category, and a supplied series when it names one.";
262
+ }
263
+ if (new Set(t.map((e) => JSON.stringify([e.categoryId, e.seriesId ?? null]))).size !== t.length) return "Each bar can hold one annotation.";
264
+ if (new Set(n).size !== n.length || n.some((e) => !i.includes(e))) return "Emphasized categories must be unique supplied categories.";
265
+ }
266
+ function z({ marker: e, index: t, formatValue: n }) {
267
+ if (e.kind === "tick") {
268
+ let r = e.values[t] ?? null;
269
+ return r === null ? "Unavailable" : n(r);
270
+ }
271
+ let r = e.lower[t] ?? null, i = e.upper[t] ?? null;
272
+ return r === null || i === null ? "Unavailable" : `${n(r)} – ${n(i)}`;
273
+ }
274
+ function B(e, t) {
275
+ return e.kind === "tick" ? e.values[t] ?? null : e.upper[t] ?? null;
276
+ }
277
+ // packages/charts/src/cartesian/bar-overlays.tsx
278
+ var me = {
279
+ kU5bRw: "x5lxx2x",
280
+ kREpy8: "x13efnbd",
281
+ $$css: !0
282
+ }, V = { stroke: (e) => [
283
+ me,
284
+ {
285
+ kjVXCG: e == null ? e : "x6mkzkt",
286
+ $$css: !0
287
+ },
288
+ { "--x-stroke": e ?? void 0 }
289
+ ] }, he = 3, H = 1, U = 1.5, ge = 3, W = 14, _e = 6.5;
290
+ function ve({ path: e, color: t, width: n }) {
291
+ return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O("path", {
292
+ d: e,
293
+ strokeWidth: n + 4,
294
+ className: "xaep1og x5lxx2x x13efnbd"
295
+ }), /* @__PURE__ */ O("path", {
296
+ d: e,
297
+ strokeWidth: n,
298
+ ...S.props(V.stroke(t))
299
+ })] });
300
+ }
301
+ function ye({ marker: e, index: t, span: n, base: r, y: i }) {
302
+ let a = e.kind === "tick" ? e.values[t] ?? null : null;
303
+ if (a !== null && r !== null && a !== r) return `M${n.x + n.width / 2},${i(r)} V${i(a)}`;
304
+ }
305
+ function be({ marker: e, index: t, span: n, y: r }) {
306
+ if (e.kind === "tick") {
307
+ let i = e.values[t] ?? null;
308
+ if (i === null) return;
309
+ let a = r(i);
310
+ return `M${n.x - ge},${a} H${n.x + n.width + ge}`;
311
+ }
312
+ let i = e.lower[t] ?? null, a = e.upper[t] ?? null;
313
+ if (i === null || a === null) return;
314
+ let o = n.x + n.width / 2, s = Math.min(W, n.width * .6) / 2, c = r(i), l = r(a);
315
+ return `M${o - s},${l} H${o + s} M${o},${l} V${c} M${o - s},${c} H${o + s}`;
316
+ }
317
+ function xe({ markers: t, categoryIds: n, span: r, barTop: i, y: a, isReceded: o }) {
318
+ return /* @__PURE__ */ O("g", { children: t.map((t) => /* @__PURE__ */ O("g", { children: n.map((n, s) => {
319
+ let c = r(n, t.seriesId), l = be({
320
+ marker: t,
321
+ index: s,
322
+ span: c,
323
+ y: a
324
+ });
325
+ if (l === void 0) return null;
326
+ let u = e[t.tone ?? "neutral"], d = ye({
327
+ marker: t,
328
+ index: s,
329
+ span: c,
330
+ base: i(s, t.seriesId),
331
+ y: a
332
+ });
333
+ return /* @__PURE__ */ k("g", {
334
+ ...S.props(v.emphasis, o(n) && v.receded),
335
+ children: [d !== void 0 && /* @__PURE__ */ O(ve, {
336
+ path: d,
337
+ color: u,
338
+ width: H
339
+ }), /* @__PURE__ */ O(ve, {
340
+ path: l,
341
+ color: u,
342
+ width: t.kind === "tick" ? he : U
343
+ })]
344
+ }, n);
345
+ }) }, t.id)) });
346
+ }
347
+ function Se({ annotations: e, left: t, right: n }) {
348
+ return /* @__PURE__ */ O("g", {
349
+ "aria-hidden": !0,
350
+ children: e.map((e) => {
351
+ let r = e.label.length * _e / 2, i = e.x - r < t, a = e.x + r > n, o = i ? "start" : a ? "end" : "middle", s = i ? t : a ? n : e.x;
352
+ return /* @__PURE__ */ O("text", {
353
+ x: s,
354
+ y: e.y,
355
+ textAnchor: o,
356
+ ...S.props(v.label, v.strongLabel, v.haloLabel, v.emphasis, e.isReceded && v.receded),
357
+ children: e.label
358
+ }, e.id);
359
+ })
360
+ });
361
+ }
223
362
  // packages/charts/src/cartesian/composition-bars.tsx
224
- var I = { mark: {
363
+ var G = { mark: {
225
364
  k3nNDw: "x1hj3fc7",
226
365
  k1ekBW: "xwcsmn1",
227
366
  kIyJzY: "xtitasy x12w9bfk",
228
367
  kAMwcw: "x1faw7qm",
229
368
  $$css: !0
230
369
  } };
231
- function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
370
+ function Ce({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
232
371
  let d = r !== void 0, f = r !== void 0 && !n.some((e) => e.id === r.id) ? [...n, r] : n;
233
372
  function p(e, t) {
234
373
  let n = c(t), r = c(t + e);
235
374
  return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0), Math.abs(r - n))})`;
236
375
  }
237
- return /* @__PURE__ */ O(E, { children: [t.kind !== "gap" && /* @__PURE__ */ D("rect", {
376
+ return /* @__PURE__ */ k(D, { children: [t.kind !== "gap" && /* @__PURE__ */ O("rect", {
238
377
  x: o,
239
378
  y: 0,
240
379
  width: s,
241
380
  height: 1,
242
381
  vectorEffect: "non-scaling-stroke",
243
382
  fill: e.neutral,
244
- ...x.props(I.mark, l && v.selected),
383
+ ...S.props(G.mark, l && v.selected),
245
384
  style: {
246
385
  transform: p(t.total, 0),
247
386
  opacity: d ? .18 : +(t.kind === "total")
@@ -250,14 +389,14 @@ function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s,
250
389
  let m = c.values[i];
251
390
  if (m == null) return null;
252
391
  let h = r?.id === c.id, g = d ? 0 : n.slice(0, f).reduce((e, t) => e + (t.values[i] ?? 0), 0), _ = d ? h : t.kind === "parts", ee = !d && u !== void 0 && u !== c.id;
253
- return /* @__PURE__ */ D("rect", {
392
+ return /* @__PURE__ */ O("rect", {
254
393
  x: o,
255
394
  y: 0,
256
395
  width: s,
257
396
  height: 1,
258
397
  vectorEffect: "non-scaling-stroke",
259
398
  fill: e[a(c.tone, f)],
260
- ...x.props(I.mark, l && v.selected),
399
+ ...S.props(G.mark, l && v.selected),
261
400
  style: {
262
401
  transform: p(m, g),
263
402
  opacity: _ ? ee ? .3 : 1 : 0
@@ -265,8 +404,100 @@ function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s,
265
404
  }, c.id);
266
405
  })] });
267
406
  }
407
+ // packages/charts/src/cartesian/reference-lines.tsx
408
+ var we = {
409
+ kfJifR: "xhr4kjn",
410
+ k5rJSQ: "x1dz65qj",
411
+ kREpy8: "x13efnbd",
412
+ $$css: !0
413
+ }, Te = {
414
+ kfJifR: "xnpr05h",
415
+ kREpy8: "x13efnbd",
416
+ $$css: !0
417
+ }, K = {
418
+ line: (e) => [
419
+ we,
420
+ {
421
+ kjVXCG: e == null ? e : "x6mkzkt",
422
+ $$css: !0
423
+ },
424
+ { "--x-stroke": e ?? void 0 }
425
+ ],
426
+ leader: (e) => [
427
+ Te,
428
+ {
429
+ kjVXCG: e == null ? e : "x6mkzkt",
430
+ $$css: !0
431
+ },
432
+ { "--x-stroke": e ?? void 0 }
433
+ ]
434
+ }, Ee = 30, De = 13, q = 8, Oe = 4, J = 6.5, Y = 40, X = 112, ke = 16, Z = 8;
435
+ function Q({ lines: e, domain: t }) {
436
+ if (e.length > Z) return `Supply at most ${Z} reference lines.`;
437
+ if (!m(e)) return "Reference lines require unique identifiers.";
438
+ for (let n of e) if (!(Number.isFinite(n.value) && n.value >= t[0] && n.value <= t[1]) || n.label.trim() === "") return "Each reference line needs a label and a finite value inside the value domain.";
439
+ }
440
+ function Ae(e) {
441
+ return e.length > ke ? `${e.slice(0, 15)}…` : e;
442
+ }
443
+ function je({ lines: e, formatValue: t }) {
444
+ if (e.length === 0) return 0;
445
+ let n = Math.max(...e.map((e) => Math.max(Ae(e.label).length, t(e.value).length)));
446
+ return Math.min(X, Math.max(Y, n * J)) + q;
447
+ }
448
+ function Me({ lines: e, y: t, top: n, bottom: r }) {
449
+ let i = e.map((e) => ({
450
+ line: e,
451
+ position: t(e.value)
452
+ })).toSorted((e, t) => e.position - t.position), a = y({
453
+ positions: i.map((e) => e.position),
454
+ gap: Ee,
455
+ start: n + Ee / 2,
456
+ end: r - Ee / 2
457
+ });
458
+ return i.map((e, t) => ({
459
+ ...e,
460
+ center: a[t] ?? e.position
461
+ }));
462
+ }
463
+ function Ne({ lines: t, y: n, left: r, right: i, top: a, bottom: o, formatValue: s }) {
464
+ return /* @__PURE__ */ O("g", { children: Me({
465
+ lines: t,
466
+ y: n,
467
+ top: a,
468
+ bottom: o
469
+ }).map(({ line: t, position: n, center: a }) => {
470
+ let o = e[t.tone ?? "neutral"], c = i + q;
471
+ return /* @__PURE__ */ k("g", { children: [
472
+ /* @__PURE__ */ O("line", {
473
+ x1: r,
474
+ x2: i,
475
+ y1: n,
476
+ y2: n,
477
+ ...S.props(K.line(o))
478
+ }),
479
+ /* @__PURE__ */ O("path", {
480
+ d: `M${i},${n} L${i + Oe},${a} H${i + Oe + 1}`,
481
+ fill: "none",
482
+ ...S.props(K.leader(o))
483
+ }),
484
+ /* @__PURE__ */ O("text", {
485
+ x: c,
486
+ y: a - 2,
487
+ ...S.props(v.label, v.strongLabel),
488
+ children: Ae(t.label)
489
+ }),
490
+ /* @__PURE__ */ O("text", {
491
+ x: c,
492
+ y: a + De - 2,
493
+ ...S.props(v.label),
494
+ children: s(t.value)
495
+ })
496
+ ] }, t.id);
497
+ }) });
498
+ }
268
499
  // packages/charts/src/cartesian/bar-chart.tsx
269
- var L = {
500
+ var Pe = {
270
501
  plot: {
271
502
  kqGvvJ: "x1we84gm",
272
503
  $$css: !0
@@ -275,72 +506,73 @@ var L = {
275
506
  kSiTet: "xuzhngd",
276
507
  $$css: !0
277
508
  }
278
- }, fe = 200;
279
- function R({ title: e, description: t, report: n, series: r, layoutSeries: i, children: o, inspectionId: c, label: l, detail: u, summary: d, rows: f = [], x: m = 0, width: h = 0, offset: g, source: _, data: v, isLoading: ee = !1 }) {
280
- let y = r.map((e, t) => ({
509
+ }, Fe = 200, Ie = 12, Le = 30, Re = 8, ze = 14;
510
+ function Be({ title: e, description: t, report: n, series: r, layoutSeries: i, markerLegend: o = [], notes: c, children: l, inspectionId: u, label: d, detail: f, summary: m, rows: h = [], x: g = 0, width: _ = 0, offset: v, source: ee, data: y, isLoading: b = !1 }) {
511
+ let x = r.map((e, t) => ({
281
512
  id: e.id,
282
513
  label: e.label,
283
514
  tone: a(e.tone, t)
284
- })), b = i?.map((e, t) => ({
515
+ })), S = i?.map((e, t) => ({
285
516
  id: e.id,
286
517
  label: e.label,
287
518
  tone: a(e.tone, t)
288
- })), x = ee && r.length === 0 && n?.seriesValues === void 0;
289
- return /* @__PURE__ */ O(p, {
290
- title: /* @__PURE__ */ D(F, {
519
+ })), C = b && r.length === 0 && n?.seriesValues === void 0;
520
+ return /* @__PURE__ */ k(p, {
521
+ title: /* @__PURE__ */ O(ce, {
291
522
  title: e,
292
- detail: u
523
+ detail: f
293
524
  }),
294
525
  description: t,
295
526
  report: n,
296
- series: y,
527
+ series: x,
297
528
  children: [
298
- v !== void 0 && /* @__PURE__ */ D(s, { ...v }),
299
- x ? /* @__PURE__ */ D(se, {}) : /* @__PURE__ */ D(le, {
300
- id: c,
301
- label: l,
302
- summary: d,
303
- legend: y,
529
+ y !== void 0 && /* @__PURE__ */ O(s, { ...y }),
530
+ C ? /* @__PURE__ */ O(se, {}) : /* @__PURE__ */ O(ue, {
531
+ id: u,
532
+ label: d,
533
+ summary: m,
534
+ legend: [...x, ...o],
304
535
  hasSeriesSummary: n?.seriesValues !== void 0,
305
- layoutLegend: b,
306
- rows: f,
307
- x: m,
308
- width: h,
309
- offset: g,
310
- source: _
536
+ layoutLegend: S === void 0 ? void 0 : [...S, ...o],
537
+ rows: h,
538
+ notes: c,
539
+ x: g,
540
+ width: _,
541
+ offset: v,
542
+ source: ee
311
543
  }),
312
- o
544
+ l
313
545
  ]
314
546
  });
315
547
  }
316
- function z({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = fe }) {
317
- let o = B(a), s = C();
318
- return o === void 0 ? /* @__PURE__ */ D("div", {
548
+ function Ve({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = Fe }) {
549
+ let o = He(a), s = w();
550
+ return o === void 0 ? /* @__PURE__ */ O("div", {
319
551
  "aria-hidden": !0,
320
552
  inert: !0,
321
- children: /* @__PURE__ */ D(R, {
553
+ children: /* @__PURE__ */ O(Be, {
322
554
  title: e,
323
555
  description: n,
324
556
  report: r,
325
557
  series: i,
326
558
  inspectionId: s,
327
559
  isLoading: !0,
328
- children: /* @__PURE__ */ D("div", {
329
- ...x.props(v.plot, L.plot),
330
- children: /* @__PURE__ */ D(t, { height: a })
560
+ children: /* @__PURE__ */ O("div", {
561
+ ...S.props(v.plot, Pe.plot),
562
+ children: /* @__PURE__ */ O(t, { height: a })
331
563
  })
332
564
  })
333
- }) : /* @__PURE__ */ D(g, {
565
+ }) : /* @__PURE__ */ O(g, {
334
566
  title: e,
335
567
  description: n,
336
568
  report: r,
337
569
  message: o
338
570
  });
339
571
  }
340
- function B(e) {
572
+ function He(e) {
341
573
  if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
342
574
  }
343
- function pe({ categories: e, series: t, domain: n, mode: r }) {
575
+ function Ue({ categories: e, series: t, domain: n, mode: r }) {
344
576
  if (e.length > i.items || t.length > i.series) return `Choose a window with at most ${i.items} categories and ${i.series} series.`;
345
577
  if (!h(n) || n[0] > 0 || n[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
346
578
  if (!m(e) || !m(t)) return "Bar categories and series require unique identifiers.";
@@ -353,91 +585,167 @@ function pe({ categories: e, series: t, domain: n, mode: r }) {
353
585
  }
354
586
  if (r === "stacked" && e.some((e, r) => t.reduce((e, t) => e + (t.values[r] ?? 0), 0) > n[1])) return "Stacked bar totals must fit the supplied domain.";
355
587
  }
356
- var me = {
588
+ var We = {
357
589
  "x-default-marker": "x-default-marker",
358
590
  $$css: !0
359
591
  };
360
- function V({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: u, formatTick: d = u, highlightedSeriesId: f, selection: p, height: m = fe, composition: h }) {
361
- let _ = h?.focusedSeries, y = C(), b = _ === void 0 ? void 0 : pe({
592
+ function Ge({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: u, formatTick: d = u, highlightedSeriesId: f, selection: p, height: m = Fe, composition: h, referenceLines: _ = [], markers: y = [], annotations: b = [], emphasizedCategoryIds: x = [] }) {
593
+ let C = h?.focusedSeries, T = w(), ne = C === void 0 ? void 0 : Ue({
362
594
  categories: i,
363
- series: [_],
595
+ series: [C],
364
596
  domain: s,
365
597
  mode: "grouped"
366
- }), te = pe({
598
+ }), D = Ue({
367
599
  categories: i,
368
600
  series: o,
369
601
  domain: s,
370
602
  mode: c
371
- }) ?? b, ne = ue({
603
+ }) ?? ne, A = i.map((e) => e.id), ie = pe({
604
+ markers: y,
605
+ annotations: b,
606
+ emphasizedCategoryIds: x,
607
+ seriesIds: [...o, ...C === void 0 ? [] : [C]].map((e) => e.id),
608
+ categoryIds: A,
609
+ domain: s
610
+ }) ?? Q({
611
+ lines: _,
612
+ domain: s
613
+ }), M = de({
372
614
  composition: h,
373
615
  series: o,
374
- categoryIds: i.map((e) => e.id),
616
+ categoryIds: A,
375
617
  domain: s
376
- }) ?? B(m), w = te ?? ne, E = h === void 0 ? void 0 : {
377
- id: y,
618
+ }) ?? ie ?? He(m), P = D ?? M, F = h === void 0 ? void 0 : {
619
+ id: T,
378
620
  label: h.contextLabel,
379
621
  tone: "neutral",
380
622
  values: h.buckets.map((e) => e.kind === "gap" ? null : e.total)
381
- }, k = E === void 0 ? o : [
382
- E,
623
+ }, I = F === void 0 ? o : [
624
+ F,
383
625
  ...o,
384
- ..._ === void 0 || o.some((e) => e.id === _.id) ? [] : [_]
385
- ], re = _ !== void 0 && E !== void 0 ? [_, E] : o, { ref: ie, width: N, element: P } = ee(), oe = C(), [se, F] = T(), [le, I] = T();
386
- S(() => {
626
+ ...C === void 0 || o.some((e) => e.id === C.id) ? [] : [C]
627
+ ], oe = C !== void 0 && F !== void 0 ? [C, F] : o, { ref: se, width: ce, element: ue } = ee(), L = w(), [fe, R] = E(), [me, V] = E();
628
+ te(() => {
387
629
  function e(e) {
388
- e.target instanceof Node && P?.contains(e.target) !== !0 && F(void 0);
630
+ e.target instanceof Node && ue?.contains(e.target) !== !0 && R(void 0);
389
631
  }
390
632
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
391
- }, [P]);
392
- let z = i.findIndex((e) => e.id === se?.id), V = i[z], H = i[i.findIndex((e) => e.id === p?.selectedId)], ge = i.find((e) => e.id === le) ?? H ?? i[0], U = V, W = z, G = h?.buckets[W], K = _ !== void 0 && E !== void 0 ? [_, E] : E === void 0 || G?.kind === "parts" ? o : [], q = G === void 0 ? void 0 : G.kind === "gap" ? "No reported value" : u(G.total);
393
- if (w !== void 0) return /* @__PURE__ */ D(g, {
633
+ }, [ue]);
634
+ let he = i.findIndex((e) => e.id === fe?.id), H = i[he], U = i[i.findIndex((e) => e.id === p?.selectedId)], ge = i.find((e) => e.id === me) ?? U ?? i[0], W = H, _e = he, ve = h?.buckets[_e], ye = C !== void 0 && F !== void 0 ? [C, F] : F === void 0 || ve?.kind === "parts" ? o : [], be = ve === void 0 ? void 0 : ve.kind === "gap" ? "No reported value" : u(ve.total);
635
+ if (P !== void 0) return /* @__PURE__ */ O(g, {
394
636
  title: t,
395
637
  description: n,
396
638
  report: r,
397
- message: w
639
+ message: P
398
640
  });
399
- let _e = K.map((e, t) => {
400
- let n = e.values[W];
641
+ let G = ye.map((e, t) => {
642
+ let n = e.values[_e];
401
643
  return {
402
644
  id: e.id,
403
645
  label: e.label,
404
646
  tone: a(e.tone, t),
405
647
  value: n == null ? "Unavailable" : u(n)
406
648
  };
407
- }), ve = m - 28, J = j({
649
+ }), we = y.map((e) => ({
650
+ id: e.id,
651
+ label: e.label,
652
+ tone: e.tone ?? "neutral",
653
+ shape: e.kind
654
+ })), Te = y.map((e) => ({
655
+ id: e.id,
656
+ label: e.label,
657
+ tone: e.tone ?? "neutral",
658
+ shape: e.kind,
659
+ value: z({
660
+ marker: e,
661
+ index: _e,
662
+ formatValue: u
663
+ })
664
+ })), K = _.map((e) => ({
665
+ id: e.id,
666
+ label: e.label,
667
+ tone: e.tone ?? "neutral",
668
+ shape: "dashed",
669
+ value: u(e.value)
670
+ })), Ee = W === void 0 ? [] : [
671
+ ...G,
672
+ ...Te,
673
+ ...K
674
+ ], De = b.filter((e) => e.categoryId === W?.id).map((e) => e.label), q = b.length > 0 ? Le : Ie, Oe = m - 28, J = j({
408
675
  domain: [...s],
409
- range: [ve, 12]
410
- }), Y = Math.max(44, ...J.ticks(3).map((e) => d(e).length * 7 + 12)), X = Math.max(Y + 1, N - 16), Z = A({
676
+ range: [Oe, q]
677
+ }), Y = Math.max(44, ...J.ticks(3).map((e) => d(e).length * 7 + 12)), X = je({
678
+ lines: _,
679
+ formatValue: d
680
+ }), ke = Math.max(Y + 1, ce - 16 - X), Z = re({
411
681
  domain: i.map((e) => e.id),
412
- range: [Y, X],
682
+ range: [Y, ke],
413
683
  padding: .3
414
- }), Q = A({
684
+ }), Ae = re({
415
685
  domain: o.map((e) => e.id),
416
686
  range: [0, Z.bandwidth()],
417
687
  padding: .08
418
- }), ye = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), $ = Math.max(1, Math.ceil((ye + 16) / Z.step())), be = Math.max(1, Math.floor((Z.step() * $ - 16) / 7));
419
- function xe(e) {
420
- let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * N, r = Math.floor((n - Y) / Z.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
421
- a !== void 0 && (e.type === "pointerdown" && I(a.id), F({
688
+ }), Me = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), Ve = Math.max(1, Math.ceil((Me + 16) / Z.step())), Ge = c === "stacked" || h !== void 0;
689
+ function qe(e, t) {
690
+ let n = Z(e) ?? Y;
691
+ return Ge ? {
692
+ x: n,
693
+ width: Z.bandwidth()
694
+ } : {
695
+ x: n + (Ae(t) ?? 0),
696
+ width: Ae.bandwidth()
697
+ };
698
+ }
699
+ function Je(e, t) {
700
+ if (!Ge) return o.find((e) => e.id === t)?.values[e] ?? null;
701
+ let n = o.flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null));
702
+ return n.length === 0 ? null : n.reduce((e, t) => e + t, 0);
703
+ }
704
+ function Ye(e) {
705
+ let t = x.includes(e);
706
+ return x.length > 0 && !t && H?.id !== e;
707
+ }
708
+ function Xe(e, t) {
709
+ let n = (t === void 0 ? o : o.filter((e) => e.id === t)).flatMap((t) => [t.values[e] ?? null].filter((e) => e !== null)), r = Ge ? n.reduce((e, t) => e + Math.max(0, t), 0) : Math.max(0, ...n), i = h?.buckets[e], a = i === void 0 || i.kind === "gap" ? 0 : i.total, s = y.filter((e) => t === void 0 || e.seriesId === t).flatMap((t) => [B(t, e)].filter((e) => e !== null));
710
+ return Math.max(0, r, a, ...s);
711
+ }
712
+ let Ze = b.map((e) => {
713
+ let t = Xe(A.indexOf(e.categoryId), e.seriesId), n = e.seriesId === void 0 ? {
714
+ x: Z(e.categoryId) ?? Y,
715
+ width: Z.bandwidth()
716
+ } : qe(e.categoryId, e.seriesId);
717
+ return {
718
+ id: e.id,
719
+ label: e.label,
720
+ x: n.x + n.width / 2,
721
+ y: Math.max(ze, J(t) - Re),
722
+ isReceded: Ye(e.categoryId)
723
+ };
724
+ }), Qe = Math.max(1, Math.floor((Z.step() * Ve - 16) / 7));
725
+ function $e(e) {
726
+ let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * ce, r = Math.floor((n - Y) / Z.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
727
+ a !== void 0 && (e.type === "pointerdown" && V(a.id), R({
422
728
  id: a.id,
423
729
  source: "pointer"
424
730
  }));
425
731
  }
426
- return /* @__PURE__ */ D(R, {
732
+ return /* @__PURE__ */ O(Be, {
427
733
  title: t,
428
734
  description: n,
429
735
  report: r,
430
- series: re,
736
+ series: oe,
431
737
  layoutSeries: o,
432
- inspectionId: oe,
433
- label: U?.label,
434
- detail: U === void 0 ? void 0 : [U.axisLabel ?? U.label, q].filter(Boolean).join(" · "),
435
- summary: q,
436
- rows: _e,
437
- x: (Z(U?.id ?? "") ?? Y) + Z.bandwidth() / 2,
438
- width: N,
738
+ markerLegend: we,
739
+ notes: De,
740
+ inspectionId: L,
741
+ label: W?.label,
742
+ detail: W === void 0 ? void 0 : [W.axisLabel ?? W.label, be].filter(Boolean).join(" · "),
743
+ summary: be,
744
+ rows: Ee,
745
+ x: (Z(W?.id ?? "") ?? Y) + Z.bandwidth() / 2,
746
+ width: ce,
439
747
  offset: Z.bandwidth() / 2 + 8,
440
- source: se?.source,
748
+ source: fe?.source,
441
749
  data: {
442
750
  label: `${t} observations`,
443
751
  columns: [{
@@ -447,128 +755,165 @@ function V({ title: t, description: n, report: r, categories: i, series: o, doma
447
755
  id: "value",
448
756
  label: "Value"
449
757
  }],
450
- rows: i.map((e, t) => ({
758
+ rows: [...i.map((e, t) => ({
451
759
  id: e.id,
452
- values: [e.label, he(k, t, u)]
453
- }))
760
+ values: [e.label, [
761
+ Ke(I, t, u),
762
+ ...y.map((e) => `${e.label}: ${z({
763
+ marker: e,
764
+ index: t,
765
+ formatValue: u
766
+ })}`),
767
+ ...b.filter((t) => t.categoryId === e.id).map((e) => e.label)
768
+ ].join(" · ")]
769
+ })), ..._.map((e) => ({
770
+ id: `reference:${e.id}`,
771
+ values: [e.label, u(e.value)]
772
+ }))]
454
773
  },
455
- children: /* @__PURE__ */ D("div", {
456
- ref: ie,
457
- ...x.props(v.plot, L.plot),
458
- children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ D("p", {
774
+ children: /* @__PURE__ */ O("div", {
775
+ ref: se,
776
+ ...S.props(v.plot, Pe.plot),
777
+ children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ O("p", {
459
778
  className: "x153jb6y x1ghz6dp xy8obcc",
460
779
  children: "No categories"
461
- }) : /* @__PURE__ */ O(l, {
780
+ }) : /* @__PURE__ */ k(l, {
462
781
  role: "img",
463
782
  "aria-label": `${t}. Use arrow keys to inspect categories.${p === void 0 ? "" : " Press Enter to select."}`,
464
- "aria-describedby": oe,
783
+ "aria-describedby": L,
465
784
  tabIndex: 0,
466
- viewBox: `0 0 ${N} ${m}`,
785
+ viewBox: `0 0 ${ce} ${m}`,
467
786
  height: m,
468
787
  controls: {
469
788
  items: i,
470
789
  cursor: ge?.id,
471
- inspected: V?.id,
472
- selected: H?.id,
473
- readout: ce({
474
- label: V?.label,
475
- summary: q,
476
- rows: _e
790
+ inspected: H?.id,
791
+ selected: U?.id,
792
+ readout: le({
793
+ label: H?.label,
794
+ summary: be,
795
+ rows: Ee,
796
+ notes: De
477
797
  }),
478
798
  onInspect: (e) => {
479
- I(e), F({
799
+ V(e), R({
480
800
  id: e,
481
801
  source: "keyboard"
482
802
  });
483
803
  },
484
- onDismiss: () => F(void 0),
804
+ onDismiss: () => R(void 0),
485
805
  onSelect: p?.onSelect
486
806
  },
487
807
  onFocus: (e) => {
488
808
  if (e.currentTarget.matches(":focus-visible")) {
489
- let e = H ?? i[0];
490
- I(e?.id), F(e === void 0 ? void 0 : {
809
+ let e = U ?? i[0];
810
+ V(e?.id), R(e === void 0 ? void 0 : {
491
811
  id: e.id,
492
812
  source: "keyboard"
493
813
  });
494
814
  }
495
815
  },
496
816
  onPointerMove: (e) => {
497
- e.pointerType === "mouse" && xe(e);
817
+ e.pointerType === "mouse" && $e(e);
498
818
  },
499
- onPointerDown: xe,
819
+ onPointerDown: $e,
500
820
  onPointerLeave: (e) => {
501
- e.pointerType === "mouse" && se?.source === "pointer" && F(void 0);
821
+ e.pointerType === "mouse" && fe?.source === "pointer" && R(void 0);
502
822
  },
503
- onBlur: () => F(void 0),
823
+ onBlur: () => R(void 0),
504
824
  onClick: () => {
505
- V !== void 0 && p?.onSelect(V.id);
825
+ H !== void 0 && p?.onSelect(H.id);
506
826
  },
507
- ...x.props(v.svg, v.inspectable, me),
827
+ ...S.props(v.svg, v.inspectable, We),
508
828
  children: [
509
- V !== void 0 && /* @__PURE__ */ D("rect", {
510
- x: (Z(V.id) ?? Y) - (Z.step() - Z.bandwidth()) / 2,
511
- y: 12,
829
+ H !== void 0 && /* @__PURE__ */ O("rect", {
830
+ x: (Z(H.id) ?? Y) - (Z.step() - Z.bandwidth()) / 2,
831
+ y: q,
512
832
  width: Z.step(),
513
- height: ve - 12,
833
+ height: Oe - q,
514
834
  className: "x2wnxhi"
515
835
  }),
516
- J.ticks(3).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
836
+ J.ticks(3).map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
517
837
  x1: Y,
518
- x2: X,
838
+ x2: ke,
519
839
  y1: J(e),
520
840
  y2: J(e),
521
- ...x.props(v.grid)
522
- }), /* @__PURE__ */ D("text", {
841
+ ...S.props(v.grid)
842
+ }), /* @__PURE__ */ O("text", {
523
843
  x: Y - 8,
524
844
  y: J(e),
525
845
  textAnchor: "end",
526
846
  dominantBaseline: "middle",
527
- ...x.props(v.label),
847
+ ...S.props(v.label),
528
848
  children: d(e)
529
849
  })] }, e)),
530
- h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ D("text", {
850
+ h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ O("text", {
531
851
  x: Z(h.annotation.categoryId),
532
- y: Math.max(12, J(h.annotation.value) - 8),
533
- ...x.props(v.label),
852
+ y: Math.max(q, J(h.annotation.value) - 8),
853
+ ...S.props(v.label),
534
854
  children: h.annotation.label
535
855
  }),
536
856
  i.map((t, n) => {
537
857
  let r = t.axisLabel ?? t.label, i = h?.buckets[n];
538
- return /* @__PURE__ */ O("g", { children: [i === void 0 ? o.map((r, i) => {
539
- let s = r.values[n];
540
- if (s == null) return null;
541
- let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = J(l), d = J(l + s), m = p?.selectedId === t.id || V?.id === t.id;
542
- return /* @__PURE__ */ D(M, {
543
- x: (Z(t.id) ?? Y) + (c === "stacked" ? 0 : Q(r.id) ?? 0),
544
- y: Math.min(u, d),
545
- width: c === "stacked" ? Z.bandwidth() : Q.bandwidth(),
546
- height: Math.max(+(s === 0), Math.abs(d - u)),
547
- fill: e[a(r.tone, i)],
548
- ...x.props(m && v.selected, f !== void 0 && f !== r.id && L.mutedMark)
549
- }, r.id);
550
- }) : /* @__PURE__ */ D(de, {
551
- bucket: i,
552
- series: o,
553
- focusedSeries: _,
554
- index: n,
555
- x: Z(t.id) ?? Y,
556
- width: Z.bandwidth(),
557
- y: J,
558
- isHighlighted: p?.selectedId === t.id || V?.id === t.id,
559
- highlightedSeriesId: f
560
- }), n % $ === 0 && /* @__PURE__ */ D("text", {
858
+ return /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("g", {
859
+ ...S.props(v.emphasis, Ye(t.id) && v.receded),
860
+ children: i === void 0 ? o.map((r, i) => {
861
+ let s = r.values[n];
862
+ if (s == null) return null;
863
+ let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = J(l), d = J(l + s), m = p?.selectedId === t.id || H?.id === t.id;
864
+ return /* @__PURE__ */ O(N, {
865
+ x: (Z(t.id) ?? Y) + (c === "stacked" ? 0 : Ae(r.id) ?? 0),
866
+ y: Math.min(u, d),
867
+ width: c === "stacked" ? Z.bandwidth() : Ae.bandwidth(),
868
+ height: Math.max(+(s === 0), Math.abs(d - u)),
869
+ fill: e[a(r.tone, i)],
870
+ ...S.props(m && v.selected, f !== void 0 && f !== r.id && Pe.mutedMark)
871
+ }, r.id);
872
+ }) : /* @__PURE__ */ O(Ce, {
873
+ bucket: i,
874
+ series: o,
875
+ focusedSeries: C,
876
+ index: n,
877
+ x: Z(t.id) ?? Y,
878
+ width: Z.bandwidth(),
879
+ y: J,
880
+ isHighlighted: p?.selectedId === t.id || H?.id === t.id,
881
+ highlightedSeriesId: f
882
+ })
883
+ }), n % Ve === 0 && /* @__PURE__ */ O("text", {
561
884
  x: (Z(t.id) ?? Y) + Z.bandwidth() / 2,
562
885
  y: m - 4,
563
886
  textAnchor: "middle",
564
- ...x.props(v.label),
565
- children: r.length > be ? `${r.slice(0, be - 1)}…` : r
887
+ ...S.props(v.label),
888
+ children: r.length > Qe ? `${r.slice(0, Qe - 1)}…` : r
566
889
  })] }, t.id);
567
890
  }),
568
- ge !== void 0 && /* @__PURE__ */ D(ae, {
891
+ /* @__PURE__ */ O(Ne, {
892
+ lines: _,
893
+ y: J,
894
+ left: Y,
895
+ right: ke,
896
+ top: q,
897
+ bottom: Oe,
898
+ formatValue: d
899
+ }),
900
+ /* @__PURE__ */ O(xe, {
901
+ markers: y,
902
+ categoryIds: A,
903
+ span: qe,
904
+ barTop: Je,
905
+ y: J,
906
+ isReceded: Ye
907
+ }),
908
+ /* @__PURE__ */ O(Se, {
909
+ annotations: Ze,
910
+ left: Y,
911
+ right: ke
912
+ }),
913
+ ge !== void 0 && /* @__PURE__ */ O(ae, {
569
914
  x: (Z(ge.id) ?? Y) + Z.bandwidth() / 2,
570
- top: 12,
571
- bottom: ve,
915
+ top: q,
916
+ bottom: Oe,
572
917
  width: Math.max(8, Z.bandwidth())
573
918
  })
574
919
  ]
@@ -576,19 +921,19 @@ function V({ title: t, description: n, report: r, categories: i, series: o, doma
576
921
  })
577
922
  });
578
923
  }
579
- function he(e, t, n) {
924
+ function Ke(e, t, n) {
580
925
  return e.map((e) => {
581
926
  let r = e.values[t];
582
927
  return `${e.label}: ${r == null ? "Unavailable" : n(r)}`;
583
928
  }).join(" · ");
584
929
  }
585
930
  // packages/charts/src/cartesian/breakdown-bar.tsx
586
- var H = {
931
+ var qe = {
587
932
  kzqmXN: "x5lhr3w",
588
933
  kZKoxP: "x5yr21d",
589
934
  $$css: !0
590
- }, ge = { segment: (e, t) => [
591
- H,
935
+ }, Je = { segment: (e, t) => [
936
+ qe,
592
937
  {
593
938
  kWkggS: t == null ? t : "xl8spv7",
594
939
  $$css: !0
@@ -598,27 +943,27 @@ var H = {
598
943
  "--x-backgroundColor": t ?? void 0
599
944
  }
600
945
  ] };
601
- function U({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
946
+ function Ye({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
602
947
  let d = r(s), f = s.reduce((e, t) => e + (t.value ?? 0), 0), m = 2 ** -52 * Math.max(f, c, 1) * s.length;
603
- return d === void 0 ? !Number.isFinite(c) || c < 0 || f - c > m ? /* @__PURE__ */ D(g, {
948
+ return d === void 0 ? !Number.isFinite(c) || c < 0 || f - c > m ? /* @__PURE__ */ O(g, {
604
949
  title: t,
605
950
  report: n,
606
951
  description: i,
607
952
  message: "The total must be finite and at least the sum of recorded values."
608
- }) : /* @__PURE__ */ D(p, {
953
+ }) : /* @__PURE__ */ O(p, {
609
954
  title: t,
610
955
  report: n,
611
956
  description: i,
612
- children: s.length === 0 ? /* @__PURE__ */ D("p", {
957
+ children: s.length === 0 ? /* @__PURE__ */ O("p", {
613
958
  className: "x153jb6y x1ghz6dp xy8obcc",
614
959
  children: "No values"
615
- }) : /* @__PURE__ */ O(E, { children: [
616
- /* @__PURE__ */ D("div", {
960
+ }) : /* @__PURE__ */ k(D, { children: [
961
+ /* @__PURE__ */ O("div", {
617
962
  "aria-hidden": !0,
618
963
  className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
619
- children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ D("span", { ...x.props(ge.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
964
+ children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ O("span", { ...S.props(Je.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
620
965
  }),
621
- /* @__PURE__ */ D(o, {
966
+ /* @__PURE__ */ O(o, {
622
967
  items: s.map((e, t) => ({
623
968
  id: e.id,
624
969
  label: e.label,
@@ -627,7 +972,7 @@ function U({ title: t, report: n, description: i, items: s, total: c, formatValu
627
972
  })),
628
973
  selection: u
629
974
  }),
630
- c - f > m && /* @__PURE__ */ O("p", {
975
+ c - f > m && /* @__PURE__ */ k("p", {
631
976
  className: "x153jb6y x1ghz6dp xy8obcc",
632
977
  children: [
633
978
  "Unassigned portion: ",
@@ -637,20 +982,402 @@ function U({ title: t, report: n, description: i, items: s, total: c, formatValu
637
982
  ]
638
983
  })
639
984
  ] })
640
- }) : /* @__PURE__ */ D(g, {
985
+ }) : /* @__PURE__ */ O(g, {
641
986
  title: t,
642
987
  report: n,
643
988
  description: i,
644
989
  message: d
645
990
  });
646
991
  }
992
+ // packages/charts/src/cartesian/bridge-data.ts
993
+ function Xe(e) {
994
+ return e.kind !== "change" || e.value === null ? "neutral" : e.value < 0 ? "negative" : "positive";
995
+ }
996
+ function Ze(e) {
997
+ let t = e.map((e) => e.kind === "total" ? 0 : e.value);
998
+ return e[0]?.kind !== "start" || t.includes(null) ? null : t.reduce((e, t) => e + (t ?? 0), 0);
999
+ }
1000
+ function Qe({ step: e, before: t, after: n }) {
1001
+ let r = e.tone ?? Xe(e);
1002
+ switch (e.kind) {
1003
+ case "start": return {
1004
+ step: e,
1005
+ from: 0,
1006
+ to: e.value,
1007
+ tone: r
1008
+ };
1009
+ case "total": return {
1010
+ step: e,
1011
+ from: n === null ? null : 0,
1012
+ to: n,
1013
+ tone: r
1014
+ };
1015
+ case "change": return {
1016
+ step: e,
1017
+ from: t,
1018
+ to: n,
1019
+ tone: r
1020
+ };
1021
+ }
1022
+ }
1023
+ function $e(e) {
1024
+ return e.map((t, n) => Qe({
1025
+ step: t,
1026
+ before: Ze(e.slice(0, n)),
1027
+ after: Ze(e.slice(0, n + 1))
1028
+ }));
1029
+ }
1030
+ function et(e) {
1031
+ let t = e.flatMap((e) => [e.from, e.to].filter((e) => e !== null)), n = Math.min(0, ...t), r = Math.max(0, ...t);
1032
+ return n === r ? [n, n + 1] : [n, r];
1033
+ }
1034
+ function tt({ steps: e, domain: t }) {
1035
+ if (e.length > i.items) return `Choose a bridge with at most ${i.items} steps.`;
1036
+ if (!m(e)) return "Bridge steps require unique identifiers.";
1037
+ if (e.length > 0 && e[0]?.kind !== "start") return "A bridge begins with one start step.";
1038
+ if (e.filter((e) => e.kind === "start").length > 1) return "A bridge has exactly one start step.";
1039
+ if (e.some((e) => {
1040
+ let t = e.kind === "total" ? null : e.value;
1041
+ return t !== null && !Number.isFinite(t);
1042
+ })) return "Bridge values must be finite numbers or explicit missing changes.";
1043
+ let n = et($e(e));
1044
+ if (t === void 0) return Number.isFinite(n[0]) && Number.isFinite(n[1]) ? void 0 : "Running totals must stay finite.";
1045
+ let r = t[0] <= n[0] && t[1] >= n[1];
1046
+ if (!h(t) || !r) return "The bridge domain must be finite, increasing, and contain zero and every running total.";
1047
+ }
1048
+ // packages/charts/src/cartesian/bridge-chart.tsx
1049
+ var nt = {
1050
+ plot: {
1051
+ kqGvvJ: "x1we84gm",
1052
+ $$css: !0
1053
+ },
1054
+ bar: (e) => [{
1055
+ kDwRjp: e == null ? e : "x19zyb68",
1056
+ $$css: !0
1057
+ }, { "--x-fill": e ?? void 0 }]
1058
+ }, rt = 240, it = 24, at = 28, ot = 6, st = 14, ct = 12, lt = 7, ut = {
1059
+ start: v.strongLabel,
1060
+ change: void 0,
1061
+ total: v.strongLabel
1062
+ };
1063
+ function dt(e) {
1064
+ return (t) => t === 0 ? e(0) : `${t > 0 ? "+" : "−"}${e(Math.abs(t))}`;
1065
+ }
1066
+ function ft({ level: e, formatValue: t, formatChange: n }) {
1067
+ return e.step.kind === "change" && e.step.value !== null ? n(e.step.value) : e.to === null ? "—" : t(e.to);
1068
+ }
1069
+ function pt({ level: e, formatValue: t, formatChange: n }) {
1070
+ return e.step.kind === "change" ? e.step.value === null ? "Unavailable" : n(e.step.value) : e.to === null ? "Unavailable" : t(e.to);
1071
+ }
1072
+ function mt({ level: e, formatValue: t }) {
1073
+ return e.from === null || e.to === null ? "Unavailable" : `${t(e.from)} → ${t(e.to)}`;
1074
+ }
1075
+ var ht = {
1076
+ "x-default-marker": "x-default-marker",
1077
+ $$css: !0
1078
+ };
1079
+ function gt({ title: e, description: t, report: n, steps: r, formatValue: i, formatChange: a = dt(i), formatTick: o = i, domain: c, referenceLines: u = [], selection: d, height: f = rt }) {
1080
+ let { ref: m, width: h, element: _ } = ee(), y = w(), [b, x] = E(), [C, T] = E();
1081
+ te(() => {
1082
+ function e(e) {
1083
+ e.target instanceof Node && _?.contains(e.target) !== !0 && x(void 0);
1084
+ }
1085
+ return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1086
+ }, [_]);
1087
+ let ne = !Number.isFinite(f) || f < 96 ? "Chart height must be at least 96 pixels." : void 0, D = $e(r), A = c ?? et(D), ie = ne ?? tt({
1088
+ steps: r,
1089
+ domain: c
1090
+ }) ?? Q({
1091
+ lines: u,
1092
+ domain: A
1093
+ });
1094
+ if (ie !== void 0) return /* @__PURE__ */ O(g, {
1095
+ title: e,
1096
+ description: t,
1097
+ report: n,
1098
+ message: ie
1099
+ });
1100
+ let M = D.find((e) => e.step.id === b?.id), N = D.find((e) => e.step.id === d?.selectedId), P = D.find((e) => e.step.id === C) ?? N ?? D[0], F = M === void 0 ? void 0 : pt({
1101
+ level: M,
1102
+ formatValue: i,
1103
+ formatChange: a
1104
+ }), I = M?.step.kind === "change" ? [{
1105
+ id: "running",
1106
+ label: "Running total",
1107
+ tone: "neutral",
1108
+ value: mt({
1109
+ level: M,
1110
+ formatValue: i
1111
+ })
1112
+ }] : [], oe = u.map((e) => ({
1113
+ id: e.id,
1114
+ label: e.label,
1115
+ tone: e.tone ?? "neutral",
1116
+ shape: "dashed",
1117
+ value: i(e.value)
1118
+ })), se = M === void 0 ? [] : [...I, ...oe], de = f - at, L = j({
1119
+ domain: [...A],
1120
+ range: [de, it]
1121
+ }), fe = L.ticks(4), R = Math.max(44, ...fe.map((e) => o(e).length * lt + 12)), pe = je({
1122
+ lines: u,
1123
+ formatValue: o
1124
+ }), z = Math.max(R + 1, h - 16 - pe), B = re({
1125
+ domain: D.map((e) => e.step.id),
1126
+ range: [R, z],
1127
+ padding: .28
1128
+ }), me = D.map((e) => ({
1129
+ id: e.step.id,
1130
+ label: e.step.label
1131
+ })), V = Math.max(1, Math.floor((B.step() - 8) / lt));
1132
+ function he(e) {
1133
+ let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * h, r = Math.floor((n - R) / B.step()), i = D[Math.max(0, Math.min(D.length - 1, r))];
1134
+ i !== void 0 && (e.type === "pointerdown" && T(i.step.id), x({
1135
+ id: i.step.id,
1136
+ source: "pointer"
1137
+ }));
1138
+ }
1139
+ function H(e) {
1140
+ let t = e.axisLabel ?? e.label;
1141
+ return t.length > V ? `${t.slice(0, V - 1)}…` : t;
1142
+ }
1143
+ return /* @__PURE__ */ k(p, {
1144
+ title: /* @__PURE__ */ O(ce, {
1145
+ title: e,
1146
+ detail: M === void 0 ? void 0 : `${M.step.label} · ${F ?? ""}`
1147
+ }),
1148
+ description: t,
1149
+ report: n,
1150
+ children: [
1151
+ /* @__PURE__ */ O(s, {
1152
+ label: `${e} steps`,
1153
+ columns: [
1154
+ {
1155
+ id: "step",
1156
+ label: "Step"
1157
+ },
1158
+ {
1159
+ id: "value",
1160
+ label: "Value"
1161
+ },
1162
+ {
1163
+ id: "running",
1164
+ label: "Running total"
1165
+ }
1166
+ ],
1167
+ rows: [...D.map((e) => ({
1168
+ id: e.step.id,
1169
+ values: [
1170
+ e.step.label,
1171
+ pt({
1172
+ level: e,
1173
+ formatValue: i,
1174
+ formatChange: a
1175
+ }),
1176
+ e.step.kind === "change" ? mt({
1177
+ level: e,
1178
+ formatValue: i
1179
+ }) : pt({
1180
+ level: e,
1181
+ formatValue: i,
1182
+ formatChange: a
1183
+ })
1184
+ ]
1185
+ })), ...u.map((e) => ({
1186
+ id: `reference:${e.id}`,
1187
+ values: [
1188
+ e.label,
1189
+ i(e.value),
1190
+ ""
1191
+ ]
1192
+ }))]
1193
+ }),
1194
+ /* @__PURE__ */ O(ue, {
1195
+ id: y,
1196
+ label: M?.step.label,
1197
+ summary: F,
1198
+ legend: [],
1199
+ hasLegend: !1,
1200
+ rows: se,
1201
+ x: (B(M?.step.id ?? "") ?? R) + B.bandwidth() / 2,
1202
+ width: h,
1203
+ offset: B.bandwidth() / 2 + 8,
1204
+ source: b?.source
1205
+ }),
1206
+ /* @__PURE__ */ O("div", {
1207
+ ref: m,
1208
+ ...S.props(v.plot, nt.plot),
1209
+ children: D.length === 0 ? /* @__PURE__ */ O("p", {
1210
+ className: "x153jb6y x1ghz6dp xy8obcc",
1211
+ children: "No steps"
1212
+ }) : /* @__PURE__ */ k(l, {
1213
+ role: "img",
1214
+ "aria-label": `${e}. Use arrow keys to inspect steps.${d === void 0 ? "" : " Press Enter to select."}`,
1215
+ "aria-describedby": y,
1216
+ tabIndex: 0,
1217
+ viewBox: `0 0 ${h} ${f}`,
1218
+ height: f,
1219
+ controls: {
1220
+ items: me,
1221
+ cursor: P?.step.id,
1222
+ inspected: M?.step.id,
1223
+ selected: N?.step.id,
1224
+ readout: le({
1225
+ label: M?.step.label,
1226
+ summary: F,
1227
+ rows: se
1228
+ }),
1229
+ onInspect: (e) => {
1230
+ T(e), x({
1231
+ id: e,
1232
+ source: "keyboard"
1233
+ });
1234
+ },
1235
+ onDismiss: () => x(void 0),
1236
+ onSelect: d?.onSelect
1237
+ },
1238
+ onFocus: (e) => {
1239
+ if (e.currentTarget.matches(":focus-visible")) {
1240
+ let e = N ?? D[0];
1241
+ T(e?.step.id), x(e === void 0 ? void 0 : {
1242
+ id: e.step.id,
1243
+ source: "keyboard"
1244
+ });
1245
+ }
1246
+ },
1247
+ onPointerMove: (e) => {
1248
+ e.pointerType === "mouse" && he(e);
1249
+ },
1250
+ onPointerDown: he,
1251
+ onPointerLeave: (e) => {
1252
+ e.pointerType === "mouse" && b?.source === "pointer" && x(void 0);
1253
+ },
1254
+ onBlur: () => x(void 0),
1255
+ onClick: () => {
1256
+ M !== void 0 && d?.onSelect(M.step.id);
1257
+ },
1258
+ ...S.props(v.svg, v.inspectable, ht),
1259
+ children: [
1260
+ M !== void 0 && /* @__PURE__ */ O("rect", {
1261
+ x: (B(M.step.id) ?? R) - (B.step() - B.bandwidth()) / 2,
1262
+ y: it,
1263
+ width: B.step(),
1264
+ height: de - it,
1265
+ className: "x2wnxhi"
1266
+ }),
1267
+ fe.map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
1268
+ x1: R,
1269
+ x2: z,
1270
+ y1: L(e),
1271
+ y2: L(e),
1272
+ ...S.props(e === 0 ? v.baseline : v.grid)
1273
+ }), /* @__PURE__ */ O("text", {
1274
+ x: R - 8,
1275
+ y: L(e),
1276
+ textAnchor: "end",
1277
+ dominantBaseline: "middle",
1278
+ ...S.props(v.label),
1279
+ children: o(e)
1280
+ })] }, e)),
1281
+ D.map((e, t) => {
1282
+ let n = D[t + 1], r = B(e.step.id) ?? R;
1283
+ return n === void 0 || e.to === null || n.from === null ? null : /* @__PURE__ */ O("line", {
1284
+ x1: r + B.bandwidth(),
1285
+ x2: B(n.step.id) ?? r,
1286
+ y1: L(e.to),
1287
+ y2: L(e.to),
1288
+ className: "x1crw9hw xnpr05h x1ypbokr x13efnbd"
1289
+ }, `connector:${e.step.id}`);
1290
+ }),
1291
+ D.map((e) => /* @__PURE__ */ O(_t, {
1292
+ level: e,
1293
+ x: B(e.step.id) ?? R,
1294
+ width: B.bandwidth(),
1295
+ y: L,
1296
+ bottom: de,
1297
+ height: f,
1298
+ label: ft({
1299
+ level: e,
1300
+ formatValue: i,
1301
+ formatChange: a
1302
+ }),
1303
+ axisLabel: H(e.step),
1304
+ isHighlighted: M?.step.id === e.step.id || N?.step.id === e.step.id
1305
+ }, e.step.id)),
1306
+ /* @__PURE__ */ O(Ne, {
1307
+ lines: u,
1308
+ y: L,
1309
+ left: R,
1310
+ right: z,
1311
+ top: it,
1312
+ bottom: de,
1313
+ formatValue: o
1314
+ }),
1315
+ P !== void 0 && /* @__PURE__ */ O(ae, {
1316
+ x: (B(P.step.id) ?? R) + B.bandwidth() / 2,
1317
+ top: it,
1318
+ bottom: de,
1319
+ width: Math.max(8, B.bandwidth())
1320
+ })
1321
+ ]
1322
+ })
1323
+ })
1324
+ ]
1325
+ });
1326
+ }
1327
+ function _t({ level: t, x: n, width: r, y: i, bottom: a, height: o, label: s, axisLabel: c, isHighlighted: l }) {
1328
+ let u = n + r / 2, d = /* @__PURE__ */ O("text", {
1329
+ x: u,
1330
+ y: o - 4,
1331
+ textAnchor: "middle",
1332
+ ...S.props(v.label),
1333
+ children: c
1334
+ });
1335
+ if (t.from === null || t.to === null) {
1336
+ let e = t.from ?? 0, o = Math.min(a - ct, i(e) - ct / 2);
1337
+ return /* @__PURE__ */ k("g", { children: [
1338
+ /* @__PURE__ */ O("rect", {
1339
+ x: n,
1340
+ y: o,
1341
+ width: r,
1342
+ height: ct,
1343
+ className: "xbh8q5q x1crw9hw xnpr05h x1ypbokr x13efnbd"
1344
+ }),
1345
+ /* @__PURE__ */ O("text", {
1346
+ x: u,
1347
+ y: o - ot,
1348
+ textAnchor: "middle",
1349
+ ...S.props(v.label),
1350
+ children: s
1351
+ }),
1352
+ d
1353
+ ] });
1354
+ }
1355
+ let f = Math.max(t.from, t.to), p = Math.min(t.from, t.to), m = i(f), h = Math.max(1, i(p) - m), g = f <= 0 && p < 0 ? i(p) + st : m - ot;
1356
+ return /* @__PURE__ */ k("g", { children: [
1357
+ /* @__PURE__ */ O("rect", {
1358
+ x: n,
1359
+ y: m,
1360
+ width: r,
1361
+ height: h,
1362
+ ...S.props(nt.bar(e[t.tone]), l && v.selected)
1363
+ }),
1364
+ /* @__PURE__ */ O("text", {
1365
+ x: u,
1366
+ y: g,
1367
+ textAnchor: "middle",
1368
+ ...S.props(v.label, ut[t.step.kind], v.haloLabel),
1369
+ children: s
1370
+ }),
1371
+ d
1372
+ ] });
1373
+ }
647
1374
  // packages/charts/src/cartesian/scatter-plot.tsx
648
- var W = 260, G = 56, K = 20, q = 12, _e = 1e3, ve = {
1375
+ var vt = 260, yt = 56, bt = 20, xt = 12, St = 1e3, Ct = {
649
1376
  kzqmXN: "x1xc55vz",
650
1377
  kZKoxP: "xdk7pt",
651
1378
  kaIpWk: "x16rqkct",
652
1379
  $$css: !0
653
- }, J = {
1380
+ }, wt = {
654
1381
  brush: {
655
1382
  kFalU9: "xx69xxh",
656
1383
  kkrTdU: "xsid9ct",
@@ -688,7 +1415,7 @@ var W = 260, G = 56, K = 20, q = 12, _e = 1e3, ve = {
688
1415
  "--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
689
1416
  }],
690
1417
  dot: (e) => [
691
- ve,
1418
+ Ct,
692
1419
  {
693
1420
  kWkggS: e == null ? e : "xl8spv7",
694
1421
  $$css: !0
@@ -703,77 +1430,77 @@ var W = 260, G = 56, K = 20, q = 12, _e = 1e3, ve = {
703
1430
  $$css: !0
704
1431
  }
705
1432
  };
706
- function Y(t) {
707
- let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: d, yLabel: m, formatX: h, formatY: _, selection: v, rangeSelection: y, emptyLabel: b } = t, S = u({
1433
+ function Tt(t) {
1434
+ let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: d, yLabel: m, formatX: h, formatY: _, selection: v, rangeSelection: y, emptyLabel: b } = t, x = u({
708
1435
  title: n,
709
1436
  selection: v,
710
1437
  items: a.map((e) => ({
711
1438
  id: e.id,
712
1439
  label: `${e.label}, ${d}: ${h(e.x)}, ${m}: ${_(e.y)}`
713
1440
  }))
714
- }), { ref: C, width: ne } = ee(), w = Q(t);
715
- if (w !== null) return /* @__PURE__ */ D(g, {
1441
+ }), { ref: te, width: w } = ee(), T = Ot(t);
1442
+ if (T !== null) return /* @__PURE__ */ O(g, {
716
1443
  title: n,
717
1444
  report: r,
718
1445
  description: i,
719
- message: w
1446
+ message: T
720
1447
  });
721
- let T = j({
1448
+ let ne = j({
722
1449
  domain: [...o],
723
- range: [G, Math.max(G, ne - K)]
1450
+ range: [yt, Math.max(yt, w - bt)]
724
1451
  }), E = j({
725
1452
  domain: [...l],
726
- range: [216, q]
1453
+ range: [216, xt]
727
1454
  });
728
- return /* @__PURE__ */ O(p, {
1455
+ return /* @__PURE__ */ k(p, {
729
1456
  title: n,
730
1457
  report: r,
731
1458
  description: i,
732
- footer: /* @__PURE__ */ D(f, {
733
- id: S.id,
734
- children: S.label ?? "\xA0"
1459
+ footer: /* @__PURE__ */ O(f, {
1460
+ id: x.id,
1461
+ children: x.label ?? "\xA0"
735
1462
  }),
736
1463
  children: [
737
- a.length === 0 ? /* @__PURE__ */ D("p", {
1464
+ a.length === 0 ? /* @__PURE__ */ O("p", {
738
1465
  className: "x1ghz6dp x153jb6y",
739
1466
  children: b
740
- }) : /* @__PURE__ */ O(c, {
741
- ref: C,
742
- ...S.props,
1467
+ }) : /* @__PURE__ */ k(c, {
1468
+ ref: te,
1469
+ ...x.props,
743
1470
  className: "x1n2onr6 xeuugli",
744
- children: [/* @__PURE__ */ D(X, {
745
- width: ne,
746
- scaleX: T,
1471
+ children: [/* @__PURE__ */ O(Et, {
1472
+ width: w,
1473
+ scaleX: ne,
747
1474
  scaleY: E,
748
1475
  ...t
749
- }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${ne}`), a.length > 0 && /* @__PURE__ */ D("div", {
1476
+ }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${w}`), a.length > 0 && /* @__PURE__ */ O("div", {
750
1477
  className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
751
1478
  children: a.map((t) => {
752
- let n = S.label !== void 0 && S.activeId === t.id;
753
- return /* @__PURE__ */ D(te, {
1479
+ let n = x.label !== void 0 && x.activeId === t.id;
1480
+ return /* @__PURE__ */ O(C, {
754
1481
  type: "button",
755
1482
  tabIndex: -1,
756
- onPointerEnter: () => S.inspect(t.id),
1483
+ onPointerEnter: () => x.inspect(t.id),
757
1484
  title: t.label,
758
1485
  "aria-label": `${t.label}, ${d}: ${h(t.x)}, ${m}: ${_(t.y)}`,
759
1486
  "aria-pressed": v === void 0 ? void 0 : v.selectedId === t.id,
760
1487
  onClick: () => {
761
- S.inspect(t.id), v?.onSelect(t.id);
1488
+ x.inspect(t.id), v?.onSelect(t.id);
762
1489
  },
763
- ...x.props(J.target, J.location(T(t.x), E(t.y))),
764
- children: /* @__PURE__ */ D("span", {
1490
+ ...S.props(wt.target, wt.location(ne(t.x), E(t.y))),
1491
+ children: /* @__PURE__ */ O("span", {
765
1492
  "aria-hidden": !0,
766
- ...x.props(J.dot(e[t.tone]), (v?.selectedId === t.id || n) && J.selected)
1493
+ ...S.props(wt.dot(e[t.tone]), (v?.selectedId === t.id || n) && wt.selected)
767
1494
  })
768
1495
  }, t.id);
769
1496
  })
770
1497
  })]
771
1498
  }),
772
- y !== void 0 && /* @__PURE__ */ D(Z, {
1499
+ y !== void 0 && /* @__PURE__ */ O(Dt, {
773
1500
  ...t,
774
1501
  rangeSelection: y
775
1502
  }),
776
- /* @__PURE__ */ D(s, {
1503
+ /* @__PURE__ */ O(s, {
777
1504
  label: `${n} points`,
778
1505
  columns: [
779
1506
  {
@@ -801,9 +1528,9 @@ function Y(t) {
801
1528
  ]
802
1529
  });
803
1530
  }
804
- function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
805
- let c = C(), [l, u] = T(null), d = w(null);
806
- S(() => () => d.current?.(), []);
1531
+ function Et({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
1532
+ let c = w(), [l, u] = E(null), d = ne(null);
1533
+ te(() => () => d.current?.(), []);
807
1534
  let f = l === null ? s?.value : {
808
1535
  x: [Math.min(l.start.x, l.end.x), Math.max(l.start.x, l.end.x)],
809
1536
  y: [Math.min(l.start.y, l.end.y), Math.max(l.start.y, l.end.y)]
@@ -811,21 +1538,21 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
811
1538
  function p(r, i, a) {
812
1539
  return {
813
1540
  x: t.copy().clamp(!0).invert((i - r.left) / r.width * e),
814
- y: n.copy().clamp(!0).invert((a - r.top) / r.height * W)
1541
+ y: n.copy().clamp(!0).invert((a - r.top) / r.height * vt)
815
1542
  };
816
1543
  }
817
1544
  function m(t) {
818
1545
  let n = t.button === 0 && t.pointerType !== "touch";
819
1546
  if (s === void 0 || d.current !== null || !n) return;
820
- let r = t.currentTarget.getBoundingClientRect(), i = (t.clientX - r.left) / r.width * e, a = (t.clientY - r.top) / r.height * W;
821
- if (i < G || i > e - K || a < q || a > 216) return;
1547
+ let r = t.currentTarget.getBoundingClientRect(), i = (t.clientX - r.left) / r.width * e, a = (t.clientY - r.top) / r.height * vt;
1548
+ if (i < yt || i > e - bt || a < xt || a > 216) return;
822
1549
  let o = t.currentTarget, c = o.parentElement;
823
1550
  if (c === null) return;
824
1551
  let l = p(r, t.clientX, t.clientY);
825
1552
  u({
826
1553
  start: l,
827
1554
  end: l
828
- }), d.current = k(c, t.nativeEvent, {
1555
+ }), d.current = A(c, t.nativeEvent, {
829
1556
  cancelOnEscape: !0,
830
1557
  onMove: ({ x: e, y: t }) => u({
831
1558
  start: l,
@@ -841,67 +1568,67 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
841
1568
  }
842
1569
  });
843
1570
  }
844
- return /* @__PURE__ */ O("svg", {
1571
+ return /* @__PURE__ */ k("svg", {
845
1572
  width: e,
846
- height: W,
847
- viewBox: `0 0 ${e} ${W}`,
1573
+ height: vt,
1574
+ viewBox: `0 0 ${e} ${vt}`,
848
1575
  "aria-hidden": !0,
849
1576
  onPointerDown: m,
850
- ...x.props(v.svg, s !== void 0 && J.brush),
1577
+ ...S.props(v.svg, s !== void 0 && wt.brush),
851
1578
  children: [
852
- /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", {
1579
+ /* @__PURE__ */ O("defs", { children: /* @__PURE__ */ O("clipPath", {
853
1580
  id: c,
854
- children: /* @__PURE__ */ D("rect", {
855
- x: G,
856
- y: q,
857
- width: Math.max(0, e - G - K),
1581
+ children: /* @__PURE__ */ O("rect", {
1582
+ x: yt,
1583
+ y: xt,
1584
+ width: Math.max(0, e - yt - bt),
858
1585
  height: 204
859
1586
  })
860
1587
  }) }),
861
- t.ticks(5).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
1588
+ t.ticks(5).map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
862
1589
  x1: t(e),
863
1590
  x2: t(e),
864
- y1: q,
1591
+ y1: xt,
865
1592
  y2: 216,
866
- ...x.props(v.grid)
867
- }), /* @__PURE__ */ D("text", {
1593
+ ...S.props(v.grid)
1594
+ }), /* @__PURE__ */ O("text", {
868
1595
  x: t(e),
869
1596
  y: 234,
870
1597
  textAnchor: "middle",
871
- ...x.props(v.label),
1598
+ ...S.props(v.label),
872
1599
  children: a(e)
873
1600
  })] }, e)),
874
- n.ticks(4).map((t) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
875
- x1: G,
876
- x2: e - K,
1601
+ n.ticks(4).map((t) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
1602
+ x1: yt,
1603
+ x2: e - bt,
877
1604
  y1: n(t),
878
1605
  y2: n(t),
879
- ...x.props(v.grid)
880
- }), /* @__PURE__ */ D("text", {
1606
+ ...S.props(v.grid)
1607
+ }), /* @__PURE__ */ O("text", {
881
1608
  x: 48,
882
1609
  y: n(t) + 4,
883
1610
  textAnchor: "end",
884
- ...x.props(v.label),
1611
+ ...S.props(v.label),
885
1612
  children: o(t)
886
1613
  })] }, t)),
887
- /* @__PURE__ */ D("text", {
888
- x: (G + e - K) / 2,
1614
+ /* @__PURE__ */ O("text", {
1615
+ x: (yt + e - bt) / 2,
889
1616
  y: 256,
890
1617
  textAnchor: "middle",
891
- ...x.props(v.label),
1618
+ ...S.props(v.label),
892
1619
  children: r
893
1620
  }),
894
- /* @__PURE__ */ D("text", {
1621
+ /* @__PURE__ */ O("text", {
895
1622
  x: 12,
896
1623
  y: 108,
897
1624
  textAnchor: "middle",
898
1625
  transform: "rotate(-90 12 108)",
899
- ...x.props(v.label),
1626
+ ...S.props(v.label),
900
1627
  children: i
901
1628
  }),
902
- /* @__PURE__ */ D("g", {
1629
+ /* @__PURE__ */ O("g", {
903
1630
  clipPath: `url(#${c})`,
904
- children: f != null && /* @__PURE__ */ D("rect", {
1631
+ children: f != null && /* @__PURE__ */ O("rect", {
905
1632
  x: t(f.x[0]),
906
1633
  y: n(f.y[1]),
907
1634
  width: t(f.x[1]) - t(f.x[0]),
@@ -912,19 +1639,19 @@ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, f
912
1639
  ]
913
1640
  });
914
1641
  }
915
- function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
1642
+ function Dt({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
916
1643
  let s = e.value ?? {
917
1644
  x: t,
918
1645
  y: n
919
1646
  };
920
- return /* @__PURE__ */ O("fieldset", {
1647
+ return /* @__PURE__ */ k("fieldset", {
921
1648
  className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
922
1649
  children: [
923
- /* @__PURE__ */ D("legend", {
1650
+ /* @__PURE__ */ O("legend", {
924
1651
  className: "x153jb6y xy8obcc x1jfksii",
925
1652
  children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
926
1653
  }),
927
- /* @__PURE__ */ O(b.Root, {
1654
+ /* @__PURE__ */ k(x.Root, {
928
1655
  value: [...s.x],
929
1656
  format: a,
930
1657
  min: t[0],
@@ -935,26 +1662,26 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
935
1662
  x: t,
936
1663
  y: s.y
937
1664
  }),
938
- children: [/* @__PURE__ */ O("div", {
1665
+ children: [/* @__PURE__ */ k("div", {
939
1666
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
940
- children: [/* @__PURE__ */ D(b.Label, { children: r }), /* @__PURE__ */ O("span", { children: [
1667
+ children: [/* @__PURE__ */ O(x.Label, { children: r }), /* @__PURE__ */ k("span", { children: [
941
1668
  a(s.x[0]),
942
1669
  " – ",
943
1670
  a(s.x[1])
944
1671
  ] })]
945
- }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
946
- /* @__PURE__ */ D(b.Indicator, {}),
947
- /* @__PURE__ */ D(b.Thumb, {
1672
+ }), /* @__PURE__ */ O(x.Control, { children: /* @__PURE__ */ k(x.Track, { children: [
1673
+ /* @__PURE__ */ O(x.Indicator, {}),
1674
+ /* @__PURE__ */ O(x.Thumb, {
948
1675
  index: 0,
949
1676
  "aria-label": `${r} minimum`
950
1677
  }),
951
- /* @__PURE__ */ D(b.Thumb, {
1678
+ /* @__PURE__ */ O(x.Thumb, {
952
1679
  index: 1,
953
1680
  "aria-label": `${r} maximum`
954
1681
  })
955
1682
  ] }) })]
956
1683
  }),
957
- /* @__PURE__ */ O(b.Root, {
1684
+ /* @__PURE__ */ k(x.Root, {
958
1685
  value: [...s.y],
959
1686
  format: o,
960
1687
  min: n[0],
@@ -965,26 +1692,26 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
965
1692
  x: s.x,
966
1693
  y: t
967
1694
  }),
968
- children: [/* @__PURE__ */ O("div", {
1695
+ children: [/* @__PURE__ */ k("div", {
969
1696
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
970
- children: [/* @__PURE__ */ D(b.Label, { children: i }), /* @__PURE__ */ O("span", { children: [
1697
+ children: [/* @__PURE__ */ O(x.Label, { children: i }), /* @__PURE__ */ k("span", { children: [
971
1698
  o(s.y[0]),
972
1699
  " – ",
973
1700
  o(s.y[1])
974
1701
  ] })]
975
- }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
976
- /* @__PURE__ */ D(b.Indicator, {}),
977
- /* @__PURE__ */ D(b.Thumb, {
1702
+ }), /* @__PURE__ */ O(x.Control, { children: /* @__PURE__ */ k(x.Track, { children: [
1703
+ /* @__PURE__ */ O(x.Indicator, {}),
1704
+ /* @__PURE__ */ O(x.Thumb, {
978
1705
  index: 0,
979
1706
  "aria-label": `${i} minimum`
980
1707
  }),
981
- /* @__PURE__ */ D(b.Thumb, {
1708
+ /* @__PURE__ */ O(x.Thumb, {
982
1709
  index: 1,
983
1710
  "aria-label": `${i} maximum`
984
1711
  })
985
1712
  ] }) })]
986
1713
  }),
987
- /* @__PURE__ */ D(y, {
1714
+ /* @__PURE__ */ O(b, {
988
1715
  type: "button",
989
1716
  disabled: e.value === null,
990
1717
  onClick: () => e.onChange(null),
@@ -993,9 +1720,9 @@ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
993
1720
  ]
994
1721
  });
995
1722
  }
996
- function Q({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
1723
+ function Ot({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
997
1724
  if (!h(t) || !h(n)) return "Scatter domains must contain finite, increasing endpoints.";
998
- if (e.length > 1e3) return `This plot exceeds the ${_e}-point render limit. Supply a smaller, labelled sample.`;
1725
+ if (e.length > 1e3) return `This plot exceeds the ${St}-point render limit. Supply a smaller, labelled sample.`;
999
1726
  if (!m(e)) return "Scatter points must have unique identifiers.";
1000
1727
  if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
1001
1728
  if (e.some((e) => {
@@ -1006,9 +1733,9 @@ function Q({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
1006
1733
  let i = Number.isFinite(r.xStep) && r.xStep > 0 && r.xStep <= t[1] - t[0], a = Number.isFinite(r.yStep) && r.yStep > 0 && r.yStep <= n[1] - n[0];
1007
1734
  if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
1008
1735
  let o = r.value;
1009
- return o === null ? null : !ye(o.x, t) || !ye(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
1736
+ return o === null ? null : !kt(o.x, t) || !kt(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
1010
1737
  }
1011
- function ye(e, t) {
1738
+ function kt(e, t) {
1012
1739
  return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
1013
1740
  }
1014
1741
  // packages/charts/src/cartesian/time-series-data.ts
@@ -1017,7 +1744,7 @@ var $ = {
1017
1744
  pointsPerSeries: 2e3,
1018
1745
  markers: 200,
1019
1746
  panels: 12
1020
- }, be = .01, xe = [
1747
+ }, At = .01, jt = [
1021
1748
  "series1",
1022
1749
  "series2",
1023
1750
  "series3",
@@ -1025,31 +1752,40 @@ var $ = {
1025
1752
  "series5",
1026
1753
  "series6"
1027
1754
  ];
1028
- function Se({ series: e, isStacked: t, markers: n }) {
1029
- let r = e[0]?.points.map((e) => e.timestamp) ?? [];
1030
- if (e.length > $.series || r.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
1755
+ function Mt({ series: e, isStacked: t, markers: n, timeline: r = [] }) {
1756
+ let i = e[0]?.points.map((e) => e.timestamp) ?? r;
1757
+ if (e.length > $.series || i.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
1031
1758
  if (!m(e) || !m(n)) return "Series and markers require unique identifiers.";
1032
1759
  for (let n of e) {
1033
- if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
1034
- let e = Ee({
1760
+ if (n.points.length !== i.length) return "Every series must supply the same observation timestamps.";
1761
+ let e = Lt({
1035
1762
  points: n.points,
1036
- timestamps: r,
1763
+ timestamps: i,
1037
1764
  isStacked: t
1038
1765
  });
1039
1766
  if (e !== void 0) return e;
1040
1767
  }
1041
1768
  for (let t of n) {
1042
- if (!r.includes(t.timestamp)) return "Every marker must align with an observation timestamp.";
1043
- if (t.kind === "point") {
1044
- let n = e.find((e) => e.id === t.seriesId)?.points.find((e) => e.timestamp === t.timestamp);
1045
- if (n === void 0 || n.value !== t.value) return "Point markers must reference the recorded series value.";
1046
- }
1769
+ let n = Nt({
1770
+ marker: t,
1771
+ series: e,
1772
+ timestamps: i
1773
+ });
1774
+ if (n !== void 0) return n;
1775
+ }
1776
+ let a = e.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value])), o = Math.max(0, ...a) - Math.min(0, ...a), s = (i.at(-1) ?? 0) - (i[0] ?? 0);
1777
+ if (!Number.isFinite(o) || !Number.isFinite(s)) return "The elapsed-time and value ranges must be finite.";
1778
+ if (t && i.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
1779
+ }
1780
+ function Nt({ marker: e, series: t, timestamps: n }) {
1781
+ if (e.kind === "event") {
1782
+ let t = n[0] ?? 0, r = n.at(-1) ?? t, i = e.timestamp >= t && e.timestamp <= r;
1783
+ return Number.isFinite(e.timestamp) && i ? void 0 : "Every event marker must fall inside the observed time range.";
1047
1784
  }
1048
- let i = e.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value])), a = Math.max(0, ...i) - Math.min(0, ...i), o = (r.at(-1) ?? 0) - (r[0] ?? 0);
1049
- if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
1050
- if (t && r.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
1785
+ if (!n.includes(e.timestamp)) return "Every time and point marker must align with an observation timestamp.";
1786
+ if (e.kind !== "time") return t.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.value === e.value ? void 0 : "Point markers must reference the recorded series value.";
1051
1787
  }
1052
- function Ce({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1788
+ function Pt({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1053
1789
  return JSON.stringify([
1054
1790
  n,
1055
1791
  r,
@@ -1069,15 +1805,15 @@ function Ce({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1069
1805
  ])
1070
1806
  ]);
1071
1807
  }
1072
- function we(e, t, n = !1) {
1808
+ function Ft(e, t, n = !1) {
1073
1809
  if (e !== t) return [e, t];
1074
- let r = Math.max(1, Math.abs(e) * be), i = n ? 0 : e - r, a = t + r;
1810
+ let r = Math.max(1, Math.abs(e) * At), i = n ? 0 : e - r, a = t + r;
1075
1811
  return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
1076
1812
  }
1077
- function Te(e, t) {
1813
+ function It(e, t) {
1078
1814
  let n = e.filter((e) => e.tone === void 0);
1079
1815
  return e.map((r, i) => {
1080
- let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? xe[a % xe.length] ?? "series1", s = r.points.map((n, r) => {
1816
+ let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? jt[a % jt.length] ?? "series1", s = r.points.map((n, r) => {
1081
1817
  let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
1082
1818
  return {
1083
1819
  ...n,
@@ -1092,7 +1828,7 @@ function Te(e, t) {
1092
1828
  };
1093
1829
  });
1094
1830
  }
1095
- function Ee({ points: e, timestamps: t, isStacked: n }) {
1831
+ function Lt({ points: e, timestamps: t, isStacked: n }) {
1096
1832
  for (let [r, i] of e.entries()) {
1097
1833
  let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
1098
1834
  if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
@@ -1101,19 +1837,20 @@ function Ee({ points: e, timestamps: t, isStacked: n }) {
1101
1837
  }
1102
1838
  }
1103
1839
  // packages/charts/src/cartesian/time-series-line.tsx
1104
- function De({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1105
- return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(ie, {
1840
+ function Rt({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1841
+ let o = t.points.findLastIndex((e) => e.value !== null);
1842
+ return /* @__PURE__ */ k(D, { children: [/* @__PURE__ */ O(P, {
1106
1843
  data: [...t.points],
1107
1844
  defined: (e) => e.value !== null,
1108
1845
  x: (e) => n(e.timestamp),
1109
1846
  y: (e) => r((e.value ?? 0) + e.base),
1110
1847
  stroke: e[t.tone],
1111
- ...x.props(v.mark)
1848
+ ...S.props(v.mark)
1112
1849
  }), t.points.filter((e, n) => {
1113
1850
  if (e.value === null) return !1;
1114
- let r = t.points[n - 1]?.value === null || t.points[n + 1]?.value === null;
1115
- return t.points.length === 1 || r || e.timestamp === i;
1116
- }).map((i) => /* @__PURE__ */ D("circle", {
1851
+ let r = t.points[n - 1]?.value === null || t.points[n + 1]?.value === null, a = t.points.length === 1, s = n === o, c = e.timestamp === i;
1852
+ return a || s ? !0 : r || c;
1853
+ }).map((i) => /* @__PURE__ */ O("circle", {
1117
1854
  cx: n(i.timestamp),
1118
1855
  cy: r((i.value ?? 0) + i.base),
1119
1856
  r: a,
@@ -1121,82 +1858,370 @@ function De({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }
1121
1858
  }, i.timestamp))] });
1122
1859
  }
1123
1860
  // packages/charts/src/cartesian/sparkline.tsx
1124
- function Oe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
1125
- let o = C(), s = C(), c = ke({
1126
- title: e,
1127
- summary: t,
1128
- unit: n,
1129
- series: i,
1130
- valueDomain: a
1131
- }), l = i.points.some((e) => e.value !== null);
1132
- if (c !== void 0 || !l) return /* @__PURE__ */ D("span", {
1861
+ var zt = {
1862
+ minimum: "Lowest",
1863
+ maximum: "Highest",
1864
+ last: "Latest"
1865
+ }, Bt = 2.5;
1866
+ function Vt({ points: e, marked: t }) {
1867
+ let n = e.flatMap((e) => e.value === null ? [] : [{
1868
+ ...e,
1869
+ value: e.value
1870
+ }]), r = n.map((e) => e.value), i = {
1871
+ minimum: n.find((e) => e.value === Math.min(...r)),
1872
+ maximum: n.find((e) => e.value === Math.max(...r)),
1873
+ last: n.at(-1)
1874
+ };
1875
+ return t.flatMap((e) => {
1876
+ let t = i[e];
1877
+ return t === void 0 ? [] : [{
1878
+ kind: e,
1879
+ point: t
1880
+ }];
1881
+ });
1882
+ }
1883
+ function Ht({ title: t, summary: n, unit: r, timestampUnit: i, series: a, valueDomain: o, markedPoints: s = [], baseline: c }) {
1884
+ let l = w(), u = w(), d = Ut({
1885
+ title: t,
1886
+ summary: n,
1887
+ unit: r,
1888
+ series: a,
1889
+ valueDomain: o,
1890
+ markedPoints: s,
1891
+ baseline: c
1892
+ }), f = a.points.some((e) => e.value !== null);
1893
+ if (d !== void 0 || !f) return /* @__PURE__ */ O("span", {
1133
1894
  role: "img",
1134
- "aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
1135
- title: c ?? "No recorded values",
1895
+ "aria-label": `${t}. ${n} Values in ${r}; timestamps in ${i}. ${d ?? "No recorded values. Missing observations remain unavailable."}`,
1896
+ title: d ?? "No recorded values",
1136
1897
  className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
1137
- children: c === void 0 ? "No data" : "Invalid trend"
1898
+ children: d === void 0 ? "No data" : "Invalid trend"
1138
1899
  });
1139
- let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = j({
1140
- domain: [...we(u, d)],
1900
+ let p = a.points[0]?.timestamp ?? 0, m = a.points.at(-1)?.timestamp ?? p, h = j({
1901
+ domain: [...Ft(p, m)],
1141
1902
  range: [3, 125]
1142
- }), p = j({
1143
- domain: [...a],
1903
+ }), g = j({
1904
+ domain: [...o],
1144
1905
  range: [29, 3]
1145
- }), m = Te([i], !1)[0];
1146
- return /* @__PURE__ */ O("svg", {
1906
+ }), _ = It([a], !1)[0], v = e[_?.tone ?? "series1"], ee = Vt({
1907
+ points: a.points,
1908
+ marked: s
1909
+ }), y = ee.map(({ kind: e, point: t }) => `${zt[e]}: ${t.value} ${r}.`).join(" "), b = c === void 0 ? "" : `Reference: ${c} ${r}.`;
1910
+ return /* @__PURE__ */ k("svg", {
1147
1911
  role: "img",
1148
- "aria-labelledby": o,
1149
- "aria-describedby": s,
1912
+ "aria-labelledby": l,
1913
+ "aria-describedby": u,
1150
1914
  focusable: "false",
1151
1915
  viewBox: "0 0 128 32",
1152
1916
  width: 128,
1153
1917
  height: 32,
1154
1918
  className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz",
1155
1919
  children: [
1156
- /* @__PURE__ */ D("title", {
1157
- id: o,
1158
- children: e
1920
+ /* @__PURE__ */ O("title", {
1921
+ id: l,
1922
+ children: t
1159
1923
  }),
1160
- /* @__PURE__ */ O("desc", {
1161
- id: s,
1924
+ /* @__PURE__ */ k("desc", {
1925
+ id: u,
1162
1926
  children: [
1163
- t,
1164
- " Values in ",
1165
1927
  n,
1166
- "; timestamps in ",
1928
+ " Values in ",
1167
1929
  r,
1930
+ "; timestamps in ",
1931
+ i,
1168
1932
  ". Displayed value domain: ",
1169
- a[0],
1933
+ o[0],
1170
1934
  " to",
1171
1935
  " ",
1172
- a[1],
1936
+ o[1],
1173
1937
  " ",
1174
- n,
1175
- "."
1938
+ r,
1939
+ ". ",
1940
+ y,
1941
+ " ",
1942
+ b
1176
1943
  ]
1177
1944
  }),
1178
- m !== void 0 && /* @__PURE__ */ D(De, {
1179
- series: m,
1180
- x: f,
1181
- y: p,
1945
+ c !== void 0 && /* @__PURE__ */ O("line", {
1946
+ x1: 3,
1947
+ x2: 125,
1948
+ y1: g(c),
1949
+ y2: g(c),
1950
+ className: "x1crw9hw xnpr05h xbw2l0c x13efnbd"
1951
+ }),
1952
+ _ !== void 0 && /* @__PURE__ */ O(Rt, {
1953
+ series: _,
1954
+ x: h,
1955
+ y: g,
1182
1956
  pointRadius: 2
1183
- })
1957
+ }),
1958
+ ee.map(({ kind: e, point: t }) => e === "last" ? /* @__PURE__ */ O("circle", {
1959
+ cx: h(t.timestamp),
1960
+ cy: g(t.value),
1961
+ r: Bt,
1962
+ fill: v
1963
+ }, e) : /* @__PURE__ */ O("circle", {
1964
+ cx: h(t.timestamp),
1965
+ cy: g(t.value),
1966
+ r: Bt,
1967
+ stroke: v,
1968
+ className: "x1fytgo2 x1r6sdyr x13efnbd"
1969
+ }, e))
1184
1970
  ]
1185
1971
  });
1186
1972
  }
1187
- function ke({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
1973
+ function Ut({ title: e, summary: t, unit: n, series: r, valueDomain: i, markedPoints: a, baseline: o }) {
1188
1974
  if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
1189
1975
  if (!h(i)) return "The displayed value domain must have finite, increasing bounds.";
1190
- let a = Se({
1976
+ let s = Mt({
1191
1977
  series: [r],
1192
1978
  isStacked: !1,
1193
1979
  markers: []
1194
1980
  });
1195
- if (a !== void 0) return a;
1981
+ if (s !== void 0) return s;
1196
1982
  if (r.points.some((e) => e.value !== null && (e.value < i[0] || e.value > i[1]))) return "Every recorded value must be inside the declared value domain.";
1983
+ if (new Set(a).size !== a.length) return "Mark each recorded point at most once.";
1984
+ if (!(o === void 0 || o >= i[0] && o <= i[1])) return "The reference value must be inside the declared value domain.";
1985
+ }
1986
+ // packages/charts/src/cartesian/time-series-bands.ts
1987
+ var Wt = {
1988
+ bands: 4,
1989
+ crossings: 4
1990
+ }, Gt = [
1991
+ "series1",
1992
+ "series2",
1993
+ "series3",
1994
+ "series4",
1995
+ "series5",
1996
+ "series6"
1997
+ ];
1998
+ function Kt(e) {
1999
+ let t = [
2000
+ e.lower,
2001
+ e.center,
2002
+ e.upper
2003
+ ].filter((e) => e !== null);
2004
+ return t.some((e) => !Number.isFinite(e)) ? "Band values must be finite numbers or explicit missing values." : e.lower === null == (e.upper === null) ? t.every((e, n) => n === 0 || (t[n - 1] ?? e) <= e) ? void 0 : "Band values must satisfy lower ≤ center ≤ upper." : "A band observation needs both bounds or neither.";
2005
+ }
2006
+ function qt({ bands: e, crossings: t, series: n, timestamps: r }) {
2007
+ if (e.length > Wt.bands || t.length > Wt.crossings) return `Supply at most ${Wt.bands} bands and ${Wt.crossings} crossings.`;
2008
+ if (!m([...n, ...e]) || !m(t)) return "Series, bands, and crossings require unique identifiers.";
2009
+ for (let t of e) {
2010
+ if (t.points.length !== r.length || t.points.some((e, t) => e.timestamp !== r[t])) return "Every band must supply the same observation timestamps as the series.";
2011
+ let e = t.points.map(Kt).find((e) => e !== void 0);
2012
+ if (e !== void 0) return e;
2013
+ }
2014
+ let i = new Set([...n, ...e].map((e) => e.id));
2015
+ for (let e of t) if (!(i.has(e.seriesId) && e.label.trim() !== "") || !Number.isFinite(e.value)) return "Each crossing needs a label, a finite value, and a supplied series or band.";
2016
+ }
2017
+ function Jt({ series: e, bands: t }) {
2018
+ let n = e.filter((e) => e.tone === void 0).length, r = t.filter((e) => e.tone === void 0);
2019
+ return t.map((e) => {
2020
+ let t = n + r.findIndex((t) => t.id === e.id);
2021
+ return {
2022
+ ...e,
2023
+ tone: e.tone ?? Gt[t % Gt.length] ?? "series1"
2024
+ };
2025
+ });
2026
+ }
2027
+ function Yt({ start: e, end: t, value: n, direction: r }) {
2028
+ let i = e > n && t <= n, a = e < n && t >= n;
2029
+ switch (r) {
2030
+ case "falling": return i;
2031
+ case "rising": return a;
2032
+ case void 0: return i || a;
2033
+ }
2034
+ }
2035
+ function Xt({ points: e, crossing: t }) {
2036
+ let n = e.flatMap((t, n) => {
2037
+ let r = e[n + 1];
2038
+ return t.value === null || r === void 0 || r.value === null ? [] : [{
2039
+ start: t.timestamp,
2040
+ end: r.timestamp,
2041
+ from: t.value,
2042
+ to: r.value
2043
+ }];
2044
+ }).find(({ from: e, to: n }) => Yt({
2045
+ start: e,
2046
+ end: n,
2047
+ value: t.value,
2048
+ direction: t.direction
2049
+ }));
2050
+ if (n === void 0) return;
2051
+ let r = (t.value - n.from) / (n.to - n.from);
2052
+ return n.start + r * (n.end - n.start);
2053
+ }
2054
+ function Zt({ crossings: e, series: t, bands: n }) {
2055
+ return e.map((e) => ({
2056
+ crossing: e,
2057
+ timestamp: Xt({
2058
+ points: t.find((t) => t.id === e.seriesId)?.points ?? n.find((t) => t.id === e.seriesId)?.points.map((e) => ({
2059
+ timestamp: e.timestamp,
2060
+ value: e.center
2061
+ })) ?? [],
2062
+ crossing: e
2063
+ })
2064
+ }));
2065
+ }
2066
+ function Qt(e, t) {
2067
+ let n = Math.min(...e.map((e) => Math.abs(e - t)));
2068
+ return e.find((e) => Math.abs(e - t) === n);
2069
+ }
2070
+ function $t(e) {
2071
+ return e.flatMap((e) => e.points.flatMap((e) => [
2072
+ e.lower,
2073
+ e.center,
2074
+ e.upper
2075
+ ].filter((e) => e !== null)));
2076
+ }
2077
+ // packages/charts/src/cartesian/time-series-overlays.tsx
2078
+ var en = {
2079
+ kDd8S0: "x1bsw5e1",
2080
+ kfJifR: "xnpr05h",
2081
+ kDwRjp: "xbh8q5q",
2082
+ $$css: !0
2083
+ }, tn = {
2084
+ kVYP8I: "xd6etog",
2085
+ $$css: !0
2086
+ }, nn = {
2087
+ kfJifR: "xvlca1e",
2088
+ kDwRjp: "xbh8q5q",
2089
+ kREpy8: "x13efnbd",
2090
+ $$css: !0
2091
+ }, rn = {
2092
+ bandEdge: (e) => [
2093
+ en,
2094
+ {
2095
+ kjVXCG: e == null ? e : "x6mkzkt",
2096
+ $$css: !0
2097
+ },
2098
+ { "--x-stroke": e ?? void 0 }
2099
+ ],
2100
+ bandFill: (e) => [
2101
+ tn,
2102
+ {
2103
+ kDwRjp: e == null ? e : "x19zyb68",
2104
+ $$css: !0
2105
+ },
2106
+ { "--x-fill": e ?? void 0 }
2107
+ ],
2108
+ center: (e) => [
2109
+ nn,
2110
+ {
2111
+ kjVXCG: e == null ? e : "x6mkzkt",
2112
+ $$css: !0
2113
+ },
2114
+ { "--x-stroke": e ?? void 0 }
2115
+ ]
2116
+ }, an = 16, on = 6, sn = 6.5, cn = 2.5, ln = 4, un = 12;
2117
+ function dn({ instants: e, x: t, right: n, ends: r }) {
2118
+ let [i, ...a] = e;
2119
+ if (i === void 0) return [];
2120
+ let o = t(i.timestamp), s = i.label.length * sn + on, c = o + s > n ? "end" : "start", l = c === "start" ? o : o - s, u = c === "start" ? o + s : o, d = r.findIndex((e) => l > e), f = d === -1 ? Math.min(r.length, 1) : d, p = [
2121
+ ...r.slice(0, f),
2122
+ Math.max(u, r[f] ?? u),
2123
+ ...r.slice(f + 1)
2124
+ ];
2125
+ return [{
2126
+ ...i,
2127
+ lane: f,
2128
+ anchor: c
2129
+ }, ...dn({
2130
+ instants: a,
2131
+ x: t,
2132
+ right: n,
2133
+ ends: p
2134
+ })];
2135
+ }
2136
+ function fn({ instants: e, x: t, right: n }) {
2137
+ return dn({
2138
+ instants: e.toSorted((e, t) => e.timestamp - t.timestamp),
2139
+ x: t,
2140
+ right: n,
2141
+ ends: []
2142
+ });
2143
+ }
2144
+ function pn(e) {
2145
+ return un + Math.max(0, ...e.map((e) => e.lane + 1)) * an;
2146
+ }
2147
+ function mn(e) {
2148
+ return e.lower !== null && e.upper !== null;
2149
+ }
2150
+ function hn({ bands: t, x: n, y: r }) {
2151
+ return /* @__PURE__ */ O("g", { children: t.map((t) => {
2152
+ let i = e[t.tone], a = [...t.points];
2153
+ return /* @__PURE__ */ k("g", { children: [
2154
+ /* @__PURE__ */ O(ie, {
2155
+ data: a,
2156
+ defined: mn,
2157
+ x: (e) => n(e.timestamp),
2158
+ y0: (e) => r(e.lower ?? 0),
2159
+ y1: (e) => r(e.upper ?? 0),
2160
+ ...S.props(rn.bandFill(i))
2161
+ }),
2162
+ /* @__PURE__ */ O(P, {
2163
+ data: a,
2164
+ defined: mn,
2165
+ x: (e) => n(e.timestamp),
2166
+ y: (e) => r(e.upper ?? 0),
2167
+ ...S.props(rn.bandEdge(i))
2168
+ }),
2169
+ /* @__PURE__ */ O(P, {
2170
+ data: a,
2171
+ defined: mn,
2172
+ x: (e) => n(e.timestamp),
2173
+ y: (e) => r(e.lower ?? 0),
2174
+ ...S.props(rn.bandEdge(i))
2175
+ }),
2176
+ /* @__PURE__ */ O(P, {
2177
+ data: a,
2178
+ defined: (e) => e.center !== null,
2179
+ x: (e) => n(e.timestamp),
2180
+ y: (e) => r(e.center ?? 0),
2181
+ ...S.props(rn.center(i))
2182
+ })
2183
+ ] }, t.id);
2184
+ }) });
2185
+ }
2186
+ function gn({ placed: e, x: t, y: n, bottom: r }) {
2187
+ return /* @__PURE__ */ O("g", {
2188
+ "aria-hidden": !0,
2189
+ children: e.map((e) => {
2190
+ let i = t(e.timestamp), a = un + e.lane * an, o = e.anchor === "start" ? i + on : i - on;
2191
+ return /* @__PURE__ */ k("g", { children: [
2192
+ /* @__PURE__ */ O("line", {
2193
+ x1: i,
2194
+ x2: i,
2195
+ y1: a,
2196
+ y2: r,
2197
+ className: "xhq4mlf xnpr05h x1bpwu3k x13efnbd"
2198
+ }),
2199
+ /* @__PURE__ */ O("circle", {
2200
+ cx: i,
2201
+ cy: a,
2202
+ r: cn,
2203
+ className: "xlrhuyr"
2204
+ }),
2205
+ /* @__PURE__ */ O("text", {
2206
+ x: o,
2207
+ y: a,
2208
+ textAnchor: e.anchor,
2209
+ dominantBaseline: "middle",
2210
+ ...S.props(v.label, v.strongLabel, v.haloLabel),
2211
+ children: e.label
2212
+ }),
2213
+ e.value !== void 0 && /* @__PURE__ */ O("circle", {
2214
+ cx: i,
2215
+ cy: n(e.value),
2216
+ r: ln,
2217
+ className: "x1fytgo2 x17y187c xvlca1e x13efnbd"
2218
+ })
2219
+ ] }, e.id);
2220
+ })
2221
+ });
1197
2222
  }
1198
2223
  // packages/charts/src/cartesian/time-series.tsx
1199
- var Ae = {
2224
+ var _n = {
1200
2225
  timeAxis: {
1201
2226
  k1xSpc: "x78zum5",
1202
2227
  kjj79g: "x1qughib",
@@ -1217,46 +2242,87 @@ var Ae = {
1217
2242
  "--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
1218
2243
  }]
1219
2244
  };
1220
- function je(e) {
1221
- return /* @__PURE__ */ D(Re, {
2245
+ function vn({ bands: e, crossings: t }) {
2246
+ return JSON.stringify([e.map((e) => [
2247
+ e.id,
2248
+ e.label,
2249
+ e.rangeLabel,
2250
+ e.tone,
2251
+ e.points.map((e) => [
2252
+ e.timestamp,
2253
+ e.lower,
2254
+ e.center,
2255
+ e.upper
2256
+ ])
2257
+ ]), t.map((e) => [
2258
+ e.id,
2259
+ e.seriesId,
2260
+ e.value,
2261
+ e.label,
2262
+ e.direction
2263
+ ])]);
2264
+ }
2265
+ function yn({ bands: e, timestamp: t, formatValue: n }) {
2266
+ return e.flatMap((e) => {
2267
+ let r = e.points.find((e) => e.timestamp === t), i = r?.center ?? null, a = r?.lower !== null && r?.upper !== null && r !== void 0;
2268
+ return [{
2269
+ id: e.id,
2270
+ label: e.label,
2271
+ tone: e.tone,
2272
+ shape: "band",
2273
+ value: i === null ? "Unavailable" : n(i)
2274
+ }, {
2275
+ id: `${e.id}:range`,
2276
+ label: e.rangeLabel,
2277
+ tone: e.tone,
2278
+ shape: "band",
2279
+ value: a ? `${n(r.lower)} – ${n(r.upper)}` : "Unavailable"
2280
+ }];
2281
+ });
2282
+ }
2283
+ function bn({ found: e, formatTimestamp: t }) {
2284
+ return e.timestamp === void 0 ? `${e.crossing.label} · Not reached in this range` : `About ${t(e.timestamp)} · ${e.crossing.label}`;
2285
+ }
2286
+ function xn(e) {
2287
+ return /* @__PURE__ */ O(On, {
1222
2288
  ...e,
1223
2289
  kind: "line",
1224
2290
  isStacked: !1
1225
2291
  });
1226
2292
  }
1227
- function Me({ isStacked: e = !1, ...t }) {
1228
- return /* @__PURE__ */ D(Re, {
2293
+ function Sn({ isStacked: e = !1, ...t }) {
2294
+ return /* @__PURE__ */ O(On, {
1229
2295
  ...t,
1230
2296
  kind: "area",
1231
2297
  isStacked: e
1232
2298
  });
1233
2299
  }
1234
- function Ne(e) {
1235
- return /* @__PURE__ */ D(Pe, { ...e });
2300
+ function Cn(e) {
2301
+ return /* @__PURE__ */ O(wn, { ...e });
1236
2302
  }
1237
- function Pe({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
1238
- let l = C(), u = Te(i.map((e) => ({
2303
+ function wn({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
2304
+ let l = w(), u = It(i.map((e) => ({
1239
2305
  ...e,
1240
2306
  points: []
1241
2307
  })), !1);
1242
- return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ D(g, {
2308
+ return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ O(g, {
1243
2309
  title: e,
1244
2310
  description: r,
1245
2311
  report: o,
1246
2312
  message: "Chart height must be at least 48 pixels."
1247
- }) : /* @__PURE__ */ D("div", {
2313
+ }) : /* @__PURE__ */ O("div", {
1248
2314
  "aria-hidden": !0,
1249
2315
  inert: !0,
1250
2316
  className: "xeuugli",
1251
- children: /* @__PURE__ */ D(p, {
2317
+ children: /* @__PURE__ */ O(p, {
1252
2318
  title: e,
1253
2319
  description: r,
1254
2320
  report: o,
1255
2321
  series: u,
1256
2322
  actions: a,
1257
- children: /* @__PURE__ */ O("div", {
2323
+ children: /* @__PURE__ */ k("div", {
1258
2324
  className: "xrvj5dj x1n8ia3y",
1259
- children: [/* @__PURE__ */ D(le, {
2325
+ children: [/* @__PURE__ */ O(ue, {
1260
2326
  id: l,
1261
2327
  label: void 0,
1262
2328
  legend: u,
@@ -1265,61 +2331,61 @@ function Pe({ title: e, description: r, series: i, actions: a, report: o, height
1265
2331
  width: 0,
1266
2332
  source: void 0,
1267
2333
  hasSeriesSummary: o?.seriesValues !== void 0
1268
- }), /* @__PURE__ */ O("div", {
1269
- ...x.props(v.plot),
1270
- children: [/* @__PURE__ */ D(t, { height: s - 16 }), c && /* @__PURE__ */ O("div", {
2334
+ }), /* @__PURE__ */ k("div", {
2335
+ ...S.props(v.plot),
2336
+ children: [/* @__PURE__ */ O(t, { height: s - 16 }), c && /* @__PURE__ */ k("div", {
1271
2337
  className: "x78zum5 x1qughib x8zbtdt x1c87qhr xy8obcc xas2l8k x153jb6y xss6m8b",
1272
- children: [/* @__PURE__ */ D(n, { width: "8ch" }), /* @__PURE__ */ D(n, { width: "8ch" })]
2338
+ children: [/* @__PURE__ */ O(n, { width: "8ch" }), /* @__PURE__ */ O(n, { width: "8ch" })]
1273
2339
  })]
1274
2340
  })]
1275
2341
  })
1276
2342
  })
1277
2343
  });
1278
2344
  }
1279
- function Fe({ charts: e, ...t }) {
1280
- let n = w(null), [r, i] = T(), a = JSON.stringify(e.map((e) => [
2345
+ function Tn({ charts: e, ...t }) {
2346
+ let n = ne(null), [r, i] = E(), a = JSON.stringify(e.map((e) => [
1281
2347
  e.id,
1282
2348
  e.title,
1283
- Ce({
2349
+ Pt({
1284
2350
  series: e.series,
1285
2351
  markers: e.markers ?? [],
1286
2352
  timestampUnit: t.timestampUnit,
1287
2353
  isStacked: !1
1288
2354
  })
1289
2355
  ])), o = JSON.stringify(e[0]?.series[0]?.points.map((e) => e.timestamp) ?? []), s = e.every((e) => JSON.stringify(e.series[0]?.points.map((e) => e.timestamp) ?? []) === o);
1290
- if (r !== void 0 && r.signature !== a && i(void 0), S(() => {
2356
+ if (r !== void 0 && r.signature !== a && i(void 0), te(() => {
1291
2357
  function e(e) {
1292
2358
  e.target instanceof Node && n.current?.contains(e.target) !== !0 && i(void 0);
1293
2359
  }
1294
2360
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1295
- }, []), !s || !m(e)) return /* @__PURE__ */ D(g, {
2361
+ }, []), !s || !m(e)) return /* @__PURE__ */ O(g, {
1296
2362
  title: "Small multiples",
1297
2363
  message: "Charts need unique identifiers and aligned observation timestamps."
1298
2364
  });
1299
- if (e.length > $.panels) return /* @__PURE__ */ D(g, {
2365
+ if (e.length > $.panels) return /* @__PURE__ */ O(g, {
1300
2366
  title: "Small multiples",
1301
2367
  message: `Choose at most ${$.panels} panels.`
1302
2368
  });
1303
- if (e.length === 0) return /* @__PURE__ */ D(p, {
2369
+ if (e.length === 0) return /* @__PURE__ */ O(p, {
1304
2370
  title: "Small multiples",
1305
- children: /* @__PURE__ */ D("p", {
2371
+ children: /* @__PURE__ */ O("p", {
1306
2372
  className: "x153jb6y",
1307
2373
  children: "No charts"
1308
2374
  })
1309
2375
  });
1310
2376
  let c = Math.max(52, ...e.flatMap((e) => e.series.flatMap((t) => t.points.flatMap((t) => t.value === null || !Number.isFinite(t.value) ? [] : [(e.formatTick ?? e.formatValue)(t.value).length * 7 + 12])))), l = e.every((e) => e.report !== void 0);
1311
- return /* @__PURE__ */ D("div", {
2377
+ return /* @__PURE__ */ O("div", {
1312
2378
  ref: n,
1313
2379
  ...{
1314
2380
  0: { className: "xrvj5dj x1j825kq" },
1315
2381
  1: { className: "xrvj5dj xxhr3t" }
1316
2382
  }[!!l | 0],
1317
- children: e.map((n, o) => /* @__PURE__ */ D("div", {
2383
+ children: e.map((n, o) => /* @__PURE__ */ O("div", {
1318
2384
  ...{
1319
2385
  0: {},
1320
2386
  1: { className: "x1y332i5" }
1321
2387
  }[!!(l && o > 0) | 0],
1322
- children: /* @__PURE__ */ D(Re, {
2388
+ children: /* @__PURE__ */ O(On, {
1323
2389
  ...t,
1324
2390
  title: n.title,
1325
2391
  description: n.description,
@@ -1345,25 +2411,25 @@ function Fe({ charts: e, ...t }) {
1345
2411
  }, n.id))
1346
2412
  });
1347
2413
  }
1348
- function Ie({ charts: e, height: t }) {
1349
- if (!m(e) || e.length > $.panels) return /* @__PURE__ */ D(g, {
2414
+ function En({ charts: e, height: t }) {
2415
+ if (!m(e) || e.length > $.panels) return /* @__PURE__ */ O(g, {
1350
2416
  title: "Small multiples",
1351
2417
  message: `Choose at most ${$.panels} panels with unique identifiers.`
1352
2418
  });
1353
2419
  let n = e.every((e) => e.report !== void 0);
1354
- return /* @__PURE__ */ D("div", {
2420
+ return /* @__PURE__ */ O("div", {
1355
2421
  "aria-hidden": !0,
1356
2422
  inert: !0,
1357
2423
  ...{
1358
2424
  0: { className: "xrvj5dj x1j825kq" },
1359
2425
  1: { className: "xrvj5dj xxhr3t" }
1360
2426
  }[!!n | 0],
1361
- children: e.map((r, i) => /* @__PURE__ */ D("div", {
2427
+ children: e.map((r, i) => /* @__PURE__ */ O("div", {
1362
2428
  ...{
1363
2429
  0: {},
1364
2430
  1: { className: "x1y332i5" }
1365
2431
  }[!!(n && i > 0) | 0],
1366
- children: /* @__PURE__ */ D(Pe, {
2432
+ children: /* @__PURE__ */ O(wn, {
1367
2433
  ...r,
1368
2434
  height: t,
1369
2435
  showTimeAxis: i === e.length - 1
@@ -1371,256 +2437,340 @@ function Ie({ charts: e, height: t }) {
1371
2437
  }, r.id))
1372
2438
  });
1373
2439
  }
1374
- var Le = {
2440
+ var Dn = {
1375
2441
  "x-default-marker": "x-default-marker",
1376
2442
  $$css: !0
1377
2443
  };
1378
- function Re({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: u = [], height: d = 180, actions: f, report: m, kind: h, isStacked: y, sharedInspection: b, axisWidth: te, showTimeAxis: E = !0 }) {
1379
- let k = !Number.isFinite(d) || d < 48 ? "Chart height must be at least 48 pixels." : Se({
2444
+ function On({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: u = [], height: d = 180, actions: f, report: m, kind: h, isStacked: y, sharedInspection: b, axisWidth: x, showTimeAxis: C = !0, bands: D = [], crossings: A = [] }) {
2445
+ let re = D[0]?.points.map((e) => e.timestamp) ?? [], ie = r[0]?.points.map((e) => e.timestamp) ?? re, N = !Number.isFinite(d) || d < 48 ? "Chart height must be at least 48 pixels." : Mt({
1380
2446
  series: r,
1381
2447
  isStacked: y,
1382
- markers: u
1383
- }), A = ne(() => k === void 0 ? Te(r, y) : [], [
2448
+ markers: u,
2449
+ timeline: re
2450
+ }) ?? qt({
2451
+ bands: D,
2452
+ crossings: A,
2453
+ series: r,
2454
+ timestamps: ie
2455
+ }), P = T(() => N === void 0 ? It(r, y) : [], [
1384
2456
  r,
1385
2457
  y,
1386
- k
1387
- ]), M = A[0]?.points ?? [], { ref: ie, width: N, element: P } = ee(), oe = w(null), [se, ue] = T(), I = ne(() => M.map(({ timestamp: e }) => ({
2458
+ N
2459
+ ]), F = T(() => N === void 0 ? Jt({
2460
+ series: r,
2461
+ bands: D
2462
+ }) : [], [
2463
+ r,
2464
+ D,
2465
+ N
2466
+ ]), I = P[0]?.points ?? F[0]?.points ?? [], { ref: oe, width: se, element: de } = ee(), L = ne(null), [fe, R] = E(), pe = T(() => I.map(({ timestamp: e }) => ({
1388
2467
  id: String(e),
1389
2468
  label: a(e)
1390
- })), [M, a]), de = M.find((e) => e.timestamp === se) ?? M[0], [L, fe] = T(), R = Ce({
2469
+ })), [I, a]), z = I.find((e) => e.timestamp === fe) ?? I[0], [B, me] = E(), V = `${Pt({
1391
2470
  series: r,
1392
2471
  markers: u,
1393
2472
  timestampUnit: i,
1394
2473
  isStacked: y
1395
- }), z = b === void 0 ? L?.signature === R ? L : void 0 : b.value, B = b === void 0 || b.isSource ? z : void 0, pe = m?.seriesValues !== void 0, me = C();
1396
- L !== void 0 && (L.signature !== R || k !== void 0) && fe(void 0);
1397
- let V = b !== void 0;
1398
- if (S(() => {
1399
- if (V) return;
2474
+ })}${vn({
2475
+ bands: D,
2476
+ crossings: A
2477
+ })}`, he = [...P.map(({ id: e, label: t, tone: n }) => ({
2478
+ id: e,
2479
+ label: t,
2480
+ tone: n
2481
+ })), ...F.map(({ id: e, label: t, tone: n }) => ({
2482
+ id: e,
2483
+ label: t,
2484
+ tone: n,
2485
+ shape: "band"
2486
+ }))], H = b === void 0 ? B?.signature === V ? B : void 0 : b.value, U = b === void 0 || b.isSource ? H : void 0, ge = m?.seriesValues !== void 0, W = w();
2487
+ B !== void 0 && (B.signature !== V || N !== void 0) && me(void 0);
2488
+ let _e = b !== void 0;
2489
+ if (te(() => {
2490
+ if (_e) return;
1400
2491
  function e(e) {
1401
- e.target instanceof Node && oe.current?.contains(e.target) !== !0 && fe(void 0);
2492
+ e.target instanceof Node && L.current?.contains(e.target) !== !0 && me(void 0);
1402
2493
  }
1403
2494
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1404
- }, [V]), k !== void 0) return /* @__PURE__ */ D(g, {
2495
+ }, [_e]), N !== void 0) return /* @__PURE__ */ O(g, {
1405
2496
  title: t,
1406
2497
  description: n,
1407
2498
  report: m,
1408
- message: k
2499
+ message: N
1409
2500
  });
1410
- if (M.length === 0) return /* @__PURE__ */ D(p, {
2501
+ if (I.length === 0) return /* @__PURE__ */ O(p, {
1411
2502
  title: t,
1412
2503
  description: n,
1413
2504
  actions: f,
1414
2505
  report: m,
1415
- series: A,
1416
- children: /* @__PURE__ */ D("p", {
2506
+ series: he,
2507
+ children: /* @__PURE__ */ O("p", {
1417
2508
  className: "x153jb6y",
1418
2509
  children: "No observations"
1419
2510
  })
1420
2511
  });
1421
- let he = {
1422
- label: B === void 0 ? void 0 : a(B.timestamp),
1423
- rows: A.map((e) => {
1424
- let t = e.points.find((e) => e.timestamp === B?.timestamp);
2512
+ let ve = I.map((e) => e.timestamp), ye = Zt({
2513
+ crossings: A,
2514
+ series: r,
2515
+ bands: D
2516
+ }), be = [...u.flatMap((e) => e.kind === "event" ? [e] : []), ...ye.flatMap(({ crossing: e, timestamp: t }) => t === void 0 ? [] : [{
2517
+ id: e.id,
2518
+ timestamp: t,
2519
+ label: e.label,
2520
+ value: e.value
2521
+ }])], xe = be.filter((e) => Qt(ve, e.timestamp) === U?.timestamp).map((e) => `${e.label} · ${a(e.timestamp)}`), Se = {
2522
+ label: U === void 0 ? void 0 : a(U.timestamp),
2523
+ rows: [...P.map((e) => {
2524
+ let t = e.points.find((e) => e.timestamp === U?.timestamp);
1425
2525
  return {
1426
2526
  id: e.id,
1427
2527
  label: e.label,
1428
2528
  tone: e.tone,
1429
2529
  value: t?.value === null || t === void 0 ? "Unavailable" : o(t.value)
1430
2530
  };
1431
- }),
1432
- notes: u.filter((e) => e.timestamp === B?.timestamp).map((e) => e.label)
1433
- }, H = d - 28, ge = H + 12, U = M[0]?.timestamp ?? 0, W = M.at(-1)?.timestamp ?? U, G = A.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), K = h === "area" ? Math.min(0, ...G) : Math.min(...G), q = h === "area" ? Math.max(0, ...G) : Math.max(...G), _e = G.length === 0 ? 0 : K, ve = G.length === 0 ? 1 : q, J = j({
1434
- domain: [...we(_e, ve, h === "area")],
1435
- range: [H, 12]
1436
- }), Y = J.ticks(3), X = te ?? Math.max(44, ...Y.map((e) => c(e).length * 7 + 12)), Z = Math.max(X + 1, N - 16), Q = j({
1437
- domain: [...we(U, W)],
1438
- range: [X, Z]
1439
- });
1440
- function ye(e) {
1441
- let t = P?.getBoundingClientRect();
2531
+ }), ...yn({
2532
+ bands: F,
2533
+ timestamp: U?.timestamp,
2534
+ formatValue: o
2535
+ })],
2536
+ notes: [...u.filter((e) => e.kind !== "event" && e.timestamp === U?.timestamp).map((e) => e.label), ...xe]
2537
+ }, G = d - 28, Ce = G + 12, we = I[0]?.timestamp ?? 0, Te = I.at(-1)?.timestamp ?? we, K = [
2538
+ ...P.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])),
2539
+ ...$t(D),
2540
+ ...A.map((e) => e.value)
2541
+ ], Ee = h === "area" ? Math.min(0, ...K) : Math.min(...K), De = h === "area" ? Math.max(0, ...K) : Math.max(...K), q = Ft(K.length === 0 ? 0 : Ee, K.length === 0 ? 1 : De, h === "area"), Oe = j({
2542
+ domain: [...q],
2543
+ range: [G, 0]
2544
+ }), J = x ?? Math.max(44, ...Oe.ticks(3).map((e) => c(e).length * 7 + 12)), Y = Math.max(J + 1, se - 16), X = j({
2545
+ domain: [...Ft(we, Te)],
2546
+ range: [J, Y]
2547
+ }), ke = fn({
2548
+ instants: be,
2549
+ x: X,
2550
+ right: Y
2551
+ }), Z = pn(ke), Q = j({
2552
+ domain: [...q],
2553
+ range: [G, Z]
2554
+ }), Ae = Q.ticks(3);
2555
+ function je(e) {
2556
+ let t = de?.getBoundingClientRect();
1442
2557
  if (t === void 0) return;
1443
- let n = Q.invert(e - t.left), r = M.find((e, t) => {
1444
- let r = M[t + 1];
2558
+ let n = X.invert(e - t.left), r = I.find((e, t) => {
2559
+ let r = I[t + 1];
1445
2560
  return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
1446
2561
  });
1447
- r !== void 0 && $({
1448
- signature: R,
2562
+ r !== void 0 && Me({
2563
+ signature: V,
1449
2564
  timestamp: r.timestamp,
1450
2565
  source: "pointer"
1451
2566
  });
1452
2567
  }
1453
- function $(e) {
1454
- b === void 0 ? fe(e) : b.onChange(e);
2568
+ function Me(e) {
2569
+ b === void 0 ? me(e) : b.onChange(e);
1455
2570
  }
1456
- return /* @__PURE__ */ D("div", {
1457
- ref: oe,
2571
+ return /* @__PURE__ */ O("div", {
2572
+ ref: L,
1458
2573
  className: "xeuugli",
1459
- children: /* @__PURE__ */ O(p, {
1460
- title: pe ? t : /* @__PURE__ */ D(F, {
2574
+ children: /* @__PURE__ */ k(p, {
2575
+ title: ge ? t : /* @__PURE__ */ O(ce, {
1461
2576
  title: t,
1462
- detail: B === void 0 ? void 0 : a(B.timestamp)
2577
+ detail: U === void 0 ? void 0 : a(U.timestamp)
1463
2578
  }),
1464
2579
  description: n,
1465
2580
  report: m,
1466
- series: A,
2581
+ series: he,
1467
2582
  actions: f,
1468
- children: [/* @__PURE__ */ D(s, {
2583
+ children: [/* @__PURE__ */ O(s, {
1469
2584
  label: `${t} observations`,
1470
- columns: [{
1471
- id: "time",
1472
- label: `Time (${i})`
1473
- }, ...A.map((e) => ({
1474
- id: `series:${e.id}`,
1475
- label: e.label
1476
- }))],
1477
- rows: M.map((e, t) => ({
2585
+ columns: [
2586
+ {
2587
+ id: "time",
2588
+ label: `Time (${i})`
2589
+ },
2590
+ ...P.map((e) => ({
2591
+ id: `series:${e.id}`,
2592
+ label: e.label
2593
+ })),
2594
+ ...F.flatMap((e) => [{
2595
+ id: `band:${e.id}`,
2596
+ label: e.label
2597
+ }, {
2598
+ id: `band-range:${e.id}`,
2599
+ label: `${e.label}: ${e.rangeLabel}`
2600
+ }])
2601
+ ],
2602
+ rows: I.map((e, t) => ({
1478
2603
  id: e.timestamp,
1479
- values: [a(e.timestamp), ...A.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value))]
2604
+ values: [
2605
+ a(e.timestamp),
2606
+ ...P.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value)),
2607
+ ...yn({
2608
+ bands: F,
2609
+ timestamp: e.timestamp,
2610
+ formatValue: o
2611
+ }).map((e) => e.value)
2612
+ ]
1480
2613
  }))
1481
- }), /* @__PURE__ */ O("div", {
2614
+ }), /* @__PURE__ */ k("div", {
1482
2615
  className: "xrvj5dj x1n8ia3y",
1483
2616
  children: [
1484
- /* @__PURE__ */ D(le, {
1485
- id: me,
1486
- label: he.label,
1487
- legend: A.map(({ id: e, label: t, tone: n }) => ({
1488
- id: e,
1489
- label: t,
1490
- tone: n
1491
- })),
1492
- rows: he.rows,
1493
- x: Q(z?.timestamp ?? U),
1494
- width: N,
1495
- source: B?.source,
1496
- notes: he.notes,
1497
- hasSeriesSummary: pe
2617
+ /* @__PURE__ */ O(ue, {
2618
+ id: W,
2619
+ label: Se.label,
2620
+ legend: he,
2621
+ rows: Se.rows,
2622
+ x: X(H?.timestamp ?? we),
2623
+ width: se,
2624
+ source: U?.source,
2625
+ notes: Se.notes,
2626
+ hasSeriesSummary: ge
1498
2627
  }),
1499
- /* @__PURE__ */ O("div", {
1500
- ref: ie,
1501
- ...x.props(v.plot),
1502
- children: [/* @__PURE__ */ O(l, {
2628
+ /* @__PURE__ */ k("div", {
2629
+ ref: oe,
2630
+ ...S.props(v.plot),
2631
+ children: [/* @__PURE__ */ k(l, {
1503
2632
  role: "img",
1504
2633
  "aria-label": `${t}. Use arrow keys to inspect observations.`,
1505
- "aria-describedby": me,
2634
+ "aria-describedby": W,
1506
2635
  tabIndex: 0,
1507
- viewBox: `0 0 ${N} ${ge}`,
1508
- height: ge,
2636
+ viewBox: `0 0 ${se} ${Ce}`,
2637
+ height: Ce,
1509
2638
  controls: {
1510
- items: I,
1511
- cursor: de === void 0 ? void 0 : String(de.timestamp),
1512
- inspected: B === void 0 ? void 0 : String(B.timestamp),
1513
- readout: ce(he),
2639
+ items: pe,
2640
+ cursor: z === void 0 ? void 0 : String(z.timestamp),
2641
+ inspected: U === void 0 ? void 0 : String(U.timestamp),
2642
+ readout: le(Se),
1514
2643
  onInspect: (e) => {
1515
2644
  let t = Number(e);
1516
- ue(t), $({
1517
- signature: R,
2645
+ R(t), Me({
2646
+ signature: V,
1518
2647
  timestamp: t,
1519
2648
  source: "keyboard"
1520
2649
  });
1521
2650
  },
1522
- onDismiss: () => $(void 0)
2651
+ onDismiss: () => Me(void 0)
1523
2652
  },
1524
2653
  onFocus: (e) => {
1525
2654
  if (e.currentTarget.matches(":focus-visible")) {
1526
- let e = z?.timestamp ?? U;
1527
- ue(e), $({
1528
- signature: R,
2655
+ let e = H?.timestamp ?? we;
2656
+ R(e), Me({
2657
+ signature: V,
1529
2658
  timestamp: e,
1530
2659
  source: "keyboard"
1531
2660
  });
1532
2661
  }
1533
2662
  },
1534
2663
  onPointerMove: (e) => {
1535
- e.pointerType === "mouse" && ye(e.clientX);
2664
+ e.pointerType === "mouse" && je(e.clientX);
1536
2665
  },
1537
- onPointerDown: (e) => ye(e.clientX),
2666
+ onPointerDown: (e) => je(e.clientX),
1538
2667
  onPointerLeave: (e) => {
1539
- e.pointerType === "mouse" && z?.source === "pointer" && $(void 0);
2668
+ e.pointerType === "mouse" && H?.source === "pointer" && Me(void 0);
1540
2669
  },
1541
- onBlur: () => $(void 0),
1542
- ...x.props(v.svg, v.inspectable, Le),
2670
+ onBlur: () => Me(void 0),
2671
+ ...S.props(v.svg, v.inspectable, Dn),
1543
2672
  children: [
1544
- Y.map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
1545
- x1: X,
1546
- x2: Z,
1547
- y1: J(e),
1548
- y2: J(e),
1549
- ...x.props(v.grid)
1550
- }), /* @__PURE__ */ D("text", {
1551
- x: X - 8,
1552
- y: J(e),
2673
+ Ae.map((e) => /* @__PURE__ */ k("g", { children: [/* @__PURE__ */ O("line", {
2674
+ x1: J,
2675
+ x2: Y,
2676
+ y1: Q(e),
2677
+ y2: Q(e),
2678
+ ...S.props(v.grid)
2679
+ }), /* @__PURE__ */ O("text", {
2680
+ x: J - 8,
2681
+ y: Q(e),
1553
2682
  textAnchor: "end",
1554
2683
  dominantBaseline: "middle",
1555
- ...x.props(v.label),
2684
+ ...S.props(v.label),
1556
2685
  children: c(e)
1557
2686
  })] }, e)),
1558
- A.map((t) => /* @__PURE__ */ O("g", { children: [h === "area" && /* @__PURE__ */ D(re, {
2687
+ A.map((e) => /* @__PURE__ */ O("line", {
2688
+ x1: J,
2689
+ x2: Y,
2690
+ y1: Q(e.value),
2691
+ y2: Q(e.value),
2692
+ ...S.props(v.baseline)
2693
+ }, e.id)),
2694
+ /* @__PURE__ */ O(hn, {
2695
+ bands: F,
2696
+ x: X,
2697
+ y: Q
2698
+ }),
2699
+ P.map((t) => /* @__PURE__ */ k("g", { children: [h === "area" && /* @__PURE__ */ O(M, {
1559
2700
  data: [...t.points],
1560
2701
  defined: (e) => e.value !== null,
1561
- x: (e) => Q(e.timestamp),
1562
- y0: (e) => J(e.base),
1563
- y1: (e) => J((e.value ?? 0) + e.base),
1564
- yScale: J,
2702
+ x: (e) => X(e.timestamp),
2703
+ y0: (e) => Q(e.base),
2704
+ y1: (e) => Q((e.value ?? 0) + e.base),
2705
+ yScale: Q,
1565
2706
  fill: e[t.tone],
1566
- fillOpacity: y ? .65 : .15
1567
- }), /* @__PURE__ */ D(De, {
2707
+ fillOpacity: y ? .65 : .12
2708
+ }), /* @__PURE__ */ O(Rt, {
1568
2709
  series: t,
1569
- x: Q,
1570
- y: J,
1571
- inspectedTimestamp: z?.timestamp
2710
+ x: X,
2711
+ y: Q,
2712
+ inspectedTimestamp: H?.timestamp
1572
2713
  })] }, t.id)),
1573
- u.map((e) => /* @__PURE__ */ O("g", { children: [e.kind === "time" ? /* @__PURE__ */ D("line", {
1574
- x1: Q(e.timestamp),
1575
- x2: Q(e.timestamp),
1576
- y1: 12,
1577
- y2: H,
2714
+ /* @__PURE__ */ O(gn, {
2715
+ placed: ke,
2716
+ x: X,
2717
+ y: Q,
2718
+ bottom: G
2719
+ }),
2720
+ u.filter((e) => e.kind !== "event").map((e) => /* @__PURE__ */ k("g", { children: [e.kind === "time" ? /* @__PURE__ */ O("line", {
2721
+ x1: X(e.timestamp),
2722
+ x2: X(e.timestamp),
2723
+ y1: Z,
2724
+ y2: G,
1578
2725
  className: "xhq4mlf x1ntoi03 x13efnbd"
1579
- }) : /* @__PURE__ */ D("circle", {
1580
- cx: Q(e.timestamp),
1581
- cy: J(e.value + (A.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
2726
+ }) : /* @__PURE__ */ O("circle", {
2727
+ cx: X(e.timestamp),
2728
+ cy: Q(e.value + (P.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1582
2729
  r: 4,
1583
2730
  fill: _.surface,
1584
- ...x.props(v.selected)
1585
- }), /* @__PURE__ */ D("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
1586
- z !== void 0 && /* @__PURE__ */ D("line", {
1587
- x1: Q(z.timestamp),
1588
- x2: Q(z.timestamp),
1589
- y1: 12,
1590
- y2: H,
2731
+ ...S.props(v.selected)
2732
+ }), /* @__PURE__ */ O("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
2733
+ H !== void 0 && /* @__PURE__ */ O("line", {
2734
+ x1: X(H.timestamp),
2735
+ x2: X(H.timestamp),
2736
+ y1: Z,
2737
+ y2: G,
1591
2738
  className: "xhq4mlf x1ntoi03 x13efnbd"
1592
2739
  }),
1593
- de !== void 0 && /* @__PURE__ */ D(ae, {
1594
- x: Q(de.timestamp),
1595
- top: 12,
1596
- bottom: H,
1597
- width: Math.min(16, (Z - X) / 2)
2740
+ z !== void 0 && /* @__PURE__ */ O(ae, {
2741
+ x: X(z.timestamp),
2742
+ top: Z,
2743
+ bottom: G,
2744
+ width: Math.min(16, (Y - J) / 2)
1598
2745
  })
1599
2746
  ]
1600
- }), E && /* @__PURE__ */ O("div", {
2747
+ }), C && /* @__PURE__ */ k("div", {
1601
2748
  "aria-hidden": !0,
1602
- ...x.props(Ae.timeAxis, Ae.timeAxisInset(X, Math.max(0, N - Z))),
1603
- children: [/* @__PURE__ */ D("span", {
2749
+ ...S.props(_n.timeAxis, _n.timeAxisInset(J, Math.max(0, se - Y))),
2750
+ children: [/* @__PURE__ */ O("span", {
1604
2751
  className: "x1cqoux5 xeuugli xj0a0fe",
1605
- children: a(U)
1606
- }), W !== U && /* @__PURE__ */ D("span", {
2752
+ children: a(we)
2753
+ }), Te !== we && /* @__PURE__ */ O("span", {
1607
2754
  className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
1608
- children: a(W)
2755
+ children: a(Te)
1609
2756
  })]
1610
2757
  })]
1611
2758
  }),
1612
- u.length > 0 && /* @__PURE__ */ D("ul", {
2759
+ u.length + ye.length > 0 && /* @__PURE__ */ k("ul", {
1613
2760
  className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
1614
- children: u.map((e) => /* @__PURE__ */ O("li", { children: [
2761
+ children: [u.map((e) => /* @__PURE__ */ k("li", { children: [
1615
2762
  a(e.timestamp),
1616
2763
  " · ",
1617
2764
  e.label,
1618
2765
  e.kind === "point" && ` · ${o(e.value)}`
1619
- ] }, e.id))
2766
+ ] }, e.id)), ye.map((e) => /* @__PURE__ */ O("li", { children: bn({
2767
+ found: e,
2768
+ formatTimestamp: a
2769
+ }) }, e.crossing.id))]
1620
2770
  })
1621
2771
  ]
1622
2772
  })]
1623
2773
  })
1624
2774
  });
1625
2775
  }
1626
- export { Me as AreaChart, V as BarChart, z as BarChartPlaceholder, U as BreakdownBar, je as LineChart, _e as MAX_SCATTER_POINTS, Y as ScatterPlot, Fe as SmallMultiples, Ie as SmallMultiplesPlaceholder, Oe as Sparkline, Ne as TimeSeriesChartPlaceholder, $ as timeSeriesLimits };
2776
+ export { Sn as AreaChart, Ge as BarChart, Ve as BarChartPlaceholder, Ye as BreakdownBar, gt as BridgeChart, xn as LineChart, St as MAX_SCATTER_POINTS, Tt as ScatterPlot, Tn as SmallMultiples, En as SmallMultiplesPlaceholder, Ht as Sparkline, Cn as TimeSeriesChartPlaceholder, Wt as timeSeriesBandLimits, $ as timeSeriesLimits };