UNPKG

iobroker.lovelace

Version:

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

2 lines 42.3 kB
/*! For license information please see 5590.7da191c7ddcefa69.js.LICENSE.txt */ "use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[5590],{82474:function(t,e,i){i.a(t,async function(t,e){try{i(13609),i(18111),i(20116),i(61701),i(3362),i(62953);var a=i(40445),s=i(5124),o=i(67576),n=i(22786),l=i(1087),r=i(74705),h=i(78649),c=i(53756),d=i(95350),p=i(24367),u=i(19711),v=(i(75064),i(38508)),g=(i(47680),i(67094),i(74281)),m=t([v,g]);[v,g]=m.then?(await m)():m;let _,y,b,f,w,$,C,x,k,I,M,A,z,L,q,H=t=>t;const E="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",V="M11,13.5V21.5H3V13.5H11M12,2L17.5,11H6.5L12,2M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13Z",O="___create-new-entity___";class Z extends s.WF{willUpdate(t){var e;this._pendingEntityId&&t.has("hass")&&this.hass.states!==(null===(e=t.get("hass"))||void 0===e?void 0:e.states)&&this.hass.states[this._pendingEntityId]&&(this._setValue(this._pendingEntityId),this._pendingEntityId=void 0)}firstUpdated(t){super.firstUpdated(t),this.hass.loadBackendTranslation("title")}_findExtraOption(t){var e;return t?null===(e=this.extraOptions)||void 0===e?void 0:e.find(e=>e.id===t):void 0}_renderExtraOptionStart(t){const e=t.entity_id?this.hass.states[t.entity_id]:void 0;return e?(0,s.qy)(_||(_=H` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),e,this.hass):t.icon_path?(0,s.qy)(y||(y=H` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> `),t.icon_path):t.icon?(0,s.qy)(b||(b=H`<ha-icon slot="start" .icon="${0}"></ha-icon>`),t.icon):s.s6}get _showEntityId(){var t;return this.showEntityId||(null===(t=this.hass.userData)||void 0===t?void 0:t.showEntityIdPicker)}_shouldHideClearIcon(){var t;return!(null===(t=this._findExtraOption(this.value))||void 0===t||!t.hide_clear)}render(){var t,e;const i=null!==(t=this.placeholder)&&void 0!==t?t:this.hass.localize("ui.components.entity.entity-picker.placeholder");return(0,s.qy)(f||(f=H` <ha-generic-picker .hass="${0}" .disabled="${0}" .autofocus="${0}" .allowCustomValue="${0}" .required="${0}" .label="${0}" .placeholder="${0}" .helper="${0}" .value="${0}" .searchLabel="${0}" .notFoundLabel="${0}" .rowRenderer="${0}" .getItems="${0}" .getAdditionalItems="${0}" .hideClearIcon="${0}" .searchFn="${0}" .valueRenderer="${0}" .searchKeys="${0}" use-top-label .addButtonLabel="${0}" .unknownItemText="${0}" @value-changed="${0}"> </ha-generic-picker> `),this.hass,this.disabled,this.autofocus,this.allowCustomEntity,this.required,this.label,i,this.helper,this.addButton?void 0:this.value,this.searchLabel,this._notFoundLabel,this._rowRenderer,this._getItems,this._getAdditionalItems,this.hideClearIcon||this._shouldHideClearIcon(),this._searchFn,this._valueRenderer,c.t,this.addButton?null!==(e=this.addButtonLabel)&&void 0!==e?e:this.hass.localize("ui.components.entity.entity-picker.add"):void 0,this.hass.localize("ui.components.entity.entity-picker.unknown"),this._valueChanged)}async open(){var t;await this.updateComplete,await(null===(t=this._picker)||void 0===t?void 0:t.open())}_valueChanged(t){t.stopPropagation();const e=t.detail.value;if(e){if(e.startsWith(O)){const t=e.substring(O.length);return void(0,u.$)(this,{domain:t,dialogClosedCallback:t=>{t.entityId&&(this.hass.states[t.entityId]?this._setValue(t.entityId):this._pendingEntityId=t.entityId)}})}((0,h.n)(e)||this._findExtraOption(e))&&this._setValue(e)}else this._setValue(void 0)}_setValue(t){this.value=t,(0,l.r)(this,"value-changed",{value:t}),(0,l.r)(this,"change")}constructor(...t){super(...t),this.autofocus=!1,this.disabled=!1,this.required=!1,this.showEntityId=!1,this.hideClearIcon=!1,this.addButton=!1,this._valueRenderer=t=>{const e=t||"",i=this._findExtraOption(e);if(i)return(0,s.qy)(w||(w=H` ${0} <span slot="headline">${0}</span> ${0} `),this._renderExtraOptionStart(i),i.primary,i.secondary?(0,s.qy)($||($=H`<span slot="supporting-text">${0}</span>`),i.secondary):s.s6);const a=this.hass.states[e];if(!a)return(0,s.qy)(C||(C=H` <ha-svg-icon slot="start" .path="${0}" style="margin:0 4px"></ha-svg-icon> <span slot="headline">${0}</span> `),V,e);const{primary:o,secondary:n}=(0,r.Bj)(this.hass,a);return(0,s.qy)(x||(x=H` <state-badge .hass="${0}" .stateObj="${0}" slot="start"></state-badge> <span slot="headline">${0}</span> <span slot="supporting-text">${0}</span> `),this.hass,a,o,n)},this._rowRenderer=(t,e)=>{const i=this._showEntityId;return(0,s.qy)(k||(k=H` <ha-combo-box-item type="button" compact="compact" .borderTop="${0}"> ${0} <span slot="headline">${0}</span> ${0} ${0} ${0} </ha-combo-box-item> `),0!==e,t.icon_path?(0,s.qy)(I||(I=H` <ha-svg-icon slot="start" style="margin:0 4px" .path="${0}"></ha-svg-icon> `),t.icon_path):(0,s.qy)(M||(M=H` <state-badge slot="start" .stateObj="${0}" .hass="${0}"></state-badge> `),t.stateObj,this.hass),t.primary,t.secondary?(0,s.qy)(A||(A=H`<span slot="supporting-text">${0}</span>`),t.secondary):s.s6,t.stateObj&&i?(0,s.qy)(z||(z=H` <span slot="supporting-text" class="code"> ${0} </span> `),t.stateObj.entity_id):s.s6,t.domain_name&&!i?(0,s.qy)(L||(L=H` <div slot="trailing-supporting-text" class="domain"> ${0} </div> `),t.domain_name):s.s6)},this._getAdditionalItems=()=>this._getCreateItems(this.hass.localize,this.createDomains),this._getCreateItems=(0,n.A)((t,e)=>null!=e&&e.length?(this.hass.loadFragmentTranslation("config"),e.map(e=>{const i=t("ui.components.entity.entity-picker.create_helper",{domain:(0,p.z)(e)?t(`ui.panel.config.helpers.types.${e}`)||e:(0,d.p$)(t,e)});return{id:O+e,primary:i,secondary:t("ui.components.entity.entity-picker.new_entity"),icon_path:E}})):[]),this._getEntitiesMemoized=(0,n.A)(c.w),this._getItems=()=>{var t;const e=this._getEntitiesMemoized(this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities,this.value);if(null!==(t=this.extraOptions)&&void 0!==t&&t.length){return[...this.extraOptions.map(t=>Object.assign(Object.assign({},t),{},{stateObj:t.entity_id?this.hass.states[t.entity_id]:void 0})),...e]}return e},this._searchFn=(t,e)=>{const i=e.findIndex(e=>{var i;return(null===(i=e.stateObj)||void 0===i?void 0:i.entity_id)===t});if(-1===i)return e;const[a]=e.splice(i,1);return e.unshift(a),e},this._notFoundLabel=t=>this.hass.localize("ui.components.entity.entity-picker.no_match",{term:(0,s.qy)(q||(q=H`<b>‘${0}’</b>`),t)})}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],Z.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],Z.prototype,"autofocus",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],Z.prototype,"disabled",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],Z.prototype,"required",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"allow-custom-entity"})],Z.prototype,"allowCustomEntity",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,attribute:"show-entity-id"})],Z.prototype,"showEntityId",void 0),(0,a.Cg)([(0,o.MZ)()],Z.prototype,"label",void 0),(0,a.Cg)([(0,o.MZ)()],Z.prototype,"value",void 0),(0,a.Cg)([(0,o.MZ)()],Z.prototype,"helper",void 0),(0,a.Cg)([(0,o.MZ)()],Z.prototype,"placeholder",void 0),(0,a.Cg)([(0,o.MZ)({type:String,attribute:"search-label"})],Z.prototype,"searchLabel",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],Z.prototype,"createDomains",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"include-domains"})],Z.prototype,"includeDomains",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-domains"})],Z.prototype,"excludeDomains",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"include-device-classes"})],Z.prototype,"includeDeviceClasses",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"include-unit-of-measurement"})],Z.prototype,"includeUnitOfMeasurement",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"include-entities"})],Z.prototype,"includeEntities",void 0),(0,a.Cg)([(0,o.MZ)({type:Array,attribute:"exclude-entities"})],Z.prototype,"excludeEntities",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],Z.prototype,"entityFilter",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],Z.prototype,"extraOptions",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"hide-clear-icon",type:Boolean})],Z.prototype,"hideClearIcon",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"add-button",type:Boolean})],Z.prototype,"addButton",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"add-button-label"})],Z.prototype,"addButtonLabel",void 0),(0,a.Cg)([(0,o.P)("ha-generic-picker")],Z.prototype,"_picker",void 0),(0,a.Cg)([(0,o.wk)()],Z.prototype,"_pendingEntityId",void 0),Z=(0,a.Cg)([(0,o.EM)("ha-entity-picker")],Z),e()}catch(_){e(_)}})},17308:function(t,e,i){var a=i(40445),s=i(49838),o=i(11245),n=i(5124),l=i(67576);let r;class h extends s.B{}h.styles=[o.R,(0,n.AH)(r||(r=(t=>t)`:host{--md-sys-color-surface:var(--card-background-color)}`))],h=(0,a.Cg)([(0,l.EM)("ha-md-list")],h)},53756:function(t,e,i){i.d(e,{t:function(){return r},w:function(){return h}});i(74423),i(18111),i(22489),i(61701),i(62953);var a=i(71727),s=i(74705),o=i(28978),n=i(15638),l=i(95350);const r=[{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}],h=(t,e,i,r,h,c,d,p,u,v="")=>{let g,m=Object.keys(t.states);return d&&(m=m.filter(t=>d.includes(t))),p&&(m=m.filter(t=>!p.includes(t))),e&&(m=m.filter(t=>e.includes((0,a.m)(t)))),i&&(m=m.filter(t=>!i.includes((0,a.m)(t)))),g=m.map(e=>{const i=t.states[e],r=(0,o.u)(i),[h,c,d]=(0,s.Cf)(i,[{type:"entity"},{type:"device"},{type:"area"}],t.entities,t.devices,t.areas,t.floors),p=(0,l.p$)(t.localize,(0,a.m)(e)),u=(0,n.qC)(t.language,t.translationMetadata.translations),g=h||c||e,m=[d,h?c:void 0].filter(Boolean).join(u?" ◂ ":" ▸ ");return{id:`${v}${e}`,primary:g,secondary:m,domain_name:p,sorting_label:[g,m].filter(Boolean).join("_"),search_labels:{entityName:h||null,deviceName:c||null,areaName:d||null,domainName:p||null,friendlyName:r||null,entityId:e},stateObj:i}}),h&&(g=g.filter(t=>{var e;return t.id===u||(null===(e=t.stateObj)||void 0===e?void 0:e.attributes.device_class)&&h.includes(t.stateObj.attributes.device_class)})),c&&(g=g.filter(t=>{var e;return t.id===u||(null===(e=t.stateObj)||void 0===e?void 0:e.attributes.unit_of_measurement)&&c.includes(t.stateObj.attributes.unit_of_measurement)})),r&&(g=g.filter(t=>t.id===u||t.stateObj&&r(t.stateObj))),g}},19711:function(t,e,i){i.d(e,{$:function(){return o}});i(3362),i(62953);var a=i(1087);const s=()=>Promise.all([i.e(80131),i.e(70183),i.e(47677)]).then(i.bind(i,79029)),o=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:s,dialogParams:e})}},30592:function(t,e,i){i.a(t,async function(t,e){try{i(18111),i(61701),i(3362),i(88454),i(29452),i(62953);var a=i(40445),s=i(5124),o=i(67576),n=i(75751),l=i(1087),r=i(81816),h=i(15638),c=i(82474),d=i(26300),p=(i(85938),t([c,d]));[c,d]=p.then?(await p)():p;let u,v,g,m,_,y,b,f=t=>t;const w="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",$="M21 11H3V9H21V11M21 13H3V15H21V13Z",C="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z";class x extends s.WF{_getKey(t){return this._entityKeys.has(t)||this._entityKeys.set(t,Math.random().toString()),this._entityKeys.get(t)}_renderItem(t,e){const i=this.hass.states[t.entity],a=i&&(0,r.es)(i,this.hass.entities,this.hass.devices),o=(0,h.qC)(this.hass.language,this.hass.translationMetadata.translations),n=i&&this.hass.formatEntityName(i,a?{type:"device"}:{type:"entity"})||t.entity,l=i&&this.hass.formatEntityName(i,a?[{type:"area"}]:[{type:"area"},{type:"device"}],{separator:o?" ◂ ":" ▸ "});return(0,s.qy)(u||(u=f` <ha-md-list-item class="item"> <ha-svg-icon class="handle" .path="${0}" slot="start"></ha-svg-icon> <div slot="headline" class="label">${0}</div> ${0} <ha-icon-button slot="end" .item="${0}" .index="${0}" .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> <ha-icon-button slot="end" .index="${0}" .label="${0}" .path="${0}" @click="${0}"></ha-icon-button> </ha-md-list-item> `),$,n,l?(0,s.qy)(v||(v=f`<div slot="supporting-text" class="description"> ${0} </div>`),l):s.s6,t,e,this.hass.localize("ui.common.edit"),C,this._editItem,e,this.hass.localize("ui.common.delete"),w,this._deleteItem)}_editItem(t){const e=t.currentTarget.index;(0,l.r)(this,"edit-detail-element",{subElementConfig:{index:e,type:"row",elementConfig:this.entities[e]}})}_deleteItem(t){const e=t.target.index,i=this.entities.slice(0,e).concat(this.entities.slice(e+1));(0,l.r)(this,"entities-changed",{entities:i})}render(){return this.entities?(0,s.qy)(g||(g=f` <h3> ${0} </h3> ${0} <ha-entity-picker .hass="${0}" .entityFilter="${0}" @value-changed="${0}" add-button></ha-entity-picker> `),this.label||`${this.hass.localize("ui.panel.lovelace.editor.card.generic.entities")}${this.required?` (${this.hass.localize("ui.panel.lovelace.editor.card.config.required")})`:""}`,this.canEdit?(0,s.qy)(m||(m=f` <div class="items-container"> <ha-sortable handle-selector=".handle" draggable-selector=".item" @item-moved="${0}"> <ha-md-list> ${0} </ha-md-list> </ha-sortable> </div> `),this._entityMoved,this.entities.map((t,e)=>this._renderItem(t,e))):(0,s.qy)(_||(_=f`<ha-sortable handle-selector=".handle" @item-moved="${0}"> <div class="entities"> ${0} </div> </ha-sortable>`),this._entityMoved,(0,n.u)(this.entities,t=>this._getKey(t),(t,e)=>(0,s.qy)(y||(y=f` <div class="entity" data-entity-id="${0}"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <ha-entity-picker .hass="${0}" .value="${0}" .index="${0}" .entityFilter="${0}" @value-changed="${0}"></ha-entity-picker> </div> `),t.entity,$,this.hass,t.entity,e,this.entityFilter,this._valueChanged))),this.hass,this.entityFilter,this._addEntity):s.s6}async _addEntity(t){const e=t.detail.value;if(""===e)return;const i=this.entities.concat({entity:e});t.target.value="",(0,l.r)(this,"entities-changed",{entities:i})}_entityMoved(t){t.stopPropagation();const{oldIndex:e,newIndex:i}=t.detail,a=this.entities.concat();a.splice(i,0,a.splice(e,1)[0]),(0,l.r)(this,"entities-changed",{entities:a})}_valueChanged(t){const e=t.detail.value,i=t.target.index,a=this.entities.concat();""===e||void 0===e?a.splice(i,1):a[i]=Object.assign(Object.assign({},a[i]),{},{entity:e}),(0,l.r)(this,"entities-changed",{entities:a})}constructor(...t){super(...t),this.required=!0,this._entityKeys=new WeakMap}}x.styles=(0,s.AH)(b||(b=f`.entity{display:flex;align-items:center}.entity .handle{padding-right:8px;cursor:move;cursor:grab;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1}ha-md-list{gap:8px;padding-top:0;display:flex;flex-direction:column}ha-md-list:has(> *){margin-bottom:var(--ha-space-2)}ha-md-list-item{border:1px solid var(--divider-color);border-radius:8px;--ha-md-list-item-gap:0;--md-list-item-top-space:0;--md-list-item-bottom-space:0;--md-list-item-leading-space:12px;--md-list-item-trailing-space:4px;--md-list-item-two-line-container-height:48px;--md-list-item-one-line-container-height:48px}.handle{cursor:move;padding:8px;margin-inline-start:-8px}label{margin-bottom:8px;display:block}ha-md-list-item .description,ha-md-list-item .label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}`)),(0,a.Cg)([(0,o.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],x.prototype,"entities",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],x.prototype,"entityFilter",void 0),(0,a.Cg)([(0,o.MZ)()],x.prototype,"label",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],x.prototype,"required",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"can-edit",type:Boolean})],x.prototype,"canEdit",void 0),x=(0,a.Cg)([(0,o.EM)("hui-entity-editor")],x),e()}catch(u){e(u)}})},68075:function(t,e,i){i.d(e,{C:function(){return s}});i(3362),i(62953);var a=i(1087);const s=(t,e)=>{(0,a.r)(t,"show-dialog",{dialogTag:"hui-dialog-select-dashboard",dialogImport:()=>i.e(35131).then(i.bind(i,72406)),dialogParams:e})}},70997:function(t,e,i){i.a(t,async function(t,a){try{i.r(e),i.d(e,{HuiDialogEditView:function(){return Q}});var s=i(86518),o=(i(33110),i(3362),i(27495),i(25440),i(62953),i(40445)),n=i(5124),l=i(67576),r=i(6412),h=i(1087),c=i(91926),d=i(19459),p=i(38962),u=i(18350),v=(i(76538),i(93444),i(72554)),g=i(29823),m=(i(70947),i(65829)),_=i(66289),y=(i(62647),i(10763)),b=i(35952),f=i(91984),w=i(65063),$=i(14503),C=i(30592),x=i(49365),k=i(31481),I=i(36751),M=i(82360),A=i(68075),z=i(53504),L=i(54953),q=i(55832),H=t([p,u,v,g,m,_,y,C,z,L,q]);[p,u,v,g,m,_,y,C,z,L,q]=H.then?(await H)():H;let E,V,O,Z,D,j,T,N,B,P,F,R,S=t=>t;const U=["strategy"],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",W="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",Y="M14 2H6C4.9 2 4 2.9 4 4V20C4 20.41 4.12 20.8 4.34 21.12C4.41 21.23 4.5 21.33 4.59 21.41C4.95 21.78 5.45 22 6 22H13.53C13 21.42 12.61 20.75 12.35 20H6V4H13V9H18V12C18.7 12 19.37 12.12 20 12.34V8L14 2M18 23L23 18.5L20 15.8L18 14V17H14V20H18V23Z",J="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",G=["tab-settings","tab-background","tab-visibility"];class Q extends n.WF{get _type(){return(0,I.E)(this._config)}updated(t){if(this._yamlMode&&t.has("_yamlMode")){var e;const t=Object.assign({},this._config);null===(e=this._editor)||void 0===e||e.setValue(t)}}showDialog(t){if(this._params=t,this._open=!0,void 0===this._params.viewIndex)return this._config={type:x._H},void(this._dirty=!1);this._lovelace=this._params.lovelace;const e=this._lovelace.config.views[this._params.viewIndex];if((0,f.R6)(e)){const{strategy:t}=e,i=(0,s.A)(e,U);return void(this._config=i)}this._config=e,this._currentType=this._type}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._config={},this._yamlMode=!1,this._dirty=!1,this._currTab=G[0],(0,h.r)(this,"dialog-closed",{dialog:this.localName})}get _viewConfigTitle(){return this._config&&this._config.title?this.hass.localize("ui.panel.lovelace.editor.edit_view.header_name",{name:this._config.title}):this.hass.localize("ui.panel.lovelace.editor.edit_view.header")}render(){var t,e;if(!this._params)return n.s6;let i;if(this._yamlMode)i=(0,n.qy)(E||(E=S` <ha-yaml-editor autofocus in-dialog @value-changed="${0}"></ha-yaml-editor> `),this._viewYamlChanged);else switch(this._currTab){case"tab-settings":i=(0,n.qy)(V||(V=S` <hui-view-editor .isNew="${0}" .hass="${0}" .config="${0}" @view-config-changed="${0}"></hui-view-editor> `),void 0===this._params.viewIndex,this.hass,this._config,this._viewConfigChanged);break;case"tab-background":i=(0,n.qy)(O||(O=S` <hui-view-background-editor .hass="${0}" .config="${0}" @view-config-changed="${0}"></hui-view-background-editor> `),this.hass,this._config,this._viewConfigChanged);break;case"tab-visibility":i=(0,n.qy)(Z||(Z=S` <hui-view-visibility-editor .hass="${0}" .config="${0}" @view-visibility-changed="${0}"></hui-view-visibility-editor> `),this.hass,this._config,this._viewVisibilityChanged)}const a=this._type===x._H&&this._currentType!==x._H&&(null===(t=this._config)||void 0===t||null===(t=t.cards)||void 0===t?void 0:t.length),s=this._type!==x._H&&this._currentType===x._H&&(null===(e=this._config)||void 0===e||null===(e=e.sections)||void 0===e?void 0:e.length);return(0,n.qy)(D||(D=S` <ha-dialog .open="${0}" width="large" prevent-scrim-close @closed="${0}" class="${0}"> <ha-dialog-header show-border slot="header"> <ha-icon-button slot="navigationIcon" @click="${0}" .label="${0}" .path="${0}"></ha-icon-button> <h2 slot="title">${0}</h2> <ha-dropdown slot="actionItems" placement="bottom-end" @wa-select="${0}"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="toggle-mode"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="move-to-dashboard"> ${0} <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> ${0} ${0} ${0} </ha-dialog-header> ${0} <ha-dialog-footer slot="footer"> ${0} <ha-button class="save" slot="primaryAction" ?disabled="${0}" @click="${0}"> ${0} ${0}</ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this._dialogClosed,(0,r.H)({"yaml-mode":this._yamlMode}),this.closeDialog,this.hass.localize("ui.common.close"),K,this._viewConfigTitle,this._handleAction,this.hass.localize("ui.common.menu"),W,this.hass.localize("ui.panel.lovelace.editor.edit_view.edit_"+(this._yamlMode?"ui":"yaml")),J,this.hass.localize("ui.panel.lovelace.editor.edit_view.move_to_dashboard"),Y,a?(0,n.qy)(j||(j=S` <ha-alert alert-type="info"> ${0} <ha-button size="small" slot="action" @click="${0}"> ${0} </ha-button> </ha-alert> `),this.hass.localize("ui.panel.lovelace.editor.edit_view.card_to_section_convert"),this._convertToSection,this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view")):n.s6,s?(0,n.qy)(T||(T=S` <ha-alert alert-type="warning"> ${0} </ha-alert> `),this.hass.localize("ui.panel.lovelace.editor.edit_view.section_to_card_not_supported")):n.s6,this._yamlMode?n.s6:(0,n.qy)(N||(N=S`<ha-tab-group @wa-tab-show="${0}"> ${0} </ha-tab-group>`),this._handleTabChanged,G.map(t=>(0,n.qy)(B||(B=S` <ha-tab-group-tab slot="nav" .panel="${0}" .active="${0}"> ${0} </ha-tab-group-tab> `),t,this._currTab===t,this.hass.localize(`ui.panel.lovelace.editor.edit_view.${t.replace("-","_")}`)))),i,void 0!==this._params.viewIndex?(0,n.qy)(P||(P=S` <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click="${0}"> ${0} </ha-button> `),this._deleteConfirm,this.hass.localize("ui.panel.lovelace.editor.edit_view.delete")):n.s6,!this._config||this._saving||!this._dirty||!this._valid||a||s,this._save,this._saving?(0,n.qy)(F||(F=S`<ha-spinner size="small" aria-label="Saving"></ha-spinner>`)):n.s6,this.hass.localize("ui.common.save"))}async _handleAction(t){const e=t.detail.item.value;if(e)switch(e){case"toggle-mode":this._yamlMode=!this._yamlMode;break;case"move-to-dashboard":this._openSelectDashboard()}}_openSelectDashboard(){(0,A.C)(this,{lovelaceConfig:this._lovelace.config,dashboardSelectedCallback:this._moveViewToDashboard,urlPath:this._lovelace.urlPath})}async _convertToSection(){if(!this._params||!this._config)return;if(!(await(0,w.dk)(this,{title:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_title"),text:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_text"),confirmText:this.hass.localize("ui.panel.lovelace.editor.edit_view.convert_view_action"),dismissText:this.hass.localize("ui.common.cancel")})))return;const t=Object.assign({},this._config);t.type=x._H,t.sections=[(0,k.Y)(this.hass.localize)],t.path=void 0;const e=this._params.lovelace;try{await e.saveConfig((0,M.fJ)(this.hass,e.config,t)),this._params.saveCallback&&this._params.saveCallback(e.config.views.length,t),this.closeDialog()}catch(i){(0,w.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view.saving_failed")}: ${i.message}`})}finally{this._saving=!1}}async _delete(){if(this._params)try{await this._params.lovelace.saveConfig((0,M.lD)(this._params.lovelace.config,this._params.viewIndex)),this.closeDialog(),(0,c.oo)(`/${window.location.pathname.split("/")[1]}`)}catch(t){(0,w.showAlertDialog)(this,{text:`Deleting failed: ${t.message}`})}}async _deleteConfirm(){var t,e,i,a;const s=null!==(t=this._config)&&void 0!==t&&null!==(t=t.sections)&&void 0!==t&&t.length?"sections":null!==(e=this._config)&&void 0!==e&&null!==(e=e.cards)&&void 0!==e&&e.length?"cards":"only",o=null!==(i=this._config)&&void 0!==i&&i.title?"named":"unnamed";await(0,w.dk)(this,{title:this.hass.localize("ui.panel.lovelace.views.delete_title"),text:this.hass.localize(`ui.panel.lovelace.views.delete_${o}_view_${s}`,{name:null===(a=this._config)||void 0===a?void 0:a.title}),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})&&this._delete()}_handleTabChanged(t){const e=t.detail.name;e!==this._currTab&&(this._currTab=e)}async _save(){var t,e;if(!this._params||!this._config)return;if(!this._isConfigChanged())return void this.closeDialog();this._saving=!0;const i=Object.assign({},this._config);i.type!==x._H||null!==(t=i.sections)&&void 0!==t&&t.length?null!==(e=i.cards)&&void 0!==e&&e.length||(i.cards=[]):i.sections=[(0,k.Y)(this.hass.localize)];const a=this._params.lovelace;try{await a.saveConfig(this._creatingView?(0,M.fJ)(this.hass,a.config,i):(0,M.Iq)(this.hass,a.config,this._params.viewIndex,i)),this._params.saveCallback&&this._creatingView&&this._params.saveCallback(this._params.viewIndex||a.config.views.length,i),this.closeDialog()}catch(s){(0,w.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view.saving_failed")}: ${s.message}`})}finally{this._saving=!1}}_viewConfigChanged(t){t.detail&&t.detail.config&&!(0,d.b)(this._config,t.detail.config)&&(void 0!==t.detail.valid&&(this._valid=t.detail.valid),this._config=t.detail.config,this._dirty=!0)}_viewVisibilityChanged(t){t.detail.visible&&this._config&&(this._config=Object.assign(Object.assign({},this._config),{},{visible:t.detail.visible})),this._dirty=!0}_viewYamlChanged(t){t.stopPropagation(),t.detail.isValid&&(this._config=t.detail.value,this._dirty=!0)}_isConfigChanged(){return this._creatingView||JSON.stringify(this._config)!==JSON.stringify(this._params.lovelace.config.views[this._params.viewIndex])}get _creatingView(){return void 0===this._params.viewIndex}static get styles(){return[$.nA,$.kO,(0,n.AH)(R||(R=S`ha-dialog{--dialog-content-padding:var(--ha-space-6)}ha-dialog.yaml-mode{--dialog-content-padding:0}h2{margin:0;font-size:inherit;font-weight:inherit}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}ha-button[slot=secondaryAction]{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}.hidden{display:none}.error{color:var(--error-color);border-bottom:1px solid var(--error-color)}ha-alert{display:block}ha-alert ha-button{display:block}ha-button.save{position:relative}.save ha-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}`))]}constructor(...t){super(...t),this._saving=!1,this._currTab=G[0],this._dirty=!1,this._valid=!0,this._yamlMode=!1,this._currentType=(0,I.E)(),this._open=!1,this._moveViewToDashboard=async t=>{let e,i,a;try{i=await(0,b.Dz)(this.hass.connection,t,!1)}catch(s){e=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.get_config_failed"),console.error(s)}if(i&&(0,b.Wu)(i)&&(e=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.cannot_move_to_strategy")),!e){const[n,l]=(0,M.Sg)(this.hass,this._lovelace.config,i,this._params.viewIndex),r=this._lovelace.config,h=i;a=async()=>{await(0,b.ql)(this.hass,t,h),await this._lovelace.saveConfig(r)};try{await this._lovelace.saveConfig(n),await(0,b.ql)(this.hass,t,l)}catch(s){console.error(s);try{await a(),e=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.move_failed")}catch(o){console.error(o),e=this.hass.localize("ui.panel.lovelace.editor.select_dashboard.revert_failed")}}}e?(0,w.showAlertDialog)(this,{text:e}):(this._lovelace.showToast({message:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.success"),duration:4e3,action:{action:a,text:this.hass.localize("ui.common.undo")}}),this.closeDialog(),(0,c.oo)(`/${window.location.pathname.split("/")[1]}`))}}}(0,o.Cg)([(0,l.MZ)({attribute:!1})],Q.prototype,"hass",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_params",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_lovelace",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_config",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_saving",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_currTab",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_dirty",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_valid",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_yamlMode",void 0),(0,o.Cg)([(0,l.P)("ha-yaml-editor")],Q.prototype,"_editor",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_currentType",void 0),(0,o.Cg)([(0,l.wk)()],Q.prototype,"_open",void 0),Q=(0,o.Cg)([(0,l.EM)("hui-dialog-edit-view")],Q),a()}catch(E){a(E)}})},53504:function(t,e,i){i.a(t,async function(t,e){try{i(27495),i(62953);var a=i(40445),s=i(22786),o=i(5124),n=i(67576),l=i(1087),r=i(52763),h=i(17022),c=t([r]);r=(c.then?(await c)():c)[0];let d,p,u,v=t=>t;class g extends o.WF{set config(t){this._config=t}updated(t){if(this._config&&this.hass&&(t.has("_config")||t.has("hass")&&!t.get("hass"))){var e;const t=this._backgroundData(this._config);this.style.setProperty("--picture-opacity",""+(null!==(e=t.opacity)&&void 0!==e?e:100)/100);const i="object"==typeof t.image?t.image.media_content_id:t.image;i&&(0,h.St)(i)?(0,h.A1)(this.hass,i).then(t=>{this._resolvedImage=t.url}):this._resolvedImage=i}}render(){if(!this.hass)return o.s6;const t=this._backgroundData(this._config);return(0,o.qy)(d||(d=v` ${0} <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}" .localizeValue="${0}"></ha-form> `),this._resolvedImage?(0,o.qy)(p||(p=v`<div class="previewContainer"> <img src="${0}" alt="${0}"> </div>`),this._resolvedImage,this.hass.localize("ui.components.picture-upload.current_image_alt")):o.s6,this.hass,t,this._schema(this.hass.localize,!0),this._computeLabelCallback,this._valueChanged,this._localizeValueCallback)}_valueChanged(t){const e=Object.assign(Object.assign({},this._config),{},{background:t.detail.value});(0,l.r)(this,"view-config-changed",{config:e})}constructor(...t){super(...t),this._localizeValueCallback=t=>this.hass.localize(t),this._schema=(0,s.A)((t,e)=>[{name:"image",selector:{media:{accept:["image/*"],clearable:!0,image_upload:!0,hide_content_type:!0,content_id_helper:t("ui.panel.lovelace.editor.card.picture.content_id_helper")}}},...e?[{name:"settings",flatten:!0,expanded:!0,type:"expandable",schema:[{name:"opacity",selector:{number:{min:0,max:100,mode:"slider",step:10}}},{name:"attachment",selector:{button_toggle:{translation_key:"ui.panel.lovelace.editor.edit_view.background.attachment",options:["scroll","fixed"]}}},{name:"size",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.size",options:["auto","cover","contain"],mode:"dropdown"}}},{name:"alignment",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.alignment",options:["top left","top center","top right","center left","center","center right","bottom left","bottom center","bottom right"],mode:"dropdown"}}},{name:"repeat",required:!0,selector:{select:{translation_key:"ui.panel.lovelace.editor.edit_view.background.repeat",options:["repeat","no-repeat"],mode:"dropdown"}}}]}]:[]]),this._backgroundData=(0,s.A)(t=>{let e=null==t?void 0:t.background;if("string"==typeof e){var i;const t=null===(i=e.match(/url\(['"]?([^'"]+)['"]?\)/))||void 0===i?void 0:i[1];e={image:t}}return e=e?Object.assign(Object.assign({opacity:100,alignment:"center",size:"cover",repeat:"no-repeat",attachment:"scroll"},e),"string"==typeof e.image?{image:{media_content_id:e.image}}:{}):{opacity:33,alignment:"center",size:"cover",repeat:"repeat",attachment:"fixed"},e}),this._computeLabelCallback=t=>{switch(t.name){case"image":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.image");case"opacity":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.opacity");case"alignment":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.alignment.name");case"size":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.size.name");case"repeat":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.repeat.name");case"attachment":return this.hass.localize("ui.panel.lovelace.editor.edit_view.background.attachment.name");default:return this.hass.localize(`ui.panel.lovelace.editor.edit_view.background.${t.name}`)}}}}g.styles=(0,o.AH)(u||(u=v`:host{display:block;--file-upload-image-border-radius:var(--ha-border-radius-sm)}.previewContainer{width:100%;display:flex;flex-direction:column;align-items:center}img{max-width:100%;max-height:200px;margin-bottom:4px;border-radius:var(--file-upload-image-border-radius);transition:opacity .3s;opacity:var(--picture-opacity, 1)}img:hover{opacity:1}`)),(0,a.Cg)([(0,n.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,a.Cg)([(0,n.wk)()],g.prototype,"_config",void 0),(0,a.Cg)([(0,n.wk)({attribute:!1})],g.prototype,"_resolvedImage",void 0),g=(0,a.Cg)([(0,n.EM)("hui-view-background-editor")],g),e()}catch(d){e(d)}})},54953:function(t,e,i){i.a(t,async function(t,e){try{i(27495),i(62953);var a=i(40445),s=i(5124),o=i(67576),n=i(22786),l=i(1087),r=i(80880),h=i(52763),c=i(49365),d=i(36751),p=t([h]);h=(p.then?(await p)():p)[0];let u,v=t=>t;const g=/^[a-zA-Z0-9_-]+$/,m=/^[0-9]+$/;class _ extends s.WF{set config(t){this._config=t}get _type(){return(0,d.E)(this._config)}render(){var t;if(!this.hass)return s.s6;const e=this._schema(this.hass.localize,this._type),i=Object.assign(Object.assign({},this._config),{},{type:this._type,theme:"backend-selected"===(null===(t=this._config.theme)||void 0===t?void 0:t.toLowerCase())?void 0:this._config.theme});return void 0===i.max_columns&&this._type===c._H&&(i.max_columns=4),(0,s.qy)(u||(u=v` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" .computeHelper="${0}" .computeError="${0}" .error="${0}" @value-changed="${0}"></ha-form> `),this.hass,i,e,this._computeLabel,this._computeHelper,this._computeError,this._error,this._valueChanged)}_valueChanged(t){const e=t.detail.value;e.type!==c._H&&(delete e.max_columns,delete e.dense_section_placement,delete e.top_margin);const i=t=>{const e=(0,r.Y)(t||"","-");return m.test(e)?`view-${e}`:e};!this.isNew||this._suggestedPath||this._config.path!==e.path||this._config.path&&e.path!==i(this._config.title)||(e.path=i(e.title));let a=!0;this._error=void 0,e.path&&!g.test(e.path)?(a=!1,this._error={path:"error_invalid_path"}):e.path&&m.test(e.path)&&(a=!1,this._error={path:"error_number"}),(0,l.r)(this,"view-config-changed",{valid:a,config:e})}constructor(...t){super(...t),this.isNew=!1,this._suggestedPath=!1,this._schema=(0,n.A)((t,e)=>[{name:"type",selector:{select:{options:[c._H,c.NT,c.oH,"panel"].map(e=>({value:e,label:t(`ui.panel.lovelace.editor.edit_view.types.${e}`)}))}}},{name:"title",selector:{text:{}}},{name:"icon",selector:{icon:{}}},{name:"show_icon_and_title",selector:{boolean:{}}},{name:"path",selector:{text:{}}},{name:"theme",selector:{theme:{}}},{name:"subview",selector:{boolean:{}}},...e===c._H?[{name:"section_specifics",type:"expandable",flatten:!0,expanded:!0,schema:[{name:"max_columns",selector:{number:{min:1,max:10,mode:"slider",slider_ticks:!0}}},{name:"dense_section_placement",selector:{boolean:{}}},{name:"top_margin",selector:{boolean:{}}}]}]:[]]),this._computeError=t=>this.hass.localize(`ui.panel.lovelace.editor.edit_view.${t}`)||t,this._computeLabel=t=>{switch(t.name){case"path":return this.hass.localize("ui.panel.lovelace.editor.card.generic.url");case"type":case"show_icon_and_title":case"subview":case"max_columns":case"dense_section_placement":case"top_margin":case"section_specifics":return this.hass.localize(`ui.panel.lovelace.editor.edit_view.${t.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${t.name}`)}},this._computeHelper=t=>{switch(t.name){case"path":case"show_icon_and_title":case"subview":case"dense_section_placement":case"top_margin":return this.hass.localize(`ui.panel.lovelace.editor.edit_view.${t.name}_helper`);default:return}}}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],_.prototype,"isNew",void 0),(0,a.Cg)([(0,o.wk)()],_.prototype,"_config",void 0),(0,a.Cg)([(0,o.wk)()],_.prototype,"_error",void 0),_=(0,a.Cg)([(0,o.EM)("hui-view-editor")],_),e()}catch(u){e(u)}})},55832:function(t,e,i){i.a(t,async function(t,e){try{i(44114),i(26910),i(18111),i(22489),i(61701),i(13579),i(62953);var a=i(40445),s=i(5124),o=i(67576),n=i(22786),l=i(1087),r=i(52220),h=(i(78673),i(17308),i(2846),i(59646)),c=i(28669),d=t([h]);h=(d.then?(await d)():d)[0];let p,u,v,g=t=>t;class m extends s.WF{set config(t){this._config=t,this._visible=void 0===this._config.visible||this._config.visible}firstUpdated(t){super.firstUpdated(t),(0,c.hU)(this.hass).then(t=>{this._users=t.filter(t=>!t.system_generated)})}render(){return this.hass&&this._users?(0,s.qy)(p||(p=g` <p> ${0} </p> <ha-md-list> ${0} </ha-md-list> `),this.hass.localize("ui.panel.lovelace.editor.edit_view.visibility.select_users"),this._sortedUsers(this._users).map(t=>(0,s.qy)(u||(u=g` <ha-md-list-item> <ha-user-badge slot="start" .hass="${0}" .user="${0}"></ha-user-badge> <span slot="headline">${0}</span> <ha-switch slot="end" .userId="${0}" @change="${0}" .checked="${0}"></ha-switch> </ha-md-list-item> `),this.hass,t,t.name,t.id,this._valChange,this.checkUser(t.id)))):s.s6}checkUser(t){return void 0===this._visible||("boolean"==typeof this._visible?this._visible:this._visible.some(e=>e.user===t))}_valChange(t){const e=t.currentTarget.userId,i=t.currentTarget.checked;let a=[];if("boolean"==typeof this._visible){this._visible&&(a=this._users.map(t=>({user:t.id})))}else a=[...this._visible];if(!0===i){const t={user:e};a.push(t)}else a=a.filter(t=>t.user!==e);this._visible=a.filter(t=>this._users.some(e=>e.id===t.user)),(0,l.r)(this,"view-visibility-changed",{visible:this._visible})}constructor(...t){super(...t),this._sortedUsers=(0,n.A)(t=>t.sort((t,e)=>(0,r.xL)(t.name,e.name,this.hass.locale.language)))}}m.styles=(0,s.AH)(v||(v=g`:host{display:block}ha-md-list{padding:0}ha-md-list-item{--md-list-item-leading-space:0;--md-list-item-trailing-space:0;--md-list-item-top-space:var(--ha-space-1);--md-list-item-bottom-space:var(--ha-space-1);--md-list-item-one-line-container-height:48px}`)),(0,a.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,o.wk)()],m.prototype,"_config",void 0),(0,a.Cg)([(0,o.wk)()],m.prototype,"_users",void 0),(0,a.Cg)([(0,o.wk)()],m.prototype,"_visible",void 0),m=(0,a.Cg)([(0,o.EM)("hui-view-visibility-editor")],m),e()}catch(p){e(p)}})},31481:function(t,e,i){i.d(e,{Y:function(){return a}});const a=(t,e)=>({type:"grid",cards:e?[{type:"heading",heading:t("ui.panel.lovelace.editor.section.default_section_title")}]:[]})},25423:function(t,e,i){i.d(e,{U:function(){return s},Z:function(){return o}});i(44114),i(62953);var a=i(27525);const s={ArrowDown:"ArrowDown",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",Home:"Home",End:"End"};class o{get items(){const t=this.getPossibleItems(),e=[];for(const i of t){if(this.isItem(i)){e.push(i);continue}const t=i.item;t&&this.isItem(t)&&e.push(t)}return e}activateNextItem(){const t=this.items,e=(0,a.A6)(t,this.isActivatable);return e&&(e.item.tabIndex=-1),(0,a.wm)(t,e,this.isActivatable,this.wrapNavigation())}activatePreviousItem(){const t=this.items,e=(0,a.A6)(t,this.isActivatable);return e&&(e.item.tabIndex=-1),(0,a.u9)(t,e,this.isActivatable,this.wrapNavigation())}constructor(t){this.handleKeydown=t=>{const e=t.key;if(t.defaultPrevented||!this.isNavigableKey(e))return;const i=this.items;if(!i.length)return;const o=(0,a.A6)(i,this.isActivatable);t.preventDefault();const n=this.isRtl(),l=n?s.ArrowRight:s.ArrowLeft,r=n?s.ArrowLeft:s.ArrowRight;let h=null;switch(e){case s.ArrowDown:case r:h=(0,a.wm)(i,o,this.isActivatable,this.wrapNavigation());break;case s.ArrowUp:case l:h=(0,a.u9)(i,o,this.isActivatable,this.wrapNavigation());break;case s.Home:h=(0,a.zT)(i,this.isActivatable);break;case s.End:h=(0,a.RZ)(i,this.isActivatable)}h&&o&&o.item!==h&&(o.item.tabIndex=-1)},this.onDeactivateItems=()=>{const t=this.items;for(const e of t)this.deactivateItem(e)},this.onRequestActivation=t=>{this.onDeactivateItems();const e=t.target;this.activateItem(e),e.focus()},this.onSlotchange=()=>{const t=this.items;let e=!1;for(const a of t){!(!a.disabled&&a.tabIndex>-1)||e?a.tabIndex=-1:(e=!0,a.tabIndex=0)}if(e)return;const i=(0,a.c7)(t,this.isActivatable);i&&(i.tabIndex=0)};const{isItem:e,getPossibleItems:i,isRtl:o,deactivateItem:n,activateItem:l,isNavigableKey:r,isActivatable:h,wrapNavigation:c}=t;this.isItem=e,this.getPossibleItems=i,this.isRtl=o,this.deactivateItem=n,this.activateItem=l,this.isNavigableKey=r,this.isActivatable=h,this.wrapNavigation=null!=c?c:()=>!0}}},11245:function(t,e,i){i.d(e,{R:function(){return s}});let a;const s=(0,i(5124).AH)(a||(a=(t=>t)`:host{background:var(--md-list-container-color,var(--md-sys-color-surface,#fef7ff));color:unset;display:flex;flex-direction:column;outline:0;padding:8px 0;position:relative}`))},49838:function(t,e,i){i.d(e,{B:function(){return c}});i(93775),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(62953);var a=i(40445),s=i(5124),o=i(67576),n=i(25423);let l,r=t=>t;const h=new Set(Object.values(n.U));class c extends s.WF{get items(){return this.listController.items}render(){return(0,s.qy)(l||(l=r` <slot @deactivate-items="${0}" @request-activation="${0}" @slotchange="${0}"> </slot> `),this.listController.onDeactivateItems,this.listController.onRequestActivation,this.listController.onSlotchange)}activateNextItem(){return this.listController.activateNextItem()}activatePreviousItem(){return this.listController.activatePreviousItem()}constructor(){super(),this.listController=new n.Z({isItem:t=>t.hasAttribute("md-list-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>"rtl"===getComputedStyle(this).direction,deactivateItem:t=>{t.tabIndex=-1},activateItem:t=>{t.tabIndex=0},isNavigableKey:t=>h.has(t),isActivatable:t=>!t.disabled&&"text"!==t.type}),this.internals=this.attachInternals(),s.S$||(this.internals.role="list",this.addEventListener("keydown",this.listController.handleKeydown))}}(0,a.Cg)([(0,o.KN)({flatten:!0})],c.prototype,"slotItems",void 0)}}]);