UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

1,303 lines 53 kB
import { jsx as v, jsxs as oe, Fragment as Me } from "react/jsx-runtime"; import * as s from "react"; import { createElement as Ce, PureComponent as Mt, useRef as At } from "react"; import * as Ue from "react-dom"; import { c as Le } from "./index-rKs9bXHr.es.js"; import { P as W, c as A, b as Dt } from "./index-BVqmUhu5.es.js"; import { c as Lt } from "./index-CbjDVb-G.es.js"; import { c as zt, u as G } from "./index-DLcqcWxM.es.js"; import { u as kt } from "./index-DBXFJW5M.es.js"; import { D as Vt } from "./index-ClNIHY-1.es.js"; import { P as Wt, h as Bt, u as Ht, R as Ft, F as Ut } from "./index-BKZjW6I1.es.js"; import { u as ze, a as Ae } from "./index-BdfbDt7y.es.js"; import { R as $t, c as $e, A as Kt, C as jt, a as qt } from "./index-Bli6ZByj.es.js"; import { u as Gt } from "./index-DwYXX2sM.es.js"; import { u as Y } from "./index-Dt3MSLsk.es.js"; import { V as Yt } from "./index-Clo5BFLY.es.js"; import { c as Z } from "./utils-CnvKSirc.es.js"; import { C as Zt } from "./check-DFKaRaBZ.es.js"; import { C as Ke } from "./chevron-down-DDxUy1A2.es.js"; import { c as Xt } from "./createLucideIcon-CyFYF6Ug.es.js"; /** * @license lucide-react v0.563.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */ const Jt = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], Qt = Xt("chevron-up", Jt); function eo(t) { const e = s.useRef({ value: t, previous: t }); return s.useMemo(() => (e.current.value !== t && (e.current.previous = e.current.value, e.current.value = t), e.current.previous), [t]); } function Te() { return Te = Object.assign ? Object.assign.bind() : function(t) { for (var e = 1; e < arguments.length; e++) { var o = arguments[e]; for (var n in o) ({}).hasOwnProperty.call(o, n) && (t[n] = o[n]); } return t; }, Te.apply(null, arguments); } function Ne(t, e) { return Ne = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, n) { return o.__proto__ = n, o; }, Ne(t, e); } function ke(t) { if (t === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return t; } // @__NO_SIDE_EFFECTS__ function to(t) { const e = /* @__PURE__ */ oo(t), o = s.forwardRef((n, i) => { const { children: f, ...c } = n, a = s.Children.toArray(f), l = a.find(no); if (l) { const h = l.props.children, g = a.map((w) => w === l ? s.Children.count(h) > 1 ? s.Children.only(null) : s.isValidElement(h) ? h.props.children : null : w); return /* @__PURE__ */ v(e, { ...c, ref: i, children: s.isValidElement(h) ? s.cloneElement(h, void 0, g) : null }); } return /* @__PURE__ */ v(e, { ...c, ref: i, children: f }); }); return o.displayName = `${t}.Slot`, o; } // @__NO_SIDE_EFFECTS__ function oo(t) { const e = s.forwardRef((o, n) => { const { children: i, ...f } = o; if (s.isValidElement(i)) { const c = so(i), a = io(f, i.props); return i.type !== s.Fragment && (a.ref = n ? zt(n, c) : c), s.cloneElement(i, a); } return s.Children.count(i) > 1 ? s.Children.only(null) : null; }); return e.displayName = `${t}.SlotClone`, e; } var ro = Symbol("radix.slottable"); function no(t) { return s.isValidElement(t) && typeof t.type == "function" && "__radixId" in t.type && t.type.__radixId === ro; } function io(t, e) { const o = { ...e }; for (const n in e) { const i = t[n], f = e[n]; /^on[A-Z]/.test(n) ? i && f ? o[n] = (...a) => { const l = f(...a); return i(...a), l; } : i && (o[n] = i) : n === "style" ? o[n] = { ...i, ...f } : n === "className" && (o[n] = [i, f].filter(Boolean).join(" ")); } return { ...t, ...o }; } function so(t) { var n, i; let e = (n = Object.getOwnPropertyDescriptor(t.props, "ref")) == null ? void 0 : n.get, o = e && "isReactWarning" in e && e.isReactWarning; return o ? t.ref : (e = (i = Object.getOwnPropertyDescriptor(t, "ref")) == null ? void 0 : i.get, o = e && "isReactWarning" in e && e.isReactWarning, o ? t.props.ref : t.props.ref || t.ref); } var ao = [" ", "Enter", "ArrowUp", "ArrowDown"], lo = [" ", "Enter"], re = "Select", [ve, ge, co] = Lt(re), [ce] = Dt(re, [ co, $e ]), Se = $e(), [uo, X] = ce(re), [po, fo] = ce(re), je = (t) => { const { __scopeSelect: e, children: o, open: n, defaultOpen: i, onOpenChange: f, value: c, defaultValue: a, onValueChange: l, dir: h, name: g, autoComplete: w, disabled: N, required: b, form: I } = t, r = Se(e), [d, p] = s.useState(null), [u, m] = s.useState(null), [x, S] = s.useState(!1), T = kt(h), [C, O] = ze({ prop: n, defaultProp: i ?? !1, onChange: f, caller: re }), [M, B] = ze({ prop: c, defaultProp: a, onChange: l, caller: re }), L = s.useRef(null), F = d ? I || !!d.closest("form") : !0, [j, U] = s.useState(/* @__PURE__ */ new Set()), $ = Array.from(j).map((D) => D.props.value).join(";"); return /* @__PURE__ */ v($t, { ...r, children: /* @__PURE__ */ oe( uo, { required: b, scope: e, trigger: d, onTriggerChange: p, valueNode: u, onValueNodeChange: m, valueNodeHasChildren: x, onValueNodeHasChildrenChange: S, contentId: Ae(), value: M, onValueChange: B, open: C, onOpenChange: O, dir: T, triggerPointerDownPosRef: L, disabled: N, children: [ /* @__PURE__ */ v(ve.Provider, { scope: e, children: /* @__PURE__ */ v( po, { scope: t.__scopeSelect, onNativeOptionAdd: s.useCallback((D) => { U((z) => new Set(z).add(D)); }, []), onNativeOptionRemove: s.useCallback((D) => { U((z) => { const k = new Set(z); return k.delete(D), k; }); }, []), children: o } ) }), F ? /* @__PURE__ */ oe( gt, { "aria-hidden": !0, required: b, tabIndex: -1, name: g, autoComplete: w, value: M, onChange: (D) => B(D.target.value), disabled: N, form: I, children: [ M === void 0 ? /* @__PURE__ */ v("option", { value: "" }) : null, Array.from(j) ] }, $ ) : null ] } ) }); }; je.displayName = re; var qe = "SelectTrigger", Ge = s.forwardRef( (t, e) => { const { __scopeSelect: o, disabled: n = !1, ...i } = t, f = Se(o), c = X(qe, o), a = c.disabled || n, l = G(e, c.onTriggerChange), h = ge(o), g = s.useRef("touch"), [w, N, b] = yt((r) => { const d = h().filter((m) => !m.disabled), p = d.find((m) => m.value === c.value), u = wt(d, r, p); u !== void 0 && c.onValueChange(u.value); }), I = (r) => { a || (c.onOpenChange(!0), b()), r && (c.triggerPointerDownPosRef.current = { x: Math.round(r.pageX), y: Math.round(r.pageY) }); }; return /* @__PURE__ */ v(Kt, { asChild: !0, ...f, children: /* @__PURE__ */ v( W.button, { type: "button", role: "combobox", "aria-controls": c.contentId, "aria-expanded": c.open, "aria-required": c.required, "aria-autocomplete": "none", dir: c.dir, "data-state": c.open ? "open" : "closed", disabled: a, "data-disabled": a ? "" : void 0, "data-placeholder": St(c.value) ? "" : void 0, ...i, ref: l, onClick: A(i.onClick, (r) => { r.currentTarget.focus(), g.current !== "mouse" && I(r); }), onPointerDown: A(i.onPointerDown, (r) => { g.current = r.pointerType; const d = r.target; d.hasPointerCapture(r.pointerId) && d.releasePointerCapture(r.pointerId), r.button === 0 && r.ctrlKey === !1 && r.pointerType === "mouse" && (I(r), r.preventDefault()); }), onKeyDown: A(i.onKeyDown, (r) => { const d = w.current !== ""; !(r.ctrlKey || r.altKey || r.metaKey) && r.key.length === 1 && N(r.key), !(d && r.key === " ") && ao.includes(r.key) && (I(), r.preventDefault()); }) } ) }); } ); Ge.displayName = qe; var Ye = "SelectValue", Ze = s.forwardRef( (t, e) => { const { __scopeSelect: o, className: n, style: i, children: f, placeholder: c = "", ...a } = t, l = X(Ye, o), { onValueNodeHasChildrenChange: h } = l, g = f !== void 0, w = G(e, l.onValueNodeChange); return Y(() => { h(g); }, [h, g]), /* @__PURE__ */ v( W.span, { ...a, ref: w, style: { pointerEvents: "none" }, children: St(l.value) ? /* @__PURE__ */ v(Me, { children: c }) : f } ); } ); Ze.displayName = Ye; var mo = "SelectIcon", Xe = s.forwardRef( (t, e) => { const { __scopeSelect: o, children: n, ...i } = t; return /* @__PURE__ */ v(W.span, { "aria-hidden": !0, ...i, ref: e, children: n || "▼" }); } ); Xe.displayName = mo; var ho = "SelectPortal", Je = (t) => /* @__PURE__ */ v(Wt, { asChild: !0, ...t }); Je.displayName = ho; var ne = "SelectContent", Qe = s.forwardRef( (t, e) => { const o = X(ne, t.__scopeSelect), [n, i] = s.useState(); if (Y(() => { i(new DocumentFragment()); }, []), !o.open) { const f = n; return f ? Ue.createPortal( /* @__PURE__ */ v(et, { scope: t.__scopeSelect, children: /* @__PURE__ */ v(ve.Slot, { scope: t.__scopeSelect, children: /* @__PURE__ */ v("div", { children: t.children }) }) }), f ) : null; } return /* @__PURE__ */ v(tt, { ...t, ref: e }); } ); Qe.displayName = ne; var K = 10, [et, J] = ce(ne), vo = "SelectContentImpl", go = /* @__PURE__ */ to("SelectContent.RemoveScroll"), tt = s.forwardRef( (t, e) => { const { __scopeSelect: o, position: n = "item-aligned", onCloseAutoFocus: i, onEscapeKeyDown: f, onPointerDownOutside: c, // // PopperContent props side: a, sideOffset: l, align: h, alignOffset: g, arrowPadding: w, collisionBoundary: N, collisionPadding: b, sticky: I, hideWhenDetached: r, avoidCollisions: d, // ...p } = t, u = X(ne, o), [m, x] = s.useState(null), [S, T] = s.useState(null), C = G(e, (y) => x(y)), [O, M] = s.useState(null), [B, L] = s.useState( null ), F = ge(o), [j, U] = s.useState(!1), $ = s.useRef(!1); s.useEffect(() => { if (m) return Bt(m); }, [m]), Ht(); const D = s.useCallback( (y) => { const [E, ...V] = F().map((_) => _.ref.current), [P] = V.slice(-1), R = document.activeElement; for (const _ of y) if (_ === R || (_ == null || _.scrollIntoView({ block: "nearest" }), _ === E && S && (S.scrollTop = 0), _ === P && S && (S.scrollTop = S.scrollHeight), _ == null || _.focus(), document.activeElement !== R)) return; }, [F, S] ), z = s.useCallback( () => D([O, m]), [D, O, m] ); s.useEffect(() => { j && z(); }, [j, z]); const { onOpenChange: k, triggerPointerDownPosRef: q } = u; s.useEffect(() => { if (m) { let y = { x: 0, y: 0 }; const E = (P) => { var R, _; y = { x: Math.abs(Math.round(P.pageX) - (((R = q.current) == null ? void 0 : R.x) ?? 0)), y: Math.abs(Math.round(P.pageY) - (((_ = q.current) == null ? void 0 : _.y) ?? 0)) }; }, V = (P) => { y.x <= 10 && y.y <= 10 ? P.preventDefault() : m.contains(P.target) || k(!1), document.removeEventListener("pointermove", E), q.current = null; }; return q.current !== null && (document.addEventListener("pointermove", E), document.addEventListener("pointerup", V, { capture: !0, once: !0 })), () => { document.removeEventListener("pointermove", E), document.removeEventListener("pointerup", V, { capture: !0 }); }; } }, [m, k, q]), s.useEffect(() => { const y = () => k(!1); return window.addEventListener("blur", y), window.addEventListener("resize", y), () => { window.removeEventListener("blur", y), window.removeEventListener("resize", y); }; }, [k]); const [ie, se] = yt((y) => { const E = F().filter((R) => !R.disabled), V = E.find((R) => R.ref.current === document.activeElement), P = wt(E, y, V); P && setTimeout(() => P.ref.current.focus()); }), de = s.useCallback( (y, E, V) => { const P = !$.current && !V; (u.value !== void 0 && u.value === E || P) && (M(y), P && ($.current = !0)); }, [u.value] ), ae = s.useCallback(() => m == null ? void 0 : m.focus(), [m]), H = s.useCallback( (y, E, V) => { const P = !$.current && !V; (u.value !== void 0 && u.value === E || P) && L(y); }, [u.value] ), Q = n === "popper" ? Re : ot, ue = Q === Re ? { side: a, sideOffset: l, align: h, alignOffset: g, arrowPadding: w, collisionBoundary: N, collisionPadding: b, sticky: I, hideWhenDetached: r, avoidCollisions: d } : {}; return /* @__PURE__ */ v( et, { scope: o, content: m, viewport: S, onViewportChange: T, itemRefCallback: de, selectedItem: O, onItemLeave: ae, itemTextRefCallback: H, focusSelectedItem: z, selectedItemText: B, position: n, isPositioned: j, searchRef: ie, children: /* @__PURE__ */ v(Ft, { as: go, allowPinchZoom: !0, children: /* @__PURE__ */ v( Ut, { asChild: !0, trapped: u.open, onMountAutoFocus: (y) => { y.preventDefault(); }, onUnmountAutoFocus: A(i, (y) => { var E; (E = u.trigger) == null || E.focus({ preventScroll: !0 }), y.preventDefault(); }), children: /* @__PURE__ */ v( Vt, { asChild: !0, disableOutsidePointerEvents: !0, onEscapeKeyDown: f, onPointerDownOutside: c, onFocusOutside: (y) => y.preventDefault(), onDismiss: () => u.onOpenChange(!1), children: /* @__PURE__ */ v( Q, { role: "listbox", id: u.contentId, "data-state": u.open ? "open" : "closed", dir: u.dir, onContextMenu: (y) => y.preventDefault(), ...p, ...ue, onPlaced: () => U(!0), ref: C, style: { // flex layout so we can place the scroll buttons properly display: "flex", flexDirection: "column", // reset the outline by default as the content MAY get focused outline: "none", ...p.style }, onKeyDown: A(p.onKeyDown, (y) => { const E = y.ctrlKey || y.altKey || y.metaKey; if (y.key === "Tab" && y.preventDefault(), !E && y.key.length === 1 && se(y.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(y.key)) { let P = F().filter((R) => !R.disabled).map((R) => R.ref.current); if (["ArrowUp", "End"].includes(y.key) && (P = P.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(y.key)) { const R = y.target, _ = P.indexOf(R); P = P.slice(_ + 1); } setTimeout(() => D(P)), y.preventDefault(); } }) } ) } ) } ) }) } ); } ); tt.displayName = vo; var So = "SelectItemAlignedPosition", ot = s.forwardRef((t, e) => { const { __scopeSelect: o, onPlaced: n, ...i } = t, f = X(ne, o), c = J(ne, o), [a, l] = s.useState(null), [h, g] = s.useState(null), w = G(e, (C) => g(C)), N = ge(o), b = s.useRef(!1), I = s.useRef(!0), { viewport: r, selectedItem: d, selectedItemText: p, focusSelectedItem: u } = c, m = s.useCallback(() => { if (f.trigger && f.valueNode && a && h && r && d && p) { const C = f.trigger.getBoundingClientRect(), O = h.getBoundingClientRect(), M = f.valueNode.getBoundingClientRect(), B = p.getBoundingClientRect(); if (f.dir !== "rtl") { const R = B.left - O.left, _ = M.left - R, ee = C.left - _, te = C.width + ee, ye = Math.max(te, O.width), we = window.innerWidth - K, Ie = Le(_, [ K, // Prevents the content from going off the starting edge of the // viewport. It may still go off the ending edge, but this can be // controlled by the user since they may want to manage overflow in a // specific way. // https://github.com/radix-ui/primitives/issues/2049 Math.max(K, we - ye) ]); a.style.minWidth = te + "px", a.style.left = Ie + "px"; } else { const R = O.right - B.right, _ = window.innerWidth - M.right - R, ee = window.innerWidth - C.right - _, te = C.width + ee, ye = Math.max(te, O.width), we = window.innerWidth - K, Ie = Le(_, [ K, Math.max(K, we - ye) ]); a.style.minWidth = te + "px", a.style.right = Ie + "px"; } const L = N(), F = window.innerHeight - K * 2, j = r.scrollHeight, U = window.getComputedStyle(h), $ = parseInt(U.borderTopWidth, 10), D = parseInt(U.paddingTop, 10), z = parseInt(U.borderBottomWidth, 10), k = parseInt(U.paddingBottom, 10), q = $ + D + j + k + z, ie = Math.min(d.offsetHeight * 5, q), se = window.getComputedStyle(r), de = parseInt(se.paddingTop, 10), ae = parseInt(se.paddingBottom, 10), H = C.top + C.height / 2 - K, Q = F - H, ue = d.offsetHeight / 2, y = d.offsetTop + ue, E = $ + D + y, V = q - E; if (E <= H) { const R = L.length > 0 && d === L[L.length - 1].ref.current; a.style.bottom = "0px"; const _ = h.clientHeight - r.offsetTop - r.offsetHeight, ee = Math.max( Q, ue + // viewport might have padding bottom, include it to avoid a scrollable viewport (R ? ae : 0) + _ + z ), te = E + ee; a.style.height = te + "px"; } else { const R = L.length > 0 && d === L[0].ref.current; a.style.top = "0px"; const ee = Math.max( H, $ + r.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport (R ? de : 0) + ue ) + V; a.style.height = ee + "px", r.scrollTop = E - H + r.offsetTop; } a.style.margin = `${K}px 0`, a.style.minHeight = ie + "px", a.style.maxHeight = F + "px", n == null || n(), requestAnimationFrame(() => b.current = !0); } }, [ N, f.trigger, f.valueNode, a, h, r, d, p, f.dir, n ]); Y(() => m(), [m]); const [x, S] = s.useState(); Y(() => { h && S(window.getComputedStyle(h).zIndex); }, [h]); const T = s.useCallback( (C) => { C && I.current === !0 && (m(), u == null || u(), I.current = !1); }, [m, u] ); return /* @__PURE__ */ v( wo, { scope: o, contentWrapper: a, shouldExpandOnScrollRef: b, onScrollButtonChange: T, children: /* @__PURE__ */ v( "div", { ref: l, style: { display: "flex", flexDirection: "column", position: "fixed", zIndex: x }, children: /* @__PURE__ */ v( W.div, { ...i, ref: w, style: { // When we get the height of the content, it includes borders. If we were to set // the height without having `boxSizing: 'border-box'` it would be too big. boxSizing: "border-box", // We need to ensure the content doesn't get taller than the wrapper maxHeight: "100%", ...i.style } } ) } ) } ); }); ot.displayName = So; var yo = "SelectPopperPosition", Re = s.forwardRef((t, e) => { const { __scopeSelect: o, align: n = "start", collisionPadding: i = K, ...f } = t, c = Se(o); return /* @__PURE__ */ v( jt, { ...c, ...f, ref: e, align: n, collisionPadding: i, style: { // Ensure border-box for floating-ui calculations boxSizing: "border-box", ...f.style, "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)", "--radix-select-content-available-width": "var(--radix-popper-available-width)", "--radix-select-content-available-height": "var(--radix-popper-available-height)", "--radix-select-trigger-width": "var(--radix-popper-anchor-width)", "--radix-select-trigger-height": "var(--radix-popper-anchor-height)" } } ); }); Re.displayName = yo; var [wo, De] = ce(ne, {}), _e = "SelectViewport", rt = s.forwardRef( (t, e) => { const { __scopeSelect: o, nonce: n, ...i } = t, f = J(_e, o), c = De(_e, o), a = G(e, f.onViewportChange), l = s.useRef(0); return /* @__PURE__ */ oe(Me, { children: [ /* @__PURE__ */ v( "style", { dangerouslySetInnerHTML: { __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}" }, nonce: n } ), /* @__PURE__ */ v(ve.Slot, { scope: o, children: /* @__PURE__ */ v( W.div, { "data-radix-select-viewport": "", role: "presentation", ...i, ref: a, style: { // we use position: 'relative' here on the `viewport` so that when we call // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport // (independent of the scrollUpButton). position: "relative", flex: 1, // Viewport should only be scrollable in the vertical direction. // This won't work in vertical writing modes, so we'll need to // revisit this if/when that is supported // https://developer.chrome.com/blog/vertical-form-controls overflow: "hidden auto", ...i.style }, onScroll: A(i.onScroll, (h) => { const g = h.currentTarget, { contentWrapper: w, shouldExpandOnScrollRef: N } = c; if (N != null && N.current && w) { const b = Math.abs(l.current - g.scrollTop); if (b > 0) { const I = window.innerHeight - K * 2, r = parseFloat(w.style.minHeight), d = parseFloat(w.style.height), p = Math.max(r, d); if (p < I) { const u = p + b, m = Math.min(I, u), x = u - m; w.style.height = m + "px", w.style.bottom === "0px" && (g.scrollTop = x > 0 ? x : 0, w.style.justifyContent = "flex-end"); } } } l.current = g.scrollTop; }) } ) }) ] }); } ); rt.displayName = _e; var nt = "SelectGroup", [Io, Co] = ce(nt), it = s.forwardRef( (t, e) => { const { __scopeSelect: o, ...n } = t, i = Ae(); return /* @__PURE__ */ v(Io, { scope: o, id: i, children: /* @__PURE__ */ v(W.div, { role: "group", "aria-labelledby": i, ...n, ref: e }) }); } ); it.displayName = nt; var st = "SelectLabel", at = s.forwardRef( (t, e) => { const { __scopeSelect: o, ...n } = t, i = Co(st, o); return /* @__PURE__ */ v(W.div, { id: i.id, ...n, ref: e }); } ); at.displayName = st; var he = "SelectItem", [bo, lt] = ce(he), ct = s.forwardRef( (t, e) => { const { __scopeSelect: o, value: n, disabled: i = !1, textValue: f, ...c } = t, a = X(he, o), l = J(he, o), h = a.value === n, [g, w] = s.useState(f ?? ""), [N, b] = s.useState(!1), I = G( e, (u) => { var m; return (m = l.itemRefCallback) == null ? void 0 : m.call(l, u, n, i); } ), r = Ae(), d = s.useRef("touch"), p = () => { i || (a.onValueChange(n), a.onOpenChange(!1)); }; if (n === "") throw new Error( "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder." ); return /* @__PURE__ */ v( bo, { scope: o, value: n, disabled: i, textId: r, isSelected: h, onItemTextChange: s.useCallback((u) => { w((m) => m || ((u == null ? void 0 : u.textContent) ?? "").trim()); }, []), children: /* @__PURE__ */ v( ve.ItemSlot, { scope: o, value: n, disabled: i, textValue: g, children: /* @__PURE__ */ v( W.div, { role: "option", "aria-labelledby": r, "data-highlighted": N ? "" : void 0, "aria-selected": h && N, "data-state": h ? "checked" : "unchecked", "aria-disabled": i || void 0, "data-disabled": i ? "" : void 0, tabIndex: i ? void 0 : -1, ...c, ref: I, onFocus: A(c.onFocus, () => b(!0)), onBlur: A(c.onBlur, () => b(!1)), onClick: A(c.onClick, () => { d.current !== "mouse" && p(); }), onPointerUp: A(c.onPointerUp, () => { d.current === "mouse" && p(); }), onPointerDown: A(c.onPointerDown, (u) => { d.current = u.pointerType; }), onPointerMove: A(c.onPointerMove, (u) => { var m; d.current = u.pointerType, i ? (m = l.onItemLeave) == null || m.call(l) : d.current === "mouse" && u.currentTarget.focus({ preventScroll: !0 }); }), onPointerLeave: A(c.onPointerLeave, (u) => { var m; u.currentTarget === document.activeElement && ((m = l.onItemLeave) == null || m.call(l)); }), onKeyDown: A(c.onKeyDown, (u) => { var x; ((x = l.searchRef) == null ? void 0 : x.current) !== "" && u.key === " " || (lo.includes(u.key) && p(), u.key === " " && u.preventDefault()); }) } ) } ) } ); } ); ct.displayName = he; var pe = "SelectItemText", dt = s.forwardRef( (t, e) => { const { __scopeSelect: o, className: n, style: i, ...f } = t, c = X(pe, o), a = J(pe, o), l = lt(pe, o), h = fo(pe, o), [g, w] = s.useState(null), N = G( e, (p) => w(p), l.onItemTextChange, (p) => { var u; return (u = a.itemTextRefCallback) == null ? void 0 : u.call(a, p, l.value, l.disabled); } ), b = g == null ? void 0 : g.textContent, I = s.useMemo( () => /* @__PURE__ */ v("option", { value: l.value, disabled: l.disabled, children: b }, l.value), [l.disabled, l.value, b] ), { onNativeOptionAdd: r, onNativeOptionRemove: d } = h; return Y(() => (r(I), () => d(I)), [r, d, I]), /* @__PURE__ */ oe(Me, { children: [ /* @__PURE__ */ v(W.span, { id: l.textId, ...f, ref: N }), l.isSelected && c.valueNode && !c.valueNodeHasChildren ? Ue.createPortal(f.children, c.valueNode) : null ] }); } ); dt.displayName = pe; var ut = "SelectItemIndicator", pt = s.forwardRef( (t, e) => { const { __scopeSelect: o, ...n } = t; return lt(ut, o).isSelected ? /* @__PURE__ */ v(W.span, { "aria-hidden": !0, ...n, ref: e }) : null; } ); pt.displayName = ut; var Pe = "SelectScrollUpButton", ft = s.forwardRef((t, e) => { const o = J(Pe, t.__scopeSelect), n = De(Pe, t.__scopeSelect), [i, f] = s.useState(!1), c = G(e, n.onScrollButtonChange); return Y(() => { if (o.viewport && o.isPositioned) { let a = function() { const h = l.scrollTop > 0; f(h); }; const l = o.viewport; return a(), l.addEventListener("scroll", a), () => l.removeEventListener("scroll", a); } }, [o.viewport, o.isPositioned]), i ? /* @__PURE__ */ v( ht, { ...t, ref: c, onAutoScroll: () => { const { viewport: a, selectedItem: l } = o; a && l && (a.scrollTop = a.scrollTop - l.offsetHeight); } } ) : null; }); ft.displayName = Pe; var Ee = "SelectScrollDownButton", mt = s.forwardRef((t, e) => { const o = J(Ee, t.__scopeSelect), n = De(Ee, t.__scopeSelect), [i, f] = s.useState(!1), c = G(e, n.onScrollButtonChange); return Y(() => { if (o.viewport && o.isPositioned) { let a = function() { const h = l.scrollHeight - l.clientHeight, g = Math.ceil(l.scrollTop) < h; f(g); }; const l = o.viewport; return a(), l.addEventListener("scroll", a), () => l.removeEventListener("scroll", a); } }, [o.viewport, o.isPositioned]), i ? /* @__PURE__ */ v( ht, { ...t, ref: c, onAutoScroll: () => { const { viewport: a, selectedItem: l } = o; a && l && (a.scrollTop = a.scrollTop + l.offsetHeight); } } ) : null; }); mt.displayName = Ee; var ht = s.forwardRef((t, e) => { const { __scopeSelect: o, onAutoScroll: n, ...i } = t, f = J("SelectScrollButton", o), c = s.useRef(null), a = ge(o), l = s.useCallback(() => { c.current !== null && (window.clearInterval(c.current), c.current = null); }, []); return s.useEffect(() => () => l(), [l]), Y(() => { var g; const h = a().find((w) => w.ref.current === document.activeElement); (g = h == null ? void 0 : h.ref.current) == null || g.scrollIntoView({ block: "nearest" }); }, [a]), /* @__PURE__ */ v( W.div, { "aria-hidden": !0, ...i, ref: e, style: { flexShrink: 0, ...i.style }, onPointerDown: A(i.onPointerDown, () => { c.current === null && (c.current = window.setInterval(n, 50)); }), onPointerMove: A(i.onPointerMove, () => { var h; (h = f.onItemLeave) == null || h.call(f), c.current === null && (c.current = window.setInterval(n, 50)); }), onPointerLeave: A(i.onPointerLeave, () => { l(); }) } ); }), xo = "SelectSeparator", vt = s.forwardRef( (t, e) => { const { __scopeSelect: o, ...n } = t; return /* @__PURE__ */ v(W.div, { "aria-hidden": !0, ...n, ref: e }); } ); vt.displayName = xo; var Oe = "SelectArrow", To = s.forwardRef( (t, e) => { const { __scopeSelect: o, ...n } = t, i = Se(o), f = X(Oe, o), c = J(Oe, o); return f.open && c.position === "popper" ? /* @__PURE__ */ v(qt, { ...i, ...n, ref: e }) : null; } ); To.displayName = Oe; var No = "SelectBubbleInput", gt = s.forwardRef( ({ __scopeSelect: t, value: e, ...o }, n) => { const i = s.useRef(null), f = G(n, i), c = eo(e); return s.useEffect(() => { const a = i.current; if (!a) return; const l = window.HTMLSelectElement.prototype, g = Object.getOwnPropertyDescriptor( l, "value" ).set; if (c !== e && g) { const w = new Event("change", { bubbles: !0 }); g.call(a, e), a.dispatchEvent(w); } }, [c, e]), /* @__PURE__ */ v( W.select, { ...o, style: { ...Yt, ...o.style }, ref: f, defaultValue: e } ); } ); gt.displayName = No; function St(t) { return t === "" || t === void 0; } function yt(t) { const e = Gt(t), o = s.useRef(""), n = s.useRef(0), i = s.useCallback( (c) => { const a = o.current + c; e(a), (function l(h) { o.current = h, window.clearTimeout(n.current), h !== "" && (n.current = window.setTimeout(() => l(""), 1e3)); })(a); }, [e] ), f = s.useCallback(() => { o.current = "", window.clearTimeout(n.current); }, []); return s.useEffect(() => () => window.clearTimeout(n.current), []), [o, i, f]; } function wt(t, e, o) { const i = e.length > 1 && Array.from(e).every((h) => h === e[0]) ? e[0] : e, f = o ? t.indexOf(o) : -1; let c = Ro(t, Math.max(f, 0)); i.length === 1 && (c = c.filter((h) => h !== o)); const l = c.find( (h) => h.textValue.toLowerCase().startsWith(i.toLowerCase()) ); return l !== o ? l : void 0; } function Ro(t, e) { return t.map((o, n) => t[(e + n) % t.length]); } var _o = je, It = Ge, Po = Ze, Eo = Xe, Oo = Je, Ct = Qe, Mo = rt, Ao = it, bt = at, xt = ct, Do = dt, Lo = pt, Tt = ft, Nt = mt, Rt = vt; function zo(t, e) { t.prototype = Object.create(e.prototype), t.prototype.constructor = t, Ne(t, e); } var Ve = Number.isNaN || function(e) { return typeof e == "number" && e !== e; }; function ko(t, e) { return !!(t === e || Ve(t) && Ve(e)); } function Vo(t, e) { if (t.length !== e.length) return !1; for (var o = 0; o < t.length; o++) if (!ko(t[o], e[o])) return !1; return !0; } function be(t, e) { e === void 0 && (e = Vo); var o, n = [], i, f = !1; function c() { for (var a = [], l = 0; l < arguments.length; l++) a[l] = arguments[l]; return f && o === this && e(a, n) || (i = t.apply(this, a), f = !0, o = this, n = a), i; } return c; } var Wo = typeof performance == "object" && typeof performance.now == "function", We = Wo ? function() { return performance.now(); } : function() { return Date.now(); }; function Be(t) { cancelAnimationFrame(t.id); } function Bo(t, e) { var o = We(); function n() { We() - o >= e ? t.call(null) : i.id = requestAnimationFrame(n); } var i = { id: requestAnimationFrame(n) }; return i; } var xe = -1; function He(t) { if (t === void 0 && (t = !1), xe === -1 || t) { var e = document.createElement("div"), o = e.style; o.width = "50px", o.height = "50px", o.overflow = "scroll", document.body.appendChild(e), xe = e.offsetWidth - e.clientWidth, document.body.removeChild(e); } return xe; } var le = null; function Fe(t) { if (t === void 0 && (t = !1), le === null || t) { var e = document.createElement("div"), o = e.style; o.width = "50px", o.height = "50px", o.overflow = "scroll", o.direction = "rtl"; var n = document.createElement("div"), i = n.style; return i.width = "100px", i.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? le = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? le = "negative" : le = "positive-ascending"), document.body.removeChild(e), le; } return le; } process.env.NODE_ENV; var Ho = 150, Fo = function(e, o) { return e; }, fe = null, me = null; process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (fe = /* @__PURE__ */ new WeakSet(), me = /* @__PURE__ */ new WeakSet()); function Uo(t) { var e, o = t.getItemOffset, n = t.getEstimatedTotalSize, i = t.getItemSize, f = t.getOffsetForIndexAndAlignment, c = t.getStartIndexForOffset, a = t.getStopIndexForStartIndex, l = t.initInstanceProps, h = t.shouldResetStyleCacheOnItemSizeChange, g = t.validateProps; return e = /* @__PURE__ */ (function(w) { zo(N, w); function N(I) { var r; return r = w.call(this, I) || this, r._instanceProps = l(r.props, ke(r)), r._outerRef = void 0, r._resetIsScrollingTimeoutId = null, r.state = { instance: ke(r), isScrolling: !1, scrollDirection: "forward", scrollOffset: typeof r.props.initialScrollOffset == "number" ? r.props.initialScrollOffset : 0, scrollUpdateWasRequested: !1 }, r._callOnItemsRendered = void 0, r._callOnItemsRendered = be(function(d, p, u, m) { return r.props.onItemsRendered({ overscanStartIndex: d, overscanStopIndex: p, visibleStartIndex: u, visibleStopIndex: m }); }), r._callOnScroll = void 0, r._callOnScroll = be(function(d, p, u) { return r.props.onScroll({ scrollDirection: d, scrollOffset: p, scrollUpdateWasRequested: u }); }), r._getItemStyle = void 0, r._getItemStyle = function(d) { var p = r.props, u = p.direction, m = p.itemSize, x = p.layout, S = r._getItemStyleCache(h && m, h && x, h && u), T; if (S.hasOwnProperty(d)) T = S[d]; else { var C = o(r.props, d, r._instanceProps), O = i(r.props, d, r._instanceProps), M = u === "horizontal" || x === "horizontal", B = u === "rtl", L = M ? C : 0; S[d] = T = { position: "absolute", left: B ? void 0 : L, right: B ? L : void 0, top: M ? 0 : C, height: M ? "100%" : O, width: M ? O : "100%" }; } return T; }, r._getItemStyleCache = void 0, r._getItemStyleCache = be(function(d, p, u) { return {}; }), r._onScrollHorizontal = function(d) { var p = d.currentTarget, u = p.clientWidth, m = p.scrollLeft, x = p.scrollWidth; r.setState(function(S) { if (S.scrollOffset === m) return null; var T = r.props.direction, C = m; if (T === "rtl") switch (Fe()) { case "negative": C = -m; break; case "positive-descending": C = x - u - m; break; } return C = Math.max(0, Math.min(C, x - u)), { isScrolling: !0, scrollDirection: S.scrollOffset < C ? "forward" : "backward", scrollOffset: C, scrollUpdateWasRequested: !1 }; }, r._resetIsScrollingDebounced); }, r._onScrollVertical = function(d) { var p = d.currentTarget, u = p.clientHeight, m = p.scrollHeight, x = p.scrollTop; r.setState(function(S) { if (S.scrollOffset === x) return null; var T = Math.max(0, Math.min(x, m - u)); return { isScrolling: !0, scrollDirection: S.scrollOffset < T ? "forward" : "backward", scrollOffset: T, scrollUpdateWasRequested: !1 }; }, r._resetIsScrollingDebounced); }, r._outerRefSetter = function(d) { var p = r.props.outerRef; r._outerRef = d, typeof p == "function" ? p(d) : p != null && typeof p == "object" && p.hasOwnProperty("current") && (p.current = d); }, r._resetIsScrollingDebounced = function() { r._resetIsScrollingTimeoutId !== null && Be(r._resetIsScrollingTimeoutId), r._resetIsScrollingTimeoutId = Bo(r._resetIsScrolling, Ho); }, r._resetIsScrolling = function() { r._resetIsScrollingTimeoutId = null, r.setState({ isScrolling: !1 }, function() { r._getItemStyleCache(-1, null); }); }, r; } N.getDerivedStateFromProps = function(r, d) { return $o(r, d), g(r), null; }; var b = N.prototype; return b.scrollTo = function(r) { r = Math.max(0, r), this.setState(function(d) { return d.scrollOffset === r ? null : { scrollDirection: d.scrollOffset < r ? "forward" : "backward", scrollOffset: r, scrollUpdateWasRequested: !0 }; }, this._resetIsScrollingDebounced); }, b.scrollToItem = function(r, d) { d === void 0 && (d = "auto"); var p = this.props, u = p.itemCount, m = p.layout, x = this.state.scrollOffset; r = Math.max(0, Math.min(r, u - 1)); var S = 0; if (this._outerRef) { var T = this._outerRef; m === "vertical" ? S = T.scrollWidth > T.clientWidth ? He() : 0 : S = T.scrollHeight > T.clientHeight ? He() : 0; } this.scrollTo(f(this.props, r, d, x, this._instanceProps, S)); }, b.componentDidMount = function() { var r = this.props, d = r.direction, p = r.initialScrollOffset, u = r.layout; if (typeof p == "number" && this._outerRef != null) { var m = this._outerRef; d === "horizontal" || u === "horizontal" ? m.scrollLeft = p : m.scrollTop = p; } this._callPropsCallbacks(); }, b.componentDidUpdate = function() { var r = this.props, d = r.direction, p = r.layout, u = this.state, m = u.scrollOffset, x = u.scrollUpdateWasRequested; if (x && this._outerRef != null) { var S = this._outerRef; if (d === "horizontal" || p === "horizontal") if (d === "rtl") switch (Fe()) { case "negative": S.scrollLeft = -m; break; case "positive-ascending": S.scrollLeft = m; break; default: var T = S.clientWidth, C = S.scrollWidth; S.scrollLeft = C - T - m; break; } else S.scrollLeft = m; else S.scrollTop = m; } this._callPropsCallbacks(); }, b.componentWillUnmount = function() { this._resetIsScrollingTimeoutId !== null && Be(this._resetIsScrollingTimeoutId); }, b.render = function() { var r = this.props, d = r.children, p = r.className, u = r.direction, m = r.height, x = r.innerRef, S = r.innerElementType, T = r.innerTagName, C = r.itemCount, O = r.itemData, M = r.itemKey, B = M === void 0 ? Fo : M, L = r.layout, F = r.outerElementType, j = r.outerTagName, U = r.style, $ = r.useIsScrolling, D = r.width, z = this.state.isScrolling, k = u === "horizontal" || L === "horizontal", q = k ? this._onScrollHorizontal : this._onScrollVertical, ie = this._getRangeToRender(), se = ie[0], de = ie[1], ae = []; if (C > 0) for (var H = se; H <= de; H++) ae.push(Ce(d, { data: O, key: B(H, O), index: H, isScrolling: $ ? z : void 0, style: this._getItemStyle(H) })); var Q = n(this.props, this._instanceProps); return Ce(F || j || "div", { className: p, onScroll: q, ref: this._outerRefSetter, style: Te({ position: "relative", height: m, width: D, overflow: "auto", WebkitOverflowScrolling: "touch", willChange: "transform", direction: u }, U) }, Ce(S || T || "div", { children: ae, ref: x, style: { height: k ? "100%" : Q, pointerEvents: z ? "none" : void 0, width: k ? Q : "100%" } })); }, b._callPropsCallbacks = function() { if (typeof this.props.onItemsRendered == "function") { var r = this.props.itemCount; if (r > 0) { var d = this._getRangeToRender(), p = d[0], u = d[1], m = d[2], x = d[3]; this._callOnItemsRendered(p, u, m, x); } } if (typeof this.props.onScroll == "function") { var S = this.state, T = S.scrollDirection, C = S.scrollOffset, O = S.scrollUpdateWasRequested; this._callOnScroll(T, C, O); } }, b._getRangeToRender = function() { var r = this.props, d = r.itemCount, p = r.overscanCount, u = this.state, m = u.isScrolling, x = u.scrollDirection, S = u.scrollOffset; if (d === 0) return [0, 0, 0, 0]; var T = c(this.props, S, this._instanceProps), C = a(this.props, T, S, this._instanceProps), O = !m || x === "backward" ? Math.max(1, p) : 1, M = !m || x === "forward" ? Math.max(1, p) : 1; return [Math.max(0, T - O), Math.max(0, Math.min(d - 1, C + M)), T, C]; }, N; })(Mt), e.defaultProps = { direction: "ltr", itemData: void 0, layout: "vertical", overscanCount: 2, useIsScrolling: !1 }, e; } var $o = function(e, o) { var n = e.children, i = e.direction, f = e.height, c = e.layout, a = e.innerTagName, l = e.outerTagName, h = e.width, g = o.instance; if (process.env.NODE_ENV !== "production") { (a != null || l != null) && me && !me.has(g) && (me.add(g), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")); var w = i === "horizontal" || c === "horizontal"; switch (i) { case "horizontal": case "vertical": fe && !fe.has(g) && (fe.add(g), console.warn('The direction prop should be either "ltr" (default) or "rtl". Please use the layout prop to specify "vertical" (default) or "horizontal" orientation.')); break; case "ltr": case "rtl": break; default: throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + i + '" was specified.')); } switch (c) { case "horizontal": case "vertical": break; default: throw Error('An invalid "layout" prop has been specified. Value should be either "horizontal" or "vertical". ' + ('"' + c + '" was specified.')); } if (n == null) throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.')); if (w && typeof h != "number") throw Error('An invalid "width" prop has been specified. Horizontal lists must specify a number for width. ' + ('"' + (h === null ? "null" : typeof h) + '" was specified.')); if (!w && typeof f != "number") throw Error('An invalid "height" prop has been specified. Vertical lists must specify a number for height. ' + ('"' + (f === null ? "null" : typeof f) + '" was specified.')); } }, Ko = /* @__PURE__ */ Uo({ getItemOffset: function(e, o) { var n = e.itemSize; return o * n; }, getItemSize: function(e, o) { var n = e.itemSize; return n; }, getEstimatedTotalSize: function(e) { var o = e.itemCount, n = e.itemSize; return n * o; }, getOffsetForIndexAndAlignment: function(e, o, n, i, f, c) { var a = e.direction, l = e.height, h = e.itemCount, g = e.itemSize, w = e.layout, N = e.width, b = a === "horizontal" || w === "horizontal", I = b ? N : l, r = Math.max(0, h * g - I), d = Math.min(r, o * g), p = Math.max(0, o * g - I + g + c); switch (n === "smart" && (i >= p - I && i <= d + I ? n = "auto" : n = "center"), n) { case "start": return d; case "end": return p; case "center": { var u = Math.round(p + (d - p) / 2); return u < Math.ceil(I / 2) ? 0 : u > r + Math.floor(I / 2) ? r : u; } case "auto": default: return i >= p && i <= d ? i : i < p ? p : d; } }, getStartIndexForOffset: function(e, o) { var n = e.itemCount, i = e.itemSize; return Math.max(0, Math.min(n - 1, Math.floor(o / i))); }, getStopIndexForStartIndex: function(e, o, n) { var i = e.direction, f = e.height, c = e.itemCount, a = e.itemSize, l = e.layout, h = e.width, g = i === "horizontal" || l === "horizontal", w = o * a, N = g ? h : f, b = Math.ceil((N + n - w) / a); return Math.max(0, Math.min( c - 1, o + b - 1 // -1 is because stop index is inclusive )); }, initInstanceProps: function(e) { }, shouldResetStyleCacheOnItemSizeChange: !0, validateProps: function(e) { var o = e.itemSize; if (process.env.NODE_ENV !== "production" && typeof o != "number") throw Error('An invalid "itemSize" prop has been specified. Value should be a number. ' + ('"' + (o === null ? "null" : typeof o) + '" was specified.')); } }); const mr = _o, hr = Ao, vr = Po, jo = s.forwardRef(({ className: t, children: e, variant: o = "default", ...n }, i) => /* @__PURE__ */ oe( It, { ref: i, className: Z( "border-border-alpha-strong focus:ring-primary data-placeholder:[&>span]:text-body-sm-regular! flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 focus:ring-2 focus:ring-offset-2 focus:ring-offset-transparent focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", "focus:ring-offset-bg data-placeholder:[&>span]:text-secondary/70 focus:ring-item-primary focus:ring-2 focus:ring-offset-2", o === "failure" && "focus:ring-destructive border-destructive text-destructive! data-placeholder:[&>span]:text-destructive", t ), ...n, children: [ e, /* @__PURE__ */ v(Eo, { asChild: !0, children: /* @__PURE__ */ v(Ke, { className: "h-4 w-4 opacity-50" }) }) ] } )); jo.displayName = It.displayName; const _t = s.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ v( Tt, { ref: o, className: Z( "flex cursor-default items-center justify-center py-1", t ), ...e, children: /* @__PURE__ */ v(Qt, { className: "size-4" }) } )); _t.displayName = Tt.displayName; const Pt = s.forwardRef(({ className: t, ...e }, o) => /* @__PURE__ */ v( Nt, { ref: o, className: Z( "flex cursor-default items-center justify-center py-1", t ), ...e, children: /* @__PURE__ */ v(Ke, { className: "h-4 w-4" }) } )); Pt.displayName = Nt.displayName; const Et = s.forwardRef(({ className: t, children: e, position: o = "popper", ...n }, i) => /* @__PURE__ */ v(Oo, { children: /* @__PURE__ */ oe( Ct, { ref: i, className: Z( "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:a