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