(self.webpackJsonp=self.webpackJsonp||[]).push([[98],{140:function(e,t,n){"use strict";n.d(t,"a",function(){return o});var s=n(92);const r={},o=e=>{if(e.html_url){const t=[n.e(70).then(n.bind(null,173))];return e.embed_iframe||t.push(Promise.all([n.e(132),n.e(72)]).then(n.bind(null,136))),Promise.all(t).then(([{importHrefPromise:t}])=>t(e.html_url))}return e.js_url?(e.js_url in r||(r[e.js_url]=Object(s.b)(e.js_url)),r[e.js_url]):e.module_url?Object(s.c)(e.module_url):Promise.reject("No valid url found in panel config.")}},141:function(e,t,n){"use strict";n.d(t,"a",function(){return s});const s=e=>{const t="html_url"in e?`ha-panel-${e.name}`:e.name;return document.createElement(t)}},142:function(e,t,n){"use strict";n.d(t,"a",function(){return s});const s=(e,t)=>{"setProperties"in e?e.setProperties(t):Object.keys(t).forEach(n=>{e[n]=t[n]})}},677:function(e,t,n){"use strict";n.r(t),n.d(t,"HaPanelCustom",function(){return l});var s=n(3),r=n(0),o=n(140),i=n(141),c=n(142),a=n(99);class l extends r.b{constructor(){super(...arguments),this.navigate=((e,t)=>Object(a.a)(this,e,t))}registerIframe(e,t){e(this.panel,{hass:this.hass,narrow:this.narrow,route:this.route}),this._setProperties=t}disconnectedCallback(){super.disconnectedCallback(),this._cleanupPanel()}updated(e){if(e.has("panel"))return e.get("panel")&&this._cleanupPanel(),void this._createPanel(this.panel);if(!this._setProperties)return;const t={};for(const n of e.keys())t[n]=this[n];this._setProperties(t)}_cleanupPanel(){for(delete window.customPanel,this._setProperties=void 0;this.lastChild;)this.removeChild(this.lastChild)}_createPanel(e){const t=e.config._panel_custom,n=document.createElement("a");if(n.href=t.html_url||t.js_url||t.module_url||"",!t.trust_external&&!["localhost","127.0.0.1",location.hostname].includes(n.hostname)&&!confirm(`Do you trust the external panel "${t.name}" at "${n.href}"?\n\nIt will have access to all data in Home Assistant.\n\n(Check docs for the panel_custom component to hide this message)`))return;if(!t.embed_iframe)return void Object(o.a)(t).then(()=>{const n=Object(i.a)(t);this._setProperties=(e=>Object(c.a)(n,e)),Object(c.a)(n,{panel:e,hass:this.hass,narrow:this.narrow,route:this.route}),this.appendChild(n)},()=>{alert(`Unable to load custom panel from ${n.href}`)});window.customPanel=this,this.innerHTML="\n    <style>\n      iframe {\n        border: 0;\n        width: 100%;\n        height: 100%;\n        display: block;\n      }\n    </style>\n    <iframe></iframe>\n    ".trim();const s=this.querySelector("iframe").contentWindow.document;s.open(),s.write(`<!doctype html><script src='${window.customPanelJS}'><\/script>`),s.close()}}Object(s.c)([Object(r.g)()],l.prototype,"hass",void 0),Object(s.c)([Object(r.g)()],l.prototype,"narrow",void 0),Object(s.c)([Object(r.g)()],l.prototype,"route",void 0),Object(s.c)([Object(r.g)()],l.prototype,"panel",void 0),customElements.define("ha-panel-custom",l)},92:function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return o}),n.d(t,"c",function(){return i});const s=(e,t,n)=>new Promise((s,r)=>{const o=document.createElement(e);let i="src",c="body";switch(o.onload=(()=>s(t)),o.onerror=(()=>r(t)),e){case"script":o.async=!0,n&&(o.type=n);break;case"link":o.type="text/css",o.rel="stylesheet",i="href",c="head"}o[i]=t,document[c].appendChild(o)}),r=e=>s("link",e),o=e=>s("script",e),i=e=>s("script",e,"module")}}]);
//# sourceMappingURL=chunk.3cf8a7ad4b49d56fc603.js.map