@canplot/react 0.1.18 → 0.1.20

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,56 +1,56 @@
1
- import { jsxs as dt, jsx as A, Fragment as Dt } from "react/jsx-runtime";
2
- import Q, { createContext as Ct, useContext as tt, useRef as I, useLayoutEffect as N, useEffect as Tt, version as _t, forwardRef as Lt, useMemo as et, useState as V, useId as Xt } from "react";
3
- import { createStore as Pt, useStore as Et } from "zustand";
1
+ import { jsxs as ht, jsx as A, Fragment as It } from "react/jsx-runtime";
2
+ import Q, { createContext as Ct, useContext as tt, useRef as D, useLayoutEffect as z, useEffect as Mt, version as Ut, forwardRef as Xt, useMemo as et, useState as V, useId as Kt } from "react";
3
+ import { createStore as Et, useStore as Pt } from "zustand";
4
4
  const j = (t, n, e) => Math.min(Math.max(t, n), e), fe = (t) => t.reduce((n, e) => n + (e ?? 0), 0), me = (t, n) => {
5
5
  let e = 0;
6
6
  for (let s = 0; s < t.length; s++)
7
7
  Math.abs(t[s] - n) < Math.abs(t[e] - n) && (e = s);
8
8
  return e;
9
- }, Kt = (t, n, e, s) => {
10
- const { min: o, max: i, origin: r } = _(t, e), u = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = (r === "x" ? u.width : u.height) / (i - o);
11
- return n / d;
12
- }, _ = (t, n) => {
9
+ }, Ot = (t, n, e, s) => {
10
+ const { min: o, max: i, origin: r } = I(t, e), d = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, l = (r === "x" ? d.width : d.height) / (i - o);
11
+ return n / l;
12
+ }, I = (t, n) => {
13
13
  const e = t.scales.find((s) => s.id === n);
14
14
  if (!e)
15
15
  throw new Error(`Scale ${n} not found`);
16
16
  return e;
17
- }, U = (t, n) => {
17
+ }, _ = (t, n) => {
18
18
  const e = window.devicePixelRatio || 1;
19
19
  t.lineCap = n?.lineCap ?? "butt", t.lineDashOffset = e * (n?.lineDashOffset ?? 0), t.lineJoin = n?.lineJoin ?? "miter", t.lineWidth = e * (n?.lineWidth ?? 1), t.miterLimit = e * (n?.miterLimit ?? 10), t.strokeStyle = n?.strokeStyle ?? "black", t.fillStyle = n?.fillStyle ?? t.strokeStyle, t.font = n?.font ?? `${10 * e}px sans-serif`, t.textAlign = n?.textAlign ?? "start", t.direction = n?.direction ?? "inherit", t.textBaseline = n?.textBaseline ?? "alphabetic", t.fontKerning = n?.fontKerning ?? "auto";
20
- }, ht = (t, n, e, s) => {
21
- const o = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: i, max: r, origin: u } = _(t, e), d = (u === "x" ? o.width : o.height) / (r - i);
22
- return n * d;
20
+ }, ft = (t, n, e, s) => {
21
+ const o = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, { min: i, max: r, origin: d } = I(t, e), l = (d === "x" ? o.width : o.height) / (r - i);
22
+ return n * l;
23
23
  }, H = (t, n, e, s) => {
24
- const { min: o, origin: i } = _(t, e), r = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, u = ht(t, n - o, e, s);
24
+ const { min: o, origin: i } = I(t, e), r = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = ft(t, n - o, e, s);
25
25
  return i === "x" ? j(
26
- r.x + u,
26
+ r.x + d,
27
27
  r.x - 10 * r.width,
28
28
  r.x + 11 * r.width
29
29
  ) : j(
30
- r.y + r.height - u,
30
+ r.y + r.height - d,
31
31
  r.y - 10 * r.height,
32
32
  r.y + 11 * r.height
33
33
  );
34
34
  }, pe = (t, n, e) => {
35
- const { min: s, max: o } = _(t, e);
35
+ const { min: s, max: o } = I(t, e);
36
36
  return j(n, s, o);
37
37
  }, Y = (t, n, e) => {
38
38
  const s = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
39
39
  return j(n, s.x, s.x + s.width);
40
- }, O = (t, n, e) => {
40
+ }, B = (t, n, e) => {
41
41
  const s = e === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS;
42
42
  return j(n, s.y, s.y + s.height);
43
43
  }, lt = (t, n, e) => {
44
- const { min: s, max: o } = _(t, e);
44
+ const { min: s, max: o } = I(t, e);
45
45
  return n >= s && n <= o;
46
- }, D = (t, n, e, s) => {
47
- const { min: o, max: i, origin: r } = _(t, e), u = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, d = r === "x" ? (n - u.x) / u.width : (u.height - n + u.y) / u.height;
48
- return o + d * (i - o);
46
+ }, L = (t, n, e, s) => {
47
+ const { min: o, max: i, origin: r } = I(t, e), d = s === "canvas" ? t.chartAreaCanvasPX : t.chartAreaCSS, l = r === "x" ? (n - d.x) / d.width : (d.height - n + d.y) / d.height;
48
+ return o + l * (i - o);
49
49
  }, Ft = (t) => {
50
50
  const { ctx: n, scales: e } = t;
51
51
  for (const s of e) {
52
52
  if (!s.axis) continue;
53
- n.save(), U(n, {
53
+ n.save(), _(n, {
54
54
  strokeStyle: "black",
55
55
  fillStyle: "black",
56
56
  lineWidth: 1,
@@ -70,7 +70,12 @@ const j = (t, n, e) => Math.min(Math.max(t, n), e), fe = (t) => t.reduce((n, e)
70
70
  } else s.axis.position === "right" && (n.beginPath(), n.moveTo(o.x, o.y), n.lineTo(o.x, o.y + o.height), n.stroke());
71
71
  n.restore();
72
72
  }
73
- }, zt = () => Pt((t, n) => {
73
+ }, ut = {
74
+ TOP: 300,
75
+ MIDDLE: 200,
76
+ BOTTOM: 200,
77
+ BACKGROUND: 100
78
+ }, zt = () => Et((t, n) => {
74
79
  const e = () => {
75
80
  const s = n()._frame;
76
81
  if (!s) throw new Error("No frame set in frame store");
@@ -81,84 +86,105 @@ const j = (t, n, e) => Math.min(Math.max(t, n), e), fe = (t) => t.reduce((n, e)
81
86
  getFrame: e,
82
87
  getCtx: () => e().ctx,
83
88
  clampXPosToChartArea: (s, o) => Y(e(), s, o ?? "canvas"),
84
- clampYPosToChartArea: (s, o) => O(e(), s, o ?? "canvas"),
89
+ clampYPosToChartArea: (s, o) => B(e(), s, o ?? "canvas"),
85
90
  valToPos: (s, o, i) => H(e(), s, o, i ?? "canvas"),
86
- valToPxDistance: (s, o, i) => ht(
91
+ valToPxDistance: (s, o, i) => ft(
87
92
  e(),
88
93
  s,
89
94
  o,
90
95
  i ?? "canvas"
91
96
  ),
92
97
  valFits: (s, o) => lt(e(), s, o),
93
- getScale: (s) => _(e(), s)
98
+ getScale: (s) => I(e(), s),
99
+ _listeners: [],
100
+ _subscribe: (s, o) => (n()._listeners.push([o, s]), n()._listeners.sort((i, r) => i[0] - r[0]), () => {
101
+ const i = n()._listeners.findIndex(([, r]) => r === s);
102
+ i !== -1 && n()._listeners.splice(i, 1);
103
+ }),
104
+ _notifyListeners: (s) => {
105
+ for (const [, o] of n()._listeners)
106
+ o(s);
107
+ }
94
108
  };
95
- }), Yt = () => Pt((t) => ({
109
+ }), Yt = () => Et((t) => ({
96
110
  notify: () => {
97
111
  t((n) => ({ version: n.version + 1 }));
98
112
  },
99
113
  version: 0
100
- })), ft = Ct(null), Mt = Ct(null), z = (t, n) => {
101
- const e = tt(ft), s = tt(Mt);
102
- if (!e || !s)
114
+ })), mt = Ct(null), kt = Ct(null), F = (t, n, e) => {
115
+ const s = tt(mt), o = tt(kt);
116
+ if (!s || !o)
103
117
  throw new Error("useFrame must be used within a CanPlot component");
104
- const o = I(t);
105
- o.current = t, N(() => (o.current(e.getState()), e.subscribe((i) => {
106
- i._frame && o.current(i);
107
- })), [e]), Tt(() => {
108
- s.getState().notify();
109
- }, [s, ...n]);
110
- }, mt = (t) => {
111
- const n = tt(ft);
118
+ const i = D(n);
119
+ i.current = n, z(() => (Promise.resolve().then(() => {
120
+ i.current(s.getState());
121
+ }), s.getState()._subscribe(
122
+ (r) => {
123
+ r._frame && i.current(r);
124
+ },
125
+ typeof t == "number" ? t : ut[t]
126
+ )), [s, t]), Mt(() => {
127
+ o.getState().notify();
128
+ }, [o, ...e]);
129
+ }, pt = (t) => {
130
+ const n = tt(mt);
112
131
  if (!n)
113
132
  throw new Error("useFrame must be used within a CanPlot component");
114
- return Et(
133
+ return Pt(
115
134
  n,
116
135
  t ?? ((e) => e.getFrame())
117
136
  );
118
137
  };
119
- function Ot(t) {
138
+ function Bt(t) {
120
139
  return (n) => {
121
- for (const e of t) ut(e, n);
140
+ for (const e of t) dt(e, n);
122
141
  };
123
142
  }
124
- function Bt(t) {
143
+ function Nt(t) {
125
144
  return (n) => {
126
145
  const e = [];
127
146
  for (const s of t) {
128
- const o = ut(s, n), i = typeof o == "function";
129
- e.push(i ? o : () => ut(s, null));
147
+ const o = dt(s, n), i = typeof o == "function";
148
+ e.push(i ? o : () => dt(s, null));
130
149
  }
131
150
  return () => {
132
151
  for (const s of e) s();
133
152
  };
134
153
  };
135
154
  }
136
- function ut(t, n) {
155
+ function dt(t, n) {
137
156
  if (typeof t == "function")
138
157
  return t(n);
139
158
  t && (t.current = n);
140
159
  }
141
- var $t = parseInt(_t.split(".")[0], 10) >= 19 ? Bt : Ot;
142
- const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) => {
143
- const i = I(null), r = I(null), u = Vt(r), d = et(zt, []), c = et(Yt, []);
144
- N(() => {
145
- d.setState({
146
- _frame: jt(t, u, i.current)
160
+ var $t = parseInt(Ut.split(".")[0], 10) >= 19 ? Nt : Bt;
161
+ const xe = Xt(({ configuration: t, children: n, style: e, className: s }, o) => {
162
+ const i = D(null), r = D(null), d = jt(r), l = et(zt, []), c = et(Yt, []);
163
+ z(() => {
164
+ l.setState({
165
+ _frame: Ht(t, d, i.current)
147
166
  });
148
- }, [t, u, i, d]), N(() => d.subscribe((m) => {
149
- m._frame && Ht(m._frame);
150
- }), [d]), N(() => {
167
+ const m = l.getState();
168
+ m._notifyListeners(m);
169
+ }, [t, d, i, l]), z(() => l.getState()._subscribe((m) => {
170
+ const h = m._frame?.ctx;
171
+ h && h.clearRect(0, 0, h.canvas.width, h.canvas.height);
172
+ }, ut.BACKGROUND), [l]), z(() => l.getState()._subscribe((m) => {
173
+ m._frame && Ft(m._frame);
174
+ }, ut.BOTTOM), [l]), z(() => {
151
175
  let m = !1;
152
176
  return c.subscribe(() => {
153
177
  m || (m = !0, window.requestAnimationFrame(() => {
154
- m = !1, d.setState((f) => ({
178
+ m = !1, l.setState((f) => ({
155
179
  _frame: f._frame ? { ...f._frame } : null
156
180
  }));
181
+ const h = l.getState();
182
+ h._notifyListeners(h);
157
183
  }));
158
184
  });
159
- }, [c, d]);
185
+ }, [c, l]);
160
186
  const a = window.devicePixelRatio || 1;
161
- return /* @__PURE__ */ dt(
187
+ return /* @__PURE__ */ ht(
162
188
  "div",
163
189
  {
164
190
  ref: $t([o, r]),
@@ -174,20 +200,20 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
174
200
  "canvas",
175
201
  {
176
202
  ref: i,
177
- width: u.width * a,
178
- height: u.height * a,
203
+ width: d.width * a,
204
+ height: d.height * a,
179
205
  style: {
180
206
  inset: 0,
181
207
  position: "absolute",
182
- width: `${u.width}px`,
183
- height: `${u.height}px`
208
+ width: `${d.width}px`,
209
+ height: `${d.height}px`
184
210
  }
185
211
  }
186
212
  ),
187
213
  /* @__PURE__ */ A(
188
- Nt,
214
+ Vt,
189
215
  {
190
- frameStore: d,
216
+ frameStore: l,
191
217
  updateRequestStore: c,
192
218
  children: n
193
219
  }
@@ -195,26 +221,26 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
195
221
  ]
196
222
  }
197
223
  );
198
- }), Nt = ({ frameStore: t, updateRequestStore: n, children: e }) => Et(t, (o) => !!o._frame) ? /* @__PURE__ */ A(Mt.Provider, { value: n, children: /* @__PURE__ */ A(ft.Provider, { value: t, children: e }) }) : null, Vt = (t) => {
224
+ }), Vt = ({ frameStore: t, updateRequestStore: n, children: e }) => Pt(t, (o) => !!o._frame) ? /* @__PURE__ */ A(kt.Provider, { value: n, children: /* @__PURE__ */ A(mt.Provider, { value: t, children: e }) }) : null, jt = (t) => {
199
225
  const [n, e] = V({
200
226
  width: 0,
201
227
  height: 0
202
228
  }), [s] = V(() => new ResizeObserver((o) => {
203
229
  for (const i of o) {
204
- const r = Math.round(i.contentRect.width), u = Math.round(i.contentRect.height);
230
+ const r = Math.round(i.contentRect.width), d = Math.round(i.contentRect.height);
205
231
  e(
206
- (d) => d.width !== r || d.height !== u ? { ...d, width: r, height: u } : d
232
+ (l) => l.width !== r || l.height !== d ? { ...l, width: r, height: d } : l
207
233
  );
208
234
  }
209
235
  }));
210
- return N(() => {
236
+ return z(() => {
211
237
  if (!t.current) return;
212
238
  const o = t.current.clientWidth, i = t.current.clientHeight;
213
239
  return e(
214
240
  (r) => r.width !== o || r.height !== i ? { ...r, width: o, height: i } : r
215
241
  ), s.observe(t.current, { box: "border-box" }), () => s.disconnect();
216
242
  }, [s, t]), n;
217
- }, jt = (t, n, e) => {
243
+ }, Ht = (t, n, e) => {
218
244
  const s = e?.getContext("2d");
219
245
  if (!s) return null;
220
246
  const o = window.devicePixelRatio || 1;
@@ -226,40 +252,40 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
226
252
  width: n.width - t.padding.left - t.padding.right,
227
253
  height: n.height - t.padding.top - t.padding.bottom
228
254
  };
229
- for (const h of t.scales)
230
- h.axis && (h.origin === "x" ? (h.axis.position === "bottom" || h.axis.position === "top") && (i.height = Math.max(
255
+ for (const f of t.scales)
256
+ f.axis && (f.origin === "x" ? (f.axis.position === "bottom" || f.axis.position === "top") && (i.height = Math.max(
231
257
  0,
232
- i.height - h.axis.size
233
- ), h.axis.position === "top" && (i.y += h.axis.size)) : (h.axis.position === "left" || h.axis.position === "right") && (i.width = Math.max(0, i.width - h.axis.size), h.axis.position === "left" && (i.x += h.axis.size)));
258
+ i.height - f.axis.size
259
+ ), f.axis.position === "top" && (i.y += f.axis.size)) : (f.axis.position === "left" || f.axis.position === "right") && (i.width = Math.max(0, i.width - f.axis.size), f.axis.position === "left" && (i.x += f.axis.size)));
234
260
  const r = {
235
261
  x: i.x * o,
236
262
  y: i.y * o,
237
263
  width: i.width * o,
238
264
  height: i.height * o
239
- }, u = [];
240
- let d = t.padding.left * o, c = s.canvas.width - t.padding.right * o, a = s.canvas.height - t.padding.bottom * o, m = t.padding.top * o;
241
- for (const h of t.scales) {
242
- if (!h.axis) {
243
- u.push({ ...h, axis: null });
265
+ }, d = [];
266
+ let l = t.padding.left * o, c = s.canvas.width - t.padding.right * o, a = s.canvas.height - t.padding.bottom * o, m = t.padding.top * o;
267
+ for (const f of t.scales) {
268
+ if (!f.axis) {
269
+ d.push({ ...f, axis: null });
244
270
  continue;
245
271
  }
246
- let l;
247
- if (h.origin === "x")
248
- switch (h.axis.position) {
272
+ let u;
273
+ if (f.origin === "x")
274
+ switch (f.axis.position) {
249
275
  case "bottom":
250
- a -= h.axis.size * o, l = {
276
+ a -= f.axis.size * o, u = {
251
277
  x: i.x,
252
278
  y: a / o,
253
279
  width: i.width,
254
- height: h.axis.size
280
+ height: f.axis.size
255
281
  };
256
282
  break;
257
283
  case "top":
258
- m += h.axis.size * o, l = {
284
+ m += f.axis.size * o, u = {
259
285
  x: i.x,
260
- y: m / o - h.axis.size,
286
+ y: m / o - f.axis.size,
261
287
  width: i.width,
262
- height: h.axis.size
288
+ height: f.axis.size
263
289
  };
264
290
  break;
265
291
  case "left":
@@ -267,20 +293,20 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
267
293
  throw new Error("Invalid axis position for x origin");
268
294
  }
269
295
  else
270
- switch (h.axis.position) {
296
+ switch (f.axis.position) {
271
297
  case "left":
272
- d += h.axis.size * o, l = {
273
- x: d / o - h.axis.size,
298
+ l += f.axis.size * o, u = {
299
+ x: l / o - f.axis.size,
274
300
  y: i.y,
275
- width: h.axis.size,
301
+ width: f.axis.size,
276
302
  height: i.height
277
303
  };
278
304
  break;
279
305
  case "right":
280
- c -= h.axis.size * o, l = {
306
+ c -= f.axis.size * o, u = {
281
307
  x: c / o,
282
308
  y: i.y,
283
- width: h.axis.size,
309
+ width: f.axis.size,
284
310
  height: i.height
285
311
  };
286
312
  break;
@@ -289,16 +315,16 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
289
315
  throw new Error("Invalid axis position for y origin");
290
316
  }
291
317
  const p = {
292
- x: l.x * o,
293
- y: l.y * o,
294
- width: l.width * o,
295
- height: l.height * o
318
+ x: u.x * o,
319
+ y: u.y * o,
320
+ width: u.width * o,
321
+ height: u.height * o
296
322
  };
297
- u.push({
298
- ...h,
323
+ d.push({
324
+ ...f,
299
325
  axis: {
300
- ...h.axis,
301
- cssRect: l,
326
+ ...f.axis,
327
+ cssRect: u,
302
328
  canvasRect: p
303
329
  }
304
330
  });
@@ -307,34 +333,37 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
307
333
  ctx: s,
308
334
  dpr: o,
309
335
  padding: t.padding,
310
- scales: u,
336
+ scales: d,
311
337
  chartAreaCSS: i,
312
338
  chartAreaCanvasPX: r
313
339
  };
314
- }, Ht = (t) => {
315
- t.ctx.clearRect(0, 0, t.ctx.canvas.width, t.ctx.canvas.height), Ft(t);
316
- }, ye = ({ data: t, xScaleId: n, yScaleId: e, style: s }) => (z(
317
- ({ getCtx: o, clampXPosToChartArea: i, clampYPosToChartArea: r, valToPos: u }) => {
318
- const d = o();
319
- d.save(), d.beginPath(), U(d, s);
340
+ }, ye = ({ data: t, xScaleId: n, yScaleId: e, style: s }) => (F(
341
+ "MIDDLE",
342
+ ({ getCtx: o, clampXPosToChartArea: i, clampYPosToChartArea: r, valToPos: d }) => {
343
+ const l = o();
344
+ l.save(), l.beginPath(), _(l, s);
320
345
  for (const c of t) {
321
- const a = i(u(c.x, n)), m = r(u(c.y, e));
322
- d.lineTo(a, m);
346
+ const a = i(d(c.x, n)), m = r(d(c.y, e));
347
+ l.lineTo(a, m);
323
348
  }
324
- d.stroke(), d.restore();
349
+ l.stroke(), l.restore();
325
350
  },
326
351
  [t, n, e, s]
327
- ), null), ve = ({ data: t, xScaleId: n, yScaleId: e, radius: s = 5, style: o }) => (z(({ getCtx: i, valToPos: r, valFits: u }) => {
328
- const d = i();
329
- d.save(), d.beginPath(), U(d, o);
330
- for (const c of t) {
331
- if (!u(c.x, n) || !u(c.y, e))
332
- continue;
333
- const a = r(c.x, n), m = r(c.y, e);
334
- d.moveTo(a + s, m), d.arc(a, m, s, 0, Math.PI * 2);
335
- }
336
- d.stroke(), d.fill(), d.restore();
337
- }, [t, n, e, s, o]), null), ge = ({
352
+ ), null), ve = ({ data: t, xScaleId: n, yScaleId: e, radius: s = 5, style: o }) => (F(
353
+ "MIDDLE",
354
+ ({ getCtx: i, valToPos: r, valFits: d }) => {
355
+ const l = i();
356
+ l.save(), l.beginPath(), _(l, o);
357
+ for (const c of t) {
358
+ if (!d(c.x, n) || !d(c.y, e))
359
+ continue;
360
+ const a = r(c.x, n), m = r(c.y, e);
361
+ l.moveTo(a + s, m), l.arc(a, m, s, 0, Math.PI * 2);
362
+ }
363
+ l.stroke(), l.fill(), l.restore();
364
+ },
365
+ [t, n, e, s, o]
366
+ ), null), ge = ({
338
367
  data: t,
339
368
  xScaleId: n,
340
369
  yScaleId: e,
@@ -342,69 +371,75 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
342
371
  barWidth: o,
343
372
  xPositionOffset: i,
344
373
  radius: r
345
- }) => (z(
374
+ }) => (F(
375
+ "MIDDLE",
346
376
  ({
347
- getCtx: u,
348
- valToPxDistance: d,
377
+ getCtx: d,
378
+ valToPxDistance: l,
349
379
  valToPos: c,
350
380
  clampXPosToChartArea: a,
351
381
  clampYPosToChartArea: m
352
382
  }) => {
353
383
  if (t.length === 0) return;
354
- const f = u();
355
- f.save(), U(f, s);
356
- const h = d(o, n);
357
- f.beginPath();
358
- for (const l of t) {
359
- const x = c(l.x, n) - h / 2 + i * h, v = m(c(0, e)), g = m(c(l.y, e)), y = v - g, w = a(x), S = a(x + h) - w;
360
- r ? f.roundRect(
361
- w,
384
+ const h = d();
385
+ h.save(), _(h, s);
386
+ const f = l(o, n);
387
+ h.beginPath();
388
+ for (const u of t) {
389
+ const x = c(u.x, n) - f / 2 + i * f, v = m(c(0, e)), g = m(c(u.y, e)), y = v - g, b = a(x), S = a(x + f) - b;
390
+ r ? h.roundRect(
391
+ b,
362
392
  g,
363
393
  S,
364
394
  y,
365
395
  r
366
- ) : f.rect(w, g, S, y);
396
+ ) : h.rect(b, g, S, y);
367
397
  }
368
- f.closePath(), f.fill(), s?.strokeStyle && f.stroke(), f.restore();
398
+ h.closePath(), h.fill(), s?.strokeStyle && h.stroke(), h.restore();
369
399
  },
370
400
  [t, n, e, s, o, i, r]
371
- ), null), we = ({ data: t, xScaleId: n, yScaleId: e, style: s }) => (z(({ getCtx: o, clampXPosToChartArea: i, clampYPosToChartArea: r, valToPos: u }) => {
372
- const d = [];
373
- for (const a of t) {
374
- const m = i(u(a.x, n)), f = r(u(a.y[0], e)), h = r(u(a.y[1], e));
375
- d.push({ x: m, y: f }), d.unshift({ x: m, y: h });
376
- }
377
- const c = o();
378
- if (d.length > 0) {
379
- c.save(), c.beginPath(), U(c, s), c.moveTo(d[0].x, d[0].y);
380
- for (const a of d)
381
- c.lineTo(a.x, a.y);
382
- c.closePath(), c.fill(), c.restore();
383
- }
384
- }, [t, n, e, s]), null), be = ({ data: t, stroked: n, xScaleId: e, yScaleId: s, style: o }) => (z(
385
- ({ getCtx: i, clampXPosToChartArea: r, clampYPosToChartArea: u, valToPos: d }) => {
401
+ ), null), be = ({ data: t, xScaleId: n, yScaleId: e, style: s }) => (F(
402
+ "MIDDLE",
403
+ ({ getCtx: o, clampXPosToChartArea: i, clampYPosToChartArea: r, valToPos: d }) => {
404
+ const l = [];
405
+ for (const a of t) {
406
+ const m = i(d(a.x, n)), h = r(d(a.y[0], e)), f = r(d(a.y[1], e));
407
+ l.push({ x: m, y: h }), l.unshift({ x: m, y: f });
408
+ }
409
+ const c = o();
410
+ if (l.length > 0) {
411
+ c.save(), c.beginPath(), _(c, s), c.moveTo(l[0].x, l[0].y);
412
+ for (const a of l)
413
+ c.lineTo(a.x, a.y);
414
+ c.closePath(), c.fill(), c.restore();
415
+ }
416
+ },
417
+ [t, n, e, s]
418
+ ), null), we = ({ data: t, stroked: n, xScaleId: e, yScaleId: s, style: o }) => (F(
419
+ "MIDDLE",
420
+ ({ getCtx: i, clampXPosToChartArea: r, clampYPosToChartArea: d, valToPos: l }) => {
386
421
  const c = [], a = i();
387
- for (const l of t) {
388
- const p = r(d(l.x, e)), x = u(d(l.y, s));
422
+ for (const u of t) {
423
+ const p = r(l(u.x, e)), x = d(l(u.y, s));
389
424
  c.push({ x: p, y: x });
390
425
  }
391
- const m = c.at(0), f = c.at(-1);
392
- if (!m || !f)
426
+ const m = c.at(0), h = c.at(-1);
427
+ if (!m || !h)
393
428
  return;
394
- const h = u(d(0, s));
395
- a.save(), a.beginPath(), U(a, o), a.moveTo(m.x, h);
396
- for (const l of c)
397
- a.lineTo(l.x, l.y);
398
- if (a.lineTo(f.x, h), a.closePath(), a.fill(), n) {
429
+ const f = d(l(0, s));
430
+ a.save(), a.beginPath(), _(a, o), a.moveTo(m.x, f);
431
+ for (const u of c)
432
+ a.lineTo(u.x, u.y);
433
+ if (a.lineTo(h.x, f), a.closePath(), a.fill(), n) {
399
434
  a.beginPath(), a.moveTo(m.x, m.y);
400
- for (const l of c)
401
- a.lineTo(l.x, l.y);
435
+ for (const u of c)
436
+ a.lineTo(u.x, u.y);
402
437
  a.stroke();
403
438
  }
404
439
  a.restore();
405
440
  },
406
441
  [t, n, e, s, o]
407
- ), null), Se = (t, n) => mt(
442
+ ), null), Se = (t, n) => pt(
408
443
  ({
409
444
  clampXPosToChartArea: e,
410
445
  clampYPosToChartArea: s,
@@ -412,75 +447,77 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
412
447
  valToPos: i,
413
448
  valFits: r
414
449
  }) => {
415
- const u = {};
416
- for (const d in t) {
417
- const c = t[d];
450
+ const d = {};
451
+ for (const l in t) {
452
+ const c = t[l];
418
453
  switch (c.exceeding) {
419
454
  case "discard": {
420
455
  if (r(c.value, c.scaleId)) {
421
456
  const a = i(c.value, c.scaleId, n);
422
- u[d] = a;
457
+ d[l] = a;
423
458
  }
424
459
  break;
425
460
  }
426
461
  case "clamp": {
427
462
  const a = i(c.value, c.scaleId, n);
428
- u[d] = o(c.scaleId)?.origin === "x" ? e(a, n) : s(a, n);
463
+ d[l] = o(c.scaleId)?.origin === "x" ? e(a, n) : s(a, n);
429
464
  break;
430
465
  }
431
466
  }
432
467
  }
433
- return u;
468
+ return d;
434
469
  }
435
- ), Ce = ({ scaleId: t, tickStyle: n, labelStyle: e, labelGap: s, tickSize: o, ticks: i }) => (z(
436
- ({ getCtx: r, valToPos: u, getScale: d, getFrame: c }) => {
437
- const a = r(), m = d(t);
470
+ ), Te = ({ scaleId: t, tickStyle: n, labelStyle: e, labelGap: s, tickSize: o, ticks: i }) => (F(
471
+ "BOTTOM",
472
+ ({ getCtx: r, valToPos: d, getScale: l, getFrame: c }) => {
473
+ const a = r(), m = l(t);
438
474
  if (!m || !m.axis || m.origin !== "x") return;
439
- const f = m.axis, h = f.position === "top" ? f.canvasRect.y + f.canvasRect.height : f.canvasRect.y, l = window.devicePixelRatio || 1, p = h, x = (o ?? 6) * l, v = f.position === "top" ? h - x : h + x, g = (s ?? 12) * l;
440
- a.save(), a.fontKerning = "auto", U(a, {
475
+ const h = m.axis, f = h.position === "top" ? h.canvasRect.y + h.canvasRect.height : h.canvasRect.y, u = window.devicePixelRatio || 1, p = f, x = (o ?? 6) * u, v = h.position === "top" ? f - x : f + x, g = (s ?? 12) * u;
476
+ a.save(), a.fontKerning = "auto", _(a, {
441
477
  ...n
442
478
  }), a.beginPath();
443
- const y = Array.isArray(i) ? i : i({ ...m, axis: f }, c());
444
- for (const { value: w } of y) {
445
- const S = u(w, t, "canvas");
479
+ const y = Array.isArray(i) ? i : i({ ...m, axis: h }, c());
480
+ for (const { value: b } of y) {
481
+ const S = d(b, t, "canvas");
446
482
  a.moveTo(S, p), a.lineTo(S, v);
447
483
  }
448
- a.stroke(), a.restore(), a.save(), U(a, {
449
- textBaseline: f.position === "top" ? "bottom" : "top",
484
+ a.stroke(), a.restore(), a.save(), _(a, {
485
+ textBaseline: h.position === "top" ? "bottom" : "top",
450
486
  textAlign: "center",
451
487
  ...n,
452
488
  ...e
453
489
  });
454
- for (const { value: w, label: S } of y) {
455
- const C = u(w, t, "canvas"), b = S.split(`
490
+ for (const { value: b, label: S } of y) {
491
+ const T = d(b, t, "canvas"), w = S.split(`
456
492
  `);
457
- for (let P = 0; P < b.length; P++)
458
- a.fillText(b[P], C, v + l * 2 + P * g);
493
+ for (let M = 0; M < w.length; M++)
494
+ a.fillText(w[M], T, v + u * 2 + M * g);
459
495
  }
460
496
  a.restore();
461
497
  },
462
498
  [i, t, n, e]
463
- ), null), Te = ({ scaleId: t, tickStyle: n, labelStyle: e, labelGap: s, tickSize: o, ticks: i }) => (z(
464
- ({ getCtx: r, valToPos: u, getScale: d, getFrame: c }) => {
465
- const a = r(), m = d(t);
499
+ ), null), Ce = ({ scaleId: t, tickStyle: n, labelStyle: e, labelGap: s, tickSize: o, ticks: i }) => (F(
500
+ "BOTTOM",
501
+ ({ getCtx: r, valToPos: d, getScale: l, getFrame: c }) => {
502
+ const a = r(), m = l(t);
466
503
  if (!m || !m.axis || m.origin !== "y") return;
467
- const f = m.axis, h = f.position === "left" ? f.canvasRect.x + f.canvasRect.width : f.canvasRect.x, l = h, p = o ?? 6, x = f.position === "left" ? h - p : h + p, v = s ?? 12, g = Array.isArray(i) ? i : i({ ...m, axis: f }, c());
468
- a.save(), a.fontKerning = "auto", U(a, { ...n }), a.beginPath();
504
+ const h = m.axis, f = h.position === "left" ? h.canvasRect.x + h.canvasRect.width : h.canvasRect.x, u = f, p = o ?? 6, x = h.position === "left" ? f - p : f + p, v = s ?? 12, g = Array.isArray(i) ? i : i({ ...m, axis: h }, c());
505
+ a.save(), a.fontKerning = "auto", _(a, { ...n }), a.beginPath();
469
506
  for (const { value: y } of g) {
470
- const w = u(y, t, "canvas");
471
- a.moveTo(l, w), a.lineTo(x, w);
507
+ const b = d(y, t, "canvas");
508
+ a.moveTo(u, b), a.lineTo(x, b);
472
509
  }
473
- a.stroke(), a.restore(), a.save(), U(a, {
510
+ a.stroke(), a.restore(), a.save(), _(a, {
474
511
  textBaseline: "middle",
475
- textAlign: f.position === "left" ? "right" : "left",
512
+ textAlign: h.position === "left" ? "right" : "left",
476
513
  ...n,
477
514
  ...e
478
515
  });
479
- for (const { value: y, label: w } of g) {
480
- const S = u(y, t, "canvas"), C = w.split(`
516
+ for (const { value: y, label: b } of g) {
517
+ const S = d(y, t, "canvas"), T = b.split(`
481
518
  `);
482
- for (let b = 0; b < C.length; b++)
483
- a.fillText(` ${C[b]} `, x, S + b * v);
519
+ for (let w = 0; w < T.length; w++)
520
+ a.fillText(` ${T[w]} `, x, S + w * v);
484
521
  }
485
522
  a.restore();
486
523
  },
@@ -500,7 +537,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
500
537
  s.syncKey === n && s.callback(n, e);
501
538
  }
502
539
  };
503
- }, T = {
540
+ }, C = {
504
541
  dblclick: k(),
505
542
  click: k(),
506
543
  contextmenu: k(),
@@ -513,41 +550,41 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
513
550
  sync_move: k()
514
551
  }, R = (t, n, e) => {
515
552
  const s = Q.useRef(e);
516
- s.current = e, Q.useEffect(() => T[t].addEventListener(
553
+ s.current = e, Q.useEffect(() => C[t].addEventListener(
517
554
  n,
518
555
  (i, r) => {
519
556
  s.current(r, i);
520
557
  }
521
558
  ), [n, t, s]);
522
- }, pt = Q.createContext(""), xt = (t, n) => {
523
- const e = Q.useContext(pt);
559
+ }, xt = Q.createContext(""), yt = (t, n) => {
560
+ const e = Q.useContext(xt);
524
561
  return R(t, e, n);
525
562
  }, Wt = (t, n, e, s, o) => {
526
563
  if (!n) return;
527
564
  const i = s ?? e.scales.find((m) => m.origin === "x")?.id, r = o ?? e.scales.find((m) => m.origin === "y")?.id;
528
565
  if (!i || !r)
529
566
  return;
530
- const u = t.clientX - n.left, d = {
567
+ const d = t.clientX - n.left, l = {
531
568
  scaleId: i,
532
- value: D(e, u, i, "css")
569
+ value: L(e, d, i, "css")
533
570
  }, c = t.clientY - n.top, a = {
534
571
  scaleId: r,
535
- value: D(e, c, r, "css")
572
+ value: L(e, c, r, "css")
536
573
  };
537
- return { pointerSyncPosition: { x: d, y: a }, cssX: u, cssY: c };
538
- }, F = (t, n) => {
574
+ return { pointerSyncPosition: { x: l, y: a }, cssX: d, cssY: c };
575
+ }, O = (t, n) => {
539
576
  const { x: e, y: s } = t, o = e && n.scales.some((r) => r.id === e.scaleId) ? H(n, e.value, e.scaleId, "css") : null, i = s && n.scales.some((r) => r.id === s.scaleId) ? H(n, s.value, s.scaleId, "css") : null;
540
577
  return {
541
578
  cssX: o,
542
579
  cssY: i,
543
580
  scaled: Object.fromEntries(
544
581
  n.scales.flatMap((r) => {
545
- const u = r.origin === "y" ? i : o;
546
- return u === null ? [] : [[r.id, D(n, u, r.id, "css")]];
582
+ const d = r.origin === "y" ? i : o;
583
+ return d === null ? [] : [[r.id, L(n, d, r.id, "css")]];
547
584
  })
548
585
  )
549
586
  };
550
- }, bt = (t, n, e) => {
587
+ }, St = (t, n, e) => {
551
588
  const s = H(
552
589
  e,
553
590
  n.from,
@@ -562,12 +599,12 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
562
599
  (r) => {
563
600
  if (r.origin !== t)
564
601
  return [];
565
- const u = D(e, s, r.id, "css"), d = D(e, o, r.id, "css");
602
+ const d = L(e, s, r.id, "css"), l = L(e, o, r.id, "css");
566
603
  return [
567
604
  {
568
605
  scaleId: r.id,
569
- from: u,
570
- to: d
606
+ from: d,
607
+ to: l
571
608
  }
572
609
  ];
573
610
  }
@@ -577,7 +614,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
577
614
  toCSS: o,
578
615
  scaled: i
579
616
  };
580
- }, Pe = ({
617
+ }, Me = ({
581
618
  id: t,
582
619
  onClick: n,
583
620
  onDblClick: e,
@@ -585,31 +622,31 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
585
622
  onMouseDown: o,
586
623
  onMouseUp: i,
587
624
  onDocumentMouseUp: r,
588
- onSpanSelect: u,
589
- onContextMenu: d,
625
+ onSpanSelect: d,
626
+ onContextMenu: l,
590
627
  className: c,
591
628
  style: a,
592
629
  sync: m,
593
- children: f
630
+ children: h
594
631
  }) => {
595
- const h = Xt(), l = t || h;
596
- return R("dblclick", l, (p) => {
632
+ const f = Kt(), u = t || f;
633
+ return R("dblclick", u, (p) => {
597
634
  e?.(p);
598
- }), R("click", l, (p) => {
635
+ }), R("click", u, (p) => {
599
636
  n?.(p);
600
- }), R("move", l, (p) => {
637
+ }), R("move", u, (p) => {
601
638
  s?.(p);
602
- }), R("mousedown", l, (p) => {
639
+ }), R("mousedown", u, (p) => {
603
640
  o?.(p);
604
- }), R("mouseup", l, (p) => {
641
+ }), R("mouseup", u, (p) => {
605
642
  i?.(p);
606
- }), R("documentmouseup", l, (p) => {
643
+ }), R("documentmouseup", u, (p) => {
607
644
  r?.(p);
608
- }), R("spanselect", l, (p) => {
609
- u?.(p);
610
- }), R("contextmenu", l, (p) => {
645
+ }), R("spanselect", u, (p) => {
611
646
  d?.(p);
612
- }), /* @__PURE__ */ dt(pt.Provider, { value: l, children: [
647
+ }), R("contextmenu", u, (p) => {
648
+ l?.(p);
649
+ }), /* @__PURE__ */ ht(xt.Provider, { value: u, children: [
613
650
  /* @__PURE__ */ A(
614
651
  qt,
615
652
  {
@@ -618,23 +655,23 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
618
655
  sync: m
619
656
  }
620
657
  ),
621
- f
658
+ h
622
659
  ] });
623
660
  }, qt = ({ className: t, style: n, sync: e }) => {
624
- const s = I(null), o = mt(), i = I(o);
661
+ const s = D(null), o = pt(), i = D(o);
625
662
  i.current = o;
626
- const r = tt(pt), u = e?.key || r, d = I(null), c = I(null), a = I(null), m = () => {
627
- const l = s.current?.parentElement;
628
- if (l) {
629
- if (l.dataset.canplotroot === void 0)
663
+ const r = tt(xt), d = e?.key || r, l = D(null), c = D(null), a = D(null), m = () => {
664
+ const u = s.current?.parentElement;
665
+ if (u) {
666
+ if (u.dataset.canplotroot === void 0)
630
667
  throw new Error(
631
668
  "ChartAreaInteractions must be used within a CanPlot component"
632
669
  );
633
- return l.getBoundingClientRect();
670
+ return u.getBoundingClientRect();
634
671
  }
635
- }, f = (l, p) => {
672
+ }, h = (u, p) => {
636
673
  const x = Wt(
637
- l,
674
+ u,
638
675
  m(),
639
676
  i.current,
640
677
  e?.xViaScaleId,
@@ -644,20 +681,20 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
644
681
  x.pointerSyncPosition,
645
682
  { cssX: x.cssX, cssY: x.cssY },
646
683
  {
647
- ctrlKey: l.ctrlKey,
648
- altKey: l.altKey,
649
- shiftKey: l.shiftKey,
650
- metaKey: l.metaKey
684
+ ctrlKey: u.ctrlKey,
685
+ altKey: u.altKey,
686
+ shiftKey: u.shiftKey,
687
+ metaKey: u.metaKey
651
688
  }
652
689
  );
653
- }, h = I(f);
654
- return h.current = f, Tt(() => {
655
- const l = (y) => {
656
- const w = c.current;
657
- w && T.spanselect.dispatchEvent(r, {
658
- ...w,
690
+ }, f = D(h);
691
+ return f.current = h, Mt(() => {
692
+ const u = (y) => {
693
+ const b = c.current;
694
+ b && C.spanselect.dispatchEvent(r, {
695
+ ...b,
659
696
  completed: !0
660
- }), T.documentmouseup.dispatchEvent(r, {
697
+ }), C.documentmouseup.dispatchEvent(r, {
661
698
  frame: i.current,
662
699
  keys: {
663
700
  ctrlKey: y.ctrlKey,
@@ -667,69 +704,69 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
667
704
  }
668
705
  });
669
706
  }, p = (y) => {
670
- const w = {
707
+ const b = {
671
708
  ctrlKey: y.ctrlKey,
672
709
  altKey: y.altKey,
673
710
  shiftKey: y.shiftKey,
674
711
  metaKey: y.metaKey
675
712
  }, S = a.current;
676
- if (S && Object.entries(w).some(
677
- ([b, P]) => S.keys[b] !== P
713
+ if (S && Object.entries(b).some(
714
+ ([w, M]) => S.keys[w] !== M
678
715
  )) {
679
- const b = { ...S, keys: w };
680
- a.current = b, T.sync_move.dispatchEvent(u, b);
716
+ const w = { ...S, keys: b };
717
+ a.current = w, C.sync_move.dispatchEvent(d, w);
681
718
  }
682
- const C = c.current;
683
- if (C && Object.entries(w).some(
684
- ([b, P]) => C.keys[b] !== P
719
+ const T = c.current;
720
+ if (T && Object.entries(b).some(
721
+ ([w, M]) => T.keys[w] !== M
685
722
  )) {
686
723
  y.stopPropagation(), y.preventDefault();
687
- const b = { ...C, keys: w };
688
- c.current = b, T.spanselect.dispatchEvent(r, b);
724
+ const w = { ...T, keys: b };
725
+ c.current = w, C.spanselect.dispatchEvent(r, w);
689
726
  }
690
727
  }, x = (y) => {
691
- h.current(
728
+ f.current(
692
729
  y,
693
- (w, { cssX: S, cssY: C }, b) => {
694
- const P = d.current;
695
- if (!P || !w.x || !w.y) return;
696
- const E = i.current, M = P.xRangeCss.start, B = S, K = P.yRangeCss.start, ot = C, it = _(E, w.x.scaleId), rt = _(E, w.y.scaleId);
697
- d.current = {
698
- xRangeCss: { start: M, end: B },
730
+ (b, { cssX: S, cssY: T }, w) => {
731
+ const M = l.current;
732
+ if (!M || !b.x || !b.y) return;
733
+ const E = i.current, P = M.xRangeCss.start, N = S, K = M.yRangeCss.start, ot = T, it = I(E, b.x.scaleId), rt = I(E, b.y.scaleId);
734
+ l.current = {
735
+ xRangeCss: { start: P, end: N },
699
736
  yRangeCss: { start: K, end: ot }
700
737
  };
701
738
  let $ = "below_threshold";
702
- const ct = Math.abs(K - ot), at = Math.abs(M - B);
739
+ const ct = Math.abs(K - ot), at = Math.abs(P - N);
703
740
  ct < 10 && at < 10 ? $ = "below_threshold" : ct > 30 && at > 30 ? $ = "box" : ct > at ? $ = "y" : $ = "x";
704
- const vt = {
741
+ const gt = {
705
742
  scaleId: it.id,
706
- from: D(
743
+ from: L(
707
744
  E,
708
- Y(i.current, M, "css"),
745
+ Y(i.current, P, "css"),
709
746
  it.id,
710
747
  "css"
711
748
  ),
712
- to: D(
749
+ to: L(
713
750
  E,
714
- Y(i.current, B, "css"),
751
+ Y(i.current, N, "css"),
715
752
  it.id,
716
753
  "css"
717
754
  )
718
- }, gt = {
755
+ }, bt = {
719
756
  scaleId: rt.id,
720
- from: D(
757
+ from: L(
721
758
  E,
722
- O(i.current, K, "css"),
759
+ B(i.current, K, "css"),
723
760
  rt.id,
724
761
  "css"
725
762
  ),
726
- to: D(
763
+ to: L(
727
764
  E,
728
- O(i.current, ot, "css"),
765
+ B(i.current, ot, "css"),
729
766
  rt.id,
730
767
  "css"
731
768
  )
732
- }, W = vt && bt("x", vt, i.current), q = gt && bt("y", gt, i.current), Ut = W?.scaled, It = q?.scaled, wt = {
769
+ }, W = gt && St("x", gt, i.current), q = bt && St("y", bt, i.current), Dt = W?.scaled, Lt = q?.scaled, wt = {
733
770
  mode: $,
734
771
  frame: i.current,
735
772
  completed: !1,
@@ -738,37 +775,37 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
738
775
  from: W.fromCSS,
739
776
  to: W.toCSS
740
777
  },
741
- scaled: Ut ?? []
778
+ scaled: Dt ?? []
742
779
  },
743
780
  y: {
744
781
  css: q && {
745
782
  from: q.fromCSS,
746
783
  to: q.toCSS
747
784
  },
748
- scaled: It ?? []
785
+ scaled: Lt ?? []
749
786
  },
750
- keys: b
787
+ keys: w
751
788
  };
752
- c.current = wt, T.spanselect.dispatchEvent(
789
+ c.current = wt, C.spanselect.dispatchEvent(
753
790
  r,
754
791
  wt
755
792
  );
756
793
  }
757
794
  );
758
795
  }, v = (y) => {
759
- h.current(y, (w, S, C) => {
760
- const b = F(
761
- w,
796
+ f.current(y, (b, S, T) => {
797
+ const w = O(
798
+ b,
762
799
  i.current
763
800
  );
764
- if (!b) return;
765
- if (Object.values(C).some((E) => E)) {
801
+ if (!w) return;
802
+ if (Object.values(T).some((E) => E)) {
766
803
  y.preventDefault();
767
804
  const E = Math.abs(y.deltaY) > Math.abs(y.deltaX) ? y.deltaY : y.deltaX;
768
- T.pressandwheel.dispatchEvent(r, {
769
- pointer: b,
805
+ C.pressandwheel.dispatchEvent(r, {
806
+ pointer: w,
770
807
  frame: i.current,
771
- keys: C,
808
+ keys: T,
772
809
  deltaX: y.deltaX,
773
810
  deltaY: y.deltaY,
774
811
  deltaAbs: E
@@ -776,22 +813,22 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
776
813
  }
777
814
  });
778
815
  };
779
- document.addEventListener("mouseup", l), document.addEventListener("keydown", p), document.addEventListener("keyup", p), document.addEventListener("mousemove", x);
816
+ document.addEventListener("mouseup", u), document.addEventListener("keydown", p), document.addEventListener("keyup", p), document.addEventListener("mousemove", x);
780
817
  const g = s.current;
781
818
  return g?.addEventListener("wheel", v, {
782
819
  passive: !1
783
820
  }), () => {
784
- document.removeEventListener("mouseup", l), document.removeEventListener("keydown", p), document.removeEventListener("keyup", p), document.removeEventListener("mousemove", x), g?.removeEventListener("wheel", v);
821
+ document.removeEventListener("mouseup", u), document.removeEventListener("keydown", p), document.removeEventListener("keyup", p), document.removeEventListener("mousemove", x), g?.removeEventListener("wheel", v);
785
822
  };
786
- }, [i, r, u, h]), R("sync_move", u, (l) => {
787
- const p = l.positions ? F(
788
- l.positions,
823
+ }, [i, r, d, f]), R("sync_move", d, (u) => {
824
+ const p = u.positions ? O(
825
+ u.positions,
789
826
  i.current
790
827
  ) : null;
791
- a.current = l, T.move.dispatchEvent(r, {
828
+ a.current = u, C.move.dispatchEvent(r, {
792
829
  frame: i.current,
793
830
  pointer: p ?? null,
794
- keys: l.keys
831
+ keys: u.keys
795
832
  });
796
833
  }), /* @__PURE__ */ A(
797
834
  "div",
@@ -808,102 +845,102 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
808
845
  zIndex: 25,
809
846
  ...n
810
847
  },
811
- onDragStart: (l) => {
812
- l.preventDefault();
848
+ onDragStart: (u) => {
849
+ u.preventDefault();
813
850
  },
814
- onClick: (l) => {
815
- f(l, (p, x, v) => {
816
- const g = F(
851
+ onClick: (u) => {
852
+ h(u, (p, x, v) => {
853
+ const g = O(
817
854
  p,
818
855
  i.current
819
856
  );
820
- g && T.click.dispatchEvent(r, {
857
+ g && C.click.dispatchEvent(r, {
821
858
  pointer: g,
822
859
  frame: i.current,
823
860
  keys: v
824
861
  });
825
862
  });
826
863
  },
827
- onMouseLeave: (l) => {
828
- f(l, (p, x, v) => {
829
- T.sync_move.dispatchEvent(u, {
864
+ onMouseLeave: (u) => {
865
+ h(u, (p, x, v) => {
866
+ C.sync_move.dispatchEvent(d, {
830
867
  positions: null,
831
868
  keys: v
832
869
  });
833
870
  });
834
871
  },
835
- onMouseMove: (l) => {
836
- f(l, (p, x, v) => {
837
- T.sync_move.dispatchEvent(u, {
872
+ onMouseMove: (u) => {
873
+ h(u, (p, x, v) => {
874
+ C.sync_move.dispatchEvent(d, {
838
875
  positions: p,
839
876
  keys: v
840
877
  });
841
878
  });
842
879
  },
843
- onMouseDown: (l) => {
844
- f(l, (p, { cssX: x, cssY: v }, g) => {
845
- const y = F(
880
+ onMouseDown: (u) => {
881
+ h(u, (p, { cssX: x, cssY: v }, g) => {
882
+ const y = O(
846
883
  p,
847
884
  i.current
848
885
  );
849
- y && (T.mousedown.dispatchEvent(r, {
886
+ y && (C.mousedown.dispatchEvent(r, {
850
887
  pointer: y,
851
888
  frame: i.current,
852
889
  keys: g
853
- }), d.current = {
890
+ }), l.current = {
854
891
  xRangeCss: { start: x, end: x },
855
892
  yRangeCss: { start: v, end: v }
856
893
  });
857
894
  });
858
895
  },
859
- onMouseUp: (l) => {
860
- f(l, (p, x, v) => {
861
- const g = F(
896
+ onMouseUp: (u) => {
897
+ h(u, (p, x, v) => {
898
+ const g = O(
862
899
  p,
863
900
  i.current
864
901
  );
865
902
  if (!g) return;
866
- T.mouseup.dispatchEvent(r, {
903
+ C.mouseup.dispatchEvent(r, {
867
904
  frame: i.current,
868
905
  pointer: g,
869
906
  keys: v
870
907
  });
871
908
  const y = c.current;
872
909
  c.current = null;
873
- const w = d.current;
874
- if (d.current = null, w && y) {
910
+ const b = l.current;
911
+ if (l.current = null, b && y) {
875
912
  const S = {
876
913
  ...y,
877
914
  keys: v,
878
915
  completed: !0
879
916
  };
880
- c.current = null, T.spanselect.dispatchEvent(
917
+ c.current = null, C.spanselect.dispatchEvent(
881
918
  r,
882
919
  S
883
920
  );
884
921
  }
885
922
  });
886
923
  },
887
- onContextMenu: (l) => {
888
- l.preventDefault(), f(l, (p, x, v) => {
889
- const g = F(
924
+ onContextMenu: (u) => {
925
+ u.preventDefault(), h(u, (p, x, v) => {
926
+ const g = O(
890
927
  p,
891
928
  i.current
892
929
  );
893
- g && T.contextmenu.dispatchEvent(r, {
930
+ g && C.contextmenu.dispatchEvent(r, {
894
931
  frame: i.current,
895
932
  pointer: g,
896
933
  keys: v
897
934
  });
898
935
  });
899
936
  },
900
- onDoubleClick: (l) => {
901
- f(l, (p, x, v) => {
902
- const g = F(
937
+ onDoubleClick: (u) => {
938
+ h(u, (p, x, v) => {
939
+ const g = O(
903
940
  p,
904
941
  i.current
905
942
  );
906
- g && T.dblclick.dispatchEvent(r, {
943
+ g && C.dblclick.dispatchEvent(r, {
907
944
  frame: i.current,
908
945
  pointer: g,
909
946
  keys: v
@@ -914,33 +951,33 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
914
951
  );
915
952
  }, Ee = ({ data: t, renderTooltip: n, xScaleId: e }) => {
916
953
  const [s, o] = V(null);
917
- xt("move", (r) => {
954
+ yt("move", (r) => {
918
955
  o(r);
919
956
  });
920
957
  const i = et(() => {
921
958
  if (!s)
922
959
  return null;
923
- const { frame: r, pointer: u } = s, d = u?.scaled[e];
924
- if (d === void 0)
960
+ const { frame: r, pointer: d } = s, l = d?.scaled[e];
961
+ if (l === void 0)
925
962
  return null;
926
963
  const c = [];
927
- let a = d;
964
+ let a = l;
928
965
  for (const m of t) {
929
- let f = null, h = 1 / 0;
966
+ let h = null, f = 1 / 0;
930
967
  for (const [p, x] of m.points.entries()) {
931
968
  if (!lt(r, x.x, e) || !lt(r, x.y, m.yScaleId))
932
969
  continue;
933
- const v = Math.abs(x.x - d);
934
- v < h && (h = v, f = p);
970
+ const v = Math.abs(x.x - l);
971
+ v < f && (f = v, h = p);
935
972
  }
936
- const l = m.points[f ?? -1];
937
- if (!l || ht(r, h, e, "css") > 30) {
973
+ const u = m.points[h ?? -1];
974
+ if (!u || ft(r, f, e, "css") > 30) {
938
975
  c.push({ seriesId: m.seriesId, y: null });
939
976
  continue;
940
977
  }
941
- a = l.x, c.push({
978
+ a = u.x, c.push({
942
979
  seriesId: m.seriesId,
943
- y: l.y
980
+ y: u.y
944
981
  });
945
982
  }
946
983
  return {
@@ -950,30 +987,30 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
950
987
  };
951
988
  }, [t, s, e]);
952
989
  return n(i);
953
- }, Me = ({ makeXStyle: t, makeXClassName: n, makeYStyle: e, makeYClassName: s }) => {
990
+ }, Pe = ({ makeXStyle: t, makeXClassName: n, makeYStyle: e, makeYClassName: s }) => {
954
991
  const [o, i] = V(null);
955
- if (xt("move", (f) => {
956
- i(f);
992
+ if (yt("move", (h) => {
993
+ i(h);
957
994
  }), !o)
958
995
  return null;
959
- const { frame: r, pointer: u } = o, d = u?.cssX ?? null, c = u?.cssY ?? null, a = d ? Y(r, d, "css") : 0, m = c ? O(r, c, "css") : 0;
960
- return /* @__PURE__ */ dt(Dt, { children: [
996
+ const { frame: r, pointer: d } = o, l = d?.cssX ?? null, c = d?.cssY ?? null, a = l ? Y(r, l, "css") : 0, m = c ? B(r, c, "css") : 0;
997
+ return /* @__PURE__ */ ht(It, { children: [
961
998
  /* @__PURE__ */ A(
962
999
  "div",
963
1000
  {
964
- "data-show": !!u,
1001
+ "data-show": !!d,
965
1002
  className: n?.(o),
966
1003
  style: {
967
1004
  position: "absolute",
968
1005
  left: 0,
969
- visibility: d === null ? "hidden" : "visible",
1006
+ visibility: l === null ? "hidden" : "visible",
970
1007
  top: r.chartAreaCSS.y,
971
1008
  height: r.chartAreaCSS.height,
972
1009
  borderColor: "red",
973
1010
  borderLeftWidth: "1px",
974
1011
  borderLeftStyle: "solid",
975
1012
  pointerEvents: "none",
976
- opacity: u ? 1 : 0,
1013
+ opacity: d ? 1 : 0,
977
1014
  transform: `translateX(${a}px)`,
978
1015
  ...t?.(o)
979
1016
  }
@@ -983,7 +1020,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
983
1020
  "div",
984
1021
  {
985
1022
  className: s?.(o),
986
- "data-show": !!u,
1023
+ "data-show": !!d,
987
1024
  style: {
988
1025
  position: "absolute",
989
1026
  visibility: c === null ? "hidden" : "visible",
@@ -993,7 +1030,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
993
1030
  left: r.chartAreaCSS.x,
994
1031
  width: r.chartAreaCSS.width,
995
1032
  pointerEvents: "none",
996
- opacity: u ? 1 : 0,
1033
+ opacity: d ? 1 : 0,
997
1034
  transform: `translateY(${m}px)`,
998
1035
  ...e?.(o)
999
1036
  }
@@ -1002,7 +1039,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
1002
1039
  ] });
1003
1040
  }, ke = ({ makeClassName: t, makeStyle: n }) => {
1004
1041
  const [e, s] = V(null);
1005
- xt("spanselect", (i) => {
1042
+ yt("spanselect", (i) => {
1006
1043
  s(
1007
1044
  i.mode === "below_threshold" || i.completed ? null : i
1008
1045
  );
@@ -1010,8 +1047,8 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
1010
1047
  const o = et(() => {
1011
1048
  if (!e || e.mode === "below_threshold")
1012
1049
  return null;
1013
- const i = e.mode === "y" ? -1 / 0 : e.x.css?.from ?? -1 / 0, r = e.mode === "y" ? 1 / 0 : e.x.css?.to ?? 1 / 0, u = e.mode === "x" ? -1 / 0 : e.y.css?.from ?? -1 / 0, d = e.mode === "x" ? 1 / 0 : e.y.css?.to ?? 1 / 0, c = Y(e.frame, i, "css"), a = Y(e.frame, r, "css"), m = O(e.frame, u, "css"), f = O(e.frame, d, "css"), h = Math.min(c, a), l = Math.min(m, f), p = Math.abs(a - c), x = Math.abs(f - m);
1014
- return { leftPx: h, topPx: l, widthPx: p, heightPx: x };
1050
+ const i = e.mode === "y" ? -1 / 0 : e.x.css?.from ?? -1 / 0, r = e.mode === "y" ? 1 / 0 : e.x.css?.to ?? 1 / 0, d = e.mode === "x" ? -1 / 0 : e.y.css?.from ?? -1 / 0, l = e.mode === "x" ? 1 / 0 : e.y.css?.to ?? 1 / 0, c = Y(e.frame, i, "css"), a = Y(e.frame, r, "css"), m = B(e.frame, d, "css"), h = B(e.frame, l, "css"), f = Math.min(c, a), u = Math.min(m, h), p = Math.abs(a - c), x = Math.abs(h - m);
1051
+ return { leftPx: f, topPx: u, widthPx: p, heightPx: x };
1015
1052
  }, [e]);
1016
1053
  return /* @__PURE__ */ A(
1017
1054
  "div",
@@ -1030,7 +1067,7 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
1030
1067
  }
1031
1068
  );
1032
1069
  }, Re = ({ style: t, children: n, scaleId: e, ...s }) => {
1033
- const o = mt((i) => i.getScale(e)?.axis);
1070
+ const o = pt((i) => i.getScale(e)?.axis);
1034
1071
  return o ? /* @__PURE__ */ A(
1035
1072
  "div",
1036
1073
  {
@@ -1047,32 +1084,32 @@ const xe = Lt(({ configuration: t, children: n, style: e, className: s }, o) =>
1047
1084
  children: n
1048
1085
  }
1049
1086
  ) : null;
1050
- }, kt = 60, Gt = 30, Rt = "UTC", Zt = "en-GB", Ae = ({
1087
+ }, Rt = 60, Gt = 30, At = "UTC", Zt = "en-GB", Ae = ({
1051
1088
  space: t,
1052
1089
  formatter: n,
1053
1090
  acceptableIncrements: e
1054
1091
  } = {}) => (s, o) => {
1055
- const { min: i, max: r } = s, u = [], d = window.devicePixelRatio || 1, c = (t ?? (s.origin === "x" ? kt : Gt)) * d, a = Kt(
1092
+ const { min: i, max: r } = s, d = [], l = window.devicePixelRatio || 1, c = (t ?? (s.origin === "x" ? Rt : Gt)) * l, a = Ot(
1056
1093
  o,
1057
1094
  c,
1058
1095
  s.id,
1059
1096
  "canvas"
1060
- ), m = e ?? G, f = m.find((l) => l > a) ?? m.at(-1) ?? 1;
1061
- let h = i;
1062
- if (Math.abs(h % f) > Number.EPSILON) {
1063
- const l = (f - h % f) % f;
1064
- h += l;
1097
+ ), m = e ?? G, h = m.find((u) => u > a) ?? m.at(-1) ?? 1;
1098
+ let f = i;
1099
+ if (Math.abs(f % h) > Number.EPSILON) {
1100
+ const u = (h - f % h) % h;
1101
+ f += u;
1065
1102
  }
1066
- for (; h <= r && u.length < 1e3; )
1067
- u.push(h), h += f;
1068
- return (n ?? Jt)(u);
1103
+ for (; f <= r && d.length < 1e3; )
1104
+ d.push(f), f += h;
1105
+ return (n ?? Jt)(d);
1069
1106
  }, Jt = (t) => {
1070
1107
  const n = Math.max(0, Math.ceil(-Math.log10(t[1] - t[0])));
1071
1108
  return t.map((e) => ({ value: e, label: e.toFixed(n) }));
1072
1109
  }, G = [];
1073
1110
  for (let t = -12; t <= 12; t++)
1074
1111
  G.push(1 * 10 ** t), G.push(2 * 10 ** t), G.push(5 * 10 ** t);
1075
- const Qt = 1, At = 1e3 * Qt, yt = 60 * At, nt = 60 * yt, st = 24 * nt, te = 30 * st, ee = 365 * st, ne = [
1112
+ const Qt = 1, _t = 1e3 * Qt, vt = 60 * _t, nt = 60 * vt, st = 24 * nt, te = 30 * st, ee = 365 * st, ne = [
1076
1113
  // second divisors
1077
1114
  [1, "milliseconds"],
1078
1115
  [2, "milliseconds"],
@@ -1130,9 +1167,9 @@ const Qt = 1, At = 1e3 * Qt, yt = 60 * At, nt = 60 * yt, st = 24 * nt, te = 30 *
1130
1167
  case "milliseconds":
1131
1168
  return n;
1132
1169
  case "seconds":
1133
- return n * At;
1170
+ return n * _t;
1134
1171
  case "minutes":
1135
- return n * yt;
1172
+ return n * vt;
1136
1173
  case "hours":
1137
1174
  return n * nt;
1138
1175
  case "days":
@@ -1157,7 +1194,7 @@ const Qt = 1, At = 1e3 * Qt, yt = 60 * At, nt = 60 * yt, st = 24 * nt, te = 30 *
1157
1194
  }, ce = (t, n) => {
1158
1195
  const e = new Date(t);
1159
1196
  return e.setUTCDate(e.getUTCDate() + n), e.getTime();
1160
- }, St = (t, n) => {
1197
+ }, Tt = (t, n) => {
1161
1198
  const e = new Date(t);
1162
1199
  return e.setUTCMonth(e.getUTCMonth() + n), e.getTime();
1163
1200
  }, X = (t, n) => {
@@ -1174,9 +1211,9 @@ const Qt = 1, At = 1e3 * Qt, yt = 60 * At, nt = 60 * yt, st = 24 * nt, te = 30 *
1174
1211
  case "days":
1175
1212
  return ce(t, e);
1176
1213
  case "months":
1177
- return St(t, e);
1214
+ return Tt(t, e);
1178
1215
  case "years":
1179
- return St(t, e * 12);
1216
+ return Tt(t, e * 12);
1180
1217
  }
1181
1218
  };
1182
1219
  function J(t, n) {
@@ -1203,7 +1240,7 @@ const ae = (t, n, e = "UTC") => {
1203
1240
  break;
1204
1241
  case "minutes":
1205
1242
  i.setUTCMinutes(
1206
- Math.ceil(i.getTime() % nt / yt / s) * s,
1243
+ Math.ceil(i.getTime() % nt / vt / s) * s,
1207
1244
  0,
1208
1245
  0
1209
1246
  );
@@ -1223,30 +1260,30 @@ const ae = (t, n, e = "UTC") => {
1223
1260
  break;
1224
1261
  }
1225
1262
  return i.getTime();
1226
- }, Ue = ({
1227
- timeZone: t = Rt,
1228
- space: n = kt,
1263
+ }, _e = ({
1264
+ timeZone: t = At,
1265
+ space: n = Rt,
1229
1266
  formatter: e,
1230
1267
  locale: s,
1231
1268
  showTimezone: o
1232
1269
  } = {}) => (i, r) => {
1233
- const { min: u, max: d } = i, c = Math.floor(r.chartAreaCanvasPX.width / n) + 1, m = (d - u) / c, [f, h] = ne.find(
1270
+ const { min: d, max: l } = i, c = Math.floor(r.chartAreaCanvasPX.width / n) + 1, m = (l - d) / c, [h, f] = ne.find(
1234
1271
  (g) => Z(g) >= m
1235
- ) ?? [1, "milliseconds"], l = ae(u, [f, h], t), p = J(l, t), x = [l];
1272
+ ) ?? [1, "milliseconds"], u = ae(d, [h, f], t), p = J(u, t), x = [u];
1236
1273
  let v;
1237
1274
  for (; ; ) {
1238
- switch (h) {
1275
+ switch (f) {
1239
1276
  case "milliseconds":
1240
1277
  case "seconds":
1241
1278
  case "minutes":
1242
1279
  case "hours": {
1243
- v = X(l, [x.length * f, h]);
1280
+ v = X(u, [x.length * h, f]);
1244
1281
  break;
1245
1282
  }
1246
1283
  case "days": {
1247
- const g = X(l, [
1248
- x.length * f,
1249
- h
1284
+ const g = X(u, [
1285
+ x.length * h,
1286
+ f
1250
1287
  ]);
1251
1288
  v = X(g, [
1252
1289
  p - J(g, t),
@@ -1257,9 +1294,9 @@ const ae = (t, n, e = "UTC") => {
1257
1294
  case "months":
1258
1295
  case "years": {
1259
1296
  const g = X(
1260
- X(X(l, [p, "hours"]), [
1261
- x.length * f,
1262
- h
1297
+ X(X(u, [p, "hours"]), [
1298
+ x.length * h,
1299
+ f
1263
1300
  ]),
1264
1301
  [-p, "hours"]
1265
1302
  );
@@ -1270,7 +1307,7 @@ const ae = (t, n, e = "UTC") => {
1270
1307
  break;
1271
1308
  }
1272
1309
  }
1273
- if (v > d)
1310
+ if (v > l)
1274
1311
  break;
1275
1312
  x.push(v);
1276
1313
  }
@@ -1279,8 +1316,8 @@ const ae = (t, n, e = "UTC") => {
1279
1316
  showTimezone: o,
1280
1317
  timeZone: t
1281
1318
  }))(x);
1282
- }, L = (t, n, e) => t.find((s) => s.type === e)?.value !== n.find((s) => s.type === e)?.value, le = ({
1283
- timeZone: t = Rt,
1319
+ }, U = (t, n, e) => t.find((s) => s.type === e)?.value !== n.find((s) => s.type === e)?.value, le = ({
1320
+ timeZone: t = At,
1284
1321
  locale: n = Zt,
1285
1322
  showTimezone: e = !0
1286
1323
  }) => {
@@ -1297,69 +1334,70 @@ const ae = (t, n, e = "UTC") => {
1297
1334
  timeZone: t
1298
1335
  });
1299
1336
  return (o) => {
1300
- const i = o[1] - o[0], r = i < Z([1, "days"]), u = i < Z([1, "minutes"]), d = i < Z([1, "seconds"]);
1337
+ const i = o[1] - o[0], r = i < Z([1, "days"]), d = i < Z([1, "minutes"]), l = i < Z([1, "seconds"]);
1301
1338
  return o.map((c) => ({ value: c, label: s.formatToParts(new Date(c)) })).map((c, a, m) => {
1302
- const f = m[a - 1], h = a === 0 || L(c.label, f.label, "year"), l = a === 0 || L(c.label, f.label, "day"), p = a === 0 || L(c.label, f.label, "month"), x = a === 0 || L(c.label, f.label, "hour"), v = a === 0 || L(c.label, f.label, "timeZoneName"), g = a === 0 || L(c.label, f.label, "minute"), y = a === 0 || L(c.label, f.label, "second"), w = a === 0 || L(c.label, f.label, "fractionalSecond"), S = [];
1303
- if (r && (x || g || v || y || w)) {
1304
- const C = c.label.find((M) => M.type === "hour")?.value, b = c.label.find((M) => M.type === "minute")?.value, P = c.label.find((M) => M.type === "timeZoneName")?.value;
1339
+ const h = m[a - 1], f = a === 0 || U(c.label, h.label, "year"), u = a === 0 || U(c.label, h.label, "day"), p = a === 0 || U(c.label, h.label, "month"), x = a === 0 || U(c.label, h.label, "hour"), v = a === 0 || U(c.label, h.label, "timeZoneName"), g = a === 0 || U(c.label, h.label, "minute"), y = a === 0 || U(c.label, h.label, "second"), b = a === 0 || U(c.label, h.label, "fractionalSecond"), S = [];
1340
+ if (r && (x || g || v || y || b)) {
1341
+ const T = c.label.find((P) => P.type === "hour")?.value, w = c.label.find((P) => P.type === "minute")?.value, M = c.label.find((P) => P.type === "timeZoneName")?.value;
1305
1342
  let E = "";
1306
- if (u) {
1307
- const M = c.label.find((K) => K.type === "second")?.value, B = c.label.find(
1343
+ if (d) {
1344
+ const P = c.label.find((K) => K.type === "second")?.value, N = c.label.find(
1308
1345
  (K) => K.type === "fractionalSecond"
1309
1346
  )?.value;
1310
- E = `:${M}` + (d ? `.${B}` : "");
1347
+ E = `:${P}` + (l ? `.${N}` : "");
1311
1348
  }
1312
1349
  S.push(
1313
- `${C}:${b}${E}` + (e && v ? ` ${P}` : "")
1350
+ `${T}:${w}${E}` + (e && v ? ` ${M}` : "")
1314
1351
  );
1315
1352
  }
1316
- return (l || p) && S.push(
1353
+ return (u || p) && S.push(
1317
1354
  [
1318
- c.label.find((C) => C.type === "month")?.value,
1319
- l && c.label.find((C) => C.type === "day")?.value
1355
+ c.label.find((T) => T.type === "month")?.value,
1356
+ u && c.label.find((T) => T.type === "day")?.value
1320
1357
  ].filter(Boolean).join(" ")
1321
- ), h && S.push(c.label.find((C) => C.type === "year")?.value), {
1358
+ ), f && S.push(c.label.find((T) => T.type === "year")?.value), {
1322
1359
  value: c.value,
1323
- label: S.filter((C) => C).join(`
1360
+ label: S.filter((T) => T).join(`
1324
1361
  `)
1325
1362
  };
1326
1363
  });
1327
1364
  };
1328
1365
  };
1329
1366
  export {
1330
- we as AreaPlot,
1367
+ be as AreaPlot,
1331
1368
  Re as AxisOverlay,
1332
1369
  ge as BarPlot,
1370
+ ut as CANPLOT_LAYER,
1333
1371
  xe as CanPlot,
1334
- Pe as ChartAreaInteractions,
1335
- Me as Crosshair,
1372
+ Me as ChartAreaInteractions,
1373
+ Pe as Crosshair,
1336
1374
  ye as LinePlot,
1337
1375
  ve as ScatterPlot,
1338
1376
  ke as SelectBox,
1339
- be as SparklinePlot,
1377
+ we as SparklinePlot,
1340
1378
  Ee as TooltipsX,
1341
- Ce as XTicks,
1342
- Te as YTicks,
1343
- U as applyStyles,
1379
+ Te as XTicks,
1380
+ Ce as YTicks,
1381
+ _ as applyStyles,
1344
1382
  j as clamp,
1345
1383
  pe as clampUnfit,
1346
1384
  Y as clampXPosToChartArea,
1347
- O as clampYPosToChartArea,
1385
+ B as clampYPosToChartArea,
1348
1386
  Jt as defaultNumericalTicksFormatter,
1349
1387
  me as findClosestIndex,
1350
- _ as getScale,
1388
+ I as getScale,
1351
1389
  Ae as makeLinearTicks,
1352
1390
  le as makeTimeTickFormat,
1353
- Ue as makeTimeTicks,
1354
- D as posToVal,
1355
- Kt as pxToValDistance,
1391
+ _e as makeTimeTicks,
1392
+ L as posToVal,
1393
+ Ot as pxToValDistance,
1356
1394
  fe as sum,
1357
- z as useDrawEffect,
1358
- mt as useFrameState,
1359
- xt as useInteractionsEvent,
1395
+ F as useDrawEffect,
1396
+ pt as useFrameState,
1397
+ yt as useInteractionsEvent,
1360
1398
  Se as useXPositioned,
1361
1399
  lt as valFits,
1362
1400
  H as valToPos,
1363
- ht as valToPxDistance
1401
+ ft as valToPxDistance
1364
1402
  };
1365
1403
  //# sourceMappingURL=canplot.mjs.map