UNPKG

iobroker.lovelace

Version:

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

7 lines 38.3 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[88020],{51857:function(e,i,t){t.a(e,async function(e,i){try{t(3362);var o=t(40445),a=(t(68825),t(5124)),s=t(67576),r=t(29823),n=(t(70947),t(26300)),d=(t(67094),t(65063)),c=t(14503),l=t(82360),h=t(75196),p=t(75244),v=e([r,n]);[r,n]=v.then?(await v)():v;let g,u,b=e=>e;const m="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",f="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",x="M21 11H3V9H21V11M21 13H3V15H21V13Z",w="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",y="M16,8H14V11H11V13H14V16H16V13H19V11H16M2,12C2,9.21 3.64,6.8 6,5.68V3.5C2.5,4.76 0,8.09 0,12C0,15.91 2.5,19.24 6,20.5V18.32C3.64,17.2 2,14.79 2,12M15,3C10.04,3 6,7.04 6,12C6,16.96 10.04,21 15,21C19.96,21 24,16.96 24,12C24,7.04 19.96,3 15,3M15,19C11.14,19 8,15.86 8,12C8,8.14 11.14,5 15,5C18.86,5 22,8.14 22,12C22,15.86 18.86,19 15,19Z";class C extends a.WF{render(){return(0,a.qy)(g||(g=b` <div class="section-header"> <div class="section-actions"> <ha-svg-icon aria-hidden="true" class="handle" .path="${0}"></ha-svg-icon> <ha-dropdown placement="bottom-end" @wa-select="${0}"> <ha-icon-button slot="trigger" .label="${0}" .path="${0}"></ha-icon-button> <ha-dropdown-item value="edit"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <ha-dropdown-item value="duplicate"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> <wa-divider></wa-divider> <ha-dropdown-item value="delete" variant="danger"> <ha-svg-icon slot="icon" .path="${0}"></ha-svg-icon> ${0} </ha-dropdown-item> </ha-dropdown> </div> </div> <div class="section-wrapper"> <slot></slot> </div> `),x,this._handleDropdownSelect,this.hass.localize("ui.common.menu"),f,w,this.hass.localize("ui.common.edit"),y,this.hass.localize("ui.common.duplicate"),m,this.hass.localize("ui.common.delete"))}_handleDropdownSelect(e){var i;const t=null===(i=e.detail)||void 0===i||null===(i=i.item)||void 0===i?void 0:i.value;if(t)switch(t){case"edit":this._editSection();break;case"duplicate":this._duplicateSection();break;case"delete":this._deleteSection()}}async _editSection(){(0,p.P)(this,{lovelace:this.lovelace,lovelaceConfig:this.lovelace.config,saveConfig:e=>{this.lovelace.saveConfig(e)},viewIndex:this.viewIndex,sectionIndex:this.index})}_duplicateSection(){const e=(0,l.pk)(this.lovelace.config,this.viewIndex,this.index);this.lovelace.saveConfig(e)}async _deleteSection(){var e;const i=[this.viewIndex,this.index],t=(0,h.ys)(this.lovelace.config,i);if("cards"in t&&(null===(e=t.cards)||void 0===e?void 0:e.length)){if(!(await(0,d.dk)(this,{title:this.hass.localize("ui.panel.lovelace.editor.delete_section.title"),text:this.hass.localize("ui.panel.lovelace.editor.delete_section.text"),confirmText:this.hass.localize("ui.common.delete"),destructive:!0})))return}const o=(0,l.tA)(this.lovelace.config,this.viewIndex,this.index);this.lovelace.saveConfig(o)}static get styles(){return[c.RF,(0,a.AH)(u||(u=b`.section-header{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.section-actions{position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.handle{cursor:grab;padding:8px}.section-wrapper{padding:8px;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-start-end-radius:0;border:2px dashed var(--divider-color);min-height:var(--row-height)}`))]}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"lovelace",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"index",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],C.prototype,"viewIndex",void 0),C=(0,o.Cg)([(0,s.EM)("hui-section-edit-mode")],C),i()}catch(g){i(g)}})},75244:function(e,i,t){t.d(i,{P:function(){return s}});t(3362),t(62953);var o=t(1087);const a=()=>Promise.all([t.e(66432),t.e(62612)]).then(t.bind(t,70559)),s=(e,i)=>{(0,o.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-section",dialogImport:a,dialogParams:i})}},20728:function(e,i,t){t.d(i,{U:function(){return a}});t(3362),t(62953);var o=t(1087);const a=(e,i)=>{(0,o.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-view-header",dialogImport:()=>t.e(2540).then(t.bind(t,44423)),dialogParams:i})}},30981:function(e,i,t){var o=t(40445),a=t(5124),s=t(67576),r=t(42372),n=t(78870),d=t(28918);let c;class l extends a.WF{render(){return a.s6}willUpdate(e){if(super.willUpdate(e),e.has("background")){const e=(0,d.o)(this.background);if(e){const i=e.color?(0,n.MP)(e.color):null;this.style.setProperty("--section-background-color",i);const t=void 0!==e.opacity?`${e.opacity}%`:null;this.style.setProperty("--section-background-opacity",t)}}if(!this.hass)return;const i=e.get("hass");!e.has("theme")&&i&&this.hass.themes===i.themes&&this.hass.selectedTheme===i.selectedTheme||(0,r.Q)(this,this.hass.themes,this.theme)}}l.styles=(0,a.AH)(c||(c=(e=>e)`:host{position:absolute;inset:0;border-radius:inherit;background-color:var(--section-background-color,var(--ha-section-background-color,var(--secondary-background-color)));opacity:var( --section-background-opacity, ${0}% );z-index:0;pointer-events:none}`),(0,a.iz)(50)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"background",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],l.prototype,"theme",void 0),l=(0,o.Cg)([(0,s.EM)("hui-section-background")],l)},31481:function(e,i,t){t.d(i,{Y:function(){return o}});const o=(e,i)=>({type:"grid",cards:i?[{type:"heading",heading:e("ui.panel.lovelace.editor.section.default_section_title")}]:[]})},18911:function(e,i,t){t.a(e,async function(e,o){try{t.r(i),t.d(i,{DEFAULT_MAX_COLUMNS:function(){return E},SectionsView:function(){return P}});t(72712),t(18111),t(22489),t(61701),t(18237),t(27495),t(25440),t(88454),t(29452),t(62953);var a=t(40445),s=t(88696),r=t(35211),n=t(5124),d=t(67576),c=t(6412),l=t(75751),h=t(89784),p=t(22786),v=t(63004),g=t(26300),u=(t(54276),t(85938),t(67094),t(29478)),b=t(80173),m=t(51857),f=t(82360),x=t(75196),w=(t(30981),t(31481)),y=(t(66048),t(98440)),C=t(16401),_=t(94629),$=e([g,b,m,y,C,s]);[g,b,m,y,C,s]=$.then?(await $)():$;let k,M,H,V,z,A,S,L,Z,I,q=e=>e;const T="M11.83,9L15,12.16C15,12.11 15,12.05 15,12A3,3 0 0,0 12,9C11.94,9 11.89,9 11.83,9M7.53,9.8L9.08,11.35C9.03,11.56 9,11.77 9,12A3,3 0 0,0 12,15C12.22,15 12.44,14.97 12.65,14.92L14.2,16.47C13.53,16.8 12.79,17 12,17A5,5 0 0,1 7,12C7,11.21 7.2,10.47 7.53,9.8M2,4.27L4.28,6.55L4.73,7C3.08,8.3 1.78,10 1,12C2.73,16.39 7,19.5 12,19.5C13.55,19.5 15.03,19.2 16.38,18.66L16.81,19.08L19.73,22L21,20.73L3.27,3M12,7A5,5 0 0,1 17,12C17,12.64 16.87,13.26 16.64,13.82L19.57,16.75C21.07,15.5 22.27,13.86 23,12C21.27,7.61 17,4.5 12,4.5C10.6,4.5 9.26,4.75 8,5.2L10.17,7.35C10.74,7.13 11.35,7 12,7Z",j="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",E=4,O=e=>parseInt(e.replace("px",""));class P extends n.WF{setConfig(e){this._config=e}_getSectionKey(e){return this._sectionConfigKeys.has(e)||this._sectionConfigKeys.set(e,Math.random().toString()),this._sectionConfigKeys.get(e)}_computeSectionsCount(){this._sectionColumnCount=this.sections.filter(e=>!e.hidden).map(e=>{var i;return null!==(i=e.config.column_span)&&void 0!==i?i:1}).reduce((e,i)=>e+i,0)}connectedCallback(){var e;super.connectedCallback(),this.addEventListener("section-visibility-changed",this._sectionVisibilityChanged),this._sidebarTabActive=Boolean(null===(e=window.history.state)||void 0===e?void 0:e.sidebar)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("section-visibility-changed",this._sectionVisibilityChanged)}willUpdate(e){e.has("sections")&&this._computeSectionsCount(),this._updateMaxColumnCount()}_updateMaxColumnCount(){var e;const i=null!==(e=this._columnsController.value)&&void 0!==e?e:1;i!==this._maxColumns&&(this._maxColumns=i,this._maxColumnsProvider.setValue(i))}render(){var e,i,t,o,a,s,r;if(!this.lovelace)return n.s6;const d=this.sections,p=this.lovelace.editMode,v=(null===(e=this._config)||void 0===e?void 0:e.sidebar)&&(this._sidebarVisible||p),g=this._sectionColumnCount+(p?1:0)+(v?1:0),u=Math.max(Math.min(this._maxColumns,g),1),b=v&&!this.narrow?Math.max(1,u-1):u,m=(0,_.z)(d,b);return(0,n.qy)(k||(k=q` <div class="wrapper ${0}" style="${0}"> <hui-view-header .hass="${0}" .badges="${0}" .lovelace="${0}" .viewIndex="${0}" .config="${0}"></hui-view-header> ${0} <div class="container"> <ha-sortable .disabled="${0}" @item-moved="${0}" group="section" handle-selector=".handle" draggable-selector=".section" .rollback="${0}"> <div class="content ${0}"> ${0} ${0} </div> </ha-sortable> ${0} </div> <hui-view-footer .hass="${0}" .lovelace="${0}" .viewIndex="${0}" .config="${0}"></hui-view-footer> <div class="imported-cards-section"> ${0} </div> </div> `),(0,c.H)({"top-margin":Boolean(null===(i=this._config)||void 0===i?void 0:i.top_margin),"has-sidebar":Boolean(v),narrow:this.narrow}),(0,h.W)({"--column-count":u,"--content-column-count":b}),this.hass,this.badges,this.lovelace,this.index,null===(t=this._config)||void 0===t?void 0:t.header,this.narrow&&v?(0,n.qy)(M||(M=q` <div class="mobile-tabs"> <ha-control-select .value="${0}" @value-changed="${0}" .options="${0}"> </ha-control-select> </div> `),this._sidebarTabActive?"sidebar":"content",this._viewChanged,[{value:"content",label:this._config.sidebar.content_label},{value:"sidebar",label:this._config.sidebar.sidebar_label}]):n.s6,!p,this._sectionMoved,!1,(0,c.H)({dense:Boolean(null===(o=this._config)||void 0===o?void 0:o.dense_section_placement),"mobile-hidden":this.narrow&&this._sidebarTabActive}),(0,l.u)(d,e=>this._getSectionKey(e),(e,i)=>{const t=Math.min(e.config.column_span||1,b),o=e.config.row_span||1;return(0,n.qy)(H||(H=q` <div class="section" style="${0}"> ${0} </div> `),(0,h.W)({"--column-span":t,"--row-span":o}),p?(0,n.qy)(V||(V=q` <hui-section-edit-mode .hass="${0}" .lovelace="${0}" .index="${0}" .viewIndex="${0}"> ${0} </hui-section-edit-mode> `),this.hass,this.lovelace,i,this.index,this._renderSection(e,m.has(i))):this._renderSection(e,m.has(i)))}),p?(0,n.qy)(z||(z=q` <ha-sortable group="card" @item-added="${0}" draggable-selector=".card" .rollback="${0}"> <div class="create-section-container"> <div class="drop-helper" aria-hidden="true"> <p> ${0} </p> </div> <button class="create-section" @click="${0}" aria-label="${0}" .title="${0}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${0}"></ha-svg-icon> </button> </div> </ha-sortable> `),this._handleCardAdded,!1,this.hass.localize("ui.panel.lovelace.editor.section.drop_card_create_section"),this._createSection,this.hass.localize("ui.panel.lovelace.editor.section.create_section"),this.hass.localize("ui.panel.lovelace.editor.section.create_section"),j):n.s6,null!==(a=this._config)&&void 0!==a&&a.sidebar?(0,n.qy)(A||(A=q` <hui-view-sidebar class="${0}" .hass="${0}" .badges="${0}" .lovelace="${0}" .viewIndex="${0}" .config="${0}" @sidebar-visibility-changed="${0}"></hui-view-sidebar> `),(0,c.H)({"mobile-hidden":!v||this.narrow&&!this._sidebarTabActive}),this.hass,this.badges,this.lovelace,this.index,this._config.sidebar,this._handleSidebarVisibilityChanged):n.s6,this.hass,this.lovelace,this.index,null===(s=this._config)||void 0===s?void 0:s.footer,p&&null!==(r=this._config)&&void 0!==r&&null!==(r=r.cards)&&void 0!==r&&r.length?(0,n.qy)(S||(S=q` <div class="section imported-cards"> <div class="imported-card-header"> <p class="title"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </p> <p class="subtitle"> ${0} </p> </div> <hui-section .lovelace="${0}" .hass="${0}" .config="${0}" .viewIndex="${0}" preview import-only></hui-section> </div> `),T,this.hass.localize("ui.panel.lovelace.editor.section.imported_cards_title"),this.hass.localize("ui.panel.lovelace.editor.section.imported_cards_description"),this.lovelace,this.hass,this._importedCardSectionConfig(this._config.cards),this.index):n.s6)}_handleCardAdded(e){const{data:i}=e.detail,t=i,{cardIndex:o}=(0,x.gO)(t),a=(0,x.S2)(t),s=(0,x.jW)("cards",this.lovelace.config,a)[o],r=(0,f.Bn)(this.lovelace.config,this.index,(0,w.Y)(this.hass.localize,"heading"!==s.type)),n=r.views[this.index],d=[this.index,n.sections.length-1,1],c=(0,f.sQ)(r,t,d);this.lovelace.saveConfig(c)}_renderSection(e,i){const t=void 0!==e.config.background;return(0,n.qy)(L||(L=q` <div class="section-container ${0}"> ${0} ${0} </div> `),(0,c.H)({"has-background":t,"align-background":i}),t?(0,n.qy)(Z||(Z=q`<hui-section-background .hass="${0}" .background="${0}" .theme="${0}"></hui-section-background>`),this.hass,e.config.background,e.config.theme):n.s6,e)}_createSection(){const e=(0,f.Bn)(this.lovelace.config,this.index,(0,w.Y)(this.hass.localize,!0));this.lovelace.saveConfig(e)}_sectionMoved(e){e.stopPropagation();const{oldIndex:i,newIndex:t}=e.detail,o=(0,f.hB)(this.lovelace.config,[this.index,i],[this.index,t]);this.lovelace.saveConfig(o)}_viewChanged(e){"sidebar"===e.detail.value!==this._sidebarTabActive&&this._toggleView()}_toggleView(){this._sidebarTabActive?this._sidebarScrollTop=window.scrollY:this._contentScrollTop=window.scrollY,this._sidebarTabActive=!this._sidebarTabActive,window.history.replaceState(Object.assign(Object.assign({},window.history.state),{},{sidebar:this._sidebarTabActive}),""),this.updateComplete.then(()=>{const e=this._sidebarTabActive?this._sidebarScrollTop:this._contentScrollTop;window.scrollTo(0,e)})}constructor(...e){super(...e),this.isStrategy=!1,this.narrow=!1,this.sections=[],this.cards=[],this.badges=[],this._sectionColumnCount=0,this._maxColumns=0,this._maxColumnsProvider=new r.DT(this,{context:u.V}),this._dragging=!1,this._sidebarTabActive=!1,this._sidebarVisible=!0,this._contentScrollTop=0,this._sidebarScrollTop=0,this._columnsController=new s.P(this,{callback:e=>{var i,t,o;const a=null===(i=e[0])||void 0===i?void 0:i.contentRect.width;if(!a)return 1;const s=getComputedStyle(this),r=this.shadowRoot.querySelector(".container"),n=getComputedStyle(r),d=O(n.paddingLeft)+O(n.paddingRight),c=O(s.getPropertyValue("--column-min-width")),l=O(n.columnGap),h=Math.floor((a-d+l)/(c+l)),p=null!==(t=null===(o=this._config)||void 0===o?void 0:o.max_columns)&&void 0!==t?t:E;return(0,v.q)(h,1,p)}}),this._sectionConfigKeys=new WeakMap,this._sectionVisibilityChanged=()=>{this._computeSectionsCount()},this._importedCardSectionConfig=(0,p.A)(e=>({type:"grid",cards:e})),this._handleSidebarVisibilityChanged=e=>{this._sidebarVisible=e.detail.visible,e.detail.visible||(this._sidebarTabActive=!1)}}}P.styles=(0,n.AH)(I||(I=q`:host{--row-height:var(--ha-view-sections-row-height, 56px);--row-gap:var(--ha-view-sections-row-gap, 24px);--column-gap:var(--ha-view-sections-column-gap, 32px);--column-max-width:var(--ha-view-sections-column-max-width, 500px);--column-min-width:var(--ha-view-sections-column-min-width, 320px);--narrow-column-gap:var(--ha-view-sections-narrow-column-gap, 8px);--top-margin:var(--ha-view-sections-extra-top-margin, 80px);display:block;flex:1}@media (max-width:600px){:host{--column-gap:var(--narrow-column-gap)}}.wrapper{display:flex;flex-direction:column;min-height:100%;padding:0 var(--column-gap);box-sizing:content-box;margin:0 auto;max-width:calc(var(--column-count) * var(--column-max-width) + (var(--column-count) - 1) * var(--column-gap))}.wrapper.top-margin{margin-top:var(--top-margin)}.section{border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));grid-column:span var(--column-span);grid-row:span var(--row-span)}.section:has(hui-section[hidden]){display:none}.section-container{position:relative}.section-container.has-background{padding:var(--ha-space-2);border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl))}.section-container.align-background{margin-top:var(--ha-space-2);margin-bottom:var(--ha-space-2)}.container{display:grid;grid-template-columns:[content-start] repeat(var(--content-column-count),1fr);gap:var(--row-gap) var(--column-gap);padding:var(--row-gap) 0;align-items:flex-start;flex:1 0 auto}.wrapper.has-sidebar .container{grid-template-columns:[content-start] repeat(var(--content-column-count),1fr) [sidebar-start] 1fr}.wrapper.narrow.has-sidebar .container{grid-template-columns:1fr}hui-view-sidebar{grid-column:sidebar-start/-1}.wrapper.narrow hui-view-sidebar{grid-column:1/-1;padding-bottom:calc(var(--ha-space-14) + var(--ha-space-3) + var(--safe-area-inset-bottom))}.mobile-hidden{display:none!important}.mobile-tabs{position:fixed;bottom:calc(var(--ha-space-3) + var(--safe-area-inset-bottom));left:50%;transform:translateX(-50%);padding:0;z-index:1}.mobile-tabs ha-control-select{width:max-content;min-width:280px;max-width:90%;--control-select-thickness:var(--ha-space-14);--control-select-border-radius:var(--ha-border-radius-pill);--control-select-background:var(--card-background-color);--control-select-background-opacity:1;--control-select-color:var(--primary-color);--control-select-padding:6px;box-shadow:rgba(0,0,0,.3) 0px 4px 10px 0px}ha-sortable{display:contents}.content{grid-column:content-start/sidebar-start;grid-row:1/-1;display:grid;align-items:start;justify-content:center;grid-template-columns:repeat(var(--content-column-count),1fr);grid-auto-flow:row;gap:var(--row-gap) var(--column-gap)}.wrapper.narrow .content{grid-column:1/-1}.wrapper.narrow.has-sidebar .content{padding-bottom:calc(var(--ha-space-14) + var(--ha-space-3) + var(--safe-area-inset-bottom))}.content.dense{grid-auto-flow:row dense}.create-section-container{position:relative;display:flex;flex-direction:column;margin-top:36px}.create-section-container .card{display:none}.create-section-container:has(.card) .drop-helper{display:flex}.create-section-container:has(.card) .create-section{display:none}.drop-helper{display:none;flex-direction:column;align-items:center;justify-content:center;position:relative;outline:0;background:0 0;cursor:pointer;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--primary-color);height:calc(var(--row-height) + 2 * (var(--row-gap) + 2px));padding:8px;box-sizing:border-box;width:100%;--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.drop-helper p{color:var(--primary-text-color);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);text-align:center}.create-section{display:block;position:relative;outline:0;background:0 0;cursor:pointer;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--primary-color);order:1;height:calc(var(--row-height) + 2 * (var(--row-gap) + 2px));padding:8px;box-sizing:border-box;width:100%;--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.create-section:focus{border:2px solid var(--primary-color)}.sortable-ghost{border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl))}hui-view-header{display:block;padding-top:var(--row-gap)}hui-view-footer{display:block}.imported-cards{--column-span:var(--column-count);--row-span:1;order:2}.imported-card-header{margin-top:36px;padding:32px 0 16px 0;border-top:4px dotted var(--divider-color)}.imported-card-header .title{margin:0;color:var(--primary-text-color);font-size:var(--ha-font-size-l);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);--mdc-icon-size:18px;display:flex;align-items:center;gap:var(--ha-space-3);margin-bottom:8px}.imported-card-header .subtitle{margin:0;color:var(--secondary-text-color);font-size:var(--ha-font-size-m);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed)}`)),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"lovelace",void 0),(0,a.Cg)([(0,d.MZ)({type:Number})],P.prototype,"index",void 0),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"isStrategy",void 0),(0,a.Cg)([(0,d.MZ)({type:Boolean})],P.prototype,"narrow",void 0),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"sections",void 0),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"cards",void 0),(0,a.Cg)([(0,d.MZ)({attribute:!1})],P.prototype,"badges",void 0),(0,a.Cg)([(0,d.wk)()],P.prototype,"_config",void 0),(0,a.Cg)([(0,d.wk)()],P.prototype,"_sectionColumnCount",void 0),(0,a.Cg)([(0,d.wk)()],P.prototype,"_dragging",void 0),(0,a.Cg)([(0,d.wk)()],P.prototype,"_sidebarTabActive",void 0),(0,a.Cg)([(0,d.wk)()],P.prototype,"_sidebarVisible",void 0),P=(0,a.Cg)([(0,d.EM)("hui-sections-view")],P),o()}catch(k){o(k)}})},66048:function(e,i,t){t(49255);var o=t(40445),a=t(5124),s=t(67576),r=t(6412),n=t(89784),d=(t(54276),t(67094),t(91984),t(76760)),c=t(21146),l=t(15950),h=t(82360),p=(t(3362),t(62953),t(1087));let v,g,u,b,m,f,x=e=>e;class w extends a.WF{connectedCallback(){super.connectedCallback(),this.addEventListener("card-visibility-changed",this._checkHidden)}willUpdate(e){var i;if(e.has("config"))return null!==(i=this.config)&&void 0!==i&&i.card?this.card=this._createCardElement(this.config.card):this.card=void 0,void this._checkHidden();this.card&&(e.has("hass")&&(this.card.hass=this.hass),e.has("lovelace")&&(this.card.preview=this.lovelace.editMode)),(e.has("lovelace")||e.has("card"))&&this._checkHidden()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("card-visibility-changed",this._checkHidden)}_checkHidden(){var e;const i=!(null!==(e=this.lovelace)&&void 0!==e&&e.editMode)&&(!this.card||this.card.hasAttribute("hidden"));this.toggleAttribute("hidden",i),this.toggleAttribute("sticky",Boolean(this.card))}_createCardElement(e){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.lovelace.editMode,i.layout="grid",i.config=e,i.addEventListener("card-updated",e=>{e.stopPropagation(),this.requestUpdate()}),i.load(),i}_addCard(){(0,c.u)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[this.viewIndex],saveCard:e=>{this._saveFooterConfig(Object.assign(Object.assign({},this.config),{},{card:e}))}})}_deleteCard(e){e.stopPropagation();const i=Object.assign({},this.config);delete i.card,this._saveFooterConfig(i)}_configure(){var e,i;e=this,i={config:this.config||{},saveConfig:e=>{this._saveFooterConfig(e)}},(0,p.r)(e,"show-dialog",{dialogTag:"hui-dialog-edit-view-footer",dialogImport:()=>t.e(42364).then(t.bind(t,94039)),dialogParams:i})}_editCard(e){var i;e.stopPropagation();const t=null===(i=this.config)||void 0===i?void 0:i.card;t&&(0,l.O)(this,{cardConfig:t,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{this._saveFooterConfig(Object.assign(Object.assign({},this.config),{},{card:e}))}})}_saveFooterConfig(e){const i=this.lovelace.config.views[this.viewIndex],t=Object.assign(Object.assign({},i),{},{footer:e}),o=(0,h.Iq)(this.hass,this.lovelace.config,this.viewIndex,t);this.lovelace.saveConfig(o)}_renderCard(e,i){const t=e.getGridOptions(),{rows:o}=(0,d.Ns)(t);return(0,a.qy)(v||(v=x` <div class="card ${0}" style="${0}"> ${0} </div> `),(0,r.H)({"fit-rows":"number"==typeof o}),(0,n.W)({"--row-size":"number"==typeof o?String(o):void 0}),i?(0,a.qy)(g||(g=x` <hui-card-edit-mode @ll-edit-card="${0}" @ll-delete-card="${0}" .hass="${0}" .lovelace="${0}" .path="${0}" no-duplicate no-move> ${0} </hui-card-edit-mode> `),this._editCard,this._deleteCard,this.hass,this.lovelace,[0],e):e)}render(){var e,i;if(!this.lovelace)return a.s6;const t=Boolean(null===(e=this.lovelace)||void 0===e?void 0:e.editMode),o=this.card;return t||o?(0,a.qy)(u||(u=x` <div class="${0}" style="${0}"> ${0} <div class="${0}"> ${0} </div> </div> `),(0,r.H)({wrapper:!0,"edit-mode":t}),(0,n.W)({"--footer-max-width":`${(null===(i=this.config)||void 0===i?void 0:i.max_width)||600}px`}),t?(0,a.qy)(b||(b=x` <div class="actions-container"> <div class="actions"> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> </div> `),this.hass.localize("ui.common.edit"),this._configure,"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"):a.s6,(0,r.H)({container:!0,"edit-mode":t}),o?this._renderCard(o,t):t?(0,a.qy)(m||(m=x` <button class="add" @click="${0}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </button> `),this._addCard,"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.add")):a.s6):a.s6}}w.styles=(0,a.AH)(f||(f=x`:host([hidden]){display:none!important}:host([sticky]){position:sticky;bottom:var(--row-gap);z-index:4}.wrapper{padding:var(--ha-space-2) 0;padding-bottom:calc(max(var(--ha-space-2),var(--safe-area-inset-bottom,0px)));box-sizing:content-box;margin:0 auto;max-width:var(--footer-max-width,600px)}.wrapper:not(.edit-mode){--ha-card-box-shadow:var( --ha-view-footer-box-shadow, var(--ha-box-shadow-l) )}.container{--row-height:var(--ha-section-grid-row-height, 56px);--row-gap:var(--ha-section-grid-row-gap, 8px);--column-gap:var(--ha-section-grid-column-gap, 8px);position:relative;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));grid-auto-rows:auto;row-gap:var(--row-gap);column-gap:var(--column-gap)}.container.edit-mode{padding:var(--ha-space-2);border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--divider-color);border-start-end-radius:0}.card{position:relative;grid-column:1/-1;grid-row:span var(--row-size,1);max-height:25vh;max-height:25dvh}.card.fit-rows{height:calc((var(--row-size,1) * (var(--row-height) + var(--row-gap))) - var(--row-gap))}.actions-container{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.actions{z-index:1;position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.add{grid-column:1/-1;margin:0 auto;position:relative;display:flex;flex-direction:row;align-items:center;justify-content:center;outline:0;gap:var(--ha-space-2);height:36px;padding:6px 20px 6px 20px;box-sizing:border-box;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));background-color:transparent;border-width:2px;border-style:dashed;border-color:var(--primary-color);--mdc-icon-size:18px;cursor:pointer;font-size:var(--ha-font-size-m);color:var(--primary-text-color);--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.add:focus{border-style:solid}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"lovelace",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"card",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"config",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"viewIndex",void 0),w=(0,o.Cg)([(0,s.EM)("hui-view-footer")],w)},98440:function(e,i,t){t.a(e,async function(e,i){try{t(49255),t(18111),t(81148),t(62953);var o=t(40445),a=t(5124),s=t(67576),r=t(6412),n=t(36356),d=(t(54276),t(85938),t(67094),t(52667)),c=t(80173),l=t(15950),h=t(82360),p=t(20728),v=e([d,c]);[d,c]=v.then?(await v)():v;let g,u,b,m,f,x,w,y=e=>e;const 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",_="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",$="center",k="bottom",M="wrap";class H extends a.WF{_checkHidden(){const e=!this.card&&!this.lovelace.editMode&&this.badges.every(e=>e.hidden);this.toggleAttribute("hidden",e)}connectedCallback(){super.connectedCallback(),this.addEventListener("badge-visibility-changed",this._badgeVisibilityChanged)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("badge-visibility-changed",this._badgeVisibilityChanged)}willUpdate(e){var i,t;((e.has("badges")||e.has("lovelace")||e.has("card"))&&this._checkHidden(),e.has("config")||e.has("lovelace"))&&(this._dragScrollController.enabled=!this.lovelace.editMode&&"scroll"===(null===(i=this.config)||void 0===i?void 0:i.badges_wrap));if(e.has("config"))return null!==(t=this.config)&&void 0!==t&&t.card?this.card=this._createCardElement(this.config.card):this.card=void 0,void this._checkHidden();this.card&&(e.has("hass")&&(this.card.hass=this.hass),e.has("lovelace")&&(this.card.preview=this.lovelace.editMode))}_createCardElement(e){const i=document.createElement("hui-card");return i.hass=this.hass,i.preview=this.lovelace.editMode,i.config=e,i.load(),i}_addCard(){const e={type:"markdown",text_only:!0,content:this.hass.localize("ui.panel.lovelace.editor.edit_view_header.default_title",{user:"{{ user }}"})};(0,l.O)(this,{cardConfig:e,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{const i=Object.assign({},this.config);i.card=e,this._saveHeaderConfig(i)},isNew:!0})}_deleteCard(e){e.stopPropagation();const i=Object.assign({},this.config);delete i.card,this._saveHeaderConfig(i)}_editCard(e){e.stopPropagation();const i=this.config.card;i&&(0,l.O)(this,{cardConfig:i,lovelaceConfig:this.lovelace.config,saveCardConfig:e=>{const i=Object.assign({},this.config);i.card=e,this._saveHeaderConfig(i)}})}_saveHeaderConfig(e){const i=this.lovelace.config.views[this.viewIndex],t=Object.assign({},i);t.header=e;const o=(0,h.Iq)(this.hass,this.lovelace.config,this.viewIndex,t);this.lovelace.saveConfig(o)}render(){var e,i,t,o,s,n,d;if(!this.lovelace)return a.s6;const c=Boolean(null===(e=this.lovelace)||void 0===e?void 0:e.editMode),l=this.card,h=null!==(i=null===(t=this.config)||void 0===t?void 0:t.layout)&&void 0!==i?i:$,p=null!==(o=null===(s=this.config)||void 0===s?void 0:s.badges_position)&&void 0!==o?o:k,v=null!==(n=null===(d=this.config)||void 0===d?void 0:d.badges_wrap)&&void 0!==n?n:M,w=this._dragScrollController.scrolling?"dragging":"",H=void 0!==l,V=this.badges.length>0;return(0,a.qy)(g||(g=y` ${0} <div class="container ${0}"> <div class="layout ${0}"> ${0} ${0} </div> </div> `),c?(0,a.qy)(u||(u=y` <div class="actions-container"> <div class="actions"> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> </div> `),this.hass.localize("ui.common.edit"),this._configure,C):a.s6,c?"edit-mode":"",(0,r.H)({[h]:!0,[`badges-${p}`]:!0,[`badges-${v}`]:!0,"has-heading":H,"has-badges":V}),l||c?(0,a.qy)(b||(b=y` <div class="heading"> ${0} </div> `),c?l?(0,a.qy)(m||(m=y` <hui-card-edit-mode @ll-edit-card="${0}" @ll-delete-card="${0}" .hass="${0}" .lovelace="${0}" .path="${0}" no-duplicate no-move> ${0} </hui-card-edit-mode> `),this._editCard,this._deleteCard,this.hass,this.lovelace,[0],l):(0,a.qy)(f||(f=y` <button class="add" @click="${0}"> <ha-ripple></ha-ripple> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </button> `),this._addCard,_,this.hass.localize("ui.panel.lovelace.editor.edit_view_header.add_title")):l):a.s6,this.lovelace&&(c||this.badges.length>0)?(0,a.qy)(x||(x=y` <div class="badges ${0} ${0} ${0}"> <hui-view-badges .badges="${0}" .hass="${0}" .lovelace="${0}" .viewIndex="${0}" .showAddLabel="${0}"></hui-view-badges> </div> `),p,v,w,this.badges,this.hass,this.lovelace,this.viewIndex,0===this.badges.length):a.s6)}constructor(...e){super(...e),this.badges=[],this._badgeVisibilityChanged=()=>{this._checkHidden()},this._dragScrollController=new n.q(this,{selector:".scroll",enabled:!1}),this._configure=()=>{(0,p.U)(this,{config:this.config,saveConfig:e=>{this._saveHeaderConfig(e)}})}}}H.styles=(0,a.AH)(w||(w=y`:host([hidden]){display:none!important}.container{position:relative}.actions-container{position:relative;height:34px;display:flex;flex-direction:column;justify-content:flex-end}.actions{z-index:1;position:absolute;height:36px;bottom:-2px;right:0;inset-inline-end:0;inset-inline-start:initial;opacity:1;display:flex;align-items:center;justify-content:center;transition:opacity .2s ease-in-out;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border-bottom-left-radius:0px;border-bottom-right-radius:0px;background:var(--secondary-background-color);--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--primary-text-color)}.layout{position:relative;display:flex;flex-direction:column;gap:16px 8px;--spacing:8px}.heading{position:relative;flex:1;width:100%;max-width:700px;display:flex}.heading>*{width:100%;height:100%}.badges{position:relative;flex:1;display:flex}.container:not(.edit-mode) .badges.scroll{overflow:auto;max-width:100%;scrollbar-color:var(--scrollbar-thumb-color) transparent;scrollbar-width:none;mask-image:linear-gradient(90deg,transparent 0%,black 16px,black calc(100% - 16px),transparent 100%)}hui-view-badges{width:100%;display:flex;flex-direction:column;justify-content:flex-end;--badges-aligmnent:flex-start}.layout{align-items:flex-start}.layout.center{align-items:center}.layout .heading{--card-text-align:start}.layout.center .heading{--card-text-align:center;display:flex;flex-direction:column;align-items:center}.layout.center hui-view-badges{--badges-aligmnent:center}.container:not(.edit-mode) .layout.badges-scroll hui-view-badges{--badges-wrap:nowrap;--badges-aligmnent:flex-start;--badge-padding:16px}.container:not(.edit-mode) .layout.center.badges-scroll hui-view-badges{--badges-aligmnent:space-around}@media (min-width:768px){.layout.responsive.has-heading{flex-direction:row;align-items:flex-end}.layout.responsive.has-heading .badges.scroll{mask-image:none;padding:0}.container:not(.edit-mode) .layout.responsive.badges-scroll.has-heading hui-view-badges{--badges-wrap:wrap;--badges-aligmnent:flex-end;--badge-padding:0}.layout.responsive.has-heading hui-view-badges{--badges-aligmnent:flex-end}}.layout.badges-top{flex-direction:column-reverse}@media (min-width:768px){.layout.responsive.badges-top.has-heading{flex-direction:row;align-items:flex-start}}.container.edit-mode{padding:8px;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));border:2px dashed var(--divider-color);border-start-end-radius:0}.container.edit-mode .content{min-height:36px}.add{position:relative;display:flex;flex-direction:row;align-items:center;outline:0;gap:var(--ha-space-2);height:36px;padding:6px 20px 6px 20px;box-sizing:border-box;width:auto;border-radius:var(--ha-section-border-radius,var(--ha-border-radius-xl));background-color:transparent;border-width:2px;border-style:dashed;border-color:var(--primary-color);--mdc-icon-size:18px;cursor:pointer;font-size:var(--ha-font-size-m);color:var(--primary-text-color);--ha-ripple-color:var(--primary-color);--ha-ripple-hover-opacity:0.04;--ha-ripple-pressed-opacity:0.12}.add:focus{border-style:solid}.dragging{pointer-events:none}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"lovelace",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"card",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"badges",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"config",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],H.prototype,"viewIndex",void 0),H=(0,o.Cg)([(0,s.EM)("hui-view-header")],H),i()}catch(g){i(g)}})},16401:function(e,i,t){t.a(e,async function(e,i){try{t(88454),t(29452),t(62953);var o=t(40445),a=t(5124),s=t(67576),r=t(75751),n=t(1087),d=t(91263),c=t(14487),l=t(26004),h=e([l,d,c]);[l,d,c]=h.then?(await h)():h;let p,v,g,u=e=>e;class b extends((0,d.M)(a.WF)){updated(e){super.updated(e),(e.has("hass")||e.has("config"))&&this._updateVisibility()}_updateVisibility(e){if(!this.hass||!this.config)return;const i=null!=e?e:!this.config.visibility||(0,c.XH)(this.config.visibility,this.hass,this._conditionContext);i!==this._visible&&(this._visible=i,(0,n.r)(this,"sidebar-visibility-changed",{visible:i}))}_getSectionKey(e){return this._sectionConfigKeys.has(e)||this._sectionConfigKeys.set(e,Math.random().toString()),this._sectionConfigKeys.get(e)}render(){var e,i;return this.lovelace?(0,a.qy)(p||(p=u` <div class="container"> ${0} </div> `),(0,r.u)(null!==(e=null===(i=this.config)||void 0===i?void 0:i.sections)&&void 0!==e?e:[],e=>this._getSectionKey(e),e=>(0,a.qy)(v||(v=u` <hui-section .config="${0}" .hass="${0}" .preview="${0}" .viewIndex="${0}"></hui-section> `),e,this.hass,this.lovelace.editMode,this.viewIndex))):a.s6}constructor(...e){super(...e),this._visible=!0,this._sectionConfigKeys=new WeakMap}}b.styles=(0,a.AH)(g||(g=u`.container{display:flex;flex-direction:column;gap:var(--row-gap,8px);width:100%}`)),(0,o.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"lovelace",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"config",void 0),(0,o.Cg)([(0,s.MZ)({attribute:!1})],b.prototype,"viewIndex",void 0),b=(0,o.Cg)([(0,s.EM)("hui-view-sidebar")],b),i()}catch(p){i(p)}})},94629:function(e,i,t){t.d(i,{z:function(){return o}});t(44114),t(17642),t(58004),t(33853),t(45876),t(32475),t(15024),t(31698),t(62953);function o(e,i){const t=new Set;if(i<=1)return t;const o=[];let a={indices:[],hasBackground:!1},s=0;for(let r=0;r<e.length;r++){const t=e[r];if(t.hidden)continue;const n=Math.min(t.config.column_span||1,i);s+n>i&&(o.push(a),a={indices:[],hasBackground:!1},s=0),s+=n,a.indices.push(r),void 0!==t.config.background&&(a.hasBackground=!0)}o.push(a);for(const r of o)if(r.hasBackground)for(const i of r.indices)void 0===e[i].config.background&&t.add(i);return t}}}]);