2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
!function(){"use strict";var t=function(){return t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)};function e(t,e,n,o){return new(n||(n=Promise))((function(i,r){function _(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(_,s)}a((o=o.apply(t,e||[])).next())}))}function n(t,e){var n,o,i,r,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(_=0)),_;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return _.label++,{value:s[1],done:!1};case 5:_.label++,o=s[1],s=[0];continue;case 7:s=_.ops.pop(),_.trys.pop();continue;default:if(!(i=_.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){_=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){_.label=s[1];break}if(6===s[0]&&_.label<i[1]){_.label=i[1],i=s;break}if(i&&_.label<i[2]){_.label=i[2],_.ops.push(s);break}i[2]&&_.ops.pop(),_.trys.pop();continue}s=e.call(t,_)}catch(t){s=[6,t],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}"function"==typeof SuppressedError&&SuppressedError;var o=function(){return o=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)};function i(t,e,n,o){return new(n||(n=Promise))((function(i,r){function _(t){try{a(o.next(t))}catch(t){r(t)}}function s(t){try{a(o.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(_,s)}a((o=o.apply(t,e||[])).next())}))}function r(t,e){var n,o,i,r,_={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r&&(r=0,s[0]&&(_=0)),_;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return _.label++,{value:s[1],done:!1};case 5:_.label++,o=s[1],s=[0];continue;case 7:s=_.ops.pop(),_.trys.pop();continue;default:if(!((i=(i=_.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){_=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){_.label=s[1];break}if(6===s[0]&&_.label<i[1]){_.label=i[1],i=s;break}if(i&&_.label<i[2]){_.label=i[2],_.ops.push(s);break}i[2]&&_.ops.pop(),_.trys.pop();continue}s=e.call(t,_)}catch(t){s=[6,t],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}"function"==typeof SuppressedError&&SuppressedError;var _="$",s=":host",a="invalid selector",c=10,I=10,E=function(t){var e,n=t[0],o=t[1];return(e=n)&&(e instanceof Document||e instanceof Element||e instanceof ShadowRoot)&&"string"==typeof o};function O(t,e){return function(t){return t.split(",").map((function(t){return t.trim()}))}(t).map((function(t){var n=function(t){return t.split(_).map((function(t){return t.trim()}))}(t);return e(n)}))}var A=function(t,e,n,o){return new Promise((function(i){var r=0,_=function(){var s=t();e(s)?i(s):++r<n?setTimeout(_,o):i(s)};_()}))};function l(t,e){var n=e?" If you want to select a shadowRoot, use ".concat(e," instead."):"";return"".concat(t," cannot be used with a selector ending in a shadowRoot (").concat(_,").").concat(n)}function u(t){return t instanceof Promise?t:Promise.resolve(t)}function T(){return"You can not select a shadowRoot (".concat(_,") of the document.")}function h(){return"You can not select a shadowRoot (".concat(_,") of a shadowRoot.")}function D(t,e){for(var n,o,i=null,r=t.length,_=0;_<r;_++){if(0===_)if(t[_].length)i=e.querySelector(t[_]);else{if(e instanceof Document)throw new SyntaxError(T());if(e instanceof ShadowRoot)throw new SyntaxError(h());i=(null===(n=e.shadowRoot)||void 0===n?void 0:n.querySelector(t[++_]))||null}else i=(null===(o=i.shadowRoot)||void 0===o?void 0:o.querySelector("".concat(s," ").concat(t[_])))||null;if(null===i)return null}return i}function L(t,e){var n,o=function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}([],t,!0),i=o.pop();if(!o.length)return e.querySelectorAll(i);var r=D(o,e);return(null===(n=null==r?void 0:r.shadowRoot)||void 0===n?void 0:n.querySelectorAll("".concat(s," ").concat(i)))||null}function d(t,e){if(1===t.length&&!t[0].length){if(e instanceof Document)throw new SyntaxError(T());if(e instanceof ShadowRoot)throw new SyntaxError(h());return e.shadowRoot}var n=D(t,e);return(null==n?void 0:n.shadowRoot)||null}function S(t,e,n,o){return i(this,void 0,void 0,(function(){return r(this,(function(i){return[2,A((function(){return function(t,e,n,o){void 0===n&&(n="querySelector"),void 0===o&&(o="shadowRootQuerySelector");for(var i=O(t,(function(t){if(!t[t.length-1].length)throw new SyntaxError(l(n,o));return t})),r=i.length,_=0;_<r;_++){var s=D(i[_],e);if(s)return s}return null}(t,e,"asyncQuerySelector","asyncShadowRootQuerySelector")}),(function(t){return!!t}),n,o)]}))}))}function H(t,e,n,o){return i(this,void 0,void 0,(function(){return r(this,(function(i){return[2,A((function(){return function(t,e,n){void 0===n&&(n="querySelectorAll");for(var o=O(t,(function(t){if(!t[t.length-1].length)throw new SyntaxError(l(n));return t})),i=o.length,r=0;r<i;r++){var _=L(o[r],e);if(null==_?void 0:_.length)return _}return document.querySelectorAll(a)}(t,e,"asyncQuerySelectorAll")}),(function(t){return!!t.length}),n,o)]}))}))}function R(t,e,n,o){return i(this,void 0,void 0,(function(){return r(this,(function(i){return[2,A((function(){return function(t,e,n,o){void 0===n&&(n="shadowRootQuerySelector"),void 0===o&&(o="querySelector");for(var i=O(t,(function(t){if(t.pop().length)throw new SyntaxError(function(t,e){return"".concat(t," must be used with a selector ending in a shadowRoot (").concat(_,"). If you don't want to select a shadowRoot, use ").concat(e," instead.")}(n,o));return t})),r=i.length,s=0;s<r;s++){var a=d(i[s],e);if(a)return a}return null}(t,e,"asyncShadowRootQuerySelector","asyncQuerySelector")}),(function(t){return!!t}),n,o)]}))}))}var N=function(t,e){var n=t.querySelectorAll(e);if(n.length)return n;if(t instanceof Element&&t.shadowRoot){var o=N(t.shadowRoot,e);if(o.length)return o}for(var i=0,r=Array.from(t.querySelectorAll("*"));i<r.length;i++){var _=r[i],s=N(_,e);if(s.length)return s}return document.querySelectorAll(a)},f=function(t,e,n,o){return A((function(){return N(t,e)}),(function(t){return!!t.length}),n,o)};function p(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i(this,void 0,void 0,(function(){var e,n,o,i,_;return r(this,(function(r){switch(r.label){case 0:return E(t)?(e=t[0],n=t[1],o=t[2],[4,S(n,e,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:case 3:return[2,r.sent()];case 2:return i=t[0],_=t[1],[4,S(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||I)]}}))}))}function G(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i(this,void 0,void 0,(function(){var e,n,o,i,_;return r(this,(function(r){switch(r.label){case 0:return E(t)?(e=t[0],n=t[1],o=t[2],[4,H(n,e,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:return[2,r.sent()];case 2:return i=t[0],_=t[1],[2,H(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||I)]}}))}))}function v(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i(this,void 0,void 0,(function(){var e,n,o,i,_;return r(this,(function(r){switch(r.label){case 0:return E(t)?(e=t[0],n=t[1],o=t[2],[4,R(n,e,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:return[2,r.sent()];case 2:return i=t[0],_=t[1],[2,R(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||I)]}}))}))}var C=function(){function t(t,e){t instanceof Node||t instanceof Promise?(this._element=t,this._asyncParams=o({retries:c,delay:I},e||{})):(this._element=document,this._asyncParams=o({retries:c,delay:I},t||{}))}return Object.defineProperty(t.prototype,"element",{get:function(){return u(this._element).then((function(t){return t instanceof NodeList?t[0]||null:t}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,_,{get:function(){var e=this;return new t(u(this._element).then((function(t){return t instanceof Document||t instanceof ShadowRoot||null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?v(t[0],_,e._asyncParams):v(t,_,e._asyncParams)})),this._asyncParams)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"all",{get:function(){return u(this._element).then((function(t){return t instanceof NodeList?t:document.querySelectorAll(a)}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asyncParams",{get:function(){return this._asyncParams},enumerable:!1,configurable:!0}),t.prototype.eq=function(t){return i(this,void 0,void 0,(function(){return r(this,(function(e){return[2,u(this._element).then((function(e){return e instanceof NodeList&&e[t]||null}))]}))}))},t.prototype.query=function(e){var n=this;return new t(u(this._element).then((function(t){return null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?G(t[0],e,n._asyncParams):G(t,e,n._asyncParams)})),this._asyncParams)},t.prototype.deepQuery=function(e){var n=this;return new t(u(this._element).then((function(t){return null===t||t instanceof NodeList&&0===t.length?null:t instanceof NodeList?Promise.race(Array.from(t).map((function(t){return f(t,e,n._asyncParams.retries,n._asyncParams.delay)}))):f(t,e,n._asyncParams.retries,n._asyncParams.delay)})),this._asyncParams)},t}(),m=function(t,e){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},m(t,e)},M=function(){return M=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},M.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var y,w,g,b,U,B,P,F,x,k,V,W,K,Y,j,q,$="$",z={retries:100,delay:50,eventThreshold:450};!function(t){t.HOME_ASSISTANT="HOME_ASSISTANT",t.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",t.HA_DRAWER="HA_DRAWER",t.HA_SIDEBAR="HA_SIDEBAR",t.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER"}(y||(y={})),function(t){t.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",t.HUI_ROOT="HUI_ROOT",t.HEADER="HEADER",t.HUI_VIEW="HUI_VIEW"}(w||(w={})),function(t){t.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",t.HA_DIALOG="HA_DIALOG",t.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",t.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",t.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",t.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(g||(g={})),function(t){t.ON_LISTEN="onListen",t.ON_PANEL_LOAD="onPanelLoad",t.ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",t.ON_MORE_INFO_DIALOG_OPEN="onMoreInfoDialogOpen",t.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onHistoryAndLogBookDialogOpen",t.ON_SETTINGS_DIALOG_OPEN="onSettingsDialogOpen"}(b||(b={})),function(t){t.HOME_ASSISTANT="home-assistant",t.HOME_ASSISTANT_MAIN="home-assistant-main",t.HA_DRAWER="ha-drawer",t.HA_SIDEBAR="ha-sidebar",t.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",t.HA_PANEL_LOVELACE="ha-panel-lovelace",t.HUI_ROOT="hui-root",t.HEADER=".header",t.HUI_VIEW="hui-view",t.HA_MORE_INFO_DIALOG="ha-more-info-dialog",t.HA_DIALOG="ha-dialog",t.HA_DIALOG_CONTENT=".content",t.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",t.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",t.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(q||(q={}));var Q,X,J,Z,tt=((U={})[y.HOME_ASSISTANT]={selector:q.HOME_ASSISTANT,children:{shadowRoot:{selector:$,children:(B={},B[y.HOME_ASSISTANT_MAIN]={selector:q.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:$,children:(P={},P[y.HA_DRAWER]={selector:q.HA_DRAWER,children:(F={},F[y.HA_SIDEBAR]={selector:q.HA_SIDEBAR,children:{shadowRoot:{selector:$}}},F[y.PARTIAL_PANEL_RESOLVER]={selector:q.PARTIAL_PANEL_RESOLVER},F)},P)}}},B)}}},U),et=((x={})[w.HA_PANEL_LOVELACE]={selector:q.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:$,children:(k={},k[w.HUI_ROOT]={selector:q.HUI_ROOT,children:{shadowRoot:{selector:$,children:(V={},V[w.HEADER]={selector:q.HEADER},V[w.HUI_VIEW]={selector:q.HUI_VIEW},V)}}},k)}}},x),nt={shadowRoot:{selector:$,children:(W={},W[g.HA_MORE_INFO_DIALOG]={selector:q.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:$,children:(K={},K[g.HA_DIALOG]={selector:q.HA_DIALOG,children:(Y={},Y[g.HA_DIALOG_CONTENT]={selector:q.HA_DIALOG_CONTENT,children:(j={},j[g.HA_MORE_INFO_DIALOG_INFO]={selector:q.HA_MORE_INFO_DIALOG_INFO},j[g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]={selector:q.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},j[g.HA_DIALOG_MORE_INFO_SETTINGS]={selector:q.HA_DIALOG_MORE_INFO_SETTINGS},j)},Y)},K)}}},W)}},ot=function(t,e,n,o){return void 0===n&&(n=null),void 0===o&&(o=!1),Object.entries(e||{}).reduce((function(e,i){var r=i[0],_=i[1];if(_.selector===$&&n)return _.children?M(M({},e),ot(t,_.children,n,!0)):e;var s=n?n.then((function(e){return e?p(e,(n=_.selector,o?"$ "+n:n),t):null;var n})):p(_.selector,t);return e[r]={element:s,children:ot(t,_.children,s),selector:new C(s,t)},e}),{})},it=function(t,e){for(var n=0,o=Object.entries(e);n<o.length;n++){var i=o[n];if(i[0]===t)return i[1];var r=it(t,i[1].children);if(r)return r}},rt=function(t,e){return Object.keys(t).reduce((function(t,n){var o=it(n,e);o.children;var i=function(t,e){var n={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&e.indexOf(o)<0&&(n[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)e.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(n[o[i]]=t[o[i]])}return n}(o,["children"]);return t[n]=M({},i),t}),{})},_t=function(){function t(){this.delegate=document.createDocumentFragment()}return t.prototype.addEventListener=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(t=this.delegate).addEventListener.apply(t,e)},t.prototype.dispatchEvent=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(t=this.delegate).dispatchEvent.apply(t,e)},t.prototype.removeEventListener=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(t=this.delegate).removeEventListener.apply(t,e)},t}(),st=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n._config=M(M({},z),e),n._timestaps={},n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}m(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype._dispatchEvent=function(t,e){var n=Date.now();n-this._timestaps[t]<this._config.eventThreshold||(this._timestaps[t]=n,this.dispatchEvent(new CustomEvent(t,{detail:e})))},e.prototype._updateDialogElements=function(t){var e,n=this;void 0===t&&(t=g.HA_MORE_INFO_DIALOG_INFO),this._dialogTree=ot(this._config,nt,this._haRootElements.HOME_ASSISTANT.element);var o=rt(g,this._dialogTree);o.HA_DIALOG_CONTENT.element.then((function(t){n._dialogsContentObserver.disconnect(),n._dialogsContentObserver.observe(t,{childList:!0})})),this._haDialogElements=function(t,e){return[g.HA_MORE_INFO_DIALOG,g.HA_DIALOG,g.HA_DIALOG_CONTENT,e].reduce((function(e,n){return e[n]=t[n],e}),{})}(o,t);var i=((e={})[g.HA_MORE_INFO_DIALOG_INFO]=b.ON_MORE_INFO_DIALOG_OPEN,e[g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=b.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN,e[g.HA_DIALOG_MORE_INFO_SETTINGS]=b.ON_SETTINGS_DIALOG_OPEN,e);this._dispatchEvent(i[t],this._haDialogElements)},e.prototype._updateRootElements=function(){var t=this;this._homeAssistantRootTree=ot(this._config,tt),this._haRootElements=rt(y,this._homeAssistantRootTree),this._haRootElements[y.HOME_ASSISTANT].selector.$.element.then((function(e){t._dialogsObserver.disconnect(),t._dialogsObserver.observe(e,{childList:!0})})),this._haRootElements[y.PARTIAL_PANEL_RESOLVER].element.then((function(e){t._panelResolverObserver.disconnect(),e&&t._panelResolverObserver.observe(e,{subtree:!0,childList:!0})})),this._dispatchEvent(b.ON_LISTEN,this._haRootElements),this._dispatchEvent(b.ON_PANEL_LOAD,this._haRootElements)},e.prototype._updateLovelaceElements=function(){var t=this;this._homeAssistantResolverTree=ot(this._config,et,this._haRootElements[y.HA_DRAWER].element),this._haResolverElements=rt(w,this._homeAssistantResolverTree),this._haResolverElements[w.HA_PANEL_LOVELACE].element.then((function(e){t._lovelaceObserver.disconnect(),e&&(t._lovelaceObserver.observe(e.shadowRoot,{childList:!0}),t._dispatchEvent(b.ON_LOVELACE_PANEL_LOAD,M(M({},t._haRootElements),t._haResolverElements)))}))},e.prototype._watchDialogs=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===q.HA_MORE_INFO_DIALOG&&e._updateDialogElements()}))}))},e.prototype._watchDialogsContent=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){var n,o=((n={})[q.HA_MORE_INFO_DIALOG_INFO]=g.HA_MORE_INFO_DIALOG_INFO,n[q.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,n[q.HA_DIALOG_MORE_INFO_SETTINGS]=g.HA_DIALOG_MORE_INFO_SETTINGS,n);if(t.localName&&t.localName in o){var i=t.localName;e._updateDialogElements(o[i])}}))}))},e.prototype._watchDashboards=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){e._dispatchEvent(b.ON_PANEL_LOAD,e._haRootElements),t.localName===q.HA_PANEL_LOVELACE&&e._updateLovelaceElements()}))}))},e.prototype._watchLovelace=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===q.HUI_ROOT&&e._updateLovelaceElements()}))}))},e.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()},e.prototype.addEventListener=function(e,n,o){t.prototype.addEventListener.call(this,e,n,o)},e}(_t),at="kiosk-mode",ct="kiosk_mode";!function(t){t.KIOSK="kiosk",t.HIDE_SIDEBAR="hide_sidebar",t.HIDE_HEADER="hide_header",t.HIDE_OVERFLOW="hide_overflow",t.HIDE_MENU_BUTTON="hide_menubutton",t.HIDE_ACCOUNT="hide_account",t.HIDE_NOTIFICATIONS="hide_notifications",t.HIDE_SEARCH="hide_search",t.HIDE_ASSISTANT="hide_assistant",t.HIDE_REFRESH="hide_refresh",t.HIDE_UNUSED_ENTITIES="hide_unused_entities",t.HIDE_RELOAD_RESOURCES="hide_reload_resources",t.HIDE_EDIT_DASHBOARD="hide_edit_dashboard",t.HIDE_DIALOG_HEADER_ACTION_ITEMS="hide_dialog_header_action_items",t.HIDE_DIALOG_HEADER_HISTORY="hide_dialog_header_history",t.HIDE_DIALOG_HEADER_SETTINGS="hide_dialog_header_settings",t.HIDE_DIALOG_HEADER_OVERFLOW="hide_dialog_header_overflow",t.HIDE_DIALOG_HISTORY="hide_dialog_history",t.HIDE_DIALOG_LOGBOOK="hide_dialog_logbook",t.HIDE_DIALOG_ATTRIBUTES="hide_dialog_attributes",t.HIDE_DIALOG_MEDIA_ACTIONS="hide_dialog_media_actions",t.HIDE_DIALOG_UPDATE_ACTIONS="hide_dialog_update_actions",t.HIDE_DIALOG_CLIMATE_ACTIONS="hide_dialog_climate_actions",t.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS="hide_dialog_climate_temperature_actions",t.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS="hide_dialog_climate_settings_actions",t.HIDE_DIALOG_TIMER_ACTIONS="hide_dialog_timer_actions",t.HIDE_DIALOG_LIGHT_ACTIONS="hide_dialog_light_actions",t.HIDE_DIALOG_LIGHT_CONTROL_ACTIONS="hide_dialog_light_control_actions",t.HIDE_DIALOG_LIGHT_COLOR_ACTIONS="hide_dialog_light_color_actions",t.HIDE_DIALOG_LIGHT_SETTINGS_ACTIONS="hide_dialog_light_settings_actions",t.HIDE_DIALOG_HISTORY_SHOW_MORE="hide_dialog_history_show_more",t.HIDE_DIALOG_LOGBOOK_SHOW_MORE="hide_dialog_logbook_show_more",t.BLOCK_OVERFLOW="block_overflow",t.BLOCK_MOUSE="block_mouse",t.BLOCK_CONTEXT_MENU="block_context_menu"}(X||(X={})),function(t){t.IGNORE_ENTITY_SETTINGS="ignore_entity_settings",t.IGNORE_MOBILE_SETTINGS="ignore_mobile_settings",t.IGNORE_DISABLE_KM="ignore_disable_km"}(J||(J={})),function(t){t.CACHE="cache",t.CLEAR_CACHE="clear_km_cache",t.DISABLE_KIOSK_MODE="disable_km"}(Z||(Z={}));var It,Et="ui",Ot="".concat(Et,".common"),At="".concat(Et,".panel"),lt="".concat(At,".lovelace"),ut="".concat(lt,".menu"),Tt="".concat(Et,".dialogs.more_info_control");!function(t){t.SEARCH="SEARCH",t.ASSIST="ASSIST",t.REFRESH="REFRESH",t.UNUSED_ENTITIES="UNUSED_ENTITIES",t.RELOAD_RESOURCES="RELOAD_RESOURCES",t.EDIT_DASHBOARD="EDIT_DASHBOARD",t.DIALOG_DISMISS="DIALOG_DISMISS",t.DIALOG_HISTORY="DIALOG_HISTORY",t.DIALOG_SETTINGS="DIALOG_SETTINGS"}(It||(It={}));var ht,Dt=Object.freeze(((Q={})[It.SEARCH]="".concat(ut,".search"),Q[It.ASSIST]="".concat(ut,".assist"),Q[It.REFRESH]="".concat(Ot,".refresh"),Q[It.UNUSED_ENTITIES]="".concat(lt,".unused_entities.title"),Q[It.RELOAD_RESOURCES]="".concat(ut,".reload_resources"),Q[It.EDIT_DASHBOARD]="".concat(ut,".configure_ui"),Q[It.DIALOG_HISTORY]="".concat(Tt,".history"),Q[It.DIALOG_SETTINGS]="".concat(Tt,".settings"),Q[It.DIALOG_DISMISS]="".concat(Tt,".dismiss"),Q));!function(t){t.HOME_ASSISTANT="home-assistant",t.HA_PANEL_LOVELACE="ha-panel-lovelace",t.HUI_VIEW="hui-view",t.MENU_ITEM="ha-icon-button",t.MENU_ITEM_ICON="mwc-icon-button",t.BUTTON_MENU="ha-button-menu",t.OVERLAY_MENU_ITEM="mwc-list-item",t.TOOLBAR=".toolbar",t.ACTION_ITEMS=".action-items",t.HA_MORE_INFO_DIALOG="ha-more-info-dialog",t.HA_DIALOG="ha-dialog",t.HA_DIALOG_HEADER="ha-dialog-header",t.HA_DIALOG_MORE_INFO="ha-more-info-info",t.HA_DIALOG_HISTORY="ha-more-info-history",t.HA_DIALOG_LOGBOOK="ha-more-info-logbook",t.HA_DIALOG_MORE_INFO_CONTENT="more-info-content",t.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",t.HA_DIALOG_DEFAULT="more-info-default",t.HA_DIALOG_TIMER="more-info-timer",t.HA_DIALOG_VACUUM="more-info-vacuum",t.HA_DIALOG_SIREN="more-info-siren",t.HA_DIALOG_MEDIA_PLAYER="more-info-media_player",t.HA_DIALOG_LIGHT="more-info-light",t.HA_DIALOG_UPDATE="more-info-update",t.HA_DIALOG_CLIMATE="more-info-climate",t.HA_DIALOG_CLIMATE_CONTROL_SELECT="ha-more-info-control-select-container",t.HA_DIALOG_CLIMATE_TEMPERATURE="ha-more-info-climate-temperature",t.HA_STATE_CONTROL_CLIMATE_TEMPERATURE="ha-state-control-climate-temperature",t.HA_DIALOG_CLIMATE_TEMPERATURE_BUTTONS=".buttons",t.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER="ha-control-circular-slider",t.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION="#interaction",t.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_SLIDER='path[role="slider"]',t.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET=".target",t.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET_BORDER=".target-border",t.HA_DIALOG_LIGHT_BRIGHTNESS="ha-state-control-light-brightness",t.HA_DIALOG_LIGHT_CONTROLS="ha-icon-button-group",t.HA_DIALOG_LIGHT_COLORS="ha-more-info-light-favorite-colors",t.HA_DIALOG_LIGHT_SETTINGS="ha-more-info-control-select-container",t.HA_DIALOG_ATTRIBUTES="ha-attributes"}(ht||(ht={}));var Lt,dt="true",St="state_changed",Ht="hass-toggle-menu",Rt=function(t){return Array.isArray(t)?t:[t]},Nt=function(t){return t instanceof ShadowRoot?t.host.localName:t.localName},ft=function(t){var e=Nt(t);return t.querySelector("#".concat(ct,"_").concat(e))},pt=function(t,e){if(e){var n=Nt(e),o=ft(e);o||((o=document.createElement("style")).setAttribute("id","".concat(ct,"_").concat(n)),e.appendChild(o)),o.innerHTML=t}},Gt=function(t){t&&Rt(t).forEach((function(t){var e=Nt(t);ft(t)&&t.querySelector("#".concat(ct,"_").concat(e)).remove()}))},vt=function(t){var e=t.replace(/(?:^|_)([a-z])/g,(function(t,e){return e.toUpperCase()}));return"km".concat(e)},Ct=function(t){var e=new URLSearchParams(window.location.search);return Rt(t).some((function(t){return e.has(t)}))},mt=function(t,e){Rt(t).forEach((function(t){return window.localStorage.setItem(vt(t),e)}))},Mt=function(t){return Rt(t).some((function(t){return window.localStorage.getItem(vt(t))===dt}))},yt=function(t){return Object.entries(t).map((function(t){var e=t[0],n=t[1];return"".concat(e,":").concat(n)})).join(";")+";"},wt=function(t){return Object.entries(t).map((function(t){var e=t[0],n=t[1];return"".concat(e,"{").concat(yt(n),"}")})).join("")},gt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map((function(t){return"".concat(t,"{display: none !important;}")})).join("")},bt=function(t){var e=0,n=Object.values(Dt);return new Promise((function(o,i){var r=function(){var _,s=null===(_=null==t?void 0:t.hass)||void 0===_?void 0:_.resources,a=!1;if(s){var c=t.hass.language;n.find((function(t){return!s[c][t]}))||(a=!0)}a?o(s):++e<500?setTimeout(r,50):i()};r()}))},Ut=function(t,e,n){return new Promise((function(o,i){var r=0,_=function(){var s=t();s&&e(s)?o(s):++r<500?setTimeout(_,50):i(new Error("".concat(at,": Cannot select ").concat(n," after ").concat(500," attempts. Giving up!")))};_()}))},Bt=function(t,e){t.forEach((function(t){if(t&&t.dataset&&!t.dataset.selector){var n=t.shadowRoot.querySelector(ht.MENU_ITEM_ICON);t.dataset.selector=e[n.title]}}))},Pt={HEADER:wt({"#view":{"min-height":"100vh !important","--header-height":"0px"},".header":{display:"none"}}),ACCOUNT:gt(".profile"),NOTIFICATIONS:gt(".notifications-container"),DIVIDER:gt(".divider"),PAPER_LISTBOX:function(t,e){var n=132;return t&&e?n=0:t?n-=50:e&&(n-=48),wt({"paper-listbox":{height:"calc(100% - var(--header-height) - ".concat(n,"px - env(safe-area-inset-bottom)) !important")}})},MENU_BUTTON:gt(".menu ha-icon-button"),MENU_BUTTON_BURGER:gt("ha-menu-button"),MOUSE:wt({"body::after":{bottom:"0",content:'""',cursor:"none",display:"block",left:"0",position:"fixed",right:"0",top:"0","z-index":"999999"}}),SIDEBAR:wt({":host":{"--mdc-drawer-width":"0 !important"},"partial-panel-resolver":{"--mdc-top-app-bar-width":"100% !important"},"ha-drawer > ha-sidebar":{display:"none"},".header":{width:"100% !important"}}),ASIDE:gt(".mdc-drawer"),OVERFLOW_MENU:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU)),BLOCK_OVERFLOW:wt((Lt={},Lt["".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU)]={"pointer-events":"none !important"},Lt)),SEARCH:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS,' > ha-icon-button[data-selector="').concat(It.SEARCH,'"]'),"".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.SEARCH,'"]')),ASSISTANT:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS,' > ha-icon-button[data-selector="').concat(It.ASSIST,'"]'),"".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.ASSIST,'"]')),REFRESH:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.REFRESH,'"]')),UNUSED_ENTITIES:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.UNUSED_ENTITIES,'"]')),RELOAD_RESOURCES:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.RELOAD_RESOURCES,'"]')),EDIT_DASHBOARD:gt("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS,' > ha-icon-button[data-selector="').concat(It.EDIT_DASHBOARD,'"]'),"".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.BUTTON_MENU," > ").concat(ht.OVERLAY_MENU_ITEM,'[data-selector="').concat(It.EDIT_DASHBOARD,'"]')),DIALOG_HEADER_HISTORY:gt("".concat(ht.HA_DIALOG_HEADER," > ").concat(ht.MENU_ITEM,'[data-selector="').concat(It.DIALOG_HISTORY,'"]')),DIALOG_HEADER_SETTINGS:gt("".concat(ht.HA_DIALOG_HEADER," > ").concat(ht.MENU_ITEM,'[data-selector="').concat(It.DIALOG_SETTINGS,'"]')),DIALOG_HEADER_OVERFLOW:gt("".concat(ht.HA_DIALOG_HEADER," > ").concat(ht.BUTTON_MENU)),DIALOG_HISTORY:gt(ht.HA_DIALOG_HISTORY),DIALOG_LOGBOOK:gt(ht.HA_DIALOG_LOGBOOK),DIALOG_ATTRIBUTES:gt(ht.HA_DIALOG_ATTRIBUTES),DIALOG_MEDIA_ACTIONS:gt(".controls"),DIALOG_TIMER_ACTIONS:gt(".actions"),DIALOG_UPDATE_ACTIONS:gt(".actions","hr:has(+ .actions)"),DIALOG_CLIMATE_CONTROL_SELECT:gt(ht.HA_DIALOG_CLIMATE_CONTROL_SELECT),DIALOG_CLIMATE_TEMPERATURE_BUTTONS:gt(ht.HA_DIALOG_CLIMATE_TEMPERATURE_BUTTONS),DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION:gt(ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION,ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_SLIDER,ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET_BORDER,ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET),DIALOG_LIGHT_CONTROL_ACTIONS:gt(".controls > ".concat(ht.HA_DIALOG_LIGHT_BRIGHTNESS," + ").concat(ht.HA_DIALOG_LIGHT_CONTROLS)),DIALOG_LIGHT_COLOR_ACTIONS:gt(".controls > ".concat(ht.HA_DIALOG_LIGHT_COLORS)),DIALOG_LIGHT_SETTINGS_ACTIONS:gt(".controls:has(> ".concat(ht.HA_DIALOG_LIGHT_BRIGHTNESS,") + div > ").concat(ht.HA_DIALOG_LIGHT_SETTINGS)),DIALOG_SHOW_MORE:gt(".header a")},Ft=function(){function e(){this.lines=[{content:"%c≡ kiosk-mode",color:"white",background:"#03a9f4"},{content:"%cversion ".concat("6.0.0")}]}return e.prototype.log=function(){var e=[],n=[],o=this.lines.length-1,i={"border-color":"#424242","border-style":"solid",display:"inline-block","font-family":"monospace","font-size":"12px"};this.lines.forEach((function(r,_){e.push(r.content.padEnd(27)),e.push("%c⋮"),_!==o&&e.push("%c\n");var s="0 0 0 1px",a="0 1px 0 1px";0===o?(s="1px 0 1px 1px",a="1px 1px 1px 0"):0===_?(s="1px 0 0 1px",a="1px 1px 0 0"):_===o&&(s="0 0 1px 1px",a="0 1px 1px 0"),n.push(yt(t(t({},i),{background:r.background||"white",color:r.color||"#424242",padding:0===_?"1px 0px 1px 5px":"1px 0px 1px 10px","border-width":s}))),n.push(yt(t(t({},i),{background:r.background||"white",color:r.color||"white",padding:0===_?"1px 5px":"1px 5px 1px 0px","border-width":a}))),_!==o&&n.push("")})),console.info.apply(console,function(t,e,n){if(n||2===arguments.length)for(var o,i=0,r=e.length;i<r;i++)!o&&i in e||(o||(o=Array.prototype.slice.call(e,0,i)),o[i]=e[i]);return t.concat(o||Array.prototype.slice.call(e))}([e.join("")],n,!1))},e}(),xt=function(){function t(){var t=this;Ct(Z.CLEAR_CACHE)&&Object.values(X).forEach((function(t){window.localStorage.removeItem(vt(t))})),window.kioskModeEntities={},this.options={};var o=new st;o.addEventListener(b.ON_LOVELACE_PANEL_LOAD,(function(o){return e(t,void 0,void 0,(function(){var t,e,i,r,_,s,a,c,I,E,O,A,l,u,T,h,D=this;return n(this,(function(n){switch(n.label){case 0:return this.HAElements=o.detail,t=this.HAElements,e=t.HOME_ASSISTANT,i=t.HOME_ASSISTANT_MAIN,r=t.HUI_ROOT,_=t.HA_DRAWER,s=t.HEADER,a=t.HA_SIDEBAR,c=this,[4,e.element];case 1:return c.ha=n.sent(),I=this,[4,i.selector.$.element];case 2:return I.main=n.sent(),E=this,[4,r.selector.$.element];case 3:return E.huiRoot=n.sent(),O=this,[4,_.element];case 4:return O.drawerLayout=n.sent(),A=this,[4,s.selector.query(ht.TOOLBAR).element];case 5:return A.appToolbar=n.sent(),l=this,[4,a.selector.$.element];case 6:return l.sideBarRoot=n.sent(),u=this,[4,Ut((function(){var t,e;return null===(e=null===(t=D.ha)||void 0===t?void 0:t.hass)||void 0===e?void 0:e.user}),(function(t){return!!t}),"".concat(ht.HOME_ASSISTANT," > hass > user"))];case 7:return u.user=n.sent(),this.version=function(t){var e=t?t.match(/^(\d+)\.(\d+)\.(\w+)(?:\.(\w+))?$/):null;return e?[+e[1],+e[2],e[3]]:null}(null===(h=null===(T=this.ha.hass)||void 0===T?void 0:T.config)||void 0===h?void 0:h.version),this.run(),[2]}}))}))})),o.addEventListener(b.ON_MORE_INFO_DIALOG_OPEN,(function(e){t.HAMoreInfoDialogElements=e.detail,t.insertMoreInfoDialogStyles()})),o.addEventListener(b.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN,(function(e){t.HAMoreInfoDialogElements=e.detail,t.insertMoreInfoDialogStyles()})),o.listen(),this.entityWatch(),this.resizeWindowBinded=this.resizeWindow.bind(this)}return t.prototype.run=function(){return e(this,void 0,void 0,(function(){var t,e=this;return n(this,(function(n){return(t=this.main.querySelector(ht.HA_PANEL_LOVELACE))?[2,Ut((function(){var e;return null===(e=null==t?void 0:t.lovelace)||void 0===e?void 0:e.config}),(function(t){return!!t}),"Lovelace config").then((function(t){return e.processConfig(t.kiosk_mode||{})}))]:[2]}))}))},t.prototype.runDialogs=function(t){var e,n;void 0===t&&(t=null===(n=null===(e=this.ha)||void 0===e?void 0:e.shadowRoot)||void 0===n?void 0:n.querySelector(ht.HA_MORE_INFO_DIALOG)),t&&this.insertMoreInfoDialogStyles()},t.prototype.processConfig=function(t){return e(this,void 0,void 0,(function(){var o,i,r,_,s,a=this;return n(this,(function(c){var I;return o=this.ha.hass.panelUrl,window.kioskModeEntities[o]||(window.kioskModeEntities[o]=[]),Object.values(X).forEach((function(t){a.options[t]=!1})),Object.values(J).forEach((function(t){a.options[t]=!1})),(I=this.ha,e(void 0,void 0,void 0,(function(){var t,e,o,i,r;return n(this,(function(n){switch(n.label){case 0:return[4,bt(I)];case 1:return t=n.sent(),e=I.hass.language,o=t[e],i=Object.entries(Dt),r=i.map((function(t){var e=t[0],n=t[1];return[o[n],e]})),[2,Object.fromEntries(r)]}}))}))).then((function(t){a.menuTranslations=t,a.updateMenuItemsLabels()})).catch((function(){console.warn("".concat(at,": ").concat("[ Non critial warning ]"," Cannot get resources translations"))})),Mt(Object.values(X))||Ct(Object.values(X))?Object.values(X).forEach((function(t){a.options[t]=Mt(t)||Ct(t)})):this.setOptions(t,!1),(i=this.user.is_admin?t.admin_settings:t.non_admin_settings)&&this.setOptions(i,!0),t.user_settings&&Rt(t.user_settings).forEach((function(t){Rt(t.users).some((function(t){return t.toLowerCase()===a.user.name.toLowerCase()}))&&a.setOptions(t,!0)})),(r=this.options[J.IGNORE_MOBILE_SETTINGS]?null:t.mobile_settings)&&(_=r.custom_width?r.custom_width:812,window.innerWidth<=_&&this.setOptions(r,!0)),(s=this.options[J.IGNORE_ENTITY_SETTINGS]?null:t.entity_settings)&&s.forEach((function(t){var e=Object.keys(t.entity)[0];window.kioskModeEntities[o].includes(e)||window.kioskModeEntities[o].push(e),a.ha.hass.states[e].state==t.entity[e]&&a.setOptions(t,!1)})),Ct(Z.DISABLE_KIOSK_MODE)&&!this.options[J.IGNORE_DISABLE_KM]||this.insertStyles(),[2]}))}))},t.prototype.insertStyles=function(){var t,e,n,o;if(this.options[X.KIOSK]||this.options[X.HIDE_HEADER]?(pt(Pt.HEADER,this.huiRoot),Ct(Z.CACHE)&&mt(X.HIDE_HEADER,dt)):Gt(this.huiRoot),null===(e=null===(t=this.main)||void 0===t?void 0:t.host)||void 0===e||e.removeEventListener(Ht,this.blockEventHandler,!0),this.options[X.KIOSK]||this.options[X.HIDE_SIDEBAR]?(null===(o=null===(n=this.main)||void 0===n?void 0:n.host)||void 0===o||o.addEventListener(Ht,this.blockEventHandler,!0),pt(Pt.SIDEBAR,this.drawerLayout),pt(Pt.ASIDE,this.drawerLayout.shadowRoot),Ct(Z.CACHE)&&mt(X.HIDE_SIDEBAR,dt)):(Gt(this.drawerLayout),Gt(this.drawerLayout.shadowRoot)),this.options[X.HIDE_ACCOUNT]||this.options[X.HIDE_NOTIFICATIONS]||this.options[X.HIDE_MENU_BUTTON]){var i=[this.options[X.HIDE_ACCOUNT]?Pt.ACCOUNT:"",this.options[X.HIDE_NOTIFICATIONS]?Pt.NOTIFICATIONS:"",this.options[X.HIDE_ACCOUNT]&&this.options[X.HIDE_NOTIFICATIONS]?Pt.DIVIDER:"",this.options[X.HIDE_ACCOUNT]||this.options[X.HIDE_NOTIFICATIONS]?Pt.PAPER_LISTBOX(this.options[X.HIDE_ACCOUNT],this.options[X.HIDE_NOTIFICATIONS]):"",this.options[X.HIDE_MENU_BUTTON]?Pt.MENU_BUTTON:""];pt(i.join(""),this.sideBarRoot),Ct(Z.CACHE)&&(this.options[X.HIDE_ACCOUNT]&&mt(X.HIDE_ACCOUNT,dt),this.options[X.HIDE_NOTIFICATIONS]&&mt(X.HIDE_NOTIFICATIONS,dt))}else Gt(this.sideBarRoot);if(this.options[X.HIDE_SEARCH]||this.options[X.HIDE_ASSISTANT]||this.options[X.HIDE_REFRESH]||this.options[X.HIDE_UNUSED_ENTITIES]||this.options[X.HIDE_RELOAD_RESOURCES]||this.options[X.HIDE_EDIT_DASHBOARD]||this.options[X.HIDE_OVERFLOW]||this.options[X.BLOCK_OVERFLOW]||this.options[X.HIDE_SIDEBAR]||this.options[X.HIDE_MENU_BUTTON]){i=[this.options[X.HIDE_SEARCH]?Pt.SEARCH:"",this.options[X.HIDE_ASSISTANT]?Pt.ASSISTANT:"",this.options[X.HIDE_REFRESH]?Pt.REFRESH:"",this.options[X.HIDE_UNUSED_ENTITIES]?Pt.UNUSED_ENTITIES:"",this.options[X.HIDE_RELOAD_RESOURCES]?Pt.RELOAD_RESOURCES:"",this.options[X.HIDE_EDIT_DASHBOARD]?Pt.EDIT_DASHBOARD:"",this.options[X.HIDE_OVERFLOW]?Pt.OVERFLOW_MENU:"",this.options[X.BLOCK_OVERFLOW]?Pt.BLOCK_OVERFLOW:"",this.options[X.HIDE_MENU_BUTTON]||this.options[X.HIDE_SIDEBAR]?Pt.MENU_BUTTON_BURGER:""];pt(i.join(""),this.appToolbar),Ct(Z.CACHE)&&(this.options[X.HIDE_SEARCH]&&mt(X.HIDE_SEARCH,dt),this.options[X.HIDE_ASSISTANT]&&mt(X.HIDE_ASSISTANT,dt),this.options[X.HIDE_REFRESH]&&mt(X.HIDE_REFRESH,dt),this.options[X.HIDE_UNUSED_ENTITIES]&&mt(X.HIDE_UNUSED_ENTITIES,dt),this.options[X.HIDE_RELOAD_RESOURCES]&&mt(X.HIDE_RELOAD_RESOURCES,dt),this.options[X.HIDE_EDIT_DASHBOARD]&&mt(X.HIDE_EDIT_DASHBOARD,dt),this.options[X.HIDE_OVERFLOW]&&mt(X.HIDE_OVERFLOW,dt),this.options[X.BLOCK_OVERFLOW]&&mt(X.BLOCK_OVERFLOW,dt),this.options[X.HIDE_MENU_BUTTON]&&mt(X.HIDE_MENU_BUTTON,dt))}else Gt(this.appToolbar);this.options[X.BLOCK_MOUSE]?(pt(Pt.MOUSE,document.body),Ct(Z.CACHE)&&mt(X.BLOCK_MOUSE,dt)):Gt(document.body),window.removeEventListener("contextmenu",this.blockEventHandler,!0),this.options[X.BLOCK_CONTEXT_MENU]&&(window.addEventListener("contextmenu",this.blockEventHandler,!0),Ct(Z.CACHE)&&mt(X.BLOCK_CONTEXT_MENU,dt)),window.removeEventListener("resize",this.resizeWindowBinded),window.addEventListener("resize",this.resizeWindowBinded),window.dispatchEvent(new Event("resize"))},t.prototype.insertMoreInfoDialogStyles=function(){return e(this,void 0,void 0,(function(){var t,e,o,i,r,_,s,a,c=this;return n(this,(function(n){switch(n.label){case 0:return this.HAMoreInfoDialogElements.HA_DIALOG.selector.query("".concat(ht.HA_DIALOG_HEADER," > ").concat(ht.MENU_ITEM)).all.then((function(t){Bt(t,c.menuTranslations)})),[4,this.HAMoreInfoDialogElements.HA_DIALOG.element];case 1:return t=n.sent(),e=this.HAMoreInfoDialogElements.HA_DIALOG_CONTENT,[4,(o=e.selector.query("".concat(ht.HA_DIALOG_MORE_INFO,", ").concat(ht.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK)).$).element];case 2:return i=n.sent(),this.options[X.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[X.HIDE_DIALOG_HEADER_HISTORY]||this.options[X.HIDE_DIALOG_HEADER_SETTINGS]||this.options[X.HIDE_DIALOG_HEADER_OVERFLOW]?(a=[this.options[X.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[X.HIDE_DIALOG_HEADER_HISTORY]?Pt.DIALOG_HEADER_HISTORY:"",this.options[X.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[X.HIDE_DIALOG_HEADER_SETTINGS]?Pt.DIALOG_HEADER_SETTINGS:"",this.options[X.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[X.HIDE_DIALOG_HEADER_OVERFLOW]?Pt.DIALOG_HEADER_OVERFLOW:""],pt(a.join(""),t),Ct(Z.CACHE)&&(this.options[X.HIDE_DIALOG_HEADER_ACTION_ITEMS]&&mt(X.HIDE_DIALOG_HEADER_ACTION_ITEMS,dt),this.options[X.HIDE_DIALOG_HEADER_HISTORY]&&mt(X.HIDE_DIALOG_HEADER_HISTORY,dt),this.options[X.HIDE_DIALOG_HEADER_SETTINGS]&&mt(X.HIDE_DIALOG_HEADER_SETTINGS,dt),this.options[X.HIDE_DIALOG_HEADER_OVERFLOW]&&mt(X.HIDE_DIALOG_HEADER_OVERFLOW,dt))):Gt(t),r=o.query(ht.HA_DIALOG_MORE_INFO_CONTENT).$.query(ht.HA_DIALOG_CLIMATE).$,_=r.query(ht.HA_STATE_CONTROL_CLIMATE_TEMPERATURE).$,s=_.query(ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER).$,r.element.then((function(t){c.options[X.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[X.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS]?(pt(Pt.DIALOG_CLIMATE_CONTROL_SELECT,t),Ct(Z.CACHE)&&(c.options[X.HIDE_DIALOG_CLIMATE_ACTIONS]&&mt(X.HIDE_DIALOG_CLIMATE_ACTIONS,dt),c.options[X.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS]&&mt(X.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS,dt))):Gt(t)})),_.element.then((function(t){c.options[X.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[X.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]?(pt(Pt.DIALOG_CLIMATE_TEMPERATURE_BUTTONS,t),Ct(Z.CACHE)&&c.options[X.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]&&mt(X.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS,dt)):Gt(t)})),s.element.then((function(t){c.options[X.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[X.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]?pt(Pt.DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION,t):Gt(t)})),o.query(ht.HA_DIALOG_MORE_INFO_CONTENT).$.query([ht.HA_DIALOG_DEFAULT,ht.HA_DIALOG_VACUUM,ht.HA_DIALOG_TIMER,ht.HA_DIALOG_LIGHT,ht.HA_DIALOG_SIREN,ht.HA_DIALOG_MEDIA_PLAYER,ht.HA_DIALOG_UPDATE].join(",")).$.element.then((function(t){if(c.options[X.HIDE_DIALOG_ATTRIBUTES]||c.options[X.HIDE_DIALOG_TIMER_ACTIONS]||c.options[X.HIDE_DIALOG_MEDIA_ACTIONS]||c.options[X.HIDE_DIALOG_UPDATE_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_CONTROL_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_COLOR_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_SETTINGS_ACTIONS]){var e=[c.options[X.HIDE_DIALOG_ATTRIBUTES]?Pt.DIALOG_ATTRIBUTES:"",c.options[X.HIDE_DIALOG_TIMER_ACTIONS]&&t.host.localName===ht.HA_DIALOG_TIMER?Pt.DIALOG_TIMER_ACTIONS:"",c.options[X.HIDE_DIALOG_MEDIA_ACTIONS]&&t.host.localName===ht.HA_DIALOG_MEDIA_PLAYER?Pt.DIALOG_MEDIA_ACTIONS:"",c.options[X.HIDE_DIALOG_UPDATE_ACTIONS]&&t.host.localName===ht.HA_DIALOG_UPDATE?Pt.DIALOG_UPDATE_ACTIONS:"",c.options[X.HIDE_DIALOG_LIGHT_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_CONTROL_ACTIONS]?Pt.DIALOG_LIGHT_CONTROL_ACTIONS:"",c.options[X.HIDE_DIALOG_LIGHT_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_COLOR_ACTIONS]?Pt.DIALOG_LIGHT_COLOR_ACTIONS:"",c.options[X.HIDE_DIALOG_LIGHT_ACTIONS]||c.options[X.HIDE_DIALOG_LIGHT_SETTINGS_ACTIONS]?Pt.DIALOG_LIGHT_SETTINGS_ACTIONS:""];pt(e.join(""),t),Ct(Z.CACHE)&&(c.options[X.HIDE_DIALOG_ATTRIBUTES]&&mt(X.HIDE_DIALOG_ATTRIBUTES,dt),c.options[X.HIDE_DIALOG_TIMER_ACTIONS]&&mt(X.HIDE_DIALOG_TIMER_ACTIONS,dt),c.options[X.HIDE_DIALOG_MEDIA_ACTIONS]&&mt(X.HIDE_DIALOG_MEDIA_ACTIONS,dt),c.options[X.HIDE_DIALOG_UPDATE_ACTIONS]&&mt(X.HIDE_DIALOG_UPDATE_ACTIONS,dt),c.options[X.HIDE_DIALOG_LIGHT_ACTIONS]&&mt(X.HIDE_DIALOG_LIGHT_ACTIONS,dt),c.options[X.HIDE_DIALOG_LIGHT_CONTROL_ACTIONS]&&mt(X.HIDE_DIALOG_LIGHT_CONTROL_ACTIONS,dt),c.options[X.HIDE_DIALOG_LIGHT_COLOR_ACTIONS]&&mt(X.HIDE_DIALOG_LIGHT_COLOR_ACTIONS,dt),c.options[X.HIDE_DIALOG_LIGHT_SETTINGS_ACTIONS]&&mt(X.HIDE_DIALOG_LIGHT_SETTINGS_ACTIONS,dt))}else Gt(t)})),this.options[X.HIDE_DIALOG_HISTORY]||this.options[X.HIDE_DIALOG_LOGBOOK]?(a=[this.options[X.HIDE_DIALOG_HISTORY]?Pt.DIALOG_HISTORY:"",this.options[X.HIDE_DIALOG_LOGBOOK]?Pt.DIALOG_LOGBOOK:""],pt(a.join(""),i),Ct(Z.CACHE)&&(this.options[X.HIDE_DIALOG_HISTORY]&&mt(X.HIDE_DIALOG_HISTORY,dt),this.options[X.HIDE_DIALOG_LOGBOOK]&&mt(X.HIDE_DIALOG_LOGBOOK,dt))):Gt(i),o.query(ht.HA_DIALOG_HISTORY).$.element.then((function(t){c.options[X.HIDE_DIALOG_HISTORY_SHOW_MORE]?(pt(Pt.DIALOG_SHOW_MORE,t),Ct(Z.CACHE)&&mt(X.HIDE_DIALOG_HISTORY_SHOW_MORE,dt)):Gt(t)})),o.query(ht.HA_DIALOG_LOGBOOK).$.element.then((function(t){c.options[X.HIDE_DIALOG_LOGBOOK_SHOW_MORE]?(pt(Pt.DIALOG_SHOW_MORE,t),Ct(Z.CACHE)&&mt(X.HIDE_DIALOG_LOGBOOK_SHOW_MORE,dt)):Gt(t)})),[2]}}))}))},t.prototype.resizeWindow=function(){var t=this;window.clearTimeout(this.resizeDelay),this.resizeDelay=window.setTimeout((function(){t.updateMenuItemsLabels()}),250)},t.prototype.updateMenuItemsLabels=function(){var t=this;this.menuTranslations&&(this.HAElements.HEADER.selector.query("".concat(ht.TOOLBAR," > ").concat(ht.ACTION_ITEMS," > ").concat(ht.MENU_ITEM)).all.then((function(e){Bt(e,t.menuTranslations)})),this.user.is_admin&&this.HAElements.HEADER.selector.query("".concat(ht.TOOLBAR," ").concat(ht.OVERLAY_MENU_ITEM)).all.then((function(e){e.forEach((function(e){if(e&&e.dataset&&!e.dataset.selector){var n=e.textContent.trim();e.dataset.selector=t.menuTranslations[n]}}))})))},t.prototype.entityWatch=function(){return e(this,void 0,void 0,(function(){var t=this;return n(this,(function(e){switch(e.label){case 0:return[4,window.hassConnection];case 1:return e.sent().conn.subscribeMessage((function(e){return t.entityWatchCallback(e)}),{type:"subscribe_events",event_type:St}),[2]}}))}))},t.prototype.entityWatchCallback=function(t){return e(this,void 0,void 0,(function(){var e,o,i;return n(this,(function(n){switch(n.label){case 0:return!(e=window.kioskModeEntities[null===(i=null===(o=this.ha)||void 0===o?void 0:o.hass)||void 0===i?void 0:i.panelUrl]||[]).length||t.event_type!==St||!e.includes(t.data.entity_id)||t.data.old_state&&t.data.new_state.state===t.data.old_state.state?[3,2]:[4,this.run()];case 1:n.sent(),this.runDialogs(),n.label=2;case 2:return[2]}}))}))},t.prototype.blockEventHandler=function(t){t.preventDefault(),t.stopImmediatePropagation()},t.prototype.setOptions=function(t,e){var n=this;Object.values(X).forEach((function(e){e in t&&(n.options[e]=t[e])})),e&&Object.values(J).forEach((function(e){e in t&&(n.options[e]=t[e])}))},t}();(new Ft).log(),Promise.resolve(customElements.whenDefined(ht.HUI_VIEW)).then((function(){window.KioskMode=new xt}))}();
|