import{r as t,h as i}from"./p-52e3bb32.js";import{_ as e}from"./p-08cf2c0e.js";import{T as s}from"./p-b0e88537.js";const a=class{constructor(i){t(this,i),this.formatedDate=void 0,this.datetime=void 0,this.afDateTime=void 0,this.afVariation=s.PRIMARY,this.afLocale="default"}primaryFormat(t){return t.toLocaleString(this.afLocale,{year:"numeric",month:"2-digit",day:"2-digit"})}prettyFormat(t){return t.toLocaleString(this.afLocale,{day:"numeric",month:"long",year:"numeric"})}distanceFormat(t){const i=864e5,s=Math.floor(Date.now()-t.getTime());let a=Math.floor(s/i);return a=Math.abs(a),s>i?e.time.days_ago(a):s<i?0===a?e.today:e.time.in_days(a):void 0}formatDate(t){const i=new Date(t);switch(this.afVariation){case s.PRIMARY:this.formatedDate=this.primaryFormat(i);break;case s.PRETTY:this.formatedDate=this.prettyFormat(i);break;case s.DISTANCE:this.formatedDate=this.distanceFormat(i)}this.datetime=this.primaryFormat(i)}componentWillLoad(){this.formatDate(this.afDateTime)}render(){return i("time",{key:"d078e4f1cdc123ea93af44910f116ad539a2088e",dateTime:this.datetime,class:"digi-typography-time"},this.formatedDate)}static get watchers(){return{afDateTime:["formatDate"]}}};export{a as digi_typography_time}