UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

10 lines 206 kB
export const __rspack_esm_id=15862;export const __rspack_esm_ids=[15862];export const __webpack_modules__={36091(t,e,i){i.d(e,{a:()=>s});i(18111),i(61701),i(18237);function s(t){return t.reduce((t,e)=>t.concat(t.map(t=>[...t,e])),[[]])}},87047(t,e,i){i.a(t,async function(t,s){try{i.d(e,{x:()=>n});i(44114);var o=i(43574),a=t([o]);o=(a.then?(await a)():a)[0];class n{hostDisconnected(){this.clear()}setup(t,e,i,s){this.clear(),t.length&&(0,o.Ep)(t,e,t=>this._unsubs.push(t),()=>i(),s)}clear(){for(const t of this._unsubs)t();this._unsubs=[]}constructor(t){this._unsubs=[],t.addController(this)}}s()}catch(t){s(t)}})},22542(t,e,i){i.d(e,{F:()=>n,j:()=>a});i(18111),i(81148),i(61701),i(13579);var s=i(22675),o=i(69093);const a=t=>{if(!t.length)return s.Hh;if(t.every(t=>t.state===s.Hh))return s.Hh;if(!t.some(t=>t.state!==s.Hh&&t.state!==s.HV))return s.HV;if("cover"===(0,o.t)(t[0])){for(const e of["opening","closing","open"])if(t.some(t=>t.state===e))return e;return"closed"}return t.some(t=>"on"===t.state)?"on":"off"},n=(t,e)=>{if(!e.length)return;const i=(0,o.t)(e[0]),s=a(e),n="on"===s||"open"===s;let r=n?"turn_off":"turn_on";"cover"===i&&(r="opening"===s||"closing"===s?"stop_cover":n?"close_cover":"open_cover");const c=e.map(t=>t.entity_id);t.callService(i,r,{entity_id:c})}},3109(t,e,i){var s=i(62826),o=i(86137),a=i(22441);class n extends o.A{constructor(){super(),this.play=!0,this.iterations=1,this.fill="both",this.name="fadeIn"}}(0,s.Cg)([(0,a.MZ)({type:Boolean})],n.prototype,"play",void 0),n=(0,s.Cg)([(0,a.EM)("ha-fade-in")],n)},14328(t,e,i){var s=i(62826),o=i(86137),a=i(22441);class n extends o.A{constructor(){super(),this.play=!0,this.iterations=1,this.fill="both",this.name="fadeOut"}}(0,s.Cg)([(0,a.MZ)({type:Boolean})],n.prototype,"play",void 0),n=(0,s.Cg)([(0,a.EM)("ha-fade-out")],n)},7822(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=(i(86137),i(5124)),a=i(22441),n=i(31479),r=(i(3109),i(14328),i(26300)),c=t([r]);r=(c.then?(await c)():c)[0];const h="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 l extends o.WF{willUpdate(t){t.has("show")&&(this._highlight=0,!this.show&&this.hasUpdated&&(this._hide=!0))}render(){if(!this.show&&!this._hide)return o.s6;let t=o.qy`<div><slot></slot></div>`;return this.interactive&&(t=o.qy`<button> <slot></slot> <ha-svg-icon .path="${h}"></ha-svg-icon> </button>`),this.show&&this._highlight?(0,n.D)(this._highlight,o.qy` <wa-animation fill="both" .iterations="${1}" name="headShake" play>${t}</wa-animation> `):!this.show&&this._hide?o.qy` <ha-fade-out @wa-finish="${this._handleHideFinish}">${t}</ha-fade-out> `:o.qy`<ha-fade-in .duration="${250}">${t}</ha-fade-in>`}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}}l.styles=o.AH`: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,s.Cg)([(0,a.MZ)({reflect:!0})],l.prototype,"variant",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],l.prototype,"interactive",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],l.prototype,"show",void 0),(0,s.Cg)([(0,a.wk)()],l.prototype,"_hide",void 0),(0,s.Cg)([(0,a.wk)()],l.prototype,"_highlight",void 0),l=(0,s.Cg)([(0,a.EM)("ha-automation-row-event-chip")],l),e()}catch(t){e(t)}})},78486(t,e,i){var s=i(62826),o=i(5124),a=i(22441);class n extends o.WF{render(){return o.qy` <div id="indicator" role="status" tabindex="0" aria-label="${this.label}"></div> `}constructor(...t){super(...t),this.state="unknown",this.label=""}}n.styles=o.AH`:host{position:absolute;top:-5px;inset-inline-end:-6px;display:inline-block}#indicator{width:10px;height:10px;border-radius:var(--ha-border-radius-circle);border:var(--ha-border-width-md) solid;box-sizing:border-box;background-color:var(--card-background-color);box-shadow:0 0 0 2px var(--card-background-color);transition:all var(--ha-animation-duration-normal) ease-in-out}:host([state=pass]) #indicator{background-color:var(--ha-color-green-60);border-color:var(--ha-color-green-60)}:host([state=fail]) #indicator{border-color:var(--ha-color-orange-60)}:host([state=invalid]) #indicator{border-color:var(--ha-color-red-60)}:host([state=unknown]) #indicator{border-color:var(--ha-color-neutral-60)}`,(0,s.Cg)([(0,a.MZ)({reflect:!0})],n.prototype,"state",void 0),(0,s.Cg)([(0,a.MZ)()],n.prototype,"label",void 0),n=(0,s.Cg)([(0,a.EM)("ha-automation-row-live-test")],n)},34218(t,e,i){i.d(e,{P:()=>s});i(44114),i(18111),i(18237),i(45367),i(92731);function s(t,e,i,s,a=!1){if(!t)return[];if(t.length<=e)return t;const n=i??o(t[0])[0],r=s??o(t[t.length-1])[0],c=Math.ceil((r-n)/Math.floor(e)),h=new Map;for(const e of t){const t=o(e);if(!Array.isArray(t))continue;const i=Number(t[0]),s=Number(t[1]);if(isNaN(i)||isNaN(s))continue;const a=Math.floor((i-n)/c),r=h.get(a);r?r.push({point:e,x:i,y:s}):h.set(a,[{point:e,x:i,y:s}])}const l=[];if(a)for(const[t,e]of h){const t=e.reduce((t,e)=>t+e.y,0)/e.length,i=e.reduce((t,e)=>t+e.x,0)/e.length,s=o(e[0].point),a=Array.isArray(s)?[i,t]:{value:[i,t]};l.push(a)}else for(const[t,e]of h){let t=e[0],i=e[0];for(const s of e)s.y<t.y&&(t=s),s.y>i.y&&(i=s);t.x>i.x&&l.push(i.point),l.push(t.point),t.x<i.x&&l.push(i.point)}return l}function o(t){return t&&"object"==typeof t&&"value"in t?t.value:t}},36248(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(91450),r=i(85694),c=(i(47680),i(67094),t([r]));r=(c.then?(await c)():c)[0];class h extends o.WF{render(){if(this.icon)return o.qy`<ha-icon .icon="${this.icon}"></ha-icon>`;if(!this.stateObj||!this.attribute)return o.s6;if(!this.hass)return o.s6;const t=(0,r.Gp)(this.hass,this.stateObj,this.attribute,this.attributeValue).then(t=>t?o.qy`<ha-icon .icon="${t}"></ha-icon>`:o.s6);return o.qy`${(0,n.T)(t)}`}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"stateObj",void 0),(0,s.Cg)([(0,a.MZ)()],h.prototype,"attribute",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"attributeValue",void 0),(0,s.Cg)([(0,a.MZ)()],h.prototype,"icon",void 0),h=(0,s.Cg)([(0,a.EM)("ha-attribute-icon")],h),e()}catch(t){e(t)}})},56048(t,e,i){i.a(t,async function(t,e){try{i(18111),i(20116),i(61701);var s=i(62826),o=i(5124),a=i(22441),n=i(6412),r=i(22786),c=i(29823),h=(i(70947),i(47680),i(67094),t([c]));c=(h.then?(await h)():h)[0];const l="M7,10L12,15L17,10H7Z";class d extends o.WF{render(){return this.disabled?this._renderTrigger():o.qy` <ha-dropdown placement="bottom" @wa-show="${this._showDropdown}"> ${this._renderTrigger()} ${this.options.map(this._renderOption)} </ha-dropdown> `}_renderTrigger(){const t=this.getValueObject(this.options,this.value)?.label,e={"select-disabled":this.disabled,"select-required":this.required,"select-no-value":!t};return o.qy`<button ?disabled="${this.disabled}" slot="trigger" class="select-anchor ${(0,n.H)(e)}"> ${this._renderIcon()} <div class="content"> ${this.hideLabel?o.s6:o.qy`<p id="label" class="label">${this.label}</p>`} ${t?o.qy`<p class="value">${t}</p>`:o.s6} </div> ${this._renderArrow()} </button>`}_renderArrow(){return this.showArrow?o.qy` <div class="icon"> <ha-svg-icon .path="${l}"></ha-svg-icon> </div> `:o.s6}_renderIcon(){const t=this.getValueObject(this.options,this.value),e=this.querySelector("[slot='icon']");return o.qy` <div class="icon"> ${t?.iconPath?o.qy`<ha-svg-icon slot="icon" .path="${t.iconPath}"></ha-svg-icon>`:t?.icon?o.qy`<ha-icon slot="icon" .icon="${t.icon}"></ha-icon>`:this.renderIcon&&this.value?this.renderIcon(this.value):e?o.qy`<slot name="icon"></slot>`:o.s6} </div> `}_showDropdown(){this.style.setProperty("--control-select-menu-width",`${this._triggerButton.offsetWidth}px`)}constructor(...t){super(...t),this.showArrow=!1,this.hideLabel=!1,this.disabled=!1,this.required=!1,this.options=[],this._renderOption=t=>o.qy`<ha-dropdown-item .value="${t.value}" .selected="${this.value===t.value}">${t.iconPath?o.qy`<ha-svg-icon slot="icon" .path="${t.iconPath}"></ha-svg-icon>`:t.icon?o.qy`<ha-icon slot="icon" .icon="${t.icon}"></ha-icon>`:this.renderIcon?o.qy`<span slot="icon">${this.renderIcon(t.value)}</span>`:o.s6} ${t.label}</ha-dropdown-item>`,this.getValueObject=(0,r.A)((t,e)=>t.find(t=>t.value===e))}}d.styles=[o.AH`:host{display:inline-block;--control-select-menu-focus-color:var(--secondary-text-color);--control-select-menu-text-color:var(--primary-text-color);--control-select-menu-background-color:var(--disabled-color);--control-select-menu-background-opacity:0.2;--control-select-menu-border-radius:var(--ha-border-radius-lg);--control-select-menu-height:48px;--control-select-menu-padding:6px 10px;--mdc-icon-size:20px;--ha-ripple-color:var(--secondary-text-color);font-size:var(--ha-font-size-m);line-height:1.4;width:auto;-webkit-tap-highlight-color:transparent}.select-anchor{border:none;text-align:left;color:var(--primary-text-color);height:var(--control-select-menu-height);padding:var(--control-select-menu-padding);overflow:hidden;position:relative;cursor:pointer;display:flex;flex-direction:row;align-items:center;border-radius:var(--control-select-menu-border-radius);box-sizing:border-box;outline:0;overflow:hidden;background:0 0;z-index:0;transition:box-shadow 180ms ease-in-out,color 180ms ease-in-out;gap:10px;width:100%;user-select:none;font-style:normal;font-weight:var(--ha-font-weight-normal);letter-spacing:.25px}.select-anchor:hover{--control-select-menu-background-color:var(--ha-color-on-neutral-quiet)}.content{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;flex:1;overflow:hidden}.content p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0;width:100%;margin:auto}.label{font-size:var(--ha-font-size-s);letter-spacing:.4px}.select-no-value .label{font-size:inherit;line-height:inherit;letter-spacing:inherit}.content .value{font-size:var(--ha-font-size-m)}.select-anchor:focus-visible{box-shadow:0 0 0 2px var(--control-select-menu-focus-color)}.select-anchor::before{content:"";position:absolute;top:0;left:0;height:100%;width:100%;background-color:var(--control-select-menu-background-color);transition:background-color 180ms ease-in-out,opacity 180ms ease-in-out;opacity:var(--control-select-menu-background-opacity)}.select-disabled.select-anchor{cursor:not-allowed;color:var(--disabled-color)}ha-dropdown::part(menu){min-width:var(--control-select-menu-width)}`],(0,s.Cg)([(0,a.MZ)({type:Boolean,attribute:"show-arrow"})],d.prototype,"showArrow",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean,attribute:"hide-label"})],d.prototype,"hideLabel",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],d.prototype,"disabled",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],d.prototype,"required",void 0),(0,s.Cg)([(0,a.MZ)()],d.prototype,"label",void 0),(0,s.Cg)([(0,a.MZ)()],d.prototype,"value",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"options",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"renderIcon",void 0),(0,s.Cg)([(0,a.P)("button")],d.prototype,"_triggerButton",void 0),d=(0,s.Cg)([(0,a.EM)("ha-control-select-menu")],d),e()}catch(t){e(t)}})},25094(t,e,i){var s=i(62826),o=i(26183),a=i(5124),n=i(22441),r=i(63672),c=i(1087),h=i(63091);i(67094);class l extends a.WF{firstUpdated(t){super.firstUpdated(t),this.setupSwipeListeners()}_toggle(){this.disabled||(this.checked=!this.checked,(0,c.r)(this,"change"))}connectedCallback(){super.connectedCallback(),this.setupSwipeListeners()}updated(t){super.updated(t),(t.has("disabled")||t.has("vertical")||t.has("reversed"))&&(this.destroyListeners(),this.setupSwipeListeners())}disconnectedCallback(){super.disconnectedCallback(),this.destroyListeners()}setupSwipeListeners(){this.disabled||this.switch&&!this._mc&&(this._mc=new o.mS(this.switch,{touchAction:this.touchAction??(this.vertical?"pan-x":"pan-y")}),this._mc.add(new o.Hp({direction:this.vertical?o.EJ:o.fK})),this._mc.add(new o.Cx({event:"singletap"})),this._mc.add(new o.ac),this.vertical?(this._mc.on("swipeup",()=>{this.disabled||(this.checked=!!this.reversed,(0,c.r)(this,"change"))}),this._mc.on("swipedown",()=>{this.disabled||(this.checked=!this.reversed,(0,c.r)(this,"change"))})):(this._mc.on("swiperight",()=>{if(this.disabled)return;const t="rtl"===h.G.document.dir;this.checked=!this.reversed&&!t||this.reversed&&t,(0,c.r)(this,"change")}),this._mc.on("swipeleft",()=>{if(this.disabled)return;const t="rtl"===h.G.document.dir;this.checked=this.reversed&&!t||!this.reversed&&t,(0,c.r)(this,"change")})),this._mc.on("singletap pressup",()=>{this.disabled||this._toggle()}))}destroyListeners(){this._mc&&(this._mc.destroy(),this._mc=void 0)}_keydown(t){if("Enter"===t.key||" "===t.key)return t.preventDefault(),void this._toggle();const e=!this.vertical&&"rtl"===h.G.document.dir,i=this.reversed!==e,[s,o]=this.vertical?["ArrowDown","ArrowUp"]:["ArrowRight","ArrowLeft"],a=i?o:s,n=i?s:o;if(t.key!==a&&t.key!==n)return;t.preventDefault();t.key===a!==this.checked&&this._toggle()}render(){return a.qy` <div id="switch" class="switch" @keydown="${this._keydown}" aria-checked="${this.checked?"true":"false"}" aria-label="${(0,r.J)(this.label)}" role="switch" tabindex="${(0,r.J)(this.disabled?void 0:"0")}" ?checked="${this.checked}" ?disabled="${this.disabled}"> <div class="background"></div> <div class="button" aria-hidden="true"> ${this.checked?this.pathOn?a.qy`<ha-svg-icon .path="${this.pathOn}"></ha-svg-icon>`:a.qy`<slot name="icon-on"></slot>`:this.pathOff?a.qy`<ha-svg-icon .path="${this.pathOff}"></ha-svg-icon>`:a.qy`<slot name="icon-off"></slot>`} </div> </div> `}constructor(...t){super(...t),this.disabled=!1,this.vertical=!1,this.reversed=!1,this.checked=!1}}l.styles=a.AH`:host{display:block;--control-switch-on-color:var(--primary-color);--control-switch-off-color:var(--disabled-color);--control-switch-background-opacity:0.2;--control-switch-hover-background-opacity:0.4;--control-switch-thickness:40px;--control-switch-min-touch-size:40px;--control-switch-border-radius:var(--ha-border-radius-lg);--control-switch-padding:4px;--mdc-icon-size:20px;height:var(--control-switch-thickness);width:100%;box-sizing:border-box;user-select:none;transition:box-shadow 180ms ease-in-out;-webkit-tap-highlight-color:transparent}.switch:not([disabled]):focus-visible{box-shadow:0 0 0 2px var(--control-switch-off-color)}.switch[checked]:not([disabled]):focus-visible{box-shadow:0 0 0 2px var(--control-switch-on-color)}.switch{box-sizing:border-box;position:relative;height:100%;width:100%;border-radius:var(--control-switch-border-radius);outline:0;padding:var(--control-switch-padding);display:flex;cursor:pointer}.switch::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--control-switch-min-touch-size);min-height:var(--control-switch-min-touch-size)}.switch[disabled]{opacity:.5;cursor:not-allowed}.switch[disabled]::before{pointer-events:none}.switch .background{position:absolute;top:0;left:0;height:100%;width:100%;border-radius:inherit;background-color:var(--control-switch-off-color);transition:background-color 180ms ease-in-out;opacity:var(--control-switch-background-opacity)}.switch:not([disabled]):focus-visible .background,.switch:not([disabled]):hover .background{opacity:var(--control-switch-hover-background-opacity)}.switch .button{width:50%;height:100%;background:#d3d3d3;border-radius:calc(var(--control-switch-border-radius) - var(--control-switch-padding));transition:transform 180ms ease-in-out,background-color 180ms ease-in-out;background-color:var(--control-switch-off-color);color:#fff;display:flex;align-items:center;justify-content:center}.switch[checked] .background{background-color:var(--control-switch-on-color)}.switch[checked] .button{transform:translateX(100%);background-color:var(--control-switch-on-color)}.switch[checked] .button:dir(rtl){transform:translateX(-100%);background-color:var(--control-switch-on-color)}:host([reversed]) .switch{flex-direction:row-reverse}:host([reversed]) .switch[checked] .button{transform:translateX(-100%)}:host([reversed]) .switch[checked] .button:dir(rtl){transform:translateX(100%)}:host([vertical]){width:var(--control-switch-thickness);height:100%}:host([vertical]) .switch[checked] .button{transform:translateY(100%)}:host([vertical]) .switch .button{width:100%;height:50%}:host([vertical][reversed]) .switch{flex-direction:column-reverse}:host([vertical][reversed]) .switch[checked] .button{transform:translateY(-100%)}`,(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"disabled",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"vertical",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"reversed",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"checked",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"pathOn",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"pathOff",void 0),(0,s.Cg)([(0,n.MZ)({type:String})],l.prototype,"label",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"touch-action"})],l.prototype,"touchAction",void 0),(0,s.Cg)([(0,n.P)("#switch")],l.prototype,"switch",void 0),l=(0,s.Cg)([(0,n.EM)("ha-control-switch")],l)},51336(t,e,i){var s=i(62826),o=i(5124),a=i(22441),n=i(63672);class r extends o.WF{render(){return o.qy` <div class="heading-badge" role="${(0,n.J)("button"===this.type?"button":void 0)}" tabindex="${(0,n.J)("button"===this.type?"0":void 0)}"> <slot name="icon"></slot> <slot></slot> </div> `}constructor(...t){super(...t),this.type="text"}}r.styles=o.AH`[role=button]{cursor:pointer}.heading-badge{display:flex;flex-direction:row;white-space:nowrap;align-items:center;gap:3px;color:var(--ha-heading-badge-text-color,var(--secondary-text-color));font-size:var(--ha-heading-badge-font-size, var(--ha-font-size-m));font-weight:var(--ha-heading-badge-font-weight,400);line-height:var(--ha-heading-badge-line-height, 20px);letter-spacing:.1px;--mdc-icon-size:16px}::slotted([slot=icon]){--ha-icon-display:block;color:var(--icon-color,inherit)}`,(0,s.Cg)([(0,a.MZ)()],r.prototype,"type",void 0),r=(0,s.Cg)([(0,a.EM)("ha-heading-badge")],r)},78673(t,e,i){var s=i(62826),o=i(5124),a=i(22441),n=i(6412),r=i(89784),c=i(69093),h=i(28669);class l extends o.WF{willUpdate(t){if(super.willUpdate(t),t.has("user"))return void this._getPersonPicture();const e=t.get("hass");if(this._personEntityId&&e&&this.hass.states[this._personEntityId]!==e.states[this._personEntityId]){const t=this.hass.states[this._personEntityId];t?this._personPicture=t.attributes.entity_picture:this._getPersonPicture()}else!this._personEntityId&&e&&this._getPersonPicture()}render(){if(!this.hass||!this.user)return o.s6;const t=this._personPicture;if(t)return o.qy`<div style="${(0,r.W)({backgroundImage:`url(${this.hass.hassUrl(t)})`})}" class="picture"></div>`;const e=(0,h._2)(this.user.name);return o.qy`<div class="initials ${(0,n.H)({long:e.length>2})}"> ${e} </div>`}_getPersonPicture(){if(this._personEntityId=void 0,this._personPicture=void 0,this.hass&&this.user)for(const t of Object.values(this.hass.states))if(t.attributes.user_id===this.user.id&&"person"===(0,c.t)(t)){this._personEntityId=t.entity_id,this._personPicture=t.attributes.entity_picture;break}}}l.styles=o.AH`:host{display:block;width:40px;height:40px}.picture{width:100%;height:100%;background-size:cover;border-radius:var(--ha-border-radius-circle)}.initials{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;width:100%;height:100%;border-radius:var(--ha-border-radius-circle);background-color:var(--light-primary-color);text-decoration:none;color:var(--text-light-primary-color,var(--primary-text-color));overflow:hidden}.initials.long{font-size:var(--ha-font-size-s)}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],l.prototype,"user",void 0),(0,s.Cg)([(0,a.wk)()],l.prototype,"_personPicture",void 0),l=(0,s.Cg)([(0,a.EM)("ha-user-badge")],l)},57488(t,e,i){i.d(e,{g:()=>n,t:()=>a});i(74423),i(18111),i(22489),i(18237);var s=i(4423);const o=t=>({filter:{domain:"cover",device_class:t}}),a={light:{filter:{domain:"light"}},fan:{filter:{domain:"fan"}},switch:{filter:{domain:"switch"}},"cover-blind":o("blind"),"cover-curtain":o("curtain"),"cover-damper":o("damper"),"cover-awning":o("awning"),"cover-door":o("door"),"cover-garage":o("garage"),"cover-gate":o("gate"),"cover-shade":o("shade"),"cover-shutter":o("shutter"),"cover-window":o("window")},n=(t,e,i,o)=>t.reduce((t,n)=>{const r=a[n],c=(0,s.r)(o,{area:e,entity_category:"none",...r.filter});return t[n]=Object.keys(o.entities).filter(t=>c(t)&&!i?.includes(t)),t},{})},84337(t,e,i){i.d(e,{S:()=>s});i(44114),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);const s=t=>{if(!t)return[];const e=new Set,i=[];for(const s of t){const t=Number(s);if(isNaN(t))continue;const o=Math.max(0,Math.min(100,t));e.has(o)||(e.add(o),i.push(o))}return i}},84610(t,e,i){i.d(e,{C6:()=>o,i5:()=>a,ye:()=>s});var s=function(t){return t[t.MODES=1]="MODES",t}({}),o=function(t){return t.HUMIDIFIER="humidifier",t.DEHUMIDIFIER="dehumidifier",t}({});const a={drying:"on",humidifying:"on",idle:"off",off:"off"}},22865(t,e,i){i.d(e,{IQ:()=>a,gK:()=>r,mB:()=>o,yU:()=>n});var s=i(22675),o=function(t){return t[t.START_MOWING=1]="START_MOWING",t[t.PAUSE=2]="PAUSE",t[t.DOCK=4]="DOCK",t}({});function a(t){return"mowing"===t.state}function n(t){return t.state!==s.Hh&&"mowing"!==t.state}function r(t){return t.state!==s.Hh&&"docked"!==t.state}},24717(t,e,i){i.d(e,{Ak:()=>a,Bd:()=>n,Ri:()=>o,lg:()=>r,qT:()=>h,uu:()=>c});i(74423);var s=i(22675),o=function(t){return t[t.TURN_ON=1]="TURN_ON",t[t.TURN_OFF=2]="TURN_OFF",t[t.PAUSE=4]="PAUSE",t[t.STOP=8]="STOP",t[t.RETURN_HOME=16]="RETURN_HOME",t[t.FAN_SPEED=32]="FAN_SPEED",t[t.BATTERY=64]="BATTERY",t[t.STATUS=128]="STATUS",t[t.SEND_COMMAND=256]="SEND_COMMAND",t[t.LOCATE=512]="LOCATE",t[t.CLEAN_SPOT=1024]="CLEAN_SPOT",t[t.MAP=2048]="MAP",t[t.STATE=4096]="STATE",t[t.START=8192]="START",t[t.CLEAN_AREA=16384]="CLEAN_AREA",t}({});function a(t){return["cleaning","on"].includes(t.state)}function n(t){return t.state!==s.Hh&&!a(t)}function r(t){return!["docked","off","idle"].includes(t.state)}function c(t){return t.state!==s.Hh&&"returning"!==t.state}const h=(t,e)=>t.callWS({type:"vacuum/get_segments",entity_id:e})},92326(t,e,i){i.d(e,{Cp:()=>u,hJ:()=>l,lg:()=>d,pc:()=>h,ph:()=>r,qm:()=>n,sA:()=>c});var s=i(47129),o=i(82286),a=i(22675),n=function(t){return t[t.OPEN=1]="OPEN",t[t.CLOSE=2]="CLOSE",t[t.SET_POSITION=4]="SET_POSITION",t[t.STOP=8]="STOP",t}({});const r=[0,25,75,100],c=t=>(0,o.$)(t,4);function h(t){if(t.state===a.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return void 0!==t.attributes.current_position&&null!==t.attributes.current_position?100===t.attributes.current_position:"open"===t.state}(t)&&!function(t){return"opening"===t.state}(t)}function l(t){if(t.state===a.Hh)return!1;return!0===t.attributes.assumed_state||!function(t){return void 0!==t.attributes.current_position&&null!==t.attributes.current_position?0===t.attributes.current_position:"closed"===t.state}(t)&&!function(t){return"closing"===t.state}(t)}function d(t){return t.state!==a.Hh}function u(t,e,i){const o=(0,s.a)(t)?t.attributes.current_position:void 0,a=i??o;return a&&100!==a?e.formatEntityAttributeValue(t,"current_position",Math.round(a)):""}},1966(t,e,i){var s=i(62826),o=i(5124),a=i(22441),n=i(63672),r=i(89784),c=i(79468),h=i(16629),l=i(79622);class d extends o.WF{focus(){this._button?.focus()}get _rgbColor(){if(this.color){if("hs_color"in this.color)return(0,c.BA)([this.color.hs_color[0],this.color.hs_color[1]/100]);if("color_temp_kelvin"in this.color)return(0,h.Mn)(this.color.color_temp_kelvin);if("rgb_color"in this.color)return this.color.rgb_color;if("rgbw_color"in this.color)return(0,h.E7)(this.color.rgbw_color);if("rgbww_color"in this.color)return(0,h.lf)(this.color.rgbww_color,this.stateObj?.attributes.min_color_temp_kelvin,this.stateObj?.attributes.max_color_temp_kelvin)}return[255,255,255]}render(){const t=(0,c.v2)(this._rgbColor),e=(0,l.EP)(this._rgbColor)>.8,i=e?"var(--divider-color)":"transparent";return o.qy` <button .disabled="${this.disabled}" title="${(0,n.J)(this.label)}" aria-label="${(0,n.J)(this.label)}" style="${(0,r.W)({"background-color":t,"border-color":i,"--focus-color":e?i:t})}"></button> `}constructor(...t){super(...t),this.disabled=!1}}d.styles=o.AH`:host{display:block;width:var(--ha-favorite-color-button-size,40px);height:var(--ha-favorite-color-button-size,40px)}button{background-color:var(--color);position:relative;display:block;width:100%;height:100%;border:1px solid transparent;border-radius:var(--ha-favorite-color-button-border-radius,var(--ha-border-radius-pill));padding:0;margin:0;cursor:pointer;outline:0;transition:box-shadow 180ms ease-in-out,transform 180ms ease-in-out}button:focus-visible{box-shadow:0 0 0 2px var(--focus-color)}button:active{transform:scale(1.1)}:host([disabled]){pointer-events:none}button:disabled{filter:grayscale(1) opacity(.5)}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"label",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"stateObj",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"color",void 0),(0,s.Cg)([(0,a.P)("button",!0)],d.prototype,"_button",void 0),d=(0,s.Cg)([(0,a.EM)("ha-favorite-color-button")],d)},68737(t,e,i){i.a(t,async function(t,s){try{i.d(e,{J:()=>f});i(44114);var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(22786),h=i(79468),l=i(16629),d=i(1087),u=i(52658),_=i(77796),p=i(10223),g=i(22675),v=i(88827),b=i(57264),y=t([p,v]);[p,v]=y.then?(await y)():y;const f=(t,e)=>{const i=[],s=(e-t)/10;for(let e=0;e<11;e++){const o=t+s*e,a=(0,h.v2)((0,l.Mn)(o));i.push([.1*e,a])}return i.map(([t,e])=>`${e} ${100*t}%`).join(", ")};class m extends a.WF{render(){if(!this.stateObj)return a.s6;const t=this.stateObj.attributes.min_color_temp_kelvin??2700,e=this.stateObj.attributes.max_color_temp_kelvin??6500,i=this._generateTemperatureGradient(t,e),s=(0,u.Se)(this.stateObj);return a.qy` <ha-control-slider touch-action="none" inverted vertical .value="${this._ctPickerValue}" .min="${t}" .max="${e}" mode="cursor" @value-changed="${this._ctColorChanged}" @slider-moved="${this._ctColorCursorMoved}" .label="${this.hass.localize("ui.dialogs.more_info_control.light.color_temp")}" style="${(0,r.W)({"--control-slider-color":s,"--gradient":i})}" .disabled="${this.stateObj.state===g.Hh}" .unit="${v.rM.light.color_temp_kelvin}" .locale="${this.hass.locale}"> </ha-control-slider> `}_updateSliderValues(){const t=this.stateObj;"on"===t.state?this._ctPickerValue=t.attributes.color_mode===b.NC.COLOR_TEMP?t.attributes.color_temp_kelvin:void 0:this._ctPickerValue=void 0}willUpdate(t){super.willUpdate(t),!this._isInteracting&&t.has("stateObj")&&this._updateSliderValues()}_ctColorCursorMoved(t){const e=t.detail.value;this._isInteracting=void 0!==e,isNaN(e)||this._ctPickerValue===e||(this._ctPickerValue=e,this._throttleUpdateColorTemp())}_ctColorChanged(t){const e=t.detail.value;isNaN(e)||this._ctPickerValue===e||(this._ctPickerValue=e,this._updateColorTemp())}_updateColorTemp(){const t=this._ctPickerValue;this._applyColor({color_temp_kelvin:t})}_applyColor(t,e){(0,d.r)(this,"color-changed",t),this.hass.callService("light","turn_on",{entity_id:this.stateObj.entity_id,...t,...e})}static get styles(){return[a.AH`:host{display:flex;flex-direction:column}ha-control-slider{height:45vh;max-height:320px;min-height:200px;--control-slider-thickness:130px;--control-slider-border-radius:var(--ha-border-radius-6xl);--control-slider-color:var(--primary-color);--control-slider-background:-webkit-linear-gradient(
            top,
            var(--gradient)
          );--control-slider-tooltip-font-size:var(--ha-font-size-xl);--control-slider-background-opacity:1}`]}constructor(...t){super(...t),this._generateTemperatureGradient=(0,c.A)((t,e)=>f(t,e)),this._throttleUpdateColorTemp=(0,_.n)(()=>{this._updateColorTemp()},500)}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"stateObj",void 0),(0,o.Cg)([(0,n.wk)()],m.prototype,"_ctPickerValue",void 0),(0,o.Cg)([(0,n.wk)()],m.prototype,"_isInteracting",void 0),m=(0,o.Cg)([(0,n.EM)("light-color-temp-picker")],m),s()}catch(t){s(t)}})},15471(t,e,i){i.d(e,{X:()=>o});var s=i(1087);const o=(t,e)=>new Promise(o=>{const a=e.cancel,n=e.submit;(0,s.r)(t,"show-dialog",{dialogTag:"dialog-update-backup",dialogImport:()=>i.e(628).then(i.bind(i,94559)),dialogParams:{...e,cancel:()=>{o(null),a&&a()},submit:t=>{o(t),n&&n(t)}}})})},70565(t,e,i){i.d(e,{C_:()=>n,Sg:()=>c,_W:()=>r});i(74423);var s=i(71727),o=i(82286),a=i(43248);const n=36e5,r=t=>!!t&&("weather"===(0,s.m)(t.entity_id)&&((0,o.$)(t,a.Or.FORECAST_DAILY)||(0,o.$)(t,a.Or.FORECAST_TWICE_DAILY)||(0,o.$)(t,a.Or.FORECAST_HOURLY))),c=(t,e)=>{if(!t)return;const i=(0,a.V7)(t);return e&&i.includes(e)?e:(0,a.JM)(t)}},18696(t,e,i){i.a(t,async function(t,s){try{i.d(e,{Is:()=>_,KX:()=>v,kd:()=>p,qO:()=>g});i(44114);var o=i(74487),a=i(5124),n=i(89784),r=i(22786),c=i(69543),h=i(70565),l=t([o]);o=(l.then?(await l)():l)[0];const d=(0,r.A)(t=>new Intl.DateTimeFormat(t,{weekday:"narrow"})),u=(0,r.A)((t,e)=>new Intl.DateTimeFormat(t,{hour:"numeric",hourCycle:e?"h12":"h23"})),_=(t,e,i)=>{const s=d(i.language),o=[];for(let i=0;i<t.length;i+=e)o.push(s.format(new Date(t[i].datetime)));return a.qy` <div class="day-labels"> ${o.map(t=>a.qy`<div class="day-label">${t}</div>`)} </div> `},p=(t,e)=>{const i=u(e.language,(0,c.J)(e)),s=Date.now(),o=Math.floor((s+t*h.C_)/h.C_)*h.C_,n=Math.max(1,Math.round(t/4)),r=[];for(let e=0;e<=t;e+=n){const t=s+e*h.C_;if(t>o)break;r.push(i.format(new Date(t)))}return a.qy` <div class="hour-labels"> ${r.map(t=>a.qy`<div class="hour-label">${t}</div>`)} </div> `},g=(t,e)=>{const i=u(e.language,(0,c.J)(e)),s=Math.ceil(Date.now()/h.C_)*h.C_,o=Math.max(1,Math.round(t/4));return a.qy` <div class="hour-slot-labels" style="${(0,n.W)({"grid-template-columns":`repeat(${t}, 1fr)`})}"> ${Array.from({length:t},(t,e)=>{if(e%o!==0)return a.s6;const r=s+e*h.C_;return a.qy` <div class="hour-slot-label" style="${(0,n.W)({"grid-column":String(e+1)})}"> ${i.format(new Date(r))} </div> `})} </div> `},v=a.AH`.day-labels,.hour-labels,.hour-slot-labels{align-items:center;height:10px;color:var(--secondary-text-color);font-size:9px;line-height:1}.day-labels,.hour-labels{display:flex}.hour-labels{justify-content:space-between}.day-label{flex:1;text-align:center}.hour-slot-labels{display:grid}.hour-slot-label{text-align:center;min-width:0;white-space:nowrap}`;s()}catch(t){s(t)}})},22287(t,e,i){i.d(e,{U:()=>r,d:()=>c});var s=i(5124),o=i(82286),a=(i(48374),i(67094),i(88360)),n=i(53072);const r=(t,e,i,a,r)=>{if(!(i??1)||!(0,o.$)(e,n.vj.VOLUME_MUTE))return s.s6;const c=e.attributes.is_volume_muted;return s.qy` <ha-control-button class="mute" .label="${t.localize("ui.card.media_player."+(c?"media_volume_unmute":"media_volume_mute"))}" .disabled="${a}" @click="${r}"> <ha-svg-icon .path="${c?"M12,4L9.91,6.09L12,8.18M4.27,3L3,4.27L7.73,9H3V15H7L12,20V13.27L16.25,17.53C15.58,18.04 14.83,18.46 14,18.7V20.77C15.38,20.45 16.63,19.82 17.68,18.96L19.73,21L21,19.73L12,10.73M19,12C19,12.94 18.8,13.82 18.46,14.64L19.97,16.15C20.62,14.91 21,13.5 21,12C21,7.72 18,4.14 14,3.23V5.29C16.89,6.15 19,8.83 19,12M16.5,12C16.5,10.23 15.5,8.71 14,7.97V10.18L16.45,12.63C16.5,12.43 16.5,12.21 16.5,12Z":"M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z"}"></ha-svg-icon> </ha-control-button> `},c=(t,e,i,s)=>{t.stopPropagation(),(0,a.j)(s,"light"),e.callService("media_player","volume_mute",{entity_id:i.entity_id,is_volume_muted:!i.attributes.is_volume_muted})}},2706(t,e,i){i.d(e,{R:()=>d,U:()=>l});i(44114);var s=i(79468),o=i(63004);const a=["#249df2","#239dec","#239fec","#23a3eb","#23a6eb","#23a9e9","#22abe6","#22aee4","#22b1e0","#21b1dd","#23b6da","#28b8d6","#2abdd3","#2fbfcf","#34c4cc","#36c6c9","#43c9c0","#59c9b3","#6fc9a3","#82c992","#98c985","#a8c977","#b9c762","#c7c74d","#d1be31","#dbb921","#e6ba22","#ecc123","#ecba23","#eeb424","#ecaa23","#eca023","#ec9723","#ec8f23","#ec8523","#ec7c23","#ee7f24","#e67122","#df6321","#df5b21","#dd5421","#db4c21","#db4121","#db3721","#d62f20","#cc301f","#c22a1d","#ca2d1e","#c82c1d"],n=-6+a.length-1,r=a.map(t=>(0,s.xp)(t)),c=t=>{const e=Math.max(-6,Math.min(n,t))- -6,i=Math.floor(e),s=Math.min(i+1,r.length-1),o=e-i,a=r[i],c=r[s];return[a[0]+(c[0]-a[0])*o,a[1]+(c[1]-a[1])*o,a[2]+(c[2]-a[2])*o]},h=(t,e,i,o)=>{const a=[];for(let n=0;n<i;n++){const r=n/(i-1),h=e+r*(t-e);a.push({offset:r,color:(0,s.v2)(c(o(h)))})}return a},l=(t,e,i=5)=>h(t,e,i,t=>t),d=(t,e,i=5)=>{const s=(t+e)/2,a=(0,o.q)(.025*s-.15,.05,1);return h(t,e,i,t=>s+a*(t-s))}},32181(t,e,i){async function s(){return await i.e(47542).then(i.bind(i,53205)),document.createElement("hui-card-feature-more-info-hint-editor")}i.d(e,{C:()=>s})},7349(t,e,i){i.a(t,async function(t,s){try{i.d(e,{s:()=>x});i(74423),i(18111),i(22489),i(61701);var o=i(62826),a=i(5124),n=i(22441),r=i(6412),c=i(89784),h=i(22786),l=i(44537),d=i(71727),u=i(22542),_=i(47129),p=i(52658),g=(i(48374),i(28624),i(59174)),v=i(93367),b=(i(67094),i(57488)),y=i(88360),f=i(86030),m=i(49908),C=i(37531),w=t([g,v]);[g,v]=w.then?(await w)():w;const x=(t,e)=>!!(e.area_id?t.areas[e.area_id]:void 0);class $ extends a.WF{get _area(){if(this.hass&&this.context&&this.context.area_id)return this.hass.areas[this.context.area_id]}get _controls(){return this._config?.controls||[...C.Ut]}_normalizeControl(t){return"object"==typeof t&&"entity_id"in t?{type:"entity",value:t.entity_id}:C.Ut.includes(t)?{type:"domain",value:t}:{type:"entity",value:t}}static getStubConfig(){return{type:"area-controls"}}static async getConfigElement(){return await i.e(62800).then(i.bind(i,7027)),document.createElement("hui-area-controls-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_handleButtonTap(t){if(t.stopPropagation(),!this.hass||!this._config)return;const e=t.currentTarget.control;if("entity"===e.type){const t=this.hass.states[e.value];return void(t&&((0,y.j)(this,"light"),(0,u.F)(this.hass,[t])))}if(!this.context?.area_id)return;const i=this._domainControls(this._controls),s=this._controlEntities(i,this.context.area_id,this.context.exclude_entities,this.hass.entities,this.hass.devices,this.hass.areas)[e.value].map(t=>this.hass.states[t]).filter(t=>Boolean(t));(0,y.j)(this,"light"),(0,u.F)(this.hass,s)}render(){if(!(this._config&&this.hass&&this.context&&this._area&&x(this.hass,this.context)))return a.s6;const t=this._controls.map(t=>this._normalizeControl(t)),e=this._domainControls(this._controls),i=this._controlEntities(e,this.context.area_id,this.context.exclude_entities,this.hass.entities,this.hass.devices,this.hass.areas),s=t.filter(t=>"domain"===t.type?i[t.value].length>0:this.hass.states[t.value]&&!this.context?.exclude_entities?.includes(t.value)),o=this._config.controls?s:s.slice(0,4);return o.length?a.qy` <ha-control-button-group class="${(0,r.H)({"no-stretch":"inline"===this.position})}"> ${o.map(t=>{let e,s,o,n,r,h;if("domain"===t.type){const a=b.t[t.value],c=i[t.value].map(t=>this.hass.states[t]).filter(t=>Boolean(t)),h=(0,u.j)(c);e=!!c[0]&&(0,_.a)(c[0],h),s=this.hass.localize(`ui.card_features.area_controls.${t.value}.${e?"off":"on"}`),o=a.filter.domain,n=a.filter.device_class?(0,l.e)(a.filter.device_class)[0]:void 0,r=h}else{if("entity"!==t.type)return a.s6;if(h=this.hass.states[t.value],!h)return a.s6;e=(0,_.a)(h),s=this.hass.localize("ui.card.common.turn_"+(e?"off":"on")),o=(0,d.m)(h.entity_id),r=h.state}const g=(0,f.B)((0,p.ZK)(o,n,r,!0));return a.qy` <ha-control-button style="${(0,c.W)({"--active-color":g})}" .title="${s}" aria-label="${s}" class="${e?"active":""}" .control="${t}" @click="${this._handleButtonTap}"> ${"domain"===t.type?a.qy`<ha-domain-icon .domain="${o}" .deviceClass="${n}" .state="${r}"></ha-domain-icon>`:a.qy`<ha-state-icon .stateObj="${h}"></ha-state-icon>`} </ha-control-button> `})} </ha-control-button-group> `:a.s6}static get styles(){return[m.T,a.AH`:host{pointer-events:none!important;display:flex;flex-direction:row;justify-content:flex-end}ha-control-button-group{pointer-events:auto;width:100%}ha-control-button-group.no-stretch{width:auto;max-width:100%}ha-control-button-group.no-stretch>ha-control-button{width:48px}ha-control-button{--active-color:var(--state-active-color);--control-button-focus-color:var(--state-active-color)}ha-control-button.active{--control-button-background-color:var(--active-color);--control-button-icon-color:var(--active-color)}`]}constructor(...t){super(...t),this._domainControls=(0,h.A)(t=>t.map(t=>this._normalizeControl(t)).filter(t=>"domain"===t.type).map(t=>t.value)),this._controlEntities=(0,h.A)((t,e,i,s,o,a)=>(0,b.g)(t,e,i,this.hass))}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"context",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],$.prototype,"position",void 0),(0,o.Cg)([(0,n.wk)()],$.prototype,"_config",void 0),$=(0,o.Cg)([(0,n.EM)("hui-area-controls-card-feature")],$),s()}catch(t){s(t)}})},38098(t,e,i){i.a(t,async function(t,s){try{i.d(e,{N:()=>l});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(20058),h=t([c]);c=(h.then?(await h)():h)[0];const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"sensor"===(0,r.m)(i.entity_id)&&(0,c.ty)(i.attributes)};class d extends a.WF{static getStubConfig(){return{type:"bar-gauge"}}static async getConfigElement(){return await i.e(34667).then(i.bind(i,39046)),document.createElement("hui-bar-gauge-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this.context.entity_id&&this.hass.states[this.context.entity_id]&&l(this.hass,this.context)))return a.s6;const t=this.hass.states[this.context.entity_id],e=this._config.min??0,i=this._config.max??100,s=parseFloat(t.state);if(isNaN(s)||e>=i)return a.s6;const o=Math.max(0,Math.min(100,(s-e)/(i-e)*100));return a.qy`<div style="width:${o}%"></div> <div class="bar-gauge-background"></div>`}}d.styles=a.AH`:host{display:flex;width:100%;height:var(--feature-height);border-radius:var(--feature-border-radius);overflow:hidden;pointer-events:none!important}:host>div{height:100%;background-color:var(--feature-color);transition:width 180ms ease-in-out}.bar-gauge-background{flex:1;opacity:.2}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],d.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],d.prototype,"_config",void 0),d=(0,o.Cg)([(0,n.EM)("hui-bar-gauge-card-feature")],d),s()}catch(t){s(t)}})},89807(t,e,i){i.d(e,{l:()=>l});i(74423);var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=(i(48374),i(28624),i(84025)),c=i(42269),h=i(49908);const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;const s=(0,n.m)(i.entity_id);return["button","input_button","scene","script"].includes(s)};class d extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}_pressButton(){if(!this.hass||!this._stateObj)return;const t=(0,n.m)(this._stateObj.entity_id),e="button"===t||"input_button"===t?"press":"turn_on";if("script"===t){const t=this._stateObj.entity_id;if((0,r.GA)(this.hass,t)&&!(0,r.sW)(this.hass,t,this._config?.data))return void(0,c.p)(this,{entityId:t,data:this._config?.data})}const i={entity_id:this._stateObj.entity_id,...this._config?.data?{variables:this._config.data}:{}};this.hass.callService(t,e,i)}static getStubConfig(){return{type:"button"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){return this._config&&this.hass&&this.context&&this._stateObj&&l(this.hass,this.context)?o.qy` <ha-control-button-group> <ha-control-button .disabled="${"unavailable"===this._stateObj.state}" class="press-button" @click="${this._pressButton}"> ${this._config.action_name??this.hass.localize("ui.card.button.press")} </ha-control-button> </ha-control-button-group> `:o.s6}static async getConfigElement(){return await i.e(57218).then(i.bind(i,72281)),document.createElement("hui-button-card-feature-editor")}}d.styles=h.T,(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],d.prototype,"_config",void 0),d=(0,s.Cg)([(0,a.EM)("hui-button-card-feature")],d)},11865(t,e,i){i.a(t,async function(t,s){try{i.d(e,{f:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(38279),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12.5,2C17,2 17.11,5.57 14.75,6.75C13.76,7.24 13.32,8.29 13.13,9.22C13.61,9.42 14.03,9.73 14.35,10.13C18.05,8.13 22.03,8.92 22.03,12.5C22.03,17 18.46,17.1 17.28,14.73C16.78,13.74 15.72,13.3 14.79,13.11C14.59,13.59 14.28,14 13.88,14.34C15.87,18.03 15.08,22 11.5,22C7,22 6.91,18.42 9.27,17.24C10.25,16.75 10.69,15.71 10.89,14.79C10.4,14.59 9.97,14.27 9.65,13.87C5.96,15.85 2,15.07 2,11.5C2,7 5.56,6.89 6.74,9.26C7.24,10.25 8.29,10.68 9.22,10.87C9.41,10.39 9.73,9.97 10.14,9.65C8.15,5.96 8.94,2 12.5,2Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"climate"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.$2.FAN_MODE)};class _ extends h.n{get _configuredModes(){return this._config?.fan_modes}static getStubConfig(){return{type:"climate-fan-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(40852).then(i.bind(i,99743)),document.createElement("hui-climate-fan-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="fan_mode",this._modesAttribute="fan_modes",this._dropdownIconPath=d,this._serviceDomain="climate",this._serviceAction="set_fan_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-climate-fan-modes-card-feature")],_),s()}catch(t){s(t)}})},85032(t,e,i){i.a(t,async function(t,s){try{i.d(e,{E:()=>p});i(18111),i(61701);var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(52658),h=i(38279),l=i(98071),d=i(48555),u=t([d]);d=(u.then?(await u)():u)[0];const _="M16.95,16.95L14.83,14.83C15.55,14.1 16,13.1 16,12C16,11.26 15.79,10.57 15.43,10L17.6,7.81C18.5,9 19,10.43 19,12C19,13.93 18.22,15.68 16.95,16.95M12,5C13.57,5 15,5.5 16.19,6.4L14,8.56C13.43,8.21 12.74,8 12,8A4,4 0 0,0 8,12C8,13.1 8.45,14.1 9.17,14.83L7.05,16.95C5.78,15.68 5,13.93 5,12A7,7 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z",p=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"climate"===(0,r.m)(i.entity_id)};class g extends d.n{get _configuredModes(){return this._config?.hvac_modes}get _label(){return this.hass.localize("ui.card.climate.mode")}get _controlSelectStyle(){if(this._stateObj)return{"--control-select-color":(0,c.Se)(this._stateObj)}}static getStubConfig(){return{type:"climate-hvac-modes"}}static async getConfigElement(){return await i.e(48465).then(i.bind(i,16072)),document.createElement("hui-climate-hvac-modes-card-feature-editor")}_getValue(t){return t.state}_getOptions(){if(!this._stateObj||!this.hass)return[];const t=(this._stateObj.attributes.hvac_modes||[]).concat().sort(h.VV).reverse();return(0,l.P)(t,this._config?.hvac_modes).map(t=>({value:t,label:this.hass.formatEntityState(this._stateObj,t),iconPath:(0,h.on)(t)}))}_renderOptionIcon(t){return a.qy`<ha-svg-icon slot="graphic" .path="${t.iconPath}"></ha-svg-icon>`}_isSupported(){return!!(this.hass&&this.context&&p(this.hass,this.context))}constructor(...t){super(...t),this._attribute="hvac_mode",this._modesAttribute="hvac_modes",this._dropdownIconPath=_,this._serviceDomain="climate",this._serviceAction="set_hvac_mode",this._showDropdownOptionIcons=!1,this._defaultStyle="icons"}}g=(0,o.Cg)([(0,n.EM)("hui-climate-hvac-modes-card-feature")],g),s()}catch(t){s(t)}})},47547(t,e,i){i.a(t,async function(t,s){try{i.d(e,{p:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(38279),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"climate"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.$2.PRESET_MODE)};class _ extends h.n{get _configuredModes(){return this._config?.preset_modes}static getStubConfig(){return{type:"climate-preset-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(33862).then(i.bind(i,7205)),document.createElement("hui-climate-preset-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="preset_mode",this._modesAttribute="preset_modes",this._dropdownIconPath=d,this._serviceDomain="climate",this._serviceAction="set_preset_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-climate-preset-modes-card-feature")],_),s()}catch(t){s(t)}})},66102(t,e,i){i.a(t,async function(t,s){try{i.d(e,{S:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(38279),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M6 14H9L5 18L1 14H4C4 11.3 5.7 6.6 11 6.1V8.1C7.6 8.6 6 11.9 6 14M20 14C20 11.3 18.3 6.6 13 6.1V8.1C16.4 8.7 18 11.9 18 14H15L19 18L23 14H20Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"climate"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.$2.SWING_HORIZONTAL_MODE)};class _ extends h.n{get _configuredModes(){return this._config?.swing_horizontal_modes}static getStubConfig(){return{type:"climate-swing-horizontal-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(8260).then(i.bind(i,4623)),document.createElement("hui-climate-swing-horizontal-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="swing_horizontal_mode",this._modesAttribute="swing_horizontal_modes",this._dropdownIconPath=d,this._serviceDomain="climate",this._serviceAction="set_swing_horizontal_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-climate-swing-horizontal-modes-card-feature")],_),s()}catch(t){s(t)}})},89156(t,e,i){i.a(t,async function(t,s){try{i.d(e,{W:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(38279),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M6 14H9L5 18L1 14H4C4 11.3 5.7 6.6 11 6.1V8.1C7.6 8.6 6 11.9 6 14M20 14C20 11.3 18.3 6.6 13 6.1V8.1C16.4 8.7 18 11.9 18 14H15L19 18L23 14H20Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"climate"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.$2.SWING_MODE)};class _ extends h.n{get _configuredModes(){return this._config?.swing_modes}static getStubConfig(){return{type:"climate-swing-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(44621).then(i.bind(i,27420)),document.createElement("hui-climate-swing-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="swing_mode",this._modesAttribute="swing_modes",this._dropdownIconPath=d,this._serviceDomain="climate",this._serviceAction="set_swing_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-climate-swing-modes-card-feature")],_),s()}catch(t){s(t)}})},3453(t,e,i){i.d(e,{Q:()=>l});i(74423),i(18111),i(22489),i(61701);var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=(i(48374),i(28624),i(43958),i(22675)),c=i(49908),h=i(37531);const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"counter"===(0,n.m)(i.entity_id)},d={increment:t=>({translationKey:"increment",icon:"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",serviceName:"increment",disabled:parseInt(t.state)===t.attributes.maximum}),reset:()=>({translationKey:"reset",icon:"M13,3A9,9 0 0,0 4,12H1L4.89,15.89L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3Z",serviceName:"reset",disabled:!1}),decrement:t=>({translationKey:"decrement",icon:"M19,13H5V11H19V13Z",serviceName:"decrement",disabled:parseInt(t.state)===t.attributes.minimum})};class u extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static async getConfigElement(){return await i.e(13816).then(i.bind(i,42699)),document.createElement("hui-counter-actions-card-feature-editor")}static getStubConfig(){return{type:"counter-actions"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&l(this.hass,this.context)))return null;const t=this._config?.actions??h.HA;return o.qy` <ha-control-button-group> ${t.filter(t=>h.HA.includes(t)).map(t=>{const e=d[t](this._stateObj);return o.qy` <ha-control-button .entry="${e}" .label="${this.hass.localize(`ui.card.counter.actions.${e.translationKey}`)}" @click="${this._onActionTap}" .disabled="${e.disabled||this._stateObj?.state===r.Hh}"> <ha-svg-icon .path="${e.icon}"></ha-svg-icon> </ha-control-button> `})} </ha-control-button-group> `}_onActionTap(t){t.stopPropagation();const e=t.target.entry;this.hass.callService("counter",e.serviceName,{entity_id:this._stateObj.entity_id})}}u.styles=c.T,(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],u.prototype,"_config",void 0),u=(0,s.Cg)([(0,a.EM)("hui-counter-actions-card-feature")],u)},1248(t,e,i){i.a(t,async function(t,s){try{i.d(e,{H:()=>f});var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(78870),h=i(53610),l=i(71727),d=i(47129),u=i(52658),_=i(10223),p=i(98079),g=i(22675),v=i(88827),b=i(49908),y=t([_,h,v]);[_,h,v]=y.then?(await y)():y;const f=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"cover"===(0,l.m)(i.entity_id)&&(0,p.dx)(i)};class m extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"cover-position"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&f(this.hass,this.context)))return a.s6;const t=(0,d.a)(this._stateObj)?this._stateObj.attributes.current_position??0:0,e=Math.max(Math.round(t),0),i=(0,u.Se)(this._stateObj,"open"),s={"--feature-color":this.color?(0,c.MP)(this.color):(0,u.Se)(this._stateObj),"--state-cover-inactive-color":i};return a.qy` <ha-control-slider style="${(0,r.W)(s)}" .value="${e}" min="0" max="100" step="1" inverted show-handle @value-changed="${this._valueChanged}" .label="${(0,h.computeAttributeNameDisplay)(this.hass.localize,this._stateObj,this.hass.entities,"current_position")}" .disabled="${this._stateObj.state===g.Hh}" .unit="${v.rM.cover.current_position}" .locale="${this.hass.locale}"></ha-control-slider> `}_valueChanged(t){const{value:e}=t.detail;"number"!=typeof e||isNaN(e)||this.hass.callService("cover","set_cover_position",{entity_id:this._stateObj.entity_id,position:e})}static get styles(){return b.T}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"context",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"color",void 0),(0,o.Cg)([(0,n.wk)()],m.prototype,"_config",void 0),m=(0,o.Cg)([(0,n.EM)("hui-cover-position-card-feature")],m),s()}catch(t){s(t)}})},31095(t,e,i){i.d(e,{B:()=>l});var s=i(62826),o=i(22441),a=i(98079),n=i(84337),r=i(55719),c=i(32181);const h={domain:"cover",supportsPosition:a.dx,getFavoritePositions:t=>t?.options?.cover?.favorite_positions,getCurrentValue:t=>t.attributes.current_position,normalizeFavoritePositions:n.S,defaultFavoritePositions:a.Et,setPositionService:"set_cover_position",serviceDataKey:"position",setPositionLabelKey:"ui.dialogs.more_info_control.cover.favorite_position.set",featureLabelKey:"ui.panel.lovelace.editor.features.types.cover-position-favorite.label"},l=(t,e)=>(0,r.s)(t,e,h);class d extends r.N{get _definition(){return h}static getStubConfig(){return{type:"cover-position-favorite"}}}d.getConfigElement=c.C,d=(0,s.Cg)([(0,o.EM)("hui-cover-position-favorite-card-feature")],d)},19300(t,e,i){i.d(e,{l:()=>l});var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=i(82286),c=(i(48374),i(28624),i(67094),i(98079)),h=i(49908);const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"cover"===(0,n.m)(i.entity_id)&&((0,r.$)(i,c.Jp.OPEN_TILT)||(0,r.$)(i,c.Jp.CLOSE_TILT))};class d extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"cover-tilt"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_onOpenTap(t){t.stopPropagation(),this.hass.callService("cover","open_cover_tilt",{entity_id:this._stateObj.entity_id})}_onCloseTap(t){t.stopPropagation(),this.hass.callService("cover","close_cover_tilt",{entity_id:this._stateObj.entity_id})}_onStopTap(t){t.stopPropagation(),this.hass.callService("cover","stop_cover_tilt",{entity_id:this._stateObj.entity_id})}render(){return this._config&&this.hass&&this.context&&this._stateObj&&l(this.hass,this.context)?o.qy` <ha-control-button-group> ${(0,r.$)(this._stateObj,c.Jp.OPEN_TILT)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.cover.open_tilt_cover")}" @click="${this._onOpenTap}" .disabled="${!(0,c.uB)(this._stateObj)}"> <ha-svg-icon .path="${"M5,17.59L15.59,7H9V5H19V15H17V8.41L6.41,19L5,17.59Z"}"></ha-svg-icon> </ha-control-button> `:o.s6} ${(0,r.$)(this._stateObj,c.Jp.STOP_TILT)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.cover.stop_cover")}" @click="${this._onStopTap}" .disabled="${!(0,c.UE)(this._stateObj)}"> <ha-svg-icon .path="${"M18,18H6V6H18V18Z"}"></ha-svg-icon> </ha-control-button> `:o.s6} ${(0,r.$)(this._stateObj,c.Jp.CLOSE_TILT)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.cover.close_tilt_cover")}" @click="${this._onCloseTap}" .disabled="${!(0,c.Yx)(this._stateObj)}"> <ha-svg-icon .path="${"M19,6.41L17.59,5L7,15.59V9H5V19H15V17H8.41L19,6.41Z"}"></ha-svg-icon> </ha-control-button> `:o.s6} </ha-control-button-group> `:o.s6}static get styles(){return h.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],d.prototype,"_config",void 0),d=(0,s.Cg)([(0,a.EM)("hui-cover-tilt-card-feature")],d)},57251(t,e,i){i.d(e,{x:()=>l});var s=i(62826),o=i(22441),a=i(98079),n=i(84337),r=i(55719),c=i(32181);const h={domain:"cover",supportsPosition:a.Av,getFavoritePositions:t=>t?.options?.cover?.favorite_tilt_positions,getCurrentValue:t=>t.attributes.current_tilt_position,normalizeFavoritePositions:n.S,defaultFavoritePositions:a.Et,setPositionService:"set_cover_tilt_position",serviceDataKey:"tilt_position",setPositionLabelKey:"ui.dialogs.more_info_control.cover.favorite_tilt_position.set",featureLabelKey:"ui.panel.lovelace.editor.features.types.cover-tilt-favorite.label"},l=(t,e)=>(0,r.s)(t,e,h);class d extends r.N{get _definition(){return h}static getStubConfig(){return{type:"cover-tilt-favorite"}}}d.getConfigElement=c.C,d=(0,s.Cg)([(0,o.EM)("hui-cover-tilt-favorite-card-feature")],d)},35598(t,e,i){i.a(t,async function(t,s){try{i.d(e,{C:()=>f});var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(78870),h=i(53610),l=i(71727),d=i(52658),u=i(98079),_=i(22675),p=i(88827),g=i(20380),v=i(49908),b=t([g,h,p]);[g,h,p]=b.then?(await b)():b;const y=(0,g.X)(),f=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"cover"===(0,l.m)(i.entity_id)&&(0,u.Av)(i)};class m extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"cover-tilt-position"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&f(this.hass,this.context)))return a.s6;const t=this._stateObj.attributes.current_tilt_position??0,e=Math.max(Math.round(t),0),i=(0,d.Se)(this._stateObj,"open"),s={"--feature-color":this.color?(0,c.MP)(this.color):(0,d.Se)(this._stateObj),"--state-cover-inactive-color":i};return a.qy` <ha-control-slider style="${(0,r.W)(s)}" .value="${e}" min="0" max="100" mode="cursor" inverted @value-changed="${this._valueChanged}" .label="${(0,h.computeAttributeNameDisplay)(this.hass.localize,this._stateObj,this.hass.entities,"current_tilt_position")}" .disabled="${this._stateObj.state===_.Hh}" .unit="${p.rM.cover.current_tilt_position}" .locale="${this.hass.locale}"> <div slot="background" class="gradient"></div></ha-control-slider> `}_valueChanged(t){const{value:e}=t.detail;"number"!=typeof e||isNaN(e)||this.hass.callService("cover","set_cover_tilt_position",{entity_id:this._stateObj.entity_id,tilt_position:e})}static get styles(){return[v.T,a.AH`.gradient{background:-webkit-linear-gradient(left,${y});opacity:.6}`]}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"context",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],m.prototype,"color",void 0),(0,o.Cg)([(0,n.wk)()],m.prototype,"_config",void 0),m=(0,o.Cg)([(0,n.EM)("hui-cover-tilt-position-card-feature")],m),s()}catch(t){s(t)}})},58500(t,e,i){i.a(t,async function(t,s){try{i.d(e,{Z:()=>p});i(74423);var o=i(62826),a=i(5124),n=i(22441),r=i(380),c=i(1087),h=i(71727),l=(i(48374),i(28624),i(10223)),d=i(49908),u=t([l]);l=(u.then?(await u)():u)[0];const _=()=>Promise.all([i.e(80827),i.e(17481)]).then(i.bind(i,64080)),p=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;const s=(0,h.m)(i.entity_id);return"input_datetime"===s&&i.attributes.has_date||["datetime","date"].includes(s)};class g extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]??void 0}_pressButton(t){this.hass&&this._stateObj&&(0,c.r)(this,"show-dialog",{dialogTag:"ha-dialog-date-picker",dialogImport:_,dialogAnchor:t.currentTarget,dialogParams:{min:"1970-01-01",value:this._stateObj.state,onChange:t=>this._dateChanged(t),locale:this.hass.locale.language,firstWeekday:(0,r.P)(this.hass.locale)}})}_dateChanged(t){if(!this.hass||!this._stateObj||!t)return;const e=(0,h.m)(this._stateObj.entity_id),i="input_datetime"===e?"set_datetime":"set_value";if("datetime"===e){const s=new Date(this._stateObj.state),o=new Date(`${t}T00:00:00`);s.setFullYear(o.getFullYear(),o.getMonth(),o.getDate()),this.hass.callService(e,i,{entity_id:this._stateObj.entity_id,datetime:s.toISOString()})}else this.hass.callService(e,i,{entity_id:this._stateObj.entity_id,date:t})}static getStubConfig(){return{type:"date-set"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){return this._config&&this.hass&&this.context&&this._stateObj&&p(this.hass,this.context)?a.qy` <ha-control-button-group> <ha-control-button .disabled="${["unavailable","unknown"].includes(this._stateObj.state)}" class="press-button" @click="${this._pressButton}"> ${this.hass.localize("ui.card.date.set_date")} </ha-control-button> </ha-control-button-group> `:a.s6}}g.styles=d.T,(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"context",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"color",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),g=(0,o.Cg)([(0,n.EM)("hui-date-set-card-feature")],g),s()}catch(t){s(t)}})},44772(t,e,i){i.a(t,async function(t,s){try{i.d(e,{n:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(84097),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d=["forward","reverse"],u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"fan"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.ZS.DIRECTION)};class _ extends h.n{static getStubConfig(){return{type:"fan-direction"}}_getOptions(){return this.hass?d.map(t=>({value:t,label:this.hass.localize(`ui.card.fan.${t}`)})):[]}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="direction",this._modesAttribute="direction",this._serviceDomain="fan",this._serviceAction="set_direction",this._defaultStyle="icons"}}_=(0,o.Cg)([(0,a.EM)("hui-fan-direction-card-feature")],_),s()}catch(t){s(t)}})},44577(t,e,i){i.d(e,{G:()=>_});var s=i(62826),o=i(5124),a=i(22441),n=i(89784),r=i(71727),c=i(52658),h=i(82286),l=(i(43958),i(22675)),d=i(84097),u=i(49908);const _=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"fan"===(0,r.m)(i.entity_id)&&(0,h.$)(i,d.ZS.OSCILLATE)};class p extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"fan-oscillate"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if((t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass"),i=e?.states[this.context.entity_id];i!==this._stateObj&&(this._oscillate=this._stateObj.attributes.oscillating)}}async _valueChanged(t){const e="yes"===t.detail.value;if(e===this._stateObj.attributes.oscillating)return;const i=this._stateObj.attributes.oscillating;this._oscillate=e;try{await this._updateOscillate(e)}catch(t){this._oscillate=i}}async _updateOscillate(t){await this.hass.callService("fan","oscillate",{entity_id:this._stateObj.entity_id,oscillating:t})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&_(this.hass,this.context)))return null;const t=(0,c.Se)(this._stateObj),e=["no","yes"].map(t=>({value:t,label:this.hass.localize(`ui.common.${t}`),path:"yes"===t?"M6 14H9L5 18L1 14H4C4 11.3 5.7 6.6 11 6.1V8.1C7.6 8.6 6 11.9 6 14M20 14C20 11.3 18.3 6.6 13 6.1V8.1C16.4 8.7 18 11.9 18 14H15L19 18L23 14H20Z":"M13 8.1V6.1C18.3 6.6 20 11.4 20 14H23L20.1 16.9L17.2 14H18C18 11.9 16.4 8.6 13 8.1M7.8 7.1L2.4 1.7L1.1 3L6.3 8.2C4.7 10 4 12.4 4 14H1L5 18L9 14H6C6 12.7 6.6 11 7.9 9.7L20.9 22.7L22.2 21.4L9.3 8.7L7.8 7.1M11 6.1L9.5 6.4L11 7.8V6.1Z"}));return o.qy` <ha-control-select .options="${e}" .value="${this._oscillate?"yes":"no"}" @value-changed="${this._valueChanged}" hide-option-label .label="${this.hass.localize("ui.card.fan.oscillate")}" style="${(0,n.W)({"--control-select-color":t})}" .disabled="${this._stateObj.state===l.Hh}"> </ha-control-select> `}static get styles(){return u.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_config",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_oscillate",void 0),p=(0,s.Cg)([(0,a.EM)("hui-fan-oscillate-card-feature")],p)},5817(t,e,i){i.a(t,async function(t,s){try{i.d(e,{r:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(84097),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"fan"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.ZS.PRESET_MODE)};class _ extends h.n{get _configuredModes(){return this._config?.preset_modes}static getStubConfig(){return{type:"fan-preset-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(20196).then(i.bind(i,97999)),document.createElement("hui-fan-preset-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="preset_mode",this._modesAttribute="preset_modes",this._dropdownIconPath=d,this._serviceDomain="fan",this._serviceAction="set_preset_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-fan-preset-modes-card-feature")],_),s()}catch(t){s(t)}})},13028(t,e,i){i.a(t,async function(t,s){try{i.d(e,{J:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(84610),h=i(48555),l=t([h]);h=(l.then?(await l)():l)[0];const d="M8 13C6.14 13 4.59 14.28 4.14 16H2V18H4.14C4.59 19.72 6.14 21 8 21S11.41 19.72 11.86 18H22V16H11.86C11.41 14.28 9.86 13 8 13M8 19C6.9 19 6 18.1 6 17C6 15.9 6.9 15 8 15S10 15.9 10 17C10 18.1 9.1 19 8 19M19.86 6C19.41 4.28 17.86 3 16 3S12.59 4.28 12.14 6H2V8H12.14C12.59 9.72 14.14 11 16 11S19.41 9.72 19.86 8H22V6H19.86M16 9C14.9 9 14 8.1 14 7C14 5.9 14.9 5 16 5S18 5.9 18 7C18 8.1 17.1 9 16 9Z",u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"humidifier"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.ye.MODES)};class _ extends h.n{get _configuredModes(){return this._config?.modes}static getStubConfig(){return{type:"humidifier-modes",style:"dropdown"}}static async getConfigElement(){return await i.e(22893).then(i.bind(i,89148)),document.createElement("hui-humidifier-modes-card-feature-editor")}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="mode",this._modesAttribute="available_modes",this._dropdownIconPath=d,this._serviceDomain="humidifier",this._serviceAction="set_mode"}}_=(0,o.Cg)([(0,a.EM)("hui-humidifier-modes-card-feature")],_),s()}catch(t){s(t)}})},30277(t,e,i){i.d(e,{R:()=>d});var s=i(62826),o=i(5124),a=i(22441),n=i(89784),r=i(71727),c=i(52658),h=(i(43958),i(22675)),l=i(49908);const d=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"humidifier"===(0,r.m)(i.entity_id)};class u extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"humidifier-toggle"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if(super.willUpdate(t),(t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass"),i=e?.states[this.context.entity_id];i!==this._stateObj&&(this._currentState=this._stateObj.state)}}async _valueChanged(t){const e=t.detail.value;if(e===this._stateObj.state)return;const i=this._stateObj.state;this._currentState=e;try{await this._setState(e)}catch(t){this._currentState=i}}async _setState(t){await this.hass.callService("humidifier","on"===t?"turn_on":"turn_off",{entity_id:this._stateObj.entity_id})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&d(this.hass,this.context)))return null;const t=(0,c.Se)(this._stateObj),e=["off","on"].map(t=>({value:t,label:this.hass.formatEntityState(this._stateObj,t),path:"on"===t?"M12,3.25C12,3.25 6,10 6,14C6,17.32 8.69,20 12,20A6,6 0 0,0 18,14C18,10 12,3.25 12,3.25M14.47,9.97L15.53,11.03L9.53,17.03L8.47,15.97M9.75,10A1.25,1.25 0 0,1 11,11.25A1.25,1.25 0 0,1 9.75,12.5A1.25,1.25 0 0,1 8.5,11.25A1.25,1.25 0 0,1 9.75,10M14.25,14.5A1.25,1.25 0 0,1 15.5,15.75A1.25,1.25 0 0,1 14.25,17A1.25,1.25 0 0,1 13,15.75A1.25,1.25 0 0,1 14.25,14.5Z":"M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13"}));return o.qy` <ha-control-select .options="${e}" .value="${this._currentState}" @value-changed="${this._valueChanged}" hide-option-label .label="${this.hass.localize("ui.card.humidifier.state")}" style="${(0,n.W)({"--control-select-color":t})}" .disabled="${this._stateObj.state===h.Hh}"> </ha-control-select> `}static get styles(){return l.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],u.prototype,"_config",void 0),(0,s.Cg)([(0,a.wk)()],u.prototype,"_currentState",void 0),u=(0,s.Cg)([(0,a.EM)("hui-humidifier-toggle-card-feature")],u)},38409(t,e,i){i.d(e,{ED:()=>g,Gw:()=>_});i(18111),i(22489),i(61701),i(13579);var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=i(82286),c=(i(48374),i(28624),i(67094),i(22675)),h=i(22865),l=i(49908),d=i(37531);const u={start_pause:[h.mB.PAUSE,h.mB.START_MOWING],dock:[h.mB.DOCK]},_=(t,e)=>u[e].some(e=>(0,r.$)(t,e)),p={start_pause:t=>"mowing"===t.state&&(0,r.$)(t,h.mB.PAUSE)?{translationKey:"pause",icon:"M14,19H18V5H14M6,19H10V5H6V19Z",serviceName:"pause"}:{translationKey:"start",icon:"M8,5.14V19.14L19,12.14L8,5.14Z",serviceName:"start_mowing"},dock:t=>({translationKey:"dock",icon:"M15 13L11 17V14H2V12H11V9L15 13M5 20V16H7V18H17V10.19L12 5.69L7.21 10H4.22L12 3L22 12H19V20H5Z",serviceName:"dock",disabled:!(0,h.gK)(t)})},g=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"lawn_mower"===(0,n.m)(i.entity_id)&&d.Ry.some(t=>_(i,t))};class v extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"lawn-mower-commands"}}static async getConfigElement(){return await i.e(88532).then(i.bind(i,22303)),document.createElement("hui-lawn-mower-commands-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_onCommandTap(t){t.stopPropagation();const e=t.target.entry;this.hass.callService("lawn_mower",e.serviceName,{entity_id:this._stateObj.entity_id})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&g(this.hass,this.context)))return o.s6;const t=this._stateObj,e=this._config.commands??d.Ry;return o.qy` <ha-control-button-group> ${e.filter(e=>_(t,e)).map(e=>{const i=p[e](t);return o.qy` <ha-control-button .entry="${i}" .label="${this.hass.localize(`ui.dialogs.more_info_control.lawn_mower.${i.translationKey}`)}" @click="${this._onCommandTap}" .disabled="${i.disabled||t.state===c.Hh}"> <ha-svg-icon .path="${i.icon}"></ha-svg-icon> </ha-control-button> `})} </ha-control-button-group> `}static get styles(){return l.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],v.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],v.prototype,"_config",void 0),v=(0,s.Cg)([(0,a.EM)("hui-lawn-mower-commands-card-feature")],v)},74049(t,e,i){i.d(e,{F:()=>p});i(18111),i(20116),i(61701);var s=i(62826),o=i(88696),a=i(5124),n=i(22441),r=i(71727),c=i(22675),h=i(57264),l=i(49908),d=i(59241),u=(i(1966),i(19037)),_=i(32181);const p=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"light"===(0,r.m)(i.entity_id)&&(0,h.n6)(i)};class g extends a.WF{connectedCallback(){super.connectedCallback(),this._subscribeEntityEntry()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEntityRegistry()}_unsubscribeEntityRegistry(){this._unsubEntityRegistry&&(this._unsubEntityRegistry(),this._unsubEntityRegistry=void 0)}_subscribeEntityEntry(){if(this.hass&&this.context?.entity_id){const t=this.context.entity_id;try{this._unsubEntityRegistry=(0,d.Bz)(this.hass.connection,e=>{const i=e.find(e=>e.entity_id===t);i&&(this._entry=i)})}catch(t){this._entry=null}}}get _maxVisible(){return this._resizeController.value??0}get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}updated(t){t.has("context")&&(this._unsubscribeEntityRegistry(),this._subscribeEntityEntry()),t.has("_entry")&&(this._entry?.options?.light?.favorite_colors?this._favoriteColors=this._entry.options.light.favorite_colors:this._entry&&this._stateObj?this._favoriteColors=(0,h.F9)(this._stateObj):this._favoriteColors=[])}static getStubConfig(){return{type:"light-color-favorites"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&p(this.hass,this.context)))return a.s6;const t=this._favoriteColors.slice(0,this._maxVisible);return a.qy` <div class="container"> ${t.map((t,e)=>a.qy` <ha-favorite-color-button .label="${this.hass.localize("ui.dialogs.more_info_control.light.favorite_color.set",{number:e})}" .disabled="${this._stateObj.state===c.Hh}" .color="${t}" .index="${e}" .actionHandler="${(0,u.T)({disabled:this._stateObj.state===c.Hh})}" @action="${this._handleColorAction}"> </ha-favorite-color-button> `)} </div> `}_handleColorAction(t){t.stopPropagation();const e=t.target.index,i=this._favoriteColors[e];this.hass.callService("light","turn_on",{entity_id:this._stateObj.entity_id,...i})}static get styles(){return[l.T,a.AH`:host{display:block;--min-width:${(0,a.iz)(32)}px;--gap:${(0,a.iz)(8)}px}.container{position:relative;display:flex;user-select:none;flex-wrap:nowrap;align-items:center;gap:var(--gap);height:var(--feature-height)}ha-favorite-color-button{--ha-favorite-color-button-border-radius:var(--feature-border-radius);height:100%;min-width:var(--min-width);width:100%;flex:1 1 var(--min-width)}`]}constructor(...t){super(...t),this._favoriteColors=[],this._resizeController=new o.P(this,{callback:t=>{const e=t[0]?.contentRect.width;return e?Math.floor((e+8)/40):0}})}}g.getConfigElement=_.C,(0,s.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"context",void 0),(0,s.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),(0,s.Cg)([(0,n.wk)()],g.prototype,"_entry",void 0),(0,s.Cg)([(0,n.wk)()],g.prototype,"_favoriteColors",void 0),g=(0,s.Cg)([(0,n.EM)("hui-light-color-favorites-card-feature")],g)},67142(t,e,i){i.a(t,async function(t,s){try{i.d(e,{a:()=>y});var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(22786),h=(i(16629),i(71727)),l=i(47129),d=i(10223),u=i(22675),_=i(88827),p=i(57264),g=i(68737),v=i(49908),b=t([d,_,g]);[d,_,g]=b.then?(await b)():b;const y=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"light"===(0,h.m)(i.entity_id)&&(0,p.ti)(i,p.NC.COLOR_TEMP)};class f extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"light-color-temp"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&y(this.hass,this.context)))return a.s6;const t=null!=this._stateObj.attributes.color_temp_kelvin?this._stateObj.attributes.color_temp_kelvin:void 0,e=this._stateObj.attributes.min_color_temp_kelvin??2700,i=this._stateObj.attributes.max_color_temp_kelvin??6500,s=this._generateTemperatureGradient(e,i);return a.qy` <ha-control-slider .value="${t}" mode="cursor" .showHandle="${(0,l.a)(this._stateObj)}" .disabled="${this._stateObj.state===u.Hh}" @value-changed="${this._valueChanged}" .label="${this.hass.localize("ui.card.light.color_temperature")}" .min="${e}" .max="${i}" style="${(0,r.W)({"--gradient":s})}" .unit="${_.rM.light.color_temp_kelvin}" .locale="${this.hass.locale}"></ha-control-slider> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;this.hass.callService("light","turn_on",{entity_id:this._stateObj.entity_id,color_temp_kelvin:e})}static get styles(){return[v.T,a.AH`ha-control-slider{--control-slider-background:-webkit-linear-gradient(
            left,
            var(--gradient)
          );--control-slider-background-opacity:1}`]}constructor(...t){super(...t),this._generateTemperatureGradient=(0,c.A)((t,e)=>(0,g.J)(t,e))}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_config",void 0),f=(0,o.Cg)([(0,n.EM)("hui-light-color-temp-card-feature")],f),s()}catch(t){s(t)}})},14312(t,e,i){i.d(e,{o:()=>l});var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=i(82286),c=(i(48374),i(28624),i(55881)),h=i(49908);const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"lock"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.Z0.OPEN)};class d extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"lock-open-door"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_setButtonState(t,e){clearTimeout(this._buttonTimeout),this._buttonState=t,e&&(this._buttonTimeout=window.setTimeout(()=>{this._buttonState="normal"},1e3*e))}async _open(){"confirm"===this._buttonState?this.hass&&this._stateObj&&((0,c.hW)(this,this.hass,this._stateObj,"open"),this._setButtonState("done",2)):this._setButtonState("confirm",5)}render(){return this._config&&this.hass&&this.context&&this._stateObj&&l(this.hass,this.context)?o.qy` ${"done"===this._buttonState?o.qy` <p class="open-done"> <ha-svg-icon path="${"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}"></ha-svg-icon> ${this.hass.localize("ui.card.lock.open_door_done")} </p> `:o.qy` <ha-control-button-group> <ha-control-button .disabled="${!(0,c.pc)(this._stateObj)}" class="open-button ${this._buttonState}" @click="${this._open}"> ${"confirm"===this._buttonState?this.hass.localize("ui.card.lock.open_door_confirm"):this.hass.localize("ui.card.lock.open_door")} </ha-control-button> </ha-control-button-group> `} `:o.s6}static get styles(){return[h.T,o.AH`ha-control-button{font-size:var(--ha-font-size-m)}.open-button{width:130px}.open-button.confirm{--control-button-background-color:var(--warning-color)}.open-done{font-size:var(--ha-font-size-m);line-height:14px;display:flex;align-items:center;justify-content:center;flex-direction:row;gap:var(--ha-space-2);font-weight:var(--ha-font-weight-medium);color:var(--success-color);margin:0 12px 12px 12px;height:40px;text-align:center}`]}constructor(...t){super(...t),this._buttonState="normal"}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],d.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],d.prototype,"_buttonState",void 0),(0,s.Cg)([(0,a.wk)()],d.prototype,"_config",void 0),d=(0,s.Cg)([(0,a.EM)("hui-lock-open-door-card-feature")],d)},29175(t,e,i){i.d(e,{L:()=>b,U:()=>v});i(44114),i(18111),i(22489),i(61701),i(13579);var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=i(47129),c=i(82286),h=(i(48374),i(28624),i(22675)),l=i(53072),d=i(784),u=i(49908),_=i(37531);const p="M13,3H11V13H13V3M17.83,5.17L16.41,6.59C18.05,7.91 19,9.9 19,12A7,7 0 0,1 12,19C8.14,19 5,15.88 5,12C5,9.91 5.95,7.91 7.58,6.58L6.17,5.17C2.38,8.39 1.92,14.07 5.14,17.86C8.36,21.64 14.04,22.1 17.83,18.88C19.85,17.17 21,14.65 21,12C21,9.37 19.84,6.87 17.83,5.17Z",g={turn_on:[l.vj.TURN_ON],turn_off:[l.vj.TURN_OFF],media_play:[l.vj.PLAY],media_pause:[l.vj.PAUSE],media_play_pause:[l.vj.PLAY,l.vj.PAUSE],media_stop:[l.vj.STOP],media_previous_track:[l.vj.PREVIOUS_TRACK],media_next_track:[l.vj.NEXT_TRACK],volume_down:[l.vj.VOLUME_STEP],volume_up:[l.vj.VOLUME_STEP],volume_mute:[l.vj.VOLUME_MUTE],shuffle:[l.vj.SHUFFLE_SET],repeat:[l.vj.REPEAT_SET]},v=(t,e)=>g[e].some(e=>(0,c.$)(t,e)),b=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"media_player"===(0,n.m)(i.entity_id)};class y extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}get _controls(){return this._config?.controls?.length?this._config.controls:[..._.mJ]}static getStubConfig(){return{type:"media-player-playback"}}static async getConfigElement(){return await i.e(1834).then(i.bind(i,93073)),document.createElement("hui-media-player-playback-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(){this.hasUpdated||this._measureCard()}shouldUpdate(t){const e=t.get("hass"),i=this.context?.entity_id;return(0,d.xP)(this,t)||t.has("hass")&&(!e||!i||e.states[i]!==this.hass.states[i])}render(){if(!(this._config&&this.hass&&this.context&&b(this.hass,this.context)&&this._stateObj))return o.s6;const t=this._computeButtons(this._stateObj);return o.qy` <ha-control-button-group> ${t.map(t=>o.qy` <ha-control-button key="${t.action}" .label="${this.hass?.localize(`ui.card.media_player.${t.action}`)}" @click="${this._action}"> <ha-svg-icon .path="${t.icon}"></ha-svg-icon> </ha-control-button> `)} </ha-control-button-group> `}_measureCard(){if(!this.isConnected)return;const t=this.getRootNode().host,e=t?.clientWidth??this.clientWidth??0;this._narrow=e<200}_computeButtons(t){return this._config?.controls?.length?this._filterNarrow(this._computeExplicitButtons(t)):this._filterNarrow((0,l.Un)(t)??[])}_computeExplicitButtons(t){const e=(0,r.a)(t),i=!0===t.attributes.assumed_state,s=[];for(const o of this._controls)switch(o){case"turn_off":(e||i)&&(0,c.$)(t,l.vj.TURN_OFF)&&s.push({icon:i?"M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z":p,action:"turn_off"});break;case"turn_on":e&&!i||t.state===h.Hh||!(0,c.$)(t,l.vj.TURN_ON)||s.push({icon:i?"M11,3H13V21H11V3Z":p,action:"turn_on"});break;case"media_play":(0,c.$)(t,l.vj.PLAY)&&s.push({icon:"M8,5.14V19.14L19,12.14L8,5.14Z",action:"media_play"});break;case"media_pause":(0,c.$)(t,l.vj.PAUSE)&&s.push({icon:"M14,19H18V5H14M6,19H10V5H6V19Z",action:"media_pause"});break;case"media_play_pause":((0,c.$)(t,l.vj.PLAY)||(0,c.$)(t,l.vj.PAUSE))&&s.push({icon:"M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5",action:"media_play_pause"});break;case"media_stop":(0,c.$)(t,l.vj.STOP)&&s.push({icon:"M18,18H6V6H18V18Z",action:"media_stop"});break;case"media_previous_track":(0,c.$)(t,l.vj.PREVIOUS_TRACK)&&s.push({icon:"M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z",action:"media_previous_track"});break;case"media_next_track":(0,c.$)(t,l.vj.NEXT_TRACK)&&s.push({icon:"M16,18H18V6H16M6,18L14.5,12L6,6V18Z",action:"media_next_track"});break;case"volume_down":(0,c.$)(t,l.vj.VOLUME_STEP)&&s.push({icon:"M3,9H7L12,4V20L7,15H3V9M14,11H22V13H14V11Z",action:"volume_down"});break;case"volume_up":(0,c.$)(t,l.vj.VOLUME_STEP)&&s.push({icon:"M3,9H7L12,4V20L7,15H3V9M14,11H17V8H19V11H22V13H19V16H17V13H14V11Z",action:"volume_up"});break;case"volume_mute":(0,c.$)(t,l.vj.VOLUME_MUTE)&&s.push({icon:t.attributes.is_volume_muted?"M12,4L9.91,6.09L12,8.18M4.27,3L3,4.27L7.73,9H3V15H7L12,20V13.27L16.25,17.53C15.58,18.04 14.83,18.46 14,18.7V20.77C15.38,20.45 16.63,19.82 17.68,18.96L19.73,21L21,19.73L12,10.73M19,12C19,12.94 18.8,13.82 18.46,14.64L19.97,16.15C20.62,14.91 21,13.5 21,12C21,7.72 18,4.14 14,3.23V5.29C16.89,6.15 19,8.83 19,12M16.5,12C16.5,10.23 15.5,8.71 14,7.97V10.18L16.45,12.63C16.5,12.43 16.5,12.21 16.5,12Z":"M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z",action:"volume_mute"});break;case"shuffle":(0,c.$)(t,l.vj.SHUFFLE_SET)&&s.push({icon:!0===t.attributes.shuffle?"M14.83,13.41L13.42,14.82L16.55,17.95L14.5,20H20V14.5L17.96,16.54L14.83,13.41M14.5,4L16.54,6.04L4,18.59L5.41,20L17.96,7.46L20,9.5V4M10.59,9.17L5.41,4L4,5.41L9.17,10.58L10.59,9.17Z":"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",action:"shuffle"});break;case"repeat":(0,c.$)(t,l.vj.REPEAT_SET)&&s.push({icon:"all"===t.attributes.repeat?"M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"one"===t.attributes.repeat?"M13,15V9H12L10,10V11H11.5V15M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"M2,5.27L3.28,4L20,20.72L18.73,22L15.73,19H7V22L3,18L7,14V17H13.73L7,10.27V11H5V8.27L2,5.27M17,13H19V17.18L17,15.18V13M17,5V2L21,6L17,10V7H8.82L6.82,5H17Z",action:"repeat"})}return s}_filterNarrow(t){return this._narrow&&t.length>3?t.filter(t=>"media_previous_track"!==t.action&&"media_next_track"!==t.action):t}_action(t){if(!this._stateObj)return;const e=t.currentTarget.getAttribute("key");if(e){if("media_play_pause"===e){const t="playing"!==this._stateObj.state?"media_play":(0,c.$)(this._stateObj,l.vj.PAUSE)?"media_pause":"media_stop";return void this.hass.callService("media_player",t,{entity_id:this._stateObj.entity_id})}if("volume_mute"!==e)if("shuffle"!==e){if("repeat"===e){const t=this._stateObj.attributes.repeat??"off";return void this.hass.callService("media_player","repeat_set",{entity_id:this._stateObj.entity_id,repeat:"off"===t?"one":"one"===t?"all":"off"})}this.hass.callService("media_player",e,{entity_id:this._stateObj.entity_id})}else this.hass.callService("media_player","shuffle_set",{entity_id:this._stateObj.entity_id,shuffle:!this._stateObj.attributes.shuffle});else this.hass.callService("media_player","volume_mute",{entity_id:this._stateObj.entity_id,is_volume_muted:!this._stateObj.attributes.is_volume_muted})}}constructor(...t){super(...t),this._narrow=!1}}y.styles=[u.T,o.AH`ha-control-button-group{overflow:hidden}`],(0,s.Cg)([(0,a.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],y.prototype,"context",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],y.prototype,"color",void 0),(0,s.Cg)([(0,a.wk)()],y.prototype,"_config",void 0),(0,s.Cg)([(0,a.wk)()],y.prototype,"_narrow",void 0),y=(0,s.Cg)([(0,a.EM)("hui-media-player-playback-card-feature")],y)},26671(t,e,i){i.a(t,async function(t,s){try{i.d(e,{u:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(53072),h=i(784),l=i(48555),d=t([l]);l=(d.then?(await d)():d)[0];const u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"media_player"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.vj.SELECT_SOUND_MODE)&&!!i.attributes.sound_mode_list?.length};class _ extends l.n{get _label(){return this.hass.localize("ui.card.media_player.sound_mode")}static getStubConfig(){return{type:"media-player-sound-mode"}}static async getConfigElement(){return await i.e(89890).then(i.bind(i,56121)),document.createElement("hui-media-player-sound-mode-card-feature-editor")}get _configuredModes(){const t=this._config?.sound_modes;return t?.length?t:void 0}shouldUpdate(t){const e=this.context?.entity_id,i=t.get("hass");return t.has("_currentValue")||t.has("context")||(0,h.xP)(this,t)||t.has("hass")&&(!i||!e||i.states[e]!==this.hass?.states[e])}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="sound_mode",this._modesAttribute="sound_mode_list",this._serviceDomain="media_player",this._serviceAction="select_sound_mode",this._hideLabel=!1,this._showDropdownOptionIcons=!1,this._allowIconsStyle=!1}}_=(0,o.Cg)([(0,a.EM)("hui-media-player-sound-mode-card-feature")],_),s()}catch(t){s(t)}})},61691(t,e,i){i.a(t,async function(t,s){try{i.d(e,{d:()=>u});var o=i(62826),a=i(22441),n=i(71727),r=i(82286),c=i(53072),h=i(784),l=i(48555),d=t([l]);l=(d.then?(await d)():d)[0];const u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"media_player"===(0,n.m)(i.entity_id)&&(0,r.$)(i,c.vj.SELECT_SOURCE)};class _ extends l.n{get _configuredModes(){const t=this._config?.sources;return t?.length?t:void 0}get _label(){return this.hass.localize("ui.card.media_player.source")}static getStubConfig(){return{type:"media-player-source"}}static async getConfigElement(){return await i.e(16406).then(i.bind(i,53397)),document.createElement("hui-media-player-source-card-feature-editor")}shouldUpdate(t){const e=this.context?.entity_id,i=t.get("hass");return t.has("_currentValue")||t.has("context")||(0,h.xP)(this,t)||t.has("hass")&&(!i||!e||i.states[e]!==this.hass?.states[e])}_isSupported(){return!!(this.hass&&this.context&&u(this.hass,this.context))}constructor(...t){super(...t),this._attribute="source",this._modesAttribute="source_list",this._serviceDomain="media_player",this._serviceAction="select_source",this._hideLabel=!1,this._showDropdownOptionIcons=!1,this._allowIconsStyle=!1}}_=(0,o.Cg)([(0,a.EM)("hui-media-player-source-card-feature")],_),s()}catch(t){s(t)}})},71982(t,e,i){i.a(t,async function(t,s){try{i.d(e,{X:()=>v});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(82286),h=i(63004),l=i(46051),d=i(22675),u=i(53072),_=i(49908),p=i(22287),g=t([l]);l=(g.then?(await g)():g)[0];const v=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"media_player"===(0,r.m)(i.entity_id)&&(0,c.$)(i,u.vj.VOLUME_SET)};class b extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"media-player-volume-buttons",step:5}}static async getConfigElement(){return await i.e(88031).then(i.bind(i,17282)),document.createElement("hui-media-player-volume-buttons-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&v(this.hass,this.context)))return a.s6;const t=this._stateObj,e=t.state===d.Hh,i=null!=t.attributes.volume_level?Math.round(100*t.attributes.volume_level):void 0;return a.qy` <ha-control-number-buttons .disabled="${e}" .locale="${this.hass.locale}" min="0" max="100" .step="${this._config.step??5}" .value="${i}" unit="%" @value-changed="${this._valueChanged}"></ha-control-number-buttons> ${(0,p.U)(this.hass,t,this._config.show_mute_button,e,this._toggleMute)} `}_valueChanged(t){t.stopPropagation(),this.hass.callService("media_player","volume_set",{entity_id:this._stateObj.entity_id,volume_level:(0,h.q)(t.detail.value,0,100)/100})}static get styles(){return[_.T,a.AH`:host{display:flex;flex-direction:row;gap:var(--feature-button-spacing)}ha-control-number-buttons{flex:1;min-width:0}.mute{width:var(--feature-height);height:var(--feature-height)}`]}constructor(...t){super(...t),this._toggleMute=t=>{(0,p.d)(t,this.hass,this._stateObj,this)}}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],b.prototype,"_config",void 0),b=(0,o.Cg)([(0,n.EM)("hui-media-player-volume-buttons-card-feature")],b),s()}catch(t){s(t)}})},91282(t,e,i){i.a(t,async function(t,s){try{i.d(e,{R:()=>v});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(47129),h=i(82286),l=i(10223),d=i(22675),u=i(53072),_=i(49908),p=i(22287),g=t([l]);l=(g.then?(await g)():g)[0];const v=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"media_player"===(0,r.m)(i.entity_id)&&(0,h.$)(i,u.vj.VOLUME_SET)};class b extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"media-player-volume-slider"}}static async getConfigElement(){return await i.e(87363).then(i.bind(i,12974)),document.createElement("hui-media-player-volume-slider-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&v(this.hass,this.context)))return a.s6;const t=this._stateObj,e=t.state===d.Hh,i=null!=t.attributes.volume_level?Math.round(100*t.attributes.volume_level):void 0;return a.qy` <ha-control-slider .value="${i}" min="0" max="100" .showHandle="${(0,c.a)(t)}" .disabled="${e}" @value-changed="${this._valueChanged}" unit="%" .locale="${this.hass.locale}"></ha-control-slider> ${(0,p.U)(this.hass,t,this._config.show_mute_button,e,this._toggleMute)} `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;this.hass.callService("media_player","volume_set",{entity_id:this._stateObj.entity_id,volume_level:e/100})}static get styles(){return[_.T,a.AH`:host{display:flex;flex-direction:row;gap:var(--feature-button-spacing)}ha-control-slider{flex:1;min-width:0}.mute{width:var(--feature-height);height:var(--feature-height)}`]}constructor(...t){super(...t),this._toggleMute=t=>{(0,p.d)(t,this.hass,this._stateObj,this)}}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],b.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],b.prototype,"_config",void 0),b=(0,o.Cg)([(0,n.EM)("hui-media-player-volume-slider-card-feature")],b),s()}catch(t){s(t)}})},48555(t,e,i){i.a(t,async function(t,s){try{i.d(e,{n:()=>p});i(18111),i(61701);var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(36248),h=(i(43958),i(56048)),l=(i(67094),i(22675)),d=i(49908),u=i(98071),_=t([c,h]);[c,h]=_.then?(await _)():_;class p extends a.WF{get _configuredModes(){}get _label(){return this.hass.formatEntityAttributeName(this._stateObj,this._attribute)}get _controlSelectStyle(){}_getServiceDomain(t){return this._serviceDomain}_isValueValid(t,e){return!0}get _stateObj(){if(this.hass&&this.context?.entity_id)return this.hass.states[this.context.entity_id]}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if(super.willUpdate(t),(t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass");(this.context?.entity_id?e?.states[this.context.entity_id]:void 0)!==this._stateObj&&(this._currentValue=this._getValue(this._stateObj))}}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&this._isSupported()))return null;const t=this._stateObj,e=this._getOptions(),i=this._label;return this._allowIconsStyle&&("icons"===this._config.style||void 0===this._config.style&&"icons"===this._defaultStyle)?a.qy` <ha-control-select .options="${e.map(t=>({...t,icon:this._renderOptionIcon(t)}))}" .value="${this._currentValue}" @value-changed="${this._valueChanged}" hide-option-label .label="${i}" style="${(0,r.W)(this._controlSelectStyle??{})}" .disabled="${t.state===l.Hh}"> </ha-control-select> `:a.qy` <ha-control-select-menu show-arrow ?hide-label="${this._hideLabel}" .label="${i}" .value="${this._currentValue}" .disabled="${t.state===l.Hh}" @wa-select="${this._valueChanged}" .options="${e}" .renderIcon="${this._showDropdownOptionIcons?this._renderMenuIcon:void 0}"> ${this._dropdownIconPath?a.qy`<ha-svg-icon slot="icon" .path="${this._dropdownIconPath}"></ha-svg-icon>`:a.s6} </ha-control-select-menu> `}_getValue(t){return t.attributes[this._attribute]}_getOptions(){return this._stateObj&&this.hass?(0,u.P)(this._stateObj.attributes[this._modesAttribute],this._configuredModes).map(t=>({value:t,label:this.hass.formatEntityAttributeValue(this._stateObj,this._attribute,t)})):[]}_renderOptionIcon(t){return a.qy`<ha-attribute-icon slot="graphic" .hass="${this.hass}" .stateObj="${this._stateObj}" .attribute="${this._attribute}" .attributeValue="${t.value}"></ha-attribute-icon>`}async _valueChanged(t){if(!this.hass||!this._stateObj)return;const e=t.detail.value??t.detail.item?.value,i=this._getValue(this._stateObj);if(e!==i&&e&&this._isValueValid(e,this._stateObj)){this._currentValue=e;try{await this.hass.callService(this._getServiceDomain(this._stateObj),this._serviceAction,{entity_id:this._stateObj.entity_id,[this._attribute]:e})}catch(t){this._currentValue=i}}}static get styles(){return d.T}constructor(...t){super(...t),this._hideLabel=!0,this._showDropdownOptionIcons=!0,this._allowIconsStyle=!0,this._defaultStyle="dropdown",this._renderMenuIcon=t=>a.qy`<ha-attribute-icon .hass="${this.hass}" .stateObj="${this._stateObj}" .attribute="${this._attribute}" .attributeValue="${t}"></ha-attribute-icon>`}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],p.prototype,"_config",void 0),(0,o.Cg)([(0,n.wk)()],p.prototype,"_currentValue",void 0),s()}catch(t){s(t)}})},55719(t,e,i){i.d(e,{N:()=>p,s:()=>_});i(18111),i(61701),i(13579);var s=i(62826),o=i(5124),a=i(22441),n=i(89784),r=i(78870),c=i(71727),h=i(52658),l=(i(43958),i(22675)),d=i(59241),u=i(49908);const _=(t,e,i)=>{const s=e.entity_id?t.states[e.entity_id]:void 0;return!!s&&((0,c.m)(s.entity_id)===i.domain&&i.supportsPosition(s))};class p extends o.WF{get _stateObj(){if(this.hass&&this.context?.entity_id)return this.hass.states[this.context.entity_id]}connectedCallback(){super.connectedCallback(),this._refreshEntitySubscription()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEntityRegistry()}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if(super.willUpdate(t),(t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass");(this.context?.entity_id?e?.states[this.context.entity_id]:void 0)!==this._stateObj&&(this._currentPosition=this._definition.getCurrentValue(this._stateObj))}t.has("context")&&t.get("context")?.entity_id!==this.context?.entity_id&&this._refreshEntitySubscription(),t.has("hass")&&t.get("hass")?.connection!==this.hass?.connection&&this._refreshEntitySubscription()}_refreshEntitySubscription(){this._ensureEntitySubscription().catch(()=>{})}_unsubscribeEntityRegistry(){this._unsubEntityRegistry&&(this._unsubEntityRegistry(),this._unsubEntityRegistry=void 0)}async _loadEntityEntry(t){if(this.hass)try{const e=await(0,d.v)(this.hass,t);this.context?.entity_id===t&&(this._entry=e)}catch(e){this.context?.entity_id===t&&(this._entry=null)}}async _subscribeEntityEntry(t){this._unsubscribeEntityRegistry(),await this._loadEntityEntry(t);try{this._unsubEntityRegistry=(0,d.Bz)(this.hass.connection,async e=>{this.context?.entity_id===t&&(e.some(e=>e.entity_id===t)?await this._loadEntityEntry(t):this._entry=null)})}catch(t){this._unsubEntityRegistry=void 0}}async _ensureEntitySubscription(){const t=this.context?.entity_id,e=this.hass?.connection;if(!this.hass||!t||!e)return this._unsubscribeEntityRegistry(),this._subscribedEntityId=void 0,this._subscribedConnection=void 0,void(this._entry=void 0);this._subscribedEntityId===t&&this._subscribedConnection===e&&this._unsubEntityRegistry||(this._subscribedEntityId=t,this._subscribedConnection=e,await this._subscribeEntityEntry(t))}async _valueChanged(t){const e=t.detail.value;if(null==e||!this.hass||!this._stateObj)return;const i=Number(e);if(isNaN(i))return;const s=this._definition.getCurrentValue(this._stateObj);if(i!==s){this._currentPosition=i;try{await this.hass.callService(this._definition.domain,this._definition.setPositionService,{entity_id:this._stateObj.entity_id,[this._definition.serviceDataKey]:i})}catch(t){this._currentPosition=s}}}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&_(this.hass,this.context,this._definition)))return null;const t=this._definition.normalizeFavoritePositions(this._definition.getFavoritePositions(this._entry)??this._definition.defaultFavoritePositions),e=this.hass;if(0===t.length||!e)return null;const i=t.map(t=>({value:String(t),label:`${t}%`,ariaLabel:e.localize(this._definition.setPositionLabelKey,{value:`${t}%`})})),s=null!=this._currentPosition?String(this._currentPosition):void 0,a=this.color?(0,r.MP)(this.color):(0,h.Se)(this._stateObj);return o.qy` <ha-control-select style="${(0,n.W)({"--feature-color":a})}" .options="${i}" .value="${s}" @value-changed="${this._valueChanged}" .label="${e.localize(this._definition.featureLabelKey)}" .disabled="${this._stateObj.state===l.Hh}"> </ha-control-select> `}static get styles(){return u.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"context",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"color",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_config",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_entry",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_currentPosition",void 0)},73269(t,e,i){i.a(t,async function(t,s){try{i.d(e,{Q:()=>_});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=(i(48374),i(28624),i(46051)),h=i(10223),l=(i(47680),i(22675)),d=i(49908),u=t([c,h]);[c,h]=u.then?(await u)():u;const _=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;const s=(0,r.m)(i.entity_id);return"input_number"===s||"number"===s};class p extends a.WF{static getStubConfig(){return{type:"numeric-input",style:"buttons"}}get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static async getConfigElement(){return await i.e(67816).then(i.bind(i,28955)),document.createElement("hui-numeric-input-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if(super.willUpdate(t),(t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass"),i=e?.states[this.context.entity_id];i!==this._stateObj&&(this._currentState=this._stateObj.state)}}async _setValue(t){const e=this._stateObj,i=(0,r.m)(e.entity_id);await this.hass.callService(i,"set_value",{entity_id:e.entity_id,value:t.detail.value})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&_(this.hass,this.context)))return a.s6;const t=this._stateObj,e=Number(t.state),i=isNaN(e)?void 0:e;return"buttons"===this._config.style?a.qy` <ha-control-number-buttons .value="${i}" .min="${t.attributes.min}" .max="${t.attributes.max}" .step="${t.attributes.step}" @value-changed="${this._setValue}" .disabled="${t.state===l.Hh}" .unit="${t.attributes.unit_of_measurement}" .locale="${this.hass.locale}"></ha-control-number-buttons> `:a.qy` <ha-control-slider .value="${i}" .min="${t.attributes.min}" .max="${t.attributes.max}" .step="${t.attributes.step}" @value-changed="${this._setValue}" .disabled="${t.state===l.Hh}" .unit="${t.attributes.unit_of_measurement}" .locale="${this.hass.locale}"></ha-control-slider> `}static get styles(){return d.T}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],p.prototype,"_config",void 0),(0,o.Cg)([(0,n.wk)()],p.prototype,"_currentState",void 0),p=(0,o.Cg)([(0,n.EM)("hui-numeric-input-card-feature")],p),s()}catch(t){s(t)}})},14501(t,e,i){i.a(t,async function(t,s){try{i.d(e,{t:()=>C});i(44114),i(18111),i(61701);var o=i(62826),a=i(35211),n=i(88696),r=i(5124),c=i(22441),h=i(6412),l=i(78870),d=(i(46190),i(93421)),u=i(32172),_=i(65829),p=i(22792),g=i(43248),v=i(70565),b=i(18696),y=t([_,b]);[_,b]=y.then?(await y)():y;const f=16,m=(t,e,i,s,o)=>{const a=Math.max(0,Math.min(o,i/2,s));return`M ${t},${e+a} a ${a},${a} 0 0 1 ${a},${-a} h ${i-2*a} a ${a},${a} 0 0 1 ${a},${a} v ${s-a} h ${-i} z`},C=(t,e)=>(0,v._W)(e.entity_id?t.states[e.entity_id]:void 0);class w extends r.WF{static getStubConfig(){return{type:"precipitation-forecast"}}static async getConfigElement(){return await i.e(4619).then(i.bind(i,37446)),document.createElement("hui-precipitation-forecast-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._subscribeForecast()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeForecast()}firstUpdated(){this._subscribeForecast()}updated(t){this._shouldResubscribe(t)&&(this._unsubscribeForecast(),this._subscribeForecast())}_shouldResubscribe(t){if(t.has("context")){const e=t.get("context");if(e?.entity_id!==this.context?.entity_id)return!0}return!(!t.has("_config")||this._resolvedForecastType()===this._subscribedType)}_referenceMaxAmount(){const t=!(!this._hassConfig||!this._stateObj)&&"in"===(0,g.d9)(this._hassConfig,this._stateObj,"precipitation");switch(this._subscribedType){case"hourly":return t?.1:2.5;case"twice_daily":return t?.25:6;default:return t?.4:10}}_resolvedForecastType(){return(0,v.Sg)(this._stateObj,this._config?.forecast_type)}get _showLabels(){return!1!==this._config?.show_labels}render(){if(!this._config||!this.context||!(0,v._W)(this._stateObj))return r.s6;if(this._error)return r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.precipitation-forecast.failed_to_load",{error:this._error})} </div> </div> `;if(!this._forecast)return r.qy` <div class="container loading"> <ha-spinner size="small"></ha-spinner> </div> `;const t="hourly"===this._subscribedType,e=this._config.precipitation_type??"amount",i=(this._config.color?(0,l.MP)(this._config.color):void 0)??"var(--state-weather-rainy-color)",s=(0,h.H)({container:!0,"with-labels":this._showLabels});if(t){const t=this._renderHourlyBars(e,i);if(!t)return r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.precipitation-forecast.no_forecast")} </div> </div> `;const o=this._config.hours_to_show??24;return r.qy` <div class="${s}"> <div class="bars">${t}</div> ${this._showLabels&&this._locale?(0,b.qO)(o,this._locale):r.s6} </div> `}const o=this._config.days_to_show??7,a="twice_daily"===this._subscribedType?2:1,n=this._forecast.slice(0,o*a);return n.length?r.qy` <div class="${s}"> <div class="bars"> ${this._renderDailyBars(n,e,i)} </div> ${this._showLabels&&this._locale?(0,b.Is)(n,a,this._locale):r.s6} </div> `:r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.precipitation-forecast.no_forecast")} </div> </div> `}_renderDailyBars(t,e,i){const s=this._size.value?.width||this.clientWidth,o=this._size.value?.height||this.clientHeight,a=s/t.length,n=Math.max(1,Math.min(f,a-4)),c=o-8,h=t.map(t=>(0,g.zr)(t,e));let l="probability"===e?100:this._referenceMaxAmount();if("amount"===e)for(const t of h)Number.isFinite(t)&&(l=Math.max(l,t));const d=h.map((t,e)=>{const s=a*e+a/2;if(!Number.isFinite(t)||t<=0||l<=0){const t=4+c-1.5;return r.JW`<circle cx="${s}" cy="${t}" r="${1.5}" fill="${i}" class="mark"></circle>`}const o=Math.max(1,t/l*c),h=m(s-n/2,4+c-o,n,o,n/4);return r.JW`<path d="${h}" fill="${i}" class="mark"></path>`});return r.qy` <svg width="100%" height="100%" viewBox="0 0 ${s} ${o}" preserveAspectRatio="none"> ${d} </svg> `}_renderHourlyBars(t,e){if(!this._forecast?.length)return;const i=this._size.value?.width||this.clientWidth,s=this._size.value?.height||this.clientHeight,o=s-4,a=Date.now(),n=this._config.hours_to_show??24,c=Math.ceil(a/v.C_)*v.C_,h=n*v.C_,l=c+h,d=[];for(const e of this._forecast){const i=new Date(e.datetime).getTime();i>=c&&i<l&&d.push({value:(0,g.zr)(e,t),t:i})}if(!d.length)return;let u="probability"===t?100:this._referenceMaxAmount();if("amount"===t)for(const{value:t}of d)Number.isFinite(t)&&(u=Math.max(u,t));const _=i/n,p=Math.max(1,Math.min(f,_-2)),b=d.map(({value:t,t:a})=>{const n=(a-c)/h*i+_/2;if(!Number.isFinite(t)||t<=0||u<=0){const t=s-1.5;return r.JW`<circle cx="${n}" cy="${t}" r="${1.5}" fill="${e}" class="mark"></circle>`}const l=n-p/2,d=Math.max(1,t/u*o),g=m(l,s-d,p,d,p/4);return r.JW`<path d="${g}" fill="${e}" class="mark"></path>`});return r.qy` <svg width="100%" height="100%" viewBox="0 0 ${i} ${s}" preserveAspectRatio="none"> ${b} </svg> `}_unsubscribeForecast(){this._subscribed&&(this._subscribed.then(t=>t?.()).catch(()=>{}),this._subscribed=void 0),this._subscribedType=void 0}async _subscribeForecast(){if(!this.context?.entity_id||!this._config||!this._connection||this._subscribed)return;const t=this._resolvedForecastType();if(!t)return;const e=this.context.entity_id;this._forecast=void 0,this._error=void 0,this._subscribedType=t,this._subscribed=(0,g.Mu)(this._connection,e,t,t=>{this._forecast=t.forecast??[]}).catch(t=>{this._subscribed=void 0,this._subscribedType=void 0,this._error=t.message||t.code})}constructor(...t){super(...t),this._size=new n.P(this,{callback:t=>{const e=t?.[0]?.contentRect;if(e)return{width:e.width,height:e.height}}})}}w.styles=[b.KX,r.AH`:host{display:flex;width:100%;height:var(--feature-height);flex-direction:column;justify-content:flex-end;align-items:stretch;pointer-events:none!important;--feature-precipitation-opacity:0.4}.container{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;overflow:hidden}.bars{flex:1;min-height:0;display:flex;align-items:stretch}.container.with-labels .bars{padding-bottom:2px}.info{color:var(--secondary-text-color);font-size:var(--ha-font-size-s)}svg{display:block}.mark{opacity:var(--feature-precipitation-opacity)}`],(0,o.Cg)([(0,c.MZ)({attribute:!1})],w.prototype,"context",void 0),(0,o.Cg)([(0,c.wk)(),(0,d.fI)({entityIdPath:["context","entity_id"]})],w.prototype,"_stateObj",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:p.D5,subscribe:!0}),(0,u.p)({transformer:({localize:t})=>t})],w.prototype,"_localize",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:p.D5,subscribe:!0}),(0,u.p)({transformer:({locale:t})=>t})],w.prototype,"_locale",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:p.Wq,subscribe:!0}),(0,u.p)({transformer:({connection:t})=>t})],w.prototype,"_connection",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:p.WF,subscribe:!0}),(0,u.p)({transformer:({config:t})=>t})],w.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,c.wk)()],w.prototype,"_config",void 0),(0,o.Cg)([(0,c.wk)()],w.prototype,"_forecast",void 0),(0,o.Cg)([(0,c.wk)()],w.prototype,"_error",void 0),w=(0,o.Cg)([(0,c.EM)("hui-precipitation-forecast-card-feature")],w),s()}catch(t){s(t)}})},29106(t,e,i){i.a(t,async function(t,s){try{i.d(e,{N:()=>l});i(74423),i(18111),i(61701);var o=i(62826),a=i(22441),n=i(71727),r=i(98071),c=i(48555),h=t([c]);c=(h.then?(await h)():h)[0];const l=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;const s=(0,n.m)(i.entity_id);return"select"===s||"input_select"===s};class d extends c.n{get _configuredModes(){return this._config?.options}get _label(){return this.hass.localize("ui.card.select.option")}static getStubConfig(){return{type:"select-options"}}static async getConfigElement(){return await i.e(45555).then(i.bind(i,21630)),document.createElement("hui-select-options-card-feature-editor")}_getValue(t){return t.state}_getOptions(){return this._stateObj&&this.hass?(0,r.P)(this._stateObj.attributes.options,this._config?.options).map(t=>({value:t,label:this.hass.formatEntityState(this._stateObj,t)})):[]}_getServiceDomain(t){return(0,n.m)(t.entity_id)}_isValueValid(t,e){return e.attributes.options.includes(t)}_isSupported(){return!!(this.hass&&this.context&&l(this.hass,this.context))}constructor(...t){super(...t),this._attribute="option",this._modesAttribute="options",this._serviceDomain="select",this._serviceAction="select_option",this._allowIconsStyle=!1,this._showDropdownOptionIcons=!1}}d=(0,o.Cg)([(0,a.EM)("hui-select-options-card-feature")],d),s()}catch(t){s(t)}})},57484(t,e,i){i.a(t,async function(t,s){try{i.d(e,{V:()=>u});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(10223),h=i(22675),l=i(49908),d=t([c]);c=(d.then?(await d)():d)[0];const u=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"humidifier"===(0,r.m)(i.entity_id)};class _ extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"target-humidity"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}willUpdate(t){if(super.willUpdate(t),(t.has("hass")||t.has("context"))&&this._stateObj){const e=t.get("hass"),i=e?.states[this.context.entity_id];i!==this._stateObj&&(this._targetHumidity=this._stateObj.attributes.humidity)}}get _min(){return this._stateObj.attributes.min_humidity??0}get _max(){return this._stateObj.attributes.max_humidity??100}_valueChanged(t){const{value:e}=t.detail;"number"!=typeof e||isNaN(e)||(this._targetHumidity=e,this._callService())}_callService(){this.hass.callService("humidifier","set_humidity",{entity_id:this._stateObj.entity_id,humidity:this._targetHumidity})}render(){return this._config&&this.hass&&this.context&&this._stateObj&&u(this.hass,this.context)?a.qy` <ha-control-slider .value="${this._stateObj.attributes.humidity}" .min="${this._min}" .max="${this._max}" .step="${this._step}" .disabled="${this._stateObj.state===h.Hh}" @value-changed="${this._valueChanged}" .label="${this.hass.formatEntityAttributeName(this._stateObj,"humidity")}" unit="%" .locale="${this.hass.locale}"></ha-control-slider> `:a.s6}static get styles(){return l.T}constructor(...t){super(...t),this._step=1}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],_.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],_.prototype,"_config",void 0),(0,o.Cg)([(0,n.wk)()],_.prototype,"_targetHumidity",void 0),_=(0,o.Cg)([(0,n.EM)("hui-target-humidity-card-feature")],_),s()}catch(t){s(t)}})},58467(t,e,i){i.a(t,async function(t,s){try{i.d(e,{q:()=>x});i(44114),i(18111),i(22489),i(61701);var o=i(62826),a=i(35211),n=i(88696),r=i(5124),c=i(22441),h=i(6412),l=i(89784),d=i(78870),u=(i(46190),i(93421)),_=i(32172),p=i(65829),g=i(22792),v=i(43248),b=i(70565),y=i(2706),f=i(18696),m=i(18721),C=(i(21824),t([p,f]));[p,f]=C.then?(await C)():C;const w=8,x=(t,e)=>(0,b._W)(e.entity_id?t.states[e.entity_id]:void 0);class $ extends r.WF{static getStubConfig(){return{type:"temperature-forecast"}}static async getConfigElement(){return await i.e(54918).then(i.bind(i,15877)),document.createElement("hui-temperature-forecast-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this._subscribeForecast()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeForecast()}firstUpdated(){this._subscribeForecast()}updated(t){this._shouldResubscribe(t)&&(this._unsubscribeForecast(),this._subscribeForecast())}_shouldResubscribe(t){if(t.has("context")){const e=t.get("context");if(e?.entity_id!==this.context?.entity_id)return!0}return!(!t.has("_config")||this._resolvedForecastType()===this._subscribedType)}_resolvedForecastType(){return(0,b.Sg)(this._stateObj,this._config?.forecast_type)}get _showLabels(){return!1!==this._config?.show_labels}_toCelsius(t){return!(!this._hassConfig||!this._stateObj)&&"°F"===(0,v.d9)(this._hassConfig,this._stateObj,"temperature")?5*(t-32)/9:t}render(){if(!this._config||!this.context||!(0,b._W)(this._stateObj))return r.s6;if(this._error)return r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.temperature-forecast.failed_to_load",{error:this._error})} </div> </div> `;if(!this._forecast)return r.qy` <div class="container loading"> <ha-spinner size="small"></ha-spinner> </div> `;const t="hourly"===this._subscribedType,e=this._config.color?(0,d.MP)(this._config.color):void 0,i=(0,h.H)({container:!0,"with-labels":this._showLabels});if(t){const t=this._computeHourly();if(!t?.coordinates.length)return r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.temperature-forecast.no_forecast")} </div> </div> `;const s=e?(0,l.W)({"--feature-color":e}):r.s6,o=this._config.hours_to_show??24;return r.qy` <div class="${i}"> <div class="bars"> <hui-graph-base .coordinates="${t.coordinates}" .yAxisOrigin="${t.yAxisOrigin}" .gradient="${e?void 0:t.gradient}" style="${s}"></hui-graph-base> </div> ${this._showLabels&&this._locale?(0,f.kd)(o,this._locale):r.s6} </div> `}const s=this._config.days_to_show??7,o="twice_daily"===this._subscribedType?2:1,a=this._forecast.filter(t=>Number.isFinite(t.temperature)&&Number.isFinite(t.templow)).slice(0,s*o);return a.length?r.qy` <div class="${i}"> <div class="bars">${this._renderBars(a,e)}</div> ${this._showLabels&&this._locale?(0,f.Is)(a,o,this._locale):r.s6} </div> `:r.qy` <div class="container"> <div class="info"> ${this._localize("ui.panel.lovelace.editor.features.types.temperature-forecast.no_forecast")} </div> </div> `}_renderBars(t,e){const i=this._size.value?.width||this.clientWidth,s=this._size.value?.height||this.clientHeight,o=i/t.length,a=Math.max(1,Math.min(w,o-4)),n=s-8;let c=1/0,h=-1/0;for(const e of t)c=Math.min(c,e.templow),h=Math.max(h,e.temperature);c===h&&(c-=1,h+=1);const l=t=>4+n-(t-c)/(h-c)*n,d=e?void 0:t.map((t,e)=>r.JW`<linearGradient id="temp-bar-${e}" x1="0" y1="0" x2="0" y2="1"> ${(0,y.R)(this._toCelsius(t.templow),this._toCelsius(t.temperature),3).map(t=>r.JW`<stop offset="${t.offset}" stop-color="${t.color}"></stop>`)} </linearGradient>`),u=t.map((t,i)=>{const s=o*i+(o-a)/2,n=l(t.temperature),c=l(t.templow),h=Math.max(1,c-n),d=Math.min(a/2,h/2),u=e??`url(#temp-bar-${i})`;return r.JW`<rect x="${s}" y="${n}" width="${a}" height="${h}" rx="${d}" ry="${d}" fill="${u}"></rect>`});return r.qy` <svg width="100%" height="100%" viewBox="0 0 ${i} ${s}" preserveAspectRatio="none"> ${d?r.JW`<defs>${d}</defs>`:r.s6}${u} </svg> `}_unsubscribeForecast(){this._subscribed&&(this._subscribed.then(t=>t?.()).catch(()=>{}),this._subscribed=void 0),this._subscribedType=void 0}_computeHourly(){if(!this._forecast?.length||!this._stateObj)return;const t=[],e=Date.now(),i=this._config.hours_to_show??24,s=Math.floor((e+i*b.C_)/b.C_)*b.C_,o=this._stateObj.attributes?.temperature;null==o||Number.isNaN(Number(o))||t.push([e,Number(o)]);for(const i of this._forecast)if(null!=i.temperature&&!Number.isNaN(i.temperature)){const o=new Date(i.datetime).getTime();if(o>s)break;if(o<e)continue;t.push([o,i.temperature])}if(!t.length)return;let a=t[0][1],n=t[0][1];for(const[,e]of t)e<a&&(a=e),e>n&&(n=e);const r=n-a||.1*a,c=a-.1*r,h=n+.1*r,l=this._size.value,d=l?.width||this.clientWidth,u=this._showLabels?12:0,_=Math.max(1,(l?.height||this.clientHeight)-u),{points:p,yAxisOrigin:g}=(0,m.G)(t,d,_,t.length,{minX:e,maxX:s,minY:c,maxY:h});p.pop();const v=h-c||.1*c,f=c-.1*v,C=h+.1*v;return{coordinates:p,yAxisOrigin:g,gradient:{x1:0,y1:0,x2:0,y2:_,stops:(0,y.U)(this._toCelsius(f),this._toCelsius(C))}}}async _subscribeForecast(){if(!this.context?.entity_id||!this._config||!this._connection||this._subscribed)return;const t=this._resolvedForecastType();if(!t)return;const e=this.context.entity_id;this._forecast=void 0,this._error=void 0,this._subscribedType=t,this._subscribed=(0,v.Mu)(this._connection,e,t,t=>{this._forecast=t.forecast??[]}).catch(t=>{this._subscribed=void 0,this._subscribedType=void 0,this._error=t.message||t.code})}constructor(...t){super(...t),this._size=new n.P(this,{callback:t=>{const e=t?.[0]?.contentRect;if(e)return{width:e.width,height:e.height}}})}}$.styles=[f.KX,r.AH`:host{display:flex;width:100%;height:var(--feature-height);flex-direction:column;justify-content:flex-end;align-items:stretch;pointer-events:none!important}.container{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:stretch;border-bottom-right-radius:8px;border-bottom-left-radius:8px;overflow:hidden}.container.with-labels{border-bottom-right-radius:0;border-bottom-left-radius:0}.bars{flex:1;min-height:0;display:flex;align-items:stretch}.container.with-labels .bars{padding-bottom:2px}.info{color:var(--secondary-text-color);font-size:var(--ha-font-size-s)}svg{display:block}hui-graph-base{width:100%;height:100%;--accent-color:var(--feature-color)}`],(0,o.Cg)([(0,c.MZ)({attribute:!1})],$.prototype,"context",void 0),(0,o.Cg)([(0,c.wk)(),(0,u.fI)({entityIdPath:["context","entity_id"]})],$.prototype,"_stateObj",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:g.D5,subscribe:!0}),(0,_.p)({transformer:({localize:t})=>t})],$.prototype,"_localize",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:g.D5,subscribe:!0}),(0,_.p)({transformer:({locale:t})=>t})],$.prototype,"_locale",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:g.Wq,subscribe:!0}),(0,_.p)({transformer:({connection:t})=>t})],$.prototype,"_connection",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:g.WF,subscribe:!0}),(0,_.p)({transformer:({config:t})=>t})],$.prototype,"_hassConfig",void 0),(0,o.Cg)([(0,c.wk)()],$.prototype,"_config",void 0),(0,o.Cg)([(0,c.wk)()],$.prototype,"_forecast",void 0),(0,o.Cg)([(0,c.wk)()],$.prototype,"_error",void 0),$=(0,o.Cg)([(0,c.EM)("hui-temperature-forecast-card-feature")],$),s()}catch(t){s(t)}})},77799(t,e,i){i.d(e,{N:()=>_});i(74423);var s=i(62826),o=i(5124),a=i(22441),n=i(6412),r=i(89784),c=i(71727),h=i(52658),l=(i(48374),i(28624),i(25094),i(22675)),d=i(88360),u=i(49908);const _=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;const s=(0,c.m)(i.entity_id);return["switch","input_boolean","light","fan","siren","automation"].includes(s)},p={siren:{on:"M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z",off:"M12,4L9.91,6.09L12,8.18M4.27,3L3,4.27L7.73,9H3V15H7L12,20V13.27L16.25,17.53C15.58,18.04 14.83,18.46 14,18.7V20.77C15.38,20.45 16.63,19.82 17.68,18.96L19.73,21L21,19.73L12,10.73M19,12C19,12.94 18.8,13.82 18.46,14.64L19.97,16.15C20.62,14.91 21,13.5 21,12C21,7.72 18,4.14 14,3.23V5.29C16.89,6.15 19,8.83 19,12M16.5,12C16.5,10.23 15.5,8.71 14,7.97V10.18L16.45,12.63C16.5,12.43 16.5,12.21 16.5,12Z"},light:{on:"M12,6A6,6 0 0,1 18,12C18,14.22 16.79,16.16 15,17.2V19A1,1 0 0,1 14,20H10A1,1 0 0,1 9,19V17.2C7.21,16.16 6,14.22 6,12A6,6 0 0,1 12,6M14,21V22A1,1 0 0,1 13,23H11A1,1 0 0,1 10,22V21H14M20,11H23V13H20V11M1,11H4V13H1V11M13,1V4H11V1H13M4.92,3.5L7.05,5.64L5.63,7.05L3.5,4.93L4.92,3.5M16.95,5.63L19.07,3.5L20.5,4.93L18.37,7.05L16.95,5.63Z",off:"M12,2C9.76,2 7.78,3.05 6.5,4.68L16.31,14.5C17.94,13.21 19,11.24 19,9A7,7 0 0,0 12,2M3.28,4L2,5.27L5.04,8.3C5,8.53 5,8.76 5,9C5,11.38 6.19,13.47 8,14.74V17A1,1 0 0,0 9,18H14.73L18.73,22L20,20.72L3.28,4M9,20V21A1,1 0 0,0 10,22H14A1,1 0 0,0 15,21V20H9Z"},fan:{on:"M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12.5,2C17,2 17.11,5.57 14.75,6.75C13.76,7.24 13.32,8.29 13.13,9.22C13.61,9.42 14.03,9.73 14.35,10.13C18.05,8.13 22.03,8.92 22.03,12.5C22.03,17 18.46,17.1 17.28,14.73C16.78,13.74 15.72,13.3 14.79,13.11C14.59,13.59 14.28,14 13.88,14.34C15.87,18.03 15.08,22 11.5,22C7,22 6.91,18.42 9.27,17.24C10.25,16.75 10.69,15.71 10.89,14.79C10.4,14.59 9.97,14.27 9.65,13.87C5.96,15.85 2,15.07 2,11.5C2,7 5.56,6.89 6.74,9.26C7.24,10.25 8.29,10.68 9.22,10.87C9.41,10.39 9.73,9.97 10.14,9.65C8.15,5.96 8.94,2 12.5,2Z",off:"M12.5,2C9.64,2 8.57,4.55 9.29,7.47L15,13.16C15.87,13.37 16.81,13.81 17.28,14.73C18.46,17.1 22.03,17 22.03,12.5C22.03,8.92 18.05,8.13 14.35,10.13C14.03,9.73 13.61,9.42 13.13,9.22C13.32,8.29 13.76,7.24 14.75,6.75C17.11,5.57 17,2 12.5,2M3.28,4L2,5.27L4.47,7.73C3.22,7.74 2,8.87 2,11.5C2,15.07 5.96,15.85 9.65,13.87C9.97,14.27 10.4,14.59 10.89,14.79C10.69,15.71 10.25,16.75 9.27,17.24C6.91,18.42 7,22 11.5,22C13.8,22 14.94,20.36 14.94,18.21L18.73,22L20,20.72L3.28,4Z"}};class g extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"toggle"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_valueChanged(t){t.target.checked?this._turnOn():this._turnOff()}_turnOn(){this._callService(!0)}_turnOff(){this._callService(!1)}async _callService(t){if(!this.hass||!this._stateObj)return;(0,d.j)(this,"light");const e=(0,c.m)(this._stateObj.entity_id),i=t?"turn_on":"turn_off";await this.hass.callService(e,i,{entity_id:this._stateObj.entity_id})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&_(this.hass,this.context)))return o.s6;const t=(0,h.Se)(this._stateObj,"off"),e="on"===this._stateObj.state,i="off"===this._stateObj.state,s=(0,c.m)(this._stateObj.entity_id),a=p[s]?.on||"M16.56,5.44L15.11,6.89C16.84,7.94 18,9.83 18,12A6,6 0 0,1 12,18A6,6 0 0,1 6,12C6,9.83 7.16,7.94 8.88,6.88L7.44,5.44C5.36,6.88 4,9.28 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,12C20,9.28 18.64,6.88 16.56,5.44M13,3H11V13H13",d=p[s]?.off||"M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z";return this._stateObj.attributes.assumed_state||this._stateObj.state===l.HV?o.qy` <ha-control-button-group> <ha-control-button .label="${this.hass.localize("ui.card.common.turn_off")}" @click="${this._turnOff}" .disabled="${this._stateObj.state===l.Hh}" class="${(0,n.H)({active:i})}" style="${(0,r.W)({"--color":t})}"> <ha-svg-icon .path="${d}"></ha-svg-icon> </ha-control-button> <ha-control-button .label="${this.hass.localize("ui.card.common.turn_on")}" @click="${this._turnOn}" .disabled="${this._stateObj.state===l.Hh}" class="${(0,n.H)({active:e})}" style="${(0,r.W)({"--color":"var(--feature-color)"})}"> <ha-svg-icon .path="${a}"></ha-svg-icon> </ha-control-button> </ha-control-button-group> `:o.qy` <ha-control-switch .pathOn="${a}" .pathOff="${d}" .checked="${e}" @change="${this._valueChanged}" .label="${this.hass.localize("ui.card.common.toggle")}" .disabled="${this._stateObj.state===l.Hh}"> </ha-control-switch> `}static get styles(){return[u.T,o.AH`ha-control-button.active{--control-button-icon-color:white;--control-button-background-color:var(--color);--control-button-background-opacity:1}`]}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],g.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],g.prototype,"_config",void 0),g=(0,s.Cg)([(0,a.EM)("hui-toggle-card-feature")],g)},45429(t,e,i){i.a(t,async function(t,s){try{i.d(e,{E:()=>_});var o=i(62826),a=i(5124),n=i(22441),r=i(36312),c=i(71727),h=i(20058),l=i(25064),d=i(18721),u=(i(21824),t([h,l]));[h,l]=u.then?(await u)():u;const _=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"sensor"===(0,c.m)(i.entity_id)&&(0,h.ty)(i.attributes)},p=24;class g extends a.WF{static getStubConfig(){return{type:"trend-graph"}}static async getConfigElement(){return await i.e(14328).then(i.bind(i,38539)),document.createElement("hui-trend-graph-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}connectedCallback(){super.connectedCallback(),clearInterval(this._interval),this._interval=window.setInterval(()=>this.requestUpdate(),6e4),this.hasUpdated&&this._subscribeHistory()}disconnectedCallback(){super.disconnectedCallback(),clearInterval(this._interval),this._unsubscribeHistory()}firstUpdated(){this._setLoadingCoordinates(),this.isConnected&&this._subscribeHistory()}_setLoadingCoordinates(){const t=this.context?.entity_id;if(!t||!this.hass)return;const e=this.hass.states[t];if(!e)return;const{points:i,yAxisOrigin:s}=(0,d.a)((0,l.Lj)(e),this.clientWidth,this.clientHeight,10);this._coordinates=i,this._yAxisOrigin=s}render(){return this._config&&this.hass&&this.context&&_(this.hass,this.context)?this._error?a.qy` <div class="container"> <div class="info">${this._error.message||this._error.code}</div> </div> `:this._coordinates&&!this._coordinates.length?a.qy` <div class="container"> <div class="info">No state history found.</div> </div> `:a.qy` <hui-graph-base ?loading="${this._loading}" .coordinates="${this._coordinates}" .yAxisOrigin="${this._yAxisOrigin}"></hui-graph-base> `:a.s6}_unsubscribeHistory(){this._subscribed&&(this._subscribed.then(t=>t?.()).catch(()=>{}),this._subscribed=void 0)}updated(t){if(this.isConnected&&!this._subscribed&&!this._error&&this._config&&this.context?.entity_id&&t.has("hass")){const e=t.get("hass");e&&e.config.components!==this.hass.config.components&&this._subscribeHistory()}}async _subscribeHistory(){if(!(0,r.x)(this.hass.config,"history")||!this.context?.entity_id||!this._config||this._subscribed)return;const t=this._config.hours_to_show??p,e=!1!==this._config.detail;this._subscribed=(0,l.IQ)(this.hass,i=>{const s=this.context.entity_id;let o=i[s];if(!o?.length){const t=this.hass.states[s];t&&(o=(0,l.Lj)(t))}const a=e?Math.max(10,this.clientWidth/5,t):Math.max(10,t),n=!e,{points:r,yAxisOrigin:c}=(0,d.a)(o,this.clientWidth,this.clientHeight,a,void 0,n);this._coordinates=r,this._yAxisOrigin=c,this._loading=!1},t,[this.context.entity_id]).catch(t=>{this._subscribed=void 0,this._error=t})}constructor(...t){super(...t),this._loading=!0}}g.styles=a.AH`:host{display:flex;width:100%;height:var(--feature-height);flex-direction:column;justify-content:flex-end;align-items:flex-end;pointer-events:none!important}hui-graph-base{width:100%;--accent-color:var(--feature-color);border-bottom-right-radius:8px;border-bottom-left-radius:8px;overflow:hidden}`,(0,o.Cg)([(0,n.MZ)({attribute:!1,hasChanged:()=>!1})],g.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_coordinates",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_yAxisOrigin",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_loading",void 0),(0,o.Cg)([(0,n.wk)()],g.prototype,"_error",void 0),g=(0,o.Cg)([(0,n.EM)("hui-trend-graph-card-feature")],g),s()}catch(t){s(t)}})},52494(t,e,i){i.a(t,async function(t,s){try{i.d(e,{J:()=>y});var o=i(62826),a=i(5124),n=i(22441),r=i(71727),c=i(47129),h=i(82286),l=(i(48374),i(28624),i(22675)),d=i(24247),u=i(15471),_=i(49908),p=t([d]);d=(p.then?(await p)():p)[0];const g="M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",v="M17,1H7A2,2 0 0,0 5,3V21A2,2 0 0,0 7,23H17A2,2 0 0,0 19,21V3A2,2 0 0,0 17,1M17,19H7V5H17V19M16,13H13V8H11V13H8L12,17L16,13Z",b="no",y=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"update"===(0,r.m)(i.entity_id)&&(0,h.$)(i,d.TY.INSTALL)};class f extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static async getConfigElement(){return await i.e(15871).then(i.bind(i,87906)),document.createElement("hui-update-actions-card-feature-editor")}static getStubConfig(){return{type:"update-actions",backup:b}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}get _installDisabled(){const t=this._stateObj;if(t.state===l.Hh)return!0;const e=t.attributes.latest_version&&t.attributes.skipped_version===t.attributes.latest_version;return!(0,c.a)(t)&&!e||(0,d.Jy)(t)}get _skipDisabled(){const t=this._stateObj;if(t.state===l.Hh)return!0;return t.attributes.latest_version&&t.attributes.skipped_version===t.attributes.latest_version||!(0,c.a)(t)||(0,d.Jy)(t)}async _install(){const t=(0,h.$)(this._stateObj,d.TY.BACKUP);let e=t&&"yes"===this._config?.backup;if(t&&"ask"===this._config?.backup){const t=await(0,u.X)(this,{});if(null===t)return;e=t}this.hass.callService("update","install",{entity_id:this._stateObj.entity_id,backup:e})}async _skip(){this.hass.callService("update","skip",{entity_id:this._stateObj.entity_id})}render(){return this._config&&this.hass&&this.context&&this._stateObj&&y(this.hass,this.context)?a.qy` <ha-control-button-group> <ha-control-button .label="${this.hass.localize("ui.dialogs.more_info_control.update.skip")}" @click="${this._skip}" .disabled="${this._skipDisabled}"> <ha-svg-icon .path="${g}"></ha-svg-icon> </ha-control-button> <ha-control-button .label="${this.hass.localize("ui.dialogs.more_info_control.update.install")}" @click="${this._install}" .disabled="${this._installDisabled}"> <ha-svg-icon .path="${v}"></ha-svg-icon> </ha-control-button> </ha-control-button-group> `:a.s6}static get styles(){return _.T}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"context",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_config",void 0),f=(0,o.Cg)([(0,n.EM)("hui-update-actions-card-feature")],f),s()}catch(t){s(t)}})},65115(t,e,i){i.d(e,{Fv:()=>p,Ky:()=>v,vA:()=>_});i(18111),i(22489),i(61701),i(13579);var s=i(62826),o=i(5124),a=i(22441),n=i(71727),r=i(82286),c=(i(48374),i(28624),i(67094),i(22675)),h=i(24717),l=i(49908),d=i(37531);const u={start_pause:[h.Ri.PAUSE,h.Ri.START],stop:[h.Ri.STOP],clean_spot:[h.Ri.CLEAN_SPOT],locate:[h.Ri.LOCATE],return_home:[h.Ri.RETURN_HOME]},_=["start_pause","stop","return_home"],p=(t,e)=>u[e].some(e=>(0,r.$)(t,e)),g={start_pause:t=>{if(!(0,r.$)(t,h.Ri.STATE)&&!(0,r.$)(t,h.Ri.START)&&(0,r.$)(t,h.Ri.PAUSE))return{translationKey:"start_pause",icon:"M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5",serviceName:"start_pause"};return(0,h.Ak)(t)&&(0,r.$)(t,h.Ri.PAUSE)?{translationKey:"pause",icon:"M14,19H18V5H14M6,19H10V5H6V19Z",serviceName:"pause"}:{translationKey:"start",icon:"M8,5.14V19.14L19,12.14L8,5.14Z",serviceName:"start",disabled:!(0,h.Bd)(t)}},stop:t=>({translationKey:"stop",icon:"M18,18H6V6H18V18Z",serviceName:"stop",disabled:!(0,h.lg)(t)}),clean_spot:()=>({translationKey:"clean_spot",icon:"M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",serviceName:"clean_spot"}),locate:()=>({translationKey:"locate",icon:"M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z",serviceName:"locate"}),return_home:t=>({translationKey:"return_home",icon:"M15 13L11 17V14H2V12H11V9L15 13M5 20V16H7V18H17V10.19L12 5.69L7.21 10H4.22L12 3L22 12H19V20H5Z",serviceName:"return_to_base",disabled:!(0,h.uu)(t)})},v=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"vacuum"===(0,n.m)(i.entity_id)&&d.zz.some(t=>p(i,t))};class b extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"vacuum-commands"}}static async getConfigElement(){return await i.e(82230).then(i.bind(i,1109)),document.createElement("hui-vacuum-commands-card-feature-editor")}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_onCommandTap(t){t.stopPropagation();const e=t.target.entry;this.hass.callService("vacuum",e.serviceName,{entity_id:this._stateObj.entity_id})}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&v(this.hass,this.context)))return o.s6;const t=this._stateObj,e=this._config.commands??_;return o.qy` <ha-control-button-group> ${e.filter(e=>p(t,e)).map(e=>{const i=g[e](t);return o.qy` <ha-control-button .entry="${i}" .label="${this.hass.localize(`ui.dialogs.more_info_control.vacuum.${i.translationKey}`)}" @click="${this._onCommandTap}" .disabled="${i.disabled||t.state===c.Hh}"> <ha-svg-icon .path="${i.icon}"></ha-svg-icon> </ha-control-button> `})} </ha-control-button-group> `}static get styles(){return l.T}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],b.prototype,"_config",void 0),b=(0,s.Cg)([(0,a.EM)("hui-vacuum-commands-card-feature")],b)},31235(t,e,i){i.d(e,{B:()=>v});var s=i(62826),o=i(5124),a=i(22441),n=i(6412),r=i(89784),c=i(71727),h=i(52658),l=i(82286),d=(i(48374),i(28624),i(25094),i(67094),i(22675)),u=i(92326),_=i(49908);const p="M22 2V22H20V13H14.82A3 3 0 0 1 9.18 13H4V22H2V2H4V11H9.18A3 3 0 0 1 14.82 11H20V2Z",g="M4 22H2V2H4M22 2H20V22H22M11 4V9.18A3 3 0 0 0 11 14.82V20H13V14.82A3 3 0 0 0 13 9.18V4Z",v=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"valve"===(0,c.m)(i.entity_id)&&((0,l.$)(i,u.qm.OPEN)||(0,l.$)(i,u.qm.CLOSE))};class b extends o.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"valve-open-close"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}_onOpenValve(){this.hass.callService("valve","open_valve",{entity_id:this._stateObj.entity_id})}_onCloseValve(){this.hass.callService("valve","close_valve",{entity_id:this._stateObj.entity_id})}_onOpenTap(t){t.stopPropagation(),this._onOpenValve()}_onCloseTap(t){t.stopPropagation(),this._onCloseValve()}_onStopTap(t){t.stopPropagation(),this.hass.callService("valve","stop_valve",{entity_id:this._stateObj.entity_id})}_valueChanged(t){t.stopPropagation();t.target.checked?this._onOpenValve():this._onCloseValve()}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&v(this.hass,this.context)))return o.s6;const t=(0,h.Se)(this._stateObj,"open"),e=(0,h.Se)(this._stateObj,"closed"),i=g,s=p,a="open"===this._stateObj.state||"closing"===this._stateObj.state||"opening"===this._stateObj.state,c="closed"===this._stateObj.state;return this._stateObj.attributes.assumed_state||this._stateObj.state===d.HV?o.qy` <ha-control-button-group> ${(0,l.$)(this._stateObj,u.qm.CLOSE)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.valve.close_valve")}" @click="${this._onCloseTap}" .disabled="${!(0,u.hJ)(this._stateObj)}" class="${(0,n.H)({active:c})}" style="${(0,r.W)({"--color":e})}"> <ha-svg-icon .path="${p}"></ha-svg-icon> </ha-control-button> `:o.s6} ${(0,l.$)(this._stateObj,u.qm.STOP)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.valve.stop_valve")}" @click="${this._onStopTap}" .disabled="${!(0,u.lg)(this._stateObj)}"> <ha-svg-icon .path="${"M18,18H6V6H18V18Z"}"></ha-svg-icon> </ha-control-button> `:o.s6} ${(0,l.$)(this._stateObj,u.qm.OPEN)?o.qy` <ha-control-button .label="${this.hass.localize("ui.card.valve.open_valve")}" @click="${this._onOpenTap}" .disabled="${!(0,u.pc)(this._stateObj)}" class="${(0,n.H)({active:a})}" style="${(0,r.W)({"--color":t})}"> <ha-svg-icon .path="${g}"></ha-svg-icon> </ha-control-button> `:o.s6} </ha-control-button-group> `:o.qy` <ha-control-switch .pathOn="${i}" .pathOff="${s}" .checked="${a}" @change="${this._valueChanged}" .label="${this.hass.localize("ui.card.common.toggle")}" .disabled="${this._stateObj.state===d.Hh}"> </ha-control-switch> `}static get styles(){return[_.T,o.AH`ha-control-button.active{--control-button-icon-color:white;--control-button-background-color:var(--color);--control-button-background-opacity:1}`]}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],b.prototype,"context",void 0),(0,s.Cg)([(0,a.wk)()],b.prototype,"_config",void 0),b=(0,s.Cg)([(0,a.EM)("hui-valve-open-close-card-feature")],b)},34609(t,e,i){i.a(t,async function(t,s){try{i.d(e,{U:()=>m});var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(78870),h=i(53610),l=i(71727),d=i(47129),u=i(52658),_=i(82286),p=i(10223),g=i(22675),v=i(88827),b=i(92326),y=i(49908),f=t([p,h,v]);[p,h,v]=f.then?(await f)():f;const m=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"valve"===(0,l.m)(i.entity_id)&&(0,_.$)(i,b.qm.SET_POSITION)};class C extends a.WF{get _stateObj(){if(this.hass&&this.context&&this.context.entity_id)return this.hass.states[this.context.entity_id]}static getStubConfig(){return{type:"valve-position"}}setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}render(){if(!(this._config&&this.hass&&this.context&&this._stateObj&&m(this.hass,this.context)))return a.s6;const t=(0,d.a)(this._stateObj)?this._stateObj.attributes.current_position??0:0,e=Math.max(Math.round(t),0),i=(0,u.Se)(this._stateObj,"open"),s={"--feature-color":this.color?(0,c.MP)(this.color):(0,u.Se)(this._stateObj),"--state-valve-inactive-color":i};return a.qy` <ha-control-slider style="${(0,r.W)(s)}" .value="${e}" min="0" max="100" step="1" inverted show-handle @value-changed="${this._valueChanged}" .label="${(0,h.computeAttributeNameDisplay)(this.hass.localize,this._stateObj,this.hass.entities,"current_position")}" .disabled="${this._stateObj.state===g.Hh}" .unit="${v.rM.valve.current_position}" .locale="${this.hass.locale}"></ha-control-slider> `}_valueChanged(t){const{value:e}=t.detail;"number"!=typeof e||isNaN(e)||this.hass.callService("valve","set_valve_position",{entity_id:this._stateObj.entity_id,position:e})}static get styles(){return y.T}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"context",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"color",void 0),(0,o.Cg)([(0,n.wk)()],C.prototype,"_config",void 0),C=(0,o.Cg)([(0,n.EM)("hui-valve-position-card-feature")],C),s()}catch(t){s(t)}})},25232(t,e,i){i.d(e,{c:()=>l});var s=i(62826),o=i(22441),a=i(92326),n=i(84337),r=i(55719),c=i(32181);const h={domain:"valve",supportsPosition:a.sA,getFavoritePositions:t=>t?.options?.valve?.favorite_positions,getCurrentValue:t=>t.attributes.current_position,normalizeFavoritePositions:n.S,defaultFavoritePositions:a.ph,setPositionService:"set_valve_position",serviceDataKey:"position",setPositionLabelKey:"ui.dialogs.more_info_control.valve.favorite_position.set",featureLabelKey:"ui.panel.lovelace.editor.features.types.valve-position-favorite.label"},l=(t,e)=>(0,r.s)(t,e,h);class d extends r.N{get _definition(){return h}static getStubConfig(){return{type:"valve-position-favorite"}}}d.getConfigElement=c.C,d=(0,s.Cg)([(0,o.EM)("hui-valve-position-favorite-card-feature")],d)},75781(t,e,i){i.a(t,async function(t,s){try{i.d(e,{Y:()=>_});i(18111),i(61701);var o=i(62826),a=i(22441),n=i(71727),r=i(52658),c=i(62091),h=i(98071),l=i(48555),d=t([l]);l=(d.then?(await d)():d)[0];const u="M8 2C6.89 2 6 2.89 6 4V16C6 17.11 6.89 18 8 18H9V20H6V22H9C10.11 22 11 21.11 11 20V18H13V20C13 21.11 13.89 22 15 22H18V20H15V18H16C17.11 18 18 17.11 18 16V4C18 2.89 17.11 2 16 2H8M12 4.97A2 2 0 0 1 14 6.97A2 2 0 0 1 12 8.97A2 2 0 0 1 10 6.97A2 2 0 0 1 12 4.97M10 14.5H14V16H10V14.5Z",_=(t,e)=>{const i=e.entity_id?t.states[e.entity_id]:void 0;if(!i)return!1;return"water_heater"===(0,n.m)(i.entity_id)};class p extends l.n{get _configuredModes(){return this._config?.operation_modes}get _label(){return this.hass.localize("ui.card.water_heater.mode")}get _controlSelectStyle(){if(this._stateObj)return{"--control-select-color":(0,r.Se)(this._stateObj)}}static getStubConfig(){return{type:"water-heater-operation-modes"}}static async getConfigElement(){return await i.e(97504).then(i.bind(i,26691)),document.createElement("hui-water-heater-operation-modes-card-feature-editor")}_getValue(t){return t.state}_getOptions(){if(!this._stateObj||!this.hass)return[];const t=(this._stateObj.attributes.operation_list||[]).concat().sort(c.im).reverse();return(0,h.P)(t,this._config?.operation_modes).map(t=>({value:t,label:this.hass.formatEntityState(this._stateObj,t)}))}_isSupported(){return!!(this.hass&&this.context&&_(this.hass,this.context))}constructor(...t){super(...t),this._attribute="operation_mode",this._modesAttribute="operation_list",this._dropdownIconPath=u,this._serviceDomain="water_heater",this._serviceAction="set_operation_mode",this._defaultStyle="icons"}}p=(0,o.Cg)([(0,a.EM)("hui-water-heater-operation-modes-card-feature")],p),s()}catch(t){s(t)}})},37531(t,e,i){i.d(e,{HA:()=>o,Ry:()=>n,Ut:()=>r,mJ:()=>s,zz:()=>a});const s=["turn_on","turn_off","media_play","media_pause","media_play_pause","media_stop","media_previous_track","media_next_track","volume_down","volume_up","volume_mute","shuffle","repeat"],o=["decrement","reset","increment"],a=["start_pause","stop","clean_spot","locate","return_home"],n=["start_pause","dock"],r=["light","fan","cover-shutter","cover-blind","cover-curtain","cover-shade","cover-awning","cover-garage","cover-gate","cover-door","cover-window","cover-damper","switch"]},13632(t,e,i){i.d(e,{B:()=>o});i(74423),i(44114);var s=i(71727);const o=(t,e,i,a,n,r)=>{const c=[];n?.length&&c.push(t=>n.includes((0,s.m)(t))),r&&c.push(e=>t.states[e]&&r(t.states[e]));const h=((t,e,i)=>{(!i||i>t.length)&&(i=t.length);const s=[];for(let o=0;o<t.length&&s.length<i;o++){let i=!0;for(const s of e)if(!s(t[o])){i=!1;break}i&&s.push(t[o])}return s})(i,c,e);if(h.length<e&&a.length){const i=o(t,e-h.length,a,[],n,r);h.push(...i)}return h}},18721(t,e,i){i.d(e,{G:()=>o,a:()=>a});i(44114),i(18111),i(22489),i(7588),i(61701);var s=i(34218);const o=(t,e,i,o,a,n=!1)=>{t=t.filter(t=>!Number.isNaN(t[1]));return((t,e,i,s)=>{if(0===t.length)return{points:[],yAxisOrigin:i};let o=i,a=s?.minY??t[0][1],n=s?.maxY??t[0][1];const r=s?.minX??t[0][0],c=s?.maxX??t[t.length-1][0];t.forEach(([t,e])=>{e<a?a=e:e>n&&(n=e)});const h=n-a||.1*a;n+=.1*h,a-=.1*h,n<0?(n=Math.min(0,n),o=0):a<0?o=n/(n-a||1)*i:a=Math.max(0,a);const l=n-a||1,d=c-r||1,u=t.map(t=>[(t[0]-r)/d*e,i-(t[1]-a)/l*i]);return u.push([e,u[u.length-1][1]]),{points:u,yAxisOrigin:o}})((0,s.P)(t,o,a?.minX,a?.maxX,n),e,i,a)},a=(t,e,i,s,a,n=!1)=>{if(!t?.length)return{points:[],yAxisOrigin:0};const r=t.map(t=>[1e3*t.lu,Number(t.s)]);return o(r,e,i,s,a,n)}},96332(t,e,i){i.d(e,{O:()=>s});const s={view_columns:"M4 5V18H21V5H4M14 7V16H11V7H14M6 7H9V16H6V7M19 16H16V7H19V16Z",location:"M12,11.5A2.5,2.5 0 0,1 9.5,9A2.5,2.5 0 0,1 12,6.5A2.5,2.5 0 0,1 14.5,9A2.5,2.5 0 0,1 12,11.5M12,2A7,7 0 0,0 5,9C5,14.25 12,22 12,22C12,22 19,14.25 19,9A7,7 0 0,0 12,2Z",numeric_state:"M4,17V9H2V7H6V17H4M22,15C22,16.11 21.1,17 20,17H16V15H20V13H18V11H20V9H16V7H20A2,2 0 0,1 22,9V10.5A1.5,1.5 0 0,1 20.5,12A1.5,1.5 0 0,1 22,13.5V15M14,15V17H8V13C8,11.89 8.9,11 10,11H12V9H8V7H12A2,2 0 0,1 14,9V11C14,12.11 13.1,13 12,13H10V15H14Z",state:"M6.27 17.05C6.72 17.58 7 18.25 7 19C7 20.66 5.66 22 4 22S1 20.66 1 19 2.34 16 4 16C4.18 16 4.36 16 4.53 16.05L7.6 10.69L5.86 9.7L9.95 8.58L11.07 12.67L9.33 11.68L6.27 17.05M20 16C18.7 16 17.6 16.84 17.18 18H11V16L8 19L11 22V20H17.18C17.6 21.16 18.7 22 20 22C21.66 22 23 20.66 23 19S21.66 16 20 16M12 8C12.18 8 12.36 8 12.53 7.95L15.6 13.31L13.86 14.3L17.95 15.42L19.07 11.33L17.33 12.32L14.27 6.95C14.72 6.42 15 5.75 15 5C15 3.34 13.66 2 12 2S9 3.34 9 5 10.34 8 12 8Z",screen:"M4,6V16H9V12A2,2 0 0,1 11,10H16A2,2 0 0,1 18,12V16H20V6H4M0,20V18H4A2,2 0 0,1 2,16V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V16A2,2 0 0,1 20,18H24V20H18V20C18,21.11 17.1,22 16,22H11A2,2 0 0,1 9,20H9L0,20M11.5,20A0.5,0.5 0 0,0 11,20.5A0.5,0.5 0 0,0 11.5,21A0.5,0.5 0 0,0 12,20.5A0.5,0.5 0 0,0 11.5,20M15.5,20A0.5,0.5 0 0,0 15,20.5A0.5,0.5 0 0,0 15.5,21A0.5,0.5 0 0,0 16,20.5A0.5,0.5 0 0,0 15.5,20M13,20V21H14V20H13M11,12V19H16V12H11Z",time:"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z",user:"M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z",and:"M4.4,16.5C4.4,15.6 4.7,14.7 5.2,13.9C5.7,13.1 6.7,12.2 8.2,11.2C7.3,10.1 6.8,9.3 6.5,8.7C6.1,8 6,7.4 6,6.7C6,5.2 6.4,4.1 7.3,3.2C8.2,2.3 9.4,2 10.9,2C12.2,2 13.3,2.4 14.2,3.2C15.1,4 15.5,5 15.5,6.1C15.5,6.9 15.3,7.6 14.9,8.3C14.5,9 13.8,9.7 12.8,10.4L11.4,11.5L15.7,16.7C16.3,15.5 16.6,14.3 16.6,12.8H18.8C18.8,15.1 18.3,17 17.2,18.5L20,21.8H17L15.7,20.3C15,20.9 14.3,21.3 13.4,21.6C12.5,21.9 11.6,22.1 10.7,22.1C8.8,22.1 7.3,21.6 6.1,20.6C5,19.5 4.4,18.2 4.4,16.5M10.7,20C12,20 13.2,19.5 14.3,18.5L9.6,12.8L9.2,13.1C7.7,14.2 7,15.3 7,16.5C7,17.6 7.3,18.4 8,19C8.7,19.6 9.5,20 10.7,20M8.5,6.7C8.5,7.6 9,8.6 10.1,9.9L11.7,8.8C12.3,8.4 12.7,8 12.9,7.6C13.1,7.2 13.2,6.7 13.2,6.2C13.2,5.6 13,5.1 12.5,4.7C12.1,4.3 11.5,4.1 10.8,4.1C10.1,4.1 9.5,4.3 9.1,4.8C8.7,5.3 8.5,5.9 8.5,6.7Z",not:"M14.08,4.61L15.92,5.4L14.8,8H19V10H13.95L12.23,14H19V16H11.38L9.92,19.4L8.08,18.61L9.2,16H5V14H10.06L11.77,10H5V8H12.63L14.08,4.61Z",or:"M2,4C5,10 5,14 2,20H8C13,20 19,16 22,12C19,8 13,4 8,4H2M5,6H8C11.5,6 16.3,9 19.3,12C16.3,15 11.5,18 8,18H5C6.4,13.9 6.4,10.1 5,6Z"}},21824(t,e,i){i(18111),i(61701);var s=i(62826),o=i(5124),a=i(22441),n=i(71769),r=i(17399);i(22489);const c=(t,e,i,s)=>[(t-i)/2+i,(e-s)/2+s];class h extends o.WF{render(){const t=this.clientWidth||500,e=this.clientHeight||t/5,i=this.yAxisOrigin??e,s=(this._displayCoordinates&&(t=>{if(!t.length)return"";let e,i,s="",o=t.filter(Boolean)[0];s+=`M ${o[0]},${o[1]}`;for(const a of t)e=a,i=c(o[0],o[1],e[0],e[1]),s+=` ${i[0]},${i[1]}`,s+=` Q${e[0]},${e[1]}`,o=e;return s+=` ${e[0]},${e[1]}`,s})(this._displayCoordinates))??(this.loading?`M 0,${e/2} L ${t},${e/2}`:void 0),a=this._displayCoordinates?.length?this._displayCoordinates[this._displayCoordinates.length-1][0]:t;if(!s)return o.qy` ${o.JW`<svg width="100%" height="100%" viewBox="0 0 ${t} ${e}"></svg>`} `;const n=this.loading&&!this._reducedMotion,r=`${this._uniqueId}-shimmer`,h=`${this._uniqueId}-gradient`,l=this.gradient,d=n?`url(#${r})`:l?`url(#${h})`:"var(--accent-color)";return o.qy` ${o.JW`<svg width="100%" height="100%" viewBox="0 0 ${t} ${e}" preserveAspectRatio="none"> ${n?o.JW`<defs> <linearGradient id="${r}" x1="-50%" x2="-30%" y1="0" y2="0"> <stop offset="0%" stop-color="var(--accent-color)"/> <stop offset="50%" stop-color="white"/> <stop offset="100%" stop-color="var(--accent-color)"/> <animate attributeName="x1" values="-50%;120%" dur="1.8s" repeatCount="indefinite"/> <animate attributeName="x2" values="-30%;140%" dur="1.8s" repeatCount="indefinite"/> </linearGradient> </defs>`:l?o.JW`<defs> <linearGradient id="${h}" gradientUnits="userSpaceOnUse" x1="${l.x1}" y1="${l.y1}" x2="${l.x2}" y2="${l.y2}"> ${l.stops.map(t=>o.JW`<stop offset="${t.offset}" style="stop-color:${t.color}"></stop>`)} </linearGradient> </defs>`:o.s6} <g> <mask id="${this._uniqueId}-fill"> <path class="fill" fill="white" d="${s} L ${a}, ${i} L 0, ${i} z"/> </mask> <rect height="100%" width="100%" fill="${d}" mask="url(#${this._uniqueId}-fill)"></rect> <mask id="${this._uniqueId}-line"> <path vector-effect="non-scaling-stroke" class="line" fill="none" stroke="white" stroke-width="${2}" stroke-linecap="round" stroke-linejoin="round" d="${s}"></path> </mask> <rect height="100%" width="100%" fill="${d}" mask="url(#${this._uniqueId}-line)"></rect> </g> </svg>`} `}connectedCallback(){super.connectedCallback(),this._unsubMediaQuery=(0,n.m)("(prefers-reduced-motion: reduce)",t=>{this._reducedMotion!==t&&(this._reducedMotion=t)})}willUpdate(t){this.coordinates&&t.has("coordinates")&&this._setCoordinates(this.coordinates)}disconnectedCallback(){super.disconnectedCallback(),this._unsubMediaQuery?.(),this._unsubMediaQuery=void 0,this._cancelAnimation()}_setCoordinates(t){this._cancelAnimation();const e=this._displayCoordinates;if(!e||t.length<2)return void(this._displayCoordinates=t);const i=(0,r.W)(getComputedStyle(this).getPropertyValue("--ha-animation-duration-slow"));if(i<=1)return void(this._displayCoordinates=t);const s=t.map(t=>[t[0],this._interpolateY(e,t[0])]),o=performance.now(),a=e=>{const n=Math.min((e-o)/i,1),r=1-(1-n)**3;this._displayCoordinates=t.map((t,e)=>[t[0],s[e][1]+(t[1]-s[e][1])*r]),this._animationFrame=n<1?requestAnimationFrame(a):void 0};this._animationFrame=requestAnimationFrame(a)}_interpolateY(t,e){if(!t.length)return 0;if(e<=t[0][0])return t[0][1];for(let i=1;i<t.length;i++){const s=t[i];if(e>s[0])continue;const o=t[i-1],a=s[0]-o[0];if(!a)return s[1];const n=(e-o[0])/a;return o[1]+(s[1]-o[1])*n}return t[t.length-1][1]}_cancelAnimation(){void 0!==this._animationFrame&&(cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}constructor(...t){super(...t),this.loading=!1,this._uniqueId=`graph-${Math.random().toString(36).substring(2,9)}`,this._reducedMotion=!1}}h.styles=o.AH`:host{display:flex;width:100%;height:100%}.line{opacity:.8}.fill{opacity:.1}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"coordinates",void 0),(0,s.Cg)([(0,a.MZ)({attribute:"y-axis-origin",type:Number})],h.prototype,"yAxisOrigin",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],h.prototype,"loading",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],h.prototype,"gradient",void 0),(0,s.Cg)([(0,a.wk)()],h.prototype,"_displayCoordinates",void 0),(0,s.Cg)([(0,a.wk)()],h.prototype,"_reducedMotion",void 0),h=(0,s.Cg)([(0,a.EM)("hui-graph-base")],h)},47046(t,e,i){var s=i(62826),o=i(5124),a=i(22441);i(67094);class n extends o.WF{render(){return o.qy` <ha-svg-icon .path="${"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16"}" .title="${this.label}"></ha-svg-icon> `}}n.styles=o.AH`ha-svg-icon{color:var(--warning-color)}`,(0,s.Cg)([(0,a.MZ)()],n.prototype,"label",void 0),n=(0,s.Cg)([(0,a.EM)("hui-warning-element")],n)},13174(t,e,i){i.a(t,async function(t,s){try{i.d(e,{L:()=>z,h:()=>P});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var o=i(50179),a=(i(89807),i(11865)),n=i(85032),r=i(47547),c=i(66102),h=i(89156),l=(i(3453),i(81210),i(31095),i(1248)),d=(i(19300),i(57251),i(35598)),u=i(58500),_=i(44772),p=(i(44577),i(5817)),g=i(67034),v=i(13028),b=(i(30277),i(38409),i(339)),y=i(67142),f=(i(74049),i(5375),i(14312),i(29175),i(26671)),m=i(61691),C=i(71982),w=i(91282),x=i(73269),$=i(29106),M=i(57484),H=i(95605),O=(i(77799),i(52494)),k=(i(65115),i(31235),i(25232),i(34609)),A=i(75781),V=i(7349),j=i(38098),E=i(14501),L=i(58467),S=i(45429),q=i(34128),Z=t([o,a,n,r,c,h,l,d,u,_,p,g,v,b,y,f,m,C,w,x,$,M,H,O,k,A,V,j,E,L,S]);[o,a,n,r,c,h,l,d,u,_,p,g,v,b,y,f,m,C,w,x,$,M,H,O,k,A,V,j,E,L,S]=Z.then?(await Z)():Z;const T=new Set(["alarm-modes","area-controls","bar-gauge","button","climate-fan-modes","climate-swing-modes","climate-swing-horizontal-modes","climate-hvac-modes","climate-preset-modes","counter-actions","cover-open-close","cover-position-favorite","cover-position","cover-tilt-favorite","cover-tilt-position","cover-tilt","date-set","fan-direction","fan-oscillate","fan-preset-modes","fan-speed","humidifier-modes","humidifier-toggle","lawn-mower-commands","light-brightness","light-color-temp","light-color-favorites","lock-commands","lock-open-door","media-player-playback","media-player-sound-mode","media-player-source","media-player-volume-buttons","media-player-volume-slider","numeric-input","precipitation-forecast","select-options","trend-graph","target-humidity","target-temperature","temperature-forecast","toggle","update-actions","vacuum-commands","valve-open-close","valve-position-favorite","valve-position","water-heater-operation-modes"]),z=t=>(0,q.Ue)("card-feature",t,T),P=t=>(0,q.gh)(t,"card-feature",T);s()}catch(t){s(t)}})},72669(t,e,i){i.a(t,async function(t,s){try{i.d(e,{E:()=>c,U:()=>h});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(90285);var o=i(16678),a=i(34128),n=t([o]);o=(n.then?(await n)():n)[0];const r=new Set(["error","entity","button"]),c=t=>(0,a.Ue)("heading-badge",t,r,void 0,void 0,"entity"),h=t=>(0,a.gh)(t,"heading-badge",r);s()}catch(t){s(t)}})},82747(t,e,i){i.d(e,{$:()=>s});const s=(0,i(35211).q6)("conditions-entity-context")},11839(t,e,i){i.d(e,{M:()=>s,Q:()=>o});const s="__current_entity__",o=(t,e,i)=>({id:s,primary:t("ui.panel.lovelace.editor.condition-editor.condition.state.current_entity"),secondary:i??e,entity_id:e,hide_clear:!0})},98204(t,e,i){i.a(t,async function(t,s){try{i.d(e,{t:()=>T});i(74423),i(18111),i(61701),i(13579);var o=i(62826),a=(i(68825),i(35211)),n=i(34271),r=i(5124),c=i(22441),h=i(87047),l=i(93905),d=i(69558),u=i(1087),_=i(57237),p=i(78978),g=i(7822),v=(i(78486),i(38962)),b=(i(76776),i(29823)),y=(i(70947),i(11382),i(26300)),f=(i(67094),i(34127)),m=i(10763),C=i(65063),w=i(14503),x=i(96332),$=i(14487),M=i(82747),H=t([g,v,b,y,f,m,$,h]);[g,v,b,y,f,m,$,h]=H.then?(await H)():H;const O="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",k="M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",A="M11,17H4A2,2 0 0,1 2,15V3A2,2 0 0,1 4,1H16V3H4V15H11V13L15,16L11,19V17M19,21V7H8V13H6V7A2,2 0 0,1 8,5H19A2,2 0 0,1 21,7V21A2,2 0 0,1 19,23H8A2,2 0 0,1 6,21V19H8V21H19Z",V="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",j="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",E="M6,22A3,3 0 0,1 3,19C3,18.4 3.18,17.84 3.5,17.37L9,7.81V6A1,1 0 0,1 8,5V4A2,2 0 0,1 10,2H14A2,2 0 0,1 16,4V5A1,1 0 0,1 15,6V7.81L20.5,17.37C20.82,17.84 21,18.4 21,19A3,3 0 0,1 18,22H6M5,19A1,1 0 0,0 6,20H18A1,1 0 0,0 19,19C19,18.79 18.93,18.59 18.82,18.43L16.53,14.47L14,17L8.93,11.93L5.18,18.43C5.07,18.59 5,18.79 5,19M13,10A1,1 0 0,0 12,11A1,1 0 0,0 13,12A1,1 0 0,0 14,11A1,1 0 0,0 13,10Z",L="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z",S=["state","numeric_state"],q=["and","or","not"],Z=(t,e)=>S.includes(t)&&e,T=(t,e)=>Z(t,e)?`ha-card-condition-${t}-no_entity`:`ha-card-condition-${t}`,z=(t,e)=>e&&q.includes(t.condition)&&!0===t.conditions?.some(t=>S.includes(t.condition));class P extends r.WF{get _noEntity(){return"filter"===this._entityContext?.mode}get _editor(){if(this._condition)return customElements.get(T(this._condition.condition,this._noEntity))}expand(){this.updateComplete.then(()=>{this.shadowRoot.querySelector("ha-expansion-panel").expanded=!0})}_setupConditionListeners(){this._listeners.setup(this.condition?[this.condition]:[],this.hass,()=>this._evaluateLiveTest())}willUpdate(t){if(t.has("condition")){this._condition={condition:"state",...this.condition};const t=this._editor?.validateUIConfig;if(t)try{t(this._condition,this.hass),this._uiAvailable=!0,this._uiWarnings=[]}catch(t){this._uiWarnings=(0,p._)(this.hass,t).warnings,this._uiAvailable=!1}else this._uiAvailable=!1,this._uiWarnings=[];this._uiAvailable||this._yamlMode||(this._yamlMode=!0),this._setupConditionListeners()}(t.has("condition")||t.has("hass"))&&this._evaluateLiveTest()}updated(t){t.has("_entityContext")&&this._evaluateLiveTest()}_evaluateLiveTest(){if(!this.condition||!this._condition)return void(this._liveTestResult={state:"unknown"});if(Z(this._condition.condition,this._noEntity)||z(this._condition,this._noEntity))return void(this._liveTestResult={state:"unknown",message:this.hass.localize("ui.panel.lovelace.editor.condition-editor.live_test_state.unknown")});if(!(0,$.db)([this.condition]))return void(this._liveTestResult={state:"invalid",message:this.hass.localize("ui.panel.lovelace.editor.condition-editor.live_test_state.invalid")});const t="current"===this._entityContext?.mode?{entity_id:this._entityContext.entityId}:{},e=(0,$.XH)([this.condition],this.hass,t);this._liveTestResult={state:e?"pass":"fail",message:this.hass.localize("ui.panel.lovelace.editor.condition-editor.live_test_state."+(e?"pass":"fail"))}}render(){const t=this._condition;if(!t)return r.s6;const e=Z(t.condition,this._noEntity)||z(t,this._noEntity);return r.qy` <div class="container"> <ha-expansion-panel left-chevron> <div id="condition-icon" class="icon-badge-wrapper" slot="leading-icon"> <ha-svg-icon .path="${x.O[t.condition]}"></ha-svg-icon> ${e?r.s6:r.qy`<ha-automation-row-live-test .state="${this._liveTestResult.state}" .label="${this.hass.localize(`ui.panel.lovelace.editor.condition-editor.live_test_state.${this._liveTestResult.state}`)}"></ha-automation-row-live-test>`} </div> ${!e&&this._liveTestResult.message?r.qy`<ha-tooltip for="condition-icon" slot="leading-icon">${this._liveTestResult.message}</ha-tooltip>`:r.s6} <h3 slot="header"> ${this.hass.localize(`ui.panel.lovelace.editor.condition-editor.condition.${t.condition}.label`)||t.condition} </h3> <ha-automation-row-event-chip .show="${void 0!==this._testingResult}" .variant="${this._testingResult?"success":"warning"}" slot="event" class="event-chip" aria-live="polite"> ${this._testingResult?this.hass.localize("ui.panel.lovelace.editor.condition-editor.testing_pass"):this.hass.localize("ui.panel.lovelace.editor.condition-editor.testing_error")} </ha-automation-row-event-chip> <ha-dropdown slot="icons" @wa-select="${this._handleAction}" @click="${_.d}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${j}"> </ha-icon-button> ${Z(t.condition,this._noEntity)||z(t,this._noEntity)?r.s6:r.qy`<ha-dropdown-item value="test"> ${this.hass.localize("ui.panel.lovelace.editor.condition-editor.test")} <ha-svg-icon slot="icon" .path="${E}"></ha-svg-icon> </ha-dropdown-item>`} <ha-dropdown-item value="duplicate"> ${this.hass.localize("ui.panel.lovelace.editor.edit_card.duplicate")} <ha-svg-icon slot="icon" .path="${A}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="copy"> ${this.hass.localize("ui.panel.lovelace.editor.edit_card.copy")} <ha-svg-icon slot="icon" .path="${O}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="cut"> ${this.hass.localize("ui.panel.lovelace.editor.edit_card.cut")} <ha-svg-icon slot="icon" .path="${k}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="toggle_yaml" .disabled="${!this._uiAvailable}"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.edit_"+(this._yamlMode?"ui":"yaml"))} <ha-svg-icon slot="icon" .path="${L}"></ha-svg-icon> </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item variant="danger" value="delete"> ${this.hass.localize("ui.common.delete")} <ha-svg-icon slot="icon" .path="${V}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> ${this._uiAvailable?r.s6:r.qy` <ha-alert alert-type="warning" .title="${this.hass.localize("ui.errors.config.editor_not_supported")}"> ${this._uiWarnings.length>0&&void 0!==this._uiWarnings[0]?r.qy` <ul> ${this._uiWarnings.map(t=>r.qy`<li>${t}</li>`)} </ul> `:r.s6} ${this.hass.localize("ui.errors.config.edit_in_yaml_supported")} </ha-alert> `} <div class="content"> ${this._yamlMode?r.qy` <ha-yaml-editor .defaultValue="${this.condition}" @value-changed="${this._onYamlChange}"></ha-yaml-editor> `:r.qy` ${(0,d._)(T(t.condition,this._noEntity),{hass:this.hass,condition:t})} `} </div> </ha-expansion-panel> </div> `}async _handleAction(t){const e=t.detail.item.value;if(void 0!==e)switch(e){case"test":return void await this._testCondition();case"duplicate":return void this._duplicateCondition();case"copy":return void this._copyCondition();case"cut":return void this._cutCondition();case"toggle_yaml":return void(this._yamlMode=!this._yamlMode);case"delete":this._delete()}}async _testCondition(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=void 0),this._testingResult=void 0;const t=this.condition;if(!(0,$.db)([this.condition]))return void(0,C.showAlertDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.condition-editor.invalid_config_title"),text:this.hass.localize("ui.panel.lovelace.editor.condition-editor.invalid_config_text")});const e="current"===this._entityContext?.mode?{entity_id:this._entityContext.entityId}:{};this._testingResult=(0,$.XH)([t],this.hass,e),this._timeout=window.setTimeout(()=>{this._testingResult=void 0},2500)}_duplicateCondition(){(0,u.r)(this,"duplicate-condition",{value:(0,n.A)(this.condition)})}_copyCondition(){this._clipboard=(0,n.A)(this.condition)}_cutCondition(){this._copyCondition(),this._delete()}_onYamlChange(t){t.stopPropagation(),t.detail.isValid&&(0,u.r)(this,"value-changed",{value:t.detail.value})}constructor(...t){super(...t),this._yamlMode=!1,this._uiAvailable=!1,this._uiWarnings=[],this._liveTestResult={state:"unknown"},this._listeners=new h.x(this),this._delete=()=>{(0,u.r)(this,"value-changed",{value:null})}}}P.styles=[w.RF,r.AH`ha-dropdown{--mdc-theme-text-primary-on-background:var(--primary-text-color)}ha-expansion-panel{--expansion-panel-summary-padding:0 0 0 8px;--expansion-panel-content-padding:0}.icon-badge-wrapper{display:inline-flex;position:relative;color:var(--secondary-text-color);opacity:.9}h3{margin:0;font-size:inherit;font-weight:inherit}.content{padding:12px}.disabled{opacity:.5;pointer-events:none}.event-chip{position:absolute;inset-inline-end:40px}.container{position:relative;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border:1px solid var(--divider-color)}`],(0,o.Cg)([(0,c.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,o.Cg)([(0,c.MZ)({attribute:!1})],P.prototype,"condition",void 0),(0,o.Cg)([(0,c.wk)(),(0,a.Fg)({context:M.$,subscribe:!0})],P.prototype,"_entityContext",void 0),(0,o.Cg)([(0,l.I)({key:"dashboardConditionClipboard",state:!1,subscribe:!1,storage:"sessionStorage"})],P.prototype,"_clipboard",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_yamlMode",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_uiAvailable",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_uiWarnings",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_condition",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_testingResult",void 0),(0,o.Cg)([(0,c.wk)()],P.prototype,"_liveTestResult",void 0),P=(0,o.Cg)([(0,c.EM)("ha-card-condition-editor")],P),s()}catch(t){s(t)}})},13898(t,e,i){i.a(t,async function(t,e){try{i(44114),i(18111),i(61701);var s=i(62826),o=i(35211),a=i(34271),n=i(5124),r=i(22441),c=i(93905),h=i(1087),l=i(18350),d=i(29823),u=(i(70947),i(67094),i(96332)),_=i(82747),p=i(98204),g=i(82450),v=i(40224),b=i(63518),y=i(12506),f=i(39208),m=i(85726),C=i(41343),w=i(54262),x=i(75076),$=i(9618),M=i(82884),H=t([l,d,g,v,b,y,f,m,C,w,x,$,M,p]);[l,d,g,v,b,y,f,m,C,w,x,$,M,p]=H.then?(await H)():H;const O="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",k="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",A=["location","numeric_state","state","screen","time","user","and","not","or"];class V extends n.WF{get _noEntity(){return"filter"===this._entityContext?.mode}firstUpdated(){if(1===this.conditions.length){const t=this.shadowRoot.querySelector("ha-card-condition-editor");t.updateComplete.then(()=>{t.expand()})}}updated(t){if(t.has("conditions")&&this._focusLastConditionOnChange){this._focusLastConditionOnChange=!1;const t=this.shadowRoot.querySelector("ha-card-condition-editor:last-of-type");t.updateComplete.then(()=>{t.expand(),t.scrollIntoView(),t.focus()})}}render(){return n.qy` <div class="conditions"> ${this.conditions.map((t,e)=>n.qy` <ha-card-condition-editor .index="${e}" @duplicate-condition="${this._duplicateCondition}" @value-changed="${this._conditionChanged}" .hass="${this.hass}" .condition="${t}"></ha-card-condition-editor> `)} <div> <ha-dropdown @wa-select="${this._addCondition}"> <ha-button slot="trigger" appearance="filled"> <ha-svg-icon .path="${k}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.lovelace.editor.condition-editor.add")} </ha-button> ${this._clipboard?n.qy` <ha-dropdown-item value="paste"> ${this.hass.localize("ui.panel.lovelace.editor.edit_card.paste_condition")} <ha-svg-icon slot="icon" .path="${O}"></ha-svg-icon> </ha-dropdown-item> `:n.s6} ${A.map(t=>n.qy` <ha-dropdown-item .value="${t}"> ${this.hass.localize(`ui.panel.lovelace.editor.condition-editor.condition.${t}.label`)||t} <ha-svg-icon slot="icon" .path="${u.O[t]}"></ha-svg-icon> </ha-dropdown-item> `)} </ha-dropdown> </div> </div> `}_addCondition(t){const e=t.detail.item.value,i=[...this.conditions];if(e&&("paste"!==e||this._clipboard)){if("paste"===e){const t=(0,a.A)(this._clipboard);i.push(t)}else{const t=customElements.get((0,p.t)(e,this._noEntity)),s=t?.defaultConfig;i.push(s?{...s}:{condition:e})}this._focusLastConditionOnChange=!0,(0,h.r)(this,"value-changed",{value:i})}}_duplicateCondition(t){const e=[...this.conditions];e.push(t.detail.value),(0,h.r)(this,"value-changed",{value:e})}_conditionChanged(t){t.stopPropagation();const e=[...this.conditions],i=t.detail.value,s=t.target.index;null===i?e.splice(s,1):e[s]=i,(0,h.r)(this,"value-changed",{value:e})}static get styles(){return[n.AH`ha-alert{display:block;margin-top:12px}ha-card-condition-editor{display:block;margin-top:12px;scroll-margin-top:48px}ha-dropdown{display:inline-block;margin-top:var(--ha-space-3)}`]}constructor(...t){super(...t),this._focusLastConditionOnChange=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],V.prototype,"hass",void 0),(0,s.Cg)([(0,c.I)({key:"dashboardConditionClipboard",state:!1,subscribe:!1,storage:"sessionStorage"})],V.prototype,"_clipboard",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],V.prototype,"conditions",void 0),(0,s.Cg)([(0,r.wk)(),(0,o.Fg)({context:_.$,subscribe:!0})],V.prototype,"_entityContext",void 0),V=(0,s.Cg)([(0,r.EM)("ha-card-conditions-editor")],V),e()}catch(t){e(t)}})},82450(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(63533),r=i(1087),c=i(52763),h=i(13898),l=t([c,h]);[c,h]=l.then?(await l)():l;const d=(0,n.Ik)({condition:(0,n.eu)("and"),conditions:(0,n.lq)((0,n.YO)((0,n.bz)()))});class u extends o.WF{static get defaultConfig(){return{condition:"and",conditions:[]}}static validateUIConfig(t){return(0,n.vA)(t,d)}render(){return o.qy` <ha-card-conditions-editor nested .hass="${this.hass}" .conditions="${this.condition.conditions}" @value-changed="${this._valueChanged}"> </ha-card-conditions-editor> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value,i={...this.condition,conditions:e};(0,r.r)(this,"value-changed",{value:i})}constructor(...t){super(...t),this.disabled=!1}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],u.prototype,"disabled",void 0),u=(0,s.Cg)([(0,a.EM)("ha-card-condition-and")],u),e()}catch(t){e(t)}})},40224(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(63533),r=i(1087),c=(i(30716),i(59646)),h=(i(8630),i(52763)),l=t([c,h]);[c,h]=l.then?(await l)():l;const d=(0,n.Ik)({condition:(0,n.eu)("location"),locations:(0,n.YO)((0,n.Yj)())}),u=[{name:"locations",selector:{state:{entity_id:"person.whomever",hide_states:["unavailable","unknown"],multiple:!0}}}];class _ extends o.WF{static get defaultConfig(){return{condition:"location",locations:[]}}static validateUIConfig(t){return(0,n.vA)(t,d)}render(){return o.qy` <ha-form .hass="${this.hass}" .data="${this.condition}" .schema="${u}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value.locations,i={...this.condition,locations:e};(0,r.r)(this,"value-changed",{value:i})}constructor(...t){super(...t),this.disabled=!1,this._computeLabelCallback=t=>"locations"===t.name?this.hass.localize("ui.panel.lovelace.editor.condition-editor.condition.location.locations"):"",this._computeHelperCallback=t=>"locations"===t.name?this.hass.localize("ui.panel.lovelace.editor.condition-editor.condition.location.locations_helper"):""}}_.styles=o.AH`:host{display:block}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],_.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],_.prototype,"disabled",void 0),_=(0,s.Cg)([(0,a.EM)("ha-card-condition-location")],_),e()}catch(t){e(t)}})},63518(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(63533),r=i(1087),c=i(52763),h=i(13898),l=t([c,h]);[c,h]=l.then?(await l)():l;const d=(0,n.Ik)({condition:(0,n.eu)("not"),conditions:(0,n.lq)((0,n.YO)((0,n.bz)()))});class u extends o.WF{static get defaultConfig(){return{condition:"not",conditions:[]}}static validateUIConfig(t){return(0,n.vA)(t,d)}render(){return o.qy` <ha-card-conditions-editor nested .hass="${this.hass}" .conditions="${this.condition.conditions}" @value-changed="${this._valueChanged}"> </ha-card-conditions-editor> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value,i={...this.condition,conditions:e};(0,r.r)(this,"value-changed",{value:i})}constructor(...t){super(...t),this.disabled=!1}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],u.prototype,"disabled",void 0),u=(0,s.Cg)([(0,a.EM)("ha-card-condition-not")],u),e()}catch(t){e(t)}})},39208(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(22441),a=i(12506),n=t([a]);a=(n.then?(await n)():n)[0];class r extends a.j{static get defaultConfig(){return{condition:"numeric_state"}}}r=(0,s.Cg)([(0,o.EM)("ha-card-condition-numeric_state-no_entity")],r),e()}catch(t){e(t)}})},12506(t,e,i){i.a(t,async function(t,s){try{i.d(e,{j:()=>y});var o=i(62826),a=i(35211),n=i(5124),r=i(22441),c=i(22786),h=i(63533),l=i(1087),d=i(52763),u=i(88827),_=i(82747),p=i(28978),g=i(11839),v=t([d,u]);[d,u]=v.then?(await v)():v;const b=(0,h.Ik)({condition:(0,h.eu)("numeric_state"),entity:(0,h.lq)((0,h.Yj)()),attribute:(0,h.lq)((0,h.Yj)()),above:(0,h.lq)((0,h.ai)()),below:(0,h.lq)((0,h.ai)())});class y extends n.WF{static get defaultConfig(){return{condition:"numeric_state",entity:""}}static validateUIConfig(t){return(0,h.vA)(t,b)}render(){const t=this._entityContext,e="current"===t?.mode?t.entityId:void 0,i="filter"===t?.mode?t.entityIds:void 0,s=void 0!==e&&!this.condition.entity,o=s?e:this.condition.entity,a=o?this.hass.states[o]:void 0,r=e?this.hass.states[e]:void 0,c=r?(0,p.u)(r):void 0,h=this.condition.attribute?void 0:a?.attributes.unit_of_measurement,l={...this.condition,entity:s?g.M:this.condition.entity};return n.qy` <ha-form .hass="${this.hass}" .data="${l}" .schema="${this._schema(this.hass.localize,e,c,s,i,h)}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e={...t.detail.value},{entity:i,...s}=e,o={...s,...!(i===g.M)&&i?{entity:i}:{}};o.attribute||delete o.attribute,(0,l.r)(this,"value-changed",{value:o})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,c.A)((t,e,i,s,o,a)=>{const n=void 0===o,r=e?(0,g.Q)(t,e,i):void 0,c=o??(s&&e?[e]:void 0);return[...n?[{name:"entity",selector:{entity:{extra_options:r?[r]:void 0}}}]:[],{name:"attribute",selector:{attribute:{hide_attributes:u.We,entity_id:c}},context:{filter_entity:"entity"}},{name:"",type:"grid",schema:[{name:"above",selector:{number:{step:"any",mode:"box",unit_of_measurement:a}}},{name:"below",selector:{number:{step:"any",mode:"box",unit_of_measurement:a}}}]}]}),this._computeLabelCallback=t=>{switch(t.name){case"entity":return this.hass.localize("ui.components.entity.entity-picker.entity");case"attribute":return this.hass.localize("ui.panel.lovelace.editor.condition-editor.condition.numeric_state.attribute");case"below":case"above":return this.hass.localize(`ui.panel.lovelace.editor.condition-editor.condition.numeric_state.${t.name}`);default:return""}}}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"condition",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],y.prototype,"disabled",void 0),(0,o.Cg)([(0,r.wk)(),(0,a.Fg)({context:_.$,subscribe:!0})],y.prototype,"_entityContext",void 0),y=(0,o.Cg)([(0,r.EM)("ha-card-condition-numeric_state")],y),s()}catch(t){s(t)}})},85726(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(63533),r=i(1087),c=i(52763),h=i(13898),l=t([c,h]);[c,h]=l.then?(await l)():l;const d=(0,n.Ik)({condition:(0,n.eu)("or"),conditions:(0,n.lq)((0,n.YO)((0,n.bz)()))});class u extends o.WF{static get defaultConfig(){return{condition:"or",conditions:[]}}static validateUIConfig(t){return(0,n.vA)(t,d)}render(){return o.qy` <ha-card-conditions-editor nested .hass="${this.hass}" .conditions="${this.condition.conditions}" @value-changed="${this._valueChanged}"> </ha-card-conditions-editor> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value,i={...this.condition,conditions:e};(0,r.r)(this,"value-changed",{value:i})}constructor(...t){super(...t),this.disabled=!1}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],u.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],u.prototype,"disabled",void 0),u=(0,s.Cg)([(0,a.EM)("ha-card-condition-or")],u),e()}catch(t){e(t)}})},41343(t,e,i){i.a(t,async function(t,e){try{i(44114),i(18111),i(22489),i(61701),i(45367),i(92731);var s=i(62826),o=i(5124),a=i(22441),n=i(22786),r=i(36091),c=i(1087),h=i(52763),l=t([h]);h=(l.then?(await l)():l)[0];const d=[0,768,1024,1280,1/0],u=["mobile","tablet","desktop","wide"];function _(t){if(0===t.length)return[];[...t].sort((t,e)=>t[0]-e[0]);const e=[t[0]];for(let i=1;i<t.length;i++){const s=t[i],o=e[e.length-1];s[0]<=o[1]+1?o[1]=s[1]:e.push(s)}return e}function p(t){const[e,i]=t,s=[];return null!=e&&s.push(`(min-width: ${e}px)`),null!=i&&i!==1/0&&s.push(`(max-width: ${i-1}px)`),s.join(" and ")}function g(t){return _(t.map(t=>{const e=u.indexOf(t);return[d[e],d[e+1]||1/0]})).map(t=>p(t)).filter(t=>t).join(", ")}function v(t){return[...t].sort().join("_")}const b=(0,r.a)(u).filter(t=>0!==t.length).map(t=>[t,g(t)]),y=new Map(b.map(([t,e])=>[v(t),e])),f=new Map(b.map(([t,e])=>[e,t]));class m extends o.WF{static get defaultConfig(){return{condition:"screen",media_query:""}}static validateUIConfig(t,e){if(!(!t.media_query||f.has(t.media_query)))throw new Error(e.localize("ui.errors.config.media_query_not_supported"))}render(){const t={breakpoints:(this.condition.media_query?f.get(this.condition.media_query):void 0)??[]};return o.qy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${this._schema(this.hass.localize)}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value,{breakpoints:i}=e,s={condition:"screen",media_query:y.get(v(i))??""};(0,c.r)(this,"value-changed",{value:s})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,n.A)(t=>[{name:"breakpoints",selector:{select:{mode:"list",options:u.map(e=>{const i=d[u.indexOf(e)];return{value:e,label:`${t(`ui.panel.lovelace.editor.condition-editor.condition.screen.breakpoints_list.${e}`)}${i?` (${t("ui.panel.lovelace.editor.condition-editor.condition.screen.min",{size:i})})`:""}`}}),multiple:!0}}}]),this._computeLabelCallback=t=>"breakpoints"===t.name?this.hass.localize(`ui.panel.lovelace.editor.condition-editor.condition.screen.${t.name}`):""}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],m.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],m.prototype,"disabled",void 0),m=(0,s.Cg)([(0,a.EM)("ha-card-condition-screen")],m),e()}catch(C){e(C)}})},75076(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(22441),a=i(54262),n=t([a]);a=(n.then?(await n)():n)[0];class r extends a.W{static get defaultConfig(){return{condition:"state",state:""}}}r=(0,s.Cg)([(0,o.EM)("ha-card-condition-state-no_entity")],r),e()}catch(t){e(t)}})},54262(t,e,i){i.a(t,async function(t,s){try{i.d(e,{W:()=>y});var o=i(62826),a=i(35211),n=i(5124),r=i(22441),c=i(22786),h=i(63533),l=i(1087),d=i(52763),u=i(88827),_=i(82747),p=i(28978),g=i(11839),v=t([d,u]);[d,u]=v.then?(await v)():v;const b=(0,h.Ik)({condition:(0,h.eu)("state"),entity:(0,h.lq)((0,h.Yj)()),attribute:(0,h.lq)((0,h.Yj)()),state:(0,h.lq)((0,h.Yj)()),state_not:(0,h.lq)((0,h.Yj)())});class y extends n.WF{static get defaultConfig(){return{condition:"state",entity:"",state:""}}static validateUIConfig(t){return(0,h.vA)(t,b)}render(){const{state:t,state_not:e,...i}=this.condition,s=this._entityContext,o="current"===s?.mode?s.entityId:void 0,a="filter"===s?.mode?s.entityIds:void 0,r=void 0!==o&&!this.condition.entity,c=o?this.hass.states[o]:void 0,h=c?(0,p.u)(c):void 0,l={...i,entity:r?g.M:this.condition.entity,invert:void 0!==this.condition.state_not?"true":"false",state:this.condition.state_not??this.condition.state};return n.qy` <ha-form .hass="${this.hass}" .data="${l}" .schema="${this._schema(this.hass.localize,o,h,r,a)}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}" .computeLabel="${this._computeLabelCallback}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value,{invert:i,state:s,entity:o,condition:a,...n}=e,r={condition:"state",...n,...!(o===g.M)&&o?{entity:o}:{},state:"false"===i?s??"":void 0,state_not:"true"===i?s??"":void 0};r.attribute||delete r.attribute,(0,l.r)(this,"value-changed",{value:r})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,c.A)((t,e,i,s,o)=>{const a=e?(0,g.Q)(t,e,i):void 0,n=o??(s&&e?[e]:void 0);return[...void 0===o?[{name:"entity",selector:{entity:{extra_options:a?[a]:void 0}}}]:[],{name:"attribute",selector:{attribute:{hide_attributes:u.B9,entity_id:n}},context:{filter_entity:"entity"}},{name:"",type:"grid",schema:[{name:"invert",required:!0,selector:{select:{mode:"dropdown",options:[{label:t("ui.panel.lovelace.editor.condition-editor.condition.state.state_equal"),value:"false"},{label:t("ui.panel.lovelace.editor.condition-editor.condition.state.state_not_equal"),value:"true"}]}}},{name:"state",selector:{state:{entity_id:n}},context:{filter_entity:"entity",filter_attribute:"attribute"}}]}]}),this._computeLabelCallback=t=>{switch(t.name){case"entity":return this.hass.localize("ui.components.entity.entity-picker.entity");case"attribute":return this.hass.localize("ui.panel.lovelace.editor.condition-editor.condition.state.attribute");case"state":return this.hass.localize("ui.components.entity.entity-state-picker.state");default:return""}}}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({attribute:!1})],y.prototype,"condition",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],y.prototype,"disabled",void 0),(0,o.Cg)([(0,r.wk)(),(0,a.Fg)({context:_.$,subscribe:!0})],y.prototype,"_entityContext",void 0),y=(0,o.Cg)([(0,r.EM)("ha-card-condition-state")],y),s()}catch(t){s(t)}})},9618(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701);var s=i(62826),o=i(5124),a=i(22441),n=i(63533),r=i(22786),c=i(96029),h=i(1087),l=i(52763),d=t([l]);l=(d.then?(await d)():d)[0];const u=(0,n.Ik)({condition:(0,n.eu)("time"),after:(0,n.lq)((0,n.Yj)()),before:(0,n.lq)((0,n.Yj)()),weekdays:(0,n.lq)((0,n.YO)((0,n.vP)(c.ZV)))});class _ extends o.WF{static get defaultConfig(){return{condition:"time",after:"08:00",before:"17:00"}}static validateUIConfig(t){return(0,n.vA)(t,u)}render(){return o.qy` <ha-form .hass="${this.hass}" .data="${this.condition}" .computeLabel="${this._computeLabelCallback}" .schema="${this._schema(this.hass.localize)}" .disabled="${this.disabled}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const e=t.detail.value;(0,h.r)(this,"value-changed",{value:e})}constructor(...t){super(...t),this.disabled=!1,this._schema=(0,r.A)(t=>[{name:"after",selector:{time:{no_second:!0}}},{name:"before",selector:{time:{no_second:!0}}},{name:"weekdays",selector:{select:{mode:"list",multiple:!0,options:c.ZV.map(e=>({value:e,label:t(`ui.weekdays.${c.Tq[e]}`)}))}}}]),this._computeLabelCallback=t=>this.hass.localize(`ui.panel.lovelace.editor.condition-editor.condition.time.${t.name}`)}}(0,s.Cg)([(0,a.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],_.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],_.prototype,"disabled",void 0),_=(0,s.Cg)([(0,a.EM)("ha-card-condition-time")],_),e()}catch(t){e(t)}})},82884(t,e,i){i.a(t,async function(t,e){try{i(74423),i(18111),i(22489),i(61701);var s=i(62826),o=i(5124),a=i(22441),n=i(22786),r=i(63533),c=i(1087),h=i(52220),l=(i(30716),i(8630),i(59646)),d=(i(78673),i(28669)),u=t([l]);l=(u.then?(await u)():u)[0];const _=(0,r.Ik)({condition:(0,r.eu)("user"),users:(0,r.YO)((0,r.Yj)())});class p extends o.WF{static get defaultConfig(){return{condition:"user",users:[]}}static validateUIConfig(t){return(0,r.vA)(t,_)}async firstUpdated(t){super.firstUpdated(t),this._fetchUsers()}async _fetchUsers(){const t=await(0,d.hU)(this.hass);this._users=t.filter(t=>!t.system_generated)}render(){const t=this.condition.users??[];return o.qy` <ha-list @selected="${this._handleSelected}" multi> ${this._sortedUsers(this._users).map(e=>o.qy` <ha-check-list-item graphic="avatar" hasMeta .selected="${t.includes(e.id)}"> <ha-user-badge slot="graphic" .hass="${this.hass}" .user="${e}"></ha-user-badge> <span>${e.name}</span> </ha-check-list-item> `)} </ha-list> `}_handleSelected(t){const e=this._sortedUsers(this._users);let i=this.condition.users??[];t.detail.diff.added.length?i=[...i,e[t.detail.diff.added[0]].id]:t.detail.diff.removed.length&&(i=i.filter(i=>i!==e[t.detail.diff.removed[0]].id));const s={...this.condition,users:i};(0,c.r)(this,"value-changed",{value:s})}constructor(...t){super(...t),this.disabled=!1,this._users=[],this._sortedUsers=(0,n.A)(t=>t.sort((t,e)=>(0,h.xL)(t.name,e.name,this.hass.locale.language)))}}p.styles=o.AH`:host{display:block}ha-list{--mdc-list-vertical-padding:0}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],p.prototype,"condition",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,s.Cg)([(0,a.wk)()],p.prototype,"_users",void 0),p=(0,s.Cg)([(0,a.EM)("ha-card-condition-user")],p),e()}catch(t){e(t)}})},7382(t,e,i){i.d(e,{U:()=>s});const s=i(5124).AH`.card-config{overflow:auto}ha-switch{padding:16px 6px}.side-by-side{display:flex;align-items:flex-end}.side-by-side>*{flex:1;padding-right:8px;padding-inline-end:8px;padding-inline-start:initial}.side-by-side>:last-child{flex:1;padding-right:0;padding-inline-end:0;padding-inline-start:initial}.suffix{margin:0 8px}ha-icon-picker,ha-input,ha-select,hui-action-editor{margin-top:8px;display:block}ha-expansion-panel{display:block;--expansion-panel-content-padding:0;border-radius:var(--ha-border-radius-md);--ha-card-border-radius:var(--ha-border-radius-md)}ha-expansion-panel .content{padding:12px}ha-expansion-panel>[slot=header]{margin:0;font-size:inherit;font-weight:inherit}ha-expansion-panel ha-svg-icon{color:var(--secondary-text-color)}`},21187(t,e,i){i.a(t,async function(t,s){try{i.r(e),i.d(e,{DEFAULT_CONFIG:()=>w,HuiHeadingEntityEditor:()=>$});i(74423),i(44114);var o=i(62826),a=i(35211),n=i(5124),r=i(22441),c=i(22786),h=i(63533),l=i(1087),d=(i(11382),i(52763)),u=i(999),_=i(82747),p=i(13898),g=i(7382),v=i(91408),b=i(44155),y=t([d,p,u]);[d,p,u]=y.then?(await y)():y;const f="M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17M12,4.5C7,4.5 2.73,7.61 1,12C2.73,16.39 7,19.5 12,19.5C17,19.5 21.27,16.39 23,12C21.27,7.61 17,4.5 12,4.5Z",m="M10,9A1,1 0 0,1 11,8A1,1 0 0,1 12,9V13.47L13.21,13.6L18.15,15.79C18.68,16.03 19,16.56 19,17.14V21.5C18.97,22.32 18.32,22.97 17.5,23H11C10.62,23 10.26,22.85 10,22.57L5.1,18.37L5.84,17.6C6.03,17.39 6.3,17.28 6.58,17.28H6.8L10,19V9M11,5A4,4 0 0,1 15,9C15,10.5 14.2,11.77 13,12.46V11.24C13.61,10.69 14,9.89 14,9A3,3 0 0,0 11,6A3,3 0 0,0 8,9C8,9.89 8.39,10.69 9,11.24V12.46C7.8,11.77 7,10.5 7,9A4,4 0 0,1 11,5Z",C="M4,9H20V11H4V9M4,13H14V15H4V13Z",w={type:"entity",show_state:!0,show_icon:!0},x=(0,h.Ik)({type:(0,h.lq)((0,h.Yj)()),entity:(0,h.lq)((0,h.Yj)()),name:(0,h.lq)(b.q),icon:(0,h.lq)((0,h.Yj)()),state_content:(0,h.lq)((0,h.KC)([(0,h.Yj)(),(0,h.YO)((0,h.Yj)())])),show_state:(0,h.lq)((0,h.zM)()),show_icon:(0,h.lq)((0,h.zM)()),color:(0,h.lq)((0,h.Yj)()),tap_action:(0,h.lq)(v.kn),hold_action:(0,h.lq)(v.kn),double_tap_action:(0,h.lq)(v.kn),visibility:(0,h.lq)((0,h.YO)((0,h.bz)()))});class $ extends n.WF{setConfig(t){(0,h.vA)(t,x),this._config={...w,...t}}willUpdate(t){t.has("_config")&&this._contextProvider.setValue(this._config?.entity?{mode:"current",entityId:this._config.entity}:void 0)}render(){if(!this.hass||!this._config)return n.s6;const t=this._schema(this.hass.localize),e={...this._config,displayed_elements:this._displayedElements(this._config)},i=this._config.visibility??[];return n.qy` <ha-form .hass="${this.hass}" .data="${e}" .schema="${t}" .computeLabel="${this._computeLabelCallback}" .computeHelper="${this._computeHelperCallback}" @value-changed="${this._valueChanged}"></ha-form> <ha-expansion-panel outlined> <ha-svg-icon slot="leading-icon" .path="${f}"></ha-svg-icon> <h3 slot="header"> ${this.hass.localize("ui.panel.lovelace.editor.card.heading.entity_config.visibility")} </h3> <div class="content"> <p class="intro"> ${this.hass.localize("ui.panel.lovelace.editor.card.heading.entity_config.visibility_explanation")} </p> <ha-card-conditions-editor .hass="${this.hass}" .conditions="${i}" @value-changed="${this._conditionChanged}"> </ha-card-conditions-editor> </div> </ha-expansion-panel> `}_valueChanged(t){if(t.stopPropagation(),!this._config||!this.hass)return;const e={...t.detail.value};e.displayed_elements&&(e.show_state=e.displayed_elements.includes("state"),e.show_icon=e.displayed_elements.includes("icon"),delete e.displayed_elements),(0,l.r)(this,"config-changed",{config:e})}_conditionChanged(t){if(t.stopPropagation(),!this._config||!this.hass)return;const e=t.detail.value,i={...this._config,visibility:e};0===i.visibility?.length&&delete i.visibility,(0,l.r)(this,"config-changed",{config:i})}static get styles(){return[g.U,n.AH`.container{display:flex;flex-direction:column}ha-form{display:block;margin-bottom:24px}.intro{margin:0;color:var(--secondary-text-color);margin-bottom:8px}`]}constructor(...t){super(...t),this.preview=!1,this._contextProvider=new a.DT(this,{context:_.$,initialValue:void 0}),this._schema=(0,c.A)(t=>[{name:"entity",selector:{entity:{}}},{name:"content",type:"expandable",flatten:!0,iconPath:C,schema:[{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"",type:"grid",schema:[{name:"icon",selector:{icon:{}},context:{icon_entity:"entity"}},{name:"color",selector:{ui_color:{default_color:"none",include_state:!0,include_none:!0}}}]},{name:"displayed_elements",selector:{select:{mode:"list",multiple:!0,options:[{value:"state",label:t("ui.panel.lovelace.editor.card.heading.entity_config.displayed_elements_options.state")},{value:"icon",label:t("ui.panel.lovelace.editor.card.heading.entity_config.displayed_elements_options.icon")}]}}},{name:"state_content",selector:{ui_state_content:{allow_name:!0}},context:{filter_entity:"entity"}}]},{name:"interactions",type:"expandable",flatten:!0,iconPath:m,schema:[{name:"tap_action",selector:{ui_action:{default_action:"none"}},context:u.Tq},{name:"",type:"optional_actions",flatten:!0,schema:["hold_action","double_tap_action"].map(t=>({name:t,selector:{ui_action:{default_action:"none"}},context:u.Tq}))}]}]),this._displayedElements=(0,c.A)(t=>{const e=[];return t.show_state&&e.push("state"),t.show_icon&&e.push("icon"),e}),this._computeLabelCallback=t=>{switch(t.name){case"state_content":case"displayed_elements":case"color":return this.hass.localize(`ui.panel.lovelace.editor.card.heading.entity_config.${t.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}},this._computeHelperCallback=t=>{switch(t.name){case"color":return this.hass.localize(`ui.panel.lovelace.editor.card.heading.entity_config.${t.name}_helper`);case"name":return this.hass.localize("ui.panel.lovelace.editor.card.heading.entity_config.name_helper");default:return}}}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,o.Cg)([(0,r.MZ)({type:Boolean})],$.prototype,"preview",void 0),(0,o.Cg)([(0,r.wk)()],$.prototype,"_config",void 0),$=(0,o.Cg)([(0,r.EM)("hui-heading-entity-editor")],$),s()}catch(t){s(t)}})},91408(t,e,i){i.d(e,{dk:()=>a,kn:()=>u});var s=i(63533);const o=(0,s.Ik)({user:(0,s.Yj)()}),a=(0,s.KC)([(0,s.zM)(),(0,s.Ik)({text:(0,s.lq)((0,s.Yj)()),excemptions:(0,s.lq)((0,s.YO)(o))})]),n=(0,s.Ik)({action:(0,s.eu)("url"),url_path:(0,s.Yj)(),confirmation:(0,s.lq)(a)}),r=(0,s.Ik)({action:(0,s.vP)(["call-service","perform-action"]),service:(0,s.lq)((0,s.Yj)()),perform_action:(0,s.lq)((0,s.Yj)()),service_data:(0,s.lq)((0,s.Ik)()),data:(0,s.lq)((0,s.Ik)()),target:(0,s.lq)((0,s.Ik)({entity_id:(0,s.lq)((0,s.KC)([(0,s.Yj)(),(0,s.YO)((0,s.Yj)())])),device_id:(0,s.lq)((0,s.KC)([(0,s.Yj)(),(0,s.YO)((0,s.Yj)())])),area_id:(0,s.lq)((0,s.KC)([(0,s.Yj)(),(0,s.YO)((0,s.Yj)())])),floor_id:(0,s.lq)((0,s.KC)([(0,s.Yj)(),(0,s.YO)((0,s.Yj)())])),label_id:(0,s.lq)((0,s.KC)([(0,s.Yj)(),(0,s.YO)((0,s.Yj)())]))})),confirmation:(0,s.lq)(a)}),c=(0,s.Ik)({action:(0,s.eu)("navigate"),navigation_path:(0,s.Yj)(),navigation_replace:(0,s.lq)((0,s.zM)()),confirmation:(0,s.lq)(a)}),h=(0,s.NW)({action:(0,s.eu)("assist"),pipeline_id:(0,s.lq)((0,s.Yj)()),start_listening:(0,s.lq)((0,s.zM)())}),l=(0,s.NW)({action:(0,s.eu)("more-info"),entity:(0,s.lq)((0,s.Yj)())}),d=(0,s.Ik)({action:(0,s.vP)(["none","toggle","more-info","call-service","perform-action","url","navigate","assist"]),confirmation:(0,s.lq)(a)}),u=(0,s.OR)(t=>{if(t&&"object"==typeof t&&"action"in t)switch(t.action){case"call-service":case"perform-action":return r;case"navigate":return c;case"url":return n;case"assist":return h;case"more-info":return l}return d})},44155(t,e,i){i.d(e,{q:()=>a});var s=i(63533);const o=(0,s.KC)([(0,s.Ik)({type:(0,s.eu)("text"),text:(0,s.Yj)()}),(0,s.Ik)({type:(0,s.KC)([(0,s.eu)("entity"),(0,s.eu)("device"),(0,s.eu)("area"),(0,s.eu)("floor")])}),(0,s.Yj)()]),a=(0,s.KC)([o,(0,s.YO)(o)])},90285(t,e,i){var s=i(62826),o=i(5124),a=i(22441),n=i(89784),r=i(6412),c=i(78870),h=(i(48374),i(47680),i(19037)),l=i(22064),d=i(97176);const u={tap_action:{action:"none"},hold_action:{action:"none"},double_tap_action:{action:"none"}};class _ extends o.WF{static async getConfigElement(){return await i.e(71751).then(i.bind(i,16282)),document.createElement("hui-button-heading-badge-editor")}static getStubConfig(){return{type:"button",icon:"mdi:gesture-tap-button"}}setConfig(t){this._config={...u,...t}}get hasAction(){return(0,d.h)(this._config?.tap_action)||(0,d.h)(this._config?.hold_action)||(0,d.h)(this._config?.double_tap_action)}_handleAction(t){(0,l.$)(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config)return o.s6;const t=this._config,e=t.color?(0,c.MP)(t.color):void 0,i={"--color":e};return o.qy` <ha-control-button @action="${this._handleAction}" .actionHandler="${(0,h.T)({hasHold:(0,d.h)(this._config.hold_action),hasDoubleClick:(0,d.h)(this._config.double_tap_action)})}" style="${(0,n.W)(i)}" .label="${t.text}" class="${(0,r.H)({colored:!!e,"with-text":!!t.text})}"> <span class="content"> ${t.icon?o.qy`<ha-icon .icon="${t.icon}"></ha-icon>`:o.s6} ${t.text?o.qy`<span class="text">${t.text}</span>`:o.s6} </span> </ha-control-button> `}constructor(...t){super(...t),this.preview=!1}}_.styles=o.AH`ha-control-button{--control-button-border-radius:var(
        --ha-heading-badge-border-radius,
        var(--ha-border-radius-pill)
      );--control-button-padding:0;--mdc-icon-size:var(--ha-heading-badge-icon-size, 16px);width:auto;height:var(--ha-heading-badge-size,26px);min-width:var(--ha-heading-badge-size,26px);font-size:var(--ha-heading-badge-font-size, var(--ha-font-size-s));font-weight:var(--ha-font-weight-medium)}ha-control-button.with-text{--control-button-padding:0 var(--ha-space-2)}ha-control-button.colored{--control-button-icon-color:var(--color);--control-button-background-color:var(--color);--control-button-focus-color:var(--color);--control-button-background-opacity:0.2;--ha-ripple-color:var(--color)}.content{display:flex;flex-direction:row;align-items:center;white-space:nowrap}.text{padding:0 var(--ha-space-1);line-height:1}ha-icon{line-height:1}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,s.Cg)([(0,a.wk)()],_.prototype,"_config",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],_.prototype,"preview",void 0),_=(0,s.Cg)([(0,a.EM)("hui-button-heading-badge")],_)},16678(t,e,i){i.a(t,async function(t,e){try{var s=i(62826),o=i(5124),a=i(22441),n=i(89784),r=i(22786),c=i(78870),h=i(79468),l=i(71727),d=i(47129),u=i(52658),_=(i(51336),i(93367)),p=i(14020),g=i(19037),v=i(13632),b=i(22064),y=i(97176),f=i(21187),m=t([_,p,f]);[_,p,f]=m.then?(await m)():m;const C="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",w={tap_action:{action:"none"},hold_action:{action:"none"},double_tap_action:{action:"none"}};class x extends o.WF{static async getConfigElement(){return await Promise.resolve().then(i.bind(i,21187)),document.createElement("hui-heading-entity-editor")}static getStubConfig(t){const e=Object.keys(t.states);return{type:"entity",entity:(0,v.B)(t,1,e,[],["sensor","light","switch"])[0]||""}}setConfig(t){this._config={...f.DEFAULT_CONFIG,...w,...t}}get hasAction(){return(0,y.h)(this._config?.tap_action)||(0,y.h)(this._config?.hold_action)||(0,y.h)(this._config?.double_tap_action)}_handleAction(t){(0,b.$)(this,this.hass,this._config,t.detail.action)}render(){if(!this.hass||!this._config)return o.s6;const t=this._config,e=t.entity,i=this.hass.states[e];if(!i)return o.qy` <ha-heading-badge class="error" .title="${e}"> <ha-svg-icon slot="icon" .hass="${this.hass}" .path="${C}"></ha-svg-icon> - </ha-heading-badge> `;const s={"--icon-color":this._computeStateColor(i,t.color)},a=this.hass.formatEntityName(i,this._config.name);return o.qy` <ha-heading-badge .type="${this.hasAction?"button":"badge"}" @action="${this._handleAction}" .actionHandler="${(0,g.T)({hasHold:(0,y.h)(this._config.hold_action),hasDoubleClick:(0,y.h)(this._config.double_tap_action)})}" style="${(0,n.W)(s)}" .title="${a}"> ${t.show_icon?o.qy` <ha-state-icon slot="icon" .icon="${t.icon}" .stateObj="${i}"></ha-state-icon> `:o.s6} ${t.show_state?o.qy` <state-display .hass="${this.hass}" .stateObj="${i}" .content="${t.state_content}" .name="${a}" dash-unavailable></state-display> `:o.s6} </ha-heading-badge> `}constructor(...t){super(...t),this.preview=!1,this._computeStateColor=(0,r.A)((t,e)=>{if(e&&"none"!==e){if("state"===e){if("light"===(0,l.m)(t.entity_id)&&t.attributes.rgb_color){const e=(0,h.bi)(t.attributes.rgb_color);return e[1]<.4&&(e[1]<.1?e[2]=225:e[1]=.4),(0,h.v2)((0,h.hT)(e))}return(0,u.Se)(t)}return e?(0,d.a)(t)?(0,c.MP)(e):void 0:e}})}}x.styles=o.AH`[role=button]{cursor:pointer}ha-heading-badge{--state-inactive-color:initial}ha-heading-badge.error{--icon-color:var(--red-color)}`,(0,s.Cg)([(0,a.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,s.Cg)([(0,a.wk)()],x.prototype,"_config",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],x.prototype,"preview",void 0),x=(0,s.Cg)([(0,a.EM)("hui-entity-heading-badge")],x),e()}catch(t){e(t)}})},20380(t,e,i){i.a(t,async function(t,s){try{i.d(e,{X:()=>p});i(44114);var o=i(62826),a=i(5124),n=i(22441),r=i(89784),c=i(53610),h=i(52658),l=i(10223),d=i(22675),u=i(88827),_=t([l,c,u]);function p(){const t=[];for(let e=0;e<24;e++){const i=e/24,s=i+e/576*.8+.2/24;0!==e&&t.push([i,"transparent"]),t.push([i,"var(--control-slider-color)"]),t.push([s,"var(--control-slider-color)"]),t.push([s,"transparent"])}return(0,a.iz)(t.map(([t,e])=>`${e} ${100*t}%`).join(", "))}[l,c,u]=_.then?(await _)():_;const g=p();class v extends a.WF{updated(t){t.has("stateObj")&&(this.value=null!=this.stateObj.attributes.current_tilt_position?Math.round(this.stateObj.attributes.current_tilt_position):void 0)}_valueChanged(t){const{value:e}=t.detail;"number"!=typeof e||isNaN(e)||this.hass.callService("cover","set_cover_tilt_position",{entity_id:this.stateObj.entity_id,tilt_position:e})}render(){const t=(0,h.Se)(this.stateObj,"open"),e=(0,h.Se)(this.stateObj);return a.qy` <ha-control-slider touch-action="none" vertical .value="${this.value}" min="0" max="100" mode="cursor" @value-changed="${this._valueChanged}" .label="${(0,c.computeAttributeNameDisplay)(this.hass.localize,this.stateObj,this.hass.entities,"current_tilt_position")}" style="${(0,r.W)({"--state-cover-inactive-color":t,"--control-slider-color":e,"--control-slider-background":e})}" .disabled="${this.stateObj.state===d.Hh}" .unit="${u.rM.cover.current_tilt_position}" .locale="${this.hass.locale}"> <div slot="background" class="gradient"></div> </ha-control-slider> `}static get styles(){return a.AH`ha-control-slider{height:45vh;max-height:320px;min-height:200px;--control-slider-thickness:130px;--control-slider-border-radius:var(--ha-border-radius-6xl);--control-slider-color:var(--primary-color);--control-slider-background:var(--disabled-color);--control-slider-background-opacity:0.2;--control-slider-tooltip-font-size:var(--ha-font-size-xl)}.gradient{background:-webkit-linear-gradient(top,${g});opacity:.6}`}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"stateObj",void 0),(0,o.Cg)([(0,n.wk)()],v.prototype,"value",void 0),v=(0,o.Cg)([(0,n.EM)("ha-state-control-cover-tilt-position")],v),s()}catch(b){s(b)}})},14020(t,e,i){i.a(t,async function(t,s){try{i.d(e,{HS:()=>y,p4:()=>b});i(74423),i(18111),i(22489),i(61701);var o=i(62826),a=i(5124),n=i(22441),r=i(96231),c=i(44537),h=i(69093),l=(i(46190),i(36158)),d=i(22675),u=i(64808),_=i(24247),p=i(62688),g=t([l,p,_]);[l,p,_]=g.then?(await g)():g;const v=["button","infrared","input_button","radio_frequency","scene"],b=["remaining_time","install_status"],y={timer:["remaining_time"],update:["install_status"]},f={valve:["current_position"],cover:["current_position"],fan:["percentage"],light:["brightness"]},m={climate:["state","current_temperature"],cover:["state","current_position"],fan:"percentage",humidifier:["state","current_humidity"],light:"brightness",timer:"remaining_time",update:"install_status",valve:["state","current_position"]};class C extends a.WF{createRenderRoot(){return this}get _content(){const t=(0,h.t)(this.stateObj);return this.content??m[t]??"state"}_computeContent(t){const e=this.stateObj,s=(0,h.t)(e);if("state"===t){const t=e.state===d.Hh||e.state===d.HV;return this.dashUnavailable&&t?"—":!u.G6.includes(this.stateObj.attributes.device_class)&&!v.includes(s)||t?this.hass.formatEntityState(e):a.qy` <hui-timestamp-display .hass="${this.hass}" .ts="${new Date(e.state)}" .format="${"uptime"===this.stateObj.attributes.device_class?"total":"relative"}" capitalize></hui-timestamp-display> `}if("name"===t&&this.name)return a.qy`${this.name}`;if("device_name"===t||"area_name"===t||"floor_name"===t){const i=t.replace("_name","");return this.hass.formatEntityName(e,{type:i})||void 0}let o;if("last_changed"!==t&&"last-changed"!==t||(o=e.last_changed),"last_updated"!==t&&"last-updated"!==t||(o=e.last_updated),"input_datetime"===s&&"timestamp"===t&&(o=new Date(1e3*e.attributes.timestamp)),"last_triggered"!==t&&("calendar"!==s||"start_time"!==t&&"end_time"!==t)&&("sun"!==s||"next_dawn"!==t&&"next_dusk"!==t&&"next_midnight"!==t&&"next_noon"!==t&&"next_rising"!==t&&"next_setting"!==t)||(o=e.attributes[t]),o)return a.qy` <ha-relative-time .hass="${this.hass}" .datetime="${o}" capitalize></ha-relative-time> `;if((y[s]??[]).includes(t)){if("install_status"===t)return a.qy` ${(0,_.A_)(e,this.hass)} `;if("remaining_time"===t)return i.e(20283).then(i.bind(i,5078)),a.qy` <ha-timer-remaining-time .hass="${this.hass}" .stateObj="${e}"></ha-timer-remaining-time> `}const n=e.attributes[t];return null==n||f[s]?.includes(t)&&!n?void 0:this.hass.formatEntityAttributeValue(e,t)}render(){const t=this.stateObj,e=(0,c.e)(this._content).map(t=>this._computeContent(t)).filter(Boolean);return e.length?(0,r.f)(e," · "):a.qy`${this.hass.formatEntityState(t)}`}}(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"stateObj",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"content",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],C.prototype,"name",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"dash-unavailable"})],C.prototype,"dashUnavailable",void 0),C=(0,o.Cg)([(0,n.EM)("state-display")],C),s()}catch(t){s(t)}})}};