import { r as e } from "./dist-koa_pEtu.js";
import * as t from "react";
//#region node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
var n = t.useInsertionEffect || e;
function r({ prop: e, defaultProp: n, onChange: r = () => {}, caller: o }) {
	let [s, c, l] = i({
		defaultProp: n,
		onChange: r
	}), u = e !== void 0, d = u ? e : s;
	{
		let n = t.useRef(e !== void 0);
		t.useEffect(() => {
			let e = n.current;
			e !== u && console.warn(`${o} is changing from ${e ? "controlled" : "uncontrolled"} to ${u ? "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.`), n.current = u;
		}, [u, o]);
	}
	return [d, t.useCallback((t) => {
		if (u) {
			let n = a(t) ? t(e) : t;
			n !== e && l.current?.(n);
		} else c(t);
	}, [
		u,
		e,
		c,
		l
	])];
}
function i({ defaultProp: e, onChange: r }) {
	let [i, a] = t.useState(e), o = t.useRef(i), s = t.useRef(r);
	return n(() => {
		s.current = r;
	}, [r]), t.useEffect(() => {
		o.current !== i && (s.current?.(i), o.current = i);
	}, [i, o]), [
		i,
		a,
		s
	];
}
function a(e) {
	return typeof e == "function";
}
//#endregion
export { r as t };

//# sourceMappingURL=dist-C0wG5dwG.js.map