iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
22 lines • 74.3 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[93303],{91069:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{EO:function(){return w},Yq:function(){return x},_U:function(){return C},eE:function(){return k},fU:function(){return $},ol:function(){return b},xo:function(){return y}});var o=i(78016),n=i(31810),r=i(87950),s=i(81977),c=i(36307),l=i(35932),d=i(73983),u=i(6946),h=i(92913),p=i(83339),g=i(77972),m=i(31886),_=i(46927),f=e([m]);m=(f.then?(await f)():f)[0];const v=(e,t,i,a)=>{const o=i(new m.BB(e,t),a);return o instanceof Date?new Date(o.getTime()):o},b=(e,t,i,a,o)=>i.time_zone===_.Wj.server?v(e,a.time_zone,t,o):t(e,o),y=(e,t,i,a,o)=>i.time_zone===_.Wj.server?v(e,a.time_zone,t,o):t(e,o),w=(e,t,i,a,o)=>y(e,i,a,o,a.time_zone===_.Wj.server?new m.BB(t,o.time_zone):t),k=(e,t,i,a,m)=>{let _,f;if(y(e,o.e,a,m)&&y(t,n.c,a,m)){const o=(w(t,e,r.W,a,m)+1)*(i?1:-1);_=b(e,s.P,a,m,o),f=b(b(t,s.P,a,m,o),c.p,a,m)}else if(y(e,e=>(0,l.o)(e).getMilliseconds()===e.getMilliseconds(),a,m)&&y(t,e=>(0,d.D)(e).getMilliseconds()===e.getMilliseconds(),a,m)){const o=(w(t,e,u.c,a,m)+1)*(i?1:-1);_=b(e,h.f,a,m,o),f=b(t,h.f,a,m,o)}else{const o=w(t,e,p.b,a,m)*(i?1:-1);_=b(e,g.A,a,m,o),f=b(t,g.A,a,m,o)}return{start:_,end:f}},C=(e,t)=>{const i=new m.BB(e,t);return new Date(i.getTime())},x=(e,t)=>new m.BB(e,t).toISOString().split("T")[0],$=(e,t)=>new m.BB(e,t).toISOString().split("T")[1].split(".")[0];a()}catch(v){a(v)}})},46223:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{b:function(){return w}});var o=i(35932),n=i(73983),r=i(92913),s=i(52640),c=i(69137),l=i(35660),d=i(36307),u=i(11650),h=i(15797),p=i(33977),g=i(69748),m=i(55144),_=i(21828),f=i(66708),v=i(91069),b=i(380),y=e([b,v]);[b,v]=y.then?(await y)():y;const w=(e,t,i)=>{const a=new Date,y=(0,b.P)(e);switch(i){case"today":return[(0,v.ol)(a,o.o,e,t,{weekStartsOn:y}),(0,v.ol)(a,n.D,e,t,{weekStartsOn:y})];case"yesterday":return[(0,v.ol)((0,r.f)(a,-1),o.o,e,t,{weekStartsOn:y}),(0,v.ol)((0,r.f)(a,-1),n.D,e,t,{weekStartsOn:y})];case"this_week":return[(0,v.ol)(a,s.k,e,t,{weekStartsOn:y}),(0,v.ol)(a,c.$,e,t,{weekStartsOn:y})];case"this_month":return[(0,v.ol)(a,l.w,e,t),(0,v.ol)(a,d.p,e,t)];case"this_quarter":return[(0,v.ol)(a,u.a,e,t),(0,v.ol)(a,h.j,e,t)];case"this_year":return[(0,v.ol)(a,p.D,e,t),(0,v.ol)(a,g.Q,e,t)];case"now-7d":return[(0,v.ol)(a,m.e,e,t,7),(0,v.ol)(a,m.e,e,t,0)];case"now-30d":return[(0,v.ol)(a,m.e,e,t,30),(0,v.ol)(a,m.e,e,t,0)];case"now-12m":return[(0,v.ol)(a,e=>(0,_.a)((0,l.w)(e),11),e,t),(0,v.ol)(a,d.p,e,t)];case"now-365d":return[(0,v.ol)(a,m.e,e,t,365),(0,v.ol)(a,m.e,e,t,0)];case"now-1h":return[(0,v.ol)(a,f.O,e,t,1),(0,v.ol)(a,f.O,e,t,0)];case"now-12h":return[(0,v.ol)(a,f.O,e,t,12),(0,v.ol)(a,f.O,e,t,0)];case"now-24h":return[(0,v.ol)(a,f.O,e,t,24),(0,v.ol)(a,f.O,e,t,0)]}return[a,a]};a()}catch(w){a(w)}})},72487:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{CA:function(){return $},Mi:function(){return I},Pm:function(){return C},Wq:function(){return b},Yq:function(){return l},bl:function(){return T},c2:function(){return w},fr:function(){return f},gu:function(){return S},kz:function(){return u},m9:function(){return j},sl:function(){return m},ur:function(){return z},zB:function(){return p}});i(18111),i(20116);var o=i(74487),n=i(22786),r=i(46927),s=i(8480),c=e([o,s]);[o,s]=c.then?(await c)():c;(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)}));const l=(e,t,i)=>d(t,i.time_zone).format(e),d=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),u=(e,t,i)=>h(t,i.time_zone).format(e),h=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),p=(e,t,i)=>{var a,o,n,s;const c=g(t,i.time_zone);if(t.date_format===r.ow.language||t.date_format===r.ow.system)return c.format(e);const l=c.formatToParts(e),d=null===(a=l.find(e=>"literal"===e.type))||void 0===a?void 0:a.value,u=null===(o=l.find(e=>"day"===e.type))||void 0===o?void 0:o.value,h=null===(n=l.find(e=>"month"===e.type))||void 0===n?void 0:n.value,p=null===(s=l.find(e=>"year"===e.type))||void 0===s?void 0:s.value,m=l[l.length-1];let _="literal"===(null==m?void 0:m.type)?null==m?void 0:m.value:"";"bg"===t.language&&t.date_format===r.ow.YMD&&(_="");return{[r.ow.DMY]:`${u}${d}${h}${d}${p}${_}`,[r.ow.MDY]:`${h}${d}${u}${d}${p}${_}`,[r.ow.YMD]:`${p}${d}${h}${d}${u}${_}`}[t.date_format]},g=(0,n.A)((e,t)=>{const i=e.date_format===r.ow.system?void 0:e.language;return e.date_format===r.ow.language||(e.date_format,r.ow.system),new Intl.DateTimeFormat(i,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})}),m=(e,t,i)=>_(t,i.time_zone).format(e),_=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{day:"numeric",month:"short",timeZone:(0,s.wj)(e.time_zone,t)})),f=(e,t,i)=>v(t,i.time_zone).format(e),v=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),b=(e,t,i)=>y(t,i.time_zone).format(e),y=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",timeZone:(0,s.wj)(e.time_zone,t)})),w=(e,t,i)=>k(t,i.time_zone).format(e),k=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"short",timeZone:(0,s.wj)(e.time_zone,t)})),C=(e,t,i)=>x(t,i.time_zone).format(e),x=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),$=(e,t,i)=>M(t,i.time_zone).format(e),M=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",timeZone:(0,s.wj)(e.time_zone,t)})),S=(e,t,i)=>L(t,i.time_zone).format(e),L=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",timeZone:(0,s.wj)(e.time_zone,t)})),I=(e,t,i)=>E(t,i.time_zone).format(e),E=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",month:"short",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),z=(e,t,i)=>D(t,i.time_zone).format(e),D=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",month:"short",day:"numeric",year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),T=(e,t,i)=>{const a=(0,s.wj)(t.time_zone,i.time_zone);return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:a}).format(e)},j=(e,t,i,a)=>`${T(e,i,a)}/${T(t,i,a)}`;a()}catch(l){a(l)}})},82591:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{E2:function(){return p},Z8:function(){return g},a3:function(){return v},i:function(){return u},nR:function(){return l}});i(16280);var o=i(74487),n=i(22786),r=i(79791),s=e([o]);o=(s.then?(await s)():s)[0];const c=e=>e<10?`0${e}`:e,l=(e,t)=>{const i=t.days||0,a=t.hours||0,o=t.minutes||0,n=t.seconds||0,r=t.milliseconds||0;return i>0?`${Intl.NumberFormat(e.language,{style:"unit",unit:"day",unitDisplay:"long"}).format(i)} ${a}:${c(o)}:${c(n)}`:a>0?`${a}:${c(o)}:${c(n)}`:o>0?`${o}:${c(n)}`:n>0?Intl.NumberFormat(e.language,{style:"unit",unit:"second",unitDisplay:"long"}).format(n):r>0?Intl.NumberFormat(e.language,{style:"unit",unit:"millisecond",unitDisplay:"long"}).format(r):null},d=(0,n.A)(e=>new Intl.DurationFormat(e.language,{style:"long"})),u=(e,t)=>d(e).format(t),h=(0,n.A)(e=>new Intl.DurationFormat(e.language,{style:"digital",hoursDisplay:"auto"})),p=(e,t)=>h(e).format(t),g=["min","h","d"],m=(0,n.A)(e=>new Intl.DurationFormat(e.language,{style:"narrow",daysDisplay:"always"})),_=(0,n.A)(e=>new Intl.DurationFormat(e.language,{style:"narrow",hoursDisplay:"always"})),f=(0,n.A)(e=>new Intl.DurationFormat(e.language,{style:"narrow",minutesDisplay:"always"})),v=(e,t,i,a)=>{const o=void 0!==a?(0,r.L)(parseFloat(t),a):parseFloat(t);switch(i){case"d":{const t=Math.floor(o),i={days:t,hours:Math.floor(24*(o-t))};return m(e).format(i)}case"h":{const t=Math.floor(o),i={hours:t,minutes:Math.floor(60*(o-t))};return _(e).format(i)}case"min":{const t=Math.floor(o),i={minutes:t,seconds:Math.floor(60*(o-t))};return f(e).format(i)}default:throw new Error("Invalid duration unit")}};a()}catch(c){a(c)}})},30162:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{LW:function(){return m},Xs:function(){return p},fU:function(){return l},ie:function(){return u}});var o=i(74487),n=i(22786),r=i(8480),s=i(69543),c=e([o,r]);[o,r]=c.then?(await c)():c;const l=(e,t,i)=>d(t,i.time_zone).format(e),d=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),u=(e,t,i)=>h(t,i.time_zone).format(e),h=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),p=(e,t,i)=>g(t,i.time_zone).format(e),g=(0,n.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),m=(e,t,i)=>_(t,i.time_zone).format(e),_=(0,n.A)((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,r.wj)(e.time_zone,t)}));a()}catch(l){a(l)}})},98975:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{K:function(){return l}});var o=i(74487),n=i(22786),r=i(63927),s=e([o,r]);[o,r]=s.then?(await s)():s;const c=(0,n.A)(e=>new Intl.RelativeTimeFormat(e.language,{numeric:"auto"})),l=(e,t,i,a=!0)=>{const o=(0,r.x)(e,i,t);return a?c(t).format(o.value,o.unit):Intl.NumberFormat(t.language,{style:"unit",unit:o.unit,unitDisplay:"long"}).format(Math.abs(o.value))};a()}catch(c){a(c)}})},26218:function(e,t,i){i.d(t,{a:function(){return o}});i(16280);const a=(0,i(77796).n)(e=>{history.replaceState({scrollPosition:e},"")},300);function o(e){return(t,i)=>{if("object"==typeof i)throw new Error("This decorator does not support this compilation type.");const o=t.connectedCallback;t.connectedCallback=function(){o.call(this);const t=this[i];t&&this.updateComplete.then(()=>{const i=this.renderRoot.querySelector(e);i&&setTimeout(()=>{i.scrollTop=t},0)})};const n=Object.getOwnPropertyDescriptor(t,i);let r;if(void 0===n)r={get(){var e;return this[`__${String(i)}`]||(null===(e=history.state)||void 0===e?void 0:e.scrollPosition)},set(e){a(e),this[`__${String(i)}`]=e},configurable:!0,enumerable:!0};else{const e=n.set;r=Object.assign(Object.assign({},n),{},{set(t){a(t),this[`__${String(i)}`]=t,null==e||e.call(this,t)}})}Object.defineProperty(t,i,r)}}},15090:function(e,t,i){i.d(t,{nP:function(){return l},vB:function(){return s}});i(44114),i(26910),i(18111),i(22489),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(22675),o=i(52220),n=i(71727),r=i(69093);const s={alarm_control_panel:["armed_away","armed_custom_bypass","armed_home","armed_night","armed_vacation","arming","disarmed","disarming","pending","triggered"],alert:["on","off","idle"],assist_satellite:["idle","listening","responding","processing"],automation:["on","off"],binary_sensor:["on","off"],button:[],calendar:["on","off"],camera:["idle","recording","streaming"],cover:["closed","closing","open","opening"],device_tracker:["home","not_home"],fan:["on","off"],humidifier:["on","off"],infrared:[],input_boolean:["on","off"],input_button:[],lawn_mower:["error","paused","mowing","returning","docked"],light:["on","off"],lock:["jammed","locked","locking","unlocked","unlocking","opening","open"],media_player:["off","on","idle","playing","paused","standby","buffering"],person:["home","not_home"],plant:["ok","problem"],radio_frequency:[],remote:["on","off"],scene:[],schedule:["on","off"],script:["on","off"],siren:["on","off"],sun:["above_horizon","below_horizon"],switch:["on","off"],timer:["active","idle","paused"],update:["on","off"],vacuum:["cleaning","docked","error","idle","paused","returning"],valve:["closed","closing","open","opening"],weather:["clear-night","cloudy","exceptional","fog","hail","lightning-rainy","lightning","partlycloudy","pouring","rainy","snowy-rainy","snowy","sunny","windy-variant","windy"]},c={alarm_control_panel:{code_format:["number","text"]},binary_sensor:{device_class:["battery","battery_charging","co","cold","connectivity","door","garage_door","gas","heat","light","lock","moisture","motion","moving","occupancy","opening","plug","power","presence","problem","running","safety","smoke","sound","tamper","update","vibration","window"]},button:{device_class:["restart","update"]},camera:{frontend_stream_type:["hls","web_rtc"]},climate:{hvac_action:["off","idle","preheating","defrosting","heating","cooling","drying","fan"]},cover:{device_class:["awning","blind","curtain","damper","door","garage","gate","shade","shutter","window"]},device_tracker:{source_type:["bluetooth","bluetooth_le","gps","router"]},fan:{direction:["forward","reverse"]},humidifier:{device_class:["humidifier","dehumidifier"],action:["off","idle","humidifying","drying"]},media_player:{device_class:["tv","speaker","receiver"],media_content_type:["album","app","artist","channel","channels","composer","contributing_artist","episode","game","genre","image","movie","music","playlist","podcast","season","track","tvshow","url","video"],repeat:["off","one","all"]},number:{device_class:["temperature"]},sensor:{device_class:["apparent_power","aqi","battery","carbon_dioxide","carbon_monoxide","current","date","duration","energy","frequency","gas","humidity","illuminance","monetary","nitrogen_dioxide","nitrogen_monoxide","nitrous_oxide","ozone","ph","pm1","pm10","pm25","pm4","power_factor","power","pressure","reactive_power","signal_strength","sulphur_dioxide","temperature","timestamp","uptime","volatile_organic_compounds","volatile_organic_compounds_parts","voltage","volume_flow_rate"],state_class:["measurement","total","total_increasing"]},switch:{device_class:["outlet","switch"]},update:{device_class:["firmware"]},water_heater:{away_mode:["on","off"]}},l=(e,t,i=void 0)=>{const l=(0,r.t)(t),d=[];switch(d.push(...((e,t,i)=>{const r=[];switch(i||r.push(a.Hh,a.HV),!i&&t in s?r.push(...s[t]):i&&t in c&&i in c[t]&&r.push(...c[t][i]),t){case"device_tracker":case"person":i||r.push(...Object.entries(e.states).filter(([e,t])=>"zone"===(0,n.m)(e)&&"zone.home"!==e&&t.attributes.friendly_name).map(([e,t])=>t.attributes.friendly_name).sort((t,i)=>(0,o.xL)(t,i,e.locale.language)))}return r})(e,l,i)),l){case"climate":i?"fan_mode"===i?d.push(...t.attributes.fan_modes):"preset_mode"===i?d.push(...t.attributes.preset_modes):"swing_mode"===i?d.push(...t.attributes.swing_modes):"swing_horizontal_mode"===i&&d.push(...t.attributes.swing_horizontal_modes):d.push(...t.attributes.hvac_modes);break;case"event":"event_type"===i&&d.push(...t.attributes.event_types);break;case"fan":"preset_mode"===i&&d.push(...t.attributes.preset_modes);break;case"humidifier":"mode"===i&&d.push(...t.attributes.available_modes);break;case"input_select":case"select":i||d.push(...t.attributes.options);break;case"light":"effect"===i&&t.attributes.effect_list?d.push(...t.attributes.effect_list):"color_mode"===i&&t.attributes.supported_color_modes&&d.push(...t.attributes.supported_color_modes);break;case"media_player":"sound_mode"===i?d.push(...t.attributes.sound_mode_list):"source"===i&&d.push(...t.attributes.source_list);break;case"remote":"current_activity"===i&&d.push(...t.attributes.activity_list);break;case"sensor":i||"enum"!==t.attributes.device_class||d.push(...t.attributes.options);break;case"vacuum":"fan_speed"===i&&d.push(...t.attributes.fan_speed_list);break;case"water_heater":i&&"operation_mode"!==i||d.push(...t.attributes.operation_list)}return[...new Set(d)]}},79791:function(e,t,i){i.d(t,{L:function(){return a}});const a=(e,t=2)=>Math.round(e*10**t)/10**t},34470:function(e,t,i){i.d(t,{E:function(){return o}});let a;const o=(0,i(5124).AH)(a||(a=(e=>e)`ha-state-icon[data-domain=alarm_control_panel][data-state=arming],ha-state-icon[data-domain=alarm_control_panel][data-state=pending],ha-state-icon[data-domain=alarm_control_panel][data-state=triggered],ha-state-icon[data-domain=lock][data-state=jammed]{animation:pulse 1s infinite}@keyframes pulse{0%{opacity:1}50%{opacity:0}100%{opacity:1}}ha-state-icon[data-state=unavailable]{color:var(--state-unavailable-color)}`))},22533:function(e,t,i){i.d(t,{i:function(){return o}});var a=i(52943);const o=(e,t)=>(e=>{switch(e){case"de":case"lb":return!0;default:return!1}})(t)?(0,a.Z)(e):e.toLocaleLowerCase(t)},67258:function(e,t,i){i.d(t,{d:function(){return a}});const a=e=>{switch(e.language){case"cs":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}}},8549:function(e,t,i){i.d(t,{A:function(){return o}});var a=i(67258);const o=(e,t)=>"°"===e?"":t&&"%"===e?(0,a.d)(t):" "},51758:function(e,t,i){i.d(t,{Z:function(){return a}});const a=e=>{const t=window.location.pathname;return e?t+"?"+e:t}},63927:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{x:function(){return p}});var o=i(6946),n=i(52640),r=i(38684),s=i(380),c=e([s]);s=(c.then?(await c)():c)[0];const d=1e3,u=60,h=60*u;function p(e,t=Date.now(),i,a={}){const c=Object.assign(Object.assign({},g),a||{}),l=(+e-+t)/d;if(Math.abs(l)<c.second)return{value:Math.round(l),unit:"second"};const p=l/u;if(Math.abs(p)<c.minute)return{value:Math.round(p),unit:"minute"};const m=l/h;if(Math.abs(m)<c.hour)return{value:Math.round(m),unit:"hour"};const _=new Date(e),f=new Date(t);_.setHours(0,0,0,0),f.setHours(0,0,0,0);const v=(0,o.c)(_,f);if(0===v)return{value:Math.round(m),unit:"hour"};if(Math.abs(v)<c.day)return{value:v,unit:"day"};const b=(0,s.P)(i),y=(0,n.k)(_,{weekStartsOn:b}),w=(0,n.k)(f,{weekStartsOn:b}),k=(0,r.I)(y,w);if(0===k)return{value:v,unit:"day"};if(Math.abs(k)<c.week)return{value:k,unit:"week"};const C=_.getFullYear()-f.getFullYear(),x=12*C+_.getMonth()-f.getMonth();return 0===x?{value:k,unit:"week"}:Math.abs(x)<c.month||0===C?{value:x,unit:"month"}:{value:Math.round(C),unit:"year"}}const g={second:59,minute:59,hour:22,day:5,week:4,month:11};a()}catch(l){a(l)}})},77796:function(e,t,i){i.d(t,{n:function(){return a}});i(62953);const a=(e,t,i=!0,a=!0)=>{let o,n=0;const r=(...r)=>{const s=()=>{n=!1===i?0:Date.now(),o=void 0,e(...r)},c=Date.now();n||!1!==i||(n=c);const l=t-(c-n);l<=0||l>t?(o&&(clearTimeout(o),o=void 0),n=c,e(...r)):o||!1===a||(o=window.setTimeout(s,l))};return r.cancel=()=>{clearTimeout(o),o=void 0,n=0},r}},3931:function(e,t,i){i.d(t,{U:function(){return a}});i(3362),i(62953);const a=async(e,t,i,a,o,...n)=>{let r=a[e];r||(r=a[e]={});const s=r[o];if(s)return s;const c=i(a,o,...n);return r[o]=c,c.then(()=>setTimeout(()=>{r[o]=void 0},t),()=>{r[o]=void 0}),c}},74281:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(7588),i(45367),i(92731),i(62953);var a=i(40445),o=i(5124),n=i(67576),r=i(63672),s=i(89784),c=i(71727),l=i(69093),d=i(52658),u=i(34470),h=i(10897),p=i(38279),g=i(93367),m=e([g]);g=(m.then?(await m)():m)[0];let _,f,v,b=e=>e;const y="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z";class w extends o.WF{connectedCallback(){var e,t;super.connectedCallback(),this.hasUpdated&&void 0===this.overrideImage&&(null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture||null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture_local)&&this.requestUpdate("stateObj")}disconnectedCallback(){var e,t;super.disconnectedCallback(),void 0===this.overrideImage&&(null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture||null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture_local)&&(this.style.backgroundImage="")}get _stateColor(){var e;const t=this.stateObj?(0,l.t)(this.stateObj):void 0;return null!==(e=this.stateColor)&&void 0!==e?e:"light"===t}render(){const e=this.stateObj;if(!e&&!this.overrideIcon&&!this.overrideImage)return(0,o.qy)(_||(_=b`<div class="missing"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div>`),y);const t=this.getClass();if(t&&t.forEach((e,t)=>{e?this.classList.add(t):this.classList.remove(t)}),!this.icon)return o.s6;const i=e?(0,l.t)(e):void 0;return(0,o.qy)(f||(f=b`<ha-state-icon style="${0}" data-domain="${0}" data-state="${0}" .icon="${0}" .stateObj="${0}"></ha-state-icon>`),(0,s.W)(this._iconStyle),(0,r.J)(i),(0,r.J)(null==e?void 0:e.state),this.overrideIcon,e)}willUpdate(e){if(super.willUpdate(e),!(e.has("stateObj")||e.has("overrideImage")||e.has("overrideIcon")||e.has("stateColor")||e.has("color")))return;const t=this.stateObj,i={};let a="";if(this.icon=!0,t){const e=(0,c.m)(t.entity_id);if(void 0===this.overrideImage)if(!t.attributes.entity_picture_local&&!t.attributes.entity_picture||this.overrideIcon){if(this.color)i.color=this.color;else if(this._stateColor){const e=(0,d.Se)(t);if(e&&(i.color=e),t.attributes.rgb_color&&(i.color=`rgb(${t.attributes.rgb_color.join(",")})`),t.attributes.brightness){const e=t.attributes.brightness;if("number"!=typeof e){const i=`Type error: state-badge expected number, but type of ${t.entity_id}.attributes.brightness is ${typeof e} (${e})`;console.warn(i)}i.filter=(0,d.mT)(t)}if(t.attributes.hvac_action){const e=t.attributes.hvac_action;e in p.sx?i.color=(0,d.Se)(t,p.sx[e]):delete i.color}}}else{let i=t.attributes.entity_picture_local||t.attributes.entity_picture;this.hass&&(i=this.hass.hassUrl(i)),"camera"===e&&(i=(0,h.su)(i,80,80)),a=`url(${i})`,this.icon=!1}else if(this.overrideImage){let e=this.overrideImage;this.hass&&(e=this.hass.hassUrl(e)),a=`url(${e})`,this.icon=!1}}this._iconStyle=i,this.style.backgroundImage=a}getClass(){const e=new Map(["has-no-radius","has-media-image","has-image"].map(e=>[e,!1]));if(this.stateObj){const t=(0,c.m)(this.stateObj.entity_id);"update"===t?e.set("has-no-radius",!0):"media_player"===t||"camera"===t?e.set("has-media-image",!0):""!==this.style.backgroundImage&&e.set("has-image",!0)}return e}static get styles(){return[u.E,(0,o.AH)(v||(v=b`:host{position:relative;display:inline-flex;width:40px;color:var(--state-icon-color);border-radius:var(--state-badge-border-radius,50%);height:40px;background-size:cover;box-sizing:border-box;--state-inactive-color:initial;align-items:center;justify-content:center}:host(.has-image){border-radius:var(--state-badge-with-image-border-radius,50%)}:host(.has-media-image){border-radius:var(--state-badge-with-media-image-border-radius,8%)}:host(.has-no-radius){border-radius:var(--ha-border-radius-square)}:host(:focus){outline:0}:host(:not([icon]):focus){border:2px solid var(--divider-color)}:host([icon]:focus){background:var(--divider-color)}ha-state-icon{transition:color .3s ease-in-out,filter .3s ease-in-out}.missing{color:#fce588}`))]}constructor(...e){super(...e),this.icon=!0,this._iconStyle={}}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"stateObj",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"overrideIcon",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"overrideImage",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],w.prototype,"stateColor",void 0),(0,a.Cg)([(0,n.MZ)()],w.prototype,"color",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],w.prototype,"icon",void 0),(0,a.Cg)([(0,n.wk)()],w.prototype,"_iconStyle",void 0),w=(0,a.Cg)([(0,n.EM)("state-badge")],w),t()}catch(_){t(_)}})},99611:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(13579),i(3362),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(40445),o=i(1126),n=i(35211),r=i(5124),s=i(67576),c=i(1087),l=i(60353),d=i(22792),u=i(59992),h=i(14503),p=i(22348),g=e([o,u]);[o,u]=g.then?(await g)():g;let m,_,f=e=>e;const v=300,b=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),y=new Set(["volume-slider-container","forecast"]);class w extends((0,u.V)(r.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(e){super.updated(e),e.has("open")&&(this._drawerOpen=this.open)}render(){return(0,r.qy)(m||(m=f` <wa-drawer id="drawer" placement="bottom" .open="${0}" .lightDismiss="${0}" .ariaLabelledby="${0}" .ariaDescribedby="${0}" @keydown="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-hide="${0}" @wa-after-hide="${0}" @click="${0}" without-header @touchstart="${0}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${0} </div> <slot name="footer"></slot> </wa-drawer> `),this._drawerOpen,!this.preventScrimClose,this.ariaLabelledBy,this.ariaDescribedBy,this._handleKeyDown,this._handleShow,this._handleAfterShow,this._handleHide,this._handleAfterHide,this._handleCloseAction,this._handleTouchStart,this.renderScrollableFades())}_startResizing(e){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(e)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${v}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},v)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,h.dp,(0,r.AH)(_||(_=f`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${0}ms;--hide-duration:${0}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`),v,v)]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new l.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,c.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e;const t=this._autofocusElement;null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,p.V)(this._hassConfig.auth.external)?t&&(t.id||(t.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})):null==t||t.focus()})},this._handleAfterShow=()=>{(0,c.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=e=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);e.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,c.r)(this,"closed"))},this._handleHide=e=>{if(e.eventPhase!==Event.AT_TARGET)return;const t=e.detail.source===e.target.drawer;if(this._sliderInteractionActive)return e.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1},this._handleKeyDown=e=>{"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)},this._handleCloseAction=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&("close"===e.getAttribute("data-dialog")||"close"===e.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=e=>{if(this.preventScrimClose)return;const t=e.composedPath();for(const i of t){if(i===this._drawer)break;if(i instanceof HTMLElement&&(i.scrollTop>0||b.has(i.localName)||Array.from(i.classList).some(e=>y.has(e))))return}e.stopPropagation(),this._startResizing(e.touches[0].clientY)},this._handleTouchMove=e=>{const t=e.touches[0].clientY,i=this._gestureRecognizer.move(t);i<0&&(e.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*i}px)`)}))},this._handleTouchEnd=()=>{var e;this._unregisterResizeHandlers(),this._isDragging=!1;const t=this._gestureRecognizer.end();if(t.isSwipe)return void(t.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const i=null===(e=this._drawer.shadowRoot)||void 0===e?void 0:e.querySelector('[part="body"]'),a=(null==i?void 0:i.offsetHeight)||0;a>0&&t.delta<0&&Math.abs(t.delta)>.5*a?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,a.Cg)([(0,s.MZ)({attribute:"aria-labelledby"})],w.prototype,"ariaLabelledBy",void 0),(0,a.Cg)([(0,s.MZ)({attribute:"aria-describedby"})],w.prototype,"ariaDescribedBy",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean})],w.prototype,"open",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],w.prototype,"flexContent",void 0),(0,a.Cg)([(0,s.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],w.prototype,"preventScrimClose",void 0),(0,a.Cg)([(0,s.wk)()],w.prototype,"_drawerOpen",void 0),(0,a.Cg)([(0,s.wk)()],w.prototype,"_sliderInteractionActive",void 0),(0,a.Cg)([(0,s.wk)(),(0,n.Fg)({context:d.WF,subscribe:!0})],w.prototype,"_hassConfig",void 0),(0,a.Cg)([(0,s.P)("#drawer")],w.prototype,"_drawer",void 0),(0,a.Cg)([(0,s.P)("#body")],w.prototype,"_bodyElement",void 0),(0,a.Cg)([(0,s.P)("[autofocus]")],w.prototype,"_autofocusElement",void 0),w=(0,a.Cg)([(0,s.EM)("ha-bottom-sheet")],w),t()}catch(m){t(m)}})},59174:function(e,t,i){i.a(e,async function(e,t){try{var a=i(40445),o=i(35211),n=i(5124),r=i(67576),s=i(91450),c=i(22792),l=i(85694),d=i(44144),u=(i(47680),e([l]));l=(u.then?(await u)():u)[0];let h,p,g,m,_,f,v,b=e=>e;class y extends n.WF{render(){if(this.icon)return(0,n.qy)(h||(h=b`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.domain)return n.s6;if(!this._connection||!this._hassConfig)return this._renderFallback();const e=(0,l._4)(this._connection.connection,this._hassConfig.config,this.domain,this.deviceClass,this.state).then(e=>e?(0,n.qy)(p||(p=b`<ha-icon .icon="${0}"></ha-icon>`),e):this._renderFallback());return(0,n.qy)(g||(g=b`${0}`),(0,s.T)(e))}_renderFallback(){if(this.domain&&this.domain in l.l)return(0,n.qy)(m||(m=b` <ha-svg-icon .path="${0}"></ha-svg-icon> `),l.l[this.domain]);if(this.brandFallback){var e,t;const i=(0,d.MR)({domain:this.domain,type:"icon",darkOptimized:null===(e=this._hassUi)||void 0===e?void 0:e.themes.darkMode},null===(t=this._hassConfig)||void 0===t?void 0:t.auth.data.hassUrl);return(0,n.qy)(_||(_=b` <img alt="" src="${0}" crossorigin="anonymous" referrerpolicy="no-referrer"> `),i)}return(0,n.qy)(f||(f=b`<ha-svg-icon .path="${0}"></ha-svg-icon>`),l.lW)}}y.styles=(0,n.AH)(v||(v=b`img{width:var(--mdc-icon-size,24px)}`)),(0,a.Cg)([(0,r.MZ)()],y.prototype,"domain",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"deviceClass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"state",void 0),(0,a.Cg)([(0,r.MZ)()],y.prototype,"icon",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"brand-fallback",type:Boolean})],y.prototype,"brandFallback",void 0),(0,a.Cg)([(0,r.wk)(),(0,o.Fg)({context:c.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,a.Cg)([(0,r.wk)(),(0,o.Fg)({context:c.Wq,subscribe:!0})],y.prototype,"_connection",void 0),(0,a.Cg)([(0,r.wk)(),(0,o.Fg)({context:c.EK,subscribe:!0})],y.prototype,"_hassUi",void 0),y=(0,a.Cg)([(0,r.EM)("ha-domain-icon")],y),t()}catch(h){t(h)}})},11382:function(e,t,i){i(3362),i(62953);var a=i(40445),o=i(5124),n=i(67576),r=i(6412),s=i(1087),c=i(12587);i(67094);let l,d,u,h,p=e=>e;class g extends o.WF{render(){const e=this.noCollapse?o.s6:(0,o.qy)(l||(l=p` <ha-svg-icon .path="${0}" class="summary-icon ${0}"></ha-svg-icon> `),"M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",(0,r.H)({expanded:this.expanded}));return(0,o.qy)(d||(d=p` <div class="top ${0}"> <div id="summary" class="${0}" @click="${0}" @keydown="${0}" @focus="${0}" @blur="${0}" role="button" tabindex="${0}" aria-expanded="${0}" aria-controls="sect1" part="summary"> ${0} <slot name="leading-icon"></slot> <slot name="header"> <div class="header"> ${0} <slot class="secondary" name="secondary">${0}</slot> </div> </slot> <slot name="event"></slot> ${0} <slot name="icons"></slot> </div> </div> <div class="container ${0}" @transitionend="${0}" role="region" aria-labelledby="summary" aria-hidden="${0}" tabindex="-1"> ${0} </div> `),(0,r.H)({expanded:this.expanded}),(0,r.H)({noCollapse:this.noCollapse}),this._toggleContainer,this._toggleContainer,this._focusChanged,this._focusChanged,this.noCollapse?-1:0,this.expanded,this.leftChevron?e:o.s6,this.header,this.secondary,this.leftChevron?o.s6:e,(0,r.H)({expanded:this.expanded}),this._handleTransitionEnd,!this.expanded,this._showContent?(0,o.qy)(u||(u=p`<slot></slot>`)):"")}willUpdate(e){super.willUpdate(e),e.has("expanded")&&(this._showContent=this.expanded,setTimeout(()=>{this._container.style.overflow=this.expanded?"initial":"hidden"},300))}_handleTransitionEnd(){this._container.style.removeProperty("height"),this._container.style.overflow=this.expanded?"initial":"hidden",this._showContent=this.expanded}async _toggleContainer(e){if(e.defaultPrevented)return;if("keydown"===e.type&&"Enter"!==e.key&&" "!==e.key)return;if(e.preventDefault(),this.noCollapse)return;const t=!this.expanded;(0,s.r)(this,"expanded-will-change",{expanded:t}),this._container.style.overflow="hidden",t&&(this._showContent=!0,await(0,c.E)());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,t||setTimeout(()=>{this._container.style.height="0px"},0),this.expanded=t,(0,s.r)(this,"expanded-changed",{expanded:this.expanded})}_focusChanged(e){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}constructor(...e){super(...e),this.expanded=!1,this.outlined=!1,this.leftChevron=!1,this.noCollapse=!1,this._showContent=this.expanded}}g.styles=(0,o.AH)(h||(h=p`:host{display:block}.top{display:flex;align-items:center;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.top.expanded{border-bottom-left-radius:0px;border-bottom-right-radius:0px}.top.focused{background:var(--input-fill-color)}:host([outlined]){box-shadow:none;border-width:1px;border-style:solid;border-color:var(--outline-color);border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.summary-icon{transition:transform 150ms cubic-bezier(.4, 0, .2, 1);direction:var(--direction);margin-left:8px;margin-inline-start:8px;margin-inline-end:initial;border-radius:var(--ha-border-radius-circle)}#summary:focus-visible ha-svg-icon.summary-icon{background-color:var(--ha-color-fill-neutral-normal-active)}::slotted([slot=leading-icon]),:host([left-chevron]) .summary-icon{margin-left:0;margin-right:8px;margin-inline-start:0;margin-inline-end:8px}#summary{flex:1;display:flex;padding:var(--expansion-panel-summary-padding,0 8px);min-height:48px;align-items:center;cursor:pointer;overflow:hidden;font-weight:var(--ha-font-weight-medium);outline:0}#summary.noCollapse{cursor:default}.summary-icon.expanded{transform:rotate(180deg)}.header,::slotted([slot=header]){flex:1;overflow-wrap:anywhere;color:var(--primary-text-color)}.container{padding:var(--expansion-panel-content-padding,0 8px);overflow:hidden;transition:height .3s cubic-bezier(.4, 0, .2, 1);height:0px}.container.expanded{height:auto}.secondary{display:block;color:var(--secondary-text-color);font-size:var(--ha-font-size-s)}`)),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],g.prototype,"expanded",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],g.prototype,"outlined",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"left-chevron",type:Boolean,reflect:!0})],g.prototype,"leftChevron",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"no-collapse",type:Boolean,reflect:!0})],g.prototype,"noCollapse",void 0),(0,a.Cg)([(0,n.MZ)()],g.prototype,"header",void 0),(0,a.Cg)([(0,n.MZ)()],g.prototype,"secondary",void 0),(0,a.Cg)([(0,n.wk)()],g.prototype,"_showContent",void 0),(0,a.Cg)([(0,n.P)(".container")],g.prototype,"_container",void 0),g=(0,a.Cg)([(0,n.EM)("ha-expansion-panel")],g)},90248:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HaIconButtonArrowPrev:function(){return g}});i(62953);var o=i(40445),n=i(5124),r=i(67576),s=i(63091),c=i(26300),l=e([c]);c=(l.then?(await l)():l)[0];let d,u=e=>e;const h="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",p="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z";class g extends n.WF{render(){var e;return(0,n.qy)(d||(d=u` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}" .href="${0}" .target="${0}" .rel="${0}" .download="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(e=this.hass)||void 0===e?void 0:e.localize("ui.common.back"))||"Back",this._icon,this.href,this.target,this.rel,this.download)}constructor(...e){super(...e),this.disabled=!1,this._icon="rtl"===s.G.document.dir?p:h}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,o.Cg)([(0,r.MZ)()],g.prototype,"label",void 0),(0,o.Cg)([(0,r.MZ)()],g.prototype,"href",void 0),(0,o.Cg)([(0,r.MZ)()],g.prototype,"target",void 0),(0,o.Cg)([(0,r.MZ)()],g.prototype,"rel",void 0),(0,o.Cg)([(0,r.MZ)()],g.prototype,"download",void 0),(0,o.Cg)([(0,r.wk)()],g.prototype,"_icon",void 0),g=(0,o.Cg)([(0,r.EM)("ha-icon-button-arrow-prev")],g),a()}catch(d){a(d)}})},43661:function(e,t,i){i.r(t),i.d(t,{HaIconNext:function(){return s}});i(62953);var a=i(40445),o=i(67576),n=i(63091),r=i(67094);class s extends r.HaSvgIcon{constructor(...e){super(...e),this.path="rtl"===n.G.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}(0,a.Cg)([(0,o.MZ)()],s.prototype,"path",void 0),s=(0,a.Cg)([(0,o.EM)("ha-icon-next")],s)},36158:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var a=i(40445),o=i(25625),n=i(5124),r=i(67576),s=i(98975),c=i(52943),l=e([s]);s=(l.then?(await l)():l)[0];class d extends n.mN{disconnectedCallback(){super.disconnectedCallback(),this._clearInterval()}connectedCallback(){super.connectedCallback(),this.datetime&&this._startInterval()}createRenderRoot(){return this}firstUpdated(e){super.firstUpdated(e),this._updateRelative()}update(e){super.update(e),this._updateRelative()}_clearInterval(){this._interval&&(window.clearInterval(this._interval),this._interval=void 0)}_startInterval(){this._clearInterval(),this._interval=window.setInterval(()=>this._updateRelative(),6e4)}_updateRelative(){if(this.datetime){const e="string"==typeof this.datetime?(0,o.H)(this.datetime):this.datetime,t=(0,s.K)(e,this.hass.locale);this.innerHTML=this.capitalize?(0,c.Z)(t):t}else this.innerHTML=this.hass.localize("ui.components.relative_time.never")}constructor(...e){super(...e),this.capitalize=!1}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"datetime",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],d.prototype,"capitalize",void 0),d=(0,a.Cg)([(0,r.EM)("ha-relative-time")],d),t()}catch(d){t(d)}})},606:function(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(61701),i(62953);var a=i(40445),o=i(5124),n=i(67576),r=i(63672),s=i(22786),c=i(1087),l=i(29823),d=(i(70947),i(3449),i(88285)),u=(i(67094),e([l,d]));[l,d]=u.then?(await u)():u;let h,p,g,m,_,f,v,b,y,w=e=>e;class k extends o.WF{render(){return this.disabled?(0,o.qy)(h||(h=w`${0}${0}`),this._renderField(),this._renderHelper()):(0,o.qy)(p||(p=w` <ha-dropdown placement="bottom" @wa-select="${0}" @wa-show="${0}" @wa-hide="${0}"> ${0} ${0} </ha-dropdown> ${0} `),this._handleSelect,this._handleShow,this._handleHide,this._renderField(),this.options?this.options.map(e=>{var t;const i=["string","number"].includes(typeof e);return(0,o.qy)(g||(g=w` <ha-dropdown-item .value="${0}" .disabled="${0}" .selected="${0}"> ${0} <div class="content"> ${0} ${0} </div> </ha-dropdown-item> `),i?e:e.value,!i&&(null!==(t=e.disabled)&&void 0!==t&&t),this.value===(i?e:e.value),e.iconPath?(0,o.qy)(m||(m=w`<ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon>`),e.iconPath):o.s6,i?e:e.label||e.value,e.secondary?(0,o.qy)(_||(_=w`<div class="secondary">${0}</div>`),e.secondary):o.s6)}):(0,o.qy)(f||(f=w`<slot></slot>`)),this._renderHelper())}_renderField(){const e=this._getValueLabel(this.options,this.value);return(0,o.qy)(v||(v=w` <ha-picker-field slot="trigger" type="button" class="${0}" compact="compact" aria-label="${0}" @clear="${0}" .label="${0}" .value="${0}" .required="${0}" .disabled="${0}" .hideClearIcon="${0}"> </ha-picker-field> `),this._opened?"opened":"",(0,r.J)(this.label),this._clearValue,this.label,e,this.required,this.disabled,!this.clearable||this.required||this.disabled||!String(this.value))}_renderHelper(){return this.helper?(0,o.qy)(b||(b=w`<ha-input-helper-text .disabled="${0}">${0}</ha-input-helper-text>`),this.disabled,this.helper):o.s6}_handleSelect(e){e.stopPropagation();const t=e.detail.item.value;t!==this.value&&(0,c.r)(this,"selected",{value:t})}_clearValue(){!this.disabled&&this.value&&(0,c.r)(this,"selected",{value:void 0})}_handleShow(){this.style.setProperty("--select-menu-width",`${this._triggerField.offsetWidth}px`),this._opened=!0}_handleHide(){this._opened=!1}constructor(...e){super(...e),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,s.A)((e,t)=>{const i=void 0!==t?String(t):void 0;if(!e||!i)return i;for(const a of e){const e=["string","number"].includes(typeof a);if(e&&a===i||!e&&String(a.value)===i)return e?a:a.label||a.value}return i})}}k.styles=(0,o.AH)(y||(y=w`:host{position:relative}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}ha-dropdown-item .content{display:flex;gap:var(--ha-space-1);flex-direction:column}ha-dropdown-item .secondary{font-size:var(--ha-font-size-s);color:var(--ha-color-text-secondary)}ha-dropdown::part(menu){min-width:var(--select-menu-width)}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}`)),(0,a.Cg)([(0,n.MZ)({type:Boolean})],k.prototype,"clearable",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],k.prototype,"options",void 0),(0,a.Cg)([(0,n.MZ)()],k.prototype,"label",void 0),(0,a.Cg)([(0,n.MZ)()],k.prototype,"helper",void 0),(0,a.Cg)([(0,n.MZ)()],k.prototype,"value",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],k.prototype,"required",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],k.prototype,"disabled",void 0),(0,a.Cg)([(0,n.wk)()],k.prototype,"_opened",void 0),(0,a.Cg)([(0,n.P)("ha-picker-field")],k.prototype,"_triggerField",void 0),k=(0,a.Cg)([(0,n.EM)("ha-select")],k),t()}catch(h){t(h)}})},34127:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var a=i(40445),o=i(52630),n=i(5124),r=i(67576),s=e([o]);o=(s.then?(await s)():s)[0];let c,l=e=>e;class d extends o.A{static get styles(){return[o.A.styles,(0,n.AH)(c||(c=l`:host{--wa-tooltip-background-color:var(
--ha-tooltip-background-color,
var(--ha-color-surface-default)
);--wa-tooltip-content-color:var(
--ha-tooltip-text-color,
var(--primary-text-color)
);--wa-tooltip-font-family:var(
--ha-tooltip-font-family,
var(--ha-font-family-body)
);--wa-tooltip-font-size:var(
--ha-tooltip-font-size,
var(--ha-font-size-m)
);--wa-tooltip-font-weight:var(
--ha-tooltip-font-weight,
var(--ha-font-weight-medium)
);--wa-tooltip-line-height:var(
--ha-tooltip-line-height,
var(--ha-line-height-condensed)
);--wa-tooltip-padding:var(--ha-tooltip-padding, var(--ha-space-2));--wa-tooltip-border-radius:var(
--ha-tooltip-border-radius,
var(--ha-border-radius-md)
);--wa-tooltip-arrow-size:var(--ha-tooltip-arrow-size, 0px);--wa-tooltip-border-width:0px;--wa-z-index-tooltip:1000}.tooltip::part(popup){animation-duration:var(--ha-tooltip-animation-duration, 0)}.body{box-shadow:var(--ha-tooltip-box-shadow,var(--ha-box-shadow-m))}`))]}constructor(...e){super(...e),this.showDelay=350,this.hideDelay=150}}(0,a.Cg)([(0,r.MZ)({attribute:"show-delay",type:Number})],d.prototype,"showDelay",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"hide-delay",type:Number})],d.prototype,"hideDelay",void 0),d=(0,a.Cg)([(0,r.EM)("ha-tooltip")],d),t()}catch(c){t(c)}})},82e3:function(e,t,i){i.d(t,{Fy:function(){return n},Gk:function(){return c},Hg:function(){return a},Y_:function(){return l},ds:function(){return s},e0:function(){return o},ec:function(){return r}});i(74423),i(18111),i(61701),i(33110),i(3362);const a=e=>e.map(e=>{if("string"!==e.type)return e;switch(e.name){case"username":return Object.assign(Object.assign({},e),{},{autocomplete:"username",autofocus:!0});case"password":return Object.assign(Object.assign({},e),{},{autocomplete:"current-password"});case"code":return Object.assign(Object.assign({},e),{},{autocomplete:"one-time-code",autofocus:!0});default:return e}}),o=(e,t)=>e.callWS({type:"auth/sign_path",path:t}),n=async(e,t,i,a)=>e.callWS({type:"config/auth_provider/homeassistant/create",user_id:t,username:i,password:a}),r=(e,t,i)=>e.callWS({type:"config/auth_provider/homeassistant/change_password",current_password:t,new_password:i}),s=(e,t,i)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_password",user_id:t,password:i}),c=(e,t,i)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_username",user_id:t,username:i}),l=(e,t,i)=>e.callWS({type:"auth/delete_all_refresh_tokens",token_type:t,delete_current_token:i})},10897:function(e,t,i){i.d(t,{C4:function(){return l},CK:function(){return c},FX:function(){return m},UC:function(){return p},_Z:function(){return b},bT:function(){return y},j4:function(){return f},sd:function(){return n},su:function(){return s},vc:function(){return v},w8:function(){return h},wv:function(){return u},y3:function(){return g},zS:function(){return r}});i(3362);var a=i(3931),o=i(82e3);const n=[1,2,3,4,6,8],r="web_rtc",s=(e,t,i)=>`${e}&width=${t}&height=${i}`,c=e=>e.attributes.access_token?`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`:void 0,l=async(e,t,i,o)=>{const n=await(0,a.U)("_cameraTmbUrl",9e3,d,e,t);return s(n,i,o)},d=async(e,t)=>{const i=await(0,o.e0)(e,`/api/camera_proxy/${t}`);return e.hassUrl(i.path)},u=async(e,t,i)=>{const a={type:"camera/stream",entity_id:t};i&&(a.format=i);const o=await e.callWS(a);return o.url=e.hassUrl(o.url),o},h=(e,t,i,a)=>e.connection.subscribeMessage(a,{type:"camera/webrtc/offer",entity_id:t,offer:i}),p=(e,t,i,a)=>e.callWS({type:"camera/webrtc/candidate",entity_id:t,session_id:i,candidate:a}),g=(e,t)=>e.callWS({type:"camera/get_prefs",entity_id:t}),m=(e,t,i)=>e.callWS(Object.assign({type:"camera/update_prefs",entity_id:t},i)),_="media-source://camera/",f=e=>e.startsWith(_),v=e=>e.substring(22),b=async(e,t)=>e.callWS({type:"camera/capabilities",entity_id:t}),y=async(e,t)=>e.callWS({type:"camera/webrtc/get_client_config",entity_id:t})},86531:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{$O:function(){return v},a$:function(){return w},cj:function(){return h},dG:function(){return f},gM:function(){return _},gd:function(){return g},k$:function(){return y},rc:function(){return k}});i(74423),i(3362),i(27495),i(25440),i(62953);var o=i(46190),n=i(71727),r=i(69093),s=i(22533),c=i(22675),l=i(25064),d=e([l]);l=(d.then?(await d)():d)[0];const u="ui.components.logbook.messages",h=["counter","proximity"],p={triggered_by_numeric_state_of:"numeric state of",triggered_by_state_of:"state of",triggered_by_event:"event",triggered_by_time_pattern:"time pattern",triggered_by_time:"time",triggered_by_homeassistant_stopping:"ioBroker stopping",triggered_by_homeassistant_starting:"ioBroker starting"},g=async(e,t,i)=>m(e,t,void 0,void 0,i),m=(e,t,i,a,o,n)=>{if((a||n)&&(!a||0===a.length)&&(!n||0===n.length))return Promise.resolve([]);const r={type:"logbook/get_events",start_time:t};return i&&(r.end_time=i),null!=a&&a.length&&(r.entity_ids=a),null!=n&&n.length&&(r.device_ids=n),o&&(r.context_id=o),e.callWS(r)},_=(e,t,i,a,o,n,r)=>{if((n||r)&&(!n||0===n.length)&&(!r||0===r.length))return Promise.reject("No entities or devices");const s={type:"logbook/event_stream",start_time:i,end_time:a};return null!=n&&n.length&&(s.entity_ids=n),null!=r&&r.length&&(s.device_ids=r),e.connection.subscribeMessage(e=>t(e,o),s)},f=(e,t)=>({entity_id:e.entity_id,state:t,attributes:{device_class:null==e?void 0:e.attributes.device_class,source_type:null==e?void 0:e.attributes.source_type,has_date:null==e?void 0:e.attributes.has_date,has_time:null==e?void 0:e.attributes.has_time,entity_picture_local:o.oL.has((0,n.m)(e.entity_id))||null==e?void 0:e.attributes.entity_picture_local,entity_picture:o.oL.has((0,n.m)(e.entity_id))||null==e?void 0:e.attributes.entity_picture}}),v=(e,t)=>{for(const i of Object.keys(p)){const a=p[i];if(t.startsWith(a))return t.replace(a,`${e(`ui.components.logbook.${i}`)}`)}return t},b={triggered_by_numeric_state_of:"numeric_state_of",triggered_by_state_of:"state_of",triggered_by_event:"event",triggered_by_time_pattern:"time_pattern",triggered_by_time:"time",triggered_by_homeassistant_stopping:"homeassistant_stopping",triggered_by_homeassistant_starting:"homeassistant_starting"},y=(e,t)=>{for(const i of Object.keys(p)){const a=p[i];if(t.startsWith(a)){const o=b[i];return t.replace(a,`${e(`ui.components.logbook.${o}`)}`)}}return t},w=(e,t,i,a,o)=>{switch(o){case"device_tracker":case"person":return"not_home"===i?t(`${u}.was_away`):"home"===i?t(`${u}.was_at_home`):t(`${u}.was_at_state`,{state:i});case"sun":return t("above_horizon"===i?`${u}.rose`:`${u}.set`);case"binary_sensor":{const o="on"===i,n="off"===i,r=a.attributes.device_class;if(r&&(o||n))return t(`${u}.${o?"detected_device_classes":"cleared_device_classes"}.${r}`,{device_class:(0,s.i)(t(`component.binary_sensor.entity_component.${r}.name`)||r,e.language)})||t(`${u}.${o?"detected_device_class":"cleared_device_class"}`,{device_class:(0,s.i)(t(`component.binary_sensor.entity_component.${r}.name`)||r,e.language)});break}case"cover":switch(i){case"open":return t(`${u}.was_opened`);case"opening":return t(`${u}.is_opening`);case"closing":return t(`${u}.is_closing`);case"closed":return t(`${u}.was_closed`)}break;case"event":return t(`${u}.detected_event_no_type`);case"lock":switch(i){case"unlocked":return t(`${u}.was_unlocked`);case"locking":return t(`${u}.is_locking`);case"unlocking":return t(`${u}.is_unlocking`);case"opening":return t(`${u}.is_opening`);case"open":return t(`${u}.is_opened`);case"locked":return t(`${u}.was_locked`);case"jammed":return t(`${u}.is_jammed`)}}return"on"===i?t(`${u}.turned_on`):"off"===i?t(`${u}.turned_off`):i===c.HV?t(`${u}.became_unknown`):i===c.Hh?t(`${u}.became_unavailable`):e.localize(`${u}.changed_to_state`,{state:a?e.formatEntityState(a,i):i})},k=(e,t=[])=>{const i=(0,r.t)(e);return!(h.includes(i)||"sensor"===i&&(0,l.Fp)(i,e,void 0,t))};a()}catch(u){a(u)}})},95311:function(e,t,i){i.d(t,{DF:function(){return _},Lo:function(){return k},MH:function(){return h},MM:function(){return f},Qz:function(){return m},Ru:function(){return b},UU:function(){return y},_7:function(){return g},bZ:function(){return p},m0:function(){return u},tD:function(){return w},vX:function(){return v},wY:function(){return C}});var a=i(86518),o=(i(78350),i(74423),i(44114),i(30237),i(18111),i(22489),i(30531),i(7588),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953),i(44537)),n=i(69093),r=i(82286),s=i(24367),c=i(58594);const l=["domain","integration","device_class"],d=["integration","manufacturer","model"],u=(e,t,i,a,o,n,r)=>{const s=[],c=[],l=[];return Object.values(i).forEach(i=>{i.labels.includes(t)&&m(e,o,a,i.area_id,n,r)&&l.push(i.area_id)}),Object.values(a).forEach(i=>{i.labels.includes(t)&&_(e.states,Object.values(o),i,n,r)&&c.push(i.id)}),Object.values(o).forEach(i=>{i.labels.includes(t)&&f(e.states[i.entity_id],n,r)&&s.push(i.entity_id)}),{areas:l,devices:c,entities:s}},h=(e,t,i,a,o)=>{const n=[];return Object.values(i).forEach(i=>{i.floor_id===t&&m(e,e.entities,e.devices,i.area_id,a,o)&&n.push(i.area_id)}),{areas:n}},p=(e,t,i,a,o,n)=>{const r=[],s=[];return Object.values(i).forEach(i=>{i.area_id===t&&_(e.states,Object.values(a),i,o,n)&&s.push(i.id)}),Object.values(a).forEach(i=>{i.area_id===t&&f(e.states[i.entity_id],o,n)&&r.push(i.entity_id)}),{devices:s,entities:r}},g=(e,t,i,a,o)=>{const n=[];return Object.values(i).forEach(i=>{i.device_id===t&&f(e.states[i.entity_id],a,o)&&n.push(i.entity_id)}),{entities:n}},m=(e,t,i,a,o,n)=>!!Object.values(i).some(i=>!(i.area_id!==a||!_(e.states,Object.values(t),i,o,n)))||Object.values(t).some(t=>!(t.area_id!==a||!f(e.states[t.entity_id],o,n))),_=(e,t,i,a,n)=>{var r,s;const l=n?(0,c.fk)(n,t):void 0;if(null!==(r=a.target)&&void 0!==r&&r.device&&!(0,o.e)(a.target.device).some(e=>v(e,i,l)))return!1;if(null!==(s=a.target)&&void 0!==s&&s.entity){return t.filter(e=>e.device_id===i.id).some(t=>{const i=e[t.entity_id];return f(i,a,n)})}return!0},f=(e,t,i)=>{var a;return!!e&&(null===(a=t.target)||void 0===a||!a.entity||(0,o.e)(t.target.entity).some(t=>b(t,e,i)))},v=(e,t,i)=>{const{manufacturer:a,model:o,model_id:n,integration:r}=e;if(a&&t.manufacturer!==a)return!1;if(o&&t.model!==o)return!1;if(n&&t.model_id!==n)return!1;var s;if(r&&i&&(null==i||null===(s=i[t.id])||void 0===s||!s.has(r)))return!1;return!0},b=(e,t,i)=>{var a;const{domain:s,device_class:c,supported_features:l,unit_of_measurement:d,integration:u}=e;if(s){const e=(0,n.t)(t);if(Array.isArray(s)?!s.includes(e):e!==s)return!1}if(c){const e=t.attributes.device_class;if(e&&Array.isArray(c)?!c.includes(e):e!==c)return!1}if(l&&!(0,o.e)(l).some(e=>(0,r.$)(t,e)))return!1;if(d){const e=t.attributes.unit_of_measurement;if(!e||(Array.isArray(d)?!d.includes(e):e!==d))return!1}return!u||(null==i||null===(a=i[t.entity_id])||void 0===a?void 0:a.domain)===u},y=e=>{if(!e.entity)return{entity:null};if("filter"in e.entity)return e;const t=e.entity,{domain:i,integration:o,device_class:n}=t,r=(0,a.A)(t,l);return i||o||n?{entity:Object.assign(Object.assign({},r),{},{filter:{domain:i,integration:o,device_class:n}})}:{entity:r}},w=e=>{if(!e.device)return{device:null};if("filter"in e.device)return e;const t=e.device,{integration:i,manufacturer:o,model:n}=t,r=(0,a.A)(t,d);return i||o||n?{device:Object.assign(Object.assign({},r),{},{filter:{integration:i,manufacturer:o,model:n}})}:{device:r}},k=e=>{let t;var i;if("target"in e)t=(0,o.e)(null===(i=e.target)||void 0===i?void 0:i.entity);else if("entity"in e){var a,n;if(null!==(a=e.entity)&&void 0!==a&&a.include_entities)return;t=(0,o.e)(null===(n=e.entity)||void 0===n?void 0:n.filter)}if(!t)return;const r=t.flatMap(e=>e.integration||e.device_class||e.supported_features||!e.domain?[]:(0,o.e)(e.domain).filter(e=>(0,s.z)(e)));return[...new Set(r)]},C=(e,t,i,a,n,r={target:{}})=>{if(!t)return[];const s=new Set((0,o.e)(t.entity_id)),c=new Set((0,o.e)(t.device_id)),l=new Set((0,o.e)(t.area_id)),d=new Set((0,o.e)(t.floor_id));return new Set((0,o.e)(t.label_id)).forEach(t=>{const o=u(e,t,n,a,i,r);o.devices.forEach(e=>c.add(e)),o.entities.forEach(e=>s.add(e)),o.areas.forEach(e=>l.add(e))}),d.forEach(t=>{h(e,t,n,r).areas.forEach(e=>l.add(e))}),l.forEach(t=>{const o=p(e,t,a,i,r);o.devices.forEach(e=>c.add(e)),o.entities.forEach(e=>s.add(e))}),c.forEach(t=>{g(e,t,i,r).entities.forEach(e=>s.add(e))}),Array.from(s)}},28669:function(e,t,i){i.d(t,{TK:function(){return s},_2:function(){return l},eR:function(){return o},hG:function(){return c},hU:function(){return n},kg:function(){return r},wj:function(){return a},xg:function(){return d}});i(44114),i(18111),i(61701),i(3362),i(42762);const a="system-admin",o="system-users",n=async e=>e.callWS({type:"config/auth/list"}),r=async(e,t,i,a)=>e.callWS({type:"config/auth/create",name:t,group_ids:i,local_only:a}),s=async(e,t,i)=>e.callWS(Object.assign(Object.assign({},i),{},{type:"config/auth/update",user_id:t})),c=async(e,t)=>e.callWS({type:"config/auth/delete",user_id:t}),l=e=>e?e.trim().split(" ").slice(0,3).map(e=>e.substring(0,1)).join(""):"?",d=(e,t,i)=>{const a=[],o=t=>e.localize(`ui.panel.config.users.${t}`);return t.is_owner&&a.push(["M12 2C6.47 2 2 6.5 2 12C2 17.5 6.5 22 12 22S22 17.5 22 12 17.5 2 12 2M12 20C7.58 20 4 16.42 4 12C4 7.58 7.58 4 12 4S20 7.58 20 12C20 16.42 16.42 20 12 20M8 14L7 8L10 10L12 7L14 10L17 8L16 14H8M8.56 16C8.22 16 8 15.78 8 15.44V15H16V15.44C16 15.78 15.78 16 15.44 16H8.56Z",o("is_owner")]),i&&t.system_generated&&a.push(["M11,7H15V9H11V11H13A2,2 0 0,1 15,13V15A2,2 0 0,1 13,17H9V15H13V13H11A2,2 0 0,1 9,11V9A2,2 0 0,1 11,7M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z",o("is_system")]),t.local_only&&a.push(["M12 20C7.6 20 4 16.4 4 12S7.6 4 12 4 20 7.6 20 12 16.4 20 12 20M12 2C6.5 2 2 6.5 2 12S6.5 22 12 22 22 17.5 22 12 17.5 2 12 2M11 14H13V17H16V12H18L12 7L6 12H8V17H11V14",o("is_local")]),t.is_active||a.push(["M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",o("is_not_active")]),a}},42269:function(e,t,i){i.d(t,{p:function(){return o}});var a=i(1087);const o=(e,t)=>(0,a.r)(e,"hass-more-info",t)},24367:function(e,t,i){i.d(t,{L:function(){return o},z:function(){return n}});var a=i(23832);const o=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],n=(0,a.g)(o)},89434:function(e,t,i){i.a(e,async function(e,t){try{i(16280),i(74423),i(44114),i(94490),i(26910),i(18111),i(22489),i(7588),i(13579),i(3362),i(62953);var a=i(40445),o=i(5124),n=i(67576),r=i(36312),s=i(69093),c=i(77796),l=i(65829),d=i(86531),u=i(61165),h=i(28669),p=i(11184),g=e([l,p,d]);[l,p,d]=g.then?(await g)():g;let m,_,f,v,b,y=e=>e;const w=(e,t)=>new Date(e.getTime()-1e3*t).getTime()/1e3,k=(e,t)=>(void 0!==e||void 0!==t)&&(!e||!t||e.length!==t.length||e.some(e=>!t.includes(e))||t.some(t=>!e.includes(t)));class C extends o.WF{render(){return(0,r.x)(this.hass.config,"logbook")?this._error?(0,o.qy)(m||(m=y`<div class="no-entries"> ${0} </div>`),`${this.hass.localize("ui.components.logbook.retrieval_error")}: ${this._error}`):void 0===this._logbookEntries?(0,o.qy)(_||(_=y` <div class="progress-wrapper"> <ha-spinner></ha-spinner> </div> `)):0===this._logbookEntries.length?(0,o.qy)(f||(f=y`<div class="no-entries"> ${0} </div>`),this.hass.localize("ui.components.logbook.entries_not_found")):(0,o.qy)(v||(v=y` <ha-logbook-renderer .hass="${0}" .narrow="${0}" .virtualize="${0}" .noIcon="${0}" .noName="${0}" .showIndicator="${0}" .relativeTime="${0}" .entries="${0}" .traceContexts="${0}" .userIdToName="${0}" @hass-logbook-live="${0}"></ha-logbook-renderer> `),this.hass,this.narrow,this.virtualize,this.noIcon,this.noName,this.showIndicator,this.relativeTime,this._logbookEntries,this._traceContexts,this._userIdToName,this._handleLogbookLive):o.s6}async refresh(e=!1){(e||!this._unsubLogbook&&void 0!==this._logbookEntries)&&(this._throttleGetLogbookEntries.cancel(),this._updateTraceContexts.cancel(),this._updateUsers.cancel(),this._unsubscribe(!0),this._liveUpdatesEnabled=!0,e?this._getLogBookData():this._throttleGetLogbookEntries())}shouldUpdate(e){if(1!==e.size||!e.has("hass"))return!0;const t=e.get("hass");return!t||t.localize!==this.hass.localize}willUpdate(e){let t=e.has("time");for(const i of["entityIds","deviceIds","stateFilter"]){if(!e.has(i))continue;const a=e.get(i),o=this[i];if(k(a,o)){t=!0;break}}t&&this.refresh(!0)}_handleLogbookLive(e){e.detail.enable&&!this._liveUpdatesEnabled&&(this._pendingStreamMessages.forEach(e=>this._processStreamMessage(e)),this._pendingStreamMessages=[]),this._liveUpdatesEnabled=e.detail.enable}get _filterAlwaysEmptyResults(){const e=this.entityIds,t=this.deviceIds;return Boolean(e||t)&&(!e||0===e.length)&&(!t||0===t.length)}_unsubscribe(e){this._unsubLogbook&&(this._unsubLogbook.then(e=>e()),this._unsubLogbook=void 0,this._logbookEntries=e?void 0:[],this._pendingStreamMessages=[])}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._subscribeLogbookPeriod(this._calculateLogbookPeriod())}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribe(!0)}_calculateLogbookPeriod(){const e=new Date;if("range"in this.time)return{now:e,startTime:this.time.range[0],endTime:this.time.range[1],purgeBeforePythonTime:void 0};if("recent"in this.time){const t=w(e,this.time.recent);return{now:e,startTime:new Date(1e3*t),endTime:new Date(e.getTime()+31536e6),purgeBeforePythonTime:w(e,this.time.recent)}}throw new Error("Unexpected time specified")}async _subscribeLogbookPeriod(e){if(!this._unsubLogbook)try{this._logbookSubscriptionId++,this._unsubLogbook=(0,d.gM)(this.hass,(e,t)=>{t===this._logbookSubscriptionId&&this._processOrQueueStreamMessage(e)},e.startTime.toISOString(),e.endTime.toISOString(),this._logbookSubscriptionId,this.entityIds,this.deviceIds),await this._unsubLogbook}catch(t){this._unsubLogbook=void 0,this._error=t}}async _getLogBookData(){var e;if(this._error=void 0,this._filterAlwaysEmptyResults)return void this._unsubscribe(!1);const t=this._calculateLogbookPeriod();t.startTime>t.now?this._unsubscribe(!1):(this._updateUsers(),null!==(e=this.hass.user)&&void 0!==e&&e.is_admin&&this._updateTraceContexts(),this._subscribeLogbookPeriod(t))}static get styles(){return[(0,o.AH)(b||(b=y`:host{display:block}:host([virtualize]){height:100%}.no-entries{text-align:center;padding:16px;color:var(--secondary-text-color)}.progress-wrapper{display:flex;justify-content:center;height:100%;align-items:center}`))]}constructor(...e){super(...e),this.narrow=!1,this.virtualize=!1,this.noIcon=!1,this.noName=!1,this.showIndicator=!1,this.relativeTime=!1,this.showMoreLink=!0,this._traceContexts={},this._userIdToName={},this._liveUpdatesEnabled=!0,this._pendingStreamMessages=[],this._throttleGetLogbookEntries=(0,c.n)(()=>this._getLogBookData(),1e3),this._logbookSubscriptionId=0,this._nonExpiredRecords=e=>this._logbookEntries?e?this._logbookEntries.filter(t=>t.when>e):this._logbookEntries:[],this._processOrQueueStreamMessage=e=>{this._liveUpdatesEnabled?this._processStreamMessage(e):this._pendingStreamMessages.push(e)},this._processStreamMessage=e=>{const t="recent"in this.time?w(new Date,this.time.recent):void 0;let i;i=this.stateFilter&&this.stateFilter.length>0?e.events.filter(e=>{var t;return e.state&&(null===(t=this.stateFilter)||void 0===t?void 0:t.includes(e.state))}):[...e.events];const a=i.reverse();if(!this._logbookEntries||!this._logbookEntries.length)return void(this._logbookEntries=a);if(!a.length)return;const o=this._nonExpiredRecords(t);o.length?a[a.length-1].when>o[0].when?this._logbookEntries=a.concat(o):o[o.length-1].when>a[0].when?this._logbookEntries=o.concat(a):this._logbookEntries=o.concat(a).sort((e,t)=>t.when-e.when):this._logbookEntries=a},this._updateTraceContexts=(0,c.n)(async()=>{this._traceContexts=await(0,u.gq)(this.hass)},6e4),this._updateUsers=(0,c.n)(async()=>{var e;const t={},i=(null===(e=this.hass.user)||void 0===e?void 0:e.is_admin)&&(0,h.hU)(this.hass);for(const a of Object.values(this.hass.states))a.attributes.user_id&&"person"===(0,s.t)(a)&&(t[a.attributes.user_id]=a.attributes.friendly_name);if(i){const e=await i;for(const i of e)i.id in t||(t[i.id]=i.name)}this._userIdToName=t},6e4)}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"time",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"entityIds",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"deviceIds",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"stateFilter",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],C.prototype,"narrow",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],C.prototype,"virtualize",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-icon"})],C.prototype,"noIcon",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-name"})],C.prototype,"noName",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"show-indicator"})],C.prototype,"showIndicator",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"relative-time"})],C.prototype,"relativeTime",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"show-more-link",type:Boolean})],C.prototype,"showMoreLink",void 0),(0,a.Cg)([(0,n.wk)()],C.prototype,"_logbookEntries",void 0),(0,a.Cg)([(0,n.wk)()],C.prototype,"_traceContexts",void 0),(0,a.Cg)([(0,n.wk)()],C.prototype,"_userIdToName",void 0),(0,a.Cg)([(0,n.wk)()],C.prototype,"_error",void 0),C=(0,a.Cg)([(0,n.EM)("ha-logbook")],C),t()}catch(m){t(m)}})},76309:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HaPanelLogbook:function(){return E}});i(3362);var o=i(40445),n=i(5124),r=i(67576),s=i(22786),c=i(44537),l=i(93905),d=i(91926),u=i(51758),h=i(6030),p=i(58987),g=i(26300),m=i(90248),_=i(2054),f=i(79286),v=(i(27330),i(86531)),b=i(95311),y=i(64808),w=i(14503),k=i(89434),C=e([p,g,m,_,f,k,v]);[p,g,m,_,f,k,v]=C.then?(await C)():C;let x,$,M,S,L=e=>e;const I="M17.65,6.35C16.2,4.9 14.21,4 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C15.73,20 18.84,17.45 19.73,14H17.65C16.83,16.33 14.61,18 12,18A6,6 0 0,1 6,12A6,6 0 0,1 12,6C13.66,6 15.14,6.69 16.22,7.78L13,11H20V4L17.65,6.35Z";class E extends n.WF{_goBack(){(0,d.OE)()}render(){return(0,n.qy)(x||(x=L` <ha-top-app-bar-fixed .narrow="${0}"> ${0} <div slot="title">${0}</div> <ha-icon-button slot="actionItems" @click="${0}" .path="${0}" .label="${0}"></ha-icon-button> <div class="content"> <div class="filters"> <ha-date-range-picker .startDate="${0}" .endDate="${0}" @value-changed="${0}" time-picker></ha-date-range-picker> <ha-target-picker .hass="${0}" .entityFilter="${0}" .value="${0}" add-on-top @value-changed="${0}" compact="compact"></ha-target-picker> </div> <ha-logbook .hass="${0}" .time="${0}" .entityIds="${0}" virtualize></ha-logbook> </div> </ha-top-app-bar-fixed> `),this.narrow,this._showBack?(0,n.qy)($||($=L` <ha-icon-button-arrow-prev slot="navigationIcon" @click="${0}"></ha-icon-button-arrow-prev> `),this._goBack):(0,n.qy)(M||(M=L` <ha-menu-button slot="navigationIcon" .hass="${0}" .narrow="${0}"></ha-menu-button> `),this.hass,this.narrow),this.hass.localize("panel.logbook"),this._refreshLogbook,I,this.hass.localize("ui.common.refresh"),this._time.range[0],this._time.range[1],this._dateRangeChanged,this.hass,this._filterFunc,this._targetPickerValue,this._targetsChanged,this.hass,this._time,this._getEntityIds())}willUpdate(e){super.willUpdate(e),this.hasUpdated||this._applyURLParams()}async _loadNumericDeviceClasses(){const e=await(0,y.KL)(this.hass);this._sensorNumericDeviceClasses=e.numeric_device_classes}firstUpdated(e){super.firstUpdated(e),this.hass.loadBackendTranslation("title"),this._loadNumericDeviceClasses();"1"===(0,h.px)().back&&history.length>1&&(this._showBack=!0,(0,d.oo)((0,u.Z)((0,h.s8)("back")),{replace:!0}))}connectedCallback(){super.connectedCallback(),window.addEventListener("location-changed",this._locationChanged)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("location-changed",this._locationChanged)}_getEntityIds(){const e=this.__getEntityIds(this._targetPickerValue,this.hass.entities,this.hass.devices,this.hass.areas);if(0!==e.length)return e}_applyURLParams(){const e=(0,h.px)(),t=e.entity_id,i=e.device_id,a=e.area_id,o=e.floor_id,n=e.label_id;if((t||i||a||o||n)&&(this._targetPickerValue={}),t){const e=t.split(",");this._targetPickerValue.entity_id=e}if(i){const e=i.split(",");this._targetPickerValue.device_id=e}if(a){const e=a.split(",");this._targetPickerValue.area_id=e}if(o){const e=o.split(",");this._targetPickerValue.floor_id=e}if(n){const e=n.split(",");this._targetPickerValue.label_id=e}const r=e.start_date,s=e.end_date;if(r||s){const e=r?new Date(r):this._time.range[0],t=s?new Date(s):this._time.range[1];e.getTime()===this._time.range[0].getTime()&&t.getTime()===this._time.range[1].getTime()||(this._time={range:[r?new Date(r):this._time.range[0],s?new Date(s):this._time.range[1]]})}}_dateRangeChanged(e){const t=e.detail.value.startDate,i=e.detail.value.endDate;this._time={range:[t,i]},this._updatePath()}_targetsChanged(e){this._targetPickerValue=e.detail.value||{},this._updatePath()}_updatePath(){const e={};this._targetPickerValue.entity_id&&(e.entity_id=(0,c.e)(this._targetPickerValue.entity_id).join(",")),this._targetPickerValue.label_id&&(e.label_id=(0,c.e)(this._targetPickerValue.label_id).join(",")),this._targetPickerValue.floor_id&&(e.floor_id=(0,c.e)(this._targetPickerValue.floor_id).join(",")),this._targetPickerValue.area_id&&(e.area_id=(0,c.e)(this._targetPickerValue.area_id).join(",")),this._targetPickerValue.device_id&&(e.device_id=(0,c.e)(this._targetPickerValue.device_id).join(",")),this._time.range[0]&&(e.start_date=this._time.range[0].toISOString()),this._time.range[1]&&(e.end_date=this._time.range[1].toISOString()),(0,d.oo)(`/logbook?${(0,h.KH)(e)}`,{replace:!0})}_refreshLogbook(){var e;null===(e=this.shadowRoot.querySelector("ha-logbook"))||void 0===e||e.refresh()}static get styles(){return[w.RF,(0,n.AH)(S||(S=L`:host{--ha-generic-picker-max-width:400px}.content{display:flex;flex-direction:column;height:calc(100vh - var(--header-height,0px) - var(--safe-area-inset-top,0px) - var(--safe-area-inset-bottom,0px));overflow-x:hidden;padding:0 0 16px}ha-logbook{flex:1;min-height:0}ha-date-range-picker{margin-right:16px;margin-inline-end:16px;margin-inline-start:initial;max-width:100%;direction:var(--direction)}@media all and (max-width:870px){ha-date-range-picker{width:100%}.filters{flex-direction:column}}:host([narrow]) ha-date-range-picker{margin-right:0;margin-inline-end:0;margin-inline-start:initial;direction:var(--direction);margin-bottom:8px}.content{overflow-x:hidden}.filters{display:flex;padding:16px 16px 0}:host([narrow]) .filters{flex-wrap:wrap}ha-target-picker{flex:1;max-width:100%;min-width:0}`))]}constructor(){super(),this.narrow=!1,this._targetPickerValue={},this._sensorNumericDeviceClasses=[],this._filterFunc=e=>(0,v.rc)(e,this._sensorNumericDeviceClasses),this._locationChanged=()=>{this._applyURLParams()},this.__getEntityIds=(0,s.A)((e,t,i,a)=>(0,b.wY)(this.hass,e,t,i,a));const e=new Date;e.setHours(e.getHours()-1,0,0,0);const t=new Date;t.setHours(t.getHours()+2,0,0,0),this._time={range:[e,t]}}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],E.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],E.prototype,"narrow",void 0),(0,o.Cg)([(0,r.wk)()],E.prototype,"_time",void 0),(0,o.Cg)([(0,r.wk)()],E.prototype,"_entityIds",void 0),(0,o.Cg)([(0,r.wk)()],E.prototype,"_showBack",void 0),(0,o.Cg)([(0,r.wk)(),(0,l.I)({key:"logbookPickedValue",state:!0,subscribe:!1})],E.prototype,"_targetPickerValue",void 0),(0,o.Cg)([(0,r.wk)()],E.prototype,"_sensorNumericDeviceClasses",void 0),E=(0,o.Cg)([(0,r.EM)("ha-panel-logbook")],E),a()}catch(x){a(x)}})}}]);