import { d as l } from "./dayjs.min-D5mIeZ1x.js";
const T = new Intl.DateTimeFormat("en-US", {
  year: "numeric",
  month: "2-digit",
  day: "2-digit",
  hour: "2-digit",
  hour12: !0,
  minute: "2-digit"
});
function p(e) {
  var o, m, u, D, d, s;
  e = new Date(e);
  const t = T.formatToParts(e), r = [
    (o = t.find((i) => i.type === "year")) == null ? void 0 : o.value,
    (m = t.find((i) => i.type === "month")) == null ? void 0 : m.value,
    (u = t.find((i) => i.type === "day")) == null ? void 0 : u.value
  ], n = [
    (D = t.find((i) => i.type === "hour")) == null ? void 0 : D.value,
    (d = t.find((i) => i.type === "minute")) == null ? void 0 : d.value
  ], a = (s = t.find((i) => i.type === "dayPeriod")) == null ? void 0 : s.value;
  return `${r.join("-")} ${n.join(":")} ${a}`;
}
function F(e) {
  const t = new Intl.DateTimeFormat("en-US", { year: "numeric" }), r = new Intl.DateTimeFormat("en-US", { month: "short" });
  return [new Intl.DateTimeFormat("en-US", { day: "2-digit" }), r, t].map((o) => o.format(e).toUpperCase()).join(" ");
}
function M(e) {
  return new Intl.DateTimeFormat("en-US", {
    hour: "2-digit",
    hour12: !0,
    minute: "2-digit"
  }).format(e);
}
function h(e) {
  var n, a;
  const r = new Intl.DateTimeFormat("en-US", {
    hour: "2-digit",
    hour12: !1,
    minute: "2-digit"
  }).formatToParts(e);
  return `${(n = r.find((o) => o.type === "hour")) == null ? void 0 : n.value}:${(a = r.find((o) => o.type === "minute")) == null ? void 0 : a.value}`;
}
function c(e, t = "-") {
  const r = new Intl.DateTimeFormat("en-US", { year: "numeric" }), n = new Intl.DateTimeFormat("en-US", { month: "2-digit" }), a = new Intl.DateTimeFormat("en-US", { day: "2-digit" });
  return [r, n, a].map((m) => m.format(e).toUpperCase()).join(t);
}
function w(e, t = "-", r = ":") {
  const n = new Intl.DateTimeFormat("en-US", { year: "numeric" }), a = new Intl.DateTimeFormat("en-US", { month: "2-digit" }), o = new Intl.DateTimeFormat("en-US", { day: "2-digit" }), m = new Intl.DateTimeFormat("en-US", { hour: "2-digit", hour12: !1 }), u = new Intl.DateTimeFormat("en-US", { minute: "2-digit" }), D = [n, a, o].map((s) => s.format(e).toUpperCase()).join(t), d = [m, u].map((s) => s.format(e).toUpperCase()).join(r);
  return `${D} ${d}`;
}
function f(e) {
  const t = new Date(e);
  return t.setHours(0), t.setMinutes(0), t.setSeconds(0), t.setMilliseconds(0), t;
}
function g(e) {
  const t = f(e);
  return t.setDate(t.getDate() + 1), t.setTime(t.getTime() - 1), t;
}
function S(e) {
  const { startDate: t, endDate: r } = e;
  if (t === null || r === null)
    return {
      startDate: null,
      endDate: null
    };
  const n = new Date(t), a = new Date(r);
  if (isNaN(n.getTime()) || isNaN(a.getTime()))
    return {
      startDate: null,
      endDate: null
    };
  const o = a.getTime() - n.getTime();
  return n.setTime(n.getTime() - o - 864e5), a.setTime(a.getTime() - o - 864e5), {
    startDate: c(n),
    endDate: c(a)
  };
}
function U(e) {
  const { startDate: t, endDate: r } = e;
  if (t === null || r === null)
    return {
      startDate: null,
      endDate: null
    };
  const n = new Date(t), a = new Date(r);
  if (isNaN(n.getTime()) || isNaN(a.getTime()))
    return {
      startDate: null,
      endDate: null
    };
  const o = a.getTime() - n.getTime();
  return n.setTime(n.getTime() + o + 864e5), a.setTime(a.getTime() + o + 864e5), {
    startDate: c(n),
    endDate: c(a)
  };
}
function I(e, t = /* @__PURE__ */ new Date()) {
  const r = g(new Date(t.getTime()));
  return {
    startDate: l(f(new Date(t.getTime()))).subtract(e, "months").toISOString(),
    endDate: r.toISOString()
  };
}
export {
  p as a,
  c as b,
  M as c,
  g as d,
  h as e,
  w as f,
  I as g,
  F as h,
  U as n,
  S as p,
  f as t
};
