@overdoser/react-toolkit 0.21.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.
Files changed (161) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +27 -0
  3. package/components/Accordion/Accordion.js +48 -48
  4. package/components/ActionButton/ActionButton.js +23 -23
  5. package/components/ActionButton/CopyButton.js +5 -5
  6. package/components/Alert/Alert.js +13 -13
  7. package/components/Avatar/Avatar.js +12 -12
  8. package/components/Badge/Badge.js +6 -6
  9. package/components/Breadcrumbs/Breadcrumbs.js +15 -15
  10. package/components/Button/Button.js +14 -14
  11. package/components/Card/Card.js +26 -26
  12. package/components/Chart/AreaChart.js +103 -103
  13. package/components/Chart/Axis.js +7 -7
  14. package/components/Chart/BarChart.js +62 -62
  15. package/components/Chart/ChartContainer.js +11 -11
  16. package/components/Chart/ChartLegend.js +7 -7
  17. package/components/Chart/ChartTooltip.js +13 -13
  18. package/components/Chart/LineChart.js +88 -88
  19. package/components/Chart/PieChart.js +25 -25
  20. package/components/Chart/RadarChart.js +42 -42
  21. package/components/Chart/Sparkline.js +11 -11
  22. package/components/Chart/TradingChart.js +126 -126
  23. package/components/Chart/trading/period.js +3 -3
  24. package/components/Chip/Chip.js +24 -24
  25. package/components/CodeBlock/CodeBlock.js +31 -31
  26. package/components/CommandPalette/CommandPalette.js +166 -166
  27. package/components/ConfirmDialog/ConfirmDialog.js +60 -60
  28. package/components/Divider/Divider.js +10 -10
  29. package/components/Draggable/Draggable.js +29 -29
  30. package/components/Drawer/Drawer.js +53 -53
  31. package/components/Dropdown/Dropdown.js +66 -66
  32. package/components/Dropdown/DropdownItem.js +13 -13
  33. package/components/Dropdown/DropdownLabel.js +5 -5
  34. package/components/Dropdown/DropdownSeparator.js +5 -5
  35. package/components/Dropzone/Dropzone.js +15 -15
  36. package/components/EmptyState/EmptyState.js +11 -11
  37. package/components/Form/Form.js +17 -17
  38. package/components/Form/FormField.js +21 -21
  39. package/components/Form/FormRow.js +3 -3
  40. package/components/ImageViewer/ImageViewer.js +118 -118
  41. package/components/Kbd/Kbd.js +11 -11
  42. package/components/KeyValueList/KeyValueList.js +32 -32
  43. package/components/Link/Link.js +7 -7
  44. package/components/List/List.js +7 -7
  45. package/components/Loader/Loader.js +39 -39
  46. package/components/Modal/Modal.js +48 -48
  47. package/components/PageHeader/PageHeader.js +18 -18
  48. package/components/Pagination/Pagination.js +23 -23
  49. package/components/Popover/Popover.js +25 -25
  50. package/components/ProgressBar/ProgressBar.js +17 -17
  51. package/components/RelativeTime/RelativeTime.js +10 -10
  52. package/components/SegmentedControl/SegmentedControl.js +38 -38
  53. package/components/Skeleton/Skeleton.js +10 -10
  54. package/components/Spinner/Spinner.js +7 -7
  55. package/components/SplitButton/SplitButton.js +63 -63
  56. package/components/SplitPane/SplitPane.js +50 -50
  57. package/components/StatCard/StatCard.js +32 -32
  58. package/components/StatusDot/StatusDot.js +7 -7
  59. package/components/Table/Table.js +174 -174
  60. package/components/Tabs/Tabs.js +47 -47
  61. package/components/ThemeToggle/ThemeToggle.js +31 -31
  62. package/components/Timeline/GanttTimeline.js +213 -213
  63. package/components/Timeline/HistoryTimeline.js +306 -306
  64. package/components/Timeline/TimelineShared.js +103 -103
  65. package/components/Timeline/TraceEventDetails.js +103 -103
  66. package/components/Timeline/TraceTimeline.js +546 -546
  67. package/components/Timeline/historyLayout.js +2 -2
  68. package/components/Timer/Timer.js +39 -39
  69. package/components/Toast/Toast.js +59 -59
  70. package/components/ToggleIconButton/ToggleIconButton.js +9 -9
  71. package/components/Tooltip/Tooltip.js +16 -16
  72. package/components/Typography/Typography.js +5 -5
  73. package/components/inputs/Checkbox/Checkbox.js +11 -11
  74. package/components/inputs/Checkbox/CheckboxGroup.js +21 -21
  75. package/components/inputs/DatePicker/CalendarPanel.js +113 -113
  76. package/components/inputs/DatePicker/DatePicker.js +39 -39
  77. package/components/inputs/DateTimePicker/DateTimePicker.js +119 -119
  78. package/components/inputs/DateTimePicker/DateTimeSegments.js +40 -40
  79. package/components/inputs/DateTimePicker/TimeField.js +34 -34
  80. package/components/inputs/Input/Input.js +13 -13
  81. package/components/inputs/NumberInput/NumberInput.js +16 -16
  82. package/components/inputs/Radio/Radio.js +17 -17
  83. package/components/inputs/SearchInput/SearchInput.js +25 -25
  84. package/components/inputs/Select/Select.d.ts +55 -3
  85. package/components/inputs/Select/Select.js +485 -344
  86. package/components/inputs/Select/{Select.module.js → Select.module.scss.js} +15 -3
  87. package/components/inputs/Slider/Slider.js +21 -21
  88. package/components/inputs/Switch/Switch.js +4 -4
  89. package/components/inputs/Textarea/Textarea.js +8 -8
  90. package/hooks/usePortalPosition.d.ts +2 -1
  91. package/hooks/usePortalPosition.js +6 -3
  92. package/hooks/useResizable.js +1 -1
  93. package/hooks/useTheme.js +7 -7
  94. package/index.css +1 -1
  95. package/index.js +1 -1
  96. package/index.layered.css +1 -1
  97. package/llms.txt +25 -4
  98. package/manifest.json +33 -4
  99. package/package.json +1 -1
  100. /package/components/Accordion/{Accordion.module.js → Accordion.module.scss.js} +0 -0
  101. /package/components/ActionButton/{ActionButton.module.js → ActionButton.module.scss.js} +0 -0
  102. /package/components/Alert/{Alert.module.js → Alert.module.scss.js} +0 -0
  103. /package/components/Avatar/{Avatar.module.js → Avatar.module.scss.js} +0 -0
  104. /package/components/Badge/{Badge.module.js → Badge.module.scss.js} +0 -0
  105. /package/components/Breadcrumbs/{Breadcrumbs.module.js → Breadcrumbs.module.scss.js} +0 -0
  106. /package/components/Button/{Button.module.js → Button.module.scss.js} +0 -0
  107. /package/components/Card/{Card.module.js → Card.module.scss.js} +0 -0
  108. /package/components/Chart/{Chart.module.js → Chart.module.scss.js} +0 -0
  109. /package/components/Chip/{Chip.module.js → Chip.module.scss.js} +0 -0
  110. /package/components/CodeBlock/{CodeBlock.module.js → CodeBlock.module.scss.js} +0 -0
  111. /package/components/CommandPalette/{CommandPalette.module.js → CommandPalette.module.scss.js} +0 -0
  112. /package/components/ConfirmDialog/{ConfirmDialog.module.js → ConfirmDialog.module.scss.js} +0 -0
  113. /package/components/Divider/{Divider.module.js → Divider.module.scss.js} +0 -0
  114. /package/components/Draggable/{Draggable.module.js → Draggable.module.scss.js} +0 -0
  115. /package/components/Drawer/{Drawer.module.js → Drawer.module.scss.js} +0 -0
  116. /package/components/Dropdown/{Dropdown.module.js → Dropdown.module.scss.js} +0 -0
  117. /package/components/Dropzone/{Dropzone.module.js → Dropzone.module.scss.js} +0 -0
  118. /package/components/EmptyState/{EmptyState.module.js → EmptyState.module.scss.js} +0 -0
  119. /package/components/Form/{Form.module.js → Form.module.scss.js} +0 -0
  120. /package/components/ImageViewer/{ImageViewer.module.js → ImageViewer.module.scss.js} +0 -0
  121. /package/components/Kbd/{Kbd.module.js → Kbd.module.scss.js} +0 -0
  122. /package/components/KeyValueList/{KeyValueList.module.js → KeyValueList.module.scss.js} +0 -0
  123. /package/components/Link/{Link.module.js → Link.module.scss.js} +0 -0
  124. /package/components/List/{List.module.js → List.module.scss.js} +0 -0
  125. /package/components/Loader/{Loader.module.js → Loader.module.scss.js} +0 -0
  126. /package/components/Modal/{Modal.module.js → Modal.module.scss.js} +0 -0
  127. /package/components/PageHeader/{PageHeader.module.js → PageHeader.module.scss.js} +0 -0
  128. /package/components/Pagination/{Pagination.module.js → Pagination.module.scss.js} +0 -0
  129. /package/components/Popover/{Popover.module.js → Popover.module.scss.js} +0 -0
  130. /package/components/ProgressBar/{ProgressBar.module.js → ProgressBar.module.scss.js} +0 -0
  131. /package/components/RelativeTime/{RelativeTime.module.js → RelativeTime.module.scss.js} +0 -0
  132. /package/components/SegmentedControl/{SegmentedControl.module.js → SegmentedControl.module.scss.js} +0 -0
  133. /package/components/Skeleton/{Skeleton.module.js → Skeleton.module.scss.js} +0 -0
  134. /package/components/Spinner/{Spinner.module.js → Spinner.module.scss.js} +0 -0
  135. /package/components/SplitButton/{SplitButton.module.js → SplitButton.module.scss.js} +0 -0
  136. /package/components/SplitPane/{SplitPane.module.js → SplitPane.module.scss.js} +0 -0
  137. /package/components/StatCard/{StatCard.module.js → StatCard.module.scss.js} +0 -0
  138. /package/components/StatusDot/{StatusDot.module.js → StatusDot.module.scss.js} +0 -0
  139. /package/components/Table/{Table.module.js → Table.module.scss.js} +0 -0
  140. /package/components/Tabs/{Tabs.module.js → Tabs.module.scss.js} +0 -0
  141. /package/components/ThemeToggle/{ThemeToggle.module.js → ThemeToggle.module.scss.js} +0 -0
  142. /package/components/Timeline/{GanttTimeline.module.js → GanttTimeline.module.scss.js} +0 -0
  143. /package/components/Timeline/{HistoryTimeline.module.js → HistoryTimeline.module.scss.js} +0 -0
  144. /package/components/Timeline/{Timeline.module.js → Timeline.module.scss.js} +0 -0
  145. /package/components/Timeline/{TraceTimeline.module.js → TraceTimeline.module.scss.js} +0 -0
  146. /package/components/Timer/{Timer.module.js → Timer.module.scss.js} +0 -0
  147. /package/components/Toast/{Toast.module.js → Toast.module.scss.js} +0 -0
  148. /package/components/ToggleIconButton/{ToggleIconButton.module.js → ToggleIconButton.module.scss.js} +0 -0
  149. /package/components/Tooltip/{Tooltip.module.js → Tooltip.module.scss.js} +0 -0
  150. /package/components/Typography/{Typography.module.js → Typography.module.scss.js} +0 -0
  151. /package/components/inputs/Checkbox/{Checkbox.module.js → Checkbox.module.scss.js} +0 -0
  152. /package/components/inputs/Checkbox/{CheckboxGroup.module.js → CheckboxGroup.module.scss.js} +0 -0
  153. /package/components/inputs/DatePicker/{CalendarPanel.module.js → CalendarPanel.module.scss.js} +0 -0
  154. /package/components/inputs/DatePicker/{DatePicker.module.js → DatePicker.module.scss.js} +0 -0
  155. /package/components/inputs/DateTimePicker/{DateTimePicker.module.js → DateTimePicker.module.scss.js} +0 -0
  156. /package/components/inputs/Input/{Input.module.js → Input.module.scss.js} +0 -0
  157. /package/components/inputs/NumberInput/{NumberInput.module.js → NumberInput.module.scss.js} +0 -0
  158. /package/components/inputs/Radio/{Radio.module.js → Radio.module.scss.js} +0 -0
  159. /package/components/inputs/SearchInput/{SearchInput.module.js → SearchInput.module.scss.js} +0 -0
  160. /package/components/inputs/Slider/{Slider.module.js → Slider.module.scss.js} +0 -0
  161. /package/components/inputs/Textarea/{Textarea.module.js → Textarea.module.scss.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { extent as e, linearScale as t } from "./scales.js";
2
- import n from "./Chart.module.js";
3
- import { forwardRef as r, useMemo as i } from "react";
4
- import a from "clsx";
1
+ import { forwardRef as e, useMemo as t } from "react";
2
+ import n from "clsx";
3
+ import { extent as r, linearScale as i } from "./scales.js";
4
+ import a from "./Chart.module.scss.js";
5
5
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
6
  // src/components/Chart/Sparkline.tsx
7
7
  function c(e, t) {
@@ -14,24 +14,24 @@ function c(e, t) {
14
14
  }
15
15
  return n;
16
16
  }
17
- var l = r(({ data: r, width: l = 80, height: u = 24, color: d = "var(--crk-chart-1)", strokeWidth: f = 1.5, curve: p = "monotone", fill: m = !1, showLastPoint: h = !1, "aria-label": g, className: _, style: v }, y) => {
18
- let { line: b, area: x, last: S } = i(() => {
19
- if (r.length === 0) return {
17
+ var l = e(({ data: e, width: l = 80, height: u = 24, color: d = "var(--crk-chart-1)", strokeWidth: f = 1.5, curve: p = "monotone", fill: m = !1, showLastPoint: h = !1, "aria-label": g, className: _, style: v }, y) => {
18
+ let { line: b, area: x, last: S } = t(() => {
19
+ if (e.length === 0) return {
20
20
  line: "",
21
21
  area: "",
22
22
  last: null
23
23
  };
24
- let n = f, i = Math.max(1, l - n * 2), a = Math.max(1, u - n * 2), [o, s] = e(r), d = t([0, Math.max(1, r.length - 1)], [n, n + i]), h = t([o, s], [n + a, n]), g = r.map((e, t) => ({
24
+ let t = f, n = Math.max(1, l - t * 2), a = Math.max(1, u - t * 2), [o, s] = r(e), d = i([0, Math.max(1, e.length - 1)], [t, t + n]), h = i([o, s], [t + a, t]), g = e.map((e, t) => ({
25
25
  x: d(t),
26
26
  y: h(e)
27
27
  })), _ = c(g, p);
28
28
  return {
29
29
  line: _,
30
- area: m ? `${_} L ${g[g.length - 1].x} ${n + a} L ${g[0].x} ${n + a} Z` : "",
30
+ area: m ? `${_} L ${g[g.length - 1].x} ${t + a} L ${g[0].x} ${t + a} Z` : "",
31
31
  last: g[g.length - 1]
32
32
  };
33
33
  }, [
34
- r,
34
+ e,
35
35
  l,
36
36
  u,
37
37
  f,
@@ -40,7 +40,7 @@ var l = r(({ data: r, width: l = 80, height: u = 24, color: d = "var(--crk-chart
40
40
  ]);
41
41
  return /* @__PURE__ */ s("svg", {
42
42
  ref: y,
43
- className: a(n.sparkline, _),
43
+ className: n(a.sparkline, _),
44
44
  style: v,
45
45
  width: l,
46
46
  height: u,
@@ -1,30 +1,30 @@
1
- import { Button as e } from "../Button/Button.js";
2
- import { Dropdown as t } from "../Dropdown/Dropdown.js";
3
- import { Popover as n } from "../Popover/Popover.js";
4
- import { niceTicks as r } from "./scales.js";
5
- import { bollinger as i, ema as a, rsi as o, sma as s } from "./trading/indicators.js";
6
- import { periodToSeconds as c } from "./trading/period.js";
7
- import l from "./Chart.module.js";
8
- import { useCallback as u, useEffect as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
9
- import g from "clsx";
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
10
  import { jsx as _, jsxs as v } from "react/jsx-runtime";
11
11
  // src/components/Chart/TradingChart.tsx
12
12
  var y = 420, b = 64, x = 28, S = 40, ee = 4, C = {
13
13
  rsi: .18,
14
14
  volume: .14
15
15
  }, te = 1, ne = 40, re = 500, ie = [];
16
- function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s = "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 = m(null), L = m(null), R = m([]), z = m({
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
18
  from: 0,
19
19
  to: 0
20
- }), B = m(null), V = m(null), H = m(!1), U = m(0), W = m(null), G = m(null), Me = m(1), K = m({
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
21
  width: 0,
22
22
  height: 0
23
- }), Ne = m(() => {}), Pe = m(Oe), q = m(ke);
23
+ }), Ne = i(() => {}), Pe = i(Oe), q = i(ke);
24
24
  Pe.current = Oe, q.current = ke;
25
- let [J, Fe] = h(null), [Ie, Le] = h(A), Re = k ?? Ie, ze = u((e) => {
25
+ let [J, Fe] = a(null), [Ie, Le] = a(A), Re = k ?? Ie, ze = e((e) => {
26
26
  k === void 0 && Le(e), j?.(e);
27
- }, [k, j]), Be = p(() => ({
27
+ }, [k, j]), Be = r(() => ({
28
28
  up: w,
29
29
  down: E,
30
30
  line: O
@@ -33,55 +33,55 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
33
33
  E,
34
34
  O
35
35
  ]), Y = x, X = Y.some((e) => e.type === "rsi"), Z = Y.some((e) => e.type === "volume");
36
- Ne.current = u(() => {
36
+ Ne.current = e(() => {
37
37
  let e = L.current;
38
38
  if (!e) return;
39
39
  let t = e.getContext("2d");
40
40
  if (!t) return;
41
41
  let { width: n, height: r } = K.current;
42
42
  if (n === 0 || r === 0) return;
43
- let a = Me.current;
44
- t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, e.width, e.height), t.scale(a, a);
45
- let c = pe(I.current, Be), l = fe(I.current), u = R.current;
46
- if (u.length === 0) {
47
- me(t, n, r, c), t.restore();
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
48
  return;
49
49
  }
50
- let d = T(n, r, X, Z), { from: f, to: p } = ce(z.current, u.length);
50
+ let c = T(n, r, X, Z), { from: l, to: u } = ce(z.current, s.length);
51
51
  z.current = {
52
- from: f,
53
- to: p
52
+ from: l,
53
+ to: u
54
54
  };
55
- let m = u.slice(Math.max(0, Math.floor(f)), Math.min(u.length, Math.ceil(p) + 1)), h = (e) => {
56
- let t = p - f + 1, n = d.plotWidth / t;
57
- return d.plotLeft + (e - f + .5) * n;
58
- }, g = d.plotWidth / (p - f + 1), _ = Y.map((e) => le(e, u)).filter((e) => e !== null).map((e) => ({
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
59
  ...e,
60
- color: l(e.color)
61
- })), v = ue(d.main, m, _, f, p);
62
- he(t, d.plotLeft, d.plotRight, v, c), ge(t, d, v, S, c), t.save(), t.beginPath(), t.rect(d.plotLeft, v.paneTop, d.plotWidth, v.paneHeight), t.clip();
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
63
  for (let e = 0; e < Y.length; e++) {
64
64
  let n = Y[e], r = _[e];
65
- r && be(t, r, n, u, f, p, h, v);
65
+ r && be(t, r, n, s, l, u, h, v);
66
66
  }
67
- if (s === "candle" ? _e(t, u, f, p, h, g, v, {
68
- up: c.up,
69
- down: c.down
70
- }) : s === "bar" ? ve(t, u, f, p, h, g, v, {
71
- up: c.up,
72
- down: c.down
73
- }) : ye(t, u, f, p, h, v, c.line, s === "area"), t.restore(), d.volume) {
74
- let e = de(d.volume, u, f, p);
75
- he(t, d.plotLeft, d.plotRight, e, c, !0), Ce(t, d, d.volume, "Volume", c), t.save(), t.beginPath(), t.rect(d.plotLeft, e.paneTop, d.plotWidth, e.paneHeight), t.clip(), xe(t, u, f, p, h, g, e, {
76
- up: c.up,
77
- down: c.down
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
78
  }), t.restore();
79
79
  }
80
- if (d.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, a = l((e && e.type === "rsi" ? e.color : void 0) ?? "var(--crk-chart-5)"), s = o(u, n), m = {
82
- paneTop: d.rsi.top,
83
- paneBottom: d.rsi.bottom,
84
- paneHeight: d.rsi.height,
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
85
  priceMin: 0,
86
86
  priceMax: 100,
87
87
  ticks: [
@@ -90,28 +90,28 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
90
90
  r
91
91
  ]
92
92
  };
93
- he(t, d.plotLeft, d.plotRight, m, c, !0), Ce(t, d, d.rsi, `RSI ${n}`, c), t.save(), t.beginPath(), t.rect(d.plotLeft, m.paneTop, d.plotWidth, m.paneHeight), t.clip(), D(t, s, f, p, h, m, a), t.restore(), Se(t, d, m, r, i, c);
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
94
  }
95
- we(t, d, u, f, p, i, c), B.current && Te(t, d, B.current, u, f, p, h, S, v, Re, c, i, N, P, De), t.restore();
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
96
  }, [
97
- s,
97
+ m,
98
98
  Y,
99
99
  X,
100
100
  Z,
101
101
  S,
102
102
  Be,
103
- i,
103
+ d,
104
104
  Re,
105
105
  N,
106
106
  P,
107
107
  De
108
108
  ]);
109
- let Q = u(() => {
109
+ let Q = e(() => {
110
110
  G.current === null && (typeof requestAnimationFrame > "u" ? Ne.current() : G.current = requestAnimationFrame(() => {
111
111
  G.current = null, Ne.current();
112
112
  }));
113
113
  }, []);
114
- f(() => {
114
+ n(() => {
115
115
  let e = I.current;
116
116
  if (!e) return;
117
117
  let t = () => {
@@ -126,23 +126,23 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
126
126
  if (t(), typeof ResizeObserver > "u") return;
127
127
  let n = new ResizeObserver(t);
128
128
  return n.observe(e), () => n.disconnect();
129
- }, [Q]), d(() => {
130
- let e = !1, n = Math.floor(Date.now() / 1e3), o = F(i), s = a === "MAX", l = a === void 0 ? o * C : c(a), u = a === void 0 ? C : Math.max(10, Math.ceil(l / o)), d = s ? 0 : n - l;
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
131
  R.current = [], z.current = {
132
132
  from: 0,
133
133
  to: 0
134
- }, U.current += 1, H.current = !1, Q(), t.getBars({
135
- symbol: r,
136
- resolution: i,
137
- from: d,
138
- to: n,
139
- countBack: u
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
140
  }).then((t) => {
141
141
  if (e) return;
142
142
  let n = [...t].sort((e, t) => e.time - t.time);
143
143
  R.current = n;
144
144
  let r = n.length - 1;
145
- if (a !== void 0) z.current = {
145
+ if (f !== void 0) z.current = {
146
146
  from: 0,
147
147
  to: r
148
148
  };
@@ -155,9 +155,9 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
155
155
  }
156
156
  q.current?.(z.current, n), Q();
157
157
  }).catch(() => {});
158
- let f = t.subscribeBars({
159
- symbol: r,
160
- resolution: i,
158
+ let s = c.subscribeBars({
159
+ symbol: u,
160
+ resolution: d,
161
161
  onTick: (t) => {
162
162
  if (e) return;
163
163
  let n = R.current, r = n[n.length - 1];
@@ -173,19 +173,19 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
173
173
  Q();
174
174
  }
175
175
  });
176
- return W.current = f, () => {
177
- e = !0, W.current !== null && (t.unsubscribeBars(W.current), W.current = null);
176
+ return W.current = s, () => {
177
+ e = !0, W.current !== null && (c.unsubscribeBars(W.current), W.current = null);
178
178
  };
179
179
  }, [
180
- t,
181
- r,
182
- i,
183
- a,
180
+ c,
181
+ u,
182
+ d,
183
+ f,
184
184
  C
185
185
  ]);
186
- let $ = u((e) => {
186
+ let $ = e((e) => {
187
187
  Fe(e), Pe.current?.(e);
188
- }, []), Ve = u((e) => {
188
+ }, []), Ve = e((e) => {
189
189
  e.currentTarget.setPointerCapture(e.pointerId);
190
190
  let t = z.current;
191
191
  V.current = {
@@ -193,39 +193,39 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
193
193
  from: t.from,
194
194
  to: t.to
195
195
  };
196
- }, []), He = u(() => {
196
+ }, []), He = e(() => {
197
197
  if (H.current) return;
198
198
  let e = R.current;
199
199
  if (e.length === 0) return;
200
200
  H.current = !0;
201
- let n = U.current, a = F(i), o = e[0].time, s = o - a * C, c = o - a;
202
- t.getBars({
203
- symbol: r,
204
- resolution: i,
205
- from: s,
206
- to: c,
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
207
  countBack: C
208
208
  }).then((e) => {
209
- if (n !== U.current) return;
209
+ if (t !== U.current) return;
210
210
  if (e.length === 0) {
211
211
  H.current = !1;
212
212
  return;
213
213
  }
214
- let t = [...e].sort((e, t) => e.time - t.time).filter((e) => e.time < o), r = z.current;
215
- R.current = [...t, ...R.current], z.current = {
216
- from: r.from + t.length,
217
- to: r.to + t.length
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
218
  }, H.current = !1, Q();
219
219
  }).catch(() => {
220
- n === U.current && (H.current = !1);
220
+ t === U.current && (H.current = !1);
221
221
  });
222
222
  }, [
223
- t,
224
- r,
225
- i,
223
+ c,
224
+ u,
225
+ d,
226
226
  C,
227
227
  Q
228
- ]), Ue = u((e) => {
228
+ ]), Ue = e((e) => {
229
229
  let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top;
230
230
  if (B.current = {
231
231
  x: n,
@@ -253,11 +253,11 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
253
253
  He,
254
254
  Q,
255
255
  $
256
- ]), We = u((e) => {
256
+ ]), We = e((e) => {
257
257
  e.currentTarget.releasePointerCapture(e.pointerId), V.current = null;
258
- }, []), Ge = u(() => {
258
+ }, []), Ge = e(() => {
259
259
  B.current = null, V.current = null, $(null), Q();
260
- }, [Q, $]), Ke = u((e) => {
260
+ }, [Q, $]), Ke = e((e) => {
261
261
  e.preventDefault();
262
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
263
  if (a.length === 0) return;
@@ -270,7 +270,7 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
270
270
  X,
271
271
  Z,
272
272
  Q
273
- ]), qe = u((e) => {
273
+ ]), qe = e((e) => {
274
274
  let t = z.current, n = t.to - t.from + 1, r = R.current;
275
275
  if (r.length === 0) return;
276
276
  let i = 0;
@@ -286,7 +286,7 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
286
286
  }, [Q]);
287
287
  return /* @__PURE__ */ v("div", {
288
288
  ref: I,
289
- className: g(l.root, Ae),
289
+ className: o(g.root, Ae),
290
290
  style: {
291
291
  ...je,
292
292
  height: ae,
@@ -294,11 +294,11 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
294
294
  },
295
295
  tabIndex: 0,
296
296
  role: "figure",
297
- "aria-label": `${r} ${i} chart`,
297
+ "aria-label": `${u} ${d} chart`,
298
298
  onKeyDown: qe,
299
299
  children: [/* @__PURE__ */ _("canvas", {
300
300
  ref: L,
301
- className: l.svg,
301
+ className: g.svg,
302
302
  onPointerDown: Ve,
303
303
  onPointerMove: Ue,
304
304
  onPointerUp: We,
@@ -309,7 +309,7 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
309
309
  touchAction: "none"
310
310
  }
311
311
  }), /* @__PURE__ */ v("div", {
312
- className: l.tradingHeader,
312
+ className: g.tradingHeader,
313
313
  style: {
314
314
  position: "absolute",
315
315
  top: ee,
@@ -329,10 +329,10 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
329
329
  minWidth: 0
330
330
  },
331
331
  children: [
332
- /* @__PURE__ */ _("strong", { children: r }),
332
+ /* @__PURE__ */ _("strong", { children: u }),
333
333
  /* @__PURE__ */ _("span", {
334
334
  style: { color: "var(--crk-color-text-muted)" },
335
- children: i
335
+ children: d
336
336
  }),
337
337
  J?.bar && /* @__PURE__ */ v("span", {
338
338
  style: {
@@ -354,10 +354,10 @@ function ae({ datafeed: t, symbol: r, resolution: i, period: a, seriesType: s =
354
354
  ]
355
355
  }), M && /* @__PURE__ */ _("div", {
356
356
  style: { pointerEvents: "auto" },
357
- children: /* @__PURE__ */ _(n, {
357
+ children: /* @__PURE__ */ _(l, {
358
358
  position: "bottom",
359
359
  asChild: !0,
360
- trigger: /* @__PURE__ */ _(e, {
360
+ trigger: /* @__PURE__ */ _(s, {
361
361
  variant: "ghost",
362
362
  size: "sm",
363
363
  iconOnly: !0,
@@ -407,7 +407,7 @@ var w = [
407
407
  label: "Asia / Singapore"
408
408
  }
409
409
  ];
410
- function oe({ timezone: e, onTimezoneChange: n }) {
410
+ function oe({ timezone: e, onTimezoneChange: t }) {
411
411
  return /* @__PURE__ */ v("div", {
412
412
  style: {
413
413
  minWidth: 220,
@@ -433,13 +433,13 @@ function oe({ timezone: e, onTimezoneChange: n }) {
433
433
  color: "var(--crk-color-text-muted)"
434
434
  },
435
435
  children: "Timezone"
436
- }), /* @__PURE__ */ _(t, {
436
+ }), /* @__PURE__ */ _(c, {
437
437
  options: w.map((e) => ({
438
438
  value: e.value,
439
439
  label: e.label
440
440
  })),
441
441
  value: e,
442
- onChange: (e) => n(e)
442
+ onChange: (e) => t(e)
443
443
  })]
444
444
  })]
445
445
  });
@@ -461,7 +461,7 @@ function se() {
461
461
  });
462
462
  }
463
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 - 0), c = Math.max(0, o - a), l = c, u = a, d = {
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
465
  top: a,
466
466
  bottom: o,
467
467
  height: c
@@ -506,16 +506,16 @@ function ce(e, t) {
506
506
  function le(e, t) {
507
507
  if (e.type === "sma") return {
508
508
  kind: "line",
509
- values: s(t, e.period),
509
+ values: m(t, e.period),
510
510
  color: e.color ?? "var(--crk-chart-2)"
511
511
  };
512
512
  if (e.type === "ema") return {
513
513
  kind: "line",
514
- values: a(t, e.period),
514
+ values: f(t, e.period),
515
515
  color: e.color ?? "var(--crk-chart-3)"
516
516
  };
517
517
  if (e.type === "bollinger") {
518
- let n = i(t, e.period, e.stdDev ?? 2);
518
+ let n = d(t, e.period, e.stdDev ?? 2);
519
519
  return {
520
520
  kind: "bollinger",
521
521
  middle: n.middle,
@@ -527,44 +527,44 @@ function le(e, t) {
527
527
  }
528
528
  return null;
529
529
  }
530
- function ue(e, t, n, i, a) {
531
- let o = Infinity, s = -Infinity;
532
- for (let e of t) e.low < o && (o = e.low), e.high > s && (s = e.high);
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
533
  for (let e of n) {
534
534
  let t = e.kind === "line" ? [e.values] : [e.upper, e.lower];
535
535
  for (let e of t) {
536
- let t = Math.max(0, Math.floor(i)), n = Math.min(e.length - 1, Math.ceil(a));
536
+ let t = Math.max(0, Math.floor(r)), n = Math.min(e.length - 1, Math.ceil(i));
537
537
  for (let r = t; r <= n; r++) {
538
538
  let t = e[r];
539
- t != null && (t < o && (o = t), t > s && (s = t));
539
+ t != null && (t < a && (a = t), t > o && (o = t));
540
540
  }
541
541
  }
542
542
  }
543
- isFinite(o) && isFinite(s) || (o = 0, s = 1);
544
- let c = (s - o) * .08 || 1, l = r(o - c, s + c, 5), u = Math.min(l[0], o), d = Math.max(l[l.length - 1], s);
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
545
  return {
546
546
  paneTop: e.top,
547
547
  paneBottom: e.bottom,
548
548
  paneHeight: e.height,
549
- priceMin: u,
549
+ priceMin: l,
550
550
  priceMax: d,
551
- ticks: l
551
+ ticks: c
552
552
  };
553
553
  }
554
- function de(e, t, n, i) {
555
- let a = 0, o = Math.max(0, Math.floor(n)), s = Math.min(t.length - 1, Math.ceil(i));
556
- for (let e = o; e <= s; e++) {
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
557
  let n = t[e].volume ?? 0;
558
- n > a && (a = n);
558
+ n > i && (i = n);
559
559
  }
560
- let c = r(0, a || 1, 3), l = Math.max(c[c.length - 1], a);
560
+ let s = u(0, i || 1, 3), c = Math.max(s[s.length - 1], i);
561
561
  return {
562
562
  paneTop: e.top,
563
563
  paneBottom: e.bottom,
564
564
  paneHeight: e.height,
565
565
  priceMin: 0,
566
- priceMax: l,
567
- ticks: c
566
+ priceMax: c,
567
+ ticks: s
568
568
  };
569
569
  }
570
570
  function E(e, t) {
@@ -30,11 +30,11 @@ function n(n) {
30
30
  case "5D": return "15";
31
31
  case "1M": return "60";
32
32
  case "3M": return "240";
33
- case "6M": return "D";
33
+ case "6M":
34
34
  case "1Y": return "D";
35
- case "5Y": return "W";
35
+ case "5Y":
36
36
  case "10Y": return "W";
37
- case "20Y": return "M";
37
+ case "20Y":
38
38
  case "MAX": return "M";
39
39
  }
40
40
  let r = t(n);