var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
import { u as uuidv4, m as magicNumbers } from "../chunks/chunk.dcf-utility.js?v=6.1.1";
class DCFDatepicker {
  static {
    __name(this, "DCFDatepicker");
  }
  uuid = uuidv4();
  constructor(datepicker) {
    this.int0 = magicNumbers("int0"), this.int1 = magicNumbers("int1"), this.int2 = magicNumbers("int2"), this.int3 = magicNumbers("int3"), this.int6 = magicNumbers("int6"), this.int7 = magicNumbers("int7"), this.intMinus1 = magicNumbers("intMinus1"), this.datepicker = datepicker, (this.datepicker.getAttribute("id") === "" || this.datepicker.getAttribute("id") === null) && this.datepicker.setAttribute("id", this.uuid.concat("-datepicker")), this.buttonLabelChoose = "Choose Date", this.buttonLabelChange = "Change Date", this.dayLabels = [
      "Sunday",
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday",
      "Saturday"
    ], this.monthLabels = [
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
    ], this.messageCursorKeys = "Cursor keys can navigate&nbsp;dates", this.lastMessage = "", this.lastRowNode = null, this.days = [], this.focusDay = /* @__PURE__ */ new Date(), this.selectedDay = new Date(this.int0, this.int0, this.int1), this.isMouseDownOnBackground = !1, this.textboxNode = this.datepicker.querySelector('input[type="text"]'), (this.textboxNode.getAttribute("id") === "" || this.textboxNode.getAttribute("id") === null) && this.textboxNode.setAttribute("id", this.uuid.concat("-datepicker-text-box")), this.appendPickerContainer(), this.appendDialog(), this.init();
  }
  // The names of the events to be used easily
  static events(name) {
    const events = {
      datepickerReady: "datepickerReady"
    };
    return Object.freeze(events), name in events ? events[name] : void 0;
  }
  parseInt(string) {
    return parseInt(string, 10);
  }
  appendPickerContainer() {
    const pickerContainer = document.createElement("div");
    pickerContainer.classList.add("dcf-input-group"), pickerContainer.append(this.textboxNode), this.buttonNode = document.createElement("button"), this.buttonNode.classList.add("dcf-btn", "dcf-btn-primary", "dcf-btn-datepicker"), this.buttonNode.setAttribute("aria-label", "Choose Date"), this.buttonNode.innerHTML = "&#128197;", pickerContainer.appendChild(this.buttonNode), this.datepicker.append(pickerContainer);
  }
  appendDialog() {
    const dialogLabelID = this.uuid.concat("-dialog-label"), dialogGridID = this.uuid.concat("-dialog-grid");
    this.dialogNode = document.createElement("div"), this.dialogNode.setAttribute("id", this.uuid.concat("-datepicker-dialog")), this.dialogNode.setAttribute("role", "dialog"), this.dialogNode.setAttribute("aria-modal", "true"), this.dialogNode.setAttribute("aria-labelledby", dialogLabelID), this.dialogNode.classList.add("dcf-datepicker-dialog", "dcf-absolute", "dcf-right-0", "dcf-invisible", "dcf-d-none");
    const dialogHeader = document.createElement("div");
    dialogHeader.classList.add("dcf-datepicker-dialog-header", "dcf-d-flex", "dcf-ai-center", "dcf-jc-around"), this.prevYearNode = document.createElement("button"), this.prevYearNode.classList.add(
      "dcf-btn",
      "dcf-btn-tertiary",
      "dcf-datepicker-dialog-btn-header",
      "dcf-datepicker-dialog-btn-prev-year"
    ), this.prevYearNode.setAttribute("aria-label", "previous year"), this.prevYearNode.innerHTML = "&laquo;", dialogHeader.append(this.prevYearNode), this.prevMonthNode = document.createElement("button"), this.prevMonthNode.classList.add(
      "dcf-btn",
      "dcf-btn-tertiary",
      "dcf-datepicker-dialog-btn-header",
      "dcf-datepicker-dialog-btn-prev-month"
    ), this.prevMonthNode.setAttribute("aria-label", "previous month"), this.prevMonthNode.innerHTML = "&lsaquo;", dialogHeader.append(this.prevMonthNode), this.monthYearNode = document.createElement("h2"), this.monthYearNode.classList.add("dcf-datepicker-dialog-month-year", "dcf-flex-grow-1", "dcf-mb-0", "dcf-txt-center"), this.monthYearNode.setAttribute("id", dialogLabelID), this.monthYearNode.setAttribute("aria-live", "polite"), dialogHeader.append(this.monthYearNode), this.nextMonthNode = document.createElement("button"), this.nextMonthNode.classList.add(
      "dcf-btn",
      "dcf-btn-tertiary",
      "dcf-datepicker-dialog-btn-header",
      "dcf-datepicker-dialog-btn-next-month"
    ), this.nextMonthNode.setAttribute("aria-label", "next month"), this.nextMonthNode.innerHTML = "&rsaquo;", dialogHeader.append(this.nextMonthNode), this.nextYearNode = document.createElement("button"), this.nextYearNode.classList.add(
      "dcf-btn",
      "dcf-btn-tertiary",
      "dcf-datepicker-dialog-btn-header",
      "dcf-datepicker-dialog-btn-next-year"
    ), this.nextYearNode.setAttribute("aria-label", "next year"), this.nextYearNode.innerHTML = "&raquo;", dialogHeader.append(this.nextYearNode);
    const calendarTable = document.createElement("table");
    calendarTable.classList.add("dcf-datepicker-dialog-calendar", "dcf-w-100%", "dcf-table-fixed"), calendarTable.setAttribute("id", dialogGridID), calendarTable.setAttribute("role", "grid"), calendarTable.setAttribute("aria-labelledby", dialogLabelID);
    const thead = document.createElement("thead"), theadRow = document.createElement("tr");
    Array.prototype.forEach.call(this.dayLabels, (dayLabel) => {
      const dayHead = document.createElement("th");
      dayHead.setAttribute("scope", "col"), dayHead.setAttribute("abbr", dayLabel), dayHead.innerText = dayLabel.substring(this.int0, this.int2), theadRow.append(dayHead);
    }), thead.append(theadRow), calendarTable.append(thead), this.tbodyNode = document.createElement("tbody"), calendarTable.append(this.tbodyNode);
    const dialogBtnGroup = document.createElement("div");
    dialogBtnGroup.classList.add("dcf-datepicker-dialog-ok-cancel-group", "dcf-flex-shrink-0", "dcf-mr-4"), this.okButtonNode = document.createElement("button"), this.okButtonNode.classList.add(
      "dcf-btn",
      "dcf-btn-primary",
      "dcf-datepicker-dialog-btn-footer",
      "dcf-datepicker-dialog-btn-ok",
      "dcf-mr-3"
    ), this.okButtonNode.setAttribute("value", "ok"), this.okButtonNode.innerText = "OK", dialogBtnGroup.append(this.okButtonNode), this.cancelButtonNode = document.createElement("button"), this.cancelButtonNode = document.createElement("button"), this.cancelButtonNode.classList.add(
      "dcf-btn",
      "dcf-btn-tertiary",
      "dcf-datepicker-dialog-btn-footer",
      "dcf-datepicker-dialog-btn-cancel"
    ), this.cancelButtonNode.setAttribute("value", "cancel"), this.cancelButtonNode.innerText = "Cancel", dialogBtnGroup.append(this.cancelButtonNode), this.messageNode = document.createElement("div"), this.messageNode.classList.add("dcf-datepicker-dialog-message", "dcf-d-flex", "dcf-ai-center", "dcf-jc-center"), this.messageNode.setAttribute("aria-live", "polite");
    const dialogFooter = document.createElement("div");
    dialogFooter.classList.add("dcf-datepicker-dialog-footer", "dcf-d-flex", "dcf-flex-nowrap", "dcf-ai-center", "dcf-mt-1"), dialogFooter.append(dialogBtnGroup), dialogFooter.append(this.messageNode), this.dialogNode.append(dialogHeader), this.dialogNode.append(calendarTable), this.dialogNode.append(dialogFooter), this.datepicker.appendChild(this.dialogNode);
  }
  init() {
    this.textboxNode.addEventListener("blur", this.setDateForButtonLabel()), this.buttonNode.addEventListener("keydown", (event) => {
      this.handleButtonKeydown(event);
    }), this.buttonNode.addEventListener("click", (event) => {
      this.handleButtonClick(event);
    }), this.okButtonNode.addEventListener("click", (event) => {
      this.handleOkButton(event);
    }), this.okButtonNode.addEventListener("keydown", (event) => {
      this.handleOkButton(event);
    }), this.cancelButtonNode.addEventListener("click", (event) => {
      this.handleCancelButton(event);
    }), this.cancelButtonNode.addEventListener("keydown", (event) => {
      this.handleCancelButton(event);
    }), this.prevMonthNode.addEventListener("click", (event) => {
      this.handlePreviousMonthButton(event);
    }), this.nextMonthNode.addEventListener("click", (event) => {
      this.handleNextMonthButton(event);
    }), this.prevYearNode.addEventListener("click", (event) => {
      this.handlePreviousYearButton(event);
    }), this.nextYearNode.addEventListener("click", (event) => {
      this.handleNextYearButton(event);
    }), this.prevMonthNode.addEventListener("keydown", (event) => {
      this.handlePreviousMonthButton(event);
    }), this.nextMonthNode.addEventListener("keydown", (event) => {
      this.handleNextMonthButton(event);
    }), this.prevYearNode.addEventListener("keydown", (event) => {
      this.handlePreviousYearButton(event);
    }), this.nextYearNode.addEventListener("keydown", (event) => {
      this.handleNextYearButton(event);
    }), document.body.addEventListener("mouseup", (event) => {
      this.handleBackgroundMouseUp(event);
    }, !0), this.tbodyNode.innerHTML = "";
    for (let indexI = 0; indexI < this.int6; indexI++) {
      const row = this.tbodyNode.insertRow(indexI);
      this.lastRowNode = row;
      for (let indexJ = 0; indexJ < this.int7; indexJ++) {
        const cell = document.createElement("td");
        cell.tabIndex = this.intMinus1, cell.addEventListener("click", this.handleDayClick.bind(this)), cell.addEventListener("keydown", this.handleDayKeyDown.bind(this)), cell.addEventListener("focus", this.handleDayFocus.bind(this)), cell.textContent = "-1", row.appendChild(cell), this.days.push(cell);
      }
    }
    this.updateGrid(), this.close(!1), this.setDateForButtonLabel(), this.datepicker.classList.add("dcf-datepicker-initialized"), this.datepicker.removeAttribute("hidden"), this.datepicker.dispatchEvent(new CustomEvent(DCFDatepicker.events("datepickerReady"), {
      detail: {
        classInstance: this
      }
    }));
  }
  isSameDay(day1, day2) {
    return day1.getFullYear() === day2.getFullYear() && day1.getMonth() === day2.getMonth() && day1.getDate() === day2.getDate();
  }
  isNotSameMonth(day1, day2) {
    return day1.getFullYear() !== day2.getFullYear() || day1.getMonth() !== day2.getMonth();
  }
  updateGrid() {
    let flag = !1;
    const currentFocusDay = this.focusDay;
    this.monthYearNode.textContent = `${this.monthLabels[currentFocusDay.getMonth()]} ${currentFocusDay.getFullYear()}`;
    const firstDayOfMonth = new Date(currentFocusDay.getFullYear(), currentFocusDay.getMonth(), this.int1), dayOfWeek = firstDayOfMonth.getDay();
    firstDayOfMonth.setDate(firstDayOfMonth.getDate() - dayOfWeek);
    const fdom = new Date(firstDayOfMonth);
    for (let indexI = 0; indexI < this.days.length; indexI++)
      flag = fdom.getMonth() !== currentFocusDay.getMonth(), this.updateDate(this.days[indexI], flag, fdom, this.isSameDay(fdom, this.selectedDay)), fdom.setDate(fdom.getDate() + this.int1), indexI === 35 && (flag ? this.lastRowNode.style.visibility = "hidden" : this.lastRowNode.style.visibility = "visible");
  }
  updateDate(domNode, disable, day, selected) {
    let dayString = day.getDate().toString();
    day.getDate() <= 9 && (dayString = `0${dayString}`);
    let monthString = day.getMonth() + this.int1;
    day.getMonth() < 9 && (monthString = `0${monthString}`), domNode.tabIndex = this.intMinus1, domNode.removeAttribute("aria-selected"), domNode.setAttribute("data-date", `${day.getFullYear()}-${monthString}-${dayString}`), disable ? (domNode.classList.add("disabled"), domNode.textContent = "") : (domNode.classList.remove("disabled"), domNode.textContent = day.getDate(), selected && (domNode.setAttribute("aria-selected", "true"), domNode.tabIndex = this.int0));
  }
  moveFocusToDay(day) {
    const cfd = this.focusDay;
    this.focusDay = day, (cfd.getMonth() !== this.focusDay.getMonth() || cfd.getYear() !== this.focusDay.getYear()) && this.updateGrid(), this.setFocusDay();
  }
  setFocusDay(flagParam) {
    let flag = flagParam;
    typeof flag != "boolean" && (flag = !0);
    for (let indexI = 0; indexI < this.days.length; indexI++) {
      const dayNode = this.days[indexI], day = this.getDayFromDataDateAttribute(dayNode);
      dayNode.tabIndex = this.intMinus1, this.isSameDay(day, this.focusDay) && (dayNode.tabIndex = this.int0, flag && dayNode.focus());
    }
  }
  open() {
    this.dialogNode.setAttribute("aria-hidden", "false"), this.dialogNode.classList.remove("dcf-opacity-0", "dcf-invisible", "dcf-d-none"), this.dialogNode.classList.add("dcf-datepicker-dialog-is-open", "dcf-opacity-100"), this.getDateFromTextbox(), this.updateGrid();
  }
  isOpen() {
    return this.dialogNode.classList.contains("dcf-datepicker-dialog-is-open");
  }
  close(flagParam) {
    let flag = flagParam;
    typeof flag != "boolean" && (flag = !0), this.setMessage(""), this.dialogNode.setAttribute("aria-hidden", "true"), this.dialogNode.classList.remove("dcf-datepicker-dialog-is-open", "dcf-opacity-100"), this.dialogNode.classList.add("dcf-opacity-0");
    const dialogTransition = /* @__PURE__ */ __name(() => {
      this.dialogNode.removeEventListener("transitionend", dialogTransition), !this.isOpen() && !this.dialogNode.classList.contains("dcf-invisible") && this.dialogNode.classList.add("dcf-invisible", "dcf-d-none");
    }, "dialogTransition");
    this.dialogNode.addEventListener("transitionend", dialogTransition), flag && this.buttonNode.focus();
  }
  moveToNextYear() {
    this.focusDay.setFullYear(this.focusDay.getFullYear() + this.int1), this.updateGrid();
  }
  moveToPreviousYear() {
    this.focusDay.setFullYear(this.focusDay.getFullYear() - this.int1), this.updateGrid();
  }
  moveToNextMonth() {
    this.focusDay.setMonth(this.focusDay.getMonth() + this.int1), this.updateGrid();
  }
  moveToPreviousMonth() {
    this.focusDay.setMonth(this.focusDay.getMonth() - this.int1), this.updateGrid();
  }
  moveFocusToNextDay() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() + this.int1), this.moveFocusToDay(currentFocusDay);
  }
  moveFocusToNextWeek() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() + this.int7), this.moveFocusToDay(currentFocusDay);
  }
  moveFocusToPreviousDay() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() - this.int1), this.moveFocusToDay(currentFocusDay);
  }
  moveFocusToPreviousWeek() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() - this.int7), this.moveFocusToDay(currentFocusDay);
  }
  moveFocusToFirstDayOfWeek() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() - currentFocusDay.getDay()), this.moveFocusToDay(currentFocusDay);
  }
  moveFocusToLastDayOfWeek() {
    const currentFocusDay = new Date(this.focusDay);
    currentFocusDay.setDate(currentFocusDay.getDate() + (this.int6 - currentFocusDay.getDay())), this.moveFocusToDay(currentFocusDay);
  }
  // Day methods
  isDayDisabled(domNode) {
    return domNode.classList.contains("disabled");
  }
  getDayFromDataDateAttribute(domNode) {
    const parts = domNode.getAttribute("data-date").split("-");
    return new Date(parts[this.int0], this.parseInt(parts[this.int1]) - this.int1, parts[this.int2]);
  }
  // Textbox methods
  setTextboxDate(domNode) {
    let currentFocusDay = this.focusDay;
    domNode && (currentFocusDay = this.getDayFromDataDateAttribute(domNode), this.days.forEach((day) => {
      day === domNode ? day.setAttribute("aria-selected", "true") : day.removeAttribute("aria-selected");
    })), this.textboxNode.value = `${currentFocusDay.getMonth() + this.int1}/${currentFocusDay.getDate()}/${currentFocusDay.getFullYear()}`;
    const changeEvent = new Event("change");
    this.textboxNode.dispatchEvent(changeEvent), this.setDateForButtonLabel();
  }
  getDateFromTextbox() {
    const parts = this.textboxNode.value.split("/"), month = this.parseInt(parts[this.int0]), day = this.parseInt(parts[this.int1]);
    let year = this.parseInt(parts[this.int2]);
    parts.length === this.int3 && Number.isInteger(month) && Number.isInteger(day) && Number.isInteger(year) ? (year < 100 && (year = 2e3 + year), this.focusDay = new Date(year, month - this.int1, day), this.selectedDay = new Date(this.focusDay)) : (this.focusDay = /* @__PURE__ */ new Date(), this.selectedDay = new Date(this.int0, this.int0, this.int1));
  }
  setDateForButtonLabel() {
    const parts = this.textboxNode.value.split("/");
    if (parts.length === this.int3 && Number.isInteger(this.parseInt(parts[this.int0])) && Number.isInteger(this.parseInt(parts[this.int1])) && Number.isInteger(this.parseInt(parts[this.int2]))) {
      const day = new Date(
        this.parseInt(parts[this.int2]),
        this.parseInt(parts[this.int0]) - this.int1,
        this.parseInt(parts[this.int1])
      ), date = `${this.monthLabels[day.getMonth()]} ${day.getDate()}, ${day.getFullYear()}`, label = `${this.buttonLabelChange}, ${this.dayLabels[day.getDay()]} ${date}`;
      this.buttonNode.setAttribute("aria-label", label);
    } else
      this.buttonNode.setAttribute("aria-label", this.buttonLabelChoose);
  }
  setMessage(str) {
    const setMessageDelayed = /* @__PURE__ */ __name(() => {
      this.messageNode.innerHTML = str;
    }, "setMessageDelayed");
    str !== this.lastMessage && (setTimeout(setMessageDelayed(), 200), this.lastMessage = str);
  }
  // Event handlers
  handleOkButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Tab":
            event.shiftKey || (this.prevYearNode.focus(), flag = !0);
            break;
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.setTextboxDate(), this.close(), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handleCancelButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.close(), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handleNextYearButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          case "Enter":
            this.moveToNextYear(), this.setFocusDay(!1), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.moveToNextYear(), this.setFocusDay(!1), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handlePreviousYearButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Enter":
            this.moveToPreviousYear(), this.setFocusDay(!1), flag = !0;
            break;
          case "Tab":
            event.shiftKey && (this.okButtonNode.focus(), flag = !0);
            break;
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.moveToPreviousYear(), this.setFocusDay(!1), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handleNextMonthButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          case "Enter":
            this.moveToNextMonth(), this.setFocusDay(!1), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.moveToNextMonth(), this.setFocusDay(!1), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handlePreviousMonthButton(event) {
    let flag = !1;
    switch (event.type) {
      case "keydown":
        switch (event.key) {
          case "Esc":
          case "Escape":
            this.close(), flag = !0;
            break;
          case "Enter":
            this.moveToPreviousMonth(), this.setFocusDay(!1), flag = !0;
            break;
          default:
            flag = !1;
            break;
        }
        break;
      case "click":
        this.moveToPreviousMonth(), this.setFocusDay(!1), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handleDayKeyDown(event) {
    let flag = !1;
    switch (event.key) {
      case "Esc":
      case "Escape":
        this.close();
        break;
      case " ":
        this.setTextboxDate(event.currentTarget), flag = !0;
        break;
      case "Enter":
        this.setTextboxDate(event.currentTarget), this.close(), flag = !0;
        break;
      case "Tab":
        this.cancelButtonNode.focus(), event.shiftKey && this.nextYearNode.focus(), this.setMessage(""), flag = !0;
        break;
      case "Right":
      case "ArrowRight":
        this.moveFocusToNextDay(), flag = !0;
        break;
      case "Left":
      case "ArrowLeft":
        this.moveFocusToPreviousDay(), flag = !0;
        break;
      case "Down":
      case "ArrowDown":
        this.moveFocusToNextWeek(), flag = !0;
        break;
      case "Up":
      case "ArrowUp":
        this.moveFocusToPreviousWeek(), flag = !0;
        break;
      case "PageUp":
        event.shiftKey ? this.moveToPreviousYear() : this.moveToPreviousMonth(), this.setFocusDay(), flag = !0;
        break;
      case "PageDown":
        event.shiftKey ? this.moveToNextYear() : this.moveToNextMonth(), this.setFocusDay(), flag = !0;
        break;
      case "Home":
        this.moveFocusToFirstDayOfWeek(), flag = !0;
        break;
      case "End":
        this.moveFocusToLastDayOfWeek(), flag = !0;
        break;
      default:
        flag = !1;
        break;
    }
    flag && (event.stopPropagation(), event.preventDefault());
  }
  handleDayClick(event) {
    this.isDayDisabled(event.currentTarget) || (this.setTextboxDate(event.currentTarget), this.close()), event.stopPropagation(), event.preventDefault();
  }
  handleDayFocus() {
    this.setMessage(this.messageCursorKeys);
  }
  handleButtonKeydown(event) {
    (event.key === "Enter" || event.key === " ") && (this.open(), this.setFocusDay(), event.stopPropagation(), event.preventDefault());
  }
  handleButtonClick(event) {
    this.isOpen() ? this.close() : (this.open(), this.setFocusDay()), event.stopPropagation(), event.preventDefault();
  }
  handleBackgroundMouseUp(event) {
    !this.buttonNode.contains(event.target) && !this.dialogNode.contains(event.target) && this.isOpen() && (this.close(!1), event.stopPropagation(), event.preventDefault());
  }
}
class UNLDatepicker extends DCFDatepicker {
  static {
    __name(this, "UNLDatepicker");
  }
  constructor(datepicker, options = {}) {
    super(datepicker, options), window.UNL = window.UNL || {}, window.UNL.classes = window.UNL.classes || {}, window.UNL.classes[this.datepicker.getAttribute("id")] = this, this.datepicker.dispatchEvent(new Event("UNLClassReady"));
  }
}
export {
  UNLDatepicker as default
};
//# sourceMappingURL=component.datepicker.js.map
