"use client";
let react = require("react");
//#region packages/@mantine/hooks/src/use-validated-state/use-validated-state.ts
function useValidatedState(initialValue, validate, initialValidationState) {
	const [value, setValue] = (0, react.useState)(initialValue);
	const [lastValidValue, setLastValidValue] = (0, react.useState)(validate(initialValue) ? initialValue : void 0);
	const [valid, setValid] = (0, react.useState)(typeof initialValidationState === "boolean" ? initialValidationState : validate(initialValue));
	const onChange = (val) => {
		if (validate(val)) {
			setLastValidValue(val);
			setValid(true);
		} else setValid(false);
		setValue(val);
	};
	return [{
		value,
		lastValidValue,
		valid
	}, onChange];
}
//#endregion
exports.useValidatedState = useValidatedState;

//# sourceMappingURL=use-validated-state.cjs.map