@gearbox-protocol/ui-kit 4.0.0-next.37 → 4.0.0-next.38

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.
@@ -1,38 +1,38 @@
1
- import { jsxs as ge, jsx as V } from "react/jsx-runtime";
2
- import { createChart as ht, CrosshairMode as gt, LineStyle as ae, LineSeries as mt, AreaSeries as pt } from "lightweight-charts";
1
+ import { jsxs as te, jsx as w } from "react/jsx-runtime";
2
+ import { createChart as ht, CrosshairMode as dt, LineStyle as le, LineSeries as mt, AreaSeries as gt } from "lightweight-charts";
3
3
  import * as Ve from "react";
4
- import { useRef as K, useState as re, useEffect as A, useLayoutEffect as dt } from "react";
4
+ import { useRef as K, useState as ne, useEffect as G, useLayoutEffect as pt } from "react";
5
5
  import { useIsMobile as bt } from "../../hooks/use-media-query.js";
6
- import { cn as ee } from "../../utils/cn.js";
7
- import { resolveCSSColor as ne, generateColorsFromBase as ve, hslToHex as St } from "../../utils/colors.js";
8
- import { getDefaultOptions as Je, getDefaultSeries as vt, AXIS_TICK_MARK_DENSITY as Se, getDefaultVerticalLine as Ct, AXIS_FONT_SIZE as yt, AXIS_EDGE_LABEL_PADDING_PX as Qe, AXIS_TOP_LABEL_PADDING_PX as Ye, AXIS_TIME_EDGE_PADDING_PX as xt } from "./default-config.js";
6
+ import { cn as Z } from "../../utils/cn.js";
7
+ import { resolveCSSColor as ie, generateColorsFromBase as Ce, hslToHex as St } from "../../utils/colors.js";
8
+ import { getDefaultOptions as Je, getDefaultSeries as vt, AXIS_TICK_MARK_DENSITY as ve, getDefaultVerticalLine as Ct, AXIS_FONT_SIZE as xt, AXIS_EDGE_LABEL_PADDING_PX as Qe, AXIS_TOP_LABEL_PADDING_PX as Ye, AXIS_TIME_EDGE_PADDING_PX as yt } from "./default-config.js";
9
9
  import { getXFormatters as Ue, formatExactValue as Le, isRatioUnit as _t, createAdaptiveYAxisFormatter as wt } from "./formatters.js";
10
10
  import { GraphCurrentValue as Pt } from "./graph-current-value.js";
11
- import { GraphTooltip as Rt } from "./graph-tooltip.js";
12
- import { VertLine as Tt } from "./plugins/vertical-line.js";
13
- import { pickMinMove as Nt, niceAxisRange as Vt } from "./y-axis-scale.js";
14
- function ie(e) {
11
+ import { GraphTooltip as Nt } from "./graph-tooltip.js";
12
+ import { VertLine as Rt } from "./plugins/vertical-line.js";
13
+ import { pickMinMove as Tt, niceAxisRange as Vt } from "./y-axis-scale.js";
14
+ function ae(e) {
15
15
  return e.id ?? e.label;
16
16
  }
17
- function et(e, i, u) {
18
- if (!u)
17
+ function et(e, i, c) {
18
+ if (!c)
19
19
  return e.values().next().value;
20
- const f = e.get(u);
21
- if (f) return f;
22
- const s = i.find((d) => d.id === u || d.label === u);
23
- return s ? e.get(ie(s)) : void 0;
20
+ const u = e.get(c);
21
+ if (u) return u;
22
+ const h = i.find((f) => f.id === c || f.label === c);
23
+ return h ? e.get(ae(h)) : void 0;
24
24
  }
25
25
  class Lt {
26
26
  _yTop;
27
27
  _yBottom;
28
28
  _color;
29
- constructor(i, u, f) {
30
- this._yTop = i, this._yBottom = u, this._color = f;
29
+ constructor(i, c, u) {
30
+ this._yTop = i, this._yBottom = c, this._color = u;
31
31
  }
32
32
  draw(i) {
33
- i.useBitmapCoordinateSpace((u) => {
34
- const f = u.context, s = u.verticalPixelRatio, d = this._yTop === null ? 0 : this._yTop * s, S = this._yBottom === null ? u.bitmapSize.height : this._yBottom * s, w = Math.min(d, S), k = Math.max(d, S);
35
- f.fillStyle = this._color, f.fillRect(0, w, u.bitmapSize.width, k - w);
33
+ i.useBitmapCoordinateSpace((c) => {
34
+ const u = c.context, h = c.verticalPixelRatio, f = this._yTop === null ? 0 : this._yTop * h, S = this._yBottom === null ? c.bitmapSize.height : this._yBottom * h, P = Math.min(f, S), I = Math.max(f, S);
35
+ u.fillStyle = this._color, u.fillRect(0, P, c.bitmapSize.width, I - P);
36
36
  });
37
37
  }
38
38
  }
@@ -61,8 +61,8 @@ class kt {
61
61
  priceBottom;
62
62
  color;
63
63
  _paneViews;
64
- constructor(i, u, f, s) {
65
- this.series = i, this.priceTop = u, this.priceBottom = f, this.color = s, this._paneViews = [new Mt(this)];
64
+ constructor(i, c, u, h) {
65
+ this.series = i, this.priceTop = c, this.priceBottom = u, this.color = h, this._paneViews = [new Mt(this)];
66
66
  }
67
67
  updateAllViews() {
68
68
  for (const i of this._paneViews) i.update();
@@ -73,13 +73,13 @@ class kt {
73
73
  }
74
74
  function It(e, i) {
75
75
  switch (e) {
76
- case ae.Dotted:
76
+ case le.Dotted:
77
77
  return [i, i];
78
- case ae.Dashed:
78
+ case le.Dashed:
79
79
  return [2 * i, 2 * i];
80
- case ae.LargeDashed:
80
+ case le.LargeDashed:
81
81
  return [6 * i, 6 * i];
82
- case ae.SparseDotted:
82
+ case le.SparseDotted:
83
83
  return [i, 4 * i];
84
84
  default:
85
85
  return [];
@@ -90,14 +90,14 @@ class Dt {
90
90
  _color;
91
91
  _lineWidth;
92
92
  _lineStyle;
93
- constructor(i, u, f, s) {
94
- this._y = i, this._color = u, this._lineWidth = f, this._lineStyle = s;
93
+ constructor(i, c, u, h) {
94
+ this._y = i, this._color = c, this._lineWidth = u, this._lineStyle = h;
95
95
  }
96
96
  draw(i) {
97
- i.useBitmapCoordinateSpace((u) => {
97
+ i.useBitmapCoordinateSpace((c) => {
98
98
  if (this._y === null) return;
99
- const f = u.context, s = u.verticalPixelRatio, d = Math.max(1, Math.round(this._lineWidth * s)), S = Math.round(this._y * s);
100
- f.save(), f.strokeStyle = this._color, f.lineWidth = d, f.setLineDash(It(this._lineStyle, d)), f.beginPath(), f.moveTo(0, S), f.lineTo(u.bitmapSize.width, S), f.stroke(), f.restore();
99
+ const u = c.context, h = c.verticalPixelRatio, f = Math.max(1, Math.round(this._lineWidth * h)), S = Math.round(this._y * h);
100
+ u.save(), u.strokeStyle = this._color, u.lineWidth = f, u.setLineDash(It(this._lineStyle, f)), u.beginPath(), u.moveTo(0, S), u.lineTo(c.bitmapSize.width, S), u.stroke(), u.restore();
101
101
  });
102
102
  }
103
103
  }
@@ -135,8 +135,8 @@ class Bt {
135
135
  lineWidth;
136
136
  lineStyle;
137
137
  _paneViews;
138
- constructor(i, u, f, s, d) {
139
- this.series = i, this.price = u, this.color = f, this.lineWidth = s, this.lineStyle = d, this._paneViews = [new Et(this)];
138
+ constructor(i, c, u, h, f) {
139
+ this.series = i, this.price = c, this.color = u, this.lineWidth = h, this.lineStyle = f, this._paneViews = [new Et(this)];
140
140
  }
141
141
  updateAllViews() {
142
142
  for (const i of this._paneViews) i.update();
@@ -145,26 +145,26 @@ class Bt {
145
145
  return this._paneViews;
146
146
  }
147
147
  }
148
- function Ft(e, i, u) {
149
- const f = e.labelText ?? "", s = e.value, d = s === void 0 ? "" : typeof s == "number" ? i === "$" ? `$${Le(s, void 0, u)}` : i === "%" ? `${Le(s, void 0, u)}%` : Le(
150
- s,
148
+ function Ft(e, i, c) {
149
+ const u = e.labelText ?? "", h = e.value, f = h === void 0 ? "" : typeof h == "number" ? i === "$" ? `$${Le(h, void 0, c)}` : i === "%" ? `${Le(h, void 0, c)}%` : Le(
150
+ h,
151
151
  i !== "none" && i !== "%" && i !== "$" && !_t(i) ? i : void 0,
152
- u
153
- ) : String(s);
154
- return { labelText: f, valueStr: d };
152
+ c
153
+ ) : String(h);
154
+ return { labelText: u, valueStr: f };
155
155
  }
156
156
  const tt = 4;
157
- function zt(e, i, u) {
158
- const f = { left: e, transform: "translateX(-50%)" };
159
- if (i <= 0 || !u || u <= 0)
160
- return f;
161
- const s = u / 2, d = tt + s, S = i - tt - s;
162
- return S < d ? { left: i / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(e, d), S), transform: "translateX(-50%)" };
157
+ function zt(e, i, c) {
158
+ const u = { left: e, transform: "translateX(-50%)" };
159
+ if (i <= 0 || !c || c <= 0)
160
+ return u;
161
+ const h = c / 2, f = tt + h, S = i - tt - h;
162
+ return S < f ? { left: i / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(e, f), S), transform: "translateX(-50%)" };
163
163
  }
164
164
  function At(e, i) {
165
- for (let u = e.length - 1; u >= 0; u--)
166
- if (Number(e[u].time) <= i)
167
- return e[u].value;
165
+ for (let c = e.length - 1; c >= 0; c--)
166
+ if (Number(e[c].time) <= i)
167
+ return e[c].value;
168
168
  return 0;
169
169
  }
170
170
  const Me = [
@@ -286,55 +286,55 @@ const Me = [
286
286
  function ot(e) {
287
287
  if (e < Me.length)
288
288
  return Me[e];
289
- const u = (e - Me.length) * Gt % 360, f = St(u, 70, 50), { topColor: s, bottomColor: d } = ve(f);
290
- return { line: f, top: s, bottom: d };
289
+ const c = (e - Me.length) * Gt % 360, u = St(c, 70, 50), { topColor: h, bottomColor: f } = Ce(u);
290
+ return { line: u, top: h, bottom: f };
291
291
  }
292
292
  function oo({
293
293
  series: e,
294
294
  className: i,
295
- showLegend: u = !1,
296
- onUnselectSeries: f,
297
- xMeasureUnit: s = "time",
298
- yMeasureUnit: d = "token",
295
+ showLegend: c = !1,
296
+ onUnselectSeries: u,
297
+ xMeasureUnit: h = "time",
298
+ yMeasureUnit: f = "token",
299
299
  optionsOverrides: S,
300
- verticalLineOptions: w,
301
- priceLineOptions: k,
302
- zoneOptions: G,
303
- currentValueDecimals: Ce,
304
- useSharedPriceScale: Z = !1,
300
+ verticalLineOptions: P,
301
+ priceLineOptions: I,
302
+ zoneOptions: F,
303
+ currentValueDecimals: se,
304
+ useSharedPriceScale: q = !1,
305
305
  dualYAxis: D = !1,
306
306
  defaultVisiblePriceScaleId: ke = "right",
307
307
  leftPriceScaleTitle: Ie,
308
308
  rightPriceScaleTitle: Xt,
309
309
  showCurrentValue: rt = !0,
310
- graphTitle: ye,
310
+ graphTitle: xe,
311
311
  yScaleMin: De,
312
312
  yScaleMinMultiple: Ee,
313
- visibleTimeFrom: Q,
313
+ visibleTimeFrom: Y,
314
314
  disableZoom: Be = !1,
315
- hideDefaultTooltip: xe = !1
315
+ hideDefaultTooltip: ye = !1
316
316
  }) {
317
- const E = K(null), L = K(/* @__PURE__ */ new Map()), _e = K(!1), Fe = K(!0), ze = K([]), le = K(0), B = K(null), we = K(null), Ae = K(null), P = bt(), se = Ve.useMemo(() => e.flatMap((t) => t.data), [e]), nt = Ve.useMemo(() => {
317
+ const E = K(null), L = K(/* @__PURE__ */ new Map()), _e = K(!1), Fe = K(!0), ze = K([]), ce = K(0), B = K(null), we = K(null), Ae = K(null), N = bt(), ue = Ve.useMemo(() => e.flatMap((t) => t.data), [e]), nt = Ve.useMemo(() => {
318
318
  if (e.length > 0) {
319
319
  const t = e[e.length - 1];
320
320
  if (t.data.length > 0)
321
321
  return t.data[t.data.length - 1];
322
322
  }
323
- }, [e]), [Ge, Pe] = re(() => {
323
+ }, [e]), [Ge, Pe] = ne(() => {
324
324
  if (!nt) return;
325
325
  const t = /* @__PURE__ */ new Map();
326
326
  for (const l of e)
327
327
  l.data.length > 0 && t.set(l.label, l.data[l.data.length - 1]);
328
328
  return t;
329
- }), [We, O] = re(null), [Xe, $e] = re([]), [it, He] = re(0), je = K(/* @__PURE__ */ new Map()), [at, lt] = re({}), [Y, st] = re(0);
330
- A(() => {
329
+ }), [We, J] = ne(null), [Xe, $e] = ne([]), [it, He] = ne(0), je = K(/* @__PURE__ */ new Map()), [at, lt] = ne({}), [U, st] = ne(0);
330
+ G(() => {
331
331
  const t = () => {
332
332
  try {
333
333
  if (B.current && He(B.current.clientWidth), E.current && B.current) {
334
- const a = B.current.clientWidth, c = B.current.clientHeight;
335
- E.current.resize(a, c);
334
+ const a = B.current.clientWidth, s = B.current.clientHeight;
335
+ E.current.resize(a, s);
336
336
  try {
337
- le.current = E.current.paneSize().height;
337
+ ce.current = E.current.paneSize().height;
338
338
  } catch {
339
339
  }
340
340
  }
@@ -344,9 +344,9 @@ function oo({
344
344
  return Ae.current = n, l && n?.observe(l), () => {
345
345
  l && n?.unobserve(l), n?.disconnect(), Ae.current = null;
346
346
  };
347
- }, []), A(() => {
347
+ }, []), G(() => {
348
348
  if (!we.current || _e.current) return;
349
- const t = Je(), l = ne(
349
+ const t = Je(), l = ie(
350
350
  "hsl(var(--muted-foreground))",
351
351
  "rgb(163, 163, 163)"
352
352
  ), n = ht(we.current, {
@@ -358,26 +358,26 @@ function oo({
358
358
  },
359
359
  rightPriceScale: {
360
360
  ...t.rightPriceScale || {},
361
- visible: !P,
361
+ visible: !N,
362
362
  textColor: l
363
363
  },
364
- ...P && {
364
+ ...N && {
365
365
  crosshair: {
366
366
  ...t.crosshair,
367
- mode: gt.Magnet
367
+ mode: dt.Magnet
368
368
  }
369
369
  }
370
370
  });
371
371
  E.current = n, _e.current = !0;
372
372
  try {
373
- le.current = n.paneSize().height;
373
+ ce.current = n.paneSize().height;
374
374
  } catch {
375
- le.current = 0;
375
+ ce.current = 0;
376
376
  }
377
377
  return st((a) => a + 1), () => {
378
378
  n.remove(), E.current = null, _e.current = !1, L.current.clear();
379
379
  };
380
- }, [P]), A(() => {
380
+ }, [N]), G(() => {
381
381
  const t = E.current;
382
382
  t && t.applyOptions(
383
383
  Be ? {
@@ -408,53 +408,53 @@ function oo({
408
408
  }
409
409
  }
410
410
  );
411
- }, [Y, Be]), A(() => {
411
+ }, [U, Be]), G(() => {
412
412
  const t = E.current;
413
413
  !t || !S || t.applyOptions(S);
414
- }, [Y, S]), A(() => {
414
+ }, [U, S]), G(() => {
415
415
  const t = E.current;
416
416
  if (!t || e.length === 0) return;
417
- const n = e.filter((r) => r.data.length > 0).length <= 1 ? De : Ee, a = s === "time" ? Ue(s, se) : Ue(s), c = /* @__PURE__ */ new Map();
417
+ const n = e.filter((r) => r.data.length > 0).length <= 1 ? De : Ee, a = h === "time" ? Ue(h, ue) : Ue(h), s = /* @__PURE__ */ new Map();
418
418
  {
419
419
  let r = 0;
420
420
  for (const o of e)
421
- o.data.length !== 0 && (c.set(
421
+ o.data.length !== 0 && (s.set(
422
422
  o.label,
423
423
  o.priceScaleId ?? (r === 0 ? "left" : "right")
424
424
  ), r++);
425
425
  }
426
- const h = (r, o, g) => {
427
- const { formatter: F, tickmarksFormatter: T, updateVisibleRange: N } = wt(r, o, {
426
+ const d = (r, o, m) => {
427
+ const { formatter: z, tickmarksFormatter: T, updateVisibleRange: V } = wt(r, o, {
428
428
  yScaleMin: n
429
429
  });
430
- return { formatter: F, tickmarksFormatter: T, updateVisibleRange: N, labels: g };
431
- }, m = [];
430
+ return { formatter: z, tickmarksFormatter: T, updateVisibleRange: V, labels: m };
431
+ }, g = [];
432
432
  if (D)
433
433
  for (const r of ["left", "right"]) {
434
- const o = /* @__PURE__ */ new Set(), g = [];
435
- let F = d;
434
+ const o = /* @__PURE__ */ new Set(), m = [];
435
+ let z = f;
436
436
  for (const T of e)
437
- if (T.data.length !== 0 && c.get(T.label) === r) {
438
- o.size === 0 && T.yMeasureUnit && (F = T.yMeasureUnit), o.add(T.label);
439
- for (const N of T.data) g.push(N.value);
437
+ if (T.data.length !== 0 && s.get(T.label) === r) {
438
+ o.size === 0 && T.yMeasureUnit && (z = T.yMeasureUnit), o.add(T.label);
439
+ for (const V of T.data) m.push(V.value);
440
440
  }
441
- o.size > 0 && m.push(h(g, F, o));
441
+ o.size > 0 && g.push(d(m, z, o));
442
442
  }
443
443
  else {
444
- const r = se.map((g) => g.value), o = new Set(
445
- e.filter((g) => g.data.length > 0).map((g) => g.label)
444
+ const r = ue.map((m) => m.value), o = new Set(
445
+ e.filter((m) => m.data.length > 0).map((m) => m.label)
446
446
  );
447
- m.push(h(r, d, o));
447
+ g.push(d(r, f, o));
448
448
  }
449
- ze.current = m;
450
- const y = /* @__PURE__ */ new Map();
451
- for (const r of m)
449
+ ze.current = g;
450
+ const x = /* @__PURE__ */ new Map();
451
+ for (const r of g)
452
452
  for (const o of r.labels)
453
- y.set(o, r);
454
- const x = Je();
453
+ x.set(o, r);
454
+ const y = Je();
455
455
  t.applyOptions({
456
456
  localization: {
457
- ...x.localization || {},
457
+ ...y.localization || {},
458
458
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
459
459
  timeFormatter: (r) => (
460
460
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
@@ -462,14 +462,14 @@ function oo({
462
462
  )
463
463
  },
464
464
  timeScale: {
465
- ...x.timeScale || {},
465
+ ...y.timeScale || {},
466
466
  ...S?.timeScale,
467
467
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
468
468
  tickMarkFormatter: a.tickMarkFormatter,
469
469
  minBarSpacing: 0
470
470
  }
471
471
  });
472
- const v = !D && e.length > 1 && !Z, W = D ? P : e.length > 1 && !Z || P, M = ne(
472
+ const v = !D && e.length > 1 && !q, W = D ? N : e.length > 1 && !q || N, M = ie(
473
473
  "hsl(var(--muted-foreground))",
474
474
  "rgb(163, 163, 163)"
475
475
  );
@@ -478,88 +478,88 @@ function oo({
478
478
  defaultVisiblePriceScaleId: ke
479
479
  },
480
480
  leftPriceScale: {
481
- ...x.leftPriceScale || {},
481
+ ...y.leftPriceScale || {},
482
482
  ...S?.leftPriceScale,
483
- visible: D && !P,
483
+ visible: D && !N,
484
484
  textColor: M,
485
485
  ...D && Ie && {
486
486
  // lightweight-charts uses scale margins; title shown via localization if needed
487
487
  }
488
488
  },
489
489
  rightPriceScale: {
490
- ...x.rightPriceScale || {},
490
+ ...y.rightPriceScale || {},
491
491
  ...S?.rightPriceScale,
492
- visible: D ? !P : !W,
492
+ visible: D ? !N : !W,
493
493
  textColor: M
494
494
  }
495
495
  });
496
- const U = new Set(L.current.keys()), X = new Set(e.map(ie));
497
- for (const r of U)
496
+ const ee = new Set(L.current.keys()), X = new Set(e.map(ae));
497
+ for (const r of ee)
498
498
  if (!X.has(r)) {
499
499
  const o = L.current.get(r);
500
500
  o && (t.removeSeries(o), L.current.delete(r));
501
501
  }
502
- const p = vt(), I = [];
502
+ const p = vt(), k = [];
503
503
  let R = 0;
504
504
  const $ = e.find((r) => r.data.length > 0), C = /* @__PURE__ */ new Map();
505
- if (k && k.length > 0)
506
- for (const r of k) {
505
+ if (I && I.length > 0)
506
+ for (const r of I) {
507
507
  if (!Number.isFinite(r.price)) continue;
508
508
  const o = r.seriesLabel ?? $?.label;
509
509
  if (!o) continue;
510
- const g = C.get(o) ?? [];
511
- g.push(r.price), C.set(o, g);
510
+ const m = C.get(o) ?? [];
511
+ m.push(r.price), C.set(o, m);
512
512
  }
513
- if (G && G.length > 0)
514
- for (const r of G) {
513
+ if (F && F.length > 0)
514
+ for (const r of F) {
515
515
  const o = r.seriesLabel ?? $?.label;
516
516
  if (!o) continue;
517
- const g = C.get(o) ?? [];
518
- Number.isFinite(r.priceTop) && g.push(r.priceTop), Number.isFinite(r.priceBottom) && g.push(r.priceBottom), C.set(o, g);
517
+ const m = C.get(o) ?? [];
518
+ Number.isFinite(r.priceTop) && m.push(r.priceTop), Number.isFinite(r.priceBottom) && m.push(r.priceBottom), C.set(o, m);
519
519
  }
520
520
  for (let r = 0; r < e.length; r++) {
521
- const o = e[r], g = ie(o), F = ot(r), T = o.lineColor ?? o.color ?? F.line;
522
- let N, J;
521
+ const o = e[r], m = ae(o), z = ot(r), T = o.lineColor ?? o.color ?? z.line;
522
+ let V, Q;
523
523
  if (o.lineColor ?? o.color)
524
524
  if (o.topColor && o.bottomColor)
525
- N = o.topColor, J = o.bottomColor;
525
+ V = o.topColor, Q = o.bottomColor;
526
526
  else if (o.topColor) {
527
- const b = ve(T);
528
- N = o.topColor, J = b.bottomColor;
527
+ const b = Ce(T);
528
+ V = o.topColor, Q = b.bottomColor;
529
529
  } else if (o.bottomColor)
530
- N = ve(T).topColor, J = o.bottomColor;
530
+ V = Ce(T).topColor, Q = o.bottomColor;
531
531
  else {
532
- const b = ve(T);
533
- N = b.topColor, J = b.bottomColor;
532
+ const b = Ce(T);
533
+ V = b.topColor, Q = b.bottomColor;
534
534
  }
535
535
  else
536
- N = o.topColor || F.top, J = o.bottomColor || F.bottom;
536
+ V = o.topColor || z.top, Q = o.bottomColor || z.bottom;
537
537
  if (o.data.length === 0) {
538
- const b = L.current.get(g);
539
- b && (t.removeSeries(b), L.current.delete(g));
538
+ const b = L.current.get(m);
539
+ b && (t.removeSeries(b), L.current.delete(m));
540
540
  continue;
541
541
  }
542
- const pe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, ce = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, ue = pe < 0, q = o.data.some((b) => b.value === 0), de = !ue && q, fe = Nt(ce - pe), he = D ? o.priceScaleId ?? (R === 0 ? "left" : "right") : Z || !v || R === 0 ? "right" : `scale-${R}`;
543
- v && I.push({
544
- priceScaleId: he || "right",
542
+ const pe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, fe = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, he = pe < 0, O = o.data.some((b) => b.value === 0), be = !he && O, de = Tt(fe - pe), me = D ? o.priceScaleId ?? (R === 0 ? "left" : "right") : q || !v || R === 0 ? "right" : `scale-${R}`;
543
+ v && k.push({
544
+ priceScaleId: me || "right",
545
545
  seriesIndex: R
546
546
  });
547
- const Re = (Z || !v) && n !== void 0 && typeof n == "number", ct = C.get(o.label) ?? [], ut = (b) => {
547
+ const Ne = (q || !v) && n !== void 0 && typeof n == "number", ct = C.get(o.label) ?? [], ut = (b) => {
548
548
  const _ = b();
549
549
  if (_?.priceRange) {
550
- Re && (_.priceRange.minValue = n);
550
+ Ne && (_.priceRange.minValue = n);
551
551
  for (const j of ct)
552
552
  j < _.priceRange.minValue && (_.priceRange.minValue = j), j > _.priceRange.maxValue && (_.priceRange.maxValue = j);
553
- const oe = Re ? n : de && _.priceRange.minValue >= 0 ? 0 : void 0, be = le.current > 0 ? le.current : B.current?.clientHeight ?? 0;
554
- if (be > 0) {
553
+ const re = Ne ? n : be && _.priceRange.minValue >= 0 ? 0 : void 0, Se = ce.current > 0 ? ce.current : B.current?.clientHeight ?? 0;
554
+ if (Se > 0) {
555
555
  const j = Vt({
556
556
  min: _.priceRange.minValue,
557
557
  max: _.priceRange.maxValue,
558
- floor: oe,
559
- scaleHeightPx: be,
560
- fontSizePx: yt,
561
- tickMarkDensity: Se,
562
- minMove: fe,
558
+ floor: re,
559
+ scaleHeightPx: Se,
560
+ fontSizePx: xt,
561
+ tickMarkDensity: ve,
562
+ minMove: de,
563
563
  edgePaddingPx: Qe,
564
564
  edgePaddingTopPx: Ye
565
565
  });
@@ -571,60 +571,60 @@ function oo({
571
571
  };
572
572
  }
573
573
  return _;
574
- }, Ze = y.get(o.label) ?? m[0], qe = Ze.formatter, ft = Ze.tickmarksFormatter, Te = {
574
+ }, Ze = x.get(o.label) ?? g[0], qe = Ze.formatter, ft = Ze.tickmarksFormatter, Re = {
575
575
  lineColor: T,
576
- topColor: N,
577
- bottomColor: J,
578
- priceScaleId: he,
576
+ topColor: V,
577
+ bottomColor: Q,
578
+ priceScaleId: me,
579
579
  ...o.seriesType === "line" && {
580
- lineStyle: o.lineStyle ?? ae.Solid
580
+ lineStyle: o.lineStyle ?? le.Solid
581
581
  },
582
582
  priceFormat: {
583
583
  type: "custom",
584
- minMove: fe,
585
- formatter: Re && typeof n == "number" ? (b) => qe(
584
+ minMove: de,
585
+ formatter: Ne && typeof n == "number" ? (b) => qe(
586
586
  b < n ? n : b
587
587
  ) : qe,
588
588
  tickmarksFormatter: ft
589
589
  },
590
590
  autoscaleInfoProvider: ut
591
591
  }, Oe = o.seriesType === "line";
592
- let z = L.current.get(g);
593
- const te = o.data.map((b) => ({
592
+ let A = L.current.get(m);
593
+ const oe = o.data.map((b) => ({
594
594
  ...b,
595
595
  time: b.time
596
596
  }));
597
- if (Q !== void 0 && te.length > 0 && Number(te[0].time) > Q) {
598
- const b = Number(te[0].time), _ = b - Q, oe = 86400, be = _ > 180 * oe ? 7 * oe : _ > 30 * oe ? oe : 6 * 3600, j = [];
599
- for (let Ne = Q; Ne < b; Ne += be)
600
- j.push({ time: Ne });
601
- te.unshift(...j);
597
+ if (Y !== void 0 && oe.length > 0 && Number(oe[0].time) > Y) {
598
+ const b = Number(oe[0].time), _ = b - Y, re = 86400, Se = _ > 180 * re ? 7 * re : _ > 30 * re ? re : 6 * 3600, j = [];
599
+ for (let Te = Y; Te < b; Te += Se)
600
+ j.push({ time: Te });
601
+ oe.unshift(...j);
602
602
  }
603
- z && z.seriesType() !== (Oe ? "Line" : "Area") && (t.removeSeries(z), L.current.delete(g), z = void 0), z ? (z.applyOptions(Te), z.setData(te)) : (Oe ? z = t.addSeries(mt, {
603
+ A && A.seriesType() !== (Oe ? "Line" : "Area") && (t.removeSeries(A), L.current.delete(m), A = void 0), A ? (A.applyOptions(Re), A.setData(oe)) : (Oe ? A = t.addSeries(mt, {
604
604
  ...p,
605
- ...Te
606
- }) : z = t.addSeries(pt, {
605
+ ...Re
606
+ }) : A = t.addSeries(gt, {
607
607
  ...p,
608
- ...Te
609
- }), z.setData(te), L.current.set(g, z)), R++;
608
+ ...Re
609
+ }), A.setData(oe), L.current.set(m, A)), R++;
610
610
  }
611
611
  if (D)
612
612
  try {
613
- const r = t.priceScale("left"), o = t.priceScale("right"), g = {
614
- visible: !P,
613
+ const r = t.priceScale("left"), o = t.priceScale("right"), m = {
614
+ visible: !N,
615
615
  autoScale: !0,
616
616
  scaleMargins: { top: 0, bottom: 0 },
617
617
  alignLabels: !0,
618
618
  entireTextOnly: !1,
619
- tickMarkDensity: Se,
619
+ tickMarkDensity: ve,
620
620
  textColor: M,
621
621
  ...S?.rightPriceScale
622
622
  };
623
- r?.applyOptions(g), o?.applyOptions(g);
623
+ r?.applyOptions(m), o?.applyOptions(m);
624
624
  } catch {
625
625
  }
626
- else if (v && I.length > 0)
627
- for (const r of I)
626
+ else if (v && k.length > 0)
627
+ for (const r of k)
628
628
  try {
629
629
  const o = t.priceScale(r.priceScaleId);
630
630
  o && o.applyOptions({
@@ -636,7 +636,7 @@ function oo({
636
636
  },
637
637
  alignLabels: !0,
638
638
  entireTextOnly: !1,
639
- tickMarkDensity: Se,
639
+ tickMarkDensity: ve,
640
640
  textColor: M
641
641
  });
642
642
  } catch (o) {
@@ -649,7 +649,7 @@ function oo({
649
649
  try {
650
650
  const r = t.priceScale("right");
651
651
  r && r.applyOptions({
652
- visible: !P,
652
+ visible: !N,
653
653
  autoScale: !0,
654
654
  scaleMargins: {
655
655
  top: 0,
@@ -657,47 +657,47 @@ function oo({
657
657
  },
658
658
  alignLabels: !0,
659
659
  entireTextOnly: !1,
660
- tickMarkDensity: Se,
660
+ tickMarkDensity: ve,
661
661
  textColor: M,
662
662
  ...S?.rightPriceScale
663
663
  });
664
664
  } catch {
665
665
  }
666
- if (n !== void 0 && !P && (Z || !v) && t.applyOptions({
666
+ if (n !== void 0 && !N && (q || !v) && t.applyOptions({
667
667
  handleScroll: {
668
668
  vertTouchDrag: !1
669
669
  }
670
- }), se.length > 0) {
671
- const r = se.map((o) => Number(o.time)).filter((o) => Number.isFinite(o));
670
+ }), ue.length > 0) {
671
+ const r = ue.map((o) => Number(o.time)).filter((o) => Number.isFinite(o));
672
672
  if (r.length > 0) {
673
- const o = Math.min(...r), g = Q !== void 0 ? Math.min(Q, o) : o, F = Math.max(...r);
674
- if (Number(g) <= Number(F)) {
673
+ const o = Math.min(...r), m = Y !== void 0 ? Math.min(Y, o) : o, z = Math.max(...r);
674
+ if (Number(m) <= Number(z)) {
675
675
  const T = () => {
676
- const N = t.timeScale();
677
- if (s !== "time") {
678
- N.applyOptions({
676
+ const V = t.timeScale();
677
+ if (h !== "time") {
678
+ V.applyOptions({
679
679
  fixLeftEdge: !0,
680
680
  fixRightEdge: !0
681
681
  });
682
682
  return;
683
683
  }
684
- const J = D && !P, pe = D ? !P : !W, ce = !J, ue = !pe;
685
- if (N.applyOptions({
686
- fixLeftEdge: !ce,
687
- fixRightEdge: !ue
688
- }), !ce && !ue) return;
689
- const q = N.getVisibleLogicalRange(), de = N.width();
690
- if (!q || !(de > 0)) return;
691
- const fe = q.to - q.from;
692
- if (!(fe > 0)) return;
693
- const he = xt * fe / de;
694
- N.setVisibleLogicalRange({
695
- from: ce ? q.from - he : q.from,
696
- to: ue ? q.to + he : q.to
684
+ const Q = D && !N, pe = D ? !N : !W, fe = !Q, he = !pe;
685
+ if (V.applyOptions({
686
+ fixLeftEdge: !fe,
687
+ fixRightEdge: !he
688
+ }), !fe && !he) return;
689
+ const O = V.getVisibleLogicalRange(), be = V.width();
690
+ if (!O || !(be > 0)) return;
691
+ const de = O.to - O.from;
692
+ if (!(de > 0)) return;
693
+ const me = yt * de / be;
694
+ V.setVisibleLogicalRange({
695
+ from: fe ? O.from - me : O.from,
696
+ to: he ? O.to + me : O.to
697
697
  });
698
698
  };
699
699
  try {
700
- t.timeScale().setVisibleRange({ from: g, to: F }), T();
700
+ t.timeScale().setVisibleRange({ from: m, to: z }), T();
701
701
  } catch {
702
702
  try {
703
703
  t.timeScale().fitContent(), T();
@@ -713,116 +713,116 @@ function oo({
713
713
  r.data.length > 0 && H.set(r.label, r.data[r.data.length - 1]);
714
714
  Pe(H.size > 0 ? H : void 0);
715
715
  }, [
716
- Y,
716
+ U,
717
717
  e,
718
- se,
719
- s,
720
- d,
721
- P,
722
- Z,
718
+ ue,
719
+ h,
720
+ f,
721
+ N,
722
+ q,
723
723
  D,
724
724
  ke,
725
725
  Ie,
726
726
  De,
727
727
  Ee,
728
- Q,
729
- k,
730
- G,
728
+ Y,
729
+ I,
730
+ F,
731
731
  S
732
- ]), A(() => {
732
+ ]), G(() => {
733
733
  const t = E.current;
734
734
  if (!t || e.length === 0) return;
735
735
  const l = e.length === 1;
736
736
  let n;
737
- for (const c of e)
738
- if (c.data.length > 0) {
739
- n = c.data[c.data.length - 1].time;
737
+ for (const s of e)
738
+ if (s.data.length > 0) {
739
+ n = s.data[s.data.length - 1].time;
740
740
  break;
741
741
  }
742
742
  if (!n) return;
743
- const a = (c) => {
744
- const { time: h = n, seriesData: m, point: y } = c || {}, x = e[0], v = x ? L.current.get(ie(x)) : void 0;
745
- if (!y || !h) {
743
+ const a = (s) => {
744
+ const { time: d = n, seriesData: g, point: x } = s || {}, y = e[0], v = y ? L.current.get(ae(y)) : void 0;
745
+ if (!x || !d) {
746
746
  const X = /* @__PURE__ */ new Map();
747
747
  for (const p of e)
748
748
  p.data.length > 0 && X.set(p.label, p.data[p.data.length - 1]);
749
- if (Pe(X.size > 0 ? X : void 0), l || Z || xe)
750
- O(null);
749
+ if (Pe(X.size > 0 ? X : void 0), l || q || ye)
750
+ J(null);
751
751
  else if (v && n) {
752
752
  const p = e[0];
753
753
  if (p && p.data.length > 0) {
754
754
  const R = t.timeScale().timeToCoordinate(n), $ = p.data[p.data.length - 1].value, C = v.priceToCoordinate($);
755
- R !== null && C !== null && O({ x: R, y: C });
755
+ R !== null && C !== null && J({ x: R, y: C });
756
756
  }
757
757
  }
758
758
  return;
759
759
  }
760
760
  const W = /* @__PURE__ */ new Map();
761
- let M, U = v;
761
+ let M, ee = v;
762
762
  for (let X = 0; X < e.length; X++) {
763
- const p = e[X], I = L.current.get(ie(p));
764
- if (!I) continue;
765
- const R = m?.get(I), $ = R && "value" in R ? R.value : void 0;
763
+ const p = e[X], k = L.current.get(ae(p));
764
+ if (!k) continue;
765
+ const R = g?.get(k), $ = R && "value" in R ? R.value : void 0;
766
766
  let C;
767
767
  if ($ !== void 0)
768
768
  C = $;
769
769
  else if (l) {
770
- const H = Number(h), r = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
770
+ const H = Number(d), r = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
771
771
  H < r ? C = Number.NaN : C = p.data[p.data.length - 1]?.value ?? 0;
772
772
  } else {
773
773
  const H = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
774
- if (Number(h) < H) continue;
775
- C = At(p.data, Number(h));
774
+ if (Number(d) < H) continue;
775
+ C = At(p.data, Number(d));
776
776
  }
777
- Number.isNaN(C) || (M === void 0 && (M = C, U = I), W.set(p.label, { value: C, time: h }));
777
+ Number.isNaN(C) || (M === void 0 && (M = C, ee = k), W.set(p.label, { value: C, time: d }));
778
778
  }
779
- if (Pe(W), M !== void 0 && U) {
780
- const p = t.timeScale().timeToCoordinate(h), I = U.priceToCoordinate(M);
781
- if (p !== null && I !== null) {
779
+ if (Pe(W), M !== void 0 && ee) {
780
+ const p = t.timeScale().timeToCoordinate(d), k = ee.priceToCoordinate(M);
781
+ if (p !== null && k !== null) {
782
782
  const R = B.current;
783
783
  if (R) {
784
784
  const $ = R.querySelector(
785
785
  ".LightweightChart"
786
786
  );
787
787
  if ($) {
788
- const C = $.getBoundingClientRect(), H = R.getBoundingClientRect(), r = p + (C.left - H.left), o = I + (C.top - H.top);
789
- O({ x: r, y: o });
788
+ const C = $.getBoundingClientRect(), H = R.getBoundingClientRect(), r = p + (C.left - H.left), o = k + (C.top - H.top);
789
+ J({ x: r, y: o });
790
790
  } else
791
- O({ x: p, y: I });
791
+ J({ x: p, y: k });
792
792
  } else
793
- O({ x: p, y: I });
793
+ J({ x: p, y: k });
794
794
  } else
795
- O(null);
795
+ J(null);
796
796
  } else
797
- O(null);
797
+ J(null);
798
798
  };
799
- return t.subscribeCrosshairMove(a), P && t.subscribeClick(a), !l && !Z && !xe && requestAnimationFrame(() => {
800
- const c = e[0], h = c ? L.current.get(ie(c)) : void 0;
801
- if (h && n && c.data.length > 0) {
802
- const y = t.timeScale().timeToCoordinate(n), x = c.data[c.data.length - 1].value, v = h.priceToCoordinate(x);
803
- y !== null && v !== null && O({ x: y, y: v });
799
+ return t.subscribeCrosshairMove(a), N && t.subscribeClick(a), !l && !q && !ye && requestAnimationFrame(() => {
800
+ const s = e[0], d = s ? L.current.get(ae(s)) : void 0;
801
+ if (d && n && s.data.length > 0) {
802
+ const x = t.timeScale().timeToCoordinate(n), y = s.data[s.data.length - 1].value, v = d.priceToCoordinate(y);
803
+ x !== null && v !== null && J({ x, y: v });
804
804
  }
805
805
  }), () => {
806
- t.unsubscribeCrosshairMove(a), P && t.unsubscribeClick(a);
806
+ t.unsubscribeCrosshairMove(a), N && t.unsubscribeClick(a);
807
807
  };
808
- }, [e, Z, P, xe]), A(() => {
808
+ }, [e, q, N, ye]), G(() => {
809
809
  const t = E.current;
810
810
  if (!t || e.length === 0) return;
811
811
  const l = t.timeScale(), n = () => {
812
812
  const a = ze.current;
813
813
  if (a.length === 0) return;
814
- const c = l.getVisibleRange();
815
- if (!c) return;
816
- const h = Number(c.from), m = Number(c.to);
817
- for (const y of a) {
818
- const x = [];
814
+ const s = l.getVisibleRange();
815
+ if (!s) return;
816
+ const d = Number(s.from), g = Number(s.to);
817
+ for (const x of a) {
818
+ const y = [];
819
819
  for (const v of e)
820
- if (y.labels.has(v.label))
820
+ if (x.labels.has(v.label))
821
821
  for (const W of v.data) {
822
822
  const M = Number(W.time);
823
- M >= h && M <= m && x.push(W.value);
823
+ M >= d && M <= g && y.push(W.value);
824
824
  }
825
- x.length > 0 && y.updateVisibleRange(x);
825
+ y.length > 0 && x.updateVisibleRange(y);
826
826
  }
827
827
  };
828
828
  return l.subscribeVisibleLogicalRangeChange(n), () => {
@@ -830,62 +830,62 @@ function oo({
830
830
  n
831
831
  );
832
832
  };
833
- }, [e]), A(() => {
833
+ }, [e]), G(() => {
834
834
  const t = E.current, l = Array.from(L.current.values()), n = [];
835
- if (t && l.length > 0 && w) {
836
- const a = Ct(), c = l[0];
837
- for (const h of w) {
838
- const m = {
835
+ if (t && l.length > 0 && P) {
836
+ const a = Ct(), s = l[0];
837
+ for (const d of P) {
838
+ const g = {
839
839
  ...a,
840
- ...h.options || {}
840
+ ...d.options || {}
841
841
  };
842
- m.color && (m.color = ne(m.color, m.color));
843
- const y = new Tt(t, c, h.xCoordinate, m);
844
- c.attachPrimitive(y), n.push(y);
842
+ g.color && (g.color = ie(g.color, g.color));
843
+ const x = new Rt(t, s, d.xCoordinate, g);
844
+ s.attachPrimitive(x), n.push(x);
845
845
  }
846
846
  }
847
847
  return () => {
848
848
  if (l.length > 0) {
849
849
  const a = l[0];
850
- for (const c of n)
850
+ for (const s of n)
851
851
  try {
852
- a.detachPrimitive(c);
852
+ a.detachPrimitive(s);
853
853
  } catch {
854
854
  }
855
855
  }
856
856
  };
857
- }, [w, e, Y]), A(() => {
857
+ }, [P, e, U]), G(() => {
858
858
  const t = [], l = [];
859
- if (k && k.length > 0) {
860
- const n = ne(
859
+ if (I && I.length > 0) {
860
+ const n = ie(
861
861
  "hsl(var(--destructive))",
862
862
  "rgb(239, 68, 68)"
863
863
  );
864
- for (const a of k) {
864
+ for (const a of I) {
865
865
  if (!Number.isFinite(a.price)) continue;
866
- const c = et(
866
+ const s = et(
867
867
  L.current,
868
868
  e,
869
869
  a.seriesLabel
870
870
  );
871
- if (!c) continue;
872
- const h = a.color ? ne(a.color, a.color) : n, m = a.lineWidth ?? 1, y = a.lineStyle ?? ae.Dashed, x = c.createPriceLine({
871
+ if (!s) continue;
872
+ const d = a.color ? ie(a.color, a.color) : n, g = a.lineWidth ?? 1, x = a.lineStyle ?? le.Dashed, y = s.createPriceLine({
873
873
  price: a.price,
874
- color: h,
875
- lineWidth: m,
876
- lineStyle: y,
874
+ color: d,
875
+ lineWidth: g,
876
+ lineStyle: x,
877
877
  axisLabelVisible: a.axisLabelVisible ?? !0,
878
878
  title: a.title ?? ""
879
879
  });
880
- t.push({ series: c, line: x });
880
+ t.push({ series: s, line: y });
881
881
  const v = new Bt(
882
- c,
882
+ s,
883
883
  a.price,
884
- h,
885
- m,
886
- y
884
+ d,
885
+ g,
886
+ x
887
887
  );
888
- c.attachPrimitive(v), l.push({ series: c, primitive: v });
888
+ s.attachPrimitive(v), l.push({ series: s, primitive: v });
889
889
  }
890
890
  }
891
891
  return () => {
@@ -900,24 +900,24 @@ function oo({
900
900
  } catch {
901
901
  }
902
902
  };
903
- }, [k, e, Y]), A(() => {
903
+ }, [I, e, U]), G(() => {
904
904
  const t = [];
905
- if (G && G.length > 0) {
905
+ if (F && F.length > 0) {
906
906
  const l = "rgba(239, 68, 68, 0.12)";
907
- for (const n of G) {
907
+ for (const n of F) {
908
908
  const a = et(
909
909
  L.current,
910
910
  e,
911
911
  n.seriesLabel
912
912
  );
913
913
  if (!a) continue;
914
- const c = n.color ? ne(n.color, l) : l, h = new kt(
914
+ const s = n.color ? ie(n.color, l) : l, d = new kt(
915
915
  a,
916
916
  n.priceTop,
917
917
  n.priceBottom,
918
- c
918
+ s
919
919
  );
920
- a.attachPrimitive(h), t.push({ series: a, zone: h });
920
+ a.attachPrimitive(d), t.push({ series: a, zone: d });
921
921
  }
922
922
  }
923
923
  return () => {
@@ -927,15 +927,15 @@ function oo({
927
927
  } catch {
928
928
  }
929
929
  };
930
- }, [G, e, Y]), A(() => {
930
+ }, [F, e, U]), G(() => {
931
931
  const t = E.current;
932
- if (!t || !w?.length) {
932
+ if (!t || !P?.length) {
933
933
  $e([]);
934
934
  return;
935
935
  }
936
936
  const l = () => {
937
- const c = t.timeScale(), h = w.map((m) => c.timeToCoordinate(m.xCoordinate) ?? null);
938
- $e(h), B.current && He(B.current.clientWidth);
937
+ const s = t.timeScale(), d = P.map((g) => s.timeToCoordinate(g.xCoordinate) ?? null);
938
+ $e(d), B.current && He(B.current.clientWidth);
939
939
  };
940
940
  l();
941
941
  const n = t.timeScale(), a = () => {
@@ -944,99 +944,99 @@ function oo({
944
944
  return n.subscribeVisibleLogicalRangeChange(a), () => {
945
945
  n.unsubscribeVisibleLogicalRangeChange(a);
946
946
  };
947
- }, [w, e, Y]), dt(() => {
947
+ }, [P, e, U]), pt(() => {
948
948
  lt((t) => {
949
949
  const l = {};
950
950
  let n = !1;
951
- for (const [a, c] of je.current) {
952
- if (!c) continue;
953
- const h = c.offsetWidth;
954
- l[a] = h, t[a] !== h && (n = !0);
951
+ for (const [a, s] of je.current) {
952
+ if (!s) continue;
953
+ const d = s.offsetWidth;
954
+ l[a] = d, t[a] !== d && (n = !0);
955
955
  }
956
956
  return Object.keys(t).length !== Object.keys(l).length && (n = !0), n ? l : t;
957
957
  });
958
958
  });
959
- const me = e.length === 1, Ke = Ve.useMemo(() => {
960
- if (me && e.length > 0) {
959
+ const ge = e.length === 1, Ke = Ve.useMemo(() => {
960
+ if (ge && e.length > 0) {
961
961
  const t = e[0];
962
962
  if (t.data.length > 0)
963
963
  return t.data[t.data.length - 1];
964
964
  }
965
- }, [me, e]);
966
- return /* @__PURE__ */ ge(
965
+ }, [ge, e]);
966
+ return /* @__PURE__ */ te(
967
967
  "div",
968
968
  {
969
969
  ref: B,
970
- className: ee(
970
+ className: Z(
971
971
  "relative z-[1] w-full h-full overflow-hidden p-0",
972
972
  i
973
973
  ),
974
974
  children: [
975
- ye != null && ye !== !1 && me ? /* @__PURE__ */ V("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ V("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: ye }) }) : rt && me && Ke && /* @__PURE__ */ V(
975
+ xe != null && xe !== !1 && ge ? /* @__PURE__ */ w("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ w("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: xe }) }) : rt && ge && Ke && /* @__PURE__ */ w(
976
976
  Pt,
977
977
  {
978
978
  point: Ke,
979
- xMeasureUnit: s,
980
- yMeasureUnit: d,
981
- decimals: Ce
979
+ xMeasureUnit: h,
980
+ yMeasureUnit: f,
981
+ decimals: se
982
982
  }
983
983
  ),
984
- Ge && We && /* @__PURE__ */ V(
985
- Rt,
984
+ Ge && We && /* @__PURE__ */ w(
985
+ Nt,
986
986
  {
987
987
  points: Ge,
988
- xMeasureUnit: s,
989
- yMeasureUnit: d,
988
+ xMeasureUnit: h,
989
+ yMeasureUnit: f,
990
990
  series: e,
991
991
  position: We,
992
992
  containerRef: B,
993
- decimals: Ce
993
+ decimals: se
994
994
  }
995
995
  ),
996
- u && /* @__PURE__ */ V(Wt, { series: e, onUnselect: f }),
997
- w && w.length > 0 && Xe.length === w.length && /* @__PURE__ */ V(
996
+ c && /* @__PURE__ */ w(Wt, { series: e, onUnselect: u }),
997
+ P && P.length > 0 && Xe.length === P.length && /* @__PURE__ */ w(
998
998
  "div",
999
999
  {
1000
1000
  className: "absolute inset-0 z-[5] pointer-events-none",
1001
1001
  "aria-hidden": !0,
1002
- children: w.map((t, l) => {
1002
+ children: P.map((t, l) => {
1003
1003
  const n = Xe[l], a = t.options ?? {};
1004
1004
  if (n === null) return null;
1005
- const { labelText: c, valueStr: h } = Ft(
1005
+ const { labelText: s, valueStr: d } = Ft(
1006
1006
  a,
1007
- d,
1008
- Ce
1009
- ), m = a.tooltipText ?? "";
1010
- if (!(c || h || m)) return null;
1011
- const x = a.labelBackgroundColor ?? a.color ?? "hsl(var(--background))", v = a.labelTextColor ?? "hsl(var(--foreground))", W = `${String(t.xCoordinate)}-${c}-${m}`, M = zt(
1007
+ f,
1008
+ se
1009
+ ), g = a.tooltipText ?? "";
1010
+ if (!(s || d || g)) return null;
1011
+ const y = a.labelBackgroundColor ?? a.color ?? "hsl(var(--background))", v = a.labelTextColor ?? "hsl(var(--foreground))", W = `${String(t.xCoordinate)}-${s}-${g}`, M = zt(
1012
1012
  n,
1013
1013
  it,
1014
1014
  at[l]
1015
1015
  );
1016
- return /* @__PURE__ */ ge(
1016
+ return /* @__PURE__ */ te(
1017
1017
  "div",
1018
1018
  {
1019
- ref: (U) => {
1020
- je.current.set(l, U);
1019
+ ref: (ee) => {
1020
+ je.current.set(l, ee);
1021
1021
  },
1022
- className: ee(
1022
+ className: Z(
1023
1023
  "group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
1024
- m && "pointer-events-auto cursor-default"
1024
+ g && "pointer-events-auto cursor-default"
1025
1025
  ),
1026
1026
  style: {
1027
1027
  ...M,
1028
- backgroundColor: x,
1028
+ backgroundColor: y,
1029
1029
  color: v
1030
1030
  },
1031
1031
  children: [
1032
- c && /* @__PURE__ */ V("span", { className: "block", children: c }),
1033
- h && /* @__PURE__ */ V("span", { className: ee("block", c && "mt-0.5"), children: h }),
1034
- m && /* @__PURE__ */ V(
1032
+ s && /* @__PURE__ */ w("span", { className: "block", children: s }),
1033
+ d && /* @__PURE__ */ w("span", { className: Z("block", s && "mt-0.5"), children: d }),
1034
+ g && /* @__PURE__ */ w(
1035
1035
  "span",
1036
1036
  {
1037
1037
  className: "pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",
1038
1038
  role: "tooltip",
1039
- children: m
1039
+ children: g
1040
1040
  }
1041
1041
  )
1042
1042
  ]
@@ -1046,7 +1046,7 @@ function oo({
1046
1046
  })
1047
1047
  }
1048
1048
  ),
1049
- /* @__PURE__ */ V(
1049
+ /* @__PURE__ */ w(
1050
1050
  "div",
1051
1051
  {
1052
1052
  ref: we,
@@ -1059,87 +1059,119 @@ function oo({
1059
1059
  }
1060
1060
  function Wt({
1061
1061
  series: e,
1062
- onUnselect: i,
1062
+ markers: i,
1063
+ onUnselect: c,
1063
1064
  inline: u = !1
1064
1065
  }) {
1065
- const f = e.every((s) => s.data.length === 0);
1066
- return /* @__PURE__ */ V(
1066
+ const h = e.every((f) => f.data.length === 0);
1067
+ return /* @__PURE__ */ te(
1067
1068
  "div",
1068
1069
  {
1069
- className: ee(
1070
+ className: Z(
1070
1071
  "flex flex-wrap",
1071
1072
  u ? "items-center justify-center gap-6" : "absolute top-0 left-2 z-[10] gap-2"
1072
1073
  ),
1073
- children: e.map((s, d) => {
1074
- const S = ot(d), w = (s.lineColor ?? s.color) || S.line, k = !f && s.data.length === 0;
1075
- return /* @__PURE__ */ ge(
1074
+ children: [
1075
+ e.map((f, S) => {
1076
+ const P = ot(S), I = (f.lineColor ?? f.color) || P.line, F = !h && f.data.length === 0;
1077
+ return /* @__PURE__ */ te(
1078
+ "div",
1079
+ {
1080
+ className: Z(
1081
+ "flex items-center gap-1.5",
1082
+ !u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
1083
+ F && "opacity-50"
1084
+ ),
1085
+ children: [
1086
+ /* @__PURE__ */ w(
1087
+ "div",
1088
+ {
1089
+ className: Z(
1090
+ u ? "size-2 rounded-full" : "h-3 w-3 rounded-sm"
1091
+ ),
1092
+ style: { backgroundColor: I }
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ te(
1096
+ "span",
1097
+ {
1098
+ className: Z(
1099
+ "font-medium text-foreground",
1100
+ u ? "text-sm" : "text-[10px] sm:text-xs"
1101
+ ),
1102
+ children: [
1103
+ f.label,
1104
+ F && " (no data)"
1105
+ ]
1106
+ }
1107
+ ),
1108
+ c && /* @__PURE__ */ w(
1109
+ "button",
1110
+ {
1111
+ type: "button",
1112
+ onClick: (se) => {
1113
+ se.stopPropagation(), c(f.label);
1114
+ },
1115
+ className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
1116
+ "aria-label": `Remove ${f.label}`,
1117
+ children: /* @__PURE__ */ te(
1118
+ "svg",
1119
+ {
1120
+ xmlns: "http://www.w3.org/2000/svg",
1121
+ width: "12",
1122
+ height: "12",
1123
+ viewBox: "0 0 24 24",
1124
+ fill: "none",
1125
+ stroke: "currentColor",
1126
+ strokeWidth: "2",
1127
+ strokeLinecap: "round",
1128
+ strokeLinejoin: "round",
1129
+ className: "text-muted-foreground hover:text-foreground",
1130
+ "aria-hidden": "true",
1131
+ children: [
1132
+ /* @__PURE__ */ w("title", { children: "Close" }),
1133
+ /* @__PURE__ */ w("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1134
+ /* @__PURE__ */ w("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1135
+ ]
1136
+ }
1137
+ )
1138
+ }
1139
+ )
1140
+ ]
1141
+ },
1142
+ f.id ?? f.label
1143
+ );
1144
+ }),
1145
+ i?.map((f) => /* @__PURE__ */ te(
1076
1146
  "div",
1077
1147
  {
1078
- className: ee(
1148
+ className: Z(
1079
1149
  "flex items-center gap-1.5",
1080
- !u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
1081
- k && "opacity-50"
1150
+ !u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"
1082
1151
  ),
1083
1152
  children: [
1084
- /* @__PURE__ */ V(
1153
+ /* @__PURE__ */ w(
1085
1154
  "div",
1086
1155
  {
1087
- className: ee(
1088
- u ? "size-2 rounded-full" : "h-3 w-3 rounded-sm"
1089
- ),
1090
- style: { backgroundColor: w }
1156
+ className: Z("w-0.5", "h-3"),
1157
+ style: { backgroundColor: f.color }
1091
1158
  }
1092
1159
  ),
1093
- /* @__PURE__ */ ge(
1160
+ /* @__PURE__ */ w(
1094
1161
  "span",
1095
1162
  {
1096
- className: ee(
1163
+ className: Z(
1097
1164
  "font-medium text-foreground",
1098
1165
  u ? "text-sm" : "text-[10px] sm:text-xs"
1099
1166
  ),
1100
- children: [
1101
- s.label,
1102
- k && " (no data)"
1103
- ]
1104
- }
1105
- ),
1106
- i && /* @__PURE__ */ V(
1107
- "button",
1108
- {
1109
- type: "button",
1110
- onClick: (G) => {
1111
- G.stopPropagation(), i(s.label);
1112
- },
1113
- className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
1114
- "aria-label": `Remove ${s.label}`,
1115
- children: /* @__PURE__ */ ge(
1116
- "svg",
1117
- {
1118
- xmlns: "http://www.w3.org/2000/svg",
1119
- width: "12",
1120
- height: "12",
1121
- viewBox: "0 0 24 24",
1122
- fill: "none",
1123
- stroke: "currentColor",
1124
- strokeWidth: "2",
1125
- strokeLinecap: "round",
1126
- strokeLinejoin: "round",
1127
- className: "text-muted-foreground hover:text-foreground",
1128
- "aria-hidden": "true",
1129
- children: [
1130
- /* @__PURE__ */ V("title", { children: "Close" }),
1131
- /* @__PURE__ */ V("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1132
- /* @__PURE__ */ V("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1133
- ]
1134
- }
1135
- )
1167
+ children: f.label
1136
1168
  }
1137
1169
  )
1138
1170
  ]
1139
1171
  },
1140
- s.id ?? s.label
1141
- );
1142
- })
1172
+ f.id
1173
+ ))
1174
+ ]
1143
1175
  }
1144
1176
  );
1145
1177
  }
@@ -1152,5 +1184,5 @@ export {
1152
1184
  At as getStepForwardValue,
1153
1185
  zt as getVerticalLineLabelStyle,
1154
1186
  Ft as getVerticalLineTooltipContent,
1155
- ie as seriesIdentity
1187
+ ae as seriesIdentity
1156
1188
  };