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