var g = Object.defineProperty;
var u = (e, t, a) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
var r = (e, t, a) => u(e, typeof t != "symbol" ? t + "" : t, a);
import { translationService as h } from "./index-translation.service.js";
import s from "./index-moment.js";
class F {
  constructor() {
    r(this, "separator", "-");
    r(this, "dayFormat", "DD");
    r(this, "monthFormat", "MMM");
    r(this, "formatDate", (t) => `${s(t).format(this.dayFormat)} ${h.get(s(t).format(this.monthFormat)).value}`);
    r(this, "dayPlaceholder", "_");
    r(this, "monthPlaceholder", "_");
  }
  /**
   * Receives 2 dates and returns a string to display in input
   * */
  formatDateRangePickerInput(t, a) {
    return `${this.formatDate(t)}${this.separator}${this.formatDate(a)}`;
  }
  formatStringToDates(t) {
    const a = t.split(this.separator), n = a[0], i = a[1], d = [n, i], f = [this.monthPlaceholder, this.dayPlaceholder];
    let c = !1;
    for (const y of d)
      if (f.some(($) => y.includes($))) {
        c = !0;
        break;
      }
    const o = {
      startDate: null,
      endDate: null
    };
    if (c)
      return o;
    const D = `${n.trim().split(" ")[0]} ${h.getTranslationKey(n.trim().split(" ")[1]).key}`, m = s(D, `${this.dayFormat} ${this.monthFormat}`), p = `${i.trim().split(" ")[0]} ${h.getTranslationKey(i.trim().split(" ")[1]).key}`, l = s(p, `${this.dayFormat} ${this.monthFormat}`);
    return m.isValid() && (o.startDate = {
      day: parseInt(m.format("D")),
      month: parseInt(m.format("MM"))
    }), l.isValid() && (o.endDate = {
      day: parseInt(l.format("D")),
      month: parseInt(l.format("MM"))
    }), o;
  }
}
const S = new F();
export {
  F as DateRangePickerFormatter,
  S as dateRangePickerFormatter
};
