import { parse as s, format as e, isValid as c } from "date-fns";
import * as d from "date-fns/locale";
const i = {
  "bg-BG": "dd.MM.yyyy",
  "cs-CZ": "dd.MM.yyyy",
  "da-DK": "dd-MM-yyyy",
  "de-DE": "dd.MM.yyyy",
  "el-GR": "dd/MM/yyyy",
  "en-GB": "dd/MM/yyyy",
  "es-ES": "dd/MM/yyyy",
  "et-EE": "dd.MM.yyyy",
  "fi-FI": "dd.MM.yyyy",
  "fr-FR": "dd/MM/yyyy",
  "hr-HR": "dd.MM.yyyy",
  "hu-HU": "yyyy. MM. dd.",
  "it-IT": "dd/MM/yyyy",
  "lt-LT": "dd-MM-yyyy",
  "lv-LV": "dd.MM.yyyy",
  "nb-NO": "dd.MM.yyyy",
  "nl-NL": "dd-MM-yyyy",
  "pl-PL": "dd.MM.yyyy",
  "pt-BR": "dd/MM/yyyy",
  "pt-PT": "dd/MM/yyyy",
  "ro-RO": "dd.MM.yyyy",
  "sk-SK": "dd.MM.yyyy",
  "sl-SI": "dd.MM.yyyy",
  "sv-SE": "yyyy-MM-dd"
}, l = Object.keys(i), g = (y) => {
  const r = y.trim(), t = r.replace(/-([a-z])/gi, (n, M) => M.toUpperCase()), o = r.split("-")[0];
  return d[t] || d[r] || d[o] || d.enGB;
}, p = (y, r, t) => y ? e(y, a(r, t)) : "", D = (y, r, t, o) => {
  if (!y)
    return "";
  const n = (M) => p(M, r, o);
  if (t === "single" && y instanceof Date)
    return n(y);
  if (t === "multiple" && Array.isArray(y))
    return y.map(n).join(", ");
  if (t === "range" && typeof y == "object" && "from" in y) {
    const M = y.from ? n(y.from) : "...", f = y.to ? n(y.to) : "...";
    return `${M} - ${f}`;
  }
  return "";
}, a = (y, r) => r || i[y] || "yyyy-MM-dd", u = (y) => {
  let r = "";
  for (let t = 0; t < y.length; ) {
    if (y.startsWith("dd", t)) {
      r += "d", t += 2;
      continue;
    }
    if (y.startsWith("MM", t)) {
      r += "m", t += 2;
      continue;
    }
    if (y.startsWith("yyyy", t)) {
      r += "Y", t += 4;
      continue;
    }
    const o = y[t];
    if (!o)
      break;
    if (/[a-zA-Z]/.test(o))
      return;
    r += o, t += 1;
  }
  return r;
}, L = (y, r) => {
  const t = a(y, r), o = u(t);
  if (o)
    return {
      mask: Date,
      pattern: o,
      format: (n) => n ? e(n, t) : "",
      parse: (n) => s(n, t, /* @__PURE__ */ new Date())
    };
}, h = (y, r, t) => {
  if (!y)
    return;
  const o = t || a(r), n = s(y, o, /* @__PURE__ */ new Date());
  if (c(n) && e(n, o) === y)
    return n;
};
export {
  p as formatDate,
  D as formatSelectionForInput,
  a as getInputFormat,
  L as getInputMaskProps,
  h as parseDateString,
  g as resolveLocale,
  l as supportedDayPickerLocales
};
//# sourceMappingURL=dayPickerUtils.js.map
