90 lines
20 KiB
JavaScript
90 lines
20 KiB
JavaScript
|
!function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";function o(){return document.querySelector("hc-main")?document.querySelector("hc-main").hass:document.querySelector("home-assistant")?document.querySelector("home-assistant").hass:void 0}function n(e){return document.querySelector("hc-main")?document.querySelector("hc-main").provideHass(e):document.querySelector("home-assistant")?document.querySelector("home-assistant").provideHass(e):void 0}function s(){var e,t=document.querySelector("hc-main");return t?((e=t._lovelaceConfig).current_view=t._lovelacePath,e):(t=(t=(t=(t=(t=(t=(t=(t=(t=document.querySelector("home-assistant"))&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root"))?((e=t.lovelace).current_view=t.___curView,e):null}function a(){var e=document.querySelector("hc-main");return e=e?(e=(e=(e=e&&e.shadowRoot)&&e.querySelector("hc-lovelace"))&&e.shadowRoot)&&e.querySelector("hui-view")||e.querySelector("hui-panel-view"):(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=document.querySelector("home-assistant"))&&e.shadowRoot)&&e.querySelector("home-assistant-main"))&&e.shadowRoot)&&e.querySelector("app-drawer-layout partial-panel-resolver"))&&e.shadowRoot||e)&&e.querySelector("ha-panel-lovelace"))&&e.shadowRoot)&&e.querySelector("hui-root"))&&e.shadowRoot)&&e.querySelector("ha-app-layout"))&&e.querySelector("#view"))&&e.firstElementChild}async function i(){if(customElements.get("hui-view"))return!0;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");if(e.hass={panels:[{url_path:"tmp",component_name:"lovelace"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),!customElements.get("ha-panel-lovelace"))return!1;const t=document.createElement("ha-panel-lovelace");return t.hass=o(),void 0===t.hass&&(await new Promise(e=>{window.addEventListener("connection-status",t=>{console.log(t),e()},{once:!0})}),t.hass=o()),t.panel={config:{mode:null}},t._fetchConfig(),!0}r.d(t,"a",(function(){return o})),r.d(t,"e",(function(){return n})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"b",(function(){return i}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));let o=function(){if(window.fully&&"function"==typeof fully.getDeviceId)return fully.getDeviceId();if(!localStorage["lovelace-player-device-id"]){const e=()=>Math.floor(1e5*(1+Math.random())).toString(16).substring(1);localStorage["lovelace-player-device-id"]=`${e()}${e()}-${e()}${e()}`}return localStorage["lovelace-player-device-id"]}()},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",(function(){return hasOldTemplate})),__webpack_require__.d(__webpack_exports__,"b",(function(){return parseOldTemplate}));var _hass_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_deviceID_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(1);function hasOldTemplate(e){return/\[\[\s+.*\s+\]\]/.test(e)}function parseTemplateString(str,specialData={}){if("string"!=typeof
|
||
|
<ha-dialog
|
||
|
open
|
||
|
@closed=${this.closeDialog}
|
||
|
.heading=${!0}
|
||
|
hideActions
|
||
|
@ll-rebuild=${this._makeCard}
|
||
|
>
|
||
|
${this.fullscreen?t`<div slot="heading"></div>`:t`
|
||
|
<app-toolbar slot="heading">
|
||
|
<mwc-icon-button
|
||
|
.label=${"dismiss"}
|
||
|
dialogAction="cancel"
|
||
|
>
|
||
|
<ha-icon
|
||
|
.icon=${"mdi:close"}
|
||
|
></ha-icon>
|
||
|
</mwc-icon-button>
|
||
|
<div class="main-title" @click=${this._enlarge}>
|
||
|
${this.title}
|
||
|
</div>
|
||
|
</app-toolbar>
|
||
|
`}
|
||
|
<div class="content">
|
||
|
${this.card}
|
||
|
</div>
|
||
|
</ha-dialog>
|
||
|
`:t``}static get styles(){return r`
|
||
|
ha-dialog {
|
||
|
--mdc-dialog-min-width: 400px;
|
||
|
--mdc-dialog-max-width: 600px;
|
||
|
--mdc-dialog-heading-ink-color: var(--primary-text-color);
|
||
|
--mdc-dialog-content-ink-color: var(--primary-text-color);
|
||
|
--justify-action-buttons: space-between;
|
||
|
}
|
||
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||
|
ha-dialog {
|
||
|
--mdc-dialog-min-width: 100vw;
|
||
|
--mdc-dialog-max-width: 100vw;
|
||
|
--mdc-dialog-min-height: 100%;
|
||
|
--mdc-dialog-max-height: 100%;
|
||
|
--mdc-shape-medium: 0px;
|
||
|
--vertial-align-dialog: flex-end;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
app-toolbar {
|
||
|
flex-shrink: 0;
|
||
|
color: var(--primary-text-color);
|
||
|
background-color: var(--secondary-background-color);
|
||
|
}
|
||
|
|
||
|
.main-title {
|
||
|
margin-left: 16px;
|
||
|
line-height: 1.3em;
|
||
|
max-height: 2.6em;
|
||
|
overflow: hidden;
|
||
|
display: -webkit-box;
|
||
|
-webkit-line-clamp: 2;
|
||
|
-webkit-box-orient: vertical;
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
|
.content {
|
||
|
margin: -20px -24px;
|
||
|
}
|
||
|
|
||
|
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||
|
app-toolbar {
|
||
|
background-color: var(--app-header-background-color);
|
||
|
color: var(--app-header-text-color, white);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@media all and (min-width: 451px) and (min-height: 501px) {
|
||
|
ha-dialog {
|
||
|
--mdc-dialog-max-width: 90vw;
|
||
|
}
|
||
|
|
||
|
.content {
|
||
|
width: 400px;
|
||
|
}
|
||
|
:host([large]) .content {
|
||
|
width: calc(90vw - 48px);
|
||
|
}
|
||
|
|
||
|
:host([large]) app-toolbar {
|
||
|
max-width: calc(90vw - 32px);
|
||
|
}
|
||
|
}
|
||
|
`}}customElements.define("card-tools-popup",o)}const s=document.querySelector("home-assistant")||document.querySelector("hc-root");if(!s)return;let i=await O(s,"$ card-tools-popup");if(i||(i=document.createElement("card-tools-popup"),s.shadowRoot.appendChild(i),Object(a.e)(i)),!window._moreInfoDialogListener){const e=async e=>{if(e.state&&"cardToolsPopup"in e.state)if(e.state.cardToolsPopup){const{title:t,card:r,large:o,style:n,fullscreen:s}=e.state.params;x(t,r,o,n,s)}else i.closeDialog()};window.addEventListener("popstate",e),window._moreInfoDialogListener=!0}history.replaceState({cardToolsPopup:!1},""),history.pushState({cardToolsPopup:!0,params:{title:e,card:t,large:r,style:o,fullscreen:n}},""),i.showDialog(e,t,r,o,n)}function D(e,t,r){e||(e=Object(a.a)().connection);let o={user:Object(a.a)().user.name,browser:v.a,hash:location.hash.substr(1)||" ",...r.variables},n=r.template,s=r.entity_ids;return e.subscribeMessage(e=>{let r=e.result;r=r.replace(/_\([^)]*\)/g,e=>Object(a.a)().localize(e.substring(2,e.length-1))||e),t(r)},{type:"render_template",template:n,variables:o,entity_ids:s})}var j=r(2);const T=Object(a.a)().callWS({type:"config/area_registry/list"}),P=Object(a.a)().callWS({type:"config/device_registry/list"}),k=Object(a.a)().callWS({type:"config/entity_registry/list"});async function q(){return window.cardToolsData=window.cardToolsData||{areas:await T,devices:await P,entities:await k},window.cardToolsData}function $(e){const t=window.cardToolsData;for(const r of t.areas)if(r.name.toLowerCase()===e.toLowerCase())return r;return null}function R(e){const t=window.cardToolsData;let r=[];if(!e)return r;for(const o of t.devices)o.area_id===e.area_id&&r.push(o);return r}function I(e){const t=window.cardToolsData;for(const r of t.devices)if(r.name.toLowerCase()===e.toLowerCase())return r;return null}function L(e){const t=window.cardToolsData;let r=[];if(!e)return r;for(const o of t.entities)o.device_id===e.id&&r.push(o.entity_id);return r}function M(e,t){window._registerCard||(window._customCardButtons=[],window._registerCard=(e,t)=>{window._customCardButtons.push({el:e,name:t})},customElements.whenDefined("hui-card-picker").then(()=>{customElements.get("hui-card-picker").prototype.firstUpdated=function(){this._customCardButtons=document.createElement("div"),this._customCardButtons.classList.add("cards-container"),this._customCardButtons.id="custom",this._customCardButtons.style.borderTop="1px solid var(--primary-color)",window._customCardButtons.forEach,this.shadowRoot.appendChild(this._customCardButtons),window._customCardButtons.forEach(e=>{const t=document.createElement("mwc-button");t.type="custom:"+e.el,t.innerHTML=e.name,t.addEventListener("click",this._cardPicked),this._customCardButtons.appendChild(t)})}})),window._registerCard(e,t)}q();const B=async e=>{await(async()=>{if(customElements.get("developer-tools-event"))return;await customElements.whenDefined("partial-panel-resolver");const e=document.createElement("partial-panel-resolver");e.hass={panels:[{url_path:"tmp",component_name:"developer-tools"}]},e._updateRoutes(),await e.routerOptions.routes.tmp.load(),await customElements.whenDefined("developer-tools-router");const t=document.createElement("developer-tools-router");await t.routerOptions.routes.event.load()})();return document.createElement("developer-tools-event")._computeParsedEventData(e)};class N{static checkVersion(e){}static args(){}static logger(){}static get localize(){return Object(a.a)().localize}static get deviceID(){return v.a}static get fireEvent(){return i}static get hass(){return Object(a.a)()}static get lovelace(){return Object(a.c)()}static get lovelace_view(){return a.d}static get provideHass(){return a.e}static get LitElement(){return o}static get LitHtml(){return n}static get LitCSS(){return s}static get longpress(){return b}static get createCard(){return p}static get createElement(){return m}static get createEntityRow(){return h}static get moreInfo(){return S}static get popUp(){return x}static get closePopUp(){return C}static get hasTemplate(){return e=>{return t=e,!!S
|