@canplot/react 0.5.6 → 0.5.8

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
@@ -2,8 +2,8 @@ var Be = Object.defineProperty;
2
2
  var ze = (e, t, n) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var O = (e, t, n) => ze(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsxs as pe, jsx as R, Fragment as Ne } from "react/jsx-runtime";
5
- import D, { version as $e, createContext as ye, forwardRef as je, useRef as A, useState as B, useMemo as Z, useLayoutEffect as $, useCallback as Ve, useContext as q, useEffect as Ae, useId as He } from "react";
6
- const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n) => t + (n ?? 0), 0), Rt = (e, t) => {
5
+ import D, { version as $e, createContext as ye, forwardRef as je, useRef as k, useState as B, useMemo as Z, useLayoutEffect as $, useCallback as Ve, useContext as q, useEffect as ke, useId as He } 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), 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);
@@ -12,46 +12,46 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n)
12
12
  const o = X(e, n);
13
13
  if (!o)
14
14
  return null;
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;
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;
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, r = X(e, n);
22
- if (!r)
21
+ const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = X(e, n);
22
+ if (!i)
23
23
  return null;
24
- const i = (r.origin === "x" ? o.width : o.height) / (r.max - r.min);
25
- return t * i;
24
+ const r = (i.origin === "x" ? o.width : o.height) / (i.max - i.min);
25
+ return t * r;
26
26
  }, G = (e, t, n, s) => {
27
27
  const o = X(e, n);
28
28
  if (!o)
29
29
  return null;
30
- const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = ge(
30
+ const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = ge(
31
31
  e,
32
32
  t - o.min,
33
33
  n,
34
34
  s
35
35
  );
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
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
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 re(t, s.x, s.x + s.width);
49
+ return ie(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 re(t, s.y, s.y + s.height);
54
+ return ie(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 re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n)
61
61
  const o = X(e, n);
62
62
  if (!o)
63
63
  return null;
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);
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);
66
66
  }, F = (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;
@@ -92,12 +92,12 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (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 r = o.y + o.height;
96
- t.beginPath(), t.moveTo(o.x, r), t.lineTo(o.x + o.width, r), t.stroke();
95
+ const i = o.y + o.height;
96
+ t.beginPath(), t.moveTo(o.x, i), t.lineTo(o.x + o.width, i), t.stroke();
97
97
  }
98
98
  } else if (s.axis.position === "left") {
99
- const r = o.x + o.width;
100
- t.beginPath(), t.moveTo(r, o.y), t.lineTo(r, o.y + o.height), t.stroke();
99
+ const i = o.x + o.width;
100
+ t.beginPath(), t.moveTo(i, o.y), t.lineTo(i, 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
  }
@@ -111,8 +111,8 @@ function Ze(e) {
111
111
  return (t) => {
112
112
  const n = [];
113
113
  for (const s of e) {
114
- const o = me(s, t), r = typeof o == "function";
115
- n.push(r ? o : () => me(s, null));
114
+ const o = me(s, t), i = typeof o == "function";
115
+ n.push(i ? o : () => me(s, null));
116
116
  }
117
117
  return () => {
118
118
  for (const s of n) s();
@@ -133,9 +133,9 @@ const Re = ye({
133
133
  }
134
134
  }), Qe = () => {
135
135
  const e = [];
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);
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);
139
139
  }), notifyListeners: () => {
140
140
  for (const [, s] of e)
141
141
  s();
@@ -170,18 +170,18 @@ class Le {
170
170
  }
171
171
  }
172
172
  const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
173
- const r = A(null), i = A(null), c = tt(i), [l, u] = B(null), f = Z(
174
- () => nt(e, c, l),
175
- [e, c, l]
173
+ const i = k(null), r = k(null), c = tt(r), [u, l] = B(null), p = Z(
174
+ () => nt(e, c, u),
175
+ [e, c, u]
176
176
  );
177
177
  $(() => {
178
- u(r.current?.getContext("2d") || null);
179
- }, [r]);
180
- const m = window.devicePixelRatio || 1;
178
+ l(i.current?.getContext("2d") || null);
179
+ }, [i]);
180
+ const d = window.devicePixelRatio || 1;
181
181
  return /* @__PURE__ */ pe(
182
182
  "div",
183
183
  {
184
- ref: Je([o, i]),
184
+ ref: Je([o, r]),
185
185
  style: {
186
186
  position: "relative",
187
187
  overflow: "hidden",
@@ -193,9 +193,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
193
193
  /* @__PURE__ */ R(
194
194
  "canvas",
195
195
  {
196
- ref: r,
197
- width: c.width * m,
198
- height: c.height * m,
196
+ ref: i,
197
+ width: c.width * d,
198
+ height: c.height * d,
199
199
  style: {
200
200
  inset: 0,
201
201
  position: "absolute",
@@ -204,7 +204,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
204
204
  }
205
205
  }
206
206
  ),
207
- f && /* @__PURE__ */ R(et, { frame: f, children: t })
207
+ p && /* @__PURE__ */ R(et, { frame: p, children: t })
208
208
  ]
209
209
  }
210
210
  );
@@ -216,10 +216,10 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
216
216
  $(() => {
217
217
  e?.ctx.clearRect(0, 0, e.ctx.canvas.width, e.ctx.canvas.height);
218
218
  }, [e, s]);
219
- const r = A(null);
220
- r.current = e, $(() => {
219
+ const i = k(null);
220
+ i.current = e, $(() => {
221
221
  n.subscribe(() => {
222
- r.current && qe(r.current);
222
+ i.current && qe(i.current);
223
223
  }, Ie.BOTTOM);
224
224
  }, [n]), $(() => {
225
225
  let c = null;
@@ -229,27 +229,27 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
229
229
  c && cancelAnimationFrame(c);
230
230
  };
231
231
  }, [s, e, n]);
232
- const i = Ve(() => {
232
+ const r = Ve(() => {
233
233
  o((c) => c + 1);
234
234
  }, [o]);
235
- return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: i, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
235
+ return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: r, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
236
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 r of o) {
242
- const i = Math.round(r.contentRect.width), c = Math.round(r.contentRect.height);
241
+ for (const i of o) {
242
+ const r = Math.round(i.contentRect.width), c = Math.round(i.contentRect.height);
243
243
  n(
244
- (l) => l.width !== i || l.height !== c ? { ...l, width: i, height: c } : l
244
+ (u) => u.width !== r || u.height !== c ? { ...u, width: r, height: c } : u
245
245
  );
246
246
  }
247
247
  }));
248
248
  return $(() => {
249
249
  if (!e.current) return;
250
- const o = e.current.clientWidth, r = e.current.clientHeight;
250
+ const o = e.current.clientWidth, i = e.current.clientHeight;
251
251
  return n(
252
- (i) => i.width !== o || i.height !== r ? { ...i, width: o, height: r } : i
252
+ (r) => r.width !== o || r.height !== i ? { ...r, width: o, height: i } : r
253
253
  ), s.observe(e.current, { box: "border-box" }), () => s.disconnect();
254
254
  }, [s, e]), t;
255
255
  }, nt = (e, t, n) => {
@@ -269,33 +269,33 @@ const Dt = je(({ configuration: e, children: t, style: n, ...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 r = {
272
+ const i = {
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
- }, i = [];
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;
277
+ }, r = [];
278
+ let c = e.padding.left * s, u = t.width * s - e.padding.right * s, l = t.height * s - e.padding.bottom * s, p = e.padding.top * s;
279
279
  for (const a of e.scales) {
280
280
  if (!a.axis) {
281
- i.push({ ...a, axis: null });
281
+ r.push({ ...a, axis: null });
282
282
  continue;
283
283
  }
284
- let p;
284
+ let g;
285
285
  if (a.origin === "x")
286
286
  switch (a.axis.position) {
287
287
  case "bottom":
288
- u -= a.axis.size * s, p = {
288
+ l -= a.axis.size * s, g = {
289
289
  x: o.x,
290
- y: u / s,
290
+ y: l / s,
291
291
  width: o.width,
292
292
  height: a.axis.size
293
293
  };
294
294
  break;
295
295
  case "top":
296
- f += a.axis.size * s, p = {
296
+ p += a.axis.size * s, g = {
297
297
  x: o.x,
298
- y: f / s - a.axis.size,
298
+ y: p / s - a.axis.size,
299
299
  width: o.width,
300
300
  height: a.axis.size
301
301
  };
@@ -307,7 +307,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
307
307
  else
308
308
  switch (a.axis.position) {
309
309
  case "left":
310
- c += a.axis.size * s, p = {
310
+ c += a.axis.size * s, g = {
311
311
  x: c / s - a.axis.size,
312
312
  y: o.y,
313
313
  width: a.axis.size,
@@ -315,8 +315,8 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
315
315
  };
316
316
  break;
317
317
  case "right":
318
- l -= a.axis.size * s, p = {
319
- x: l / s,
318
+ u -= a.axis.size * s, g = {
319
+ x: u / s,
320
320
  y: o.y,
321
321
  width: a.axis.size,
322
322
  height: o.height
@@ -326,18 +326,18 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
326
326
  case "bottom":
327
327
  throw new Error("Invalid axis position for y origin");
328
328
  }
329
- const d = {
330
- x: p.x * s,
331
- y: p.y * s,
332
- width: p.width * s,
333
- height: p.height * s
329
+ const f = {
330
+ x: g.x * s,
331
+ y: g.y * s,
332
+ width: g.width * s,
333
+ height: g.height * s
334
334
  };
335
- i.push({
335
+ r.push({
336
336
  ...a,
337
337
  axis: {
338
338
  ...a.axis,
339
- cssRect: p,
340
- canvasRect: d
339
+ cssRect: g,
340
+ canvasRect: f
341
341
  }
342
342
  });
343
343
  }
@@ -345,32 +345,32 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
345
345
  ctx: n,
346
346
  dpr: s,
347
347
  padding: e.padding,
348
- scales: i,
348
+ scales: r,
349
349
  chartAreaCSS: o,
350
- chartAreaCanvasPX: r
350
+ chartAreaCanvasPX: i
351
351
  };
352
352
  }, j = (e, t, n) => {
353
- const s = q(ve), o = q(De), r = q(Re);
353
+ const s = q(ve), o = q(De), i = q(Re);
354
354
  if (!s || !o)
355
355
  throw new Error("useFrame must be used within a CanPlot component");
356
- const [i] = B(() => new Le());
357
- i._updateFrame(s);
358
- const c = A(i);
359
- c.current = i;
360
- const l = A(t);
361
- l.current = t, $(() => {
362
- const u = r.subscribe(
356
+ const [r] = B(() => new Le());
357
+ r._updateFrame(s);
358
+ const c = k(r);
359
+ c.current = r;
360
+ const u = k(t);
361
+ u.current = t, $(() => {
362
+ const l = i.subscribe(
363
363
  () => {
364
- l.current(i);
364
+ u.current(r);
365
365
  },
366
366
  typeof e == "number" ? e : Ie[e]
367
367
  );
368
368
  return () => {
369
- u();
369
+ l();
370
370
  };
371
- }, [r, e, i]), $(() => {
371
+ }, [i, e, r]), $(() => {
372
372
  o();
373
- }, [o, ...n]), Ae(() => () => {
373
+ }, [o, ...n]), ke(() => () => {
374
374
  o();
375
375
  }, [o]);
376
376
  }, Ue = () => {
@@ -381,189 +381,196 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
381
381
  const t = new Le();
382
382
  return t._updateFrame(e), t;
383
383
  }, [e]);
384
- }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
384
+ }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o, globalAlpha: i }) => (j(
385
385
  e,
386
- ({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
387
- r.save(), r.beginPath(), U(r, o);
388
- for (const u of t) {
389
- const f = i(l(u.x, n, "canvas")), m = c(l(u.y, s, "canvas"));
390
- f === null || m === null || r.lineTo(f, m);
386
+ ({ ctx: r, clampXPosToChartArea: c, clampYPosToChartArea: u, valToPos: l }) => {
387
+ r.save(), r.beginPath(), U(r, o), i !== void 0 && (r.globalAlpha = i);
388
+ for (const p of t) {
389
+ const d = c(l(p.x, n, "canvas")), a = u(l(p.y, s, "canvas"));
390
+ d === null || a === null || r.lineTo(d, a);
391
391
  }
392
392
  r.stroke(), r.restore();
393
393
  },
394
- [t, n, s, o]
394
+ [t, n, s, o, i]
395
395
  ), null), It = D.memo(st, F), ot = ({
396
396
  layer: e = "MIDDLE",
397
397
  data: t,
398
398
  xScaleId: n,
399
399
  yScaleId: s,
400
400
  xStrategy: o = "clip",
401
- yStrategy: r = "clip",
402
- radius: i = 5,
401
+ yStrategy: i = "clip",
402
+ radius: r = 5,
403
403
  style: c,
404
- globalAlpha: l
404
+ globalAlpha: u
405
405
  }) => (j(
406
406
  e,
407
407
  ({
408
- ctx: u,
409
- valToPos: f,
410
- valFits: m,
408
+ ctx: l,
409
+ valToPos: p,
410
+ valFits: d,
411
411
  clampXPosToChartArea: a,
412
- clampYPosToChartArea: p
412
+ clampYPosToChartArea: g
413
413
  }) => {
414
- u.save(), u.beginPath();
415
- const d = new Path2D();
416
- U(u, c), l !== void 0 && (u.globalAlpha = l);
414
+ l.save(), U(l, c), u !== void 0 && (l.globalAlpha = u);
415
+ const f = [];
417
416
  for (const y of t) {
418
- let h, g;
419
- switch (o) {
420
- case "clip":
421
- if (!m(y.x, n))
422
- continue;
423
- h = f(y.x, n);
424
- break;
425
- case "clamp": {
426
- if (f(y.x, n) === null)
427
- continue;
428
- h = a(f(y.x, n), "canvas");
429
- break;
430
- }
417
+ let h = null, m = null;
418
+ const w = p(y.x, n);
419
+ if (w === null) continue;
420
+ if (o === "clip") {
421
+ if (!d(y.x, n)) continue;
422
+ h = w;
423
+ } else
424
+ h = a(w, "canvas");
425
+ const x = p(y.y, s);
426
+ if (x !== null) {
427
+ if (i === "clip") {
428
+ if (!d(y.y, s)) continue;
429
+ m = x;
430
+ } else
431
+ m = g(x, "canvas");
432
+ h === null || m === null || f.push({ x: h, y: m });
431
433
  }
432
- switch (r) {
433
- case "clip":
434
- if (!m(y.y, s))
435
- continue;
436
- g = f(y.y, s);
437
- break;
438
- case "clamp":
439
- g = p(f(y.y, s), "canvas");
440
- break;
441
- }
442
- h === null || g === null || (d.moveTo(h + i, g), d.arc(h, g, i, 0, Math.PI * 2));
443
434
  }
444
- u.fill(d), u.stroke(d), u.restore();
435
+ if (c?.fillStyle)
436
+ for (const y of f)
437
+ l.beginPath(), l.arc(y.x, y.y, r, 0, Math.PI * 2), l.fill();
438
+ if (c?.strokeStyle) {
439
+ l.beginPath();
440
+ for (const y of f)
441
+ l.moveTo(y.x + r, y.y), l.arc(y.x, y.y, r, 0, Math.PI * 2);
442
+ l.stroke();
443
+ }
444
+ l.restore();
445
445
  },
446
- [t, n, s, i, c, l]
447
- ), null), Lt = D.memo(ot, F), rt = ({
446
+ [t, n, s, r, c, u]
447
+ ), null), Lt = D.memo(ot, F), it = ({
448
448
  data: e,
449
449
  xScaleId: t,
450
450
  yScaleId: n,
451
451
  style: s,
452
452
  barWidth: o,
453
- xPositionOffset: r,
454
- radius: i,
455
- layer: c = "MIDDLE"
453
+ xPositionOffset: i,
454
+ globalAlpha: r,
455
+ radius: c,
456
+ layer: u = "MIDDLE"
456
457
  }) => (j(
457
- c,
458
+ u,
458
459
  ({
459
460
  ctx: l,
460
- valToPxDistance: u,
461
- valToPos: f,
462
- clampXPosToChartArea: m,
463
- clampYPosToChartArea: a
461
+ valToPxDistance: p,
462
+ valToPos: d,
463
+ clampXPosToChartArea: a,
464
+ clampYPosToChartArea: g
464
465
  }) => {
465
466
  if (e.length === 0) return;
466
- l.save(), U(l, s);
467
- const p = u(o, t) ?? 0;
468
- l.beginPath();
469
- for (const d of e) {
470
- const y = f(d.x, t);
471
- if (y === null)
472
- continue;
473
- const h = y - p / 2 + r * p, g = a(
474
- f(0, n, "canvas"),
475
- "canvas"
476
- );
477
- if (g === null)
467
+ const f = g(
468
+ d(0, n, "canvas"),
469
+ "canvas"
470
+ );
471
+ if (f === null)
472
+ return;
473
+ const y = p(o, t, "canvas") ?? 0, h = [];
474
+ for (const m of e) {
475
+ const w = d(m.x, t, "canvas");
476
+ if (w === null)
478
477
  continue;
479
- const w = a(
480
- f(d.y, n, "canvas"),
478
+ const x = w - y / 2 + i * y, T = g(
479
+ d(m.y, n, "canvas"),
481
480
  "canvas"
482
481
  );
483
- if (w === null)
482
+ if (T === null)
484
483
  continue;
485
- const x = g - w, b = m(h, "canvas"), v = m(h + p, "canvas") - b;
486
- i ? l.roundRect(
487
- b,
488
- w,
489
- v,
490
- x,
491
- i
492
- ) : l.rect(b, w, v, x);
484
+ const v = f - T, b = a(x, "canvas"), S = a(x + y, "canvas") - b;
485
+ h.push({
486
+ x: b,
487
+ y: T,
488
+ width: S,
489
+ height: v
490
+ });
491
+ }
492
+ if (l.save(), U(l, s), r !== void 0 && (l.globalAlpha = r), s?.fillStyle)
493
+ for (const m of h)
494
+ l.beginPath(), c ? l.roundRect(m.x, m.y, m.width, m.height, c) : l.rect(m.x, m.y, m.width, m.height), l.fill();
495
+ if (s?.strokeStyle) {
496
+ l.beginPath();
497
+ for (const m of h)
498
+ c ? l.roundRect(m.x, m.y, m.width, m.height, c) : l.rect(m.x, m.y, m.width, m.height);
499
+ l.stroke();
493
500
  }
494
- l.closePath(), l.fill(), s?.strokeStyle && l.stroke(), l.restore();
501
+ l.restore();
495
502
  },
496
- [e, t, n, s, o, r, i]
497
- ), null), Ut = D.memo(rt, F), it = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
503
+ [e, t, n, s, o, i, c]
504
+ ), null), Ut = D.memo(it, F), rt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
498
505
  e,
499
- ({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
500
- const u = [];
501
- for (const m of t) {
502
- const a = i(l(m.x, n));
506
+ ({ ctx: i, clampXPosToChartArea: r, clampYPosToChartArea: c, valToPos: u }) => {
507
+ const l = [];
508
+ for (const d of t) {
509
+ const a = r(u(d.x, n));
503
510
  if (a === null)
504
511
  continue;
505
- const p = c(l(m.y[0], s));
506
- if (p === null)
512
+ const g = c(u(d.y[0], s));
513
+ if (g === null)
507
514
  continue;
508
- const d = c(l(m.y[1], s));
509
- d !== null && (u.push({ x: a, y: p }), u.unshift({ x: a, y: d }));
515
+ const f = c(u(d.y[1], s));
516
+ f !== null && (l.push({ x: a, y: g }), l.unshift({ x: a, y: f }));
510
517
  }
511
- const f = u[0];
512
- if (f) {
513
- r.save(), r.beginPath(), U(r, o), r.moveTo(f.x, f.y);
514
- for (const m of u)
515
- r.lineTo(m.x, m.y);
516
- r.closePath(), r.fill(), r.restore();
518
+ const p = l[0];
519
+ if (p) {
520
+ i.save(), i.beginPath(), U(i, o), i.moveTo(p.x, p.y);
521
+ for (const d of l)
522
+ i.lineTo(d.x, d.y);
523
+ i.closePath(), i.fill(), i.restore();
517
524
  }
518
525
  },
519
526
  [t, n, s, o]
520
- ), null), _t = D.memo(it, F), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: r }) => (j(
527
+ ), null), _t = D.memo(rt, F), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: i }) => (j(
521
528
  e,
522
- ({ ctx: i, clampXPosToChartArea: c, clampYPosToChartArea: l, valToPos: u }) => {
523
- const f = [];
524
- for (const d of t) {
525
- const y = c(u(d.x, s)), h = l(u(d.y, o));
526
- y === null || h === null || f.push({ x: y, y: h });
529
+ ({ ctx: r, clampXPosToChartArea: c, clampYPosToChartArea: u, valToPos: l }) => {
530
+ const p = [];
531
+ for (const f of t) {
532
+ const y = c(l(f.x, s)), h = u(l(f.y, o));
533
+ y === null || h === null || p.push({ x: y, y: h });
527
534
  }
528
- const m = f.at(0), a = f.at(-1);
529
- if (!m || !a)
535
+ const d = p.at(0), a = p.at(-1);
536
+ if (!d || !a)
530
537
  return;
531
- const p = l(u(0, o));
532
- if (p !== null) {
533
- i.save(), i.beginPath(), U(i, r), i.moveTo(m.x, p);
534
- for (const d of f)
535
- i.lineTo(d.x, d.y);
536
- if (i.lineTo(a.x, p), i.closePath(), i.fill(), n) {
537
- i.beginPath(), i.moveTo(m.x, m.y);
538
- for (const d of f)
539
- i.lineTo(d.x, d.y);
540
- i.stroke();
538
+ const g = u(l(0, o));
539
+ if (g !== null) {
540
+ r.save(), r.beginPath(), U(r, i), r.moveTo(d.x, g);
541
+ for (const f of p)
542
+ r.lineTo(f.x, f.y);
543
+ if (r.lineTo(a.x, g), r.closePath(), r.fill(), n) {
544
+ r.beginPath(), r.moveTo(d.x, d.y);
545
+ for (const f of p)
546
+ r.lineTo(f.x, f.y);
547
+ r.stroke();
541
548
  }
542
- i.restore();
549
+ r.restore();
543
550
  }
544
551
  },
545
- [t, n, s, o, r]
552
+ [t, n, s, o, i]
546
553
  ), null), Xt = D.memo(ct, F), at = ({
547
554
  layer: e = "BOTTOM",
548
555
  scaleId: t,
549
556
  tickStyle: n,
550
557
  labelStyle: s,
551
558
  labelGap: o,
552
- tickSize: r,
553
- ticks: i
559
+ tickSize: i,
560
+ ticks: r
554
561
  }) => (j(
555
562
  e,
556
- ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
557
- const m = u(t);
558
- if (!m || !m.axis || m.origin !== "x") return;
559
- const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, d = window.devicePixelRatio || 1, y = p, h = (r ?? 6) * d, g = a.position === "top" ? p - h : p + h, w = (o ?? 12) * d;
563
+ ({ ctx: c, valToPos: u, getScale: l, frame: p }) => {
564
+ const d = l(t);
565
+ if (!d || !d.axis || d.origin !== "x") return;
566
+ const a = d.axis, g = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, f = window.devicePixelRatio || 1, y = g, h = (i ?? 6) * f, m = a.position === "top" ? g - h : g + h, w = (o ?? 12) * f;
560
567
  c.save(), c.fontKerning = "auto", U(c, {
561
568
  ...n
562
569
  }), c.beginPath();
563
- const x = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
564
- for (const { value: b } of x) {
565
- const v = l(b, t, "canvas");
566
- v !== null && (c.moveTo(v, y), c.lineTo(v, g));
570
+ const x = Array.isArray(r) ? r : r({ ...d, axis: a }, p);
571
+ for (const { value: T } of x) {
572
+ const v = u(T, t, "canvas");
573
+ v !== null && (c.moveTo(v, y), c.lineTo(v, m));
567
574
  }
568
575
  c.stroke(), c.restore(), c.save(), U(c, {
569
576
  textBaseline: a.position === "top" ? "bottom" : "top",
@@ -573,36 +580,36 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
573
580
  // alter font size for DPR
574
581
  font: _e(s?.font ?? n?.font)
575
582
  });
576
- for (const { value: b, label: v } of x) {
577
- const T = l(b, t, "canvas");
578
- if (T === null)
583
+ for (const { value: T, label: v } of x) {
584
+ const b = u(T, t, "canvas");
585
+ if (b === null)
579
586
  continue;
580
- const C = v.split(`
587
+ const S = v.split(`
581
588
  `);
582
- for (let E = 0; E < C.length; E++)
583
- c.fillText(C[E], T, g + d * 2 + E * w);
589
+ for (let E = 0; E < S.length; E++)
590
+ c.fillText(S[E], b, m + f * 2 + E * w);
584
591
  }
585
592
  c.restore();
586
593
  },
587
- [i, t, n, s]
594
+ [r, t, n, s]
588
595
  ), null), Ft = D.memo(at, F), lt = ({
589
596
  layer: e = "BOTTOM",
590
597
  scaleId: t,
591
598
  tickStyle: n,
592
599
  labelStyle: s,
593
600
  labelGap: o,
594
- tickSize: r,
595
- ticks: i
601
+ tickSize: i,
602
+ ticks: r
596
603
  }) => (j(
597
604
  e,
598
- ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
599
- const m = u(t);
600
- if (!m || !m.axis || m.origin !== "y") return;
601
- const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, d = p, y = r ?? 6, h = a.position === "left" ? p - y : p + y, g = o ?? 12, w = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
605
+ ({ ctx: c, valToPos: u, getScale: l, frame: p }) => {
606
+ const d = l(t);
607
+ if (!d || !d.axis || d.origin !== "y") return;
608
+ const a = d.axis, g = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, f = g, y = i ?? 6, h = a.position === "left" ? g - y : g + y, m = o ?? 12, w = Array.isArray(r) ? r : r({ ...d, axis: a }, p);
602
609
  c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
603
610
  for (const { value: x } of w) {
604
- const b = l(x, t, "canvas");
605
- b !== null && (c.moveTo(d, b), c.lineTo(h, b));
611
+ const T = u(x, t, "canvas");
612
+ T !== null && (c.moveTo(f, T), c.lineTo(h, T));
606
613
  }
607
614
  c.stroke(), c.restore(), c.save(), U(c, {
608
615
  textBaseline: "middle",
@@ -612,18 +619,18 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
612
619
  // alter font size for DPR
613
620
  font: _e(s?.font ?? n?.font)
614
621
  });
615
- for (const { value: x, label: b } of w) {
616
- const v = l(x, t, "canvas");
622
+ for (const { value: x, label: T } of w) {
623
+ const v = u(x, t, "canvas");
617
624
  if (v === null)
618
625
  continue;
619
- const T = b.split(`
626
+ const b = T.split(`
620
627
  `);
621
- for (let C = 0; C < T.length; C++)
622
- c.fillText(` ${T[C]} `, h, v + C * g);
628
+ for (let S = 0; S < b.length; S++)
629
+ c.fillText(` ${b[S]} `, h, v + S * m);
623
630
  }
624
631
  c.restore();
625
632
  },
626
- [i, t, n, s]
633
+ [r, t, n, s]
627
634
  ), null), Ot = D.memo(lt, F), _e = (e) => {
628
635
  if (e)
629
636
  try {
@@ -661,8 +668,8 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
661
668
  const s = D.useRef(n);
662
669
  s.current = n, D.useEffect(() => M[e].addEventListener(
663
670
  t,
664
- (r, i) => {
665
- s.current(i, r);
671
+ (i, r) => {
672
+ s.current(r, i);
666
673
  }
667
674
  ), [t, e, s]);
668
675
  }, we = D.createContext(""), xe = (e, t) => {
@@ -670,23 +677,23 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
670
677
  return L(e, n, t);
671
678
  }, ut = (e, t, n, s, o) => {
672
679
  if (!t) return;
673
- 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 ? {
674
- scaleId: r,
675
- value: _(n, c, r, "css")
676
- } : null, u = e.clientY - t.top, f = i ? {
680
+ const i = s ?? n.scales.find((d) => d.origin === "x")?.id, r = o ?? n.scales.find((d) => d.origin === "y")?.id, c = e.clientX - t.left, u = i ? {
677
681
  scaleId: i,
678
- value: _(n, u, i, "css")
682
+ value: _(n, c, i, "css")
683
+ } : null, l = e.clientY - t.top, p = r ? {
684
+ scaleId: r,
685
+ value: _(n, l, r, "css")
679
686
  } : null;
680
- return { pointerSyncPosition: { x: l, y: f }, cssX: c, cssY: u };
687
+ return { pointerSyncPosition: { x: u, y: p }, cssX: c, cssY: l };
681
688
  }, N = (e, t) => {
682
- 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;
689
+ 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;
683
690
  return {
684
691
  cssX: o,
685
- cssY: r,
692
+ cssY: i,
686
693
  scaled: Object.fromEntries(
687
- t.scales.flatMap((i) => {
688
- const c = i.origin === "y" ? r : o;
689
- return c === null ? [] : [[i.id, _(t, c, i.id, "css")]];
694
+ t.scales.flatMap((r) => {
695
+ const c = r.origin === "y" ? i : o;
696
+ return c === null ? [] : [[r.id, _(t, c, r.id, "css")]];
690
697
  })
691
698
  )
692
699
  };
@@ -704,16 +711,16 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
704
711
  );
705
712
  if (s === null || o === null)
706
713
  return null;
707
- const r = n.scales.flatMap(
708
- (i) => {
709
- if (i.origin !== e)
714
+ const i = n.scales.flatMap(
715
+ (r) => {
716
+ if (r.origin !== e)
710
717
  return [];
711
- const c = _(n, s, i.id, "css"), l = _(n, o, i.id, "css");
712
- return c === null || l === null ? [] : [
718
+ const c = _(n, s, r.id, "css"), u = _(n, o, r.id, "css");
719
+ return c === null || u === null ? [] : [
713
720
  {
714
- scaleId: i.id,
721
+ scaleId: r.id,
715
722
  from: c,
716
- to: l
723
+ to: u
717
724
  }
718
725
  ];
719
726
  }
@@ -721,7 +728,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
721
728
  return {
722
729
  fromCSS: s,
723
730
  toCSS: o,
724
- scaled: r
731
+ scaled: i
725
732
  };
726
733
  }, Kt = ({
727
734
  id: e,
@@ -729,51 +736,51 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
729
736
  onDblClick: n,
730
737
  onMouseMove: s,
731
738
  onMouseDown: o,
732
- onMouseUp: r,
733
- onDocumentMouseUp: i,
739
+ onMouseUp: i,
740
+ onDocumentMouseUp: r,
734
741
  onSpanSelect: c,
735
- onContextMenu: l,
736
- className: u,
737
- style: f,
738
- sync: m,
742
+ onContextMenu: u,
743
+ className: l,
744
+ style: p,
745
+ sync: d,
739
746
  innerChildren: a,
740
- children: p
747
+ children: g
741
748
  }) => {
742
- const d = He();
743
- return L("dblclick", d, (y) => {
749
+ const f = He();
750
+ return L("dblclick", f, (y) => {
744
751
  n?.(y);
745
- }), L("click", d, (y) => {
752
+ }), L("click", f, (y) => {
746
753
  t?.(y);
747
- }), L("move", d, (y) => {
754
+ }), L("move", f, (y) => {
748
755
  s?.(y);
749
- }), L("mousedown", d, (y) => {
756
+ }), L("mousedown", f, (y) => {
750
757
  o?.(y);
751
- }), L("mouseup", d, (y) => {
752
- r?.(y);
753
- }), L("documentmouseup", d, (y) => {
758
+ }), L("mouseup", f, (y) => {
754
759
  i?.(y);
755
- }), L("spanselect", d, (y) => {
760
+ }), L("documentmouseup", f, (y) => {
761
+ r?.(y);
762
+ }), L("spanselect", f, (y) => {
756
763
  c?.(y);
757
- }), L("contextmenu", d, (y) => {
758
- l?.(y);
759
- }), /* @__PURE__ */ pe(we.Provider, { value: d, children: [
764
+ }), L("contextmenu", f, (y) => {
765
+ u?.(y);
766
+ }), /* @__PURE__ */ pe(we.Provider, { value: f, children: [
760
767
  /* @__PURE__ */ R(
761
768
  ht,
762
769
  {
763
770
  id: e,
764
- className: u,
765
- style: f,
766
- sync: m,
771
+ className: l,
772
+ style: p,
773
+ sync: d,
767
774
  children: a
768
775
  }
769
776
  ),
770
- p
777
+ g
771
778
  ] });
772
779
  }, ht = ({ id: e, className: t, style: n, sync: s, children: o }) => {
773
- const r = A(null), i = Ue().frame, c = A(i);
774
- c.current = i;
775
- const l = q(we), u = s?.key || l, f = A(null), m = A(null), a = A(null), p = () => {
776
- const h = r.current?.parentElement;
780
+ const i = k(null), r = Ue().frame, c = k(r);
781
+ c.current = r;
782
+ const u = q(we), l = s?.key || u, p = k(null), d = k(null), a = k(null), g = () => {
783
+ const h = i.current?.parentElement;
777
784
  if (h) {
778
785
  if (h.dataset.canplotroot === void 0)
779
786
  throw new Error(
@@ -781,15 +788,15 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
781
788
  );
782
789
  return h.getBoundingClientRect();
783
790
  }
784
- }, d = (h, g) => {
791
+ }, f = (h, m) => {
785
792
  const w = ut(
786
793
  h,
787
- p(),
794
+ g(),
788
795
  c.current,
789
796
  s?.xViaScaleId,
790
797
  s?.yViaScaleId
791
798
  );
792
- w && g(
799
+ w && m(
793
800
  w.pointerSyncPosition,
794
801
  { cssX: w.cssX, cssY: w.cssY },
795
802
  {
@@ -799,14 +806,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
799
806
  metaKey: h.metaKey
800
807
  }
801
808
  );
802
- }, y = A(d);
803
- return y.current = d, Ae(() => {
809
+ }, y = k(f);
810
+ return y.current = f, ke(() => {
804
811
  const h = (v) => {
805
- const T = m.current;
806
- T && M.spanselect.dispatchEvent(l, {
807
- ...T,
812
+ const b = d.current;
813
+ b && M.spanselect.dispatchEvent(u, {
814
+ ...b,
808
815
  completed: !0
809
- }), M.documentmouseup.dispatchEvent(l, {
816
+ }), M.documentmouseup.dispatchEvent(u, {
810
817
  frame: c.current,
811
818
  keys: {
812
819
  ctrlKey: v.ctrlKey,
@@ -815,38 +822,38 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
815
822
  metaKey: v.metaKey
816
823
  }
817
824
  });
818
- }, g = (v) => {
819
- const T = {
825
+ }, m = (v) => {
826
+ const b = {
820
827
  ctrlKey: v.ctrlKey,
821
828
  altKey: v.altKey,
822
829
  shiftKey: v.shiftKey,
823
830
  metaKey: v.metaKey
824
- }, C = a.current;
825
- if (C && Object.entries(T).some(
826
- ([S, P]) => C.keys[S] !== P
831
+ }, S = a.current;
832
+ if (S && Object.entries(b).some(
833
+ ([C, P]) => S.keys[C] !== P
827
834
  )) {
828
- const S = { ...C, keys: T };
829
- a.current = S, M.sync_move.dispatchEvent(u, S);
835
+ const C = { ...S, keys: b };
836
+ a.current = C, M.sync_move.dispatchEvent(l, C);
830
837
  }
831
- const E = m.current;
832
- if (E && Object.entries(T).some(
833
- ([S, P]) => E.keys[S] !== P
838
+ const E = d.current;
839
+ if (E && Object.entries(b).some(
840
+ ([C, P]) => E.keys[C] !== P
834
841
  )) {
835
842
  v.stopPropagation(), v.preventDefault();
836
- const S = { ...E, keys: T };
837
- m.current = S, M.spanselect.dispatchEvent(l, S);
843
+ const C = { ...E, keys: b };
844
+ d.current = C, M.spanselect.dispatchEvent(u, C);
838
845
  }
839
846
  }, w = (v) => {
840
847
  y.current(
841
848
  v,
842
- (T, { cssX: C, cssY: E }, S) => {
843
- const P = f.current;
844
- if (!P || !T.x || !T.y) return;
845
- const k = c.current, z = P.xRangeCss.start, ae = C, le = P.yRangeCss.start, ue = E, J = X(k, T.x.scaleId);
849
+ (b, { cssX: S, cssY: E }, C) => {
850
+ const P = p.current;
851
+ if (!P || !b.x || !b.y) return;
852
+ const A = c.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, J = X(A, b.x.scaleId);
846
853
  if (!J) return;
847
- const Q = X(k, T.y.scaleId);
854
+ const Q = X(A, b.y.scaleId);
848
855
  if (!Q) return;
849
- f.current = {
856
+ p.current = {
850
857
  xRangeCss: { start: z, end: ae },
851
858
  yRangeCss: { start: le, end: ue }
852
859
  };
@@ -854,28 +861,28 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
854
861
  const he = Math.abs(le - ue), de = Math.abs(z - ae);
855
862
  he < 10 && de < 10 ? W = "below_threshold" : he > 30 && de > 30 ? W = "box" : he > de ? W = "y" : W = "x";
856
863
  const Te = _(
857
- k,
864
+ A,
858
865
  V(c.current, z, "css"),
859
866
  J.id,
860
867
  "css"
861
868
  );
862
869
  if (Te === null) return;
863
- const Ce = _(
864
- k,
870
+ const Se = _(
871
+ A,
865
872
  V(c.current, ae, "css"),
866
873
  J.id,
867
874
  "css"
868
875
  );
869
- if (Ce === null) return;
870
- const Se = _(
871
- k,
876
+ if (Se === null) return;
877
+ const Ce = _(
878
+ A,
872
879
  H(c.current, le, "css"),
873
880
  Q.id,
874
881
  "css"
875
882
  );
876
- if (Se === null) return;
883
+ if (Ce === null) return;
877
884
  const Pe = _(
878
- k,
885
+ A,
879
886
  H(c.current, ue, "css"),
880
887
  Q.id,
881
888
  "css"
@@ -883,11 +890,11 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
883
890
  if (Pe === null) return;
884
891
  const ee = Ee(
885
892
  "x",
886
- { scaleId: J.id, from: Te, to: Ce },
893
+ { scaleId: J.id, from: Te, to: Se },
887
894
  c.current
888
895
  ), te = Ee(
889
896
  "y",
890
- { scaleId: Q.id, from: Se, to: Pe },
897
+ { scaleId: Q.id, from: Ce, to: Pe },
891
898
  c.current
892
899
  ), Ke = ee?.scaled, Ye = te?.scaled, Me = {
893
900
  mode: W,
@@ -907,65 +914,65 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
907
914
  } : void 0,
908
915
  scaled: Ye ?? []
909
916
  },
910
- keys: S
917
+ keys: C
911
918
  };
912
- m.current = Me, M.spanselect.dispatchEvent(
913
- l,
919
+ d.current = Me, M.spanselect.dispatchEvent(
920
+ u,
914
921
  Me
915
922
  );
916
923
  }
917
924
  );
918
925
  }, x = (v) => {
919
- y.current(v, (T, C, E) => {
920
- const S = N(
921
- T,
926
+ y.current(v, (b, S, E) => {
927
+ const C = N(
928
+ b,
922
929
  c.current
923
930
  );
924
- if (!S) return;
925
- if (Object.values(E).some((k) => k)) {
931
+ if (!C) return;
932
+ if (Object.values(E).some((A) => A)) {
926
933
  v.preventDefault();
927
- const k = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
928
- M.pressandwheel.dispatchEvent(l, {
929
- pointer: S,
934
+ const A = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
935
+ M.pressandwheel.dispatchEvent(u, {
936
+ pointer: C,
930
937
  frame: c.current,
931
938
  keys: E,
932
939
  deltaX: v.deltaX,
933
940
  deltaY: v.deltaY,
934
- deltaAbs: k
941
+ deltaAbs: A
935
942
  });
936
943
  }
937
944
  });
938
945
  };
939
- document.addEventListener("mouseup", h), document.addEventListener("keydown", g), document.addEventListener("keyup", g), document.addEventListener("mousemove", w);
940
- const b = r.current;
941
- return b?.addEventListener("wheel", x, {
946
+ document.addEventListener("mouseup", h), document.addEventListener("keydown", m), document.addEventListener("keyup", m), document.addEventListener("mousemove", w);
947
+ const T = i.current;
948
+ return T?.addEventListener("wheel", x, {
942
949
  passive: !1
943
950
  }), () => {
944
- document.removeEventListener("mouseup", h), document.removeEventListener("keydown", g), document.removeEventListener("keyup", g), document.removeEventListener("mousemove", w), b?.removeEventListener("wheel", x);
951
+ document.removeEventListener("mouseup", h), document.removeEventListener("keydown", m), document.removeEventListener("keyup", m), document.removeEventListener("mousemove", w), T?.removeEventListener("wheel", x);
945
952
  };
946
- }, [c, l, u, y]), L("sync_move", u, (h) => {
947
- const g = h.positions ? N(
953
+ }, [c, u, l, y]), L("sync_move", l, (h) => {
954
+ const m = h.positions ? N(
948
955
  h.positions,
949
956
  c.current
950
957
  ) : null;
951
- a.current = h, M.move.dispatchEvent(l, {
958
+ a.current = h, M.move.dispatchEvent(u, {
952
959
  frame: c.current,
953
- pointer: g ?? null,
960
+ pointer: m ?? null,
954
961
  keys: h.keys,
955
- source: h.originInteractionsId === l ? "own" : "sync"
962
+ source: h.originInteractionsId === u ? "own" : "sync"
956
963
  });
957
964
  }), /* @__PURE__ */ R(
958
965
  "div",
959
966
  {
960
- ref: r,
967
+ ref: i,
961
968
  id: e,
962
969
  className: t,
963
970
  style: {
964
971
  position: "absolute",
965
- left: i.chartAreaCSS.x,
966
- top: i.chartAreaCSS.y,
967
- width: i.chartAreaCSS.width,
968
- height: i.chartAreaCSS.height,
972
+ left: r.chartAreaCSS.x,
973
+ top: r.chartAreaCSS.y,
974
+ width: r.chartAreaCSS.width,
975
+ height: r.chartAreaCSS.height,
969
976
  zIndex: 25,
970
977
  ...n
971
978
  },
@@ -973,102 +980,102 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
973
980
  h.preventDefault();
974
981
  },
975
982
  onClick: (h) => {
976
- d(h, (g, w, x) => {
977
- const b = N(
978
- g,
983
+ f(h, (m, w, x) => {
984
+ const T = N(
985
+ m,
979
986
  c.current
980
987
  );
981
- b && M.click.dispatchEvent(l, {
982
- pointer: b,
988
+ T && M.click.dispatchEvent(u, {
989
+ pointer: T,
983
990
  frame: c.current,
984
991
  keys: x
985
992
  });
986
993
  });
987
994
  },
988
995
  onMouseLeave: (h) => {
989
- d(h, (g, w, x) => {
990
- M.sync_move.dispatchEvent(u, {
996
+ f(h, (m, w, x) => {
997
+ M.sync_move.dispatchEvent(l, {
991
998
  positions: null,
992
999
  keys: x,
993
- originInteractionsId: l
1000
+ originInteractionsId: u
994
1001
  });
995
1002
  });
996
1003
  },
997
1004
  onMouseMove: (h) => {
998
- d(h, (g, w, x) => {
999
- M.sync_move.dispatchEvent(u, {
1000
- positions: g,
1005
+ f(h, (m, w, x) => {
1006
+ M.sync_move.dispatchEvent(l, {
1007
+ positions: m,
1001
1008
  keys: x,
1002
- originInteractionsId: l
1009
+ originInteractionsId: u
1003
1010
  });
1004
1011
  });
1005
1012
  },
1006
1013
  onMouseDown: (h) => {
1007
- d(h, (g, { cssX: w, cssY: x }, b) => {
1014
+ f(h, (m, { cssX: w, cssY: x }, T) => {
1008
1015
  const v = N(
1009
- g,
1016
+ m,
1010
1017
  c.current
1011
1018
  );
1012
- v && (M.mousedown.dispatchEvent(l, {
1019
+ v && (M.mousedown.dispatchEvent(u, {
1013
1020
  pointer: v,
1014
1021
  frame: c.current,
1015
- keys: b
1016
- }), f.current = {
1022
+ keys: T
1023
+ }), p.current = {
1017
1024
  xRangeCss: { start: w, end: w },
1018
1025
  yRangeCss: { start: x, end: x }
1019
1026
  });
1020
1027
  });
1021
1028
  },
1022
1029
  onMouseUp: (h) => {
1023
- d(h, (g, w, x) => {
1024
- const b = N(
1025
- g,
1030
+ f(h, (m, w, x) => {
1031
+ const T = N(
1032
+ m,
1026
1033
  c.current
1027
1034
  );
1028
- if (!b) return;
1029
- M.mouseup.dispatchEvent(l, {
1035
+ if (!T) return;
1036
+ M.mouseup.dispatchEvent(u, {
1030
1037
  frame: c.current,
1031
- pointer: b,
1038
+ pointer: T,
1032
1039
  keys: x
1033
1040
  });
1034
- const v = m.current;
1035
- m.current = null;
1036
- const T = f.current;
1037
- if (f.current = null, T && v) {
1038
- const C = {
1041
+ const v = d.current;
1042
+ d.current = null;
1043
+ const b = p.current;
1044
+ if (p.current = null, b && v) {
1045
+ const S = {
1039
1046
  ...v,
1040
1047
  keys: x,
1041
1048
  completed: !0
1042
1049
  };
1043
- m.current = null, M.spanselect.dispatchEvent(
1044
- l,
1045
- C
1050
+ d.current = null, M.spanselect.dispatchEvent(
1051
+ u,
1052
+ S
1046
1053
  );
1047
1054
  }
1048
1055
  });
1049
1056
  },
1050
1057
  onContextMenu: (h) => {
1051
- h.preventDefault(), d(h, (g, w, x) => {
1052
- const b = N(
1053
- g,
1058
+ h.preventDefault(), f(h, (m, w, x) => {
1059
+ const T = N(
1060
+ m,
1054
1061
  c.current
1055
1062
  );
1056
- b && M.contextmenu.dispatchEvent(l, {
1063
+ T && M.contextmenu.dispatchEvent(u, {
1057
1064
  frame: c.current,
1058
- pointer: b,
1065
+ pointer: T,
1059
1066
  keys: x
1060
1067
  });
1061
1068
  });
1062
1069
  },
1063
1070
  onDoubleClick: (h) => {
1064
- d(h, (g, w, x) => {
1065
- const b = N(
1066
- g,
1071
+ f(h, (m, w, x) => {
1072
+ const T = N(
1073
+ m,
1067
1074
  c.current
1068
1075
  );
1069
- b && M.dblclick.dispatchEvent(l, {
1076
+ T && M.dblclick.dispatchEvent(u, {
1070
1077
  frame: c.current,
1071
- pointer: b,
1078
+ pointer: T,
1072
1079
  keys: x
1073
1080
  });
1074
1081
  });
@@ -1078,49 +1085,49 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1078
1085
  );
1079
1086
  }, Yt = ({ data: e, renderTooltip: t, xScaleId: n }) => {
1080
1087
  const [s, o] = B(null);
1081
- xe("move", (i) => {
1082
- o(i);
1088
+ xe("move", (r) => {
1089
+ o(r);
1083
1090
  });
1084
- const r = Z(() => {
1091
+ const i = Z(() => {
1085
1092
  if (!s)
1086
1093
  return null;
1087
- const { frame: i, pointer: c } = s, l = c?.scaled[n];
1088
- if (l === void 0 || !X(i, n))
1094
+ const { frame: r, pointer: c } = s, u = c?.scaled[n];
1095
+ if (u === void 0 || !X(r, n))
1089
1096
  return null;
1090
- const f = [];
1091
- let m = l;
1097
+ const p = [];
1098
+ let d = u;
1092
1099
  for (const a of e) {
1093
- let p = null, d = 1 / 0;
1094
- for (const [g, w] of a.points.entries()) {
1095
- if (!fe(i, w.x, n) || !fe(i, w.y, a.yScaleId))
1100
+ let g = null, f = 1 / 0;
1101
+ for (const [m, w] of a.points.entries()) {
1102
+ if (!fe(r, w.x, n) || !fe(r, w.y, a.yScaleId))
1096
1103
  continue;
1097
- const x = Math.abs(w.x - l);
1098
- x < d && (d = x, p = g);
1104
+ const x = Math.abs(w.x - u);
1105
+ x < f && (f = x, g = m);
1099
1106
  }
1100
- const y = a.points[p ?? -1], h = ge(i, d, n, "css");
1107
+ const y = a.points[g ?? -1], h = ge(r, f, n, "css");
1101
1108
  if (!y || h === null || h > 30) {
1102
- f.push({ seriesId: a.seriesId, y: null });
1109
+ p.push({ seriesId: a.seriesId, y: null });
1103
1110
  continue;
1104
1111
  }
1105
- m = y.x, f.push({
1112
+ d = y.x, p.push({
1106
1113
  seriesId: a.seriesId,
1107
1114
  y: y.y
1108
1115
  });
1109
1116
  }
1110
1117
  return {
1111
- frame: i,
1112
- x: m,
1113
- points: f
1118
+ frame: r,
1119
+ x: d,
1120
+ points: p
1114
1121
  };
1115
1122
  }, [e, s, n]);
1116
- return t(r);
1123
+ return t(i);
1117
1124
  }, Bt = ({ makeXStyle: e, makeXClassName: t, makeYStyle: n, makeYClassName: s }) => {
1118
- const [o, r] = B(null);
1125
+ const [o, i] = B(null);
1119
1126
  if (xe("move", (a) => {
1120
- r(a);
1127
+ i(a);
1121
1128
  }), !o)
1122
1129
  return null;
1123
- 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;
1130
+ const { frame: r, pointer: c } = o, u = c?.cssX ?? null, l = c?.cssY ?? null, p = u ? V(r, u, "css") : 0, d = l ? H(r, l, "css") : 0;
1124
1131
  return /* @__PURE__ */ pe(Ne, { children: [
1125
1132
  /* @__PURE__ */ R(
1126
1133
  "div",
@@ -1130,15 +1137,15 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1130
1137
  style: {
1131
1138
  position: "absolute",
1132
1139
  left: 0,
1133
- visibility: l === null ? "hidden" : "visible",
1134
- top: i.chartAreaCSS.y,
1135
- height: i.chartAreaCSS.height,
1140
+ visibility: u === null ? "hidden" : "visible",
1141
+ top: r.chartAreaCSS.y,
1142
+ height: r.chartAreaCSS.height,
1136
1143
  borderColor: "red",
1137
1144
  borderLeftWidth: "1px",
1138
1145
  borderLeftStyle: "solid",
1139
1146
  pointerEvents: "none",
1140
1147
  opacity: c ? 1 : 0,
1141
- transform: `translateX(${f}px)`,
1148
+ transform: `translateX(${p}px)`,
1142
1149
  ...e?.(o)
1143
1150
  }
1144
1151
  }
@@ -1150,15 +1157,15 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1150
1157
  "data-show": !!c,
1151
1158
  style: {
1152
1159
  position: "absolute",
1153
- visibility: u === null ? "hidden" : "visible",
1160
+ visibility: l === null ? "hidden" : "visible",
1154
1161
  top: 0,
1155
1162
  height: 0,
1156
1163
  borderTop: "solid 1px red",
1157
- left: i.chartAreaCSS.x,
1158
- width: i.chartAreaCSS.width,
1164
+ left: r.chartAreaCSS.x,
1165
+ width: r.chartAreaCSS.width,
1159
1166
  pointerEvents: "none",
1160
1167
  opacity: c ? 1 : 0,
1161
- transform: `translateY(${m}px)`,
1168
+ transform: `translateY(${d}px)`,
1162
1169
  ...n?.(o)
1163
1170
  }
1164
1171
  }
@@ -1166,16 +1173,16 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1166
1173
  ] });
1167
1174
  }, zt = ({ makeClassName: e, makeStyle: t }) => {
1168
1175
  const [n, s] = B(null);
1169
- xe("spanselect", (r) => {
1176
+ xe("spanselect", (i) => {
1170
1177
  s(
1171
- r.mode === "below_threshold" || r.completed ? null : r
1178
+ i.mode === "below_threshold" || i.completed ? null : i
1172
1179
  );
1173
1180
  });
1174
1181
  const o = Z(() => {
1175
1182
  if (!n || n.mode === "below_threshold")
1176
1183
  return null;
1177
- 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), d = Math.min(m, a), y = Math.abs(f - u), h = Math.abs(a - m);
1178
- return { leftPx: p, topPx: d, widthPx: y, heightPx: h };
1184
+ 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, u = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, l = V(n.frame, i, "css"), p = V(n.frame, r, "css"), d = H(n.frame, c, "css"), a = H(n.frame, u, "css"), g = Math.min(l, p), f = Math.min(d, a), y = Math.abs(p - l), h = Math.abs(a - d);
1185
+ return { leftPx: g, topPx: f, widthPx: y, heightPx: h };
1179
1186
  }, [n]);
1180
1187
  return /* @__PURE__ */ R(
1181
1188
  "div",
@@ -1216,22 +1223,22 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1216
1223
  formatter: t,
1217
1224
  acceptableIncrements: n
1218
1225
  } = {}) => (s, o) => {
1219
- const { min: r, max: i } = s, c = [], l = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ? Xe : dt)) * l, f = We(
1226
+ const { min: i, max: r } = s, c = [], u = window.devicePixelRatio || 1, l = (e ?? (s.origin === "x" ? Xe : dt)) * u, p = We(
1220
1227
  o,
1221
- u,
1228
+ l,
1222
1229
  s.id,
1223
1230
  "canvas"
1224
1231
  );
1225
- if (f === null)
1232
+ if (p === null)
1226
1233
  return [];
1227
- const m = n ?? ne, a = m.find((d) => d > f) ?? m.at(-1) ?? 1;
1228
- let p = r;
1229
- if (Math.abs(p % a) > Number.EPSILON) {
1230
- const d = (a - p % a) % a;
1231
- p += d;
1234
+ const d = n ?? ne, a = d.find((f) => f > p) ?? d.at(-1) ?? 1;
1235
+ let g = i;
1236
+ if (Math.abs(g % a) > Number.EPSILON) {
1237
+ const f = (a - g % a) % a;
1238
+ g += f;
1232
1239
  }
1233
- for (; p <= i && c.length < 1e3; )
1234
- c.push(p), p += a;
1240
+ for (; g <= r && c.length < 1e3; )
1241
+ c.push(g), g += a;
1235
1242
  return (t ?? mt)(c);
1236
1243
  }, mt = (e) => {
1237
1244
  const t = Math.max(0, Math.ceil(-Math.log10(e[1] - e[0])));
@@ -1239,7 +1246,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1239
1246
  }, ne = [];
1240
1247
  for (let e = -12; e <= 12; e++)
1241
1248
  ne.push(1 * 10 ** e), ne.push(2 * 10 ** e), ne.push(5 * 10 ** e);
1242
- const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 * ce, gt = 365 * ce, vt = [
1249
+ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, re = 60 * be, ce = 24 * re, yt = 30 * ce, gt = 365 * ce, vt = [
1243
1250
  // second divisors
1244
1251
  [1, "milliseconds"],
1245
1252
  [2, "milliseconds"],
@@ -1301,7 +1308,7 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
1301
1308
  case "minutes":
1302
1309
  return t * be;
1303
1310
  case "hours":
1304
- return t * ie;
1311
+ return t * re;
1305
1312
  case "days":
1306
1313
  return t * ce;
1307
1314
  case "months":
@@ -1321,10 +1328,10 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
1321
1328
  }, Tt = (e, t) => {
1322
1329
  const n = new Date(e);
1323
1330
  return n.setUTCHours(n.getUTCHours() + t), n.getTime();
1324
- }, Ct = (e, t) => {
1331
+ }, St = (e, t) => {
1325
1332
  const n = new Date(e);
1326
1333
  return n.setUTCDate(n.getUTCDate() + t), n.getTime();
1327
- }, ke = (e, t) => {
1334
+ }, Ae = (e, t) => {
1328
1335
  const n = new Date(e);
1329
1336
  return n.setUTCMonth(n.getUTCMonth() + t), n.getTime();
1330
1337
  }, Y = (e, t) => {
@@ -1339,45 +1346,45 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
1339
1346
  case "hours":
1340
1347
  return Tt(e, n);
1341
1348
  case "days":
1342
- return Ct(e, n);
1349
+ return St(e, n);
1343
1350
  case "months":
1344
- return ke(e, n);
1351
+ return Ae(e, n);
1345
1352
  case "years":
1346
- return ke(e, n * 12);
1353
+ return Ae(e, n * 12);
1347
1354
  }
1348
1355
  };
1349
1356
  function oe(e, t) {
1350
1357
  const n = new Date(e), s = new Date(n.toLocaleString("en-US", { timeZone: t })), o = new Date(n.toLocaleString("en-US", { timeZone: "UTC" }));
1351
1358
  return (s.getTime() - o.getTime()) / (3600 * 1e3);
1352
1359
  }
1353
- const St = (e, t, n = "UTC") => {
1360
+ const Ct = (e, t, n = "UTC") => {
1354
1361
  const [s, o] = t;
1355
- let r = new Date(e);
1356
- const i = () => {
1357
- r.setUTCHours(-oe(r, n), 0, 0, 0);
1362
+ let i = new Date(e);
1363
+ const r = () => {
1364
+ i.setUTCHours(-oe(i, n), 0, 0, 0);
1358
1365
  };
1359
1366
  switch (o) {
1360
1367
  case "milliseconds":
1361
- r.setUTCMilliseconds(
1362
- Math.ceil(r.getUTCMilliseconds() / s) * s
1368
+ i.setUTCMilliseconds(
1369
+ Math.ceil(i.getUTCMilliseconds() / s) * s
1363
1370
  );
1364
1371
  break;
1365
1372
  case "seconds":
1366
- r.setUTCSeconds(
1367
- Math.ceil(r.getUTCSeconds() / s) * s,
1373
+ i.setUTCSeconds(
1374
+ Math.ceil(i.getUTCSeconds() / s) * s,
1368
1375
  0
1369
1376
  );
1370
1377
  break;
1371
1378
  case "minutes":
1372
- r.setUTCMinutes(
1373
- Math.ceil(r.getTime() % ie / be / s) * s,
1379
+ i.setUTCMinutes(
1380
+ Math.ceil(i.getTime() % re / be / s) * s,
1374
1381
  0,
1375
1382
  0
1376
1383
  );
1377
1384
  break;
1378
1385
  case "hours":
1379
- r.setUTCHours(
1380
- Math.ceil(r.getTime() % ce / ie / s) * s,
1386
+ i.setUTCHours(
1387
+ Math.ceil(i.getTime() % ce / re / s) * s,
1381
1388
  0,
1382
1389
  0,
1383
1390
  0
@@ -1386,42 +1393,42 @@ const St = (e, t, n = "UTC") => {
1386
1393
  case "days":
1387
1394
  case "months":
1388
1395
  case "years":
1389
- o === "months" ? r.setUTCDate(1) : o === "years" && r.setUTCMonth(0, 1), i(), r.getTime() < e && (r = new Date(Y(r, [1, o])));
1396
+ o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1), r(), i.getTime() < e && (i = new Date(Y(i, [1, o])));
1390
1397
  break;
1391
1398
  }
1392
- return r.getTime();
1399
+ return i.getTime();
1393
1400
  }, jt = ({
1394
1401
  timeZone: e = Fe,
1395
1402
  space: t = Xe,
1396
1403
  formatter: n,
1397
1404
  locale: s,
1398
1405
  showTimezone: o
1399
- } = {}) => (r, i) => {
1400
- const { min: c, max: l } = r;
1401
- if (!Number.isFinite(c) || !Number.isFinite(l))
1406
+ } = {}) => (i, r) => {
1407
+ const { min: c, max: u } = i;
1408
+ if (!Number.isFinite(c) || !Number.isFinite(u))
1402
1409
  return [];
1403
- const u = Math.floor(i.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = vt.find(
1404
- (w) => se(w) >= m
1410
+ const l = Math.floor(r.chartAreaCanvasPX.width / t) + 1, d = (u - c) / l, [a, g] = vt.find(
1411
+ (w) => se(w) >= d
1405
1412
  ) ?? [1, "milliseconds"];
1406
- if (!a || !p)
1413
+ if (!a || !g)
1407
1414
  return [];
1408
- const d = St(c, [a, p], e), y = oe(d, e), h = [d];
1409
- let g;
1415
+ const f = Ct(c, [a, g], e), y = oe(f, e), h = [f];
1416
+ let m;
1410
1417
  for (; !(h.length > 1e3); ) {
1411
- switch (p) {
1418
+ switch (g) {
1412
1419
  case "milliseconds":
1413
1420
  case "seconds":
1414
1421
  case "minutes":
1415
1422
  case "hours": {
1416
- g = Y(d, [h.length * a, p]);
1423
+ m = Y(f, [h.length * a, g]);
1417
1424
  break;
1418
1425
  }
1419
1426
  case "days": {
1420
- const w = Y(d, [
1427
+ const w = Y(f, [
1421
1428
  h.length * a,
1422
- p
1429
+ g
1423
1430
  ]);
1424
- g = Y(w, [
1431
+ m = Y(w, [
1425
1432
  y - oe(w, e),
1426
1433
  "hours"
1427
1434
  ]);
@@ -1430,22 +1437,22 @@ const St = (e, t, n = "UTC") => {
1430
1437
  case "months":
1431
1438
  case "years": {
1432
1439
  const w = Y(
1433
- Y(Y(d, [y, "hours"]), [
1440
+ Y(Y(f, [y, "hours"]), [
1434
1441
  h.length * a,
1435
- p
1442
+ g
1436
1443
  ]),
1437
1444
  [-y, "hours"]
1438
1445
  );
1439
- g = Y(w, [
1446
+ m = Y(w, [
1440
1447
  y - oe(w, e),
1441
1448
  "hours"
1442
1449
  ]);
1443
1450
  break;
1444
1451
  }
1445
1452
  }
1446
- if (g > l)
1453
+ if (m > u)
1447
1454
  break;
1448
- h.push(g);
1455
+ h.push(m);
1449
1456
  }
1450
1457
  return (n ?? Pt({
1451
1458
  locale: s,
@@ -1470,30 +1477,30 @@ const St = (e, t, n = "UTC") => {
1470
1477
  timeZone: e
1471
1478
  });
1472
1479
  return (o) => {
1473
- const r = o[1] - o[0], i = r < se([1, "days"]), c = r < se([1, "minutes"]), l = r < se([1, "seconds"]);
1474
- return o.map((u) => ({ value: u, label: s.formatToParts(new Date(u)) })).map((u, f, m) => {
1475
- const a = m[f - 1], p = f === 0 || K(u.label, a.label, "year"), d = f === 0 || K(u.label, a.label, "day"), y = f === 0 || K(u.label, a.label, "month"), h = 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 = [];
1476
- if (i && (h || w || g || x || b)) {
1477
- 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;
1478
- let S = "";
1480
+ const i = o[1] - o[0], r = i < se([1, "days"]), c = i < se([1, "minutes"]), u = i < se([1, "seconds"]);
1481
+ return o.map((l) => ({ value: l, label: s.formatToParts(new Date(l)) })).map((l, p, d) => {
1482
+ const a = d[p - 1], g = p === 0 || K(l.label, a.label, "year"), f = p === 0 || K(l.label, a.label, "day"), y = p === 0 || K(l.label, a.label, "month"), h = p === 0 || K(l.label, a.label, "hour"), m = p === 0 || K(l.label, a.label, "timeZoneName"), w = p === 0 || K(l.label, a.label, "minute"), x = p === 0 || K(l.label, a.label, "second"), T = p === 0 || K(l.label, a.label, "fractionalSecond"), v = [];
1483
+ if (r && (h || w || m || x || T)) {
1484
+ const b = l.label.find((P) => P.type === "hour")?.value, S = l.label.find((P) => P.type === "minute")?.value, E = l.label.find((P) => P.type === "timeZoneName")?.value;
1485
+ let C = "";
1479
1486
  if (c) {
1480
- const P = u.label.find((z) => z.type === "second")?.value, k = u.label.find(
1487
+ const P = l.label.find((z) => z.type === "second")?.value, A = l.label.find(
1481
1488
  (z) => z.type === "fractionalSecond"
1482
1489
  )?.value;
1483
- S = `:${P}` + (l ? `.${k}` : "");
1490
+ C = `:${P}` + (u ? `.${A}` : "");
1484
1491
  }
1485
1492
  v.push(
1486
- `${T}:${C}${S}` + (n && g ? ` ${E}` : "")
1493
+ `${b}:${S}${C}` + (n && m ? ` ${E}` : "")
1487
1494
  );
1488
1495
  }
1489
- return (d || y) && v.push(
1496
+ return (f || y) && v.push(
1490
1497
  [
1491
- u.label.find((T) => T.type === "month")?.value,
1492
- d && u.label.find((T) => T.type === "day")?.value
1498
+ l.label.find((b) => b.type === "month")?.value,
1499
+ f && l.label.find((b) => b.type === "day")?.value
1493
1500
  ].filter(Boolean).join(" ")
1494
- ), p && v.push(u.label.find((T) => T.type === "year")?.value), {
1495
- value: u.value,
1496
- label: v.filter((T) => T).join(`
1501
+ ), g && v.push(l.label.find((b) => b.type === "year")?.value), {
1502
+ value: l.value,
1503
+ label: v.filter((b) => b).join(`
1497
1504
  `)
1498
1505
  };
1499
1506
  });
@@ -1516,7 +1523,7 @@ export {
1516
1523
  Ft as XTicks,
1517
1524
  Ot as YTicks,
1518
1525
  U as applyStyles,
1519
- re as clamp,
1526
+ ie as clamp,
1520
1527
  V as clampXPosToChartArea,
1521
1528
  H as clampYPosToChartArea,
1522
1529
  F as deepEqual,
@@ -1528,7 +1535,7 @@ export {
1528
1535
  jt as makeTimeTicks,
1529
1536
  _ as posToVal,
1530
1537
  We as pxToValDistance,
1531
- At as sum,
1538
+ kt as sum,
1532
1539
  j as useDrawEffect,
1533
1540
  Ue as useFrameState,
1534
1541
  xe as useInteractionsEvent,