iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
36 lines • 110 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[84207],{80785:function(t,e,i){function o(t){return!!t&&(t instanceof Date&&!isNaN(t.valueOf()))}i.d(e,{A:function(){return o}})},57673:function(t,e,i){i.d(e,{z:function(){return o}});const o=t=>{if(void 0===t)return;if("object"!=typeof t){if("string"==typeof t||isNaN(t)){const e=(null==t?void 0:t.toString().split(":"))||[];if(1===e.length)return{seconds:Number(e[0])};if(e.length>3)return;const i=Number(e[2])||0,o=Math.floor(i);return{hours:Number(e[0])||0,minutes:Number(e[1])||0,seconds:o,milliseconds:Math.floor(1e3*Number((i-o).toFixed(4)))}}return{seconds:t}}if(!("days"in t))return t;const{days:e,minutes:i,seconds:o,milliseconds:r}=t;let a=t.hours||0;return a=(a||0)+24*(e||0),{hours:a,minutes:i,seconds:o,milliseconds:r}}},72487:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{CA:function(){return k},Mi:function(){return q},Pm:function(){return x},Wq:function(){return b},Yq:function(){return d},bl:function(){return S},c2:function(){return w},fr:function(){return m},gu:function(){return z},kz:function(){return u},m9:function(){return O},sl:function(){return y},ur:function(){return I},zB:function(){return p}});i(18111),i(20116);var r=i(74487),a=i(22786),n=i(46927),s=i(8480),l=t([r,s]);[r,s]=l.then?(await l)():l;(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,s.wj)(t.time_zone,e)}));const d=(t,e,i)=>c(e,i.time_zone).format(t),c=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),u=(t,e,i)=>h(e,i.time_zone).format(t),h=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),p=(t,e,i)=>{var o,r,a,s;const l=g(e,i.time_zone);if(e.date_format===n.ow.language||e.date_format===n.ow.system)return l.format(t);const d=l.formatToParts(t),c=null===(o=d.find(t=>"literal"===t.type))||void 0===o?void 0:o.value,u=null===(r=d.find(t=>"day"===t.type))||void 0===r?void 0:r.value,h=null===(a=d.find(t=>"month"===t.type))||void 0===a?void 0:a.value,p=null===(s=d.find(t=>"year"===t.type))||void 0===s?void 0:s.value,y=d[d.length-1];let v="literal"===(null==y?void 0:y.type)?null==y?void 0:y.value:"";"bg"===e.language&&e.date_format===n.ow.YMD&&(v="");return{[n.ow.DMY]:`${u}${c}${h}${c}${p}${v}`,[n.ow.MDY]:`${h}${c}${u}${c}${p}${v}`,[n.ow.YMD]:`${p}${c}${h}${c}${u}${v}`}[e.date_format]},g=(0,a.A)((t,e)=>{const i=t.date_format===n.ow.system?void 0:t.language;return t.date_format===n.ow.language||(t.date_format,n.ow.system),new Intl.DateTimeFormat(i,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})}),y=(t,e,i)=>v(e,i.time_zone).format(t),v=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short",timeZone:(0,s.wj)(t.time_zone,e)})),m=(t,e,i)=>f(e,i.time_zone).format(t),f=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),b=(t,e,i)=>_(e,i.time_zone).format(t),_=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",timeZone:(0,s.wj)(t.time_zone,e)})),w=(t,e,i)=>$(e,i.time_zone).format(t),$=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"short",timeZone:(0,s.wj)(t.time_zone,e)})),x=(t,e,i)=>C(e,i.time_zone).format(t),C=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),k=(t,e,i)=>M(e,i.time_zone).format(t),M=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",timeZone:(0,s.wj)(t.time_zone,e)})),z=(t,e,i)=>A(e,i.time_zone).format(t),A=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",timeZone:(0,s.wj)(t.time_zone,e)})),q=(t,e,i)=>Z(e,i.time_zone).format(t),Z=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),I=(t,e,i)=>E(e,i.time_zone).format(t),E=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",year:"numeric",timeZone:(0,s.wj)(t.time_zone,e)})),S=(t,e,i)=>{const o=(0,s.wj)(e.time_zone,i.time_zone);return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:o}).format(t)},O=(t,e,i,o)=>`${S(t,i,o)}/${S(e,i,o)}`;o()}catch(d){o(d)}})},30162:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{LW:function(){return y},Xs:function(){return p},fU:function(){return d},ie:function(){return u}});var r=i(74487),a=i(22786),n=i(8480),s=i(69543),l=t([r,n]);[r,n]=l.then?(await l)():l;const d=(t,e,i)=>c(e,i.time_zone).format(t),c=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,s.J)(t)?"h12":"h23",timeZone:(0,n.wj)(t.time_zone,e)})),u=(t,e,i)=>h(e,i.time_zone).format(t),h=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:(0,s.J)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,s.J)(t)?"h12":"h23",timeZone:(0,n.wj)(t.time_zone,e)})),p=(t,e,i)=>g(e,i.time_zone).format(t),g=(0,a.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",hour:(0,s.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,s.J)(t)?"h12":"h23",timeZone:(0,n.wj)(t.time_zone,e)})),y=(t,e,i)=>v(e,i.time_zone).format(t),v=(0,a.A)((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,n.wj)(t.time_zone,e)}));o()}catch(d){o(d)}})},27167:function(t,e,i){i.d(e,{A:function(){return r}});const o=t=>t<10?`0${t}`:t;function r(t){const e=Math.floor(t/3600),i=Math.floor(t%3600/60),r=Math.floor(t%3600%60);return e>0?`${e}:${o(i)}:${o(r)}`:i>0?`${i}:${o(r)}`:r>0?""+r:null}},69543:function(t,e,i){i.d(e,{J:function(){return a}});i(74423);var o=i(22786),r=i(46927);const a=(0,o.A)(t=>{if(t.time_format===r.Hg.language||t.time_format===r.Hg.system){const e=t.time_format===r.Hg.language?t.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(e).includes("10")}return t.time_format===r.Hg.am_pm})},99124:function(t,e,i){i.d(e,{C:function(){return o}});const o=t=>{t.preventDefault(),t.stopPropagation()}},53610:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{computeAttributeNameDisplay:function(){return b},computeAttributeValueDisplay:function(){return m},computeAttributeValueToParts:function(){return f}});i(44114),i(18111),i(61701),i(13579),i(33110),i(27495),i(25440);var r=i(88827),a=i(43248),n=i(80785),s=i(72487),l=i(95747),d=i(20058),c=i(52943),u=i(22682),h=i(6940),p=i(8549),g=i(71727),y=i(69093),v=t([d,r,l,s]);[d,r,l,s]=v.then?(await v)():v;const m=(t,e,i,o,r,a,n)=>f(t,e,i,o,r,a,n).map(t=>t.value).join(""),f=(t,e,i,o,c,v,f)=>{const b=void 0!==f?f:e.attributes[v];if(null==b)return[{type:"value",value:t("state.default.unknown")}];if("number"==typeof b){var _,w;const t=(0,y.t)(e),n=null===(_=r.Tf[t])||void 0===_?void 0:_[v],s=n?n(b,i):(0,d.ZV)(b,i);let l=null===(w=r.rM[t])||void 0===w?void 0:w[v];"weather"===t?l=(0,a.d9)(o,e,v):r.Zn.has(v)&&(l=o.unit_system.temperature);const c=[{type:"value",value:s}];if(l){const t=(0,p.A)(l,i);t&&c.push({type:"literal",value:t}),c.push({type:"unit",value:l})}return c}if("string"==typeof b&&(0,u.$)(b,!0)){if((0,h.F)(b)){const t=new Date(b);if((0,n.A)(t)){return[{type:"value",value:(0,l.yg)(t,i,o)}]}}const t=new Date(b);if((0,n.A)(t))return[{type:"value",value:(0,s.Yq)(t,i,o)}]}if(Array.isArray(b)&&b.some(t=>t instanceof Object)||!Array.isArray(b)&&b instanceof Object)return[{type:"value",value:JSON.stringify(b)}];if(Array.isArray(b)){return[{type:"value",value:b.map(r=>m(t,e,i,o,c,v,r)).join(", ")}]}const $=e.entity_id,x=(0,g.m)($),C=e.attributes.device_class,k=c[$],M=null==k?void 0:k.translation_key;return[{type:"value",value:M&&t(`component.${k.platform}.entity.${x}.${M}.state_attributes.${v}.state.${b}`)||C&&t(`component.${x}.entity_component.${C}.state_attributes.${v}.state.${b}`)||t(`component.${x}.entity_component._.state_attributes.${v}.state.${b}`)||b}]},b=(t,e,i,o)=>{const r=e.entity_id,a=e.attributes.device_class,n=(0,g.m)(r),s=i[r],l=null==s?void 0:s.translation_key;return l&&t(`component.${s.platform}.entity.${n}.${l}.state_attributes.${o}.name`)||a&&t(`component.${n}.entity_component.${a}.state_attributes.${o}.name`)||t(`component.${n}.entity_component._.state_attributes.${o}.name`)||(0,c.Z)(o.replace(/_/g," ").replace(/\bid\b/g,"ID").replace(/\bip\b/g,"IP").replace(/\bmac\b/g,"MAC").replace(/\bgps\b/g,"GPS"))};o()}catch(m){o(m)}})},3471:function(t,e,i){i.d(e,{e:function(){return o}});const o=t=>"latitude"in t.attributes&&"longitude"in t.attributes},19771:function(t,e,i){i.d(e,{D:function(){return s}});i(62953);var o=i(42017),r=i(63937),a=i(5055);class n extends o.WL{render(t,e){return this._key=t,e}update(t,e){const i=e[0],o=e[1];return i!==this._key&&((0,r.mY)(t),this._key=i),o}constructor(...t){super(...t),this._key=a.s6}}const s=(0,o.u$)(n)},52943:function(t,e,i){i.d(e,{Z:function(){return o}});const o=t=>t.charAt(0).toUpperCase()+t.slice(1)},8185:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{c:function(){return s},q:function(){return l}});var r=i(74487),a=i(22786),n=t([r]);r=(n.then?(await n)():n)[0];const s=(t,e)=>d(t).format(e),l=(t,e)=>c(t).format(e),d=(0,a.A)(t=>new Intl.ListFormat(t.language,{style:"long",type:"conjunction"})),c=(0,a.A)(t=>new Intl.ListFormat(t.language,{style:"long",type:"disjunction"}));o()}catch(s){o(s)}})},53516:function(t,e,i){i.d(e,{C:function(){return o}});const o=(t,e,i="...")=>t.length<=e+i.length?t:`${t.substring(0,e)}${i}`},78978:function(t,e,i){i.d(e,{_:function(){return r}});i(44114),i(33110),i(27495),i(25440),i(62953);var o=i(63533);const r=(t,e)=>{if(!(e instanceof o.C5))return{warnings:[e.message],errors:void 0};const i=[],r=[];for(const o of e.failures())if(void 0===o.value)i.push(t.localize("ui.errors.config.key_missing",{key:o.path.join(".")}));else if("never"===o.type)r.push(t.localize("ui.errors.config.key_not_expected",{key:o.path.join(".")}));else{if("union"===o.type)continue;"enums"===o.type?r.push(t.localize("ui.errors.config.key_wrong_type",{key:o.path.join("."),type_correct:o.message.replace("Expected ","").split(", ")[0],type_wrong:JSON.stringify(o.value)})):r.push(t.localize("ui.errors.config.key_wrong_type",{key:o.path.join("."),type_correct:o.refinement||o.type,type_wrong:JSON.stringify(o.value)}))}return{warnings:r,errors:i}}},34470:function(t,e,i){i.d(e,{E:function(){return r}});let o;const r=(0,i(5124).AH)(o||(o=(t=>t)`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)}`))},63130:function(t,e,i){i.d(e,{l:function(){return r}});i(3362);var o=i(50248);const r=async(t,e)=>{var i;if(navigator.clipboard)try{return void(await navigator.clipboard.writeText(t))}catch(n){}const r=e||(null===(i=(0,o.n)())||void 0===i?void 0:i.getRootNode())||document.body,a=document.createElement("textarea");a.value=t,a.setAttribute("readonly",""),a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.opacity="0",r.appendChild(a),a.select(),document.execCommand("copy"),r.removeChild(a)}},3931:function(t,e,i){i.d(e,{U:function(){return o}});i(3362),i(62953);const o=async(t,e,i,o,r,...a)=>{let n=o[t];n||(n=o[t]={});const s=n[r];if(s)return s;const l=i(o,r,...a);return n[r]=l,l.then(()=>setTimeout(()=>{n[r]=void 0},e),()=>{n[r]=void 0}),l}},3109:function(t,e,i){var o=i(40445),r=i(86137),a=i(67576);class n extends r.A{constructor(){super(),this.play=!0,this.iterations=1,this.fill="both",this.name="fadeIn"}}(0,o.Cg)([(0,a.MZ)({type:Boolean})],n.prototype,"play",void 0),n=(0,o.Cg)([(0,a.EM)("ha-fade-in")],n)},14328:function(t,e,i){var o=i(40445),r=i(86137),a=i(67576);class n extends r.A{constructor(){super(),this.play=!0,this.iterations=1,this.fill="both",this.name="fadeOut"}}(0,o.Cg)([(0,a.MZ)({type:Boolean})],n.prototype,"play",void 0),n=(0,o.Cg)([(0,a.EM)("ha-fade-out")],n)},7822:function(t,e,i){i.a(t,async function(t,e){try{i(62953);var o=i(40445),r=(i(86137),i(5124)),a=i(67576),n=i(19771),s=(i(3109),i(14328),i(26300)),l=t([s]);s=(l.then?(await l)():l)[0];let d,c,u,h,p,g,y=t=>t;const v="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z";class m extends r.WF{willUpdate(t){t.has("show")&&(this._highlight=0,!this.show&&this.hasUpdated&&(this._hide=!0))}render(){if(!this.show&&!this._hide)return r.s6;let t=(0,r.qy)(d||(d=y`<div><slot></slot></div>`));return this.interactive&&(t=(0,r.qy)(c||(c=y`<button> <slot></slot> <ha-svg-icon .path="${0}"></ha-svg-icon> </button>`),v)),this.show&&this._highlight?(0,n.D)(this._highlight,(0,r.qy)(u||(u=y` <wa-animation fill="both" .iterations="${0}" name="headShake" play>${0}</wa-animation> `),1,t)):!this.show&&this._hide?(0,r.qy)(h||(h=y` <ha-fade-out @wa-finish="${0}">${0}</ha-fade-out> `),this._handleHideFinish,t):(0,r.qy)(p||(p=y`<ha-fade-in .duration="${0}">${0}</ha-fade-in>`),250,t)}highlight(){this._highlight+=1}_handleHideFinish(){this._hide=!1}constructor(...t){super(...t),this.variant="info",this.interactive=!1,this.show=!1,this._hide=!1,this._highlight=0}}m.styles=(0,r.AH)(g||(g=y`:host{--background-color:var(--ha-color-fill-primary-normal-resting);--background-color-hover:var(--ha-color-fill-primary-normal-hover);--text-color:var(--ha-color-on-primary-normal);border-radius:var(--ha-border-radius-pill)}:host([variant=warning]){--background-color:var(--ha-color-fill-warning-normal-resting);--background-color-hover:var(--ha-color-fill-warning-normal-hover);--text-color:var(--ha-color-on-warning-normal)}:host([variant=neutral]){--background-color:var(--ha-color-fill-neutral-normal-resting);--background-color-hover:var(--ha-color-fill-neutral-normal-hover);--text-color:var(--ha-color-on-neutral-normal)}:host([variant=success]){--background-color:var(--ha-color-fill-success-normal-resting);--background-color-hover:var(--ha-color-fill-success-normal-hover);--text-color:var(--ha-color-on-success-normal)}:host([variant=danger]){--background-color:var(--ha-color-fill-danger-normal-resting);--background-color-hover:var(--ha-color-fill-danger-normal-hover);--text-color:var(--ha-color-on-danger-normal)}button,div{background:var(--background-color);border-radius:var(--ha-border-radius-pill);color:var(--text-color);display:inline-flex;gap:var(--ha-space-2);padding:var(--ha-space-1) var(--ha-space-2);align-items:center;--mdc-icon-size:16px;line-height:1;box-shadow:var(--ha-box-shadow-s)}button{border:none;cursor:pointer}button:hover{background:var(--background-color-hover)}button:focus-visible{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}`)),(0,o.Cg)([(0,a.MZ)({reflect:!0})],m.prototype,"variant",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],m.prototype,"interactive",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],m.prototype,"show",void 0),(0,o.Cg)([(0,a.wk)()],m.prototype,"_hide",void 0),(0,o.Cg)([(0,a.wk)()],m.prototype,"_highlight",void 0),m=(0,o.Cg)([(0,a.EM)("ha-automation-row-event-chip")],m),e()}catch(d){e(d)}})},56214:function(t,e,i){i.a(t,async function(t,e){try{i(3362),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(1087),s=i(26300),l=t([s]);s=(l.then?(await l)():l)[0];let d,c,u,h=t=>t;const p="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z";class g extends r.WF{render(){return(0,r.qy)(d||(d=h` <div class="row" tabindex="0" role="button" @keydown="${0}"> ${0} <div class="leading-icon-wrapper"> <slot name="leading-icon"></slot> </div> <div class="header"> <slot name="header"></slot> <slot name="event"></slot> </div> <div class="icons"> <slot name="icons"></slot> </div> </div> `),this._handleKeydown,this.leftChevron?(0,r.qy)(c||(c=h` <ha-icon-button class="expand-button" .path="${0}" @click="${0}" @keydown="${0}"></ha-icon-button> `),p,this._handleExpand,this._handleExpand):r.s6)}async _handleExpand(t){t.defaultPrevented||"keydown"===t.type&&"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),t.preventDefault(),(0,n.r)(this,"toggle-collapsed"))}async _handleKeydown(t){if(!(t.defaultPrevented||"Enter"!==t.key&&" "!==t.key&&(!this.sortSelected&&!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||"ArrowUp"!==t.key&&"ArrowDown"!==t.key))){if(t.preventDefault(),t.stopPropagation(),"ArrowUp"===t.key||"ArrowDown"===t.key)return"ArrowUp"===t.key?void(0,n.r)(this,"move-up"):void(0,n.r)(this,"move-down");!this.sortSelected||"Enter"!==t.key&&" "!==t.key?this.click():(0,n.r)(this,"stop-sort-selection")}}focus(){requestAnimationFrame(()=>{var t;null===(t=this._rowElement)||void 0===t||t.focus()})}constructor(...t){super(...t),this.leftChevron=!1,this.collapsed=!1,this.selected=!1,this.sortSelected=!1,this.disabled=!1,this.buildingBlock=!1,this.dim=!1}}g.styles=(0,r.AH)(u||(u=h`:host{display:block;position:relative}.row{display:flex;padding-left:var(--ha-space-3);padding-inline-start:var(--ha-space-3);padding-inline-end:initial;min-height:48px;align-items:flex-start;cursor:pointer;overflow:hidden;outline:0;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.row:focus{outline:var(--wa-focus-ring);outline-offset:-2px}.expand-button{transition:transform 150ms cubic-bezier(.4, 0, .2, 1);color:var(--ha-color-on-neutral-quiet);margin-left:calc(var(--ha-space-2) * -1);margin-inline-start:calc(var(--ha-space-2) * -1);margin-inline-end:initial}:host([building-block]) .leading-icon-wrapper{background-color:var(--ha-color-fill-neutral-loud-resting);border-radius:var(--ha-border-radius-md);padding:var(--ha-space-1);margin-top:10px;display:flex;justify-content:center;align-items:center;transform:rotate(45deg)}.leading-icon-wrapper{padding-top:var(--ha-space-3);position:relative;z-index:1}::slotted([slot=leading-icon]){color:var(--ha-color-on-neutral-quiet)}:host([building-block]) ::slotted(#condition-icon),:host([building-block]) ::slotted([slot=leading-icon].action-icon){--mdc-icon-size:var(--ha-space-5);color:var(--white-color);transform:rotate(-45deg)}:host([collapsed]) .expand-button{transform:rotate(180deg)}:host([selected]) .row,:host([selected]) .row:focus{outline:solid;outline-color:var(--primary-color);outline-offset:-2px;outline-width:2px}:host([disabled]) .row{border-top-right-radius:var(--ha-border-radius-square);border-top-left-radius:var(--ha-border-radius-square)}.header{position:relative;display:flex;align-items:center;flex:1;min-width:0;overflow-wrap:anywhere}::slotted([slot=header]){overflow-wrap:anywhere;margin:0 var(--ha-space-3)}::slotted([slot=event]){position:absolute;inset-inline-end:0}.icons{display:flex;align-items:center;flex-shrink:0}:host([sort-selected]) .row{outline:solid;outline-color:rgba(var(--rgb-accent-color),.6);outline-offset:-2px;outline-width:2px;background-color:rgba(var(--rgb-accent-color),.08)}.row:hover{background-color:rgba(var(--rgb-primary-text-color),.04)}:host([highlight]) .row{background-color:rgba(var(--rgb-primary-color),.08)}:host([highlight]) .row:hover{background-color:rgba(var(--rgb-primary-color),.16)}.icons,.leading-icon-wrapper,::slotted([slot=header]){transition:opacity var(--ha-animation-duration-normal);opacity:1}:host([dim]) .icons,:host([dim]) .leading-icon-wrapper,:host([dim]) ::slotted([slot=header]){opacity:.5}`)),(0,o.Cg)([(0,a.MZ)({attribute:"left-chevron",type:Boolean})],g.prototype,"leftChevron",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"collapsed",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"selected",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0,attribute:"sort-selected"})],g.prototype,"sortSelected",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"disabled",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0,attribute:"building-block"})],g.prototype,"buildingBlock",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"highlight",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"dim",void 0),(0,o.Cg)([(0,a.P)(".row")],g.prototype,"_rowElement",void 0),g=(0,o.Cg)([(0,a.EM)("ha-automation-row")],g),e()}catch(d){e(d)}})},17062:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{V:function(){return b}});i(26910),i(13609),i(18111),i(20116),i(61701),i(3362),i(62953);var r=i(40445),a=i(35211),n=i(5124),s=i(67576),l=i(22786),d=i(1087),c=i(52220),u=i(22792),h=i(10139),p=i(38508),g=t([p]);p=(g.then?(await g)():g)[0];let y,v,m=t=>t;const f="NO_AUTOMATION";class b extends n.WF{get NO_AUTOMATION_TEXT(){return this.hass.localize("ui.panel.config.devices.automation.actions.no_actions")}get _value(){if(!this.value||!this._automations)return"";if(!this._automations.length)return f;const t=this._automations.findIndex(t=>(0,h.Po)(this._entityReg,t,this.value));return-1===t?this.value.alias||this.value.type||"unknown":`${this._automations[t].device_id}_${t}`}render(){if(this._renderEmpty)return n.s6;const t=this._value;return(0,n.qy)(y||(y=m`<ha-generic-picker .hass="${0}" .label="${0}" .value="${0}" .disabled="${0}" .getItems="${0}" @value-changed="${0}" .valueRenderer="${0}" .unknownItemText="${0}" hide-clear-icon> </ha-generic-picker>`),this.hass,this.label,t,!this._automations||0===this._automations.length,this._getItems(t,this._automations),this._automationChanged,this._valueRenderer,this.hass.localize("ui.panel.config.devices.automation.actions.unknown_action"))}updated(t){super.updated(t),t.has("deviceId")&&this._updateDeviceInfo()}async _updateDeviceInfo(){this._automations=this.deviceId?(await this._fetchDeviceAutomations(this.hass.callWS,this.deviceId)).sort(h.RK):[],this.value&&this.value.device_id===this.deviceId||this._setValue(this._automations.length?this._automations[0]:this._createNoAutomation(this.deviceId)),this._renderEmpty=!0,await this.updateComplete,this._renderEmpty=!1}_automationChanged(t){t.stopPropagation();const e=t.detail.value;if(!e||f===e)return;const[i,o]=e.split("_"),r=this._automations[o];r.device_id===i&&this._setValue(r)}_setValue(t){if(this.value&&(0,h.Po)(this._entityReg,t,this.value))return;const e=Object.assign({},t);delete e.metadata,(0,d.r)(this,"value-changed",{value:e})}constructor(t,e,i){super(),this._renderEmpty=!1,this._entityReg=[],this._getItems=(0,l.A)((t,e)=>{if(!e)return()=>{};const i=e.map((t,e)=>{const i=this._localizeDeviceAutomation(this.hass.localize,this.hass.states,this._entityReg,t);return{id:`${t.device_id}_${e}`,primary:i}});return i.sort((t,e)=>(0,c.SH)(t.primary,e.primary,this.hass.locale.language)),t===f&&i.unshift({id:f,primary:this.NO_AUTOMATION_TEXT}),()=>i}),this._valueRenderer=t=>{var e;const i=null===(e=this._automations)||void 0===e?void 0:e.find((e,i)=>t===`${e.device_id}_${i}`),o=i?this._localizeDeviceAutomation(this.hass.localize,this.hass.states,this._entityReg,i):t===f?this.NO_AUTOMATION_TEXT:t;return(0,n.qy)(v||(v=m`<span slot="headline">${0}</span>`),o)},this._localizeDeviceAutomation=t,this._fetchDeviceAutomations=e,this._createNoAutomation=i}}(0,r.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,r.Cg)([(0,s.MZ)()],b.prototype,"label",void 0),(0,r.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"deviceId",void 0),(0,r.Cg)([(0,s.MZ)({type:Object})],b.prototype,"value",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_automations",void 0),(0,r.Cg)([(0,s.wk)()],b.prototype,"_renderEmpty",void 0),(0,r.Cg)([(0,s.wk)(),(0,a.Fg)({context:u.ih,subscribe:!0})],b.prototype,"_entityReg",void 0),o()}catch(y){o(y)}})},1798:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701),i(53921),i(3362),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(22786),s=i(1087),l=i(65522),d=i(37981),c=i(76774),u=i(77423),h=i(31422),p=i(44144),g=i(38508),y=t([g]);g=(y.then?(await y)():y)[0];let v,m,f,b,_,w,$,x,C,k=t=>t;class M extends r.WF{firstUpdated(t){super.firstUpdated(t),this._loadConfigEntries()}async _loadConfigEntries(){const t=await(0,u.VN)(this.hass);this._configEntryLookup=Object.fromEntries(t.map(t=>[t.entry_id,t]))}render(){var t;const e=null!==(t=this.placeholder)&&void 0!==t?t:this.hass.localize("ui.components.device-picker.placeholder"),i=this._valueRenderer(this._configEntryLookup);return(0,r.qy)(v||(v=k` <ha-generic-picker .hass="${0}" .autofocus="${0}" .disabled="${0}" .helper="${0}" .label="${0}" .searchLabel="${0}" .notFoundLabel="${0}" .emptyLabel="${0}" .placeholder="${0}" .value="${0}" .rowRenderer="${0}" .getItems="${0}" .hideClearIcon="${0}" .valueRenderer="${0}" .searchKeys="${0}" .unknownItemText="${0}" @value-changed="${0}"> </ha-generic-picker> `),this.hass,this.autofocus,this.disabled,this.helper,this.label,this.searchLabel,this._notFoundLabel,this.hass.localize("ui.components.device-picker.no_devices"),e,this.value,this._rowRenderer,this._getItems,this.hideClearIcon,i,h._o,this.hass.localize("ui.components.device-picker.unknown"),this._valueChanged)}async open(){var t;await this.updateComplete,await(null===(t=this._picker)||void 0===t?void 0:t.open())}_valueChanged(t){t.stopPropagation();const e=t.detail.value;this.value=e,(0,s.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.autofocus=!1,this.disabled=!1,this.required=!1,this.hideClearIcon=!1,this._configEntryLookup={},this._getDevicesMemoized=(0,n.A)((t,e,i,o,r,a,n,s,l)=>(0,h.oG)(this.hass,e,i,o,r,a,n,s,l)),this._getItems=()=>this._getDevicesMemoized(this.hass.devices,this._configEntryLookup,this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeDevices,this.value),this._valueRenderer=(0,n.A)(t=>e=>{var i;const o=e,a=this.hass.devices[o];if(!a)return(0,r.qy)(m||(m=k`<span slot="headline">${0}</span>`),o);const n=(0,c.q)(a,this.hass.areas),s=a?(0,d.xn)(a):void 0,u=n?(0,l.A)(n):void 0,h=a.primary_config_entry?t[a.primary_config_entry]:void 0;return(0,r.qy)(f||(f=k` ${0} <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> `),h?(0,r.qy)(b||(b=k`<img slot="start" alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${0}">`),(0,p.MR)({domain:h.domain,type:"icon",darkOptimized:null===(i=this.hass.themes)||void 0===i?void 0:i.darkMode},this.hass.auth.data.hassUrl)):r.s6,s,u)}),this._rowRenderer=t=>(0,r.qy)(_||(_=k` <ha-combo-box-item type="button"> ${0} <span slot="headline">${0}</span> ${0} ${0} </ha-combo-box-item> `),t.domain?(0,r.qy)(w||(w=k` <img slot="start" alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${0}"> `),(0,p.MR)({domain:t.domain,type:"icon",darkOptimized:this.hass.themes.darkMode},this.hass.auth.data.hassUrl)):r.s6,t.primary,t.secondary?(0,r.qy)($||($=k`<span slot="supporting-text">${0}</span>`),t.secondary):r.s6,t.domain_name?(0,r.qy)(x||(x=k` <div slot="trailing-supporting-text" class="domain"> ${0} </div> `),t.domain_name):r.s6),this._notFoundLabel=t=>this.hass.localize("ui.components.device-picker.no_match",{term:(0,r.qy)(C||(C=k`<b>‘${0}’</b>`),t)})}}(0,o.Cg)([(0,a.MZ)({attribute:!1})],M.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],M.prototype,"autofocus",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],M.prototype,"disabled",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],M.prototype,"required",void 0),(0,o.Cg)([(0,a.MZ)()],M.prototype,"label",void 0),(0,o.Cg)([(0,a.MZ)()],M.prototype,"value",void 0),(0,o.Cg)([(0,a.MZ)()],M.prototype,"helper",void 0),(0,o.Cg)([(0,a.MZ)()],M.prototype,"placeholder",void 0),(0,o.Cg)([(0,a.MZ)({type:String,attribute:"search-label"})],M.prototype,"searchLabel",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],M.prototype,"createDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-domains"})],M.prototype,"includeDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"exclude-domains"})],M.prototype,"excludeDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-device-classes"})],M.prototype,"includeDeviceClasses",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"exclude-devices"})],M.prototype,"excludeDevices",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],M.prototype,"deviceFilter",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],M.prototype,"entityFilter",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"hide-clear-icon",type:Boolean})],M.prototype,"hideClearIcon",void 0),(0,o.Cg)([(0,a.P)("ha-generic-picker")],M.prototype,"_picker",void 0),(0,o.Cg)([(0,a.wk)()],M.prototype,"_configEntryLookup",void 0),M=(0,o.Cg)([(0,a.EM)("ha-device-picker")],M),e()}catch(v){e(v)}})},82474:function(t,e,i){i.a(t,async function(t,e){try{i(13609),i(18111),i(20116),i(61701),i(3362),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(22786),s=i(1087),l=i(74705),d=i(78649),c=i(53756),u=i(95350),h=i(24367),p=i(19711),g=(i(75064),i(38508)),y=(i(47680),i(67094),i(74281)),v=t([g,y]);[g,y]=v.then?(await v)():v;let m,f,b,_,w,$,x,C,k,M,z,A,q,Z,I,E=t=>t;const S="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",O="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",H="___create-new-entity___";class D extends r.WF{willUpdate(t){var e;this._pendingEntityId&&t.has("hass")&&this.hass.states!==(null===(e=t.get("hass"))||void 0===e?void 0:e.states)&&this.hass.states[this._pendingEntityId]&&(this._setValue(this._pendingEntityId),this._pendingEntityId=void 0)}firstUpdated(t){super.firstUpdated(t),this.hass.loadBackendTranslation("title")}_findExtraOption(t){var e;return t?null===(e=this.extraOptions)||void 0===e?void 0:e.find(e=>e.id===t):void 0}_renderExtraOptionStart(t){const e=t.entity_id?this.hass.states[t.entity_id]:void 0;return e?(0,r.qy)(m||(m=E` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),e,this.hass):t.icon_path?(0,r.qy)(f||(f=E` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> `),t.icon_path):t.icon?(0,r.qy)(b||(b=E`<ha-icon slot="start" .icon="${0}"></ha-icon>`),t.icon):r.s6}get _showEntityId(){var t;return this.showEntityId||(null===(t=this.hass.userData)||void 0===t?void 0:t.showEntityIdPicker)}_shouldHideClearIcon(){var t;return!(null===(t=this._findExtraOption(this.value))||void 0===t||!t.hide_clear)}render(){var t,e;const i=null!==(t=this.placeholder)&&void 0!==t?t:this.hass.localize("ui.components.entity.entity-picker.placeholder");return(0,r.qy)(_||(_=E` <ha-generic-picker .hass="${0}" .disabled="${0}" .autofocus="${0}" .allowCustomValue="${0}" .required="${0}" .label="${0}" .placeholder="${0}" .helper="${0}" .value="${0}" .searchLabel="${0}" .notFoundLabel="${0}" .rowRenderer="${0}" .getItems="${0}" .getAdditionalItems="${0}" .hideClearIcon="${0}" .searchFn="${0}" .valueRenderer="${0}" .searchKeys="${0}" use-top-label .addButtonLabel="${0}" .unknownItemText="${0}" @value-changed="${0}"> </ha-generic-picker> `),this.hass,this.disabled,this.autofocus,this.allowCustomEntity,this.required,this.label,i,this.helper,this.addButton?void 0:this.value,this.searchLabel,this._notFoundLabel,this._rowRenderer,this._getItems,this._getAdditionalItems,this.hideClearIcon||this._shouldHideClearIcon(),this._searchFn,this._valueRenderer,c.t,this.addButton?null!==(e=this.addButtonLabel)&&void 0!==e?e:this.hass.localize("ui.components.entity.entity-picker.add"):void 0,this.hass.localize("ui.components.entity.entity-picker.unknown"),this._valueChanged)}async open(){var t;await this.updateComplete,await(null===(t=this._picker)||void 0===t?void 0:t.open())}_valueChanged(t){t.stopPropagation();const e=t.detail.value;if(e){if(e.startsWith(H)){const t=e.substring(H.length);return void(0,p.$)(this,{domain:t,dialogClosedCallback:t=>{t.entityId&&(this.hass.states[t.entityId]?this._setValue(t.entityId):this._pendingEntityId=t.entityId)}})}((0,d.n)(e)||this._findExtraOption(e))&&this._setValue(e)}else this._setValue(void 0)}_setValue(t){this.value=t,(0,s.r)(this,"value-changed",{value:t}),(0,s.r)(this,"change")}constructor(...t){super(...t),this.autofocus=!1,this.disabled=!1,this.required=!1,this.showEntityId=!1,this.hideClearIcon=!1,this.addButton=!1,this._valueRenderer=t=>{const e=t||"",i=this._findExtraOption(e);if(i)return(0,r.qy)(w||(w=E` ${0} <span slot="headline">${0}</span> ${0} `),this._renderExtraOptionStart(i),i.primary,i.secondary?(0,r.qy)($||($=E`<span slot="supporting-text">${0}</span>`),i.secondary):r.s6);const o=this.hass.states[e];if(!o)return(0,r.qy)(x||(x=E` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> <span slot="headline">${0}</span> `),O,e);const{primary:a,secondary:n}=(0,l.Bj)(this.hass,o);return(0,r.qy)(C||(C=E` <state-badge .hass="${0}" .stateObj="${0}" slot="start"></state-badge> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> `),this.hass,o,a,n)},this._rowRenderer=(t,e)=>{const i=this._showEntityId;return(0,r.qy)(k||(k=E` <ha-combo-box-item type="button" compact="compact" .borderTop="${0}"> ${0} <span slot="headline">${0}</span> ${0} ${0} ${0} </ha-combo-box-item> `),0!==e,t.icon_path?(0,r.qy)(M||(M=E` <ha-svg-icon slot="start" style="margin:0 4px" .path="${0}"></ha-svg-icon> `),t.icon_path):(0,r.qy)(z||(z=E` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),t.stateObj,this.hass),t.primary,t.secondary?(0,r.qy)(A||(A=E`<span slot="supporting-text">${0}</span>`),t.secondary):r.s6,t.stateObj&&i?(0,r.qy)(q||(q=E` <span slot="supporting-text" class="code"> ${0} </span> `),t.stateObj.entity_id):r.s6,t.domain_name&&!i?(0,r.qy)(Z||(Z=E` <div slot="trailing-supporting-text" class="domain"> ${0} </div> `),t.domain_name):r.s6)},this._getAdditionalItems=()=>this._getCreateItems(this.hass.localize,this.createDomains),this._getCreateItems=(0,n.A)((t,e)=>null!=e&&e.length?(this.hass.loadFragmentTranslation("config"),e.map(e=>{const i=t("ui.components.entity.entity-picker.create_helper",{domain:(0,h.z)(e)?t(`ui.panel.config.helpers.types.${e}`)||e:(0,u.p$)(t,e)});return{id:H+e,primary:i,secondary:t("ui.components.entity.entity-picker.new_entity"),icon_path:S}})):[]),this._getEntitiesMemoized=(0,n.A)(c.w),this._getItems=()=>{var t;const e=this._getEntitiesMemoized(this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities,this.value);if(null!==(t=this.extraOptions)&&void 0!==t&&t.length){return[...this.extraOptions.map(t=>Object.assign(Object.assign({},t),{},{stateObj:t.entity_id?this.hass.states[t.entity_id]:void 0})),...e]}return e},this._searchFn=(t,e)=>{const i=e.findIndex(e=>{var i;return(null===(i=e.stateObj)||void 0===i?void 0:i.entity_id)===t});if(-1===i)return e;const[o]=e.splice(i,1);return e.unshift(o),e},this._notFoundLabel=t=>this.hass.localize("ui.components.entity.entity-picker.no_match",{term:(0,r.qy)(I||(I=E`<b>‘${0}’</b>`),t)})}}(0,o.Cg)([(0,a.MZ)({attribute:!1})],D.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],D.prototype,"autofocus",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],D.prototype,"disabled",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],D.prototype,"required",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"allow-custom-entity"})],D.prototype,"allowCustomEntity",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"show-entity-id"})],D.prototype,"showEntityId",void 0),(0,o.Cg)([(0,a.MZ)()],D.prototype,"label",void 0),(0,o.Cg)([(0,a.MZ)()],D.prototype,"value",void 0),(0,o.Cg)([(0,a.MZ)()],D.prototype,"helper",void 0),(0,o.Cg)([(0,a.MZ)()],D.prototype,"placeholder",void 0),(0,o.Cg)([(0,a.MZ)({type:String,attribute:"search-label"})],D.prototype,"searchLabel",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],D.prototype,"createDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-domains"})],D.prototype,"includeDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"exclude-domains"})],D.prototype,"excludeDomains",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-device-classes"})],D.prototype,"includeDeviceClasses",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-unit-of-measurement"})],D.prototype,"includeUnitOfMeasurement",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"include-entities"})],D.prototype,"includeEntities",void 0),(0,o.Cg)([(0,a.MZ)({type:Array,attribute:"exclude-entities"})],D.prototype,"excludeEntities",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],D.prototype,"entityFilter",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],D.prototype,"extraOptions",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"hide-clear-icon",type:Boolean})],D.prototype,"hideClearIcon",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"add-button",type:Boolean})],D.prototype,"addButton",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"add-button-label"})],D.prototype,"addButtonLabel",void 0),(0,o.Cg)([(0,a.P)("ha-generic-picker")],D.prototype,"_picker",void 0),(0,o.Cg)([(0,a.wk)()],D.prototype,"_pendingEntityId",void 0),D=(0,o.Cg)([(0,a.EM)("ha-entity-picker")],D),e()}catch(m){e(m)}})},74281:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(7588),i(45367),i(92731),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(63672),s=i(89784),l=i(71727),d=i(69093),c=i(52658),u=i(34470),h=i(10897),p=i(38279),g=i(93367),y=t([g]);g=(y.then?(await y)():y)[0];let v,m,f,b=t=>t;const _="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z";class w extends r.WF{connectedCallback(){var t,e;super.connectedCallback(),this.hasUpdated&&void 0===this.overrideImage&&(null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture||null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture_local)&&this.requestUpdate("stateObj")}disconnectedCallback(){var t,e;super.disconnectedCallback(),void 0===this.overrideImage&&(null!==(t=this.stateObj)&&void 0!==t&&t.attributes.entity_picture||null!==(e=this.stateObj)&&void 0!==e&&e.attributes.entity_picture_local)&&(this.style.backgroundImage="")}get _stateColor(){var t;const e=this.stateObj?(0,d.t)(this.stateObj):void 0;return null!==(t=this.stateColor)&&void 0!==t?t:"light"===e}render(){const t=this.stateObj;if(!t&&!this.overrideIcon&&!this.overrideImage)return(0,r.qy)(v||(v=b`<div class="missing"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div>`),_);const e=this.getClass();if(e&&e.forEach((t,e)=>{t?this.classList.add(e):this.classList.remove(e)}),!this.icon)return r.s6;const i=t?(0,d.t)(t):void 0;return(0,r.qy)(m||(m=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,n.J)(i),(0,n.J)(null==t?void 0:t.state),this.overrideIcon,t)}willUpdate(t){if(super.willUpdate(t),!(t.has("stateObj")||t.has("overrideImage")||t.has("overrideIcon")||t.has("stateColor")||t.has("color")))return;const e=this.stateObj,i={};let o="";if(this.icon=!0,e){const t=(0,l.m)(e.entity_id);if(void 0===this.overrideImage)if(!e.attributes.entity_picture_local&&!e.attributes.entity_picture||this.overrideIcon){if(this.color)i.color=this.color;else if(this._stateColor){const t=(0,c.Se)(e);if(t&&(i.color=t),e.attributes.rgb_color&&(i.color=`rgb(${e.attributes.rgb_color.join(",")})`),e.attributes.brightness){const t=e.attributes.brightness;if("number"!=typeof t){const i=`Type error: state-badge expected number, but type of ${e.entity_id}.attributes.brightness is ${typeof t} (${t})`;console.warn(i)}i.filter=(0,c.mT)(e)}if(e.attributes.hvac_action){const t=e.attributes.hvac_action;t in p.sx?i.color=(0,c.Se)(e,p.sx[t]):delete i.color}}}else{let i=e.attributes.entity_picture_local||e.attributes.entity_picture;this.hass&&(i=this.hass.hassUrl(i)),"camera"===t&&(i=(0,h.su)(i,80,80)),o=`url(${i})`,this.icon=!1}else if(this.overrideImage){let t=this.overrideImage;this.hass&&(t=this.hass.hassUrl(t)),o=`url(${t})`,this.icon=!1}}this._iconStyle=i,this.style.backgroundImage=o}getClass(){const t=new Map(["has-no-radius","has-media-image","has-image"].map(t=>[t,!1]));if(this.stateObj){const e=(0,l.m)(this.stateObj.entity_id);"update"===e?t.set("has-no-radius",!0):"media_player"===e||"camera"===e?t.set("has-media-image",!0):""!==this.style.backgroundImage&&t.set("has-image",!0)}return t}static get styles(){return[u.E,(0,r.AH)(f||(f=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(...t){super(...t),this.icon=!0,this._iconStyle={}}}(0,o.Cg)([(0,a.MZ)({attribute:!1})],w.prototype,"stateObj",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],w.prototype,"overrideIcon",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],w.prototype,"overrideImage",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],w.prototype,"stateColor",void 0),(0,o.Cg)([(0,a.MZ)()],w.prototype,"color",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],w.prototype,"icon",void 0),(0,o.Cg)([(0,a.wk)()],w.prototype,"_iconStyle",void 0),w=(0,o.Cg)([(0,a.EM)("state-badge")],w),e()}catch(v){e(v)}})},76776:function(t,e,i){i(62953);var o=i(40445),r=i(5124),a=i(67576);let n,s,l,d=t=>t;class c extends r.WF{render(){return(0,r.qy)(n||(n=d` ${0} <slot></slot> `),this.header?(0,r.qy)(s||(s=d`<h1 class="card-header">${0}</h1>`),this.header):r.s6)}constructor(...t){super(...t),this.raised=!1}}c.styles=(0,r.AH)(l||(l=d`:host{background:var(--ha-card-background,var(--card-background-color,#fff));-webkit-backdrop-filter:var(--ha-card-backdrop-filter,none);backdrop-filter:var(--ha-card-backdrop-filter,none);box-shadow:var(--ha-card-box-shadow,none);box-sizing:border-box;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-width:var(--ha-card-border-width,1px);border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));color:var(--primary-text-color);display:block;transition:all .3s ease-out;position:relative}:host([raised]){border:none;box-shadow:var(--ha-card-box-shadow,0px 2px 1px -1px rgba(0,0,0,.2),0px 1px 1px 0px rgba(0,0,0,.14),0px 1px 3px 0px rgba(0,0,0,.12))}.card-header,:host ::slotted(.card-header){color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-card-header-font-size, var(--ha-font-size-2xl));letter-spacing:-.012em;line-height:var(--ha-line-height-expanded);padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4);display:block;margin-block-start:0;margin-block-end:0;font-weight:var(--ha-font-weight-normal)}
:host
::slotted(
.card-content:not(:nth-child(1 of .card-content, .card-header))
),
slot:not(:first-child)::slotted(.card-content) {
padding-top: 0;
margin-top: calc(var(--ha-space-2) * -1);
}
:host ::slotted(.card-content){padding:var(--ha-space-4)}:host ::slotted(.card-actions){border-top:1px solid var(--divider-color,#e8e8e8);padding:var(--ha-space-2)}`)),(0,o.Cg)([(0,a.MZ)()],c.prototype,"header",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],c.prototype,"raised",void 0),c=(0,o.Cg)([(0,a.EM)("ha-card")],c)},9503:function(t,e,i){var o=i(40445),r=i(97577),a=i(5124),n=i(67576);let s,l=t=>t;class d extends r.A{get value(){var t;return null!==(t=this._value)&&void 0!==t?t:null}set value(t){this._value=t}static get styles(){return[r.A.styles,(0,a.AH)(s||(s=l`:host{--wa-form-control-toggle-size:var(--ha-checkbox-size, 20px);--wa-form-control-border-color:var(
--ha-checkbox-border-color,
var(--ha-color-border-neutral-normal)
);--wa-form-control-background-color:var(
--ha-checkbox-background-color,
var(--wa-form-control-background-color)
);--checked-icon-color:var(
--ha-checkbox-checked-icon-color,
var(--wa-color-brand-on-loud)
);--wa-form-control-activated-color:var(
--ha-checkbox-checked-background-color,
var(--ha-color-fill-primary-loud-resting)
);-webkit-tap-highlight-color:transparent;--checked-icon-scale:var(--ha-checkbox-checked-icon-scale, 0.9);--wa-form-control-required-content:var(
--ha-checkbox-required-marker,
var(--ha-input-required-marker, "*")
);--wa-form-control-required-content-offset:var(
--ha-checkbox-required-marker-offset,
0.1rem
)}[part~=base]{align-items:center;gap:var(--ha-space-2)}[part~=control]{border-radius:var(--ha-checkbox-border-radius,var(--ha-border-radius-sm));border-width:var(--ha-checkbox-border-width,var(--ha-border-width-md));margin-inline-end:0}[part~=label]{line-height:1}#hint{font-size:var(--ha-font-size-xs);color:var(--ha-color-text-secondary)}label:has(input:not(:disabled)):hover{--wa-form-control-border-color:var(
--ha-checkbox-border-color-hover,
var(--ha-checkbox-border-color, var(--ha-color-border-neutral-loud))
)}label:has(input:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-background-color-hover,var(--ha-color-form-background-hover))}label:has(input:checked:not(:disabled)):hover [part~=control],label:has(input:indeterminate:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover));border-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover))}`))]}}d=(0,o.Cg)([(0,n.EM)("ha-checkbox")],d)},59174:function(t,e,i){i.a(t,async function(t,e){try{var o=i(40445),r=i(35211),a=i(5124),n=i(67576),s=i(91450),l=i(22792),d=i(85694),c=i(44144),u=(i(47680),t([d]));d=(u.then?(await u)():u)[0];let h,p,g,y,v,m,f,b=t=>t;class _ extends a.WF{render(){if(this.icon)return(0,a.qy)(h||(h=b`<ha-icon .icon="${0}"></ha-icon>`),this.icon);if(!this.domain)return a.s6;if(!this._connection||!this._hassConfig)return this._renderFallback();const t=(0,d._4)(this._connection.connection,this._hassConfig.config,this.domain,this.deviceClass,this.state).then(t=>t?(0,a.qy)(p||(p=b`<ha-icon .icon="${0}"></ha-icon>`),t):this._renderFallback());return(0,a.qy)(g||(g=b`${0}`),(0,s.T)(t))}_renderFallback(){if(this.domain&&this.domain in d.l)return(0,a.qy)(y||(y=b` <ha-svg-icon .path="${0}"></ha-svg-icon> `),d.l[this.domain]);if(this.brandFallback){var t,e;const i=(0,c.MR)({domain:this.domain,type:"icon",darkOptimized:null===(t=this._hassUi)||void 0===t?void 0:t.themes.darkMode},null===(e=this._hassConfig)||void 0===e?void 0:e.auth.data.hassUrl);return(0,a.qy)(v||(v=b` <img alt="" src="${0}" crossorigin="anonymous" referrerpolicy="no-referrer"> `),i)}return(0,a.qy)(m||(m=b`<ha-svg-icon .path="${0}"></ha-svg-icon>`),d.lW)}}_.styles=(0,a.AH)(f||(f=b`img{width:var(--mdc-icon-size,24px)}`)),(0,o.Cg)([(0,n.MZ)()],_.prototype,"domain",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"deviceClass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"state",void 0),(0,o.Cg)([(0,n.MZ)()],_.prototype,"icon",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"brand-fallback",type:Boolean})],_.prototype,"brandFallback",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.WF,subscribe:!0})],_.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.Wq,subscribe:!0})],_.prototype,"_connection",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:l.EK,subscribe:!0})],_.prototype,"_hassUi",void 0),_=(0,o.Cg)([(0,n.EM)("ha-domain-icon")],_),e()}catch(h){e(h)}})},11382:function(t,e,i){i(3362),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(6412),s=i(1087),l=i(12587);i(67094);let d,c,u,h,p=t=>t;class g extends r.WF{render(){const t=this.noCollapse?r.s6:(0,r.qy)(d||(d=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,n.H)({expanded:this.expanded}));return(0,r.qy)(c||(c=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,n.H)({expanded:this.expanded}),(0,n.H)({noCollapse:this.noCollapse}),this._toggleContainer,this._toggleContainer,this._focusChanged,this._focusChanged,this.noCollapse?-1:0,this.expanded,this.leftChevron?t:r.s6,this.header,this.secondary,this.leftChevron?r.s6:t,(0,n.H)({expanded:this.expanded}),this._handleTransitionEnd,!this.expanded,this._showContent?(0,r.qy)(u||(u=p`<slot></slot>`)):"")}willUpdate(t){super.willUpdate(t),t.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(t){if(t.defaultPrevented)return;if("keydown"===t.type&&"Enter"!==t.key&&" "!==t.key)return;if(t.preventDefault(),this.noCollapse)return;const e=!this.expanded;(0,s.r)(this,"expanded-will-change",{expanded:e}),this._container.style.overflow="hidden",e&&(this._showContent=!0,await(0,l.E)());const i=this._container.scrollHeight;this._container.style.height=`${i}px`,e||setTimeout(()=>{this._container.style.height="0px"},0),this.expanded=e,(0,s.r)(this,"expanded-changed",{expanded:this.expanded})}_focusChanged(t){this.noCollapse||this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===t.type)}constructor(...t){super(...t),this.expanded=!1,this.outlined=!1,this.leftChevron=!1,this.noCollapse=!1,this._showContent=this.expanded}}g.styles=(0,r.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,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"expanded",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],g.prototype,"outlined",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"left-chevron",type:Boolean,reflect:!0})],g.prototype,"leftChevron",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"no-collapse",type:Boolean,reflect:!0})],g.prototype,"noCollapse",void 0),(0,o.Cg)([(0,a.MZ)()],g.prototype,"header",void 0),(0,o.Cg)([(0,a.MZ)()],g.prototype,"secondary",void 0),(0,o.Cg)([(0,a.wk)()],g.prototype,"_showContent",void 0),(0,o.Cg)([(0,a.P)(".container")],g.prototype,"_container",void 0),g=(0,o.Cg)([(0,a.EM)("ha-expansion-panel")],g)},606:function(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(61701),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(63672),s=i(22786),l=i(1087),d=i(29823),c=(i(70947),i(3449),i(88285)),u=(i(67094),t([d,c]));[d,c]=u.then?(await u)():u;let h,p,g,y,v,m,f,b,_,w=t=>t;class $ extends r.WF{render(){return this.disabled?(0,r.qy)(h||(h=w`${0}${0}`),this._renderField(),this._renderHelper()):(0,r.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(t=>{var e;const i=["string","number"].includes(typeof t);return(0,r.qy)(g||(g=w` <ha-dropdown-item .value="${0}" .disabled="${0}" .selected="${0}"> ${0} <div class="content"> ${0} ${0} </div> </ha-dropdown-item> `),i?t:t.value,!i&&(null!==(e=t.disabled)&&void 0!==e&&e),this.value===(i?t:t.value),t.iconPath?(0,r.qy)(y||(y=w`<ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon>`),t.iconPath):r.s6,i?t:t.label||t.value,t.secondary?(0,r.qy)(v||(v=w`<div class="secondary">${0}</div>`),t.secondary):r.s6)}):(0,r.qy)(m||(m=w`<slot></slot>`)),this._renderHelper())}_renderField(){const t=this._getValueLabel(this.options,this.value);return(0,r.qy)(f||(f=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,n.J)(this.label),this._clearValue,this.label,t,this.required,this.disabled,!this.clearable||this.required||this.disabled||!String(this.value))}_renderHelper(){return this.helper?(0,r.qy)(b||(b=w`<ha-input-helper-text .disabled="${0}">${0}</ha-input-helper-text>`),this.disabled,this.helper):r.s6}_handleSelect(t){t.stopPropagation();const e=t.detail.item.value;e!==this.value&&(0,l.r)(this,"selected",{value:e})}_clearValue(){!this.disabled&&this.value&&(0,l.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(...t){super(...t),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,s.A)((t,e)=>{const i=void 0!==e?String(e):void 0;if(!t||!i)return i;for(const o of t){const t=["string","number"].includes(typeof o);if(t&&o===i||!t&&String(o.value)===i)return t?o:o.label||o.value}return i})}}$.styles=(0,r.AH)(_||(_=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,o.Cg)([(0,a.MZ)({type:Boolean})],$.prototype,"clearable",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],$.prototype,"options",void 0),(0,o.Cg)([(0,a.MZ)()],$.prototype,"label",void 0),(0,o.Cg)([(0,a.MZ)()],$.prototype,"helper",void 0),(0,o.Cg)([(0,a.MZ)()],$.prototype,"value",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],$.prototype,"required",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],$.prototype,"disabled",void 0),(0,o.Cg)([(0,a.wk)()],$.prototype,"_opened",void 0),(0,o.Cg)([(0,a.P)("ha-picker-field")],$.prototype,"_triggerField",void 0),$=(0,o.Cg)([(0,a.EM)("ha-select")],$),e()}catch(h){e(h)}})},85938:function(t,e,i){i(18111),i(22489),i(3362),i(46058),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(1087);let s,l=t=>t;class d extends r.WF{updated(t){t.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}disconnectedCallback(){super.disconnectedCallback(),this._shouldBeDestroy=!0,setTimeout(()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)},1)}connectedCallback(){super.connectedCallback(),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}createRenderRoot(){return this}render(){return this.noStyle?r.s6:(0,r.qy)(s||(s=l` <style>.sortable-fallback{display:none!important}.sortable-ghost{box-shadow:0 0 0 2px var(--primary-color);background:rgba(var(--rgb-primary-color),.25);border-radius:var(--ha-border-radius-sm);opacity:.4}.sortable-drag{border-radius:var(--ha-border-radius-sm);opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `))}async _createSortable(){if(this._sortable)return;const t=this.children[0];if(!t)return;const e=(await Promise.all([i.e(85283),i.e(70322)]).then(i.bind(i,80745))).default,o=Object.assign(Object.assign({scroll:!0,forceAutoScrollFallback:!0,scrollSpeed:20,animation:150},this.options),{},{onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd,onUpdate:this._handleUpdate,onAdd:this._handleAdd,onRemove:this._handleRemove});this.draggableSelector&&(o.draggable=this.draggableSelector),this.handleSelector&&(o.handle=this.handleSelector),void 0!==this.invertSwap&&(o.invertSwap=this.invertSwap),this.group&&(o.group=this.group),this.filter&&(o.filter=this.filter),this._sortable=new e(t,o)}_destroySortable(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}constructor(...t){super(...t),this.disabled=!1,this.noStyle=!1,this.invertSwap=!1,this.rollback=!0,this._shouldBeDestroy=!1,this._handleUpdate=t=>{(0,n.r)(this,"item-moved",{newIndex:t.newIndex,oldIndex:t.oldIndex})},this._handleAdd=t=>{(0,n.r)(this,"item-added",{index:t.newIndex,data:t.item.sortableData,item:t.item})},this._handleRemove=t=>{(0,n.r)(this,"item-removed",{index:t.oldIndex})},this._handleEnd=async t=>{(0,n.r)(this,"drag-end"),this.rollback&&t.item.placeholder&&(t.item.placeholder.replaceWith(t.item),delete t.item.placeholder)},this._handleStart=()=>{(0,n.r)(this,"drag-start")},this._handleChoose=t=>{this.rollback&&(t.item.placeholder=document.createComment("sort-placeholder"),t.item.after(t.item.placeholder))}}}(0,o.Cg)([(0,a.MZ)({type:Boolean})],d.prototype,"disabled",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"no-style"})],d.prototype,"noStyle",void 0),(0,o.Cg)([(0,a.MZ)({type:String,attribute:"draggable-selector"})],d.prototype,"draggableSelector",void 0),(0,o.Cg)([(0,a.MZ)({type:String,attribute:"handle-selector"})],d.prototype,"handleSelector",void 0),(0,o.Cg)([(0,a.MZ)({type:String,attribute:"filter"})],d.prototype,"filter",void 0),(0,o.Cg)([(0,a.MZ)({type:String})],d.prototype,"group",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"invert-swap"})],d.prototype,"invertSwap",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"options",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],d.prototype,"rollback",void 0),d=(0,o.Cg)([(0,a.EM)("ha-sortable")],d)},10763:function(t,e,i){i.a(t,async function(t,e){try{i(3362),i(62953);var o=i(40445),r=i(53289),a=i(5124),n=i(67576),s=i(35211),l=i(1087),d=i(63130),c=i(14503),u=i(81619),h=i(18350),p=i(15717),g=i(22792),y=t([h,p]);[h,p]=y.then?(await y)():y;let v,m,f,b,_,w=t=>t;const $=t=>{if("object"!=typeof t||null===t)return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0};class x extends a.WF{setValue(t){try{this._yaml=$(t)?"":(0,r.dump)(t,{schema:this.yamlSchema,quotingType:'"',noRefs:!0})}catch(e){console.error(e,t),alert(`There was an error converting to YAML: ${e}`)}}firstUpdated(){void 0!==this.defaultValue&&this.setValue(this.defaultValue)}willUpdate(t){super.willUpdate(t),this.autoUpdate&&t.has("value")&&this.setValue(this.value)}focus(){var t,e;null!==(t=this._codeEditor)&&void 0!==t&&t.codemirror&&(null===(e=this._codeEditor)||void 0===e||e.codemirror.focus())}disableCodeEditorFullscreen(){this.disableFullscreen=!0,this._codeEditor&&(this._codeEditor.disableFullscreen=!0)}render(){return void 0===this._yaml?a.s6:(0,a.qy)(v||(v=w` ${0} <ha-code-editor .value="${0}" .readOnly="${0}" .disableFullscreen="${0}" .inDialog="${0}" mode="yaml" lint autocomplete-entities autocomplete-icons .error="${0}" @value-changed="${0}" @editor-save="${0}" dir="ltr"></ha-code-editor> ${0} `),this.label?(0,a.qy)(m||(m=w`<p>${0}${0}</p>`),this.label,this.required?" *":""):a.s6,this._yaml,this.readOnly,this.disableFullscreen,this.inDialog,!1===this.isValid,this._onChange,this._onEditorSave,this.copyClipboard||this.hasExtraActions?(0,a.qy)(f||(f=w` <div class="card-actions"> ${0} <slot name="extra-actions"></slot> </div> `),this.copyClipboard?(0,a.qy)(b||(b=w` <ha-button appearance="plain" @click="${0}"> ${0} </ha-button> `),this._copyYaml,this._i18n.localize("ui.components.yaml-editor.copy_to_clipboard")):a.s6):a.s6)}_onChange(t){var e;let i;t.stopPropagation(),this._yaml=t.detail.value;let o,a=!0,n=null;if(this._yaml)try{i=(0,r.Hh)(this._yaml,{schema:this.yamlSchema})}catch(s){a=!1,n=s,o=`${this._i18n.localize("ui.components.yaml-editor.error",{reason:s.reason})}${s.mark?` (${this._i18n.localize("ui.components.yaml-editor.error_location",{line:s.mark.line+1,column:s.mark.column+1})})`:""}`}else i={};null===(e=this._codeEditor)||void 0===e||e.setYamlError(n),this.value=i,this.isValid=a,(0,l.r)(this,"value-changed",{value:i,isValid:a,errorMsg:o})}get yaml(){return this._yaml}get codemirror(){var t;return null===(t=this._codeEditor)||void 0===t?void 0:t.codemirror}get hasComments(){var t,e;return null!==(t=null===(e=this._codeEditor)||void 0===e?void 0:e.hasComments)&&void 0!==t&&t}_onEditorSave(t){(0,l.r)(this,"editor-save"),t.stopPropagation()}async _copyYaml(){this.yaml&&(await(0,d.l)(this.yaml),(0,u.P)(this,{message:this._i18n.localize("ui.common.copied_clipboard")}))}static get styles(){return[c.RF,(0,a.AH)(_||(_=w`.card-actions{border-radius:var(--actions-border-radius,var(--ha-border-radius-square) var(--ha-border-radius-square) var(--ha-card-border-radius,var(--ha-border-radius-lg)) var(--ha-card-border-radius,var(--ha-border-radius-lg)));border:1px solid var(--divider-color);padding:5px 16px}ha-code-editor{flex-grow:1;min-height:0}`))]}constructor(...t){super(...t),this.yamlSchema=r.my,this.isValid=!0,this.autoUpdate=!1,this.readOnly=!1,this.disableFullscreen=!1,this.inDialog=!1,this.required=!1,this.copyClipboard=!1,this.hasExtraActions=!1,this._yaml=""}}(0,o.Cg)([(0,n.MZ)()],x.prototype,"value",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],x.prototype,"yamlSchema",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],x.prototype,"defaultValue",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"is-valid",type:Boolean})],x.prototype,"isValid",void 0),(0,o.Cg)([(0,n.MZ)()],x.prototype,"label",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"auto-update",type:Boolean})],x.prototype,"autoUpdate",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"read-only",type:Boolean})],x.prototype,"readOnly",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"disable-fullscreen"})],x.prototype,"disableFullscreen",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"in-dialog"})],x.prototype,"inDialog",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],x.prototype,"required",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"copy-clipboard",type:Boolean})],x.prototype,"copyClipboard",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"has-extra-actions",type:Boolean})],x.prototype,"hasExtraActions",void 0),(0,o.Cg)([(0,n.wk)()],x.prototype,"_yaml",void 0),(0,o.Cg)([(0,n.wk)(),(0,s.Fg)({context:g.D5,subscribe:!0})],x.prototype,"_i18n",void 0),(0,o.Cg)([(0,n.P)("ha-code-editor")],x.prototype,"_codeEditor",void 0),x=(0,o.Cg)([(0,n.EM)("ha-yaml-editor")],x),e()}catch(v){e(v)}})},79800:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{g:function(){return x},p:function(){return z}});i(16280),i(18107),i(74423),i(44114),i(18111),i(20116),i(61701),i(33110),i(27495),i(67357),i(62953);var r=i(31886),a=i(44537),n=i(82591),s=i(30162),l=i(27167),d=i(53610),c=i(28978),u=i(78649),h=i(8185),p=i(24790),g=i(87225),y=i(10139),v=i(3496),m=t([r,s,n,d,h]);[r,s,n,d,h]=m.then?(await m)():m;const f="ui.panel.config.automation.editor.triggers.type",b="ui.panel.config.automation.editor.conditions.type",_=(t,e)=>{let i;return i="number"==typeof e?(0,l.A)(e):"string"==typeof e?e:(0,n.nR)(t,e),i},w=(t,e,i)=>{const o=t.split(":");if(o.length<2||o.length>3)return t;try{const t=Number(o[0]),a=Number(o[1]),n=o.length>2?Number(o[2]):0,l=new Date,d=new r.BB(l.getFullYear(),l.getMonth(),l.getDate(),t,a,n,i.time_zone);return 2===o.length||0===n?(0,s.fU)(d,e,i):(0,s.ie)(d,e,i)}catch(a){return t}},$=(t,e)=>"string"==typeof e&&(0,u.n)(e)&&t.states[e]&&(0,c.u)(t.states[e])||e,x=(t,e,i,o=!1)=>{try{const r=C(t,e,i,o);if("string"!=typeof r)throw new Error(String(r));return r}catch(r){console.error(r);let t="Error in describing trigger";return r.message&&(t+=": "+r.message),t}},C=(t,e,i,o=!1)=>{if((0,v.H4)(t)){const i=(0,a.e)(t.triggers);if(!i||0===i.length)return e.localize(`${f}.list.description.no_trigger`);const o=i.length;return e.localize(`${f}.list.description.full`,{count:o})}if(t.alias&&!o)return t.alias;const r=k(t,e,i);if(r)return r;const n=t.trigger,s=(0,v.zz)(t.trigger),l=(0,v.hN)(t.trigger);return e.localize(`component.${s}.triggers.${l}.name`)||e.localize(`ui.panel.config.automation.editor.triggers.type.${n}.label`)||e.localize("ui.panel.config.automation.editor.triggers.unknown_trigger")},k=(t,e,i)=>{if("event"===t.trigger&&t.event_type){const i=[];if(Array.isArray(t.event_type))for(const e of t.event_type.values())i.push(e);else i.push(t.event_type);const o=(0,h.q)(e.locale,i);return e.localize(`${f}.event.description.full`,{eventTypes:o})}if("homeassistant"===t.trigger&&t.event)return e.localize("start"===t.event?`${f}.homeassistant.description.started`:`${f}.homeassistant.description.shutdown`);if("numeric_state"===t.trigger&&t.entity_id){const i=[],o=e.states,r=Array.isArray(t.entity_id)?e.states[t.entity_id[0]]:e.states[t.entity_id];if(Array.isArray(t.entity_id))for(const e of t.entity_id.values())o[e]&&i.push((0,c.u)(o[e])||e);else t.entity_id&&i.push(o[t.entity_id]?(0,c.u)(o[t.entity_id]):t.entity_id);const a=t.attribute?r?(0,d.computeAttributeNameDisplay)(e.localize,r,e.entities,t.attribute):t.attribute:void 0,n=t.for?_(e.locale,t.for):void 0;if(void 0!==t.above&&void 0!==t.below)return e.localize(`${f}.numeric_state.description.above-below`,{attribute:a,entity:(0,h.q)(e.locale,i),numberOfEntities:i.length,above:$(e,t.above),below:$(e,t.below),duration:n});if(void 0!==t.above)return e.localize(`${f}.numeric_state.description.above`,{attribute:a,entity:(0,h.q)(e.locale,i),numberOfEntities:i.length,above:$(e,t.above),duration:n});if(void 0!==t.below)return e.localize(`${f}.numeric_state.description.below`,{attribute:a,entity:(0,h.q)(e.locale,i),numberOfEntities:i.length,below:$(e,t.below),duration:n})}if("state"===t.trigger){const i=[],r=e.states;let n="";if(t.attribute){const i=Array.isArray(t.entity_id)?e.states[t.entity_id[0]]:e.states[t.entity_id];n=i?(0,d.computeAttributeNameDisplay)(e.localize,i,e.entities,t.attribute):t.attribute}const s=(0,a.e)(t.entity_id);if(s)for(const t of s)r[t]&&i.push((0,c.u)(r[t])||t);const l=e.states[s[0]];let u="other",p="";if(void 0!==t.from)if(null===t.from)t.attribute||(u="null");else{const i=(0,a.e)(t.from),o=[];for(const r of i)o.push(l?t.attribute?e.formatEntityAttributeValue(l,t.attribute,r).toString():e.formatEntityState(l,r):r);0!==o.length&&(p=(0,h.q)(e.locale,o),u="fromUsed")}let g="other",y="";if(void 0!==t.to)if(null===t.to)t.attribute||(g="null");else{const i=(0,a.e)(t.to),o=[];for(const r of i)o.push(l?t.attribute?e.formatEntityAttributeValue(l,t.attribute,r).toString():e.formatEntityState(l,r).toString():r);0!==o.length&&(y=(0,h.q)(e.locale,o),g="toUsed")}t.attribute||void 0!==t.from||void 0!==t.to||(g="special");let v="";var o;if(t.for)v=null!==(o=_(e.locale,t.for))&&void 0!==o?o:"";return e.localize(`${f}.state.description.full`,{hasAttribute:""!==n?"true":"false",attribute:n,hasEntity:0!==i.length?"true":"false",entity:(0,h.q)(e.locale,i),fromChoice:u,fromString:p,toChoice:g,toString:y,hasDuration:""!==v?"true":"false",duration:v})}if("sun"===t.trigger&&t.event){let i="";return t.offset&&(i="number"==typeof t.offset?(0,l.A)(t.offset):"string"==typeof t.offset?t.offset:JSON.stringify(t.offset)),e.localize("sunset"===t.event?`${f}.sun.description.sets`:`${f}.sun.description.rises`,{hasDuration:""!==i?"true":"false",duration:i})}if("tag"===t.trigger){const i=Object.values(e.states).find(e=>e.entity_id.startsWith("tag.")&&e.attributes.tag_id===t.tag_id);return i?e.localize(`${f}.tag.description.known_tag`,{tag_name:(0,c.u)(i)}):e.localize(`${f}.tag.description.full`)}if("time"===t.trigger&&t.at){const i=(0,a.e)(t.at).map(t=>{if("string"==typeof t)return(0,u.n)(t)?`entity ${e.states[t]?(0,c.u)(e.states[t]):t}`:w(t,e.locale,e.config);return`${`entity ${e.states[t.entity_id]?(0,c.u)(e.states[t.entity_id]):t.entity_id}`}${t.offset?" "+e.localize(`${f}.time.offset_by`,{offset:_(e.locale,t.offset)}):""}`});let o=[];if(t.weekday){const i=(0,a.e)(t.weekday);i.length>0&&(o=i.map(t=>e.localize(`ui.panel.config.automation.editor.triggers.type.time.weekdays.${t}`)))}return e.localize(`${f}.time.description.full`,{time:(0,h.q)(e.locale,i),hasWeekdays:o.length>0?"true":"false",weekdays:(0,h.q)(e.locale,o)})}if("time_pattern"===t.trigger){if(!t.seconds&&!t.minutes&&!t.hours)return e.localize(`${f}.time_pattern.description.initial`);const i=[];let o,r="other",a="other",n=0,s=0,l=0;if(void 0!==t.seconds){const e="*"===t.seconds,o="string"==typeof t.seconds&&t.seconds.startsWith("/");n=e?0:"number"==typeof t.seconds?t.seconds:o?parseInt(t.seconds.substring(1)):parseInt(t.seconds),(isNaN(n)||n>59||n<0||o&&0===n)&&i.push("seconds"),r=e||o&&1===n?"every":o?"every_interval":"on_the_xth"}if(void 0!==t.minutes){const e="*"===t.minutes,o="string"==typeof t.minutes&&t.minutes.startsWith("/");s=e?0:"number"==typeof t.minutes?t.minutes:o?parseInt(t.minutes.substring(1)):parseInt(t.minutes),(isNaN(s)||s>59||s<0||o&&0===s)&&i.push("minutes"),a=e||o&&1===s?"every":o?"every_interval":void 0!==t.seconds?"has_seconds":"on_the_xth"}else void 0!==t.seconds&&(void 0!==t.hours?(s=0,a="has_seconds"):a="every");if(void 0!==t.hours){const e="*"===t.hours,r="string"==typeof t.hours&&t.hours.startsWith("/");l=e?0:"number"==typeof t.hours?t.hours:r?parseInt(t.hours.substring(1)):parseInt(t.hours),(isNaN(l)||l>23||l<0||r&&0===l)&&i.push("hours"),o=e||r&&1===l?"every":r?"every_interval":void 0!==t.seconds||void 0!==t.minutes?"has_seconds_or_minutes":"on_the_xth"}else o="every";return 0!==i.length?e.localize(`${f}.time_pattern.description.invalid`,{parts:(0,h.c)(e.locale,i.map(t=>e.localize(`${f}.time_pattern.${t}`)))}):e.localize(`${f}.time_pattern.description.full`,{secondsChoice:r,minutesChoice:a,hoursChoice:o,seconds:n,minutes:s,hours:l,secondsWithOrdinal:e.localize(`${f}.time_pattern.description.ordinal`,{part:n}),minutesWithOrdinal:e.localize(`${f}.time_pattern.description.ordinal`,{part:s}),hoursWithOrdinal:e.localize(`${f}.time_pattern.description.ordinal`,{part:l})})}if("zone"===t.trigger&&t.entity_id&&t.zone){const i=[],o=[],r=e.states;if(Array.isArray(t.entity_id))for(const e of t.entity_id.values())r[e]&&i.push((0,c.u)(r[e])||e);else i.push(r[t.entity_id]?(0,c.u)(r[t.entity_id]):t.entity_id);if(Array.isArray(t.zone))for(const e of t.zone.values())r[e]&&o.push((0,c.u)(r[e])||e);else o.push(r[t.zone]?(0,c.u)(r[t.zone]):t.zone);return e.localize(`${f}.zone.description.full`,{entity:(0,h.q)(e.locale,i),event:t.event.toString(),zone:(0,h.q)(e.locale,o),numberOfZones:o.length})}if("geo_location"===t.trigger&&t.source&&t.zone){const i=[],o=[],r=e.states;if(Array.isArray(t.source))for(const e of t.source.values())i.push(e);else i.push(t.source);if(Array.isArray(t.zone))for(const e of t.zone.values())r[e]&&o.push((0,c.u)(r[e])||e);else o.push(r[t.zone]?(0,c.u)(r[t.zone]):t.zone);return e.localize(`${f}.geo_location.description.full`,{source:(0,h.q)(e.locale,i),event:t.event.toString(),zone:(0,h.q)(e.locale,o),numberOfZones:o.length})}if("mqtt"===t.trigger)return e.localize(`${f}.mqtt.description.full`);if("template"===t.trigger){let i="";var r;if(t.for)i=null!==(r=_(e.locale,t.for))&&void 0!==r?r:"";return e.localize(`${f}.template.description.full`,{hasDuration:""!==i?"true":"false",duration:i})}if("webhook"===t.trigger)return e.localize(`${f}.webhook.description.full`);if("conversation"===t.trigger){if(!t.command||!t.command.length)return e.localize(`${f}.conversation.description.empty`);const i=(0,a.e)(t.command);return 1===i.length?e.localize(`${f}.conversation.description.single`,{sentence:i[0]}):e.localize(`${f}.conversation.description.multiple`,{sentence:i[0],count:i.length-1})}if("persistent_notification"===t.trigger)return e.localize(`${f}.persistent_notification.description.full`);if("device"===t.trigger&&t.device_id){const o=t,r=(0,y.nx)(e.localize,e.states,i,o);if(r)return r;const a=e.states[o.entity_id];return`${a?(0,c.u)(a):o.entity_id} ${o.type}`}if("calendar"===t.trigger){const i=e.states[t.entity_id]?(0,c.u)(e.states[t.entity_id]):t.entity_id;let o="other",r="";if(t.offset){o=t.offset.startsWith("-")?"before":"after";const i=t.offset.startsWith("-")?t.offset.substring(1).split(":"):t.offset.split(":"),a={hours:i.length>0?+i[0]:0,minutes:i.length>1?+i[1]:0,seconds:i.length>2?+i[2]:0};r=(0,n.i)(e.locale,a),""===r&&(o="other")}return e.localize(`${f}.calendar.description.full`,{eventChoice:t.event,offsetChoice:o,offset:r,hasCalendar:t.entity_id?"true":"false",calendar:i})}},M=(t,e)=>{if(!e)return"";if("number"==typeof e)return(0,l.A)(e);if("string"==typeof e)return e;try{const i=(0,n.E2)(t.locale,e);return i.startsWith("-")?i:`+${i}`}catch(i){return JSON.stringify(e)}},z=(t,e,i,o=!1)=>{try{const r=A(t,e,i,o);if("string"!=typeof r)throw new Error(String(r));return r}catch(r){console.error(r);let t="Error in describing condition";return r.message&&(t+=": "+r.message),t}},A=(t,e,i,o=!1)=>{if("string"==typeof t&&(0,p.r)(t))return e.localize(`${b}.template.description.full`);if(t.alias&&!o)return t.alias;if(!t.condition){const e=["and","or","not"];for(const i of e)i in t&&(0,a.e)(t[i])&&(t={condition:i,conditions:t[i]})}const r=q(t,e,i);if(r)return r;const n=t.condition,s=(0,g.ob)(t.condition),l=(0,g.YQ)(t.condition);return e.localize(`component.${s}.conditions.${l}.name`)||e.localize(`ui.panel.config.automation.editor.conditions.type.${n}.label`)||e.localize("ui.panel.config.automation.editor.conditions.unknown_condition")},q=(t,e,i)=>{if("or"===t.condition){const i=(0,a.e)(t.conditions);if(!i||0===i.length)return e.localize(`${b}.or.description.no_conditions`);const o=i.length;return e.localize(`${b}.or.description.full`,{count:o})}if("and"===t.condition){const i=(0,a.e)(t.conditions);if(!i||0===i.length)return e.localize(`${b}.and.description.no_conditions`);const o=i.length;return e.localize(`${b}.and.description.full`,{count:o})}if("not"===t.condition){const i=(0,a.e)(t.conditions);return i&&0!==i.length?1===i.length?e.localize(`${b}.not.description.one_condition`):e.localize(`${b}.not.description.full`,{count:i.length}):e.localize(`${b}.not.description.no_conditions`)}if("state"===t.condition){if(!t.entity_id)return e.localize(`${b}.state.description.no_entity`);let i="";if(t.attribute){const o=Array.isArray(t.entity_id)?e.states[t.entity_id[0]]:e.states[t.entity_id];i=o?(0,d.computeAttributeNameDisplay)(e.localize,o,e.entities,t.attribute):t.attribute}const o=[];if(Array.isArray(t.entity_id))for(const s of t.entity_id.values())e.states[s]&&o.push((0,c.u)(e.states[s])||s);else t.entity_id&&o.push(e.states[t.entity_id]?(0,c.u)(e.states[t.entity_id]):t.entity_id);const r=[],a=e.states[Array.isArray(t.entity_id)?t.entity_id[0]:t.entity_id];if(Array.isArray(t.state))for(const s of t.state.values())r.push(a?t.attribute?e.formatEntityAttributeValue(a,t.attribute,s).toString():e.formatEntityState(a,s):s);else""!==t.state&&r.push(a?t.attribute?e.formatEntityAttributeValue(a,t.attribute,t.state).toString():e.formatEntityState(a,t.state.toString()):t.state.toString());let n="";return t.for&&(n=_(e.locale,t.for)||""),e.localize(`${b}.state.description.full`,{hasAttribute:""!==i?"true":"false",attribute:i,numberOfEntities:o.length,entities:"any"===t.match?(0,h.q)(e.locale,o):(0,h.c)(e.locale,o),numberOfStates:r.length,states:(0,h.q)(e.locale,r),hasDuration:""!==n?"true":"false",duration:n})}if("numeric_state"===t.condition&&t.entity_id){const i=(0,a.e)(t.entity_id),o=e.states[i[0]],r=(0,h.c)(e.locale,i.map(t=>e.states[t]?(0,c.u)(e.states[t]):t||"")),n=t.attribute?o?(0,d.computeAttributeNameDisplay)(e.localize,o,e.entities,t.attribute):t.attribute:void 0;if(void 0!==t.above&&void 0!==t.below)return e.localize(`${b}.numeric_state.description.above-below`,{attribute:n,entity:r,numberOfEntities:i.length,above:$(e,t.above),below:$(e,t.below)});if(void 0!==t.above)return e.localize(`${b}.numeric_state.description.above`,{attribute:n,entity:r,numberOfEntities:i.length,above:$(e,t.above)});if(void 0!==t.below)return e.localize(`${b}.numeric_state.description.below`,{attribute:n,entity:r,numberOfEntities:i.length,below:$(e,t.below)})}if("time"===t.condition){const i=(0,a.e)(t.weekday),o=i&&i.length>0&&i.length<7;if(t.before||t.after||o){const r="string"!=typeof t.before?t.before:t.before.includes(".")?`entity ${e.states[t.before]?(0,c.u)(e.states[t.before]):t.before}`:w(t.before,e.locale,e.config),a="string"!=typeof t.after?t.after:t.after.includes(".")?`entity ${e.states[t.after]?(0,c.u)(e.states[t.after]):t.after}`:w(t.after,e.locale,e.config);let n=[];o&&(n=i.map(t=>e.localize(`ui.panel.config.automation.editor.conditions.type.time.weekdays.${t}`)));let s="";return void 0!==a&&void 0!==r?s="string"==typeof t.after&&!t.after.includes(".")&&"string"==typeof t.before&&!t.before.includes(".")&&t.after>t.before?"after_before_or":"after_before":void 0!==a?s="after":void 0!==r&&(s="before"),e.localize(`${b}.time.description.full`,{hasTime:s,hasTimeAndDay:(a||r)&&o?"true":"false",hasDay:o?"true":"false",time_before:r,time_after:a,day:(0,h.q)(e.locale,n)})}}if("sun"===t.condition&&(t.before||t.after)){var o,r;const i=t.after?M(e,t.after_offset):"",a=t.before?M(e,t.before_offset):"";return e.localize(`${b}.sun.description.${t.before&&t.after?"between":t.before?"before":"after"}`,{afterChoice:null!==(o=t.after)&&void 0!==o?o:"other",afterOffsetChoice:""!==i?"offset":"other",afterOffset:i,beforeChoice:null!==(r=t.before)&&void 0!==r?r:"other",beforeOffsetChoice:""!==a?"offset":"other",beforeOffset:a})}if("zone"===t.condition&&t.entity_id&&t.zone){const i=[],o=[],r=e.states;if(Array.isArray(t.entity_id))for(const e of t.entity_id.values())r[e]&&i.push((0,c.u)(r[e])||e);else i.push(r[t.entity_id]?(0,c.u)(r[t.entity_id]):t.entity_id);if(Array.isArray(t.zone))for(const e of t.zone.values())r[e]&&o.push((0,c.u)(r[e])||e);else o.push(r[t.zone]?(0,c.u)(r[t.zone]):t.zone);const a=(0,h.q)(e.locale,i),n=(0,h.q)(e.locale,o);return e.localize(`${b}.zone.description.full`,{entity:a,numberOfEntities:i.length,zone:n,numberOfZones:o.length})}if("device"===t.condition&&t.device_id){const o=t,r=(0,y.I3)(e.localize,e.states,i,o);if(r)return r;const a=e.states[o.entity_id];return`${a?(0,c.u)(a):o.entity_id} ${o.type}`}return"template"===t.condition?e.localize(`${b}.template.description.full`):"trigger"===t.condition&&null!=t.id?e.localize(`${b}.trigger.description.full`,{id:(0,h.q)(e.locale,(0,a.e)(t.id).map(t=>t.toString()))}):void 0};o()}catch(f){o(f)}})},10897:function(t,e,i){i.d(e,{C4:function(){return d},CK:function(){return l},FX:function(){return y},UC:function(){return p},_Z:function(){return b},bT:function(){return _},j4:function(){return m},sd:function(){return a},su:function(){return s},vc:function(){return f},w8:function(){return h},wv:function(){return u},y3:function(){return g},zS:function(){return n}});i(3362);var o=i(3931),r=i(82e3);const a=[1,2,3,4,6,8],n="web_rtc",s=(t,e,i)=>`${t}&width=${e}&height=${i}`,l=t=>t.attributes.access_token?`/api/camera_proxy_stream/${t.entity_id}?token=${t.attributes.access_token}`:void 0,d=async(t,e,i,r)=>{const a=await(0,o.U)("_cameraTmbUrl",9e3,c,t,e);return s(a,i,r)},c=async(t,e)=>{const i=await(0,r.e0)(t,`/api/camera_proxy/${e}`);return t.hassUrl(i.path)},u=async(t,e,i)=>{const o={type:"camera/stream",entity_id:e};i&&(o.format=i);const r=await t.callWS(o);return r.url=t.hassUrl(r.url),r},h=(t,e,i,o)=>t.connection.subscribeMessage(o,{type:"camera/webrtc/offer",entity_id:e,offer:i}),p=(t,e,i,o)=>t.callWS({type:"camera/webrtc/candidate",entity_id:e,session_id:i,candidate:o}),g=(t,e)=>t.callWS({type:"camera/get_prefs",entity_id:e}),y=(t,e,i)=>t.callWS(Object.assign({type:"camera/update_prefs",entity_id:e},i)),v="media-source://camera/",m=t=>t.startsWith(v),f=t=>t.substring(22),b=async(t,e)=>t.callWS({type:"camera/capabilities",entity_id:e}),_=async(t,e)=>t.callWS({type:"camera/webrtc/get_client_config",entity_id:e})},12596:function(t,e,i){i.d(e,{$:function(){return o}});const o=(t,e)=>t.callWS(Object.assign({type:"validate_config"},e))},10139:function(t,e,i){i.d(e,{I$:function(){return c},I3:function(){return m},PV:function(){return v},Po:function(){return p},RK:function(){return w},TB:function(){return u},TH:function(){return _},T_:function(){return b},am:function(){return n},jR:function(){return d},ng:function(){return s},nx:function(){return f},o9:function(){return l}});i(74423);var o=i(28978),r=i(88249),a=i(59241);const n=(t,e)=>t({type:"device_automation/action/list",device_id:e}),s=(t,e)=>t({type:"device_automation/condition/list",device_id:e}),l=(t,e)=>t({type:"device_automation/trigger/list",device_id:e}).then(t=>(0,r.vO)(t)),d=(t,e)=>t({type:"device_automation/action/capabilities",action:e}),c=(t,e)=>t({type:"device_automation/condition/capabilities",condition:e}),u=(t,e)=>t({type:"device_automation/trigger/capabilities",trigger:e}),h=["device_id","domain","entity_id","type","subtype","event","condition","trigger"],p=(t,e,i)=>{if(typeof e!=typeof i)return!1;for(const s in e){var o,r;if(h.includes(s))if("entity_id"!==s||(null===(o=e[s])||void 0===o?void 0:o.includes("."))===(null===(r=i[s])||void 0===r?void 0:r.includes("."))){if(!Object.is(e[s],i[s]))return!1}else if(!g(t,e[s],i[s]))return!1}for(const s in i){var a,n;if(h.includes(s))if("entity_id"!==s||(null===(a=e[s])||void 0===a?void 0:a.includes("."))===(null===(n=i[s])||void 0===n?void 0:n.includes("."))){if(!Object.is(e[s],i[s]))return!1}else if(!g(t,e[s],i[s]))return!1}return!0},g=(t,e,i)=>{if(!e||!i)return!1;if(e.includes(".")){const i=(0,a.Ox)(t)[e];if(!i)return!1;e=i.id}if(i.includes(".")){const e=(0,a.Ox)(t)[i];if(!e)return!1;i=e.id}return e===i},y=(t,e,i,r)=>{if(!r)return`<${t("ui.panel.config.automation.editor.unknown_entity")}>`;if(r.includes(".")){const t=e[r];return t?(0,o.u)(t):r}const n=(0,a.P9)(i)[r];if(n){var s;if(n.name)return n.name;const t=e[n.entity_id];return t?(0,o.u)(t):null!==(s=n.original_name)&&void 0!==s?s:r}return`<${t("ui.panel.config.automation.editor.unknown_entity")}>`},v=(t,e,i,o)=>t(`component.${o.domain}.device_automation.action_type.${o.type}`,{entity_name:y(t,e,i,o.entity_id),subtype:o.subtype?t(`component.${o.domain}.device_automation.action_subtype.${o.subtype}`)||o.subtype:""})||(o.subtype?`"${o.subtype}" ${o.type}`:o.type),m=(t,e,i,o)=>t(`component.${o.domain}.device_automation.condition_type.${o.type}`,{entity_name:y(t,e,i,o.entity_id),subtype:o.subtype?t(`component.${o.domain}.device_automation.condition_subtype.${o.subtype}`)||o.subtype:""})||(o.subtype?`"${o.subtype}" ${o.type}`:o.type),f=(t,e,i,o)=>t(`component.${o.domain}.device_automation.trigger_type.${o.type}`,{entity_name:y(t,e,i,o.entity_id),subtype:o.subtype?t(`component.${o.domain}.device_automation.trigger_subtype.${o.subtype}`)||o.subtype:""})||(o.subtype?`"${o.subtype}" ${o.type}`:o.type),b=(t,e)=>i=>t(`component.${e.domain}.device_automation.extra_fields.${i.name}`)||i.name,_=(t,e)=>i=>t(`component.${e.domain}.device_automation.extra_fields_descriptions.${i.name}`),w=(t,e)=>{var i,o,r,a;return null===(i=t.metadata)||void 0===i||!i.secondary||null!==(o=e.metadata)&&void 0!==o&&o.secondary?null!==(r=t.metadata)&&void 0!==r&&r.secondary||null===(a=e.metadata)||void 0===a||!a.secondary?0:-1:1}},93758:function(t,e,i){i.d(e,{CO:function(){return c},NS:function(){return d},f$:function(){return a},ok:function(){return n}});i(3362);if(66649!=i.j)var o=i(90889);var r=i(9899);const a=async t=>(await t.callWS({type:"labs/list"})).features,n=(t,e,i,o,r)=>t.callWS(Object.assign({type:"labs/update",domain:e,preview_feature:i,enabled:o},void 0!==r&&{create_backup:r})),s=t=>t.sendMessagePromise({type:"labs/list"}).then(t=>t.features),l=(t,e)=>t.subscribeEvents((0,r.s)(()=>s(t).then(t=>e.setState(t,!0)),500,!0),"labs_updated"),d=(t,e)=>(0,o.N)("_labFeatures",s,l,t,e),c=(t,e,i,o)=>t.subscribeMessage(o,{type:"labs/subscribe",domain:e,preview_feature:i})},42269:function(t,e,i){i.d(e,{p:function(){return r}});var o=i(1087);const r=(t,e)=>(0,o.r)(t,"hass-more-info",e)},49053:function(t,e,i){i.d(e,{c:function(){return n}});var o=i(62371),r=i(81619);const a=60;function n(t,e){const i=function(t){if("ha-automation-editor"===t.localName||"ha-script-editor"===t.localName)return Boolean(t.dirty);const e=(0,o.T)(t,"dirty",!1);return Boolean(null==e?void 0:e.dirty)}(t)?a:void 0;(0,r.P)(t,Object.assign(Object.assign(Object.assign({},e),void 0!==i?{bottomOffset:i}:{}),{},{dismissable:!0}))}},15702:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701),i(62953);var o=i(40445),r=i(5124),a=i(67576),n=i(38962),s=t([n]);n=(s.then?(await s)():s)[0];let l,d,c,u=t=>t;class h extends r.WF{render(){return(0,r.qy)(l||(l=u` <ha-alert alert-type="warning" .title="${0}"> ${0} ${0} </ha-alert> `),this.alertTitle||this.localize("ui.errors.config.editor_not_supported"),this.warnings.length&&void 0!==this.warnings[0]?(0,r.qy)(d||(d=u`<ul> ${0} </ul>`),this.warnings.map(t=>(0,r.qy)(c||(c=u`<li>${0}</li>`),t))):r.s6,this.localize("ui.errors.config.edit_in_yaml_supported"))}constructor(...t){super(...t),this.warnings=[]}}(0,o.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"localize",void 0),(0,o.Cg)([(0,a.MZ)({attribute:"alert-title"})],h.prototype,"alertTitle",void 0),(0,o.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"warnings",void 0),h=(0,o.Cg)([(0,a.EM)("ha-automation-editor-warning")],h),e()}catch(l){e(l)}})},41175:function(t,e,i){i.d(e,{j:function(){return c}});i(16280),i(71658),i(18111),i(22489),i(3362),i(88454),i(29452),i(62953);var o=i(40445),r=i(34271),a=i(67576),n=i(44537),s=i(93905),l=i(1087),d=i(12587);const c=t=>{class e extends t{get items(){throw new Error("Not implemented")}set items(t){throw new Error("Not implemented")}getKey(t){return this._itemKeys.has(t)||this._itemKeys.set(t,Math.random().toString()),this._itemKeys.get(t)}moveUp(t){t.stopPropagation();const e=t.target.index;if(!t.target.first){const i=e-1;this.move(e,i),this.rowSortSelected===e&&(this.rowSortSelected=i),t.target.focus()}}moveDown(t){t.stopPropagation();const e=t.target.index;if(!t.target.last){const i=e+1;this.move(e,i),this.rowSortSelected===e&&(this.rowSortSelected=i),t.target.focus()}}move(t,e){const i=this.items.concat(),o=i.splice(t,1)[0];i.splice(e,0,o),this.items=i,(0,l.r)(this,"value-changed",{value:i})}itemMoved(t){t.stopPropagation();const{oldIndex:e,newIndex:i}=t.detail;this.move(e,i)}async itemAdded(t){t.stopPropagation();const{index:e,data:i}=t.detail,o=t.detail.item.selected;let r=[...this.items.slice(0,e),i,...this.items.slice(e)];this.items=r,o&&(this.focusItemIndexOnChange=1===r.length?0:e),await(0,d.E)(),this.items!==r&&(r=[...this.items.slice(0,e),i,...this.items.slice(e)],o&&(this.focusItemIndexOnChange=1===r.length?0:e)),(0,l.r)(this,"value-changed",{value:r})}async itemRemoved(t){t.stopPropagation();const{index:e}=t.detail,i=this.items[e];this.items=this.items.filter(t=>t!==i),await(0,d.E)();const o=this.items.filter(t=>t!==i);(0,l.r)(this,"value-changed",{value:o})}itemChanged(t){t.stopPropagation();const e=[...this.items],i=t.detail.value,o=t.target.index;if(null===i)e.splice(o,1);else{const t=this.getKey(e[o]);this._itemKeys.set(i,t),e[o]=i}this.items=e,(0,l.r)(this,"value-changed",{value:e})}duplicateItem(t){t.stopPropagation();const e=t.target.index;(0,l.r)(this,"value-changed",{value:this.items.toSpliced(e+1,0,(0,r.A)(this.items[e]))})}pasteItem(t){if(t.stopPropagation(),!t.detail.item)return;const e=t.target.index,i=(0,r.A)(t.detail.item);this.setHighlightedItems((0,n.e)(i)),(0,l.r)(this,"value-changed",{value:this.items.toSpliced(e+1,0,i)})}insertAfter(t){t.stopPropagation();const e=t.target.index,i=(0,n.e)(t.detail.value);this.setHighlightedItems(i),(0,l.r)(this,"value-changed",{value:this.items.toSpliced(e+1,0,...i)})}setHighlightedItems(t){throw new Error("Not implemented")}handleDragKeydown(t){"Enter"!==t.key&&" "!==t.key||(t.stopPropagation(),this.rowSortSelected=void 0===this.rowSortSelected?t.target.index:void 0)}stopSortSelection(){this.rowSortSelected=void 0}constructor(...t){super(...t),this.disabled=!1,this.narrow=!1,this.optionsInSidebar=!1,this.focusLastItemOnChange=!1,this._itemKeys=new WeakMap}}return(0,o.Cg)([(0,a.MZ)({attribute:!1})],e.prototype,"hass",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],e.prototype,"disabled",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean})],e.prototype,"narrow",void 0),(0,o.Cg)([(0,a.MZ)({type:Boolean,attribute:"sidebar"})],e.prototype,"optionsInSidebar",void 0),(0,o.Cg)([(0,a.wk)()],e.prototype,"rowSortSelected",void 0),(0,o.Cg)([(0,a.wk)(),(0,s.I)({key:"automationClipboard",state:!0,subscribe:!0,storage:"sessionStorage"})],e.prototype,"_clipboard",void 0),e}},82405:function(t,e,i){i.d(e,{II:function(){return d},Ku:function(){return a},gZ:function(){return u},jJ:function(){return n},uV:function(){return r},ve:function(){return l},yz:function(){return s}});i(3362),i(27495),i(62953),i(48408),i(14603),i(47566),i(98721);var o=i(1087);const r="__paste__",a="add_automation_element",n="target_entity_id",s="target_device_id",l="target_area_id",d=(t,e,i,o)=>{const r=new URLSearchParams(window.location.search);if(r.get(a)!==o)return;const d=r.get(n);if(d&&t[d])return{entity_id:d};const c=r.get(s);if(c&&e[c])return{device_id:c};const u=r.get(l);return u&&i[u]?{area_id:u}:void 0},c=()=>Promise.all([i.e(32450),i.e(7305),i.e(92769),i.e(3283),i.e(80131),i.e(70183),i.e(12629),i.e(62574),i.e(61864)]).then(i.bind(i,65467)),u=(t,e)=>{const i=new URLSearchParams(window.location.search);(0,o.r)(t,"show-dialog",{dialogTag:"add-automation-element-dialog",dialogImport:c,dialogParams:e,addHistory:i.get(a)!==e.type})}},67442:function(t,e,i){i.d(e,{V:function(){return r},b:function(){return a}});var o=i(63533);const r=(0,o.Ik)({trigger:(0,o.Yj)(),id:(0,o.lq)((0,o.Yj)()),enabled:(0,o.lq)((0,o.zM)()),note:(0,o.lq)((0,o.Yj)())}),a=(0,o.Ik)({days:(0,o.lq)((0,o.ai)()),hours:(0,o.lq)((0,o.ai)()),minutes:(0,o.lq)((0,o.ai)()),seconds:(0,o.lq)((0,o.ai)())})},57116:function(t,e,i){i.d(e,{Ju:function(){return f},KC:function(){return b},Lt:function(){return _},T_:function(){return v},aM:function(){return y},bH:function(){return p},qK:function(){return m},yj:function(){return g}});var o=i(5124);let r,a,n,s,l,d,c,u,h=t=>t;const p=(0,o.AH)(r||(r=h`ha-icon-button{--mdc-theme-text-primary-on-background:var(--primary-text-color)}ha-expansion-panel{position:relative;--expansion-panel-summary-padding:0 0 0 8px;--expansion-panel-content-padding:0}h3{font-size:inherit;font-weight:inherit;display:flex;align-items:center;flex-wrap:wrap;gap:var(--ha-space-2);padding:var(--ha-space-2) 0;min-height:32px;max-width:100%}ha-card{transition:outline .2s}.disabled-bar{background:var(--divider-color,#e0e0e0);text-align:center;border-top-right-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-top-left-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.warning ul{margin:4px 0}ha-tooltip{cursor:default}.hidden{display:none}ha-automation-row-event-chip.event-chip{position:absolute}.icon-badge-wrapper{position:relative;display:inline-flex}.note-indicator{color:var(--ha-color-on-neutral-normal)}.note-indicator+ha-tooltip::part(body){cursor:default;max-width:300px}.note-indicator+ha-tooltip p{white-space:pre-wrap;margin:0}`)),g=(0,o.AH)(a||(a=h`.disabled{pointer-events:none}.card-content.card{padding:16px}.card-content.yaml{padding:0 1px;border-top:1px solid var(--divider-color);border-bottom:1px solid var(--divider-color)}`)),y=(0,o.AH)(n||(n=h`.card-content.indent,.selector-row,:host([indent]) ha-form{margin-inline-start:12px;padding-top:12px;padding-bottom:16px;padding-inline-start:16px;padding-inline-end:0px;border-inline-start:2px solid var(--ha-color-border-neutral-quiet);border-bottom:2px solid var(--ha-color-border-neutral-quiet);border-radius:var(--ha-border-radius-square);border-end-start-radius:var(--ha-border-radius-lg)}.card-content.indent.selected,.selector-row.parent-selected,:host([selected]) .card-content.indent,:host([selected]) ha-form{border-color:var(--primary-color);background:var(--ha-color-fill-primary-quiet-resting);background:linear-gradient(to right,var(--ha-color-fill-primary-quiet-resting) 0%,var(--ha-color-fill-primary-quiet-resting) 80%,rgba(var(--rgb-primary-color),0) 100%)}`)),v=(0,o.AH)(s||(s=h`:host{overflow:hidden}ha-button[slot=fab]{position:absolute;right:calc(16px + var(--safe-area-inset-right,0px));bottom:calc(-80px - var(--safe-area-inset-bottom));transition:bottom .3s;--ha-button-box-shadow:var(--ha-box-shadow-l)}ha-button[slot=fab].dirty{bottom:calc(16px + var(--safe-area-inset-bottom,0px))}`)),m=(0,o.AH)(l||(l=h`:host{display:block;--sidebar-width:0;--sidebar-gap:0}.has-sidebar{--sidebar-width:min(
max(var(--sidebar-dynamic-width), ${0}px),
100vw - ${0}px - var(--ha-sidebar-width, 0px),
var(--ha-automation-editor-max-width) -
${0}px - var(--ha-sidebar-width, 0px)
);--sidebar-gap:var(--ha-space-4)}.fab-positioner{display:flex;justify-content:flex-end}.fab-positioner ha-button[slot=fab]{position:fixed;right:unset;left:unset;bottom:calc(-80px - var(--safe-area-inset-bottom));transition:bottom .3s}.fab-positioner ha-button[slot=fab].dirty{bottom:calc(16px + var(--safe-area-inset-bottom,0px))}.content-wrapper{padding-right:calc(var(--sidebar-width) + var(--sidebar-gap));padding-inline-end:calc(var(--sidebar-width) + var(--sidebar-gap));padding-inline-start:0}.content{padding-top:var(--ha-space-3);padding-bottom:max(var(--safe-area-inset-bottom),32px);transition:padding-bottom 180ms ease-in-out}.content.has-bottom-sheet{padding-bottom:calc(90vh - max(var(--safe-area-inset-bottom),32px))}ha-automation-sidebar{position:fixed;top:calc(var(--header-height) + 16px);height:calc(-81px + 100vh - var(--safe-area-inset-top,0px));height:calc(-81px + 100dvh - var(--safe-area-inset-top,0px));width:var(--sidebar-width);display:block}ha-automation-sidebar.hidden{display:none}.sidebar-positioner{display:flex;justify-content:flex-end}.description{margin:0}.header a{color:var(--secondary-text-color)}`),375,350,350),f=(0,o.AH)(d||(d=h`.rows{display:flex;flex-direction:column;gap:var(--ha-space-4)}.rows.no-sidebar{margin-inline-end:0}.sortable-ghost{background:0 0;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg))}.sortable-drag{background:0 0}ha-automation-action-row{display:block;scroll-margin-top:48px}.handle{padding:4px;cursor:move;cursor:grab;border-radius:var(--ha-border-radius-pill)}.handle:focus{outline:var(--wa-focus-ring);background:var(--ha-color-fill-neutral-quiet-resting)}.handle.active{outline:var(--wa-focus-ring);background:var(--ha-color-fill-neutral-normal-active)}.handle ha-svg-icon{pointer-events:none;height:24px}.buttons{display:flex;flex-wrap:wrap;gap:var(--ha-space-2);order:1}`)),b=(0,o.AH)(c||(c=h`.sidebar-editor{display:block}.description{padding-top:16px}`)),_=(0,o.AH)(u||(u=h`.overflow-label{display:flex;justify-content:space-between;gap:var(--ha-space-3);white-space:nowrap}.overflow-label .shortcut{--mdc-icon-size:12px;display:inline-flex;flex-direction:row;align-items:center;gap:2px}.overflow-label .shortcut span{font-size:var(--ha-font-size-s);font-family:var(--ha-font-family-code);color:var(--ha-color-text-secondary)}.shortcut-placeholder{display:inline-block;width:60px}.shortcut-placeholder.mac{width:46px}@media all and (max-width:870px){.shortcut-placeholder{display:none}}`))},14440:function(t,e,i){i.a(t,async function(t,o){try{i.d(e,{B:function(){return f}});var r=i(5124),a=i(59174),n=(i(18198),i(47680),i(93367)),s=(i(67094),t([a,n]));[a,n]=s.then?(await s)():s;let l,d,c,u,h,p,g,y=t=>t;const v="M17.63,5.84C17.27,5.33 16.67,5 16,5H5A2,2 0 0,0 3,7V17A2,2 0 0,0 5,19H16C16.67,19 17.27,18.66 17.63,18.15L22,12L17.63,5.84Z",m="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z",f=(t,e,i,o,a,n,s)=>{if(!o)return r.s6;if("floor"===i&&t.floors[o])return(0,r.qy)(l||(l=y`<ha-floor-icon .slot="${0}" .floor="${0}"></ha-floor-icon>`),s,t.floors[o]);if("area"===i){const e=t.areas[o];return null!=e&&e.icon?(0,r.qy)(d||(d=y`<ha-icon .slot="${0}" .icon="${0}"></ha-icon>`),s,e.icon):(0,r.qy)(c||(c=y`<ha-svg-icon .slot="${0}" .path="${0}"></ha-svg-icon>`),s,m)}if("device"===i&&t.devices[o]){const e=t.devices[o],i=e.primary_config_entry?a[e.primary_config_entry]:void 0,n=null==i?void 0:i.domain;if(n)return(0,r.qy)(u||(u=y`<ha-domain-icon .domain="${0}" brand-fallback .slot="${0}"></ha-domain-icon>`),n,s)}if("entity"===i&&e[o])return(0,r.qy)(h||(h=y`<ha-state-icon .stateObj="${0}" .slot="${0}"></ha-state-icon>`),e[o],s);if("label"===i&&n){const t=n(o);return null!=t&&t.icon?(0,r.qy)(p||(p=y`<ha-icon .slot="${0}" .icon="${0}"></ha-icon>`),s,t.icon):(0,r.qy)(g||(g=y`<ha-svg-icon .slot="${0}" .path="${0}"></ha-svg-icon>`),s,v)}return r.s6};o()}catch(l){o(l)}})},69070:function(t,e,i){i.d(e,{N:function(){return s}});i(62953);var o=i(65522),r=i(37981),a=i(74705),n=i(55931);const s=(t,e,i,s,l,d)=>{if("floor"===s)return t.floors[l]&&(0,n.X)(t.floors[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_floor");if("area"===s)return t.areas[l]&&(0,o.A)(t.areas[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_area");if("device"===s)return t.devices[l]&&(0,r.xn)(t.devices[l])||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_device");if("entity"===s&&e[l]){const i=e[l],[o,r]=(0,a.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],t.entities,t.devices,t.areas,t.floors);return o||r||l}if("entity"===s)return i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_entity");if("label"===s&&d){const t=d(l);return(null==t?void 0:t.name)||i("ui.panel.config.automation.editor.actions.type.service.description.target_unknown_label")}return l}},62711:function(t,e,i){i.a(t,async function(t,e){try{i(74423),i(72712),i(26910),i(18111),i(22489),i(20116),i(61701),i(18237),i(45367),i(92731),i(53921),i(3362),i(27495),i(25440),i(62953);var o=i(40445),r=(i(68825),i(35211)),a=i(5124),n=i(67576),s=i(6412),l=i(91450),d=i(44537),c=i(32172),u=i(57237),h=i(24790),p=i(29823),g=(i(70947),i(67094),i(89081)),y=i(22792),v=i(95311),m=i(88555),f=i(42269),b=i(14440),_=i(69070),w=t([p,b]);[p,b]=w.then?(await w)():w;let $,x,C,k,M,z,A,q,Z,I,E,S,O=t=>t;const H="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z",D="M13 13H11V7H13M11 15H13V17H11M15.73 3H8.27L3 8.27V15.73L8.27 21H15.73L21 15.73V8.27L15.73 3Z",j="M8,3A2,2 0 0,0 6,5V9A2,2 0 0,1 4,11H3V13H4A2,2 0 0,1 6,15V19A2,2 0 0,0 8,21H10V19H8V14A2,2 0 0,0 6,12A2,2 0 0,0 8,10V5H10V3M16,3A2,2 0 0,1 18,5V9A2,2 0 0,0 20,11H21V13H20A2,2 0 0,0 18,15V19A2,2 0 0,1 16,21H14V19H16V14A2,2 0 0,1 18,12A2,2 0 0,1 16,10V5H14V3H16Z",T="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z",F="M7,10L12,15L17,10H7Z",V="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z";class L extends a.WF{willUpdate(t){super.willUpdate(t),(t.has("target")||t.has("selector")||t.has("_registries"))&&(this._rerenderCount=!0)}updated(t){super.updated(t),this._rerenderCount=!1}_countMatchingEntities(t){var e,i;const o=this.selector,r=!(null==o||null===(e=o.target)||void 0===e||!e.entity),a=!(null==o||null===(i=o.target)||void 0===i||!i.device);if(!r&&!a)return t.length;const n=a?Object.values(this._registries.entities):[];return t.filter(t=>{if(r){const e=this._states[t];if(!(0,v.MM)(e,o))return!1}if(a){var e;const i=null===(e=this._registries.entities[t])||void 0===e?void 0:e.device_id;if(i){const t=this._registries.devices[i];if(t&&!(0,v.DF)(this._states,n,t,o))return!1}}return!0}).length}_renderCount(t,e){const i=`${t}:${e}`;let o=" (-)";var r;this._countCache.has(i)&&!this._rerenderCount||("number"==typeof this._countCache.get(i)&&(o=` (${this._countCache.get(i)})`),this._countCache.set(i,(0,m.F7)(this._api.callWS,{[`${t}_id`]:[e]},!1,null===(r=this.selector)||void 0===r||null===(r=r.target)||void 0===r?void 0:r.primary_entities_only).then(t=>this._countMatchingEntities(t.referenced_entities)).catch(t=>{console.error("Error counting target entities",t)})));return this._countCache.get(i)instanceof Promise?(0,l.T)(this._countCache.get(i).then(t=>(this._countCache.set(i,t),void 0===t?a.s6:(0,a.qy)($||($=O` (${0})`),t))),o):"number"==typeof this._countCache.get(i)?` (${this._countCache.get(i)})`:a.s6}render(){if(!Object.keys(this.target||{}).length)return this._renderTargetBadge(this.targetRequired?(0,a.qy)(x||(x=O`<ha-svg-icon .path="${0}"></ha-svg-icon>`),D):a.s6,this._i18n.localize("ui.panel.config.automation.editor.target_summary.no_target"),!1,this.targetRequired);const t=Object.values(this.target||{}).reduce((t,e)=>t+(0,d.e)(e).length,0);if(t<=5){return Object.entries(this.target).reduce((t,[e,i])=>{const o=e.replace("_id","");return[...t,...(0,d.e)(i).map(t=>[o,t])]},[]).map(([t,e])=>(0,a.qy)(C||(C=O`<span class="target-wrapper"> ${0} </span>`),this._renderTarget(t,e)))}const e=Object.entries(this.target).reduce((t,[e,i])=>{const o=e.replace("_id","");return[...t,...(0,d.e)(i).map(t=>[o,t])]},[]).sort(([t],[e])=>{const i=["entity","device","area","floor","label"];return i.indexOf(t)-i.indexOf(e)});let i=null;return(0,a.qy)(k||(k=O` <ha-dropdown @wa-select="${0}" @click="${0}" @keydown="${0}"> <button slot="trigger" class="target"> <ha-svg-icon .path="${0}"></ha-svg-icon> <div class="label"> ${0} </div> <ha-svg-icon .path="${0}"></ha-svg-icon> </button> ${0} </ha-dropdown> `),this._handleTargetSelect,u.d,u.d,T,this._i18n.localize("ui.panel.config.automation.editor.target_summary.targets",{count:t}),F,e.map(([t,e])=>{const o=(0,a.qy)(M||(M=O`${0} ${0} ${0}`),null!==i&&i!==t?(0,a.qy)(z||(z=O`<wa-divider></wa-divider>`)):a.s6,i&&i===t?a.s6:(0,a.qy)(A||(A=O`<h3> ${0} </h3>`),this._i18n.localize(`ui.panel.config.automation.editor.target_summary.types.${t}`)),this._renderTarget(t,e,!0));return i=t,o}))}_checkTargetExists(t,e){return"floor"===t?!!this._registries.floors[e]:"area"===t?!!this._registries.areas[e]:"device"===t?!!this._registries.devices[e]:"entity"===t?!!this._states[e]:"label"===t&&!!this._getLabel(e)}_renderTargetBadge(t,e,i=!1,o=!1,r,n,l=a.s6){return this.interactive&&r&&n?(0,a.qy)(Z||(Z=O`<button class="${0}" .targetId="${0}" .targetType="${0}" .label="${0}" @click="${0}" @keydown="${0}"> ${0} <div class="label">${0}${0}</div> </button>`),(0,s.H)({target:!0,warning:i,error:o}),r,n,e,this._handleTargetClick,this._handleTargetKeydown,t,e,l):(0,a.qy)(q||(q=O`<div class="${0}" .targetId="${0}" .targetType="${0}" .label="${0}"> ${0} <div class="label">${0}${0}</div> </div>`),(0,s.H)({target:!0,warning:i,error:o}),r,n,e,t,e,l)}_renderTarget(t,e,i=!1){let o,r,n=!1,l=e,d=t,c=a.s6;if("entity"===t&&["all","none"].includes(e))o=V,r=this._i18n.localize(`ui.panel.config.automation.editor.target_summary.${e}_entities`),l=void 0,d=void 0;else if((0,h.F)(e))o=j,r=this._i18n.localize("ui.panel.config.automation.editor.target_summary.template"),l=void 0,d=void 0;else{this._checkTargetExists(t,e)?(r=(0,_.N)(this._registries,this._states,this._i18n.localize,t,e,this._getLabel),"entity"!==t&&this.interactive&&(c=this._renderCount(t,e))):(o=H,r=(0,_.N)(this._registries,this._states,this._i18n.localize,t,e,this._getLabel),n=!0,l=void 0,d=void 0)}const u=o?(0,a.qy)(I||(I=O`<ha-svg-icon .slot="${0}" .path="${0}"></ha-svg-icon>`),i?"icon":"",o):(0,b.B)(this._registries,this._states,t,e,this._configEntryLookup||{},this._getLabel,i?"icon":"");return i?(0,a.qy)(E||(E=O`<ha-dropdown-item .value="${0}" class="${0}">${0} ${0}${0}</ha-dropdown-item>`),{targetId:l,targetType:d,label:r},(0,s.H)({warning:n}),u,r,c):this._renderTargetBadge(u,r,n,!1,l,d,c)}_handleTargetClick(t){const e=t.currentTarget;e.targetId&&e.targetType&&this._showTargetInfo(e.targetId,e.targetType,e.label,t)}_handleTargetKeydown(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this._handleTargetClick(t))}_handleTargetSelect(t){const e=t.detail.item.value;e.targetId&&e.targetType&&this._showTargetInfo(e.targetId,e.targetType,e.label)}_showTargetInfo(t,e,i,o){null==o||o.stopPropagation(),"entity"!==e?(0,g.D)(this,{title:i,type:e,itemId:t,selector:this.selector}):(0,f.p)(this,{entityId:t})}constructor(...t){super(...t),this.targetRequired=!1,this.interactive=!1,this._countCache=new Map,this._rerenderCount=!0,this._getLabel=t=>{var e;return null===(e=this._labelRegistry)||void 0===e?void 0:e.find(({label_id:e})=>e===t)}}}L.styles=(0,a.AH)(S||(S=O`:host{display:contents;min-height:32px}.target-wrapper{display:inline-flex;align-items:flex-end;gap:var(--ha-space-1);max-width:100%}.target{display:inline-flex;gap:var(--ha-space-1);justify-content:center;align-items:center;border-radius:var(--ha-border-radius-md);background:var(--ha-color-fill-neutral-normal-resting);padding:0 var(--ha-space-2) 0 var(--ha-space-1);color:var(--ha-color-on-neutral-normal);border:var(--ha-border-width-sm) solid var(--ha-color-border-neutral-quiet);overflow:hidden;height:32px}.target.warning{background:var(--ha-color-fill-warning-normal-resting);color:var(--ha-color-on-warning-normal)}.target.error{background:var(--ha-color-fill-danger-normal-resting);color:var(--ha-color-on-danger-normal)}.target .label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.target ha-domain-icon,.target ha-icon,.target ha-svg-icon{display:flex;padding:var(--ha-space-1) 0}.target ha-floor-icon{display:flex;height:32px;align-items:center}button.target{cursor:pointer}button.target:hover{background:var(--ha-color-fill-neutral-normal-hover)}ha-dropdown-item{padding:0 var(--ha-space-2)}ha-dropdown-item.warning{background-color:var(--ha-color-fill-warning-quiet-resting);color:var(--ha-color-on-warning-normal)}ha-dropdown-item.warning:hover{background-color:var(--ha-color-fill-warning-quiet-hover);color:var(--ha-color-on-warning-normal)}`)),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"target",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"targetRequired",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"selector",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],L.prototype,"interactive",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:y.D5,subscribe:!0})],L.prototype,"_i18n",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:y.Hd,subscribe:!0})],L.prototype,"_registries",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:y.HD,subscribe:!0})],L.prototype,"_labelRegistry",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:y.g5,subscribe:!0}),(0,c.p)({transformer:function(t){return t?Object.fromEntries(t.map(t=>[t.entry_id,t])):void 0}})],L.prototype,"_configEntryLookup",void 0),(0,o.Cg)([(0,r.Fg)({context:y.Ie,subscribe:!0})],L.prototype,"_api",void 0),(0,o.Cg)([(0,r.Fg)({context:y.iN,subscribe:!0})],L.prototype,"_states",void 0),L=(0,o.Cg)([(0,n.EM)("ha-automation-row-targets")],L),e()}catch($){e($)}})},53580:function(t,e,i){i.d(e,{mdiHomeAssistant:function(){return o}});const o="m12.151 1.5882c-.3262 0-.6523.1291-.8996.3867l-8.3848 8.7354c-.0619.0644-.1223.1368-.1807.2154-.0588.0789-.1151.1638-.1688.2534-.2593.4325-.4552.9749-.5232 1.4555-.0026.018-.0076.0369-.0094.0548-.0121.0987-.0184.1944-.0184.2857v8.0124a1.2731 1.2731 0 001.2731 1.2731h7.8313l-3.4484-3.593a1.7399 1.7399 0 111.0803-1.125l2.6847 2.7972v-10.248a1.7399 1.7399 0 111.5276-0v7.187l2.6702-2.782a1.7399 1.7399 0 111.0566 1.1505l-3.7269 3.8831v2.7299h8.174a1.2471 1.2471 0 001.2471-1.2471v-8.0375c0-.0912-.0059-.1868-.0184-.2855-.0603-.4935-.2636-1.0617-.5326-1.5105-.0537-.0896-.1101-.1745-.1684-.253-.0588-.079-.1191-.1513-.181-.2158l-8.3848-8.7363c-.2473-.2577-.5735-.3866-.8995-.3864"},36918:function(t,e,i){i.d(e,{o:function(){return o}});const o=(t,e)=>`https://www.iobroker.net/#${t.language&&t.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`},41570:function(t,e,i){i.d(e,{c:function(){return o}});i(27495);const o=/Mac/i.test(navigator.userAgent)}}]);