"use client";
const h = /* @__PURE__ */ new Date(), c = /* @__PURE__ */ new Date();
function v(e, i, D, m) {
  function u(n) {
    return e(n = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+n)), n;
  }
  return u.floor = (n) => (e(n = /* @__PURE__ */ new Date(+n)), n), u.ceil = (n) => (e(n = new Date(n - 1)), i(n, 1), e(n), n), u.round = (n) => {
    const r = u(n), l = u.ceil(n);
    return n - r < l - n ? r : l;
  }, u.offset = (n, r) => (i(n = /* @__PURE__ */ new Date(+n), r == null ? 1 : Math.floor(r)), n), u.range = (n, r, l) => {
    const w = [];
    if (n = u.ceil(n), l = l == null ? 1 : Math.floor(l), !(n < r) || !(l > 0)) return w;
    let g;
    do
      w.push(g = /* @__PURE__ */ new Date(+n)), i(n, l), e(n);
    while (g < n && n < r);
    return w;
  }, u.filter = (n) => v((r) => {
    if (r >= r) for (; e(r), !n(r); ) r.setTime(r - 1);
  }, (r, l) => {
    if (r >= r)
      if (l < 0) for (; ++l <= 0; )
        for (; i(r, -1), !n(r); )
          ;
      else for (; --l >= 0; )
        for (; i(r, 1), !n(r); )
          ;
  }), D && (u.count = (n, r) => (h.setTime(+n), c.setTime(+r), e(h), e(c), Math.floor(D(h, c))), u.every = (n) => (n = Math.floor(n), !isFinite(n) || !(n > 0) ? null : n > 1 ? u.filter(m ? (r) => m(r) % n === 0 : (r) => u.count(0, r) % n === 0) : u)), u;
}
export {
  v as timeInterval
};
