@canplot/react 0.5.1 → 0.5.2

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,57 +1,57 @@
1
- var Ke = Object.defineProperty;
2
- var Ye = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var F = (e, t, n) => Ye(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsxs as pe, jsx as R, Fragment as Be } from "react/jsx-runtime";
5
- import D, { version as ze, createContext as ye, forwardRef as Ne, useRef as A, useState as B, useMemo as Z, useLayoutEffect as $, useCallback as $e, useContext as q, useId as je, useEffect as Ve } from "react";
6
- const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n) => t + (n ?? 0), 0), At = (e, t) => {
1
+ var Ye = Object.defineProperty;
2
+ var Be = (e, t, n) => t in e ? Ye(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var F = (e, t, n) => Be(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsxs as pe, jsx as R, Fragment as ze } from "react/jsx-runtime";
5
+ import D, { version as Ne, createContext as ye, forwardRef as $e, useRef as k, useState as B, useMemo as Z, useLayoutEffect as $, useCallback as je, useContext as q, useId as Ve, useEffect as He } from "react";
6
+ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n) => t + (n ?? 0), 0), Rt = (e, t) => {
7
7
  let n = 0;
8
8
  for (let s = 0; s < e.length; s++)
9
9
  Math.abs(e[s] - t) < Math.abs(e[n] - t) && (n = s);
10
10
  return n;
11
- }, He = (e, t, n, s) => {
11
+ }, We = (e, t, n, s) => {
12
12
  const o = X(e, n);
13
13
  if (!o)
14
14
  return null;
15
- const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = (o.origin === "x" ? i.width : i.height) / (o.max - o.min);
16
- return t / r;
15
+ const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = (o.origin === "x" ? r.width : r.height) / (o.max - o.min);
16
+ return t / i;
17
17
  }, X = (e, t) => e.scales.find((n) => n.id === t) ?? null, U = (e, t) => {
18
18
  const n = window.devicePixelRatio || 1;
19
19
  e.lineCap = t?.lineCap ?? "butt", e.lineDashOffset = n * (t?.lineDashOffset ?? 0), e.lineJoin = t?.lineJoin ?? "miter", e.lineWidth = n * (t?.lineWidth ?? 1), e.miterLimit = n * (t?.miterLimit ?? 10), e.strokeStyle = t?.strokeStyle ?? "black", e.fillStyle = t?.fillStyle ?? e.strokeStyle, e.font = t?.font ?? `${10 * n}px sans-serif`, e.textAlign = t?.textAlign ?? "start", e.direction = t?.direction ?? "inherit", e.textBaseline = t?.textBaseline ?? "alphabetic", e.fontKerning = t?.fontKerning ?? "auto";
20
20
  }, ge = (e, t, n, s) => {
21
- const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = X(e, n);
22
- if (!i)
21
+ const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = X(e, n);
22
+ if (!r)
23
23
  return null;
24
- const r = (i.origin === "x" ? o.width : o.height) / (i.max - i.min);
25
- return t * r;
24
+ const i = (r.origin === "x" ? o.width : o.height) / (r.max - r.min);
25
+ return t * i;
26
26
  }, G = (e, t, n, s) => {
27
27
  const o = X(e, n);
28
28
  if (!o)
29
29
  return null;
30
- const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = ge(
30
+ const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = ge(
31
31
  e,
32
32
  t - o.min,
33
33
  n,
34
34
  s
35
35
  );
36
- return r === null ? null : o.origin === "x" ? ie(
37
- i.x + r,
38
- i.x - 10 * i.width,
39
- i.x + 11 * i.width
40
- ) : ie(
41
- i.y + i.height - r,
42
- i.y - 10 * i.height,
43
- i.y + 11 * i.height
36
+ return i === null ? null : o.origin === "x" ? re(
37
+ r.x + i,
38
+ r.x - 10 * r.width,
39
+ r.x + 11 * r.width
40
+ ) : re(
41
+ r.y + r.height - i,
42
+ r.y - 10 * r.height,
43
+ r.y + 11 * r.height
44
44
  );
45
45
  }, V = (e, t, n) => {
46
46
  if (t === null)
47
47
  return null;
48
48
  const s = n === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS;
49
- return ie(t, s.x, s.x + s.width);
49
+ return re(t, s.x, s.x + s.width);
50
50
  }, H = (e, t, n) => {
51
51
  if (t === null)
52
52
  return null;
53
53
  const s = n === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS;
54
- return ie(t, s.y, s.y + s.height);
54
+ return re(t, s.y, s.y + s.height);
55
55
  }, fe = (e, t, n) => {
56
56
  if (t === null)
57
57
  return !1;
@@ -61,8 +61,8 @@ const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
61
61
  const o = X(e, n);
62
62
  if (!o)
63
63
  return null;
64
- const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = o.origin === "x" ? (t - i.x) / i.width : (i.height - t + i.y) / i.height;
65
- return o.min + r * (o.max - o.min);
64
+ const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = o.origin === "x" ? (t - r.x) / r.width : (r.height - t + r.y) / r.height;
65
+ return o.min + i * (o.max - o.min);
66
66
  }, O = (e, t) => {
67
67
  if (e === t) return !0;
68
68
  if (e == null || t == null || typeof e != typeof t || typeof e != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
@@ -77,7 +77,7 @@ const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
77
77
  for (const o of n)
78
78
  if (!Object.prototype.hasOwnProperty.call(t, o) || !O(e[o], t[o])) return !1;
79
79
  return !0;
80
- }, We = (e) => {
80
+ }, qe = (e) => {
81
81
  const { ctx: t, scales: n } = e;
82
82
  for (const s of n) {
83
83
  if (!s.axis) continue;
@@ -92,27 +92,27 @@ const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
92
92
  if (s.axis.position === "bottom")
93
93
  t.beginPath(), t.moveTo(o.x, o.y), t.lineTo(o.x + o.width, o.y), t.stroke();
94
94
  else if (s.axis.position === "top") {
95
- const i = o.y + o.height;
96
- t.beginPath(), t.moveTo(o.x, i), t.lineTo(o.x + o.width, i), t.stroke();
95
+ const r = o.y + o.height;
96
+ t.beginPath(), t.moveTo(o.x, r), t.lineTo(o.x + o.width, r), t.stroke();
97
97
  }
98
98
  } else if (s.axis.position === "left") {
99
- const i = o.x + o.width;
100
- t.beginPath(), t.moveTo(i, o.y), t.lineTo(i, o.y + o.height), t.stroke();
99
+ const r = o.x + o.width;
100
+ t.beginPath(), t.moveTo(r, o.y), t.lineTo(r, o.y + o.height), t.stroke();
101
101
  } else s.axis.position === "right" && (t.beginPath(), t.moveTo(o.x, o.y), t.lineTo(o.x, o.y + o.height), t.stroke());
102
102
  t.restore();
103
103
  }
104
104
  };
105
- function qe(e) {
105
+ function Ge(e) {
106
106
  return (t) => {
107
107
  for (const n of e) me(n, t);
108
108
  };
109
109
  }
110
- function Ge(e) {
110
+ function Ze(e) {
111
111
  return (t) => {
112
112
  const n = [];
113
113
  for (const s of e) {
114
- const o = me(s, t), i = typeof o == "function";
115
- n.push(i ? o : () => me(s, null));
114
+ const o = me(s, t), r = typeof o == "function";
115
+ n.push(r ? o : () => me(s, null));
116
116
  }
117
117
  return () => {
118
118
  for (const s of n) s();
@@ -124,18 +124,18 @@ function me(e, t) {
124
124
  return e(t);
125
125
  e && (e.current = t);
126
126
  }
127
- var Ze = parseInt(ze.split(".")[0], 10) >= 19 ? Ge : qe;
128
- const Ae = ye({
127
+ var Je = parseInt(Ne.split(".")[0], 10) >= 19 ? Ze : Ge;
128
+ const ke = ye({
129
129
  listeners: [],
130
130
  subscribe: () => () => {
131
131
  },
132
132
  notifyListeners: () => {
133
133
  }
134
- }), Je = () => {
134
+ }), Qe = () => {
135
135
  const e = [];
136
- return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((i, r) => i[0] - r[0]), () => {
137
- const i = e.findIndex(([, r]) => r === s);
138
- i !== -1 && e.splice(i, 1);
136
+ return { listeners: e, subscribe: (s, o) => (e.push([o, s]), e.sort((r, i) => r[0] - i[0]), () => {
137
+ const r = e.findIndex(([, i]) => i === s);
138
+ r !== -1 && e.splice(r, 1);
139
139
  }), notifyListeners: () => {
140
140
  for (const [, s] of e)
141
141
  s();
@@ -169,19 +169,19 @@ class Ie {
169
169
  return this.frame.ctx;
170
170
  }
171
171
  }
172
- const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) => {
173
- const i = A(null), r = A(null), c = et(r), [l, u] = B(null), f = Z(
174
- () => tt(e, c, l),
172
+ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) => {
173
+ const r = k(null), i = k(null), c = tt(i), [l, u] = B(null), f = Z(
174
+ () => nt(e, c, l),
175
175
  [e, c, l]
176
176
  );
177
177
  $(() => {
178
- u(i.current?.getContext("2d") || null);
179
- }, [i]);
178
+ u(r.current?.getContext("2d") || null);
179
+ }, [r]);
180
180
  const m = window.devicePixelRatio || 1;
181
181
  return /* @__PURE__ */ pe(
182
182
  "div",
183
183
  {
184
- ref: Ze([o, r]),
184
+ ref: Je([o, i]),
185
185
  className: s,
186
186
  style: {
187
187
  position: "relative",
@@ -193,7 +193,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
193
193
  /* @__PURE__ */ R(
194
194
  "canvas",
195
195
  {
196
- ref: i,
196
+ ref: r,
197
197
  width: c.width * m,
198
198
  height: c.height * m,
199
199
  style: {
@@ -204,22 +204,22 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
204
204
  }
205
205
  }
206
206
  ),
207
- f && /* @__PURE__ */ R(Qe, { frame: f, children: t })
207
+ f && /* @__PURE__ */ R(et, { frame: f, children: t })
208
208
  ]
209
209
  }
210
210
  );
211
- }), Qe = ({
211
+ }), et = ({
212
212
  frame: e,
213
213
  children: t
214
214
  }) => {
215
- const n = Z(Je, []), [s, o] = B(0);
215
+ const n = Z(Qe, []), [s, o] = B(0);
216
216
  $(() => {
217
217
  e?.ctx.clearRect(0, 0, e.ctx.canvas.width, e.ctx.canvas.height);
218
218
  }, [e, s]);
219
- const i = A(null);
220
- i.current = e, $(() => {
219
+ const r = k(null);
220
+ r.current = e, $(() => {
221
221
  n.subscribe(() => {
222
- i.current && We(i.current);
222
+ r.current && qe(r.current);
223
223
  }, De.BOTTOM);
224
224
  }, [n]), $(() => {
225
225
  let c = null;
@@ -229,30 +229,30 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
229
229
  c && cancelAnimationFrame(c);
230
230
  };
231
231
  }, [s, e, n]);
232
- const r = $e(() => {
232
+ const i = je(() => {
233
233
  o((c) => c + 1);
234
234
  }, [o]);
235
- return /* @__PURE__ */ R(Ae.Provider, { value: n, children: /* @__PURE__ */ R(Re.Provider, { value: r, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
236
- }, et = (e) => {
235
+ return /* @__PURE__ */ R(ke.Provider, { value: n, children: /* @__PURE__ */ R(Re.Provider, { value: i, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
236
+ }, tt = (e) => {
237
237
  const [t, n] = B({
238
238
  width: 0,
239
239
  height: 0
240
240
  }), [s] = B(() => new ResizeObserver((o) => {
241
- for (const i of o) {
242
- const r = Math.round(i.contentRect.width), c = Math.round(i.contentRect.height);
241
+ for (const r of o) {
242
+ const i = Math.round(r.contentRect.width), c = Math.round(r.contentRect.height);
243
243
  n(
244
- (l) => l.width !== r || l.height !== c ? { ...l, width: r, height: c } : l
244
+ (l) => l.width !== i || l.height !== c ? { ...l, width: i, height: c } : l
245
245
  );
246
246
  }
247
247
  }));
248
248
  return $(() => {
249
249
  if (!e.current) return;
250
- const o = e.current.clientWidth, i = e.current.clientHeight;
250
+ const o = e.current.clientWidth, r = e.current.clientHeight;
251
251
  return n(
252
- (r) => r.width !== o || r.height !== i ? { ...r, width: o, height: i } : r
252
+ (i) => i.width !== o || i.height !== r ? { ...i, width: o, height: r } : i
253
253
  ), s.observe(e.current, { box: "border-box" }), () => s.disconnect();
254
254
  }, [s, e]), t;
255
- }, tt = (e, t, n) => {
255
+ }, nt = (e, t, n) => {
256
256
  if (!n)
257
257
  return null;
258
258
  const s = window.devicePixelRatio || 1;
@@ -269,16 +269,16 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
269
269
  0,
270
270
  o.height - a.axis.size
271
271
  ), a.axis.position === "top" && (o.y += a.axis.size)) : (a.axis.position === "left" || a.axis.position === "right") && (o.width = Math.max(0, o.width - a.axis.size), a.axis.position === "left" && (o.x += a.axis.size)));
272
- const i = {
272
+ const r = {
273
273
  x: o.x * s,
274
274
  y: o.y * s,
275
275
  width: o.width * s,
276
276
  height: o.height * s
277
- }, r = [];
277
+ }, i = [];
278
278
  let c = e.padding.left * s, l = t.width * s - e.padding.right * s, u = t.height * s - e.padding.bottom * s, f = e.padding.top * s;
279
279
  for (const a of e.scales) {
280
280
  if (!a.axis) {
281
- r.push({ ...a, axis: null });
281
+ i.push({ ...a, axis: null });
282
282
  continue;
283
283
  }
284
284
  let p;
@@ -332,7 +332,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
332
332
  width: p.width * s,
333
333
  height: p.height * s
334
334
  };
335
- r.push({
335
+ i.push({
336
336
  ...a,
337
337
  axis: {
338
338
  ...a.axis,
@@ -345,25 +345,25 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
345
345
  ctx: n,
346
346
  dpr: s,
347
347
  padding: e.padding,
348
- scales: r,
348
+ scales: i,
349
349
  chartAreaCSS: o,
350
- chartAreaCanvasPX: i
350
+ chartAreaCanvasPX: r
351
351
  };
352
352
  }, j = (e, t, n) => {
353
- const s = q(ve), o = q(Re), i = q(Ae);
353
+ const s = q(ve), o = q(Re), r = q(ke);
354
354
  if (!s || !o)
355
355
  throw new Error("useFrame must be used within a CanPlot component");
356
- const [r] = B(() => new Ie());
357
- r._updateFrame(s);
358
- const c = A(r);
359
- c.current = r;
360
- const l = A(t);
361
- l.current = t, $(() => i.subscribe(
356
+ const [i] = B(() => new Ie());
357
+ i._updateFrame(s);
358
+ const c = k(i);
359
+ c.current = i;
360
+ const l = k(t);
361
+ l.current = t, $(() => r.subscribe(
362
362
  () => {
363
- l.current(r);
363
+ l.current(i);
364
364
  },
365
365
  typeof e == "number" ? e : De[e]
366
- ), [i, e, r]), $(() => {
366
+ ), [r, e, i]), $(() => {
367
367
  o();
368
368
  }, [o, ...n]);
369
369
  }, Le = () => {
@@ -374,25 +374,25 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
374
374
  const t = new Ie();
375
375
  return t._updateFrame(e), t;
376
376
  }, [e]);
377
- }, nt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
377
+ }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
378
378
  e,
379
- ({ ctx: i, clampXPosToChartArea: r, clampYPosToChartArea: c, valToPos: l }) => {
380
- i.save(), i.beginPath(), U(i, o);
379
+ ({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
380
+ r.save(), r.beginPath(), U(r, o);
381
381
  for (const u of t) {
382
- const f = r(l(u.x, n, "canvas")), m = c(l(u.y, s, "canvas"));
383
- f === null || m === null || i.lineTo(f, m);
382
+ const f = i(l(u.x, n, "canvas")), m = c(l(u.y, s, "canvas"));
383
+ f === null || m === null || r.lineTo(f, m);
384
384
  }
385
- i.stroke(), i.restore();
385
+ r.stroke(), r.restore();
386
386
  },
387
387
  [t, n, s, o]
388
- ), null), Dt = D.memo(nt, O), st = ({
388
+ ), null), It = D.memo(st, O), ot = ({
389
389
  layer: e = "MIDDLE",
390
390
  data: t,
391
391
  xScaleId: n,
392
392
  yScaleId: s,
393
393
  xStrategy: o = "clip",
394
- yStrategy: i = "clip",
395
- radius: r = 5,
394
+ yStrategy: r = "clip",
395
+ radius: i = 5,
396
396
  style: c,
397
397
  globalAlpha: l
398
398
  }) => (j(
@@ -422,7 +422,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
422
422
  break;
423
423
  }
424
424
  }
425
- switch (i) {
425
+ switch (r) {
426
426
  case "clip":
427
427
  if (!m(y.y, s))
428
428
  continue;
@@ -432,19 +432,19 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
432
432
  g = p(f(y.y, s), "canvas");
433
433
  break;
434
434
  }
435
- d === null || g === null || (h.moveTo(d + r, g), h.arc(d, g, r, 0, Math.PI * 2));
435
+ d === null || g === null || (h.moveTo(d + i, g), h.arc(d, g, i, 0, Math.PI * 2));
436
436
  }
437
437
  u.fill(h), u.stroke(h), u.restore();
438
438
  },
439
- [t, n, s, r, c, l]
440
- ), null), It = D.memo(st, O), ot = ({
439
+ [t, n, s, i, c, l]
440
+ ), null), Lt = D.memo(ot, O), rt = ({
441
441
  data: e,
442
442
  xScaleId: t,
443
443
  yScaleId: n,
444
444
  style: s,
445
445
  barWidth: o,
446
- xPositionOffset: i,
447
- radius: r,
446
+ xPositionOffset: r,
447
+ radius: i,
448
448
  layer: c = "MIDDLE"
449
449
  }) => (j(
450
450
  c,
@@ -463,7 +463,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
463
463
  const y = f(h.x, t);
464
464
  if (y === null)
465
465
  continue;
466
- const d = y - p / 2 + i * p, g = a(
466
+ const d = y - p / 2 + r * p, g = a(
467
467
  f(0, n, "canvas"),
468
468
  "canvas"
469
469
  );
@@ -476,23 +476,23 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
476
476
  if (w === null)
477
477
  continue;
478
478
  const x = g - w, b = m(d, "canvas"), v = m(d + p, "canvas") - b;
479
- r ? l.roundRect(
479
+ i ? l.roundRect(
480
480
  b,
481
481
  w,
482
482
  v,
483
483
  x,
484
- r
484
+ i
485
485
  ) : l.rect(b, w, v, x);
486
486
  }
487
487
  l.closePath(), l.fill(), s?.strokeStyle && l.stroke(), l.restore();
488
488
  },
489
- [e, t, n, s, o, i, r]
490
- ), null), Lt = D.memo(ot, O), it = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
489
+ [e, t, n, s, o, r, i]
490
+ ), null), Ut = D.memo(rt, O), it = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
491
491
  e,
492
- ({ ctx: i, clampXPosToChartArea: r, clampYPosToChartArea: c, valToPos: l }) => {
492
+ ({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
493
493
  const u = [];
494
494
  for (const m of t) {
495
- const a = r(l(m.x, n));
495
+ const a = i(l(m.x, n));
496
496
  if (a === null)
497
497
  continue;
498
498
  const p = c(l(m.y[0], s));
@@ -503,16 +503,16 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
503
503
  }
504
504
  const f = u[0];
505
505
  if (f) {
506
- i.save(), i.beginPath(), U(i, o), i.moveTo(f.x, f.y);
506
+ r.save(), r.beginPath(), U(r, o), r.moveTo(f.x, f.y);
507
507
  for (const m of u)
508
- i.lineTo(m.x, m.y);
509
- i.closePath(), i.fill(), i.restore();
508
+ r.lineTo(m.x, m.y);
509
+ r.closePath(), r.fill(), r.restore();
510
510
  }
511
511
  },
512
512
  [t, n, s, o]
513
- ), null), Ut = D.memo(it, O), rt = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: i }) => (j(
513
+ ), null), _t = D.memo(it, O), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: r }) => (j(
514
514
  e,
515
- ({ ctx: r, clampXPosToChartArea: c, clampYPosToChartArea: l, valToPos: u }) => {
515
+ ({ ctx: i, clampXPosToChartArea: c, clampYPosToChartArea: l, valToPos: u }) => {
516
516
  const f = [];
517
517
  for (const h of t) {
518
518
  const y = c(u(h.x, s)), d = l(u(h.y, o));
@@ -523,37 +523,37 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
523
523
  return;
524
524
  const p = l(u(0, o));
525
525
  if (p !== null) {
526
- r.save(), r.beginPath(), U(r, i), r.moveTo(m.x, p);
526
+ i.save(), i.beginPath(), U(i, r), i.moveTo(m.x, p);
527
527
  for (const h of f)
528
- r.lineTo(h.x, h.y);
529
- if (r.lineTo(a.x, p), r.closePath(), r.fill(), n) {
530
- r.beginPath(), r.moveTo(m.x, m.y);
528
+ i.lineTo(h.x, h.y);
529
+ if (i.lineTo(a.x, p), i.closePath(), i.fill(), n) {
530
+ i.beginPath(), i.moveTo(m.x, m.y);
531
531
  for (const h of f)
532
- r.lineTo(h.x, h.y);
533
- r.stroke();
532
+ i.lineTo(h.x, h.y);
533
+ i.stroke();
534
534
  }
535
- r.restore();
535
+ i.restore();
536
536
  }
537
537
  },
538
- [t, n, s, o, i]
539
- ), null), _t = D.memo(rt, O), ct = ({
538
+ [t, n, s, o, r]
539
+ ), null), Xt = D.memo(ct, O), at = ({
540
540
  layer: e = "BOTTOM",
541
541
  scaleId: t,
542
542
  tickStyle: n,
543
543
  labelStyle: s,
544
544
  labelGap: o,
545
- tickSize: i,
546
- ticks: r
545
+ tickSize: r,
546
+ ticks: i
547
547
  }) => (j(
548
548
  e,
549
549
  ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
550
550
  const m = u(t);
551
551
  if (!m || !m.axis || m.origin !== "x") return;
552
- const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, h = window.devicePixelRatio || 1, y = p, d = (i ?? 6) * h, g = a.position === "top" ? p - d : p + d, w = (o ?? 12) * h;
552
+ const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, h = window.devicePixelRatio || 1, y = p, d = (r ?? 6) * h, g = a.position === "top" ? p - d : p + d, w = (o ?? 12) * h;
553
553
  c.save(), c.fontKerning = "auto", U(c, {
554
554
  ...n
555
555
  }), c.beginPath();
556
- const x = Array.isArray(r) ? r : r({ ...m, axis: a }, f);
556
+ const x = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
557
557
  for (const { value: b } of x) {
558
558
  const v = l(b, t, "canvas");
559
559
  v !== null && (c.moveTo(v, y), c.lineTo(v, g));
@@ -562,34 +562,36 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
562
562
  textBaseline: a.position === "top" ? "bottom" : "top",
563
563
  textAlign: "center",
564
564
  ...n,
565
- ...s
565
+ ...s,
566
+ // alter font size for DPR
567
+ font: Ue(s?.font ?? n?.font)
566
568
  });
567
569
  for (const { value: b, label: v } of x) {
568
570
  const T = l(b, t, "canvas");
569
571
  if (T === null)
570
572
  continue;
571
- const S = v.split(`
573
+ const C = v.split(`
572
574
  `);
573
- for (let E = 0; E < S.length; E++)
574
- c.fillText(S[E], T, g + h * 2 + E * w);
575
+ for (let E = 0; E < C.length; E++)
576
+ c.fillText(C[E], T, g + h * 2 + E * w);
575
577
  }
576
578
  c.restore();
577
579
  },
578
- [r, t, n, s]
579
- ), null), Xt = D.memo(ct, O), at = ({
580
+ [i, t, n, s]
581
+ ), null), Ot = D.memo(at, O), lt = ({
580
582
  layer: e = "BOTTOM",
581
583
  scaleId: t,
582
584
  tickStyle: n,
583
585
  labelStyle: s,
584
586
  labelGap: o,
585
- tickSize: i,
586
- ticks: r
587
+ tickSize: r,
588
+ ticks: i
587
589
  }) => (j(
588
590
  e,
589
591
  ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
590
592
  const m = u(t);
591
593
  if (!m || !m.axis || m.origin !== "y") return;
592
- const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, h = p, y = i ?? 6, d = a.position === "left" ? p - y : p + y, g = o ?? 12, w = Array.isArray(r) ? r : r({ ...m, axis: a }, f);
594
+ const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, h = p, y = r ?? 6, d = a.position === "left" ? p - y : p + y, g = o ?? 12, w = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
593
595
  c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
594
596
  for (const { value: x } of w) {
595
597
  const b = l(x, t, "canvas");
@@ -599,7 +601,9 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
599
601
  textBaseline: "middle",
600
602
  textAlign: a.position === "left" ? "right" : "left",
601
603
  ...n,
602
- ...s
604
+ ...s,
605
+ // alter font size for DPR
606
+ font: Ue(s?.font ?? n?.font)
603
607
  });
604
608
  for (const { value: x, label: b } of w) {
605
609
  const v = l(x, t, "canvas");
@@ -607,13 +611,20 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
607
611
  continue;
608
612
  const T = b.split(`
609
613
  `);
610
- for (let S = 0; S < T.length; S++)
611
- c.fillText(` ${T[S]} `, d, v + S * g);
614
+ for (let C = 0; C < T.length; C++)
615
+ c.fillText(` ${T[C]} `, d, v + C * g);
612
616
  }
613
617
  c.restore();
614
618
  },
615
- [r, t, n, s]
616
- ), null), Ot = D.memo(at, O), I = () => {
619
+ [i, t, n, s]
620
+ ), null), Ft = D.memo(lt, O), Ue = (e) => {
621
+ if (e)
622
+ try {
623
+ return e.replace(/(\d+)px/, (t, n) => `${parseInt(n) * window.devicePixelRatio || 1}px`);
624
+ } catch {
625
+ }
626
+ return e;
627
+ }, I = () => {
617
628
  const e = [];
618
629
  return {
619
630
  addEventListener: (t, n) => (e.push({
@@ -643,32 +654,32 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
643
654
  const s = D.useRef(n);
644
655
  s.current = n, D.useEffect(() => M[e].addEventListener(
645
656
  t,
646
- (i, r) => {
647
- s.current(r, i);
657
+ (r, i) => {
658
+ s.current(i, r);
648
659
  }
649
660
  ), [t, e, s]);
650
661
  }, we = D.createContext(""), xe = (e, t) => {
651
662
  const n = D.useContext(we);
652
663
  return L(e, n, t);
653
- }, lt = (e, t, n, s, o) => {
664
+ }, ut = (e, t, n, s, o) => {
654
665
  if (!t) return;
655
- const i = s ?? n.scales.find((m) => m.origin === "x")?.id, r = o ?? n.scales.find((m) => m.origin === "y")?.id, c = e.clientX - t.left, l = i ? {
656
- scaleId: i,
657
- value: _(n, c, i, "css")
658
- } : null, u = e.clientY - t.top, f = r ? {
666
+ const r = s ?? n.scales.find((m) => m.origin === "x")?.id, i = o ?? n.scales.find((m) => m.origin === "y")?.id, c = e.clientX - t.left, l = r ? {
659
667
  scaleId: r,
660
- value: _(n, u, r, "css")
668
+ value: _(n, c, r, "css")
669
+ } : null, u = e.clientY - t.top, f = i ? {
670
+ scaleId: i,
671
+ value: _(n, u, i, "css")
661
672
  } : null;
662
673
  return { pointerSyncPosition: { x: l, y: f }, cssX: c, cssY: u };
663
674
  }, N = (e, t) => {
664
- const { x: n, y: s } = e, o = n && t.scales.some((r) => r.id === n.scaleId) ? G(t, n.value, n.scaleId, "css") : null, i = s && t.scales.some((r) => r.id === s.scaleId) ? G(t, s.value, s.scaleId, "css") : null;
675
+ const { x: n, y: s } = e, o = n && t.scales.some((i) => i.id === n.scaleId) ? G(t, n.value, n.scaleId, "css") : null, r = s && t.scales.some((i) => i.id === s.scaleId) ? G(t, s.value, s.scaleId, "css") : null;
665
676
  return {
666
677
  cssX: o,
667
- cssY: i,
678
+ cssY: r,
668
679
  scaled: Object.fromEntries(
669
- t.scales.flatMap((r) => {
670
- const c = r.origin === "y" ? i : o;
671
- return c === null ? [] : [[r.id, _(t, c, r.id, "css")]];
680
+ t.scales.flatMap((i) => {
681
+ const c = i.origin === "y" ? r : o;
682
+ return c === null ? [] : [[i.id, _(t, c, i.id, "css")]];
672
683
  })
673
684
  )
674
685
  };
@@ -686,14 +697,14 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
686
697
  );
687
698
  if (s === null || o === null)
688
699
  return null;
689
- const i = n.scales.flatMap(
690
- (r) => {
691
- if (r.origin !== e)
700
+ const r = n.scales.flatMap(
701
+ (i) => {
702
+ if (i.origin !== e)
692
703
  return [];
693
- const c = _(n, s, r.id, "css"), l = _(n, o, r.id, "css");
704
+ const c = _(n, s, i.id, "css"), l = _(n, o, i.id, "css");
694
705
  return c === null || l === null ? [] : [
695
706
  {
696
- scaleId: r.id,
707
+ scaleId: i.id,
697
708
  from: c,
698
709
  to: l
699
710
  }
@@ -703,16 +714,16 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
703
714
  return {
704
715
  fromCSS: s,
705
716
  toCSS: o,
706
- scaled: i
717
+ scaled: r
707
718
  };
708
- }, Ft = ({
719
+ }, Kt = ({
709
720
  id: e,
710
721
  onClick: t,
711
722
  onDblClick: n,
712
723
  onMouseMove: s,
713
724
  onMouseDown: o,
714
- onMouseUp: i,
715
- onDocumentMouseUp: r,
725
+ onMouseUp: r,
726
+ onDocumentMouseUp: i,
716
727
  onSpanSelect: c,
717
728
  onContextMenu: l,
718
729
  className: u,
@@ -721,7 +732,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
721
732
  innerChildren: a,
722
733
  children: p
723
734
  }) => {
724
- const h = je();
735
+ const h = Ve();
725
736
  return L("dblclick", h, (y) => {
726
737
  n?.(y);
727
738
  }), L("click", h, (y) => {
@@ -731,16 +742,16 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
731
742
  }), L("mousedown", h, (y) => {
732
743
  o?.(y);
733
744
  }), L("mouseup", h, (y) => {
734
- i?.(y);
735
- }), L("documentmouseup", h, (y) => {
736
745
  r?.(y);
746
+ }), L("documentmouseup", h, (y) => {
747
+ i?.(y);
737
748
  }), L("spanselect", h, (y) => {
738
749
  c?.(y);
739
750
  }), L("contextmenu", h, (y) => {
740
751
  l?.(y);
741
752
  }), /* @__PURE__ */ pe(we.Provider, { value: h, children: [
742
753
  /* @__PURE__ */ R(
743
- ut,
754
+ ht,
744
755
  {
745
756
  id: e,
746
757
  className: u,
@@ -751,11 +762,11 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
751
762
  ),
752
763
  p
753
764
  ] });
754
- }, ut = ({ id: e, className: t, style: n, sync: s, children: o }) => {
755
- const i = A(null), r = Le().frame, c = A(r);
756
- c.current = r;
757
- const l = q(we), u = s?.key || l, f = A(null), m = A(null), a = A(null), p = () => {
758
- const d = i.current?.parentElement;
765
+ }, ht = ({ id: e, className: t, style: n, sync: s, children: o }) => {
766
+ const r = k(null), i = Le().frame, c = k(i);
767
+ c.current = i;
768
+ const l = q(we), u = s?.key || l, f = k(null), m = k(null), a = k(null), p = () => {
769
+ const d = r.current?.parentElement;
759
770
  if (d) {
760
771
  if (d.dataset.canplotroot === void 0)
761
772
  throw new Error(
@@ -764,7 +775,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
764
775
  return d.getBoundingClientRect();
765
776
  }
766
777
  }, h = (d, g) => {
767
- const w = lt(
778
+ const w = ut(
768
779
  d,
769
780
  p(),
770
781
  c.current,
@@ -781,8 +792,8 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
781
792
  metaKey: d.metaKey
782
793
  }
783
794
  );
784
- }, y = A(h);
785
- return y.current = h, Ve(() => {
795
+ }, y = k(h);
796
+ return y.current = h, He(() => {
786
797
  const d = (v) => {
787
798
  const T = m.current;
788
799
  T && M.spanselect.dispatchEvent(l, {
@@ -803,30 +814,30 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
803
814
  altKey: v.altKey,
804
815
  shiftKey: v.shiftKey,
805
816
  metaKey: v.metaKey
806
- }, S = a.current;
807
- if (S && Object.entries(T).some(
808
- ([C, P]) => S.keys[C] !== P
817
+ }, C = a.current;
818
+ if (C && Object.entries(T).some(
819
+ ([S, P]) => C.keys[S] !== P
809
820
  )) {
810
- const C = { ...S, keys: T };
811
- a.current = C, M.sync_move.dispatchEvent(u, C);
821
+ const S = { ...C, keys: T };
822
+ a.current = S, M.sync_move.dispatchEvent(u, S);
812
823
  }
813
824
  const E = m.current;
814
825
  if (E && Object.entries(T).some(
815
- ([C, P]) => E.keys[C] !== P
826
+ ([S, P]) => E.keys[S] !== P
816
827
  )) {
817
828
  v.stopPropagation(), v.preventDefault();
818
- const C = { ...E, keys: T };
819
- m.current = C, M.spanselect.dispatchEvent(l, C);
829
+ const S = { ...E, keys: T };
830
+ m.current = S, M.spanselect.dispatchEvent(l, S);
820
831
  }
821
832
  }, w = (v) => {
822
833
  y.current(
823
834
  v,
824
- (T, { cssX: S, cssY: E }, C) => {
835
+ (T, { cssX: C, cssY: E }, S) => {
825
836
  const P = f.current;
826
837
  if (!P || !T.x || !T.y) return;
827
- const k = c.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, J = X(k, T.x.scaleId);
838
+ const A = c.current, z = P.xRangeCss.start, ae = C, le = P.yRangeCss.start, ue = E, J = X(A, T.x.scaleId);
828
839
  if (!J) return;
829
- const Q = X(k, T.y.scaleId);
840
+ const Q = X(A, T.y.scaleId);
830
841
  if (!Q) return;
831
842
  f.current = {
832
843
  xRangeCss: { start: z, end: ae },
@@ -836,28 +847,28 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
836
847
  const he = Math.abs(le - ue), de = Math.abs(z - ae);
837
848
  he < 10 && de < 10 ? W = "below_threshold" : he > 30 && de > 30 ? W = "box" : he > de ? W = "y" : W = "x";
838
849
  const Te = _(
839
- k,
850
+ A,
840
851
  V(c.current, z, "css"),
841
852
  J.id,
842
853
  "css"
843
854
  );
844
855
  if (Te === null) return;
845
- const Se = _(
846
- k,
856
+ const Ce = _(
857
+ A,
847
858
  V(c.current, ae, "css"),
848
859
  J.id,
849
860
  "css"
850
861
  );
851
- if (Se === null) return;
852
- const Ce = _(
853
- k,
862
+ if (Ce === null) return;
863
+ const Se = _(
864
+ A,
854
865
  H(c.current, le, "css"),
855
866
  Q.id,
856
867
  "css"
857
868
  );
858
- if (Ce === null) return;
869
+ if (Se === null) return;
859
870
  const Pe = _(
860
- k,
871
+ A,
861
872
  H(c.current, ue, "css"),
862
873
  Q.id,
863
874
  "css"
@@ -865,13 +876,13 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
865
876
  if (Pe === null) return;
866
877
  const ee = Ee(
867
878
  "x",
868
- { scaleId: J.id, from: Te, to: Se },
879
+ { scaleId: J.id, from: Te, to: Ce },
869
880
  c.current
870
881
  ), te = Ee(
871
882
  "y",
872
- { scaleId: Q.id, from: Ce, to: Pe },
883
+ { scaleId: Q.id, from: Se, to: Pe },
873
884
  c.current
874
- ), Oe = ee?.scaled, Fe = te?.scaled, Me = {
885
+ ), Fe = ee?.scaled, Ke = te?.scaled, Me = {
875
886
  mode: W,
876
887
  frame: c.current,
877
888
  completed: !1,
@@ -880,16 +891,16 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
880
891
  from: ee.fromCSS,
881
892
  to: ee.toCSS
882
893
  } : void 0,
883
- scaled: Oe ?? []
894
+ scaled: Fe ?? []
884
895
  },
885
896
  y: {
886
897
  css: te ? {
887
898
  from: te.fromCSS,
888
899
  to: te.toCSS
889
900
  } : void 0,
890
- scaled: Fe ?? []
901
+ scaled: Ke ?? []
891
902
  },
892
- keys: C
903
+ keys: S
893
904
  };
894
905
  m.current = Me, M.spanselect.dispatchEvent(
895
906
  l,
@@ -898,28 +909,28 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
898
909
  }
899
910
  );
900
911
  }, x = (v) => {
901
- y.current(v, (T, S, E) => {
902
- const C = N(
912
+ y.current(v, (T, C, E) => {
913
+ const S = N(
903
914
  T,
904
915
  c.current
905
916
  );
906
- if (!C) return;
907
- if (Object.values(E).some((k) => k)) {
917
+ if (!S) return;
918
+ if (Object.values(E).some((A) => A)) {
908
919
  v.preventDefault();
909
- const k = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
920
+ const A = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
910
921
  M.pressandwheel.dispatchEvent(l, {
911
- pointer: C,
922
+ pointer: S,
912
923
  frame: c.current,
913
924
  keys: E,
914
925
  deltaX: v.deltaX,
915
926
  deltaY: v.deltaY,
916
- deltaAbs: k
927
+ deltaAbs: A
917
928
  });
918
929
  }
919
930
  });
920
931
  };
921
932
  document.addEventListener("mouseup", d), document.addEventListener("keydown", g), document.addEventListener("keyup", g), document.addEventListener("mousemove", w);
922
- const b = i.current;
933
+ const b = r.current;
923
934
  return b?.addEventListener("wheel", x, {
924
935
  passive: !1
925
936
  }), () => {
@@ -939,15 +950,15 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
939
950
  }), /* @__PURE__ */ R(
940
951
  "div",
941
952
  {
942
- ref: i,
953
+ ref: r,
943
954
  id: e,
944
955
  className: t,
945
956
  style: {
946
957
  position: "absolute",
947
- left: r.chartAreaCSS.x,
948
- top: r.chartAreaCSS.y,
949
- width: r.chartAreaCSS.width,
950
- height: r.chartAreaCSS.height,
958
+ left: i.chartAreaCSS.x,
959
+ top: i.chartAreaCSS.y,
960
+ width: i.chartAreaCSS.width,
961
+ height: i.chartAreaCSS.height,
951
962
  zIndex: 25,
952
963
  ...n
953
964
  },
@@ -1017,14 +1028,14 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1017
1028
  m.current = null;
1018
1029
  const T = f.current;
1019
1030
  if (f.current = null, T && v) {
1020
- const S = {
1031
+ const C = {
1021
1032
  ...v,
1022
1033
  keys: x,
1023
1034
  completed: !0
1024
1035
  };
1025
1036
  m.current = null, M.spanselect.dispatchEvent(
1026
1037
  l,
1027
- S
1038
+ C
1028
1039
  );
1029
1040
  }
1030
1041
  });
@@ -1058,28 +1069,28 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1058
1069
  children: o
1059
1070
  }
1060
1071
  );
1061
- }, Kt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
1072
+ }, Yt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
1062
1073
  const [s, o] = B(null);
1063
- xe("move", (r) => {
1064
- o(r);
1074
+ xe("move", (i) => {
1075
+ o(i);
1065
1076
  });
1066
- const i = Z(() => {
1077
+ const r = Z(() => {
1067
1078
  if (!s)
1068
1079
  return null;
1069
- const { frame: r, pointer: c } = s, l = c?.scaled[n];
1070
- if (l === void 0 || !X(r, n))
1080
+ const { frame: i, pointer: c } = s, l = c?.scaled[n];
1081
+ if (l === void 0 || !X(i, n))
1071
1082
  return null;
1072
1083
  const f = [];
1073
1084
  let m = l;
1074
1085
  for (const a of e) {
1075
1086
  let p = null, h = 1 / 0;
1076
1087
  for (const [g, w] of a.points.entries()) {
1077
- if (!fe(r, w.x, n) || !fe(r, w.y, a.yScaleId))
1088
+ if (!fe(i, w.x, n) || !fe(i, w.y, a.yScaleId))
1078
1089
  continue;
1079
1090
  const x = Math.abs(w.x - l);
1080
1091
  x < h && (h = x, p = g);
1081
1092
  }
1082
- const y = a.points[p ?? -1], d = ge(r, h, n, "css");
1093
+ const y = a.points[p ?? -1], d = ge(i, h, n, "css");
1083
1094
  if (!y || d === null || d > 30) {
1084
1095
  f.push({ seriesId: a.seriesId, y: null });
1085
1096
  continue;
@@ -1090,20 +1101,20 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1090
1101
  });
1091
1102
  }
1092
1103
  return {
1093
- frame: r,
1104
+ frame: i,
1094
1105
  x: m,
1095
1106
  points: f
1096
1107
  };
1097
1108
  }, [e, s, n]);
1098
- return t(i);
1099
- }, Yt = ({ makeXStyle: e, makeXClassName: t, makeYStyle: n, makeYClassName: s }) => {
1100
- const [o, i] = B(null);
1109
+ return t(r);
1110
+ }, Bt = ({ makeXStyle: e, makeXClassName: t, makeYStyle: n, makeYClassName: s }) => {
1111
+ const [o, r] = B(null);
1101
1112
  if (xe("move", (a) => {
1102
- i(a);
1113
+ r(a);
1103
1114
  }), !o)
1104
1115
  return null;
1105
- const { frame: r, pointer: c } = o, l = c?.cssX ?? null, u = c?.cssY ?? null, f = l ? V(r, l, "css") : 0, m = u ? H(r, u, "css") : 0;
1106
- return /* @__PURE__ */ pe(Be, { children: [
1116
+ const { frame: i, pointer: c } = o, l = c?.cssX ?? null, u = c?.cssY ?? null, f = l ? V(i, l, "css") : 0, m = u ? H(i, u, "css") : 0;
1117
+ return /* @__PURE__ */ pe(ze, { children: [
1107
1118
  /* @__PURE__ */ R(
1108
1119
  "div",
1109
1120
  {
@@ -1113,8 +1124,8 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1113
1124
  position: "absolute",
1114
1125
  left: 0,
1115
1126
  visibility: l === null ? "hidden" : "visible",
1116
- top: r.chartAreaCSS.y,
1117
- height: r.chartAreaCSS.height,
1127
+ top: i.chartAreaCSS.y,
1128
+ height: i.chartAreaCSS.height,
1118
1129
  borderColor: "red",
1119
1130
  borderLeftWidth: "1px",
1120
1131
  borderLeftStyle: "solid",
@@ -1136,8 +1147,8 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1136
1147
  top: 0,
1137
1148
  height: 0,
1138
1149
  borderTop: "solid 1px red",
1139
- left: r.chartAreaCSS.x,
1140
- width: r.chartAreaCSS.width,
1150
+ left: i.chartAreaCSS.x,
1151
+ width: i.chartAreaCSS.width,
1141
1152
  pointerEvents: "none",
1142
1153
  opacity: c ? 1 : 0,
1143
1154
  transform: `translateY(${m}px)`,
@@ -1146,17 +1157,17 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1146
1157
  }
1147
1158
  )
1148
1159
  ] });
1149
- }, Bt = ({ makeClassName: e, makeStyle: t }) => {
1160
+ }, zt = ({ makeClassName: e, makeStyle: t }) => {
1150
1161
  const [n, s] = B(null);
1151
- xe("spanselect", (i) => {
1162
+ xe("spanselect", (r) => {
1152
1163
  s(
1153
- i.mode === "below_threshold" || i.completed ? null : i
1164
+ r.mode === "below_threshold" || r.completed ? null : r
1154
1165
  );
1155
1166
  });
1156
1167
  const o = Z(() => {
1157
1168
  if (!n || n.mode === "below_threshold")
1158
1169
  return null;
1159
- const i = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, r = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, c = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, l = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, u = V(n.frame, i, "css"), f = V(n.frame, r, "css"), m = H(n.frame, c, "css"), a = H(n.frame, l, "css"), p = Math.min(u, f), h = Math.min(m, a), y = Math.abs(f - u), d = Math.abs(a - m);
1170
+ const r = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, i = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, c = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, l = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, u = V(n.frame, r, "css"), f = V(n.frame, i, "css"), m = H(n.frame, c, "css"), a = H(n.frame, l, "css"), p = Math.min(u, f), h = Math.min(m, a), y = Math.abs(f - u), d = Math.abs(a - m);
1160
1171
  return { leftPx: p, topPx: h, widthPx: y, heightPx: d };
1161
1172
  }, [n]);
1162
1173
  return /* @__PURE__ */ R(
@@ -1175,7 +1186,7 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1175
1186
  }
1176
1187
  }
1177
1188
  );
1178
- }, zt = ({ style: e, children: t, scaleId: n, ...s }) => {
1189
+ }, Nt = ({ style: e, children: t, scaleId: n, ...s }) => {
1179
1190
  const o = Le().getScale(n)?.axis;
1180
1191
  return o ? /* @__PURE__ */ R(
1181
1192
  "div",
@@ -1193,12 +1204,12 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1193
1204
  children: t
1194
1205
  }
1195
1206
  ) : null;
1196
- }, Ue = 60, ht = 30, _e = "UTC", dt = "en-GB", Nt = ({
1207
+ }, _e = 60, dt = 30, Xe = "UTC", ft = "en-GB", $t = ({
1197
1208
  space: e,
1198
1209
  formatter: t,
1199
1210
  acceptableIncrements: n
1200
1211
  } = {}) => (s, o) => {
1201
- const { min: i, max: r } = s, c = [], l = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ? Ue : ht)) * l, f = He(
1212
+ const { min: r, max: i } = s, c = [], l = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ? _e : dt)) * l, f = We(
1202
1213
  o,
1203
1214
  u,
1204
1215
  s.id,
@@ -1207,21 +1218,21 @@ const Rt = Ne(({ configuration: e, children: t, style: n, className: s }, o) =>
1207
1218
  if (f === null)
1208
1219
  return [];
1209
1220
  const m = n ?? ne, a = m.find((h) => h > f) ?? m.at(-1) ?? 1;
1210
- let p = i;
1221
+ let p = r;
1211
1222
  if (Math.abs(p % a) > Number.EPSILON) {
1212
1223
  const h = (a - p % a) % a;
1213
1224
  p += h;
1214
1225
  }
1215
- for (; p <= r && c.length < 1e3; )
1226
+ for (; p <= i && c.length < 1e3; )
1216
1227
  c.push(p), p += a;
1217
- return (t ?? ft)(c);
1218
- }, ft = (e) => {
1228
+ return (t ?? mt)(c);
1229
+ }, mt = (e) => {
1219
1230
  const t = Math.max(0, Math.ceil(-Math.log10(e[1] - e[0])));
1220
1231
  return e.map((n) => ({ value: n, label: n.toFixed(t) }));
1221
1232
  }, ne = [];
1222
1233
  for (let e = -12; e <= 12; e++)
1223
1234
  ne.push(1 * 10 ** e), ne.push(2 * 10 ** e), ne.push(5 * 10 ** e);
1224
- const mt = 1, Xe = 1e3 * mt, be = 60 * Xe, re = 60 * be, ce = 24 * re, pt = 30 * ce, yt = 365 * ce, gt = [
1235
+ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 * ce, gt = 365 * ce, vt = [
1225
1236
  // second divisors
1226
1237
  [1, "milliseconds"],
1227
1238
  [2, "milliseconds"],
@@ -1279,53 +1290,53 @@ const mt = 1, Xe = 1e3 * mt, be = 60 * Xe, re = 60 * be, ce = 24 * re, pt = 30 *
1279
1290
  case "milliseconds":
1280
1291
  return t;
1281
1292
  case "seconds":
1282
- return t * Xe;
1293
+ return t * Oe;
1283
1294
  case "minutes":
1284
1295
  return t * be;
1285
1296
  case "hours":
1286
- return t * re;
1297
+ return t * ie;
1287
1298
  case "days":
1288
1299
  return t * ce;
1289
1300
  case "months":
1290
- return t * pt;
1291
- case "years":
1292
1301
  return t * yt;
1302
+ case "years":
1303
+ return t * gt;
1293
1304
  }
1294
- }, vt = (e, t) => {
1305
+ }, wt = (e, t) => {
1295
1306
  const n = new Date(e);
1296
1307
  return n.setUTCMilliseconds(n.getUTCMilliseconds() + t), n.getTime();
1297
- }, wt = (e, t) => {
1308
+ }, xt = (e, t) => {
1298
1309
  const n = new Date(e);
1299
1310
  return n.setUTCSeconds(n.getUTCSeconds() + t), n.getTime();
1300
- }, xt = (e, t) => {
1311
+ }, bt = (e, t) => {
1301
1312
  const n = new Date(e);
1302
1313
  return n.setUTCMinutes(n.getUTCMinutes() + t), n.getTime();
1303
- }, bt = (e, t) => {
1314
+ }, Tt = (e, t) => {
1304
1315
  const n = new Date(e);
1305
1316
  return n.setUTCHours(n.getUTCHours() + t), n.getTime();
1306
- }, Tt = (e, t) => {
1317
+ }, Ct = (e, t) => {
1307
1318
  const n = new Date(e);
1308
1319
  return n.setUTCDate(n.getUTCDate() + t), n.getTime();
1309
- }, ke = (e, t) => {
1320
+ }, Ae = (e, t) => {
1310
1321
  const n = new Date(e);
1311
1322
  return n.setUTCMonth(n.getUTCMonth() + t), n.getTime();
1312
1323
  }, Y = (e, t) => {
1313
1324
  const [n, s] = t;
1314
1325
  switch (s) {
1315
1326
  case "milliseconds":
1316
- return vt(e, n);
1317
- case "seconds":
1318
1327
  return wt(e, n);
1319
- case "minutes":
1328
+ case "seconds":
1320
1329
  return xt(e, n);
1321
- case "hours":
1330
+ case "minutes":
1322
1331
  return bt(e, n);
1323
- case "days":
1332
+ case "hours":
1324
1333
  return Tt(e, n);
1334
+ case "days":
1335
+ return Ct(e, n);
1325
1336
  case "months":
1326
- return ke(e, n);
1337
+ return Ae(e, n);
1327
1338
  case "years":
1328
- return ke(e, n * 12);
1339
+ return Ae(e, n * 12);
1329
1340
  }
1330
1341
  };
1331
1342
  function oe(e, t) {
@@ -1334,32 +1345,32 @@ function oe(e, t) {
1334
1345
  }
1335
1346
  const St = (e, t, n = "UTC") => {
1336
1347
  const [s, o] = t;
1337
- let i = new Date(e);
1338
- const r = () => {
1339
- i.setUTCHours(-oe(i, n), 0, 0, 0);
1348
+ let r = new Date(e);
1349
+ const i = () => {
1350
+ r.setUTCHours(-oe(r, n), 0, 0, 0);
1340
1351
  };
1341
1352
  switch (o) {
1342
1353
  case "milliseconds":
1343
- i.setUTCMilliseconds(
1344
- Math.ceil(i.getUTCMilliseconds() / s) * s
1354
+ r.setUTCMilliseconds(
1355
+ Math.ceil(r.getUTCMilliseconds() / s) * s
1345
1356
  );
1346
1357
  break;
1347
1358
  case "seconds":
1348
- i.setUTCSeconds(
1349
- Math.ceil(i.getUTCSeconds() / s) * s,
1359
+ r.setUTCSeconds(
1360
+ Math.ceil(r.getUTCSeconds() / s) * s,
1350
1361
  0
1351
1362
  );
1352
1363
  break;
1353
1364
  case "minutes":
1354
- i.setUTCMinutes(
1355
- Math.ceil(i.getTime() % re / be / s) * s,
1365
+ r.setUTCMinutes(
1366
+ Math.ceil(r.getTime() % ie / be / s) * s,
1356
1367
  0,
1357
1368
  0
1358
1369
  );
1359
1370
  break;
1360
1371
  case "hours":
1361
- i.setUTCHours(
1362
- Math.ceil(i.getTime() % ce / re / s) * s,
1372
+ r.setUTCHours(
1373
+ Math.ceil(r.getTime() % ce / ie / s) * s,
1363
1374
  0,
1364
1375
  0,
1365
1376
  0
@@ -1368,18 +1379,18 @@ const St = (e, t, n = "UTC") => {
1368
1379
  case "days":
1369
1380
  case "months":
1370
1381
  case "years":
1371
- o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1), r(), i.getTime() < e && (i = new Date(Y(i, [1, o])));
1382
+ o === "months" ? r.setUTCDate(1) : o === "years" && r.setUTCMonth(0, 1), i(), r.getTime() < e && (r = new Date(Y(r, [1, o])));
1372
1383
  break;
1373
1384
  }
1374
- return i.getTime();
1375
- }, $t = ({
1376
- timeZone: e = _e,
1377
- space: t = Ue,
1385
+ return r.getTime();
1386
+ }, jt = ({
1387
+ timeZone: e = Xe,
1388
+ space: t = _e,
1378
1389
  formatter: n,
1379
1390
  locale: s,
1380
1391
  showTimezone: o
1381
- } = {}) => (i, r) => {
1382
- const { min: c, max: l } = i, u = Math.floor(r.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = gt.find(
1392
+ } = {}) => (r, i) => {
1393
+ const { min: c, max: l } = r, u = Math.floor(i.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = vt.find(
1383
1394
  (w) => se(w) >= m
1384
1395
  ) ?? [1, "milliseconds"], h = St(c, [a, p], e), y = oe(h, e), d = [h];
1385
1396
  let g;
@@ -1423,14 +1434,14 @@ const St = (e, t, n = "UTC") => {
1423
1434
  break;
1424
1435
  d.push(g);
1425
1436
  }
1426
- return (n ?? Ct({
1437
+ return (n ?? Pt({
1427
1438
  locale: s,
1428
1439
  showTimezone: o,
1429
1440
  timeZone: e
1430
1441
  }))(d);
1431
- }, K = (e, t, n) => e.find((s) => s.type === n)?.value !== t.find((s) => s.type === n)?.value, Ct = ({
1432
- timeZone: e = _e,
1433
- locale: t = dt,
1442
+ }, K = (e, t, n) => e.find((s) => s.type === n)?.value !== t.find((s) => s.type === n)?.value, Pt = ({
1443
+ timeZone: e = Xe,
1444
+ locale: t = ft,
1434
1445
  showTimezone: n = !0
1435
1446
  }) => {
1436
1447
  const s = new Intl.DateTimeFormat(t, {
@@ -1446,20 +1457,20 @@ const St = (e, t, n = "UTC") => {
1446
1457
  timeZone: e
1447
1458
  });
1448
1459
  return (o) => {
1449
- const i = o[1] - o[0], r = i < se([1, "days"]), c = i < se([1, "minutes"]), l = i < se([1, "seconds"]);
1460
+ const r = o[1] - o[0], i = r < se([1, "days"]), c = r < se([1, "minutes"]), l = r < se([1, "seconds"]);
1450
1461
  return o.map((u) => ({ value: u, label: s.formatToParts(new Date(u)) })).map((u, f, m) => {
1451
1462
  const a = m[f - 1], p = f === 0 || K(u.label, a.label, "year"), h = f === 0 || K(u.label, a.label, "day"), y = f === 0 || K(u.label, a.label, "month"), d = f === 0 || K(u.label, a.label, "hour"), g = f === 0 || K(u.label, a.label, "timeZoneName"), w = f === 0 || K(u.label, a.label, "minute"), x = f === 0 || K(u.label, a.label, "second"), b = f === 0 || K(u.label, a.label, "fractionalSecond"), v = [];
1452
- if (r && (d || w || g || x || b)) {
1453
- const T = u.label.find((P) => P.type === "hour")?.value, S = u.label.find((P) => P.type === "minute")?.value, E = u.label.find((P) => P.type === "timeZoneName")?.value;
1454
- let C = "";
1463
+ if (i && (d || w || g || x || b)) {
1464
+ const T = u.label.find((P) => P.type === "hour")?.value, C = u.label.find((P) => P.type === "minute")?.value, E = u.label.find((P) => P.type === "timeZoneName")?.value;
1465
+ let S = "";
1455
1466
  if (c) {
1456
- const P = u.label.find((z) => z.type === "second")?.value, k = u.label.find(
1467
+ const P = u.label.find((z) => z.type === "second")?.value, A = u.label.find(
1457
1468
  (z) => z.type === "fractionalSecond"
1458
1469
  )?.value;
1459
- C = `:${P}` + (l ? `.${k}` : "");
1470
+ S = `:${P}` + (l ? `.${A}` : "");
1460
1471
  }
1461
1472
  v.push(
1462
- `${T}:${S}${C}` + (n && g ? ` ${E}` : "")
1473
+ `${T}:${C}${S}` + (n && g ? ` ${E}` : "")
1463
1474
  );
1464
1475
  }
1465
1476
  return (h || y) && v.push(
@@ -1476,34 +1487,34 @@ const St = (e, t, n = "UTC") => {
1476
1487
  };
1477
1488
  };
1478
1489
  export {
1479
- Ut as AreaPlot,
1480
- zt as AxisOverlay,
1481
- Lt as BarPlot,
1490
+ _t as AreaPlot,
1491
+ Nt as AxisOverlay,
1492
+ Ut as BarPlot,
1482
1493
  De as CANPLOT_LAYER,
1483
- Rt as CanPlot,
1484
- Ft as ChartAreaInteractions,
1485
- Yt as Crosshair,
1494
+ Dt as CanPlot,
1495
+ Kt as ChartAreaInteractions,
1496
+ Bt as Crosshair,
1486
1497
  Ie as FrameDrawer,
1487
- Dt as LinePlot,
1488
- It as ScatterPlot,
1489
- Bt as SelectBox,
1490
- _t as SparklinePlot,
1491
- Kt as TooltipsX,
1492
- Xt as XTicks,
1493
- Ot as YTicks,
1498
+ It as LinePlot,
1499
+ Lt as ScatterPlot,
1500
+ zt as SelectBox,
1501
+ Xt as SparklinePlot,
1502
+ Yt as TooltipsX,
1503
+ Ot as XTicks,
1504
+ Ft as YTicks,
1494
1505
  U as applyStyles,
1495
- ie as clamp,
1506
+ re as clamp,
1496
1507
  V as clampXPosToChartArea,
1497
1508
  H as clampYPosToChartArea,
1498
1509
  O as deepEqual,
1499
- ft as defaultNumericalTicksFormatter,
1500
- At as findClosestIndex,
1510
+ mt as defaultNumericalTicksFormatter,
1511
+ Rt as findClosestIndex,
1501
1512
  X as getScale,
1502
- Nt as makeLinearTicks,
1503
- Ct as makeTimeTickFormat,
1504
- $t as makeTimeTicks,
1513
+ $t as makeLinearTicks,
1514
+ Pt as makeTimeTickFormat,
1515
+ jt as makeTimeTicks,
1505
1516
  _ as posToVal,
1506
- He as pxToValDistance,
1517
+ We as pxToValDistance,
1507
1518
  kt as sum,
1508
1519
  j as useDrawEffect,
1509
1520
  Le as useFrameState,