2 lines
125 KiB
JavaScript
2 lines
125 KiB
JavaScript
!function(){"use strict";var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)};function t(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function c(e){try{s(o.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((o=o.apply(e,t||[])).next())}))}function n(e,t){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&c[0]?o.return:c[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,c[1])).done)return r;switch(o=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,o=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(r=i.trys,(r=r.length>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]<r[3])){i.label=c[1];break}if(6===c[0]&&i.label<r[1]){i.label=r[1],r=c;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(c);break}r[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],o=0}finally{n=r=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}function o(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var r=function(e,t,n){var o;void 0===n&&(n={});var r=n.retries,i=void 0===r?10:r,a=n.delay,c=void 0===a?10:a,s=n.shouldReject,l=void 0===s||s,u=null!==(o=n.rejectMessage)&&void 0!==o?o:"Could not get the result after {{ retries }} retries";return new Promise((function(n,o){var r=0,a=function(){var s=e();t(s)?n(s):++r<i?setTimeout(a,c):l?o(new Error(u.replace(/\{\{\s*retries\s*\}\}/g,"".concat(i)))):n(s)};a()}))},i=function(){return i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)};function a(e,t,n,o){return new(n||(n=Promise))((function(t,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var o;e.done?t(e.value):(o=e.value,o instanceof n?o:new n((function(e){e(o)}))).then(i,a)}c((o=o.apply(e,[])).next())}))}function c(e,t){var n,o,r,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,o&&(r=2&c[0]?o.return:c[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,c[1])).done)return r;switch(o=0,r&&(c=[2&c[0],r.value]),c[0]){case 0:case 1:r=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,o=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!((r=(r=i.trys).length>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]<r[3])){i.label=c[1];break}if(6===c[0]&&i.label<r[1]){i.label=r[1],r=c;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(c);break}r[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],o=0}finally{n=r=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}}"function"==typeof SuppressedError&&SuppressedError;var s="$",l=":host",u="invalid selector",d=10,f=10,_=function(e){var t,n=e[0],o=e[1];return(t=n)&&(t instanceof Document||t instanceof Element||t instanceof ShadowRoot)&&"string"==typeof o};function p(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(s).map((function(e){return e.trim()}))}(e);return t(n)}))}function h(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(s,").").concat(n)}function E(e){return e instanceof Promise?e:Promise.resolve(e)}function O(){return"You can not select a shadowRoot (".concat(s,") of the document.")}function m(){return"You can not select a shadowRoot (".concat(s,") of a shadowRoot.")}function v(e,t){for(var n,o,r=null,i=e.length,a=0;a<i;a++){if(0===a)if(e[a].length)r=t.querySelector(e[a]);else{if(t instanceof Document)throw new SyntaxError(O());if(t instanceof ShadowRoot)throw new SyntaxError(m());r=(null===(n=t.shadowRoot)||void 0===n?void 0:n.querySelector(e[++a]))||null}else r=(null===(o=r.shadowRoot)||void 0===o?void 0:o.querySelector("".concat(l," ").concat(e[a])))||null;if(null===r)return null}return r}function A(e,t){var n,o=function(e,t,n){for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return[].concat(o||Array.prototype.slice.call(t))}(0,e),r=o.pop();if(!o.length)return t.querySelectorAll(r);var i=v(o,t);return(null===(n=null==i?void 0:i.shadowRoot)||void 0===n?void 0:n.querySelectorAll("".concat(l," ").concat(r)))||null}function T(e,t){if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(O());if(t instanceof ShadowRoot)throw new SyntaxError(m());return t.shadowRoot}var n=v(e,t);return(null==n?void 0:n.shadowRoot)||null}function b(e,t,n,o){return a(this,0,void 0,(function(){return c(this,(function(i){return[2,r((function(){return function(e,t,n,o){for(var r=p(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(h(n,o));return e})),i=r.length,a=0;a<i;a++){var c=v(r[a],t);if(c)return c}return null}(e,t,"asyncQuerySelector","asyncShadowRootQuerySelector")}),(function(e){return!!e}),{retries:n,delay:o,shouldReject:!1})]}))}))}function g(e,t,n,o){return a(this,0,void 0,(function(){return c(this,(function(i){return[2,r((function(){return function(e,t,n){for(var o=p(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(h(n));return e})),r=o.length,i=0;i<r;i++){var a=A(o[i],t);if(null==a?void 0:a.length)return a}return document.querySelectorAll(u)}(e,t,"asyncQuerySelectorAll")}),(function(e){return!!e.length}),{retries:n,delay:o,shouldReject:!1})]}))}))}function I(e,t,n,o){return a(this,0,void 0,(function(){return c(this,(function(i){return[2,r((function(){return function(e,t,n,o){for(var r=p(e,(function(e){if(e.pop().length)throw new SyntaxError(function(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(s,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}(n,o));return e})),i=r.length,a=0;a<i;a++){var c=T(r[a],t);if(c)return c}return null}(e,t,"asyncShadowRootQuerySelector","asyncQuerySelector")}),(function(e){return!!e}),{retries:n,delay:o,shouldReject:!1})]}))}))}var y=function(e,t){var n=e.querySelectorAll(t);if(n.length)return n;if(e instanceof Element&&e.shadowRoot){var o=y(e.shadowRoot,t);if(o.length)return o}for(var r=0,i=Array.from(e.querySelectorAll("*"));r<i.length;r++){var a=i[r],c=y(a,t);if(c.length)return c}return document.querySelectorAll(u)},R=function(e,t,n,o){return r((function(){return y(e,t)}),(function(e){return!!e.length}),{retries:n,delay:o,shouldReject:!1})};function S(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a(this,0,void 0,(function(){var t,n,o,r,i;return c(this,(function(a){switch(a.label){case 0:return _(e)?(t=e[0],n=e[1],o=e[2],[4,b(n,t,(null==o?void 0:o.retries)||d,(null==o?void 0:o.delay)||f)]):[3,2];case 1:case 3:return[2,a.sent()];case 2:return r=e[0],i=e[1],[4,b(r,document,(null==i?void 0:i.retries)||d,(null==i?void 0:i.delay)||f)]}}))}))}function C(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a(this,0,void 0,(function(){var t,n,o,r,i;return c(this,(function(a){switch(a.label){case 0:return _(e)?(t=e[0],n=e[1],o=e[2],[4,g(n,t,(null==o?void 0:o.retries)||d,(null==o?void 0:o.delay)||f)]):[3,2];case 1:return[2,a.sent()];case 2:return r=e[0],i=e[1],[2,g(r,document,(null==i?void 0:i.retries)||d,(null==i?void 0:i.delay)||f)]}}))}))}function N(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a(this,0,void 0,(function(){var t,n,o,r,i;return c(this,(function(a){switch(a.label){case 0:return _(e)?(t=e[0],n=e[1],o=e[2],[4,I(n,t,(null==o?void 0:o.retries)||d,(null==o?void 0:o.delay)||f)]):[3,2];case 1:return[2,a.sent()];case 2:return r=e[0],i=e[1],[2,I(r,document,(null==i?void 0:i.retries)||d,(null==i?void 0:i.delay)||f)]}}))}))}var L=function(){function e(e,t){e instanceof Node||e instanceof Promise?(this._element=e,this._asyncParams=i({retries:d,delay:f},t||{})):(this._element=document,this._asyncParams=i({retries:d,delay:f},e||{}))}return Object.defineProperty(e.prototype,"element",{get:function(){return E(this._element).then((function(e){return e instanceof NodeList?e[0]||null:e}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$",{get:function(){var t=this;return new e(E(this._element).then((function(e){return e instanceof Document||e instanceof ShadowRoot||null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?N(e[0],s,t._asyncParams):N(e,s,t._asyncParams)})),this._asyncParams)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"all",{get:function(){return E(this._element).then((function(e){return e instanceof NodeList?e:document.querySelectorAll(u)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"asyncParams",{get:function(){return this._asyncParams},enumerable:!1,configurable:!0}),e.prototype.eq=function(e){return a(this,0,void 0,(function(){return c(this,(function(t){return[2,E(this._element).then((function(t){return t instanceof NodeList&&t[e]||null}))]}))}))},e.prototype.query=function(t){var n=this;return new e(E(this._element).then((function(e){return null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?C(e[0],t,n._asyncParams):C(e,t,n._asyncParams)})),this._asyncParams)},e.prototype.deepQuery=function(t){var n=this;return new e(E(this._element).then((function(e){return null===e||e instanceof NodeList&&0===e.length?null:e instanceof NodeList?Promise.race(Array.from(e).map((function(e){return R(e,t,n._asyncParams.retries,n._asyncParams.delay)}))):R(e,t,n._asyncParams.retries,n._asyncParams.delay)})),this._asyncParams)},e}(),w=function(e,t){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},w(e,t)},D=function(){return D=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},D.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var x,M,H,k,P,B,F,j,U,G,V,W,X,q,Y,K,$="$",J={retries:100,delay:50,eventThreshold:450};!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR",e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER"}(x||(x={})),function(e){e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(M||(M={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(H||(H={})),function(e){e.ON_LISTEN="onListen",e.ON_PANEL_LOAD="onPanelLoad",e.ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",e.ON_MORE_INFO_DIALOG_OPEN="onMoreInfoDialogOpen",e.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onHistoryAndLogBookDialogOpen",e.ON_SETTINGS_DIALOG_OPEN="onSettingsDialogOpen"}(k||(k={})),function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(K||(K={}));var z=((P={})[x.HOME_ASSISTANT]={selector:K.HOME_ASSISTANT,children:{shadowRoot:{selector:$,children:(B={},B[x.HOME_ASSISTANT_MAIN]={selector:K.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:$,children:(F={},F[x.HA_DRAWER]={selector:K.HA_DRAWER,children:(j={},j[x.HA_SIDEBAR]={selector:K.HA_SIDEBAR,children:{shadowRoot:{selector:$}}},j[x.PARTIAL_PANEL_RESOLVER]={selector:K.PARTIAL_PANEL_RESOLVER},j)},F)}}},B)}}},P),Q=((U={})[M.HA_PANEL_LOVELACE]={selector:K.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:$,children:(G={},G[M.HUI_ROOT]={selector:K.HUI_ROOT,children:{shadowRoot:{selector:$,children:(V={},V[M.HEADER]={selector:K.HEADER},V[M.HUI_VIEW]={selector:K.HUI_VIEW},V)}}},G)}}},U),Z={shadowRoot:{selector:$,children:(W={},W[H.HA_MORE_INFO_DIALOG]={selector:K.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:$,children:(X={},X[H.HA_DIALOG]={selector:K.HA_DIALOG,children:(q={},q[H.HA_DIALOG_CONTENT]={selector:K.HA_DIALOG_CONTENT,children:(Y={},Y[H.HA_MORE_INFO_DIALOG_INFO]={selector:K.HA_MORE_INFO_DIALOG_INFO},Y[H.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]={selector:K.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},Y[H.HA_DIALOG_MORE_INFO_SETTINGS]={selector:K.HA_DIALOG_MORE_INFO_SETTINGS},Y)},q)},X)}}},W)}},ee=function(e,t,n,o){return void 0===n&&(n=null),void 0===o&&(o=!1),Object.entries(t||{}).reduce((function(t,r){var i=r[0],a=r[1];if(a.selector===$&&n)return a.children?D(D({},t),ee(e,a.children,n,!0)):t;var c=n?n.then((function(t){return t?S(t,(n=a.selector,o?"$ "+n:n),e):null;var n})):S(a.selector,e);return t[i]={element:c,children:ee(e,a.children,c),selector:new L(c,e)},t}),{})},te=function(e,t){for(var n=0,o=Object.entries(t);n<o.length;n++){var r=o[n];if(r[0]===e)return r[1];var i=te(e,r[1].children);if(i)return i}},ne=function(e,t){return Object.keys(e).reduce((function(e,n){var o=te(n,t);o.children;var r=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(o,["children"]);return e[n]=D({},r),e}),{})},oe=function(){function e(){this.delegate=document.createDocumentFragment()}return e.prototype.addEventListener=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];(e=this.delegate).addEventListener.apply(e,t)},e.prototype.dispatchEvent=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this.delegate).dispatchEvent.apply(e,t)},e.prototype.removeEventListener=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(e=this.delegate).removeEventListener.apply(e,t)},e}(),re=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n._config=D(D({},J),t),n._timestaps={},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}w(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype._dispatchEvent=function(e,t){var n=Date.now();n-this._timestaps[e]<this._config.eventThreshold||(this._timestaps[e]=n,this.dispatchEvent(new CustomEvent(e,{detail:t})))},t.prototype._updateDialogElements=function(e){var t,n=this;void 0===e&&(e=H.HA_MORE_INFO_DIALOG_INFO),this._dialogTree=ee(this._config,Z,this._haRootElements.HOME_ASSISTANT.element);var o=ne(H,this._dialogTree);o.HA_DIALOG_CONTENT.element.then((function(e){n._dialogsContentObserver.disconnect(),n._dialogsContentObserver.observe(e,{childList:!0})})),this._haDialogElements=function(e,t){return[H.HA_MORE_INFO_DIALOG,H.HA_DIALOG,H.HA_DIALOG_CONTENT,t].reduce((function(t,n){return t[n]=e[n],t}),{})}(o,e);var r=((t={})[H.HA_MORE_INFO_DIALOG_INFO]=k.ON_MORE_INFO_DIALOG_OPEN,t[H.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=k.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN,t[H.HA_DIALOG_MORE_INFO_SETTINGS]=k.ON_SETTINGS_DIALOG_OPEN,t);this._dispatchEvent(r[e],this._haDialogElements)},t.prototype._updateRootElements=function(){var e=this;this._homeAssistantRootTree=ee(this._config,z),this._haRootElements=ne(x,this._homeAssistantRootTree),this._haRootElements[x.HOME_ASSISTANT].selector.$.element.then((function(t){e._dialogsObserver.disconnect(),e._dialogsObserver.observe(t,{childList:!0})})),this._haRootElements[x.PARTIAL_PANEL_RESOLVER].element.then((function(t){e._panelResolverObserver.disconnect(),t&&e._panelResolverObserver.observe(t,{subtree:!0,childList:!0})})),this._dispatchEvent(k.ON_LISTEN,this._haRootElements),this._dispatchEvent(k.ON_PANEL_LOAD,this._haRootElements)},t.prototype._updateLovelaceElements=function(){var e=this;this._homeAssistantResolverTree=ee(this._config,Q,this._haRootElements[x.HA_DRAWER].element),this._haResolverElements=ne(M,this._homeAssistantResolverTree),this._haResolverElements[M.HA_PANEL_LOVELACE].element.then((function(t){e._lovelaceObserver.disconnect(),t&&(e._lovelaceObserver.observe(t.shadowRoot,{childList:!0}),e._dispatchEvent(k.ON_LOVELACE_PANEL_LOAD,D(D({},e._haRootElements),e._haResolverElements)))}))},t.prototype._watchDialogs=function(e){var t=this;e.forEach((function(e){e.addedNodes.forEach((function(e){e.localName===K.HA_MORE_INFO_DIALOG&&t._updateDialogElements()}))}))},t.prototype._watchDialogsContent=function(e){var t=this;e.forEach((function(e){e.addedNodes.forEach((function(e){var n,o=((n={})[K.HA_MORE_INFO_DIALOG_INFO]=H.HA_MORE_INFO_DIALOG_INFO,n[K.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=H.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,n[K.HA_DIALOG_MORE_INFO_SETTINGS]=H.HA_DIALOG_MORE_INFO_SETTINGS,n);if(e.localName&&e.localName in o){var r=e.localName;t._updateDialogElements(o[r])}}))}))},t.prototype._watchDashboards=function(e){var t=this;e.forEach((function(e){e.addedNodes.forEach((function(e){t._dispatchEvent(k.ON_PANEL_LOAD,t._haRootElements),e.localName===K.HA_PANEL_LOVELACE&&t._updateLovelaceElements()}))}))},t.prototype._watchLovelace=function(e){var t=this;e.forEach((function(e){e.addedNodes.forEach((function(e){e.localName===K.HUI_ROOT&&t._updateLovelaceElements()}))}))},t.prototype.listen=function(){this._watchDialogsBinded=this._watchDialogs.bind(this),this._watchDialogsContentBinded=this._watchDialogsContent.bind(this),this._watchDashboardsBinded=this._watchDashboards.bind(this),this._watchLovelaceBinded=this._watchLovelace.bind(this),this._dialogsObserver=new MutationObserver(this._watchDialogsBinded),this._dialogsContentObserver=new MutationObserver(this._watchDialogsContentBinded),this._panelResolverObserver=new MutationObserver(this._watchDashboardsBinded),this._lovelaceObserver=new MutationObserver(this._watchLovelaceBinded),this._updateRootElements(),this._updateLovelaceElements()},t.prototype.addEventListener=function(t,n,o){e.prototype.addEventListener.call(this,t,n,o)},t}(oe),ie=function(){return ie=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},ie.apply(this,arguments)};function ae(e,t,n){if(2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var ce,se,le,ue,de="[home-assistant-javascript-templates]",fe=/^([a-z_]+)\.(\w+)$/;!function(e){e.UNKNOWN="unknown",e.UNAVAILABLE="unavailable"}(ce||(ce={})),function(e){e.AREA_ID="area_id",e.NAME="name"}(se||(se={})),function(e){e.PANEL_URL="panel_url",e.LANG="lang"}(le||(le={})),function(e){e.LOCATION_CHANGED="location-changed",e.TRANSLATIONS_UPDATED="translations-updated",e.POPSTATE="popstate",e.SUBSCRIBE_EVENTS="subscribe_events",e.STATE_CHANGE_EVENT="state_changed"}(ue||(ue={}));var _e=function(e){return e.reduce((function(e,t){var n=t[0],o=t[1];return e[n.replace(fe,"$2")]=o,e}),{})},pe=function(e){return e.includes(".")},he="ref",Ee="value",Oe="toJSON",me=function(e){return"".concat(he,".").concat(e)};function ve(e,t,n){var o=function(){return Object.entries(e.hass.areas)},r=function(){return Object.entries(e.hass.devices)},i=function(){return Object.entries(e.hass.entities)},a=new Set,c=new Map,s=function(e,t){n&&console.warn("".concat(e," ").concat(t," used in a JavaScript template doesn't exist"))},l=function(e){return s("Entity",e)},u=function(e){return s("Domain",e)},d=function(e){var o=new SyntaxError(e);if(t)throw o;n&&console.warn(o)},f=function(t){e.hass.states[t]?a.add(t):l(t)},_=function(e){a.add(e)},p=function(t,n){var o=n.with_unit,r=void 0!==o&&o,i=n.rounded,a=void 0!==i&&i;if(t){var c=t.state,s=t.attributes.unit_of_measurement,l=Number(a),u=!1===a||isNaN(Number(c))?c:new Intl.NumberFormat(e.hass.language,{minimumFractionDigits:l,maximumFractionDigits:l}).format(Number(c));return r&&s?"".concat(u," ").concat(s):u}},h=function(e){return new Proxy(e,{get:function(e,t){return"state_with_unit"===t?p(e,{rounded:!0,with_unit:!0}):e[t]}})};return{get hass(){return e.hass},states:new Proxy((function(t,n){if(void 0===n&&(n={}),pe(t))return f(t),p(e.hass.states[t],n);throw SyntaxError("".concat(de,": states method cannot be used with a domain, use it as an object instead."))}),{get:function(t,n){if(pe(n))return f(n),h(e.hass.states[n]);var o=Object.entries(e.hass.states).filter((function(e){return e[0].startsWith(n)}));return o.length||u(n),new Proxy(_e(o),{get:function(e,t){return f("".concat(n,".").concat(t)),h(e[t])}})}}),state_translated:function(t){if(f(t),e.hass.states[t])return e.hass.formatEntityState(e.hass.states[t])},is_state:function(t,n){var o;return f(t),Array.isArray(n)?n.some((function(n){var o;return(null===(o=e.hass.states[t])||void 0===o?void 0:o.state)===n})):(null===(o=e.hass.states[t])||void 0===o?void 0:o.state)===n},state_attr:function(t,n){var o,r;return f(t),null===(r=null===(o=e.hass.states[t])||void 0===o?void 0:o.attributes)||void 0===r?void 0:r[n]},is_state_attr:function(e,t,n){return this.state_attr(e,t)===n},has_value:function(e){return this.states(e)?!(this.is_state(e,ce.UNKNOWN)||this.is_state(e,ce.UNAVAILABLE)):(l(e),!1)},entities:new Proxy((function(t){if(void 0===t)return e.hass.entities;if(pe(t))return f(t),e.hass.entities[t];var n=i().filter((function(e){return e[0].startsWith(t)}));return n.length||u(t),new Proxy(_e(n),{get:function(e,n){return f("".concat(t,".").concat(n)),e[n]}})}),{get:function(e,t){return e(t)}}),entity_prop:function(t,n){var o;return f(t),null===(o=e.hass.entities[t])||void 0===o?void 0:o[n]},is_entity_prop:function(e,t,n){return this.entity_prop(e,t)===n},devices:new Proxy((function(t){if(void 0===t)return e.hass.devices;if(pe(t))throw SyntaxError("".concat(de,": devices method cannot be used with an entity id, you should use a device id instead."));return e.hass.devices[t]}),{get:function(t,n){if(pe(n))throw SyntaxError("".concat(de,": devices cannot be accesed using an entity id, you should use a device id instead."));return e.hass.devices[n]}}),device_attr:function(t,n){var o,r,i;if(pe(t)){f(t);var a=null===(o=e.hass.entities[t])||void 0===o?void 0:o.device_id;return null===(r=e.hass.devices[a])||void 0===r?void 0:r[n]}return null===(i=e.hass.devices[t])||void 0===i?void 0:i[n]},is_device_attr:function(e,t,n){return this.device_attr(e,t)===n},device_id:function(t){var n;if(pe(t))return f(t),null===(n=e.hass.entities[t])||void 0===n?void 0:n.device_id;var o=r().find((function(e){return e[1].name===t}));return null==o?void 0:o[0]},device_name:function(t){var n,o,r;if(pe(t)){f(t);var i=null===(n=e.hass.entities[t])||void 0===n?void 0:n.device_id;return null===(o=e.hass.devices[i])||void 0===o?void 0:o.name}return null===(r=e.hass.devices[t])||void 0===r?void 0:r.name},areas:function(){return o().map((function(e){return e[1].area_id}))},area_id:function(t){var n,r;if(t in e.hass.devices)return this.device_attr(t,se.AREA_ID);var i=null===(n=e.hass.entities[t])||void 0===n?void 0:n.device_id;if(i)return this.device_attr(i,se.AREA_ID);var a=o().find((function(e){return e[1].name===t}));return null===(r=null==a?void 0:a[1])||void 0===r?void 0:r.area_id},area_name:function(t){var n,r,i;t in e.hass.devices&&(i=this.device_attr(t,se.AREA_ID));var a=null===(n=e.hass.entities[t])||void 0===n?void 0:n.device_id;a&&(i=this.device_attr(a,se.AREA_ID));var c=o().find((function(e){var n=e[1];return n.area_id===t||n.area_id===i}));return null===(r=null==c?void 0:c[1])||void 0===r?void 0:r.name},area_entities:function(e){var t=o().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return t?i().filter((function(e){return e[1].area_id===t[1].area_id})).map((function(e){return e[0]})):[]},area_devices:function(e){var t=o().find((function(t){var n=t[1];return n.area_id===e||n.name===e}));return t?r().filter((function(e){return e[1].area_id===t[1].area_id})).map((function(e){return e[1].id})):[]},get user_name(){return e.hass.user.name},get user_is_admin(){return e.hass.user.is_admin},get user_is_owner(){return e.hass.user.is_owner},get user_agent(){return window.navigator.userAgent},get tracked(){return a},cleanTracked:function(){a.clear()},ref:function(e,t,n){var o;void 0===n&&(n=void 0);var r=me(t);if(c.has(t))return c.get(t);var i=new Proxy(((o={})[Ee]=n,o[Oe]=function(){return this[Ee]},o),{get:function(e,t,n){if(t===Ee||t===Oe)return _(r),Reflect.get(e,t,n);d("".concat(t," is not a valid ").concat(he," property. A ").concat(he,' only exposes a "').concat(Ee,'" property'))},set:function(t,n,o){if(n===Ee){var i=t[Ee];return t[Ee]=o,e({event_type:ue.STATE_CHANGE_EVENT,data:{entity_id:r,old_state:{state:JSON.stringify(i)},new_state:{state:JSON.stringify(o)}}}),!0}return d('property "'.concat(n,'" cannot be set in a ').concat(he)),!1}});return c.set(t,i),i},unref:function(e,t){var n=me(t);c.has(t)?(c.delete(t),e(n)):d("".concat(t," is not a ref or it has been unrefed already"))},refs:function(e,t,n){void 0===n&&(n={});var o=this.ref,r=this.unref,i=new Proxy(n,{get:function(t,n){return o(e,n).value},set:function(t,n,r){return o(e,n).value=r,!0}});return Object.entries(n).forEach((function(n){var i=n[0],a=n[1];c.has(i)&&r(t,i),o(e,i,a)})),i},cleanRefs:function(e){var t=this;Array.from(c.keys()).forEach((function(n){t.unref(e,n)}))},clientSideProxy:new Proxy({},{get:function(t,o){switch(Object.values(le).includes(o)&&_(o),o){case le.PANEL_URL:return location.pathname;case le.LANG:return e.hass.language}n&&console.warn("clientSideProxy should only be used to access these variables: ".concat(Object.values(le).join(", ")))}})}}var Ae,Te,be,ge,Ie,ye,Re,Se,Ce=function(){function e(e,t){var n=t.throwErrors,o=void 0!==n&&n,r=t.throwWarnings,i=void 0===r||r,a=t.variables,c=void 0===a?{}:a,s=t.refs,l=void 0===s?{}:s,u=t.refsVariableName,d=void 0===u?"refs":u,f=t.autoReturn,_=void 0===f||f;this._throwErrors=o,this._throwWarnings=i,this._variables=c,this._refsVariableName=d,this._autoReturn=_,this._subscriptions=new Map,this._clientSideEntitiesRegExp=new RegExp("(^|[ \\?(+:\\{\\[><,])(".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<arguments.length;n++)t[n]=arguments[n];return t.reduce((function(t,n){var r,i;return e(e(e({},t),n),{order:o(o([],null!==(r=t.order)&&void 0!==r?r:[],!0),null!==(i=n.order)&&void 0!==i?i:[],!0)})}),{})},t.prototype._pickExtendableOptions=function(t){var n=Object.entries(t),o=Object.fromEntries(n.filter((function(e){var t=e[0];return!Kt.includes(t)})));return t.extend_from?this._mergeConfigs(this._importConfig(t.extend_from),o):e({},o)},t.prototype._importConfig=function(e){var t,n=this;return(Xt(t=e)?t:[t]).reduce((function(e,t){return t===Ge?n._mergeConfigs(n._pickExtendableOptions(n._config),e):n._mergeConfigs(n._pickExtendableOptions(n._extendable.get(t)),e)}),{})},t.prototype._buildFlattenConfigFromExceptions=function(){var t=this,n=$t.reduce((function(n,o){var r;return t._config[o]?e(e({},n),((r={})[o]=t._config[o],r)):n}),{});this._flattenConfig=this._exceptions.reduce((function(e,n){return n.extend_from?t._mergeConfigs(t._importConfig(n.extend_from),e,n):t._mergeConfigs(e,n)}),n)},t.prototype._buildFlattenConfigFromMainConfig=function(){this._flattenConfig=this._config.extend_from?this._mergeConfigs(this._importConfig(this._config.extend_from),this._config):this._config},t.prototype._buildFlattenConfig=function(){this._exceptions.length?this._buildFlattenConfigFromExceptions():this._buildFlattenConfigFromMainConfig()},t.prototype._flattenOrder=function(t){var n,o=null!==(n=t.order)&&void 0!==n?n:[],r=new Map;return o.forEach((function(t){r.has(t.item)?r.set(t.item,e(e({},r.get(t.item)),t)):r.set(t.item,t)})),r.forEach((function(e){Yt.forEach((function(n){void 0===e[n]&&void 0!==t[n]&&(e[n]=t[n])})),e.new_item||void 0!==e.hide||void 0===t.hide_all||(e.hide=t.hide_all)})),Array.from(r.values()).sort((function(e,t){return!!e.bottom!=!!t.bottom?e.bottom?1:-1:jt(e.order)||jt(t.order)?e.order===t.order?0:jt(e.order)?1:-1:e.order-t.order}))},Object.defineProperty(t.prototype,"config",{get:function(){return e(e({},this._flattenConfig),{order:this._flattenOrder(this._flattenConfig)})},enumerable:!1,configurable:!0}),t}(),zt=function(e,t,n){return void 0===n&&(n=[]),e.replace(Bt,(function(e,r){if(null==t?void 0:t[r]){if(n.includes(r))throw new SyntaxError("".concat(Fe,": circular partials dependency ").concat(n.join(" > ")," > ").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<arguments.length;t++)e[t]=arguments[t];var n=e[0],o=e.slice(1);return 0===o.length?n.startsWith("--")?"var(".concat(n,")"):n:"var(".concat(n,", ").concat(Qt.apply(void 0,o),")")},Zt=function(){return t(void 0,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return customElements.get(ze.HA_PANEL_CONFIG)?[3,3]:((e=document.createElement(ze.PARTIAL_PANEL_RESOLVER)).hass={panels:[{url_path:"config",component_name:"config"}]},e._updateRoutes(),[4,e.routerOptions.routes.config.load()]);case 1:return t.sent(),[4,customElements.whenDefined(ze.HA_PANEL_CONFIG)];case 2:t.sent(),t.label=3;case 3:return[2,document.createElement(ze.HA_PANEL_CONFIG)]}}))}))},en=function(e){return t(void 0,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return customElements.get(ze.HA_CONFIG_BACKUP)?[3,3]:[4,e.routerOptions.routes.backup.load()];case 1:return t.sent(),[4,customElements.whenDefined(ze.HA_CONFIG_BACKUP)];case 2:t.sent(),t.label=3;case 3:return[2,document.createElement(ze.HA_CONFIG_BACKUP_BACKUPS)]}}))}))},tn=function(e){return t(void 0,void 0,void 0,(function(){return n(this,(function(t){switch(t.label){case 0:return customElements.get(ze.HA_CONFIG_SYSTEM_NAVIGATION)?[3,3]:[4,e.routerOptions.routes.system.load()];case 1:return t.sent(),[4,customElements.whenDefined(ze.HA_CONFIG_SYSTEM_NAVIGATION)];case 2:t.sent(),t.label=3;case 3:return[2,document.createElement(ze.HA_CONFIG_SYSTEM_NAVIGATION)]}}))}))},nn=function(e){return t(void 0,void 0,void 0,(function(){var t,o,r;return n(this,(function(n){switch(n.label){case 0:return(t=customElements.get(ze.DIALOG_BOX))?[2,t]:[4,Zt()];case 1:return o=n.sent(),[4,en(o)];case 2:return(r=n.sent()).hass=e.hass,[2,new Promise((function(e){r.addEventListener(Qe.SHOW_DIALOG,(function(t){var n=t.detail.dialogImport();e(n)}),{once:!0}),r._deleteBackup({parentElement:{anchorElement:{backup:!0}}})}))]}}))}))},on=function(e,t,n,o){e.dispatchEvent(new CustomEvent(Qe.SHOW_DIALOG,{bubbles:!0,cancelable:!1,composed:!0,detail:{dialogTag:t,dialogImport:n,dialogParams:o}}))},rn=function(e){return t(void 0,void 0,void 0,(function(){var o;return n(this,(function(r){switch(r.label){case 0:return[4,t(void 0,void 0,void 0,(function(){var e,t,o;return n(this,(function(n){switch(n.label){case 0:return(e=customElements.get(ze.DIALOG_RESTART))?[2,e]:[4,Zt()];case 1:return t=n.sent(),[4,tn(t)];case 2:return o=n.sent(),[2,new Promise((function(e){o.addEventListener(Qe.SHOW_DIALOG,(function(t){var n=t.detail.dialogImport();e(n)}),{once:!0}),o._showRestartDialog()}))]}}))}))];case 1:return o=r.sent(),function(e,t){on(e,ze.DIALOG_RESTART,t,{})}(e,(function(){return Promise.resolve(o)})),[2]}}))}))},an=function(e,t){e.dispatchEvent(new CustomEvent(Qe.HASS_MORE_INFO,{detail:{entityId:t}}))},cn=function(o){return{openAlertDialog:function(e){var r=e.title,i=e.text,a=e.confirmText,c=e.confirm;!function(e,o){t(void 0,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,nn(e)];case 1:return t=n.sent(),on(e,ze.DIALOG_BOX,(function(){return Promise.resolve(t)}),o),[2]}}))}))}(o,{title:r,text:i,confirmText:a,confirm:c})},openConfirmDialog:function(r){var i=r.title,a=r.text,c=r.destructive,s=r.confirmText,l=r.dismissText,u=r.confirm,d=r.cancel;!function(o,r){t(void 0,void 0,void 0,(function(){var t;return n(this,(function(n){switch(n.label){case 0:return[4,nn(o)];case 1:return t=n.sent(),on(o,ze.DIALOG_BOX,(function(){return Promise.resolve(t)}),e(e({},r),{confirmation:!0})),[2]}}))}))}(o,{title:i,text:a,destructive:c,confirmText:s,dismissText:l,confirm:u,cancel:d})},openRestartDialog:function(){rn(o)},openMoreInfoDialog:function(e){an(o,e)}}},sn={backgroundColor:Qt(Ye.NOTIFICATION_COLOR,qe.ACCENT_COLOR),color:Qt(Ye.NOTIFICATION_TEXT_COLOR,qe.TEXT_ACCENT_COLOR,qe.TEXT_PRIMARY_COLOR),display:"block",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",textWrap:"nowrap",zIndex:1},ln=((it={})["".concat(We.HOST_EXPANDED," ").concat(Ve.ITEM," > ").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;n<t;n+=1)o+=e;return o},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,o,r,i;if(t)for(n=0,o=(i=Object.keys(t)).length;n<o;n+=1)e[r=i[n]]=t[r];return e}};function Pn(e,t){var n="",o=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),o+" "+n):o}function Bn(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Pn(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}Bn.prototype=Object.create(Error.prototype),Bn.prototype.constructor=Bn,Bn.prototype.toString=function(e){return this.name+": "+Pn(this,e)};var Fn=Bn;function jn(e,t,n,o,r){var i="",a="",c=Math.floor(r/2)-1;return o-t>c&&(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<t;e+=1)arguments[e].forEach(o);return n}(o.compiledImplicit,o.compiledExplicit),o};var Kn=Yn,$n=new Xn("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),Jn=new Xn("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),zn=new Xn("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}}),Qn=new Kn({explicit:[$n,Jn,zn]});var Zn=new Xn("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var eo=new Xn("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function to(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function no(e){return 48<=e&&e<=55}function oo(e){return 48<=e&&e<=57}var ro=new Xn("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n=e.length,o=0,r=!1;if(!n)return!1;if("-"!==(t=e[o])&&"+"!==t||(t=e[++o]),"0"===t){if(o+1===n)return!0;if("b"===(t=e[++o])){for(o++;o<n;o++)if("_"!==(t=e[o])){if("0"!==t&&"1"!==t)return!1;r=!0}return r&&"_"!==t}if("x"===t){for(o++;o<n;o++)if("_"!==(t=e[o])){if(!to(e.charCodeAt(o)))return!1;r=!0}return r&&"_"!==t}if("o"===t){for(o++;o<n;o++)if("_"!==(t=e[o])){if(!no(e.charCodeAt(o)))return!1;r=!0}return r&&"_"!==t}}if("_"===t)return!1;for(;o<n;o++)if("_"!==(t=e[o])){if(!oo(e.charCodeAt(o)))return!1;r=!0}return!(!r||"_"===t)},construct:function(e){var t,n=e,o=1;if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(o=-1),t=(n=n.slice(1))[0]),"0"===n)return 0;if("0"===t){if("b"===n[1])return o*parseInt(n.slice(2),2);if("x"===n[1])return o*parseInt(n.slice(2),16);if("o"===n[1])return o*parseInt(n.slice(2),8)}return o*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!kn.isNegativeZero(e)},represent:{binary:function(e){return 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;n<r;n++)if(!((t=i.indexOf(e.charAt(n)))>64)){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<r;t++)t%4==0&&t&&(c.push(a>>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<i;t++)t%3==0&&t&&(o+=a[r>>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<n;t+=1){if(o=c[t],i=!1,"[object Object]"!==mo.call(o))return!1;for(r in o)if(Oo.call(o,r)){if(i)return!1;i=!0}if(!i)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}}),Ao=Object.prototype.toString;var To=new Xn("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,o,r,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(o=a[t],"[object Object]"!==Ao.call(o))return!1;if(1!==(r=Object.keys(o)).length)return!1;i[t]=[r[0],o[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,o,r,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1)o=a[t],r=Object.keys(o),i[t]=[r[0],o[r[0]]];return i}}),bo=Object.prototype.hasOwnProperty;var go=new Xn("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(bo.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}}),Io=lo.extend({implicit:[_o,po],explicit:[Eo,vo,To,go]}),yo=Object.prototype.hasOwnProperty,Ro=1,So=2,Co=3,No=4,Lo=1,wo=2,Do=3,xo=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Mo=/[\x85\u2028\u2029]/,Ho=/[,\[\]\{\}]/,ko=/^(?:!|!!|![a-z\-]+!)$/i,Po=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Bo(e){return Object.prototype.toString.call(e)}function Fo(e){return 10===e||13===e}function jo(e){return 9===e||32===e}function Uo(e){return 9===e||32===e||10===e||13===e}function Go(e){return 44===e||91===e||93===e||123===e||125===e}function Vo(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function Wo(e){return 120===e?2:117===e?4:85===e?8:0}function Xo(e){return 48<=e&&e<=57?e-48:-1}function qo(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"
":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function Yo(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>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(t<n){if(c=e.input.slice(t,n),o)for(r=0,i=c.length;r<i;r+=1)9===(a=c.charCodeAt(r))||32<=a&&a<=1114111||er(e,"expected valid JSON character");else xo.test(c)&&er(e,"the stream contains non-printable characters");e.result+=c}}function rr(e,t,n,o){var r,i,a,c;for(kn.isObject(n)||er(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,c=(r=Object.keys(n)).length;a<c;a+=1)i=r[a],yo.call(t,i)||(Ko(t,i,n[i]),o[i]=!0)}function ir(e,t,n,o,r,i,a,c,s){var l,u;if(Array.isArray(r))for(l=0,u=(r=Array.prototype.slice.call(r)).length;l<u;l+=1)Array.isArray(r[l])&&er(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===Bo(r[l])&&(r[l]="[object Object]");if("object"==typeof r&&"[object Object]"===Bo(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===o)if(Array.isArray(i))for(l=0,u=i.length;l<u;l+=1)rr(e,t,i[l],n);else rr(e,t,i,n);else e.json||yo.call(n,r)||!yo.call(t,r)||(e.line=a||e.line,e.lineStart=c||e.lineStart,e.position=s||e.position,er(e,"duplicated mapping key")),Ko(t,r,i),delete n[r];return t}function ar(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):er(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function cr(e,t,n){for(var o=0,r=e.input.charCodeAt(e.position);0!==r;){for(;jo(r);)9===r&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r);if(!Fo(r))break;for(ar(e),r=e.input.charCodeAt(e.position),o++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==o&&e.lineIndent<n&&tr(e,"deficient indentation"),o}function sr(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!Uo(t)))}function lr(e,t){1===t?e.result+=" ":t>1&&(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.lineIndent<t)break;return!!c&&(e.tag=r,e.anchor=i,e.kind="sequence",e.result=a,!0)}function dr(e){var t,n,o,r,i=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&er(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(i=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,i){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r);e.position<e.length?(o=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):er(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!Uo(r);)33===r&&(a?er(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),ko.test(n)||er(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);o=e.input.slice(t,e.position),Ho.test(o)&&er(e,"tag suffix cannot contain flow indicator characters")}o&&!Po.test(o)&&er(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch(t){er(e,"tag name is malformed: "+o)}return i?e.tag=o:yo.call(e.tagMap,n)?e.tag=e.tagMap[n]+o:"!"===n?e.tag="!"+o:"!!"===n?e.tag="tag:yaml.org,2002:"+o:er(e,'undeclared tag handle "'+n+'"'),!0}function fr(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&er(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!Uo(n)&&!Go(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&er(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function _r(e,t,n,o,r){var i,a,c,s,l,u,d,f,_,p=1,h=!1,E=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=c=No===n||Co===n,o&&cr(e,!0,-1)&&(h=!0,e.lineIndent>t?p=1:e.lineIndent===t?p=0:e.lineIndent<t&&(p=-1)),1===p)for(;dr(e)||fr(e);)cr(e,!0,-1)?(h=!0,c=i,e.lineIndent>t?p=1:e.lineIndent===t?p=0:e.lineIndent<t&&(p=-1)):c=!1;if(c&&(c=h||r),1!==p&&No!==n||(f=Ro===n||So===n?t:t+1,_=e.position-e.lineStart,1===p?c&&(ur(e,_)||function(e,t,n){var o,r,i,a,c,s,l,u=e.tag,d=e.anchor,f={},_=Object.create(null),p=null,h=null,E=null,O=!1,m=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),l=e.input.charCodeAt(e.position);0!==l;){if(O||-1===e.firstTabInLine||(e.position=e.firstTabInLine,er(e,"tab characters must not be used in indentation")),o=e.input.charCodeAt(e.position+1),i=e.line,63!==l&&58!==l||!Uo(o)){if(a=e.line,c=e.lineStart,s=e.position,!_r(e,n,So,!1,!0))break;if(e.line===i){for(l=e.input.charCodeAt(e.position);jo(l);)l=e.input.charCodeAt(++e.position);if(58===l)Uo(l=e.input.charCodeAt(++e.position))||er(e,"a whitespace character is expected after the key-value separator within a block mapping"),O&&(ir(e,f,_,p,h,null,a,c,s),p=h=E=null),m=!0,O=!1,r=!1,p=e.tag,h=e.result;else{if(!m)return e.tag=u,e.anchor=d,!0;er(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!m)return e.tag=u,e.anchor=d,!0;er(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(O&&(ir(e,f,_,p,h,null,a,c,s),p=h=E=null),m=!0,O=!0,r=!0):O?(O=!1,r=!0):er(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,l=o;if((e.line===i||e.lineIndent>t)&&(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<t)break}return O&&ir(e,f,_,p,h,null,a,c,s),m&&(e.tag=u,e.anchor=d,e.kind="mapping",e.result=f),m}(e,_,f))||function(e,t){var n,o,r,i,a,c,s,l,u,d,f,_,p=!0,h=e.tag,E=e.anchor,O=Object.create(null);if(91===(_=e.input.charCodeAt(e.position)))a=93,l=!1,i=[];else{if(123!==_)return!1;a=125,l=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),_=e.input.charCodeAt(++e.position);0!==_;){if(cr(e,!0,t),(_=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=h,e.anchor=E,e.kind=l?"mapping":"sequence",e.result=i,!0;p?44===_&&er(e,"expected the node content, but found ','"):er(e,"missed comma between flow collection entries"),f=null,c=s=!1,63===_&&Uo(e.input.charCodeAt(e.position+1))&&(c=s=!0,e.position++,cr(e,!0,t)),n=e.line,o=e.lineStart,r=e.position,_r(e,t,Ro,!1,!0),d=e.tag,u=e.result,cr(e,!0,t),_=e.input.charCodeAt(e.position),!s&&e.line!==n||58!==_||(c=!0,_=e.input.charCodeAt(++e.position),cr(e,!0,t),_r(e,t,Ro,!1,!0),f=e.result),l?ir(e,i,O,d,u,f,n,o,r):c?i.push(ir(e,null,O,d,u,f,n,o,r)):i.push(u),cr(e,!0,t),44===(_=e.input.charCodeAt(e.position))?(p=!0,_=e.input.charCodeAt(++e.position)):p=!1}er(e,"unexpected end of the stream within a flow collection")}(e,f)?E=!0:(a&&function(e,t){var n,o,r,i,a=Lo,c=!1,s=!1,l=t,u=0,d=!1;if(124===(i=e.input.charCodeAt(e.position)))o=!1;else{if(62!==i)return!1;o=!0}for(e.kind="scalar",e.result="";0!==i;)if(43===(i=e.input.charCodeAt(++e.position))||45===i)Lo===a?a=43===i?Do:wo:er(e,"repeat of a chomping mode identifier");else{if(!((r=Xo(i))>=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.lineIndent<l)&&32===i;)e.lineIndent++,i=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>l&&(l=e.lineIndent),Fo(i))u++;else{if(e.lineIndent<l){a===Do?e.result+=kn.repeat("\n",c?1+u:u):a===Lo&&c&&(e.result+="\n");break}for(o?jo(i)?(d=!0,e.result+=kn.repeat("\n",c?1+u:u)):d?(d=!1,e.result+=kn.repeat("\n",u+1)):0===u?c&&(e.result+=" "):e.result+=kn.repeat("\n",u):e.result+=kn.repeat("\n",c?1+u:u),c=!0,s=!0,u=0,n=e.position;!Fo(i)&&0!==i;)i=e.input.charCodeAt(++e.position);or(e,n,e.position,!1)}}return!0}(e,f)||function(e,t){var n,o,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,o=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(or(e,o,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;o=e.position,e.position++,r=e.position}else Fo(n)?(or(e,o,r,!0),lr(e,cr(e,!1,t)),o=r=e.position):e.position===e.lineStart&&sr(e)?er(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);er(e,"unexpected end of the stream within a single quoted scalar")}(e,f)||function(e,t){var n,o,r,i,a,c;if(34!==(c=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=o=e.position;0!==(c=e.input.charCodeAt(e.position));){if(34===c)return or(e,n,e.position,!0),e.position++,!0;if(92===c){if(or(e,n,e.position,!0),Fo(c=e.input.charCodeAt(++e.position)))cr(e,!1,t);else if(c<256&&$o[c])e.result+=Jo[c],e.position++;else if((a=Wo(c))>0){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<l;s+=1)if((d=e.implicitTypes[s]).resolve(e.result)){e.result=d.construct(e.result),e.tag=d.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else if("!"!==e.tag){if(yo.call(e.typeMap[e.kind||"fallback"],e.tag))d=e.typeMap[e.kind||"fallback"][e.tag];else for(d=null,s=0,l=(u=e.typeMap.multi[e.kind||"fallback"]).length;s<l;s+=1)if(e.tag.slice(0,u[s].tag.length)===u[s].tag){d=u[s];break}d||er(e,"unknown tag !<"+e.tag+">"),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<e.length-1&&er(e,"end of the stream or a document separator is expected")}function hr(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new Qo(e,t),o=e.indexOf("\0");for(-1!==o&&(n.position=o,er(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)pr(n);return n.documents}var Er={loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var o=hr(e,n);if("function"!=typeof t)return o;for(var r=0,i=o.length;r<i;r+=1)t(o[r])},load:function(e,t){var n=hr(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new Fn("expected a single document in the stream, but found more")}}},Or=Object.prototype.toString,mr=Object.prototype.hasOwnProperty,vr=65279,Ar=9,Tr=10,br=13,gr=32,Ir=33,yr=34,Rr=35,Sr=37,Cr=38,Nr=39,Lr=42,wr=44,Dr=45,xr=58,Mr=61,Hr=62,kr=63,Pr=64,Br=91,Fr=93,jr=96,Ur=123,Gr=124,Vr=125,Wr={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Xr=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],qr=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Yr(e){var t,n,o;if(t=e.toString(16).toUpperCase(),e<=255)n="x",o=2;else if(e<=65535)n="u",o=4;else{if(!(e<=4294967295))throw new Fn("code point within a string may not be greater than 0xFFFFFFFF");n="U",o=8}return"\\"+n+kn.repeat("0",o-t.length)+t}var Kr=1,$r=2;function Jr(e){this.schema=e.schema||Io,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=kn.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,o,r,i,a,c,s;if(null===t)return{};for(n={},r=0,i=(o=Object.keys(t)).length;r<i;r+=1)a=o[r],c=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(s=e.compiledTypeMap.fallback[a])&&mr.call(s.styleAliases,c)&&(c=s.styleAliases[c]),n[a]=c;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?$r:Kr,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function zr(e,t){for(var n,o=kn.repeat(" ",t),r=0,i=-1,a="",c=e.length;r<c;)-1===(i=e.indexOf("\n",r))?(n=e.slice(r),r=c):(n=e.slice(r,i+1),r=i+1),n.length&&"\n"!==n&&(a+=o),a+=n;return a}function Qr(e,t){return"\n"+kn.repeat(" ",e.indent*t)}function Zr(e){return e===gr||e===Ar}function ei(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&e!==vr||65536<=e&&e<=1114111}function ti(e){return ei(e)&&e!==vr&&e!==br&&e!==Tr}function ni(e,t,n){var o=ti(e),r=o&&!Zr(e);return(n?o:o&&e!==wr&&e!==Br&&e!==Fr&&e!==Ur&&e!==Vr)&&e!==Rr&&!(t===xr&&!r)||ti(t)&&!Zr(t)&&e===Rr||t===xr&&r}function oi(e,t){var n,o=e.charCodeAt(t);return o>=55296&&o<=56319&&t+1<e.length&&(n=e.charCodeAt(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<e.length;l>=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<e.length;l>=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<o;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(e,t)}),e.quotingType,e.forceQuotes&&!o,r)){case ii:return t;case ai:return"'"+t.replace(/'/g,"''")+"'";case ci:return"|"+fi(t,e.indent)+_i(zr(t,i));case si:return">"+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<e.length;o>=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<i;r+=1)a=n[r],e.replacer&&(a=e.replacer.call(n,String(r),a)),(Oi(e,t+1,a,!0,!0,!1,!0)||void 0===a&&Oi(e,t+1,null,!0,!0,!1,!0))&&(o&&""===c||(c+=Qr(e,t)),e.dump&&Tr===e.dump.charCodeAt(0)?c+="-":c+="- ",c+=e.dump);e.tag=s,e.dump=c||"[]"}function Ei(e,t,n){var o,r,i,a,c,s;for(i=0,a=(r=n?e.explicitTypes:e.implicitTypes).length;i<a;i+=1)if(((c=r[i]).instanceOf||c.predicate)&&(!c.instanceOf||"object"==typeof t&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(s=e.styleMap[c.tag]||c.defaultStyle,"[object Function]"===Or.call(c.represent))o=c.represent(t,s);else{if(!mr.call(c.represent,s))throw new Fn("!<"+c.tag+'> 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;r<i;r+=1)l="",o&&""===u||(l+=Qr(e,t)),c=n[a=f[r]],e.replacer&&(c=e.replacer.call(n,a,c)),Oi(e,t+1,a,!0,!0,!0)&&((s=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(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;o<r;o+=1)c="",""!==s&&(c+=", "),e.condenseFlow&&(c+='"'),a=n[i=u[o]],e.replacer&&(a=e.replacer.call(n,i,a)),Oi(e,t,i,!1,!1)&&(e.dump.length>1024&&(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<r;o+=1)i=n[o],e.replacer&&(i=e.replacer.call(n,String(o),i)),(Oi(e,t,i,!1,!1)||void 0===i&&Oi(e,t,null,!1,!1))&&(""!==a&&(a+=","+(e.condenseFlow?"":" ")),a+=e.dump);e.tag=c,e.dump="["+a+"]"}(e,t,e.dump),d&&(e.dump="&ref_"+u+" "+e.dump));else{if("[object String]"!==s){if("[object Undefined]"===s)return!1;if(e.skipInvalid)return!1;throw new Fn("unacceptable kind of an object to dump "+s)}"?"!==e.tag&&di(e,e.dump,t,i,l)}null!==e.tag&&"?"!==e.tag&&(c=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),c="!"===e.tag[0]?"!"+c:"tag:yaml.org,2002:"===c.slice(0,18)?"!!"+c.slice(18):"!<"+c+">",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<o;n+=1)t.duplicates.push(r[i[n]]);t.usedDuplicates=new Array(o)}function vi(e,t,n){var o,r,i;if(null!==e&&"object"==typeof e)if(-1!==(r=t.indexOf(e)))-1===n.indexOf(r)&&n.push(r);else if(t.push(e),Array.isArray(e))for(r=0,i=e.length;r<i;r+=1)vi(e[r],t,n);else for(r=0,i=(o=Object.keys(e)).length;r<i;r+=1)vi(e[o[r]],t,n)}function Ai(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Ti={Type:Xn,Schema:Kn,FAILSAFE_SCHEMA:Qn,JSON_SCHEMA:so,CORE_SCHEMA:lo,DEFAULT_SCHEMA:Io,load:Er.load,loadAll:Er.loadAll,dump:{dump:function(e,t){var n=new Jr(t=t||{});n.noRefs||mi(e,n);var o=e;return n.replacer&&(o=n.replacer.call({"":o},"",o)),Oi(n,0,o,!0,!0)?n.dump+"\n":""}}.dump,YAMLException:Fn,types:{binary:Eo,float:co,map:zn,null:Zn,pairs:To,set:go,timestamp:_o,bool:eo,int:ro,merge:po,omap:vo,seq:Jn,str:$n},safeLoad:Ai("safeLoad","load"),safeLoadAll:Ai("safeLoadAll","loadAll"),safeDump:Ai("safeDump","dump")},bi="Invalid configuration",gi=o(o(["title","subtitle","sidebar_background","title_color","subtitle_color","sidebar_button_color","sidebar_border_color","menu_background","divider_color","divider_top_color","divider_bottom_color","scrollbar_thumb_color","styles"],tt,!0),["default_path"],!0),Ii=["js_variables","jinja_variables","partials","extendable_configs"],yi=function(e,t,n){t.forEach((function(t){if(!jt(e[t])&&!Ut(e[t]))throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a string'))}))},Ri=function(e,t,n){t.forEach((function(t){if(!jt(e[t])&&!Ut(e[t])&&!Gt(e[t]))throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a number or a string'))}))},Si=function(e,t,n){t.forEach((function(t){if(!jt(e[t])&&!Vt(e[t]))throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean'))}))},Ci=function(e,t,n){t.forEach((function(t){if(!jt(e[t])&&!Vt(e[t])&&!Ut(e[t]))throw new SyntaxError("".concat(n,' "').concat(String(t),'" property should be a boolean or a string'))}))},Ni=function(e,t){e.forEach((function(e){var n=e[0],o=e[1];if(!Li(o))throw new SyntaxError("".concat(t,' "').concat(n,'" property should be a string or an array of strings'))}))},Li=function(e){return!!jt(e)||(Ut(e)||Xt(e)&&e.some(Ut))},wi=function(e,t,n,o){(void 0===o&&(o=!1),e)&&(Xt(e)?e:[e]).forEach((function(e){var r;if(e===Ge&&!o)throw new SyntaxError("".concat(n,' "entend_from" can only be "base" in exceptions'));if(e!==Ge&&!(e in(null!==(r=t.extendable_configs)&&void 0!==r?r:{})))throw new SyntaxError("".concat(n,' "').concat(e,'" doesn\'t exist in "extendable_configs"'))}))},Di=function(e,t,n){e&&(Xt(e)?e:[e]).forEach((function(e){if(n.includes(e))throw new SyntaxError("".concat(bi,', circular extend dependency detected in "').concat(n.join(" > ")," > ").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 <span class="item-text" slot="headline">'.concat(e.item,'</span>\n <span class="badge" slot="end"></span>\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;a<i;a++){var c=a>n-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&&a<c||!n&&a>0?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)}}();
|