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