@devopness/ui-react
Version:
Devopness Design System React Components - Painless essential DevOps to everyone
1,474 lines (1,467 loc) • 327 kB
JavaScript
import { jsx as p, jsxs as ce, Fragment as ve } from "react/jsx-runtime";
import * as n from "react";
import G, { useState as wp, useLayoutEffect as bp } from "react";
import { a as Ve, d as xa, _ as Sp, e as Ep, o as Np, s as Rp, f as xp, h as Pp, i as _p, j as Yo, l as Tp, b as Mp, g as Ip } from "./floating-ui.dom-D-Xa-KVQ.js";
import * as _r from "react-dom";
import Pa from "react-dom";
function Xo(e, t) {
if (typeof e == "function")
return e(t);
e != null && (e.current = t);
}
function he(...e) {
return (t) => {
let r = !1;
const o = e.map((a) => {
const s = Xo(a, t);
return !r && typeof s == "function" && (r = !0), s;
});
if (r)
return () => {
for (let a = 0; a < o.length; a++) {
const s = o[a];
typeof s == "function" ? s() : Xo(e[a], null);
}
};
};
}
function $(...e) {
return n.useCallback(he(...e), e);
}
// @__NO_SIDE_EFFECTS__
function Ap(e) {
const t = /* @__PURE__ */ $p(e), r = n.forwardRef((o, a) => {
const { children: s, ...i } = o, c = n.Children.toArray(s), l = c.find(Op);
if (l) {
const d = l.props.children, u = c.map((f) => f === l ? n.Children.count(d) > 1 ? n.Children.only(null) : n.isValidElement(d) ? d.props.children : null : f);
return /* @__PURE__ */ p(t, { ...i, ref: a, children: n.isValidElement(d) ? n.cloneElement(d, void 0, u) : null });
}
return /* @__PURE__ */ p(t, { ...i, ref: a, children: s });
});
return r.displayName = `${e}.Slot`, r;
}
// @__NO_SIDE_EFFECTS__
function $p(e) {
const t = n.forwardRef((r, o) => {
const { children: a, ...s } = r;
if (n.isValidElement(a)) {
const i = Lp(a), c = kp(s, a.props);
return a.type !== n.Fragment && (c.ref = o ? he(o, i) : i), n.cloneElement(a, c);
}
return n.Children.count(a) > 1 ? n.Children.only(null) : null;
});
return t.displayName = `${e}.SlotClone`, t;
}
var Dp = /* @__PURE__ */ Symbol("radix.slottable");
function Op(e) {
return n.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Dp;
}
function kp(e, t) {
const r = { ...t };
for (const o in t) {
const a = e[o], s = t[o];
/^on[A-Z]/.test(o) ? a && s ? r[o] = (...c) => {
const l = s(...c);
return a(...c), l;
} : a && (r[o] = a) : o === "style" ? r[o] = { ...a, ...s } : o === "className" && (r[o] = [a, s].filter(Boolean).join(" "));
}
return { ...e, ...r };
}
function Lp(e) {
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning;
return r ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
}
var Fp = [
"a",
"button",
"div",
"form",
"h2",
"h3",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"select",
"span",
"svg",
"ul"
], P = Fp.reduce((e, t) => {
const r = /* @__PURE__ */ Ap(`Primitive.${t}`), o = n.forwardRef((a, s) => {
const { asChild: i, ...c } = a, l = i ? r : t;
return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(l, { ...c, ref: s });
});
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
}, {});
function kt(e, t) {
e && _r.flushSync(() => e.dispatchEvent(t));
}
var _a = Object.freeze({
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
position: "absolute",
border: 0,
width: 1,
height: 1,
padding: 0,
margin: -1,
overflow: "hidden",
clip: "rect(0, 0, 0, 0)",
whiteSpace: "nowrap",
wordWrap: "normal"
}), Bp = "VisuallyHidden", Ta = n.forwardRef(
(e, t) => /* @__PURE__ */ p(
P.span,
{
...e,
ref: t,
style: { ..._a, ...e.style }
}
)
);
Ta.displayName = Bp;
var Un = Ta;
function Vp(e, t) {
const r = n.createContext(t), o = (s) => {
const { children: i, ...c } = s, l = n.useMemo(() => c, Object.values(c));
return /* @__PURE__ */ p(r.Provider, { value: l, children: i });
};
o.displayName = e + "Provider";
function a(s) {
const i = n.useContext(r);
if (i) return i;
if (t !== void 0) return t;
throw new Error(`\`${s}\` must be used within \`${e}\``);
}
return [o, a];
}
function U(e, t = []) {
let r = [];
function o(s, i) {
const c = n.createContext(i), l = r.length;
r = [...r, i];
const d = (f) => {
const { scope: m, children: h, ...g } = f, v = m?.[e]?.[l] || c, C = n.useMemo(() => g, Object.values(g));
return /* @__PURE__ */ p(v.Provider, { value: C, children: h });
};
d.displayName = s + "Provider";
function u(f, m) {
const h = m?.[e]?.[l] || c, g = n.useContext(h);
if (g) return g;
if (i !== void 0) return i;
throw new Error(`\`${f}\` must be used within \`${s}\``);
}
return [d, u];
}
const a = () => {
const s = r.map((i) => n.createContext(i));
return function(c) {
const l = c?.[e] || s;
return n.useMemo(
() => ({ [`__scope${e}`]: { ...c, [e]: l } }),
[c, l]
);
};
};
return a.scopeName = e, [o, Gp(a, ...t)];
}
function Gp(...e) {
const t = e[0];
if (e.length === 1) return t;
const r = () => {
const o = e.map((a) => ({
useScope: a(),
scopeName: a.scopeName
}));
return function(s) {
const i = o.reduce((c, { useScope: l, scopeName: d }) => {
const f = l(s)[`__scope${d}`];
return { ...c, ...f };
}, {});
return n.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
};
};
return r.scopeName = t.scopeName, r;
}
// @__NO_SIDE_EFFECTS__
function qo(e) {
const t = /* @__PURE__ */ zp(e), r = n.forwardRef((o, a) => {
const { children: s, ...i } = o, c = n.Children.toArray(s), l = c.find(Wp);
if (l) {
const d = l.props.children, u = c.map((f) => f === l ? n.Children.count(d) > 1 ? n.Children.only(null) : n.isValidElement(d) ? d.props.children : null : f);
return /* @__PURE__ */ p(t, { ...i, ref: a, children: n.isValidElement(d) ? n.cloneElement(d, void 0, u) : null });
}
return /* @__PURE__ */ p(t, { ...i, ref: a, children: s });
});
return r.displayName = `${e}.Slot`, r;
}
// @__NO_SIDE_EFFECTS__
function zp(e) {
const t = n.forwardRef((r, o) => {
const { children: a, ...s } = r;
if (n.isValidElement(a)) {
const i = Up(a), c = Kp(s, a.props);
return a.type !== n.Fragment && (c.ref = o ? he(o, i) : i), n.cloneElement(a, c);
}
return n.Children.count(a) > 1 ? n.Children.only(null) : null;
});
return t.displayName = `${e}.SlotClone`, t;
}
var Hp = /* @__PURE__ */ Symbol("radix.slottable");
function Wp(e) {
return n.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Hp;
}
function Kp(e, t) {
const r = { ...t };
for (const o in t) {
const a = e[o], s = t[o];
/^on[A-Z]/.test(o) ? a && s ? r[o] = (...c) => {
const l = s(...c);
return a(...c), l;
} : a && (r[o] = a) : o === "style" ? r[o] = { ...a, ...s } : o === "className" && (r[o] = [a, s].filter(Boolean).join(" "));
}
return { ...e, ...r };
}
function Up(e) {
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning;
return r ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
}
function yt(e) {
const t = e + "CollectionProvider", [r, o] = U(t), [a, s] = r(
t,
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
), i = (v) => {
const { scope: C, children: y } = v, b = G.useRef(null), w = G.useRef(/* @__PURE__ */ new Map()).current;
return /* @__PURE__ */ p(a, { scope: C, itemMap: w, collectionRef: b, children: y });
};
i.displayName = t;
const c = e + "CollectionSlot", l = /* @__PURE__ */ qo(c), d = G.forwardRef(
(v, C) => {
const { scope: y, children: b } = v, w = s(c, y), S = $(C, w.collectionRef);
return /* @__PURE__ */ p(l, { ref: S, children: b });
}
);
d.displayName = c;
const u = e + "CollectionItemSlot", f = "data-radix-collection-item", m = /* @__PURE__ */ qo(u), h = G.forwardRef(
(v, C) => {
const { scope: y, children: b, ...w } = v, S = G.useRef(null), R = $(C, S), _ = s(u, y);
return G.useEffect(() => (_.itemMap.set(S, { ref: S, ...w }), () => {
_.itemMap.delete(S);
})), /* @__PURE__ */ p(m, { [f]: "", ref: R, children: b });
}
);
h.displayName = u;
function g(v) {
const C = s(e + "CollectionConsumer", v);
return G.useCallback(() => {
const b = C.collectionRef.current;
if (!b) return [];
const w = Array.from(b.querySelectorAll(`[${f}]`));
return Array.from(C.itemMap.values()).sort(
(_, x) => w.indexOf(_.ref.current) - w.indexOf(x.ref.current)
);
}, [C.collectionRef, C.itemMap]);
}
return [
{ Provider: i, Slot: d, ItemSlot: h },
g,
o
];
}
function E(e, t, { checkForDefaultPrevented: r = !0 } = {}) {
return function(a) {
if (e?.(a), r === !1 || !a.defaultPrevented)
return t?.(a);
};
}
var J = globalThis?.document ? n.useLayoutEffect : () => {
}, jp = n[" useInsertionEffect ".trim().toString()] || J;
function ee({
prop: e,
defaultProp: t,
onChange: r = () => {
},
caller: o
}) {
const [a, s, i] = Yp({
defaultProp: t,
onChange: r
}), c = e !== void 0, l = c ? e : a;
{
const u = n.useRef(e !== void 0);
n.useEffect(() => {
const f = u.current;
f !== c && console.warn(
`${o} is changing from ${f ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
), u.current = c;
}, [c, o]);
}
const d = n.useCallback(
(u) => {
if (c) {
const f = Xp(u) ? u(e) : u;
f !== e && i.current?.(f);
} else
s(u);
},
[c, e, s, i]
);
return [l, d];
}
function Yp({
defaultProp: e,
onChange: t
}) {
const [r, o] = n.useState(e), a = n.useRef(r), s = n.useRef(t);
return jp(() => {
s.current = t;
}, [t]), n.useEffect(() => {
a.current !== r && (s.current?.(r), a.current = r);
}, [r, a]), [r, o, s];
}
function Xp(e) {
return typeof e == "function";
}
function qp(e, t) {
return n.useReducer((r, o) => t[r][o] ?? r, e);
}
var X = (e) => {
const { present: t, children: r } = e, o = Zp(t), a = typeof r == "function" ? r({ present: o.isPresent }) : n.Children.only(r), s = $(o.ref, Qp(a));
return typeof r == "function" || o.isPresent ? n.cloneElement(a, { ref: s }) : null;
};
X.displayName = "Presence";
function Zp(e) {
const [t, r] = n.useState(), o = n.useRef(null), a = n.useRef(e), s = n.useRef("none"), i = e ? "mounted" : "unmounted", [c, l] = qp(i, {
mounted: {
UNMOUNT: "unmounted",
ANIMATION_OUT: "unmountSuspended"
},
unmountSuspended: {
MOUNT: "mounted",
ANIMATION_END: "unmounted"
},
unmounted: {
MOUNT: "mounted"
}
});
return n.useEffect(() => {
const d = nr(o.current);
s.current = c === "mounted" ? d : "none";
}, [c]), J(() => {
const d = o.current, u = a.current;
if (u !== e) {
const m = s.current, h = nr(d);
e ? l("MOUNT") : h === "none" || d?.display === "none" ? l("UNMOUNT") : l(u && m !== h ? "ANIMATION_OUT" : "UNMOUNT"), a.current = e;
}
}, [e, l]), J(() => {
if (t) {
let d;
const u = t.ownerDocument.defaultView ?? window, f = (h) => {
const v = nr(o.current).includes(CSS.escape(h.animationName));
if (h.target === t && v && (l("ANIMATION_END"), !a.current)) {
const C = t.style.animationFillMode;
t.style.animationFillMode = "forwards", d = u.setTimeout(() => {
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = C);
});
}
}, m = (h) => {
h.target === t && (s.current = nr(o.current));
};
return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", f), t.addEventListener("animationend", f), () => {
u.clearTimeout(d), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", f), t.removeEventListener("animationend", f);
};
} else
l("ANIMATION_END");
}, [t, l]), {
isPresent: ["mounted", "unmountSuspended"].includes(c),
ref: n.useCallback((d) => {
o.current = d ? getComputedStyle(d) : null, r(d);
}, [])
};
}
function nr(e) {
return e?.animationName || "none";
}
function Qp(e) {
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning;
return r ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
}
var Jp = n[" useId ".trim().toString()] || (() => {
}), em = 0;
function ie(e) {
const [t, r] = n.useState(Jp());
return J(() => {
r((o) => o ?? String(em++));
}, [e]), e || (t ? `radix-${t}` : "");
}
var Ma = n.createContext(void 0), Ia = (e) => {
const { dir: t, children: r } = e;
return /* @__PURE__ */ p(Ma.Provider, { value: t, children: r });
};
function _e(e) {
const t = n.useContext(Ma);
return e || t || "ltr";
}
var Aa = Ia;
const tm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
DirectionProvider: Ia,
Provider: Aa,
useDirection: _e
}, Symbol.toStringTag, { value: "Module" }));
function K(e) {
const t = n.useRef(e);
return n.useEffect(() => {
t.current = e;
}), n.useMemo(() => (...r) => t.current?.(...r), []);
}
function rm(e, t = globalThis?.document) {
const r = K(e);
n.useEffect(() => {
const o = (a) => {
a.key === "Escape" && r(a);
};
return t.addEventListener("keydown", o, { capture: !0 }), () => t.removeEventListener("keydown", o, { capture: !0 });
}, [r, t]);
}
var nm = "DismissableLayer", En = "dismissableLayer.update", om = "dismissableLayer.pointerDownOutside", am = "dismissableLayer.focusOutside", Zo, $a = n.createContext({
layers: /* @__PURE__ */ new Set(),
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
branches: /* @__PURE__ */ new Set()
}), ze = n.forwardRef(
(e, t) => {
const {
disableOutsidePointerEvents: r = !1,
onEscapeKeyDown: o,
onPointerDownOutside: a,
onFocusOutside: s,
onInteractOutside: i,
onDismiss: c,
...l
} = e, d = n.useContext($a), [u, f] = n.useState(null), m = u?.ownerDocument ?? globalThis?.document, [, h] = n.useState({}), g = $(t, (x) => f(x)), v = Array.from(d.layers), [C] = [...d.layersWithOutsidePointerEventsDisabled].slice(-1), y = v.indexOf(C), b = u ? v.indexOf(u) : -1, w = d.layersWithOutsidePointerEventsDisabled.size > 0, S = b >= y, R = cm((x) => {
const D = x.target, T = [...d.branches].some((O) => O.contains(D));
!S || T || (a?.(x), i?.(x), x.defaultPrevented || c?.());
}, m), _ = lm((x) => {
const D = x.target;
[...d.branches].some((O) => O.contains(D)) || (s?.(x), i?.(x), x.defaultPrevented || c?.());
}, m);
return rm((x) => {
b === d.layers.size - 1 && (o?.(x), !x.defaultPrevented && c && (x.preventDefault(), c()));
}, m), n.useEffect(() => {
if (u)
return r && (d.layersWithOutsidePointerEventsDisabled.size === 0 && (Zo = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), d.layersWithOutsidePointerEventsDisabled.add(u)), d.layers.add(u), Qo(), () => {
r && d.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = Zo);
};
}, [u, m, r, d]), n.useEffect(() => () => {
u && (d.layers.delete(u), d.layersWithOutsidePointerEventsDisabled.delete(u), Qo());
}, [u, d]), n.useEffect(() => {
const x = () => h({});
return document.addEventListener(En, x), () => document.removeEventListener(En, x);
}, []), /* @__PURE__ */ p(
P.div,
{
...l,
ref: g,
style: {
pointerEvents: w ? S ? "auto" : "none" : void 0,
...e.style
},
onFocusCapture: E(e.onFocusCapture, _.onFocusCapture),
onBlurCapture: E(e.onBlurCapture, _.onBlurCapture),
onPointerDownCapture: E(
e.onPointerDownCapture,
R.onPointerDownCapture
)
}
);
}
);
ze.displayName = nm;
var sm = "DismissableLayerBranch", im = n.forwardRef((e, t) => {
const r = n.useContext($a), o = n.useRef(null), a = $(t, o);
return n.useEffect(() => {
const s = o.current;
if (s)
return r.branches.add(s), () => {
r.branches.delete(s);
};
}, [r.branches]), /* @__PURE__ */ p(P.div, { ...e, ref: a });
});
im.displayName = sm;
function cm(e, t = globalThis?.document) {
const r = K(e), o = n.useRef(!1), a = n.useRef(() => {
});
return n.useEffect(() => {
const s = (c) => {
if (c.target && !o.current) {
let l = function() {
Da(
om,
r,
d,
{ discrete: !0 }
);
};
const d = { originalEvent: c };
c.pointerType === "touch" ? (t.removeEventListener("click", a.current), a.current = l, t.addEventListener("click", a.current, { once: !0 })) : l();
} else
t.removeEventListener("click", a.current);
o.current = !1;
}, i = window.setTimeout(() => {
t.addEventListener("pointerdown", s);
}, 0);
return () => {
window.clearTimeout(i), t.removeEventListener("pointerdown", s), t.removeEventListener("click", a.current);
};
}, [t, r]), {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: () => o.current = !0
};
}
function lm(e, t = globalThis?.document) {
const r = K(e), o = n.useRef(!1);
return n.useEffect(() => {
const a = (s) => {
s.target && !o.current && Da(am, r, { originalEvent: s }, {
discrete: !1
});
};
return t.addEventListener("focusin", a), () => t.removeEventListener("focusin", a);
}, [t, r]), {
onFocusCapture: () => o.current = !0,
onBlurCapture: () => o.current = !1
};
}
function Qo() {
const e = new CustomEvent(En);
document.dispatchEvent(e);
}
function Da(e, t, r, { discrete: o }) {
const a = r.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: r });
t && a.addEventListener(e, t, { once: !0 }), o ? kt(a, s) : a.dispatchEvent(s);
}
var sn = "focusScope.autoFocusOnMount", cn = "focusScope.autoFocusOnUnmount", Jo = { bubbles: !1, cancelable: !0 }, um = "FocusScope", Ht = n.forwardRef((e, t) => {
const {
loop: r = !1,
trapped: o = !1,
onMountAutoFocus: a,
onUnmountAutoFocus: s,
...i
} = e, [c, l] = n.useState(null), d = K(a), u = K(s), f = n.useRef(null), m = $(t, (v) => l(v)), h = n.useRef({
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}).current;
n.useEffect(() => {
if (o) {
let v = function(w) {
if (h.paused || !c) return;
const S = w.target;
c.contains(S) ? f.current = S : Fe(f.current, { select: !0 });
}, C = function(w) {
if (h.paused || !c) return;
const S = w.relatedTarget;
S !== null && (c.contains(S) || Fe(f.current, { select: !0 }));
}, y = function(w) {
if (document.activeElement === document.body)
for (const R of w)
R.removedNodes.length > 0 && Fe(c);
};
document.addEventListener("focusin", v), document.addEventListener("focusout", C);
const b = new MutationObserver(y);
return c && b.observe(c, { childList: !0, subtree: !0 }), () => {
document.removeEventListener("focusin", v), document.removeEventListener("focusout", C), b.disconnect();
};
}
}, [o, c, h.paused]), n.useEffect(() => {
if (c) {
ta.add(h);
const v = document.activeElement;
if (!c.contains(v)) {
const y = new CustomEvent(sn, Jo);
c.addEventListener(sn, d), c.dispatchEvent(y), y.defaultPrevented || (dm(hm(Oa(c)), { select: !0 }), document.activeElement === v && Fe(c));
}
return () => {
c.removeEventListener(sn, d), setTimeout(() => {
const y = new CustomEvent(cn, Jo);
c.addEventListener(cn, u), c.dispatchEvent(y), y.defaultPrevented || Fe(v ?? document.body, { select: !0 }), c.removeEventListener(cn, u), ta.remove(h);
}, 0);
};
}
}, [c, d, u, h]);
const g = n.useCallback(
(v) => {
if (!r && !o || h.paused) return;
const C = v.key === "Tab" && !v.altKey && !v.ctrlKey && !v.metaKey, y = document.activeElement;
if (C && y) {
const b = v.currentTarget, [w, S] = fm(b);
w && S ? !v.shiftKey && y === S ? (v.preventDefault(), r && Fe(w, { select: !0 })) : v.shiftKey && y === w && (v.preventDefault(), r && Fe(S, { select: !0 })) : y === b && v.preventDefault();
}
},
[r, o, h.paused]
);
return /* @__PURE__ */ p(P.div, { tabIndex: -1, ...i, ref: m, onKeyDown: g });
});
Ht.displayName = um;
function dm(e, { select: t = !1 } = {}) {
const r = document.activeElement;
for (const o of e)
if (Fe(o, { select: t }), document.activeElement !== r) return;
}
function fm(e) {
const t = Oa(e), r = ea(t, e), o = ea(t.reverse(), e);
return [r, o];
}
function Oa(e) {
const t = [], r = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
acceptNode: (o) => {
const a = o.tagName === "INPUT" && o.type === "hidden";
return o.disabled || o.hidden || a ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
for (; r.nextNode(); ) t.push(r.currentNode);
return t;
}
function ea(e, t) {
for (const r of e)
if (!pm(r, { upTo: t })) return r;
}
function pm(e, { upTo: t }) {
if (getComputedStyle(e).visibility === "hidden") return !0;
for (; e; ) {
if (t !== void 0 && e === t) return !1;
if (getComputedStyle(e).display === "none") return !0;
e = e.parentElement;
}
return !1;
}
function mm(e) {
return e instanceof HTMLInputElement && "select" in e;
}
function Fe(e, { select: t = !1 } = {}) {
if (e && e.focus) {
const r = document.activeElement;
e.focus({ preventScroll: !0 }), e !== r && mm(e) && t && e.select();
}
}
var ta = vm();
function vm() {
let e = [];
return {
add(t) {
const r = e[0];
t !== r && r?.pause(), e = ra(e, t), e.unshift(t);
},
remove(t) {
e = ra(e, t), e[0]?.resume();
}
};
}
function ra(e, t) {
const r = [...e], o = r.indexOf(t);
return o !== -1 && r.splice(o, 1), r;
}
function hm(e) {
return e.filter((t) => t.tagName !== "A");
}
var gm = "Portal", He = n.forwardRef((e, t) => {
const { container: r, ...o } = e, [a, s] = n.useState(!1);
J(() => s(!0), []);
const i = r || a && globalThis?.document?.body;
return i ? Pa.createPortal(/* @__PURE__ */ p(P.div, { ...o, ref: t }), i) : null;
});
He.displayName = gm;
var Cm = He, ln = 0;
function Tr() {
n.useEffect(() => {
const e = document.querySelectorAll("[data-radix-focus-guard]");
return document.body.insertAdjacentElement("afterbegin", e[0] ?? na()), document.body.insertAdjacentElement("beforeend", e[1] ?? na()), ln++, () => {
ln === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), ln--;
};
}, []);
}
function na() {
const e = document.createElement("span");
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
}
var ur = "right-scroll-bar-position", dr = "width-before-scroll-bar", ym = "with-scroll-bars-hidden", wm = "--removed-body-scroll-bar-size";
function un(e, t) {
return typeof e == "function" ? e(t) : e && (e.current = t), e;
}
function bm(e, t) {
var r = wp(function() {
return {
// value
value: e,
// last callback
callback: t,
// "memoized" public interface
facade: {
get current() {
return r.value;
},
set current(o) {
var a = r.value;
a !== o && (r.value = o, r.callback(o, a));
}
}
};
})[0];
return r.callback = t, r.facade;
}
var Sm = typeof window < "u" ? n.useLayoutEffect : n.useEffect, oa = /* @__PURE__ */ new WeakMap();
function Em(e, t) {
var r = bm(null, function(o) {
return e.forEach(function(a) {
return un(a, o);
});
});
return Sm(function() {
var o = oa.get(r);
if (o) {
var a = new Set(o), s = new Set(e), i = r.current;
a.forEach(function(c) {
s.has(c) || un(c, null);
}), s.forEach(function(c) {
a.has(c) || un(c, i);
});
}
oa.set(r, e);
}, [e]), r;
}
function Nm(e) {
return e;
}
function Rm(e, t) {
t === void 0 && (t = Nm);
var r = [], o = !1, a = {
read: function() {
if (o)
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
return r.length ? r[r.length - 1] : e;
},
useMedium: function(s) {
var i = t(s, o);
return r.push(i), function() {
r = r.filter(function(c) {
return c !== i;
});
};
},
assignSyncMedium: function(s) {
for (o = !0; r.length; ) {
var i = r;
r = [], i.forEach(s);
}
r = {
push: function(c) {
return s(c);
},
filter: function() {
return r;
}
};
},
assignMedium: function(s) {
o = !0;
var i = [];
if (r.length) {
var c = r;
r = [], c.forEach(s), i = r;
}
var l = function() {
var u = i;
i = [], u.forEach(s);
}, d = function() {
return Promise.resolve().then(l);
};
d(), r = {
push: function(u) {
i.push(u), d();
},
filter: function(u) {
return i = i.filter(u), r;
}
};
}
};
return a;
}
function xm(e) {
e === void 0 && (e = {});
var t = Rm(null);
return t.options = Ve({ async: !0, ssr: !1 }, e), t;
}
var ka = function(e) {
var t = e.sideCar, r = xa(e, ["sideCar"]);
if (!t)
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
var o = t.read();
if (!o)
throw new Error("Sidecar medium not found");
return n.createElement(o, Ve({}, r));
};
ka.isSideCarExport = !0;
function Pm(e, t) {
return e.useMedium(t), ka;
}
var La = xm(), dn = function() {
}, Mr = n.forwardRef(function(e, t) {
var r = n.useRef(null), o = n.useState({
onScrollCapture: dn,
onWheelCapture: dn,
onTouchMoveCapture: dn
}), a = o[0], s = o[1], i = e.forwardProps, c = e.children, l = e.className, d = e.removeScrollBar, u = e.enabled, f = e.shards, m = e.sideCar, h = e.noRelative, g = e.noIsolation, v = e.inert, C = e.allowPinchZoom, y = e.as, b = y === void 0 ? "div" : y, w = e.gapMode, S = xa(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), R = m, _ = Em([r, t]), x = Ve(Ve({}, S), a);
return n.createElement(
n.Fragment,
null,
u && n.createElement(R, { sideCar: La, removeScrollBar: d, shards: f, noRelative: h, noIsolation: g, inert: v, setCallbacks: s, allowPinchZoom: !!C, lockRef: r, gapMode: w }),
i ? n.cloneElement(n.Children.only(c), Ve(Ve({}, x), { ref: _ })) : n.createElement(b, Ve({}, x, { className: l, ref: _ }), c)
);
});
Mr.defaultProps = {
enabled: !0,
removeScrollBar: !0,
inert: !1
};
Mr.classNames = {
fullWidth: dr,
zeroRight: ur
};
var _m = function() {
if (typeof __webpack_nonce__ < "u")
return __webpack_nonce__;
};
function Tm() {
if (!document)
return null;
var e = document.createElement("style");
e.type = "text/css";
var t = _m();
return t && e.setAttribute("nonce", t), e;
}
function Mm(e, t) {
e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
}
function Im(e) {
var t = document.head || document.getElementsByTagName("head")[0];
t.appendChild(e);
}
var Am = function() {
var e = 0, t = null;
return {
add: function(r) {
e == 0 && (t = Tm()) && (Mm(t, r), Im(t)), e++;
},
remove: function() {
e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
}
};
}, $m = function() {
var e = Am();
return function(t, r) {
n.useEffect(function() {
return e.add(t), function() {
e.remove();
};
}, [t && r]);
};
}, Fa = function() {
var e = $m(), t = function(r) {
var o = r.styles, a = r.dynamic;
return e(o, a), null;
};
return t;
}, Dm = {
left: 0,
top: 0,
right: 0,
gap: 0
}, fn = function(e) {
return parseInt(e || "", 10) || 0;
}, Om = function(e) {
var t = window.getComputedStyle(document.body), r = t[e === "padding" ? "paddingLeft" : "marginLeft"], o = t[e === "padding" ? "paddingTop" : "marginTop"], a = t[e === "padding" ? "paddingRight" : "marginRight"];
return [fn(r), fn(o), fn(a)];
}, km = function(e) {
if (e === void 0 && (e = "margin"), typeof window > "u")
return Dm;
var t = Om(e), r = document.documentElement.clientWidth, o = window.innerWidth;
return {
left: t[0],
top: t[1],
right: t[2],
gap: Math.max(0, o - r + t[2] - t[0])
};
}, Lm = Fa(), ft = "data-scroll-locked", Fm = function(e, t, r, o) {
var a = e.left, s = e.top, i = e.right, c = e.gap;
return r === void 0 && (r = "margin"), `
.`.concat(ym, ` {
overflow: hidden `).concat(o, `;
padding-right: `).concat(c, "px ").concat(o, `;
}
body[`).concat(ft, `] {
overflow: hidden `).concat(o, `;
overscroll-behavior: contain;
`).concat([
t && "position: relative ".concat(o, ";"),
r === "margin" && `
padding-left: `.concat(a, `px;
padding-top: `).concat(s, `px;
padding-right: `).concat(i, `px;
margin-left:0;
margin-top:0;
margin-right: `).concat(c, "px ").concat(o, `;
`),
r === "padding" && "padding-right: ".concat(c, "px ").concat(o, ";")
].filter(Boolean).join(""), `
}
.`).concat(ur, ` {
right: `).concat(c, "px ").concat(o, `;
}
.`).concat(dr, ` {
margin-right: `).concat(c, "px ").concat(o, `;
}
.`).concat(ur, " .").concat(ur, ` {
right: 0 `).concat(o, `;
}
.`).concat(dr, " .").concat(dr, ` {
margin-right: 0 `).concat(o, `;
}
body[`).concat(ft, `] {
`).concat(wm, ": ").concat(c, `px;
}
`);
}, aa = function() {
var e = parseInt(document.body.getAttribute(ft) || "0", 10);
return isFinite(e) ? e : 0;
}, Bm = function() {
n.useEffect(function() {
return document.body.setAttribute(ft, (aa() + 1).toString()), function() {
var e = aa() - 1;
e <= 0 ? document.body.removeAttribute(ft) : document.body.setAttribute(ft, e.toString());
};
}, []);
}, Vm = function(e) {
var t = e.noRelative, r = e.noImportant, o = e.gapMode, a = o === void 0 ? "margin" : o;
Bm();
var s = n.useMemo(function() {
return km(a);
}, [a]);
return n.createElement(Lm, { styles: Fm(s, !t, a, r ? "" : "!important") });
}, Nn = !1;
if (typeof window < "u")
try {
var or = Object.defineProperty({}, "passive", {
get: function() {
return Nn = !0, !0;
}
});
window.addEventListener("test", or, or), window.removeEventListener("test", or, or);
} catch {
Nn = !1;
}
var ct = Nn ? { passive: !1 } : !1, Gm = function(e) {
return e.tagName === "TEXTAREA";
}, Ba = function(e, t) {
if (!(e instanceof Element))
return !1;
var r = window.getComputedStyle(e);
return (
// not-not-scrollable
r[t] !== "hidden" && // contains scroll inside self
!(r.overflowY === r.overflowX && !Gm(e) && r[t] === "visible")
);
}, zm = function(e) {
return Ba(e, "overflowY");
}, Hm = function(e) {
return Ba(e, "overflowX");
}, sa = function(e, t) {
var r = t.ownerDocument, o = t;
do {
typeof ShadowRoot < "u" && o instanceof ShadowRoot && (o = o.host);
var a = Va(e, o);
if (a) {
var s = Ga(e, o), i = s[1], c = s[2];
if (i > c)
return !0;
}
o = o.parentNode;
} while (o && o !== r.body);
return !1;
}, Wm = function(e) {
var t = e.scrollTop, r = e.scrollHeight, o = e.clientHeight;
return [
t,
r,
o
];
}, Km = function(e) {
var t = e.scrollLeft, r = e.scrollWidth, o = e.clientWidth;
return [
t,
r,
o
];
}, Va = function(e, t) {
return e === "v" ? zm(t) : Hm(t);
}, Ga = function(e, t) {
return e === "v" ? Wm(t) : Km(t);
}, Um = function(e, t) {
return e === "h" && t === "rtl" ? -1 : 1;
}, jm = function(e, t, r, o, a) {
var s = Um(e, window.getComputedStyle(t).direction), i = s * o, c = r.target, l = t.contains(c), d = !1, u = i > 0, f = 0, m = 0;
do {
if (!c)
break;
var h = Ga(e, c), g = h[0], v = h[1], C = h[2], y = v - C - s * g;
(g || y) && Va(e, c) && (f += y, m += g);
var b = c.parentNode;
c = b && b.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? b.host : b;
} while (
// portaled content
!l && c !== document.body || // self content
l && (t.contains(c) || t === c)
);
return (u && Math.abs(f) < 1 || !u && Math.abs(m) < 1) && (d = !0), d;
}, ar = function(e) {
return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
}, ia = function(e) {
return [e.deltaX, e.deltaY];
}, ca = function(e) {
return e && "current" in e ? e.current : e;
}, Ym = function(e, t) {
return e[0] === t[0] && e[1] === t[1];
}, Xm = function(e) {
return `
.block-interactivity-`.concat(e, ` {pointer-events: none;}
.allow-interactivity-`).concat(e, ` {pointer-events: all;}
`);
}, qm = 0, lt = [];
function Zm(e) {
var t = n.useRef([]), r = n.useRef([0, 0]), o = n.useRef(), a = n.useState(qm++)[0], s = n.useState(Fa)[0], i = n.useRef(e);
n.useEffect(function() {
i.current = e;
}, [e]), n.useEffect(function() {
if (e.inert) {
document.body.classList.add("block-interactivity-".concat(a));
var v = Sp([e.lockRef.current], (e.shards || []).map(ca), !0).filter(Boolean);
return v.forEach(function(C) {
return C.classList.add("allow-interactivity-".concat(a));
}), function() {
document.body.classList.remove("block-interactivity-".concat(a)), v.forEach(function(C) {
return C.classList.remove("allow-interactivity-".concat(a));
});
};
}
}, [e.inert, e.lockRef.current, e.shards]);
var c = n.useCallback(function(v, C) {
if ("touches" in v && v.touches.length === 2 || v.type === "wheel" && v.ctrlKey)
return !i.current.allowPinchZoom;
var y = ar(v), b = r.current, w = "deltaX" in v ? v.deltaX : b[0] - y[0], S = "deltaY" in v ? v.deltaY : b[1] - y[1], R, _ = v.target, x = Math.abs(w) > Math.abs(S) ? "h" : "v";
if ("touches" in v && x === "h" && _.type === "range")
return !1;
var D = window.getSelection(), T = D && D.anchorNode, O = T ? T === _ || T.contains(_) : !1;
if (O)
return !1;
var k = sa(x, _);
if (!k)
return !0;
if (k ? R = x : (R = x === "v" ? "h" : "v", k = sa(x, _)), !k)
return !1;
if (!o.current && "changedTouches" in v && (w || S) && (o.current = R), !R)
return !0;
var V = o.current || R;
return jm(V, C, v, V === "h" ? w : S);
}, []), l = n.useCallback(function(v) {
var C = v;
if (!(!lt.length || lt[lt.length - 1] !== s)) {
var y = "deltaY" in C ? ia(C) : ar(C), b = t.current.filter(function(R) {
return R.name === C.type && (R.target === C.target || C.target === R.shadowParent) && Ym(R.delta, y);
})[0];
if (b && b.should) {
C.cancelable && C.preventDefault();
return;
}
if (!b) {
var w = (i.current.shards || []).map(ca).filter(Boolean).filter(function(R) {
return R.contains(C.target);
}), S = w.length > 0 ? c(C, w[0]) : !i.current.noIsolation;
S && C.cancelable && C.preventDefault();
}
}
}, []), d = n.useCallback(function(v, C, y, b) {
var w = { name: v, delta: C, target: y, should: b, shadowParent: Qm(y) };
t.current.push(w), setTimeout(function() {
t.current = t.current.filter(function(S) {
return S !== w;
});
}, 1);
}, []), u = n.useCallback(function(v) {
r.current = ar(v), o.current = void 0;
}, []), f = n.useCallback(function(v) {
d(v.type, ia(v), v.target, c(v, e.lockRef.current));
}, []), m = n.useCallback(function(v) {
d(v.type, ar(v), v.target, c(v, e.lockRef.current));
}, []);
n.useEffect(function() {
return lt.push(s), e.setCallbacks({
onScrollCapture: f,
onWheelCapture: f,
onTouchMoveCapture: m
}), document.addEventListener("wheel", l, ct), document.addEventListener("touchmove", l, ct), document.addEventListener("touchstart", u, ct), function() {
lt = lt.filter(function(v) {
return v !== s;
}), document.removeEventListener("wheel", l, ct), document.removeEventListener("touchmove", l, ct), document.removeEventListener("touchstart", u, ct);
};
}, []);
var h = e.removeScrollBar, g = e.inert;
return n.createElement(
n.Fragment,
null,
g ? n.createElement(s, { styles: Xm(a) }) : null,
h ? n.createElement(Vm, { noRelative: e.noRelative, gapMode: e.gapMode }) : null
);
}
function Qm(e) {
for (var t = null; e !== null; )
e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
return t;
}
const Jm = Pm(La, Zm);
var Wt = n.forwardRef(function(e, t) {
return n.createElement(Mr, Ve({}, e, { ref: t, sideCar: Jm }));
});
Wt.classNames = Mr.classNames;
var ev = function(e) {
if (typeof document > "u")
return null;
var t = Array.isArray(e) ? e[0] : e;
return t.ownerDocument.body;
}, ut = /* @__PURE__ */ new WeakMap(), sr = /* @__PURE__ */ new WeakMap(), ir = {}, pn = 0, za = function(e) {
return e && (e.host || za(e.parentNode));
}, tv = function(e, t) {
return t.map(function(r) {
if (e.contains(r))
return r;
var o = za(r);
return o && e.contains(o) ? o : (console.error("aria-hidden", r, "in not contained inside", e, ". Doing nothing"), null);
}).filter(function(r) {
return !!r;
});
}, rv = function(e, t, r, o) {
var a = tv(t, Array.isArray(e) ? e : [e]);
ir[r] || (ir[r] = /* @__PURE__ */ new WeakMap());
var s = ir[r], i = [], c = /* @__PURE__ */ new Set(), l = new Set(a), d = function(f) {
!f || c.has(f) || (c.add(f), d(f.parentNode));
};
a.forEach(d);
var u = function(f) {
!f || l.has(f) || Array.prototype.forEach.call(f.children, function(m) {
if (c.has(m))
u(m);
else
try {
var h = m.getAttribute(o), g = h !== null && h !== "false", v = (ut.get(m) || 0) + 1, C = (s.get(m) || 0) + 1;
ut.set(m, v), s.set(m, C), i.push(m), v === 1 && g && sr.set(m, !0), C === 1 && m.setAttribute(r, "true"), g || m.setAttribute(o, "true");
} catch (y) {
console.error("aria-hidden: cannot operate on ", m, y);
}
});
};
return u(t), c.clear(), pn++, function() {
i.forEach(function(f) {
var m = ut.get(f) - 1, h = s.get(f) - 1;
ut.set(f, m), s.set(f, h), m || (sr.has(f) || f.removeAttribute(o), sr.delete(f)), h || f.removeAttribute(r);
}), pn--, pn || (ut = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), sr = /* @__PURE__ */ new WeakMap(), ir = {});
};
}, Ir = function(e, t, r) {
r === void 0 && (r = "data-aria-hidden");
var o = Array.from(Array.isArray(e) ? e : [e]), a = ev(e);
return a ? (o.push.apply(o, Array.from(a.querySelectorAll("[aria-live], script"))), rv(o, a, r, "aria-hidden")) : function() {
return null;
};
};
// @__NO_SIDE_EFFECTS__
function nv(e) {
const t = /* @__PURE__ */ ov(e), r = n.forwardRef((o, a) => {
const { children: s, ...i } = o, c = n.Children.toArray(s), l = c.find(sv);
if (l) {
const d = l.props.children, u = c.map((f) => f === l ? n.Children.count(d) > 1 ? n.Children.only(null) : n.isValidElement(d) ? d.props.children : null : f);
return /* @__PURE__ */ p(t, { ...i, ref: a, children: n.isValidElement(d) ? n.cloneElement(d, void 0, u) : null });
}
return /* @__PURE__ */ p(t, { ...i, ref: a, children: s });
});
return r.displayName = `${e}.Slot`, r;
}
// @__NO_SIDE_EFFECTS__
function ov(e) {
const t = n.forwardRef((r, o) => {
const { children: a, ...s } = r;
if (n.isValidElement(a)) {
const i = cv(a), c = iv(s, a.props);
return a.type !== n.Fragment && (c.ref = o ? he(o, i) : i), n.cloneElement(a, c);
}
return n.Children.count(a) > 1 ? n.Children.only(null) : null;
});
return t.displayName = `${e}.SlotClone`, t;
}
var av = /* @__PURE__ */ Symbol("radix.slottable");
function sv(e) {
return n.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === av;
}
function iv(e, t) {
const r = { ...t };
for (const o in t) {
const a = e[o], s = t[o];
/^on[A-Z]/.test(o) ? a && s ? r[o] = (...c) => {
const l = s(...c);
return a(...c), l;
} : a && (r[o] = a) : o === "style" ? r[o] = { ...a, ...s } : o === "className" && (r[o] = [a, s].filter(Boolean).join(" "));
}
return { ...e, ...r };
}
function cv(e) {
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning;
return r ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
}
var Ar = "Dialog", [Ha, Wa] = U(Ar), [lv, Re] = Ha(Ar), Ka = (e) => {
const {
__scopeDialog: t,
children: r,
open: o,
defaultOpen: a,
onOpenChange: s,
modal: i = !0
} = e, c = n.useRef(null), l = n.useRef(null), [d, u] = ee({
prop: o,
defaultProp: a ?? !1,
onChange: s,
caller: Ar
});
return /* @__PURE__ */ p(
lv,
{
scope: t,
triggerRef: c,
contentRef: l,
contentId: ie(),
titleId: ie(),
descriptionId: ie(),
open: d,
onOpenChange: u,
onOpenToggle: n.useCallback(() => u((f) => !f), [u]),
modal: i,
children: r
}
);
};
Ka.displayName = Ar;
var Ua = "DialogTrigger", ja = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, ...o } = e, a = Re(Ua, r), s = $(t, a.triggerRef);
return /* @__PURE__ */ p(
P.button,
{
type: "button",
"aria-haspopup": "dialog",
"aria-expanded": a.open,
"aria-controls": a.contentId,
"data-state": Xn(a.open),
...o,
ref: s,
onClick: E(e.onClick, a.onOpenToggle)
}
);
}
);
ja.displayName = Ua;
var jn = "DialogPortal", [uv, Ya] = Ha(jn, {
forceMount: void 0
}), Xa = (e) => {
const { __scopeDialog: t, forceMount: r, children: o, container: a } = e, s = Re(jn, t);
return /* @__PURE__ */ p(uv, { scope: t, forceMount: r, children: n.Children.map(o, (i) => /* @__PURE__ */ p(X, { present: r || s.open, children: /* @__PURE__ */ p(He, { asChild: !0, container: a, children: i }) })) });
};
Xa.displayName = jn;
var mr = "DialogOverlay", qa = n.forwardRef(
(e, t) => {
const r = Ya(mr, e.__scopeDialog), { forceMount: o = r.forceMount, ...a } = e, s = Re(mr, e.__scopeDialog);
return s.modal ? /* @__PURE__ */ p(X, { present: o || s.open, children: /* @__PURE__ */ p(fv, { ...a, ref: t }) }) : null;
}
);
qa.displayName = mr;
var dv = /* @__PURE__ */ nv("DialogOverlay.RemoveScroll"), fv = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, ...o } = e, a = Re(mr, r);
return (
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
// ie. when `Overlay` and `Content` are siblings
/* @__PURE__ */ p(Wt, { as: dv, allowPinchZoom: !0, shards: [a.contentRef], children: /* @__PURE__ */ p(
P.div,
{
"data-state": Xn(a.open),
...o,
ref: t,
style: { pointerEvents: "auto", ...o.style }
}
) })
);
}
), tt = "DialogContent", Za = n.forwardRef(
(e, t) => {
const r = Ya(tt, e.__scopeDialog), { forceMount: o = r.forceMount, ...a } = e, s = Re(tt, e.__scopeDialog);
return /* @__PURE__ */ p(X, { present: o || s.open, children: s.modal ? /* @__PURE__ */ p(pv, { ...a, ref: t }) : /* @__PURE__ */ p(mv, { ...a, ref: t }) });
}
);
Za.displayName = tt;
var pv = n.forwardRef(
(e, t) => {
const r = Re(tt, e.__scopeDialog), o = n.useRef(null), a = $(t, r.contentRef, o);
return n.useEffect(() => {
const s = o.current;
if (s) return Ir(s);
}, []), /* @__PURE__ */ p(
Qa,
{
...e,
ref: a,
trapFocus: r.open,
disableOutsidePointerEvents: !0,
onCloseAutoFocus: E(e.onCloseAutoFocus, (s) => {
s.preventDefault(), r.triggerRef.current?.focus();
}),
onPointerDownOutside: E(e.onPointerDownOutside, (s) => {
const i = s.detail.originalEvent, c = i.button === 0 && i.ctrlKey === !0;
(i.button === 2 || c) && s.preventDefault();
}),
onFocusOutside: E(
e.onFocusOutside,
(s) => s.preventDefault()
)
}
);
}
), mv = n.forwardRef(
(e, t) => {
const r = Re(tt, e.__scopeDialog), o = n.useRef(!1), a = n.useRef(!1);
return /* @__PURE__ */ p(
Qa,
{
...e,
ref: t,
trapFocus: !1,
disableOutsidePointerEvents: !1,
onCloseAutoFocus: (s) => {
e.onCloseAutoFocus?.(s), s.defaultPrevented || (o.current || r.triggerRef.current?.focus(), s.preventDefault()), o.current = !1, a.current = !1;
},
onInteractOutside: (s) => {
e.onInteractOutside?.(s), s.defaultPrevented || (o.current = !0, s.detail.originalEvent.type === "pointerdown" && (a.current = !0));
const i = s.target;
r.triggerRef.current?.contains(i) && s.preventDefault(), s.detail.originalEvent.type === "focusin" && a.current && s.preventDefault();
}
}
);
}
), Qa = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, trapFocus: o, onOpenAutoFocus: a, onCloseAutoFocus: s, ...i } = e, c = Re(tt, r), l = n.useRef(null), d = $(t, l);
return Tr(), /* @__PURE__ */ ce(ve, { children: [
/* @__PURE__ */ p(
Ht,
{
asChild: !0,
loop: !0,
trapped: o,
onMountAutoFocus: a,
onUnmountAutoFocus: s,
children: /* @__PURE__ */ p(
ze,
{
role: "dialog",
id: c.contentId,
"aria-describedby": c.descriptionId,
"aria-labelledby": c.titleId,
"data-state": Xn(c.open),
...i,
ref: d,
onDismiss: () => c.onOpenChange(!1)
}
)
}
),
/* @__PURE__ */ ce(ve, { children: [
/* @__PURE__ */ p(hv, { titleId: c.titleId }),
/* @__PURE__ */ p(Cv, { contentRef: l, descriptionId: c.descriptionId })
] })
] });
}
), Yn = "DialogTitle", Ja = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, ...o } = e, a = Re(Yn, r);
return /* @__PURE__ */ p(P.h2, { id: a.titleId, ...o, ref: t });
}
);
Ja.displayName = Yn;
var es = "DialogDescription", ts = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, ...o } = e, a = Re(es, r);
return /* @__PURE__ */ p(P.p, { id: a.descriptionId, ...o, ref: t });
}
);
ts.displayName = es;
var rs = "DialogClose", ns = n.forwardRef(
(e, t) => {
const { __scopeDialog: r, ...o } = e, a = Re(rs, r);
return /* @__PURE__ */ p(
P.button,
{
type: "button",
...o,
ref: t,
onClick: E(e.onClick, () => a.onOpenChange(!1))
}
);
}
);
ns.displayName = rs;
function Xn(e) {
return e ? "open" : "closed";
}
var os = "DialogTitleWarning", [vv, as] = Vp(os, {
contentName: tt,
titleName: Yn,
docsSlug: "dialog"
}), hv = ({ titleId: e }) => {
const t = as(os), r = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
return n.useEffect(() => {
e && (document.getElementById(e) || console.error(r));
}, [r, e]), null;
}, gv = "DialogDescriptionWarning", Cv = ({ contentRef: e, descriptionId: t }) => {
const o = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${as(gv).contentName}}.`;
return n.useEffect(() => {
const a = e.current?.getAttribute("aria-describedby");
t && a && (document.getElementById(t) || console.warn(o));
}, [o, e, t]), null;
}, ss = Ka, is = ja, cs = Xa, ls = qa, us = Za, ds = Ja, fs = ts, qn = ns, yv = /* @__PURE__ */ Symbol("radix.slottable");
// @__NO_SIDE_EFFECTS__
function wv(e) {
const t = ({ children: r }) => /* @__PURE__ */ p(ve, { children: r });
return t.displayName = `${e}.Slottable`, t.__radixId = yv, t;
}
var ps = "AlertDialog", [bv] = U(ps, [
Wa
]), ke = Wa(), ms = (e) => {
const { __scopeAlertDialog: t, ...r } = e, o = ke(t);
return /* @__PURE__ */ p(ss, { ...o, ...r, modal: !0 });
};
ms.displayName = ps;
var Sv = "AlertDialogTrigger", vs = n.forwardRef(
(e, t) => {
const { __scopeAlertDialog: