@canplot/react 0.1.24 → 0.2.0

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