export const __rspack_esm_id=91474;export const __rspack_esm_ids=[91474];export const __webpack_modules__={23724(t,e,i){i.d(e,{},{z:t=>{if(void 0===t)return;if("object"!=typeof t){if("string"==typeof t||isNaN(t)){const e=t?.toString().split(":")||[];if(1===e.length)return{seconds:Number(e[0])};if(e.length>3)return;const i=Number(e[2])||0,s=Math.floor(i);return{hours:Number(e[0])||0,minutes:Number(e[1])||0,seconds:s,milliseconds:Math.floor(1e3*Number((i-s).toFixed(4)))}}return{seconds:t}}if(!("days"in t))return t;const{days:e,minutes:i,seconds:s,milliseconds:a}=t;let n=t.hours||0;return n=(n||0)+24*(e||0),{hours:n,minutes:i,seconds:s,milliseconds:a}}})},19058(t,e,i){i(18111),i(61701);function s(t){const e=t.split(":").map(Number);return 3600*e[0]+60*e[1]+e[2]}i.d(e,{A:()=>s},{v:t=>86400*(t.days||0)+3600*(t.hours||0)+60*(t.minutes||0)+(t.seconds||0)+(t.milliseconds||0)/1e3})},52372(t,e,i){const s=t=>t<10?`0${t}`:t;function a(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60),a=Math.floor(t%3600%60);return e>0?`${e}:${s(i)}:${s(a)}`:i>0?`${i}:${s(a)}`:a>0?""+a:null}i.d(e,{A:()=>a})},33668(t,e,i){var s=i(23724),a=i(19058),n=i(52372);i.d(e,{},{CR:(t,e)=>t.callWS({type:"timer/create",...e}),GV:t=>(0,s.z)(t.attributes.duration),PF:(t,e,i)=>{if(!e)return null;if("idle"===e.state||0===i)return t.formatEntityState(e);let s=(0,n.A)(i||0)||"0";return"paused"===e.state&&(s=`${s} (${t.formatEntityState(e)})`),s},kL:t=>t.callWS({type:"timer/list"}),ls:t=>{if(!t.attributes.remaining)return;let e=(0,a.A)(t.attributes.remaining);if("active"===t.state){const i=(new Date).getTime(),s=new Date(t.attributes.finishes_at).getTime();e=Math.max((s-i)/1e3,0)}return e},pZ:(t,e)=>t.callWS({type:"timer/delete",timer_id:e}),r9:(t,e,i)=>t.callWS({type:"timer/update",timer_id:e,...i})})},69385(t,e,i){i.r(e);var s=i(15697),a=i(57527),n=i(79224),r=i(33668);class l extends a.mN{createRenderRoot(){return this}update(t){super.update(t),this.innerHTML=(0,r.PF)(this.hass,this.stateObj,this.timeRemaining)??"-"}connectedCallback(){super.connectedCallback(),this.stateObj&&this._startInterval(this.stateObj)}disconnectedCallback(){super.disconnectedCallback(),this._clearInterval()}willUpdate(t){super.willUpdate(t),t.has("stateObj")&&this._startInterval(this.stateObj)}_clearInterval(){this._updateRemaining&&(clearInterval(this._updateRemaining),this._updateRemaining=null)}_startInterval(t){this._clearInterval(),this._calculateRemaining(t),"active"===t.state&&(this._updateRemaining=setInterval(()=>this._calculateRemaining(this.stateObj),1e3))}_calculateRemaining(t){this.timeRemaining=(0,r.ls)(t)}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"stateObj",void 0),(0,s.Cg)([(0,n.wk)()],l.prototype,"timeRemaining",void 0),l=(0,s.Cg)([(0,n.EM)("ha-timer-remaining-time")],l)}};
//# sourceMappingURL=91474.e70073459ff67a4d.js.map