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