import * as v from "react";
import { isSameDate as f, getQuarter as q } from "../utils/dateUtil.mjs";
import { getValue as k } from "../utils/miscUtil.mjs";
function p(u, l) {
  var m = u.picker, h = u.locale, D = u.selectedValue, n = u.disabledDate, i = u.disabled, r = u.generateConfig, a = k(D, 0), t = k(D, 1);
  function s(e) {
    return r.locale.getWeekFirstDate(h.locale, e);
  }
  function c(e) {
    var b = r.getYear(e), g = r.getMonth(e);
    return b * 100 + g;
  }
  function o(e) {
    var b = r.getYear(e), g = q(r, e);
    return b * 10 + g;
  }
  var w = v.useCallback(function(e) {
    if (i[0] || n && n(e))
      return !0;
    if (i[1] && t)
      return !f(r, e, t) && r.isAfter(e, t);
    if (!l && t)
      switch (m) {
        case "quarter":
          return o(e) > o(t);
        case "month":
          return c(e) > c(t);
        case "week":
          return s(e) > s(t);
        default:
          return !f(r, e, t) && r.isAfter(e, t);
      }
    return !1;
  }, [n, i[1], t, l]), d = v.useCallback(function(e) {
    if (i[1] || n && n(e))
      return !0;
    if (i[0] && a)
      return !f(r, e, t) && r.isAfter(a, e);
    if (!l && a)
      switch (m) {
        case "quarter":
          return o(e) < o(a);
        case "month":
          return c(e) < c(a);
        case "week":
          return s(e) < s(a);
        default:
          return !f(r, e, a) && r.isAfter(a, e);
      }
    return !1;
  }, [n, i[0], a, l]);
  return [w, d];
}
export {
  p as default
};
