"use client";
import * as e from "react";
import { createElement as t } from "react";
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/useRefWithInit.js
var n = {};
function r(t, r) {
	let i = e.useRef(n);
	return i.current === n && (i.current = t(r)), i;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/warn.js
var i;
process.env.NODE_ENV !== "production" && (i = /* @__PURE__ */ new Set());
function a(...e) {
	if (process.env.NODE_ENV !== "production") {
		let t = e.join(" ");
		i.has(t) || (i.add(t), console.warn(`Base UI: ${t}`));
	}
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/formatErrorMessage.js
function o(e, t) {
	return function(n, ...r) {
		let i = new URL(e);
		return i.searchParams.set("code", n.toString()), r.forEach((e) => i.searchParams.append("args[]", e)), `${t} error #${n}; visit ${i} for the full message.`;
	};
}
var s = o("https://base-ui.com/production-error", "Base UI");
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/useMergedRefs.js
function c(e, t, n, i) {
	let a = r(u).current;
	return d(a, e, t, n, i) && p(a, [
		e,
		t,
		n,
		i
	]), a.callback;
}
function l(e) {
	let t = r(u).current;
	return f(t, e) && p(t, e), t.callback;
}
function u() {
	return {
		callback: null,
		cleanup: null,
		refs: []
	};
}
function d(e, t, n, r, i) {
	return e.refs[0] !== t || e.refs[1] !== n || e.refs[2] !== r || e.refs[3] !== i;
}
function f(e, t) {
	return e.refs.length !== t.length || e.refs.some((e, n) => e !== t[n]);
}
function p(e, t) {
	if (e.refs = t, t.every((e) => e == null)) {
		e.callback = null;
		return;
	}
	e.callback = (n) => {
		if (e.cleanup &&= (e.cleanup(), null), n != null) {
			let r = Array(t.length).fill(null);
			for (let e = 0; e < t.length; e += 1) {
				let i = t[e];
				if (i != null) switch (typeof i) {
					case "function": {
						let t = i(n);
						typeof t == "function" && (r[e] = t);
						break;
					}
					case "object":
						i.current = n;
						break;
					default:
				}
			}
			e.cleanup = () => {
				for (let e = 0; e < t.length; e += 1) {
					let n = t[e];
					if (n != null) switch (typeof n) {
						case "function": {
							let t = r[e];
							typeof t == "function" ? t() : n(null);
							break;
						}
						case "object":
							n.current = null;
							break;
						default:
					}
				}
			};
		}
	};
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/reactVersion.js
var m = parseInt(e.version, 10);
function h(e) {
	return m >= e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/getReactElementRef.js
function g(t) {
	if (!/*#__PURE__*/ e.isValidElement(t)) return null;
	let n = t, r = n.props;
	return (h(19) ? r?.ref : n.ref) ?? null;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/mergeObjects.js
function _(e, t) {
	if (e && !t) return e;
	if (!e && t) return t;
	if (e || t) return {
		...e,
		...t
	};
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+utils@0.2.9+f7941a290aa3d619/node_modules/@base-ui/utils/esm/empty.js
function v() {}
var y = Object.freeze([]), b = Object.freeze({});
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js
function x(e, t) {
	let n = {};
	for (let r in e) {
		let i = e[r];
		if (t?.hasOwnProperty(r)) {
			let e = t[r](i);
			e != null && Object.assign(n, e);
			continue;
		}
		i === !0 ? n[`data-${r.toLowerCase()}`] = "" : i && (n[`data-${r.toLowerCase()}`] = i.toString());
	}
	return n;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/resolveClassName.js
function S(e, t) {
	return typeof e == "function" ? e(t) : e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/utils/resolveStyle.js
function C(e, t) {
	return typeof e == "function" ? e(t) : e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/merge-props/mergeProps.js
var w = {};
function T(e, t, n, r, i) {
	if (!n && !r && !i && !e) return D(t);
	let a = D(e);
	return t && (a = O(a, t)), n && (a = O(a, n)), r && (a = O(a, r)), i && (a = O(a, i)), a;
}
function E(e) {
	if (e.length === 0) return w;
	if (e.length === 1) return D(e[0]);
	let t = D(e[0]);
	for (let n = 1; n < e.length; n += 1) t = O(t, e[n]);
	return t;
}
function D(e) {
	return M(e) ? { ...N(e, w) } : k(e);
}
function O(e, t) {
	return M(t) ? N(t, e) : A(e, t);
}
function k(e) {
	let t = { ...e };
	for (let e in t) {
		let n = t[e];
		j(e, n) && (t[e] = F(n));
	}
	return t;
}
function A(e, t) {
	if (!t) return e;
	for (let n in t) {
		let r = t[n];
		switch (n) {
			case "style":
				e[n] = _(e.style, r);
				break;
			case "className":
				e[n] = L(e.className, r);
				break;
			default: j(n, r) ? e[n] = P(e[n], r) : e[n] = r;
		}
	}
	return e;
}
function j(e, t) {
	let n = e.charCodeAt(0), r = e.charCodeAt(1), i = e.charCodeAt(2);
	return n === 111 && r === 110 && i >= 65 && i <= 90 && (typeof t == "function" || t === void 0);
}
function M(e) {
	return typeof e == "function";
}
function N(e, t) {
	return M(e) ? e(t) : e ?? w;
}
function P(e, t) {
	return t ? e ? (...n) => {
		let r = n[0];
		if (R(r)) {
			let i = r;
			I(i);
			let a = t(...n);
			return i.baseUIHandlerPrevented || e?.(...n), a;
		}
		let i = t(...n);
		return e?.(...n), i;
	} : F(t) : e;
}
function F(e) {
	return e && ((...t) => {
		let n = t[0];
		return R(n) && I(n), e(...t);
	});
}
function I(e) {
	return e.preventBaseUIHandler = () => {
		e.baseUIHandlerPrevented = !0;
	}, e;
}
function L(e, t) {
	return t ? e ? t + " " + e : t : e;
}
function R(e) {
	return typeof e == "object" && !!e && "nativeEvent" in e;
}
//#endregion
//#region ../../node_modules/.bun/@base-ui+react@1.5.0+f4ada88178b00e6f/node_modules/@base-ui/react/esm/internals/useRenderElement.js
function z(e, t, n = {}) {
	let r = t.render, i = B(t, n);
	return n.enabled === !1 ? null : G(e, r, i, n.state ?? b);
}
function B(e, t = {}) {
	let { className: n, style: r, render: i } = e, { state: a = b, ref: o, props: s, stateAttributesMapping: u, enabled: d = !0 } = t, f = d ? S(n, a) : void 0, p = d ? C(r, a) : void 0, m = d ? x(a, u) : b, h = d && s ? V(s) : void 0, v = d ? _(m, h) ?? {} : b;
	return typeof document < "u" && (d ? Array.isArray(o) ? v.ref = l([
		v.ref,
		g(i),
		...o
	]) : v.ref = c(v.ref, g(i), o) : c(null, null)), d ? (f !== void 0 && (v.className = L(v.className, f)), p !== void 0 && (v.style = _(v.style, p)), v) : b;
}
function V(e) {
	return Array.isArray(e) ? E(e) : T(void 0, e);
}
var H = Symbol.for("react.lazy"), U = /^[A-Z][A-Za-z0-9$]*$/, W = /[a-z]/;
function G(t, n, r, i) {
	if (n) {
		if (typeof n == "function") return process.env.NODE_ENV !== "production" && K(n), n(r, i);
		let t = T(r, n.props);
		t.ref = r.ref;
		let a = n;
		if (a?.$$typeof === H && (a = e.Children.toArray(n)[0]), process.env.NODE_ENV !== "production" && !/*#__PURE__*/ e.isValidElement(a)) throw Error([
			"Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.",
			"A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.",
			"https://base-ui.com/r/invalid-render-prop"
		].join("\n"));
		return /*#__PURE__*/ e.cloneElement(a, t);
	}
	if (t && typeof t == "string") return q(t, r);
	throw Error(process.env.NODE_ENV === "production" ? s(8) : "Base UI: Render element or function are not defined.");
}
function K(e) {
	let t = e.name;
	t.length !== 0 && U.test(t) && W.test(t) && a(`The \`render\` prop received a function named \`${t}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop");
}
function q(n, r) {
	return n === "button" ? /*#__PURE__*/ t("button", {
		type: "button",
		...r,
		key: r.key
	}) : n === "img" ? /*#__PURE__*/ t("img", {
		alt: "",
		...r,
		key: r.key
	}) : /*#__PURE__*/ e.createElement(n, r);
}
//#endregion
export { y as a, h as c, a as d, r as f, C as i, c as l, I as n, b as o, T as r, v as s, z as t, s as u };
