"use client";
let react = require("react");
//#region src/utils/use-controllable-state.ts
function useControllableState(props) {
	const { value, onChange, defaultValue } = props;
	const [uncontrolledValue, setUncontrolledValue] = (0, react.useState)(defaultValue);
	const controlled = value !== void 0;
	return [controlled ? value : uncontrolledValue, (0, react.useCallback)((value) => {
		if (controlled) return onChange?.(value);
		setUncontrolledValue(value);
		return onChange?.(value);
	}, [controlled, onChange])];
}
//#endregion
exports.useControllableState = useControllableState;
