@overdoser/react-toolkit 0.0.7 → 0.0.9

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/index.js CHANGED
@@ -1,43 +1,43 @@
1
- import { forwardRef as $e, createElement as cn, useState as Se, useCallback as he, useMemo as ke, useEffect as Be, useRef as te, useId as ze, createContext as jt, useContext as ft, cloneElement as ln, useImperativeHandle as sn, useLayoutEffect as an } from "react";
2
- import { jsxs as H, jsx as s, Fragment as Ye } from "react/jsx-runtime";
3
- import { FormProvider as dn, useFormContext as un, useController as hn } from "react-hook-form";
4
- import { createPortal as mn } from "react-dom";
5
- function Xt(e) {
1
+ import { forwardRef as $e, createElement as ln, useState as Se, useCallback as de, useMemo as ke, useEffect as Be, useRef as ne, useId as Ye, isValidElement as sn, cloneElement as jt, createContext as Xt, useContext as ft, useImperativeHandle as an, useLayoutEffect as dn } from "react";
2
+ import { jsxs as F, jsx as s, Fragment as Xe } from "react/jsx-runtime";
3
+ import { FormProvider as un, useFormContext as hn, useController as mn } from "react-hook-form";
4
+ import { createPortal as fn } from "react-dom";
5
+ function _t(e) {
6
6
  var t, n, r = "";
7
7
  if (typeof e == "string" || typeof e == "number") r += e;
8
8
  else if (typeof e == "object") if (Array.isArray(e)) {
9
9
  var o = e.length;
10
- for (t = 0; t < o; t++) e[t] && (n = Xt(e[t])) && (r && (r += " "), r += n);
10
+ for (t = 0; t < o; t++) e[t] && (n = _t(e[t])) && (r && (r += " "), r += n);
11
11
  } else for (n in e) e[n] && (r && (r += " "), r += n);
12
12
  return r;
13
13
  }
14
14
  function f() {
15
- for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = Xt(e)) && (r && (r += " "), r += t);
15
+ for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = _t(e)) && (r && (r += " "), r += t);
16
16
  return r;
17
17
  }
18
- const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY", yn = "crk-secondary-j-3rj", vn = "crk-danger-Hxs5n", bn = "crk-ghost-kQ0A8", xn = "crk-sm-RXFPY", kn = "crk-md-nDnOD", Mn = "crk-lg-qD-Qh", wn = "crk-fullWidth-AHpSl", $n = "crk-iconOnly-FNrSu", Nn = "crk-content-PpYVU", Ln = "crk-shimmer-8iQSU", Sn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Rn = "crk-dots-U8wss", Cn = "crk-loadingDots-eKv64", An = "crk-dot-Owuk1", Bn = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", In = "crk-borderSpin-EJ2gW", Ae = {
19
- root: fn,
20
- loading: pn,
21
- primary: gn,
22
- secondary: yn,
23
- danger: vn,
24
- ghost: bn,
25
- sm: xn,
26
- md: kn,
27
- lg: Mn,
28
- fullWidth: wn,
29
- iconOnly: $n,
30
- content: Nn,
31
- shimmer: Ln,
32
- loadingShimmer: Sn,
33
- shimmerSweep: Tn,
34
- dots: Rn,
35
- loadingDots: Cn,
36
- dot: An,
37
- dotBounce: Bn,
38
- loadingBorder: Dn,
39
- borderSpin: In
40
- }, En = {
18
+ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY", vn = "crk-secondary-j-3rj", bn = "crk-danger-Hxs5n", xn = "crk-ghost-kQ0A8", kn = "crk-sm-RXFPY", Mn = "crk-md-nDnOD", wn = "crk-lg-qD-Qh", $n = "crk-fullWidth-AHpSl", Nn = "crk-iconOnly-FNrSu", Ln = "crk-content-PpYVU", Sn = "crk-shimmer-8iQSU", Tn = "crk-loadingShimmer-BVvFw", Rn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", Dn = "crk-dotBounce-FwdcC", In = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Ae = {
19
+ root: pn,
20
+ loading: gn,
21
+ primary: yn,
22
+ secondary: vn,
23
+ danger: bn,
24
+ ghost: xn,
25
+ sm: kn,
26
+ md: Mn,
27
+ lg: wn,
28
+ fullWidth: $n,
29
+ iconOnly: Nn,
30
+ content: Ln,
31
+ shimmer: Sn,
32
+ loadingShimmer: Tn,
33
+ shimmerSweep: Rn,
34
+ dots: Cn,
35
+ loadingDots: An,
36
+ dot: Bn,
37
+ dotBounce: Dn,
38
+ loadingBorder: In,
39
+ borderSpin: En
40
+ }, Pn = {
41
41
  dots: Ae.loadingDots,
42
42
  shimmer: Ae.loadingShimmer,
43
43
  border: Ae.loadingBorder
@@ -55,7 +55,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
55
55
  style: h,
56
56
  children: u,
57
57
  ...d
58
- }, m) => /* @__PURE__ */ H(
58
+ }, m) => /* @__PURE__ */ F(
59
59
  "button",
60
60
  {
61
61
  ref: m,
@@ -66,7 +66,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
66
66
  o && Ae.fullWidth,
67
67
  i && Ae.iconOnly,
68
68
  n && Ae.loading,
69
- n && En[r],
69
+ n && Pn[r],
70
70
  l?.root,
71
71
  a
72
72
  ),
@@ -77,7 +77,7 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
77
77
  children: [
78
78
  /* @__PURE__ */ s("div", { className: f(Ae.shimmer, l?.shimmer) }),
79
79
  /* @__PURE__ */ s("span", { className: f(Ae.content, l?.content), children: u }),
80
- /* @__PURE__ */ H("span", { className: f(Ae.dots, l?.dots), "aria-hidden": "true", children: [
80
+ /* @__PURE__ */ F("span", { className: f(Ae.dots, l?.dots), "aria-hidden": "true", children: [
81
81
  /* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) }),
82
82
  /* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) }),
83
83
  /* @__PURE__ */ s("span", { className: f(Ae.dot, l?.dot) })
@@ -87,13 +87,13 @@ const fn = "crk-root-8RX49", pn = "crk-loading-QfItr", gn = "crk-primary-st6yY",
87
87
  )
88
88
  );
89
89
  Ut.displayName = "Button";
90
- const Pn = "crk-root-2j4Vp", Wn = "crk-muted-vReNc", Hn = "crk-danger-ugf9r", On = "crk-srOnly-LGQgs", $t = {
91
- root: Pn,
90
+ const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn = "crk-srOnly-LGQgs", $t = {
91
+ root: Wn,
92
92
  default: "crk-default-3TBlr",
93
- muted: Wn,
94
- danger: Hn,
95
- srOnly: On
96
- }, Fn = $e(
93
+ muted: Hn,
94
+ danger: On,
95
+ srOnly: Fn
96
+ }, jn = $e(
97
97
  ({
98
98
  variant: e = "default",
99
99
  external: t = !1,
@@ -101,7 +101,7 @@ const Pn = "crk-root-2j4Vp", Wn = "crk-muted-vReNc", Hn = "crk-danger-ugf9r", On
101
101
  style: r,
102
102
  children: o,
103
103
  ...i
104
- }, c) => /* @__PURE__ */ H(
104
+ }, c) => /* @__PURE__ */ F(
105
105
  "a",
106
106
  {
107
107
  ref: c,
@@ -119,32 +119,32 @@ const Pn = "crk-root-2j4Vp", Wn = "crk-muted-vReNc", Hn = "crk-danger-ugf9r", On
119
119
  }
120
120
  )
121
121
  );
122
- Fn.displayName = "Link";
123
- const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", _n = "crk-h3-lrbrK", zn = "crk-h4--jkC1", Yn = "crk-h5-GnQvD", Vn = "crk-h6-MKlIN", qn = "crk-p-FzRtm", Gn = "crk-span-NZvLx", Zn = "crk-label-Cwi6a", Kn = "crk-normal-7AeZz", Qn = "crk-medium-36OXr", Jn = "crk-semibold-oQixc", er = "crk-bold-bk4b4", tr = "crk-muted-itOSW", nr = "crk-primary-rp36t", rr = "crk-danger-SyOy-", or = "crk-success-w8PpD", cr = "crk-align-left-3AGYw", ir = "crk-align-center-h-x--", lr = "crk-align-right-IXFhK", sr = "crk-truncate-eqr85", _e = {
124
- root: jn,
125
- h1: Xn,
122
+ jn.displayName = "Link";
123
+ const Xn = "crk-root-U-oiq", _n = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", zn = "crk-h3-lrbrK", Yn = "crk-h4--jkC1", Vn = "crk-h5-GnQvD", qn = "crk-h6-MKlIN", Gn = "crk-p-FzRtm", Zn = "crk-span-NZvLx", Kn = "crk-label-Cwi6a", Qn = "crk-normal-7AeZz", Jn = "crk-medium-36OXr", er = "crk-semibold-oQixc", tr = "crk-bold-bk4b4", nr = "crk-muted-itOSW", rr = "crk-primary-rp36t", or = "crk-danger-SyOy-", cr = "crk-success-w8PpD", ir = "crk-align-left-3AGYw", lr = "crk-align-center-h-x--", sr = "crk-align-right-IXFhK", ar = "crk-truncate-eqr85", ze = {
124
+ root: Xn,
125
+ h1: _n,
126
126
  h2: Un,
127
- h3: _n,
128
- h4: zn,
129
- h5: Yn,
130
- h6: Vn,
131
- p: qn,
132
- span: Gn,
133
- label: Zn,
134
- normal: Kn,
135
- medium: Qn,
136
- semibold: Jn,
137
- bold: er,
127
+ h3: zn,
128
+ h4: Yn,
129
+ h5: Vn,
130
+ h6: qn,
131
+ p: Gn,
132
+ span: Zn,
133
+ label: Kn,
134
+ normal: Qn,
135
+ medium: Jn,
136
+ semibold: er,
137
+ bold: tr,
138
138
  default: "crk-default-79lKR",
139
- muted: tr,
140
- primary: nr,
141
- danger: rr,
142
- success: or,
143
- alignLeft: cr,
144
- alignCenter: ir,
145
- alignRight: lr,
146
- truncate: sr
147
- }, ar = $e(
139
+ muted: nr,
140
+ primary: rr,
141
+ danger: or,
142
+ success: cr,
143
+ alignLeft: ir,
144
+ alignCenter: lr,
145
+ alignRight: sr,
146
+ truncate: ar
147
+ }, dr = $e(
148
148
  ({
149
149
  variant: e = "p",
150
150
  weight: t,
@@ -155,17 +155,17 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", _n = "crk
155
155
  style: c,
156
156
  children: l,
157
157
  ...a
158
- }, h) => cn(
158
+ }, h) => ln(
159
159
  e,
160
160
  {
161
161
  ref: h,
162
162
  className: f(
163
- _e.root,
164
- _e[e],
165
- t && _e[t],
166
- n && _e[n],
167
- r && _e[`align-${r}`],
168
- o && _e.truncate,
163
+ ze.root,
164
+ ze[e],
165
+ t && ze[t],
166
+ n && ze[n],
167
+ r && ze[`align-${r}`],
168
+ o && ze.truncate,
169
169
  i
170
170
  ),
171
171
  style: c,
@@ -174,17 +174,17 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", Un = "crk-h2-CV8Oo", _n = "crk
174
174
  l
175
175
  )
176
176
  );
177
- ar.displayName = "Typography";
178
- const dr = "crk-root-PVrgx", ur = "crk-unordered-FhCWT", hr = "crk-item-TfW82", mr = "crk-ordered-8x4YC", fr = "crk-none-f03Kx", pr = "crk-sm-Rg4Mv", gr = "crk-md-X4Icb", yr = "crk-lg-JjNKZ", ut = {
179
- root: dr,
180
- unordered: ur,
181
- item: hr,
182
- ordered: mr,
183
- none: fr,
184
- sm: pr,
185
- md: gr,
186
- lg: yr
187
- }, vr = $e(
177
+ dr.displayName = "Typography";
178
+ const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82", fr = "crk-ordered-8x4YC", pr = "crk-none-f03Kx", gr = "crk-sm-Rg4Mv", yr = "crk-md-X4Icb", vr = "crk-lg-JjNKZ", ut = {
179
+ root: ur,
180
+ unordered: hr,
181
+ item: mr,
182
+ ordered: fr,
183
+ none: pr,
184
+ sm: gr,
185
+ md: yr,
186
+ lg: vr
187
+ }, br = $e(
188
188
  ({
189
189
  variant: e = "unordered",
190
190
  spacing: t = "md",
@@ -208,8 +208,8 @@ const dr = "crk-root-PVrgx", ur = "crk-unordered-FhCWT", hr = "crk-item-TfW82",
208
208
  }
209
209
  )
210
210
  );
211
- vr.displayName = "List";
212
- const br = $e(
211
+ br.displayName = "List";
212
+ const xr = $e(
213
213
  ({ className: e, style: t, children: n, ...r }, o) => /* @__PURE__ */ s(
214
214
  "li",
215
215
  {
@@ -221,42 +221,42 @@ const br = $e(
221
221
  }
222
222
  )
223
223
  );
224
- br.displayName = "ListItem";
225
- const xr = "crk-wrapper-zxjMt", kr = "crk-root-Gf85-", Mr = "crk-headerCell-ePPZW", wr = "crk-headerCellSortable-NMybk", $r = "crk-sortIndicator-WGD2S", Nr = "crk-sortArrow-1-ok4", Lr = "crk-sortArrowActive-yhWrO", Sr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Rr = "crk-cell-ZfnbG", Cr = "crk-emptyRow-AoPfj", Ar = "crk-emptyCell-99-7C", Br = "crk-striped-6Qckq", Dr = "crk-hoverable-ljU9B", Ir = "crk-compact-2-UWr", Er = "crk-paginator-UlYIY", Pr = "crk-paginatorInfo-BVca4", Wr = "crk-paginatorText-sqWS0", Hr = "crk-pageSizeSelect-yhqJQ", Or = "crk-paginatorNav-MDSui", Fr = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", Xr = "crk-pageEllipsis-en59J", ye = {
226
- wrapper: xr,
227
- root: kr,
228
- headerCell: Mr,
229
- headerCellSortable: wr,
230
- sortIndicator: $r,
231
- sortArrow: Nr,
232
- sortArrowActive: Lr,
233
- sortIndex: Sr,
234
- row: Tr,
235
- cell: Rr,
236
- emptyRow: Cr,
237
- emptyCell: Ar,
238
- striped: Br,
239
- hoverable: Dr,
240
- compact: Ir,
241
- paginator: Er,
242
- paginatorInfo: Pr,
243
- paginatorText: Wr,
244
- pageSizeSelect: Hr,
245
- paginatorNav: Or,
246
- pageButton: Fr,
247
- pageButtonActive: jr,
248
- pageEllipsis: Xr
224
+ xr.displayName = "ListItem";
225
+ const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZW", $r = "crk-headerCellSortable-NMybk", Nr = "crk-sortIndicator-WGD2S", Lr = "crk-sortArrow-1-ok4", Sr = "crk-sortArrowActive-yhWrO", Tr = "crk-sortIndex-HGoca", Rr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Dr = "crk-striped-6Qckq", Ir = "crk-hoverable-ljU9B", Er = "crk-compact-2-UWr", Pr = "crk-paginator-UlYIY", Wr = "crk-paginatorInfo-BVca4", Hr = "crk-paginatorText-sqWS0", Or = "crk-pageSizeSelect-yhqJQ", Fr = "crk-paginatorNav-MDSui", jr = "crk-pageButton-1PX-g", Xr = "crk-pageButtonActive--D7Q7", _r = "crk-pageEllipsis-en59J", ye = {
226
+ wrapper: kr,
227
+ root: Mr,
228
+ headerCell: wr,
229
+ headerCellSortable: $r,
230
+ sortIndicator: Nr,
231
+ sortArrow: Lr,
232
+ sortArrowActive: Sr,
233
+ sortIndex: Tr,
234
+ row: Rr,
235
+ cell: Cr,
236
+ emptyRow: Ar,
237
+ emptyCell: Br,
238
+ striped: Dr,
239
+ hoverable: Ir,
240
+ compact: Er,
241
+ paginator: Pr,
242
+ paginatorInfo: Wr,
243
+ paginatorText: Hr,
244
+ pageSizeSelect: Or,
245
+ paginatorNav: Fr,
246
+ pageButton: jr,
247
+ pageButtonActive: Xr,
248
+ pageEllipsis: _r
249
249
  };
250
250
  function Ur(e, t) {
251
251
  return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t));
252
252
  }
253
- function _r(e, t = []) {
254
- const [n, r] = Se(t), o = he((a) => {
253
+ function zr(e, t = []) {
254
+ const [n, r] = Se(t), o = de((a) => {
255
255
  r((h) => {
256
256
  const u = h.find((d) => d.key === a);
257
257
  return u ? u.direction === "asc" ? [{ key: a, direction: "desc" }] : [] : [{ key: a, direction: "asc" }];
258
258
  });
259
- }, []), i = he((a) => {
259
+ }, []), i = de((a) => {
260
260
  r((h) => {
261
261
  const u = h.findIndex((m) => m.key === a);
262
262
  if (u === -1)
@@ -267,7 +267,7 @@ function _r(e, t = []) {
267
267
  }
268
268
  return h.filter((m, p) => p !== u);
269
269
  });
270
- }, []), c = he(() => {
270
+ }, []), c = de(() => {
271
271
  r([]);
272
272
  }, []);
273
273
  return { sortedData: ke(() => n.length === 0 ? e : [...e].sort((a, h) => {
@@ -279,14 +279,14 @@ function _r(e, t = []) {
279
279
  return 0;
280
280
  }), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: i, resetSort: c };
281
281
  }
282
- function zr({ direction: e, sortIndex: t }) {
283
- return /* @__PURE__ */ H("span", { className: ye.sortIndicator, "aria-hidden": "true", children: [
282
+ function Yr({ direction: e, sortIndex: t }) {
283
+ return /* @__PURE__ */ F("span", { className: ye.sortIndicator, "aria-hidden": "true", children: [
284
284
  /* @__PURE__ */ s("span", { className: f(ye.sortArrow, e === "asc" && ye.sortArrowActive), children: "▲" }),
285
285
  /* @__PURE__ */ s("span", { className: f(ye.sortArrow, e === "desc" && ye.sortArrowActive), children: "▼" }),
286
286
  t !== void 0 && t >= 0 && /* @__PURE__ */ s("span", { className: ye.sortIndex, children: t + 1 })
287
287
  ] });
288
288
  }
289
- function Yr({
289
+ function Vr({
290
290
  page: e,
291
291
  pageSize: t,
292
292
  totalRows: n,
@@ -306,8 +306,8 @@ function Yr({
306
306
  }
307
307
  return u;
308
308
  }, [e, c]);
309
- return /* @__PURE__ */ H("nav", { className: f(ye.paginator, i?.paginator), "aria-label": "Table pagination", children: [
310
- /* @__PURE__ */ H("div", { className: ye.paginatorInfo, children: [
309
+ return /* @__PURE__ */ F("nav", { className: f(ye.paginator, i?.paginator), "aria-label": "Table pagination", children: [
310
+ /* @__PURE__ */ F("div", { className: ye.paginatorInfo, children: [
311
311
  /* @__PURE__ */ s("span", { className: ye.paginatorText, children: n > 0 ? `${l}–${a} of ${n}` : "No results" }),
312
312
  r.length > 1 && /* @__PURE__ */ s(
313
313
  "select",
@@ -316,14 +316,14 @@ function Yr({
316
316
  value: t,
317
317
  onChange: (u) => o(1, Number(u.target.value)),
318
318
  "aria-label": "Rows per page",
319
- children: r.map((u) => /* @__PURE__ */ H("option", { value: u, children: [
319
+ children: r.map((u) => /* @__PURE__ */ F("option", { value: u, children: [
320
320
  u,
321
321
  " / page"
322
322
  ] }, u))
323
323
  }
324
324
  )
325
325
  ] }),
326
- /* @__PURE__ */ H("div", { className: ye.paginatorNav, children: [
326
+ /* @__PURE__ */ F("div", { className: ye.paginatorNav, children: [
327
327
  /* @__PURE__ */ s(
328
328
  "button",
329
329
  {
@@ -363,7 +363,7 @@ function Yr({
363
363
  ] })
364
364
  ] });
365
365
  }
366
- function Vr({
366
+ function qr({
367
367
  data: e,
368
368
  columns: t,
369
369
  sortConfig: n,
@@ -379,47 +379,47 @@ function Vr({
379
379
  pagination: m,
380
380
  classes: p
381
381
  }) {
382
- const y = r !== void 0, {
383
- sortedData: $,
384
- sortConfig: k,
385
- requestSort: R,
386
- requestMultiSort: X
387
- } = _r(e, n), E = y ? n ?? [] : k, W = y ? e : $, ae = ke(() => {
388
- if (!m || y) return W;
389
- const w = (m.page - 1) * m.pageSize;
390
- return W.slice(w, w + m.pageSize);
391
- }, [W, m, y]), _ = m?.totalRows ?? W.length, C = he(
392
- (w, q) => {
393
- const D = o && (q.ctrlKey || q.metaKey);
394
- if (y)
395
- if (D) {
396
- const Q = E.findIndex((P) => P.key === w);
397
- let O;
398
- Q === -1 ? O = [...E, { key: w, direction: "asc" }] : E[Q].direction === "asc" ? O = E.map(
399
- (P, ee) => ee === Q ? { key: w, direction: "desc" } : P
400
- ) : O = E.filter((P, ee) => ee !== Q), r(O);
382
+ const x = r !== void 0, {
383
+ sortedData: C,
384
+ sortConfig: $,
385
+ requestSort: b,
386
+ requestMultiSort: W
387
+ } = zr(e, n), X = x ? n ?? [] : $, Y = x ? e : C, Q = ke(() => {
388
+ if (!m || x) return Y;
389
+ const M = (m.page - 1) * m.pageSize;
390
+ return Y.slice(M, M + m.pageSize);
391
+ }, [Y, m, x]), D = m?.totalRows ?? Y.length, S = de(
392
+ (M, G) => {
393
+ const O = o && (G.ctrlKey || G.metaKey);
394
+ if (x)
395
+ if (O) {
396
+ const te = X.findIndex((U) => U.key === M);
397
+ let j;
398
+ te === -1 ? j = [...X, { key: M, direction: "asc" }] : X[te].direction === "asc" ? j = X.map(
399
+ (U, J) => J === te ? { key: M, direction: "desc" } : U
400
+ ) : j = X.filter((U, J) => J !== te), r(j);
401
401
  } else {
402
- const Q = E.find((O) => O.key === w);
403
- Q ? Q.direction === "asc" ? r([{ key: w, direction: "desc" }]) : r([]) : r([{ key: w, direction: "asc" }]);
402
+ const te = X.find((j) => j.key === M);
403
+ te ? te.direction === "asc" ? r([{ key: M, direction: "desc" }]) : r([]) : r([{ key: M, direction: "asc" }]);
404
404
  }
405
405
  else
406
- D ? X(w) : R(w);
406
+ O ? W(M) : b(M);
407
407
  },
408
408
  [
409
- y,
409
+ x,
410
410
  o,
411
- E,
411
+ X,
412
412
  r,
413
- R,
414
- X
413
+ b,
414
+ W
415
415
  ]
416
- ), oe = (w) => E.find((D) => D.key === w)?.direction, le = (w) => {
417
- if (E.length <= 1) return;
418
- const q = E.findIndex((D) => D.key === w);
419
- return q >= 0 ? q : void 0;
416
+ ), ee = (M) => X.find((O) => O.key === M)?.direction, re = (M) => {
417
+ if (X.length <= 1) return;
418
+ const G = X.findIndex((O) => O.key === M);
419
+ return G >= 0 ? G : void 0;
420
420
  };
421
- return /* @__PURE__ */ H("div", { className: f(ye.wrapper, p?.wrapper), children: [
422
- /* @__PURE__ */ H(
421
+ return /* @__PURE__ */ F("div", { className: f(ye.wrapper, p?.wrapper), children: [
422
+ /* @__PURE__ */ F(
423
423
  "table",
424
424
  {
425
425
  className: f(
@@ -432,74 +432,74 @@ function Vr({
432
432
  ),
433
433
  style: h,
434
434
  children: [
435
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((w) => /* @__PURE__ */ H(
435
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((M) => /* @__PURE__ */ F(
436
436
  "th",
437
437
  {
438
438
  className: f(
439
439
  ye.headerCell,
440
- w.sortable && ye.headerCellSortable,
440
+ M.sortable && ye.headerCellSortable,
441
441
  p?.headerCell
442
442
  ),
443
443
  style: {
444
- width: w.width,
445
- textAlign: w.align
444
+ width: M.width,
445
+ textAlign: M.align
446
446
  },
447
- onClick: w.sortable ? (q) => C(w.key, q) : void 0,
448
- "aria-sort": w.sortable ? oe(w.key) === "asc" ? "ascending" : oe(w.key) === "desc" ? "descending" : "none" : void 0,
447
+ onClick: M.sortable ? (G) => S(M.key, G) : void 0,
448
+ "aria-sort": M.sortable ? ee(M.key) === "asc" ? "ascending" : ee(M.key) === "desc" ? "descending" : "none" : void 0,
449
449
  children: [
450
- w.header,
451
- w.sortable && /* @__PURE__ */ s(
452
- zr,
450
+ M.header,
451
+ M.sortable && /* @__PURE__ */ s(
452
+ Yr,
453
453
  {
454
- direction: oe(w.key),
455
- sortIndex: le(w.key)
454
+ direction: ee(M.key),
455
+ sortIndex: re(M.key)
456
456
  }
457
457
  )
458
458
  ]
459
459
  },
460
- w.key
460
+ M.key
461
461
  )) }) }),
462
- /* @__PURE__ */ s("tbody", { children: ae.length === 0 ? /* @__PURE__ */ s("tr", { className: ye.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ye.emptyCell, p?.emptyCell), colSpan: t.length, children: d }) }) : ae.map((w, q) => {
463
- const D = u ? String(w[u]) : q;
464
- return /* @__PURE__ */ s("tr", { className: f(ye.row, p?.row), children: t.map((Q) => /* @__PURE__ */ s(
462
+ /* @__PURE__ */ s("tbody", { children: Q.length === 0 ? /* @__PURE__ */ s("tr", { className: ye.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ye.emptyCell, p?.emptyCell), colSpan: t.length, children: d }) }) : Q.map((M, G) => {
463
+ const O = u ? String(M[u]) : G;
464
+ return /* @__PURE__ */ s("tr", { className: f(ye.row, p?.row), children: t.map((te) => /* @__PURE__ */ s(
465
465
  "td",
466
466
  {
467
467
  className: f(ye.cell, p?.cell),
468
- style: { textAlign: Q.align },
469
- children: Q.render ? Q.render(w[Q.key], w, q) : w[Q.key]
468
+ style: { textAlign: te.align },
469
+ children: te.render ? te.render(M[te.key], M, G) : M[te.key]
470
470
  },
471
- Q.key
472
- )) }, D);
471
+ te.key
472
+ )) }, O);
473
473
  }) })
474
474
  ]
475
475
  }
476
476
  ),
477
477
  m && /* @__PURE__ */ s(
478
- Yr,
478
+ Vr,
479
479
  {
480
480
  ...m,
481
- totalRows: _,
481
+ totalRows: D,
482
482
  paginatorClasses: { paginator: p?.paginator, pageButton: p?.pageButton }
483
483
  }
484
484
  )
485
485
  ] });
486
486
  }
487
- const Al = Vr, qr = "crk-root-an8Cf", Gr = "crk-fullWidth-S-uVk", Zr = "crk-trigger-LwPaD", Kr = "crk-triggerOpen-U4pa9", Qr = "crk-triggerLabel-QLITs", Jr = "crk-triggerError-3jlu1", eo = "crk-placeholder-fWdch", to = "crk-chevron-jmDNe", no = "crk-menu-fxnKL", ro = "crk-menuOpen-HF-Y1", oo = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", io = "crk-item-f-Rhh", lo = "crk-itemDisabled-L-d6i", so = "crk-itemSelected-Fwmuo", Me = {
488
- root: qr,
489
- fullWidth: Gr,
490
- trigger: Zr,
491
- triggerOpen: Kr,
492
- triggerLabel: Qr,
493
- triggerError: Jr,
494
- placeholder: eo,
495
- chevron: to,
496
- menu: no,
497
- menuOpen: ro,
498
- alignLeft: oo,
499
- alignRight: co,
500
- item: io,
501
- itemDisabled: lo,
502
- itemSelected: so
487
+ const Il = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", co = "crk-alignLeft-buCDJ", io = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", Me = {
488
+ root: Gr,
489
+ fullWidth: Zr,
490
+ trigger: Kr,
491
+ triggerOpen: Qr,
492
+ triggerLabel: Jr,
493
+ triggerError: eo,
494
+ placeholder: to,
495
+ chevron: no,
496
+ menu: ro,
497
+ menuOpen: oo,
498
+ alignLeft: co,
499
+ alignRight: io,
500
+ item: lo,
501
+ itemDisabled: so,
502
+ itemSelected: ao
503
503
  };
504
504
  function pt(e, t, n = !0) {
505
505
  Be(() => {
@@ -513,7 +513,7 @@ function pt(e, t, n = !0) {
513
513
  }, [e, t, n]);
514
514
  }
515
515
  function Tt(e, t = !0) {
516
- const n = he(
516
+ const n = de(
517
517
  (r) => {
518
518
  const o = e[r.key];
519
519
  o && o(r);
@@ -527,7 +527,7 @@ function Tt(e, t = !0) {
527
527
  };
528
528
  }, [t, n]);
529
529
  }
530
- const _t = $e(
530
+ const zt = $e(
531
531
  ({
532
532
  trigger: e,
533
533
  children: t,
@@ -543,91 +543,91 @@ const _t = $e(
543
543
  onChange: d,
544
544
  error: m = !1,
545
545
  fullWidth: p = !0,
546
- classes: y
547
- }, $) => {
548
- const [k, R] = Se(!1), X = te(null), E = te(null), W = te(null), ae = ze();
546
+ classes: x
547
+ }, C) => {
548
+ const [$, b] = Se(!1), W = ne(null), X = ne(null), Y = ne(null), Q = Ye();
549
549
  Be(() => {
550
- k && E.current && E.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
551
- }, [k]);
552
- const _ = he(() => {
553
- R(!1), l?.(), W.current?.focus();
554
- }, [l]), C = he(() => {
555
- R((D) => {
556
- const Q = !D;
557
- return Q ? c?.() : l?.(), Q;
550
+ $ && X.current && X.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
551
+ }, [$]);
552
+ const D = de(() => {
553
+ b(!1), l?.(), Y.current?.focus();
554
+ }, [l]), S = de(() => {
555
+ b((O) => {
556
+ const te = !O;
557
+ return te ? c?.() : l?.(), te;
558
558
  });
559
- }, [c, l]), oe = he(
560
- (D) => {
561
- d?.(D), _();
559
+ }, [c, l]), ee = de(
560
+ (O) => {
561
+ d?.(O), D();
562
562
  },
563
- [d, _]
563
+ [d, D]
564
564
  );
565
- pt(X, _, k), Tt(
565
+ pt(W, D, $), Tt(
566
566
  {
567
- Escape: () => _()
567
+ Escape: () => D()
568
568
  },
569
- k
569
+ $
570
570
  );
571
- const le = a?.find((D) => D.value === u)?.label, w = a ? le || h : e, q = a && !le;
571
+ const re = a?.find((O) => O.value === u)?.label, M = a ? re || h : e, G = a && !re;
572
572
  return /* @__PURE__ */ s(
573
573
  "div",
574
574
  {
575
- ref: $,
576
- className: f(Me.root, p && Me.fullWidth, y?.root, r),
575
+ ref: C,
576
+ className: f(Me.root, p && Me.fullWidth, x?.root, r),
577
577
  style: o,
578
- children: /* @__PURE__ */ H("div", { ref: X, style: p ? { width: "100%" } : void 0, children: [
579
- /* @__PURE__ */ H(
578
+ children: /* @__PURE__ */ F("div", { ref: W, style: p ? { width: "100%" } : void 0, children: [
579
+ /* @__PURE__ */ F(
580
580
  "button",
581
581
  {
582
- ref: W,
582
+ ref: Y,
583
583
  id: i,
584
584
  type: "button",
585
585
  className: f(
586
586
  Me.trigger,
587
- k && Me.triggerOpen,
587
+ $ && Me.triggerOpen,
588
588
  m && Me.triggerError,
589
589
  p && Me.fullWidth,
590
- y?.trigger
590
+ x?.trigger
591
591
  ),
592
- onClick: C,
593
- "aria-expanded": k,
592
+ onClick: S,
593
+ "aria-expanded": $,
594
594
  "aria-haspopup": "menu",
595
- "aria-controls": k ? ae : void 0,
595
+ "aria-controls": $ ? Q : void 0,
596
596
  children: [
597
- /* @__PURE__ */ s("span", { className: f(Me.triggerLabel, q && Me.placeholder, y?.triggerLabel), children: w }),
598
- /* @__PURE__ */ s("span", { className: f(Me.chevron, y?.chevron), "aria-hidden": "true" })
597
+ /* @__PURE__ */ s("span", { className: f(Me.triggerLabel, G && Me.placeholder, x?.triggerLabel), children: M }),
598
+ /* @__PURE__ */ s("span", { className: f(Me.chevron, x?.chevron), "aria-hidden": "true" })
599
599
  ]
600
600
  }
601
601
  ),
602
602
  /* @__PURE__ */ s(
603
603
  "div",
604
604
  {
605
- ref: E,
606
- id: ae,
605
+ ref: X,
606
+ id: Q,
607
607
  className: f(
608
608
  Me.menu,
609
- k && Me.menuOpen,
609
+ $ && Me.menuOpen,
610
610
  n === "left" ? Me.alignLeft : Me.alignRight,
611
611
  p && Me.fullWidth,
612
- y?.menu
612
+ x?.menu
613
613
  ),
614
614
  role: "menu",
615
- children: a ? a.map((D) => /* @__PURE__ */ s(
615
+ children: a ? a.map((O) => /* @__PURE__ */ s(
616
616
  "button",
617
617
  {
618
618
  type: "button",
619
619
  role: "menuitem",
620
620
  className: f(
621
621
  Me.item,
622
- D.disabled && Me.itemDisabled,
623
- D.value === u && Me.itemSelected,
624
- y?.item
622
+ O.disabled && Me.itemDisabled,
623
+ O.value === u && Me.itemSelected,
624
+ x?.item
625
625
  ),
626
- disabled: D.disabled,
627
- onClick: () => oe(D.value),
628
- children: D.label
626
+ disabled: O.disabled,
627
+ onClick: () => ee(O.value),
628
+ children: O.label
629
629
  },
630
- D.value
630
+ O.value
631
631
  )) : t
632
632
  }
633
633
  )
@@ -636,8 +636,8 @@ const _t = $e(
636
636
  );
637
637
  }
638
638
  );
639
- _t.displayName = "Dropdown";
640
- const ao = $e(
639
+ zt.displayName = "Dropdown";
640
+ const uo = $e(
641
641
  ({
642
642
  disabled: e = !1,
643
643
  className: t,
@@ -660,78 +660,102 @@ const ao = $e(
660
660
  }
661
661
  )
662
662
  );
663
- ao.displayName = "DropdownItem";
664
- const uo = "crk-root-8H-L9", ho = "crk-trigger-Zn1nQ", mo = "crk-popover-rvS3X", fo = "crk-popoverFade-hj41M", po = "crk-bottom-lawQw", go = "crk-top-rqvC6", yo = "crk-left-J6exv", vo = "crk-right-3y20l", at = {
665
- root: uo,
666
- trigger: ho,
667
- popover: mo,
668
- popoverFade: fo,
669
- bottom: po,
670
- top: go,
671
- left: yo,
672
- right: vo
673
- }, zt = $e(
663
+ uo.displayName = "DropdownItem";
664
+ const ho = "crk-root-8H-L9", mo = "crk-trigger-Zn1nQ", fo = "crk-popover-rvS3X", po = "crk-popoverFade-hj41M", go = "crk-bottom-lawQw", yo = "crk-top-rqvC6", vo = "crk-left-J6exv", bo = "crk-right-3y20l", at = {
665
+ root: ho,
666
+ trigger: mo,
667
+ popover: fo,
668
+ popoverFade: po,
669
+ bottom: go,
670
+ top: yo,
671
+ left: vo,
672
+ right: bo
673
+ };
674
+ function xo(...e) {
675
+ return (t) => {
676
+ for (const n of e)
677
+ n && (typeof n == "function" ? n(t) : n.current = t);
678
+ };
679
+ }
680
+ const Yt = $e(
674
681
  ({
675
682
  trigger: e,
676
- content: t,
677
- position: n = "bottom",
678
- open: r,
679
- onOpenChange: o,
680
- classes: i,
681
- className: c,
682
- style: l
683
- }, a) => {
684
- const [h, u] = Se(!1), d = te(null), m = te(null), p = te(null), y = ze(), $ = r !== void 0, k = $ ? r : h, R = he(
685
- (W) => {
686
- $ || u(W), o?.(W);
683
+ asChild: t = !1,
684
+ content: n,
685
+ position: r = "bottom",
686
+ open: o,
687
+ onOpenChange: i,
688
+ classes: c,
689
+ className: l,
690
+ style: a
691
+ }, h) => {
692
+ const [u, d] = Se(!1), m = ne(null), p = ne(null), x = ne(null), C = Ye(), $ = o !== void 0, b = $ ? o : u, W = de(
693
+ (D) => {
694
+ $ || d(D), i?.(D);
687
695
  },
688
- [$, o]
689
- ), X = he(() => {
690
- R(!1), p.current?.focus();
691
- }, [R]), E = he(() => {
692
- R(!k);
693
- }, [k, R]);
694
- return pt(d, X, k), Tt(
696
+ [$, i]
697
+ ), X = de(() => {
698
+ W(!1), x.current?.focus();
699
+ }, [W]), Y = de(() => {
700
+ W(!b);
701
+ }, [b, W]);
702
+ pt(m, X, b), Tt(
695
703
  {
696
704
  Escape: () => X()
697
705
  },
698
- k
706
+ b
699
707
  ), Be(() => {
700
- if (k && m.current) {
701
- const W = m.current.querySelector(
708
+ if (b && p.current) {
709
+ const D = p.current.querySelector(
702
710
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
703
711
  );
704
- W ? W.focus() : m.current.focus();
712
+ D ? D.focus() : p.current.focus();
705
713
  }
706
- }, [k]), /* @__PURE__ */ s(
714
+ }, [b]);
715
+ let Q;
716
+ if (t && sn(e)) {
717
+ const D = e, S = D.ref;
718
+ Q = jt(D, {
719
+ ref: xo(x, S),
720
+ onClick: (ee) => {
721
+ D.props.onClick?.(ee), Y();
722
+ },
723
+ className: f(D.props.className, c?.trigger),
724
+ "aria-expanded": b,
725
+ "aria-haspopup": "dialog",
726
+ "aria-controls": b ? C : void 0
727
+ });
728
+ } else
729
+ Q = /* @__PURE__ */ s(
730
+ "button",
731
+ {
732
+ ref: x,
733
+ type: "button",
734
+ className: f(at.trigger, c?.trigger),
735
+ onClick: Y,
736
+ "aria-expanded": b,
737
+ "aria-haspopup": "dialog",
738
+ "aria-controls": b ? C : void 0,
739
+ children: e
740
+ }
741
+ );
742
+ return /* @__PURE__ */ s(
707
743
  "div",
708
744
  {
709
- ref: a,
710
- className: f(at.root, i?.root, c),
711
- style: l,
712
- children: /* @__PURE__ */ H("div", { ref: d, children: [
713
- /* @__PURE__ */ s(
714
- "button",
715
- {
716
- ref: p,
717
- type: "button",
718
- className: f(at.trigger, i?.trigger),
719
- onClick: E,
720
- "aria-expanded": k,
721
- "aria-haspopup": "dialog",
722
- "aria-controls": k ? y : void 0,
723
- children: e
724
- }
725
- ),
726
- k && /* @__PURE__ */ s(
745
+ ref: h,
746
+ className: f(at.root, c?.root, l),
747
+ style: a,
748
+ children: /* @__PURE__ */ F("div", { ref: m, children: [
749
+ Q,
750
+ b && /* @__PURE__ */ s(
727
751
  "div",
728
752
  {
729
- ref: m,
730
- id: y,
753
+ ref: p,
754
+ id: C,
731
755
  role: "dialog",
732
756
  tabIndex: -1,
733
- className: f(at.popover, at[n], i?.popover),
734
- children: t
757
+ className: f(at.popover, at[r], c?.popover),
758
+ children: n
735
759
  }
736
760
  )
737
761
  ] })
@@ -739,7 +763,7 @@ const uo = "crk-root-8H-L9", ho = "crk-trigger-Zn1nQ", mo = "crk-popover-rvS3X",
739
763
  );
740
764
  }
741
765
  );
742
- zt.displayName = "Popover";
766
+ Yt.displayName = "Popover";
743
767
  const Bt = [
744
768
  'input:not([disabled]):not([type="hidden"])',
745
769
  "button:not([disabled])",
@@ -748,8 +772,8 @@ const Bt = [
748
772
  "a[href]",
749
773
  '[tabindex]:not([tabindex="-1"])'
750
774
  ].join(", ");
751
- function bo(e, t) {
752
- const n = te(null), r = he(
775
+ function ko(e, t) {
776
+ const n = ne(null), r = de(
753
777
  (o) => {
754
778
  if (o.key !== "Tab" || !e.current)
755
779
  return;
@@ -775,23 +799,23 @@ function bo(e, t) {
775
799
  };
776
800
  }, [t, e, r]);
777
801
  }
778
- const xo = "crk-backdrop-jYpTA", ko = "crk-backdropIn-x5Z-A", Mo = "crk-modal-yNG-7", wo = "crk-modalIn-xFUwm", $o = "crk-sm--xyY9", No = "crk-md-ETTfh", Lo = "crk-lg-5DBb7", So = "crk-fullscreen-b4jQ-", To = "crk-header-NS30G", Ro = "crk-headerWithClose-4davm", Co = "crk-closeButton-JX-aq", Ao = "crk-body-3zIj9", Bo = "crk-footer-Oyz-R", je = {
779
- backdrop: xo,
780
- backdropIn: ko,
781
- modal: Mo,
782
- modalIn: wo,
783
- sm: $o,
784
- md: No,
785
- lg: Lo,
786
- fullscreen: So,
787
- header: To,
788
- headerWithClose: Ro,
789
- closeButton: Co,
790
- body: Ao,
791
- footer: Bo
792
- }, gt = jt({ classes: {}, titleId: "" }), Yt = ({ children: e, className: t, style: n, onClose: r }) => {
802
+ const Mo = "crk-backdrop-jYpTA", wo = "crk-backdropIn-x5Z-A", $o = "crk-modal-yNG-7", No = "crk-modalIn-xFUwm", Lo = "crk-sm--xyY9", So = "crk-md-ETTfh", To = "crk-lg-5DBb7", Ro = "crk-fullscreen-b4jQ-", Co = "crk-header-NS30G", Ao = "crk-headerWithClose-4davm", Bo = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Io = "crk-footer-Oyz-R", je = {
803
+ backdrop: Mo,
804
+ backdropIn: wo,
805
+ modal: $o,
806
+ modalIn: No,
807
+ sm: Lo,
808
+ md: So,
809
+ lg: To,
810
+ fullscreen: Ro,
811
+ header: Co,
812
+ headerWithClose: Ao,
813
+ closeButton: Bo,
814
+ body: Do,
815
+ footer: Io
816
+ }, gt = Xt({ classes: {}, titleId: "" }), Vt = ({ children: e, className: t, style: n, onClose: r }) => {
793
817
  const { classes: o, titleId: i } = ft(gt);
794
- return /* @__PURE__ */ H(
818
+ return /* @__PURE__ */ F(
795
819
  "div",
796
820
  {
797
821
  id: i,
@@ -813,17 +837,17 @@ const xo = "crk-backdrop-jYpTA", ko = "crk-backdropIn-x5Z-A", Mo = "crk-modal-yN
813
837
  }
814
838
  );
815
839
  };
816
- Yt.displayName = "Modal.Header";
817
- const Vt = ({ children: e, className: t, style: n }) => {
840
+ Vt.displayName = "Modal.Header";
841
+ const qt = ({ children: e, className: t, style: n }) => {
818
842
  const { classes: r } = ft(gt);
819
843
  return /* @__PURE__ */ s("div", { className: f(je.body, r.body, t), style: n, children: e });
820
844
  };
821
- Vt.displayName = "Modal.Body";
822
- const qt = ({ children: e, className: t, style: n }) => {
845
+ qt.displayName = "Modal.Body";
846
+ const Gt = ({ children: e, className: t, style: n }) => {
823
847
  const { classes: r } = ft(gt);
824
848
  return /* @__PURE__ */ s("div", { className: f(je.footer, r.footer, t), style: n, children: e });
825
849
  };
826
- qt.displayName = "Modal.Footer";
850
+ Gt.displayName = "Modal.Footer";
827
851
  const yt = $e(
828
852
  ({
829
853
  open: e,
@@ -838,9 +862,9 @@ const yt = $e(
838
862
  "aria-label": h,
839
863
  "aria-labelledby": u
840
864
  }, d) => {
841
- const m = te(null), p = d ?? m, y = ze(), $ = u ?? `${y}-title`;
842
- bo(p, e);
843
- const k = ke(
865
+ const m = ne(null), p = d ?? m, x = Ye(), C = u ?? `${x}-title`;
866
+ ko(p, e);
867
+ const $ = ke(
844
868
  () => ({
845
869
  Escape: () => {
846
870
  r && t();
@@ -848,22 +872,22 @@ const yt = $e(
848
872
  }),
849
873
  [r, t]
850
874
  );
851
- Tt(k, e), Be(() => {
875
+ Tt($, e), Be(() => {
852
876
  if (!e) return;
853
- const X = document.body.style.overflow;
877
+ const W = document.body.style.overflow;
854
878
  return document.body.style.overflow = "hidden", () => {
855
- document.body.style.overflow = X;
879
+ document.body.style.overflow = W;
856
880
  };
857
881
  }, [e]);
858
- const R = (X) => {
859
- n && X.target === X.currentTarget && t();
882
+ const b = (W) => {
883
+ n && W.target === W.currentTarget && t();
860
884
  };
861
- return e ? mn(
885
+ return e ? fn(
862
886
  /* @__PURE__ */ s(
863
887
  "div",
864
888
  {
865
889
  className: f(je.backdrop, i?.backdrop),
866
- onClick: R,
890
+ onClick: b,
867
891
  role: "presentation",
868
892
  children: /* @__PURE__ */ s(
869
893
  "div",
@@ -874,8 +898,8 @@ const yt = $e(
874
898
  role: "dialog",
875
899
  "aria-modal": "true",
876
900
  "aria-label": h,
877
- "aria-labelledby": h ? void 0 : $,
878
- children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId: $ }, children: a })
901
+ "aria-labelledby": h ? void 0 : C,
902
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId: C }, children: a })
879
903
  }
880
904
  )
881
905
  }
@@ -885,22 +909,22 @@ const yt = $e(
885
909
  }
886
910
  );
887
911
  yt.displayName = "Modal";
888
- yt.Header = Yt;
889
- yt.Body = Vt;
890
- yt.Footer = qt;
891
- const Do = "crk-root-jHIIP", Io = "crk-formErrors-eh-OP", Eo = "crk-formError-XEuWv", Po = "crk-field-OUlYz", Wo = "crk-label-udkR7", Ho = "crk-labelError-LOgKi", Oo = "crk-required-IYiA2", Fo = "crk-error-yFZXm", jo = "crk-helperText-Dm-rb", Xo = "crk-row-nNbx-", We = {
892
- root: Do,
893
- formErrors: Io,
894
- formError: Eo,
895
- field: Po,
896
- label: Wo,
897
- labelError: Ho,
898
- required: Oo,
899
- error: Fo,
900
- helperText: jo,
901
- row: Xo
912
+ yt.Header = Vt;
913
+ yt.Body = qt;
914
+ yt.Footer = Gt;
915
+ const Eo = "crk-root-jHIIP", Po = "crk-formErrors-eh-OP", Wo = "crk-formError-XEuWv", Ho = "crk-field-OUlYz", Oo = "crk-label-udkR7", Fo = "crk-labelError-LOgKi", jo = "crk-required-IYiA2", Xo = "crk-error-yFZXm", _o = "crk-helperText-Dm-rb", Uo = "crk-row-nNbx-", We = {
916
+ root: Eo,
917
+ formErrors: Po,
918
+ formError: Wo,
919
+ field: Ho,
920
+ label: Oo,
921
+ labelError: Fo,
922
+ required: jo,
923
+ error: Xo,
924
+ helperText: _o,
925
+ row: Uo
902
926
  };
903
- function Bl({
927
+ function El({
904
928
  form: e,
905
929
  onSubmit: t,
906
930
  errors: n,
@@ -909,7 +933,7 @@ function Bl({
909
933
  children: i
910
934
  }) {
911
935
  const c = n && n.length > 0;
912
- return /* @__PURE__ */ s(dn, { ...e, children: /* @__PURE__ */ H(
936
+ return /* @__PURE__ */ s(un, { ...e, children: /* @__PURE__ */ F(
913
937
  "form",
914
938
  {
915
939
  onSubmit: e.handleSubmit(t),
@@ -922,14 +946,14 @@ function Bl({
922
946
  }
923
947
  ) });
924
948
  }
925
- const Uo = /* @__PURE__ */ new Set([
949
+ const zo = /* @__PURE__ */ new Set([
926
950
  "Select",
927
951
  "NativeSelect",
928
952
  "SearchableSelect",
929
953
  "MultiSelect",
930
954
  "Dropdown"
931
955
  ]);
932
- function Dl({
956
+ function Pl({
933
957
  name: e,
934
958
  label: t,
935
959
  helperText: n,
@@ -940,27 +964,27 @@ function Dl({
940
964
  style: l,
941
965
  children: a
942
966
  }) {
943
- const { control: h } = un(), { field: u, fieldState: d } = hn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", y = Uo.has(p), { ref: $, ...k } = u, R = te($);
944
- R.current = $;
945
- const X = he(
946
- (E) => {
947
- if (E) {
948
- const W = E.matches("input, select, textarea, button, [tabindex]") ? E : E.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
949
- R.current(W ?? E);
967
+ const { control: h } = hn(), { field: u, fieldState: d } = mn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", x = zo.has(p), { ref: C, ...$ } = u, b = ne(C);
968
+ b.current = C;
969
+ const W = de(
970
+ (X) => {
971
+ if (X) {
972
+ const Y = X.matches("input, select, textarea, button, [tabindex]") ? X : X.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
973
+ b.current(Y ?? X);
950
974
  } else
951
- R.current(null);
975
+ b.current(null);
952
976
  },
953
977
  // eslint-disable-next-line react-hooks/exhaustive-deps
954
978
  []
955
979
  );
956
- return /* @__PURE__ */ H("div", { className: f(We.field, i?.field, c), style: l, children: [
957
- t && /* @__PURE__ */ H("label", { className: f(We.label, d.error && We.labelError, i?.label), htmlFor: e, children: [
980
+ return /* @__PURE__ */ F("div", { className: f(We.field, i?.field, c), style: l, children: [
981
+ t && /* @__PURE__ */ F("label", { className: f(We.label, d.error && We.labelError, i?.label), htmlFor: e, children: [
958
982
  t,
959
983
  r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
960
984
  ] }),
961
- ln(a, {
962
- ...k,
963
- ref: X,
985
+ jt(a, {
986
+ ...$,
987
+ ref: W,
964
988
  id: e,
965
989
  error: !!d.error,
966
990
  "aria-invalid": d.error ? !0 : void 0,
@@ -968,31 +992,31 @@ function Dl({
968
992
  // Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
969
993
  // Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
970
994
  // handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
971
- ...y && {
972
- onValueChange: k.onChange,
973
- onValuesChange: k.onChange
995
+ ...x && {
996
+ onValueChange: $.onChange,
997
+ onValuesChange: $.onChange
974
998
  },
975
999
  // Bridge for Checkbox (expects checked, not value)
976
- checked: typeof k.value == "boolean" ? k.value : void 0
1000
+ checked: typeof $.value == "boolean" ? $.value : void 0
977
1001
  }),
978
1002
  d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: f(We.error, i?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: f(We.helperText, i?.helperText), children: n }) : null
979
1003
  ] });
980
1004
  }
981
- function Il({ children: e, className: t, style: n }) {
1005
+ function Wl({ children: e, className: t, style: n }) {
982
1006
  return /* @__PURE__ */ s("div", { className: f(We.row, t), style: n, children: e });
983
1007
  }
984
- const _o = "crk-root-rSgdy", zo = "crk-wrapper-GHy8V", Yo = "crk-sm-DptM5", Vo = "crk-md-F4B0G", qo = "crk-lg-pBxwX", Go = "crk-error-fucxe", Zo = "crk-prefix-w53Md", Ko = "crk-suffix-fcNgR", Qo = "crk-hasPrefix--bqPD", Jo = "crk-hasSuffix-zO0nX", Pe = {
985
- root: _o,
986
- wrapper: zo,
987
- sm: Yo,
988
- md: Vo,
989
- lg: qo,
990
- error: Go,
991
- prefix: Zo,
992
- suffix: Ko,
993
- hasPrefix: Qo,
994
- hasSuffix: Jo
995
- }, ec = $e(
1008
+ const Yo = "crk-root-rSgdy", Vo = "crk-wrapper-GHy8V", qo = "crk-sm-DptM5", Go = "crk-md-F4B0G", Zo = "crk-lg-pBxwX", Ko = "crk-error-fucxe", Qo = "crk-prefix-w53Md", Jo = "crk-suffix-fcNgR", ec = "crk-hasPrefix--bqPD", tc = "crk-hasSuffix-zO0nX", Pe = {
1009
+ root: Yo,
1010
+ wrapper: Vo,
1011
+ sm: qo,
1012
+ md: Go,
1013
+ lg: Zo,
1014
+ error: Ko,
1015
+ prefix: Qo,
1016
+ suffix: Jo,
1017
+ hasPrefix: ec,
1018
+ hasSuffix: tc
1019
+ }, nc = $e(
996
1020
  ({
997
1021
  inputSize: e = "md",
998
1022
  error: t = !1,
@@ -1020,7 +1044,7 @@ const _o = "crk-root-rSgdy", zo = "crk-wrapper-GHy8V", Yo = "crk-sm-DptM5", Vo =
1020
1044
  ...l
1021
1045
  }
1022
1046
  );
1023
- return n || r ? /* @__PURE__ */ H(
1047
+ return n || r ? /* @__PURE__ */ F(
1024
1048
  "div",
1025
1049
  {
1026
1050
  className: f(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, i),
@@ -1034,41 +1058,41 @@ const _o = "crk-root-rSgdy", zo = "crk-wrapper-GHy8V", Yo = "crk-sm-DptM5", Vo =
1034
1058
  ) : h;
1035
1059
  }
1036
1060
  );
1037
- ec.displayName = "Input";
1038
- const tc = "crk-wrapper-SP2JE", nc = "crk-sm-DqshL", rc = "crk-md-j4AKI", oc = "crk-lg-24Xd3", cc = "crk-root-Uu9Ah", ic = "crk-error-9oRU6", lc = "crk-arrow-WU8ZW", sc = "crk-searchableWrapper-7AL4l", ac = "crk-hiddenSelect-s3DEx", dc = "crk-searchableTrigger-m-GWV", uc = "crk-triggerOpen-Lo8-j", hc = "crk-triggerLabel-5rETZ", mc = "crk-placeholder-teBBh", fc = "crk-arrowInline-m-roG", pc = "crk-disabled-pcSeq", gc = "crk-visuallyHidden-2tTD5", yc = "crk-menu--i-je", vc = "crk-menuEnter-vJjLV", bc = "crk-menuItems-VrZnE", xc = "crk-item-fU3XI", kc = "crk-itemHighlighted-MvR41", Mc = "crk-itemDisabled-KTUO8", wc = "crk-itemSelected-42-BG", $c = "crk-noResults-uicSW", Nc = "crk-multiTrigger-Pd3wJ", Lc = "crk-multiTriggerDisabled-9ajge", Sc = "crk-chip-TuYUB", Tc = "crk-chipLabel-H4JWu", Rc = "crk-chipRemove-Lfk0R", Cc = "crk-multiSearch-OrVeS", Ac = "crk-arrowMulti-Nh9Hr", Bc = "crk-itemCheck-DPB5A", I = {
1039
- wrapper: tc,
1040
- sm: nc,
1041
- md: rc,
1042
- lg: oc,
1043
- root: cc,
1044
- error: ic,
1045
- arrow: lc,
1046
- searchableWrapper: sc,
1047
- hiddenSelect: ac,
1048
- searchableTrigger: dc,
1049
- triggerOpen: uc,
1050
- triggerLabel: hc,
1051
- placeholder: mc,
1052
- arrowInline: fc,
1053
- disabled: pc,
1054
- visuallyHidden: gc,
1055
- menu: yc,
1056
- menuEnter: vc,
1057
- menuItems: bc,
1058
- item: xc,
1059
- itemHighlighted: kc,
1060
- itemDisabled: Mc,
1061
- itemSelected: wc,
1062
- noResults: $c,
1063
- multiTrigger: Nc,
1064
- multiTriggerDisabled: Lc,
1065
- chip: Sc,
1066
- chipLabel: Tc,
1067
- chipRemove: Rc,
1068
- multiSearch: Cc,
1069
- arrowMulti: Ac,
1070
- itemCheck: Bc
1071
- }, Gt = $e(
1061
+ nc.displayName = "Input";
1062
+ const rc = "crk-wrapper-SP2JE", oc = "crk-sm-DqshL", cc = "crk-md-j4AKI", ic = "crk-lg-24Xd3", lc = "crk-root-Uu9Ah", sc = "crk-error-9oRU6", ac = "crk-arrow-WU8ZW", dc = "crk-searchableWrapper-7AL4l", uc = "crk-hiddenSelect-s3DEx", hc = "crk-searchableTrigger-m-GWV", mc = "crk-triggerOpen-Lo8-j", fc = "crk-triggerLabel-5rETZ", pc = "crk-placeholder-teBBh", gc = "crk-arrowInline-m-roG", yc = "crk-disabled-pcSeq", vc = "crk-visuallyHidden-2tTD5", bc = "crk-menu--i-je", xc = "crk-menuEnter-vJjLV", kc = "crk-menuItems-VrZnE", Mc = "crk-item-fU3XI", wc = "crk-itemHighlighted-MvR41", $c = "crk-itemDisabled-KTUO8", Nc = "crk-itemSelected-42-BG", Lc = "crk-noResults-uicSW", Sc = "crk-multiTrigger-Pd3wJ", Tc = "crk-multiTriggerDisabled-9ajge", Rc = "crk-chip-TuYUB", Cc = "crk-chipLabel-H4JWu", Ac = "crk-chipRemove-Lfk0R", Bc = "crk-multiSearch-OrVeS", Dc = "crk-arrowMulti-Nh9Hr", Ic = "crk-itemCheck-DPB5A", P = {
1063
+ wrapper: rc,
1064
+ sm: oc,
1065
+ md: cc,
1066
+ lg: ic,
1067
+ root: lc,
1068
+ error: sc,
1069
+ arrow: ac,
1070
+ searchableWrapper: dc,
1071
+ hiddenSelect: uc,
1072
+ searchableTrigger: hc,
1073
+ triggerOpen: mc,
1074
+ triggerLabel: fc,
1075
+ placeholder: pc,
1076
+ arrowInline: gc,
1077
+ disabled: yc,
1078
+ visuallyHidden: vc,
1079
+ menu: bc,
1080
+ menuEnter: xc,
1081
+ menuItems: kc,
1082
+ item: Mc,
1083
+ itemHighlighted: wc,
1084
+ itemDisabled: $c,
1085
+ itemSelected: Nc,
1086
+ noResults: Lc,
1087
+ multiTrigger: Sc,
1088
+ multiTriggerDisabled: Tc,
1089
+ chip: Rc,
1090
+ chipLabel: Cc,
1091
+ chipRemove: Ac,
1092
+ multiSearch: Bc,
1093
+ arrowMulti: Dc,
1094
+ itemCheck: Ic
1095
+ }, Zt = $e(
1072
1096
  ({
1073
1097
  inputSize: e = "md",
1074
1098
  error: t = !1,
@@ -1082,12 +1106,12 @@ const tc = "crk-wrapper-SP2JE", nc = "crk-sm-DqshL", rc = "crk-md-j4AKI", oc = "
1082
1106
  searchPlaceholder: h,
1083
1107
  onValueChange: u,
1084
1108
  ...d
1085
- }, m) => /* @__PURE__ */ H("div", { className: f(I.wrapper, I[e], t && I.error, o?.wrapper, i), style: c, children: [
1086
- /* @__PURE__ */ H(
1109
+ }, m) => /* @__PURE__ */ F("div", { className: f(P.wrapper, P[e], t && P.error, o?.wrapper, i), style: c, children: [
1110
+ /* @__PURE__ */ F(
1087
1111
  "select",
1088
1112
  {
1089
1113
  ref: m,
1090
- className: f(I.root, I[e], t && I.error, o?.root),
1114
+ className: f(P.root, P[e], t && P.error, o?.root),
1091
1115
  ...d,
1092
1116
  children: [
1093
1117
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
@@ -1095,11 +1119,11 @@ const tc = "crk-wrapper-SP2JE", nc = "crk-sm-DqshL", rc = "crk-md-j4AKI", oc = "
1095
1119
  ]
1096
1120
  }
1097
1121
  ),
1098
- /* @__PURE__ */ s("span", { className: f(I.arrow, o?.arrow) })
1122
+ /* @__PURE__ */ s("span", { className: f(P.arrow, o?.arrow) })
1099
1123
  ] })
1100
1124
  );
1101
- Gt.displayName = "NativeSelect";
1102
- const Zt = $e(
1125
+ Zt.displayName = "NativeSelect";
1126
+ const Kt = $e(
1103
1127
  ({
1104
1128
  inputSize: e = "md",
1105
1129
  error: t = !1,
@@ -1115,75 +1139,75 @@ const Zt = $e(
1115
1139
  onChange: d,
1116
1140
  onValueChange: m
1117
1141
  }, p) => {
1118
- const [y, $] = Se(!1), [k, R] = Se(""), [X, E] = Se(0), W = te(null), ae = te(null), _ = te(null), C = te(null), oe = ze(), le = te(null), w = p ?? le, q = te(!1);
1142
+ const [x, C] = Se(!1), [$, b] = Se(""), [W, X] = Se(0), Y = ne(null), Q = ne(null), D = ne(null), S = ne(null), ee = Ye(), re = ne(null), M = p ?? re, G = ne(!1);
1119
1143
  Be(() => {
1120
- q.current && !y && _.current?.focus(), q.current = y;
1121
- }, [y]);
1122
- const D = he(() => {
1123
- $(!1), R(""), E(0);
1124
- }, []), Q = he(() => {
1125
- a || ($(!0), R(""), E(0), setTimeout(() => ae.current?.focus(), 0));
1126
- }, [a]), O = he(
1127
- (v) => {
1128
- if (m?.(v), w.current) {
1144
+ G.current && !x && D.current?.focus(), G.current = x;
1145
+ }, [x]);
1146
+ const O = de(() => {
1147
+ C(!1), b(""), X(0);
1148
+ }, []), te = de(() => {
1149
+ a || (C(!0), b(""), X(0), setTimeout(() => Q.current?.focus(), 0));
1150
+ }, [a]), j = de(
1151
+ (w) => {
1152
+ if (m?.(w), M.current) {
1129
1153
  Object.getOwnPropertyDescriptor(
1130
1154
  HTMLSelectElement.prototype,
1131
1155
  "value"
1132
- )?.set?.call(w.current, v);
1156
+ )?.set?.call(M.current, w);
1133
1157
  const N = new Event("change", { bubbles: !0 });
1134
- w.current.dispatchEvent(N), d?.(N);
1158
+ M.current.dispatchEvent(N), d?.(N);
1135
1159
  }
1136
- D();
1160
+ O();
1137
1161
  },
1138
- [m, d, w, D]
1139
- ), P = ke(() => {
1140
- if (!k) return n;
1141
- const v = k.toLowerCase();
1142
- return n.filter((M) => M.label.toLowerCase().includes(v));
1143
- }, [n, k]);
1162
+ [m, d, M, O]
1163
+ ), U = ke(() => {
1164
+ if (!$) return n;
1165
+ const w = $.toLowerCase();
1166
+ return n.filter((B) => B.label.toLowerCase().includes(w));
1167
+ }, [n, $]);
1144
1168
  Be(() => {
1145
- const v = P.findIndex((M) => !M.disabled);
1146
- E(v >= 0 ? v : 0);
1147
- }, [P]), Be(() => {
1148
- if (!y) return;
1149
- const v = C.current;
1150
- if (!v) return;
1151
- v.querySelectorAll('[role="option"]')[X]?.scrollIntoView?.({ block: "nearest" });
1152
- }, [X, y]);
1153
- const ee = he(
1154
- (v) => {
1155
- const M = P.map((N, z) => N.disabled ? -1 : z).filter((N) => N >= 0);
1156
- if (M.length !== 0)
1157
- if (v.key === "ArrowDown")
1158
- v.preventDefault(), E((N) => {
1159
- const z = M.indexOf(N);
1160
- return z < M.length - 1 ? M[z + 1] : M[0];
1169
+ const w = U.findIndex((B) => !B.disabled);
1170
+ X(w >= 0 ? w : 0);
1171
+ }, [U]), Be(() => {
1172
+ if (!x) return;
1173
+ const w = S.current;
1174
+ if (!w) return;
1175
+ w.querySelectorAll('[role="option"]')[W]?.scrollIntoView?.({ block: "nearest" });
1176
+ }, [W, x]);
1177
+ const J = de(
1178
+ (w) => {
1179
+ const B = U.map((N, z) => N.disabled ? -1 : z).filter((N) => N >= 0);
1180
+ if (B.length !== 0)
1181
+ if (w.key === "ArrowDown")
1182
+ w.preventDefault(), X((N) => {
1183
+ const z = B.indexOf(N);
1184
+ return z < B.length - 1 ? B[z + 1] : B[0];
1161
1185
  });
1162
- else if (v.key === "ArrowUp")
1163
- v.preventDefault(), E((N) => {
1164
- const z = M.indexOf(N);
1165
- return z > 0 ? M[z - 1] : M[M.length - 1];
1186
+ else if (w.key === "ArrowUp")
1187
+ w.preventDefault(), X((N) => {
1188
+ const z = B.indexOf(N);
1189
+ return z > 0 ? B[z - 1] : B[B.length - 1];
1166
1190
  });
1167
- else if (v.key === "Enter") {
1168
- v.preventDefault();
1169
- const N = P[X];
1170
- N && !N.disabled && O(N.value);
1171
- } else v.key === "Escape" && (v.preventDefault(), D());
1191
+ else if (w.key === "Enter") {
1192
+ w.preventDefault();
1193
+ const N = U[W];
1194
+ N && !N.disabled && j(N.value);
1195
+ } else w.key === "Escape" && (w.preventDefault(), O());
1172
1196
  },
1173
- [P, X, O, D]
1197
+ [U, W, j, O]
1174
1198
  );
1175
- pt(W, D, y);
1176
- const ne = n.find((v) => v.value === l)?.label, L = P.filter((v) => !v.disabled);
1177
- return /* @__PURE__ */ H(
1199
+ pt(Y, O, x);
1200
+ const oe = n.find((w) => w.value === l)?.label, he = U.filter((w) => !w.disabled);
1201
+ return /* @__PURE__ */ F(
1178
1202
  "div",
1179
1203
  {
1180
- ref: W,
1204
+ ref: Y,
1181
1205
  className: f(
1182
- I.wrapper,
1183
- I.searchableWrapper,
1184
- I[e],
1185
- t && I.error,
1186
- a && I.disabled,
1206
+ P.wrapper,
1207
+ P.searchableWrapper,
1208
+ P[e],
1209
+ t && P.error,
1210
+ a && P.disabled,
1187
1211
  o?.wrapper,
1188
1212
  i
1189
1213
  ),
@@ -1192,96 +1216,96 @@ const Zt = $e(
1192
1216
  /* @__PURE__ */ s(
1193
1217
  "select",
1194
1218
  {
1195
- ref: w,
1196
- className: I.hiddenSelect,
1219
+ ref: M,
1220
+ className: P.hiddenSelect,
1197
1221
  value: l ?? "",
1198
1222
  disabled: a,
1199
1223
  tabIndex: -1,
1200
1224
  "aria-hidden": "true",
1201
1225
  onChange: () => {
1202
1226
  },
1203
- children: n.map((v) => /* @__PURE__ */ s("option", { value: v.value, children: v.label }, v.value))
1227
+ children: n.map((w) => /* @__PURE__ */ s("option", { value: w.value, children: w.label }, w.value))
1204
1228
  }
1205
1229
  ),
1206
- /* @__PURE__ */ H(
1230
+ /* @__PURE__ */ F(
1207
1231
  "button",
1208
1232
  {
1209
- ref: _,
1233
+ ref: D,
1210
1234
  id: h,
1211
1235
  type: "button",
1212
1236
  className: f(
1213
- I.root,
1214
- I.searchableTrigger,
1215
- I[e],
1216
- y && I.triggerOpen,
1217
- t && I.error,
1218
- y && I.visuallyHidden,
1237
+ P.root,
1238
+ P.searchableTrigger,
1239
+ P[e],
1240
+ x && P.triggerOpen,
1241
+ t && P.error,
1242
+ x && P.visuallyHidden,
1219
1243
  o?.root
1220
1244
  ),
1221
- onClick: Q,
1245
+ onClick: te,
1222
1246
  disabled: a,
1223
- "aria-expanded": y,
1247
+ "aria-expanded": x,
1224
1248
  "aria-haspopup": "listbox",
1225
- "aria-controls": y ? oe : void 0,
1249
+ "aria-controls": x ? ee : void 0,
1226
1250
  children: [
1227
- /* @__PURE__ */ s("span", { className: f(I.triggerLabel, !ne && I.placeholder), children: ne || r }),
1228
- /* @__PURE__ */ s("span", { className: f(I.arrow, I.arrowInline, o?.arrow) })
1251
+ /* @__PURE__ */ s("span", { className: f(P.triggerLabel, !oe && P.placeholder), children: oe || r }),
1252
+ /* @__PURE__ */ s("span", { className: f(P.arrow, P.arrowInline, o?.arrow) })
1229
1253
  ]
1230
1254
  }
1231
1255
  ),
1232
- y && /* @__PURE__ */ s(
1256
+ x && /* @__PURE__ */ s(
1233
1257
  "input",
1234
1258
  {
1235
- ref: ae,
1259
+ ref: Q,
1236
1260
  type: "text",
1237
1261
  role: "combobox",
1238
1262
  className: f(
1239
- I.root,
1240
- I.searchableTrigger,
1241
- I[e],
1242
- I.triggerOpen,
1243
- t && I.error,
1263
+ P.root,
1264
+ P.searchableTrigger,
1265
+ P[e],
1266
+ P.triggerOpen,
1267
+ t && P.error,
1244
1268
  o?.root,
1245
1269
  o?.search
1246
1270
  ),
1247
- placeholder: ne || r,
1248
- value: k,
1249
- onChange: (v) => R(v.target.value),
1250
- onKeyDown: ee,
1271
+ placeholder: oe || r,
1272
+ value: $,
1273
+ onChange: (w) => b(w.target.value),
1274
+ onKeyDown: J,
1251
1275
  "aria-expanded": !0,
1252
1276
  "aria-haspopup": "listbox",
1253
- "aria-controls": oe,
1254
- "aria-activedescendant": L.length > 0 ? `select-option-${P[X]?.value}` : void 0
1277
+ "aria-controls": ee,
1278
+ "aria-activedescendant": he.length > 0 ? `select-option-${U[W]?.value}` : void 0
1255
1279
  }
1256
1280
  ),
1257
- y && /* @__PURE__ */ s("div", { id: oe, className: f(I.menu, o?.menu), role: "listbox", children: /* @__PURE__ */ s("div", { className: I.menuItems, ref: C, children: P.length === 0 ? /* @__PURE__ */ s("div", { className: I.noResults, children: "No results" }) : P.map((v, M) => /* @__PURE__ */ s(
1281
+ x && /* @__PURE__ */ s("div", { id: ee, className: f(P.menu, o?.menu), role: "listbox", children: /* @__PURE__ */ s("div", { className: P.menuItems, ref: S, children: U.length === 0 ? /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }) : U.map((w, B) => /* @__PURE__ */ s(
1258
1282
  "button",
1259
1283
  {
1260
- id: `select-option-${v.value}`,
1284
+ id: `select-option-${w.value}`,
1261
1285
  type: "button",
1262
1286
  role: "option",
1263
- "aria-selected": v.value === l,
1287
+ "aria-selected": w.value === l,
1264
1288
  className: f(
1265
- I.item,
1266
- v.disabled && I.itemDisabled,
1267
- v.value === l && I.itemSelected,
1268
- M === X && I.itemHighlighted,
1289
+ P.item,
1290
+ w.disabled && P.itemDisabled,
1291
+ w.value === l && P.itemSelected,
1292
+ B === W && P.itemHighlighted,
1269
1293
  o?.item
1270
1294
  ),
1271
- disabled: v.disabled,
1272
- onClick: () => O(v.value),
1273
- onMouseEnter: () => E(M),
1274
- children: v.content ?? v.label
1295
+ disabled: w.disabled,
1296
+ onClick: () => j(w.value),
1297
+ onMouseEnter: () => X(B),
1298
+ children: w.content ?? w.label
1275
1299
  },
1276
- v.value
1300
+ w.value
1277
1301
  )) }) })
1278
1302
  ]
1279
1303
  }
1280
1304
  );
1281
1305
  }
1282
1306
  );
1283
- Zt.displayName = "SearchableSelect";
1284
- const Kt = $e(
1307
+ Kt.displayName = "SearchableSelect";
1308
+ const Qt = $e(
1285
1309
  ({
1286
1310
  inputSize: e = "md",
1287
1311
  error: t = !1,
@@ -1295,79 +1319,89 @@ const Kt = $e(
1295
1319
  id: h,
1296
1320
  searchPlaceholder: u,
1297
1321
  onValuesChange: d,
1298
- clearSearchOnSelect: m = !0
1299
- }, p) => {
1300
- const y = Array.isArray(l) ? l : l ? [l] : [], [$, k] = Se(!1), [R, X] = Se(""), [E, W] = Se(0), ae = te(null), _ = te(null), C = te(null), oe = ze(), le = te(null), w = p ?? le, q = he(() => {
1301
- k(!1), X(""), W(0);
1302
- }, []), D = he(() => {
1303
- a || (k(!0), X(""), W(0), setTimeout(() => _.current?.focus(), 0));
1304
- }, [a]), Q = he(
1305
- (L) => {
1306
- const v = y.includes(L) ? y.filter((M) => M !== L) : [...y, L];
1307
- d?.(v), m && X("");
1322
+ clearSearchOnSelect: m = !0,
1323
+ allowCreate: p = !1,
1324
+ onCreate: x,
1325
+ createLabel: C
1326
+ }, $) => {
1327
+ const b = Array.isArray(l) ? l : l ? [l] : [], [W, X] = Se(!1), [Y, Q] = Se(""), [D, S] = Se(0), ee = ne(null), re = ne(null), M = ne(null), G = Ye(), O = ne(null), te = $ ?? O, j = de(() => {
1328
+ X(!1), Q(""), S(0);
1329
+ }, []), U = de(() => {
1330
+ a || (X(!0), Q(""), S(0), setTimeout(() => re.current?.focus(), 0));
1331
+ }, [a]), J = de(
1332
+ (y) => {
1333
+ const L = b.includes(y) ? b.filter((A) => A !== y) : [...b, y];
1334
+ d?.(L), m && Q("");
1308
1335
  },
1309
- [y, d, m]
1310
- ), O = he(
1311
- (L, v) => {
1312
- v.stopPropagation(), d?.(y.filter((M) => M !== L));
1336
+ [b, d, m]
1337
+ ), oe = de(
1338
+ (y, L) => {
1339
+ L.stopPropagation(), d?.(b.filter((A) => A !== y));
1313
1340
  },
1314
- [y, d]
1315
- ), P = ke(() => {
1316
- if (!R) return n;
1317
- const L = R.toLowerCase();
1318
- return n.filter((v) => v.label.toLowerCase().includes(L));
1319
- }, [n, R]);
1341
+ [b, d]
1342
+ ), he = ke(() => {
1343
+ if (!Y) return n;
1344
+ const y = Y.toLowerCase();
1345
+ return n.filter((L) => L.label.toLowerCase().includes(y));
1346
+ }, [n, Y]), w = Y.trim(), B = p && w.length > 0 && !n.some(
1347
+ (y) => y.label.toLowerCase() === w.toLowerCase() || y.value === w
1348
+ ) && !b.includes(w), N = de(() => {
1349
+ w && (b.includes(w) || (x?.(w), d?.([...b, w]), m && Q("")));
1350
+ }, [w, b, x, d, m]);
1320
1351
  Be(() => {
1321
- const L = P.findIndex((v) => !v.disabled);
1322
- W(L >= 0 ? L : 0);
1323
- }, [P]), Be(() => {
1324
- if (!$) return;
1325
- const L = C.current;
1326
- if (!L) return;
1327
- L.querySelectorAll('[role="option"]')[E]?.scrollIntoView?.({ block: "nearest" });
1328
- }, [E, $]);
1329
- const ee = he(
1330
- (L) => {
1331
- const v = P.map((M, N) => M.disabled ? -1 : N).filter((M) => M >= 0);
1332
- if (L.key === "Backspace" && R === "" && y.length > 0) {
1333
- L.preventDefault(), d?.(y.slice(0, -1));
1352
+ const y = he.findIndex((L) => !L.disabled);
1353
+ S(y >= 0 ? y : 0);
1354
+ }, [he]), Be(() => {
1355
+ if (!W) return;
1356
+ const y = M.current;
1357
+ if (!y) return;
1358
+ y.querySelectorAll('[role="option"]')[D]?.scrollIntoView?.({ block: "nearest" });
1359
+ }, [D, W]);
1360
+ const z = he.length, T = de(
1361
+ (y) => {
1362
+ const L = he.map((A, H) => A.disabled ? -1 : H).filter((A) => A >= 0);
1363
+ if (B && L.push(z), y.key === "Backspace" && Y === "" && b.length > 0) {
1364
+ y.preventDefault(), d?.(b.slice(0, -1));
1334
1365
  return;
1335
1366
  }
1336
- if (v.length !== 0)
1337
- if (L.key === "ArrowDown") {
1338
- if (L.preventDefault(), !$) {
1339
- D();
1367
+ if (L.length !== 0)
1368
+ if (y.key === "ArrowDown") {
1369
+ if (y.preventDefault(), !W) {
1370
+ U();
1340
1371
  return;
1341
1372
  }
1342
- W((M) => {
1343
- const N = v.indexOf(M);
1344
- return N < v.length - 1 ? v[N + 1] : v[0];
1373
+ S((A) => {
1374
+ const H = L.indexOf(A);
1375
+ return H < L.length - 1 ? L[H + 1] : L[0];
1345
1376
  });
1346
- } else if (L.key === "ArrowUp")
1347
- L.preventDefault(), W((M) => {
1348
- const N = v.indexOf(M);
1349
- return N > 0 ? v[N - 1] : v[v.length - 1];
1377
+ } else if (y.key === "ArrowUp")
1378
+ y.preventDefault(), S((A) => {
1379
+ const H = L.indexOf(A);
1380
+ return H > 0 ? L[H - 1] : L[L.length - 1];
1350
1381
  });
1351
- else if (L.key === "Enter") {
1352
- L.preventDefault();
1353
- const M = P[E];
1354
- M && !M.disabled && Q(M.value);
1355
- } else L.key === "Escape" && (L.preventDefault(), q());
1382
+ else if (y.key === "Enter") {
1383
+ if (y.preventDefault(), B && D === z) {
1384
+ N();
1385
+ return;
1386
+ }
1387
+ const A = he[D];
1388
+ A && !A.disabled ? J(A.value) : B && N();
1389
+ } else y.key === "Escape" && (y.preventDefault(), j());
1356
1390
  },
1357
- [P, E, Q, q, R, y, d, $, D]
1391
+ [he, D, J, j, Y, b, d, W, U, B, N, z]
1358
1392
  );
1359
- pt(ae, q, $);
1360
- const ne = y.map((L) => n.find((v) => v.value === L)).filter((L) => !!L);
1361
- return /* @__PURE__ */ H(
1393
+ pt(ee, j, W);
1394
+ const _ = b.map((y) => n.find((A) => A.value === y) ?? { value: y, label: y });
1395
+ return /* @__PURE__ */ F(
1362
1396
  "div",
1363
1397
  {
1364
- ref: ae,
1398
+ ref: ee,
1365
1399
  className: f(
1366
- I.wrapper,
1367
- I.searchableWrapper,
1368
- I[e],
1369
- t && I.error,
1370
- a && I.disabled,
1400
+ P.wrapper,
1401
+ P.searchableWrapper,
1402
+ P[e],
1403
+ t && P.error,
1404
+ a && P.disabled,
1371
1405
  o?.wrapper,
1372
1406
  i
1373
1407
  ),
@@ -1376,115 +1410,139 @@ const Kt = $e(
1376
1410
  /* @__PURE__ */ s(
1377
1411
  "select",
1378
1412
  {
1379
- ref: w,
1380
- className: I.hiddenSelect,
1413
+ ref: te,
1414
+ className: P.hiddenSelect,
1381
1415
  multiple: !0,
1382
- value: y,
1416
+ value: b,
1383
1417
  disabled: a,
1384
1418
  tabIndex: -1,
1385
1419
  "aria-hidden": "true",
1386
1420
  onChange: () => {
1387
1421
  },
1388
- children: n.map((L) => /* @__PURE__ */ s("option", { value: L.value, children: L.label }, L.value))
1422
+ children: n.map((y) => /* @__PURE__ */ s("option", { value: y.value, children: y.label }, y.value))
1389
1423
  }
1390
1424
  ),
1391
- /* @__PURE__ */ H(
1425
+ /* @__PURE__ */ F(
1392
1426
  "div",
1393
1427
  {
1394
1428
  className: f(
1395
- I.multiTrigger,
1396
- I[e],
1397
- $ && I.triggerOpen,
1398
- t && I.error,
1399
- a && I.multiTriggerDisabled,
1429
+ P.multiTrigger,
1430
+ P[e],
1431
+ W && P.triggerOpen,
1432
+ t && P.error,
1433
+ a && P.multiTriggerDisabled,
1400
1434
  o?.root
1401
1435
  ),
1402
1436
  onClick: () => {
1403
- $ ? _.current?.focus() : D();
1437
+ W ? re.current?.focus() : U();
1404
1438
  },
1405
1439
  role: "combobox",
1406
- "aria-expanded": $,
1440
+ "aria-expanded": W,
1407
1441
  "aria-haspopup": "listbox",
1408
- "aria-controls": $ ? oe : void 0,
1442
+ "aria-controls": W ? G : void 0,
1409
1443
  children: [
1410
- ne.map((L) => /* @__PURE__ */ H("span", { className: f(I.chip, o?.chip), children: [
1411
- /* @__PURE__ */ s("span", { className: I.chipLabel, children: L.content ?? L.label }),
1444
+ _.map((y) => /* @__PURE__ */ F("span", { className: f(P.chip, o?.chip), children: [
1445
+ /* @__PURE__ */ s("span", { className: P.chipLabel, children: y.content ?? y.label }),
1412
1446
  /* @__PURE__ */ s(
1413
1447
  "button",
1414
1448
  {
1415
1449
  type: "button",
1416
- className: f(I.chipRemove, o?.chipRemove),
1417
- onClick: (v) => O(L.value, v),
1418
- "aria-label": `Remove ${L.label}`,
1450
+ className: f(P.chipRemove, o?.chipRemove),
1451
+ onClick: (L) => oe(y.value, L),
1452
+ "aria-label": `Remove ${y.label}`,
1419
1453
  tabIndex: -1,
1420
1454
  children: "×"
1421
1455
  }
1422
1456
  )
1423
- ] }, L.value)),
1457
+ ] }, y.value)),
1424
1458
  /* @__PURE__ */ s(
1425
1459
  "input",
1426
1460
  {
1427
- ref: _,
1461
+ ref: re,
1428
1462
  id: h,
1429
1463
  type: "text",
1430
- className: I.multiSearch,
1431
- placeholder: y.length === 0 ? r : "",
1432
- value: R,
1433
- onChange: (L) => {
1434
- X(L.target.value), $ || D();
1464
+ className: P.multiSearch,
1465
+ placeholder: b.length === 0 ? r : "",
1466
+ value: Y,
1467
+ onChange: (y) => {
1468
+ Q(y.target.value), W || U();
1435
1469
  },
1436
- onKeyDown: ee,
1470
+ onKeyDown: T,
1437
1471
  disabled: a,
1438
1472
  "aria-label": "Search options"
1439
1473
  }
1440
1474
  ),
1441
- /* @__PURE__ */ s("span", { className: f(I.arrow, I.arrowMulti, o?.arrow) })
1475
+ /* @__PURE__ */ s("span", { className: f(P.arrow, P.arrowMulti, o?.arrow) })
1442
1476
  ]
1443
1477
  }
1444
1478
  ),
1445
- $ && /* @__PURE__ */ s("div", { id: oe, className: f(I.menu, o?.menu), role: "listbox", "aria-multiselectable": "true", children: /* @__PURE__ */ s("div", { className: I.menuItems, ref: C, children: P.length === 0 ? /* @__PURE__ */ s("div", { className: I.noResults, children: "No results" }) : P.map((L, v) => {
1446
- const M = y.includes(L.value);
1447
- return /* @__PURE__ */ H(
1479
+ W && /* @__PURE__ */ s("div", { id: G, className: f(P.menu, o?.menu), role: "listbox", "aria-multiselectable": "true", children: /* @__PURE__ */ F("div", { className: P.menuItems, ref: M, children: [
1480
+ he.length === 0 && !B && /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }),
1481
+ he.map((y, L) => {
1482
+ const A = b.includes(y.value);
1483
+ return /* @__PURE__ */ F(
1484
+ "button",
1485
+ {
1486
+ id: `select-option-${y.value}`,
1487
+ type: "button",
1488
+ role: "option",
1489
+ "aria-selected": A,
1490
+ className: f(
1491
+ P.item,
1492
+ y.disabled && P.itemDisabled,
1493
+ A && P.itemSelected,
1494
+ L === D && P.itemHighlighted,
1495
+ o?.item
1496
+ ),
1497
+ disabled: y.disabled,
1498
+ onClick: () => J(y.value),
1499
+ onMouseEnter: () => S(L),
1500
+ children: [
1501
+ A && /* @__PURE__ */ s("span", { className: P.itemCheck, "aria-hidden": "true" }),
1502
+ y.content ?? y.label
1503
+ ]
1504
+ },
1505
+ y.value
1506
+ );
1507
+ }),
1508
+ B && /* @__PURE__ */ s(
1448
1509
  "button",
1449
1510
  {
1450
- id: `select-option-${L.value}`,
1451
1511
  type: "button",
1452
1512
  role: "option",
1453
- "aria-selected": M,
1513
+ "aria-selected": !1,
1454
1514
  className: f(
1455
- I.item,
1456
- L.disabled && I.itemDisabled,
1457
- M && I.itemSelected,
1458
- v === E && I.itemHighlighted,
1515
+ P.item,
1516
+ D === z && P.itemHighlighted,
1459
1517
  o?.item
1460
1518
  ),
1461
- disabled: L.disabled,
1462
- onClick: () => Q(L.value),
1463
- onMouseEnter: () => W(v),
1464
- children: [
1465
- M && /* @__PURE__ */ s("span", { className: I.itemCheck, "aria-hidden": "true" }),
1466
- L.content ?? L.label
1467
- ]
1519
+ onClick: N,
1520
+ onMouseEnter: () => S(z),
1521
+ children: C ? C(w) : /* @__PURE__ */ F(Xe, { children: [
1522
+ "Create “",
1523
+ /* @__PURE__ */ s("strong", { children: w }),
1524
+ "”"
1525
+ ] })
1468
1526
  },
1469
- L.value
1470
- );
1471
- }) }) })
1527
+ "__create__"
1528
+ )
1529
+ ] }) })
1472
1530
  ]
1473
1531
  }
1474
1532
  );
1475
1533
  }
1476
1534
  );
1477
- Kt.displayName = "MultiSelect";
1478
- const Dc = $e(
1479
- (e, t) => e.multiple ? /* @__PURE__ */ s(Kt, { ref: t, ...e }) : e.searchable ? /* @__PURE__ */ s(Zt, { ref: t, ...e }) : /* @__PURE__ */ s(Gt, { ref: t, ...e })
1535
+ Qt.displayName = "MultiSelect";
1536
+ const Ec = $e(
1537
+ (e, t) => e.multiple ? /* @__PURE__ */ s(Qt, { ref: t, ...e }) : e.searchable ? /* @__PURE__ */ s(Kt, { ref: t, ...e }) : /* @__PURE__ */ s(Zt, { ref: t, ...e })
1480
1538
  );
1481
- Dc.displayName = "Select";
1482
- const Ic = "crk-root-61cKD", Ec = "crk-input-bAjPU", Pc = "crk-label-W9IeS", Wc = "crk-indeterminate-mLarv", dt = {
1483
- root: Ic,
1484
- input: Ec,
1485
- label: Pc,
1486
- indeterminate: Wc
1487
- }, Hc = $e(
1539
+ Ec.displayName = "Select";
1540
+ const Pc = "crk-root-61cKD", Wc = "crk-input-bAjPU", Hc = "crk-label-W9IeS", Oc = "crk-indeterminate-mLarv", dt = {
1541
+ root: Pc,
1542
+ input: Wc,
1543
+ label: Hc,
1544
+ indeterminate: Oc
1545
+ }, Fc = $e(
1488
1546
  ({
1489
1547
  label: e,
1490
1548
  indeterminate: t = !1,
@@ -1493,10 +1551,10 @@ const Ic = "crk-root-61cKD", Ec = "crk-input-bAjPU", Pc = "crk-label-W9IeS", Wc
1493
1551
  style: o,
1494
1552
  ...i
1495
1553
  }, c) => {
1496
- const l = te(null);
1554
+ const l = ne(null);
1497
1555
  return Be(() => {
1498
1556
  l.current && (l.current.indeterminate = t);
1499
- }, [t]), /* @__PURE__ */ H(
1557
+ }, [t]), /* @__PURE__ */ F(
1500
1558
  "label",
1501
1559
  {
1502
1560
  className: f(dt.root, t && dt.indeterminate, n?.root, r),
@@ -1519,13 +1577,13 @@ const Ic = "crk-root-61cKD", Ec = "crk-input-bAjPU", Pc = "crk-label-W9IeS", Wc
1519
1577
  );
1520
1578
  }
1521
1579
  );
1522
- Hc.displayName = "Checkbox";
1523
- const Oc = "crk-group-NNwCD", Fc = "crk-root-7fGik", jc = "crk-input-43PQW", Xc = "crk-label-aW30x", ht = {
1524
- group: Oc,
1525
- root: Fc,
1526
- input: jc,
1527
- label: Xc
1528
- }, Qt = jt(null), Uc = ({
1580
+ Fc.displayName = "Checkbox";
1581
+ const jc = "crk-group-NNwCD", Xc = "crk-root-7fGik", _c = "crk-input-43PQW", Uc = "crk-label-aW30x", ht = {
1582
+ group: jc,
1583
+ root: Xc,
1584
+ input: _c,
1585
+ label: Uc
1586
+ }, Jt = Xt(null), zc = ({
1529
1587
  name: e,
1530
1588
  value: t,
1531
1589
  onChange: n,
@@ -1536,7 +1594,7 @@ const Oc = "crk-group-NNwCD", Fc = "crk-root-7fGik", jc = "crk-input-43PQW", Xc
1536
1594
  "aria-label": l,
1537
1595
  "aria-labelledby": a,
1538
1596
  required: h
1539
- }) => /* @__PURE__ */ s(Qt.Provider, { value: { name: e, value: t, onChange: n }, children: /* @__PURE__ */ s(
1597
+ }) => /* @__PURE__ */ s(Jt.Provider, { value: { name: e, value: t, onChange: n }, children: /* @__PURE__ */ s(
1540
1598
  "div",
1541
1599
  {
1542
1600
  id: c,
@@ -1550,8 +1608,8 @@ const Oc = "crk-group-NNwCD", Fc = "crk-root-7fGik", jc = "crk-input-43PQW", Xc
1550
1608
  children: i
1551
1609
  }
1552
1610
  ) });
1553
- Uc.displayName = "RadioGroup";
1554
- const _c = $e(
1611
+ zc.displayName = "RadioGroup";
1612
+ const Yc = $e(
1555
1613
  ({
1556
1614
  label: e,
1557
1615
  value: t,
@@ -1563,10 +1621,10 @@ const _c = $e(
1563
1621
  name: l,
1564
1622
  ...a
1565
1623
  }, h) => {
1566
- const u = ft(Qt), d = u?.name ?? l, m = u ? u.value === t : c, p = (y) => {
1567
- u?.onChange?.(t), i?.(y);
1624
+ const u = ft(Jt), d = u?.name ?? l, m = u ? u.value === t : c, p = (x) => {
1625
+ u?.onChange?.(t), i?.(x);
1568
1626
  };
1569
- return /* @__PURE__ */ H("label", { className: f(ht.root, n?.root, r), style: o, children: [
1627
+ return /* @__PURE__ */ F("label", { className: f(ht.root, n?.root, r), style: o, children: [
1570
1628
  /* @__PURE__ */ s(
1571
1629
  "input",
1572
1630
  {
@@ -1584,24 +1642,24 @@ const _c = $e(
1584
1642
  ] });
1585
1643
  }
1586
1644
  );
1587
- _c.displayName = "Radio";
1588
- const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk-lg-Pd-Iq", Gc = "crk-error-fyu3i", Zc = "crk-resizeNone-SmNT4", Kc = "crk-resizeVertical-oi8vP", Qc = "crk-resizeHorizontal-riMLL", Jc = "crk-resizeBoth-NYSh4", ei = "crk-autoExpand-JWone", Ke = {
1589
- root: zc,
1590
- sm: Yc,
1591
- md: Vc,
1592
- lg: qc,
1593
- error: Gc,
1594
- resizeNone: Zc,
1595
- resizeVertical: Kc,
1596
- resizeHorizontal: Qc,
1597
- resizeBoth: Jc,
1598
- autoExpand: ei
1599
- }, ti = {
1645
+ Yc.displayName = "Radio";
1646
+ const Vc = "crk-root-IGgdn", qc = "crk-sm-N-5I2", Gc = "crk-md-bbyFl", Zc = "crk-lg-Pd-Iq", Kc = "crk-error-fyu3i", Qc = "crk-resizeNone-SmNT4", Jc = "crk-resizeVertical-oi8vP", ei = "crk-resizeHorizontal-riMLL", ti = "crk-resizeBoth-NYSh4", ni = "crk-autoExpand-JWone", Ke = {
1647
+ root: Vc,
1648
+ sm: qc,
1649
+ md: Gc,
1650
+ lg: Zc,
1651
+ error: Kc,
1652
+ resizeNone: Qc,
1653
+ resizeVertical: Jc,
1654
+ resizeHorizontal: ei,
1655
+ resizeBoth: ti,
1656
+ autoExpand: ni
1657
+ }, ri = {
1600
1658
  none: "resizeNone",
1601
1659
  vertical: "resizeVertical",
1602
1660
  horizontal: "resizeHorizontal",
1603
1661
  both: "resizeBoth"
1604
- }, ni = $e(
1662
+ }, oi = $e(
1605
1663
  ({
1606
1664
  inputSize: e = "md",
1607
1665
  error: t = !1,
@@ -1612,14 +1670,14 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
1612
1670
  onChange: c,
1613
1671
  ...l
1614
1672
  }, a) => {
1615
- const h = te(null), u = he(() => {
1673
+ const h = ne(null), u = de(() => {
1616
1674
  const p = h.current;
1617
1675
  p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1618
1676
  }, []), d = l.value ?? "";
1619
1677
  Be(() => {
1620
1678
  r && u();
1621
1679
  }, [r, u, d]);
1622
- const m = he(
1680
+ const m = de(
1623
1681
  (p) => {
1624
1682
  r && u(), c?.(p);
1625
1683
  },
@@ -1635,7 +1693,7 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
1635
1693
  Ke.root,
1636
1694
  Ke[e],
1637
1695
  t && Ke.error,
1638
- r ? Ke.autoExpand : Ke[ti[n]],
1696
+ r ? Ke.autoExpand : Ke[ri[n]],
1639
1697
  o
1640
1698
  ),
1641
1699
  style: i,
@@ -1646,9 +1704,9 @@ const zc = "crk-root-IGgdn", Yc = "crk-sm-N-5I2", Vc = "crk-md-bbyFl", qc = "crk
1646
1704
  );
1647
1705
  }
1648
1706
  );
1649
- ni.displayName = "Textarea";
1650
- function ri(e, t = { width: 600, height: 300 }) {
1651
- const [n, r] = Se(t), o = te(t);
1707
+ oi.displayName = "Textarea";
1708
+ function ci(e, t = { width: 600, height: 300 }) {
1709
+ const [n, r] = Se(t), o = ne(t);
1652
1710
  return Be(() => {
1653
1711
  const i = e.current;
1654
1712
  if (!i || typeof ResizeObserver > "u") return;
@@ -1666,52 +1724,52 @@ function ri(e, t = { width: 600, height: 300 }) {
1666
1724
  return a.observe(i), () => a.disconnect();
1667
1725
  }, [e]), n;
1668
1726
  }
1669
- const oi = "crk-root-uMSq0", ci = "crk-canvas-zhFr0", ii = "crk-svg-waPLB", li = "crk-gridLine-K2Gx9", si = "crk-axis-Zum8-", ai = "crk-axisLabel-Ilv3u", di = "crk-cursorLine-iNHim", ui = "crk-linePath-E4eYA", hi = "crk-areaPath-ZwMc6", mi = "crk-point-DTAoa", fi = "crk-bar-9sYbq", pi = "crk-barLabelInside-dlQh5", gi = "crk-activeBar-FJhPJ", yi = "crk-interactionLayer-dHNAG", vi = "crk-legend-JL6YI", bi = "crk-legendItem-rcdvO", xi = "crk-legendSwatch-eJBsF", ki = "crk-legendIcon-6gzcO", Mi = "crk-legendLabel-C-eu3", wi = "crk-tooltip-m55-N", $i = "crk-tooltipTitle-0EfoX", Ni = "crk-tooltipRows-MC0wM", Li = "crk-tooltipRow-ZQomr", Si = "crk-tooltipLabel-s4OKX", Ti = "crk-tooltipValue-iwj1s", Ri = "crk-empty-aa4vk", Ci = "crk-sparkline-3-eRc", Ai = "crk-tradingHeader-Pb9wS", x = {
1670
- root: oi,
1671
- canvas: ci,
1672
- svg: ii,
1673
- gridLine: li,
1674
- axis: si,
1675
- axisLabel: ai,
1676
- cursorLine: di,
1677
- linePath: ui,
1678
- areaPath: hi,
1679
- point: mi,
1680
- bar: fi,
1681
- barLabelInside: pi,
1682
- activeBar: gi,
1683
- interactionLayer: yi,
1684
- legend: vi,
1685
- legendItem: bi,
1686
- legendSwatch: xi,
1687
- legendIcon: ki,
1688
- legendLabel: Mi,
1689
- tooltip: wi,
1690
- tooltipTitle: $i,
1691
- tooltipRows: Ni,
1692
- tooltipRow: Li,
1693
- tooltipLabel: Si,
1694
- tooltipValue: Ti,
1695
- empty: Ri,
1696
- sparkline: Ci,
1697
- tradingHeader: Ai
1727
+ const ii = "crk-root-uMSq0", li = "crk-canvas-zhFr0", si = "crk-svg-waPLB", ai = "crk-gridLine-K2Gx9", di = "crk-axis-Zum8-", ui = "crk-axisLabel-Ilv3u", hi = "crk-cursorLine-iNHim", mi = "crk-linePath-E4eYA", fi = "crk-areaPath-ZwMc6", pi = "crk-point-DTAoa", gi = "crk-bar-9sYbq", yi = "crk-barLabelInside-dlQh5", vi = "crk-activeBar-FJhPJ", bi = "crk-interactionLayer-dHNAG", xi = "crk-legend-JL6YI", ki = "crk-legendItem-rcdvO", Mi = "crk-legendSwatch-eJBsF", wi = "crk-legendIcon-6gzcO", $i = "crk-legendLabel-C-eu3", Ni = "crk-tooltip-m55-N", Li = "crk-tooltipTitle-0EfoX", Si = "crk-tooltipRows-MC0wM", Ti = "crk-tooltipRow-ZQomr", Ri = "crk-tooltipLabel-s4OKX", Ci = "crk-tooltipValue-iwj1s", Ai = "crk-empty-aa4vk", Bi = "crk-sparkline-3-eRc", Di = "crk-tradingHeader-Pb9wS", k = {
1728
+ root: ii,
1729
+ canvas: li,
1730
+ svg: si,
1731
+ gridLine: ai,
1732
+ axis: di,
1733
+ axisLabel: ui,
1734
+ cursorLine: hi,
1735
+ linePath: mi,
1736
+ areaPath: fi,
1737
+ point: pi,
1738
+ bar: gi,
1739
+ barLabelInside: yi,
1740
+ activeBar: vi,
1741
+ interactionLayer: bi,
1742
+ legend: xi,
1743
+ legendItem: ki,
1744
+ legendSwatch: Mi,
1745
+ legendIcon: wi,
1746
+ legendLabel: $i,
1747
+ tooltip: Ni,
1748
+ tooltipTitle: Li,
1749
+ tooltipRows: Si,
1750
+ tooltipRow: Ti,
1751
+ tooltipLabel: Ri,
1752
+ tooltipValue: Ci,
1753
+ empty: Ai,
1754
+ sparkline: Bi,
1755
+ tradingHeader: Di
1698
1756
  }, Ve = $e(
1699
1757
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: i, overlay: c, children: l }, a) => {
1700
- const h = te(null);
1701
- sn(a, () => h.current);
1702
- const { width: u } = ri(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
1703
- return /* @__PURE__ */ H(
1758
+ const h = ne(null);
1759
+ an(a, () => h.current);
1760
+ const { width: u } = ci(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
1761
+ return /* @__PURE__ */ F(
1704
1762
  "div",
1705
1763
  {
1706
1764
  ref: h,
1707
- className: f(x.root, o?.root, n),
1765
+ className: f(k.root, o?.root, n),
1708
1766
  style: r,
1709
1767
  children: [
1710
- /* @__PURE__ */ H("div", { className: x.canvas, style: { height: m || void 0 }, children: [
1768
+ /* @__PURE__ */ F("div", { className: k.canvas, style: { height: m || void 0 }, children: [
1711
1769
  d > 0 && m > 0 && /* @__PURE__ */ s(
1712
1770
  "svg",
1713
1771
  {
1714
- className: f(x.svg, o?.svg),
1772
+ className: f(k.svg, o?.svg),
1715
1773
  width: d,
1716
1774
  height: m,
1717
1775
  viewBox: `0 0 ${d} ${m}`,
@@ -1730,13 +1788,13 @@ const oi = "crk-root-uMSq0", ci = "crk-canvas-zhFr0", ii = "crk-svg-waPLB", li =
1730
1788
  Ve.displayName = "ChartContainer";
1731
1789
  function vt({ config: e, order: t, classes: n }) {
1732
1790
  const r = t ?? Object.keys(e);
1733
- return /* @__PURE__ */ s("div", { className: f(x.legend, n?.legend), role: "list", children: r.map((o) => {
1791
+ return /* @__PURE__ */ s("div", { className: f(k.legend, n?.legend), role: "list", children: r.map((o) => {
1734
1792
  const i = e[o];
1735
- return i ? /* @__PURE__ */ H("div", { className: f(x.legendItem, n?.legendItem), role: "listitem", children: [
1793
+ return i ? /* @__PURE__ */ F("div", { className: f(k.legendItem, n?.legendItem), role: "listitem", children: [
1736
1794
  i.icon ? /* @__PURE__ */ s(
1737
1795
  "span",
1738
1796
  {
1739
- className: x.legendIcon,
1797
+ className: k.legendIcon,
1740
1798
  style: { color: i.color },
1741
1799
  "aria-hidden": "true",
1742
1800
  children: i.icon
@@ -1744,12 +1802,12 @@ function vt({ config: e, order: t, classes: n }) {
1744
1802
  ) : /* @__PURE__ */ s(
1745
1803
  "span",
1746
1804
  {
1747
- className: x.legendSwatch,
1805
+ className: k.legendSwatch,
1748
1806
  style: { background: i.color },
1749
1807
  "aria-hidden": "true"
1750
1808
  }
1751
1809
  ),
1752
- /* @__PURE__ */ s("span", { className: x.legendLabel, children: i.label })
1810
+ /* @__PURE__ */ s("span", { className: k.legendLabel, children: i.label })
1753
1811
  ] }, o) : null;
1754
1812
  }) });
1755
1813
  }
@@ -1770,31 +1828,31 @@ function et({
1770
1828
  return /* @__PURE__ */ s(
1771
1829
  "div",
1772
1830
  {
1773
- className: f(x.tooltip, h?.tooltip),
1831
+ className: f(k.tooltip, h?.tooltip),
1774
1832
  style: { left: m, top: p, width: u },
1775
1833
  role: "tooltip",
1776
- children: i ? i(e) : /* @__PURE__ */ H(Ye, { children: [
1777
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: x.tooltipTitle, children: String(e[l]) }),
1778
- /* @__PURE__ */ s("div", { className: x.tooltipRows, children: Object.entries(o).map(([y, $]) => {
1779
- const k = e[y];
1780
- if (k == null) return null;
1781
- const R = typeof k == "number" ? c(k) : String(k), X = a?.(y) ?? $.color;
1782
- return /* @__PURE__ */ H("div", { className: x.tooltipRow, children: [
1783
- /* @__PURE__ */ s("span", { className: x.legendSwatch, style: { background: X }, "aria-hidden": "true" }),
1784
- /* @__PURE__ */ s("span", { className: x.tooltipLabel, children: $.label }),
1785
- /* @__PURE__ */ s("span", { className: x.tooltipValue, children: R })
1786
- ] }, y);
1834
+ children: i ? i(e) : /* @__PURE__ */ F(Xe, { children: [
1835
+ l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: k.tooltipTitle, children: String(e[l]) }),
1836
+ /* @__PURE__ */ s("div", { className: k.tooltipRows, children: Object.entries(o).map(([x, C]) => {
1837
+ const $ = e[x];
1838
+ if ($ == null) return null;
1839
+ const b = typeof $ == "number" ? c($) : String($), W = a?.(x) ?? C.color;
1840
+ return /* @__PURE__ */ F("div", { className: k.tooltipRow, children: [
1841
+ /* @__PURE__ */ s("span", { className: k.legendSwatch, style: { background: W }, "aria-hidden": "true" }),
1842
+ /* @__PURE__ */ s("span", { className: k.tooltipLabel, children: C.label }),
1843
+ /* @__PURE__ */ s("span", { className: k.tooltipValue, children: b })
1844
+ ] }, x);
1787
1845
  }) })
1788
1846
  ] })
1789
1847
  }
1790
1848
  );
1791
1849
  }
1792
- function Jt({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: i }) {
1793
- return /* @__PURE__ */ s("g", { className: f(x.axis, i?.axis), children: e.map(({ value: c, y: l }) => /* @__PURE__ */ H("g", { children: [
1850
+ function en({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: i }) {
1851
+ return /* @__PURE__ */ s("g", { className: f(k.axis, i?.axis), children: e.map(({ value: c, y: l }) => /* @__PURE__ */ F("g", { children: [
1794
1852
  o && /* @__PURE__ */ s(
1795
1853
  "line",
1796
1854
  {
1797
- className: f(x.gridLine, i?.grid),
1855
+ className: f(k.gridLine, i?.grid),
1798
1856
  x1: t,
1799
1857
  x2: t + n,
1800
1858
  y1: l,
@@ -1804,7 +1862,7 @@ function Jt({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1804
1862
  /* @__PURE__ */ s(
1805
1863
  "text",
1806
1864
  {
1807
- className: f(x.axisLabel, i?.axisLabel),
1865
+ className: f(k.axisLabel, i?.axisLabel),
1808
1866
  x: t - 8,
1809
1867
  y: l,
1810
1868
  textAnchor: "end",
@@ -1814,11 +1872,11 @@ function Jt({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1814
1872
  )
1815
1873
  ] }, `y-${c}`)) });
1816
1874
  }
1817
- function en({ ticks: e, y: t, format: n, classes: r }) {
1818
- return /* @__PURE__ */ s("g", { className: f(x.axis, r?.axis), children: e.map(({ label: o, x: i }) => /* @__PURE__ */ s(
1875
+ function tn({ ticks: e, y: t, format: n, classes: r }) {
1876
+ return /* @__PURE__ */ s("g", { className: f(k.axis, r?.axis), children: e.map(({ label: o, x: i }) => /* @__PURE__ */ s(
1819
1877
  "text",
1820
1878
  {
1821
- className: f(x.axisLabel, r?.axisLabel),
1879
+ className: f(k.axisLabel, r?.axisLabel),
1822
1880
  x: i,
1823
1881
  y: t + 16,
1824
1882
  textAnchor: "middle",
@@ -1840,7 +1898,7 @@ function Je(e, t) {
1840
1898
  const [n, r] = e, [o, i] = t, c = r - n || 1, l = i - o, a = (h) => o + (h - n) / c * l;
1841
1899
  return a.invert = (h) => n + (h - o) / l * c, a;
1842
1900
  }
1843
- function Xe(e, t, n = 0.2) {
1901
+ function _e(e, t, n = 0.2) {
1844
1902
  const [r, o] = t, c = (o - r) / Math.max(1, e.length), l = c * (1 - n), a = /* @__PURE__ */ new Map();
1845
1903
  for (let u = 0; u < e.length; u++) a.set(e[u], u);
1846
1904
  const h = (u) => {
@@ -1860,8 +1918,8 @@ function qe(e, t, n = 5) {
1860
1918
  u.push(Number(d.toFixed(10)));
1861
1919
  return u;
1862
1920
  }
1863
- const Bi = { top: 12, right: 16, bottom: 28, left: 48 };
1864
- function Di(e, t) {
1921
+ const Ii = { top: 12, right: 16, bottom: 28, left: 48 };
1922
+ function Ei(e, t) {
1865
1923
  if (e.length === 0) return "";
1866
1924
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
1867
1925
  if (t === "linear")
@@ -1879,12 +1937,12 @@ function Di(e, t) {
1879
1937
  }
1880
1938
  return n;
1881
1939
  }
1882
- function Ii(e, t = 8) {
1940
+ function Pi(e, t = 8) {
1883
1941
  if (e.length <= t) return e;
1884
1942
  const n = Math.ceil(e.length / t);
1885
1943
  return e.filter((r, o) => o % n === 0);
1886
1944
  }
1887
- function El({
1945
+ function Hl({
1888
1946
  data: e,
1889
1947
  xKey: t,
1890
1948
  config: n,
@@ -1899,176 +1957,176 @@ function El({
1899
1957
  renderLabel: d,
1900
1958
  activeIndex: m,
1901
1959
  onPointClick: p,
1902
- showGrid: y = !0,
1903
- showLegend: $ = !0,
1904
- showTooltip: k = !0,
1905
- yTickCount: R = 5,
1906
- yFormat: X,
1907
- xFormat: E,
1908
- valueFormat: W,
1909
- renderTooltip: ae,
1910
- margin: _,
1911
- emptyMessage: C = "No data",
1912
- className: oe,
1913
- style: le,
1914
- classes: w
1960
+ showGrid: x = !0,
1961
+ showLegend: C = !0,
1962
+ showTooltip: $ = !0,
1963
+ yTickCount: b = 5,
1964
+ yFormat: W,
1965
+ xFormat: X,
1966
+ valueFormat: Y,
1967
+ renderTooltip: Q,
1968
+ margin: D,
1969
+ emptyMessage: S = "No data",
1970
+ className: ee,
1971
+ style: re,
1972
+ classes: M
1915
1973
  }) {
1916
- const q = { ...Bi, ..._ }, D = ke(() => Object.keys(n), [n]), [Q, O] = Se(null), P = te(null), ee = m ?? Q, ne = (v, M) => {
1974
+ const G = { ...Ii, ...D }, O = ke(() => Object.keys(n), [n]), [te, j] = Se(null), U = ne(null), J = m ?? te, oe = (w, B) => {
1917
1975
  if (l) {
1918
- const N = e[M]?.[l];
1976
+ const N = e[B]?.[l];
1919
1977
  if (typeof N == "string") return N;
1920
1978
  }
1921
- return n[v]?.color ?? "var(--crk-chart-1)";
1979
+ return n[w]?.color ?? "var(--crk-chart-1)";
1922
1980
  };
1923
1981
  if (e.length === 0)
1924
- return /* @__PURE__ */ s("div", { ref: P, className: f(x.root, w?.root, oe), style: le, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: C }) }) });
1925
- const L = k && ee !== null ? /* @__PURE__ */ s(
1982
+ return /* @__PURE__ */ s("div", { ref: U, className: f(k.root, M?.root, ee), style: re, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: S }) }) });
1983
+ const he = $ && J !== null ? /* @__PURE__ */ s(
1926
1984
  et,
1927
1985
  {
1928
- row: e[ee],
1929
- x: Ei(e, t, q, ee, P),
1986
+ row: e[J],
1987
+ x: Wi(e, t, G, J, U),
1930
1988
  y: 16,
1931
- containerWidth: P.current?.getBoundingClientRect().width ?? 0,
1989
+ containerWidth: U.current?.getBoundingClientRect().width ?? 0,
1932
1990
  config: n,
1933
- render: ae ? () => ae(e[ee]) : void 0,
1934
- valueFormat: W,
1991
+ render: Q ? () => Q(e[J]) : void 0,
1992
+ valueFormat: Y,
1935
1993
  titleKey: t,
1936
- resolveColor: l ? (v) => ne(v, ee) : void 0,
1937
- classes: w
1994
+ resolveColor: l ? (w) => oe(w, J) : void 0,
1995
+ classes: M
1938
1996
  }
1939
1997
  ) : null;
1940
1998
  return /* @__PURE__ */ s(
1941
1999
  Ve,
1942
2000
  {
1943
- ref: P,
2001
+ ref: U,
1944
2002
  aspectRatio: r,
1945
2003
  height: o,
1946
- className: oe,
1947
- style: le,
1948
- classes: w,
1949
- legend: $ ? /* @__PURE__ */ s(vt, { config: n, classes: w }) : void 0,
1950
- overlay: L,
1951
- children: ({ width: v, height: M }) => {
1952
- const N = q.left, z = v - q.right, S = q.top, F = M - q.bottom, Y = Math.max(0, z - N), G = Math.max(0, F - S), Z = e.map((g) => String(g[t])), U = Xe(Z, [N, z], 0), J = [];
1953
- for (const g of D)
1954
- for (const b of e) {
1955
- const K = b[g];
1956
- typeof K == "number" && J.push(K);
2004
+ className: ee,
2005
+ style: re,
2006
+ classes: M,
2007
+ legend: C ? /* @__PURE__ */ s(vt, { config: n, classes: M }) : void 0,
2008
+ overlay: he,
2009
+ children: ({ width: w, height: B }) => {
2010
+ const N = G.left, z = w - G.right, T = G.top, _ = B - G.bottom, y = Math.max(0, z - N), L = Math.max(0, _ - T), A = e.map((g) => String(g[t])), H = _e(A, [N, z], 0), Z = [];
2011
+ for (const g of O)
2012
+ for (const v of e) {
2013
+ const K = v[g];
2014
+ typeof K == "number" && Z.push(K);
1957
2015
  }
1958
- const [ue, be] = bt(J), pe = Math.min(0, ue), fe = qe(pe, be, R), ge = Je([fe[0], fe[fe.length - 1]], [F, S]), ve = fe.map((g) => ({ value: g, y: ge(g) })), Ne = Ii(Z).map((g) => ({ label: g, x: U(g) }));
1959
- return /* @__PURE__ */ H(Ye, { children: [
2016
+ const [ue, be] = bt(Z), pe = Math.min(0, ue), fe = qe(pe, be, b), ge = Je([fe[0], fe[fe.length - 1]], [_, T]), ve = fe.map((g) => ({ value: g, y: ge(g) })), Ne = Pi(A).map((g) => ({ label: g, x: H(g) }));
2017
+ return /* @__PURE__ */ F(Xe, { children: [
1960
2018
  /* @__PURE__ */ s(
1961
- Jt,
2019
+ en,
1962
2020
  {
1963
2021
  ticks: ve,
1964
2022
  x: N,
1965
- plotWidth: Y,
1966
- format: X,
1967
- showGrid: y,
1968
- classes: w
2023
+ plotWidth: y,
2024
+ format: W,
2025
+ showGrid: x,
2026
+ classes: M
1969
2027
  }
1970
2028
  ),
1971
- /* @__PURE__ */ s(en, { ticks: Ne, y: F, format: E, classes: w }),
1972
- D.map((g) => {
1973
- const b = n[g], K = e.map((B, j) => {
1974
- const A = B[g], de = typeof A == "number" ? A : 0;
1975
- return { x: U(Z[j]), y: ge(de), value: de, row: B };
2029
+ /* @__PURE__ */ s(tn, { ticks: Ne, y: _, format: X, classes: M }),
2030
+ O.map((g) => {
2031
+ const v = n[g], K = e.map((E, V) => {
2032
+ const I = E[g], ae = typeof I == "number" ? I : 0;
2033
+ return { x: H(A[V]), y: ge(ae), value: ae, row: E };
1976
2034
  });
1977
- return /* @__PURE__ */ H("g", { className: f(x.series, w?.series), children: [
2035
+ return /* @__PURE__ */ F("g", { className: f(k.series, M?.series), children: [
1978
2036
  /* @__PURE__ */ s(
1979
2037
  "path",
1980
2038
  {
1981
- className: f(x.linePath),
1982
- d: Di(K, i),
1983
- stroke: b.color
2039
+ className: f(k.linePath),
2040
+ d: Ei(K, i),
2041
+ stroke: v.color
1984
2042
  }
1985
2043
  ),
1986
- c && K.map((B, j) => {
1987
- const A = ne(g, j), de = ee === j, V = m !== void 0 && !de, T = p ? () => p({ row: B.row, value: B.value, seriesKey: g, index: j }) : void 0;
2044
+ c && K.map((E, V) => {
2045
+ const I = oe(g, V), ae = J === V, q = m !== void 0 && !ae, R = p ? () => p({ row: E.row, value: E.value, seriesKey: g, index: V }) : void 0;
1988
2046
  return a ? /* @__PURE__ */ s(
1989
2047
  "g",
1990
2048
  {
1991
- onClick: T,
1992
- style: T ? { cursor: "pointer" } : void 0,
1993
- opacity: V ? 0.45 : 1,
2049
+ onClick: R,
2050
+ style: R ? { cursor: "pointer" } : void 0,
2051
+ opacity: q ? 0.45 : 1,
1994
2052
  children: a({
1995
- row: B.row,
1996
- value: B.value,
2053
+ row: E.row,
2054
+ value: E.value,
1997
2055
  seriesKey: g,
1998
- index: j,
1999
- x: B.x,
2000
- y: B.y,
2001
- color: A,
2002
- active: de
2056
+ index: V,
2057
+ x: E.x,
2058
+ y: E.y,
2059
+ color: I,
2060
+ active: ae
2003
2061
  })
2004
2062
  },
2005
- `${g}-${j}`
2063
+ `${g}-${V}`
2006
2064
  ) : /* @__PURE__ */ s(
2007
2065
  "circle",
2008
2066
  {
2009
- className: f(x.point, w?.point),
2010
- cx: B.x,
2011
- cy: B.y,
2012
- r: de ? 5 : 3.5,
2013
- fill: A,
2014
- onClick: T,
2015
- style: T ? { cursor: "pointer" } : void 0,
2016
- opacity: V ? 0.45 : 1
2067
+ className: f(k.point, M?.point),
2068
+ cx: E.x,
2069
+ cy: E.y,
2070
+ r: ae ? 5 : 3.5,
2071
+ fill: I,
2072
+ onClick: R,
2073
+ style: R ? { cursor: "pointer" } : void 0,
2074
+ opacity: q ? 0.45 : 1
2017
2075
  },
2018
- `${g}-${j}`
2076
+ `${g}-${V}`
2019
2077
  );
2020
2078
  }),
2021
- (h || d) && K.map((B, j) => {
2022
- const A = d ? d({ row: B.row, value: B.value, seriesKey: g, index: j }) : h ? W ? W(B.value) : String(B.value) : null;
2023
- if (A == null) return null;
2024
- const de = 10, V = u === "top" ? B.y - de : B.y + de + 4;
2079
+ (h || d) && K.map((E, V) => {
2080
+ const I = d ? d({ row: E.row, value: E.value, seriesKey: g, index: V }) : h ? Y ? Y(E.value) : String(E.value) : null;
2081
+ if (I == null) return null;
2082
+ const ae = 10, q = u === "top" ? E.y - ae : E.y + ae + 4;
2025
2083
  return /* @__PURE__ */ s(
2026
2084
  "text",
2027
2085
  {
2028
- className: f(x.axisLabel),
2029
- x: B.x,
2030
- y: V,
2086
+ className: f(k.axisLabel),
2087
+ x: E.x,
2088
+ y: q,
2031
2089
  textAnchor: "middle",
2032
2090
  dominantBaseline: u === "top" ? "auto" : "middle",
2033
- children: A
2091
+ children: I
2034
2092
  },
2035
- `label-${g}-${j}`
2093
+ `label-${g}-${V}`
2036
2094
  );
2037
2095
  })
2038
2096
  ] }, g);
2039
2097
  }),
2040
- ee !== null && /* @__PURE__ */ s(
2098
+ J !== null && /* @__PURE__ */ s(
2041
2099
  "line",
2042
2100
  {
2043
- className: x.cursorLine,
2044
- x1: U(Z[ee]),
2045
- x2: U(Z[ee]),
2046
- y1: S,
2047
- y2: F
2101
+ className: k.cursorLine,
2102
+ x1: H(A[J]),
2103
+ x2: H(A[J]),
2104
+ y1: T,
2105
+ y2: _
2048
2106
  }
2049
2107
  ),
2050
2108
  /* @__PURE__ */ s(
2051
2109
  "rect",
2052
2110
  {
2053
- className: x.interactionLayer,
2111
+ className: k.interactionLayer,
2054
2112
  x: N,
2055
- y: S,
2056
- width: Y,
2057
- height: G,
2113
+ y: T,
2114
+ width: y,
2115
+ height: L,
2058
2116
  onMouseMove: (g) => {
2059
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + N, B = U.step(), j = Math.max(
2117
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
2060
2118
  0,
2061
- Math.min(e.length - 1, Math.round((K - N - B / 2) / B))
2119
+ Math.min(e.length - 1, Math.round((K - N - E / 2) / E))
2062
2120
  );
2063
- O(j);
2121
+ j(V);
2064
2122
  },
2065
- onMouseLeave: () => O(null),
2123
+ onMouseLeave: () => j(null),
2066
2124
  onClick: p ? (g) => {
2067
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + N, B = U.step(), j = Math.max(
2125
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
2068
2126
  0,
2069
- Math.min(e.length - 1, Math.round((K - N - B / 2) / B))
2070
- ), A = D[0], de = e[j][A], V = typeof de == "number" ? de : 0;
2071
- p({ row: e[j], value: V, seriesKey: A, index: j });
2127
+ Math.min(e.length - 1, Math.round((K - N - E / 2) / E))
2128
+ ), I = O[0], ae = e[V][I], q = typeof ae == "number" ? ae : 0;
2129
+ p({ row: e[V], value: q, seriesKey: I, index: V });
2072
2130
  } : void 0,
2073
2131
  style: p ? { cursor: "pointer" } : void 0
2074
2132
  }
@@ -2078,13 +2136,13 @@ function El({
2078
2136
  }
2079
2137
  );
2080
2138
  }
2081
- function Ei(e, t, n, r, o) {
2139
+ function Wi(e, t, n, r, o) {
2082
2140
  const i = o.current;
2083
2141
  if (!i) return 0;
2084
2142
  const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2085
- return Xe(l, [n.left, c - n.right], 0)(l[r]);
2143
+ return _e(l, [n.left, c - n.right], 0)(l[r]);
2086
2144
  }
2087
- const Pi = { top: 12, right: 16, bottom: 28, left: 48 };
2145
+ const Hi = { top: 12, right: 16, bottom: 28, left: 48 };
2088
2146
  function St(e, t) {
2089
2147
  if (e.length === 0) return "";
2090
2148
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
@@ -2113,12 +2171,12 @@ function Dt(e, t, n) {
2113
2171
  const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), c = St(o, n).replace(/^M /, "L ");
2114
2172
  return `${r} ${c} Z`;
2115
2173
  }
2116
- function Wi(e, t = 8) {
2174
+ function Oi(e, t = 8) {
2117
2175
  if (e.length <= t) return e;
2118
2176
  const n = Math.ceil(e.length / t);
2119
2177
  return e.filter((r, o) => o % n === 0);
2120
2178
  }
2121
- function Pl({
2179
+ function Ol({
2122
2180
  data: e,
2123
2181
  xKey: t,
2124
2182
  config: n,
@@ -2133,91 +2191,91 @@ function Pl({
2133
2191
  showYAxis: d = !0,
2134
2192
  showLegend: m = !0,
2135
2193
  showTooltip: p = !0,
2136
- yTickCount: y = 5,
2137
- yFormat: $,
2138
- xFormat: k,
2139
- valueFormat: R,
2140
- renderTooltip: X,
2141
- margin: E,
2142
- emptyMessage: W = "No data",
2143
- className: ae,
2144
- style: _,
2145
- classes: C
2194
+ yTickCount: x = 5,
2195
+ yFormat: C,
2196
+ xFormat: $,
2197
+ valueFormat: b,
2198
+ renderTooltip: W,
2199
+ margin: X,
2200
+ emptyMessage: Y = "No data",
2201
+ className: Q,
2202
+ style: D,
2203
+ classes: S
2146
2204
  }) {
2147
- const oe = ke(
2205
+ const ee = ke(
2148
2206
  () => ({
2149
- ...Pi,
2207
+ ...Hi,
2150
2208
  ...d ? {} : { left: 16 },
2151
- ...E
2209
+ ...X
2152
2210
  }),
2153
- [E, d]
2154
- ), le = ke(() => Object.keys(n), [n]), w = c && le.length > 0, q = w && l === "expand", [D, Q] = Se(null), O = te(null), P = ze();
2211
+ [X, d]
2212
+ ), re = ke(() => Object.keys(n), [n]), M = c && re.length > 0, G = M && l === "expand", [O, te] = Se(null), j = ne(null), U = Ye();
2155
2213
  if (e.length === 0)
2156
- return /* @__PURE__ */ s("div", { ref: O, className: f(x.root, C?.root, ae), style: _, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: W }) }) });
2157
- const ee = ke(() => {
2158
- const N = le.map(() => []), z = le.map(() => []);
2159
- for (let S = 0; S < e.length; S++) {
2160
- let F = 0;
2161
- if (q) {
2162
- for (const G of le) {
2163
- const Z = e[S][G];
2164
- typeof Z == "number" && Z > 0 && (F += Z);
2214
+ return /* @__PURE__ */ s("div", { ref: j, className: f(k.root, S?.root, Q), style: D, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: Y }) }) });
2215
+ const J = ke(() => {
2216
+ const N = re.map(() => []), z = re.map(() => []);
2217
+ for (let T = 0; T < e.length; T++) {
2218
+ let _ = 0;
2219
+ if (G) {
2220
+ for (const L of re) {
2221
+ const A = e[T][L];
2222
+ typeof A == "number" && A > 0 && (_ += A);
2165
2223
  }
2166
- F === 0 && (F = 1);
2224
+ _ === 0 && (_ = 1);
2167
2225
  }
2168
- let Y = 0;
2169
- for (let G = 0; G < le.length; G++) {
2170
- const Z = le[G], U = e[S][Z], J = typeof U == "number" ? U : 0;
2171
- if (w) {
2172
- const ue = q ? J / F : J;
2173
- z[G][S] = Y, Y += ue, N[G][S] = Y;
2226
+ let y = 0;
2227
+ for (let L = 0; L < re.length; L++) {
2228
+ const A = re[L], H = e[T][A], Z = typeof H == "number" ? H : 0;
2229
+ if (M) {
2230
+ const ue = G ? Z / _ : Z;
2231
+ z[L][T] = y, y += ue, N[L][T] = y;
2174
2232
  } else
2175
- z[G][S] = 0, N[G][S] = J;
2233
+ z[L][T] = 0, N[L][T] = Z;
2176
2234
  }
2177
2235
  }
2178
2236
  return { tops: N, bottoms: z };
2179
- }, [e, le, w, q]), { tops: ne, bottoms: L } = ee, [v, M] = ke(() => {
2180
- if (q) return [0, 1];
2237
+ }, [e, re, M, G]), { tops: oe, bottoms: he } = J, [w, B] = ke(() => {
2238
+ if (G) return [0, 1];
2181
2239
  let N = 0, z = 0;
2182
- for (const S of ne)
2183
- for (const F of S)
2184
- F < N && (N = F), F > z && (z = F);
2185
- for (const S of L)
2186
- for (const F of S)
2187
- F < N && (N = F);
2240
+ for (const T of oe)
2241
+ for (const _ of T)
2242
+ _ < N && (N = _), _ > z && (z = _);
2243
+ for (const T of he)
2244
+ for (const _ of T)
2245
+ _ < N && (N = _);
2188
2246
  return [Math.min(0, N), z];
2189
- }, [ne, L, q]);
2247
+ }, [oe, he, G]);
2190
2248
  return /* @__PURE__ */ s(
2191
2249
  Ve,
2192
2250
  {
2193
- ref: O,
2251
+ ref: j,
2194
2252
  aspectRatio: r,
2195
2253
  height: o,
2196
- className: ae,
2197
- style: _,
2198
- classes: C,
2199
- legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: C }) : void 0,
2200
- overlay: p && D !== null ? /* @__PURE__ */ s(
2254
+ className: Q,
2255
+ style: D,
2256
+ classes: S,
2257
+ legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
2258
+ overlay: p && O !== null ? /* @__PURE__ */ s(
2201
2259
  et,
2202
2260
  {
2203
- row: e[D],
2204
- x: Hi(e, t, oe, D, O),
2261
+ row: e[O],
2262
+ x: Fi(e, t, ee, O, j),
2205
2263
  y: 16,
2206
- containerWidth: O.current?.getBoundingClientRect().width ?? 0,
2264
+ containerWidth: j.current?.getBoundingClientRect().width ?? 0,
2207
2265
  config: n,
2208
- render: X ? () => X(e[D]) : void 0,
2209
- valueFormat: q ? (N) => `${Math.round(N * 100)}%` : R,
2266
+ render: W ? () => W(e[O]) : void 0,
2267
+ valueFormat: G ? (N) => `${Math.round(N * 100)}%` : b,
2210
2268
  titleKey: t,
2211
- classes: C
2269
+ classes: S
2212
2270
  }
2213
2271
  ) : null,
2214
2272
  children: ({ width: N, height: z }) => {
2215
- const S = oe.left, F = N - oe.right, Y = oe.top, G = z - oe.bottom, Z = Math.max(0, F - S), U = Math.max(0, G - Y), J = e.map((g) => String(g[t])), ue = Xe(J, [S, F], 0), be = q ? [0, 0.25, 0.5, 0.75, 1] : qe(v, M, y), pe = Je([be[0], be[be.length - 1]], [G, Y]), fe = pe(0), ge = be.map((g) => ({ value: g, y: pe(g) })), Re = Wi(J).map((g) => ({ label: g, x: ue(g) })), Ne = q ? (g) => `${Math.round(g * 100)}%` : $;
2216
- return /* @__PURE__ */ H(Ye, { children: [
2217
- a && /* @__PURE__ */ s("defs", { children: le.map((g) => /* @__PURE__ */ H(
2273
+ const T = ee.left, _ = N - ee.right, y = ee.top, L = z - ee.bottom, A = Math.max(0, _ - T), H = Math.max(0, L - y), Z = e.map((g) => String(g[t])), ue = _e(Z, [T, _], 0), be = G ? [0, 0.25, 0.5, 0.75, 1] : qe(w, B, x), pe = Je([be[0], be[be.length - 1]], [L, y]), fe = pe(0), ge = be.map((g) => ({ value: g, y: pe(g) })), Re = Oi(Z).map((g) => ({ label: g, x: ue(g) })), Ne = G ? (g) => `${Math.round(g * 100)}%` : C;
2274
+ return /* @__PURE__ */ F(Xe, { children: [
2275
+ a && /* @__PURE__ */ s("defs", { children: re.map((g) => /* @__PURE__ */ F(
2218
2276
  "linearGradient",
2219
2277
  {
2220
- id: `${P}-${g}`,
2278
+ id: `${U}-${g}`,
2221
2279
  x1: "0",
2222
2280
  y1: "0",
2223
2281
  x2: "0",
@@ -2230,79 +2288,79 @@ function Pl({
2230
2288
  g
2231
2289
  )) }),
2232
2290
  d ? /* @__PURE__ */ s(
2233
- Jt,
2291
+ en,
2234
2292
  {
2235
2293
  ticks: ge,
2236
- x: S,
2237
- plotWidth: Z,
2294
+ x: T,
2295
+ plotWidth: A,
2238
2296
  format: Ne,
2239
2297
  showGrid: h,
2240
- classes: C
2298
+ classes: S
2241
2299
  }
2242
- ) : h && /* @__PURE__ */ s("g", { className: f(x.axis, C?.axis), children: ge.map(({ value: g, y: b }) => /* @__PURE__ */ s(
2300
+ ) : h && /* @__PURE__ */ s("g", { className: f(k.axis, S?.axis), children: ge.map(({ value: g, y: v }) => /* @__PURE__ */ s(
2243
2301
  "line",
2244
2302
  {
2245
- className: f(x.gridLine, C?.grid),
2246
- x1: S,
2247
- x2: F,
2248
- y1: b,
2249
- y2: b
2303
+ className: f(k.gridLine, S?.grid),
2304
+ x1: T,
2305
+ x2: _,
2306
+ y1: v,
2307
+ y2: v
2250
2308
  },
2251
2309
  `grid-${g}`
2252
2310
  )) }),
2253
- u && /* @__PURE__ */ s(en, { ticks: Re, y: G, format: k, classes: C }),
2254
- le.map((g, b) => {
2255
- const K = n[g], B = e.map((V, T) => ({
2256
- x: ue(J[T]),
2257
- y: pe(ne[b][T])
2258
- })), j = a ? `url(#${P}-${g})` : K.color, A = a ? 1 : 0.18, de = w ? Dt(B, L[b].map((V) => pe(V)), i) : Dt(B, fe, i);
2259
- return /* @__PURE__ */ H("g", { className: f(x.series, C?.series), children: [
2311
+ u && /* @__PURE__ */ s(tn, { ticks: Re, y: L, format: $, classes: S }),
2312
+ re.map((g, v) => {
2313
+ const K = n[g], E = e.map((q, R) => ({
2314
+ x: ue(Z[R]),
2315
+ y: pe(oe[v][R])
2316
+ })), V = a ? `url(#${U}-${g})` : K.color, I = a ? 1 : 0.18, ae = M ? Dt(E, he[v].map((q) => pe(q)), i) : Dt(E, fe, i);
2317
+ return /* @__PURE__ */ F("g", { className: f(k.series, S?.series), children: [
2260
2318
  /* @__PURE__ */ s(
2261
2319
  "path",
2262
2320
  {
2263
- className: x.areaPath,
2264
- d: de,
2265
- fill: j,
2266
- fillOpacity: A
2321
+ className: k.areaPath,
2322
+ d: ae,
2323
+ fill: V,
2324
+ fillOpacity: I
2267
2325
  }
2268
2326
  ),
2269
- /* @__PURE__ */ s("path", { className: x.linePath, d: St(B, i), stroke: K.color }),
2270
- !w && B.map((V, T) => /* @__PURE__ */ s(
2327
+ /* @__PURE__ */ s("path", { className: k.linePath, d: St(E, i), stroke: K.color }),
2328
+ !M && E.map((q, R) => /* @__PURE__ */ s(
2271
2329
  "circle",
2272
2330
  {
2273
- className: f(x.point, C?.point),
2274
- cx: V.x,
2275
- cy: V.y,
2276
- r: D === T ? 5 : 3,
2331
+ className: f(k.point, S?.point),
2332
+ cx: q.x,
2333
+ cy: q.y,
2334
+ r: O === R ? 5 : 3,
2277
2335
  fill: K.color
2278
2336
  },
2279
- `${g}-${T}`
2337
+ `${g}-${R}`
2280
2338
  ))
2281
2339
  ] }, g);
2282
2340
  }),
2283
- D !== null && /* @__PURE__ */ s(
2341
+ O !== null && /* @__PURE__ */ s(
2284
2342
  "line",
2285
2343
  {
2286
- className: x.cursorLine,
2287
- x1: ue(J[D]),
2288
- x2: ue(J[D]),
2289
- y1: Y,
2290
- y2: G
2344
+ className: k.cursorLine,
2345
+ x1: ue(Z[O]),
2346
+ x2: ue(Z[O]),
2347
+ y1: y,
2348
+ y2: L
2291
2349
  }
2292
2350
  ),
2293
2351
  /* @__PURE__ */ s(
2294
2352
  "rect",
2295
2353
  {
2296
- className: x.interactionLayer,
2297
- x: S,
2298
- y: Y,
2299
- width: Z,
2300
- height: U,
2354
+ className: k.interactionLayer,
2355
+ x: T,
2356
+ y,
2357
+ width: A,
2358
+ height: H,
2301
2359
  onMouseMove: (g) => {
2302
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + S, B = ue.step(), j = Math.max(0, Math.min(e.length - 1, Math.round((K - S - B / 2) / B)));
2303
- Q(j);
2360
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + T, E = ue.step(), V = Math.max(0, Math.min(e.length - 1, Math.round((K - T - E / 2) / E)));
2361
+ te(V);
2304
2362
  },
2305
- onMouseLeave: () => Q(null)
2363
+ onMouseLeave: () => te(null)
2306
2364
  }
2307
2365
  )
2308
2366
  ] });
@@ -2310,25 +2368,25 @@ function Pl({
2310
2368
  }
2311
2369
  );
2312
2370
  }
2313
- function Hi(e, t, n, r, o) {
2371
+ function Fi(e, t, n, r, o) {
2314
2372
  const i = o.current;
2315
2373
  if (!i) return 0;
2316
2374
  const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2317
- return Xe(l, [n.left, c - n.right], 0)(l[r]);
2375
+ return _e(l, [n.left, c - n.right], 0)(l[r]);
2318
2376
  }
2319
- const Oi = [
2377
+ const ji = [
2320
2378
  "var(--crk-chart-1)",
2321
2379
  "var(--crk-chart-2)",
2322
2380
  "var(--crk-chart-3)",
2323
2381
  "var(--crk-chart-4)",
2324
2382
  "var(--crk-chart-5)"
2325
- ], Fi = { top: 12, right: 16, bottom: 28, left: 48 }, ji = { top: 12, right: 16, bottom: 28, left: 72 };
2326
- function Xi(e, t = 8) {
2383
+ ], Xi = { top: 12, right: 16, bottom: 28, left: 48 }, _i = { top: 12, right: 16, bottom: 28, left: 72 };
2384
+ function Ui(e, t = 8) {
2327
2385
  if (e.length <= t) return e;
2328
2386
  const n = Math.ceil(e.length / t);
2329
2387
  return e.filter((r, o) => o % n === 0);
2330
2388
  }
2331
- function Wl({
2389
+ function Fl({
2332
2390
  data: e,
2333
2391
  xKey: t,
2334
2392
  config: n,
@@ -2343,35 +2401,35 @@ function Wl({
2343
2401
  showLegend: d = !0,
2344
2402
  showTooltip: m = !0,
2345
2403
  showValues: p = !1,
2346
- valuePosition: y = "outside",
2347
- renderLabel: $,
2348
- colorBy: k = "series",
2349
- colors: R = Oi,
2350
- negativeColor: X,
2351
- activeIndex: E,
2352
- onBarClick: W,
2353
- yTickCount: ae = 5,
2354
- yFormat: _,
2355
- xFormat: C,
2356
- valueFormat: oe,
2357
- renderTooltip: le,
2358
- margin: w,
2359
- emptyMessage: q = "No data",
2360
- className: D,
2361
- style: Q,
2362
- classes: O
2404
+ valuePosition: x = "outside",
2405
+ renderLabel: C,
2406
+ colorBy: $ = "series",
2407
+ colors: b = ji,
2408
+ negativeColor: W,
2409
+ activeIndex: X,
2410
+ onBarClick: Y,
2411
+ yTickCount: Q = 5,
2412
+ yFormat: D,
2413
+ xFormat: S,
2414
+ valueFormat: ee,
2415
+ renderTooltip: re,
2416
+ margin: M,
2417
+ emptyMessage: G = "No data",
2418
+ className: O,
2419
+ style: te,
2420
+ classes: j
2363
2421
  }) {
2364
- const P = r === "horizontal", ee = { ...P ? ji : Fi, ...w }, ne = ke(() => Object.keys(n), [n]), L = o && ne.length > 1, [v, M] = Se(null), N = te(null);
2422
+ const U = r === "horizontal", J = { ...U ? _i : Xi, ...M }, oe = ke(() => Object.keys(n), [n]), he = o && oe.length > 1, [w, B] = Se(null), N = ne(null);
2365
2423
  if (e.length === 0)
2366
- return /* @__PURE__ */ s("div", { ref: N, className: f(x.root, O?.root, D), style: Q, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: q }) }) });
2367
- const z = e.map((ue) => String(ue[t])), S = E ?? v, F = ke(() => {
2368
- if (L) {
2424
+ return /* @__PURE__ */ s("div", { ref: N, className: f(k.root, j?.root, O), style: te, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: G }) }) });
2425
+ const z = e.map((ue) => String(ue[t])), T = X ?? w, _ = ke(() => {
2426
+ if (he) {
2369
2427
  let fe = 0, ge = 0;
2370
2428
  for (const ve of e) {
2371
2429
  let Re = 0, Ne = 0;
2372
- for (const g of ne) {
2373
- const b = ve[g];
2374
- typeof b == "number" && (b >= 0 ? Re += b : Ne += b);
2430
+ for (const g of oe) {
2431
+ const v = ve[g];
2432
+ typeof v == "number" && (v >= 0 ? Re += v : Ne += v);
2375
2433
  }
2376
2434
  Re > fe && (fe = Re), Ne < ge && (ge = Ne);
2377
2435
  }
@@ -2379,28 +2437,28 @@ function Wl({
2379
2437
  }
2380
2438
  const ue = [];
2381
2439
  for (const fe of e)
2382
- for (const ge of ne) {
2440
+ for (const ge of oe) {
2383
2441
  const ve = fe[ge];
2384
2442
  typeof ve == "number" && ue.push(ve);
2385
2443
  }
2386
2444
  const [be, pe] = bt(ue);
2387
2445
  return [Math.min(0, be), Math.max(0, pe)];
2388
- }, [e, ne, L]), Y = qe(F[0], F[1], ae), G = Y[0], Z = Y[Y.length - 1], U = (ue, be) => k === "index" ? R[be % R.length] : n[ue]?.color ?? R[0], J = m && S !== null && e[S] ? /* @__PURE__ */ s(
2446
+ }, [e, oe, he]), y = qe(_[0], _[1], Q), L = y[0], A = y[y.length - 1], H = (ue, be) => $ === "index" ? b[be % b.length] : n[ue]?.color ?? b[0], Z = m && T !== null && e[T] ? /* @__PURE__ */ s(
2389
2447
  et,
2390
2448
  {
2391
- row: e[S],
2392
- x: _i(e, t, ee, S, N, P, l),
2393
- y: P ? zi(e, t, ee, S, N, l) : 16,
2449
+ row: e[T],
2450
+ x: Yi(e, t, J, T, N, U, l),
2451
+ y: U ? Vi(e, t, J, T, N, l) : 16,
2394
2452
  containerWidth: N.current?.getBoundingClientRect().width ?? 0,
2395
2453
  config: n,
2396
- render: le ? () => le(e[S]) : void 0,
2397
- valueFormat: oe,
2454
+ render: re ? () => re(e[T]) : void 0,
2455
+ valueFormat: ee,
2398
2456
  titleKey: t,
2399
2457
  resolveColor: (ue) => {
2400
- const be = e[S][ue], pe = U(ue, S);
2401
- return typeof be != "number" ? pe : X !== void 0 && be < 0 ? X : pe;
2458
+ const be = e[T][ue], pe = H(ue, T);
2459
+ return typeof be != "number" ? pe : W !== void 0 && be < 0 ? W : pe;
2402
2460
  },
2403
- classes: O
2461
+ classes: j
2404
2462
  }
2405
2463
  ) : null;
2406
2464
  return /* @__PURE__ */ s(
@@ -2409,125 +2467,125 @@ function Wl({
2409
2467
  ref: N,
2410
2468
  aspectRatio: i,
2411
2469
  height: c,
2412
- className: D,
2413
- style: Q,
2414
- classes: O,
2415
- legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: O }) : void 0,
2416
- overlay: J,
2470
+ className: O,
2471
+ style: te,
2472
+ classes: j,
2473
+ legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: j }) : void 0,
2474
+ overlay: Z,
2417
2475
  children: ({ width: ue, height: be }) => {
2418
- const pe = ee.left, fe = ue - ee.right, ge = ee.top, ve = be - ee.bottom, Re = Math.max(0, fe - pe), Ne = Math.max(0, ve - ge), b = Xe(z, P ? [ge, ve] : [pe, fe], l), K = b.bandWidth(), j = Je([G, Z], P ? [pe, fe] : [ve, ge]), A = j(0), de = L ? 1 : Math.max(1, ne.length), V = K / de, T = V * (1 - a), ce = Y.map((re) => ({
2419
- value: re,
2420
- pos: j(re)
2421
- })), me = Xi(z);
2422
- return /* @__PURE__ */ H(Ye, { children: [
2423
- u && /* @__PURE__ */ s("g", { className: f(x.axis, O?.axis), children: ce.map(
2424
- ({ value: re, pos: se }) => P ? /* @__PURE__ */ s(
2476
+ const pe = J.left, fe = ue - J.right, ge = J.top, ve = be - J.bottom, Re = Math.max(0, fe - pe), Ne = Math.max(0, ve - ge), v = _e(z, U ? [ge, ve] : [pe, fe], l), K = v.bandWidth(), V = Je([L, A], U ? [pe, fe] : [ve, ge]), I = V(0), ae = he ? 1 : Math.max(1, oe.length), q = K / ae, R = q * (1 - a), ie = y.map((ce) => ({
2477
+ value: ce,
2478
+ pos: V(ce)
2479
+ })), me = Ui(z);
2480
+ return /* @__PURE__ */ F(Xe, { children: [
2481
+ u && /* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: ie.map(
2482
+ ({ value: ce, pos: se }) => U ? /* @__PURE__ */ s(
2425
2483
  "line",
2426
2484
  {
2427
- className: f(x.gridLine, O?.grid),
2485
+ className: f(k.gridLine, j?.grid),
2428
2486
  x1: se,
2429
2487
  x2: se,
2430
2488
  y1: ge,
2431
2489
  y2: ve
2432
2490
  },
2433
- `g-${re}`
2491
+ `g-${ce}`
2434
2492
  ) : /* @__PURE__ */ s(
2435
2493
  "line",
2436
2494
  {
2437
- className: f(x.gridLine, O?.grid),
2495
+ className: f(k.gridLine, j?.grid),
2438
2496
  x1: pe,
2439
2497
  x2: fe,
2440
2498
  y1: se,
2441
2499
  y2: se
2442
2500
  },
2443
- `g-${re}`
2501
+ `g-${ce}`
2444
2502
  )
2445
2503
  ) }),
2446
- /* @__PURE__ */ s("g", { className: f(x.axis, O?.axis), children: ce.map(({ value: re, pos: se }) => {
2447
- const Ce = _ ? _(re) : String(re);
2448
- return P ? /* @__PURE__ */ s(
2504
+ /* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: ie.map(({ value: ce, pos: se }) => {
2505
+ const Ce = D ? D(ce) : String(ce);
2506
+ return U ? /* @__PURE__ */ s(
2449
2507
  "text",
2450
2508
  {
2451
- className: f(x.axisLabel, O?.axisLabel),
2509
+ className: f(k.axisLabel, j?.axisLabel),
2452
2510
  x: se,
2453
2511
  y: ve + 16,
2454
2512
  textAnchor: "middle",
2455
2513
  children: Ce
2456
2514
  },
2457
- `vt-${re}`
2515
+ `vt-${ce}`
2458
2516
  ) : /* @__PURE__ */ s(
2459
2517
  "text",
2460
2518
  {
2461
- className: f(x.axisLabel, O?.axisLabel),
2519
+ className: f(k.axisLabel, j?.axisLabel),
2462
2520
  x: pe - 8,
2463
2521
  y: se,
2464
2522
  textAnchor: "end",
2465
2523
  dominantBaseline: "middle",
2466
2524
  children: Ce
2467
2525
  },
2468
- `vt-${re}`
2526
+ `vt-${ce}`
2469
2527
  );
2470
2528
  }) }),
2471
- /* @__PURE__ */ s("g", { className: f(x.axis, O?.axis), children: me.map((re) => {
2472
- const se = b(re), Ce = C ? C(re) : re;
2473
- return P ? /* @__PURE__ */ s(
2529
+ /* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: me.map((ce) => {
2530
+ const se = v(ce), Ce = S ? S(ce) : ce;
2531
+ return U ? /* @__PURE__ */ s(
2474
2532
  "text",
2475
2533
  {
2476
- className: f(x.axisLabel, O?.axisLabel),
2534
+ className: f(k.axisLabel, j?.axisLabel),
2477
2535
  x: pe - 8,
2478
2536
  y: se,
2479
2537
  textAnchor: "end",
2480
2538
  dominantBaseline: "middle",
2481
2539
  children: Ce
2482
2540
  },
2483
- `c-${re}`
2541
+ `c-${ce}`
2484
2542
  ) : /* @__PURE__ */ s(
2485
2543
  "text",
2486
2544
  {
2487
- className: f(x.axisLabel, O?.axisLabel),
2545
+ className: f(k.axisLabel, j?.axisLabel),
2488
2546
  x: se,
2489
2547
  y: ve + 16,
2490
2548
  textAnchor: "middle",
2491
2549
  children: Ce
2492
2550
  },
2493
- `c-${re}`
2551
+ `c-${ce}`
2494
2552
  );
2495
2553
  }) }),
2496
- e.map((re, se) => {
2497
- const Ie = b(z[se]) - K / 2;
2498
- let xe = 0, ie = 0;
2499
- return /* @__PURE__ */ s("g", { className: f(x.series, O?.series), children: ne.map((De, He) => {
2500
- const Ge = re[De];
2554
+ e.map((ce, se) => {
2555
+ const Ie = v(z[se]) - K / 2;
2556
+ let xe = 0, le = 0;
2557
+ return /* @__PURE__ */ s("g", { className: f(k.series, j?.series), children: oe.map((De, He) => {
2558
+ const Ge = ce[De];
2501
2559
  if (typeof Ge != "number") return null;
2502
- const Ee = Ge, xt = U(De, se), kt = X !== void 0 && Ee < 0 ? X : xt, Oe = E !== void 0 ? E === se : v === se, tt = E !== void 0 && !Oe;
2560
+ const Ee = Ge, xt = H(De, se), kt = W !== void 0 && Ee < 0 ? W : xt, Oe = X !== void 0 ? X === se : w === se, tt = X !== void 0 && !Oe;
2503
2561
  let nt, Ue;
2504
- L ? Ee >= 0 ? (nt = xe, Ue = xe + Ee, xe = Ue) : (nt = ie, Ue = ie + Ee, ie = Ue) : (nt = 0, Ue = Ee);
2505
- const rt = j(nt), ot = j(Ue), At = L ? (K - T) / 2 : He * V + (V - T) / 2;
2562
+ he ? Ee >= 0 ? (nt = xe, Ue = xe + Ee, xe = Ue) : (nt = le, Ue = le + Ee, le = Ue) : (nt = 0, Ue = Ee);
2563
+ const rt = V(nt), ot = V(Ue), At = he ? (K - R) / 2 : He * q + (q - R) / 2;
2506
2564
  let ct = 0, it = 0, lt = 0, st = 0;
2507
- if (P) {
2565
+ if (U) {
2508
2566
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2509
- ct = Ze, lt = wt - Ze, it = Ie + At, st = T;
2567
+ ct = Ze, lt = wt - Ze, it = Ie + At, st = R;
2510
2568
  } else {
2511
2569
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2512
- ct = Ie + At, lt = T, it = Ze, st = wt - Ze;
2570
+ ct = Ie + At, lt = R, it = Ze, st = wt - Ze;
2513
2571
  }
2514
- const Mt = $ ? $({ row: re, value: Ee, seriesKey: De, index: se }) : p ? oe ? oe(Ee) : String(Ee) : null, Fe = Ui({
2515
- isHorizontal: P,
2516
- valuePosition: y,
2572
+ const Mt = C ? C({ row: ce, value: Ee, seriesKey: De, index: se }) : p ? ee ? ee(Ee) : String(Ee) : null, Fe = zi({
2573
+ isHorizontal: U,
2574
+ valuePosition: x,
2517
2575
  x: ct,
2518
2576
  y: it,
2519
2577
  rectW: lt,
2520
2578
  rectH: st,
2521
2579
  value: Ee
2522
2580
  });
2523
- return /* @__PURE__ */ H("g", { children: [
2581
+ return /* @__PURE__ */ F("g", { children: [
2524
2582
  /* @__PURE__ */ s(
2525
2583
  "rect",
2526
2584
  {
2527
2585
  className: f(
2528
- x.bar,
2529
- Oe && x.activeBar,
2530
- O?.point
2586
+ k.bar,
2587
+ Oe && k.activeBar,
2588
+ j?.point
2531
2589
  ),
2532
2590
  x: ct,
2533
2591
  y: it,
@@ -2537,16 +2595,16 @@ function Wl({
2537
2595
  ry: h,
2538
2596
  fill: kt,
2539
2597
  opacity: tt ? 0.35 : 1,
2540
- onClick: W ? () => W({ row: re, value: Ee, seriesKey: De, index: se }) : void 0,
2541
- style: W ? { cursor: "pointer" } : void 0
2598
+ onClick: Y ? () => Y({ row: ce, value: Ee, seriesKey: De, index: se }) : void 0,
2599
+ style: Y ? { cursor: "pointer" } : void 0
2542
2600
  }
2543
2601
  ),
2544
2602
  Mt != null && /* @__PURE__ */ s(
2545
2603
  "text",
2546
2604
  {
2547
2605
  className: f(
2548
- x.axisLabel,
2549
- (y === "inside" || y === "inside-start") && x.barLabelInside
2606
+ k.axisLabel,
2607
+ (x === "inside" || x === "inside-start") && k.barLabelInside
2550
2608
  ),
2551
2609
  x: Fe.x,
2552
2610
  y: Fe.y,
@@ -2560,33 +2618,33 @@ function Wl({
2560
2618
  ] }, De);
2561
2619
  }) }, `group-${se}`);
2562
2620
  }),
2563
- G < 0 && Z > 0 && /* @__PURE__ */ s(
2621
+ L < 0 && A > 0 && /* @__PURE__ */ s(
2564
2622
  "line",
2565
2623
  {
2566
- className: f(x.gridLine),
2567
- x1: P ? A : pe,
2568
- x2: P ? A : fe,
2569
- y1: P ? ge : A,
2570
- y2: P ? ve : A,
2624
+ className: f(k.gridLine),
2625
+ x1: U ? I : pe,
2626
+ x2: U ? I : fe,
2627
+ y1: U ? ge : I,
2628
+ y2: U ? ve : I,
2571
2629
  opacity: 0.9
2572
2630
  }
2573
2631
  ),
2574
2632
  /* @__PURE__ */ s(
2575
2633
  "rect",
2576
2634
  {
2577
- className: x.interactionLayer,
2635
+ className: k.interactionLayer,
2578
2636
  x: pe,
2579
2637
  y: ge,
2580
2638
  width: Re,
2581
2639
  height: Ne,
2582
- onMouseMove: (re) => {
2583
- const se = re.currentTarget.getBoundingClientRect(), Ce = re.clientX - se.left + pe, Ie = re.clientY - se.top + ge, xe = b.step(), ie = P ? Ie - ge : Ce - pe, De = Math.max(
2640
+ onMouseMove: (ce) => {
2641
+ const se = ce.currentTarget.getBoundingClientRect(), Ce = ce.clientX - se.left + pe, Ie = ce.clientY - se.top + ge, xe = v.step(), le = U ? Ie - ge : Ce - pe, De = Math.max(
2584
2642
  0,
2585
- Math.min(e.length - 1, Math.round((ie - xe / 2) / xe))
2643
+ Math.min(e.length - 1, Math.round((le - xe / 2) / xe))
2586
2644
  );
2587
- M(De);
2645
+ B(De);
2588
2646
  },
2589
- onMouseLeave: () => M(null)
2647
+ onMouseLeave: () => B(null)
2590
2648
  }
2591
2649
  )
2592
2650
  ] });
@@ -2594,7 +2652,7 @@ function Wl({
2594
2652
  }
2595
2653
  );
2596
2654
  }
2597
- function Ui({
2655
+ function zi({
2598
2656
  isHorizontal: e,
2599
2657
  valuePosition: t,
2600
2658
  x: n,
@@ -2646,19 +2704,19 @@ function Ui({
2646
2704
  dominantBaseline: a ? "auto" : "middle"
2647
2705
  };
2648
2706
  }
2649
- function _i(e, t, n, r, o, i, c) {
2707
+ function Yi(e, t, n, r, o, i, c) {
2650
2708
  const l = o.current;
2651
2709
  if (!l) return 0;
2652
2710
  const a = l.getBoundingClientRect(), h = e.map((d) => String(d[t]));
2653
- return i ? a.width / 2 : Xe(h, [n.left, a.width - n.right], c)(h[r]);
2711
+ return i ? a.width / 2 : _e(h, [n.left, a.width - n.right], c)(h[r]);
2654
2712
  }
2655
- function zi(e, t, n, r, o, i) {
2713
+ function Vi(e, t, n, r, o, i) {
2656
2714
  const c = o.current;
2657
2715
  if (!c) return 16;
2658
2716
  const l = c.getBoundingClientRect(), a = e.map((u) => String(u[t]));
2659
- return Xe(a, [n.top, l.height - n.bottom], i)(a[r]);
2717
+ return _e(a, [n.top, l.height - n.bottom], i)(a[r]);
2660
2718
  }
2661
- const Yi = [
2719
+ const qi = [
2662
2720
  "var(--crk-chart-1)",
2663
2721
  "var(--crk-chart-2)",
2664
2722
  "var(--crk-chart-3)",
@@ -2670,7 +2728,7 @@ function It(e, t) {
2670
2728
  const n = /^([\d.]+)%$/.exec(e);
2671
2729
  return n ? parseFloat(n[1]) / 100 * t : parseFloat(e) || 0;
2672
2730
  }
2673
- function Vi(e, t, n, r, o, i) {
2731
+ function Gi(e, t, n, r, o, i) {
2674
2732
  if (Math.abs(i - o) >= 360 - 1e-6)
2675
2733
  return r > 0 ? [
2676
2734
  `M ${e + n} ${t}`,
@@ -2688,12 +2746,12 @@ function Vi(e, t, n, r, o, i) {
2688
2746
  ].join(" ");
2689
2747
  const c = (o - 90) * Math.PI / 180, l = (i - 90) * Math.PI / 180, a = i - o > 180 ? 1 : 0, h = e + n * Math.cos(c), u = t + n * Math.sin(c), d = e + n * Math.cos(l), m = t + n * Math.sin(l);
2690
2748
  if (r > 0) {
2691
- const p = e + r * Math.cos(l), y = t + r * Math.sin(l), $ = e + r * Math.cos(c), k = t + r * Math.sin(c);
2749
+ const p = e + r * Math.cos(l), x = t + r * Math.sin(l), C = e + r * Math.cos(c), $ = t + r * Math.sin(c);
2692
2750
  return [
2693
2751
  `M ${h} ${u}`,
2694
2752
  `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2695
- `L ${p} ${y}`,
2696
- `A ${r} ${r} 0 ${a} 0 ${$} ${k}`,
2753
+ `L ${p} ${x}`,
2754
+ `A ${r} ${r} 0 ${a} 0 ${C} ${$}`,
2697
2755
  "Z"
2698
2756
  ].join(" ");
2699
2757
  }
@@ -2708,12 +2766,12 @@ function Et(e, t, n, r, o) {
2708
2766
  const c = ((r + o) / 2 - 90) * Math.PI / 180;
2709
2767
  return { x: e + n * Math.cos(c), y: t + n * Math.sin(c) };
2710
2768
  }
2711
- function Hl({
2769
+ function jl({
2712
2770
  data: e,
2713
2771
  valueKey: t,
2714
2772
  nameKey: n,
2715
2773
  colorKey: r,
2716
- colors: o = Yi,
2774
+ colors: o = qi,
2717
2775
  aspectRatio: i = 1,
2718
2776
  height: c,
2719
2777
  innerRadius: l = 0,
@@ -2723,94 +2781,94 @@ function Hl({
2723
2781
  padAngle: d = 0,
2724
2782
  showLabels: m = !1,
2725
2783
  valuePosition: p = "outside",
2726
- showLabelLines: y = !0,
2727
- renderLabel: $,
2728
- centerLabel: k,
2729
- activeIndex: R,
2730
- onSliceClick: X,
2731
- showLegend: E = !0,
2732
- showTooltip: W = !0,
2733
- valueFormat: ae,
2734
- renderTooltip: _,
2735
- emptyMessage: C = "No data",
2736
- className: oe,
2737
- style: le,
2738
- classes: w
2784
+ showLabelLines: x = !0,
2785
+ renderLabel: C,
2786
+ centerLabel: $,
2787
+ activeIndex: b,
2788
+ onSliceClick: W,
2789
+ showLegend: X = !0,
2790
+ showTooltip: Y = !0,
2791
+ valueFormat: Q,
2792
+ renderTooltip: D,
2793
+ emptyMessage: S = "No data",
2794
+ className: ee,
2795
+ style: re,
2796
+ classes: M
2739
2797
  }) {
2740
- const [q, D] = Se(null), Q = te(null), O = R ?? q, P = (M) => {
2798
+ const [G, O] = Se(null), te = ne(null), j = b ?? G, U = (B) => {
2741
2799
  if (r) {
2742
- const N = e[M]?.[r];
2800
+ const N = e[B]?.[r];
2743
2801
  if (typeof N == "string") return N;
2744
2802
  }
2745
- return o[M % o.length];
2746
- }, ee = ke(() => {
2747
- let M = 0;
2803
+ return o[B % o.length];
2804
+ }, J = ke(() => {
2805
+ let B = 0;
2748
2806
  for (const N of e) {
2749
2807
  const z = N[t];
2750
- typeof z == "number" && z > 0 && (M += z);
2808
+ typeof z == "number" && z > 0 && (B += z);
2751
2809
  }
2752
- return M;
2810
+ return B;
2753
2811
  }, [e, t]);
2754
- if (e.length === 0 || ee === 0)
2755
- return /* @__PURE__ */ s("div", { ref: Q, className: f(x.root, w?.root, oe), style: le, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: C }) }) });
2756
- const ne = ke(() => {
2757
- const M = [];
2812
+ if (e.length === 0 || J === 0)
2813
+ return /* @__PURE__ */ s("div", { ref: te, className: f(k.root, M?.root, ee), style: re, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: S }) }) });
2814
+ const oe = ke(() => {
2815
+ const B = [];
2758
2816
  let N = 0;
2759
2817
  for (let z = 0; z < e.length; z++) {
2760
- const S = e[z], F = S[t], Y = typeof F == "number" && F > 0 ? F : 0;
2761
- if (Y === 0) continue;
2762
- const G = Y / ee, Z = G * 360;
2763
- M.push({ index: z, row: S, value: Y, start: N, end: N + Z, fraction: G }), N += Z;
2818
+ const T = e[z], _ = T[t], y = typeof _ == "number" && _ > 0 ? _ : 0;
2819
+ if (y === 0) continue;
2820
+ const L = y / J, A = L * 360;
2821
+ B.push({ index: z, row: T, value: y, start: N, end: N + A, fraction: L }), N += A;
2764
2822
  }
2765
- return M;
2766
- }, [e, t, ee]), L = E ? /* @__PURE__ */ s("div", { className: f(x.legend, w?.legend), role: "list", children: ne.map((M) => /* @__PURE__ */ H("div", { className: f(x.legendItem, w?.legendItem), role: "listitem", children: [
2823
+ return B;
2824
+ }, [e, t, J]), he = X ? /* @__PURE__ */ s("div", { className: f(k.legend, M?.legend), role: "list", children: oe.map((B) => /* @__PURE__ */ F("div", { className: f(k.legendItem, M?.legendItem), role: "listitem", children: [
2767
2825
  /* @__PURE__ */ s(
2768
2826
  "span",
2769
2827
  {
2770
- className: x.legendSwatch,
2771
- style: { background: P(M.index) },
2828
+ className: k.legendSwatch,
2829
+ style: { background: U(B.index) },
2772
2830
  "aria-hidden": "true"
2773
2831
  }
2774
2832
  ),
2775
- /* @__PURE__ */ s("span", { className: x.legendLabel, children: String(M.row[n]) })
2776
- ] }, M.index)) }) : void 0, v = ke(() => {
2777
- const M = {};
2778
- for (const N of ne)
2779
- M[N.index.toString()] = {
2833
+ /* @__PURE__ */ s("span", { className: k.legendLabel, children: String(B.row[n]) })
2834
+ ] }, B.index)) }) : void 0, w = ke(() => {
2835
+ const B = {};
2836
+ for (const N of oe)
2837
+ B[N.index.toString()] = {
2780
2838
  label: String(N.row[n]),
2781
- color: P(N.index)
2839
+ color: U(N.index)
2782
2840
  };
2783
- return M;
2784
- }, [ne]);
2841
+ return B;
2842
+ }, [oe]);
2785
2843
  return /* @__PURE__ */ s(
2786
2844
  Ve,
2787
2845
  {
2788
- ref: Q,
2846
+ ref: te,
2789
2847
  aspectRatio: i,
2790
2848
  height: c,
2791
- className: oe,
2792
- style: le,
2793
- classes: w,
2794
- legend: L,
2795
- overlay: W && O !== null && e[O] ? /* @__PURE__ */ s(
2849
+ className: ee,
2850
+ style: re,
2851
+ classes: M,
2852
+ legend: he,
2853
+ overlay: Y && j !== null && e[j] ? /* @__PURE__ */ s(
2796
2854
  et,
2797
2855
  {
2798
- row: { [O.toString()]: e[O][t] },
2799
- x: Q.current ? Q.current.getBoundingClientRect().width / 2 : 0,
2856
+ row: { [j.toString()]: e[j][t] },
2857
+ x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
2800
2858
  y: 16,
2801
- containerWidth: Q.current?.getBoundingClientRect().width ?? 0,
2802
- config: { [O.toString()]: v[O.toString()] },
2803
- render: _ ? () => _(e[O]) : void 0,
2804
- valueFormat: ae,
2859
+ containerWidth: te.current?.getBoundingClientRect().width ?? 0,
2860
+ config: { [j.toString()]: w[j.toString()] },
2861
+ render: D ? () => D(e[j]) : void 0,
2862
+ valueFormat: Q,
2805
2863
  titleKey: void 0,
2806
- classes: w
2864
+ classes: M
2807
2865
  }
2808
2866
  ) : null,
2809
- children: ({ width: M, height: N }) => {
2810
- const z = M / 2, S = N / 2, F = Math.min(M, N) / 2 - 4, Y = It(a, F), G = Math.min(Y - 1, It(l, F)), Z = Math.max(4, Y * 0.06);
2811
- return /* @__PURE__ */ H(Ye, { children: [
2812
- /* @__PURE__ */ s("g", { children: ne.map((U) => {
2813
- const J = d / 2, ue = Math.min(U.end, U.start + J), be = Math.max(U.start, U.end - J), pe = P(U.index), fe = O === U.index, ge = R !== void 0 && !fe, ve = fe && R !== void 0 ? Y + Z : Y, Re = Vi(z, S, ve, G, ue, be), Ne = X ? () => X({ row: U.row, value: U.value, index: U.index }) : void 0;
2867
+ children: ({ width: B, height: N }) => {
2868
+ const z = B / 2, T = N / 2, _ = Math.min(B, N) / 2 - 4, y = It(a, _), L = Math.min(y - 1, It(l, _)), A = Math.max(4, y * 0.06);
2869
+ return /* @__PURE__ */ F(Xe, { children: [
2870
+ /* @__PURE__ */ s("g", { children: oe.map((H) => {
2871
+ const Z = d / 2, ue = Math.min(H.end, H.start + Z), be = Math.max(H.start, H.end - Z), pe = U(H.index), fe = j === H.index, ge = b !== void 0 && !fe, ve = fe && b !== void 0 ? y + A : y, Re = Gi(z, T, ve, L, ue, be), Ne = W ? () => W({ row: H.row, value: H.value, index: H.index }) : void 0;
2814
2872
  return /* @__PURE__ */ s(
2815
2873
  "path",
2816
2874
  {
@@ -2819,24 +2877,24 @@ function Hl({
2819
2877
  stroke: h > 0 ? u : "none",
2820
2878
  strokeWidth: h,
2821
2879
  opacity: ge ? 0.45 : 1,
2822
- onMouseEnter: () => D(U.index),
2823
- onMouseLeave: () => D(null),
2880
+ onMouseEnter: () => O(H.index),
2881
+ onMouseLeave: () => O(null),
2824
2882
  onClick: Ne,
2825
2883
  style: Ne ? { cursor: "pointer" } : void 0
2826
2884
  },
2827
- U.index
2885
+ H.index
2828
2886
  );
2829
2887
  }) }),
2830
- (m || $) && ne.map((U) => {
2831
- const J = $ ? $({ row: U.row, value: U.value, fraction: U.fraction, index: U.index }) : m ? `${String(U.row[n])} ${ae ? ae(U.value) : Math.round(U.fraction * 100) + "%"}` : null;
2832
- if (J == null) return null;
2833
- const ue = p === "inside", be = Math.max(16, Y * 0.12), pe = ue ? (Y + G) / 2 : Y + be, fe = Et(z, S, pe, U.start, U.end), ge = ue ? "middle" : fe.x < z - 1 ? "end" : fe.x > z + 1 ? "start" : "middle";
2888
+ (m || C) && oe.map((H) => {
2889
+ const Z = C ? C({ row: H.row, value: H.value, fraction: H.fraction, index: H.index }) : m ? `${String(H.row[n])} ${Q ? Q(H.value) : Math.round(H.fraction * 100) + "%"}` : null;
2890
+ if (Z == null) return null;
2891
+ const ue = p === "inside", be = Math.max(16, y * 0.12), pe = ue ? (y + L) / 2 : y + be, fe = Et(z, T, pe, H.start, H.end), ge = ue ? "middle" : fe.x < z - 1 ? "end" : fe.x > z + 1 ? "start" : "middle";
2834
2892
  let ve = null;
2835
- if (!ue && y) {
2836
- const Re = Et(z, S, Y, U.start, U.end), Ne = 4, g = ge === "end" ? Ne : ge === "start" ? -Ne : 0;
2893
+ if (!ue && x) {
2894
+ const Re = Et(z, T, y, H.start, H.end), Ne = 4, g = ge === "end" ? Ne : ge === "start" ? -Ne : 0;
2837
2895
  ve = { x1: Re.x, y1: Re.y, x2: fe.x + g, y2: fe.y };
2838
2896
  }
2839
- return /* @__PURE__ */ H("g", { children: [
2897
+ return /* @__PURE__ */ F("g", { children: [
2840
2898
  ve && /* @__PURE__ */ s(
2841
2899
  "line",
2842
2900
  {
@@ -2844,7 +2902,7 @@ function Hl({
2844
2902
  y1: ve.y1,
2845
2903
  x2: ve.x2,
2846
2904
  y2: ve.y2,
2847
- stroke: P(U.index),
2905
+ stroke: U(H.index),
2848
2906
  strokeWidth: 1,
2849
2907
  opacity: 0.7
2850
2908
  }
@@ -2855,23 +2913,23 @@ function Hl({
2855
2913
  x: fe.x,
2856
2914
  y: fe.y,
2857
2915
  className: f(
2858
- x.axisLabel,
2859
- ue && x.barLabelInside
2916
+ k.axisLabel,
2917
+ ue && k.barLabelInside
2860
2918
  ),
2861
2919
  textAnchor: ge,
2862
2920
  dominantBaseline: "middle",
2863
- children: J
2921
+ children: Z
2864
2922
  }
2865
2923
  )
2866
- ] }, `label-${U.index}`);
2924
+ ] }, `label-${H.index}`);
2867
2925
  }),
2868
- k !== void 0 && /* @__PURE__ */ s(
2926
+ $ !== void 0 && /* @__PURE__ */ s(
2869
2927
  "foreignObject",
2870
2928
  {
2871
- x: z - G,
2872
- y: S - G,
2873
- width: Math.max(0, G * 2),
2874
- height: Math.max(0, G * 2),
2929
+ x: z - L,
2930
+ y: T - L,
2931
+ width: Math.max(0, L * 2),
2932
+ height: Math.max(0, L * 2),
2875
2933
  style: { pointerEvents: "none" },
2876
2934
  children: /* @__PURE__ */ s(
2877
2935
  "div",
@@ -2887,7 +2945,7 @@ function Hl({
2887
2945
  color: "var(--crk-color-text)",
2888
2946
  fontFamily: "var(--crk-font-family)"
2889
2947
  },
2890
- children: k
2948
+ children: $
2891
2949
  }
2892
2950
  )
2893
2951
  }
@@ -2901,13 +2959,13 @@ function mt(e, t, n, r) {
2901
2959
  const o = (r - 90) * Math.PI / 180;
2902
2960
  return { x: e + n * Math.cos(o), y: t + n * Math.sin(o) };
2903
2961
  }
2904
- function qi(e, t, n, r) {
2962
+ function Zi(e, t, n, r) {
2905
2963
  return r.map((o) => {
2906
2964
  const i = mt(e, t, n, o);
2907
2965
  return `${i.x},${i.y}`;
2908
2966
  }).join(" ");
2909
2967
  }
2910
- function Ol({
2968
+ function Xl({
2911
2969
  data: e,
2912
2970
  axisKey: t,
2913
2971
  config: n,
@@ -2922,184 +2980,184 @@ function Ol({
2922
2980
  showPoints: d = !0,
2923
2981
  fillOpacity: m = 0.4,
2924
2982
  strokeWidth: p = 2,
2925
- renderAxisLabel: y,
2926
- axisFormat: $,
2927
- valueFormat: k,
2928
- renderTooltip: R,
2929
- showLegend: X = !0,
2930
- showTooltip: E = !0,
2931
- emptyMessage: W = "No data",
2932
- className: ae,
2933
- style: _,
2934
- classes: C
2983
+ renderAxisLabel: x,
2984
+ axisFormat: C,
2985
+ valueFormat: $,
2986
+ renderTooltip: b,
2987
+ showLegend: W = !0,
2988
+ showTooltip: X = !0,
2989
+ emptyMessage: Y = "No data",
2990
+ className: Q,
2991
+ style: D,
2992
+ classes: S
2935
2993
  }) {
2936
- const [oe, le] = Se(null), w = te(null), q = ke(() => Object.keys(n), [n]);
2994
+ const [ee, re] = Se(null), M = ne(null), G = ke(() => Object.keys(n), [n]);
2937
2995
  if (e.length === 0)
2938
- return /* @__PURE__ */ s("div", { ref: w, className: f(x.root, C?.root, ae), style: _, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: W }) }) });
2939
- const D = ke(
2940
- () => e.map((ee, ne) => ne / e.length * 360),
2996
+ return /* @__PURE__ */ s("div", { ref: M, className: f(k.root, S?.root, Q), style: D, children: /* @__PURE__ */ s("div", { className: k.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: k.empty, children: Y }) }) });
2997
+ const O = ke(
2998
+ () => e.map((J, oe) => oe / e.length * 360),
2941
2999
  [e]
2942
- ), Q = ke(() => {
2943
- const ee = [];
2944
- for (const L of q)
2945
- for (const v of e) {
2946
- const M = v[L];
2947
- typeof M == "number" && ee.push(M);
3000
+ ), te = ke(() => {
3001
+ const J = [];
3002
+ for (const he of G)
3003
+ for (const w of e) {
3004
+ const B = w[he];
3005
+ typeof B == "number" && J.push(B);
2948
3006
  }
2949
- const [, ne] = bt(ee);
2950
- return Math.max(1, ne);
2951
- }, [e, q]), O = ke(() => qe(0, Q, u).filter((ne) => ne > 0), [Q, u]), P = O[O.length - 1] ?? Q;
3007
+ const [, oe] = bt(J);
3008
+ return Math.max(1, oe);
3009
+ }, [e, G]), j = ke(() => qe(0, te, u).filter((oe) => oe > 0), [te, u]), U = j[j.length - 1] ?? te;
2952
3010
  return /* @__PURE__ */ s(
2953
3011
  Ve,
2954
3012
  {
2955
- ref: w,
3013
+ ref: M,
2956
3014
  aspectRatio: r,
2957
3015
  height: o,
2958
- className: ae,
2959
- style: _,
2960
- classes: C,
2961
- legend: X ? /* @__PURE__ */ s(vt, { config: n, classes: C }) : void 0,
2962
- overlay: E && oe !== null ? /* @__PURE__ */ s(
3016
+ className: Q,
3017
+ style: D,
3018
+ classes: S,
3019
+ legend: W ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
3020
+ overlay: X && ee !== null ? /* @__PURE__ */ s(
2963
3021
  et,
2964
3022
  {
2965
- row: e[oe],
2966
- x: (w.current?.getBoundingClientRect().width ?? 0) / 2,
3023
+ row: e[ee],
3024
+ x: (M.current?.getBoundingClientRect().width ?? 0) / 2,
2967
3025
  y: 16,
2968
- containerWidth: w.current?.getBoundingClientRect().width ?? 0,
3026
+ containerWidth: M.current?.getBoundingClientRect().width ?? 0,
2969
3027
  config: n,
2970
- render: R ? () => R(e[oe]) : void 0,
2971
- valueFormat: k,
3028
+ render: b ? () => b(e[ee]) : void 0,
3029
+ valueFormat: $,
2972
3030
  titleKey: t,
2973
- classes: C
3031
+ classes: S
2974
3032
  }
2975
3033
  ) : null,
2976
- children: ({ width: ee, height: ne }) => {
2977
- const L = a ? 32 : 8, v = ee / 2, M = ne / 2, N = Math.max(0, Math.min(ee, ne) / 2 - L), z = (S) => Math.max(0, S) / P * N;
2978
- return /* @__PURE__ */ H(Ye, { children: [
2979
- c && O.map((S) => {
2980
- const F = z(S);
3034
+ children: ({ width: J, height: oe }) => {
3035
+ const he = a ? 32 : 8, w = J / 2, B = oe / 2, N = Math.max(0, Math.min(J, oe) / 2 - he), z = (T) => Math.max(0, T) / U * N;
3036
+ return /* @__PURE__ */ F(Xe, { children: [
3037
+ c && j.map((T) => {
3038
+ const _ = z(T);
2981
3039
  return i === "circle" ? /* @__PURE__ */ s(
2982
3040
  "circle",
2983
3041
  {
2984
- className: f(x.gridLine, C?.grid),
2985
- cx: v,
2986
- cy: M,
2987
- r: F,
3042
+ className: f(k.gridLine, S?.grid),
3043
+ cx: w,
3044
+ cy: B,
3045
+ r: _,
2988
3046
  fill: "none"
2989
3047
  },
2990
- `ring-${S}`
3048
+ `ring-${T}`
2991
3049
  ) : /* @__PURE__ */ s(
2992
3050
  "polygon",
2993
3051
  {
2994
- className: f(x.gridLine, C?.grid),
2995
- points: qi(v, M, F, D),
3052
+ className: f(k.gridLine, S?.grid),
3053
+ points: Zi(w, B, _, O),
2996
3054
  fill: "none"
2997
3055
  },
2998
- `ring-${S}`
3056
+ `ring-${T}`
2999
3057
  );
3000
3058
  }),
3001
- l && D.map((S, F) => {
3002
- const Y = mt(v, M, N, S);
3059
+ l && O.map((T, _) => {
3060
+ const y = mt(w, B, N, T);
3003
3061
  return /* @__PURE__ */ s(
3004
3062
  "line",
3005
3063
  {
3006
- className: f(x.gridLine, C?.grid),
3007
- x1: v,
3008
- y1: M,
3009
- x2: Y.x,
3010
- y2: Y.y
3064
+ className: f(k.gridLine, S?.grid),
3065
+ x1: w,
3066
+ y1: B,
3067
+ x2: y.x,
3068
+ y2: y.y
3011
3069
  },
3012
- `spoke-${F}`
3070
+ `spoke-${_}`
3013
3071
  );
3014
3072
  }),
3015
- h && O.map((S) => {
3016
- const F = z(S);
3073
+ h && j.map((T) => {
3074
+ const _ = z(T);
3017
3075
  return /* @__PURE__ */ s(
3018
3076
  "text",
3019
3077
  {
3020
- className: f(x.axisLabel, C?.axisLabel),
3021
- x: v + 4,
3022
- y: M - F,
3078
+ className: f(k.axisLabel, S?.axisLabel),
3079
+ x: w + 4,
3080
+ y: B - _,
3023
3081
  textAnchor: "start",
3024
3082
  dominantBaseline: "middle",
3025
- children: k ? k(S) : S
3083
+ children: $ ? $(T) : T
3026
3084
  },
3027
- `raxis-${S}`
3085
+ `raxis-${T}`
3028
3086
  );
3029
3087
  }),
3030
- a && e.map((S, F) => {
3031
- const Y = D[F], G = mt(v, M, N + 14, Y), Z = G.x < v - 1 ? "end" : G.x > v + 1 ? "start" : "middle";
3032
- if (y)
3033
- return /* @__PURE__ */ s("g", { children: y({
3034
- row: S,
3035
- index: F,
3036
- angle: Y,
3037
- x: G.x,
3038
- y: G.y,
3039
- textAnchor: Z
3040
- }) }, `label-${F}`);
3041
- const U = String(S[t]), J = $ ? $(U) : U;
3088
+ a && e.map((T, _) => {
3089
+ const y = O[_], L = mt(w, B, N + 14, y), A = L.x < w - 1 ? "end" : L.x > w + 1 ? "start" : "middle";
3090
+ if (x)
3091
+ return /* @__PURE__ */ s("g", { children: x({
3092
+ row: T,
3093
+ index: _,
3094
+ angle: y,
3095
+ x: L.x,
3096
+ y: L.y,
3097
+ textAnchor: A
3098
+ }) }, `label-${_}`);
3099
+ const H = String(T[t]), Z = C ? C(H) : H;
3042
3100
  return /* @__PURE__ */ s(
3043
3101
  "text",
3044
3102
  {
3045
- className: f(x.axisLabel, C?.axisLabel),
3046
- x: G.x,
3047
- y: G.y,
3048
- textAnchor: Z,
3103
+ className: f(k.axisLabel, S?.axisLabel),
3104
+ x: L.x,
3105
+ y: L.y,
3106
+ textAnchor: A,
3049
3107
  dominantBaseline: "middle",
3050
- children: J
3108
+ children: Z
3051
3109
  },
3052
- `label-${F}`
3110
+ `label-${_}`
3053
3111
  );
3054
3112
  }),
3055
- q.map((S) => {
3056
- const F = n[S], Y = e.map((Z, U) => {
3057
- const J = Z[S], be = z(typeof J == "number" ? J : 0);
3058
- return mt(v, M, be, D[U]);
3059
- }), G = Y.map((Z) => `${Z.x},${Z.y}`).join(" ");
3060
- return /* @__PURE__ */ H("g", { className: f(x.series, C?.series), children: [
3113
+ G.map((T) => {
3114
+ const _ = n[T], y = e.map((A, H) => {
3115
+ const Z = A[T], be = z(typeof Z == "number" ? Z : 0);
3116
+ return mt(w, B, be, O[H]);
3117
+ }), L = y.map((A) => `${A.x},${A.y}`).join(" ");
3118
+ return /* @__PURE__ */ F("g", { className: f(k.series, S?.series), children: [
3061
3119
  /* @__PURE__ */ s(
3062
3120
  "polygon",
3063
3121
  {
3064
- points: G,
3065
- fill: F.color,
3122
+ points: L,
3123
+ fill: _.color,
3066
3124
  fillOpacity: m,
3067
- stroke: F.color,
3125
+ stroke: _.color,
3068
3126
  strokeWidth: p,
3069
3127
  strokeLinejoin: "round",
3070
3128
  strokeLinecap: "round"
3071
3129
  }
3072
3130
  ),
3073
- d && Y.map((Z, U) => /* @__PURE__ */ s(
3131
+ d && y.map((A, H) => /* @__PURE__ */ s(
3074
3132
  "circle",
3075
3133
  {
3076
- className: f(x.point, C?.point),
3077
- cx: Z.x,
3078
- cy: Z.y,
3079
- r: oe === U ? 5 : 3.5,
3080
- fill: F.color
3134
+ className: f(k.point, S?.point),
3135
+ cx: A.x,
3136
+ cy: A.y,
3137
+ r: ee === H ? 5 : 3.5,
3138
+ fill: _.color
3081
3139
  },
3082
- `${S}-${U}`
3140
+ `${T}-${H}`
3083
3141
  ))
3084
- ] }, S);
3142
+ ] }, T);
3085
3143
  }),
3086
3144
  /* @__PURE__ */ s(
3087
3145
  "rect",
3088
3146
  {
3089
- className: x.interactionLayer,
3147
+ className: k.interactionLayer,
3090
3148
  x: 0,
3091
3149
  y: 0,
3092
- width: ee,
3093
- height: ne,
3094
- onMouseMove: (S) => {
3095
- const F = S.currentTarget.getBoundingClientRect(), Y = S.clientX - F.left - v, G = S.clientY - F.top - M;
3096
- if (Y === 0 && G === 0) return;
3097
- let Z = Math.atan2(G, Y) * 180 / Math.PI + 90;
3098
- Z < 0 && (Z += 360), Z >= 360 && (Z -= 360);
3099
- const U = 360 / e.length, J = Math.round(Z / U) % e.length;
3100
- le(J);
3150
+ width: J,
3151
+ height: oe,
3152
+ onMouseMove: (T) => {
3153
+ const _ = T.currentTarget.getBoundingClientRect(), y = T.clientX - _.left - w, L = T.clientY - _.top - B;
3154
+ if (y === 0 && L === 0) return;
3155
+ let A = Math.atan2(L, y) * 180 / Math.PI + 90;
3156
+ A < 0 && (A += 360), A >= 360 && (A -= 360);
3157
+ const H = 360 / e.length, Z = Math.round(A / H) % e.length;
3158
+ re(Z);
3101
3159
  },
3102
- onMouseLeave: () => le(null)
3160
+ onMouseLeave: () => re(null)
3103
3161
  }
3104
3162
  )
3105
3163
  ] });
@@ -3107,7 +3165,7 @@ function Ol({
3107
3165
  }
3108
3166
  );
3109
3167
  }
3110
- function Gi(e, t) {
3168
+ function Ki(e, t) {
3111
3169
  const n = new Array(e.length).fill(null);
3112
3170
  if (t <= 0 || e.length < t) return n;
3113
3171
  let r = 0;
@@ -3117,7 +3175,7 @@ function Gi(e, t) {
3117
3175
  r += e[o].close - e[o - t].close, n[o] = r / t;
3118
3176
  return n;
3119
3177
  }
3120
- function Zi(e, t) {
3178
+ function Qi(e, t) {
3121
3179
  const n = new Array(e.length).fill(null);
3122
3180
  if (t <= 0 || e.length < t) return n;
3123
3181
  const r = 2 / (t + 1);
@@ -3129,7 +3187,7 @@ function Zi(e, t) {
3129
3187
  i = e[c].close * r + i * (1 - r), n[c] = i;
3130
3188
  return n;
3131
3189
  }
3132
- function Ki(e, t, n = 2) {
3190
+ function Ji(e, t, n = 2) {
3133
3191
  const r = e.length, o = new Array(r).fill(null), i = new Array(r).fill(null), c = new Array(r).fill(null);
3134
3192
  if (t <= 0 || r < t) return { middle: o, upper: i, lower: c };
3135
3193
  for (let l = t - 1; l < r; l++) {
@@ -3147,7 +3205,7 @@ function Ki(e, t, n = 2) {
3147
3205
  }
3148
3206
  return { middle: o, upper: i, lower: c };
3149
3207
  }
3150
- function Qi(e, t = 14) {
3208
+ function el(e, t = 14) {
3151
3209
  const n = new Array(e.length).fill(null);
3152
3210
  if (e.length <= t) return n;
3153
3211
  let r = 0, o = 0;
@@ -3165,11 +3223,11 @@ function Qi(e, t = 14) {
3165
3223
  function Pt(e, t) {
3166
3224
  return t === 0 ? 100 : 100 - 100 / (1 + e / t);
3167
3225
  }
3168
- function Fl(e) {
3226
+ function _l(e) {
3169
3227
  return e.map((t) => typeof t.volume == "number" ? t.volume : null);
3170
3228
  }
3171
3229
  const Le = 86400;
3172
- function tn(e) {
3230
+ function nn(e) {
3173
3231
  switch (e) {
3174
3232
  case "1D":
3175
3233
  return Le;
@@ -3197,7 +3255,7 @@ function tn(e) {
3197
3255
  }
3198
3256
  return 30 * Le;
3199
3257
  }
3200
- function jl(e) {
3258
+ function Ul(e) {
3201
3259
  switch (e) {
3202
3260
  case "1D":
3203
3261
  return "5";
@@ -3214,232 +3272,232 @@ function jl(e) {
3214
3272
  case "5Y":
3215
3273
  return "W";
3216
3274
  }
3217
- const t = tn(e);
3275
+ const t = nn(e);
3218
3276
  return t >= 3 * 365 * Le ? "W" : t >= 180 * Le ? "D" : t >= 60 * Le ? "240" : t >= 14 * Le ? "60" : t >= 3 * Le ? "15" : "5";
3219
3277
  }
3220
- function Xl(e) {
3278
+ function zl(e) {
3221
3279
  if (e === "W" || e === "M") return "5Y";
3222
3280
  if (e === "D") return "1Y";
3223
3281
  const t = Number(e);
3224
3282
  return !Number.isFinite(t) || t >= 240 ? "3M" : t >= 60 ? "1M" : t >= 15 || t >= 5 ? "5D" : "1D";
3225
3283
  }
3226
- const Ji = 420, Rt = 64, Ct = 28, el = 28, Wt = { rsi: 0.18, volume: 0.14 }, tl = 1, nl = 40, Ht = 0.1, rl = 500, ol = [];
3227
- function Ul({
3284
+ const tl = 420, Rt = 64, Ct = 28, nl = 40, rl = 4, Wt = { rsi: 0.18, volume: 0.14 }, ol = 1, cl = 40, Ht = 0.1, il = 500, ll = [];
3285
+ function Yl({
3228
3286
  datafeed: e,
3229
3287
  symbol: t,
3230
3288
  resolution: n,
3231
3289
  period: r,
3232
3290
  seriesType: o = "candle",
3233
- indicators: i = ol,
3291
+ indicators: i = ll,
3234
3292
  precision: c = 2,
3235
- initialLookback: l = rl,
3236
- height: a = Ji,
3293
+ initialLookback: l = il,
3294
+ height: a = tl,
3237
3295
  upColor: h = "var(--crk-color-success)",
3238
3296
  downColor: u = "var(--crk-color-danger)",
3239
3297
  lineColor: d = "var(--crk-chart-1)",
3240
3298
  timezone: m,
3241
3299
  defaultTimezone: p = "local",
3242
- onTimezoneChange: y,
3243
- showConfigPanel: $ = !0,
3244
- onCrosshair: k,
3245
- onVisibleRangeChange: R,
3246
- className: X,
3247
- style: E
3300
+ onTimezoneChange: x,
3301
+ showConfigPanel: C = !0,
3302
+ onCrosshair: $,
3303
+ onVisibleRangeChange: b,
3304
+ className: W,
3305
+ style: X
3248
3306
  }) {
3249
- const W = te(null), ae = te(null), _ = te([]), C = te({ from: 0, to: 0 }), oe = te(null), le = te(null), w = te(!1), q = te(null), D = te(null), Q = te(1), O = te({ width: 0, height: 0 }), P = te(() => {
3250
- }), ee = te(k), ne = te(R);
3251
- ee.current = k, ne.current = R;
3252
- const [L, v] = Se(null), [M, N] = Se(p), z = m ?? M, S = he(
3307
+ const Y = ne(null), Q = ne(null), D = ne([]), S = ne({ from: 0, to: 0 }), ee = ne(null), re = ne(null), M = ne(!1), G = ne(null), O = ne(null), te = ne(1), j = ne({ width: 0, height: 0 }), U = ne(() => {
3308
+ }), J = ne($), oe = ne(b);
3309
+ J.current = $, oe.current = b;
3310
+ const [he, w] = Se(null), [B, N] = Se(p), z = m ?? B, T = de(
3253
3311
  (g) => {
3254
- m === void 0 && N(g), y?.(g);
3312
+ m === void 0 && N(g), x?.(g);
3255
3313
  },
3256
- [m, y]
3257
- ), F = ke(
3314
+ [m, x]
3315
+ ), _ = ke(
3258
3316
  () => ({ up: h, down: u, line: d }),
3259
3317
  [h, u, d]
3260
- ), Y = i, G = Y.some((g) => g.type === "rsi"), Z = Y.some((g) => g.type === "volume"), U = he(() => {
3261
- const g = ae.current;
3318
+ ), y = i, L = y.some((g) => g.type === "rsi"), A = y.some((g) => g.type === "volume"), H = de(() => {
3319
+ const g = Q.current;
3262
3320
  if (!g) return;
3263
- const b = g.getContext("2d");
3264
- if (!b) return;
3265
- const { width: K, height: B } = O.current;
3266
- if (K === 0 || B === 0) return;
3267
- const j = Q.current;
3268
- b.save(), b.setTransform(1, 0, 0, 1, 0, 0), b.clearRect(0, 0, g.width, g.height), b.scale(j, j);
3269
- const A = ul(W.current, F), de = rn(W.current), V = _.current;
3270
- if (V.length === 0) {
3271
- hl(b, K, B, A), b.restore();
3321
+ const v = g.getContext("2d");
3322
+ if (!v) return;
3323
+ const { width: K, height: E } = j.current;
3324
+ if (K === 0 || E === 0) return;
3325
+ const V = te.current;
3326
+ v.save(), v.setTransform(1, 0, 0, 1, 0, 0), v.clearRect(0, 0, g.width, g.height), v.scale(V, V);
3327
+ const I = fl(Y.current, _), ae = on(Y.current), q = D.current;
3328
+ if (q.length === 0) {
3329
+ pl(v, K, E, I), v.restore();
3272
3330
  return;
3273
3331
  }
3274
- const T = Nt(K, B, G, Z), { from: ce, to: me } = sl(C.current, V.length);
3275
- C.current = { from: ce, to: me };
3276
- const re = V.slice(Math.max(0, Math.floor(ce)), Math.min(V.length, Math.ceil(me) + 1)), se = (ie) => {
3277
- const De = me - ce + 1, He = T.plotWidth / De;
3278
- return T.plotLeft + (ie - ce + 0.5) * He;
3279
- }, Ce = T.plotWidth / (me - ce + 1), Ie = Y.map((ie) => al(ie, V)).filter((ie) => ie !== null).map((ie) => ({ ...ie, color: de(ie.color) })), xe = nn(T.main, re, Ie, ce, me);
3280
- Lt(b, T.plotLeft, T.plotRight, xe, A), ml(b, T, xe, c, A), b.save(), b.beginPath(), b.rect(T.plotLeft, xe.paneTop, T.plotWidth, xe.paneHeight), b.clip();
3281
- for (let ie = 0; ie < Y.length; ie++) {
3282
- const De = Y[ie], He = Ie[ie];
3283
- He && yl(b, He, De, V, ce, me, se, xe);
3332
+ const R = Nt(K, E, L, A), { from: ie, to: me } = ul(S.current, q.length);
3333
+ S.current = { from: ie, to: me };
3334
+ const ce = q.slice(Math.max(0, Math.floor(ie)), Math.min(q.length, Math.ceil(me) + 1)), se = (le) => {
3335
+ const De = me - ie + 1, He = R.plotWidth / De;
3336
+ return R.plotLeft + (le - ie + 0.5) * He;
3337
+ }, Ce = R.plotWidth / (me - ie + 1), Ie = y.map((le) => hl(le, q)).filter((le) => le !== null).map((le) => ({ ...le, color: ae(le.color) })), xe = rn(R.main, ce, Ie, ie, me);
3338
+ Lt(v, R.plotLeft, R.plotRight, xe, I), gl(v, R, xe, c, I), v.save(), v.beginPath(), v.rect(R.plotLeft, xe.paneTop, R.plotWidth, xe.paneHeight), v.clip();
3339
+ for (let le = 0; le < y.length; le++) {
3340
+ const De = y[le], He = Ie[le];
3341
+ He && xl(v, He, De, q, ie, me, se, xe);
3284
3342
  }
3285
- if (o === "candle" ? fl(b, V, ce, me, se, Ce, xe, { up: A.up, down: A.down }) : o === "bar" ? pl(b, V, ce, me, se, Ce, xe, { up: A.up, down: A.down }) : gl(b, V, ce, me, se, xe, A.line, o === "area"), b.restore(), T.volume) {
3286
- const ie = dl(T.volume, V, ce, me);
3287
- Lt(b, T.plotLeft, T.plotRight, ie, A, !0), Ot(b, T, T.volume, "Volume", A), b.save(), b.beginPath(), b.rect(T.plotLeft, ie.paneTop, T.plotWidth, ie.paneHeight), b.clip(), vl(b, V, ce, me, se, Ce, ie, { up: A.up, down: A.down }), b.restore();
3343
+ if (o === "candle" ? yl(v, q, ie, me, se, Ce, xe, { up: I.up, down: I.down }) : o === "bar" ? vl(v, q, ie, me, se, Ce, xe, { up: I.up, down: I.down }) : bl(v, q, ie, me, se, xe, I.line, o === "area"), v.restore(), R.volume) {
3344
+ const le = ml(R.volume, q, ie, me);
3345
+ Lt(v, R.plotLeft, R.plotRight, le, I, !0), Ot(v, R, R.volume, "Volume", I), v.save(), v.beginPath(), v.rect(R.plotLeft, le.paneTop, R.plotWidth, le.paneHeight), v.clip(), kl(v, q, ie, me, se, Ce, le, { up: I.up, down: I.down }), v.restore();
3288
3346
  }
3289
- if (T.rsi) {
3290
- const ie = Y.find((tt) => tt.type === "rsi"), De = ie && ie.type === "rsi" ? ie.period ?? 14 : 14, He = ie && ie.type === "rsi" ? ie.overbought ?? 70 : 70, Ge = ie && ie.type === "rsi" ? ie.oversold ?? 30 : 30, Ee = (ie && ie.type === "rsi" ? ie.color : void 0) ?? "var(--crk-chart-5)", xt = de(Ee), kt = Qi(V, De), Oe = {
3291
- paneTop: T.rsi.top,
3292
- paneBottom: T.rsi.bottom,
3293
- paneHeight: T.rsi.height,
3347
+ if (R.rsi) {
3348
+ const le = y.find((tt) => tt.type === "rsi"), De = le && le.type === "rsi" ? le.period ?? 14 : 14, He = le && le.type === "rsi" ? le.overbought ?? 70 : 70, Ge = le && le.type === "rsi" ? le.oversold ?? 30 : 30, Ee = (le && le.type === "rsi" ? le.color : void 0) ?? "var(--crk-chart-5)", xt = ae(Ee), kt = el(q, De), Oe = {
3349
+ paneTop: R.rsi.top,
3350
+ paneBottom: R.rsi.bottom,
3351
+ paneHeight: R.rsi.height,
3294
3352
  priceMin: 0,
3295
3353
  priceMax: 100,
3296
3354
  ticks: [Ge, 50, He]
3297
3355
  };
3298
- Lt(b, T.plotLeft, T.plotRight, Oe, A, !0), Ot(b, T, T.rsi, `RSI ${De}`, A), b.save(), b.beginPath(), b.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), b.clip(), Qe(b, kt, ce, me, se, Oe, xt), b.restore(), bl(b, T, Oe, He, Ge, A);
3356
+ Lt(v, R.plotLeft, R.plotRight, Oe, I, !0), Ot(v, R, R.rsi, `RSI ${De}`, I), v.save(), v.beginPath(), v.rect(R.plotLeft, Oe.paneTop, R.plotWidth, Oe.paneHeight), v.clip(), Qe(v, kt, ie, me, se, Oe, xt), v.restore(), Ml(v, R, Oe, He, Ge, I);
3299
3357
  }
3300
- xl(b, T, V, ce, me, n, A), oe.current && kl(b, T, oe.current, V, ce, me, se, c, xe, z, A), b.restore();
3301
- }, [o, Y, G, Z, c, F, n, z]);
3302
- P.current = U;
3303
- const J = he(() => {
3304
- if (D.current === null) {
3358
+ wl(v, R, q, ie, me, n, I), ee.current && $l(v, R, ee.current, q, ie, me, se, c, xe, z, I), v.restore();
3359
+ }, [o, y, L, A, c, _, n, z]);
3360
+ U.current = H;
3361
+ const Z = de(() => {
3362
+ if (O.current === null) {
3305
3363
  if (typeof requestAnimationFrame > "u") {
3306
- P.current();
3364
+ U.current();
3307
3365
  return;
3308
3366
  }
3309
- D.current = requestAnimationFrame(() => {
3310
- D.current = null, P.current();
3367
+ O.current = requestAnimationFrame(() => {
3368
+ O.current = null, U.current();
3311
3369
  });
3312
3370
  }
3313
3371
  }, []);
3314
- an(() => {
3315
- const g = W.current;
3372
+ dn(() => {
3373
+ const g = Y.current;
3316
3374
  if (!g) return;
3317
- const b = () => {
3318
- const B = g.getBoundingClientRect(), j = typeof window < "u" && window.devicePixelRatio || 1;
3319
- Q.current = j, O.current = { width: B.width, height: B.height };
3320
- const A = ae.current;
3321
- A && (A.width = Math.round(B.width * j), A.height = Math.round(B.height * j), A.style.width = `${B.width}px`, A.style.height = `${B.height}px`), J();
3375
+ const v = () => {
3376
+ const E = g.getBoundingClientRect(), V = typeof window < "u" && window.devicePixelRatio || 1;
3377
+ te.current = V, j.current = { width: E.width, height: E.height };
3378
+ const I = Q.current;
3379
+ I && (I.width = Math.round(E.width * V), I.height = Math.round(E.height * V), I.style.width = `${E.width}px`, I.style.height = `${E.height}px`), Z();
3322
3380
  };
3323
- if (b(), typeof ResizeObserver > "u") return;
3324
- const K = new ResizeObserver(b);
3381
+ if (v(), typeof ResizeObserver > "u") return;
3382
+ const K = new ResizeObserver(v);
3325
3383
  return K.observe(g), () => K.disconnect();
3326
- }, [J]), Be(() => {
3384
+ }, [Z]), Be(() => {
3327
3385
  let g = !1;
3328
- const b = Math.floor(Date.now() / 1e3), K = Ft(n), B = r !== void 0 ? tn(r) : K * l, j = r !== void 0 ? Math.max(10, Math.ceil(B / K)) : l, A = b - B;
3329
- _.current = [], C.current = { from: 0, to: 0 }, J(), e.getBars({ symbol: t, resolution: n, from: A, to: b, countBack: j }).then((V) => {
3386
+ const v = Math.floor(Date.now() / 1e3), K = Ft(n), E = r !== void 0 ? nn(r) : K * l, V = r !== void 0 ? Math.max(10, Math.ceil(E / K)) : l, I = v - E;
3387
+ D.current = [], S.current = { from: 0, to: 0 }, Z(), e.getBars({ symbol: t, resolution: n, from: I, to: v, countBack: V }).then((q) => {
3330
3388
  if (g) return;
3331
- const T = [...V].sort((me, re) => me.time - re.time);
3332
- _.current = T;
3333
- const ce = T.length - 1;
3389
+ const R = [...q].sort((me, ce) => me.time - ce.time);
3390
+ D.current = R;
3391
+ const ie = R.length - 1;
3334
3392
  if (r !== void 0)
3335
- C.current = { from: 0, to: ce };
3393
+ S.current = { from: 0, to: ie };
3336
3394
  else {
3337
- const me = Math.min(T.length, Math.min(200, l));
3338
- C.current = {
3339
- from: Math.max(0, ce - me + 1),
3340
- to: ce
3395
+ const me = Math.min(R.length, Math.min(200, l));
3396
+ S.current = {
3397
+ from: Math.max(0, ie - me + 1),
3398
+ to: ie
3341
3399
  };
3342
3400
  }
3343
- ne.current?.(C.current, T), J();
3401
+ oe.current?.(S.current, R), Z();
3344
3402
  }).catch(() => {
3345
3403
  });
3346
- const de = e.subscribeBars({
3404
+ const ae = e.subscribeBars({
3347
3405
  symbol: t,
3348
3406
  resolution: n,
3349
- onTick: (V) => {
3407
+ onTick: (q) => {
3350
3408
  if (g) return;
3351
- const T = _.current, ce = T[T.length - 1];
3352
- if (ce && ce.time === V.time)
3353
- T[T.length - 1] = V;
3354
- else if (!ce || V.time > ce.time) {
3355
- T.push(V);
3356
- const me = C.current;
3357
- me.to >= T.length - 2 && (C.current = { from: me.from + 1, to: me.to + 1 });
3409
+ const R = D.current, ie = R[R.length - 1];
3410
+ if (ie && ie.time === q.time)
3411
+ R[R.length - 1] = q;
3412
+ else if (!ie || q.time > ie.time) {
3413
+ R.push(q);
3414
+ const me = S.current;
3415
+ me.to >= R.length - 2 && (S.current = { from: me.from + 1, to: me.to + 1 });
3358
3416
  }
3359
- J();
3417
+ Z();
3360
3418
  }
3361
3419
  });
3362
- return q.current = de, () => {
3363
- g = !0, q.current !== null && (e.unsubscribeBars(q.current), q.current = null);
3420
+ return G.current = ae, () => {
3421
+ g = !0, G.current !== null && (e.unsubscribeBars(G.current), G.current = null);
3364
3422
  };
3365
3423
  }, [e, t, n, r, l]);
3366
- const ue = he((g) => {
3367
- v(g), ee.current?.(g);
3368
- }, []), be = he((g) => {
3424
+ const ue = de((g) => {
3425
+ w(g), J.current?.(g);
3426
+ }, []), be = de((g) => {
3369
3427
  g.currentTarget.setPointerCapture(g.pointerId);
3370
- const b = C.current;
3371
- le.current = { startX: g.clientX, from: b.from, to: b.to };
3372
- }, []), pe = he(
3428
+ const v = S.current;
3429
+ re.current = { startX: g.clientX, from: v.from, to: v.to };
3430
+ }, []), pe = de(
3373
3431
  (g) => {
3374
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left, B = g.clientY - b.top;
3375
- if (oe.current = { x: K, y: B }, le.current) {
3376
- const { startX: de, from: V, to: T } = le.current, { width: ce } = O.current, me = Math.max(1, ce - Rt), re = T - V + 1, se = me / re, Ce = -(g.clientX - de) / se;
3377
- let Ie = V + Ce, xe = T + Ce;
3378
- const ie = _.current.length;
3379
- Ie < 0 && (Ne(), Ie = 0, xe = re - 1), xe > ie - 1 && (xe = ie - 1, Ie = xe - re + 1), C.current = { from: Ie, to: xe }, ne.current?.(C.current, _.current);
3432
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left, E = g.clientY - v.top;
3433
+ if (ee.current = { x: K, y: E }, re.current) {
3434
+ const { startX: ae, from: q, to: R } = re.current, { width: ie } = j.current, me = Math.max(1, ie - Rt), ce = R - q + 1, se = me / ce, Ce = -(g.clientX - ae) / se;
3435
+ let Ie = q + Ce, xe = R + Ce;
3436
+ const le = D.current.length;
3437
+ Ie < 0 && (Ne(), Ie = 0, xe = ce - 1), xe > le - 1 && (xe = le - 1, Ie = xe - ce + 1), S.current = { from: Ie, to: xe }, oe.current?.(S.current, D.current);
3380
3438
  }
3381
- const j = Nt(b.width, b.height, G, Z), A = C.current;
3382
- if (K >= j.plotLeft && K <= j.plotRight) {
3383
- const de = A.to - A.from + 1, V = j.plotWidth / de, T = Math.round(A.from + (K - j.plotLeft) / V - 0.5), ce = _.current, me = Math.max(0, Math.min(ce.length - 1, T)), re = ce[me] ?? null, se = Ml(B, j, ce, A.from, A.to);
3384
- ue({ barIndex: me, bar: re, priceAtCursor: se });
3439
+ const V = Nt(v.width, v.height, L, A), I = S.current;
3440
+ if (K >= V.plotLeft && K <= V.plotRight) {
3441
+ const ae = I.to - I.from + 1, q = V.plotWidth / ae, R = Math.round(I.from + (K - V.plotLeft) / q - 0.5), ie = D.current, me = Math.max(0, Math.min(ie.length - 1, R)), ce = ie[me] ?? null, se = Nl(E, V, ie, I.from, I.to);
3442
+ ue({ barIndex: me, bar: ce, priceAtCursor: se });
3385
3443
  } else
3386
3444
  ue(null);
3387
- J();
3445
+ Z();
3388
3446
  },
3389
- [G, Z, J, ue]
3390
- ), fe = he((g) => {
3391
- g.currentTarget.releasePointerCapture(g.pointerId), le.current = null;
3392
- }, []), ge = he(() => {
3393
- oe.current = null, le.current = null, ue(null), J();
3394
- }, [J, ue]), ve = he(
3447
+ [L, A, Z, ue]
3448
+ ), fe = de((g) => {
3449
+ g.currentTarget.releasePointerCapture(g.pointerId), re.current = null;
3450
+ }, []), ge = de(() => {
3451
+ ee.current = null, re.current = null, ue(null), Z();
3452
+ }, [Z, ue]), ve = de(
3395
3453
  (g) => {
3396
3454
  g.preventDefault();
3397
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left, B = Nt(b.width, b.height, G, Z), j = C.current, A = _.current;
3398
- if (A.length === 0) return;
3399
- const de = j.to - j.from + 1, V = g.deltaY > 0 ? 1 + Ht : 1 / (1 + Ht), T = Math.max(
3400
- B.plotWidth / nl,
3401
- Math.min(A.length, B.plotWidth / tl, de * V)
3402
- ), ce = j.from + (K - B.plotLeft) / (B.plotWidth / de), me = (ce - j.from) / de;
3403
- let re = ce - me * T, se = re + T - 1;
3404
- re < 0 && (re = 0, se = T - 1), se > A.length - 1 && (se = A.length - 1, re = se - T + 1), C.current = { from: re, to: se }, ne.current?.(C.current, A), J();
3455
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left, E = Nt(v.width, v.height, L, A), V = S.current, I = D.current;
3456
+ if (I.length === 0) return;
3457
+ const ae = V.to - V.from + 1, q = g.deltaY > 0 ? 1 + Ht : 1 / (1 + Ht), R = Math.max(
3458
+ E.plotWidth / cl,
3459
+ Math.min(I.length, E.plotWidth / ol, ae * q)
3460
+ ), ie = V.from + (K - E.plotLeft) / (E.plotWidth / ae), me = (ie - V.from) / ae;
3461
+ let ce = ie - me * R, se = ce + R - 1;
3462
+ ce < 0 && (ce = 0, se = R - 1), se > I.length - 1 && (se = I.length - 1, ce = se - R + 1), S.current = { from: ce, to: se }, oe.current?.(S.current, I), Z();
3405
3463
  },
3406
- [G, Z, J]
3407
- ), Re = he(
3464
+ [L, A, Z]
3465
+ ), Re = de(
3408
3466
  (g) => {
3409
- const b = C.current, K = b.to - b.from + 1, B = _.current;
3410
- if (B.length === 0) return;
3411
- let j = 0;
3412
- if (g.key === "ArrowLeft") j = -Math.max(1, Math.floor(K * 0.1));
3413
- else if (g.key === "ArrowRight") j = Math.max(1, Math.floor(K * 0.1));
3467
+ const v = S.current, K = v.to - v.from + 1, E = D.current;
3468
+ if (E.length === 0) return;
3469
+ let V = 0;
3470
+ if (g.key === "ArrowLeft") V = -Math.max(1, Math.floor(K * 0.1));
3471
+ else if (g.key === "ArrowRight") V = Math.max(1, Math.floor(K * 0.1));
3414
3472
  else return;
3415
3473
  g.preventDefault();
3416
- let A = b.from + j, de = b.to + j;
3417
- A < 0 && (A = 0, de = K - 1), de > B.length - 1 && (de = B.length - 1, A = de - K + 1), C.current = { from: A, to: de }, ne.current?.(C.current, B), J();
3474
+ let I = v.from + V, ae = v.to + V;
3475
+ I < 0 && (I = 0, ae = K - 1), ae > E.length - 1 && (ae = E.length - 1, I = ae - K + 1), S.current = { from: I, to: ae }, oe.current?.(S.current, E), Z();
3418
3476
  },
3419
- [J]
3420
- ), Ne = he(() => {
3421
- if (w.current) return;
3422
- const g = _.current;
3477
+ [Z]
3478
+ ), Ne = de(() => {
3479
+ if (M.current) return;
3480
+ const g = D.current;
3423
3481
  if (g.length === 0) return;
3424
- w.current = !0;
3425
- const b = Ft(n), K = g[0].time, B = K - b * l, j = K - b;
3426
- e.getBars({ symbol: t, resolution: n, from: B, to: j, countBack: l }).then((A) => {
3427
- if (A.length === 0) {
3428
- w.current = !1;
3482
+ M.current = !0;
3483
+ const v = Ft(n), K = g[0].time, E = K - v * l, V = K - v;
3484
+ e.getBars({ symbol: t, resolution: n, from: E, to: V, countBack: l }).then((I) => {
3485
+ if (I.length === 0) {
3486
+ M.current = !1;
3429
3487
  return;
3430
3488
  }
3431
- const V = [...A].sort((ce, me) => ce.time - me.time).filter((ce) => ce.time < K), T = C.current;
3432
- _.current = [...V, ...g], C.current = { from: T.from + V.length, to: T.to + V.length }, w.current = !1, J();
3489
+ const q = [...I].sort((ie, me) => ie.time - me.time).filter((ie) => ie.time < K), R = S.current;
3490
+ D.current = [...q, ...g], S.current = { from: R.from + q.length, to: R.to + q.length }, M.current = !1, Z();
3433
3491
  }).catch(() => {
3434
- w.current = !1;
3492
+ M.current = !1;
3435
3493
  });
3436
- }, [e, t, n, l, J]);
3437
- return /* @__PURE__ */ H(
3494
+ }, [e, t, n, l, Z]);
3495
+ return /* @__PURE__ */ F(
3438
3496
  "div",
3439
3497
  {
3440
- ref: W,
3441
- className: f(x.root, X),
3442
- style: { ...E, height: a, position: "relative" },
3498
+ ref: Y,
3499
+ className: f(k.root, W),
3500
+ style: { ...X, height: a, position: "relative" },
3443
3501
  tabIndex: 0,
3444
3502
  role: "figure",
3445
3503
  "aria-label": `${t} ${n} chart`,
@@ -3448,23 +3506,23 @@ function Ul({
3448
3506
  /* @__PURE__ */ s(
3449
3507
  "canvas",
3450
3508
  {
3451
- ref: ae,
3452
- className: x.svg,
3509
+ ref: Q,
3510
+ className: k.svg,
3453
3511
  onPointerDown: be,
3454
3512
  onPointerMove: pe,
3455
3513
  onPointerUp: fe,
3456
3514
  onPointerLeave: ge,
3457
3515
  onWheel: ve,
3458
- style: { cursor: le.current ? "grabbing" : "crosshair", touchAction: "none" }
3516
+ style: { cursor: re.current ? "grabbing" : "crosshair", touchAction: "none" }
3459
3517
  }
3460
3518
  ),
3461
- /* @__PURE__ */ H(
3519
+ /* @__PURE__ */ F(
3462
3520
  "div",
3463
3521
  {
3464
- className: x.tradingHeader,
3522
+ className: k.tradingHeader,
3465
3523
  style: {
3466
3524
  position: "absolute",
3467
- top: 6,
3525
+ top: rl,
3468
3526
  left: 8,
3469
3527
  right: 8,
3470
3528
  pointerEvents: "none",
@@ -3474,25 +3532,26 @@ function Ul({
3474
3532
  gap: 8
3475
3533
  },
3476
3534
  children: [
3477
- /* @__PURE__ */ H("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3535
+ /* @__PURE__ */ F("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3478
3536
  /* @__PURE__ */ s("strong", { children: t }),
3479
3537
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3480
- L?.bar && /* @__PURE__ */ H("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3538
+ he?.bar && /* @__PURE__ */ F("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3481
3539
  "O ",
3482
- L.bar.open.toFixed(c),
3540
+ he.bar.open.toFixed(c),
3483
3541
  " · H ",
3484
- L.bar.high.toFixed(c),
3542
+ he.bar.high.toFixed(c),
3485
3543
  " · L",
3486
3544
  " ",
3487
- L.bar.low.toFixed(c),
3545
+ he.bar.low.toFixed(c),
3488
3546
  " · C ",
3489
- L.bar.close.toFixed(c)
3547
+ he.bar.close.toFixed(c)
3490
3548
  ] })
3491
3549
  ] }),
3492
- $ && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3493
- zt,
3550
+ C && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3551
+ Yt,
3494
3552
  {
3495
3553
  position: "bottom",
3554
+ asChild: !0,
3496
3555
  trigger: /* @__PURE__ */ s(
3497
3556
  Ut,
3498
3557
  {
@@ -3500,14 +3559,14 @@ function Ul({
3500
3559
  size: "sm",
3501
3560
  iconOnly: !0,
3502
3561
  "aria-label": "Chart settings",
3503
- children: /* @__PURE__ */ s(ll, {})
3562
+ children: /* @__PURE__ */ s(dl, {})
3504
3563
  }
3505
3564
  ),
3506
3565
  content: /* @__PURE__ */ s(
3507
- il,
3566
+ al,
3508
3567
  {
3509
3568
  timezone: z,
3510
- onTimezoneChange: S
3569
+ onTimezoneChange: T
3511
3570
  }
3512
3571
  )
3513
3572
  }
@@ -3519,7 +3578,7 @@ function Ul({
3519
3578
  }
3520
3579
  );
3521
3580
  }
3522
- const cl = [
3581
+ const sl = [
3523
3582
  { value: "local", label: "Local time" },
3524
3583
  { value: "utc", label: "UTC" },
3525
3584
  { value: "America/New_York", label: "America / New York" },
@@ -3529,11 +3588,11 @@ const cl = [
3529
3588
  { value: "Asia/Tokyo", label: "Asia / Tokyo" },
3530
3589
  { value: "Asia/Singapore", label: "Asia / Singapore" }
3531
3590
  ];
3532
- function il({
3591
+ function al({
3533
3592
  timezone: e,
3534
3593
  onTimezoneChange: t
3535
3594
  }) {
3536
- return /* @__PURE__ */ H("div", { style: { minWidth: 220, padding: 4 }, children: [
3595
+ return /* @__PURE__ */ F("div", { style: { minWidth: 220, padding: 4 }, children: [
3537
3596
  /* @__PURE__ */ s(
3538
3597
  "div",
3539
3598
  {
@@ -3545,12 +3604,12 @@ function il({
3545
3604
  children: "Settings"
3546
3605
  }
3547
3606
  ),
3548
- /* @__PURE__ */ H("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3607
+ /* @__PURE__ */ F("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3549
3608
  /* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
3550
3609
  /* @__PURE__ */ s(
3551
- _t,
3610
+ zt,
3552
3611
  {
3553
- options: cl.map((n) => ({ value: n.value, label: n.label })),
3612
+ options: sl.map((n) => ({ value: n.value, label: n.label })),
3554
3613
  value: e,
3555
3614
  onChange: (n) => t(n)
3556
3615
  }
@@ -3558,8 +3617,8 @@ function il({
3558
3617
  ] })
3559
3618
  ] });
3560
3619
  }
3561
- function ll() {
3562
- return /* @__PURE__ */ H(
3620
+ function dl() {
3621
+ return /* @__PURE__ */ F(
3563
3622
  "svg",
3564
3623
  {
3565
3624
  viewBox: "0 0 24 24",
@@ -3577,14 +3636,14 @@ function ll() {
3577
3636
  );
3578
3637
  }
3579
3638
  function Nt(e, t, n, r) {
3580
- const i = Math.max(0, e - Rt), c = el, l = Math.max(c, t - Ct), a = Math.max(0, i - 0), h = Math.max(0, l - c);
3639
+ const i = Math.max(0, e - Rt), c = nl, l = Math.max(c, t - Ct), a = Math.max(0, i - 0), h = Math.max(0, l - c);
3581
3640
  let u = h, d = c;
3582
3641
  const m = { top: c, bottom: l, height: h };
3583
- let p = null, y = null;
3584
- const $ = n ? Wt.rsi : 0, k = r ? Wt.volume : 0;
3585
- return u = h * (1 - $ - k), m.top = d, m.height = u, m.bottom = m.top + u, d = m.bottom, n && (p = { top: d, height: h * $, bottom: d + h * $ }, d = p.bottom), r && (y = { top: d, height: h * k, bottom: d + h * k }), { width: e, height: t, plotLeft: 0, plotRight: i, plotTop: c, plotBottom: l, plotWidth: a, plotHeight: h, main: m, rsi: p, volume: y };
3642
+ let p = null, x = null;
3643
+ const C = n ? Wt.rsi : 0, $ = r ? Wt.volume : 0;
3644
+ return u = h * (1 - C - $), m.top = d, m.height = u, m.bottom = m.top + u, d = m.bottom, n && (p = { top: d, height: h * C, bottom: d + h * C }, d = p.bottom), r && (x = { top: d, height: h * $, bottom: d + h * $ }), { width: e, height: t, plotLeft: 0, plotRight: i, plotTop: c, plotBottom: l, plotWidth: a, plotHeight: h, main: m, rsi: p, volume: x };
3586
3645
  }
3587
- function sl(e, t) {
3646
+ function ul(e, t) {
3588
3647
  if (t === 0) return { from: 0, to: 0 };
3589
3648
  let { from: n, to: r } = e;
3590
3649
  if (r >= t) {
@@ -3593,13 +3652,13 @@ function sl(e, t) {
3593
3652
  }
3594
3653
  return n < 0 && (n = 0), r < n && (r = n), { from: n, to: r };
3595
3654
  }
3596
- function al(e, t) {
3655
+ function hl(e, t) {
3597
3656
  if (e.type === "sma")
3598
- return { kind: "line", values: Gi(t, e.period), color: e.color ?? "var(--crk-chart-2)" };
3657
+ return { kind: "line", values: Ki(t, e.period), color: e.color ?? "var(--crk-chart-2)" };
3599
3658
  if (e.type === "ema")
3600
- return { kind: "line", values: Zi(t, e.period), color: e.color ?? "var(--crk-chart-3)" };
3659
+ return { kind: "line", values: Qi(t, e.period), color: e.color ?? "var(--crk-chart-3)" };
3601
3660
  if (e.type === "bollinger") {
3602
- const n = Ki(t, e.period, e.stdDev ?? 2);
3661
+ const n = Ji(t, e.period, e.stdDev ?? 2);
3603
3662
  return {
3604
3663
  kind: "bollinger",
3605
3664
  middle: n.middle,
@@ -3611,17 +3670,17 @@ function al(e, t) {
3611
3670
  }
3612
3671
  return null;
3613
3672
  }
3614
- function nn(e, t, n, r, o) {
3673
+ function rn(e, t, n, r, o) {
3615
3674
  let i = 1 / 0, c = -1 / 0;
3616
3675
  for (const d of t)
3617
3676
  d.low < i && (i = d.low), d.high > c && (c = d.high);
3618
3677
  for (const d of n) {
3619
3678
  const m = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3620
3679
  for (const p of m) {
3621
- const y = Math.max(0, Math.floor(r)), $ = Math.min(p.length - 1, Math.ceil(o));
3622
- for (let k = y; k <= $; k++) {
3623
- const R = p[k];
3624
- R != null && (R < i && (i = R), R > c && (c = R));
3680
+ const x = Math.max(0, Math.floor(r)), C = Math.min(p.length - 1, Math.ceil(o));
3681
+ for (let $ = x; $ <= C; $++) {
3682
+ const b = p[$];
3683
+ b != null && (b < i && (i = b), b > c && (c = b));
3625
3684
  }
3626
3685
  }
3627
3686
  }
@@ -3629,7 +3688,7 @@ function nn(e, t, n, r, o) {
3629
3688
  const l = (c - i) * 0.08 || 1, a = qe(i - l, c + l, 5), h = Math.min(a[0], i), u = Math.max(a[a.length - 1], c);
3630
3689
  return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: h, priceMax: u, ticks: a };
3631
3690
  }
3632
- function dl(e, t, n, r) {
3691
+ function ml(e, t, n, r) {
3633
3692
  let o = 0;
3634
3693
  const i = Math.max(0, Math.floor(n)), c = Math.min(t.length - 1, Math.ceil(r));
3635
3694
  for (let h = i; h <= c; h++) {
@@ -3643,7 +3702,7 @@ function we(e, t) {
3643
3702
  const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
3644
3703
  return t.paneBottom - n * t.paneHeight;
3645
3704
  }
3646
- function rn(e) {
3705
+ function on(e) {
3647
3706
  if (!e || typeof getComputedStyle > "u") return (o) => o;
3648
3707
  const t = getComputedStyle(e), n = /* @__PURE__ */ new Map(), r = (o) => {
3649
3708
  if (!o || !o.includes("var(")) return o;
@@ -3660,8 +3719,8 @@ function rn(e) {
3660
3719
  };
3661
3720
  return r;
3662
3721
  }
3663
- function ul(e, t) {
3664
- const n = rn(e);
3722
+ function fl(e, t) {
3723
+ const n = on(e);
3665
3724
  return {
3666
3725
  up: n(t.up),
3667
3726
  down: n(t.down),
@@ -3673,7 +3732,7 @@ function ul(e, t) {
3673
3732
  bg: n("var(--crk-color-bg)") || "#ffffff"
3674
3733
  };
3675
3734
  }
3676
- function hl(e, t, n, r) {
3735
+ function pl(e, t, n, r) {
3677
3736
  e.fillStyle = r.textMuted, e.font = "13px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle", e.fillText("Loading…", t / 2, n / 2);
3678
3737
  }
3679
3738
  function Lt(e, t, n, r, o, i = !1) {
@@ -3684,33 +3743,33 @@ function Lt(e, t, n, r, o, i = !1) {
3684
3743
  }
3685
3744
  e.stroke();
3686
3745
  }
3687
- function ml(e, t, n, r, o) {
3746
+ function gl(e, t, n, r, o) {
3688
3747
  e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
3689
3748
  for (const i of n.ticks) {
3690
3749
  const c = we(i, n);
3691
3750
  e.fillText(i.toFixed(r), t.plotRight + 6, c);
3692
3751
  }
3693
3752
  }
3694
- function fl(e, t, n, r, o, i, c, l) {
3753
+ function yl(e, t, n, r, o, i, c, l) {
3695
3754
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, i * 0.7);
3696
3755
  for (let d = a; d <= h; d++) {
3697
- const m = t[d], p = o(d), y = we(m.open, c), $ = we(m.close, c), k = we(m.high, c), R = we(m.low, c), E = m.close >= m.open ? l.up : l.down;
3698
- e.strokeStyle = E, e.fillStyle = E, e.beginPath();
3699
- const W = Math.round(p) + 0.5;
3700
- e.moveTo(W, k), e.lineTo(W, R), e.stroke();
3701
- const ae = Math.min(y, $), _ = Math.max(1, Math.abs($ - y));
3702
- e.fillRect(Math.round(p - u / 2), Math.round(ae), Math.round(u), Math.round(_));
3756
+ const m = t[d], p = o(d), x = we(m.open, c), C = we(m.close, c), $ = we(m.high, c), b = we(m.low, c), X = m.close >= m.open ? l.up : l.down;
3757
+ e.strokeStyle = X, e.fillStyle = X, e.beginPath();
3758
+ const Y = Math.round(p) + 0.5;
3759
+ e.moveTo(Y, $), e.lineTo(Y, b), e.stroke();
3760
+ const Q = Math.min(x, C), D = Math.max(1, Math.abs(C - x));
3761
+ e.fillRect(Math.round(p - u / 2), Math.round(Q), Math.round(u), Math.round(D));
3703
3762
  }
3704
3763
  }
3705
- function pl(e, t, n, r, o, i, c, l) {
3764
+ function vl(e, t, n, r, o, i, c, l) {
3706
3765
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(i * 0.4, 8));
3707
3766
  e.lineWidth = Math.max(1, Math.min(2, i * 0.18)), e.lineCap = "butt";
3708
3767
  for (let d = a; d <= h; d++) {
3709
- const m = t[d], p = Math.round(o(d)) + 0.5, y = we(m.high, c), $ = we(m.low, c), k = we(m.open, c), R = we(m.close, c), X = m.close >= m.open;
3710
- e.strokeStyle = X ? l.up : l.down, e.beginPath(), e.moveTo(p, y), e.lineTo(p, $), e.moveTo(p - u, k), e.lineTo(p, k), e.moveTo(p, R), e.lineTo(p + u, R), e.stroke();
3768
+ const m = t[d], p = Math.round(o(d)) + 0.5, x = we(m.high, c), C = we(m.low, c), $ = we(m.open, c), b = we(m.close, c), W = m.close >= m.open;
3769
+ e.strokeStyle = W ? l.up : l.down, e.beginPath(), e.moveTo(p, x), e.lineTo(p, C), e.moveTo(p - u, $), e.lineTo(p, $), e.moveTo(p, b), e.lineTo(p + u, b), e.stroke();
3711
3770
  }
3712
3771
  }
3713
- function gl(e, t, n, r, o, i, c, l) {
3772
+ function bl(e, t, n, r, o, i, c, l) {
3714
3773
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3715
3774
  if (!(h <= a)) {
3716
3775
  e.strokeStyle = c, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, i));
@@ -3719,7 +3778,7 @@ function gl(e, t, n, r, o, i, c, l) {
3719
3778
  e.stroke(), l && (e.globalAlpha = 0.18, e.fillStyle = c, e.lineTo(o(h), i.paneBottom), e.lineTo(o(a), i.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
3720
3779
  }
3721
3780
  }
3722
- function yl(e, t, n, r, o, i, c, l) {
3781
+ function xl(e, t, n, r, o, i, c, l) {
3723
3782
  if (t.kind === "line") {
3724
3783
  Qe(e, t.values, o, i, c, l, t.color);
3725
3784
  return;
@@ -3730,8 +3789,8 @@ function yl(e, t, n, r, o, i, c, l) {
3730
3789
  for (let d = a; d <= h; d++) {
3731
3790
  const m = t.upper[d];
3732
3791
  if (m == null) continue;
3733
- const p = c(d), y = we(m, l);
3734
- u ? e.lineTo(p, y) : (e.moveTo(p, y), u = !0);
3792
+ const p = c(d), x = we(m, l);
3793
+ u ? e.lineTo(p, x) : (e.moveTo(p, x), u = !0);
3735
3794
  }
3736
3795
  for (let d = h; d >= a; d--) {
3737
3796
  const m = t.lower[d];
@@ -3754,19 +3813,19 @@ function Qe(e, t, n, r, o, i, c) {
3754
3813
  }
3755
3814
  e.stroke();
3756
3815
  }
3757
- function vl(e, t, n, r, o, i, c, l) {
3816
+ function kl(e, t, n, r, o, i, c, l) {
3758
3817
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, i * 0.7);
3759
3818
  for (let d = a; d <= h; d++) {
3760
3819
  const m = t[d], p = m.volume ?? 0;
3761
3820
  if (p === 0) continue;
3762
- const y = m.close >= m.open;
3763
- e.fillStyle = y ? l.up : l.down, e.globalAlpha = 0.55;
3764
- const $ = we(p, c), k = c.paneBottom - $;
3765
- e.fillRect(Math.round(o(d) - u / 2), Math.round($), Math.round(u), Math.round(k));
3821
+ const x = m.close >= m.open;
3822
+ e.fillStyle = x ? l.up : l.down, e.globalAlpha = 0.55;
3823
+ const C = we(p, c), $ = c.paneBottom - C;
3824
+ e.fillRect(Math.round(o(d) - u / 2), Math.round(C), Math.round(u), Math.round($));
3766
3825
  }
3767
3826
  e.globalAlpha = 1;
3768
3827
  }
3769
- function bl(e, t, n, r, o, i) {
3828
+ function Ml(e, t, n, r, o, i) {
3770
3829
  e.strokeStyle = i.grid, e.setLineDash([3, 3]), e.beginPath();
3771
3830
  for (const c of [r, o]) {
3772
3831
  const l = Math.round(we(c, n)) + 0.5;
@@ -3777,45 +3836,45 @@ function bl(e, t, n, r, o, i) {
3777
3836
  function Ot(e, t, n, r, o) {
3778
3837
  e.fillStyle = o.textMuted, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "top", e.fillText(r, t.plotLeft + 6, n.top + 4);
3779
3838
  }
3780
- function xl(e, t, n, r, o, i, c) {
3839
+ function wl(e, t, n, r, o, i, c) {
3781
3840
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3782
3841
  e.fillStyle = c.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3783
3842
  const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + Ct / 2;
3784
3843
  for (let p = u; p <= d; p += h) {
3785
- const y = n[p], $ = t.plotLeft + (p - r + 0.5) * a;
3786
- e.fillText(wl(y.time, i), $, m);
3844
+ const x = n[p], C = t.plotLeft + (p - r + 0.5) * a;
3845
+ e.fillText(Ll(x.time, i), C, m);
3787
3846
  }
3788
3847
  }
3789
- function kl(e, t, n, r, o, i, c, l, a, h, u) {
3848
+ function $l(e, t, n, r, o, i, c, l, a, h, u) {
3790
3849
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3791
- const d = i - o + 1, m = t.plotWidth / d, p = o + (n.x - t.plotLeft) / m - 0.5, y = Math.round(p), $ = Math.max(0, Math.min(r.length - 1, y)), k = c($);
3792
- if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(k + 0.5, t.plotTop), e.lineTo(k + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
3793
- const R = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3794
- e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Rt, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(R.toFixed(l), t.plotRight + 6, n.y);
3850
+ const d = i - o + 1, m = t.plotWidth / d, p = o + (n.x - t.plotLeft) / m - 0.5, x = Math.round(p), C = Math.max(0, Math.min(r.length - 1, x)), $ = c(C);
3851
+ if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo($ + 0.5, t.plotTop), e.lineTo($ + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
3852
+ const b = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3853
+ e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Rt, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(b.toFixed(l), t.plotRight + 6, n.y);
3795
3854
  }
3796
- if (r[$]) {
3797
- const R = on(r[$].time, h);
3855
+ if (r[C]) {
3856
+ const b = cn(r[C].time, h);
3798
3857
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3799
- const W = e.measureText(R).width + 8 * 2, ae = Ct, _ = Math.max(
3858
+ const Y = e.measureText(b).width + 8 * 2, Q = Ct, D = Math.max(
3800
3859
  t.plotLeft,
3801
- Math.min(t.plotRight - W, k - W / 2)
3802
- ), C = t.plotBottom;
3803
- e.fillStyle = u.text, e.fillRect(_, C, W, ae), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(R, _ + W / 2, C + ae / 2);
3860
+ Math.min(t.plotRight - Y, $ - Y / 2)
3861
+ ), S = t.plotBottom;
3862
+ e.fillStyle = u.text, e.fillRect(D, S, Y, Q), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(b, D + Y / 2, S + Q / 2);
3804
3863
  }
3805
3864
  e.restore();
3806
3865
  }
3807
- function Ml(e, t, n, r, o, i, c) {
3808
- const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a = nn(t.main, l, [], r, o);
3866
+ function Nl(e, t, n, r, o, i, c) {
3867
+ const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a = rn(t.main, l, [], r, o);
3809
3868
  return e < a.paneTop || e > a.paneBottom ? null : a.priceMax - (e - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3810
3869
  }
3811
- function wl(e, t) {
3870
+ function Ll(e, t) {
3812
3871
  const n = new Date(e * 1e3);
3813
3872
  return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())}` : `${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}`;
3814
3873
  }
3815
- function on(e, t) {
3874
+ function cn(e, t) {
3816
3875
  const n = new Date(e * 1e3);
3817
3876
  if (t === "local")
3818
- return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${$l(n)}`;
3877
+ return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Sl(n)}`;
3819
3878
  if (t === "utc")
3820
3879
  return `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())} ${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}:${Te(n.getUTCSeconds())} UTC`;
3821
3880
  try {
@@ -3833,10 +3892,10 @@ function on(e, t) {
3833
3892
  }).formatToParts(n), i = (l) => o.find((a) => a.type === l)?.value ?? "", c = i("timeZoneName") || t;
3834
3893
  return `${i("year")}-${i("month")}-${i("day")} ${i("hour")}:${i("minute")}:${i("second")} ${c}`;
3835
3894
  } catch {
3836
- return on(e, "utc");
3895
+ return cn(e, "utc");
3837
3896
  }
3838
3897
  }
3839
- function $l(e) {
3898
+ function Sl(e) {
3840
3899
  const t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
3841
3900
  return `${n}${Te(Math.floor(r / 60))}:${Te(r % 60)}`;
3842
3901
  }
@@ -3859,7 +3918,7 @@ function Ft(e) {
3859
3918
  }
3860
3919
  return 60;
3861
3920
  }
3862
- function Nl(e, t) {
3921
+ function Tl(e, t) {
3863
3922
  if (e.length === 0) return "";
3864
3923
  if (e.length === 1 || t === "linear")
3865
3924
  return e.map((r, o) => `${o === 0 ? "M" : "L"} ${r.x} ${r.y}`).join(" ");
@@ -3870,7 +3929,7 @@ function Nl(e, t) {
3870
3929
  }
3871
3930
  return n;
3872
3931
  }
3873
- const Ll = $e(
3932
+ const Rl = $e(
3874
3933
  ({
3875
3934
  data: e,
3876
3935
  width: t = 80,
@@ -3884,16 +3943,16 @@ const Ll = $e(
3884
3943
  className: h,
3885
3944
  style: u
3886
3945
  }, d) => {
3887
- const { line: m, area: p, last: y } = ke(() => {
3946
+ const { line: m, area: p, last: x } = ke(() => {
3888
3947
  if (e.length === 0) return { line: "", area: "", last: null };
3889
- const $ = o, k = Math.max(1, t - $ * 2), R = Math.max(1, n - $ * 2), [X, E] = bt(e), W = Je([0, Math.max(1, e.length - 1)], [$, $ + k]), ae = Je([X, E], [$ + R, $]), _ = e.map((le, w) => ({ x: W(w), y: ae(le) })), C = Nl(_, i), oe = c ? `${C} L ${_[_.length - 1].x} ${$ + R} L ${_[0].x} ${$ + R} Z` : "";
3890
- return { line: C, area: oe, last: _[_.length - 1] };
3948
+ const C = o, $ = Math.max(1, t - C * 2), b = Math.max(1, n - C * 2), [W, X] = bt(e), Y = Je([0, Math.max(1, e.length - 1)], [C, C + $]), Q = Je([W, X], [C + b, C]), D = e.map((re, M) => ({ x: Y(M), y: Q(re) })), S = Tl(D, i), ee = c ? `${S} L ${D[D.length - 1].x} ${C + b} L ${D[0].x} ${C + b} Z` : "";
3949
+ return { line: S, area: ee, last: D[D.length - 1] };
3891
3950
  }, [e, t, n, o, i, c]);
3892
- return /* @__PURE__ */ H(
3951
+ return /* @__PURE__ */ F(
3893
3952
  "svg",
3894
3953
  {
3895
3954
  ref: d,
3896
- className: f(x.sparkline, h),
3955
+ className: f(k.sparkline, h),
3897
3956
  style: u,
3898
3957
  width: t,
3899
3958
  height: n,
@@ -3913,51 +3972,51 @@ const Ll = $e(
3913
3972
  strokeLinecap: "round"
3914
3973
  }
3915
3974
  ),
3916
- l && y && /* @__PURE__ */ s("circle", { cx: y.x, cy: y.y, r: o + 1, fill: r })
3975
+ l && x && /* @__PURE__ */ s("circle", { cx: x.x, cy: x.y, r: o + 1, fill: r })
3917
3976
  ]
3918
3977
  }
3919
3978
  );
3920
3979
  }
3921
3980
  );
3922
- Ll.displayName = "Sparkline";
3981
+ Rl.displayName = "Sparkline";
3923
3982
  export {
3924
- Pl as AreaChart,
3925
- Wl as BarChart,
3983
+ Ol as AreaChart,
3984
+ Fl as BarChart,
3926
3985
  Ut as Button,
3927
- Hc as Checkbox,
3928
- _t as Dropdown,
3929
- ao as DropdownItem,
3930
- Bl as Form,
3931
- Dl as FormField,
3932
- Il as FormRow,
3933
- ec as Input,
3934
- El as LineChart,
3935
- Fn as Link,
3936
- vr as List,
3937
- br as ListItem,
3986
+ Fc as Checkbox,
3987
+ zt as Dropdown,
3988
+ uo as DropdownItem,
3989
+ El as Form,
3990
+ Pl as FormField,
3991
+ Wl as FormRow,
3992
+ nc as Input,
3993
+ Hl as LineChart,
3994
+ jn as Link,
3995
+ br as List,
3996
+ xr as ListItem,
3938
3997
  yt as Modal,
3939
- Hl as PieChart,
3940
- zt as Popover,
3941
- Ol as RadarChart,
3942
- _c as Radio,
3943
- Uc as RadioGroup,
3944
- Dc as Select,
3945
- Ll as Sparkline,
3946
- Al as Table,
3947
- ni as Textarea,
3948
- Ul as TradingChart,
3949
- ar as Typography,
3950
- Ki as bollinger,
3951
- Zi as ema,
3952
- on as formatCrosshairTime,
3953
- tn as periodToSeconds,
3954
- Qi as rsi,
3955
- Gi as sma,
3956
- Xl as suggestPeriodForResolution,
3957
- jl as suggestResolutionForPeriod,
3998
+ jl as PieChart,
3999
+ Yt as Popover,
4000
+ Xl as RadarChart,
4001
+ Yc as Radio,
4002
+ zc as RadioGroup,
4003
+ Ec as Select,
4004
+ Rl as Sparkline,
4005
+ Il as Table,
4006
+ oi as Textarea,
4007
+ Yl as TradingChart,
4008
+ dr as Typography,
4009
+ Ji as bollinger,
4010
+ Qi as ema,
4011
+ cn as formatCrosshairTime,
4012
+ nn as periodToSeconds,
4013
+ el as rsi,
4014
+ Ki as sma,
4015
+ zl as suggestPeriodForResolution,
4016
+ Ul as suggestResolutionForPeriod,
3958
4017
  pt as useClickOutside,
3959
- bo as useFocusTrap,
4018
+ ko as useFocusTrap,
3960
4019
  Tt as useKeyboard,
3961
- _r as useTableSort,
3962
- Fl as volumeSeries
4020
+ zr as useTableSort,
4021
+ _l as volumeSeries
3963
4022
  };