@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.
- package/dist/cjs/components/assets-list-cell/assets-list-cell.cjs +1 -1
- package/dist/cjs/components/badge/badge.cjs +1 -1
- package/dist/cjs/components/badge/chip.cjs +1 -0
- package/dist/cjs/components/badge/index.cjs +1 -1
- package/dist/cjs/components/base/borrow-rate-block/borrow-rate-block.cjs +1 -1
- package/dist/cjs/components/base/chart-with-side-card/chart-with-side-card.cjs +1 -1
- package/dist/cjs/components/base/history-chart/history-chart.cjs +1 -1
- package/dist/cjs/components/base/index.cjs +1 -1
- package/dist/cjs/components/base/info-list/info-list.cjs +1 -1
- package/dist/cjs/components/base/leverage-input/leverage-input.cjs +1 -1
- package/dist/cjs/components/base/leverage-preset-chips/constants.cjs +1 -0
- package/dist/cjs/components/base/leverage-preset-chips/index.cjs +1 -0
- package/dist/cjs/components/base/leverage-preset-chips/leverage-preset-chips.cjs +1 -0
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/constants.cjs +1 -1
- package/dist/cjs/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/base/title-meta/constants.cjs +1 -1
- package/dist/cjs/components/base/title-meta/title-meta.cjs +1 -1
- package/dist/cjs/components/base/values/index.cjs +1 -1
- package/dist/cjs/components/base/values/position-status-badge.cjs +1 -0
- package/dist/cjs/components/base/values/position-type-badge.cjs +1 -1
- package/dist/cjs/components/base-table/base-table-line.cjs +1 -0
- package/dist/cjs/components/base-table/base-table.cjs +1 -0
- package/dist/cjs/components/base-table/constants.cjs +1 -0
- package/dist/cjs/components/base-table/index.cjs +1 -0
- package/dist/cjs/components/base-table/types.cjs +1 -0
- package/dist/cjs/components/block-sync-pill/block-sync-pill.cjs +1 -1
- package/dist/cjs/components/checkbox/checkbox-labeled.cjs +1 -1
- package/dist/cjs/components/client-adapters/styled-rounded-image/styled-rounded-image.cjs +1 -1
- package/dist/cjs/components/collateral-allocation-tooltip/allocation-wheel.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/collateral-allocation-tooltip.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/constants.cjs +1 -0
- package/dist/cjs/components/collateral-allocation-tooltip/index.cjs +1 -0
- package/dist/cjs/components/composites/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/constants.cjs +1 -0
- package/dist/cjs/components/composites/pool-assets-table/index.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-head.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table-row.cjs +1 -1
- package/dist/cjs/components/composites/pool-assets-table/pool-assets-table.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/index.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.cjs +1 -0
- package/dist/cjs/components/composites/tx-preview/confirm/index.cjs +1 -1
- package/dist/cjs/components/composites/tx-preview/index.cjs +1 -1
- package/dist/cjs/components/compound-apy/compound-apy.cjs +1 -1
- package/dist/cjs/components/filter/filter-chip.cjs +1 -1
- package/dist/cjs/components/graph/default-config.cjs +1 -1
- package/dist/cjs/components/graph/graph-view.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/hf-indicator/hf-indicator.cjs +1 -0
- package/dist/cjs/components/hf-indicator/index.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/infinite-scroll/index.cjs +1 -0
- package/dist/cjs/components/infinite-scroll/infinite-scroll-wrapper.cjs +1 -0
- package/dist/cjs/components/name-cell/index.cjs +1 -0
- package/dist/cjs/components/name-cell/name-cell.cjs +1 -0
- package/dist/cjs/components/network-icon/index.cjs +1 -1
- package/dist/cjs/components/network-icon/network-indicator.cjs +1 -0
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/components/with-copy/with-copy.cjs +1 -1
- package/dist/cjs/components/yield-breakdown-tooltip/yield-breakdown-tooltip.cjs +1 -1
- package/dist/cjs/configs/tailwind-preset.cjs +1 -1
- package/dist/cjs/hooks/index.cjs +1 -1
- package/dist/cjs/hooks/use-observed-width-key.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/cjs/utils/format-money.cjs +1 -1
- package/dist/cjs/utils/index.cjs +1 -1
- package/dist/cjs/utils/leverage-presets.cjs +1 -0
- package/dist/esm/components/assets-list-cell/assets-list-cell.js +161 -159
- package/dist/esm/components/badge/badge.js +14 -8
- package/dist/esm/components/badge/chip.js +47 -0
- package/dist/esm/components/badge/index.js +8 -3
- package/dist/esm/components/base/borrow-rate-block/borrow-rate-block.js +3 -2
- package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
- package/dist/esm/components/base/history-chart/history-chart.js +86 -46
- package/dist/esm/components/base/index.js +144 -138
- package/dist/esm/components/base/info-list/info-list.js +7 -8
- package/dist/esm/components/base/leverage-input/leverage-input.js +1 -1
- package/dist/esm/components/base/leverage-preset-chips/constants.js +7 -0
- package/dist/esm/components/base/leverage-preset-chips/index.js +6 -0
- package/dist/esm/components/base/leverage-preset-chips/leverage-preset-chips.js +39 -0
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +23 -30
- package/dist/esm/components/base/strategy-apy-breakdown-card/constants.js +3 -2
- package/dist/esm/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.js +194 -32
- package/dist/esm/components/base/title-meta/constants.js +1 -0
- package/dist/esm/components/base/title-meta/title-meta.js +53 -33
- package/dist/esm/components/base/values/index.js +16 -14
- package/dist/esm/components/base/values/position-status-badge.js +26 -0
- package/dist/esm/components/base/values/position-type-badge.js +7 -6
- package/dist/esm/components/base-table/base-table-line.js +117 -0
- package/dist/esm/components/base-table/base-table.js +110 -0
- package/dist/esm/components/base-table/constants.js +12 -0
- package/dist/esm/components/base-table/index.js +9 -0
- package/dist/esm/components/base-table/types.js +1 -0
- package/dist/esm/components/block-sync-pill/block-sync-pill.js +9 -6
- package/dist/esm/components/checkbox/checkbox-labeled.js +7 -4
- package/dist/esm/components/client-adapters/styled-rounded-image/styled-rounded-image.js +7 -4
- package/dist/esm/components/collateral-allocation-tooltip/allocation-wheel.js +71 -0
- package/dist/esm/components/collateral-allocation-tooltip/collateral-allocation-tooltip.js +102 -0
- package/dist/esm/components/collateral-allocation-tooltip/constants.js +12 -0
- package/dist/esm/components/collateral-allocation-tooltip/index.js +9 -0
- package/dist/esm/components/composites/index.js +31 -31
- package/dist/esm/components/composites/pool-assets-table/constants.js +9 -0
- package/dist/esm/components/composites/pool-assets-table/index.js +8 -6
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-head.js +52 -30
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table-row.js +108 -76
- package/dist/esm/components/composites/pool-assets-table/pool-assets-table.js +44 -26
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.js +109 -52
- package/dist/esm/components/composites/tx-preview/confirm/dialog/index.js +8 -10
- package/dist/esm/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.js +1 -0
- package/dist/esm/components/composites/tx-preview/confirm/index.js +24 -26
- package/dist/esm/components/composites/tx-preview/index.js +24 -26
- package/dist/esm/components/compound-apy/compound-apy.js +85 -80
- package/dist/esm/components/filter/filter-chip.js +1 -0
- package/dist/esm/components/graph/default-config.js +20 -18
- package/dist/esm/components/graph/graph-view.js +32 -31
- package/dist/esm/components/graph/graph.js +459 -458
- package/dist/esm/components/hf-indicator/hf-indicator.js +33 -0
- package/dist/esm/components/hf-indicator/index.js +4 -0
- package/dist/esm/components/index.js +732 -701
- package/dist/esm/components/infinite-scroll/index.js +4 -0
- package/dist/esm/components/infinite-scroll/infinite-scroll-wrapper.js +30 -0
- package/dist/esm/components/name-cell/index.js +4 -0
- package/dist/esm/components/name-cell/name-cell.js +35 -0
- package/dist/esm/components/network-icon/index.js +4 -2
- package/dist/esm/components/network-icon/network-indicator.js +82 -0
- package/dist/esm/components/trading-view/trading-view.js +193 -155
- package/dist/esm/components/with-copy/with-copy.js +7 -4
- package/dist/esm/components/yield-breakdown-tooltip/yield-breakdown-tooltip.js +112 -169
- package/dist/esm/configs/tailwind-preset.js +13 -1
- package/dist/esm/hooks/index.js +20 -18
- package/dist/esm/hooks/use-observed-width-key.js +24 -0
- package/dist/esm/index.js +881 -842
- package/dist/esm/locale/en.json.js +21 -18
- package/dist/esm/utils/format-money.js +59 -41
- package/dist/esm/utils/index.js +87 -83
- package/dist/esm/utils/leverage-presets.js +13 -0
- package/dist/globals.css +1 -1
- package/dist/types/components/assets-list-cell/assets-list-cell.d.ts +3 -0
- package/dist/types/components/badge/badge.d.ts +2 -1
- package/dist/types/components/badge/chip.d.ts +22 -0
- package/dist/types/components/badge/index.d.ts +1 -0
- package/dist/types/components/base/history-chart/history-chart.d.ts +13 -3
- package/dist/types/components/base/index.d.ts +1 -0
- package/dist/types/components/base/leverage-input/leverage-input.d.ts +1 -1
- package/dist/types/components/base/leverage-preset-chips/constants.d.ts +4 -0
- package/dist/types/components/base/leverage-preset-chips/index.d.ts +2 -0
- package/dist/types/components/base/leverage-preset-chips/leverage-preset-chips.d.ts +13 -0
- package/dist/types/components/base/liquidation-params-table/liquidation-params-table.d.ts +2 -2
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +4 -5
- package/dist/types/components/base/strategy-apy-breakdown-card/constants.d.ts +1 -0
- package/dist/types/components/base/strategy-apy-breakdown-card/strategy-apy-breakdown-card.d.ts +12 -4
- package/dist/types/components/base/title-meta/constants.d.ts +1 -0
- package/dist/types/components/base/title-meta/title-meta.d.ts +9 -1
- package/dist/types/components/base/values/index.d.ts +1 -0
- package/dist/types/components/base/values/position-status-badge.d.ts +7 -0
- package/dist/types/components/base/values/position-type-badge.d.ts +1 -1
- package/dist/types/components/base-table/base-table-line.d.ts +21 -0
- package/dist/types/components/base-table/base-table.d.ts +19 -0
- package/dist/types/components/base-table/constants.d.ts +8 -0
- package/dist/types/components/base-table/index.d.ts +3 -0
- package/dist/types/components/base-table/types.d.ts +37 -0
- package/dist/types/components/collateral-allocation-tooltip/allocation-wheel.d.ts +10 -0
- package/dist/types/components/collateral-allocation-tooltip/collateral-allocation-tooltip.d.ts +23 -0
- package/dist/types/components/collateral-allocation-tooltip/constants.d.ts +8 -0
- package/dist/types/components/collateral-allocation-tooltip/index.d.ts +3 -0
- package/dist/types/components/composites/pool-assets-table/constants.d.ts +6 -0
- package/dist/types/components/composites/pool-assets-table/index.d.ts +1 -0
- package/dist/types/components/composites/pool-assets-table/pool-assets-table-head.d.ts +1 -2
- package/dist/types/components/composites/pool-assets-table/pool-assets-table-row.d.ts +8 -8
- package/dist/types/components/composites/pool-assets-table/pool-assets-table.d.ts +7 -20
- package/dist/types/components/composites/pool-assets-table/types.d.ts +4 -12
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmShell.d.ts +23 -19
- package/dist/types/components/composites/tx-preview/confirm/dialog/index.d.ts +2 -2
- package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmPhase.d.ts +0 -3
- package/dist/types/components/composites/tx-preview/confirm/dialog/transactionConfirmShellTypes.d.ts +97 -0
- package/dist/types/components/graph/graph-view.d.ts +1 -1
- package/dist/types/components/graph/graph.d.ts +4 -0
- package/dist/types/components/hf-indicator/hf-indicator.d.ts +8 -0
- package/dist/types/components/hf-indicator/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +5 -0
- package/dist/types/components/infinite-scroll/index.d.ts +1 -0
- package/dist/types/components/infinite-scroll/infinite-scroll-wrapper.d.ts +11 -0
- package/dist/types/components/name-cell/index.d.ts +1 -0
- package/dist/types/components/name-cell/name-cell.d.ts +13 -0
- package/dist/types/components/network-icon/index.d.ts +1 -0
- package/dist/types/components/network-icon/network-indicator.d.ts +23 -0
- package/dist/types/components/trading-view/trading-view.d.ts +10 -3
- package/dist/types/components/yield-breakdown-tooltip/yield-breakdown-tooltip.d.ts +6 -8
- package/dist/types/configs/tailwind-preset.d.ts +12 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/use-observed-width-key.d.ts +8 -0
- package/dist/types/index.d.ts +6 -1
- package/dist/types/locale/en.json.d.ts +23 -18
- package/dist/types/utils/format-money.d.ts +11 -5
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/leverage-presets.d.ts +7 -0
- package/package.json +1 -1
- package/src/styles/base.css +30 -0
- package/src/styles/theme.css +16 -0
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.cjs +0 -1
- package/dist/cjs/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.cjs +0 -1
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.js +0 -177
- package/dist/esm/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.js +0 -54
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmModalView.d.ts +0 -17
- package/dist/types/components/composites/tx-preview/confirm/dialog/TransactionConfirmPageView.d.ts +0 -16
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createChart as it, CrosshairMode as st, LineStyle as
|
|
3
|
-
import * as
|
|
4
|
-
import { useRef as
|
|
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
|
|
7
|
-
import { resolveCSSColor as
|
|
8
|
-
import { getDefaultOptions as
|
|
9
|
-
import { getXFormatters as qe, formatExactValue as
|
|
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
|
|
13
|
-
class
|
|
12
|
+
import { VertLine as St } from "./plugins/vertical-line.js";
|
|
13
|
+
class Ct {
|
|
14
14
|
_yTop;
|
|
15
15
|
_yBottom;
|
|
16
16
|
_color;
|
|
17
|
-
constructor(
|
|
18
|
-
this._yTop =
|
|
17
|
+
constructor(a, u, m) {
|
|
18
|
+
this._yTop = a, this._yBottom = u, this._color = m;
|
|
19
19
|
}
|
|
20
|
-
draw(
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
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(
|
|
32
|
-
this._source =
|
|
31
|
+
constructor(a) {
|
|
32
|
+
this._source = a;
|
|
33
33
|
}
|
|
34
34
|
update() {
|
|
35
|
-
const
|
|
36
|
-
this._yTop = this._source.priceTop === void 0 ? null :
|
|
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
|
|
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(
|
|
53
|
-
this.series =
|
|
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
|
|
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(
|
|
63
|
-
switch (
|
|
64
|
-
case
|
|
65
|
-
return [
|
|
66
|
-
case
|
|
67
|
-
return [2 *
|
|
68
|
-
case
|
|
69
|
-
return [6 *
|
|
70
|
-
case
|
|
71
|
-
return [
|
|
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(
|
|
82
|
-
this._y =
|
|
81
|
+
constructor(a, u, m, c) {
|
|
82
|
+
this._y = a, this._color = u, this._lineWidth = m, this._lineStyle = c;
|
|
83
83
|
}
|
|
84
|
-
draw(
|
|
85
|
-
|
|
84
|
+
draw(a) {
|
|
85
|
+
a.useBitmapCoordinateSpace((u) => {
|
|
86
86
|
if (this._y === null) return;
|
|
87
|
-
const
|
|
88
|
-
|
|
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(
|
|
96
|
-
this._source =
|
|
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
|
|
119
|
+
class Pt {
|
|
120
120
|
series;
|
|
121
121
|
price;
|
|
122
122
|
color;
|
|
123
123
|
lineWidth;
|
|
124
124
|
lineStyle;
|
|
125
125
|
_paneViews;
|
|
126
|
-
constructor(
|
|
127
|
-
this.series =
|
|
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
|
|
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
|
|
137
|
-
const
|
|
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
|
-
|
|
139
|
+
a !== "none" && a !== "%" && a !== "$" ? a : void 0,
|
|
140
140
|
u
|
|
141
141
|
) : String(c);
|
|
142
|
-
return { labelText:
|
|
142
|
+
return { labelText: m, valueStr: b };
|
|
143
143
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
return
|
|
149
|
-
const c = u / 2, b =
|
|
150
|
-
return
|
|
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(
|
|
153
|
-
for (let u =
|
|
154
|
-
if (Number(
|
|
155
|
-
return
|
|
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
|
|
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
|
|
275
|
-
if (
|
|
276
|
-
return
|
|
277
|
-
const u = (
|
|
278
|
-
return { line:
|
|
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
|
|
281
|
-
series:
|
|
282
|
-
className:
|
|
280
|
+
function Xt({
|
|
281
|
+
series: t,
|
|
282
|
+
className: a,
|
|
283
283
|
showLegend: u = !1,
|
|
284
|
-
onUnselectSeries:
|
|
284
|
+
onUnselectSeries: m,
|
|
285
285
|
xMeasureUnit: c = "time",
|
|
286
286
|
yMeasureUnit: b = "token",
|
|
287
|
-
optionsOverrides:
|
|
288
|
-
verticalLineOptions:
|
|
287
|
+
optionsOverrides: v,
|
|
288
|
+
verticalLineOptions: w,
|
|
289
289
|
priceLineOptions: R,
|
|
290
|
-
zoneOptions:
|
|
291
|
-
currentValueDecimals:
|
|
290
|
+
zoneOptions: A,
|
|
291
|
+
currentValueDecimals: ue,
|
|
292
292
|
useSharedPriceScale: j = !1,
|
|
293
|
-
dualYAxis:
|
|
294
|
-
defaultVisiblePriceScaleId:
|
|
295
|
-
leftPriceScaleTitle:
|
|
293
|
+
dualYAxis: D = !1,
|
|
294
|
+
defaultVisiblePriceScaleId: we = "right",
|
|
295
|
+
leftPriceScaleTitle: _e,
|
|
296
296
|
rightPriceScaleTitle: kt,
|
|
297
|
-
showCurrentValue:
|
|
298
|
-
graphTitle:
|
|
299
|
-
yScaleMin:
|
|
297
|
+
showCurrentValue: Qe = !0,
|
|
298
|
+
graphTitle: fe,
|
|
299
|
+
yScaleMin: Ne,
|
|
300
300
|
yScaleMinMultiple: Pe,
|
|
301
|
-
visibleTimeFrom:
|
|
302
|
-
disableZoom:
|
|
303
|
-
hideDefaultTooltip:
|
|
301
|
+
visibleTimeFrom: J,
|
|
302
|
+
disableZoom: Te = !1,
|
|
303
|
+
hideDefaultTooltip: he = !1
|
|
304
304
|
}) {
|
|
305
|
-
const
|
|
306
|
-
if (
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
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
|
-
}, [
|
|
312
|
-
if (!
|
|
313
|
-
const
|
|
314
|
-
for (const i of
|
|
315
|
-
i.data.length > 0 &&
|
|
316
|
-
return
|
|
317
|
-
}), [ke, q] =
|
|
318
|
-
|
|
319
|
-
const
|
|
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 (
|
|
322
|
-
const s =
|
|
323
|
-
|
|
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 =
|
|
328
|
-
return
|
|
329
|
-
i && n?.unobserve(i), n?.disconnect(),
|
|
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
|
-
}, []),
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
334
|
-
"hsl(var(--foreground))",
|
|
335
|
-
"rgb(
|
|
336
|
-
), n =
|
|
337
|
-
|
|
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
|
-
...
|
|
339
|
+
...e.leftPriceScale || {},
|
|
353
340
|
visible: !1,
|
|
354
341
|
textColor: i
|
|
355
342
|
},
|
|
356
343
|
rightPriceScale: {
|
|
357
|
-
...
|
|
344
|
+
...e.rightPriceScale || {},
|
|
358
345
|
visible: !V,
|
|
359
346
|
textColor: i
|
|
360
347
|
},
|
|
361
348
|
...V && {
|
|
362
349
|
crosshair: {
|
|
363
|
-
...
|
|
350
|
+
...e.crosshair,
|
|
364
351
|
mode: st.Magnet
|
|
365
352
|
}
|
|
366
|
-
}
|
|
367
|
-
...n,
|
|
368
|
-
...L
|
|
353
|
+
}
|
|
369
354
|
});
|
|
370
|
-
return
|
|
371
|
-
|
|
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
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
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
|
-
}, [
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
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
|
|
411
|
-
o.data.length !== 0 && (
|
|
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,
|
|
404
|
+
const f = (r, o, d) => {
|
|
417
405
|
const {
|
|
418
|
-
formatter:
|
|
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
|
-
}),
|
|
425
|
-
return We(
|
|
426
|
-
},
|
|
427
|
-
if (
|
|
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(),
|
|
430
|
-
let
|
|
431
|
-
for (const T of
|
|
432
|
-
if (T.data.length !== 0 &&
|
|
433
|
-
o.size === 0 && T.yMeasureUnit && (
|
|
434
|
-
for (const
|
|
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 &&
|
|
424
|
+
o.size > 0 && h.push(f(d, I, o));
|
|
437
425
|
}
|
|
438
426
|
else {
|
|
439
|
-
const r =
|
|
440
|
-
|
|
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
|
-
|
|
430
|
+
h.push(f(r, b, o));
|
|
443
431
|
}
|
|
444
|
-
|
|
445
|
-
const
|
|
446
|
-
for (const r of
|
|
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
|
-
|
|
449
|
-
const
|
|
450
|
-
|
|
436
|
+
y.set(o, r);
|
|
437
|
+
const S = Ze();
|
|
438
|
+
e.applyOptions({
|
|
451
439
|
localization: {
|
|
452
|
-
...
|
|
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
|
-
...
|
|
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
|
|
467
|
-
"hsl(var(--foreground))",
|
|
468
|
-
"rgb(
|
|
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
|
-
|
|
471
|
-
...
|
|
472
|
-
defaultVisiblePriceScaleId:
|
|
459
|
+
e.applyOptions({
|
|
460
|
+
...D && {
|
|
461
|
+
defaultVisiblePriceScaleId: we
|
|
473
462
|
},
|
|
474
463
|
leftPriceScale: {
|
|
475
|
-
...
|
|
476
|
-
|
|
464
|
+
...S.leftPriceScale || {},
|
|
465
|
+
...v?.leftPriceScale,
|
|
466
|
+
visible: D && !V,
|
|
477
467
|
textColor: k,
|
|
478
|
-
...
|
|
468
|
+
...D && _e && {
|
|
479
469
|
// lightweight-charts uses scale margins; title shown via localization if needed
|
|
480
470
|
}
|
|
481
471
|
},
|
|
482
472
|
rightPriceScale: {
|
|
483
|
-
...
|
|
484
|
-
|
|
473
|
+
...S.rightPriceScale || {},
|
|
474
|
+
...v?.rightPriceScale,
|
|
475
|
+
visible: D ? !V : !M,
|
|
485
476
|
textColor: k,
|
|
486
|
-
...p && !
|
|
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
|
|
495
|
-
for (const r of
|
|
496
|
-
if (!
|
|
497
|
-
const o =
|
|
498
|
-
o && (
|
|
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
|
|
501
|
-
let
|
|
502
|
-
const
|
|
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 ??
|
|
497
|
+
const o = r.seriesLabel ?? ze?.label;
|
|
507
498
|
if (!o) continue;
|
|
508
|
-
const
|
|
509
|
-
|
|
499
|
+
const d = ae.get(o) ?? [];
|
|
500
|
+
d.push(r.price), ae.set(o, d);
|
|
510
501
|
}
|
|
511
|
-
if (
|
|
512
|
-
for (const r of
|
|
513
|
-
const o = r.seriesLabel ??
|
|
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
|
|
516
|
-
Number.isFinite(r.priceTop) &&
|
|
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 <
|
|
519
|
-
const o =
|
|
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,
|
|
514
|
+
T = o.topColor, G = o.bottomColor;
|
|
524
515
|
else if (o.topColor) {
|
|
525
|
-
const g =
|
|
526
|
-
T = o.topColor,
|
|
516
|
+
const g = ce(I);
|
|
517
|
+
T = o.topColor, G = g.bottomColor;
|
|
527
518
|
} else if (o.bottomColor)
|
|
528
|
-
T =
|
|
519
|
+
T = ce(I).topColor, G = o.bottomColor;
|
|
529
520
|
else {
|
|
530
|
-
const g =
|
|
531
|
-
T = g.topColor,
|
|
521
|
+
const g = ce(I);
|
|
522
|
+
T = g.topColor, G = g.bottomColor;
|
|
532
523
|
}
|
|
533
524
|
else
|
|
534
|
-
T = o.topColor ||
|
|
525
|
+
T = o.topColor || d.top, G = o.bottomColor || d.bottom;
|
|
535
526
|
if (o.data.length === 0) {
|
|
536
|
-
const g =
|
|
537
|
-
g && (
|
|
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
|
|
541
|
-
|
|
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:
|
|
535
|
+
seriesIndex: le
|
|
545
536
|
});
|
|
546
|
-
const $e = (j || !
|
|
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 =
|
|
555
|
-
lineColor:
|
|
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 ??
|
|
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
|
|
573
|
-
const
|
|
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 (
|
|
578
|
-
const g = Number(
|
|
579
|
-
for (let
|
|
580
|
-
|
|
581
|
-
|
|
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
|
-
|
|
584
|
-
...
|
|
585
|
-
...
|
|
586
|
-
}) :
|
|
587
|
-
...
|
|
588
|
-
...
|
|
589
|
-
}),
|
|
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 (
|
|
582
|
+
if (D)
|
|
592
583
|
try {
|
|
593
|
-
const r =
|
|
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(
|
|
593
|
+
r?.applyOptions(d), o?.applyOptions(d);
|
|
604
594
|
} catch {
|
|
605
595
|
}
|
|
606
|
-
else if (
|
|
607
|
-
for (const r of
|
|
596
|
+
else if (x && ne.length > 0)
|
|
597
|
+
for (const r of ne)
|
|
608
598
|
try {
|
|
609
|
-
const o =
|
|
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 (!
|
|
621
|
+
else if (!x)
|
|
634
622
|
try {
|
|
635
|
-
const r =
|
|
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 || !
|
|
642
|
+
if (n !== void 0 && !V && (j || !x) && e.applyOptions({
|
|
656
643
|
handleScroll: {
|
|
657
644
|
vertTouchDrag: !1
|
|
658
645
|
}
|
|
659
|
-
}),
|
|
660
|
-
const r =
|
|
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),
|
|
663
|
-
if (Number(
|
|
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
|
-
|
|
652
|
+
e.timeScale().setVisibleRange({ from: d, to: I });
|
|
666
653
|
} catch {
|
|
667
654
|
try {
|
|
668
|
-
|
|
655
|
+
e.timeScale().fitContent();
|
|
669
656
|
} catch {
|
|
670
657
|
}
|
|
671
658
|
}
|
|
672
659
|
}
|
|
673
660
|
}
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
for (const r of
|
|
677
|
-
r.data.length > 0 &&
|
|
678
|
-
|
|
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
|
-
|
|
681
|
-
|
|
667
|
+
Q,
|
|
668
|
+
t,
|
|
669
|
+
Z,
|
|
682
670
|
c,
|
|
683
671
|
b,
|
|
684
672
|
V,
|
|
685
673
|
j,
|
|
686
|
-
|
|
674
|
+
D,
|
|
675
|
+
we,
|
|
676
|
+
_e,
|
|
687
677
|
Ne,
|
|
688
|
-
Te,
|
|
689
|
-
Ve,
|
|
690
678
|
Pe,
|
|
691
|
-
|
|
679
|
+
J,
|
|
692
680
|
R,
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
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
|
|
700
|
-
if (
|
|
701
|
-
n =
|
|
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 = (
|
|
706
|
-
const { time: f = n, seriesData:
|
|
707
|
-
if (!
|
|
708
|
-
const
|
|
709
|
-
for (const p of
|
|
710
|
-
p.data.length > 0 &&
|
|
711
|
-
if (
|
|
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 (
|
|
714
|
-
const
|
|
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,
|
|
717
|
-
|
|
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
|
|
723
|
-
let
|
|
724
|
-
for (let
|
|
725
|
-
const p =
|
|
726
|
-
if (!
|
|
727
|
-
const M =
|
|
728
|
-
let
|
|
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
|
-
|
|
719
|
+
P = k;
|
|
731
720
|
else if (i) {
|
|
732
|
-
const
|
|
733
|
-
|
|
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
|
|
736
|
-
if (Number(f) <
|
|
737
|
-
|
|
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(
|
|
728
|
+
Number.isNaN(P) || (L === void 0 && (L = P), $.set(p.label, { value: P, time: f }));
|
|
740
729
|
}
|
|
741
|
-
if (
|
|
742
|
-
const p =
|
|
743
|
-
if (p !== null &&
|
|
744
|
-
const M =
|
|
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
|
|
751
|
-
q({ x:
|
|
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:
|
|
742
|
+
q({ x: p, y: x });
|
|
754
743
|
} else
|
|
755
|
-
q({ x: p, y:
|
|
744
|
+
q({ x: p, y: x });
|
|
756
745
|
} else
|
|
757
746
|
q(null);
|
|
758
747
|
} else
|
|
759
748
|
q(null);
|
|
760
749
|
};
|
|
761
|
-
return
|
|
762
|
-
const
|
|
763
|
-
if (
|
|
764
|
-
const
|
|
765
|
-
|
|
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
|
-
|
|
757
|
+
e.unsubscribeCrosshairMove(s), V && e.unsubscribeClick(s);
|
|
769
758
|
};
|
|
770
|
-
}, [
|
|
771
|
-
const
|
|
772
|
-
if (!
|
|
773
|
-
const i =
|
|
774
|
-
const s =
|
|
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
|
|
777
|
-
if (!
|
|
778
|
-
const f = Number(
|
|
779
|
-
for (const
|
|
780
|
-
const
|
|
781
|
-
for (const
|
|
782
|
-
if (
|
|
783
|
-
for (const
|
|
784
|
-
const
|
|
785
|
-
|
|
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
|
-
|
|
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
|
-
}, [
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
798
|
-
const s = pt(),
|
|
799
|
-
for (const f of
|
|
800
|
-
const
|
|
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
|
-
|
|
805
|
-
const
|
|
806
|
-
|
|
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
|
|
801
|
+
for (const l of n)
|
|
813
802
|
try {
|
|
814
|
-
s.detachPrimitive(
|
|
803
|
+
s.detachPrimitive(l);
|
|
815
804
|
} catch {
|
|
816
805
|
}
|
|
817
806
|
}
|
|
818
807
|
};
|
|
819
|
-
}, [
|
|
820
|
-
const
|
|
808
|
+
}, [w, t, Q]), W(() => {
|
|
809
|
+
const e = [], i = [];
|
|
821
810
|
if (R && R.length > 0) {
|
|
822
|
-
const n = Array.from(
|
|
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
|
|
827
|
-
if (!Number.isFinite(
|
|
828
|
-
const f =
|
|
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
|
|
831
|
-
price:
|
|
832
|
-
color:
|
|
833
|
-
lineWidth:
|
|
834
|
-
lineStyle:
|
|
835
|
-
axisLabelVisible:
|
|
836
|
-
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
|
-
|
|
839
|
-
const
|
|
827
|
+
e.push({ series: f, line: $ });
|
|
828
|
+
const L = new Pt(
|
|
840
829
|
f,
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
830
|
+
l.price,
|
|
831
|
+
h,
|
|
832
|
+
y,
|
|
833
|
+
S
|
|
845
834
|
);
|
|
846
|
-
f.attachPrimitive(
|
|
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
|
|
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,
|
|
862
|
-
const
|
|
863
|
-
if (
|
|
864
|
-
const i = Array.from(
|
|
865
|
-
for (const s of
|
|
866
|
-
const
|
|
867
|
-
if (!
|
|
868
|
-
const f = s.color ?
|
|
869
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
}, [
|
|
885
|
-
const
|
|
886
|
-
if (!
|
|
887
|
-
|
|
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
|
|
892
|
-
|
|
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 =
|
|
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
|
-
}, [
|
|
902
|
-
et((
|
|
890
|
+
}, [w, t, Q]), ft(() => {
|
|
891
|
+
et((e) => {
|
|
903
892
|
const i = {};
|
|
904
893
|
let n = !1;
|
|
905
|
-
for (const [s,
|
|
906
|
-
if (!
|
|
907
|
-
const f =
|
|
908
|
-
i[s] = f,
|
|
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(
|
|
899
|
+
return Object.keys(e).length !== Object.keys(i).length && (n = !0), n ? i : e;
|
|
911
900
|
});
|
|
912
901
|
});
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
const
|
|
916
|
-
if (
|
|
917
|
-
return
|
|
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
|
-
}, [
|
|
920
|
-
return /* @__PURE__ */
|
|
908
|
+
}, [se, t]);
|
|
909
|
+
return /* @__PURE__ */ ie(
|
|
921
910
|
"div",
|
|
922
911
|
{
|
|
923
|
-
ref:
|
|
924
|
-
className:
|
|
912
|
+
ref: F,
|
|
913
|
+
className: O(
|
|
925
914
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
926
|
-
|
|
915
|
+
a
|
|
927
916
|
),
|
|
928
917
|
children: [
|
|
929
|
-
|
|
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:
|
|
921
|
+
point: Ee,
|
|
933
922
|
xMeasureUnit: c,
|
|
934
923
|
yMeasureUnit: b,
|
|
935
|
-
decimals:
|
|
924
|
+
decimals: ue
|
|
936
925
|
}
|
|
937
926
|
),
|
|
938
|
-
Me && ke && /* @__PURE__ */
|
|
927
|
+
Me && ke && /* @__PURE__ */ _(
|
|
939
928
|
vt,
|
|
940
929
|
{
|
|
941
930
|
points: Me,
|
|
942
931
|
xMeasureUnit: c,
|
|
943
932
|
yMeasureUnit: b,
|
|
944
|
-
series:
|
|
933
|
+
series: t,
|
|
945
934
|
position: ke,
|
|
946
|
-
containerRef:
|
|
947
|
-
decimals:
|
|
935
|
+
containerRef: F,
|
|
936
|
+
decimals: ue
|
|
948
937
|
}
|
|
949
938
|
),
|
|
950
|
-
u && /* @__PURE__ */
|
|
951
|
-
|
|
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:
|
|
957
|
-
const n =
|
|
958
|
-
if (n === null
|
|
959
|
-
const { labelText:
|
|
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
|
-
|
|
963
|
-
),
|
|
964
|
-
if (!(
|
|
965
|
-
const
|
|
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
|
-
|
|
956
|
+
Oe,
|
|
968
957
|
Ue[i]
|
|
969
958
|
);
|
|
970
|
-
return /* @__PURE__ */
|
|
959
|
+
return /* @__PURE__ */ ie(
|
|
971
960
|
"div",
|
|
972
961
|
{
|
|
973
|
-
ref: (
|
|
974
|
-
Fe.current.set(i,
|
|
962
|
+
ref: (p) => {
|
|
963
|
+
Fe.current.set(i, p);
|
|
975
964
|
},
|
|
976
|
-
className:
|
|
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
|
-
|
|
967
|
+
h && "pointer-events-auto cursor-default"
|
|
979
968
|
),
|
|
980
969
|
style: {
|
|
981
|
-
...
|
|
982
|
-
backgroundColor:
|
|
983
|
-
color:
|
|
970
|
+
...N,
|
|
971
|
+
backgroundColor: S,
|
|
972
|
+
color: $
|
|
984
973
|
},
|
|
985
974
|
children: [
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
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:
|
|
982
|
+
children: h
|
|
994
983
|
}
|
|
995
984
|
)
|
|
996
985
|
]
|
|
997
986
|
},
|
|
998
|
-
|
|
987
|
+
L
|
|
999
988
|
);
|
|
1000
989
|
})
|
|
1001
990
|
}
|
|
1002
991
|
),
|
|
1003
|
-
/* @__PURE__ */
|
|
992
|
+
/* @__PURE__ */ _(
|
|
1004
993
|
"div",
|
|
1005
994
|
{
|
|
1006
|
-
ref:
|
|
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:
|
|
1016
|
-
onUnselect:
|
|
1004
|
+
series: t,
|
|
1005
|
+
onUnselect: a,
|
|
1017
1006
|
inline: u = !1
|
|
1018
1007
|
}) {
|
|
1019
|
-
const
|
|
1020
|
-
return /* @__PURE__ */
|
|
1008
|
+
const m = t.every((c) => c.data.length === 0);
|
|
1009
|
+
return /* @__PURE__ */ _(
|
|
1021
1010
|
"div",
|
|
1022
1011
|
{
|
|
1023
|
-
className:
|
|
1024
|
-
"flex flex-wrap
|
|
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:
|
|
1028
|
-
const
|
|
1029
|
-
return /* @__PURE__ */
|
|
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:
|
|
1033
|
-
"flex items-center gap-1.5
|
|
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__ */
|
|
1027
|
+
/* @__PURE__ */ _(
|
|
1038
1028
|
"div",
|
|
1039
1029
|
{
|
|
1040
|
-
className:
|
|
1041
|
-
|
|
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__ */
|
|
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: (
|
|
1053
|
-
|
|
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__ */
|
|
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__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
1090
|
-
|
|
1090
|
+
xe as DEFAULT_SERIES_COLORS,
|
|
1091
|
+
Xt as Graph,
|
|
1091
1092
|
Mt as GraphLegend,
|
|
1092
|
-
|
|
1093
|
-
|
|
1093
|
+
Ke as VERTICAL_LINE_LABEL_EDGE_PADDING,
|
|
1094
|
+
Je as getSeriesColorPalette,
|
|
1094
1095
|
Lt as getStepForwardValue,
|
|
1095
|
-
|
|
1096
|
-
|
|
1096
|
+
Vt as getVerticalLineLabelStyle,
|
|
1097
|
+
Tt as getVerticalLineTooltipContent
|
|
1097
1098
|
};
|