import u from "./index-moment.js";
const m = {
  normalDateWithWeekday: "ddd, MMM D",
  normalDate: "D MMMM",
  shortDate: "MMM D",
  monthAndDate: "MMMM D",
  dayOfMonth: "D",
  year: "YYYY",
  month: "MMMM",
  monthShort: "MMM",
  monthAndYear: "MMMM YYYY",
  weekday: "dddd",
  weekdayShort: "ddd",
  minutes: "mm",
  hours12h: "hh",
  hours24h: "HH",
  seconds: "ss",
  fullTime: "LT",
  fullTime12h: "hh:mm A",
  fullTime24h: "HH:mm",
  fullDate: "ll",
  fullDateWithWeekday: "dddd, LL",
  fullDateTime: "lll",
  fullDateTime12h: "ll hh:mm A",
  fullDateTime24h: "ll HH:mm",
  keyboardDate: "L",
  keyboardDateTime: "L LT",
  keyboardDateTime12h: "L hh:mm A",
  keyboardDateTime24h: "L HH:mm"
};
class f {
  constructor({ locale: i, formats: h, instance: l } = {}) {
    this.lib = "moment", this.is12HourCycleInCurrentLocale = () => /A|a/.test(this.moment.localeData(this.getCurrentLocaleCode()).longDateFormat("LT")), this.getFormatHelperText = (t) => {
      var e, r;
      const a = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
      return (r = (e = t.match(a)) === null || e === void 0 ? void 0 : e.map((n) => {
        const s = n[0];
        return s === "L" || s === ";" ? this.moment.localeData(this.getCurrentLocaleCode()).longDateFormat(n) : n;
      }).join("").replace(/a/gi, "(a|p)m").toLocaleLowerCase()) !== null && r !== void 0 ? r : t;
    }, this.getCurrentLocaleCode = () => this.locale || this.moment.locale(), this.parseISO = (t) => this.moment(t, !0), this.toISO = (t) => t.toISOString(), this.parse = (t, e) => t === "" ? null : this.locale ? this.moment(t, e, this.locale, !0) : this.moment(t, e, !0), this.date = (t) => {
      if (t === null)
        return null;
      const e = this.moment(t);
      return this.locale && e.locale(this.locale), e;
    }, this.toJsDate = (t) => t.toDate(), this.isValid = (t) => this.moment(t).isValid(), this.isNull = (t) => t === null, this.getDiff = (t, e, r) => this.moment(e).isValid() ? t.diff(e, r) : 0, this.isAfter = (t, e) => t.isAfter(e), this.isBefore = (t, e) => t.isBefore(e), this.isAfterDay = (t, e) => t.isAfter(e, "day"), this.isBeforeDay = (t, e) => t.isBefore(e, "day"), this.isBeforeMonth = (t, e) => t.isBefore(e, "month"), this.isAfterMonth = (t, e) => t.isAfter(e, "month"), this.isBeforeYear = (t, e) => t.isBefore(e, "year"), this.isAfterYear = (t, e) => t.isAfter(e, "year"), this.startOfDay = (t) => t.clone().startOf("day"), this.endOfDay = (t) => t.clone().endOf("day"), this.format = (t, e) => this.formatByString(t, this.formats[e]), this.formatByString = (t, e) => {
      const r = t.clone();
      return this.locale && r.locale(this.locale), r.format(e);
    }, this.formatNumber = (t) => t, this.getHours = (t) => t.get("hours"), this.addSeconds = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "seconds") : t.clone().add(e, "seconds"), this.addMinutes = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "minutes") : t.clone().add(e, "minutes"), this.addHours = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "hours") : t.clone().add(e, "hours"), this.addDays = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "days") : t.clone().add(e, "days"), this.addWeeks = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "weeks") : t.clone().add(e, "weeks"), this.addMonths = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "months") : t.clone().add(e, "months"), this.addYears = (t, e) => e < 0 ? t.clone().subtract(Math.abs(e), "years") : t.clone().add(e, "years"), this.setHours = (t, e) => t.clone().hours(e), this.getMinutes = (t) => t.get("minutes"), this.setMinutes = (t, e) => t.clone().minutes(e), this.getSeconds = (t) => t.get("seconds"), this.setSeconds = (t, e) => t.clone().seconds(e), this.getMonth = (t) => t.get("month"), this.getDaysInMonth = (t) => t.daysInMonth(), this.isSameDay = (t, e) => t.isSame(e, "day"), this.isSameMonth = (t, e) => t.isSame(e, "month"), this.isSameYear = (t, e) => t.isSame(e, "year"), this.isSameHour = (t, e) => t.isSame(e, "hour"), this.setMonth = (t, e) => t.clone().month(e), this.getMeridiemText = (t) => this.is12HourCycleInCurrentLocale() ? this.moment.localeData(this.getCurrentLocaleCode()).meridiem(t === "am" ? 0 : 13, 0, !1) : t === "am" ? "AM" : "PM", this.startOfYear = (t) => t.clone().startOf("year"), this.endOfYear = (t) => t.clone().endOf("year"), this.startOfMonth = (t) => t.clone().startOf("month"), this.endOfMonth = (t) => t.clone().endOf("month"), this.startOfWeek = (t) => t.clone().startOf("week"), this.endOfWeek = (t) => t.clone().endOf("week"), this.getNextMonth = (t) => t.clone().add(1, "month"), this.getPreviousMonth = (t) => t.clone().subtract(1, "month"), this.getMonthArray = (t) => {
      const r = [t.clone().startOf("year")];
      for (; r.length < 12; ) {
        const a = r[r.length - 1];
        r.push(this.getNextMonth(a));
      }
      return r;
    }, this.getYear = (t) => t.get("year"), this.setYear = (t, e) => t.clone().set("year", e), this.getDate = (t) => t.get("date"), this.setDate = (t, e) => t.clone().set("date", e), this.mergeDateAndTime = (t, e) => t.hour(e.hour()).minute(e.minute()).second(e.second()), this.getWeekdays = () => this.moment.weekdaysShort(!0), this.isEqual = (t, e) => t === null && e === null ? !0 : this.moment(t).isSame(e), this.getWeekArray = (t) => {
      const e = t.clone().startOf("month").startOf("week"), r = t.clone().endOf("month").endOf("week");
      let a = 0, n = e;
      const s = [];
      for (; n.isBefore(r); ) {
        const o = Math.floor(a / 7);
        s[o] = s[o] || [], s[o].push(n), n = n.clone().add(1, "day"), a += 1;
      }
      return s;
    }, this.getYearRange = (t, e) => {
      const r = this.moment(t).startOf("year"), a = this.moment(e).endOf("year"), n = [];
      let s = r;
      for (; s.isBefore(a); )
        n.push(s), s = s.clone().add(1, "year");
      return n;
    }, this.isWithinRange = (t, [e, r]) => t.isBetween(e, r, null, "[]"), this.moment = l || u, this.locale = i, this.formats = Object.assign({}, m, h);
  }
}
export {
  f as default
};
