@overdoser/react-toolkit 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,733 +1,836 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
1
|
+
import { useCallback as e, useEffect as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import o from "clsx";
|
|
3
|
+
import { Button as s } from "../Button/Button.js";
|
|
4
|
+
import { Dropdown as c } from "../Dropdown/Dropdown.js";
|
|
5
|
+
import { Popover as l } from "../Popover/Popover.js";
|
|
6
|
+
import { niceTicks as u } from "./scales.js";
|
|
7
|
+
import { bollinger as d, ema as f, rsi as p, sma as m } from "./trading/indicators.js";
|
|
8
|
+
import { periodToSeconds as h } from "./trading/period.js";
|
|
9
|
+
import g from "./Chart.module.scss.js";
|
|
10
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
11
|
+
// src/components/Chart/TradingChart.tsx
|
|
12
|
+
var y = 420, b = 64, x = 28, S = 40, ee = 4, C = {
|
|
13
|
+
rsi: .18,
|
|
14
|
+
volume: .14
|
|
15
|
+
}, te = 1, ne = 40, re = 500, ie = [];
|
|
16
|
+
function ae({ datafeed: c, symbol: u, resolution: d, period: f, seriesType: m = "candle", indicators: x = ie, precision: S = 2, initialLookback: C = re, height: ae = y, upColor: w = "var(--crk-color-success)", downColor: E = "var(--crk-color-danger)", lineColor: O = "var(--crk-chart-1)", timezone: k, defaultTimezone: A = "local", onTimezoneChange: j, showConfigPanel: M = !0, priceBadgeColorByDirection: N = !1, priceBadgeShowTime: P = !1, priceBadgeTimeFormat: De, onCrosshair: Oe, onVisibleRangeChange: ke, className: Ae, style: je }) {
|
|
17
|
+
let I = i(null), L = i(null), R = i([]), z = i({
|
|
18
|
+
from: 0,
|
|
19
|
+
to: 0
|
|
20
|
+
}), B = i(null), V = i(null), H = i(!1), U = i(0), W = i(null), G = i(null), Me = i(1), K = i({
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 0
|
|
23
|
+
}), Ne = i(() => {}), Pe = i(Oe), q = i(ke);
|
|
24
|
+
Pe.current = Oe, q.current = ke;
|
|
25
|
+
let [J, Fe] = a(null), [Ie, Le] = a(A), Re = k ?? Ie, ze = e((e) => {
|
|
26
|
+
k === void 0 && Le(e), j?.(e);
|
|
27
|
+
}, [k, j]), Be = r(() => ({
|
|
28
|
+
up: w,
|
|
29
|
+
down: E,
|
|
30
|
+
line: O
|
|
31
|
+
}), [
|
|
32
|
+
w,
|
|
33
|
+
E,
|
|
34
|
+
O
|
|
35
|
+
]), Y = x, X = Y.some((e) => e.type === "rsi"), Z = Y.some((e) => e.type === "volume");
|
|
36
|
+
Ne.current = e(() => {
|
|
37
|
+
let e = L.current;
|
|
38
|
+
if (!e) return;
|
|
39
|
+
let t = e.getContext("2d");
|
|
40
|
+
if (!t) return;
|
|
41
|
+
let { width: n, height: r } = K.current;
|
|
42
|
+
if (n === 0 || r === 0) return;
|
|
43
|
+
let i = Me.current;
|
|
44
|
+
t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, e.width, e.height), t.scale(i, i);
|
|
45
|
+
let a = pe(I.current, Be), o = fe(I.current), s = R.current;
|
|
46
|
+
if (s.length === 0) {
|
|
47
|
+
me(t, n, r, a), t.restore();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
let c = T(n, r, X, Z), { from: l, to: u } = ce(z.current, s.length);
|
|
51
|
+
z.current = {
|
|
52
|
+
from: l,
|
|
53
|
+
to: u
|
|
54
|
+
};
|
|
55
|
+
let f = s.slice(Math.max(0, Math.floor(l)), Math.min(s.length, Math.ceil(u) + 1)), h = (e) => {
|
|
56
|
+
let t = u - l + 1, n = c.plotWidth / t;
|
|
57
|
+
return c.plotLeft + (e - l + .5) * n;
|
|
58
|
+
}, g = c.plotWidth / (u - l + 1), _ = Y.map((e) => le(e, s)).filter((e) => e !== null).map((e) => ({
|
|
59
|
+
...e,
|
|
60
|
+
color: o(e.color)
|
|
61
|
+
})), v = ue(c.main, f, _, l, u);
|
|
62
|
+
he(t, c.plotLeft, c.plotRight, v, a), ge(t, c, v, S, a), t.save(), t.beginPath(), t.rect(c.plotLeft, v.paneTop, c.plotWidth, v.paneHeight), t.clip();
|
|
63
|
+
for (let e = 0; e < Y.length; e++) {
|
|
64
|
+
let n = Y[e], r = _[e];
|
|
65
|
+
r && be(t, r, n, s, l, u, h, v);
|
|
66
|
+
}
|
|
67
|
+
if (m === "candle" ? _e(t, s, l, u, h, g, v, {
|
|
68
|
+
up: a.up,
|
|
69
|
+
down: a.down
|
|
70
|
+
}) : m === "bar" ? ve(t, s, l, u, h, g, v, {
|
|
71
|
+
up: a.up,
|
|
72
|
+
down: a.down
|
|
73
|
+
}) : ye(t, s, l, u, h, v, a.line, m === "area"), t.restore(), c.volume) {
|
|
74
|
+
let e = de(c.volume, s, l, u);
|
|
75
|
+
he(t, c.plotLeft, c.plotRight, e, a, !0), Ce(t, c, c.volume, "Volume", a), t.save(), t.beginPath(), t.rect(c.plotLeft, e.paneTop, c.plotWidth, e.paneHeight), t.clip(), xe(t, s, l, u, h, g, e, {
|
|
76
|
+
up: a.up,
|
|
77
|
+
down: a.down
|
|
78
|
+
}), t.restore();
|
|
79
|
+
}
|
|
80
|
+
if (c.rsi) {
|
|
81
|
+
let e = Y.find((e) => e.type === "rsi"), n = e && e.type === "rsi" ? e.period ?? 14 : 14, r = e && e.type === "rsi" ? e.overbought ?? 70 : 70, i = e && e.type === "rsi" ? e.oversold ?? 30 : 30, d = o((e && e.type === "rsi" ? e.color : void 0) ?? "var(--crk-chart-5)"), f = p(s, n), m = {
|
|
82
|
+
paneTop: c.rsi.top,
|
|
83
|
+
paneBottom: c.rsi.bottom,
|
|
84
|
+
paneHeight: c.rsi.height,
|
|
85
|
+
priceMin: 0,
|
|
86
|
+
priceMax: 100,
|
|
87
|
+
ticks: [
|
|
88
|
+
i,
|
|
89
|
+
50,
|
|
90
|
+
r
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
he(t, c.plotLeft, c.plotRight, m, a, !0), Ce(t, c, c.rsi, `RSI ${n}`, a), t.save(), t.beginPath(), t.rect(c.plotLeft, m.paneTop, c.plotWidth, m.paneHeight), t.clip(), D(t, f, l, u, h, m, d), t.restore(), Se(t, c, m, r, i, a);
|
|
94
|
+
}
|
|
95
|
+
we(t, c, s, l, u, d, a), B.current && Te(t, c, B.current, s, l, u, h, S, v, Re, a, d, N, P, De), t.restore();
|
|
96
|
+
}, [
|
|
97
|
+
m,
|
|
98
|
+
Y,
|
|
99
|
+
X,
|
|
100
|
+
Z,
|
|
101
|
+
S,
|
|
102
|
+
Be,
|
|
103
|
+
d,
|
|
104
|
+
Re,
|
|
105
|
+
N,
|
|
106
|
+
P,
|
|
107
|
+
De
|
|
108
|
+
]);
|
|
109
|
+
let Q = e(() => {
|
|
110
|
+
G.current === null && (typeof requestAnimationFrame > "u" ? Ne.current() : G.current = requestAnimationFrame(() => {
|
|
111
|
+
G.current = null, Ne.current();
|
|
112
|
+
}));
|
|
113
|
+
}, []);
|
|
114
|
+
n(() => {
|
|
115
|
+
let e = I.current;
|
|
116
|
+
if (!e) return;
|
|
117
|
+
let t = () => {
|
|
118
|
+
let t = e.getBoundingClientRect(), n = typeof window < "u" && window.devicePixelRatio || 1;
|
|
119
|
+
Me.current = n, K.current = {
|
|
120
|
+
width: t.width,
|
|
121
|
+
height: t.height
|
|
122
|
+
};
|
|
123
|
+
let r = L.current;
|
|
124
|
+
r && (r.width = Math.round(t.width * n), r.height = Math.round(t.height * n), r.style.width = `${t.width}px`, r.style.height = `${t.height}px`), Q();
|
|
125
|
+
};
|
|
126
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
127
|
+
let n = new ResizeObserver(t);
|
|
128
|
+
return n.observe(e), () => n.disconnect();
|
|
129
|
+
}, [Q]), t(() => {
|
|
130
|
+
let e = !1, t = Math.floor(Date.now() / 1e3), n = F(d), r = f === "MAX", i = f === void 0 ? n * C : h(f), a = f === void 0 ? C : Math.max(10, Math.ceil(i / n)), o = r ? 0 : t - i;
|
|
131
|
+
R.current = [], z.current = {
|
|
132
|
+
from: 0,
|
|
133
|
+
to: 0
|
|
134
|
+
}, U.current += 1, H.current = !1, Q(), c.getBars({
|
|
135
|
+
symbol: u,
|
|
136
|
+
resolution: d,
|
|
137
|
+
from: o,
|
|
138
|
+
to: t,
|
|
139
|
+
countBack: a
|
|
140
|
+
}).then((t) => {
|
|
141
|
+
if (e) return;
|
|
142
|
+
let n = [...t].sort((e, t) => e.time - t.time);
|
|
143
|
+
R.current = n;
|
|
144
|
+
let r = n.length - 1;
|
|
145
|
+
if (f !== void 0) z.current = {
|
|
146
|
+
from: 0,
|
|
147
|
+
to: r
|
|
148
|
+
};
|
|
149
|
+
else {
|
|
150
|
+
let e = Math.min(n.length, Math.min(200, C));
|
|
151
|
+
z.current = {
|
|
152
|
+
from: Math.max(0, r - e + 1),
|
|
153
|
+
to: r
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
q.current?.(z.current, n), Q();
|
|
157
|
+
}).catch(() => {});
|
|
158
|
+
let s = c.subscribeBars({
|
|
159
|
+
symbol: u,
|
|
160
|
+
resolution: d,
|
|
161
|
+
onTick: (t) => {
|
|
162
|
+
if (e) return;
|
|
163
|
+
let n = R.current, r = n[n.length - 1];
|
|
164
|
+
if (r && r.time === t.time) n[n.length - 1] = t;
|
|
165
|
+
else if (!r || t.time > r.time) {
|
|
166
|
+
n.push(t);
|
|
167
|
+
let e = z.current;
|
|
168
|
+
e.to >= n.length - 2 && (z.current = {
|
|
169
|
+
from: e.from + 1,
|
|
170
|
+
to: e.to + 1
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
Q();
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return W.current = s, () => {
|
|
177
|
+
e = !0, W.current !== null && (c.unsubscribeBars(W.current), W.current = null);
|
|
178
|
+
};
|
|
179
|
+
}, [
|
|
180
|
+
c,
|
|
181
|
+
u,
|
|
182
|
+
d,
|
|
183
|
+
f,
|
|
184
|
+
C
|
|
185
|
+
]);
|
|
186
|
+
let $ = e((e) => {
|
|
187
|
+
Fe(e), Pe.current?.(e);
|
|
188
|
+
}, []), Ve = e((e) => {
|
|
189
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
190
|
+
let t = z.current;
|
|
191
|
+
V.current = {
|
|
192
|
+
startX: e.clientX,
|
|
193
|
+
from: t.from,
|
|
194
|
+
to: t.to
|
|
195
|
+
};
|
|
196
|
+
}, []), He = e(() => {
|
|
197
|
+
if (H.current) return;
|
|
198
|
+
let e = R.current;
|
|
199
|
+
if (e.length === 0) return;
|
|
200
|
+
H.current = !0;
|
|
201
|
+
let t = U.current, n = F(d), r = e[0].time, i = r - n * C, a = r - n;
|
|
202
|
+
c.getBars({
|
|
203
|
+
symbol: u,
|
|
204
|
+
resolution: d,
|
|
205
|
+
from: i,
|
|
206
|
+
to: a,
|
|
207
|
+
countBack: C
|
|
208
|
+
}).then((e) => {
|
|
209
|
+
if (t !== U.current) return;
|
|
210
|
+
if (e.length === 0) {
|
|
211
|
+
H.current = !1;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
let n = [...e].sort((e, t) => e.time - t.time).filter((e) => e.time < r), i = z.current;
|
|
215
|
+
R.current = [...n, ...R.current], z.current = {
|
|
216
|
+
from: i.from + n.length,
|
|
217
|
+
to: i.to + n.length
|
|
218
|
+
}, H.current = !1, Q();
|
|
219
|
+
}).catch(() => {
|
|
220
|
+
t === U.current && (H.current = !1);
|
|
221
|
+
});
|
|
222
|
+
}, [
|
|
223
|
+
c,
|
|
224
|
+
u,
|
|
225
|
+
d,
|
|
226
|
+
C,
|
|
227
|
+
Q
|
|
228
|
+
]), Ue = e((e) => {
|
|
229
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
|
|
230
|
+
if (B.current = {
|
|
231
|
+
x: n,
|
|
232
|
+
y: r
|
|
233
|
+
}, V.current) {
|
|
234
|
+
let { startX: t, from: n, to: r } = V.current, { width: i } = K.current, a = Math.max(1, i - b), o = r - n + 1, s = a / o, c = -(e.clientX - t) / s, l = n + c, u = r + c, d = R.current.length;
|
|
235
|
+
l < 0 && (He(), l = 0, u = o - 1), u > d - 1 && (u = d - 1, l = u - o + 1), z.current = {
|
|
236
|
+
from: l,
|
|
237
|
+
to: u
|
|
238
|
+
}, q.current?.(z.current, R.current);
|
|
239
|
+
}
|
|
240
|
+
let i = T(t.width, t.height, X, Z), a = z.current;
|
|
241
|
+
if (n >= i.plotLeft && n <= i.plotRight) {
|
|
242
|
+
let e = a.to - a.from + 1, t = i.plotWidth / e, o = Math.round(a.from + (n - i.plotLeft) / t - .5), s = R.current, c = Math.max(0, Math.min(s.length - 1, o)), l = s[c] ?? null, u = Ee(r, i, s, a.from, a.to, X, Z);
|
|
243
|
+
$({
|
|
244
|
+
barIndex: c,
|
|
245
|
+
bar: l,
|
|
246
|
+
priceAtCursor: u
|
|
247
|
+
});
|
|
248
|
+
} else $(null);
|
|
249
|
+
Q();
|
|
250
|
+
}, [
|
|
251
|
+
X,
|
|
252
|
+
Z,
|
|
253
|
+
He,
|
|
254
|
+
Q,
|
|
255
|
+
$
|
|
256
|
+
]), We = e((e) => {
|
|
257
|
+
e.currentTarget.releasePointerCapture(e.pointerId), V.current = null;
|
|
258
|
+
}, []), Ge = e(() => {
|
|
259
|
+
B.current = null, V.current = null, $(null), Q();
|
|
260
|
+
}, [Q, $]), Ke = e((e) => {
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = T(t.width, t.height, X, Z), i = z.current, a = R.current;
|
|
263
|
+
if (a.length === 0) return;
|
|
264
|
+
let o = i.to - i.from + 1, s = e.deltaY > 0 ? 1.1 : 1 / 1.1, c = Math.max(r.plotWidth / ne, Math.min(a.length, r.plotWidth / te, o * s)), l = i.from + (n - r.plotLeft) / (r.plotWidth / o), u = l - (l - i.from) / o * c, d = u + c - 1;
|
|
265
|
+
u < 0 && (u = 0, d = c - 1), d > a.length - 1 && (d = a.length - 1, u = d - c + 1), z.current = {
|
|
266
|
+
from: u,
|
|
267
|
+
to: d
|
|
268
|
+
}, q.current?.(z.current, a), Q();
|
|
269
|
+
}, [
|
|
270
|
+
X,
|
|
271
|
+
Z,
|
|
272
|
+
Q
|
|
273
|
+
]), qe = e((e) => {
|
|
274
|
+
let t = z.current, n = t.to - t.from + 1, r = R.current;
|
|
275
|
+
if (r.length === 0) return;
|
|
276
|
+
let i = 0;
|
|
277
|
+
if (e.key === "ArrowLeft") i = -Math.max(1, Math.floor(n * .1));
|
|
278
|
+
else if (e.key === "ArrowRight") i = Math.max(1, Math.floor(n * .1));
|
|
279
|
+
else return;
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
let a = t.from + i, o = t.to + i;
|
|
282
|
+
a < 0 && (a = 0, o = n - 1), o > r.length - 1 && (o = r.length - 1, a = o - n + 1), z.current = {
|
|
283
|
+
from: a,
|
|
284
|
+
to: o
|
|
285
|
+
}, q.current?.(z.current, r), Q();
|
|
286
|
+
}, [Q]);
|
|
287
|
+
return /* @__PURE__ */ v("div", {
|
|
288
|
+
ref: I,
|
|
289
|
+
className: o(g.root, Ae),
|
|
290
|
+
style: {
|
|
291
|
+
...je,
|
|
292
|
+
height: ae,
|
|
293
|
+
position: "relative"
|
|
294
|
+
},
|
|
295
|
+
tabIndex: 0,
|
|
296
|
+
role: "figure",
|
|
297
|
+
"aria-label": `${u} ${d} chart`,
|
|
298
|
+
onKeyDown: qe,
|
|
299
|
+
children: [/* @__PURE__ */ _("canvas", {
|
|
300
|
+
ref: L,
|
|
301
|
+
className: g.svg,
|
|
302
|
+
onPointerDown: Ve,
|
|
303
|
+
onPointerMove: Ue,
|
|
304
|
+
onPointerUp: We,
|
|
305
|
+
onPointerLeave: Ge,
|
|
306
|
+
onWheel: Ke,
|
|
307
|
+
style: {
|
|
308
|
+
cursor: V.current ? "grabbing" : "crosshair",
|
|
309
|
+
touchAction: "none"
|
|
310
|
+
}
|
|
311
|
+
}), /* @__PURE__ */ v("div", {
|
|
312
|
+
className: g.tradingHeader,
|
|
313
|
+
style: {
|
|
314
|
+
position: "absolute",
|
|
315
|
+
top: ee,
|
|
316
|
+
left: 8,
|
|
317
|
+
right: 8,
|
|
318
|
+
pointerEvents: "none",
|
|
319
|
+
display: "flex",
|
|
320
|
+
alignItems: "center",
|
|
321
|
+
justifyContent: "space-between",
|
|
322
|
+
gap: 8
|
|
323
|
+
},
|
|
324
|
+
children: [/* @__PURE__ */ v("div", {
|
|
325
|
+
style: {
|
|
326
|
+
display: "flex",
|
|
327
|
+
alignItems: "center",
|
|
328
|
+
gap: 8,
|
|
329
|
+
minWidth: 0
|
|
330
|
+
},
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ _("strong", { children: u }),
|
|
333
|
+
/* @__PURE__ */ _("span", {
|
|
334
|
+
style: { color: "var(--crk-color-text-muted)" },
|
|
335
|
+
children: d
|
|
336
|
+
}),
|
|
337
|
+
J?.bar && /* @__PURE__ */ v("span", {
|
|
338
|
+
style: {
|
|
339
|
+
color: "var(--crk-color-text-muted)",
|
|
340
|
+
whiteSpace: "nowrap"
|
|
341
|
+
},
|
|
342
|
+
children: [
|
|
343
|
+
"O ",
|
|
344
|
+
J.bar.open.toFixed(S),
|
|
345
|
+
" · H ",
|
|
346
|
+
J.bar.high.toFixed(S),
|
|
347
|
+
" · L",
|
|
348
|
+
" ",
|
|
349
|
+
J.bar.low.toFixed(S),
|
|
350
|
+
" · C ",
|
|
351
|
+
J.bar.close.toFixed(S)
|
|
352
|
+
]
|
|
353
|
+
})
|
|
354
|
+
]
|
|
355
|
+
}), M && /* @__PURE__ */ _("div", {
|
|
356
|
+
style: { pointerEvents: "auto" },
|
|
357
|
+
children: /* @__PURE__ */ _(l, {
|
|
358
|
+
position: "bottom",
|
|
359
|
+
asChild: !0,
|
|
360
|
+
trigger: /* @__PURE__ */ _(s, {
|
|
361
|
+
variant: "ghost",
|
|
362
|
+
size: "sm",
|
|
363
|
+
iconOnly: !0,
|
|
364
|
+
"aria-label": "Chart settings",
|
|
365
|
+
children: /* @__PURE__ */ _(se, {})
|
|
366
|
+
}),
|
|
367
|
+
content: /* @__PURE__ */ _(oe, {
|
|
368
|
+
timezone: Re,
|
|
369
|
+
onTimezoneChange: ze
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
})]
|
|
373
|
+
})]
|
|
374
|
+
});
|
|
327
375
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
376
|
+
var w = [
|
|
377
|
+
{
|
|
378
|
+
value: "local",
|
|
379
|
+
label: "Local time"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
value: "utc",
|
|
383
|
+
label: "UTC"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
value: "America/New_York",
|
|
387
|
+
label: "America / New York"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
value: "America/Los_Angeles",
|
|
391
|
+
label: "America / Los Angeles"
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
value: "Europe/London",
|
|
395
|
+
label: "Europe / London"
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
value: "Europe/Berlin",
|
|
399
|
+
label: "Europe / Berlin"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
value: "Asia/Tokyo",
|
|
403
|
+
label: "Asia / Tokyo"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
value: "Asia/Singapore",
|
|
407
|
+
label: "Asia / Singapore"
|
|
408
|
+
}
|
|
337
409
|
];
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
410
|
+
function oe({ timezone: e, onTimezoneChange: t }) {
|
|
411
|
+
return /* @__PURE__ */ v("div", {
|
|
412
|
+
style: {
|
|
413
|
+
minWidth: 220,
|
|
414
|
+
padding: 4
|
|
415
|
+
},
|
|
416
|
+
children: [/* @__PURE__ */ _("div", {
|
|
417
|
+
style: {
|
|
418
|
+
fontWeight: 600,
|
|
419
|
+
fontSize: "var(--crk-font-size-sm)",
|
|
420
|
+
padding: "4px 4px 8px"
|
|
421
|
+
},
|
|
422
|
+
children: "Settings"
|
|
423
|
+
}), /* @__PURE__ */ v("label", {
|
|
424
|
+
style: {
|
|
425
|
+
display: "flex",
|
|
426
|
+
flexDirection: "column",
|
|
427
|
+
gap: 4,
|
|
428
|
+
padding: "4px"
|
|
429
|
+
},
|
|
430
|
+
children: [/* @__PURE__ */ _("span", {
|
|
431
|
+
style: {
|
|
432
|
+
fontSize: "var(--crk-font-size-xs)",
|
|
433
|
+
color: "var(--crk-color-text-muted)"
|
|
434
|
+
},
|
|
435
|
+
children: "Timezone"
|
|
436
|
+
}), /* @__PURE__ */ _(c, {
|
|
437
|
+
options: w.map((e) => ({
|
|
438
|
+
value: e.value,
|
|
439
|
+
label: e.label
|
|
440
|
+
})),
|
|
441
|
+
value: e,
|
|
442
|
+
onChange: (e) => t(e)
|
|
443
|
+
})]
|
|
444
|
+
})]
|
|
445
|
+
});
|
|
366
446
|
}
|
|
367
|
-
function
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
);
|
|
447
|
+
function se() {
|
|
448
|
+
return /* @__PURE__ */ v("svg", {
|
|
449
|
+
viewBox: "0 0 24 24",
|
|
450
|
+
fill: "none",
|
|
451
|
+
stroke: "currentColor",
|
|
452
|
+
strokeWidth: 2,
|
|
453
|
+
strokeLinecap: "round",
|
|
454
|
+
strokeLinejoin: "round",
|
|
455
|
+
"aria-hidden": "true",
|
|
456
|
+
children: [/* @__PURE__ */ _("circle", {
|
|
457
|
+
cx: "12",
|
|
458
|
+
cy: "12",
|
|
459
|
+
r: "3"
|
|
460
|
+
}), /* @__PURE__ */ _("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" })]
|
|
461
|
+
});
|
|
384
462
|
}
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
463
|
+
function T(e, t, n, r) {
|
|
464
|
+
let i = Math.max(0, e - b), a = S, o = Math.max(a, t - x), s = Math.max(0, +i), c = Math.max(0, o - a), l = c, u = a, d = {
|
|
465
|
+
top: a,
|
|
466
|
+
bottom: o,
|
|
467
|
+
height: c
|
|
468
|
+
}, f = null, p = null, m = n ? C.rsi : 0, h = r ? C.volume : 0;
|
|
469
|
+
return l = c * (1 - m - h), d.top = u, d.height = l, d.bottom = d.top + l, u = d.bottom, n && (f = {
|
|
470
|
+
top: u,
|
|
471
|
+
height: c * m,
|
|
472
|
+
bottom: u + c * m
|
|
473
|
+
}, u = f.bottom), r && (p = {
|
|
474
|
+
top: u,
|
|
475
|
+
height: c * h,
|
|
476
|
+
bottom: u + c * h
|
|
477
|
+
}), {
|
|
478
|
+
width: e,
|
|
479
|
+
height: t,
|
|
480
|
+
plotLeft: 0,
|
|
481
|
+
plotRight: i,
|
|
482
|
+
plotTop: a,
|
|
483
|
+
plotBottom: o,
|
|
484
|
+
plotWidth: s,
|
|
485
|
+
plotHeight: c,
|
|
486
|
+
main: d,
|
|
487
|
+
rsi: f,
|
|
488
|
+
volume: p
|
|
489
|
+
};
|
|
392
490
|
}
|
|
393
|
-
function
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
491
|
+
function ce(e, t) {
|
|
492
|
+
if (t === 0) return {
|
|
493
|
+
from: 0,
|
|
494
|
+
to: 0
|
|
495
|
+
};
|
|
496
|
+
let { from: n, to: r } = e;
|
|
497
|
+
if (r >= t) {
|
|
498
|
+
let e = r - n;
|
|
499
|
+
r = t - 1, n = Math.max(0, r - e);
|
|
500
|
+
}
|
|
501
|
+
return n < 0 && (n = 0), r < n && (r = n), {
|
|
502
|
+
from: n,
|
|
503
|
+
to: r
|
|
504
|
+
};
|
|
401
505
|
}
|
|
402
|
-
function
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
506
|
+
function le(e, t) {
|
|
507
|
+
if (e.type === "sma") return {
|
|
508
|
+
kind: "line",
|
|
509
|
+
values: m(t, e.period),
|
|
510
|
+
color: e.color ?? "var(--crk-chart-2)"
|
|
511
|
+
};
|
|
512
|
+
if (e.type === "ema") return {
|
|
513
|
+
kind: "line",
|
|
514
|
+
values: f(t, e.period),
|
|
515
|
+
color: e.color ?? "var(--crk-chart-3)"
|
|
516
|
+
};
|
|
517
|
+
if (e.type === "bollinger") {
|
|
518
|
+
let n = d(t, e.period, e.stdDev ?? 2);
|
|
519
|
+
return {
|
|
520
|
+
kind: "bollinger",
|
|
521
|
+
middle: n.middle,
|
|
522
|
+
upper: n.upper,
|
|
523
|
+
lower: n.lower,
|
|
524
|
+
color: e.color ?? "var(--crk-chart-4)",
|
|
525
|
+
fillOpacity: e.fillOpacity ?? .1
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
return null;
|
|
419
529
|
}
|
|
420
|
-
function
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
530
|
+
function ue(e, t, n, r, i) {
|
|
531
|
+
let a = 1e400, o = -1e400;
|
|
532
|
+
for (let e of t) e.low < a && (a = e.low), e.high > o && (o = e.high);
|
|
533
|
+
for (let e of n) {
|
|
534
|
+
let t = e.kind === "line" ? [e.values] : [e.upper, e.lower];
|
|
535
|
+
for (let e of t) {
|
|
536
|
+
let t = Math.max(0, Math.floor(r)), n = Math.min(e.length - 1, Math.ceil(i));
|
|
537
|
+
for (let r = t; r <= n; r++) {
|
|
538
|
+
let t = e[r];
|
|
539
|
+
t != null && (t < a && (a = t), t > o && (o = t));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
isFinite(a) && isFinite(o) || (a = 0, o = 1);
|
|
544
|
+
let s = (o - a) * .08 || 1, c = u(a - s, o + s, 5), l = Math.min(c[0], a), d = Math.max(c[c.length - 1], o);
|
|
545
|
+
return {
|
|
546
|
+
paneTop: e.top,
|
|
547
|
+
paneBottom: e.bottom,
|
|
548
|
+
paneHeight: e.height,
|
|
549
|
+
priceMin: l,
|
|
550
|
+
priceMax: d,
|
|
551
|
+
ticks: c
|
|
552
|
+
};
|
|
437
553
|
}
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
554
|
+
function de(e, t, n, r) {
|
|
555
|
+
let i = 0, a = Math.max(0, Math.floor(n)), o = Math.min(t.length - 1, Math.ceil(r));
|
|
556
|
+
for (let e = a; e <= o; e++) {
|
|
557
|
+
let n = t[e].volume ?? 0;
|
|
558
|
+
n > i && (i = n);
|
|
559
|
+
}
|
|
560
|
+
let s = u(0, i || 1, 3), c = Math.max(s[s.length - 1], i);
|
|
561
|
+
return {
|
|
562
|
+
paneTop: e.top,
|
|
563
|
+
paneBottom: e.bottom,
|
|
564
|
+
paneHeight: e.height,
|
|
565
|
+
priceMin: 0,
|
|
566
|
+
priceMax: c,
|
|
567
|
+
ticks: s
|
|
568
|
+
};
|
|
447
569
|
}
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
570
|
+
function E(e, t) {
|
|
571
|
+
let n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
|
|
572
|
+
return t.paneBottom - n * t.paneHeight;
|
|
451
573
|
}
|
|
452
|
-
function
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
};
|
|
467
|
-
return o;
|
|
574
|
+
function fe(e) {
|
|
575
|
+
if (!e || typeof getComputedStyle > "u") return (e) => e;
|
|
576
|
+
let t = getComputedStyle(e), n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
577
|
+
if (!e || !e.includes("var(")) return e;
|
|
578
|
+
let i = n.get(e);
|
|
579
|
+
if (i !== void 0) return i;
|
|
580
|
+
let a = /var\(\s*(--[a-zA-Z0-9_-]+)/.exec(e);
|
|
581
|
+
if (!a) return n.set(e, e), e;
|
|
582
|
+
let o = t.getPropertyValue(a[1]).trim();
|
|
583
|
+
if (!o) return n.set(e, e), e;
|
|
584
|
+
let s = o.includes("var(") ? r(o) : o;
|
|
585
|
+
return n.set(e, s), s;
|
|
586
|
+
};
|
|
587
|
+
return r;
|
|
468
588
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
589
|
+
function pe(e, t) {
|
|
590
|
+
let n = fe(e);
|
|
591
|
+
return {
|
|
592
|
+
up: n(t.up),
|
|
593
|
+
down: n(t.down),
|
|
594
|
+
line: n(t.line),
|
|
595
|
+
text: n("var(--crk-color-text)") || "#0f172a",
|
|
596
|
+
textMuted: n("var(--crk-color-text-muted)") || "#94a3b8",
|
|
597
|
+
axis: n("var(--crk-chart-axis)") || "#94a3b8",
|
|
598
|
+
grid: n("var(--crk-chart-grid)") || "#e2e8f0",
|
|
599
|
+
bg: n("var(--crk-color-bg)") || "#ffffff"
|
|
600
|
+
};
|
|
481
601
|
}
|
|
482
|
-
function
|
|
483
|
-
|
|
602
|
+
function me(e, t, n, r) {
|
|
603
|
+
e.fillStyle = r.textMuted, e.font = "13px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading…", t / 2, n / 2);
|
|
484
604
|
}
|
|
485
|
-
function
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
605
|
+
function he(e, t, n, r, i, a = !1) {
|
|
606
|
+
e.strokeStyle = i.grid, e.lineWidth = 1, e.beginPath();
|
|
607
|
+
for (let i of r.ticks) {
|
|
608
|
+
let a = Math.round(E(i, r)) + .5;
|
|
609
|
+
e.moveTo(t, a), e.lineTo(n, a);
|
|
610
|
+
}
|
|
611
|
+
e.stroke();
|
|
492
612
|
}
|
|
493
|
-
function
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
613
|
+
function ge(e, t, n, r, i) {
|
|
614
|
+
e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
|
|
615
|
+
for (let i of n.ticks) {
|
|
616
|
+
let a = E(i, n);
|
|
617
|
+
e.fillText(i.toFixed(r), t.plotRight + 6, a);
|
|
618
|
+
}
|
|
499
619
|
}
|
|
500
|
-
function
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
620
|
+
function _e(e, t, n, r, i, a, o, s) {
|
|
621
|
+
let c = Math.max(0, Math.floor(n)), l = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, a * .7);
|
|
622
|
+
for (let n = c; n <= l; n++) {
|
|
623
|
+
let r = t[n], a = i(n), c = E(r.open, o), l = E(r.close, o), d = E(r.high, o), f = E(r.low, o), p = r.close >= r.open ? s.up : s.down;
|
|
624
|
+
e.strokeStyle = p, e.fillStyle = p, e.beginPath();
|
|
625
|
+
let m = Math.round(a) + .5;
|
|
626
|
+
e.moveTo(m, d), e.lineTo(m, f), e.stroke();
|
|
627
|
+
let h = Math.min(c, l), g = Math.max(1, Math.abs(l - c));
|
|
628
|
+
e.fillRect(Math.round(a - u / 2), Math.round(h), Math.round(u), Math.round(g));
|
|
629
|
+
}
|
|
510
630
|
}
|
|
511
|
-
function
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
631
|
+
function ve(e, t, n, r, i, a, o, s) {
|
|
632
|
+
let c = Math.max(0, Math.floor(n)), l = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(a * .4, 8));
|
|
633
|
+
e.lineWidth = Math.max(1, Math.min(2, a * .18)), e.lineCap = "butt";
|
|
634
|
+
for (let n = c; n <= l; n++) {
|
|
635
|
+
let r = t[n], a = Math.round(i(n)) + .5, c = E(r.high, o), l = E(r.low, o), d = E(r.open, o), f = E(r.close, o);
|
|
636
|
+
e.strokeStyle = r.close >= r.open ? s.up : s.down, e.beginPath(), e.moveTo(a, c), e.lineTo(a, l), e.moveTo(a - u, d), e.lineTo(a, d), e.moveTo(a, f), e.lineTo(a + u, f), e.stroke();
|
|
637
|
+
}
|
|
518
638
|
}
|
|
519
|
-
function
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
639
|
+
function ye(e, t, n, r, i, a, o, s) {
|
|
640
|
+
let c = Math.max(0, Math.floor(n)), l = Math.min(t.length - 1, Math.ceil(r));
|
|
641
|
+
if (!(l <= c)) {
|
|
642
|
+
e.strokeStyle = o, e.lineWidth = 1.5, e.beginPath(), e.moveTo(i(c), E(t[c].close, a));
|
|
643
|
+
for (let n = c + 1; n <= l; n++) e.lineTo(i(n), E(t[n].close, a));
|
|
644
|
+
e.stroke(), s && (e.globalAlpha = .18, e.fillStyle = o, e.lineTo(i(l), a.paneBottom), e.lineTo(i(c), a.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
|
|
645
|
+
}
|
|
527
646
|
}
|
|
528
|
-
function
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
647
|
+
function be(e, t, n, r, i, a, o, s) {
|
|
648
|
+
if (t.kind === "line") {
|
|
649
|
+
D(e, t.values, i, a, o, s, t.color);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
let c = Math.max(0, Math.floor(i)), l = Math.min(r.length - 1, Math.ceil(a));
|
|
653
|
+
e.globalAlpha = t.fillOpacity, e.fillStyle = t.color, e.beginPath();
|
|
654
|
+
let u = !1;
|
|
655
|
+
for (let n = c; n <= l; n++) {
|
|
656
|
+
let r = t.upper[n];
|
|
657
|
+
if (r == null) continue;
|
|
658
|
+
let i = o(n), a = E(r, s);
|
|
659
|
+
u ? e.lineTo(i, a) : (e.moveTo(i, a), u = !0);
|
|
660
|
+
}
|
|
661
|
+
for (let n = l; n >= c; n--) {
|
|
662
|
+
let r = t.lower[n];
|
|
663
|
+
r != null && e.lineTo(o(n), E(r, s));
|
|
664
|
+
}
|
|
665
|
+
e.closePath(), e.fill(), e.globalAlpha = 1, D(e, t.upper, i, a, o, s, t.color), D(e, t.lower, i, a, o, s, t.color), D(e, t.middle, i, a, o, s, t.color);
|
|
547
666
|
}
|
|
548
|
-
function
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
t.stroke();
|
|
667
|
+
function D(e, t, n, r, i, a, o) {
|
|
668
|
+
e.strokeStyle = o, e.lineWidth = 1.25, e.beginPath();
|
|
669
|
+
let s = !1, c = Math.max(0, Math.floor(n)), l = Math.min(t.length - 1, Math.ceil(r));
|
|
670
|
+
for (let n = c; n <= l; n++) {
|
|
671
|
+
let r = t[n];
|
|
672
|
+
if (r == null) {
|
|
673
|
+
s = !1;
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
let o = i(n), c = E(r, a);
|
|
677
|
+
s ? e.lineTo(o, c) : (e.moveTo(o, c), s = !0);
|
|
678
|
+
}
|
|
679
|
+
e.stroke();
|
|
562
680
|
}
|
|
563
|
-
function
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
t.globalAlpha = 1;
|
|
681
|
+
function xe(e, t, n, r, i, a, o, s) {
|
|
682
|
+
let c = Math.max(0, Math.floor(n)), l = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, a * .7);
|
|
683
|
+
for (let n = c; n <= l; n++) {
|
|
684
|
+
let r = t[n], a = r.volume ?? 0;
|
|
685
|
+
if (a === 0) continue;
|
|
686
|
+
e.fillStyle = r.close >= r.open ? s.up : s.down, e.globalAlpha = .55;
|
|
687
|
+
let c = E(a, o), l = o.paneBottom - c;
|
|
688
|
+
e.fillRect(Math.round(i(n) - u / 2), Math.round(c), Math.round(u), Math.round(l));
|
|
689
|
+
}
|
|
690
|
+
e.globalAlpha = 1;
|
|
574
691
|
}
|
|
575
|
-
function
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
692
|
+
function Se(e, t, n, r, i, a) {
|
|
693
|
+
e.strokeStyle = a.grid, e.setLineDash([3, 3]), e.beginPath();
|
|
694
|
+
for (let a of [r, i]) {
|
|
695
|
+
let r = Math.round(E(a, n)) + .5;
|
|
696
|
+
e.moveTo(t.plotLeft, r), e.lineTo(t.plotRight, r);
|
|
697
|
+
}
|
|
698
|
+
e.stroke(), e.setLineDash([]), e.fillStyle = a.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, E(r, n)), e.fillText(String(i), t.plotRight + 6, E(i, n));
|
|
582
699
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
700
|
+
function Ce(e, t, n, r, i) {
|
|
701
|
+
e.fillStyle = i.textMuted, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "top", e.fillText(r, t.plotLeft + 6, n.top + 4);
|
|
585
702
|
}
|
|
586
|
-
function
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
703
|
+
function we(e, t, n, r, i, a, o) {
|
|
704
|
+
let s = i - r + 1, c = t.plotWidth / s, l = Math.max(1, Math.round(80 / c));
|
|
705
|
+
e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
|
|
706
|
+
let u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(i)), f = t.plotBottom + x / 2;
|
|
707
|
+
for (let i = u; i <= d; i += l) {
|
|
708
|
+
let o = n[i], s = t.plotLeft + (i - r + .5) * c;
|
|
709
|
+
e.fillText(O(o.time, a), s, f);
|
|
710
|
+
}
|
|
594
711
|
}
|
|
595
|
-
function
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
const y = t.measureText(Z).width + 8 * 2, F = 18, V = Math.max(
|
|
620
|
-
n.plotLeft,
|
|
621
|
-
Math.min(n.plotRight - y, Y - y / 2)
|
|
622
|
-
), z = Math.max(0, n.plotTop - F - 2);
|
|
623
|
-
if (d) {
|
|
624
|
-
const K = _.close >= _.open;
|
|
625
|
-
t.fillStyle = K ? u.up : u.down, t.fillRect(V, z, y, F), t.fillStyle = "#ffffff";
|
|
626
|
-
} else
|
|
627
|
-
t.fillStyle = u.text, t.fillRect(V, z, y, F), t.fillStyle = u.bg;
|
|
628
|
-
t.textAlign = "center", t.fillText(Z, V + y / 2, z + F / 2);
|
|
629
|
-
}
|
|
630
|
-
t.restore();
|
|
712
|
+
function Te(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m) {
|
|
713
|
+
if (n.x < t.plotLeft || n.x > t.plotRight) return;
|
|
714
|
+
let h = a - i + 1, g = t.plotWidth / h, _ = i + (n.x - t.plotLeft) / g - .5, v = Math.round(_), y = Math.max(0, Math.min(r.length - 1, v)), S = o(y);
|
|
715
|
+
if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(S + .5, t.plotTop), e.lineTo(S + .5, t.plotBottom), e.moveTo(t.plotLeft, n.y + .5), e.lineTo(t.plotRight, n.y + .5), e.stroke(), e.setLineDash([]), n.y >= c.paneTop && n.y <= c.paneBottom) {
|
|
716
|
+
let r = c.priceMax - (n.y - c.paneTop) / c.paneHeight * (c.priceMax - c.priceMin);
|
|
717
|
+
e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, b, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(r.toFixed(s), t.plotRight + 6, n.y);
|
|
718
|
+
}
|
|
719
|
+
if (r[y]) {
|
|
720
|
+
let n = M(r[y].time, l);
|
|
721
|
+
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
722
|
+
let i = e.measureText(n).width + 16, a = x, o = Math.max(t.plotLeft, Math.min(t.plotRight - i, S - i / 2)), s = t.plotBottom;
|
|
723
|
+
e.fillStyle = u.text, e.fillRect(o, s, i, a), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(n, o + i / 2, s + a / 2);
|
|
724
|
+
}
|
|
725
|
+
if (r[y]) {
|
|
726
|
+
let n = r[y], i = n.close.toFixed(s), a = i;
|
|
727
|
+
if (p) {
|
|
728
|
+
let e = (m ?? j)(n.time, d, l);
|
|
729
|
+
e && (a = `${i} · ${e}`);
|
|
730
|
+
}
|
|
731
|
+
e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
|
|
732
|
+
let o = e.measureText(a).width + 16, c = Math.max(t.plotLeft, Math.min(t.plotRight - o, S - o / 2)), h = Math.max(0, t.plotTop - 18 - 2);
|
|
733
|
+
f ? (e.fillStyle = n.close >= n.open ? u.up : u.down, e.fillRect(c, h, o, 18), e.fillStyle = "#ffffff") : (e.fillStyle = u.text, e.fillRect(c, h, o, 18), e.fillStyle = u.bg), e.textAlign = "center", e.fillText(a, c + o / 2, h + 9);
|
|
734
|
+
}
|
|
735
|
+
e.restore();
|
|
631
736
|
}
|
|
632
|
-
function
|
|
633
|
-
|
|
634
|
-
|
|
737
|
+
function Ee(e, t, n, r, i, a, o) {
|
|
738
|
+
let s = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(i) + 1)), c = ue(t.main, s, [], r, i);
|
|
739
|
+
return e < c.paneTop || e > c.paneBottom ? null : c.priceMax - (e - c.paneTop) / c.paneHeight * (c.priceMax - c.priceMin);
|
|
635
740
|
}
|
|
636
|
-
function
|
|
637
|
-
|
|
638
|
-
|
|
741
|
+
function O(e, t) {
|
|
742
|
+
let n = /* @__PURE__ */ new Date(e * 1e3);
|
|
743
|
+
return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${P(n.getUTCMonth() + 1)}-${P(n.getUTCDate())}` : `${P(n.getUTCHours())}:${P(n.getUTCMinutes())}`;
|
|
639
744
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
],
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
745
|
+
var k = [
|
|
746
|
+
"Jan",
|
|
747
|
+
"Feb",
|
|
748
|
+
"Mar",
|
|
749
|
+
"Apr",
|
|
750
|
+
"May",
|
|
751
|
+
"Jun",
|
|
752
|
+
"Jul",
|
|
753
|
+
"Aug",
|
|
754
|
+
"Sep",
|
|
755
|
+
"Oct",
|
|
756
|
+
"Nov",
|
|
757
|
+
"Dec"
|
|
758
|
+
], A = [
|
|
759
|
+
"Sun",
|
|
760
|
+
"Mon",
|
|
761
|
+
"Tue",
|
|
762
|
+
"Wed",
|
|
763
|
+
"Thu",
|
|
764
|
+
"Fri",
|
|
765
|
+
"Sat"
|
|
766
|
+
];
|
|
767
|
+
function j(e, t, n) {
|
|
768
|
+
let r = /* @__PURE__ */ new Date(e * 1e3), i = t === "D" || t === "W" || t === "M", a, o, s, c, l, u;
|
|
769
|
+
if (n === "local") a = r.getDate(), o = r.getMonth(), s = r.getFullYear(), c = r.getHours(), l = r.getMinutes(), u = r.getDay();
|
|
770
|
+
else if (n === "utc") a = r.getUTCDate(), o = r.getUTCMonth(), s = r.getUTCFullYear(), c = r.getUTCHours(), l = r.getUTCMinutes(), u = r.getUTCDay();
|
|
771
|
+
else try {
|
|
772
|
+
let e = new Intl.DateTimeFormat("en-US", {
|
|
773
|
+
timeZone: n,
|
|
774
|
+
year: "numeric",
|
|
775
|
+
month: "2-digit",
|
|
776
|
+
day: "2-digit",
|
|
777
|
+
hour: "2-digit",
|
|
778
|
+
minute: "2-digit",
|
|
779
|
+
weekday: "short",
|
|
780
|
+
hour12: !1,
|
|
781
|
+
hourCycle: "h23"
|
|
782
|
+
}).formatToParts(r), t = (t) => e.find((e) => e.type === t)?.value ?? "";
|
|
783
|
+
a = Number(t("day")), o = Number(t("month")) - 1, s = Number(t("year")), c = Number(t("hour")), l = Number(t("minute"));
|
|
784
|
+
let i = t("weekday"), d = A.indexOf(i);
|
|
785
|
+
u = d >= 0 ? d : 0;
|
|
786
|
+
} catch {
|
|
787
|
+
return j(e, t, "utc");
|
|
788
|
+
}
|
|
789
|
+
return i ? `${a} ${k[o]} ${s}` : `${A[u]} ${a} ${k[o]} ${P(c)}:${P(l)}`;
|
|
681
790
|
}
|
|
682
|
-
function
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
return Et(t, "utc");
|
|
704
|
-
}
|
|
791
|
+
function M(e, t) {
|
|
792
|
+
let n = /* @__PURE__ */ new Date(e * 1e3);
|
|
793
|
+
if (t === "local") return `${n.getFullYear()}-${P(n.getMonth() + 1)}-${P(n.getDate())} ${P(n.getHours())}:${P(n.getMinutes())}:${P(n.getSeconds())} ${N(n)}`;
|
|
794
|
+
if (t === "utc") return `${n.getUTCFullYear()}-${P(n.getUTCMonth() + 1)}-${P(n.getUTCDate())} ${P(n.getUTCHours())}:${P(n.getUTCMinutes())}:${P(n.getUTCSeconds())} UTC`;
|
|
795
|
+
try {
|
|
796
|
+
let e = new Intl.DateTimeFormat("en-CA", {
|
|
797
|
+
timeZone: t,
|
|
798
|
+
year: "numeric",
|
|
799
|
+
month: "2-digit",
|
|
800
|
+
day: "2-digit",
|
|
801
|
+
hour: "2-digit",
|
|
802
|
+
minute: "2-digit",
|
|
803
|
+
second: "2-digit",
|
|
804
|
+
hour12: !1,
|
|
805
|
+
hourCycle: "h23",
|
|
806
|
+
timeZoneName: "short"
|
|
807
|
+
}).formatToParts(n), r = (t) => e.find((e) => e.type === t)?.value ?? "", i = r("timeZoneName") || t;
|
|
808
|
+
return `${r("year")}-${r("month")}-${r("day")} ${r("hour")}:${r("minute")}:${r("second")} ${i}`;
|
|
809
|
+
} catch {
|
|
810
|
+
return M(e, "utc");
|
|
811
|
+
}
|
|
705
812
|
}
|
|
706
|
-
function
|
|
707
|
-
|
|
708
|
-
|
|
813
|
+
function N(e) {
|
|
814
|
+
let t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
|
|
815
|
+
return `${n}${P(Math.floor(r / 60))}:${P(r % 60)}`;
|
|
709
816
|
}
|
|
710
|
-
function
|
|
711
|
-
|
|
817
|
+
function P(e) {
|
|
818
|
+
return e < 10 ? `0${e}` : String(e);
|
|
712
819
|
}
|
|
713
|
-
function
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
820
|
+
function F(e) {
|
|
821
|
+
if (e === "D") return 86400;
|
|
822
|
+
if (e === "W") return 604800;
|
|
823
|
+
if (e === "M") return 2592e3;
|
|
824
|
+
let t = Number(e);
|
|
825
|
+
if (Number.isFinite(t)) return t * 60;
|
|
826
|
+
let n = /^(\d+)([HhDdWwMm])$/.exec(e);
|
|
827
|
+
if (n) {
|
|
828
|
+
let e = Number(n[1]), t = n[2].toUpperCase();
|
|
829
|
+
if (t === "H") return e * 3600;
|
|
830
|
+
if (t === "D") return e * 86400;
|
|
831
|
+
if (t === "W") return e * 86400 * 7;
|
|
832
|
+
if (t === "M") return e * 60;
|
|
833
|
+
}
|
|
834
|
+
return 60;
|
|
728
835
|
}
|
|
729
|
-
export {
|
|
730
|
-
Ge as TradingChart,
|
|
731
|
-
Bt as approxIntervalSeconds,
|
|
732
|
-
Et as formatCrosshairTime
|
|
733
|
-
};
|
|
836
|
+
export { ae as TradingChart, F as approxIntervalSeconds, M as formatCrosshairTime };
|