(e.add(t),e),new Set).forEach(e=>t.unshift(e))}else e&&t.push(e);return t}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?D?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){super.update(e);const t=this.render();t instanceof TemplateResult&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){}}LitElement.finalized=!0,LitElement.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,o=M.has(t),i=T&&11===t.nodeType&&!!t.host,a=i&&!N.has(r),s=a?document.createDocumentFragment():t;if(((e,t,n)=>{let r=M.get(t);void 0===r&&(removeNodes(t,t.firstChild),M.set(t,r=new NodePart(Object.assign({templateFactory:templateFactory},n))),r.appendInto(t)),r.setValue(e),r.commit()})(e,s,Object.assign({templateFactory:shadyTemplateFactory(r)},n)),a){const e=M.get(s);M.delete(s);const n=e.value instanceof TemplateInstance?e.value.template:void 0;prepareTemplateStyles(r,s,n),removeNodes(t,t.firstChild),t.appendChild(s),M.set(t,e)}!o&&i&&window.ShadyCSS.styleElement(t.host)};const getThemeVar=e=>getComputedStyle(document.body).getPropertyValue(e),defaultConfig=()=>({locale:[],header_text:h.config.title||"Home Assistant",disabled_mode:!1,kiosk_mode:!1,compact_mode:!1,footer_mode:!1,split_mode:!1,disable_sidebar:!1,hide_header:!1,chevrons:!0,indicator_top:!1,hidden_tab_redirect:!0,shadow:!0,default_tab_on_refresh:!0,background:getThemeVar("--ch-background")||getThemeVar("--app-header-background-color")||"var(--primary-color)",elements_color:getThemeVar("--ch-elements-color")||getThemeVar("--app-header-text-color")||"var(--text-primary-color)",menu_color:getThemeVar("--ch-menu-color")||"",voice_color:getThemeVar("--ch-voice-color")||"",options_color:getThemeVar("--ch-options-color")||"",all_tabs_color:getThemeVar("--ch-all-tabs-color")||"",notification_dot_color:getThemeVar("--ch-notification-dot-color")||getThemeVar("var(--accent-color)")||"#ff9800",tab_indicator_color:getThemeVar("--ch-tab-indicator-color")||"",active_tab_color:getThemeVar("--ch-active-tab-color")||"",tabs_color:[],hide_tabs:[],show_tabs:[],default_tab:"",tab_icons:[],reverse_tab_direction:!1,button_icons:[],button_text:[],reverse_button_direction:!1,menu_dropdown:!1,menu_hide:!1,voice_dropdown:!1,voice_hide:!1,options_hide:!1,hide_help:!1,hide_unused:!1,hide_refresh:!1,hide_config:!1,hide_raw:!1,tabs_css:[],header_css:"",stack_css:"",header_text_css:"",active_tab_css:"",options_list_css:"",menu_css:"",options_css:"",voice_css:"",all_tabs_css:"",tab_container_css:"",view_css:"",panel_view_css:"",template_variables:"",exceptions:[],editor_warnings:!0});var z={version:"Version"},H={docs:"Docs",forums:"Forums"},V={add_exception:"Add Exception",automatic:"automatic",buttons:"Buttons",cancel:"Cancel",chevrons_tip:"Disable scrolling arrows for tabs.",chevrons_title:"Display Tab Chevrons",compact_mode_tip:"Make header compact.",compact_mode_title:"Compact Mode",conditions:"Conditions",config:"Config",current_user_agent:"Current User Agent",current_user:"Current User",default_tab:"Default tab",disable_sidebar_tip:"Disable sidebar and menu button.",disable_sidebar_title:"Disable Sidebar",disabled_mode_tip:"Completely disable Custom-Header.",disabled_mode_title:"Disabled Mode",disabled_template:"Disabled: The current value is a template.",editor_warnings_second_title:"Display Editor Warnings & Info",editor_warnings_tip:"Toggle editor warnings.",editor_warnings_title:"Display this info and warnings section.",exceptions:"Exceptions",footer_mode_tip:"Turn the header into a footer or reverse split mode.",footer_mode_title:"Footer Mode",header_text:"Header text.",hidden_tab_redirect_tip:"Redirect from hidden tab.",hidden_tab_redirect_title:"Hidden Tab Redirect",hide_configure_ui_tip:"Hide item in options menu.",hide_configure_ui_title:"Hide 'Configure UI'",hide_header_tip:"Hide header, but allow swipe out of sidebar.",hide_header_title:"Disable Header",hide_help_tip:"Hide item in options menu.",hide_help_title:"Hide 'Help'",hide_raw_editor_tip:"Hide item in options menu.",hide_raw_editor_title:"Hide 'Raw Config Editor'",hide_tab_list:"Comma-separated list of tab numbers to hide",hide_unused_tip:"Hide item in options menu.",hide_unused_title:"Hide 'Unused Entities'",kiosk_mode_tip:"Hide and disable the header and sidebar",kiosk_mode_title:"Kiosk Mode",locale_desc:"Locale for default template variables (date/time).",media_query:"Media Query",menu_dropdown_tip:"Put menu button in options menu.",menu_dropdown_title:"Menu in Dropdown Menu",menu_hide_tip:"Hide the menu button.",menu_hide_title:"Hide Menu Button",menu_items:"Menu Items",options_hide_tip:"Hide the options button.",options_hide_title:"Hide Options Button",query_string:"Query String",removes_edit_ui:"Removes ability to edit UI.",reverse_button_tip:"Reverses all buttons orientation.",reverse_button_title:"Reverse Buttons Orientation",reverse_tab_tip:"Places tabs on right side in reverse order.",reverse_tab_title:"Reverse Tab Direction",save_and_reload:"Save and reload",save_failed:"Save failed",shadow_tip:"Hide header shadows",shadow_title:"Shadows",show_tab_list:"Comma-separated list of tab numbers to show",split_mode_tip:"Split header into one header one footer",split_mode_title:"Split Mode",tabs_hide:"Hide Tabs",tabs_show:"Show Tabs",tabs:"Tabs",template:"Template",user_agent:"User Agent",user_list:"User (Seperate multiple users with a comma.)",voice_dropdown_tip:"Put voice button in options menu.",voice_dropdown_title:"Voice in Dropdown Menu",voice_hide_tip:"Hide the voice button.",voice_hide_title:"Hide Voice Button",warning_already_a_template:"Designates items that are already a template and won't be modified by the editor.",warning_disable_ch:"You can temporaily disable Custom-Header by adding '?disable_ch' to the end of your URL.",warning_edit_ui:"Marks items that remove your ability to edit the UI.",warning_jinja_info:"All text options accept Jinja. Hover over any item for more info.",warning_raw_editor_reload:"After using the 'Raw Config Editor' you need to reload the page to restore Custom Header."},U={common:z,links:H,editor:V},G={version:"Versjon"},B={docs:"Documentasjon",forums:"Forum"},W={add_exception:"Legg til unntak",automatic:"automatisk",buttons:"Brytere",cancel:"Avbryt",chevrons_tip:"Deaktiver pilene på tab båndet.",chevrons_title:"Vis tab piler",compact_mode_tip:"Gjør headeren compact.",compact_mode_title:"Kompakt modus",conditions:"Betingelser",config:"Konfigurasjon",current_user_agent:"Nåværende User Agent",current_user:"Pålogget bruker",default_tab:"Standard tab",disable_sidebar_tip:"Deaktiver side panelet og meny knappen.",disable_sidebar_title:"Deaktiver side panelet",disabled_mode_tip:"Deaktiver Custom-Header.",disabled_mode_title:"Deaktivert modus",disabled_template:"Deaktivert: Nåværende verdi er en mal.",editor_warnings_second_title:"Vis editor advarser of informasjon",editor_warnings_tip:"Veksle editor advarsler.",editor_warnings_title:"Vis denne informasjonen og advarsel seksjoner.",exceptions:"Unntak",footer_mode_tip:"Gjør header til footer eller reversert split modus.",footer_mode_title:"Footer modus",header_text:"Header tekst.",hidden_tab_redirect_tip:"Omadresser fra gjemt tab.",hidden_tab_redirect_title:"Gjemt tab omadresser",hide_configure_ui_tip:"Gjem 'Konfigurer brukergrensesnitt' in nedtrekksmenyen.",hide_configure_ui_title:"Gjem 'Konfigurer brukergrensesnitt'",hide_header_tip:"Gjem headderen, men tillat å dra inn fra siden for å åpne side panelet",hide_help_tip:"Deaktiver header",hide_help_title:"Gjem 'Hjelp'",hide_raw_editor_tip:"Gjem 'Tekstbasert konfigurasjonsredigering' in nedtrekksmenyen.",hide_raw_editor_title:"Gjem 'Tekstbasert konfigurasjonsredigering'",hide_tab_list:"Komma separert liste over tabber som skal gjemmes",hide_unused_tip:"Gjem 'Unused Entities' in nedtrekksmenyen.",hide_unused_title:"Gjem 'Unused Entities'",kiosk_mode_tip:"Gjem og deaktiver headeren og side panelet.",kiosk_mode_title:"Kiosk modus",locale_desc:"Locale for standard mal variabler (dato/tip).",menu_dropdown_tip:"Plasser meny i nedtrekksmenyen.",menu_dropdown_title:"Meny i nedtrekksmenyen",menu_hide_tip:"Gjem meny knappen.",menu_hide_title:"Gjem meny knappen",menu_items:"Meny elementer",options_hide_tip:"Gjem alternativer knappen.",options_hide_title:"Gjem alternativer knappen",removes_edit_ui:"Fjerner muligheten til å redigere brukergrensesnittet.",reverse_button_tip:"Reverser alle bryter orienteringer.",reverse_button_title:"Reverser bryter orientering",reverse_tab_tip:"Plasser tabber på høyre side i reversert rekkefølge.",reverse_tab_title:"Reverser tab rettning",save_and_reload:"Lagre og last inn på nytt",save_failed:"Lagring feilet",shadow_tip:"Gjemheader skygger",shadow_title:"Skygger",show_tab_list:"Komma separert liste over tabber som skal vises",split_mode_tip:"Split modus, både header og footer",split_mode_title:"Split modus",tabs_hide:"Gjem Tabber",tabs_show:"Vis Tabber",tabs:"Tabber",template:"mal",user_list:"Bruker (Skill flere brukere med komma.)",voice_dropdown_tip:"Plasser stemme i nedtrekksmenyen.",voice_dropdown_title:"Stemme i nedtrekksmenyen",voice_hide_tip:"Gjem stemme knappen.",voice_hide_title:"Gjem stemme knappen",warning_already_a_template:"Etter å ha brukt 'Tekstbasert konfigurasjonsredigering', må du laste inn siden på nytt for å gjenopprette Custom Header.",warning_disable_ch:"Du kan deaktivere Custom-Header midlertidig ved å legge til '?disable_ch' på slutten av nettadressen.",warning_edit_ui:"Markerer elementer som fjerner muligheten til å redigere brukergrensesnittet.",warning_jinja_info:"Alle tekstalternativer godtar Jinja. Hold musepekeren over et hvilket som helst element for mer informasjon.",warning_raw_editor_reload:"After using the 'Tekstbasert konfigurasjonsredigering' you need to reload the page to restore Custom Header."},Y={common:G,links:B,editor:W};const $={en:Object.freeze({__proto__:null,common:z,links:H,editor:V,default:U}),nb:Object.freeze({__proto__:null,common:G,links:B,editor:W,default:Y})};function localize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const r=e.split(".")[0],o=e.split(".")[1],i=(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_");let a;try{a=$[i][r][o]}catch(e){a=$.en[r][o]}return void 0===a&&(a=$.en[r][o]),""!==t&&""!==n&&(a=a.replace(t,n)),a}function _templateObject21(){const e=_taggedTemplateLiteral(['\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ']);return _templateObject21=function _templateObject21(){return e},e}function _templateObject20(){const e=_taggedTemplateLiteral([""]);return _templateObject20=function _templateObject20(){return e},e}function _templateObject19(){const e=_taggedTemplateLiteral(["\n \n "]);return _templateObject19=function _templateObject19(){return e},e}function _templateObject18(){const e=_taggedTemplateLiteral(["\n ",'\n \n \n \n \n \n \n
','
\n \n \n ','
\n \n \n \n \n ']);return _templateObject18=function _templateObject18(){return e},e}function _templateObject17(){const e=_taggedTemplateLiteral([""]);return _templateObject17=function _templateObject17(){return e},e}function _templateObject16(){const e=_taggedTemplateLiteral(["\n \n "]);return _templateObject16=function _templateObject16(){return e},e}function _templateObject15(){const e=_taggedTemplateLiteral(['\n Main Config
\n ']);return _templateObject15=function _templateObject15(){return e},e}function _templateObject14(){const e=_taggedTemplateLiteral(['\n
\n \n
\n ','\n
\n
\n ','\n
\n
\n
\n \n ','\n
','
\n
\n
\n
\n ',"\n
\n
\n "]);return _templateObject14=function _templateObject14(){return e},e}function _templateObject13(){const e=_taggedTemplateLiteral(['\n \n Custom Header\n
\n \n ","\n ","\n "]);return _templateObject13=function _templateObject13(){return e},e}function _templateObject12(){const e=_taggedTemplateLiteral(['\n \n \n \n ',"\n ","\n ",'\n \n ',"\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n ",'\n
\n
\n \n ','
\n \n ',"\n ","\n ","\n ",'\n
\n ','
\n \n ',"\n ","\n ","\n ","\n ","\n ",'\n
\n ','
\n \n \n ',"\n ",'\n \n \n \n "]);return _templateObject12=function _templateObject12(){return e},e}function _templateObject11(){const e=_taggedTemplateLiteral(['\n \n ']);return _templateObject10=function _templateObject10(){return e},e}function _templateObject9(){const e=_taggedTemplateLiteral(['\n \n ']);return _templateObject9=function _templateObject9(){return e},e}function _templateObject8(){const e=_taggedTemplateLiteral(["\n \n "]);return _templateObject8=function _templateObject8(){return e},e}function _templateObject7(){const e=_taggedTemplateLiteral(['\n ',"\n "]);return _templateObject7=function _templateObject7(){return e},e}function _templateObject6(){const e=_taggedTemplateLiteral(['\n ',"\n "]);return _templateObject6=function _templateObject6(){return e},e}function _templateObject5(){const e=_taggedTemplateLiteral(["\n ","\n "]);return _templateObject5=function _templateObject5(){return e},e}function _templateObject4(){const e=_taggedTemplateLiteral(["\n ","\n "]);return _templateObject4=function _templateObject4(){return e},e}function _templateObject3(){const e=_taggedTemplateLiteral(['\n \n \n ']);return _templateObject3=function _templateObject3(){return e},e}function _templateObject2(){const e=_taggedTemplateLiteral(['\n \n X\n
\n ','\n \n \n ',"
\n
\n ",'\n
\n ','\n ',"
\n
\n Name: ","
\n ID: ",'\n Device ID
\n
\n ','\n
\n ',"
\n
\n ",'\n
\n \n ',"\n ","\n
\n "]);return _templateObject2=function _templateObject2(){return e},e}function _templateObject(){const e=_taggedTemplateLiteral([""]);return _templateObject=function _templateObject(){return e},e}customElements.define("custom-header-editor",class CustomHeaderEditor extends LitElement{static get properties(){return{_config:{}}}firstUpdated(){this.defaultConfig=defaultConfig(),this._lovelace=F(),this.deepcopy=this.deepcopy.bind(this),this._config=this._lovelace.config.custom_header?this.deepcopy(this._lovelace.config.custom_header):{}}render(){return this._config&&this._lovelace?html(_templateObject2(),this._close,this.renderStyle(),this.defaultConfig,this._config,this._configChanged,localize("editor.exceptions"),this._config.exceptions?this._config.exceptions.map((e,t)=>html(_templateObject3(),this._config,e,t,this._exceptionChanged,this._exceptionDelete)):"",this._addException,localize("editor.add_exception"),localize("editor.current_user"),d.user.name,d.user.id,g,localize("editor.current_user_agent"),navigator.userAgent,this.exception?"":html(_templateObject4(),this._save_button),this.exception?"":html(_templateObject5(),this._cancel_button)):html(_templateObject())}_close(){const e=this.parentNode.parentNode.parentNode.querySelector("editor");this.parentNode.parentNode.parentNode.removeChild(e)}_save(){for(const e in this._config)this._config[e]==this.defaultConfig[e]&&delete this._config[e];const e=_objectSpread2({},this._lovelace.config,{},{custom_header:this._config});try{this._lovelace.saveConfig(e).then(()=>{window.location.href=window.location.href})}catch(e){alert("".concat(localize("editor.save_failed"),": ").concat(e))}}get _save_button(){const e=localize("editor.save_and_reload");return html(_templateObject6(),this._save,e)}get _cancel_button(){return html(_templateObject7(),this._close,localize("editor.cancel"))}_addException(){let e;this._config.exceptions?(e=this._config.exceptions.slice(0),e.push({conditions:{},config:{}})):e=[{conditions:{},config:{}}],this._config=_objectSpread2({},this._config,{exceptions:e}),A(this,"config-changed",{config:this._config})}_configChanged(e){let{detail:t}=e;this._config&&(this._config=_objectSpread2({},this._config,{},t.config),A(this,"config-changed",{config:this._config}))}_exceptionChanged(e){if(!this._config)return;const t=e.target.index,n=this._config.exceptions.slice(0);n[t]=e.detail.exception;for(const e of n)for(const t in e.config)this._config[t]==e.config[t]?delete e.config[t]:this._config[t]||this.defaultConfig[t]!=e.config[t]||delete e.config[t];this._config=_objectSpread2({},this._config,{exceptions:n}),A(this,"config-changed",{config:this._config})}_exceptionDelete(e){if(!this._config)return;const t=e.target,n=this._config.exceptions.slice(0);n.splice(t.index,1),this._config=_objectSpread2({},this._config,{exceptions:n}),A(this,"config-changed",{config:this._config}),this.requestUpdate()}deepcopy(e){if(!e||"object"!=typeof e)return e;if("[object Date]"==Object.prototype.toString.call(e))return new Date(e.getTime());if(Array.isArray(e))return e.map(this.deepcopy);const t={};return Object.keys(e).forEach(n=>{t[n]=this.deepcopy(e[n])}),t}renderStyle(){return html(_templateObject8())}});customElements.define("ch-config-editor",class ChConfigEditor extends LitElement{static get properties(){return{defaultConfig:{},config:{},exception:{},_closed:{}}}constructor(){super(),this.buttonOptions=["show","hide","clock","overflow"],this.overflowOptions=["show","hide","clock"],this.swipeAnimation=["none","swipe","fade","flip"]}get _clock(){return"clock"==this.getConfig("menu")||"clock"==this.getConfig("voice")||"clock"==this.getConfig("options")}getConfig(e){return void 0!==this.config[e]?this.config[e]:this.defaultConfig[e]}templateExists(e){return!("string"!=typeof e||!e.includes("{{")&&!e.includes("{%"))}haSwitch(e,t,n,r,o,i){const a=html(_templateObject9(),localize("editor.disabled_template")),s=html(_templateObject10(),localize("editor.removes_edit_ui"));return html(_templateObject11(),this.exception&&void 0===this.config[e]?"inherited slotted":"slotted",!1!==this.getConfig(e)&&!this.templateExists(this.getConfig(e)),e,this._valueChanged,o,this.templateExists(this.getConfig(e)),r,this.templateExists(this.getConfig(e))&&t?a:"",n?s:"")}render(){return this.exception=void 0!==this.exception&&!1!==this.exception,html(_templateObject12(),this.exception?"":html(_templateObject13(),localize("links.docs"),localize("links.forums"),this.getConfig("editor_warnings")?html(_templateObject14(),localize("editor.warning_disable_ch"),localize("editor.warning_raw_editor_reload"),localize("editor.warning_already_a_template"),localize("editor.warning_edit_ui"),localize("editor.warning_jinja_info")):"",!this.exception&&this.getConfig("editor_warnings")?this.haSwitch("editor_warnings",!1,!1,localize("editor.editor_warnings_title"),localize("editor.editor_warnings_tip")):""),this.renderStyle(),this.getConfig("editor_warnings")&&!this.exception?html(_templateObject15()):"",this.haSwitch("disabled_mode",!0,!1,localize("editor.disabled_mode_title"),localize("editor.disabled_mode_tip")),this.haSwitch("footer_mode",!0,!1,localize("editor.footer_mode_title"),localize("editor.footer_mode_tip")),this.haSwitch("compact_mode",!0,!1,localize("editor.compact_mode_title"),localize("editor.compact_mode_tip")),this.haSwitch("split_mode",!0,!1,localize("editor.split_mode_title"),localize("editor.split_mode_tip")),this.haSwitch("kiosk_mode",!0,!0,localize("editor.kiosk_mode_title"),localize("editor.kiosk_mode_tip")),this.haSwitch("disable_sidebar",!0,!1,localize("editor.disable_sidebar_title"),localize("editor.disable_sidebar_tip")),this.haSwitch("hide_header",!0,!1,localize("editor.hide_header_title"),localize("editor.hide_header_tip")),this.haSwitch("chevrons",!0,!1,localize("editor.chevrons_title"),localize("editor.chevrons_tip")),this.haSwitch("hidden_tab_redirect",!0,!1,localize("editor.hidden_tab_redirect_title"),localize("editor.hidden_tab_redirect_tip")),this.haSwitch("shadow",!0,!1,localize("editor.shadow_title"),localize("editor.shadow_tip")),this.exception||this.getConfig("editor_warnings")?"":this.haSwitch("editor_warnings",!1,!1,localize("editor.editor_warnings_second_title"),localize("editor.editor_warnings_tip")),this.exception&&void 0===this.config.header_text?"inherited slotted":"slotted",localize("editor.header_text"),this.getConfig("header_text"),"header_text",this._valueChanged,localize("editor.automatic"),this.exception&&void 0===this.config.locale?"inherited slotted":"slotted",localize("editor.locale_desc"),this.getConfig("locale"),"locale",this._valueChanged,localize("editor.menu_items"),this.haSwitch("hide_config",!0,!0,localize("editor.hide_configure_ui_title"),localize("editor.hide_configure_ui_tip")),this.haSwitch("hide_raw",!0,!0,localize("editor.hide_raw_editor_title"),localize("editor.hide_raw_editor_tip")),this.haSwitch("hide_help",!0,!1,localize("editor.hide_help_title"),localize("editor.hide_help_tip")),this.haSwitch("hide_unused",!0,!1,localize("editor.hide_unused_title"),localize("editor.hide_unused_tip")),localize("editor.buttons"),this.haSwitch("menu_hide",!0,!1,localize("editor.menu_hide_title"),localize("editor.menu_hide_tip")),this.haSwitch("menu_dropdown",!0,!1,localize("editor.menu_dropdown_title"),localize("editor.menu_dropdown_tip")),this.haSwitch("voice_hide",!0,!1,localize("editor.voice_hide_title"),localize("editor.voice_hide_tip")),this.haSwitch("voice_dropdown",!0,!1,localize("editor.voice_dropdown_title"),localize("editor.voice_dropdown_tip")),this.haSwitch("options_hide",!0,!0,localize("editor.options_hide_title"),localize("editor.options_hide_tip")),this.haSwitch("reverse_button_direction",!0,!1,localize("editor.reverse_button_title"),localize("editor.reverse_button_tip")),localize("editor.tabs"),this._tabVisibility,this.getConfig("show_tabs").length>0?"1":"0",localize("editor.tabs_hide"),localize("editor.tabs_show"),this.getConfig("show_tabs").length>0?"initial":"none",this.exception&&void 0===this.config.show_tabs?"inherited slotted":"slotted",localize("editor.show_tab_list"),this.getConfig("show_tabs"),"show_tabs",this._valueChanged,this.getConfig("show_tabs").length>0?"none":"initial",this.exception&&void 0===this.config.hide_tabs?"inherited slotted":"slotted",localize("editor.hide_tab_list"),this.getConfig("hide_tabs"),"hide_tabs",this._valueChanged,this.exception&&void 0===this.config.default_tab?"inherited slotted":"slotted",localize("editor.default_tab"),this.getConfig("default_tab"),"default_tab",this._valueChanged,this.haSwitch("reverse_tab_direction",!0,!1,localize("editor.reverse_tab_title"),localize("editor.reverse_tab_tip")))}_toggleCard(){this._closed=!this._closed,A(this,"iron-resize")}_tabVisibility(){const e=this.shadowRoot.querySelector("#show"),t=this.shadowRoot.querySelector("#hide");"Hide Tabs"==this.shadowRoot.querySelector("#tabs").value?(e.style.display="none",t.style.display="initial"):(t.style.display="none",e.style.display="initial")}_valueChanged(e){this.config&&(e.target.configValue&&(""===e.target.value?delete this.config[e.target.configValue]:this.config=_objectSpread2({},this.config,{[e.target.configValue]:void 0!==e.target.checked?e.target.checked:e.target.value})),A(this,"ch-config-changed",{config:this.config}))}renderStyle(){return html(_templateObject16())}});customElements.define("ch-exception-editor",class ChExceptionEditor extends LitElement{static get properties(){return{config:{},exception:{},_closed:{}}}constructor(){super(),this._closed=!0}render(){return this.exception?html(_templateObject18(),this.renderStyle(),this._closed,Object.values(this.exception.conditions).join(", ").substring(0,40)||"New Exception",this._closed?"mdi:chevron-down":"mdi:chevron-up",this._toggleCard,this._closed,this._deleteException,localize("editor.conditions"),this.exception.conditions,this._conditionsChanged,localize("editor.config"),_objectSpread2({},this.defaultConfig,{},this.config),this.exception.config,this._configChanged):html(_templateObject17())}renderStyle(){return html(_templateObject19())}_toggleCard(){this._closed=!this._closed,A(this,"iron-resize")}_deleteException(){A(this,"ch-exception-delete")}_conditionsChanged(e){let{detail:t}=e;if(!this.exception)return;const n=_objectSpread2({},this.exception,{conditions:t.conditions});A(this,"ch-exception-changed",{exception:n})}_configChanged(e){if(e.stopPropagation(),!this.exception)return;const t=_objectSpread2({},this.exception,{config:e.detail.config});A(this,"ch-exception-changed",{exception:t})}});customElements.define("ch-conditions-editor",class ChConditionsEditor extends LitElement{static get properties(){return{conditions:{}}}get _user(){return this.conditions.user||""}get _user_agent(){return this.conditions.user_agent||""}get _media_query(){return this.conditions.media_query||""}get _query_string(){return this.conditions.query_string||""}get _template(){return this.conditions.template||""}get _tab(){return this.conditions.tab||""}get _device_id(){return this.conditions.device_id||""}render(){return this.conditions?html(_templateObject21(),localize("editor.user_list"),this._user,"user",this._valueChanged,localize("editor.user_agent"),this._user_agent,"user_agent",this._valueChanged,localize("editor.media_query"),this._media_query,"media_query",this._valueChanged,localize("editor.query_string"),this._query_string,"query_string",this._valueChanged,localize("editor.template"),this._template,"template",this._valueChanged,localize("editor.tabs"),this._tab,"tab",this._valueChanged,this._device_id,"device_id",this._valueChanged):html(_templateObject20())}_valueChanged(e){if(!this.conditions)return;const t=e.target;this["_".concat(t.configValue)]!==t.value&&(t.configValue&&(""===t.value?delete this.conditions[t.configValue]:this.conditions=_objectSpread2({},this.conditions,{[t.configValue]:t.value})),A(this,"ch-conditions-changed",{conditions:this.conditions}))}});const hideMenuItems=(e,t,n)=>{const localized=(e,t)=>{let n;const r=document.querySelector("home-assistant").hass;return n="raw_editor"===t?r.localize("ui.panel.lovelace.editor.menu.raw_editor"):"unused_entities"==t?r.localize("ui.panel.lovelace.unused_entities.title"):r.localize("ui.panel.lovelace.menu.".concat(t)),e.innerHTML.includes(n)||e.getAttribute("aria-label")==n};(n?document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-panel-lovelace").shadowRoot.querySelector("hui-root").shadowRoot.querySelector("app-toolbar > paper-menu-button"):t.options).querySelector("paper-listbox").querySelectorAll("paper-item").forEach(t=>{e.hide_help&&localized(t,"help")||e.hide_unused&&localized(t,"unused_entities")||e.hide_refresh&&localized(t,"refresh")||e.hide_config&&localized(t,"configure_ui")||e.hide_raw&&localized(t,"raw_editor")?t.style.display="none":t.style.display=""})},buttonToOverflow=(e,t,n,r)=>{n.options.querySelector("#".concat(e.toLowerCase(),"_dropdown"))&&n.options.querySelector("#".concat(e.toLowerCase(),"_dropdown")).remove();const o=document.createElement("paper-item"),i=document.createElement("ha-icon");o.setAttribute("id","".concat(e.toLowerCase(),"_dropdown")),i.setAttribute("icon",r.button_icons[e.toLowerCase()]||t),i.style.pointerEvents="none",r.reverse_button_direction?i.style.marginLeft="auto":i.style.marginRight="auto",o.innerText=e,o.appendChild(i),o.addEventListener("click",()=>{n[e.toLowerCase()].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1}))}),i.addEventListener("click",()=>{n[e.toLowerCase()].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1}))}),n.options.querySelector("paper-listbox").appendChild(o)},insertSettings=()=>{function insertAfter(e,t){t.parentNode.insertBefore(e,t.nextSibling)}if("storage"===h.mode){const e=document.createElement("paper-item");e.setAttribute("id","ch_settings"),e.addEventListener("click",()=>(()=>{if(window.scrollTo(0,0),!p.querySelector("ha-app-layout editor")){const e=document.createElement("editor"),t=document.createElement("div");t.style.cssText="\n padding: 20px;\n max-width: 600px;\n margin: 15px auto;\n background: var(--paper-card-background-color);\n border: 6px solid var(--paper-card-background-color);\n ",e.style.cssText="\n width: 100%;\n min-height: 100%;\n box-sizing: border-box;\n position: absolute;\n background: var(--background-color, grey);\n z-index: 100;\n padding: 5px;\n ",p.querySelector("ha-app-layout").insertBefore(e,p.querySelector("#view")),e.appendChild(t),t.appendChild(document.createElement("custom-header-editor"))}})()),e.innerHTML="Custom Header";const t=_.options.querySelector("paper-listbox").querySelectorAll("paper-item"),n=f.options.querySelector("paper-listbox").querySelectorAll("paper-item");_.options.querySelector("paper-listbox").querySelector("#ch_settings")||insertAfter(e,t[t.length-1]),f.options.querySelector("paper-listbox").querySelector("#ch_settings")||insertAfter(e,n[n.length-1])}},kioskMode=(e,t,n)=>{if(window.location.href.includes("disable_ch"))return;let r=document.createElement("style");r.setAttribute("id","ch_header_style"),t||(r.innerHTML+="\n #drawer {\n display: none;\n }\n "),e||(r.innerHTML+="\n ch-header {\n display: none;\n }\n ch-header-bottom {\n display: none;\n }\n app-header {\n display: none;\n }\n hui-view {\n padding-top: 100px;\n }\n hui-view, hui-panel-view {\n min-height: calc(100vh + 96px);\n margin-top: -96px;\n }\n ");const o=p.querySelector("#ch_header_style");o&&o.innerText==r.innerHTML||(p.appendChild(r),o&&o.remove()),n.hide_tabs&&n.hide_tabs.forEach(e=>{r.innerHTML+="\n paper-tab:nth-child(".concat(tabIndexByName(e)+1,") {\n display: none;\n }\n ")}),t||(f.drawer.style.display="none",f.sidebar.main.shadowRoot.querySelector("#ch_sidebar_style")||(r=document.createElement("style"),r.setAttribute("id","ch_sidebar_style"),r.innerHTML=":host(:not([expanded])) {width: 0px !important;}",f.sidebar.main.shadowRoot.appendChild(r)),f.main.shadowRoot.querySelector("#ch_sidebar_style")||(r=document.createElement("style"),r.setAttribute("id","ch_sidebar_style"),r.innerHTML=":host {--app-drawer-width: 0px !important;}",f.main.shadowRoot.appendChild(r))),window.dispatchEvent(new Event("resize"))},removeKioskMode=()=>{f.drawer.style.display="";let e=f.main.shadowRoot.querySelector("#ch_sidebar_style");e&&e.remove(),e=f.sidebar.main.shadowRoot.querySelector("#ch_sidebar_style"),e&&e.remove(),f.drawer.style.display=""},insertStyleTags=e=>{let t=48;const n=e.split_mode?_.bottom:_;e.compact_mode||(e.reverse_button_direction?(_.container.querySelector("#contentContainer").dir="ltr",_.container.querySelector("#contentContainer").style.textAlign="right"):(_.container.querySelector("#contentContainer").style.textAlign="",_.container.querySelector("#contentContainer").dir=""),_.container.querySelector("#contentContainer").innerHTML=e.header_text,t=n.tabs.length?96:48);let r=document.createElement("style");r.setAttribute("id","ch_header_style"),r.innerHTML="\n ch-header {\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n display:flex;\n justify-content: center;\n font: 400 20px Roboto, sans-serif;\n background: ".concat(e.background||"var(--primary-color)",";\n color: ").concat(e.elements_color||"var(--text-primary-color)",";\n margin-bottom: 0px;\n margin-top: ").concat(e.footer_mode?"4px;":"0px",";\n position: sticky;\n position: -webkit-sticky;\n ").concat(e.footer_mode?"z-index: 99; bottom: 0px;":"top: 0px;","\n ").concat(e.header_css?e.header_css:"","\n transition: box-shadow 0.3s ease-in-out;\n ").concat(e.shadow&&(e.footer_mode||e.split_mode)?"box-shadow: 0px 0px 5px 5px rgba(0,0,0,0.2)":"","\n }\n ch-header-bottom {\n z-index: 99;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n display:flex;\n justify-content: center;\n font: 400 20px Roboto, sans-serif;\n background: ").concat(e.background||"var(--primary-color)",";\n color: ").concat(e.elements_color||"var(--text-primary-color)",";\n margin-bottom: 0px;\n margin-top: 0px;\n position: sticky;\n position: -webkit-sticky;\n ").concat(e.footer_mode?"top: 0px;":"bottom: 0px;","\n ").concat(e.header_css?e.header_css:"","\n ").concat(e.shadow?"box-shadow: 0px 0px 5px 5px rgba(0,0,0,0.2)":"","\n }\n ch-stack {\n flex-direction: column;\n width: 100%;\n margin-left: 9px;\n margin-right: 9px;\n ").concat(e.stack_css?e.stack_css:"","\n }\n ch-stack-bottom {\n flex-direction: column;\n width: 100%;\n margin-left: 9px;\n margin-right: 9px;\n ").concat(e.stack_css?e.stack_css:"","\n }\n #contentContainer {\n padding: 12px 6px 12px 6px;\n ").concat(e.compact_mode?"display: none;":"","\n ").concat(e.header_text.includes("
")?"\n font-size: 17px;\n line-height: 1.2;\n margin: -9px 0px 0px;\n ":"","\n ").concat(e.header_text_css?e.header_text_css:"","\n\n }\n app-header {\n display: none;\n }\n paper-tab.iron-selected {\n ").concat(e.active_tab_color?"color: ".concat(e.active_tab_color,";"):"","\n ").concat(e.active_tab_css?e.active_tab_css:"",'\n }\n [buttonElem="menu"] {\n ').concat(e.menu_color?"color: ".concat(e.menu_color,";"):"","\n ").concat(e.menu_hide?"display: none;":"","\n ").concat(e.menu_css?e.menu_css:"","\n ").concat(e.footer_mode&&e.compact_mode?"margin-top:0 !important;":"",'\n }\n [buttonElem="options"] {\n ').concat(e.options_color?"color: ".concat(e.options_color,";"):"","\n ").concat(e.options_hide?"display: none;":"","\n ").concat(e.options_css?e.options_css:"","\n ").concat(e.footer_mode&&e.compact_mode?"margin-top:0 !important;":"",'\n }\n [buttonElem="voice"] {\n ').concat(e.voice_color?"color: ".concat(e.voice_color,";"):"","\n ").concat(e.voice_hide?"display: none;":"","\n ").concat(e.voice_css?e.voice_css:"","\n ").concat(e.footer_mode&&e.compact_mode?"margin-top:0 !important;":"","\n }\n paper-tab {\n ").concat(e.all_tabs_color?"color: ".concat(e.all_tabs_color,";"):"","\n ").concat(e.all_tabs_css?e.all_tabs_css:"","\n }\n paper-tabs {\n ").concat(e.tab_indicator_color?"--paper-tabs-selection-bar-color: ".concat(e.tab_indicator_color," !important;"):"","\n ").concat(e.tab_container_css?e.tab_container_css:"","\n }\n "),e.tabs_color&&Object.keys(e.tabs_color).forEach(t=>{r.innerHTML+="\n paper-tab:nth-child(".concat(tabIndexByName(t)+1,") {\n color: ").concat(e.tabs_color[t],";\n }\n ")}),e.hide_tabs&&e.hide_tabs.forEach(e=>{r.innerHTML+="\n paper-tab:nth-child(".concat(tabIndexByName(e)+1,") {\n display: none;\n }\n ")}),e.tabs_css&&Object.keys(e.tabs_css).forEach(t=>{r.innerHTML+="\n paper-tab:nth-child(".concat(tabIndexByName(t)+1,") {\n ").concat(e.tabs_css[t],";\n }\n ")});let o=p.querySelector("#ch_header_style");p.appendChild(r),o&&o.remove(),r=document.createElement("style"),r.setAttribute("id","ch_view_style"),r.innerHTML="\n hui-view, hui-panel-view {\n margin-top: -96px;\n ".concat(e.compact_mode?"min-height: calc(100vh - 96px);":"min-height: calc(100vh - 112px);","\n ").concat(e.footer_mode&&!e.split_mode?"padding-bottom: ".concat(t,"px;"):"","\n ").concat(e.footer_mode&&!e.split_mode?"margin-bottom: -".concat(t+4,"px;"):"","\n ").concat(e.split_mode?"padding-bottom: 48px;":"","\n ").concat(e.split_mode&&e.footer_mode?"margin-bottom: -4px;":"","\n }\n hui-panel-view {\n padding-top: 96px;\n ").concat(e.panel_view_css?e.panel_view_css:"","\n ").concat(e.kiosk_mode||e.hide_header?"min-height: 100vh !important; margin-bottom: 0 !important;":"","\n }\n hui-view {\n padding-top: 100px;\n ").concat(e.view_css?e.view_css:"","\n }\n #view {\n min-height: calc(100vh - 96px) !important;\n ").concat(e.footer_mode&&!e.split_mode?"min-height: calc(100vh - ".concat(t,"px) !important;"):"","\n ").concat(e.compact_mode&&!e.footer_mode?"min-height: calc(100vh - ".concat(t,"px) !important;"):"","\n ").concat(e.split_mode?"min-height: calc(100vh - 48px) !important; margin-bottom: -48px;":"","\n ").concat(e.split_mode&&e.footer_mode?"min-height: calc(100vh - 52px) !important; margin-bottom: -48px;":"","\n ").concat(e.kiosk_mode||e.hide_header?"min-height: 100vh !important;":"","\n }\n "),o=p.querySelector("#ch_view_style"),o&&r.innerHTML==o.innerHTML||(p.appendChild(r),o&&o.remove()),r=document.createElement("style"),r.setAttribute("id","ch_chevron"),r.innerHTML='\n .not-visible[icon*="chevron"] {\n display:none;\n }\n ',o=n.tabContainer.shadowRoot.querySelector("#ch_chevron"),n.tabContainer.shadowRoot.appendChild(r),o&&o.remove(),o=_.bottom.querySelector("paper-tabs").shadowRoot.querySelector("#ch_chevron"),_.bottom.querySelector("paper-tabs").shadowRoot.appendChild(r.cloneNode(!0)),o&&o.remove(),r=document.createElement("style"),r.setAttribute("id","ch_animated"),r.innerHTML='\n ch-header, [buttonElem="menu"], [buttonElem="options"], [buttonElem="voice"] {\n transition: margin-top 0.4s ease-in-out;\n transition: top 0.4s ease-in-out;\n }\n ',setTimeout(()=>{p.querySelector("#ch_animated")||p.appendChild(r)},1e3)},redirects=(e,t)=>{const n=e.split_mode?t.bottom:t,r=f.sidebar.listbox.querySelector('[data-panel="lovelace"]');if(e.hide_tabs.includes(0)&&!e.default_tab){for(const e of n.tabs)if("none"!=getComputedStyle(e).display){r.setAttribute("href","/lovelace/".concat(n.tabContainer.indexOf(e)));break}}else e.default_tab&&r.setAttribute("href","/lovelace/".concat(tabIndexByName(e.default_tab)));const o=null!=e.default_tab?tabIndexByName(e.default_tab):null;if(e.hidden_tab_redirect&&f.tabs.length){const t=f.tabContainer.indexOf(f.tabContainer.querySelector("paper-tab.iron-selected"));if(e.hide_tabs.includes(t)&&e.hide_tabs.length!=f.tabs.length)if(o&&!e.hide_tabs.includes(tabIndexByName(o)))"none"!=getComputedStyle(n.tabs[o]).display&&(f.tabs[o].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1})),r.setAttribute("href","/lovelace/".concat(o)));else for(const e of n.tabs)if("none"!=getComputedStyle(e).display){e.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1})),r.setAttribute("href","/lovelace/".concat(n.tabContainer.indexOf(e)));break}}let i;i=!e.default_tab_on_refresh&&window.performance?0==performance.navigation.type:!(e.default_tab_on_refresh||!performance.getEntriesByType("navigation"))&&"reload"==performance.getEntriesByType("navigation")[0].type,i||null==o||window.customHeaderDefaultClicked||!f.tabs[o]||(f.tabs[o].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1})),window.customHeaderDefaultClicked=!0)},styleHeader=e=>{if(insertSettings(),window.location.href.includes("disable_ch")&&(e.disabled_mode=!0),e.disabled_mode)return window.customHeaderDisabled=!0,removeKioskMode(),_.container&&(_.container.style.visibility="hidden"),p.querySelector("#ch_header_style")&&p.querySelector("#ch_header_style").remove(),p.querySelector("#ch_view_style")&&p.querySelector("#ch_view_style").remove(),_.tabContainer.shadowRoot.querySelector("#ch_chevron")&&(_.tabContainer.shadowRoot.querySelector("#ch_chevron").remove(),_.bottom.tabContainer.shadowRoot.querySelector("#ch_chevron").remove()),_.menu.style.display="none",p.querySelector("ha-menu-button").style.display="",f.sidebar.main.shadowRoot.querySelector(".menu").style="",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="",f.sidebar.main.shadowRoot.querySelector("div.divider").style="",void window.dispatchEvent(new Event("resize"));window.customHeaderDisabled=!1,hideMenuItems(e,_,!1),_.menu.style.display="",_.container&&(_.container.style.visibility="visible"),insertSettings(),p.querySelector("ch-header-bottom").querySelector("paper-tabs")||(_.bottom.appendChild(_.tabContainer.cloneNode(!0)),_.bottom.tabContainer=p.querySelector("ch-header-bottom").querySelector("paper-tabs"),_.bottom.tabs=_.bottom.tabContainer.querySelectorAll("paper-tab")),f.tabs.forEach(e=>{const t=f.tabs.indexOf(e);_.bottom.tabs[t].addEventListener("click",()=>{f.tabs[t].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1}))})}),e.split_mode?(_.tabContainer.style.display="none",e.compact_mode=!1,e.footer_mode?_.bottom.setAttribute("slot","header"):_.bottom.setAttribute("slot","")):_.bottom.style.display="none";const t=e.split_mode?_.bottom:_;e.split_mode||(_.bottom.style.display="none"),_.tabs.length||(e.compact_mode=!1),e.menu_dropdown&&!e.disable_sidebar?buttonToOverflow("Menu","mdi:menu",_,e):_.options.querySelector("#menu_dropdown")&&_.options.querySelector("#menu_dropdown").remove(),e.voice_dropdown?buttonToOverflow("Voice","mdi:microphone",_,e):_.options.querySelector("#voice_dropdown")&&_.options.querySelector("#voice_dropdown").remove(),e.reverse_button_direction?(_.options.setAttribute("horizontal-align","left"),_.options.querySelector("paper-listbox").setAttribute("dir","ltr")):(_.options.setAttribute("horizontal-align","right"),_.options.querySelector("paper-listbox").setAttribute("dir","rtl"));const n=document.createElement("style");if(n.setAttribute("id","ch_header_style"),n.innerHTML="\n .menu, paper-listbox {\n transition: height 0.1s ease-in-out 0s;\n }\n .divider {\n transition: margin-bottom 0.1s ease-in-out 0s;\n }\n ",f.sidebar.main.shadowRoot.appendChild(n),e.kiosk_mode&&!e.disabled_mode?(insertStyleTags(e),kioskMode(!1,!1,e)):e.disable_sidebar?(kioskMode(!0,!1,e),insertStyleTags(e)):e.hide_header?(insertStyleTags(e),kioskMode(!1,!0,e)):e.disable_sidebar||e.kiosk_mode||e.hide_header||(removeKioskMode(),e.compact_mode&&!e.footer_mode?(f.sidebar.main.shadowRoot.querySelector(".menu").style="height:49px;",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height:calc(100% - 175px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style=""):e.footer_mode&&!e.split_mode?(f.sidebar.main.shadowRoot.querySelector(".menu").style="",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height: calc(100% - 170px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style="margin-bottom: -10px;"):e.split_mode?(f.sidebar.main.shadowRoot.querySelector(".menu").style="height:49px;",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height: calc(100% - 170px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style="margin-bottom: -3px;"):(f.sidebar.main.shadowRoot.querySelector(".menu").style="",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="",f.sidebar.main.shadowRoot.querySelector("div.divider").style=""),insertStyleTags(e)),e.chevrons?t.tabContainer.hideScrollButtons=!1:t.tabContainer.hideScrollButtons=!0,e.indicator_top?t.tabContainer.alignBottom=!0:t.tabContainer.alignBottom=!1,e.footer_mode?_.options.setAttribute("vertical-align","bottom"):_.options.removeAttribute("vertical-align"),e.footer_mode?_.container.removeAttribute("slot"):_.container.setAttribute("slot","header"),t.tabContainer.dir=e.reverse_tab_direction?"rtl":"ltr",_.container.dir=e.reverse_button_direction?"rtl":"ltr",e.tab_icons&&t.tabs.length)for(const n in e.tab_icons){const r=tabIndexByName(n),o=t.tabs[r].querySelector("ha-icon");e.tab_icons[n]?o.icon=e.tab_icons[n]:o.icon=h.config.views[r].icon}if(e.button_icons)for(const t in e.button_icons)_[t]&&(e.button_icons[t]?"options"===t?_[t].querySelector("paper-icon-button").icon=e.button_icons[t]:_[t].icon=e.button_icons[t]:"menu"===t?_.menu.icon="mdi:menu":"voice"===t&&_.voice?_.voice.icon="mdi:microphone":"options"===t&&(_[t].querySelector("paper-icon-button").icon="mdi:dots-vertical"));if(e.button_text)for(const t in e.button_text){const n=document.createElement("p");n.className="buttonText";const r="options"===t?_[t].querySelector("paper-icon-button"):_[t];e.button_text[t]||!r.shadowRoot.querySelector(".buttonText")?e.button_text[t]&&(r.shadowRoot.querySelector(".buttonText")?r.shadowRoot.querySelector(".buttonText").innerHTML=e.button_text[t]:(n.innerHTML=e.button_text[t],r.shadowRoot.appendChild(n)),r.shadowRoot.querySelector(".buttonText").dir="ltr",r.shadowRoot.querySelector(".buttonText").style.textAlign="menu"==t?e.reverse_button_direction?"right":"left":e.reverse_button_direction?"left":"right",r.shadowRoot.querySelector("iron-icon").style.display="none",r.style.width="auto",e.button_text[t].includes("
")?(r.shadowRoot.querySelector(".buttonText").style.fontSize="17px",r.shadowRoot.querySelector(".buttonText").style.lineHeight="1.2",r.shadowRoot.querySelector(".buttonText").style.margin="-5px 0px 0px 0px"):r.shadowRoot.querySelector(".buttonText").style.margin="5.5px 0px 0px 0px"):(r.shadowRoot.querySelector(".buttonText").remove(),r.shadowRoot.querySelector("iron-icon").style.display="",r.style.width="")}t.tabs.length||(t.tabContainer.style.display="none"),((e,t)=>{if(e.menu_hide)return;const buildDot=()=>{const t=document.createElement("div");return t.className="dot",t.style.cssText="\n pointer-events: none;\n position: relative;\n background-color: ".concat(e.notification_dot_color,";\n width: 12px;\n height: 12px;\n top: -28px;\n right: ").concat(e.reverse_button_direction?"":"-","16px;\n border-radius: 50%;\n "),t},menuButtonVisibility=()=>{e.disable_sidebar||window.customHeaderDisabled||("hidden"===f.menu.style.visibility?t.menu.style.display="none":t.menu.style.display="initial")},notificationDot=e=>{const t=document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-panel-lovelace").shadowRoot.querySelector("hui-root");e.forEach(e=>{let{addedNodes:n,removedNodes:r}=e;if(n)for(const e of n)"dot"!==e.className||t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".dot")||(t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.appendChild(buildDot()),t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".buttonText")&&(t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".dot").style.display="none",t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".buttonText").style.borderBottom="3px solid ".concat(window.customHeaderConfig.notification_dot_color)));if(r)for(const e of r)"dot"===e.className&&t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".dot")&&(t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".dot").remove(),t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".buttonText")&&(t.shadowRoot.querySelector('[buttonElem="menu"]').shadowRoot.querySelector(".buttonText").style.borderBottom=""))})};if(!window.customHeaderMenuObserver){window.customHeaderMenuObserver=!0,new MutationObserver(notificationDot).observe(f.menu.shadowRoot,{childList:!0}),new MutationObserver(menuButtonVisibility).observe(f.menu,{attributes:!0,attributeFilter:["style"]})}menuButtonVisibility();const n=t.menu.shadowRoot.querySelector(".dot");n&&n.style.cssText!=buildDot().style.cssText&&(n.remove(),e.button_text.menu&&(t.menu.shadowRoot.querySelector(".buttonText").style.textDecoration="")),!t.menu.shadowRoot.querySelector(".dot")&&f.menu.shadowRoot.querySelector(".dot")&&(t.menu.shadowRoot.appendChild(buildDot()),e.button_text.menu&&(t.menu.shadowRoot.querySelector(".dot").style.display="none",t.menu.shadowRoot.querySelector(".buttonText").style.borderBottom="3px solid ".concat(e.notification_dot_color)))})(e,_),window.customHeaderShrink||e.split_mode||(window.customHeaderShrink=!0,window.addEventListener("scroll",(function(e){const t="none"===window.getComputedStyle(_.container.querySelector("#contentContainer")).getPropertyValue("display");"0px"===window.getComputedStyle(_.container).getPropertyValue("bottom")||t||(window.scrollY>48?(_.container.style.top="-48px",_.menu.style.marginTop="48px",_.voice&&(_.voice.style.marginTop="48px"),_.options.style.marginTop="48px"):(_.container.style.transition="0s",_.menu.style.transition="0s",_.voice&&(_.voice.style.transition="0s"),_.options.style.transition="0s",_.container.style.top="-".concat(window.scrollY,"px"),_.menu.style.marginTop="".concat(window.scrollY,"px"),_.voice&&(_.voice.style.marginTop="".concat(window.scrollY,"px")),_.options.style.marginTop="".concat(window.scrollY,"px")),_.container.style.transition="")})));const shadowScroll=()=>{window.scrollY>15?_.container.style.boxShadow="0px 0px 5px 5px rgba(0,0,0,0.2)":_.container.style.boxShadow="0px 0px 5px 5px rgba(0,0,0,0)"};window.customHeaderShadow||e.footer_mode||e.split_mode||!e.shadow?window.removeEventListener("scroll",shadowScroll):(window.customHeaderShadow=!0,window.addEventListener("scroll",shadowScroll)),A(_.container,"iron-resize"),redirects(e,_)},observers=()=>{const e=new MutationObserver(e=>{const t=window.customHeaderConfig,n=t.split_mode?_.bottom:_;e.forEach(r=>{let{addedNodes:o,target:i}=r;e.length&&"HTML"==e[0].target.nodeName&&(window.customHeaderExceptionConfig="init",buildConfig(),e=[]),"view"==i.id&&o.length&&n.tabs.length?(redirects(t,_),(e=>{const t=e.split_mode?_.bottom:_,n=F();n&&(f.tabContainer||t.tabContainer)&&(t.tabs[n.current_view].dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!1})),A(_.container,"iron-resize"))})(t),window.customHeaderTabCond&&buildConfig()):o.length&&"PARTIAL-PANEL-RESOLVER"==i.nodeName?(f.main.shadowRoot.querySelector(" ha-panel-lovelace")?t.compact_mode&&!t.footer_mode?(f.sidebar.main.shadowRoot.querySelector(".menu").style="height:49px;",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height:calc(100% - 175px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style=""):t.footer_mode&&!t.split_mode?(f.sidebar.main.shadowRoot.querySelector(".menu").style="",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height: calc(100% - 170px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style="margin-bottom: -10px;"):t.split_mode&&(f.sidebar.main.shadowRoot.querySelector(".menu").style="height:49px;",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="height: calc(100% - 170px);",f.sidebar.main.shadowRoot.querySelector("div.divider").style="margin-bottom: -3px;"):(f.sidebar.main.shadowRoot.querySelector(".menu").style="",f.sidebar.main.shadowRoot.querySelector("paper-listbox").style="",f.sidebar.main.shadowRoot.querySelector("div.divider").style=""),p.querySelector("editor")&&p.querySelector("editor").remove()):"edit-mode"===i.className&&o.length?(p.querySelector("editor")&&p.querySelector("editor").remove(),window.customHeaderDisabled||hideMenuItems(t,_,!0),_.menu.style.display="none",p.querySelector("ch-header").style.display="none",f.appHeader.style.display="block",p.querySelector("#ch_view_style")&&p.querySelector("#ch_view_style").remove(),p.querySelector("#ch_header_style")&&p.querySelector("#ch_header_style").remove(),p.querySelector("#ch_animated")&&p.querySelector("#ch_animated").remove()):"APP-HEADER"===i.nodeName&&o.length&&(insertStyleTags(t),f.menu=f.appHeader.querySelector("ha-menu-button"),f.appHeader.style.display="none",_.menu.style.display="",p.querySelector("ch-header").style.display="")})});e.observe(f.partialPanelResolver,{childList:!0}),e.observe(f.appHeader,{childList:!0}),e.observe(p.querySelector("#view"),{childList:!0}),e.observe(document.querySelector("html"),{attributes:!0})};window.customHeaderExceptionConfig="init";const buildConfig=e=>{const t=defaultConfig();e||(e=_objectSpread2({},t,{},h.config.custom_header));const n=_objectSpread2({},e,{},conditionalConfig(e)),r=e.template_variables;delete e.template_variables;const o="boolean"==typeof n.disabled_mode&&n.disabled_mode||"string"==typeof n.disabled_mode&&!n.disabled_mode.includes("{{")&&!n.disabled_mode.includes("{%")||window.location.href.includes("disable_ch"),processAndContinue=()=>{(e=_objectSpread2({},e,{},conditionalConfig(e))).hide_tabs&&(e.hide_tabs=processTabArray(e.hide_tabs)),e.show_tabs&&(e.show_tabs=processTabArray(e.show_tabs)),e.show_tabs&&e.show_tabs.length&&(e.hide_tabs=(e=>{if(e&&e.length){const t=[];for(let e=0;e!e.includes(t))}})(e.show_tabs)),(e.disable_sidebar||e.menu_dropdown)&&(e.menu_hide=!0),e.voice_dropdown&&(e.voice_hide=!0),null!=e.header_text&&""==e.header_text&&(e.header_text=t.header_text),e.header_text&&" "==e.header_text&&(e.header_text=" "),e.hide_header&&e.disable_sidebar&&(e.kiosk_mode=!0,e.hide_header=!1,e.disable_sidebar=!1),null!=e.test_template&&(o?console.log("Custom Header cannot render templates while disabled."):"string"==typeof e.test_template&&(e.test_template.toLowerCase().includes("true")||e.test_template.toLowerCase().includes("false"))?(console.log('Custom Header test returned: "'.concat(e.test_template,'"')),console.log("Warning: Boolean is returned as string instead of Boolean.")):"string"==typeof e.test_template?console.log('Custom Header test returned: "'.concat(e.test_template,'"')):console.log("Custom Header test returned: ".concat(e.test_template))),window.customHeaderConfig=e,styleHeader(e),window.customHeaderObservers||(observers(),window.customHeaderObservers=!0)},i=JSON.stringify(e),a=!!r||i.includes("{{")||i.includes("{%");let s,c=!1;a&&!o?("function"==typeof window.unsub&&(window.unsub(),window.unsub=null),s=subscribeRenderTemplate(t=>{if(window.customHeaderLastTemplateResult!=t||window.customHeaderLastExceptionConfig!=window.customHeaderExceptionConfig){window.customHeaderLastExceptionConfig=window.customHeaderExceptionConfig,window.customHeaderLastTemplateResult=t;try{e=JSON.parse(t.replace(/"true"/gi,"true").replace(/"false"/gi,"false").replace(/""/,""))}catch(e){c=!0;let n="[CUSTOM-HEADER] There was an issue with the template: ".concat(((e,t)=>{const n=t.toString().match(/\d+/g)[0],r=e.substr(0,n).match(/[^,]*$/),o=e.substr(n).match(/^[^,]*/);return"".concat(r?r[0]:"").concat(o?o[0]:"").replace('":"',': "')})(t,e));n.includes("locale")&&(n='[CUSTOM-HEADER] There was an issue one of your "template_variables".'),console.log(n)}processAndContinue()}},{template:JSON.stringify(r).replace(/\\/g,"")+JSON.stringify(e).replace(/\\/g,"")},e.locale),function _asyncToGenerator(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function _next(e){asyncGeneratorStep(i,r,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(i,r,o,_next,_throw,"throw",e)}_next(void 0)}))}}((function*(){try{window.unsub=yield s}catch(e){c=!0,console.log("[CUSTOM-HEADER] There was an error with one or more of your templates:"),console.log("".concat(e.message.substring(0,e.message.indexOf(")")),")"))}}))(),clearTimeout(window.customHeaderTempTimeout),window.customHeaderTempTimeout=window.setTimeout(()=>{const e=document.querySelector("home-assistant").shadowRoot.querySelector("home-assistant-main").shadowRoot.querySelector("ha-panel-lovelace");(e?e.shadowRoot.querySelector("hui-editor"):null)||c||p.querySelector("custom-header-editor")||buildConfig()},1e3*(60-(new Date).getSeconds()))):processAndContinue()};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var J=createCommonjsModule((function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)})),K={}.hasOwnProperty,_has=function(e,t){return K.call(e,t)},_fails=function(e){try{return!!e()}catch(e){return!0}},Z=!_fails((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),X=createCommonjsModule((function(e){var t=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=t)})),Q=(X.version,function(e){return"object"==typeof e?null!==e:"function"==typeof e}),_anObject=function(e){if(!Q(e))throw TypeError(e+" is not an object!");return e},ee=J.document,te=Q(ee)&&Q(ee.createElement),_domCreate=function(e){return te?ee.createElement(e):{}},ne=!Z&&!_fails((function(){return 7!=Object.defineProperty(_domCreate("div"),"a",{get:function(){return 7}}).a})),_toPrimitive=function(e,t){if(!Q(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!Q(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!Q(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!Q(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},re=Object.defineProperty,oe={f:Z?Object.defineProperty:function defineProperty(e,t,n){if(_anObject(e),t=_toPrimitive(t,!0),_anObject(n),ne)try{return re(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},_propertyDesc=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ie=Z?function(e,t,n){return oe.f(e,t,_propertyDesc(1,n))}:function(e,t,n){return e[t]=n,e},ae=0,se=Math.random(),_uid=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++ae+se).toString(36))},ce=createCommonjsModule((function(e){var t=J["__core-js_shared__"]||(J["__core-js_shared__"]={});(e.exports=function(e,n){return t[e]||(t[e]=void 0!==n?n:{})})("versions",[]).push({version:X.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),le=ce("native-function-to-string",Function.toString),ue=createCommonjsModule((function(e){var t=_uid("src"),n=(""+le).split("toString");X.inspectSource=function(e){return le.call(e)},(e.exports=function(e,r,o,i){var a="function"==typeof o;a&&(_has(o,"name")||ie(o,"name",r)),e[r]!==o&&(a&&(_has(o,t)||ie(o,t,e[r]?""+e[r]:n.join(String(r)))),e===J?e[r]=o:i?e[r]?e[r]=o:ie(e,r,o):(delete e[r],ie(e,r,o)))})(Function.prototype,"toString",(function toString(){return"function"==typeof this&&this[t]||le.call(this)}))})),_aFunction=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},_ctx=function(e,t,n){if(_aFunction(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}},$export=function(e,t,n){var r,o,i,a,s=e&$export.F,c=e&$export.G,l=e&$export.S,u=e&$export.P,d=e&$export.B,h=c?J:l?J[t]||(J[t]={}):(J[t]||{}).prototype,p=c?X:X[t]||(X[t]={}),f=p.prototype||(p.prototype={});for(r in c&&(n=t),n)i=((o=!s&&h&&void 0!==h[r])?h:n)[r],a=d&&o?_ctx(i,J):u&&"function"==typeof i?_ctx(Function.call,i):i,h&&ue(h,r,i,e&$export.U),p[r]!=i&&ie(p,r,a),u&&f[r]!=i&&(f[r]=i)};J.core=X,$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128;var de=$export,he=createCommonjsModule((function(e){var t=_uid("meta"),n=oe.f,r=0,o=Object.isExtensible||function(){return!0},i=!_fails((function(){return o(Object.preventExtensions({}))})),setMeta=function(e){n(e,t,{value:{i:"O"+ ++r,w:{}}})},a=e.exports={KEY:t,NEED:!1,fastKey:function(e,n){if(!Q(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!_has(e,t)){if(!o(e))return"F";if(!n)return"E";setMeta(e)}return e[t].i},getWeak:function(e,n){if(!_has(e,t)){if(!o(e))return!0;if(!n)return!1;setMeta(e)}return e[t].w},onFreeze:function(e){return i&&a.NEED&&o(e)&&!_has(e,t)&&setMeta(e),e}}})),pe=(he.KEY,he.NEED,he.fastKey,he.getWeak,he.onFreeze,createCommonjsModule((function(e){var t=ce("wks"),n=J.Symbol,r="function"==typeof n;(e.exports=function(e){return t[e]||(t[e]=r&&n[e]||(r?n:_uid)("Symbol."+e))}).store=t}))),fe=oe.f,me=pe("toStringTag"),_setToStringTag=function(e,t,n){e&&!_has(e=n?e:e.prototype,me)&&fe(e,me,{configurable:!0,value:t})},ge={f:pe},_e=oe.f,_wksDefine=function(e){var t=X.Symbol||(X.Symbol=J.Symbol||{});"_"==e.charAt(0)||e in t||_e(t,e,{value:ge.f(e)})},ye={}.toString,_cof=function(e){return ye.call(e).slice(8,-1)},ve=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==_cof(e)?e.split(""):Object(e)},_defined=function(e){if(null==e)throw TypeError("Can't call method on "+e);return e},_toIobject=function(e){return ve(_defined(e))},be=Math.ceil,we=Math.floor,_toInteger=function(e){return isNaN(e=+e)?0:(e>0?we:be)(e)},Se=Math.min,_toLength=function(e){return e>0?Se(_toInteger(e),9007199254740991):0},xe=Math.max,Ee=Math.min,_toAbsoluteIndex=function(e,t){return(e=_toInteger(e))<0?xe(e+t,0):Ee(e,t)},_arrayIncludes=function(e){return function(t,n,r){var o,i=_toIobject(t),a=_toLength(i.length),s=_toAbsoluteIndex(r,a);if(e&&n!=n){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}},Oe=ce("keys"),_sharedKey=function(e){return Oe[e]||(Oe[e]=_uid(e))},ke=_arrayIncludes(!1),Ce=_sharedKey("IE_PROTO"),_objectKeysInternal=function(e,t){var n,r=_toIobject(e),o=0,i=[];for(n in r)n!=Ce&&_has(r,n)&&i.push(n);for(;t.length>o;)_has(r,n=t[o++])&&(~ke(i,n)||i.push(n));return i},je="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Pe=Object.keys||function keys(e){return _objectKeysInternal(e,je)},Me={f:Object.getOwnPropertySymbols},Ae={f:{}.propertyIsEnumerable},Te=Array.isArray||function isArray(e){return"Array"==_cof(e)},_toObject=function(e){return Object(_defined(e))},Re=Z?Object.defineProperties:function defineProperties(e,t){_anObject(e);for(var n,r=Pe(t),o=r.length,i=0;o>i;)oe.f(e,n=r[i++],t[n]);return e},Ne=J.document,qe=Ne&&Ne.documentElement,Ie=_sharedKey("IE_PROTO"),Empty=function(){},createDict=function(){var e,t=_domCreate("iframe"),n=je.length;for(t.style.display="none",qe.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("