@overdoser/react-toolkit 0.0.12 → 0.0.13

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,5 +1,5 @@
1
- import { forwardRef as $e, createElement as an, useState as Le, useCallback as fe, useMemo as ke, useEffect as Ne, useLayoutEffect as jt, useRef as re, useId as Ye, isValidElement as dn, cloneElement as Xt, createContext as _t, useContext as ft, useImperativeHandle as un } from "react";
2
- import { jsxs as z, jsx as s, Fragment as je } from "react/jsx-runtime";
1
+ import { forwardRef as $e, createElement as an, useState as Le, useCallback as pe, useMemo as ke, useEffect as Ne, useLayoutEffect as jt, useRef as oe, useId as Ye, isValidElement as dn, cloneElement as Xt, createContext as _t, useContext as ft, useImperativeHandle as un } from "react";
2
+ import { jsxs as j, jsx as s, Fragment as je } from "react/jsx-runtime";
3
3
  import { createPortal as pt } from "react-dom";
4
4
  import { FormProvider as hn, useFormContext as mn, useController as fn } from "react-hook-form";
5
5
  function Ut(e) {
@@ -15,7 +15,7 @@ function m() {
15
15
  for (var e, t, n = 0, r = "", o = arguments.length; n < o; n++) (e = arguments[n]) && (t = Ut(e)) && (r && (r += " "), r += t);
16
16
  return r;
17
17
  }
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", Rn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", In = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Be = {
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", Rn = "crk-shimmer-8iQSU", Sn = "crk-loadingShimmer-BVvFw", Tn = "crk-shimmerSweep-uiZ01", Cn = "crk-dots-U8wss", An = "crk-loadingDots-eKv64", Bn = "crk-dot-Owuk1", In = "crk-dotBounce-FwdcC", Dn = "crk-loadingBorder-9ULFw", En = "crk-borderSpin-EJ2gW", Be = {
19
19
  root: pn,
20
20
  loading: gn,
21
21
  primary: yn,
@@ -28,8 +28,8 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
28
28
  fullWidth: $n,
29
29
  iconOnly: Nn,
30
30
  content: Ln,
31
- shimmer: Sn,
32
- loadingShimmer: Rn,
31
+ shimmer: Rn,
32
+ loadingShimmer: Sn,
33
33
  shimmerSweep: Tn,
34
34
  dots: Cn,
35
35
  loadingDots: An,
@@ -55,7 +55,7 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
55
55
  style: h,
56
56
  children: u,
57
57
  ...d
58
- }, f) => /* @__PURE__ */ z(
58
+ }, f) => /* @__PURE__ */ j(
59
59
  "button",
60
60
  {
61
61
  ref: f,
@@ -77,7 +77,7 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
77
77
  children: [
78
78
  /* @__PURE__ */ s("div", { className: m(Be.shimmer, l?.shimmer) }),
79
79
  /* @__PURE__ */ s("span", { className: m(Be.content, l?.content), children: u }),
80
- /* @__PURE__ */ z("span", { className: m(Be.dots, l?.dots), "aria-hidden": "true", children: [
80
+ /* @__PURE__ */ j("span", { className: m(Be.dots, l?.dots), "aria-hidden": "true", children: [
81
81
  /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
82
82
  /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
83
83
  /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) })
@@ -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
  ...c
104
- }, i) => /* @__PURE__ */ z(
104
+ }, i) => /* @__PURE__ */ j(
105
105
  "a",
106
106
  {
107
107
  ref: i,
@@ -222,15 +222,15 @@ 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", Rr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Ir = "crk-striped-6Qckq", Dr = "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", zr = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", Xr = "crk-pageEllipsis-en59J", ve = {
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", Rr = "crk-sortArrowActive-yhWrO", Sr = "crk-sortIndex-HGoca", Tr = "crk-row-H0wL1", Cr = "crk-cell-ZfnbG", Ar = "crk-emptyRow-AoPfj", Br = "crk-emptyCell-99-7C", Ir = "crk-striped-6Qckq", Dr = "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", zr = "crk-pageButton-1PX-g", jr = "crk-pageButtonActive--D7Q7", Xr = "crk-pageEllipsis-en59J", ve = {
226
226
  wrapper: kr,
227
227
  root: Mr,
228
228
  headerCell: wr,
229
229
  headerCellSortable: $r,
230
230
  sortIndicator: Nr,
231
231
  sortArrow: Lr,
232
- sortArrowActive: Sr,
233
- sortIndex: Rr,
232
+ sortArrowActive: Rr,
233
+ sortIndex: Sr,
234
234
  row: Tr,
235
235
  cell: Cr,
236
236
  emptyRow: Ar,
@@ -251,12 +251,12 @@ function _r(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 Ur(e, t = []) {
254
- const [n, r] = Le(t), o = fe((a) => {
254
+ const [n, r] = Le(t), o = pe((a) => {
255
255
  r((h) => {
256
256
  const u = h.find((d) => d.key === a);
257
257
  return u ? u.direction === "asc" ? [{ key: a, direction: "desc" }] : [] : [{ key: a, direction: "asc" }];
258
258
  });
259
- }, []), c = fe((a) => {
259
+ }, []), c = pe((a) => {
260
260
  r((h) => {
261
261
  const u = h.findIndex((f) => f.key === a);
262
262
  if (u === -1)
@@ -265,9 +265,9 @@ function Ur(e, t = []) {
265
265
  const f = [...h];
266
266
  return f[u] = { key: a, direction: "desc" }, f;
267
267
  }
268
- return h.filter((f, y) => y !== u);
268
+ return h.filter((f, p) => p !== u);
269
269
  });
270
- }, []), i = fe(() => {
270
+ }, []), i = pe(() => {
271
271
  r([]);
272
272
  }, []);
273
273
  return { sortedData: ke(() => n.length === 0 ? e : [...e].sort((a, h) => {
@@ -280,7 +280,7 @@ function Ur(e, t = []) {
280
280
  }), [e, n]), sortConfig: n, requestSort: o, requestMultiSort: c, resetSort: i };
281
281
  }
282
282
  function Yr({ direction: e, sortIndex: t }) {
283
- return /* @__PURE__ */ z("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
283
+ return /* @__PURE__ */ j("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
284
284
  /* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
285
285
  /* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "desc" && ve.sortArrowActive), children: "▼" }),
286
286
  t !== void 0 && t >= 0 && /* @__PURE__ */ s("span", { className: ve.sortIndex, children: t + 1 })
@@ -306,8 +306,8 @@ function Vr({
306
306
  }
307
307
  return u;
308
308
  }, [e, i]);
309
- return /* @__PURE__ */ z("nav", { className: m(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
310
- /* @__PURE__ */ z("div", { className: ve.paginatorInfo, children: [
309
+ return /* @__PURE__ */ j("nav", { className: m(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
310
+ /* @__PURE__ */ j("div", { className: ve.paginatorInfo, children: [
311
311
  /* @__PURE__ */ s("span", { className: ve.paginatorText, children: n > 0 ? `${l}–${a} of ${n}` : "No results" }),
312
312
  r.length > 1 && /* @__PURE__ */ s(
313
313
  "select",
@@ -316,14 +316,14 @@ function Vr({
316
316
  value: t,
317
317
  onChange: (u) => o(1, Number(u.target.value)),
318
318
  "aria-label": "Rows per page",
319
- children: r.map((u) => /* @__PURE__ */ z("option", { value: u, children: [
319
+ children: r.map((u) => /* @__PURE__ */ j("option", { value: u, children: [
320
320
  u,
321
321
  " / page"
322
322
  ] }, u))
323
323
  }
324
324
  )
325
325
  ] }),
326
- /* @__PURE__ */ z("div", { className: ve.paginatorNav, children: [
326
+ /* @__PURE__ */ j("div", { className: ve.paginatorNav, children: [
327
327
  /* @__PURE__ */ s(
328
328
  "button",
329
329
  {
@@ -377,51 +377,51 @@ function qr({
377
377
  rowKey: u,
378
378
  rowClassName: d,
379
379
  rowStyle: f,
380
- emptyMessage: y = "No data",
380
+ emptyMessage: p = "No data",
381
381
  pagination: L,
382
- classes: v
382
+ classes: b
383
383
  }) {
384
- const S = r !== void 0, {
385
- sortedData: N,
386
- sortConfig: D,
387
- requestSort: j,
388
- requestMultiSort: Z
389
- } = Ur(e, n), U = S ? n ?? [] : D, C = S ? e : N, $ = ke(() => {
390
- if (!L || S) return C;
391
- const R = (L.page - 1) * L.pageSize;
392
- return C.slice(R, R + L.pageSize);
393
- }, [C, L, S]), oe = L?.totalRows ?? C.length, ce = fe(
394
- (R, te) => {
395
- const H = o && (te.ctrlKey || te.metaKey);
396
- if (S)
397
- if (H) {
398
- const O = U.findIndex((F) => F.key === R);
384
+ const R = r !== void 0, {
385
+ sortedData: w,
386
+ sortConfig: J,
387
+ requestSort: W,
388
+ requestMultiSort: E
389
+ } = Ur(e, n), Z = R ? n ?? [] : J, C = R ? e : w, $ = ke(() => {
390
+ if (!L || R) return C;
391
+ const S = (L.page - 1) * L.pageSize;
392
+ return C.slice(S, S + L.pageSize);
393
+ }, [C, L, R]), ie = L?.totalRows ?? C.length, ne = pe(
394
+ (S, re) => {
395
+ const F = o && (re.ctrlKey || re.metaKey);
396
+ if (R)
397
+ if (F) {
398
+ const X = Z.findIndex((z) => z.key === S);
399
399
  let A;
400
- O === -1 ? A = [...U, { key: R, direction: "asc" }] : U[O].direction === "asc" ? A = U.map(
401
- (F, ne) => ne === O ? { key: R, direction: "desc" } : F
402
- ) : A = U.filter((F, ne) => ne !== O), r(A);
400
+ X === -1 ? A = [...Z, { key: S, direction: "asc" }] : Z[X].direction === "asc" ? A = Z.map(
401
+ (z, ce) => ce === X ? { key: S, direction: "desc" } : z
402
+ ) : A = Z.filter((z, ce) => ce !== X), r(A);
403
403
  } else {
404
- const O = U.find((A) => A.key === R);
405
- O ? O.direction === "asc" ? r([{ key: R, direction: "desc" }]) : r([]) : r([{ key: R, direction: "asc" }]);
404
+ const X = Z.find((A) => A.key === S);
405
+ X ? X.direction === "asc" ? r([{ key: S, direction: "desc" }]) : r([]) : r([{ key: S, direction: "asc" }]);
406
406
  }
407
407
  else
408
- H ? Z(R) : j(R);
408
+ F ? E(S) : W(S);
409
409
  },
410
410
  [
411
- S,
411
+ R,
412
412
  o,
413
- U,
413
+ Z,
414
414
  r,
415
- j,
416
- Z
415
+ W,
416
+ E
417
417
  ]
418
- ), q = (R) => U.find((H) => H.key === R)?.direction, ae = (R) => {
419
- if (U.length <= 1) return;
420
- const te = U.findIndex((H) => H.key === R);
421
- return te >= 0 ? te : void 0;
418
+ ), V = (S) => Z.find((F) => F.key === S)?.direction, ae = (S) => {
419
+ if (Z.length <= 1) return;
420
+ const re = Z.findIndex((F) => F.key === S);
421
+ return re >= 0 ? re : void 0;
422
422
  };
423
- return /* @__PURE__ */ z("div", { className: m(ve.wrapper, v?.wrapper), children: [
424
- /* @__PURE__ */ z(
423
+ return /* @__PURE__ */ j("div", { className: m(ve.wrapper, b?.wrapper), children: [
424
+ /* @__PURE__ */ j(
425
425
  "table",
426
426
  {
427
427
  className: m(
@@ -429,56 +429,56 @@ function qr({
429
429
  c && ve.striped,
430
430
  i && ve.hoverable,
431
431
  l && ve.compact,
432
- v?.root,
432
+ b?.root,
433
433
  a
434
434
  ),
435
435
  style: h,
436
436
  children: [
437
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((R) => /* @__PURE__ */ z(
437
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((S) => /* @__PURE__ */ j(
438
438
  "th",
439
439
  {
440
440
  className: m(
441
441
  ve.headerCell,
442
- R.sortable && ve.headerCellSortable,
443
- v?.headerCell
442
+ S.sortable && ve.headerCellSortable,
443
+ b?.headerCell
444
444
  ),
445
445
  style: {
446
- width: R.width,
447
- textAlign: R.align
446
+ width: S.width,
447
+ textAlign: S.align
448
448
  },
449
- onClick: R.sortable ? (te) => ce(R.key, te) : void 0,
450
- "aria-sort": R.sortable ? q(R.key) === "asc" ? "ascending" : q(R.key) === "desc" ? "descending" : "none" : void 0,
449
+ onClick: S.sortable ? (re) => ne(S.key, re) : void 0,
450
+ "aria-sort": S.sortable ? V(S.key) === "asc" ? "ascending" : V(S.key) === "desc" ? "descending" : "none" : void 0,
451
451
  children: [
452
- R.header,
453
- R.sortable && /* @__PURE__ */ s(
452
+ S.header,
453
+ S.sortable && /* @__PURE__ */ s(
454
454
  Yr,
455
455
  {
456
- direction: q(R.key),
457
- sortIndex: ae(R.key)
456
+ direction: V(S.key),
457
+ sortIndex: ae(S.key)
458
458
  }
459
459
  )
460
460
  ]
461
461
  },
462
- R.key
462
+ S.key
463
463
  )) }) }),
464
- /* @__PURE__ */ s("tbody", { children: $.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: m(ve.emptyCell, v?.emptyCell), colSpan: t.length, children: y }) }) : $.map((R, te) => {
465
- const H = u ? String(R[u]) : te, O = typeof d == "function" ? d(R, te) : d, A = typeof f == "function" ? f(R, te) : f;
464
+ /* @__PURE__ */ s("tbody", { children: $.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: m(ve.emptyCell, b?.emptyCell), colSpan: t.length, children: p }) }) : $.map((S, re) => {
465
+ const F = u ? String(S[u]) : re, X = typeof d == "function" ? d(S, re) : d, A = typeof f == "function" ? f(S, re) : f;
466
466
  return /* @__PURE__ */ s(
467
467
  "tr",
468
468
  {
469
- className: m(ve.row, v?.row, O),
469
+ className: m(ve.row, b?.row, X),
470
470
  style: A,
471
- children: t.map((F) => /* @__PURE__ */ s(
471
+ children: t.map((z) => /* @__PURE__ */ s(
472
472
  "td",
473
473
  {
474
- className: m(ve.cell, v?.cell),
475
- style: { textAlign: F.align },
476
- children: F.render ? F.render(R[F.key], R, te) : R[F.key]
474
+ className: m(ve.cell, b?.cell),
475
+ style: { textAlign: z.align },
476
+ children: z.render ? z.render(S[z.key], S, re) : S[z.key]
477
477
  },
478
- F.key
478
+ z.key
479
479
  ))
480
480
  },
481
- H
481
+ F
482
482
  );
483
483
  }) })
484
484
  ]
@@ -488,8 +488,8 @@ function qr({
488
488
  Vr,
489
489
  {
490
490
  ...L,
491
- totalRows: oe,
492
- paginatorClasses: { paginator: v?.paginator, pageButton: v?.pageButton }
491
+ totalRows: ie,
492
+ paginatorClasses: { paginator: b?.paginator, pageButton: b?.pageButton }
493
493
  }
494
494
  )
495
495
  ] });
@@ -511,8 +511,8 @@ const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trig
511
511
  itemDisabled: so,
512
512
  itemSelected: ao
513
513
  };
514
- function Rt(e, t = !0) {
515
- const n = fe(
514
+ function St(e, t = !0) {
515
+ const n = pe(
516
516
  (r) => {
517
517
  const o = e[r.key];
518
518
  o && o(r);
@@ -557,41 +557,41 @@ const Vt = $e(
557
557
  value: u,
558
558
  onChange: d,
559
559
  error: f = !1,
560
- fullWidth: y = !0,
560
+ fullWidth: p = !0,
561
561
  portal: L = !0,
562
- classes: v
563
- }, S) => {
564
- const [N, D] = Le(!1), j = re(null), Z = re(null), U = re(null), C = Ye();
562
+ classes: b
563
+ }, R) => {
564
+ const [w, J] = Le(!1), W = oe(null), E = oe(null), Z = oe(null), C = Ye();
565
565
  Ne(() => {
566
- N && Z.current && Z.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
567
- }, [N]);
568
- const $ = fe(() => {
569
- D(!1), l?.(), U.current?.focus();
570
- }, [l]), oe = fe(() => {
571
- D((A) => {
572
- const F = !A;
573
- return F ? i?.() : l?.(), F;
566
+ w && E.current && E.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
567
+ }, [w]);
568
+ const $ = pe(() => {
569
+ J(!1), l?.(), Z.current?.focus();
570
+ }, [l]), ie = pe(() => {
571
+ J((A) => {
572
+ const z = !A;
573
+ return z ? i?.() : l?.(), z;
574
574
  });
575
- }, [i, l]), ce = fe(
575
+ }, [i, l]), ne = pe(
576
576
  (A) => {
577
577
  d?.(A), $();
578
578
  },
579
579
  [d, $]
580
580
  );
581
581
  Ne(() => {
582
- if (!N) return;
583
- const A = (F) => {
584
- const ne = F.target;
585
- j.current?.contains(ne) || Z.current?.contains(ne) || $();
582
+ if (!w) return;
583
+ const A = (z) => {
584
+ const ce = z.target;
585
+ W.current?.contains(ce) || E.current?.contains(ce) || $();
586
586
  };
587
587
  return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
588
- }, [N, $]), Rt(
588
+ }, [w, $]), St(
589
589
  {
590
590
  Escape: () => $()
591
591
  },
592
- N
592
+ w
593
593
  );
594
- const q = Tt(U, N && L), ae = a?.find((A) => A.value === u)?.label, R = a ? ae || h : e, te = a && !ae, H = a ? a.map((A) => /* @__PURE__ */ s(
594
+ const V = Tt(Z, w && L), ae = a?.find((A) => A.value === u)?.label, S = a ? ae || h : e, re = a && !ae, F = a ? a.map((A) => /* @__PURE__ */ s(
595
595
  "button",
596
596
  {
597
597
  type: "button",
@@ -600,70 +600,70 @@ const Vt = $e(
600
600
  Me.item,
601
601
  A.disabled && Me.itemDisabled,
602
602
  A.value === u && Me.itemSelected,
603
- v?.item
603
+ b?.item
604
604
  ),
605
605
  disabled: A.disabled,
606
- onClick: () => ce(A.value),
606
+ onClick: () => ne(A.value),
607
607
  children: A.label
608
608
  },
609
609
  A.value
610
- )) : t, O = (A) => /* @__PURE__ */ s(
610
+ )) : t, X = (A) => /* @__PURE__ */ s(
611
611
  "div",
612
612
  {
613
- ref: Z,
613
+ ref: E,
614
614
  id: C,
615
615
  className: m(
616
616
  Me.menu,
617
- N && Me.menuOpen,
617
+ w && Me.menuOpen,
618
618
  n === "left" ? Me.alignLeft : Me.alignRight,
619
- !L && y && Me.fullWidth,
620
- v?.menu
619
+ !L && p && Me.fullWidth,
620
+ b?.menu
621
621
  ),
622
622
  style: A,
623
623
  role: "menu",
624
- children: H
624
+ children: F
625
625
  }
626
626
  );
627
- return /* @__PURE__ */ z(
627
+ return /* @__PURE__ */ j(
628
628
  "div",
629
629
  {
630
- ref: S,
631
- className: m(Me.root, y && Me.fullWidth, v?.root, r),
630
+ ref: R,
631
+ className: m(Me.root, p && Me.fullWidth, b?.root, r),
632
632
  style: o,
633
633
  children: [
634
- /* @__PURE__ */ z("div", { ref: j, style: y ? { width: "100%" } : void 0, children: [
635
- /* @__PURE__ */ z(
634
+ /* @__PURE__ */ j("div", { ref: W, style: p ? { width: "100%" } : void 0, children: [
635
+ /* @__PURE__ */ j(
636
636
  "button",
637
637
  {
638
- ref: U,
638
+ ref: Z,
639
639
  id: c,
640
640
  type: "button",
641
641
  className: m(
642
642
  Me.trigger,
643
- N && Me.triggerOpen,
643
+ w && Me.triggerOpen,
644
644
  f && Me.triggerError,
645
- y && Me.fullWidth,
646
- v?.trigger
645
+ p && Me.fullWidth,
646
+ b?.trigger
647
647
  ),
648
- onClick: oe,
649
- "aria-expanded": N,
648
+ onClick: ie,
649
+ "aria-expanded": w,
650
650
  "aria-haspopup": "menu",
651
- "aria-controls": N ? C : void 0,
651
+ "aria-controls": w ? C : void 0,
652
652
  children: [
653
- /* @__PURE__ */ s("span", { className: m(Me.triggerLabel, te && Me.placeholder, v?.triggerLabel), children: R }),
654
- /* @__PURE__ */ s("span", { className: m(Me.chevron, v?.chevron), "aria-hidden": "true" })
653
+ /* @__PURE__ */ s("span", { className: m(Me.triggerLabel, re && Me.placeholder, b?.triggerLabel), children: S }),
654
+ /* @__PURE__ */ s("span", { className: m(Me.chevron, b?.chevron), "aria-hidden": "true" })
655
655
  ]
656
656
  }
657
657
  ),
658
- !L && O()
658
+ !L && X()
659
659
  ] }),
660
- L && N && typeof document < "u" && pt(
661
- O({
660
+ L && w && typeof document < "u" && pt(
661
+ X({
662
662
  position: "fixed",
663
- top: q.top + 4,
664
- left: n === "right" ? void 0 : q.left,
665
- right: n === "right" ? window.innerWidth - (q.left + q.width) : void 0,
666
- minWidth: q.width,
663
+ top: V.top + 4,
664
+ left: n === "right" ? void 0 : V.left,
665
+ right: n === "right" ? window.innerWidth - (V.left + V.width) : void 0,
666
+ minWidth: V.width,
667
667
  zIndex: "var(--crk-z-floating)"
668
668
  }),
669
669
  document.body
@@ -737,53 +737,53 @@ const qt = $e(
737
737
  className: l,
738
738
  style: a
739
739
  }, h) => {
740
- const [u, d] = Le(!1), f = re(null), y = re(null), L = re(null), v = Ye(), S = o !== void 0, N = S ? o : u, D = fe(
740
+ const [u, d] = Le(!1), f = oe(null), p = oe(null), L = oe(null), b = Ye(), R = o !== void 0, w = R ? o : u, J = pe(
741
741
  (C) => {
742
- S || d(C), c?.(C);
742
+ R || d(C), c?.(C);
743
743
  },
744
- [S, c]
745
- ), j = fe(() => {
746
- D(!1), L.current?.focus();
747
- }, [D]), Z = fe(() => {
748
- D(!N);
749
- }, [N, D]);
750
- xo(f, j, N), Rt(
744
+ [R, c]
745
+ ), W = pe(() => {
746
+ J(!1), L.current?.focus();
747
+ }, [J]), E = pe(() => {
748
+ J(!w);
749
+ }, [w, J]);
750
+ xo(f, W, w), St(
751
751
  {
752
- Escape: () => j()
752
+ Escape: () => W()
753
753
  },
754
- N
754
+ w
755
755
  ), Ne(() => {
756
- if (N && y.current) {
757
- const C = y.current.querySelector(
756
+ if (w && p.current) {
757
+ const C = p.current.querySelector(
758
758
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
759
759
  );
760
- C ? C.focus() : y.current.focus();
760
+ C ? C.focus() : p.current.focus();
761
761
  }
762
- }, [N]);
763
- let U;
762
+ }, [w]);
763
+ let Z;
764
764
  if (t && dn(e)) {
765
765
  const C = e, $ = C.ref;
766
- U = Xt(C, {
766
+ Z = Xt(C, {
767
767
  ref: ko(L, $),
768
- onClick: (oe) => {
769
- C.props.onClick?.(oe), Z();
768
+ onClick: (ie) => {
769
+ C.props.onClick?.(ie), E();
770
770
  },
771
771
  className: m(C.props.className, i?.trigger),
772
- "aria-expanded": N,
772
+ "aria-expanded": w,
773
773
  "aria-haspopup": "dialog",
774
- "aria-controls": N ? v : void 0
774
+ "aria-controls": w ? b : void 0
775
775
  });
776
776
  } else
777
- U = /* @__PURE__ */ s(
777
+ Z = /* @__PURE__ */ s(
778
778
  "button",
779
779
  {
780
780
  ref: L,
781
781
  type: "button",
782
782
  className: m(at.trigger, i?.trigger),
783
- onClick: Z,
784
- "aria-expanded": N,
783
+ onClick: E,
784
+ "aria-expanded": w,
785
785
  "aria-haspopup": "dialog",
786
- "aria-controls": N ? v : void 0,
786
+ "aria-controls": w ? b : void 0,
787
787
  children: e
788
788
  }
789
789
  );
@@ -793,13 +793,13 @@ const qt = $e(
793
793
  ref: h,
794
794
  className: m(at.root, i?.root, l),
795
795
  style: a,
796
- children: /* @__PURE__ */ z("div", { ref: f, children: [
797
- U,
798
- N && /* @__PURE__ */ s(
796
+ children: /* @__PURE__ */ j("div", { ref: f, children: [
797
+ Z,
798
+ w && /* @__PURE__ */ s(
799
799
  "div",
800
800
  {
801
- ref: y,
802
- id: v,
801
+ ref: p,
802
+ id: b,
803
803
  role: "dialog",
804
804
  tabIndex: -1,
805
805
  className: m(at.popover, at[r], i?.popover),
@@ -821,7 +821,7 @@ const It = [
821
821
  '[tabindex]:not([tabindex="-1"])'
822
822
  ].join(", ");
823
823
  function Mo(e, t) {
824
- const n = re(null), r = fe(
824
+ const n = oe(null), r = pe(
825
825
  (o) => {
826
826
  if (o.key !== "Tab" || !e.current)
827
827
  return;
@@ -847,13 +847,13 @@ function Mo(e, t) {
847
847
  };
848
848
  }, [t, e, r]);
849
849
  }
850
- const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yNG-7", Lo = "crk-modalIn-xFUwm", So = "crk-sm--xyY9", Ro = "crk-md-ETTfh", To = "crk-lg-5DBb7", Co = "crk-fullscreen-b4jQ-", Ao = "crk-header-NS30G", Bo = "crk-headerWithClose-4davm", Io = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Eo = "crk-footer-Oyz-R", ze = {
850
+ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yNG-7", Lo = "crk-modalIn-xFUwm", Ro = "crk-sm--xyY9", So = "crk-md-ETTfh", To = "crk-lg-5DBb7", Co = "crk-fullscreen-b4jQ-", Ao = "crk-header-NS30G", Bo = "crk-headerWithClose-4davm", Io = "crk-closeButton-JX-aq", Do = "crk-body-3zIj9", Eo = "crk-footer-Oyz-R", ze = {
851
851
  backdrop: wo,
852
852
  backdropIn: $o,
853
853
  modal: No,
854
854
  modalIn: Lo,
855
- sm: So,
856
- md: Ro,
855
+ sm: Ro,
856
+ md: So,
857
857
  lg: To,
858
858
  fullscreen: Co,
859
859
  header: Ao,
@@ -863,7 +863,7 @@ const wo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
863
863
  footer: Eo
864
864
  }, gt = _t({ classes: {}, titleId: "" }), Gt = ({ children: e, className: t, style: n, onClose: r }) => {
865
865
  const { classes: o, titleId: c } = ft(gt);
866
- return /* @__PURE__ */ z(
866
+ return /* @__PURE__ */ j(
867
867
  "div",
868
868
  {
869
869
  id: c,
@@ -910,9 +910,9 @@ const yt = $e(
910
910
  "aria-label": h,
911
911
  "aria-labelledby": u
912
912
  }, d) => {
913
- const f = re(null), y = d ?? f, L = Ye(), v = u ?? `${L}-title`;
914
- Mo(y, e);
915
- const S = ke(
913
+ const f = oe(null), p = d ?? f, L = Ye(), b = u ?? `${L}-title`;
914
+ Mo(p, e);
915
+ const R = ke(
916
916
  () => ({
917
917
  Escape: () => {
918
918
  r && t();
@@ -920,34 +920,34 @@ const yt = $e(
920
920
  }),
921
921
  [r, t]
922
922
  );
923
- Rt(S, e), Ne(() => {
923
+ St(R, e), Ne(() => {
924
924
  if (!e) return;
925
- const D = document.body.style.overflow;
925
+ const J = document.body.style.overflow;
926
926
  return document.body.style.overflow = "hidden", () => {
927
- document.body.style.overflow = D;
927
+ document.body.style.overflow = J;
928
928
  };
929
929
  }, [e]);
930
- const N = (D) => {
931
- n && D.target === D.currentTarget && t();
930
+ const w = (J) => {
931
+ n && J.target === J.currentTarget && t();
932
932
  };
933
933
  return e ? pt(
934
934
  /* @__PURE__ */ s(
935
935
  "div",
936
936
  {
937
937
  className: m(ze.backdrop, c?.backdrop),
938
- onClick: N,
938
+ onClick: w,
939
939
  role: "presentation",
940
940
  children: /* @__PURE__ */ s(
941
941
  "div",
942
942
  {
943
- ref: y,
943
+ ref: p,
944
944
  className: m(ze.modal, ze[o], c?.modal, i),
945
945
  style: l,
946
946
  role: "dialog",
947
947
  "aria-modal": "true",
948
948
  "aria-label": h,
949
- "aria-labelledby": h ? void 0 : v,
950
- children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: v }, children: a })
949
+ "aria-labelledby": h ? void 0 : b,
950
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: b }, children: a })
951
951
  }
952
952
  )
953
953
  }
@@ -981,7 +981,7 @@ function Pl({
981
981
  children: c
982
982
  }) {
983
983
  const i = n && n.length > 0;
984
- return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */ z(
984
+ return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */ j(
985
985
  "form",
986
986
  {
987
987
  onSubmit: e.handleSubmit(t),
@@ -1012,27 +1012,27 @@ function Wl({
1012
1012
  style: l,
1013
1013
  children: a
1014
1014
  }) {
1015
- const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), f = a.type, y = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Yo.has(y), { ref: v, ...S } = u, N = re(v);
1016
- N.current = v;
1017
- const D = fe(
1018
- (j) => {
1019
- if (j) {
1020
- const Z = j.matches("input, select, textarea, button, [tabindex]") ? j : j.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1021
- N.current(Z ?? j);
1015
+ const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), f = a.type, p = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Yo.has(p), { ref: b, ...R } = u, w = oe(b);
1016
+ w.current = b;
1017
+ const J = pe(
1018
+ (W) => {
1019
+ if (W) {
1020
+ const E = W.matches("input, select, textarea, button, [tabindex]") ? W : W.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1021
+ w.current(E ?? W);
1022
1022
  } else
1023
- N.current(null);
1023
+ w.current(null);
1024
1024
  },
1025
1025
  // eslint-disable-next-line react-hooks/exhaustive-deps
1026
1026
  []
1027
1027
  );
1028
- return /* @__PURE__ */ z("div", { className: m(We.field, c?.field, i), style: l, children: [
1029
- t && /* @__PURE__ */ z("label", { className: m(We.label, d.error && We.labelError, c?.label), htmlFor: e, children: [
1028
+ return /* @__PURE__ */ j("div", { className: m(We.field, c?.field, i), style: l, children: [
1029
+ t && /* @__PURE__ */ j("label", { className: m(We.label, d.error && We.labelError, c?.label), htmlFor: e, children: [
1030
1030
  t,
1031
1031
  r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
1032
1032
  ] }),
1033
1033
  Xt(a, {
1034
- ...S,
1035
- ref: D,
1034
+ ...R,
1035
+ ref: J,
1036
1036
  id: e,
1037
1037
  error: !!d.error,
1038
1038
  "aria-invalid": d.error ? !0 : void 0,
@@ -1041,11 +1041,11 @@ function Wl({
1041
1041
  // Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
1042
1042
  // handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
1043
1043
  ...L && {
1044
- onValueChange: S.onChange,
1045
- onValuesChange: S.onChange
1044
+ onValueChange: R.onChange,
1045
+ onValuesChange: R.onChange
1046
1046
  },
1047
1047
  // Bridge for Checkbox (expects checked, not value)
1048
- checked: typeof S.value == "boolean" ? S.value : void 0
1048
+ checked: typeof R.value == "boolean" ? R.value : void 0
1049
1049
  }),
1050
1050
  d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: m(We.error, c?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: m(We.helperText, c?.helperText), children: n }) : null
1051
1051
  ] });
@@ -1092,7 +1092,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1092
1092
  ...l
1093
1093
  }
1094
1094
  );
1095
- return n || r ? /* @__PURE__ */ z(
1095
+ return n || r ? /* @__PURE__ */ j(
1096
1096
  "div",
1097
1097
  {
1098
1098
  className: m(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, c),
@@ -1107,7 +1107,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1107
1107
  }
1108
1108
  );
1109
1109
  ri.displayName = "Input";
1110
- const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV", Mi = "crk-menuItems-VrZnE", wi = "crk-item-fU3XI", $i = "crk-itemHighlighted-MvR41", Ni = "crk-itemDisabled-KTUO8", Li = "crk-itemSelected-42-BG", Si = "crk-noResults-uicSW", Ri = "crk-multiTrigger-Pd3wJ", Ti = "crk-multiTriggerDisabled-9ajge", Ci = "crk-chip-TuYUB", Ai = "crk-chipLabel-H4JWu", Bi = "crk-chipRemove-Lfk0R", Ii = "crk-multiSearch-OrVeS", Di = "crk-arrowMulti-Nh9Hr", Ei = "crk-itemCheck-DPB5A", W = {
1110
+ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "crk-lg-24Xd3", si = "crk-root-Uu9Ah", ai = "crk-error-9oRU6", di = "crk-arrow-WU8ZW", ui = "crk-searchableWrapper-7AL4l", hi = "crk-hiddenSelect-s3DEx", mi = "crk-searchableTrigger-m-GWV", fi = "crk-triggerOpen-Lo8-j", pi = "crk-triggerLabel-5rETZ", gi = "crk-placeholder-teBBh", yi = "crk-arrowInline-m-roG", vi = "crk-disabled-pcSeq", bi = "crk-visuallyHidden-2tTD5", xi = "crk-menu--i-je", ki = "crk-menuEnter-vJjLV", Mi = "crk-menuItems-VrZnE", wi = "crk-item-fU3XI", $i = "crk-itemHighlighted-MvR41", Ni = "crk-itemDisabled-KTUO8", Li = "crk-itemSelected-42-BG", Ri = "crk-noResults-uicSW", Si = "crk-multiTrigger-Pd3wJ", Ti = "crk-multiTriggerDisabled-9ajge", Ci = "crk-chip-TuYUB", Ai = "crk-chipLabel-H4JWu", Bi = "crk-chipRemove-Lfk0R", Ii = "crk-multiSearch-OrVeS", Di = "crk-arrowMulti-Nh9Hr", Ei = "crk-itemCheck-DPB5A", P = {
1111
1111
  wrapper: oi,
1112
1112
  sm: ii,
1113
1113
  md: ci,
@@ -1131,8 +1131,8 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1131
1131
  itemHighlighted: $i,
1132
1132
  itemDisabled: Ni,
1133
1133
  itemSelected: Li,
1134
- noResults: Si,
1135
- multiTrigger: Ri,
1134
+ noResults: Ri,
1135
+ multiTrigger: Si,
1136
1136
  multiTriggerDisabled: Ti,
1137
1137
  chip: Ci,
1138
1138
  chipLabel: Ai,
@@ -1154,20 +1154,20 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1154
1154
  searchPlaceholder: h,
1155
1155
  onValueChange: u,
1156
1156
  ...d
1157
- }, f) => /* @__PURE__ */ z("div", { className: m(W.wrapper, W[e], t && W.error, o?.wrapper, c), style: i, children: [
1158
- /* @__PURE__ */ z(
1157
+ }, f) => /* @__PURE__ */ j("div", { className: m(P.wrapper, P[e], t && P.error, o?.wrapper, c), style: i, children: [
1158
+ /* @__PURE__ */ j(
1159
1159
  "select",
1160
1160
  {
1161
1161
  ref: f,
1162
- className: m(W.root, W[e], t && W.error, o?.root),
1162
+ className: m(P.root, P[e], t && P.error, o?.root),
1163
1163
  ...d,
1164
1164
  children: [
1165
1165
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
1166
- n ? n.map((y) => /* @__PURE__ */ s("option", { value: y.value, disabled: y.disabled, children: y.label }, y.value)) : l
1166
+ n ? n.map((p) => /* @__PURE__ */ s("option", { value: p.value, disabled: p.disabled, children: p.label }, p.value)) : l
1167
1167
  ]
1168
1168
  }
1169
1169
  ),
1170
- /* @__PURE__ */ s("span", { className: m(W.arrow, o?.arrow) })
1170
+ /* @__PURE__ */ s("span", { className: m(P.arrow, o?.arrow) })
1171
1171
  ] })
1172
1172
  );
1173
1173
  Qt.displayName = "NativeSelect";
@@ -1186,84 +1186,84 @@ const Jt = $e(
1186
1186
  searchPlaceholder: u = "Search...",
1187
1187
  onChange: d,
1188
1188
  onValueChange: f,
1189
- portal: y = !0
1189
+ portal: p = !0
1190
1190
  }, L) => {
1191
- const [v, S] = Le(!1), [N, D] = Le(""), [j, Z] = Le(0), U = re(null), C = re(null), $ = re(null), oe = re(null), ce = re(null), q = Ye(), ae = Tt($, v && y), R = re(null), te = L ?? R, H = re(!1);
1191
+ const [b, R] = Le(!1), [w, J] = Le(""), [W, E] = Le(0), Z = oe(null), C = oe(null), $ = oe(null), ie = oe(null), ne = oe(null), V = Ye(), ae = Tt($, b && p), S = oe(null), re = L ?? S, F = oe(!1);
1192
1192
  Ne(() => {
1193
- H.current && !v && $.current?.focus(), H.current = v;
1194
- }, [v]);
1195
- const O = fe(() => {
1196
- S(!1), D(""), Z(0);
1197
- }, []), A = fe(() => {
1198
- a || (S(!0), D(""), Z(0), setTimeout(() => C.current?.focus(), 0));
1199
- }, [a]), F = fe(
1200
- (M) => {
1201
- if (f?.(M), te.current) {
1193
+ F.current && !b && $.current?.focus(), F.current = b;
1194
+ }, [b]);
1195
+ const X = pe(() => {
1196
+ R(!1), J(""), E(0);
1197
+ }, []), A = pe(() => {
1198
+ a || (R(!0), J(""), E(0), setTimeout(() => C.current?.focus(), 0));
1199
+ }, [a]), z = pe(
1200
+ (N) => {
1201
+ if (f?.(N), re.current) {
1202
1202
  Object.getOwnPropertyDescriptor(
1203
1203
  HTMLSelectElement.prototype,
1204
1204
  "value"
1205
- )?.set?.call(te.current, M);
1206
- const k = new Event("change", { bubbles: !0 });
1207
- te.current.dispatchEvent(k), d?.(k);
1205
+ )?.set?.call(re.current, N);
1206
+ const v = new Event("change", { bubbles: !0 });
1207
+ re.current.dispatchEvent(v), d?.(v);
1208
1208
  }
1209
- O();
1209
+ X();
1210
1210
  },
1211
- [f, d, te, O]
1212
- ), ne = ke(() => {
1213
- if (!N) return n;
1214
- const M = N.toLowerCase();
1215
- return n.filter((g) => g.label.toLowerCase().includes(M));
1216
- }, [n, N]);
1211
+ [f, d, re, X]
1212
+ ), ce = ke(() => {
1213
+ if (!w) return n;
1214
+ const N = w.toLowerCase();
1215
+ return n.filter((y) => y.label.toLowerCase().includes(N));
1216
+ }, [n, w]);
1217
1217
  Ne(() => {
1218
- const M = ne.findIndex((g) => !g.disabled);
1219
- Z(M >= 0 ? M : 0);
1220
- }, [ne]), Ne(() => {
1221
- if (!v) return;
1222
- const M = ce.current;
1223
- if (!M) return;
1224
- M.querySelectorAll('[role="option"]')[j]?.scrollIntoView?.({ block: "nearest" });
1225
- }, [j, v]);
1226
- const pe = fe(
1227
- (M) => {
1228
- const g = ne.map((k, B) => k.disabled ? -1 : B).filter((k) => k >= 0);
1229
- if (g.length !== 0)
1230
- if (M.key === "ArrowDown")
1231
- M.preventDefault(), Z((k) => {
1232
- const B = g.indexOf(k);
1233
- return B < g.length - 1 ? g[B + 1] : g[0];
1218
+ const N = ce.findIndex((y) => !y.disabled);
1219
+ E(N >= 0 ? N : 0);
1220
+ }, [ce]), Ne(() => {
1221
+ if (!b) return;
1222
+ const N = ne.current;
1223
+ if (!N) return;
1224
+ N.querySelectorAll('[role="option"]')[W]?.scrollIntoView?.({ block: "nearest" });
1225
+ }, [W, b]);
1226
+ const me = pe(
1227
+ (N) => {
1228
+ const y = ce.map((v, B) => v.disabled ? -1 : B).filter((v) => v >= 0);
1229
+ if (y.length !== 0)
1230
+ if (N.key === "ArrowDown")
1231
+ N.preventDefault(), E((v) => {
1232
+ const B = y.indexOf(v);
1233
+ return B < y.length - 1 ? y[B + 1] : y[0];
1234
1234
  });
1235
- else if (M.key === "ArrowUp")
1236
- M.preventDefault(), Z((k) => {
1237
- const B = g.indexOf(k);
1238
- return B > 0 ? g[B - 1] : g[g.length - 1];
1235
+ else if (N.key === "ArrowUp")
1236
+ N.preventDefault(), E((v) => {
1237
+ const B = y.indexOf(v);
1238
+ return B > 0 ? y[B - 1] : y[y.length - 1];
1239
1239
  });
1240
- else if (M.key === "Enter") {
1241
- M.preventDefault();
1242
- const k = ne[j];
1243
- k && !k.disabled && F(k.value);
1244
- } else M.key === "Escape" && (M.preventDefault(), O());
1240
+ else if (N.key === "Enter") {
1241
+ N.preventDefault();
1242
+ const v = ce[W];
1243
+ v && !v.disabled && z(v.value);
1244
+ } else N.key === "Escape" && (N.preventDefault(), X());
1245
1245
  },
1246
- [ne, j, F, O]
1246
+ [ce, W, z, X]
1247
1247
  );
1248
1248
  Ne(() => {
1249
- if (!v) return;
1250
- const M = (g) => {
1251
- const k = g.target;
1252
- U.current?.contains(k) || oe.current?.contains(k) || O();
1249
+ if (!b) return;
1250
+ const N = (y) => {
1251
+ const v = y.target;
1252
+ Z.current?.contains(v) || ie.current?.contains(v) || X();
1253
1253
  };
1254
- return document.addEventListener("mousedown", M), () => document.removeEventListener("mousedown", M);
1255
- }, [v, O]);
1256
- const K = n.find((M) => M.value === l)?.label, X = ne.filter((M) => !M.disabled);
1257
- return /* @__PURE__ */ z(
1254
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
1255
+ }, [b, X]);
1256
+ const K = n.find((N) => N.value === l)?.label, H = ce.filter((N) => !N.disabled);
1257
+ return /* @__PURE__ */ j(
1258
1258
  "div",
1259
1259
  {
1260
- ref: U,
1260
+ ref: Z,
1261
1261
  className: m(
1262
- W.wrapper,
1263
- W.searchableWrapper,
1264
- W[e],
1265
- t && W.error,
1266
- a && W.disabled,
1262
+ P.wrapper,
1263
+ P.searchableWrapper,
1264
+ P[e],
1265
+ t && P.error,
1266
+ a && P.disabled,
1267
1267
  o?.wrapper,
1268
1268
  c
1269
1269
  ),
@@ -1272,108 +1272,108 @@ const Jt = $e(
1272
1272
  /* @__PURE__ */ s(
1273
1273
  "select",
1274
1274
  {
1275
- ref: te,
1276
- className: W.hiddenSelect,
1275
+ ref: re,
1276
+ className: P.hiddenSelect,
1277
1277
  value: l ?? "",
1278
1278
  disabled: a,
1279
1279
  tabIndex: -1,
1280
1280
  "aria-hidden": "true",
1281
1281
  onChange: () => {
1282
1282
  },
1283
- children: n.map((M) => /* @__PURE__ */ s("option", { value: M.value, children: M.label }, M.value))
1283
+ children: n.map((N) => /* @__PURE__ */ s("option", { value: N.value, children: N.label }, N.value))
1284
1284
  }
1285
1285
  ),
1286
- /* @__PURE__ */ z(
1286
+ /* @__PURE__ */ j(
1287
1287
  "button",
1288
1288
  {
1289
1289
  ref: $,
1290
1290
  id: h,
1291
1291
  type: "button",
1292
1292
  className: m(
1293
- W.root,
1294
- W.searchableTrigger,
1295
- W[e],
1296
- v && W.triggerOpen,
1297
- t && W.error,
1298
- v && W.visuallyHidden,
1293
+ P.root,
1294
+ P.searchableTrigger,
1295
+ P[e],
1296
+ b && P.triggerOpen,
1297
+ t && P.error,
1298
+ b && P.visuallyHidden,
1299
1299
  o?.root
1300
1300
  ),
1301
1301
  onClick: A,
1302
1302
  disabled: a,
1303
- "aria-expanded": v,
1303
+ "aria-expanded": b,
1304
1304
  "aria-haspopup": "listbox",
1305
- "aria-controls": v ? q : void 0,
1305
+ "aria-controls": b ? V : void 0,
1306
1306
  children: [
1307
- /* @__PURE__ */ s("span", { className: m(W.triggerLabel, !K && W.placeholder), children: K || r }),
1308
- /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowInline, o?.arrow) })
1307
+ /* @__PURE__ */ s("span", { className: m(P.triggerLabel, !K && P.placeholder), children: K || r }),
1308
+ /* @__PURE__ */ s("span", { className: m(P.arrow, P.arrowInline, o?.arrow) })
1309
1309
  ]
1310
1310
  }
1311
1311
  ),
1312
- v && /* @__PURE__ */ s(
1312
+ b && /* @__PURE__ */ s(
1313
1313
  "input",
1314
1314
  {
1315
1315
  ref: C,
1316
1316
  type: "text",
1317
1317
  role: "combobox",
1318
1318
  className: m(
1319
- W.root,
1320
- W.searchableTrigger,
1321
- W[e],
1322
- W.triggerOpen,
1323
- t && W.error,
1319
+ P.root,
1320
+ P.searchableTrigger,
1321
+ P[e],
1322
+ P.triggerOpen,
1323
+ t && P.error,
1324
1324
  o?.root,
1325
1325
  o?.search
1326
1326
  ),
1327
1327
  placeholder: K || r,
1328
- value: N,
1329
- onChange: (M) => D(M.target.value),
1330
- onKeyDown: pe,
1328
+ value: w,
1329
+ onChange: (N) => J(N.target.value),
1330
+ onKeyDown: me,
1331
1331
  "aria-expanded": !0,
1332
1332
  "aria-haspopup": "listbox",
1333
- "aria-controls": q,
1334
- "aria-activedescendant": X.length > 0 ? `select-option-${ne[j]?.value}` : void 0
1333
+ "aria-controls": V,
1334
+ "aria-activedescendant": H.length > 0 ? `select-option-${ce[W]?.value}` : void 0
1335
1335
  }
1336
1336
  ),
1337
- v && (() => {
1338
- const M = y ? {
1337
+ b && (() => {
1338
+ const N = p ? {
1339
1339
  position: "fixed",
1340
1340
  top: ae.top + 4,
1341
1341
  left: ae.left,
1342
1342
  right: "auto",
1343
1343
  width: ae.width,
1344
1344
  zIndex: "var(--crk-z-floating)"
1345
- } : void 0, g = /* @__PURE__ */ s(
1345
+ } : void 0, y = /* @__PURE__ */ s(
1346
1346
  "div",
1347
1347
  {
1348
- id: q,
1349
- ref: oe,
1350
- className: m(W.menu, o?.menu),
1351
- style: M,
1348
+ id: V,
1349
+ ref: ie,
1350
+ className: m(P.menu, o?.menu),
1351
+ style: N,
1352
1352
  role: "listbox",
1353
- children: /* @__PURE__ */ s("div", { className: W.menuItems, ref: ce, children: ne.length === 0 ? /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }) : ne.map((k, B) => /* @__PURE__ */ s(
1353
+ children: /* @__PURE__ */ s("div", { className: P.menuItems, ref: ne, children: ce.length === 0 ? /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }) : ce.map((v, B) => /* @__PURE__ */ s(
1354
1354
  "button",
1355
1355
  {
1356
- id: `select-option-${k.value}`,
1356
+ id: `select-option-${v.value}`,
1357
1357
  type: "button",
1358
1358
  role: "option",
1359
- "aria-selected": k.value === l,
1359
+ "aria-selected": v.value === l,
1360
1360
  className: m(
1361
- W.item,
1362
- k.disabled && W.itemDisabled,
1363
- k.value === l && W.itemSelected,
1364
- B === j && W.itemHighlighted,
1361
+ P.item,
1362
+ v.disabled && P.itemDisabled,
1363
+ v.value === l && P.itemSelected,
1364
+ B === W && P.itemHighlighted,
1365
1365
  o?.item
1366
1366
  ),
1367
- disabled: k.disabled,
1368
- onClick: () => F(k.value),
1369
- onMouseEnter: () => Z(B),
1370
- children: k.content ?? k.label
1367
+ disabled: v.disabled,
1368
+ onClick: () => z(v.value),
1369
+ onMouseEnter: () => E(B),
1370
+ children: v.content ?? v.label
1371
1371
  },
1372
- k.value
1372
+ v.value
1373
1373
  )) })
1374
1374
  }
1375
1375
  );
1376
- return y && typeof document < "u" ? pt(g, document.body) : g;
1376
+ return p && typeof document < "u" ? pt(y, document.body) : y;
1377
1377
  })()
1378
1378
  ]
1379
1379
  }
@@ -1396,96 +1396,97 @@ const en = $e(
1396
1396
  searchPlaceholder: u,
1397
1397
  onValuesChange: d,
1398
1398
  clearSearchOnSelect: f = !0,
1399
- allowCreate: y = !1,
1400
- onCreate: L,
1401
- createLabel: v,
1402
- portal: S = !0
1403
- }, N) => {
1404
- const D = Array.isArray(l) ? l : l ? [l] : [], [j, Z] = Le(!1), [U, C] = Le(""), [$, oe] = Le(0), ce = re(null), q = re(null), ae = re(null), R = re(null), te = re(null), H = Ye(), O = Tt(te, j && S), A = re(null), F = N ?? A, ne = fe(() => {
1405
- Z(!1), C(""), oe(0);
1406
- }, []), pe = fe(() => {
1407
- a || (Z(!0), C(""), oe(0), setTimeout(() => q.current?.focus(), 0));
1408
- }, [a]), K = fe(
1409
- (b) => {
1410
- const E = D.includes(b) ? D.filter((V) => V !== b) : [...D, b];
1411
- d?.(E), f && C("");
1399
+ closeOnSelect: p = !0,
1400
+ allowCreate: L = !1,
1401
+ onCreate: b,
1402
+ createLabel: R,
1403
+ portal: w = !0
1404
+ }, J) => {
1405
+ const W = Array.isArray(l) ? l : l ? [l] : [], [E, Z] = Le(!1), [C, $] = Le(""), [ie, ne] = Le(0), V = oe(null), ae = oe(null), S = oe(null), re = oe(null), F = oe(null), X = Ye(), A = Tt(F, E && w), z = oe(null), ce = J ?? z, me = pe(() => {
1406
+ Z(!1), $(""), ne(0);
1407
+ }, []), K = pe(() => {
1408
+ a || (Z(!0), $(""), ne(0), setTimeout(() => ae.current?.focus(), 0));
1409
+ }, [a]), H = pe(
1410
+ (k) => {
1411
+ const G = W.includes(k) ? W.filter((O) => O !== k) : [...W, k];
1412
+ d?.(G), p ? me() : f && $("");
1412
1413
  },
1413
- [D, d, f]
1414
- ), X = fe(
1415
- (b, E) => {
1416
- E.stopPropagation(), d?.(D.filter((V) => V !== b));
1414
+ [W, d, p, me, f]
1415
+ ), N = pe(
1416
+ (k, G) => {
1417
+ G.stopPropagation(), d?.(W.filter((O) => O !== k));
1417
1418
  },
1418
- [D, d]
1419
- ), M = ke(() => {
1420
- if (!U) return n;
1421
- const b = U.toLowerCase();
1422
- return n.filter((E) => E.label.toLowerCase().includes(b));
1423
- }, [n, U]), g = U.trim(), k = y && g.length > 0 && !n.some(
1424
- (b) => b.label.toLowerCase() === g.toLowerCase() || b.value === g
1425
- ) && !D.includes(g), B = fe(() => {
1426
- g && (D.includes(g) || (L?.(g), d?.([...D, g]), f && C("")));
1427
- }, [g, D, L, d, f]);
1419
+ [W, d]
1420
+ ), y = ke(() => {
1421
+ if (!C) return n;
1422
+ const k = C.toLowerCase();
1423
+ return n.filter((G) => G.label.toLowerCase().includes(k));
1424
+ }, [n, C]), v = C.trim(), B = L && v.length > 0 && !n.some(
1425
+ (k) => k.label.toLowerCase() === v.toLowerCase() || k.value === v
1426
+ ) && !W.includes(v), _ = pe(() => {
1427
+ v && (W.includes(v) || (b?.(v), d?.([...W, v]), p ? me() : f && $("")));
1428
+ }, [v, W, b, d, p, me, f]);
1428
1429
  Ne(() => {
1429
- const b = M.findIndex((E) => !E.disabled);
1430
- oe(b >= 0 ? b : 0);
1431
- }, [M]), Ne(() => {
1432
- if (!j) return;
1433
- const b = R.current;
1434
- if (!b) return;
1435
- b.querySelectorAll('[role="option"]')[$]?.scrollIntoView?.({ block: "nearest" });
1436
- }, [$, j]);
1437
- const _ = M.length, J = fe(
1438
- (b) => {
1439
- const E = M.map((V, de) => V.disabled ? -1 : de).filter((V) => V >= 0);
1440
- if (k && E.push(_), b.key === "Backspace" && U === "" && D.length > 0) {
1441
- b.preventDefault(), d?.(D.slice(0, -1));
1430
+ const k = y.findIndex((G) => !G.disabled);
1431
+ ne(k >= 0 ? k : 0);
1432
+ }, [y]), Ne(() => {
1433
+ if (!E) return;
1434
+ const k = re.current;
1435
+ if (!k) return;
1436
+ k.querySelectorAll('[role="option"]')[ie]?.scrollIntoView?.({ block: "nearest" });
1437
+ }, [ie, E]);
1438
+ const q = y.length, U = pe(
1439
+ (k) => {
1440
+ const G = y.map((O, le) => O.disabled ? -1 : le).filter((O) => O >= 0);
1441
+ if (B && G.push(q), k.key === "Backspace" && C === "" && W.length > 0) {
1442
+ k.preventDefault(), d?.(W.slice(0, -1));
1442
1443
  return;
1443
1444
  }
1444
- if (E.length !== 0)
1445
- if (b.key === "ArrowDown") {
1446
- if (b.preventDefault(), !j) {
1447
- pe();
1445
+ if (G.length !== 0)
1446
+ if (k.key === "ArrowDown") {
1447
+ if (k.preventDefault(), !E) {
1448
+ K();
1448
1449
  return;
1449
1450
  }
1450
- oe((V) => {
1451
- const de = E.indexOf(V);
1452
- return de < E.length - 1 ? E[de + 1] : E[0];
1451
+ ne((O) => {
1452
+ const le = G.indexOf(O);
1453
+ return le < G.length - 1 ? G[le + 1] : G[0];
1453
1454
  });
1454
- } else if (b.key === "ArrowUp")
1455
- b.preventDefault(), oe((V) => {
1456
- const de = E.indexOf(V);
1457
- return de > 0 ? E[de - 1] : E[E.length - 1];
1455
+ } else if (k.key === "ArrowUp")
1456
+ k.preventDefault(), ne((O) => {
1457
+ const le = G.indexOf(O);
1458
+ return le > 0 ? G[le - 1] : G[G.length - 1];
1458
1459
  });
1459
- else if (b.key === "Enter") {
1460
- if (b.preventDefault(), k && $ === _) {
1461
- B();
1460
+ else if (k.key === "Enter") {
1461
+ if (k.preventDefault(), B && ie === q) {
1462
+ _();
1462
1463
  return;
1463
1464
  }
1464
- const V = M[$];
1465
- V && !V.disabled ? K(V.value) : k && B();
1466
- } else b.key === "Escape" && (b.preventDefault(), ne());
1465
+ const O = y[ie];
1466
+ O && !O.disabled ? H(O.value) : B && _();
1467
+ } else k.key === "Escape" && (k.preventDefault(), me());
1467
1468
  },
1468
- [M, $, K, ne, U, D, d, j, pe, k, B, _]
1469
+ [y, ie, H, me, C, W, d, E, K, B, _, q]
1469
1470
  );
1470
1471
  Ne(() => {
1471
- if (!j) return;
1472
- const b = (E) => {
1473
- const V = E.target;
1474
- ce.current?.contains(V) || ae.current?.contains(V) || ne();
1472
+ if (!E) return;
1473
+ const k = (G) => {
1474
+ const O = G.target;
1475
+ V.current?.contains(O) || S.current?.contains(O) || me();
1475
1476
  };
1476
- return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
1477
- }, [j, ne]);
1478
- const Y = D.map((b) => n.find((V) => V.value === b) ?? { value: b, label: b });
1479
- return /* @__PURE__ */ z(
1477
+ return document.addEventListener("mousedown", k), () => document.removeEventListener("mousedown", k);
1478
+ }, [E, me]);
1479
+ const ee = W.map((k) => n.find((O) => O.value === k) ?? { value: k, label: k });
1480
+ return /* @__PURE__ */ j(
1480
1481
  "div",
1481
1482
  {
1482
- ref: ce,
1483
+ ref: V,
1483
1484
  className: m(
1484
- W.wrapper,
1485
- W.searchableWrapper,
1486
- W[e],
1487
- t && W.error,
1488
- a && W.disabled,
1485
+ P.wrapper,
1486
+ P.searchableWrapper,
1487
+ P[e],
1488
+ t && P.error,
1489
+ a && P.disabled,
1489
1490
  o?.wrapper,
1490
1491
  c
1491
1492
  ),
@@ -1494,135 +1495,135 @@ const en = $e(
1494
1495
  /* @__PURE__ */ s(
1495
1496
  "select",
1496
1497
  {
1497
- ref: F,
1498
- className: W.hiddenSelect,
1498
+ ref: ce,
1499
+ className: P.hiddenSelect,
1499
1500
  multiple: !0,
1500
- value: D,
1501
+ value: W,
1501
1502
  disabled: a,
1502
1503
  tabIndex: -1,
1503
1504
  "aria-hidden": "true",
1504
1505
  onChange: () => {
1505
1506
  },
1506
- children: n.map((b) => /* @__PURE__ */ s("option", { value: b.value, children: b.label }, b.value))
1507
+ children: n.map((k) => /* @__PURE__ */ s("option", { value: k.value, children: k.label }, k.value))
1507
1508
  }
1508
1509
  ),
1509
- /* @__PURE__ */ z(
1510
+ /* @__PURE__ */ j(
1510
1511
  "div",
1511
1512
  {
1512
- ref: te,
1513
+ ref: F,
1513
1514
  className: m(
1514
- W.multiTrigger,
1515
- W[e],
1516
- j && W.triggerOpen,
1517
- t && W.error,
1518
- a && W.multiTriggerDisabled,
1515
+ P.multiTrigger,
1516
+ P[e],
1517
+ E && P.triggerOpen,
1518
+ t && P.error,
1519
+ a && P.multiTriggerDisabled,
1519
1520
  o?.root
1520
1521
  ),
1521
1522
  onClick: () => {
1522
- j ? q.current?.focus() : pe();
1523
+ E ? ae.current?.focus() : K();
1523
1524
  },
1524
1525
  role: "combobox",
1525
- "aria-expanded": j,
1526
+ "aria-expanded": E,
1526
1527
  "aria-haspopup": "listbox",
1527
- "aria-controls": j ? H : void 0,
1528
+ "aria-controls": E ? X : void 0,
1528
1529
  children: [
1529
- Y.map((b) => /* @__PURE__ */ z("span", { className: m(W.chip, o?.chip), children: [
1530
- /* @__PURE__ */ s("span", { className: W.chipLabel, children: b.content ?? b.label }),
1530
+ ee.map((k) => /* @__PURE__ */ j("span", { className: m(P.chip, o?.chip), children: [
1531
+ /* @__PURE__ */ s("span", { className: P.chipLabel, children: k.content ?? k.label }),
1531
1532
  /* @__PURE__ */ s(
1532
1533
  "button",
1533
1534
  {
1534
1535
  type: "button",
1535
- className: m(W.chipRemove, o?.chipRemove),
1536
- onClick: (E) => X(b.value, E),
1537
- "aria-label": `Remove ${b.label}`,
1536
+ className: m(P.chipRemove, o?.chipRemove),
1537
+ onClick: (G) => N(k.value, G),
1538
+ "aria-label": `Remove ${k.label}`,
1538
1539
  tabIndex: -1,
1539
1540
  children: "×"
1540
1541
  }
1541
1542
  )
1542
- ] }, b.value)),
1543
+ ] }, k.value)),
1543
1544
  /* @__PURE__ */ s(
1544
1545
  "input",
1545
1546
  {
1546
- ref: q,
1547
+ ref: ae,
1547
1548
  id: h,
1548
1549
  type: "text",
1549
- className: W.multiSearch,
1550
- placeholder: D.length === 0 ? r : "",
1551
- value: U,
1552
- onChange: (b) => {
1553
- C(b.target.value), j || pe();
1550
+ className: P.multiSearch,
1551
+ placeholder: W.length === 0 ? r : "",
1552
+ value: C,
1553
+ onChange: (k) => {
1554
+ $(k.target.value), E || K();
1554
1555
  },
1555
- onKeyDown: J,
1556
+ onKeyDown: U,
1556
1557
  disabled: a,
1557
1558
  "aria-label": "Search options"
1558
1559
  }
1559
1560
  ),
1560
- /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowMulti, o?.arrow) })
1561
+ /* @__PURE__ */ s("span", { className: m(P.arrow, P.arrowMulti, o?.arrow) })
1561
1562
  ]
1562
1563
  }
1563
1564
  ),
1564
- j && (() => {
1565
- const b = S ? {
1565
+ E && (() => {
1566
+ const k = w ? {
1566
1567
  position: "fixed",
1567
- top: O.top + 4,
1568
- left: O.left,
1568
+ top: A.top + 4,
1569
+ left: A.left,
1569
1570
  right: "auto",
1570
- width: O.width,
1571
+ width: A.width,
1571
1572
  zIndex: "var(--crk-z-floating)"
1572
- } : void 0, E = /* @__PURE__ */ s(
1573
+ } : void 0, G = /* @__PURE__ */ s(
1573
1574
  "div",
1574
1575
  {
1575
- id: H,
1576
- ref: ae,
1577
- className: m(W.menu, o?.menu),
1578
- style: b,
1576
+ id: X,
1577
+ ref: S,
1578
+ className: m(P.menu, o?.menu),
1579
+ style: k,
1579
1580
  role: "listbox",
1580
1581
  "aria-multiselectable": "true",
1581
- children: /* @__PURE__ */ z("div", { className: W.menuItems, ref: R, children: [
1582
- M.length === 0 && !k && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
1583
- M.map((V, de) => {
1584
- const he = D.includes(V.value);
1585
- return /* @__PURE__ */ z(
1582
+ children: /* @__PURE__ */ j("div", { className: P.menuItems, ref: re, children: [
1583
+ y.length === 0 && !B && /* @__PURE__ */ s("div", { className: P.noResults, children: "No results" }),
1584
+ y.map((O, le) => {
1585
+ const ge = W.includes(O.value);
1586
+ return /* @__PURE__ */ j(
1586
1587
  "button",
1587
1588
  {
1588
- id: `select-option-${V.value}`,
1589
+ id: `select-option-${O.value}`,
1589
1590
  type: "button",
1590
1591
  role: "option",
1591
- "aria-selected": he,
1592
+ "aria-selected": ge,
1592
1593
  className: m(
1593
- W.item,
1594
- V.disabled && W.itemDisabled,
1595
- he && W.itemSelected,
1596
- de === $ && W.itemHighlighted,
1594
+ P.item,
1595
+ O.disabled && P.itemDisabled,
1596
+ ge && P.itemSelected,
1597
+ le === ie && P.itemHighlighted,
1597
1598
  o?.item
1598
1599
  ),
1599
- disabled: V.disabled,
1600
- onClick: () => K(V.value),
1601
- onMouseEnter: () => oe(de),
1600
+ disabled: O.disabled,
1601
+ onClick: () => H(O.value),
1602
+ onMouseEnter: () => ne(le),
1602
1603
  children: [
1603
- he && /* @__PURE__ */ s("span", { className: W.itemCheck, "aria-hidden": "true" }),
1604
- V.content ?? V.label
1604
+ ge && /* @__PURE__ */ s("span", { className: P.itemCheck, "aria-hidden": "true" }),
1605
+ O.content ?? O.label
1605
1606
  ]
1606
1607
  },
1607
- V.value
1608
+ O.value
1608
1609
  );
1609
1610
  }),
1610
- k && /* @__PURE__ */ s(
1611
+ B && /* @__PURE__ */ s(
1611
1612
  "button",
1612
1613
  {
1613
1614
  type: "button",
1614
1615
  role: "option",
1615
1616
  "aria-selected": !1,
1616
1617
  className: m(
1617
- W.item,
1618
- $ === _ && W.itemHighlighted,
1618
+ P.item,
1619
+ ie === q && P.itemHighlighted,
1619
1620
  o?.item
1620
1621
  ),
1621
- onClick: B,
1622
- onMouseEnter: () => oe(_),
1623
- children: v ? v(g) : /* @__PURE__ */ z(je, { children: [
1622
+ onClick: _,
1623
+ onMouseEnter: () => ne(q),
1624
+ children: R ? R(v) : /* @__PURE__ */ j(je, { children: [
1624
1625
  "Create “",
1625
- /* @__PURE__ */ s("strong", { children: g }),
1626
+ /* @__PURE__ */ s("strong", { children: v }),
1626
1627
  "”"
1627
1628
  ] })
1628
1629
  },
@@ -1631,7 +1632,7 @@ const en = $e(
1631
1632
  ] })
1632
1633
  }
1633
1634
  );
1634
- return S && typeof document < "u" ? pt(E, document.body) : E;
1635
+ return w && typeof document < "u" ? pt(G, document.body) : G;
1635
1636
  })()
1636
1637
  ]
1637
1638
  }
@@ -1657,10 +1658,10 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1657
1658
  style: o,
1658
1659
  ...c
1659
1660
  }, i) => {
1660
- const l = re(null);
1661
+ const l = oe(null);
1661
1662
  return Ne(() => {
1662
1663
  l.current && (l.current.indeterminate = t);
1663
- }, [t]), /* @__PURE__ */ z(
1664
+ }, [t]), /* @__PURE__ */ j(
1664
1665
  "label",
1665
1666
  {
1666
1667
  className: m(dt.root, t && dt.indeterminate, n?.root, r),
@@ -1727,10 +1728,10 @@ const Vi = $e(
1727
1728
  name: l,
1728
1729
  ...a
1729
1730
  }, h) => {
1730
- const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, y = (L) => {
1731
+ const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, p = (L) => {
1731
1732
  u?.onChange?.(t), c?.(L);
1732
1733
  };
1733
- return /* @__PURE__ */ z("label", { className: m(ht.root, n?.root, r), style: o, children: [
1734
+ return /* @__PURE__ */ j("label", { className: m(ht.root, n?.root, r), style: o, children: [
1734
1735
  /* @__PURE__ */ s(
1735
1736
  "input",
1736
1737
  {
@@ -1740,7 +1741,7 @@ const Vi = $e(
1740
1741
  name: d,
1741
1742
  value: t,
1742
1743
  checked: f,
1743
- onChange: y,
1744
+ onChange: p,
1744
1745
  ...a
1745
1746
  }
1746
1747
  ),
@@ -1776,24 +1777,24 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1776
1777
  onChange: i,
1777
1778
  ...l
1778
1779
  }, a) => {
1779
- const h = re(null), u = fe(() => {
1780
- const y = h.current;
1781
- y && (y.style.height = "auto", y.style.height = `${y.scrollHeight}px`);
1780
+ const h = oe(null), u = pe(() => {
1781
+ const p = h.current;
1782
+ p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1782
1783
  }, []), d = l.value ?? "";
1783
1784
  Ne(() => {
1784
1785
  r && u();
1785
1786
  }, [r, u, d]);
1786
- const f = fe(
1787
- (y) => {
1788
- r && u(), i?.(y);
1787
+ const f = pe(
1788
+ (p) => {
1789
+ r && u(), i?.(p);
1789
1790
  },
1790
1791
  [r, u, i]
1791
1792
  );
1792
1793
  return /* @__PURE__ */ s(
1793
1794
  "textarea",
1794
1795
  {
1795
- ref: (y) => {
1796
- h.current = y, typeof a == "function" ? a(y) : a && (a.current = y);
1796
+ ref: (p) => {
1797
+ h.current = p, typeof a == "function" ? a(p) : a && (a.current = p);
1797
1798
  },
1798
1799
  className: m(
1799
1800
  Ke.root,
@@ -1812,7 +1813,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1812
1813
  );
1813
1814
  ic.displayName = "Textarea";
1814
1815
  function cc(e, t = { width: 600, height: 300 }) {
1815
- const [n, r] = Le(t), o = re(t);
1816
+ const [n, r] = Le(t), o = oe(t);
1816
1817
  return Ne(() => {
1817
1818
  const c = e.current;
1818
1819
  if (!c || typeof ResizeObserver > "u") return;
@@ -1830,7 +1831,7 @@ function cc(e, t = { width: 600, height: 300 }) {
1830
1831
  return a.observe(c), () => a.disconnect();
1831
1832
  }, [e]), n;
1832
1833
  }
1833
- const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Sc = "crk-tooltipTitle-0EfoX", Rc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", w = {
1834
+ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Rc = "crk-tooltipTitle-0EfoX", Sc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", M = {
1834
1835
  root: lc,
1835
1836
  canvas: sc,
1836
1837
  svg: ac,
@@ -1851,8 +1852,8 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1851
1852
  legendIcon: $c,
1852
1853
  legendLabel: Nc,
1853
1854
  tooltip: Lc,
1854
- tooltipTitle: Sc,
1855
- tooltipRows: Rc,
1855
+ tooltipTitle: Rc,
1856
+ tooltipRows: Sc,
1856
1857
  tooltipRow: Tc,
1857
1858
  tooltipLabel: Cc,
1858
1859
  tooltipValue: Ac,
@@ -1861,21 +1862,21 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1861
1862
  tradingHeader: Dc
1862
1863
  }, Ve = $e(
1863
1864
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: c, overlay: i, children: l }, a) => {
1864
- const h = re(null);
1865
+ const h = oe(null);
1865
1866
  un(a, () => h.current);
1866
1867
  const { width: u } = cc(h), d = Math.max(0, u), f = t ?? Math.round(d / e);
1867
- return /* @__PURE__ */ z(
1868
+ return /* @__PURE__ */ j(
1868
1869
  "div",
1869
1870
  {
1870
1871
  ref: h,
1871
- className: m(w.root, o?.root, n),
1872
+ className: m(M.root, o?.root, n),
1872
1873
  style: r,
1873
1874
  children: [
1874
- /* @__PURE__ */ z("div", { className: w.canvas, style: { height: f || void 0 }, children: [
1875
+ /* @__PURE__ */ j("div", { className: M.canvas, style: { height: f || void 0 }, children: [
1875
1876
  d > 0 && f > 0 && /* @__PURE__ */ s(
1876
1877
  "svg",
1877
1878
  {
1878
- className: m(w.svg, o?.svg),
1879
+ className: m(M.svg, o?.svg),
1879
1880
  width: d,
1880
1881
  height: f,
1881
1882
  viewBox: `0 0 ${d} ${f}`,
@@ -1894,13 +1895,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1894
1895
  Ve.displayName = "ChartContainer";
1895
1896
  function vt({ config: e, order: t, classes: n }) {
1896
1897
  const r = t ?? Object.keys(e);
1897
- return /* @__PURE__ */ s("div", { className: m(w.legend, n?.legend), role: "list", children: r.map((o) => {
1898
+ return /* @__PURE__ */ s("div", { className: m(M.legend, n?.legend), role: "list", children: r.map((o) => {
1898
1899
  const c = e[o];
1899
- return c ? /* @__PURE__ */ z("div", { className: m(w.legendItem, n?.legendItem), role: "listitem", children: [
1900
+ return c ? /* @__PURE__ */ j("div", { className: m(M.legendItem, n?.legendItem), role: "listitem", children: [
1900
1901
  c.icon ? /* @__PURE__ */ s(
1901
1902
  "span",
1902
1903
  {
1903
- className: w.legendIcon,
1904
+ className: M.legendIcon,
1904
1905
  style: { color: c.color },
1905
1906
  "aria-hidden": "true",
1906
1907
  children: c.icon
@@ -1908,12 +1909,12 @@ function vt({ config: e, order: t, classes: n }) {
1908
1909
  ) : /* @__PURE__ */ s(
1909
1910
  "span",
1910
1911
  {
1911
- className: w.legendSwatch,
1912
+ className: M.legendSwatch,
1912
1913
  style: { background: c.color },
1913
1914
  "aria-hidden": "true"
1914
1915
  }
1915
1916
  ),
1916
- /* @__PURE__ */ s("span", { className: w.legendLabel, children: c.label })
1917
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: c.label })
1917
1918
  ] }, o) : null;
1918
1919
  }) });
1919
1920
  }
@@ -1930,23 +1931,23 @@ function et({
1930
1931
  classes: h
1931
1932
  }) {
1932
1933
  if (!e) return null;
1933
- const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, y = Math.max(8, n - 16);
1934
+ const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, p = Math.max(8, n - 16);
1934
1935
  return /* @__PURE__ */ s(
1935
1936
  "div",
1936
1937
  {
1937
- className: m(w.tooltip, h?.tooltip),
1938
- style: { left: f, top: y, width: u },
1938
+ className: m(M.tooltip, h?.tooltip),
1939
+ style: { left: f, top: p, width: u },
1939
1940
  role: "tooltip",
1940
- children: c ? c(e) : /* @__PURE__ */ z(je, { children: [
1941
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: w.tooltipTitle, children: String(e[l]) }),
1942
- /* @__PURE__ */ s("div", { className: w.tooltipRows, children: Object.entries(o).map(([L, v]) => {
1943
- const S = e[L];
1944
- if (S == null) return null;
1945
- const N = typeof S == "number" ? i(S) : String(S), D = a?.(L) ?? v.color;
1946
- return /* @__PURE__ */ z("div", { className: w.tooltipRow, children: [
1947
- /* @__PURE__ */ s("span", { className: w.legendSwatch, style: { background: D }, "aria-hidden": "true" }),
1948
- /* @__PURE__ */ s("span", { className: w.tooltipLabel, children: v.label }),
1949
- /* @__PURE__ */ s("span", { className: w.tooltipValue, children: N })
1941
+ children: c ? c(e) : /* @__PURE__ */ j(je, { children: [
1942
+ l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: M.tooltipTitle, children: String(e[l]) }),
1943
+ /* @__PURE__ */ s("div", { className: M.tooltipRows, children: Object.entries(o).map(([L, b]) => {
1944
+ const R = e[L];
1945
+ if (R == null) return null;
1946
+ const w = typeof R == "number" ? i(R) : String(R), J = a?.(L) ?? b.color;
1947
+ return /* @__PURE__ */ j("div", { className: M.tooltipRow, children: [
1948
+ /* @__PURE__ */ s("span", { className: M.legendSwatch, style: { background: J }, "aria-hidden": "true" }),
1949
+ /* @__PURE__ */ s("span", { className: M.tooltipLabel, children: b.label }),
1950
+ /* @__PURE__ */ s("span", { className: M.tooltipValue, children: w })
1950
1951
  ] }, L);
1951
1952
  }) })
1952
1953
  ] })
@@ -1954,11 +1955,11 @@ function et({
1954
1955
  );
1955
1956
  }
1956
1957
  function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
1957
- return /* @__PURE__ */ s("g", { className: m(w.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ z("g", { children: [
1958
+ return /* @__PURE__ */ s("g", { className: m(M.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ j("g", { children: [
1958
1959
  o && /* @__PURE__ */ s(
1959
1960
  "line",
1960
1961
  {
1961
- className: m(w.gridLine, c?.grid),
1962
+ className: m(M.gridLine, c?.grid),
1962
1963
  x1: t,
1963
1964
  x2: t + n,
1964
1965
  y1: l,
@@ -1968,7 +1969,7 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1968
1969
  /* @__PURE__ */ s(
1969
1970
  "text",
1970
1971
  {
1971
- className: m(w.axisLabel, c?.axisLabel),
1972
+ className: m(M.axisLabel, c?.axisLabel),
1972
1973
  x: t - 8,
1973
1974
  y: l,
1974
1975
  textAnchor: "end",
@@ -1979,10 +1980,10 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1979
1980
  ] }, `y-${i}`)) });
1980
1981
  }
1981
1982
  function rn({ ticks: e, y: t, format: n, classes: r }) {
1982
- return /* @__PURE__ */ s("g", { className: m(w.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1983
+ return /* @__PURE__ */ s("g", { className: m(M.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1983
1984
  "text",
1984
1985
  {
1985
- className: m(w.axisLabel, r?.axisLabel),
1986
+ className: m(M.axisLabel, r?.axisLabel),
1986
1987
  x: c,
1987
1988
  y: t + 16,
1988
1989
  textAnchor: "middle",
@@ -2062,93 +2063,93 @@ function Ol({
2062
2063
  valuePosition: u = "top",
2063
2064
  renderLabel: d,
2064
2065
  activeIndex: f,
2065
- onPointClick: y,
2066
+ onPointClick: p,
2066
2067
  showGrid: L = !0,
2067
- showLegend: v = !0,
2068
- showTooltip: S = !0,
2069
- yTickCount: N = 5,
2070
- yFormat: D,
2071
- xFormat: j,
2072
- valueFormat: Z,
2073
- renderTooltip: U,
2068
+ showLegend: b = !0,
2069
+ showTooltip: R = !0,
2070
+ yTickCount: w = 5,
2071
+ yFormat: J,
2072
+ xFormat: W,
2073
+ valueFormat: E,
2074
+ renderTooltip: Z,
2074
2075
  margin: C,
2075
2076
  emptyMessage: $ = "No data",
2076
- className: oe,
2077
- style: ce,
2078
- classes: q
2077
+ className: ie,
2078
+ style: ne,
2079
+ classes: V
2079
2080
  }) {
2080
- const ae = { ...Ec, ...C }, R = ke(() => Object.keys(n), [n]), [te, H] = Le(null), O = re(null), A = f ?? te, F = (pe, K) => {
2081
+ const ae = { ...Ec, ...C }, S = ke(() => Object.keys(n), [n]), [re, F] = Le(null), X = oe(null), A = f ?? re, z = (me, K) => {
2081
2082
  if (l) {
2082
- const X = e[K]?.[l];
2083
- if (typeof X == "string") return X;
2083
+ const H = e[K]?.[l];
2084
+ if (typeof H == "string") return H;
2084
2085
  }
2085
- return n[pe]?.color ?? "var(--crk-chart-1)";
2086
+ return n[me]?.color ?? "var(--crk-chart-1)";
2086
2087
  };
2087
2088
  if (e.length === 0)
2088
- return /* @__PURE__ */ s("div", { ref: O, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2089
- const ne = S && A !== null ? /* @__PURE__ */ s(
2089
+ return /* @__PURE__ */ s("div", { ref: X, className: m(M.root, V?.root, ie), style: ne, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: $ }) }) });
2090
+ const ce = R && A !== null ? /* @__PURE__ */ s(
2090
2091
  et,
2091
2092
  {
2092
2093
  row: e[A],
2093
- x: Hc(e, t, ae, A, O),
2094
+ x: Hc(e, t, ae, A, X),
2094
2095
  y: 16,
2095
- containerWidth: O.current?.getBoundingClientRect().width ?? 0,
2096
+ containerWidth: X.current?.getBoundingClientRect().width ?? 0,
2096
2097
  config: n,
2097
- render: U ? () => U(e[A]) : void 0,
2098
- valueFormat: Z,
2098
+ render: Z ? () => Z(e[A]) : void 0,
2099
+ valueFormat: E,
2099
2100
  titleKey: t,
2100
- resolveColor: l ? (pe) => F(pe, A) : void 0,
2101
- classes: q
2101
+ resolveColor: l ? (me) => z(me, A) : void 0,
2102
+ classes: V
2102
2103
  }
2103
2104
  ) : null;
2104
2105
  return /* @__PURE__ */ s(
2105
2106
  Ve,
2106
2107
  {
2107
- ref: O,
2108
+ ref: X,
2108
2109
  aspectRatio: r,
2109
2110
  height: o,
2110
- className: oe,
2111
- style: ce,
2112
- classes: q,
2113
- legend: v ? /* @__PURE__ */ s(vt, { config: n, classes: q }) : void 0,
2114
- overlay: ne,
2115
- children: ({ width: pe, height: K }) => {
2116
- const X = ae.left, M = pe - ae.right, g = ae.top, k = K - ae.bottom, B = Math.max(0, M - X), _ = Math.max(0, k - g), J = e.map((p) => String(p[t])), Y = Xe(J, [X, M], 0), b = [];
2117
- for (const p of R)
2111
+ className: ie,
2112
+ style: ne,
2113
+ classes: V,
2114
+ legend: b ? /* @__PURE__ */ s(vt, { config: n, classes: V }) : void 0,
2115
+ overlay: ce,
2116
+ children: ({ width: me, height: K }) => {
2117
+ const H = ae.left, N = me - ae.right, y = ae.top, v = K - ae.bottom, B = Math.max(0, N - H), _ = Math.max(0, v - y), q = e.map((g) => String(g[t])), U = Xe(q, [H, N], 0), ee = [];
2118
+ for (const g of S)
2118
2119
  for (const x of e) {
2119
- const ee = x[p];
2120
- typeof ee == "number" && b.push(ee);
2120
+ const te = x[g];
2121
+ typeof te == "number" && ee.push(te);
2121
2122
  }
2122
- const [E, V] = bt(b), de = Math.min(0, E), he = qe(de, V, N), ye = Je([he[0], he[he.length - 1]], [k, g]), be = he.map((p) => ({ value: p, y: ye(p) })), Se = Wc(J).map((p) => ({ label: p, x: Y(p) }));
2123
- return /* @__PURE__ */ z(je, { children: [
2123
+ const [k, G] = bt(ee), O = Math.min(0, k), le = qe(O, G, w), ge = Je([le[0], le[le.length - 1]], [v, y]), be = le.map((g) => ({ value: g, y: ge(g) })), Re = Wc(q).map((g) => ({ label: g, x: U(g) }));
2124
+ return /* @__PURE__ */ j(je, { children: [
2124
2125
  /* @__PURE__ */ s(
2125
2126
  nn,
2126
2127
  {
2127
2128
  ticks: be,
2128
- x: X,
2129
+ x: H,
2129
2130
  plotWidth: B,
2130
- format: D,
2131
+ format: J,
2131
2132
  showGrid: L,
2132
- classes: q
2133
+ classes: V
2133
2134
  }
2134
2135
  ),
2135
- /* @__PURE__ */ s(rn, { ticks: Se, y: k, format: j, classes: q }),
2136
- R.map((p) => {
2137
- const x = n[p], ee = e.map((P, G) => {
2138
- const I = P[p], me = typeof I == "number" ? I : 0;
2139
- return { x: Y(J[G]), y: ye(me), value: me, row: P };
2136
+ /* @__PURE__ */ s(rn, { ticks: Re, y: v, format: W, classes: V }),
2137
+ S.map((g) => {
2138
+ const x = n[g], te = e.map((D, Y) => {
2139
+ const I = D[g], fe = typeof I == "number" ? I : 0;
2140
+ return { x: U(q[Y]), y: ge(fe), value: fe, row: D };
2140
2141
  });
2141
- return /* @__PURE__ */ z("g", { className: m(w.series, q?.series), children: [
2142
+ return /* @__PURE__ */ j("g", { className: m(M.series, V?.series), children: [
2142
2143
  /* @__PURE__ */ s(
2143
2144
  "path",
2144
2145
  {
2145
- className: m(w.linePath),
2146
- d: Pc(ee, c),
2146
+ className: m(M.linePath),
2147
+ d: Pc(te, c),
2147
2148
  stroke: x.color
2148
2149
  }
2149
2150
  ),
2150
- i && ee.map((P, G) => {
2151
- const I = F(p, G), me = A === G, Q = f !== void 0 && !me, T = y ? () => y({ row: P.row, value: P.value, seriesKey: p, index: G }) : void 0;
2151
+ i && te.map((D, Y) => {
2152
+ const I = z(g, Y), fe = A === Y, Q = f !== void 0 && !fe, T = p ? () => p({ row: D.row, value: D.value, seriesKey: g, index: Y }) : void 0;
2152
2153
  return a ? /* @__PURE__ */ s(
2153
2154
  "g",
2154
2155
  {
@@ -2156,85 +2157,85 @@ function Ol({
2156
2157
  style: T ? { cursor: "pointer" } : void 0,
2157
2158
  opacity: Q ? 0.45 : 1,
2158
2159
  children: a({
2159
- row: P.row,
2160
- value: P.value,
2161
- seriesKey: p,
2162
- index: G,
2163
- x: P.x,
2164
- y: P.y,
2160
+ row: D.row,
2161
+ value: D.value,
2162
+ seriesKey: g,
2163
+ index: Y,
2164
+ x: D.x,
2165
+ y: D.y,
2165
2166
  color: I,
2166
- active: me
2167
+ active: fe
2167
2168
  })
2168
2169
  },
2169
- `${p}-${G}`
2170
+ `${g}-${Y}`
2170
2171
  ) : /* @__PURE__ */ s(
2171
2172
  "circle",
2172
2173
  {
2173
- className: m(w.point, q?.point),
2174
- cx: P.x,
2175
- cy: P.y,
2176
- r: me ? 5 : 3.5,
2174
+ className: m(M.point, V?.point),
2175
+ cx: D.x,
2176
+ cy: D.y,
2177
+ r: fe ? 5 : 3.5,
2177
2178
  fill: I,
2178
2179
  onClick: T,
2179
2180
  style: T ? { cursor: "pointer" } : void 0,
2180
2181
  opacity: Q ? 0.45 : 1
2181
2182
  },
2182
- `${p}-${G}`
2183
+ `${g}-${Y}`
2183
2184
  );
2184
2185
  }),
2185
- (h || d) && ee.map((P, G) => {
2186
- const I = d ? d({ row: P.row, value: P.value, seriesKey: p, index: G }) : h ? Z ? Z(P.value) : String(P.value) : null;
2186
+ (h || d) && te.map((D, Y) => {
2187
+ const I = d ? d({ row: D.row, value: D.value, seriesKey: g, index: Y }) : h ? E ? E(D.value) : String(D.value) : null;
2187
2188
  if (I == null) return null;
2188
- const me = 10, Q = u === "top" ? P.y - me : P.y + me + 4;
2189
+ const fe = 10, Q = u === "top" ? D.y - fe : D.y + fe + 4;
2189
2190
  return /* @__PURE__ */ s(
2190
2191
  "text",
2191
2192
  {
2192
- className: m(w.axisLabel),
2193
- x: P.x,
2193
+ className: m(M.axisLabel),
2194
+ x: D.x,
2194
2195
  y: Q,
2195
2196
  textAnchor: "middle",
2196
2197
  dominantBaseline: u === "top" ? "auto" : "middle",
2197
2198
  children: I
2198
2199
  },
2199
- `label-${p}-${G}`
2200
+ `label-${g}-${Y}`
2200
2201
  );
2201
2202
  })
2202
- ] }, p);
2203
+ ] }, g);
2203
2204
  }),
2204
2205
  A !== null && /* @__PURE__ */ s(
2205
2206
  "line",
2206
2207
  {
2207
- className: w.cursorLine,
2208
- x1: Y(J[A]),
2209
- x2: Y(J[A]),
2210
- y1: g,
2211
- y2: k
2208
+ className: M.cursorLine,
2209
+ x1: U(q[A]),
2210
+ x2: U(q[A]),
2211
+ y1: y,
2212
+ y2: v
2212
2213
  }
2213
2214
  ),
2214
2215
  /* @__PURE__ */ s(
2215
2216
  "rect",
2216
2217
  {
2217
- className: w.interactionLayer,
2218
- x: X,
2219
- y: g,
2218
+ className: M.interactionLayer,
2219
+ x: H,
2220
+ y,
2220
2221
  width: B,
2221
2222
  height: _,
2222
- onMouseMove: (p) => {
2223
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2223
+ onMouseMove: (g) => {
2224
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left + H, D = U.step(), Y = Math.max(
2224
2225
  0,
2225
- Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2226
+ Math.min(e.length - 1, Math.round((te - H - D / 2) / D))
2226
2227
  );
2227
- H(G);
2228
+ F(Y);
2228
2229
  },
2229
- onMouseLeave: () => H(null),
2230
- onClick: y ? (p) => {
2231
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2230
+ onMouseLeave: () => F(null),
2231
+ onClick: p ? (g) => {
2232
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left + H, D = U.step(), Y = Math.max(
2232
2233
  0,
2233
- Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2234
- ), I = R[0], me = e[G][I], Q = typeof me == "number" ? me : 0;
2235
- y({ row: e[G], value: Q, seriesKey: I, index: G });
2234
+ Math.min(e.length - 1, Math.round((te - H - D / 2) / D))
2235
+ ), I = S[0], fe = e[Y][I], Q = typeof fe == "number" ? fe : 0;
2236
+ p({ row: e[Y], value: Q, seriesKey: I, index: Y });
2236
2237
  } : void 0,
2237
- style: y ? { cursor: "pointer" } : void 0
2238
+ style: p ? { cursor: "pointer" } : void 0
2238
2239
  }
2239
2240
  )
2240
2241
  ] });
@@ -2249,7 +2250,7 @@ function Hc(e, t, n, r, o) {
2249
2250
  return Xe(l, [n.left, i - n.right], 0)(l[r]);
2250
2251
  }
2251
2252
  const Oc = { top: 12, right: 16, bottom: 28, left: 48 };
2252
- function St(e, t) {
2253
+ function Rt(e, t) {
2253
2254
  if (e.length === 0) return "";
2254
2255
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
2255
2256
  if (t === "linear")
@@ -2269,12 +2270,12 @@ function St(e, t) {
2269
2270
  }
2270
2271
  function Dt(e, t, n) {
2271
2272
  if (e.length === 0) return "";
2272
- const r = St(e, n);
2273
+ const r = Rt(e, n);
2273
2274
  if (typeof t == "number") {
2274
2275
  const l = e[e.length - 1], a = e[0];
2275
2276
  return `${r} L ${l.x} ${t} L ${a.x} ${t} Z`;
2276
2277
  }
2277
- const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), i = St(o, n).replace(/^M /, "L ");
2278
+ const o = e.map((l, a) => ({ x: l.x, y: t[a] })).reverse(), i = Rt(o, n).replace(/^M /, "L ");
2278
2279
  return `${r} ${i} Z`;
2279
2280
  }
2280
2281
  function Fc(e, t = 8) {
@@ -2296,160 +2297,160 @@ function Fl({
2296
2297
  showXAxis: u = !0,
2297
2298
  showYAxis: d = !0,
2298
2299
  showLegend: f = !0,
2299
- showTooltip: y = !0,
2300
+ showTooltip: p = !0,
2300
2301
  yTickCount: L = 5,
2301
- yFormat: v,
2302
- xFormat: S,
2303
- valueFormat: N,
2304
- renderTooltip: D,
2305
- margin: j,
2306
- emptyMessage: Z = "No data",
2307
- className: U,
2302
+ yFormat: b,
2303
+ xFormat: R,
2304
+ valueFormat: w,
2305
+ renderTooltip: J,
2306
+ margin: W,
2307
+ emptyMessage: E = "No data",
2308
+ className: Z,
2308
2309
  style: C,
2309
2310
  classes: $
2310
2311
  }) {
2311
- const oe = ke(
2312
+ const ie = ke(
2312
2313
  () => ({
2313
2314
  ...Oc,
2314
2315
  ...d ? {} : { left: 16 },
2315
- ...j
2316
+ ...W
2316
2317
  }),
2317
- [j, d]
2318
- ), ce = ke(() => Object.keys(n), [n]), q = i && ce.length > 0, ae = q && l === "expand", [R, te] = Le(null), H = re(null), O = Ye();
2318
+ [W, d]
2319
+ ), ne = ke(() => Object.keys(n), [n]), V = i && ne.length > 0, ae = V && l === "expand", [S, re] = Le(null), F = oe(null), X = Ye();
2319
2320
  if (e.length === 0)
2320
- return /* @__PURE__ */ s("div", { ref: H, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
2321
+ return /* @__PURE__ */ s("div", { ref: F, className: m(M.root, $?.root, Z), style: C, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: E }) }) });
2321
2322
  const A = ke(() => {
2322
- const X = ce.map(() => []), M = ce.map(() => []);
2323
- for (let g = 0; g < e.length; g++) {
2324
- let k = 0;
2323
+ const H = ne.map(() => []), N = ne.map(() => []);
2324
+ for (let y = 0; y < e.length; y++) {
2325
+ let v = 0;
2325
2326
  if (ae) {
2326
- for (const _ of ce) {
2327
- const J = e[g][_];
2328
- typeof J == "number" && J > 0 && (k += J);
2327
+ for (const _ of ne) {
2328
+ const q = e[y][_];
2329
+ typeof q == "number" && q > 0 && (v += q);
2329
2330
  }
2330
- k === 0 && (k = 1);
2331
+ v === 0 && (v = 1);
2331
2332
  }
2332
2333
  let B = 0;
2333
- for (let _ = 0; _ < ce.length; _++) {
2334
- const J = ce[_], Y = e[g][J], b = typeof Y == "number" ? Y : 0;
2335
- if (q) {
2336
- const E = ae ? b / k : b;
2337
- M[_][g] = B, B += E, X[_][g] = B;
2334
+ for (let _ = 0; _ < ne.length; _++) {
2335
+ const q = ne[_], U = e[y][q], ee = typeof U == "number" ? U : 0;
2336
+ if (V) {
2337
+ const k = ae ? ee / v : ee;
2338
+ N[_][y] = B, B += k, H[_][y] = B;
2338
2339
  } else
2339
- M[_][g] = 0, X[_][g] = b;
2340
+ N[_][y] = 0, H[_][y] = ee;
2340
2341
  }
2341
2342
  }
2342
- return { tops: X, bottoms: M };
2343
- }, [e, ce, q, ae]), { tops: F, bottoms: ne } = A, [pe, K] = ke(() => {
2343
+ return { tops: H, bottoms: N };
2344
+ }, [e, ne, V, ae]), { tops: z, bottoms: ce } = A, [me, K] = ke(() => {
2344
2345
  if (ae) return [0, 1];
2345
- let X = 0, M = 0;
2346
- for (const g of F)
2347
- for (const k of g)
2348
- k < X && (X = k), k > M && (M = k);
2349
- for (const g of ne)
2350
- for (const k of g)
2351
- k < X && (X = k);
2352
- return [Math.min(0, X), M];
2353
- }, [F, ne, ae]);
2346
+ let H = 0, N = 0;
2347
+ for (const y of z)
2348
+ for (const v of y)
2349
+ v < H && (H = v), v > N && (N = v);
2350
+ for (const y of ce)
2351
+ for (const v of y)
2352
+ v < H && (H = v);
2353
+ return [Math.min(0, H), N];
2354
+ }, [z, ce, ae]);
2354
2355
  return /* @__PURE__ */ s(
2355
2356
  Ve,
2356
2357
  {
2357
- ref: H,
2358
+ ref: F,
2358
2359
  aspectRatio: r,
2359
2360
  height: o,
2360
- className: U,
2361
+ className: Z,
2361
2362
  style: C,
2362
2363
  classes: $,
2363
2364
  legend: f ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
2364
- overlay: y && R !== null ? /* @__PURE__ */ s(
2365
+ overlay: p && S !== null ? /* @__PURE__ */ s(
2365
2366
  et,
2366
2367
  {
2367
- row: e[R],
2368
- x: zc(e, t, oe, R, H),
2368
+ row: e[S],
2369
+ x: zc(e, t, ie, S, F),
2369
2370
  y: 16,
2370
- containerWidth: H.current?.getBoundingClientRect().width ?? 0,
2371
+ containerWidth: F.current?.getBoundingClientRect().width ?? 0,
2371
2372
  config: n,
2372
- render: D ? () => D(e[R]) : void 0,
2373
- valueFormat: ae ? (X) => `${Math.round(X * 100)}%` : N,
2373
+ render: J ? () => J(e[S]) : void 0,
2374
+ valueFormat: ae ? (H) => `${Math.round(H * 100)}%` : w,
2374
2375
  titleKey: t,
2375
2376
  classes: $
2376
2377
  }
2377
2378
  ) : null,
2378
- children: ({ width: X, height: M }) => {
2379
- const g = oe.left, k = X - oe.right, B = oe.top, _ = M - oe.bottom, J = Math.max(0, k - g), Y = Math.max(0, _ - B), b = e.map((p) => String(p[t])), E = Xe(b, [g, k], 0), V = ae ? [0, 0.25, 0.5, 0.75, 1] : qe(pe, K, L), de = Je([V[0], V[V.length - 1]], [_, B]), he = de(0), ye = V.map((p) => ({ value: p, y: de(p) })), Ce = Fc(b).map((p) => ({ label: p, x: E(p) })), Se = ae ? (p) => `${Math.round(p * 100)}%` : v;
2380
- return /* @__PURE__ */ z(je, { children: [
2381
- a && /* @__PURE__ */ s("defs", { children: ce.map((p) => /* @__PURE__ */ z(
2379
+ children: ({ width: H, height: N }) => {
2380
+ const y = ie.left, v = H - ie.right, B = ie.top, _ = N - ie.bottom, q = Math.max(0, v - y), U = Math.max(0, _ - B), ee = e.map((g) => String(g[t])), k = Xe(ee, [y, v], 0), G = ae ? [0, 0.25, 0.5, 0.75, 1] : qe(me, K, L), O = Je([G[0], G[G.length - 1]], [_, B]), le = O(0), ge = G.map((g) => ({ value: g, y: O(g) })), Ce = Fc(ee).map((g) => ({ label: g, x: k(g) })), Re = ae ? (g) => `${Math.round(g * 100)}%` : b;
2381
+ return /* @__PURE__ */ j(je, { children: [
2382
+ a && /* @__PURE__ */ s("defs", { children: ne.map((g) => /* @__PURE__ */ j(
2382
2383
  "linearGradient",
2383
2384
  {
2384
- id: `${O}-${p}`,
2385
+ id: `${X}-${g}`,
2385
2386
  x1: "0",
2386
2387
  y1: "0",
2387
2388
  x2: "0",
2388
2389
  y2: "1",
2389
2390
  children: [
2390
- /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[p].color, stopOpacity: 0.6 }),
2391
- /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[p].color, stopOpacity: 0.05 })
2391
+ /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[g].color, stopOpacity: 0.6 }),
2392
+ /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[g].color, stopOpacity: 0.05 })
2392
2393
  ]
2393
2394
  },
2394
- p
2395
+ g
2395
2396
  )) }),
2396
2397
  d ? /* @__PURE__ */ s(
2397
2398
  nn,
2398
2399
  {
2399
- ticks: ye,
2400
- x: g,
2401
- plotWidth: J,
2402
- format: Se,
2400
+ ticks: ge,
2401
+ x: y,
2402
+ plotWidth: q,
2403
+ format: Re,
2403
2404
  showGrid: h,
2404
2405
  classes: $
2405
2406
  }
2406
- ) : h && /* @__PURE__ */ s("g", { className: m(w.axis, $?.axis), children: ye.map(({ value: p, y: x }) => /* @__PURE__ */ s(
2407
+ ) : h && /* @__PURE__ */ s("g", { className: m(M.axis, $?.axis), children: ge.map(({ value: g, y: x }) => /* @__PURE__ */ s(
2407
2408
  "line",
2408
2409
  {
2409
- className: m(w.gridLine, $?.grid),
2410
- x1: g,
2411
- x2: k,
2410
+ className: m(M.gridLine, $?.grid),
2411
+ x1: y,
2412
+ x2: v,
2412
2413
  y1: x,
2413
2414
  y2: x
2414
2415
  },
2415
- `grid-${p}`
2416
+ `grid-${g}`
2416
2417
  )) }),
2417
- u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: S, classes: $ }),
2418
- ce.map((p, x) => {
2419
- const ee = n[p], P = e.map((Q, T) => ({
2420
- x: E(b[T]),
2421
- y: de(F[x][T])
2422
- })), G = a ? `url(#${O}-${p})` : ee.color, I = a ? 1 : 0.18, me = q ? Dt(P, ne[x].map((Q) => de(Q)), c) : Dt(P, he, c);
2423
- return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
2418
+ u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: R, classes: $ }),
2419
+ ne.map((g, x) => {
2420
+ const te = n[g], D = e.map((Q, T) => ({
2421
+ x: k(ee[T]),
2422
+ y: O(z[x][T])
2423
+ })), Y = a ? `url(#${X}-${g})` : te.color, I = a ? 1 : 0.18, fe = V ? Dt(D, ce[x].map((Q) => O(Q)), c) : Dt(D, le, c);
2424
+ return /* @__PURE__ */ j("g", { className: m(M.series, $?.series), children: [
2424
2425
  /* @__PURE__ */ s(
2425
2426
  "path",
2426
2427
  {
2427
- className: w.areaPath,
2428
- d: me,
2429
- fill: G,
2428
+ className: M.areaPath,
2429
+ d: fe,
2430
+ fill: Y,
2430
2431
  fillOpacity: I
2431
2432
  }
2432
2433
  ),
2433
- /* @__PURE__ */ s("path", { className: w.linePath, d: St(P, c), stroke: ee.color }),
2434
- !q && P.map((Q, T) => /* @__PURE__ */ s(
2434
+ /* @__PURE__ */ s("path", { className: M.linePath, d: Rt(D, c), stroke: te.color }),
2435
+ !V && D.map((Q, T) => /* @__PURE__ */ s(
2435
2436
  "circle",
2436
2437
  {
2437
- className: m(w.point, $?.point),
2438
+ className: m(M.point, $?.point),
2438
2439
  cx: Q.x,
2439
2440
  cy: Q.y,
2440
- r: R === T ? 5 : 3,
2441
- fill: ee.color
2441
+ r: S === T ? 5 : 3,
2442
+ fill: te.color
2442
2443
  },
2443
- `${p}-${T}`
2444
+ `${g}-${T}`
2444
2445
  ))
2445
- ] }, p);
2446
+ ] }, g);
2446
2447
  }),
2447
- R !== null && /* @__PURE__ */ s(
2448
+ S !== null && /* @__PURE__ */ s(
2448
2449
  "line",
2449
2450
  {
2450
- className: w.cursorLine,
2451
- x1: E(b[R]),
2452
- x2: E(b[R]),
2451
+ className: M.cursorLine,
2452
+ x1: k(ee[S]),
2453
+ x2: k(ee[S]),
2453
2454
  y1: B,
2454
2455
  y2: _
2455
2456
  }
@@ -2457,16 +2458,16 @@ function Fl({
2457
2458
  /* @__PURE__ */ s(
2458
2459
  "rect",
2459
2460
  {
2460
- className: w.interactionLayer,
2461
- x: g,
2461
+ className: M.interactionLayer,
2462
+ x: y,
2462
2463
  y: B,
2463
- width: J,
2464
- height: Y,
2465
- onMouseMove: (p) => {
2466
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + g, P = E.step(), G = Math.max(0, Math.min(e.length - 1, Math.round((ee - g - P / 2) / P)));
2467
- te(G);
2464
+ width: q,
2465
+ height: U,
2466
+ onMouseMove: (g) => {
2467
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left + y, D = k.step(), Y = Math.max(0, Math.min(e.length - 1, Math.round((te - y - D / 2) / D)));
2468
+ re(Y);
2468
2469
  },
2469
- onMouseLeave: () => te(null)
2470
+ onMouseLeave: () => re(null)
2470
2471
  }
2471
2472
  )
2472
2473
  ] });
@@ -2506,177 +2507,177 @@ function zl({
2506
2507
  showGrid: u = !0,
2507
2508
  showLegend: d = !0,
2508
2509
  showTooltip: f = !0,
2509
- showValues: y = !1,
2510
+ showValues: p = !1,
2510
2511
  valuePosition: L = "outside",
2511
- renderLabel: v,
2512
- colorBy: S = "series",
2513
- colors: N = jc,
2514
- negativeColor: D,
2515
- activeIndex: j,
2516
- onBarClick: Z,
2517
- yTickCount: U = 5,
2512
+ renderLabel: b,
2513
+ colorBy: R = "series",
2514
+ colors: w = jc,
2515
+ negativeColor: J,
2516
+ activeIndex: W,
2517
+ onBarClick: E,
2518
+ yTickCount: Z = 5,
2518
2519
  yFormat: C,
2519
2520
  xFormat: $,
2520
- valueFormat: oe,
2521
- renderTooltip: ce,
2522
- margin: q,
2521
+ valueFormat: ie,
2522
+ renderTooltip: ne,
2523
+ margin: V,
2523
2524
  emptyMessage: ae = "No data",
2524
- className: R,
2525
- style: te,
2526
- classes: H
2525
+ className: S,
2526
+ style: re,
2527
+ classes: F
2527
2528
  }) {
2528
- const O = r === "horizontal", A = { ...O ? _c : Xc, ...q }, F = ke(() => Object.keys(n), [n]), ne = o && F.length > 1, [pe, K] = Le(null), X = re(null);
2529
+ const X = r === "horizontal", A = { ...X ? _c : Xc, ...V }, z = ke(() => Object.keys(n), [n]), ce = o && z.length > 1, [me, K] = Le(null), H = oe(null);
2529
2530
  if (e.length === 0)
2530
- return /* @__PURE__ */ s("div", { ref: X, className: m(w.root, H?.root, R), style: te, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: ae }) }) });
2531
- const M = e.map((E) => String(E[t])), g = j ?? pe, k = ke(() => {
2532
- if (ne) {
2533
- let he = 0, ye = 0;
2531
+ return /* @__PURE__ */ s("div", { ref: H, className: m(M.root, F?.root, S), style: re, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: ae }) }) });
2532
+ const N = e.map((k) => String(k[t])), y = W ?? me, v = ke(() => {
2533
+ if (ce) {
2534
+ let le = 0, ge = 0;
2534
2535
  for (const be of e) {
2535
- let Ce = 0, Se = 0;
2536
- for (const p of F) {
2537
- const x = be[p];
2538
- typeof x == "number" && (x >= 0 ? Ce += x : Se += x);
2536
+ let Ce = 0, Re = 0;
2537
+ for (const g of z) {
2538
+ const x = be[g];
2539
+ typeof x == "number" && (x >= 0 ? Ce += x : Re += x);
2539
2540
  }
2540
- Ce > he && (he = Ce), Se < ye && (ye = Se);
2541
+ Ce > le && (le = Ce), Re < ge && (ge = Re);
2541
2542
  }
2542
- return [ye, he];
2543
+ return [ge, le];
2543
2544
  }
2544
- const E = [];
2545
- for (const he of e)
2546
- for (const ye of F) {
2547
- const be = he[ye];
2548
- typeof be == "number" && E.push(be);
2545
+ const k = [];
2546
+ for (const le of e)
2547
+ for (const ge of z) {
2548
+ const be = le[ge];
2549
+ typeof be == "number" && k.push(be);
2549
2550
  }
2550
- const [V, de] = bt(E);
2551
- return [Math.min(0, V), Math.max(0, de)];
2552
- }, [e, F, ne]), B = qe(k[0], k[1], U), _ = B[0], J = B[B.length - 1], Y = (E, V) => S === "index" ? N[V % N.length] : n[E]?.color ?? N[0], b = f && g !== null && e[g] ? /* @__PURE__ */ s(
2551
+ const [G, O] = bt(k);
2552
+ return [Math.min(0, G), Math.max(0, O)];
2553
+ }, [e, z, ce]), B = qe(v[0], v[1], Z), _ = B[0], q = B[B.length - 1], U = (k, G) => R === "index" ? w[G % w.length] : n[k]?.color ?? w[0], ee = f && y !== null && e[y] ? /* @__PURE__ */ s(
2553
2554
  et,
2554
2555
  {
2555
- row: e[g],
2556
- x: Vc(e, t, A, g, X, O, l),
2557
- y: O ? qc(e, t, A, g, X, l) : 16,
2558
- containerWidth: X.current?.getBoundingClientRect().width ?? 0,
2556
+ row: e[y],
2557
+ x: Vc(e, t, A, y, H, X, l),
2558
+ y: X ? qc(e, t, A, y, H, l) : 16,
2559
+ containerWidth: H.current?.getBoundingClientRect().width ?? 0,
2559
2560
  config: n,
2560
- render: ce ? () => ce(e[g]) : void 0,
2561
- valueFormat: oe,
2561
+ render: ne ? () => ne(e[y]) : void 0,
2562
+ valueFormat: ie,
2562
2563
  titleKey: t,
2563
- resolveColor: (E) => {
2564
- const V = e[g][E], de = Y(E, g);
2565
- return typeof V != "number" ? de : D !== void 0 && V < 0 ? D : de;
2564
+ resolveColor: (k) => {
2565
+ const G = e[y][k], O = U(k, y);
2566
+ return typeof G != "number" ? O : J !== void 0 && G < 0 ? J : O;
2566
2567
  },
2567
- classes: H
2568
+ classes: F
2568
2569
  }
2569
2570
  ) : null;
2570
2571
  return /* @__PURE__ */ s(
2571
2572
  Ve,
2572
2573
  {
2573
- ref: X,
2574
+ ref: H,
2574
2575
  aspectRatio: c,
2575
2576
  height: i,
2576
- className: R,
2577
- style: te,
2578
- classes: H,
2579
- legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: H }) : void 0,
2580
- overlay: b,
2581
- children: ({ width: E, height: V }) => {
2582
- const de = A.left, he = E - A.right, ye = A.top, be = V - A.bottom, Ce = Math.max(0, he - de), Se = Math.max(0, be - ye), x = Xe(M, O ? [ye, be] : [de, he], l), ee = x.bandWidth(), G = Je([_, J], O ? [de, he] : [be, ye]), I = G(0), me = ne ? 1 : Math.max(1, F.length), Q = ee / me, T = Q * (1 - a), le = B.map((ie) => ({
2583
- value: ie,
2584
- pos: G(ie)
2585
- })), ge = Uc(M);
2586
- return /* @__PURE__ */ z(je, { children: [
2587
- u && /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(
2588
- ({ value: ie, pos: ue }) => O ? /* @__PURE__ */ s(
2577
+ className: S,
2578
+ style: re,
2579
+ classes: F,
2580
+ legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: F }) : void 0,
2581
+ overlay: ee,
2582
+ children: ({ width: k, height: G }) => {
2583
+ const O = A.left, le = k - A.right, ge = A.top, be = G - A.bottom, Ce = Math.max(0, le - O), Re = Math.max(0, be - ge), x = Xe(N, X ? [ge, be] : [O, le], l), te = x.bandWidth(), Y = Je([_, q], X ? [O, le] : [be, ge]), I = Y(0), fe = ce ? 1 : Math.max(1, z.length), Q = te / fe, T = Q * (1 - a), de = B.map((se) => ({
2584
+ value: se,
2585
+ pos: Y(se)
2586
+ })), ye = Uc(N);
2587
+ return /* @__PURE__ */ j(je, { children: [
2588
+ u && /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: de.map(
2589
+ ({ value: se, pos: he }) => X ? /* @__PURE__ */ s(
2589
2590
  "line",
2590
2591
  {
2591
- className: m(w.gridLine, H?.grid),
2592
- x1: ue,
2593
- x2: ue,
2594
- y1: ye,
2592
+ className: m(M.gridLine, F?.grid),
2593
+ x1: he,
2594
+ x2: he,
2595
+ y1: ge,
2595
2596
  y2: be
2596
2597
  },
2597
- `g-${ie}`
2598
+ `g-${se}`
2598
2599
  ) : /* @__PURE__ */ s(
2599
2600
  "line",
2600
2601
  {
2601
- className: m(w.gridLine, H?.grid),
2602
- x1: de,
2603
- x2: he,
2604
- y1: ue,
2605
- y2: ue
2602
+ className: m(M.gridLine, F?.grid),
2603
+ x1: O,
2604
+ x2: le,
2605
+ y1: he,
2606
+ y2: he
2606
2607
  },
2607
- `g-${ie}`
2608
+ `g-${se}`
2608
2609
  )
2609
2610
  ) }),
2610
- /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(({ value: ie, pos: ue }) => {
2611
- const Ae = C ? C(ie) : String(ie);
2612
- return O ? /* @__PURE__ */ s(
2611
+ /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: de.map(({ value: se, pos: he }) => {
2612
+ const Ae = C ? C(se) : String(se);
2613
+ return X ? /* @__PURE__ */ s(
2613
2614
  "text",
2614
2615
  {
2615
- className: m(w.axisLabel, H?.axisLabel),
2616
- x: ue,
2616
+ className: m(M.axisLabel, F?.axisLabel),
2617
+ x: he,
2617
2618
  y: be + 16,
2618
2619
  textAnchor: "middle",
2619
2620
  children: Ae
2620
2621
  },
2621
- `vt-${ie}`
2622
+ `vt-${se}`
2622
2623
  ) : /* @__PURE__ */ s(
2623
2624
  "text",
2624
2625
  {
2625
- className: m(w.axisLabel, H?.axisLabel),
2626
- x: de - 8,
2627
- y: ue,
2626
+ className: m(M.axisLabel, F?.axisLabel),
2627
+ x: O - 8,
2628
+ y: he,
2628
2629
  textAnchor: "end",
2629
2630
  dominantBaseline: "middle",
2630
2631
  children: Ae
2631
2632
  },
2632
- `vt-${ie}`
2633
+ `vt-${se}`
2633
2634
  );
2634
2635
  }) }),
2635
- /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: ge.map((ie) => {
2636
- const ue = x(ie), Ae = $ ? $(ie) : ie;
2637
- return O ? /* @__PURE__ */ s(
2636
+ /* @__PURE__ */ s("g", { className: m(M.axis, F?.axis), children: ye.map((se) => {
2637
+ const he = x(se), Ae = $ ? $(se) : se;
2638
+ return X ? /* @__PURE__ */ s(
2638
2639
  "text",
2639
2640
  {
2640
- className: m(w.axisLabel, H?.axisLabel),
2641
- x: de - 8,
2642
- y: ue,
2641
+ className: m(M.axisLabel, F?.axisLabel),
2642
+ x: O - 8,
2643
+ y: he,
2643
2644
  textAnchor: "end",
2644
2645
  dominantBaseline: "middle",
2645
2646
  children: Ae
2646
2647
  },
2647
- `c-${ie}`
2648
+ `c-${se}`
2648
2649
  ) : /* @__PURE__ */ s(
2649
2650
  "text",
2650
2651
  {
2651
- className: m(w.axisLabel, H?.axisLabel),
2652
- x: ue,
2652
+ className: m(M.axisLabel, F?.axisLabel),
2653
+ x: he,
2653
2654
  y: be + 16,
2654
2655
  textAnchor: "middle",
2655
2656
  children: Ae
2656
2657
  },
2657
- `c-${ie}`
2658
+ `c-${se}`
2658
2659
  );
2659
2660
  }) }),
2660
- e.map((ie, ue) => {
2661
- const De = x(M[ue]) - ee / 2;
2662
- let xe = 0, se = 0;
2663
- return /* @__PURE__ */ s("g", { className: m(w.series, H?.series), children: F.map((Ie, He) => {
2664
- const Ge = ie[Ie];
2661
+ e.map((se, he) => {
2662
+ const De = x(N[he]) - te / 2;
2663
+ let xe = 0, ue = 0;
2664
+ return /* @__PURE__ */ s("g", { className: m(M.series, F?.series), children: z.map((Ie, He) => {
2665
+ const Ge = se[Ie];
2665
2666
  if (typeof Ge != "number") return null;
2666
- const Ee = Ge, xt = Y(Ie, ue), kt = D !== void 0 && Ee < 0 ? D : xt, Oe = j !== void 0 ? j === ue : pe === ue, tt = j !== void 0 && !Oe;
2667
+ const Ee = Ge, xt = U(Ie, he), kt = J !== void 0 && Ee < 0 ? J : xt, Oe = W !== void 0 ? W === he : me === he, tt = W !== void 0 && !Oe;
2667
2668
  let nt, _e;
2668
- ne ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = se, _e = se + Ee, se = _e) : (nt = 0, _e = Ee);
2669
- const rt = G(nt), ot = G(_e), Bt = ne ? (ee - T) / 2 : He * Q + (Q - T) / 2;
2669
+ ce ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = ue, _e = ue + Ee, ue = _e) : (nt = 0, _e = Ee);
2670
+ const rt = Y(nt), ot = Y(_e), Bt = ce ? (te - T) / 2 : He * Q + (Q - T) / 2;
2670
2671
  let it = 0, ct = 0, lt = 0, st = 0;
2671
- if (O) {
2672
+ if (X) {
2672
2673
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2673
2674
  it = Ze, lt = wt - Ze, ct = De + Bt, st = T;
2674
2675
  } else {
2675
2676
  const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2676
2677
  it = De + Bt, lt = T, ct = Ze, st = wt - Ze;
2677
2678
  }
2678
- const Mt = v ? v({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : y ? oe ? oe(Ee) : String(Ee) : null, Fe = Yc({
2679
- isHorizontal: O,
2679
+ const Mt = b ? b({ row: se, value: Ee, seriesKey: Ie, index: he }) : p ? ie ? ie(Ee) : String(Ee) : null, Fe = Yc({
2680
+ isHorizontal: X,
2680
2681
  valuePosition: L,
2681
2682
  x: it,
2682
2683
  y: ct,
@@ -2684,14 +2685,14 @@ function zl({
2684
2685
  rectH: st,
2685
2686
  value: Ee
2686
2687
  });
2687
- return /* @__PURE__ */ z("g", { children: [
2688
+ return /* @__PURE__ */ j("g", { children: [
2688
2689
  /* @__PURE__ */ s(
2689
2690
  "rect",
2690
2691
  {
2691
2692
  className: m(
2692
- w.bar,
2693
- Oe && w.activeBar,
2694
- H?.point
2693
+ M.bar,
2694
+ Oe && M.activeBar,
2695
+ F?.point
2695
2696
  ),
2696
2697
  x: it,
2697
2698
  y: ct,
@@ -2701,16 +2702,16 @@ function zl({
2701
2702
  ry: h,
2702
2703
  fill: kt,
2703
2704
  opacity: tt ? 0.35 : 1,
2704
- onClick: Z ? () => Z({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : void 0,
2705
- style: Z ? { cursor: "pointer" } : void 0
2705
+ onClick: E ? () => E({ row: se, value: Ee, seriesKey: Ie, index: he }) : void 0,
2706
+ style: E ? { cursor: "pointer" } : void 0
2706
2707
  }
2707
2708
  ),
2708
2709
  Mt != null && /* @__PURE__ */ s(
2709
2710
  "text",
2710
2711
  {
2711
2712
  className: m(
2712
- w.axisLabel,
2713
- (L === "inside" || L === "inside-start") && w.barLabelInside
2713
+ M.axisLabel,
2714
+ (L === "inside" || L === "inside-start") && M.barLabelInside
2714
2715
  ),
2715
2716
  x: Fe.x,
2716
2717
  y: Fe.y,
@@ -2722,31 +2723,31 @@ function zl({
2722
2723
  }
2723
2724
  )
2724
2725
  ] }, Ie);
2725
- }) }, `group-${ue}`);
2726
+ }) }, `group-${he}`);
2726
2727
  }),
2727
- _ < 0 && J > 0 && /* @__PURE__ */ s(
2728
+ _ < 0 && q > 0 && /* @__PURE__ */ s(
2728
2729
  "line",
2729
2730
  {
2730
- className: m(w.gridLine),
2731
- x1: O ? I : de,
2732
- x2: O ? I : he,
2733
- y1: O ? ye : I,
2734
- y2: O ? be : I,
2731
+ className: m(M.gridLine),
2732
+ x1: X ? I : O,
2733
+ x2: X ? I : le,
2734
+ y1: X ? ge : I,
2735
+ y2: X ? be : I,
2735
2736
  opacity: 0.9
2736
2737
  }
2737
2738
  ),
2738
2739
  /* @__PURE__ */ s(
2739
2740
  "rect",
2740
2741
  {
2741
- className: w.interactionLayer,
2742
- x: de,
2743
- y: ye,
2742
+ className: M.interactionLayer,
2743
+ x: O,
2744
+ y: ge,
2744
2745
  width: Ce,
2745
- height: Se,
2746
- onMouseMove: (ie) => {
2747
- const ue = ie.currentTarget.getBoundingClientRect(), Ae = ie.clientX - ue.left + de, De = ie.clientY - ue.top + ye, xe = x.step(), se = O ? De - ye : Ae - de, Ie = Math.max(
2746
+ height: Re,
2747
+ onMouseMove: (se) => {
2748
+ const he = se.currentTarget.getBoundingClientRect(), Ae = se.clientX - he.left + O, De = se.clientY - he.top + ge, xe = x.step(), ue = X ? De - ge : Ae - O, Ie = Math.max(
2748
2749
  0,
2749
- Math.min(e.length - 1, Math.round((se - xe / 2) / xe))
2750
+ Math.min(e.length - 1, Math.round((ue - xe / 2) / xe))
2750
2751
  );
2751
2752
  K(Ie);
2752
2753
  },
@@ -2852,12 +2853,12 @@ function Zc(e, t, n, r, o, c) {
2852
2853
  ].join(" ");
2853
2854
  const i = (o - 90) * Math.PI / 180, l = (c - 90) * Math.PI / 180, a = c - o > 180 ? 1 : 0, h = e + n * Math.cos(i), u = t + n * Math.sin(i), d = e + n * Math.cos(l), f = t + n * Math.sin(l);
2854
2855
  if (r > 0) {
2855
- const y = e + r * Math.cos(l), L = t + r * Math.sin(l), v = e + r * Math.cos(i), S = t + r * Math.sin(i);
2856
+ const p = e + r * Math.cos(l), L = t + r * Math.sin(l), b = e + r * Math.cos(i), R = t + r * Math.sin(i);
2856
2857
  return [
2857
2858
  `M ${h} ${u}`,
2858
2859
  `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2859
- `L ${y} ${L}`,
2860
- `A ${r} ${r} 0 ${a} 0 ${v} ${S}`,
2860
+ `L ${p} ${L}`,
2861
+ `A ${r} ${r} 0 ${a} 0 ${b} ${R}`,
2861
2862
  "Z"
2862
2863
  ].join(" ");
2863
2864
  }
@@ -2886,121 +2887,121 @@ function jl({
2886
2887
  strokeColor: u = "var(--crk-color-bg)",
2887
2888
  padAngle: d = 0,
2888
2889
  showLabels: f = !1,
2889
- valuePosition: y = "outside",
2890
+ valuePosition: p = "outside",
2890
2891
  showLabelLines: L = !0,
2891
- renderLabel: v,
2892
- centerLabel: S,
2893
- activeIndex: N,
2894
- onSliceClick: D,
2895
- showLegend: j = !0,
2896
- showTooltip: Z = !0,
2897
- valueFormat: U,
2892
+ renderLabel: b,
2893
+ centerLabel: R,
2894
+ activeIndex: w,
2895
+ onSliceClick: J,
2896
+ showLegend: W = !0,
2897
+ showTooltip: E = !0,
2898
+ valueFormat: Z,
2898
2899
  renderTooltip: C,
2899
2900
  emptyMessage: $ = "No data",
2900
- className: oe,
2901
- style: ce,
2902
- classes: q
2901
+ className: ie,
2902
+ style: ne,
2903
+ classes: V
2903
2904
  }) {
2904
- const [ae, R] = Le(null), te = re(null), H = N ?? ae, O = (K) => {
2905
+ const [ae, S] = Le(null), re = oe(null), F = w ?? ae, X = (K) => {
2905
2906
  if (r) {
2906
- const X = e[K]?.[r];
2907
- if (typeof X == "string") return X;
2907
+ const H = e[K]?.[r];
2908
+ if (typeof H == "string") return H;
2908
2909
  }
2909
2910
  return o[K % o.length];
2910
2911
  }, A = ke(() => {
2911
2912
  let K = 0;
2912
- for (const X of e) {
2913
- const M = X[t];
2914
- typeof M == "number" && M > 0 && (K += M);
2913
+ for (const H of e) {
2914
+ const N = H[t];
2915
+ typeof N == "number" && N > 0 && (K += N);
2915
2916
  }
2916
2917
  return K;
2917
2918
  }, [e, t]);
2918
2919
  if (e.length === 0 || A === 0)
2919
- return /* @__PURE__ */ s("div", { ref: te, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2920
- const F = ke(() => {
2920
+ return /* @__PURE__ */ s("div", { ref: re, className: m(M.root, V?.root, ie), style: ne, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: $ }) }) });
2921
+ const z = ke(() => {
2921
2922
  const K = [];
2922
- let X = 0;
2923
- for (let M = 0; M < e.length; M++) {
2924
- const g = e[M], k = g[t], B = typeof k == "number" && k > 0 ? k : 0;
2923
+ let H = 0;
2924
+ for (let N = 0; N < e.length; N++) {
2925
+ const y = e[N], v = y[t], B = typeof v == "number" && v > 0 ? v : 0;
2925
2926
  if (B === 0) continue;
2926
- const _ = B / A, J = _ * 360;
2927
- K.push({ index: M, row: g, value: B, start: X, end: X + J, fraction: _ }), X += J;
2927
+ const _ = B / A, q = _ * 360;
2928
+ K.push({ index: N, row: y, value: B, start: H, end: H + q, fraction: _ }), H += q;
2928
2929
  }
2929
2930
  return K;
2930
- }, [e, t, A]), ne = j ? /* @__PURE__ */ s("div", { className: m(w.legend, q?.legend), role: "list", children: F.map((K) => /* @__PURE__ */ z("div", { className: m(w.legendItem, q?.legendItem), role: "listitem", children: [
2931
+ }, [e, t, A]), ce = W ? /* @__PURE__ */ s("div", { className: m(M.legend, V?.legend), role: "list", children: z.map((K) => /* @__PURE__ */ j("div", { className: m(M.legendItem, V?.legendItem), role: "listitem", children: [
2931
2932
  /* @__PURE__ */ s(
2932
2933
  "span",
2933
2934
  {
2934
- className: w.legendSwatch,
2935
- style: { background: O(K.index) },
2935
+ className: M.legendSwatch,
2936
+ style: { background: X(K.index) },
2936
2937
  "aria-hidden": "true"
2937
2938
  }
2938
2939
  ),
2939
- /* @__PURE__ */ s("span", { className: w.legendLabel, children: String(K.row[n]) })
2940
- ] }, K.index)) }) : void 0, pe = ke(() => {
2940
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: String(K.row[n]) })
2941
+ ] }, K.index)) }) : void 0, me = ke(() => {
2941
2942
  const K = {};
2942
- for (const X of F)
2943
- K[X.index.toString()] = {
2944
- label: String(X.row[n]),
2945
- color: O(X.index)
2943
+ for (const H of z)
2944
+ K[H.index.toString()] = {
2945
+ label: String(H.row[n]),
2946
+ color: X(H.index)
2946
2947
  };
2947
2948
  return K;
2948
- }, [F]);
2949
+ }, [z]);
2949
2950
  return /* @__PURE__ */ s(
2950
2951
  Ve,
2951
2952
  {
2952
- ref: te,
2953
+ ref: re,
2953
2954
  aspectRatio: c,
2954
2955
  height: i,
2955
- className: oe,
2956
- style: ce,
2957
- classes: q,
2958
- legend: ne,
2959
- overlay: Z && H !== null && e[H] ? /* @__PURE__ */ s(
2956
+ className: ie,
2957
+ style: ne,
2958
+ classes: V,
2959
+ legend: ce,
2960
+ overlay: E && F !== null && e[F] ? /* @__PURE__ */ s(
2960
2961
  et,
2961
2962
  {
2962
- row: { [H.toString()]: e[H][t] },
2963
- x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
2963
+ row: { [F.toString()]: e[F][t] },
2964
+ x: re.current ? re.current.getBoundingClientRect().width / 2 : 0,
2964
2965
  y: 16,
2965
- containerWidth: te.current?.getBoundingClientRect().width ?? 0,
2966
- config: { [H.toString()]: pe[H.toString()] },
2967
- render: C ? () => C(e[H]) : void 0,
2968
- valueFormat: U,
2966
+ containerWidth: re.current?.getBoundingClientRect().width ?? 0,
2967
+ config: { [F.toString()]: me[F.toString()] },
2968
+ render: C ? () => C(e[F]) : void 0,
2969
+ valueFormat: Z,
2969
2970
  titleKey: void 0,
2970
- classes: q
2971
+ classes: V
2971
2972
  }
2972
2973
  ) : null,
2973
- children: ({ width: K, height: X }) => {
2974
- const M = K / 2, g = X / 2, k = Math.min(K, X) / 2 - 4, B = Et(a, k), _ = Math.min(B - 1, Et(l, k)), J = Math.max(4, B * 0.06);
2975
- return /* @__PURE__ */ z(je, { children: [
2976
- /* @__PURE__ */ s("g", { children: F.map((Y) => {
2977
- const b = d / 2, E = Math.min(Y.end, Y.start + b), V = Math.max(Y.start, Y.end - b), de = O(Y.index), he = H === Y.index, ye = N !== void 0 && !he, be = he && N !== void 0 ? B + J : B, Ce = Zc(M, g, be, _, E, V), Se = D ? () => D({ row: Y.row, value: Y.value, index: Y.index }) : void 0;
2974
+ children: ({ width: K, height: H }) => {
2975
+ const N = K / 2, y = H / 2, v = Math.min(K, H) / 2 - 4, B = Et(a, v), _ = Math.min(B - 1, Et(l, v)), q = Math.max(4, B * 0.06);
2976
+ return /* @__PURE__ */ j(je, { children: [
2977
+ /* @__PURE__ */ s("g", { children: z.map((U) => {
2978
+ const ee = d / 2, k = Math.min(U.end, U.start + ee), G = Math.max(U.start, U.end - ee), O = X(U.index), le = F === U.index, ge = w !== void 0 && !le, be = le && w !== void 0 ? B + q : B, Ce = Zc(N, y, be, _, k, G), Re = J ? () => J({ row: U.row, value: U.value, index: U.index }) : void 0;
2978
2979
  return /* @__PURE__ */ s(
2979
2980
  "path",
2980
2981
  {
2981
2982
  d: Ce,
2982
- fill: de,
2983
+ fill: O,
2983
2984
  stroke: h > 0 ? u : "none",
2984
2985
  strokeWidth: h,
2985
- opacity: ye ? 0.45 : 1,
2986
- onMouseEnter: () => R(Y.index),
2987
- onMouseLeave: () => R(null),
2988
- onClick: Se,
2989
- style: Se ? { cursor: "pointer" } : void 0
2986
+ opacity: ge ? 0.45 : 1,
2987
+ onMouseEnter: () => S(U.index),
2988
+ onMouseLeave: () => S(null),
2989
+ onClick: Re,
2990
+ style: Re ? { cursor: "pointer" } : void 0
2990
2991
  },
2991
- Y.index
2992
+ U.index
2992
2993
  );
2993
2994
  }) }),
2994
- (f || v) && F.map((Y) => {
2995
- const b = v ? v({ row: Y.row, value: Y.value, fraction: Y.fraction, index: Y.index }) : f ? `${String(Y.row[n])} ${U ? U(Y.value) : Math.round(Y.fraction * 100) + "%"}` : null;
2996
- if (b == null) return null;
2997
- const E = y === "inside", V = Math.max(16, B * 0.12), de = E ? (B + _) / 2 : B + V, he = Pt(M, g, de, Y.start, Y.end), ye = E ? "middle" : he.x < M - 1 ? "end" : he.x > M + 1 ? "start" : "middle";
2995
+ (f || b) && z.map((U) => {
2996
+ const ee = b ? b({ row: U.row, value: U.value, fraction: U.fraction, index: U.index }) : f ? `${String(U.row[n])} ${Z ? Z(U.value) : Math.round(U.fraction * 100) + "%"}` : null;
2997
+ if (ee == null) return null;
2998
+ const k = p === "inside", G = Math.max(16, B * 0.12), O = k ? (B + _) / 2 : B + G, le = Pt(N, y, O, U.start, U.end), ge = k ? "middle" : le.x < N - 1 ? "end" : le.x > N + 1 ? "start" : "middle";
2998
2999
  let be = null;
2999
- if (!E && L) {
3000
- const Ce = Pt(M, g, B, Y.start, Y.end), Se = 4, p = ye === "end" ? Se : ye === "start" ? -Se : 0;
3001
- be = { x1: Ce.x, y1: Ce.y, x2: he.x + p, y2: he.y };
3000
+ if (!k && L) {
3001
+ const Ce = Pt(N, y, B, U.start, U.end), Re = 4, g = ge === "end" ? Re : ge === "start" ? -Re : 0;
3002
+ be = { x1: Ce.x, y1: Ce.y, x2: le.x + g, y2: le.y };
3002
3003
  }
3003
- return /* @__PURE__ */ z("g", { children: [
3004
+ return /* @__PURE__ */ j("g", { children: [
3004
3005
  be && /* @__PURE__ */ s(
3005
3006
  "line",
3006
3007
  {
@@ -3008,7 +3009,7 @@ function jl({
3008
3009
  y1: be.y1,
3009
3010
  x2: be.x2,
3010
3011
  y2: be.y2,
3011
- stroke: O(Y.index),
3012
+ stroke: X(U.index),
3012
3013
  strokeWidth: 1,
3013
3014
  opacity: 0.7
3014
3015
  }
@@ -3016,24 +3017,24 @@ function jl({
3016
3017
  /* @__PURE__ */ s(
3017
3018
  "text",
3018
3019
  {
3019
- x: he.x,
3020
- y: he.y,
3020
+ x: le.x,
3021
+ y: le.y,
3021
3022
  className: m(
3022
- w.axisLabel,
3023
- E && w.barLabelInside
3023
+ M.axisLabel,
3024
+ k && M.barLabelInside
3024
3025
  ),
3025
- textAnchor: ye,
3026
+ textAnchor: ge,
3026
3027
  dominantBaseline: "middle",
3027
- children: b
3028
+ children: ee
3028
3029
  }
3029
3030
  )
3030
- ] }, `label-${Y.index}`);
3031
+ ] }, `label-${U.index}`);
3031
3032
  }),
3032
- S !== void 0 && /* @__PURE__ */ s(
3033
+ R !== void 0 && /* @__PURE__ */ s(
3033
3034
  "foreignObject",
3034
3035
  {
3035
- x: M - _,
3036
- y: g - _,
3036
+ x: N - _,
3037
+ y: y - _,
3037
3038
  width: Math.max(0, _ * 2),
3038
3039
  height: Math.max(0, _ * 2),
3039
3040
  style: { pointerEvents: "none" },
@@ -3051,7 +3052,7 @@ function jl({
3051
3052
  color: "var(--crk-color-text)",
3052
3053
  fontFamily: "var(--crk-font-family)"
3053
3054
  },
3054
- children: S
3055
+ children: R
3055
3056
  }
3056
3057
  )
3057
3058
  }
@@ -3085,185 +3086,185 @@ function Xl({
3085
3086
  levels: u = 5,
3086
3087
  showPoints: d = !0,
3087
3088
  fillOpacity: f = 0.4,
3088
- strokeWidth: y = 2,
3089
+ strokeWidth: p = 2,
3089
3090
  renderAxisLabel: L,
3090
- axisFormat: v,
3091
- valueFormat: S,
3092
- renderTooltip: N,
3093
- showLegend: D = !0,
3094
- showTooltip: j = !0,
3095
- emptyMessage: Z = "No data",
3096
- className: U,
3091
+ axisFormat: b,
3092
+ valueFormat: R,
3093
+ renderTooltip: w,
3094
+ showLegend: J = !0,
3095
+ showTooltip: W = !0,
3096
+ emptyMessage: E = "No data",
3097
+ className: Z,
3097
3098
  style: C,
3098
3099
  classes: $
3099
3100
  }) {
3100
- const [oe, ce] = Le(null), q = re(null), ae = ke(() => Object.keys(n), [n]);
3101
+ const [ie, ne] = Le(null), V = oe(null), ae = ke(() => Object.keys(n), [n]);
3101
3102
  if (e.length === 0)
3102
- return /* @__PURE__ */ s("div", { ref: q, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
3103
- const R = ke(
3104
- () => e.map((A, F) => F / e.length * 360),
3103
+ return /* @__PURE__ */ s("div", { ref: V, className: m(M.root, $?.root, Z), style: C, children: /* @__PURE__ */ s("div", { className: M.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: M.empty, children: E }) }) });
3104
+ const S = ke(
3105
+ () => e.map((A, z) => z / e.length * 360),
3105
3106
  [e]
3106
- ), te = ke(() => {
3107
+ ), re = ke(() => {
3107
3108
  const A = [];
3108
- for (const ne of ae)
3109
- for (const pe of e) {
3110
- const K = pe[ne];
3109
+ for (const ce of ae)
3110
+ for (const me of e) {
3111
+ const K = me[ce];
3111
3112
  typeof K == "number" && A.push(K);
3112
3113
  }
3113
- const [, F] = bt(A);
3114
- return Math.max(1, F);
3115
- }, [e, ae]), H = ke(() => qe(0, te, u).filter((F) => F > 0), [te, u]), O = H[H.length - 1] ?? te;
3114
+ const [, z] = bt(A);
3115
+ return Math.max(1, z);
3116
+ }, [e, ae]), F = ke(() => qe(0, re, u).filter((z) => z > 0), [re, u]), X = F[F.length - 1] ?? re;
3116
3117
  return /* @__PURE__ */ s(
3117
3118
  Ve,
3118
3119
  {
3119
- ref: q,
3120
+ ref: V,
3120
3121
  aspectRatio: r,
3121
3122
  height: o,
3122
- className: U,
3123
+ className: Z,
3123
3124
  style: C,
3124
3125
  classes: $,
3125
- legend: D ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3126
- overlay: j && oe !== null ? /* @__PURE__ */ s(
3126
+ legend: J ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3127
+ overlay: W && ie !== null ? /* @__PURE__ */ s(
3127
3128
  et,
3128
3129
  {
3129
- row: e[oe],
3130
- x: (q.current?.getBoundingClientRect().width ?? 0) / 2,
3130
+ row: e[ie],
3131
+ x: (V.current?.getBoundingClientRect().width ?? 0) / 2,
3131
3132
  y: 16,
3132
- containerWidth: q.current?.getBoundingClientRect().width ?? 0,
3133
+ containerWidth: V.current?.getBoundingClientRect().width ?? 0,
3133
3134
  config: n,
3134
- render: N ? () => N(e[oe]) : void 0,
3135
- valueFormat: S,
3135
+ render: w ? () => w(e[ie]) : void 0,
3136
+ valueFormat: R,
3136
3137
  titleKey: t,
3137
3138
  classes: $
3138
3139
  }
3139
3140
  ) : null,
3140
- children: ({ width: A, height: F }) => {
3141
- const ne = a ? 32 : 8, pe = A / 2, K = F / 2, X = Math.max(0, Math.min(A, F) / 2 - ne), M = (g) => Math.max(0, g) / O * X;
3142
- return /* @__PURE__ */ z(je, { children: [
3143
- i && H.map((g) => {
3144
- const k = M(g);
3141
+ children: ({ width: A, height: z }) => {
3142
+ const ce = a ? 32 : 8, me = A / 2, K = z / 2, H = Math.max(0, Math.min(A, z) / 2 - ce), N = (y) => Math.max(0, y) / X * H;
3143
+ return /* @__PURE__ */ j(je, { children: [
3144
+ i && F.map((y) => {
3145
+ const v = N(y);
3145
3146
  return c === "circle" ? /* @__PURE__ */ s(
3146
3147
  "circle",
3147
3148
  {
3148
- className: m(w.gridLine, $?.grid),
3149
- cx: pe,
3149
+ className: m(M.gridLine, $?.grid),
3150
+ cx: me,
3150
3151
  cy: K,
3151
- r: k,
3152
+ r: v,
3152
3153
  fill: "none"
3153
3154
  },
3154
- `ring-${g}`
3155
+ `ring-${y}`
3155
3156
  ) : /* @__PURE__ */ s(
3156
3157
  "polygon",
3157
3158
  {
3158
- className: m(w.gridLine, $?.grid),
3159
- points: Kc(pe, K, k, R),
3159
+ className: m(M.gridLine, $?.grid),
3160
+ points: Kc(me, K, v, S),
3160
3161
  fill: "none"
3161
3162
  },
3162
- `ring-${g}`
3163
+ `ring-${y}`
3163
3164
  );
3164
3165
  }),
3165
- l && R.map((g, k) => {
3166
- const B = mt(pe, K, X, g);
3166
+ l && S.map((y, v) => {
3167
+ const B = mt(me, K, H, y);
3167
3168
  return /* @__PURE__ */ s(
3168
3169
  "line",
3169
3170
  {
3170
- className: m(w.gridLine, $?.grid),
3171
- x1: pe,
3171
+ className: m(M.gridLine, $?.grid),
3172
+ x1: me,
3172
3173
  y1: K,
3173
3174
  x2: B.x,
3174
3175
  y2: B.y
3175
3176
  },
3176
- `spoke-${k}`
3177
+ `spoke-${v}`
3177
3178
  );
3178
3179
  }),
3179
- h && H.map((g) => {
3180
- const k = M(g);
3180
+ h && F.map((y) => {
3181
+ const v = N(y);
3181
3182
  return /* @__PURE__ */ s(
3182
3183
  "text",
3183
3184
  {
3184
- className: m(w.axisLabel, $?.axisLabel),
3185
- x: pe + 4,
3186
- y: K - k,
3185
+ className: m(M.axisLabel, $?.axisLabel),
3186
+ x: me + 4,
3187
+ y: K - v,
3187
3188
  textAnchor: "start",
3188
3189
  dominantBaseline: "middle",
3189
- children: S ? S(g) : g
3190
+ children: R ? R(y) : y
3190
3191
  },
3191
- `raxis-${g}`
3192
+ `raxis-${y}`
3192
3193
  );
3193
3194
  }),
3194
- a && e.map((g, k) => {
3195
- const B = R[k], _ = mt(pe, K, X + 14, B), J = _.x < pe - 1 ? "end" : _.x > pe + 1 ? "start" : "middle";
3195
+ a && e.map((y, v) => {
3196
+ const B = S[v], _ = mt(me, K, H + 14, B), q = _.x < me - 1 ? "end" : _.x > me + 1 ? "start" : "middle";
3196
3197
  if (L)
3197
3198
  return /* @__PURE__ */ s("g", { children: L({
3198
- row: g,
3199
- index: k,
3199
+ row: y,
3200
+ index: v,
3200
3201
  angle: B,
3201
3202
  x: _.x,
3202
3203
  y: _.y,
3203
- textAnchor: J
3204
- }) }, `label-${k}`);
3205
- const Y = String(g[t]), b = v ? v(Y) : Y;
3204
+ textAnchor: q
3205
+ }) }, `label-${v}`);
3206
+ const U = String(y[t]), ee = b ? b(U) : U;
3206
3207
  return /* @__PURE__ */ s(
3207
3208
  "text",
3208
3209
  {
3209
- className: m(w.axisLabel, $?.axisLabel),
3210
+ className: m(M.axisLabel, $?.axisLabel),
3210
3211
  x: _.x,
3211
3212
  y: _.y,
3212
- textAnchor: J,
3213
+ textAnchor: q,
3213
3214
  dominantBaseline: "middle",
3214
- children: b
3215
+ children: ee
3215
3216
  },
3216
- `label-${k}`
3217
+ `label-${v}`
3217
3218
  );
3218
3219
  }),
3219
- ae.map((g) => {
3220
- const k = n[g], B = e.map((J, Y) => {
3221
- const b = J[g], V = M(typeof b == "number" ? b : 0);
3222
- return mt(pe, K, V, R[Y]);
3223
- }), _ = B.map((J) => `${J.x},${J.y}`).join(" ");
3224
- return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
3220
+ ae.map((y) => {
3221
+ const v = n[y], B = e.map((q, U) => {
3222
+ const ee = q[y], G = N(typeof ee == "number" ? ee : 0);
3223
+ return mt(me, K, G, S[U]);
3224
+ }), _ = B.map((q) => `${q.x},${q.y}`).join(" ");
3225
+ return /* @__PURE__ */ j("g", { className: m(M.series, $?.series), children: [
3225
3226
  /* @__PURE__ */ s(
3226
3227
  "polygon",
3227
3228
  {
3228
3229
  points: _,
3229
- fill: k.color,
3230
+ fill: v.color,
3230
3231
  fillOpacity: f,
3231
- stroke: k.color,
3232
- strokeWidth: y,
3232
+ stroke: v.color,
3233
+ strokeWidth: p,
3233
3234
  strokeLinejoin: "round",
3234
3235
  strokeLinecap: "round"
3235
3236
  }
3236
3237
  ),
3237
- d && B.map((J, Y) => /* @__PURE__ */ s(
3238
+ d && B.map((q, U) => /* @__PURE__ */ s(
3238
3239
  "circle",
3239
3240
  {
3240
- className: m(w.point, $?.point),
3241
- cx: J.x,
3242
- cy: J.y,
3243
- r: oe === Y ? 5 : 3.5,
3244
- fill: k.color
3241
+ className: m(M.point, $?.point),
3242
+ cx: q.x,
3243
+ cy: q.y,
3244
+ r: ie === U ? 5 : 3.5,
3245
+ fill: v.color
3245
3246
  },
3246
- `${g}-${Y}`
3247
+ `${y}-${U}`
3247
3248
  ))
3248
- ] }, g);
3249
+ ] }, y);
3249
3250
  }),
3250
3251
  /* @__PURE__ */ s(
3251
3252
  "rect",
3252
3253
  {
3253
- className: w.interactionLayer,
3254
+ className: M.interactionLayer,
3254
3255
  x: 0,
3255
3256
  y: 0,
3256
3257
  width: A,
3257
- height: F,
3258
- onMouseMove: (g) => {
3259
- const k = g.currentTarget.getBoundingClientRect(), B = g.clientX - k.left - pe, _ = g.clientY - k.top - K;
3258
+ height: z,
3259
+ onMouseMove: (y) => {
3260
+ const v = y.currentTarget.getBoundingClientRect(), B = y.clientX - v.left - me, _ = y.clientY - v.top - K;
3260
3261
  if (B === 0 && _ === 0) return;
3261
- let J = Math.atan2(_, B) * 180 / Math.PI + 90;
3262
- J < 0 && (J += 360), J >= 360 && (J -= 360);
3263
- const Y = 360 / e.length, b = Math.round(J / Y) % e.length;
3264
- ce(b);
3262
+ let q = Math.atan2(_, B) * 180 / Math.PI + 90;
3263
+ q < 0 && (q += 360), q >= 360 && (q -= 360);
3264
+ const U = 360 / e.length, ee = Math.round(q / U) % e.length;
3265
+ ne(ee);
3265
3266
  },
3266
- onMouseLeave: () => ce(null)
3267
+ onMouseLeave: () => ne(null)
3267
3268
  }
3268
3269
  )
3269
3270
  ] });
@@ -3302,8 +3303,8 @@ function el(e, t, n = 2) {
3302
3303
  const h = a / t;
3303
3304
  let u = 0;
3304
3305
  for (let f = l - t + 1; f <= l; f++) {
3305
- const y = e[f].close - h;
3306
- u += y * y;
3306
+ const p = e[f].close - h;
3307
+ u += p * p;
3307
3308
  }
3308
3309
  u /= t;
3309
3310
  const d = Math.sqrt(u);
@@ -3332,34 +3333,34 @@ function Wt(e, t) {
3332
3333
  function _l(e) {
3333
3334
  return e.map((t) => typeof t.volume == "number" ? t.volume : null);
3334
3335
  }
3335
- const Re = 86400;
3336
+ const Se = 86400;
3336
3337
  function on(e) {
3337
3338
  switch (e) {
3338
3339
  case "1D":
3339
- return Re;
3340
+ return Se;
3340
3341
  case "5D":
3341
- return 5 * Re;
3342
+ return 5 * Se;
3342
3343
  case "1M":
3343
- return 30 * Re;
3344
+ return 30 * Se;
3344
3345
  case "3M":
3345
- return 90 * Re;
3346
+ return 90 * Se;
3346
3347
  case "6M":
3347
- return 180 * Re;
3348
+ return 180 * Se;
3348
3349
  case "1Y":
3349
- return 365 * Re;
3350
+ return 365 * Se;
3350
3351
  case "5Y":
3351
- return 5 * 365 * Re;
3352
+ return 5 * 365 * Se;
3352
3353
  }
3353
3354
  const t = /^(\d+)\s*([dDwWmMyYhH])$/.exec(e);
3354
3355
  if (t) {
3355
3356
  const n = Number(t[1]), r = t[2].toLowerCase();
3356
3357
  if (r === "h") return n * 3600;
3357
- if (r === "d") return n * Re;
3358
- if (r === "w") return n * 7 * Re;
3359
- if (r === "m") return n * 30 * Re;
3360
- if (r === "y") return n * 365 * Re;
3358
+ if (r === "d") return n * Se;
3359
+ if (r === "w") return n * 7 * Se;
3360
+ if (r === "m") return n * 30 * Se;
3361
+ if (r === "y") return n * 365 * Se;
3361
3362
  }
3362
- return 30 * Re;
3363
+ return 30 * Se;
3363
3364
  }
3364
3365
  function Ul(e) {
3365
3366
  switch (e) {
@@ -3379,7 +3380,7 @@ function Ul(e) {
3379
3380
  return "W";
3380
3381
  }
3381
3382
  const t = on(e);
3382
- return t >= 3 * 365 * Re ? "W" : t >= 180 * Re ? "D" : t >= 60 * Re ? "240" : t >= 14 * Re ? "60" : t >= 3 * Re ? "15" : "5";
3383
+ return t >= 3 * 365 * Se ? "W" : t >= 180 * Se ? "D" : t >= 60 * Se ? "240" : t >= 14 * Se ? "60" : t >= 3 * Se ? "15" : "5";
3383
3384
  }
3384
3385
  function Yl(e) {
3385
3386
  if (e === "W" || e === "M") return "5Y";
@@ -3402,56 +3403,56 @@ function Vl({
3402
3403
  downColor: u = "var(--crk-color-danger)",
3403
3404
  lineColor: d = "var(--crk-chart-1)",
3404
3405
  timezone: f,
3405
- defaultTimezone: y = "local",
3406
+ defaultTimezone: p = "local",
3406
3407
  onTimezoneChange: L,
3407
- showConfigPanel: v = !0,
3408
- onCrosshair: S,
3409
- onVisibleRangeChange: N,
3410
- className: D,
3411
- style: j
3408
+ showConfigPanel: b = !0,
3409
+ onCrosshair: R,
3410
+ onVisibleRangeChange: w,
3411
+ className: J,
3412
+ style: W
3412
3413
  }) {
3413
- const Z = re(null), U = re(null), C = re([]), $ = re({ from: 0, to: 0 }), oe = re(null), ce = re(null), q = re(!1), ae = re(null), R = re(null), te = re(1), H = re({ width: 0, height: 0 }), O = re(() => {
3414
- }), A = re(S), F = re(N);
3415
- A.current = S, F.current = N;
3416
- const [ne, pe] = Le(null), [K, X] = Le(y), M = f ?? K, g = fe(
3417
- (p) => {
3418
- f === void 0 && X(p), L?.(p);
3414
+ const E = oe(null), Z = oe(null), C = oe([]), $ = oe({ from: 0, to: 0 }), ie = oe(null), ne = oe(null), V = oe(!1), ae = oe(null), S = oe(null), re = oe(1), F = oe({ width: 0, height: 0 }), X = oe(() => {
3415
+ }), A = oe(R), z = oe(w);
3416
+ A.current = R, z.current = w;
3417
+ const [ce, me] = Le(null), [K, H] = Le(p), N = f ?? K, y = pe(
3418
+ (g) => {
3419
+ f === void 0 && H(g), L?.(g);
3419
3420
  },
3420
3421
  [f, L]
3421
- ), k = ke(
3422
+ ), v = ke(
3422
3423
  () => ({ up: h, down: u, line: d }),
3423
3424
  [h, u, d]
3424
- ), B = c, _ = B.some((p) => p.type === "rsi"), J = B.some((p) => p.type === "volume"), Y = fe(() => {
3425
- const p = U.current;
3426
- if (!p) return;
3427
- const x = p.getContext("2d");
3425
+ ), B = c, _ = B.some((g) => g.type === "rsi"), q = B.some((g) => g.type === "volume"), U = pe(() => {
3426
+ const g = Z.current;
3427
+ if (!g) return;
3428
+ const x = g.getContext("2d");
3428
3429
  if (!x) return;
3429
- const { width: ee, height: P } = H.current;
3430
- if (ee === 0 || P === 0) return;
3431
- const G = te.current;
3432
- x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, p.width, p.height), x.scale(G, G);
3433
- const I = pl(Z.current, k), me = ln(Z.current), Q = C.current;
3430
+ const { width: te, height: D } = F.current;
3431
+ if (te === 0 || D === 0) return;
3432
+ const Y = re.current;
3433
+ x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, g.width, g.height), x.scale(Y, Y);
3434
+ const I = pl(E.current, v), fe = ln(E.current), Q = C.current;
3434
3435
  if (Q.length === 0) {
3435
- gl(x, ee, P, I), x.restore();
3436
+ gl(x, te, D, I), x.restore();
3436
3437
  return;
3437
3438
  }
3438
- const T = Nt(ee, P, _, J), { from: le, to: ge } = hl($.current, Q.length);
3439
- $.current = { from: le, to: ge };
3440
- const ie = Q.slice(Math.max(0, Math.floor(le)), Math.min(Q.length, Math.ceil(ge) + 1)), ue = (se) => {
3441
- const Ie = ge - le + 1, He = T.plotWidth / Ie;
3442
- return T.plotLeft + (se - le + 0.5) * He;
3443
- }, Ae = T.plotWidth / (ge - le + 1), De = B.map((se) => ml(se, Q)).filter((se) => se !== null).map((se) => ({ ...se, color: me(se.color) })), xe = cn(T.main, ie, De, le, ge);
3439
+ const T = Nt(te, D, _, q), { from: de, to: ye } = hl($.current, Q.length);
3440
+ $.current = { from: de, to: ye };
3441
+ const se = Q.slice(Math.max(0, Math.floor(de)), Math.min(Q.length, Math.ceil(ye) + 1)), he = (ue) => {
3442
+ const Ie = ye - de + 1, He = T.plotWidth / Ie;
3443
+ return T.plotLeft + (ue - de + 0.5) * He;
3444
+ }, Ae = T.plotWidth / (ye - de + 1), De = B.map((ue) => ml(ue, Q)).filter((ue) => ue !== null).map((ue) => ({ ...ue, color: fe(ue.color) })), xe = cn(T.main, se, De, de, ye);
3444
3445
  Lt(x, T.plotLeft, T.plotRight, xe, I), yl(x, T, xe, i, I), x.save(), x.beginPath(), x.rect(T.plotLeft, xe.paneTop, T.plotWidth, xe.paneHeight), x.clip();
3445
- for (let se = 0; se < B.length; se++) {
3446
- const Ie = B[se], He = De[se];
3447
- He && kl(x, He, Ie, Q, le, ge, ue, xe);
3446
+ for (let ue = 0; ue < B.length; ue++) {
3447
+ const Ie = B[ue], He = De[ue];
3448
+ He && kl(x, He, Ie, Q, de, ye, he, xe);
3448
3449
  }
3449
- if (o === "candle" ? vl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : xl(x, Q, le, ge, ue, xe, I.line, o === "area"), x.restore(), T.volume) {
3450
- const se = fl(T.volume, Q, le, ge);
3451
- Lt(x, T.plotLeft, T.plotRight, se, I, !0), Ft(x, T, T.volume, "Volume", I), x.save(), x.beginPath(), x.rect(T.plotLeft, se.paneTop, T.plotWidth, se.paneHeight), x.clip(), Ml(x, Q, le, ge, ue, Ae, se, { up: I.up, down: I.down }), x.restore();
3450
+ if (o === "candle" ? vl(x, Q, de, ye, he, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, Q, de, ye, he, Ae, xe, { up: I.up, down: I.down }) : xl(x, Q, de, ye, he, xe, I.line, o === "area"), x.restore(), T.volume) {
3451
+ const ue = fl(T.volume, Q, de, ye);
3452
+ Lt(x, T.plotLeft, T.plotRight, ue, I, !0), Ft(x, T, T.volume, "Volume", I), x.save(), x.beginPath(), x.rect(T.plotLeft, ue.paneTop, T.plotWidth, ue.paneHeight), x.clip(), Ml(x, Q, de, ye, he, Ae, ue, { up: I.up, down: I.down }), x.restore();
3452
3453
  }
3453
3454
  if (T.rsi) {
3454
- const se = B.find((tt) => tt.type === "rsi"), Ie = se && se.type === "rsi" ? se.period ?? 14 : 14, He = se && se.type === "rsi" ? se.overbought ?? 70 : 70, Ge = se && se.type === "rsi" ? se.oversold ?? 30 : 30, Ee = (se && se.type === "rsi" ? se.color : void 0) ?? "var(--crk-chart-5)", xt = me(Ee), kt = tl(Q, Ie), Oe = {
3455
+ const ue = B.find((tt) => tt.type === "rsi"), Ie = ue && ue.type === "rsi" ? ue.period ?? 14 : 14, He = ue && ue.type === "rsi" ? ue.overbought ?? 70 : 70, Ge = ue && ue.type === "rsi" ? ue.oversold ?? 30 : 30, Ee = (ue && ue.type === "rsi" ? ue.color : void 0) ?? "var(--crk-chart-5)", xt = fe(Ee), kt = tl(Q, Ie), Oe = {
3455
3456
  paneTop: T.rsi.top,
3456
3457
  paneBottom: T.rsi.bottom,
3457
3458
  paneHeight: T.rsi.height,
@@ -3459,151 +3460,151 @@ function Vl({
3459
3460
  priceMax: 100,
3460
3461
  ticks: [Ge, 50, He]
3461
3462
  };
3462
- Lt(x, T.plotLeft, T.plotRight, Oe, I, !0), Ft(x, T, T.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, le, ge, ue, Oe, xt), x.restore(), wl(x, T, Oe, He, Ge, I);
3463
+ Lt(x, T.plotLeft, T.plotRight, Oe, I, !0), Ft(x, T, T.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, de, ye, he, Oe, xt), x.restore(), wl(x, T, Oe, He, Ge, I);
3463
3464
  }
3464
- $l(x, T, Q, le, ge, n, I), oe.current && Nl(x, T, oe.current, Q, le, ge, ue, i, xe, M, I), x.restore();
3465
- }, [o, B, _, J, i, k, n, M]);
3466
- O.current = Y;
3467
- const b = fe(() => {
3468
- if (R.current === null) {
3465
+ $l(x, T, Q, de, ye, n, I), ie.current && Nl(x, T, ie.current, Q, de, ye, he, i, xe, N, I), x.restore();
3466
+ }, [o, B, _, q, i, v, n, N]);
3467
+ X.current = U;
3468
+ const ee = pe(() => {
3469
+ if (S.current === null) {
3469
3470
  if (typeof requestAnimationFrame > "u") {
3470
- O.current();
3471
+ X.current();
3471
3472
  return;
3472
3473
  }
3473
- R.current = requestAnimationFrame(() => {
3474
- R.current = null, O.current();
3474
+ S.current = requestAnimationFrame(() => {
3475
+ S.current = null, X.current();
3475
3476
  });
3476
3477
  }
3477
3478
  }, []);
3478
3479
  jt(() => {
3479
- const p = Z.current;
3480
- if (!p) return;
3480
+ const g = E.current;
3481
+ if (!g) return;
3481
3482
  const x = () => {
3482
- const P = p.getBoundingClientRect(), G = typeof window < "u" && window.devicePixelRatio || 1;
3483
- te.current = G, H.current = { width: P.width, height: P.height };
3484
- const I = U.current;
3485
- I && (I.width = Math.round(P.width * G), I.height = Math.round(P.height * G), I.style.width = `${P.width}px`, I.style.height = `${P.height}px`), b();
3483
+ const D = g.getBoundingClientRect(), Y = typeof window < "u" && window.devicePixelRatio || 1;
3484
+ re.current = Y, F.current = { width: D.width, height: D.height };
3485
+ const I = Z.current;
3486
+ I && (I.width = Math.round(D.width * Y), I.height = Math.round(D.height * Y), I.style.width = `${D.width}px`, I.style.height = `${D.height}px`), ee();
3486
3487
  };
3487
3488
  if (x(), typeof ResizeObserver > "u") return;
3488
- const ee = new ResizeObserver(x);
3489
- return ee.observe(p), () => ee.disconnect();
3490
- }, [b]), Ne(() => {
3491
- let p = !1;
3492
- const x = Math.floor(Date.now() / 1e3), ee = zt(n), P = r !== void 0 ? on(r) : ee * l, G = r !== void 0 ? Math.max(10, Math.ceil(P / ee)) : l, I = x - P;
3493
- C.current = [], $.current = { from: 0, to: 0 }, b(), e.getBars({ symbol: t, resolution: n, from: I, to: x, countBack: G }).then((Q) => {
3494
- if (p) return;
3495
- const T = [...Q].sort((ge, ie) => ge.time - ie.time);
3489
+ const te = new ResizeObserver(x);
3490
+ return te.observe(g), () => te.disconnect();
3491
+ }, [ee]), Ne(() => {
3492
+ let g = !1;
3493
+ const x = Math.floor(Date.now() / 1e3), te = zt(n), D = r !== void 0 ? on(r) : te * l, Y = r !== void 0 ? Math.max(10, Math.ceil(D / te)) : l, I = x - D;
3494
+ C.current = [], $.current = { from: 0, to: 0 }, ee(), e.getBars({ symbol: t, resolution: n, from: I, to: x, countBack: Y }).then((Q) => {
3495
+ if (g) return;
3496
+ const T = [...Q].sort((ye, se) => ye.time - se.time);
3496
3497
  C.current = T;
3497
- const le = T.length - 1;
3498
+ const de = T.length - 1;
3498
3499
  if (r !== void 0)
3499
- $.current = { from: 0, to: le };
3500
+ $.current = { from: 0, to: de };
3500
3501
  else {
3501
- const ge = Math.min(T.length, Math.min(200, l));
3502
+ const ye = Math.min(T.length, Math.min(200, l));
3502
3503
  $.current = {
3503
- from: Math.max(0, le - ge + 1),
3504
- to: le
3504
+ from: Math.max(0, de - ye + 1),
3505
+ to: de
3505
3506
  };
3506
3507
  }
3507
- F.current?.($.current, T), b();
3508
+ z.current?.($.current, T), ee();
3508
3509
  }).catch(() => {
3509
3510
  });
3510
- const me = e.subscribeBars({
3511
+ const fe = e.subscribeBars({
3511
3512
  symbol: t,
3512
3513
  resolution: n,
3513
3514
  onTick: (Q) => {
3514
- if (p) return;
3515
- const T = C.current, le = T[T.length - 1];
3516
- if (le && le.time === Q.time)
3515
+ if (g) return;
3516
+ const T = C.current, de = T[T.length - 1];
3517
+ if (de && de.time === Q.time)
3517
3518
  T[T.length - 1] = Q;
3518
- else if (!le || Q.time > le.time) {
3519
+ else if (!de || Q.time > de.time) {
3519
3520
  T.push(Q);
3520
- const ge = $.current;
3521
- ge.to >= T.length - 2 && ($.current = { from: ge.from + 1, to: ge.to + 1 });
3521
+ const ye = $.current;
3522
+ ye.to >= T.length - 2 && ($.current = { from: ye.from + 1, to: ye.to + 1 });
3522
3523
  }
3523
- b();
3524
+ ee();
3524
3525
  }
3525
3526
  });
3526
- return ae.current = me, () => {
3527
- p = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
3527
+ return ae.current = fe, () => {
3528
+ g = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
3528
3529
  };
3529
3530
  }, [e, t, n, r, l]);
3530
- const E = fe((p) => {
3531
- pe(p), A.current?.(p);
3532
- }, []), V = fe((p) => {
3533
- p.currentTarget.setPointerCapture(p.pointerId);
3531
+ const k = pe((g) => {
3532
+ me(g), A.current?.(g);
3533
+ }, []), G = pe((g) => {
3534
+ g.currentTarget.setPointerCapture(g.pointerId);
3534
3535
  const x = $.current;
3535
- ce.current = { startX: p.clientX, from: x.from, to: x.to };
3536
- }, []), de = fe(
3537
- (p) => {
3538
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = p.clientY - x.top;
3539
- if (oe.current = { x: ee, y: P }, ce.current) {
3540
- const { startX: me, from: Q, to: T } = ce.current, { width: le } = H.current, ge = Math.max(1, le - Ct), ie = T - Q + 1, ue = ge / ie, Ae = -(p.clientX - me) / ue;
3536
+ ne.current = { startX: g.clientX, from: x.from, to: x.to };
3537
+ }, []), O = pe(
3538
+ (g) => {
3539
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left, D = g.clientY - x.top;
3540
+ if (ie.current = { x: te, y: D }, ne.current) {
3541
+ const { startX: fe, from: Q, to: T } = ne.current, { width: de } = F.current, ye = Math.max(1, de - Ct), se = T - Q + 1, he = ye / se, Ae = -(g.clientX - fe) / he;
3541
3542
  let De = Q + Ae, xe = T + Ae;
3542
- const se = C.current.length;
3543
- De < 0 && (Se(), De = 0, xe = ie - 1), xe > se - 1 && (xe = se - 1, De = xe - ie + 1), $.current = { from: De, to: xe }, F.current?.($.current, C.current);
3543
+ const ue = C.current.length;
3544
+ De < 0 && (Re(), De = 0, xe = se - 1), xe > ue - 1 && (xe = ue - 1, De = xe - se + 1), $.current = { from: De, to: xe }, z.current?.($.current, C.current);
3544
3545
  }
3545
- const G = Nt(x.width, x.height, _, J), I = $.current;
3546
- if (ee >= G.plotLeft && ee <= G.plotRight) {
3547
- const me = I.to - I.from + 1, Q = G.plotWidth / me, T = Math.round(I.from + (ee - G.plotLeft) / Q - 0.5), le = C.current, ge = Math.max(0, Math.min(le.length - 1, T)), ie = le[ge] ?? null, ue = Ll(P, G, le, I.from, I.to);
3548
- E({ barIndex: ge, bar: ie, priceAtCursor: ue });
3546
+ const Y = Nt(x.width, x.height, _, q), I = $.current;
3547
+ if (te >= Y.plotLeft && te <= Y.plotRight) {
3548
+ const fe = I.to - I.from + 1, Q = Y.plotWidth / fe, T = Math.round(I.from + (te - Y.plotLeft) / Q - 0.5), de = C.current, ye = Math.max(0, Math.min(de.length - 1, T)), se = de[ye] ?? null, he = Ll(D, Y, de, I.from, I.to);
3549
+ k({ barIndex: ye, bar: se, priceAtCursor: he });
3549
3550
  } else
3550
- E(null);
3551
- b();
3551
+ k(null);
3552
+ ee();
3552
3553
  },
3553
- [_, J, b, E]
3554
- ), he = fe((p) => {
3555
- p.currentTarget.releasePointerCapture(p.pointerId), ce.current = null;
3556
- }, []), ye = fe(() => {
3557
- oe.current = null, ce.current = null, E(null), b();
3558
- }, [b, E]), be = fe(
3559
- (p) => {
3560
- p.preventDefault();
3561
- const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = Nt(x.width, x.height, _, J), G = $.current, I = C.current;
3554
+ [_, q, ee, k]
3555
+ ), le = pe((g) => {
3556
+ g.currentTarget.releasePointerCapture(g.pointerId), ne.current = null;
3557
+ }, []), ge = pe(() => {
3558
+ ie.current = null, ne.current = null, k(null), ee();
3559
+ }, [ee, k]), be = pe(
3560
+ (g) => {
3561
+ g.preventDefault();
3562
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left, D = Nt(x.width, x.height, _, q), Y = $.current, I = C.current;
3562
3563
  if (I.length === 0) return;
3563
- const me = G.to - G.from + 1, Q = p.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), T = Math.max(
3564
- P.plotWidth / cl,
3565
- Math.min(I.length, P.plotWidth / il, me * Q)
3566
- ), le = G.from + (ee - P.plotLeft) / (P.plotWidth / me), ge = (le - G.from) / me;
3567
- let ie = le - ge * T, ue = ie + T - 1;
3568
- ie < 0 && (ie = 0, ue = T - 1), ue > I.length - 1 && (ue = I.length - 1, ie = ue - T + 1), $.current = { from: ie, to: ue }, F.current?.($.current, I), b();
3564
+ const fe = Y.to - Y.from + 1, Q = g.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), T = Math.max(
3565
+ D.plotWidth / cl,
3566
+ Math.min(I.length, D.plotWidth / il, fe * Q)
3567
+ ), de = Y.from + (te - D.plotLeft) / (D.plotWidth / fe), ye = (de - Y.from) / fe;
3568
+ let se = de - ye * T, he = se + T - 1;
3569
+ se < 0 && (se = 0, he = T - 1), he > I.length - 1 && (he = I.length - 1, se = he - T + 1), $.current = { from: se, to: he }, z.current?.($.current, I), ee();
3569
3570
  },
3570
- [_, J, b]
3571
- ), Ce = fe(
3572
- (p) => {
3573
- const x = $.current, ee = x.to - x.from + 1, P = C.current;
3574
- if (P.length === 0) return;
3575
- let G = 0;
3576
- if (p.key === "ArrowLeft") G = -Math.max(1, Math.floor(ee * 0.1));
3577
- else if (p.key === "ArrowRight") G = Math.max(1, Math.floor(ee * 0.1));
3571
+ [_, q, ee]
3572
+ ), Ce = pe(
3573
+ (g) => {
3574
+ const x = $.current, te = x.to - x.from + 1, D = C.current;
3575
+ if (D.length === 0) return;
3576
+ let Y = 0;
3577
+ if (g.key === "ArrowLeft") Y = -Math.max(1, Math.floor(te * 0.1));
3578
+ else if (g.key === "ArrowRight") Y = Math.max(1, Math.floor(te * 0.1));
3578
3579
  else return;
3579
- p.preventDefault();
3580
- let I = x.from + G, me = x.to + G;
3581
- I < 0 && (I = 0, me = ee - 1), me > P.length - 1 && (me = P.length - 1, I = me - ee + 1), $.current = { from: I, to: me }, F.current?.($.current, P), b();
3580
+ g.preventDefault();
3581
+ let I = x.from + Y, fe = x.to + Y;
3582
+ I < 0 && (I = 0, fe = te - 1), fe > D.length - 1 && (fe = D.length - 1, I = fe - te + 1), $.current = { from: I, to: fe }, z.current?.($.current, D), ee();
3582
3583
  },
3583
- [b]
3584
- ), Se = fe(() => {
3585
- if (q.current) return;
3586
- const p = C.current;
3587
- if (p.length === 0) return;
3588
- q.current = !0;
3589
- const x = zt(n), ee = p[0].time, P = ee - x * l, G = ee - x;
3590
- e.getBars({ symbol: t, resolution: n, from: P, to: G, countBack: l }).then((I) => {
3584
+ [ee]
3585
+ ), Re = pe(() => {
3586
+ if (V.current) return;
3587
+ const g = C.current;
3588
+ if (g.length === 0) return;
3589
+ V.current = !0;
3590
+ const x = zt(n), te = g[0].time, D = te - x * l, Y = te - x;
3591
+ e.getBars({ symbol: t, resolution: n, from: D, to: Y, countBack: l }).then((I) => {
3591
3592
  if (I.length === 0) {
3592
- q.current = !1;
3593
+ V.current = !1;
3593
3594
  return;
3594
3595
  }
3595
- const Q = [...I].sort((le, ge) => le.time - ge.time).filter((le) => le.time < ee), T = $.current;
3596
- C.current = [...Q, ...p], $.current = { from: T.from + Q.length, to: T.to + Q.length }, q.current = !1, b();
3596
+ const Q = [...I].sort((de, ye) => de.time - ye.time).filter((de) => de.time < te), T = $.current;
3597
+ C.current = [...Q, ...g], $.current = { from: T.from + Q.length, to: T.to + Q.length }, V.current = !1, ee();
3597
3598
  }).catch(() => {
3598
- q.current = !1;
3599
+ V.current = !1;
3599
3600
  });
3600
- }, [e, t, n, l, b]);
3601
- return /* @__PURE__ */ z(
3601
+ }, [e, t, n, l, ee]);
3602
+ return /* @__PURE__ */ j(
3602
3603
  "div",
3603
3604
  {
3604
- ref: Z,
3605
- className: m(w.root, D),
3606
- style: { ...j, height: a, position: "relative" },
3605
+ ref: E,
3606
+ className: m(M.root, J),
3607
+ style: { ...W, height: a, position: "relative" },
3607
3608
  tabIndex: 0,
3608
3609
  role: "figure",
3609
3610
  "aria-label": `${t} ${n} chart`,
@@ -3612,20 +3613,20 @@ function Vl({
3612
3613
  /* @__PURE__ */ s(
3613
3614
  "canvas",
3614
3615
  {
3615
- ref: U,
3616
- className: w.svg,
3617
- onPointerDown: V,
3618
- onPointerMove: de,
3619
- onPointerUp: he,
3620
- onPointerLeave: ye,
3616
+ ref: Z,
3617
+ className: M.svg,
3618
+ onPointerDown: G,
3619
+ onPointerMove: O,
3620
+ onPointerUp: le,
3621
+ onPointerLeave: ge,
3621
3622
  onWheel: be,
3622
- style: { cursor: ce.current ? "grabbing" : "crosshair", touchAction: "none" }
3623
+ style: { cursor: ne.current ? "grabbing" : "crosshair", touchAction: "none" }
3623
3624
  }
3624
3625
  ),
3625
- /* @__PURE__ */ z(
3626
+ /* @__PURE__ */ j(
3626
3627
  "div",
3627
3628
  {
3628
- className: w.tradingHeader,
3629
+ className: M.tradingHeader,
3629
3630
  style: {
3630
3631
  position: "absolute",
3631
3632
  top: ol,
@@ -3638,22 +3639,22 @@ function Vl({
3638
3639
  gap: 8
3639
3640
  },
3640
3641
  children: [
3641
- /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3642
+ /* @__PURE__ */ j("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3642
3643
  /* @__PURE__ */ s("strong", { children: t }),
3643
3644
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3644
- ne?.bar && /* @__PURE__ */ z("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3645
+ ce?.bar && /* @__PURE__ */ j("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3645
3646
  "O ",
3646
- ne.bar.open.toFixed(i),
3647
+ ce.bar.open.toFixed(i),
3647
3648
  " · H ",
3648
- ne.bar.high.toFixed(i),
3649
+ ce.bar.high.toFixed(i),
3649
3650
  " · L",
3650
3651
  " ",
3651
- ne.bar.low.toFixed(i),
3652
+ ce.bar.low.toFixed(i),
3652
3653
  " · C ",
3653
- ne.bar.close.toFixed(i)
3654
+ ce.bar.close.toFixed(i)
3654
3655
  ] })
3655
3656
  ] }),
3656
- v && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3657
+ b && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3657
3658
  qt,
3658
3659
  {
3659
3660
  position: "bottom",
@@ -3671,8 +3672,8 @@ function Vl({
3671
3672
  content: /* @__PURE__ */ s(
3672
3673
  dl,
3673
3674
  {
3674
- timezone: M,
3675
- onTimezoneChange: g
3675
+ timezone: N,
3676
+ onTimezoneChange: y
3676
3677
  }
3677
3678
  )
3678
3679
  }
@@ -3698,7 +3699,7 @@ function dl({
3698
3699
  timezone: e,
3699
3700
  onTimezoneChange: t
3700
3701
  }) {
3701
- return /* @__PURE__ */ z("div", { style: { minWidth: 220, padding: 4 }, children: [
3702
+ return /* @__PURE__ */ j("div", { style: { minWidth: 220, padding: 4 }, children: [
3702
3703
  /* @__PURE__ */ s(
3703
3704
  "div",
3704
3705
  {
@@ -3710,7 +3711,7 @@ function dl({
3710
3711
  children: "Settings"
3711
3712
  }
3712
3713
  ),
3713
- /* @__PURE__ */ z("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3714
+ /* @__PURE__ */ j("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3714
3715
  /* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
3715
3716
  /* @__PURE__ */ s(
3716
3717
  Vt,
@@ -3724,7 +3725,7 @@ function dl({
3724
3725
  ] });
3725
3726
  }
3726
3727
  function ul() {
3727
- return /* @__PURE__ */ z(
3728
+ return /* @__PURE__ */ j(
3728
3729
  "svg",
3729
3730
  {
3730
3731
  viewBox: "0 0 24 24",
@@ -3745,9 +3746,9 @@ function Nt(e, t, n, r) {
3745
3746
  const c = Math.max(0, e - Ct), i = rl, l = Math.max(i, t - At), a = Math.max(0, c - 0), h = Math.max(0, l - i);
3746
3747
  let u = h, d = i;
3747
3748
  const f = { top: i, bottom: l, height: h };
3748
- let y = null, L = null;
3749
- const v = n ? Ht.rsi : 0, S = r ? Ht.volume : 0;
3750
- return u = h * (1 - v - S), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (y = { top: d, height: h * v, bottom: d + h * v }, d = y.bottom), r && (L = { top: d, height: h * S, bottom: d + h * S }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: y, volume: L };
3749
+ let p = null, L = null;
3750
+ const b = n ? Ht.rsi : 0, R = r ? Ht.volume : 0;
3751
+ return u = h * (1 - b - R), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (p = { top: d, height: h * b, bottom: d + h * b }, d = p.bottom), r && (L = { top: d, height: h * R, bottom: d + h * R }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: p, volume: L };
3751
3752
  }
3752
3753
  function hl(e, t) {
3753
3754
  if (t === 0) return { from: 0, to: 0 };
@@ -3782,11 +3783,11 @@ function cn(e, t, n, r, o) {
3782
3783
  d.low < c && (c = d.low), d.high > i && (i = d.high);
3783
3784
  for (const d of n) {
3784
3785
  const f = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3785
- for (const y of f) {
3786
- const L = Math.max(0, Math.floor(r)), v = Math.min(y.length - 1, Math.ceil(o));
3787
- for (let S = L; S <= v; S++) {
3788
- const N = y[S];
3789
- N != null && (N < c && (c = N), N > i && (i = N));
3786
+ for (const p of f) {
3787
+ const L = Math.max(0, Math.floor(r)), b = Math.min(p.length - 1, Math.ceil(o));
3788
+ for (let R = L; R <= b; R++) {
3789
+ const w = p[R];
3790
+ w != null && (w < c && (c = w), w > i && (i = w));
3790
3791
  }
3791
3792
  }
3792
3793
  }
@@ -3859,20 +3860,20 @@ function yl(e, t, n, r, o) {
3859
3860
  function vl(e, t, n, r, o, c, i, l) {
3860
3861
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3861
3862
  for (let d = a; d <= h; d++) {
3862
- const f = t[d], y = o(d), L = we(f.open, i), v = we(f.close, i), S = we(f.high, i), N = we(f.low, i), j = f.close >= f.open ? l.up : l.down;
3863
- e.strokeStyle = j, e.fillStyle = j, e.beginPath();
3864
- const Z = Math.round(y) + 0.5;
3865
- e.moveTo(Z, S), e.lineTo(Z, N), e.stroke();
3866
- const U = Math.min(L, v), C = Math.max(1, Math.abs(v - L));
3867
- e.fillRect(Math.round(y - u / 2), Math.round(U), Math.round(u), Math.round(C));
3863
+ const f = t[d], p = o(d), L = we(f.open, i), b = we(f.close, i), R = we(f.high, i), w = we(f.low, i), W = f.close >= f.open ? l.up : l.down;
3864
+ e.strokeStyle = W, e.fillStyle = W, e.beginPath();
3865
+ const E = Math.round(p) + 0.5;
3866
+ e.moveTo(E, R), e.lineTo(E, w), e.stroke();
3867
+ const Z = Math.min(L, b), C = Math.max(1, Math.abs(b - L));
3868
+ e.fillRect(Math.round(p - u / 2), Math.round(Z), Math.round(u), Math.round(C));
3868
3869
  }
3869
3870
  }
3870
3871
  function bl(e, t, n, r, o, c, i, l) {
3871
3872
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(2, Math.min(c * 0.4, 8));
3872
3873
  e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
3873
3874
  for (let d = a; d <= h; d++) {
3874
- const f = t[d], y = Math.round(o(d)) + 0.5, L = we(f.high, i), v = we(f.low, i), S = we(f.open, i), N = we(f.close, i), D = f.close >= f.open;
3875
- e.strokeStyle = D ? l.up : l.down, e.beginPath(), e.moveTo(y, L), e.lineTo(y, v), e.moveTo(y - u, S), e.lineTo(y, S), e.moveTo(y, N), e.lineTo(y + u, N), e.stroke();
3875
+ const f = t[d], p = Math.round(o(d)) + 0.5, L = we(f.high, i), b = we(f.low, i), R = we(f.open, i), w = we(f.close, i), J = f.close >= f.open;
3876
+ e.strokeStyle = J ? l.up : l.down, e.beginPath(), e.moveTo(p, L), e.lineTo(p, b), e.moveTo(p - u, R), e.lineTo(p, R), e.moveTo(p, w), e.lineTo(p + u, w), e.stroke();
3876
3877
  }
3877
3878
  }
3878
3879
  function xl(e, t, n, r, o, c, i, l) {
@@ -3895,8 +3896,8 @@ function kl(e, t, n, r, o, c, i, l) {
3895
3896
  for (let d = a; d <= h; d++) {
3896
3897
  const f = t.upper[d];
3897
3898
  if (f == null) continue;
3898
- const y = i(d), L = we(f, l);
3899
- u ? e.lineTo(y, L) : (e.moveTo(y, L), u = !0);
3899
+ const p = i(d), L = we(f, l);
3900
+ u ? e.lineTo(p, L) : (e.moveTo(p, L), u = !0);
3900
3901
  }
3901
3902
  for (let d = h; d >= a; d--) {
3902
3903
  const f = t.lower[d];
@@ -3914,20 +3915,20 @@ function Qe(e, t, n, r, o, c, i) {
3914
3915
  l = !1;
3915
3916
  continue;
3916
3917
  }
3917
- const f = o(u), y = we(d, c);
3918
- l ? e.lineTo(f, y) : (e.moveTo(f, y), l = !0);
3918
+ const f = o(u), p = we(d, c);
3919
+ l ? e.lineTo(f, p) : (e.moveTo(f, p), l = !0);
3919
3920
  }
3920
3921
  e.stroke();
3921
3922
  }
3922
3923
  function Ml(e, t, n, r, o, c, i, l) {
3923
3924
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3924
3925
  for (let d = a; d <= h; d++) {
3925
- const f = t[d], y = f.volume ?? 0;
3926
- if (y === 0) continue;
3926
+ const f = t[d], p = f.volume ?? 0;
3927
+ if (p === 0) continue;
3927
3928
  const L = f.close >= f.open;
3928
3929
  e.fillStyle = L ? l.up : l.down, e.globalAlpha = 0.55;
3929
- const v = we(y, i), S = i.paneBottom - v;
3930
- e.fillRect(Math.round(o(d) - u / 2), Math.round(v), Math.round(u), Math.round(S));
3930
+ const b = we(p, i), R = i.paneBottom - b;
3931
+ e.fillRect(Math.round(o(d) - u / 2), Math.round(b), Math.round(u), Math.round(R));
3931
3932
  }
3932
3933
  e.globalAlpha = 1;
3933
3934
  }
@@ -3946,26 +3947,26 @@ function $l(e, t, n, r, o, c, i) {
3946
3947
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3947
3948
  e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3948
3949
  const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), f = t.plotBottom + At / 2;
3949
- for (let y = u; y <= d; y += h) {
3950
- const L = n[y], v = t.plotLeft + (y - r + 0.5) * a;
3951
- e.fillText(Sl(L.time, c), v, f);
3950
+ for (let p = u; p <= d; p += h) {
3951
+ const L = n[p], b = t.plotLeft + (p - r + 0.5) * a;
3952
+ e.fillText(Rl(L.time, c), b, f);
3952
3953
  }
3953
3954
  }
3954
3955
  function Nl(e, t, n, r, o, c, i, l, a, h, u) {
3955
3956
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3956
- const d = c - o + 1, f = t.plotWidth / d, y = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(y), v = Math.max(0, Math.min(r.length - 1, L)), S = i(v);
3957
- if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(S + 0.5, t.plotTop), e.lineTo(S + 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) {
3958
- const N = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3959
- e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(N.toFixed(l), t.plotRight + 6, n.y);
3957
+ const d = c - o + 1, f = t.plotWidth / d, p = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(p), b = Math.max(0, Math.min(r.length - 1, L)), R = i(b);
3958
+ if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(R + 0.5, t.plotTop), e.lineTo(R + 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) {
3959
+ const w = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3960
+ e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(w.toFixed(l), t.plotRight + 6, n.y);
3960
3961
  }
3961
- if (r[v]) {
3962
- const N = sn(r[v].time, h);
3962
+ if (r[b]) {
3963
+ const w = sn(r[b].time, h);
3963
3964
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3964
- const Z = e.measureText(N).width + 8 * 2, U = At, C = Math.max(
3965
+ const E = e.measureText(w).width + 8 * 2, Z = At, C = Math.max(
3965
3966
  t.plotLeft,
3966
- Math.min(t.plotRight - Z, S - Z / 2)
3967
+ Math.min(t.plotRight - E, R - E / 2)
3967
3968
  ), $ = t.plotBottom;
3968
- e.fillStyle = u.text, e.fillRect(C, $, Z, U), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(N, C + Z / 2, $ + U / 2);
3969
+ e.fillStyle = u.text, e.fillRect(C, $, E, Z), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(w, C + E / 2, $ + Z / 2);
3969
3970
  }
3970
3971
  e.restore();
3971
3972
  }
@@ -3973,14 +3974,14 @@ function Ll(e, t, n, r, o, c, i) {
3973
3974
  const l = n.slice(Math.max(0, Math.floor(r)), Math.min(n.length, Math.ceil(o) + 1)), a = cn(t.main, l, [], r, o);
3974
3975
  return e < a.paneTop || e > a.paneBottom ? null : a.priceMax - (e - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3975
3976
  }
3976
- function Sl(e, t) {
3977
+ function Rl(e, t) {
3977
3978
  const n = new Date(e * 1e3);
3978
3979
  return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())}` : `${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}`;
3979
3980
  }
3980
3981
  function sn(e, t) {
3981
3982
  const n = new Date(e * 1e3);
3982
3983
  if (t === "local")
3983
- return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Rl(n)}`;
3984
+ return `${n.getFullYear()}-${Te(n.getMonth() + 1)}-${Te(n.getDate())} ${Te(n.getHours())}:${Te(n.getMinutes())}:${Te(n.getSeconds())} ${Sl(n)}`;
3984
3985
  if (t === "utc")
3985
3986
  return `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())} ${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}:${Te(n.getUTCSeconds())} UTC`;
3986
3987
  try {
@@ -4001,7 +4002,7 @@ function sn(e, t) {
4001
4002
  return sn(e, "utc");
4002
4003
  }
4003
4004
  }
4004
- function Rl(e) {
4005
+ function Sl(e) {
4005
4006
  const t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
4006
4007
  return `${n}${Te(Math.floor(r / 60))}:${Te(r % 60)}`;
4007
4008
  }
@@ -4049,16 +4050,16 @@ const Cl = $e(
4049
4050
  className: h,
4050
4051
  style: u
4051
4052
  }, d) => {
4052
- const { line: f, area: y, last: L } = ke(() => {
4053
+ const { line: f, area: p, last: L } = ke(() => {
4053
4054
  if (e.length === 0) return { line: "", area: "", last: null };
4054
- const v = o, S = Math.max(1, t - v * 2), N = Math.max(1, n - v * 2), [D, j] = bt(e), Z = Je([0, Math.max(1, e.length - 1)], [v, v + S]), U = Je([D, j], [v + N, v]), C = e.map((ce, q) => ({ x: Z(q), y: U(ce) })), $ = Tl(C, c), oe = i ? `${$} L ${C[C.length - 1].x} ${v + N} L ${C[0].x} ${v + N} Z` : "";
4055
- return { line: $, area: oe, last: C[C.length - 1] };
4055
+ const b = o, R = Math.max(1, t - b * 2), w = Math.max(1, n - b * 2), [J, W] = bt(e), E = Je([0, Math.max(1, e.length - 1)], [b, b + R]), Z = Je([J, W], [b + w, b]), C = e.map((ne, V) => ({ x: E(V), y: Z(ne) })), $ = Tl(C, c), ie = i ? `${$} L ${C[C.length - 1].x} ${b + w} L ${C[0].x} ${b + w} Z` : "";
4056
+ return { line: $, area: ie, last: C[C.length - 1] };
4056
4057
  }, [e, t, n, o, c, i]);
4057
- return /* @__PURE__ */ z(
4058
+ return /* @__PURE__ */ j(
4058
4059
  "svg",
4059
4060
  {
4060
4061
  ref: d,
4061
- className: m(w.sparkline, h),
4062
+ className: m(M.sparkline, h),
4062
4063
  style: u,
4063
4064
  width: t,
4064
4065
  height: n,
@@ -4066,7 +4067,7 @@ const Cl = $e(
4066
4067
  role: "img",
4067
4068
  "aria-label": a,
4068
4069
  children: [
4069
- i && y && /* @__PURE__ */ s("path", { d: y, fill: r, opacity: 0.18 }),
4070
+ i && p && /* @__PURE__ */ s("path", { d: p, fill: r, opacity: 0.18 }),
4070
4071
  f && /* @__PURE__ */ s(
4071
4072
  "path",
4072
4073
  {
@@ -4122,7 +4123,7 @@ export {
4122
4123
  Ul as suggestResolutionForPeriod,
4123
4124
  xo as useClickOutside,
4124
4125
  Mo as useFocusTrap,
4125
- Rt as useKeyboard,
4126
+ St as useKeyboard,
4126
4127
  Ur as useTableSort,
4127
4128
  _l as volumeSeries
4128
4129
  };