@overdoser/react-toolkit 0.0.8 → 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,18 +1,18 @@
1
- import { forwardRef as $e, createElement as ln, useState as Se, useCallback as he, useMemo as ke, useEffect as Be, useRef as ne, useId as ze, isValidElement as sn, cloneElement as jt, createContext as Xt, useContext as ft, useImperativeHandle as an, useLayoutEffect as dn } from "react";
2
- import { jsxs as H, jsx as s, Fragment as Ve } from "react/jsx-runtime";
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
3
  import { FormProvider as un, useFormContext as hn, useController as mn } from "react-hook-form";
4
4
  import { createPortal as fn } from "react-dom";
5
- function Ut(e) {
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 = Ut(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 = Ut(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
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 = {
@@ -41,7 +41,7 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
41
41
  dots: Ae.loadingDots,
42
42
  shimmer: Ae.loadingShimmer,
43
43
  border: Ae.loadingBorder
44
- }, _t = $e(
44
+ }, Ut = $e(
45
45
  ({
46
46
  variant: e = "primary",
47
47
  size: t = "md",
@@ -53,9 +53,9 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
53
53
  classes: l,
54
54
  className: a,
55
55
  style: h,
56
- children: d,
57
- ...u
58
- }, m) => /* @__PURE__ */ H(
56
+ children: u,
57
+ ...d
58
+ }, m) => /* @__PURE__ */ F(
59
59
  "button",
60
60
  {
61
61
  ref: m,
@@ -73,11 +73,11 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
73
73
  style: h,
74
74
  disabled: c || n,
75
75
  "aria-busy": n || void 0,
76
- ...u,
76
+ ...d,
77
77
  children: [
78
78
  /* @__PURE__ */ s("div", { className: f(Ae.shimmer, l?.shimmer) }),
79
- /* @__PURE__ */ s("span", { className: f(Ae.content, l?.content), children: d }),
80
- /* @__PURE__ */ H("span", { className: f(Ae.dots, l?.dots), "aria-hidden": "true", children: [
79
+ /* @__PURE__ */ s("span", { className: f(Ae.content, l?.content), children: u }),
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) })
@@ -86,7 +86,7 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
86
86
  }
87
87
  )
88
88
  );
89
- _t.displayName = "Button";
89
+ Ut.displayName = "Button";
90
90
  const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn = "crk-srOnly-LGQgs", $t = {
91
91
  root: Wn,
92
92
  default: "crk-default-3TBlr",
@@ -101,7 +101,7 @@ const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn
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,
@@ -120,13 +120,13 @@ const Wn = "crk-root-2j4Vp", Hn = "crk-muted-vReNc", On = "crk-danger-ugf9r", Fn
120
120
  )
121
121
  );
122
122
  jn.displayName = "Link";
123
- const Xn = "crk-root-U-oiq", Un = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", zn = "crk-h3-lrbrK", Vn = "crk-h4--jkC1", Yn = "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", _e = {
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
124
  root: Xn,
125
- h1: Un,
126
- h2: _n,
125
+ h1: _n,
126
+ h2: Un,
127
127
  h3: zn,
128
- h4: Vn,
129
- h5: Yn,
128
+ h4: Yn,
129
+ h5: Vn,
130
130
  h6: qn,
131
131
  p: Gn,
132
132
  span: Zn,
@@ -160,12 +160,12 @@ const Xn = "crk-root-U-oiq", Un = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", zn = "crk
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,
@@ -222,7 +222,7 @@ const xr = $e(
222
222
  )
223
223
  );
224
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", Ur = "crk-pageEllipsis-en59J", ye = {
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
226
  wrapper: kr,
227
227
  root: Mr,
228
228
  headerCell: wr,
@@ -245,48 +245,48 @@ const kr = "crk-wrapper-zxjMt", Mr = "crk-root-Gf85-", wr = "crk-headerCell-ePPZ
245
245
  paginatorNav: Fr,
246
246
  pageButton: jr,
247
247
  pageButtonActive: Xr,
248
- pageEllipsis: Ur
248
+ pageEllipsis: _r
249
249
  };
250
- function _r(e, t) {
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
253
  function zr(e, t = []) {
254
- const [n, r] = Se(t), o = he((a) => {
254
+ const [n, r] = Se(t), o = de((a) => {
255
255
  r((h) => {
256
- const d = h.find((u) => u.key === a);
257
- return d ? d.direction === "asc" ? [{ key: a, direction: "desc" }] : [] : [{ key: a, direction: "asc" }];
256
+ const u = h.find((d) => d.key === a);
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
- const d = h.findIndex((m) => m.key === a);
262
- if (d === -1)
261
+ const u = h.findIndex((m) => m.key === a);
262
+ if (u === -1)
263
263
  return [...h, { key: a, direction: "asc" }];
264
- if (h[d].direction === "asc") {
264
+ if (h[u].direction === "asc") {
265
265
  const m = [...h];
266
- return m[d] = { key: a, direction: "desc" }, m;
266
+ return m[u] = { key: a, direction: "desc" }, m;
267
267
  }
268
- return h.filter((m, p) => p !== d);
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) => {
274
- for (const { key: d, direction: u } of n) {
275
- const m = _r(a[d], h[d]);
274
+ for (const { key: u, direction: d } of n) {
275
+ const m = Ur(a[u], h[u]);
276
276
  if (m !== 0)
277
- return u === "asc" ? m : -m;
277
+ return d === "asc" ? m : -m;
278
278
  }
279
279
  return 0;
280
280
  }), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: i, resetSort: c };
281
281
  }
282
- function Vr({ 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,
@@ -295,35 +295,35 @@ function Yr({
295
295
  paginatorClasses: i
296
296
  }) {
297
297
  const c = Math.max(1, Math.ceil(n / t)), l = (e - 1) * t + 1, a = Math.min(e * t, n), h = ke(() => {
298
- const d = [];
298
+ const u = [];
299
299
  if (c <= 7)
300
- for (let u = 1; u <= c; u++) d.push(u);
300
+ for (let d = 1; d <= c; d++) u.push(d);
301
301
  else {
302
- d.push(1), e > 3 && d.push("ellipsis");
303
- for (let u = Math.max(2, e - 1); u <= Math.min(c - 1, e + 1); u++)
304
- d.push(u);
305
- e < c - 2 && d.push("ellipsis"), d.push(c);
302
+ u.push(1), e > 3 && u.push("ellipsis");
303
+ for (let d = Math.max(2, e - 1); d <= Math.min(c - 1, e + 1); d++)
304
+ u.push(d);
305
+ e < c - 2 && u.push("ellipsis"), u.push(c);
306
306
  }
307
- return d;
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",
314
314
  {
315
315
  className: ye.pageSizeSelect,
316
316
  value: t,
317
- onChange: (d) => o(1, Number(d.target.value)),
317
+ onChange: (u) => o(1, Number(u.target.value)),
318
318
  "aria-label": "Rows per page",
319
- children: r.map((d) => /* @__PURE__ */ H("option", { value: d, children: [
320
- d,
319
+ children: r.map((u) => /* @__PURE__ */ F("option", { value: u, children: [
320
+ u,
321
321
  " / page"
322
- ] }, d))
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
  {
@@ -336,17 +336,17 @@ function Yr({
336
336
  }
337
337
  ),
338
338
  h.map(
339
- (d, u) => d === "ellipsis" ? /* @__PURE__ */ s("span", { className: ye.pageEllipsis, children: "…" }, `ellipsis-${u}`) : /* @__PURE__ */ s(
339
+ (u, d) => u === "ellipsis" ? /* @__PURE__ */ s("span", { className: ye.pageEllipsis, children: "…" }, `ellipsis-${d}`) : /* @__PURE__ */ s(
340
340
  "button",
341
341
  {
342
342
  type: "button",
343
- className: f(ye.pageButton, d === e && ye.pageButtonActive, i?.pageButton),
344
- onClick: () => o(d, t),
345
- "aria-label": `Page ${d}`,
346
- "aria-current": d === e ? "page" : void 0,
347
- children: d
343
+ className: f(ye.pageButton, u === e && ye.pageButtonActive, i?.pageButton),
344
+ onClick: () => o(u, t),
345
+ "aria-label": `Page ${u}`,
346
+ "aria-current": u === e ? "page" : void 0,
347
+ children: u
348
348
  },
349
- d
349
+ u
350
350
  )
351
351
  ),
352
352
  /* @__PURE__ */ s(
@@ -374,52 +374,52 @@ function qr({
374
374
  compact: l = !1,
375
375
  className: a,
376
376
  style: h,
377
- rowKey: d,
378
- emptyMessage: u = "No data",
377
+ rowKey: u,
378
+ emptyMessage: d = "No data",
379
379
  pagination: m,
380
380
  classes: p
381
381
  }) {
382
- const y = r !== void 0, {
383
- sortedData: w,
384
- sortConfig: N,
385
- requestSort: S,
386
- requestMultiSort: O
387
- } = zr(e, n), P = y ? n ?? [] : N, U = y ? e : w, re = ke(() => {
388
- if (!m || y) return U;
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
389
  const M = (m.page - 1) * m.pageSize;
390
- return U.slice(M, M + m.pageSize);
391
- }, [U, m, y]), D = m?.totalRows ?? U.length, C = he(
392
- (M, q) => {
393
- const I = o && (q.ctrlKey || q.metaKey);
394
- if (y)
395
- if (I) {
396
- const Q = P.findIndex((W) => W.key === M);
397
- let F;
398
- Q === -1 ? F = [...P, { key: M, direction: "asc" }] : P[Q].direction === "asc" ? F = P.map(
399
- (W, te) => te === Q ? { key: M, direction: "desc" } : W
400
- ) : F = P.filter((W, te) => te !== Q), r(F);
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 = P.find((F) => F.key === M);
403
- Q ? Q.direction === "asc" ? r([{ key: M, direction: "desc" }]) : r([]) : r([{ key: M, 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
- I ? O(M) : S(M);
406
+ O ? W(M) : b(M);
407
407
  },
408
408
  [
409
- y,
409
+ x,
410
410
  o,
411
- P,
411
+ X,
412
412
  r,
413
- S,
414
- O
413
+ b,
414
+ W
415
415
  ]
416
- ), ee = (M) => P.find((I) => I.key === M)?.direction, se = (M) => {
417
- if (P.length <= 1) return;
418
- const q = P.findIndex((I) => I.key === M);
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,7 +432,7 @@ function qr({
432
432
  ),
433
433
  style: h,
434
434
  children: [
435
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((M) => /* @__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(
@@ -444,38 +444,38 @@ function qr({
444
444
  width: M.width,
445
445
  textAlign: M.align
446
446
  },
447
- onClick: M.sortable ? (q) => C(M.key, q) : void 0,
447
+ onClick: M.sortable ? (G) => S(M.key, G) : void 0,
448
448
  "aria-sort": M.sortable ? ee(M.key) === "asc" ? "ascending" : ee(M.key) === "desc" ? "descending" : "none" : void 0,
449
449
  children: [
450
450
  M.header,
451
451
  M.sortable && /* @__PURE__ */ s(
452
- Vr,
452
+ Yr,
453
453
  {
454
454
  direction: ee(M.key),
455
- sortIndex: se(M.key)
455
+ sortIndex: re(M.key)
456
456
  }
457
457
  )
458
458
  ]
459
459
  },
460
460
  M.key
461
461
  )) }) }),
462
- /* @__PURE__ */ s("tbody", { children: re.length === 0 ? /* @__PURE__ */ s("tr", { className: ye.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ye.emptyCell, p?.emptyCell), colSpan: t.length, children: u }) }) : re.map((M, q) => {
463
- const I = d ? String(M[d]) : 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(M[Q.key], M, q) : M[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
- )) }, I);
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
481
  totalRows: D,
@@ -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);
@@ -539,95 +539,95 @@ const zt = $e(
539
539
  onClose: l,
540
540
  options: a,
541
541
  placeholder: h = "Select...",
542
- value: d,
543
- onChange: u,
542
+ value: u,
543
+ onChange: d,
544
544
  error: m = !1,
545
545
  fullWidth: p = !0,
546
- classes: y
547
- }, w) => {
548
- const [N, S] = Se(!1), O = ne(null), P = ne(null), U = ne(null), re = 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
- N && P.current && P.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
551
- }, [N]);
552
- const D = he(() => {
553
- S(!1), l?.(), U.current?.focus();
554
- }, [l]), C = he(() => {
555
- S((I) => {
556
- const Q = !I;
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]), ee = he(
560
- (I) => {
561
- u?.(I), D();
559
+ }, [c, l]), ee = de(
560
+ (O) => {
561
+ d?.(O), D();
562
562
  },
563
- [u, D]
563
+ [d, D]
564
564
  );
565
- pt(O, D, N), Tt(
565
+ pt(W, D, $), Tt(
566
566
  {
567
567
  Escape: () => D()
568
568
  },
569
- N
569
+ $
570
570
  );
571
- const se = a?.find((I) => I.value === d)?.label, M = a ? se || h : e, q = a && !se;
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: w,
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: O, 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: U,
582
+ ref: Y,
583
583
  id: i,
584
584
  type: "button",
585
585
  className: f(
586
586
  Me.trigger,
587
- N && 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": N,
592
+ onClick: S,
593
+ "aria-expanded": $,
594
594
  "aria-haspopup": "menu",
595
- "aria-controls": N ? re : 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: M }),
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: P,
606
- id: re,
605
+ ref: X,
606
+ id: Q,
607
607
  className: f(
608
608
  Me.menu,
609
- N && 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((I) => /* @__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
- I.disabled && Me.itemDisabled,
623
- I.value === d && Me.itemSelected,
624
- y?.item
622
+ O.disabled && Me.itemDisabled,
623
+ O.value === u && Me.itemSelected,
624
+ x?.item
625
625
  ),
626
- disabled: I.disabled,
627
- onClick: () => ee(I.value),
628
- children: I.label
626
+ disabled: O.disabled,
627
+ onClick: () => ee(O.value),
628
+ children: O.label
629
629
  },
630
- I.value
630
+ O.value
631
631
  )) : t
632
632
  }
633
633
  )
@@ -677,7 +677,7 @@ function xo(...e) {
677
677
  n && (typeof n == "function" ? n(t) : n.current = t);
678
678
  };
679
679
  }
680
- const Vt = $e(
680
+ const Yt = $e(
681
681
  ({
682
682
  trigger: e,
683
683
  asChild: t = !1,
@@ -689,53 +689,53 @@ const Vt = $e(
689
689
  className: l,
690
690
  style: a
691
691
  }, h) => {
692
- const [d, u] = Se(!1), m = ne(null), p = ne(null), y = ne(null), w = ze(), N = o !== void 0, S = N ? o : d, O = he(
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
693
  (D) => {
694
- N || u(D), i?.(D);
694
+ $ || d(D), i?.(D);
695
695
  },
696
- [N, i]
697
- ), P = he(() => {
698
- O(!1), y.current?.focus();
699
- }, [O]), U = he(() => {
700
- O(!S);
701
- }, [S, O]);
702
- pt(m, P, S), 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(
703
703
  {
704
- Escape: () => P()
704
+ Escape: () => X()
705
705
  },
706
- S
706
+ b
707
707
  ), Be(() => {
708
- if (S && p.current) {
708
+ if (b && p.current) {
709
709
  const D = p.current.querySelector(
710
710
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
711
711
  );
712
712
  D ? D.focus() : p.current.focus();
713
713
  }
714
- }, [S]);
715
- let re;
714
+ }, [b]);
715
+ let Q;
716
716
  if (t && sn(e)) {
717
- const D = e, C = D.ref;
718
- re = jt(D, {
719
- ref: xo(y, C),
717
+ const D = e, S = D.ref;
718
+ Q = jt(D, {
719
+ ref: xo(x, S),
720
720
  onClick: (ee) => {
721
- D.props.onClick?.(ee), U();
721
+ D.props.onClick?.(ee), Y();
722
722
  },
723
723
  className: f(D.props.className, c?.trigger),
724
- "aria-expanded": S,
724
+ "aria-expanded": b,
725
725
  "aria-haspopup": "dialog",
726
- "aria-controls": S ? w : void 0
726
+ "aria-controls": b ? C : void 0
727
727
  });
728
728
  } else
729
- re = /* @__PURE__ */ s(
729
+ Q = /* @__PURE__ */ s(
730
730
  "button",
731
731
  {
732
- ref: y,
732
+ ref: x,
733
733
  type: "button",
734
734
  className: f(at.trigger, c?.trigger),
735
- onClick: U,
736
- "aria-expanded": S,
735
+ onClick: Y,
736
+ "aria-expanded": b,
737
737
  "aria-haspopup": "dialog",
738
- "aria-controls": S ? w : void 0,
738
+ "aria-controls": b ? C : void 0,
739
739
  children: e
740
740
  }
741
741
  );
@@ -745,13 +745,13 @@ const Vt = $e(
745
745
  ref: h,
746
746
  className: f(at.root, c?.root, l),
747
747
  style: a,
748
- children: /* @__PURE__ */ H("div", { ref: m, children: [
749
- re,
750
- S && /* @__PURE__ */ s(
748
+ children: /* @__PURE__ */ F("div", { ref: m, children: [
749
+ Q,
750
+ b && /* @__PURE__ */ s(
751
751
  "div",
752
752
  {
753
753
  ref: p,
754
- id: w,
754
+ id: C,
755
755
  role: "dialog",
756
756
  tabIndex: -1,
757
757
  className: f(at.popover, at[r], c?.popover),
@@ -763,7 +763,7 @@ const Vt = $e(
763
763
  );
764
764
  }
765
765
  );
766
- Vt.displayName = "Popover";
766
+ Yt.displayName = "Popover";
767
767
  const Bt = [
768
768
  'input:not([disabled]):not([type="hidden"])',
769
769
  "button:not([disabled])",
@@ -773,7 +773,7 @@ const Bt = [
773
773
  '[tabindex]:not([tabindex="-1"])'
774
774
  ].join(", ");
775
775
  function ko(e, t) {
776
- const n = ne(null), r = he(
776
+ const n = ne(null), r = de(
777
777
  (o) => {
778
778
  if (o.key !== "Tab" || !e.current)
779
779
  return;
@@ -813,9 +813,9 @@ const Mo = "crk-backdrop-jYpTA", wo = "crk-backdropIn-x5Z-A", $o = "crk-modal-yN
813
813
  closeButton: Bo,
814
814
  body: Do,
815
815
  footer: Io
816
- }, gt = Xt({ classes: {}, titleId: "" }), Yt = ({ children: e, className: t, style: n, onClose: r }) => {
816
+ }, gt = Xt({ classes: {}, titleId: "" }), Vt = ({ children: e, className: t, style: n, onClose: r }) => {
817
817
  const { classes: o, titleId: i } = ft(gt);
818
- return /* @__PURE__ */ H(
818
+ return /* @__PURE__ */ F(
819
819
  "div",
820
820
  {
821
821
  id: i,
@@ -837,7 +837,7 @@ const Mo = "crk-backdrop-jYpTA", wo = "crk-backdropIn-x5Z-A", $o = "crk-modal-yN
837
837
  }
838
838
  );
839
839
  };
840
- Yt.displayName = "Modal.Header";
840
+ Vt.displayName = "Modal.Header";
841
841
  const qt = ({ children: e, className: t, style: n }) => {
842
842
  const { classes: r } = ft(gt);
843
843
  return /* @__PURE__ */ s("div", { className: f(je.body, r.body, t), style: n, children: e });
@@ -860,11 +860,11 @@ const yt = $e(
860
860
  style: l,
861
861
  children: a,
862
862
  "aria-label": h,
863
- "aria-labelledby": d
864
- }, u) => {
865
- const m = ne(null), p = u ?? m, y = ze(), w = d ?? `${y}-title`;
863
+ "aria-labelledby": u
864
+ }, d) => {
865
+ const m = ne(null), p = d ?? m, x = Ye(), C = u ?? `${x}-title`;
866
866
  ko(p, e);
867
- const N = ke(
867
+ const $ = ke(
868
868
  () => ({
869
869
  Escape: () => {
870
870
  r && t();
@@ -872,22 +872,22 @@ const yt = $e(
872
872
  }),
873
873
  [r, t]
874
874
  );
875
- Tt(N, e), Be(() => {
875
+ Tt($, e), Be(() => {
876
876
  if (!e) return;
877
- const O = document.body.style.overflow;
877
+ const W = document.body.style.overflow;
878
878
  return document.body.style.overflow = "hidden", () => {
879
- document.body.style.overflow = O;
879
+ document.body.style.overflow = W;
880
880
  };
881
881
  }, [e]);
882
- const S = (O) => {
883
- n && O.target === O.currentTarget && t();
882
+ const b = (W) => {
883
+ n && W.target === W.currentTarget && t();
884
884
  };
885
885
  return e ? fn(
886
886
  /* @__PURE__ */ s(
887
887
  "div",
888
888
  {
889
889
  className: f(je.backdrop, i?.backdrop),
890
- onClick: S,
890
+ onClick: b,
891
891
  role: "presentation",
892
892
  children: /* @__PURE__ */ s(
893
893
  "div",
@@ -898,8 +898,8 @@ const yt = $e(
898
898
  role: "dialog",
899
899
  "aria-modal": "true",
900
900
  "aria-label": h,
901
- "aria-labelledby": h ? void 0 : w,
902
- children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId: w }, children: a })
901
+ "aria-labelledby": h ? void 0 : C,
902
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: i ?? {}, titleId: C }, children: a })
903
903
  }
904
904
  )
905
905
  }
@@ -909,10 +909,10 @@ const yt = $e(
909
909
  }
910
910
  );
911
911
  yt.displayName = "Modal";
912
- yt.Header = Yt;
912
+ yt.Header = Vt;
913
913
  yt.Body = qt;
914
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", Uo = "crk-helperText-Dm-rb", _o = "crk-row-nNbx-", We = {
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
916
  root: Eo,
917
917
  formErrors: Po,
918
918
  formError: Wo,
@@ -921,8 +921,8 @@ const Eo = "crk-root-jHIIP", Po = "crk-formErrors-eh-OP", Wo = "crk-formError-XE
921
921
  labelError: Fo,
922
922
  required: jo,
923
923
  error: Xo,
924
- helperText: Uo,
925
- row: _o
924
+ helperText: _o,
925
+ row: Uo
926
926
  };
927
927
  function El({
928
928
  form: e,
@@ -933,7 +933,7 @@ function El({
933
933
  children: i
934
934
  }) {
935
935
  const c = n && n.length > 0;
936
- return /* @__PURE__ */ s(un, { ...e, children: /* @__PURE__ */ H(
936
+ return /* @__PURE__ */ s(un, { ...e, children: /* @__PURE__ */ F(
937
937
  "form",
938
938
  {
939
939
  onSubmit: e.handleSubmit(t),
@@ -964,50 +964,50 @@ function Pl({
964
964
  style: l,
965
965
  children: a
966
966
  }) {
967
- const { control: h } = hn(), { field: d, fieldState: u } = mn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", y = zo.has(p), { ref: w, ...N } = d, S = ne(w);
968
- S.current = w;
969
- const O = he(
970
- (P) => {
971
- if (P) {
972
- const U = P.matches("input, select, textarea, button, [tabindex]") ? P : P.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
973
- S.current(U ?? P);
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);
974
974
  } else
975
- S.current(null);
975
+ b.current(null);
976
976
  },
977
977
  // eslint-disable-next-line react-hooks/exhaustive-deps
978
978
  []
979
979
  );
980
- return /* @__PURE__ */ H("div", { className: f(We.field, i?.field, c), style: l, children: [
981
- t && /* @__PURE__ */ H("label", { className: f(We.label, u.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: [
982
982
  t,
983
983
  r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
984
984
  ] }),
985
985
  jt(a, {
986
- ...N,
987
- ref: O,
986
+ ...$,
987
+ ref: W,
988
988
  id: e,
989
- error: !!u.error,
990
- "aria-invalid": u.error ? !0 : void 0,
991
- "aria-describedby": u.error?.message ? `${e}-error` : n ? `${e}-helper` : void 0,
989
+ error: !!d.error,
990
+ "aria-invalid": d.error ? !0 : void 0,
991
+ "aria-describedby": d.error?.message ? `${e}-error` : n ? `${e}-helper` : void 0,
992
992
  // Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
993
993
  // Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
994
994
  // handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
995
- ...y && {
996
- onValueChange: N.onChange,
997
- onValuesChange: N.onChange
995
+ ...x && {
996
+ onValueChange: $.onChange,
997
+ onValuesChange: $.onChange
998
998
  },
999
999
  // Bridge for Checkbox (expects checked, not value)
1000
- checked: typeof N.value == "boolean" ? N.value : void 0
1000
+ checked: typeof $.value == "boolean" ? $.value : void 0
1001
1001
  }),
1002
- u.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: f(We.error, i?.error), role: "alert", children: u.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: f(We.helperText, i?.helperText), children: n }) : null
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
1003
1003
  ] });
1004
1004
  }
1005
1005
  function Wl({ children: e, className: t, style: n }) {
1006
1006
  return /* @__PURE__ */ s("div", { className: f(We.row, t), style: n, children: e });
1007
1007
  }
1008
- const Vo = "crk-root-rSgdy", Yo = "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: Vo,
1010
- wrapper: Yo,
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
1011
  sm: qo,
1012
1012
  md: Go,
1013
1013
  lg: Zo,
@@ -1044,7 +1044,7 @@ const Vo = "crk-root-rSgdy", Yo = "crk-wrapper-GHy8V", qo = "crk-sm-DptM5", Go =
1044
1044
  ...l
1045
1045
  }
1046
1046
  );
1047
- return n || r ? /* @__PURE__ */ H(
1047
+ return n || r ? /* @__PURE__ */ F(
1048
1048
  "div",
1049
1049
  {
1050
1050
  className: f(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, i),
@@ -1059,7 +1059,7 @@ const Vo = "crk-root-rSgdy", Yo = "crk-wrapper-GHy8V", qo = "crk-sm-DptM5", Go =
1059
1059
  }
1060
1060
  );
1061
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", E = {
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
1063
  wrapper: rc,
1064
1064
  sm: oc,
1065
1065
  md: cc,
@@ -1104,22 +1104,22 @@ const rc = "crk-wrapper-SP2JE", oc = "crk-sm-DqshL", cc = "crk-md-j4AKI", ic = "
1104
1104
  children: l,
1105
1105
  searchable: a,
1106
1106
  searchPlaceholder: h,
1107
- onValueChange: d,
1108
- ...u
1109
- }, m) => /* @__PURE__ */ H("div", { className: f(E.wrapper, E[e], t && E.error, o?.wrapper, i), style: c, children: [
1110
- /* @__PURE__ */ H(
1107
+ onValueChange: u,
1108
+ ...d
1109
+ }, m) => /* @__PURE__ */ F("div", { className: f(P.wrapper, P[e], t && P.error, o?.wrapper, i), style: c, children: [
1110
+ /* @__PURE__ */ F(
1111
1111
  "select",
1112
1112
  {
1113
1113
  ref: m,
1114
- className: f(E.root, E[e], t && E.error, o?.root),
1115
- ...u,
1114
+ className: f(P.root, P[e], t && P.error, o?.root),
1115
+ ...d,
1116
1116
  children: [
1117
1117
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
1118
1118
  n ? n.map((p) => /* @__PURE__ */ s("option", { value: p.value, disabled: p.disabled, children: p.label }, p.value)) : l
1119
1119
  ]
1120
1120
  }
1121
1121
  ),
1122
- /* @__PURE__ */ s("span", { className: f(E.arrow, o?.arrow) })
1122
+ /* @__PURE__ */ s("span", { className: f(P.arrow, o?.arrow) })
1123
1123
  ] })
1124
1124
  );
1125
1125
  Zt.displayName = "NativeSelect";
@@ -1135,79 +1135,79 @@ const Kt = $e(
1135
1135
  value: l,
1136
1136
  disabled: a,
1137
1137
  id: h,
1138
- searchPlaceholder: d = "Search...",
1139
- onChange: u,
1138
+ searchPlaceholder: u = "Search...",
1139
+ onChange: d,
1140
1140
  onValueChange: m
1141
1141
  }, p) => {
1142
- const [y, w] = Se(!1), [N, S] = Se(""), [O, P] = Se(0), U = ne(null), re = ne(null), D = ne(null), C = ne(null), ee = ze(), se = ne(null), M = p ?? se, q = ne(!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);
1143
1143
  Be(() => {
1144
- q.current && !y && D.current?.focus(), q.current = y;
1145
- }, [y]);
1146
- const I = he(() => {
1147
- w(!1), S(""), P(0);
1148
- }, []), Q = he(() => {
1149
- a || (w(!0), S(""), P(0), setTimeout(() => re.current?.focus(), 0));
1150
- }, [a]), F = he(
1151
- (v) => {
1152
- if (m?.(v), M.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) {
1153
1153
  Object.getOwnPropertyDescriptor(
1154
1154
  HTMLSelectElement.prototype,
1155
1155
  "value"
1156
- )?.set?.call(M.current, v);
1157
- const $ = new Event("change", { bubbles: !0 });
1158
- M.current.dispatchEvent($), u?.($);
1156
+ )?.set?.call(M.current, w);
1157
+ const N = new Event("change", { bubbles: !0 });
1158
+ M.current.dispatchEvent(N), d?.(N);
1159
1159
  }
1160
- I();
1160
+ O();
1161
1161
  },
1162
- [m, u, M, I]
1163
- ), W = ke(() => {
1164
- if (!N) return n;
1165
- const v = N.toLowerCase();
1166
- return n.filter((k) => k.label.toLowerCase().includes(v));
1167
- }, [n, N]);
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, $]);
1168
1168
  Be(() => {
1169
- const v = W.findIndex((k) => !k.disabled);
1170
- P(v >= 0 ? v : 0);
1171
- }, [W]), Be(() => {
1172
- if (!y) return;
1173
- const v = C.current;
1174
- if (!v) return;
1175
- v.querySelectorAll('[role="option"]')[O]?.scrollIntoView?.({ block: "nearest" });
1176
- }, [O, y]);
1177
- const te = he(
1178
- (v) => {
1179
- const k = W.map(($, z) => $.disabled ? -1 : z).filter(($) => $ >= 0);
1180
- if (k.length !== 0)
1181
- if (v.key === "ArrowDown")
1182
- v.preventDefault(), P(($) => {
1183
- const z = k.indexOf($);
1184
- return z < k.length - 1 ? k[z + 1] : k[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];
1185
1185
  });
1186
- else if (v.key === "ArrowUp")
1187
- v.preventDefault(), P(($) => {
1188
- const z = k.indexOf($);
1189
- return z > 0 ? k[z - 1] : k[k.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];
1190
1190
  });
1191
- else if (v.key === "Enter") {
1192
- v.preventDefault();
1193
- const $ = W[O];
1194
- $ && !$.disabled && F($.value);
1195
- } else v.key === "Escape" && (v.preventDefault(), I());
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());
1196
1196
  },
1197
- [W, O, F, I]
1197
+ [U, W, j, O]
1198
1198
  );
1199
- pt(U, I, y);
1200
- const oe = n.find((v) => v.value === l)?.label, L = W.filter((v) => !v.disabled);
1201
- 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(
1202
1202
  "div",
1203
1203
  {
1204
- ref: U,
1204
+ ref: Y,
1205
1205
  className: f(
1206
- E.wrapper,
1207
- E.searchableWrapper,
1208
- E[e],
1209
- t && E.error,
1210
- a && E.disabled,
1206
+ P.wrapper,
1207
+ P.searchableWrapper,
1208
+ P[e],
1209
+ t && P.error,
1210
+ a && P.disabled,
1211
1211
  o?.wrapper,
1212
1212
  i
1213
1213
  ),
@@ -1217,87 +1217,87 @@ const Kt = $e(
1217
1217
  "select",
1218
1218
  {
1219
1219
  ref: M,
1220
- className: E.hiddenSelect,
1220
+ className: P.hiddenSelect,
1221
1221
  value: l ?? "",
1222
1222
  disabled: a,
1223
1223
  tabIndex: -1,
1224
1224
  "aria-hidden": "true",
1225
1225
  onChange: () => {
1226
1226
  },
1227
- 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))
1228
1228
  }
1229
1229
  ),
1230
- /* @__PURE__ */ H(
1230
+ /* @__PURE__ */ F(
1231
1231
  "button",
1232
1232
  {
1233
1233
  ref: D,
1234
1234
  id: h,
1235
1235
  type: "button",
1236
1236
  className: f(
1237
- E.root,
1238
- E.searchableTrigger,
1239
- E[e],
1240
- y && E.triggerOpen,
1241
- t && E.error,
1242
- y && E.visuallyHidden,
1237
+ P.root,
1238
+ P.searchableTrigger,
1239
+ P[e],
1240
+ x && P.triggerOpen,
1241
+ t && P.error,
1242
+ x && P.visuallyHidden,
1243
1243
  o?.root
1244
1244
  ),
1245
- onClick: Q,
1245
+ onClick: te,
1246
1246
  disabled: a,
1247
- "aria-expanded": y,
1247
+ "aria-expanded": x,
1248
1248
  "aria-haspopup": "listbox",
1249
- "aria-controls": y ? ee : void 0,
1249
+ "aria-controls": x ? ee : void 0,
1250
1250
  children: [
1251
- /* @__PURE__ */ s("span", { className: f(E.triggerLabel, !oe && E.placeholder), children: oe || r }),
1252
- /* @__PURE__ */ s("span", { className: f(E.arrow, E.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) })
1253
1253
  ]
1254
1254
  }
1255
1255
  ),
1256
- y && /* @__PURE__ */ s(
1256
+ x && /* @__PURE__ */ s(
1257
1257
  "input",
1258
1258
  {
1259
- ref: re,
1259
+ ref: Q,
1260
1260
  type: "text",
1261
1261
  role: "combobox",
1262
1262
  className: f(
1263
- E.root,
1264
- E.searchableTrigger,
1265
- E[e],
1266
- E.triggerOpen,
1267
- t && E.error,
1263
+ P.root,
1264
+ P.searchableTrigger,
1265
+ P[e],
1266
+ P.triggerOpen,
1267
+ t && P.error,
1268
1268
  o?.root,
1269
1269
  o?.search
1270
1270
  ),
1271
1271
  placeholder: oe || r,
1272
- value: N,
1273
- onChange: (v) => S(v.target.value),
1274
- onKeyDown: te,
1272
+ value: $,
1273
+ onChange: (w) => b(w.target.value),
1274
+ onKeyDown: J,
1275
1275
  "aria-expanded": !0,
1276
1276
  "aria-haspopup": "listbox",
1277
1277
  "aria-controls": ee,
1278
- "aria-activedescendant": L.length > 0 ? `select-option-${W[O]?.value}` : void 0
1278
+ "aria-activedescendant": he.length > 0 ? `select-option-${U[W]?.value}` : void 0
1279
1279
  }
1280
1280
  ),
1281
- y && /* @__PURE__ */ s("div", { id: ee, className: f(E.menu, o?.menu), role: "listbox", children: /* @__PURE__ */ s("div", { className: E.menuItems, ref: C, children: W.length === 0 ? /* @__PURE__ */ s("div", { className: E.noResults, children: "No results" }) : W.map((v, k) => /* @__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(
1282
1282
  "button",
1283
1283
  {
1284
- id: `select-option-${v.value}`,
1284
+ id: `select-option-${w.value}`,
1285
1285
  type: "button",
1286
1286
  role: "option",
1287
- "aria-selected": v.value === l,
1287
+ "aria-selected": w.value === l,
1288
1288
  className: f(
1289
- E.item,
1290
- v.disabled && E.itemDisabled,
1291
- v.value === l && E.itemSelected,
1292
- k === O && E.itemHighlighted,
1289
+ P.item,
1290
+ w.disabled && P.itemDisabled,
1291
+ w.value === l && P.itemSelected,
1292
+ B === W && P.itemHighlighted,
1293
1293
  o?.item
1294
1294
  ),
1295
- disabled: v.disabled,
1296
- onClick: () => F(v.value),
1297
- onMouseEnter: () => P(k),
1298
- children: v.content ?? v.label
1295
+ disabled: w.disabled,
1296
+ onClick: () => j(w.value),
1297
+ onMouseEnter: () => X(B),
1298
+ children: w.content ?? w.label
1299
1299
  },
1300
- v.value
1300
+ w.value
1301
1301
  )) }) })
1302
1302
  ]
1303
1303
  }
@@ -1317,81 +1317,91 @@ const Qt = $e(
1317
1317
  value: l,
1318
1318
  disabled: a,
1319
1319
  id: h,
1320
- searchPlaceholder: d,
1321
- onValuesChange: u,
1322
- clearSearchOnSelect: m = !0
1323
- }, p) => {
1324
- const y = Array.isArray(l) ? l : l ? [l] : [], [w, N] = Se(!1), [S, O] = Se(""), [P, U] = Se(0), re = ne(null), D = ne(null), C = ne(null), ee = ze(), se = ne(null), M = p ?? se, q = he(() => {
1325
- N(!1), O(""), U(0);
1326
- }, []), I = he(() => {
1327
- a || (N(!0), O(""), U(0), setTimeout(() => D.current?.focus(), 0));
1328
- }, [a]), Q = he(
1329
- (L) => {
1330
- const v = y.includes(L) ? y.filter((k) => k !== L) : [...y, L];
1331
- u?.(v), m && O("");
1320
+ searchPlaceholder: u,
1321
+ onValuesChange: d,
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("");
1332
1335
  },
1333
- [y, u, m]
1334
- ), F = he(
1335
- (L, v) => {
1336
- v.stopPropagation(), u?.(y.filter((k) => k !== L));
1336
+ [b, d, m]
1337
+ ), oe = de(
1338
+ (y, L) => {
1339
+ L.stopPropagation(), d?.(b.filter((A) => A !== y));
1337
1340
  },
1338
- [y, u]
1339
- ), W = ke(() => {
1340
- if (!S) return n;
1341
- const L = S.toLowerCase();
1342
- return n.filter((v) => v.label.toLowerCase().includes(L));
1343
- }, [n, S]);
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]);
1344
1351
  Be(() => {
1345
- const L = W.findIndex((v) => !v.disabled);
1346
- U(L >= 0 ? L : 0);
1347
- }, [W]), Be(() => {
1348
- if (!w) return;
1349
- const L = C.current;
1350
- if (!L) return;
1351
- L.querySelectorAll('[role="option"]')[P]?.scrollIntoView?.({ block: "nearest" });
1352
- }, [P, w]);
1353
- const te = he(
1354
- (L) => {
1355
- const v = W.map((k, $) => k.disabled ? -1 : $).filter((k) => k >= 0);
1356
- if (L.key === "Backspace" && S === "" && y.length > 0) {
1357
- L.preventDefault(), u?.(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));
1358
1365
  return;
1359
1366
  }
1360
- if (v.length !== 0)
1361
- if (L.key === "ArrowDown") {
1362
- if (L.preventDefault(), !w) {
1363
- I();
1367
+ if (L.length !== 0)
1368
+ if (y.key === "ArrowDown") {
1369
+ if (y.preventDefault(), !W) {
1370
+ U();
1364
1371
  return;
1365
1372
  }
1366
- U((k) => {
1367
- const $ = v.indexOf(k);
1368
- return $ < v.length - 1 ? v[$ + 1] : v[0];
1373
+ S((A) => {
1374
+ const H = L.indexOf(A);
1375
+ return H < L.length - 1 ? L[H + 1] : L[0];
1369
1376
  });
1370
- } else if (L.key === "ArrowUp")
1371
- L.preventDefault(), U((k) => {
1372
- const $ = v.indexOf(k);
1373
- return $ > 0 ? v[$ - 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];
1374
1381
  });
1375
- else if (L.key === "Enter") {
1376
- L.preventDefault();
1377
- const k = W[P];
1378
- k && !k.disabled && Q(k.value);
1379
- } 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());
1380
1390
  },
1381
- [W, P, Q, q, S, y, u, w, I]
1391
+ [he, D, J, j, Y, b, d, W, U, B, N, z]
1382
1392
  );
1383
- pt(re, q, w);
1384
- const oe = y.map((L) => n.find((v) => v.value === L)).filter((L) => !!L);
1385
- 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(
1386
1396
  "div",
1387
1397
  {
1388
- ref: re,
1398
+ ref: ee,
1389
1399
  className: f(
1390
- E.wrapper,
1391
- E.searchableWrapper,
1392
- E[e],
1393
- t && E.error,
1394
- a && E.disabled,
1400
+ P.wrapper,
1401
+ P.searchableWrapper,
1402
+ P[e],
1403
+ t && P.error,
1404
+ a && P.disabled,
1395
1405
  o?.wrapper,
1396
1406
  i
1397
1407
  ),
@@ -1400,99 +1410,123 @@ const Qt = $e(
1400
1410
  /* @__PURE__ */ s(
1401
1411
  "select",
1402
1412
  {
1403
- ref: M,
1404
- className: E.hiddenSelect,
1413
+ ref: te,
1414
+ className: P.hiddenSelect,
1405
1415
  multiple: !0,
1406
- value: y,
1416
+ value: b,
1407
1417
  disabled: a,
1408
1418
  tabIndex: -1,
1409
1419
  "aria-hidden": "true",
1410
1420
  onChange: () => {
1411
1421
  },
1412
- 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))
1413
1423
  }
1414
1424
  ),
1415
- /* @__PURE__ */ H(
1425
+ /* @__PURE__ */ F(
1416
1426
  "div",
1417
1427
  {
1418
1428
  className: f(
1419
- E.multiTrigger,
1420
- E[e],
1421
- w && E.triggerOpen,
1422
- t && E.error,
1423
- a && E.multiTriggerDisabled,
1429
+ P.multiTrigger,
1430
+ P[e],
1431
+ W && P.triggerOpen,
1432
+ t && P.error,
1433
+ a && P.multiTriggerDisabled,
1424
1434
  o?.root
1425
1435
  ),
1426
1436
  onClick: () => {
1427
- w ? D.current?.focus() : I();
1437
+ W ? re.current?.focus() : U();
1428
1438
  },
1429
1439
  role: "combobox",
1430
- "aria-expanded": w,
1440
+ "aria-expanded": W,
1431
1441
  "aria-haspopup": "listbox",
1432
- "aria-controls": w ? ee : void 0,
1442
+ "aria-controls": W ? G : void 0,
1433
1443
  children: [
1434
- oe.map((L) => /* @__PURE__ */ H("span", { className: f(E.chip, o?.chip), children: [
1435
- /* @__PURE__ */ s("span", { className: E.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 }),
1436
1446
  /* @__PURE__ */ s(
1437
1447
  "button",
1438
1448
  {
1439
1449
  type: "button",
1440
- className: f(E.chipRemove, o?.chipRemove),
1441
- onClick: (v) => F(L.value, v),
1442
- "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}`,
1443
1453
  tabIndex: -1,
1444
1454
  children: "×"
1445
1455
  }
1446
1456
  )
1447
- ] }, L.value)),
1457
+ ] }, y.value)),
1448
1458
  /* @__PURE__ */ s(
1449
1459
  "input",
1450
1460
  {
1451
- ref: D,
1461
+ ref: re,
1452
1462
  id: h,
1453
1463
  type: "text",
1454
- className: E.multiSearch,
1455
- placeholder: y.length === 0 ? r : "",
1456
- value: S,
1457
- onChange: (L) => {
1458
- O(L.target.value), w || I();
1464
+ className: P.multiSearch,
1465
+ placeholder: b.length === 0 ? r : "",
1466
+ value: Y,
1467
+ onChange: (y) => {
1468
+ Q(y.target.value), W || U();
1459
1469
  },
1460
- onKeyDown: te,
1470
+ onKeyDown: T,
1461
1471
  disabled: a,
1462
1472
  "aria-label": "Search options"
1463
1473
  }
1464
1474
  ),
1465
- /* @__PURE__ */ s("span", { className: f(E.arrow, E.arrowMulti, o?.arrow) })
1475
+ /* @__PURE__ */ s("span", { className: f(P.arrow, P.arrowMulti, o?.arrow) })
1466
1476
  ]
1467
1477
  }
1468
1478
  ),
1469
- w && /* @__PURE__ */ s("div", { id: ee, className: f(E.menu, o?.menu), role: "listbox", "aria-multiselectable": "true", children: /* @__PURE__ */ s("div", { className: E.menuItems, ref: C, children: W.length === 0 ? /* @__PURE__ */ s("div", { className: E.noResults, children: "No results" }) : W.map((L, v) => {
1470
- const k = y.includes(L.value);
1471
- 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(
1472
1509
  "button",
1473
1510
  {
1474
- id: `select-option-${L.value}`,
1475
1511
  type: "button",
1476
1512
  role: "option",
1477
- "aria-selected": k,
1513
+ "aria-selected": !1,
1478
1514
  className: f(
1479
- E.item,
1480
- L.disabled && E.itemDisabled,
1481
- k && E.itemSelected,
1482
- v === P && E.itemHighlighted,
1515
+ P.item,
1516
+ D === z && P.itemHighlighted,
1483
1517
  o?.item
1484
1518
  ),
1485
- disabled: L.disabled,
1486
- onClick: () => Q(L.value),
1487
- onMouseEnter: () => U(v),
1488
- children: [
1489
- k && /* @__PURE__ */ s("span", { className: E.itemCheck, "aria-hidden": "true" }),
1490
- L.content ?? L.label
1491
- ]
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
+ ] })
1492
1526
  },
1493
- L.value
1494
- );
1495
- }) }) })
1527
+ "__create__"
1528
+ )
1529
+ ] }) })
1496
1530
  ]
1497
1531
  }
1498
1532
  );
@@ -1520,7 +1554,7 @@ const Pc = "crk-root-61cKD", Wc = "crk-input-bAjPU", Hc = "crk-label-W9IeS", Oc
1520
1554
  const l = ne(null);
1521
1555
  return Be(() => {
1522
1556
  l.current && (l.current.indeterminate = t);
1523
- }, [t]), /* @__PURE__ */ H(
1557
+ }, [t]), /* @__PURE__ */ F(
1524
1558
  "label",
1525
1559
  {
1526
1560
  className: f(dt.root, t && dt.indeterminate, n?.root, r),
@@ -1544,11 +1578,11 @@ const Pc = "crk-root-61cKD", Wc = "crk-input-bAjPU", Hc = "crk-label-W9IeS", Oc
1544
1578
  }
1545
1579
  );
1546
1580
  Fc.displayName = "Checkbox";
1547
- const jc = "crk-group-NNwCD", Xc = "crk-root-7fGik", Uc = "crk-input-43PQW", _c = "crk-label-aW30x", ht = {
1581
+ const jc = "crk-group-NNwCD", Xc = "crk-root-7fGik", _c = "crk-input-43PQW", Uc = "crk-label-aW30x", ht = {
1548
1582
  group: jc,
1549
1583
  root: Xc,
1550
- input: Uc,
1551
- label: _c
1584
+ input: _c,
1585
+ label: Uc
1552
1586
  }, Jt = Xt(null), zc = ({
1553
1587
  name: e,
1554
1588
  value: t,
@@ -1575,7 +1609,7 @@ const jc = "crk-group-NNwCD", Xc = "crk-root-7fGik", Uc = "crk-input-43PQW", _c
1575
1609
  }
1576
1610
  ) });
1577
1611
  zc.displayName = "RadioGroup";
1578
- const Vc = $e(
1612
+ const Yc = $e(
1579
1613
  ({
1580
1614
  label: e,
1581
1615
  value: t,
@@ -1587,17 +1621,17 @@ const Vc = $e(
1587
1621
  name: l,
1588
1622
  ...a
1589
1623
  }, h) => {
1590
- const d = ft(Jt), u = d?.name ?? l, m = d ? d.value === t : c, p = (y) => {
1591
- d?.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);
1592
1626
  };
1593
- 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: [
1594
1628
  /* @__PURE__ */ s(
1595
1629
  "input",
1596
1630
  {
1597
1631
  ref: h,
1598
1632
  type: "radio",
1599
1633
  className: f(ht.input, n?.input),
1600
- name: u,
1634
+ name: d,
1601
1635
  value: t,
1602
1636
  checked: m,
1603
1637
  onChange: p,
@@ -1608,9 +1642,9 @@ const Vc = $e(
1608
1642
  ] });
1609
1643
  }
1610
1644
  );
1611
- Vc.displayName = "Radio";
1612
- const Yc = "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 = {
1613
- root: Yc,
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,
1614
1648
  sm: qc,
1615
1649
  md: Gc,
1616
1650
  lg: Zc,
@@ -1636,18 +1670,18 @@ const Yc = "crk-root-IGgdn", qc = "crk-sm-N-5I2", Gc = "crk-md-bbyFl", Zc = "crk
1636
1670
  onChange: c,
1637
1671
  ...l
1638
1672
  }, a) => {
1639
- const h = ne(null), d = he(() => {
1673
+ const h = ne(null), u = de(() => {
1640
1674
  const p = h.current;
1641
1675
  p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1642
- }, []), u = l.value ?? "";
1676
+ }, []), d = l.value ?? "";
1643
1677
  Be(() => {
1644
- r && d();
1645
- }, [r, d, u]);
1646
- const m = he(
1678
+ r && u();
1679
+ }, [r, u, d]);
1680
+ const m = de(
1647
1681
  (p) => {
1648
- r && d(), c?.(p);
1682
+ r && u(), c?.(p);
1649
1683
  },
1650
- [r, d, c]
1684
+ [r, u, c]
1651
1685
  );
1652
1686
  return /* @__PURE__ */ s(
1653
1687
  "textarea",
@@ -1676,21 +1710,21 @@ function ci(e, t = { width: 600, height: 300 }) {
1676
1710
  return Be(() => {
1677
1711
  const i = e.current;
1678
1712
  if (!i || typeof ResizeObserver > "u") return;
1679
- const c = (h, d) => {
1680
- const u = Math.max(0, Math.round(h)), m = Math.max(0, Math.round(d));
1681
- o.current.width === u && o.current.height === m || (o.current = { width: u, height: m }, r({ width: u, height: m }));
1713
+ const c = (h, u) => {
1714
+ const d = Math.max(0, Math.round(h)), m = Math.max(0, Math.round(u));
1715
+ o.current.width === d && o.current.height === m || (o.current = { width: d, height: m }, r({ width: d, height: m }));
1682
1716
  }, l = i.getBoundingClientRect();
1683
1717
  (l.width > 0 || l.height > 0) && c(l.width, l.height);
1684
1718
  const a = new ResizeObserver((h) => {
1685
- const d = h[0];
1686
- if (!d) return;
1687
- const u = d.contentRect;
1688
- c(u.width, u.height);
1719
+ const u = h[0];
1720
+ if (!u) return;
1721
+ const d = u.contentRect;
1722
+ c(d.width, d.height);
1689
1723
  });
1690
1724
  return a.observe(i), () => a.disconnect();
1691
1725
  }, [e]), n;
1692
1726
  }
1693
- 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", x = {
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 = {
1694
1728
  root: ii,
1695
1729
  canvas: li,
1696
1730
  svg: si,
@@ -1719,28 +1753,28 @@ const ii = "crk-root-uMSq0", li = "crk-canvas-zhFr0", si = "crk-svg-waPLB", ai =
1719
1753
  empty: Ai,
1720
1754
  sparkline: Bi,
1721
1755
  tradingHeader: Di
1722
- }, Ye = $e(
1756
+ }, Ve = $e(
1723
1757
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: i, overlay: c, children: l }, a) => {
1724
1758
  const h = ne(null);
1725
1759
  an(a, () => h.current);
1726
- const { width: d } = ci(h), u = Math.max(0, d), m = t ?? Math.round(u / e);
1727
- return /* @__PURE__ */ H(
1760
+ const { width: u } = ci(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
1761
+ return /* @__PURE__ */ F(
1728
1762
  "div",
1729
1763
  {
1730
1764
  ref: h,
1731
- className: f(x.root, o?.root, n),
1765
+ className: f(k.root, o?.root, n),
1732
1766
  style: r,
1733
1767
  children: [
1734
- /* @__PURE__ */ H("div", { className: x.canvas, style: { height: m || void 0 }, children: [
1735
- u > 0 && m > 0 && /* @__PURE__ */ s(
1768
+ /* @__PURE__ */ F("div", { className: k.canvas, style: { height: m || void 0 }, children: [
1769
+ d > 0 && m > 0 && /* @__PURE__ */ s(
1736
1770
  "svg",
1737
1771
  {
1738
- className: f(x.svg, o?.svg),
1739
- width: u,
1772
+ className: f(k.svg, o?.svg),
1773
+ width: d,
1740
1774
  height: m,
1741
- viewBox: `0 0 ${u} ${m}`,
1775
+ viewBox: `0 0 ${d} ${m}`,
1742
1776
  role: "img",
1743
- children: l({ width: u, height: m })
1777
+ children: l({ width: d, height: m })
1744
1778
  }
1745
1779
  ),
1746
1780
  c
@@ -1751,16 +1785,16 @@ const ii = "crk-root-uMSq0", li = "crk-canvas-zhFr0", si = "crk-svg-waPLB", ai =
1751
1785
  );
1752
1786
  }
1753
1787
  );
1754
- Ye.displayName = "ChartContainer";
1788
+ Ve.displayName = "ChartContainer";
1755
1789
  function vt({ config: e, order: t, classes: n }) {
1756
1790
  const r = t ?? Object.keys(e);
1757
- 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) => {
1758
1792
  const i = e[o];
1759
- 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: [
1760
1794
  i.icon ? /* @__PURE__ */ s(
1761
1795
  "span",
1762
1796
  {
1763
- className: x.legendIcon,
1797
+ className: k.legendIcon,
1764
1798
  style: { color: i.color },
1765
1799
  "aria-hidden": "true",
1766
1800
  children: i.icon
@@ -1768,12 +1802,12 @@ function vt({ config: e, order: t, classes: n }) {
1768
1802
  ) : /* @__PURE__ */ s(
1769
1803
  "span",
1770
1804
  {
1771
- className: x.legendSwatch,
1805
+ className: k.legendSwatch,
1772
1806
  style: { background: i.color },
1773
1807
  "aria-hidden": "true"
1774
1808
  }
1775
1809
  ),
1776
- /* @__PURE__ */ s("span", { className: x.legendLabel, children: i.label })
1810
+ /* @__PURE__ */ s("span", { className: k.legendLabel, children: i.label })
1777
1811
  ] }, o) : null;
1778
1812
  }) });
1779
1813
  }
@@ -1790,35 +1824,35 @@ function et({
1790
1824
  classes: h
1791
1825
  }) {
1792
1826
  if (!e) return null;
1793
- const d = 180, m = t + d + 16 > r ? t - d - 12 : t + 12, p = Math.max(8, n - 16);
1827
+ const u = 180, m = t + u + 16 > r ? t - u - 12 : t + 12, p = Math.max(8, n - 16);
1794
1828
  return /* @__PURE__ */ s(
1795
1829
  "div",
1796
1830
  {
1797
- className: f(x.tooltip, h?.tooltip),
1798
- style: { left: m, top: p, width: d },
1831
+ className: f(k.tooltip, h?.tooltip),
1832
+ style: { left: m, top: p, width: u },
1799
1833
  role: "tooltip",
1800
- children: i ? i(e) : /* @__PURE__ */ H(Ve, { children: [
1801
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: x.tooltipTitle, children: String(e[l]) }),
1802
- /* @__PURE__ */ s("div", { className: x.tooltipRows, children: Object.entries(o).map(([y, w]) => {
1803
- const N = e[y];
1804
- if (N == null) return null;
1805
- const S = typeof N == "number" ? c(N) : String(N), O = a?.(y) ?? w.color;
1806
- return /* @__PURE__ */ H("div", { className: x.tooltipRow, children: [
1807
- /* @__PURE__ */ s("span", { className: x.legendSwatch, style: { background: O }, "aria-hidden": "true" }),
1808
- /* @__PURE__ */ s("span", { className: x.tooltipLabel, children: w.label }),
1809
- /* @__PURE__ */ s("span", { className: x.tooltipValue, children: S })
1810
- ] }, 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);
1811
1845
  }) })
1812
1846
  ] })
1813
1847
  }
1814
1848
  );
1815
1849
  }
1816
1850
  function en({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: i }) {
1817
- return /* @__PURE__ */ s("g", { className: f(x.axis, i?.axis), children: e.map(({ value: c, y: l }) => /* @__PURE__ */ H("g", { children: [
1851
+ return /* @__PURE__ */ s("g", { className: f(k.axis, i?.axis), children: e.map(({ value: c, y: l }) => /* @__PURE__ */ F("g", { children: [
1818
1852
  o && /* @__PURE__ */ s(
1819
1853
  "line",
1820
1854
  {
1821
- className: f(x.gridLine, i?.grid),
1855
+ className: f(k.gridLine, i?.grid),
1822
1856
  x1: t,
1823
1857
  x2: t + n,
1824
1858
  y1: l,
@@ -1828,7 +1862,7 @@ function en({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1828
1862
  /* @__PURE__ */ s(
1829
1863
  "text",
1830
1864
  {
1831
- className: f(x.axisLabel, i?.axisLabel),
1865
+ className: f(k.axisLabel, i?.axisLabel),
1832
1866
  x: t - 8,
1833
1867
  y: l,
1834
1868
  textAnchor: "end",
@@ -1839,10 +1873,10 @@ function en({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1839
1873
  ] }, `y-${c}`)) });
1840
1874
  }
1841
1875
  function tn({ ticks: e, y: t, format: n, classes: r }) {
1842
- return /* @__PURE__ */ s("g", { className: f(x.axis, r?.axis), children: e.map(({ label: o, x: i }) => /* @__PURE__ */ s(
1876
+ return /* @__PURE__ */ s("g", { className: f(k.axis, r?.axis), children: e.map(({ label: o, x: i }) => /* @__PURE__ */ s(
1843
1877
  "text",
1844
1878
  {
1845
- className: f(x.axisLabel, r?.axisLabel),
1879
+ className: f(k.axisLabel, r?.axisLabel),
1846
1880
  x: i,
1847
1881
  y: t + 16,
1848
1882
  textAnchor: "middle",
@@ -1864,12 +1898,12 @@ function Je(e, t) {
1864
1898
  const [n, r] = e, [o, i] = t, c = r - n || 1, l = i - o, a = (h) => o + (h - n) / c * l;
1865
1899
  return a.invert = (h) => n + (h - o) / l * c, a;
1866
1900
  }
1867
- function Xe(e, t, n = 0.2) {
1901
+ function _e(e, t, n = 0.2) {
1868
1902
  const [r, o] = t, c = (o - r) / Math.max(1, e.length), l = c * (1 - n), a = /* @__PURE__ */ new Map();
1869
- for (let d = 0; d < e.length; d++) a.set(e[d], d);
1870
- const h = (d) => {
1871
- const u = a.get(d);
1872
- return u === void 0 ? r : r + u * c + c / 2;
1903
+ for (let u = 0; u < e.length; u++) a.set(e[u], u);
1904
+ const h = (u) => {
1905
+ const d = a.get(u);
1906
+ return d === void 0 ? r : r + d * c + c / 2;
1873
1907
  };
1874
1908
  return h.bandWidth = () => l, h.step = () => c, h;
1875
1909
  }
@@ -1879,10 +1913,10 @@ function qe(e, t, n = 5) {
1879
1913
  const o = (t - e) / Math.max(1, n), i = Math.pow(10, Math.floor(Math.log10(o))), c = o / i;
1880
1914
  let l;
1881
1915
  c < 1.5 ? l = i : c < 3 ? l = 2 * i : c < 7 ? l = 5 * i : l = 10 * i;
1882
- const a = Math.floor(e / l) * l, h = Math.ceil(t / l) * l, d = [];
1883
- for (let u = a; u <= h + l / 2; u += l)
1884
- d.push(Number(u.toFixed(10)));
1885
- return d;
1916
+ const a = Math.floor(e / l) * l, h = Math.ceil(t / l) * l, u = [];
1917
+ for (let d = a; d <= h + l / 2; d += l)
1918
+ u.push(Number(d.toFixed(10)));
1919
+ return u;
1886
1920
  }
1887
1921
  const Ii = { top: 12, right: 16, bottom: 28, left: 48 };
1888
1922
  function Ei(e, t) {
@@ -1898,8 +1932,8 @@ function Ei(e, t) {
1898
1932
  }
1899
1933
  let n = `M ${e[0].x} ${e[0].y}`;
1900
1934
  for (let r = 0; r < e.length - 1; r++) {
1901
- const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, d = c.x - (l.x - i.x) / 6, u = c.y - (l.y - i.y) / 6;
1902
- n += ` C ${a} ${h}, ${d} ${u}, ${c.x} ${c.y}`;
1935
+ const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, u = c.x - (l.x - i.x) / 6, d = c.y - (l.y - i.y) / 6;
1936
+ n += ` C ${a} ${h}, ${u} ${d}, ${c.x} ${c.y}`;
1903
1937
  }
1904
1938
  return n;
1905
1939
  }
@@ -1919,180 +1953,180 @@ function Hl({
1919
1953
  dotColorKey: l,
1920
1954
  renderDot: a,
1921
1955
  showValues: h = !1,
1922
- valuePosition: d = "top",
1923
- renderLabel: u,
1956
+ valuePosition: u = "top",
1957
+ renderLabel: d,
1924
1958
  activeIndex: m,
1925
1959
  onPointClick: p,
1926
- showGrid: y = !0,
1927
- showLegend: w = !0,
1928
- showTooltip: N = !0,
1929
- yTickCount: S = 5,
1930
- yFormat: O,
1931
- xFormat: P,
1932
- valueFormat: U,
1933
- renderTooltip: re,
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,
1934
1968
  margin: D,
1935
- emptyMessage: C = "No data",
1969
+ emptyMessage: S = "No data",
1936
1970
  className: ee,
1937
- style: se,
1971
+ style: re,
1938
1972
  classes: M
1939
1973
  }) {
1940
- const q = { ...Ii, ...D }, I = ke(() => Object.keys(n), [n]), [Q, F] = Se(null), W = ne(null), te = m ?? Q, oe = (v, k) => {
1974
+ const G = { ...Ii, ...D }, O = ke(() => Object.keys(n), [n]), [te, j] = Se(null), U = ne(null), J = m ?? te, oe = (w, B) => {
1941
1975
  if (l) {
1942
- const $ = e[k]?.[l];
1943
- if (typeof $ == "string") return $;
1976
+ const N = e[B]?.[l];
1977
+ if (typeof N == "string") return N;
1944
1978
  }
1945
- return n[v]?.color ?? "var(--crk-chart-1)";
1979
+ return n[w]?.color ?? "var(--crk-chart-1)";
1946
1980
  };
1947
1981
  if (e.length === 0)
1948
- return /* @__PURE__ */ s("div", { ref: W, className: f(x.root, M?.root, ee), style: se, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: C }) }) });
1949
- const L = N && te !== 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(
1950
1984
  et,
1951
1985
  {
1952
- row: e[te],
1953
- x: Wi(e, t, q, te, W),
1986
+ row: e[J],
1987
+ x: Wi(e, t, G, J, U),
1954
1988
  y: 16,
1955
- containerWidth: W.current?.getBoundingClientRect().width ?? 0,
1989
+ containerWidth: U.current?.getBoundingClientRect().width ?? 0,
1956
1990
  config: n,
1957
- render: re ? () => re(e[te]) : void 0,
1958
- valueFormat: U,
1991
+ render: Q ? () => Q(e[J]) : void 0,
1992
+ valueFormat: Y,
1959
1993
  titleKey: t,
1960
- resolveColor: l ? (v) => oe(v, te) : void 0,
1994
+ resolveColor: l ? (w) => oe(w, J) : void 0,
1961
1995
  classes: M
1962
1996
  }
1963
1997
  ) : null;
1964
1998
  return /* @__PURE__ */ s(
1965
- Ye,
1999
+ Ve,
1966
2000
  {
1967
- ref: W,
2001
+ ref: U,
1968
2002
  aspectRatio: r,
1969
2003
  height: o,
1970
2004
  className: ee,
1971
- style: se,
2005
+ style: re,
1972
2006
  classes: M,
1973
- legend: w ? /* @__PURE__ */ s(vt, { config: n, classes: M }) : void 0,
1974
- overlay: L,
1975
- children: ({ width: v, height: k }) => {
1976
- const $ = q.left, z = v - q.right, T = q.top, j = k - q.bottom, V = Math.max(0, z - $), G = Math.max(0, j - T), Z = e.map((g) => String(g[t])), _ = Xe(Z, [$, z], 0), J = [];
1977
- for (const g of I)
1978
- for (const b of e) {
1979
- const K = b[g];
1980
- typeof K == "number" && J.push(K);
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);
1981
2015
  }
1982
- const [ue, be] = bt(J), pe = Math.min(0, ue), fe = qe(pe, be, S), ge = Je([fe[0], fe[fe.length - 1]], [j, T]), ve = fe.map((g) => ({ value: g, y: ge(g) })), Ne = Pi(Z).map((g) => ({ label: g, x: _(g) }));
1983
- return /* @__PURE__ */ H(Ve, { 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: [
1984
2018
  /* @__PURE__ */ s(
1985
2019
  en,
1986
2020
  {
1987
2021
  ticks: ve,
1988
- x: $,
1989
- plotWidth: V,
1990
- format: O,
1991
- showGrid: y,
2022
+ x: N,
2023
+ plotWidth: y,
2024
+ format: W,
2025
+ showGrid: x,
1992
2026
  classes: M
1993
2027
  }
1994
2028
  ),
1995
- /* @__PURE__ */ s(tn, { ticks: Ne, y: j, format: P, classes: M }),
1996
- I.map((g) => {
1997
- const b = n[g], K = e.map((B, X) => {
1998
- const A = B[g], de = typeof A == "number" ? A : 0;
1999
- return { x: _(Z[X]), 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 };
2000
2034
  });
2001
- return /* @__PURE__ */ H("g", { className: f(x.series, M?.series), children: [
2035
+ return /* @__PURE__ */ F("g", { className: f(k.series, M?.series), children: [
2002
2036
  /* @__PURE__ */ s(
2003
2037
  "path",
2004
2038
  {
2005
- className: f(x.linePath),
2039
+ className: f(k.linePath),
2006
2040
  d: Ei(K, i),
2007
- stroke: b.color
2041
+ stroke: v.color
2008
2042
  }
2009
2043
  ),
2010
- c && K.map((B, X) => {
2011
- const A = oe(g, X), de = te === X, Y = m !== void 0 && !de, R = p ? () => p({ row: B.row, value: B.value, seriesKey: g, index: X }) : 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;
2012
2046
  return a ? /* @__PURE__ */ s(
2013
2047
  "g",
2014
2048
  {
2015
2049
  onClick: R,
2016
2050
  style: R ? { cursor: "pointer" } : void 0,
2017
- opacity: Y ? 0.45 : 1,
2051
+ opacity: q ? 0.45 : 1,
2018
2052
  children: a({
2019
- row: B.row,
2020
- value: B.value,
2053
+ row: E.row,
2054
+ value: E.value,
2021
2055
  seriesKey: g,
2022
- index: X,
2023
- x: B.x,
2024
- y: B.y,
2025
- color: A,
2026
- active: de
2056
+ index: V,
2057
+ x: E.x,
2058
+ y: E.y,
2059
+ color: I,
2060
+ active: ae
2027
2061
  })
2028
2062
  },
2029
- `${g}-${X}`
2063
+ `${g}-${V}`
2030
2064
  ) : /* @__PURE__ */ s(
2031
2065
  "circle",
2032
2066
  {
2033
- className: f(x.point, M?.point),
2034
- cx: B.x,
2035
- cy: B.y,
2036
- r: de ? 5 : 3.5,
2037
- fill: A,
2067
+ className: f(k.point, M?.point),
2068
+ cx: E.x,
2069
+ cy: E.y,
2070
+ r: ae ? 5 : 3.5,
2071
+ fill: I,
2038
2072
  onClick: R,
2039
2073
  style: R ? { cursor: "pointer" } : void 0,
2040
- opacity: Y ? 0.45 : 1
2074
+ opacity: q ? 0.45 : 1
2041
2075
  },
2042
- `${g}-${X}`
2076
+ `${g}-${V}`
2043
2077
  );
2044
2078
  }),
2045
- (h || u) && K.map((B, X) => {
2046
- const A = u ? u({ row: B.row, value: B.value, seriesKey: g, index: X }) : h ? U ? U(B.value) : String(B.value) : null;
2047
- if (A == null) return null;
2048
- const de = 10, Y = d === "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;
2049
2083
  return /* @__PURE__ */ s(
2050
2084
  "text",
2051
2085
  {
2052
- className: f(x.axisLabel),
2053
- x: B.x,
2054
- y: Y,
2086
+ className: f(k.axisLabel),
2087
+ x: E.x,
2088
+ y: q,
2055
2089
  textAnchor: "middle",
2056
- dominantBaseline: d === "top" ? "auto" : "middle",
2057
- children: A
2090
+ dominantBaseline: u === "top" ? "auto" : "middle",
2091
+ children: I
2058
2092
  },
2059
- `label-${g}-${X}`
2093
+ `label-${g}-${V}`
2060
2094
  );
2061
2095
  })
2062
2096
  ] }, g);
2063
2097
  }),
2064
- te !== null && /* @__PURE__ */ s(
2098
+ J !== null && /* @__PURE__ */ s(
2065
2099
  "line",
2066
2100
  {
2067
- className: x.cursorLine,
2068
- x1: _(Z[te]),
2069
- x2: _(Z[te]),
2101
+ className: k.cursorLine,
2102
+ x1: H(A[J]),
2103
+ x2: H(A[J]),
2070
2104
  y1: T,
2071
- y2: j
2105
+ y2: _
2072
2106
  }
2073
2107
  ),
2074
2108
  /* @__PURE__ */ s(
2075
2109
  "rect",
2076
2110
  {
2077
- className: x.interactionLayer,
2078
- x: $,
2111
+ className: k.interactionLayer,
2112
+ x: N,
2079
2113
  y: T,
2080
- width: V,
2081
- height: G,
2114
+ width: y,
2115
+ height: L,
2082
2116
  onMouseMove: (g) => {
2083
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + $, B = _.step(), X = Math.max(
2117
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
2084
2118
  0,
2085
- Math.min(e.length - 1, Math.round((K - $ - B / 2) / B))
2119
+ Math.min(e.length - 1, Math.round((K - N - E / 2) / E))
2086
2120
  );
2087
- F(X);
2121
+ j(V);
2088
2122
  },
2089
- onMouseLeave: () => F(null),
2123
+ onMouseLeave: () => j(null),
2090
2124
  onClick: p ? (g) => {
2091
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + $, B = _.step(), X = Math.max(
2125
+ const v = g.currentTarget.getBoundingClientRect(), K = g.clientX - v.left + N, E = H.step(), V = Math.max(
2092
2126
  0,
2093
- Math.min(e.length - 1, Math.round((K - $ - B / 2) / B))
2094
- ), A = I[0], de = e[X][A], Y = typeof de == "number" ? de : 0;
2095
- p({ row: e[X], value: Y, seriesKey: A, index: X });
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 });
2096
2130
  } : void 0,
2097
2131
  style: p ? { cursor: "pointer" } : void 0
2098
2132
  }
@@ -2106,7 +2140,7 @@ function Wi(e, t, n, r, o) {
2106
2140
  const i = o.current;
2107
2141
  if (!i) return 0;
2108
2142
  const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2109
- return Xe(l, [n.left, c - n.right], 0)(l[r]);
2143
+ return _e(l, [n.left, c - n.right], 0)(l[r]);
2110
2144
  }
2111
2145
  const Hi = { top: 12, right: 16, bottom: 28, left: 48 };
2112
2146
  function St(e, t) {
@@ -2122,8 +2156,8 @@ function St(e, t) {
2122
2156
  }
2123
2157
  let n = `M ${e[0].x} ${e[0].y}`;
2124
2158
  for (let r = 0; r < e.length - 1; r++) {
2125
- const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, d = c.x - (l.x - i.x) / 6, u = c.y - (l.y - i.y) / 6;
2126
- n += ` C ${a} ${h}, ${d} ${u}, ${c.x} ${c.y}`;
2159
+ const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, u = c.x - (l.x - i.x) / 6, d = c.y - (l.y - i.y) / 6;
2160
+ n += ` C ${a} ${h}, ${u} ${d}, ${c.x} ${c.y}`;
2127
2161
  }
2128
2162
  return n;
2129
2163
  }
@@ -2153,95 +2187,95 @@ function Ol({
2153
2187
  stackOffset: l = "none",
2154
2188
  fillGradient: a = !1,
2155
2189
  showGrid: h = !0,
2156
- showXAxis: d = !0,
2157
- showYAxis: u = !0,
2190
+ showXAxis: u = !0,
2191
+ showYAxis: d = !0,
2158
2192
  showLegend: m = !0,
2159
2193
  showTooltip: p = !0,
2160
- yTickCount: y = 5,
2161
- yFormat: w,
2162
- xFormat: N,
2163
- valueFormat: S,
2164
- renderTooltip: O,
2165
- margin: P,
2166
- emptyMessage: U = "No data",
2167
- className: re,
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,
2168
2202
  style: D,
2169
- classes: C
2203
+ classes: S
2170
2204
  }) {
2171
2205
  const ee = ke(
2172
2206
  () => ({
2173
2207
  ...Hi,
2174
- ...u ? {} : { left: 16 },
2175
- ...P
2208
+ ...d ? {} : { left: 16 },
2209
+ ...X
2176
2210
  }),
2177
- [P, u]
2178
- ), se = ke(() => Object.keys(n), [n]), M = c && se.length > 0, q = M && l === "expand", [I, Q] = Se(null), F = ne(null), W = 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();
2179
2213
  if (e.length === 0)
2180
- return /* @__PURE__ */ s("div", { ref: F, className: f(x.root, C?.root, re), style: D, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: U }) }) });
2181
- const te = ke(() => {
2182
- const $ = se.map(() => []), z = se.map(() => []);
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(() => []);
2183
2217
  for (let T = 0; T < e.length; T++) {
2184
- let j = 0;
2185
- if (q) {
2186
- for (const G of se) {
2187
- const Z = e[T][G];
2188
- typeof Z == "number" && Z > 0 && (j += Z);
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);
2189
2223
  }
2190
- j === 0 && (j = 1);
2224
+ _ === 0 && (_ = 1);
2191
2225
  }
2192
- let V = 0;
2193
- for (let G = 0; G < se.length; G++) {
2194
- const Z = se[G], _ = e[T][Z], J = typeof _ == "number" ? _ : 0;
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;
2195
2229
  if (M) {
2196
- const ue = q ? J / j : J;
2197
- z[G][T] = V, V += ue, $[G][T] = V;
2230
+ const ue = G ? Z / _ : Z;
2231
+ z[L][T] = y, y += ue, N[L][T] = y;
2198
2232
  } else
2199
- z[G][T] = 0, $[G][T] = J;
2233
+ z[L][T] = 0, N[L][T] = Z;
2200
2234
  }
2201
2235
  }
2202
- return { tops: $, bottoms: z };
2203
- }, [e, se, M, q]), { tops: oe, bottoms: L } = te, [v, k] = ke(() => {
2204
- if (q) return [0, 1];
2205
- let $ = 0, z = 0;
2236
+ return { tops: N, bottoms: z };
2237
+ }, [e, re, M, G]), { tops: oe, bottoms: he } = J, [w, B] = ke(() => {
2238
+ if (G) return [0, 1];
2239
+ let N = 0, z = 0;
2206
2240
  for (const T of oe)
2207
- for (const j of T)
2208
- j < $ && ($ = j), j > z && (z = j);
2209
- for (const T of L)
2210
- for (const j of T)
2211
- j < $ && ($ = j);
2212
- return [Math.min(0, $), z];
2213
- }, [oe, L, q]);
2241
+ for (const _ of T)
2242
+ _ < N && (N = _), _ > z && (z = _);
2243
+ for (const T of he)
2244
+ for (const _ of T)
2245
+ _ < N && (N = _);
2246
+ return [Math.min(0, N), z];
2247
+ }, [oe, he, G]);
2214
2248
  return /* @__PURE__ */ s(
2215
- Ye,
2249
+ Ve,
2216
2250
  {
2217
- ref: F,
2251
+ ref: j,
2218
2252
  aspectRatio: r,
2219
2253
  height: o,
2220
- className: re,
2254
+ className: Q,
2221
2255
  style: D,
2222
- classes: C,
2223
- legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: C }) : void 0,
2224
- overlay: p && I !== null ? /* @__PURE__ */ s(
2256
+ classes: S,
2257
+ legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
2258
+ overlay: p && O !== null ? /* @__PURE__ */ s(
2225
2259
  et,
2226
2260
  {
2227
- row: e[I],
2228
- x: Fi(e, t, ee, I, F),
2261
+ row: e[O],
2262
+ x: Fi(e, t, ee, O, j),
2229
2263
  y: 16,
2230
- containerWidth: F.current?.getBoundingClientRect().width ?? 0,
2264
+ containerWidth: j.current?.getBoundingClientRect().width ?? 0,
2231
2265
  config: n,
2232
- render: O ? () => O(e[I]) : void 0,
2233
- valueFormat: q ? ($) => `${Math.round($ * 100)}%` : S,
2266
+ render: W ? () => W(e[O]) : void 0,
2267
+ valueFormat: G ? (N) => `${Math.round(N * 100)}%` : b,
2234
2268
  titleKey: t,
2235
- classes: C
2269
+ classes: S
2236
2270
  }
2237
2271
  ) : null,
2238
- children: ({ width: $, height: z }) => {
2239
- const T = ee.left, j = $ - ee.right, V = ee.top, G = z - ee.bottom, Z = Math.max(0, j - T), _ = Math.max(0, G - V), J = e.map((g) => String(g[t])), ue = Xe(J, [T, j], 0), be = q ? [0, 0.25, 0.5, 0.75, 1] : qe(v, k, y), pe = Je([be[0], be[be.length - 1]], [G, V]), fe = pe(0), ge = be.map((g) => ({ value: g, y: pe(g) })), Re = Oi(J).map((g) => ({ label: g, x: ue(g) })), Ne = q ? (g) => `${Math.round(g * 100)}%` : w;
2240
- return /* @__PURE__ */ H(Ve, { children: [
2241
- a && /* @__PURE__ */ s("defs", { children: se.map((g) => /* @__PURE__ */ H(
2272
+ children: ({ width: N, height: z }) => {
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(
2242
2276
  "linearGradient",
2243
2277
  {
2244
- id: `${W}-${g}`,
2278
+ id: `${U}-${g}`,
2245
2279
  x1: "0",
2246
2280
  y1: "0",
2247
2281
  x2: "0",
@@ -2253,80 +2287,80 @@ function Ol({
2253
2287
  },
2254
2288
  g
2255
2289
  )) }),
2256
- u ? /* @__PURE__ */ s(
2290
+ d ? /* @__PURE__ */ s(
2257
2291
  en,
2258
2292
  {
2259
2293
  ticks: ge,
2260
2294
  x: T,
2261
- plotWidth: Z,
2295
+ plotWidth: A,
2262
2296
  format: Ne,
2263
2297
  showGrid: h,
2264
- classes: C
2298
+ classes: S
2265
2299
  }
2266
- ) : 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(
2267
2301
  "line",
2268
2302
  {
2269
- className: f(x.gridLine, C?.grid),
2303
+ className: f(k.gridLine, S?.grid),
2270
2304
  x1: T,
2271
- x2: j,
2272
- y1: b,
2273
- y2: b
2305
+ x2: _,
2306
+ y1: v,
2307
+ y2: v
2274
2308
  },
2275
2309
  `grid-${g}`
2276
2310
  )) }),
2277
- d && /* @__PURE__ */ s(tn, { ticks: Re, y: G, format: N, classes: C }),
2278
- se.map((g, b) => {
2279
- const K = n[g], B = e.map((Y, R) => ({
2280
- x: ue(J[R]),
2281
- y: pe(oe[b][R])
2282
- })), X = a ? `url(#${W}-${g})` : K.color, A = a ? 1 : 0.18, de = M ? Dt(B, L[b].map((Y) => pe(Y)), i) : Dt(B, fe, i);
2283
- 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: [
2284
2318
  /* @__PURE__ */ s(
2285
2319
  "path",
2286
2320
  {
2287
- className: x.areaPath,
2288
- d: de,
2289
- fill: X,
2290
- fillOpacity: A
2321
+ className: k.areaPath,
2322
+ d: ae,
2323
+ fill: V,
2324
+ fillOpacity: I
2291
2325
  }
2292
2326
  ),
2293
- /* @__PURE__ */ s("path", { className: x.linePath, d: St(B, i), stroke: K.color }),
2294
- !M && B.map((Y, R) => /* @__PURE__ */ s(
2327
+ /* @__PURE__ */ s("path", { className: k.linePath, d: St(E, i), stroke: K.color }),
2328
+ !M && E.map((q, R) => /* @__PURE__ */ s(
2295
2329
  "circle",
2296
2330
  {
2297
- className: f(x.point, C?.point),
2298
- cx: Y.x,
2299
- cy: Y.y,
2300
- r: I === R ? 5 : 3,
2331
+ className: f(k.point, S?.point),
2332
+ cx: q.x,
2333
+ cy: q.y,
2334
+ r: O === R ? 5 : 3,
2301
2335
  fill: K.color
2302
2336
  },
2303
2337
  `${g}-${R}`
2304
2338
  ))
2305
2339
  ] }, g);
2306
2340
  }),
2307
- I !== null && /* @__PURE__ */ s(
2341
+ O !== null && /* @__PURE__ */ s(
2308
2342
  "line",
2309
2343
  {
2310
- className: x.cursorLine,
2311
- x1: ue(J[I]),
2312
- x2: ue(J[I]),
2313
- y1: V,
2314
- y2: G
2344
+ className: k.cursorLine,
2345
+ x1: ue(Z[O]),
2346
+ x2: ue(Z[O]),
2347
+ y1: y,
2348
+ y2: L
2315
2349
  }
2316
2350
  ),
2317
2351
  /* @__PURE__ */ s(
2318
2352
  "rect",
2319
2353
  {
2320
- className: x.interactionLayer,
2354
+ className: k.interactionLayer,
2321
2355
  x: T,
2322
- y: V,
2323
- width: Z,
2324
- height: _,
2356
+ y,
2357
+ width: A,
2358
+ height: H,
2325
2359
  onMouseMove: (g) => {
2326
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left + T, B = ue.step(), X = Math.max(0, Math.min(e.length - 1, Math.round((K - T - B / 2) / B)));
2327
- Q(X);
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);
2328
2362
  },
2329
- onMouseLeave: () => Q(null)
2363
+ onMouseLeave: () => te(null)
2330
2364
  }
2331
2365
  )
2332
2366
  ] });
@@ -2338,7 +2372,7 @@ function Fi(e, t, n, r, o) {
2338
2372
  const i = o.current;
2339
2373
  if (!i) return 0;
2340
2374
  const c = i.getBoundingClientRect().width, l = e.map((h) => String(h[t]));
2341
- return Xe(l, [n.left, c - n.right], 0)(l[r]);
2375
+ return _e(l, [n.left, c - n.right], 0)(l[r]);
2342
2376
  }
2343
2377
  const ji = [
2344
2378
  "var(--crk-chart-1)",
@@ -2346,8 +2380,8 @@ const ji = [
2346
2380
  "var(--crk-chart-3)",
2347
2381
  "var(--crk-chart-4)",
2348
2382
  "var(--crk-chart-5)"
2349
- ], Xi = { top: 12, right: 16, bottom: 28, left: 48 }, Ui = { top: 12, right: 16, bottom: 28, left: 72 };
2350
- function _i(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) {
2351
2385
  if (e.length <= t) return e;
2352
2386
  const n = Math.ceil(e.length / t);
2353
2387
  return e.filter((r, o) => o % n === 0);
@@ -2363,39 +2397,39 @@ function Fl({
2363
2397
  groupPadding: l = 0.2,
2364
2398
  barPadding: a = 0.1,
2365
2399
  barRadius: h = 4,
2366
- showGrid: d = !0,
2367
- showLegend: u = !0,
2400
+ showGrid: u = !0,
2401
+ showLegend: d = !0,
2368
2402
  showTooltip: m = !0,
2369
2403
  showValues: p = !1,
2370
- valuePosition: y = "outside",
2371
- renderLabel: w,
2372
- colorBy: N = "series",
2373
- colors: S = ji,
2374
- negativeColor: O,
2375
- activeIndex: P,
2376
- onBarClick: U,
2377
- yTickCount: re = 5,
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,
2378
2412
  yFormat: D,
2379
- xFormat: C,
2413
+ xFormat: S,
2380
2414
  valueFormat: ee,
2381
- renderTooltip: se,
2415
+ renderTooltip: re,
2382
2416
  margin: M,
2383
- emptyMessage: q = "No data",
2384
- className: I,
2385
- style: Q,
2386
- classes: F
2417
+ emptyMessage: G = "No data",
2418
+ className: O,
2419
+ style: te,
2420
+ classes: j
2387
2421
  }) {
2388
- const W = r === "horizontal", te = { ...W ? Ui : Xi, ...M }, oe = ke(() => Object.keys(n), [n]), L = o && oe.length > 1, [v, k] = Se(null), $ = ne(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);
2389
2423
  if (e.length === 0)
2390
- return /* @__PURE__ */ s("div", { ref: $, className: f(x.root, F?.root, I), style: Q, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: q }) }) });
2391
- const z = e.map((ue) => String(ue[t])), T = P ?? v, j = ke(() => {
2392
- 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) {
2393
2427
  let fe = 0, ge = 0;
2394
2428
  for (const ve of e) {
2395
2429
  let Re = 0, Ne = 0;
2396
2430
  for (const g of oe) {
2397
- const b = ve[g];
2398
- typeof b == "number" && (b >= 0 ? Re += b : Ne += b);
2431
+ const v = ve[g];
2432
+ typeof v == "number" && (v >= 0 ? Re += v : Ne += v);
2399
2433
  }
2400
2434
  Re > fe && (fe = Re), Ne < ge && (ge = Ne);
2401
2435
  }
@@ -2409,48 +2443,48 @@ function Fl({
2409
2443
  }
2410
2444
  const [be, pe] = bt(ue);
2411
2445
  return [Math.min(0, be), Math.max(0, pe)];
2412
- }, [e, oe, L]), V = qe(j[0], j[1], re), G = V[0], Z = V[V.length - 1], _ = (ue, be) => N === "index" ? S[be % S.length] : n[ue]?.color ?? S[0], J = m && T !== null && e[T] ? /* @__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(
2413
2447
  et,
2414
2448
  {
2415
2449
  row: e[T],
2416
- x: Vi(e, t, te, T, $, W, l),
2417
- y: W ? Yi(e, t, te, T, $, l) : 16,
2418
- containerWidth: $.current?.getBoundingClientRect().width ?? 0,
2450
+ x: Yi(e, t, J, T, N, U, l),
2451
+ y: U ? Vi(e, t, J, T, N, l) : 16,
2452
+ containerWidth: N.current?.getBoundingClientRect().width ?? 0,
2419
2453
  config: n,
2420
- render: se ? () => se(e[T]) : void 0,
2454
+ render: re ? () => re(e[T]) : void 0,
2421
2455
  valueFormat: ee,
2422
2456
  titleKey: t,
2423
2457
  resolveColor: (ue) => {
2424
- const be = e[T][ue], pe = _(ue, T);
2425
- return typeof be != "number" ? pe : O !== void 0 && be < 0 ? O : pe;
2458
+ const be = e[T][ue], pe = H(ue, T);
2459
+ return typeof be != "number" ? pe : W !== void 0 && be < 0 ? W : pe;
2426
2460
  },
2427
- classes: F
2461
+ classes: j
2428
2462
  }
2429
2463
  ) : null;
2430
2464
  return /* @__PURE__ */ s(
2431
- Ye,
2465
+ Ve,
2432
2466
  {
2433
- ref: $,
2467
+ ref: N,
2434
2468
  aspectRatio: i,
2435
2469
  height: c,
2436
- className: I,
2437
- style: Q,
2438
- classes: F,
2439
- legend: u ? /* @__PURE__ */ s(vt, { config: n, classes: F }) : void 0,
2440
- 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,
2441
2475
  children: ({ width: ue, height: be }) => {
2442
- const pe = te.left, fe = ue - te.right, ge = te.top, ve = be - te.bottom, Re = Math.max(0, fe - pe), Ne = Math.max(0, ve - ge), b = Xe(z, W ? [ge, ve] : [pe, fe], l), K = b.bandWidth(), X = Je([G, Z], W ? [pe, fe] : [ve, ge]), A = X(0), de = L ? 1 : Math.max(1, oe.length), Y = K / de, R = Y * (1 - a), ie = V.map((ce) => ({
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) => ({
2443
2477
  value: ce,
2444
- pos: X(ce)
2445
- })), me = _i(z);
2446
- return /* @__PURE__ */ H(Ve, { children: [
2447
- d && /* @__PURE__ */ s("g", { className: f(x.axis, F?.axis), children: ie.map(
2448
- ({ value: ce, pos: ae }) => W ? /* @__PURE__ */ s(
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(
2449
2483
  "line",
2450
2484
  {
2451
- className: f(x.gridLine, F?.grid),
2452
- x1: ae,
2453
- x2: ae,
2485
+ className: f(k.gridLine, j?.grid),
2486
+ x1: se,
2487
+ x2: se,
2454
2488
  y1: ge,
2455
2489
  y2: ve
2456
2490
  },
@@ -2458,22 +2492,22 @@ function Fl({
2458
2492
  ) : /* @__PURE__ */ s(
2459
2493
  "line",
2460
2494
  {
2461
- className: f(x.gridLine, F?.grid),
2495
+ className: f(k.gridLine, j?.grid),
2462
2496
  x1: pe,
2463
2497
  x2: fe,
2464
- y1: ae,
2465
- y2: ae
2498
+ y1: se,
2499
+ y2: se
2466
2500
  },
2467
2501
  `g-${ce}`
2468
2502
  )
2469
2503
  ) }),
2470
- /* @__PURE__ */ s("g", { className: f(x.axis, F?.axis), children: ie.map(({ value: ce, pos: ae }) => {
2504
+ /* @__PURE__ */ s("g", { className: f(k.axis, j?.axis), children: ie.map(({ value: ce, pos: se }) => {
2471
2505
  const Ce = D ? D(ce) : String(ce);
2472
- return W ? /* @__PURE__ */ s(
2506
+ return U ? /* @__PURE__ */ s(
2473
2507
  "text",
2474
2508
  {
2475
- className: f(x.axisLabel, F?.axisLabel),
2476
- x: ae,
2509
+ className: f(k.axisLabel, j?.axisLabel),
2510
+ x: se,
2477
2511
  y: ve + 16,
2478
2512
  textAnchor: "middle",
2479
2513
  children: Ce
@@ -2482,9 +2516,9 @@ function Fl({
2482
2516
  ) : /* @__PURE__ */ s(
2483
2517
  "text",
2484
2518
  {
2485
- className: f(x.axisLabel, F?.axisLabel),
2519
+ className: f(k.axisLabel, j?.axisLabel),
2486
2520
  x: pe - 8,
2487
- y: ae,
2521
+ y: se,
2488
2522
  textAnchor: "end",
2489
2523
  dominantBaseline: "middle",
2490
2524
  children: Ce
@@ -2492,14 +2526,14 @@ function Fl({
2492
2526
  `vt-${ce}`
2493
2527
  );
2494
2528
  }) }),
2495
- /* @__PURE__ */ s("g", { className: f(x.axis, F?.axis), children: me.map((ce) => {
2496
- const ae = b(ce), Ce = C ? C(ce) : ce;
2497
- return W ? /* @__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(
2498
2532
  "text",
2499
2533
  {
2500
- className: f(x.axisLabel, F?.axisLabel),
2534
+ className: f(k.axisLabel, j?.axisLabel),
2501
2535
  x: pe - 8,
2502
- y: ae,
2536
+ y: se,
2503
2537
  textAnchor: "end",
2504
2538
  dominantBaseline: "middle",
2505
2539
  children: Ce
@@ -2508,8 +2542,8 @@ function Fl({
2508
2542
  ) : /* @__PURE__ */ s(
2509
2543
  "text",
2510
2544
  {
2511
- className: f(x.axisLabel, F?.axisLabel),
2512
- x: ae,
2545
+ className: f(k.axisLabel, j?.axisLabel),
2546
+ x: se,
2513
2547
  y: ve + 16,
2514
2548
  textAnchor: "middle",
2515
2549
  children: Ce
@@ -2517,41 +2551,41 @@ function Fl({
2517
2551
  `c-${ce}`
2518
2552
  );
2519
2553
  }) }),
2520
- e.map((ce, ae) => {
2521
- const Ie = b(z[ae]) - K / 2;
2554
+ e.map((ce, se) => {
2555
+ const Ie = v(z[se]) - K / 2;
2522
2556
  let xe = 0, le = 0;
2523
- return /* @__PURE__ */ s("g", { className: f(x.series, F?.series), children: oe.map((De, He) => {
2557
+ return /* @__PURE__ */ s("g", { className: f(k.series, j?.series), children: oe.map((De, He) => {
2524
2558
  const Ge = ce[De];
2525
2559
  if (typeof Ge != "number") return null;
2526
- const Ee = Ge, xt = _(De, ae), kt = O !== void 0 && Ee < 0 ? O : xt, Oe = P !== void 0 ? P === ae : v === ae, tt = P !== 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;
2527
2561
  let nt, Ue;
2528
- L ? Ee >= 0 ? (nt = xe, Ue = xe + Ee, xe = Ue) : (nt = le, Ue = le + Ee, le = Ue) : (nt = 0, Ue = Ee);
2529
- const rt = X(nt), ot = X(Ue), At = L ? (K - R) / 2 : He * Y + (Y - R) / 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;
2530
2564
  let ct = 0, it = 0, lt = 0, st = 0;
2531
- if (W) {
2565
+ if (U) {
2532
2566
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2533
2567
  ct = Ze, lt = wt - Ze, it = Ie + At, st = R;
2534
2568
  } else {
2535
2569
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2536
2570
  ct = Ie + At, lt = R, it = Ze, st = wt - Ze;
2537
2571
  }
2538
- const Mt = w ? w({ row: ce, value: Ee, seriesKey: De, index: ae }) : p ? ee ? ee(Ee) : String(Ee) : null, Fe = zi({
2539
- isHorizontal: W,
2540
- 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,
2541
2575
  x: ct,
2542
2576
  y: it,
2543
2577
  rectW: lt,
2544
2578
  rectH: st,
2545
2579
  value: Ee
2546
2580
  });
2547
- return /* @__PURE__ */ H("g", { children: [
2581
+ return /* @__PURE__ */ F("g", { children: [
2548
2582
  /* @__PURE__ */ s(
2549
2583
  "rect",
2550
2584
  {
2551
2585
  className: f(
2552
- x.bar,
2553
- Oe && x.activeBar,
2554
- F?.point
2586
+ k.bar,
2587
+ Oe && k.activeBar,
2588
+ j?.point
2555
2589
  ),
2556
2590
  x: ct,
2557
2591
  y: it,
@@ -2561,16 +2595,16 @@ function Fl({
2561
2595
  ry: h,
2562
2596
  fill: kt,
2563
2597
  opacity: tt ? 0.35 : 1,
2564
- onClick: U ? () => U({ row: ce, value: Ee, seriesKey: De, index: ae }) : void 0,
2565
- style: U ? { 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
2566
2600
  }
2567
2601
  ),
2568
2602
  Mt != null && /* @__PURE__ */ s(
2569
2603
  "text",
2570
2604
  {
2571
2605
  className: f(
2572
- x.axisLabel,
2573
- (y === "inside" || y === "inside-start") && x.barLabelInside
2606
+ k.axisLabel,
2607
+ (x === "inside" || x === "inside-start") && k.barLabelInside
2574
2608
  ),
2575
2609
  x: Fe.x,
2576
2610
  y: Fe.y,
@@ -2582,35 +2616,35 @@ function Fl({
2582
2616
  }
2583
2617
  )
2584
2618
  ] }, De);
2585
- }) }, `group-${ae}`);
2619
+ }) }, `group-${se}`);
2586
2620
  }),
2587
- G < 0 && Z > 0 && /* @__PURE__ */ s(
2621
+ L < 0 && A > 0 && /* @__PURE__ */ s(
2588
2622
  "line",
2589
2623
  {
2590
- className: f(x.gridLine),
2591
- x1: W ? A : pe,
2592
- x2: W ? A : fe,
2593
- y1: W ? ge : A,
2594
- y2: W ? 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,
2595
2629
  opacity: 0.9
2596
2630
  }
2597
2631
  ),
2598
2632
  /* @__PURE__ */ s(
2599
2633
  "rect",
2600
2634
  {
2601
- className: x.interactionLayer,
2635
+ className: k.interactionLayer,
2602
2636
  x: pe,
2603
2637
  y: ge,
2604
2638
  width: Re,
2605
2639
  height: Ne,
2606
2640
  onMouseMove: (ce) => {
2607
- const ae = ce.currentTarget.getBoundingClientRect(), Ce = ce.clientX - ae.left + pe, Ie = ce.clientY - ae.top + ge, xe = b.step(), le = W ? Ie - ge : Ce - pe, De = Math.max(
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(
2608
2642
  0,
2609
2643
  Math.min(e.length - 1, Math.round((le - xe / 2) / xe))
2610
2644
  );
2611
- k(De);
2645
+ B(De);
2612
2646
  },
2613
- onMouseLeave: () => k(null)
2647
+ onMouseLeave: () => B(null)
2614
2648
  }
2615
2649
  )
2616
2650
  ] });
@@ -2670,17 +2704,17 @@ function zi({
2670
2704
  dominantBaseline: a ? "auto" : "middle"
2671
2705
  };
2672
2706
  }
2673
- function Vi(e, t, n, r, o, i, c) {
2707
+ function Yi(e, t, n, r, o, i, c) {
2674
2708
  const l = o.current;
2675
2709
  if (!l) return 0;
2676
- const a = l.getBoundingClientRect(), h = e.map((u) => String(u[t]));
2677
- return i ? a.width / 2 : Xe(h, [n.left, a.width - n.right], c)(h[r]);
2710
+ const a = l.getBoundingClientRect(), h = e.map((d) => String(d[t]));
2711
+ return i ? a.width / 2 : _e(h, [n.left, a.width - n.right], c)(h[r]);
2678
2712
  }
2679
- function Yi(e, t, n, r, o, i) {
2713
+ function Vi(e, t, n, r, o, i) {
2680
2714
  const c = o.current;
2681
2715
  if (!c) return 16;
2682
- const l = c.getBoundingClientRect(), a = e.map((d) => String(d[t]));
2683
- return Xe(a, [n.top, l.height - n.bottom], i)(a[r]);
2716
+ const l = c.getBoundingClientRect(), a = e.map((u) => String(u[t]));
2717
+ return _e(a, [n.top, l.height - n.bottom], i)(a[r]);
2684
2718
  }
2685
2719
  const qi = [
2686
2720
  "var(--crk-chart-1)",
@@ -2710,21 +2744,21 @@ function Gi(e, t, n, r, o, i) {
2710
2744
  `A ${n} ${n} 0 1 1 ${e + n} ${t}`,
2711
2745
  "Z"
2712
2746
  ].join(" ");
2713
- 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), d = t + n * Math.sin(c), u = e + n * Math.cos(l), m = t + n * Math.sin(l);
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);
2714
2748
  if (r > 0) {
2715
- const p = e + r * Math.cos(l), y = t + r * Math.sin(l), w = e + r * Math.cos(c), N = 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);
2716
2750
  return [
2717
- `M ${h} ${d}`,
2718
- `A ${n} ${n} 0 ${a} 1 ${u} ${m}`,
2719
- `L ${p} ${y}`,
2720
- `A ${r} ${r} 0 ${a} 0 ${w} ${N}`,
2751
+ `M ${h} ${u}`,
2752
+ `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2753
+ `L ${p} ${x}`,
2754
+ `A ${r} ${r} 0 ${a} 0 ${C} ${$}`,
2721
2755
  "Z"
2722
2756
  ].join(" ");
2723
2757
  }
2724
2758
  return [
2725
2759
  `M ${e} ${t}`,
2726
- `L ${h} ${d}`,
2727
- `A ${n} ${n} 0 ${a} 1 ${u} ${m}`,
2760
+ `L ${h} ${u}`,
2761
+ `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2728
2762
  "Z"
2729
2763
  ].join(" ");
2730
2764
  }
@@ -2743,124 +2777,124 @@ function jl({
2743
2777
  innerRadius: l = 0,
2744
2778
  outerRadius: a = "90%",
2745
2779
  strokeWidth: h = 2,
2746
- strokeColor: d = "var(--crk-color-bg)",
2747
- padAngle: u = 0,
2780
+ strokeColor: u = "var(--crk-color-bg)",
2781
+ padAngle: d = 0,
2748
2782
  showLabels: m = !1,
2749
2783
  valuePosition: p = "outside",
2750
- showLabelLines: y = !0,
2751
- renderLabel: w,
2752
- centerLabel: N,
2753
- activeIndex: S,
2754
- onSliceClick: O,
2755
- showLegend: P = !0,
2756
- showTooltip: U = !0,
2757
- valueFormat: re,
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,
2758
2792
  renderTooltip: D,
2759
- emptyMessage: C = "No data",
2793
+ emptyMessage: S = "No data",
2760
2794
  className: ee,
2761
- style: se,
2795
+ style: re,
2762
2796
  classes: M
2763
2797
  }) {
2764
- const [q, I] = Se(null), Q = ne(null), F = S ?? q, W = (k) => {
2798
+ const [G, O] = Se(null), te = ne(null), j = b ?? G, U = (B) => {
2765
2799
  if (r) {
2766
- const $ = e[k]?.[r];
2767
- if (typeof $ == "string") return $;
2800
+ const N = e[B]?.[r];
2801
+ if (typeof N == "string") return N;
2768
2802
  }
2769
- return o[k % o.length];
2770
- }, te = ke(() => {
2771
- let k = 0;
2772
- for (const $ of e) {
2773
- const z = $[t];
2774
- typeof z == "number" && z > 0 && (k += z);
2803
+ return o[B % o.length];
2804
+ }, J = ke(() => {
2805
+ let B = 0;
2806
+ for (const N of e) {
2807
+ const z = N[t];
2808
+ typeof z == "number" && z > 0 && (B += z);
2775
2809
  }
2776
- return k;
2810
+ return B;
2777
2811
  }, [e, t]);
2778
- if (e.length === 0 || te === 0)
2779
- return /* @__PURE__ */ s("div", { ref: Q, className: f(x.root, M?.root, ee), style: se, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: c ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: C }) }) });
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 }) }) });
2780
2814
  const oe = ke(() => {
2781
- const k = [];
2782
- let $ = 0;
2815
+ const B = [];
2816
+ let N = 0;
2783
2817
  for (let z = 0; z < e.length; z++) {
2784
- const T = e[z], j = T[t], V = typeof j == "number" && j > 0 ? j : 0;
2785
- if (V === 0) continue;
2786
- const G = V / te, Z = G * 360;
2787
- k.push({ index: z, row: T, value: V, start: $, end: $ + Z, fraction: G }), $ += 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;
2788
2822
  }
2789
- return k;
2790
- }, [e, t, te]), L = P ? /* @__PURE__ */ s("div", { className: f(x.legend, M?.legend), role: "list", children: oe.map((k) => /* @__PURE__ */ H("div", { className: f(x.legendItem, M?.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: [
2791
2825
  /* @__PURE__ */ s(
2792
2826
  "span",
2793
2827
  {
2794
- className: x.legendSwatch,
2795
- style: { background: W(k.index) },
2828
+ className: k.legendSwatch,
2829
+ style: { background: U(B.index) },
2796
2830
  "aria-hidden": "true"
2797
2831
  }
2798
2832
  ),
2799
- /* @__PURE__ */ s("span", { className: x.legendLabel, children: String(k.row[n]) })
2800
- ] }, k.index)) }) : void 0, v = ke(() => {
2801
- const k = {};
2802
- for (const $ of oe)
2803
- k[$.index.toString()] = {
2804
- label: String($.row[n]),
2805
- color: W($.index)
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()] = {
2838
+ label: String(N.row[n]),
2839
+ color: U(N.index)
2806
2840
  };
2807
- return k;
2841
+ return B;
2808
2842
  }, [oe]);
2809
2843
  return /* @__PURE__ */ s(
2810
- Ye,
2844
+ Ve,
2811
2845
  {
2812
- ref: Q,
2846
+ ref: te,
2813
2847
  aspectRatio: i,
2814
2848
  height: c,
2815
2849
  className: ee,
2816
- style: se,
2850
+ style: re,
2817
2851
  classes: M,
2818
- legend: L,
2819
- overlay: U && F !== null && e[F] ? /* @__PURE__ */ s(
2852
+ legend: he,
2853
+ overlay: Y && j !== null && e[j] ? /* @__PURE__ */ s(
2820
2854
  et,
2821
2855
  {
2822
- row: { [F.toString()]: e[F][t] },
2823
- 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,
2824
2858
  y: 16,
2825
- containerWidth: Q.current?.getBoundingClientRect().width ?? 0,
2826
- config: { [F.toString()]: v[F.toString()] },
2827
- render: D ? () => D(e[F]) : void 0,
2828
- valueFormat: re,
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,
2829
2863
  titleKey: void 0,
2830
2864
  classes: M
2831
2865
  }
2832
2866
  ) : null,
2833
- children: ({ width: k, height: $ }) => {
2834
- const z = k / 2, T = $ / 2, j = Math.min(k, $) / 2 - 4, V = It(a, j), G = Math.min(V - 1, It(l, j)), Z = Math.max(4, V * 0.06);
2835
- return /* @__PURE__ */ H(Ve, { children: [
2836
- /* @__PURE__ */ s("g", { children: oe.map((_) => {
2837
- const J = u / 2, ue = Math.min(_.end, _.start + J), be = Math.max(_.start, _.end - J), pe = W(_.index), fe = F === _.index, ge = S !== void 0 && !fe, ve = fe && S !== void 0 ? V + Z : V, Re = Gi(z, T, ve, G, ue, be), Ne = O ? () => O({ row: _.row, value: _.value, index: _.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;
2838
2872
  return /* @__PURE__ */ s(
2839
2873
  "path",
2840
2874
  {
2841
2875
  d: Re,
2842
2876
  fill: pe,
2843
- stroke: h > 0 ? d : "none",
2877
+ stroke: h > 0 ? u : "none",
2844
2878
  strokeWidth: h,
2845
2879
  opacity: ge ? 0.45 : 1,
2846
- onMouseEnter: () => I(_.index),
2847
- onMouseLeave: () => I(null),
2880
+ onMouseEnter: () => O(H.index),
2881
+ onMouseLeave: () => O(null),
2848
2882
  onClick: Ne,
2849
2883
  style: Ne ? { cursor: "pointer" } : void 0
2850
2884
  },
2851
- _.index
2885
+ H.index
2852
2886
  );
2853
2887
  }) }),
2854
- (m || w) && oe.map((_) => {
2855
- const J = w ? w({ row: _.row, value: _.value, fraction: _.fraction, index: _.index }) : m ? `${String(_.row[n])} ${re ? re(_.value) : Math.round(_.fraction * 100) + "%"}` : null;
2856
- if (J == null) return null;
2857
- const ue = p === "inside", be = Math.max(16, V * 0.12), pe = ue ? (V + G) / 2 : V + be, fe = Et(z, T, pe, _.start, _.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";
2858
2892
  let ve = null;
2859
- if (!ue && y) {
2860
- const Re = Et(z, T, V, _.start, _.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;
2861
2895
  ve = { x1: Re.x, y1: Re.y, x2: fe.x + g, y2: fe.y };
2862
2896
  }
2863
- return /* @__PURE__ */ H("g", { children: [
2897
+ return /* @__PURE__ */ F("g", { children: [
2864
2898
  ve && /* @__PURE__ */ s(
2865
2899
  "line",
2866
2900
  {
@@ -2868,7 +2902,7 @@ function jl({
2868
2902
  y1: ve.y1,
2869
2903
  x2: ve.x2,
2870
2904
  y2: ve.y2,
2871
- stroke: W(_.index),
2905
+ stroke: U(H.index),
2872
2906
  strokeWidth: 1,
2873
2907
  opacity: 0.7
2874
2908
  }
@@ -2879,23 +2913,23 @@ function jl({
2879
2913
  x: fe.x,
2880
2914
  y: fe.y,
2881
2915
  className: f(
2882
- x.axisLabel,
2883
- ue && x.barLabelInside
2916
+ k.axisLabel,
2917
+ ue && k.barLabelInside
2884
2918
  ),
2885
2919
  textAnchor: ge,
2886
2920
  dominantBaseline: "middle",
2887
- children: J
2921
+ children: Z
2888
2922
  }
2889
2923
  )
2890
- ] }, `label-${_.index}`);
2924
+ ] }, `label-${H.index}`);
2891
2925
  }),
2892
- N !== void 0 && /* @__PURE__ */ s(
2926
+ $ !== void 0 && /* @__PURE__ */ s(
2893
2927
  "foreignObject",
2894
2928
  {
2895
- x: z - G,
2896
- y: T - G,
2897
- width: Math.max(0, G * 2),
2898
- 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),
2899
2933
  style: { pointerEvents: "none" },
2900
2934
  children: /* @__PURE__ */ s(
2901
2935
  "div",
@@ -2911,7 +2945,7 @@ function jl({
2911
2945
  color: "var(--crk-color-text)",
2912
2946
  fontFamily: "var(--crk-font-family)"
2913
2947
  },
2914
- children: N
2948
+ children: $
2915
2949
  }
2916
2950
  )
2917
2951
  }
@@ -2942,48 +2976,48 @@ function Xl({
2942
2976
  showRadialLines: l = !0,
2943
2977
  showAxisLabels: a = !0,
2944
2978
  showRadiusAxis: h = !1,
2945
- levels: d = 5,
2946
- showPoints: u = !0,
2979
+ levels: u = 5,
2980
+ showPoints: d = !0,
2947
2981
  fillOpacity: m = 0.4,
2948
2982
  strokeWidth: p = 2,
2949
- renderAxisLabel: y,
2950
- axisFormat: w,
2951
- valueFormat: N,
2952
- renderTooltip: S,
2953
- showLegend: O = !0,
2954
- showTooltip: P = !0,
2955
- emptyMessage: U = "No data",
2956
- className: re,
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,
2957
2991
  style: D,
2958
- classes: C
2992
+ classes: S
2959
2993
  }) {
2960
- const [ee, se] = Se(null), M = ne(null), q = ke(() => Object.keys(n), [n]);
2994
+ const [ee, re] = Se(null), M = ne(null), G = ke(() => Object.keys(n), [n]);
2961
2995
  if (e.length === 0)
2962
- return /* @__PURE__ */ s("div", { ref: M, className: f(x.root, C?.root, re), style: D, children: /* @__PURE__ */ s("div", { className: x.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: x.empty, children: U }) }) });
2963
- const I = ke(
2964
- () => e.map((te, oe) => oe / 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),
2965
2999
  [e]
2966
- ), Q = ke(() => {
2967
- const te = [];
2968
- for (const L of q)
2969
- for (const v of e) {
2970
- const k = v[L];
2971
- typeof k == "number" && te.push(k);
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);
2972
3006
  }
2973
- const [, oe] = bt(te);
3007
+ const [, oe] = bt(J);
2974
3008
  return Math.max(1, oe);
2975
- }, [e, q]), F = ke(() => qe(0, Q, d).filter((oe) => oe > 0), [Q, d]), W = F[F.length - 1] ?? Q;
3009
+ }, [e, G]), j = ke(() => qe(0, te, u).filter((oe) => oe > 0), [te, u]), U = j[j.length - 1] ?? te;
2976
3010
  return /* @__PURE__ */ s(
2977
- Ye,
3011
+ Ve,
2978
3012
  {
2979
3013
  ref: M,
2980
3014
  aspectRatio: r,
2981
3015
  height: o,
2982
- className: re,
3016
+ className: Q,
2983
3017
  style: D,
2984
- classes: C,
2985
- legend: O ? /* @__PURE__ */ s(vt, { config: n, classes: C }) : void 0,
2986
- overlay: P && ee !== null ? /* @__PURE__ */ s(
3018
+ classes: S,
3019
+ legend: W ? /* @__PURE__ */ s(vt, { config: n, classes: S }) : void 0,
3020
+ overlay: X && ee !== null ? /* @__PURE__ */ s(
2987
3021
  et,
2988
3022
  {
2989
3023
  row: e[ee],
@@ -2991,139 +3025,139 @@ function Xl({
2991
3025
  y: 16,
2992
3026
  containerWidth: M.current?.getBoundingClientRect().width ?? 0,
2993
3027
  config: n,
2994
- render: S ? () => S(e[ee]) : void 0,
2995
- valueFormat: N,
3028
+ render: b ? () => b(e[ee]) : void 0,
3029
+ valueFormat: $,
2996
3030
  titleKey: t,
2997
- classes: C
3031
+ classes: S
2998
3032
  }
2999
3033
  ) : null,
3000
- children: ({ width: te, height: oe }) => {
3001
- const L = a ? 32 : 8, v = te / 2, k = oe / 2, $ = Math.max(0, Math.min(te, oe) / 2 - L), z = (T) => Math.max(0, T) / W * $;
3002
- return /* @__PURE__ */ H(Ve, { children: [
3003
- c && F.map((T) => {
3004
- const j = z(T);
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);
3005
3039
  return i === "circle" ? /* @__PURE__ */ s(
3006
3040
  "circle",
3007
3041
  {
3008
- className: f(x.gridLine, C?.grid),
3009
- cx: v,
3010
- cy: k,
3011
- r: j,
3042
+ className: f(k.gridLine, S?.grid),
3043
+ cx: w,
3044
+ cy: B,
3045
+ r: _,
3012
3046
  fill: "none"
3013
3047
  },
3014
3048
  `ring-${T}`
3015
3049
  ) : /* @__PURE__ */ s(
3016
3050
  "polygon",
3017
3051
  {
3018
- className: f(x.gridLine, C?.grid),
3019
- points: Zi(v, k, j, I),
3052
+ className: f(k.gridLine, S?.grid),
3053
+ points: Zi(w, B, _, O),
3020
3054
  fill: "none"
3021
3055
  },
3022
3056
  `ring-${T}`
3023
3057
  );
3024
3058
  }),
3025
- l && I.map((T, j) => {
3026
- const V = mt(v, k, $, T);
3059
+ l && O.map((T, _) => {
3060
+ const y = mt(w, B, N, T);
3027
3061
  return /* @__PURE__ */ s(
3028
3062
  "line",
3029
3063
  {
3030
- className: f(x.gridLine, C?.grid),
3031
- x1: v,
3032
- y1: k,
3033
- x2: V.x,
3034
- y2: V.y
3064
+ className: f(k.gridLine, S?.grid),
3065
+ x1: w,
3066
+ y1: B,
3067
+ x2: y.x,
3068
+ y2: y.y
3035
3069
  },
3036
- `spoke-${j}`
3070
+ `spoke-${_}`
3037
3071
  );
3038
3072
  }),
3039
- h && F.map((T) => {
3040
- const j = z(T);
3073
+ h && j.map((T) => {
3074
+ const _ = z(T);
3041
3075
  return /* @__PURE__ */ s(
3042
3076
  "text",
3043
3077
  {
3044
- className: f(x.axisLabel, C?.axisLabel),
3045
- x: v + 4,
3046
- y: k - j,
3078
+ className: f(k.axisLabel, S?.axisLabel),
3079
+ x: w + 4,
3080
+ y: B - _,
3047
3081
  textAnchor: "start",
3048
3082
  dominantBaseline: "middle",
3049
- children: N ? N(T) : T
3083
+ children: $ ? $(T) : T
3050
3084
  },
3051
3085
  `raxis-${T}`
3052
3086
  );
3053
3087
  }),
3054
- a && e.map((T, j) => {
3055
- const V = I[j], G = mt(v, k, $ + 14, V), Z = G.x < v - 1 ? "end" : G.x > v + 1 ? "start" : "middle";
3056
- if (y)
3057
- return /* @__PURE__ */ s("g", { children: y({
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({
3058
3092
  row: T,
3059
- index: j,
3060
- angle: V,
3061
- x: G.x,
3062
- y: G.y,
3063
- textAnchor: Z
3064
- }) }, `label-${j}`);
3065
- const _ = String(T[t]), J = w ? w(_) : _;
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;
3066
3100
  return /* @__PURE__ */ s(
3067
3101
  "text",
3068
3102
  {
3069
- className: f(x.axisLabel, C?.axisLabel),
3070
- x: G.x,
3071
- y: G.y,
3072
- textAnchor: Z,
3103
+ className: f(k.axisLabel, S?.axisLabel),
3104
+ x: L.x,
3105
+ y: L.y,
3106
+ textAnchor: A,
3073
3107
  dominantBaseline: "middle",
3074
- children: J
3108
+ children: Z
3075
3109
  },
3076
- `label-${j}`
3110
+ `label-${_}`
3077
3111
  );
3078
3112
  }),
3079
- q.map((T) => {
3080
- const j = n[T], V = e.map((Z, _) => {
3081
- const J = Z[T], be = z(typeof J == "number" ? J : 0);
3082
- return mt(v, k, be, I[_]);
3083
- }), G = V.map((Z) => `${Z.x},${Z.y}`).join(" ");
3084
- 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: [
3085
3119
  /* @__PURE__ */ s(
3086
3120
  "polygon",
3087
3121
  {
3088
- points: G,
3089
- fill: j.color,
3122
+ points: L,
3123
+ fill: _.color,
3090
3124
  fillOpacity: m,
3091
- stroke: j.color,
3125
+ stroke: _.color,
3092
3126
  strokeWidth: p,
3093
3127
  strokeLinejoin: "round",
3094
3128
  strokeLinecap: "round"
3095
3129
  }
3096
3130
  ),
3097
- u && V.map((Z, _) => /* @__PURE__ */ s(
3131
+ d && y.map((A, H) => /* @__PURE__ */ s(
3098
3132
  "circle",
3099
3133
  {
3100
- className: f(x.point, C?.point),
3101
- cx: Z.x,
3102
- cy: Z.y,
3103
- r: ee === _ ? 5 : 3.5,
3104
- fill: j.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
3105
3139
  },
3106
- `${T}-${_}`
3140
+ `${T}-${H}`
3107
3141
  ))
3108
3142
  ] }, T);
3109
3143
  }),
3110
3144
  /* @__PURE__ */ s(
3111
3145
  "rect",
3112
3146
  {
3113
- className: x.interactionLayer,
3147
+ className: k.interactionLayer,
3114
3148
  x: 0,
3115
3149
  y: 0,
3116
- width: te,
3150
+ width: J,
3117
3151
  height: oe,
3118
3152
  onMouseMove: (T) => {
3119
- const j = T.currentTarget.getBoundingClientRect(), V = T.clientX - j.left - v, G = T.clientY - j.top - k;
3120
- if (V === 0 && G === 0) return;
3121
- let Z = Math.atan2(G, V) * 180 / Math.PI + 90;
3122
- Z < 0 && (Z += 360), Z >= 360 && (Z -= 360);
3123
- const _ = 360 / e.length, J = Math.round(Z / _) % e.length;
3124
- se(J);
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);
3125
3159
  },
3126
- onMouseLeave: () => se(null)
3160
+ onMouseLeave: () => re(null)
3127
3161
  }
3128
3162
  )
3129
3163
  ] });
@@ -3160,14 +3194,14 @@ function Ji(e, t, n = 2) {
3160
3194
  let a = 0;
3161
3195
  for (let m = l - t + 1; m <= l; m++) a += e[m].close;
3162
3196
  const h = a / t;
3163
- let d = 0;
3197
+ let u = 0;
3164
3198
  for (let m = l - t + 1; m <= l; m++) {
3165
3199
  const p = e[m].close - h;
3166
- d += p * p;
3200
+ u += p * p;
3167
3201
  }
3168
- d /= t;
3169
- const u = Math.sqrt(d);
3170
- o[l] = h, i[l] = h + n * u, c[l] = h - n * u;
3202
+ u /= t;
3203
+ const d = Math.sqrt(u);
3204
+ o[l] = h, i[l] = h + n * d, c[l] = h - n * d;
3171
3205
  }
3172
3206
  return { middle: o, upper: i, lower: c };
3173
3207
  }
@@ -3189,7 +3223,7 @@ function el(e, t = 14) {
3189
3223
  function Pt(e, t) {
3190
3224
  return t === 0 ? 100 : 100 - 100 / (1 + e / t);
3191
3225
  }
3192
- function Ul(e) {
3226
+ function _l(e) {
3193
3227
  return e.map((t) => typeof t.volume == "number" ? t.volume : null);
3194
3228
  }
3195
3229
  const Le = 86400;
@@ -3221,7 +3255,7 @@ function nn(e) {
3221
3255
  }
3222
3256
  return 30 * Le;
3223
3257
  }
3224
- function _l(e) {
3258
+ function Ul(e) {
3225
3259
  switch (e) {
3226
3260
  case "1D":
3227
3261
  return "5";
@@ -3248,7 +3282,7 @@ function zl(e) {
3248
3282
  return !Number.isFinite(t) || t >= 240 ? "3M" : t >= 60 ? "1M" : t >= 15 || t >= 5 ? "5D" : "1D";
3249
3283
  }
3250
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 = [];
3251
- function Vl({
3285
+ function Yl({
3252
3286
  datafeed: e,
3253
3287
  symbol: t,
3254
3288
  resolution: n,
@@ -3259,59 +3293,59 @@ function Vl({
3259
3293
  initialLookback: l = il,
3260
3294
  height: a = tl,
3261
3295
  upColor: h = "var(--crk-color-success)",
3262
- downColor: d = "var(--crk-color-danger)",
3263
- lineColor: u = "var(--crk-chart-1)",
3296
+ downColor: u = "var(--crk-color-danger)",
3297
+ lineColor: d = "var(--crk-chart-1)",
3264
3298
  timezone: m,
3265
3299
  defaultTimezone: p = "local",
3266
- onTimezoneChange: y,
3267
- showConfigPanel: w = !0,
3268
- onCrosshair: N,
3269
- onVisibleRangeChange: S,
3270
- className: O,
3271
- style: P
3300
+ onTimezoneChange: x,
3301
+ showConfigPanel: C = !0,
3302
+ onCrosshair: $,
3303
+ onVisibleRangeChange: b,
3304
+ className: W,
3305
+ style: X
3272
3306
  }) {
3273
- const U = ne(null), re = ne(null), D = ne([]), C = ne({ from: 0, to: 0 }), ee = ne(null), se = ne(null), M = ne(!1), q = ne(null), I = ne(null), Q = ne(1), F = ne({ width: 0, height: 0 }), W = ne(() => {
3274
- }), te = ne(N), oe = ne(S);
3275
- te.current = N, oe.current = S;
3276
- const [L, v] = Se(null), [k, $] = Se(p), z = m ?? k, T = 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(
3277
3311
  (g) => {
3278
- m === void 0 && $(g), y?.(g);
3312
+ m === void 0 && N(g), x?.(g);
3279
3313
  },
3280
- [m, y]
3281
- ), j = ke(
3282
- () => ({ up: h, down: d, line: u }),
3283
- [h, d, u]
3284
- ), V = i, G = V.some((g) => g.type === "rsi"), Z = V.some((g) => g.type === "volume"), _ = he(() => {
3285
- const g = re.current;
3314
+ [m, x]
3315
+ ), _ = ke(
3316
+ () => ({ up: h, down: u, line: d }),
3317
+ [h, u, d]
3318
+ ), y = i, L = y.some((g) => g.type === "rsi"), A = y.some((g) => g.type === "volume"), H = de(() => {
3319
+ const g = Q.current;
3286
3320
  if (!g) return;
3287
- const b = g.getContext("2d");
3288
- if (!b) return;
3289
- const { width: K, height: B } = F.current;
3290
- if (K === 0 || B === 0) return;
3291
- const X = Q.current;
3292
- b.save(), b.setTransform(1, 0, 0, 1, 0, 0), b.clearRect(0, 0, g.width, g.height), b.scale(X, X);
3293
- const A = fl(U.current, j), de = on(U.current), Y = D.current;
3294
- if (Y.length === 0) {
3295
- pl(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();
3296
3330
  return;
3297
3331
  }
3298
- const R = Nt(K, B, G, Z), { from: ie, to: me } = ul(C.current, Y.length);
3299
- C.current = { from: ie, to: me };
3300
- const ce = Y.slice(Math.max(0, Math.floor(ie)), Math.min(Y.length, Math.ceil(me) + 1)), ae = (le) => {
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) => {
3301
3335
  const De = me - ie + 1, He = R.plotWidth / De;
3302
3336
  return R.plotLeft + (le - ie + 0.5) * He;
3303
- }, Ce = R.plotWidth / (me - ie + 1), Ie = V.map((le) => hl(le, Y)).filter((le) => le !== null).map((le) => ({ ...le, color: de(le.color) })), xe = rn(R.main, ce, Ie, ie, me);
3304
- Lt(b, R.plotLeft, R.plotRight, xe, A), gl(b, R, xe, c, A), b.save(), b.beginPath(), b.rect(R.plotLeft, xe.paneTop, R.plotWidth, xe.paneHeight), b.clip();
3305
- for (let le = 0; le < V.length; le++) {
3306
- const De = V[le], He = Ie[le];
3307
- He && xl(b, He, De, Y, ie, me, ae, xe);
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);
3308
3342
  }
3309
- if (o === "candle" ? yl(b, Y, ie, me, ae, Ce, xe, { up: A.up, down: A.down }) : o === "bar" ? vl(b, Y, ie, me, ae, Ce, xe, { up: A.up, down: A.down }) : bl(b, Y, ie, me, ae, xe, A.line, o === "area"), b.restore(), R.volume) {
3310
- const le = ml(R.volume, Y, ie, me);
3311
- Lt(b, R.plotLeft, R.plotRight, le, A, !0), Ot(b, R, R.volume, "Volume", A), b.save(), b.beginPath(), b.rect(R.plotLeft, le.paneTop, R.plotWidth, le.paneHeight), b.clip(), kl(b, Y, ie, me, ae, Ce, le, { 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();
3312
3346
  }
3313
3347
  if (R.rsi) {
3314
- const le = V.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 = de(Ee), kt = el(Y, De), Oe = {
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 = {
3315
3349
  paneTop: R.rsi.top,
3316
3350
  paneBottom: R.rsi.bottom,
3317
3351
  paneHeight: R.rsi.height,
@@ -3319,151 +3353,151 @@ function Vl({
3319
3353
  priceMax: 100,
3320
3354
  ticks: [Ge, 50, He]
3321
3355
  };
3322
- Lt(b, R.plotLeft, R.plotRight, Oe, A, !0), Ot(b, R, R.rsi, `RSI ${De}`, A), b.save(), b.beginPath(), b.rect(R.plotLeft, Oe.paneTop, R.plotWidth, Oe.paneHeight), b.clip(), Qe(b, kt, ie, me, ae, Oe, xt), b.restore(), Ml(b, R, 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);
3323
3357
  }
3324
- wl(b, R, Y, ie, me, n, A), ee.current && $l(b, R, ee.current, Y, ie, me, ae, c, xe, z, A), b.restore();
3325
- }, [o, V, G, Z, c, j, n, z]);
3326
- W.current = _;
3327
- const J = he(() => {
3328
- if (I.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) {
3329
3363
  if (typeof requestAnimationFrame > "u") {
3330
- W.current();
3364
+ U.current();
3331
3365
  return;
3332
3366
  }
3333
- I.current = requestAnimationFrame(() => {
3334
- I.current = null, W.current();
3367
+ O.current = requestAnimationFrame(() => {
3368
+ O.current = null, U.current();
3335
3369
  });
3336
3370
  }
3337
3371
  }, []);
3338
3372
  dn(() => {
3339
- const g = U.current;
3373
+ const g = Y.current;
3340
3374
  if (!g) return;
3341
- const b = () => {
3342
- const B = g.getBoundingClientRect(), X = typeof window < "u" && window.devicePixelRatio || 1;
3343
- Q.current = X, F.current = { width: B.width, height: B.height };
3344
- const A = re.current;
3345
- A && (A.width = Math.round(B.width * X), A.height = Math.round(B.height * X), 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();
3346
3380
  };
3347
- if (b(), typeof ResizeObserver > "u") return;
3348
- const K = new ResizeObserver(b);
3381
+ if (v(), typeof ResizeObserver > "u") return;
3382
+ const K = new ResizeObserver(v);
3349
3383
  return K.observe(g), () => K.disconnect();
3350
- }, [J]), Be(() => {
3384
+ }, [Z]), Be(() => {
3351
3385
  let g = !1;
3352
- const b = Math.floor(Date.now() / 1e3), K = Ft(n), B = r !== void 0 ? nn(r) : K * l, X = r !== void 0 ? Math.max(10, Math.ceil(B / K)) : l, A = b - B;
3353
- D.current = [], C.current = { from: 0, to: 0 }, J(), e.getBars({ symbol: t, resolution: n, from: A, to: b, countBack: X }).then((Y) => {
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) => {
3354
3388
  if (g) return;
3355
- const R = [...Y].sort((me, ce) => me.time - ce.time);
3389
+ const R = [...q].sort((me, ce) => me.time - ce.time);
3356
3390
  D.current = R;
3357
3391
  const ie = R.length - 1;
3358
3392
  if (r !== void 0)
3359
- C.current = { from: 0, to: ie };
3393
+ S.current = { from: 0, to: ie };
3360
3394
  else {
3361
3395
  const me = Math.min(R.length, Math.min(200, l));
3362
- C.current = {
3396
+ S.current = {
3363
3397
  from: Math.max(0, ie - me + 1),
3364
3398
  to: ie
3365
3399
  };
3366
3400
  }
3367
- oe.current?.(C.current, R), J();
3401
+ oe.current?.(S.current, R), Z();
3368
3402
  }).catch(() => {
3369
3403
  });
3370
- const de = e.subscribeBars({
3404
+ const ae = e.subscribeBars({
3371
3405
  symbol: t,
3372
3406
  resolution: n,
3373
- onTick: (Y) => {
3407
+ onTick: (q) => {
3374
3408
  if (g) return;
3375
3409
  const R = D.current, ie = R[R.length - 1];
3376
- if (ie && ie.time === Y.time)
3377
- R[R.length - 1] = Y;
3378
- else if (!ie || Y.time > ie.time) {
3379
- R.push(Y);
3380
- const me = C.current;
3381
- me.to >= R.length - 2 && (C.current = { from: me.from + 1, to: me.to + 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 });
3382
3416
  }
3383
- J();
3417
+ Z();
3384
3418
  }
3385
3419
  });
3386
- return q.current = de, () => {
3387
- 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);
3388
3422
  };
3389
3423
  }, [e, t, n, r, l]);
3390
- const ue = he((g) => {
3391
- v(g), te.current?.(g);
3392
- }, []), be = he((g) => {
3424
+ const ue = de((g) => {
3425
+ w(g), J.current?.(g);
3426
+ }, []), be = de((g) => {
3393
3427
  g.currentTarget.setPointerCapture(g.pointerId);
3394
- const b = C.current;
3395
- se.current = { startX: g.clientX, from: b.from, to: b.to };
3396
- }, []), pe = he(
3428
+ const v = S.current;
3429
+ re.current = { startX: g.clientX, from: v.from, to: v.to };
3430
+ }, []), pe = de(
3397
3431
  (g) => {
3398
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left, B = g.clientY - b.top;
3399
- if (ee.current = { x: K, y: B }, se.current) {
3400
- const { startX: de, from: Y, to: R } = se.current, { width: ie } = F.current, me = Math.max(1, ie - Rt), ce = R - Y + 1, ae = me / ce, Ce = -(g.clientX - de) / ae;
3401
- let Ie = Y + Ce, xe = R + Ce;
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;
3402
3436
  const le = D.current.length;
3403
- Ie < 0 && (Ne(), Ie = 0, xe = ce - 1), xe > le - 1 && (xe = le - 1, Ie = xe - ce + 1), C.current = { from: Ie, to: xe }, oe.current?.(C.current, D.current);
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);
3404
3438
  }
3405
- const X = Nt(b.width, b.height, G, Z), A = C.current;
3406
- if (K >= X.plotLeft && K <= X.plotRight) {
3407
- const de = A.to - A.from + 1, Y = X.plotWidth / de, R = Math.round(A.from + (K - X.plotLeft) / Y - 0.5), ie = D.current, me = Math.max(0, Math.min(ie.length - 1, R)), ce = ie[me] ?? null, ae = Nl(B, X, ie, A.from, A.to);
3408
- ue({ barIndex: me, bar: ce, priceAtCursor: ae });
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 });
3409
3443
  } else
3410
3444
  ue(null);
3411
- J();
3445
+ Z();
3412
3446
  },
3413
- [G, Z, J, ue]
3414
- ), fe = he((g) => {
3415
- g.currentTarget.releasePointerCapture(g.pointerId), se.current = null;
3416
- }, []), ge = he(() => {
3417
- ee.current = null, se.current = null, ue(null), J();
3418
- }, [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(
3419
3453
  (g) => {
3420
3454
  g.preventDefault();
3421
- const b = g.currentTarget.getBoundingClientRect(), K = g.clientX - b.left, B = Nt(b.width, b.height, G, Z), X = C.current, A = D.current;
3422
- if (A.length === 0) return;
3423
- const de = X.to - X.from + 1, Y = g.deltaY > 0 ? 1 + Ht : 1 / (1 + Ht), R = Math.max(
3424
- B.plotWidth / cl,
3425
- Math.min(A.length, B.plotWidth / ol, de * Y)
3426
- ), ie = X.from + (K - B.plotLeft) / (B.plotWidth / de), me = (ie - X.from) / de;
3427
- let ce = ie - me * R, ae = ce + R - 1;
3428
- ce < 0 && (ce = 0, ae = R - 1), ae > A.length - 1 && (ae = A.length - 1, ce = ae - R + 1), C.current = { from: ce, to: ae }, oe.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();
3429
3463
  },
3430
- [G, Z, J]
3431
- ), Re = he(
3464
+ [L, A, Z]
3465
+ ), Re = de(
3432
3466
  (g) => {
3433
- const b = C.current, K = b.to - b.from + 1, B = D.current;
3434
- if (B.length === 0) return;
3435
- let X = 0;
3436
- if (g.key === "ArrowLeft") X = -Math.max(1, Math.floor(K * 0.1));
3437
- else if (g.key === "ArrowRight") X = 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));
3438
3472
  else return;
3439
3473
  g.preventDefault();
3440
- let A = b.from + X, de = b.to + X;
3441
- 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 }, oe.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();
3442
3476
  },
3443
- [J]
3444
- ), Ne = he(() => {
3477
+ [Z]
3478
+ ), Ne = de(() => {
3445
3479
  if (M.current) return;
3446
3480
  const g = D.current;
3447
3481
  if (g.length === 0) return;
3448
3482
  M.current = !0;
3449
- const b = Ft(n), K = g[0].time, B = K - b * l, X = K - b;
3450
- e.getBars({ symbol: t, resolution: n, from: B, to: X, countBack: l }).then((A) => {
3451
- if (A.length === 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) {
3452
3486
  M.current = !1;
3453
3487
  return;
3454
3488
  }
3455
- const Y = [...A].sort((ie, me) => ie.time - me.time).filter((ie) => ie.time < K), R = C.current;
3456
- D.current = [...Y, ...g], C.current = { from: R.from + Y.length, to: R.to + Y.length }, M.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();
3457
3491
  }).catch(() => {
3458
3492
  M.current = !1;
3459
3493
  });
3460
- }, [e, t, n, l, J]);
3461
- return /* @__PURE__ */ H(
3494
+ }, [e, t, n, l, Z]);
3495
+ return /* @__PURE__ */ F(
3462
3496
  "div",
3463
3497
  {
3464
- ref: U,
3465
- className: f(x.root, O),
3466
- style: { ...P, height: a, position: "relative" },
3498
+ ref: Y,
3499
+ className: f(k.root, W),
3500
+ style: { ...X, height: a, position: "relative" },
3467
3501
  tabIndex: 0,
3468
3502
  role: "figure",
3469
3503
  "aria-label": `${t} ${n} chart`,
@@ -3472,20 +3506,20 @@ function Vl({
3472
3506
  /* @__PURE__ */ s(
3473
3507
  "canvas",
3474
3508
  {
3475
- ref: re,
3476
- className: x.svg,
3509
+ ref: Q,
3510
+ className: k.svg,
3477
3511
  onPointerDown: be,
3478
3512
  onPointerMove: pe,
3479
3513
  onPointerUp: fe,
3480
3514
  onPointerLeave: ge,
3481
3515
  onWheel: ve,
3482
- style: { cursor: se.current ? "grabbing" : "crosshair", touchAction: "none" }
3516
+ style: { cursor: re.current ? "grabbing" : "crosshair", touchAction: "none" }
3483
3517
  }
3484
3518
  ),
3485
- /* @__PURE__ */ H(
3519
+ /* @__PURE__ */ F(
3486
3520
  "div",
3487
3521
  {
3488
- className: x.tradingHeader,
3522
+ className: k.tradingHeader,
3489
3523
  style: {
3490
3524
  position: "absolute",
3491
3525
  top: rl,
@@ -3498,28 +3532,28 @@ function Vl({
3498
3532
  gap: 8
3499
3533
  },
3500
3534
  children: [
3501
- /* @__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: [
3502
3536
  /* @__PURE__ */ s("strong", { children: t }),
3503
3537
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3504
- 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: [
3505
3539
  "O ",
3506
- L.bar.open.toFixed(c),
3540
+ he.bar.open.toFixed(c),
3507
3541
  " · H ",
3508
- L.bar.high.toFixed(c),
3542
+ he.bar.high.toFixed(c),
3509
3543
  " · L",
3510
3544
  " ",
3511
- L.bar.low.toFixed(c),
3545
+ he.bar.low.toFixed(c),
3512
3546
  " · C ",
3513
- L.bar.close.toFixed(c)
3547
+ he.bar.close.toFixed(c)
3514
3548
  ] })
3515
3549
  ] }),
3516
- w && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3517
- Vt,
3550
+ C && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3551
+ Yt,
3518
3552
  {
3519
3553
  position: "bottom",
3520
3554
  asChild: !0,
3521
3555
  trigger: /* @__PURE__ */ s(
3522
- _t,
3556
+ Ut,
3523
3557
  {
3524
3558
  variant: "ghost",
3525
3559
  size: "sm",
@@ -3558,7 +3592,7 @@ function al({
3558
3592
  timezone: e,
3559
3593
  onTimezoneChange: t
3560
3594
  }) {
3561
- return /* @__PURE__ */ H("div", { style: { minWidth: 220, padding: 4 }, children: [
3595
+ return /* @__PURE__ */ F("div", { style: { minWidth: 220, padding: 4 }, children: [
3562
3596
  /* @__PURE__ */ s(
3563
3597
  "div",
3564
3598
  {
@@ -3570,7 +3604,7 @@ function al({
3570
3604
  children: "Settings"
3571
3605
  }
3572
3606
  ),
3573
- /* @__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: [
3574
3608
  /* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
3575
3609
  /* @__PURE__ */ s(
3576
3610
  zt,
@@ -3584,7 +3618,7 @@ function al({
3584
3618
  ] });
3585
3619
  }
3586
3620
  function dl() {
3587
- return /* @__PURE__ */ H(
3621
+ return /* @__PURE__ */ F(
3588
3622
  "svg",
3589
3623
  {
3590
3624
  viewBox: "0 0 24 24",
@@ -3603,11 +3637,11 @@ function dl() {
3603
3637
  }
3604
3638
  function Nt(e, t, n, r) {
3605
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);
3606
- let d = h, u = c;
3640
+ let u = h, d = c;
3607
3641
  const m = { top: c, bottom: l, height: h };
3608
- let p = null, y = null;
3609
- const w = n ? Wt.rsi : 0, N = r ? Wt.volume : 0;
3610
- return d = h * (1 - w - N), m.top = u, m.height = d, m.bottom = m.top + d, u = m.bottom, n && (p = { top: u, height: h * w, bottom: u + h * w }, u = p.bottom), r && (y = { top: u, height: h * N, bottom: u + h * N }), { 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 };
3611
3645
  }
3612
3646
  function ul(e, t) {
3613
3647
  if (t === 0) return { from: 0, to: 0 };
@@ -3638,28 +3672,28 @@ function hl(e, t) {
3638
3672
  }
3639
3673
  function rn(e, t, n, r, o) {
3640
3674
  let i = 1 / 0, c = -1 / 0;
3641
- for (const u of t)
3642
- u.low < i && (i = u.low), u.high > c && (c = u.high);
3643
- for (const u of n) {
3644
- const m = u.kind === "line" ? [u.values] : [u.upper, u.lower];
3675
+ for (const d of t)
3676
+ d.low < i && (i = d.low), d.high > c && (c = d.high);
3677
+ for (const d of n) {
3678
+ const m = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3645
3679
  for (const p of m) {
3646
- const y = Math.max(0, Math.floor(r)), w = Math.min(p.length - 1, Math.ceil(o));
3647
- for (let N = y; N <= w; N++) {
3648
- const S = p[N];
3649
- S != null && (S < i && (i = S), S > c && (c = S));
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));
3650
3684
  }
3651
3685
  }
3652
3686
  }
3653
3687
  (!isFinite(i) || !isFinite(c)) && (i = 0, c = 1);
3654
- const l = (c - i) * 0.08 || 1, a = qe(i - l, c + l, 5), h = Math.min(a[0], i), d = Math.max(a[a.length - 1], c);
3655
- return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: h, priceMax: d, ticks: a };
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);
3689
+ return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: h, priceMax: u, ticks: a };
3656
3690
  }
3657
3691
  function ml(e, t, n, r) {
3658
3692
  let o = 0;
3659
3693
  const i = Math.max(0, Math.floor(n)), c = Math.min(t.length - 1, Math.ceil(r));
3660
3694
  for (let h = i; h <= c; h++) {
3661
- const d = t[h].volume ?? 0;
3662
- d > o && (o = d);
3695
+ const u = t[h].volume ?? 0;
3696
+ u > o && (o = u);
3663
3697
  }
3664
3698
  const l = qe(0, o || 1, 3), a = Math.max(l[l.length - 1], o);
3665
3699
  return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: 0, priceMax: a, ticks: l };
@@ -3717,30 +3751,30 @@ function gl(e, t, n, r, o) {
3717
3751
  }
3718
3752
  }
3719
3753
  function yl(e, t, n, r, o, i, c, l) {
3720
- const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), d = Math.max(1, i * 0.7);
3721
- for (let u = a; u <= h; u++) {
3722
- const m = t[u], p = o(u), y = we(m.open, c), w = we(m.close, c), N = we(m.high, c), S = we(m.low, c), P = m.close >= m.open ? l.up : l.down;
3723
- e.strokeStyle = P, e.fillStyle = P, e.beginPath();
3724
- const U = Math.round(p) + 0.5;
3725
- e.moveTo(U, N), e.lineTo(U, S), e.stroke();
3726
- const re = Math.min(y, w), D = Math.max(1, Math.abs(w - y));
3727
- e.fillRect(Math.round(p - d / 2), Math.round(re), Math.round(d), Math.round(D));
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);
3755
+ for (let d = a; d <= h; d++) {
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));
3728
3762
  }
3729
3763
  }
3730
3764
  function vl(e, t, n, r, o, i, c, l) {
3731
- const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), d = Math.max(2, Math.min(i * 0.4, 8));
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));
3732
3766
  e.lineWidth = Math.max(1, Math.min(2, i * 0.18)), e.lineCap = "butt";
3733
- for (let u = a; u <= h; u++) {
3734
- const m = t[u], p = Math.round(o(u)) + 0.5, y = we(m.high, c), w = we(m.low, c), N = we(m.open, c), S = we(m.close, c), O = m.close >= m.open;
3735
- e.strokeStyle = O ? l.up : l.down, e.beginPath(), e.moveTo(p, y), e.lineTo(p, w), e.moveTo(p - d, N), e.lineTo(p, N), e.moveTo(p, S), e.lineTo(p + d, S), e.stroke();
3767
+ for (let d = a; d <= h; d++) {
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();
3736
3770
  }
3737
3771
  }
3738
3772
  function bl(e, t, n, r, o, i, c, l) {
3739
3773
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3740
3774
  if (!(h <= a)) {
3741
3775
  e.strokeStyle = c, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, i));
3742
- for (let d = a + 1; d <= h; d++)
3743
- e.lineTo(o(d), we(t[d].close, i));
3776
+ for (let u = a + 1; u <= h; u++)
3777
+ e.lineTo(o(u), we(t[u].close, i));
3744
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);
3745
3779
  }
3746
3780
  }
@@ -3751,16 +3785,16 @@ function xl(e, t, n, r, o, i, c, l) {
3751
3785
  }
3752
3786
  const a = Math.max(0, Math.floor(o)), h = Math.min(r.length - 1, Math.ceil(i));
3753
3787
  e.globalAlpha = t.fillOpacity, e.fillStyle = t.color, e.beginPath();
3754
- let d = !1;
3755
- for (let u = a; u <= h; u++) {
3756
- const m = t.upper[u];
3788
+ let u = !1;
3789
+ for (let d = a; d <= h; d++) {
3790
+ const m = t.upper[d];
3757
3791
  if (m == null) continue;
3758
- const p = c(u), y = we(m, l);
3759
- d ? e.lineTo(p, y) : (e.moveTo(p, y), d = !0);
3792
+ const p = c(d), x = we(m, l);
3793
+ u ? e.lineTo(p, x) : (e.moveTo(p, x), u = !0);
3760
3794
  }
3761
- for (let u = h; u >= a; u--) {
3762
- const m = t.lower[u];
3763
- m != null && e.lineTo(c(u), we(m, l));
3795
+ for (let d = h; d >= a; d--) {
3796
+ const m = t.lower[d];
3797
+ m != null && e.lineTo(c(d), we(m, l));
3764
3798
  }
3765
3799
  e.closePath(), e.fill(), e.globalAlpha = 1, Qe(e, t.upper, o, i, c, l, t.color), Qe(e, t.lower, o, i, c, l, t.color), Qe(e, t.middle, o, i, c, l, t.color);
3766
3800
  }
@@ -3768,26 +3802,26 @@ function Qe(e, t, n, r, o, i, c) {
3768
3802
  e.strokeStyle = c, e.lineWidth = 1.25, e.beginPath();
3769
3803
  let l = !1;
3770
3804
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3771
- for (let d = a; d <= h; d++) {
3772
- const u = t[d];
3773
- if (u == null) {
3805
+ for (let u = a; u <= h; u++) {
3806
+ const d = t[u];
3807
+ if (d == null) {
3774
3808
  l = !1;
3775
3809
  continue;
3776
3810
  }
3777
- const m = o(d), p = we(u, i);
3811
+ const m = o(u), p = we(d, i);
3778
3812
  l ? e.lineTo(m, p) : (e.moveTo(m, p), l = !0);
3779
3813
  }
3780
3814
  e.stroke();
3781
3815
  }
3782
3816
  function kl(e, t, n, r, o, i, c, l) {
3783
- const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), d = Math.max(1, i * 0.7);
3784
- for (let u = a; u <= h; u++) {
3785
- const m = t[u], p = m.volume ?? 0;
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);
3818
+ for (let d = a; d <= h; d++) {
3819
+ const m = t[d], p = m.volume ?? 0;
3786
3820
  if (p === 0) continue;
3787
- const y = m.close >= m.open;
3788
- e.fillStyle = y ? l.up : l.down, e.globalAlpha = 0.55;
3789
- const w = we(p, c), N = c.paneBottom - w;
3790
- e.fillRect(Math.round(o(u) - d / 2), Math.round(w), Math.round(d), Math.round(N));
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($));
3791
3825
  }
3792
3826
  e.globalAlpha = 1;
3793
3827
  }
@@ -3805,27 +3839,27 @@ function Ot(e, t, n, r, o) {
3805
3839
  function wl(e, t, n, r, o, i, c) {
3806
3840
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3807
3841
  e.fillStyle = c.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3808
- const d = Math.max(0, Math.floor(r)), u = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + Ct / 2;
3809
- for (let p = d; p <= u; p += h) {
3810
- const y = n[p], w = t.plotLeft + (p - r + 0.5) * a;
3811
- e.fillText(Ll(y.time, i), w, m);
3842
+ const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + Ct / 2;
3843
+ for (let p = u; p <= d; p += h) {
3844
+ const x = n[p], C = t.plotLeft + (p - r + 0.5) * a;
3845
+ e.fillText(Ll(x.time, i), C, m);
3812
3846
  }
3813
3847
  }
3814
- function $l(e, t, n, r, o, i, c, l, a, h, d) {
3848
+ function $l(e, t, n, r, o, i, c, l, a, h, u) {
3815
3849
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3816
- const u = i - o + 1, m = t.plotWidth / u, p = o + (n.x - t.plotLeft) / m - 0.5, y = Math.round(p), w = Math.max(0, Math.min(r.length - 1, y)), N = c(w);
3817
- if (e.save(), e.strokeStyle = d.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(N + 0.5, t.plotTop), e.lineTo(N + 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) {
3818
- const S = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3819
- e.fillStyle = d.text, e.fillRect(t.plotRight, n.y - 9, Rt, 18), e.fillStyle = d.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(S.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);
3820
3854
  }
3821
- if (r[w]) {
3822
- const S = cn(r[w].time, h);
3855
+ if (r[C]) {
3856
+ const b = cn(r[C].time, h);
3823
3857
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3824
- const U = e.measureText(S).width + 8 * 2, re = Ct, D = Math.max(
3858
+ const Y = e.measureText(b).width + 8 * 2, Q = Ct, D = Math.max(
3825
3859
  t.plotLeft,
3826
- Math.min(t.plotRight - U, N - U / 2)
3827
- ), C = t.plotBottom;
3828
- e.fillStyle = d.text, e.fillRect(D, C, U, re), e.fillStyle = d.bg, e.textAlign = "center", e.fillText(S, D + U / 2, C + re / 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);
3829
3863
  }
3830
3864
  e.restore();
3831
3865
  }
@@ -3890,8 +3924,8 @@ function Tl(e, t) {
3890
3924
  return e.map((r, o) => `${o === 0 ? "M" : "L"} ${r.x} ${r.y}`).join(" ");
3891
3925
  let n = `M ${e[0].x} ${e[0].y}`;
3892
3926
  for (let r = 0; r < e.length - 1; r++) {
3893
- const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, d = c.x - (l.x - i.x) / 6, u = c.y - (l.y - i.y) / 6;
3894
- n += ` C ${a} ${h}, ${d} ${u}, ${c.x} ${c.y}`;
3927
+ const o = e[r - 1] ?? e[r], i = e[r], c = e[r + 1], l = e[r + 2] ?? c, a = i.x + (c.x - o.x) / 6, h = i.y + (c.y - o.y) / 6, u = c.x - (l.x - i.x) / 6, d = c.y - (l.y - i.y) / 6;
3928
+ n += ` C ${a} ${h}, ${u} ${d}, ${c.x} ${c.y}`;
3895
3929
  }
3896
3930
  return n;
3897
3931
  }
@@ -3907,19 +3941,19 @@ const Rl = $e(
3907
3941
  showLastPoint: l = !1,
3908
3942
  "aria-label": a,
3909
3943
  className: h,
3910
- style: d
3911
- }, u) => {
3912
- const { line: m, area: p, last: y } = ke(() => {
3944
+ style: u
3945
+ }, d) => {
3946
+ const { line: m, area: p, last: x } = ke(() => {
3913
3947
  if (e.length === 0) return { line: "", area: "", last: null };
3914
- const w = o, N = Math.max(1, t - w * 2), S = Math.max(1, n - w * 2), [O, P] = bt(e), U = Je([0, Math.max(1, e.length - 1)], [w, w + N]), re = Je([O, P], [w + S, w]), D = e.map((se, M) => ({ x: U(M), y: re(se) })), C = Tl(D, i), ee = c ? `${C} L ${D[D.length - 1].x} ${w + S} L ${D[0].x} ${w + S} Z` : "";
3915
- return { line: C, area: ee, last: D[D.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] };
3916
3950
  }, [e, t, n, o, i, c]);
3917
- return /* @__PURE__ */ H(
3951
+ return /* @__PURE__ */ F(
3918
3952
  "svg",
3919
3953
  {
3920
- ref: u,
3921
- className: f(x.sparkline, h),
3922
- style: d,
3954
+ ref: d,
3955
+ className: f(k.sparkline, h),
3956
+ style: u,
3923
3957
  width: t,
3924
3958
  height: n,
3925
3959
  viewBox: `0 0 ${t} ${n}`,
@@ -3938,7 +3972,7 @@ const Rl = $e(
3938
3972
  strokeLinecap: "round"
3939
3973
  }
3940
3974
  ),
3941
- 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 })
3942
3976
  ]
3943
3977
  }
3944
3978
  );
@@ -3948,7 +3982,7 @@ Rl.displayName = "Sparkline";
3948
3982
  export {
3949
3983
  Ol as AreaChart,
3950
3984
  Fl as BarChart,
3951
- _t as Button,
3985
+ Ut as Button,
3952
3986
  Fc as Checkbox,
3953
3987
  zt as Dropdown,
3954
3988
  uo as DropdownItem,
@@ -3962,15 +3996,15 @@ export {
3962
3996
  xr as ListItem,
3963
3997
  yt as Modal,
3964
3998
  jl as PieChart,
3965
- Vt as Popover,
3999
+ Yt as Popover,
3966
4000
  Xl as RadarChart,
3967
- Vc as Radio,
4001
+ Yc as Radio,
3968
4002
  zc as RadioGroup,
3969
4003
  Ec as Select,
3970
4004
  Rl as Sparkline,
3971
4005
  Il as Table,
3972
4006
  oi as Textarea,
3973
- Vl as TradingChart,
4007
+ Yl as TradingChart,
3974
4008
  dr as Typography,
3975
4009
  Ji as bollinger,
3976
4010
  Qi as ema,
@@ -3979,10 +4013,10 @@ export {
3979
4013
  el as rsi,
3980
4014
  Ki as sma,
3981
4015
  zl as suggestPeriodForResolution,
3982
- _l as suggestResolutionForPeriod,
4016
+ Ul as suggestResolutionForPeriod,
3983
4017
  pt as useClickOutside,
3984
4018
  ko as useFocusTrap,
3985
4019
  Tt as useKeyboard,
3986
4020
  zr as useTableSort,
3987
- Ul as volumeSeries
4021
+ _l as volumeSeries
3988
4022
  };