@mechane-ai/elements 0.39.0 → 0.41.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/NOTICE +11 -19
  2. package/README.md +49 -25
  3. package/dist/accessibility-P89UG9-r.js +25 -0
  4. package/dist/agent.js +1 -0
  5. package/dist/ai.js +50 -44
  6. package/dist/{categorical-values-BECG-J6R.js → categorical-values-DnGR_pQx.js} +3 -3
  7. package/dist/{chart-frame-CJFnI39T.js → chart-frame-BsyI1Zc8.js} +58 -57
  8. package/dist/{chart-input-DwAobO8Y.js → chart-input-r4S3-QCT.js} +2 -2
  9. package/dist/chart-navigation-D7OkLdSx.js +119 -0
  10. package/dist/charts/cartesian.js +560 -583
  11. package/dist/charts/distribution.js +218 -218
  12. package/dist/charts/graph.js +86 -85
  13. package/dist/charts/hierarchy.js +4 -4
  14. package/dist/charts/matrix.js +148 -147
  15. package/dist/charts/timeline.js +77 -76
  16. package/dist/charts.js +2 -2
  17. package/dist/code-block-C4K1sM9O.js +255 -0
  18. package/dist/collections.js +828 -607
  19. package/dist/constants.stylex-BILvnwUk.js +84 -0
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +3 -3
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +184 -77
  25. package/dist/{content-link-B3ObdyZY.js → content-link-CBDqSvgP.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/control-styles-D3q_Qyxi.js +179 -0
  28. package/dist/csp.js +14 -1
  29. package/dist/feedback.js +1 -1
  30. package/dist/forms/dates.js +359 -245
  31. package/dist/forms-I-WMHTkr.js +139 -0
  32. package/dist/forms.js +3 -3
  33. package/dist/index.js +1 -1
  34. package/dist/layout.js +271 -241
  35. package/dist/navigation/commands.js +87 -76
  36. package/dist/{navigation-D2_sGy3C.js → navigation-CveMIuXI.js} +1 -1
  37. package/dist/navigation.js +2 -2
  38. package/dist/overlays.js +1 -1
  39. package/dist/packages/ai/src/message-action.d.ts +1 -1
  40. package/dist/packages/charts/src/chart-navigation.d.ts +18 -2
  41. package/dist/packages/charts/src/chart-surface.d.ts +23 -0
  42. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -2
  43. package/dist/packages/collections/src/data-table.d.ts +7 -2
  44. package/dist/packages/collections/src/index.d.ts +4 -1
  45. package/dist/packages/collections/src/query-controls.d.ts +18 -0
  46. package/dist/packages/collections/src/table-query.d.ts +64 -0
  47. package/dist/packages/collections/src/use-collection-controls.d.ts +3 -8
  48. package/dist/packages/content/src/pierre-theme.d.ts +0 -1
  49. package/dist/packages/core/src/actions.d.ts +15 -13
  50. package/dist/packages/core/src/copy-value.d.ts +3 -2
  51. package/dist/packages/core/src/disclosure.d.ts +14 -11
  52. package/dist/packages/feedback/src/notifications.d.ts +15 -15
  53. package/dist/packages/feedback/src/toast.d.ts +9 -3
  54. package/dist/packages/forms/src/combobox.d.ts +31 -41
  55. package/dist/packages/forms/src/dates/event-month.d.ts +17 -0
  56. package/dist/packages/forms/src/dates/index.d.ts +2 -0
  57. package/dist/packages/forms/src/field-styles.d.ts +0 -19
  58. package/dist/packages/forms/src/form-controls.d.ts +26 -24
  59. package/dist/packages/forms/src/forms.d.ts +17 -14
  60. package/dist/packages/forms/src/select-control.d.ts +6 -4
  61. package/dist/packages/forms/src/select.d.ts +14 -18
  62. package/dist/packages/forms/src/selection-state.d.ts +11 -0
  63. package/dist/packages/forms/src/selection-styles.d.ts +3 -0
  64. package/dist/packages/forms/src/selection.d.ts +21 -19
  65. package/dist/packages/foundations/src/agent/index.d.ts +2 -0
  66. package/dist/packages/foundations/src/control-state.d.ts +2 -3
  67. package/dist/packages/foundations/src/control-styles.d.ts +19 -0
  68. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  69. package/dist/packages/foundations/src/csp/provider.d.ts +3 -0
  70. package/dist/packages/foundations/src/style-composition.d.ts +4 -1
  71. package/dist/packages/layout/src/app-shell.d.ts +12 -1
  72. package/dist/packages/layout/src/index.d.ts +1 -1
  73. package/dist/packages/layout/src/navigation-rail.d.ts +15 -2
  74. package/dist/packages/layout/src/resizable.d.ts +2 -2
  75. package/dist/packages/layout/src/sidebar.d.ts +4 -3
  76. package/dist/packages/navigation/src/tab-styles.d.ts +1 -1
  77. package/dist/packages/navigation/src/tabs.d.ts +12 -10
  78. package/dist/packages/overlays/src/alert-dialog.d.ts +19 -13
  79. package/dist/packages/overlays/src/dialog.d.ts +39 -24
  80. package/dist/packages/overlays/src/drawer.d.ts +16 -26
  81. package/dist/packages/overlays/src/menu.d.ts +37 -44
  82. package/dist/packages/overlays/src/overlay-root.d.ts +10 -0
  83. package/dist/packages/overlays/src/popover.d.ts +11 -20
  84. package/dist/packages/overlays/src/preview.d.ts +6 -13
  85. package/dist/packages/overlays/src/tooltip.d.ts +12 -15
  86. package/dist/{pierre-diff-CaPsfQRo.js → pierre-diff-DJ3oOfPX.js} +5 -5
  87. package/dist/{src-DPRmO-JY.js → src-CNV1ewzb.js} +379 -407
  88. package/dist/{src-CSWIG_op.js → src-CQQvXi7a.js} +58 -81
  89. package/dist/{src-DWjAoOyd.js → src-D2OHco8V.js} +42 -41
  90. package/dist/src-DfOAlAd2.js +750 -0
  91. package/dist/src-na2DdkKI.js +561 -0
  92. package/dist/{src-C-Sx37kz.js → src-s3tWwnN4.js} +361 -518
  93. package/dist/styles.js +3 -0
  94. package/dist/{elements.css → styles2.css} +195 -97
  95. package/dist/tokens.js +3 -1
  96. package/dist/{tokens.stylex-CJbIDPB9.js → tokens.stylex-dF5CACEJ.js} +13 -93
  97. package/package.json +8 -9
  98. package/skills/elements-workspace/SKILL.md +12 -0
  99. package/dist/accessibility-C-aIZ1Yx.js +0 -15
  100. package/dist/chart-navigation-CBIeNtJq.js +0 -67
  101. package/dist/code-block-aC0Htt4N.js +0 -184
  102. package/dist/forms-BQQFas9g.js +0 -118
  103. package/dist/foundations.css +0 -7
  104. package/dist/packages/content/src/tree/pierre-tree.d.ts +0 -3
  105. package/dist/pierre-theme-BpNaWn1x.js +0 -126
  106. package/dist/pierre-tree-CYCRjdGG.js +0 -106
  107. package/dist/src-d7EAi61b.js +0 -617
  108. package/dist/src-nkgFDl-g.js +0 -1171
  109. package/dist/style-composition-uYlczSsB.js +0 -9
  110. package/styles.css +0 -2
@@ -1,29 +1,31 @@
1
- import { c as e, d as t, f as n } from "../src-nkgFDl-g.js";
2
- import { i as r, n as i, r as a, t as o } from "../categorical-values-BECG-J6R.js";
3
- import { n as s, t as c } from "../chart-navigation-CBIeNtJq.js";
4
- import { a as l, i as u, n as d } from "../chart-frame-CJFnI39T.js";
5
- import { n as f, r as p, t as m } from "../chart-input-DwAobO8Y.js";
6
- import { r as h } from "../tokens.stylex-CJbIDPB9.js";
7
- import { n as g, t as ee } from "../plot-width-BQQS-mw9.js";
8
- import { D as _ } from "../src-C-Sx37kz.js";
9
- import { m as v } from "../src-DPRmO-JY.js";
10
- import * as y from "@stylexjs/stylex";
11
- import { useEffect as te, useId as b, useMemo as ne, useRef as x, useState as S } from "react";
12
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
13
- import { scaleBand as re, scaleLinear as E } from "@visx/scale";
14
- import { AreaClosed as ie, Bar as ae, LinePath as D } from "@visx/shape";
1
+ import { c as e, d as t, f as n } from "../src-DfOAlAd2.js";
2
+ import { i as r, n as i, r as a, t as o } from "../categorical-values-DnGR_pQx.js";
3
+ import { a as s, n as c, r as l, t as u } from "../chart-navigation-D7OkLdSx.js";
4
+ import { a as d, i as f, n as p } from "../chart-frame-BsyI1Zc8.js";
5
+ import { n as m, r as h, t as g } from "../chart-input-r4S3-QCT.js";
6
+ import { r as _ } from "../tokens.stylex-dF5CACEJ.js";
7
+ import { n as v, t as ee } from "../plot-width-BQQS-mw9.js";
8
+ import { D as y } from "../src-s3tWwnN4.js";
9
+ import { m as b } from "../src-CNV1ewzb.js";
10
+ import * as x from "@stylexjs/stylex";
11
+ import { Button as te } from "@ui-sdk/react/button";
12
+ import { useEffect as S, useId as C, useMemo as ne, useRef as w, useState as T } from "react";
13
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
14
+ import { bindDrag as k } from "@ui-sdk/core";
15
+ import { scaleBand as A, scaleLinear as j } from "@visx/scale";
16
+ import { AreaClosed as re, Bar as M, LinePath as ie } from "@visx/shape";
15
17
  // packages/charts/src/chart-cursor.tsx
16
- function oe({ x: e, top: t, bottom: n, width: r }) {
17
- return /* @__PURE__ */ T("g", {
18
+ function ae({ x: e, top: t, bottom: n, width: r }) {
19
+ return /* @__PURE__ */ O("g", {
18
20
  "aria-hidden": !0,
19
21
  className: "xlshs6z xgs60n x17y187c xbabvq0 x47corl",
20
- children: [/* @__PURE__ */ w("line", {
22
+ children: [/* @__PURE__ */ D("line", {
21
23
  x1: e,
22
24
  x2: e,
23
25
  y1: t,
24
26
  y2: n,
25
27
  className: "xnpr05h x1ntoi03 x13efnbd"
26
- }), /* @__PURE__ */ w("line", {
28
+ }), /* @__PURE__ */ D("line", {
27
29
  x1: e - r / 2,
28
30
  x2: e + r / 2,
29
31
  y1: n + 4,
@@ -33,14 +35,14 @@ function oe({ x: e, top: t, bottom: n, width: r }) {
33
35
  });
34
36
  }
35
37
  // packages/charts/src/chart-inspection.tsx
36
- var O = {
38
+ var N = {
37
39
  kzqmXN: "x1xc55vz",
38
40
  kZKoxP: "xdk7pt",
39
41
  kmuXW: "x2lah0s",
40
42
  $$css: !0
41
- }, k = {
43
+ }, P = {
42
44
  swatch: (e) => [
43
- O,
45
+ N,
44
46
  {
45
47
  kWkggS: e == null ? e : "xl8spv7",
46
48
  $$css: !0
@@ -80,75 +82,75 @@ var O = {
80
82
  "--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
81
83
  "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
82
84
  }]
83
- }, se = 4;
84
- function A() {
85
- return /* @__PURE__ */ w("ul", {
85
+ }, oe = 4;
86
+ function se() {
87
+ return /* @__PURE__ */ D("ul", {
86
88
  "aria-hidden": !0,
87
89
  inert: !0,
88
90
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k",
89
- children: Array.from({ length: se }, (e, t) => /* @__PURE__ */ T("li", {
91
+ children: Array.from({ length: oe }, (e, t) => /* @__PURE__ */ O("li", {
90
92
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe x1f394nn x43dure",
91
- children: [/* @__PURE__ */ w("span", { ...y.props(k.swatch(h.line)) }), /* @__PURE__ */ T("span", {
93
+ children: [/* @__PURE__ */ D("span", { ...x.props(P.swatch(_.line)) }), /* @__PURE__ */ O("span", {
92
94
  className: "x1cqoux5 xeuugli",
93
95
  children: [
94
- /* @__PURE__ */ w(n, {}),
95
- /* @__PURE__ */ w("span", {
96
+ /* @__PURE__ */ D(n, {}),
97
+ /* @__PURE__ */ D("span", {
96
98
  className: "x1s85apg xannxpe",
97
- children: /* @__PURE__ */ w(n, {})
99
+ children: /* @__PURE__ */ D(n, {})
98
100
  }),
99
- /* @__PURE__ */ w("span", {
101
+ /* @__PURE__ */ D("span", {
100
102
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
101
- children: /* @__PURE__ */ w(n, {})
103
+ children: /* @__PURE__ */ D(n, {})
102
104
  })
103
105
  ]
104
106
  })]
105
107
  }, t))
106
108
  });
107
109
  }
108
- function ce({ title: e, detail: t }) {
109
- return t === void 0 ? e : /* @__PURE__ */ T("span", {
110
+ function F({ title: e, detail: t }) {
111
+ return t === void 0 ? e : /* @__PURE__ */ O("span", {
110
112
  "aria-label": e,
111
113
  className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
112
- children: [/* @__PURE__ */ w("span", {
114
+ children: [/* @__PURE__ */ D("span", {
113
115
  className: "xt0psk2 x1boff50",
114
116
  children: e
115
- }), /* @__PURE__ */ w("span", {
117
+ }), /* @__PURE__ */ D("span", {
116
118
  className: "x1s85apg xfodcyb",
117
119
  children: t
118
120
  })]
119
121
  });
120
122
  }
121
- function j({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: u, notes: d = [], hasSeriesSummary: f = !1 }) {
123
+ function ce({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [], hasSeriesSummary: f = !1 }) {
122
124
  let p = Math.min(260, s), m = o > s / 2 ? o - p - c : o + c, h = Math.max(0, Math.min(s - p, m)), g = t === void 0 ? [] : [
123
125
  t,
124
126
  n,
125
127
  ...a.map((e) => `${e.label}: ${e.value}`),
126
- ...d
128
+ ...u
127
129
  ].filter((e) => e !== void 0);
128
- return /* @__PURE__ */ T("div", {
130
+ return /* @__PURE__ */ O("div", {
129
131
  className: "xeuugli",
130
132
  children: [
131
- !f && /* @__PURE__ */ T("div", {
133
+ !f && /* @__PURE__ */ O("div", {
132
134
  className: "xrvj5dj xeuugli",
133
- children: [i !== void 0 && /* @__PURE__ */ w("ul", {
135
+ children: [i !== void 0 && /* @__PURE__ */ D("ul", {
134
136
  "aria-hidden": !0,
135
137
  inert: !0,
136
138
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
137
- children: i.map((e) => /* @__PURE__ */ T("li", {
139
+ children: i.map((e) => /* @__PURE__ */ O("li", {
138
140
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
139
- children: [/* @__PURE__ */ w(l, { tone: e.tone }), /* @__PURE__ */ T("span", {
141
+ children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
140
142
  className: "xeuugli",
141
- children: [e.label, /* @__PURE__ */ w("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
143
+ children: [e.label, /* @__PURE__ */ D("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
142
144
  })]
143
145
  }, e.id))
144
- }), /* @__PURE__ */ w("ul", {
146
+ }), /* @__PURE__ */ D("ul", {
145
147
  "aria-label": "Legend",
146
148
  className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
147
- children: r.map((e) => /* @__PURE__ */ T("li", {
149
+ children: r.map((e) => /* @__PURE__ */ O("li", {
148
150
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
149
- children: [/* @__PURE__ */ w(l, { tone: e.tone }), /* @__PURE__ */ T("span", {
151
+ children: [/* @__PURE__ */ D(d, { tone: e.tone }), /* @__PURE__ */ O("span", {
150
152
  className: "xeuugli",
151
- children: [e.label, /* @__PURE__ */ w("span", {
153
+ children: [e.label, /* @__PURE__ */ D("span", {
152
154
  className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
153
155
  children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
154
156
  })]
@@ -156,36 +158,36 @@ function j({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x
156
158
  }, e.id))
157
159
  })]
158
160
  }),
159
- /* @__PURE__ */ w("span", {
161
+ /* @__PURE__ */ D("span", {
160
162
  id: e,
161
- "aria-live": u === "keyboard" ? "polite" : "off",
163
+ "aria-live": l === "keyboard" ? "polite" : "off",
162
164
  className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
163
165
  children: g.join(" · ")
164
166
  }),
165
- t !== void 0 && /* @__PURE__ */ w("div", {
167
+ t !== void 0 && /* @__PURE__ */ D("div", {
166
168
  "aria-hidden": !0,
167
169
  className: "x1n2onr6 xqtp20y x1vjfegm",
168
- children: /* @__PURE__ */ T("div", {
169
- ...y.props(k.inspector, f && k.summaryInspector, k.position(h, p)),
170
+ children: /* @__PURE__ */ O("div", {
171
+ ...x.props(P.inspector, f && P.summaryInspector, P.position(h, p)),
170
172
  children: [
171
- /* @__PURE__ */ T("div", {
173
+ /* @__PURE__ */ O("div", {
172
174
  className: "x78zum5 x1qughib x1hnptsi xk4h15q",
173
- children: [/* @__PURE__ */ w("span", { children: t }), n !== void 0 && /* @__PURE__ */ w("span", { children: n })]
175
+ children: [/* @__PURE__ */ D("span", { children: t }), n !== void 0 && /* @__PURE__ */ D("span", { children: n })]
174
176
  }),
175
- /* @__PURE__ */ w("dl", {
177
+ /* @__PURE__ */ D("dl", {
176
178
  className: "xrvj5dj xunmzkg x1ghz6dp",
177
- children: a.map((e) => /* @__PURE__ */ T("div", {
179
+ children: a.map((e) => /* @__PURE__ */ O("div", {
178
180
  className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
179
- children: [/* @__PURE__ */ T("dt", {
181
+ children: [/* @__PURE__ */ O("dt", {
180
182
  className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
181
- children: [/* @__PURE__ */ w(l, { tone: e.tone }), e.label]
182
- }), /* @__PURE__ */ w("dd", {
183
+ children: [/* @__PURE__ */ D(d, { tone: e.tone }), e.label]
184
+ }), /* @__PURE__ */ D("dd", {
183
185
  className: "x1ghz6dp xuxw1ft",
184
186
  children: e.value
185
187
  })]
186
188
  }, e.id))
187
189
  }),
188
- d.map((e) => /* @__PURE__ */ w("span", { children: e }, e))
190
+ u.map((e) => /* @__PURE__ */ D("span", { children: e }, e))
189
191
  ]
190
192
  })
191
193
  })
@@ -211,27 +213,27 @@ function le({ composition: e, series: t, categoryIds: n, domain: r }) {
211
213
  }
212
214
  }
213
215
  // packages/charts/src/cartesian/composition-bars.tsx
214
- var M = { mark: {
216
+ var ue = { mark: {
215
217
  k3nNDw: "x1hj3fc7",
216
218
  k1ekBW: "xwcsmn1",
217
219
  kIyJzY: "xtitasy x12w9bfk",
218
220
  kAMwcw: "x1faw7qm",
219
221
  $$css: !0
220
222
  } };
221
- function ue({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
223
+ function de({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s, y: c, isHighlighted: l, highlightedSeriesId: u }) {
222
224
  let d = r !== void 0, f = r !== void 0 && !n.some((e) => e.id === r.id) ? [...n, r] : n;
223
225
  function p(e, t) {
224
226
  let n = c(t), r = c(t + e);
225
227
  return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0), Math.abs(r - n))})`;
226
228
  }
227
- return /* @__PURE__ */ T(C, { children: [t.kind !== "gap" && /* @__PURE__ */ w("rect", {
229
+ return /* @__PURE__ */ O(E, { children: [t.kind !== "gap" && /* @__PURE__ */ D("rect", {
228
230
  x: o,
229
231
  y: 0,
230
232
  width: s,
231
233
  height: 1,
232
234
  vectorEffect: "non-scaling-stroke",
233
235
  fill: e.neutral,
234
- ...y.props(M.mark, l && g.selected),
236
+ ...x.props(ue.mark, l && v.selected),
235
237
  style: {
236
238
  transform: p(t.total, 0),
237
239
  opacity: d ? .18 : +(t.kind === "total")
@@ -239,24 +241,24 @@ function ue({ bucket: t, series: n, focusedSeries: r, index: i, x: o, width: s,
239
241
  }), f.map((c, f) => {
240
242
  let m = c.values[i];
241
243
  if (m == null) return null;
242
- let h = r?.id === c.id, ee = d ? 0 : n.slice(0, f).reduce((e, t) => e + (t.values[i] ?? 0), 0), _ = d ? h : t.kind === "parts", v = !d && u !== void 0 && u !== c.id;
243
- return /* @__PURE__ */ w("rect", {
244
+ let h = r?.id === c.id, g = d ? 0 : n.slice(0, f).reduce((e, t) => e + (t.values[i] ?? 0), 0), _ = d ? h : t.kind === "parts", ee = !d && u !== void 0 && u !== c.id;
245
+ return /* @__PURE__ */ D("rect", {
244
246
  x: o,
245
247
  y: 0,
246
248
  width: s,
247
249
  height: 1,
248
250
  vectorEffect: "non-scaling-stroke",
249
251
  fill: e[a(c.tone, f)],
250
- ...y.props(M.mark, l && g.selected),
252
+ ...x.props(ue.mark, l && v.selected),
251
253
  style: {
252
- transform: p(m, ee),
253
- opacity: _ ? v ? .3 : 1 : 0
254
+ transform: p(m, g),
255
+ opacity: _ ? ee ? .3 : 1 : 0
254
256
  }
255
257
  }, c.id);
256
258
  })] });
257
259
  }
258
260
  // packages/charts/src/cartesian/bar-chart.tsx
259
- var N = {
261
+ var I = {
260
262
  plot: {
261
263
  kqGvvJ: "x1we84gm",
262
264
  $$css: !0
@@ -265,80 +267,80 @@ var N = {
265
267
  kSiTet: "xuzhngd",
266
268
  $$css: !0
267
269
  }
268
- }, de = /* @__PURE__ */ new Set(["Enter", " "]), P = 200;
269
- function fe({ title: e, description: t, report: n, series: r, layoutSeries: i, children: o, inspectionId: c, label: l, detail: u, summary: f, rows: p = [], index: m = -1, formatValue: h = String, x: g = 0, width: ee = 0, offset: _, source: v, data: y, isLoading: te = !1 }) {
270
- let b = r.map((e, t) => ({
270
+ }, fe = 200;
271
+ function L({ title: e, description: t, report: n, series: r, layoutSeries: i, children: o, inspectionId: c, label: l, detail: u, summary: d, rows: f = [], index: m = -1, formatValue: h = String, x: g = 0, width: _ = 0, offset: v, source: ee, data: y, isLoading: b = !1 }) {
272
+ let x = r.map((e, t) => ({
271
273
  id: e.id,
272
274
  label: e.label,
273
275
  tone: a(e.tone, t)
274
- })), ne = i?.map((e, t) => ({
276
+ })), te = i?.map((e, t) => ({
275
277
  id: e.id,
276
278
  label: e.label,
277
279
  tone: a(e.tone, t)
278
- })), x = te && r.length === 0 && n?.seriesValues === void 0;
279
- return /* @__PURE__ */ T(d, {
280
- title: /* @__PURE__ */ w(ce, {
280
+ })), S = b && r.length === 0 && n?.seriesValues === void 0;
281
+ return /* @__PURE__ */ O(p, {
282
+ title: /* @__PURE__ */ D(F, {
281
283
  title: e,
282
284
  detail: u
283
285
  }),
284
286
  description: t,
285
287
  report: n,
286
- series: b,
288
+ series: x,
287
289
  children: [
288
- y !== void 0 && /* @__PURE__ */ w(s, { ...y }),
289
- x ? /* @__PURE__ */ w(A, {}) : /* @__PURE__ */ w(j, {
290
+ y !== void 0 && /* @__PURE__ */ D(s, { ...y }),
291
+ S ? /* @__PURE__ */ D(se, {}) : /* @__PURE__ */ D(ce, {
290
292
  id: c,
291
293
  label: l,
292
- summary: f,
293
- legend: b,
294
+ summary: d,
295
+ legend: x,
294
296
  hasSeriesSummary: n?.seriesValues !== void 0,
295
- layoutLegend: ne,
296
- rows: p.map((e, t) => ({
297
+ layoutLegend: te,
298
+ rows: f.map((e, t) => ({
297
299
  id: e.id,
298
300
  label: e.label,
299
301
  tone: a(e.tone, t),
300
302
  value: e.values[m] === null || e.values[m] === void 0 ? "Unavailable" : h(e.values[m])
301
303
  })),
302
304
  x: g,
303
- width: ee,
304
- offset: _,
305
- source: v
305
+ width: _,
306
+ offset: v,
307
+ source: ee
306
308
  }),
307
309
  o
308
310
  ]
309
311
  });
310
312
  }
311
- function F({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = P }) {
312
- let o = I(a), s = b();
313
- return o === void 0 ? /* @__PURE__ */ w("div", {
313
+ function R({ title: e = "Loading chart", description: n, report: r, series: i = [], height: a = fe }) {
314
+ let o = z(a), s = C();
315
+ return o === void 0 ? /* @__PURE__ */ D("div", {
314
316
  "aria-hidden": !0,
315
317
  inert: !0,
316
- children: /* @__PURE__ */ w(fe, {
318
+ children: /* @__PURE__ */ D(L, {
317
319
  title: e,
318
320
  description: n,
319
321
  report: r,
320
322
  series: i,
321
323
  inspectionId: s,
322
324
  isLoading: !0,
323
- children: /* @__PURE__ */ w("div", {
324
- ...y.props(g.plot, N.plot),
325
- children: /* @__PURE__ */ w(t, { height: a })
325
+ children: /* @__PURE__ */ D("div", {
326
+ ...x.props(v.plot, I.plot),
327
+ children: /* @__PURE__ */ D(t, { height: a })
326
328
  })
327
329
  })
328
- }) : /* @__PURE__ */ w(m, {
330
+ }) : /* @__PURE__ */ D(g, {
329
331
  title: e,
330
332
  description: n,
331
333
  report: r,
332
334
  message: o
333
335
  });
334
336
  }
335
- function I(e) {
337
+ function z(e) {
336
338
  if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
337
339
  }
338
- function L({ categories: e, series: t, domain: n, mode: r }) {
340
+ function pe({ categories: e, series: t, domain: n, mode: r }) {
339
341
  if (e.length > i.items || t.length > i.series) return `Choose a window with at most ${i.items} categories and ${i.series} series.`;
340
- if (!p(n) || n[0] > 0 || n[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
341
- if (!f(e) || !f(t)) return "Bar categories and series require unique identifiers.";
342
+ if (!h(n) || n[0] > 0 || n[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
343
+ if (!m(e) || !m(t)) return "Bar categories and series require unique identifiers.";
342
344
  for (let i of t) {
343
345
  if (i.values.length !== e.length) return "Every series requires one explicit value per category.";
344
346
  for (let e of i.values) {
@@ -348,106 +350,85 @@ function L({ categories: e, series: t, domain: n, mode: r }) {
348
350
  }
349
351
  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.";
350
352
  }
351
- var pe = {
353
+ var me = {
352
354
  "x-default-marker": "x-default-marker",
353
355
  $$css: !0
354
356
  };
355
- function me({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: l, formatTick: u = l, highlightedSeriesId: d, selection: f, height: p = P, composition: h }) {
356
- let _ = h?.focusedSeries, v = b(), ne = _ === void 0 ? void 0 : L({
357
+ function B({ title: t, description: n, report: r, categories: i, series: o, domain: s, mode: c = "grouped", formatValue: u, formatTick: d = u, highlightedSeriesId: f, selection: p, height: m = fe, composition: h }) {
358
+ let _ = h?.focusedSeries, y = C(), b = _ === void 0 ? void 0 : pe({
357
359
  categories: i,
358
360
  series: [_],
359
361
  domain: s,
360
362
  mode: "grouped"
361
- }), x = L({
363
+ }), te = pe({
362
364
  categories: i,
363
365
  series: o,
364
366
  domain: s,
365
367
  mode: c
366
- }) ?? ne, C = le({
368
+ }) ?? b, ne = le({
367
369
  composition: h,
368
370
  series: o,
369
371
  categoryIds: i.map((e) => e.id),
370
372
  domain: s
371
- }) ?? I(p), ie = x ?? C, D = h === void 0 ? void 0 : {
372
- id: v,
373
+ }) ?? z(m), w = te ?? ne, E = h === void 0 ? void 0 : {
374
+ id: y,
373
375
  label: h.contextLabel,
374
376
  tone: "neutral",
375
377
  values: h.buckets.map((e) => e.kind === "gap" ? null : e.total)
376
- }, O = D === void 0 ? o : [
377
- D,
378
+ }, k = E === void 0 ? o : [
379
+ E,
378
380
  ...o,
379
381
  ..._ === void 0 || o.some((e) => e.id === _.id) ? [] : [_]
380
- ], k = _ !== void 0 && D !== void 0 ? [_, D] : o, { ref: se, width: A, element: ce } = ee(), j = b(), [M, F] = S(), [me, R] = S();
381
- te(() => {
382
+ ], re = _ !== void 0 && E !== void 0 ? [_, E] : o, { ref: ie, width: N, element: P } = ee(), oe = C(), [se, F] = T(), [ce, ue] = T();
383
+ S(() => {
382
384
  function e(e) {
383
- e.target instanceof Node && ce?.contains(e.target) !== !0 && F(void 0);
385
+ e.target instanceof Node && P?.contains(e.target) !== !0 && F(void 0);
384
386
  }
385
387
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
386
- }, [ce]);
387
- let z = i.findIndex((e) => e.id === M?.id), B = i[z], V = i[i.findIndex((e) => e.id === f?.selectedId)], H = i.find((e) => e.id === me) ?? V ?? i[0], U = i.findIndex((e) => e.id === H?.id), W = B, G = z, K = h?.buckets[G], q = _ !== void 0 && D !== void 0 ? [_, D] : D === void 0 || K?.kind === "parts" ? o : [], ge = K === void 0 ? void 0 : K.kind === "gap" ? "No reported value" : l(K.total);
388
- if (ie !== void 0) return /* @__PURE__ */ w(m, {
388
+ }, [P]);
389
+ let R = i.findIndex((e) => e.id === se?.id), B = i[R], ge = i[i.findIndex((e) => e.id === p?.selectedId)], V = i.find((e) => e.id === ce) ?? ge ?? i[0], H = B, U = R, W = h?.buckets[U], G = _ !== void 0 && E !== void 0 ? [_, E] : E === void 0 || W?.kind === "parts" ? o : [], K = W === void 0 ? void 0 : W.kind === "gap" ? "No reported value" : u(W.total);
390
+ if (w !== void 0) return /* @__PURE__ */ D(g, {
389
391
  title: t,
390
392
  description: n,
391
393
  report: r,
392
- message: ie
394
+ message: w
393
395
  });
394
- let J = p - 28, Y = E({
396
+ let _e = m - 28, q = j({
395
397
  domain: [...s],
396
- range: [J, 12]
397
- }), X = Math.max(44, ...Y.ticks(3).map((e) => u(e).length * 7 + 12)), Z = Math.max(X + 1, A - 16), Q = re({
398
+ range: [_e, 12]
399
+ }), J = Math.max(44, ...q.ticks(3).map((e) => d(e).length * 7 + 12)), Y = Math.max(J + 1, N - 16), X = A({
398
400
  domain: i.map((e) => e.id),
399
- range: [X, Z],
401
+ range: [J, Y],
400
402
  padding: .3
401
- }), _e = re({
403
+ }), Z = A({
402
404
  domain: o.map((e) => e.id),
403
- range: [0, Q.bandwidth()],
405
+ range: [0, X.bandwidth()],
404
406
  padding: .08
405
- }), ve = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), ye = Math.max(1, Math.ceil((ve + 16) / Q.step())), be = Math.max(1, Math.floor((Q.step() * ye - 16) / 7));
406
- function $(e) {
407
- let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * A, r = Math.floor((n - X) / Q.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
408
- a !== void 0 && (e.type === "pointerdown" && R(a.id), F({
407
+ }), ve = Math.min(120, Math.max(40, ...i.map((e) => (e.axisLabel ?? e.label).length * 7))), Q = Math.max(1, Math.ceil((ve + 16) / X.step())), $ = Math.max(1, Math.floor((X.step() * Q - 16) / 7));
408
+ function ye(e) {
409
+ let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * N, r = Math.floor((n - J) / X.step()), a = i[Math.max(0, Math.min(i.length - 1, r))];
410
+ a !== void 0 && (e.type === "pointerdown" && ue(a.id), F({
409
411
  id: a.id,
410
412
  source: "pointer"
411
413
  }));
412
414
  }
413
- function xe(e) {
414
- if (e.altKey || e.ctrlKey || e.metaKey) return;
415
- if (e.key === "Escape") {
416
- e.preventDefault(), e.stopPropagation(), F(void 0);
417
- return;
418
- }
419
- if (de.has(e.key)) {
420
- H !== void 0 && f !== void 0 && (e.preventDefault(), f.onSelect(H.id));
421
- return;
422
- }
423
- let t = {
424
- ArrowRight: Math.min(i.length - 1, U + 1),
425
- ArrowLeft: Math.max(0, U - 1),
426
- Home: 0,
427
- End: i.length - 1
428
- }[e.key], n = t === void 0 ? void 0 : i[t];
429
- n !== void 0 && (e.preventDefault(), R(n.id), F({
430
- id: n.id,
431
- source: "keyboard"
432
- }));
433
- }
434
- return /* @__PURE__ */ w(fe, {
415
+ return /* @__PURE__ */ D(L, {
435
416
  title: t,
436
417
  description: n,
437
418
  report: r,
438
- series: k,
419
+ series: re,
439
420
  layoutSeries: o,
440
- inspectionId: j,
441
- label: W?.label,
442
- detail: W === void 0 ? void 0 : [W.axisLabel ?? W.label, ge].filter(Boolean).join(" · "),
443
- summary: ge,
444
- rows: q,
445
- index: G,
446
- formatValue: l,
447
- x: (Q(W?.id ?? "") ?? X) + Q.bandwidth() / 2,
448
- width: A,
449
- offset: Q.bandwidth() / 2 + 8,
450
- source: M?.source,
421
+ inspectionId: oe,
422
+ label: H?.label,
423
+ detail: H === void 0 ? void 0 : [H.axisLabel ?? H.label, K].filter(Boolean).join(" · "),
424
+ summary: K,
425
+ rows: G,
426
+ index: U,
427
+ formatValue: u,
428
+ x: (X(H?.id ?? "") ?? J) + X.bandwidth() / 2,
429
+ width: N,
430
+ offset: X.bandwidth() / 2 + 8,
431
+ source: se?.source,
451
432
  data: {
452
433
  label: `${t} observations`,
453
434
  columns: [{
@@ -459,109 +440,121 @@ function me({ title: t, description: n, report: r, categories: i, series: o, dom
459
440
  }],
460
441
  rows: i.map((e, t) => ({
461
442
  id: e.id,
462
- values: [e.label, he(O, t, l)]
443
+ values: [e.label, he(k, t, u)]
463
444
  }))
464
445
  },
465
- children: /* @__PURE__ */ w("div", {
466
- ref: se,
467
- ...y.props(g.plot, N.plot),
468
- children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ w("p", {
446
+ children: /* @__PURE__ */ D("div", {
447
+ ref: ie,
448
+ ...x.props(v.plot, I.plot),
449
+ children: i.length === 0 || o.length === 0 && h === void 0 ? /* @__PURE__ */ D("p", {
469
450
  className: "x153jb6y x1ghz6dp xy8obcc",
470
451
  children: "No categories"
471
- }) : /* @__PURE__ */ T("svg", {
452
+ }) : /* @__PURE__ */ O(l, {
472
453
  role: "img",
473
- "aria-label": `${t}. Use arrow keys to inspect categories.${f === void 0 ? "" : " Press Enter to select."}`,
474
- "aria-describedby": j,
454
+ "aria-label": `${t}. Use arrow keys to inspect categories.${p === void 0 ? "" : " Press Enter to select."}`,
455
+ "aria-describedby": oe,
475
456
  tabIndex: 0,
476
- viewBox: `0 0 ${A} ${p}`,
477
- height: p,
478
- onKeyDown: xe,
457
+ viewBox: `0 0 ${N} ${m}`,
458
+ height: m,
459
+ controls: {
460
+ items: i,
461
+ cursor: V?.id,
462
+ inspected: B?.id,
463
+ onInspect: (e) => {
464
+ ue(e), F({
465
+ id: e,
466
+ source: "keyboard"
467
+ });
468
+ },
469
+ onDismiss: () => F(void 0),
470
+ onSelect: p?.onSelect
471
+ },
479
472
  onFocus: (e) => {
480
473
  if (e.currentTarget.matches(":focus-visible")) {
481
- let e = V ?? i[0];
482
- R(e?.id), F(e === void 0 ? void 0 : {
474
+ let e = ge ?? i[0];
475
+ ue(e?.id), F(e === void 0 ? void 0 : {
483
476
  id: e.id,
484
477
  source: "keyboard"
485
478
  });
486
479
  }
487
480
  },
488
481
  onPointerMove: (e) => {
489
- e.pointerType === "mouse" && $(e);
482
+ e.pointerType === "mouse" && ye(e);
490
483
  },
491
- onPointerDown: $,
484
+ onPointerDown: ye,
492
485
  onPointerLeave: (e) => {
493
- e.pointerType === "mouse" && M?.source === "pointer" && F(void 0);
486
+ e.pointerType === "mouse" && se?.source === "pointer" && F(void 0);
494
487
  },
495
488
  onBlur: () => F(void 0),
496
489
  onClick: () => {
497
- B !== void 0 && f?.onSelect(B.id);
490
+ B !== void 0 && p?.onSelect(B.id);
498
491
  },
499
- ...y.props(g.svg, g.inspectable, pe),
492
+ ...x.props(v.svg, v.inspectable, me),
500
493
  children: [
501
- B !== void 0 && /* @__PURE__ */ w("rect", {
502
- x: (Q(B.id) ?? X) - (Q.step() - Q.bandwidth()) / 2,
494
+ B !== void 0 && /* @__PURE__ */ D("rect", {
495
+ x: (X(B.id) ?? J) - (X.step() - X.bandwidth()) / 2,
503
496
  y: 12,
504
- width: Q.step(),
505
- height: J - 12,
497
+ width: X.step(),
498
+ height: _e - 12,
506
499
  className: "x2wnxhi"
507
500
  }),
508
- Y.ticks(3).map((e) => /* @__PURE__ */ T("g", { children: [/* @__PURE__ */ w("line", {
509
- x1: X,
510
- x2: Z,
511
- y1: Y(e),
512
- y2: Y(e),
513
- ...y.props(g.grid)
514
- }), /* @__PURE__ */ w("text", {
515
- x: X - 8,
516
- y: Y(e),
501
+ q.ticks(3).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
502
+ x1: J,
503
+ x2: Y,
504
+ y1: q(e),
505
+ y2: q(e),
506
+ ...x.props(v.grid)
507
+ }), /* @__PURE__ */ D("text", {
508
+ x: J - 8,
509
+ y: q(e),
517
510
  textAnchor: "end",
518
511
  dominantBaseline: "middle",
519
- ...y.props(g.label),
520
- children: u(e)
512
+ ...x.props(v.label),
513
+ children: d(e)
521
514
  })] }, e)),
522
- h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ w("text", {
523
- x: Q(h.annotation.categoryId),
524
- y: Math.max(12, Y(h.annotation.value) - 8),
525
- ...y.props(g.label),
515
+ h?.annotation !== void 0 && i.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ D("text", {
516
+ x: X(h.annotation.categoryId),
517
+ y: Math.max(12, q(h.annotation.value) - 8),
518
+ ...x.props(v.label),
526
519
  children: h.annotation.label
527
520
  }),
528
521
  i.map((t, n) => {
529
522
  let r = t.axisLabel ?? t.label, i = h?.buckets[n];
530
- return /* @__PURE__ */ T("g", { children: [i === void 0 ? o.map((r, i) => {
523
+ return /* @__PURE__ */ O("g", { children: [i === void 0 ? o.map((r, i) => {
531
524
  let s = r.values[n];
532
525
  if (s == null) return null;
533
- let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = Y(l), p = Y(l + s), m = f?.selectedId === t.id || B?.id === t.id;
534
- return /* @__PURE__ */ w(ae, {
535
- x: (Q(t.id) ?? X) + (c === "stacked" ? 0 : _e(r.id) ?? 0),
536
- y: Math.min(u, p),
537
- width: c === "stacked" ? Q.bandwidth() : _e.bandwidth(),
538
- height: Math.max(+(s === 0), Math.abs(p - u)),
526
+ let l = c === "stacked" ? o.slice(0, i).reduce((e, t) => e + (t.values[n] ?? 0), 0) : 0, u = q(l), d = q(l + s), m = p?.selectedId === t.id || B?.id === t.id;
527
+ return /* @__PURE__ */ D(M, {
528
+ x: (X(t.id) ?? J) + (c === "stacked" ? 0 : Z(r.id) ?? 0),
529
+ y: Math.min(u, d),
530
+ width: c === "stacked" ? X.bandwidth() : Z.bandwidth(),
531
+ height: Math.max(+(s === 0), Math.abs(d - u)),
539
532
  fill: e[a(r.tone, i)],
540
- ...y.props(m && g.selected, d !== void 0 && d !== r.id && N.mutedMark)
533
+ ...x.props(m && v.selected, f !== void 0 && f !== r.id && I.mutedMark)
541
534
  }, r.id);
542
- }) : /* @__PURE__ */ w(ue, {
535
+ }) : /* @__PURE__ */ D(de, {
543
536
  bucket: i,
544
537
  series: o,
545
538
  focusedSeries: _,
546
539
  index: n,
547
- x: Q(t.id) ?? X,
548
- width: Q.bandwidth(),
549
- y: Y,
550
- isHighlighted: f?.selectedId === t.id || B?.id === t.id,
551
- highlightedSeriesId: d
552
- }), n % ye === 0 && /* @__PURE__ */ w("text", {
553
- x: (Q(t.id) ?? X) + Q.bandwidth() / 2,
554
- y: p - 4,
540
+ x: X(t.id) ?? J,
541
+ width: X.bandwidth(),
542
+ y: q,
543
+ isHighlighted: p?.selectedId === t.id || B?.id === t.id,
544
+ highlightedSeriesId: f
545
+ }), n % Q === 0 && /* @__PURE__ */ D("text", {
546
+ x: (X(t.id) ?? J) + X.bandwidth() / 2,
547
+ y: m - 4,
555
548
  textAnchor: "middle",
556
- ...y.props(g.label),
557
- children: r.length > be ? `${r.slice(0, be - 1)}…` : r
549
+ ...x.props(v.label),
550
+ children: r.length > $ ? `${r.slice(0, $ - 1)}…` : r
558
551
  })] }, t.id);
559
552
  }),
560
- H !== void 0 && /* @__PURE__ */ w(oe, {
561
- x: (Q(H.id) ?? X) + Q.bandwidth() / 2,
553
+ V !== void 0 && /* @__PURE__ */ D(ae, {
554
+ x: (X(V.id) ?? J) + X.bandwidth() / 2,
562
555
  top: 12,
563
- bottom: J,
564
- width: Math.max(8, Q.bandwidth())
556
+ bottom: _e,
557
+ width: Math.max(8, X.bandwidth())
565
558
  })
566
559
  ]
567
560
  })
@@ -575,12 +568,12 @@ function he(e, t, n) {
575
568
  }).join(" · ");
576
569
  }
577
570
  // packages/charts/src/cartesian/breakdown-bar.tsx
578
- var R = {
571
+ var ge = {
579
572
  kzqmXN: "x5lhr3w",
580
573
  kZKoxP: "x5yr21d",
581
574
  $$css: !0
582
- }, z = { segment: (e, t) => [
583
- R,
575
+ }, V = { segment: (e, t) => [
576
+ ge,
584
577
  {
585
578
  kWkggS: t == null ? t : "xl8spv7",
586
579
  $$css: !0
@@ -590,27 +583,27 @@ var R = {
590
583
  "--x-backgroundColor": t ?? void 0
591
584
  }
592
585
  ] };
593
- function B({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
594
- let f = r(s), p = s.reduce((e, t) => e + (t.value ?? 0), 0), h = 2 ** -52 * Math.max(p, c, 1) * s.length;
595
- return f === void 0 ? !Number.isFinite(c) || c < 0 || p - c > h ? /* @__PURE__ */ w(m, {
586
+ function H({ title: t, report: n, description: i, items: s, total: c, formatValue: l, selection: u }) {
587
+ let d = r(s), f = s.reduce((e, t) => e + (t.value ?? 0), 0), m = 2 ** -52 * Math.max(f, c, 1) * s.length;
588
+ return d === void 0 ? !Number.isFinite(c) || c < 0 || f - c > m ? /* @__PURE__ */ D(g, {
596
589
  title: t,
597
590
  report: n,
598
591
  description: i,
599
592
  message: "The total must be finite and at least the sum of recorded values."
600
- }) : /* @__PURE__ */ w(d, {
593
+ }) : /* @__PURE__ */ D(p, {
601
594
  title: t,
602
595
  report: n,
603
596
  description: i,
604
- children: s.length === 0 ? /* @__PURE__ */ w("p", {
597
+ children: s.length === 0 ? /* @__PURE__ */ D("p", {
605
598
  className: "x153jb6y x1ghz6dp xy8obcc",
606
599
  children: "No values"
607
- }) : /* @__PURE__ */ T(C, { children: [
608
- /* @__PURE__ */ w("div", {
600
+ }) : /* @__PURE__ */ O(E, { children: [
601
+ /* @__PURE__ */ D("div", {
609
602
  "aria-hidden": !0,
610
603
  className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
611
- children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ w("span", { ...y.props(z.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
604
+ children: s.map((t, n) => t.value === null ? null : /* @__PURE__ */ D("span", { ...x.props(V.segment(c === 0 ? 0 : t.value / c * 100, e[a(t.tone, n)])) }, t.id))
612
605
  }),
613
- /* @__PURE__ */ w(o, {
606
+ /* @__PURE__ */ D(o, {
614
607
  items: s.map((e, t) => ({
615
608
  id: e.id,
616
609
  label: e.label,
@@ -619,30 +612,30 @@ function B({ title: t, report: n, description: i, items: s, total: c, formatValu
619
612
  })),
620
613
  selection: u
621
614
  }),
622
- c - p > h && /* @__PURE__ */ T("p", {
615
+ c - f > m && /* @__PURE__ */ O("p", {
623
616
  className: "x153jb6y x1ghz6dp xy8obcc",
624
617
  children: [
625
618
  "Unassigned portion: ",
626
- l(c - p),
619
+ l(c - f),
627
620
  " of ",
628
621
  l(c)
629
622
  ]
630
623
  })
631
624
  ] })
632
- }) : /* @__PURE__ */ w(m, {
625
+ }) : /* @__PURE__ */ D(g, {
633
626
  title: t,
634
627
  report: n,
635
628
  description: i,
636
- message: f
629
+ message: d
637
630
  });
638
631
  }
639
632
  // packages/charts/src/cartesian/scatter-plot.tsx
640
- var V = 260, H = 56, U = 20, W = 12, G = 1e3, K = {
633
+ var U = 260, W = 56, G = 20, K = 12, _e = 1e3, q = {
641
634
  kzqmXN: "x1xc55vz",
642
635
  kZKoxP: "xdk7pt",
643
636
  kaIpWk: "x16rqkct",
644
637
  $$css: !0
645
- }, q = {
638
+ }, J = {
646
639
  brush: {
647
640
  kFalU9: "xx69xxh",
648
641
  kkrTdU: "xsid9ct",
@@ -680,7 +673,7 @@ var V = 260, H = 56, U = 20, W = 12, G = 1e3, K = {
680
673
  "--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
681
674
  }],
682
675
  dot: (e) => [
683
- K,
676
+ q,
684
677
  {
685
678
  kWkggS: e == null ? e : "xl8spv7",
686
679
  $$css: !0
@@ -695,77 +688,77 @@ var V = 260, H = 56, U = 20, W = 12, G = 1e3, K = {
695
688
  $$css: !0
696
689
  }
697
690
  };
698
- function ge(t) {
699
- let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: f, yLabel: p, formatX: h, formatY: g, selection: _, rangeSelection: v, emptyLabel: te } = t, b = c({
691
+ function Y(t) {
692
+ let { title: n, report: r, description: i, points: a, xDomain: o, yDomain: l, xLabel: d, yLabel: m, formatX: h, formatY: _, selection: v, rangeSelection: y, emptyLabel: b } = t, S = u({
700
693
  title: n,
701
- selection: _,
694
+ selection: v,
702
695
  items: a.map((e) => ({
703
696
  id: e.id,
704
- label: `${e.label}, ${f}: ${h(e.x)}, ${p}: ${g(e.y)}`
697
+ label: `${e.label}, ${d}: ${h(e.x)}, ${m}: ${_(e.y)}`
705
698
  }))
706
- }), { ref: ne, width: x } = ee(), S = X(t);
707
- if (S !== null) return /* @__PURE__ */ w(m, {
699
+ }), { ref: C, width: ne } = ee(), w = ve(t);
700
+ if (w !== null) return /* @__PURE__ */ D(g, {
708
701
  title: n,
709
702
  report: r,
710
703
  description: i,
711
- message: S
704
+ message: w
712
705
  });
713
- let C = E({
706
+ let T = j({
714
707
  domain: [...o],
715
- range: [H, Math.max(H, x - U)]
716
- }), re = E({
708
+ range: [W, Math.max(W, ne - G)]
709
+ }), E = j({
717
710
  domain: [...l],
718
- range: [216, W]
711
+ range: [216, K]
719
712
  });
720
- return /* @__PURE__ */ T(d, {
713
+ return /* @__PURE__ */ O(p, {
721
714
  title: n,
722
715
  report: r,
723
716
  description: i,
724
- footer: /* @__PURE__ */ w(u, {
725
- id: b.id,
726
- children: b.label ?? "\xA0"
717
+ footer: /* @__PURE__ */ D(f, {
718
+ id: S.id,
719
+ children: S.label ?? "\xA0"
727
720
  }),
728
721
  children: [
729
- a.length === 0 ? /* @__PURE__ */ w("p", {
722
+ a.length === 0 ? /* @__PURE__ */ D("p", {
730
723
  className: "x1ghz6dp x153jb6y",
731
- children: te
732
- }) : /* @__PURE__ */ T("div", {
733
- ref: ne,
734
- ...b.props,
724
+ children: b
725
+ }) : /* @__PURE__ */ O(c, {
726
+ ref: C,
727
+ ...S.props,
735
728
  className: "x1n2onr6 xeuugli",
736
- children: [/* @__PURE__ */ w(J, {
737
- width: x,
738
- scaleX: C,
739
- scaleY: re,
729
+ children: [/* @__PURE__ */ D(X, {
730
+ width: ne,
731
+ scaleX: T,
732
+ scaleY: E,
740
733
  ...t
741
- }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${x}`), a.length > 0 && /* @__PURE__ */ w("div", {
734
+ }, `${o[0]}:${o[1]}:${l[0]}:${l[1]}:${ne}`), a.length > 0 && /* @__PURE__ */ D("div", {
742
735
  className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
743
736
  children: a.map((t) => {
744
- let n = b.label !== void 0 && b.activeId === t.id;
745
- return /* @__PURE__ */ w("button", {
737
+ let n = S.label !== void 0 && S.activeId === t.id;
738
+ return /* @__PURE__ */ D(te, {
746
739
  type: "button",
747
740
  tabIndex: -1,
748
- onPointerEnter: () => b.inspect(t.id),
741
+ onPointerEnter: () => S.inspect(t.id),
749
742
  title: t.label,
750
- "aria-label": `${t.label}, ${f}: ${h(t.x)}, ${p}: ${g(t.y)}`,
751
- "aria-pressed": _ === void 0 ? void 0 : _.selectedId === t.id,
743
+ "aria-label": `${t.label}, ${d}: ${h(t.x)}, ${m}: ${_(t.y)}`,
744
+ "aria-pressed": v === void 0 ? void 0 : v.selectedId === t.id,
752
745
  onClick: () => {
753
- b.inspect(t.id), _?.onSelect(t.id);
746
+ S.inspect(t.id), v?.onSelect(t.id);
754
747
  },
755
- ...y.props(q.target, q.location(C(t.x), re(t.y))),
756
- children: /* @__PURE__ */ w("span", {
748
+ ...x.props(J.target, J.location(T(t.x), E(t.y))),
749
+ children: /* @__PURE__ */ D("span", {
757
750
  "aria-hidden": !0,
758
- ...y.props(q.dot(e[t.tone]), (_?.selectedId === t.id || n) && q.selected)
751
+ ...x.props(J.dot(e[t.tone]), (v?.selectedId === t.id || n) && J.selected)
759
752
  })
760
753
  }, t.id);
761
754
  })
762
755
  })]
763
756
  }),
764
- v !== void 0 && /* @__PURE__ */ w(Y, {
757
+ y !== void 0 && /* @__PURE__ */ D(Z, {
765
758
  ...t,
766
- rangeSelection: v
759
+ rangeSelection: y
767
760
  }),
768
- /* @__PURE__ */ w(s, {
761
+ /* @__PURE__ */ D(s, {
769
762
  label: `${n} points`,
770
763
  columns: [
771
764
  {
@@ -774,11 +767,11 @@ function ge(t) {
774
767
  },
775
768
  {
776
769
  id: "x",
777
- label: f
770
+ label: d
778
771
  },
779
772
  {
780
773
  id: "y",
781
- label: p
774
+ label: m
782
775
  }
783
776
  ],
784
777
  rows: a.map((e) => ({
@@ -786,202 +779,197 @@ function ge(t) {
786
779
  values: [
787
780
  e.label,
788
781
  h(e.x),
789
- g(e.y)
782
+ _(e.y)
790
783
  ]
791
784
  }))
792
785
  })
793
786
  ]
794
787
  });
795
788
  }
796
- function J({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
797
- let c = b(), [l, u] = S(null), d = l === null ? s?.value : {
789
+ function X({ width: e, scaleX: t, scaleY: n, xLabel: r, yLabel: i, formatX: a, formatY: o, rangeSelection: s }) {
790
+ let c = C(), [l, u] = T(null), d = w(null);
791
+ S(() => () => d.current?.(), []);
792
+ let f = l === null ? s?.value : {
798
793
  x: [Math.min(l.start.x, l.end.x), Math.max(l.start.x, l.end.x)],
799
794
  y: [Math.min(l.start.y, l.end.y), Math.max(l.start.y, l.end.y)]
800
795
  };
801
- function f(r) {
802
- let i = r.currentTarget.getBoundingClientRect();
796
+ function p(r, i, a) {
803
797
  return {
804
- x: t.copy().clamp(!0).invert((r.clientX - i.left) / i.width * e),
805
- y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height * V)
798
+ x: t.copy().clamp(!0).invert((i - r.left) / r.width * e),
799
+ y: n.copy().clamp(!0).invert((a - r.top) / r.height * U)
806
800
  };
807
801
  }
808
- function p(t) {
809
- if (s === void 0 || t.button !== 0 || t.pointerType === "touch") return;
810
- let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * V;
811
- if (r < H || r > e - U || i < W || i > 216) return;
812
- let a = f(t);
813
- t.currentTarget.setPointerCapture(t.pointerId), u({
814
- start: a,
815
- end: a,
816
- pointerId: t.pointerId
817
- });
818
- }
819
- function m(e) {
820
- l !== null && l.pointerId === e.pointerId && u({
821
- ...l,
822
- end: f(e)
802
+ function m(t) {
803
+ let n = t.button === 0 && t.pointerType !== "touch";
804
+ if (s === void 0 || d.current !== null || !n) return;
805
+ let r = t.currentTarget.getBoundingClientRect(), i = (t.clientX - r.left) / r.width * e, a = (t.clientY - r.top) / r.height * U;
806
+ if (i < W || i > e - G || a < K || a > 216) return;
807
+ let o = t.currentTarget, c = o.parentElement;
808
+ if (c === null) return;
809
+ let l = p(r, t.clientX, t.clientY);
810
+ u({
811
+ start: l,
812
+ end: l
813
+ }), d.current = k(c, t.nativeEvent, {
814
+ cancelOnEscape: !0,
815
+ onMove: ({ x: e, y: t }) => u({
816
+ start: l,
817
+ end: p(o.getBoundingClientRect(), e, t)
818
+ }),
819
+ onEnd: (e, t) => {
820
+ if (d.current = null, u(null), t) return;
821
+ let n = p(o.getBoundingClientRect(), e.clientX, e.clientY);
822
+ s.onChange({
823
+ x: [Math.min(l.x, n.x), Math.max(l.x, n.x)],
824
+ y: [Math.min(l.y, n.y), Math.max(l.y, n.y)]
825
+ });
826
+ }
823
827
  });
824
828
  }
825
- function h(e) {
826
- if (l === null || l.pointerId !== e.pointerId) return;
827
- let t = f(e), n = {
828
- x: [Math.min(l.start.x, t.x), Math.max(l.start.x, t.x)],
829
- y: [Math.min(l.start.y, t.y), Math.max(l.start.y, t.y)]
830
- };
831
- u(null), e.currentTarget.releasePointerCapture(e.pointerId), s?.onChange(n);
832
- }
833
- return /* @__PURE__ */ T("svg", {
829
+ return /* @__PURE__ */ O("svg", {
834
830
  width: e,
835
- height: V,
836
- viewBox: `0 0 ${e} ${V}`,
831
+ height: U,
832
+ viewBox: `0 0 ${e} ${U}`,
837
833
  "aria-hidden": !0,
838
- onPointerDown: p,
839
- onPointerMove: m,
840
- onPointerUp: h,
841
- onPointerCancel: () => u(null),
842
- onLostPointerCapture: () => u(null),
843
- ...y.props(g.svg, s !== void 0 && q.brush),
834
+ onPointerDown: m,
835
+ ...x.props(v.svg, s !== void 0 && J.brush),
844
836
  children: [
845
- /* @__PURE__ */ w("defs", { children: /* @__PURE__ */ w("clipPath", {
837
+ /* @__PURE__ */ D("defs", { children: /* @__PURE__ */ D("clipPath", {
846
838
  id: c,
847
- children: /* @__PURE__ */ w("rect", {
848
- x: H,
849
- y: W,
850
- width: Math.max(0, e - H - U),
839
+ children: /* @__PURE__ */ D("rect", {
840
+ x: W,
841
+ y: K,
842
+ width: Math.max(0, e - W - G),
851
843
  height: 204
852
844
  })
853
845
  }) }),
854
- t.ticks(5).map((e) => /* @__PURE__ */ T("g", { children: [/* @__PURE__ */ w("line", {
846
+ t.ticks(5).map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
855
847
  x1: t(e),
856
848
  x2: t(e),
857
- y1: W,
849
+ y1: K,
858
850
  y2: 216,
859
- ...y.props(g.grid)
860
- }), /* @__PURE__ */ w("text", {
851
+ ...x.props(v.grid)
852
+ }), /* @__PURE__ */ D("text", {
861
853
  x: t(e),
862
854
  y: 234,
863
855
  textAnchor: "middle",
864
- ...y.props(g.label),
856
+ ...x.props(v.label),
865
857
  children: a(e)
866
858
  })] }, e)),
867
- n.ticks(4).map((t) => /* @__PURE__ */ T("g", { children: [/* @__PURE__ */ w("line", {
868
- x1: H,
869
- x2: e - U,
859
+ n.ticks(4).map((t) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
860
+ x1: W,
861
+ x2: e - G,
870
862
  y1: n(t),
871
863
  y2: n(t),
872
- ...y.props(g.grid)
873
- }), /* @__PURE__ */ w("text", {
864
+ ...x.props(v.grid)
865
+ }), /* @__PURE__ */ D("text", {
874
866
  x: 48,
875
867
  y: n(t) + 4,
876
868
  textAnchor: "end",
877
- ...y.props(g.label),
869
+ ...x.props(v.label),
878
870
  children: o(t)
879
871
  })] }, t)),
880
- /* @__PURE__ */ w("text", {
881
- x: (H + e - U) / 2,
872
+ /* @__PURE__ */ D("text", {
873
+ x: (W + e - G) / 2,
882
874
  y: 256,
883
875
  textAnchor: "middle",
884
- ...y.props(g.label),
876
+ ...x.props(v.label),
885
877
  children: r
886
878
  }),
887
- /* @__PURE__ */ w("text", {
879
+ /* @__PURE__ */ D("text", {
888
880
  x: 12,
889
881
  y: 108,
890
882
  textAnchor: "middle",
891
883
  transform: "rotate(-90 12 108)",
892
- ...y.props(g.label),
884
+ ...x.props(v.label),
893
885
  children: i
894
886
  }),
895
- /* @__PURE__ */ w("g", {
887
+ /* @__PURE__ */ D("g", {
896
888
  clipPath: `url(#${c})`,
897
- children: d != null && /* @__PURE__ */ w("rect", {
898
- x: t(d.x[0]),
899
- y: n(d.y[1]),
900
- width: t(d.x[1]) - t(d.x[0]),
901
- height: n(d.y[0]) - n(d.y[1]),
889
+ children: f != null && /* @__PURE__ */ D("rect", {
890
+ x: t(f.x[0]),
891
+ y: n(f.y[1]),
892
+ width: t(f.x[1]) - t(f.x[0]),
893
+ height: n(f.y[0]) - n(f.y[1]),
902
894
  className: "x1e0kj8g xv7c1pl x1tg5nk6 xnpr05h x15lqr97 x47corl"
903
895
  })
904
896
  })
905
897
  ]
906
898
  });
907
899
  }
908
- function Y({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
900
+ function Z({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
909
901
  let s = e.value ?? {
910
902
  x: t,
911
903
  y: n
912
904
  };
913
- return /* @__PURE__ */ T("fieldset", {
905
+ return /* @__PURE__ */ O("fieldset", {
914
906
  className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
915
907
  children: [
916
- /* @__PURE__ */ w("legend", {
908
+ /* @__PURE__ */ D("legend", {
917
909
  className: "x153jb6y xy8obcc x1jfksii",
918
910
  children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
919
911
  }),
920
- /* @__PURE__ */ T(v.Root, {
921
- value: s.x,
912
+ /* @__PURE__ */ O(b.Root, {
913
+ value: [...s.x],
914
+ format: a,
922
915
  min: t[0],
923
916
  max: t[1],
924
917
  step: e.xStep,
925
918
  locale: e.locale,
926
- thumbCollisionBehavior: "none",
927
919
  onValueChange: (t) => e.onChange({
928
920
  x: t,
929
921
  y: s.y
930
922
  }),
931
- children: [/* @__PURE__ */ T("div", {
923
+ children: [/* @__PURE__ */ O("div", {
932
924
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
933
- children: [/* @__PURE__ */ w(v.Label, { children: r }), /* @__PURE__ */ T("span", { children: [
925
+ children: [/* @__PURE__ */ D(b.Label, { children: r }), /* @__PURE__ */ O("span", { children: [
934
926
  a(s.x[0]),
935
927
  " – ",
936
928
  a(s.x[1])
937
929
  ] })]
938
- }), /* @__PURE__ */ w(v.Control, { children: /* @__PURE__ */ T(v.Track, { children: [
939
- /* @__PURE__ */ w(v.Indicator, {}),
940
- /* @__PURE__ */ w(v.Thumb, {
930
+ }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
931
+ /* @__PURE__ */ D(b.Indicator, {}),
932
+ /* @__PURE__ */ D(b.Thumb, {
941
933
  index: 0,
942
- "aria-label": `${r} minimum`,
943
- getAriaValueText: (e, t) => a(t)
934
+ "aria-label": `${r} minimum`
944
935
  }),
945
- /* @__PURE__ */ w(v.Thumb, {
936
+ /* @__PURE__ */ D(b.Thumb, {
946
937
  index: 1,
947
- "aria-label": `${r} maximum`,
948
- getAriaValueText: (e, t) => a(t)
938
+ "aria-label": `${r} maximum`
949
939
  })
950
940
  ] }) })]
951
941
  }),
952
- /* @__PURE__ */ T(v.Root, {
953
- value: s.y,
942
+ /* @__PURE__ */ O(b.Root, {
943
+ value: [...s.y],
944
+ format: o,
954
945
  min: n[0],
955
946
  max: n[1],
956
947
  step: e.yStep,
957
948
  locale: e.locale,
958
- thumbCollisionBehavior: "none",
959
949
  onValueChange: (t) => e.onChange({
960
950
  x: s.x,
961
951
  y: t
962
952
  }),
963
- children: [/* @__PURE__ */ T("div", {
953
+ children: [/* @__PURE__ */ O("div", {
964
954
  className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
965
- children: [/* @__PURE__ */ w(v.Label, { children: i }), /* @__PURE__ */ T("span", { children: [
955
+ children: [/* @__PURE__ */ D(b.Label, { children: i }), /* @__PURE__ */ O("span", { children: [
966
956
  o(s.y[0]),
967
957
  " – ",
968
958
  o(s.y[1])
969
959
  ] })]
970
- }), /* @__PURE__ */ w(v.Control, { children: /* @__PURE__ */ T(v.Track, { children: [
971
- /* @__PURE__ */ w(v.Indicator, {}),
972
- /* @__PURE__ */ w(v.Thumb, {
960
+ }), /* @__PURE__ */ D(b.Control, { children: /* @__PURE__ */ O(b.Track, { children: [
961
+ /* @__PURE__ */ D(b.Indicator, {}),
962
+ /* @__PURE__ */ D(b.Thumb, {
973
963
  index: 0,
974
- "aria-label": `${i} minimum`,
975
- getAriaValueText: (e, t) => o(t)
964
+ "aria-label": `${i} minimum`
976
965
  }),
977
- /* @__PURE__ */ w(v.Thumb, {
966
+ /* @__PURE__ */ D(b.Thumb, {
978
967
  index: 1,
979
- "aria-label": `${i} maximum`,
980
- getAriaValueText: (e, t) => o(t)
968
+ "aria-label": `${i} maximum`
981
969
  })
982
970
  ] }) })]
983
971
  }),
984
- /* @__PURE__ */ w(_, {
972
+ /* @__PURE__ */ D(y, {
985
973
  type: "button",
986
974
  disabled: e.value === null,
987
975
  onClick: () => e.onChange(null),
@@ -990,10 +978,10 @@ function Y({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
990
978
  ]
991
979
  });
992
980
  }
993
- function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
994
- if (!p(t) || !p(n)) return "Scatter domains must contain finite, increasing endpoints.";
995
- if (e.length > 1e3) return `This plot exceeds the ${G}-point render limit. Supply a smaller, labelled sample.`;
996
- if (!f(e)) return "Scatter points must have unique identifiers.";
981
+ function ve({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
982
+ if (!h(t) || !h(n)) return "Scatter domains must contain finite, increasing endpoints.";
983
+ if (e.length > 1e3) return `This plot exceeds the ${_e}-point render limit. Supply a smaller, labelled sample.`;
984
+ if (!m(e)) return "Scatter points must have unique identifiers.";
997
985
  if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
998
986
  if (e.some((e) => {
999
987
  let r = e.x < t[0] || e.x > t[1], i = e.y < n[0] || e.y > n[1];
@@ -1003,18 +991,18 @@ function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
1003
991
  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];
1004
992
  if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
1005
993
  let o = r.value;
1006
- return o === null ? null : !Z(o.x, t) || !Z(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
994
+ return o === null ? null : !Q(o.x, t) || !Q(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
1007
995
  }
1008
- function Z(e, t) {
996
+ function Q(e, t) {
1009
997
  return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
1010
998
  }
1011
999
  // packages/charts/src/cartesian/time-series-data.ts
1012
- var Q = {
1000
+ var $ = {
1013
1001
  series: 12,
1014
1002
  pointsPerSeries: 2e3,
1015
1003
  markers: 200,
1016
1004
  panels: 12
1017
- }, _e = .01, ve = [
1005
+ }, ye = .01, be = [
1018
1006
  "series1",
1019
1007
  "series2",
1020
1008
  "series3",
@@ -1022,13 +1010,13 @@ var Q = {
1022
1010
  "series5",
1023
1011
  "series6"
1024
1012
  ];
1025
- function ye({ series: e, isStacked: t, markers: n }) {
1013
+ function xe({ series: e, isStacked: t, markers: n }) {
1026
1014
  let r = e[0]?.points.map((e) => e.timestamp) ?? [];
1027
- if (e.length > Q.series || r.length > Q.pointsPerSeries || n.length > Q.markers) return `Choose a window with at most ${Q.series} series, ${Q.pointsPerSeries} observations per series, and ${Q.markers} markers.`;
1028
- if (!f(e) || !f(n)) return "Series and markers require unique identifiers.";
1015
+ if (e.length > $.series || r.length > $.pointsPerSeries || n.length > $.markers) return `Choose a window with at most ${$.series} series, ${$.pointsPerSeries} observations per series, and ${$.markers} markers.`;
1016
+ if (!m(e) || !m(n)) return "Series and markers require unique identifiers.";
1029
1017
  for (let n of e) {
1030
1018
  if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
1031
- let e = Se({
1019
+ let e = Te({
1032
1020
  points: n.points,
1033
1021
  timestamps: r,
1034
1022
  isStacked: t
@@ -1046,7 +1034,7 @@ function ye({ series: e, isStacked: t, markers: n }) {
1046
1034
  if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
1047
1035
  if (t && r.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
1048
1036
  }
1049
- function be({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1037
+ function Se({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1050
1038
  return JSON.stringify([
1051
1039
  n,
1052
1040
  r,
@@ -1066,15 +1054,15 @@ function be({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
1066
1054
  ])
1067
1055
  ]);
1068
1056
  }
1069
- function $(e, t, n = !1) {
1057
+ function Ce(e, t, n = !1) {
1070
1058
  if (e !== t) return [e, t];
1071
- let r = Math.max(1, Math.abs(e) * _e), i = n ? 0 : e - r, a = t + r;
1059
+ let r = Math.max(1, Math.abs(e) * ye), i = n ? 0 : e - r, a = t + r;
1072
1060
  return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
1073
1061
  }
1074
- function xe(e, t) {
1062
+ function we(e, t) {
1075
1063
  let n = e.filter((e) => e.tone === void 0);
1076
1064
  return e.map((r, i) => {
1077
- let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? ve[a % ve.length] ?? "series1", s = r.points.map((n, r) => {
1065
+ let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? be[a % be.length] ?? "series1", s = r.points.map((n, r) => {
1078
1066
  let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
1079
1067
  return {
1080
1068
  ...n,
@@ -1089,7 +1077,7 @@ function xe(e, t) {
1089
1077
  };
1090
1078
  });
1091
1079
  }
1092
- function Se({ points: e, timestamps: t, isStacked: n }) {
1080
+ function Te({ points: e, timestamps: t, isStacked: n }) {
1093
1081
  for (let [r, i] of e.entries()) {
1094
1082
  let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
1095
1083
  if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
@@ -1098,19 +1086,19 @@ function Se({ points: e, timestamps: t, isStacked: n }) {
1098
1086
  }
1099
1087
  }
1100
1088
  // packages/charts/src/cartesian/time-series-line.tsx
1101
- function Ce({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1102
- return /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(D, {
1089
+ function Ee({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }) {
1090
+ return /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(ie, {
1103
1091
  data: [...t.points],
1104
1092
  defined: (e) => e.value !== null,
1105
1093
  x: (e) => n(e.timestamp),
1106
1094
  y: (e) => r((e.value ?? 0) + e.base),
1107
1095
  stroke: e[t.tone],
1108
- ...y.props(g.mark)
1096
+ ...x.props(v.mark)
1109
1097
  }), t.points.filter((e, n) => {
1110
1098
  if (e.value === null) return !1;
1111
1099
  let r = t.points[n - 1]?.value === null || t.points[n + 1]?.value === null;
1112
1100
  return t.points.length === 1 || r || e.timestamp === i;
1113
- }).map((i) => /* @__PURE__ */ w("circle", {
1101
+ }).map((i) => /* @__PURE__ */ D("circle", {
1114
1102
  cx: n(i.timestamp),
1115
1103
  cy: r((i.value ?? 0) + i.base),
1116
1104
  r: a,
@@ -1118,29 +1106,29 @@ function Ce({ series: t, x: n, y: r, inspectedTimestamp: i, pointRadius: a = 3 }
1118
1106
  }, i.timestamp))] });
1119
1107
  }
1120
1108
  // packages/charts/src/cartesian/sparkline.tsx
1121
- function we({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
1122
- let o = b(), s = b(), c = Te({
1109
+ function De({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
1110
+ let o = C(), s = C(), c = Oe({
1123
1111
  title: e,
1124
1112
  summary: t,
1125
1113
  unit: n,
1126
1114
  series: i,
1127
1115
  valueDomain: a
1128
1116
  }), l = i.points.some((e) => e.value !== null);
1129
- if (c !== void 0 || !l) return /* @__PURE__ */ w("span", {
1117
+ if (c !== void 0 || !l) return /* @__PURE__ */ D("span", {
1130
1118
  role: "img",
1131
1119
  "aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
1132
1120
  title: c ?? "No recorded values",
1133
1121
  className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
1134
1122
  children: c === void 0 ? "No data" : "Invalid trend"
1135
1123
  });
1136
- let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = E({
1137
- domain: [...$(u, d)],
1124
+ let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = j({
1125
+ domain: [...Ce(u, d)],
1138
1126
  range: [3, 125]
1139
- }), p = E({
1127
+ }), p = j({
1140
1128
  domain: [...a],
1141
1129
  range: [29, 3]
1142
- }), m = xe([i], !1)[0];
1143
- return /* @__PURE__ */ T("svg", {
1130
+ }), m = we([i], !1)[0];
1131
+ return /* @__PURE__ */ O("svg", {
1144
1132
  role: "img",
1145
1133
  "aria-labelledby": o,
1146
1134
  "aria-describedby": s,
@@ -1150,11 +1138,11 @@ function we({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
1150
1138
  height: 32,
1151
1139
  className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz",
1152
1140
  children: [
1153
- /* @__PURE__ */ w("title", {
1141
+ /* @__PURE__ */ D("title", {
1154
1142
  id: o,
1155
1143
  children: e
1156
1144
  }),
1157
- /* @__PURE__ */ T("desc", {
1145
+ /* @__PURE__ */ O("desc", {
1158
1146
  id: s,
1159
1147
  children: [
1160
1148
  t,
@@ -1172,7 +1160,7 @@ function we({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
1172
1160
  "."
1173
1161
  ]
1174
1162
  }),
1175
- m !== void 0 && /* @__PURE__ */ w(Ce, {
1163
+ m !== void 0 && /* @__PURE__ */ D(Ee, {
1176
1164
  series: m,
1177
1165
  x: f,
1178
1166
  y: p,
@@ -1181,10 +1169,10 @@ function we({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
1181
1169
  ]
1182
1170
  });
1183
1171
  }
1184
- function Te({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
1172
+ function Oe({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
1185
1173
  if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
1186
- if (!p(i)) return "The displayed value domain must have finite, increasing bounds.";
1187
- let a = ye({
1174
+ if (!h(i)) return "The displayed value domain must have finite, increasing bounds.";
1175
+ let a = xe({
1188
1176
  series: [r],
1189
1177
  isStacked: !1,
1190
1178
  markers: []
@@ -1193,7 +1181,7 @@ function Te({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
1193
1181
  if (r.points.some((e) => e.value !== null && (e.value < i[0] || e.value > i[1]))) return "Every recorded value must be inside the declared value domain.";
1194
1182
  }
1195
1183
  // packages/charts/src/cartesian/time-series.tsx
1196
- var Ee = {
1184
+ var ke = {
1197
1185
  timeAxis: {
1198
1186
  k1xSpc: "x78zum5",
1199
1187
  kjj79g: "x1qughib",
@@ -1214,46 +1202,46 @@ var Ee = {
1214
1202
  "--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
1215
1203
  }]
1216
1204
  };
1217
- function De(e) {
1218
- return /* @__PURE__ */ w(Pe, {
1205
+ function Ae(e) {
1206
+ return /* @__PURE__ */ D(Le, {
1219
1207
  ...e,
1220
1208
  kind: "line",
1221
1209
  isStacked: !1
1222
1210
  });
1223
1211
  }
1224
- function Oe({ isStacked: e = !1, ...t }) {
1225
- return /* @__PURE__ */ w(Pe, {
1212
+ function je({ isStacked: e = !1, ...t }) {
1213
+ return /* @__PURE__ */ D(Le, {
1226
1214
  ...t,
1227
1215
  kind: "area",
1228
1216
  isStacked: e
1229
1217
  });
1230
1218
  }
1231
- function ke(e) {
1232
- return /* @__PURE__ */ w(Ae, { ...e });
1219
+ function Me(e) {
1220
+ return /* @__PURE__ */ D(Ne, { ...e });
1233
1221
  }
1234
- function Ae({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
1235
- let l = b(), u = xe(i.map((e) => ({
1222
+ function Ne({ title: e, description: r, series: i, actions: a, report: o, height: s = 180, showTimeAxis: c = !0 }) {
1223
+ let l = C(), u = we(i.map((e) => ({
1236
1224
  ...e,
1237
1225
  points: []
1238
1226
  })), !1);
1239
- return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ w(m, {
1227
+ return !Number.isFinite(s) || s < 48 ? /* @__PURE__ */ D(g, {
1240
1228
  title: e,
1241
1229
  description: r,
1242
1230
  report: o,
1243
1231
  message: "Chart height must be at least 48 pixels."
1244
- }) : /* @__PURE__ */ w("div", {
1232
+ }) : /* @__PURE__ */ D("div", {
1245
1233
  "aria-hidden": !0,
1246
1234
  inert: !0,
1247
1235
  className: "xeuugli",
1248
- children: /* @__PURE__ */ w(d, {
1236
+ children: /* @__PURE__ */ D(p, {
1249
1237
  title: e,
1250
1238
  description: r,
1251
1239
  report: o,
1252
1240
  series: u,
1253
1241
  actions: a,
1254
- children: /* @__PURE__ */ T("div", {
1242
+ children: /* @__PURE__ */ O("div", {
1255
1243
  className: "xrvj5dj x1n8ia3y",
1256
- children: [/* @__PURE__ */ w(j, {
1244
+ children: [/* @__PURE__ */ D(ce, {
1257
1245
  id: l,
1258
1246
  label: void 0,
1259
1247
  legend: u,
@@ -1262,61 +1250,61 @@ function Ae({ title: e, description: r, series: i, actions: a, report: o, height
1262
1250
  width: 0,
1263
1251
  source: void 0,
1264
1252
  hasSeriesSummary: o?.seriesValues !== void 0
1265
- }), /* @__PURE__ */ T("div", {
1266
- ...y.props(g.plot),
1267
- children: [/* @__PURE__ */ w(t, { height: s - 16 }), c && /* @__PURE__ */ T("div", {
1253
+ }), /* @__PURE__ */ O("div", {
1254
+ ...x.props(v.plot),
1255
+ children: [/* @__PURE__ */ D(t, { height: s - 16 }), c && /* @__PURE__ */ O("div", {
1268
1256
  className: "x78zum5 x1qughib x8zbtdt x1c87qhr xy8obcc xas2l8k x153jb6y xss6m8b",
1269
- children: [/* @__PURE__ */ w(n, { width: "8ch" }), /* @__PURE__ */ w(n, { width: "8ch" })]
1257
+ children: [/* @__PURE__ */ D(n, { width: "8ch" }), /* @__PURE__ */ D(n, { width: "8ch" })]
1270
1258
  })]
1271
1259
  })]
1272
1260
  })
1273
1261
  })
1274
1262
  });
1275
1263
  }
1276
- function je({ charts: e, ...t }) {
1277
- let n = x(null), [r, i] = S(), a = JSON.stringify(e.map((e) => [
1264
+ function Pe({ charts: e, ...t }) {
1265
+ let n = w(null), [r, i] = T(), a = JSON.stringify(e.map((e) => [
1278
1266
  e.id,
1279
1267
  e.title,
1280
- be({
1268
+ Se({
1281
1269
  series: e.series,
1282
1270
  markers: e.markers ?? [],
1283
1271
  timestampUnit: t.timestampUnit,
1284
1272
  isStacked: !1
1285
1273
  })
1286
1274
  ])), 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);
1287
- if (r !== void 0 && r.signature !== a && i(void 0), te(() => {
1275
+ if (r !== void 0 && r.signature !== a && i(void 0), S(() => {
1288
1276
  function e(e) {
1289
1277
  e.target instanceof Node && n.current?.contains(e.target) !== !0 && i(void 0);
1290
1278
  }
1291
1279
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1292
- }, []), !s || !f(e)) return /* @__PURE__ */ w(m, {
1280
+ }, []), !s || !m(e)) return /* @__PURE__ */ D(g, {
1293
1281
  title: "Small multiples",
1294
1282
  message: "Charts need unique identifiers and aligned observation timestamps."
1295
1283
  });
1296
- if (e.length > Q.panels) return /* @__PURE__ */ w(m, {
1284
+ if (e.length > $.panels) return /* @__PURE__ */ D(g, {
1297
1285
  title: "Small multiples",
1298
- message: `Choose at most ${Q.panels} panels.`
1286
+ message: `Choose at most ${$.panels} panels.`
1299
1287
  });
1300
- if (e.length === 0) return /* @__PURE__ */ w(d, {
1288
+ if (e.length === 0) return /* @__PURE__ */ D(p, {
1301
1289
  title: "Small multiples",
1302
- children: /* @__PURE__ */ w("p", {
1290
+ children: /* @__PURE__ */ D("p", {
1303
1291
  className: "x153jb6y",
1304
1292
  children: "No charts"
1305
1293
  })
1306
1294
  });
1307
1295
  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);
1308
- return /* @__PURE__ */ w("div", {
1296
+ return /* @__PURE__ */ D("div", {
1309
1297
  ref: n,
1310
1298
  ...{
1311
1299
  0: { className: "xrvj5dj x1j825kq" },
1312
1300
  1: { className: "xrvj5dj xxhr3t" }
1313
1301
  }[!!l | 0],
1314
- children: e.map((n, o) => /* @__PURE__ */ w("div", {
1302
+ children: e.map((n, o) => /* @__PURE__ */ D("div", {
1315
1303
  ...{
1316
1304
  0: {},
1317
1305
  1: { className: "x1y332i5" }
1318
1306
  }[!!(l && o > 0) | 0],
1319
- children: /* @__PURE__ */ w(Pe, {
1307
+ children: /* @__PURE__ */ D(Le, {
1320
1308
  ...t,
1321
1309
  title: n.title,
1322
1310
  description: n.description,
@@ -1342,25 +1330,25 @@ function je({ charts: e, ...t }) {
1342
1330
  }, n.id))
1343
1331
  });
1344
1332
  }
1345
- function Me({ charts: e, height: t }) {
1346
- if (!f(e) || e.length > Q.panels) return /* @__PURE__ */ w(m, {
1333
+ function Fe({ charts: e, height: t }) {
1334
+ if (!m(e) || e.length > $.panels) return /* @__PURE__ */ D(g, {
1347
1335
  title: "Small multiples",
1348
- message: `Choose at most ${Q.panels} panels with unique identifiers.`
1336
+ message: `Choose at most ${$.panels} panels with unique identifiers.`
1349
1337
  });
1350
1338
  let n = e.every((e) => e.report !== void 0);
1351
- return /* @__PURE__ */ w("div", {
1339
+ return /* @__PURE__ */ D("div", {
1352
1340
  "aria-hidden": !0,
1353
1341
  inert: !0,
1354
1342
  ...{
1355
1343
  0: { className: "xrvj5dj x1j825kq" },
1356
1344
  1: { className: "xrvj5dj xxhr3t" }
1357
1345
  }[!!n | 0],
1358
- children: e.map((r, i) => /* @__PURE__ */ w("div", {
1346
+ children: e.map((r, i) => /* @__PURE__ */ D("div", {
1359
1347
  ...{
1360
1348
  0: {},
1361
1349
  1: { className: "x1y332i5" }
1362
1350
  }[!!(n && i > 0) | 0],
1363
- children: /* @__PURE__ */ w(Ae, {
1351
+ children: /* @__PURE__ */ D(Ne, {
1364
1352
  ...r,
1365
1353
  height: t,
1366
1354
  showTimeAxis: i === e.length - 1
@@ -1368,138 +1356,114 @@ function Me({ charts: e, height: t }) {
1368
1356
  }, r.id))
1369
1357
  });
1370
1358
  }
1371
- var Ne = {
1359
+ var Ie = {
1372
1360
  "x-default-marker": "x-default-marker",
1373
1361
  $$css: !0
1374
1362
  };
1375
- function Pe({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: l = [], height: u = 180, actions: f, report: p, kind: _, isStacked: v, sharedInspection: C, axisWidth: re, showTimeAxis: ae = !0 }) {
1376
- let D = !Number.isFinite(u) || u < 48 ? "Chart height must be at least 48 pixels." : ye({
1363
+ function Le({ title: t, description: n, series: r, timestampUnit: i, formatTimestamp: a, formatValue: o, formatTick: c = o, markers: u = [], height: d = 180, actions: f, report: m, kind: h, isStacked: y, sharedInspection: b, axisWidth: te, showTimeAxis: E = !0 }) {
1364
+ let k = !Number.isFinite(d) || d < 48 ? "Chart height must be at least 48 pixels." : xe({
1377
1365
  series: r,
1378
- isStacked: v,
1379
- markers: l
1380
- }), O = ne(() => D === void 0 ? xe(r, v) : [], [
1366
+ isStacked: y,
1367
+ markers: u
1368
+ }), A = ne(() => k === void 0 ? we(r, y) : [], [
1381
1369
  r,
1382
- v,
1383
- D
1384
- ]), k = O[0]?.points ?? [], { ref: se, width: A, element: le } = ee(), M = x(null), [ue, N] = S(), de = k.find((e) => e.timestamp === ue) ?? k[0], [P, fe] = S(), F = be({
1370
+ y,
1371
+ k
1372
+ ]), M = A[0]?.points ?? [], { ref: ie, width: N, element: P } = ee(), oe = w(null), [se, le] = T(), ue = ne(() => M.map(({ timestamp: e }) => ({
1373
+ id: String(e),
1374
+ label: a(e)
1375
+ })), [M, a]), de = M.find((e) => e.timestamp === se) ?? M[0], [I, fe] = T(), L = Se({
1385
1376
  series: r,
1386
- markers: l,
1377
+ markers: u,
1387
1378
  timestampUnit: i,
1388
- isStacked: v
1389
- }), I = C === void 0 ? P?.signature === F ? P : void 0 : C.value, L = C === void 0 || C.isSource ? I : void 0, pe = p?.seriesValues !== void 0, me = b();
1390
- P !== void 0 && (P.signature !== F || D !== void 0) && fe(void 0);
1391
- let he = C !== void 0;
1392
- if (te(() => {
1393
- if (he) return;
1379
+ isStacked: y
1380
+ }), R = b === void 0 ? I?.signature === L ? I : void 0 : b.value, z = b === void 0 || b.isSource ? R : void 0, pe = m?.seriesValues !== void 0, me = C();
1381
+ I !== void 0 && (I.signature !== L || k !== void 0) && fe(void 0);
1382
+ let B = b !== void 0;
1383
+ if (S(() => {
1384
+ if (B) return;
1394
1385
  function e(e) {
1395
- e.target instanceof Node && M.current?.contains(e.target) !== !0 && fe(void 0);
1386
+ e.target instanceof Node && oe.current?.contains(e.target) !== !0 && fe(void 0);
1396
1387
  }
1397
1388
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
1398
- }, [he]), D !== void 0) return /* @__PURE__ */ w(m, {
1389
+ }, [B]), k !== void 0) return /* @__PURE__ */ D(g, {
1399
1390
  title: t,
1400
1391
  description: n,
1401
- report: p,
1402
- message: D
1392
+ report: m,
1393
+ message: k
1403
1394
  });
1404
- if (k.length === 0) return /* @__PURE__ */ w(d, {
1395
+ if (M.length === 0) return /* @__PURE__ */ D(p, {
1405
1396
  title: t,
1406
1397
  description: n,
1407
1398
  actions: f,
1408
- report: p,
1409
- series: O,
1410
- children: /* @__PURE__ */ w("p", {
1399
+ report: m,
1400
+ series: A,
1401
+ children: /* @__PURE__ */ D("p", {
1411
1402
  className: "x153jb6y",
1412
1403
  children: "No observations"
1413
1404
  })
1414
1405
  });
1415
- let R = u - 28, z = R + 12, B = k[0]?.timestamp ?? 0, V = k.at(-1)?.timestamp ?? B, H = O.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), U = _ === "area" ? Math.min(0, ...H) : Math.min(...H), W = _ === "area" ? Math.max(0, ...H) : Math.max(...H), G = H.length === 0 ? 0 : U, K = H.length === 0 ? 1 : W, q = E({
1416
- domain: [...$(G, K, _ === "area")],
1417
- range: [R, 12]
1418
- }), ge = q.ticks(3), J = re ?? Math.max(44, ...ge.map((e) => c(e).length * 7 + 12)), Y = Math.max(J + 1, A - 16), X = E({
1419
- domain: [...$(B, V)],
1420
- range: [J, Y]
1406
+ let he = d - 28, ge = he + 12, V = M[0]?.timestamp ?? 0, H = M.at(-1)?.timestamp ?? V, U = A.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), W = h === "area" ? Math.min(0, ...U) : Math.min(...U), G = h === "area" ? Math.max(0, ...U) : Math.max(...U), K = U.length === 0 ? 0 : W, _e = U.length === 0 ? 1 : G, q = j({
1407
+ domain: [...Ce(K, _e, h === "area")],
1408
+ range: [he, 12]
1409
+ }), J = q.ticks(3), Y = te ?? Math.max(44, ...J.map((e) => c(e).length * 7 + 12)), X = Math.max(Y + 1, N - 16), Z = j({
1410
+ domain: [...Ce(V, H)],
1411
+ range: [Y, X]
1421
1412
  });
1422
- function Z(e) {
1423
- let t = le?.getBoundingClientRect();
1413
+ function ve(e) {
1414
+ let t = P?.getBoundingClientRect();
1424
1415
  if (t === void 0) return;
1425
- let n = X.invert(e - t.left), r = k.find((e, t) => {
1426
- let r = k[t + 1];
1416
+ let n = Z.invert(e - t.left), r = M.find((e, t) => {
1417
+ let r = M[t + 1];
1427
1418
  return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
1428
1419
  });
1429
1420
  r !== void 0 && Q({
1430
- signature: F,
1421
+ signature: L,
1431
1422
  timestamp: r.timestamp,
1432
1423
  source: "pointer"
1433
1424
  });
1434
1425
  }
1435
1426
  function Q(e) {
1436
- C === void 0 ? fe(e) : C.onChange(e);
1427
+ b === void 0 ? fe(e) : b.onChange(e);
1437
1428
  }
1438
- function _e(e) {
1439
- if (e.altKey || e.ctrlKey || e.metaKey) return;
1440
- let t = k.findIndex((e) => e.timestamp === de?.timestamp), n = {
1441
- ArrowRight: Math.min(k.length - 1, t + 1),
1442
- ArrowLeft: Math.max(0, t - 1),
1443
- Home: 0,
1444
- End: k.length - 1
1445
- };
1446
- switch (e.key) {
1447
- case "Escape":
1448
- e.preventDefault(), e.stopPropagation(), Q(void 0);
1449
- break;
1450
- case "ArrowRight":
1451
- case "ArrowLeft":
1452
- case "Home":
1453
- case "End": {
1454
- e.preventDefault();
1455
- let t = k[n[e.key]];
1456
- t !== void 0 && (N(t.timestamp), Q({
1457
- signature: F,
1458
- timestamp: t.timestamp,
1459
- source: "keyboard"
1460
- }));
1461
- break;
1462
- }
1463
- }
1464
- }
1465
- return /* @__PURE__ */ w("div", {
1466
- ref: M,
1429
+ return /* @__PURE__ */ D("div", {
1430
+ ref: oe,
1467
1431
  className: "xeuugli",
1468
- children: /* @__PURE__ */ T(d, {
1469
- title: pe ? t : /* @__PURE__ */ w(ce, {
1432
+ children: /* @__PURE__ */ O(p, {
1433
+ title: pe ? t : /* @__PURE__ */ D(F, {
1470
1434
  title: t,
1471
- detail: L === void 0 ? void 0 : a(L.timestamp)
1435
+ detail: z === void 0 ? void 0 : a(z.timestamp)
1472
1436
  }),
1473
1437
  description: n,
1474
- report: p,
1475
- series: O,
1438
+ report: m,
1439
+ series: A,
1476
1440
  actions: f,
1477
- children: [/* @__PURE__ */ w(s, {
1441
+ children: [/* @__PURE__ */ D(s, {
1478
1442
  label: `${t} observations`,
1479
1443
  columns: [{
1480
1444
  id: "time",
1481
1445
  label: `Time (${i})`
1482
- }, ...O.map((e) => ({
1446
+ }, ...A.map((e) => ({
1483
1447
  id: `series:${e.id}`,
1484
1448
  label: e.label
1485
1449
  }))],
1486
- rows: k.map((e, t) => ({
1450
+ rows: M.map((e, t) => ({
1487
1451
  id: e.timestamp,
1488
- values: [a(e.timestamp), ...O.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value))]
1452
+ values: [a(e.timestamp), ...A.map((e) => e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : o(e.points[t].value))]
1489
1453
  }))
1490
- }), /* @__PURE__ */ T("div", {
1454
+ }), /* @__PURE__ */ O("div", {
1491
1455
  className: "xrvj5dj x1n8ia3y",
1492
1456
  children: [
1493
- /* @__PURE__ */ w(j, {
1457
+ /* @__PURE__ */ D(ce, {
1494
1458
  id: me,
1495
- label: L === void 0 ? void 0 : a(L.timestamp),
1496
- legend: O.map(({ id: e, label: t, tone: n }) => ({
1459
+ label: z === void 0 ? void 0 : a(z.timestamp),
1460
+ legend: A.map(({ id: e, label: t, tone: n }) => ({
1497
1461
  id: e,
1498
1462
  label: t,
1499
1463
  tone: n
1500
1464
  })),
1501
- rows: O.map((e) => {
1502
- let t = e.points.find((e) => e.timestamp === L?.timestamp);
1465
+ rows: A.map((e) => {
1466
+ let t = e.points.find((e) => e.timestamp === z?.timestamp);
1503
1467
  return {
1504
1468
  id: e.id,
1505
1469
  label: e.label,
@@ -1507,114 +1471,127 @@ function Pe({ title: t, description: n, series: r, timestampUnit: i, formatTimes
1507
1471
  value: t?.value === null || t === void 0 ? "Unavailable" : o(t.value)
1508
1472
  };
1509
1473
  }),
1510
- x: X(I?.timestamp ?? B),
1511
- width: A,
1512
- source: L?.source,
1513
- notes: l.filter((e) => e.timestamp === L?.timestamp).map((e) => e.label),
1474
+ x: Z(R?.timestamp ?? V),
1475
+ width: N,
1476
+ source: z?.source,
1477
+ notes: u.filter((e) => e.timestamp === z?.timestamp).map((e) => e.label),
1514
1478
  hasSeriesSummary: pe
1515
1479
  }),
1516
- /* @__PURE__ */ T("div", {
1517
- ref: se,
1518
- ...y.props(g.plot),
1519
- children: [/* @__PURE__ */ T("svg", {
1480
+ /* @__PURE__ */ O("div", {
1481
+ ref: ie,
1482
+ ...x.props(v.plot),
1483
+ children: [/* @__PURE__ */ O(l, {
1520
1484
  role: "img",
1521
1485
  "aria-label": `${t}. Use arrow keys to inspect observations.`,
1522
1486
  "aria-describedby": me,
1523
1487
  tabIndex: 0,
1524
- viewBox: `0 0 ${A} ${z}`,
1525
- height: z,
1526
- onKeyDown: _e,
1488
+ viewBox: `0 0 ${N} ${ge}`,
1489
+ height: ge,
1490
+ controls: {
1491
+ items: ue,
1492
+ cursor: de === void 0 ? void 0 : String(de.timestamp),
1493
+ inspected: R === void 0 ? void 0 : String(R.timestamp),
1494
+ onInspect: (e) => {
1495
+ let t = Number(e);
1496
+ le(t), Q({
1497
+ signature: L,
1498
+ timestamp: t,
1499
+ source: "keyboard"
1500
+ });
1501
+ },
1502
+ onDismiss: () => Q(void 0)
1503
+ },
1527
1504
  onFocus: (e) => {
1528
1505
  if (e.currentTarget.matches(":focus-visible")) {
1529
- let e = I?.timestamp ?? B;
1530
- N(e), Q({
1531
- signature: F,
1506
+ let e = R?.timestamp ?? V;
1507
+ le(e), Q({
1508
+ signature: L,
1532
1509
  timestamp: e,
1533
1510
  source: "keyboard"
1534
1511
  });
1535
1512
  }
1536
1513
  },
1537
1514
  onPointerMove: (e) => {
1538
- e.pointerType === "mouse" && Z(e.clientX);
1515
+ e.pointerType === "mouse" && ve(e.clientX);
1539
1516
  },
1540
- onPointerDown: (e) => Z(e.clientX),
1517
+ onPointerDown: (e) => ve(e.clientX),
1541
1518
  onPointerLeave: (e) => {
1542
- e.pointerType === "mouse" && I?.source === "pointer" && Q(void 0);
1519
+ e.pointerType === "mouse" && R?.source === "pointer" && Q(void 0);
1543
1520
  },
1544
1521
  onBlur: () => Q(void 0),
1545
- ...y.props(g.svg, g.inspectable, Ne),
1522
+ ...x.props(v.svg, v.inspectable, Ie),
1546
1523
  children: [
1547
- ge.map((e) => /* @__PURE__ */ T("g", { children: [/* @__PURE__ */ w("line", {
1548
- x1: J,
1549
- x2: Y,
1524
+ J.map((e) => /* @__PURE__ */ O("g", { children: [/* @__PURE__ */ D("line", {
1525
+ x1: Y,
1526
+ x2: X,
1550
1527
  y1: q(e),
1551
1528
  y2: q(e),
1552
- ...y.props(g.grid)
1553
- }), /* @__PURE__ */ w("text", {
1554
- x: J - 8,
1529
+ ...x.props(v.grid)
1530
+ }), /* @__PURE__ */ D("text", {
1531
+ x: Y - 8,
1555
1532
  y: q(e),
1556
1533
  textAnchor: "end",
1557
1534
  dominantBaseline: "middle",
1558
- ...y.props(g.label),
1535
+ ...x.props(v.label),
1559
1536
  children: c(e)
1560
1537
  })] }, e)),
1561
- O.map((t) => /* @__PURE__ */ T("g", { children: [_ === "area" && /* @__PURE__ */ w(ie, {
1538
+ A.map((t) => /* @__PURE__ */ O("g", { children: [h === "area" && /* @__PURE__ */ D(re, {
1562
1539
  data: [...t.points],
1563
1540
  defined: (e) => e.value !== null,
1564
- x: (e) => X(e.timestamp),
1541
+ x: (e) => Z(e.timestamp),
1565
1542
  y0: (e) => q(e.base),
1566
1543
  y1: (e) => q((e.value ?? 0) + e.base),
1567
1544
  yScale: q,
1568
1545
  fill: e[t.tone],
1569
- fillOpacity: v ? .65 : .15
1570
- }), /* @__PURE__ */ w(Ce, {
1546
+ fillOpacity: y ? .65 : .15
1547
+ }), /* @__PURE__ */ D(Ee, {
1571
1548
  series: t,
1572
- x: X,
1549
+ x: Z,
1573
1550
  y: q,
1574
- inspectedTimestamp: I?.timestamp
1551
+ inspectedTimestamp: R?.timestamp
1575
1552
  })] }, t.id)),
1576
- l.map((e) => /* @__PURE__ */ T("g", { children: [e.kind === "time" ? /* @__PURE__ */ w("line", {
1577
- x1: X(e.timestamp),
1578
- x2: X(e.timestamp),
1553
+ u.map((e) => /* @__PURE__ */ O("g", { children: [e.kind === "time" ? /* @__PURE__ */ D("line", {
1554
+ x1: Z(e.timestamp),
1555
+ x2: Z(e.timestamp),
1579
1556
  y1: 12,
1580
- y2: R,
1557
+ y2: he,
1581
1558
  className: "xhq4mlf x1ntoi03 x13efnbd"
1582
- }) : /* @__PURE__ */ w("circle", {
1583
- cx: X(e.timestamp),
1584
- cy: q(e.value + (O.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1559
+ }) : /* @__PURE__ */ D("circle", {
1560
+ cx: Z(e.timestamp),
1561
+ cy: q(e.value + (A.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1585
1562
  r: 4,
1586
- fill: h.surface,
1587
- ...y.props(g.selected)
1588
- }), /* @__PURE__ */ w("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
1589
- I !== void 0 && /* @__PURE__ */ w("line", {
1590
- x1: X(I.timestamp),
1591
- x2: X(I.timestamp),
1563
+ fill: _.surface,
1564
+ ...x.props(v.selected)
1565
+ }), /* @__PURE__ */ D("title", { children: e.kind === "point" ? `${e.label}: ${o(e.value)}` : e.label })] }, e.id)),
1566
+ R !== void 0 && /* @__PURE__ */ D("line", {
1567
+ x1: Z(R.timestamp),
1568
+ x2: Z(R.timestamp),
1592
1569
  y1: 12,
1593
- y2: R,
1570
+ y2: he,
1594
1571
  className: "xhq4mlf x1ntoi03 x13efnbd"
1595
1572
  }),
1596
- de !== void 0 && /* @__PURE__ */ w(oe, {
1597
- x: X(de.timestamp),
1573
+ de !== void 0 && /* @__PURE__ */ D(ae, {
1574
+ x: Z(de.timestamp),
1598
1575
  top: 12,
1599
- bottom: R,
1600
- width: Math.min(16, (Y - J) / 2)
1576
+ bottom: he,
1577
+ width: Math.min(16, (X - Y) / 2)
1601
1578
  })
1602
1579
  ]
1603
- }), ae && /* @__PURE__ */ T("div", {
1580
+ }), E && /* @__PURE__ */ O("div", {
1604
1581
  "aria-hidden": !0,
1605
- ...y.props(Ee.timeAxis, Ee.timeAxisInset(J, Math.max(0, A - Y))),
1606
- children: [/* @__PURE__ */ w("span", {
1582
+ ...x.props(ke.timeAxis, ke.timeAxisInset(Y, Math.max(0, N - X))),
1583
+ children: [/* @__PURE__ */ D("span", {
1607
1584
  className: "x1cqoux5 xeuugli xj0a0fe",
1608
- children: a(B)
1609
- }), V !== B && /* @__PURE__ */ w("span", {
1610
- className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
1611
1585
  children: a(V)
1586
+ }), H !== V && /* @__PURE__ */ D("span", {
1587
+ className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
1588
+ children: a(H)
1612
1589
  })]
1613
1590
  })]
1614
1591
  }),
1615
- l.length > 0 && /* @__PURE__ */ w("ul", {
1592
+ u.length > 0 && /* @__PURE__ */ D("ul", {
1616
1593
  className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
1617
- children: l.map((e) => /* @__PURE__ */ T("li", { children: [
1594
+ children: u.map((e) => /* @__PURE__ */ O("li", { children: [
1618
1595
  a(e.timestamp),
1619
1596
  " · ",
1620
1597
  e.label,
@@ -1626,4 +1603,4 @@ function Pe({ title: t, description: n, series: r, timestampUnit: i, formatTimes
1626
1603
  })
1627
1604
  });
1628
1605
  }
1629
- export { Oe as AreaChart, me as BarChart, F as BarChartPlaceholder, B as BreakdownBar, De as LineChart, G as MAX_SCATTER_POINTS, ge as ScatterPlot, je as SmallMultiples, Me as SmallMultiplesPlaceholder, we as Sparkline, ke as TimeSeriesChartPlaceholder, Q as timeSeriesLimits };
1606
+ export { je as AreaChart, B as BarChart, R as BarChartPlaceholder, H as BreakdownBar, Ae as LineChart, _e as MAX_SCATTER_POINTS, Y as ScatterPlot, Pe as SmallMultiples, Fe as SmallMultiplesPlaceholder, De as Sparkline, Me as TimeSeriesChartPlaceholder, $ as timeSeriesLimits };