"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["5864"],{47899:function(e,t,a){a.a(e,(async function(e,i){try{a.d(t,{Bt:function(){return d}});a(19083);var n=a(16485),s=a(88977),o=a(50177),r=e([n]);n=(r.then?(await r)():r)[0];const l=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],d=e=>e.first_weekday===o.FS.language?"weekInfo"in Intl.Locale.prototype?new Intl.Locale(e.language).weekInfo.firstDay%7:(0,s.L)(e.language)%7:l.includes(e.first_weekday)?l.indexOf(e.first_weekday):1;i()}catch(l){i(l)}}))},823:function(e,t,a){a.a(e,(async function(e,i){try{a.d(t,{Vu:function(){return h},Zs:function(){return v},mr:function(){return d},xO:function(){return f}});var n=a(16485),s=a(27486),o=a(70691),r=a(51873),l=e([n,o]);[n,o]=l.then?(await l)():l;const d=(e,t,a)=>c(t,a.time_zone).format(e),c=(0,s.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,r.y)(e)?"h12":"h23",timeZone:(0,o.f)(e.time_zone,t)}))),h=(e,t,a)=>u(t,a.time_zone).format(e),u=(0,s.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,r.y)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,r.y)(e)?"h12":"h23",timeZone:(0,o.f)(e.time_zone,t)}))),f=(e,t,a)=>m(t,a.time_zone).format(e),m=(0,s.Z)(((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,r.y)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,r.y)(e)?"h12":"h23",timeZone:(0,o.f)(e.time_zone,t)}))),v=(e,t,a)=>y(t,a.time_zone).format(e),y=(0,s.Z)(((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,o.f)(e.time_zone,t)})));i()}catch(d){i(d)}}))},70691:function(e,t,a){a.a(e,(async function(e,i){try{a.d(t,{f:function(){return u}});var n,s,o,r=a(16485),l=a(50177),d=e([r]);r=(d.then?(await d)():d)[0];const c=null===(n=Intl.DateTimeFormat)||void 0===n||null===(s=(o=n.call(Intl)).resolvedOptions)||void 0===s?void 0:s.call(o).timeZone,h=null!=c?c:"UTC",u=(e,t)=>e===l.c_.local&&c?h:t;i()}catch(c){i(c)}}))},51873:function(e,t,a){a.d(t,{y:function(){return s}});a(19083),a(61006);var i=a(27486),n=a(50177);const s=(0,i.Z)((e=>{if(e.time_format===n.zt.language||e.time_format===n.zt.system){const t=e.time_format===n.zt.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===n.zt.am_pm}))},77595:function(e,t,a){a.a(e,(async function(e,i){try{a.r(t);var n=a(73577),s=a(72621),o=(a(71695),a(92745),a(19423),a(23669),a(40251),a(39527),a(41360),a(47021),a(95559)),r=a(33297),l=a(70001),d=a(46834),c=a(63454),h=a(28866),u=a(32424),f=a(97836),m=a(57243),v=a(50778),y=a(47899),g=a(823),_=a(51873),k=a(11297),p=(a(70596),a(32851)),b=a(50177),w=a(96545),B=a(66193),O=e([d,l,o,y,g]);[d,l,o,y,g]=O.then?(await O)():O;let $,S,Z=e=>e;const C={plugins:[d.Z,l.ZP],headerToolbar:!1,initialView:"timeGridWeek",editable:!0,selectable:!0,selectMirror:!0,selectOverlap:!1,eventOverlap:!1,allDaySlot:!1,height:"parent",locales:r.Z,firstDay:1,dayHeaderFormat:{weekday:"short",month:void 0,day:void 0}};(0,n.Z)([(0,v.Mo)("ha-schedule-form")],(function(e,t){class a extends t{constructor(...t){super(...t),e(this)}}return{F:a,d:[{kind:"field",decorators:[(0,v.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,v.Cb)({type:Boolean})],key:"new",value(){return!1}},{kind:"field",decorators:[(0,v.SB)()],key:"_name",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_icon",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_monday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_tuesday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_wednesday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_thursday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_friday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_saturday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"_sunday",value:void 0},{kind:"field",decorators:[(0,v.SB)()],key:"calendar",value:void 0},{kind:"field",key:"_item",value:void 0},{kind:"set",key:"item",value:function(e){this._item=e,e?(this._name=e.name||"",this._icon=e.icon||"",this._monday=e.monday||[],this._tuesday=e.tuesday||[],this._wednesday=e.wednesday||[],this._thursday=e.thursday||[],this._friday=e.friday||[],this._saturday=e.saturday||[],this._sunday=e.sunday||[]):(this._name="",this._icon="",this._monday=[],this._tuesday=[],this._wednesday=[],this._thursday=[],this._friday=[],this._saturday=[],this._sunday=[])}},{kind:"method",key:"disconnectedCallback",value:function(){var e,t;(0,s.Z)(a,"disconnectedCallback",this,3)([]),null===(e=this.calendar)||void 0===e||e.destroy(),this.calendar=void 0,null===(t=this.renderRoot.querySelector("style[data-fullcalendar]"))||void 0===t||t.remove()}},{kind:"method",key:"connectedCallback",value:function(){(0,s.Z)(a,"connectedCallback",this,3)([]),this.hasUpdated&&!this.calendar&&this._setupCalendar()}},{kind:"method",key:"focus",value:function(){this.updateComplete.then((()=>{var e;return null===(e=this.shadowRoot)||void 0===e||null===(e=e.querySelector("[dialogInitialFocus]"))||void 0===e?void 0:e.focus()}))}},{kind:"method",key:"render",value:function(){return this.hass?(0,m.dy)($||($=Z`
`),this._name,"name",this._valueChanged,this.hass.localize("ui.dialogs.helper_settings.generic.name"),this.hass.localize("ui.dialogs.helper_settings.required_error_msg"),this.hass,this._icon,"icon",this._valueChanged,this.hass.localize("ui.dialogs.helper_settings.generic.icon")):m.Ld}},{kind:"method",key:"willUpdate",value:function(e){if((0,s.Z)(a,"willUpdate",this,3)([e]),!this.calendar)return;(e.has("_sunday")||e.has("_monday")||e.has("_tuesday")||e.has("_wednesday")||e.has("_thursday")||e.has("_friday")||e.has("_saturday")||e.has("calendar"))&&(this.calendar.removeAllEventSources(),this.calendar.addEventSource(this._events));const t=e.get("hass");t&&t.language!==this.hass.language&&this.calendar.setOption("locale",this.hass.language)}},{kind:"method",key:"firstUpdated",value:function(){this._setupCalendar()}},{kind:"method",key:"_setupCalendar",value:function(){const e=Object.assign(Object.assign({},C),{},{locale:this.hass.language,firstDay:(0,y.Bt)(this.hass.locale),slotLabelFormat:{hour:"numeric",minute:void 0,hour12:(0,_.y)(this.hass.locale),meridiem:!!(0,_.y)(this.hass.locale)&&"narrow"},eventTimeFormat:{hour:(0,_.y)(this.hass.locale)?"numeric":"2-digit",minute:(0,_.y)(this.hass.locale)?"numeric":"2-digit",hour12:(0,_.y)(this.hass.locale),meridiem:!!(0,_.y)(this.hass.locale)&&"narrow"}});e.eventClick=e=>this._handleEventClick(e),e.select=e=>this._handleSelect(e),e.eventResize=e=>this._handleEventResize(e),e.eventDrop=e=>this._handleEventDrop(e),this.calendar=new o.f(this.shadowRoot.getElementById("calendar"),e),this.calendar.render()}},{kind:"get",key:"_events",value:function(){const e=[];for(const[t,a]of p.KY.entries())this[`_${a}`].length&&this[`_${a}`].forEach(((i,n)=>{let s=(0,c.O)(new Date,t);(0,h.x)(s,new Date,{weekStartsOn:(0,y.Bt)(this.hass.locale)})||(s=(0,u.E)(s,-7));const o=new Date(s),r=i.from.split(":");o.setHours(parseInt(r[0]),parseInt(r[1]),0,0);const l=new Date(s),d=i.to.split(":");l.setHours(parseInt(d[0]),parseInt(d[1]),0,0),e.push({id:`${a}-${n}`,start:o.toISOString(),end:l.toISOString()})}));return e}},{kind:"method",key:"_handleSelect",value:function(e){const{start:t,end:a}=e,i=p.KY[t.getDay()],n=[...this[`_${i}`]],s=Object.assign({},this._item),o=(0,g.Zs)(a,Object.assign(Object.assign({},this.hass.locale),{},{time_zone:b.c_.local}),this.hass.config);n.push({from:(0,g.Zs)(t,Object.assign(Object.assign({},this.hass.locale),{},{time_zone:b.c_.local}),this.hass.config),to:(0,f.K)(t,a)&&"0:00"!==o?o:"24:00"}),s[i]=n,(0,k.B)(this,"value-changed",{value:s}),(0,f.K)(t,a)||this.calendar.unselect()}},{kind:"method",key:"_handleEventResize",value:function(e){const{id:t,start:a,end:i}=e.event,[n,s]=t.split("-"),o=this[`_${n}`][parseInt(s)],r=Object.assign({},this._item),l=(0,g.Zs)(i,this.hass.locale,this.hass.config);r[n][s]=Object.assign(Object.assign({},r[n][s]),{},{from:o.from,to:(0,f.K)(a,i)&&"0:00"!==l?l:"24:00"}),(0,k.B)(this,"value-changed",{value:r}),(0,f.K)(a,i)||(this.requestUpdate(`_${n}`),e.revert())}},{kind:"method",key:"_handleEventDrop",value:function(e){const{id:t,start:a,end:i}=e.event,[n,s]=t.split("-"),o=p.KY[a.getDay()],r=Object.assign({},this._item),l=(0,g.Zs)(i,this.hass.locale,this.hass.config),d=Object.assign(Object.assign({},r[n][s]),{},{from:(0,g.Zs)(a,this.hass.locale,this.hass.config),to:(0,f.K)(a,i)&&"0:00"!==l?l:"24:00"});if(o===n)r[n][s]=d;else{r[n].splice(s,1);const e=[...this[`_${o}`]];e.push(d),r[o]=e}(0,k.B)(this,"value-changed",{value:r}),(0,f.K)(a,i)||(this.requestUpdate(`_${n}`),e.revert())}},{kind:"method",key:"_handleEventClick",value:async function(e){const[t,a]=e.event.id.split("-"),i=[...this[`_${t}`]][a];(0,w.F)(this,{block:i,updateBlock:e=>this._updateBlock(t,a,e),deleteBlock:()=>this._deleteBlock(t,a)})}},{kind:"method",key:"_updateBlock",value:function(e,t,a){const[i,n,s]=a.from.split(":");a.from=`${i}:${n}`;const[o,r,l]=a.to.split(":");a.to=`${o}:${r}`,0===Number(o)&&0===Number(r)&&(a.to="24:00");const d=Object.assign({},this._item);d[e]=[...this._item[e]],d[e][t]=a,(0,k.B)(this,"value-changed",{value:d})}},{kind:"method",key:"_deleteBlock",value:function(e,t){const a=[...this[`_${e}`]],i=Object.assign({},this._item);a.splice(parseInt(t),1),i[e]=a,(0,k.B)(this,"value-changed",{value:i})}},{kind:"method",key:"_valueChanged",value:function(e){var t;if(!this.new&&!this._item)return;e.stopPropagation();const a=e.target.configValue,i=(null===(t=e.detail)||void 0===t?void 0:t.value)||e.target.value;if(this[`_${a}`]===i)return;const n=Object.assign({},this._item);i?n[a]=i:delete n[a],(0,k.B)(this,"value-changed",{value:n})}},{kind:"get",static:!0,key:"styles",value:function(){return[B.Qx,(0,m.iv)(S||(S=Z`.form{color:var(--primary-text-color)}ha-textfield{display:block;margin:8px 0}#calendar{margin:8px 0;height:450px;width:100%;-webkit-user-select:none;-ms-user-select:none;user-select:none;--fc-border-color:var(--divider-color);--fc-event-border-color:var(--divider-color)}.fc-v-event .fc-event-time{white-space:inherit}.fc-theme-standard .fc-scrollgrid{border:1px solid var(--divider-color);border-radius:var(--mdc-shape-small,4px)}.fc-scrollgrid-section-header td{border:none}:host([narrow]) .fc-scrollgrid-sync-table{overflow:hidden}table.fc-scrollgrid-sync-table tbody tr:first-child .fc-daygrid-day-top{padding-top:0}.fc-scroller::-webkit-scrollbar{width:.4rem;height:.4rem}.fc-scroller::-webkit-scrollbar-thumb{-webkit-border-radius:4px;border-radius:4px;background:var(--scrollbar-thumb-color)}.fc-scroller{overflow-y:auto;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:thin}.fc-timegrid-event-short .fc-event-time:after{content:""}a{color:inherit!important}th.fc-col-header-cell.fc-day{background-color:var(--table-header-background-color);color:var(--primary-text-color);font-size:11px;font-weight:700;text-transform:uppercase}`))]}}]}}),m.oi);i()}catch($){i($)}}))},96545:function(e,t,a){a.d(t,{F:function(){return s}});a(71695),a(40251),a(47021);var i=a(11297);const n=()=>a.e("317").then(a.bind(a,58202)),s=(e,t)=>{(0,i.B)(e,"show-dialog",{dialogTag:"dialog-schedule-block-info",dialogImport:n,dialogParams:t})}}}]);
//# sourceMappingURL=5864.155e6c0328dd33b2.js.map