import { toDate as k } from "./toDate.js";
import { getDefaultOptions as u } from "./_lib/defaultOptions.js";
function S(l, e) {
  var n, s, c, O;
  const a = u(), r = (e == null ? void 0 : e.weekStartsOn) ?? ((s = (n = e == null ? void 0 : e.locale) == null ? void 0 : n.options) == null ? void 0 : s.weekStartsOn) ?? a.weekStartsOn ?? ((O = (c = a.locale) == null ? void 0 : c.options) == null ? void 0 : O.weekStartsOn) ?? 0, t = k(l), f = t.getDay(), d = (f < r ? -7 : 0) + 6 - (f - r);
  return t.setDate(t.getDate() + d), t.setHours(23, 59, 59, 999), t;
}
export {
  S as default,
  S as endOfWeek
};
