import { getDays as s, getIsSameDay as f } from "../../dateUtils.js";
function l(n) {
  return n === 0 ? 11 : n - 1;
}
function g(n) {
  return n === 11 ? 0 : n + 1;
}
function d(n, t) {
  return n === 0 ? t - 1 : t;
}
function h(n, t) {
  return n === 11 ? t + 1 : t;
}
function w(n, t) {
  return t === "sunday" ? n : n === 0 ? 6 : n - 1;
}
function x(n, t, e, o) {
  const r = l(n), u = d(n, t), i = w(e, o);
  return i !== 0 ? s(r, u).slice(-i) : [];
}
function p(n, t, e) {
  const o = g(n), r = h(n, t);
  return s(o, r).slice(0, e !== 7 ? e : 0);
}
function N(n, t, e, o) {
  const r = s(t, e), u = x(t, e, n, o), i = 7 - (u.length + r.length) % 7, c = p(t, e, i);
  return o === "monday" ? [...u, ...r, ...c] : n > 0 ? [...u, ...r, ...c] : [...r, ...c];
}
function P(n, t, e) {
  if (e === "single-date" || n === "none")
    return 0;
  switch (n) {
    case "monday":
      return t === 0 ? 7 : t;
    case "sunday":
    default:
      return t > 0 ? t + 1 : t;
  }
}
function M(n, t, e) {
  return !!(t && n < t || e && n > e);
}
function S(n, t) {
  return t && t.end ? f(n, t.end) : !1;
}
function a(n) {
  if (n && n.current) {
    const t = n.current.getBoundingClientRect().width - 32;
    if (t / 7 < 40)
      return t / 7;
  }
  return 40;
}
function y(n, t) {
  if (t.current) {
    const e = window.getComputedStyle(t.current).gridColumnStart.split(" ").length - 1 || 0, o = 7, r = Math.floor((n + e) / o), u = (n + e) % o;
    return { row: r, col: u };
  }
}
function Y(n) {
  return n.row * 7 + n.col;
}
export {
  N as getAllDays,
  a as getDayWidth,
  y as getGridPosition,
  Y as getIndexFromGridPosition,
  p as getNextDays,
  g as getNextMonth,
  h as getNextYear,
  x as getPrevDays,
  l as getPrevMonth,
  d as getPrevYear,
  w as getSliceNum,
  P as getStartColumn,
  S as hasEndRange,
  M as isDisabled
};
