@gearbox-protocol/ui-kit 4.0.0-next.4 → 4.0.0-next.6

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.
Files changed (207) hide show
  1. package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
  2. package/dist/cjs/components/badge/badge.cjs +1 -1
  3. package/dist/cjs/components/badge/chip.cjs +1 -0
  4. package/dist/cjs/components/badge/index.cjs +1 -1
  5. package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
  6. package/dist/cjs/components/base/chart-with-side-card/chart-with-side-card.cjs +1 -1
  7. package/dist/cjs/components/base/history-chart/history-chart.cjs +1 -1
  8. package/dist/cjs/components/base/index.cjs +1 -1
  9. package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
  10. package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
  11. package/dist/cjs/components/base/leverage-preset-chips/constants.cjs +1 -0
  12. package/dist/cjs/components/base/leverage-preset-chips/index.cjs +1 -0
  13. package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -0
  14. package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
  15. package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
  16. package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
  17. package/dist/cjs/components/base/title-meta/constants.cjs +1 -1
  18. package/dist/cjs/components/base/title-meta/title-meta.cjs +1 -1
  19. package/dist/cjs/components/base/values/index.cjs +1 -1
  20. package/dist/cjs/components/base/values/position-status-badge.cjs +1 -0
  21. package/dist/cjs/components/base/values/position-type-badge.cjs +1 -1
  22. package/dist/cjs/components/base-table/base-table-line.cjs +1 -0
  23. package/dist/cjs/components/base-table/base-table.cjs +1 -0
  24. package/dist/cjs/components/base-table/constants.cjs +1 -0
  25. package/dist/cjs/components/base-table/index.cjs +1 -0
  26. package/dist/cjs/components/base-table/types.cjs +1 -0
  27. package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
  28. package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
  29. package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
  30. package/dist/cjs/components/collateral-allocation-tooltip/allocation-wheel.cjs +1 -0
  31. package/dist/cjs/components/collateral-allocation-tooltip/collateral-allocation-tooltip.cjs +1 -0
  32. package/dist/cjs/components/collateral-allocation-tooltip/constants.cjs +1 -0
  33. package/dist/cjs/components/collateral-allocation-tooltip/index.cjs +1 -0
  34. package/dist/cjs/components/composites/index.cjs +1 -1
  35. package/dist/cjs/components/composites/pool-assets-table/constants.cjs +1 -0
  36. package/dist/cjs/components/composites/pool-assets-table/index.cjs +1 -1
  37. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
  38. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
  39. package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
  40. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
  41. package/dist/cjs/components/composites/tx-preview/confirm/dialog/index.cjs +1 -1
  42. package/dist/cjs/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.cjs +1 -0
  43. package/dist/cjs/components/composites/tx-preview/confirm/index.cjs +1 -1
  44. package/dist/cjs/components/composites/tx-preview/index.cjs +1 -1
  45. package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
  46. package/dist/cjs/components/filter/filter-chip.cjs +1 -1
  47. package/dist/cjs/components/graph/default-config.cjs +1 -1
  48. package/dist/cjs/components/graph/graph-view.cjs +1 -1
  49. package/dist/cjs/components/graph/graph.cjs +1 -1
  50. package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -0
  51. package/dist/cjs/components/hf-indicator/index.cjs +1 -0
  52. package/dist/cjs/components/index.cjs +1 -1
  53. package/dist/cjs/components/infinite-scroll/index.cjs +1 -0
  54. package/dist/cjs/components/infinite-scroll/infinite-scroll-wrapper.cjs +1 -0
  55. package/dist/cjs/components/name-cell/index.cjs +1 -0
  56. package/dist/cjs/components/name-cell/name-cell.cjs +1 -0
  57. package/dist/cjs/components/network-icon/index.cjs +1 -1
  58. package/dist/cjs/components/network-icon/network-indicator.cjs +1 -0
  59. package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
  60. package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
  61. package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
  62. package/dist/cjs/configs/tailwind-preset.cjs +1 -1
  63. package/dist/cjs/hooks/index.cjs +1 -1
  64. package/dist/cjs/hooks/use-observed-width-key.cjs +1 -0
  65. package/dist/cjs/index.cjs +1 -1
  66. package/dist/cjs/locale/en.json.cjs +1 -1
  67. package/dist/cjs/utils/format-money.cjs +1 -1
  68. package/dist/cjs/utils/index.cjs +1 -1
  69. package/dist/cjs/utils/leverage-presets.cjs +1 -0
  70. package/dist/esm/components/assets-list-cell/assets-list-cell.js +161 -159
  71. package/dist/esm/components/badge/badge.js +14 -8
  72. package/dist/esm/components/badge/chip.js +47 -0
  73. package/dist/esm/components/badge/index.js +8 -3
  74. package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
  75. package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
  76. package/dist/esm/components/base/history-chart/history-chart.js +86 -46
  77. package/dist/esm/components/base/index.js +144 -138
  78. package/dist/esm/components/base/info-list/info-list.js +7 -8
  79. package/dist/esm/components/base/leverage-input/leverage-input.js +1 -1
  80. package/dist/esm/components/base/leverage-preset-chips/constants.js +7 -0
  81. package/dist/esm/components/base/leverage-preset-chips/index.js +6 -0
  82. package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +39 -0
  83. package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +23 -30
  84. package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +3 -2
  85. package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +194 -32
  86. package/dist/esm/components/base/title-meta/constants.js +1 -0
  87. package/dist/esm/components/base/title-meta/title-meta.js +53 -33
  88. package/dist/esm/components/base/values/index.js +16 -14
  89. package/dist/esm/components/base/values/position-status-badge.js +26 -0
  90. package/dist/esm/components/base/values/position-type-badge.js +7 -6
  91. package/dist/esm/components/base-table/base-table-line.js +117 -0
  92. package/dist/esm/components/base-table/base-table.js +110 -0
  93. package/dist/esm/components/base-table/constants.js +12 -0
  94. package/dist/esm/components/base-table/index.js +9 -0
  95. package/dist/esm/components/base-table/types.js +1 -0
  96. package/dist/esm/components/block-sync-pill/block-sync-pill.js +9 -6
  97. package/dist/esm/components/checkbox/checkbox-labeled.js +7 -4
  98. package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -4
  99. package/dist/esm/components/collateral-allocation-tooltip/allocation-wheel.js +71 -0
  100. package/dist/esm/components/collateral-allocation-tooltip/collateral-allocation-tooltip.js +102 -0
  101. package/dist/esm/components/collateral-allocation-tooltip/constants.js +12 -0
  102. package/dist/esm/components/collateral-allocation-tooltip/index.js +9 -0
  103. package/dist/esm/components/composites/index.js +31 -31
  104. package/dist/esm/components/composites/pool-assets-table/constants.js +9 -0
  105. package/dist/esm/components/composites/pool-assets-table/index.js +8 -6
  106. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +52 -30
  107. package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +108 -76
  108. package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +44 -26
  109. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +109 -52
  110. package/dist/esm/components/composites/tx-preview/confirm/dialog/index.js +8 -10
  111. package/dist/esm/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.js +1 -0
  112. package/dist/esm/components/composites/tx-preview/confirm/index.js +24 -26
  113. package/dist/esm/components/composites/tx-preview/index.js +24 -26
  114. package/dist/esm/components/compound-apy/compound-apy.js +85 -80
  115. package/dist/esm/components/filter/filter-chip.js +1 -0
  116. package/dist/esm/components/graph/default-config.js +20 -18
  117. package/dist/esm/components/graph/graph-view.js +32 -31
  118. package/dist/esm/components/graph/graph.js +459 -458
  119. package/dist/esm/components/hf-indicator/hf-indicator.js +33 -0
  120. package/dist/esm/components/hf-indicator/index.js +4 -0
  121. package/dist/esm/components/index.js +732 -701
  122. package/dist/esm/components/infinite-scroll/index.js +4 -0
  123. package/dist/esm/components/infinite-scroll/infinite-scroll-wrapper.js +30 -0
  124. package/dist/esm/components/name-cell/index.js +4 -0
  125. package/dist/esm/components/name-cell/name-cell.js +35 -0
  126. package/dist/esm/components/network-icon/index.js +4 -2
  127. package/dist/esm/components/network-icon/network-indicator.js +82 -0
  128. package/dist/esm/components/trading-view/trading-view.js +193 -155
  129. package/dist/esm/components/with-copy/with-copy.js +7 -4
  130. package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +112 -169
  131. package/dist/esm/configs/tailwind-preset.js +13 -1
  132. package/dist/esm/hooks/index.js +20 -18
  133. package/dist/esm/hooks/use-observed-width-key.js +24 -0
  134. package/dist/esm/index.js +881 -842
  135. package/dist/esm/locale/en.json.js +21 -18
  136. package/dist/esm/utils/format-money.js +59 -41
  137. package/dist/esm/utils/index.js +87 -83
  138. package/dist/esm/utils/leverage-presets.js +13 -0
  139. package/dist/globals.css +1 -1
  140. package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +3 -0
  141. package/dist/types/components/badge/badge.d.ts +2 -1
  142. package/dist/types/components/badge/chip.d.ts +22 -0
  143. package/dist/types/components/badge/index.d.ts +1 -0
  144. package/dist/types/components/base/history-chart/history-chart.d.ts +13 -3
  145. package/dist/types/components/base/index.d.ts +1 -0
  146. package/dist/types/components/base/leverage-input/leverage-input.d.ts +1 -1
  147. package/dist/types/components/base/leverage-preset-chips/constants.d.ts +4 -0
  148. package/dist/types/components/base/leverage-preset-chips/index.d.ts +2 -0
  149. package/dist/types/components/base/leverage-preset-chips/leverage-preset-chips.d.ts +13 -0
  150. package/dist/types/components/base/liquidation-params-table/liquidation-params-table.d.ts +2 -2
  151. package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -5
  152. package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +1 -0
  153. package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -4
  154. package/dist/types/components/base/title-meta/constants.d.ts +1 -0
  155. package/dist/types/components/base/title-meta/title-meta.d.ts +9 -1
  156. package/dist/types/components/base/values/index.d.ts +1 -0
  157. package/dist/types/components/base/values/position-status-badge.d.ts +7 -0
  158. package/dist/types/components/base/values/position-type-badge.d.ts +1 -1
  159. package/dist/types/components/base-table/base-table-line.d.ts +21 -0
  160. package/dist/types/components/base-table/base-table.d.ts +19 -0
  161. package/dist/types/components/base-table/constants.d.ts +8 -0
  162. package/dist/types/components/base-table/index.d.ts +3 -0
  163. package/dist/types/components/base-table/types.d.ts +37 -0
  164. package/dist/types/components/collateral-allocation-tooltip/allocation-wheel.d.ts +10 -0
  165. package/dist/types/components/collateral-allocation-tooltip/collateral-allocation-tooltip.d.ts +23 -0
  166. package/dist/types/components/collateral-allocation-tooltip/constants.d.ts +8 -0
  167. package/dist/types/components/collateral-allocation-tooltip/index.d.ts +3 -0
  168. package/dist/types/components/composites/pool-assets-table/constants.d.ts +6 -0
  169. package/dist/types/components/composites/pool-assets-table/index.d.ts +1 -0
  170. package/dist/types/components/composites/pool-assets-table/pool-assets-table-head.d.ts +1 -2
  171. package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +8 -8
  172. package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +7 -20
  173. package/dist/types/components/composites/pool-assets-table/types.d.ts +4 -12
  174. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.d.ts +23 -19
  175. package/dist/types/components/composites/tx-preview/confirm/dialog/index.d.ts +2 -2
  176. package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.d.ts +0 -3
  177. package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.d.ts +97 -0
  178. package/dist/types/components/graph/graph-view.d.ts +1 -1
  179. package/dist/types/components/graph/graph.d.ts +4 -0
  180. package/dist/types/components/hf-indicator/hf-indicator.d.ts +8 -0
  181. package/dist/types/components/hf-indicator/index.d.ts +1 -0
  182. package/dist/types/components/index.d.ts +5 -0
  183. package/dist/types/components/infinite-scroll/index.d.ts +1 -0
  184. package/dist/types/components/infinite-scroll/infinite-scroll-wrapper.d.ts +11 -0
  185. package/dist/types/components/name-cell/index.d.ts +1 -0
  186. package/dist/types/components/name-cell/name-cell.d.ts +13 -0
  187. package/dist/types/components/network-icon/index.d.ts +1 -0
  188. package/dist/types/components/network-icon/network-indicator.d.ts +23 -0
  189. package/dist/types/components/trading-view/trading-view.d.ts +10 -3
  190. package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +6 -8
  191. package/dist/types/configs/tailwind-preset.d.ts +12 -0
  192. package/dist/types/hooks/index.d.ts +1 -0
  193. package/dist/types/hooks/use-observed-width-key.d.ts +8 -0
  194. package/dist/types/index.d.ts +6 -1
  195. package/dist/types/locale/en.json.d.ts +23 -18
  196. package/dist/types/utils/format-money.d.ts +11 -5
  197. package/dist/types/utils/index.d.ts +2 -1
  198. package/dist/types/utils/leverage-presets.d.ts +7 -0
  199. package/package.json +1 -1
  200. package/src/styles/base.css +30 -0
  201. package/src/styles/theme.css +16 -0
  202. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +0 -1
  203. package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.cjs +0 -1
  204. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +0 -177
  205. package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.js +0 -54
  206. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.d.ts +0 -17
  207. package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.d.ts +0 -16
@@ -1,26 +1,26 @@
1
- import { jsxs as le, jsx as w } from "react/jsx-runtime";
2
- import { createChart as it, CrosshairMode as st, LineStyle as te, LineSeries as ct, AreaSeries as ut } from "lightweight-charts";
3
- import * as xe from "react";
4
- import { useRef as O, useState as U, useEffect as G, useLayoutEffect as ft } from "react";
1
+ import { jsxs as ie, jsx as _ } from "react/jsx-runtime";
2
+ import { createChart as it, CrosshairMode as st, LineStyle as re, LineSeries as ct, AreaSeries as ut } from "lightweight-charts";
3
+ import * as Ce from "react";
4
+ import { useRef as X, useState as te, useEffect as W, useLayoutEffect as ft } from "react";
5
5
  import { useIsMobile as ht } from "../../hooks/use-media-query.js";
6
- import { cn as ae } from "../../utils/cn.js";
7
- import { resolveCSSColor as ee, generateColorsFromBase as fe, hslToHex as dt } from "../../utils/colors.js";
8
- import { getDefaultOptions as Xe, getDefaultSeries as mt, getDefaultVerticalLine as pt } from "./default-config.js";
9
- import { getXFormatters as qe, formatExactValue as we, createAdaptiveYAxisFormatter as gt } from "./formatters.js";
6
+ import { cn as O } from "../../utils/cn.js";
7
+ import { resolveCSSColor as oe, generateColorsFromBase as ce, hslToHex as mt } from "../../utils/colors.js";
8
+ import { getDefaultOptions as Ze, getDefaultSeries as dt, getDefaultVerticalLine as pt } from "./default-config.js";
9
+ import { getXFormatters as qe, formatExactValue as ye, createAdaptiveYAxisFormatter as gt } from "./formatters.js";
10
10
  import { GraphCurrentValue as bt } from "./graph-current-value.js";
11
11
  import { GraphTooltip as vt } from "./graph-tooltip.js";
12
- import { VertLine as Ct } from "./plugins/vertical-line.js";
13
- class St {
12
+ import { VertLine as St } from "./plugins/vertical-line.js";
13
+ class Ct {
14
14
  _yTop;
15
15
  _yBottom;
16
16
  _color;
17
- constructor(l, u, h) {
18
- this._yTop = l, this._yBottom = u, this._color = h;
17
+ constructor(a, u, m) {
18
+ this._yTop = a, this._yBottom = u, this._color = m;
19
19
  }
20
- draw(l) {
21
- l.useBitmapCoordinateSpace((u) => {
22
- const h = u.context, c = u.verticalPixelRatio, b = this._yTop === null ? 0 : this._yTop * c, L = this._yBottom === null ? u.bitmapSize.height : this._yBottom * c, x = Math.min(b, L), R = Math.max(b, L);
23
- h.fillStyle = this._color, h.fillRect(0, x, u.bitmapSize.width, R - x);
20
+ draw(a) {
21
+ a.useBitmapCoordinateSpace((u) => {
22
+ const m = u.context, c = u.verticalPixelRatio, b = this._yTop === null ? 0 : this._yTop * c, v = this._yBottom === null ? u.bitmapSize.height : this._yBottom * c, w = Math.min(b, v), R = Math.max(b, v);
23
+ m.fillStyle = this._color, m.fillRect(0, w, u.bitmapSize.width, R - w);
24
24
  });
25
25
  }
26
26
  }
@@ -28,19 +28,19 @@ class yt {
28
28
  _source;
29
29
  _yTop = null;
30
30
  _yBottom = null;
31
- constructor(l) {
32
- this._source = l;
31
+ constructor(a) {
32
+ this._source = a;
33
33
  }
34
34
  update() {
35
- const l = this._source.series;
36
- this._yTop = this._source.priceTop === void 0 ? null : l.priceToCoordinate(this._source.priceTop), this._yBottom = this._source.priceBottom === void 0 ? null : l.priceToCoordinate(this._source.priceBottom);
35
+ const a = this._source.series;
36
+ this._yTop = this._source.priceTop === void 0 ? null : a.priceToCoordinate(this._source.priceTop), this._yBottom = this._source.priceBottom === void 0 ? null : a.priceToCoordinate(this._source.priceBottom);
37
37
  }
38
38
  /** Draw beneath the series line/area so the data stays readable. */
39
39
  zOrder() {
40
40
  return "bottom";
41
41
  }
42
42
  renderer() {
43
- return new St(this._yTop, this._yBottom, this._source.color);
43
+ return new Ct(this._yTop, this._yBottom, this._source.color);
44
44
  }
45
45
  }
46
46
  class xt {
@@ -49,26 +49,26 @@ class xt {
49
49
  priceBottom;
50
50
  color;
51
51
  _paneViews;
52
- constructor(l, u, h, c) {
53
- this.series = l, this.priceTop = u, this.priceBottom = h, this.color = c, this._paneViews = [new yt(this)];
52
+ constructor(a, u, m, c) {
53
+ this.series = a, this.priceTop = u, this.priceBottom = m, this.color = c, this._paneViews = [new yt(this)];
54
54
  }
55
55
  updateAllViews() {
56
- for (const l of this._paneViews) l.update();
56
+ for (const a of this._paneViews) a.update();
57
57
  }
58
58
  paneViews() {
59
59
  return this._paneViews;
60
60
  }
61
61
  }
62
- function wt(e, l) {
63
- switch (e) {
64
- case te.Dotted:
65
- return [l, l];
66
- case te.Dashed:
67
- return [2 * l, 2 * l];
68
- case te.LargeDashed:
69
- return [6 * l, 6 * l];
70
- case te.SparseDotted:
71
- return [l, 4 * l];
62
+ function wt(t, a) {
63
+ switch (t) {
64
+ case re.Dotted:
65
+ return [a, a];
66
+ case re.Dashed:
67
+ return [2 * a, 2 * a];
68
+ case re.LargeDashed:
69
+ return [6 * a, 6 * a];
70
+ case re.SparseDotted:
71
+ return [a, 4 * a];
72
72
  default:
73
73
  return [];
74
74
  }
@@ -78,22 +78,22 @@ class _t {
78
78
  _color;
79
79
  _lineWidth;
80
80
  _lineStyle;
81
- constructor(l, u, h, c) {
82
- this._y = l, this._color = u, this._lineWidth = h, this._lineStyle = c;
81
+ constructor(a, u, m, c) {
82
+ this._y = a, this._color = u, this._lineWidth = m, this._lineStyle = c;
83
83
  }
84
- draw(l) {
85
- l.useBitmapCoordinateSpace((u) => {
84
+ draw(a) {
85
+ a.useBitmapCoordinateSpace((u) => {
86
86
  if (this._y === null) return;
87
- const h = u.context, c = u.verticalPixelRatio, b = Math.max(1, Math.round(this._lineWidth * c)), L = Math.round(this._y * c);
88
- h.save(), h.strokeStyle = this._color, h.lineWidth = b, h.setLineDash(wt(this._lineStyle, b)), h.beginPath(), h.moveTo(0, L), h.lineTo(u.bitmapSize.width, L), h.stroke(), h.restore();
87
+ const m = u.context, c = u.verticalPixelRatio, b = Math.max(1, Math.round(this._lineWidth * c)), v = Math.round(this._y * c);
88
+ m.save(), m.strokeStyle = this._color, m.lineWidth = b, m.setLineDash(wt(this._lineStyle, b)), m.beginPath(), m.moveTo(0, v), m.lineTo(u.bitmapSize.width, v), m.stroke(), m.restore();
89
89
  });
90
90
  }
91
91
  }
92
92
  class Nt {
93
93
  _source;
94
94
  _y = null;
95
- constructor(l) {
96
- this._source = l;
95
+ constructor(a) {
96
+ this._source = a;
97
97
  }
98
98
  update() {
99
99
  this._y = this._source.series.priceToCoordinate(this._source.price);
@@ -116,46 +116,46 @@ class Nt {
116
116
  );
117
117
  }
118
118
  }
119
- class Tt {
119
+ class Pt {
120
120
  series;
121
121
  price;
122
122
  color;
123
123
  lineWidth;
124
124
  lineStyle;
125
125
  _paneViews;
126
- constructor(l, u, h, c, b) {
127
- this.series = l, this.price = u, this.color = h, this.lineWidth = c, this.lineStyle = b, this._paneViews = [new Nt(this)];
126
+ constructor(a, u, m, c, b) {
127
+ this.series = a, this.price = u, this.color = m, this.lineWidth = c, this.lineStyle = b, this._paneViews = [new Nt(this)];
128
128
  }
129
129
  updateAllViews() {
130
- for (const l of this._paneViews) l.update();
130
+ for (const a of this._paneViews) a.update();
131
131
  }
132
132
  paneViews() {
133
133
  return this._paneViews;
134
134
  }
135
135
  }
136
- function Vt(e, l, u) {
137
- const h = e.labelText ?? "", c = e.value, b = c === void 0 ? "" : typeof c == "number" ? l === "$" ? `$${we(c, void 0, u)}` : l === "%" ? `${we(c, void 0, u)}%` : we(
136
+ function Tt(t, a, u) {
137
+ const m = t.labelText ?? "", c = t.value, b = c === void 0 ? "" : typeof c == "number" ? a === "$" ? `$${ye(c, void 0, u)}` : a === "%" ? `${ye(c, void 0, u)}%` : ye(
138
138
  c,
139
- l !== "none" && l !== "%" && l !== "$" ? l : void 0,
139
+ a !== "none" && a !== "%" && a !== "$" ? a : void 0,
140
140
  u
141
141
  ) : String(c);
142
- return { labelText: h, valueStr: b };
142
+ return { labelText: m, valueStr: b };
143
143
  }
144
- const Ze = 4;
145
- function Pt(e, l, u) {
146
- const h = { left: e, transform: "translateX(-50%)" };
147
- if (l <= 0 || !u || u <= 0)
148
- return h;
149
- const c = u / 2, b = Ze + c, L = l - Ze - c;
150
- return L < b ? { left: l / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(e, b), L), transform: "translateX(-50%)" };
144
+ const Ke = 4;
145
+ function Vt(t, a, u) {
146
+ const m = { left: t, transform: "translateX(-50%)" };
147
+ if (a <= 0 || !u || u <= 0)
148
+ return m;
149
+ const c = u / 2, b = Ke + c, v = a - Ke - c;
150
+ return v < b ? { left: a / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(t, b), v), transform: "translateX(-50%)" };
151
151
  }
152
- function Lt(e, l) {
153
- for (let u = e.length - 1; u >= 0; u--)
154
- if (Number(e[u].time) <= l)
155
- return e[u].value;
152
+ function Lt(t, a) {
153
+ for (let u = t.length - 1; u >= 0; u--)
154
+ if (Number(t[u].time) <= a)
155
+ return t[u].value;
156
156
  return 0;
157
157
  }
158
- const _e = [
158
+ const xe = [
159
159
  // 0 green (emerald)
160
160
  {
161
161
  line: "#02c39a",
@@ -271,109 +271,94 @@ const _e = [
271
271
  bottom: "rgba(71, 85, 105, 0.04)"
272
272
  }
273
273
  ], Rt = 137.5;
274
- function Ke(e) {
275
- if (e < _e.length)
276
- return _e[e];
277
- const u = (e - _e.length) * Rt % 360, h = dt(u, 70, 50), { topColor: c, bottomColor: b } = fe(h);
278
- return { line: h, top: c, bottom: b };
274
+ function Je(t) {
275
+ if (t < xe.length)
276
+ return xe[t];
277
+ const u = (t - xe.length) * Rt % 360, m = mt(u, 70, 50), { topColor: c, bottomColor: b } = ce(m);
278
+ return { line: m, top: c, bottom: b };
279
279
  }
280
- function Ot({
281
- series: e,
282
- className: l,
280
+ function Xt({
281
+ series: t,
282
+ className: a,
283
283
  showLegend: u = !1,
284
- onUnselectSeries: h,
284
+ onUnselectSeries: m,
285
285
  xMeasureUnit: c = "time",
286
286
  yMeasureUnit: b = "token",
287
- optionsOverrides: L,
288
- verticalLineOptions: x,
287
+ optionsOverrides: v,
288
+ verticalLineOptions: w,
289
289
  priceLineOptions: R,
290
- zoneOptions: E,
291
- currentValueDecimals: he,
290
+ zoneOptions: A,
291
+ currentValueDecimals: ue,
292
292
  useSharedPriceScale: j = !1,
293
- dualYAxis: I = !1,
294
- defaultVisiblePriceScaleId: Ne = "right",
295
- leftPriceScaleTitle: Te,
293
+ dualYAxis: D = !1,
294
+ defaultVisiblePriceScaleId: we = "right",
295
+ leftPriceScaleTitle: _e,
296
296
  rightPriceScaleTitle: kt,
297
- showCurrentValue: Je = !0,
298
- graphTitle: de,
299
- yScaleMin: Ve,
297
+ showCurrentValue: Qe = !0,
298
+ graphTitle: fe,
299
+ yScaleMin: Ne,
300
300
  yScaleMinMultiple: Pe,
301
- visibleTimeFrom: K,
302
- disableZoom: ie = !1,
303
- hideDefaultTooltip: me = !1
301
+ visibleTimeFrom: J,
302
+ disableZoom: Te = !1,
303
+ hideDefaultTooltip: he = !1
304
304
  }) {
305
- const W = O(null), y = O(/* @__PURE__ */ new Map()), pe = O(!1), Le = O(!0), Re = O([]), B = O(null), ge = O(null), se = O(null), V = ht(), X = xe.useMemo(() => e.flatMap((t) => t.data), [e]), Qe = xe.useMemo(() => {
306
- if (e.length > 0) {
307
- const t = e[e.length - 1];
308
- if (t.data.length > 0)
309
- return t.data[t.data.length - 1];
305
+ const B = X(null), C = X(/* @__PURE__ */ new Map()), me = X(!1), Ve = X(!0), Le = X([]), F = X(null), de = X(null), Re = X(null), V = ht(), Z = Ce.useMemo(() => t.flatMap((e) => e.data), [t]), Ye = Ce.useMemo(() => {
306
+ if (t.length > 0) {
307
+ const e = t[t.length - 1];
308
+ if (e.data.length > 0)
309
+ return e.data[e.data.length - 1];
310
310
  }
311
- }, [e]), [Me, be] = U(() => {
312
- if (!Qe) return;
313
- const t = /* @__PURE__ */ new Map();
314
- for (const i of e)
315
- i.data.length > 0 && t.set(i.label, i.data[i.data.length - 1]);
316
- return t;
317
- }), [ke, q] = U(null), [De, Ie] = U([]), [Ye, Be] = U(0), Fe = O(/* @__PURE__ */ new Map()), [Ue, et] = U({}), [ce, tt] = U(0);
318
- G(() => {
319
- const t = () => {
311
+ }, [t]), [Me, pe] = te(() => {
312
+ if (!Ye) return;
313
+ const e = /* @__PURE__ */ new Map();
314
+ for (const i of t)
315
+ i.data.length > 0 && e.set(i.label, i.data[i.data.length - 1]);
316
+ return e;
317
+ }), [ke, q] = te(null), [Ie, De] = te([]), [Oe, Be] = te(0), Fe = X(/* @__PURE__ */ new Map()), [Ue, et] = te({}), [Q, tt] = te(0);
318
+ W(() => {
319
+ const e = () => {
320
320
  try {
321
- if (B.current && Be(B.current.clientWidth), W.current && B.current) {
322
- const s = B.current.clientWidth, a = B.current.clientHeight;
323
- W.current.resize(s, a);
321
+ if (F.current && Be(F.current.clientWidth), B.current && F.current) {
322
+ const s = F.current.clientWidth, l = F.current.clientHeight;
323
+ B.current.resize(s, l);
324
324
  }
325
325
  } catch {
326
326
  }
327
- }, i = B.current, n = i ? new ResizeObserver(t) : null;
328
- return se.current = n, i && n?.observe(i), () => {
329
- i && n?.unobserve(i), n?.disconnect(), se.current = null;
327
+ }, i = F.current, n = i ? new ResizeObserver(e) : null;
328
+ return Re.current = n, i && n?.observe(i), () => {
329
+ i && n?.unobserve(i), n?.disconnect(), Re.current = null;
330
330
  };
331
- }, []), G(() => {
332
- if (!ge.current || pe.current) return;
333
- const t = Xe(), i = ee(
334
- "hsl(var(--foreground))",
335
- "rgb(0, 0, 0)"
336
- ), n = ie ? {
337
- handleScale: {
338
- mouseWheel: !1,
339
- pinch: !1,
340
- axisPressedMouseMove: !1,
341
- axisDoubleClickReset: !1
342
- },
343
- handleScroll: {
344
- mouseWheel: !1,
345
- pressedMouseMove: !1,
346
- horzTouchDrag: !1,
347
- vertTouchDrag: !1
348
- }
349
- } : {}, s = it(ge.current, {
350
- ...t,
331
+ }, []), W(() => {
332
+ if (!de.current || me.current) return;
333
+ const e = Ze(), i = oe(
334
+ "hsl(var(--muted-foreground))",
335
+ "rgb(163, 163, 163)"
336
+ ), n = it(de.current, {
337
+ ...e,
351
338
  leftPriceScale: {
352
- ...t.leftPriceScale || {},
339
+ ...e.leftPriceScale || {},
353
340
  visible: !1,
354
341
  textColor: i
355
342
  },
356
343
  rightPriceScale: {
357
- ...t.rightPriceScale || {},
344
+ ...e.rightPriceScale || {},
358
345
  visible: !V,
359
346
  textColor: i
360
347
  },
361
348
  ...V && {
362
349
  crosshair: {
363
- ...t.crosshair,
350
+ ...e.crosshair,
364
351
  mode: st.Magnet
365
352
  }
366
- },
367
- ...n,
368
- ...L
353
+ }
369
354
  });
370
- return W.current = s, pe.current = !0, tt((a) => a + 1), () => {
371
- se.current?.disconnect(), se.current = null, s.remove(), W.current = null, pe.current = !1, y.current.clear();
355
+ return B.current = n, me.current = !0, tt((s) => s + 1), () => {
356
+ n.remove(), B.current = null, me.current = !1, C.current.clear();
372
357
  };
373
- }, [V, L, ie]), G(() => {
374
- const t = W.current;
375
- t && t.applyOptions(
376
- ie ? {
358
+ }, [V]), W(() => {
359
+ const e = B.current;
360
+ e && e.applyOptions(
361
+ Te ? {
377
362
  handleScale: {
378
363
  mouseWheel: !1,
379
364
  pinch: !1,
@@ -401,55 +386,58 @@ function Ot({
401
386
  }
402
387
  }
403
388
  );
404
- }, [ie]), G(() => {
405
- const t = W.current;
406
- if (!t || e.length === 0) return;
407
- const n = e.filter((r) => r.data.length > 0).length <= 1 ? Ve : Pe, s = c === "time" ? qe(c, X) : qe(c), a = /* @__PURE__ */ new Map();
389
+ }, [Q, Te]), W(() => {
390
+ const e = B.current;
391
+ !e || !v || e.applyOptions(v);
392
+ }, [Q, v]), W(() => {
393
+ const e = B.current;
394
+ if (!e || t.length === 0) return;
395
+ const n = t.filter((r) => r.data.length > 0).length <= 1 ? Ne : Pe, s = c === "time" ? qe(c, Z) : qe(c), l = /* @__PURE__ */ new Map();
408
396
  {
409
397
  let r = 0;
410
- for (const o of e)
411
- o.data.length !== 0 && (a.set(
398
+ for (const o of t)
399
+ o.data.length !== 0 && (l.set(
412
400
  o.label,
413
401
  o.priceScaleId ?? (r === 0 ? "left" : "right")
414
402
  ), r++);
415
403
  }
416
- const f = (r, o, m) => {
404
+ const f = (r, o, d) => {
417
405
  const {
418
- formatter: D,
406
+ formatter: I,
419
407
  tickmarksFormatter: T,
420
- updateVisibleRange: $,
408
+ updateVisibleRange: G,
421
409
  updateLastValues: We
422
410
  } = gt(r, o, {
423
411
  yScaleMin: n
424
- }), Ce = e.filter((J) => J.data.length > 0 && m.has(J.label)).map((J) => J.data[J.data.length - 1].value);
425
- return We(Ce), { formatter: D, tickmarksFormatter: T, updateVisibleRange: $, labels: m };
426
- }, d = [];
427
- if (I)
412
+ }), be = t.filter((Y) => Y.data.length > 0 && d.has(Y.label)).map((Y) => Y.data[Y.data.length - 1].value);
413
+ return We(be), { formatter: I, tickmarksFormatter: T, updateVisibleRange: G, labels: d };
414
+ }, h = [];
415
+ if (D)
428
416
  for (const r of ["left", "right"]) {
429
- const o = /* @__PURE__ */ new Set(), m = [];
430
- let D = b;
431
- for (const T of e)
432
- if (T.data.length !== 0 && a.get(T.label) === r) {
433
- o.size === 0 && T.yMeasureUnit && (D = T.yMeasureUnit), o.add(T.label);
434
- for (const $ of T.data) m.push($.value);
417
+ const o = /* @__PURE__ */ new Set(), d = [];
418
+ let I = b;
419
+ for (const T of t)
420
+ if (T.data.length !== 0 && l.get(T.label) === r) {
421
+ o.size === 0 && T.yMeasureUnit && (I = T.yMeasureUnit), o.add(T.label);
422
+ for (const G of T.data) d.push(G.value);
435
423
  }
436
- o.size > 0 && d.push(f(m, D, o));
424
+ o.size > 0 && h.push(f(d, I, o));
437
425
  }
438
426
  else {
439
- const r = X.map((m) => m.value), o = new Set(
440
- e.filter((m) => m.data.length > 0).map((m) => m.label)
427
+ const r = Z.map((d) => d.value), o = new Set(
428
+ t.filter((d) => d.data.length > 0).map((d) => d.label)
441
429
  );
442
- d.push(f(r, b, o));
430
+ h.push(f(r, b, o));
443
431
  }
444
- Re.current = d;
445
- const v = /* @__PURE__ */ new Map();
446
- for (const r of d)
432
+ Le.current = h;
433
+ const y = /* @__PURE__ */ new Map();
434
+ for (const r of h)
447
435
  for (const o of r.labels)
448
- v.set(o, r);
449
- const C = Xe();
450
- t.applyOptions({
436
+ y.set(o, r);
437
+ const S = Ze();
438
+ e.applyOptions({
451
439
  localization: {
452
- ...C.localization || {},
440
+ ...S.localization || {},
453
441
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
454
442
  timeFormatter: (r) => (
455
443
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
@@ -457,33 +445,36 @@ function Ot({
457
445
  )
458
446
  },
459
447
  timeScale: {
460
- ...C.timeScale || {},
448
+ ...S.timeScale || {},
449
+ ...v?.timeScale,
461
450
  // biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
462
451
  tickMarkFormatter: s.tickMarkFormatter,
463
452
  minBarSpacing: 0
464
453
  }
465
454
  });
466
- const P = (X.length > 0 ? Math.min(...X.map((r) => r.value)) : 0) < 0, _ = X.some((r) => r.value === 0), p = !P && _, S = !I && e.length > 1 && !j, M = I ? V : e.length > 1 && !j || V, k = ee(
467
- "hsl(var(--foreground))",
468
- "rgb(0, 0, 0)"
455
+ const L = (Z.length > 0 ? Math.min(...Z.map((r) => r.value)) : 0) < 0, N = Z.some((r) => r.value === 0), p = !L && N, x = !D && t.length > 1 && !j, M = D ? V : t.length > 1 && !j || V, k = oe(
456
+ "hsl(var(--muted-foreground))",
457
+ "rgb(163, 163, 163)"
469
458
  );
470
- t.applyOptions({
471
- ...I && {
472
- defaultVisiblePriceScaleId: Ne
459
+ e.applyOptions({
460
+ ...D && {
461
+ defaultVisiblePriceScaleId: we
473
462
  },
474
463
  leftPriceScale: {
475
- ...C.leftPriceScale || {},
476
- visible: I && !V,
464
+ ...S.leftPriceScale || {},
465
+ ...v?.leftPriceScale,
466
+ visible: D && !V,
477
467
  textColor: k,
478
- ...I && Te && {
468
+ ...D && _e && {
479
469
  // lightweight-charts uses scale margins; title shown via localization if needed
480
470
  }
481
471
  },
482
472
  rightPriceScale: {
483
- ...C.rightPriceScale || {},
484
- visible: I ? !V : !M,
473
+ ...S.rightPriceScale || {},
474
+ ...v?.rightPriceScale,
475
+ visible: D ? !V : !M,
485
476
  textColor: k,
486
- ...p && !I && {
477
+ ...p && !D && {
487
478
  scaleMargins: {
488
479
  top: 0.3,
489
480
  bottom: 0
@@ -491,59 +482,59 @@ function Ot({
491
482
  }
492
483
  }
493
484
  });
494
- const N = new Set(y.current.keys()), Z = new Set(e.map((r) => r.label));
495
- for (const r of N)
496
- if (!Z.has(r)) {
497
- const o = y.current.get(r);
498
- o && (t.removeSeries(o), y.current.delete(r));
485
+ const P = new Set(C.current.keys()), K = new Set(t.map((r) => r.label));
486
+ for (const r of P)
487
+ if (!K.has(r)) {
488
+ const o = C.current.get(r);
489
+ o && (e.removeSeries(o), C.current.delete(r));
499
490
  }
500
- const Q = mt(), oe = [];
501
- let re = 0;
502
- const Ee = e.find((r) => r.data.length > 0), ne = /* @__PURE__ */ new Map();
491
+ const U = dt(), ne = [];
492
+ let le = 0;
493
+ const ze = t.find((r) => r.data.length > 0), ae = /* @__PURE__ */ new Map();
503
494
  if (R && R.length > 0)
504
495
  for (const r of R) {
505
496
  if (!Number.isFinite(r.price)) continue;
506
- const o = r.seriesLabel ?? Ee?.label;
497
+ const o = r.seriesLabel ?? ze?.label;
507
498
  if (!o) continue;
508
- const m = ne.get(o) ?? [];
509
- m.push(r.price), ne.set(o, m);
499
+ const d = ae.get(o) ?? [];
500
+ d.push(r.price), ae.set(o, d);
510
501
  }
511
- if (E && E.length > 0)
512
- for (const r of E) {
513
- const o = r.seriesLabel ?? Ee?.label;
502
+ if (A && A.length > 0)
503
+ for (const r of A) {
504
+ const o = r.seriesLabel ?? ze?.label;
514
505
  if (!o) continue;
515
- const m = ne.get(o) ?? [];
516
- Number.isFinite(r.priceTop) && m.push(r.priceTop), Number.isFinite(r.priceBottom) && m.push(r.priceBottom), ne.set(o, m);
506
+ const d = ae.get(o) ?? [];
507
+ Number.isFinite(r.priceTop) && d.push(r.priceTop), Number.isFinite(r.priceBottom) && d.push(r.priceBottom), ae.set(o, d);
517
508
  }
518
- for (let r = 0; r < e.length; r++) {
519
- const o = e[r], m = Ke(r), D = o.lineColor ?? o.color ?? m.line;
520
- let T, $;
509
+ for (let r = 0; r < t.length; r++) {
510
+ const o = t[r], d = Je(r), I = o.lineColor ?? o.color ?? d.line;
511
+ let T, G;
521
512
  if (o.lineColor ?? o.color)
522
513
  if (o.topColor && o.bottomColor)
523
- T = o.topColor, $ = o.bottomColor;
514
+ T = o.topColor, G = o.bottomColor;
524
515
  else if (o.topColor) {
525
- const g = fe(D);
526
- T = o.topColor, $ = g.bottomColor;
516
+ const g = ce(I);
517
+ T = o.topColor, G = g.bottomColor;
527
518
  } else if (o.bottomColor)
528
- T = fe(D).topColor, $ = o.bottomColor;
519
+ T = ce(I).topColor, G = o.bottomColor;
529
520
  else {
530
- const g = fe(D);
531
- T = g.topColor, $ = g.bottomColor;
521
+ const g = ce(I);
522
+ T = g.topColor, G = g.bottomColor;
532
523
  }
533
524
  else
534
- T = o.topColor || m.top, $ = o.bottomColor || m.bottom;
525
+ T = o.topColor || d.top, G = o.bottomColor || d.bottom;
535
526
  if (o.data.length === 0) {
536
- const g = y.current.get(o.label);
537
- g && (t.removeSeries(g), y.current.delete(o.label));
527
+ const g = C.current.get(o.label);
528
+ g && (e.removeSeries(g), C.current.delete(o.label));
538
529
  continue;
539
530
  }
540
- const Ce = (o.data.length > 0 ? Math.min(...o.data.map((g) => g.value)) : 0) < 0, J = o.data.some((g) => g.value === 0), ot = !Ce && J, Ae = I ? o.priceScaleId ?? (re === 0 ? "left" : "right") : j || !S || re === 0 ? "right" : `scale-${re}`;
541
- S && oe.push({
531
+ const be = (o.data.length > 0 ? Math.min(...o.data.map((g) => g.value)) : 0) < 0, Y = o.data.some((g) => g.value === 0), ot = !be && Y, Ae = D ? o.priceScaleId ?? (le === 0 ? "left" : "right") : j || !x || le === 0 ? "right" : `scale-${le}`;
532
+ x && ne.push({
542
533
  priceScaleId: Ae || "right",
543
534
  shouldPreventNegativeAxis: ot,
544
- seriesIndex: re
535
+ seriesIndex: le
545
536
  });
546
- const $e = (j || !S) && n !== void 0 && typeof n == "number", rt = ne.get(o.label) ?? [], nt = (g) => {
537
+ const $e = (j || !x) && n !== void 0 && typeof n == "number", rt = ae.get(o.label) ?? [], nt = (g) => {
547
538
  const z = g();
548
539
  if (z?.priceRange) {
549
540
  $e && (z.priceRange.minValue = n);
@@ -551,13 +542,13 @@ function Ot({
551
542
  H < z.priceRange.minValue && (z.priceRange.minValue = H), H > z.priceRange.maxValue && (z.priceRange.maxValue = H);
552
543
  }
553
544
  return z;
554
- }, Ge = v.get(o.label) ?? d[0], je = Ge.formatter, lt = Ge.tickmarksFormatter, Se = {
555
- lineColor: D,
545
+ }, Ge = y.get(o.label) ?? h[0], je = Ge.formatter, lt = Ge.tickmarksFormatter, ve = {
546
+ lineColor: I,
556
547
  topColor: T,
557
- bottomColor: $,
548
+ bottomColor: G,
558
549
  priceScaleId: Ae,
559
550
  ...o.seriesType === "line" && {
560
- lineStyle: o.lineStyle ?? te.Solid
551
+ lineStyle: o.lineStyle ?? re.Solid
561
552
  },
562
553
  priceFormat: {
563
554
  type: "custom",
@@ -569,44 +560,43 @@ function Ot({
569
560
  },
570
561
  autoscaleInfoProvider: nt
571
562
  }, He = o.seriesType === "line";
572
- let F = y.current.get(o.label);
573
- const Y = o.data.map((g) => ({
563
+ let E = C.current.get(o.label);
564
+ const ee = o.data.map((g) => ({
574
565
  ...g,
575
566
  time: g.time
576
567
  }));
577
- if (K !== void 0 && Y.length > 0 && Number(Y[0].time) > K) {
578
- const g = Number(Y[0].time), z = g - K, H = 86400, at = z > 180 * H ? 7 * H : z > 30 * H ? H : 6 * 3600, Oe = [];
579
- for (let ye = K; ye < g; ye += at)
580
- Oe.push({ time: ye });
581
- Y.unshift(...Oe);
568
+ if (J !== void 0 && ee.length > 0 && Number(ee[0].time) > J) {
569
+ const g = Number(ee[0].time), z = g - J, H = 86400, at = z > 180 * H ? 7 * H : z > 30 * H ? H : 6 * 3600, Xe = [];
570
+ for (let Se = J; Se < g; Se += at)
571
+ Xe.push({ time: Se });
572
+ ee.unshift(...Xe);
582
573
  }
583
- F && F.seriesType() !== (He ? "Line" : "Area") && (t.removeSeries(F), y.current.delete(o.label), F = void 0), F ? (F.applyOptions(Se), F.setData(Y)) : (He ? F = t.addSeries(ct, {
584
- ...Q,
585
- ...Se
586
- }) : F = t.addSeries(ut, {
587
- ...Q,
588
- ...Se
589
- }), F.setData(Y), y.current.set(o.label, F)), re++;
574
+ E && E.seriesType() !== (He ? "Line" : "Area") && (e.removeSeries(E), C.current.delete(o.label), E = void 0), E ? (E.applyOptions(ve), E.setData(ee)) : (He ? E = e.addSeries(ct, {
575
+ ...U,
576
+ ...ve
577
+ }) : E = e.addSeries(ut, {
578
+ ...U,
579
+ ...ve
580
+ }), E.setData(ee), C.current.set(o.label, E)), le++;
590
581
  }
591
- if (I)
582
+ if (D)
592
583
  try {
593
- const r = t.priceScale("left"), o = t.priceScale("right"), m = {
584
+ const r = e.priceScale("left"), o = e.priceScale("right"), d = {
594
585
  visible: !V,
595
586
  autoScale: !0,
596
587
  scaleMargins: { top: 0.1, bottom: 0.1 },
597
588
  alignLabels: !0,
598
- borderVisible: !0,
599
- borderColor: "rgba(224, 227, 235, 0.1)",
600
589
  entireTextOnly: !1,
601
- textColor: k
590
+ textColor: k,
591
+ ...v?.rightPriceScale
602
592
  };
603
- r?.applyOptions(m), o?.applyOptions(m);
593
+ r?.applyOptions(d), o?.applyOptions(d);
604
594
  } catch {
605
595
  }
606
- else if (S && oe.length > 0)
607
- for (const r of oe)
596
+ else if (x && ne.length > 0)
597
+ for (const r of ne)
608
598
  try {
609
- const o = t.priceScale(r.priceScaleId);
599
+ const o = e.priceScale(r.priceScaleId);
610
600
  o && o.applyOptions({
611
601
  visible: !1,
612
602
  autoScale: !0,
@@ -619,8 +609,6 @@ function Ot({
619
609
  }
620
610
  },
621
611
  alignLabels: !0,
622
- borderVisible: !0,
623
- borderColor: "rgba(224, 227, 235, 0.1)",
624
612
  entireTextOnly: !1,
625
613
  textColor: k
626
614
  });
@@ -630,9 +618,9 @@ function Ot({
630
618
  o
631
619
  );
632
620
  }
633
- else if (!S)
621
+ else if (!x)
634
622
  try {
635
- const r = t.priceScale("right");
623
+ const r = e.priceScale("right");
636
624
  r && r.applyOptions({
637
625
  visible: !V,
638
626
  autoScale: !0,
@@ -645,146 +633,147 @@ function Ot({
645
633
  }
646
634
  },
647
635
  alignLabels: !0,
648
- borderVisible: !0,
649
- borderColor: "rgba(224, 227, 235, 0.1)",
650
636
  entireTextOnly: !1,
651
- textColor: k
637
+ textColor: k,
638
+ ...v?.rightPriceScale
652
639
  });
653
640
  } catch {
654
641
  }
655
- if (n !== void 0 && !V && (j || !S) && t.applyOptions({
642
+ if (n !== void 0 && !V && (j || !x) && e.applyOptions({
656
643
  handleScroll: {
657
644
  vertTouchDrag: !1
658
645
  }
659
- }), X.length > 0) {
660
- const r = X.map((o) => Number(o.time)).filter((o) => Number.isFinite(o));
646
+ }), Z.length > 0) {
647
+ const r = Z.map((o) => Number(o.time)).filter((o) => Number.isFinite(o));
661
648
  if (r.length > 0) {
662
- const o = Math.min(...r), m = K !== void 0 ? Math.min(K, o) : o, D = Math.max(...r);
663
- if (Number(m) <= Number(D))
649
+ const o = Math.min(...r), d = J !== void 0 ? Math.min(J, o) : o, I = Math.max(...r);
650
+ if (Number(d) <= Number(I))
664
651
  try {
665
- t.timeScale().setVisibleRange({ from: m, to: D });
652
+ e.timeScale().setVisibleRange({ from: d, to: I });
666
653
  } catch {
667
654
  try {
668
- t.timeScale().fitContent();
655
+ e.timeScale().fitContent();
669
656
  } catch {
670
657
  }
671
658
  }
672
659
  }
673
660
  }
674
- Le.current && (Le.current = !1);
675
- const ve = /* @__PURE__ */ new Map();
676
- for (const r of e)
677
- r.data.length > 0 && ve.set(r.label, r.data[r.data.length - 1]);
678
- be(ve.size > 0 ? ve : void 0);
661
+ Ve.current && (Ve.current = !1), v && e.applyOptions(v);
662
+ const ge = /* @__PURE__ */ new Map();
663
+ for (const r of t)
664
+ r.data.length > 0 && ge.set(r.label, r.data[r.data.length - 1]);
665
+ pe(ge.size > 0 ? ge : void 0);
679
666
  }, [
680
- e,
681
- X,
667
+ Q,
668
+ t,
669
+ Z,
682
670
  c,
683
671
  b,
684
672
  V,
685
673
  j,
686
- I,
674
+ D,
675
+ we,
676
+ _e,
687
677
  Ne,
688
- Te,
689
- Ve,
690
678
  Pe,
691
- K,
679
+ J,
692
680
  R,
693
- E
694
- ]), G(() => {
695
- const t = W.current;
696
- if (!t || e.length === 0) return;
697
- const i = e.length === 1;
681
+ A,
682
+ v
683
+ ]), W(() => {
684
+ const e = B.current;
685
+ if (!e || t.length === 0) return;
686
+ const i = t.length === 1;
698
687
  let n;
699
- for (const a of e)
700
- if (a.data.length > 0) {
701
- n = a.data[a.data.length - 1].time;
688
+ for (const l of t)
689
+ if (l.data.length > 0) {
690
+ n = l.data[l.data.length - 1].time;
702
691
  break;
703
692
  }
704
693
  if (!n) return;
705
- const s = (a) => {
706
- const { time: f = n, seriesData: d, point: v } = a || {}, C = Array.from(y.current.values());
707
- if (!v || !f) {
708
- const _ = /* @__PURE__ */ new Map();
709
- for (const p of e)
710
- p.data.length > 0 && _.set(p.label, p.data[p.data.length - 1]);
711
- if (be(_.size > 0 ? _ : void 0), i || j || me)
694
+ const s = (l) => {
695
+ const { time: f = n, seriesData: h, point: y } = l || {}, S = Array.from(C.current.values());
696
+ if (!y || !f) {
697
+ const N = /* @__PURE__ */ new Map();
698
+ for (const p of t)
699
+ p.data.length > 0 && N.set(p.label, p.data[p.data.length - 1]);
700
+ if (pe(N.size > 0 ? N : void 0), i || j || he)
712
701
  q(null);
713
- else if (C[0] && n) {
714
- const S = t.timeScale().timeToCoordinate(n), M = e[0];
702
+ else if (S[0] && n) {
703
+ const x = e.timeScale().timeToCoordinate(n), M = t[0];
715
704
  if (M.data.length > 0) {
716
- const k = M.data[M.data.length - 1].value, N = C[0].priceToCoordinate(k);
717
- S !== null && N !== null && q({ x: S, y: N });
705
+ const k = M.data[M.data.length - 1].value, P = S[0].priceToCoordinate(k);
706
+ x !== null && P !== null && q({ x, y: P });
718
707
  }
719
708
  }
720
709
  return;
721
710
  }
722
- const A = /* @__PURE__ */ new Map();
723
- let P;
724
- for (let _ = 0; _ < e.length; _++) {
725
- const p = e[_], S = y.current.get(p.label);
726
- if (!S) continue;
727
- const M = d?.get(S), k = M && "value" in M ? M.value : void 0;
728
- let N;
711
+ const $ = /* @__PURE__ */ new Map();
712
+ let L;
713
+ for (let N = 0; N < t.length; N++) {
714
+ const p = t[N], x = C.current.get(p.label);
715
+ if (!x) continue;
716
+ const M = h?.get(x), k = M && "value" in M ? M.value : void 0;
717
+ let P;
729
718
  if (k !== void 0)
730
- N = k;
719
+ P = k;
731
720
  else if (i) {
732
- const Z = Number(f), Q = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
733
- Z < Q ? N = Number.NaN : N = p.data[p.data.length - 1]?.value ?? 0;
721
+ const K = Number(f), U = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
722
+ K < U ? P = Number.NaN : P = p.data[p.data.length - 1]?.value ?? 0;
734
723
  } else {
735
- const Z = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
736
- if (Number(f) < Z) continue;
737
- N = Lt(p.data, Number(f));
724
+ const K = p.data.length > 0 ? Number(p.data[0].time) : Number.POSITIVE_INFINITY;
725
+ if (Number(f) < K) continue;
726
+ P = Lt(p.data, Number(f));
738
727
  }
739
- Number.isNaN(N) || (P === void 0 && (P = N), A.set(p.label, { value: N, time: f }));
728
+ Number.isNaN(P) || (L === void 0 && (L = P), $.set(p.label, { value: P, time: f }));
740
729
  }
741
- if (be(A), P !== void 0 && C[0]) {
742
- const p = t.timeScale().timeToCoordinate(f), S = C[0].priceToCoordinate(P);
743
- if (p !== null && S !== null) {
744
- const M = B.current;
730
+ if (pe($), L !== void 0 && S[0]) {
731
+ const p = e.timeScale().timeToCoordinate(f), x = S[0].priceToCoordinate(L);
732
+ if (p !== null && x !== null) {
733
+ const M = F.current;
745
734
  if (M) {
746
735
  const k = M.querySelector(
747
736
  ".LightweightChart"
748
737
  );
749
738
  if (k) {
750
- const N = k.getBoundingClientRect(), Z = M.getBoundingClientRect(), Q = p + (N.left - Z.left), oe = S + (N.top - Z.top);
751
- q({ x: Q, y: oe });
739
+ const P = k.getBoundingClientRect(), K = M.getBoundingClientRect(), U = p + (P.left - K.left), ne = x + (P.top - K.top);
740
+ q({ x: U, y: ne });
752
741
  } else
753
- q({ x: p, y: S });
742
+ q({ x: p, y: x });
754
743
  } else
755
- q({ x: p, y: S });
744
+ q({ x: p, y: x });
756
745
  } else
757
746
  q(null);
758
747
  } else
759
748
  q(null);
760
749
  };
761
- return t.subscribeCrosshairMove(s), V && t.subscribeClick(s), !i && !j && !me && requestAnimationFrame(() => {
762
- const a = Array.from(y.current.values());
763
- if (a[0] && n && e[0]?.data.length > 0) {
764
- const d = t.timeScale().timeToCoordinate(n), v = e[0].data[e[0].data.length - 1].value, C = a[0].priceToCoordinate(v);
765
- d !== null && C !== null && q({ x: d, y: C });
750
+ return e.subscribeCrosshairMove(s), V && e.subscribeClick(s), !i && !j && !he && requestAnimationFrame(() => {
751
+ const l = Array.from(C.current.values());
752
+ if (l[0] && n && t[0]?.data.length > 0) {
753
+ const h = e.timeScale().timeToCoordinate(n), y = t[0].data[t[0].data.length - 1].value, S = l[0].priceToCoordinate(y);
754
+ h !== null && S !== null && q({ x: h, y: S });
766
755
  }
767
756
  }), () => {
768
- t.unsubscribeCrosshairMove(s), V && t.unsubscribeClick(s);
757
+ e.unsubscribeCrosshairMove(s), V && e.unsubscribeClick(s);
769
758
  };
770
- }, [e, j, V, me]), G(() => {
771
- const t = W.current;
772
- if (!t || e.length === 0) return;
773
- const i = t.timeScale(), n = () => {
774
- const s = Re.current;
759
+ }, [t, j, V, he]), W(() => {
760
+ const e = B.current;
761
+ if (!e || t.length === 0) return;
762
+ const i = e.timeScale(), n = () => {
763
+ const s = Le.current;
775
764
  if (s.length === 0) return;
776
- const a = i.getVisibleRange();
777
- if (!a) return;
778
- const f = Number(a.from), d = Number(a.to);
779
- for (const v of s) {
780
- const C = [];
781
- for (const A of e)
782
- if (v.labels.has(A.label))
783
- for (const P of A.data) {
784
- const _ = Number(P.time);
785
- _ >= f && _ <= d && C.push(P.value);
765
+ const l = i.getVisibleRange();
766
+ if (!l) return;
767
+ const f = Number(l.from), h = Number(l.to);
768
+ for (const y of s) {
769
+ const S = [];
770
+ for (const $ of t)
771
+ if (y.labels.has($.label))
772
+ for (const L of $.data) {
773
+ const N = Number(L.time);
774
+ N >= f && N <= h && S.push(L.value);
786
775
  }
787
- C.length > 0 && v.updateVisibleRange(C);
776
+ S.length > 0 && y.updateVisibleRange(S);
788
777
  }
789
778
  };
790
779
  return i.subscribeVisibleLogicalRangeChange(n), () => {
@@ -792,58 +781,58 @@ function Ot({
792
781
  n
793
782
  );
794
783
  };
795
- }, [e]), G(() => {
796
- const t = W.current, i = Array.from(y.current.values()), n = [];
797
- if (t && i.length > 0 && x) {
798
- const s = pt(), a = i[0];
799
- for (const f of x) {
800
- const d = {
784
+ }, [t]), W(() => {
785
+ const e = B.current, i = Array.from(C.current.values()), n = [];
786
+ if (e && i.length > 0 && w) {
787
+ const s = pt(), l = i[0];
788
+ for (const f of w) {
789
+ const h = {
801
790
  ...s,
802
791
  ...f.options || {}
803
792
  };
804
- d.color && (d.color = ee(d.color, d.color));
805
- const v = new Ct(t, a, f.xCoordinate, d);
806
- a.attachPrimitive(v), n.push(v);
793
+ h.color && (h.color = oe(h.color, h.color));
794
+ const y = new St(e, l, f.xCoordinate, h);
795
+ l.attachPrimitive(y), n.push(y);
807
796
  }
808
797
  }
809
798
  return () => {
810
799
  if (i.length > 0) {
811
800
  const s = i[0];
812
- for (const a of n)
801
+ for (const l of n)
813
802
  try {
814
- s.detachPrimitive(a);
803
+ s.detachPrimitive(l);
815
804
  } catch {
816
805
  }
817
806
  }
818
807
  };
819
- }, [x, e, ce]), G(() => {
820
- const t = [], i = [];
808
+ }, [w, t, Q]), W(() => {
809
+ const e = [], i = [];
821
810
  if (R && R.length > 0) {
822
- const n = Array.from(y.current.values())[0], s = ee(
811
+ const n = Array.from(C.current.values())[0], s = oe(
823
812
  "hsl(var(--destructive))",
824
813
  "rgb(239, 68, 68)"
825
814
  );
826
- for (const a of R) {
827
- if (!Number.isFinite(a.price)) continue;
828
- const f = a.seriesLabel ? y.current.get(a.seriesLabel) : n;
815
+ for (const l of R) {
816
+ if (!Number.isFinite(l.price)) continue;
817
+ const f = l.seriesLabel ? C.current.get(l.seriesLabel) : n;
829
818
  if (!f) continue;
830
- const d = a.color ? ee(a.color, a.color) : s, v = a.lineWidth ?? 1, C = a.lineStyle ?? te.Dashed, A = f.createPriceLine({
831
- price: a.price,
832
- color: d,
833
- lineWidth: v,
834
- lineStyle: C,
835
- axisLabelVisible: a.axisLabelVisible ?? !0,
836
- title: a.title ?? ""
819
+ const h = l.color ? oe(l.color, l.color) : s, y = l.lineWidth ?? 1, S = l.lineStyle ?? re.Dashed, $ = f.createPriceLine({
820
+ price: l.price,
821
+ color: h,
822
+ lineWidth: y,
823
+ lineStyle: S,
824
+ axisLabelVisible: l.axisLabelVisible ?? !0,
825
+ title: l.title ?? ""
837
826
  });
838
- t.push({ series: f, line: A });
839
- const P = new Tt(
827
+ e.push({ series: f, line: $ });
828
+ const L = new Pt(
840
829
  f,
841
- a.price,
842
- d,
843
- v,
844
- C
830
+ l.price,
831
+ h,
832
+ y,
833
+ S
845
834
  );
846
- f.attachPrimitive(P), i.push({ series: f, primitive: P });
835
+ f.attachPrimitive(L), i.push({ series: f, primitive: L });
847
836
  }
848
837
  }
849
838
  return () => {
@@ -852,158 +841,158 @@ function Ot({
852
841
  n.detachPrimitive(s);
853
842
  } catch {
854
843
  }
855
- for (const { series: n, line: s } of t)
844
+ for (const { series: n, line: s } of e)
856
845
  try {
857
846
  n.removePriceLine(s);
858
847
  } catch {
859
848
  }
860
849
  };
861
- }, [R, e, ce]), G(() => {
862
- const t = [];
863
- if (E && E.length > 0) {
864
- const i = Array.from(y.current.values())[0], n = "rgba(239, 68, 68, 0.12)";
865
- for (const s of E) {
866
- const a = s.seriesLabel ? y.current.get(s.seriesLabel) : i;
867
- if (!a) continue;
868
- const f = s.color ? ee(s.color, n) : n, d = new xt(
869
- a,
850
+ }, [R, t, Q]), W(() => {
851
+ const e = [];
852
+ if (A && A.length > 0) {
853
+ const i = Array.from(C.current.values())[0], n = "rgba(239, 68, 68, 0.12)";
854
+ for (const s of A) {
855
+ const l = s.seriesLabel ? C.current.get(s.seriesLabel) : i;
856
+ if (!l) continue;
857
+ const f = s.color ? oe(s.color, n) : n, h = new xt(
858
+ l,
870
859
  s.priceTop,
871
860
  s.priceBottom,
872
861
  f
873
862
  );
874
- a.attachPrimitive(d), t.push({ series: a, zone: d });
863
+ l.attachPrimitive(h), e.push({ series: l, zone: h });
875
864
  }
876
865
  }
877
866
  return () => {
878
- for (const { series: i, zone: n } of t)
867
+ for (const { series: i, zone: n } of e)
879
868
  try {
880
869
  i.detachPrimitive(n);
881
870
  } catch {
882
871
  }
883
872
  };
884
- }, [E, e, ce]), G(() => {
885
- const t = W.current;
886
- if (!t || !x?.length) {
887
- Ie([]);
873
+ }, [A, t, Q]), W(() => {
874
+ const e = B.current;
875
+ if (!e || !w?.length) {
876
+ De([]);
888
877
  return;
889
878
  }
890
879
  const i = () => {
891
- const a = t.timeScale(), f = x.map((d) => a.timeToCoordinate(d.xCoordinate) ?? null);
892
- Ie(f), B.current && Be(B.current.clientWidth);
880
+ const l = e.timeScale(), f = w.map((h) => l.timeToCoordinate(h.xCoordinate) ?? null);
881
+ De(f), F.current && Be(F.current.clientWidth);
893
882
  };
894
883
  i();
895
- const n = t.timeScale(), s = () => {
884
+ const n = e.timeScale(), s = () => {
896
885
  i();
897
886
  };
898
887
  return n.subscribeVisibleLogicalRangeChange(s), () => {
899
888
  n.unsubscribeVisibleLogicalRangeChange(s);
900
889
  };
901
- }, [x, e, ce]), ft(() => {
902
- et((t) => {
890
+ }, [w, t, Q]), ft(() => {
891
+ et((e) => {
903
892
  const i = {};
904
893
  let n = !1;
905
- for (const [s, a] of Fe.current) {
906
- if (!a) continue;
907
- const f = a.offsetWidth;
908
- i[s] = f, t[s] !== f && (n = !0);
894
+ for (const [s, l] of Fe.current) {
895
+ if (!l) continue;
896
+ const f = l.offsetWidth;
897
+ i[s] = f, e[s] !== f && (n = !0);
909
898
  }
910
- return Object.keys(t).length !== Object.keys(i).length && (n = !0), n ? i : t;
899
+ return Object.keys(e).length !== Object.keys(i).length && (n = !0), n ? i : e;
911
900
  });
912
901
  });
913
- const ue = e.length === 1, ze = xe.useMemo(() => {
914
- if (ue && e.length > 0) {
915
- const t = e[0];
916
- if (t.data.length > 0)
917
- return t.data[t.data.length - 1];
902
+ const se = t.length === 1, Ee = Ce.useMemo(() => {
903
+ if (se && t.length > 0) {
904
+ const e = t[0];
905
+ if (e.data.length > 0)
906
+ return e.data[e.data.length - 1];
918
907
  }
919
- }, [ue, e]);
920
- return /* @__PURE__ */ le(
908
+ }, [se, t]);
909
+ return /* @__PURE__ */ ie(
921
910
  "div",
922
911
  {
923
- ref: B,
924
- className: ae(
912
+ ref: F,
913
+ className: O(
925
914
  "relative z-[1] w-full h-full overflow-hidden p-0",
926
- l
915
+ a
927
916
  ),
928
917
  children: [
929
- de != null && de !== !1 && ue ? /* @__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: de }) }) : Je && ue && ze && /* @__PURE__ */ w(
918
+ fe != null && fe !== !1 && se ? /* @__PURE__ */ _("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ _("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: fe }) }) : Qe && se && Ee && /* @__PURE__ */ _(
930
919
  bt,
931
920
  {
932
- point: ze,
921
+ point: Ee,
933
922
  xMeasureUnit: c,
934
923
  yMeasureUnit: b,
935
- decimals: he
924
+ decimals: ue
936
925
  }
937
926
  ),
938
- Me && ke && /* @__PURE__ */ w(
927
+ Me && ke && /* @__PURE__ */ _(
939
928
  vt,
940
929
  {
941
930
  points: Me,
942
931
  xMeasureUnit: c,
943
932
  yMeasureUnit: b,
944
- series: e,
933
+ series: t,
945
934
  position: ke,
946
- containerRef: B,
947
- decimals: he
935
+ containerRef: F,
936
+ decimals: ue
948
937
  }
949
938
  ),
950
- u && /* @__PURE__ */ w(Mt, { series: e, onUnselect: h }),
951
- x && x.length > 0 && De.length === x.length && /* @__PURE__ */ w(
939
+ u && /* @__PURE__ */ _(Mt, { series: t, onUnselect: m }),
940
+ w && w.length > 0 && Ie.length === w.length && /* @__PURE__ */ _(
952
941
  "div",
953
942
  {
954
943
  className: "absolute inset-0 z-[5] pointer-events-none",
955
944
  "aria-hidden": !0,
956
- children: x.map((t, i) => {
957
- const n = De[i], s = t.options ?? {}, a = s.showLabel !== !1;
958
- if (n === null || !a) return null;
959
- const { labelText: f, valueStr: d } = Vt(
945
+ children: w.map((e, i) => {
946
+ const n = Ie[i], s = e.options ?? {};
947
+ if (n === null) return null;
948
+ const { labelText: l, valueStr: f } = Tt(
960
949
  s,
961
950
  b,
962
- he
963
- ), v = s.tooltipText ?? "";
964
- if (!(f || d || v)) return null;
965
- const A = s.labelBackgroundColor ?? s.color ?? "hsl(var(--background))", P = s.labelTextColor ?? "hsl(var(--foreground))", _ = `${String(t.xCoordinate)}-${f}-${v}`, p = Pt(
951
+ ue
952
+ ), h = s.tooltipText ?? "";
953
+ if (!(l || f || h)) return null;
954
+ const S = s.labelBackgroundColor ?? s.color ?? "hsl(var(--background))", $ = s.labelTextColor ?? "hsl(var(--foreground))", L = `${String(e.xCoordinate)}-${l}-${h}`, N = Vt(
966
955
  n,
967
- Ye,
956
+ Oe,
968
957
  Ue[i]
969
958
  );
970
- return /* @__PURE__ */ le(
959
+ return /* @__PURE__ */ ie(
971
960
  "div",
972
961
  {
973
- ref: (S) => {
974
- Fe.current.set(i, S);
962
+ ref: (p) => {
963
+ Fe.current.set(i, p);
975
964
  },
976
- className: ae(
965
+ className: O(
977
966
  "group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
978
- v && "pointer-events-auto cursor-default"
967
+ h && "pointer-events-auto cursor-default"
979
968
  ),
980
969
  style: {
981
- ...p,
982
- backgroundColor: A,
983
- color: P
970
+ ...N,
971
+ backgroundColor: S,
972
+ color: $
984
973
  },
985
974
  children: [
986
- f && /* @__PURE__ */ w("span", { className: "block", children: f }),
987
- d && /* @__PURE__ */ w("span", { className: ae("block", f && "mt-0.5"), children: d }),
988
- v && /* @__PURE__ */ w(
975
+ l && /* @__PURE__ */ _("span", { className: "block", children: l }),
976
+ f && /* @__PURE__ */ _("span", { className: O("block", l && "mt-0.5"), children: f }),
977
+ h && /* @__PURE__ */ _(
989
978
  "span",
990
979
  {
991
980
  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",
992
981
  role: "tooltip",
993
- children: v
982
+ children: h
994
983
  }
995
984
  )
996
985
  ]
997
986
  },
998
- _
987
+ L
999
988
  );
1000
989
  })
1001
990
  }
1002
991
  ),
1003
- /* @__PURE__ */ w(
992
+ /* @__PURE__ */ _(
1004
993
  "div",
1005
994
  {
1006
- ref: ge,
995
+ ref: de,
1007
996
  className: "LightweightChart w-full h-full overflow-hidden"
1008
997
  }
1009
998
  )
@@ -1012,49 +1001,61 @@ function Ot({
1012
1001
  );
1013
1002
  }
1014
1003
  function Mt({
1015
- series: e,
1016
- onUnselect: l,
1004
+ series: t,
1005
+ onUnselect: a,
1017
1006
  inline: u = !1
1018
1007
  }) {
1019
- const h = e.every((c) => c.data.length === 0);
1020
- return /* @__PURE__ */ w(
1008
+ const m = t.every((c) => c.data.length === 0);
1009
+ return /* @__PURE__ */ _(
1021
1010
  "div",
1022
1011
  {
1023
- className: ae(
1024
- "flex flex-wrap gap-2",
1025
- u ? "items-center" : "absolute top-0 left-2 z-[10]"
1012
+ className: O(
1013
+ "flex flex-wrap",
1014
+ u ? "items-center justify-center gap-6" : "absolute top-0 left-2 z-[10] gap-2"
1026
1015
  ),
1027
- children: e.map((c, b) => {
1028
- const L = Ke(b), x = (c.lineColor ?? c.color) || L.line, R = !h && c.data.length === 0;
1029
- return /* @__PURE__ */ le(
1016
+ children: t.map((c, b) => {
1017
+ const v = Je(b), w = (c.lineColor ?? c.color) || v.line, R = !m && c.data.length === 0;
1018
+ return /* @__PURE__ */ ie(
1030
1019
  "div",
1031
1020
  {
1032
- className: ae(
1033
- "flex items-center gap-1.5 px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
1021
+ className: O(
1022
+ "flex items-center gap-1.5",
1023
+ !u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
1034
1024
  R && "opacity-50"
1035
1025
  ),
1036
1026
  children: [
1037
- /* @__PURE__ */ w(
1027
+ /* @__PURE__ */ _(
1038
1028
  "div",
1039
1029
  {
1040
- className: "w-3 h-3 rounded-sm",
1041
- style: { backgroundColor: x }
1030
+ className: O(
1031
+ u ? "size-2 rounded-full" : "h-3 w-3 rounded-sm"
1032
+ ),
1033
+ style: { backgroundColor: w }
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ ie(
1037
+ "span",
1038
+ {
1039
+ className: O(
1040
+ "font-medium text-foreground",
1041
+ u ? "text-sm" : "text-[10px] sm:text-xs"
1042
+ ),
1043
+ children: [
1044
+ c.label,
1045
+ R && " (no data)"
1046
+ ]
1042
1047
  }
1043
1048
  ),
1044
- /* @__PURE__ */ le("span", { className: "text-[10px] sm:text-xs font-medium text-foreground", children: [
1045
- c.label,
1046
- R && " (no data)"
1047
- ] }),
1048
- l && /* @__PURE__ */ w(
1049
+ a && /* @__PURE__ */ _(
1049
1050
  "button",
1050
1051
  {
1051
1052
  type: "button",
1052
- onClick: (E) => {
1053
- E.stopPropagation(), l(c.label);
1053
+ onClick: (A) => {
1054
+ A.stopPropagation(), a(c.label);
1054
1055
  },
1055
1056
  className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
1056
1057
  "aria-label": `Remove ${c.label}`,
1057
- children: /* @__PURE__ */ le(
1058
+ children: /* @__PURE__ */ ie(
1058
1059
  "svg",
1059
1060
  {
1060
1061
  xmlns: "http://www.w3.org/2000/svg",
@@ -1069,9 +1070,9 @@ function Mt({
1069
1070
  className: "text-muted-foreground hover:text-foreground",
1070
1071
  "aria-hidden": "true",
1071
1072
  children: [
1072
- /* @__PURE__ */ w("title", { children: "Close" }),
1073
- /* @__PURE__ */ w("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1074
- /* @__PURE__ */ w("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1073
+ /* @__PURE__ */ _("title", { children: "Close" }),
1074
+ /* @__PURE__ */ _("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1075
+ /* @__PURE__ */ _("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1075
1076
  ]
1076
1077
  }
1077
1078
  )
@@ -1086,12 +1087,12 @@ function Mt({
1086
1087
  );
1087
1088
  }
1088
1089
  export {
1089
- _e as DEFAULT_SERIES_COLORS,
1090
- Ot as Graph,
1090
+ xe as DEFAULT_SERIES_COLORS,
1091
+ Xt as Graph,
1091
1092
  Mt as GraphLegend,
1092
- Ze as VERTICAL_LINE_LABEL_EDGE_PADDING,
1093
- Ke as getSeriesColorPalette,
1093
+ Ke as VERTICAL_LINE_LABEL_EDGE_PADDING,
1094
+ Je as getSeriesColorPalette,
1094
1095
  Lt as getStepForwardValue,
1095
- Pt as getVerticalLineLabelStyle,
1096
- Vt as getVerticalLineTooltipContent
1096
+ Vt as getVerticalLineLabelStyle,
1097
+ Tt as getVerticalLineTooltipContent
1097
1098
  };