@overdoser/react-toolkit 0.0.11 → 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 O, 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) {
@@ -11,11 +11,11 @@ function Ut(e) {
11
11
  } else for (n in e) e[n] && (r && (r += " "), r += n);
12
12
  return r;
13
13
  }
14
- function f() {
14
+ 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", wn = "crk-md-nDnOD", Mn = "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,
@@ -23,13 +23,13 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
23
23
  danger: bn,
24
24
  ghost: xn,
25
25
  sm: kn,
26
- md: wn,
27
- lg: Mn,
26
+ md: Mn,
27
+ lg: wn,
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,11 +55,11 @@ 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
- }, m) => /* @__PURE__ */ O(
58
+ }, f) => /* @__PURE__ */ j(
59
59
  "button",
60
60
  {
61
- ref: m,
62
- className: f(
61
+ ref: f,
62
+ className: m(
63
63
  Be.root,
64
64
  Be[e],
65
65
  Be[t],
@@ -75,12 +75,12 @@ const pn = "crk-root-8RX49", gn = "crk-loading-QfItr", yn = "crk-primary-st6yY",
75
75
  "aria-busy": n || void 0,
76
76
  ...d,
77
77
  children: [
78
- /* @__PURE__ */ s("div", { className: f(Be.shimmer, l?.shimmer) }),
79
- /* @__PURE__ */ s("span", { className: f(Be.content, l?.content), children: u }),
80
- /* @__PURE__ */ O("span", { className: f(Be.dots, l?.dots), "aria-hidden": "true", children: [
81
- /* @__PURE__ */ s("span", { className: f(Be.dot, l?.dot) }),
82
- /* @__PURE__ */ s("span", { className: f(Be.dot, l?.dot) }),
83
- /* @__PURE__ */ s("span", { className: f(Be.dot, l?.dot) })
78
+ /* @__PURE__ */ s("div", { className: m(Be.shimmer, l?.shimmer) }),
79
+ /* @__PURE__ */ s("span", { className: m(Be.content, l?.content), children: u }),
80
+ /* @__PURE__ */ j("span", { className: m(Be.dots, l?.dots), "aria-hidden": "true", children: [
81
+ /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
82
+ /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) }),
83
+ /* @__PURE__ */ s("span", { className: m(Be.dot, l?.dot) })
84
84
  ] })
85
85
  ]
86
86
  }
@@ -101,11 +101,11 @@ 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__ */ O(
104
+ }, i) => /* @__PURE__ */ j(
105
105
  "a",
106
106
  {
107
107
  ref: i,
108
- className: f($t.root, $t[e], n),
108
+ className: m($t.root, $t[e], n),
109
109
  style: r,
110
110
  ...t && {
111
111
  target: "_blank",
@@ -159,7 +159,7 @@ const jn = "crk-root-U-oiq", Xn = "crk-h1-Aivwz", _n = "crk-h2-CV8Oo", Un = "crk
159
159
  e,
160
160
  {
161
161
  ref: h,
162
- className: f(
162
+ className: m(
163
163
  Ue.root,
164
164
  Ue[e],
165
165
  t && Ue[t],
@@ -196,7 +196,7 @@ const ur = "crk-root-PVrgx", hr = "crk-unordered-FhCWT", mr = "crk-item-TfW82",
196
196
  e === "ordered" ? "ol" : "ul",
197
197
  {
198
198
  ref: i,
199
- className: f(
199
+ className: m(
200
200
  ut.root,
201
201
  ut[e],
202
202
  ut[t],
@@ -214,7 +214,7 @@ const xr = $e(
214
214
  "li",
215
215
  {
216
216
  ref: o,
217
- className: f(ut.item, e),
217
+ className: m(ut.item, e),
218
218
  style: t,
219
219
  ...r,
220
220
  children: n
@@ -222,15 +222,15 @@ const xr = $e(
222
222
  )
223
223
  );
224
224
  xr.displayName = "ListItem";
225
- const kr = "crk-wrapper-zxjMt", wr = "crk-root-Gf85-", Mr = "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
- root: wr,
228
- headerCell: Mr,
227
+ root: Mr,
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,38 +251,38 @@ 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
- const u = h.findIndex((m) => m.key === a);
261
+ const u = h.findIndex((f) => f.key === a);
262
262
  if (u === -1)
263
263
  return [...h, { key: a, direction: "asc" }];
264
264
  if (h[u].direction === "asc") {
265
- const m = [...h];
266
- return m[u] = { key: a, direction: "desc" }, m;
265
+ const f = [...h];
266
+ return f[u] = { key: a, direction: "desc" }, f;
267
267
  }
268
- return h.filter((m, p) => p !== 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) => {
274
274
  for (const { key: u, direction: d } of n) {
275
- const m = _r(a[u], h[u]);
276
- if (m !== 0)
277
- return d === "asc" ? m : -m;
275
+ const f = _r(a[u], h[u]);
276
+ if (f !== 0)
277
+ return d === "asc" ? f : -f;
278
278
  }
279
279
  return 0;
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__ */ O("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
284
- /* @__PURE__ */ s("span", { className: f(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
285
- /* @__PURE__ */ s("span", { className: f(ve.sortArrow, e === "desc" && ve.sortArrowActive), children: "▼" }),
283
+ return /* @__PURE__ */ j("span", { className: ve.sortIndicator, "aria-hidden": "true", children: [
284
+ /* @__PURE__ */ s("span", { className: m(ve.sortArrow, e === "asc" && ve.sortArrowActive), children: "▲" }),
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 })
287
287
  ] });
288
288
  }
@@ -306,8 +306,8 @@ function Vr({
306
306
  }
307
307
  return u;
308
308
  }, [e, i]);
309
- return /* @__PURE__ */ O("nav", { className: f(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
310
- /* @__PURE__ */ O("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,19 +316,19 @@ 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__ */ O("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__ */ O("div", { className: ve.paginatorNav, children: [
326
+ /* @__PURE__ */ j("div", { className: ve.paginatorNav, children: [
327
327
  /* @__PURE__ */ s(
328
328
  "button",
329
329
  {
330
330
  type: "button",
331
- className: f(ve.pageButton, c?.pageButton),
331
+ className: m(ve.pageButton, c?.pageButton),
332
332
  disabled: e <= 1,
333
333
  onClick: () => o(e - 1, t),
334
334
  "aria-label": "Previous page",
@@ -340,7 +340,7 @@ function Vr({
340
340
  "button",
341
341
  {
342
342
  type: "button",
343
- className: f(ve.pageButton, u === e && ve.pageButtonActive, c?.pageButton),
343
+ className: m(ve.pageButton, u === e && ve.pageButtonActive, c?.pageButton),
344
344
  onClick: () => o(u, t),
345
345
  "aria-label": `Page ${u}`,
346
346
  "aria-current": u === e ? "page" : void 0,
@@ -353,7 +353,7 @@ function Vr({
353
353
  "button",
354
354
  {
355
355
  type: "button",
356
- className: f(ve.pageButton, c?.pageButton),
356
+ className: m(ve.pageButton, c?.pageButton),
357
357
  disabled: e >= i,
358
358
  onClick: () => o(e + 1, t),
359
359
  "aria-label": "Next page",
@@ -375,116 +375,126 @@ function qr({
375
375
  className: a,
376
376
  style: h,
377
377
  rowKey: u,
378
- emptyMessage: d = "No data",
379
- pagination: m,
380
- classes: p
378
+ rowClassName: d,
379
+ rowStyle: f,
380
+ emptyMessage: p = "No data",
381
+ pagination: L,
382
+ classes: b
381
383
  }) {
382
- const S = r !== void 0, {
383
- sortedData: k,
384
- sortConfig: T,
385
- requestSort: N,
386
- requestMultiSort: I
387
- } = Ur(e, n), C = S ? n ?? [] : T, X = S ? e : k, Q = ke(() => {
388
- if (!m || S) return X;
389
- const w = (m.page - 1) * m.pageSize;
390
- return X.slice(w, w + m.pageSize);
391
- }, [X, m, S]), P = m?.totalRows ?? X.length, L = fe(
392
- (w, q) => {
393
- const oe = o && (q.ctrlKey || q.metaKey);
394
- if (S)
395
- if (oe) {
396
- const ee = C.findIndex((Y) => Y.key === w);
397
- let z;
398
- ee === -1 ? z = [...C, { key: w, direction: "asc" }] : C[ee].direction === "asc" ? z = C.map(
399
- (Y, H) => H === ee ? { key: w, direction: "desc" } : Y
400
- ) : z = C.filter((Y, H) => H !== ee), r(z);
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
+ let 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);
401
403
  } else {
402
- const ee = C.find((z) => z.key === w);
403
- ee ? ee.direction === "asc" ? r([{ key: w, direction: "desc" }]) : r([]) : r([{ key: w, 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" }]);
404
406
  }
405
407
  else
406
- oe ? I(w) : N(w);
408
+ F ? E(S) : W(S);
407
409
  },
408
410
  [
409
- S,
411
+ R,
410
412
  o,
411
- C,
413
+ Z,
412
414
  r,
413
- N,
414
- I
415
+ W,
416
+ E
415
417
  ]
416
- ), J = (w) => C.find((oe) => oe.key === w)?.direction, le = (w) => {
417
- if (C.length <= 1) return;
418
- const q = C.findIndex((oe) => oe.key === w);
419
- return q >= 0 ? q : 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;
420
422
  };
421
- return /* @__PURE__ */ O("div", { className: f(ve.wrapper, p?.wrapper), children: [
422
- /* @__PURE__ */ O(
423
+ return /* @__PURE__ */ j("div", { className: m(ve.wrapper, b?.wrapper), children: [
424
+ /* @__PURE__ */ j(
423
425
  "table",
424
426
  {
425
- className: f(
427
+ className: m(
426
428
  ve.root,
427
429
  c && ve.striped,
428
430
  i && ve.hoverable,
429
431
  l && ve.compact,
430
- p?.root,
432
+ b?.root,
431
433
  a
432
434
  ),
433
435
  style: h,
434
436
  children: [
435
- /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((w) => /* @__PURE__ */ O(
437
+ /* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: t.map((S) => /* @__PURE__ */ j(
436
438
  "th",
437
439
  {
438
- className: f(
440
+ className: m(
439
441
  ve.headerCell,
440
- w.sortable && ve.headerCellSortable,
441
- p?.headerCell
442
+ S.sortable && ve.headerCellSortable,
443
+ b?.headerCell
442
444
  ),
443
445
  style: {
444
- width: w.width,
445
- textAlign: w.align
446
+ width: S.width,
447
+ textAlign: S.align
446
448
  },
447
- onClick: w.sortable ? (q) => L(w.key, q) : void 0,
448
- "aria-sort": w.sortable ? J(w.key) === "asc" ? "ascending" : J(w.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,
449
451
  children: [
450
- w.header,
451
- w.sortable && /* @__PURE__ */ s(
452
+ S.header,
453
+ S.sortable && /* @__PURE__ */ s(
452
454
  Yr,
453
455
  {
454
- direction: J(w.key),
455
- sortIndex: le(w.key)
456
+ direction: V(S.key),
457
+ sortIndex: ae(S.key)
456
458
  }
457
459
  )
458
460
  ]
459
461
  },
460
- w.key
462
+ S.key
461
463
  )) }) }),
462
- /* @__PURE__ */ s("tbody", { children: Q.length === 0 ? /* @__PURE__ */ s("tr", { className: ve.emptyRow, children: /* @__PURE__ */ s("td", { className: f(ve.emptyCell, p?.emptyCell), colSpan: t.length, children: d }) }) : Q.map((w, q) => {
463
- const oe = u ? String(w[u]) : q;
464
- return /* @__PURE__ */ s("tr", { className: f(ve.row, p?.row), children: t.map((ee) => /* @__PURE__ */ s(
465
- "td",
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
+ return /* @__PURE__ */ s(
467
+ "tr",
466
468
  {
467
- className: f(ve.cell, p?.cell),
468
- style: { textAlign: ee.align },
469
- children: ee.render ? ee.render(w[ee.key], w, q) : w[ee.key]
469
+ className: m(ve.row, b?.row, X),
470
+ style: A,
471
+ children: t.map((z) => /* @__PURE__ */ s(
472
+ "td",
473
+ {
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
+ },
478
+ z.key
479
+ ))
470
480
  },
471
- ee.key
472
- )) }, oe);
481
+ F
482
+ );
473
483
  }) })
474
484
  ]
475
485
  }
476
486
  ),
477
- m && /* @__PURE__ */ s(
487
+ L && /* @__PURE__ */ s(
478
488
  Vr,
479
489
  {
480
- ...m,
481
- totalRows: P,
482
- paginatorClasses: { paginator: p?.paginator, pageButton: p?.pageButton }
490
+ ...L,
491
+ totalRows: ie,
492
+ paginatorClasses: { paginator: b?.paginator, pageButton: b?.pageButton }
483
493
  }
484
494
  )
485
495
  ] });
486
496
  }
487
- const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", we = {
497
+ const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trigger-LwPaD", Qr = "crk-triggerOpen-U4pa9", Jr = "crk-triggerLabel-QLITs", eo = "crk-triggerError-3jlu1", to = "crk-placeholder-fWdch", no = "crk-chevron-jmDNe", ro = "crk-menu-fxnKL", oo = "crk-menuOpen-HF-Y1", io = "crk-alignLeft-buCDJ", co = "crk-alignRight-05P9w", lo = "crk-item-f-Rhh", so = "crk-itemDisabled-L-d6i", ao = "crk-itemSelected-Fwmuo", Me = {
488
498
  root: Gr,
489
499
  fullWidth: Zr,
490
500
  trigger: Kr,
@@ -501,8 +511,8 @@ const El = qr, Gr = "crk-root-an8Cf", Zr = "crk-fullWidth-S-uVk", Kr = "crk-trig
501
511
  itemDisabled: so,
502
512
  itemSelected: ao
503
513
  };
504
- function Rt(e, t = !0) {
505
- const n = fe(
514
+ function St(e, t = !0) {
515
+ const n = pe(
506
516
  (r) => {
507
517
  const o = e[r.key];
508
518
  o && o(r);
@@ -546,114 +556,114 @@ const Vt = $e(
546
556
  placeholder: h = "Select...",
547
557
  value: u,
548
558
  onChange: d,
549
- error: m = !1,
559
+ error: f = !1,
550
560
  fullWidth: p = !0,
551
- portal: S = !0,
552
- classes: k
553
- }, T) => {
554
- const [N, I] = Le(!1), C = re(null), X = re(null), Q = re(null), P = Ye();
561
+ portal: L = !0,
562
+ classes: b
563
+ }, R) => {
564
+ const [w, J] = Le(!1), W = oe(null), E = oe(null), Z = oe(null), C = Ye();
555
565
  Ne(() => {
556
- N && X.current && X.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
557
- }, [N]);
558
- const L = fe(() => {
559
- I(!1), l?.(), Q.current?.focus();
560
- }, [l]), J = fe(() => {
561
- I((H) => {
562
- const te = !H;
563
- return te ? i?.() : l?.(), te;
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;
564
574
  });
565
- }, [i, l]), le = fe(
566
- (H) => {
567
- d?.(H), L();
575
+ }, [i, l]), ne = pe(
576
+ (A) => {
577
+ d?.(A), $();
568
578
  },
569
- [d, L]
579
+ [d, $]
570
580
  );
571
581
  Ne(() => {
572
- if (!N) return;
573
- const H = (te) => {
574
- const ie = te.target;
575
- C.current?.contains(ie) || X.current?.contains(ie) || L();
582
+ if (!w) return;
583
+ const A = (z) => {
584
+ const ce = z.target;
585
+ W.current?.contains(ce) || E.current?.contains(ce) || $();
576
586
  };
577
- return document.addEventListener("mousedown", H), () => document.removeEventListener("mousedown", H);
578
- }, [N, L]), Rt(
587
+ return document.addEventListener("mousedown", A), () => document.removeEventListener("mousedown", A);
588
+ }, [w, $]), St(
579
589
  {
580
- Escape: () => L()
590
+ Escape: () => $()
581
591
  },
582
- N
592
+ w
583
593
  );
584
- const w = Tt(Q, N && S), q = a?.find((H) => H.value === u)?.label, oe = a ? q || h : e, ee = a && !q, z = a ? a.map((H) => /* @__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(
585
595
  "button",
586
596
  {
587
597
  type: "button",
588
598
  role: "menuitem",
589
- className: f(
590
- we.item,
591
- H.disabled && we.itemDisabled,
592
- H.value === u && we.itemSelected,
593
- k?.item
599
+ className: m(
600
+ Me.item,
601
+ A.disabled && Me.itemDisabled,
602
+ A.value === u && Me.itemSelected,
603
+ b?.item
594
604
  ),
595
- disabled: H.disabled,
596
- onClick: () => le(H.value),
597
- children: H.label
605
+ disabled: A.disabled,
606
+ onClick: () => ne(A.value),
607
+ children: A.label
598
608
  },
599
- H.value
600
- )) : t, Y = (H) => /* @__PURE__ */ s(
609
+ A.value
610
+ )) : t, X = (A) => /* @__PURE__ */ s(
601
611
  "div",
602
612
  {
603
- ref: X,
604
- id: P,
605
- className: f(
606
- we.menu,
607
- N && we.menuOpen,
608
- n === "left" ? we.alignLeft : we.alignRight,
609
- !S && p && we.fullWidth,
610
- k?.menu
613
+ ref: E,
614
+ id: C,
615
+ className: m(
616
+ Me.menu,
617
+ w && Me.menuOpen,
618
+ n === "left" ? Me.alignLeft : Me.alignRight,
619
+ !L && p && Me.fullWidth,
620
+ b?.menu
611
621
  ),
612
- style: H,
622
+ style: A,
613
623
  role: "menu",
614
- children: z
624
+ children: F
615
625
  }
616
626
  );
617
- return /* @__PURE__ */ O(
627
+ return /* @__PURE__ */ j(
618
628
  "div",
619
629
  {
620
- ref: T,
621
- className: f(we.root, p && we.fullWidth, k?.root, r),
630
+ ref: R,
631
+ className: m(Me.root, p && Me.fullWidth, b?.root, r),
622
632
  style: o,
623
633
  children: [
624
- /* @__PURE__ */ O("div", { ref: C, style: p ? { width: "100%" } : void 0, children: [
625
- /* @__PURE__ */ O(
634
+ /* @__PURE__ */ j("div", { ref: W, style: p ? { width: "100%" } : void 0, children: [
635
+ /* @__PURE__ */ j(
626
636
  "button",
627
637
  {
628
- ref: Q,
638
+ ref: Z,
629
639
  id: c,
630
640
  type: "button",
631
- className: f(
632
- we.trigger,
633
- N && we.triggerOpen,
634
- m && we.triggerError,
635
- p && we.fullWidth,
636
- k?.trigger
641
+ className: m(
642
+ Me.trigger,
643
+ w && Me.triggerOpen,
644
+ f && Me.triggerError,
645
+ p && Me.fullWidth,
646
+ b?.trigger
637
647
  ),
638
- onClick: J,
639
- "aria-expanded": N,
648
+ onClick: ie,
649
+ "aria-expanded": w,
640
650
  "aria-haspopup": "menu",
641
- "aria-controls": N ? P : void 0,
651
+ "aria-controls": w ? C : void 0,
642
652
  children: [
643
- /* @__PURE__ */ s("span", { className: f(we.triggerLabel, ee && we.placeholder, k?.triggerLabel), children: oe }),
644
- /* @__PURE__ */ s("span", { className: f(we.chevron, k?.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" })
645
655
  ]
646
656
  }
647
657
  ),
648
- !S && Y()
658
+ !L && X()
649
659
  ] }),
650
- S && N && typeof document < "u" && pt(
651
- Y({
660
+ L && w && typeof document < "u" && pt(
661
+ X({
652
662
  position: "fixed",
653
- top: w.top + 4,
654
- left: n === "right" ? void 0 : w.left,
655
- right: n === "right" ? window.innerWidth - (w.left + w.width) : void 0,
656
- minWidth: w.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,
657
667
  zIndex: "var(--crk-z-floating)"
658
668
  }),
659
669
  document.body
@@ -676,9 +686,9 @@ const uo = $e(
676
686
  ref: o,
677
687
  type: "button",
678
688
  role: "menuitem",
679
- className: f(
680
- we.item,
681
- e && we.itemDisabled,
689
+ className: m(
690
+ Me.item,
691
+ e && Me.itemDisabled,
682
692
  t
683
693
  ),
684
694
  disabled: e,
@@ -727,53 +737,53 @@ const qt = $e(
727
737
  className: l,
728
738
  style: a
729
739
  }, h) => {
730
- const [u, d] = Le(!1), m = re(null), p = re(null), S = re(null), k = Ye(), T = o !== void 0, N = T ? o : u, I = fe(
731
- (P) => {
732
- T || d(P), c?.(P);
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
+ (C) => {
742
+ R || d(C), c?.(C);
733
743
  },
734
- [T, c]
735
- ), C = fe(() => {
736
- I(!1), S.current?.focus();
737
- }, [I]), X = fe(() => {
738
- I(!N);
739
- }, [N, I]);
740
- xo(m, C, 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(
741
751
  {
742
- Escape: () => C()
752
+ Escape: () => W()
743
753
  },
744
- N
754
+ w
745
755
  ), Ne(() => {
746
- if (N && p.current) {
747
- const P = p.current.querySelector(
756
+ if (w && p.current) {
757
+ const C = p.current.querySelector(
748
758
  'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
749
759
  );
750
- P ? P.focus() : p.current.focus();
760
+ C ? C.focus() : p.current.focus();
751
761
  }
752
- }, [N]);
753
- let Q;
762
+ }, [w]);
763
+ let Z;
754
764
  if (t && dn(e)) {
755
- const P = e, L = P.ref;
756
- Q = Xt(P, {
757
- ref: ko(S, L),
758
- onClick: (J) => {
759
- P.props.onClick?.(J), X();
765
+ const C = e, $ = C.ref;
766
+ Z = Xt(C, {
767
+ ref: ko(L, $),
768
+ onClick: (ie) => {
769
+ C.props.onClick?.(ie), E();
760
770
  },
761
- className: f(P.props.className, i?.trigger),
762
- "aria-expanded": N,
771
+ className: m(C.props.className, i?.trigger),
772
+ "aria-expanded": w,
763
773
  "aria-haspopup": "dialog",
764
- "aria-controls": N ? k : void 0
774
+ "aria-controls": w ? b : void 0
765
775
  });
766
776
  } else
767
- Q = /* @__PURE__ */ s(
777
+ Z = /* @__PURE__ */ s(
768
778
  "button",
769
779
  {
770
- ref: S,
780
+ ref: L,
771
781
  type: "button",
772
- className: f(at.trigger, i?.trigger),
773
- onClick: X,
774
- "aria-expanded": N,
782
+ className: m(at.trigger, i?.trigger),
783
+ onClick: E,
784
+ "aria-expanded": w,
775
785
  "aria-haspopup": "dialog",
776
- "aria-controls": N ? k : void 0,
786
+ "aria-controls": w ? b : void 0,
777
787
  children: e
778
788
  }
779
789
  );
@@ -781,18 +791,18 @@ const qt = $e(
781
791
  "div",
782
792
  {
783
793
  ref: h,
784
- className: f(at.root, i?.root, l),
794
+ className: m(at.root, i?.root, l),
785
795
  style: a,
786
- children: /* @__PURE__ */ O("div", { ref: m, children: [
787
- Q,
788
- N && /* @__PURE__ */ s(
796
+ children: /* @__PURE__ */ j("div", { ref: f, children: [
797
+ Z,
798
+ w && /* @__PURE__ */ s(
789
799
  "div",
790
800
  {
791
801
  ref: p,
792
- id: k,
802
+ id: b,
793
803
  role: "dialog",
794
804
  tabIndex: -1,
795
- className: f(at.popover, at[r], i?.popover),
805
+ className: m(at.popover, at[r], i?.popover),
796
806
  children: n
797
807
  }
798
808
  )
@@ -810,8 +820,8 @@ const It = [
810
820
  "a[href]",
811
821
  '[tabindex]:not([tabindex="-1"])'
812
822
  ].join(", ");
813
- function wo(e, t) {
814
- const n = re(null), r = fe(
823
+ function Mo(e, t) {
824
+ const n = oe(null), r = pe(
815
825
  (o) => {
816
826
  if (o.key !== "Tab" || !e.current)
817
827
  return;
@@ -837,13 +847,13 @@ function wo(e, t) {
837
847
  };
838
848
  }, [t, e, r]);
839
849
  }
840
- const Mo = "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 = {
841
- backdrop: Mo,
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
+ backdrop: wo,
842
852
  backdropIn: $o,
843
853
  modal: No,
844
854
  modalIn: Lo,
845
- sm: So,
846
- md: Ro,
855
+ sm: Ro,
856
+ md: So,
847
857
  lg: To,
848
858
  fullscreen: Co,
849
859
  header: Ao,
@@ -853,11 +863,11 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
853
863
  footer: Eo
854
864
  }, gt = _t({ classes: {}, titleId: "" }), Gt = ({ children: e, className: t, style: n, onClose: r }) => {
855
865
  const { classes: o, titleId: c } = ft(gt);
856
- return /* @__PURE__ */ O(
866
+ return /* @__PURE__ */ j(
857
867
  "div",
858
868
  {
859
869
  id: c,
860
- className: f(ze.header, r && ze.headerWithClose, o.header, t),
870
+ className: m(ze.header, r && ze.headerWithClose, o.header, t),
861
871
  style: n,
862
872
  children: [
863
873
  e,
@@ -865,7 +875,7 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
865
875
  "button",
866
876
  {
867
877
  type: "button",
868
- className: f(ze.closeButton, o.closeButton),
878
+ className: m(ze.closeButton, o.closeButton),
869
879
  onClick: r,
870
880
  "aria-label": "Close",
871
881
  children: "×"
@@ -878,12 +888,12 @@ const Mo = "crk-backdrop-jYpTA", $o = "crk-backdropIn-x5Z-A", No = "crk-modal-yN
878
888
  Gt.displayName = "Modal.Header";
879
889
  const Zt = ({ children: e, className: t, style: n }) => {
880
890
  const { classes: r } = ft(gt);
881
- return /* @__PURE__ */ s("div", { className: f(ze.body, r.body, t), style: n, children: e });
891
+ return /* @__PURE__ */ s("div", { className: m(ze.body, r.body, t), style: n, children: e });
882
892
  };
883
893
  Zt.displayName = "Modal.Body";
884
894
  const Kt = ({ children: e, className: t, style: n }) => {
885
895
  const { classes: r } = ft(gt);
886
- return /* @__PURE__ */ s("div", { className: f(ze.footer, r.footer, t), style: n, children: e });
896
+ return /* @__PURE__ */ s("div", { className: m(ze.footer, r.footer, t), style: n, children: e });
887
897
  };
888
898
  Kt.displayName = "Modal.Footer";
889
899
  const yt = $e(
@@ -900,9 +910,9 @@ const yt = $e(
900
910
  "aria-label": h,
901
911
  "aria-labelledby": u
902
912
  }, d) => {
903
- const m = re(null), p = d ?? m, S = Ye(), k = u ?? `${S}-title`;
904
- wo(p, e);
905
- const T = ke(
913
+ const f = oe(null), p = d ?? f, L = Ye(), b = u ?? `${L}-title`;
914
+ Mo(p, e);
915
+ const R = ke(
906
916
  () => ({
907
917
  Escape: () => {
908
918
  r && t();
@@ -910,34 +920,34 @@ const yt = $e(
910
920
  }),
911
921
  [r, t]
912
922
  );
913
- Rt(T, e), Ne(() => {
923
+ St(R, e), Ne(() => {
914
924
  if (!e) return;
915
- const I = document.body.style.overflow;
925
+ const J = document.body.style.overflow;
916
926
  return document.body.style.overflow = "hidden", () => {
917
- document.body.style.overflow = I;
927
+ document.body.style.overflow = J;
918
928
  };
919
929
  }, [e]);
920
- const N = (I) => {
921
- n && I.target === I.currentTarget && t();
930
+ const w = (J) => {
931
+ n && J.target === J.currentTarget && t();
922
932
  };
923
933
  return e ? pt(
924
934
  /* @__PURE__ */ s(
925
935
  "div",
926
936
  {
927
- className: f(ze.backdrop, c?.backdrop),
928
- onClick: N,
937
+ className: m(ze.backdrop, c?.backdrop),
938
+ onClick: w,
929
939
  role: "presentation",
930
940
  children: /* @__PURE__ */ s(
931
941
  "div",
932
942
  {
933
943
  ref: p,
934
- className: f(ze.modal, ze[o], c?.modal, i),
944
+ className: m(ze.modal, ze[o], c?.modal, i),
935
945
  style: l,
936
946
  role: "dialog",
937
947
  "aria-modal": "true",
938
948
  "aria-label": h,
939
- "aria-labelledby": h ? void 0 : k,
940
- children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: k }, children: a })
949
+ "aria-labelledby": h ? void 0 : b,
950
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: b }, children: a })
941
951
  }
942
952
  )
943
953
  }
@@ -971,11 +981,11 @@ function Pl({
971
981
  children: c
972
982
  }) {
973
983
  const i = n && n.length > 0;
974
- return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */ O(
984
+ return /* @__PURE__ */ s(hn, { ...e, children: /* @__PURE__ */ j(
975
985
  "form",
976
986
  {
977
987
  onSubmit: e.handleSubmit(t),
978
- className: f(We.root, r),
988
+ className: m(We.root, r),
979
989
  style: o,
980
990
  children: [
981
991
  i && /* @__PURE__ */ s("ul", { className: We.formErrors, role: "alert", children: n.map((l, a) => /* @__PURE__ */ s("li", { className: We.formError, children: l }, a)) }),
@@ -1002,27 +1012,27 @@ function Wl({
1002
1012
  style: l,
1003
1013
  children: a
1004
1014
  }) {
1005
- const { control: h } = mn(), { field: u, fieldState: d } = fn({ name: e, control: h, rules: o }), m = a.type, p = typeof m == "string" ? "" : m?.displayName ?? m?.name ?? "", S = Yo.has(p), { ref: k, ...T } = u, N = re(k);
1006
- N.current = k;
1007
- const I = fe(
1008
- (C) => {
1009
- if (C) {
1010
- const X = C.matches("input, select, textarea, button, [tabindex]") ? C : C.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1011
- N.current(X ?? C);
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);
1012
1022
  } else
1013
- N.current(null);
1023
+ w.current(null);
1014
1024
  },
1015
1025
  // eslint-disable-next-line react-hooks/exhaustive-deps
1016
1026
  []
1017
1027
  );
1018
- return /* @__PURE__ */ O("div", { className: f(We.field, c?.field, i), style: l, children: [
1019
- t && /* @__PURE__ */ O("label", { className: f(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: [
1020
1030
  t,
1021
1031
  r && /* @__PURE__ */ s("span", { className: We.required, children: "*" })
1022
1032
  ] }),
1023
1033
  Xt(a, {
1024
- ...T,
1025
- ref: I,
1034
+ ...R,
1035
+ ref: J,
1026
1036
  id: e,
1027
1037
  error: !!d.error,
1028
1038
  "aria-invalid": d.error ? !0 : void 0,
@@ -1030,18 +1040,18 @@ function Wl({
1030
1040
  // Bridge for custom components that use onValueChange/onValuesChange (Select, Dropdown).
1031
1041
  // Skip for native-input wrappers (Input, Textarea, Checkbox, Radio) so the unknown
1032
1042
  // handler doesn't leak onto the DOM and trip React's "Unknown event handler" warning.
1033
- ...S && {
1034
- onValueChange: T.onChange,
1035
- onValuesChange: T.onChange
1043
+ ...L && {
1044
+ onValueChange: R.onChange,
1045
+ onValuesChange: R.onChange
1036
1046
  },
1037
1047
  // Bridge for Checkbox (expects checked, not value)
1038
- checked: typeof T.value == "boolean" ? T.value : void 0
1048
+ checked: typeof R.value == "boolean" ? R.value : void 0
1039
1049
  }),
1040
- d.error?.message ? /* @__PURE__ */ s("span", { id: `${e}-error`, className: f(We.error, c?.error), role: "alert", children: d.error.message }) : n ? /* @__PURE__ */ s("span", { id: `${e}-helper`, className: f(We.helperText, c?.helperText), children: n }) : null
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
1041
1051
  ] });
1042
1052
  }
1043
1053
  function Hl({ children: e, className: t, style: n }) {
1044
- return /* @__PURE__ */ s("div", { className: f(We.row, t), style: n, children: e });
1054
+ return /* @__PURE__ */ s("div", { className: m(We.row, t), style: n, children: e });
1045
1055
  }
1046
1056
  const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo = "crk-md-F4B0G", Ko = "crk-lg-pBxwX", Qo = "crk-error-fucxe", Jo = "crk-prefix-w53Md", ei = "crk-suffix-fcNgR", ti = "crk-hasPrefix--bqPD", ni = "crk-hasSuffix-zO0nX", Pe = {
1047
1057
  root: Vo,
@@ -1069,7 +1079,7 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1069
1079
  "input",
1070
1080
  {
1071
1081
  ref: a,
1072
- className: f(
1082
+ className: m(
1073
1083
  Pe.root,
1074
1084
  Pe[e],
1075
1085
  t && Pe.error,
@@ -1082,22 +1092,22 @@ const Vo = "crk-root-rSgdy", qo = "crk-wrapper-GHy8V", Go = "crk-sm-DptM5", Zo =
1082
1092
  ...l
1083
1093
  }
1084
1094
  );
1085
- return n || r ? /* @__PURE__ */ O(
1095
+ return n || r ? /* @__PURE__ */ j(
1086
1096
  "div",
1087
1097
  {
1088
- className: f(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, c),
1098
+ className: m(Pe.wrapper, Pe[e], t && Pe.error, o?.wrapper, c),
1089
1099
  style: i,
1090
1100
  children: [
1091
- n && /* @__PURE__ */ s("span", { className: f(Pe.prefix, o?.prefix), children: n }),
1101
+ n && /* @__PURE__ */ s("span", { className: m(Pe.prefix, o?.prefix), children: n }),
1092
1102
  h,
1093
- r && /* @__PURE__ */ s("span", { className: f(Pe.suffix, o?.suffix), children: r })
1103
+ r && /* @__PURE__ */ s("span", { className: m(Pe.suffix, o?.suffix), children: r })
1094
1104
  ]
1095
1105
  }
1096
1106
  ) : h;
1097
1107
  }
1098
1108
  );
1099
1109
  ri.displayName = "Input";
1100
- 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", wi = "crk-menuItems-VrZnE", Mi = "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 = {
1101
1111
  wrapper: oi,
1102
1112
  sm: ii,
1103
1113
  md: ci,
@@ -1116,13 +1126,13 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1116
1126
  visuallyHidden: bi,
1117
1127
  menu: xi,
1118
1128
  menuEnter: ki,
1119
- menuItems: wi,
1120
- item: Mi,
1129
+ menuItems: Mi,
1130
+ item: wi,
1121
1131
  itemHighlighted: $i,
1122
1132
  itemDisabled: Ni,
1123
1133
  itemSelected: Li,
1124
- noResults: Si,
1125
- multiTrigger: Ri,
1134
+ noResults: Ri,
1135
+ multiTrigger: Si,
1126
1136
  multiTriggerDisabled: Ti,
1127
1137
  chip: Ci,
1128
1138
  chipLabel: Ai,
@@ -1144,12 +1154,12 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1144
1154
  searchPlaceholder: h,
1145
1155
  onValueChange: u,
1146
1156
  ...d
1147
- }, m) => /* @__PURE__ */ O("div", { className: f(W.wrapper, W[e], t && W.error, o?.wrapper, c), style: i, children: [
1148
- /* @__PURE__ */ O(
1157
+ }, f) => /* @__PURE__ */ j("div", { className: m(P.wrapper, P[e], t && P.error, o?.wrapper, c), style: i, children: [
1158
+ /* @__PURE__ */ j(
1149
1159
  "select",
1150
1160
  {
1151
- ref: m,
1152
- className: f(W.root, W[e], t && W.error, o?.root),
1161
+ ref: f,
1162
+ className: m(P.root, P[e], t && P.error, o?.root),
1153
1163
  ...d,
1154
1164
  children: [
1155
1165
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
@@ -1157,7 +1167,7 @@ const oi = "crk-wrapper-SP2JE", ii = "crk-sm-DqshL", ci = "crk-md-j4AKI", li = "
1157
1167
  ]
1158
1168
  }
1159
1169
  ),
1160
- /* @__PURE__ */ s("span", { className: f(W.arrow, o?.arrow) })
1170
+ /* @__PURE__ */ s("span", { className: m(P.arrow, o?.arrow) })
1161
1171
  ] })
1162
1172
  );
1163
1173
  Qt.displayName = "NativeSelect";
@@ -1175,85 +1185,85 @@ const Jt = $e(
1175
1185
  id: h,
1176
1186
  searchPlaceholder: u = "Search...",
1177
1187
  onChange: d,
1178
- onValueChange: m,
1188
+ onValueChange: f,
1179
1189
  portal: p = !0
1180
- }, S) => {
1181
- const [k, T] = Le(!1), [N, I] = Le(""), [C, X] = Le(0), Q = re(null), P = re(null), L = re(null), J = re(null), le = re(null), w = Ye(), q = Tt(L, k && p), oe = re(null), ee = S ?? oe, z = re(!1);
1190
+ }, L) => {
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);
1182
1192
  Ne(() => {
1183
- z.current && !k && L.current?.focus(), z.current = k;
1184
- }, [k]);
1185
- const Y = fe(() => {
1186
- T(!1), I(""), X(0);
1187
- }, []), H = fe(() => {
1188
- a || (T(!0), I(""), X(0), setTimeout(() => P.current?.focus(), 0));
1189
- }, [a]), te = fe(
1190
- (M) => {
1191
- if (m?.(M), ee.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) {
1192
1202
  Object.getOwnPropertyDescriptor(
1193
1203
  HTMLSelectElement.prototype,
1194
1204
  "value"
1195
- )?.set?.call(ee.current, M);
1196
- const x = new Event("change", { bubbles: !0 });
1197
- ee.current.dispatchEvent(x), d?.(x);
1205
+ )?.set?.call(re.current, N);
1206
+ const v = new Event("change", { bubbles: !0 });
1207
+ re.current.dispatchEvent(v), d?.(v);
1198
1208
  }
1199
- Y();
1209
+ X();
1200
1210
  },
1201
- [m, d, ee, Y]
1202
- ), ie = ke(() => {
1203
- if (!N) return n;
1204
- const M = N.toLowerCase();
1205
- return n.filter((y) => y.label.toLowerCase().includes(M));
1206
- }, [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]);
1207
1217
  Ne(() => {
1208
- const M = ie.findIndex((y) => !y.disabled);
1209
- X(M >= 0 ? M : 0);
1210
- }, [ie]), Ne(() => {
1211
- if (!k) return;
1212
- const M = le.current;
1213
- if (!M) return;
1214
- M.querySelectorAll('[role="option"]')[C]?.scrollIntoView?.({ block: "nearest" });
1215
- }, [C, k]);
1216
- const pe = fe(
1217
- (M) => {
1218
- const y = ie.map((x, A) => x.disabled ? -1 : A).filter((x) => x >= 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);
1219
1229
  if (y.length !== 0)
1220
- if (M.key === "ArrowDown")
1221
- M.preventDefault(), X((x) => {
1222
- const A = y.indexOf(x);
1223
- return A < y.length - 1 ? y[A + 1] : y[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];
1224
1234
  });
1225
- else if (M.key === "ArrowUp")
1226
- M.preventDefault(), X((x) => {
1227
- const A = y.indexOf(x);
1228
- return A > 0 ? y[A - 1] : y[y.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];
1229
1239
  });
1230
- else if (M.key === "Enter") {
1231
- M.preventDefault();
1232
- const x = ie[C];
1233
- x && !x.disabled && te(x.value);
1234
- } else M.key === "Escape" && (M.preventDefault(), Y());
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());
1235
1245
  },
1236
- [ie, C, te, Y]
1246
+ [ce, W, z, X]
1237
1247
  );
1238
1248
  Ne(() => {
1239
- if (!k) return;
1240
- const M = (y) => {
1241
- const x = y.target;
1242
- Q.current?.contains(x) || J.current?.contains(x) || Y();
1249
+ if (!b) return;
1250
+ const N = (y) => {
1251
+ const v = y.target;
1252
+ Z.current?.contains(v) || ie.current?.contains(v) || X();
1243
1253
  };
1244
- return document.addEventListener("mousedown", M), () => document.removeEventListener("mousedown", M);
1245
- }, [k, Y]);
1246
- const G = n.find((M) => M.value === l)?.label, F = ie.filter((M) => !M.disabled);
1247
- return /* @__PURE__ */ O(
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(
1248
1258
  "div",
1249
1259
  {
1250
- ref: Q,
1251
- className: f(
1252
- W.wrapper,
1253
- W.searchableWrapper,
1254
- W[e],
1255
- t && W.error,
1256
- a && W.disabled,
1260
+ ref: Z,
1261
+ className: m(
1262
+ P.wrapper,
1263
+ P.searchableWrapper,
1264
+ P[e],
1265
+ t && P.error,
1266
+ a && P.disabled,
1257
1267
  o?.wrapper,
1258
1268
  c
1259
1269
  ),
@@ -1262,104 +1272,104 @@ const Jt = $e(
1262
1272
  /* @__PURE__ */ s(
1263
1273
  "select",
1264
1274
  {
1265
- ref: ee,
1266
- className: W.hiddenSelect,
1275
+ ref: re,
1276
+ className: P.hiddenSelect,
1267
1277
  value: l ?? "",
1268
1278
  disabled: a,
1269
1279
  tabIndex: -1,
1270
1280
  "aria-hidden": "true",
1271
1281
  onChange: () => {
1272
1282
  },
1273
- 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))
1274
1284
  }
1275
1285
  ),
1276
- /* @__PURE__ */ O(
1286
+ /* @__PURE__ */ j(
1277
1287
  "button",
1278
1288
  {
1279
- ref: L,
1289
+ ref: $,
1280
1290
  id: h,
1281
1291
  type: "button",
1282
- className: f(
1283
- W.root,
1284
- W.searchableTrigger,
1285
- W[e],
1286
- k && W.triggerOpen,
1287
- t && W.error,
1288
- k && W.visuallyHidden,
1292
+ className: m(
1293
+ P.root,
1294
+ P.searchableTrigger,
1295
+ P[e],
1296
+ b && P.triggerOpen,
1297
+ t && P.error,
1298
+ b && P.visuallyHidden,
1289
1299
  o?.root
1290
1300
  ),
1291
- onClick: H,
1301
+ onClick: A,
1292
1302
  disabled: a,
1293
- "aria-expanded": k,
1303
+ "aria-expanded": b,
1294
1304
  "aria-haspopup": "listbox",
1295
- "aria-controls": k ? w : void 0,
1305
+ "aria-controls": b ? V : void 0,
1296
1306
  children: [
1297
- /* @__PURE__ */ s("span", { className: f(W.triggerLabel, !G && W.placeholder), children: G || r }),
1298
- /* @__PURE__ */ s("span", { className: f(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) })
1299
1309
  ]
1300
1310
  }
1301
1311
  ),
1302
- k && /* @__PURE__ */ s(
1312
+ b && /* @__PURE__ */ s(
1303
1313
  "input",
1304
1314
  {
1305
- ref: P,
1315
+ ref: C,
1306
1316
  type: "text",
1307
1317
  role: "combobox",
1308
- className: f(
1309
- W.root,
1310
- W.searchableTrigger,
1311
- W[e],
1312
- W.triggerOpen,
1313
- t && W.error,
1318
+ className: m(
1319
+ P.root,
1320
+ P.searchableTrigger,
1321
+ P[e],
1322
+ P.triggerOpen,
1323
+ t && P.error,
1314
1324
  o?.root,
1315
1325
  o?.search
1316
1326
  ),
1317
- placeholder: G || r,
1318
- value: N,
1319
- onChange: (M) => I(M.target.value),
1320
- onKeyDown: pe,
1327
+ placeholder: K || r,
1328
+ value: w,
1329
+ onChange: (N) => J(N.target.value),
1330
+ onKeyDown: me,
1321
1331
  "aria-expanded": !0,
1322
1332
  "aria-haspopup": "listbox",
1323
- "aria-controls": w,
1324
- "aria-activedescendant": F.length > 0 ? `select-option-${ie[C]?.value}` : void 0
1333
+ "aria-controls": V,
1334
+ "aria-activedescendant": H.length > 0 ? `select-option-${ce[W]?.value}` : void 0
1325
1335
  }
1326
1336
  ),
1327
- k && (() => {
1328
- const M = p ? {
1337
+ b && (() => {
1338
+ const N = p ? {
1329
1339
  position: "fixed",
1330
- top: q.top + 4,
1331
- left: q.left,
1340
+ top: ae.top + 4,
1341
+ left: ae.left,
1332
1342
  right: "auto",
1333
- width: q.width,
1343
+ width: ae.width,
1334
1344
  zIndex: "var(--crk-z-floating)"
1335
1345
  } : void 0, y = /* @__PURE__ */ s(
1336
1346
  "div",
1337
1347
  {
1338
- id: w,
1339
- ref: J,
1340
- className: f(W.menu, o?.menu),
1341
- style: M,
1348
+ id: V,
1349
+ ref: ie,
1350
+ className: m(P.menu, o?.menu),
1351
+ style: N,
1342
1352
  role: "listbox",
1343
- children: /* @__PURE__ */ s("div", { className: W.menuItems, ref: le, children: ie.length === 0 ? /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }) : ie.map((x, A) => /* @__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(
1344
1354
  "button",
1345
1355
  {
1346
- id: `select-option-${x.value}`,
1356
+ id: `select-option-${v.value}`,
1347
1357
  type: "button",
1348
1358
  role: "option",
1349
- "aria-selected": x.value === l,
1350
- className: f(
1351
- W.item,
1352
- x.disabled && W.itemDisabled,
1353
- x.value === l && W.itemSelected,
1354
- A === C && W.itemHighlighted,
1359
+ "aria-selected": v.value === l,
1360
+ className: m(
1361
+ P.item,
1362
+ v.disabled && P.itemDisabled,
1363
+ v.value === l && P.itemSelected,
1364
+ B === W && P.itemHighlighted,
1355
1365
  o?.item
1356
1366
  ),
1357
- disabled: x.disabled,
1358
- onClick: () => te(x.value),
1359
- onMouseEnter: () => X(A),
1360
- children: x.content ?? x.label
1367
+ disabled: v.disabled,
1368
+ onClick: () => z(v.value),
1369
+ onMouseEnter: () => E(B),
1370
+ children: v.content ?? v.label
1361
1371
  },
1362
- x.value
1372
+ v.value
1363
1373
  )) })
1364
1374
  }
1365
1375
  );
@@ -1385,97 +1395,98 @@ const en = $e(
1385
1395
  id: h,
1386
1396
  searchPlaceholder: u,
1387
1397
  onValuesChange: d,
1388
- clearSearchOnSelect: m = !0,
1389
- allowCreate: p = !1,
1390
- onCreate: S,
1391
- createLabel: k,
1392
- portal: T = !0
1393
- }, N) => {
1394
- const I = Array.isArray(l) ? l : l ? [l] : [], [C, X] = Le(!1), [Q, P] = Le(""), [L, J] = Le(0), le = re(null), w = re(null), q = re(null), oe = re(null), ee = re(null), z = Ye(), Y = Tt(ee, C && T), H = re(null), te = N ?? H, ie = fe(() => {
1395
- X(!1), P(""), J(0);
1396
- }, []), pe = fe(() => {
1397
- a || (X(!0), P(""), J(0), setTimeout(() => w.current?.focus(), 0));
1398
- }, [a]), G = fe(
1399
- (v) => {
1400
- const D = I.includes(v) ? I.filter((U) => U !== v) : [...I, v];
1401
- d?.(D), m && P("");
1398
+ clearSearchOnSelect: f = !0,
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 && $("");
1402
1413
  },
1403
- [I, d, m]
1404
- ), F = fe(
1405
- (v, D) => {
1406
- D.stopPropagation(), d?.(I.filter((U) => U !== v));
1414
+ [W, d, p, me, f]
1415
+ ), N = pe(
1416
+ (k, G) => {
1417
+ G.stopPropagation(), d?.(W.filter((O) => O !== k));
1407
1418
  },
1408
- [I, d]
1409
- ), M = ke(() => {
1410
- if (!Q) return n;
1411
- const v = Q.toLowerCase();
1412
- return n.filter((D) => D.label.toLowerCase().includes(v));
1413
- }, [n, Q]), y = Q.trim(), x = p && y.length > 0 && !n.some(
1414
- (v) => v.label.toLowerCase() === y.toLowerCase() || v.value === y
1415
- ) && !I.includes(y), A = fe(() => {
1416
- y && (I.includes(y) || (S?.(y), d?.([...I, y]), m && P("")));
1417
- }, [y, I, S, d, m]);
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]);
1418
1429
  Ne(() => {
1419
- const v = M.findIndex((D) => !D.disabled);
1420
- J(v >= 0 ? v : 0);
1421
- }, [M]), Ne(() => {
1422
- if (!C) return;
1423
- const v = oe.current;
1424
- if (!v) return;
1425
- v.querySelectorAll('[role="option"]')[L]?.scrollIntoView?.({ block: "nearest" });
1426
- }, [L, C]);
1427
- const j = M.length, K = fe(
1428
- (v) => {
1429
- const D = M.map((U, de) => U.disabled ? -1 : de).filter((U) => U >= 0);
1430
- if (x && D.push(j), v.key === "Backspace" && Q === "" && I.length > 0) {
1431
- v.preventDefault(), d?.(I.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));
1432
1443
  return;
1433
1444
  }
1434
- if (D.length !== 0)
1435
- if (v.key === "ArrowDown") {
1436
- if (v.preventDefault(), !C) {
1437
- pe();
1445
+ if (G.length !== 0)
1446
+ if (k.key === "ArrowDown") {
1447
+ if (k.preventDefault(), !E) {
1448
+ K();
1438
1449
  return;
1439
1450
  }
1440
- J((U) => {
1441
- const de = D.indexOf(U);
1442
- return de < D.length - 1 ? D[de + 1] : D[0];
1451
+ ne((O) => {
1452
+ const le = G.indexOf(O);
1453
+ return le < G.length - 1 ? G[le + 1] : G[0];
1443
1454
  });
1444
- } else if (v.key === "ArrowUp")
1445
- v.preventDefault(), J((U) => {
1446
- const de = D.indexOf(U);
1447
- return de > 0 ? D[de - 1] : D[D.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];
1448
1459
  });
1449
- else if (v.key === "Enter") {
1450
- if (v.preventDefault(), x && L === j) {
1451
- A();
1460
+ else if (k.key === "Enter") {
1461
+ if (k.preventDefault(), B && ie === q) {
1462
+ _();
1452
1463
  return;
1453
1464
  }
1454
- const U = M[L];
1455
- U && !U.disabled ? G(U.value) : x && A();
1456
- } else v.key === "Escape" && (v.preventDefault(), ie());
1465
+ const O = y[ie];
1466
+ O && !O.disabled ? H(O.value) : B && _();
1467
+ } else k.key === "Escape" && (k.preventDefault(), me());
1457
1468
  },
1458
- [M, L, G, ie, Q, I, d, C, pe, x, A, j]
1469
+ [y, ie, H, me, C, W, d, E, K, B, _, q]
1459
1470
  );
1460
1471
  Ne(() => {
1461
- if (!C) return;
1462
- const v = (D) => {
1463
- const U = D.target;
1464
- le.current?.contains(U) || q.current?.contains(U) || ie();
1472
+ if (!E) return;
1473
+ const k = (G) => {
1474
+ const O = G.target;
1475
+ V.current?.contains(O) || S.current?.contains(O) || me();
1465
1476
  };
1466
- return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
1467
- }, [C, ie]);
1468
- const _ = I.map((v) => n.find((U) => U.value === v) ?? { value: v, label: v });
1469
- return /* @__PURE__ */ O(
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(
1470
1481
  "div",
1471
1482
  {
1472
- ref: le,
1473
- className: f(
1474
- W.wrapper,
1475
- W.searchableWrapper,
1476
- W[e],
1477
- t && W.error,
1478
- a && W.disabled,
1483
+ ref: V,
1484
+ className: m(
1485
+ P.wrapper,
1486
+ P.searchableWrapper,
1487
+ P[e],
1488
+ t && P.error,
1489
+ a && P.disabled,
1479
1490
  o?.wrapper,
1480
1491
  c
1481
1492
  ),
@@ -1484,135 +1495,135 @@ const en = $e(
1484
1495
  /* @__PURE__ */ s(
1485
1496
  "select",
1486
1497
  {
1487
- ref: te,
1488
- className: W.hiddenSelect,
1498
+ ref: ce,
1499
+ className: P.hiddenSelect,
1489
1500
  multiple: !0,
1490
- value: I,
1501
+ value: W,
1491
1502
  disabled: a,
1492
1503
  tabIndex: -1,
1493
1504
  "aria-hidden": "true",
1494
1505
  onChange: () => {
1495
1506
  },
1496
- children: n.map((v) => /* @__PURE__ */ s("option", { value: v.value, children: v.label }, v.value))
1507
+ children: n.map((k) => /* @__PURE__ */ s("option", { value: k.value, children: k.label }, k.value))
1497
1508
  }
1498
1509
  ),
1499
- /* @__PURE__ */ O(
1510
+ /* @__PURE__ */ j(
1500
1511
  "div",
1501
1512
  {
1502
- ref: ee,
1503
- className: f(
1504
- W.multiTrigger,
1505
- W[e],
1506
- C && W.triggerOpen,
1507
- t && W.error,
1508
- a && W.multiTriggerDisabled,
1513
+ ref: F,
1514
+ className: m(
1515
+ P.multiTrigger,
1516
+ P[e],
1517
+ E && P.triggerOpen,
1518
+ t && P.error,
1519
+ a && P.multiTriggerDisabled,
1509
1520
  o?.root
1510
1521
  ),
1511
1522
  onClick: () => {
1512
- C ? w.current?.focus() : pe();
1523
+ E ? ae.current?.focus() : K();
1513
1524
  },
1514
1525
  role: "combobox",
1515
- "aria-expanded": C,
1526
+ "aria-expanded": E,
1516
1527
  "aria-haspopup": "listbox",
1517
- "aria-controls": C ? z : void 0,
1528
+ "aria-controls": E ? X : void 0,
1518
1529
  children: [
1519
- _.map((v) => /* @__PURE__ */ O("span", { className: f(W.chip, o?.chip), children: [
1520
- /* @__PURE__ */ s("span", { className: W.chipLabel, children: v.content ?? v.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 }),
1521
1532
  /* @__PURE__ */ s(
1522
1533
  "button",
1523
1534
  {
1524
1535
  type: "button",
1525
- className: f(W.chipRemove, o?.chipRemove),
1526
- onClick: (D) => F(v.value, D),
1527
- "aria-label": `Remove ${v.label}`,
1536
+ className: m(P.chipRemove, o?.chipRemove),
1537
+ onClick: (G) => N(k.value, G),
1538
+ "aria-label": `Remove ${k.label}`,
1528
1539
  tabIndex: -1,
1529
1540
  children: "×"
1530
1541
  }
1531
1542
  )
1532
- ] }, v.value)),
1543
+ ] }, k.value)),
1533
1544
  /* @__PURE__ */ s(
1534
1545
  "input",
1535
1546
  {
1536
- ref: w,
1547
+ ref: ae,
1537
1548
  id: h,
1538
1549
  type: "text",
1539
- className: W.multiSearch,
1540
- placeholder: I.length === 0 ? r : "",
1541
- value: Q,
1542
- onChange: (v) => {
1543
- P(v.target.value), C || pe();
1550
+ className: P.multiSearch,
1551
+ placeholder: W.length === 0 ? r : "",
1552
+ value: C,
1553
+ onChange: (k) => {
1554
+ $(k.target.value), E || K();
1544
1555
  },
1545
- onKeyDown: K,
1556
+ onKeyDown: U,
1546
1557
  disabled: a,
1547
1558
  "aria-label": "Search options"
1548
1559
  }
1549
1560
  ),
1550
- /* @__PURE__ */ s("span", { className: f(W.arrow, W.arrowMulti, o?.arrow) })
1561
+ /* @__PURE__ */ s("span", { className: m(P.arrow, P.arrowMulti, o?.arrow) })
1551
1562
  ]
1552
1563
  }
1553
1564
  ),
1554
- C && (() => {
1555
- const v = T ? {
1565
+ E && (() => {
1566
+ const k = w ? {
1556
1567
  position: "fixed",
1557
- top: Y.top + 4,
1558
- left: Y.left,
1568
+ top: A.top + 4,
1569
+ left: A.left,
1559
1570
  right: "auto",
1560
- width: Y.width,
1571
+ width: A.width,
1561
1572
  zIndex: "var(--crk-z-floating)"
1562
- } : void 0, D = /* @__PURE__ */ s(
1573
+ } : void 0, G = /* @__PURE__ */ s(
1563
1574
  "div",
1564
1575
  {
1565
- id: z,
1566
- ref: q,
1567
- className: f(W.menu, o?.menu),
1568
- style: v,
1576
+ id: X,
1577
+ ref: S,
1578
+ className: m(P.menu, o?.menu),
1579
+ style: k,
1569
1580
  role: "listbox",
1570
1581
  "aria-multiselectable": "true",
1571
- children: /* @__PURE__ */ O("div", { className: W.menuItems, ref: oe, children: [
1572
- M.length === 0 && !x && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
1573
- M.map((U, de) => {
1574
- const he = I.includes(U.value);
1575
- return /* @__PURE__ */ O(
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(
1576
1587
  "button",
1577
1588
  {
1578
- id: `select-option-${U.value}`,
1589
+ id: `select-option-${O.value}`,
1579
1590
  type: "button",
1580
1591
  role: "option",
1581
- "aria-selected": he,
1582
- className: f(
1583
- W.item,
1584
- U.disabled && W.itemDisabled,
1585
- he && W.itemSelected,
1586
- de === L && W.itemHighlighted,
1592
+ "aria-selected": ge,
1593
+ className: m(
1594
+ P.item,
1595
+ O.disabled && P.itemDisabled,
1596
+ ge && P.itemSelected,
1597
+ le === ie && P.itemHighlighted,
1587
1598
  o?.item
1588
1599
  ),
1589
- disabled: U.disabled,
1590
- onClick: () => G(U.value),
1591
- onMouseEnter: () => J(de),
1600
+ disabled: O.disabled,
1601
+ onClick: () => H(O.value),
1602
+ onMouseEnter: () => ne(le),
1592
1603
  children: [
1593
- he && /* @__PURE__ */ s("span", { className: W.itemCheck, "aria-hidden": "true" }),
1594
- U.content ?? U.label
1604
+ ge && /* @__PURE__ */ s("span", { className: P.itemCheck, "aria-hidden": "true" }),
1605
+ O.content ?? O.label
1595
1606
  ]
1596
1607
  },
1597
- U.value
1608
+ O.value
1598
1609
  );
1599
1610
  }),
1600
- x && /* @__PURE__ */ s(
1611
+ B && /* @__PURE__ */ s(
1601
1612
  "button",
1602
1613
  {
1603
1614
  type: "button",
1604
1615
  role: "option",
1605
1616
  "aria-selected": !1,
1606
- className: f(
1607
- W.item,
1608
- L === j && W.itemHighlighted,
1617
+ className: m(
1618
+ P.item,
1619
+ ie === q && P.itemHighlighted,
1609
1620
  o?.item
1610
1621
  ),
1611
- onClick: A,
1612
- onMouseEnter: () => J(j),
1613
- children: k ? k(y) : /* @__PURE__ */ O(je, { children: [
1622
+ onClick: _,
1623
+ onMouseEnter: () => ne(q),
1624
+ children: R ? R(v) : /* @__PURE__ */ j(je, { children: [
1614
1625
  "Create “",
1615
- /* @__PURE__ */ s("strong", { children: y }),
1626
+ /* @__PURE__ */ s("strong", { children: v }),
1616
1627
  "”"
1617
1628
  ] })
1618
1629
  },
@@ -1621,7 +1632,7 @@ const en = $e(
1621
1632
  ] })
1622
1633
  }
1623
1634
  );
1624
- return T && typeof document < "u" ? pt(D, document.body) : D;
1635
+ return w && typeof document < "u" ? pt(G, document.body) : G;
1625
1636
  })()
1626
1637
  ]
1627
1638
  }
@@ -1647,13 +1658,13 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1647
1658
  style: o,
1648
1659
  ...c
1649
1660
  }, i) => {
1650
- const l = re(null);
1661
+ const l = oe(null);
1651
1662
  return Ne(() => {
1652
1663
  l.current && (l.current.indeterminate = t);
1653
- }, [t]), /* @__PURE__ */ O(
1664
+ }, [t]), /* @__PURE__ */ j(
1654
1665
  "label",
1655
1666
  {
1656
- className: f(dt.root, t && dt.indeterminate, n?.root, r),
1667
+ className: m(dt.root, t && dt.indeterminate, n?.root, r),
1657
1668
  style: o,
1658
1669
  children: [
1659
1670
  /* @__PURE__ */ s(
@@ -1663,11 +1674,11 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1663
1674
  l.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
1664
1675
  },
1665
1676
  type: "checkbox",
1666
- className: f(dt.input, n?.input),
1677
+ className: m(dt.input, n?.input),
1667
1678
  ...c
1668
1679
  }
1669
1680
  ),
1670
- e && /* @__PURE__ */ s("span", { className: f(dt.label, n?.label), children: e })
1681
+ e && /* @__PURE__ */ s("span", { className: m(dt.label, n?.label), children: e })
1671
1682
  ]
1672
1683
  }
1673
1684
  );
@@ -1694,7 +1705,7 @@ const ji = "crk-group-NNwCD", Xi = "crk-root-7fGik", _i = "crk-input-43PQW", Ui
1694
1705
  "div",
1695
1706
  {
1696
1707
  id: i,
1697
- className: f(ht.group, r),
1708
+ className: m(ht.group, r),
1698
1709
  style: o,
1699
1710
  role: "radiogroup",
1700
1711
  tabIndex: -1,
@@ -1717,24 +1728,24 @@ const Vi = $e(
1717
1728
  name: l,
1718
1729
  ...a
1719
1730
  }, h) => {
1720
- const u = ft(tn), d = u?.name ?? l, m = u ? u.value === t : i, p = (S) => {
1721
- u?.onChange?.(t), c?.(S);
1731
+ const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, p = (L) => {
1732
+ u?.onChange?.(t), c?.(L);
1722
1733
  };
1723
- return /* @__PURE__ */ O("label", { className: f(ht.root, n?.root, r), style: o, children: [
1734
+ return /* @__PURE__ */ j("label", { className: m(ht.root, n?.root, r), style: o, children: [
1724
1735
  /* @__PURE__ */ s(
1725
1736
  "input",
1726
1737
  {
1727
1738
  ref: h,
1728
1739
  type: "radio",
1729
- className: f(ht.input, n?.input),
1740
+ className: m(ht.input, n?.input),
1730
1741
  name: d,
1731
1742
  value: t,
1732
- checked: m,
1743
+ checked: f,
1733
1744
  onChange: p,
1734
1745
  ...a
1735
1746
  }
1736
1747
  ),
1737
- e && /* @__PURE__ */ s("span", { className: f(ht.label, n?.label), children: e })
1748
+ e && /* @__PURE__ */ s("span", { className: m(ht.label, n?.label), children: e })
1738
1749
  ] });
1739
1750
  }
1740
1751
  );
@@ -1766,14 +1777,14 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1766
1777
  onChange: i,
1767
1778
  ...l
1768
1779
  }, a) => {
1769
- const h = re(null), u = fe(() => {
1780
+ const h = oe(null), u = pe(() => {
1770
1781
  const p = h.current;
1771
1782
  p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1772
1783
  }, []), d = l.value ?? "";
1773
1784
  Ne(() => {
1774
1785
  r && u();
1775
1786
  }, [r, u, d]);
1776
- const m = fe(
1787
+ const f = pe(
1777
1788
  (p) => {
1778
1789
  r && u(), i?.(p);
1779
1790
  },
@@ -1785,7 +1796,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1785
1796
  ref: (p) => {
1786
1797
  h.current = p, typeof a == "function" ? a(p) : a && (a.current = p);
1787
1798
  },
1788
- className: f(
1799
+ className: m(
1789
1800
  Ke.root,
1790
1801
  Ke[e],
1791
1802
  t && Ke.error,
@@ -1793,7 +1804,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1793
1804
  o
1794
1805
  ),
1795
1806
  style: c,
1796
- onChange: m,
1807
+ onChange: f,
1797
1808
  rows: l.rows ?? 1,
1798
1809
  ...l
1799
1810
  }
@@ -1802,13 +1813,13 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1802
1813
  );
1803
1814
  ic.displayName = "Textarea";
1804
1815
  function cc(e, t = { width: 600, height: 300 }) {
1805
- const [n, r] = Le(t), o = re(t);
1816
+ const [n, r] = Le(t), o = oe(t);
1806
1817
  return Ne(() => {
1807
1818
  const c = e.current;
1808
1819
  if (!c || typeof ResizeObserver > "u") return;
1809
1820
  const i = (h, u) => {
1810
- const d = Math.max(0, Math.round(h)), m = Math.max(0, Math.round(u));
1811
- o.current.width === d && o.current.height === m || (o.current = { width: d, height: m }, r({ width: d, height: m }));
1821
+ const d = Math.max(0, Math.round(h)), f = Math.max(0, Math.round(u));
1822
+ o.current.width === d && o.current.height === f || (o.current = { width: d, height: f }, r({ width: d, height: f }));
1812
1823
  }, l = c.getBoundingClientRect();
1813
1824
  (l.width > 0 || l.height > 0) && i(l.width, l.height);
1814
1825
  const a = new ResizeObserver((h) => {
@@ -1820,7 +1831,7 @@ function cc(e, t = { width: 600, height: 300 }) {
1820
1831
  return a.observe(c), () => a.disconnect();
1821
1832
  }, [e]), n;
1822
1833
  }
1823
- 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", wc = "crk-legendItem-rcdvO", Mc = "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", $ = {
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 = {
1824
1835
  root: lc,
1825
1836
  canvas: sc,
1826
1837
  svg: ac,
@@ -1836,13 +1847,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1836
1847
  activeBar: bc,
1837
1848
  interactionLayer: xc,
1838
1849
  legend: kc,
1839
- legendItem: wc,
1840
- legendSwatch: Mc,
1850
+ legendItem: Mc,
1851
+ legendSwatch: wc,
1841
1852
  legendIcon: $c,
1842
1853
  legendLabel: Nc,
1843
1854
  tooltip: Lc,
1844
- tooltipTitle: Sc,
1845
- tooltipRows: Rc,
1855
+ tooltipTitle: Rc,
1856
+ tooltipRows: Sc,
1846
1857
  tooltipRow: Tc,
1847
1858
  tooltipLabel: Cc,
1848
1859
  tooltipValue: Ac,
@@ -1851,26 +1862,26 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1851
1862
  tradingHeader: Dc
1852
1863
  }, Ve = $e(
1853
1864
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: c, overlay: i, children: l }, a) => {
1854
- const h = re(null);
1865
+ const h = oe(null);
1855
1866
  un(a, () => h.current);
1856
- const { width: u } = cc(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
1857
- return /* @__PURE__ */ O(
1867
+ const { width: u } = cc(h), d = Math.max(0, u), f = t ?? Math.round(d / e);
1868
+ return /* @__PURE__ */ j(
1858
1869
  "div",
1859
1870
  {
1860
1871
  ref: h,
1861
- className: f($.root, o?.root, n),
1872
+ className: m(M.root, o?.root, n),
1862
1873
  style: r,
1863
1874
  children: [
1864
- /* @__PURE__ */ O("div", { className: $.canvas, style: { height: m || void 0 }, children: [
1865
- d > 0 && m > 0 && /* @__PURE__ */ s(
1875
+ /* @__PURE__ */ j("div", { className: M.canvas, style: { height: f || void 0 }, children: [
1876
+ d > 0 && f > 0 && /* @__PURE__ */ s(
1866
1877
  "svg",
1867
1878
  {
1868
- className: f($.svg, o?.svg),
1879
+ className: m(M.svg, o?.svg),
1869
1880
  width: d,
1870
- height: m,
1871
- viewBox: `0 0 ${d} ${m}`,
1881
+ height: f,
1882
+ viewBox: `0 0 ${d} ${f}`,
1872
1883
  role: "img",
1873
- children: l({ width: d, height: m })
1884
+ children: l({ width: d, height: f })
1874
1885
  }
1875
1886
  ),
1876
1887
  i
@@ -1884,13 +1895,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1884
1895
  Ve.displayName = "ChartContainer";
1885
1896
  function vt({ config: e, order: t, classes: n }) {
1886
1897
  const r = t ?? Object.keys(e);
1887
- return /* @__PURE__ */ s("div", { className: f($.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) => {
1888
1899
  const c = e[o];
1889
- return c ? /* @__PURE__ */ O("div", { className: f($.legendItem, n?.legendItem), role: "listitem", children: [
1900
+ return c ? /* @__PURE__ */ j("div", { className: m(M.legendItem, n?.legendItem), role: "listitem", children: [
1890
1901
  c.icon ? /* @__PURE__ */ s(
1891
1902
  "span",
1892
1903
  {
1893
- className: $.legendIcon,
1904
+ className: M.legendIcon,
1894
1905
  style: { color: c.color },
1895
1906
  "aria-hidden": "true",
1896
1907
  children: c.icon
@@ -1898,12 +1909,12 @@ function vt({ config: e, order: t, classes: n }) {
1898
1909
  ) : /* @__PURE__ */ s(
1899
1910
  "span",
1900
1911
  {
1901
- className: $.legendSwatch,
1912
+ className: M.legendSwatch,
1902
1913
  style: { background: c.color },
1903
1914
  "aria-hidden": "true"
1904
1915
  }
1905
1916
  ),
1906
- /* @__PURE__ */ s("span", { className: $.legendLabel, children: c.label })
1917
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: c.label })
1907
1918
  ] }, o) : null;
1908
1919
  }) });
1909
1920
  }
@@ -1920,35 +1931,35 @@ function et({
1920
1931
  classes: h
1921
1932
  }) {
1922
1933
  if (!e) return null;
1923
- const u = 180, m = t + u + 16 > r ? t - u - 12 : t + 12, p = 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);
1924
1935
  return /* @__PURE__ */ s(
1925
1936
  "div",
1926
1937
  {
1927
- className: f($.tooltip, h?.tooltip),
1928
- style: { left: m, top: p, width: u },
1938
+ className: m(M.tooltip, h?.tooltip),
1939
+ style: { left: f, top: p, width: u },
1929
1940
  role: "tooltip",
1930
- children: c ? c(e) : /* @__PURE__ */ O(je, { children: [
1931
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: $.tooltipTitle, children: String(e[l]) }),
1932
- /* @__PURE__ */ s("div", { className: $.tooltipRows, children: Object.entries(o).map(([S, k]) => {
1933
- const T = e[S];
1934
- if (T == null) return null;
1935
- const N = typeof T == "number" ? i(T) : String(T), I = a?.(S) ?? k.color;
1936
- return /* @__PURE__ */ O("div", { className: $.tooltipRow, children: [
1937
- /* @__PURE__ */ s("span", { className: $.legendSwatch, style: { background: I }, "aria-hidden": "true" }),
1938
- /* @__PURE__ */ s("span", { className: $.tooltipLabel, children: k.label }),
1939
- /* @__PURE__ */ s("span", { className: $.tooltipValue, children: N })
1940
- ] }, S);
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 })
1951
+ ] }, L);
1941
1952
  }) })
1942
1953
  ] })
1943
1954
  }
1944
1955
  );
1945
1956
  }
1946
1957
  function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
1947
- return /* @__PURE__ */ s("g", { className: f($.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ O("g", { children: [
1958
+ return /* @__PURE__ */ s("g", { className: m(M.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ j("g", { children: [
1948
1959
  o && /* @__PURE__ */ s(
1949
1960
  "line",
1950
1961
  {
1951
- className: f($.gridLine, c?.grid),
1962
+ className: m(M.gridLine, c?.grid),
1952
1963
  x1: t,
1953
1964
  x2: t + n,
1954
1965
  y1: l,
@@ -1958,7 +1969,7 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1958
1969
  /* @__PURE__ */ s(
1959
1970
  "text",
1960
1971
  {
1961
- className: f($.axisLabel, c?.axisLabel),
1972
+ className: m(M.axisLabel, c?.axisLabel),
1962
1973
  x: t - 8,
1963
1974
  y: l,
1964
1975
  textAnchor: "end",
@@ -1969,10 +1980,10 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1969
1980
  ] }, `y-${i}`)) });
1970
1981
  }
1971
1982
  function rn({ ticks: e, y: t, format: n, classes: r }) {
1972
- return /* @__PURE__ */ s("g", { className: f($.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(
1973
1984
  "text",
1974
1985
  {
1975
- className: f($.axisLabel, r?.axisLabel),
1986
+ className: m(M.axisLabel, r?.axisLabel),
1976
1987
  x: c,
1977
1988
  y: t + 16,
1978
1989
  textAnchor: "middle",
@@ -2051,178 +2062,178 @@ function Ol({
2051
2062
  showValues: h = !1,
2052
2063
  valuePosition: u = "top",
2053
2064
  renderLabel: d,
2054
- activeIndex: m,
2065
+ activeIndex: f,
2055
2066
  onPointClick: p,
2056
- showGrid: S = !0,
2057
- showLegend: k = !0,
2058
- showTooltip: T = !0,
2059
- yTickCount: N = 5,
2060
- yFormat: I,
2061
- xFormat: C,
2062
- valueFormat: X,
2063
- renderTooltip: Q,
2064
- margin: P,
2065
- emptyMessage: L = "No data",
2066
- className: J,
2067
- style: le,
2068
- classes: w
2067
+ showGrid: L = !0,
2068
+ showLegend: b = !0,
2069
+ showTooltip: R = !0,
2070
+ yTickCount: w = 5,
2071
+ yFormat: J,
2072
+ xFormat: W,
2073
+ valueFormat: E,
2074
+ renderTooltip: Z,
2075
+ margin: C,
2076
+ emptyMessage: $ = "No data",
2077
+ className: ie,
2078
+ style: ne,
2079
+ classes: V
2069
2080
  }) {
2070
- const q = { ...Ec, ...P }, oe = ke(() => Object.keys(n), [n]), [ee, z] = Le(null), Y = re(null), H = m ?? ee, te = (pe, G) => {
2081
+ const ae = { ...Ec, ...C }, S = ke(() => Object.keys(n), [n]), [re, F] = Le(null), X = oe(null), A = f ?? re, z = (me, K) => {
2071
2082
  if (l) {
2072
- const F = e[G]?.[l];
2073
- if (typeof F == "string") return F;
2083
+ const H = e[K]?.[l];
2084
+ if (typeof H == "string") return H;
2074
2085
  }
2075
- return n[pe]?.color ?? "var(--crk-chart-1)";
2086
+ return n[me]?.color ?? "var(--crk-chart-1)";
2076
2087
  };
2077
2088
  if (e.length === 0)
2078
- return /* @__PURE__ */ s("div", { ref: Y, className: f($.root, w?.root, J), style: le, children: /* @__PURE__ */ s("div", { className: $.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: $.empty, children: L }) }) });
2079
- const ie = T && H !== 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(
2080
2091
  et,
2081
2092
  {
2082
- row: e[H],
2083
- x: Hc(e, t, q, H, Y),
2093
+ row: e[A],
2094
+ x: Hc(e, t, ae, A, X),
2084
2095
  y: 16,
2085
- containerWidth: Y.current?.getBoundingClientRect().width ?? 0,
2096
+ containerWidth: X.current?.getBoundingClientRect().width ?? 0,
2086
2097
  config: n,
2087
- render: Q ? () => Q(e[H]) : void 0,
2088
- valueFormat: X,
2098
+ render: Z ? () => Z(e[A]) : void 0,
2099
+ valueFormat: E,
2089
2100
  titleKey: t,
2090
- resolveColor: l ? (pe) => te(pe, H) : void 0,
2091
- classes: w
2101
+ resolveColor: l ? (me) => z(me, A) : void 0,
2102
+ classes: V
2092
2103
  }
2093
2104
  ) : null;
2094
2105
  return /* @__PURE__ */ s(
2095
2106
  Ve,
2096
2107
  {
2097
- ref: Y,
2108
+ ref: X,
2098
2109
  aspectRatio: r,
2099
2110
  height: o,
2100
- className: J,
2101
- style: le,
2102
- classes: w,
2103
- legend: k ? /* @__PURE__ */ s(vt, { config: n, classes: w }) : void 0,
2104
- overlay: ie,
2105
- children: ({ width: pe, height: G }) => {
2106
- const F = q.left, M = pe - q.right, y = q.top, x = G - q.bottom, A = Math.max(0, M - F), j = Math.max(0, x - y), K = e.map((g) => String(g[t])), _ = Xe(K, [F, M], 0), v = [];
2107
- for (const g of oe)
2108
- for (const b of e) {
2109
- const ne = b[g];
2110
- typeof ne == "number" && v.push(ne);
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)
2119
+ for (const x of e) {
2120
+ const te = x[g];
2121
+ typeof te == "number" && ee.push(te);
2111
2122
  }
2112
- const [D, U] = bt(v), de = Math.min(0, D), he = qe(de, U, N), ye = Je([he[0], he[he.length - 1]], [x, y]), be = he.map((g) => ({ value: g, y: ye(g) })), Se = Wc(K).map((g) => ({ label: g, x: _(g) }));
2113
- return /* @__PURE__ */ O(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: [
2114
2125
  /* @__PURE__ */ s(
2115
2126
  nn,
2116
2127
  {
2117
2128
  ticks: be,
2118
- x: F,
2119
- plotWidth: A,
2120
- format: I,
2121
- showGrid: S,
2122
- classes: w
2129
+ x: H,
2130
+ plotWidth: B,
2131
+ format: J,
2132
+ showGrid: L,
2133
+ classes: V
2123
2134
  }
2124
2135
  ),
2125
- /* @__PURE__ */ s(rn, { ticks: Se, y: x, format: C, classes: w }),
2126
- oe.map((g) => {
2127
- const b = n[g], ne = e.map((E, V) => {
2128
- const B = E[g], me = typeof B == "number" ? B : 0;
2129
- return { x: _(K[V]), y: ye(me), value: me, row: E };
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 };
2130
2141
  });
2131
- return /* @__PURE__ */ O("g", { className: f($.series, w?.series), children: [
2142
+ return /* @__PURE__ */ j("g", { className: m(M.series, V?.series), children: [
2132
2143
  /* @__PURE__ */ s(
2133
2144
  "path",
2134
2145
  {
2135
- className: f($.linePath),
2136
- d: Pc(ne, c),
2137
- stroke: b.color
2146
+ className: m(M.linePath),
2147
+ d: Pc(te, c),
2148
+ stroke: x.color
2138
2149
  }
2139
2150
  ),
2140
- i && ne.map((E, V) => {
2141
- const B = te(g, V), me = H === V, Z = m !== void 0 && !me, R = p ? () => p({ row: E.row, value: E.value, seriesKey: g, index: V }) : 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;
2142
2153
  return a ? /* @__PURE__ */ s(
2143
2154
  "g",
2144
2155
  {
2145
- onClick: R,
2146
- style: R ? { cursor: "pointer" } : void 0,
2147
- opacity: Z ? 0.45 : 1,
2156
+ onClick: T,
2157
+ style: T ? { cursor: "pointer" } : void 0,
2158
+ opacity: Q ? 0.45 : 1,
2148
2159
  children: a({
2149
- row: E.row,
2150
- value: E.value,
2160
+ row: D.row,
2161
+ value: D.value,
2151
2162
  seriesKey: g,
2152
- index: V,
2153
- x: E.x,
2154
- y: E.y,
2155
- color: B,
2156
- active: me
2163
+ index: Y,
2164
+ x: D.x,
2165
+ y: D.y,
2166
+ color: I,
2167
+ active: fe
2157
2168
  })
2158
2169
  },
2159
- `${g}-${V}`
2170
+ `${g}-${Y}`
2160
2171
  ) : /* @__PURE__ */ s(
2161
2172
  "circle",
2162
2173
  {
2163
- className: f($.point, w?.point),
2164
- cx: E.x,
2165
- cy: E.y,
2166
- r: me ? 5 : 3.5,
2167
- fill: B,
2168
- onClick: R,
2169
- style: R ? { cursor: "pointer" } : void 0,
2170
- opacity: Z ? 0.45 : 1
2174
+ className: m(M.point, V?.point),
2175
+ cx: D.x,
2176
+ cy: D.y,
2177
+ r: fe ? 5 : 3.5,
2178
+ fill: I,
2179
+ onClick: T,
2180
+ style: T ? { cursor: "pointer" } : void 0,
2181
+ opacity: Q ? 0.45 : 1
2171
2182
  },
2172
- `${g}-${V}`
2183
+ `${g}-${Y}`
2173
2184
  );
2174
2185
  }),
2175
- (h || d) && ne.map((E, V) => {
2176
- const B = d ? d({ row: E.row, value: E.value, seriesKey: g, index: V }) : h ? X ? X(E.value) : String(E.value) : null;
2177
- if (B == null) return null;
2178
- const me = 10, Z = u === "top" ? E.y - me : E.y + me + 4;
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;
2188
+ if (I == null) return null;
2189
+ const fe = 10, Q = u === "top" ? D.y - fe : D.y + fe + 4;
2179
2190
  return /* @__PURE__ */ s(
2180
2191
  "text",
2181
2192
  {
2182
- className: f($.axisLabel),
2183
- x: E.x,
2184
- y: Z,
2193
+ className: m(M.axisLabel),
2194
+ x: D.x,
2195
+ y: Q,
2185
2196
  textAnchor: "middle",
2186
2197
  dominantBaseline: u === "top" ? "auto" : "middle",
2187
- children: B
2198
+ children: I
2188
2199
  },
2189
- `label-${g}-${V}`
2200
+ `label-${g}-${Y}`
2190
2201
  );
2191
2202
  })
2192
2203
  ] }, g);
2193
2204
  }),
2194
- H !== null && /* @__PURE__ */ s(
2205
+ A !== null && /* @__PURE__ */ s(
2195
2206
  "line",
2196
2207
  {
2197
- className: $.cursorLine,
2198
- x1: _(K[H]),
2199
- x2: _(K[H]),
2208
+ className: M.cursorLine,
2209
+ x1: U(q[A]),
2210
+ x2: U(q[A]),
2200
2211
  y1: y,
2201
- y2: x
2212
+ y2: v
2202
2213
  }
2203
2214
  ),
2204
2215
  /* @__PURE__ */ s(
2205
2216
  "rect",
2206
2217
  {
2207
- className: $.interactionLayer,
2208
- x: F,
2218
+ className: M.interactionLayer,
2219
+ x: H,
2209
2220
  y,
2210
- width: A,
2211
- height: j,
2221
+ width: B,
2222
+ height: _,
2212
2223
  onMouseMove: (g) => {
2213
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left + F, E = _.step(), V = Math.max(
2224
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left + H, D = U.step(), Y = Math.max(
2214
2225
  0,
2215
- Math.min(e.length - 1, Math.round((ne - F - E / 2) / E))
2226
+ Math.min(e.length - 1, Math.round((te - H - D / 2) / D))
2216
2227
  );
2217
- z(V);
2228
+ F(Y);
2218
2229
  },
2219
- onMouseLeave: () => z(null),
2230
+ onMouseLeave: () => F(null),
2220
2231
  onClick: p ? (g) => {
2221
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left + F, E = _.step(), V = Math.max(
2232
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left + H, D = U.step(), Y = Math.max(
2222
2233
  0,
2223
- Math.min(e.length - 1, Math.round((ne - F - E / 2) / E))
2224
- ), B = oe[0], me = e[V][B], Z = typeof me == "number" ? me : 0;
2225
- p({ row: e[V], value: Z, seriesKey: B, index: V });
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 });
2226
2237
  } : void 0,
2227
2238
  style: p ? { cursor: "pointer" } : void 0
2228
2239
  }
@@ -2239,7 +2250,7 @@ function Hc(e, t, n, r, o) {
2239
2250
  return Xe(l, [n.left, i - n.right], 0)(l[r]);
2240
2251
  }
2241
2252
  const Oc = { top: 12, right: 16, bottom: 28, left: 48 };
2242
- function St(e, t) {
2253
+ function Rt(e, t) {
2243
2254
  if (e.length === 0) return "";
2244
2255
  if (e.length === 1) return `M ${e[0].x} ${e[0].y}`;
2245
2256
  if (t === "linear")
@@ -2259,12 +2270,12 @@ function St(e, t) {
2259
2270
  }
2260
2271
  function Dt(e, t, n) {
2261
2272
  if (e.length === 0) return "";
2262
- const r = St(e, n);
2273
+ const r = Rt(e, n);
2263
2274
  if (typeof t == "number") {
2264
2275
  const l = e[e.length - 1], a = e[0];
2265
2276
  return `${r} L ${l.x} ${t} L ${a.x} ${t} Z`;
2266
2277
  }
2267
- 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 ");
2268
2279
  return `${r} ${i} Z`;
2269
2280
  }
2270
2281
  function Fc(e, t = 8) {
@@ -2285,93 +2296,93 @@ function Fl({
2285
2296
  showGrid: h = !0,
2286
2297
  showXAxis: u = !0,
2287
2298
  showYAxis: d = !0,
2288
- showLegend: m = !0,
2299
+ showLegend: f = !0,
2289
2300
  showTooltip: p = !0,
2290
- yTickCount: S = 5,
2291
- yFormat: k,
2292
- xFormat: T,
2293
- valueFormat: N,
2294
- renderTooltip: I,
2295
- margin: C,
2296
- emptyMessage: X = "No data",
2297
- className: Q,
2298
- style: P,
2299
- classes: L
2301
+ yTickCount: L = 5,
2302
+ yFormat: b,
2303
+ xFormat: R,
2304
+ valueFormat: w,
2305
+ renderTooltip: J,
2306
+ margin: W,
2307
+ emptyMessage: E = "No data",
2308
+ className: Z,
2309
+ style: C,
2310
+ classes: $
2300
2311
  }) {
2301
- const J = ke(
2312
+ const ie = ke(
2302
2313
  () => ({
2303
2314
  ...Oc,
2304
2315
  ...d ? {} : { left: 16 },
2305
- ...C
2316
+ ...W
2306
2317
  }),
2307
- [C, d]
2308
- ), le = ke(() => Object.keys(n), [n]), w = i && le.length > 0, q = w && l === "expand", [oe, ee] = Le(null), z = re(null), Y = 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();
2309
2320
  if (e.length === 0)
2310
- return /* @__PURE__ */ s("div", { ref: z, className: f($.root, L?.root, Q), style: P, children: /* @__PURE__ */ s("div", { className: $.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: $.empty, children: X }) }) });
2311
- const H = ke(() => {
2312
- const F = le.map(() => []), M = le.map(() => []);
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 }) }) });
2322
+ const A = ke(() => {
2323
+ const H = ne.map(() => []), N = ne.map(() => []);
2313
2324
  for (let y = 0; y < e.length; y++) {
2314
- let x = 0;
2315
- if (q) {
2316
- for (const j of le) {
2317
- const K = e[y][j];
2318
- typeof K == "number" && K > 0 && (x += K);
2325
+ let v = 0;
2326
+ if (ae) {
2327
+ for (const _ of ne) {
2328
+ const q = e[y][_];
2329
+ typeof q == "number" && q > 0 && (v += q);
2319
2330
  }
2320
- x === 0 && (x = 1);
2331
+ v === 0 && (v = 1);
2321
2332
  }
2322
- let A = 0;
2323
- for (let j = 0; j < le.length; j++) {
2324
- const K = le[j], _ = e[y][K], v = typeof _ == "number" ? _ : 0;
2325
- if (w) {
2326
- const D = q ? v / x : v;
2327
- M[j][y] = A, A += D, F[j][y] = A;
2333
+ let B = 0;
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;
2328
2339
  } else
2329
- M[j][y] = 0, F[j][y] = v;
2340
+ N[_][y] = 0, H[_][y] = ee;
2330
2341
  }
2331
2342
  }
2332
- return { tops: F, bottoms: M };
2333
- }, [e, le, w, q]), { tops: te, bottoms: ie } = H, [pe, G] = ke(() => {
2334
- if (q) return [0, 1];
2335
- let F = 0, M = 0;
2336
- for (const y of te)
2337
- for (const x of y)
2338
- x < F && (F = x), x > M && (M = x);
2339
- for (const y of ie)
2340
- for (const x of y)
2341
- x < F && (F = x);
2342
- return [Math.min(0, F), M];
2343
- }, [te, ie, q]);
2343
+ return { tops: H, bottoms: N };
2344
+ }, [e, ne, V, ae]), { tops: z, bottoms: ce } = A, [me, K] = ke(() => {
2345
+ if (ae) return [0, 1];
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]);
2344
2355
  return /* @__PURE__ */ s(
2345
2356
  Ve,
2346
2357
  {
2347
- ref: z,
2358
+ ref: F,
2348
2359
  aspectRatio: r,
2349
2360
  height: o,
2350
- className: Q,
2351
- style: P,
2352
- classes: L,
2353
- legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: L }) : void 0,
2354
- overlay: p && oe !== null ? /* @__PURE__ */ s(
2361
+ className: Z,
2362
+ style: C,
2363
+ classes: $,
2364
+ legend: f ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
2365
+ overlay: p && S !== null ? /* @__PURE__ */ s(
2355
2366
  et,
2356
2367
  {
2357
- row: e[oe],
2358
- x: zc(e, t, J, oe, z),
2368
+ row: e[S],
2369
+ x: zc(e, t, ie, S, F),
2359
2370
  y: 16,
2360
- containerWidth: z.current?.getBoundingClientRect().width ?? 0,
2371
+ containerWidth: F.current?.getBoundingClientRect().width ?? 0,
2361
2372
  config: n,
2362
- render: I ? () => I(e[oe]) : void 0,
2363
- valueFormat: q ? (F) => `${Math.round(F * 100)}%` : N,
2373
+ render: J ? () => J(e[S]) : void 0,
2374
+ valueFormat: ae ? (H) => `${Math.round(H * 100)}%` : w,
2364
2375
  titleKey: t,
2365
- classes: L
2376
+ classes: $
2366
2377
  }
2367
2378
  ) : null,
2368
- children: ({ width: F, height: M }) => {
2369
- const y = J.left, x = F - J.right, A = J.top, j = M - J.bottom, K = Math.max(0, x - y), _ = Math.max(0, j - A), v = e.map((g) => String(g[t])), D = Xe(v, [y, x], 0), U = q ? [0, 0.25, 0.5, 0.75, 1] : qe(pe, G, S), de = Je([U[0], U[U.length - 1]], [j, A]), he = de(0), ye = U.map((g) => ({ value: g, y: de(g) })), Ce = Fc(v).map((g) => ({ label: g, x: D(g) })), Se = q ? (g) => `${Math.round(g * 100)}%` : k;
2370
- return /* @__PURE__ */ O(je, { children: [
2371
- a && /* @__PURE__ */ s("defs", { children: le.map((g) => /* @__PURE__ */ O(
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(
2372
2383
  "linearGradient",
2373
2384
  {
2374
- id: `${Y}-${g}`,
2385
+ id: `${X}-${g}`,
2375
2386
  x1: "0",
2376
2387
  y1: "0",
2377
2388
  x2: "0",
@@ -2386,77 +2397,77 @@ function Fl({
2386
2397
  d ? /* @__PURE__ */ s(
2387
2398
  nn,
2388
2399
  {
2389
- ticks: ye,
2400
+ ticks: ge,
2390
2401
  x: y,
2391
- plotWidth: K,
2392
- format: Se,
2402
+ plotWidth: q,
2403
+ format: Re,
2393
2404
  showGrid: h,
2394
- classes: L
2405
+ classes: $
2395
2406
  }
2396
- ) : h && /* @__PURE__ */ s("g", { className: f($.axis, L?.axis), children: ye.map(({ value: g, y: b }) => /* @__PURE__ */ s(
2407
+ ) : h && /* @__PURE__ */ s("g", { className: m(M.axis, $?.axis), children: ge.map(({ value: g, y: x }) => /* @__PURE__ */ s(
2397
2408
  "line",
2398
2409
  {
2399
- className: f($.gridLine, L?.grid),
2410
+ className: m(M.gridLine, $?.grid),
2400
2411
  x1: y,
2401
- x2: x,
2402
- y1: b,
2403
- y2: b
2412
+ x2: v,
2413
+ y1: x,
2414
+ y2: x
2404
2415
  },
2405
2416
  `grid-${g}`
2406
2417
  )) }),
2407
- u && /* @__PURE__ */ s(rn, { ticks: Ce, y: j, format: T, classes: L }),
2408
- le.map((g, b) => {
2409
- const ne = n[g], E = e.map((Z, R) => ({
2410
- x: D(v[R]),
2411
- y: de(te[b][R])
2412
- })), V = a ? `url(#${Y}-${g})` : ne.color, B = a ? 1 : 0.18, me = w ? Dt(E, ie[b].map((Z) => de(Z)), c) : Dt(E, he, c);
2413
- return /* @__PURE__ */ O("g", { className: f($.series, L?.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: [
2414
2425
  /* @__PURE__ */ s(
2415
2426
  "path",
2416
2427
  {
2417
- className: $.areaPath,
2418
- d: me,
2419
- fill: V,
2420
- fillOpacity: B
2428
+ className: M.areaPath,
2429
+ d: fe,
2430
+ fill: Y,
2431
+ fillOpacity: I
2421
2432
  }
2422
2433
  ),
2423
- /* @__PURE__ */ s("path", { className: $.linePath, d: St(E, c), stroke: ne.color }),
2424
- !w && E.map((Z, R) => /* @__PURE__ */ s(
2434
+ /* @__PURE__ */ s("path", { className: M.linePath, d: Rt(D, c), stroke: te.color }),
2435
+ !V && D.map((Q, T) => /* @__PURE__ */ s(
2425
2436
  "circle",
2426
2437
  {
2427
- className: f($.point, L?.point),
2428
- cx: Z.x,
2429
- cy: Z.y,
2430
- r: oe === R ? 5 : 3,
2431
- fill: ne.color
2438
+ className: m(M.point, $?.point),
2439
+ cx: Q.x,
2440
+ cy: Q.y,
2441
+ r: S === T ? 5 : 3,
2442
+ fill: te.color
2432
2443
  },
2433
- `${g}-${R}`
2444
+ `${g}-${T}`
2434
2445
  ))
2435
2446
  ] }, g);
2436
2447
  }),
2437
- oe !== null && /* @__PURE__ */ s(
2448
+ S !== null && /* @__PURE__ */ s(
2438
2449
  "line",
2439
2450
  {
2440
- className: $.cursorLine,
2441
- x1: D(v[oe]),
2442
- x2: D(v[oe]),
2443
- y1: A,
2444
- y2: j
2451
+ className: M.cursorLine,
2452
+ x1: k(ee[S]),
2453
+ x2: k(ee[S]),
2454
+ y1: B,
2455
+ y2: _
2445
2456
  }
2446
2457
  ),
2447
2458
  /* @__PURE__ */ s(
2448
2459
  "rect",
2449
2460
  {
2450
- className: $.interactionLayer,
2461
+ className: M.interactionLayer,
2451
2462
  x: y,
2452
- y: A,
2453
- width: K,
2454
- height: _,
2463
+ y: B,
2464
+ width: q,
2465
+ height: U,
2455
2466
  onMouseMove: (g) => {
2456
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left + y, E = D.step(), V = Math.max(0, Math.min(e.length - 1, Math.round((ne - y - E / 2) / E)));
2457
- ee(V);
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);
2458
2469
  },
2459
- onMouseLeave: () => ee(null)
2470
+ onMouseLeave: () => re(null)
2460
2471
  }
2461
2472
  )
2462
2473
  ] });
@@ -2495,193 +2506,193 @@ function zl({
2495
2506
  barRadius: h = 4,
2496
2507
  showGrid: u = !0,
2497
2508
  showLegend: d = !0,
2498
- showTooltip: m = !0,
2509
+ showTooltip: f = !0,
2499
2510
  showValues: p = !1,
2500
- valuePosition: S = "outside",
2501
- renderLabel: k,
2502
- colorBy: T = "series",
2503
- colors: N = jc,
2504
- negativeColor: I,
2505
- activeIndex: C,
2506
- onBarClick: X,
2507
- yTickCount: Q = 5,
2508
- yFormat: P,
2509
- xFormat: L,
2510
- valueFormat: J,
2511
- renderTooltip: le,
2512
- margin: w,
2513
- emptyMessage: q = "No data",
2514
- className: oe,
2515
- style: ee,
2516
- classes: z
2511
+ valuePosition: L = "outside",
2512
+ renderLabel: b,
2513
+ colorBy: R = "series",
2514
+ colors: w = jc,
2515
+ negativeColor: J,
2516
+ activeIndex: W,
2517
+ onBarClick: E,
2518
+ yTickCount: Z = 5,
2519
+ yFormat: C,
2520
+ xFormat: $,
2521
+ valueFormat: ie,
2522
+ renderTooltip: ne,
2523
+ margin: V,
2524
+ emptyMessage: ae = "No data",
2525
+ className: S,
2526
+ style: re,
2527
+ classes: F
2517
2528
  }) {
2518
- const Y = r === "horizontal", H = { ...Y ? _c : Xc, ...w }, te = ke(() => Object.keys(n), [n]), ie = o && te.length > 1, [pe, G] = Le(null), F = 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);
2519
2530
  if (e.length === 0)
2520
- return /* @__PURE__ */ s("div", { ref: F, className: f($.root, z?.root, oe), style: ee, children: /* @__PURE__ */ s("div", { className: $.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: $.empty, children: q }) }) });
2521
- const M = e.map((D) => String(D[t])), y = C ?? pe, x = ke(() => {
2522
- if (ie) {
2523
- 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;
2524
2535
  for (const be of e) {
2525
- let Ce = 0, Se = 0;
2526
- for (const g of te) {
2527
- const b = be[g];
2528
- typeof b == "number" && (b >= 0 ? Ce += b : Se += b);
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);
2529
2540
  }
2530
- Ce > he && (he = Ce), Se < ye && (ye = Se);
2541
+ Ce > le && (le = Ce), Re < ge && (ge = Re);
2531
2542
  }
2532
- return [ye, he];
2543
+ return [ge, le];
2533
2544
  }
2534
- const D = [];
2535
- for (const he of e)
2536
- for (const ye of te) {
2537
- const be = he[ye];
2538
- typeof be == "number" && D.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);
2539
2550
  }
2540
- const [U, de] = bt(D);
2541
- return [Math.min(0, U), Math.max(0, de)];
2542
- }, [e, te, ie]), A = qe(x[0], x[1], Q), j = A[0], K = A[A.length - 1], _ = (D, U) => T === "index" ? N[U % N.length] : n[D]?.color ?? N[0], v = m && y !== null && e[y] ? /* @__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(
2543
2554
  et,
2544
2555
  {
2545
2556
  row: e[y],
2546
- x: Vc(e, t, H, y, F, Y, l),
2547
- y: Y ? qc(e, t, H, y, F, l) : 16,
2548
- containerWidth: F.current?.getBoundingClientRect().width ?? 0,
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,
2549
2560
  config: n,
2550
- render: le ? () => le(e[y]) : void 0,
2551
- valueFormat: J,
2561
+ render: ne ? () => ne(e[y]) : void 0,
2562
+ valueFormat: ie,
2552
2563
  titleKey: t,
2553
- resolveColor: (D) => {
2554
- const U = e[y][D], de = _(D, y);
2555
- return typeof U != "number" ? de : I !== void 0 && U < 0 ? I : 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;
2556
2567
  },
2557
- classes: z
2568
+ classes: F
2558
2569
  }
2559
2570
  ) : null;
2560
2571
  return /* @__PURE__ */ s(
2561
2572
  Ve,
2562
2573
  {
2563
- ref: F,
2574
+ ref: H,
2564
2575
  aspectRatio: c,
2565
2576
  height: i,
2566
- className: oe,
2567
- style: ee,
2568
- classes: z,
2569
- legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: z }) : void 0,
2570
- overlay: v,
2571
- children: ({ width: D, height: U }) => {
2572
- const de = H.left, he = D - H.right, ye = H.top, be = U - H.bottom, Ce = Math.max(0, he - de), Se = Math.max(0, be - ye), b = Xe(M, Y ? [ye, be] : [de, he], l), ne = b.bandWidth(), V = Je([j, K], Y ? [de, he] : [be, ye]), B = V(0), me = ie ? 1 : Math.max(1, te.length), Z = ne / me, R = Z * (1 - a), se = A.map((ce) => ({
2573
- value: ce,
2574
- pos: V(ce)
2575
- })), ge = Uc(M);
2576
- return /* @__PURE__ */ O(je, { children: [
2577
- u && /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: se.map(
2578
- ({ value: ce, pos: ue }) => Y ? /* @__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(
2579
2590
  "line",
2580
2591
  {
2581
- className: f($.gridLine, z?.grid),
2582
- x1: ue,
2583
- x2: ue,
2584
- y1: ye,
2592
+ className: m(M.gridLine, F?.grid),
2593
+ x1: he,
2594
+ x2: he,
2595
+ y1: ge,
2585
2596
  y2: be
2586
2597
  },
2587
- `g-${ce}`
2598
+ `g-${se}`
2588
2599
  ) : /* @__PURE__ */ s(
2589
2600
  "line",
2590
2601
  {
2591
- className: f($.gridLine, z?.grid),
2592
- x1: de,
2593
- x2: he,
2594
- y1: ue,
2595
- y2: ue
2602
+ className: m(M.gridLine, F?.grid),
2603
+ x1: O,
2604
+ x2: le,
2605
+ y1: he,
2606
+ y2: he
2596
2607
  },
2597
- `g-${ce}`
2608
+ `g-${se}`
2598
2609
  )
2599
2610
  ) }),
2600
- /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: se.map(({ value: ce, pos: ue }) => {
2601
- const Ae = P ? P(ce) : String(ce);
2602
- return Y ? /* @__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(
2603
2614
  "text",
2604
2615
  {
2605
- className: f($.axisLabel, z?.axisLabel),
2606
- x: ue,
2616
+ className: m(M.axisLabel, F?.axisLabel),
2617
+ x: he,
2607
2618
  y: be + 16,
2608
2619
  textAnchor: "middle",
2609
2620
  children: Ae
2610
2621
  },
2611
- `vt-${ce}`
2622
+ `vt-${se}`
2612
2623
  ) : /* @__PURE__ */ s(
2613
2624
  "text",
2614
2625
  {
2615
- className: f($.axisLabel, z?.axisLabel),
2616
- x: de - 8,
2617
- y: ue,
2626
+ className: m(M.axisLabel, F?.axisLabel),
2627
+ x: O - 8,
2628
+ y: he,
2618
2629
  textAnchor: "end",
2619
2630
  dominantBaseline: "middle",
2620
2631
  children: Ae
2621
2632
  },
2622
- `vt-${ce}`
2633
+ `vt-${se}`
2623
2634
  );
2624
2635
  }) }),
2625
- /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: ge.map((ce) => {
2626
- const ue = b(ce), Ae = L ? L(ce) : ce;
2627
- return Y ? /* @__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(
2628
2639
  "text",
2629
2640
  {
2630
- className: f($.axisLabel, z?.axisLabel),
2631
- x: de - 8,
2632
- y: ue,
2641
+ className: m(M.axisLabel, F?.axisLabel),
2642
+ x: O - 8,
2643
+ y: he,
2633
2644
  textAnchor: "end",
2634
2645
  dominantBaseline: "middle",
2635
2646
  children: Ae
2636
2647
  },
2637
- `c-${ce}`
2648
+ `c-${se}`
2638
2649
  ) : /* @__PURE__ */ s(
2639
2650
  "text",
2640
2651
  {
2641
- className: f($.axisLabel, z?.axisLabel),
2642
- x: ue,
2652
+ className: m(M.axisLabel, F?.axisLabel),
2653
+ x: he,
2643
2654
  y: be + 16,
2644
2655
  textAnchor: "middle",
2645
2656
  children: Ae
2646
2657
  },
2647
- `c-${ce}`
2658
+ `c-${se}`
2648
2659
  );
2649
2660
  }) }),
2650
- e.map((ce, ue) => {
2651
- const De = b(M[ue]) - ne / 2;
2652
- let xe = 0, ae = 0;
2653
- return /* @__PURE__ */ s("g", { className: f($.series, z?.series), children: te.map((Ie, He) => {
2654
- const Ge = ce[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];
2655
2666
  if (typeof Ge != "number") return null;
2656
- const Ee = Ge, xt = _(Ie, ue), kt = I !== void 0 && Ee < 0 ? I : xt, Oe = C !== void 0 ? C === ue : pe === ue, tt = C !== 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;
2657
2668
  let nt, _e;
2658
- ie ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = ae, _e = ae + Ee, ae = _e) : (nt = 0, _e = Ee);
2659
- const rt = V(nt), ot = V(_e), Bt = ie ? (ne - R) / 2 : He * Z + (Z - R) / 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;
2660
2671
  let it = 0, ct = 0, lt = 0, st = 0;
2661
- if (Y) {
2662
- const Ze = Math.min(rt, ot), Mt = Math.max(rt, ot);
2663
- it = Ze, lt = Mt - Ze, ct = De + Bt, st = R;
2672
+ if (X) {
2673
+ const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2674
+ it = Ze, lt = wt - Ze, ct = De + Bt, st = T;
2664
2675
  } else {
2665
- const Ze = Math.min(rt, ot), Mt = Math.max(rt, ot);
2666
- it = De + Bt, lt = R, ct = Ze, st = Mt - Ze;
2676
+ const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2677
+ it = De + Bt, lt = T, ct = Ze, st = wt - Ze;
2667
2678
  }
2668
- const wt = k ? k({ row: ce, value: Ee, seriesKey: Ie, index: ue }) : p ? J ? J(Ee) : String(Ee) : null, Fe = Yc({
2669
- isHorizontal: Y,
2670
- valuePosition: S,
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,
2681
+ valuePosition: L,
2671
2682
  x: it,
2672
2683
  y: ct,
2673
2684
  rectW: lt,
2674
2685
  rectH: st,
2675
2686
  value: Ee
2676
2687
  });
2677
- return /* @__PURE__ */ O("g", { children: [
2688
+ return /* @__PURE__ */ j("g", { children: [
2678
2689
  /* @__PURE__ */ s(
2679
2690
  "rect",
2680
2691
  {
2681
- className: f(
2682
- $.bar,
2683
- Oe && $.activeBar,
2684
- z?.point
2692
+ className: m(
2693
+ M.bar,
2694
+ Oe && M.activeBar,
2695
+ F?.point
2685
2696
  ),
2686
2697
  x: it,
2687
2698
  y: ct,
@@ -2691,16 +2702,16 @@ function zl({
2691
2702
  ry: h,
2692
2703
  fill: kt,
2693
2704
  opacity: tt ? 0.35 : 1,
2694
- onClick: X ? () => X({ row: ce, value: Ee, seriesKey: Ie, index: ue }) : void 0,
2695
- style: X ? { 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
2696
2707
  }
2697
2708
  ),
2698
- wt != null && /* @__PURE__ */ s(
2709
+ Mt != null && /* @__PURE__ */ s(
2699
2710
  "text",
2700
2711
  {
2701
- className: f(
2702
- $.axisLabel,
2703
- (S === "inside" || S === "inside-start") && $.barLabelInside
2712
+ className: m(
2713
+ M.axisLabel,
2714
+ (L === "inside" || L === "inside-start") && M.barLabelInside
2704
2715
  ),
2705
2716
  x: Fe.x,
2706
2717
  y: Fe.y,
@@ -2708,39 +2719,39 @@ function zl({
2708
2719
  dominantBaseline: Fe.dominantBaseline,
2709
2720
  transform: Fe.rotate ? `rotate(${Fe.rotate} ${Fe.x} ${Fe.y})` : void 0,
2710
2721
  opacity: tt ? 0.5 : 1,
2711
- children: wt
2722
+ children: Mt
2712
2723
  }
2713
2724
  )
2714
2725
  ] }, Ie);
2715
- }) }, `group-${ue}`);
2726
+ }) }, `group-${he}`);
2716
2727
  }),
2717
- j < 0 && K > 0 && /* @__PURE__ */ s(
2728
+ _ < 0 && q > 0 && /* @__PURE__ */ s(
2718
2729
  "line",
2719
2730
  {
2720
- className: f($.gridLine),
2721
- x1: Y ? B : de,
2722
- x2: Y ? B : he,
2723
- y1: Y ? ye : B,
2724
- y2: Y ? be : B,
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,
2725
2736
  opacity: 0.9
2726
2737
  }
2727
2738
  ),
2728
2739
  /* @__PURE__ */ s(
2729
2740
  "rect",
2730
2741
  {
2731
- className: $.interactionLayer,
2732
- x: de,
2733
- y: ye,
2742
+ className: M.interactionLayer,
2743
+ x: O,
2744
+ y: ge,
2734
2745
  width: Ce,
2735
- height: Se,
2736
- onMouseMove: (ce) => {
2737
- const ue = ce.currentTarget.getBoundingClientRect(), Ae = ce.clientX - ue.left + de, De = ce.clientY - ue.top + ye, xe = b.step(), ae = Y ? 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(
2738
2749
  0,
2739
- Math.min(e.length - 1, Math.round((ae - xe / 2) / xe))
2750
+ Math.min(e.length - 1, Math.round((ue - xe / 2) / xe))
2740
2751
  );
2741
- G(Ie);
2752
+ K(Ie);
2742
2753
  },
2743
- onMouseLeave: () => G(null)
2754
+ onMouseLeave: () => K(null)
2744
2755
  }
2745
2756
  )
2746
2757
  ] });
@@ -2840,21 +2851,21 @@ function Zc(e, t, n, r, o, c) {
2840
2851
  `A ${n} ${n} 0 1 1 ${e + n} ${t}`,
2841
2852
  "Z"
2842
2853
  ].join(" ");
2843
- 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), m = t + n * Math.sin(l);
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);
2844
2855
  if (r > 0) {
2845
- const p = e + r * Math.cos(l), S = t + r * Math.sin(l), k = e + r * Math.cos(i), T = 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);
2846
2857
  return [
2847
2858
  `M ${h} ${u}`,
2848
- `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2849
- `L ${p} ${S}`,
2850
- `A ${r} ${r} 0 ${a} 0 ${k} ${T}`,
2859
+ `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2860
+ `L ${p} ${L}`,
2861
+ `A ${r} ${r} 0 ${a} 0 ${b} ${R}`,
2851
2862
  "Z"
2852
2863
  ].join(" ");
2853
2864
  }
2854
2865
  return [
2855
2866
  `M ${e} ${t}`,
2856
2867
  `L ${h} ${u}`,
2857
- `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2868
+ `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2858
2869
  "Z"
2859
2870
  ].join(" ");
2860
2871
  }
@@ -2875,122 +2886,122 @@ function jl({
2875
2886
  strokeWidth: h = 2,
2876
2887
  strokeColor: u = "var(--crk-color-bg)",
2877
2888
  padAngle: d = 0,
2878
- showLabels: m = !1,
2889
+ showLabels: f = !1,
2879
2890
  valuePosition: p = "outside",
2880
- showLabelLines: S = !0,
2881
- renderLabel: k,
2882
- centerLabel: T,
2883
- activeIndex: N,
2884
- onSliceClick: I,
2885
- showLegend: C = !0,
2886
- showTooltip: X = !0,
2887
- valueFormat: Q,
2888
- renderTooltip: P,
2889
- emptyMessage: L = "No data",
2890
- className: J,
2891
- style: le,
2892
- classes: w
2891
+ showLabelLines: L = !0,
2892
+ renderLabel: b,
2893
+ centerLabel: R,
2894
+ activeIndex: w,
2895
+ onSliceClick: J,
2896
+ showLegend: W = !0,
2897
+ showTooltip: E = !0,
2898
+ valueFormat: Z,
2899
+ renderTooltip: C,
2900
+ emptyMessage: $ = "No data",
2901
+ className: ie,
2902
+ style: ne,
2903
+ classes: V
2893
2904
  }) {
2894
- const [q, oe] = Le(null), ee = re(null), z = N ?? q, Y = (G) => {
2905
+ const [ae, S] = Le(null), re = oe(null), F = w ?? ae, X = (K) => {
2895
2906
  if (r) {
2896
- const F = e[G]?.[r];
2897
- if (typeof F == "string") return F;
2907
+ const H = e[K]?.[r];
2908
+ if (typeof H == "string") return H;
2898
2909
  }
2899
- return o[G % o.length];
2900
- }, H = ke(() => {
2901
- let G = 0;
2902
- for (const F of e) {
2903
- const M = F[t];
2904
- typeof M == "number" && M > 0 && (G += M);
2910
+ return o[K % o.length];
2911
+ }, A = ke(() => {
2912
+ let K = 0;
2913
+ for (const H of e) {
2914
+ const N = H[t];
2915
+ typeof N == "number" && N > 0 && (K += N);
2905
2916
  }
2906
- return G;
2917
+ return K;
2907
2918
  }, [e, t]);
2908
- if (e.length === 0 || H === 0)
2909
- return /* @__PURE__ */ s("div", { ref: ee, className: f($.root, w?.root, J), style: le, children: /* @__PURE__ */ s("div", { className: $.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: $.empty, children: L }) }) });
2910
- const te = ke(() => {
2911
- const G = [];
2912
- let F = 0;
2913
- for (let M = 0; M < e.length; M++) {
2914
- const y = e[M], x = y[t], A = typeof x == "number" && x > 0 ? x : 0;
2915
- if (A === 0) continue;
2916
- const j = A / H, K = j * 360;
2917
- G.push({ index: M, row: y, value: A, start: F, end: F + K, fraction: j }), F += K;
2919
+ if (e.length === 0 || A === 0)
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(() => {
2922
+ const K = [];
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;
2926
+ if (B === 0) continue;
2927
+ const _ = B / A, q = _ * 360;
2928
+ K.push({ index: N, row: y, value: B, start: H, end: H + q, fraction: _ }), H += q;
2918
2929
  }
2919
- return G;
2920
- }, [e, t, H]), ie = C ? /* @__PURE__ */ s("div", { className: f($.legend, w?.legend), role: "list", children: te.map((G) => /* @__PURE__ */ O("div", { className: f($.legendItem, w?.legendItem), role: "listitem", children: [
2930
+ return K;
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: [
2921
2932
  /* @__PURE__ */ s(
2922
2933
  "span",
2923
2934
  {
2924
- className: $.legendSwatch,
2925
- style: { background: Y(G.index) },
2935
+ className: M.legendSwatch,
2936
+ style: { background: X(K.index) },
2926
2937
  "aria-hidden": "true"
2927
2938
  }
2928
2939
  ),
2929
- /* @__PURE__ */ s("span", { className: $.legendLabel, children: String(G.row[n]) })
2930
- ] }, G.index)) }) : void 0, pe = ke(() => {
2931
- const G = {};
2932
- for (const F of te)
2933
- G[F.index.toString()] = {
2934
- label: String(F.row[n]),
2935
- color: Y(F.index)
2940
+ /* @__PURE__ */ s("span", { className: M.legendLabel, children: String(K.row[n]) })
2941
+ ] }, K.index)) }) : void 0, me = ke(() => {
2942
+ const K = {};
2943
+ for (const H of z)
2944
+ K[H.index.toString()] = {
2945
+ label: String(H.row[n]),
2946
+ color: X(H.index)
2936
2947
  };
2937
- return G;
2938
- }, [te]);
2948
+ return K;
2949
+ }, [z]);
2939
2950
  return /* @__PURE__ */ s(
2940
2951
  Ve,
2941
2952
  {
2942
- ref: ee,
2953
+ ref: re,
2943
2954
  aspectRatio: c,
2944
2955
  height: i,
2945
- className: J,
2946
- style: le,
2947
- classes: w,
2948
- legend: ie,
2949
- overlay: X && z !== null && e[z] ? /* @__PURE__ */ s(
2956
+ className: ie,
2957
+ style: ne,
2958
+ classes: V,
2959
+ legend: ce,
2960
+ overlay: E && F !== null && e[F] ? /* @__PURE__ */ s(
2950
2961
  et,
2951
2962
  {
2952
- row: { [z.toString()]: e[z][t] },
2953
- x: ee.current ? ee.current.getBoundingClientRect().width / 2 : 0,
2963
+ row: { [F.toString()]: e[F][t] },
2964
+ x: re.current ? re.current.getBoundingClientRect().width / 2 : 0,
2954
2965
  y: 16,
2955
- containerWidth: ee.current?.getBoundingClientRect().width ?? 0,
2956
- config: { [z.toString()]: pe[z.toString()] },
2957
- render: P ? () => P(e[z]) : void 0,
2958
- valueFormat: Q,
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,
2959
2970
  titleKey: void 0,
2960
- classes: w
2971
+ classes: V
2961
2972
  }
2962
2973
  ) : null,
2963
- children: ({ width: G, height: F }) => {
2964
- const M = G / 2, y = F / 2, x = Math.min(G, F) / 2 - 4, A = Et(a, x), j = Math.min(A - 1, Et(l, x)), K = Math.max(4, A * 0.06);
2965
- return /* @__PURE__ */ O(je, { children: [
2966
- /* @__PURE__ */ s("g", { children: te.map((_) => {
2967
- const v = d / 2, D = Math.min(_.end, _.start + v), U = Math.max(_.start, _.end - v), de = Y(_.index), he = z === _.index, ye = N !== void 0 && !he, be = he && N !== void 0 ? A + K : A, Ce = Zc(M, y, be, j, D, U), Se = I ? () => I({ row: _.row, value: _.value, index: _.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;
2968
2979
  return /* @__PURE__ */ s(
2969
2980
  "path",
2970
2981
  {
2971
2982
  d: Ce,
2972
- fill: de,
2983
+ fill: O,
2973
2984
  stroke: h > 0 ? u : "none",
2974
2985
  strokeWidth: h,
2975
- opacity: ye ? 0.45 : 1,
2976
- onMouseEnter: () => oe(_.index),
2977
- onMouseLeave: () => oe(null),
2978
- onClick: Se,
2979
- 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
2980
2991
  },
2981
- _.index
2992
+ U.index
2982
2993
  );
2983
2994
  }) }),
2984
- (m || k) && te.map((_) => {
2985
- const v = k ? k({ row: _.row, value: _.value, fraction: _.fraction, index: _.index }) : m ? `${String(_.row[n])} ${Q ? Q(_.value) : Math.round(_.fraction * 100) + "%"}` : null;
2986
- if (v == null) return null;
2987
- const D = p === "inside", U = Math.max(16, A * 0.12), de = D ? (A + j) / 2 : A + U, he = Pt(M, y, de, _.start, _.end), ye = D ? "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";
2988
2999
  let be = null;
2989
- if (!D && S) {
2990
- const Ce = Pt(M, y, A, _.start, _.end), Se = 4, g = ye === "end" ? Se : ye === "start" ? -Se : 0;
2991
- be = { x1: Ce.x, y1: Ce.y, x2: he.x + g, 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 };
2992
3003
  }
2993
- return /* @__PURE__ */ O("g", { children: [
3004
+ return /* @__PURE__ */ j("g", { children: [
2994
3005
  be && /* @__PURE__ */ s(
2995
3006
  "line",
2996
3007
  {
@@ -2998,7 +3009,7 @@ function jl({
2998
3009
  y1: be.y1,
2999
3010
  x2: be.x2,
3000
3011
  y2: be.y2,
3001
- stroke: Y(_.index),
3012
+ stroke: X(U.index),
3002
3013
  strokeWidth: 1,
3003
3014
  opacity: 0.7
3004
3015
  }
@@ -3006,26 +3017,26 @@ function jl({
3006
3017
  /* @__PURE__ */ s(
3007
3018
  "text",
3008
3019
  {
3009
- x: he.x,
3010
- y: he.y,
3011
- className: f(
3012
- $.axisLabel,
3013
- D && $.barLabelInside
3020
+ x: le.x,
3021
+ y: le.y,
3022
+ className: m(
3023
+ M.axisLabel,
3024
+ k && M.barLabelInside
3014
3025
  ),
3015
- textAnchor: ye,
3026
+ textAnchor: ge,
3016
3027
  dominantBaseline: "middle",
3017
- children: v
3028
+ children: ee
3018
3029
  }
3019
3030
  )
3020
- ] }, `label-${_.index}`);
3031
+ ] }, `label-${U.index}`);
3021
3032
  }),
3022
- T !== void 0 && /* @__PURE__ */ s(
3033
+ R !== void 0 && /* @__PURE__ */ s(
3023
3034
  "foreignObject",
3024
3035
  {
3025
- x: M - j,
3026
- y: y - j,
3027
- width: Math.max(0, j * 2),
3028
- height: Math.max(0, j * 2),
3036
+ x: N - _,
3037
+ y: y - _,
3038
+ width: Math.max(0, _ * 2),
3039
+ height: Math.max(0, _ * 2),
3029
3040
  style: { pointerEvents: "none" },
3030
3041
  children: /* @__PURE__ */ s(
3031
3042
  "div",
@@ -3041,7 +3052,7 @@ function jl({
3041
3052
  color: "var(--crk-color-text)",
3042
3053
  fontFamily: "var(--crk-font-family)"
3043
3054
  },
3044
- children: T
3055
+ children: R
3045
3056
  }
3046
3057
  )
3047
3058
  }
@@ -3074,186 +3085,186 @@ function Xl({
3074
3085
  showRadiusAxis: h = !1,
3075
3086
  levels: u = 5,
3076
3087
  showPoints: d = !0,
3077
- fillOpacity: m = 0.4,
3088
+ fillOpacity: f = 0.4,
3078
3089
  strokeWidth: p = 2,
3079
- renderAxisLabel: S,
3080
- axisFormat: k,
3081
- valueFormat: T,
3082
- renderTooltip: N,
3083
- showLegend: I = !0,
3084
- showTooltip: C = !0,
3085
- emptyMessage: X = "No data",
3086
- className: Q,
3087
- style: P,
3088
- classes: L
3090
+ renderAxisLabel: L,
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,
3098
+ style: C,
3099
+ classes: $
3089
3100
  }) {
3090
- const [J, le] = Le(null), w = re(null), q = ke(() => Object.keys(n), [n]);
3101
+ const [ie, ne] = Le(null), V = oe(null), ae = ke(() => Object.keys(n), [n]);
3091
3102
  if (e.length === 0)
3092
- return /* @__PURE__ */ s("div", { ref: w, className: f($.root, L?.root, Q), style: P, children: /* @__PURE__ */ s("div", { className: $.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: $.empty, children: X }) }) });
3093
- const oe = ke(
3094
- () => e.map((H, te) => te / 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),
3095
3106
  [e]
3096
- ), ee = ke(() => {
3097
- const H = [];
3098
- for (const ie of q)
3099
- for (const pe of e) {
3100
- const G = pe[ie];
3101
- typeof G == "number" && H.push(G);
3107
+ ), re = ke(() => {
3108
+ const A = [];
3109
+ for (const ce of ae)
3110
+ for (const me of e) {
3111
+ const K = me[ce];
3112
+ typeof K == "number" && A.push(K);
3102
3113
  }
3103
- const [, te] = bt(H);
3104
- return Math.max(1, te);
3105
- }, [e, q]), z = ke(() => qe(0, ee, u).filter((te) => te > 0), [ee, u]), Y = z[z.length - 1] ?? ee;
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;
3106
3117
  return /* @__PURE__ */ s(
3107
3118
  Ve,
3108
3119
  {
3109
- ref: w,
3120
+ ref: V,
3110
3121
  aspectRatio: r,
3111
3122
  height: o,
3112
- className: Q,
3113
- style: P,
3114
- classes: L,
3115
- legend: I ? /* @__PURE__ */ s(vt, { config: n, classes: L }) : void 0,
3116
- overlay: C && J !== null ? /* @__PURE__ */ s(
3123
+ className: Z,
3124
+ style: C,
3125
+ classes: $,
3126
+ legend: J ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3127
+ overlay: W && ie !== null ? /* @__PURE__ */ s(
3117
3128
  et,
3118
3129
  {
3119
- row: e[J],
3120
- x: (w.current?.getBoundingClientRect().width ?? 0) / 2,
3130
+ row: e[ie],
3131
+ x: (V.current?.getBoundingClientRect().width ?? 0) / 2,
3121
3132
  y: 16,
3122
- containerWidth: w.current?.getBoundingClientRect().width ?? 0,
3133
+ containerWidth: V.current?.getBoundingClientRect().width ?? 0,
3123
3134
  config: n,
3124
- render: N ? () => N(e[J]) : void 0,
3125
- valueFormat: T,
3135
+ render: w ? () => w(e[ie]) : void 0,
3136
+ valueFormat: R,
3126
3137
  titleKey: t,
3127
- classes: L
3138
+ classes: $
3128
3139
  }
3129
3140
  ) : null,
3130
- children: ({ width: H, height: te }) => {
3131
- const ie = a ? 32 : 8, pe = H / 2, G = te / 2, F = Math.max(0, Math.min(H, te) / 2 - ie), M = (y) => Math.max(0, y) / Y * F;
3132
- return /* @__PURE__ */ O(je, { children: [
3133
- i && z.map((y) => {
3134
- const x = M(y);
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);
3135
3146
  return c === "circle" ? /* @__PURE__ */ s(
3136
3147
  "circle",
3137
3148
  {
3138
- className: f($.gridLine, L?.grid),
3139
- cx: pe,
3140
- cy: G,
3141
- r: x,
3149
+ className: m(M.gridLine, $?.grid),
3150
+ cx: me,
3151
+ cy: K,
3152
+ r: v,
3142
3153
  fill: "none"
3143
3154
  },
3144
3155
  `ring-${y}`
3145
3156
  ) : /* @__PURE__ */ s(
3146
3157
  "polygon",
3147
3158
  {
3148
- className: f($.gridLine, L?.grid),
3149
- points: Kc(pe, G, x, oe),
3159
+ className: m(M.gridLine, $?.grid),
3160
+ points: Kc(me, K, v, S),
3150
3161
  fill: "none"
3151
3162
  },
3152
3163
  `ring-${y}`
3153
3164
  );
3154
3165
  }),
3155
- l && oe.map((y, x) => {
3156
- const A = mt(pe, G, F, y);
3166
+ l && S.map((y, v) => {
3167
+ const B = mt(me, K, H, y);
3157
3168
  return /* @__PURE__ */ s(
3158
3169
  "line",
3159
3170
  {
3160
- className: f($.gridLine, L?.grid),
3161
- x1: pe,
3162
- y1: G,
3163
- x2: A.x,
3164
- y2: A.y
3171
+ className: m(M.gridLine, $?.grid),
3172
+ x1: me,
3173
+ y1: K,
3174
+ x2: B.x,
3175
+ y2: B.y
3165
3176
  },
3166
- `spoke-${x}`
3177
+ `spoke-${v}`
3167
3178
  );
3168
3179
  }),
3169
- h && z.map((y) => {
3170
- const x = M(y);
3180
+ h && F.map((y) => {
3181
+ const v = N(y);
3171
3182
  return /* @__PURE__ */ s(
3172
3183
  "text",
3173
3184
  {
3174
- className: f($.axisLabel, L?.axisLabel),
3175
- x: pe + 4,
3176
- y: G - x,
3185
+ className: m(M.axisLabel, $?.axisLabel),
3186
+ x: me + 4,
3187
+ y: K - v,
3177
3188
  textAnchor: "start",
3178
3189
  dominantBaseline: "middle",
3179
- children: T ? T(y) : y
3190
+ children: R ? R(y) : y
3180
3191
  },
3181
3192
  `raxis-${y}`
3182
3193
  );
3183
3194
  }),
3184
- a && e.map((y, x) => {
3185
- const A = oe[x], j = mt(pe, G, F + 14, A), K = j.x < pe - 1 ? "end" : j.x > pe + 1 ? "start" : "middle";
3186
- if (S)
3187
- return /* @__PURE__ */ s("g", { children: S({
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";
3197
+ if (L)
3198
+ return /* @__PURE__ */ s("g", { children: L({
3188
3199
  row: y,
3189
- index: x,
3190
- angle: A,
3191
- x: j.x,
3192
- y: j.y,
3193
- textAnchor: K
3194
- }) }, `label-${x}`);
3195
- const _ = String(y[t]), v = k ? k(_) : _;
3200
+ index: v,
3201
+ angle: B,
3202
+ x: _.x,
3203
+ y: _.y,
3204
+ textAnchor: q
3205
+ }) }, `label-${v}`);
3206
+ const U = String(y[t]), ee = b ? b(U) : U;
3196
3207
  return /* @__PURE__ */ s(
3197
3208
  "text",
3198
3209
  {
3199
- className: f($.axisLabel, L?.axisLabel),
3200
- x: j.x,
3201
- y: j.y,
3202
- textAnchor: K,
3210
+ className: m(M.axisLabel, $?.axisLabel),
3211
+ x: _.x,
3212
+ y: _.y,
3213
+ textAnchor: q,
3203
3214
  dominantBaseline: "middle",
3204
- children: v
3215
+ children: ee
3205
3216
  },
3206
- `label-${x}`
3217
+ `label-${v}`
3207
3218
  );
3208
3219
  }),
3209
- q.map((y) => {
3210
- const x = n[y], A = e.map((K, _) => {
3211
- const v = K[y], U = M(typeof v == "number" ? v : 0);
3212
- return mt(pe, G, U, oe[_]);
3213
- }), j = A.map((K) => `${K.x},${K.y}`).join(" ");
3214
- return /* @__PURE__ */ O("g", { className: f($.series, L?.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: [
3215
3226
  /* @__PURE__ */ s(
3216
3227
  "polygon",
3217
3228
  {
3218
- points: j,
3219
- fill: x.color,
3220
- fillOpacity: m,
3221
- stroke: x.color,
3229
+ points: _,
3230
+ fill: v.color,
3231
+ fillOpacity: f,
3232
+ stroke: v.color,
3222
3233
  strokeWidth: p,
3223
3234
  strokeLinejoin: "round",
3224
3235
  strokeLinecap: "round"
3225
3236
  }
3226
3237
  ),
3227
- d && A.map((K, _) => /* @__PURE__ */ s(
3238
+ d && B.map((q, U) => /* @__PURE__ */ s(
3228
3239
  "circle",
3229
3240
  {
3230
- className: f($.point, L?.point),
3231
- cx: K.x,
3232
- cy: K.y,
3233
- r: J === _ ? 5 : 3.5,
3234
- fill: x.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
3235
3246
  },
3236
- `${y}-${_}`
3247
+ `${y}-${U}`
3237
3248
  ))
3238
3249
  ] }, y);
3239
3250
  }),
3240
3251
  /* @__PURE__ */ s(
3241
3252
  "rect",
3242
3253
  {
3243
- className: $.interactionLayer,
3254
+ className: M.interactionLayer,
3244
3255
  x: 0,
3245
3256
  y: 0,
3246
- width: H,
3247
- height: te,
3257
+ width: A,
3258
+ height: z,
3248
3259
  onMouseMove: (y) => {
3249
- const x = y.currentTarget.getBoundingClientRect(), A = y.clientX - x.left - pe, j = y.clientY - x.top - G;
3250
- if (A === 0 && j === 0) return;
3251
- let K = Math.atan2(j, A) * 180 / Math.PI + 90;
3252
- K < 0 && (K += 360), K >= 360 && (K -= 360);
3253
- const _ = 360 / e.length, v = Math.round(K / _) % e.length;
3254
- le(v);
3260
+ const v = y.currentTarget.getBoundingClientRect(), B = y.clientX - v.left - me, _ = y.clientY - v.top - K;
3261
+ if (B === 0 && _ === 0) return;
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);
3255
3266
  },
3256
- onMouseLeave: () => le(null)
3267
+ onMouseLeave: () => ne(null)
3257
3268
  }
3258
3269
  )
3259
3270
  ] });
@@ -3288,11 +3299,11 @@ function el(e, t, n = 2) {
3288
3299
  if (t <= 0 || r < t) return { middle: o, upper: c, lower: i };
3289
3300
  for (let l = t - 1; l < r; l++) {
3290
3301
  let a = 0;
3291
- for (let m = l - t + 1; m <= l; m++) a += e[m].close;
3302
+ for (let f = l - t + 1; f <= l; f++) a += e[f].close;
3292
3303
  const h = a / t;
3293
3304
  let u = 0;
3294
- for (let m = l - t + 1; m <= l; m++) {
3295
- const p = e[m].close - h;
3305
+ for (let f = l - t + 1; f <= l; f++) {
3306
+ const p = e[f].close - h;
3296
3307
  u += p * p;
3297
3308
  }
3298
3309
  u /= t;
@@ -3322,34 +3333,34 @@ function Wt(e, t) {
3322
3333
  function _l(e) {
3323
3334
  return e.map((t) => typeof t.volume == "number" ? t.volume : null);
3324
3335
  }
3325
- const Re = 86400;
3336
+ const Se = 86400;
3326
3337
  function on(e) {
3327
3338
  switch (e) {
3328
3339
  case "1D":
3329
- return Re;
3340
+ return Se;
3330
3341
  case "5D":
3331
- return 5 * Re;
3342
+ return 5 * Se;
3332
3343
  case "1M":
3333
- return 30 * Re;
3344
+ return 30 * Se;
3334
3345
  case "3M":
3335
- return 90 * Re;
3346
+ return 90 * Se;
3336
3347
  case "6M":
3337
- return 180 * Re;
3348
+ return 180 * Se;
3338
3349
  case "1Y":
3339
- return 365 * Re;
3350
+ return 365 * Se;
3340
3351
  case "5Y":
3341
- return 5 * 365 * Re;
3352
+ return 5 * 365 * Se;
3342
3353
  }
3343
3354
  const t = /^(\d+)\s*([dDwWmMyYhH])$/.exec(e);
3344
3355
  if (t) {
3345
3356
  const n = Number(t[1]), r = t[2].toLowerCase();
3346
3357
  if (r === "h") return n * 3600;
3347
- if (r === "d") return n * Re;
3348
- if (r === "w") return n * 7 * Re;
3349
- if (r === "m") return n * 30 * Re;
3350
- 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;
3351
3362
  }
3352
- return 30 * Re;
3363
+ return 30 * Se;
3353
3364
  }
3354
3365
  function Ul(e) {
3355
3366
  switch (e) {
@@ -3369,7 +3380,7 @@ function Ul(e) {
3369
3380
  return "W";
3370
3381
  }
3371
3382
  const t = on(e);
3372
- 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";
3373
3384
  }
3374
3385
  function Yl(e) {
3375
3386
  if (e === "W" || e === "M") return "5Y";
@@ -3391,209 +3402,209 @@ function Vl({
3391
3402
  upColor: h = "var(--crk-color-success)",
3392
3403
  downColor: u = "var(--crk-color-danger)",
3393
3404
  lineColor: d = "var(--crk-chart-1)",
3394
- timezone: m,
3405
+ timezone: f,
3395
3406
  defaultTimezone: p = "local",
3396
- onTimezoneChange: S,
3397
- showConfigPanel: k = !0,
3398
- onCrosshair: T,
3399
- onVisibleRangeChange: N,
3400
- className: I,
3401
- style: C
3407
+ onTimezoneChange: L,
3408
+ showConfigPanel: b = !0,
3409
+ onCrosshair: R,
3410
+ onVisibleRangeChange: w,
3411
+ className: J,
3412
+ style: W
3402
3413
  }) {
3403
- const X = re(null), Q = re(null), P = re([]), L = re({ from: 0, to: 0 }), J = re(null), le = re(null), w = re(!1), q = re(null), oe = re(null), ee = re(1), z = re({ width: 0, height: 0 }), Y = re(() => {
3404
- }), H = re(T), te = re(N);
3405
- H.current = T, te.current = N;
3406
- const [ie, pe] = Le(null), [G, F] = Le(p), M = m ?? G, y = fe(
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(
3407
3418
  (g) => {
3408
- m === void 0 && F(g), S?.(g);
3419
+ f === void 0 && H(g), L?.(g);
3409
3420
  },
3410
- [m, S]
3411
- ), x = ke(
3421
+ [f, L]
3422
+ ), v = ke(
3412
3423
  () => ({ up: h, down: u, line: d }),
3413
3424
  [h, u, d]
3414
- ), A = c, j = A.some((g) => g.type === "rsi"), K = A.some((g) => g.type === "volume"), _ = fe(() => {
3415
- const g = Q.current;
3425
+ ), B = c, _ = B.some((g) => g.type === "rsi"), q = B.some((g) => g.type === "volume"), U = pe(() => {
3426
+ const g = Z.current;
3416
3427
  if (!g) return;
3417
- const b = g.getContext("2d");
3418
- if (!b) return;
3419
- const { width: ne, height: E } = z.current;
3420
- if (ne === 0 || E === 0) return;
3421
- const V = ee.current;
3422
- b.save(), b.setTransform(1, 0, 0, 1, 0, 0), b.clearRect(0, 0, g.width, g.height), b.scale(V, V);
3423
- const B = pl(X.current, x), me = ln(X.current), Z = P.current;
3424
- if (Z.length === 0) {
3425
- gl(b, ne, E, B), b.restore();
3428
+ const x = g.getContext("2d");
3429
+ if (!x) return;
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;
3435
+ if (Q.length === 0) {
3436
+ gl(x, te, D, I), x.restore();
3426
3437
  return;
3427
3438
  }
3428
- const R = Nt(ne, E, j, K), { from: se, to: ge } = hl(L.current, Z.length);
3429
- L.current = { from: se, to: ge };
3430
- const ce = Z.slice(Math.max(0, Math.floor(se)), Math.min(Z.length, Math.ceil(ge) + 1)), ue = (ae) => {
3431
- const Ie = ge - se + 1, He = R.plotWidth / Ie;
3432
- return R.plotLeft + (ae - se + 0.5) * He;
3433
- }, Ae = R.plotWidth / (ge - se + 1), De = A.map((ae) => ml(ae, Z)).filter((ae) => ae !== null).map((ae) => ({ ...ae, color: me(ae.color) })), xe = cn(R.main, ce, De, se, ge);
3434
- Lt(b, R.plotLeft, R.plotRight, xe, B), yl(b, R, xe, i, B), b.save(), b.beginPath(), b.rect(R.plotLeft, xe.paneTop, R.plotWidth, xe.paneHeight), b.clip();
3435
- for (let ae = 0; ae < A.length; ae++) {
3436
- const Ie = A[ae], He = De[ae];
3437
- He && kl(b, He, Ie, Z, se, ge, ue, xe);
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);
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();
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);
3438
3449
  }
3439
- if (o === "candle" ? vl(b, Z, se, ge, ue, Ae, xe, { up: B.up, down: B.down }) : o === "bar" ? bl(b, Z, se, ge, ue, Ae, xe, { up: B.up, down: B.down }) : xl(b, Z, se, ge, ue, xe, B.line, o === "area"), b.restore(), R.volume) {
3440
- const ae = fl(R.volume, Z, se, ge);
3441
- Lt(b, R.plotLeft, R.plotRight, ae, B, !0), Ft(b, R, R.volume, "Volume", B), b.save(), b.beginPath(), b.rect(R.plotLeft, ae.paneTop, R.plotWidth, ae.paneHeight), b.clip(), wl(b, Z, se, ge, ue, Ae, ae, { up: B.up, down: B.down }), b.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();
3442
3453
  }
3443
- if (R.rsi) {
3444
- const ae = A.find((tt) => tt.type === "rsi"), Ie = ae && ae.type === "rsi" ? ae.period ?? 14 : 14, He = ae && ae.type === "rsi" ? ae.overbought ?? 70 : 70, Ge = ae && ae.type === "rsi" ? ae.oversold ?? 30 : 30, Ee = (ae && ae.type === "rsi" ? ae.color : void 0) ?? "var(--crk-chart-5)", xt = me(Ee), kt = tl(Z, Ie), Oe = {
3445
- paneTop: R.rsi.top,
3446
- paneBottom: R.rsi.bottom,
3447
- paneHeight: R.rsi.height,
3454
+ if (T.rsi) {
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 = {
3456
+ paneTop: T.rsi.top,
3457
+ paneBottom: T.rsi.bottom,
3458
+ paneHeight: T.rsi.height,
3448
3459
  priceMin: 0,
3449
3460
  priceMax: 100,
3450
3461
  ticks: [Ge, 50, He]
3451
3462
  };
3452
- Lt(b, R.plotLeft, R.plotRight, Oe, B, !0), Ft(b, R, R.rsi, `RSI ${Ie}`, B), b.save(), b.beginPath(), b.rect(R.plotLeft, Oe.paneTop, R.plotWidth, Oe.paneHeight), b.clip(), Qe(b, kt, se, ge, ue, Oe, xt), b.restore(), Ml(b, R, Oe, He, Ge, B);
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);
3453
3464
  }
3454
- $l(b, R, Z, se, ge, n, B), J.current && Nl(b, R, J.current, Z, se, ge, ue, i, xe, M, B), b.restore();
3455
- }, [o, A, j, K, i, x, n, M]);
3456
- Y.current = _;
3457
- const v = fe(() => {
3458
- if (oe.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) {
3459
3470
  if (typeof requestAnimationFrame > "u") {
3460
- Y.current();
3471
+ X.current();
3461
3472
  return;
3462
3473
  }
3463
- oe.current = requestAnimationFrame(() => {
3464
- oe.current = null, Y.current();
3474
+ S.current = requestAnimationFrame(() => {
3475
+ S.current = null, X.current();
3465
3476
  });
3466
3477
  }
3467
3478
  }, []);
3468
3479
  jt(() => {
3469
- const g = X.current;
3480
+ const g = E.current;
3470
3481
  if (!g) return;
3471
- const b = () => {
3472
- const E = g.getBoundingClientRect(), V = typeof window < "u" && window.devicePixelRatio || 1;
3473
- ee.current = V, z.current = { width: E.width, height: E.height };
3474
- const B = Q.current;
3475
- B && (B.width = Math.round(E.width * V), B.height = Math.round(E.height * V), B.style.width = `${E.width}px`, B.style.height = `${E.height}px`), v();
3482
+ const x = () => {
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();
3476
3487
  };
3477
- if (b(), typeof ResizeObserver > "u") return;
3478
- const ne = new ResizeObserver(b);
3479
- return ne.observe(g), () => ne.disconnect();
3480
- }, [v]), Ne(() => {
3488
+ if (x(), typeof ResizeObserver > "u") return;
3489
+ const te = new ResizeObserver(x);
3490
+ return te.observe(g), () => te.disconnect();
3491
+ }, [ee]), Ne(() => {
3481
3492
  let g = !1;
3482
- const b = Math.floor(Date.now() / 1e3), ne = zt(n), E = r !== void 0 ? on(r) : ne * l, V = r !== void 0 ? Math.max(10, Math.ceil(E / ne)) : l, B = b - E;
3483
- P.current = [], L.current = { from: 0, to: 0 }, v(), e.getBars({ symbol: t, resolution: n, from: B, to: b, countBack: V }).then((Z) => {
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) => {
3484
3495
  if (g) return;
3485
- const R = [...Z].sort((ge, ce) => ge.time - ce.time);
3486
- P.current = R;
3487
- const se = R.length - 1;
3496
+ const T = [...Q].sort((ye, se) => ye.time - se.time);
3497
+ C.current = T;
3498
+ const de = T.length - 1;
3488
3499
  if (r !== void 0)
3489
- L.current = { from: 0, to: se };
3500
+ $.current = { from: 0, to: de };
3490
3501
  else {
3491
- const ge = Math.min(R.length, Math.min(200, l));
3492
- L.current = {
3493
- from: Math.max(0, se - ge + 1),
3494
- to: se
3502
+ const ye = Math.min(T.length, Math.min(200, l));
3503
+ $.current = {
3504
+ from: Math.max(0, de - ye + 1),
3505
+ to: de
3495
3506
  };
3496
3507
  }
3497
- te.current?.(L.current, R), v();
3508
+ z.current?.($.current, T), ee();
3498
3509
  }).catch(() => {
3499
3510
  });
3500
- const me = e.subscribeBars({
3511
+ const fe = e.subscribeBars({
3501
3512
  symbol: t,
3502
3513
  resolution: n,
3503
- onTick: (Z) => {
3514
+ onTick: (Q) => {
3504
3515
  if (g) return;
3505
- const R = P.current, se = R[R.length - 1];
3506
- if (se && se.time === Z.time)
3507
- R[R.length - 1] = Z;
3508
- else if (!se || Z.time > se.time) {
3509
- R.push(Z);
3510
- const ge = L.current;
3511
- ge.to >= R.length - 2 && (L.current = { from: ge.from + 1, to: ge.to + 1 });
3516
+ const T = C.current, de = T[T.length - 1];
3517
+ if (de && de.time === Q.time)
3518
+ T[T.length - 1] = Q;
3519
+ else if (!de || Q.time > de.time) {
3520
+ T.push(Q);
3521
+ const ye = $.current;
3522
+ ye.to >= T.length - 2 && ($.current = { from: ye.from + 1, to: ye.to + 1 });
3512
3523
  }
3513
- v();
3524
+ ee();
3514
3525
  }
3515
3526
  });
3516
- return q.current = me, () => {
3517
- g = !0, q.current !== null && (e.unsubscribeBars(q.current), q.current = null);
3527
+ return ae.current = fe, () => {
3528
+ g = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
3518
3529
  };
3519
3530
  }, [e, t, n, r, l]);
3520
- const D = fe((g) => {
3521
- pe(g), H.current?.(g);
3522
- }, []), U = fe((g) => {
3531
+ const k = pe((g) => {
3532
+ me(g), A.current?.(g);
3533
+ }, []), G = pe((g) => {
3523
3534
  g.currentTarget.setPointerCapture(g.pointerId);
3524
- const b = L.current;
3525
- le.current = { startX: g.clientX, from: b.from, to: b.to };
3526
- }, []), de = fe(
3535
+ const x = $.current;
3536
+ ne.current = { startX: g.clientX, from: x.from, to: x.to };
3537
+ }, []), O = pe(
3527
3538
  (g) => {
3528
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left, E = g.clientY - b.top;
3529
- if (J.current = { x: ne, y: E }, le.current) {
3530
- const { startX: me, from: Z, to: R } = le.current, { width: se } = z.current, ge = Math.max(1, se - Ct), ce = R - Z + 1, ue = ge / ce, Ae = -(g.clientX - me) / ue;
3531
- let De = Z + Ae, xe = R + Ae;
3532
- const ae = P.current.length;
3533
- De < 0 && (Se(), De = 0, xe = ce - 1), xe > ae - 1 && (xe = ae - 1, De = xe - ce + 1), L.current = { from: De, to: xe }, te.current?.(L.current, P.current);
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;
3542
+ let De = Q + Ae, xe = T + Ae;
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);
3534
3545
  }
3535
- const V = Nt(b.width, b.height, j, K), B = L.current;
3536
- if (ne >= V.plotLeft && ne <= V.plotRight) {
3537
- const me = B.to - B.from + 1, Z = V.plotWidth / me, R = Math.round(B.from + (ne - V.plotLeft) / Z - 0.5), se = P.current, ge = Math.max(0, Math.min(se.length - 1, R)), ce = se[ge] ?? null, ue = Ll(E, V, se, B.from, B.to);
3538
- D({ barIndex: ge, bar: ce, 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 });
3539
3550
  } else
3540
- D(null);
3541
- v();
3551
+ k(null);
3552
+ ee();
3542
3553
  },
3543
- [j, K, v, D]
3544
- ), he = fe((g) => {
3545
- g.currentTarget.releasePointerCapture(g.pointerId), le.current = null;
3546
- }, []), ye = fe(() => {
3547
- J.current = null, le.current = null, D(null), v();
3548
- }, [v, D]), be = fe(
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(
3549
3560
  (g) => {
3550
3561
  g.preventDefault();
3551
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left, E = Nt(b.width, b.height, j, K), V = L.current, B = P.current;
3552
- if (B.length === 0) return;
3553
- const me = V.to - V.from + 1, Z = g.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), R = Math.max(
3554
- E.plotWidth / cl,
3555
- Math.min(B.length, E.plotWidth / il, me * Z)
3556
- ), se = V.from + (ne - E.plotLeft) / (E.plotWidth / me), ge = (se - V.from) / me;
3557
- let ce = se - ge * R, ue = ce + R - 1;
3558
- ce < 0 && (ce = 0, ue = R - 1), ue > B.length - 1 && (ue = B.length - 1, ce = ue - R + 1), L.current = { from: ce, to: ue }, te.current?.(L.current, B), v();
3562
+ const x = g.currentTarget.getBoundingClientRect(), te = g.clientX - x.left, D = Nt(x.width, x.height, _, q), Y = $.current, I = C.current;
3563
+ if (I.length === 0) return;
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();
3559
3570
  },
3560
- [j, K, v]
3561
- ), Ce = fe(
3571
+ [_, q, ee]
3572
+ ), Ce = pe(
3562
3573
  (g) => {
3563
- const b = L.current, ne = b.to - b.from + 1, E = P.current;
3564
- if (E.length === 0) return;
3565
- let V = 0;
3566
- if (g.key === "ArrowLeft") V = -Math.max(1, Math.floor(ne * 0.1));
3567
- else if (g.key === "ArrowRight") V = Math.max(1, Math.floor(ne * 0.1));
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));
3568
3579
  else return;
3569
3580
  g.preventDefault();
3570
- let B = b.from + V, me = b.to + V;
3571
- B < 0 && (B = 0, me = ne - 1), me > E.length - 1 && (me = E.length - 1, B = me - ne + 1), L.current = { from: B, to: me }, te.current?.(L.current, E), v();
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();
3572
3583
  },
3573
- [v]
3574
- ), Se = fe(() => {
3575
- if (w.current) return;
3576
- const g = P.current;
3584
+ [ee]
3585
+ ), Re = pe(() => {
3586
+ if (V.current) return;
3587
+ const g = C.current;
3577
3588
  if (g.length === 0) return;
3578
- w.current = !0;
3579
- const b = zt(n), ne = g[0].time, E = ne - b * l, V = ne - b;
3580
- e.getBars({ symbol: t, resolution: n, from: E, to: V, countBack: l }).then((B) => {
3581
- if (B.length === 0) {
3582
- w.current = !1;
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) => {
3592
+ if (I.length === 0) {
3593
+ V.current = !1;
3583
3594
  return;
3584
3595
  }
3585
- const Z = [...B].sort((se, ge) => se.time - ge.time).filter((se) => se.time < ne), R = L.current;
3586
- P.current = [...Z, ...g], L.current = { from: R.from + Z.length, to: R.to + Z.length }, w.current = !1, v();
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();
3587
3598
  }).catch(() => {
3588
- w.current = !1;
3599
+ V.current = !1;
3589
3600
  });
3590
- }, [e, t, n, l, v]);
3591
- return /* @__PURE__ */ O(
3601
+ }, [e, t, n, l, ee]);
3602
+ return /* @__PURE__ */ j(
3592
3603
  "div",
3593
3604
  {
3594
- ref: X,
3595
- className: f($.root, I),
3596
- style: { ...C, height: a, position: "relative" },
3605
+ ref: E,
3606
+ className: m(M.root, J),
3607
+ style: { ...W, height: a, position: "relative" },
3597
3608
  tabIndex: 0,
3598
3609
  role: "figure",
3599
3610
  "aria-label": `${t} ${n} chart`,
@@ -3602,20 +3613,20 @@ function Vl({
3602
3613
  /* @__PURE__ */ s(
3603
3614
  "canvas",
3604
3615
  {
3605
- ref: Q,
3606
- className: $.svg,
3607
- onPointerDown: U,
3608
- onPointerMove: de,
3609
- onPointerUp: he,
3610
- onPointerLeave: ye,
3616
+ ref: Z,
3617
+ className: M.svg,
3618
+ onPointerDown: G,
3619
+ onPointerMove: O,
3620
+ onPointerUp: le,
3621
+ onPointerLeave: ge,
3611
3622
  onWheel: be,
3612
- style: { cursor: le.current ? "grabbing" : "crosshair", touchAction: "none" }
3623
+ style: { cursor: ne.current ? "grabbing" : "crosshair", touchAction: "none" }
3613
3624
  }
3614
3625
  ),
3615
- /* @__PURE__ */ O(
3626
+ /* @__PURE__ */ j(
3616
3627
  "div",
3617
3628
  {
3618
- className: $.tradingHeader,
3629
+ className: M.tradingHeader,
3619
3630
  style: {
3620
3631
  position: "absolute",
3621
3632
  top: ol,
@@ -3628,22 +3639,22 @@ function Vl({
3628
3639
  gap: 8
3629
3640
  },
3630
3641
  children: [
3631
- /* @__PURE__ */ O("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: [
3632
3643
  /* @__PURE__ */ s("strong", { children: t }),
3633
3644
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3634
- ie?.bar && /* @__PURE__ */ O("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: [
3635
3646
  "O ",
3636
- ie.bar.open.toFixed(i),
3647
+ ce.bar.open.toFixed(i),
3637
3648
  " · H ",
3638
- ie.bar.high.toFixed(i),
3649
+ ce.bar.high.toFixed(i),
3639
3650
  " · L",
3640
3651
  " ",
3641
- ie.bar.low.toFixed(i),
3652
+ ce.bar.low.toFixed(i),
3642
3653
  " · C ",
3643
- ie.bar.close.toFixed(i)
3654
+ ce.bar.close.toFixed(i)
3644
3655
  ] })
3645
3656
  ] }),
3646
- k && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3657
+ b && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3647
3658
  qt,
3648
3659
  {
3649
3660
  position: "bottom",
@@ -3661,7 +3672,7 @@ function Vl({
3661
3672
  content: /* @__PURE__ */ s(
3662
3673
  dl,
3663
3674
  {
3664
- timezone: M,
3675
+ timezone: N,
3665
3676
  onTimezoneChange: y
3666
3677
  }
3667
3678
  )
@@ -3688,7 +3699,7 @@ function dl({
3688
3699
  timezone: e,
3689
3700
  onTimezoneChange: t
3690
3701
  }) {
3691
- return /* @__PURE__ */ O("div", { style: { minWidth: 220, padding: 4 }, children: [
3702
+ return /* @__PURE__ */ j("div", { style: { minWidth: 220, padding: 4 }, children: [
3692
3703
  /* @__PURE__ */ s(
3693
3704
  "div",
3694
3705
  {
@@ -3700,7 +3711,7 @@ function dl({
3700
3711
  children: "Settings"
3701
3712
  }
3702
3713
  ),
3703
- /* @__PURE__ */ O("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: [
3704
3715
  /* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
3705
3716
  /* @__PURE__ */ s(
3706
3717
  Vt,
@@ -3714,7 +3725,7 @@ function dl({
3714
3725
  ] });
3715
3726
  }
3716
3727
  function ul() {
3717
- return /* @__PURE__ */ O(
3728
+ return /* @__PURE__ */ j(
3718
3729
  "svg",
3719
3730
  {
3720
3731
  viewBox: "0 0 24 24",
@@ -3734,10 +3745,10 @@ function ul() {
3734
3745
  function Nt(e, t, n, r) {
3735
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);
3736
3747
  let u = h, d = i;
3737
- const m = { top: i, bottom: l, height: h };
3738
- let p = null, S = null;
3739
- const k = n ? Ht.rsi : 0, T = r ? Ht.volume : 0;
3740
- return u = h * (1 - k - T), m.top = d, m.height = u, m.bottom = m.top + u, d = m.bottom, n && (p = { top: d, height: h * k, bottom: d + h * k }, d = p.bottom), r && (S = { top: d, height: h * T, bottom: d + h * T }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: m, rsi: p, volume: S };
3748
+ const f = { top: i, bottom: l, height: h };
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 };
3741
3752
  }
3742
3753
  function hl(e, t) {
3743
3754
  if (t === 0) return { from: 0, to: 0 };
@@ -3771,12 +3782,12 @@ function cn(e, t, n, r, o) {
3771
3782
  for (const d of t)
3772
3783
  d.low < c && (c = d.low), d.high > i && (i = d.high);
3773
3784
  for (const d of n) {
3774
- const m = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3775
- for (const p of m) {
3776
- const S = Math.max(0, Math.floor(r)), k = Math.min(p.length - 1, Math.ceil(o));
3777
- for (let T = S; T <= k; T++) {
3778
- const N = p[T];
3779
- N != null && (N < c && (c = N), N > i && (i = N));
3785
+ const f = d.kind === "line" ? [d.values] : [d.upper, d.lower];
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));
3780
3791
  }
3781
3792
  }
3782
3793
  }
@@ -3794,7 +3805,7 @@ function fl(e, t, n, r) {
3794
3805
  const l = qe(0, o || 1, 3), a = Math.max(l[l.length - 1], o);
3795
3806
  return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: 0, priceMax: a, ticks: l };
3796
3807
  }
3797
- function Me(e, t) {
3808
+ function we(e, t) {
3798
3809
  const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
3799
3810
  return t.paneBottom - n * t.paneHeight;
3800
3811
  }
@@ -3834,7 +3845,7 @@ function gl(e, t, n, r) {
3834
3845
  function Lt(e, t, n, r, o, c = !1) {
3835
3846
  e.strokeStyle = o.grid, e.lineWidth = 1, e.beginPath();
3836
3847
  for (const i of r.ticks) {
3837
- const l = Math.round(Me(i, r)) + 0.5;
3848
+ const l = Math.round(we(i, r)) + 0.5;
3838
3849
  e.moveTo(t, l), e.lineTo(n, l);
3839
3850
  }
3840
3851
  e.stroke();
@@ -3842,35 +3853,35 @@ function Lt(e, t, n, r, o, c = !1) {
3842
3853
  function yl(e, t, n, r, o) {
3843
3854
  e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
3844
3855
  for (const c of n.ticks) {
3845
- const i = Me(c, n);
3856
+ const i = we(c, n);
3846
3857
  e.fillText(c.toFixed(r), t.plotRight + 6, i);
3847
3858
  }
3848
3859
  }
3849
3860
  function vl(e, t, n, r, o, c, i, l) {
3850
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);
3851
3862
  for (let d = a; d <= h; d++) {
3852
- const m = t[d], p = o(d), S = Me(m.open, i), k = Me(m.close, i), T = Me(m.high, i), N = Me(m.low, i), C = m.close >= m.open ? l.up : l.down;
3853
- e.strokeStyle = C, e.fillStyle = C, e.beginPath();
3854
- const X = Math.round(p) + 0.5;
3855
- e.moveTo(X, T), e.lineTo(X, N), e.stroke();
3856
- const Q = Math.min(S, k), P = Math.max(1, Math.abs(k - S));
3857
- e.fillRect(Math.round(p - u / 2), Math.round(Q), Math.round(u), Math.round(P));
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));
3858
3869
  }
3859
3870
  }
3860
3871
  function bl(e, t, n, r, o, c, i, l) {
3861
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));
3862
3873
  e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
3863
3874
  for (let d = a; d <= h; d++) {
3864
- const m = t[d], p = Math.round(o(d)) + 0.5, S = Me(m.high, i), k = Me(m.low, i), T = Me(m.open, i), N = Me(m.close, i), I = m.close >= m.open;
3865
- e.strokeStyle = I ? l.up : l.down, e.beginPath(), e.moveTo(p, S), e.lineTo(p, k), e.moveTo(p - u, T), e.lineTo(p, T), e.moveTo(p, N), e.lineTo(p + 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();
3866
3877
  }
3867
3878
  }
3868
3879
  function xl(e, t, n, r, o, c, i, l) {
3869
3880
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3870
3881
  if (!(h <= a)) {
3871
- e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), Me(t[a].close, c));
3882
+ e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, c));
3872
3883
  for (let u = a + 1; u <= h; u++)
3873
- e.lineTo(o(u), Me(t[u].close, c));
3884
+ e.lineTo(o(u), we(t[u].close, c));
3874
3885
  e.stroke(), l && (e.globalAlpha = 0.18, e.fillStyle = i, e.lineTo(o(h), c.paneBottom), e.lineTo(o(a), c.paneBottom), e.closePath(), e.fill(), e.globalAlpha = 1);
3875
3886
  }
3876
3887
  }
@@ -3883,14 +3894,14 @@ function kl(e, t, n, r, o, c, i, l) {
3883
3894
  e.globalAlpha = t.fillOpacity, e.fillStyle = t.color, e.beginPath();
3884
3895
  let u = !1;
3885
3896
  for (let d = a; d <= h; d++) {
3886
- const m = t.upper[d];
3887
- if (m == null) continue;
3888
- const p = i(d), S = Me(m, l);
3889
- u ? e.lineTo(p, S) : (e.moveTo(p, S), u = !0);
3897
+ const f = t.upper[d];
3898
+ if (f == null) continue;
3899
+ const p = i(d), L = we(f, l);
3900
+ u ? e.lineTo(p, L) : (e.moveTo(p, L), u = !0);
3890
3901
  }
3891
3902
  for (let d = h; d >= a; d--) {
3892
- const m = t.lower[d];
3893
- m != null && e.lineTo(i(d), Me(m, l));
3903
+ const f = t.lower[d];
3904
+ f != null && e.lineTo(i(d), we(f, l));
3894
3905
  }
3895
3906
  e.closePath(), e.fill(), e.globalAlpha = 1, Qe(e, t.upper, o, c, i, l, t.color), Qe(e, t.lower, o, c, i, l, t.color), Qe(e, t.middle, o, c, i, l, t.color);
3896
3907
  }
@@ -3904,30 +3915,30 @@ function Qe(e, t, n, r, o, c, i) {
3904
3915
  l = !1;
3905
3916
  continue;
3906
3917
  }
3907
- const m = o(u), p = Me(d, c);
3908
- l ? e.lineTo(m, p) : (e.moveTo(m, p), l = !0);
3918
+ const f = o(u), p = we(d, c);
3919
+ l ? e.lineTo(f, p) : (e.moveTo(f, p), l = !0);
3909
3920
  }
3910
3921
  e.stroke();
3911
3922
  }
3912
- function wl(e, t, n, r, o, c, i, l) {
3923
+ function Ml(e, t, n, r, o, c, i, l) {
3913
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);
3914
3925
  for (let d = a; d <= h; d++) {
3915
- const m = t[d], p = m.volume ?? 0;
3926
+ const f = t[d], p = f.volume ?? 0;
3916
3927
  if (p === 0) continue;
3917
- const S = m.close >= m.open;
3918
- e.fillStyle = S ? l.up : l.down, e.globalAlpha = 0.55;
3919
- const k = Me(p, i), T = i.paneBottom - k;
3920
- e.fillRect(Math.round(o(d) - u / 2), Math.round(k), Math.round(u), Math.round(T));
3928
+ const L = f.close >= f.open;
3929
+ e.fillStyle = L ? l.up : l.down, e.globalAlpha = 0.55;
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));
3921
3932
  }
3922
3933
  e.globalAlpha = 1;
3923
3934
  }
3924
- function Ml(e, t, n, r, o, c) {
3935
+ function wl(e, t, n, r, o, c) {
3925
3936
  e.strokeStyle = c.grid, e.setLineDash([3, 3]), e.beginPath();
3926
3937
  for (const i of [r, o]) {
3927
- const l = Math.round(Me(i, n)) + 0.5;
3938
+ const l = Math.round(we(i, n)) + 0.5;
3928
3939
  e.moveTo(t.plotLeft, l), e.lineTo(t.plotRight, l);
3929
3940
  }
3930
- e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, Me(r, n)), e.fillText(String(o), t.plotRight + 6, Me(o, n));
3941
+ e.stroke(), e.setLineDash([]), e.fillStyle = c.axis, e.font = "10px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(String(r), t.plotRight + 6, we(r, n)), e.fillText(String(o), t.plotRight + 6, we(o, n));
3931
3942
  }
3932
3943
  function Ft(e, t, n, r, o) {
3933
3944
  e.fillStyle = o.textMuted, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "top", e.fillText(r, t.plotLeft + 6, n.top + 4);
@@ -3935,27 +3946,27 @@ function Ft(e, t, n, r, o) {
3935
3946
  function $l(e, t, n, r, o, c, i) {
3936
3947
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3937
3948
  e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3938
- const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + At / 2;
3949
+ const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), f = t.plotBottom + At / 2;
3939
3950
  for (let p = u; p <= d; p += h) {
3940
- const S = n[p], k = t.plotLeft + (p - r + 0.5) * a;
3941
- e.fillText(Sl(S.time, c), k, m);
3951
+ const L = n[p], b = t.plotLeft + (p - r + 0.5) * a;
3952
+ e.fillText(Rl(L.time, c), b, f);
3942
3953
  }
3943
3954
  }
3944
3955
  function Nl(e, t, n, r, o, c, i, l, a, h, u) {
3945
3956
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3946
- const d = c - o + 1, m = t.plotWidth / d, p = o + (n.x - t.plotLeft) / m - 0.5, S = Math.round(p), k = Math.max(0, Math.min(r.length - 1, S)), T = i(k);
3947
- if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(T + 0.5, t.plotTop), e.lineTo(T + 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) {
3948
- const N = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3949
- 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);
3950
3961
  }
3951
- if (r[k]) {
3952
- const N = sn(r[k].time, h);
3962
+ if (r[b]) {
3963
+ const w = sn(r[b].time, h);
3953
3964
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3954
- const X = e.measureText(N).width + 8 * 2, Q = At, P = Math.max(
3965
+ const E = e.measureText(w).width + 8 * 2, Z = At, C = Math.max(
3955
3966
  t.plotLeft,
3956
- Math.min(t.plotRight - X, T - X / 2)
3957
- ), L = t.plotBottom;
3958
- e.fillStyle = u.text, e.fillRect(P, L, X, Q), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(N, P + X / 2, L + Q / 2);
3967
+ Math.min(t.plotRight - E, R - E / 2)
3968
+ ), $ = t.plotBottom;
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);
3959
3970
  }
3960
3971
  e.restore();
3961
3972
  }
@@ -3963,14 +3974,14 @@ function Ll(e, t, n, r, o, c, i) {
3963
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);
3964
3975
  return e < a.paneTop || e > a.paneBottom ? null : a.priceMax - (e - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3965
3976
  }
3966
- function Sl(e, t) {
3977
+ function Rl(e, t) {
3967
3978
  const n = new Date(e * 1e3);
3968
3979
  return t === "D" || t === "W" || t === "M" ? `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())}` : `${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}`;
3969
3980
  }
3970
3981
  function sn(e, t) {
3971
3982
  const n = new Date(e * 1e3);
3972
3983
  if (t === "local")
3973
- 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)}`;
3974
3985
  if (t === "utc")
3975
3986
  return `${n.getUTCFullYear()}-${Te(n.getUTCMonth() + 1)}-${Te(n.getUTCDate())} ${Te(n.getUTCHours())}:${Te(n.getUTCMinutes())}:${Te(n.getUTCSeconds())} UTC`;
3976
3987
  try {
@@ -3991,7 +4002,7 @@ function sn(e, t) {
3991
4002
  return sn(e, "utc");
3992
4003
  }
3993
4004
  }
3994
- function Rl(e) {
4005
+ function Sl(e) {
3995
4006
  const t = -e.getTimezoneOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t);
3996
4007
  return `${n}${Te(Math.floor(r / 60))}:${Te(r % 60)}`;
3997
4008
  }
@@ -4039,16 +4050,16 @@ const Cl = $e(
4039
4050
  className: h,
4040
4051
  style: u
4041
4052
  }, d) => {
4042
- const { line: m, area: p, last: S } = ke(() => {
4053
+ const { line: f, area: p, last: L } = ke(() => {
4043
4054
  if (e.length === 0) return { line: "", area: "", last: null };
4044
- const k = o, T = Math.max(1, t - k * 2), N = Math.max(1, n - k * 2), [I, C] = bt(e), X = Je([0, Math.max(1, e.length - 1)], [k, k + T]), Q = Je([I, C], [k + N, k]), P = e.map((le, w) => ({ x: X(w), y: Q(le) })), L = Tl(P, c), J = i ? `${L} L ${P[P.length - 1].x} ${k + N} L ${P[0].x} ${k + N} Z` : "";
4045
- return { line: L, area: J, last: P[P.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] };
4046
4057
  }, [e, t, n, o, c, i]);
4047
- return /* @__PURE__ */ O(
4058
+ return /* @__PURE__ */ j(
4048
4059
  "svg",
4049
4060
  {
4050
4061
  ref: d,
4051
- className: f($.sparkline, h),
4062
+ className: m(M.sparkline, h),
4052
4063
  style: u,
4053
4064
  width: t,
4054
4065
  height: n,
@@ -4057,10 +4068,10 @@ const Cl = $e(
4057
4068
  "aria-label": a,
4058
4069
  children: [
4059
4070
  i && p && /* @__PURE__ */ s("path", { d: p, fill: r, opacity: 0.18 }),
4060
- m && /* @__PURE__ */ s(
4071
+ f && /* @__PURE__ */ s(
4061
4072
  "path",
4062
4073
  {
4063
- d: m,
4074
+ d: f,
4064
4075
  fill: "none",
4065
4076
  stroke: r,
4066
4077
  strokeWidth: o,
@@ -4068,7 +4079,7 @@ const Cl = $e(
4068
4079
  strokeLinecap: "round"
4069
4080
  }
4070
4081
  ),
4071
- l && S && /* @__PURE__ */ s("circle", { cx: S.x, cy: S.y, r: o + 1, fill: r })
4082
+ l && L && /* @__PURE__ */ s("circle", { cx: L.x, cy: L.y, r: o + 1, fill: r })
4072
4083
  ]
4073
4084
  }
4074
4085
  );
@@ -4111,8 +4122,8 @@ export {
4111
4122
  Yl as suggestPeriodForResolution,
4112
4123
  Ul as suggestResolutionForPeriod,
4113
4124
  xo as useClickOutside,
4114
- wo as useFocusTrap,
4115
- Rt as useKeyboard,
4125
+ Mo as useFocusTrap,
4126
+ St as useKeyboard,
4116
4127
  Ur as useTableSort,
4117
4128
  _l as volumeSeries
4118
4129
  };