shadcn-react
Version:
A simple wrapper for shadcn/ui
1,787 lines • 129 kB
JavaScript
import { A as Sn, a as wn, b as vn, c as Rn, d as _n, e as Fn, f as xn, g as _, h as yn, i as Pn, j as $n, k as In, l as Mn, m as Vn, n as Dn, o as Nn, p as bn, q as Ln, r as En, s as An, t as Gn, B as Hn, D as Tn, u as zn, v as kn, w as ut, x as ct, y as On, z as Bn, C as jn, E as dt, F as gt, G as ft, H as qn, I as Un, J as Wn, K as Xn, L as Kn, M as Jn, N as Qn, O as Yn, P as Zn, Q as er, R as tr, S as nr, T as rr, U as or, V as sr, W as lr, X as ir, Y as pt, Z as ar, _ as ur, $ as cr, a0 as dr, a1 as mt, a2 as gr, a3 as fr, a4 as pr, a5 as mr, a6 as hr, a7 as K, a8 as Ye, a9 as ze, aa as Cr, ab as Sr, ac as wr, ad as ht, ae as Ct, af as St, ag as wt, ah as vr, ai as Rr, aj as _r, ak as Fr, al as xr, am as yr, an as Pr, ao as $r, ap as Ir, aq as Mr, ar as Vr, as as Dr, at as Nr, au as br, av as Lr, aw as Er, ax as Ar, ay as Gr, az as Hr, aA as Tr, aB as zr, aC as kr, aD as Or, aE as de, aF as Br, aG as jr, aH as qr, aI as Ur, aJ as vt, aK as Rt, aL as _t, aM as Ft, aN as Wr, aO as Xr, aP as Kr, aQ as Jr, aR as xt, aS as yt, aT as Pt, aU as $t, aV as Qr, aW as Ie, aX as we, aY as Yr, aZ as Zr, a_ as eo, a$ as to, b0 as no, b1 as ro, b2 as It, b3 as Mt, b4 as Vt, b5 as Me, b6 as ne, b7 as oo, b8 as so, b9 as lo, ba as Dt, bb as io, bc as ao, bd as uo, be as co, bf as go, bg as fo, bh as po, bi as mo, bj as ho, bk as Co, bl as So, bm as wo, bn as Nt, bo as vo, bp as Ro, bq as _o, br as Fo, bs as xo, bt as yo, bu as Po, bv as $o, bw as Io, bx as Mo, by as Vo, bz as Do, bA as Y, bB as Ze, bC as et, bD as No, bE as bo, bF as Lo, bG as Eo, bH as Ao, bI as Go, bJ as Ho, bK as To, bL as zo, bM as ko, bN as Oo, bO as Bo, bP as jo, bQ as qo, bR as Uo, bS as Wo, bT as Xo, bU as bt, bV as Lt, bW as Et, bX as At, bY as Gt, bZ as Ko, b_ as Jo, b$ as Qo, c0 as Yo, c1 as Zo, c2 as tt, c3 as es, c4 as ts, c5 as ve, c6 as ns, c7 as rs, c8 as nt, c9 as rt, ca as Ht, cb as Tt, cc as zt, cd as os, ce as ss } from "./assets/tooltip-9JnInH4H.js";
import { cf as ii, cm as ai, cn as ui, co as ci, cp as di, cq as gi, cs as fi, cg as pi, ch as mi, cr as hi, ck as Ci, cl as Si, ci as wi, cj as vi } from "./assets/tooltip-9JnInH4H.js";
import { jsx as u, jsxs as w, Fragment as re } from "react/jsx-runtime";
import { I as ls, T as is, L as Ve, C as as, A as us, a as cs } from "./assets/triangle-alert-HGztmRWd.js";
import * as De from "react";
import q, { forwardRef as H, useState as z, useRef as j, useCallback as kt, useEffect as ke, Children as ds, createContext as gs, useContext as fs, useMemo as se, createElement as Ne } from "react";
import { X as ps, C as ms, a as hs, b as Cs, c as Ss } from "./assets/x-lidj0hpJ.js";
import "./assets/ResponsiveContainer-Fx4iosBf.js";
import "react-dom";
function ws(e) {
return /* @__PURE__ */ u(
Sn,
{
...e.type === "single" && { collapsible: !0 },
...e
}
);
}
function vs(e) {
const { trigger: r, children: t, ...n } = e;
return /* @__PURE__ */ w(wn, { ...n, children: [
/* @__PURE__ */ u(vn, { children: r }),
/* @__PURE__ */ u(Rn, { children: t })
] });
}
ws.Item = vs;
function Wl(e) {
const {
variant: r = "default",
icon: t = r === "default" ? /* @__PURE__ */ u(ls, {}) : /* @__PURE__ */ u(is, {}),
title: n,
children: o,
...s
} = e;
return /* @__PURE__ */ u(_n, { variant: r, ...s, children: /* @__PURE__ */ w("div", { className: "sr-flex [&>svg]:sr-w-4 [&>svg]:sr-h-4", children: [
t,
/* @__PURE__ */ w("div", { className: "sr-ml-3", children: [
n != null && /* @__PURE__ */ u(Fn, { className: "!sr-leading-4", children: n }),
o != null && /* @__PURE__ */ u(xn, { className: _(n == null && "-sr-mt-0.5"), children: o })
] })
] }) });
}
function Xl(e) {
const {
title: r,
description: t,
okText: n = "Ok",
okProps: o,
cancelText: s = "Cancel",
cancelProps: l,
children: i
} = e;
return /* @__PURE__ */ w(yn, { children: [
/* @__PURE__ */ u(Pn, { asChild: !0, children: i }),
/* @__PURE__ */ w($n, { children: [
/* @__PURE__ */ w(In, { children: [
r != null && /* @__PURE__ */ u(Mn, { children: r }),
t != null && /* @__PURE__ */ u(Vn, { children: t })
] }),
/* @__PURE__ */ w(Dn, { children: [
s != null && /* @__PURE__ */ u(Nn, { ...l, children: s }),
n != null && /* @__PURE__ */ u(bn, { ...o, children: n })
] })
] })
] });
}
function Kl(e) {
return /* @__PURE__ */ u(Ln, { ...e });
}
function Jl(e) {
const { fallback: r, delayMs: t, className: n, style: o, ...s } = e;
return /* @__PURE__ */ w(En, { className: n, style: o, children: [
/* @__PURE__ */ u(An, { ...s }),
r != null && /* @__PURE__ */ u(Gn, { delayMs: t, children: r })
] });
}
const L = q.forwardRef(
(e, r) => {
const { children: t, icon: n, loading: o, disabled: s, size: l, ...i } = e;
return /* @__PURE__ */ w(
Hn,
{
ref: r,
disabled: o || s,
size: l,
...i,
children: [
o && /* @__PURE__ */ u(Ve, { className: "sr-mr-2 sr-h-4 sr-w-4 sr-animate-spin" }),
n && /* @__PURE__ */ u(
"span",
{
className: `${l !== "icon" ? "sr-mr-2" : ""} ${l === "sm" ? "[&>svg]:sr-h-3.5 [&>svg]:sr-w-3.5" : "[&>svg]:sr-h-4 [&>svg]:sr-w-4"}`,
children: n
}
),
t
]
}
);
}
);
L.displayName = "Button";
function E(e) {
const {
children: r,
content: t,
dir: n,
open: o,
defaultOpen: s,
onOpenChange: l,
modal: i,
...a
} = e;
return /* @__PURE__ */ w(
Tn,
{
dir: n,
open: o,
defaultOpen: s,
onOpenChange: l,
modal: i,
children: [
/* @__PURE__ */ u(zn, { asChild: !0, children: r }),
t != null && /* @__PURE__ */ u(kn, { ...a, children: t })
]
}
);
}
const Ot = H((e, r) => {
const { icon: t, shortcut: n, children: o, className: s, ...l } = e;
return /* @__PURE__ */ w(
ut,
{
ref: r,
className: _("sr-cursor-pointer", s),
...l,
children: [
t != null && /* @__PURE__ */ u("span", { className: "sr-mr-2 [&>svg]:sr-w-4 [&>svg]:sr-h-4", children: t }),
o,
n != null && /* @__PURE__ */ u(ct, { children: n })
]
}
);
});
Ot.displayName = ut.displayName;
function Rs(e) {
const { children: r, icon: t, content: n, ...o } = e;
return /* @__PURE__ */ w(Xn, { children: [
/* @__PURE__ */ w(gt, { className: "sr-cursor-pointer", children: [
t != null && /* @__PURE__ */ u("span", { className: "sr-mr-2 [&>svg]:sr-w-4 [&>svg]:sr-h-4", children: t }),
r
] }),
n != null && /* @__PURE__ */ u(dt, { children: /* @__PURE__ */ u(ft, { ...o, children: n }) })
] });
}
E.Label = On;
E.Separator = Bn;
E.Group = jn;
E.Item = Ot;
E.Portal = dt;
E.Shortcut = ct;
E.Sub = Rs;
E.SubTrigger = gt;
E.SubContent = ft;
E.CheckboxItem = qn;
E.RadioGroup = Un;
E.RadioItem = Wn;
function _s(e) {
const { separator: r, maxCount: t, children: n, className: o, style: s } = e, l = q.Children.toArray(n).filter(
(i) => (i == null ? void 0 : i.type) === me
);
if (t && l.length > t) {
let i = [], a = 0;
t === 1 ? (i = l.splice(0, l.length - t), a = 0) : (i = l.splice(1, l.length - t), a = 1), l.splice(
a,
0,
/* @__PURE__ */ u(me, { children: /* @__PURE__ */ u(
E,
{
content: /* @__PURE__ */ u(re, { children: i.map((g, d) => /* @__PURE__ */ u(
E.Item,
{
className: _(
"!sr-p-0 [&>*]:sr-w-full",
(g == null ? void 0 : g.props.variant) === "link" ? "[&_a]:sr-px-2 [&_a]:sr-py-1.5" : "[&>*]:sr-px-2 [&>*]:sr-py-1.5"
),
children: g
},
d
)) }),
children: /* @__PURE__ */ u(L, { variant: "ghost", size: "icon", icon: /* @__PURE__ */ u(Kn, {}) })
}
) })
);
}
return /* @__PURE__ */ u(Jn, { className: o, style: s, children: /* @__PURE__ */ u(Qn, { children: l.map((i, a) => /* @__PURE__ */ w(q.Fragment, { children: [
i,
a !== l.length - 1 && /* @__PURE__ */ u(Yn, { children: r })
] }, a)) }) });
}
const me = q.forwardRef(
(e, r) => {
const { variant: t = "default", children: n, ...o } = e;
return /* @__PURE__ */ w(Zn, { ref: r, ...o, children: [
t === "default" && n,
t === "link" && /* @__PURE__ */ u(er, { asChild: !0, children: /* @__PURE__ */ u("span", { className: "sr-w-full sr-h-full sr-flex sr-items-center [&>a]:sr-w-full [&>a]:sr-h-full [&>a]:sr-flex [&>a]:sr-items-center [&>a]:sr-text-inherit", children: n }) }),
t === "page" && /* @__PURE__ */ u(tr, { children: n })
] });
}
);
me.displayName = "BreadcrumbItem";
_s.Item = me;
function Ql(e) {
const { title: r, description: t, footer: n, children: o, ...s } = e;
return /* @__PURE__ */ w(nr, { ...s, children: [
(r != null || t != null) && /* @__PURE__ */ w(rr, { className: "!sr-pb-0", children: [
r != null && /* @__PURE__ */ u(or, { children: r }),
t != null && /* @__PURE__ */ u(sr, { children: t })
] }),
/* @__PURE__ */ u(lr, { className: "!sr-pt-6", children: o }),
n != null && /* @__PURE__ */ u(ir, { children: n })
] });
}
function oe(e) {
var F, x;
const {
plugins: r,
orientation: t = "horizontal",
setApi: n,
showIndicator: o = !1,
showControls: s = "outside",
onIndexChange: l,
children: i,
className: a,
style: g,
...d
} = e, [f, p] = z(d.startIndex || 0), c = j(l);
c.current = l;
const [m, h] = z(), S = kt(
(P) => {
h(P), n == null || n(P);
},
[h, n]
);
ke(() => {
const P = (M) => {
var $;
const V = M.selectedScrollSnap();
p(V), ($ = c.current) == null || $.call(c, V);
};
return m == null || m.on("select", P), () => {
m == null || m.off("select", P);
};
}, [m]);
const C = s === "inside", y = ((x = (F = ds.map(i, (P) => (P == null ? void 0 : P.type) === pt)) == null ? void 0 : F.filter(Boolean)) == null ? void 0 : x.length) || 0;
return /* @__PURE__ */ w(
ar,
{
className: "sr-group",
plugins: r,
orientation: t,
setApi: S,
opts: d,
children: [
/* @__PURE__ */ u(ur, { className: a, style: g, children: i }),
s && /* @__PURE__ */ w(re, { children: [
/* @__PURE__ */ u(
oe.Previous,
{
className: _(
C && "!sr-bg-background/30 hover:!sr-bg-accent/50 !sr-opacity-0 group-hover:!sr-opacity-100 sr-transition-opacity",
C && (t === "horizontal" ? "!sr-left-2" : "!sr-top-2")
),
variant: C ? "ghost" : "outline"
}
),
/* @__PURE__ */ u(
oe.Next,
{
className: _(
C && "!sr-bg-background/30 hover:!sr-bg-accent/50 sr-opacity-0 group-hover:sr-opacity-100 sr-transition-opacity",
C && (t === "horizontal" ? "!sr-right-2" : "!sr-bottom-2")
),
variant: C ? "ghost" : "outline"
}
)
] }),
o && y > 0 && /* @__PURE__ */ u(
"div",
{
className: _(
"sr-absolute sr-flex",
t === "horizontal" ? "sr-bottom-2 sr-left-1/2 -sr-translate-x-1/2" : "sr-right-2 sr-top-1/2 -sr-translate-y-1/2 sr-flex-col"
),
children: Array.from({ length: y }, (P, M) => /* @__PURE__ */ u(
"div",
{
className: _(
"sr-w-1.5 sr-h-1.5 sr-mr-2 sr-rounded-full sr-bg-background sr-opacity-30",
t === "horizontal" ? "sr-mr-2" : "sr-mb-2",
M === y - 1 && (t === "horizontal" ? "!sr-mr-0" : "!sr-mb-0"),
f === M && "!sr-opacity-100"
)
},
M
))
}
)
]
}
);
}
function Fs(e) {
const { className: r, ...t } = e;
return /* @__PURE__ */ u(
cr,
{
...t,
className: _(r, "!sr-h-8 !sr-w-8 !sr-rounded-full")
}
);
}
function xs(e) {
const { className: r, ...t } = e;
return /* @__PURE__ */ u(
dr,
{
...t,
className: _(r, "!sr-h-8 !sr-w-8 !sr-rounded-full")
}
);
}
oe.Item = pt;
oe.Previous = Fs;
oe.Next = xs;
mt.displayName = "Legend";
const Yl = {
Container: gr,
Style: fr,
Tooltip: pr,
TooltipContent: mr,
Legend: mt,
LegendContent: hr
};
function ee(e, r, t) {
const n = j(!1);
n.current || (n.current = typeof r < "u");
const o = j(t), [s, l] = z(() => e), i = n.current ? r : s, a = j(i);
a.current = i;
const g = kt(
(d) => {
var p;
const f = typeof d == "function" ? d(a.current) : d;
l(f), (p = o.current) == null || p.call(o, f);
},
[]
);
return ke(() => {
n.current && l(r);
}, [r]), [i, g];
}
const Bt = gs(
null
);
let ys = 0;
const jt = H((e, r) => {
const t = fs(Bt), {
id: n,
children: o,
className: s,
style: l,
disabled: i = t == null ? void 0 : t.disabled,
value: a,
checked: g,
onCheckedChange: d,
...f
} = K(e, "checked", "onCheckedChange"), p = se(() => n || `sr-checkbox-${++ys}`, [n]), c = t ? t.value.includes(a) : g, m = (h) => {
if (t) {
const S = new Set(t.value);
h ? S.add(a) : S.delete(a), t.onChange([...S]);
} else
d == null || d(h);
};
return t && a === void 0 ? (console.error("[SR] Checkbox in group must have a value."), null) : o == null ? /* @__PURE__ */ u(
Ye,
{
ref: r,
id: p,
className: _(s, "disabled:sr-opacity-50"),
style: l,
disabled: i,
checked: c,
onCheckedChange: m,
...f
}
) : /* @__PURE__ */ w(
"div",
{
className: _(
s,
"sr-flex sr-items-center",
!t && "group-data-[label-pos=left]:sr-py-2.5"
),
style: l,
children: [
/* @__PURE__ */ u(
Ye,
{
ref: r,
id: p,
className: _(i && "sr-opacity-50"),
disabled: i,
checked: c,
onCheckedChange: m,
...f
}
),
/* @__PURE__ */ u(
ze,
{
htmlFor: p,
className: "sr-pl-2 sr-cursor-pointer peer-disabled:sr-cursor-not-allowed peer-disabled:!sr-opacity-50",
children: o
}
)
]
}
);
});
jt.displayName = "Checkbox";
const be = jt, qt = H(
(e, r) => {
const {
disabled: t,
defaultValue: n = [],
value: o,
layout: s = "horizontal",
onChange: l,
children: i,
className: a,
style: g
} = e, [d, f] = ee(n, o, l);
return /* @__PURE__ */ u(Bt.Provider, { value: { disabled: t, value: d, onChange: f }, children: /* @__PURE__ */ u(
"div",
{
ref: r,
className: _(
a,
"sr-flex group-data-[label-pos=top]:sr-pt-1 group-data-[label-pos=left]:sr-py-2.5",
s === "horizontal" ? "sr-flex-row sr-gap-x-6 sr-gap-y-2.5 sr-items-center sr-flex-wrap" : "sr-flex-col sr-gap-y-4 sr-justify-stretch"
),
style: g,
children: i
}
) });
}
);
qt.displayName = "CheckboxGroup";
be.Group = qt;
const Ut = Cr;
Ut.Trigger = Sr;
Ut.Content = wr;
const Wt = q.forwardRef((e, r) => {
const { empty: t, children: n, ...o } = e;
return /* @__PURE__ */ w(ht, { ref: r, ...o, children: [
t != null && /* @__PURE__ */ u(Ct, { children: t }),
n
] });
});
Wt.displayName = ht.displayName;
const Xt = q.forwardRef((e, r) => {
const { icon: t, shortcut: n, children: o, ...s } = e;
return /* @__PURE__ */ w(St, { ref: r, ...s, children: [
t != null && /* @__PURE__ */ u("span", { className: "sr-mr-2 [&>svg]:sr-w-4 [&>svg]:sr-h-4", children: t }),
o,
n != null && /* @__PURE__ */ u(wt, { children: n })
] });
});
Xt.displayName = St.displayName;
const W = vr;
W.Dialog = Rr;
W.Input = _r;
W.List = Wt;
W.Empty = Ct;
W.Group = Fr;
W.Item = Xt;
W.Separator = xr;
W.Shortcut = wt;
const A = yr;
A.Trigger = Pr;
A.Content = $r;
A.Item = Ir;
A.CheckboxItem = Mr;
A.RadioItem = Vr;
A.Label = Dr;
A.Separator = Nr;
A.Shortcut = br;
A.Group = Lr;
A.Portal = Er;
A.Sub = Ar;
A.SubContent = Gr;
A.SubTrigger = Hr;
A.RadioGroup = Tr;
function Ps(e) {
const {
content: r,
children: t,
open: n,
defaultOpen: o,
onOpenChange: s,
modal: l,
...i
} = e;
return /* @__PURE__ */ w(
zr,
{
open: n,
defaultOpen: o,
onOpenChange: s,
modal: l,
children: [
/* @__PURE__ */ u(kr, { asChild: !0, children: t }),
r != null && /* @__PURE__ */ u(Or, { ...i, children: r })
]
}
);
}
const $s = H((e, r) => {
const {
calendarProps: t,
placeholder: n,
formatStr: o = "yyyy-MM-dd",
format: s,
className: l,
onClear: i,
value: a,
onChange: g,
...d
} = e, f = K(
{
...t,
__sr_form__: e.__sr_form__,
value: a,
onChange: g
},
"selected",
"onSelect"
), { selected: p } = f, c = j(s);
c.current = s;
const m = se(() => {
if (p) {
if (c.current)
return c.current(p);
if (p instanceof Date)
return de(p, o);
if (Array.isArray(p))
return p.map((S) => de(S, o)).join(", ");
if (p.from || p.to)
return (p.from ? de(p.from, o) : "") + " ~ " + (p.to ? de(p.to, o) : "");
}
}, [p, o]), h = (S) => {
S.stopPropagation(), i == null || i();
};
return /* @__PURE__ */ u(
Ps,
{
className: "sr-w-auto !sr-p-0",
align: "start",
content: /* @__PURE__ */ u(Br, { initialFocus: !0, ...f }),
children: /* @__PURE__ */ w(
L,
{
ref: r,
variant: "outline",
className: _(
"sr-w-full !sr-justify-start sr-text-left sr-font-normal sr-group",
!m && "sr-text-muted-foreground",
l
),
icon: /* @__PURE__ */ u(as, { className: "sr-mr-2 sr-shrink-0 sr-h-4 sr-w-4" }),
...d,
children: [
/* @__PURE__ */ u("span", { className: "sr-flex-1 sr-overflow-x-auto sr-scrollbar-none", children: m ?? n }),
i && m != null && /* @__PURE__ */ u(
"span",
{
className: "sr-ml-2 -sr-mr-2.5 sr-shrink-0 sr-h-6 sr-w-6 sr-flex sr-justify-center sr-items-center sr-opacity-0 group-hover:sr-opacity-50 hover:!sr-opacity-100",
onClick: h,
children: /* @__PURE__ */ u(ps, { className: "sr-h-4 sr-w-4" })
}
)
]
}
)
}
);
});
$s.displayName = "DatePicker";
function le(e) {
const {
title: r,
description: t,
content: n,
children: o,
okText: s = "Ok",
okProps: l,
cancelText: i = "Cancel",
cancelProps: a,
footer: g,
className: d,
style: f,
onOk: p,
onCancel: c,
...m
} = e, h = j(null), [S, C] = z(!1), [y, F] = z(!1), x = async (M) => {
var $;
const V = setTimeout(() => {
C(!0);
}, 50);
try {
await (p == null ? void 0 : p(M)), ($ = h.current) == null || $.click();
} finally {
clearTimeout(V), C(!1);
}
}, P = async (M) => {
var $;
const V = setTimeout(() => {
F(!0);
}, 50);
try {
await (c == null ? void 0 : c(M)), ($ = h.current) == null || $.click();
} finally {
clearTimeout(V), F(!1);
}
};
return /* @__PURE__ */ w(jr, { ...m, children: [
/* @__PURE__ */ u(qr, { asChild: !0, children: o }),
/* @__PURE__ */ w(Ur, { className: d, style: f, children: [
/* @__PURE__ */ u(
Oe,
{
ref: h,
asChild: !1,
className: "sr-absolute sr-invisible sr-opacity-0 sr-pointer-events-none"
}
),
(r != null || t != null) && /* @__PURE__ */ w(vt, { children: [
r != null && /* @__PURE__ */ u(Rt, { children: r }),
t != null && /* @__PURE__ */ u(_t, { children: t })
] }),
/* @__PURE__ */ u("div", { children: n }),
g === null ? null : g ?? /* @__PURE__ */ w(Ft, { children: [
/* @__PURE__ */ u(
L,
{
variant: "outline",
loading: y,
onClick: P,
...a,
children: i
}
),
/* @__PURE__ */ u(L, { loading: S, onClick: x, ...l, children: s })
] })
] })
] });
}
const Oe = H(
function(r, t) {
return /* @__PURE__ */ u(Wr, { ref: t, asChild: !0, ...r });
}
);
Oe.displayName = "DialogClose";
le.Close = Oe;
le.Header = vt;
le.Title = Rt;
le.Description = _t;
le.Footer = Ft;
function ie(e) {
const {
title: r,
description: t,
content: n,
children: o,
footer: s,
direction: l = "bottom",
okText: i = "Ok",
okProps: a,
cancelText: g = "Cancel",
cancelProps: d,
onOk: f,
onCancel: p,
className: c,
style: m,
...h
} = e, S = j(null), [C, y] = z(!1), [F, x] = z(!1), P = async (V) => {
var N;
const $ = setTimeout(() => {
y(!0);
}, 50);
try {
await (f == null ? void 0 : f(V)), (N = S.current) == null || N.click();
} finally {
clearTimeout($), y(!1);
}
}, M = async (V) => {
var N;
const $ = setTimeout(() => {
x(!0);
}, 50);
try {
await (p == null ? void 0 : p(V)), (N = S.current) == null || N.click();
} finally {
clearTimeout($), x(!1);
}
};
return /* @__PURE__ */ w(
Xr,
{
handleOnly: l !== "bottom",
direction: l,
...h,
children: [
/* @__PURE__ */ u(Kr, { asChild: !0, children: o }),
/* @__PURE__ */ w(
Jr,
{
className: _(
l === "top" && "sr-inset-x-0 sr-top-0 sr-mb-24 sr-rounded-b-[10px]",
l === "right" && "sr-inset-y-0 sr-right-0 sr-ml-24",
l === "bottom" && "sr-inset-x-0 sr-bottom-0 sr-mt-24 sr-rounded-t-[10px]",
l === "left" && "sr-inset-y-0 sr-left-0 sr-mr-24",
c
),
showHandle: l === "bottom",
style: m,
children: [
/* @__PURE__ */ u(
Be,
{
ref: S,
asChild: !1,
className: "sr-absolute sr-invisible sr-opacity-0 sr-pointer-events-none"
}
),
(r != null || t != null) && /* @__PURE__ */ w(xt, { children: [
r != null && /* @__PURE__ */ u(yt, { children: r }),
t != null && /* @__PURE__ */ u(Pt, { children: t })
] }),
/* @__PURE__ */ u("div", { className: "sr-px-4", children: n }),
s === null ? null : s ?? /* @__PURE__ */ w($t, { className: "sm:sr-flex-row-reverse", children: [
/* @__PURE__ */ u(L, { loading: C, onClick: P, ...a, children: i }),
/* @__PURE__ */ u(
L,
{
variant: "outline",
loading: F,
onClick: M,
...d,
children: g
}
)
] })
]
}
)
]
}
);
}
const Be = H(
function(r, t) {
return /* @__PURE__ */ u(Qr, { ref: t, asChild: !0, ...r });
}
);
Be.displayName = "DrawerClose";
ie.Close = Be;
ie.Header = xt;
ie.Title = yt;
ie.Description = Pt;
ie.Footer = $t;
var ot = function(e, r, t) {
if (e && "reportValidity" in e) {
var n = Ie(t, r);
e.setCustomValidity(n && n.message || ""), e.reportValidity();
}
}, Kt = function(e, r) {
var t = function(o) {
var s = r.fields[o];
s && s.ref && "reportValidity" in s.ref ? ot(s.ref, o, e) : s.refs && s.refs.forEach(function(l) {
return ot(l, o, e);
});
};
for (var n in r.fields)
t(n);
}, Is = function(e, r) {
r.shouldUseNativeValidation && Kt(e, r);
var t = {};
for (var n in e) {
var o = Ie(r.fields, n), s = Object.assign(e[n] || {}, { ref: o && o.ref });
if (Ms(r.names || Object.keys(e), n)) {
var l = Object.assign({}, Ie(t, n));
we(l, "root", s), we(t, n, l);
} else
we(t, n, s);
}
return t;
}, Ms = function(e, r) {
return e.some(function(t) {
return t.startsWith(r + ".");
});
}, Vs = function(e, r) {
for (var t = {}; e.length; ) {
var n = e[0], o = n.code, s = n.message, l = n.path.join(".");
if (!t[l])
if ("unionErrors" in n) {
var i = n.unionErrors[0].errors[0];
t[l] = { message: i.message, type: i.code };
} else
t[l] = { message: s, type: o };
if ("unionErrors" in n && n.unionErrors.forEach(function(d) {
return d.errors.forEach(function(f) {
return e.push(f);
});
}), r) {
var a = t[l].types, g = a && a[n.code];
t[l] = Yr(l, r, t, o, g ? [].concat(g, n.message) : n.message);
}
e.shift();
}
return t;
}, Ds = function(e, r, t) {
return t === void 0 && (t = {}), function(n, o, s) {
try {
return Promise.resolve(function(l, i) {
try {
var a = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](n, r)).then(function(g) {
return s.shouldUseNativeValidation && Kt({}, s), { errors: {}, values: t.raw ? n : g };
});
} catch (g) {
return i(g);
}
return a && a.then ? a.then(void 0, i) : a;
}(0, function(l) {
if (function(i) {
return i.errors != null;
}(l))
return { values: {}, errors: Is(Vs(l.errors, !s.shouldUseNativeValidation && s.criteriaMode === "all"), s) };
throw l;
}));
} catch (l) {
return Promise.reject(l);
}
};
};
function Zl(e) {
return Object.assign(
Zr({
resolver: Ds(e.schema),
...e
}),
{
Field: Qt
}
);
}
const Jt = eo;
function X(e) {
const {
labelPosition: r = "top",
labelClassName: t,
labelStyle: n,
watch: o,
getValues: s,
getFieldState: l,
setError: i,
clearErrors: a,
setValue: g,
trigger: d,
formState: f,
resetField: p,
reset: c,
handleSubmit: m,
unregister: h,
control: S,
register: C,
setFocus: y,
className: F,
// @ts-ignore
Field: x,
...P
} = e;
return /* @__PURE__ */ u(
to,
{
watch: o,
getValues: s,
getFieldState: l,
setError: i,
clearErrors: a,
setValue: g,
trigger: d,
formState: f,
resetField: p,
reset: c,
handleSubmit: m,
unregister: h,
control: S,
register: C,
setFocus: y,
labelPosition: r,
labelClassName: t,
labelStyle: n,
Field: x,
children: /* @__PURE__ */ u(
no,
{
...P,
className: _(F, "sr-group sr-form sr-space-y-6"),
"data-label-pos": r
}
)
}
);
}
function Qt(e) {
const { labelPosition: r, labelClassName: t, labelStyle: n, control: o } = Jt(), { label: s, desc: l, children: i, ...a } = e;
return /* @__PURE__ */ u(
ro,
{
...a,
control: o,
render: (g) => {
if (!i)
return /* @__PURE__ */ u(re, {});
if (typeof i == "function")
return i(g);
const d = /* @__PURE__ */ w("div", { className: "sr-flex-auto sr-space-y-2 sr-relative", children: [
/* @__PURE__ */ u(It, { children: q.cloneElement(i, {
...i.props,
...g.field,
__sr_form__: "1"
}) }),
l != null && /* @__PURE__ */ u(Mt, { children: l }),
/* @__PURE__ */ u(Vt, {})
] });
return r === "left" ? /* @__PURE__ */ w(
Me,
{
"data-label-pos": "left",
className: "sr-flex sr-items-start data-[label-pos=left]:sr-space-y-0 sr-gap-x-4",
children: [
/* @__PURE__ */ u(
ne,
{
className: _(
t,
"sr-min-h-9 sr-shrink-0 sr-flex sr-flex-wrap sr-items-center"
),
style: n,
children: s
}
),
d
]
}
) : /* @__PURE__ */ w(Me, { children: [
s != null && /* @__PURE__ */ u(
ne,
{
className: _(
t,
"sr-min-h-5 sr-shrink-0 sr-flex sr-items-center"
),
style: n,
children: s
}
),
d
] });
}
}
);
}
function Ns(e) {
const { labelPosition: r, labelClassName: t, labelStyle: n } = Jt(), { label: o, children: s } = e;
return r === "left" ? /* @__PURE__ */ w("div", { "data-label-pos": "left", className: "sr-flex sr-gap-x-4", children: [
/* @__PURE__ */ u(
ne,
{
className: _(
t,
"sr-min-h-9 sr-shrink-0 sr-flex sr-flex-wrap sr-items-center"
),
style: n,
children: o
}
),
s
] }) : /* @__PURE__ */ w("div", { className: "sr-space-y-2", children: [
o != null && /* @__PURE__ */ u(
ne,
{
className: _(
t,
"sr-min-h-5 sr-shrink-0 sr-flex sr-items-center"
),
style: n,
children: o
}
),
s
] });
}
X.Field = Qt;
X.Item = Me;
X.Label = ne;
X.Control = It;
X.Description = Mt;
X.Message = Vt;
X.Slot = Ns;
function ei(e) {
const {
content: r,
children: t,
open: n,
defaultOpen: o,
openDelay: s,
closeDelay: l,
onOpenChange: i,
...a
} = e;
return /* @__PURE__ */ w(
oo,
{
open: n,
defaultOpen: o,
openDelay: s,
closeDelay: l,
onOpenChange: i,
children: [
/* @__PURE__ */ u(so, { asChild: !0, children: t }),
/* @__PURE__ */ u(lo, { ...a, children: r })
]
}
);
}
const bs = H((e, r) => /* @__PURE__ */ u(Dt, { ref: r, ...e }));
bs.displayName = Dt.displayName;
const Yt = q.forwardRef(
(e, r) => {
const { length: t, ...n } = e;
return /* @__PURE__ */ u(io, { ref: r, maxLength: t, ...n });
}
);
Yt.displayName = "InputOTP";
function Ls(e) {
const { className: r, ...t } = e;
return /* @__PURE__ */ u(
po,
{
className: _(
r,
"sr-w-4 sr-h-4 sr-flex sr-justify-center sr-items-center [&>svg]:sr-w-2 [&>svg]:sr-h-2"
),
...t
}
);
}
const J = Yt;
J.Group = ao;
J.Slot = uo;
J.Separator = Ls;
J.regexpOnlyDigits = co;
J.regexpOnlyChars = go;
J.regexpOnlyDigitsAndChars = fo;
function Es(e) {
const { value: r, children: t, content: n, ...o } = e;
return /* @__PURE__ */ w(Fo, { value: r, children: [
/* @__PURE__ */ u(xo, { className: "sr-cursor-pointer", children: t }),
n != null && /* @__PURE__ */ u(yo, { ...o, children: n })
] });
}
function As(e) {
const { icon: r, shortcut: t, children: n, className: o, ...s } = e;
return /* @__PURE__ */ w(
Po,
{
className: _("sr-cursor-pointer", o),
...s,
children: [
r != null && /* @__PURE__ */ u("span", { className: "sr-mr-2 [&>svg]:sr-w-4 [&>svg]:sr-h-4", children: r }),
n,
t != null && /* @__PURE__ */ u(Nt, { children: t })
]
}
);
}
function Gs(e) {
const { children: r, open: t, defaultOpen: n, onOpenChange: o, content: s, ...l } = e;
return /* @__PURE__ */ w(
$o,
{
open: t,
defaultOpen: n,
onOpenChange: o,
children: [
/* @__PURE__ */ u(Io, { className: "sr-cursor-pointer", children: r }),
s != null && /* @__PURE__ */ u(Mo, { ...l, children: s })
]
}
);
}
const k = mo;
k.Menu = Es;
k.Item = As;
k.Sub = Gs;
k.Label = ho;
k.Separator = Co;
k.Portal = So;
k.Group = wo;
k.Shortcut = Nt;
k.CheckboxItem = vo;
k.RadioGroup = Ro;
k.RadioItem = _o;
function Hs(e) {
const {
total: r,
page: t,
defaultPage: n = 1,
pageSize: o = 10,
buffer: s = 1,
onChange: l,
...i
} = e, [a, g] = z(n), d = t ?? a, f = r ? Math.ceil(r / o) : 0, p = (m) => {
g(m), l == null || l(m);
}, c = (m) => {
const h = m === d;
return /* @__PURE__ */ u(Y, { children: /* @__PURE__ */ u(
L,
{
variant: h ? "outline" : "ghost",
size: "icon",
"aria-current": h ? "page" : void 0,
onClick: () => p(m),
children: m
}
) }, m);
};
return /* @__PURE__ */ u(Vo, { ...i, children: /* @__PURE__ */ w(Do, { children: [
/* @__PURE__ */ u(Y, { children: /* @__PURE__ */ u(
L,
{
variant: "ghost",
size: "icon",
icon: /* @__PURE__ */ u(ms, {}),
disabled: d <= 1,
"aria-label": "Go to previous page",
onClick: () => p(d - 1)
}
) }),
c(1),
d - s - 1 > 1 && /* @__PURE__ */ u(Y, { children: /* @__PURE__ */ u(Ze, {}) }),
Array.from({ length: s * 2 + 1 }, (m, h) => {
const S = d + h - s;
return S <= 1 || S >= f ? null : c(S);
}),
f > 0 && d + s + 1 < f && /* @__PURE__ */ u(Y, { children: /* @__PURE__ */ u(Ze, {}) }),
f > 0 && c(f),
/* @__PURE__ */ u(Y, { children: /* @__PURE__ */ u(
L,
{
variant: "ghost",
size: "icon",
icon: /* @__PURE__ */ u(hs, {}),
disabled: d >= f,
"aria-label": "Go to next page",
onClick: () => p(d + 1)
}
) })
] }) });
}
let Ts = 0;
function zs(e) {
const { id: r, children: t, className: n, style: o, disabled: s, ...l } = e, i = se(() => r || `sr-radio-${++Ts}`, [r]);
return t == null ? /* @__PURE__ */ u(
et,
{
id: i,
className: n,
style: o,
...l
}
) : /* @__PURE__ */ w("div", { className: _("sr-flex sr-items-center ", n), style: o, children: [
/* @__PURE__ */ u(et, { id: i, disabled: s, ...l }),
/* @__PURE__ */ u(
ze,
{
className: _(
"sr-pl-2 sr-cursor-pointer",
s && "sr-cursor-not-allowed sr-opacity-50"
),
htmlFor: i,
children: t
}
)
] });
}
const Zt = H((e, r) => {
const {
layout: t = "horizontal",
className: n,
...o
} = K(e, "value", "onValueChange");
return /* @__PURE__ */ u(
No,
{
ref: r,
className: _(
n,
"!sr-flex group-data-[label-pos=top]:sr-pt-1 group-data-[label-pos=left]:sr-py-2.5",
t === "horizontal" ? "sr-flex-row !sr-gap-x-6 !sr-gap-y-2.5 sr-items-center sr-flex-wrap" : "sr-flex-col !sr-gap-y-4 sr-justify-stretch"
),
...o
}
);
});
Zt.displayName = "RadioGroup";
zs.Group = Zt;
const en = bo;
en.Panel = Lo;
en.Handle = Eo;
function ti(e) {
const {
children: r,
orientation: t = "vertical",
scrollBarProps: n,
...o
} = e;
return /* @__PURE__ */ w(Ao, { ...o, children: [
r,
/* @__PURE__ */ u(Go, { ...n, orientation: t })
] });
}
const tn = H(
(e, r) => {
const {
placeholder: t,
className: n,
style: o,
children: s,
contentClassName: l,
contentStyle: i,
...a
} = K(e, "value", "onValueChange");
return /* @__PURE__ */ w(Ho, { ...a, children: [
/* @__PURE__ */ u(To, { ref: r, className: n, style: o, children: /* @__PURE__ */ u(zo, { placeholder: t }) }),
/* @__PURE__ */ u(ko, { className: l, style: i, children: s })
] });
}
);
tn.displayName = "Select";
const je = tn;
function ks(e) {
const { label: r, children: t, ...n } = e;
return /* @__PURE__ */ w(Bo, { ...n, children: [
r != null && /* @__PURE__ */ u(jo, { children: r }),
t
] });
}
function Os(e) {
const { className: r, ...t } = e;
return /* @__PURE__ */ u(
qo,
{
className: _(
r,
"!sr-pointer-events-auto sr-cursor-pointer data-[disabled]:sr-cursor-not-allowed"
),
...t
}
);
}
je.Group = ks;
je.Item = Os;
je.Separator = Oo;
function ae(e) {
const {
side: r = "right",
title: t,
description: n,
content: o,
children: s,
footer: l,
okText: i = "Ok",
okProps: a,
cancelText: g = "Cancel",
cancelProps: d,
onOk: f,
onCancel: p,
className: c,
style: m,
...h
} = e, S = j(null), [C, y] = z(!1), [F, x] = z(!1), P = async (V) => {
var N;
const $ = setTimeout(() => {
y(!0);
}, 50);
try {
await (f == null ? void 0 : f(V)), (N = S.current) == null || N.click();
} finally {
clearTimeout($), y(!1);
}
}, M = async (V) => {
var N;
const $ = setTimeout(() => {
x(!0);
}, 50);
try {
await (p == null ? void 0 : p(V)), (N = S.current) == null || N.click();
} finally {
clearTimeout($), x(!1);
}
};
return /* @__PURE__ */ w(Uo, { ...h, children: [
/* @__PURE__ */ u(Wo, { asChild: !0, children: s }),
/* @__PURE__ */ w(Xo, { side: r, className: c, style: m, children: [
/* @__PURE__ */ u(
bt,
{
ref: S,
asChild: !1,
className: "sr-absolute sr-invisible sr-opacity-0 sr-pointer-events-none"
}
),
(t != null || n != null) && /* @__PURE__ */ w(Lt, { children: [
t != null && /* @__PURE__ */ u(Et, { children: t }),
n != null && /* @__PURE__ */ u(At, { children: n })
] }),
/* @__PURE__ */ u("div", { className: "sr-py-4", children: o }),
l === null ? null : l ?? /* @__PURE__ */ w(Gt, { className: "!sr-flex-col sm:!sr-flex-row-reverse sm:!sr-justify-start sr-gap-2", children: [
/* @__PURE__ */ u(L, { loading: C, onClick: P, ...a, children: i }),
/* @__PURE__ */ u(
L,
{
variant: "outline",
loading: F,
onClick: M,
...d,
children: g
}
)
] })
] })
] });
}
ae.Close = bt;
ae.Header = Lt;
ae.Title = Et;
ae.Description = At;
ae.Footer = Gt;
const nn = H(
function(r, t) {
const {
content: n,
children: o,
open: s,
defaultOpen: l,
onOpenChange: i,
delayDuration: a = 400,
disableHoverableContent: g,
...d
} = r;
return /* @__PURE__ */ u(Ko, { children: /* @__PURE__ */ w(
Jo,
{
open: s,
defaultOpen: l,
onOpenChange: i,
delayDuration: a,
disableHoverableContent: g,
children: [
/* @__PURE__ */ u(Qo, { asChild: !0, ref: t, children: o }),
n != null && /* @__PURE__ */ u(Yo, { ...d, children: n })
]
}
) });
}
);
nn.displayName = "Tooltip";
function he(e) {
return !!e.children;
}
function rn(e) {
for (const r of e)
return he(r) ? rn(r.children) : r.value;
}
function Le(e) {
if (he(e)) {
const {
title: p,
children: c,
selected: m,
selectedVariant: h,
collapsed: S,
defaultWrapper: C,
className: y,
onClick: F
} = e;
return S ? /* @__PURE__ */ u(re, { children: c.map((x) => /* @__PURE__ */ Ne(
Le,
{
...x,
key: x.value,
selected: m,
selectedVariant: h,
collapsed: !0,
defaultWrapper: C,
onClick: F
}
)) }) : /* @__PURE__ */ w("div", { className: y, children: [
/* @__PURE__ */ u("h2", { className: "sr-mb-2 sr-px-4 sr-text-lg sr-font-semibold sr-tracking-tight", children: p }),
/* @__PURE__ */ u("div", { className: "sr-space-y-1", children: c.map((x) => /* @__PURE__ */ Ne(
Le,
{
...x,
key: x.value,
selected: m,
selectedVariant: h,
defaultWrapper: C,
onClick: F
}
)) })
] });
}
const {
value: r,
title: t,
icon: n,
badge: o,
selected: s,
selectedVariant: l,
collapsed: i,
defaultWrapper: a,
wrapper: g = a,
className: d,
onClick: f
} = e;
return i ? /* @__PURE__ */ u(
nn,
{
delayDuration: 0,
side: "right",
align: "start",
className: "sr-flex sr-items-center",
content: /* @__PURE__ */ w(re, { children: [
t,
o && /* @__PURE__ */ u("span", { className: "sr-ml-4 sr-text-muted-foreground", children: o })
] }),
children: /* @__PURE__ */ u(g, { className: "sr-block", value: r, children: /* @__PURE__ */ u(
L,
{
className: d,
variant: r === s ? l : "ghost",
size: "icon",
icon: n,
onClick: () => f == null ? void 0 : f(r),
children: /* @__PURE__ */ u("span", { className: "sr-sr-only", children: t })
}
) })
}
) : /* @__PURE__ */ u(g, { className: "sr-block", value: r, children: /* @__PURE__ */ w(
L,
{
className: _(d, "sr-w-full !sr-justify-start"),
variant: r === s ? l : "ghost",
icon: n,
onClick: () => f == null ? void 0 : f(r),
children: [
t,
o && /* @__PURE__ */ u("span", { className: "sr-ml-auto", children: o })
]
},
r
) });
}
function ni(e) {
const {
items: r,
value: t,
defaultValue: n = rn(r),
itemWrapper: o = "div",
width: s = 256,
collapsed: l,
selectedVariant: i = "default",
onChange: a,
className: g,
style: d
} = e, [f, p] = ee(n, t, a);
return /* @__PURE__ */ u(
"aside",
{
"data-collapsed": l,
className: _(
g,
"sr-group sr-py-4 data-[collapsed=true]:sr-py-2"
),
style: { width: l ? void 0 : s, ...d },
children: /* @__PURE__ */ u(
"div",
{
className: _(
"sr-space-y-1",
l ? "sr-px-2 sr-flex sr-flex-col sr-items-center" : "sr-px-3"
),
children: r.map((c, m) => /* @__PURE__ */ Ne(
Le,
{
...c,
key: m,
selected: f,
selectedVariant: i,
collapsed: l,
defaultWrapper: o,
className: _(
m > 0 && !l && (he(c) || he(r[m - 1])) && "!sr-mt-8"
),
onClick: p
}
))
}
)
}
);
}
const Bs = H((e, r) => {
const { className: t, ...n } = K(
e,
"value",
"onValueChange"
);
return /* @__PURE__ */ u(
Zo,
{
ref: r,
className: _(
t,
"group-data-[label-pos=top]:sr-py-2 group-data-[label-pos=left]:sr-py-3.5"
),
...n
}
);
});
Bs.displayName = "Slider";
function js(e) {
const {
loading: r = !1,
delay: t,
size: n = 20,
children: o,
className: s,
style: l
} = e, [i, a] = z(t ? !1 : r);
return ke(() => {
if (t && r) {
const g = setTimeout(() => {
a(!0);
}, t);
return () => clearTimeout(g);
} else
a(r);
}, [r, t]), o == null ? /* @__PURE__ */ u(
Ve,
{
className: _(
s,
"sr-w-5 sr-h-5 sr-text-primary sr-animate-spin"
),
style: {
...l,
width: `${n}px`,
height: `${n}px`
}
}
) : /* @__PURE__ */ w("div", { className: _(s, "sr-relative"), style: l, children: [
/* @__PURE__ */ u("div", { className: _("sr-relative", i && "sr-select-none"), children: o }),
i && /* @__PURE__ */ u("div", { className: "sr-absolute sr-inset-0 sr-z-10 sr-flex sr-flex-col sr-justify-center sr-items-center sr-bg-white/60", children: /* @__PURE__ */ u(
Ve,
{
className: "sr-w-5 sr-h-5 sr-text-primary sr-animate-spin",
style: { width: `${n}px`, height: `${n}px` }
}
) })
] });
}
let qs = 0;
const Us = H((e, r) => {
const { id: t, children: n, className: o, style: s, ...l } = K(
e,
"checked",
"onCheckedChange"
), i = se(() => t || `sr-switch-${++qs}`, [t]);
return n == null ? /* @__PURE__ */ u(
tt,
{
ref: r,
id: i,
className: _(
o,
"group-data-[label-pos=top]:sr-mt-0.5 group-data-[label-pos=left]:sr-py-2"
),
style: s,
...l
}
) : /* @__PURE__ */ w(
"div",
{
className: _(
"sr-flex sr-items-center group-data-[label-pos=top]:sr-pt-0.5 group-data-[label-pos=left]:sr-py-2",
o
),
style: s,
children: [
/* @__PURE__ */ u(tt, { ref: r, id: i, ...l }),
/* @__PURE__ */ u(
ze,
{
htmlFor: i,
className: "sr-pl-2 sr-cursor-pointer peer-disabled:!sr-opacity-50",
children: n
}
)
]
}
);
});
Us.displayName = "Switch";
/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
function B(e, r) {
return typeof e == "function" ? e(r) : e;
}
function G(e, r) {
return (t) => {
r.setState((n) => ({
...n,
[e]: B(t, n[e])
}));
};
}
function Ce(e) {
return e instanceof Function;
}
function Ws(e) {
return Array.isArray(e) && e.every((r) => typeof r == "number");
}
function Xs(e, r) {
const t = [], n = (o) => {
o.forEach((s) => {
t.push(s);
const l = r(s);
l != null && l.length && n(l);
});
};
return n(e), t;
}
function v(e, r, t) {
let n = [], o;
return (s) => {
let l;
t.key && t.debug && (l = Date.now());
const i = e(s);
if (!(i.length !== n.length || i.some((d, f) => n[f] !== d)))
return o;
n = i;
let g;
if (t.key && t.debug && (g = Date.now()), o = r(...i), t == null || t.onChange == null || t.onChange(o), t.key && t.debug && t != null && t.debug()) {
const d = Math.round((Date.now() - l) * 100) / 100, f = Math.round((Date.now() - g) * 100) / 100, p = f / 16, c = (m, h) => {
for (m = String(m); m.length < h; )
m = " " + m;
return m;
};
console.info(`%c⏱ ${c(f, 5)} /${c(d, 5)} ms`, `
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0, Math.min(120 - 120 * p, 120))}deg 100% 31%);`, t == null ? void 0 : t.key);
}
return o;
};
}
function R(e, r, t, n) {
return {
debug: () => {
var o;
return (o = e == null ? void 0 : e.debugAll) != null ? o : e[r];
},
key: process.env.NODE_ENV === "development" && t,
onChange: n
};
}
function Ks(e, r, t, n) {
var o, s;
const i = {
...e._getDefaultColumnDef(),
...r
}, a = i.accessorKey;
let g = (o = (s = i.id) != null ? s : a ? a.replace(".", "_") : void 0) != null ? o : typeof i.header == "string" ? i.header : void 0, d;
if (i.accessorFn ? d = i.accessorFn : a && (a.includes(".") ? d = (p) => {
let c = p;
for (const h of a.split(".")) {
var m;
c = (m = c) == null ? void 0 : m[h], process.env.NODE_ENV !== "production" && c === void 0 && console.warn(`"${h}" in deeply nested key "${a}" returned undefined.`);
}
return c;
} : d = (p) => p[i.accessorKey]), !g)
throw process.env.NODE_ENV !== "production" ? new Error(i.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header") : new Error();
let f = {
id: `${String(g)}`,
accessorFn: d,
parent: n,
depth: t,
columnDef: i,
columns: [],
getFlatColumns: v(() => [!0], () => {
var p;
return [f, ...(p = f.columns) == null ? void 0 : p.flatMap((c) => c.getFlatColumns())];
}, R(e.options, "debugColumns", "column.getFlatColumns")),
getLeafColumns: v(() => [e._getOrderColumnsFn()], (p) => {
var c;
if ((c = f.columns) != null && c.length) {
let m = f.columns.flatMap((h) => h.getLeafColumns());
return p(m);
}
return [f];
}, R(e.options, "debugColumns", "column.getLeafColumns"))
};
for (const p of e._features)
p.createColumn == null || p.createColumn(f, e);
return f;
}
const b = "debugHeaders";
function st(e, r, t) {
var n;
let s = {
id: (n = t.id) != null ? n : r.id,
column: r,
index: t.index,
isPlaceholder: !!t.isPlaceholder,
placeholderId: t.placeholderId,
depth: t.depth,
subHeaders: [],
colSpan: 0,
rowSpan: 0,
headerGroup: null,
getLeafHeaders: () => {
const l = [], i = (a) => {
a.subHeaders && a.subHeaders.length && a.subHeaders.map(i), l.push(a);
};
return i(s), l;
},
getContext: () => ({
table: e,
header: s,
column: r
})
};
return e._features.forEach((l) => {
l.createHeader == null || l.createHeader(s, e);
}), s;
}
const Js = {
createTable: (e) => {
e.getHeaderGroups = v(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (r, t, n, o) => {
var s, l;
const i = (s = n == null ? void 0 : n.map((f) => t.find((p) => p.id === f)).filter(Boolean)) != null ? s : [], a = (l = o == null ? void 0 : o.map((f) => t.find((p) => p.id === f)).filter(Boolean)) != null ? l : [], g = t.filter((f) => !(n != null && n.includes(f.id)) && !(o != null && o.includes(f.id)));
return ge(r, [...i, ...g, ...a], e);
}, R(e.options, b, "getHeaderGroups")), e.getCenterHeaderGroups = v(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (r, t, n, o) => (t = t.filter((s) => !(n != null && n.includes(s.id)) && !(o != null && o.includes(s.id))), ge(r, t, e, "center")), R(e.options, b, "getCenterHeaderGroups")), e.getLeftHeaderGroups = v(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left], (r, t, n) => {
var o;
const s = (o = n == null ? void 0 : n.map((l) => t.fi