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