!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(le).join("|"),")($|[ \\?)+:\\}\\]><.,])"),"gm"),this._scopped=ve(e,o,i),this.refs=l,this._watchForPanelUrlChange(),this._watchForEntitiesChange(),this._watchForLanguageChange()}return e.prototype._executeRenderingFunctions=function(e){var t=this;this._subscriptions.get(e).forEach((function(e,n){e.forEach((function(e,o){t.trackTemplate(n,o,e)}))}))},e.prototype._watchForPanelUrlChange=function(){var e=this;window.addEventListener(ue.LOCATION_CHANGED,(function(){e._panelUrlWatchCallback()})),window.addEventListener(ue.POPSTATE,(function(){e._panelUrlWatchCallback()}))},e.prototype._panelUrlWatchCallback=function(){this._subscriptions.has(le.PANEL_URL)&&this._executeRenderingFunctions(le.PANEL_URL)},e.prototype._watchForEntitiesChange=function(){var e=this;window.hassConnection.then((function(t){t.conn.subscribeMessage((function(t){return e._entityWatchCallback(t)}),{type:ue.SUBSCRIBE_EVENTS,event_type:ue.STATE_CHANGE_EVENT})}))},e.prototype._watchForLanguageChange=function(){var e=this;window.addEventListener(ue.TRANSLATIONS_UPDATED,(function(){e._subscriptions.has(le.LANG)&&e._executeRenderingFunctions(le.LANG)}))},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,n){var o=this;this._scopped.tracked.forEach((function(r){var i=[t,n];if(o._subscriptions.has(r)){var a=o._subscriptions.get(r);if(a.has(e)){var c=a.get(e);c.has(t)||c.set.apply(c,i)}else a.set(e,new Map([i]))}else o._subscriptions.set(r,new Map([[e,new Map([i])]]))}))},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.delete(t),0===i.size&&(o.delete(e),0===o.size&&n._subscriptions.delete(r))}}))},e.prototype.renderTemplate=function(e,t){void 0===t&&(t={});try{var n=t.variables,o=void 0===n?{}:n,r=t.refs,i=void 0===r?{}:r,a=new Map(Object.entries(ie(ie({},this._variables),o))),c=e.trim().replace(this._clientSideEntitiesRegExp,"$1clientSide.$2$3"),s=c.includes("return")||!this._autoReturn?c:"return ".concat(c);return(new(Function.bind.apply(Function,ae(ae([void 0,"hass","states","state_translated","is_state","state_attr","is_state_attr","has_value","entities","entity_prop","is_entity_prop","devices","device_attr","is_device_attr","device_id","device_name","areas","area_id","area_name","area_entities","area_devices","user_name","user_is_admin","user_is_owner","user_agent","clientSide","ref","unref",this._refsVariableName],Array.from(a.keys()),!1),["".concat('"use strict";'," ").concat(s)],!1)))).apply(void 0,ae([this._scopped.hass,this._scopped.states,this._scopped.state_translated.bind(this._scopped),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.device_name.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)),this._scopped.refs(this._entityWatchCallback.bind(this),this.cleanTracked.bind(this),i)],Array.from(a.values()),!1))}catch(e){if(this._throwErrors)throw e;return void(this._throwWarnings&&console.warn(e))}},e.prototype.trackTemplate=function(e,t,n){var o=this;void 0===n&&(n={}),this._scopped.cleanTracked();var r=this.renderTemplate(e,n);return this._storeTracked(e,t,n),t(r),function(){return o._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}),Object.defineProperty(e.prototype,"refs",{get:function(){return this._scopped.refs(this._entityWatchCallback.bind(this),this.cleanTracked.bind(this))},set:function(e){this._scopped.cleanRefs(this.cleanTracked.bind(this)),this._scopped.refs(this._entityWatchCallback.bind(this),this.cleanTracked.bind(this),e)},enumerable:!1,configurable:!0}),e}(),Ne=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 Ce(e,t)}))}return e.prototype.getRenderer=function(){return this._renderer},e}(),Le=/([A-Z])([a-z0-9_-]+)/g,we=function(e){return Object.entries(e).map((function(e){var t=e[0],n=e[1];return"".concat(function(e){return e.replace(Le,(function(e,t,n,o){var r=t.toLocaleLowerCase();return o?"-".concat(r).concat(n):"--".concat(r).concat(n)}))}(t),":").concat(n)})).join(";")+";"},De=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(we(n),"}")})).join("")})).join("")},xe=function(e,t){return"".concat(t,"_").concat(e)},Me=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},He=function(e,t){var n=xe(Me(e),t);return e.querySelector("#".concat(n))},ke=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 He(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,o,r){if(t){var i=He(t,n);if(!i){var a=xe(Me(t),n);(i=document.createElement("style")).setAttribute("id",a),t.appendChild(i)}i.innerHTML="string"==typeof e?e:De(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=He(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"}(Ae||(Ae={})),function(e){e.DOCKED="docked",e.AUTO="auto",e.ALWAYS_HIDDEN="always_hidden"}(Te||(Te={})),function(e){e.AND="AND",e.OR="OR"}(be||(be={})),function(e){e.TEXT="text",e.HREF="href"}(ge||(ge={})),function(e){e.CALL_SERVICE="call-service",e.JAVASCRIPT="javascript",e.OPEN_DIALOG="open-dialog"}(Ie||(Ie={})),function(e){e.MORE_INFO="more-info",e.ALERT="alert",e.RESTART="restart"}(ye||(ye={})),function(e){e.GET="GET",e.POST="POST"}(Re||(Re={})),function(e){e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.RELATIVE="relative"}(Se||(Se={}));var Pe,Be,Fe="custom-sidebar",je="sidebar-config",Ue="".concat("/local/").concat(je),Ge="base";!function(e){e.BOOLEAN="boolean",e.STRING="string",e.UNDEFINED="undefined",e.NUMBER="number"}(Be||(Be={}));var Ve,We,Xe,qe,Ye,Ke="data-blocked";!function(e){e.ITEM="ha-md-list-item",e.HA_SVG_ICON="ha-svg-icon",e.HA_ICON="ha-icon",e.HA_ICON_BUTTON="ha-icon-button",e.ANCHOR="a",e.BUTTON="button",e.HA_RIPPLE="ha-ripple",e.USER_BADGE="ha-user-badge",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HUI_VIEW_CONTAINER="hui-view-container",e.HUI_VIEW="hui-view"}(Ve||(Ve={})),function(e){e.HOST=":host",e.HOST_EXPANDED=":host([expanded])",e.HOST_NOT_EXPANDED=":host(:not([expanded]))",e.SIDEBAR_LOADER="ha-fade-in",e.SIDEBAR_ITEMS_CONTAINER="ha-md-list.ha-scrollbar",e.SCOPE=":scope",e.TITLE=".title",e.ITEM_SELECTED=".selected",e.ITEM_HOVER="ha-md-list-item:hover",e.SURFACE=".surface",e.SURFACE_HOVERED=".surface.hovered",e.SPACER=".spacer",e.ITEM_TEXT=".item-text",e.BADGE=".badge",e.CONFIGURATION=".configuration",e.HUI_ROOT="ha-panel-lovelace$ hui-root",e.HA_MENU_BUTTON=".header .toolbar > ha-menu-button",e.EDIT_SIDEBAR_BUTTON="ha-panel-profile ha-profile-section-general$ ha-settings-row mwc-button, ha-panel-profile ha-profile-section-general$ ha-settings-row ha-button",e.SIDEBAR_NOTIFICATIONS_CONTAINER=".notifications-container",e.SIDEBAR_NOTIFICATIONS_CONTAINER_HOVER=".notifications-container:hover",e.SIDEBAR_NOTIFICATIONS=".notifications",e.USER=".user",e.MENU=".menu",e.DIVIDER=".divider",e.MC_DRAWER=".mdc-drawer",e.DATA_INFO="[data-info]"}(We||(We={})),function(e){e.AFTER="::after",e.BEFORE="::before",e.WEBKIT_SCROLLBAR_THUMB="::-webkit-scrollbar-thumb"}(Xe||(Xe={})),function(e){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.MD_RIPPLE_HOVER_COLOR="--md-ripple-hover-color",e.MD_RIPPLE_HOVER_OPACITY="--md-ripple-hover-opacity",e.MD_SYS_COLOR_ON_SURFACE="--md-sys-color-on-surface",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.DIVIDER_OPACITY="--dark-divider-opacity",e.SCROLLBAR_THUMB_COLOR="--scrollbar-thumb-color"}(qe||(qe={})),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.ITEM_BACKGROUND_HOVER_OPACITY="--custom-sidebar-item-background-hover-opacity",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"}(Ye||(Ye={}));var $e,Je,ze,Qe,Ze,et,tt=["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","divider_color"],nt=["selection_opacity","item_background_hover_opacity"],ot=[["item_background",Ye.ITEM_BACKGROUND],["item_background_hover",Ye.ITEM_BACKGROUND_HOVER],["item_background_hover_opacity",Ye.ITEM_BACKGROUND_HOVER_OPACITY],["icon_color",Ye.ICON_COLOR],["icon_color_selected",Ye.ICON_COLOR_SELECTED],["icon_color_hover",Ye.ICON_COLOR_HOVER],["text_color",Ye.TEXT_COLOR],["text_color_selected",Ye.TEXT_COLOR_SELECTED],["text_color_hover",Ye.TEXT_COLOR_HOVER],["selection_background",Ye.SELECTION_BACKGROUND],["selection_opacity",Ye.SELECTION_OPACITY],["info_color",Ye.INFO_COLOR],["info_color_selected",Ye.INFO_COLOR_SELECTED],["info_color_hover",Ye.INFO_COLOR_HOVER],["notification_color",Ye.NOTIFICATION_COLOR],["notification_color_selected",Ye.NOTIFICATION_COLOR_SELECTED],["notification_color_hover",Ye.NOTIFICATION_COLOR_HOVER],["notification_text_color",Ye.NOTIFICATION_TEXT_COLOR],["notification_text_color_selected",Ye.NOTIFICATION_TEXT_COLOR_SELECTED],["notification_text_color_hover",Ye.NOTIFICATION_TEXT_COLOR_HOVER],["divider_color",Ye.DIVIDER_COLOR]],rt=o([["title_color",Ye.TITLE_COLOR],["subtitle_color",Ye.SUBTITLE_COLOR],["sidebar_button_color",Ye.BUTTON_COLOR],["sidebar_background",Ye.BACKGROUND],["menu_background",Ye.MENU_BACKGROUND],["scrollbar_thumb_color",Ye.SCROLLBAR_THUMB_COLOR],["divider_top_color",Ye.DIVIDER_TOP_COLOR],["divider_bottom_color",Ye.DIVIDER_BOTTOM_COLOR]],ot,!0);!function(e){e.BADGE="badge",e.ITEM_SELECTED="selected",e.USER="user"}($e||($e={})),function(e){e.ROLE="role",e.PROCESSED="data-processed",e.WITH_NOTIFICATION="data-notification",e.WITH_DIVIDER="data-divider",e.TAB_INDEX="tabindex",e.DISABLED="disabled",e.HREF="href",e.SLOT="slot",e.TYPE="type",e.CUSTOM_SIDEBAR_ATTRIBUTES="data-custom-sidebar-attrs"}(Je||(Je={})),function(e){e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_CONFIG="ha-panel-config",e.HA_CONFIG_BACKUP="ha-config-backup",e.HA_CONFIG_BACKUP_BACKUPS="ha-config-backup-backups",e.HA_CONFIG_SYSTEM_NAVIGATION="ha-config-system-navigation",e.DIALOG_BOX="dialog-box",e.DIALOG_RESTART="dialog-restart",e.HUI_TIMESTAMP_DISPLAY="hui-timestamp-display"}(ze||(ze={})),function(e){e.CLICK="click",e.MOUSEDOWN="mousedown",e.MOUSEENTER="mouseenter",e.MOUSELEAVE="mouseleave",e.KEYDOWN="keydown",e.RENDER_TEMPLATE="render_template",e.LOCATION_CHANGED="location-changed",e.HASS_MORE_INFO="hass-more-info",e.SHOW_DIALOG="show-dialog"}(Qe||(Qe={})),function(e){e.ARROW_DOWN="ArrowDown",e.ARROW_UP="ArrowUp",e.ENTER="Enter",e.TAB="Tab"}(Ze||(Ze={})),function(e){e.ITEM="HA-MD-LIST-ITEM",e.A="A"}(et||(et={}));var it,at,ct,st,lt,ut,dt,ft,_t,pt,ht,Et,Ot,mt,vt,At,Tt,bt,gt,It,yt,Rt,St,Ct,Nt,Lt,wt=["HOME-ASSISTANT","HOME-ASSISTANT-MAIN","HA-SIDEBAR"],Dt="config/core/check_config",xt="template",Mt=((Pe={})[Ae.HIDDEN]=Te.ALWAYS_HIDDEN,Pe[Ae.NARROW]=Te.AUTO,Pe[Ae.EXTENDED]=Te.DOCKED,Pe),Ht=/\/profile(\/general)?$/,kt=/^\s*\[\[\[([\s\S]+)\]\]\]\s*$/,Pt=/\{\{[\s\S]*\}\}|\{%[\s\S]*%\}/,Bt=/@partial\s+([\w-]+)/g,Ft=/^\s*([a-z_]+)\.([\w-]+)\s*$/,jt=function(e){return typeof e===Be.UNDEFINED},Ut=function(e){return typeof e===Be.STRING},Gt=function(e){return typeof e===Be.NUMBER&&!Number.isNaN(e)},Vt=function(e){return typeof e===Be.BOOLEAN},Wt=function(e){return"[object Object]"===Object.prototype.toString.call(e)},Xt=function(e){return Array.isArray(e)},qt=function(e){return Xt(e)?e.map((function(e){return e.toLowerCase()})):e.toLowerCase().split(/\s*,\s*/)},Yt=o(o([],tt,!0),nt,!0),Kt=["id","exceptions","extendable_configs","extend_from","user","not_user","device","not_device","is_admin"],$t=["js_variables","jinja_variables","partials"],Jt=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:be.OR,i=void 0!==n.user&&qt(n.user).includes(t),a=void 0!==n.not_user&&!qt(n.not_user).includes(t),c=void 0!==n.device&&qt(n.device).some((function(t){return e._userAgent.includes(t)})),s=void 0!==n.not_device&&!qt(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===be.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 zt(t[r].trim(),t,o(o([],n,!0),[r],!1))}return console.warn("".concat(Fe,": partial ").concat(r," doesn't exist")),""}))},Qt=function(){for(var e=[],t=0;t ").concat(Ve.USER_BADGE)]={zIndex:1},it["".concat(We.HOST_EXPANDED," ").concat(Ve.ITEM," > ").concat(We.ITEM_TEXT)]={position:"relative",zIndex:1},it["".concat(We.HOST_EXPANDED," ").concat(Ve.ITEM," > ").concat(We.ITEM_TEXT).concat(We.DATA_INFO)]={display:"flex",flexDirection:"column",gap:"5px",lineHeight:"1"},it["".concat(We.HOST_EXPANDED," ").concat(Ve.ITEM," > ").concat(We.ITEM_TEXT).concat(We.DATA_INFO).concat(Xe.AFTER)]={content:"attr(data-info)",display:"block",fontSize:"11px",lineHeight:"1",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},it["".concat(We.HOST," ").concat(Ve.ITEM,":not([").concat(Je.WITH_NOTIFICATION,"], ").concat(We.CONFIGURATION,", ").concat(We.SIDEBAR_NOTIFICATIONS,") > ").concat(We.BADGE)]={display:"none"},it["".concat(We.HOST_NOT_EXPANDED," ").concat(Ve.ITEM,":not([").concat(Je.WITH_NOTIFICATION,"], ").concat(We.CONFIGURATION,", ").concat(We.SIDEBAR_NOTIFICATIONS,") > ").concat(We.BADGE)]={display:"none"},it["".concat(We.HOST," ").concat(Ve.ITEM," > ").concat(We.BADGE)]=sn,it["".concat(We.HOST_NOT_EXPANDED," ").concat(Ve.ITEM," > ").concat(We.BADGE)]=e(e({},sn),{display:"flex",fontSize:"0.65em",justifyContent:"center",left:"26px",lineHeight:"2",maxWidth:"5px",textOverflow:"unset",top:"4px",padding:"0 5px",position:"absolute"}),it),un=((at={})["".concat(We.HOST," ").concat(We.MENU," > ").concat(We.TITLE)]={color:Qt(Ye.TITLE_COLOR,qe.SIDEBAR_TITLE_COLOR,qe.PRIMARY_TEXT_COLOR)},at),dn=((ct={})["".concat(We.HOST," ").concat(We.MENU," > ").concat(We.TITLE).concat(Xe.AFTER)]={content:"attr(data-subtitle)",color:Qt(Ye.SUBTITLE_COLOR,Ye.TITLE_COLOR,qe.SIDEBAR_TITLE_COLOR,qe.PRIMARY_TEXT_COLOR),display:"block",fontSize:"12px",lineHeight:"1.5"},ct),fn=((st={})["".concat(We.HOST," ").concat(We.MENU," > ").concat(Ve.HA_ICON_BUTTON)]={color:Qt(Ye.BUTTON_COLOR,qe.SIDEBAR_ICON_COLOR)},st),_n=((lt={})[We.HOST]={background:Qt(Ye.BACKGROUND,qe.SIDEBAR_BACKGROUND_COLOR)+" !important"},lt),pn=((ut={})["".concat(We.HOST," ").concat(We.MENU)]={background:Qt(Ye.MENU_BACKGROUND,Ye.BACKGROUND,qe.SIDEBAR_MENU_BUTTON_BACKGROUND_COLOR,"inherit"),borderBottomColor:Qt(Ye.DIVIDER_TOP_COLOR,Ye.DIVIDER_COLOR,qe.DIVIDER_COLOR),borderBottomStyle:"solid",borderBottomWidth:"1px"},ut),hn=((dt={})["".concat(We.HOST," ").concat(We.DIVIDER).concat(Xe.BEFORE)]={backgroundColor:Qt(Ye.DIVIDER_BOTTOM_COLOR,Ye.DIVIDER_COLOR,qe.DIVIDER_COLOR)},dt),En=((ft={})["".concat(We.HOST," > ").concat(We.MC_DRAWER)]={borderColor:Qt(Ye.BORDER_COLOR,qe.DIVIDER_COLOR,"rgba(0,0,0,.12)")},ft),On=((_t={})["".concat(We.HOST," ").concat(We.SIDEBAR_ITEMS_CONTAINER)]={scrollbarColor:Qt(Ye.SCROLLBAR_THUMB_COLOR,qe.SCROLLBAR_THUMB_COLOR)+" transparent"},_t["".concat(We.HOST," ").concat(We.SIDEBAR_ITEMS_CONTAINER).concat(Xe.WEBKIT_SCROLLBAR_THUMB)]={background:Qt(Ye.SCROLLBAR_THUMB_COLOR,qe.SCROLLBAR_THUMB_COLOR)},_t),mn=((pt={})["".concat(We.MENU,"[").concat(Ke,"]")]={pointerEvents:"none"},pt["".concat(We.MENU,"[").concat(Ke,"] > ").concat(Ve.HA_ICON_BUTTON)]={pointerEvents:"all"},pt),vn=((ht={})["".concat(We.HOST," ").concat(Ve.ITEM,":not(").concat(We.ITEM_SELECTED,")").concat(Xe.BEFORE)]={background:Qt(Ye.ITEM_BACKGROUND,"none"),bottom:"0px",content:'""',borderRadius:"4px",display:"block",left:"0px",position:"absolute",pointerEvents:"none",right:"0px",top:"0px"},ht),An=((Et={})["".concat(We.HOST," ").concat(We.SURFACE).concat(Xe.BEFORE)]={background:Qt(Ye.ITEM_BACKGROUND_HOVER,qe.MD_RIPPLE_HOVER_COLOR,qe.MD_SYS_COLOR_ON_SURFACE,"#1d1b20")},Et["".concat(We.HOST," ").concat(We.SURFACE_HOVERED).concat(Xe.BEFORE)]={opacity:Qt(Ye.ITEM_BACKGROUND_HOVER_OPACITY,qe.MD_RIPPLE_HOVER_OPACITY,".08")},Et),Tn=((Ot={})["".concat(We.HOST," ").concat(Ve.ITEM,"[").concat(Je.WITH_DIVIDER,"]")]={marginBottom:"10px",paddingBottom:"15px",position:"relative"},Ot["".concat(We.HOST," ").concat(Ve.ITEM,"[").concat(Je.WITH_DIVIDER,"]").concat(Xe.AFTER)]={content:'""',backgroundColor:Qt(Ye.DIVIDER_COLOR,qe.DIVIDER_COLOR),bottom:0,height:"1px",left:"-4px",position:"absolute",right:"-4px"},Ot["".concat(We.HOST," ").concat(Ve.ITEM).concat(We.ITEM_SELECTED,"[").concat(Je.WITH_DIVIDER,"]")]={borderBottomLeftRadius:0,borderBottomRightRadius:0},Ot["".concat(We.HOST," ").concat(Ve.ITEM).concat(We.ITEM_SELECTED,"[").concat(Je.WITH_DIVIDER,"]").concat(Xe.BEFORE)]={bottom:"10px"},Ot),bn=((mt={})["".concat(We.HOST," ").concat(Ve.ITEM," > :is(").concat(Ve.HA_SVG_ICON,", ").concat(Ve.HA_ICON,")")]={color:Qt(Ye.ICON_COLOR,qe.SIDEBAR_ICON_COLOR)},mt),gn=((vt={})["".concat(We.HOST," ").concat(Ve.ITEM).concat(We.ITEM_SELECTED," > :is(").concat(Ve.HA_SVG_ICON,", ").concat(Ve.HA_ICON,')[slot="start"]')]={color:Qt(Ye.ICON_COLOR_SELECTED,qe.SIDEBAR_SELECTED_ICON_COLOR)},vt),In=((At={})["".concat(We.HOST," ").concat(We.ITEM_HOVER,":not(").concat(We.ITEM_SELECTED,") > :is(").concat(Ve.HA_SVG_ICON,", ").concat(Ve.HA_ICON,")")]={color:Qt(Ye.ICON_COLOR_HOVER,Ye.ICON_COLOR,qe.SIDEBAR_ICON_COLOR)},At),yn=((Tt={})["".concat(We.HOST," ").concat(Ve.ITEM," > ").concat(We.ITEM_TEXT)]={color:Qt(Ye.TEXT_COLOR,qe.SIDEBAR_TEXT_COLOR)},Tt),Rn=((bt={})["".concat(We.HOST," ").concat(Ve.ITEM).concat(We.ITEM_SELECTED," > ").concat(We.ITEM_TEXT)]={color:Qt(Ye.TEXT_COLOR_SELECTED,qe.SIDEBAR_SELECTED_TEXT_COLOR)},bt),Sn=((gt={})["".concat(We.HOST," ").concat(We.ITEM_HOVER,":not(").concat(We.ITEM_SELECTED,") > ").concat(We.ITEM_TEXT)]={color:Qt(Ye.TEXT_COLOR_HOVER,Ye.TEXT_COLOR,qe.SIDEBAR_TEXT_COLOR)},gt),Cn=((It={})["".concat(We.HOST," ").concat(Ve.ITEM).concat(We.ITEM_SELECTED).concat(Xe.BEFORE)]={backgroundColor:Qt(Ye.SELECTION_BACKGROUND,Ye.ICON_COLOR_SELECTED,qe.SIDEBAR_SELECTED_ICON_COLOR),opacity:Qt(Ye.SELECTION_OPACITY,qe.DIVIDER_OPACITY)},It),Nn=((yt={})["".concat(We.HOST_EXPANDED," ").concat(We.SIDEBAR_ITEMS_CONTAINER," > ").concat(Ve.ITEM," > ").concat(We.ITEM_TEXT).concat(We.DATA_INFO).concat(Xe.AFTER)]={color:Qt(Ye.INFO_COLOR,qe.SIDEBAR_TEXT_COLOR)},yt),Ln=((Rt={})["".concat(We.HOST_EXPANDED," ").concat(We.SIDEBAR_ITEMS_CONTAINER," > ").concat(Ve.ITEM).concat(We.ITEM_SELECTED," > ").concat(We.ITEM_TEXT).concat(We.DATA_INFO).concat(Xe.AFTER)]={color:Qt(Ye.INFO_COLOR_SELECTED,qe.SIDEBAR_SELECTED_TEXT_COLOR)},Rt),wn=((St={})["".concat(We.HOST_EXPANDED," ").concat(We.ITEM_HOVER,":not(").concat(We.ITEM_SELECTED,") > ").concat(We.ITEM_TEXT).concat(We.DATA_INFO).concat(Xe.AFTER)]={color:Qt(Ye.INFO_COLOR_HOVER,Ye.INFO_COLOR,qe.SIDEBAR_TEXT_COLOR)},St),Dn=((Ct={})["".concat(We.HOST," ").concat(We.ITEM_SELECTED," > ").concat(We.BADGE)]={backgroundColor:Qt(Ye.NOTIFICATION_COLOR_SELECTED,Ye.NOTIFICATION_COLOR,qe.ACCENT_COLOR),color:Qt(Ye.NOTIFICATION_TEXT_COLOR_SELECTED,Ye.NOTIFICATION_TEXT_COLOR,qe.TEXT_ACCENT_COLOR,qe.TEXT_PRIMARY_COLOR)},Ct),xn=((Nt={})["".concat(We.HOST," ").concat(We.ITEM_HOVER,":not(").concat(We.ITEM_SELECTED,") > ").concat(We.BADGE)]={backgroundColor:Qt(Ye.NOTIFICATION_COLOR_HOVER,Ye.NOTIFICATION_COLOR,qe.ACCENT_COLOR),color:Qt(Ye.NOTIFICATION_TEXT_COLOR_HOVER,Ye.NOTIFICATION_TEXT_COLOR,qe.TEXT_ACCENT_COLOR,qe.TEXT_PRIMARY_COLOR)},Nt),Mn=((Lt={})["".concat(We.HA_MENU_BUTTON)]=!1,Lt);function Hn(e){return null==e}var kn={isNothing:Hn,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:Hn(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 Un(e,t){return kn.repeat(" ",t-e.length)+e}var Gn=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=jn(e.buffer,r[a-c],i[a-c],e.position-(r[a]-r[a-c]),d),l=kn.repeat(" ",t.indent)+Un((e.line-c+1).toString(),u)+" | "+s.str+"\n"+l;for(s=jn(e.buffer,r[a],i[a],e.position,d),l+=kn.repeat(" ",t.indent)+Un((e.line+1).toString(),u)+" | "+s.str+"\n",l+=kn.repeat("-",t.indent+u+3+s.pos)+"^\n",c=1;c<=t.linesAfter&&!(a+c>=i.length);c++)s=jn(e.buffer,r[a+c],i[a+c],e.position-(r[a]-r[a+c]),d),l+=kn.repeat(" ",t.indent)+Un((e.line+c+1).toString(),u)+" | "+s.str+"\n";return l.replace(/\n$/,"")},Vn=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Wn=["scalar","sequence","mapping"];var Xn=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===Vn.indexOf(t))throw new Fn('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===Wn.indexOf(this.kind))throw new Fn('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function qn(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 Yn(e){return this.extend(e)}Yn.prototype.extend=function(e){var t=[],n=[];if(e instanceof Xn)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 Fn("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 Xn))throw new Fn("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new Fn("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 Fn("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 Xn))throw new Fn("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var o=Object.create(Yn.prototype);return o.implicit=(this.implicit||[]).concat(t),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=qn(o,"implicit"),o.compiledExplicit=qn(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"]}}),io=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var ao=/^[-+]?[0-9]+e/;var co=new Xn("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!io.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||kn.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(kn.isNegativeZero(e))return"-0.0";return n=e.toString(10),ao.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),so=Qn.extend({implicit:[Zn,eo,ro,co]}),lo=so,uo=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),fo=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 _o=new Xn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==uo.exec(e)||null!==fo.exec(e))},construct:function(e){var t,n,o,r,i,a,c,s,l=0,u=null;if(null===(t=uo.exec(e))&&(t=fo.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 po=new Xn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Eo=new Xn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,o=0,r=e.length,i=ho;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=ho,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=ho;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}}),Oo=Object.prototype.hasOwnProperty,mo=Object.prototype.toString;var vo=new Xn("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))}function Ko(e,t,n){"__proto__"===t?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}for(var $o=new Array(256),Jo=new Array(256),zo=0;zo<256;zo++)$o[zo]=qo(zo)?1:0,Jo[zo]=qo(zo);function Qo(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Io,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 Zo(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=Gn(n),new Fn(t,n)}function er(e,t){throw Zo(e,t)}function tr(e,t){e.onWarning&&e.onWarning.call(null,Zo(e,t))}var nr={YAML:function(e,t,n){var o,r,i;null!==e.version&&er(e,"duplication of %YAML directive"),1!==n.length&&er(e,"YAML directive accepts exactly one argument"),null===(o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&er(e,"ill-formed argument of the YAML directive"),r=parseInt(o[1],10),i=parseInt(o[2],10),1!==r&&er(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=i<2,1!==i&&2!==i&&tr(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var o,r;2!==n.length&&er(e,"TAG directive accepts exactly two arguments"),o=n[0],r=n[1],ko.test(o)||er(e,"ill-formed tag handle (first argument) of the TAG directive"),yo.call(e.tagMap,o)&&er(e,'there is a previously declared suffix for "'+o+'" tag handle'),Po.test(r)||er(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){er(e,"tag prefix is malformed: "+r)}e.tagMap[o]=r}};function or(e,t,n,o){var r,i,a,c;if(t1&&(e.result+=kn.repeat("\n",t-1))}function ur(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,er(e,"tab characters must not be used in indentation")),45===o)&&Uo(e.input.charCodeAt(e.position+1));)if(c=!0,e.position++,cr(e,!0,-1)&&e.lineIndent<=t)a.push(null),o=e.input.charCodeAt(e.position);else if(n=e.line,_r(e,t,Co,!1,!0),a.push(e.result),cr(e,!0,-1),o=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==o)er(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),_r(e,t,No,!0,r)&&(O?h=e.result:E=e.result),O||(ir(e,f,_,p,h,E,a,c,s),p=h=E=null),cr(e,!0,-1),l=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&0!==l)er(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===r?er(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?er(e,"repeat of an indentation width identifier"):(l=t+r-1,s=!0)}if(jo(i)){do{i=e.input.charCodeAt(++e.position)}while(jo(i));if(35===i)do{i=e.input.charCodeAt(++e.position)}while(!Fo(i)&&0!==i)}for(;0!==i;){for(ar(e),e.lineIndent=0,i=e.input.charCodeAt(e.position);(!s||e.lineIndentl&&(l=e.lineIndent),Fo(i))u++;else{if(e.lineIndent0){for(r=a,i=0;r>0;r--)(a=Vo(c=e.input.charCodeAt(++e.position)))>=0?i=(i<<4)+a:er(e,"expected hexadecimal character");e.result+=Yo(i),e.position++}else er(e,"unknown escape sequence");n=o=e.position}else Fo(c)?(or(e,n,o,!0),lr(e,cr(e,!1,t)),n=o=e.position):e.position===e.lineStart&&sr(e)?er(e,"unexpected end of the document within a double quoted scalar"):(e.position++,o=e.position)}er(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&&!Uo(o)&&!Go(o);)o=e.input.charCodeAt(++e.position);return e.position===t&&er(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),yo.call(e.anchorMap,n)||er(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],cr(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(Uo(u=e.input.charCodeAt(e.position))||Go(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)&&(Uo(o=e.input.charCodeAt(e.position+1))||n&&Go(o)))return!1;for(e.kind="scalar",e.result="",r=i=e.position,a=!1;0!==u;){if(58===u){if(Uo(o=e.input.charCodeAt(e.position+1))||n&&Go(o))break}else if(35===u){if(Uo(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&sr(e)||n&&Go(u))break;if(Fo(u)){if(c=e.line,s=e.lineStart,l=e.lineIndent,cr(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&&(or(e,r,i,!1),lr(e,e.line-c),r=i=e.position,a=!1),jo(u)||(i=e.position+1),u=e.input.charCodeAt(++e.position)}return or(e,r,i,!1),!!e.result||(e.kind=d,e.result=f,!1)}(e,f,Ro===n)&&(E=!0,null===e.tag&&(e.tag="?")):(E=!0,null===e.tag&&null===e.anchor||er(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(E=c&&ur(e,_))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&er(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&&er(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)):er(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 pr(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))&&(cr(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&&!Uo(r);)r=e.input.charCodeAt(++e.position);for(o=[],(n=e.input.slice(t,e.position)).length<1&&er(e,"directive name must not be less than one character in length");0!==r;){for(;jo(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!Fo(r));break}if(Fo(r))break;for(t=e.position;0!==r&&!Uo(r);)r=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==r&&ar(e),yo.call(nr,n)?nr[n](e,n,o):tr(e,'unknown document directive "'+n+'"')}cr(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,cr(e,!0,-1)):a&&er(e,"directives end mark is expected"),_r(e,e.lineIndent-1,No,!1,!0),cr(e,!0,-1),e.checkLineBreaks&&Mo.test(e.input.slice(i,e.position))&&tr(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&sr(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,cr(e,!0,-1)):e.position=55296&&o<=56319&&t+1=56320&&n<=57343?1024*(o-55296)+n-56320+65536:o}function ri(e){return/^\n* /.test(e)}var ii=1,ai=2,ci=3,si=4,li=5;function ui(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 ei(e)&&e!==vr&&!Zr(e)&&e!==Dr&&e!==kr&&e!==xr&&e!==wr&&e!==Br&&e!==Fr&&e!==Ur&&e!==Vr&&e!==Rr&&e!==Cr&&e!==Lr&&e!==Ir&&e!==Gr&&e!==Mr&&e!==Hr&&e!==Nr&&e!==yr&&e!==Sr&&e!==Pr&&e!==jr}(oi(e,0))&&function(e){return!Zr(e)&&e!==xr}(oi(e,e.length-1));if(t||a)for(s=0;s=65536?s+=2:s++){if(!ei(l=oi(e,s)))return li;h=h&&ni(l,u,c),u=l}else{for(s=0;s=65536?s+=2:s++){if((l=oi(e,s))===Tr)d=!0,_&&(f=f||s-p-1>o&&" "!==e[p+1],p=s);else if(!ei(l))return li;h=h&&ni(l,u,c),u=l}f=f||_&&s-p-1>o&&" "!==e[p+1]}return d||f?n>9&&ri(e)?li:a?i===$r?li:ai:f?si:ci:!h||a||r(e)?i===$r?li:ai:ii}function di(e,t,n,o,r){e.dump=function(){if(0===t.length)return e.quotingType===$r?'""':"''";if(!e.noCompatMode&&(-1!==Xr.indexOf(t)||qr.test(t)))return e.quotingType===$r?'"'+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(ui(t,c,e.indent,a,(function(t){return function(e,t){var n,o;for(n=0,o=e.implicitTypes.length;n"+fi(t,e.indent)+_i(zr(function(e,t){var n,o,r=/(\n+)([^\n]*)/g,i=(c=e.indexOf("\n"),c=-1!==c?c:e.length,r.lastIndex=c,pi(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")+pi(l,t),a=n}return i}(t,a),i));case li:return'"'+function(e){for(var t,n="",o=0,r=0;r=65536?r+=2:r++)o=oi(e,r),!(t=Wr[o])&&ei(o)?(n+=e[r],o>=65536&&(n+=e[r+1])):n+=t||Yr(o);return n}(t)+'"';default:throw new Fn("impossible error: invalid scalar style")}}()}function fi(e,t){var n=ri(e)?String(t):"",o="\n"===e[e.length-1];return n+(o&&("\n"===e[e.length-2]||"\n"===e)?"+":o?"":"-")+"\n"}function _i(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function pi(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 hi(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 Oi(e,t,n,o,r,i,a){e.tag=null,e.dump=n,Ei(e,n,!1)||Ei(e,n,!0);var c,s=Or.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 Fn("sortKeys must be a boolean or a function");for(r=0,i=f.length;r1024)&&(e.dump&&Tr===e.dump.charCodeAt(0)?l+="?":l+="? "),l+=e.dump,s&&(l+=Qr(e,t)),Oi(e,t+1,c,!0,s)&&(e.dump&&Tr===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?"":" "),Oi(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?hi(e,t-1,e.dump,r):hi(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 mi(e,t){var n,o,r=[],i=[];for(vi(e,r,i),n=0,o=i.length;n ")," > ").concat(e,'"'));if(e===Ge)throw new SyntaxError("".concat(bi,', 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(bi,', error in "').concat(n[n.length-1],'": "').concat(e,'" doesn\'t exist in "extendable_configs"'));Di(t.extendable_configs[e].extend_from,t,o(o([],n,!0),[e],!1))}))},xi=function(e,t){Ii.forEach((function(n){if(n in e)throw new SyntaxError("".concat(t,' "').concat(n,'" option can only be placed in the main config'))}))},Mi=function(e,t,n){if(Ut(t)&&(kt.test(t)||Pt.test(t)))console.warn('"'.concat(e,'" property should not have templates. "').concat(n.join(" > "),'" seems to be a template'));else if(!Ut(t)&&!Gt(t)&&!Vt(t))if(Xt(t))t.forEach((function(t,r){Mi(e,t,o(o([],n,!0),["[".concat(r,"]")],!1))}));else{if(!Wt(t))throw new SyntaxError("".concat(bi,', "').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];Mi(e,i,o(o([],n,!0),[r],!1))}))}},Hi=function(e,t){if(!jt(t)){if(!Wt(t))throw new SyntaxError("".concat(bi,', "').concat(e,'" property should be an object'));Object.entries(t).forEach((function(t){var n=t[0],o=t[1];Mi(e,o,[n])}))}},ki=function(e,t){if(e.analytics){if(!Vt(e.analytics)&&!Wt(e.analytics))throw new SyntaxError("".concat(t,' "analytics" should be a boolean or an object'));Wt(e.analytics)&&Si(e.analytics,["sidebar_item_clicked","panel_visited"],"".concat(t,' "analytics"'))}},Pi=function(e,t){if(!jt(e)){if(!Xt(e))throw new SyntaxError("".concat(bi,", exceptions should be an array"));e.forEach((function(e){!function(e,t){var n;if(xi(e,"".concat(bi,", exceptions")),yi(e,o([],gi,!0),"".concat(bi,", exceptions")),Ri(e,o([],nt,!0),"".concat(bi,", exceptions")),Ni([["user",e.user],["not_user",e.not_user],["device",e.device],["not_device",e.not_device],["extend_from",e.extend_from]],"".concat(bi,", exceptions")),wi(e.extend_from,t,"".concat(bi,", error in exception:"),!0),!jt(e.matchers_conditions)&&e.matchers_conditions!==be.AND&&e.matchers_conditions!==be.OR)throw new SyntaxError("".concat(bi,', exceptions "matchers_conditions" property should be "').concat(be.AND,'" or "').concat(be.OR,'"'));if(!jt(e.order)&&!Xt(e.order))throw new SyntaxError("".concat(bi,', exceptions "order" property should be an array'));if(Ci(e,["sidebar_editable"],"".concat(bi,", exceptions")),Si(e,["hide_all","is_admin","is_owner"],"".concat(bi,", exceptions")),ki(e,"".concat(bi,", error in exception:")),!jt(e.sidebar_mode)&&!(e.sidebar_mode in Mt))throw new SyntaxError("".concat(bi,', exceptions "sidebar_mode" property should be ').concat(Ae.HIDDEN,", ").concat(Ae.NARROW," or ").concat(Ae.EXTENDED));if(e.user&&e.not_user)throw new SyntaxError("".concat(bi,', exceptions "user" and "not_user" properties cannot be used together'));if(e.device&&e.not_device)throw new SyntaxError("".concat(bi,', exceptions "device" and "not_device" properties cannot be used together'));null===(n=e.order)||void 0===n||n.forEach(Bi)}(e,t)}))}},Bi=function(e){if(xi(e,"".concat(bi," in ").concat(e.item,",")),!e.item)throw new SyntaxError("".concat(bi,', every item in an "order" array should have an "item" property'));if(yi(e,o(["item","info"],tt,!0),"".concat(bi," in ").concat(e.item,",")),Ri(e,o([],nt,!0),"".concat(bi," in ").concat(e.item,",")),Ci(e,["hide"],"".concat(bi," in ").concat(e.item,",")),Si(e,["divider"],"".concat(bi," in ").concat(e.item,",")),function(e,t){if(!jt(e.on_click)){if(!Wt(e.on_click))throw new SyntaxError("".concat(t,' "on_click" property should be an object'));if(!Ut(e.on_click.action))throw new SyntaxError("".concat(t,' the "action" parameter should be a string'));if(!Object.values(Ie).includes(e.on_click.action))throw new SyntaxError("".concat(t,' the "action" parameter should be one of these values: ').concat(Object.values(Ie).join(", ")));if(e.on_click.action===Ie.CALL_SERVICE){if(!Ut(e.on_click.service))throw new SyntaxError("".concat(t,' the "service" parameter should be a string'));if(!jt(e.on_click.data)&&!Wt(e.on_click.data))throw new SyntaxError("".concat(t,' the "data" parameter needs to be an object'))}if(e.on_click.action===Ie.JAVASCRIPT&&!Ut(e.on_click.code))throw new SyntaxError("".concat(t,' the "code" parameter should be a string'))}}(e,"".concat(bi," in ").concat(e.item,",")),function(e,t){if(!jt(e)){if(!Wt(e)&&!Ut(e))throw new SyntaxError("".concat(t,' the "attributes" parameter should be an object or a template string'));if(Wt(e))Object.entries(e).forEach((function(e){var n=e[0],o=e[1];if(!Ut(o)&&!Vt(o)&&!Gt(o))throw new SyntaxError("".concat(t,' the prop "').concat(n,'" in the attributes should be a string, a number or a boolean'))}));else if(Ut(e)&&!kt.test(e))throw new SyntaxError("".concat(t,' the "attributes" parameter as a string should be a JavaScript template'))}}(e.attributes,"".concat(bi," in ").concat(e.item,",")),e.new_item){if(yi(e,["href","icon"],"".concat(bi," in ").concat(e.item,",")),!e.href&&!e.on_click)throw new SyntaxError("".concat(bi," in ").concat(e.item,', if you set "new_item" as "true", it is necessary an "href" or an "on_click "property'));if(!e.icon)throw new SyntaxError("".concat(bi," in ").concat(e.item,', if you set "new_item" as "true", "icon" property is necessary'))}},Fi=function(e){var t;if(yi(e,o([],gi,!0),"".concat(bi,",")),Ni([["extend_from",e.extend_from]],"".concat(bi,",")),wi(e.extend_from,e,"".concat(bi,", error in main config:")),function(e){e.extendable_configs&&Object.entries(e.extendable_configs).forEach((function(t){var n=t[0],o=t[1];Di(o.extend_from,e,[n])}))}(e),Ri(e,o([],nt,!0),"".concat(bi,",")),Ci(e,["sidebar_editable"],"".concat(bi,",")),Si(e,["hide_all"],"".concat(bi,",")),!jt(e.sidebar_mode)&&!(e.sidebar_mode in Mt))throw new SyntaxError("".concat(bi,', "sidebar_mode" property should be ').concat(Ae.HIDDEN,", ").concat(Ae.NARROW," or ").concat(Ae.EXTENDED));if(!jt(e.order)&&!Xt(e.order))throw new SyntaxError("".concat(bi,', "order" property should be an array'));if(!jt(e.partials)){if(!Wt(e.partials))throw new SyntaxError("".concat(bi,', "partials" property should be an object'));Object.entries(e.partials).forEach((function(e){var t=e[0],n=e[1];if(!Ut(n))throw new SyntaxError("".concat(bi,', "partials" should be an object with strings. The partial ').concat(t," is not a string"))}))}Hi("js_variables",e.js_variables),Hi("js_refs",e.js_refs),Hi("jinja_variables",e.jinja_variables),ki(e,"".concat(bi,",")),null===(t=e.order)||void 0===t||t.forEach(Bi),Pi(e.exceptions,e)},ji=function(){return t(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){return e="".concat(Fe,": YAML config file not found."),t="Make sure you have valid config in /config/www/".concat(je,".yaml file."),[2,new Promise((function(n){fetch("".concat(Ue,".yaml?hash=").concat(Math.random().toString(16).slice(2)),{cache:"no-store"}).then((function(o){if(!o.ok)throw Error("".concat(e,"\n").concat(t));o.text().then((function(e){return Ti.load(e)})).then((function(e){var o;(null===(o=e.id)||void 0===o?void 0:o.startsWith("example_yaml"))&&console.warn("".concat(Fe,": You seem to be using the example configuration.\n").concat(t)),Fi(e),n(e)})).catch((function(e){throw Error("".concat(Fe,": ").concat((null==e?void 0:e.message)||e))}))})).catch((function(){throw Error("".concat(e,"\n").concat(t))}))}))]}))}))},Ui=function(){function o(e){var t=this;this._debug=e;var n=new re;n.addEventListener(k.ON_LISTEN,(function(e){t._homeAssistant=e.detail.HOME_ASSISTANT,t._main=e.detail.HOME_ASSISTANT_MAIN,t._haDrawer=e.detail.HA_DRAWER,t._sidebar=e.detail.HA_SIDEBAR,t._partialPanelResolver=e.detail.PARTIAL_PANEL_RESOLVER,t._debugLog("HAQuerySelector init executed",{HOME_ASSISTANT:t._homeAssistant,HOME_ASSISTANT_MAIN:t._main,HA_DRAWER:t._haDrawer,HA_SIDEBAR:t._sidebar,PARTIAL_PANEL_RESOLVER:t._partialPanelResolver},{stringify:!1}),t._process()}),{once:!0}),n.addEventListener(k.ON_PANEL_LOAD,this._panelLoaded.bind(this)),this._huiViewContainerObserver=new MutationObserver(this._watchHuiViewContainer.bind(this)),this._styleManager=new ke({prefix:Fe,namespace:Fe,throwWarnings:!1}),this._debugLog("Starting the plugin..."),this._items=[],this._logBookMessagesMap=new Map,this._sidebarScroll=0,this._itemTouchedBinded=this._itemTouched.bind(this),this._mouseEnterBinded=this._mouseEnter.bind(this),this._mouseLeaveBinded=this._mouseLeave.bind(this),this._configPromise=ji(),n.listen()}return o.prototype._debugLog=function(e,t,n){var o=null!=n?n:{},r=o.stringify,i=void 0===r||r,a=o.table,c=void 0!==a&&a;if(this._debug){var s="".concat(Fe," debug: ").concat(e);t?(console.groupCollapsed(s),c?console.table(t):console.log(i?JSON.stringify(t,null,4):t),console.groupEnd()):console.log(s)}},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 this._debugLog("Getting the config..."),e=this,[4,this._configPromise.then((function(e){return t._debugLog("Raw config",e),function(e,t,n){return new Jt(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,a,c;return n(this,(function(n){switch(n.label){case 0:return e={retries:100,delay:50,shouldReject:!1},[4,this._sidebar.selector.$.element];case 1:return t=n.sent(),[4,r((function(){return t.querySelector(We.SIDEBAR_LOADER)}),(function(e){return null===e}),e)];case 2:return n.sent(),[4,this._sidebar.selector.$.query(We.SIDEBAR_ITEMS_CONTAINER).element];case 3:return o=n.sent(),[4,r((function(){return o.querySelector(":scope > ".concat(We.SPACER))}),(function(e){return!!e}),e)];case 4:return i=n.sent(),[4,r((function(){return o.querySelectorAll(":scope > ".concat(Ve.ITEM))}),(function(e){return Array.from(e).every((function(e){return e.querySelector(We.ITEM_TEXT).innerText.trim().length>0}))}),e)];case 5:return a=n.sent(),this._debug&&(c=Array.from(a).map((function(e){var t=e.href;return{text:e.querySelector(We.ITEM_TEXT).textContent.trim(),href:t}})),this._debugLog("Native sidebar items",c,{table:!0})),[2,[o,a,i]]}}))}))},o.prototype._getAnchorElement=function(e){return e.shadowRoot.querySelector(Ve.ANCHOR)},o.prototype._getButtonElement=function(e){return e.shadowRoot.querySelector(Ve.BUTTON)},o.prototype._hideItem=function(e,t){t?e.style.display="none":e.style.removeProperty("display")},o.prototype._buildNewItem=function(e){var t,n,o=document.createElement("ha-md-list-item");return o.setAttribute(Je.TYPE,"link"),o.href=null!==(t=e.href)&&void 0!==t?t:"#",o.target=null!==(n=e.target)&&void 0!==n?n:"",o.tabIndex=-1,o.innerHTML='\n '.concat(e.item,'\n \n '),o},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||Ut(e)||Gt(e)||Vt(e)||Wt(e)||Xt(e)||(r=e,"[object RegExp]"===Object.prototype.toString.call(r))?Ut(e)?(t=e.trim(),[3,6]):[3,1]:[3,6];case 1:return Gt(e)||Vt(e)?(t=e.toString(),[3,6]):[3,2];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]}var r}))}))},o.prototype._subscribeTitle=function(){var e=this;this._sidebar.selector.$.query(We.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(Qe.SHOW_DIALOG,t,!0),n.removeAttribute(Ke)},o=function(e,n){e.removeEventListener(Qe.SHOW_DIALOG,t,!0),e.addEventListener(Qe.SHOW_DIALOG,t,!0),n.setAttribute(Ke,"")};Promise.all([this._sidebar.element,this._sidebar.selector.$.query(We.MENU).element]).then((function(t){var r=t[0],i=t[1];Vt(e._config.sidebar_editable)&&(e._config.sidebar_editable||o(r,i)),Ut(e._config.sidebar_editable)&&e._subscribeTemplate(e._config.sidebar_editable,(function(t){var a=void 0;"true"===t||"false"===t?(a=!("false"===t))?n(r,i):o(r,i):(a=void 0,n(r,i)),e._checkProfileEditableButton(a)}))}))},o.prototype._subscribeAttributes=function(e,t){var n=function(t){var n,o,r=null!==(o=null===(n=e.element.getAttribute(Je.CUSTOM_SIDEBAR_ATTRIBUTES))||void 0===n?void 0:n.split("|"))&&void 0!==o?o:[];r.forEach((function(t){e.element.removeAttribute(t)})),r.splice(0),t.forEach((function(t){var n=t[0],o=t[1];Ut(o)||Gt(o)||Vt(o)?(e.element.setAttribute(n,"".concat(o)),r.push(n)):console.warn("".concat(Fe,': the property "').concat(n,'" in the attributes property of the item "').concat(e.item,'" should be a string, a number or a boolean. This property will be omitted'))})),e.element.setAttribute(Je.CUSTOM_SIDEBAR_ATTRIBUTES,r.join("|"))};Ut(t)?this._subscribeTemplate(t,(function(e){try{var t=JSON.parse(e);n(Object.entries(t))}catch(e){throw new SyntaxError("".concat(Fe,': "attributes" template must always return an object'))}})):n(Object.entries(t))},o.prototype._subscribeName=function(e,t){var n=e.querySelector(We.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(Ve.HA_ICON);if(!n){(n=document.createElement(Ve.HA_ICON)).setAttribute(Je.SLOT,"start");var o=e.querySelector(Ve.HA_SVG_ICON);o?o.replaceWith(n):e.prepend(n)}n.setAttribute("icon",t)}))},o.prototype._subscribeInfo=function(e,t){var n=e.querySelector(We.ITEM_TEXT);this._subscribeTemplate(t,(function(e){n.dataset.info=e}))},o.prototype._subscribeNotification=function(e,t){var n=e.querySelector(We.BADGE);n||((n=document.createElement("span")).classList.add($e.BADGE),n.setAttribute(Je.SLOT,"end"),e.append(n));this._subscribeTemplate(t,(function(t){t.length?(n.innerHTML=t,e.setAttribute(Je.WITH_NOTIFICATION,"true")):(n.innerHTML="",e.removeAttribute(Je.WITH_NOTIFICATION))}))},o.prototype._subscribeHide=function(e,t){var n=this;Vt(t)?this._hideItem(e,t):this._subscribeTemplate(t,(function(t){n._hideItem(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){var n=zt("".concat(e),this._config.partials);kt.test(n)?this._createJsTemplateSubscription(n.replace(kt,"$1"),t):Pt.test(n)?this._createJinjaTemplateSubscription(n,t):this._getTemplateString(n).then((function(e){t(e)}))},o.prototype._createJsTemplateSubscription=function(e,t){var n=this;this._renderer.trackTemplate(e,(function(e){n._getTemplateString(e).then((function(e){t(e)}))}))},o.prototype._createJinjaTemplateSubscription=function(t,n){var o=this;return new Promise((function(r){window.hassConnection.then((function(i){var a=i.conn.subscribeMessage((function(e){n("".concat(e.result))}),{type:Qe.RENDER_TEMPLATE,template:t,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)});r(a)}))}))},o.prototype._focusItem=function(e,t){var n=this._items.length,o="none",r=0;if(t)for(var i=(s=e+1)+n,a=s;an-1?a-n:a;if(this._items[c].style.display!==o){r=c;break}}else{var s;for(i=(s=e-1)-n,a=s;a>i;a--){c=a<0?n+a:a;if(this._items[c].style.display!==o){r=c;break}}}this._items[r].focus(),this._items[r].tabIndex=0},o.prototype._focusItemByKeyboard=function(e,t){var n=e.querySelector("\n ".concat(We.SCOPE," > ").concat(Ve.ITEM,":not(.").concat($e.ITEM_SELECTED,"):focus,\n ").concat(We.SCOPE," > ").concat(Ve.ITEM,":focus\n ")),o=0;this._items.forEach((function(e,t){e===n&&(o=t),e.tabIndex=-1})),this._focusItem(o,t)},o.prototype._focusItemByTab=function(e,t,n){var o=e.querySelector(We.SIDEBAR_NOTIFICATIONS),r=e.querySelector(We.USER),i=e.querySelector(Ve.HA_ICON_BUTTON),a=this._items.indexOf(t);if(t===o||t===r||a>=0)if(t===o)n?r.focus():this._focusItem(0,n);else if(t===r)o.focus();else{var c=this._items.length-1;n&&a0?this._focusItem(a,n):n?o.focus():i.focus()}},o.prototype._getActiveElement=function(e){void 0===e&&(e=document);var t=e.activeElement;return t?t instanceof HTMLElement&&t.nodeName===et.ITEM?t:t.shadowRoot&&wt.includes(t.nodeName)?this._getActiveElement(t.shadowRoot):null:null},o.prototype._isAnalyticsOptionEnabled=function(e){return this._config.analytics&&(!0===this._config.analytics||this._config.analytics[e])},o.prototype._getUserEntity=function(){var e,t=this,n=Object.entries(this._ha.hass.entities).filter((function(e){var n=e[1];return"".concat(n.name).toLowerCase()===t._ha.hass.user.name.toLocaleLowerCase()}));return null===(e=n[0])||void 0===e?void 0:e[0]},o.prototype._logBookLog=function(e){var t=this;window.clearTimeout(this._logBookMessagesMap.get(e)),this._logBookMessagesMap.set(e,window.setTimeout((function(){t._ha.hass.callService("logbook","log",{name:Fe,message:e,domain:"person",entity_id:t._getUserEntity()}),t._logBookMessagesMap.delete(e)}),500))},o.prototype._processDefaultPath=function(){var e=this,t=this._config.default_path;if(t){var n=zt(t,this._config.partials);if(kt.test(n)){var o=this._renderer.renderTemplate(n.replace(kt,"$1"));this._executeDefaultPath(o)}else if(Pt.test(n))var r=this._createJinjaTemplateSubscription(n,(function(t){e._executeDefaultPath(t),r.then((function(e){e()}))}));else this._executeDefaultPath(n)}},o.prototype._executeDefaultPath=function(e){var t;if(e.startsWith("/")){var n=[null,"",e];(t=window.history).replaceState.apply(t,n),window.dispatchEvent(new CustomEvent(Qe.LOCATION_CHANGED,{detail:{replace:e}}))}else console.warn("".concat(Fe,': ignoring default_path property "').concat(e,'" 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=Mt[a];var s=function(o){return t(e,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return[4,this._partialPanelResolver.selector.query(We.HUI_ROOT).$.element];case 1:return e=t.sent(),this._styleManager.removeStyle(e),a!==Ae.HIDDEN&&(r.narrow=!1,i.narrow=o,o&&this._styleManager.addStyle(Mn,e)),[2]}}))}))};c.addEventListener("change",(function(e){s(e.matches)})),s(c.matches)}})),Promise.all([this._haDrawer.selector.$.query(We.MC_DRAWER).element,this._sidebar.element,this._sidebar.selector.$.element,this._sidebar.selector.$.query(We.SIDEBAR_ITEMS_CONTAINER).element]).then((function(t){var n=t[0],o=t[1],r=t[2],i=t[3];e._subscribeTemplateColorChanges(e._config,o,rt),e._subscribeTemplateColorChanges(e._config,n,[["sidebar_border_color",Ye.BORDER_COLOR]]),i.addEventListener(Qe.KEYDOWN,(function(t){t.key!==Ze.ARROW_DOWN&&t.key!==Ze.ARROW_UP||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByKeyboard(i,t.key===Ze.ARROW_DOWN))}),!0),window.addEventListener(Qe.KEYDOWN,(function(t){if(t.key===Ze.TAB){var n=e._getActiveElement();if(n){var o=n;o.nodeName===et.ITEM&&(o.classList.contains($e.USER)&&!t.shiftKey||(t.preventDefault(),t.stopImmediatePropagation(),e._focusItemByTab(r,o,!t.shiftKey)))}}}),!0),e._isAnalyticsOptionEnabled("sidebar_item_clicked")&&r.addEventListener(Qe.CLICK,(function(t){var n=t.target.closest(Ve.ITEM);if(n){var o=n.querySelector(We.ITEM_TEXT).innerText;e._logBookLog("sidebar_item_clicked: ".concat(o))}})),e._styleManager.addStyle(En,n),e._styleManager.addStyle([ln,un,dn,fn,_n,pn,hn,On,mn,Tn,vn,bn,gn,In,yn,Rn,Sn,Cn,Nn,Ln,wn,Dn,xn,e._config.styles||""],r)}))},o.prototype._aplyItemRippleStyles=function(){return t(this,void 0,void 0,(function(){var e,t=this;return n(this,(function(n){switch(n.label){case 0:return[4,this._sidebar.selector.$.query(Ve.ITEM).all];case 1:return e=n.sent(),Array.from(e).forEach((function(e){var n=("link"===e.getAttribute(Je.TYPE)?t._getAnchorElement(e):t._getButtonElement(e)).querySelector(Ve.HA_RIPPLE).shadowRoot.querySelector(We.SURFACE);t._styleManager.addStyle([An],n)})),[2]}}))}))},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._hideItem(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===ge.HREF?e.href:e.querySelector(We.ITEM_TEXT).innerText.trim();return!((!a||r!==t)&&(a||!t.toLowerCase().includes(s)))&&(!d.has(e)&&(d.add(e),!0))}));return l&&l.setAttribute(Je.PROCESSED,"true"),(c||l)&&n.push(e(e({},o),{element:l})),c||l||console.warn("".concat(Fe,": 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(Je.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(Je.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),jt(e.attributes)||t._subscribeAttributes(e,e.attributes),e.divider&&e.element.setAttribute(Je.WITH_DIVIDER,"true"),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),jt(e.hide)||t._subscribeHide(e.element,e.hide),t._subscribeTemplateColorChanges(e,e.element,ot),e.new_item&&(e.element.addEventListener(Qe.MOUSEENTER,t._mouseEnterBinded),e.element.addEventListener(Qe.MOUSELEAVE,t._mouseLeaveBinded)),e.on_click&&e.element.addEventListener(Qe.CLICK,t._mouseClick.bind(t,e),!0),l++})),f.length&&_(),t._items.sort((function(e,t){return+e.style.order-+t.style.order})),a.addEventListener(Qe.MOUSEDOWN,t._itemTouchedBinded),a.addEventListener(Qe.KEYDOWN,(function(e){e.key===Ze.ENTER&&t._itemTouchedBinded()})),t._aplyItemRippleStyles(),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(We.SIDEBAR_ITEMS_CONTAINER).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._mouseClick=function(e,o){return t(this,void 0,void 0,(function(){var t,r,i,a,c,s,l,u,d,f,_,p,h=this;return n(this,(function(n){switch(t=e.on_click,r=e.element,i=r,a=r.querySelector(We.ITEM_TEXT),c=a.textContent.trim(),"#"===i.href&&o.preventDefault(),s=function(t){var n=t.includes("return")?t:"".concat(t,"\n;return;");return h._renderer.renderTemplate(n,{variables:{item:e,itemText:c}})},t.action){case Ie.CALL_SERVICE:l=t.service,u=t.data,d=void 0===u?{}:u,f=l.match(Ft),_=Object.entries(d).map((function(e){var t=e[0],n=e[1],o=zt("".concat(n),h._config.partials);return kt.test(o)?[t,s(o.replace(kt,"$1"))]:[t,n]})),3===(null==f?void 0:f.length)?this._ha.hass.callService(f[1],f[2],Object.fromEntries(_)):console.warn("".concat(Fe,' ignoring "').concat(Ie.CALL_SERVICE,'" action in "').concat(c,'" item. The service parameter is malfomed.'));break;case Ie.JAVASCRIPT:p=t.code,s(zt(p,this._config.partials));break;case Ie.OPEN_DIALOG:switch(t.type){case ye.MORE_INFO:an(this._ha,t.entity_id);break;case ye.RESTART:rn(this._ha)}}return[2]}))}))},o.prototype._checkProfileEditableButton=function(){return t(this,arguments,void 0,(function(e){var t,o,r,i;return void 0===e&&(e=void 0),n(this,(function(n){switch(n.label){case 0:return[4,this._partialPanelResolver.element];case 1:return t=n.sent(),o=t.route.path,Ht.test(o)?[4,this._partialPanelResolver.selector.query(We.EDIT_SIDEBAR_BUTTON).element]:[3,3];case 2:if(r=n.sent()){if(i=Vt(e)?e:this._config.sidebar_editable,!Vt(i))return[2];!1===i?r.setAttribute(Je.DISABLED,""):r.removeAttribute(Je.DISABLED)}n.label=3;case 3:return[2]}}))}))},o.prototype._panelLoaded=function(){return t(this,void 0,void 0,(function(){var e,t,o,i,a,c=this;return n(this,(function(n){switch(n.label){case 0:return this._checkProfileEditableButton(),[4,this._partialPanelResolver.element];case 1:return e=n.sent(),t="".concat(location.pathname).concat(location.search),[4,this._sidebar.selector.$.query(We.SIDEBAR_ITEMS_CONTAINER).element];case 2:return o=n.sent(),i=Array.from(o.querySelectorAll(Ve.ITEM)),a=i.reduce((function(e,n){return t.startsWith(n.href)&&(null===e||n.href.length>e.href.length)?n:e}),null),i.forEach((function(e){var t=a===e;e.classList.toggle($e.ITEM_SELECTED,t),e.tabIndex=t?0:-1})),o.scrollTop!==this._sidebarScroll&&(o.scrollTop=this._sidebarScroll),this._huiViewContainerObserver.disconnect(),e.querySelector(Ve.HA_PANEL_LOVELACE)&&this._partialPanelResolver.selector.query(Ve.HA_PANEL_LOVELACE).$.query(Ve.HUI_ROOT).$.query(Ve.HUI_VIEW_CONTAINER).element.then((function(e){c._huiViewContainerObserver.observe(e,{subtree:!0,childList:!0})})),this._config?[3,4]:[4,r((function(){return c._config}),(function(e){return!!e}),{retries:100,delay:50,shouldReject:!1})];case 3:n.sent(),n.label=4;case 4:return this._isAnalyticsOptionEnabled("panel_visited")&&this._logBookLog("panel_visited: ".concat(t)),[2]}}))}))},o.prototype._watchHuiViewContainer=function(e){var t=this;e.forEach((function(e){e.addedNodes.forEach((function(e){e.localName===Ve.HUI_VIEW&&t._panelLoaded()}))}))},o.prototype._process=function(){var t=this;this._homeAssistant.element.then((function(n){t._ha=n,t._debugLog("Instantiating HomeAssistantJavaScriptTemplates..."),new Ne(t._ha).getRenderer().then((function(n){t._debugLog("HomeAssistantJavaScriptTemplates instantiated"),t._renderer=n,t._getConfig().then((function(){var n,o;t._debugLog("Compiled config",t._config),t._debugLog("Executing plugin logic..."),t._renderer.variables=e(e(e(e({},null!==(n=t._config.js_variables)&&void 0!==n?n:{}),function(e){return{checkConfig:function(){return e.hass.callApi(Re.POST,Dt)},renderTemplate:function(t){return e.hass.callApi(Re.POST,xt,{template:t})},callService:function(t,n,o){return e.hass.callService(t,n,o)}}}(t._ha)),cn(t._ha)),function(e){var t=function(t){var n=document.createElement(ze.HUI_TIMESTAMP_DISPLAY);return n.hass=e.hass,n.ts=t instanceof Date?t:new Date(t),n},n=function(e){return e.render().values.join("")};return{formatDate:function(e){var o=t(e);return o.format=Se.DATE,n(o)},formatDateTime:function(e){var o=t(e);return o.format=Se.DATETIME,n(o)},formatTime:function(e){var o=/^\d+:\d+(:\d+)?$/.test(e.toString())?"1900-01-01T".concat(e):e,r=t(o);return r.format=Se.TIME,n(r)},getRelativeTime:function(e,o){void 0===o&&(o=!1);var r=t(e);return r.format=Se.RELATIVE,r.capitalize=o,r._updateRelative(),n(r)}}}(t._ha)),t._renderer.refs=null!==(o=t._config.js_refs)&&void 0!==o?o:{},t._processDefaultPath(),t._processSidebar(),t._subscribeTitle(),t._subscribeSideBarEdition(),t._rearrange()}))}))}))},o}();if(!window.CustomSidebar){console.info("%c≡ ".concat(Fe.toUpperCase()," (YAML)%cv").concat("11.1.0"),"font-weight: bold; background: #EEEEEE; color: #666666; padding: 2px 5px;","font-weight: normal; background: #E87A24; color: #FFFFFF; padding: 2px 5px");var Gi=new URLSearchParams(window.location.search).has("cs_debug");window.CustomSidebar=new Ui(Gi)}}();