UNPKG

iobroker.lovelace

Version:

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

8 lines 51 kB
/*! For license information please see 37558.0ff16424479adf8c.js.LICENSE.txt */
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[37558],{66639:function(e,t,i){i.d(t,{Vu:function(){return o},Xz:function(){return n},cs:function(){return a}});i(44114),i(18111),i(61701),i(45367),i(92731),i(62953);const a=(e,t)=>{const i=new Map,a=[];for(const n of t)n.floor_id?(i.has(n.floor_id)||i.set(n.floor_id,[]),i.get(n.floor_id).push(n.area_id)):a.push(n.area_id);return{floors:e.map(e=>({id:e.floor_id,areas:i.get(e.floor_id)||[]})),areas:a}},n=e=>{const t=[];for(const i of e.floors)t.push(...i.areas);return t.push(...e.areas),t},o=e=>e.floors.map(e=>e.id)},18198:function(e,t,i){i.d(t,{Dc:function(){return d},Si:function(){return l}});var a=i(40445),n=i(5124),o=i(67576);i(47680),i(67094);let s,r,c=e=>e;const l=e=>{switch(e.level){case 0:return"M11,10H13V16H11V10M22,12H19V20H5V12H2L12,3L22,12M15,10A2,2 0 0,0 13,8H11A2,2 0 0,0 9,10V16A2,2 0 0,0 11,18H13A2,2 0 0,0 15,16V10Z";case 1:return"M12,3L2,12H5V20H19V12H22L12,3M10,8H14V18H12V10H10V8Z";case 2:return"M12,3L2,12H5V20H19V12H22L12,3M9,8H13A2,2 0 0,1 15,10V12A2,2 0 0,1 13,14H11V16H15V18H9V14A2,2 0 0,1 11,12H13V10H9V8Z";case 3:return"M12,3L22,12H19V20H5V12H2L12,3M15,11.5V10C15,8.89 14.1,8 13,8H9V10H13V12H11V14H13V16H9V18H13A2,2 0 0,0 15,16V14.5A1.5,1.5 0 0,0 13.5,13A1.5,1.5 0 0,0 15,11.5Z";case-1:return"M12,3L2,12H5V20H19V12H22L12,3M11,15H7V13H11V15M15,18H13V10H11V8H15V18Z"}return"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z"},d=e=>{switch(e.level){case 0:return"mdi:home-floor-0";case 1:return"mdi:home-floor-1";case 2:return"mdi:home-floor-2";case 3:return"mdi:home-floor-3";case-1:return"mdi:home-floor-negative-1"}return"mdi:home"};class h extends n.WF{render(){if(!this.floor)return n.s6;if(this.floor.icon)return(0,n.qy)(s||(s=c`<ha-icon .icon="${0}"></ha-icon>`),this.floor.icon);const e=l(this.floor);return(0,n.qy)(r||(r=c`<ha-svg-icon .path="${0}"></ha-svg-icon>`),e)}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],h.prototype,"floor",void 0),(0,a.Cg)([(0,o.MZ)()],h.prototype,"icon",void 0),h=(0,a.Cg)([(0,o.EM)("ha-floor-icon")],h)},69464:function(e,t,i){var a=i(40445),n=i(5124),o=i(67576);let s,r,c=e=>e;class l extends n.WF{render(){return(0,n.qy)(s||(s=c`<slot></slot>`))}}l.styles=(0,n.AH)(r||(r=c`:host{background-color:var(--ha-color-fill-neutral-quiet-resting);padding:var(--ha-space-2) var(--ha-space-3);font-weight:var(--ha-font-weight-bold);color:var(--secondary-text-color);min-height:var(--ha-space-6);display:flex;align-items:center;box-sizing:border-box}`)),l=(0,a.Cg)([(0,o.EM)("ha-section-title")],l)},62647:function(e,t,i){var a=i(40445),n=i(9866),o=i(5124),s=i(67576);let r,c=e=>e;class l extends n.A{static get styles(){return[n.A.styles,(0,o.AH)(r||(r=c`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var(
            --ha-tab-active-text-color,
            var(--primary-color)
          );--wa-color-neutral-on-quiet:var(--wa-color-brand-on-quiet);opacity:.8;color:inherit;--wa-space-l:16px}:host([active]:not([disabled])){opacity:1}@media (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`))]}}l=(0,a.Cg)([(0,s.EM)("ha-tab-group-tab")],l)},66289:function(e,t,i){i.a(e,async function(e,t){try{i(62953);var a=i(40445),n=i(42814),o=i(5124),s=i(67576),r=i(36356),c=e([n]);n=(c.then?(await c)():c)[0];let l,d=e=>e;class h extends n.A{connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeyDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown,!0)}handleClick(e){this._dragScrollController.scrolled||super.handleClick(e)}static get styles(){return[n.A.styles,(0,o.AH)(l||(l=d`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var(
            --ha-tab-indicator-color,
            var(--primary-color)
          );--wa-color-neutral-on-quiet:var(--indicator-color)}.tab-group-top ::slotted(ha-tab-group-tab[active]){border-block-end:solid var(--track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--track-width))}.tab-group-start ::slotted(ha-tab-group-tab[active]){border-inline-end:solid var(--track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--track-width))}.tab-group-end ::slotted(ha-tab-group-tab[active]){border-inline-start:solid var(--track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--track-width))}.scroll-button::part(base):hover{background-color:transparent}`))]}constructor(...e){super(...e),this._dragScrollController=new r.q(this,{selector:".nav"}),this.tabTag="ha-tab-group-tab",this.tabOnly=!0,this._handleKeyDown=e=>{(e.altKey||e.metaKey)&&e.stopPropagation()}}}(0,a.Cg)([(0,s.MZ)({attribute:"tab-tag"})],h.prototype,"tabTag",void 0),(0,a.Cg)([(0,s.MZ)({attribute:"tab-only",type:Boolean})],h.prototype,"tabOnly",void 0),h=(0,a.Cg)([(0,s.EM)("ha-tab-group")],h),t()}catch(l){t(l)}})},53756:function(e,t,i){i.d(t,{t:function(){return c},w:function(){return l}});i(74423),i(18111),i(22489),i(61701),i(62953);var a=i(71727),n=i(74705),o=i(28978),s=i(15638),r=i(95350);const c=[{name:"search_labels.entityName",weight:10},{name:"search_labels.friendlyName",weight:8},{name:"search_labels.deviceName",weight:7},{name:"search_labels.areaName",weight:6},{name:"search_labels.domainName",weight:6},{name:"search_labels.entityId",weight:3}],l=(e,t,i,c,l,d,h,u,p,g="")=>{let m,v=Object.keys(e.states);return h&&(v=v.filter(e=>h.includes(e))),u&&(v=v.filter(e=>!u.includes(e))),t&&(v=v.filter(e=>t.includes((0,a.m)(e)))),i&&(v=v.filter(e=>!i.includes((0,a.m)(e)))),m=v.map(t=>{const i=e.states[t],c=(0,o.u)(i),[l,d,h]=(0,n.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],e.entities,e.devices,e.areas,e.floors),u=(0,r.p$)(e.localize,(0,a.m)(t)),p=(0,s.qC)(e.language,e.translationMetadata.translations),m=l||d||t,v=[h,l?d:void 0].filter(Boolean).join(p?" ◂ ":" ▸ ");return{id:`${g}${t}`,primary:m,secondary:v,domain_name:u,sorting_label:[m,v].filter(Boolean).join("_"),search_labels:{entityName:l||null,deviceName:d||null,areaName:h||null,domainName:u||null,friendlyName:c||null,entityId:t},stateObj:i}}),l&&(m=m.filter(e=>{var t;return e.id===p||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.device_class)&&l.includes(e.stateObj.attributes.device_class)})),d&&(m=m.filter(e=>{var t;return e.id===p||(null===(t=e.stateObj)||void 0===t?void 0:t.attributes.unit_of_measurement)&&d.includes(e.stateObj.attributes.unit_of_measurement)})),c&&(m=m.filter(e=>e.id===p||e.stateObj&&c(e.stateObj))),m}},26783:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{Cj:function(){return X}});var n=i(50179),o=i(7349),s=i(38098),r=i(89807),c=i(11865),l=i(85032),d=i(47547),h=i(66102),u=i(89156),p=i(3453),g=i(81210),m=i(31095),v=i(1248),y=i(19300),f=i(57251),_=i(35598),b=i(58500),w=i(44772),$=i(44577),C=i(5817),x=i(67034),k=i(13028),H=i(30277),L=i(38409),M=i(339),V=i(74049),E=i(67142),A=i(5375),q=i(14312),z=i(29175),S=i(26671),I=i(61691),N=i(71982),j=i(91282),O=i(73269),T=i(14501),Z=i(29106),D=i(58467),K=i(57484),F=i(95605),B=i(77799),P=i(45429),U=i(52494),W=i(65115),R=i(31235),G=i(25232),Q=i(34609),J=i(75781),Y=e([n,o,s,c,u,h,l,d,v,_,b,w,C,x,k,M,E,V,S,I,N,j,O,T,Z,P,K,F,D,U,Q,J]);[n,o,s,c,u,h,l,d,v,_,b,w,C,x,k,M,E,V,S,I,N,j,O,T,Z,P,K,F,D,U,Q,J]=Y.then?(await Y)():Y;const X={"alarm-modes":n.S,"area-controls":o.s,"bar-gauge":s.N,button:r.l,"climate-fan-modes":c.f,"climate-swing-modes":u.W,"climate-swing-horizontal-modes":h.S,"climate-hvac-modes":l.E,"climate-preset-modes":d.p,"counter-actions":p.Q,"cover-open-close":g.O,"cover-position-favorite":m.B,"cover-position":v.H,"cover-tilt-favorite":f.x,"cover-tilt-position":_.C,"cover-tilt":y.l,"date-set":b.Z,"fan-direction":w.n,"fan-oscillate":$.G,"fan-preset-modes":C.r,"fan-speed":x.Z,"humidifier-modes":k.J,"humidifier-toggle":H.R,"lawn-mower-commands":L.ED,"light-brightness":M._,"light-color-temp":E.a,"light-color-favorites":V.F,"lock-commands":A.k,"lock-open-door":q.o,"media-player-playback":z.L,"media-player-sound-mode":S.u,"media-player-source":I.d,"media-player-volume-buttons":N.X,"media-player-volume-slider":j.R,"numeric-input":O.Q,"precipitation-forecast":T.t,"select-options":Z.N,"trend-graph":P.E,"target-humidity":K.V,"target-temperature":F.E,"temperature-forecast":D.q,toggle:B.N,"update-actions":U.J,"vacuum-commands":W.Ky,"valve-open-close":R.B,"valve-position-favorite":G.c,"valve-position":Q.U,"water-heater-operation-modes":J.Y};a()}catch(X){a(X)}})},29754:function(e,t,i){i.d(t,{N:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"alarm_control_panel"!==(0,a.m)(t)?null:{config:{type:"alarm-panel",entity:t}}}}},95210:function(e,t,i){i.d(t,{Q:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"calendar"!==(0,a.m)(t)?null:{config:{type:"calendar",entities:[t]}}}}},10073:function(e,t,i){i.d(t,{D:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){if("sensor"!==(0,a.m)(t))return null;const i=e.states[t];return!i||isNaN(Number(i.state))||"%"!==i.attributes.unit_of_measurement?null:{config:{type:"gauge",entity:t}}}}},29587:function(e,t,i){i.d(t,{G:function(){return o}});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(71727);const n=new Set(["counter","input_number","number","sensor"]),o={getEntitySuggestion(e,t){if(!n.has((0,a.m)(t)))return null;const i=e.states[t];return!i||isNaN(Number(i.state))?null:{config:{type:"history-graph",entities:[t],hours_to_show:24}}}}},81708:function(e,t,i){i.d(t,{a:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"humidifier"!==(0,a.m)(t)?null:{config:{type:"humidifier",entity:t}}}}},75450:function(e,t,i){i.d(t,{a:function(){return o}});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(71727);const n=new Set(["person","device_tracker","zone"]),o={getEntitySuggestion(e,t){return n.has((0,a.m)(t))?{config:{type:"map",entities:[t]}}:null}}},52120:function(e,t,i){i.d(t,{l:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"media_player"!==(0,a.m)(t)?null:{config:{type:"media-control",entity:t}}}}},92398:function(e,t,i){i.d(t,{b:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"camera"!==(0,a.m)(t)?null:{config:{type:"picture-entity",entity:t,camera_image:t}}}}},64718:function(e,t,i){i.d(t,{v:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"plant"!==(0,a.m)(t)?null:{config:{type:"plant-status",entity:t}}}}},37422:function(e,t,i){i.d(t,{B:function(){return s}});var a=i(71727);const n=[{labelKey:"last_24h",days_to_show:1,period:"hour",chart_type:"line",stat_types:["mean"]},{labelKey:"last_7d",days_to_show:7,period:"day",chart_type:"line",stat_types:["mean","min","max"]},{labelKey:"last_30d",days_to_show:30,period:"day",chart_type:"line",stat_types:["mean","min","max"]}],o=[{labelKey:"last_7d",days_to_show:7,period:"day",chart_type:"bar",stat_types:["change"]},{labelKey:"last_30d",days_to_show:30,period:"day",chart_type:"bar",stat_types:["change"]},{labelKey:"last_year",days_to_show:365,period:"month",chart_type:"bar",stat_types:["change"]}],s={getEntitySuggestion(e,t){if("sensor"!==(0,a.m)(t))return null;const i=e.states[t],s=null==i?void 0:i.attributes.state_class;if(!s)return null;return("measurement"===s?n:o).map(i=>({label:e.localize(`ui.panel.lovelace.editor.cardpicker.suggestions.periods.${i.labelKey}`),config:{type:"statistics-graph",entities:[t],days_to_show:i.days_to_show,period:i.period,chart_type:i.chart_type,stat_types:i.stat_types}}))}}},70907:function(e,t,i){i.d(t,{t:function(){return o}});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(71727);const n=new Set(["climate","water_heater"]),o={getEntitySuggestion(e,t){return n.has((0,a.m)(t))?{config:{type:"thermostat",entity:t}}:null}}},6744:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{S:function(){return w}});i(44114),i(18111),i(81148),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var n=i(71727),o=i(26783),s=e([o]);o=(s.then?(await s)():s)[0];const r=[],c=["toggle"],l=[r,["select-options"]],d=[r,["numeric-input"]],h=[r,["date-set"]],u=[r,["button"]],p={light:[r,["light-brightness"],c,["light-color-temp"],["light-color-favorites"]],cover:[r,["cover-open-close"],["cover-position"],["cover-tilt"],["cover-tilt-position"]],climate:[r,["climate-hvac-modes"],["climate-preset-modes"],["climate-fan-modes"],["climate-swing-modes"],["climate-swing-horizontal-modes"],["target-temperature"]],media_player:[r,["media-player-playback"],["media-player-volume-slider"],["media-player-volume-buttons"],["media-player-source"],["media-player-sound-mode"]],fan:[r,["fan-speed"],["fan-preset-modes"],["fan-direction"],["fan-oscillate"]],switch:[r,c],input_boolean:[r,c],lock:[r,["lock-commands"],["lock-open-door"]],humidifier:[r,["humidifier-toggle"],["humidifier-modes"],["target-humidity"]],vacuum:[r,["vacuum-commands"]],lawn_mower:[r,["lawn-mower-commands"]],valve:[r,["valve-open-close"],["valve-position"]],alarm_control_panel:[r,["alarm-modes"]],counter:[r,["counter-actions"]],input_select:l,select:l,input_number:d,number:d,input_datetime:h,date:h,update:[r,["update-actions"]],water_heater:[r,["water-heater-operation-modes"],["target-temperature"]],datetime:h,button:u,input_button:u,scene:u,script:u,weather:[r,["temperature-forecast"],["precipitation-forecast"]]},g=r,m=new Set(["battery","carbon_dioxide","carbon_monoxide","humidity","illuminance","pm1","pm10","pm25","power","pressure","temperature","volatile_organic_compounds","wind_speed"]),v=new Set(["calendar","todo","camera"]),y=(e,t)=>{const i=(0,n.m)(t);if("sensor"===i){const i=e[t],a=null==i?void 0:i.attributes.device_class,n="%"===(null==i?void 0:i.attributes.unit_of_measurement),o=[r];return a&&m.has(a)&&o.push(["trend-graph"]),n&&o.push(["bar-gauge"]),o}return p[i]},f=(e,t)=>{const i={type:"tile",entity:e};return t.length&&(i.features=t.map(e=>({type:e}))),i},_=(e,t,i)=>i.every(i=>{try{return o.Cj[i](e,{entity_id:t})}catch(a){return!1}}),b=(e,t)=>{if(t.length)return t.map(t=>e.localize(`ui.panel.lovelace.editor.features.types.${t}.label`)).join(", ")},w={getEntitySuggestion(e,t){var i;if(v.has((0,n.m)(t)))return null;const a=null!==(i=y(e.states,t))&&void 0!==i?i:[g],o=[];for(const n of a)_(e,t,n)&&o.push({label:b(e,n),config:f(t,n)});return o.length?o:null}};a()}catch(r){a(r)}})},7181:function(e,t,i){i.d(t,{U:function(){return n}});var a=i(71727);const n={getEntitySuggestion(e,t){return"todo"!==(0,a.m)(t)?null:{config:{type:"todo-list",entity:t}}}}},20382:function(e,t,i){i.d(t,{$:function(){return s}});i(44114),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(71727),n=i(43248);const o=["daily","hourly"],s={getEntitySuggestion(e,t){if("weather"!==(0,a.m)(t))return null;const i=e.states[t];if(!i)return null;const s=new Set((0,n.V7)(i)),r=[];for(const a of o)s.has(a)&&r.push({label:e.localize(`ui.panel.lovelace.editor.card.weather-forecast.${a}`),config:{type:"weather-forecast",entity:t,forecast_type:a}});return r.length?r:null}}},35694:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{h:function(){return c}});i(78350),i(30237),i(18111),i(30531);var n=i(44537),o=i(45291),s=i(74683),r=e([s]);s=(r.then?(await r)():r)[0];const c=(e,t)=>{if(!t||void 0===e.states[t])return{core:[],custom:[]};return{core:Object.values(s.z).flatMap(i=>{try{var a;return null!==(a=(0,n.e)(i.getEntitySuggestion(e,t)))&&void 0!==a?a:[]}catch(o){return console.error("Card suggestion provider threw:",o),[]}}),custom:o.J_.flatMap(i=>{if(!i.getEntitySuggestion)return[];try{var a;return null!==(a=(0,n.e)(i.getEntitySuggestion(e,t)))&&void 0!==a?a:[]}catch(o){return console.error(`Custom card "${i.type}" getEntitySuggestion threw:`,o),[]}})}};a()}catch(c){a(c)}})},74683:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{z:function(){return _}});var n=i(29754),o=i(95210),s=i(10073),r=i(29587),c=i(81708),l=i(75450),d=i(52120),h=i(92398),u=i(64718),p=i(37422),g=i(70907),m=i(6744),v=i(7181),y=i(20382),f=e([m]);const _={tile:(m=(f.then?(await f)():f)[0]).S,"alarm-panel":n.N,calendar:o.Q,gauge:s.D,humidifier:c.a,map:l.a,"media-control":d.l,"picture-entity":h.b,"plant-status":u.v,"statistics-graph":p.B,"history-graph":r.G,thermostat:g.t,"todo-list":v.U,"weather-forecast":y.$};a()}catch(_){a(_)}})},54:function(e,t,i){i.d(t,{BG:function(){return C},BK:function(){return _},OC:function(){return b},TQ:function(){return x},U7:function(){return L},cY:function(){return k},eT:function(){return A},ig:function(){return $},mI:function(){return H},mm:function(){return V},wH:function(){return E}});i(74423),i(44114),i(26910),i(18111),i(22489),i(61701),i(45367),i(92731),i(62953);var a=i(78648),n=i(66639),o=i(65522),s=i(37981),r=i(71727),c=i(81816),l=i(28978),d=i(52220),h=i(53756),u=i(95350),p=i(59653),g=i(24367);const m="M21.8,13H20V21H13V17.67L15.79,14.88L16.5,15C17.66,15 18.6,14.06 18.6,12.9C18.6,11.74 17.66,10.8 16.5,10.8A2.1,2.1 0 0,0 14.4,12.9L14.5,13.61L13,15.13V9.65C13.66,9.29 14.1,8.6 14.1,7.8A2.1,2.1 0 0,0 12,5.7A2.1,2.1 0 0,0 9.9,7.8C9.9,8.6 10.34,9.29 11,9.65V15.13L9.5,13.61L9.6,12.9A2.1,2.1 0 0,0 7.5,10.8A2.1,2.1 0 0,0 5.4,12.9A2.1,2.1 0 0,0 7.5,15L8.21,14.88L11,17.67V21H4V13H2.25C1.83,13 1.42,13 1.42,12.79C1.43,12.57 1.85,12.15 2.28,11.72L11,3C11.33,2.67 11.67,2.33 12,2.33C12.33,2.33 12.67,2.67 13,3L17,7V6H19V9L21.78,11.78C22.18,12.18 22.59,12.59 22.6,12.8C22.6,13 22.2,13 21.8,13M7.5,12A0.9,0.9 0 0,1 8.4,12.9A0.9,0.9 0 0,1 7.5,13.8A0.9,0.9 0 0,1 6.6,12.9A0.9,0.9 0 0,1 7.5,12M16.5,12C17,12 17.4,12.4 17.4,12.9C17.4,13.4 17,13.8 16.5,13.8A0.9,0.9 0 0,1 15.6,12.9A0.9,0.9 0 0,1 16.5,12M12,6.9C12.5,6.9 12.9,7.3 12.9,7.8C12.9,8.3 12.5,8.7 12,8.7C11.5,8.7 11.1,8.3 11.1,7.8C11.1,7.3 11.5,6.9 12,6.9Z",v="M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z",y="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",f="M17,7H7A5,5 0 0,0 2,12A5,5 0 0,0 7,17H17A5,5 0 0,0 22,12A5,5 0 0,0 17,7M17,15A3,3 0 0,1 14,12A3,3 0 0,1 17,9A3,3 0 0,1 20,12A3,3 0 0,1 17,15Z",_=e=>a.A.createIndex(M,e),b="__other_areas__",w="~",$=e=>`f|${e}`,C=e=>`u|${e}`,x=(e,t)=>`${e}${w}a|${t}`,k=(e,t)=>`${e}${w}d|${t}`,H=(e,t)=>`${e}${w}dom|${t}`,L=e=>`${e}${w}`,M=h.t.map(e=>e.name);function V(e){const{states:t,entities:i,devices:a,areas:h,floors:p,language:_,localize:b}=e,w=new Map,$=new Map,C=new Map,x=new Map,k=new Map,H=new Map,L=[];for(const n of Object.keys(t)){var M;const e=t[n];if(!e)continue;const d=i[n];if(null!=d&&d.hidden)continue;const p=null!=d&&d.device_id?a[d.device_id]:void 0,m=null!==(M=null==d?void 0:d.area_id)&&void 0!==M?M:null==p?void 0:p.area_id,v=m?h[m]:void 0,y=(0,r.m)(n),f=(0,c.aH)(e,i,a),_=(0,l.u)(e),I=p?(0,s.xn)(p):void 0,N=v?(0,o.A)(v):void 0,j=(0,u.p$)(b,y);if(L.push({id:n,name:f||_||n,area:null!=N?N:"",device:null!=I?I:"",domain:j,search_labels:{entityName:f||null,friendlyName:_||null,deviceName:I||null,areaName:N||null,domainName:j||null,entityId:n}}),!m||!h[m]){if(p){var V;const e="service"===p.entry_type?x:C,t=null!==(V=e.get(p.id))&&void 0!==V?V:[];t.push(n),e.set(p.id,t)}else if((0,g.z)(y)){var E;const e=null!==(E=k.get(y))&&void 0!==E?E:[];e.push(n),k.set(y,e)}else{var A;const e=null!==(A=H.get(y))&&void 0!==A?A:[];e.push(n),H.set(y,e)}continue}if(p&&!(null!=d&&d.area_id)){var q,z;const e=null!==(q=$.get(m))&&void 0!==q?q:new Map,t=null!==(z=e.get(p.id))&&void 0!==z?z:[];t.push(n),e.set(p.id,t),$.set(m,e)}else{var S;const e=null!==(S=w.get(m))&&void 0!==S?S:[];e.push(n),w.set(m,e)}}const I=(e,i)=>{const a=(0,l.u)(t[e])||e,n=(0,l.u)(t[i])||i;return(0,d.xL)(a,n,_)},N=e=>[...e.entries()].map(([e,t])=>{var i;const n=a[e];return{id:e,name:null!==(i=n?(0,s.xn)(n):void 0)&&void 0!==i?i:e,entityIds:t.sort(I)}}).sort((e,t)=>(0,d.xL)(e.name,t.name,_)),j=e=>{var t,i,a;const n=h[e];if(!n)return;const s=(null!==(t=w.get(e))&&void 0!==t?t:[]).sort(I),r=$.get(e),c=r?N(r):[];return s.length||c.length?{id:n.area_id,name:null!==(i=(0,o.A)(n))&&void 0!==i?i:n.area_id,icon:null!==(a=n.icon)&&void 0!==a?a:void 0,directEntityIds:s,devices:c}:void 0},O=Object.values(h),T=Object.values(p),Z=(0,n.cs)(T,O),D=Z.floors.map(({id:e,areas:t})=>{const i=p[e],a=t.map(e=>j(e)).filter(e=>!!e);if(a.length)return{id:i.floor_id,name:i.name,icon:i.icon,level:i.level,areas:a}}).filter(e=>!!e),K=Z.areas.map(e=>j(e)).filter(e=>!!e),F=e=>[...e.entries()].map(([e,t])=>({domain:e,name:(0,u.p$)(b,e),entityIds:t.sort(I)})).sort((e,t)=>(0,d.xL)(e.name,t.name,_)),B=[],P=F(H);P.length&&B.push({id:"entities",iconPath:y,label:b("ui.panel.lovelace.editor.cardpicker.entities"),domains:P});const U=F(k);U.length&&B.push({id:"helpers",iconPath:f,label:b("ui.panel.lovelace.editor.cardpicker.helpers"),domains:U});const W=N(C);W.length&&B.push({id:"devices",iconPath:v,label:b("ui.panel.lovelace.editor.cardpicker.devices"),devices:W});const R=N(x);return R.length&&B.push({id:"services",iconPath:m,label:b("ui.panel.lovelace.editor.cardpicker.services"),devices:R}),{floors:D,otherAreas:K,unassignedSections:B,searchableEntities:L}}function E(e,t){for(const a of e.floors){const e=$(a.id);for(const i of a.areas){const a=x(e,i.id);if(i.directEntityIds.includes(t))return[e,a];for(const n of i.devices)if(n.entityIds.includes(t))return[e,a,k(a,n.id)]}}const i=$(b);for(const a of e.otherAreas){const e=x(i,a.id);if(a.directEntityIds.includes(t))return[i,e];for(const n of a.devices)if(n.entityIds.includes(t))return[i,e,k(e,n.id)]}for(const a of e.unassignedSections){const e=C(a.id);if(a.devices)for(const i of a.devices)if(i.entityIds.includes(t))return[e,k(e,i.id)];if(a.domains)for(const i of a.domains)if(i.entityIds.includes(t))return[e,H(e,i.domain)]}return[]}function A(e,t,i,a=100){return i?(0,p.x)(e,i,h.t,e=>e.id,t).slice(0,a):[]}},2389:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HuiCreateDialogCard:function(){return H}});i(16280),i(3362),i(62953);var n=i(40445),o=i(5124),s=i(67576),r=i(74985),c=i(1087),l=i(18350),d=i(72554),h=(i(93444),i(76538),i(66289)),u=(i(62647),i(14503)),p=i(82360),g=i(75196),m=i(81797),v=i(73840),y=i(15950),f=e([l,d,h,m,v]);[l,d,h,m,v]=f.then?(await f)():f;let _,b,w,$,C,x=e=>e;const k="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";class H extends o.WF{async showDialog(e){this._params=e,this._narrow=matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches;const t=(0,g.ys)(e.lovelaceConfig,e.path);if("strategy"in t)throw new Error("Can't edit strategy");this._containerConfig=t,this._open=!0}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._open=!1,this._params=void 0,this._currTab="entity",(0,c.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return o.s6;const e=this._containerConfig.title?this.hass.localize("ui.panel.lovelace.editor.edit_card.pick_card_title",{name:`"${this._containerConfig.title}"`}):this.hass.localize("ui.panel.lovelace.editor.edit_card.pick_card");return(0,o.qy)(_||(_=x` <ha-dialog .open="${0}" flexcontent width="large" @keydown="${0}" @closed="${0}"> <ha-dialog-header show-border slot="header"> <ha-icon-button slot="navigationIcon" @click="${0}" .label="${0}" .path="${0}"></ha-icon-button> <span slot="title">${0}</span> ${0} </ha-dialog-header> <div class="body"> ${0} </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this._ignoreKeydown,this._dialogClosed,this._cancel,this.hass.localize("ui.common.close"),k,e,this._params.saveCard?o.s6:(0,o.qy)(b||(b=x` <ha-tab-group @wa-tab-show="${0}"> <ha-tab-group-tab slot="nav" .active="${0}" panel="entity" ?autofocus="${0}">${0}</ha-tab-group-tab> <ha-tab-group-tab slot="nav" .active="${0}" panel="card"> ${0} </ha-tab-group-tab> </ha-tab-group> `),this._handleTabChanged,"entity"===this._currTab,this._narrow,this.hass.localize("ui.panel.lovelace.editor.cardpicker.by_entity"),"card"===this._currTab,this.hass.localize("ui.panel.lovelace.editor.cardpicker.by_card")),(0,r.P)("entity"===this._currTab?(0,o.qy)(w||(w=x` <hui-suggestion-picker ?autofocus="${0}" .hass="${0}" .prioritizedCardTypes="${0}" @suggestion-picked="${0}" @browse-cards="${0}"></hui-suggestion-picker> `),!this._narrow,this.hass,this._params.suggestedCards,this._handleSuggestionPicked,this._handleBrowseCards):(0,o.qy)($||($=x` <hui-card-picker ?autofocus="${0}" .suggestedCards="${0}" .lovelace="${0}" .hass="${0}" @config-changed="${0}"></hui-card-picker> `),!this._narrow,this._params.suggestedCards,this._params.lovelaceConfig,this.hass,this._handleCardPicked)),this._cancel,this.hass.localize("ui.common.cancel"))}_ignoreKeydown(e){e.stopPropagation()}static get styles(){return[u.nA,(0,o.AH)(C||(C=x`ha-dialog{--dialog-content-padding:0;--dialog-z-index:6}@media (min-width:451px) and (min-height:501px){ha-dialog{--ha-dialog-min-height:min(900px, 80vh);--ha-dialog-max-height:var(--ha-dialog-min-height)}}ha-dialog::part(body){overflow:hidden}ha-dialog-footer{border-top:1px solid var(--divider-color)}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}.body{display:flex;flex-direction:column;flex:1;min-height:0}hui-card-picker,hui-suggestion-picker{flex:1;min-height:0}`))]}_handleBrowseCards(){this._currTab="card"}async _handleSuggestionPicked(e){const t=e.detail.config;if(this._params.saveCard)await this._params.saveCard(t);else{const e=this._params.lovelaceConfig,i=this._params.path,a=this._params.saveConfig,n=(0,p.gm)(e,i,t);await a(n)}this.closeDialog()}_handleCardPicked(e){const t=e.detail.config;if(this._params.entities&&this._params.entities.length&&("entities"in t?t.entities=this._params.entities:"entity"in t&&(t.entity=this._params.entities[0])),this._params.saveCard)return(0,y.O)(this,{lovelaceConfig:this._params.lovelaceConfig,saveCardConfig:this._params.saveCard,cardConfig:t,isNew:!0}),void this.closeDialog();const i=this._params.lovelaceConfig,a=this._params.path,n=this._params.saveConfig,o=2===a.length?(0,g.ys)(i,a):void 0;(0,y.O)(this,{lovelaceConfig:i,saveCardConfig:async e=>{const t=(0,p.gm)(i,a,e);await n(t)},cardConfig:t,sectionConfig:o,isNew:!0}),this.closeDialog()}_handleTabChanged(e){const t=e.detail.name;t!==this._currTab&&(this._currTab=t)}_cancel(e){e&&e.stopPropagation(),this.closeDialog()}constructor(...e){super(...e),this._open=!1,this._currTab="entity",this._narrow=!1}}(0,n.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,n.Cg)([(0,s.wk)()],H.prototype,"_params",void 0),(0,n.Cg)([(0,s.wk)()],H.prototype,"_open",void 0),(0,n.Cg)([(0,s.wk)()],H.prototype,"_containerConfig",void 0),(0,n.Cg)([(0,s.wk)()],H.prototype,"_currTab",void 0),(0,n.Cg)([(0,s.wk)()],H.prototype,"_narrow",void 0),H=(0,n.Cg)([(0,s.EM)("hui-dialog-create-card")],H),a()}catch(_){a(_)}})},33300:function(e,t,i){i.a(e,async function(e,t){try{var a=i(40445),n=i(5124),o=i(67576),s=i(1087),r=(i(54276),i(45291)),c=i(46856),l=e([c]);c=(l.then?(await l)():l)[0];let d,h,u,p,g=e=>e;const m=6,v=e=>{var t;const i=e,a=null!==(t=i.cards)&&void 0!==t?t:i.entities;if(!a||a.length<=m)return{config:e,hiddenCount:0};const n=a.slice(0,m);return{config:i.cards?Object.assign(Object.assign({},e),{},{cards:n}):Object.assign(Object.assign({},e),{},{entities:n}),hiddenCount:a.length-m}};class y extends n.WF{willUpdate(e){var t;super.willUpdate(e),e.has("suggestion")&&(this._preview=null!==(t=this.suggestion)&&void 0!==t&&t.config?v(this.suggestion.config):void 0)}render(){var e,t;const{suggestion:i}=this,a=null!==(e=null===(t=this._preview)||void 0===t?void 0:t.hiddenCount)&&void 0!==e?e:0,o=i.config.type;let s;if((0,r.c8)(o)){var c,l;const e=(0,r.Iu)(o);s=null!==(c=null===(l=(0,r.wi)(e))||void 0===l?void 0:l.name)&&void 0!==c?c:e}else s=this.hass.localize(`ui.panel.lovelace.editor.card.${o}.name`);const p=i.label?`${s} - ${i.label}`:s;return(0,n.qy)(d||(d=g` <div class="card" tabindex="0" role="button" aria-label="${0}" @keydown="${0}"> <div class="overlay" @click="${0}"></div> <div class="card-header">${0}</div> <div class="preview"> ${0} </div> ${0} <ha-ripple></ha-ripple> </div> `),p,this._handleKeyDown,this._handleClick,p,this._preview?(0,n.qy)(h||(h=g` <hui-card .hass="${0}" .config="${0}" preview></hui-card> `),this.hass,this._preview.config):n.s6,a>0?(0,n.qy)(u||(u=g` <div class="more-badge"> ${0} </div> `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.more_cards",{count:a})):n.s6)}_handleClick(){(0,s.r)(this,"pick-suggestion",{suggestion:this.suggestion})}_handleKeyDown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this._handleClick())}}y.styles=(0,n.AH)(p||(p=g`:host{display:block;height:100%}.card{height:100%;display:flex;flex-direction:column;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));background:var(--primary-background-color);cursor:pointer;position:relative;overflow:hidden;border:var(--ha-card-border-width,var(--ha-border-width-sm)) solid var(--ha-card-border-color,var(--divider-color))}.card:focus-visible{outline:2px solid var(--primary-color);outline-offset:2px}.overlay{position:absolute;inset:0;z-index:1;border-radius:inherit}.card-header{color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-medium);padding:var(--ha-space-3) var(--ha-space-4);text-align:center}.preview{pointer-events:none;margin:var(--ha-space-4);flex-grow:1;display:flex;align-items:center;justify-content:center}.preview>:first-child{display:block;width:100%}.more-badge{margin:0 var(--ha-space-4) var(--ha-space-3);padding:var(--ha-space-1) var(--ha-space-2);align-self:flex-start;border-radius:var(--ha-border-radius-md);background:var(--ha-color-fill-neutral-quiet-resting);color:var(--ha-color-text-secondary);font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-medium)}`)),(0,a.Cg)([(0,o.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],y.prototype,"suggestion",void 0),(0,a.Cg)([(0,o.wk)()],y.prototype,"_preview",void 0),y=(0,a.Cg)([(0,o.EM)("hui-suggestion-card")],y),t()}catch(d){t(d)}})},84030:function(e,t,i){i.a(e,async function(e,t){try{i(18111),i(61701),i(53921),i(3362),i(62953);var a=i(40445),n=i(35211),o=i(5124),s=i(67576),r=i(75751),c=i(22786),l=i(32172),d=i(1087),h=i(81816),u=i(28978),p=i(15638),g=i(9899),m=i(63091),v=i(74281),y=(i(75064),i(59174)),f=(i(18198),i(47680),i(69464),i(67094),i(36866)),_=i(22792),b=i(14503),w=i(85614),$=i(54),C=e([v,y,f]);[v,y,f]=C.then?(await C)():C;let x,k,H,L,M,V,E,A,q,z,S,I,N,j,O,T,Z,D,K,F,B,P,U,W,R,G,Q,J,Y=e=>e;const X="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",ee="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",te="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",ie="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",ae="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z";class ne extends o.WF{async focus(){var e,t;await this.updateComplete,await(null===(e=this._searchInput)||void 0===e?void 0:e.updateComplete),null===(t=this._searchInput)||void 0===t||t.focus()}connectedCallback(){super.connectedCallback(),this._loadDomainTranslations()}async _loadDomainTranslations(){this.hass&&(this._domainLocalize=await this.hass.loadBackendTranslation("title"))}disconnectedCallback(){super.disconnectedCallback(),this._setFilter.cancel()}_deviceDomain(e){var t,i;const a=null===(t=this.hass)||void 0===t?void 0:t.devices[e];if(null!=a&&a.primary_config_entry)return null===(i=this._configEntryLookup)||void 0===i||null===(i=i[a.primary_config_entry])||void 0===i?void 0:i.domain}willUpdate(e){var t;(super.willUpdate(e),this.hasUpdated||(0,w.i)(),!this._tree&&this.hass&&this._domainLocalize)&&(this._tree=(0,$.mm)({states:this.hass.states,entities:this.hass.entities,devices:this.hass.devices,areas:this.hass.areas,floors:this.hass.floors,language:null===(t=this.hass.locale)||void 0===t?void 0:t.language,localize:this._domainLocalize}),this._fuseIndex=(0,$.BK)(this._tree.searchableEntities),1===this._tree.floors.length&&(this._expanded={[(0,$.ig)(this._tree.floors[0].id)]:!0}))}render(){return this.hass?(0,o.qy)(x||(x=Y` <ha-input-search appearance="outlined" .value="${0}" .placeholder="${0}" @input="${0}"></ha-input-search> ${0} `),this._filter,this.hass.localize("ui.panel.lovelace.editor.cardpicker.search_entities"),this._handleFilterChange,this._tree?this._filter?this._renderSearchResults():(0,o.qy)(k||(k=Y`<div class="tree ha-scrollbar"> ${0} </div>`),this._renderTree(this._tree)):o.s6):o.s6}_isExpanded(e){var t;return null!==(t=this._expanded[e])&&void 0!==t&&t}_renderTree(e){const t=0===e.floors.length&&e.otherAreas.length>0;return(0,o.qy)(H||(H=Y` ${0} ${0} `),e.floors.length||e.otherAreas.length?(0,o.qy)(L||(L=Y` <ha-section-title> ${0} </ha-section-title> ${0} ${0} `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.home"),(0,r.u)(e.floors,e=>e.id,e=>this._renderFloor(e,!1)),e.otherAreas.length?t?(0,r.u)(e.otherAreas,e=>e.id,e=>this._renderArea(e,(0,$.ig)($.OC))):this._renderFloor({id:$.OC,name:this.hass.localize("ui.panel.lovelace.editor.cardpicker.other_areas"),icon:null,level:null,areas:e.otherAreas},!0):o.s6):o.s6,e.unassignedSections.length?(0,o.qy)(M||(M=Y` <ha-section-title> ${0} </ha-section-title> ${0} `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.unassigned"),(0,r.u)(e.unassignedSections,e=>e.id,e=>this._renderUnassignedSection(e))):o.s6)}_renderSearchResults(){const e=this._searchMemo(this._tree.searchableEntities,this._fuseIndex,this._filter);return e.length?(0,o.qy)(E||(E=Y` <lit-virtualizer scroller class="search-results ha-scrollbar" .items="${0}" .keyFunction="${0}" .renderItem="${0}"></lit-virtualizer> `),e,this._searchKeyFunction,this._getSearchRowRenderer(this.selectedEntityId)):(0,o.qy)(V||(V=Y` <div class="empty"> <ha-svg-icon .path="${0}"></ha-svg-icon> <h2> ${0} </h2> <p> ${0} </p> </div> `),ie,this.hass.localize("ui.panel.lovelace.editor.cardpicker.no_search_results_title"),this.hass.localize("ui.panel.lovelace.editor.cardpicker.no_search_results_description"))}_renderChevron(e){return(0,o.qy)(A||(A=Y`<ha-svg-icon class="chevron" .path="${0}"></ha-svg-icon>`),e?X:"rtl"===m.G.document.dir?te:ee)}_renderFloor(e,t){const i=(0,$.ig)(e.id),a=this._isExpanded(i);return(0,o.qy)(q||(q=Y` <ha-combo-box-item type="button" class="branch depth-root floor-item" aria-expanded="${0}" data-node-key="${0}" @click="${0}"> <div slot="start" class="leading"> ${0} ${0} </div> <span slot="headline">${0}</span> </ha-combo-box-item> ${0} `),a,i,this._toggleNode,this._renderChevron(a),t?(0,o.qy)(z||(z=Y`<ha-svg-icon .path="${0}"></ha-svg-icon>`),ae):(0,o.qy)(S||(S=Y`<ha-floor-icon .floor="${0}"></ha-floor-icon>`),{icon:e.icon,level:e.level}),e.name,a?(0,r.u)(e.areas,e=>e.id,e=>this._renderArea(e,i)):o.s6)}_renderArea(e,t){const i=(0,$.TQ)(t,e.id),a=this._isExpanded(i);return(0,o.qy)(I||(I=Y` <ha-combo-box-item type="button" class="branch depth-area area-item" aria-expanded="${0}" data-node-key="${0}" @click="${0}"> <div slot="start" class="leading"> ${0} ${0} </div> <span slot="headline">${0}</span> </ha-combo-box-item> ${0} `),a,i,this._toggleNode,this._renderChevron(a),e.icon?(0,o.qy)(N||(N=Y`<ha-icon .icon="${0}"></ha-icon>`),e.icon):(0,o.qy)(j||(j=Y`<ha-svg-icon .path="${0}"></ha-svg-icon>`),ae),e.name,a?(0,o.qy)(O||(O=Y` ${0} ${0} `),(0,r.u)(e.devices,e=>e.id,e=>this._renderDevice(e,i)),(0,r.u)(e.directEntityIds,e=>e,e=>this._renderEntity(e,"depth-entity-area"))):o.s6)}_renderDevice(e,t){const i=(0,$.cY)(t,e.id),a=this._isExpanded(i),n=this._deviceDomain(e.id);return(0,o.qy)(T||(T=Y` <ha-combo-box-item type="button" class="branch depth-device device-item" aria-expanded="${0}" data-node-key="${0}" @click="${0}"> <div slot="start" class="leading"> ${0} ${0} </div> <span slot="headline">${0}</span> </ha-combo-box-item> ${0} `),a,i,this._toggleNode,this._renderChevron(a),n?(0,o.qy)(Z||(Z=Y`<ha-domain-icon .hass="${0}" .domain="${0}" brand-fallback></ha-domain-icon>`),this.hass,n):(0,o.qy)(D||(D=Y`<ha-svg-icon .path="${0}"></ha-svg-icon>`),ae),e.name,a?(0,r.u)(e.entityIds,e=>e,e=>this._renderEntity(e,"depth-entity-device")):o.s6)}_renderUnassignedSection(e){const t=(0,$.BG)(e.id),i=this._isExpanded(t);return(0,o.qy)(K||(K=Y` <ha-combo-box-item type="button" class="branch depth-root floor-item" aria-expanded="${0}" data-node-key="${0}" @click="${0}"> <div slot="start" class="leading"> ${0} <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <span slot="headline">${0}</span> </ha-combo-box-item> ${0} `),i,t,this._toggleNode,this._renderChevron(i),e.iconPath,e.label,i?(0,o.qy)(F||(F=Y` ${0} ${0} `),e.devices?(0,r.u)(e.devices,e=>e.id,e=>this._renderDevice(e,t)):o.s6,e.domains?(0,r.u)(e.domains,e=>e.domain,e=>{const i=(0,$.mI)(t,e.domain),a=this._isExpanded(i);return(0,o.qy)(B||(B=Y` <ha-combo-box-item type="button" class="branch depth-area area-item" aria-expanded="${0}" data-node-key="${0}" @click="${0}"> <div slot="start" class="leading"> ${0} <ha-domain-icon .hass="${0}" .domain="${0}" brand-fallback></ha-domain-icon> </div> <span slot="headline">${0}</span> </ha-combo-box-item> ${0} `),a,i,this._toggleNode,this._renderChevron(a),this.hass,e.domain,e.name,a?(0,r.u)(e.entityIds,e=>e,e=>this._renderEntity(e,"depth-entity-area")):o.s6)}):o.s6):o.s6)}_renderEntity(e,t){const i=this.hass.states[e],a=this.selectedEntityId===e,n=(i?(0,h.aH)(i,this.hass.entities,this.hass.devices):void 0)||(i?(0,u.u)(i):void 0)||e;return(0,o.qy)(P||(P=Y` <ha-combo-box-item type="button" class="leaf ${0} entity-item ${0}" aria-current="${0}" data-entity-id="${0}" @click="${0}"> <div slot="start" class="leading"> <span class="chevron-spacer"></span> ${0} </div> <span slot="headline">${0}</span> </ha-combo-box-item> `),t,a?"selected":"",a?"true":"false",e,this._pickEntity,i?(0,o.qy)(U||(U=Y`<state-badge .hass="${0}" .stateObj="${0}"></state-badge>`),this.hass,i):o.s6,n)}_toggleNode(e){const t=e.currentTarget.dataset.nodeKey;if(t)if(this._expanded[t]){const e=Object.assign({},this._expanded);delete e[t];const i=(0,$.U7)(t);for(const t of Object.keys(e))t.startsWith(i)&&delete e[t];this._expanded=e}else this._expanded=Object.assign(Object.assign({},this._expanded),{},{[t]:!0})}_expandToEntity(e){if(!this._tree)return;const t=(0,$.wH)(this._tree,e);if(!t.length)return;const i=Object.assign({},this._expanded);let a=!1;for(const n of t)i[n]||(i[n]=!0,a=!0);a&&(this._expanded=i)}_handleFilterChange(e){var t;this._setFilter(null!==(t=e.target.value)&&void 0!==t?t:"")}static get styles(){return[b.dp,(0,o.AH)(W||(W=Y`:host{display:flex;flex-direction:column;min-height:0}ha-input-search{padding:var(--ha-space-3);border-bottom:var(--ha-border-width-sm) solid var(--divider-color)}.tree{flex:1;min-height:0;overflow:auto;padding-bottom:var(--ha-space-3)}lit-virtualizer.search-results{flex:1;min-height:0;padding-bottom:var(--ha-space-3)}ha-combo-box-item{--md-list-item-one-line-container-height:40px;--md-list-item-two-line-container-height:48px;--md-list-item-leading-space:var(--ha-space-3);--md-list-item-trailing-space:var(--ha-space-3);--md-list-item-leading-element-leading-space:0;width:100%}ha-combo-box-item.depth-area{--md-list-item-leading-space:var(--ha-space-8)}ha-combo-box-item.depth-device{--md-list-item-leading-space:var(--ha-space-12)}ha-combo-box-item.depth-entity-area{--md-list-item-leading-space:var(--ha-space-12)}ha-combo-box-item.depth-entity-device{--md-list-item-leading-space:var(--ha-space-16)}.leading{display:flex;align-items:center;gap:var(--ha-space-2)}.leading ha-domain-icon,.leading ha-floor-icon,.leading ha-icon,.leading ha-svg-icon{color:var(--secondary-text-color)}.leading state-badge{--state-icon-color:var(--secondary-text-color);width:24px;height:24px}.chevron{color:var(--secondary-text-color);flex:0 0 24px}.chevron-spacer{width:24px;flex:0 0 24px}.floor-item{--md-list-item-label-text-weight:var(--ha-font-weight-medium)}.entity-item.selected{background-color:var(--ha-color-fill-primary-quiet-resting,rgba(var(--rgb-primary-color,33,150,243),.12));--md-list-item-label-text-color:var(--primary-color);--md-list-item-label-text-weight:var(--ha-font-weight-medium)}.entity-item.selected .leading state-badge{--state-icon-color:var(--primary-color)}.empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ha-space-2);padding:var(--ha-space-8) var(--ha-space-4);text-align:center}.empty ha-svg-icon{--mdc-icon-size:32px;color:var(--ha-color-text-secondary)}.empty h2{margin:0;font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-medium);color:var(--primary-text-color)}.empty p{margin:0;color:var(--ha-color-text-secondary);font-size:var(--ha-font-size-s)}`))]}constructor(...e){super(...e),this._filter="",this._expanded={},this._searchMemo=(0,c.A)($.eT),this._searchKeyFunction=e=>e.id,this._getSearchRowRenderer=(0,c.A)(e=>(e,t)=>this._renderSearchRow(e,t)),this._renderSearchRow=(e,t)=>{const i=this.hass.states[e.id],a=this.selectedEntityId===e.id,n=(0,p.qC)(this.hass.language,this.hass.translationMetadata.translations)?" ◂ ":" ▸ ",s=[e.area,e.device].filter(Boolean).join(n);return(0,o.qy)(R||(R=Y` <ha-combo-box-item type="button" compact="compact" .borderTop="${0}" class="entity-item ${0}" aria-current="${0}" data-entity-id="${0}" @click="${0}"> ${0} <span slot="headline">${0}</span> ${0} ${0} </ha-combo-box-item> `),0!==t,a?"selected":"",a?"true":"false",e.id,this._pickEntity,i?(0,o.qy)(G||(G=Y`<state-badge slot="start" .hass="${0}" .stateObj="${0}"></state-badge>`),this.hass,i):o.s6,e.name,s?(0,o.qy)(Q||(Q=Y`<span slot="supporting-text">${0}</span>`),s):o.s6,e.domain?(0,o.qy)(J||(J=Y`<div slot="trailing-supporting-text" class="domain"> ${0} </div>`),e.domain):o.s6)},this._pickEntity=e=>{const t=e.currentTarget.dataset.entityId;t&&(this._expandToEntity(t),(0,d.r)(this,"entity-picked",{entityId:t}))},this._setFilter=(0,g.s)(e=>{this._filter=e},150)}}(0,a.Cg)([(0,s.MZ)({attribute:!1})],ne.prototype,"hass",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1})],ne.prototype,"selectedEntityId",void 0),(0,a.Cg)([(0,s.wk)()],ne.prototype,"_filter",void 0),(0,a.Cg)([(0,s.wk)()],ne.prototype,"_expanded",void 0),(0,a.Cg)([(0,s.wk)(),(0,n.Fg)({context:_.g5,subscribe:!0}),(0,l.p)({transformer:e=>e?Object.fromEntries(e.map(e=>[e.entry_id,e])):void 0})],ne.prototype,"_configEntryLookup",void 0),(0,a.Cg)([(0,s.wk)()],ne.prototype,"_domainLocalize",void 0),(0,a.Cg)([(0,s.wk)()],ne.prototype,"_tree",void 0),(0,a.Cg)([(0,s.wk)()],ne.prototype,"_fuseIndex",void 0),(0,a.Cg)([(0,s.P)("ha-input-search")],ne.prototype,"_searchInput",void 0),ne=(0,a.Cg)([(0,s.EM)("hui-suggestion-entity-tree")],ne),t()}catch(x){t(x)}})},73840:function(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(22489),i(33110),i(3362),i(88454),i(29452),i(62953);var a=i(40445),n=i(5124),o=i(67576),s=i(6412),r=i(75751),c=i(22786),l=i(1087),d=i(74705),h=i(74281),u=i(18350),p=(i(75064),i(26300)),g=(i(54276),i(69464),i(67094),i(14503)),m=i(35694),v=i(33300),y=i(84030),f=e([h,u,p,v,y,m]);[h,u,p,v,y,m]=f.then?(await f)():f;let _,b,w,$,C,x,k,H,L,M,V,E=e=>e;const A="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",q="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z";class z extends n.WF{async focus(){var e;await this.updateComplete,await(null===(e=this._entityTree)||void 0===e?void 0:e.focus())}connectedCallback(){super.connectedCallback(),this._narrowMql=matchMedia("(max-width: 600px)"),this._narrow=this._narrowMql.matches,this._narrowMql.addEventListener("change",this._handleNarrowChange)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._narrowMql)||void 0===e||e.removeEventListener("change",this._handleNarrowChange),this._narrowMql=void 0}render(){const e=!!this._entityId,t=!this._narrow||!e,i=!this._narrow||e;return(0,n.qy)(_||(_=E` <div class="${0}"> <hui-suggestion-entity-tree class="tree" .hass="${0}" .selectedEntityId="${0}" @entity-picked="${0}"></hui-suggestion-entity-tree> </div> <div class="${0}"> <div class="content ha-scrollbar"> ${0} </div> </div> `),(0,s.H)({sidebar:!0,hidden:!t}),this.hass,this._entityId,this._handleEntityPicked,(0,s.H)({main:!0,hidden:!i}),this._renderMainContent(e))}_renderMainContent(e){if(!e)return this._renderEmptyState();const{core:t,custom:i}=this._suggestions();return(0,n.qy)(b||(b=E` ${0} <ha-section-title> ${0} </ha-section-title> ${0} ${0} ${0} `),this._narrow?this._renderSelectedEntity():n.s6,this.hass.localize("ui.panel.lovelace.editor.cardpicker.suggestions_title"),this._renderSuggestionsGrid(t),i.length?(0,n.qy)(w||(w=E` <ha-section-title> ${0} </ha-section-title> ${0} `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.community_title"),this._renderSuggestionsGrid(i)):n.s6,this._renderBrowseCard())}_renderBrowseCard(){return(0,n.qy)($||($=E` <div class="browse-card"> <p> ${0} </p> <ha-button appearance="plain" @click="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div> `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.not_found"),this._browseCards,q,this.hass.localize("ui.panel.lovelace.editor.cardpicker.browse_cards"))}_renderSelectedEntity(){const e=this.hass.states[this._entityId],{primary:t,secondary:i}=e?(0,d.Bj)(this.hass,e):{primary:this._entityId,secondary:void 0};return(0,n.qy)(C||(C=E` <ha-section-title> ${0} </ha-section-title> <ha-combo-box-item compact="compact" class="selected-entity"> ${0} <span slot="headline">${0}</span> ${0} <ha-icon-button slot="end" .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> </ha-combo-box-item> `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.selected_entity"),e?(0,n.qy)(x||(x=E`<state-badge slot="start" .hass="${0}" .stateObj="${0}"></state-badge>`),this.hass,e):n.s6,t,i?(0,n.qy)(k||(k=E`<span slot="supporting-text">${0}</span>`),i):n.s6,this.hass.localize("ui.common.clear"),A,this._clearEntity)}_renderEmptyState(){return(0,n.qy)(H||(H=E` <div class="content-empty"> <h2> ${0} </h2> <p> ${0} </p> <ha-button appearance="plain" @click="${0}"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div> `),this.hass.localize("ui.panel.lovelace.editor.cardpicker.content_empty_title"),this.hass.localize("ui.panel.lovelace.editor.cardpicker.content_empty_description"),this._browseCards,q,this.hass.localize("ui.panel.lovelace.editor.cardpicker.browse_cards"))}_renderSuggestionsGrid(e){return(0,n.qy)(L||(L=E` <div class="suggestions" @pick-suggestion="${0}"> ${0} </div> `),this._pickSuggestion,(0,r.u)(e,this._suggestionKey,e=>(0,n.qy)(M||(M=E` <hui-suggestion-card .hass="${0}" .suggestion="${0}"></hui-suggestion-card> `),this.hass,e)))}_suggestions(){var e;return this._computeSuggestions(this._entityId,(null!==(e=this.prioritizedCardTypes)&&void 0!==e?e:[]).join("|"))}_browseCards(){(0,l.r)(this,"browse-cards",void 0)}_handleEntityPicked(e){this._entityId=e.detail.entityId}_clearEntity(){this._entityId=void 0}_pickSuggestion(e){(0,l.r)(this,"suggestion-picked",{config:e.detail.suggestion.config})}static get styles(){return[g.dp,(0,n.AH)(V||(V=E`:host{display:flex;flex-direction:row;min-height:0}.sidebar{flex:0 0 320px;display:flex;flex-direction:column;border-inline-end:var(--ha-border-width-sm) solid var(--divider-color);min-height:0;overflow:hidden}.tree{flex:1;min-height:0}.main{flex:1;display:flex;flex-direction:column;min-height:0}.content{flex:1;min-height:0;overflow:auto}.hidden{display:none!important}.suggestions{display:grid;gap:var(--ha-space-3);grid-template-columns:repeat(auto-fill,minmax(280px,1fr));padding:var(--ha-space-3)}.content-empty{box-sizing:border-box;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--ha-space-3);padding:var(--ha-space-8) var(--ha-space-4);text-align:center}.content-empty h2{margin:0;font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-medium)}.content-empty p{margin:0;max-width:480px;color:var(--ha-color-text-secondary);line-height:var(--ha-line-height-expanded)}.browse-card{display:flex;flex-direction:column;align-items:center;gap:var(--ha-space-2);padding:var(--ha-space-6) var(--ha-space-4)}.browse-card p{margin:0;color:var(--ha-color-text-secondary);font-size:var(--ha-font-size-s)}@media (max-width:600px){:host{flex-direction:column;overflow:hidden}.sidebar{flex:1;border-inline-end:none}}`))]}constructor(...e){super(...e),this._narrow=!1,this._handleNarrowChange=e=>{this._narrow=e.matches},this._computeSuggestions=(0,c.A)((e,t)=>{const{core:i,custom:a}=(0,m.h)(this.hass,e),n=t?t.split("|"):void 0;if(null==n||!n.length)return{core:i,custom:a};const o=e=>n.includes(e.config.type);return{core:[...i.filter(o),...i.filter(e=>!o(e))],custom:a}}),this._suggestionKeys=new WeakMap,this._suggestionKey=e=>{let t=this._suggestionKeys.get(e);return void 0===t&&(t=JSON.stringify(e.config),this._suggestionKeys.set(e,t)),t}}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],z.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:!1})],z.prototype,"prioritizedCardTypes",void 0),(0,a.Cg)([(0,o.wk)()],z.prototype,"_entityId",void 0),(0,a.Cg)([(0,o.wk)()],z.prototype,"_narrow",void 0),(0,a.Cg)([(0,o.P)("hui-suggestion-entity-tree")],z.prototype,"_entityTree",void 0),z=(0,a.Cg)([(0,o.EM)("hui-suggestion-picker")],z),t()}catch(_){t(_)}})},74985:function(e,t,i){i.d(t,{P:function(){return r}});i(88454),i(29452),i(62953);var a=i(5055),n=i(42017),o=i(63937);const s=e=>(0,o.ps)(e)?e._$litType$.h:e.strings,r=(0,n.u$)(class extends n.WL{render(e){return[e]}update(e,[t]){const i=(0,o.qb)(this.it)?s(this.it):null,n=(0,o.qb)(t)?s(t):null;if(null!==i&&(null===n||i!==n)){const t=(0,o.cN)(e).pop();let n=this.et.get(i);if(void 0===n){const e=document.createDocumentFragment();n=(0,a.XX)(a.s6,e),n.setConnected(!1),this.et.set(i,n)}(0,o.mY)(n,[t]),(0,o.Dx)(n,void 0,t)}if(null!==n){if(null===i||i!==n){const t=this.et.get(n);if(void 0!==t){const i=(0,o.cN)(t).pop();(0,o.Jz)(e),(0,o.Dx)(e,void 0,i),(0,o.mY)(e,[i])}}this.it=t}else this.it=void 0;return this.render(t)}constructor(e){super(e),this.et=new WeakMap}})}}]);