diff --git a/dist/custom-sidebar-json.js b/dist/custom-sidebar-json.js index efbc315..8d73375 100644 --- a/dist/custom-sidebar-json.js +++ b/dist/custom-sidebar-json.js @@ -1 +1 @@ -!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=Oe(e,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(_e.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(_e.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:_e.SUBSCRIBE_EVENTS,event_type:_e.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),Re=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ae(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),ve=/([A-Z])([a-z0-9_-]+)/g,Ne=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(ve,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},be=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(Ne(n),"}")})).join("")})).join("")},me=function(e,t){return"".concat(t,"_").concat(e)},Se=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},ye=function(e,t){var n=me(Se(e),t);return e.querySelector("#".concat(n))},Le=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return ye(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=ye(t,n);if(!i){var c=me(Se(t),n);(i=document.createElement("style")).setAttribute("id",c),t.appendChild(i)}i.innerHTML="string"==typeof e?e:be(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=ye(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(fe||(fe={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(he||(he={})),function(e){e.AND="AND",e.OR="OR"}(pe||(pe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Ie||(Ie={}));var Ce,De="custom-sidebar",ge="sidebar-config",we="".concat("/local/").concat(ge),Pe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Ce||(Ce={}));var He,Me,Be,xe,Fe,Ge="[object Object]",Ue="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(He||(He={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Me||(Me={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(Be||(Be={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(xe||(xe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Fe||(Fe={}));var je,ke,Xe,Ve,We,Ke=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],qe=["selection_opacity"],Ye=[["item_background",Fe.ITEM_BACKGROUND],["item_background_hover",Fe.ITEM_BACKGROUND_HOVER],["icon_color",Fe.ICON_COLOR],["icon_color_selected",Fe.ICON_COLOR_SELECTED],["icon_color_hover",Fe.ICON_COLOR_HOVER],["text_color",Fe.TEXT_COLOR],["text_color_selected",Fe.TEXT_COLOR_SELECTED],["text_color_hover",Fe.TEXT_COLOR_HOVER],["selection_background",Fe.SELECTION_BACKGROUND],["selection_opacity",Fe.SELECTION_OPACITY],["info_color",Fe.INFO_COLOR],["info_color_selected",Fe.INFO_COLOR_SELECTED],["info_color_hover",Fe.INFO_COLOR_HOVER],["notification_color",Fe.NOTIFICATION_COLOR],["notification_color_selected",Fe.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Fe.NOTIFICATION_COLOR_HOVER],["notification_text_color",Fe.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Fe.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Fe.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Fe.TITLE_COLOR],["subtitle_color",Fe.SUBTITLE_COLOR],["sidebar_button_color",Fe.BUTTON_COLOR],["sidebar_background",Fe.BACKGROUND],["menu_background",Fe.MENU_BACKGROUND],["scrollbar_thumb_color",Fe.SCROLLBAR_THUMB_COLOR],["divider_color",Fe.DIVIDER_COLOR],["divider_top_color",Fe.DIVIDER_TOP_COLOR],["divider_bottom_color",Fe.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(je||(je={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(ke||(ke={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template",e.LOCATION_CHANGED="location-changed"}(Xe||(Xe={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Ve||(Ve={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var ze,Je,Qe,Ze,et,tt,nt,ot,rt,it,ct,at,st,_t,ut,lt,dt,Et,Ot,ft,ht,pt,It,Tt,At=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Rt=((Te={})[fe.HIDDEN]=he.ALWAYS_HIDDEN,Te[fe.NARROW]=he.AUTO,Te[fe.EXTENDED]=he.DOCKED,Te),vt="/profile",Nt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,bt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,mt=/@partial\s+([\w-]+)/g,St=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},yt=function(){return new Promise((function(e){setTimeout(e,1)}))},Lt=o(o([],Ke,!0),qe,!0),Ct=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Dt=["js_variables","jinja_variables","partials"],gt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:pe.OR,i=void 0!==n.user&&St(n.user).includes(t),c=void 0!==n.not_user&&!St(n.not_user).includes(t),a=void 0!==n.device&&St(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!St(n.not_device).some((function(t){return e._userAgent.includes(t)})),_=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===pe.OR?i||c||a||s||_||u:(void 0===n.user||i)&&(void 0===n.not_user||c)&&(void 0===n.device||a)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||_)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return wt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(De,": partial ").concat(r," doesn't exist")),""}))},Pt=function(){for(var e=[],t=0;t ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Be.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ze["{ SELECTOR.HOST_EXPANDED } ".concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},ze["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={zIndex:"1"},ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Ht),ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Ht),ze["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.CONFIGURATION_BADGE)]=e({},Ht),ze),Bt=((Je={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE)]={color:Pt(Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR)},Je),xt=((Qe={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE).concat(Be.AFTER)]={content:"attr(data-subtitle)",color:Pt(Fe.SUBTITLE_COLOR,Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Qe),Ft=((Ze={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(He.HA_ICON_BUTTON)]={color:Pt(Fe.BUTTON_COLOR,xe.SIDEBAR_ICON_COLOR)},Ze),Gt=((et={})[Me.HOST]={background:Pt(Fe.BACKGROUND,xe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),Ut=((tt={})["".concat(Me.HOST," ").concat(Me.MENU)]={background:Pt(Fe.MENU_BACKGROUND,Fe.BACKGROUND,xe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,xe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:Pt(Fe.DIVIDER_TOP_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),jt=((nt={})["".concat(Me.HOST," ").concat(Me.DIVIDER).concat(Be.BEFORE)]={backgroundColor:Pt(Fe.DIVIDER_BOTTOM_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR)},nt),kt=((ot={})["".concat(Me.HOST," > ").concat(Me.MC_DRAWER)]={borderColor:Pt(Fe.BORDER_COLOR,xe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Xt=((rt={})["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR)]={scrollbarColor:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR).concat(Be.WEBKIT_SCROLLBAR_THUMB)]={background:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)},rt),Vt=((it={})["".concat(Me.MENU,"[").concat(Ue,"]")]={pointerEvents:"none"},it["".concat(Me.MENU,"[").concat(Ue,"] > ").concat(He.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((ct={})["".concat(Me.HOST," ").concat(Me.ITEM,":not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND,"none")},ct),Kt=((at={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND_HOVER,Fe.ITEM_BACKGROUND,"none")},at),qt=((st={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},st),Yt=((_t={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR)},_t),$t=((ut={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_HOVER,Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},ut),zt=((lt={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},lt),Jt=((dt={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},dt),Qt=((Et={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_HOVER,Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},Et),Zt=((Ot={})["".concat(Me.HOST," :is(").concat(Me.ITEM,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(He.PAPER_ICON_ITEM).concat(Be.BEFORE)]={background:Pt(Fe.SELECTION_BACKGROUND,Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR),opacity:Pt(Fe.SELECTION_OPACITY,"0.12")},Ot),en=((ft={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR),display:"block"},ft),tn=((ht={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},ht),nn=((pt={})["".concat(Me.HOST_EXPANDED," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_HOVER,Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR)},pt),on=((It={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_SELECTED,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_SELECTED,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},It),rn=((Tt={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_HOVER,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_HOVER,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},Tt),cn="Invalid configuration",an=o(o(["title","subtitle","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],Ke,!0),["default_path"],!0),sn=["js_variables","jinja_variables","partials","extendable_configs"],_n=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a string'))}))},un=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.STRING&&typeof e[t]!==Ce.NUMBER)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a number or a string'))}))},ln=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean'))}))},dn=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Ce.UNDEFINED&&typeof e[t]!==Ce.BOOLEAN&&typeof e[t]!==Ce.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean or a string'))}))},En=function(e,t){e.forEach((function(e){var n=e[0],o=e[1];if(!On(o))throw new SyntaxError("".concat(t,' "').concat(n,'" property should be a string or an array of strings'))}))},On=function(e){return typeof e===Ce.UNDEFINED||(typeof e===Ce.STRING||Array.isArray(e)&&e.some((function(e){return typeof e===Ce.STRING})))},fn=function(e,t,n,o){(void 0===o&&(o=!1),e)&&(Array.isArray(e)?e:[e]).forEach((function(e){var r;if(e===Pe&&!o)throw new SyntaxError("".concat(n,' "entend_from" can only be "base" in exceptions'));if(e!==Pe&&!(e in(null!==(r=t.extendable_configs)&&void 0!==r?r:{})))throw new SyntaxError("".concat(n,' "').concat(e,'" doesn\'t exist in "extendable_configs"'))}))},hn=function(e,t,n){e&&(Array.isArray(e)?e:[e]).forEach((function(e){if(n.includes(e))throw new SyntaxError("".concat(cn,', circular extend dependency detected in "').concat(n.join(" > ")," > ").concat(e,'"'));if(e===Pe)throw new SyntaxError("".concat(cn,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(cn,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));hn(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},pn=function(e,t){sn.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},In=function(e,t,n){if("string"==typeof t&&(Nt.test(t)||bt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Ce.STRING&&typeof t!==Ce.NUMBER&&typeof t!==Ce.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){In(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];In(e,i,o(o([],n,!0),[r],!1))}))}},Tn=function(e,t){if(typeof t!==Ce.UNDEFINED){if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];In(e,o,[n])}))}},An=function(e,t){if(typeof e!==Ce.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(cn,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(pn(e,"".concat(cn,", exceptions")),_n(e,o([],an,!0),"".concat(cn,", exceptions")),un(e,o([],qe,!0),"".concat(cn,", exceptions")),En([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(cn,", exceptions")),fn(e.extend_from,t,"".concat(cn,", error in exception:"),!0),typeof e.matchers_conditions!==Ce.UNDEFINED&&e.matchers_conditions!==pe.AND&&e.matchers_conditions!==pe.OR)throw new SyntaxError("".concat(cn,', exceptions "matchers_conditions" property should be "').concat(pe.AND,'" or "').concat(pe.OR,'"'));if(typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', exceptions "order" property should be an array'));if(dn(e,["sidebar_editable"],"".concat(cn,", exceptions")),ln(e,["hide_all","is_admin","is_owner"],"".concat(cn,", exceptions")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Rt))throw new SyntaxError("".concat(cn,', exceptions "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(cn,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(cn,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(Rn)}(e,t)}))}},Rn=function(e){if(pn(e,"".concat(cn," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(cn,', every item in an "order" array should have an "item" property'));if(_n(e,o(["item","info"],Ke,!0),"".concat(cn," in ").concat(e.item,",")),un(e,o([],qe,!0),"".concat(cn," in ").concat(e.item,",")),dn(e,["hide"],"".concat(cn," in ").concat(e.item,",")),e.new_item){if(_n(e,["href","icon"],"".concat(cn," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},vn=function(e){var t;if(_n(e,o([],an,!0),"".concat(cn,",")),En([["extend_from",e.extend_from]],"".concat(cn,",")),fn(e.extend_from,e,"".concat(cn,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];hn(o.extend_from,e,[n])}))}(e),un(e,o([],qe,!0),"".concat(cn,",")),dn(e,["sidebar_editable"],"".concat(cn,",")),ln(e,["hide_all"],"".concat(cn,",")),typeof e.sidebar_mode!==Ce.UNDEFINED&&!(e.sidebar_mode in Rt))throw new SyntaxError("".concat(cn,', "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(typeof e.order!==Ce.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', "order" property should be an array'));if(typeof e.partials!==Ce.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==Ge)throw new SyntaxError("".concat(cn,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Ce.STRING)throw new SyntaxError("".concat(cn,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}Tn("js_variables",e.js_variables),Tn("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(Rn),An(e.exceptions,e)},Nn=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(De,": JSON config file not found."),t="Make sure you have valid config in /config/www/".concat(ge,".json file."),[2,new Promise((function(n){fetch("".concat(we,".json?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.json().then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_json"))&&console.warn("".concat(De,": You seem to be using the example configuration.\n").concat(t)),vn(e),n(e)})).catch((function(e){throw Error("".concat(De,": ").concat(e.message))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},bn=function(){function o(){var e=this,t=new re;t.addEventListener(B.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(B.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Le({prefix:De,namespace:De,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=Nn(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new gt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Me.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Me.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Me.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(ke.ROLE,"option"),t.setAttribute(ke.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(ke.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Me.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(Ue)},o=function(e,n){e.removeEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Xe.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(Ue,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Me.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(He.HA_ICON);if(!n){(n=document.createElement(He.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(He.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(He.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Me.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE),e.querySelector(He.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE,je.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(ke.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(ke.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){Nt.test(e)?this._createJsTemplateSubscription(e.replace(Nt,"$1"),t):bt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(wt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Xe.RENDER_TEMPLATE,template:wt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var c=(_=e+1)+o,a=_;ao-1?a-o:a;if(this._items[s].style.display!==r){i=s;break}}else{var _;for(c=(_=e-1)-o,a=_;a>c;a--){s=a<0?o+a:a;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(He.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,":not(.").concat(je.IRON_SELECTED,"):focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":has(> ").concat(He.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Me.SIDEBAR_NOTIFICATIONS):e.querySelector(He.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Me.PROFILE," > ").concat(He.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&At.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processDefaultPath=function(){var e,t=this._config.default_path;if(t)if(t.startsWith("/")){var n=[null,"",t];(e=window.history).replaceState.apply(e,n),window.dispatchEvent(new CustomEvent(Xe.LOCATION_CHANGED,{detail:{replace:t}}))}else console.warn("".concat(De,': ignoring default_path property as it doesn\'t start with "/".'))},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],c=e._config.sidebar_mode,a=matchMedia("(max-width: 870px)");if(c){r.hass.dockedSidebar=Rt[c];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return c===fe.HIDDEN?[3,5]:[4,yt()];case 1:return e.sent(),r.narrow=!1,[4,yt()];case 2:return e.sent(),i.narrow=o,[4,yt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Me.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};a.addEventListener("change",(function(e){s(e.matches)})),s(a.matches)}})),Promise.all([this._haDrawer.selector.$.query(Me.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Fe.BORDER_COLOR]]),i.addEventListener(Xe.KEYDOWN,(function(t){t.key!==Ve.ARROW_DOWN&&t.key!==Ve.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Ve.ARROW_DOWN))}),!0),window.addEventListener(Xe.KEYDOWN,(function(t){if(t.key===Ve.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(ke.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(ke.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(kt,n),e._styleManager.addStyle([Mt,Bt,xt,Ft,Gt,Ut,jt,Xt,Vt,Wt,Kt,qt,Yt,$t,zt,Jt,Qt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,c=n[0],a=n[1],s=n[2],_=0,u=!1;t._items=Array.from(a);var l=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var d=r.reduce((function(n,o){var r=o.item,i=o.match,c=o.exact,a=o.new_item,s=r.toLocaleLowerCase(),_=a?void 0:t._items.find((function(e){var t=i===Ie.DATA_PANEL?e.getAttribute(ke.PANEL):i===Ie.HREF?e.getAttribute(ke.HREF):e.querySelector(Me.ITEM_TEXT).innerText.trim();return!((!c||r!==t)&&(c||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!l.has(e)&&(l.add(e),!0))}));return _&&_.setAttribute(ke.PROCESSED,"true"),(a||_)&&n.push(e(e({},o),{element:_})),a||_||console.warn("".concat(De,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),E=function(){u||(t._items.forEach((function(e){e.hasAttribute(ke.PROCESSED)||(e.style.order="".concat(_))})),_++,s.style.order="".concat(_),_++,u=!0)};d.forEach((function(e){if(e.bottom&&E(),e.new_item){var n=t._buildNewItem(e);c.append(n),e.element=n,e.element.setAttribute(ke.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(_),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Xe.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Xe.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Xe.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Xe.KEYDOWN,(function(e){e.key===Ve.ENTER&&t._itemTouchedBinded()})),_++})),d.length&&E(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(He.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Me.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(ke.DISABLED,""):t.removeAttribute(ke.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'"],\n ').concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(ke.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(ke.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(je.IRON_SELECTED,t),e.setAttribute(ke.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Re(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processDefaultPath(),e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(De.toUpperCase()," (JSON)%cv").concat("8.3.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new bn)}(); +!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]0&&r[r.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=Oe(e,o,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(_e.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(_e.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:_e.SUBSCRIBE_EVENTS,event_type:_e.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide","ref","unref"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy,this._scopped.ref.bind(this._scopped,this._entityWatchCallback.bind(this)),this._scopped.unref.bind(this._scopped,this.cleanTracked.bind(this))],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),ve=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ae(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),Re=/([A-Z])([a-z0-9_-]+)/g,Ne=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(Re,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},be=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(Ne(n),"}")})).join("")})).join("")},me=function(e,t){return"".concat(t,"_").concat(e)},ye=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},Se=function(e,t){var n=me(ye(e),t);return e.querySelector("#".concat(n))},Ce=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return Se(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=Se(t,n);if(!i){var c=me(ye(t),n);(i=document.createElement("style")).setAttribute("id",c),t.appendChild(i)}i.innerHTML="string"==typeof e?e:be(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=Se(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(fe||(fe={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(he||(he={})),function(e){e.AND="AND",e.OR="OR"}(pe||(pe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Te||(Te={}));var Le,De="custom-sidebar",ge="sidebar-config",we="".concat("/local/").concat(ge),Pe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Le||(Le={}));var He,Me,Be,xe,Fe,Ge="[object Object]",Ue="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(He||(He={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Me||(Me={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(Be||(Be={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(xe||(xe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Fe||(Fe={}));var je,ke,Ve,Xe,We,Ke=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],qe=["selection_opacity"],Ye=[["item_background",Fe.ITEM_BACKGROUND],["item_background_hover",Fe.ITEM_BACKGROUND_HOVER],["icon_color",Fe.ICON_COLOR],["icon_color_selected",Fe.ICON_COLOR_SELECTED],["icon_color_hover",Fe.ICON_COLOR_HOVER],["text_color",Fe.TEXT_COLOR],["text_color_selected",Fe.TEXT_COLOR_SELECTED],["text_color_hover",Fe.TEXT_COLOR_HOVER],["selection_background",Fe.SELECTION_BACKGROUND],["selection_opacity",Fe.SELECTION_OPACITY],["info_color",Fe.INFO_COLOR],["info_color_selected",Fe.INFO_COLOR_SELECTED],["info_color_hover",Fe.INFO_COLOR_HOVER],["notification_color",Fe.NOTIFICATION_COLOR],["notification_color_selected",Fe.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Fe.NOTIFICATION_COLOR_HOVER],["notification_text_color",Fe.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Fe.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Fe.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Fe.TITLE_COLOR],["subtitle_color",Fe.SUBTITLE_COLOR],["sidebar_button_color",Fe.BUTTON_COLOR],["sidebar_background",Fe.BACKGROUND],["menu_background",Fe.MENU_BACKGROUND],["scrollbar_thumb_color",Fe.SCROLLBAR_THUMB_COLOR],["divider_color",Fe.DIVIDER_COLOR],["divider_top_color",Fe.DIVIDER_TOP_COLOR],["divider_bottom_color",Fe.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(je||(je={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(ke||(ke={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template",e.LOCATION_CHANGED="location-changed"}(Ve||(Ve={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Xe||(Xe={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var Je,ze,Qe,Ze,et,tt,nt,ot,rt,it,ct,at,st,_t,ut,lt,dt,Et,Ot,ft,ht,pt,Tt,It,At=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],vt=((Ie={})[fe.HIDDEN]=he.ALWAYS_HIDDEN,Ie[fe.NARROW]=he.AUTO,Ie[fe.EXTENDED]=he.DOCKED,Ie),Rt="/profile",Nt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,bt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,mt=/@partial\s+([\w-]+)/g,yt=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},St=function(){return new Promise((function(e){setTimeout(e,1)}))},Ct=o(o([],Ke,!0),qe,!0),Lt=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Dt=["js_variables","jinja_variables","partials"],gt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:pe.OR,i=void 0!==n.user&&yt(n.user).includes(t),c=void 0!==n.not_user&&!yt(n.not_user).includes(t),a=void 0!==n.device&&yt(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!yt(n.not_device).some((function(t){return e._userAgent.includes(t)})),_=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===pe.OR?i||c||a||s||_||u:(void 0===n.user||i)&&(void 0===n.not_user||c)&&(void 0===n.device||a)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||_)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return wt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(De,": partial ").concat(r," doesn't exist")),""}))},Pt=function(){for(var e=[],t=0;t ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},Je["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},Je["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Be.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Je["{ SELECTOR.HOST_EXPANDED } ".concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},Je["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={zIndex:"1"},Je["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Ht),Je["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Ht),Je["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.CONFIGURATION_BADGE)]=e({},Ht),Je),Bt=((ze={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE)]={color:Pt(Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR)},ze),xt=((Qe={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(Me.TITLE).concat(Be.AFTER)]={content:"attr(data-subtitle)",color:Pt(Fe.SUBTITLE_COLOR,Fe.TITLE_COLOR,xe.SIDEBAR_TITLE_COLOR,xe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Qe),Ft=((Ze={})["".concat(Me.HOST," ").concat(Me.MENU," > ").concat(He.HA_ICON_BUTTON)]={color:Pt(Fe.BUTTON_COLOR,xe.SIDEBAR_ICON_COLOR)},Ze),Gt=((et={})[Me.HOST]={background:Pt(Fe.BACKGROUND,xe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),Ut=((tt={})["".concat(Me.HOST," ").concat(Me.MENU)]={background:Pt(Fe.MENU_BACKGROUND,Fe.BACKGROUND,xe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,xe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:Pt(Fe.DIVIDER_TOP_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),jt=((nt={})["".concat(Me.HOST," ").concat(Me.DIVIDER).concat(Be.BEFORE)]={backgroundColor:Pt(Fe.DIVIDER_BOTTOM_COLOR,Fe.DIVIDER_COLOR,xe.DIVIDER_COLOR)},nt),kt=((ot={})["".concat(Me.HOST," > ").concat(Me.MC_DRAWER)]={borderColor:Pt(Fe.BORDER_COLOR,xe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Vt=((rt={})["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR)]={scrollbarColor:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Me.HOST," ").concat(He.PAPER_LISTBOX).concat(Me.HA_SCROLLBAR).concat(Be.WEBKIT_SCROLLBAR_THUMB)]={background:Pt(Fe.SCROLLBAR_THUMB_COLOR,xe.SCROLLBAR_THUMB_COLOR)},rt),Xt=((it={})["".concat(Me.MENU,"[").concat(Ue,"]")]={pointerEvents:"none"},it["".concat(Me.MENU,"[").concat(Ue,"] > ").concat(He.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((ct={})["".concat(Me.HOST," ").concat(Me.ITEM,":not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND,"none")},ct),Kt=((at={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM)]={background:Pt(Fe.ITEM_BACKGROUND_HOVER,Fe.ITEM_BACKGROUND,"none")},at),qt=((st={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},st),Yt=((_t={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR)},_t),$t=((ut={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON,")")]={color:Pt(Fe.ICON_COLOR_HOVER,Fe.ICON_COLOR,xe.SIDEBAR_ICON_COLOR)},ut),Jt=((lt={})["".concat(Me.HOST," ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},lt),zt=((dt={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},dt),Qt=((Et={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT)]={color:Pt(Fe.TEXT_COLOR_HOVER,Fe.TEXT_COLOR,xe.SIDEBAR_TEXT_COLOR)},Et),Zt=((Ot={})["".concat(Me.HOST," :is(").concat(Me.ITEM,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(He.PAPER_ICON_ITEM).concat(Be.BEFORE)]={background:Pt(Fe.SELECTION_BACKGROUND,Fe.ICON_COLOR_SELECTED,xe.SIDEBAR_SELECTED_ICON_COLOR),opacity:Pt(Fe.SELECTION_OPACITY,"0.12")},Ot),en=((ft={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR),display:"block"},ft),tn=((ht={})["".concat(Me.HOST_EXPANDED," ").concat(He.PAPER_LISTBOX," > ").concat(Me.ITEM).concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_SELECTED,xe.SIDEBAR_SELECTED_TEXT_COLOR)},ht),nn=((pt={})["".concat(Me.HOST_EXPANDED," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > ").concat(Me.ITEM_TEXT).concat(Me.DATA_INFO).concat(Be.AFTER)]={color:Pt(Fe.INFO_COLOR_HOVER,Fe.INFO_COLOR,xe.SIDEBAR_TEXT_COLOR)},pt),on=((Tt={})["".concat(Me.HOST," ").concat(Me.ITEM_SELECTED," > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_SELECTED,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_SELECTED,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},Tt),rn=((It={})["".concat(Me.HOST," :is(").concat(Me.ITEM_HOVER,", ").concat(Me.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Me.ITEM_SELECTED,") > ").concat(He.PAPER_ICON_ITEM," > :is(").concat(Me.NOTIFICATION_BADGE,", ").concat(Me.CONFIGURATION_BADGE,")")]={backgroundColor:Pt(Fe.NOTIFICATION_COLOR_HOVER,Fe.NOTIFICATION_COLOR,xe.ACCENT_COLOR),color:Pt(Fe.NOTIFICATION_TEXT_COLOR_HOVER,Fe.NOTIFICATION_TEXT_COLOR,xe.TEXT_ACCENT_COLOR,xe.TEXT_PRIMARY_COLOR)},It),cn="Invalid configuration",an=o(o(["title","subtitle","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],Ke,!0),["default_path"],!0),sn=["js_variables","jinja_variables","partials","extendable_configs"],_n=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Le.UNDEFINED&&typeof e[t]!==Le.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a string'))}))},un=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Le.UNDEFINED&&typeof e[t]!==Le.STRING&&typeof e[t]!==Le.NUMBER)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a number or a string'))}))},ln=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Le.UNDEFINED&&typeof e[t]!==Le.BOOLEAN)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean'))}))},dn=function(e,t,n){t.forEach((function(t){if(typeof e[t]!==Le.UNDEFINED&&typeof e[t]!==Le.BOOLEAN&&typeof e[t]!==Le.STRING)throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean or a string'))}))},En=function(e,t){e.forEach((function(e){var n=e[0],o=e[1];if(!On(o))throw new SyntaxError("".concat(t,' "').concat(n,'" property should be a string or an array of strings'))}))},On=function(e){return typeof e===Le.UNDEFINED||(typeof e===Le.STRING||Array.isArray(e)&&e.some((function(e){return typeof e===Le.STRING})))},fn=function(e,t,n,o){(void 0===o&&(o=!1),e)&&(Array.isArray(e)?e:[e]).forEach((function(e){var r;if(e===Pe&&!o)throw new SyntaxError("".concat(n,' "entend_from" can only be "base" in exceptions'));if(e!==Pe&&!(e in(null!==(r=t.extendable_configs)&&void 0!==r?r:{})))throw new SyntaxError("".concat(n,' "').concat(e,'" doesn\'t exist in "extendable_configs"'))}))},hn=function(e,t,n){e&&(Array.isArray(e)?e:[e]).forEach((function(e){if(n.includes(e))throw new SyntaxError("".concat(cn,', circular extend dependency detected in "').concat(n.join(" > ")," > ").concat(e,'"'));if(e===Pe)throw new SyntaxError("".concat(cn,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(cn,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));hn(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},pn=function(e,t){sn.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},Tn=function(e,t,n){if("string"==typeof t&&(Nt.test(t)||bt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Le.STRING&&typeof t!==Le.NUMBER&&typeof t!==Le.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){Tn(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];Tn(e,i,o(o([],n,!0),[r],!1))}))}},In=function(e,t){if(typeof t!==Le.UNDEFINED){if(Object.prototype.toString.call(t)!==Ge)throw new SyntaxError("".concat(cn,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];Tn(e,o,[n])}))}},An=function(e,t){if(typeof e!==Le.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(cn,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(pn(e,"".concat(cn,", exceptions")),_n(e,o([],an,!0),"".concat(cn,", exceptions")),un(e,o([],qe,!0),"".concat(cn,", exceptions")),En([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(cn,", exceptions")),fn(e.extend_from,t,"".concat(cn,", error in exception:"),!0),typeof e.matchers_conditions!==Le.UNDEFINED&&e.matchers_conditions!==pe.AND&&e.matchers_conditions!==pe.OR)throw new SyntaxError("".concat(cn,', exceptions "matchers_conditions" property should be "').concat(pe.AND,'" or "').concat(pe.OR,'"'));if(typeof e.order!==Le.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', exceptions "order" property should be an array'));if(dn(e,["sidebar_editable"],"".concat(cn,", exceptions")),ln(e,["hide_all","is_admin","is_owner"],"".concat(cn,", exceptions")),typeof e.sidebar_mode!==Le.UNDEFINED&&!(e.sidebar_mode in vt))throw new SyntaxError("".concat(cn,', exceptions "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(cn,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(cn,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(vn)}(e,t)}))}},vn=function(e){if(pn(e,"".concat(cn," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(cn,', every item in an "order" array should have an "item" property'));if(_n(e,o(["item","info"],Ke,!0),"".concat(cn," in ").concat(e.item,",")),un(e,o([],qe,!0),"".concat(cn," in ").concat(e.item,",")),dn(e,["hide"],"".concat(cn," in ").concat(e.item,",")),e.new_item){if(_n(e,["href","icon"],"".concat(cn," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(cn," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},Rn=function(e){var t;if(_n(e,o([],an,!0),"".concat(cn,",")),En([["extend_from",e.extend_from]],"".concat(cn,",")),fn(e.extend_from,e,"".concat(cn,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];hn(o.extend_from,e,[n])}))}(e),un(e,o([],qe,!0),"".concat(cn,",")),dn(e,["sidebar_editable"],"".concat(cn,",")),ln(e,["hide_all"],"".concat(cn,",")),typeof e.sidebar_mode!==Le.UNDEFINED&&!(e.sidebar_mode in vt))throw new SyntaxError("".concat(cn,', "sidebar_mode" property should be ').concat(fe.HIDDEN,", ").concat(fe.NARROW," or ").concat(fe.EXTENDED));if(typeof e.order!==Le.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(cn,', "order" property should be an array'));if(typeof e.partials!==Le.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==Ge)throw new SyntaxError("".concat(cn,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Le.STRING)throw new SyntaxError("".concat(cn,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}In("js_variables",e.js_variables),In("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(vn),An(e.exceptions,e)},Nn=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(De,": JSON config file not found."),t="Make sure you have valid config in /config/www/".concat(ge,".json file."),[2,new Promise((function(n){fetch("".concat(we,".json?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.json().then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_json"))&&console.warn("".concat(De,": You seem to be using the example configuration.\n").concat(t)),Rn(e),n(e)})).catch((function(e){throw Error("".concat(De,": ").concat(e.message))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},bn=function(){function o(){var e=this,t=new re;t.addEventListener(B.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(B.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Ce({prefix:De,namespace:De,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=Nn(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new gt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Me.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Me.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Me.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(ke.ROLE,"option"),t.setAttribute(ke.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(ke.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Me.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(Ue)},o=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(Ue,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Me.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(He.HA_ICON);if(!n){(n=document.createElement(He.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(He.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(He.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Me.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Me.NOTIFICATION_BADGE,":not(").concat(Me.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Me.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE),e.querySelector(He.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(je.NOTIFICATIONS_BADGE,je.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(He.HA_SVG_ICON,", ").concat(He.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(ke.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(ke.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){Nt.test(e)?this._createJsTemplateSubscription(e.replace(Nt,"$1"),t):bt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(wt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Ve.RENDER_TEMPLATE,template:wt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var c=(_=e+1)+o,a=_;ao-1?a-o:a;if(this._items[s].style.display!==r){i=s;break}}else{var _;for(c=(_=e-1)-o,a=_;a>c;a--){s=a<0?o+a:a;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(He.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,":not(.").concat(je.IRON_SELECTED,"):focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":focus,\n ").concat(Me.SCOPE," > ").concat(Me.ITEM,":has(> ").concat(He.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Me.SIDEBAR_NOTIFICATIONS):e.querySelector(He.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Me.PROFILE," > ").concat(He.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&At.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processDefaultPath=function(){var e,t=this._config.default_path;if(t)if(t.startsWith("/")){var n=[null,"",t];(e=window.history).replaceState.apply(e,n),window.dispatchEvent(new CustomEvent(Ve.LOCATION_CHANGED,{detail:{replace:t}}))}else console.warn("".concat(De,': ignoring default_path property as it doesn\'t start with "/".'))},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],c=e._config.sidebar_mode,a=matchMedia("(max-width: 870px)");if(c){r.hass.dockedSidebar=vt[c];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return c===fe.HIDDEN?[3,5]:[4,St()];case 1:return e.sent(),r.narrow=!1,[4,St()];case 2:return e.sent(),i.narrow=o,[4,St()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Me.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};a.addEventListener("change",(function(e){s(e.matches)})),s(a.matches)}})),Promise.all([this._haDrawer.selector.$.query(Me.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Fe.BORDER_COLOR]]),i.addEventListener(Ve.KEYDOWN,(function(t){t.key!==Xe.ARROW_DOWN&&t.key!==Xe.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Xe.ARROW_DOWN))}),!0),window.addEventListener(Ve.KEYDOWN,(function(t){if(t.key===Xe.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(ke.HREF)!==Rt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(ke.HREF)!==Rt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(kt,n),e._styleManager.addStyle([Mt,Bt,xt,Ft,Gt,Ut,jt,Vt,Xt,Wt,Kt,qt,Yt,$t,Jt,zt,Qt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,c=n[0],a=n[1],s=n[2],_=0,u=!1;t._items=Array.from(a);var l=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var d=r.reduce((function(n,o){var r=o.item,i=o.match,c=o.exact,a=o.new_item,s=r.toLocaleLowerCase(),_=a?void 0:t._items.find((function(e){var t=i===Te.DATA_PANEL?e.getAttribute(ke.PANEL):i===Te.HREF?e.getAttribute(ke.HREF):e.querySelector(Me.ITEM_TEXT).innerText.trim();return!((!c||r!==t)&&(c||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!l.has(e)&&(l.add(e),!0))}));return _&&_.setAttribute(ke.PROCESSED,"true"),(a||_)&&n.push(e(e({},o),{element:_})),a||_||console.warn("".concat(De,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),E=function(){u||(t._items.forEach((function(e){e.hasAttribute(ke.PROCESSED)||(e.style.order="".concat(_))})),_++,s.style.order="".concat(_),_++,u=!0)};d.forEach((function(e){if(e.bottom&&E(),e.new_item){var n=t._buildNewItem(e);c.append(n),e.element=n,e.element.setAttribute(ke.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(_),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Ve.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Ve.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Ve.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Ve.KEYDOWN,(function(e){e.key===Xe.ENTER&&t._itemTouchedBinded()})),_++})),d.length&&E(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(He.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Me.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(ke.DISABLED,""):t.removeAttribute(ke.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(He.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'"],\n ').concat(Me.SCOPE," > ").concat(Me.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(ke.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(ke.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(je.IRON_SELECTED,t),e.setAttribute(ke.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new ve(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processDefaultPath(),e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(De.toUpperCase()," (JSON)%cv").concat("8.3.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new bn)}(); diff --git a/dist/custom-sidebar-yaml.js b/dist/custom-sidebar-yaml.js index 24cd058..c020937 100644 --- a/dist/custom-sidebar-yaml.js +++ b/dist/custom-sidebar-yaml.js @@ -1 +1 @@ -!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=pe(e,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(le.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(le.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:le.SUBSCRIBE_EVENTS,event_type:le.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),Te=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ie(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),ve=/([A-Z])([a-z0-9_-]+)/g,be=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(ve,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},ge=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(be(n),"}")})).join("")})).join("")},ye=function(e,t){return"".concat(t,"_").concat(e)},Ne=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},Re=function(e,t){var n=ye(Ne(e),t);return e.querySelector("#".concat(n))},Ce=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return Re(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=Re(t,n);if(!i){var a=ye(Ne(t),n);(i=document.createElement("style")).setAttribute("id",a),t.appendChild(i)}i.innerHTML="string"==typeof e?e:ge(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=Re(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(he||(he={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(Ee||(Ee={})),function(e){e.AND="AND",e.OR="OR"}(Oe||(Oe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Ae||(Ae={}));var Se,Le="custom-sidebar",we="sidebar-config",De="".concat("/local/").concat(we),xe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Se||(Se={}));var Me,Pe,He,Fe,Be,ke="[object Object]",je="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(Me||(Me={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Pe||(Pe={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(He||(He={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(Fe||(Fe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Be||(Be={}));var Ge,Ue,Ve,Xe,We,qe=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],Ke=["selection_opacity"],Ye=[["item_background",Be.ITEM_BACKGROUND],["item_background_hover",Be.ITEM_BACKGROUND_HOVER],["icon_color",Be.ICON_COLOR],["icon_color_selected",Be.ICON_COLOR_SELECTED],["icon_color_hover",Be.ICON_COLOR_HOVER],["text_color",Be.TEXT_COLOR],["text_color_selected",Be.TEXT_COLOR_SELECTED],["text_color_hover",Be.TEXT_COLOR_HOVER],["selection_background",Be.SELECTION_BACKGROUND],["selection_opacity",Be.SELECTION_OPACITY],["info_color",Be.INFO_COLOR],["info_color_selected",Be.INFO_COLOR_SELECTED],["info_color_hover",Be.INFO_COLOR_HOVER],["notification_color",Be.NOTIFICATION_COLOR],["notification_color_selected",Be.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Be.NOTIFICATION_COLOR_HOVER],["notification_text_color",Be.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Be.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Be.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Be.TITLE_COLOR],["subtitle_color",Be.SUBTITLE_COLOR],["sidebar_button_color",Be.BUTTON_COLOR],["sidebar_background",Be.BACKGROUND],["menu_background",Be.MENU_BACKGROUND],["scrollbar_thumb_color",Be.SCROLLBAR_THUMB_COLOR],["divider_color",Be.DIVIDER_COLOR],["divider_top_color",Be.DIVIDER_TOP_COLOR],["divider_bottom_color",Be.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(Ge||(Ge={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(Ue||(Ue={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template",e.LOCATION_CHANGED="location-changed"}(Ve||(Ve={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Xe||(Xe={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var ze,Qe,Je,Ze,et,tt,nt,ot,rt,it,at,ct,st,lt,ut,dt,ft,_t,pt,ht,Et,Ot,At,mt,It=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Tt=((me={})[he.HIDDEN]=Ee.ALWAYS_HIDDEN,me[he.NARROW]=Ee.AUTO,me[he.EXTENDED]=Ee.DOCKED,me),vt="/profile",bt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,gt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,yt=/@partial\s+([\w-]+)/g,Nt=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Rt=function(){return new Promise((function(e){setTimeout(e,1)}))},Ct=o(o([],qe,!0),Ke,!0),St=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Lt=["js_variables","jinja_variables","partials"],wt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:Oe.OR,i=void 0!==n.user&&Nt(n.user).includes(t),a=void 0!==n.not_user&&!Nt(n.not_user).includes(t),c=void 0!==n.device&&Nt(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!Nt(n.not_device).some((function(t){return e._userAgent.includes(t)})),l=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===Oe.OR?i||a||c||s||l||u:(void 0===n.user||i)&&(void 0===n.not_user||a)&&(void 0===n.device||c)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||l)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return Dt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(Le,": partial ").concat(r," doesn't exist")),""}))},xt=function(){for(var e=[],t=0;t ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(He.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ze["{ SELECTOR.HOST_EXPANDED } ".concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={zIndex:"1"},ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.CONFIGURATION_BADGE)]=e({},Mt),ze),Ht=((Qe={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE)]={color:xt(Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR)},Qe),Ft=((Je={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE).concat(He.AFTER)]={content:"attr(data-subtitle)",color:xt(Be.SUBTITLE_COLOR,Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Je),Bt=((Ze={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Me.HA_ICON_BUTTON)]={color:xt(Be.BUTTON_COLOR,Fe.SIDEBAR_ICON_COLOR)},Ze),kt=((et={})[Pe.HOST]={background:xt(Be.BACKGROUND,Fe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),jt=((tt={})["".concat(Pe.HOST," ").concat(Pe.MENU)]={background:xt(Be.MENU_BACKGROUND,Be.BACKGROUND,Fe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,Fe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:xt(Be.DIVIDER_TOP_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),Gt=((nt={})["".concat(Pe.HOST," ").concat(Pe.DIVIDER).concat(He.BEFORE)]={backgroundColor:xt(Be.DIVIDER_BOTTOM_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR)},nt),Ut=((ot={})["".concat(Pe.HOST," > ").concat(Pe.MC_DRAWER)]={borderColor:xt(Be.BORDER_COLOR,Fe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Vt=((rt={})["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR)]={scrollbarColor:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR).concat(He.WEBKIT_SCROLLBAR_THUMB)]={background:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)},rt),Xt=((it={})["".concat(Pe.MENU,"[").concat(je,"]")]={pointerEvents:"none"},it["".concat(Pe.MENU,"[").concat(je,"] > ").concat(Me.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((at={})["".concat(Pe.HOST," ").concat(Pe.ITEM,":not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND,"none")},at),qt=((ct={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND_HOVER,Be.ITEM_BACKGROUND,"none")},ct),Kt=((st={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},st),Yt=((lt={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR)},lt),$t=((ut={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_HOVER,Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},ut),zt=((dt={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},dt),Qt=((ft={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},ft),Jt=((_t={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_HOVER,Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},_t),Zt=((pt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(Me.PAPER_ICON_ITEM).concat(He.BEFORE)]={background:xt(Be.SELECTION_BACKGROUND,Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR),opacity:xt(Be.SELECTION_OPACITY,"0.12")},pt),en=((ht={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR),display:"block"},ht),tn=((Et={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},Et),nn=((Ot={})["".concat(Pe.HOST_EXPANDED," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_HOVER,Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR)},Ot),on=((At={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_SELECTED,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_SELECTED,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},At),rn=((mt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_HOVER,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_HOVER,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},mt);function an(e){return null==e}var cn={isNothing:an,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:an(e)?[]:[e]},repeat:function(e,t){var n,o="";for(n=0;nc&&(t=o-c+(i=" ... ").length),n-o>c&&(n=o+c-(a=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:o-t+i.length}}function fn(e,t){return cn.repeat(" ",t-e.length)+e}var _n=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,o=/\r?\n|\r|\0/g,r=[0],i=[],a=-1;n=o.exec(e.buffer);)i.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c,s,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)s=dn(e.buffer,r[a-c],i[a-c],e.position-(r[a]-r[a-c]),d),l=cn.repeat(" ",t.indent)+fn((e.line-c+1).toString(),u)+" | "+s.str+"\n"+l;for(s=dn(e.buffer,r[a],i[a],e.position,d),l+=cn.repeat(" ",t.indent)+fn((e.line+1).toString(),u)+" | "+s.str+"\n",l+=cn.repeat("-",t.indent+u+3+s.pos)+"^\n",c=1;c<=t.linesAfter&&!(a+c>=i.length);c++)s=dn(e.buffer,r[a+c],i[a+c],e.position-(r[a]-r[a+c]),d),l+=cn.repeat(" ",t.indent)+fn((e.line+c+1).toString(),u)+" | "+s.str+"\n";return l.replace(/\n$/,"")},pn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hn=["scalar","sequence","mapping"];var En=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===pn.indexOf(t))throw new un('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===hn.indexOf(this.kind))throw new un('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function On(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,o){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=o)})),n[t]=e})),n}function An(e){return this.extend(e)}An.prototype.extend=function(e){var t=[],n=[];if(e instanceof En)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new un("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new un("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new un("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(An.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=On(o,"implicit"),o.compiledExplicit=On(o,"explicit"),o.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ln=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var wn=/^[-+]?[0-9]+e/;var Dn=new En("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Ln.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||cn.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(cn.isNegativeZero(e))return"-0.0";return n=e.toString(10),wn.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),xn=bn.extend({implicit:[gn,yn,Sn,Dn]}),Mn=xn,Pn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Hn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Fn=new En("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Pn.exec(e)||null!==Hn.exec(e))},construct:function(e){var t,n,o,r,i,a,c,s,l=0,u=null;if(null===(t=Pn.exec(e))&&(t=Hn.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],o=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,o,r));if(i=+t[4],a=+t[5],c=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),s=new Date(Date.UTC(n,o,r,i,a,c,l)),u&&s.setTime(s.getTime()-u),s},instanceOf:Date,represent:function(e){return e.toISOString()}});var Bn=new En("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var jn=new En("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,r=e.length,i=kn;for(n=0;n64)){if(t<0)return!1;o+=6}return o%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),r=o.length,i=kn,a=0,c=[];for(t=0;t>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|i.indexOf(o.charAt(t));return 0===(n=r%4*6)?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),new Uint8Array(c)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,o="",r=0,i=e.length,a=kn;for(t=0;t>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]),r=(r<<8)+e[t];return 0===(n=i%3)?(o+=a[r>>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]):2===n?(o+=a[r>>10&63],o+=a[r>>4&63],o+=a[r<<2&63],o+=a[64]):1===n&&(o+=a[r>>2&63],o+=a[r<<4&63],o+=a[64],o+=a[64]),o}}),Gn=Object.prototype.hasOwnProperty,Un=Object.prototype.toString;var Vn=new En("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,r,i,a=[],c=e;for(t=0,n=c.length;t>10),56320+(e-65536&1023))}for(var mo=new Array(256),Io=new Array(256),To=0;To<256;To++)mo[To]=Oo(To)?1:0,Io[To]=Oo(To);function vo(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Yn,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function bo(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=_n(n),new un(t,n)}function go(e,t){throw bo(e,t)}function yo(e,t){e.onWarning&&e.onWarning.call(null,bo(e,t))}var No={YAML:function(e,t,n){var o,r,i;null!==e.version&&go(e,"duplication of %YAML directive"),1!==n.length&&go(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&go(e,"ill-formed argument of the YAML directive"),r=parseInt(o[1],10),i=parseInt(o[2],10),1!==r&&go(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&yo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,r;2!==n.length&&go(e,"TAG directive accepts exactly two arguments"),o=n[0],r=n[1],ao.test(o)||go(e,"ill-formed tag handle (first argument) of the TAG directive"),$n.call(e.tagMap,o)&&go(e,'there is a previously declared suffix for "'+o+'" tag handle'),co.test(r)||go(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){go(e,"tag prefix is malformed: "+r)}e.tagMap[o]=r}};function Ro(e,t,n,o){var r,i,a,c;if(t1&&(e.result+=cn.repeat("\n",t-1))}function Mo(e,t){var n,o,r=e.tag,i=e.anchor,a=[],c=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),o=e.input.charCodeAt(e.position);0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,go(e,"tab characters must not be used in indentation")),45===o)&&fo(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,wo(e,!0,-1)&&e.lineIndent<=t)a.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,Fo(e,t,Jn,!1,!0),a.push(e.result),wo(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)go(e,"bad indentation of a sequence entry");else if(e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt)&&(O&&(a=e.line,c=e.lineStart,s=e.position),Fo(e,t,Zn,!0,r)&&(O?h=e.result:E=e.result),O||(So(e,f,_,p,h,E,a,c,s),p=h=E=null),wo(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)go(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?go(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?go(e,"repeat of an indentation width identifier"):(l=t+r-1,s=!0)}if(uo(i)){do{i=e.input.charCodeAt(++e.position)}while(uo(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!lo(i)&&0!==i)}for(;0!==i;){for(Lo(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),lo(i))u++;else{if(e.lineIndent0){for(r=a,i=0;r>0;r--)(a=po(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:go(e,"expected hexadecimal character");e.result+=Ao(i),e.position++}else go(e,"unknown escape sequence");n=o=e.position}else lo(c)?(Ro(e,n,o,!0),xo(e,wo(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Do(e)?go(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}go(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?E=!0:!function(e){var t,n,o;if(42!==(o=e.input.charCodeAt(e.position)))return!1;for(o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!fo(o)&&!_o(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&go(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),$n.call(e.anchorMap,n)||go(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],wo(e,!0,-1),!0}(e)?function(e,t,n){var o,r,i,a,c,s,l,u,d=e.kind,f=e.result;if(fo(u=e.input.charCodeAt(e.position))||_o(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o)))return!1;for(e.kind="scalar",e.result="",r=i=e.position,a=!1;0!==u;){if(58===u){if(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o))break}else if(35===u){if(fo(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Do(e)||n&&_o(u))break;if(lo(u)){if(c=e.line,s=e.lineStart,l=e.lineIndent,wo(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=c,e.lineStart=s,e.lineIndent=l;break}}a&&(Ro(e,r,i,!1),xo(e,e.line-c),r=i=e.position,a=!1),uo(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return Ro(e,r,i,!1),!!e.result||(e.kind=d,e.result=f,!1)}(e,f,zn===n)&&(E=!0,null===e.tag&&(e.tag="?")):(E=!0,null===e.tag&&null===e.anchor||go(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(E=c&&Mo(e,_))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&go(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,l=e.implicitTypes.length;s"),null!==e.result&&d.kind!==e.kind&&go(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):go(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||E}function Bo(e){var t,n,o,r,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(wo(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&go(e,"directive name must not be less than one character in length");0!==r;){for(;uo(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!lo(r));break}if(lo(r))break;for(t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==r&&Lo(e),$n.call(No,n)?No[n](e,n,o):yo(e,'unknown document directive "'+n+'"')}wo(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,wo(e,!0,-1)):a&&go(e,"directives end mark is expected"),Fo(e,e.lineIndent-1,Zn,!1,!0),wo(e,!0,-1),e.checkLineBreaks&&ro.test(e.input.slice(i,e.position))&&yo(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Do(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,wo(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function Cr(e){return/^\n* /.test(e)}var Sr=1,Lr=2,wr=3,Dr=4,xr=5;function Mr(e,t,n,o,r,i,a,c){var s,l=0,u=null,d=!1,f=!1,_=-1!==o,p=-1,h=function(e){return gr(e)&&e!==Vo&&!br(e)&&e!==nr&&e!==ar&&e!==or&&e!==tr&&e!==sr&&e!==lr&&e!==dr&&e!==_r&&e!==zo&&e!==Jo&&e!==er&&e!==Yo&&e!==fr&&e!==rr&&e!==ir&&e!==Zo&&e!==$o&&e!==Qo&&e!==cr&&e!==ur}(Rr(e,0))&&function(e){return!br(e)&&e!==or}(Rr(e,e.length-1));if(t||a)for(s=0;s=65536?s+=2:s++){if(!gr(l=Rr(e,s)))return xr;h=h&&Nr(l,u,c),u=l}else{for(s=0;s=65536?s+=2:s++){if((l=Rr(e,s))===Wo)d=!0,_&&(f=f||s-p-1>o&&" "!==e[p+1],p=s);else if(!gr(l))return xr;h=h&&Nr(l,u,c),u=l}f=f||_&&s-p-1>o&&" "!==e[p+1]}return d||f?n>9&&Cr(e)?xr:a?i===mr?xr:Lr:f?Dr:wr:!h||a||r(e)?i===mr?xr:Lr:Sr}function Pr(e,t,n,o,r){e.dump=function(){if(0===t.length)return e.quotingType===mr?'""':"''";if(!e.noCompatMode&&(-1!==hr.indexOf(t)||Er.test(t)))return e.quotingType===mr?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),c=o||e.flowLevel>-1&&n>=e.flowLevel;switch(Mr(t,c,e.indent,a,(function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+Hr(t,e.indent)+Fr(Tr(function(e,t){var n,o,r=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,r.lastIndex=c,Br(e.slice(0,c),t)),a="\n"===e[0]||" "===e[0];var c;for(;o=r.exec(e);){var s=o[1],l=o[2];n=" "===l[0],i+=s+(a||n||""===l?"":"\n")+Br(l,t),a=n}return i}(t,a),i));case xr:return'"'+function(e){for(var t,n="",o=0,r=0;r=65536?r+=2:r++)o=Rr(e,r),!(t=pr[o])&&gr(o)?(n+=e[r],o>=65536&&(n+=e[r+1])):n+=t||Or(o);return n}(t)+'"';default:throw new un("impossible error: invalid scalar style")}}()}function Hr(e,t){var n=Cr(e)?String(t):"",o="\n"===e[e.length-1];return n+(o&&("\n"===e[e.length-2]||"\n"===e)?"+":o?"":"-")+"\n"}function Fr(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Br(e,t){if(""===e||" "===e[0])return e;for(var n,o,r=/ [^ ]/g,i=0,a=0,c=0,s="";n=r.exec(e);)(c=n.index)-i>t&&(o=a>i?a:c,s+="\n"+e.slice(i,o),i=o+1),a=c;return s+="\n",e.length-i>t&&a>i?s+=e.slice(i,a)+"\n"+e.slice(a+1):s+=e.slice(i),s.slice(1)}function kr(e,t,n,o){var r,i,a,c="",s=e.tag;for(r=0,i=n.length;r tag resolver accepts not "'+s+'" style');o=c.represent[s](t,s)}e.dump=o}return!0}return!1}function Gr(e,t,n,o,r,i,a){e.tag=null,e.dump=n,jr(e,n,!1)||jr(e,n,!0);var c,s=Go.call(e.dump),l=o;o&&(o=e.flowLevel<0||e.flowLevel>t);var u,d,f="[object Object]"===s||"[object Array]"===s;if(f&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(r=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)o&&0!==Object.keys(e.dump).length?(!function(e,t,n,o){var r,i,a,c,s,l,u="",d=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new un("sortKeys must be a boolean or a function");for(r=0,i=f.length;r1024)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,s&&(l+=vr(e,t)),Gr(e,t+1,c,!0,s)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a,c,s="",l=e.tag,u=Object.keys(n);for(o=0,r=u.length;o1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Gr(e,t,a,!1,!1)&&(s+=c+=e.dump));e.tag=l,e.dump="{"+s+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)o&&0!==e.dump.length?(e.noArrayIndent&&!a&&t>0?kr(e,t-1,e.dump,r):kr(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a="",c=e.tag;for(o=0,r=n.length;o",e.dump=c+" "+e.dump)}return!0}function Ur(e,t){var n,o,r=[],i=[];for(Vr(e,r,i),n=0,o=i.length;n ")," > ").concat(e,'"'));if(e===xe)throw new SyntaxError("".concat(qr,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(qr,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));ni(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},oi=function(e,t){Yr.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},ri=function(e,t,n){if("string"==typeof t&&(bt.test(t)||gt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Se.STRING&&typeof t!==Se.NUMBER&&typeof t!==Se.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){ri(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];ri(e,i,o(o([],n,!0),[r],!1))}))}},ii=function(e,t){if(typeof t!==Se.UNDEFINED){if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];ri(e,o,[n])}))}},ai=function(e,t){if(typeof e!==Se.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(qr,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(oi(e,"".concat(qr,", exceptions")),$r(e,o([],Kr,!0),"".concat(qr,", exceptions")),zr(e,o([],Ke,!0),"".concat(qr,", exceptions")),Zr([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(qr,", exceptions")),ti(e.extend_from,t,"".concat(qr,", error in exception:"),!0),typeof e.matchers_conditions!==Se.UNDEFINED&&e.matchers_conditions!==Oe.AND&&e.matchers_conditions!==Oe.OR)throw new SyntaxError("".concat(qr,', exceptions "matchers_conditions" property should be "').concat(Oe.AND,'" or "').concat(Oe.OR,'"'));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', exceptions "order" property should be an array'));if(Jr(e,["sidebar_editable"],"".concat(qr,", exceptions")),Qr(e,["hide_all","is_admin","is_owner"],"".concat(qr,", exceptions")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', exceptions "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(qr,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(qr,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(ci)}(e,t)}))}},ci=function(e){if(oi(e,"".concat(qr," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(qr,', every item in an "order" array should have an "item" property'));if($r(e,o(["item","info"],qe,!0),"".concat(qr," in ").concat(e.item,",")),zr(e,o([],Ke,!0),"".concat(qr," in ").concat(e.item,",")),Jr(e,["hide"],"".concat(qr," in ").concat(e.item,",")),e.new_item){if($r(e,["href","icon"],"".concat(qr," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},si=function(e){var t;if($r(e,o([],Kr,!0),"".concat(qr,",")),Zr([["extend_from",e.extend_from]],"".concat(qr,",")),ti(e.extend_from,e,"".concat(qr,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];ni(o.extend_from,e,[n])}))}(e),zr(e,o([],Ke,!0),"".concat(qr,",")),Jr(e,["sidebar_editable"],"".concat(qr,",")),Qr(e,["hide_all"],"".concat(qr,",")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', "order" property should be an array'));if(typeof e.partials!==Se.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==ke)throw new SyntaxError("".concat(qr,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Se.STRING)throw new SyntaxError("".concat(qr,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}ii("js_variables",e.js_variables),ii("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(ci),ai(e.exceptions,e)},li=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(Le,": YAML config file not found."),t="Make sure you have valid config in /config/www/".concat(we,".yaml file."),[2,new Promise((function(n){fetch("".concat(De,".yaml?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.text().then((function(e){return Wr.load(e)})).then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_yaml"))&&console.warn("".concat(Le,": You seem to be using the example configuration.\n").concat(t)),si(e),n(e)})).catch((function(e){throw Error("".concat(Le,": ").concat((null==e?void 0:e.message)||e))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},ui=function(){function o(){var e=this,t=new re;t.addEventListener(H.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(H.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Ce({prefix:Le,namespace:Le,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=li(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new wt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Pe.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Pe.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Pe.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(Ue.ROLE,"option"),t.setAttribute(Ue.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(Ue.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Pe.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(je)},o=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(je,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Pe.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(Me.HA_ICON);if(!n){(n=document.createElement(Me.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(Me.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(Me.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Pe.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE),e.querySelector(Me.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE,Ge.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(Ue.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(Ue.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){bt.test(e)?this._createJsTemplateSubscription(e.replace(bt,"$1"),t):gt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(Dt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Ve.RENDER_TEMPLATE,template:Dt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var a=(l=e+1)+o,c=l;co-1?c-o:c;if(this._items[s].style.display!==r){i=s;break}}else{var l;for(a=(l=e-1)-o,c=l;c>a;c--){s=c<0?o+c:c;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(Me.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,":not(.").concat(Ge.IRON_SELECTED,"):focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":has(> ").concat(Me.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Pe.SIDEBAR_NOTIFICATIONS):e.querySelector(Me.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Pe.PROFILE," > ").concat(Me.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&It.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processDefaultPath=function(){var e,t=this._config.default_path;if(t)if(t.startsWith("/")){var n=[null,"",t];(e=window.history).replaceState.apply(e,n),window.dispatchEvent(new CustomEvent(Ve.LOCATION_CHANGED,{detail:{replace:t}}))}else console.warn("".concat(Le,': ignoring default_path property as it doesn\'t start with "/".'))},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],a=e._config.sidebar_mode,c=matchMedia("(max-width: 870px)");if(a){r.hass.dockedSidebar=Tt[a];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return a===he.HIDDEN?[3,5]:[4,Rt()];case 1:return e.sent(),r.narrow=!1,[4,Rt()];case 2:return e.sent(),i.narrow=o,[4,Rt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Pe.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};c.addEventListener("change",(function(e){s(e.matches)})),s(c.matches)}})),Promise.all([this._haDrawer.selector.$.query(Pe.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Be.BORDER_COLOR]]),i.addEventListener(Ve.KEYDOWN,(function(t){t.key!==Xe.ARROW_DOWN&&t.key!==Xe.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Xe.ARROW_DOWN))}),!0),window.addEventListener(Ve.KEYDOWN,(function(t){if(t.key===Xe.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(Ut,n),e._styleManager.addStyle([Pt,Ht,Ft,Bt,kt,jt,Gt,Vt,Xt,Wt,qt,Kt,Yt,$t,zt,Qt,Jt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,a=n[0],c=n[1],s=n[2],l=0,u=!1;t._items=Array.from(c);var d=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var f=r.reduce((function(n,o){var r=o.item,i=o.match,a=o.exact,c=o.new_item,s=r.toLocaleLowerCase(),l=c?void 0:t._items.find((function(e){var t=i===Ae.DATA_PANEL?e.getAttribute(Ue.PANEL):i===Ae.HREF?e.getAttribute(Ue.HREF):e.querySelector(Pe.ITEM_TEXT).innerText.trim();return!((!a||r!==t)&&(a||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!d.has(e)&&(d.add(e),!0))}));return l&&l.setAttribute(Ue.PROCESSED,"true"),(c||l)&&n.push(e(e({},o),{element:l})),c||l||console.warn("".concat(Le,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),_=function(){u||(t._items.forEach((function(e){e.hasAttribute(Ue.PROCESSED)||(e.style.order="".concat(l))})),l++,s.style.order="".concat(l),l++,u=!0)};f.forEach((function(e){if(e.bottom&&_(),e.new_item){var n=t._buildNewItem(e);a.append(n),e.element=n,e.element.setAttribute(Ue.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(l),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Ve.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Ve.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Ve.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Ve.KEYDOWN,(function(e){e.key===Xe.ENTER&&t._itemTouchedBinded()})),l++})),f.length&&_(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Pe.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(Ue.DISABLED,""):t.removeAttribute(Ue.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'"],\n ').concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(Ue.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(Ue.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(Ge.IRON_SELECTED,t),e.setAttribute(Ue.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Te(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processDefaultPath(),e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(Le.toUpperCase()," (YAML)%cv").concat("8.3.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new ui)}(); +!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]0&&r[r.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!r||c[1]>r[0]&&c[1]<])(".concat(Object.values(se).join("|"),")($|[ \\?)+:\\}\\]><.])"),"gm"),this._scopped=pe(e,o,i),this._watchForPanelUrlChange(),this._watchForEntitiesChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e){t.trackTemplate(n,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(le.LOCATION_CHANGED,(function(t){e._panelUrlWatchCallback()})),window.addEventListener(le.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(se.PANEL_URL)&&this._executeRenderingFunctions(se.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:le.SUBSCRIBE_EVENTS,event_type:le.STATE_CHANGE_EVENT})}))},e.prototype._entityWatchCallback=function(e){if(this._subscriptions.size){var t=e.data.entity_id;this._subscriptions.has(t)&&this._executeRenderingFunctions(t)}},e.prototype._storeTracked=function(e,t){var n=this;this._scopped.tracked.forEach((function(o){if(n._subscriptions.has(o)){var r=n._subscriptions.get(o);if(r.has(e)){var i=r.get(e);i.has(t)||i.add(t)}else r.set(e,new Set([t]))}else n._subscriptions.set(o,new Map([[e,new Set([t])]]))}))},e.prototype._untrackTemplate=function(e,t){var n=this;this._subscriptions.forEach((function(o,r){if(o.has(e)){var i=o.get(e);i.has(t)&&i.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e){try{var t=new Map(Object.entries(this._variables)),n=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),o=n.includes("return")||!this._autoReturn?n:"return ".concat(n);return(new(Function.bind.apply(Function,ie(ie([void 0,"hass","states","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide","ref","unref"],Array.from(t.keys()),!1),["".concat('"use strict";'," ").concat(o)],!1)))).apply(void 0,ie([this._scopped.hass,this._scopped.states,this._scopped.is_state.bind(this._scopped),this._scopped.state_attr.bind(this._scopped),this._scopped.is_state_attr.bind(this._scopped),this._scopped.has_value.bind(this._scopped),this._scopped.entities,this._scopped.entity_prop,this._scopped.is_entity_prop.bind(this._scopped),this._scopped.devices,this._scopped.device_attr.bind(this._scopped),this._scopped.is_device_attr.bind(this._scopped),this._scopped.device_id.bind(this._scopped),this._scopped.areas.bind(this._scopped),this._scopped.area_id.bind(this._scopped),this._scopped.area_name.bind(this._scopped),this._scopped.area_entities.bind(this._scopped),this._scopped.area_devices.bind(this._scopped),this._scopped.user_name,this._scopped.user_is_admin,this._scopped.user_is_owner,this._scopped.user_agent,this._scopped.clientSideProxy,this._scopped.ref.bind(this._scopped,this._entityWatchCallback.bind(this)),this._scopped.unref.bind(this._scopped,this.cleanTracked.bind(this))],Array.from(t.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t){var n=this;this._scopped.cleanTracked();var o=this.renderTemplate(e);return this._storeTracked(e,t),t(o),function(){return n._untrackTemplate(e,t)}},e.prototype.cleanTracked=function(e){e?this._subscriptions.has(e)&&this._subscriptions.delete(e):this._subscriptions.clear()},Object.defineProperty(e.prototype,"variables",{get:function(){return this._variables},set:function(e){this._variables=e},enumerable:!1,configurable:!0}),e}(),Te=function(){function e(e,t){void 0===t&&(t={}),this._renderer=r((function(){return e.hass}),(function(e){return!!(e&&e.areas&&e.devices&&e.entities&&e.states&&e.user)}),{retries:100,delay:50,rejectMessage:"The provided element doesn't contain a proper or initialised hass object"}).then((function(){return new Ie(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),ve=/([A-Z])([a-z0-9_-]+)/g,be=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(ve,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},ge=function(e){return(Array.isArray(e)?e:[e]).map((function(e){return"string"==typeof e?e:Object.entries(e).map((function(e){var t=e[0],n=e[1];return!1===n?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(be(n),"}")})).join("")})).join("")},ye=function(e,t){return"".concat(t,"_").concat(e)},Ne=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},Re=function(e,t){var n=ye(Ne(e),t);return e.querySelector("#".concat(n))},Ce=function(){function e(e){var t,n,o;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager",this._throwWarnings=null===(o=e.throwWarnings)||void 0===o||o}return e.prototype.getStyleElement=function(e){return Re(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=Re(t,n);if(!i){var a=ye(Ne(t),n);(i=document.createElement("style")).setAttribute("id",a),t.appendChild(i)}i.innerHTML="string"==typeof e?e:ge(e)}else r&&console.warn("".concat(o,': no element has been provided calling "addStyle"'))}(e,t,this._prefix,this._namespace,this._throwWarnings)},e.prototype.removeStyle=function(e){!function(e,t,n,o){if(e){var r=Re(e,t);r?r.remove():o&&console.warn("".concat(n,': no style to remove calling "removeStyle"'))}else o&&console.warn("".concat(n,': no element has been provided calling "removeStyle"'))}(e,this._prefix,this._namespace,this._throwWarnings)},e}();!function(e){e.HIDDEN="hidden",e.NARROW="narrow",e.EXTENDED="extended"}(he||(he={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(Ee||(Ee={})),function(e){e.AND="AND",e.OR="OR"}(Oe||(Oe={})),function(e){e.TEXT="text",e.DATA_PANEL="data-panel",e.HREF="href"}(Ae||(Ae={}));var Se,Le="custom-sidebar",we="sidebar-config",De="".concat("/local/").concat(we),xe="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Se||(Se={}));var Me,Pe,He,Fe,Be,ke="[object Object]",je="data-blocked";!function(e){e.SIDEBAR="ha-sidebar",e.PAPER_LISTBOX="paper-listbox",e.PAPER_ICON_ITEM="paper-icon-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button"}(Me||(Me={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.SCOPE=":scope",e.TITLE=".title",e.ITEM='a[role="option"]',e.ITEM_SELECTED=".iron-selected",e.ITEM_HOVER='a[role="option"]:hover',e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.NOTIFICATION_BADGE=".notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED=".notification-badge-collapsed",e.CONFIGURATION_BADGE=".configuration-badge",e.HA_MENU_BUTTON="ha-panel-lovelace$ hui-root$ .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.PROFILE=".profile",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.HA_SCROLLBAR=".ha-scrollbar",e.DATA_INFO="[data-info]"}(Pe||(Pe={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(He||(He={})),function(e){e.PRIMARY_BACKGROUND_COLOR="--primary-background-color",e.SIDEBAR_BACKGROUND_COLOR="--sidebar-background-color",e.SIDEBAR_TITLE_COLOR="--sidebar-menu-button-text-color",e.SIDEBAR_BUTTON_COLOR="--sidebar-icon-color",e.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR="--sidebar-menu-button-background-color",e.SIDEBAR_ICON_COLOR="--sidebar-icon-color",e.SIDEBAR_SELECTED_ICON_COLOR="--sidebar-selected-icon-color",e.SIDEBAR_TEXT_COLOR="--sidebar-text-color",e.SIDEBAR_SELECTED_TEXT_COLOR="--sidebar-selected-text-color",e.ACCENT_COLOR="--accent-color",e.TEXT_ACCENT_COLOR="--text-accent-color",e.TEXT_PRIMARY_COLOR="--text-primary-color",e.PRIMARY_TEXT_COLOR="--primary-text-color",e.DIVIDER_COLOR="--divider-color",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(Fe||(Fe={})),function(e){e.BACKGROUND="--custom-sidebar-background",e.BORDER_COLOR="--custom-sidebar-border-color",e.MENU_BACKGROUND="--custom-sidebar-menu-background",e.TITLE_COLOR="--custom-sidebar-title-color",e.SUBTITLE_COLOR="--custom-sidebar-subtitle-color",e.BUTTON_COLOR="--custom-sidebar-button-color",e.DIVIDER_COLOR="--custom-sidebar-divider-color",e.DIVIDER_TOP_COLOR="--custom-sidebar-divider-top-color",e.DIVIDER_BOTTOM_COLOR="--custom-sidebar-divider-bottom-color",e.SCROLLBAR_THUMB_COLOR="--custom-sidebar-scrollbar-thumb-color",e.ITEM_BACKGROUND="--custom-sidebar-item-background",e.ITEM_BACKGROUND_HOVER="--custom-sidebar-item-background-hover",e.ICON_COLOR="--custom-sidebar-icon-color",e.ICON_COLOR_SELECTED="--custom-sidebar-icon-color-selected",e.ICON_COLOR_HOVER="--custom-sidebar-icon-color-hover",e.TEXT_COLOR="--custom-sidebar-text-color",e.TEXT_COLOR_SELECTED="--custom-sidebar-text-color-selected",e.TEXT_COLOR_HOVER="--custom-sidebar-text-color-hover",e.SELECTION_BACKGROUND="--custom-sidebar-selection-background",e.SELECTION_OPACITY="--custom-sidebar-selection-opacity",e.INFO_COLOR="--custom-sidebar-info-color",e.INFO_COLOR_SELECTED="--custom-sidebar-info-color-selected",e.INFO_COLOR_HOVER="--custom-sidebar-info-color-hover",e.NOTIFICATION_COLOR="--custom-sidebar-notification-color",e.NOTIFICATION_COLOR_SELECTED="--custom-sidebar-notification-color-selected",e.NOTIFICATION_COLOR_HOVER="--custom-sidebar-notification-color-hover",e.NOTIFICATION_TEXT_COLOR="--custom-sidebar-notification-text-color",e.NOTIFICATION_TEXT_COLOR_SELECTED="--custom-sidebar-notification-text-color-selected",e.NOTIFICATION_TEXT_COLOR_HOVER="--custom-sidebar-notification-text-color-hover"}(Be||(Be={}));var Ge,Ue,Ve,Xe,We,qe=["item_background","item_background_hover","icon_color","icon_color_selected","icon_color_hover","text_color","text_color_selected","text_color_hover","selection_background","info_color","info_color_selected","info_color_hover","notification_color","notification_color_selected","notification_color_hover","notification_text_color","notification_text_color_selected","notification_text_color_hover"],Ke=["selection_opacity"],Ye=[["item_background",Be.ITEM_BACKGROUND],["item_background_hover",Be.ITEM_BACKGROUND_HOVER],["icon_color",Be.ICON_COLOR],["icon_color_selected",Be.ICON_COLOR_SELECTED],["icon_color_hover",Be.ICON_COLOR_HOVER],["text_color",Be.TEXT_COLOR],["text_color_selected",Be.TEXT_COLOR_SELECTED],["text_color_hover",Be.TEXT_COLOR_HOVER],["selection_background",Be.SELECTION_BACKGROUND],["selection_opacity",Be.SELECTION_OPACITY],["info_color",Be.INFO_COLOR],["info_color_selected",Be.INFO_COLOR_SELECTED],["info_color_hover",Be.INFO_COLOR_HOVER],["notification_color",Be.NOTIFICATION_COLOR],["notification_color_selected",Be.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Be.NOTIFICATION_COLOR_HOVER],["notification_text_color",Be.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Be.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Be.NOTIFICATION_TEXT_COLOR_HOVER]],$e=o([["title_color",Be.TITLE_COLOR],["subtitle_color",Be.SUBTITLE_COLOR],["sidebar_button_color",Be.BUTTON_COLOR],["sidebar_background",Be.BACKGROUND],["menu_background",Be.MENU_BACKGROUND],["scrollbar_thumb_color",Be.SCROLLBAR_THUMB_COLOR],["divider_color",Be.DIVIDER_COLOR],["divider_top_color",Be.DIVIDER_TOP_COLOR],["divider_bottom_color",Be.DIVIDER_BOTTOM_COLOR]],Ye,!0);!function(e){e.NOTIFICATIONS_BADGE="notification-badge",e.NOTIFICATIONS_BADGE_COLLAPSED="notification-badge-collapsed",e.IRON_SELECTED="iron-selected"}(Ge||(Ge={})),function(e){e.PANEL="data-panel",e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.ARIA_SELECTED="aria-selected",e.ARIA_DISABLED="aria-disabled",e.DISABLED="disabled",e.HREF="href",e.STYLE="style"}(Ue||(Ue={})),function(e){e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.HASS_EDIT_SIDEBAR="hass-edit-sidebar",e.RENDER_TEMPLATE="render_template",e.LOCATION_CHANGED="location-changed"}(Ve||(Ve={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Xe||(Xe={})),function(e){e.PAPER_ICON_ITEM="PAPER-ICON-ITEM",e.A="A"}(We||(We={}));var ze,Je,Qe,Ze,et,tt,nt,ot,rt,it,at,ct,st,lt,ut,dt,ft,_t,pt,ht,Et,Ot,At,mt,It=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Tt=((me={})[he.HIDDEN]=Ee.ALWAYS_HIDDEN,me[he.NARROW]=Ee.AUTO,me[he.EXTENDED]=Ee.DOCKED,me),vt="/profile",bt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,gt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,yt=/@partial\s+([\w-]+)/g,Nt=function(e){return Array.isArray(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Rt=function(){return new Promise((function(e){setTimeout(e,1)}))},Ct=o(o([],qe,!0),Ke,!0),St=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],Lt=["js_variables","jinja_variables","partials"],wt=function(){function t(e,t,n){var o;this._config=e,this._extendable=new Map(Object.entries(null!==(o=this._config.extendable_configs)&&void 0!==o?o:[])),this._user=t,this._userAgent=n,this._exceptions=this._getExceptions(),this._buildFlattenConfig()}return t.prototype._getExceptions=function(){var e=this;if(this._config.exceptions){var t=this._user.name.toLocaleLowerCase();return this._config.exceptions.filter((function(n){var o,r=null!==(o=n.matchers_conditions)&&void 0!==o?o:Oe.OR,i=void 0!==n.user&&Nt(n.user).includes(t),a=void 0!==n.not_user&&!Nt(n.not_user).includes(t),c=void 0!==n.device&&Nt(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!Nt(n.not_device).some((function(t){return e._userAgent.includes(t)})),l=void 0!==n.is_admin&&n.is_admin===e._user.is_admin,u=void 0!==n.is_owner&&n.is_owner===e._user.is_owner;return r===Oe.OR?i||a||c||s||l||u:(void 0===n.user||i)&&(void 0===n.not_user||a)&&(void 0===n.device||c)&&(void 0===n.not_device||s)&&(void 0===n.is_admin||l)&&(void 0===n.is_owner||u)}))}return[]},t.prototype._mergeConfigs=function(){for(var t=[],n=0;n ")," > ").concat(r));return Dt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(Le,": partial ").concat(r," doesn't exist")),""}))},xt=function(){for(var e=[],t=0;t ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={maxWidth:"calc(100% - 100px)"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(He.AFTER)]={content:"attr(data-info)",display:"none",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ze["{ SELECTOR.HOST_EXPANDED } ".concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]={opacity:"0"},ze["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={zIndex:"1"},ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")]=e({left:"calc(var(--app-drawer-width, 248px) - 22px)",maxWidth:"80px",transform:"translateX(-100%)"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED)]=e({bottom:"14px",left:"26px",maxWidth:"20px"},Mt),ze["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.CONFIGURATION_BADGE)]=e({},Mt),ze),Ht=((Je={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE)]={color:xt(Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR)},Je),Ft=((Qe={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Pe.TITLE).concat(He.AFTER)]={content:"attr(data-subtitle)",color:xt(Be.SUBTITLE_COLOR,Be.TITLE_COLOR,Fe.SIDEBAR_TITLE_COLOR,Fe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},Qe),Bt=((Ze={})["".concat(Pe.HOST," ").concat(Pe.MENU," > ").concat(Me.HA_ICON_BUTTON)]={color:xt(Be.BUTTON_COLOR,Fe.SIDEBAR_ICON_COLOR)},Ze),kt=((et={})[Pe.HOST]={background:xt(Be.BACKGROUND,Fe.SIDEBAR_BACKGROUND_COLOR)+" !important"},et),jt=((tt={})["".concat(Pe.HOST," ").concat(Pe.MENU)]={background:xt(Be.MENU_BACKGROUND,Be.BACKGROUND,Fe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,Fe.PRIMARY_BACKGROUND_COLOR),borderBottomColor:xt(Be.DIVIDER_TOP_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},tt),Gt=((nt={})["".concat(Pe.HOST," ").concat(Pe.DIVIDER).concat(He.BEFORE)]={backgroundColor:xt(Be.DIVIDER_BOTTOM_COLOR,Be.DIVIDER_COLOR,Fe.DIVIDER_COLOR)},nt),Ut=((ot={})["".concat(Pe.HOST," > ").concat(Pe.MC_DRAWER)]={borderColor:xt(Be.BORDER_COLOR,Fe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ot),Vt=((rt={})["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR)]={scrollbarColor:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)+" transparent"},rt["".concat(Pe.HOST," ").concat(Me.PAPER_LISTBOX).concat(Pe.HA_SCROLLBAR).concat(He.WEBKIT_SCROLLBAR_THUMB)]={background:xt(Be.SCROLLBAR_THUMB_COLOR,Fe.SCROLLBAR_THUMB_COLOR)},rt),Xt=((it={})["".concat(Pe.MENU,"[").concat(je,"]")]={pointerEvents:"none"},it["".concat(Pe.MENU,"[").concat(je,"] > ").concat(Me.HA_ICON_BUTTON)]={pointerEvents:"all"},it),Wt=((at={})["".concat(Pe.HOST," ").concat(Pe.ITEM,":not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND,"none")},at),qt=((ct={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM)]={background:xt(Be.ITEM_BACKGROUND_HOVER,Be.ITEM_BACKGROUND,"none")},ct),Kt=((st={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},st),Yt=((lt={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR)},lt),$t=((ut={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON,")")]={color:xt(Be.ICON_COLOR_HOVER,Be.ICON_COLOR,Fe.SIDEBAR_ICON_COLOR)},ut),zt=((dt={})["".concat(Pe.HOST," ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},dt),Jt=((ft={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},ft),Qt=((_t={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT)]={color:xt(Be.TEXT_COLOR_HOVER,Be.TEXT_COLOR,Fe.SIDEBAR_TEXT_COLOR)},_t),Zt=((pt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER,") > ").concat(Me.PAPER_ICON_ITEM).concat(He.BEFORE)]={background:xt(Be.SELECTION_BACKGROUND,Be.ICON_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_ICON_COLOR),opacity:xt(Be.SELECTION_OPACITY,"0.12")},pt),en=((ht={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR),display:"block"},ht),tn=((Et={})["".concat(Pe.HOST_EXPANDED," ").concat(Me.PAPER_LISTBOX," > ").concat(Pe.ITEM).concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_SELECTED,Fe.SIDEBAR_SELECTED_TEXT_COLOR)},Et),nn=((Ot={})["".concat(Pe.HOST_EXPANDED," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > ").concat(Pe.ITEM_TEXT).concat(Pe.DATA_INFO).concat(He.AFTER)]={color:xt(Be.INFO_COLOR_HOVER,Be.INFO_COLOR,Fe.SIDEBAR_TEXT_COLOR)},Ot),on=((At={})["".concat(Pe.HOST," ").concat(Pe.ITEM_SELECTED," > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_SELECTED,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_SELECTED,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},At),rn=((mt={})["".concat(Pe.HOST," :is(").concat(Pe.ITEM_HOVER,", ").concat(Pe.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER,"):not(").concat(Pe.ITEM_SELECTED,") > ").concat(Me.PAPER_ICON_ITEM," > :is(").concat(Pe.NOTIFICATION_BADGE,", ").concat(Pe.CONFIGURATION_BADGE,")")]={backgroundColor:xt(Be.NOTIFICATION_COLOR_HOVER,Be.NOTIFICATION_COLOR,Fe.ACCENT_COLOR),color:xt(Be.NOTIFICATION_TEXT_COLOR_HOVER,Be.NOTIFICATION_TEXT_COLOR,Fe.TEXT_ACCENT_COLOR,Fe.TEXT_PRIMARY_COLOR)},mt);function an(e){return null==e}var cn={isNothing:an,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:an(e)?[]:[e]},repeat:function(e,t){var n,o="";for(n=0;nc&&(t=o-c+(i=" ... ").length),n-o>c&&(n=o+c-(a=" ...").length),{str:i+e.slice(t,n).replace(/\t/g,"→")+a,pos:o-t+i.length}}function fn(e,t){return cn.repeat(" ",t-e.length)+e}var _n=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n,o=/\r?\n|\r|\0/g,r=[0],i=[],a=-1;n=o.exec(e.buffer);)i.push(n.index),r.push(n.index+n[0].length),e.position<=n.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c,s,l="",u=Math.min(e.line+t.linesAfter,i.length).toString().length,d=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)s=dn(e.buffer,r[a-c],i[a-c],e.position-(r[a]-r[a-c]),d),l=cn.repeat(" ",t.indent)+fn((e.line-c+1).toString(),u)+" | "+s.str+"\n"+l;for(s=dn(e.buffer,r[a],i[a],e.position,d),l+=cn.repeat(" ",t.indent)+fn((e.line+1).toString(),u)+" | "+s.str+"\n",l+=cn.repeat("-",t.indent+u+3+s.pos)+"^\n",c=1;c<=t.linesAfter&&!(a+c>=i.length);c++)s=dn(e.buffer,r[a+c],i[a+c],e.position-(r[a]-r[a+c]),d),l+=cn.repeat(" ",t.indent)+fn((e.line+c+1).toString(),u)+" | "+s.str+"\n";return l.replace(/\n$/,"")},pn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],hn=["scalar","sequence","mapping"];var En=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===pn.indexOf(t))throw new un('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===hn.indexOf(this.kind))throw new un('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function On(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,o){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=o)})),n[t]=e})),n}function An(e){return this.extend(e)}An.prototype.extend=function(e){var t=[],n=[];if(e instanceof En)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new un("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new un("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new un("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof En))throw new un("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(An.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=On(o,"implicit"),o.compiledExplicit=On(o,"explicit"),o.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function o(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ln=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var wn=/^[-+]?[0-9]+e/;var Dn=new En("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!Ln.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||cn.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(cn.isNegativeZero(e))return"-0.0";return n=e.toString(10),wn.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),xn=bn.extend({implicit:[gn,yn,Sn,Dn]}),Mn=xn,Pn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Hn=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var Fn=new En("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==Pn.exec(e)||null!==Hn.exec(e))},construct:function(e){var t,n,o,r,i,a,c,s,l=0,u=null;if(null===(t=Pn.exec(e))&&(t=Hn.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],o=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,o,r));if(i=+t[4],a=+t[5],c=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),s=new Date(Date.UTC(n,o,r,i,a,c,l)),u&&s.setTime(s.getTime()-u),s},instanceOf:Date,represent:function(e){return e.toISOString()}});var Bn=new En("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var jn=new En("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,r=e.length,i=kn;for(n=0;n64)){if(t<0)return!1;o+=6}return o%8==0},construct:function(e){var t,n,o=e.replace(/[\r\n=]/g,""),r=o.length,i=kn,a=0,c=[];for(t=0;t>16&255),c.push(a>>8&255),c.push(255&a)),a=a<<6|i.indexOf(o.charAt(t));return 0===(n=r%4*6)?(c.push(a>>16&255),c.push(a>>8&255),c.push(255&a)):18===n?(c.push(a>>10&255),c.push(a>>2&255)):12===n&&c.push(a>>4&255),new Uint8Array(c)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,o="",r=0,i=e.length,a=kn;for(t=0;t>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]),r=(r<<8)+e[t];return 0===(n=i%3)?(o+=a[r>>18&63],o+=a[r>>12&63],o+=a[r>>6&63],o+=a[63&r]):2===n?(o+=a[r>>10&63],o+=a[r>>4&63],o+=a[r<<2&63],o+=a[64]):1===n&&(o+=a[r>>2&63],o+=a[r<<4&63],o+=a[64],o+=a[64]),o}}),Gn=Object.prototype.hasOwnProperty,Un=Object.prototype.toString;var Vn=new En("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,r,i,a=[],c=e;for(t=0,n=c.length;t>10),56320+(e-65536&1023))}for(var mo=new Array(256),Io=new Array(256),To=0;To<256;To++)mo[To]=Oo(To)?1:0,Io[To]=Oo(To);function vo(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Yn,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function bo(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=_n(n),new un(t,n)}function go(e,t){throw bo(e,t)}function yo(e,t){e.onWarning&&e.onWarning.call(null,bo(e,t))}var No={YAML:function(e,t,n){var o,r,i;null!==e.version&&go(e,"duplication of %YAML directive"),1!==n.length&&go(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&go(e,"ill-formed argument of the YAML directive"),r=parseInt(o[1],10),i=parseInt(o[2],10),1!==r&&go(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&yo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,r;2!==n.length&&go(e,"TAG directive accepts exactly two arguments"),o=n[0],r=n[1],ao.test(o)||go(e,"ill-formed tag handle (first argument) of the TAG directive"),$n.call(e.tagMap,o)&&go(e,'there is a previously declared suffix for "'+o+'" tag handle'),co.test(r)||go(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){go(e,"tag prefix is malformed: "+r)}e.tagMap[o]=r}};function Ro(e,t,n,o){var r,i,a,c;if(t1&&(e.result+=cn.repeat("\n",t-1))}function Mo(e,t){var n,o,r=e.tag,i=e.anchor,a=[],c=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),o=e.input.charCodeAt(e.position);0!==o&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,go(e,"tab characters must not be used in indentation")),45===o)&&fo(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,wo(e,!0,-1)&&e.lineIndent<=t)a.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,Fo(e,t,Qn,!1,!0),a.push(e.result),wo(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)go(e,"bad indentation of a sequence entry");else if(e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt?p=1:e.lineIndent===t?p=0:e.lineIndentt)&&(O&&(a=e.line,c=e.lineStart,s=e.position),Fo(e,t,Zn,!0,r)&&(O?h=e.result:E=e.result),O||(So(e,f,_,p,h,E,a,c,s),p=h=E=null),wo(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)go(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?go(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?go(e,"repeat of an indentation width identifier"):(l=t+r-1,s=!0)}if(uo(i)){do{i=e.input.charCodeAt(++e.position)}while(uo(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!lo(i)&&0!==i)}for(;0!==i;){for(Lo(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),lo(i))u++;else{if(e.lineIndent0){for(r=a,i=0;r>0;r--)(a=po(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:go(e,"expected hexadecimal character");e.result+=Ao(i),e.position++}else go(e,"unknown escape sequence");n=o=e.position}else lo(c)?(Ro(e,n,o,!0),xo(e,wo(e,!1,t)),n=o=e.position):e.position===e.lineStart&&Do(e)?go(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}go(e,"unexpected end of the stream within a double quoted scalar")}(e,f)?E=!0:!function(e){var t,n,o;if(42!==(o=e.input.charCodeAt(e.position)))return!1;for(o=e.input.charCodeAt(++e.position),t=e.position;0!==o&&!fo(o)&&!_o(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&go(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),$n.call(e.anchorMap,n)||go(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],wo(e,!0,-1),!0}(e)?function(e,t,n){var o,r,i,a,c,s,l,u,d=e.kind,f=e.result;if(fo(u=e.input.charCodeAt(e.position))||_o(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o)))return!1;for(e.kind="scalar",e.result="",r=i=e.position,a=!1;0!==u;){if(58===u){if(fo(o=e.input.charCodeAt(e.position+1))||n&&_o(o))break}else if(35===u){if(fo(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&Do(e)||n&&_o(u))break;if(lo(u)){if(c=e.line,s=e.lineStart,l=e.lineIndent,wo(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=i,e.line=c,e.lineStart=s,e.lineIndent=l;break}}a&&(Ro(e,r,i,!1),xo(e,e.line-c),r=i=e.position,a=!1),uo(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return Ro(e,r,i,!1),!!e.result||(e.kind=d,e.result=f,!1)}(e,f,zn===n)&&(E=!0,null===e.tag&&(e.tag="?")):(E=!0,null===e.tag&&null===e.anchor||go(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(E=c&&Mo(e,_))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&go(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,l=e.implicitTypes.length;s"),null!==e.result&&d.kind!==e.kind&&go(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+d.kind+'", not "'+e.kind+'"'),d.resolve(e.result,e.tag)?(e.result=d.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):go(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||E}function Bo(e){var t,n,o,r,i=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(wo(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&go(e,"directive name must not be less than one character in length");0!==r;){for(;uo(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!lo(r));break}if(lo(r))break;for(t=e.position;0!==r&&!fo(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==r&&Lo(e),$n.call(No,n)?No[n](e,n,o):yo(e,'unknown document directive "'+n+'"')}wo(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,wo(e,!0,-1)):a&&go(e,"directives end mark is expected"),Fo(e,e.lineIndent-1,Zn,!1,!0),wo(e,!0,-1),e.checkLineBreaks&&ro.test(e.input.slice(i,e.position))&&yo(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Do(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,wo(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function Cr(e){return/^\n* /.test(e)}var Sr=1,Lr=2,wr=3,Dr=4,xr=5;function Mr(e,t,n,o,r,i,a,c){var s,l=0,u=null,d=!1,f=!1,_=-1!==o,p=-1,h=function(e){return gr(e)&&e!==Vo&&!br(e)&&e!==nr&&e!==ar&&e!==or&&e!==tr&&e!==sr&&e!==lr&&e!==dr&&e!==_r&&e!==zo&&e!==Qo&&e!==er&&e!==Yo&&e!==fr&&e!==rr&&e!==ir&&e!==Zo&&e!==$o&&e!==Jo&&e!==cr&&e!==ur}(Rr(e,0))&&function(e){return!br(e)&&e!==or}(Rr(e,e.length-1));if(t||a)for(s=0;s=65536?s+=2:s++){if(!gr(l=Rr(e,s)))return xr;h=h&&Nr(l,u,c),u=l}else{for(s=0;s=65536?s+=2:s++){if((l=Rr(e,s))===Wo)d=!0,_&&(f=f||s-p-1>o&&" "!==e[p+1],p=s);else if(!gr(l))return xr;h=h&&Nr(l,u,c),u=l}f=f||_&&s-p-1>o&&" "!==e[p+1]}return d||f?n>9&&Cr(e)?xr:a?i===mr?xr:Lr:f?Dr:wr:!h||a||r(e)?i===mr?xr:Lr:Sr}function Pr(e,t,n,o,r){e.dump=function(){if(0===t.length)return e.quotingType===mr?'""':"''";if(!e.noCompatMode&&(-1!==hr.indexOf(t)||Er.test(t)))return e.quotingType===mr?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),c=o||e.flowLevel>-1&&n>=e.flowLevel;switch(Mr(t,c,e.indent,a,(function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+Hr(t,e.indent)+Fr(Tr(function(e,t){var n,o,r=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,r.lastIndex=c,Br(e.slice(0,c),t)),a="\n"===e[0]||" "===e[0];var c;for(;o=r.exec(e);){var s=o[1],l=o[2];n=" "===l[0],i+=s+(a||n||""===l?"":"\n")+Br(l,t),a=n}return i}(t,a),i));case xr:return'"'+function(e){for(var t,n="",o=0,r=0;r=65536?r+=2:r++)o=Rr(e,r),!(t=pr[o])&&gr(o)?(n+=e[r],o>=65536&&(n+=e[r+1])):n+=t||Or(o);return n}(t)+'"';default:throw new un("impossible error: invalid scalar style")}}()}function Hr(e,t){var n=Cr(e)?String(t):"",o="\n"===e[e.length-1];return n+(o&&("\n"===e[e.length-2]||"\n"===e)?"+":o?"":"-")+"\n"}function Fr(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Br(e,t){if(""===e||" "===e[0])return e;for(var n,o,r=/ [^ ]/g,i=0,a=0,c=0,s="";n=r.exec(e);)(c=n.index)-i>t&&(o=a>i?a:c,s+="\n"+e.slice(i,o),i=o+1),a=c;return s+="\n",e.length-i>t&&a>i?s+=e.slice(i,a)+"\n"+e.slice(a+1):s+=e.slice(i),s.slice(1)}function kr(e,t,n,o){var r,i,a,c="",s=e.tag;for(r=0,i=n.length;r tag resolver accepts not "'+s+'" style');o=c.represent[s](t,s)}e.dump=o}return!0}return!1}function Gr(e,t,n,o,r,i,a){e.tag=null,e.dump=n,jr(e,n,!1)||jr(e,n,!0);var c,s=Go.call(e.dump),l=o;o&&(o=e.flowLevel<0||e.flowLevel>t);var u,d,f="[object Object]"===s||"[object Array]"===s;if(f&&(d=-1!==(u=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||d||2!==e.indent&&t>0)&&(r=!1),d&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&d&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),"[object Object]"===s)o&&0!==Object.keys(e.dump).length?(!function(e,t,n,o){var r,i,a,c,s,l,u="",d=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new un("sortKeys must be a boolean or a function");for(r=0,i=f.length;r1024)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,s&&(l+=vr(e,t)),Gr(e,t+1,c,!0,s)&&(e.dump&&Wo===e.dump.charCodeAt(0)?l+=":":l+=": ",u+=l+=e.dump));e.tag=d,e.dump=u||"{}"}(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a,c,s="",l=e.tag,u=Object.keys(n);for(o=0,r=u.length;o1024&&(c+="? "),c+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Gr(e,t,a,!1,!1)&&(s+=c+=e.dump));e.tag=l,e.dump="{"+s+"}"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else if("[object Array]"===s)o&&0!==e.dump.length?(e.noArrayIndent&&!a&&t>0?kr(e,t-1,e.dump,r):kr(e,t,e.dump,r),d&&(e.dump="&ref_"+u+e.dump)):(!function(e,t,n){var o,r,i,a="",c=e.tag;for(o=0,r=n.length;o",e.dump=c+" "+e.dump)}return!0}function Ur(e,t){var n,o,r=[],i=[];for(Vr(e,r,i),n=0,o=i.length;n ")," > ").concat(e,'"'));if(e===xe)throw new SyntaxError("".concat(qr,', error in extendable config "').concat(n[0],'": "entend_from" can only be "base" in exceptions'));if(!(e in t.extendable_configs))throw new SyntaxError("".concat(qr,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));ni(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},oi=function(e,t){Yr.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},ri=function(e,t,n){if("string"==typeof t&&(bt.test(t)||gt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(typeof t!==Se.STRING&&typeof t!==Se.NUMBER&&typeof t!==Se.BOOLEAN)if(Array.isArray(t))t.forEach((function(t,r){ri(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,": ").concat(n.join(" > "),'" has a wrong type ').concat(Object.prototype.toString.call(t)));var r=t;Object.entries(r).forEach((function(t){var r=t[0],i=t[1];ri(e,i,o(o([],n,!0),[r],!1))}))}},ii=function(e,t){if(typeof t!==Se.UNDEFINED){if(Object.prototype.toString.call(t)!==ke)throw new SyntaxError("".concat(qr,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];ri(e,o,[n])}))}},ai=function(e,t){if(typeof e!==Se.UNDEFINED){if(!Array.isArray(e))throw new SyntaxError("".concat(qr,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(oi(e,"".concat(qr,", exceptions")),$r(e,o([],Kr,!0),"".concat(qr,", exceptions")),zr(e,o([],Ke,!0),"".concat(qr,", exceptions")),Zr([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(qr,", exceptions")),ti(e.extend_from,t,"".concat(qr,", error in exception:"),!0),typeof e.matchers_conditions!==Se.UNDEFINED&&e.matchers_conditions!==Oe.AND&&e.matchers_conditions!==Oe.OR)throw new SyntaxError("".concat(qr,', exceptions "matchers_conditions" property should be "').concat(Oe.AND,'" or "').concat(Oe.OR,'"'));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', exceptions "order" property should be an array'));if(Qr(e,["sidebar_editable"],"".concat(qr,", exceptions")),Jr(e,["hide_all","is_admin","is_owner"],"".concat(qr,", exceptions")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', exceptions "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(qr,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(qr,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(ci)}(e,t)}))}},ci=function(e){if(oi(e,"".concat(qr," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(qr,', every item in an "order" array should have an "item" property'));if($r(e,o(["item","info"],qe,!0),"".concat(qr," in ").concat(e.item,",")),zr(e,o([],Ke,!0),"".concat(qr," in ").concat(e.item,",")),Qr(e,["hide"],"".concat(qr," in ").concat(e.item,",")),e.new_item){if($r(e,["href","icon"],"".concat(qr," in ").concat(e.item,",")),!e.href)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "href" property is necessary'));if(!e.icon)throw new SyntaxError("".concat(qr," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},si=function(e){var t;if($r(e,o([],Kr,!0),"".concat(qr,",")),Zr([["extend_from",e.extend_from]],"".concat(qr,",")),ti(e.extend_from,e,"".concat(qr,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];ni(o.extend_from,e,[n])}))}(e),zr(e,o([],Ke,!0),"".concat(qr,",")),Qr(e,["sidebar_editable"],"".concat(qr,",")),Jr(e,["hide_all"],"".concat(qr,",")),typeof e.sidebar_mode!==Se.UNDEFINED&&!(e.sidebar_mode in Tt))throw new SyntaxError("".concat(qr,', "sidebar_mode" property should be ').concat(he.HIDDEN,", ").concat(he.NARROW," or ").concat(he.EXTENDED));if(typeof e.order!==Se.UNDEFINED&&!Array.isArray(e.order))throw new SyntaxError("".concat(qr,', "order" property should be an array'));if(typeof e.partials!==Se.UNDEFINED){if(Object.prototype.toString.call(e.partials)!==ke)throw new SyntaxError("".concat(qr,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0];if(typeof e[1]!==Se.STRING)throw new SyntaxError("".concat(qr,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}ii("js_variables",e.js_variables),ii("jinja_variables",e.jinja_variables),null===(t=e.order)||void 0===t||t.forEach(ci),ai(e.exceptions,e)},li=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(Le,": YAML config file not found."),t="Make sure you have valid config in /config/www/".concat(we,".yaml file."),[2,new Promise((function(n){fetch("".concat(De,".yaml?hash=").concat(Math.random().toString(16).slice(2))).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.text().then((function(e){return Wr.load(e)})).then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_yaml"))&&console.warn("".concat(Le,": You seem to be using the example configuration.\n").concat(t)),si(e),n(e)})).catch((function(e){throw Error("".concat(Le,": ").concat((null==e?void 0:e.message)||e))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},ui=function(){function o(){var e=this,t=new re;t.addEventListener(H.ON_LISTEN,(function(t){e._homeAssistant=t.detail.HOME_ASSISTANT,e._main=t.detail.HOME_ASSISTANT_MAIN,e._haDrawer=t.detail.HA_DRAWER,e._sidebar=t.detail.HA_SIDEBAR,e._partialPanelResolver=t.detail.PARTIAL_PANEL_RESOLVER}),{once:!0}),t.addEventListener(H.ON_PANEL_LOAD,this._panelLoaded.bind(this)),t.listen(),this._styleManager=new Ce({prefix:Le,namespace:Le,throwWarnings:!1}),this._items=[],this._sidebarScroll=0,this._isSidebarEditable=void 0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=li(),this._process()}return o.prototype._getConfig=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return e=this,[4,this._configPromise.then((function(e){return function(e,t,n){return new wt(n,e,t).config}(t._ha.hass.user,navigator.userAgent.toLowerCase(),e)}))];case 1:return e._config=n.sent(),[2]}}))}))},o.prototype._getElements=function(){return t(this,void 0,void 0,(function(){var e,t,o,i;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(":scope > ".concat(Pe.SPACER))}),(function(e){return!!e}),e)];case 2:return o=n.sent(),[4,r((function(){return t.querySelectorAll(":scope > ".concat(Pe.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(Pe.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 3:return i=n.sent(),[2,[t,i,o]]}}))}))},o.prototype._hideAnchor=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t=document.createElement("a");return t.href=e.href,t.target=e.target||"",t.tabIndex=-1,t.setAttribute(Ue.ROLE,"option"),t.setAttribute(Ue.PANEL,e.item.toLowerCase().replace(/\s+/,"-")),t.setAttribute(Ue.ARIA_SELECTED,"false"),t.innerHTML='\n \n \n \n ').concat(e.item,'\n \n \n \n ').trim(),t},o.prototype._getTemplateString=function(e){return t(this,void 0,void 0,(function(){var t,o;return n(this,(function(n){switch(n.label){case 0:return t="",e instanceof Promise||"string"==typeof e||"number"==typeof e&&!Number.isNaN(e)||"boolean"==typeof e||"object"==typeof e?"string"!=typeof e?[3,1]:(t=e.trim(),[3,6]):[3,6];case 1:return"number"!=typeof e&&"boolean"!=typeof e?[3,2]:(t=e.toString(),[3,6]);case 2:return e instanceof Promise?[4,e]:[3,5];case 3:return o=n.sent(),[4,this._getTemplateString(o)];case 4:return t=n.sent(),[3,6];case 5:t=JSON.stringify(e),n.label=6;case 6:return[2,t]}}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(Pe.TITLE).element.then((function(t){e._config.title&&e._subscribeTemplate(e._config.title,(function(e){t.innerHTML=e})),e._config.subtitle&&e._subscribeTemplate(e._config.subtitle,(function(e){t.dataset.subtitle=e}))}))},o.prototype._subscribeSideBarEdition=function(){var e=this,t=function(e){e.preventDefault(),e.stopImmediatePropagation()},n=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.removeAttribute(je)},o=function(e,n){e.removeEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),e.addEventListener(Ve.HASS_EDIT_SIDEBAR,t,!0),n.setAttribute(je,"")};Promise.all([this._main.element,this._sidebar.selector.$.query(Pe.MENU).element]).then((function(t){var r=t[0],i=t[1];"boolean"==typeof e._config.sidebar_editable&&(e._isSidebarEditable=e._config.sidebar_editable,e._isSidebarEditable||o(r,i)),"string"==typeof e._config.sidebar_editable&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){"true"===t||"false"===t?(e._isSidebarEditable=!("false"===t),e._isSidebarEditable?n(r,i):o(r,i)):(e._isSidebarEditable=void 0,n(r,i)),e._checkProfileEditableButton()}))}))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.innerHTML=e}))},o.prototype._subscribeIcon=function(e,t){this._subscribeTemplate(t,(function(t){var n=e.querySelector(Me.HA_ICON);if(!n){(n=document.createElement(Me.HA_ICON)).setAttribute("slot","item-icon");var o=e.querySelector(Me.HA_SVG_ICON);o?o.replaceWith(n):e.querySelector(Me.PAPER_ICON_ITEM).prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(Pe.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector("".concat(Pe.NOTIFICATION_BADGE,":not(").concat(Pe.NOTIFICATIONS_BADGE_COLLAPSED,")")),o=e.querySelector(Pe.NOTIFICATIONS_BADGE_COLLAPSED);n||((n=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE),e.querySelector(Me.PAPER_ICON_ITEM).append(n)),o||((o=document.createElement("span")).classList.add(Ge.NOTIFICATIONS_BADGE,Ge.NOTIFICATIONS_BADGE_COLLAPSED),e.querySelector("".concat(Me.HA_SVG_ICON,", ").concat(Me.HA_ICON)).after(o));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,o.innerHTML=t,e.setAttribute(Ue.WITH_NOTIFICATION,"true")):(n.innerHTML="",o.innerHTML="",e.removeAttribute(Ue.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;"boolean"==typeof t?this._hideAnchor(e,t):this._subscribeTemplate(t,(function(t){n._hideAnchor(e,"true"===t)}))},o.prototype._subscribeTemplateColorChanges=function(e,t,n){var o=this;n.forEach((function(n){var r=n[0],i=n[1];e[r]&&o._subscribeTemplate(e[r],(function(e){t.style.setProperty(i,e)}))}))},o.prototype._subscribeTemplate=function(e,t){bt.test(e)?this._createJsTemplateSubscription(e.replace(bt,"$1"),t):gt.test(e)?this._createJinjaTemplateSubscription(e,t):this._getTemplateString(e).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(Dt(e,this._config.partials),(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;window.hassConnection.then((function(r){r.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Ve.RENDER_TEMPLATE,template:Dt(t,o._config.partials),variables:e({user_name:o._ha.hass.user.name,user_is_admin:o._ha.hass.user.is_admin,user_is_owner:o._ha.hass.user.is_owner,user_agent:window.navigator.userAgent},o._config.jinja_variables)})}))},o.prototype._focusItem=function(e,t,n){var o=this._items.length,r="none",i=0;if(t)for(var a=(l=e+1)+o,c=l;co-1?c-o:c;if(this._items[s].style.display!==r){i=s;break}}else{var l;for(a=(l=e-1)-o,c=l;c>a;c--){s=c<0?o+c:c;if(this._items[s].style.display!==r){i=s;break}}}n?this._items[i].querySelector(Me.PAPER_ICON_ITEM).focus():(this._items[i].focus(),this._items[i].tabIndex=0)},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,":not(.").concat(Ge.IRON_SELECTED,"):focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":focus,\n ").concat(Pe.SCOPE," > ").concat(Pe.ITEM,":has(> ").concat(Me.PAPER_ICON_ITEM,":focus)\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t,!1)},o.prototype._focusItemByTab=function(e,t,n){if(t.nodeName===We.A){var o=t,r=this._items.indexOf(o),i=this._items.length-1;if(n&&r0)this._focusItem(r,n,!0);else(n?e.querySelector(Pe.SIDEBAR_NOTIFICATIONS):e.querySelector(Me.HA_ICON_BUTTON)).focus()}else{if(n)e.querySelector("".concat(Pe.PROFILE," > ").concat(Me.PAPER_ICON_ITEM)).focus();else this._focusItem(0,n,!0)}},o.prototype._getActivePaperIconElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&(t.nodeName===We.PAPER_ICON_ITEM||t.nodeName===We.A&&"option"===t.getAttribute("role"))?t:t.shadowRoot&&It.includes(t.nodeName)?this._getActivePaperIconElement(t.shadowRoot):null:null},o.prototype._processDefaultPath=function(){var e,t=this._config.default_path;if(t)if(t.startsWith("/")){var n=[null,"",t];(e=window.history).replaceState.apply(e,n),window.dispatchEvent(new CustomEvent(Ve.LOCATION_CHANGED,{detail:{replace:t}}))}else console.warn("".concat(Le,': ignoring default_path property as it doesn\'t start with "/".'))},o.prototype._processSidebar=function(){var e=this;Promise.all([this._main.element,this._partialPanelResolver.element]).then((function(o){var r=o[0],i=o[1],a=e._config.sidebar_mode,c=matchMedia("(max-width: 870px)");if(a){r.hass.dockedSidebar=Tt[a];var s=function(o){return t(e,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return a===he.HIDDEN?[3,5]:[4,Rt()];case 1:return e.sent(),r.narrow=!1,[4,Rt()];case 2:return e.sent(),i.narrow=o,[4,Rt()];case 3:return e.sent(),o?[4,this._partialPanelResolver.selector.query(Pe.HA_MENU_BUTTON).element]:[3,5];case 4:e.sent().narrow=!1,e.label=5;case 5:return[2]}}))}))};c.addEventListener("change",(function(e){s(e.matches)})),s(c.matches)}})),Promise.all([this._haDrawer.selector.$.query(Pe.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,$e),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Be.BORDER_COLOR]]),i.addEventListener(Ve.KEYDOWN,(function(t){t.key!==Xe.ARROW_DOWN&&t.key!==Xe.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Xe.ARROW_DOWN))}),!0),window.addEventListener(Ve.KEYDOWN,(function(t){if(t.key===Xe.TAB){var n=e._getActivePaperIconElement();if(n)if(n.nodeName===We.PAPER_ICON_ITEM){var o=n.parentElement;o.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey))}else n.getAttribute(Ue.HREF)!==vt&&(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,n,!t.shiftKey))}}),!0),e._styleManager.addStyle(Ut,n),e._styleManager.addStyle([Pt,Ht,Ft,Bt,kt,jt,Gt,Vt,Xt,Wt,qt,Kt,Yt,$t,zt,Jt,Qt,Zt,en,tn,nn,on,rn,e._config.styles||""],r)}))},o.prototype._rearrange=function(){var t=this;this._getElements().then((function(n){var o=t._config,r=o.order,i=o.hide_all,a=n[0],c=n[1],s=n[2],l=0,u=!1;t._items=Array.from(c);var d=new Set;i&&t._items.forEach((function(e){t._hideAnchor(e,!0)}));var f=r.reduce((function(n,o){var r=o.item,i=o.match,a=o.exact,c=o.new_item,s=r.toLocaleLowerCase(),l=c?void 0:t._items.find((function(e){var t=i===Ae.DATA_PANEL?e.getAttribute(Ue.PANEL):i===Ae.HREF?e.getAttribute(Ue.HREF):e.querySelector(Pe.ITEM_TEXT).innerText.trim();return!((!a||r!==t)&&(a||!(null==t?void 0:t.toLowerCase().includes(s))))&&(!d.has(e)&&(d.add(e),!0))}));return l&&l.setAttribute(Ue.PROCESSED,"true"),(c||l)&&n.push(e(e({},o),{element:l})),c||l||console.warn("".concat(Le,": you have an order item in your configuration that didn't match any sidebar item: \"").concat(r,'"')),n}),[]),_=function(){u||(t._items.forEach((function(e){e.hasAttribute(Ue.PROCESSED)||(e.style.order="".concat(l))})),l++,s.style.order="".concat(l),l++,u=!0)};f.forEach((function(e){if(e.bottom&&_(),e.new_item){var n=t._buildNewItem(e);a.append(n),e.element=n,e.element.setAttribute(Ue.PROCESSED,"true"),t._items.push(e.element)}else if(e.element){var o=e.element;e.href&&(o.href=e.href),e.target&&(o.target=e.target)}e.element.style.order="".concat(l),e.name&&t._subscribeName(e.element,e.name),e.icon&&t._subscribeIcon(e.element,e.icon),e.info&&t._subscribeInfo(e.element,e.info),e.notification&&t._subscribeNotification(e.element,e.notification),void 0!==e.hide&&t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,Ye),e.new_item&&(e.element.addEventListener(Ve.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Ve.MOUSELEAVE,t._mouseLeaveBinded)),e.element.addEventListener(Ve.MOUSEDOWN,t._itemTouchedBinded),e.element.addEventListener(Ve.KEYDOWN,(function(e){e.key===Xe.ENTER&&t._itemTouchedBinded()})),l++})),f.length&&_(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),t._panelLoaded()}))},o.prototype._itemTouched=function(){return t(this,void 0,void 0,(function(){var e=this;return n(this,(function(t){return this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element.then((function(t){e._sidebarScroll=t.scrollTop})),[2]}))}))},o.prototype._mouseEnter=function(e){this._sidebar.element.then((function(t){t.alwaysExpand||(t._mouseLeaveTimeout&&(clearTimeout(t._mouseLeaveTimeout),t._mouseLeaveTimeout=void 0),t._showTooltip(e.currentTarget))}))},o.prototype._mouseLeave=function(){return t(this,void 0,void 0,(function(){return n(this,(function(e){return this._sidebar.element.then((function(e){e._mouseLeaveTimeout&&clearTimeout(e._mouseLeaveTimeout),e._mouseLeaveTimeout=window.setTimeout((function(){e._hideTooltip()}),500)})),[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),"/profile/general"!==e.__route.path?[3,3]:[4,this._partialPanelResolver.selector.query(Pe.EDIT_SIDEBAR_BUTTON).element];case 2:(t=n.sent())&&(!1===this._isSidebarEditable?t.setAttribute(Ue.DISABLED,""):t.removeAttribute(Ue.DISABLED)),n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,r,i;return n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t=e.__route.path,[4,this._sidebar.selector.$.query(Me.PAPER_LISTBOX).element];case 2:return o=n.sent(),r=o.querySelector("\n ".concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'"],\n ').concat(Pe.SCOPE," > ").concat(Pe.ITEM,'[href="').concat(t,'/dashboard"]\n ')),i=r?null:this._items.reduce((function(e,n){var o=n.getAttribute(Ue.HREF);return t.startsWith(o)&&(!e||o.length>e.getAttribute(Ue.HREF).length)&&(e=n),e}),null),this._items.forEach((function(e){var t=r&&r===e||!r&&i===e;e.classList.toggle(Ge.IRON_SELECTED,t),e.setAttribute(Ue.ARIA_SELECTED,"".concat(t))})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._checkProfileEditableButton(),[2]}}))}))},o.prototype._process=function(){var e=this;this._homeAssistant.element.then((function(t){e._ha=t,new Te(e._ha).getRenderer().then((function(t){e._renderer=t,e._getConfig().then((function(){var t;e._renderer.variables=null!==(t=e._config.js_variables)&&void 0!==t?t:{},e._processDefaultPath(),e._processSidebar(),e._subscribeTitle(),e._subscribeSideBarEdition(),e._rearrange()}))}))}))},o}();window.CustomSidebar||(console.info("%c≡ ".concat(Le.toUpperCase()," (YAML)%cv").concat("8.3.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px"),window.CustomSidebar=new ui)}(); diff --git a/package.json b/package.json index ffd8625..a6d7826 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ }, "dependencies": { "get-promisable-result": "^1.0.1", - "home-assistant-javascript-templates": "^5.5.1", + "home-assistant-javascript-templates": "^5.6.0", "home-assistant-query-selector": "^4.3.0", "home-assistant-styles-manager": "^3.1.0", "js-yaml": "^4.1.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c98347..5516a4b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 home-assistant-javascript-templates: - specifier: ^5.5.1 - version: 5.5.1 + specifier: ^5.6.0 + version: 5.6.0 home-assistant-query-selector: specifier: ^4.3.0 version: 4.3.0 @@ -962,8 +962,8 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} - home-assistant-javascript-templates@5.5.1: - resolution: {integrity: sha512-U2TWGGl+9/9mTgLaFk7tw9BfrQQxpnUV5fvZIRa0LLyQf+xSJ+eoQ+kouhdPYaE95tOTgLv8waKTS/WRp5ZyUw==} + home-assistant-javascript-templates@5.6.0: + resolution: {integrity: sha512-zlTyFHjaAG7gQoI9gKaT0pFu4k0Tm1xcJ3lak/w+xvSKzY2tnHpwV0nb3NM7Jh5UsZCwzEsokL7TqgfWpOiupA==} home-assistant-query-selector@4.3.0: resolution: {integrity: sha512-L+TfdKKlqKAijIp/dWYKmtQWmTT+S9CZOM43L1lu1azPwVqIhJ2nlzf4GZ1MpWlGjY0+kn4sip0TYxvSCpZeeg==} @@ -2450,7 +2450,7 @@ snapshots: dependencies: function-bind: 1.1.2 - home-assistant-javascript-templates@5.5.1: + home-assistant-javascript-templates@5.6.0: dependencies: get-promisable-result: 1.0.1