@lilt-ui/charts 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/activity-ring.d.ts +3 -2
  3. package/dist/cards/activity-ring-card.d.ts +3 -2
  4. package/dist/cards/cartesian-card.d.ts +15 -2
  5. package/dist/cards/funnel-chart-card.d.ts +3 -2
  6. package/dist/cards/heatmap-chart-card.d.ts +3 -2
  7. package/dist/cards/horizontal-bar-chart-card.d.ts +3 -2
  8. package/dist/cards/progress-card.d.ts +3 -2
  9. package/dist/cards/radar-chart-card.d.ts +3 -2
  10. package/dist/cards/radial-chart-card.d.ts +4 -2
  11. package/dist/cards/sankey-chart-card.d.ts +3 -2
  12. package/dist/cards/scatter-chart-card.d.ts +3 -2
  13. package/dist/cards/slope-chart-card.d.ts +3 -2
  14. package/dist/cards/stat-card.d.ts +3 -2
  15. package/dist/chart-context.d.ts +8 -1
  16. package/dist/chart.d.ts +1 -1
  17. package/dist/engine/decimate.d.ts +25 -0
  18. package/dist/finance/cards/depth-chart-card.d.ts +3 -2
  19. package/dist/finance/order-book.d.ts +4 -2
  20. package/dist/finance.js +467 -404
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +2488 -2080
  23. package/dist/lifecycle/loading-layer.d.ts +14 -3
  24. package/dist/lifecycle/skeleton-block.d.ts +6 -0
  25. package/dist/lifecycle/skeleton-sheen.d.ts +15 -2
  26. package/dist/lifecycle/use-skeleton-clock.d.ts +5 -0
  27. package/dist/marks/contract.d.ts +15 -0
  28. package/dist/marks/range-loading-mark.d.ts +3 -0
  29. package/dist/primitives/depth-paint.d.ts +5 -1
  30. package/dist/primitives/runoff.d.ts +6 -7
  31. package/dist/{report-context-Cz0AYdV2.js → report-context-CkzH-r8B.js} +130 -129
  32. package/dist/{cartesian-card-7DAiMU3w.js → skeleton-block-C110l-2a.js} +2223 -1856
  33. package/dist/styles.css +1 -1
  34. package/dist/types.d.ts +14 -0
  35. package/dist/watch.js +1 -1
  36. package/package.json +1 -1
@@ -1,16 +1,17 @@
1
1
  import { createContext as e, useContext as t, useEffect as n, useLayoutEffect as r, useMemo as i, useRef as a, useState as o } from "react";
2
2
  import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
3
  import { AnimatePresence as u, animate as d, motion as f, useMotionValue as p, useMotionValueEvent as m, useReducedMotion as h, useTransform as g } from "motion/react";
4
- import { animate as _ } from "motion";
5
- import v from "@number-flow/react";
4
+ import { extent as _, min as v } from "d3-array";
5
+ import { animate as y } from "motion";
6
+ import ee from "@number-flow/react";
6
7
  //#region src/motion/use-chart-motion.ts
7
- var y = [
8
+ var b = [
8
9
  .22,
9
10
  1,
10
11
  .36,
11
12
  1
12
13
  ];
13
- function b(e) {
14
+ function x(e) {
14
15
  let [t, r] = o(!1);
15
16
  return n(() => {
16
17
  if (typeof window > "u" || !window.matchMedia) return;
@@ -18,7 +19,7 @@ function b(e) {
18
19
  return t(), e.addEventListener?.("change", t), () => e.removeEventListener?.("change", t);
19
20
  }, []), e === "none" || t;
20
21
  }
21
- function x(e, t) {
22
+ function S(e, t) {
22
23
  let [n, i] = o(e.active ? +!!t : 1), s = a(e.key), c = e.active && e.key !== s.current;
23
24
  return r(() => {
24
25
  if (s.current = e.key, !e.active || t) {
@@ -26,9 +27,9 @@ function x(e, t) {
26
27
  return;
27
28
  }
28
29
  i(0);
29
- let n = _(0, 1, {
30
+ let n = y(0, 1, {
30
31
  duration: e.duration / 1e3,
31
- ease: y,
32
+ ease: b,
32
33
  onUpdate: (e) => i(e),
33
34
  onComplete: () => i(1)
34
35
  });
@@ -42,15 +43,15 @@ function x(e, t) {
42
43
  }
43
44
  //#endregion
44
45
  //#region src/interaction/pin-glyphs.tsx
45
- var S = "M9 4.5h6l-1 5 3 3v2H7v-2l3-3-1-5ZM12 14.5v7";
46
- function C({ release: e }) {
46
+ var C = "M9 4.5h6l-1 5 3 3v2H7v-2l3-3-1-5ZM12 14.5v7";
47
+ function w({ release: e }) {
47
48
  return /* @__PURE__ */ c("svg", {
48
49
  className: e ? "lilt-chart__pin-glyph lilt-chart__pin-glyph--release" : "lilt-chart__pin-glyph",
49
50
  viewBox: "0 0 24 24",
50
51
  fill: "none",
51
52
  "aria-hidden": "true",
52
53
  children: /* @__PURE__ */ c("path", {
53
- d: e ? `${S}M4.5 5.5l15 15` : S,
54
+ d: e ? `${C}M4.5 5.5l15 15` : C,
54
55
  stroke: "currentColor",
55
56
  strokeLinecap: "round",
56
57
  strokeLinejoin: "round",
@@ -58,18 +59,18 @@ function C({ release: e }) {
58
59
  })
59
60
  });
60
61
  }
61
- function w({ release: e = !1 }) {
62
- return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(C, {}), e ? /* @__PURE__ */ c(C, { release: !0 }) : null] });
62
+ function T({ release: e = !1 }) {
63
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(w, {}), e ? /* @__PURE__ */ c(w, { release: !0 }) : null] });
63
64
  }
64
65
  //#endregion
65
66
  //#region src/motion/number-format.ts
66
- var T = /* @__PURE__ */ new WeakMap();
67
- function E(e) {
67
+ var E = /* @__PURE__ */ new WeakMap();
68
+ function D(e) {
68
69
  let t = (t) => e.format(t);
69
- return T.set(t, e), t;
70
+ return E.set(t, e), t;
70
71
  }
71
- function D(e) {
72
- return e instanceof Intl.NumberFormat ? e : T.get(e);
72
+ function te(e) {
73
+ return e instanceof Intl.NumberFormat ? e : E.get(e);
73
74
  }
74
75
  //#endregion
75
76
  //#region src/motion/animated-number.tsx
@@ -81,7 +82,7 @@ var O = /\p{Decimal_Number}/u, k = /* @__PURE__ */ new Set([
81
82
  "nan",
82
83
  "infinity"
83
84
  ]);
84
- function ee(e, t) {
85
+ function A(e, t) {
85
86
  let n = [];
86
87
  if (t?.length && t.map((e) => e.value).join("") === e) {
87
88
  let e = t.findIndex((e) => k.has(e.type)), r = t.length - 1 - [...t].reverse().findIndex((e) => k.has(e.type)), i = t.filter((e) => e.type === "integer").reduce((e, t) => e + Array.from(t.value).length, 0), a = 0, o = /* @__PURE__ */ new Map();
@@ -132,15 +133,15 @@ function ee(e, t) {
132
133
  place: n.length - 1 - t
133
134
  }));
134
135
  }
135
- function A(e, t) {
136
+ function ne(e, t) {
136
137
  let [n, r] = String(t).toLowerCase().split("e"), i = n.split(".")[1]?.length ?? 0, a = Number(r ?? 0), o = Math.min(10, Math.max(0, i - a)), s = Number(e.toFixed(o));
137
138
  return Object.is(s, -0) ? 0 : s;
138
139
  }
139
- function te(e, t, n) {
140
+ function re(e, t, n) {
140
141
  let r = ((t - e) % 10 + 10) % 10;
141
142
  return r === 0 ? e : n > 0 ? e + r : e - (10 - r);
142
143
  }
143
- var ne = 240, j = .16, M = {
144
+ var ie = 240, j = .16, M = {
144
145
  duration: .1,
145
146
  ease: "easeOut"
146
147
  }, N = [
@@ -148,13 +149,13 @@ var ne = 240, j = .16, M = {
148
149
  1,
149
150
  .3,
150
151
  1
151
- ], re = {
152
+ ], P = {
152
153
  type: "spring",
153
154
  stiffness: 420,
154
155
  damping: 34,
155
156
  mass: .7
156
- }, P = (e) => Math.min(e, 6) * .024;
157
- function F({ cell: e, change: t, style: n }) {
157
+ }, F = (e) => Math.min(e, 6) * .024;
158
+ function I({ cell: e, change: t, style: n }) {
158
159
  let r = n === "slide" ? .72 : 0;
159
160
  return /* @__PURE__ */ c("span", {
160
161
  className: "lilt-number__cell",
@@ -201,8 +202,8 @@ function F({ cell: e, change: t, style: n }) {
201
202
  duration: j,
202
203
  ease: N
203
204
  } : {
204
- delay: P(e.place),
205
- y: re,
205
+ delay: F(e.place),
206
+ y: P,
206
207
  default: {
207
208
  duration: .26,
208
209
  ease: N
@@ -213,20 +214,20 @@ function F({ cell: e, change: t, style: n }) {
213
214
  })
214
215
  });
215
216
  }
216
- var I = Array.from({ length: 30 }, (e, t) => String(t % 10));
217
- function ie({ cell: e, change: t }) {
217
+ var L = Array.from({ length: 30 }, (e, t) => String(t % 10));
218
+ function ae({ cell: e, change: t }) {
218
219
  let r = Number(e.char), i = p(10 + r), o = a(t);
219
220
  o.current = t, n(() => {
220
221
  let t = i.get();
221
222
  (t < 5 || t >= 25) && (t = 10 + (t % 10 + 10) % 10, i.jump(t));
222
- let { direction: n, live: a } = o.current, s = te(t, r, n);
223
+ let { direction: n, live: a } = o.current, s = re(t, r, n);
223
224
  if (s === t) return;
224
225
  let c = d(i, s, {
225
226
  type: "spring",
226
227
  stiffness: a ? 320 : 190,
227
228
  damping: a ? 32 : 26,
228
229
  mass: .9,
229
- delay: a ? 0 : P(e.place),
230
+ delay: a ? 0 : F(e.place),
230
231
  onComplete: () => i.jump(10 + r)
231
232
  });
232
233
  return () => c.stop();
@@ -235,7 +236,7 @@ function ie({ cell: e, change: t }) {
235
236
  r,
236
237
  i
237
238
  ]);
238
- let s = g(i, (e) => `${-e / I.length * 100}%`);
239
+ let s = g(i, (e) => `${-e / L.length * 100}%`);
239
240
  return /* @__PURE__ */ l("span", {
240
241
  className: "lilt-number__cell lilt-number__cell--reel",
241
242
  "data-digit": !0,
@@ -246,18 +247,18 @@ function ie({ cell: e, change: t }) {
246
247
  }), /* @__PURE__ */ c(f.span, {
247
248
  className: "lilt-number__reel",
248
249
  style: { y: s },
249
- children: I.map((e, t) => /* @__PURE__ */ c("span", { children: e }, t))
250
+ children: L.map((e, t) => /* @__PURE__ */ c("span", { children: e }, t))
250
251
  })]
251
252
  });
252
253
  }
253
- var L = "0123456789";
254
- function R({ cell: e, live: t }) {
254
+ var oe = "0123456789";
255
+ function se({ cell: e, live: t }) {
255
256
  let [r, i] = o(null), s = a(e.char), l = a(t);
256
257
  return l.current = t, n(() => {
257
258
  if (s.current === e.char) return;
258
259
  s.current = e.char;
259
260
  let t = 0, n = l.current ? 2 : 5 + Math.min(e.place, 6), r = window.setInterval(() => {
260
- t += 1, i(t >= n ? null : L[Math.floor(Math.random() * 10)]), t >= n && window.clearInterval(r);
261
+ t += 1, i(t >= n ? null : oe[Math.floor(Math.random() * 10)]), t >= n && window.clearInterval(r);
261
262
  }, 36);
262
263
  return () => {
263
264
  window.clearInterval(r), i(null);
@@ -272,7 +273,7 @@ function R({ cell: e, live: t }) {
272
273
  })
273
274
  });
274
275
  }
275
- function z({ cell: e }) {
276
+ function R({ cell: e }) {
276
277
  return /* @__PURE__ */ c("span", {
277
278
  className: "lilt-number__cell",
278
279
  "data-digit": e.digit || void 0,
@@ -282,12 +283,12 @@ function z({ cell: e }) {
282
283
  })
283
284
  });
284
285
  }
285
- var B = [
286
+ var z = [
286
287
  .34,
287
288
  1.45,
288
289
  .64,
289
290
  1
290
- ], ae = {
291
+ ], ce = {
291
292
  enter: (e) => e ? {
292
293
  y: "16%",
293
294
  opacity: .4,
@@ -302,7 +303,7 @@ var B = [
302
303
  opacity: 1,
303
304
  filter: "blur(0px)"
304
305
  }
305
- }, oe = { leave: (e) => e ? {
306
+ }, le = { leave: (e) => e ? {
306
307
  y: "-16%",
307
308
  opacity: 0,
308
309
  transition: M
@@ -315,7 +316,7 @@ var B = [
315
316
  ease: N
316
317
  }
317
318
  } };
318
- function se({ cells: e, live: t }) {
319
+ function ue({ cells: e, live: t }) {
319
320
  let n = e.map((e) => e.char).join("");
320
321
  return /* @__PURE__ */ c("span", {
321
322
  className: "lilt-number__pop-host",
@@ -325,21 +326,21 @@ function se({ cells: e, live: t }) {
325
326
  custom: t,
326
327
  children: /* @__PURE__ */ c(f.span, {
327
328
  className: "lilt-number__pop",
328
- variants: oe,
329
+ variants: le,
329
330
  initial: "enter",
330
331
  animate: "visible",
331
332
  exit: "leave",
332
333
  children: e.map((e, n) => /* @__PURE__ */ c(f.span, {
333
334
  className: "lilt-number__pop-char",
334
335
  custom: t,
335
- variants: ae,
336
+ variants: ce,
336
337
  transition: t ? {
337
338
  duration: .22,
338
- ease: B
339
+ ease: z
339
340
  } : {
340
341
  duration: .5,
341
342
  delay: Math.min(n, 2) * .07,
342
- ease: B
343
+ ease: z
343
344
  },
344
345
  children: e.char
345
346
  }, n))
@@ -347,7 +348,7 @@ function se({ cells: e, live: t }) {
347
348
  })
348
349
  });
349
350
  }
350
- function ce(e, t, r) {
351
+ function de(e, t, r) {
351
352
  let i = p(e), s = a(r);
352
353
  s.current = r;
353
354
  let [c, l] = o(e);
@@ -365,9 +366,9 @@ function ce(e, t, r) {
365
366
  t,
366
367
  i,
367
368
  e
368
- ]), t ? A(c, e) : e;
369
+ ]), t ? ne(c, e) : e;
369
370
  }
370
- function le(e) {
371
+ function B(e) {
371
372
  let [t, n] = o({
372
373
  value: e,
373
374
  at: 0,
@@ -380,7 +381,7 @@ function le(e) {
380
381
  value: e,
381
382
  at: r,
382
383
  direction: e >= t.value ? 1 : -1,
383
- live: r - t.at < ne
384
+ live: r - t.at < ie
384
385
  });
385
386
  }
386
387
  return {
@@ -389,24 +390,24 @@ function le(e) {
389
390
  };
390
391
  }
391
392
  function V({ value: e, format: t = String, className: n, motion: r = "auto", variant: a = "count" }) {
392
- let o = !h() && r !== "none", d = D(t), p = (e) => t instanceof Intl.NumberFormat ? t.format(e) : t(e), m = (e) => ee(p(e), d?.formatToParts(e)), g = a === "flow" && !d ? "slide" : a, _ = i(() => {
393
+ let o = !h() && r !== "none", d = te(t), p = (e) => t instanceof Intl.NumberFormat ? t.format(e) : t(e), m = (e) => A(p(e), d?.formatToParts(e)), g = a === "flow" && !d ? "slide" : a, _ = i(() => {
393
394
  if (!d) return;
394
395
  let { locale: e, ...t } = d.resolvedOptions();
395
396
  return {
396
397
  locale: e,
397
398
  options: t
398
399
  };
399
- }, [d]), y = p(e), b = le(e), x = ce(e, o && g === "count", b.live), S = ["lilt-number", n].filter(Boolean).join(" ");
400
+ }, [d]), v = p(e), y = B(e), b = de(e, o && g === "count", y.live), x = ["lilt-number", n].filter(Boolean).join(" ");
400
401
  if (g === "flow" && _) return /* @__PURE__ */ l("span", {
401
- className: S,
402
+ className: x,
402
403
  "data-variant": "flow",
403
404
  children: [/* @__PURE__ */ c("span", {
404
405
  className: "lilt-chart__sr-only",
405
- children: y
406
+ children: v
406
407
  }), /* @__PURE__ */ c("span", {
407
408
  "aria-hidden": "true",
408
409
  className: "lilt-number__flow",
409
- children: /* @__PURE__ */ c(v, {
410
+ children: /* @__PURE__ */ c(ee, {
410
411
  value: e,
411
412
  locales: _.locale,
412
413
  format: _.options,
@@ -415,31 +416,31 @@ function V({ value: e, format: t = String, className: n, motion: r = "auto", var
415
416
  })
416
417
  })]
417
418
  });
418
- let C = m(g === "count" ? x : e), w = (e) => o ? e.role === "number" ? g === "count" ? /* @__PURE__ */ c(z, { cell: e }) : g === "roll" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ c(ie, {
419
+ let S = m(g === "count" ? b : e), C = (e) => o ? e.role === "number" ? g === "count" ? /* @__PURE__ */ c(R, { cell: e }) : g === "roll" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ c(ae, {
419
420
  cell: e,
420
- change: b
421
- }) : /* @__PURE__ */ c(F, {
421
+ change: y
422
+ }) : /* @__PURE__ */ c(I, {
422
423
  cell: e,
423
- change: b,
424
+ change: y,
424
425
  style: "fade"
425
- }) : g === "scramble" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ c(R, {
426
+ }) : g === "scramble" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ c(se, {
426
427
  cell: e,
427
- live: b.live
428
- }) : /* @__PURE__ */ c(F, {
428
+ live: y.live
429
+ }) : /* @__PURE__ */ c(I, {
429
430
  cell: e,
430
- change: b,
431
+ change: y,
431
432
  style: "fade"
432
- }) : /* @__PURE__ */ c(F, {
433
+ }) : /* @__PURE__ */ c(I, {
433
434
  cell: e,
434
- change: b,
435
+ change: y,
435
436
  style: "slide"
436
- }) : /* @__PURE__ */ c(F, {
437
+ }) : /* @__PURE__ */ c(I, {
437
438
  cell: e,
438
- change: b,
439
+ change: y,
439
440
  style: "fade"
440
- }) : /* @__PURE__ */ c(z, { cell: e }), T = (e) => /* @__PURE__ */ c(f.span, {
441
+ }) : /* @__PURE__ */ c(R, { cell: e }), w = (e) => /* @__PURE__ */ c(f.span, {
441
442
  className: "lilt-number__place",
442
- custom: b.live,
443
+ custom: y.live,
443
444
  initial: o ? {
444
445
  width: 0,
445
446
  opacity: 0
@@ -453,36 +454,36 @@ function V({ value: e, format: t = String, className: n, motion: r = "auto", var
453
454
  opacity: 0
454
455
  } : void 0,
455
456
  transition: {
456
- duration: b.live ? j : .32,
457
+ duration: y.live ? j : .32,
457
458
  ease: N
458
459
  },
459
- children: w(e)
460
- }, e.key), E = g === "pop" && o, O = C.filter((e) => e.role === "prefix"), k = C.filter((e) => e.role === "number"), A = C.filter((e) => e.role === "suffix");
460
+ children: C(e)
461
+ }, e.key), T = g === "pop" && o, E = S.filter((e) => e.role === "prefix"), D = S.filter((e) => e.role === "number"), O = S.filter((e) => e.role === "suffix");
461
462
  return /* @__PURE__ */ l("span", {
462
- className: S,
463
+ className: x,
463
464
  "data-variant": a,
464
465
  children: [/* @__PURE__ */ c("span", {
465
466
  className: "lilt-chart__sr-only",
466
- children: y
467
+ children: v
467
468
  }), /* @__PURE__ */ c("span", {
468
469
  "aria-hidden": "true",
469
470
  className: "lilt-number__characters",
470
- children: E ? /* @__PURE__ */ l(s, { children: [
471
+ children: T ? /* @__PURE__ */ l(s, { children: [
471
472
  /* @__PURE__ */ c(u, {
472
473
  initial: !1,
473
- children: O.map(T)
474
+ children: E.map(w)
474
475
  }),
475
- /* @__PURE__ */ c(se, {
476
- cells: k,
477
- live: b.live
476
+ /* @__PURE__ */ c(ue, {
477
+ cells: D,
478
+ live: y.live
478
479
  }),
479
480
  /* @__PURE__ */ c(u, {
480
481
  initial: !1,
481
- children: A.map(T)
482
+ children: O.map(w)
482
483
  })
483
484
  ] }) : /* @__PURE__ */ c(u, {
484
485
  initial: !1,
485
- children: C.map(T)
486
+ children: S.map(w)
486
487
  })
487
488
  })]
488
489
  });
@@ -494,7 +495,7 @@ function U(...e) {
494
495
  return e.filter(Boolean).join(" ");
495
496
  }
496
497
  var W = e(null);
497
- function ue({ children: e, surface: n = "elevated", palette: r, motion: i, numberStyle: a = "count", badge: o, className: s, style: u, "aria-label": d }) {
498
+ function fe({ children: e, surface: n = "elevated", palette: r, motion: i, numberStyle: a = "count", badge: o, className: s, style: u, "aria-label": d }) {
498
499
  let f = t(W), p = f?.badge ?? o, m = p != null && p !== !1, h = m || f !== null, g = {
499
500
  "data-lilt-chart": "",
500
501
  "data-lilt-palette": r,
@@ -532,7 +533,7 @@ function G({ children: e, className: t }) {
532
533
  children: e
533
534
  });
534
535
  }
535
- function de({ children: e, aside: t, className: n }) {
536
+ function pe({ children: e, aside: t, className: n }) {
536
537
  return /* @__PURE__ */ l("header", {
537
538
  className: U("lilt-card__header", n),
538
539
  children: [/* @__PURE__ */ c("div", {
@@ -544,13 +545,13 @@ function de({ children: e, aside: t, className: n }) {
544
545
  }) : null]
545
546
  });
546
547
  }
547
- function fe({ children: e }) {
548
+ function me({ children: e }) {
548
549
  return /* @__PURE__ */ c("p", {
549
550
  className: "lilt-card__title",
550
551
  children: e
551
552
  });
552
553
  }
553
- function pe({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
554
+ function he({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
554
555
  let o = t(H);
555
556
  return /* @__PURE__ */ l("div", {
556
557
  className: "lilt-card__value-row",
@@ -569,8 +570,8 @@ function pe({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
569
570
  }), r]
570
571
  });
571
572
  }
572
- var me = (e) => `${e >= 0 ? "+" : ""}${(e * 100).toFixed(1)}%`;
573
- function K({ value: e, tone: t = "default", format: n = me }) {
573
+ var ge = (e) => `${e >= 0 ? "+" : ""}${(e * 100).toFixed(1)}%`;
574
+ function _e({ value: e, tone: t = "default", format: n = ge }) {
574
575
  let r = e > 0 ? "up" : e < 0 ? "down" : "flat";
575
576
  return /* @__PURE__ */ c("span", {
576
577
  className: "lilt-card__delta",
@@ -578,13 +579,13 @@ function K({ value: e, tone: t = "default", format: n = me }) {
578
579
  children: n(e)
579
580
  });
580
581
  }
581
- function he({ children: e }) {
582
+ function ve({ children: e }) {
582
583
  return /* @__PURE__ */ c("span", {
583
584
  className: "lilt-card__caption",
584
585
  children: e
585
586
  });
586
587
  }
587
- function ge({ label: e, options: t, value: n, onValueChange: r }) {
588
+ function ye({ label: e, options: t, value: n, onValueChange: r }) {
588
589
  return !t || t.length < 2 ? /* @__PURE__ */ c("span", {
589
590
  className: "lilt-card__range",
590
591
  children: e ?? t?.[0]?.label
@@ -614,26 +615,26 @@ function ge({ label: e, options: t, value: n, onValueChange: r }) {
614
615
  }
615
616
  //#endregion
616
617
  //#region src/watch/engine/robust.ts
617
- function q(e) {
618
+ function K(e) {
618
619
  if (e.length === 0) return null;
619
620
  let t = [...e].sort((e, t) => e - t), n = t.length >> 1;
620
621
  return t.length % 2 == 1 ? t[n] : (t[n - 1] + t[n]) / 2;
621
622
  }
622
- function _e(e, t) {
623
- let n = q(e.map((e) => Math.abs(e - t)));
623
+ function be(e, t) {
624
+ let n = K(e.map((e) => Math.abs(e - t)));
624
625
  return n === null ? 0 : n * 1.4826;
625
626
  }
626
627
  //#endregion
627
628
  //#region src/watch/engine/normal.ts
628
- var J = 1440, ve = 256, ye = 12;
629
- function be({ data: e, x: t, value: n, normal: r }) {
629
+ var q = 1440, xe = 256, Se = 12;
630
+ function Ce({ data: e, x: t, value: n, normal: r }) {
630
631
  let i = (e, t) => {
631
632
  let n = e[t];
632
633
  return typeof n == "number" && Number.isFinite(n) ? n : null;
633
634
  }, a = e.map((e) => i(e, n));
634
635
  if (r.around !== void 0 && r.tolerance === void 0) throw Error("Lilt Charts: `normal.around` needs a `tolerance`.");
635
636
  if (r.given !== void 0 && r.learn === void 0) throw Error("Lilt Charts: `normal.given` needs `learn`.");
636
- let o = r.learn === void 0 ? null : we(r.learn), s = o ? Te(e, t, o) : null, c = r.given === void 0 ? null : De(r.given, e, i), l = /* @__PURE__ */ new Map(), u = [], d = Object.entries(r.rules ?? {}).map(([e, t]) => typeof t == "function" ? {
637
+ let o = r.learn === void 0 ? null : De(r.learn), s = o ? Oe(e, t, o) : null, c = r.given === void 0 ? null : Z(r.given, e, i), l = /* @__PURE__ */ new Map(), u = [], d = Object.entries(r.rules ?? {}).map(([e, t]) => typeof t == "function" ? {
637
638
  id: e,
638
639
  test: t
639
640
  } : {
@@ -650,36 +651,36 @@ function be({ data: e, x: t, value: n, normal: r }) {
650
651
  h = {
651
652
  lower: e ?? null,
652
653
  upper: t ?? null
653
- }, p && f !== null && (t !== void 0 && f > t && m.push(Y("limit", "max", n, "above", t, f, X(t))), e !== void 0 && f < e && m.push(Y("limit", "min", n, "below", e, f, X(e))));
654
+ }, p && f !== null && (t !== void 0 && f > t && m.push(J("limit", "max", n, "above", t, f, Y(t))), e !== void 0 && f < e && m.push(J("limit", "min", n, "below", e, f, Y(e))));
654
655
  }
655
656
  if (r.around !== void 0 && r.tolerance !== void 0) {
656
657
  let e = i(t, r.around);
657
658
  if (e !== null) {
658
- let t = xe(r.tolerance, e), n = {
659
+ let t = we(r.tolerance, e), n = {
659
660
  lower: e - t,
660
661
  upper: e + t
661
662
  };
662
- if (h = Z(h, n), g = e, p && f !== null) {
663
+ if (h = X(h, n), g = e, p && f !== null) {
663
664
  let e = r.aroundSeverity ?? "warning";
664
- f > n.upper ? m.push(Y("around", "around", e, "above", n.upper, f, t)) : f < n.lower && m.push(Y("around", "around", e, "below", n.lower, f, t));
665
+ f > n.upper ? m.push(J("around", "around", e, "above", n.upper, f, t)) : f < n.lower && m.push(J("around", "around", e, "below", n.lower, f, t));
665
666
  }
666
667
  }
667
668
  }
668
669
  if (o && s) {
669
- let e = Oe(s(t), c ? c(t) : ""), r = e === null ? void 0 : l.get(e), i = r?.values;
670
+ let e = Ae(s(t), c ? c(t) : ""), r = e === null ? void 0 : l.get(e), i = r?.values;
670
671
  if (r && i && i.length >= o.minSamples) {
671
- let e = q(i);
672
+ let e = K(i);
672
673
  _ = [...r.rows];
673
- let t = u.length >= ye ? q(u) * 1.4826 : 0, n = Math.max(_e(i, e), Math.abs(e) * Math.max(t, .02), 1e-9) * o.width, a = {
674
+ let t = u.length >= Se ? K(u) * 1.4826 : 0, n = Math.max(be(i, e), Math.abs(e) * Math.max(t, .02), 1e-9) * o.width, a = {
674
675
  lower: e - n,
675
676
  upper: e + n
676
677
  };
677
- h = Z(h, a), g = e, p && f !== null && (f > a.upper ? m.push(Y("learned", "learned", o.severity, "above", a.upper, f, n)) : f < a.lower && m.push(Y("learned", "learned", o.severity, "below", a.lower, f, n)));
678
+ h = X(h, a), g = e, p && f !== null && (f > a.upper ? m.push(J("learned", "learned", o.severity, "above", a.upper, f, n)) : f < a.lower && m.push(J("learned", "learned", o.severity, "below", a.lower, f, n)));
678
679
  }
679
680
  if (e !== null && p && f !== null) {
680
681
  if (g !== null && i && i.length >= o.minSamples) {
681
- let e = q(i);
682
- e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length > ve && u.shift());
682
+ let e = K(i);
683
+ e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length > xe && u.shift());
683
684
  }
684
685
  let t = l.get(e) ?? {
685
686
  values: [],
@@ -715,7 +716,7 @@ function be({ data: e, x: t, value: n, normal: r }) {
715
716
  };
716
717
  });
717
718
  }
718
- function Y(e, t, n, r, i, a, o) {
719
+ function J(e, t, n, r, i, a, o) {
719
720
  return {
720
721
  source: e,
721
722
  id: t,
@@ -725,19 +726,19 @@ function Y(e, t, n, r, i, a, o) {
725
726
  score: 1 + Math.abs(a - i) / Math.max(o, 1e-9)
726
727
  };
727
728
  }
728
- var X = (e) => e === 0 ? 1 : Math.abs(e) * .1;
729
- function xe(e, t) {
729
+ var Y = (e) => e === 0 ? 1 : Math.abs(e) * .1;
730
+ function we(e, t) {
730
731
  return typeof e == "number" ? Math.abs(e) : Math.abs(t) * Math.abs(Number.parseFloat(e)) / 100;
731
732
  }
732
- function Z(e, t) {
733
- let n = Se(e.lower, t.lower), r = Ce(e.upper, t.upper);
733
+ function X(e, t) {
734
+ let n = Te(e.lower, t.lower), r = Ee(e.upper, t.upper);
734
735
  return n !== null && r !== null && n > r ? e : {
735
736
  lower: n,
736
737
  upper: r
737
738
  };
738
739
  }
739
- var Se = (e, t) => e === null ? t : t === null ? e : Math.max(e, t), Ce = (e, t) => e === null ? t : t === null ? e : Math.min(e, t);
740
- function we(e) {
740
+ var Te = (e, t) => e === null ? t : t === null ? e : Math.max(e, t), Ee = (e, t) => e === null ? t : t === null ? e : Math.min(e, t);
741
+ function De(e) {
741
742
  return {
742
743
  width: 3,
743
744
  history: 8,
@@ -747,7 +748,7 @@ function we(e) {
747
748
  ...typeof e == "string" ? { period: e } : e
748
749
  };
749
750
  }
750
- function Te(e, t, n) {
751
+ function Oe(e, t, n) {
751
752
  if (n.period === "all") return () => "all";
752
753
  let r = (e) => {
753
754
  let r = e[t];
@@ -755,7 +756,7 @@ function Te(e, t, n) {
755
756
  if (typeof r == "number" && Number.isFinite(r)) return r;
756
757
  if (r == null) return null;
757
758
  throw Error(`Lilt Charts: learning by '${n.period}' needs dates or epoch milliseconds in '${t}'.`);
758
- }, i = n.slotMinutes ?? Ee(e.map(r));
759
+ }, i = n.slotMinutes ?? ke(e.map(r));
759
760
  return (e) => {
760
761
  let t = r(e);
761
762
  if (t === null) return null;
@@ -763,39 +764,39 @@ function Te(e, t, n) {
763
764
  return n.period === "week" ? `${a.getUTCDay()}:${s}` : String(s);
764
765
  };
765
766
  }
766
- function Ee(e) {
767
+ function ke(e) {
767
768
  let t = e.filter((e) => e !== null), n = [];
768
769
  for (let e = 1; e < t.length; e += 1) {
769
770
  let r = t[e] - t[e - 1];
770
771
  r > 0 && n.push(r);
771
772
  }
772
- let r = q(n);
773
- return r === null ? J : Math.min(J, Math.max(1, Math.round(r / 6e4)));
773
+ let r = K(n);
774
+ return r === null ? q : Math.min(q, Math.max(1, Math.round(r / 6e4)));
774
775
  }
775
- function De(e, t, n) {
776
+ function Z(e, t, n) {
776
777
  let { key: r, step: i } = typeof e == "string" ? {
777
778
  key: e,
778
779
  step: void 0
779
780
  } : e, a = i;
780
781
  if (a === void 0) {
781
- let e = t.map((e) => n(e, r)).filter((e) => e !== null), i = e.length > 0 ? Math.max(...e) - Math.min(...e) : 0;
782
- a = i > 0 ? i / 8 : 1;
782
+ let e = t.map((e) => n(e, r)).filter((e) => e !== null), [i, o] = _(e), s = i === void 0 || o === void 0 ? 0 : o - i;
783
+ a = s > 0 ? s / 8 : 1;
783
784
  }
784
785
  return (e) => {
785
786
  let t = n(e, r);
786
787
  return t === null ? null : String(Math.floor(t / a));
787
788
  };
788
789
  }
789
- function Oe(e, t) {
790
+ function Ae(e, t) {
790
791
  return e === null || t === null ? null : t === "" ? e : `${e}|${t}`;
791
792
  }
792
793
  //#endregion
793
794
  //#region src/watch/engine/status.ts
794
- function ke(e, { enter: t = 2, exit: n = 3 } = {}) {
795
+ function je(e, { enter: t = 2, exit: n = 3 } = {}) {
795
796
  let r = [], i = !1, a = null, o = null, s = [], c = 0, l = 0, u = 0, d = 0, f = [];
796
797
  for (let p of e) {
797
798
  let e = p.flags.length > 0;
798
- p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a = Ae(f), c = Math.max(...f.map((e) => e.score)), s = p.flags, r.push({
799
+ p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a = Me(f), c = Math.max(...f.map((e) => e.score)), s = p.flags, r.push({
799
800
  type: "activated",
800
801
  index: p.index,
801
802
  severity: a,
@@ -819,10 +820,10 @@ function ke(e, { enter: t = 2, exit: n = 3 } = {}) {
819
820
  events: r
820
821
  };
821
822
  }
822
- var Ae = (e) => e.some((e) => e.severity === "critical") ? "critical" : "warning";
823
+ var Me = (e) => e.some((e) => e.severity === "critical") ? "critical" : "warning";
823
824
  //#endregion
824
825
  //#region src/watch/engine/describe.ts
825
- function je(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
826
+ function Ne(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
826
827
  let r = e.direction === "above";
827
828
  switch (e.source) {
828
829
  case "limit": return `${r ? "Above max" : "Below min"} ${t(e.bound)}`;
@@ -861,11 +862,11 @@ function Q(e, t) {
861
862
  };
862
863
  }
863
864
  var $ = (e) => typeof e == "number" && Number.isFinite(e);
864
- function Me({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
865
+ function Pe({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
865
866
  if (!n.length) return null;
866
867
  let a = {}, o = {}, s = (e, t, n) => {
867
868
  e[t] !== null && (e[t] = n === null ? null : (e[t] ?? 0) + n);
868
- }, c = Math.min(...n), l = [];
869
+ }, c = v(n) ?? Infinity, l = [];
869
870
  for (let e = c - 1; e >= 0 && l.length < i; --e) {
870
871
  let n = t[e];
871
872
  n?.judged && n.value !== null && n.flags.length === 0 && l.push(e);
@@ -876,12 +877,12 @@ function Me({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
876
877
  let c = r(n), u = (t[i]?.basis?.length ? t[i].basis : l).map((t) => r(e[t])), d = /* @__PURE__ */ new Set([...Object.keys(c), ...u.flatMap(Object.keys)]);
877
878
  for (let e of d) {
878
879
  let t = c[e];
879
- s(a, e, $(t) ? t : null), s(o, e, q(u.map((t) => t[e]).filter($)));
880
+ s(a, e, $(t) ? t : null), s(o, e, K(u.map((t) => t[e]).filter($)));
880
881
  }
881
882
  }
882
883
  return Q(a, o);
883
884
  }
884
- function Ne(e, { lead: t = .5 } = {}) {
885
+ function Fe(e, { lead: t = .5 } = {}) {
885
886
  if (!e || e.delta === 0) return null;
886
887
  let [n, r] = e.parts;
887
888
  if (!n || n.share <= 0) return null;
@@ -890,6 +891,6 @@ function Ne(e, { lead: t = .5 } = {}) {
890
891
  }
891
892
  //#endregion
892
893
  //#region src/watch/board/report-context.ts
893
- var Pe = e(null);
894
+ var Ie = e(null);
894
895
  //#endregion
895
- export { b as S, V as _, je as a, y as b, G as c, he as d, K as f, pe as g, fe as h, Me as i, W as l, ge as m, Ne as n, ke as o, de as p, Q as r, be as s, Pe as t, ue as u, E as v, x, w as y };
896
+ export { x as S, V as _, Ne as a, b, G as c, ve as d, _e as f, he as g, me as h, Pe as i, W as l, ye as m, Fe as n, je as o, pe as p, Q as r, Ce as s, Ie as t, fe as u, D as v, S as x, T as y };