2 lines
43 KiB
JavaScript
2 lines
43 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,E=10,O=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 I(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 h(){return"You can not select a shadowRoot (".concat(_,") of the document.")}function D(){return"You can not select a shadowRoot (".concat(_,") of a shadowRoot.")}function T(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(h());if(e instanceof ShadowRoot)throw new SyntaxError(D());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 d(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=T(o,e);return(null===(n=null==r?void 0:r.shadowRoot)||void 0===n?void 0:n.querySelectorAll("".concat(s," ").concat(i)))||null}function L(t,e){if(1===t.length&&!t[0].length){if(e instanceof Document)throw new SyntaxError(h());if(e instanceof ShadowRoot)throw new SyntaxError(D());return e.shadowRoot}var n=T(t,e);return(null==n?void 0:n.shadowRoot)||null}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="querySelector"),void 0===o&&(o="shadowRootQuerySelector");for(var i=I(t,(function(t){if(!t[t.length-1].length)throw new SyntaxError(l(n,o));return t})),r=i.length,_=0;_<r;_++){var s=T(i[_],e);if(s)return s}return null}(t,e,"asyncQuerySelector","asyncShadowRootQuerySelector")}),(function(t){return!!t}),n,o)]}))}))}function f(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=I(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 _=d(o[r],e);if(null==_?void 0:_.length)return _}return document.querySelectorAll(a)}(t,e,"asyncQuerySelectorAll")}),(function(t){return!!t.length}),n,o)]}))}))}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="shadowRootQuerySelector"),void 0===o&&(o="querySelector");for(var i=I(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=L(i[s],e);if(a)return a}return null}(t,e,"asyncShadowRootQuerySelector","asyncQuerySelector")}),(function(t){return!!t}),n,o)]}))}))}var H=function(t,e){var n=t.querySelectorAll(e);if(n.length)return n;if(t instanceof Element&&t.shadowRoot){var o=H(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=H(_,e);if(s.length)return s}return document.querySelectorAll(a)},p=function(t,e,n,o){return A((function(){return H(t,e)}),(function(t){return!!t.length}),n,o)};function N(){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 O(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)||E)]):[3,2];case 1:case 3:return[2,r.sent()];case 2:return i=t[0],_=t[1],[4,R(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||E)]}}))}))}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 O(t)?(e=t[0],n=t[1],o=t[2],[4,f(n,e,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||E)]):[3,2];case 1:return[2,r.sent()];case 2:return i=t[0],_=t[1],[2,f(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||E)]}}))}))}function C(){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 O(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)||E)]):[3,2];case 1:return[2,r.sent()];case 2:return i=t[0],_=t[1],[2,S(i,document,(null==_?void 0:_.retries)||c,(null==_?void 0:_.delay)||E)]}}))}))}var G=function(){function t(t,e){t instanceof Node||t instanceof Promise?(this._element=t,this._asyncParams=o({retries:c,delay:E},e||{})):(this._element=document,this._asyncParams=o({retries:c,delay:E},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?C(t[0],_,e._asyncParams):C(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?v(t[0],e,n._asyncParams):v(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 p(t,e,n._asyncParams.retries,n._asyncParams.delay)}))):p(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,U,b,B,P,F,V,x,k,W,K,Y,j,q,$,z="$",Q={retries:100,delay:50};!function(t){t.HOME_ASSISTANT="HOME_ASSISTANT",t.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",t.HA_DRAWER="HA_DRAWER",t.HA_SIDEBAR="HA_SIDEBAR"}(y||(y={})),function(t){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"}(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_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",t.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaceMoreInfoDialogOpen",t.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaceHistoryAndLogBookDialogOpen",t.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaceSettingsDialogOpen"}(U||(U={})),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"}($||($={}));var X,J,Z,tt,et=((b={})[y.HOME_ASSISTANT]={selector:$.HOME_ASSISTANT,children:{shadowRoot:{selector:z,children:(B={},B[y.HOME_ASSISTANT_MAIN]={selector:$.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:z,children:(P={},P[y.HA_DRAWER]={selector:$.HA_DRAWER,children:(F={},F[y.HA_SIDEBAR]={selector:$.HA_SIDEBAR,children:{shadowRoot:{selector:z}}},F)},P)}}},B)}}},b),nt=((V={})[w.PARTIAL_PANEL_RESOLVER]={selector:$.PARTIAL_PANEL_RESOLVER,children:(x={},x[w.HA_PANEL_LOVELACE]={selector:$.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:z,children:(k={},k[w.HUI_ROOT]={selector:$.HUI_ROOT,children:{shadowRoot:{selector:z,children:(W={},W[w.HEADER]={selector:$.HEADER},W[w.HUI_VIEW]={selector:$.HUI_VIEW},W)}}},k)}}},x)},V),ot={shadowRoot:{selector:z,children:(K={},K[g.HA_MORE_INFO_DIALOG]={selector:$.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:z,children:(Y={},Y[g.HA_DIALOG]={selector:$.HA_DIALOG,children:(j={},j[g.HA_DIALOG_CONTENT]={selector:$.HA_DIALOG_CONTENT,children:(q={},q[g.HA_MORE_INFO_DIALOG_INFO]={selector:$.HA_MORE_INFO_DIALOG_INFO},q[g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]={selector:$.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},q[g.HA_DIALOG_MORE_INFO_SETTINGS]={selector:$.HA_DIALOG_MORE_INFO_SETTINGS},q)},j)},Y)}}},K)}},it=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===z&&n)return _.children?M(M({},e),it(t,_.children,n,!0)):e;var s=n?n.then((function(e){return N(e,(n=_.selector,o?"$ "+n:n),t);var n})):N(_.selector,t);return e[r]={element:s,children:it(t,_.children,s),selector:new G(s,t)},e}),{})},rt=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=rt(t,i[1].children);if(r)return r}},_t=function(t,e){return Object.keys(t).reduce((function(t,n){var o=rt(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}),{})},st=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}(),at=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n._config=M(M({},Q),e),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){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=it(this._config,ot,this._haRootElements.HOME_ASSISTANT.element);var o=_t(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]=U.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,e[g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=U.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,e[g.HA_DIALOG_MORE_INFO_SETTINGS]=U.ON_LOVELACE_SETTINGS_DIALOG_OPEN,e);this._dispatchEvent(i[t],this._haDialogElements)},e.prototype._updateRootElements=function(){var t=this;this._homeAssistantRootTree=it(this._config,et),this._haRootElements=_t(y,this._homeAssistantRootTree),this._haRootElements[y.HOME_ASSISTANT].selector.$.element.then((function(e){t._dialogsObserver.disconnect(),t._dialogsObserver.observe(e,{childList:!0})}))},e.prototype._updateResolverElements=function(){var t=this,e=Date.now();e-this._timestap<500||(this._timestap=e,this._homeAssistantResolverTree=it(this._config,nt,this._haRootElements[y.HA_DRAWER].element),this._haResolverElements=_t(w,this._homeAssistantResolverTree),this._haResolverElements[w.PARTIAL_PANEL_RESOLVER].element.then((function(e){t._panelResolverObserver.disconnect(),t._panelResolverObserver.observe(e,{childList:!0})})),this._haResolverElements[w.HA_PANEL_LOVELACE].selector.$.element.then((function(e){t._lovelaceObserver.disconnect(),t._lovelaceObserver.observe(e,{childList:!0})})),this._dispatchEvent(U.ON_LOVELACE_PANEL_LOAD,M(M({},this._haRootElements),this._haResolverElements)))},e.prototype._watchDialogs=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===$.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={})[$.HA_MORE_INFO_DIALOG_INFO]=g.HA_MORE_INFO_DIALOG_INFO,n[$.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,n[$.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){t.localName===$.HA_PANEL_LOVELACE&&e._updateResolverElements()}))}))},e.prototype._watchLovelace=function(t){var e=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===$.HUI_ROOT&&e._updateResolverElements()}))}))},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._updateResolverElements()},e.prototype.addEventListener=function(e,n,o){t.prototype.addEventListener.call(this,e,n,o)},e}(st),ct="kiosk-mode",Et="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_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"}(J||(J={})),function(t){t.IGNORE_ENTITY_SETTINGS="ignore_entity_settings",t.IGNORE_MOBILE_SETTINGS="ignore_mobile_settings",t.IGNORE_DISABLE_KM="ignore_disable_km"}(Z||(Z={})),function(t){t.CACHE="cache",t.CLEAR_CACHE="clear_km_cache",t.DISABLE_KIOSK_MODE="disable_km"}(tt||(tt={}));var Ot,It="ui",At="".concat(It,".common"),lt="".concat(It,".panel"),ut="".concat(lt,".lovelace"),ht="".concat(ut,".menu"),Dt="".concat(It,".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"}(Ot||(Ot={}));var Tt,dt=Object.freeze(((X={})[Ot.SEARCH]="".concat(ht,".search"),X[Ot.ASSIST]="".concat(ht,".assist"),X[Ot.REFRESH]="".concat(At,".refresh"),X[Ot.UNUSED_ENTITIES]="".concat(ut,".unused_entities.title"),X[Ot.RELOAD_RESOURCES]="".concat(ht,".reload_resources"),X[Ot.EDIT_DASHBOARD]="".concat(ht,".configure_ui"),X[Ot.DIALOG_HISTORY]="".concat(Dt,".history"),X[Ot.DIALOG_SETTINGS]="".concat(Dt,".settings"),X[Ot.DIALOG_DISMISS]="".concat(Dt,".dismiss"),X));!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_ATTRIBUTES="ha-attributes"}(Tt||(Tt={}));var Lt,Rt="true",ft="state_changed",St="hass-toggle-menu",Ht=function(t){return Array.isArray(t)?t:[t]},pt=function(t){return t instanceof ShadowRoot?t.host.localName:t.localName},Nt=function(t){var e=pt(t);return t.querySelector("#".concat(Et,"_").concat(e))},vt=function(t,e){if(e){var n=pt(e),o=Nt(e);o||((o=document.createElement("style")).setAttribute("id","".concat(Et,"_").concat(n)),e.appendChild(o)),o.innerHTML=t}},Ct=function(t){t&&Ht(t).forEach((function(t){var e=pt(t);Nt(t)&&t.querySelector("#".concat(Et,"_").concat(e)).remove()}))},Gt=function(t){var e=t.replace(/(?:^|_)([a-z])/g,(function(t,e){return e.toUpperCase()}));return"km".concat(e)},mt=function(t){var e=new URLSearchParams(window.location.search);return Ht(t).some((function(t){return e.has(t)}))},Mt=function(t,e){Ht(t).forEach((function(t){return window.localStorage.setItem(Gt(t),e)}))},yt=function(t){return Ht(t).some((function(t){return window.localStorage.getItem(Gt(t))===Rt}))},wt=function(t){return Object.entries(t).map((function(t){var e=t[0],n=t[1];return"".concat(e,":").concat(n)})).join(";")+";"},gt=function(t){return Object.entries(t).map((function(t){var e=t[0],n=t[1];return"".concat(e,"{").concat(wt(n),"}")})).join("")},Ut=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()}))},Bt=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(ct,": Cannot select ").concat(n," after ").concat(500," attempts. Giving up!")))};_()}))},Pt=function(t,e){t.forEach((function(t){if(t&&t.dataset&&!t.dataset.selector){var n=t.shadowRoot.querySelector(Tt.MENU_ITEM_ICON);t.dataset.selector=e[n.title]}}))},Ft={HEADER:gt({"#view":{"min-height":"100vh !important","--header-height":"0px"},".header":{display:"none"}}),ACCOUNT:Ut(".profile"),NOTIFICATIONS:Ut(".notifications-container"),DIVIDER:Ut(".divider"),PEPER_LISTBOX:function(t,e){var n=132;return t&&e?n=0:t?n-=50:e&&(n-=48),gt({"paper-listbox":{height:"calc(100% - var(--header-height) - ".concat(n,"px - env(safe-area-inset-bottom)) !important")}})},MENU_BUTTON:Ut(".menu ha-icon-button"),MENU_BUTTON_BURGER:Ut("ha-menu-button"),MOUSE:gt({"body::after":{bottom:"0",content:'""',cursor:"none",display:"block",left:"0",position:"fixed",right:"0",top:"0","z-index":"999999"}}),SIDEBAR:gt({":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:Ut(".mdc-drawer"),OVERFLOW_MENU:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU)),BLOCK_OVERFLOW:gt((Lt={},Lt["".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU)]={"pointer-events":"none !important"},Lt)),SEARCH:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS,' > ha-icon-button[data-selector="').concat(Ot.SEARCH,'"]'),"".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.SEARCH,'"]')),ASSISTANT:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS,' > ha-icon-button[data-selector="').concat(Ot.ASSIST,'"]'),"".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.ASSIST,'"]')),REFRESH:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.REFRESH,'"]')),UNUSED_ENTITIES:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.UNUSED_ENTITIES,'"]')),RELOAD_RESOURCES:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.RELOAD_RESOURCES,'"]')),EDIT_DASHBOARD:Ut("".concat(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.BUTTON_MENU," > ").concat(Tt.OVERLAY_MENU_ITEM,'[data-selector="').concat(Ot.EDIT_DASHBOARD,'"]')),DIALOG_HEADER_HISTORY:Ut("".concat(Tt.HA_DIALOG_HEADER," > ").concat(Tt.MENU_ITEM,'[data-selector="').concat(Ot.DIALOG_HISTORY,'"]')),DIALOG_HEADER_SETTINGS:Ut("".concat(Tt.HA_DIALOG_HEADER," > ").concat(Tt.MENU_ITEM,'[data-selector="').concat(Ot.DIALOG_SETTINGS,'"]')),DIALOG_HEADER_OVERFLOW:Ut("".concat(Tt.HA_DIALOG_HEADER," > ").concat(Tt.BUTTON_MENU)),DIALOG_HISTORY:Ut(Tt.HA_DIALOG_HISTORY),DIALOG_LOGBOOK:Ut(Tt.HA_DIALOG_LOGBOOK),DIALOG_ATTRIBUTES:Ut(Tt.HA_DIALOG_ATTRIBUTES),DIALOG_MEDIA_ACTIONS:Ut(".controls"),DIALOG_TIMER_ACTIONS:Ut(".actions"),DIALOG_UPDATE_ACTIONS:Ut(".actions","hr:has(+ .actions)"),DIALOG_CLIMATE_CONTROL_SELECT:Ut(Tt.HA_DIALOG_CLIMATE_CONTROL_SELECT),DIALOG_CLIMATE_TEMPERATURE_BUTTONS:Ut(Tt.HA_DIALOG_CLIMATE_TEMPERATURE_BUTTONS),DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION:Ut(Tt.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION,Tt.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_SLIDER,Tt.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET_BORDER,Tt.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION_TARGET),DIALOG_SHOW_MORE:Ut(".header a")},Vt=function(){function e(){this.lines=[{content:"%c≡ kiosk-mode",color:"white",background:"#03a9f4"},{content:"%cversion ".concat("5.1.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(wt(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(wt(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;mt(tt.CLEAR_CACHE)&&Object.values(J).forEach((function(t){window.localStorage.removeItem(Gt(t))})),window.kioskModeEntities={},this.options={};var o=new at;o.addEventListener(U.ON_LOVELACE_PANEL_LOAD,(function(o){return e(t,void 0,void 0,(function(){var t,e,i,r,_,s,a,c,E,O,I,A,l,u,h,D,T=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(),E=this,[4,i.selector.$.element];case 2:return E.main=n.sent(),O=this,[4,r.selector.$.element];case 3:return O.huiRoot=n.sent(),I=this,[4,_.element];case 4:return I.drawerLayout=n.sent(),A=this,[4,s.selector.query(Tt.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,Bt((function(){var t,e;return null===(e=null===(t=T.ha)||void 0===t?void 0:t.hass)||void 0===e?void 0:e.user}),(function(t){return!!t}),"".concat(Tt.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===(D=null===(h=this.ha.hass)||void 0===h?void 0:h.config)||void 0===D?void 0:D.version),this.run(),[2]}}))}))})),o.addEventListener(U.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,(function(e){t.HAMoreInfoDialogElements=e.detail,t.insertMoreInfoDialogStyles()})),o.addEventListener(U.ON_LOVELACE_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(Tt.HA_PANEL_LOVELACE))?[2,Bt((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(Tt.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 E;return o=this.ha.hass.panelUrl,window.kioskModeEntities[o]||(window.kioskModeEntities[o]=[]),Object.values(J).forEach((function(t){a.options[t]=!1})),Object.values(Z).forEach((function(t){a.options[t]=!1})),(E=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(E)];case 1:return t=n.sent(),e=E.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(ct,": ").concat("[ Non critial warning ]"," Cannot get resources translations"))})),yt(Object.values(J))||mt(Object.values(J))?Object.values(J).forEach((function(t){a.options[t]=yt(t)||mt(t)})):this.setOptions(t,!1),(i=this.user.is_admin?t.admin_settings:t.non_admin_settings)&&this.setOptions(i,!0),t.user_settings&&Ht(t.user_settings).forEach((function(t){Ht(t.users).some((function(t){return t.toLowerCase()===a.user.name.toLowerCase()}))&&a.setOptions(t,!0)})),(r=this.options[Z.IGNORE_MOBILE_SETTINGS]?null:t.mobile_settings)&&(_=r.custom_width?r.custom_width:812,window.innerWidth<=_&&this.setOptions(r,!0)),(s=this.options[Z.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)})),mt(tt.DISABLE_KIOSK_MODE)&&!this.options[Z.IGNORE_DISABLE_KM]||this.insertStyles(),[2]}))}))},t.prototype.insertStyles=function(){var t,e,n,o;if(this.options[J.KIOSK]||this.options[J.HIDE_HEADER]?(vt(Ft.HEADER,this.huiRoot),mt(tt.CACHE)&&Mt(J.HIDE_HEADER,Rt)):Ct(this.huiRoot),null===(e=null===(t=this.main)||void 0===t?void 0:t.host)||void 0===e||e.removeEventListener(St,this.blockEventHandler,!0),this.options[J.KIOSK]||this.options[J.HIDE_SIDEBAR]?(null===(o=null===(n=this.main)||void 0===n?void 0:n.host)||void 0===o||o.addEventListener(St,this.blockEventHandler,!0),vt(Ft.SIDEBAR,this.drawerLayout),vt(Ft.ASIDE,this.drawerLayout.shadowRoot),mt(tt.CACHE)&&Mt(J.HIDE_SIDEBAR,Rt)):(Ct(this.drawerLayout),Ct(this.drawerLayout.shadowRoot)),this.options[J.HIDE_ACCOUNT]||this.options[J.HIDE_NOTIFICATIONS]||this.options[J.HIDE_MENU_BUTTON]){var i=[this.options[J.HIDE_ACCOUNT]?Ft.ACCOUNT:"",this.options[J.HIDE_NOTIFICATIONS]?Ft.NOTIFICATIONS:"",this.options[J.HIDE_ACCOUNT]&&this.options[J.HIDE_NOTIFICATIONS]?Ft.DIVIDER:"",this.options[J.HIDE_ACCOUNT]||this.options[J.HIDE_NOTIFICATIONS]?Ft.PEPER_LISTBOX(this.options[J.HIDE_ACCOUNT],this.options[J.HIDE_NOTIFICATIONS]):"",this.options[J.HIDE_MENU_BUTTON]?Ft.MENU_BUTTON:""];vt(i.join(""),this.sideBarRoot),mt(tt.CACHE)&&(this.options[J.HIDE_ACCOUNT]&&Mt(J.HIDE_ACCOUNT,Rt),this.options[J.HIDE_NOTIFICATIONS]&&Mt(J.HIDE_NOTIFICATIONS,Rt))}else Ct(this.sideBarRoot);if(this.options[J.HIDE_SEARCH]||this.options[J.HIDE_ASSISTANT]||this.options[J.HIDE_REFRESH]||this.options[J.HIDE_UNUSED_ENTITIES]||this.options[J.HIDE_RELOAD_RESOURCES]||this.options[J.HIDE_EDIT_DASHBOARD]||this.options[J.HIDE_OVERFLOW]||this.options[J.BLOCK_OVERFLOW]||this.options[J.HIDE_SIDEBAR]||this.options[J.HIDE_MENU_BUTTON]){i=[this.options[J.HIDE_SEARCH]?Ft.SEARCH:"",this.options[J.HIDE_ASSISTANT]?Ft.ASSISTANT:"",this.options[J.HIDE_REFRESH]?Ft.REFRESH:"",this.options[J.HIDE_UNUSED_ENTITIES]?Ft.UNUSED_ENTITIES:"",this.options[J.HIDE_RELOAD_RESOURCES]?Ft.RELOAD_RESOURCES:"",this.options[J.HIDE_EDIT_DASHBOARD]?Ft.EDIT_DASHBOARD:"",this.options[J.HIDE_OVERFLOW]?Ft.OVERFLOW_MENU:"",this.options[J.BLOCK_OVERFLOW]?Ft.BLOCK_OVERFLOW:"",this.options[J.HIDE_MENU_BUTTON]||this.options[J.HIDE_SIDEBAR]?Ft.MENU_BUTTON_BURGER:""];vt(i.join(""),this.appToolbar),mt(tt.CACHE)&&(this.options[J.HIDE_SEARCH]&&Mt(J.HIDE_SEARCH,Rt),this.options[J.HIDE_ASSISTANT]&&Mt(J.HIDE_ASSISTANT,Rt),this.options[J.HIDE_REFRESH]&&Mt(J.HIDE_REFRESH,Rt),this.options[J.HIDE_UNUSED_ENTITIES]&&Mt(J.HIDE_UNUSED_ENTITIES,Rt),this.options[J.HIDE_RELOAD_RESOURCES]&&Mt(J.HIDE_RELOAD_RESOURCES,Rt),this.options[J.HIDE_EDIT_DASHBOARD]&&Mt(J.HIDE_EDIT_DASHBOARD,Rt),this.options[J.HIDE_OVERFLOW]&&Mt(J.HIDE_OVERFLOW,Rt),this.options[J.BLOCK_OVERFLOW]&&Mt(J.BLOCK_OVERFLOW,Rt),this.options[J.HIDE_MENU_BUTTON]&&Mt(J.HIDE_MENU_BUTTON,Rt))}else Ct(this.appToolbar);this.options[J.BLOCK_MOUSE]?(vt(Ft.MOUSE,document.body),mt(tt.CACHE)&&Mt(J.BLOCK_MOUSE,Rt)):Ct(document.body),window.removeEventListener("contextmenu",this.blockEventHandler,!0),this.options[J.BLOCK_CONTEXT_MENU]&&(window.addEventListener("contextmenu",this.blockEventHandler,!0),mt(tt.CACHE)&&Mt(J.BLOCK_CONTEXT_MENU,Rt)),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(Tt.HA_DIALOG_HEADER," > ").concat(Tt.MENU_ITEM)).all.then((function(t){Pt(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(Tt.HA_DIALOG_MORE_INFO,", ").concat(Tt.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK)).$).element];case 2:return i=n.sent(),this.options[J.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[J.HIDE_DIALOG_HEADER_HISTORY]||this.options[J.HIDE_DIALOG_HEADER_SETTINGS]||this.options[J.HIDE_DIALOG_HEADER_OVERFLOW]?(r=[this.options[J.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[J.HIDE_DIALOG_HEADER_HISTORY]?Ft.DIALOG_HEADER_HISTORY:"",this.options[J.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[J.HIDE_DIALOG_HEADER_SETTINGS]?Ft.DIALOG_HEADER_SETTINGS:"",this.options[J.HIDE_DIALOG_HEADER_ACTION_ITEMS]||this.options[J.HIDE_DIALOG_HEADER_OVERFLOW]?Ft.DIALOG_HEADER_OVERFLOW:""],vt(r.join(""),t),mt(tt.CACHE)&&(this.options[J.HIDE_DIALOG_HEADER_ACTION_ITEMS]&&Mt(J.HIDE_DIALOG_HEADER_ACTION_ITEMS,Rt),this.options[J.HIDE_DIALOG_HEADER_HISTORY]&&Mt(J.HIDE_DIALOG_HEADER_HISTORY,Rt),this.options[J.HIDE_DIALOG_HEADER_SETTINGS]&&Mt(J.HIDE_DIALOG_HEADER_SETTINGS,Rt),this.options[J.HIDE_DIALOG_HEADER_OVERFLOW]&&Mt(J.HIDE_DIALOG_HEADER_OVERFLOW,Rt))):Ct(t),this.options[J.HIDE_DIALOG_HISTORY]||this.options[J.HIDE_DIALOG_LOGBOOK]?(r=[this.options[J.HIDE_DIALOG_HISTORY]?Ft.DIALOG_HISTORY:"",this.options[J.HIDE_DIALOG_LOGBOOK]?Ft.DIALOG_LOGBOOK:""],vt(r.join(""),i),mt(tt.CACHE)&&(this.options[J.HIDE_DIALOG_HISTORY]&&Mt(J.HIDE_DIALOG_HISTORY,Rt),this.options[J.HIDE_DIALOG_LOGBOOK]&&Mt(J.HIDE_DIALOG_LOGBOOK,Rt))):Ct(i),_=o.deepQuery(Tt.HA_DIALOG_CLIMATE).$,s=_.query([Tt.HA_DIALOG_CLIMATE_TEMPERATURE,Tt.HA_STATE_CONTROL_CLIMATE_TEMPERATURE].join(",")).$,a=s.query(Tt.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER).$,_.element.then((function(t){c.options[J.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[J.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS]?(vt(Ft.DIALOG_CLIMATE_CONTROL_SELECT,t),mt(tt.CACHE)&&(c.options[J.HIDE_DIALOG_CLIMATE_ACTIONS]&&Mt(J.HIDE_DIALOG_CLIMATE_ACTIONS,Rt),c.options[J.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS]&&Mt(J.HIDE_DIALOG_CLIMATE_SETTINGS_ACTIONS,Rt))):Ct(t)})),s.element.then((function(t){c.options[J.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[J.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]?(vt(Ft.DIALOG_CLIMATE_TEMPERATURE_BUTTONS,t),mt(tt.CACHE)&&c.options[J.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]&&Mt(J.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS,Rt)):Ct(t)})),a.element.then((function(t){c.options[J.HIDE_DIALOG_CLIMATE_ACTIONS]||c.options[J.HIDE_DIALOG_CLIMATE_TEMPERATURE_ACTIONS]?vt(Ft.DIALOG_CLIMATE_CIRCULAR_SLIDER_INTERACTION,t):Ct(t)})),o.query(Tt.HA_DIALOG_HISTORY).$.element.then((function(t){c.options[J.HIDE_DIALOG_HISTORY_SHOW_MORE]?(vt(Ft.DIALOG_SHOW_MORE,t),mt(tt.CACHE)&&Mt(J.HIDE_DIALOG_HISTORY_SHOW_MORE,Rt)):Ct(t)})),o.query(Tt.HA_DIALOG_LOGBOOK).$.element.then((function(t){c.options[J.HIDE_DIALOG_LOGBOOK_SHOW_MORE]?(vt(Ft.DIALOG_SHOW_MORE,t),mt(tt.CACHE)&&Mt(J.HIDE_DIALOG_LOGBOOK_SHOW_MORE,Rt)):Ct(t)})),o.deepQuery([Tt.HA_DIALOG_DEFAULT,Tt.HA_DIALOG_VACUUM,Tt.HA_DIALOG_TIMER,Tt.HA_DIALOG_LIGHT,Tt.HA_DIALOG_SIREN,Tt.HA_DIALOG_MEDIA_PLAYER].join(",")).$.element.then((function(t){if(c.options[J.HIDE_DIALOG_ATTRIBUTES]||c.options[J.HIDE_DIALOG_TIMER_ACTIONS]||c.options[J.HIDE_DIALOG_MEDIA_ACTIONS]){var e=[c.options[J.HIDE_DIALOG_ATTRIBUTES]?Ft.DIALOG_ATTRIBUTES:"",c.options[J.HIDE_DIALOG_TIMER_ACTIONS]?Ft.DIALOG_TIMER_ACTIONS:"",c.options[J.HIDE_DIALOG_MEDIA_ACTIONS]&&t.host.localName===Tt.HA_DIALOG_MEDIA_PLAYER?Ft.DIALOG_MEDIA_ACTIONS:""];vt(e.join(""),t),mt(tt.CACHE)&&(c.options[J.HIDE_DIALOG_ATTRIBUTES]&&Mt(J.HIDE_DIALOG_ATTRIBUTES,Rt),c.options[J.HIDE_DIALOG_TIMER_ACTIONS]&&Mt(J.HIDE_DIALOG_TIMER_ACTIONS,Rt),c.options[J.HIDE_DIALOG_MEDIA_ACTIONS]&&Mt(J.HIDE_DIALOG_MEDIA_ACTIONS,Rt))}else Ct(t)})),o.deepQuery(Tt.HA_DIALOG_UPDATE).$.element.then((function(t){c.options[J.HIDE_DIALOG_UPDATE_ACTIONS]?(vt(Ft.DIALOG_UPDATE_ACTIONS,t),mt(tt.CACHE)&&Mt(J.HIDE_DIALOG_UPDATE_ACTIONS,Rt)):Ct(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(Tt.TOOLBAR," > ").concat(Tt.ACTION_ITEMS," > ").concat(Tt.MENU_ITEM)).all.then((function(e){Pt(e,t.menuTranslations)})),this.user.is_admin&&this.HAElements.HEADER.selector.query("".concat(Tt.TOOLBAR," ").concat(Tt.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:ft}),[2]}}))}))},t.prototype.entityWatchCallback=function(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return!(e=window.kioskModeEntities[this.ha.hass.panelUrl]||[]).length||t.event_type!==ft||!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(J).forEach((function(e){e in t&&(n.options[e]=t[e])})),e&&Object.values(Z).forEach((function(e){e in t&&(n.options[e]=t[e])}))},t}();(new Vt).log(),Promise.resolve(customElements.whenDefined(Tt.HUI_VIEW)).then((function(){window.KioskMode=new xt}))}();
|