@overdoser/react-toolkit 0.0.10 → 0.0.12

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
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";
2
+ import { jsxs as z, 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", 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 = {
19
19
  root: pn,
20
20
  loading: gn,
21
21
  primary: yn,
@@ -23,8 +23,8 @@ 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,
@@ -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__ */ z(
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__ */ z("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__ */ z(
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,10 +222,10 @@ 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", 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 = {
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,
@@ -258,31 +258,31 @@ function Ur(e, t = []) {
258
258
  });
259
259
  }, []), c = fe((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, y) => y !== u);
269
269
  });
270
270
  }, []), i = fe(() => {
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__ */ z("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__ */ z("nav", { className: m(ve.paginator, c?.paginator), "aria-label": "Table pagination", children: [
310
+ /* @__PURE__ */ z("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__ */ z("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__ */ z("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: y = "No data",
381
+ pagination: L,
382
+ classes: v
381
383
  }) {
382
384
  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);
385
+ sortedData: N,
386
+ sortConfig: D,
387
+ requestSort: j,
388
+ requestMultiSort: Z
389
+ } = Ur(e, n), U = S ? n ?? [] : D, C = S ? e : N, $ = ke(() => {
390
+ if (!L || S) return C;
391
+ const R = (L.page - 1) * L.pageSize;
392
+ return C.slice(R, R + L.pageSize);
393
+ }, [C, L, S]), oe = L?.totalRows ?? C.length, ce = fe(
394
+ (R, te) => {
395
+ const H = o && (te.ctrlKey || te.metaKey);
394
396
  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);
397
+ if (H) {
398
+ const O = U.findIndex((F) => F.key === R);
399
+ let A;
400
+ O === -1 ? A = [...U, { key: R, direction: "asc" }] : U[O].direction === "asc" ? A = U.map(
401
+ (F, ne) => ne === O ? { key: R, direction: "desc" } : F
402
+ ) : A = U.filter((F, ne) => ne !== O), r(A);
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 O = U.find((A) => A.key === R);
405
+ O ? O.direction === "asc" ? r([{ key: R, direction: "desc" }]) : r([]) : r([{ key: R, direction: "asc" }]);
404
406
  }
405
407
  else
406
- oe ? I(w) : N(w);
408
+ H ? Z(R) : j(R);
407
409
  },
408
410
  [
409
411
  S,
410
412
  o,
411
- C,
413
+ U,
412
414
  r,
413
- N,
414
- I
415
+ j,
416
+ Z
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
+ ), q = (R) => U.find((H) => H.key === R)?.direction, ae = (R) => {
419
+ if (U.length <= 1) return;
420
+ const te = U.findIndex((H) => H.key === R);
421
+ return te >= 0 ? te : void 0;
420
422
  };
421
- return /* @__PURE__ */ O("div", { className: f(ve.wrapper, p?.wrapper), children: [
422
- /* @__PURE__ */ O(
423
+ return /* @__PURE__ */ z("div", { className: m(ve.wrapper, v?.wrapper), children: [
424
+ /* @__PURE__ */ z(
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
+ v?.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((R) => /* @__PURE__ */ z(
436
438
  "th",
437
439
  {
438
- className: f(
440
+ className: m(
439
441
  ve.headerCell,
440
- w.sortable && ve.headerCellSortable,
441
- p?.headerCell
442
+ R.sortable && ve.headerCellSortable,
443
+ v?.headerCell
442
444
  ),
443
445
  style: {
444
- width: w.width,
445
- textAlign: w.align
446
+ width: R.width,
447
+ textAlign: R.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: R.sortable ? (te) => ce(R.key, te) : void 0,
450
+ "aria-sort": R.sortable ? q(R.key) === "asc" ? "ascending" : q(R.key) === "desc" ? "descending" : "none" : void 0,
449
451
  children: [
450
- w.header,
451
- w.sortable && /* @__PURE__ */ s(
452
+ R.header,
453
+ R.sortable && /* @__PURE__ */ s(
452
454
  Yr,
453
455
  {
454
- direction: J(w.key),
455
- sortIndex: le(w.key)
456
+ direction: q(R.key),
457
+ sortIndex: ae(R.key)
456
458
  }
457
459
  )
458
460
  ]
459
461
  },
460
- w.key
462
+ R.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, v?.emptyCell), colSpan: t.length, children: y }) }) : $.map((R, te) => {
465
+ const H = u ? String(R[u]) : te, O = typeof d == "function" ? d(R, te) : d, A = typeof f == "function" ? f(R, te) : f;
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, v?.row, O),
470
+ style: A,
471
+ children: t.map((F) => /* @__PURE__ */ s(
472
+ "td",
473
+ {
474
+ className: m(ve.cell, v?.cell),
475
+ style: { textAlign: F.align },
476
+ children: F.render ? F.render(R[F.key], R, te) : R[F.key]
477
+ },
478
+ F.key
479
+ ))
470
480
  },
471
- ee.key
472
- )) }, oe);
481
+ H
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: oe,
492
+ paginatorClasses: { paginator: v?.paginator, pageButton: v?.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,
@@ -546,114 +556,114 @@ const Vt = $e(
546
556
  placeholder: h = "Select...",
547
557
  value: u,
548
558
  onChange: d,
549
- error: m = !1,
550
- 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();
559
+ error: f = !1,
560
+ fullWidth: y = !0,
561
+ portal: L = !0,
562
+ classes: v
563
+ }, S) => {
564
+ const [N, D] = Le(!1), j = re(null), Z = re(null), U = re(null), C = Ye();
555
565
  Ne(() => {
556
- N && X.current && X.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
566
+ N && Z.current && Z.current.querySelector('[role="menuitem"]:not(:disabled)')?.focus();
557
567
  }, [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;
568
+ const $ = fe(() => {
569
+ D(!1), l?.(), U.current?.focus();
570
+ }, [l]), oe = fe(() => {
571
+ D((A) => {
572
+ const F = !A;
573
+ return F ? i?.() : l?.(), F;
564
574
  });
565
- }, [i, l]), le = fe(
566
- (H) => {
567
- d?.(H), L();
575
+ }, [i, l]), ce = fe(
576
+ (A) => {
577
+ d?.(A), $();
568
578
  },
569
- [d, L]
579
+ [d, $]
570
580
  );
571
581
  Ne(() => {
572
582
  if (!N) return;
573
- const H = (te) => {
574
- const ie = te.target;
575
- C.current?.contains(ie) || X.current?.contains(ie) || L();
583
+ const A = (F) => {
584
+ const ne = F.target;
585
+ j.current?.contains(ne) || Z.current?.contains(ne) || $();
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
+ }, [N, $]), Rt(
579
589
  {
580
- Escape: () => L()
590
+ Escape: () => $()
581
591
  },
582
592
  N
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 q = Tt(U, N && L), ae = a?.find((A) => A.value === u)?.label, R = a ? ae || h : e, te = a && !ae, H = a ? a.map((A) => /* @__PURE__ */ s(
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
+ v?.item
594
604
  ),
595
- disabled: H.disabled,
596
- onClick: () => le(H.value),
597
- children: H.label
605
+ disabled: A.disabled,
606
+ onClick: () => ce(A.value),
607
+ children: A.label
598
608
  },
599
- H.value
600
- )) : t, Y = (H) => /* @__PURE__ */ s(
609
+ A.value
610
+ )) : t, O = (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: Z,
614
+ id: C,
615
+ className: m(
616
+ Me.menu,
617
+ N && Me.menuOpen,
618
+ n === "left" ? Me.alignLeft : Me.alignRight,
619
+ !L && y && Me.fullWidth,
620
+ v?.menu
611
621
  ),
612
- style: H,
622
+ style: A,
613
623
  role: "menu",
614
- children: z
624
+ children: H
615
625
  }
616
626
  );
617
- return /* @__PURE__ */ O(
627
+ return /* @__PURE__ */ z(
618
628
  "div",
619
629
  {
620
- ref: T,
621
- className: f(we.root, p && we.fullWidth, k?.root, r),
630
+ ref: S,
631
+ className: m(Me.root, y && Me.fullWidth, v?.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__ */ z("div", { ref: j, style: y ? { width: "100%" } : void 0, children: [
635
+ /* @__PURE__ */ z(
626
636
  "button",
627
637
  {
628
- ref: Q,
638
+ ref: U,
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
+ N && Me.triggerOpen,
644
+ f && Me.triggerError,
645
+ y && Me.fullWidth,
646
+ v?.trigger
637
647
  ),
638
- onClick: J,
648
+ onClick: oe,
639
649
  "aria-expanded": N,
640
650
  "aria-haspopup": "menu",
641
- "aria-controls": N ? P : void 0,
651
+ "aria-controls": N ? 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, te && Me.placeholder, v?.triggerLabel), children: R }),
654
+ /* @__PURE__ */ s("span", { className: m(Me.chevron, v?.chevron), "aria-hidden": "true" })
645
655
  ]
646
656
  }
647
657
  ),
648
- !S && Y()
658
+ !L && O()
649
659
  ] }),
650
- S && N && typeof document < "u" && pt(
651
- Y({
660
+ L && N && typeof document < "u" && pt(
661
+ O({
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: q.top + 4,
664
+ left: n === "right" ? void 0 : q.left,
665
+ right: n === "right" ? window.innerWidth - (q.left + q.width) : void 0,
666
+ minWidth: q.width,
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 = re(null), y = re(null), L = re(null), v = Ye(), S = o !== void 0, N = S ? o : u, D = fe(
741
+ (C) => {
742
+ S || 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
+ [S, c]
745
+ ), j = fe(() => {
746
+ D(!1), L.current?.focus();
747
+ }, [D]), Z = fe(() => {
748
+ D(!N);
749
+ }, [N, D]);
750
+ xo(f, j, N), Rt(
741
751
  {
742
- Escape: () => C()
752
+ Escape: () => j()
743
753
  },
744
754
  N
745
755
  ), Ne(() => {
746
- if (N && p.current) {
747
- const P = p.current.querySelector(
756
+ if (N && y.current) {
757
+ const C = y.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() : y.current.focus();
751
761
  }
752
762
  }, [N]);
753
- let Q;
763
+ let U;
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
+ U = Xt(C, {
767
+ ref: ko(L, $),
768
+ onClick: (oe) => {
769
+ C.props.onClick?.(oe), Z();
760
770
  },
761
- className: f(P.props.className, i?.trigger),
771
+ className: m(C.props.className, i?.trigger),
762
772
  "aria-expanded": N,
763
773
  "aria-haspopup": "dialog",
764
- "aria-controls": N ? k : void 0
774
+ "aria-controls": N ? v : void 0
765
775
  });
766
776
  } else
767
- Q = /* @__PURE__ */ s(
777
+ U = /* @__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,
782
+ className: m(at.trigger, i?.trigger),
783
+ onClick: Z,
774
784
  "aria-expanded": N,
775
785
  "aria-haspopup": "dialog",
776
- "aria-controls": N ? k : void 0,
786
+ "aria-controls": N ? v : 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,
796
+ children: /* @__PURE__ */ z("div", { ref: f, children: [
797
+ U,
788
798
  N && /* @__PURE__ */ s(
789
799
  "div",
790
800
  {
791
- ref: p,
792
- id: k,
801
+ ref: y,
802
+ id: v,
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,7 +820,7 @@ const It = [
810
820
  "a[href]",
811
821
  '[tabindex]:not([tabindex="-1"])'
812
822
  ].join(", ");
813
- function wo(e, t) {
823
+ function Mo(e, t) {
814
824
  const n = re(null), r = fe(
815
825
  (o) => {
816
826
  if (o.key !== "Tab" || !e.current)
@@ -837,8 +847,8 @@ 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", 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 = {
851
+ backdrop: wo,
842
852
  backdropIn: $o,
843
853
  modal: No,
844
854
  modalIn: Lo,
@@ -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__ */ z(
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 = re(null), y = d ?? f, L = Ye(), v = u ?? `${L}-title`;
914
+ Mo(y, e);
915
+ const S = 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
+ Rt(S, e), Ne(() => {
914
924
  if (!e) return;
915
- const I = document.body.style.overflow;
925
+ const D = document.body.style.overflow;
916
926
  return document.body.style.overflow = "hidden", () => {
917
- document.body.style.overflow = I;
927
+ document.body.style.overflow = D;
918
928
  };
919
929
  }, [e]);
920
- const N = (I) => {
921
- n && I.target === I.currentTarget && t();
930
+ const N = (D) => {
931
+ n && D.target === D.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),
937
+ className: m(ze.backdrop, c?.backdrop),
928
938
  onClick: N,
929
939
  role: "presentation",
930
940
  children: /* @__PURE__ */ s(
931
941
  "div",
932
942
  {
933
- ref: p,
934
- className: f(ze.modal, ze[o], c?.modal, i),
943
+ ref: y,
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 : v,
950
+ children: /* @__PURE__ */ s(gt.Provider, { value: { classes: c ?? {}, titleId: v }, 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__ */ z(
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, y = typeof f == "string" ? "" : f?.displayName ?? f?.name ?? "", L = Yo.has(y), { ref: v, ...S } = u, N = re(v);
1016
+ N.current = v;
1017
+ const D = fe(
1018
+ (j) => {
1019
+ if (j) {
1020
+ const Z = j.matches("input, select, textarea, button, [tabindex]") ? j : j.querySelector('input, select, textarea, button, [tabindex]:not([tabindex="-1"])');
1021
+ N.current(Z ?? j);
1012
1022
  } else
1013
1023
  N.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__ */ z("div", { className: m(We.field, c?.field, i), style: l, children: [
1029
+ t && /* @__PURE__ */ z("label", { className: m(We.label, d.error && We.labelError, c?.label), htmlFor: e, children: [
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
+ ...S,
1035
+ ref: D,
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: S.onChange,
1045
+ onValuesChange: S.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 S.value == "boolean" ? S.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__ */ z(
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", 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 = {
1101
1111
  wrapper: oi,
1102
1112
  sm: ii,
1103
1113
  md: ci,
@@ -1116,8 +1126,8 @@ 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,
@@ -1144,20 +1154,20 @@ 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__ */ z("div", { className: m(W.wrapper, W[e], t && W.error, o?.wrapper, c), style: i, children: [
1158
+ /* @__PURE__ */ z(
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(W.root, W[e], t && W.error, o?.root),
1153
1163
  ...d,
1154
1164
  children: [
1155
1165
  r && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: r }),
1156
- n ? n.map((p) => /* @__PURE__ */ s("option", { value: p.value, disabled: p.disabled, children: p.label }, p.value)) : l
1166
+ n ? n.map((y) => /* @__PURE__ */ s("option", { value: y.value, disabled: y.disabled, children: y.label }, y.value)) : l
1157
1167
  ]
1158
1168
  }
1159
1169
  ),
1160
- /* @__PURE__ */ s("span", { className: f(W.arrow, o?.arrow) })
1170
+ /* @__PURE__ */ s("span", { className: m(W.arrow, o?.arrow) })
1161
1171
  ] })
1162
1172
  );
1163
1173
  Qt.displayName = "NativeSelect";
@@ -1175,80 +1185,80 @@ const Jt = $e(
1175
1185
  id: h,
1176
1186
  searchPlaceholder: u = "Search...",
1177
1187
  onChange: d,
1178
- onValueChange: m,
1179
- 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);
1188
+ onValueChange: f,
1189
+ portal: y = !0
1190
+ }, L) => {
1191
+ const [v, S] = Le(!1), [N, D] = Le(""), [j, Z] = Le(0), U = re(null), C = re(null), $ = re(null), oe = re(null), ce = re(null), q = Ye(), ae = Tt($, v && y), R = re(null), te = L ?? R, H = re(!1);
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(
1193
+ H.current && !v && $.current?.focus(), H.current = v;
1194
+ }, [v]);
1195
+ const O = fe(() => {
1196
+ S(!1), D(""), Z(0);
1197
+ }, []), A = fe(() => {
1198
+ a || (S(!0), D(""), Z(0), setTimeout(() => C.current?.focus(), 0));
1199
+ }, [a]), F = fe(
1190
1200
  (M) => {
1191
- if (m?.(M), ee.current) {
1201
+ if (f?.(M), te.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(te.current, M);
1206
+ const k = new Event("change", { bubbles: !0 });
1207
+ te.current.dispatchEvent(k), d?.(k);
1198
1208
  }
1199
- Y();
1209
+ O();
1200
1210
  },
1201
- [m, d, ee, Y]
1202
- ), ie = ke(() => {
1211
+ [f, d, te, O]
1212
+ ), ne = ke(() => {
1203
1213
  if (!N) return n;
1204
1214
  const M = N.toLowerCase();
1205
- return n.filter((y) => y.label.toLowerCase().includes(M));
1215
+ return n.filter((g) => g.label.toLowerCase().includes(M));
1206
1216
  }, [n, N]);
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;
1218
+ const M = ne.findIndex((g) => !g.disabled);
1219
+ Z(M >= 0 ? M : 0);
1220
+ }, [ne]), Ne(() => {
1221
+ if (!v) return;
1222
+ const M = ce.current;
1213
1223
  if (!M) return;
1214
- M.querySelectorAll('[role="option"]')[C]?.scrollIntoView?.({ block: "nearest" });
1215
- }, [C, k]);
1224
+ M.querySelectorAll('[role="option"]')[j]?.scrollIntoView?.({ block: "nearest" });
1225
+ }, [j, v]);
1216
1226
  const pe = fe(
1217
1227
  (M) => {
1218
- const y = ie.map((x, A) => x.disabled ? -1 : A).filter((x) => x >= 0);
1219
- if (y.length !== 0)
1228
+ const g = ne.map((k, B) => k.disabled ? -1 : B).filter((k) => k >= 0);
1229
+ if (g.length !== 0)
1220
1230
  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];
1231
+ M.preventDefault(), Z((k) => {
1232
+ const B = g.indexOf(k);
1233
+ return B < g.length - 1 ? g[B + 1] : g[0];
1224
1234
  });
1225
1235
  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];
1236
+ M.preventDefault(), Z((k) => {
1237
+ const B = g.indexOf(k);
1238
+ return B > 0 ? g[B - 1] : g[g.length - 1];
1229
1239
  });
1230
1240
  else if (M.key === "Enter") {
1231
1241
  M.preventDefault();
1232
- const x = ie[C];
1233
- x && !x.disabled && te(x.value);
1234
- } else M.key === "Escape" && (M.preventDefault(), Y());
1242
+ const k = ne[j];
1243
+ k && !k.disabled && F(k.value);
1244
+ } else M.key === "Escape" && (M.preventDefault(), O());
1235
1245
  },
1236
- [ie, C, te, Y]
1246
+ [ne, j, F, O]
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 (!v) return;
1250
+ const M = (g) => {
1251
+ const k = g.target;
1252
+ U.current?.contains(k) || oe.current?.contains(k) || O();
1243
1253
  };
1244
1254
  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(
1255
+ }, [v, O]);
1256
+ const K = n.find((M) => M.value === l)?.label, X = ne.filter((M) => !M.disabled);
1257
+ return /* @__PURE__ */ z(
1248
1258
  "div",
1249
1259
  {
1250
- ref: Q,
1251
- className: f(
1260
+ ref: U,
1261
+ className: m(
1252
1262
  W.wrapper,
1253
1263
  W.searchableWrapper,
1254
1264
  W[e],
@@ -1262,7 +1272,7 @@ const Jt = $e(
1262
1272
  /* @__PURE__ */ s(
1263
1273
  "select",
1264
1274
  {
1265
- ref: ee,
1275
+ ref: te,
1266
1276
  className: W.hiddenSelect,
1267
1277
  value: l ?? "",
1268
1278
  disabled: a,
@@ -1273,39 +1283,39 @@ const Jt = $e(
1273
1283
  children: n.map((M) => /* @__PURE__ */ s("option", { value: M.value, children: M.label }, M.value))
1274
1284
  }
1275
1285
  ),
1276
- /* @__PURE__ */ O(
1286
+ /* @__PURE__ */ z(
1277
1287
  "button",
1278
1288
  {
1279
- ref: L,
1289
+ ref: $,
1280
1290
  id: h,
1281
1291
  type: "button",
1282
- className: f(
1292
+ className: m(
1283
1293
  W.root,
1284
1294
  W.searchableTrigger,
1285
1295
  W[e],
1286
- k && W.triggerOpen,
1296
+ v && W.triggerOpen,
1287
1297
  t && W.error,
1288
- k && W.visuallyHidden,
1298
+ v && W.visuallyHidden,
1289
1299
  o?.root
1290
1300
  ),
1291
- onClick: H,
1301
+ onClick: A,
1292
1302
  disabled: a,
1293
- "aria-expanded": k,
1303
+ "aria-expanded": v,
1294
1304
  "aria-haspopup": "listbox",
1295
- "aria-controls": k ? w : void 0,
1305
+ "aria-controls": v ? q : 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(W.triggerLabel, !K && W.placeholder), children: K || r }),
1308
+ /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowInline, o?.arrow) })
1299
1309
  ]
1300
1310
  }
1301
1311
  ),
1302
- k && /* @__PURE__ */ s(
1312
+ v && /* @__PURE__ */ s(
1303
1313
  "input",
1304
1314
  {
1305
- ref: P,
1315
+ ref: C,
1306
1316
  type: "text",
1307
1317
  role: "combobox",
1308
- className: f(
1318
+ className: m(
1309
1319
  W.root,
1310
1320
  W.searchableTrigger,
1311
1321
  W[e],
@@ -1314,55 +1324,56 @@ const Jt = $e(
1314
1324
  o?.root,
1315
1325
  o?.search
1316
1326
  ),
1317
- placeholder: G || r,
1327
+ placeholder: K || r,
1318
1328
  value: N,
1319
- onChange: (M) => I(M.target.value),
1329
+ onChange: (M) => D(M.target.value),
1320
1330
  onKeyDown: pe,
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": q,
1334
+ "aria-activedescendant": X.length > 0 ? `select-option-${ne[j]?.value}` : void 0
1325
1335
  }
1326
1336
  ),
1327
- k && (() => {
1328
- const M = p ? {
1337
+ v && (() => {
1338
+ const M = y ? {
1329
1339
  position: "fixed",
1330
- top: q.top + 4,
1331
- left: q.left,
1332
- minWidth: q.width,
1340
+ top: ae.top + 4,
1341
+ left: ae.left,
1342
+ right: "auto",
1343
+ width: ae.width,
1333
1344
  zIndex: "var(--crk-z-floating)"
1334
- } : void 0, y = /* @__PURE__ */ s(
1345
+ } : void 0, g = /* @__PURE__ */ s(
1335
1346
  "div",
1336
1347
  {
1337
- id: w,
1338
- ref: J,
1339
- className: f(W.menu, o?.menu),
1348
+ id: q,
1349
+ ref: oe,
1350
+ className: m(W.menu, o?.menu),
1340
1351
  style: M,
1341
1352
  role: "listbox",
1342
- 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: W.menuItems, ref: ce, children: ne.length === 0 ? /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }) : ne.map((k, B) => /* @__PURE__ */ s(
1343
1354
  "button",
1344
1355
  {
1345
- id: `select-option-${x.value}`,
1356
+ id: `select-option-${k.value}`,
1346
1357
  type: "button",
1347
1358
  role: "option",
1348
- "aria-selected": x.value === l,
1349
- className: f(
1359
+ "aria-selected": k.value === l,
1360
+ className: m(
1350
1361
  W.item,
1351
- x.disabled && W.itemDisabled,
1352
- x.value === l && W.itemSelected,
1353
- A === C && W.itemHighlighted,
1362
+ k.disabled && W.itemDisabled,
1363
+ k.value === l && W.itemSelected,
1364
+ B === j && W.itemHighlighted,
1354
1365
  o?.item
1355
1366
  ),
1356
- disabled: x.disabled,
1357
- onClick: () => te(x.value),
1358
- onMouseEnter: () => X(A),
1359
- children: x.content ?? x.label
1367
+ disabled: k.disabled,
1368
+ onClick: () => F(k.value),
1369
+ onMouseEnter: () => Z(B),
1370
+ children: k.content ?? k.label
1360
1371
  },
1361
- x.value
1372
+ k.value
1362
1373
  )) })
1363
1374
  }
1364
1375
  );
1365
- return p && typeof document < "u" ? pt(y, document.body) : y;
1376
+ return y && typeof document < "u" ? pt(g, document.body) : g;
1366
1377
  })()
1367
1378
  ]
1368
1379
  }
@@ -1384,92 +1395,92 @@ const en = $e(
1384
1395
  id: h,
1385
1396
  searchPlaceholder: u,
1386
1397
  onValuesChange: d,
1387
- clearSearchOnSelect: m = !0,
1388
- allowCreate: p = !1,
1389
- onCreate: S,
1390
- createLabel: k,
1391
- portal: T = !0
1398
+ clearSearchOnSelect: f = !0,
1399
+ allowCreate: y = !1,
1400
+ onCreate: L,
1401
+ createLabel: v,
1402
+ portal: S = !0
1392
1403
  }, N) => {
1393
- 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(() => {
1394
- X(!1), P(""), J(0);
1404
+ const D = Array.isArray(l) ? l : l ? [l] : [], [j, Z] = Le(!1), [U, C] = Le(""), [$, oe] = Le(0), ce = re(null), q = re(null), ae = re(null), R = re(null), te = re(null), H = Ye(), O = Tt(te, j && S), A = re(null), F = N ?? A, ne = fe(() => {
1405
+ Z(!1), C(""), oe(0);
1395
1406
  }, []), pe = fe(() => {
1396
- a || (X(!0), P(""), J(0), setTimeout(() => w.current?.focus(), 0));
1397
- }, [a]), G = fe(
1398
- (v) => {
1399
- const D = I.includes(v) ? I.filter((U) => U !== v) : [...I, v];
1400
- d?.(D), m && P("");
1407
+ a || (Z(!0), C(""), oe(0), setTimeout(() => q.current?.focus(), 0));
1408
+ }, [a]), K = fe(
1409
+ (b) => {
1410
+ const E = D.includes(b) ? D.filter((V) => V !== b) : [...D, b];
1411
+ d?.(E), f && C("");
1401
1412
  },
1402
- [I, d, m]
1403
- ), F = fe(
1404
- (v, D) => {
1405
- D.stopPropagation(), d?.(I.filter((U) => U !== v));
1413
+ [D, d, f]
1414
+ ), X = fe(
1415
+ (b, E) => {
1416
+ E.stopPropagation(), d?.(D.filter((V) => V !== b));
1406
1417
  },
1407
- [I, d]
1418
+ [D, d]
1408
1419
  ), M = ke(() => {
1409
- if (!Q) return n;
1410
- const v = Q.toLowerCase();
1411
- return n.filter((D) => D.label.toLowerCase().includes(v));
1412
- }, [n, Q]), y = Q.trim(), x = p && y.length > 0 && !n.some(
1413
- (v) => v.label.toLowerCase() === y.toLowerCase() || v.value === y
1414
- ) && !I.includes(y), A = fe(() => {
1415
- y && (I.includes(y) || (S?.(y), d?.([...I, y]), m && P("")));
1416
- }, [y, I, S, d, m]);
1420
+ if (!U) return n;
1421
+ const b = U.toLowerCase();
1422
+ return n.filter((E) => E.label.toLowerCase().includes(b));
1423
+ }, [n, U]), g = U.trim(), k = y && g.length > 0 && !n.some(
1424
+ (b) => b.label.toLowerCase() === g.toLowerCase() || b.value === g
1425
+ ) && !D.includes(g), B = fe(() => {
1426
+ g && (D.includes(g) || (L?.(g), d?.([...D, g]), f && C("")));
1427
+ }, [g, D, L, d, f]);
1417
1428
  Ne(() => {
1418
- const v = M.findIndex((D) => !D.disabled);
1419
- J(v >= 0 ? v : 0);
1429
+ const b = M.findIndex((E) => !E.disabled);
1430
+ oe(b >= 0 ? b : 0);
1420
1431
  }, [M]), Ne(() => {
1421
- if (!C) return;
1422
- const v = oe.current;
1423
- if (!v) return;
1424
- v.querySelectorAll('[role="option"]')[L]?.scrollIntoView?.({ block: "nearest" });
1425
- }, [L, C]);
1426
- const j = M.length, K = fe(
1427
- (v) => {
1428
- const D = M.map((U, de) => U.disabled ? -1 : de).filter((U) => U >= 0);
1429
- if (x && D.push(j), v.key === "Backspace" && Q === "" && I.length > 0) {
1430
- v.preventDefault(), d?.(I.slice(0, -1));
1432
+ if (!j) return;
1433
+ const b = R.current;
1434
+ if (!b) return;
1435
+ b.querySelectorAll('[role="option"]')[$]?.scrollIntoView?.({ block: "nearest" });
1436
+ }, [$, j]);
1437
+ const _ = M.length, J = fe(
1438
+ (b) => {
1439
+ const E = M.map((V, de) => V.disabled ? -1 : de).filter((V) => V >= 0);
1440
+ if (k && E.push(_), b.key === "Backspace" && U === "" && D.length > 0) {
1441
+ b.preventDefault(), d?.(D.slice(0, -1));
1431
1442
  return;
1432
1443
  }
1433
- if (D.length !== 0)
1434
- if (v.key === "ArrowDown") {
1435
- if (v.preventDefault(), !C) {
1444
+ if (E.length !== 0)
1445
+ if (b.key === "ArrowDown") {
1446
+ if (b.preventDefault(), !j) {
1436
1447
  pe();
1437
1448
  return;
1438
1449
  }
1439
- J((U) => {
1440
- const de = D.indexOf(U);
1441
- return de < D.length - 1 ? D[de + 1] : D[0];
1450
+ oe((V) => {
1451
+ const de = E.indexOf(V);
1452
+ return de < E.length - 1 ? E[de + 1] : E[0];
1442
1453
  });
1443
- } else if (v.key === "ArrowUp")
1444
- v.preventDefault(), J((U) => {
1445
- const de = D.indexOf(U);
1446
- return de > 0 ? D[de - 1] : D[D.length - 1];
1454
+ } else if (b.key === "ArrowUp")
1455
+ b.preventDefault(), oe((V) => {
1456
+ const de = E.indexOf(V);
1457
+ return de > 0 ? E[de - 1] : E[E.length - 1];
1447
1458
  });
1448
- else if (v.key === "Enter") {
1449
- if (v.preventDefault(), x && L === j) {
1450
- A();
1459
+ else if (b.key === "Enter") {
1460
+ if (b.preventDefault(), k && $ === _) {
1461
+ B();
1451
1462
  return;
1452
1463
  }
1453
- const U = M[L];
1454
- U && !U.disabled ? G(U.value) : x && A();
1455
- } else v.key === "Escape" && (v.preventDefault(), ie());
1464
+ const V = M[$];
1465
+ V && !V.disabled ? K(V.value) : k && B();
1466
+ } else b.key === "Escape" && (b.preventDefault(), ne());
1456
1467
  },
1457
- [M, L, G, ie, Q, I, d, C, pe, x, A, j]
1468
+ [M, $, K, ne, U, D, d, j, pe, k, B, _]
1458
1469
  );
1459
1470
  Ne(() => {
1460
- if (!C) return;
1461
- const v = (D) => {
1462
- const U = D.target;
1463
- le.current?.contains(U) || q.current?.contains(U) || ie();
1471
+ if (!j) return;
1472
+ const b = (E) => {
1473
+ const V = E.target;
1474
+ ce.current?.contains(V) || ae.current?.contains(V) || ne();
1464
1475
  };
1465
- return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
1466
- }, [C, ie]);
1467
- const _ = I.map((v) => n.find((U) => U.value === v) ?? { value: v, label: v });
1468
- return /* @__PURE__ */ O(
1476
+ return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
1477
+ }, [j, ne]);
1478
+ const Y = D.map((b) => n.find((V) => V.value === b) ?? { value: b, label: b });
1479
+ return /* @__PURE__ */ z(
1469
1480
  "div",
1470
1481
  {
1471
- ref: le,
1472
- className: f(
1482
+ ref: ce,
1483
+ className: m(
1473
1484
  W.wrapper,
1474
1485
  W.searchableWrapper,
1475
1486
  W[e],
@@ -1483,134 +1494,135 @@ const en = $e(
1483
1494
  /* @__PURE__ */ s(
1484
1495
  "select",
1485
1496
  {
1486
- ref: te,
1497
+ ref: F,
1487
1498
  className: W.hiddenSelect,
1488
1499
  multiple: !0,
1489
- value: I,
1500
+ value: D,
1490
1501
  disabled: a,
1491
1502
  tabIndex: -1,
1492
1503
  "aria-hidden": "true",
1493
1504
  onChange: () => {
1494
1505
  },
1495
- children: n.map((v) => /* @__PURE__ */ s("option", { value: v.value, children: v.label }, v.value))
1506
+ children: n.map((b) => /* @__PURE__ */ s("option", { value: b.value, children: b.label }, b.value))
1496
1507
  }
1497
1508
  ),
1498
- /* @__PURE__ */ O(
1509
+ /* @__PURE__ */ z(
1499
1510
  "div",
1500
1511
  {
1501
- ref: ee,
1502
- className: f(
1512
+ ref: te,
1513
+ className: m(
1503
1514
  W.multiTrigger,
1504
1515
  W[e],
1505
- C && W.triggerOpen,
1516
+ j && W.triggerOpen,
1506
1517
  t && W.error,
1507
1518
  a && W.multiTriggerDisabled,
1508
1519
  o?.root
1509
1520
  ),
1510
1521
  onClick: () => {
1511
- C ? w.current?.focus() : pe();
1522
+ j ? q.current?.focus() : pe();
1512
1523
  },
1513
1524
  role: "combobox",
1514
- "aria-expanded": C,
1525
+ "aria-expanded": j,
1515
1526
  "aria-haspopup": "listbox",
1516
- "aria-controls": C ? z : void 0,
1527
+ "aria-controls": j ? H : void 0,
1517
1528
  children: [
1518
- _.map((v) => /* @__PURE__ */ O("span", { className: f(W.chip, o?.chip), children: [
1519
- /* @__PURE__ */ s("span", { className: W.chipLabel, children: v.content ?? v.label }),
1529
+ Y.map((b) => /* @__PURE__ */ z("span", { className: m(W.chip, o?.chip), children: [
1530
+ /* @__PURE__ */ s("span", { className: W.chipLabel, children: b.content ?? b.label }),
1520
1531
  /* @__PURE__ */ s(
1521
1532
  "button",
1522
1533
  {
1523
1534
  type: "button",
1524
- className: f(W.chipRemove, o?.chipRemove),
1525
- onClick: (D) => F(v.value, D),
1526
- "aria-label": `Remove ${v.label}`,
1535
+ className: m(W.chipRemove, o?.chipRemove),
1536
+ onClick: (E) => X(b.value, E),
1537
+ "aria-label": `Remove ${b.label}`,
1527
1538
  tabIndex: -1,
1528
1539
  children: "×"
1529
1540
  }
1530
1541
  )
1531
- ] }, v.value)),
1542
+ ] }, b.value)),
1532
1543
  /* @__PURE__ */ s(
1533
1544
  "input",
1534
1545
  {
1535
- ref: w,
1546
+ ref: q,
1536
1547
  id: h,
1537
1548
  type: "text",
1538
1549
  className: W.multiSearch,
1539
- placeholder: I.length === 0 ? r : "",
1540
- value: Q,
1541
- onChange: (v) => {
1542
- P(v.target.value), C || pe();
1550
+ placeholder: D.length === 0 ? r : "",
1551
+ value: U,
1552
+ onChange: (b) => {
1553
+ C(b.target.value), j || pe();
1543
1554
  },
1544
- onKeyDown: K,
1555
+ onKeyDown: J,
1545
1556
  disabled: a,
1546
1557
  "aria-label": "Search options"
1547
1558
  }
1548
1559
  ),
1549
- /* @__PURE__ */ s("span", { className: f(W.arrow, W.arrowMulti, o?.arrow) })
1560
+ /* @__PURE__ */ s("span", { className: m(W.arrow, W.arrowMulti, o?.arrow) })
1550
1561
  ]
1551
1562
  }
1552
1563
  ),
1553
- C && (() => {
1554
- const v = T ? {
1564
+ j && (() => {
1565
+ const b = S ? {
1555
1566
  position: "fixed",
1556
- top: Y.top + 4,
1557
- left: Y.left,
1558
- minWidth: Y.width,
1567
+ top: O.top + 4,
1568
+ left: O.left,
1569
+ right: "auto",
1570
+ width: O.width,
1559
1571
  zIndex: "var(--crk-z-floating)"
1560
- } : void 0, D = /* @__PURE__ */ s(
1572
+ } : void 0, E = /* @__PURE__ */ s(
1561
1573
  "div",
1562
1574
  {
1563
- id: z,
1564
- ref: q,
1565
- className: f(W.menu, o?.menu),
1566
- style: v,
1575
+ id: H,
1576
+ ref: ae,
1577
+ className: m(W.menu, o?.menu),
1578
+ style: b,
1567
1579
  role: "listbox",
1568
1580
  "aria-multiselectable": "true",
1569
- children: /* @__PURE__ */ O("div", { className: W.menuItems, ref: oe, children: [
1570
- M.length === 0 && !x && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
1571
- M.map((U, de) => {
1572
- const he = I.includes(U.value);
1573
- return /* @__PURE__ */ O(
1581
+ children: /* @__PURE__ */ z("div", { className: W.menuItems, ref: R, children: [
1582
+ M.length === 0 && !k && /* @__PURE__ */ s("div", { className: W.noResults, children: "No results" }),
1583
+ M.map((V, de) => {
1584
+ const he = D.includes(V.value);
1585
+ return /* @__PURE__ */ z(
1574
1586
  "button",
1575
1587
  {
1576
- id: `select-option-${U.value}`,
1588
+ id: `select-option-${V.value}`,
1577
1589
  type: "button",
1578
1590
  role: "option",
1579
1591
  "aria-selected": he,
1580
- className: f(
1592
+ className: m(
1581
1593
  W.item,
1582
- U.disabled && W.itemDisabled,
1594
+ V.disabled && W.itemDisabled,
1583
1595
  he && W.itemSelected,
1584
- de === L && W.itemHighlighted,
1596
+ de === $ && W.itemHighlighted,
1585
1597
  o?.item
1586
1598
  ),
1587
- disabled: U.disabled,
1588
- onClick: () => G(U.value),
1589
- onMouseEnter: () => J(de),
1599
+ disabled: V.disabled,
1600
+ onClick: () => K(V.value),
1601
+ onMouseEnter: () => oe(de),
1590
1602
  children: [
1591
1603
  he && /* @__PURE__ */ s("span", { className: W.itemCheck, "aria-hidden": "true" }),
1592
- U.content ?? U.label
1604
+ V.content ?? V.label
1593
1605
  ]
1594
1606
  },
1595
- U.value
1607
+ V.value
1596
1608
  );
1597
1609
  }),
1598
- x && /* @__PURE__ */ s(
1610
+ k && /* @__PURE__ */ s(
1599
1611
  "button",
1600
1612
  {
1601
1613
  type: "button",
1602
1614
  role: "option",
1603
1615
  "aria-selected": !1,
1604
- className: f(
1616
+ className: m(
1605
1617
  W.item,
1606
- L === j && W.itemHighlighted,
1618
+ $ === _ && W.itemHighlighted,
1607
1619
  o?.item
1608
1620
  ),
1609
- onClick: A,
1610
- onMouseEnter: () => J(j),
1611
- children: k ? k(y) : /* @__PURE__ */ O(je, { children: [
1621
+ onClick: B,
1622
+ onMouseEnter: () => oe(_),
1623
+ children: v ? v(g) : /* @__PURE__ */ z(je, { children: [
1612
1624
  "Create “",
1613
- /* @__PURE__ */ s("strong", { children: y }),
1625
+ /* @__PURE__ */ s("strong", { children: g }),
1614
1626
  "”"
1615
1627
  ] })
1616
1628
  },
@@ -1619,7 +1631,7 @@ const en = $e(
1619
1631
  ] })
1620
1632
  }
1621
1633
  );
1622
- return T && typeof document < "u" ? pt(D, document.body) : D;
1634
+ return S && typeof document < "u" ? pt(E, document.body) : E;
1623
1635
  })()
1624
1636
  ]
1625
1637
  }
@@ -1648,10 +1660,10 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1648
1660
  const l = re(null);
1649
1661
  return Ne(() => {
1650
1662
  l.current && (l.current.indeterminate = t);
1651
- }, [t]), /* @__PURE__ */ O(
1663
+ }, [t]), /* @__PURE__ */ z(
1652
1664
  "label",
1653
1665
  {
1654
- className: f(dt.root, t && dt.indeterminate, n?.root, r),
1666
+ className: m(dt.root, t && dt.indeterminate, n?.root, r),
1655
1667
  style: o,
1656
1668
  children: [
1657
1669
  /* @__PURE__ */ s(
@@ -1661,11 +1673,11 @@ const Wi = "crk-root-61cKD", Hi = "crk-input-bAjPU", Oi = "crk-label-W9IeS", Fi
1661
1673
  l.current = a, typeof i == "function" ? i(a) : i && (i.current = a);
1662
1674
  },
1663
1675
  type: "checkbox",
1664
- className: f(dt.input, n?.input),
1676
+ className: m(dt.input, n?.input),
1665
1677
  ...c
1666
1678
  }
1667
1679
  ),
1668
- e && /* @__PURE__ */ s("span", { className: f(dt.label, n?.label), children: e })
1680
+ e && /* @__PURE__ */ s("span", { className: m(dt.label, n?.label), children: e })
1669
1681
  ]
1670
1682
  }
1671
1683
  );
@@ -1692,7 +1704,7 @@ const ji = "crk-group-NNwCD", Xi = "crk-root-7fGik", _i = "crk-input-43PQW", Ui
1692
1704
  "div",
1693
1705
  {
1694
1706
  id: i,
1695
- className: f(ht.group, r),
1707
+ className: m(ht.group, r),
1696
1708
  style: o,
1697
1709
  role: "radiogroup",
1698
1710
  tabIndex: -1,
@@ -1715,24 +1727,24 @@ const Vi = $e(
1715
1727
  name: l,
1716
1728
  ...a
1717
1729
  }, h) => {
1718
- const u = ft(tn), d = u?.name ?? l, m = u ? u.value === t : i, p = (S) => {
1719
- u?.onChange?.(t), c?.(S);
1730
+ const u = ft(tn), d = u?.name ?? l, f = u ? u.value === t : i, y = (L) => {
1731
+ u?.onChange?.(t), c?.(L);
1720
1732
  };
1721
- return /* @__PURE__ */ O("label", { className: f(ht.root, n?.root, r), style: o, children: [
1733
+ return /* @__PURE__ */ z("label", { className: m(ht.root, n?.root, r), style: o, children: [
1722
1734
  /* @__PURE__ */ s(
1723
1735
  "input",
1724
1736
  {
1725
1737
  ref: h,
1726
1738
  type: "radio",
1727
- className: f(ht.input, n?.input),
1739
+ className: m(ht.input, n?.input),
1728
1740
  name: d,
1729
1741
  value: t,
1730
- checked: m,
1731
- onChange: p,
1742
+ checked: f,
1743
+ onChange: y,
1732
1744
  ...a
1733
1745
  }
1734
1746
  ),
1735
- e && /* @__PURE__ */ s("span", { className: f(ht.label, n?.label), children: e })
1747
+ e && /* @__PURE__ */ s("span", { className: m(ht.label, n?.label), children: e })
1736
1748
  ] });
1737
1749
  }
1738
1750
  );
@@ -1765,25 +1777,25 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1765
1777
  ...l
1766
1778
  }, a) => {
1767
1779
  const h = re(null), u = fe(() => {
1768
- const p = h.current;
1769
- p && (p.style.height = "auto", p.style.height = `${p.scrollHeight}px`);
1780
+ const y = h.current;
1781
+ y && (y.style.height = "auto", y.style.height = `${y.scrollHeight}px`);
1770
1782
  }, []), d = l.value ?? "";
1771
1783
  Ne(() => {
1772
1784
  r && u();
1773
1785
  }, [r, u, d]);
1774
- const m = fe(
1775
- (p) => {
1776
- r && u(), i?.(p);
1786
+ const f = fe(
1787
+ (y) => {
1788
+ r && u(), i?.(y);
1777
1789
  },
1778
1790
  [r, u, i]
1779
1791
  );
1780
1792
  return /* @__PURE__ */ s(
1781
1793
  "textarea",
1782
1794
  {
1783
- ref: (p) => {
1784
- h.current = p, typeof a == "function" ? a(p) : a && (a.current = p);
1795
+ ref: (y) => {
1796
+ h.current = y, typeof a == "function" ? a(y) : a && (a.current = y);
1785
1797
  },
1786
- className: f(
1798
+ className: m(
1787
1799
  Ke.root,
1788
1800
  Ke[e],
1789
1801
  t && Ke.error,
@@ -1791,7 +1803,7 @@ const qi = "crk-root-IGgdn", Gi = "crk-sm-N-5I2", Zi = "crk-md-bbyFl", Ki = "crk
1791
1803
  o
1792
1804
  ),
1793
1805
  style: c,
1794
- onChange: m,
1806
+ onChange: f,
1795
1807
  rows: l.rows ?? 1,
1796
1808
  ...l
1797
1809
  }
@@ -1805,8 +1817,8 @@ function cc(e, t = { width: 600, height: 300 }) {
1805
1817
  const c = e.current;
1806
1818
  if (!c || typeof ResizeObserver > "u") return;
1807
1819
  const i = (h, u) => {
1808
- const d = Math.max(0, Math.round(h)), m = Math.max(0, Math.round(u));
1809
- o.current.width === d && o.current.height === m || (o.current = { width: d, height: m }, r({ width: d, height: m }));
1820
+ const d = Math.max(0, Math.round(h)), f = Math.max(0, Math.round(u));
1821
+ o.current.width === d && o.current.height === f || (o.current = { width: d, height: f }, r({ width: d, height: f }));
1810
1822
  }, l = c.getBoundingClientRect();
1811
1823
  (l.width > 0 || l.height > 0) && i(l.width, l.height);
1812
1824
  const a = new ResizeObserver((h) => {
@@ -1818,7 +1830,7 @@ function cc(e, t = { width: 600, height: 300 }) {
1818
1830
  return a.observe(c), () => a.disconnect();
1819
1831
  }, [e]), n;
1820
1832
  }
1821
- 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", $ = {
1833
+ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc = "crk-gridLine-K2Gx9", uc = "crk-axis-Zum8-", hc = "crk-axisLabel-Ilv3u", mc = "crk-cursorLine-iNHim", fc = "crk-linePath-E4eYA", pc = "crk-areaPath-ZwMc6", gc = "crk-point-DTAoa", yc = "crk-bar-9sYbq", vc = "crk-barLabelInside-dlQh5", bc = "crk-activeBar-FJhPJ", xc = "crk-interactionLayer-dHNAG", kc = "crk-legend-JL6YI", Mc = "crk-legendItem-rcdvO", wc = "crk-legendSwatch-eJBsF", $c = "crk-legendIcon-6gzcO", Nc = "crk-legendLabel-C-eu3", Lc = "crk-tooltip-m55-N", Sc = "crk-tooltipTitle-0EfoX", Rc = "crk-tooltipRows-MC0wM", Tc = "crk-tooltipRow-ZQomr", Cc = "crk-tooltipLabel-s4OKX", Ac = "crk-tooltipValue-iwj1s", Bc = "crk-empty-aa4vk", Ic = "crk-sparkline-3-eRc", Dc = "crk-tradingHeader-Pb9wS", w = {
1822
1834
  root: lc,
1823
1835
  canvas: sc,
1824
1836
  svg: ac,
@@ -1834,8 +1846,8 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1834
1846
  activeBar: bc,
1835
1847
  interactionLayer: xc,
1836
1848
  legend: kc,
1837
- legendItem: wc,
1838
- legendSwatch: Mc,
1849
+ legendItem: Mc,
1850
+ legendSwatch: wc,
1839
1851
  legendIcon: $c,
1840
1852
  legendLabel: Nc,
1841
1853
  tooltip: Lc,
@@ -1851,24 +1863,24 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1851
1863
  ({ aspectRatio: e = 16 / 9, height: t, className: n, style: r, classes: o, legend: c, overlay: i, children: l }, a) => {
1852
1864
  const h = re(null);
1853
1865
  un(a, () => h.current);
1854
- const { width: u } = cc(h), d = Math.max(0, u), m = t ?? Math.round(d / e);
1855
- return /* @__PURE__ */ O(
1866
+ const { width: u } = cc(h), d = Math.max(0, u), f = t ?? Math.round(d / e);
1867
+ return /* @__PURE__ */ z(
1856
1868
  "div",
1857
1869
  {
1858
1870
  ref: h,
1859
- className: f($.root, o?.root, n),
1871
+ className: m(w.root, o?.root, n),
1860
1872
  style: r,
1861
1873
  children: [
1862
- /* @__PURE__ */ O("div", { className: $.canvas, style: { height: m || void 0 }, children: [
1863
- d > 0 && m > 0 && /* @__PURE__ */ s(
1874
+ /* @__PURE__ */ z("div", { className: w.canvas, style: { height: f || void 0 }, children: [
1875
+ d > 0 && f > 0 && /* @__PURE__ */ s(
1864
1876
  "svg",
1865
1877
  {
1866
- className: f($.svg, o?.svg),
1878
+ className: m(w.svg, o?.svg),
1867
1879
  width: d,
1868
- height: m,
1869
- viewBox: `0 0 ${d} ${m}`,
1880
+ height: f,
1881
+ viewBox: `0 0 ${d} ${f}`,
1870
1882
  role: "img",
1871
- children: l({ width: d, height: m })
1883
+ children: l({ width: d, height: f })
1872
1884
  }
1873
1885
  ),
1874
1886
  i
@@ -1882,13 +1894,13 @@ const lc = "crk-root-uMSq0", sc = "crk-canvas-zhFr0", ac = "crk-svg-waPLB", dc =
1882
1894
  Ve.displayName = "ChartContainer";
1883
1895
  function vt({ config: e, order: t, classes: n }) {
1884
1896
  const r = t ?? Object.keys(e);
1885
- return /* @__PURE__ */ s("div", { className: f($.legend, n?.legend), role: "list", children: r.map((o) => {
1897
+ return /* @__PURE__ */ s("div", { className: m(w.legend, n?.legend), role: "list", children: r.map((o) => {
1886
1898
  const c = e[o];
1887
- return c ? /* @__PURE__ */ O("div", { className: f($.legendItem, n?.legendItem), role: "listitem", children: [
1899
+ return c ? /* @__PURE__ */ z("div", { className: m(w.legendItem, n?.legendItem), role: "listitem", children: [
1888
1900
  c.icon ? /* @__PURE__ */ s(
1889
1901
  "span",
1890
1902
  {
1891
- className: $.legendIcon,
1903
+ className: w.legendIcon,
1892
1904
  style: { color: c.color },
1893
1905
  "aria-hidden": "true",
1894
1906
  children: c.icon
@@ -1896,12 +1908,12 @@ function vt({ config: e, order: t, classes: n }) {
1896
1908
  ) : /* @__PURE__ */ s(
1897
1909
  "span",
1898
1910
  {
1899
- className: $.legendSwatch,
1911
+ className: w.legendSwatch,
1900
1912
  style: { background: c.color },
1901
1913
  "aria-hidden": "true"
1902
1914
  }
1903
1915
  ),
1904
- /* @__PURE__ */ s("span", { className: $.legendLabel, children: c.label })
1916
+ /* @__PURE__ */ s("span", { className: w.legendLabel, children: c.label })
1905
1917
  ] }, o) : null;
1906
1918
  }) });
1907
1919
  }
@@ -1918,35 +1930,35 @@ function et({
1918
1930
  classes: h
1919
1931
  }) {
1920
1932
  if (!e) return null;
1921
- const u = 180, m = t + u + 16 > r ? t - u - 12 : t + 12, p = Math.max(8, n - 16);
1933
+ const u = 180, f = t + u + 16 > r ? t - u - 12 : t + 12, y = Math.max(8, n - 16);
1922
1934
  return /* @__PURE__ */ s(
1923
1935
  "div",
1924
1936
  {
1925
- className: f($.tooltip, h?.tooltip),
1926
- style: { left: m, top: p, width: u },
1937
+ className: m(w.tooltip, h?.tooltip),
1938
+ style: { left: f, top: y, width: u },
1927
1939
  role: "tooltip",
1928
- children: c ? c(e) : /* @__PURE__ */ O(je, { children: [
1929
- l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: $.tooltipTitle, children: String(e[l]) }),
1930
- /* @__PURE__ */ s("div", { className: $.tooltipRows, children: Object.entries(o).map(([S, k]) => {
1931
- const T = e[S];
1932
- if (T == null) return null;
1933
- const N = typeof T == "number" ? i(T) : String(T), I = a?.(S) ?? k.color;
1934
- return /* @__PURE__ */ O("div", { className: $.tooltipRow, children: [
1935
- /* @__PURE__ */ s("span", { className: $.legendSwatch, style: { background: I }, "aria-hidden": "true" }),
1936
- /* @__PURE__ */ s("span", { className: $.tooltipLabel, children: k.label }),
1937
- /* @__PURE__ */ s("span", { className: $.tooltipValue, children: N })
1938
- ] }, S);
1940
+ children: c ? c(e) : /* @__PURE__ */ z(je, { children: [
1941
+ l && e[l] !== void 0 && /* @__PURE__ */ s("div", { className: w.tooltipTitle, children: String(e[l]) }),
1942
+ /* @__PURE__ */ s("div", { className: w.tooltipRows, children: Object.entries(o).map(([L, v]) => {
1943
+ const S = e[L];
1944
+ if (S == null) return null;
1945
+ const N = typeof S == "number" ? i(S) : String(S), D = a?.(L) ?? v.color;
1946
+ return /* @__PURE__ */ z("div", { className: w.tooltipRow, children: [
1947
+ /* @__PURE__ */ s("span", { className: w.legendSwatch, style: { background: D }, "aria-hidden": "true" }),
1948
+ /* @__PURE__ */ s("span", { className: w.tooltipLabel, children: v.label }),
1949
+ /* @__PURE__ */ s("span", { className: w.tooltipValue, children: N })
1950
+ ] }, L);
1939
1951
  }) })
1940
1952
  ] })
1941
1953
  }
1942
1954
  );
1943
1955
  }
1944
1956
  function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes: c }) {
1945
- return /* @__PURE__ */ s("g", { className: f($.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ O("g", { children: [
1957
+ return /* @__PURE__ */ s("g", { className: m(w.axis, c?.axis), children: e.map(({ value: i, y: l }) => /* @__PURE__ */ z("g", { children: [
1946
1958
  o && /* @__PURE__ */ s(
1947
1959
  "line",
1948
1960
  {
1949
- className: f($.gridLine, c?.grid),
1961
+ className: m(w.gridLine, c?.grid),
1950
1962
  x1: t,
1951
1963
  x2: t + n,
1952
1964
  y1: l,
@@ -1956,7 +1968,7 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1956
1968
  /* @__PURE__ */ s(
1957
1969
  "text",
1958
1970
  {
1959
- className: f($.axisLabel, c?.axisLabel),
1971
+ className: m(w.axisLabel, c?.axisLabel),
1960
1972
  x: t - 8,
1961
1973
  y: l,
1962
1974
  textAnchor: "end",
@@ -1967,10 +1979,10 @@ function nn({ ticks: e, x: t, plotWidth: n, format: r, showGrid: o = !0, classes
1967
1979
  ] }, `y-${i}`)) });
1968
1980
  }
1969
1981
  function rn({ ticks: e, y: t, format: n, classes: r }) {
1970
- return /* @__PURE__ */ s("g", { className: f($.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1982
+ return /* @__PURE__ */ s("g", { className: m(w.axis, r?.axis), children: e.map(({ label: o, x: c }) => /* @__PURE__ */ s(
1971
1983
  "text",
1972
1984
  {
1973
- className: f($.axisLabel, r?.axisLabel),
1985
+ className: m(w.axisLabel, r?.axisLabel),
1974
1986
  x: c,
1975
1987
  y: t + 16,
1976
1988
  textAnchor: "middle",
@@ -2049,180 +2061,180 @@ function Ol({
2049
2061
  showValues: h = !1,
2050
2062
  valuePosition: u = "top",
2051
2063
  renderLabel: d,
2052
- activeIndex: m,
2053
- onPointClick: p,
2054
- showGrid: S = !0,
2055
- showLegend: k = !0,
2056
- showTooltip: T = !0,
2064
+ activeIndex: f,
2065
+ onPointClick: y,
2066
+ showGrid: L = !0,
2067
+ showLegend: v = !0,
2068
+ showTooltip: S = !0,
2057
2069
  yTickCount: N = 5,
2058
- yFormat: I,
2059
- xFormat: C,
2060
- valueFormat: X,
2061
- renderTooltip: Q,
2062
- margin: P,
2063
- emptyMessage: L = "No data",
2064
- className: J,
2065
- style: le,
2066
- classes: w
2070
+ yFormat: D,
2071
+ xFormat: j,
2072
+ valueFormat: Z,
2073
+ renderTooltip: U,
2074
+ margin: C,
2075
+ emptyMessage: $ = "No data",
2076
+ className: oe,
2077
+ style: ce,
2078
+ classes: q
2067
2079
  }) {
2068
- const q = { ...Ec, ...P }, oe = ke(() => Object.keys(n), [n]), [ee, z] = Le(null), Y = re(null), H = m ?? ee, te = (pe, G) => {
2080
+ const ae = { ...Ec, ...C }, R = ke(() => Object.keys(n), [n]), [te, H] = Le(null), O = re(null), A = f ?? te, F = (pe, K) => {
2069
2081
  if (l) {
2070
- const F = e[G]?.[l];
2071
- if (typeof F == "string") return F;
2082
+ const X = e[K]?.[l];
2083
+ if (typeof X == "string") return X;
2072
2084
  }
2073
2085
  return n[pe]?.color ?? "var(--crk-chart-1)";
2074
2086
  };
2075
2087
  if (e.length === 0)
2076
- 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 }) }) });
2077
- const ie = T && H !== null ? /* @__PURE__ */ s(
2088
+ return /* @__PURE__ */ s("div", { ref: O, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2089
+ const ne = S && A !== null ? /* @__PURE__ */ s(
2078
2090
  et,
2079
2091
  {
2080
- row: e[H],
2081
- x: Hc(e, t, q, H, Y),
2092
+ row: e[A],
2093
+ x: Hc(e, t, ae, A, O),
2082
2094
  y: 16,
2083
- containerWidth: Y.current?.getBoundingClientRect().width ?? 0,
2095
+ containerWidth: O.current?.getBoundingClientRect().width ?? 0,
2084
2096
  config: n,
2085
- render: Q ? () => Q(e[H]) : void 0,
2086
- valueFormat: X,
2097
+ render: U ? () => U(e[A]) : void 0,
2098
+ valueFormat: Z,
2087
2099
  titleKey: t,
2088
- resolveColor: l ? (pe) => te(pe, H) : void 0,
2089
- classes: w
2100
+ resolveColor: l ? (pe) => F(pe, A) : void 0,
2101
+ classes: q
2090
2102
  }
2091
2103
  ) : null;
2092
2104
  return /* @__PURE__ */ s(
2093
2105
  Ve,
2094
2106
  {
2095
- ref: Y,
2107
+ ref: O,
2096
2108
  aspectRatio: r,
2097
2109
  height: o,
2098
- className: J,
2099
- style: le,
2100
- classes: w,
2101
- legend: k ? /* @__PURE__ */ s(vt, { config: n, classes: w }) : void 0,
2102
- overlay: ie,
2103
- children: ({ width: pe, height: G }) => {
2104
- 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 = [];
2105
- for (const g of oe)
2106
- for (const b of e) {
2107
- const ne = b[g];
2108
- typeof ne == "number" && v.push(ne);
2110
+ className: oe,
2111
+ style: ce,
2112
+ classes: q,
2113
+ legend: v ? /* @__PURE__ */ s(vt, { config: n, classes: q }) : void 0,
2114
+ overlay: ne,
2115
+ children: ({ width: pe, height: K }) => {
2116
+ const X = ae.left, M = pe - ae.right, g = ae.top, k = K - ae.bottom, B = Math.max(0, M - X), _ = Math.max(0, k - g), J = e.map((p) => String(p[t])), Y = Xe(J, [X, M], 0), b = [];
2117
+ for (const p of R)
2118
+ for (const x of e) {
2119
+ const ee = x[p];
2120
+ typeof ee == "number" && b.push(ee);
2109
2121
  }
2110
- 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) }));
2111
- return /* @__PURE__ */ O(je, { children: [
2122
+ const [E, V] = bt(b), de = Math.min(0, E), he = qe(de, V, N), ye = Je([he[0], he[he.length - 1]], [k, g]), be = he.map((p) => ({ value: p, y: ye(p) })), Se = Wc(J).map((p) => ({ label: p, x: Y(p) }));
2123
+ return /* @__PURE__ */ z(je, { children: [
2112
2124
  /* @__PURE__ */ s(
2113
2125
  nn,
2114
2126
  {
2115
2127
  ticks: be,
2116
- x: F,
2117
- plotWidth: A,
2118
- format: I,
2119
- showGrid: S,
2120
- classes: w
2128
+ x: X,
2129
+ plotWidth: B,
2130
+ format: D,
2131
+ showGrid: L,
2132
+ classes: q
2121
2133
  }
2122
2134
  ),
2123
- /* @__PURE__ */ s(rn, { ticks: Se, y: x, format: C, classes: w }),
2124
- oe.map((g) => {
2125
- const b = n[g], ne = e.map((E, V) => {
2126
- const B = E[g], me = typeof B == "number" ? B : 0;
2127
- return { x: _(K[V]), y: ye(me), value: me, row: E };
2135
+ /* @__PURE__ */ s(rn, { ticks: Se, y: k, format: j, classes: q }),
2136
+ R.map((p) => {
2137
+ const x = n[p], ee = e.map((P, G) => {
2138
+ const I = P[p], me = typeof I == "number" ? I : 0;
2139
+ return { x: Y(J[G]), y: ye(me), value: me, row: P };
2128
2140
  });
2129
- return /* @__PURE__ */ O("g", { className: f($.series, w?.series), children: [
2141
+ return /* @__PURE__ */ z("g", { className: m(w.series, q?.series), children: [
2130
2142
  /* @__PURE__ */ s(
2131
2143
  "path",
2132
2144
  {
2133
- className: f($.linePath),
2134
- d: Pc(ne, c),
2135
- stroke: b.color
2145
+ className: m(w.linePath),
2146
+ d: Pc(ee, c),
2147
+ stroke: x.color
2136
2148
  }
2137
2149
  ),
2138
- i && ne.map((E, V) => {
2139
- 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;
2150
+ i && ee.map((P, G) => {
2151
+ const I = F(p, G), me = A === G, Q = f !== void 0 && !me, T = y ? () => y({ row: P.row, value: P.value, seriesKey: p, index: G }) : void 0;
2140
2152
  return a ? /* @__PURE__ */ s(
2141
2153
  "g",
2142
2154
  {
2143
- onClick: R,
2144
- style: R ? { cursor: "pointer" } : void 0,
2145
- opacity: Z ? 0.45 : 1,
2155
+ onClick: T,
2156
+ style: T ? { cursor: "pointer" } : void 0,
2157
+ opacity: Q ? 0.45 : 1,
2146
2158
  children: a({
2147
- row: E.row,
2148
- value: E.value,
2149
- seriesKey: g,
2150
- index: V,
2151
- x: E.x,
2152
- y: E.y,
2153
- color: B,
2159
+ row: P.row,
2160
+ value: P.value,
2161
+ seriesKey: p,
2162
+ index: G,
2163
+ x: P.x,
2164
+ y: P.y,
2165
+ color: I,
2154
2166
  active: me
2155
2167
  })
2156
2168
  },
2157
- `${g}-${V}`
2169
+ `${p}-${G}`
2158
2170
  ) : /* @__PURE__ */ s(
2159
2171
  "circle",
2160
2172
  {
2161
- className: f($.point, w?.point),
2162
- cx: E.x,
2163
- cy: E.y,
2173
+ className: m(w.point, q?.point),
2174
+ cx: P.x,
2175
+ cy: P.y,
2164
2176
  r: me ? 5 : 3.5,
2165
- fill: B,
2166
- onClick: R,
2167
- style: R ? { cursor: "pointer" } : void 0,
2168
- opacity: Z ? 0.45 : 1
2177
+ fill: I,
2178
+ onClick: T,
2179
+ style: T ? { cursor: "pointer" } : void 0,
2180
+ opacity: Q ? 0.45 : 1
2169
2181
  },
2170
- `${g}-${V}`
2182
+ `${p}-${G}`
2171
2183
  );
2172
2184
  }),
2173
- (h || d) && ne.map((E, V) => {
2174
- const B = d ? d({ row: E.row, value: E.value, seriesKey: g, index: V }) : h ? X ? X(E.value) : String(E.value) : null;
2175
- if (B == null) return null;
2176
- const me = 10, Z = u === "top" ? E.y - me : E.y + me + 4;
2185
+ (h || d) && ee.map((P, G) => {
2186
+ const I = d ? d({ row: P.row, value: P.value, seriesKey: p, index: G }) : h ? Z ? Z(P.value) : String(P.value) : null;
2187
+ if (I == null) return null;
2188
+ const me = 10, Q = u === "top" ? P.y - me : P.y + me + 4;
2177
2189
  return /* @__PURE__ */ s(
2178
2190
  "text",
2179
2191
  {
2180
- className: f($.axisLabel),
2181
- x: E.x,
2182
- y: Z,
2192
+ className: m(w.axisLabel),
2193
+ x: P.x,
2194
+ y: Q,
2183
2195
  textAnchor: "middle",
2184
2196
  dominantBaseline: u === "top" ? "auto" : "middle",
2185
- children: B
2197
+ children: I
2186
2198
  },
2187
- `label-${g}-${V}`
2199
+ `label-${p}-${G}`
2188
2200
  );
2189
2201
  })
2190
- ] }, g);
2202
+ ] }, p);
2191
2203
  }),
2192
- H !== null && /* @__PURE__ */ s(
2204
+ A !== null && /* @__PURE__ */ s(
2193
2205
  "line",
2194
2206
  {
2195
- className: $.cursorLine,
2196
- x1: _(K[H]),
2197
- x2: _(K[H]),
2198
- y1: y,
2199
- y2: x
2207
+ className: w.cursorLine,
2208
+ x1: Y(J[A]),
2209
+ x2: Y(J[A]),
2210
+ y1: g,
2211
+ y2: k
2200
2212
  }
2201
2213
  ),
2202
2214
  /* @__PURE__ */ s(
2203
2215
  "rect",
2204
2216
  {
2205
- className: $.interactionLayer,
2206
- x: F,
2207
- y,
2208
- width: A,
2209
- height: j,
2210
- onMouseMove: (g) => {
2211
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left + F, E = _.step(), V = Math.max(
2217
+ className: w.interactionLayer,
2218
+ x: X,
2219
+ y: g,
2220
+ width: B,
2221
+ height: _,
2222
+ onMouseMove: (p) => {
2223
+ const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2212
2224
  0,
2213
- Math.min(e.length - 1, Math.round((ne - F - E / 2) / E))
2225
+ Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2214
2226
  );
2215
- z(V);
2227
+ H(G);
2216
2228
  },
2217
- onMouseLeave: () => z(null),
2218
- onClick: p ? (g) => {
2219
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left + F, E = _.step(), V = Math.max(
2229
+ onMouseLeave: () => H(null),
2230
+ onClick: y ? (p) => {
2231
+ const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + X, P = Y.step(), G = Math.max(
2220
2232
  0,
2221
- Math.min(e.length - 1, Math.round((ne - F - E / 2) / E))
2222
- ), B = oe[0], me = e[V][B], Z = typeof me == "number" ? me : 0;
2223
- p({ row: e[V], value: Z, seriesKey: B, index: V });
2233
+ Math.min(e.length - 1, Math.round((ee - X - P / 2) / P))
2234
+ ), I = R[0], me = e[G][I], Q = typeof me == "number" ? me : 0;
2235
+ y({ row: e[G], value: Q, seriesKey: I, index: G });
2224
2236
  } : void 0,
2225
- style: p ? { cursor: "pointer" } : void 0
2237
+ style: y ? { cursor: "pointer" } : void 0
2226
2238
  }
2227
2239
  )
2228
2240
  ] });
@@ -2283,178 +2295,178 @@ function Fl({
2283
2295
  showGrid: h = !0,
2284
2296
  showXAxis: u = !0,
2285
2297
  showYAxis: d = !0,
2286
- showLegend: m = !0,
2287
- showTooltip: p = !0,
2288
- yTickCount: S = 5,
2289
- yFormat: k,
2290
- xFormat: T,
2298
+ showLegend: f = !0,
2299
+ showTooltip: y = !0,
2300
+ yTickCount: L = 5,
2301
+ yFormat: v,
2302
+ xFormat: S,
2291
2303
  valueFormat: N,
2292
- renderTooltip: I,
2293
- margin: C,
2294
- emptyMessage: X = "No data",
2295
- className: Q,
2296
- style: P,
2297
- classes: L
2304
+ renderTooltip: D,
2305
+ margin: j,
2306
+ emptyMessage: Z = "No data",
2307
+ className: U,
2308
+ style: C,
2309
+ classes: $
2298
2310
  }) {
2299
- const J = ke(
2311
+ const oe = ke(
2300
2312
  () => ({
2301
2313
  ...Oc,
2302
2314
  ...d ? {} : { left: 16 },
2303
- ...C
2315
+ ...j
2304
2316
  }),
2305
- [C, d]
2306
- ), le = ke(() => Object.keys(n), [n]), w = i && le.length > 0, q = w && l === "expand", [oe, ee] = Le(null), z = re(null), Y = Ye();
2317
+ [j, d]
2318
+ ), ce = ke(() => Object.keys(n), [n]), q = i && ce.length > 0, ae = q && l === "expand", [R, te] = Le(null), H = re(null), O = Ye();
2307
2319
  if (e.length === 0)
2308
- 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 }) }) });
2309
- const H = ke(() => {
2310
- const F = le.map(() => []), M = le.map(() => []);
2311
- for (let y = 0; y < e.length; y++) {
2312
- let x = 0;
2313
- if (q) {
2314
- for (const j of le) {
2315
- const K = e[y][j];
2316
- typeof K == "number" && K > 0 && (x += K);
2320
+ return /* @__PURE__ */ s("div", { ref: H, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
2321
+ const A = ke(() => {
2322
+ const X = ce.map(() => []), M = ce.map(() => []);
2323
+ for (let g = 0; g < e.length; g++) {
2324
+ let k = 0;
2325
+ if (ae) {
2326
+ for (const _ of ce) {
2327
+ const J = e[g][_];
2328
+ typeof J == "number" && J > 0 && (k += J);
2317
2329
  }
2318
- x === 0 && (x = 1);
2330
+ k === 0 && (k = 1);
2319
2331
  }
2320
- let A = 0;
2321
- for (let j = 0; j < le.length; j++) {
2322
- const K = le[j], _ = e[y][K], v = typeof _ == "number" ? _ : 0;
2323
- if (w) {
2324
- const D = q ? v / x : v;
2325
- M[j][y] = A, A += D, F[j][y] = A;
2332
+ let B = 0;
2333
+ for (let _ = 0; _ < ce.length; _++) {
2334
+ const J = ce[_], Y = e[g][J], b = typeof Y == "number" ? Y : 0;
2335
+ if (q) {
2336
+ const E = ae ? b / k : b;
2337
+ M[_][g] = B, B += E, X[_][g] = B;
2326
2338
  } else
2327
- M[j][y] = 0, F[j][y] = v;
2339
+ M[_][g] = 0, X[_][g] = b;
2328
2340
  }
2329
2341
  }
2330
- return { tops: F, bottoms: M };
2331
- }, [e, le, w, q]), { tops: te, bottoms: ie } = H, [pe, G] = ke(() => {
2332
- if (q) return [0, 1];
2333
- let F = 0, M = 0;
2334
- for (const y of te)
2335
- for (const x of y)
2336
- x < F && (F = x), x > M && (M = x);
2337
- for (const y of ie)
2338
- for (const x of y)
2339
- x < F && (F = x);
2340
- return [Math.min(0, F), M];
2341
- }, [te, ie, q]);
2342
+ return { tops: X, bottoms: M };
2343
+ }, [e, ce, q, ae]), { tops: F, bottoms: ne } = A, [pe, K] = ke(() => {
2344
+ if (ae) return [0, 1];
2345
+ let X = 0, M = 0;
2346
+ for (const g of F)
2347
+ for (const k of g)
2348
+ k < X && (X = k), k > M && (M = k);
2349
+ for (const g of ne)
2350
+ for (const k of g)
2351
+ k < X && (X = k);
2352
+ return [Math.min(0, X), M];
2353
+ }, [F, ne, ae]);
2342
2354
  return /* @__PURE__ */ s(
2343
2355
  Ve,
2344
2356
  {
2345
- ref: z,
2357
+ ref: H,
2346
2358
  aspectRatio: r,
2347
2359
  height: o,
2348
- className: Q,
2349
- style: P,
2350
- classes: L,
2351
- legend: m ? /* @__PURE__ */ s(vt, { config: n, classes: L }) : void 0,
2352
- overlay: p && oe !== null ? /* @__PURE__ */ s(
2360
+ className: U,
2361
+ style: C,
2362
+ classes: $,
2363
+ legend: f ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
2364
+ overlay: y && R !== null ? /* @__PURE__ */ s(
2353
2365
  et,
2354
2366
  {
2355
- row: e[oe],
2356
- x: zc(e, t, J, oe, z),
2367
+ row: e[R],
2368
+ x: zc(e, t, oe, R, H),
2357
2369
  y: 16,
2358
- containerWidth: z.current?.getBoundingClientRect().width ?? 0,
2370
+ containerWidth: H.current?.getBoundingClientRect().width ?? 0,
2359
2371
  config: n,
2360
- render: I ? () => I(e[oe]) : void 0,
2361
- valueFormat: q ? (F) => `${Math.round(F * 100)}%` : N,
2372
+ render: D ? () => D(e[R]) : void 0,
2373
+ valueFormat: ae ? (X) => `${Math.round(X * 100)}%` : N,
2362
2374
  titleKey: t,
2363
- classes: L
2375
+ classes: $
2364
2376
  }
2365
2377
  ) : null,
2366
- children: ({ width: F, height: M }) => {
2367
- 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;
2368
- return /* @__PURE__ */ O(je, { children: [
2369
- a && /* @__PURE__ */ s("defs", { children: le.map((g) => /* @__PURE__ */ O(
2378
+ children: ({ width: X, height: M }) => {
2379
+ const g = oe.left, k = X - oe.right, B = oe.top, _ = M - oe.bottom, J = Math.max(0, k - g), Y = Math.max(0, _ - B), b = e.map((p) => String(p[t])), E = Xe(b, [g, k], 0), V = ae ? [0, 0.25, 0.5, 0.75, 1] : qe(pe, K, L), de = Je([V[0], V[V.length - 1]], [_, B]), he = de(0), ye = V.map((p) => ({ value: p, y: de(p) })), Ce = Fc(b).map((p) => ({ label: p, x: E(p) })), Se = ae ? (p) => `${Math.round(p * 100)}%` : v;
2380
+ return /* @__PURE__ */ z(je, { children: [
2381
+ a && /* @__PURE__ */ s("defs", { children: ce.map((p) => /* @__PURE__ */ z(
2370
2382
  "linearGradient",
2371
2383
  {
2372
- id: `${Y}-${g}`,
2384
+ id: `${O}-${p}`,
2373
2385
  x1: "0",
2374
2386
  y1: "0",
2375
2387
  x2: "0",
2376
2388
  y2: "1",
2377
2389
  children: [
2378
- /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[g].color, stopOpacity: 0.6 }),
2379
- /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[g].color, stopOpacity: 0.05 })
2390
+ /* @__PURE__ */ s("stop", { offset: "5%", stopColor: n[p].color, stopOpacity: 0.6 }),
2391
+ /* @__PURE__ */ s("stop", { offset: "95%", stopColor: n[p].color, stopOpacity: 0.05 })
2380
2392
  ]
2381
2393
  },
2382
- g
2394
+ p
2383
2395
  )) }),
2384
2396
  d ? /* @__PURE__ */ s(
2385
2397
  nn,
2386
2398
  {
2387
2399
  ticks: ye,
2388
- x: y,
2389
- plotWidth: K,
2400
+ x: g,
2401
+ plotWidth: J,
2390
2402
  format: Se,
2391
2403
  showGrid: h,
2392
- classes: L
2404
+ classes: $
2393
2405
  }
2394
- ) : h && /* @__PURE__ */ s("g", { className: f($.axis, L?.axis), children: ye.map(({ value: g, y: b }) => /* @__PURE__ */ s(
2406
+ ) : h && /* @__PURE__ */ s("g", { className: m(w.axis, $?.axis), children: ye.map(({ value: p, y: x }) => /* @__PURE__ */ s(
2395
2407
  "line",
2396
2408
  {
2397
- className: f($.gridLine, L?.grid),
2398
- x1: y,
2399
- x2: x,
2400
- y1: b,
2401
- y2: b
2409
+ className: m(w.gridLine, $?.grid),
2410
+ x1: g,
2411
+ x2: k,
2412
+ y1: x,
2413
+ y2: x
2402
2414
  },
2403
- `grid-${g}`
2415
+ `grid-${p}`
2404
2416
  )) }),
2405
- u && /* @__PURE__ */ s(rn, { ticks: Ce, y: j, format: T, classes: L }),
2406
- le.map((g, b) => {
2407
- const ne = n[g], E = e.map((Z, R) => ({
2408
- x: D(v[R]),
2409
- y: de(te[b][R])
2410
- })), 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);
2411
- return /* @__PURE__ */ O("g", { className: f($.series, L?.series), children: [
2417
+ u && /* @__PURE__ */ s(rn, { ticks: Ce, y: _, format: S, classes: $ }),
2418
+ ce.map((p, x) => {
2419
+ const ee = n[p], P = e.map((Q, T) => ({
2420
+ x: E(b[T]),
2421
+ y: de(F[x][T])
2422
+ })), G = a ? `url(#${O}-${p})` : ee.color, I = a ? 1 : 0.18, me = q ? Dt(P, ne[x].map((Q) => de(Q)), c) : Dt(P, he, c);
2423
+ return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
2412
2424
  /* @__PURE__ */ s(
2413
2425
  "path",
2414
2426
  {
2415
- className: $.areaPath,
2427
+ className: w.areaPath,
2416
2428
  d: me,
2417
- fill: V,
2418
- fillOpacity: B
2429
+ fill: G,
2430
+ fillOpacity: I
2419
2431
  }
2420
2432
  ),
2421
- /* @__PURE__ */ s("path", { className: $.linePath, d: St(E, c), stroke: ne.color }),
2422
- !w && E.map((Z, R) => /* @__PURE__ */ s(
2433
+ /* @__PURE__ */ s("path", { className: w.linePath, d: St(P, c), stroke: ee.color }),
2434
+ !q && P.map((Q, T) => /* @__PURE__ */ s(
2423
2435
  "circle",
2424
2436
  {
2425
- className: f($.point, L?.point),
2426
- cx: Z.x,
2427
- cy: Z.y,
2428
- r: oe === R ? 5 : 3,
2429
- fill: ne.color
2437
+ className: m(w.point, $?.point),
2438
+ cx: Q.x,
2439
+ cy: Q.y,
2440
+ r: R === T ? 5 : 3,
2441
+ fill: ee.color
2430
2442
  },
2431
- `${g}-${R}`
2443
+ `${p}-${T}`
2432
2444
  ))
2433
- ] }, g);
2445
+ ] }, p);
2434
2446
  }),
2435
- oe !== null && /* @__PURE__ */ s(
2447
+ R !== null && /* @__PURE__ */ s(
2436
2448
  "line",
2437
2449
  {
2438
- className: $.cursorLine,
2439
- x1: D(v[oe]),
2440
- x2: D(v[oe]),
2441
- y1: A,
2442
- y2: j
2450
+ className: w.cursorLine,
2451
+ x1: E(b[R]),
2452
+ x2: E(b[R]),
2453
+ y1: B,
2454
+ y2: _
2443
2455
  }
2444
2456
  ),
2445
2457
  /* @__PURE__ */ s(
2446
2458
  "rect",
2447
2459
  {
2448
- className: $.interactionLayer,
2449
- x: y,
2450
- y: A,
2451
- width: K,
2452
- height: _,
2453
- onMouseMove: (g) => {
2454
- 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)));
2455
- ee(V);
2460
+ className: w.interactionLayer,
2461
+ x: g,
2462
+ y: B,
2463
+ width: J,
2464
+ height: Y,
2465
+ onMouseMove: (p) => {
2466
+ const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left + g, P = E.step(), G = Math.max(0, Math.min(e.length - 1, Math.round((ee - g - P / 2) / P)));
2467
+ te(G);
2456
2468
  },
2457
- onMouseLeave: () => ee(null)
2469
+ onMouseLeave: () => te(null)
2458
2470
  }
2459
2471
  )
2460
2472
  ] });
@@ -2493,193 +2505,193 @@ function zl({
2493
2505
  barRadius: h = 4,
2494
2506
  showGrid: u = !0,
2495
2507
  showLegend: d = !0,
2496
- showTooltip: m = !0,
2497
- showValues: p = !1,
2498
- valuePosition: S = "outside",
2499
- renderLabel: k,
2500
- colorBy: T = "series",
2508
+ showTooltip: f = !0,
2509
+ showValues: y = !1,
2510
+ valuePosition: L = "outside",
2511
+ renderLabel: v,
2512
+ colorBy: S = "series",
2501
2513
  colors: N = jc,
2502
- negativeColor: I,
2503
- activeIndex: C,
2504
- onBarClick: X,
2505
- yTickCount: Q = 5,
2506
- yFormat: P,
2507
- xFormat: L,
2508
- valueFormat: J,
2509
- renderTooltip: le,
2510
- margin: w,
2511
- emptyMessage: q = "No data",
2512
- className: oe,
2513
- style: ee,
2514
- classes: z
2514
+ negativeColor: D,
2515
+ activeIndex: j,
2516
+ onBarClick: Z,
2517
+ yTickCount: U = 5,
2518
+ yFormat: C,
2519
+ xFormat: $,
2520
+ valueFormat: oe,
2521
+ renderTooltip: ce,
2522
+ margin: q,
2523
+ emptyMessage: ae = "No data",
2524
+ className: R,
2525
+ style: te,
2526
+ classes: H
2515
2527
  }) {
2516
- 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);
2528
+ const O = r === "horizontal", A = { ...O ? _c : Xc, ...q }, F = ke(() => Object.keys(n), [n]), ne = o && F.length > 1, [pe, K] = Le(null), X = re(null);
2517
2529
  if (e.length === 0)
2518
- 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 }) }) });
2519
- const M = e.map((D) => String(D[t])), y = C ?? pe, x = ke(() => {
2520
- if (ie) {
2530
+ return /* @__PURE__ */ s("div", { ref: X, className: m(w.root, H?.root, R), style: te, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: ae }) }) });
2531
+ const M = e.map((E) => String(E[t])), g = j ?? pe, k = ke(() => {
2532
+ if (ne) {
2521
2533
  let he = 0, ye = 0;
2522
2534
  for (const be of e) {
2523
2535
  let Ce = 0, Se = 0;
2524
- for (const g of te) {
2525
- const b = be[g];
2526
- typeof b == "number" && (b >= 0 ? Ce += b : Se += b);
2536
+ for (const p of F) {
2537
+ const x = be[p];
2538
+ typeof x == "number" && (x >= 0 ? Ce += x : Se += x);
2527
2539
  }
2528
2540
  Ce > he && (he = Ce), Se < ye && (ye = Se);
2529
2541
  }
2530
2542
  return [ye, he];
2531
2543
  }
2532
- const D = [];
2544
+ const E = [];
2533
2545
  for (const he of e)
2534
- for (const ye of te) {
2546
+ for (const ye of F) {
2535
2547
  const be = he[ye];
2536
- typeof be == "number" && D.push(be);
2548
+ typeof be == "number" && E.push(be);
2537
2549
  }
2538
- const [U, de] = bt(D);
2539
- return [Math.min(0, U), Math.max(0, de)];
2540
- }, [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(
2550
+ const [V, de] = bt(E);
2551
+ return [Math.min(0, V), Math.max(0, de)];
2552
+ }, [e, F, ne]), B = qe(k[0], k[1], U), _ = B[0], J = B[B.length - 1], Y = (E, V) => S === "index" ? N[V % N.length] : n[E]?.color ?? N[0], b = f && g !== null && e[g] ? /* @__PURE__ */ s(
2541
2553
  et,
2542
2554
  {
2543
- row: e[y],
2544
- x: Vc(e, t, H, y, F, Y, l),
2545
- y: Y ? qc(e, t, H, y, F, l) : 16,
2546
- containerWidth: F.current?.getBoundingClientRect().width ?? 0,
2555
+ row: e[g],
2556
+ x: Vc(e, t, A, g, X, O, l),
2557
+ y: O ? qc(e, t, A, g, X, l) : 16,
2558
+ containerWidth: X.current?.getBoundingClientRect().width ?? 0,
2547
2559
  config: n,
2548
- render: le ? () => le(e[y]) : void 0,
2549
- valueFormat: J,
2560
+ render: ce ? () => ce(e[g]) : void 0,
2561
+ valueFormat: oe,
2550
2562
  titleKey: t,
2551
- resolveColor: (D) => {
2552
- const U = e[y][D], de = _(D, y);
2553
- return typeof U != "number" ? de : I !== void 0 && U < 0 ? I : de;
2563
+ resolveColor: (E) => {
2564
+ const V = e[g][E], de = Y(E, g);
2565
+ return typeof V != "number" ? de : D !== void 0 && V < 0 ? D : de;
2554
2566
  },
2555
- classes: z
2567
+ classes: H
2556
2568
  }
2557
2569
  ) : null;
2558
2570
  return /* @__PURE__ */ s(
2559
2571
  Ve,
2560
2572
  {
2561
- ref: F,
2573
+ ref: X,
2562
2574
  aspectRatio: c,
2563
2575
  height: i,
2564
- className: oe,
2565
- style: ee,
2566
- classes: z,
2567
- legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: z }) : void 0,
2568
- overlay: v,
2569
- children: ({ width: D, height: U }) => {
2570
- 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) => ({
2571
- value: ce,
2572
- pos: V(ce)
2576
+ className: R,
2577
+ style: te,
2578
+ classes: H,
2579
+ legend: d ? /* @__PURE__ */ s(vt, { config: n, classes: H }) : void 0,
2580
+ overlay: b,
2581
+ children: ({ width: E, height: V }) => {
2582
+ const de = A.left, he = E - A.right, ye = A.top, be = V - A.bottom, Ce = Math.max(0, he - de), Se = Math.max(0, be - ye), x = Xe(M, O ? [ye, be] : [de, he], l), ee = x.bandWidth(), G = Je([_, J], O ? [de, he] : [be, ye]), I = G(0), me = ne ? 1 : Math.max(1, F.length), Q = ee / me, T = Q * (1 - a), le = B.map((ie) => ({
2583
+ value: ie,
2584
+ pos: G(ie)
2573
2585
  })), ge = Uc(M);
2574
- return /* @__PURE__ */ O(je, { children: [
2575
- u && /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: se.map(
2576
- ({ value: ce, pos: ue }) => Y ? /* @__PURE__ */ s(
2586
+ return /* @__PURE__ */ z(je, { children: [
2587
+ u && /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(
2588
+ ({ value: ie, pos: ue }) => O ? /* @__PURE__ */ s(
2577
2589
  "line",
2578
2590
  {
2579
- className: f($.gridLine, z?.grid),
2591
+ className: m(w.gridLine, H?.grid),
2580
2592
  x1: ue,
2581
2593
  x2: ue,
2582
2594
  y1: ye,
2583
2595
  y2: be
2584
2596
  },
2585
- `g-${ce}`
2597
+ `g-${ie}`
2586
2598
  ) : /* @__PURE__ */ s(
2587
2599
  "line",
2588
2600
  {
2589
- className: f($.gridLine, z?.grid),
2601
+ className: m(w.gridLine, H?.grid),
2590
2602
  x1: de,
2591
2603
  x2: he,
2592
2604
  y1: ue,
2593
2605
  y2: ue
2594
2606
  },
2595
- `g-${ce}`
2607
+ `g-${ie}`
2596
2608
  )
2597
2609
  ) }),
2598
- /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: se.map(({ value: ce, pos: ue }) => {
2599
- const Ae = P ? P(ce) : String(ce);
2600
- return Y ? /* @__PURE__ */ s(
2610
+ /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: le.map(({ value: ie, pos: ue }) => {
2611
+ const Ae = C ? C(ie) : String(ie);
2612
+ return O ? /* @__PURE__ */ s(
2601
2613
  "text",
2602
2614
  {
2603
- className: f($.axisLabel, z?.axisLabel),
2615
+ className: m(w.axisLabel, H?.axisLabel),
2604
2616
  x: ue,
2605
2617
  y: be + 16,
2606
2618
  textAnchor: "middle",
2607
2619
  children: Ae
2608
2620
  },
2609
- `vt-${ce}`
2621
+ `vt-${ie}`
2610
2622
  ) : /* @__PURE__ */ s(
2611
2623
  "text",
2612
2624
  {
2613
- className: f($.axisLabel, z?.axisLabel),
2625
+ className: m(w.axisLabel, H?.axisLabel),
2614
2626
  x: de - 8,
2615
2627
  y: ue,
2616
2628
  textAnchor: "end",
2617
2629
  dominantBaseline: "middle",
2618
2630
  children: Ae
2619
2631
  },
2620
- `vt-${ce}`
2632
+ `vt-${ie}`
2621
2633
  );
2622
2634
  }) }),
2623
- /* @__PURE__ */ s("g", { className: f($.axis, z?.axis), children: ge.map((ce) => {
2624
- const ue = b(ce), Ae = L ? L(ce) : ce;
2625
- return Y ? /* @__PURE__ */ s(
2635
+ /* @__PURE__ */ s("g", { className: m(w.axis, H?.axis), children: ge.map((ie) => {
2636
+ const ue = x(ie), Ae = $ ? $(ie) : ie;
2637
+ return O ? /* @__PURE__ */ s(
2626
2638
  "text",
2627
2639
  {
2628
- className: f($.axisLabel, z?.axisLabel),
2640
+ className: m(w.axisLabel, H?.axisLabel),
2629
2641
  x: de - 8,
2630
2642
  y: ue,
2631
2643
  textAnchor: "end",
2632
2644
  dominantBaseline: "middle",
2633
2645
  children: Ae
2634
2646
  },
2635
- `c-${ce}`
2647
+ `c-${ie}`
2636
2648
  ) : /* @__PURE__ */ s(
2637
2649
  "text",
2638
2650
  {
2639
- className: f($.axisLabel, z?.axisLabel),
2651
+ className: m(w.axisLabel, H?.axisLabel),
2640
2652
  x: ue,
2641
2653
  y: be + 16,
2642
2654
  textAnchor: "middle",
2643
2655
  children: Ae
2644
2656
  },
2645
- `c-${ce}`
2657
+ `c-${ie}`
2646
2658
  );
2647
2659
  }) }),
2648
- e.map((ce, ue) => {
2649
- const De = b(M[ue]) - ne / 2;
2650
- let xe = 0, ae = 0;
2651
- return /* @__PURE__ */ s("g", { className: f($.series, z?.series), children: te.map((Ie, He) => {
2652
- const Ge = ce[Ie];
2660
+ e.map((ie, ue) => {
2661
+ const De = x(M[ue]) - ee / 2;
2662
+ let xe = 0, se = 0;
2663
+ return /* @__PURE__ */ s("g", { className: m(w.series, H?.series), children: F.map((Ie, He) => {
2664
+ const Ge = ie[Ie];
2653
2665
  if (typeof Ge != "number") return null;
2654
- 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;
2666
+ const Ee = Ge, xt = Y(Ie, ue), kt = D !== void 0 && Ee < 0 ? D : xt, Oe = j !== void 0 ? j === ue : pe === ue, tt = j !== void 0 && !Oe;
2655
2667
  let nt, _e;
2656
- ie ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = ae, _e = ae + Ee, ae = _e) : (nt = 0, _e = Ee);
2657
- const rt = V(nt), ot = V(_e), Bt = ie ? (ne - R) / 2 : He * Z + (Z - R) / 2;
2668
+ ne ? Ee >= 0 ? (nt = xe, _e = xe + Ee, xe = _e) : (nt = se, _e = se + Ee, se = _e) : (nt = 0, _e = Ee);
2669
+ const rt = G(nt), ot = G(_e), Bt = ne ? (ee - T) / 2 : He * Q + (Q - T) / 2;
2658
2670
  let it = 0, ct = 0, lt = 0, st = 0;
2659
- if (Y) {
2660
- const Ze = Math.min(rt, ot), Mt = Math.max(rt, ot);
2661
- it = Ze, lt = Mt - Ze, ct = De + Bt, st = R;
2671
+ if (O) {
2672
+ const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2673
+ it = Ze, lt = wt - Ze, ct = De + Bt, st = T;
2662
2674
  } else {
2663
- const Ze = Math.min(rt, ot), Mt = Math.max(rt, ot);
2664
- it = De + Bt, lt = R, ct = Ze, st = Mt - Ze;
2675
+ const Ze = Math.min(rt, ot), wt = Math.max(rt, ot);
2676
+ it = De + Bt, lt = T, ct = Ze, st = wt - Ze;
2665
2677
  }
2666
- const wt = k ? k({ row: ce, value: Ee, seriesKey: Ie, index: ue }) : p ? J ? J(Ee) : String(Ee) : null, Fe = Yc({
2667
- isHorizontal: Y,
2668
- valuePosition: S,
2678
+ const Mt = v ? v({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : y ? oe ? oe(Ee) : String(Ee) : null, Fe = Yc({
2679
+ isHorizontal: O,
2680
+ valuePosition: L,
2669
2681
  x: it,
2670
2682
  y: ct,
2671
2683
  rectW: lt,
2672
2684
  rectH: st,
2673
2685
  value: Ee
2674
2686
  });
2675
- return /* @__PURE__ */ O("g", { children: [
2687
+ return /* @__PURE__ */ z("g", { children: [
2676
2688
  /* @__PURE__ */ s(
2677
2689
  "rect",
2678
2690
  {
2679
- className: f(
2680
- $.bar,
2681
- Oe && $.activeBar,
2682
- z?.point
2691
+ className: m(
2692
+ w.bar,
2693
+ Oe && w.activeBar,
2694
+ H?.point
2683
2695
  ),
2684
2696
  x: it,
2685
2697
  y: ct,
@@ -2689,16 +2701,16 @@ function zl({
2689
2701
  ry: h,
2690
2702
  fill: kt,
2691
2703
  opacity: tt ? 0.35 : 1,
2692
- onClick: X ? () => X({ row: ce, value: Ee, seriesKey: Ie, index: ue }) : void 0,
2693
- style: X ? { cursor: "pointer" } : void 0
2704
+ onClick: Z ? () => Z({ row: ie, value: Ee, seriesKey: Ie, index: ue }) : void 0,
2705
+ style: Z ? { cursor: "pointer" } : void 0
2694
2706
  }
2695
2707
  ),
2696
- wt != null && /* @__PURE__ */ s(
2708
+ Mt != null && /* @__PURE__ */ s(
2697
2709
  "text",
2698
2710
  {
2699
- className: f(
2700
- $.axisLabel,
2701
- (S === "inside" || S === "inside-start") && $.barLabelInside
2711
+ className: m(
2712
+ w.axisLabel,
2713
+ (L === "inside" || L === "inside-start") && w.barLabelInside
2702
2714
  ),
2703
2715
  x: Fe.x,
2704
2716
  y: Fe.y,
@@ -2706,39 +2718,39 @@ function zl({
2706
2718
  dominantBaseline: Fe.dominantBaseline,
2707
2719
  transform: Fe.rotate ? `rotate(${Fe.rotate} ${Fe.x} ${Fe.y})` : void 0,
2708
2720
  opacity: tt ? 0.5 : 1,
2709
- children: wt
2721
+ children: Mt
2710
2722
  }
2711
2723
  )
2712
2724
  ] }, Ie);
2713
2725
  }) }, `group-${ue}`);
2714
2726
  }),
2715
- j < 0 && K > 0 && /* @__PURE__ */ s(
2727
+ _ < 0 && J > 0 && /* @__PURE__ */ s(
2716
2728
  "line",
2717
2729
  {
2718
- className: f($.gridLine),
2719
- x1: Y ? B : de,
2720
- x2: Y ? B : he,
2721
- y1: Y ? ye : B,
2722
- y2: Y ? be : B,
2730
+ className: m(w.gridLine),
2731
+ x1: O ? I : de,
2732
+ x2: O ? I : he,
2733
+ y1: O ? ye : I,
2734
+ y2: O ? be : I,
2723
2735
  opacity: 0.9
2724
2736
  }
2725
2737
  ),
2726
2738
  /* @__PURE__ */ s(
2727
2739
  "rect",
2728
2740
  {
2729
- className: $.interactionLayer,
2741
+ className: w.interactionLayer,
2730
2742
  x: de,
2731
2743
  y: ye,
2732
2744
  width: Ce,
2733
2745
  height: Se,
2734
- onMouseMove: (ce) => {
2735
- 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
+ onMouseMove: (ie) => {
2747
+ const ue = ie.currentTarget.getBoundingClientRect(), Ae = ie.clientX - ue.left + de, De = ie.clientY - ue.top + ye, xe = x.step(), se = O ? De - ye : Ae - de, Ie = Math.max(
2736
2748
  0,
2737
- Math.min(e.length - 1, Math.round((ae - xe / 2) / xe))
2749
+ Math.min(e.length - 1, Math.round((se - xe / 2) / xe))
2738
2750
  );
2739
- G(Ie);
2751
+ K(Ie);
2740
2752
  },
2741
- onMouseLeave: () => G(null)
2753
+ onMouseLeave: () => K(null)
2742
2754
  }
2743
2755
  )
2744
2756
  ] });
@@ -2838,21 +2850,21 @@ function Zc(e, t, n, r, o, c) {
2838
2850
  `A ${n} ${n} 0 1 1 ${e + n} ${t}`,
2839
2851
  "Z"
2840
2852
  ].join(" ");
2841
- 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);
2853
+ 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);
2842
2854
  if (r > 0) {
2843
- 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);
2855
+ const y = e + r * Math.cos(l), L = t + r * Math.sin(l), v = e + r * Math.cos(i), S = t + r * Math.sin(i);
2844
2856
  return [
2845
2857
  `M ${h} ${u}`,
2846
- `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2847
- `L ${p} ${S}`,
2848
- `A ${r} ${r} 0 ${a} 0 ${k} ${T}`,
2858
+ `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2859
+ `L ${y} ${L}`,
2860
+ `A ${r} ${r} 0 ${a} 0 ${v} ${S}`,
2849
2861
  "Z"
2850
2862
  ].join(" ");
2851
2863
  }
2852
2864
  return [
2853
2865
  `M ${e} ${t}`,
2854
2866
  `L ${h} ${u}`,
2855
- `A ${n} ${n} 0 ${a} 1 ${d} ${m}`,
2867
+ `A ${n} ${n} 0 ${a} 1 ${d} ${f}`,
2856
2868
  "Z"
2857
2869
  ].join(" ");
2858
2870
  }
@@ -2873,96 +2885,96 @@ function jl({
2873
2885
  strokeWidth: h = 2,
2874
2886
  strokeColor: u = "var(--crk-color-bg)",
2875
2887
  padAngle: d = 0,
2876
- showLabels: m = !1,
2877
- valuePosition: p = "outside",
2878
- showLabelLines: S = !0,
2879
- renderLabel: k,
2880
- centerLabel: T,
2888
+ showLabels: f = !1,
2889
+ valuePosition: y = "outside",
2890
+ showLabelLines: L = !0,
2891
+ renderLabel: v,
2892
+ centerLabel: S,
2881
2893
  activeIndex: N,
2882
- onSliceClick: I,
2883
- showLegend: C = !0,
2884
- showTooltip: X = !0,
2885
- valueFormat: Q,
2886
- renderTooltip: P,
2887
- emptyMessage: L = "No data",
2888
- className: J,
2889
- style: le,
2890
- classes: w
2894
+ onSliceClick: D,
2895
+ showLegend: j = !0,
2896
+ showTooltip: Z = !0,
2897
+ valueFormat: U,
2898
+ renderTooltip: C,
2899
+ emptyMessage: $ = "No data",
2900
+ className: oe,
2901
+ style: ce,
2902
+ classes: q
2891
2903
  }) {
2892
- const [q, oe] = Le(null), ee = re(null), z = N ?? q, Y = (G) => {
2904
+ const [ae, R] = Le(null), te = re(null), H = N ?? ae, O = (K) => {
2893
2905
  if (r) {
2894
- const F = e[G]?.[r];
2895
- if (typeof F == "string") return F;
2906
+ const X = e[K]?.[r];
2907
+ if (typeof X == "string") return X;
2896
2908
  }
2897
- return o[G % o.length];
2898
- }, H = ke(() => {
2899
- let G = 0;
2900
- for (const F of e) {
2901
- const M = F[t];
2902
- typeof M == "number" && M > 0 && (G += M);
2909
+ return o[K % o.length];
2910
+ }, A = ke(() => {
2911
+ let K = 0;
2912
+ for (const X of e) {
2913
+ const M = X[t];
2914
+ typeof M == "number" && M > 0 && (K += M);
2903
2915
  }
2904
- return G;
2916
+ return K;
2905
2917
  }, [e, t]);
2906
- if (e.length === 0 || H === 0)
2907
- 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 }) }) });
2908
- const te = ke(() => {
2909
- const G = [];
2910
- let F = 0;
2918
+ if (e.length === 0 || A === 0)
2919
+ return /* @__PURE__ */ s("div", { ref: te, className: m(w.root, q?.root, oe), style: ce, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: i ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: $ }) }) });
2920
+ const F = ke(() => {
2921
+ const K = [];
2922
+ let X = 0;
2911
2923
  for (let M = 0; M < e.length; M++) {
2912
- const y = e[M], x = y[t], A = typeof x == "number" && x > 0 ? x : 0;
2913
- if (A === 0) continue;
2914
- const j = A / H, K = j * 360;
2915
- G.push({ index: M, row: y, value: A, start: F, end: F + K, fraction: j }), F += K;
2924
+ const g = e[M], k = g[t], B = typeof k == "number" && k > 0 ? k : 0;
2925
+ if (B === 0) continue;
2926
+ const _ = B / A, J = _ * 360;
2927
+ K.push({ index: M, row: g, value: B, start: X, end: X + J, fraction: _ }), X += J;
2916
2928
  }
2917
- return G;
2918
- }, [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: [
2929
+ return K;
2930
+ }, [e, t, A]), ne = j ? /* @__PURE__ */ s("div", { className: m(w.legend, q?.legend), role: "list", children: F.map((K) => /* @__PURE__ */ z("div", { className: m(w.legendItem, q?.legendItem), role: "listitem", children: [
2919
2931
  /* @__PURE__ */ s(
2920
2932
  "span",
2921
2933
  {
2922
- className: $.legendSwatch,
2923
- style: { background: Y(G.index) },
2934
+ className: w.legendSwatch,
2935
+ style: { background: O(K.index) },
2924
2936
  "aria-hidden": "true"
2925
2937
  }
2926
2938
  ),
2927
- /* @__PURE__ */ s("span", { className: $.legendLabel, children: String(G.row[n]) })
2928
- ] }, G.index)) }) : void 0, pe = ke(() => {
2929
- const G = {};
2930
- for (const F of te)
2931
- G[F.index.toString()] = {
2932
- label: String(F.row[n]),
2933
- color: Y(F.index)
2939
+ /* @__PURE__ */ s("span", { className: w.legendLabel, children: String(K.row[n]) })
2940
+ ] }, K.index)) }) : void 0, pe = ke(() => {
2941
+ const K = {};
2942
+ for (const X of F)
2943
+ K[X.index.toString()] = {
2944
+ label: String(X.row[n]),
2945
+ color: O(X.index)
2934
2946
  };
2935
- return G;
2936
- }, [te]);
2947
+ return K;
2948
+ }, [F]);
2937
2949
  return /* @__PURE__ */ s(
2938
2950
  Ve,
2939
2951
  {
2940
- ref: ee,
2952
+ ref: te,
2941
2953
  aspectRatio: c,
2942
2954
  height: i,
2943
- className: J,
2944
- style: le,
2945
- classes: w,
2946
- legend: ie,
2947
- overlay: X && z !== null && e[z] ? /* @__PURE__ */ s(
2955
+ className: oe,
2956
+ style: ce,
2957
+ classes: q,
2958
+ legend: ne,
2959
+ overlay: Z && H !== null && e[H] ? /* @__PURE__ */ s(
2948
2960
  et,
2949
2961
  {
2950
- row: { [z.toString()]: e[z][t] },
2951
- x: ee.current ? ee.current.getBoundingClientRect().width / 2 : 0,
2962
+ row: { [H.toString()]: e[H][t] },
2963
+ x: te.current ? te.current.getBoundingClientRect().width / 2 : 0,
2952
2964
  y: 16,
2953
- containerWidth: ee.current?.getBoundingClientRect().width ?? 0,
2954
- config: { [z.toString()]: pe[z.toString()] },
2955
- render: P ? () => P(e[z]) : void 0,
2956
- valueFormat: Q,
2965
+ containerWidth: te.current?.getBoundingClientRect().width ?? 0,
2966
+ config: { [H.toString()]: pe[H.toString()] },
2967
+ render: C ? () => C(e[H]) : void 0,
2968
+ valueFormat: U,
2957
2969
  titleKey: void 0,
2958
- classes: w
2970
+ classes: q
2959
2971
  }
2960
2972
  ) : null,
2961
- children: ({ width: G, height: F }) => {
2962
- 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);
2963
- return /* @__PURE__ */ O(je, { children: [
2964
- /* @__PURE__ */ s("g", { children: te.map((_) => {
2965
- 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;
2973
+ children: ({ width: K, height: X }) => {
2974
+ const M = K / 2, g = X / 2, k = Math.min(K, X) / 2 - 4, B = Et(a, k), _ = Math.min(B - 1, Et(l, k)), J = Math.max(4, B * 0.06);
2975
+ return /* @__PURE__ */ z(je, { children: [
2976
+ /* @__PURE__ */ s("g", { children: F.map((Y) => {
2977
+ const b = d / 2, E = Math.min(Y.end, Y.start + b), V = Math.max(Y.start, Y.end - b), de = O(Y.index), he = H === Y.index, ye = N !== void 0 && !he, be = he && N !== void 0 ? B + J : B, Ce = Zc(M, g, be, _, E, V), Se = D ? () => D({ row: Y.row, value: Y.value, index: Y.index }) : void 0;
2966
2978
  return /* @__PURE__ */ s(
2967
2979
  "path",
2968
2980
  {
@@ -2971,24 +2983,24 @@ function jl({
2971
2983
  stroke: h > 0 ? u : "none",
2972
2984
  strokeWidth: h,
2973
2985
  opacity: ye ? 0.45 : 1,
2974
- onMouseEnter: () => oe(_.index),
2975
- onMouseLeave: () => oe(null),
2986
+ onMouseEnter: () => R(Y.index),
2987
+ onMouseLeave: () => R(null),
2976
2988
  onClick: Se,
2977
2989
  style: Se ? { cursor: "pointer" } : void 0
2978
2990
  },
2979
- _.index
2991
+ Y.index
2980
2992
  );
2981
2993
  }) }),
2982
- (m || k) && te.map((_) => {
2983
- const v = k ? k({ row: _.row, value: _.value, fraction: _.fraction, index: _.index }) : m ? `${String(_.row[n])} ${Q ? Q(_.value) : Math.round(_.fraction * 100) + "%"}` : null;
2984
- if (v == null) return null;
2985
- 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";
2994
+ (f || v) && F.map((Y) => {
2995
+ const b = v ? v({ row: Y.row, value: Y.value, fraction: Y.fraction, index: Y.index }) : f ? `${String(Y.row[n])} ${U ? U(Y.value) : Math.round(Y.fraction * 100) + "%"}` : null;
2996
+ if (b == null) return null;
2997
+ const E = y === "inside", V = Math.max(16, B * 0.12), de = E ? (B + _) / 2 : B + V, he = Pt(M, g, de, Y.start, Y.end), ye = E ? "middle" : he.x < M - 1 ? "end" : he.x > M + 1 ? "start" : "middle";
2986
2998
  let be = null;
2987
- if (!D && S) {
2988
- const Ce = Pt(M, y, A, _.start, _.end), Se = 4, g = ye === "end" ? Se : ye === "start" ? -Se : 0;
2989
- be = { x1: Ce.x, y1: Ce.y, x2: he.x + g, y2: he.y };
2999
+ if (!E && L) {
3000
+ const Ce = Pt(M, g, B, Y.start, Y.end), Se = 4, p = ye === "end" ? Se : ye === "start" ? -Se : 0;
3001
+ be = { x1: Ce.x, y1: Ce.y, x2: he.x + p, y2: he.y };
2990
3002
  }
2991
- return /* @__PURE__ */ O("g", { children: [
3003
+ return /* @__PURE__ */ z("g", { children: [
2992
3004
  be && /* @__PURE__ */ s(
2993
3005
  "line",
2994
3006
  {
@@ -2996,7 +3008,7 @@ function jl({
2996
3008
  y1: be.y1,
2997
3009
  x2: be.x2,
2998
3010
  y2: be.y2,
2999
- stroke: Y(_.index),
3011
+ stroke: O(Y.index),
3000
3012
  strokeWidth: 1,
3001
3013
  opacity: 0.7
3002
3014
  }
@@ -3006,24 +3018,24 @@ function jl({
3006
3018
  {
3007
3019
  x: he.x,
3008
3020
  y: he.y,
3009
- className: f(
3010
- $.axisLabel,
3011
- D && $.barLabelInside
3021
+ className: m(
3022
+ w.axisLabel,
3023
+ E && w.barLabelInside
3012
3024
  ),
3013
3025
  textAnchor: ye,
3014
3026
  dominantBaseline: "middle",
3015
- children: v
3027
+ children: b
3016
3028
  }
3017
3029
  )
3018
- ] }, `label-${_.index}`);
3030
+ ] }, `label-${Y.index}`);
3019
3031
  }),
3020
- T !== void 0 && /* @__PURE__ */ s(
3032
+ S !== void 0 && /* @__PURE__ */ s(
3021
3033
  "foreignObject",
3022
3034
  {
3023
- x: M - j,
3024
- y: y - j,
3025
- width: Math.max(0, j * 2),
3026
- height: Math.max(0, j * 2),
3035
+ x: M - _,
3036
+ y: g - _,
3037
+ width: Math.max(0, _ * 2),
3038
+ height: Math.max(0, _ * 2),
3027
3039
  style: { pointerEvents: "none" },
3028
3040
  children: /* @__PURE__ */ s(
3029
3041
  "div",
@@ -3039,7 +3051,7 @@ function jl({
3039
3051
  color: "var(--crk-color-text)",
3040
3052
  fontFamily: "var(--crk-font-family)"
3041
3053
  },
3042
- children: T
3054
+ children: S
3043
3055
  }
3044
3056
  )
3045
3057
  }
@@ -3072,186 +3084,186 @@ function Xl({
3072
3084
  showRadiusAxis: h = !1,
3073
3085
  levels: u = 5,
3074
3086
  showPoints: d = !0,
3075
- fillOpacity: m = 0.4,
3076
- strokeWidth: p = 2,
3077
- renderAxisLabel: S,
3078
- axisFormat: k,
3079
- valueFormat: T,
3087
+ fillOpacity: f = 0.4,
3088
+ strokeWidth: y = 2,
3089
+ renderAxisLabel: L,
3090
+ axisFormat: v,
3091
+ valueFormat: S,
3080
3092
  renderTooltip: N,
3081
- showLegend: I = !0,
3082
- showTooltip: C = !0,
3083
- emptyMessage: X = "No data",
3084
- className: Q,
3085
- style: P,
3086
- classes: L
3093
+ showLegend: D = !0,
3094
+ showTooltip: j = !0,
3095
+ emptyMessage: Z = "No data",
3096
+ className: U,
3097
+ style: C,
3098
+ classes: $
3087
3099
  }) {
3088
- const [J, le] = Le(null), w = re(null), q = ke(() => Object.keys(n), [n]);
3100
+ const [oe, ce] = Le(null), q = re(null), ae = ke(() => Object.keys(n), [n]);
3089
3101
  if (e.length === 0)
3090
- 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 }) }) });
3091
- const oe = ke(
3092
- () => e.map((H, te) => te / e.length * 360),
3102
+ return /* @__PURE__ */ s("div", { ref: q, className: m(w.root, $?.root, U), style: C, children: /* @__PURE__ */ s("div", { className: w.canvas, style: { height: o ?? 240 }, children: /* @__PURE__ */ s("div", { className: w.empty, children: Z }) }) });
3103
+ const R = ke(
3104
+ () => e.map((A, F) => F / e.length * 360),
3093
3105
  [e]
3094
- ), ee = ke(() => {
3095
- const H = [];
3096
- for (const ie of q)
3106
+ ), te = ke(() => {
3107
+ const A = [];
3108
+ for (const ne of ae)
3097
3109
  for (const pe of e) {
3098
- const G = pe[ie];
3099
- typeof G == "number" && H.push(G);
3110
+ const K = pe[ne];
3111
+ typeof K == "number" && A.push(K);
3100
3112
  }
3101
- const [, te] = bt(H);
3102
- return Math.max(1, te);
3103
- }, [e, q]), z = ke(() => qe(0, ee, u).filter((te) => te > 0), [ee, u]), Y = z[z.length - 1] ?? ee;
3113
+ const [, F] = bt(A);
3114
+ return Math.max(1, F);
3115
+ }, [e, ae]), H = ke(() => qe(0, te, u).filter((F) => F > 0), [te, u]), O = H[H.length - 1] ?? te;
3104
3116
  return /* @__PURE__ */ s(
3105
3117
  Ve,
3106
3118
  {
3107
- ref: w,
3119
+ ref: q,
3108
3120
  aspectRatio: r,
3109
3121
  height: o,
3110
- className: Q,
3111
- style: P,
3112
- classes: L,
3113
- legend: I ? /* @__PURE__ */ s(vt, { config: n, classes: L }) : void 0,
3114
- overlay: C && J !== null ? /* @__PURE__ */ s(
3122
+ className: U,
3123
+ style: C,
3124
+ classes: $,
3125
+ legend: D ? /* @__PURE__ */ s(vt, { config: n, classes: $ }) : void 0,
3126
+ overlay: j && oe !== null ? /* @__PURE__ */ s(
3115
3127
  et,
3116
3128
  {
3117
- row: e[J],
3118
- x: (w.current?.getBoundingClientRect().width ?? 0) / 2,
3129
+ row: e[oe],
3130
+ x: (q.current?.getBoundingClientRect().width ?? 0) / 2,
3119
3131
  y: 16,
3120
- containerWidth: w.current?.getBoundingClientRect().width ?? 0,
3132
+ containerWidth: q.current?.getBoundingClientRect().width ?? 0,
3121
3133
  config: n,
3122
- render: N ? () => N(e[J]) : void 0,
3123
- valueFormat: T,
3134
+ render: N ? () => N(e[oe]) : void 0,
3135
+ valueFormat: S,
3124
3136
  titleKey: t,
3125
- classes: L
3137
+ classes: $
3126
3138
  }
3127
3139
  ) : null,
3128
- children: ({ width: H, height: te }) => {
3129
- 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;
3130
- return /* @__PURE__ */ O(je, { children: [
3131
- i && z.map((y) => {
3132
- const x = M(y);
3140
+ children: ({ width: A, height: F }) => {
3141
+ const ne = a ? 32 : 8, pe = A / 2, K = F / 2, X = Math.max(0, Math.min(A, F) / 2 - ne), M = (g) => Math.max(0, g) / O * X;
3142
+ return /* @__PURE__ */ z(je, { children: [
3143
+ i && H.map((g) => {
3144
+ const k = M(g);
3133
3145
  return c === "circle" ? /* @__PURE__ */ s(
3134
3146
  "circle",
3135
3147
  {
3136
- className: f($.gridLine, L?.grid),
3148
+ className: m(w.gridLine, $?.grid),
3137
3149
  cx: pe,
3138
- cy: G,
3139
- r: x,
3150
+ cy: K,
3151
+ r: k,
3140
3152
  fill: "none"
3141
3153
  },
3142
- `ring-${y}`
3154
+ `ring-${g}`
3143
3155
  ) : /* @__PURE__ */ s(
3144
3156
  "polygon",
3145
3157
  {
3146
- className: f($.gridLine, L?.grid),
3147
- points: Kc(pe, G, x, oe),
3158
+ className: m(w.gridLine, $?.grid),
3159
+ points: Kc(pe, K, k, R),
3148
3160
  fill: "none"
3149
3161
  },
3150
- `ring-${y}`
3162
+ `ring-${g}`
3151
3163
  );
3152
3164
  }),
3153
- l && oe.map((y, x) => {
3154
- const A = mt(pe, G, F, y);
3165
+ l && R.map((g, k) => {
3166
+ const B = mt(pe, K, X, g);
3155
3167
  return /* @__PURE__ */ s(
3156
3168
  "line",
3157
3169
  {
3158
- className: f($.gridLine, L?.grid),
3170
+ className: m(w.gridLine, $?.grid),
3159
3171
  x1: pe,
3160
- y1: G,
3161
- x2: A.x,
3162
- y2: A.y
3172
+ y1: K,
3173
+ x2: B.x,
3174
+ y2: B.y
3163
3175
  },
3164
- `spoke-${x}`
3176
+ `spoke-${k}`
3165
3177
  );
3166
3178
  }),
3167
- h && z.map((y) => {
3168
- const x = M(y);
3179
+ h && H.map((g) => {
3180
+ const k = M(g);
3169
3181
  return /* @__PURE__ */ s(
3170
3182
  "text",
3171
3183
  {
3172
- className: f($.axisLabel, L?.axisLabel),
3184
+ className: m(w.axisLabel, $?.axisLabel),
3173
3185
  x: pe + 4,
3174
- y: G - x,
3186
+ y: K - k,
3175
3187
  textAnchor: "start",
3176
3188
  dominantBaseline: "middle",
3177
- children: T ? T(y) : y
3189
+ children: S ? S(g) : g
3178
3190
  },
3179
- `raxis-${y}`
3191
+ `raxis-${g}`
3180
3192
  );
3181
3193
  }),
3182
- a && e.map((y, x) => {
3183
- const A = oe[x], j = mt(pe, G, F + 14, A), K = j.x < pe - 1 ? "end" : j.x > pe + 1 ? "start" : "middle";
3184
- if (S)
3185
- return /* @__PURE__ */ s("g", { children: S({
3186
- row: y,
3187
- index: x,
3188
- angle: A,
3189
- x: j.x,
3190
- y: j.y,
3191
- textAnchor: K
3192
- }) }, `label-${x}`);
3193
- const _ = String(y[t]), v = k ? k(_) : _;
3194
+ a && e.map((g, k) => {
3195
+ const B = R[k], _ = mt(pe, K, X + 14, B), J = _.x < pe - 1 ? "end" : _.x > pe + 1 ? "start" : "middle";
3196
+ if (L)
3197
+ return /* @__PURE__ */ s("g", { children: L({
3198
+ row: g,
3199
+ index: k,
3200
+ angle: B,
3201
+ x: _.x,
3202
+ y: _.y,
3203
+ textAnchor: J
3204
+ }) }, `label-${k}`);
3205
+ const Y = String(g[t]), b = v ? v(Y) : Y;
3194
3206
  return /* @__PURE__ */ s(
3195
3207
  "text",
3196
3208
  {
3197
- className: f($.axisLabel, L?.axisLabel),
3198
- x: j.x,
3199
- y: j.y,
3200
- textAnchor: K,
3209
+ className: m(w.axisLabel, $?.axisLabel),
3210
+ x: _.x,
3211
+ y: _.y,
3212
+ textAnchor: J,
3201
3213
  dominantBaseline: "middle",
3202
- children: v
3214
+ children: b
3203
3215
  },
3204
- `label-${x}`
3216
+ `label-${k}`
3205
3217
  );
3206
3218
  }),
3207
- q.map((y) => {
3208
- const x = n[y], A = e.map((K, _) => {
3209
- const v = K[y], U = M(typeof v == "number" ? v : 0);
3210
- return mt(pe, G, U, oe[_]);
3211
- }), j = A.map((K) => `${K.x},${K.y}`).join(" ");
3212
- return /* @__PURE__ */ O("g", { className: f($.series, L?.series), children: [
3219
+ ae.map((g) => {
3220
+ const k = n[g], B = e.map((J, Y) => {
3221
+ const b = J[g], V = M(typeof b == "number" ? b : 0);
3222
+ return mt(pe, K, V, R[Y]);
3223
+ }), _ = B.map((J) => `${J.x},${J.y}`).join(" ");
3224
+ return /* @__PURE__ */ z("g", { className: m(w.series, $?.series), children: [
3213
3225
  /* @__PURE__ */ s(
3214
3226
  "polygon",
3215
3227
  {
3216
- points: j,
3217
- fill: x.color,
3218
- fillOpacity: m,
3219
- stroke: x.color,
3220
- strokeWidth: p,
3228
+ points: _,
3229
+ fill: k.color,
3230
+ fillOpacity: f,
3231
+ stroke: k.color,
3232
+ strokeWidth: y,
3221
3233
  strokeLinejoin: "round",
3222
3234
  strokeLinecap: "round"
3223
3235
  }
3224
3236
  ),
3225
- d && A.map((K, _) => /* @__PURE__ */ s(
3237
+ d && B.map((J, Y) => /* @__PURE__ */ s(
3226
3238
  "circle",
3227
3239
  {
3228
- className: f($.point, L?.point),
3229
- cx: K.x,
3230
- cy: K.y,
3231
- r: J === _ ? 5 : 3.5,
3232
- fill: x.color
3240
+ className: m(w.point, $?.point),
3241
+ cx: J.x,
3242
+ cy: J.y,
3243
+ r: oe === Y ? 5 : 3.5,
3244
+ fill: k.color
3233
3245
  },
3234
- `${y}-${_}`
3246
+ `${g}-${Y}`
3235
3247
  ))
3236
- ] }, y);
3248
+ ] }, g);
3237
3249
  }),
3238
3250
  /* @__PURE__ */ s(
3239
3251
  "rect",
3240
3252
  {
3241
- className: $.interactionLayer,
3253
+ className: w.interactionLayer,
3242
3254
  x: 0,
3243
3255
  y: 0,
3244
- width: H,
3245
- height: te,
3246
- onMouseMove: (y) => {
3247
- const x = y.currentTarget.getBoundingClientRect(), A = y.clientX - x.left - pe, j = y.clientY - x.top - G;
3248
- if (A === 0 && j === 0) return;
3249
- let K = Math.atan2(j, A) * 180 / Math.PI + 90;
3250
- K < 0 && (K += 360), K >= 360 && (K -= 360);
3251
- const _ = 360 / e.length, v = Math.round(K / _) % e.length;
3252
- le(v);
3256
+ width: A,
3257
+ height: F,
3258
+ onMouseMove: (g) => {
3259
+ const k = g.currentTarget.getBoundingClientRect(), B = g.clientX - k.left - pe, _ = g.clientY - k.top - K;
3260
+ if (B === 0 && _ === 0) return;
3261
+ let J = Math.atan2(_, B) * 180 / Math.PI + 90;
3262
+ J < 0 && (J += 360), J >= 360 && (J -= 360);
3263
+ const Y = 360 / e.length, b = Math.round(J / Y) % e.length;
3264
+ ce(b);
3253
3265
  },
3254
- onMouseLeave: () => le(null)
3266
+ onMouseLeave: () => ce(null)
3255
3267
  }
3256
3268
  )
3257
3269
  ] });
@@ -3286,12 +3298,12 @@ function el(e, t, n = 2) {
3286
3298
  if (t <= 0 || r < t) return { middle: o, upper: c, lower: i };
3287
3299
  for (let l = t - 1; l < r; l++) {
3288
3300
  let a = 0;
3289
- for (let m = l - t + 1; m <= l; m++) a += e[m].close;
3301
+ for (let f = l - t + 1; f <= l; f++) a += e[f].close;
3290
3302
  const h = a / t;
3291
3303
  let u = 0;
3292
- for (let m = l - t + 1; m <= l; m++) {
3293
- const p = e[m].close - h;
3294
- u += p * p;
3304
+ for (let f = l - t + 1; f <= l; f++) {
3305
+ const y = e[f].close - h;
3306
+ u += y * y;
3295
3307
  }
3296
3308
  u /= t;
3297
3309
  const d = Math.sqrt(u);
@@ -3389,209 +3401,209 @@ function Vl({
3389
3401
  upColor: h = "var(--crk-color-success)",
3390
3402
  downColor: u = "var(--crk-color-danger)",
3391
3403
  lineColor: d = "var(--crk-chart-1)",
3392
- timezone: m,
3393
- defaultTimezone: p = "local",
3394
- onTimezoneChange: S,
3395
- showConfigPanel: k = !0,
3396
- onCrosshair: T,
3404
+ timezone: f,
3405
+ defaultTimezone: y = "local",
3406
+ onTimezoneChange: L,
3407
+ showConfigPanel: v = !0,
3408
+ onCrosshair: S,
3397
3409
  onVisibleRangeChange: N,
3398
- className: I,
3399
- style: C
3410
+ className: D,
3411
+ style: j
3400
3412
  }) {
3401
- 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(() => {
3402
- }), H = re(T), te = re(N);
3403
- H.current = T, te.current = N;
3404
- const [ie, pe] = Le(null), [G, F] = Le(p), M = m ?? G, y = fe(
3405
- (g) => {
3406
- m === void 0 && F(g), S?.(g);
3413
+ const Z = re(null), U = re(null), C = re([]), $ = re({ from: 0, to: 0 }), oe = re(null), ce = re(null), q = re(!1), ae = re(null), R = re(null), te = re(1), H = re({ width: 0, height: 0 }), O = re(() => {
3414
+ }), A = re(S), F = re(N);
3415
+ A.current = S, F.current = N;
3416
+ const [ne, pe] = Le(null), [K, X] = Le(y), M = f ?? K, g = fe(
3417
+ (p) => {
3418
+ f === void 0 && X(p), L?.(p);
3407
3419
  },
3408
- [m, S]
3409
- ), x = ke(
3420
+ [f, L]
3421
+ ), k = ke(
3410
3422
  () => ({ up: h, down: u, line: d }),
3411
3423
  [h, u, d]
3412
- ), A = c, j = A.some((g) => g.type === "rsi"), K = A.some((g) => g.type === "volume"), _ = fe(() => {
3413
- const g = Q.current;
3414
- if (!g) return;
3415
- const b = g.getContext("2d");
3416
- if (!b) return;
3417
- const { width: ne, height: E } = z.current;
3418
- if (ne === 0 || E === 0) return;
3419
- const V = ee.current;
3420
- b.save(), b.setTransform(1, 0, 0, 1, 0, 0), b.clearRect(0, 0, g.width, g.height), b.scale(V, V);
3421
- const B = pl(X.current, x), me = ln(X.current), Z = P.current;
3422
- if (Z.length === 0) {
3423
- gl(b, ne, E, B), b.restore();
3424
+ ), B = c, _ = B.some((p) => p.type === "rsi"), J = B.some((p) => p.type === "volume"), Y = fe(() => {
3425
+ const p = U.current;
3426
+ if (!p) return;
3427
+ const x = p.getContext("2d");
3428
+ if (!x) return;
3429
+ const { width: ee, height: P } = H.current;
3430
+ if (ee === 0 || P === 0) return;
3431
+ const G = te.current;
3432
+ x.save(), x.setTransform(1, 0, 0, 1, 0, 0), x.clearRect(0, 0, p.width, p.height), x.scale(G, G);
3433
+ const I = pl(Z.current, k), me = ln(Z.current), Q = C.current;
3434
+ if (Q.length === 0) {
3435
+ gl(x, ee, P, I), x.restore();
3424
3436
  return;
3425
3437
  }
3426
- const R = Nt(ne, E, j, K), { from: se, to: ge } = hl(L.current, Z.length);
3427
- L.current = { from: se, to: ge };
3428
- const ce = Z.slice(Math.max(0, Math.floor(se)), Math.min(Z.length, Math.ceil(ge) + 1)), ue = (ae) => {
3429
- const Ie = ge - se + 1, He = R.plotWidth / Ie;
3430
- return R.plotLeft + (ae - se + 0.5) * He;
3431
- }, 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);
3432
- 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();
3433
- for (let ae = 0; ae < A.length; ae++) {
3434
- const Ie = A[ae], He = De[ae];
3435
- He && kl(b, He, Ie, Z, se, ge, ue, xe);
3438
+ const T = Nt(ee, P, _, J), { from: le, to: ge } = hl($.current, Q.length);
3439
+ $.current = { from: le, to: ge };
3440
+ const ie = Q.slice(Math.max(0, Math.floor(le)), Math.min(Q.length, Math.ceil(ge) + 1)), ue = (se) => {
3441
+ const Ie = ge - le + 1, He = T.plotWidth / Ie;
3442
+ return T.plotLeft + (se - le + 0.5) * He;
3443
+ }, Ae = T.plotWidth / (ge - le + 1), De = B.map((se) => ml(se, Q)).filter((se) => se !== null).map((se) => ({ ...se, color: me(se.color) })), xe = cn(T.main, ie, De, le, ge);
3444
+ Lt(x, T.plotLeft, T.plotRight, xe, I), yl(x, T, xe, i, I), x.save(), x.beginPath(), x.rect(T.plotLeft, xe.paneTop, T.plotWidth, xe.paneHeight), x.clip();
3445
+ for (let se = 0; se < B.length; se++) {
3446
+ const Ie = B[se], He = De[se];
3447
+ He && kl(x, He, Ie, Q, le, ge, ue, xe);
3436
3448
  }
3437
- 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) {
3438
- const ae = fl(R.volume, Z, se, ge);
3439
- 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();
3449
+ if (o === "candle" ? vl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : o === "bar" ? bl(x, Q, le, ge, ue, Ae, xe, { up: I.up, down: I.down }) : xl(x, Q, le, ge, ue, xe, I.line, o === "area"), x.restore(), T.volume) {
3450
+ const se = fl(T.volume, Q, le, ge);
3451
+ Lt(x, T.plotLeft, T.plotRight, se, I, !0), Ft(x, T, T.volume, "Volume", I), x.save(), x.beginPath(), x.rect(T.plotLeft, se.paneTop, T.plotWidth, se.paneHeight), x.clip(), Ml(x, Q, le, ge, ue, Ae, se, { up: I.up, down: I.down }), x.restore();
3440
3452
  }
3441
- if (R.rsi) {
3442
- 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 = {
3443
- paneTop: R.rsi.top,
3444
- paneBottom: R.rsi.bottom,
3445
- paneHeight: R.rsi.height,
3453
+ if (T.rsi) {
3454
+ const se = B.find((tt) => tt.type === "rsi"), Ie = se && se.type === "rsi" ? se.period ?? 14 : 14, He = se && se.type === "rsi" ? se.overbought ?? 70 : 70, Ge = se && se.type === "rsi" ? se.oversold ?? 30 : 30, Ee = (se && se.type === "rsi" ? se.color : void 0) ?? "var(--crk-chart-5)", xt = me(Ee), kt = tl(Q, Ie), Oe = {
3455
+ paneTop: T.rsi.top,
3456
+ paneBottom: T.rsi.bottom,
3457
+ paneHeight: T.rsi.height,
3446
3458
  priceMin: 0,
3447
3459
  priceMax: 100,
3448
3460
  ticks: [Ge, 50, He]
3449
3461
  };
3450
- 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);
3462
+ Lt(x, T.plotLeft, T.plotRight, Oe, I, !0), Ft(x, T, T.rsi, `RSI ${Ie}`, I), x.save(), x.beginPath(), x.rect(T.plotLeft, Oe.paneTop, T.plotWidth, Oe.paneHeight), x.clip(), Qe(x, kt, le, ge, ue, Oe, xt), x.restore(), wl(x, T, Oe, He, Ge, I);
3451
3463
  }
3452
- $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();
3453
- }, [o, A, j, K, i, x, n, M]);
3454
- Y.current = _;
3455
- const v = fe(() => {
3456
- if (oe.current === null) {
3464
+ $l(x, T, Q, le, ge, n, I), oe.current && Nl(x, T, oe.current, Q, le, ge, ue, i, xe, M, I), x.restore();
3465
+ }, [o, B, _, J, i, k, n, M]);
3466
+ O.current = Y;
3467
+ const b = fe(() => {
3468
+ if (R.current === null) {
3457
3469
  if (typeof requestAnimationFrame > "u") {
3458
- Y.current();
3470
+ O.current();
3459
3471
  return;
3460
3472
  }
3461
- oe.current = requestAnimationFrame(() => {
3462
- oe.current = null, Y.current();
3473
+ R.current = requestAnimationFrame(() => {
3474
+ R.current = null, O.current();
3463
3475
  });
3464
3476
  }
3465
3477
  }, []);
3466
3478
  jt(() => {
3467
- const g = X.current;
3468
- if (!g) return;
3469
- const b = () => {
3470
- const E = g.getBoundingClientRect(), V = typeof window < "u" && window.devicePixelRatio || 1;
3471
- ee.current = V, z.current = { width: E.width, height: E.height };
3472
- const B = Q.current;
3473
- 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();
3479
+ const p = Z.current;
3480
+ if (!p) return;
3481
+ const x = () => {
3482
+ const P = p.getBoundingClientRect(), G = typeof window < "u" && window.devicePixelRatio || 1;
3483
+ te.current = G, H.current = { width: P.width, height: P.height };
3484
+ const I = U.current;
3485
+ I && (I.width = Math.round(P.width * G), I.height = Math.round(P.height * G), I.style.width = `${P.width}px`, I.style.height = `${P.height}px`), b();
3474
3486
  };
3475
- if (b(), typeof ResizeObserver > "u") return;
3476
- const ne = new ResizeObserver(b);
3477
- return ne.observe(g), () => ne.disconnect();
3478
- }, [v]), Ne(() => {
3479
- let g = !1;
3480
- 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;
3481
- P.current = [], L.current = { from: 0, to: 0 }, v(), e.getBars({ symbol: t, resolution: n, from: B, to: b, countBack: V }).then((Z) => {
3482
- if (g) return;
3483
- const R = [...Z].sort((ge, ce) => ge.time - ce.time);
3484
- P.current = R;
3485
- const se = R.length - 1;
3487
+ if (x(), typeof ResizeObserver > "u") return;
3488
+ const ee = new ResizeObserver(x);
3489
+ return ee.observe(p), () => ee.disconnect();
3490
+ }, [b]), Ne(() => {
3491
+ let p = !1;
3492
+ const x = Math.floor(Date.now() / 1e3), ee = zt(n), P = r !== void 0 ? on(r) : ee * l, G = r !== void 0 ? Math.max(10, Math.ceil(P / ee)) : l, I = x - P;
3493
+ C.current = [], $.current = { from: 0, to: 0 }, b(), e.getBars({ symbol: t, resolution: n, from: I, to: x, countBack: G }).then((Q) => {
3494
+ if (p) return;
3495
+ const T = [...Q].sort((ge, ie) => ge.time - ie.time);
3496
+ C.current = T;
3497
+ const le = T.length - 1;
3486
3498
  if (r !== void 0)
3487
- L.current = { from: 0, to: se };
3499
+ $.current = { from: 0, to: le };
3488
3500
  else {
3489
- const ge = Math.min(R.length, Math.min(200, l));
3490
- L.current = {
3491
- from: Math.max(0, se - ge + 1),
3492
- to: se
3501
+ const ge = Math.min(T.length, Math.min(200, l));
3502
+ $.current = {
3503
+ from: Math.max(0, le - ge + 1),
3504
+ to: le
3493
3505
  };
3494
3506
  }
3495
- te.current?.(L.current, R), v();
3507
+ F.current?.($.current, T), b();
3496
3508
  }).catch(() => {
3497
3509
  });
3498
3510
  const me = e.subscribeBars({
3499
3511
  symbol: t,
3500
3512
  resolution: n,
3501
- onTick: (Z) => {
3502
- if (g) return;
3503
- const R = P.current, se = R[R.length - 1];
3504
- if (se && se.time === Z.time)
3505
- R[R.length - 1] = Z;
3506
- else if (!se || Z.time > se.time) {
3507
- R.push(Z);
3508
- const ge = L.current;
3509
- ge.to >= R.length - 2 && (L.current = { from: ge.from + 1, to: ge.to + 1 });
3513
+ onTick: (Q) => {
3514
+ if (p) return;
3515
+ const T = C.current, le = T[T.length - 1];
3516
+ if (le && le.time === Q.time)
3517
+ T[T.length - 1] = Q;
3518
+ else if (!le || Q.time > le.time) {
3519
+ T.push(Q);
3520
+ const ge = $.current;
3521
+ ge.to >= T.length - 2 && ($.current = { from: ge.from + 1, to: ge.to + 1 });
3510
3522
  }
3511
- v();
3523
+ b();
3512
3524
  }
3513
3525
  });
3514
- return q.current = me, () => {
3515
- g = !0, q.current !== null && (e.unsubscribeBars(q.current), q.current = null);
3526
+ return ae.current = me, () => {
3527
+ p = !0, ae.current !== null && (e.unsubscribeBars(ae.current), ae.current = null);
3516
3528
  };
3517
3529
  }, [e, t, n, r, l]);
3518
- const D = fe((g) => {
3519
- pe(g), H.current?.(g);
3520
- }, []), U = fe((g) => {
3521
- g.currentTarget.setPointerCapture(g.pointerId);
3522
- const b = L.current;
3523
- le.current = { startX: g.clientX, from: b.from, to: b.to };
3530
+ const E = fe((p) => {
3531
+ pe(p), A.current?.(p);
3532
+ }, []), V = fe((p) => {
3533
+ p.currentTarget.setPointerCapture(p.pointerId);
3534
+ const x = $.current;
3535
+ ce.current = { startX: p.clientX, from: x.from, to: x.to };
3524
3536
  }, []), de = fe(
3525
- (g) => {
3526
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left, E = g.clientY - b.top;
3527
- if (J.current = { x: ne, y: E }, le.current) {
3528
- 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;
3529
- let De = Z + Ae, xe = R + Ae;
3530
- const ae = P.current.length;
3531
- 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);
3537
+ (p) => {
3538
+ const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = p.clientY - x.top;
3539
+ if (oe.current = { x: ee, y: P }, ce.current) {
3540
+ const { startX: me, from: Q, to: T } = ce.current, { width: le } = H.current, ge = Math.max(1, le - Ct), ie = T - Q + 1, ue = ge / ie, Ae = -(p.clientX - me) / ue;
3541
+ let De = Q + Ae, xe = T + Ae;
3542
+ const se = C.current.length;
3543
+ De < 0 && (Se(), De = 0, xe = ie - 1), xe > se - 1 && (xe = se - 1, De = xe - ie + 1), $.current = { from: De, to: xe }, F.current?.($.current, C.current);
3532
3544
  }
3533
- const V = Nt(b.width, b.height, j, K), B = L.current;
3534
- if (ne >= V.plotLeft && ne <= V.plotRight) {
3535
- 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);
3536
- D({ barIndex: ge, bar: ce, priceAtCursor: ue });
3545
+ const G = Nt(x.width, x.height, _, J), I = $.current;
3546
+ if (ee >= G.plotLeft && ee <= G.plotRight) {
3547
+ const me = I.to - I.from + 1, Q = G.plotWidth / me, T = Math.round(I.from + (ee - G.plotLeft) / Q - 0.5), le = C.current, ge = Math.max(0, Math.min(le.length - 1, T)), ie = le[ge] ?? null, ue = Ll(P, G, le, I.from, I.to);
3548
+ E({ barIndex: ge, bar: ie, priceAtCursor: ue });
3537
3549
  } else
3538
- D(null);
3539
- v();
3550
+ E(null);
3551
+ b();
3540
3552
  },
3541
- [j, K, v, D]
3542
- ), he = fe((g) => {
3543
- g.currentTarget.releasePointerCapture(g.pointerId), le.current = null;
3553
+ [_, J, b, E]
3554
+ ), he = fe((p) => {
3555
+ p.currentTarget.releasePointerCapture(p.pointerId), ce.current = null;
3544
3556
  }, []), ye = fe(() => {
3545
- J.current = null, le.current = null, D(null), v();
3546
- }, [v, D]), be = fe(
3547
- (g) => {
3548
- g.preventDefault();
3549
- const b = g.currentTarget.getBoundingClientRect(), ne = g.clientX - b.left, E = Nt(b.width, b.height, j, K), V = L.current, B = P.current;
3550
- if (B.length === 0) return;
3551
- const me = V.to - V.from + 1, Z = g.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), R = Math.max(
3552
- E.plotWidth / cl,
3553
- Math.min(B.length, E.plotWidth / il, me * Z)
3554
- ), se = V.from + (ne - E.plotLeft) / (E.plotWidth / me), ge = (se - V.from) / me;
3555
- let ce = se - ge * R, ue = ce + R - 1;
3556
- 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();
3557
+ oe.current = null, ce.current = null, E(null), b();
3558
+ }, [b, E]), be = fe(
3559
+ (p) => {
3560
+ p.preventDefault();
3561
+ const x = p.currentTarget.getBoundingClientRect(), ee = p.clientX - x.left, P = Nt(x.width, x.height, _, J), G = $.current, I = C.current;
3562
+ if (I.length === 0) return;
3563
+ const me = G.to - G.from + 1, Q = p.deltaY > 0 ? 1 + Ot : 1 / (1 + Ot), T = Math.max(
3564
+ P.plotWidth / cl,
3565
+ Math.min(I.length, P.plotWidth / il, me * Q)
3566
+ ), le = G.from + (ee - P.plotLeft) / (P.plotWidth / me), ge = (le - G.from) / me;
3567
+ let ie = le - ge * T, ue = ie + T - 1;
3568
+ ie < 0 && (ie = 0, ue = T - 1), ue > I.length - 1 && (ue = I.length - 1, ie = ue - T + 1), $.current = { from: ie, to: ue }, F.current?.($.current, I), b();
3557
3569
  },
3558
- [j, K, v]
3570
+ [_, J, b]
3559
3571
  ), Ce = fe(
3560
- (g) => {
3561
- const b = L.current, ne = b.to - b.from + 1, E = P.current;
3562
- if (E.length === 0) return;
3563
- let V = 0;
3564
- if (g.key === "ArrowLeft") V = -Math.max(1, Math.floor(ne * 0.1));
3565
- else if (g.key === "ArrowRight") V = Math.max(1, Math.floor(ne * 0.1));
3572
+ (p) => {
3573
+ const x = $.current, ee = x.to - x.from + 1, P = C.current;
3574
+ if (P.length === 0) return;
3575
+ let G = 0;
3576
+ if (p.key === "ArrowLeft") G = -Math.max(1, Math.floor(ee * 0.1));
3577
+ else if (p.key === "ArrowRight") G = Math.max(1, Math.floor(ee * 0.1));
3566
3578
  else return;
3567
- g.preventDefault();
3568
- let B = b.from + V, me = b.to + V;
3569
- 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();
3579
+ p.preventDefault();
3580
+ let I = x.from + G, me = x.to + G;
3581
+ I < 0 && (I = 0, me = ee - 1), me > P.length - 1 && (me = P.length - 1, I = me - ee + 1), $.current = { from: I, to: me }, F.current?.($.current, P), b();
3570
3582
  },
3571
- [v]
3583
+ [b]
3572
3584
  ), Se = fe(() => {
3573
- if (w.current) return;
3574
- const g = P.current;
3575
- if (g.length === 0) return;
3576
- w.current = !0;
3577
- const b = zt(n), ne = g[0].time, E = ne - b * l, V = ne - b;
3578
- e.getBars({ symbol: t, resolution: n, from: E, to: V, countBack: l }).then((B) => {
3579
- if (B.length === 0) {
3580
- w.current = !1;
3585
+ if (q.current) return;
3586
+ const p = C.current;
3587
+ if (p.length === 0) return;
3588
+ q.current = !0;
3589
+ const x = zt(n), ee = p[0].time, P = ee - x * l, G = ee - x;
3590
+ e.getBars({ symbol: t, resolution: n, from: P, to: G, countBack: l }).then((I) => {
3591
+ if (I.length === 0) {
3592
+ q.current = !1;
3581
3593
  return;
3582
3594
  }
3583
- const Z = [...B].sort((se, ge) => se.time - ge.time).filter((se) => se.time < ne), R = L.current;
3584
- P.current = [...Z, ...g], L.current = { from: R.from + Z.length, to: R.to + Z.length }, w.current = !1, v();
3595
+ const Q = [...I].sort((le, ge) => le.time - ge.time).filter((le) => le.time < ee), T = $.current;
3596
+ C.current = [...Q, ...p], $.current = { from: T.from + Q.length, to: T.to + Q.length }, q.current = !1, b();
3585
3597
  }).catch(() => {
3586
- w.current = !1;
3598
+ q.current = !1;
3587
3599
  });
3588
- }, [e, t, n, l, v]);
3589
- return /* @__PURE__ */ O(
3600
+ }, [e, t, n, l, b]);
3601
+ return /* @__PURE__ */ z(
3590
3602
  "div",
3591
3603
  {
3592
- ref: X,
3593
- className: f($.root, I),
3594
- style: { ...C, height: a, position: "relative" },
3604
+ ref: Z,
3605
+ className: m(w.root, D),
3606
+ style: { ...j, height: a, position: "relative" },
3595
3607
  tabIndex: 0,
3596
3608
  role: "figure",
3597
3609
  "aria-label": `${t} ${n} chart`,
@@ -3600,20 +3612,20 @@ function Vl({
3600
3612
  /* @__PURE__ */ s(
3601
3613
  "canvas",
3602
3614
  {
3603
- ref: Q,
3604
- className: $.svg,
3605
- onPointerDown: U,
3615
+ ref: U,
3616
+ className: w.svg,
3617
+ onPointerDown: V,
3606
3618
  onPointerMove: de,
3607
3619
  onPointerUp: he,
3608
3620
  onPointerLeave: ye,
3609
3621
  onWheel: be,
3610
- style: { cursor: le.current ? "grabbing" : "crosshair", touchAction: "none" }
3622
+ style: { cursor: ce.current ? "grabbing" : "crosshair", touchAction: "none" }
3611
3623
  }
3612
3624
  ),
3613
- /* @__PURE__ */ O(
3625
+ /* @__PURE__ */ z(
3614
3626
  "div",
3615
3627
  {
3616
- className: $.tradingHeader,
3628
+ className: w.tradingHeader,
3617
3629
  style: {
3618
3630
  position: "absolute",
3619
3631
  top: ol,
@@ -3626,22 +3638,22 @@ function Vl({
3626
3638
  gap: 8
3627
3639
  },
3628
3640
  children: [
3629
- /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3641
+ /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: 8, minWidth: 0 }, children: [
3630
3642
  /* @__PURE__ */ s("strong", { children: t }),
3631
3643
  /* @__PURE__ */ s("span", { style: { color: "var(--crk-color-text-muted)" }, children: n }),
3632
- ie?.bar && /* @__PURE__ */ O("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3644
+ ne?.bar && /* @__PURE__ */ z("span", { style: { color: "var(--crk-color-text-muted)", whiteSpace: "nowrap" }, children: [
3633
3645
  "O ",
3634
- ie.bar.open.toFixed(i),
3646
+ ne.bar.open.toFixed(i),
3635
3647
  " · H ",
3636
- ie.bar.high.toFixed(i),
3648
+ ne.bar.high.toFixed(i),
3637
3649
  " · L",
3638
3650
  " ",
3639
- ie.bar.low.toFixed(i),
3651
+ ne.bar.low.toFixed(i),
3640
3652
  " · C ",
3641
- ie.bar.close.toFixed(i)
3653
+ ne.bar.close.toFixed(i)
3642
3654
  ] })
3643
3655
  ] }),
3644
- k && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3656
+ v && /* @__PURE__ */ s("div", { style: { pointerEvents: "auto" }, children: /* @__PURE__ */ s(
3645
3657
  qt,
3646
3658
  {
3647
3659
  position: "bottom",
@@ -3660,7 +3672,7 @@ function Vl({
3660
3672
  dl,
3661
3673
  {
3662
3674
  timezone: M,
3663
- onTimezoneChange: y
3675
+ onTimezoneChange: g
3664
3676
  }
3665
3677
  )
3666
3678
  }
@@ -3686,7 +3698,7 @@ function dl({
3686
3698
  timezone: e,
3687
3699
  onTimezoneChange: t
3688
3700
  }) {
3689
- return /* @__PURE__ */ O("div", { style: { minWidth: 220, padding: 4 }, children: [
3701
+ return /* @__PURE__ */ z("div", { style: { minWidth: 220, padding: 4 }, children: [
3690
3702
  /* @__PURE__ */ s(
3691
3703
  "div",
3692
3704
  {
@@ -3698,7 +3710,7 @@ function dl({
3698
3710
  children: "Settings"
3699
3711
  }
3700
3712
  ),
3701
- /* @__PURE__ */ O("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3713
+ /* @__PURE__ */ z("label", { style: { display: "flex", flexDirection: "column", gap: 4, padding: "4px" }, children: [
3702
3714
  /* @__PURE__ */ s("span", { style: { fontSize: "var(--crk-font-size-xs)", color: "var(--crk-color-text-muted)" }, children: "Timezone" }),
3703
3715
  /* @__PURE__ */ s(
3704
3716
  Vt,
@@ -3712,7 +3724,7 @@ function dl({
3712
3724
  ] });
3713
3725
  }
3714
3726
  function ul() {
3715
- return /* @__PURE__ */ O(
3727
+ return /* @__PURE__ */ z(
3716
3728
  "svg",
3717
3729
  {
3718
3730
  viewBox: "0 0 24 24",
@@ -3732,10 +3744,10 @@ function ul() {
3732
3744
  function Nt(e, t, n, r) {
3733
3745
  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);
3734
3746
  let u = h, d = i;
3735
- const m = { top: i, bottom: l, height: h };
3736
- let p = null, S = null;
3737
- const k = n ? Ht.rsi : 0, T = r ? Ht.volume : 0;
3738
- 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 };
3747
+ const f = { top: i, bottom: l, height: h };
3748
+ let y = null, L = null;
3749
+ const v = n ? Ht.rsi : 0, S = r ? Ht.volume : 0;
3750
+ return u = h * (1 - v - S), f.top = d, f.height = u, f.bottom = f.top + u, d = f.bottom, n && (y = { top: d, height: h * v, bottom: d + h * v }, d = y.bottom), r && (L = { top: d, height: h * S, bottom: d + h * S }), { width: e, height: t, plotLeft: 0, plotRight: c, plotTop: i, plotBottom: l, plotWidth: a, plotHeight: h, main: f, rsi: y, volume: L };
3739
3751
  }
3740
3752
  function hl(e, t) {
3741
3753
  if (t === 0) return { from: 0, to: 0 };
@@ -3769,11 +3781,11 @@ function cn(e, t, n, r, o) {
3769
3781
  for (const d of t)
3770
3782
  d.low < c && (c = d.low), d.high > i && (i = d.high);
3771
3783
  for (const d of n) {
3772
- const m = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3773
- for (const p of m) {
3774
- const S = Math.max(0, Math.floor(r)), k = Math.min(p.length - 1, Math.ceil(o));
3775
- for (let T = S; T <= k; T++) {
3776
- const N = p[T];
3784
+ const f = d.kind === "line" ? [d.values] : [d.upper, d.lower];
3785
+ for (const y of f) {
3786
+ const L = Math.max(0, Math.floor(r)), v = Math.min(y.length - 1, Math.ceil(o));
3787
+ for (let S = L; S <= v; S++) {
3788
+ const N = y[S];
3777
3789
  N != null && (N < c && (c = N), N > i && (i = N));
3778
3790
  }
3779
3791
  }
@@ -3792,7 +3804,7 @@ function fl(e, t, n, r) {
3792
3804
  const l = qe(0, o || 1, 3), a = Math.max(l[l.length - 1], o);
3793
3805
  return { paneTop: e.top, paneBottom: e.bottom, paneHeight: e.height, priceMin: 0, priceMax: a, ticks: l };
3794
3806
  }
3795
- function Me(e, t) {
3807
+ function we(e, t) {
3796
3808
  const n = (e - t.priceMin) / (t.priceMax - t.priceMin || 1);
3797
3809
  return t.paneBottom - n * t.paneHeight;
3798
3810
  }
@@ -3832,7 +3844,7 @@ function gl(e, t, n, r) {
3832
3844
  function Lt(e, t, n, r, o, c = !1) {
3833
3845
  e.strokeStyle = o.grid, e.lineWidth = 1, e.beginPath();
3834
3846
  for (const i of r.ticks) {
3835
- const l = Math.round(Me(i, r)) + 0.5;
3847
+ const l = Math.round(we(i, r)) + 0.5;
3836
3848
  e.moveTo(t, l), e.lineTo(n, l);
3837
3849
  }
3838
3850
  e.stroke();
@@ -3840,35 +3852,35 @@ function Lt(e, t, n, r, o, c = !1) {
3840
3852
  function yl(e, t, n, r, o) {
3841
3853
  e.fillStyle = o.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle";
3842
3854
  for (const c of n.ticks) {
3843
- const i = Me(c, n);
3855
+ const i = we(c, n);
3844
3856
  e.fillText(c.toFixed(r), t.plotRight + 6, i);
3845
3857
  }
3846
3858
  }
3847
3859
  function vl(e, t, n, r, o, c, i, l) {
3848
3860
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3849
3861
  for (let d = a; d <= h; d++) {
3850
- 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;
3851
- e.strokeStyle = C, e.fillStyle = C, e.beginPath();
3852
- const X = Math.round(p) + 0.5;
3853
- e.moveTo(X, T), e.lineTo(X, N), e.stroke();
3854
- const Q = Math.min(S, k), P = Math.max(1, Math.abs(k - S));
3855
- e.fillRect(Math.round(p - u / 2), Math.round(Q), Math.round(u), Math.round(P));
3862
+ const f = t[d], y = o(d), L = we(f.open, i), v = we(f.close, i), S = we(f.high, i), N = we(f.low, i), j = f.close >= f.open ? l.up : l.down;
3863
+ e.strokeStyle = j, e.fillStyle = j, e.beginPath();
3864
+ const Z = Math.round(y) + 0.5;
3865
+ e.moveTo(Z, S), e.lineTo(Z, N), e.stroke();
3866
+ const U = Math.min(L, v), C = Math.max(1, Math.abs(v - L));
3867
+ e.fillRect(Math.round(y - u / 2), Math.round(U), Math.round(u), Math.round(C));
3856
3868
  }
3857
3869
  }
3858
3870
  function bl(e, t, n, r, o, c, i, l) {
3859
3871
  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));
3860
3872
  e.lineWidth = Math.max(1, Math.min(2, c * 0.18)), e.lineCap = "butt";
3861
3873
  for (let d = a; d <= h; d++) {
3862
- 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;
3863
- 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();
3874
+ const f = t[d], y = Math.round(o(d)) + 0.5, L = we(f.high, i), v = we(f.low, i), S = we(f.open, i), N = we(f.close, i), D = f.close >= f.open;
3875
+ e.strokeStyle = D ? l.up : l.down, e.beginPath(), e.moveTo(y, L), e.lineTo(y, v), e.moveTo(y - u, S), e.lineTo(y, S), e.moveTo(y, N), e.lineTo(y + u, N), e.stroke();
3864
3876
  }
3865
3877
  }
3866
3878
  function xl(e, t, n, r, o, c, i, l) {
3867
3879
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r));
3868
3880
  if (!(h <= a)) {
3869
- e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), Me(t[a].close, c));
3881
+ e.strokeStyle = i, e.lineWidth = 1.5, e.beginPath(), e.moveTo(o(a), we(t[a].close, c));
3870
3882
  for (let u = a + 1; u <= h; u++)
3871
- e.lineTo(o(u), Me(t[u].close, c));
3883
+ e.lineTo(o(u), we(t[u].close, c));
3872
3884
  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);
3873
3885
  }
3874
3886
  }
@@ -3881,14 +3893,14 @@ function kl(e, t, n, r, o, c, i, l) {
3881
3893
  e.globalAlpha = t.fillOpacity, e.fillStyle = t.color, e.beginPath();
3882
3894
  let u = !1;
3883
3895
  for (let d = a; d <= h; d++) {
3884
- const m = t.upper[d];
3885
- if (m == null) continue;
3886
- const p = i(d), S = Me(m, l);
3887
- u ? e.lineTo(p, S) : (e.moveTo(p, S), u = !0);
3896
+ const f = t.upper[d];
3897
+ if (f == null) continue;
3898
+ const y = i(d), L = we(f, l);
3899
+ u ? e.lineTo(y, L) : (e.moveTo(y, L), u = !0);
3888
3900
  }
3889
3901
  for (let d = h; d >= a; d--) {
3890
- const m = t.lower[d];
3891
- m != null && e.lineTo(i(d), Me(m, l));
3902
+ const f = t.lower[d];
3903
+ f != null && e.lineTo(i(d), we(f, l));
3892
3904
  }
3893
3905
  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);
3894
3906
  }
@@ -3902,30 +3914,30 @@ function Qe(e, t, n, r, o, c, i) {
3902
3914
  l = !1;
3903
3915
  continue;
3904
3916
  }
3905
- const m = o(u), p = Me(d, c);
3906
- l ? e.lineTo(m, p) : (e.moveTo(m, p), l = !0);
3917
+ const f = o(u), y = we(d, c);
3918
+ l ? e.lineTo(f, y) : (e.moveTo(f, y), l = !0);
3907
3919
  }
3908
3920
  e.stroke();
3909
3921
  }
3910
- function wl(e, t, n, r, o, c, i, l) {
3922
+ function Ml(e, t, n, r, o, c, i, l) {
3911
3923
  const a = Math.max(0, Math.floor(n)), h = Math.min(t.length - 1, Math.ceil(r)), u = Math.max(1, c * 0.7);
3912
3924
  for (let d = a; d <= h; d++) {
3913
- const m = t[d], p = m.volume ?? 0;
3914
- if (p === 0) continue;
3915
- const S = m.close >= m.open;
3916
- e.fillStyle = S ? l.up : l.down, e.globalAlpha = 0.55;
3917
- const k = Me(p, i), T = i.paneBottom - k;
3918
- e.fillRect(Math.round(o(d) - u / 2), Math.round(k), Math.round(u), Math.round(T));
3925
+ const f = t[d], y = f.volume ?? 0;
3926
+ if (y === 0) continue;
3927
+ const L = f.close >= f.open;
3928
+ e.fillStyle = L ? l.up : l.down, e.globalAlpha = 0.55;
3929
+ const v = we(y, i), S = i.paneBottom - v;
3930
+ e.fillRect(Math.round(o(d) - u / 2), Math.round(v), Math.round(u), Math.round(S));
3919
3931
  }
3920
3932
  e.globalAlpha = 1;
3921
3933
  }
3922
- function Ml(e, t, n, r, o, c) {
3934
+ function wl(e, t, n, r, o, c) {
3923
3935
  e.strokeStyle = c.grid, e.setLineDash([3, 3]), e.beginPath();
3924
3936
  for (const i of [r, o]) {
3925
- const l = Math.round(Me(i, n)) + 0.5;
3937
+ const l = Math.round(we(i, n)) + 0.5;
3926
3938
  e.moveTo(t.plotLeft, l), e.lineTo(t.plotRight, l);
3927
3939
  }
3928
- 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));
3940
+ 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));
3929
3941
  }
3930
3942
  function Ft(e, t, n, r, o) {
3931
3943
  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);
@@ -3933,27 +3945,27 @@ function Ft(e, t, n, r, o) {
3933
3945
  function $l(e, t, n, r, o, c, i) {
3934
3946
  const l = o - r + 1, a = t.plotWidth / l, h = Math.max(1, Math.round(80 / a));
3935
3947
  e.fillStyle = i.axis, e.font = "11px system-ui, sans-serif", e.textAlign = "center", e.textBaseline = "middle";
3936
- const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), m = t.plotBottom + At / 2;
3937
- for (let p = u; p <= d; p += h) {
3938
- const S = n[p], k = t.plotLeft + (p - r + 0.5) * a;
3939
- e.fillText(Sl(S.time, c), k, m);
3948
+ const u = Math.max(0, Math.floor(r)), d = Math.min(n.length - 1, Math.ceil(o)), f = t.plotBottom + At / 2;
3949
+ for (let y = u; y <= d; y += h) {
3950
+ const L = n[y], v = t.plotLeft + (y - r + 0.5) * a;
3951
+ e.fillText(Sl(L.time, c), v, f);
3940
3952
  }
3941
3953
  }
3942
3954
  function Nl(e, t, n, r, o, c, i, l, a, h, u) {
3943
3955
  if (n.x < t.plotLeft || n.x > t.plotRight) return;
3944
- 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);
3945
- 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) {
3956
+ const d = c - o + 1, f = t.plotWidth / d, y = o + (n.x - t.plotLeft) / f - 0.5, L = Math.round(y), v = Math.max(0, Math.min(r.length - 1, L)), S = i(v);
3957
+ if (e.save(), e.strokeStyle = u.textMuted, e.setLineDash([3, 3]), e.lineWidth = 1, e.beginPath(), e.moveTo(S + 0.5, t.plotTop), e.lineTo(S + 0.5, t.plotBottom), e.moveTo(t.plotLeft, n.y + 0.5), e.lineTo(t.plotRight, n.y + 0.5), e.stroke(), e.setLineDash([]), n.y >= a.paneTop && n.y <= a.paneBottom) {
3946
3958
  const N = a.priceMax - (n.y - a.paneTop) / a.paneHeight * (a.priceMax - a.priceMin);
3947
3959
  e.fillStyle = u.text, e.fillRect(t.plotRight, n.y - 9, Ct, 18), e.fillStyle = u.bg, e.font = "11px system-ui, sans-serif", e.textAlign = "left", e.textBaseline = "middle", e.fillText(N.toFixed(l), t.plotRight + 6, n.y);
3948
3960
  }
3949
- if (r[k]) {
3950
- const N = sn(r[k].time, h);
3961
+ if (r[v]) {
3962
+ const N = sn(r[v].time, h);
3951
3963
  e.font = "11px system-ui, sans-serif", e.textBaseline = "middle";
3952
- const X = e.measureText(N).width + 8 * 2, Q = At, P = Math.max(
3964
+ const Z = e.measureText(N).width + 8 * 2, U = At, C = Math.max(
3953
3965
  t.plotLeft,
3954
- Math.min(t.plotRight - X, T - X / 2)
3955
- ), L = t.plotBottom;
3956
- 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);
3966
+ Math.min(t.plotRight - Z, S - Z / 2)
3967
+ ), $ = t.plotBottom;
3968
+ e.fillStyle = u.text, e.fillRect(C, $, Z, U), e.fillStyle = u.bg, e.textAlign = "center", e.fillText(N, C + Z / 2, $ + U / 2);
3957
3969
  }
3958
3970
  e.restore();
3959
3971
  }
@@ -4037,16 +4049,16 @@ const Cl = $e(
4037
4049
  className: h,
4038
4050
  style: u
4039
4051
  }, d) => {
4040
- const { line: m, area: p, last: S } = ke(() => {
4052
+ const { line: f, area: y, last: L } = ke(() => {
4041
4053
  if (e.length === 0) return { line: "", area: "", last: null };
4042
- 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` : "";
4043
- return { line: L, area: J, last: P[P.length - 1] };
4054
+ const v = o, S = Math.max(1, t - v * 2), N = Math.max(1, n - v * 2), [D, j] = bt(e), Z = Je([0, Math.max(1, e.length - 1)], [v, v + S]), U = Je([D, j], [v + N, v]), C = e.map((ce, q) => ({ x: Z(q), y: U(ce) })), $ = Tl(C, c), oe = i ? `${$} L ${C[C.length - 1].x} ${v + N} L ${C[0].x} ${v + N} Z` : "";
4055
+ return { line: $, area: oe, last: C[C.length - 1] };
4044
4056
  }, [e, t, n, o, c, i]);
4045
- return /* @__PURE__ */ O(
4057
+ return /* @__PURE__ */ z(
4046
4058
  "svg",
4047
4059
  {
4048
4060
  ref: d,
4049
- className: f($.sparkline, h),
4061
+ className: m(w.sparkline, h),
4050
4062
  style: u,
4051
4063
  width: t,
4052
4064
  height: n,
@@ -4054,11 +4066,11 @@ const Cl = $e(
4054
4066
  role: "img",
4055
4067
  "aria-label": a,
4056
4068
  children: [
4057
- i && p && /* @__PURE__ */ s("path", { d: p, fill: r, opacity: 0.18 }),
4058
- m && /* @__PURE__ */ s(
4069
+ i && y && /* @__PURE__ */ s("path", { d: y, fill: r, opacity: 0.18 }),
4070
+ f && /* @__PURE__ */ s(
4059
4071
  "path",
4060
4072
  {
4061
- d: m,
4073
+ d: f,
4062
4074
  fill: "none",
4063
4075
  stroke: r,
4064
4076
  strokeWidth: o,
@@ -4066,7 +4078,7 @@ const Cl = $e(
4066
4078
  strokeLinecap: "round"
4067
4079
  }
4068
4080
  ),
4069
- l && S && /* @__PURE__ */ s("circle", { cx: S.x, cy: S.y, r: o + 1, fill: r })
4081
+ l && L && /* @__PURE__ */ s("circle", { cx: L.x, cy: L.y, r: o + 1, fill: r })
4070
4082
  ]
4071
4083
  }
4072
4084
  );
@@ -4109,7 +4121,7 @@ export {
4109
4121
  Yl as suggestPeriodForResolution,
4110
4122
  Ul as suggestResolutionForPeriod,
4111
4123
  xo as useClickOutside,
4112
- wo as useFocusTrap,
4124
+ Mo as useFocusTrap,
4113
4125
  Rt as useKeyboard,
4114
4126
  Ur as useTableSort,
4115
4127
  _l as volumeSeries