2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
!function(){"use strict";var t=function(){return t=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},t.apply(this,arguments)};function n(t,n,e,o){return new(e||(e=Promise))((function(i,_){function r(t){try{a(o.next(t))}catch(t){_(t)}}function s(t){try{a(o.throw(t))}catch(t){_(t)}}function a(t){var n;t.done?i(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(r,s)}a((o=o.apply(t,n||[])).next())}))}function e(t,n){var e,o,i,_,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return _={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_;function s(s){return function(a){return function(s){if(e)throw new TypeError("Generator is already executing.");for(;_&&(_=0,s[0]&&(r=0)),r;)try{if(e=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 r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(i=r.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(t,r)}catch(t){s=[6,t],o=0}finally{e=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 n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t},o.apply(this,arguments)};function i(t,n,e,o){return new(e||(e=Promise))((function(n,i){function _(t){try{s(o.next(t))}catch(t){i(t)}}function r(t){try{s(o.throw(t))}catch(t){i(t)}}function s(t){var o;t.done?n(t.value):(o=t.value,o instanceof e?o:new e((function(t){t(o)}))).then(_,r)}s((o=o.apply(t,[])).next())}))}function _(t,n){var e,o,i,_,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return _={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(_[Symbol.iterator]=function(){return this}),_;function s(s){return function(a){return function(s){if(e)throw new TypeError("Generator is already executing.");for(;_&&(_=0,s[0]&&(r=0)),r;)try{if(e=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 r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!((i=(i=r.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){r.label=s[1];break}if(6===s[0]&&r.label<i[1]){r.label=i[1],i=s;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(s);break}i[2]&&r.ops.pop(),r.trys.pop();continue}s=n.call(t,r)}catch(t){s=[6,t],o=0}finally{e=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 r="$",s=":host",a="invalid selector",c=10,I=10,E=function(t){var n,e=t[0],o=t[1];return(n=e)&&(n instanceof Document||n instanceof Element||n instanceof ShadowRoot)&&"string"==typeof o};function O(t,n){return function(t){return t.split(",").map((function(t){return t.trim()}))}(t).map((function(t){var e=function(t){return t.split(r).map((function(t){return t.trim()}))}(t);return n(e)}))}var A=function(t,n,e,o){return new Promise((function(i){var _=0,r=function(){var s=t();n(s)?i(s):++_<e?setTimeout(r,o):i(s)};r()}))};function l(t,n){var e=n?" If you want to select a shadowRoot, use ".concat(n," instead."):"";return"".concat(t," cannot be used with a selector ending in a shadowRoot (").concat(r,").").concat(e)}function u(t){return t instanceof Promise?t:Promise.resolve(t)}function T(){return"You can not select a shadowRoot (".concat(r,") of the document.")}function h(){return"You can not select a shadowRoot (".concat(r,") of a shadowRoot.")}function D(t,n){for(var e,o,i=null,_=t.length,r=0;r<_;r++){if(0===r)if(t[r].length)i=n.querySelector(t[r]);else{if(n instanceof Document)throw new SyntaxError(T());if(n instanceof ShadowRoot)throw new SyntaxError(h());i=(null===(e=n.shadowRoot)||void 0===e?void 0:e.querySelector(t[++r]))||null}else i=(null===(o=i.shadowRoot)||void 0===o?void 0:o.querySelector("".concat(s," ").concat(t[r])))||null;if(null===i)return null}return i}function L(t,n){var e,o=function(t,n,e){for(var o,i=0,_=n.length;i<_;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return[].concat(o||Array.prototype.slice.call(n))}(0,t),i=o.pop();if(!o.length)return n.querySelectorAll(i);var _=D(o,n);return(null===(e=null==_?void 0:_.shadowRoot)||void 0===e?void 0:e.querySelectorAll("".concat(s," ").concat(i)))||null}function d(t,n){if(1===t.length&&!t[0].length){if(n instanceof Document)throw new SyntaxError(T());if(n instanceof ShadowRoot)throw new SyntaxError(h());return n.shadowRoot}var e=D(t,n);return(null==e?void 0:e.shadowRoot)||null}function H(t,n,e,o){return i(this,0,void 0,(function(){return _(this,(function(i){return[2,A((function(){return function(t,n,e,o){for(var i=O(t,(function(t){if(!t[t.length-1].length)throw new SyntaxError(l(e,o));return t})),_=i.length,r=0;r<_;r++){var s=D(i[r],n);if(s)return s}return null}(t,n,"asyncQuerySelector","asyncShadowRootQuerySelector")}),(function(t){return!!t}),e,o)]}))}))}function S(t,n,e,o){return i(this,0,void 0,(function(){return _(this,(function(i){return[2,A((function(){return function(t,n,e){for(var o=O(t,(function(t){if(!t[t.length-1].length)throw new SyntaxError(l(e));return t})),i=o.length,_=0;_<i;_++){var r=L(o[_],n);if(null==r?void 0:r.length)return r}return document.querySelectorAll(a)}(t,n,"asyncQuerySelectorAll")}),(function(t){return!!t.length}),e,o)]}))}))}function R(t,n,e,o){return i(this,0,void 0,(function(){return _(this,(function(i){return[2,A((function(){return function(t,n,e,o){for(var i=O(t,(function(t){if(t.pop().length)throw new SyntaxError(function(t,n){return"".concat(t," must be used with a selector ending in a shadowRoot (").concat(r,"). If you don't want to select a shadowRoot, use ").concat(n," instead.")}(e,o));return t})),_=i.length,s=0;s<_;s++){var a=d(i[s],n);if(a)return a}return null}(t,n,"asyncShadowRootQuerySelector","asyncQuerySelector")}),(function(t){return!!t}),e,o)]}))}))}var N=function(t,n){var e=t.querySelectorAll(n);if(e.length)return e;if(t instanceof Element&&t.shadowRoot){var o=N(t.shadowRoot,n);if(o.length)return o}for(var i=0,_=Array.from(t.querySelectorAll("*"));i<_.length;i++){var r=_[i],s=N(r,n);if(s.length)return s}return document.querySelectorAll(a)},f=function(t,n,e,o){return A((function(){return N(t,n)}),(function(t){return!!t.length}),e,o)};function p(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i(this,0,void 0,(function(){var n,e,o,i,r;return _(this,(function(_){switch(_.label){case 0:return E(t)?(n=t[0],e=t[1],o=t[2],[4,H(e,n,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:case 3:return[2,_.sent()];case 2:return i=t[0],r=t[1],[4,H(i,document,(null==r?void 0:r.retries)||c,(null==r?void 0:r.delay)||I)]}}))}))}function G(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i(this,0,void 0,(function(){var n,e,o,i,r;return _(this,(function(_){switch(_.label){case 0:return E(t)?(n=t[0],e=t[1],o=t[2],[4,S(e,n,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:return[2,_.sent()];case 2:return i=t[0],r=t[1],[2,S(i,document,(null==r?void 0:r.retries)||c,(null==r?void 0:r.delay)||I)]}}))}))}function C(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return i(this,0,void 0,(function(){var n,e,o,i,r;return _(this,(function(_){switch(_.label){case 0:return E(t)?(n=t[0],e=t[1],o=t[2],[4,R(e,n,(null==o?void 0:o.retries)||c,(null==o?void 0:o.delay)||I)]):[3,2];case 1:return[2,_.sent()];case 2:return i=t[0],r=t[1],[2,R(i,document,(null==r?void 0:r.retries)||c,(null==r?void 0:r.delay)||I)]}}))}))}var v=function(){function t(t,n){t instanceof Node||t instanceof Promise?(this._element=t,this._asyncParams=o({retries:c,delay:I},n||{})):(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,r,{get:function(){var n=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],r,n._asyncParams):C(t,r,n._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,0,void 0,(function(){return _(this,(function(n){return[2,u(this._element).then((function(n){return n instanceof NodeList&&n[t]||null}))]}))}))},t.prototype.query=function(n){var e=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],n,e._asyncParams):G(t,n,e._asyncParams)})),this._asyncParams)},t.prototype.deepQuery=function(n){var e=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,n,e._asyncParams.retries,e._asyncParams.delay)}))):f(t,n,e._asyncParams.retries,e._asyncParams.delay)})),this._asyncParams)},t}(),m=function(t,n){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},m(t,n)},M=function(){return M=Object.assign||function(t){for(var n,e=1,o=arguments.length;e<o;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[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),nt=((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),et={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,n,e,o){return void 0===e&&(e=null),void 0===o&&(o=!1),Object.entries(n||{}).reduce((function(n,i){var _=i[0],r=i[1];if(r.selector===$&&e)return r.children?M(M({},n),ot(t,r.children,e,!0)):n;var s=e?e.then((function(n){return n?p(n,(e=r.selector,o?"$ "+e:e),t):null;var e})):p(r.selector,t);return n[_]={element:s,children:ot(t,r.children,s),selector:new v(s,t)},n}),{})},it=function(t,n){for(var e=0,o=Object.entries(n);e<o.length;e++){var i=o[e];if(i[0]===t)return i[1];var _=it(t,i[1].children);if(_)return _}},_t=function(t,n){return Object.keys(t).reduce((function(t,e){var o=it(e,n);o.children;var i=function(t,n){var e={};for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&n.indexOf(o)<0&&(e[o]=t[o]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(t);i<o.length;i++)n.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(t,o[i])&&(e[o[i]]=t[o[i]])}return e}(o,["children"]);return t[e]=M({},i),t}),{})},rt=function(){function t(){this.delegate=document.createDocumentFragment()}return t.prototype.addEventListener=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];(t=this.delegate).addEventListener.apply(t,n)},t.prototype.dispatchEvent=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return(t=this.delegate).dispatchEvent.apply(t,n)},t.prototype.removeEventListener=function(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return(t=this.delegate).removeEventListener.apply(t,n)},t}(),st=function(t){function n(n){void 0===n&&(n={});var e=t.call(this)||this;return e._config=M(M({},z),n),e._timestaps={},e}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}m(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}(n,t),n.prototype._dispatchEvent=function(t,n){var e=Date.now();e-this._timestaps[t]<this._config.eventThreshold||(this._timestaps[t]=e,this.dispatchEvent(new CustomEvent(t,{detail:n})))},n.prototype._updateDialogElements=function(t){var n,e=this;void 0===t&&(t=g.HA_MORE_INFO_DIALOG_INFO),this._dialogTree=ot(this._config,et,this._haRootElements.HOME_ASSISTANT.element);var o=_t(g,this._dialogTree);o.HA_DIALOG_CONTENT.element.then((function(t){e._dialogsContentObserver.disconnect(),e._dialogsContentObserver.observe(t,{childList:!0})})),this._haDialogElements=function(t,n){return[g.HA_MORE_INFO_DIALOG,g.HA_DIALOG,g.HA_DIALOG_CONTENT,n].reduce((function(n,e){return n[e]=t[e],n}),{})}(o,t);var i=((n={})[g.HA_MORE_INFO_DIALOG_INFO]=b.ON_MORE_INFO_DIALOG_OPEN,n[g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=b.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN,n[g.HA_DIALOG_MORE_INFO_SETTINGS]=b.ON_SETTINGS_DIALOG_OPEN,n);this._dispatchEvent(i[t],this._haDialogElements)},n.prototype._updateRootElements=function(){var t=this;this._homeAssistantRootTree=ot(this._config,tt),this._haRootElements=_t(y,this._homeAssistantRootTree),this._haRootElements[y.HOME_ASSISTANT].selector.$.element.then((function(n){t._dialogsObserver.disconnect(),t._dialogsObserver.observe(n,{childList:!0})})),this._haRootElements[y.PARTIAL_PANEL_RESOLVER].element.then((function(n){t._panelResolverObserver.disconnect(),n&&t._panelResolverObserver.observe(n,{subtree:!0,childList:!0})})),this._dispatchEvent(b.ON_LISTEN,this._haRootElements),this._dispatchEvent(b.ON_PANEL_LOAD,this._haRootElements)},n.prototype._updateLovelaceElements=function(){var t=this;this._homeAssistantResolverTree=ot(this._config,nt,this._haRootElements[y.HA_DRAWER].element),this._haResolverElements=_t(w,this._homeAssistantResolverTree),this._haResolverElements[w.HA_PANEL_LOVELACE].element.then((function(n){t._lovelaceObserver.disconnect(),n&&(t._lovelaceObserver.observe(n.shadowRoot,{childList:!0}),t._dispatchEvent(b.ON_LOVELACE_PANEL_LOAD,M(M({},t._haRootElements),t._haResolverElements)))}))},n.prototype._watchDialogs=function(t){var n=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===q.HA_MORE_INFO_DIALOG&&n._updateDialogElements()}))}))},n.prototype._watchDialogsContent=function(t){var n=this;t.forEach((function(t){t.addedNodes.forEach((function(t){var e,o=((e={})[q.HA_MORE_INFO_DIALOG_INFO]=g.HA_MORE_INFO_DIALOG_INFO,e[q.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]=g.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,e[q.HA_DIALOG_MORE_INFO_SETTINGS]=g.HA_DIALOG_MORE_INFO_SETTINGS,e);if(t.localName&&t.localName in o){var i=t.localName;n._updateDialogElements(o[i])}}))}))},n.prototype._watchDashboards=function(t){var n=this;t.forEach((function(t){t.addedNodes.forEach((function(t){n._dispatchEvent(b.ON_PANEL_LOAD,n._haRootElements),t.localName===q.HA_PANEL_LOVELACE&&n._updateLovelaceElements()}))}))},n.prototype._watchLovelace=function(t){var n=this;t.forEach((function(t){t.addedNodes.forEach((function(t){t.localName===q.HUI_ROOT&&n._updateLovelaceElements()}))}))},n.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()},n.prototype.addEventListener=function(n,e,o){t.prototype.addEventListener.call(this,n,e,o)},n}(rt),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",Ht="state_changed",St="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 n=Nt(t);return t.querySelector("#".concat(ct,"_").concat(n))},pt=function(t,n){if(n){var e=Nt(n),o=ft(n);o||((o=document.createElement("style")).setAttribute("id","".concat(ct,"_").concat(e)),n.appendChild(o)),o.innerHTML=t}},Gt=function(t){t&&Rt(t).forEach((function(t){var n=Nt(t);ft(t)&&t.querySelector("#".concat(ct,"_").concat(n)).remove()}))},Ct=function(t){var n=t.replace(/(?:^|_)([a-z])/g,(function(t,n){return n.toUpperCase()}));return"km".concat(n)},vt=function(t){var n=new URLSearchParams(window.location.search);return Rt(t).some((function(t){return n.has(t)}))},mt=function(t,n){Rt(t).forEach((function(t){return window.localStorage.setItem(Ct(t),n)}))},Mt=function(t){return Rt(t).some((function(t){return window.localStorage.getItem(Ct(t))===dt}))},yt=function(t){return Object.entries(t).map((function(t){var n=t[0],e=t[1];return"".concat(n,":").concat(e)})).join(";")+";"},wt=function(t){return Object.entries(t).map((function(t){var n=t[0],e=t[1];return"".concat(n,"{").concat(yt(e),"}")})).join("")},gt=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.map((function(t){return"".concat(t,"{display: none !important;}")})).join("")},bt=function(t){var n=0,e=Object.values(Dt);return new Promise((function(o,i){var _=function(){var r,s=null===(r=null==t?void 0:t.hass)||void 0===r?void 0:r.resources,a=!1;if(s){var c=t.hass.language;e.find((function(t){return!s[c][t]}))||(a=!0)}a?o(s):++n<500?setTimeout(_,50):i()};_()}))},Ut=function(t,n,e){return new Promise((function(o,i){var _=0,r=function(){var s=t();s&&n(s)?o(s):++_<500?setTimeout(r,50):i(new Error("".concat(at,": Cannot select ").concat(e," after ").concat(500," attempts. Giving up!")))};r()}))},Bt=function(t,n){t.forEach((function(t){if(t&&t.dataset&&!t.dataset.selector){var e=t.shadowRoot.querySelector(ht.MENU_ITEM_ICON);t.dataset.selector=n[e.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,n){var e=132;return t&&n?e=0:t?e-=50:n&&(e-=48),wt({"paper-listbox":{height:"calc(100% - var(--header-height) - ".concat(e,"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":"0px !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 n(){this.lines=[{content:"%c≡ kiosk-mode",color:"white",background:"#03a9f4"},{content:"%cversion ".concat("6.0.1")}]}return n.prototype.log=function(){var n=[],e=[],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){n.push(_.content.padEnd(27)),n.push("%c⋮"),r!==o&&n.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===r?(s="1px 0 0 1px",a="1px 1px 0 0"):r===o&&(s="0 0 1px 1px",a="0 1px 1px 0"),e.push(yt(t(t({},i),{background:_.background||"white",color:_.color||"#424242",padding:0===r?"1px 0px 1px 5px":"1px 0px 1px 10px","border-width":s}))),e.push(yt(t(t({},i),{background:_.background||"white",color:_.color||"white",padding:0===r?"1px 5px":"1px 5px 1px 0px","border-width":a}))),r!==o&&e.push("")})),console.info.apply(console,function(t,n,e){if(e||2===arguments.length)for(var o,i=0,_=n.length;i<_;i++)!o&&i in n||(o||(o=Array.prototype.slice.call(n,0,i)),o[i]=n[i]);return t.concat(o||Array.prototype.slice.call(n))}([n.join("")],e,!1))},n}(),xt=function(){function t(){var t=this;vt(Z.CLEAR_CACHE)&&Object.values(X).forEach((function(t){window.localStorage.removeItem(Ct(t))})),window.kioskModeEntities={},this.options={};var o=new st;o.addEventListener(b.ON_LOVELACE_PANEL_LOAD,(function(o){return n(t,void 0,void 0,(function(){var t,n,i,_,r,s,a,c,I,E,O,A,l,u,T,h,D=this;return e(this,(function(e){switch(e.label){case 0:return this.HAElements=o.detail,t=this.HAElements,n=t.HOME_ASSISTANT,i=t.HOME_ASSISTANT_MAIN,_=t.HUI_ROOT,r=t.HA_DRAWER,s=t.HEADER,a=t.HA_SIDEBAR,c=this,[4,n.element];case 1:return c.ha=e.sent(),I=this,[4,i.selector.$.element];case 2:return I.main=e.sent(),E=this,[4,_.selector.$.element];case 3:return E.huiRoot=e.sent(),O=this,[4,r.element];case 4:return O.drawerLayout=e.sent(),A=this,[4,s.selector.query(ht.TOOLBAR).element];case 5:return A.appToolbar=e.sent(),l=this,[4,a.selector.$.element];case 6:return l.sideBarRoot=e.sent(),u=this,[4,Ut((function(){var t,n;return null===(n=null===(t=D.ha)||void 0===t?void 0:t.hass)||void 0===n?void 0:n.user}),(function(t){return!!t}),"".concat(ht.HOME_ASSISTANT," > hass > user"))];case 7:return u.user=e.sent(),this.version=function(t){var n=t?t.match(/^(\d+)\.(\d+)\.(\w+)(?:\.(\w+))?$/):null;return n?[+n[1],+n[2],n[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(n){t.HAMoreInfoDialogElements=n.detail,t.insertMoreInfoDialogStyles()})),o.addEventListener(b.ON_HISTORY_AND_LOGBOOK_DIALOG_OPEN,(function(n){t.HAMoreInfoDialogElements=n.detail,t.insertMoreInfoDialogStyles()})),o.listen(),this.entityWatch(),this.resizeWindowBinded=this.resizeWindow.bind(this)}return t.prototype.run=function(){return n(this,void 0,void 0,(function(){var t,n=this;return e(this,(function(e){return(t=this.main.querySelector(ht.HA_PANEL_LOVELACE))?[2,Ut((function(){var n;return null===(n=null==t?void 0:t.lovelace)||void 0===n?void 0:n.config}),(function(t){return!!t}),"Lovelace config").then((function(t){return n.processConfig(t.kiosk_mode||{})}))]:[2]}))}))},t.prototype.runDialogs=function(t){var n,e;void 0===t&&(t=null===(e=null===(n=this.ha)||void 0===n?void 0:n.shadowRoot)||void 0===e?void 0:e.querySelector(ht.HA_MORE_INFO_DIALOG)),t&&this.insertMoreInfoDialogStyles()},t.prototype.processConfig=function(t){return n(this,void 0,void 0,(function(){var o,i,_,r,s,a=this;return e(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,n(void 0,void 0,void 0,(function(){var t,n,o,i,_;return e(this,(function(e){switch(e.label){case 0:return[4,bt(I)];case 1:return t=e.sent(),n=I.hass.language,o=t[n],i=Object.entries(Dt),_=i.map((function(t){var n=t[0],e=t[1];return[o[e],n]})),[2,Object.fromEntries(_)]}}))}))).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))||vt(Object.values(X))?Object.values(X).forEach((function(t){a.options[t]=Mt(t)||vt(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)})),(_=this.options[J.IGNORE_MOBILE_SETTINGS]?null:t.mobile_settings)&&(r=_.custom_width?_.custom_width:812,window.innerWidth<=r&&this.setOptions(_,!0)),(s=this.options[J.IGNORE_ENTITY_SETTINGS]?null:t.entity_settings)&&s.forEach((function(t){var n=Object.keys(t.entity)[0];window.kioskModeEntities[o].includes(n)||window.kioskModeEntities[o].push(n),a.ha.hass.states[n].state==t.entity[n]&&a.setOptions(t,!1)})),vt(Z.DISABLE_KIOSK_MODE)&&!this.options[J.IGNORE_DISABLE_KM]||this.insertStyles(),[2]}))}))},t.prototype.insertStyles=function(){var t,n,e,o;if(this.options[X.KIOSK]||this.options[X.HIDE_HEADER]?(pt(Pt.HEADER,this.huiRoot),vt(Z.CACHE)&&mt(X.HIDE_HEADER,dt)):Gt(this.huiRoot),null===(n=null===(t=this.main)||void 0===t?void 0:t.host)||void 0===n||n.removeEventListener(St,this.blockEventHandler,!0),this.options[X.KIOSK]||this.options[X.HIDE_SIDEBAR]?(null===(o=null===(e=this.main)||void 0===e?void 0:e.host)||void 0===o||o.addEventListener(St,this.blockEventHandler,!0),pt(Pt.SIDEBAR,this.drawerLayout),pt(Pt.ASIDE,this.drawerLayout.shadowRoot),vt(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),vt(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),vt(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),vt(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),vt(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 n(this,void 0,void 0,(function(){var t,n,o,i,_,r,s,a,c=this;return e(this,(function(e){switch(e.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=e.sent(),n=this.HAMoreInfoDialogElements.HA_DIALOG_CONTENT,[4,(o=n.selector.query("".concat(ht.HA_DIALOG_MORE_INFO,", ").concat(ht.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK)).$).element];case 2:return i=e.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),vt(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),_=o.query(ht.HA_DIALOG_MORE_INFO_CONTENT).$.query(ht.HA_DIALOG_CLIMATE).$,r=_.query(ht.HA_STATE_CONTROL_CLIMATE_TEMPERATURE).$,s=r.query(ht.HA_DIALOG_CLIMATE_CIRCULAR_SLIDER).$,_.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),vt(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)})),r.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),vt(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 n=[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(n.join(""),t),vt(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),vt(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),vt(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),vt(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(n){Bt(n,t.menuTranslations)})),this.user.is_admin&&this.HAElements.HEADER.selector.query("".concat(ht.TOOLBAR," ").concat(ht.OVERLAY_MENU_ITEM)).all.then((function(n){n.forEach((function(n){if(n&&n.dataset&&!n.dataset.selector){var e=n.textContent.trim();n.dataset.selector=t.menuTranslations[e]}}))})))},t.prototype.entityWatch=function(){return n(this,void 0,void 0,(function(){var t=this;return e(this,(function(n){switch(n.label){case 0:return[4,window.hassConnection];case 1:return n.sent().conn.subscribeMessage((function(n){return t.entityWatchCallback(n)}),{type:"subscribe_events",event_type:Ht}),[2]}}))}))},t.prototype.entityWatchCallback=function(t){return n(this,void 0,void 0,(function(){var n,o,i;return e(this,(function(e){switch(e.label){case 0:return!(n=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!==Ht||!n.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:e.sent(),this.runDialogs(),e.label=2;case 2:return[2]}}))}))},t.prototype.blockEventHandler=function(t){t.preventDefault(),t.stopImmediatePropagation()},t.prototype.setOptions=function(t,n){var e=this;Object.values(X).forEach((function(n){n in t&&(e.options[n]=t[n])})),n&&Object.values(J).forEach((function(n){n in t&&(e.options[n]=t[n])}))},t}();(new Ft).log(),Promise.resolve(customElements.whenDefined(ht.HUI_VIEW)).then((function(){window.KioskMode=new xt}))}();
|