import{__decorate as t}from"tslib";import{html as e}from"lit";import{property as i,customElement as o}from"lit/decorators.js";import{s as r}from"./nile-format-date.css.esm.js";import{N as a}from"../internal/nile-element.esm.js";import"../internal/accessibility/a11y.state.enum.esm.js";import"../internal/accessibility/a11y.property.enum.esm.js";import"../internal/accessibility/role.enum.esm.js";let s=class extends a{constructor(){super(...arguments),this.date=new Date,this.hourFormat="auto",this.dateSeparator="-"}static get styles(){return[r]}formatDate(t,e){t=new Date(t);return new Intl.DateTimeFormat("en-GB",e).formatToParts(t).map((({type:t,value:e})=>"day"===t||"month"===t||"year"===t?e:"literal"===t&&"/"===e?this.dateSeparator:e)).join("")}render(){const t=new Date(this.date),i="auto"===this.hourFormat?void 0:"12"===this.hourFormat;if(!isNaN(t.getMilliseconds()))return e`
      <time datetime=${t.toISOString()}>
        ${this.formatDate(t,{weekday:this.weekday,era:this.era,year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second,timeZoneName:this.timeZoneName,timeZone:this.timeZone,hour12:i})}
      </time>
    `}};t([i()],s.prototype,"date",void 0),t([i()],s.prototype,"weekday",void 0),t([i()],s.prototype,"era",void 0),t([i()],s.prototype,"year",void 0),t([i()],s.prototype,"month",void 0),t([i()],s.prototype,"day",void 0),t([i()],s.prototype,"hour",void 0),t([i()],s.prototype,"minute",void 0),t([i()],s.prototype,"second",void 0),t([i({attribute:"time-zone-name"})],s.prototype,"timeZoneName",void 0),t([i({attribute:"time-zone"})],s.prototype,"timeZone",void 0),t([i({attribute:"hour-format"})],s.prototype,"hourFormat",void 0),t([i({attribute:"date-separator"})],s.prototype,"dateSeparator",void 0),s=t([o("nile-format-date")],s);export{s as N};
