@canplot/react 0.1.12 → 0.1.13

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.
package/dist/canplot.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsxs as lt, jsx as _, Fragment as _t } from "react/jsx-runtime";
2
- import Z, { createContext as vt, useContext as J, useRef as D, useLayoutEffect as N, useEffect as wt, version as Rt, forwardRef as At, useMemo as Q, useState as V, useId as Ut } from "react";
2
+ import Z, { createContext as vt, useContext as J, useRef as U, useLayoutEffect as N, useEffect as wt, version as Rt, forwardRef as At, useMemo as Q, useState as V, useId as Ut } from "react";
3
3
  import { createStore as bt, useStore as St } from "zustand";
4
4
  const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e) => s + (e ?? 0), 0), ue = (t, s) => {
5
5
  let e = 0;
@@ -7,9 +7,9 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
7
7
  Math.abs(t[o] - s) < Math.abs(t[e] - s) && (e = o);
8
8
  return e;
9
9
  }, Dt = (t, s, e, o) => {
10
- const { min: n, max: c, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = (a === "x" ? r.width : r.height) / (c - n);
10
+ const { min: n, max: c, origin: a } = L(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = (a === "x" ? r.width : r.height) / (c - n);
11
11
  return s / d;
12
- }, I = (t, s) => {
12
+ }, L = (t, s) => {
13
13
  const e = t.scales.find((o) => o.id === s);
14
14
  if (!e)
15
15
  throw new Error(`Scale ${s} not found`);
@@ -18,10 +18,10 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
18
18
  const e = window.devicePixelRatio || 1;
19
19
  t.lineCap = s?.lineCap ?? "butt", t.lineDashOffset = e * (s?.lineDashOffset ?? 0), t.lineJoin = s?.lineJoin ?? "miter", t.lineWidth = e * (s?.lineWidth ?? 1), t.miterLimit = e * (s?.miterLimit ?? 10), t.strokeStyle = s?.strokeStyle ?? "black", t.fillStyle = s?.fillStyle ?? t.strokeStyle, t.font = s?.font ?? `${10 * e}px sans-serif`, t.textAlign = s?.textAlign ?? "start", t.direction = s?.direction ?? "inherit", t.textBaseline = s?.textBaseline ?? "alphabetic", t.fontKerning = s?.fontKerning ?? "auto";
20
20
  }, ut = (t, s, e, o) => {
21
- const n = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: c, max: a, origin: r } = I(t, e), d = (r === "x" ? n.width : n.height) / (a - c);
21
+ const n = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: c, max: a, origin: r } = L(t, e), d = (r === "x" ? n.width : n.height) / (a - c);
22
22
  return s * d;
23
23
  }, H = (t, s, e, o) => {
24
- const { min: n, origin: c } = I(t, e), a = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, r = ut(t, s - n, e, o);
24
+ const { min: n, origin: c } = L(t, e), a = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, r = ut(t, s - n, e, o);
25
25
  return c === "x" ? j(
26
26
  a.x + r,
27
27
  a.x - 10 * a.width,
@@ -32,19 +32,19 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
32
32
  a.y + 11 * a.height
33
33
  );
34
34
  }, de = (t, s, e) => {
35
- const { min: o, max: n } = I(t, e);
35
+ const { min: o, max: n } = L(t, e);
36
36
  return j(s, o, n);
37
- }, O = (t, s, e) => {
37
+ }, Y = (t, s, e) => {
38
38
  const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
39
39
  return j(s, o.x, o.x + o.width);
40
- }, B = (t, s, e) => {
40
+ }, O = (t, s, e) => {
41
41
  const o = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
42
42
  return j(s, o.y, o.y + o.height);
43
43
  }, rt = (t, s, e) => {
44
- const { min: o, max: n } = I(t, e);
44
+ const { min: o, max: n } = L(t, e);
45
45
  return s >= o && s <= n;
46
- }, L = (t, s, e, o) => {
47
- const { min: n, max: c, origin: a } = I(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = a === "x" ? (s - r.x) / r.width : (r.height - s + r.y) / r.height;
46
+ }, D = (t, s, e, o) => {
47
+ const { min: n, max: c, origin: a } = L(t, e), r = o === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = a === "x" ? (s - r.x) / r.width : (r.height - s + r.y) / r.height;
48
48
  return n + d * (c - n);
49
49
  }, Lt = (t) => {
50
50
  const { ctx: s, scales: e } = t;
@@ -80,8 +80,8 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
80
80
  _frame: null,
81
81
  getFrame: e,
82
82
  getCtx: () => e().ctx,
83
- clampXPosToChartArea: (o, n) => O(e(), o, n ?? "canvas"),
84
- clampYPosToChartArea: (o, n) => B(e(), o, n ?? "canvas"),
83
+ clampXPosToChartArea: (o, n) => Y(e(), o, n ?? "canvas"),
84
+ clampYPosToChartArea: (o, n) => O(e(), o, n ?? "canvas"),
85
85
  valToPos: (o, n, c) => H(e(), o, n, c ?? "canvas"),
86
86
  valToPxDistance: (o, n, c) => ut(
87
87
  e(),
@@ -90,18 +90,18 @@ const j = (t, s, e) => Math.min(Math.max(t, s), e), le = (t) => t.reduce((s, e)
90
90
  c ?? "canvas"
91
91
  ),
92
92
  valFits: (o, n) => rt(e(), o, n),
93
- getScale: (o) => I(e(), o)
93
+ getScale: (o) => L(e(), o)
94
94
  };
95
95
  }), Xt = () => bt((t) => ({
96
96
  notify: () => {
97
97
  t((s) => ({ version: s.version + 1 }));
98
98
  },
99
99
  version: 0
100
- })), dt = vt(null), Ct = vt(null), Y = (t, s) => {
100
+ })), dt = vt(null), Ct = vt(null), z = (t, s) => {
101
101
  const e = J(dt), o = J(Ct);
102
102
  if (!e || !o)
103
103
  throw new Error("useFrame must be used within a CanPlot component");
104
- const n = D(t);
104
+ const n = U(t);
105
105
  n.current = t, N(() => {
106
106
  n.current(e.getState()), e.subscribe((c) => {
107
107
  c._frame && n.current(c);
@@ -142,7 +142,7 @@ function at(t, s) {
142
142
  }
143
143
  var zt = parseInt(Rt.split(".")[0], 10) >= 19 ? Ft : Kt;
144
144
  const he = At(({ configuration: t, children: s, style: e, className: o }, n) => {
145
- const c = D(null), a = D(null), r = Ot(a), d = Q(It, []), u = Q(Xt, []);
145
+ const c = U(null), a = U(null), r = Ot(a), d = Q(It, []), u = Q(Xt, []);
146
146
  N(() => {
147
147
  d.setState({
148
148
  _frame: Bt(t, r, c.current)
@@ -315,7 +315,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
315
315
  };
316
316
  }, $t = (t) => {
317
317
  t.ctx.clearRect(0, 0, t.ctx.canvas.width, t.ctx.canvas.height), Lt(t);
318
- }, fe = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (Y(
318
+ }, fe = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (z(
319
319
  ({ getCtx: n, clampXPosToChartArea: c, clampYPosToChartArea: a, valToPos: r }) => {
320
320
  const d = n();
321
321
  d.save(), d.beginPath(), R(d, o);
@@ -326,7 +326,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
326
326
  d.stroke(), d.restore();
327
327
  },
328
328
  [t, s, e, o]
329
- ), null), me = ({ data: t, xScaleId: s, yScaleId: e, radius: o = 5, style: n }) => (Y(({ getCtx: c, valToPos: a, valFits: r }) => {
329
+ ), null), me = ({ data: t, xScaleId: s, yScaleId: e, radius: o = 5, style: n }) => (z(({ getCtx: c, valToPos: a, valFits: r }) => {
330
330
  const d = c();
331
331
  d.save(), d.beginPath(), R(d, n);
332
332
  for (const u of t) {
@@ -344,7 +344,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
344
344
  barWidth: n,
345
345
  xPositionOffset: c,
346
346
  radius: a
347
- }) => (Y(
347
+ }) => (z(
348
348
  ({
349
349
  getCtx: r,
350
350
  valToPxDistance: d,
@@ -370,7 +370,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
370
370
  m.closePath(), m.fill(), o?.strokeStyle && m.stroke(), m.restore();
371
371
  },
372
372
  [t, s, e, o, n, c, a]
373
- ), null), ye = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (Y(({ getCtx: n, clampXPosToChartArea: c, clampYPosToChartArea: a, valToPos: r }) => {
373
+ ), null), ye = ({ data: t, xScaleId: s, yScaleId: e, style: o }) => (z(({ getCtx: n, clampXPosToChartArea: c, clampYPosToChartArea: a, valToPos: r }) => {
374
374
  const d = [];
375
375
  for (const l of t) {
376
376
  const p = c(r(l.x, s)), m = a(r(l.y[0], e)), f = a(r(l.y[1], e));
@@ -383,7 +383,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
383
383
  u.lineTo(l.x, l.y);
384
384
  u.closePath(), u.fill(), u.restore();
385
385
  }
386
- }, [t, s, e, o]), null), xe = ({ data: t, stroked: s, xScaleId: e, yScaleId: o, style: n }) => (Y(
386
+ }, [t, s, e, o]), null), xe = ({ data: t, stroked: s, xScaleId: e, yScaleId: o, style: n }) => (z(
387
387
  ({ getCtx: c, clampXPosToChartArea: a, clampYPosToChartArea: r, valToPos: d }) => {
388
388
  const u = [], l = c();
389
389
  for (const i of t) {
@@ -434,7 +434,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
434
434
  }
435
435
  return r;
436
436
  }
437
- ), ve = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (Y(
437
+ ), ve = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (z(
438
438
  ({ getCtx: a, valToPos: r, getScale: d, getFrame: u }) => {
439
439
  const l = a(), p = d(t);
440
440
  if (!p || !p.axis || p.origin !== "x") return;
@@ -462,7 +462,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
462
462
  l.restore();
463
463
  },
464
464
  [c, t, s, e]
465
- ), null), we = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (Y(
465
+ ), null), we = ({ scaleId: t, tickStyle: s, labelStyle: e, labelGap: o, tickSize: n, ticks: c }) => (z(
466
466
  ({ getCtx: a, valToPos: r, getScale: d, getFrame: u }) => {
467
467
  const l = a(), p = d(t);
468
468
  if (!p || !p.axis || p.origin !== "y") return;
@@ -538,13 +538,13 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
538
538
  return;
539
539
  const r = t.clientX - s.left, d = {
540
540
  scaleId: c,
541
- value: L(e, r, c, "css")
541
+ value: D(e, r, c, "css")
542
542
  }, u = t.clientY - s.top, l = {
543
543
  scaleId: a,
544
- value: L(e, u, a, "css")
544
+ value: D(e, u, a, "css")
545
545
  };
546
546
  return { pointerSyncPosition: { x: d, y: l }, cssX: r, cssY: u };
547
- }, z = (t, s) => {
547
+ }, F = (t, s) => {
548
548
  const e = t.x ? H(
549
549
  s,
550
550
  t.x.value,
@@ -562,7 +562,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
562
562
  scaled: Object.fromEntries(
563
563
  s.scales.map((n) => {
564
564
  const c = n.origin === "y" ? o : e;
565
- return [n.id, L(s, c, n.id, "css")];
565
+ return [n.id, D(s, c, n.id, "css")];
566
566
  })
567
567
  )
568
568
  };
@@ -581,7 +581,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
581
581
  (a) => {
582
582
  if (a.origin !== t)
583
583
  return [];
584
- const r = L(e, o, a.id, "css"), d = L(e, n, a.id, "css");
584
+ const r = D(e, o, a.id, "css"), d = D(e, n, a.id, "css");
585
585
  return [
586
586
  {
587
587
  scaleId: a.id,
@@ -640,9 +640,9 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
640
640
  m
641
641
  ] });
642
642
  }, Vt = ({ className: t, style: s, sync: e }) => {
643
- const o = D(null), n = ht(), c = D(n);
643
+ const o = U(null), n = ht(), c = U(n);
644
644
  c.current = n;
645
- const a = J(ft), r = e?.key || a, d = D(null), u = D(null), l = D(null), p = () => {
645
+ const a = J(ft), r = e?.key || a, d = U(null), u = U(null), l = U(null), p = () => {
646
646
  const i = o.current?.parentElement;
647
647
  if (i) {
648
648
  if (i.dataset.canplotroot === void 0)
@@ -669,7 +669,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
669
669
  metaKey: i.metaKey
670
670
  }
671
671
  );
672
- }, f = D(m);
672
+ }, f = U(m);
673
673
  return f.current = m, wt(() => {
674
674
  const i = (g) => {
675
675
  const v = u.current;
@@ -715,44 +715,44 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
715
715
  (v, { cssX: T, cssY: b }, C) => {
716
716
  const k = d.current;
717
717
  if (!k || !v.x || !v.y) return;
718
- const A = c.current, P = k.xRangeCss.start, $ = T, F = k.yRangeCss.start, st = b, nt = I(A, v.x.scaleId), ot = I(A, v.y.scaleId);
718
+ const A = c.current, P = k.xRangeCss.start, B = T, K = k.yRangeCss.start, st = b, nt = L(A, v.x.scaleId), ot = L(A, v.y.scaleId);
719
719
  d.current = {
720
- xRangeCss: { start: P, end: $ },
721
- yRangeCss: { start: F, end: st }
720
+ xRangeCss: { start: P, end: B },
721
+ yRangeCss: { start: K, end: st }
722
722
  };
723
- let U = "below_threshold";
724
- const ct = Math.abs(F - st), it = Math.abs(P - $);
725
- ct < 10 && it < 10 ? U = "below_threshold" : ct > 30 && it > 30 ? U = "box" : ct > it ? U = "y" : U = "x";
726
- const Mt = U === "x" || U === "box" ? {
723
+ let $ = "below_threshold";
724
+ const ct = Math.abs(K - st), it = Math.abs(P - B);
725
+ ct < 10 && it < 10 ? $ = "below_threshold" : ct > 30 && it > 30 ? $ = "box" : ct > it ? $ = "y" : $ = "x";
726
+ const Mt = {
727
727
  scaleId: nt.id,
728
- from: L(
728
+ from: D(
729
729
  A,
730
- O(c.current, P, "css"),
730
+ Y(c.current, P, "css"),
731
731
  nt.id,
732
732
  "css"
733
733
  ),
734
- to: L(
734
+ to: D(
735
735
  A,
736
- O(c.current, $, "css"),
736
+ Y(c.current, B, "css"),
737
737
  nt.id,
738
738
  "css"
739
739
  )
740
- } : void 0, Pt = U === "y" || U === "box" ? {
740
+ }, Pt = {
741
741
  scaleId: ot.id,
742
- from: L(
742
+ from: D(
743
743
  A,
744
- B(c.current, F, "css"),
744
+ O(c.current, K, "css"),
745
745
  ot.id,
746
746
  "css"
747
747
  ),
748
- to: L(
748
+ to: D(
749
749
  A,
750
- B(c.current, st, "css"),
750
+ O(c.current, st, "css"),
751
751
  ot.id,
752
752
  "css"
753
753
  )
754
- } : void 0, yt = {
755
- mode: U,
754
+ }, yt = {
755
+ mode: $,
756
756
  xRange: Mt,
757
757
  yRange: Pt,
758
758
  completed: !1,
@@ -787,7 +787,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
787
787
  document.removeEventListener("mouseup", i), document.removeEventListener("keydown", h), document.removeEventListener("keyup", h), document.removeEventListener("mousemove", y), w?.removeEventListener("wheel", x);
788
788
  };
789
789
  }, [c, r, f]), M("sync_dblclick", r, (i) => {
790
- const h = z(
790
+ const h = F(
791
791
  i.positions,
792
792
  c.current
793
793
  );
@@ -797,7 +797,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
797
797
  keys: i.keys
798
798
  });
799
799
  }), M("sync_click", r, (i) => {
800
- const h = z(
800
+ const h = F(
801
801
  i.positions,
802
802
  c.current
803
803
  );
@@ -807,7 +807,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
807
807
  keys: i.keys
808
808
  });
809
809
  }), M("sync_contextmenu", r, (i) => {
810
- const h = z(
810
+ const h = F(
811
811
  i.positions,
812
812
  c.current
813
813
  );
@@ -817,7 +817,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
817
817
  keys: i.keys
818
818
  });
819
819
  }), M("sync_move", r, (i) => {
820
- const h = i.positions ? z(
820
+ const h = i.positions ? F(
821
821
  i.positions,
822
822
  c.current
823
823
  ) : null;
@@ -827,7 +827,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
827
827
  keys: i.keys
828
828
  });
829
829
  }), M("sync_mousedown", r, (i) => {
830
- const h = z(
830
+ const h = F(
831
831
  i.positions,
832
832
  c.current
833
833
  );
@@ -837,7 +837,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
837
837
  keys: i.keys
838
838
  });
839
839
  }), M("sync_mouseup", r, (i) => {
840
- const h = z(
840
+ const h = F(
841
841
  i.positions,
842
842
  c.current
843
843
  );
@@ -850,7 +850,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
850
850
  "sync_pressandwheel",
851
851
  r,
852
852
  (i) => {
853
- const h = z(
853
+ const h = F(
854
854
  i.positions,
855
855
  c.current
856
856
  );
@@ -1022,7 +1022,7 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1022
1022
  c(l);
1023
1023
  }), !n)
1024
1024
  return null;
1025
- const { frame: a, pointer: r } = n, d = O(a, r?.cssX ?? 0, "css"), u = B(a, r?.cssY ?? 0, "css");
1025
+ const { frame: a, pointer: r } = n, d = Y(a, r?.cssX ?? 0, "css"), u = O(a, r?.cssY ?? 0, "css");
1026
1026
  return /* @__PURE__ */ lt(_t, { children: [
1027
1027
  /* @__PURE__ */ _(
1028
1028
  "div",
@@ -1072,19 +1072,19 @@ const he = At(({ configuration: t, children: s, style: e, className: o }, n) =>
1072
1072
  const n = Q(() => {
1073
1073
  if (!e || e.mode === "below_threshold")
1074
1074
  return null;
1075
- const c = O(
1075
+ const c = Y(
1076
1076
  e.frame,
1077
1077
  e.x.css?.from ?? -1 / 0,
1078
1078
  "css"
1079
- ), a = O(
1079
+ ), a = Y(
1080
1080
  e.frame,
1081
1081
  e.x.css?.to ?? 1 / 0,
1082
1082
  "css"
1083
- ), r = B(
1083
+ ), r = O(
1084
1084
  e.frame,
1085
1085
  e.y.css?.from ?? -1 / 0,
1086
1086
  "css"
1087
- ), d = B(
1087
+ ), d = O(
1088
1088
  e.frame,
1089
1089
  e.y.css?.to ?? 1 / 0,
1090
1090
  "css"
@@ -1238,7 +1238,7 @@ const qt = 1, Et = 1e3 * qt, pt = 60 * Et, tt = 60 * pt, et = 24 * tt, Gt = 30 *
1238
1238
  }, gt = (t, s) => {
1239
1239
  const e = new Date(t);
1240
1240
  return e.setUTCMonth(e.getUTCMonth() + s), e.getTime();
1241
- }, K = (t, s) => {
1241
+ }, X = (t, s) => {
1242
1242
  const [e, o] = s;
1243
1243
  switch (o) {
1244
1244
  case "milliseconds":
@@ -1297,7 +1297,7 @@ const oe = (t, s, e = "UTC") => {
1297
1297
  case "days":
1298
1298
  case "months":
1299
1299
  case "years":
1300
- n === "months" ? c.setUTCDate(1) : n === "years" && c.setUTCMonth(0, 1), a(), c.getTime() < t && (c = new Date(K(c, [1, n])));
1300
+ n === "months" ? c.setUTCDate(1) : n === "years" && c.setUTCMonth(0, 1), a(), c.getTime() < t && (c = new Date(X(c, [1, n])));
1301
1301
  break;
1302
1302
  }
1303
1303
  return c.getTime();
@@ -1318,15 +1318,15 @@ const oe = (t, s, e = "UTC") => {
1318
1318
  case "seconds":
1319
1319
  case "minutes":
1320
1320
  case "hours": {
1321
- x = K(i, [y.length * m, f]);
1321
+ x = X(i, [y.length * m, f]);
1322
1322
  break;
1323
1323
  }
1324
1324
  case "days": {
1325
- const w = K(i, [
1325
+ const w = X(i, [
1326
1326
  y.length * m,
1327
1327
  f
1328
1328
  ]);
1329
- x = K(w, [
1329
+ x = X(w, [
1330
1330
  h - G(w, t),
1331
1331
  "hours"
1332
1332
  ]);
@@ -1334,14 +1334,14 @@ const oe = (t, s, e = "UTC") => {
1334
1334
  }
1335
1335
  case "months":
1336
1336
  case "years": {
1337
- const w = K(
1338
- K(K(i, [h, "hours"]), [
1337
+ const w = X(
1338
+ X(X(i, [h, "hours"]), [
1339
1339
  y.length * m,
1340
1340
  f
1341
1341
  ]),
1342
1342
  [-h, "hours"]
1343
1343
  );
1344
- x = K(w, [
1344
+ x = X(w, [
1345
1345
  h - G(w, t),
1346
1346
  "hours"
1347
1347
  ]);
@@ -1357,7 +1357,7 @@ const oe = (t, s, e = "UTC") => {
1357
1357
  showTimezone: n,
1358
1358
  timeZone: t
1359
1359
  }))(y);
1360
- }, X = (t, s, e) => t.find((o) => o.type === e)?.value !== s.find((o) => o.type === e)?.value, ce = ({
1360
+ }, I = (t, s, e) => t.find((o) => o.type === e)?.value !== s.find((o) => o.type === e)?.value, ce = ({
1361
1361
  timeZone: t = kt,
1362
1362
  locale: s = Ht,
1363
1363
  showTimezone: e = !0
@@ -1377,15 +1377,15 @@ const oe = (t, s, e = "UTC") => {
1377
1377
  return (n) => {
1378
1378
  const c = n[1] - n[0], a = c < q([1, "days"]), r = c < q([1, "minutes"]), d = c < q([1, "seconds"]);
1379
1379
  return n.map((u) => ({ value: u, label: o.formatToParts(new Date(u)) })).map((u, l, p) => {
1380
- const m = p[l - 1], f = l === 0 || X(u.label, m.label, "year"), i = l === 0 || X(u.label, m.label, "day"), h = l === 0 || X(u.label, m.label, "month"), y = l === 0 || X(u.label, m.label, "hour"), x = l === 0 || X(u.label, m.label, "timeZoneName"), w = l === 0 || X(u.label, m.label, "minute"), g = l === 0 || X(u.label, m.label, "second"), v = l === 0 || X(u.label, m.label, "fractionalSecond"), T = [];
1380
+ const m = p[l - 1], f = l === 0 || I(u.label, m.label, "year"), i = l === 0 || I(u.label, m.label, "day"), h = l === 0 || I(u.label, m.label, "month"), y = l === 0 || I(u.label, m.label, "hour"), x = l === 0 || I(u.label, m.label, "timeZoneName"), w = l === 0 || I(u.label, m.label, "minute"), g = l === 0 || I(u.label, m.label, "second"), v = l === 0 || I(u.label, m.label, "fractionalSecond"), T = [];
1381
1381
  if (a && (y || w || x || g || v)) {
1382
1382
  const b = u.label.find((P) => P.type === "hour")?.value, C = u.label.find((P) => P.type === "minute")?.value, k = u.label.find((P) => P.type === "timeZoneName")?.value;
1383
1383
  let A = "";
1384
1384
  if (r) {
1385
- const P = u.label.find((F) => F.type === "second")?.value, $ = u.label.find(
1386
- (F) => F.type === "fractionalSecond"
1385
+ const P = u.label.find((K) => K.type === "second")?.value, B = u.label.find(
1386
+ (K) => K.type === "fractionalSecond"
1387
1387
  )?.value;
1388
- A = `:${P}` + (d ? `.${$}` : "");
1388
+ A = `:${P}` + (d ? `.${B}` : "");
1389
1389
  }
1390
1390
  T.push(
1391
1391
  `${b}:${C}${A}` + (e && x ? ` ${k}` : "")
@@ -1421,18 +1421,18 @@ export {
1421
1421
  R as applyStyles,
1422
1422
  j as clamp,
1423
1423
  de as clampUnfit,
1424
- O as clampXPosToChartArea,
1425
- B as clampYPosToChartArea,
1424
+ Y as clampXPosToChartArea,
1425
+ O as clampYPosToChartArea,
1426
1426
  Wt as defaultNumericalTicksFormatter,
1427
1427
  ue as findClosestIndex,
1428
- I as getScale,
1428
+ L as getScale,
1429
1429
  Ee as makeLinearTicks,
1430
1430
  ce as makeTimeTickFormat,
1431
1431
  Me as makeTimeTicks,
1432
- L as posToVal,
1432
+ D as posToVal,
1433
1433
  Dt as pxToValDistance,
1434
1434
  le as sum,
1435
- Y as useDrawEffect,
1435
+ z as useDrawEffect,
1436
1436
  ht as useFrameState,
1437
1437
  mt as useInteractionsEvent,
1438
1438
  ge as useXPositioned,