import {
  __decorateClass
} from "../../../chunks/chunk.QU3DSPNU.js";
import { property } from "lit/decorators.js";
import { gdsCustomElement } from "../../../utils/helpers/custom-element-scoping.js";
import { GdsFormattedText } from "../formatted-text.js";
import { dateTimeFormats } from "./date-time-formatter.js";
let GdsFormattedDate = class extends GdsFormattedText {
  constructor() {
    super(...arguments);
    this.format = "dateOnlyNumbers";
  }
  get formattedValue() {
    if (this.format && this.format in dateTimeFormats) {
      return dateTimeFormats[this.format](
        this.value ?? this.element?.textContent ?? void 0,
        this.locale
      );
    }
    return this.value?.toString() ?? "";
  }
  firstUpdated(_changedProperties) {
    super.firstUpdated(_changedProperties);
    if (!this.value && this.textContent) {
      this.value = this.textContent;
    }
  }
};
__decorateClass([
  property({ attribute: false })
], GdsFormattedDate.prototype, "value", 2);
__decorateClass([
  property({ type: String })
], GdsFormattedDate.prototype, "format", 2);
__decorateClass([
  property({ type: String })
], GdsFormattedDate.prototype, "locale", 2);
GdsFormattedDate = __decorateClass([
  gdsCustomElement("gds-formatted-date")
], GdsFormattedDate);
export {
  GdsFormattedDate
};
