import * as i from "react";
import { useUtils as u } from "./index-useUtils.js";
import { getMeridiem as M, convertToMeridiem as f } from "./index-time-utils.js";
function h(t, {
  disableFuture: r,
  maxDate: o
}) {
  const e = u();
  return i.useMemo(() => {
    const n = e.date(), s = e.startOfMonth(r && e.isBefore(n, o) ? n : o);
    return !e.isAfter(s, t);
  }, [r, o, t, e]);
}
function a(t, {
  disablePast: r,
  minDate: o
}) {
  const e = u();
  return i.useMemo(() => {
    const n = e.date(), s = e.startOfMonth(r && e.isAfter(n, o) ? n : o);
    return !e.isBefore(s, t);
  }, [r, o, t, e]);
}
function p(t, r, o) {
  const e = u(), n = M(t, e), s = i.useCallback((c) => {
    const l = t == null ? null : f(t, c, !!r, e);
    o(l, "partial");
  }, [r, t, o, e]);
  return {
    meridiemMode: n,
    handleMeridiemChange: s
  };
}
export {
  p as useMeridiemMode,
  h as useNextMonthDisabled,
  a as usePreviousMonthDisabled
};
