import { useState as m, useMemo as f, useCallback as p } from "react";
function n(t, o, s) {
  const [r, u] = m(o), i = f(() => t !== void 0, [t]), a = f(() => i ? t : r, [i, t, r]), c = p(
    (e) => {
      s && s(e), u(e);
    },
    [s]
  );
  return { value: a, setValue: c, isControlled: i };
}
export {
  n as default
};
//# sourceMappingURL=useControlledState.js.map
