@mechane-ai/elements 0.17.2 → 0.19.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 (33) hide show
  1. package/dist/ai.js +208 -166
  2. package/dist/{categorical-values-l5YTG9G3.js → categorical-values-D-sSI9JB.js} +2 -2
  3. package/dist/{chart-frame-Bf1l_7-R.js → chart-frame-vwS7YVgv.js} +9 -3
  4. package/dist/{chart-input-fBuRm0Lc.js → chart-input-D6Fw2UGV.js} +1 -1
  5. package/dist/charts/cartesian.js +331 -228
  6. package/dist/charts/distribution.js +2 -2
  7. package/dist/charts/graph.js +2 -2
  8. package/dist/charts/hierarchy.js +3 -3
  9. package/dist/charts/matrix.js +2 -2
  10. package/dist/charts/timeline.js +1 -1
  11. package/dist/charts.js +1 -1
  12. package/dist/collections.js +1 -1
  13. package/dist/content/markdown.js +134 -132
  14. package/dist/content/tree.js +1 -1
  15. package/dist/elements.css +111 -0
  16. package/dist/forms.js +1 -1
  17. package/dist/navigation/commands.js +1 -1
  18. package/dist/packages/ai/src/index.d.ts +2 -0
  19. package/dist/packages/ai/src/message.d.ts +2 -1
  20. package/dist/packages/ai/src/reply-indicator.d.ts +6 -0
  21. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +4 -8
  22. package/dist/packages/charts/src/cartesian/bar-data.d.ts +31 -0
  23. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +14 -0
  24. package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
  25. package/dist/packages/charts/src/chart-frame.d.ts +2 -1
  26. package/dist/packages/content/src/markdown/markdown.d.ts +1 -1
  27. package/dist/packages/forms/src/field-styles.d.ts +6 -0
  28. package/dist/packages/forms/src/forms.d.ts +2 -1
  29. package/dist/packages/foundations/src/visible-motion.d.ts +4 -0
  30. package/dist/{pierre-tree-BaIVTNmG.js → pierre-tree-BQBbAhmI.js} +1 -1
  31. package/dist/{src-R0kgHFPZ.js → src-Dven_9lR.js} +19 -12
  32. package/dist/visible-motion-1GcUaEi4.js +23 -0
  33. package/package.json +1 -1
@@ -1,22 +1,85 @@
1
1
  import { u as e } from "../src-BVsyKLQ8.js";
2
- import { i as t, n, r, t as i } from "../categorical-values-l5YTG9G3.js";
3
- import { a, i as o, n as s, o as c, r as l, s as u, t as d } from "../chart-frame-Bf1l_7-R.js";
4
- import { n as f, r as p, t as m } from "../chart-input-fBuRm0Lc.js";
2
+ import { i as t, n, r, t as i } from "../categorical-values-D-sSI9JB.js";
3
+ import { a, i as o, n as s, o as c, r as l, s as u, t as d } from "../chart-frame-vwS7YVgv.js";
4
+ import { n as f, r as p, t as m } from "../chart-input-D6Fw2UGV.js";
5
5
  import { t as h } from "../plot-width--OgdohB5.js";
6
6
  import { E as g } from "../src-BXh4g2VY.js";
7
- import { g as _ } from "../src-R0kgHFPZ.js";
7
+ import { g as _ } from "../src-Dven_9lR.js";
8
8
  import { r as v } from "../tokens.stylex-DTHHFbyl.js";
9
9
  import * as y from "@stylexjs/stylex";
10
10
  import { useEffect as b, useId as x, useMemo as S, useRef as C, useState as w } from "react";
11
11
  import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
12
12
  import { scaleBand as O, scaleLinear as k } from "@visx/scale";
13
- import { AreaClosed as A, Bar as ee, LinePath as j } from "@visx/shape";
13
+ import { AreaClosed as ee, Bar as te, LinePath as A } from "@visx/shape";
14
+ // packages/charts/src/cartesian/bar-data.ts
15
+ function j({ composition: e, series: t, categoryIds: n, domain: r }) {
16
+ if (e === void 0) return;
17
+ if (e.buckets.length !== n.length) return "Composition requires one explicit bucket per category.";
18
+ let i = e.annotation;
19
+ if (i !== void 0) {
20
+ if (!n.includes(i.categoryId) || !Number.isFinite(i.value)) return "A bar annotation requires an existing category and a finite value.";
21
+ if (i.value < r[0] || i.value > r[1]) return "A bar annotation must fit the supplied domain.";
22
+ }
23
+ for (let [n, i] of e.buckets.entries()) if (i.kind !== "gap") {
24
+ if (!Number.isFinite(i.total) || i.total < r[0] || i.total > r[1]) return "Context totals must be finite and inside the supplied domain.";
25
+ if (i.kind === "parts") {
26
+ let e = t.map((e) => e.values[n]);
27
+ if (e.some((e) => e != null && e < 0)) return "Composition parts require nonnegative reported values.";
28
+ if (e.reduce((e, t) => e + (t ?? 0), 0) > r[1] || i.total < 0) return "Composition parts must fit the supplied positive domain.";
29
+ }
30
+ }
31
+ }
32
+ // packages/charts/src/cartesian/composition-bars.tsx
33
+ var M = { mark: {
34
+ k3nNDw: "x1hj3fc7",
35
+ k1ekBW: "xwcsmn1",
36
+ kIyJzY: "xtitasy x12w9bfk",
37
+ kAMwcw: "x1faw7qm",
38
+ $$css: !0
39
+ } };
40
+ function ne({ bucket: e, series: t, focusedSeries: n, index: i, x: a, width: o, y: s, isHighlighted: l }) {
41
+ let d = n !== void 0, f = n !== void 0 && !t.some((e) => e.id === n.id) ? [...t, n] : t;
42
+ function p(e, t) {
43
+ let n = s(t), r = s(t + e);
44
+ return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0), Math.abs(r - n))})`;
45
+ }
46
+ return /* @__PURE__ */ D(T, { children: [e.kind !== "gap" && /* @__PURE__ */ E("rect", {
47
+ x: a,
48
+ y: 0,
49
+ width: o,
50
+ height: 1,
51
+ vectorEffect: "non-scaling-stroke",
52
+ fill: u.neutral,
53
+ ...y.props(M.mark, l && c.selected),
54
+ style: {
55
+ transform: p(e.total, 0),
56
+ opacity: d ? .18 : +(e.kind === "total")
57
+ }
58
+ }), f.map((s, f) => {
59
+ let m = s.values[i];
60
+ if (m == null) return null;
61
+ let h = n?.id === s.id, g = d ? 0 : t.slice(0, f).reduce((e, t) => e + (t.values[i] ?? 0), 0), _ = d ? h : e.kind === "parts";
62
+ return /* @__PURE__ */ E("rect", {
63
+ x: a,
64
+ y: 0,
65
+ width: o,
66
+ height: 1,
67
+ vectorEffect: "non-scaling-stroke",
68
+ fill: u[r(s.tone, f)],
69
+ ...y.props(M.mark, l && c.selected),
70
+ style: {
71
+ transform: p(m, g),
72
+ opacity: +!!_
73
+ }
74
+ }, s.id);
75
+ })] });
76
+ }
14
77
  // packages/charts/src/cartesian/bar-chart.tsx
15
- var M = { plot: {
78
+ var N = { plot: {
16
79
  kqGvvJ: "x1we84gm",
17
80
  $$css: !0
18
- } }, N = /* @__PURE__ */ new Set(["Enter", " "]), te = 200, P = "Point, tap, or use the arrow keys to inspect values.";
19
- function ne({ title: e, description: t, series: n, children: i }) {
81
+ } }, re = /* @__PURE__ */ new Set(["Enter", " "]), ie = 200, P = "Point, tap, or use the arrow keys to inspect values.";
82
+ function F({ title: e, description: t, series: n, children: i }) {
20
83
  let a = n.map((e, t) => ({
21
84
  id: e.id,
22
85
  label: e.label,
@@ -25,25 +88,31 @@ function ne({ title: e, description: t, series: n, children: i }) {
25
88
  return /* @__PURE__ */ D(l, {
26
89
  title: e,
27
90
  description: t,
28
- children: [/* @__PURE__ */ E(o, { items: a }), i]
91
+ children: [/* @__PURE__ */ E("div", {
92
+ className: "x1mqbd49",
93
+ children: /* @__PURE__ */ E(o, {
94
+ items: a,
95
+ isScrollable: !0
96
+ })
97
+ }), i]
29
98
  });
30
99
  }
31
- function F({ title: t = "Loading chart", description: n, series: r = [], height: i = te }) {
32
- let a = I(i);
100
+ function I({ title: t = "Loading chart", description: n, series: r = [], height: i = ie }) {
101
+ let a = L(i);
33
102
  return a === void 0 ? /* @__PURE__ */ E("div", {
34
103
  "aria-hidden": !0,
35
104
  inert: !0,
36
- children: /* @__PURE__ */ D(ne, {
105
+ children: /* @__PURE__ */ D(F, {
37
106
  title: t,
38
107
  description: n,
39
108
  series: r,
40
109
  children: [
41
110
  /* @__PURE__ */ E("div", {
42
- ...y.props(c.plot, M.plot),
111
+ ...y.props(c.plot, N.plot),
43
112
  children: /* @__PURE__ */ E(e, { height: i })
44
113
  }),
45
114
  /* @__PURE__ */ E("div", {
46
- className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1mqbd49 xy8obcc xas2l8k xss6m8b xj0a0fe",
115
+ className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1rtsecp xy8obcc xas2l8k xss6m8b xj0a0fe",
47
116
  children: /* @__PURE__ */ D("span", {
48
117
  className: "x1n2onr6 xeuugli",
49
118
  children: [/* @__PURE__ */ E("span", {
@@ -67,10 +136,10 @@ function F({ title: t = "Loading chart", description: n, series: r = [], height:
67
136
  message: a
68
137
  });
69
138
  }
70
- function I(e) {
139
+ function L(e) {
71
140
  if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
72
141
  }
73
- function L({ categories: e, series: t, domain: r, mode: i }) {
142
+ function ae({ categories: e, series: t, domain: r, mode: i }) {
74
143
  if (e.length > n.items || t.length > n.series) return `Choose a window with at most ${n.items} categories and ${n.series} series.`;
75
144
  if (!p(r) || r[0] > 0 || r[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
76
145
  if (!f(e) || !f(t)) return "Bar categories and series require unique identifiers.";
@@ -83,155 +152,189 @@ function L({ categories: e, series: t, domain: r, mode: i }) {
83
152
  }
84
153
  if (i === "stacked" && e.some((e, n) => t.reduce((e, t) => e + (t.values[n] ?? 0), 0) > r[1])) return "Stacked bar totals must fit the supplied domain.";
85
154
  }
86
- function R({ title: e, description: t, categories: n, series: a, domain: o, mode: s = "grouped", formatValue: l, selection: f, height: p = te }) {
87
- let g = L({
155
+ function oe({ title: e, description: t, categories: n, series: a, domain: o, mode: s = "grouped", formatValue: l, selection: f, height: p = ie, composition: g }) {
156
+ let _ = g?.focusedSeries, v = x(), b = _ === void 0 ? void 0 : ae({
157
+ categories: n,
158
+ series: [_],
159
+ domain: o,
160
+ mode: "grouped"
161
+ }), S = ae({
88
162
  categories: n,
89
163
  series: a,
90
164
  domain: o,
91
165
  mode: s
92
- }) ?? I(p), { ref: _, width: v } = h(), b = x(), [S, C] = w(), A = n.findIndex((e) => e.id === S?.id), j = n[A], F = n.findIndex((e) => e.id === f?.selectedId), R = n[F], B = j ?? R, V = j === void 0 ? F : A;
93
- if (g !== void 0) return /* @__PURE__ */ E(m, {
166
+ }) ?? b, C = j({
167
+ composition: g,
168
+ series: a,
169
+ categoryIds: n.map((e) => e.id),
170
+ domain: o
171
+ }) ?? L(p), ee = S ?? C, A = g === void 0 ? void 0 : {
172
+ id: v,
173
+ label: g.contextLabel,
174
+ tone: "neutral",
175
+ values: g.buckets.map((e) => e.kind === "gap" ? null : e.total)
176
+ }, M = A === void 0 ? a : [A, ..._ === void 0 ? [] : [_]], I = A === void 0 ? a : [
177
+ A,
178
+ ...a,
179
+ ..._ === void 0 || a.some((e) => e.id === _.id) ? [] : [_]
180
+ ], oe = a.length > 0 ? a : M, { ref: se, width: z } = h(), B = x(), [V, H] = w(), U = n.findIndex((e) => e.id === V?.id), W = n[U], G = n.findIndex((e) => e.id === f?.selectedId), K = n[G], q = W ?? K, J = W === void 0 ? G : U;
181
+ if (ee !== void 0) return /* @__PURE__ */ E(m, {
94
182
  title: e,
95
183
  description: t,
96
- message: g
184
+ message: ee
97
185
  });
98
- let H = p - 28, U = k({
186
+ let Y = p - 28, X = k({
99
187
  domain: [...o],
100
- range: [H, 12]
101
- }), W = Math.max(52, ...U.ticks(3).map((e) => l(e).length * 7 + 12)), G = Math.max(W + 1, v - 16), K = O({
188
+ range: [Y, 12]
189
+ }), Z = Math.max(52, ...X.ticks(3).map((e) => l(e).length * 7 + 12)), Q = Math.max(Z + 1, z - 16), $ = O({
102
190
  domain: n.map((e) => e.id),
103
- range: [W, G],
191
+ range: [Z, Q],
104
192
  padding: .3
105
- }), q = O({
193
+ }), ce = O({
106
194
  domain: a.map((e) => e.id),
107
- range: [0, K.bandwidth()],
195
+ range: [0, $.bandwidth()],
108
196
  padding: .08
109
- }), re = Math.min(120, Math.max(40, ...n.map((e) => (e.axisLabel ?? e.label).length * 7))), J = Math.max(1, Math.ceil((re + 16) / K.step())), ie = Math.max(1, Math.floor((K.step() * J - 16) / 7));
110
- function Y(e) {
111
- let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / t.width * v, i = Math.floor((r - W) / K.step()), a = n[Math.max(0, Math.min(n.length - 1, i))];
112
- a !== void 0 && C({
197
+ }), le = Math.min(120, Math.max(40, ...n.map((e) => (e.axisLabel ?? e.label).length * 7))), ue = Math.max(1, Math.ceil((le + 16) / $.step())), de = n.length > 0 && (a.length > 0 || g !== void 0), fe = Math.max(1, Math.floor(($.step() * ue - 16) / 7));
198
+ function pe(e) {
199
+ let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / t.width * z, i = Math.floor((r - Z) / $.step()), a = n[Math.max(0, Math.min(n.length - 1, i))];
200
+ a !== void 0 && H({
113
201
  id: a.id,
114
202
  source: "pointer"
115
203
  });
116
204
  }
117
- function ae(e) {
205
+ function me(e) {
118
206
  if (e.altKey || e.ctrlKey || e.metaKey) return;
119
207
  if (e.key === "Escape") {
120
- e.preventDefault(), e.stopPropagation(), C(void 0);
208
+ e.preventDefault(), e.stopPropagation(), H(void 0);
121
209
  return;
122
210
  }
123
- if (N.has(e.key)) {
124
- j !== void 0 && f !== void 0 && (e.preventDefault(), f.onSelect(j.id));
211
+ if (re.has(e.key)) {
212
+ W !== void 0 && f !== void 0 && (e.preventDefault(), f.onSelect(W.id));
125
213
  return;
126
214
  }
127
215
  let t = {
128
- ArrowRight: Math.min(n.length - 1, A + 1),
129
- ArrowLeft: Math.max(0, A - 1),
216
+ ArrowRight: Math.min(n.length - 1, U + 1),
217
+ ArrowLeft: Math.max(0, U - 1),
130
218
  Home: 0,
131
219
  End: n.length - 1
132
220
  }[e.key], r = t === void 0 ? void 0 : n[t];
133
- r !== void 0 && (e.preventDefault(), C({
221
+ r !== void 0 && (e.preventDefault(), H({
134
222
  id: r.id,
135
223
  source: "keyboard"
136
224
  }));
137
225
  }
138
- return /* @__PURE__ */ D(ne, {
226
+ return /* @__PURE__ */ D(F, {
139
227
  title: e,
140
228
  description: t,
141
- series: a,
229
+ series: oe,
142
230
  children: [
143
231
  /* @__PURE__ */ E("div", {
144
- ref: _,
145
- ...y.props(c.plot, M.plot),
146
- children: n.length === 0 || a.length === 0 ? /* @__PURE__ */ E("p", {
232
+ ref: se,
233
+ ...y.props(c.plot, N.plot),
234
+ children: n.length === 0 || a.length === 0 && g === void 0 ? /* @__PURE__ */ E("p", {
147
235
  className: "x153jb6y x1ghz6dp xy8obcc",
148
236
  children: "No categories"
149
237
  }) : /* @__PURE__ */ D("svg", {
150
238
  role: "img",
151
239
  "aria-label": `${e}. Use arrow keys to inspect categories.${f === void 0 ? "" : " Press Enter to select."}`,
152
- "aria-describedby": b,
240
+ "aria-describedby": B,
153
241
  tabIndex: 0,
154
- viewBox: `0 0 ${v} ${p}`,
242
+ viewBox: `0 0 ${z} ${p}`,
155
243
  height: p,
156
- onKeyDown: ae,
244
+ onKeyDown: me,
157
245
  onPointerMove: (e) => {
158
- e.pointerType === "mouse" && Y(e);
246
+ e.pointerType === "mouse" && pe(e);
159
247
  },
160
- onPointerDown: Y,
248
+ onPointerDown: pe,
161
249
  onPointerLeave: (e) => {
162
- e.pointerType === "mouse" && S?.source === "pointer" && C(void 0);
250
+ e.pointerType === "mouse" && V?.source === "pointer" && H(void 0);
163
251
  },
164
- onBlur: () => C(void 0),
252
+ onBlur: () => H(void 0),
165
253
  onClick: () => {
166
- j !== void 0 && f?.onSelect(j.id);
254
+ W !== void 0 && f?.onSelect(W.id);
167
255
  },
168
256
  ...y.props(c.svg, c.focus),
169
257
  children: [
170
- j !== void 0 && /* @__PURE__ */ E("rect", {
171
- x: (K(j.id) ?? W) - (K.step() - K.bandwidth()) / 2,
258
+ W !== void 0 && /* @__PURE__ */ E("rect", {
259
+ x: ($(W.id) ?? Z) - ($.step() - $.bandwidth()) / 2,
172
260
  y: 12,
173
- width: K.step(),
174
- height: H - 12,
261
+ width: $.step(),
262
+ height: Y - 12,
175
263
  className: "x2wnxhi"
176
264
  }),
177
- U.ticks(3).map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
178
- x1: W,
179
- x2: G,
180
- y1: U(e),
181
- y2: U(e),
265
+ X.ticks(3).map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
266
+ x1: Z,
267
+ x2: Q,
268
+ y1: X(e),
269
+ y2: X(e),
182
270
  ...y.props(c.grid)
183
271
  }), /* @__PURE__ */ E("text", {
184
- x: W - 8,
185
- y: U(e),
272
+ x: Z - 8,
273
+ y: X(e),
186
274
  textAnchor: "end",
187
275
  dominantBaseline: "middle",
188
276
  ...y.props(c.label),
189
277
  children: l(e)
190
278
  })] }, e)),
279
+ g?.annotation !== void 0 && n.some((e) => e.id === g.annotation?.categoryId) && /* @__PURE__ */ E("text", {
280
+ x: $(g.annotation.categoryId),
281
+ y: Math.max(12, X(g.annotation.value) - 8),
282
+ ...y.props(c.label),
283
+ children: g.annotation.label
284
+ }),
191
285
  n.map((e, t) => {
192
- let n = e.axisLabel ?? e.label;
193
- return /* @__PURE__ */ D("g", { children: [a.map((n, i) => {
286
+ let n = e.axisLabel ?? e.label, i = g?.buckets[t];
287
+ return /* @__PURE__ */ D("g", { children: [i === void 0 ? a.map((n, i) => {
194
288
  let o = n.values[t];
195
289
  if (o == null) return null;
196
- let l = s === "stacked" ? a.slice(0, i).reduce((e, n) => e + (n.values[t] ?? 0), 0) : 0, d = U(l), p = U(l + o), m = f?.selectedId === e.id || j?.id === e.id;
197
- return /* @__PURE__ */ E(ee, {
198
- x: (K(e.id) ?? W) + (s === "stacked" ? 0 : q(n.id) ?? 0),
290
+ let l = s === "stacked" ? a.slice(0, i).reduce((e, n) => e + (n.values[t] ?? 0), 0) : 0, d = X(l), p = X(l + o), m = f?.selectedId === e.id || W?.id === e.id;
291
+ return /* @__PURE__ */ E(te, {
292
+ x: ($(e.id) ?? Z) + (s === "stacked" ? 0 : ce(n.id) ?? 0),
199
293
  y: Math.min(d, p),
200
- width: s === "stacked" ? K.bandwidth() : q.bandwidth(),
294
+ width: s === "stacked" ? $.bandwidth() : ce.bandwidth(),
201
295
  height: Math.max(+(o === 0), Math.abs(p - d)),
202
296
  fill: u[r(n.tone, i)],
203
297
  ...y.props(m && c.selected)
204
298
  }, n.id);
205
- }), t % J === 0 && /* @__PURE__ */ E("text", {
206
- x: (K(e.id) ?? W) + K.bandwidth() / 2,
299
+ }) : /* @__PURE__ */ E(ne, {
300
+ bucket: i,
301
+ series: a,
302
+ focusedSeries: _,
303
+ index: t,
304
+ x: $(e.id) ?? Z,
305
+ width: $.bandwidth(),
306
+ y: X,
307
+ isHighlighted: f?.selectedId === e.id || W?.id === e.id
308
+ }), t % ue === 0 && /* @__PURE__ */ E("text", {
309
+ x: ($(e.id) ?? Z) + $.bandwidth() / 2,
207
310
  y: p - 4,
208
311
  textAnchor: "middle",
209
312
  ...y.props(c.label),
210
- children: n.length > ie ? `${n.slice(0, ie - 1)}…` : n
313
+ children: n.length > fe ? `${n.slice(0, fe - 1)}…` : n
211
314
  })] }, e.id);
212
315
  })
213
316
  ]
214
317
  })
215
318
  }),
216
- n.length > 0 && a.length > 0 && /* @__PURE__ */ E("div", {
217
- id: b,
218
- "aria-live": S?.source === "pointer" ? "off" : "polite",
219
- className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1mqbd49 xy8obcc xas2l8k xss6m8b xj0a0fe",
220
- children: B === void 0 ? /* @__PURE__ */ E("span", {
319
+ de && /* @__PURE__ */ E("div", {
320
+ id: B,
321
+ "aria-live": V?.source === "pointer" ? "off" : "polite",
322
+ className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1rtsecp xy8obcc xas2l8k xss6m8b xj0a0fe",
323
+ children: q === void 0 ? /* @__PURE__ */ E("span", {
221
324
  className: "x153jb6y x1ghz6dp xy8obcc",
222
325
  children: P
223
- }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: B.label }), a.map((e) => /* @__PURE__ */ D("span", { children: [
326
+ }) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: q.label }), M.map((e) => /* @__PURE__ */ D("span", { children: [
224
327
  e.label,
225
328
  ":",
226
329
  " ",
227
- e.values[V] === null || e.values[V] === void 0 ? "Unavailable" : l(e.values[V])
330
+ e.values[J] === null || e.values[J] === void 0 ? "Unavailable" : l(e.values[J])
228
331
  ] }, e.id))] })
229
332
  }),
230
333
  /* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(i, {
231
334
  items: n.map((e, t) => ({
232
335
  id: e.id,
233
336
  label: e.label,
234
- valueLabel: z(a, t, l),
337
+ valueLabel: R(I, t, l),
235
338
  tone: "neutral"
236
339
  })),
237
340
  selection: f
@@ -239,19 +342,19 @@ function R({ title: e, description: t, categories: n, series: a, domain: o, mode
239
342
  ]
240
343
  });
241
344
  }
242
- function z(e, t, n) {
345
+ function R(e, t, n) {
243
346
  return e.map((e) => {
244
347
  let r = e.values[t];
245
348
  return `${e.label}: ${r == null ? "Unavailable" : n(r)}`;
246
349
  }).join(" · ");
247
350
  }
248
351
  // packages/charts/src/cartesian/breakdown-bar.tsx
249
- var B = {
352
+ var se = {
250
353
  kzqmXN: "x5lhr3w",
251
354
  kZKoxP: "x5yr21d",
252
355
  $$css: !0
253
- }, V = { segment: (e, t) => [
254
- B,
356
+ }, z = { segment: (e, t) => [
357
+ se,
255
358
  {
256
359
  kWkggS: t == null ? t : "xl8spv7",
257
360
  $$css: !0
@@ -261,7 +364,7 @@ var B = {
261
364
  "--x-backgroundColor": t ?? void 0
262
365
  }
263
366
  ] };
264
- function H({ title: e, description: n, items: a, total: o, formatValue: s, selection: c }) {
367
+ function B({ title: e, description: n, items: a, total: o, formatValue: s, selection: c }) {
265
368
  let d = t(a), f = a.reduce((e, t) => e + (t.value ?? 0), 0), p = 2 ** -52 * Math.max(f, o, 1) * a.length;
266
369
  return d === void 0 ? !Number.isFinite(o) || o < 0 || f - o > p ? /* @__PURE__ */ E(m, {
267
370
  title: e,
@@ -277,7 +380,7 @@ function H({ title: e, description: n, items: a, total: o, formatValue: s, selec
277
380
  /* @__PURE__ */ E("div", {
278
381
  "aria-hidden": !0,
279
382
  className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
280
- children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */ E("span", { ...y.props(V.segment(o === 0 ? 0 : e.value / o * 100, u[r(e.tone, t)])) }, e.id))
383
+ children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */ E("span", { ...y.props(z.segment(o === 0 ? 0 : e.value / o * 100, u[r(e.tone, t)])) }, e.id))
281
384
  }),
282
385
  /* @__PURE__ */ E(i, {
283
386
  items: a.map((e, t) => ({
@@ -305,12 +408,12 @@ function H({ title: e, description: n, items: a, total: o, formatValue: s, selec
305
408
  });
306
409
  }
307
410
  // packages/charts/src/cartesian/scatter-plot.tsx
308
- var U = 260, W = 56, G = 20, K = 12, q = 1e3, re = {
411
+ var V = 260, H = 56, U = 20, W = 12, G = 1e3, K = {
309
412
  kzqmXN: "x1xc55vz",
310
413
  kZKoxP: "xdk7pt",
311
414
  kaIpWk: "x16rqkct",
312
415
  $$css: !0
313
- }, J = {
416
+ }, q = {
314
417
  brush: {
315
418
  kFalU9: "xx69xxh",
316
419
  kkrTdU: "xsid9ct",
@@ -348,7 +451,7 @@ var U = 260, W = 56, G = 20, K = 12, q = 1e3, re = {
348
451
  "--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
349
452
  }],
350
453
  dot: (e) => [
351
- re,
454
+ K,
352
455
  {
353
456
  kWkggS: e == null ? e : "xl8spv7",
354
457
  $$css: !0
@@ -363,8 +466,8 @@ var U = 260, W = 56, G = 20, K = 12, q = 1e3, re = {
363
466
  $$css: !0
364
467
  }
365
468
  };
366
- function ie(e) {
367
- let { title: t, description: n, points: r, xDomain: i, yDomain: o, xLabel: c, yLabel: f, formatX: p, formatY: g, selection: _, rangeSelection: v, emptyLabel: b } = e, { ref: x, width: S } = h(), C = X(e);
469
+ function J(e) {
470
+ let { title: t, description: n, points: r, xDomain: i, yDomain: o, xLabel: c, yLabel: f, formatX: p, formatY: g, selection: _, rangeSelection: v, emptyLabel: b } = e, { ref: x, width: S } = h(), C = Z(e);
368
471
  if (C !== null) return /* @__PURE__ */ E(m, {
369
472
  title: t,
370
473
  description: n,
@@ -372,10 +475,10 @@ function ie(e) {
372
475
  });
373
476
  let w = k({
374
477
  domain: [...i],
375
- range: [W, Math.max(W, S - G)]
478
+ range: [H, Math.max(H, S - U)]
376
479
  }), T = k({
377
480
  domain: [...o],
378
- range: [216, K]
481
+ range: [216, W]
379
482
  }), O = r.find((e) => e.id === _?.selectedId);
380
483
  return /* @__PURE__ */ D(l, {
381
484
  title: t,
@@ -401,15 +504,15 @@ function ie(e) {
401
504
  "aria-label": `${e.label}, ${c}: ${p(e.x)}, ${f}: ${g(e.y)}`,
402
505
  "aria-pressed": _.selectedId === e.id,
403
506
  onClick: () => _.onSelect(e.id),
404
- ...y.props(J.target, J.location(w(e.x), T(e.y))),
507
+ ...y.props(q.target, q.location(w(e.x), T(e.y))),
405
508
  children: /* @__PURE__ */ E("span", {
406
509
  "aria-hidden": !0,
407
- ...y.props(J.dot(u[e.tone]), _.selectedId === e.id && J.selected)
510
+ ...y.props(q.dot(u[e.tone]), _.selectedId === e.id && q.selected)
408
511
  })
409
512
  }, e.id))
410
513
  })]
411
514
  }),
412
- v !== void 0 && /* @__PURE__ */ E(ae, {
515
+ v !== void 0 && /* @__PURE__ */ E(X, {
413
516
  ...e,
414
517
  rangeSelection: v
415
518
  }),
@@ -438,13 +541,13 @@ function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
438
541
  let i = r.currentTarget.getBoundingClientRect();
439
542
  return {
440
543
  x: t.copy().clamp(!0).invert((r.clientX - i.left) / i.width * e),
441
- y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height * U)
544
+ y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height * V)
442
545
  };
443
546
  }
444
547
  function _(t) {
445
548
  if (d === void 0 || t.button !== 0 || t.pointerType === "touch") return;
446
- let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * U;
447
- if (r < W || r > e - G || i < K || i > 216) return;
549
+ let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * V;
550
+ if (r < H || r > e - U || i < W || i > 216) return;
448
551
  let a = g(t);
449
552
  t.currentTarget.setPointerCapture(t.pointerId), m({
450
553
  start: a,
@@ -468,29 +571,29 @@ function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
468
571
  }
469
572
  return /* @__PURE__ */ D("svg", {
470
573
  width: e,
471
- height: U,
472
- viewBox: `0 0 ${e} ${U}`,
574
+ height: V,
575
+ viewBox: `0 0 ${e} ${V}`,
473
576
  "aria-hidden": !0,
474
577
  onPointerDown: _,
475
578
  onPointerMove: v,
476
579
  onPointerUp: b,
477
580
  onPointerCancel: () => m(null),
478
581
  onLostPointerCapture: () => m(null),
479
- ...y.props(c.svg, d !== void 0 && J.brush),
582
+ ...y.props(c.svg, d !== void 0 && q.brush),
480
583
  children: [
481
584
  /* @__PURE__ */ E("defs", { children: /* @__PURE__ */ E("clipPath", {
482
585
  id: f,
483
586
  children: /* @__PURE__ */ E("rect", {
484
- x: W,
485
- y: K,
486
- width: Math.max(0, e - W - G),
587
+ x: H,
588
+ y: W,
589
+ width: Math.max(0, e - H - U),
487
590
  height: 204
488
591
  })
489
592
  }) }),
490
593
  t.ticks(5).map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
491
594
  x1: t(e),
492
595
  x2: t(e),
493
- y1: K,
596
+ y1: W,
494
597
  y2: 216,
495
598
  ...y.props(c.grid)
496
599
  }), /* @__PURE__ */ E("text", {
@@ -501,8 +604,8 @@ function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
501
604
  children: o(e)
502
605
  })] }, e)),
503
606
  n.ticks(4).map((t) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
504
- x1: W,
505
- x2: e - G,
607
+ x1: H,
608
+ x2: e - U,
506
609
  y1: n(t),
507
610
  y2: n(t),
508
611
  ...y.props(c.grid)
@@ -514,7 +617,7 @@ function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
514
617
  children: s(t)
515
618
  })] }, t)),
516
619
  /* @__PURE__ */ E("text", {
517
- x: (W + e - G) / 2,
620
+ x: (H + e - U) / 2,
518
621
  y: 256,
519
622
  textAnchor: "middle",
520
623
  ...y.props(c.label),
@@ -546,7 +649,7 @@ function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
546
649
  ]
547
650
  });
548
651
  }
549
- function ae({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
652
+ function X({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
550
653
  let s = e.value ?? {
551
654
  x: t,
552
655
  y: n
@@ -631,9 +734,9 @@ function ae({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, f
631
734
  ]
632
735
  });
633
736
  }
634
- function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
737
+ function Z({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
635
738
  if (!p(t) || !p(n)) return "Scatter domains must contain finite, increasing endpoints.";
636
- if (e.length > 1e3) return `This plot exceeds the ${q}-point render limit. Supply a smaller, labelled sample.`;
739
+ if (e.length > 1e3) return `This plot exceeds the ${G}-point render limit. Supply a smaller, labelled sample.`;
637
740
  if (!f(e)) return "Scatter points must have unique identifiers.";
638
741
  if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
639
742
  if (e.some((e) => {
@@ -644,18 +747,18 @@ function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
644
747
  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];
645
748
  if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
646
749
  let o = r.value;
647
- 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;
750
+ 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;
648
751
  }
649
- function Z(e, t) {
752
+ function Q(e, t) {
650
753
  return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
651
754
  }
652
755
  // packages/charts/src/cartesian/time-series-data.ts
653
- var Q = {
756
+ var $ = {
654
757
  series: 12,
655
758
  pointsPerSeries: 2e3,
656
759
  markers: 200,
657
760
  panels: 12
658
- }, oe = .01, $ = [
761
+ }, ce = .01, le = [
659
762
  "series1",
660
763
  "series2",
661
764
  "series3",
@@ -663,13 +766,13 @@ var Q = {
663
766
  "series5",
664
767
  "series6"
665
768
  ];
666
- function se({ series: e, isStacked: t, markers: n }) {
769
+ function ue({ series: e, isStacked: t, markers: n }) {
667
770
  let r = e[0]?.points.map((e) => e.timestamp) ?? [];
668
- 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.`;
771
+ 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.`;
669
772
  if (!f(e) || !f(n)) return "Series and markers require unique identifiers.";
670
773
  for (let n of e) {
671
774
  if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
672
- let e = de({
775
+ let e = me({
673
776
  points: n.points,
674
777
  timestamps: r,
675
778
  isStacked: t
@@ -687,7 +790,7 @@ function se({ series: e, isStacked: t, markers: n }) {
687
790
  if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
688
791
  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.";
689
792
  }
690
- function ce({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
793
+ function de({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
691
794
  return JSON.stringify([
692
795
  n,
693
796
  r,
@@ -707,15 +810,15 @@ function ce({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
707
810
  ])
708
811
  ]);
709
812
  }
710
- function le(e, t, n = !1) {
813
+ function fe(e, t, n = !1) {
711
814
  if (e !== t) return [e, t];
712
- let r = Math.max(1, Math.abs(e) * oe), i = n ? 0 : e - r, a = t + r;
815
+ let r = Math.max(1, Math.abs(e) * ce), i = n ? 0 : e - r, a = t + r;
713
816
  return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
714
817
  }
715
- function ue(e, t) {
818
+ function pe(e, t) {
716
819
  let n = e.filter((e) => e.tone === void 0);
717
820
  return e.map((r, i) => {
718
- let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? $[a % $.length] ?? "series1", s = r.points.map((n, r) => {
821
+ let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? le[a % le.length] ?? "series1", s = r.points.map((n, r) => {
719
822
  let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
720
823
  return {
721
824
  ...n,
@@ -730,7 +833,7 @@ function ue(e, t) {
730
833
  };
731
834
  });
732
835
  }
733
- function de({ points: e, timestamps: t, isStacked: n }) {
836
+ function me({ points: e, timestamps: t, isStacked: n }) {
734
837
  for (let [r, i] of e.entries()) {
735
838
  let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
736
839
  if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
@@ -739,8 +842,8 @@ function de({ points: e, timestamps: t, isStacked: n }) {
739
842
  }
740
843
  }
741
844
  // packages/charts/src/cartesian/time-series-line.tsx
742
- function fe({ series: e, x: t, y: n, inspectedTimestamp: r, pointRadius: i = 3 }) {
743
- return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(j, {
845
+ function he({ series: e, x: t, y: n, inspectedTimestamp: r, pointRadius: i = 3 }) {
846
+ return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(A, {
744
847
  data: [...e.points],
745
848
  defined: (e) => e.value !== null,
746
849
  x: (e) => t(e.timestamp),
@@ -759,8 +862,8 @@ function fe({ series: e, x: t, y: n, inspectedTimestamp: r, pointRadius: i = 3 }
759
862
  }, r.timestamp))] });
760
863
  }
761
864
  // packages/charts/src/cartesian/sparkline.tsx
762
- function pe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
763
- let o = x(), s = x(), c = me({
865
+ function ge({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
866
+ let o = x(), s = x(), c = _e({
764
867
  title: e,
765
868
  summary: t,
766
869
  unit: n,
@@ -775,12 +878,12 @@ function pe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
775
878
  children: c === void 0 ? "No data" : "Invalid trend"
776
879
  });
777
880
  let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = k({
778
- domain: [...le(u, d)],
881
+ domain: [...fe(u, d)],
779
882
  range: [3, 125]
780
883
  }), p = k({
781
884
  domain: [...a],
782
885
  range: [29, 3]
783
- }), m = ue([i], !1)[0];
886
+ }), m = pe([i], !1)[0];
784
887
  return /* @__PURE__ */ D("svg", {
785
888
  role: "img",
786
889
  "aria-labelledby": o,
@@ -813,7 +916,7 @@ function pe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
813
916
  "."
814
917
  ]
815
918
  }),
816
- m !== void 0 && /* @__PURE__ */ E(fe, {
919
+ m !== void 0 && /* @__PURE__ */ E(he, {
817
920
  series: m,
818
921
  x: f,
819
922
  y: p,
@@ -822,10 +925,10 @@ function pe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
822
925
  ]
823
926
  });
824
927
  }
825
- function me({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
928
+ function _e({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
826
929
  if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
827
930
  if (!p(i)) return "The displayed value domain must have finite, increasing bounds.";
828
- let a = se({
931
+ let a = ue({
829
932
  series: [r],
830
933
  isStacked: !1,
831
934
  markers: []
@@ -834,7 +937,7 @@ function me({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
834
937
  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.";
835
938
  }
836
939
  // packages/charts/src/cartesian/time-series.tsx
837
- var he = {
940
+ var ve = {
838
941
  plot: {
839
942
  k7Eaqz: "xeuugli",
840
943
  k3XXqK: "x1t137rt",
@@ -864,25 +967,25 @@ var he = {
864
967
  "--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
865
968
  }]
866
969
  };
867
- function ge(e) {
868
- return /* @__PURE__ */ E(ye, {
970
+ function ye(e) {
971
+ return /* @__PURE__ */ E(Se, {
869
972
  ...e,
870
973
  kind: "line",
871
974
  isStacked: !1
872
975
  });
873
976
  }
874
- function _e({ isStacked: e = !1, ...t }) {
875
- return /* @__PURE__ */ E(ye, {
977
+ function be({ isStacked: e = !1, ...t }) {
978
+ return /* @__PURE__ */ E(Se, {
876
979
  ...t,
877
980
  kind: "area",
878
981
  isStacked: e
879
982
  });
880
983
  }
881
- function ve({ charts: e, ...t }) {
984
+ function xe({ charts: e, ...t }) {
882
985
  let n = C(null), [r, i] = w(), a = JSON.stringify(e.map((e) => [
883
986
  e.id,
884
987
  e.title,
885
- ce({
988
+ de({
886
989
  series: e.series,
887
990
  markers: e.markers ?? [],
888
991
  timestampUnit: t.timestampUnit,
@@ -898,9 +1001,9 @@ function ve({ charts: e, ...t }) {
898
1001
  title: "Small multiples",
899
1002
  message: "Charts need unique identifiers and aligned observation timestamps."
900
1003
  });
901
- if (e.length > Q.panels) return /* @__PURE__ */ E(m, {
1004
+ if (e.length > $.panels) return /* @__PURE__ */ E(m, {
902
1005
  title: "Small multiples",
903
- message: `Choose at most ${Q.panels} panels.`
1006
+ message: `Choose at most ${$.panels} panels.`
904
1007
  });
905
1008
  if (e.length === 0) return /* @__PURE__ */ E(l, {
906
1009
  title: "Small multiples",
@@ -919,7 +1022,7 @@ function ve({ charts: e, ...t }) {
919
1022
  return /* @__PURE__ */ E("div", {
920
1023
  ref: n,
921
1024
  className: "xrvj5dj x1j825kq",
922
- children: e.map((e) => /* @__PURE__ */ E(ye, {
1025
+ children: e.map((e) => /* @__PURE__ */ E(Se, {
923
1026
  ...t,
924
1027
  title: e.title,
925
1028
  description: e.description,
@@ -933,35 +1036,35 @@ function ve({ charts: e, ...t }) {
933
1036
  }, e.id))
934
1037
  });
935
1038
  }
936
- function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimestamp: i, formatValue: a, markers: s = [], height: f = 180, actions: p, kind: g, isStacked: _, sharedInspection: O, axisWidth: ee }) {
937
- let j = !Number.isFinite(f) || f < 48 ? "Chart height must be at least 48 pixels." : se({
1039
+ function Se({ title: e, description: t, series: n, timestampUnit: r, formatTimestamp: i, formatValue: a, markers: s = [], height: f = 180, actions: p, kind: g, isStacked: _, sharedInspection: O, axisWidth: te }) {
1040
+ let A = !Number.isFinite(f) || f < 48 ? "Chart height must be at least 48 pixels." : ue({
938
1041
  series: n,
939
1042
  isStacked: _,
940
1043
  markers: s
941
- }), M = S(() => j === void 0 ? ue(n, _) : [], [
1044
+ }), j = S(() => A === void 0 ? pe(n, _) : [], [
942
1045
  n,
943
1046
  _,
944
- j
945
- ]), N = M[0]?.points ?? [], { ref: te, width: P, element: ne } = h(), F = C(null), [I, L] = w(), R = ce({
1047
+ A
1048
+ ]), M = j[0]?.points ?? [], { ref: ne, width: N, element: re } = h(), ie = C(null), [P, F] = w(), I = de({
946
1049
  series: n,
947
1050
  markers: s,
948
1051
  timestampUnit: r,
949
1052
  isStacked: _
950
- }), z = O === void 0 ? I?.signature === R ? I : void 0 : O.value, B = x();
951
- I !== void 0 && (I.signature !== R || j !== void 0) && L(void 0);
952
- let V = O !== void 0;
1053
+ }), L = O === void 0 ? P?.signature === I ? P : void 0 : O.value, ae = x();
1054
+ P !== void 0 && (P.signature !== I || A !== void 0) && F(void 0);
1055
+ let oe = O !== void 0;
953
1056
  if (b(() => {
954
- if (V) return;
1057
+ if (oe) return;
955
1058
  function e(e) {
956
- e.target instanceof Node && F.current?.contains(e.target) !== !0 && L(void 0);
1059
+ e.target instanceof Node && ie.current?.contains(e.target) !== !0 && F(void 0);
957
1060
  }
958
1061
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
959
- }, [V]), j !== void 0) return /* @__PURE__ */ E(m, {
1062
+ }, [oe]), A !== void 0) return /* @__PURE__ */ E(m, {
960
1063
  title: e,
961
1064
  description: t,
962
- message: j
1065
+ message: A
963
1066
  });
964
- if (N.length === 0) return /* @__PURE__ */ E(l, {
1067
+ if (M.length === 0) return /* @__PURE__ */ E(l, {
965
1068
  title: e,
966
1069
  description: t,
967
1070
  actions: p,
@@ -970,49 +1073,49 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
970
1073
  children: "No observations"
971
1074
  })
972
1075
  });
973
- let H = f - 28, U = H + 12, W = N[0]?.timestamp ?? 0, G = N.at(-1)?.timestamp ?? W, K = M.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), q = g === "area" ? Math.min(0, ...K) : Math.min(...K), re = g === "area" ? Math.max(0, ...K) : Math.max(...K), J = K.length === 0 ? 0 : q, ie = K.length === 0 ? 1 : re, Y = k({
974
- domain: [...le(J, ie, g === "area")],
975
- range: [H, 12]
976
- }), ae = Y.ticks(3), X = ee ?? Math.max(52, ...ae.map((e) => a(e).length * 7 + 12)), Z = Math.max(X + 1, P - 16), Q = k({
977
- domain: [...le(W, G)],
978
- range: [X, Z]
1076
+ let R = f - 28, se = R + 12, z = M[0]?.timestamp ?? 0, B = M.at(-1)?.timestamp ?? z, V = j.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), H = g === "area" ? Math.min(0, ...V) : Math.min(...V), U = g === "area" ? Math.max(0, ...V) : Math.max(...V), W = V.length === 0 ? 0 : H, G = V.length === 0 ? 1 : U, K = k({
1077
+ domain: [...fe(W, G, g === "area")],
1078
+ range: [R, 12]
1079
+ }), q = K.ticks(3), J = te ?? Math.max(52, ...q.map((e) => a(e).length * 7 + 12)), Y = Math.max(J + 1, N - 16), X = k({
1080
+ domain: [...fe(z, B)],
1081
+ range: [J, Y]
979
1082
  });
980
- function oe(e) {
981
- let t = ne?.getBoundingClientRect();
1083
+ function Z(e) {
1084
+ let t = re?.getBoundingClientRect();
982
1085
  if (t === void 0) return;
983
- let n = Q.invert(e - t.left), r = N.find((e, t) => {
984
- let r = N[t + 1];
1086
+ let n = X.invert(e - t.left), r = M.find((e, t) => {
1087
+ let r = M[t + 1];
985
1088
  return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
986
1089
  });
987
- r !== void 0 && $({
988
- signature: R,
1090
+ r !== void 0 && Q({
1091
+ signature: I,
989
1092
  timestamp: r.timestamp,
990
1093
  source: "pointer"
991
1094
  });
992
1095
  }
993
- function $(e) {
994
- O === void 0 ? L(e) : O.onChange(e);
1096
+ function Q(e) {
1097
+ O === void 0 ? F(e) : O.onChange(e);
995
1098
  }
996
- function de(e) {
1099
+ function $(e) {
997
1100
  if (e.altKey || e.ctrlKey || e.metaKey) return;
998
- let t = N.findIndex((e) => e.timestamp === z?.timestamp), n = {
999
- ArrowRight: Math.min(N.length - 1, t + 1),
1101
+ let t = M.findIndex((e) => e.timestamp === L?.timestamp), n = {
1102
+ ArrowRight: Math.min(M.length - 1, t + 1),
1000
1103
  ArrowLeft: Math.max(0, t - 1),
1001
1104
  Home: 0,
1002
- End: N.length - 1
1105
+ End: M.length - 1
1003
1106
  };
1004
1107
  switch (e.key) {
1005
1108
  case "Escape":
1006
- e.preventDefault(), e.stopPropagation(), $(void 0);
1109
+ e.preventDefault(), e.stopPropagation(), Q(void 0);
1007
1110
  break;
1008
1111
  case "ArrowRight":
1009
1112
  case "ArrowLeft":
1010
1113
  case "Home":
1011
1114
  case "End": {
1012
1115
  e.preventDefault();
1013
- let t = N[n[e.key]];
1014
- t !== void 0 && $({
1015
- signature: R,
1116
+ let t = M[n[e.key]];
1117
+ t !== void 0 && Q({
1118
+ signature: I,
1016
1119
  timestamp: t.timestamp,
1017
1120
  source: "keyboard"
1018
1121
  });
@@ -1021,7 +1124,7 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
1021
1124
  }
1022
1125
  }
1023
1126
  return /* @__PURE__ */ E("div", {
1024
- ref: F,
1127
+ ref: ie,
1025
1128
  className: "xeuugli",
1026
1129
  children: /* @__PURE__ */ D(l, {
1027
1130
  title: e,
@@ -1030,103 +1133,103 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
1030
1133
  children: [/* @__PURE__ */ D("div", {
1031
1134
  className: "xrvj5dj x1n8ia3y",
1032
1135
  children: [
1033
- /* @__PURE__ */ E(o, { items: M.map(({ id: e, label: t, tone: n }) => ({
1136
+ /* @__PURE__ */ E(o, { items: j.map(({ id: e, label: t, tone: n }) => ({
1034
1137
  id: e,
1035
1138
  label: t,
1036
1139
  tone: n
1037
1140
  })) }),
1038
1141
  /* @__PURE__ */ D("div", {
1039
- ref: te,
1142
+ ref: ne,
1040
1143
  ...y.props(c.plot),
1041
1144
  children: [/* @__PURE__ */ D("svg", {
1042
1145
  role: "img",
1043
1146
  "aria-label": `${e}. Use arrow keys to inspect observations.`,
1044
- "aria-describedby": B,
1147
+ "aria-describedby": ae,
1045
1148
  tabIndex: 0,
1046
- viewBox: `0 0 ${P} ${U}`,
1047
- height: U,
1048
- onKeyDown: de,
1149
+ viewBox: `0 0 ${N} ${se}`,
1150
+ height: se,
1151
+ onKeyDown: $,
1049
1152
  onPointerMove: (e) => {
1050
- e.pointerType === "mouse" && oe(e.clientX);
1153
+ e.pointerType === "mouse" && Z(e.clientX);
1051
1154
  },
1052
- onPointerDown: (e) => oe(e.clientX),
1053
- ...y.props(c.svg, he.plot),
1155
+ onPointerDown: (e) => Z(e.clientX),
1156
+ ...y.props(c.svg, ve.plot),
1054
1157
  children: [
1055
- ae.map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
1056
- x1: X,
1057
- x2: Z,
1058
- y1: Y(e),
1059
- y2: Y(e),
1158
+ q.map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
1159
+ x1: J,
1160
+ x2: Y,
1161
+ y1: K(e),
1162
+ y2: K(e),
1060
1163
  ...y.props(c.grid)
1061
1164
  }), /* @__PURE__ */ E("text", {
1062
- x: X - 8,
1063
- y: Y(e),
1165
+ x: J - 8,
1166
+ y: K(e),
1064
1167
  textAnchor: "end",
1065
1168
  dominantBaseline: "middle",
1066
1169
  ...y.props(c.label),
1067
1170
  children: a(e)
1068
1171
  })] }, e)),
1069
- M.map((e) => /* @__PURE__ */ D("g", { children: [g === "area" && /* @__PURE__ */ E(A, {
1172
+ j.map((e) => /* @__PURE__ */ D("g", { children: [g === "area" && /* @__PURE__ */ E(ee, {
1070
1173
  data: [...e.points],
1071
1174
  defined: (e) => e.value !== null,
1072
- x: (e) => Q(e.timestamp),
1073
- y0: (e) => Y(e.base),
1074
- y1: (e) => Y((e.value ?? 0) + e.base),
1075
- yScale: Y,
1175
+ x: (e) => X(e.timestamp),
1176
+ y0: (e) => K(e.base),
1177
+ y1: (e) => K((e.value ?? 0) + e.base),
1178
+ yScale: K,
1076
1179
  fill: u[e.tone],
1077
1180
  fillOpacity: _ ? .65 : .15
1078
- }), /* @__PURE__ */ E(fe, {
1181
+ }), /* @__PURE__ */ E(he, {
1079
1182
  series: e,
1080
- x: Q,
1081
- y: Y,
1082
- inspectedTimestamp: z?.timestamp
1183
+ x: X,
1184
+ y: K,
1185
+ inspectedTimestamp: L?.timestamp
1083
1186
  })] }, e.id)),
1084
1187
  s.map((e) => /* @__PURE__ */ D("g", { children: [e.kind === "time" ? /* @__PURE__ */ E("line", {
1085
- x1: Q(e.timestamp),
1086
- x2: Q(e.timestamp),
1188
+ x1: X(e.timestamp),
1189
+ x2: X(e.timestamp),
1087
1190
  y1: 12,
1088
- y2: H,
1191
+ y2: R,
1089
1192
  className: "xhq4mlf x1ntoi03 x13efnbd"
1090
1193
  }) : /* @__PURE__ */ E("circle", {
1091
- cx: Q(e.timestamp),
1092
- cy: Y(e.value + (M.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1194
+ cx: X(e.timestamp),
1195
+ cy: K(e.value + (j.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
1093
1196
  r: 4,
1094
1197
  fill: v.surface,
1095
1198
  ...y.props(c.selected)
1096
1199
  }), /* @__PURE__ */ E("title", { children: e.kind === "point" ? `${e.label}: ${a(e.value)}` : e.label })] }, e.id)),
1097
- z !== void 0 && /* @__PURE__ */ E("line", {
1098
- x1: Q(z.timestamp),
1099
- x2: Q(z.timestamp),
1200
+ L !== void 0 && /* @__PURE__ */ E("line", {
1201
+ x1: X(L.timestamp),
1202
+ x2: X(L.timestamp),
1100
1203
  y1: 12,
1101
- y2: H,
1204
+ y2: R,
1102
1205
  className: "xhq4mlf x1ntoi03 x13efnbd"
1103
1206
  })
1104
1207
  ]
1105
1208
  }), /* @__PURE__ */ D("div", {
1106
1209
  "aria-hidden": !0,
1107
- ...y.props(he.timeAxis, he.timeAxisInset(X, Math.max(0, P - Z))),
1210
+ ...y.props(ve.timeAxis, ve.timeAxisInset(J, Math.max(0, N - Y))),
1108
1211
  children: [/* @__PURE__ */ E("span", {
1109
1212
  className: "x1cqoux5 xeuugli xj0a0fe",
1110
- children: i(W)
1111
- }), G !== W && /* @__PURE__ */ E("span", {
1213
+ children: i(z)
1214
+ }), B !== z && /* @__PURE__ */ E("span", {
1112
1215
  className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
1113
- children: i(G)
1216
+ children: i(B)
1114
1217
  })]
1115
1218
  })]
1116
1219
  }),
1117
1220
  /* @__PURE__ */ E("div", {
1118
- id: B,
1119
- "aria-live": z?.source === "keyboard" ? "polite" : "off",
1221
+ id: ae,
1222
+ "aria-live": L?.source === "keyboard" ? "polite" : "off",
1120
1223
  className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xy8obcc xas2l8k x1mqbd49 xj0a0fe",
1121
- children: z === void 0 ? /* @__PURE__ */ E("span", {
1224
+ children: L === void 0 ? /* @__PURE__ */ E("span", {
1122
1225
  className: "x153jb6y",
1123
1226
  children: "Point, tap, or use the arrow keys to inspect values."
1124
1227
  }) : /* @__PURE__ */ D(T, { children: [
1125
- /* @__PURE__ */ E("span", { children: i(z.timestamp) }),
1228
+ /* @__PURE__ */ E("span", { children: i(L.timestamp) }),
1126
1229
  /* @__PURE__ */ E("dl", {
1127
1230
  className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp xeuugli",
1128
- children: M.map((e) => {
1129
- let t = e.points.find((e) => e.timestamp === z.timestamp);
1231
+ children: j.map((e) => {
1232
+ let t = e.points.find((e) => e.timestamp === L.timestamp);
1130
1233
  return /* @__PURE__ */ D("div", {
1131
1234
  className: "x78zum5 x1a02dak xunmzkg x1ghz6dp xeuugli xss6m8b",
1132
1235
  children: [/* @__PURE__ */ E("dt", { children: e.label }), /* @__PURE__ */ E("dd", {
@@ -1136,7 +1239,7 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
1136
1239
  }, e.id);
1137
1240
  })
1138
1241
  }),
1139
- s.filter((e) => e.timestamp === z.timestamp).map((e) => /* @__PURE__ */ E("span", { children: e.label }, e.id))
1242
+ s.filter((e) => e.timestamp === L.timestamp).map((e) => /* @__PURE__ */ E("span", { children: e.label }, e.id))
1140
1243
  ] })
1141
1244
  }),
1142
1245
  s.length > 0 && /* @__PURE__ */ E("ul", {
@@ -1161,16 +1264,16 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
1161
1264
  r,
1162
1265
  ")"
1163
1266
  ]
1164
- }), M.map((e) => /* @__PURE__ */ E("th", {
1267
+ }), j.map((e) => /* @__PURE__ */ E("th", {
1165
1268
  scope: "col",
1166
1269
  className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
1167
1270
  children: e.label
1168
1271
  }, e.id))] }) }),
1169
- /* @__PURE__ */ E("tbody", { children: N.map((e, t) => /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ E("th", {
1272
+ /* @__PURE__ */ E("tbody", { children: M.map((e, t) => /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ E("th", {
1170
1273
  scope: "row",
1171
1274
  className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
1172
1275
  children: i(e.timestamp)
1173
- }), M.map((e) => /* @__PURE__ */ E("td", {
1276
+ }), j.map((e) => /* @__PURE__ */ E("td", {
1174
1277
  className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
1175
1278
  children: e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : a(e.points[t].value)
1176
1279
  }, e.id))] }, e.timestamp)) })
@@ -1179,4 +1282,4 @@ function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimes
1179
1282
  })
1180
1283
  });
1181
1284
  }
1182
- export { _e as AreaChart, R as BarChart, F as BarChartPlaceholder, H as BreakdownBar, ge as LineChart, q as MAX_SCATTER_POINTS, ie as ScatterPlot, ve as SmallMultiples, pe as Sparkline, Q as timeSeriesLimits };
1285
+ export { be as AreaChart, oe as BarChart, I as BarChartPlaceholder, B as BreakdownBar, ye as LineChart, G as MAX_SCATTER_POINTS, J as ScatterPlot, xe as SmallMultiples, ge as Sparkline, $ as timeSeriesLimits };