react-docs-ui
Version:
React documentation site UI components — navigation, sidebar, search, code highlight, MDX rendering and theming to help you build docs fast.
1,623 lines • 1.13 MB
JavaScript
import * as g from "react";
import Dn, { forwardRef as mf, createElement as ks, createContext as Mb, useState as zt, useEffect as Kn, useContext as Pb, useLayoutEffect as Fb, useCallback as Ot, useMemo as du } from "react";
import { useNavigate as fu, useLocation as Ri, Link as qn, useParams as hu, createBrowserRouter as Bb, RouterProvider as Ub, Outlet as Hb } from "react-router-dom";
import { clsx as gf } from "clsx";
import { twMerge as zb } from "tailwind-merge";
import * as Ef from "react-dom";
import $b from "react-dom";
function pu(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var ea = { exports: {} }, Xr = {};
/**
* @license React
* react-jsx-runtime.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var $l;
function jb() {
if ($l) return Xr;
$l = 1;
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
function n(r, i, a) {
var o = null;
if (a !== void 0 && (o = "" + a), i.key !== void 0 && (o = "" + i.key), "key" in i) {
a = {};
for (var s in i)
s !== "key" && (a[s] = i[s]);
} else a = i;
return i = a.ref, {
$$typeof: e,
type: r,
key: o,
ref: i !== void 0 ? i : null,
props: a
};
}
return Xr.Fragment = t, Xr.jsx = n, Xr.jsxs = n, Xr;
}
var Qr = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var jl;
function Yb() {
return jl || (jl = 1, process.env.NODE_ENV !== "production" && function() {
function e(A) {
if (A == null) return null;
if (typeof A == "function")
return A.$$typeof === k ? null : A.displayName || A.name || null;
if (typeof A == "string") return A;
switch (A) {
case b:
return "Fragment";
case _:
return "Profiler";
case T:
return "StrictMode";
case R:
return "Suspense";
case w:
return "SuspenseList";
case z:
return "Activity";
}
if (typeof A == "object")
switch (typeof A.tag == "number" && console.error(
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
), A.$$typeof) {
case E:
return "Portal";
case N:
return (A.displayName || "Context") + ".Provider";
case y:
return (A._context.displayName || "Context") + ".Consumer";
case I:
var ee = A.render;
return A = A.displayName, A || (A = ee.displayName || ee.name || "", A = A !== "" ? "ForwardRef(" + A + ")" : "ForwardRef"), A;
case L:
return ee = A.displayName || null, ee !== null ? ee : e(A.type) || "Memo";
case H:
ee = A._payload, A = A._init;
try {
return e(A(ee));
} catch {
}
}
return null;
}
function t(A) {
return "" + A;
}
function n(A) {
try {
t(A);
var ee = !1;
} catch {
ee = !0;
}
if (ee) {
ee = console;
var M = ee.error, C = typeof Symbol == "function" && Symbol.toStringTag && A[Symbol.toStringTag] || A.constructor.name || "Object";
return M.call(
ee,
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
C
), t(A);
}
}
function r(A) {
if (A === b) return "<>";
if (typeof A == "object" && A !== null && A.$$typeof === H)
return "<...>";
try {
var ee = e(A);
return ee ? "<" + ee + ">" : "<...>";
} catch {
return "<...>";
}
}
function i() {
var A = $.A;
return A === null ? null : A.getOwner();
}
function a() {
return Error("react-stack-top-frame");
}
function o(A) {
if (Y.call(A, "key")) {
var ee = Object.getOwnPropertyDescriptor(A, "key").get;
if (ee && ee.isReactWarning) return !1;
}
return A.key !== void 0;
}
function s(A, ee) {
function M() {
K || (K = !0, console.error(
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
ee
));
}
M.isReactWarning = !0, Object.defineProperty(A, "key", {
get: M,
configurable: !0
});
}
function u() {
var A = e(this.type);
return ie[A] || (ie[A] = !0, console.error(
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
)), A = this.props.ref, A !== void 0 ? A : null;
}
function l(A, ee, M, C, oe, te, se, ce) {
return M = te.ref, A = {
$$typeof: p,
type: A,
key: ee,
props: te,
_owner: oe
}, (M !== void 0 ? M : null) !== null ? Object.defineProperty(A, "ref", {
enumerable: !1,
get: u
}) : Object.defineProperty(A, "ref", { enumerable: !1, value: null }), A._store = {}, Object.defineProperty(A._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: 0
}), Object.defineProperty(A, "_debugInfo", {
configurable: !1,
enumerable: !1,
writable: !0,
value: null
}), Object.defineProperty(A, "_debugStack", {
configurable: !1,
enumerable: !1,
writable: !0,
value: se
}), Object.defineProperty(A, "_debugTask", {
configurable: !1,
enumerable: !1,
writable: !0,
value: ce
}), Object.freeze && (Object.freeze(A.props), Object.freeze(A)), A;
}
function d(A, ee, M, C, oe, te, se, ce) {
var ge = ee.children;
if (ge !== void 0)
if (C)
if (G(ge)) {
for (C = 0; C < ge.length; C++)
c(ge[C]);
Object.freeze && Object.freeze(ge);
} else
console.error(
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
);
else c(ge);
if (Y.call(ee, "key")) {
ge = e(A);
var ke = Object.keys(ee).filter(function(Rt) {
return Rt !== "key";
});
C = 0 < ke.length ? "{key: someKey, " + ke.join(": ..., ") + ": ...}" : "{key: someKey}", V[ge + C] || (ke = 0 < ke.length ? "{" + ke.join(": ..., ") + ": ...}" : "{}", console.error(
`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,
C,
ge,
ke,
ge
), V[ge + C] = !0);
}
if (ge = null, M !== void 0 && (n(M), ge = "" + M), o(ee) && (n(ee.key), ge = "" + ee.key), "key" in ee) {
M = {};
for (var $e in ee)
$e !== "key" && (M[$e] = ee[$e]);
} else M = ee;
return ge && s(
M,
typeof A == "function" ? A.displayName || A.name || "Unknown" : A
), l(
A,
ge,
te,
oe,
i(),
M,
se,
ce
);
}
function c(A) {
typeof A == "object" && A !== null && A.$$typeof === p && A._store && (A._store.validated = 1);
}
var h = Dn, p = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), N = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), R = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), L = Symbol.for("react.memo"), H = Symbol.for("react.lazy"), z = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), $ = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, G = Array.isArray, B = console.createTask ? console.createTask : function() {
return null;
};
h = {
react_stack_bottom_frame: function(A) {
return A();
}
};
var K, ie = {}, fe = h.react_stack_bottom_frame.bind(
h,
a
)(), q = B(r(a)), V = {};
Qr.Fragment = b, Qr.jsx = function(A, ee, M, C, oe) {
var te = 1e4 > $.recentlyCreatedOwnerStacks++;
return d(
A,
ee,
M,
!1,
C,
oe,
te ? Error("react-stack-top-frame") : fe,
te ? B(r(A)) : q
);
}, Qr.jsxs = function(A, ee, M, C, oe) {
var te = 1e4 > $.recentlyCreatedOwnerStacks++;
return d(
A,
ee,
M,
!0,
C,
oe,
te ? Error("react-stack-top-frame") : fe,
te ? B(r(A)) : q
);
};
}()), Qr;
}
var Yl;
function Gb() {
return Yl || (Yl = 1, process.env.NODE_ENV === "production" ? ea.exports = jb() : ea.exports = Yb()), ea.exports;
}
var m = Gb();
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Wb = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Kb = (e) => e.replace(
/^([A-Z])|[\s-_]+(\w)/g,
(t, n, r) => r ? r.toUpperCase() : n.toLowerCase()
), Gl = (e) => {
const t = Kb(e);
return t.charAt(0).toUpperCase() + t.slice(1);
}, bf = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim(), qb = (e) => {
for (const t in e)
if (t.startsWith("aria-") || t === "role" || t === "title")
return !0;
};
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
var Vb = {
xmlns: "http://www.w3.org/2000/svg",
width: 24,
height: 24,
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: 2,
strokeLinecap: "round",
strokeLinejoin: "round"
};
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Xb = mf(
({
color: e = "currentColor",
size: t = 24,
strokeWidth: n = 2,
absoluteStrokeWidth: r,
className: i = "",
children: a,
iconNode: o,
...s
}, u) => ks(
"svg",
{
ref: u,
...Vb,
width: t,
height: t,
stroke: e,
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
className: bf("lucide", i),
...!a && !qb(s) && { "aria-hidden": "true" },
...s
},
[
...o.map(([l, d]) => ks(l, d)),
...Array.isArray(a) ? a : [a]
]
)
);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Je = (e, t) => {
const n = mf(
({ className: r, ...i }, a) => ks(Xb, {
ref: a,
iconNode: t,
className: bf(
`lucide-${Wb(Gl(e))}`,
`lucide-${e}`,
r
),
...i
})
);
return n.displayName = Gl(e), n;
};
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Qb = [
["path", { d: "M12 7v14", key: "1akyts" }],
[
"path",
{
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
key: "ruj8y"
}
]
], Zb = Je("book-open", Qb);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const Jb = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], _f = Je("check", Jb);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const e1 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]], Oa = Je("chevron-right", e1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const t1 = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], Tf = Je("circle", t1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const n1 = [
[
"path",
{
d: "M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",
key: "96xj49"
}
]
], r1 = Je("flame", n1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const i1 = [
[
"path",
{
d: "M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",
key: "tonef"
}
],
["path", { d: "M9 18c-4.51 2-5-2-7-2", key: "9comsn" }]
], Af = Je("github", i1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const a1 = [
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
["path", { d: "M2 12h20", key: "9i4pu4" }]
], xf = Je("globe", a1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const o1 = [
["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7", key: "132q7q" }],
["rect", { x: "2", y: "4", width: "20", height: "16", rx: "2", key: "izxlao" }]
], s1 = Je("mail", o1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const u1 = [
[
"path",
{
d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",
key: "1sd12s"
}
]
], l1 = Je("message-circle", u1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const c1 = [
[
"path",
{
d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
key: "18887p"
}
]
], Wl = Je("message-square", c1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const d1 = [
[
"path",
{
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
key: "kfwtm"
}
]
], f1 = Je("moon", d1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const h1 = [
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
], p1 = Je("search", h1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const m1 = [
[
"path",
{
d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
key: "1ffxy3"
}
],
["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
], g1 = Je("send", m1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const E1 = [
["circle", { cx: "12", cy: "12", r: "4", key: "4exip2" }],
["path", { d: "M12 2v2", key: "tus03m" }],
["path", { d: "M12 20v2", key: "1lh1kg" }],
["path", { d: "m4.93 4.93 1.41 1.41", key: "149t6j" }],
["path", { d: "m17.66 17.66 1.41 1.41", key: "ptbguv" }],
["path", { d: "M2 12h2", key: "1t8f8n" }],
["path", { d: "M20 12h2", key: "1q8mjw" }],
["path", { d: "m6.34 17.66-1.41 1.41", key: "1m8zz5" }],
["path", { d: "m19.07 4.93-1.41 1.41", key: "1shlcs" }]
], b1 = Je("sun", E1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const _1 = [
["path", { d: "m17 2-5 5-5-5", key: "16satq" }],
["rect", { width: "20", height: "15", x: "2", y: "7", rx: "2", key: "1e6viu" }]
], T1 = Je("tv", _1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const A1 = [
[
"path",
{
d: "M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",
key: "pff0z6"
}
]
], x1 = Je("twitter", A1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const y1 = [
[
"path",
{
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
key: "ftymec"
}
],
["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
], C1 = Je("video", y1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const S1 = [
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
], N1 = Je("x", S1);
/**
* @license lucide-react v0.539.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
const D1 = [
[
"path",
{
d: "M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",
key: "1q2vi4"
}
],
["path", { d: "m10 15 5-3-5-3z", key: "1jp15x" }]
], w1 = Je("youtube", D1), v1 = {
theme: "system",
setTheme: () => null
}, yf = Mb(v1);
function k1({
children: e,
defaultTheme: t = "system",
storageKey: n = "vite-ui-theme",
...r
}) {
const [i, a] = zt(
() => localStorage.getItem(n) || t
);
Kn(() => {
const s = window.document.documentElement;
if (s.classList.remove("light", "dark"), i === "system") {
const u = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
s.classList.add(u);
return;
}
s.classList.add(i);
}, [i]);
const o = {
theme: i,
setTheme: (s) => {
localStorage.setItem(n, s), a(s);
}
};
return /* @__PURE__ */ m.jsx(yf.Provider, { ...r, value: o, children: e });
}
const no = () => {
const e = Pb(yf);
if (e === void 0)
throw new Error("useTheme must be used within a ThemeProvider");
return e;
};
function Kl(e, t) {
if (typeof e == "function")
return e(t);
e != null && (e.current = t);
}
function En(...e) {
return (t) => {
let n = !1;
const r = e.map((i) => {
const a = Kl(i, t);
return !n && typeof a == "function" && (n = !0), a;
});
if (n)
return () => {
for (let i = 0; i < r.length; i++) {
const a = r[i];
typeof a == "function" ? a() : Kl(e[i], null);
}
};
};
}
function ze(...e) {
return g.useCallback(En(...e), e);
}
// @__NO_SIDE_EFFECTS__
function Ir(e) {
const t = /* @__PURE__ */ R1(e), n = g.forwardRef((r, i) => {
const { children: a, ...o } = r, s = g.Children.toArray(a), u = s.find(L1);
if (u) {
const l = u.props.children, d = s.map((c) => c === u ? g.Children.count(l) > 1 ? g.Children.only(null) : g.isValidElement(l) ? l.props.children : null : c);
return /* @__PURE__ */ m.jsx(t, { ...o, ref: i, children: g.isValidElement(l) ? g.cloneElement(l, void 0, d) : null });
}
return /* @__PURE__ */ m.jsx(t, { ...o, ref: i, children: a });
});
return n.displayName = `${e}.Slot`, n;
}
var I1 = /* @__PURE__ */ Ir("Slot");
// @__NO_SIDE_EFFECTS__
function R1(e) {
const t = g.forwardRef((n, r) => {
const { children: i, ...a } = n;
if (g.isValidElement(i)) {
const o = P1(i), s = M1(a, i.props);
return i.type !== g.Fragment && (s.ref = r ? En(r, o) : o), g.cloneElement(i, s);
}
return g.Children.count(i) > 1 ? g.Children.only(null) : null;
});
return t.displayName = `${e}.SlotClone`, t;
}
var Cf = Symbol("radix.slottable");
// @__NO_SIDE_EFFECTS__
function O1(e) {
const t = ({ children: n }) => /* @__PURE__ */ m.jsx(m.Fragment, { children: n });
return t.displayName = `${e}.Slottable`, t.__radixId = Cf, t;
}
function L1(e) {
return g.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Cf;
}
function M1(e, t) {
const n = { ...t };
for (const r in t) {
const i = e[r], a = t[r];
/^on[A-Z]/.test(r) ? i && a ? n[r] = (...s) => {
const u = a(...s);
return i(...s), u;
} : i && (n[r] = i) : r === "style" ? n[r] = { ...i, ...a } : r === "className" && (n[r] = [i, a].filter(Boolean).join(" "));
}
return { ...e, ...n };
}
function P1(e) {
let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
}
const ql = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Vl = gf, F1 = (e, t) => (n) => {
var r;
if (t?.variants == null) return Vl(e, n?.class, n?.className);
const { variants: i, defaultVariants: a } = t, o = Object.keys(i).map((l) => {
const d = n?.[l], c = a?.[l];
if (d === null) return null;
const h = ql(d) || ql(c);
return i[l][h];
}), s = n && Object.entries(n).reduce((l, d) => {
let [c, h] = d;
return h === void 0 || (l[c] = h), l;
}, {}), u = t == null || (r = t.compoundVariants) === null || r === void 0 ? void 0 : r.reduce((l, d) => {
let { class: c, className: h, ...p } = d;
return Object.entries(p).every((E) => {
let [b, T] = E;
return Array.isArray(T) ? T.includes({
...a,
...s
}[b]) : {
...a,
...s
}[b] === T;
}) ? [
...l,
c,
h
] : l;
}, []);
return Vl(e, o, u, n?.class, n?.className);
};
function _e(...e) {
return zb(gf(e));
}
const mu = F1(
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
{
variants: {
variant: {
default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost: "hover:bg-accent hover:text-accent-foreground",
link: "text-primary underline-offset-4 hover:underline"
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
lg: "h-11 rounded-md px-8",
icon: "h-10 w-10"
}
},
defaultVariants: {
variant: "default",
size: "default"
}
}
), gu = g.forwardRef(
({ className: e, variant: t, size: n, asChild: r = !1, ...i }, a) => {
const o = r ? I1 : "button";
return /* @__PURE__ */ m.jsx(
o,
{
className: _e(mu({ variant: t, size: n, className: e })),
ref: a,
...i
}
);
}
);
gu.displayName = "Button";
function le(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
return function(i) {
if (e?.(i), n === !1 || !i.defaultPrevented)
return t?.(i);
};
}
function B1(e, t) {
const n = g.createContext(t), r = (a) => {
const { children: o, ...s } = a, u = g.useMemo(() => s, Object.values(s));
return /* @__PURE__ */ m.jsx(n.Provider, { value: u, children: o });
};
r.displayName = e + "Provider";
function i(a) {
const o = g.useContext(n);
if (o) return o;
if (t !== void 0) return t;
throw new Error(`\`${a}\` must be used within \`${e}\``);
}
return [r, i];
}
function on(e, t = []) {
let n = [];
function r(a, o) {
const s = g.createContext(o), u = n.length;
n = [...n, o];
const l = (c) => {
const { scope: h, children: p, ...E } = c, b = h?.[e]?.[u] || s, T = g.useMemo(() => E, Object.values(E));
return /* @__PURE__ */ m.jsx(b.Provider, { value: T, children: p });
};
l.displayName = a + "Provider";
function d(c, h) {
const p = h?.[e]?.[u] || s, E = g.useContext(p);
if (E) return E;
if (o !== void 0) return o;
throw new Error(`\`${c}\` must be used within \`${a}\``);
}
return [l, d];
}
const i = () => {
const a = n.map((o) => g.createContext(o));
return function(s) {
const u = s?.[e] || a;
return g.useMemo(
() => ({ [`__scope${e}`]: { ...s, [e]: u } }),
[s, u]
);
};
};
return i.scopeName = e, [r, U1(i, ...t)];
}
function U1(...e) {
const t = e[0];
if (e.length === 1) return t;
const n = () => {
const r = e.map((i) => ({
useScope: i(),
scopeName: i.scopeName
}));
return function(a) {
const o = r.reduce((s, { useScope: u, scopeName: l }) => {
const c = u(a)[`__scope${l}`];
return { ...s, ...c };
}, {});
return g.useMemo(() => ({ [`__scope${t.scopeName}`]: o }), [o]);
};
};
return n.scopeName = t.scopeName, n;
}
var rn = globalThis?.document ? g.useLayoutEffect : () => {
}, H1 = g[" useInsertionEffect ".trim().toString()] || rn;
function er({
prop: e,
defaultProp: t,
onChange: n = () => {
},
caller: r
}) {
const [i, a, o] = z1({
defaultProp: t,
onChange: n
}), s = e !== void 0, u = s ? e : i;
{
const d = g.useRef(e !== void 0);
g.useEffect(() => {
const c = d.current;
c !== s && console.warn(
`${r} is changing from ${c ? "controlled" : "uncontrolled"} to ${s ? "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.`
), d.current = s;
}, [s, r]);
}
const l = g.useCallback(
(d) => {
if (s) {
const c = $1(d) ? d(e) : d;
c !== e && o.current?.(c);
} else
a(d);
},
[s, e, a, o]
);
return [u, l];
}
function z1({
defaultProp: e,
onChange: t
}) {
const [n, r] = g.useState(e), i = g.useRef(n), a = g.useRef(t);
return H1(() => {
a.current = t;
}, [t]), g.useEffect(() => {
i.current !== n && (a.current?.(n), i.current = n);
}, [n, i]), [n, r, a];
}
function $1(e) {
return typeof e == "function";
}
var j1 = [
"a",
"button",
"div",
"form",
"h2",
"h3",
"img",
"input",
"label",
"li",
"nav",
"ol",
"p",
"select",
"span",
"svg",
"ul"
], Se = j1.reduce((e, t) => {
const n = /* @__PURE__ */ Ir(`Primitive.${t}`), r = g.forwardRef((i, a) => {
const { asChild: o, ...s } = i, u = o ? n : t;
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m.jsx(u, { ...s, ref: a });
});
return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
}, {});
function Sf(e, t) {
e && Ef.flushSync(() => e.dispatchEvent(t));
}
function Nf(e) {
const t = e + "CollectionProvider", [n, r] = on(t), [i, a] = n(
t,
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
), o = (b) => {
const { scope: T, children: _ } = b, y = Dn.useRef(null), N = Dn.useRef(/* @__PURE__ */ new Map()).current;
return /* @__PURE__ */ m.jsx(i, { scope: T, itemMap: N, collectionRef: y, children: _ });
};
o.displayName = t;
const s = e + "CollectionSlot", u = /* @__PURE__ */ Ir(s), l = Dn.forwardRef(
(b, T) => {
const { scope: _, children: y } = b, N = a(s, _), I = ze(T, N.collectionRef);
return /* @__PURE__ */ m.jsx(u, { ref: I, children: y });
}
);
l.displayName = s;
const d = e + "CollectionItemSlot", c = "data-radix-collection-item", h = /* @__PURE__ */ Ir(d), p = Dn.forwardRef(
(b, T) => {
const { scope: _, children: y, ...N } = b, I = Dn.useRef(null), R = ze(T, I), w = a(d, _);
return Dn.useEffect(() => (w.itemMap.set(I, { ref: I, ...N }), () => void w.itemMap.delete(I))), /* @__PURE__ */ m.jsx(h, { [c]: "", ref: R, children: y });
}
);
p.displayName = d;
function E(b) {
const T = a(e + "CollectionConsumer", b);
return Dn.useCallback(() => {
const y = T.collectionRef.current;
if (!y) return [];
const N = Array.from(y.querySelectorAll(`[${c}]`));
return Array.from(T.itemMap.values()).sort(
(w, L) => N.indexOf(w.ref.current) - N.indexOf(L.ref.current)
);
}, [T.collectionRef, T.itemMap]);
}
return [
{ Provider: o, Slot: l, ItemSlot: p },
E,
r
];
}
var Y1 = g.createContext(void 0);
function Eu(e) {
const t = g.useContext(Y1);
return e || t || "ltr";
}
function nt(e) {
const t = g.useRef(e);
return g.useEffect(() => {
t.current = e;
}), g.useMemo(() => (...n) => t.current?.(...n), []);
}
function G1(e, t = globalThis?.document) {
const n = nt(e);
g.useEffect(() => {
const r = (i) => {
i.key === "Escape" && n(i);
};
return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
}, [n, t]);
}
var W1 = "DismissableLayer", Is = "dismissableLayer.update", K1 = "dismissableLayer.pointerDownOutside", q1 = "dismissableLayer.focusOutside", Xl, Df = g.createContext({
layers: /* @__PURE__ */ new Set(),
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
branches: /* @__PURE__ */ new Set()
}), ro = g.forwardRef(
(e, t) => {
const {
disableOutsidePointerEvents: n = !1,
onEscapeKeyDown: r,
onPointerDownOutside: i,
onFocusOutside: a,
onInteractOutside: o,
onDismiss: s,
...u
} = e, l = g.useContext(Df), [d, c] = g.useState(null), h = d?.ownerDocument ?? globalThis?.document, [, p] = g.useState({}), E = ze(t, (L) => c(L)), b = Array.from(l.layers), [T] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), _ = b.indexOf(T), y = d ? b.indexOf(d) : -1, N = l.layersWithOutsidePointerEventsDisabled.size > 0, I = y >= _, R = Q1((L) => {
const H = L.target, z = [...l.branches].some((k) => k.contains(H));
!I || z || (i?.(L), o?.(L), L.defaultPrevented || s?.());
}, h), w = Z1((L) => {
const H = L.target;
[...l.branches].some((k) => k.contains(H)) || (a?.(L), o?.(L), L.defaultPrevented || s?.());
}, h);
return G1((L) => {
y === l.layers.size - 1 && (r?.(L), !L.defaultPrevented && s && (L.preventDefault(), s()));
}, h), g.useEffect(() => {
if (d)
return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Xl = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(d)), l.layers.add(d), Ql(), () => {
n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = Xl);
};
}, [d, h, n, l]), g.useEffect(() => () => {
d && (l.layers.delete(d), l.layersWithOutsidePointerEventsDisabled.delete(d), Ql());
}, [d, l]), g.useEffect(() => {
const L = () => p({});
return document.addEventListener(Is, L), () => document.removeEventListener(Is, L);
}, []), /* @__PURE__ */ m.jsx(
Se.div,
{
...u,
ref: E,
style: {
pointerEvents: N ? I ? "auto" : "none" : void 0,
...e.style
},
onFocusCapture: le(e.onFocusCapture, w.onFocusCapture),
onBlurCapture: le(e.onBlurCapture, w.onBlurCapture),
onPointerDownCapture: le(
e.onPointerDownCapture,
R.onPointerDownCapture
)
}
);
}
);
ro.displayName = W1;
var V1 = "DismissableLayerBranch", X1 = g.forwardRef((e, t) => {
const n = g.useContext(Df), r = g.useRef(null), i = ze(t, r);
return g.useEffect(() => {
const a = r.current;
if (a)
return n.branches.add(a), () => {
n.branches.delete(a);
};
}, [n.branches]), /* @__PURE__ */ m.jsx(Se.div, { ...e, ref: i });
});
X1.displayName = V1;
function Q1(e, t = globalThis?.document) {
const n = nt(e), r = g.useRef(!1), i = g.useRef(() => {
});
return g.useEffect(() => {
const a = (s) => {
if (s.target && !r.current) {
let u = function() {
wf(
K1,
n,
l,
{ discrete: !0 }
);
};
const l = { originalEvent: s };
s.pointerType === "touch" ? (t.removeEventListener("click", i.current), i.current = u, t.addEventListener("click", i.current, { once: !0 })) : u();
} else
t.removeEventListener("click", i.current);
r.current = !1;
}, o = window.setTimeout(() => {
t.addEventListener("pointerdown", a);
}, 0);
return () => {
window.clearTimeout(o), t.removeEventListener("pointerdown", a), t.removeEventListener("click", i.current);
};
}, [t, n]), {
// ensures we check React component tree (not just DOM tree)
onPointerDownCapture: () => r.current = !0
};
}
function Z1(e, t = globalThis?.document) {
const n = nt(e), r = g.useRef(!1);
return g.useEffect(() => {
const i = (a) => {
a.target && !r.current && wf(q1, n, { originalEvent: a }, {
discrete: !1
});
};
return t.addEventListener("focusin", i), () => t.removeEventListener("focusin", i);
}, [t, n]), {
onFocusCapture: () => r.current = !0,
onBlurCapture: () => r.current = !1
};
}
function Ql() {
const e = new CustomEvent(Is);
document.dispatchEvent(e);
}
function wf(e, t, n, { discrete: r }) {
const i = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
t && i.addEventListener(e, t, { once: !0 }), r ? Sf(i, a) : i.dispatchEvent(a);
}
var Ho = 0;
function vf() {
g.useEffect(() => {
const e = document.querySelectorAll("[data-radix-focus-guard]");
return document.body.insertAdjacentElement("afterbegin", e[0] ?? Zl()), document.body.insertAdjacentElement("beforeend", e[1] ?? Zl()), Ho++, () => {
Ho === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Ho--;
};
}, []);
}
function Zl() {
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 zo = "focusScope.autoFocusOnMount", $o = "focusScope.autoFocusOnUnmount", Jl = { bubbles: !1, cancelable: !0 }, J1 = "FocusScope", bu = g.forwardRef((e, t) => {
const {
loop: n = !1,
trapped: r = !1,
onMountAutoFocus: i,
onUnmountAutoFocus: a,
...o
} = e, [s, u] = g.useState(null), l = nt(i), d = nt(a), c = g.useRef(null), h = ze(t, (b) => u(b)), p = g.useRef({
paused: !1,
pause() {
this.paused = !0;
},
resume() {
this.paused = !1;
}
}).current;
g.useEffect(() => {
if (r) {
let b = function(N) {
if (p.paused || !s) return;
const I = N.target;
s.contains(I) ? c.current = I : wn(c.current, { select: !0 });
}, T = function(N) {
if (p.paused || !s) return;
const I = N.relatedTarget;
I !== null && (s.contains(I) || wn(c.current, { select: !0 }));
}, _ = function(N) {
if (document.activeElement === document.body)
for (const R of N)
R.removedNodes.length > 0 && wn(s);
};
document.addEventListener("focusin", b), document.addEventListener("focusout", T);
const y = new MutationObserver(_);
return s && y.observe(s, { childList: !0, subtree: !0 }), () => {
document.removeEventListener("focusin", b), document.removeEventListener("focusout", T), y.disconnect();
};
}
}, [r, s, p.paused]), g.useEffect(() => {
if (s) {
tc.add(p);
const b = document.activeElement;
if (!s.contains(b)) {
const _ = new CustomEvent(zo, Jl);
s.addEventListener(zo, l), s.dispatchEvent(_), _.defaultPrevented || (e_(a_(kf(s)), { select: !0 }), document.activeElement === b && wn(s));
}
return () => {
s.removeEventListener(zo, l), setTimeout(() => {
const _ = new CustomEvent($o, Jl);
s.addEventListener($o, d), s.dispatchEvent(_), _.defaultPrevented || wn(b ?? document.body, { select: !0 }), s.removeEventListener($o, d), tc.remove(p);
}, 0);
};
}
}, [s, l, d, p]);
const E = g.useCallback(
(b) => {
if (!n && !r || p.paused) return;
const T = b.key === "Tab" && !b.altKey && !b.ctrlKey && !b.metaKey, _ = document.activeElement;
if (T && _) {
const y = b.currentTarget, [N, I] = t_(y);
N && I ? !b.shiftKey && _ === I ? (b.preventDefault(), n && wn(N, { select: !0 })) : b.shiftKey && _ === N && (b.preventDefault(), n && wn(I, { select: !0 })) : _ === y && b.preventDefault();
}
},
[n, r, p.paused]
);
return /* @__PURE__ */ m.jsx(Se.div, { tabIndex: -1, ...o, ref: h, onKeyDown: E });
});
bu.displayName = J1;
function e_(e, { select: t = !1 } = {}) {
const n = document.activeElement;
for (const r of e)
if (wn(r, { select: t }), document.activeElement !== n) return;
}
function t_(e) {
const t = kf(e), n = ec(t, e), r = ec(t.reverse(), e);
return [n, r];
}
function kf(e) {
const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
acceptNode: (r) => {
const i = r.tagName === "INPUT" && r.type === "hidden";
return r.disabled || r.hidden || i ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
}
});
for (; n.nextNode(); ) t.push(n.currentNode);
return t;
}
function ec(e, t) {
for (const n of e)
if (!n_(n, { upTo: t })) return n;
}
function n_(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 r_(e) {
return e instanceof HTMLInputElement && "select" in e;
}
function wn(e, { select: t = !1 } = {}) {
if (e && e.focus) {
const n = document.activeElement;
e.focus({ preventScroll: !0 }), e !== n && r_(e) && t && e.select();
}
}
var tc = i_();
function i_() {
let e = [];
return {
add(t) {
const n = e[0];
t !== n && n?.pause(), e = nc(e, t), e.unshift(t);
},
remove(t) {
e = nc(e, t), e[0]?.resume();
}
};
}
function nc(e, t) {
const n = [...e], r = n.indexOf(t);
return r !== -1 && n.splice(r, 1), n;
}
function a_(e) {
return e.filter((t) => t.tagName !== "A");
}
var o_ = g[" useId ".trim().toString()] || (() => {
}), s_ = 0;
function lt(e) {
const [t, n] = g.useState(o_());
return rn(() => {
n((r) => r ?? String(s_++));
}, [e]), t ? `radix-${t}` : "";
}
const u_ = ["top", "right", "bottom", "left"], On = Math.min, vt = Math.max, La = Math.round, ta = Math.floor, tn = (e) => ({
x: e,
y: e
}), l_ = {
left: "right",
right: "left",
bottom: "top",
top: "bottom"
}, c_ = {
start: "end",
end: "start"
};
function Rs(e, t, n) {
return vt(e, On(t, n));
}
function bn(e, t) {
return typeof e == "function" ? e(t) : e;
}
function _n(e) {
return e.split("-")[0];
}
function Br(e) {
return e.split("-")[1];
}
function _u(e) {
return e === "x" ? "y" : "x";
}
function Tu(e) {
return e === "y" ? "height" : "width";
}
const d_ = /* @__PURE__ */ new Set(["top", "bottom"]);
function en(e) {
return d_.has(_n(e)) ? "y" : "x";
}
function Au(e) {
return _u(en(e));
}
function f_(e, t, n) {
n === void 0 && (n = !1);
const r = Br(e), i = Au(e), a = Tu(i);
let o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
return t.reference[a] > t.floating[a] && (o = Ma(o)), [o, Ma(o)];
}
function h_(e) {
const t = Ma(e);
return [Os(e), t, Os(t)];
}
function Os(e) {
return e.replace(/start|end/g, (t) => c_[t]);
}
const rc = ["left", "right"], ic = ["right", "left"], p_ = ["top", "bottom"], m_ = ["bottom", "top"];
function g_(e, t, n) {
switch (e) {
case "top":
case "bottom":
return n ? t ? ic : rc : t ? rc : ic;
case "left":
case "right":
return t ? p_ : m_;
default:
return [];
}
}
function E_(e, t, n, r) {
const i = Br(e);
let a = g_(_n(e), n === "start", r);
return i && (a = a.map((o) => o + "-" + i), t && (a = a.concat(a.map(Os)))), a;
}
function Ma(e) {
return e.replace(/left|right|bottom|top/g, (t) => l_[t]);
}
function b_(e) {
return {
top: 0,
right: 0,
bottom: 0,
left: 0,
...e
};
}
function If(e) {
return typeof e != "number" ? b_(e) : {
top: e,
right: e,
bottom: e,
left: e
};
}
function Pa(e) {
const {
x: t,
y: n,
width: r,
height: i
} = e;
return {
width: r,
height: i,
top: n,
left: t,
right: t + r,
bottom: n + i,
x: t,
y: n
};
}
function ac(e, t, n) {
let {
reference: r,
floating: i
} = e;
const a = en(t), o = Au(t), s = Tu(o), u = _n(t), l = a === "y", d = r.x + r.width / 2 - i.width / 2, c = r.y + r.height / 2 - i.height / 2, h = r[s] / 2 - i[s] / 2;
let p;
switch (u) {
case "top":
p = {
x: d,
y: r.y - i.height
};
break;
case "bottom":
p = {
x: d,
y: r.y + r.height
};
break;
case "right":
p = {
x: r.x + r.width,
y: c
};
break;
case "left":
p = {
x: r.x - i.width,
y: c
};
break;
default:
p = {
x: r.x,
y: r.y
};
}
switch (Br(t)) {
case "start":
p[o] -= h * (n && l ? -1 : 1);
break;
case "end":
p[o] += h * (n && l ? -1 : 1);
break;
}
return p;
}
const __ = async (e, t, n) => {
const {
placement: r = "bottom",
strategy: i = "absolute",
middleware: a = [],
platform: o
} = n, s = a.filter(Boolean), u = await (o.isRTL == null ? void 0 : o.isRTL(t));
let l = await o.getElementRects({
reference: e,
floating: t,
strategy: i
}), {
x: d,
y: c
} = ac(l, r, u), h = r, p = {}, E = 0;
for (let b = 0; b < s.length; b++) {
const {
name: T,
fn: _
} = s[b], {
x: y,
y: N,
data: I,
reset: R
} = await _({
x: d,
y: c,
initialPlacement: r,
placement: h,
strategy: i,
middlewareData: p,
rects: l,
platform: o,
elements: {
reference: e,
floating: t
}
});
d = y ?? d, c = N ?? c, p = {
...p,
[T]: {
...p[T],
...I
}
}, R && E <= 50 && (E++, typeof R == "object" && (R.placement && (h = R.placement), R.rects && (l = R.rects === !0 ? await o.getElementRects({
reference: e,
floating: t,
strategy: i
}) : R.rects), {
x: d,
y: c
} = ac(l, h, u)), b = -1);
}
return {
x: d,
y: c,
placement: h,
strategy: i,
middlewareData: p
};
};
async function _i(e, t) {
var n;
t === void 0 && (t = {});
const {
x: r,
y: i,
platform: a,
rects: o,
elements: s,
strategy: u
} = e, {
boundary: l = "clippingAncestors",
rootBoundary: d = "viewport",
elementContext: c = "floating",
altBoundary: h = !1,
padding: p = 0
} = bn(t, e), E = If(p), T = s[h ? c === "floating" ? "reference" : "floating" : c], _ = Pa(await a.getClippingRect({
element: (n = await (a.isElement == null ? void 0 : a.isElement(T))) == null || n ? T : T.contextElement || await (a.getDocumentElement == null ? void 0 : a.getDocumentElement(s.floating)),
boundary: l,
rootBoundary: d,
strategy: u
})), y = c === "floating" ? {
x: r,
y: i,
width: o.floating.width,
height: o.floating.height
} : o.reference, N = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(s.floating)), I = await (a.isElement == null ? void 0 : a.isElement(N)) ? await (a.getScale == null ? void 0 : a.getScale(N)) || {
x: 1,
y: 1
} : {
x: 1,
y: 1
}, R = Pa(a.convertOffsetParentRelativeRectToViewportRelativeRect ? await a.convertOffsetParentRelativeRectToViewportRelativeRect({
elements: s,
rect: y,
offsetParent: N,
strategy: u
}) : y);
return {
top: (_.top - R.top + E.top) / I.y,
bottom: (R.bottom - _.bottom + E.bottom) / I.y,
left: (_.left - R.left + E.left) / I.x,
right: (R.right - _.right + E.right) / I.x
};
}
const T_ = (e) => ({
name: "arrow",
options: e,
async fn(t) {
const {
x: n,
y: r,
placement: i,
rects: a,
platform: o,
elements: s,
middlewareData: u
} = t, {
element: l,
padding: d = 0
} = bn(e, t) || {};
if (l == null)
return {};
const c = If(d), h = {
x: n,
y: r
}, p = Au(i), E = Tu(p), b = await o.getDimensions(l), T = p === "y", _ = T ? "top" : "left", y = T ? "bottom" : "right", N = T ? "clientHeight" : "clientWidth", I = a.reference[E] + a.reference[p] - h[p] - a.floating[E], R = h[p] - a.reference[p], w = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l));
let L = w ? w[N] : 0;
(!L || !await (o.isElement == null ? void 0 : o.isElement(w))) && (L = s.floating[N] || a.floating[E]);
const H = I / 2 - R / 2, z = L / 2 - b[E] / 2 - 1, k = On(c[_], z), $ = On(c[y], z), Y = k, G = L - b[E] - $, B = L / 2 - b[E] / 2 + H, K = Rs(Y, B, G), ie = !u.arrow && Br(i) != null && B !== K && a.reference[E] / 2 - (B < Y ? k : $) - b[E] / 2 < 0, fe = ie ? B < Y ? B - Y : B - G : 0;
return {
[p]: h[p] + fe,
data: {
[p]: K,
centerOffset: B - K - fe,
...ie && {
alignmentOffset: fe
}
},
reset: ie
};
}
}), A_ = function(e) {
return e === void 0 && (e = {}), {
name: "flip",
options: e,
async fn(t) {
var n, r;
const {
placement: i,
middlewareData: a,
rects: o,
initialPlacement: s,
platform: u,
elements: l
} = t, {
mainAxis: d = !0,
crossAxis: c = !0,
fallbackPlacements: h,
fallbackStrategy: p = "bestFit",
fallbackAxisSideDirection: E = "none",
flipAlignment: b = !0,
...T
} = bn(e, t);
if ((n = a.arrow) != null && n.alignmentOffset)
return {};
const _ = _n(i), y = en(s), N = _n(s) === s, I = await (u.isRTL == null ? void 0 : u.isRTL(l.floating)), R = h || (N || !b ? [Ma(s)] : h_(s)), w = E !== "none";
!h && w && R.push(...E_(s, b, E, I));
const L = [s, ...R], H = await _i(t, T), z = [];
let k = ((r = a.flip) == null ? void 0 : r.overflows) || [];
if (d && z.push(H[_]), c) {
const B = f_(i, o, I);
z.push(H[B[0]], H[B[1]]);
}
if (k = [...k, {
placement: i,
overflows: z
}], !z.every((B) => B <= 0)) {
var $, Y;
const B = ((($ = a.flip) == null ? void 0 : $.index) || 0) + 1, K = L[B];
if (K && (!(c === "alignment" ? y !== en(K) : !1) || // We leave the current main axis only if every placement on that axis
// overflows the main axis.
k.every((q) => en(q.placement) === y ? q.overflows[0] > 0 : !0)))
return {
data: {
index: B,
overflows: k
},
reset: {
placement: K
}
};
let ie = (Y = k.filter((fe) => fe.overflows[0] <= 0).sort((fe, q) => fe.overflows[1] - q.overflows[1])[0]) == null ? void 0 : Y.placement;
if (!ie)
switch (p) {
c