Files
homeassistant_config/config/www/community/power-flow-card-plus/power-flow-card-plus.js
2024-05-31 13:07:35 +02:00

2 lines
224 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function e(e,t,o,i){var a,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,o,i);else for(var l=e.length-1;l>=0;l--)(a=e[l])&&(r=(n<3?a(r):n>3?a(t,o,r):a(t,o))||r);return n>3&&r&&Object.defineProperty(t,o,r),r}"function"==typeof SuppressedError&&SuppressedError;const t=window,o=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;class n{constructor(e,t,o){if(this._$cssResult$=!0,o!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(o&&void 0===e){const o=void 0!==t&&1===t.length;o&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&a.set(t,e))}return e}toString(){return this.cssText}}const r=(e,...t)=>{const o=1===e.length?e[0]:t.reduce(((t,o,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1]),e[0]);return new n(o,e,i)},l=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const o of e.cssRules)t+=o.cssText;return(e=>new n("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var s;const d=window,c=d.trustedTypes,u=c?c.emptyScript:"",h=d.reactiveElementPolyfillSupport,p={toAttribute(e,t){switch(t){case Boolean:e=e?u:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let o=e;switch(t){case Boolean:o=null!==e;break;case Number:o=null===e?null:Number(e);break;case Object:case Array:try{o=JSON.parse(e)}catch(e){o=null}}return o}},v=(e,t)=>t!==e&&(t==t||e==e),_={attribute:!0,type:String,converter:p,reflect:!1,hasChanged:v},m="finalized";class f extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,o)=>{const i=this._$Ep(o,t);void 0!==i&&(this._$Ev.set(i,o),e.push(i))})),e}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const o="symbol"==typeof e?Symbol():"__"+e,i=this.getPropertyDescriptor(e,o,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,o){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdate(e,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||_}static finalize(){if(this.hasOwnProperty(m))return!1;this[m]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const o of t)this.createProperty(o,e[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const o=new Set(e.flat(1/0).reverse());for(const e of o)t.unshift(l(e))}else void 0!==e&&t.push(l(e));return t}static _$Ep(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,o;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(o=e.hostConnected)||void 0===o||o.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{o?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((o=>{const i=document.createElement("style"),a=t.litNonce;void 0!==a&&i.setAttribute("nonce",a),i.textContent=o.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,o){this._$AK(e,o)}_$EO(e,t,o=_){var i;const a=this.constructor._$Ep(e,o);if(void 0!==a&&!0===o.reflect){const n=(void 0!==(null===(i=o.converter)||void 0===i?void 0:i.toAttribute)?o.converter:p).toAttribute(t,o.type);this._$El=e,null==n?this.removeAttribute(a):this.setAttribute(a,n),this._$El=null}}_$AK(e,t){var o;const i=this.constructor,a=i._$Ev.get(e);if(void 0!==a&&this._$El!==a){const e=i.getPropertyOptions(a),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(o=e.converter)||void 0===o?void 0:o.fromAttribute)?e.converter:p;this._$El=a,this[a]=n.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,o){let i=!0;void 0!==e&&(((o=o||this.constructor.getPropertyOptions(e)).hasChanged||v)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===o.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,o))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const o=this._$AL;try{t=this.shouldUpdate(o),t?(this.willUpdate(o),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(o)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(o)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var y;f[m]=!0,f.elementProperties=new Map,f.elementStyles=[],f.shadowRootOptions={mode:"open"},null==h||h({ReactiveElement:f}),(null!==(s=d.reactiveElementVersions)&&void 0!==s?s:d.reactiveElementVersions=[]).push("1.6.3");const g=window,b=g.trustedTypes,w=b?b.createPolicy("lit-html",{createHTML:e=>e}):void 0,x="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,S="?"+k,$=`<${S}>`,C=document,E=()=>C.createComment(""),A=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,P=e=>M(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),z="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,O=/>/g,N=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,B=/"/g,L=/^(?:script|style|textarea|title)$/i,I=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),H=I(1),R=I(2),F=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),G=new WeakMap,V=C.createTreeWalker(C,129,null,!1);function W(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==w?w.createHTML(t):t}const Z=(e,t)=>{const o=e.length-1,i=[];let a,n=2===t?"<svg>":"",r=D;for(let t=0;t<o;t++){const o=e[t];let l,s,d=-1,c=0;for(;c<o.length&&(r.lastIndex=c,s=r.exec(o),null!==s);)c=r.lastIndex,r===D?"!--"===s[1]?r=T:void 0!==s[1]?r=O:void 0!==s[2]?(L.test(s[2])&&(a=RegExp("</"+s[2],"g")),r=N):void 0!==s[3]&&(r=N):r===N?">"===s[0]?(r=null!=a?a:D,d=-1):void 0===s[1]?d=-2:(d=r.lastIndex-s[2].length,l=s[1],r=void 0===s[3]?N:'"'===s[3]?B:j):r===B||r===j?r=N:r===T||r===O?r=D:(r=N,a=void 0);const u=r===N&&e[t+1].startsWith("/>")?" ":"";n+=r===D?o+$:d>=0?(i.push(l),o.slice(0,d)+x+o.slice(d)+k+u):o+k+(-2===d?(i.push(void 0),t):u)}return[W(e,n+(e[o]||"<?>")+(2===t?"</svg>":"")),i]};class K{constructor({strings:e,_$litType$:t},o){let i;this.parts=[];let a=0,n=0;const r=e.length-1,l=this.parts,[s,d]=Z(e,t);if(this.el=K.createElement(s,o),V.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(i=V.nextNode())&&l.length<r;){if(1===i.nodeType){if(i.hasAttributes()){const e=[];for(const t of i.getAttributeNames())if(t.endsWith(x)||t.startsWith(k)){const o=d[n++];if(e.push(t),void 0!==o){const e=i.getAttribute(o.toLowerCase()+x).split(k),t=/([.?@])?(.*)/.exec(o);l.push({type:1,index:a,name:t[2],strings:e,ctor:"."===t[1]?Q:"?"===t[1]?te:"@"===t[1]?oe:J})}else l.push({type:6,index:a})}for(const t of e)i.removeAttribute(t)}if(L.test(i.tagName)){const e=i.textContent.split(k),t=e.length-1;if(t>0){i.textContent=b?b.emptyScript:"";for(let o=0;o<t;o++)i.append(e[o],E()),V.nextNode(),l.push({type:2,index:++a});i.append(e[t],E())}}}else if(8===i.nodeType)if(i.data===S)l.push({type:2,index:a});else{let e=-1;for(;-1!==(e=i.data.indexOf(k,e+1));)l.push({type:7,index:a}),e+=k.length-1}a++}}static createElement(e,t){const o=C.createElement("template");return o.innerHTML=e,o}}function Y(e,t,o=e,i){var a,n,r,l;if(t===F)return t;let s=void 0!==i?null===(a=o._$Co)||void 0===a?void 0:a[i]:o._$Cl;const d=A(t)?void 0:t._$litDirective$;return(null==s?void 0:s.constructor)!==d&&(null===(n=null==s?void 0:s._$AO)||void 0===n||n.call(s,!1),void 0===d?s=void 0:(s=new d(e),s._$AT(e,o,i)),void 0!==i?(null!==(r=(l=o)._$Co)&&void 0!==r?r:l._$Co=[])[i]=s:o._$Cl=s),void 0!==s&&(t=Y(e,s._$AS(e,t.values),s,i)),t}class X{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:o},parts:i}=this._$AD,a=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:C).importNode(o,!0);V.currentNode=a;let n=V.nextNode(),r=0,l=0,s=i[0];for(;void 0!==s;){if(r===s.index){let t;2===s.type?t=new q(n,n.nextSibling,this,e):1===s.type?t=new s.ctor(n,s.name,s.strings,this,e):6===s.type&&(t=new ie(n,this,e)),this._$AV.push(t),s=i[++l]}r!==(null==s?void 0:s.index)&&(n=V.nextNode(),r++)}return V.currentNode=C,a}v(e){let t=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}}class q{constructor(e,t,o,i){var a;this.type=2,this._$AH=U,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=i,this._$Cp=null===(a=null==i?void 0:i.isConnected)||void 0===a||a}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Y(this,e,t),A(e)?e===U||null==e||""===e?(this._$AH!==U&&this._$AR(),this._$AH=U):e!==this._$AH&&e!==F&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):P(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==U&&A(this._$AH)?this._$AA.nextSibling.data=e:this.$(C.createTextNode(e)),this._$AH=e}g(e){var t;const{values:o,_$litType$:i}=e,a="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=K.createElement(W(i.h,i.h[0]),this.options)),i);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===a)this._$AH.v(o);else{const e=new X(a,this),t=e.u(this.options);e.v(o),this.$(t),this._$AH=e}}_$AC(e){let t=G.get(e.strings);return void 0===t&&G.set(e.strings,t=new K(e)),t}T(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let o,i=0;for(const a of e)i===t.length?t.push(o=new q(this.k(E()),this.k(E()),this,this.options)):o=t[i],o._$AI(a),i++;i<t.length&&(this._$AR(o&&o._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var o;for(null===(o=this._$AP)||void 0===o||o.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class J{constructor(e,t,o,i,a){this.type=1,this._$AH=U,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=U}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,o,i){const a=this.strings;let n=!1;if(void 0===a)e=Y(this,e,t,0),n=!A(e)||e!==this._$AH&&e!==F,n&&(this._$AH=e);else{const i=e;let r,l;for(e=a[0],r=0;r<a.length-1;r++)l=Y(this,i[o+r],t,r),l===F&&(l=this._$AH[r]),n||(n=!A(l)||l!==this._$AH[r]),l===U?e=U:e!==U&&(e+=(null!=l?l:"")+a[r+1]),this._$AH[r]=l}n&&!i&&this.j(e)}j(e){e===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class Q extends J{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===U?void 0:e}}const ee=b?b.emptyScript:"";class te extends J{constructor(){super(...arguments),this.type=4}j(e){e&&e!==U?this.element.setAttribute(this.name,ee):this.element.removeAttribute(this.name)}}class oe extends J{constructor(e,t,o,i,a){super(e,t,o,i,a),this.type=5}_$AI(e,t=this){var o;if((e=null!==(o=Y(this,e,t,0))&&void 0!==o?o:U)===F)return;const i=this._$AH,a=e===U&&i!==U||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==U&&(i===U||a);a&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,o;"function"==typeof this._$AH?this._$AH.call(null!==(o=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==o?o:this.element,e):this._$AH.handleEvent(e)}}class ie{constructor(e,t,o){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(e){Y(this,e)}}const ae={O:x,P:k,A:S,C:1,M:Z,L:X,R:P,D:Y,I:q,V:J,H:te,N:oe,U:Q,F:ie},ne=g.litHtmlPolyfillSupport;null==ne||ne(K,q),(null!==(y=g.litHtmlVersions)&&void 0!==y?y:g.litHtmlVersions=[]).push("2.8.0");var re,le;class se extends f{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const o=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=o.firstChild),o}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,o)=>{var i,a;const n=null!==(i=null==o?void 0:o.renderBefore)&&void 0!==i?i:t;let r=n._$litPart$;if(void 0===r){const e=null!==(a=null==o?void 0:o.renderBefore)&&void 0!==a?a:null;n._$litPart$=r=new q(t.insertBefore(E(),e),e,void 0,null!=o?o:{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return F}}se.finalized=!0,se._$litElement$=!0,null===(re=globalThis.litElementHydrateSupport)||void 0===re||re.call(globalThis,{LitElement:se});const de=globalThis.litElementPolyfillSupport;null==de||de({LitElement:se}),(null!==(le=globalThis.litElementVersions)&&void 0!==le?le:globalThis.litElementVersions=[]).push("3.3.3");const ce=e=>t=>"function"==typeof t?((e,t)=>(customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:o,elements:i}=t;return{kind:o,elements:i,finisher(t){customElements.define(e,t)}}})(e,t),ue=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(o){o.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(o){o.createProperty(t.key,e)}},he=(e,t,o)=>{t.constructor.createProperty(o,e)};function pe(e){return(t,o)=>void 0!==o?he(e,t,o):ue(e,t)}function ve(e){return pe({...e,state:!0})}function _e(e,t){return(({finisher:e,descriptor:t})=>(o,i)=>{var a;if(void 0===i){const i=null!==(a=o.originalKey)&&void 0!==a?a:o.key,n=null!=t?{kind:"method",placement:"prototype",key:i,descriptor:t(o.key)}:{...o,key:i};return null!=e&&(n.finisher=function(t){e(t,i)}),n}{const a=o.constructor;void 0!==t&&Object.defineProperty(o,i,t(i)),null==e||e(a,i)}})({descriptor:o=>{const i={get(){var t,o;return null!==(o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(e))&&void 0!==o?o:null},enumerable:!0,configurable:!0};if(t){const t="symbol"==typeof o?Symbol():"__"+o;i.get=function(){var o,i;return void 0===this[t]&&(this[t]=null!==(i=null===(o=this.renderRoot)||void 0===o?void 0:o.querySelector(e))&&void 0!==i?i:null),this[t]}}return i}})}var me;null===(me=window.HTMLSlotElement)||void 0===me||me.prototype.assignedElements;const fe=(e,t)=>Number(`${Math.round(Number(`${e}e${t}`))}e-${t}`);function ye(e){return!isNaN(parseFloat(e))&&!isNaN(Number(e))}function ge(e,t=0){return ye(e)?Number(e):t}const be=r`:host{--size-circle-entity:79.99px;--mdc-icon-size:24px;--clickable-cursor:pointer;--individual-left-bottom-color:#d0cc5b;--individual-left-top-color:#964cb5;--individual-right-top-color:#b54c9d;--individual-right-bottom-color:#5bd0cc;--non-fossil-color:var(--energy-non-fossil-color, #0f9d58);--icon-non-fossil-color:var(--non-fossil-color, #0f9d58);--icon-solar-color:var(--energy-solar-color, #ff9800);--icon-individual-bottom-color:var(--individual-left-bottom-color, #d0cc5b);--icon-individual-top-color:var(--individual-left-top-color, #964cb5);--icon-grid-color:var(--energy-grid-consumption-color, #488fc2);--icon-battery-color:var(--energy-battery-in-color, #f06292);--icon-home-color:var(--energy-grid-consumption-color, #488fc2);--text-solar-color:var(--primary-text-color);--text-non-fossil-color:var(--primary-text-color);--text-individual-bottom-color:var(--primary-text-color);--text-individual-top-color:var(--primary-text-color);--text-home-color:var(--primary-text-color);--secondary-text-individual-bottom-color:var(--primary-text-color);--secondary-text-individual-top-color:var(--primary-text-color);--text-battery-state-of-charge-color:var(--primary-text-color);--cirlce-grid-color:var(--energy-grid-consumption-color, #488fc2);--circle-battery-color:var(--energy-battery-in-color, #f06292);--battery-grid-line:var(--energy-grid-return-color, #8353d1);--secondary-text-solar-color:var(--primary-text-color);--secondary-text-grid-color:var(--primary-text-color);--secondary-text-home-color:var(--primary-text-color);--secondary-text-non-fossil-color:var(--primary-text-color);--lines-svg-not-flat-line-height:106%;--lines-svg-not-flat-line-top:-2%;--lines-svg-flat-width:calc(100% - 160px);--lines-svg-not-flat-width:calc(103% - 165px);--lines-svg-not-flat-multi-indiv-height:104%;--lines-svg-not-flat-multi-indiv-width:calc(103% - var(--size-circle-entity) * 3.7);--lines-svg-not-flat-multi-indiv-width:calc(((106% - 165px) * 0.5));--lines-svg-not-flat-multi-indiv-width:calc(((130% - 246px) * 0.5));--lines-svg-not-flat-multi-indiv-right-indiv-width:calc(((130% - 210px) * 0.5));--lines-svg-not-flat-multi-indiv-right-indiv-height:103%;--lines-svg-flat-multi-indiv-width:calc((129% - 242px) * 0.5);--lines-svg-flat-left:0;--lines-svg-not-flat-left:0;--dot-size:3.5px;--transparency:var(--transparency-unused-lines);--greyed-out--line-color:#bdbdbd;--text-grid-consumption-color:var(--energy-grid-consumption-color);--text-grid-return-color:var(--energy-grid-return-color);--text-battery-in-color:var(--energy-battery-in-color);--text-battery-out-color:var(--energy-battery-out-color)}ha-card{overflow:hidden}ha-card.full-size{height:100%}.card-content.full-size{transform:scale(2) translateY(30%)}.card-content{position:relative;margin:0 auto}.circle{width:80px;height:80px;border-radius:50%;box-sizing:border-box;border:2px solid;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:12px;line-height:12px;position:relative;text-decoration:none;color:var(--primary-text-color);gap:2px}.card-content,.row{max-width:470px}.lines{position:absolute;bottom:0;left:var(--size-circle-entity);width:100%;height:146px;display:flex;justify-content:flex-start;padding:0 16px 16px;box-sizing:border-box}.lines:not(.multi-individual) svg.flat-line{left:var(--lines-svg-flat-left)}.lines:not(.multi-individual) svg:not(.flat-line){left:var(--lines-svg-not-flat-left)}.lines:has(svg:not(.flat-line)){margin-left:-1%}.lines.individual-bottom-individual-top{bottom:110px}.lines.high{bottom:100px;height:156px}.lines svg{width:var(--lines-svg-flat-width);height:100%;max-width:340px;position:relative}.lines svg:not(.flat-line){width:var(--lines-svg-not-flat-width);height:var(--lines-svg-not-flat-line-height);top:var(--lines-svg-not-flat-line-top)}.multi-individual{left:calc(var(--size-circle-entity) + 2%);margin-left:-2.2%!important}.multi-individual svg{width:var(--lines-svg-flat-multi-indiv-width)}.multi-individual svg:not(.flat-line){width:var(--lines-svg-not-flat-multi-indiv-width);margin-top:1px;height:var(--lines-svg-not-flat-multi-indiv-height)}.row{display:flex;justify-content:space-between;max-width:500px;margin:0 auto}.circle-container{display:flex;flex-direction:column;align-items:center;z-index:2}.circle-container.solar{height:130px}.circle-container.individual-top{height:130px}.circle-container.individual-bottom{justify-content:flex-end}.circle-container.individual-bottom.bottom{position:relative;top:-20px;margin-bottom:-20px}.circle-container.battery{height:110px;justify-content:flex-end}.spacer{width:var(--size-circle-entity)}.circle-container .circle{cursor:var(--clickable-cursor)}#battery-grid{stroke:var(--battery-grid-line)}ha-icon{padding-bottom:2px}ha-icon.small{--mdc-icon-size:12px}.label{color:var(--secondary-text-color);font-size:12px;max-width:80px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;min-height:20px}line,path{stroke:var(--disabled-text-color);stroke-width:1;fill:none}path.transparency{opacity:calc(calc(100 - var(--transparency))/ 100)}path.grey{stroke:var(--greyed-out--line-color)!important}.circle svg{position:absolute;fill:none;stroke-width:4px;width:100%;height:100%;top:0;left:0}span.secondary-info{color:var(--primary-text-color);font-size:12px;max-width:60px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.individual-top circle,.individual-top path{stroke:var(--individual-left-top-color)}#individual-left-bottom-icon{color:var(--icon-individual-left-bottom-color)}#individual-left-top-icon{color:var(--icon-individual-left-top-color)}#individual-right-bottom-icon{color:var(--icon-individual-right-bottom-color)}#individual-right-top-icon{color:var(--icon-individual-right-top-color)}#solar-icon{color:var(--icon-solar-color)}circle.individual-top{stroke-width:4;width:var(--dot-size);fill:var(--individual-left-top-color)}circle.individual-bottom{stroke-width:4;width:var(--dot-size);fill:var(--individual-left-bottom-color)}.individual-top .circle{border-color:var(--individual-left-top-color)}.individual-bottom circle,.individual-bottom path{stroke:var(--individual-left-bottom-color)}.individual-bottom .circle{border-color:var(--individual-left-bottom-color)}.individual-right-top .circle{border-color:var(--individual-right-top-color)}circle.individual-right-top .circle{fill:var(--individual-right-top-color)}.individual-right-top circle,.individual-right-top path{stroke:var(--individual-right-top-color)}.individual-right-bottom .circle{border-color:var(--individual-right-bottom-color)}circle.individual-right-bottom .circle{fill:var(--individual-right-bottom-color)}.individual-right-bottom circle,.individual-right-bottom path{stroke:var(--individual-right-bottom-color)}.right-individual-flow-container{position:absolute;right:calc(var(--size-circle-entity) - 27% * 1.1 + 6px);width:100%;display:flex;justify-content:flex-end;height:156px;bottom:100px;padding:0 16px 16px;margin-right:-1.2%;box-sizing:border-box;pointer-events:none}.right-individual-flow-container>svg{width:var(--lines-svg-not-flat-multi-indiv-right-indiv-width)}.right-individual-flow{height:var(--lines-svg-not-flat-multi-indiv-right-indiv-height);margin-top:2px;width:var(--lines-svg-not-flat-multi-indiv-width);top:var(--lines-svg-not-flat-line-top);max-width:340px;position:relative}.circle-container.low-carbon{height:130px}.low-carbon path{stroke:var(--non-fossil-color)}.low-carbon .circle{border-color:var(--non-fossil-color)}.low-carbon ha-icon:not(.small){color:var(--icon-non-fossil-color)}circle.low-carbon{stroke-width:4;fill:var(--non-fossil-color);stroke:var(--non-fossil-color)}.solar{color:var(--primary-text-color)}.solar .circle{border-color:var(--energy-solar-color)}.solar ha-icon:not(.small){color:var(--icon-solar-color)}circle.solar,path.solar{stroke:var(--energy-solar-color)}circle.solar{stroke-width:4;fill:var(--energy-solar-color)}.battery .circle{border-color:var(--circle-battery-color)}circle.battery,path.battery{stroke:var(--energy-battery-out-color)}circle.battery-home,path.battery-home{stroke:var(--energy-battery-out-color)}circle.battery-home{stroke-width:4;fill:var(--energy-battery-out-color)}circle.battery-solar,path.battery-solar{stroke:var(--energy-battery-in-color)}circle.battery-solar{stroke-width:4;fill:var(--energy-battery-in-color)}.battery-in{color:var(--energy-battery-in-color)}.battery-out{color:var(--energy-battery-out-color)}span.battery-in{color:var(--text-battery-in-color)}span.battery-out{color:var(--text-battery-out-color)}path.battery-from-grid{stroke:var(--energy-grid-consumption-color)}path.battery-to-grid{stroke:var(--battery-grid-line)}.battery ha-icon:not(.small){color:var(--icon-battery-color)}circle.battery-to-grid,circle.return,path.return{stroke:var(--energy-grid-return-color)}circle.battery-to-grid,circle.return{stroke-width:4;fill:var(--energy-grid-return-color)}.return{color:var(--energy-grid-return-color)}span.return{color:var(--text-grid-return-color)}.grid .circle{border-color:var(--circle-grid-color)}.consumption{color:var(--energy-grid-consumption-color)}span.consumption{color:var(--text-grid-consumption-color)}circle.battery-from-grid,circle.grid,path.grid{stroke:var(--energy-grid-consumption-color)}circle.battery-from-grid,circle.grid{stroke-width:4;fill:var(--energy-grid-consumption-color)}.grid ha-icon:not(.small){color:var(--icon-grid-color)}.home .circle{border-width:0;border-color:var(--primary-color)}.home .circle.border{border-width:2px}.home ha-icon:not(.small){color:var(--icon-home-color)}.circle svg circle{animation:rotate-in .6s ease-in;transition:stroke-dashoffset .4s,stroke-dasharray .4s;fill:none}span.solar{color:var(--text-solar-color)}span.low-carbon{color:var(--text-non-fossil-color)}span.low-carbon.secondary-info{color:var(--secondary-text-non-fossil-color)}#home-circle{color:var(--text-home-color);z-index:2}.individual-bottom .circle{color:var(--text-individual-bottom-color)}.individual-top .circle{color:var(--text-individual-top-color)}.individual-bottom span.secondary-info{color:var(--secondary-text-individual-bottom-color)}.individual-top span.secondary-info{color:var(--secondary-text-individual-top-color)}span.secondary-info.left-top{color:var(--secondary-text-individual-left-top-color)}span.individual-left-top{color:var(--text-individual-left-top-color)}span.secondary-info.left-bottom{color:var(--secondary-text-individual-left-bottom-color)}span.individual-left-bottom{color:var(--text-individual-left-bottom-color)}span.secondary-info.right-top{color:var(--secondary-text-individual-right-top-color)}span.individual-right-top{color:var(--text-individual-right-top-color)}span.secondary-info.right-bottom{color:var(--secondary-text-individual-right-bottom-color)}span.individual-right-bottom{color:var(--text-individual-right-bottom-color)}.solar span.secondary-info{color:var(--secondary-text-solar-color)}.grid span.secondary-info{color:var(--secondary-text-grid-color)}.home span.secondary-info{color:var(--secondary-text-home-color)}#battery-state-of-charge-text{color:var(--text-battery-state-of-charge-color)}@keyframes rotate-in{from{stroke-dashoffset:238.76104;stroke-dasharray:238.76104}}.card-actions{display:flex;justify-content:space-between;align-items:center}.card-actions a{text-decoration:none}.home-circle-sections{pointer-events:none}`,we={maxFlowRate:6,minFlowRate:.75,wattDecimals:0,kilowattDecimals:1,minExpectedPower:.01,maxExpectedPower:2e3,wattThreshold:1e3,transparencyZeroLines:0,displayZeroLines:{mode:"show",transparency:50,grey_color:[189,189,189]}};const xe=(e,t)=>{var o;return ye(null===(o=e.states[t])||void 0===o?void 0:o.state)};var ke,Se;function $e(){return($e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}).apply(this,arguments)}!function(e){e.language="language",e.system="system",e.comma_decimal="comma_decimal",e.decimal_comma="decimal_comma",e.space_comma="space_comma",e.none="none"}(ke||(ke={})),function(e){e.language="language",e.system="system",e.am_pm="12",e.twenty_four="24"}(Se||(Se={}));var Ce=function(e,t,o){var i=t?function(e){switch(e.number_format){case ke.comma_decimal:return["en-US","en"];case ke.decimal_comma:return["de","es","it"];case ke.space_comma:return["fr","sv","cs"];case ke.system:return;default:return e.language}}(t):void 0;if(Number.isNaN=Number.isNaN||function e(t){return"number"==typeof t&&e(t)},(null==t?void 0:t.number_format)!==ke.none&&!Number.isNaN(Number(e))&&Intl)try{return new Intl.NumberFormat(i,Ee(e,o)).format(Number(e))}catch(t){return console.error(t),new Intl.NumberFormat(void 0,Ee(e,o)).format(Number(e))}return"string"==typeof e?e:function(e,t){return void 0===t&&(t=2),Math.round(e*Math.pow(10,t))/Math.pow(10,t)}(e,null==o?void 0:o.maximumFractionDigits).toString()+("currency"===(null==o?void 0:o.style)?" "+o.currency:"")},Ee=function(e,t){var o=$e({maximumFractionDigits:2},t);if("string"!=typeof e)return o;if(!t||!t.minimumFractionDigits&&!t.maximumFractionDigits){var i=e.indexOf(".")>-1?e.split(".")[1].length:0;o.minimumFractionDigits=i,o.maximumFractionDigits=i}return o},Ae=function(e,t,o,i){i=i||{},o=null==o?{}:o;var a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=o,e.dispatchEvent(a),a},Me="0.2.2";console.groupCollapsed(`%c⚡ Power Flow Card Plus v${Me} is installed`,"color: #488fc2; font-weight: bold"),console.log("Readme:","https://github.com/flixlix/power-flow-card-plus"),console.groupEnd();const Pe=function(e,t,o){var i;return void 0===o&&(o=!1),function(){var a=[].slice.call(arguments),n=this,r=o&&!i;clearTimeout(i),i=setTimeout((function(){i=null,o||e.apply(n,a)}),t),r&&e.apply(n,a)}}((e=>{console.log(`%c⚡ Power Flow Card Plus v${Me} %cError: ${e}`,"color: #488fc2; font-weight: bold","color: #b33a3a; font-weight: normal")}),6e4),ze=e=>{Pe(`Entity "${null!=e?e:"Unknown"}" is not available or misconfigured`)},De=(e,t)=>t&&xe(e,t)?ge(e.states[t].state):(ze(t),null),Te=["K","M","G","T","P","E","Z","Y"],Oe=(e,t)=>{var o;const i=De(e,t);if(!t||null===i)return 0;const a=null!==(o=e.states[t].attributes.unit_of_measurement)&&void 0!==o?o:"";return Ne(i,a)},Ne=(e,t)=>{const o=t.toUpperCase().slice(0,1),i=Te.indexOf(o);return i>-1?e*Math.pow(1e3,i+1):e},je=(e,t,o)=>{var i;return null===(i=e.use_new_flow_rate_model)||void 0===i||i?((e,t)=>{const o=e.max_expected_power,i=e.min_expected_power;return((e,t,o,i,a)=>e>a?o:(e-i)*(o-t)/(a-i)+t)(t,e.max_flow_rate,e.min_flow_rate,i,o)})(e,t):((e,t,o)=>{const i=null==e?void 0:e.min_flow_rate,a=null==e?void 0:e.max_flow_rate;return a-t/(o>0?o:t)*(a-i)})(e,t,o)},Be=(e,t)=>!1!==e&&t?t:"number"==typeof e?e:1.66,Le=(e,t)=>{var o;return!!(null===(o=e.entities[t])||void 0===o?void 0:o.invert_state)},Ie=e=>Math.abs(Math.min(e,0)),He=e=>Math.max(e,0),Re=(e,t,o)=>{var i,a,n;const r=null===(n=null===(a=null===(i=t.entities)||void 0===i?void 0:i[o])||void 0===a?void 0:a.secondary_info)||void 0===n?void 0:n.entity;if("string"!=typeof r)return null;const l=e.states[r].state;return ye(l)?Number(l):l},Fe=(e,t,o)=>{var i;const a=null===(i=t.entities[o])||void 0===i?void 0:i.entity;if(void 0===a)return null;if("string"==typeof a){const i=Oe(e,a);return Le(t,o)?He(i):Ie(i)}return Oe(e,a.production)},Ue=(e,t,o)=>{var i;const a=null===(i=t.entities[o])||void 0===i?void 0:i.entity;if(void 0===a)return null;if("string"==typeof a){const i=Oe(e,a);return Le(t,o)?Ie(i):He(i)}return Oe(e,a.consumption)},Ge=(e,t)=>Ue(e,t,"grid"),Ve=(e,t)=>Re(e,t,"grid"),We=(e,t)=>{var o;const i=null===(o=t.entities.solar)||void 0===o?void 0:o.entity;if(void 0===i)return null;const a=Oe(e,i);return Le(t,"solar")?Ie(a):He(a)},Ze=(e,t)=>Re(e,t,"solar"),Ke=(e,t)=>{var o;const i=null===(o=t.entities.battery)||void 0===o?void 0:o.state_of_charge;return void 0===i?null:De(e,i)},Ye=(e,t)=>Fe(e,t,"battery"),Xe=(e,t)=>Ue(e,t,"battery"),qe=(e,t)=>{if(t&&xe(e,t))return e.states[t];ze(t)},Je=(e,t,o)=>{var i,a,n,r,l,s,d,c;return(null==t?void 0:t.icon)?t.icon:(null==t?void 0:t.use_metadata)?"string"==typeof(null==t?void 0:t.entity)?(null===(a=null===(i=qe(e,null==t?void 0:t.entity))||void 0===i?void 0:i.attributes)||void 0===a?void 0:a.icon)||o:(null===(l=null===(r=qe(e,null===(n=null==t?void 0:t.entity)||void 0===n?void 0:n.consumption))||void 0===r?void 0:r.attributes)||void 0===l?void 0:l.icon)||(null===(c=null===(d=qe(e,null===(s=null==t?void 0:t.entity)||void 0===s?void 0:s.production))||void 0===d?void 0:d.attributes)||void 0===c?void 0:c.icon)||o:o},Qe=(e,t,o)=>{var i,a,n,r,l,s,d,c;return(null==t?void 0:t.name)?t.name:(null==t?void 0:t.use_metadata)?"string"==typeof(null==t?void 0:t.entity)?(null===(a=null===(i=qe(e,t.entity))||void 0===i?void 0:i.attributes)||void 0===a?void 0:a.friendly_name)||o:(null===(l=null===(r=qe(e,null===(n=null==t?void 0:t.entity)||void 0===n?void 0:n.consumption))||void 0===r?void 0:r.attributes)||void 0===l?void 0:l.friendly_name)||(null===(c=null===(d=qe(e,null===(s=null==t?void 0:t.entity)||void 0===s?void 0:s.production))||void 0===d?void 0:d.attributes)||void 0===c?void 0:c.friendly_name)||o:o},et=(e,t)=>!!e&&e>=t,tt=(e,t)=>e?t?et(e,t)?e:0:e:0,ot=(e,t)=>{var o;const i=t.entities.fossil_fuel_percentage;t.entities.grid;const a=null==i?void 0:i.entity,n=null==i?void 0:i.display_zero,r=Ge(e,t);return void 0!==a&&(!0===n||null!==r&&1*r-(null!==(o=De(e,a))&&void 0!==o?o:0)/100>0)},it=(e,t)=>{var o;const i=t.entities.fossil_fuel_percentage;t.entities.grid;const a=null==i?void 0:i.entity,n=null==i?void 0:i.display_zero,r=Ge(e,t);return void 0!==a&&(!0===n||null!==r&&(!1!==ot(e,t)&&1*r-(null!==(o=De(e,a))&&void 0!==o?o:0)/100>0))},at=(e,t)=>Re(e,t,"fossil_fuel_percentage"),nt=(e,t)=>Re(e,t,"home"),rt=(e,t,o,{unit:i,unitWhiteSpace:a,decimals:n,accept_negative:r,watt_threshold:l=1e3})=>{if(null===o)return"0";if(!ye(o))return o.toString();const s=Number(o),d=void 0===i&&s>=l,c=null!=n?n:d?t.kw_decimals:t.w_decimals;return`${Ce((e=>r?e:Math.abs(e))(d?fe(s/1e3,null!=c?c:2):fe(s,null!=c?c:0)),e.locale)}${!1===a?"":" "}${i||(d?"kW":"W")}`},lt=e=>e?"#".concat(e.map((e=>e.toString(16).padStart(2,"0"))).join("")):"",st=(e,t,o)=>{let i="var(--primary-text-color)";return"string"==typeof e&&(i=t[e].color),!0===e&&(i=t[o].color),i},dt=["unavailable","unknown"],ct=({main:e,className:t,template:o,value:i,entityId:a,icon:n})=>i&&dt.includes(i)?H``:i||o?H`<span class="secondary-info ${t}" @click="${t=>{e.openDetails(t,a)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,a)}}">${n?H`<ha-icon class="secondary-info small" .icon="${n}"></ha-icon>`:""} ${null!=o?o:i}</span>`:H``,ut=(e,t,o,i,a,n)=>{var r,l;return H`${(null===(r=null==a?void 0:a.secondary)||void 0===r?void 0:r.has)||(null===(l=null==a?void 0:a.secondary)||void 0===l?void 0:l.template)?H`${ct({main:t,className:n,entityId:a.secondary.entity,icon:a.secondary.icon,value:rt(e,o,a.secondary.state,{unit:a.secondary.unit,unitWhiteSpace:a.secondary.unit_white_space,decimals:a.secondary.decimals,accept_negative:a.secondary.accept_negative,watt_threshold:o.watt_threshold}),template:i[`${n}Secondary`]})}`:""}`},ht=(e,t)=>{var o,i;if(e>0)return"";const a=null===(o=null==t?void 0:t.display_zero_lines)||void 0===o?void 0:o.mode;if("show"===a||void 0===a)return"";let n="";if("transparency"===a||"custom"===a){const e=null===(i=null==t?void 0:t.display_zero_lines)||void 0===i?void 0:i.transparency;(null==e||e)&&(n+="transparency ")}return"grey_out"!==a&&"custom"!==a||(n+="grey"),n},pt=(e,t)=>{var o;return t>0||"hide"!==(null===(o=null==e?void 0:e.display_zero_lines)||void 0===o?void 0:o.mode)},vt=e=>!0!==e.disable_dots,_t=(e,t,{nonFossil:o,entities:i,templatesObj:a,grid:n,newDur:r})=>{var l,s,d;return H`${o.hasPercentage?H`<div class="circle-container low-carbon"><span class="label">${o.name}</span><div class="circle" @click="${t=>{var o;e.openDetails(t,null===(o=i.fossil_fuel_percentage)||void 0===o?void 0:o.entity)}}" @keyDown="${t=>{var o;"Enter"===t.key&&e.openDetails(t,null===(o=i.fossil_fuel_percentage)||void 0===o?void 0:o.entity)}}">${ut(e.hass,e,t,a,o,"low-carbon")} ${" "!==o.icon?H`<ha-icon id="low-carbon-icon" .icon="${o.icon}">`:null} ${!1!==(null===(l=i.fossil_fuel_percentage)||void 0===l?void 0:l.display_zero_state)||(o.state.power||0)>((null===(s=i.fossil_fuel_percentage)||void 0===s?void 0:s.display_zero_tolerance)||0)?H`<span class="low-carbon">${((e,t,o,i)=>{var a,n,r,l,s,d,c,u,h;if(!o||!xe(e,o))return ze(o),"NaN";const p=null===(n=null===(a=t.entities.fossil_fuel_percentage)||void 0===a?void 0:a.unit_white_space)||void 0===n||n,v="percentage"===(null===(r=t.entities.fossil_fuel_percentage)||void 0===r?void 0:r.state_type)?"%":"W",_=1-(null!==(l=De(e,o))&&void 0!==l?l:0)/100;let m;m="string"==typeof(null===(s=t.entities.grid)||void 0===s?void 0:s.entity)?i:Oe(e,null===(d=t.entities.grid)||void 0===d?void 0:d.entity.consumption)||0;const f=null!==(u=null===(c=t.entities.fossil_fuel_percentage)||void 0===c?void 0:c.display_zero_tolerance)&&void 0!==u?u:0;if("W"===v){let o=m*_;return f&&o<f&&(o=0),rt(e,t,o,{unitWhiteSpace:p,watt_threshold:t.watt_threshold})}let y=100-(null!==(h=De(e,o))&&void 0!==h?h:0);return f&&y<f&&(y=0),rt(e,t,y,{unit:"%",unitWhiteSpace:p,decimals:0,watt_threshold:t.watt_threshold})})(e.hass,t,i.fossil_fuel_percentage.entity,n.state.fromGrid)}</span>`:""}</div>${pt(t,o.state.power||0)?H`<svg width="80" height="30"><path d="M40 -10 v40" class="low-carbon ${ht(o.state.power||0,t)}" id="low-carbon"/>${vt(t)&&o.has&&o.state.power>0?R`<circle r="1.75" class="low-carbon" vector-effect="non-scaling-stroke"><animateMotion dur="${Be(null===(d=i.fossil_fuel_percentage)||void 0===d?void 0:d.calculate_flow_rate,r.nonFossil)}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#low-carbon"></animateMotion></circle>`:""}</svg>`:""}</div>`:H`<div class="spacer"></div>`}`},mt=1,ft=2,yt=e=>(...t)=>({_$litDirective$:e,values:t});class gt{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,o){this._$Ct=e,this._$AM=t,this._$Ci=o}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}const bt=yt(class extends gt{constructor(e){var t;if(super(e),e.type!==mt||"class"!==e.name||(null===(t=e.strings)||void 0===t?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter((t=>e[t])).join(" ")+" "}update(e,[t]){var o,i;if(void 0===this.it){this.it=new Set,void 0!==e.strings&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter((e=>""!==e))));for(const e in t)t[e]&&!(null===(o=this.nt)||void 0===o?void 0:o.has(e))&&this.it.add(e);return this.render(t)}const a=e.element.classList;this.it.forEach((e=>{e in t||(a.remove(e),this.it.delete(e))}));for(const e in t){const o=!!t[e];o===this.it.has(e)||(null===(i=this.nt)||void 0===i?void 0:i.has(e))||(o?(a.add(e),this.it.add(e)):(a.remove(e),this.it.delete(e)))}return F}}),wt=(e,t)=>{var o;const i=(e=>{const t=JSON.parse(JSON.stringify(e)).filter((e=>null==e?void 0:e.has));return t})(e);return null!==(o=null==i?void 0:i[t])&&void 0!==o?o:void 0},xt=(e,t)=>{var o;if("sort_power"===(null===(o=e.individual_mode_config)||void 0===o?void 0:o.mode))return wt(t,1)},kt=(e,t)=>{var o;if("sort_power"===(null===(o=e.individual_mode_config)||void 0===o?void 0:o.mode))return wt(t,2)},St=(e,t)=>{var o;if("sort_power"===(null===(o=e.individual_mode_config)||void 0===o?void 0:o.mode))return wt(t,3)},$t=(e,t)=>!!kt(e,t)||!!St(e,t),Ct=(e,t)=>!!xt(e,t)||!!St(e,t),Et=(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>H`${((e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>a.has&&pt(e,a.state.toHome||0)?H`<div class="lines ${bt({high:t.has||Ct(e,i),"individual1-individual2":!t.has&&i.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-home-flow"><path id="solar" class="solar ${ht(a.state.toHome||0,e)}" d="M${t.has?55:53},0 v${o.has?15:17} c0,${t.has?"30 10,30 30,30":"35 10,35 30,35"} h25" vector-effect="non-scaling-stroke"></path>${vt(e)&&a.state.toHome?R`<circle r="1" class="solar" vector-effect="non-scaling-stroke"><animateMotion dur="${n.solarToHome}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#solar"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${((e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>o.hasReturnToGrid&&a.has&&pt(e,a.state.toGrid||0)?H`<div class="lines ${bt({high:t.has||Ct(e,i),"individual1-individual2":!t.has&&i.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-grid-flow"><path id="return" class="return ${ht(a.state.toGrid||0,e)}" d="M${t.has?45:47},0 v15 c0,${t.has?"30 -10,30 -30,30":"35 -10,35 -30,35"} h-20" vector-effect="non-scaling-stroke"></path>${vt(e)&&a.state.toGrid&&a.has?R`<circle r="1" class="return" vector-effect="non-scaling-stroke"><animateMotion dur="${n.solarToGrid}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#return"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${((e,{battery:t,individual:o,solar:i,newDur:a})=>t.has&&i.has&&pt(e,i.state.toBattery||0)?H`<div class="lines ${bt({high:t.has||Ct(e,o),"individual1-individual2":!t.has&&o.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,o)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="solar-battery-flow" class="flat-line"><path id="battery-solar" class="battery-solar ${ht(i.state.toBattery||0,e)}" d="M50,0 V100" vector-effect="non-scaling-stroke"></path>${vt(e)&&i.state.toBattery?R`<circle r="1" class="battery-solar" vector-effect="non-scaling-stroke"><animateMotion dur="${a.solarToBattery}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#battery-solar"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,individual:i,solar:a,newDur:n})} ${((e,{battery:t,grid:o,individual:i,solar:a,newDur:n})=>o.has&&pt(e,o.state.fromGrid)?H`<div class="lines ${bt({high:t.has||Ct(e,i),"individual1-individual2":!t.has&&i.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="grid-home-flow" class="flat-line"><path class="grid ${ht(o.state.toHome||0,e)}" id="grid" d="M0,${t.has?50:a.has?56:53} H100" vector-effect="non-scaling-stroke"></path>${vt(e)&&o.state.toHome?R`<circle r="1" class="grid" vector-effect="non-scaling-stroke"><animateMotion dur="${n.gridToHome}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#grid"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,grid:o,individual:i,solar:a,newDur:n})} ${((e,{battery:t,grid:o,individual:i,newDur:a})=>t.has&&pt(e,t.state.toHome)?H`<div class="lines ${bt({high:t.has||Ct(e,i),"individual1-individual2":!t.has&&i.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="battery-home-flow"><path id="battery-home" class="battery-home ${ht(t.state.toHome||0,e)}" d="M55,100 v-${o.has?15:17} c0,-30 10,-30 30,-30 h20" vector-effect="non-scaling-stroke"></path>${vt(e)&&t.state.toHome?R`<circle r="1" class="battery-home" vector-effect="non-scaling-stroke"><animateMotion dur="${a.batteryToHome}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#battery-home"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,grid:o,individual:i,newDur:n})} ${((e,{battery:t,grid:o,individual:i,newDur:a})=>o.has&&t.has&&pt(e,Math.max(o.state.toBattery||0,t.state.toGrid||0))?H`<div class="lines ${bt({high:t.has||Ct(e,i),"individual1-individual2":!t.has&&i.every((e=>null==e?void 0:e.has)),"multi-individual":$t(e,i)})}"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" id="battery-grid-flow"><path id="battery-grid" class="${ht(t.state.toGrid||o.state.toBattery||0,e)}" d="M45,100 v-15 c0,-30 -10,-30 -30,-30 h-20" vector-effect="non-scaling-stroke"></path>${vt(e)&&o.state.toBattery?R`<circle r="1" class="battery-from-grid" vector-effect="non-scaling-stroke"><animateMotion dur="${a.batteryGrid}s" repeatCount="indefinite" keyPoints="1;0" keyTimes="0;1" calcMode="linear"><mpath xlink:href="#battery-grid"></animateMotion></circle>`:""} ${t.state.toGrid?R`<circle r="1" class="battery-to-grid" vector-effect="non-scaling-stroke"><animateMotion dur="${a.batteryGrid}s" repeatCount="indefinite" calcMode="linear"><mpath xlink:href="#battery-grid"></animateMotion></circle>`:""}</svg></div>`:"")(e,{battery:t,grid:o,individual:i,newDur:n})}`,At=(e,t)=>{var o;if("string"!=typeof(null==t?void 0:t.entity))return null;const i=qe(e,null===(o=null==t?void 0:t.secondary_info)||void 0===o?void 0:o.entity),a=null==i?void 0:i.state;return ye(a)?Number(a):a},Mt={field:void 0,entity:"",has:!1,state:null,displayZero:!1,displayZeroTolerance:0,icon:"",name:"",color:null,unit:void 0,unit_white_space:!1,invertAnimation:!1,showDirection:!1,secondary:{entity:null,template:null,has:!1,state:null,icon:null,unit:null,unit_white_space:!1,displayZero:!1,accept_negative:!1,displayZeroTolerance:0,decimals:null}},Pt=(e,t)=>{var o,i,a,n,r,l,s,d,c,u;if(!t||!(null==t?void 0:t.entity))return Mt;const h=t.entity,p=((e,t)=>{const o=null==t?void 0:t.entity;if(void 0===o)return null;const i=Oe(e,o);return Math.abs(i)})(e,t),v=(null==t?void 0:t.display_zero)||!1,_=(null==t?void 0:t.display_zero_tolerance)||0,m=((e,t,o)=>!!e||!!et(t,o))(v,p,_),f=p&&p<0,y=(null==t?void 0:t.inverted_animation)||!1,g=f?!y:y,b=(null==t?void 0:t.color)&&"string"==typeof(null==t?void 0:t.color)?null==t?void 0:t.color:null;return{field:t,entity:h,has:m,state:p,displayZero:v,displayZeroTolerance:_,icon:Je(e,t,"mdi:flash"),name:Qe(e,t,"Individual"),color:b,unit:null==t?void 0:t.unit_of_measurement,unit_white_space:(null==t?void 0:t.unit_white_space)||!1,decimals:null==t?void 0:t.decimals,invertAnimation:g,showDirection:(null==t?void 0:t.show_direction)||!1,secondary:{entity:(null===(o=null==t?void 0:t.secondary_info)||void 0===o?void 0:o.entity)||null,template:(null===(i=null==t?void 0:t.secondary_info)||void 0===i?void 0:i.template)||null,has:void 0!==(null===(a=null==t?void 0:t.secondary_info)||void 0===a?void 0:a.entity),state:At(e,t)||null,accept_negative:(null===(n=null==t?void 0:t.secondary_info)||void 0===n?void 0:n.accept_negative)||!1,icon:(null===(r=null==t?void 0:t.secondary_info)||void 0===r?void 0:r.icon)||null,unit:(null===(l=null==t?void 0:t.secondary_info)||void 0===l?void 0:l.unit_of_measurement)||null,unit_white_space:(null===(s=null==t?void 0:t.secondary_info)||void 0===s?void 0:s.unit_white_space)||!1,displayZero:(null===(d=null==t?void 0:t.secondary_info)||void 0===d?void 0:d.display_zero)||!1,displayZeroTolerance:(null===(c=null==t?void 0:t.secondary_info)||void 0===c?void 0:c.display_zero_tolerance)||0,decimals:(null===(u=null==t?void 0:t.secondary_info)||void 0===u?void 0:u.decimals)||null}}},zt=(e,t,o,i,a,n,r)=>{var l,s,d,c,u,h,p;const v=i.individual[n],_=(null===(l=null==a?void 0:a.secondary)||void 0===l?void 0:l.has)?rt(e,o,null===(s=null==a?void 0:a.secondary)||void 0===s?void 0:s.state,{unit:(null===(d=null==a?void 0:a.secondary)||void 0===d?void 0:d.unit)||void 0,unitWhiteSpace:null===(c=null==a?void 0:a.secondary)||void 0===c?void 0:c.unit_white_space,decimals:(null===(u=null==a?void 0:a.secondary)||void 0===u?void 0:u.decimals)||0,accept_negative:(null===(h=null==a?void 0:a.secondary)||void 0===h?void 0:h.accept_negative)||!1,watt_threshold:o.watt_threshold}):void 0;return H`${(()=>{var e,t,o,i,n;if(v)return!0;if(!0===(null===(e=null==a?void 0:a.secondary)||void 0===e?void 0:e.displayZero))return!0;if(!(null===(t=null==a?void 0:a.secondary)||void 0===t?void 0:t.state))return!1;if(!ye(null===(o=null==a?void 0:a.secondary)||void 0===o?void 0:o.state))return!0;const r=null!==(n=null===(i=null==a?void 0:a.secondary)||void 0===i?void 0:i.displayZeroTolerance)&&void 0!==n?n:0;return Number(a.secondary.state)>=r||a.secondary.accept_negative&&"number"==typeof Number(+a.secondary.state)})()?H`${ct({main:t,className:r,entityId:(null==a?void 0:a.secondary.entity)||void 0,icon:(null===(p=null==a?void 0:a.secondary)||void 0===p?void 0:p.icon)||void 0,value:_,template:i.individual[n]||void 0})}`:""}`},Dt=238.76104;!function(e){const t=window;t.customCards=t.customCards||[],t.customCards.push(Object.assign(Object.assign({},e),{preview:!0,documentationURL:"https://github.com/flixlix/power-flow-card-plus"}))}({type:"power-flow-card-plus",name:"Power Flow Card Plus",description:"An extended version of the power flow card with richer options, advanced features and a few small UI enhancements. Inspired by the Energy Dashboard."});let Tt=class extends se{constructor(){super(...arguments),this._config={},this._templateResults={},this._unsubRenderTemplates=new Map,this._width=0,this.previousDur={}}setConfig(e){var t,o,i,a,n,r,l,s,d,c,u,h;if(e.entities.individual1||e.entities.individual2)throw new Error("You are using an outdated configuration. Please update your configuration to the latest version.");if(!e.entities||!(null===(o=null===(t=e.entities)||void 0===t?void 0:t.battery)||void 0===o?void 0:o.entity)&&!(null===(a=null===(i=e.entities)||void 0===i?void 0:i.grid)||void 0===a?void 0:a.entity)&&!(null===(r=null===(n=e.entities)||void 0===n?void 0:n.solar)||void 0===r?void 0:r.entity))throw new Error("At least one entity for battery, grid or solar must be defined");if(this._config=Object.assign(Object.assign({},e),{kw_decimals:ge(e.kw_decimals,we.kilowattDecimals),min_flow_rate:ge(e.min_flow_rate,we.minFlowRate),max_flow_rate:ge(e.max_flow_rate,we.maxFlowRate),w_decimals:ge(e.w_decimals,we.wattDecimals),watt_threshold:ge(e.watt_threshold,we.wattThreshold),max_expected_power:ge(e.max_expected_power,we.maxExpectedPower),min_expected_power:ge(e.min_expected_power,we.minExpectedPower),display_zero_lines:{mode:null!==(s=null===(l=e.display_zero_lines)||void 0===l?void 0:l.mode)&&void 0!==s?s:we.displayZeroLines.mode,transparency:ge(null===(d=e.display_zero_lines)||void 0===d?void 0:d.transparency,we.displayZeroLines.transparency),grey_color:null!==(u=null===(c=e.display_zero_lines)||void 0===c?void 0:c.grey_color)&&void 0!==u?u:we.displayZeroLines.grey_color},individual_mode_config:{mode:"sort_power"}}),(null===(h=this._config.entities)||void 0===h?void 0:h.individual)&&this._config.entities.individual.length>4)throw new Error("Only 4 individual entities are supported")}connectedCallback(){super.connectedCallback(),this._tryConnectAll()}disconnectedCallback(){this._tryDisconnectAll()}static async getConfigElement(){return await Promise.resolve().then((function(){return Ba})),document.createElement("power-flow-card-plus-editor")}static getStubConfig(e){return function(e){function t(t,o){const i=e.states[t].attributes.friendly_name;return o.some((e=>t.includes(e)||(null==i?void 0:i.includes(e))))}const o=Object.keys(e.states).filter((t=>{const o=e.states[t];return o.state&&o.attributes&&"power"===o.attributes.device_class||o.entity_id.includes("power")})),i=["grid","utility","net","meter"],a=["solar","pv","photovoltaic","inverter"],n=["battery"],r=["battery_percent","battery_level","state_of_charge","soc","percentage"],l=o.filter((e=>t(e,i)))[0],s=o.filter((e=>t(e,a)))[0],d=o.filter((e=>t(e,n)))[0],c=Object.keys(e.states).filter((t=>{const o=e.states[t];return o&&o.state&&o.attributes&&"%"===o.attributes.unit_of_measurement})).filter((e=>t(e,r)))[0];return{entities:{battery:{entity:null!=d?d:"",state_of_charge:null!=c?c:""},grid:l?{entity:l}:void 0,solar:s?{entity:s,display_zero_state:!0}:void 0},clickable_entities:!0,display_zero_lines:!0,use_new_flow_rate_model:!0,w_decimals:we.wattDecimals,kw_decimals:we.kilowattDecimals,min_flow_rate:we.minFlowRate,max_flow_rate:we.maxFlowRate,max_expected_power:we.maxExpectedPower,min_expected_power:we.minExpectedPower,watt_threshold:we.wattThreshold,transparency_zero_lines:we.transparencyZeroLines}}(e)}getCardSize(){return 3}openDetails(e,t){if(e.stopPropagation(),!t||!this._config.clickable_entities)return;if(!((e,t)=>t in e.states)(this.hass,t))return;const o=new CustomEvent("hass-more-info",{composed:!0,detail:{entityId:t}});this.dispatchEvent(o)}render(){var e,t,o,i,a,n,r,l,s,d,c,u,h,p,v,_,m,f,y,g,b,w,x,k,S,$,C,E,A,M,P,z,D,T,O,N,j,B,L,I,F,U,G,V,W,Z,K,Y,X,q,J,Q,ee,te,oe,ie,ae,ne,re,le,se,de,ce,ue,he,pe,ve,_e,me,fe,ye,ge,be,we,xe,ke,Se,$e,Ce,Ee,Ae,Me,Pe,ze,Te,Ne,Le,Ie,He,Re,Ue,qe,et,dt,ct,mt,ft,yt,gt,bt,At,Mt,Tt,Ot,Nt,jt,Bt,Lt,It,Ht,Rt,Ft,Ut,Gt,Vt,Wt,Zt,Kt,Yt,Xt,qt,Jt,Qt,eo,to,oo,io,ao,no,ro,lo,so,co,uo,ho,po,vo,_o,mo,fo,yo,go,bo,wo,xo,ko,So,$o,Co,Eo,Ao,Mo,Po,zo,Do,To,Oo,No,jo,Bo,Lo,Io,Ho,Ro,Fo,Uo,Go,Vo,Wo,Zo,Ko,Yo,Xo,qo,Jo,Qo;if(!this._config||!this.hass)return H``;const{entities:ei}=this._config;this.style.setProperty("--clickable-cursor",this._config.clickable_entities?"pointer":"default");const ti=null,oi={entity:null===(e=ei.grid)||void 0===e?void 0:e.entity,has:void 0!==(null===(t=null==ei?void 0:ei.grid)||void 0===t?void 0:t.entity),hasReturnToGrid:"string"==typeof(null===(o=ei.grid)||void 0===o?void 0:o.entity)||!!(null===(a=null===(i=ei.grid)||void 0===i?void 0:i.entity)||void 0===a?void 0:a.production),state:{fromGrid:Ge(this.hass,this._config),toGrid:(ii=this.hass,ai=this._config,Fe(ii,ai,"grid")),toBattery:ti,toHome:ti},powerOutage:{has:void 0!==(null===(r=null===(n=ei.grid)||void 0===n?void 0:n.power_outage)||void 0===r?void 0:r.entity),isOutage:(ei.grid&&(null===(s=this.hass.states[null===(l=ei.grid.power_outage)||void 0===l?void 0:l.entity])||void 0===s?void 0:s.state))===(null!==(u=null===(c=null===(d=ei.grid)||void 0===d?void 0:d.power_outage)||void 0===c?void 0:c.state_alert)&&void 0!==u?u:"on"),icon:(null===(p=null===(h=ei.grid)||void 0===h?void 0:h.power_outage)||void 0===p?void 0:p.icon_alert)||"mdi:transmission-tower-off",name:null!==(m=null===(_=null===(v=ei.grid)||void 0===v?void 0:v.power_outage)||void 0===_?void 0:_.label_alert)&&void 0!==m?m:H`Power<br>Outage`,entityGenerator:null===(y=null===(f=ei.grid)||void 0===f?void 0:f.power_outage)||void 0===y?void 0:y.entity_generator},icon:Je(this.hass,ei.grid,"mdi:transmission-tower"),name:Qe(this.hass,ei.grid,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.grid")),mainEntity:"object"==typeof(null===(g=ei.grid)||void 0===g?void 0:g.entity)?ei.grid.entity.consumption||ei.grid.entity.production:null===(b=ei.grid)||void 0===b?void 0:b.entity,color:{fromGrid:null===(x=null===(w=ei.grid)||void 0===w?void 0:w.color)||void 0===x?void 0:x.consumption,toGrid:null===(S=null===(k=ei.grid)||void 0===k?void 0:k.color)||void 0===S?void 0:S.production,icon_type:null===($=ei.grid)||void 0===$?void 0:$.color_icon,circle_type:null===(C=ei.grid)||void 0===C?void 0:C.color_circle},secondary:{entity:null===(A=null===(E=ei.grid)||void 0===E?void 0:E.secondary_info)||void 0===A?void 0:A.entity,decimals:null===(P=null===(M=ei.grid)||void 0===M?void 0:M.secondary_info)||void 0===P?void 0:P.decimals,template:null===(D=null===(z=ei.grid)||void 0===z?void 0:z.secondary_info)||void 0===D?void 0:D.template,has:void 0!==(null===(O=null===(T=ei.grid)||void 0===T?void 0:T.secondary_info)||void 0===O?void 0:O.entity),state:Ve(this.hass,this._config),icon:null===(j=null===(N=ei.grid)||void 0===N?void 0:N.secondary_info)||void 0===j?void 0:j.icon,unit:null===(L=null===(B=ei.grid)||void 0===B?void 0:B.secondary_info)||void 0===L?void 0:L.unit_of_measurement,unit_white_space:null===(F=null===(I=ei.grid)||void 0===I?void 0:I.secondary_info)||void 0===F?void 0:F.unit_white_space,accept_negative:(null===(G=null===(U=ei.grid)||void 0===U?void 0:U.secondary_info)||void 0===G?void 0:G.accept_negative)||!1,color:{type:null===(W=null===(V=ei.grid)||void 0===V?void 0:V.secondary_info)||void 0===W?void 0:W.color_value}}};var ii,ai;const ni={entity:null===(Z=ei.solar)||void 0===Z?void 0:Z.entity,has:void 0!==(null===(K=ei.solar)||void 0===K?void 0:K.entity),state:{total:We(this.hass,this._config),toHome:ti,toGrid:ti,toBattery:ti},icon:Je(this.hass,ei.solar,"mdi:solar-power"),name:Qe(this.hass,ei.solar,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.solar")),secondary:{entity:null===(X=null===(Y=ei.solar)||void 0===Y?void 0:Y.secondary_info)||void 0===X?void 0:X.entity,decimals:null===(J=null===(q=ei.solar)||void 0===q?void 0:q.secondary_info)||void 0===J?void 0:J.decimals,template:null===(ee=null===(Q=ei.solar)||void 0===Q?void 0:Q.secondary_info)||void 0===ee?void 0:ee.template,has:void 0!==(null===(oe=null===(te=ei.solar)||void 0===te?void 0:te.secondary_info)||void 0===oe?void 0:oe.entity),accept_negative:(null===(ae=null===(ie=ei.solar)||void 0===ie?void 0:ie.secondary_info)||void 0===ae?void 0:ae.accept_negative)||!1,state:Ze(this.hass,this._config),icon:null===(re=null===(ne=ei.solar)||void 0===ne?void 0:ne.secondary_info)||void 0===re?void 0:re.icon,unit:null===(se=null===(le=ei.solar)||void 0===le?void 0:le.secondary_info)||void 0===se?void 0:se.unit_of_measurement,unit_white_space:null===(ce=null===(de=ei.solar)||void 0===de?void 0:de.secondary_info)||void 0===ce?void 0:ce.unit_white_space}},ri={entity:null===(ue=ei.battery)||void 0===ue?void 0:ue.entity,has:(()=>{var e,t,o,i,a;return!!(null===(e=ei.battery)||void 0===e?void 0:e.entity)&&("object"==typeof(null===(t=ei.battery)||void 0===t?void 0:t.entity)?(null===(o=ei.battery)||void 0===o?void 0:o.entity.consumption)||(null===(i=ei.battery)||void 0===i?void 0:i.entity.production):void 0!==(null===(a=ei.battery)||void 0===a?void 0:a.entity))})(),mainEntity:"object"==typeof(null===(he=ei.battery)||void 0===he?void 0:he.entity)?ei.battery.entity.consumption:null===(pe=ei.battery)||void 0===pe?void 0:pe.entity,name:Qe(this.hass,ei.battery,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.battery")),icon:Je(this.hass,ei.battery,"mdi:battery-high"),state_of_charge:{state:Ke(this.hass,this._config),unit:(null===(ve=null==ei?void 0:ei.battery)||void 0===ve?void 0:ve.state_of_charge_unit)||"%",unit_white_space:(null===(_e=null==ei?void 0:ei.battery)||void 0===_e?void 0:_e.state_of_charge_unit_white_space)||!0,decimals:(null===(me=null==ei?void 0:ei.battery)||void 0===me?void 0:me.state_of_charge_decimals)||0},state:{toBattery:Ye(this.hass,this._config),fromBattery:Xe(this.hass,this._config),toGrid:0,toHome:0},color:{fromBattery:null===(ye=null===(fe=ei.battery)||void 0===fe?void 0:fe.color)||void 0===ye?void 0:ye.consumption,toBattery:null===(be=null===(ge=ei.battery)||void 0===ge?void 0:ge.color)||void 0===be?void 0:be.production,icon_type:void 0,circle_type:null===(we=ei.battery)||void 0===we?void 0:we.color_circle}},li={entity:null===(xe=ei.home)||void 0===xe?void 0:xe.entity,has:void 0!==(null===(ke=null==ei?void 0:ei.home)||void 0===ke?void 0:ke.entity),state:ti,icon:Je(this.hass,null==ei?void 0:ei.home,"mdi:home"),name:Qe(this.hass,null==ei?void 0:ei.home,this.hass.localize("ui.panel.lovelace.cards.energy.energy_distribution.home")),secondary:{entity:null===($e=null===(Se=ei.home)||void 0===Se?void 0:Se.secondary_info)||void 0===$e?void 0:$e.entity,template:null===(Ee=null===(Ce=ei.home)||void 0===Ce?void 0:Ce.secondary_info)||void 0===Ee?void 0:Ee.template,has:void 0!==(null===(Me=null===(Ae=ei.home)||void 0===Ae?void 0:Ae.secondary_info)||void 0===Me?void 0:Me.entity),state:nt(this.hass,this._config),accept_negative:(null===(ze=null===(Pe=ei.home)||void 0===Pe?void 0:Pe.secondary_info)||void 0===ze?void 0:ze.accept_negative)||!1,unit:null===(Ne=null===(Te=ei.home)||void 0===Te?void 0:Te.secondary_info)||void 0===Ne?void 0:Ne.unit_of_measurement,unit_white_space:null===(Ie=null===(Le=ei.home)||void 0===Le?void 0:Le.secondary_info)||void 0===Ie?void 0:Ie.unit_white_space,icon:null===(Re=null===(He=ei.home)||void 0===He?void 0:He.secondary_info)||void 0===Re?void 0:Re.icon,decimals:null===(qe=null===(Ue=ei.home)||void 0===Ue?void 0:Ue.secondary_info)||void 0===qe?void 0:qe.decimals}},si=(null===(et=ei.individual)||void 0===et?void 0:et.map((e=>Pt(this.hass,e))))||[],di={entity:null===(dt=ei.fossil_fuel_percentage)||void 0===dt?void 0:dt.entity,name:Qe(this.hass,ei.fossil_fuel_percentage,this.hass.localize("card.label.non_fossil_fuel_percentage")),icon:Je(this.hass,ei.fossil_fuel_percentage,"mdi:leaf"),has:ot(this.hass,this._config),hasPercentage:it(this.hass,this._config),state:{power:ti},color:null===(ct=ei.fossil_fuel_percentage)||void 0===ct?void 0:ct.color,color_value:null===(mt=ei.fossil_fuel_percentage)||void 0===mt?void 0:mt.color_value,secondary:{entity:null===(yt=null===(ft=ei.fossil_fuel_percentage)||void 0===ft?void 0:ft.secondary_info)||void 0===yt?void 0:yt.entity,decimals:null===(bt=null===(gt=ei.fossil_fuel_percentage)||void 0===gt?void 0:gt.secondary_info)||void 0===bt?void 0:bt.decimals,template:null===(Mt=null===(At=ei.fossil_fuel_percentage)||void 0===At?void 0:At.secondary_info)||void 0===Mt?void 0:Mt.template,has:void 0!==(null===(Ot=null===(Tt=ei.fossil_fuel_percentage)||void 0===Tt?void 0:Tt.secondary_info)||void 0===Ot?void 0:Ot.entity),state:at(this.hass,this._config),accept_negative:(null===(jt=null===(Nt=ei.fossil_fuel_percentage)||void 0===Nt?void 0:Nt.secondary_info)||void 0===jt?void 0:jt.accept_negative)||!1,icon:null===(Lt=null===(Bt=ei.fossil_fuel_percentage)||void 0===Bt?void 0:Bt.secondary_info)||void 0===Lt?void 0:Lt.icon,unit:null===(Ht=null===(It=ei.fossil_fuel_percentage)||void 0===It?void 0:It.secondary_info)||void 0===Ht?void 0:Ht.unit_of_measurement,unit_white_space:null===(Ft=null===(Rt=ei.fossil_fuel_percentage)||void 0===Rt?void 0:Rt.secondary_info)||void 0===Ft?void 0:Ft.unit_white_space,color_value:null===(Gt=null===(Ut=ei.fossil_fuel_percentage)||void 0===Ut?void 0:Ut.secondary_info)||void 0===Gt?void 0:Gt.color_value}};oi.state.fromGrid=tt(oi.state.fromGrid,null===(Vt=ei.grid)||void 0===Vt?void 0:Vt.display_zero_tolerance),oi.state.toGrid=tt(oi.state.toGrid,null===(Wt=ei.grid)||void 0===Wt?void 0:Wt.display_zero_tolerance),ni.state.total=tt(ni.state.total,null===(Zt=ei.solar)||void 0===Zt?void 0:Zt.display_zero_tolerance),ri.state.fromBattery=tt(ri.state.fromBattery,null===(Kt=ei.battery)||void 0===Kt?void 0:Kt.display_zero_tolerance),ri.state.toBattery=tt(ri.state.toBattery,null===(Yt=ei.battery)||void 0===Yt?void 0:Yt.display_zero_tolerance),0===oi.state.fromGrid&&(oi.state.toHome=0,oi.state.toBattery=0),0===ni.state.total&&(ni.state.toGrid=0,ni.state.toBattery=0,ni.state.toHome=0),0===ri.state.fromBattery&&(ri.state.toGrid=0,ri.state.toHome=0),ni.has&&(ni.state.toHome=(null!==(Xt=ni.state.total)&&void 0!==Xt?Xt:0)-(null!==(qt=oi.state.toGrid)&&void 0!==qt?qt:0)-(null!==(Jt=ri.state.toBattery)&&void 0!==Jt?Jt:0));const ci=Math.max(null!==(eo=null===(Qt=ei.grid)||void 0===Qt?void 0:Qt.display_zero_tolerance)&&void 0!==eo?eo:0,null!==(oo=null===(to=ei.battery)||void 0===to?void 0:to.display_zero_tolerance)&&void 0!==oo?oo:0);if(null!==ni.state.toHome&&ni.state.toHome<0?(ri.has&&(oi.state.toBattery=Math.abs(ni.state.toHome),oi.state.toBattery>(null!==(io=oi.state.fromGrid)&&void 0!==io?io:0)&&(ri.state.toGrid=Math.min(oi.state.toBattery-(null!==(ao=oi.state.fromGrid)&&void 0!==ao?ao:0),0),oi.state.toBattery=oi.state.fromGrid)),ni.state.toHome=0):oi.state.toBattery=0,oi.state.toBattery=(null!==(no=oi.state.toBattery)&&void 0!==no?no:0)>ci?oi.state.toBattery:0,ri.has&&(ni.has?(ri.state.toGrid||(ri.state.toGrid=Math.max(0,(oi.state.toGrid||0)-(ni.state.total||0)-(ri.state.toBattery||0)-(oi.state.toBattery||0))),ni.state.toBattery=ri.state.toBattery-(oi.state.toBattery||0),(null===(ro=ei.solar)||void 0===ro?void 0:ro.display_zero_tolerance)&&ei.solar.display_zero_tolerance>=(ni.state.total||0)&&(ni.state.toBattery=0)):ri.state.toGrid=oi.state.toGrid||0,ri.state.toGrid=(ri.state.toGrid||0)>ci&&ri.state.toGrid||0,ri.state.toHome=(null!==(lo=ri.state.fromBattery)&&void 0!==lo?lo:0)-(null!==(so=ri.state.toGrid)&&void 0!==so?so:0)),oi.state.toHome=Math.max(oi.state.fromGrid-(null!==(co=oi.state.toBattery)&&void 0!==co?co:0),0),ni.has&&oi.state.toGrid&&(ni.state.toGrid=oi.state.toGrid-(null!==(uo=ri.state.toGrid)&&void 0!==uo?uo:0)),oi.powerOutage.isOutage&&(oi.state.fromGrid=oi.powerOutage.entityGenerator?Math.max(Oe(this.hass,oi.powerOutage.entityGenerator),0):0,oi.state.toHome=Math.max(oi.state.fromGrid-(null!==(ho=oi.state.toBattery)&&void 0!==ho?ho:0),0),oi.state.toGrid=0,ri.state.toGrid=0,ni.state.toGrid=0,oi.icon=oi.powerOutage.icon,di.has=!1,di.hasPercentage=!1),di.has){const e=1-(null!==(vo=De(this.hass,null===(po=ei.fossil_fuel_percentage)||void 0===po?void 0:po.entity))&&void 0!==vo?vo:0)/100;di.state.power=oi.state.toHome*e}const ui=(null==si?void 0:si.reduce(((e,t)=>e+(t.state||0)),0))||0,hi=Math.max(oi.state.toHome+(null!==(_o=ni.state.toHome)&&void 0!==_o?_o:0)+(null!==(mo=ri.state.toHome)&&void 0!==mo?mo:0),0),pi=ri.state.toHome?Dt*(ri.state.toHome/hi):0,vi=ni.state.toHome?Dt*(ni.state.toHome/hi):0,_i=di.state.power?Dt*(di.state.power/hi):0,mi=Dt*((hi-(null!==(fo=di.state.power)&&void 0!==fo?fo:0)-(null!==(yo=ri.state.toHome)&&void 0!==yo?yo:0)-(null!==(go=ni.state.toHome)&&void 0!==go?go:0))/hi),fi=(null===(bo=ei.home)||void 0===bo?void 0:bo.override_state)&&ei.home.entity?(null===(wo=ei.home)||void 0===wo?void 0:wo.subtract_individual)?rt(this.hass,this._config,Oe(this.hass,ei.home.entity)-ui,{unit:null===(xo=ei.home)||void 0===xo?void 0:xo.unit_of_measurement,unitWhiteSpace:null===(ko=ei.home)||void 0===ko?void 0:ko.unit_white_space,watt_threshold:this._config.watt_threshold}):rt(this.hass,this._config,Oe(this.hass,ei.home.entity),{unit:null===(So=ei.home)||void 0===So?void 0:So.unit_of_measurement,unitWhiteSpace:null===($o=ei.home)||void 0===$o?void 0:$o.unit_white_space,watt_threshold:this._config.watt_threshold}):(null===(Co=ei.home)||void 0===Co?void 0:Co.subtract_individual)?rt(this.hass,this._config,hi-ui||0,{unit:null===(Eo=ei.home)||void 0===Eo?void 0:Eo.unit_of_measurement,unitWhiteSpace:null===(Ao=ei.home)||void 0===Ao?void 0:Ao.unit_white_space,watt_threshold:this._config.watt_threshold}):rt(this.hass,this._config,hi,{unit:null===(Mo=ei.home)||void 0===Mo?void 0:Mo.unit_of_measurement,unitWhiteSpace:null===(Po=ei.home)||void 0===Po?void 0:Po.unit_white_space,watt_threshold:this._config.watt_threshold}),yi=oi.state.toHome+(null!==(zo=ni.state.toHome)&&void 0!==zo?zo:0)+(null!==(Do=ni.state.toGrid)&&void 0!==Do?Do:0)+(null!==(To=ni.state.toBattery)&&void 0!==To?To:0)+(null!==(Oo=ri.state.toHome)&&void 0!==Oo?Oo:0)+(null!==(No=oi.state.toBattery)&&void 0!==No?No:0)+(null!==(jo=ri.state.toGrid)&&void 0!==jo?jo:0);null===ri.state_of_charge.state?ri.icon="mdi:battery":ri.state_of_charge.state<=72&&ri.state_of_charge.state>44?ri.icon="mdi:battery-medium":ri.state_of_charge.state<=44&&ri.state_of_charge.state>16?ri.icon="mdi:battery-low":ri.state_of_charge.state<=16&&(ri.icon="mdi:battery-outline"),void 0!==(null===(Bo=ei.battery)||void 0===Bo?void 0:Bo.icon)&&(ri.icon=null===(Lo=ei.battery)||void 0===Lo?void 0:Lo.icon);const gi={batteryGrid:je(this._config,null!==(Ho=null!==(Io=oi.state.toBattery)&&void 0!==Io?Io:ri.state.toGrid)&&void 0!==Ho?Ho:0,yi),batteryToHome:je(this._config,null!==(Ro=ri.state.toHome)&&void 0!==Ro?Ro:0,yi),gridToHome:je(this._config,oi.state.toHome,yi),solarToBattery:je(this._config,null!==(Fo=ni.state.toBattery)&&void 0!==Fo?Fo:0,yi),solarToGrid:je(this._config,null!==(Uo=ni.state.toGrid)&&void 0!==Uo?Uo:0,yi),solarToHome:je(this._config,null!==(Go=ni.state.toHome)&&void 0!==Go?Go:0,yi),individual:(null==si?void 0:si.map((e=>{var t;return je(this._config,null!==(t=e.state)&&void 0!==t?t:0,ui)})))||[],nonFossil:je(this._config,null!==(Vo=di.state.power)&&void 0!==Vo?Vo:0,yi)};["batteryGrid","batteryToHome","gridToHome","solarToBattery","solarToGrid","solarToHome"].forEach((e=>{const t=this[`${e}Flow`];t&&this.previousDur[e]&&this.previousDur[e]!==gi[e]&&(t.pauseAnimations(),t.setCurrentTime(t.getCurrentTime()*(gi[e]/this.previousDur[e])),t.unpauseAnimations()),this.previousDur[e]=gi[e]}));const bi={battery:{value:pi,color:"var(--energy-battery-out-color)"},solar:{value:vi,color:"var(--energy-solar-color)"},grid:{value:mi,color:"var(--energy-grid-consumption-color)"},gridNonFossil:{value:_i,color:"var(--energy-non-fossil-color)"}},wi=Object.keys(bi).reduce(((e,t)=>bi[e].value>bi[t].value?e:t)),xi=e=>e?void 0===(null==e?void 0:e.state)?"":rt(this.hass,this._config,null==e?void 0:e.state,{decimals:null==e?void 0:e.decimals,unit:null==e?void 0:e.unit,unitWhiteSpace:null==e?void 0:e.unit_white_space,watt_threshold:this._config.watt_threshold}):"",ki=["left-top","left-bottom","right-top","right-bottom"],Si={gridSecondary:null===(Wo=this._templateResults.gridSecondary)||void 0===Wo?void 0:Wo.result,solarSecondary:null===(Zo=this._templateResults.solarSecondary)||void 0===Zo?void 0:Zo.result,homeSecondary:null===(Ko=this._templateResults.homeSecondary)||void 0===Ko?void 0:Ko.result,nonFossilFuelSecondary:null===(Yo=this._templateResults.nonFossilFuelSecondary)||void 0===Yo?void 0:Yo.result,individual:(null==si?void 0:si.map(((e,t)=>{var o;return null===(o=this._templateResults[`${ki[t]}Secondary`])||void 0===o?void 0:o.result})))||[]},$i=this._width>420;((e,{grid:t,solar:o,entities:i,individual:a,battery:n,homeSources:r,homeLargestSource:l,nonFossil:s,display_zero_lines_transparency:d,display_zero_lines_grey_color:c,isCardWideEnough:u})=>{var h,p,v,_,m,f,y,g,b,w,x,k,S,$,C,E,A,M,P,z,D,T,O,N;if(e.style.setProperty("--icon-grid-color","consumption"===t.color.icon_type?"var(--energy-grid-consumption-color)":"production"===t.color.icon_type?"var(--energy-grid-return-color)":!0===t.color.icon_type?(null!==(h=t.state.fromGrid)&&void 0!==h?h:0)>=(null!==(p=t.state.toGrid)&&void 0!==p?p:0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--primary-text-color)"),e.style.setProperty("--circle-grid-color","consumption"===t.color.circle_type?"var(--energy-grid-consumption-color)":"production"===t.color.circle_type?"var(--energy-grid-return-color)":!0===t.color.circle_type?(null!==(v=t.state.fromGrid)&&void 0!==v?v:0)>=(null!==(_=t.state.toGrid)&&void 0!==_?_:0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--energy-grid-consumption-color)"),void 0!==t.color.fromGrid&&("object"==typeof t.color.fromGrid&&(t.color.fromGrid=lt(t.color.fromGrid)),e.style.setProperty("--energy-grid-consumption-color",t.color.fromGrid||"#a280db")),void 0!==t.color.toGrid&&("object"==typeof t.color.toGrid&&(t.color.toGrid=lt(t.color.toGrid)),e.style.setProperty("--energy-grid-return-color",t.color.toGrid||"#a280db")),e.style.setProperty("--secondary-text-grid-color","consumption"===t.secondary.color.type?"var(--energy-grid-consumption-color)":"production"===t.secondary.color.type?"var(--energy-grid-return-color)":!0===t.secondary.color.type?(null!==(m=t.state.fromGrid)&&void 0!==m?m:0)>=(null!==(f=t.state.toGrid)&&void 0!==f?f:0)?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)":"var(--primary-text-color)"),!1===(null===(y=i.grid)||void 0===y?void 0:y.color_value)?(e.style.setProperty("--text-grid-consumption-color","var(--primary-text-color)"),e.style.setProperty("--text-grid-return-color","var(--primary-text-color)")):(e.style.setProperty("--text-grid-consumption-color","var(--energy-grid-consumption-color)"),e.style.setProperty("--text-grid-return-color","var(--energy-grid-return-color)")),e.style.setProperty("--text-solar-color",(null===(g=i.solar)||void 0===g?void 0:g.color_value)?"var(--energy-solar-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-solar-color",(null===(w=null===(b=i.solar)||void 0===b?void 0:b.secondary_info)||void 0===w?void 0:w.color_value)?"var(--energy-solar-color)":"var(--primary-text-color)"),void 0!==(null===(x=i.solar)||void 0===x?void 0:x.color)){let t=null===(k=i.solar)||void 0===k?void 0:k.color;"object"==typeof t&&(t=lt(t)),e.style.setProperty("--energy-solar-color",t||"#ff9800")}e.style.setProperty("--icon-solar-color",(null===(S=i.solar)||void 0===S?void 0:S.color_icon)?"var(--energy-solar-color)":"var(--primary-text-color)"),void 0!==n.color.fromBattery&&("object"==typeof n.color.fromBattery&&(n.color.fromBattery=lt(n.color.fromBattery)),e.style.setProperty("--energy-battery-out-color",n.color.fromBattery||"#4db6ac")),void 0!==n.color.toBattery&&("object"==typeof n.color.toBattery&&(n.color.toBattery=lt(n.color.toBattery)),e.style.setProperty("--energy-battery-in-color",n.color.toBattery||"#a280db")),n.color.icon_type=null===($=i.battery)||void 0===$?void 0:$.color_icon,e.style.setProperty("--icon-battery-color","consumption"===n.color.icon_type?"var(--energy-battery-in-color)":"production"===n.color.icon_type?"var(--energy-battery-out-color)":!0===n.color.icon_type?n.state.fromBattery>=n.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)":"var(--primary-text-color)");const j=null===(C=i.battery)||void 0===C?void 0:C.color_state_of_charge_value;if(e.style.setProperty("--text-battery-state-of-charge-color","consumption"===j?"var(--energy-battery-in-color)":"production"===j?"var(--energy-battery-out-color)":!0===j?n.state.fromBattery>=n.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)":"var(--primary-text-color)"),e.style.setProperty("--circle-battery-color","consumption"===n.color.circle_type?"var(--energy-battery-in-color)":"production"===n.color.circle_type||!0===n.color.circle_type&&n.state.fromBattery>=n.state.toBattery?"var(--energy-battery-out-color)":"var(--energy-battery-in-color)"),!1===(null===(E=i.battery)||void 0===E?void 0:E.color_value)?(e.style.setProperty("--text-battery-in-color","var(--primary-text-color)"),e.style.setProperty("--text-battery-out-color","var(--primary-text-color)")):(e.style.setProperty("--text-battery-in-color","var(--energy-battery-in-color)"),e.style.setProperty("--text-battery-out-color","var(--energy-battery-out-color)")),void 0!==s.color&&("object"==typeof s.color&&(s.color=lt(s.color)),e.style.setProperty("--non-fossil-color",s.color||"var(--energy-non-fossil-color)")),e.style.setProperty("--icon-non-fossil-color",(null===(A=i.fossil_fuel_percentage)||void 0===A?void 0:A.color_icon)?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--text-non-fossil-color",(null===(M=i.fossil_fuel_percentage)||void 0===M?void 0:M.color_value)?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-non-fossil-color",(null===(z=null===(P=i.fossil_fuel_percentage)||void 0===P?void 0:P.secondary_info)||void 0===z?void 0:z.color_value)?"var(--non-fossil-color)":"var(--primary-text-color)"),e.style.setProperty("--secondary-text-home-color",(null===(T=null===(D=i.home)||void 0===D?void 0:D.secondary_info)||void 0===T?void 0:T.color_value)?"var(--text-home-color)":"var(--primary-text-color)"),e.style.setProperty("--icon-home-color",st(null===(O=i.home)||void 0===O?void 0:O.color_icon,r,l)),e.style.setProperty("--text-home-color",st(null===(N=i.home)||void 0===N?void 0:N.color_value,r,l)),e.style.setProperty("--battery-grid-line",t.state.toBattery?"var(--energy-grid-consumption-color)":"var(--energy-grid-return-color)"),e.style.setProperty("--transparency-unused-lines",d?d.toString():"0"),void 0!==c){let t=c;"object"==typeof t&&(t=lt(t)),e.style.setProperty("--greyed-out--line-color",t)}if(o.has&&(n.has?(e.style.setProperty("--lines-svg-not-flat-line-height","106%"),e.style.setProperty("--lines-svg-not-flat-line-top","-3%"),e.style.setProperty("--lines-svg-flat-width","calc(100% - 160px)"),e.style.setProperty("--lines-svg-flat-left","0"),e.style.setProperty("--lines-svg-not-flat-left","0")):(e.style.setProperty("--lines-svg-not-flat-line-top","-2%"),e.style.setProperty("--lines-svg-flat-width",u?"calc(100% - 154px)":"calc(100% - 157px)"),e.style.setProperty("--lines-svg-not-flat-width",u?"calc(103% - 172px)":"calc(103% - 169px)"),e.style.setProperty("--lines-svg-not-flat-left","3px"),e.style.setProperty("--lines-svg-flat-left","-3px"))),null==a?void 0:a.some((e=>e.has))){const t=(t,o)=>{var i;const a=["left-top","left-bottom","right-top","right-bottom"],n=(null==a?void 0:a[o])||"left-top";let r=null==t?void 0:t.color;"object"==typeof r&&(r=lt(r)),e.style.setProperty(`--individual-${n}-color`,r||["#d0cc5b","#964cb5","#b54c9d","#5bd0cc"][o]||"#d0cc5b"),e.style.setProperty(`--icon-individual-${n}-color`,!1!==(null==t?void 0:t.color_icon)?`var(--individual-${n}-color)`:"var(--primary-text-color)"),e.style.setProperty(`--text-individual-${n}-color`,(null==t?void 0:t.color_value)?`var(--individual-${n}-color)`:"var(--primary-text-color)"),e.style.setProperty(`--secondary-text-individual-${n}-color`,(null===(i=null==t?void 0:t.secondary_info)||void 0===i?void 0:i.color_value)?`var(--individual-${n}-color)`:"var(--primary-text-color)")};let o=0;a.forEach(((e,n)=>{a[n].has&&(t(i.individual[n],o),o++)}))}})(this,{grid:oi,solar:ni,battery:ri,display_zero_lines_grey_color:"grey_out"===(null===(Xo=this._config.display_zero_lines)||void 0===Xo?void 0:Xo.mode)?null===(qo=this._config.display_zero_lines)||void 0===qo?void 0:qo.grey_color:"",display_zero_lines_transparency:"transparency"===(null===(Jo=this._config.display_zero_lines)||void 0===Jo?void 0:Jo.mode)?null===(Qo=this._config.display_zero_lines)||void 0===Qo?void 0:Qo.transparency:"",entities:ei,homeLargestSource:wi,homeSources:bi,individual:si,nonFossil:di,isCardWideEnough:$i});const Ci=((e,t)=>{var o;if("sort_power"===(null===(o=e.individual_mode_config)||void 0===o?void 0:o.mode))return wt(t,0)})(this._config,si),Ei=xt(this._config,si),Ai=kt(this._config,si),Mi=St(this._config,si);return H`<ha-card .header="${this._config.title}" class="${this._config.full_size?"full-size":""}" style="${this._config.style_ha_card?this._config.style_ha_card:""}"><div class="card-content ${this._config.full_size?"full-size":""}" id="power-flow-card-plus" style="${this._config.style_card_content?this._config.style_card_content:""}">${ni.has||(null==si?void 0:si.some((e=>null==e?void 0:e.has)))||di.hasPercentage?H`<div class="row">${_t(this,this._config,{entities:ei,grid:oi,newDur:gi,nonFossil:di,templatesObj:Si})} ${ni.has?((e,t,{entities:o,solar:i,templatesObj:a})=>{var n;return H`<div class="circle-container solar"><span class="label">${i.name}</span><div class="circle" @click="${t=>{e.openDetails(t,i.entity)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,i.entity)}}">${ut(e.hass,e,t,a,i,"solar")} ${" "!==i.icon?H`<ha-icon id="solar-icon" .icon="${i.icon}">`:null} ${!1!==(null===(n=o.solar)||void 0===n?void 0:n.display_zero_state)||(i.state.total||0)>0?H`<span class="solar">${rt(e.hass,t,i.state.total,{unit:i.state.unit,unitWhiteSpace:i.state.unit_white_space,decimals:i.state.decimals,watt_threshold:t.watt_threshold})}</span>`:""}</div></div>`})(this,this._config,{entities:ei,solar:ni,templatesObj:Si}):(null==si?void 0:si.some((e=>null==e?void 0:e.has)))?H`<div class="spacer"></div>`:""} ${Ci?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n})=>{var r,l,s,d,c,u;if(!o)return H`<div class="spacer"></div>`;const h=(null===(l=null===(r=null==t?void 0:t.entities)||void 0===r?void 0:r.individual)||void 0===l?void 0:l.findIndex((e=>e.entity===o.entity)))||0,p=n.individual[h]||0;return H`<div class="circle-container individual-top"><span class="label">${o.name}</span><div class="circle" @click="${t=>{e.openDetails(t,null==o?void 0:o.entity)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,null==o?void 0:o.entity)}}">${zt(e.hass,e,t,i,o,h,"left-top")} ${" "!==o.icon?H`<ha-icon id="individual-left-top-icon" .icon="${o.icon}">`:null} ${!1!==(null===(s=null==o?void 0:o.field)||void 0===s?void 0:s.display_zero_state)||(o.state||0)>(null!==(d=o.displayZeroTolerance)&&void 0!==d?d:0)?H`<span class="individual-top individual-left-top">${(null==o?void 0:o.showDirection)?H`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:""}${a}</span>`:""}</div>${pt(t,o.state||0)?H`<svg width="80" height="30"><path d="M40 -10 v50" id="individual-top" class="${ht(o.state||0,t)}"/>${vt(t)&&o.state&&o.state>=(null!==(c=o.displayZeroTolerance)&&void 0!==c?c:0)?R`<circle r="1.75" class="individual-top" vector-effect="non-scaling-stroke"><animateMotion dur="${Be(null===(u=null==o?void 0:o.field)||void 0===u?void 0:u.calculate_flow_rate,p)}s" repeatCount="indefinite" calcMode="linear" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-top"></animateMotion></circle>`:""}</svg>`:""}</div>`})(this,this._config,{individualObj:Ci,displayState:xi(Ci),newDur:gi,templatesObj:Si}):H`<div class="spacer"></div>`} ${$t(this._config,si)?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n,battery:r,individualObjs:l})=>{var s,d,c,u,h,p;if(!o)return H`<div class="spacer"></div>`;const v=(null===(d=null===(s=null==t?void 0:t.entities)||void 0===s?void 0:s.individual)||void 0===d?void 0:d.findIndex((e=>e.entity===o.entity)))||-1;if(-1===v)return H`<div class="spacer"></div>`;const _=n.individual[v]||1.66,m=!!(null==r?void 0:r.has)||Ct(t,l);return H`<div class="circle-container individual-top individual-right individual-right-top"><span class="label">${o.name}</span><div class="circle" @click="${t=>{e.openDetails(t,null==o?void 0:o.entity)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,null==o?void 0:o.entity)}}">${zt(e.hass,e,t,i,o,v,"right-top")} ${" "!==o.icon?H`<ha-icon id="individual-right-top-icon" .icon="${o.icon}">`:null} ${!1!==(null===(c=null==o?void 0:o.field)||void 0===c?void 0:c.display_zero_state)||(o.state||0)>(null!==(u=o.displayZeroTolerance)&&void 0!==u?u:0)?H`<span class="individual-top individual-right-top">${(null==o?void 0:o.showDirection)?H`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:""}${a}</span>`:""}</div>${pt(t,o.state||0)?H`<div class="right-individual-flow-container"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" class="right-individual-flow"><path id="individual-top-right-home" class="${ht(o.state||0,t)}" d="M${m?45:47},0 v15 c0,${m?"30 -10,30 -30,30":"35 -10,35 -30,35"} h-20" vector-effect="non-scaling-stroke"/>${vt(t)&&o.state&&o.state>=(null!==(h=o.displayZeroTolerance)&&void 0!==h?h:0)?R`<circle r="1" class="individual-top" vector-effect="non-scaling-stroke"><animateMotion dur="${Be(null===(p=null==o?void 0:o.field)||void 0===p?void 0:p.calculate_flow_rate,_)}s" repeatCount="indefinite" calcMode="linear" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-top-right-home"></animateMotion></circle>`:""}</svg></div>`:""}</div>`})(this,this._config,{displayState:xi(Ai),individualObj:Ai,newDur:gi,templatesObj:Si,battery:ri,individualObjs:si}):H``}</div>`:H``}<div class="row">${oi.has?((e,t,{entities:o,grid:i,templatesObj:a})=>{var n,r,l,s,d,c,u,h,p,v,_;return H`<div class="circle-container grid"><div class="circle" @click="${t=>{var a,n,r,l,s;const d=null!==(n=null===(a=i.powerOutage)||void 0===a?void 0:a.entityGenerator)&&void 0!==n?n:null===(l=null===(r=o.grid)||void 0===r?void 0:r.power_outage)||void 0===l?void 0:l.entity,c=(null===(s=i.powerOutage)||void 0===s?void 0:s.isOutage)&&d?d:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,c)}}" @keyDown="${t=>{var a,n,r,l,s;if("Enter"===t.key){const d=null!==(n=null===(a=i.powerOutage)||void 0===a?void 0:a.entityGenerator)&&void 0!==n?n:null===(l=null===(r=o.grid)||void 0===r?void 0:r.power_outage)||void 0===l?void 0:l.entity,c=(null===(s=i.powerOutage)||void 0===s?void 0:s.isOutage)&&d?d:"string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,c)}}}">${ut(e.hass,e,t,a,i,"grid")} ${" "!==i.icon?H`<ha-icon id="grid-icon" .icon="${i.icon}">`:null} ${("two_way"===(null===(n=o.grid)||void 0===n?void 0:n.display_state)||void 0===(null===(r=o.grid)||void 0===r?void 0:r.display_state)||"one_way_no_zero"===(null===(l=o.grid)||void 0===l?void 0:l.display_state)&&(null!==(s=i.state.toGrid)&&void 0!==s?s:0)>0||"one_way"===(null===(d=o.grid)||void 0===d?void 0:d.display_state)&&(null===i.state.fromGrid||0===i.state.fromGrid)&&0!==i.state.toGrid)&&null!==i.state.toGrid&&!i.powerOutage.isOutage?H`<span class="return" @click="${t=>{const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.openDetails(t,i)}}" @keyDown="${t=>{if("Enter"===t.key){const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.production;e.openDetails(t,i)}}}"><ha-icon class="small" .icon="${"mdi:arrow-left"}"></ha-icon>${rt(e.hass,t,i.state.toGrid,{unit:i.unit,unitWhiteSpace:i.unit_white_space,decimals:i.decimals,watt_threshold:t.watt_threshold})}</span>`:null} ${("two_way"===(null===(c=o.grid)||void 0===c?void 0:c.display_state)||void 0===(null===(u=o.grid)||void 0===u?void 0:u.display_state)||"one_way_no_zero"===(null===(h=o.grid)||void 0===h?void 0:h.display_state)&&i.state.fromGrid>0||"one_way"===(null===(p=o.grid)||void 0===p?void 0:p.display_state)&&(null===i.state.toGrid||0===i.state.toGrid))&&null!==i.state.fromGrid&&!i.powerOutage.isOutage||i.powerOutage.isOutage&&i.powerOutage.entityGenerator?H`<span class="consumption" @click="${t=>{const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,i)}}" @keyDown="${t=>{if("Enter"===t.key){const i="string"==typeof o.grid.entity?o.grid.entity:o.grid.entity.consumption;e.openDetails(t,i)}}}"><ha-icon class="small" .icon="${"mdi:arrow-right"}"></ha-icon>${rt(e.hass,t,i.state.fromGrid,{unit:i.unit,unitWhiteSpace:i.unit_white_space,decimals:i.decimals,watt_threshold:t.watt_threshold})}</span>`:""} ${(null===(v=i.powerOutage)||void 0===v?void 0:v.isOutage)&&!(null===(_=i.powerOutage)||void 0===_?void 0:_.entityGenerator)?H`<span class="grid power-outage">${i.powerOutage.name}</span>`:""}</div><span class="label">${i.name}</span></div>`})(this,this._config,{entities:ei,grid:oi,templatesObj:Si}):H`<div class="spacer"></div>`}<div class="spacer"></div>${((e,t,{home:o,entities:i,templatesObj:a,homeUsageToDisplay:n,homeSolarCircumference:r,circleCircumference:l,homeBatteryCircumference:s,homeNonFossilCircumference:d,homeGridCircumference:c,individual:u})=>{const h=u.filter((e=>e.has)).length<=1;return H`<div class="circle-container home"><div class="circle" id="home-circle" @click="${t=>{var o;e.openDetails(t,null===(o=i.home)||void 0===o?void 0:o.entity)}}" @keyDown="${t=>{var o;"Enter"===t.key&&e.openDetails(t,null===(o=i.home)||void 0===o?void 0:o.entity)}}">${ut(e.hass,e,t,a,o,"home")} ${" "!==o.icon?H`<ha-icon id="home-icon" .icon="${o.icon}">`:null} ${n} <svg class="home-circle-sections">${void 0!==r?R`<circle class="solar" cx="40" cy="40" r="38" stroke-dasharray="${r} ${l-r}" shape-rendering="geometricPrecision" stroke-dashoffset="-${l-r}">`:""} ${s?R`<circle class="battery" cx="40" cy="40" r="38" stroke-dasharray="${s} ${l-s}" stroke-dashoffset="-${l-s-(r||0)}" shape-rendering="geometricPrecision">`:""} ${void 0!==d?R`<circle class="low-carbon" cx="40" cy="40" r="38" stroke-dasharray="${d} ${l-d}" stroke-dashoffset="-${l-d-(s||0)-(r||0)}" shape-rendering="geometricPrecision">`:""}<circle class="grid" cx="40" cy="40" r="38" stroke-dasharray="${null!=c?c:l-r-(s||0)} ${void 0!==c?l-c:r+(s||0)}" stroke-dashoffset="0" shape-rendering="geometricPrecision"/></svg></div>${h?H`<span class="label">${o.name}</span>`:H`<span class="label"></span>`}</div>`})(this,this._config,{circleCircumference:Dt,entities:ei,grid:oi,home:li,homeBatteryCircumference:pi,homeGridCircumference:mi,homeNonFossilCircumference:_i,homeSolarCircumference:vi,newDur:gi,templatesObj:Si,homeUsageToDisplay:fi,individual:si})} ${$t(this._config,si)?H`<div class="spacer"></div>`:H``}</div>${ri.has||Ct(this._config,si)?H`<div class="row"><div class="spacer"></div>${ri.has?((e,t,{battery:o,entities:i})=>{var a,n,r,l,s,d,c,u,h,p;return H`<div class="circle-container battery"><div class="circle" @click="${t=>{var o,a,n,r,l;const s=(null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)?null===(a=i.battery)||void 0===a?void 0:a.state_of_charge:"string"==typeof(null===(n=i.battery)||void 0===n?void 0:n.entity)?null===(r=i.battery)||void 0===r?void 0:r.entity:null===(l=i.battery)||void 0===l?void 0:l.entity.production;e.openDetails(t,s)}}" @keyDown="${t=>{var o,a;if("Enter"===t.key){const n=(null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)?null===(a=i.battery)||void 0===a?void 0:a.state_of_charge:"string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.openDetails(t,n)}}}">${null!==o.state_of_charge.state&&!1!==(null===(a=i.battery)||void 0===a?void 0:a.show_state_of_charge)?H`<span @click="${t=>{var o;e.openDetails(t,null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)}}" @keyDown="${t=>{var o;"Enter"===t.key&&e.openDetails(t,null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)}}" id="battery-state-of-charge-text">${rt(e.hass,t,o.state_of_charge.state,{unit:null!==(n=o.state_of_charge.unit)&&void 0!==n?n:"%",unitWhiteSpace:o.state_of_charge.unit_white_space,decimals:o.state_of_charge.decimals,accept_negative:void 0,watt_threshold:t.watt_threshold})}</span>`:null} ${" "!==o.icon?H`<ha-icon id="battery-icon" .icon="${o.icon}" @click="${t=>{var o;e.openDetails(t,null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)}}" @keyDown="${t=>{var o;"Enter"===t.key&&e.openDetails(t,null===(o=i.battery)||void 0===o?void 0:o.state_of_charge)}}">`:null} ${"two_way"===(null===(r=i.battery)||void 0===r?void 0:r.display_state)||void 0===(null===(l=i.battery)||void 0===l?void 0:l.display_state)||"one_way_no_zero"===(null===(s=i.battery)||void 0===s?void 0:s.display_state)&&o.state.toBattery>0||"one_way"===(null===(d=i.battery)||void 0===d?void 0:d.display_state)&&0!==o.state.toBattery?H`<span class="battery-in" @click="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.openDetails(t,o)}}" @keyDown="${t=>{if("Enter"===t.key){const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.production;e.openDetails(t,o)}}}"><ha-icon class="small" .icon="${"mdi:arrow-down"}"></ha-icon>${rt(e.hass,t,o.state.toBattery,{unit:o.unit,unitWhiteSpace:o.unit_white_space,decimals:o.decimals,watt_threshold:t.watt_threshold})}</span>`:""} ${"two_way"===(null===(c=i.battery)||void 0===c?void 0:c.display_state)||void 0===(null===(u=i.battery)||void 0===u?void 0:u.display_state)||"one_way_no_zero"===(null===(h=i.battery)||void 0===h?void 0:h.display_state)&&o.state.fromBattery>0||"one_way"===(null===(p=i.battery)||void 0===p?void 0:p.display_state)&&(0===o.state.toBattery||0!==o.state.fromBattery)?H`<span class="battery-out" @click="${t=>{const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.openDetails(t,o)}}" @keyDown="${t=>{if("Enter"===t.key){const o="string"==typeof i.battery.entity?i.battery.entity:i.battery.entity.consumption;e.openDetails(t,o)}}}"><ha-icon class="small" .icon="${"mdi:arrow-up"}"></ha-icon>${rt(e.hass,t,o.state.fromBattery,{unit:o.unit,unitWhiteSpace:o.unit_white_space,decimals:o.decimals,watt_threshold:t.watt_threshold})}</span>`:""}</div><span class="label">${o.name}</span></div>`})(this,this._config,{battery:ri,entities:ei}):H`<div class="spacer"></div>`} ${Ei?((e,t,o,{individualObj:i,templatesObj:a,displayState:n,newDur:r})=>{var l,s,d,c,u,h;if(!i)return H`<div class="spacer"></div>`;const p=(null===(s=null===(l=null==o?void 0:o.entities)||void 0===l?void 0:l.individual)||void 0===s?void 0:s.findIndex((e=>e.entity===i.entity)))||0,v=r.individual[p]||0;return H`<div class="circle-container individual-bottom bottom">${pt(o,(null==i?void 0:i.state)||0)?H`<svg width="80" height="30"><path d="M40 40 v-40" id="individual-bottom" class="${ht((null==i?void 0:i.state)||0,o)}"/>${vt(o)&&(null==i?void 0:i.state)&&i.state>=(null!==(d=i.displayZeroTolerance)&&void 0!==d?d:0)?R`<circle r="1.75" class="individual-bottom" vector-effect="non-scaling-stroke"><animateMotion dur="${Be(!1!==(null===(c=i.field)||void 0===c?void 0:c.calculate_flow_rate),v)}s" repeatCount="indefinite" calcMode="linear" keyPoints="${i.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-bottom"></animateMotion></circle>`:""}</svg>`:H`<svg width="80" height="30"></svg>`}<div class="circle" @click="${t=>{e.openDetails(t,null==i?void 0:i.entity)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,null==i?void 0:i.entity)}}">${zt(t,e,o,a,i,p,"left-bottom")} ${" "!==(null==i?void 0:i.icon)?H`<ha-icon id="individual-left-bottom-icon" .icon="${null==i?void 0:i.icon}">`:null} ${!1!==(null===(u=null==i?void 0:i.field)||void 0===u?void 0:u.display_zero_state)||((null==i?void 0:i.state)||0)>(null!==(h=i.displayZeroTolerance)&&void 0!==h?h:0)?H`<span class="individual-bottom individual-left-bottom">${(null==i?void 0:i.showDirection)?H`<ha-icon class="small" .icon="${(null==i?void 0:i.invertAnimation)?"mdi:arrow-up":"mdi:arrow-down"}"></ha-icon>`:""}${n}</span>`:""}</div><span class="label">${null==i?void 0:i.name}</span></div>`})(this,this.hass,this._config,{displayState:xi(Ei),individualObj:Ei,newDur:gi,templatesObj:Si}):H`<div class="spacer"></div>`} ${$t(this._config,si)?((e,t,{individualObj:o,templatesObj:i,displayState:a,newDur:n,battery:r,individualObjs:l})=>{var s,d,c,u,h,p;if(!o)return H`<div class="spacer"></div>`;const v=(null===(d=null===(s=null==t?void 0:t.entities)||void 0===s?void 0:s.individual)||void 0===d?void 0:d.findIndex((e=>e.entity===o.entity)))||-1;if(-1===v)return H`<div class="spacer"></div>`;const _=n.individual[v]||1.66;return(null==r?void 0:r.has)||Ct(t,l),H`<div class="circle-container individual-bottom individual-right individual-right-bottom"><div class="circle" @click="${t=>{e.openDetails(t,null==o?void 0:o.entity)}}" @keyDown="${t=>{"Enter"===t.key&&e.openDetails(t,null==o?void 0:o.entity)}}">${zt(e.hass,e,t,i,o,v,"right-bottom")} ${" "!==o.icon?H`<ha-icon id="individual-right-bottom-icon" .icon="${o.icon}">`:null} ${!1!==(null===(c=null==o?void 0:o.field)||void 0===c?void 0:c.display_zero_state)||(o.state||0)>(null!==(u=o.displayZeroTolerance)&&void 0!==u?u:0)?H`<span class="individual-bottom individual-right-bottom">${(null==o?void 0:o.showDirection)?H`<ha-icon class="small" .icon="${o.invertAnimation?"mdi:arrow-down":"mdi:arrow-up"}"></ha-icon>`:""}${a}</span>`:""}</div><span class="label">${o.name}</span> ${pt(t,o.state||0)?H`<div class="right-individual-flow-container"><svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid slice" class="right-individual-flow"><path id="individual-bottom-right-home" class="${ht(o.state||0,t)}" d="M45,100 v-15 c0,-30 -10,-30 -30,-30 h-20" vector-effect="non-scaling-stroke"/>${vt(t)&&o.state&&o.state>=(null!==(h=o.displayZeroTolerance)&&void 0!==h?h:0)?R`<circle r="1" class="individual-bottom" vector-effect="non-scaling-stroke"><animateMotion dur="${Be(null===(p=null==o?void 0:o.field)||void 0===p?void 0:p.calculate_flow_rate,_)}s" repeatCount="indefinite" calcMode="linear" keyPoints="${o.invertAnimation?"0;1":"1;0"}" keyTimes="0;1"><mpath xlink:href="#individual-bottom-right-home"></animateMotion></circle>`:""}</svg></div>`:""}</div>`})(this,this._config,{displayState:xi(Mi),individualObj:Mi,newDur:gi,templatesObj:Si,battery:ri,individualObjs:si}):H``}</div>`:H`<div class="spacer"></div>`} ${Et(this._config,{battery:ri,grid:oi,individual:si,newDur:gi,solar:ni})}</div>${((e,t)=>e.dashboard_link||e.second_dashboard_link?H`<div class="card-actions">${e.dashboard_link?H`<a href="${e.dashboard_link}"><mwc-button>${e.dashboard_link_label||t.localize("ui.panel.lovelace.cards.energy.energy_distribution.go_to_energy_dashboard")}</mwc-button></a>`:""} ${e.second_dashboard_link?H`<a href="${e.second_dashboard_link}"><mwc-button>${e.second_dashboard_link_label||t.localize("ui.panel.lovelace.cards.energy.energy_distribution.go_to_energy_dashboard")}</mwc-button></a>`:""}</div>`:H``)(this._config,this.hass)}</ha-card>`}updated(e){var t;if(super.updated(e),!this._config||!this.hass)return;const o=null===(t=null==this?void 0:this.shadowRoot)||void 0===t?void 0:t.querySelector("#power-flow-card-plus"),i=o?getComputedStyle(o).getPropertyValue("width"):"0px";this._width=parseInt(i.replace("px",""),10),this._tryConnectAll()}_tryConnectAll(){var e,t,o,i,a,n,r,l,s;const{entities:d}=this._config,c={gridSecondary:null===(t=null===(e=d.grid)||void 0===e?void 0:e.secondary_info)||void 0===t?void 0:t.template,solarSecondary:null===(i=null===(o=d.solar)||void 0===o?void 0:o.secondary_info)||void 0===i?void 0:i.template,homeSecondary:null===(n=null===(a=d.home)||void 0===a?void 0:a.secondary_info)||void 0===n?void 0:n.template,individualSecondary:null===(r=d.individual)||void 0===r?void 0:r.map((e=>{var t;return null===(t=e.secondary_info)||void 0===t?void 0:t.template})),nonFossilFuelSecondary:null===(s=null===(l=d.fossil_fuel_percentage)||void 0===l?void 0:l.secondary_info)||void 0===s?void 0:s.template};for(const[e,t]of Object.entries(c))if(t)if(Array.isArray(t)){const e=["left-top","left-bottom","right-top","right-bottom"];t.forEach(((t,o)=>{t&&this._tryConnect(t,`${e[o]}Secondary`)}))}else this._tryConnect(t,e)}async _tryConnect(e,t){var o,i,a,n,r,l;if(this.hass&&this._config&&void 0===(null===(o=this._unsubRenderTemplates)||void 0===o?void 0:o.get(t))&&""!==e)try{const o=(n=this.hass.connection,r=e=>{this._templateResults[t]=e},l={template:e,entity_ids:this._config.entity_id,variables:{config:this._config,user:this.hass.user.name},strict:!0},n.subscribeMessage((e=>r(e)),Object.assign({type:"render_template"},l)));null===(i=this._unsubRenderTemplates)||void 0===i||i.set(t,o),await o}catch(o){this._templateResults=Object.assign(Object.assign({},this._templateResults),{[t]:{result:e,listeners:{all:!1,domains:[],entities:[],time:!1}}}),null===(a=this._unsubRenderTemplates)||void 0===a||a.delete(t)}}async _tryDisconnectAll(){var e,t,o,i,a,n,r;const{entities:l}=this._config,s={gridSecondary:null===(t=null===(e=l.grid)||void 0===e?void 0:e.secondary_info)||void 0===t?void 0:t.template,solarSecondary:null===(i=null===(o=l.solar)||void 0===o?void 0:o.secondary_info)||void 0===i?void 0:i.template,homeSecondary:null===(n=null===(a=l.home)||void 0===a?void 0:a.secondary_info)||void 0===n?void 0:n.template,individualSecondary:null===(r=l.individual)||void 0===r?void 0:r.map((e=>{var t;return null===(t=e.secondary_info)||void 0===t?void 0:t.template}))};for(const[e,t]of Object.entries(s))t&&this._tryDisconnect(e)}async _tryDisconnect(e){var t,o;const i=null===(t=this._unsubRenderTemplates)||void 0===t?void 0:t.get(e);if(i)try{(await i)(),null===(o=this._unsubRenderTemplates)||void 0===o||o.delete(e)}catch(e){if("not_found"!==e.code&&"template_error"!==e.code)throw e}}};Tt.styles=be,e([pe({attribute:!1})],Tt.prototype,"hass",void 0),e([ve()],Tt.prototype,"_config",void 0),e([ve()],Tt.prototype,"_templateResults",void 0),e([ve()],Tt.prototype,"_unsubRenderTemplates",void 0),e([ve()],Tt.prototype,"_width",void 0),e([_e("#battery-grid-flow")],Tt.prototype,"batteryGridFlow",void 0),e([_e("#battery-home-flow")],Tt.prototype,"batteryToHomeFlow",void 0),e([_e("#grid-home-flow")],Tt.prototype,"gridToHomeFlow",void 0),e([_e("#solar-battery-flow")],Tt.prototype,"solarToBatteryFlow",void 0),e([_e("#solar-grid-flow")],Tt.prototype,"solarToGridFlow",void 0),e([_e("#solar-home-flow")],Tt.prototype,"solarToHomeFlow",void 0),Tt=e([ce("power-flow-card-plus")],Tt);class Ot extends TypeError{constructor(e,t){let o;const{message:i,explanation:a,...n}=e,{path:r}=e,l=0===r.length?i:`At path: ${r.join(".")} -- ${i}`;super(a??l),null!=a&&(this.cause=l),Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>o??(o=[e,...t()])}}function Nt(e){return"object"==typeof e&&null!=e}function jt(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function Bt(e,t,o,i){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:a,branch:n}=t,{type:r}=o,{refinement:l,message:s=`Expected a value of type \`${r}\`${l?` with refinement \`${l}\``:""}, but received: \`${jt(i)}\``}=e;return{value:i,type:r,refinement:l,key:a[a.length-1],path:a,branch:n,...e,message:s}}function*Lt(e,t,o,i){(function(e){return Nt(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const a of e){const e=Bt(a,t,o,i);e&&(yield e)}}function*It(e,t,o={}){const{path:i=[],branch:a=[e],coerce:n=!1,mask:r=!1}=o,l={path:i,branch:a};if(n&&(e=t.coercer(e,l),r&&"type"!==t.type&&Nt(t.schema)&&Nt(e)&&!Array.isArray(e)))for(const o in e)void 0===t.schema[o]&&delete e[o];let s="valid";for(const i of t.validator(e,l))i.explanation=o.message,s="not_valid",yield[i,void 0];for(let[d,c,u]of t.entries(e,l)){const t=It(c,u,{path:void 0===d?i:[...i,d],branch:void 0===d?a:[...a,c],coerce:n,mask:r,message:o.message});for(const o of t)o[0]?(s=null!=o[0].refinement?"not_refined":"not_valid",yield[o[0],void 0]):n&&(c=o[1],void 0===d?e=c:e instanceof Map?e.set(d,c):e instanceof Set?e.add(c):Nt(e)&&(void 0!==c||d in e)&&(e[d]=c))}if("not_valid"!==s)for(const i of t.refiner(e,l))i.explanation=o.message,s="not_refined",yield[i,void 0];"valid"===s&&(yield[void 0,e])}class Ht{constructor(e){const{type:t,schema:o,validator:i,refiner:a,coercer:n=(e=>e),entries:r=function*(){}}=e;this.type=t,this.schema=o,this.entries=r,this.coercer=n,this.validator=i?(e,t)=>Lt(i(e,t),t,this,e):()=>[],this.refiner=a?(e,t)=>Lt(a(e,t),t,this,e):()=>[]}assert(e,t){return Rt(e,this,t)}create(e,t){return function(e,t,o){const i=Ft(e,t,{coerce:!0,message:o});if(i[0])throw i[0];return i[1]}(e,this,t)}is(e){return function(e,t){const o=Ft(e,t);return!o[0]}(e,this)}mask(e,t){return function(e,t,o){const i=Ft(e,t,{coerce:!0,mask:!0,message:o});if(i[0])throw i[0];return i[1]}(e,this,t)}validate(e,t={}){return Ft(e,this,t)}}function Rt(e,t,o){const i=Ft(e,t,{message:o});if(i[0])throw i[0]}function Ft(e,t,o={}){const i=It(e,t,o),a=function(e){const{done:t,value:o}=e.next();return t?void 0:o}(i);if(a[0]){const e=new Ot(a[0],(function*(){for(const e of i)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,a[1]]}function Ut(e,t){return new Ht({type:e,schema:null,validator:t})}function Gt(){return Ut("any",(()=>!0))}function Vt(){return Ut("boolean",(e=>"boolean"==typeof e))}function Wt(){return Ut("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${jt(e)}`))}function Zt(){return Ut("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${jt(e)}`))}function Kt(e){const t=e?Object.keys(e):[],o=Ut("never",(()=>!1));return new Ht({type:"object",schema:e||null,*entries(i){if(e&&Nt(i)){const a=new Set(Object.keys(i));for(const o of t)a.delete(o),yield[o,i[o],e[o]];for(const e of a)yield[e,i[e],o]}},validator:e=>Nt(e)||`Expected an object, but received: ${jt(e)}`,coercer:e=>Nt(e)?{...e}:e})}function Yt(e){return new Ht({...e,validator:(t,o)=>void 0===t||e.validator(t,o),refiner:(t,o)=>void 0===t||e.refiner(t,o)})}function Xt(){return Ut("string",(e=>"string"==typeof e||`Expected a string, but received: ${jt(e)}`))}var qt=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function Jt(e,t){if(e.length!==t.length)return!1;for(var o=0;o<e.length;o++)if(i=e[o],a=t[o],!(i===a||qt(i)&&qt(a)))return!1;var i,a;return!0}function Qt(e,t){void 0===t&&(t=Jt);var o=null;function i(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];if(o&&o.lastThis===this&&t(i,o.lastArgs))return o.lastResult;var n=e.apply(this,i);return o={lastResult:n,lastArgs:i,lastThis:this},n}return i.clear=function(){o=null},i}var eo={label:{car:"Auto",motorbike:"Motorka"}},to={entity_generator:"Generátor",combined:"Kombinovaná entita (jedna entita s kladnými a zápornými hodnotami)",separated:"Oddelené subjekty (jeden subjekt pro spotřebu a jeden pro výrobu)",custom_colors:"Vlastní barvy",secondary_info:"Sekundární informace",power_outage:"Výpadek",grid:"Síť",solar:"Solární",battery:"Baterie",fossil_fuel_percentage:"Fosilní palivo",home:"Dům",individual:"Individuální",accept_negative:"Přijmout záporné hodnoty",advanced:"Pokročilá nastavení",decimals:"Desetinná místa",consumption:"Spotřeba",production:"Výroba",color_icon:"Barva ikony",color_circle:"Barva kruhu",color_value:"Barva hodnoty",color_state_of_charge_value:"Barva",display_zero:"Zobrazit nulu",display_zero_tolerance:"Zobrazit nulovou toleranci",display_state:"Zobrazit stav",display_zero_state:"Zobrazení nulového stavu",invert_state:"Invertovat stav",template:"Šablona",unit_of_measurement:"Jednotka",unit_white_space:"Jednotka bílé plochy",label_alert:"Štítek pro upozornění",icon_alert:"Ikona pro upozornění",state_alert:"Stav upozornění",state_of_charge:"Stav nabití",state_of_charge_unit_white_space:"Bílá plocha",state_of_charge_unit:"Jednotky",state_of_charge_decimals:"Desetinná místa",state_of_charge_icon:"Ikona",show_state_of_charge:"Zobrazit stav nabití",state_type:"Typ stavu",subtract_individual:"Odečíst individuálně",override_state:"Přepsat stav",calculate_flow_rate:"Počítat průtok",inverted_animation:"Invertovat animaci",show_direction:"Zobrazit směr",color:"Barva",dashboard_link:"Odkaz na informační panel",dashboard_link_label:"Název odkazu na informační panel",w_decimals:"Desetinná místa pro Watty",kw_decimals:"Desetinná místa pro kilowatty",max_flow_rate:"Maximální průtok",min_flow_rate:"Minimální průtok",max_expected_power:"Maximální očekávaný výkon",min_expected_power:"Minimální očekávaný výkon",watt_threshold:"Práh wattů na kilowatty",display_zero_lines:"Zobrazit nulové řádky",clickable_entities:"Entity, na které se dá kliknout",disable_dots:"Vypnout tečky",use_new_flow_rate_model:"Nový model průtoku",use_metadata:"Použít Metadata",mode:"Režim",show:"Zobrazit",hide:"Skrýt",custom:"Volitelné",grey_out:"Šedý výstup",transparency:"Průhlednost",grey_color:"Šedá barva"},oo={card:eo,editor:to},io={label:{car:"Car",motorbike:"Motorbike"}},ao={entity_generator:"Generator",combined:"Combined Entity (One entity with positive and negative values)",separated:"Separated Entities (One entity for consumption and one for production)",custom_colors:"Custom Colors",secondary_info:"Secondary Info",power_outage:"Power Outage",grid:"Grid",solar:"Solar",battery:"Battery",fossil_fuel_percentage:"Fossil Fuel",home:"Home",individual:"Individual",accept_negative:"Accept Negative",advanced:"Advanced Options",decimals:"Decimals",consumption:"Consumption",production:"Production",color_icon:"Color of Icon",color_circle:"Color of Circle",color_value:"Color of Value",color_state_of_charge_value:"Color",display_zero:"Display Zero",display_zero_tolerance:"Display Zero Tolerance",display_state:"Display State",display_zero_state:"Display Zero State",invert_state:"Invert State",template:"Template",unit_of_measurement:"Unit",unit_white_space:"Unit White Space",label_alert:"Label for Alert",icon_alert:"Icon for Alert",state_alert:"State of Alert",state_of_charge:"State of Charge",state_of_charge_unit_white_space:"White Space",state_of_charge_unit:"Unit",state_of_charge_decimals:"Decimals",state_of_charge_icon:"Icon",show_state_of_charge:"Show State of Charge",state_type:"Type of State",subtract_individual:"Subtract Individual",override_state:"Override State",calculate_flow_rate:"Calculate Flow Rate",inverted_animation:"Invert Animation",show_direction:"Show Direction",color:"Color",dashboard_link:"Dashboard Link",dashboard_link_label:"Dashboard Link Name",w_decimals:"Watt Decimals",kw_decimals:"Kilowatt Decimals",max_flow_rate:"Max Flow Rate",min_flow_rate:"Min Flow Rate",max_expected_power:"Max Expected Power",min_expected_power:"Min Expected Power",watt_threshold:"Watt to Kilowatt Threshold",display_zero_lines:"Display Zero Lines",clickable_entities:"Clickable Entities",disable_dots:"Disable Dots",use_new_flow_rate_model:"New Flow Rate Model",use_metadata:"Use Metadata",mode:"Mode",show:"Show",hide:"Hide",custom:"Custom",grey_out:"Grey Out",transparency:"Transparency",grey_color:"Grey Color"},no={card:io,editor:ao},ro={label:{car:"Auto",motorbike:"Motorrad"}},lo={entity_generator:"Generator",combined:"Kombinierte Entität (Eine Entität mit positiven und negativen Werten)",separated:"Getrennte Entitäten (Eine Entität für den Verbrauch und eine für die Produktion)",custom_colors:"Benutzerdefinierte Farben",secondary_info:"Sekundäre Information",power_outage:"Stromausfall",grid:"Netz",solar:"Solar",battery:"Batterie",fossil_fuel_percentage:"Fossile Brennstoffe",home:"Zuhause",individual:"Individuell",accept_negative:"Negative Werte akzeptieren",advanced:"Erweiterte Optionen",decimals:"Dezimalstellen",consumption:"Verbrauch",production:"Produktion",color_icon:"Farbe des Symbols",color_circle:"Farbe des Kreises",color_value:"Farbe des Wertes",color_state_of_charge_value:"Farbe",display_zero:"Null anzeigen",display_zero_tolerance:"Nulltoleranz",display_state:"Zustand anzeigen",display_zero_state:"Nullzustand anzeigen",invert_state:"Zustand umkehren",template:"Vorlage",unit_of_measurement:"Einheit",unit_white_space:"Weißraum für Einheit",label_alert:"Beschriftung für Alarm",icon_alert:"Symbol für Alarm",state_alert:"Alarmzustand",state_of_charge:"Ladezustand",state_of_charge_unit_white_space:"Leerzeichen",state_of_charge_unit:"Einheit",state_of_charge_decimals:"Dezimalstellen",state_of_charge_icon:"Symbol",show_state_of_charge:"Ladezustand anzeigen",state_type:"Typ des Zustands",subtract_individual:"Individuell abziehen",override_state:"Zustand überschreiben",calculate_flow_rate:"Flussrate berechnen",inverted_animation:"Animation umkehren",show_direction:"Richtung anzeigen",color:"Farbe",dashboard_link:"Dashboard-Link",dashboard_link_label:"Name des Dashboard-Links",w_decimals:"Watt-Dezimalstellen",kw_decimals:"Kilowatt-Dezimalstellen",max_flow_rate:"Maximale Flussrate",min_flow_rate:"Minimale Flussrate",max_expected_power:"Maximale erwartete Leistung",min_expected_power:"Minimale erwartete Leistung",watt_threshold:"Watt-zu-Kilowatt-Schwelle",display_zero_lines:"Nulllinien anzeigen",clickable_entities:"Klickbare Entitäten",disable_dots:"Punkte deaktivieren",use_new_flow_rate_model:"Neues Fluss-Modell verwenden",use_metadata:"Metadaten verwenden",mode:"Modus",show:"Anzeigen",hide:"Verstecken",custom:"Benutzerdefiniert",grey_out:"Ausgrauen",transparency:"Transparenz",grey_color:"Graue Farbe"},so={card:ro,editor:lo},co={label:{car:"Bil",motorbike:"Motorcykel"}},uo={entity_generator:"Generator",combined:"Kombineret enhed (Én enhed med positive og negative værdier)",separated:"Adskilte enheder (én enhed til forbrug og én til produktion)",custom_colors:"Brugerdefinerede farver",secondary_info:"Sekundær info",power_outage:"Strømafbrydelse",grid:"El-Net",solar:"Solar",battery:"Batteri",fossil_fuel_percentage:"Fossilt Brændstof",home:"Hjem",individual:"Individuel",accept_negative:"Accepter negative værdier",advanced:"Avancerede indstillinger",decimals:"Decimaler",consumption:"Forbrug",production:"Produktion",color_icon:"Farve af Icon",color_circle:"Farve af Cirkel",color_value:"Farve af værdi",color_state_of_charge_value:"Farve",display_zero:"Vis Nul",display_zero_tolerance:"Vis ingen tolerance",display_state:"Vis Tilstand",display_zero_state:"Vis Nultilstand",invert_state:"Omvendt tilstand",template:"Skabelon",unit_of_measurement:"Enhed",unit_white_space:"Enhed tomt mellemrum",label_alert:"Etiket til Alarm",icon_alert:"Ikon for alarm",state_alert:"Alarmtilstand",state_of_charge:"Ladningstilstand",state_of_charge_unit_white_space:"Tomt mellemrum",state_of_charge_unit:"Enhed",state_of_charge_decimals:"Decimal",state_of_charge_icon:"Ikon",show_state_of_charge:"Vis ladningstilstand",state_type:"Tilstande",subtract_individual:"Subtract Individual",override_state:"Overskriv Tilstand",calculate_flow_rate:"Beregn Hastighed",inverted_animation:"Omvendt Animation",show_direction:"Vis Retning",color:"Farve",dashboard_link:"Dashboard Link",dashboard_link_label:"Dashboard Link Navn",w_decimals:"Watt Decimal",kw_decimals:"Kilowatt Decimal",max_flow_rate:"Max Flow Rate",min_flow_rate:"Min Flow Rate",max_expected_power:"Max Forventede Strøm",min_expected_power:"Min Forventede Power",watt_threshold:"Watt til Kilowatt Grænse",display_zero_lines:"Vis Nul Linjer",clickable_entities:"Klikbar enheder",disable_dots:"Deaktiver prikker",use_new_flow_rate_model:"Ny flowhastighedsmodel",use_metadata:"Brug Metadata",mode:"Tilstand",show:"Vis",hide:"Skjul",custom:"Brugerdefinerede",grey_out:"Grået ud",transparency:"Transparens",grey_color:"Grå Farve"},ho={card:co,editor:uo},po={label:{car:"Carro",motorbike:"Mota"}},vo={entity_generator:"Gerador",combined:"Entidade combinada (uma entidade com valores positivos e negativos)",separated:"Entidades Separadas (Uma entidade para consumo e outra para produção)",custom_colors:"Cores personalizadas",secondary_info:"Informação Secundária",power_outage:"Falta de energia",grid:"Rede",solar:"Solar",battery:"Bateria",fossil_fuel_percentage:"Combustíveis Fósseis",home:"Casa",individual:"Individual",accept_negative:"Aceitar Valores Negativos",advanced:"Opções Avançadas",decimals:"Casas Decimais",consumption:"Consumo",production:"Produção",color_icon:"Cor do Ícone",color_circle:"Cor do Círculo",color_value:"Cor do Valor",color_state_of_charge_value:"Cor",display_zero:"Mostrar Zero",display_zero_tolerance:"Tolerância do Zero",display_state:"Mostrar Estado",display_zero_state:"Mostrar Estado Zero",invert_state:"Inverter Estado",template:"Modelo",unit_of_measurement:"Unidade",unit_white_space:"Espaçamento da Unidade",label_alert:"Nome para Alerta",icon_alert:"Ícone para Alerta",state_alert:"Estado do Alerta",state_of_charge:"Estado de Carga",state_of_charge_unit_white_space:"Espaçamento",state_of_charge_unit:"Unidade",state_of_charge_decimals:"Casas Decimais",state_of_charge_icon:"Ícone",show_state_of_charge:"Mostrar Estado de Carga",state_type:"Tipo de Estado",subtract_individual:"Subtrair Individualmente",override_state:"Substituir Estado",calculate_flow_rate:"Calcular Taxa de Fluxo",inverted_animation:"Animação Invertida",show_direction:"Mostrar Direção",color:"Cor",dashboard_link:"Link do Painel de Controlo",dashboard_link_label:"Nome do Link do Painel de Controlo",w_decimals:"Casas Decimais de Watt",kw_decimals:"Casas Decimais de Quilowatt",max_flow_rate:"Taxa de Fluxo Máxima",min_flow_rate:"Taxa de Fluxo Mínima",max_expected_power:"Potência Máxima Esperada",min_expected_power:"Potência Mínima Esperada",watt_threshold:"Limiar de Watt para Quilowatt",display_zero_lines:"Mostrar Linhas Zero",clickable_entities:"Entidades Clicáveis",disable_dots:"Desativar Pontos",use_new_flow_rate_model:"Utilizar Novo Modelo de Velocidade",use_metadata:"Utilizar Metadados",mode:"Modo",show:"Mostrar",hide:"Esconder",custom:"Personalizado",grey_out:"Cinzento",transparency:"Transparência",grey_color:"Cor Cinzenta"},_o={card:po,editor:vo},mo={label:{car:"Carro",motorbike:"Mota"}},fo={entity_generator:"Gerador",combined:"Entidade combinada (uma entidade com valores positivos e negativos)",separated:"Entidades Separadas (Uma entidade para consumo e outra para produção)",custom_colors:"Cores personalizadas",secondary_info:"Informação Secundária",power_outage:"Falta de energia",grid:"Rede",solar:"Solar",battery:"Bateria",fossil_fuel_percentage:"Combustíveis Fósseis",home:"Casa",individual:"Individual",accept_negative:"Aceitar Valores Negativos",advanced:"Opções Avançadas",decimals:"Casas Decimais",consumption:"Consumo",production:"Produção",color_icon:"Cor do Ícone",color_circle:"Cor do Círculo",color_value:"Cor do Valor",color_state_of_charge_value:"Cor",display_zero:"Exibir Zero",display_zero_tolerance:"Tolerância de Zero",display_state:"Exibir Estado",display_zero_state:"Exibir Estado Zero",invert_state:"Inverter Estado",template:"Modelo",unit_of_measurement:"Unidade",unit_white_space:"Espaçamento da Unidade",label_alert:"Rótulo para Alerta",icon_alert:"Ícone para Alerta",state_alert:"Estado do Alerta",state_of_charge:"Estado de Carga",state_of_charge_unit_white_space:"Espaçamento",state_of_charge_unit:"Unidade",state_of_charge_decimals:"Casas Decimais",state_of_charge_icon:"Ícone",show_state_of_charge:"Exibir Estado de Carga",state_type:"Tipo de Estado",subtract_individual:"Subtrair Individualmente",override_state:"Substituir Estado",calculate_flow_rate:"Calcular Taxa de Fluxo",inverted_animation:"Animação Invertida",show_direction:"Mostrar Direção",color:"Cor",dashboard_link:"Link do Painel",dashboard_link_label:"Nome do Link do Painel",w_decimals:"Casas Decimais de Watts",kw_decimals:"Casas Decimais de Quilowatts",max_flow_rate:"Taxa de Fluxo Máxima",min_flow_rate:"Taxa de Fluxo Mínima",max_expected_power:"Potência Máxima Esperada",min_expected_power:"Potência Mínima Esperada",watt_threshold:"Limiar de Watts para Quilowatts",display_zero_lines:"Exibir Linhas Zero",clickable_entities:"Entidades Clicáveis",disable_dots:"Desativar Pontos",use_new_flow_rate_model:"Utilizar Novo Modelo de Velocidade",use_metadata:"Utilizar Metadados",mode:"Modo",show:"Mostrar",hide:"Esconder",custom:"Personalizado",grey_out:"Cinza",transparency:"Transparência",grey_color:"Cor do Cinza"},yo={card:mo,editor:fo},go={label:{car:"Coche",motorbike:"Motocicleta"}},bo={entity_generator:"Generador",combined:"Entidad combinada (una entidad con valores positivos y negativos)",separated:"Entidades separadas (una entidad de consumo y otra de producción)",custom_colors:"Colores personalizados",secondary_info:"Información secundaria",power_outage:"Corte de energía",grid:"Red eléctrica",solar:"Solar",battery:"Batería",fossil_fuel_percentage:"Combustible Fósil",home:"Inicio",individual:"Individual",accept_negative:"Aceptar valores negativos",advanced:"Opciones Avanzadas",decimals:"Decimales",consumption:"Consumo",production:"Producción",color_icon:"Color del Icono",color_circle:"Color del Círculo",color_value:"Color del Valor",color_state_of_charge_value:"Color",display_zero:"Mostrar Cero",display_zero_tolerance:"Tolerancia de Cero",display_state:"Mostrar Estado",display_zero_state:"Mostrar Estado Cero",invert_state:"Invertir Estado",template:"Plantilla",unit_of_measurement:"Unidad",unit_white_space:"Espacio en Blanco de la Unidad",label_alert:"Etiqueta para Alerta",icon_alert:"Ícono para Alerta",state_alert:"Estado de Alerta",state_of_charge:"Estado de Carga",state_of_charge_unit_white_space:"Espacio en Blanco",state_of_charge_unit:"Unidad",state_of_charge_decimals:"Decimales",state_of_charge_icon:"Ícono",show_state_of_charge:"Mostrar Estado de Carga",state_type:"Tipo de Estado",subtract_individual:"Restar Individualmente",override_state:"Sobrescribir Estado",calculate_flow_rate:"Calcular Tasa de Flujo",inverted_animation:"Animación Invertida",show_direction:"Mostrar Dirección",color:"Color",dashboard_link:"Enlace del Tablero",dashboard_link_label:"Nombre del Enlace del Tablero",w_decimals:"Decimales de Vatio",kw_decimals:"Decimales de Kilovatio",max_flow_rate:"Tasa de Flujo Máxima",min_flow_rate:"Tasa de Flujo Mínima",max_expected_power:"Potencia Máxima Esperada",min_expected_power:"Potencia Mínima Esperada",watt_threshold:"Umbral de Vatio a Kilovatio",display_zero_lines:"Mostrar Líneas de Cero",clickable_entities:"Entidades Clicables",disable_dots:"Desactivar Puntos",use_new_flow_rate_model:"Utilizar Nuevo Modelo de Tasa de Flujo",use_metadata:"Utilizar Metadatos",mode:"Modo",show:"Mostrar",hide:"Ocultar",custom:"Personalizado",grey_out:"Gris",transparency:"Transparencia",grey_color:"Color Gris"},wo={card:go,editor:bo},xo={label:{car:"Auto",motorbike:"Motorfiets"}},ko={entity_generator:"Generator",combined:"Gecombineerde entiteit (één entiteit met positieve en negatieve waarden)",separated:"Gescheiden entiteiten (één entiteit voor consumptie en één voor productie)",custom_colors:"Aangepaste kleuren",secondary_info:"Secundaire informatie",power_outage:"Stroomuitval",grid:"Elektriciteitsnet",solar:"Zonne-energie",battery:"Batterij",fossil_fuel_percentage:"Fossiele Brandstof",home:"Thuis",individual:"Individueel",accept_negative:"Negatieve waarden accepteren",advanced:"Geavanceerde Opties",decimals:"Decimalen",consumption:"Verbruik",production:"Productie",color_icon:"Kleur van Pictogram",color_circle:"Kleur van Cirkel",color_value:"Kleur van Waarde",color_state_of_charge_value:"Kleur",display_zero:"Nul Weergeven",display_zero_tolerance:"Nultolerantie Weergeven",display_state:"Toestand Weergeven",display_zero_state:"Nul Toestand Weergeven",invert_state:"Toestand Omkeren",template:"Sjabloon",unit_of_measurement:"Eenheid",unit_white_space:"Eenheid Spaties",label_alert:"Label voor Alarm",icon_alert:"Pictogram voor Alarm",state_alert:"Toestand van Alarm",state_of_charge:"Laadstatus",state_of_charge_unit_white_space:"Spaties",state_of_charge_unit:"Eenheid",state_of_charge_decimals:"Decimalen",state_of_charge_icon:"Pictogram",show_state_of_charge:"Laadstatus Weergeven",state_type:"Type Toestand",subtract_individual:"Individueel Aftrekken",override_state:"Toestand Overschrijven",calculate_flow_rate:"Stroomsnelheid Berekenen",inverted_animation:"Animatie Omkeren",show_direction:"Richting Weergeven",color:"Kleur",dashboard_link:"Dashboard Link",dashboard_link_label:"Naam van Dashboard Link",w_decimals:"Watt Decimalen",kw_decimals:"Kilowatt Decimalen",max_flow_rate:"Maximale Stroomsnelheid",min_flow_rate:"Minimale Stroomsnelheid",max_expected_power:"Maximaal Verwacht Vermogen",min_expected_power:"Minimaal Verwacht Vermogen",watt_threshold:"Watt naar Kilowatt Drempelwaarde",display_zero_lines:"Nullijnen Weergeven",clickable_entities:"Klikbare Entiteiten",disable_dots:"Punten Uitschakelen",use_new_flow_rate_model:"Nieuw Stroomsnelheid Model Gebruiken",use_metadata:"Metadata Gebruiken",mode:"Modus",show:"Weergeven",hide:"Verbergen",custom:"Aangepast",grey_out:"Grijstint",transparency:"Transparantie",grey_color:"Grijstint"},So={card:xo,editor:ko},$o={label:{car:"Auto",motorbike:"Motocicletta"}},Co={entity_generator:"Generatore",combined:"Entità combinata (un'entità con valori positivi e negativi)",separated:"Entità separate (Un'entità per il consumo e una per la produzione)",custom_colors:"Colori personalizzati",secondary_info:"Informazioni secondarie",power_outage:"Interruzione di corrente",grid:"Rete Elettrica",solar:"Solare",battery:"Batteria",fossil_fuel_percentage:"Carburante Fossile",home:"Casa",individual:"Individuale",accept_negative:"Accetta Valori Negativi",advanced:"Opzioni Avanzate",decimals:"Decimali",consumption:"Consumo",production:"Produzione",color_icon:"Colore dell'Icona",color_circle:"Colore del Cerchio",color_value:"Colore del Valore",color_state_of_charge_value:"Colore",display_zero:"Mostra Zero",display_zero_tolerance:"Tolleranza dello Zero",display_state:"Mostra Stato",display_zero_state:"Mostra Stato Zero",invert_state:"Inverti Stato",template:"Modello",unit_of_measurement:"Unità",unit_white_space:"Spazio Bianco Unità",label_alert:"Etichetta per l'Allarme",icon_alert:"Icona per l'Allarme",state_alert:"Stato dell'Allarme",state_of_charge:"Stato di Carica",state_of_charge_unit_white_space:"Spazio Bianco",state_of_charge_unit:"Unità",state_of_charge_decimals:"Decimali",state_of_charge_icon:"Icona",show_state_of_charge:"Mostra Stato di Carica",state_type:"Tipo di Stato",subtract_individual:"Sottrai Individualmente",override_state:"Sovrascrivi Stato",calculate_flow_rate:"Calcola Tasso di Flusso",inverted_animation:"Animazione Invertita",show_direction:"Mostra Direzione",color:"Colore",dashboard_link:"Collegamento Dashboard",dashboard_link_label:"Nome Collegamento Dashboard",w_decimals:"Decimali Watt",kw_decimals:"Decimali Kilowatt",max_flow_rate:"Tasso di Flusso Massimo",min_flow_rate:"Tasso di Flusso Minimo",max_expected_power:"Potenza Massima Prevista",min_expected_power:"Potenza Minima Prevista",watt_threshold:"Soglia Watt per Kilowatt",display_zero_lines:"Mostra Linee Zero",clickable_entities:"Entità Cliccabili",disable_dots:"Disabilita Punti",use_new_flow_rate_model:"Utilizza Nuovo Modello di Tasso di Flusso",use_metadata:"Utilizza Metadati",mode:"Modalità",show:"Mostra",hide:"Nascondi",custom:"Personalizzato",grey_out:"Sfuma",transparency:"Trasparenza",grey_color:"Colore Sfumato"},Eo={card:$o,editor:Co},Ao={label:{car:"Voiture",motorbike:"Moto"}},Mo={entity_generator:"Générateur",combined:"Entité combinée (une entité avec des valeurs positives et négatives)",separated:"Entités séparées (une entité pour la consommation et une pour la production)",custom_colors:"Couleurs personnalisées",secondary_info:"Informations secondaires",power_outage:"Panne de courant",grid:"Réseau Électrique",solar:"Solaire",battery:"Batterie",fossil_fuel_percentage:"Carburant fossile",home:"Domicile",individual:"Individuel",accept_negative:"Accepter les valeurs négatives",advanced:"Options avancées",decimals:"Décimales",consumption:"Consommation",production:"Production",color_icon:"Couleur de l'icône",color_circle:"Couleur du cercle",color_value:"Couleur de la valeur",color_state_of_charge_value:"Couleur",display_zero:"Afficher zéro",display_zero_tolerance:"Tolérance de l'affichage zéro",display_state:"Afficher l'état",display_zero_state:"Afficher l'état zéro",invert_state:"Inverser l'état",template:"Modèle",unit_of_measurement:"Unité",unit_white_space:"Espace blanc de l'unité",label_alert:"Libellé de l'alerte",icon_alert:"Icône de l'alerte",state_alert:"État de l'alerte",state_of_charge:"État de charge",state_of_charge_unit_white_space:"Espace blanc de l'unité",state_of_charge_unit:"Unité",state_of_charge_decimals:"Décimales",state_of_charge_icon:"Icône",show_state_of_charge:"Afficher l'état de charge",state_type:"Type d'état",subtract_individual:"Soustraire l'individuel",override_state:"Remplacer l'état",calculate_flow_rate:"Calculer le débit",inverted_animation:"Animation inversée",show_direction:"Afficher la direction",color:"Couleur",dashboard_link:"Lien du tableau de bord",dashboard_link_label:"Nom du lien du tableau de bord",w_decimals:"Décimales de watt",kw_decimals:"Décimales de kilowatt",max_flow_rate:"Débit maximal",min_flow_rate:"Débit minimal",max_expected_power:"Puissance maximale attendue",min_expected_power:"Puissance minimale attendue",watt_threshold:"Seuil de watt vers kilowatt",display_zero_lines:"Afficher les lignes zéro",clickable_entities:"Entités cliquables",disable_dots:"Désactiver les points",use_new_flow_rate_model:"Nouveau modèle de débit",use_metadata:"Utiliser les métadonnées",mode:"Mode",show:"Afficher",hide:"Masquer",custom:"Personnalisé",grey_out:"Griser",transparency:"Transparence",grey_color:"Couleur grise"},Po={card:Ao,editor:Mo},zo={label:{car:"Автомобиль",motorbike:"Мотоцикл"}},Do={entity_generator:"Генератор",combined:"Комбинированный объект (один объект с положительными и отрицательными значениями)",separated:"Отдельные объекты (один объект для потребления и один для производства)",custom_colors:"Пользовательские цвета",secondary_info:"Вторичная информация",power_outage:"Отключение электричества",grid:"Электрическая сеть",solar:"Солнечная",battery:"Батарея",fossil_fuel_percentage:"Полный объем ископаемого топлива",home:"Домашняя",individual:"Индивидуальная",accept_negative:"Принять отрицательные значения",advanced:"Расширенные настройки",decimals:"Десятичные",consumption:"Потребление",production:"Производство",color_icon:"Цвет иконки",color_circle:"Цвет круга",color_value:"Цвет значения",color_state_of_charge_value:"Цвет",display_zero:"Отображать ноль",display_zero_tolerance:"Допустимая погрешность нуля",display_state:"Отображать состояние",display_zero_state:"Отображать состояние нуля",invert_state:"Инвертировать состояние",template:"Шаблон",unit_of_measurement:"Единица измерения",unit_white_space:"Пробел единицы измерения",label_alert:"Метка для предупреждения",icon_alert:"Иконка для предупреждения",state_alert:"Состояние предупреждения",state_of_charge:"Уровень заряда",state_of_charge_unit_white_space:"Пробел",state_of_charge_unit:"Единица измерения",state_of_charge_decimals:"Десятичные",state_of_charge_icon:"Иконка",show_state_of_charge:"Показать уровень заряда",state_type:"Тип состояния",subtract_individual:"Вычесть индивидуально",override_state:"Переопределить состояние",calculate_flow_rate:"Рассчитать скорость потока",inverted_animation:"Инвертированная анимация",show_direction:"Показать направление",color:"Цвет",dashboard_link:"Ссылка на панель управления",dashboard_link_label:"Название ссылки на панель управления",w_decimals:"Десятичные ватт",kw_decimals:"Десятичные киловатт",max_flow_rate:"Максимальная скорость потока",min_flow_rate:"Минимальная скорость потока",max_expected_power:"Максимальная ожидаемая мощность",min_expected_power:"Минимальная ожидаемая мощность",watt_threshold:"Пороговое значение ватт в киловатты",display_zero_lines:"Отображать нулевые линии",clickable_entities:"Кликабельные сущности",disable_dots:"Отключить точки",use_new_flow_rate_model:"Использовать новую модель скорости потока",use_metadata:"Использовать метаданные",mode:"Режим",show:"Показать",hide:"Скрыть",custom:"Пользовательский",grey_out:"Серый",transparency:"Прозрачность",grey_color:"Серый цвет"},To={card:zo,editor:Do},Oo={label:{car:"Auto",motorbike:"Moottoripyörä"}},No={entity_generator:"Generaattori",combined:"Yhdistetty kokonaisuus (yksi kokonaisuus positiivisilla ja negatiivisilla arvoilla)",separated:"Erotetut kokonaisuudet (yksi kulutukseen ja yksi tuotantoon)",custom_colors:"Mukautetut värit",secondary_info:"Toissijaiset tiedot",power_outage:"Sähkökatkos",grid:"Sähköverkko",solar:"Aurinko",battery:"Akku",fossil_fuel_percentage:"Fossiilinen polttoaine",home:"Koti",individual:"Yksittäinen",accept_negative:"Hyväksy negatiiviset arvot",advanced:"Lisäasetukset",decimals:"Desimaalit",consumption:"Kulutus",production:"Tuotanto",color_icon:"Ikonin väri",color_circle:"Ympyrän väri",color_value:"Arvon väri",color_state_of_charge_value:"Väri",display_zero:"Näytä nolla",display_zero_tolerance:"Näytä nolla-toleranssi",display_state:"Näytä tila",display_zero_state:"Näytä nolla-tila",invert_state:"Käänteinen tila",template:"Malli",unit_of_measurement:"Yksikkö",unit_white_space:"Yksikön välilyönti",label_alert:"Hälytyksen teksti",icon_alert:"Hälytyksen kuvake",state_alert:"Hälytyksen tila",state_of_charge:"Varauksen tila",state_of_charge_unit_white_space:"Välilyönti",state_of_charge_unit:"Yksikkö",state_of_charge_decimals:"Desimaalit",state_of_charge_icon:"Kuvake",show_state_of_charge:"Näytä varauksen tila",state_type:"Tilan tyyppi",subtract_individual:"Vähennä yksittäinen",override_state:"Korvaa tila",calculate_flow_rate:"Laske virtausnopeus",inverted_animation:"Käänteinen animaatio",show_direction:"Näytä suunta",color:"Väri",dashboard_link:"Ohjauspaneelin linkki",dashboard_link_label:"Ohjauspaneelin linkin nimi",w_decimals:"Wattien desimaalit",kw_decimals:"Kilowattien desimaalit",max_flow_rate:"Maksimivirtausnopeus",min_flow_rate:"Minimivirtausnopeus",max_expected_power:"Ennustettu maksimiteho",min_expected_power:"Ennustettu minimiteho",watt_threshold:"Wattin ja kilowatin kynnysarvo",display_zero_lines:"Näytä nolla-viivat",clickable_entities:"Napautettavat kohteet",disable_dots:"Poista pisteet",use_new_flow_rate_model:"Uusi virtausnopeusmalli",use_metadata:"Käytä metatietoja",mode:"Tila",show:"Näytä",hide:"Piilota",custom:"Mukautettu",grey_out:"Harmaa",transparency:"Läpinäkyvyys",grey_color:"Harmaa väri"},jo={card:Oo,editor:No},Bo={label:{car:"Samochód",motorbike:"Motocykl"}},Lo={entity_generator:"Generator",combined:"Jednostka połączona (jedna jednostka z wartościami dodatnimi i ujemnymi)",separated:"Oddzielne podmioty (jeden podmiot do konsumpcji i jeden do produkcji)",custom_colors:"Kolory niestandardowe",secondary_info:"Informacje dodatkowe",power_outage:"Brak prądu",grid:"Sieć elektryczna",solar:"Energia słoneczna",battery:"Bateria",fossil_fuel_percentage:"Paliwo kopalne",home:"Dom",individual:"Indywidualne",accept_negative:"Akceptuj wartości ujemne",advanced:"Zaawansowane opcje",decimals:"Miejsca po przecinku",consumption:"Zużycie",production:"Produkcja",color_icon:"Kolor ikony",color_circle:"Kolor okręgu",color_value:"Kolor wartości",color_state_of_charge_value:"Kolor",display_zero:"Wyświetl zero",display_zero_tolerance:"Wyświetl tolerancję zera",display_state:"Wyświetl stan",display_zero_state:"Wyświetl stan zera",invert_state:"Odwróć stan",template:"Szablon",unit_of_measurement:"Jednostka",unit_white_space:"Spacja jednostki",label_alert:"Etykieta alertu",icon_alert:"Ikona alertu",state_alert:"Stan alertu",state_of_charge:"Stan naładowania",state_of_charge_unit_white_space:"Spacja jednostki",state_of_charge_unit:"Jednostka",state_of_charge_decimals:"Miejsca po przecinku",state_of_charge_icon:"Ikona",show_state_of_charge:"Pokaż stan naładowania",state_type:"Typ stanu",subtract_individual:"Odjęcie indywidualne",override_state:"Nadpisanie stanu",calculate_flow_rate:"Oblicz wskaźnik przepływu",inverted_animation:"Odwróć animację",show_direction:"Pokaż kierunek",color:"Kolor",dashboard_link:"Link do panelu",dashboard_link_label:"Nazwa linku do panelu",w_decimals:"Miejsca po przecinku dla watów",kw_decimals:"Miejsca po przecinku dla kilowatów",max_flow_rate:"Maksymalna szybkość przepływu",min_flow_rate:"Minimalna szybkość przepływu",max_expected_power:"Maksymalna oczekiwana moc",min_expected_power:"Minimalna oczekiwana moc",watt_threshold:"Próg watów na kilowaty",display_zero_lines:"Wyświetl linie zera",clickable_entities:"Klikalne jednostki",disable_dots:"Wyłącz kropki",use_new_flow_rate_model:"Nowy model wskaźnika przepływu",use_metadata:"Użyj metadanych",mode:"Tryb",show:"Pokaż",hide:"Ukryj",custom:"Niestandardowy",grey_out:"Szary",transparency:"Przezroczystość",grey_color:"Kolor szary"},Io={card:Bo,editor:Lo},Ho={label:{car:"Auto",motorbike:"Motorka"}},Ro={entity_generator:"Generátor",combined:"Kombinovaná entita (jedna entita s kladnými a zápornými hodnotami)",separated:"Oddelené subjekty (jeden subjekt pre spotrebu a jeden pre výrobu)",custom_colors:"Vlastné farby",secondary_info:"Sekundárne informácie",power_outage:"Výpadok",grid:"Sieť",solar:"Solárne",battery:"Batéria",fossil_fuel_percentage:"Fosílne palivo",home:"Doma",individual:"Individuálne",accept_negative:"Povoliť záporné hodnoty",advanced:"Pokročilé nastavenia",decimals:"Desatinné",consumption:"Spotreba",production:"Výroba",color_icon:"Farba ikony",color_circle:"Farba kruhu",color_value:"Farba hodnoty",color_state_of_charge_value:"Farba",display_zero:"Zobraziť nulu",display_zero_tolerance:"Zobraziť nulovú toleranciu",display_state:"Zobraziť stav",display_zero_state:"Zobrazenie nulového stavu",invert_state:"Invertovať stav",template:"Šablóna",unit_of_measurement:"Jednotka",unit_white_space:"Jednotka bielej plochy",label_alert:"Štítok pre upozornenie",icon_alert:"Ikona pre upozornenie",state_alert:"Stav upozornenia",state_of_charge:"Stav nabitia",state_of_charge_unit_white_space:"Biela plocha",state_of_charge_unit:"Jednotky",state_of_charge_decimals:"Desatinné",state_of_charge_icon:"Ikona",show_state_of_charge:"Zobraziť stav nabitia",state_type:"Typ stavu",subtract_individual:"Odčítať individuálne",override_state:"Prepísať stav",calculate_flow_rate:"Počítať prietok",inverted_animation:"Invertovať animáciu",show_direction:"Zobraziť smer",color:"Farba",dashboard_link:"Odkaz na informačný panel",dashboard_link_label:"Názov odkazu na informačný panel",w_decimals:"Wattové desatinné miesta",kw_decimals:"Kilowattové desatinné miesta",max_flow_rate:"Max prietok",min_flow_rate:"Min prietok",max_expected_power:"Max očakávaný výkon",min_expected_power:"Min očakávaný výkon",watt_threshold:"Prah wattov na kilowatty",display_zero_lines:"Zobraziť nulové riadky",clickable_entities:"Entity, na ktoré sa dá kliknúť",disable_dots:"Vypnúť bodky",use_new_flow_rate_model:"Nový model prietoku",use_metadata:"Použiť Metadata",mode:"Mód",show:"Zobraziť",hide:"Skryť",custom:"Voliteľné",grey_out:"Grey Out",transparency:"Transparentnosť",grey_color:"Šedá farba"},Fo={card:Ho,editor:Ro},Uo={label:{car:"Bil",motorbike:"Motorcykel"}},Go={entity_generator:"Generator",combined:"Sammansatt entitet (en entitet med postitiva och negativa värden)",separated:"Separata entiteter (en entitet för konsumtion och en för produktion)",custom_colors:"Anpassade färger",secondary_info:"Sekundär information",power_outage:"Strömavbrott",grid:"Nät",solar:"Sol",battery:"Batteri",fossil_fuel_percentage:"Fossilt bränsle",home:"Hem",individual:"Individuell",accept_negative:"Acceptera negativa värden",advanced:"Avancerade inställningar",decimals:"Decimaler",consumption:"Konsumtion",production:"Produktion",color_icon:"Ikonfärg",color_circle:"Cirkelfärg",color_value:"Färg på värde",color_state_of_charge_value:"Färg",display_zero:"Visa vid nollvärde",display_zero_tolerance:"Tolerans för nollvärde",display_state:"Visningsläge",display_zero_state:"Visning vid noll",invert_state:"Invertera status",template:"Mall",unit_of_measurement:"Enhet",unit_white_space:"Mellanrum före enhet",label_alert:"Varningsetikett",icon_alert:"Varningsikon",state_alert:"Status vid strömavbrott",state_of_charge:"Laddningsnivå",state_of_charge_unit_white_space:"Mellanrum före enhet",state_of_charge_unit:"Enhet",state_of_charge_decimals:"Decimaler",state_of_charge_icon:"Ikon",show_state_of_charge:"Visa laddningsnivå",state_type:"Statustyp",subtract_individual:"Individuell avräkning",override_state:"Använd entitetsvärde",calculate_flow_rate:"Beräkna flöde",inverted_animation:"Reversera animation",show_direction:"Visa riktning",color:"Färg",dashboard_link:"Länk till kontrollpanel",dashboard_link_label:"Länknamn till kontrollpanel",w_decimals:"Decimaler watt",kw_decimals:"Decimaler kilowatt",max_flow_rate:"Maximalt flöde",min_flow_rate:"Minimalt flöde",max_expected_power:"Maximal förväntad effekt",min_expected_power:"Minimal förväntad effekt",watt_threshold:"Tröskelvärde för kiloprefix",display_zero_lines:"Vising av inaktiva linjer",clickable_entities:"Klickbara entiteter",disable_dots:"Avaktivera punkter",use_new_flow_rate_model:"Ny flödesmodell",use_metadata:"Använd metadata",mode:"Läge",show:"Visa",hide:"Dölj",custom:"Anpassad",grey_out:"Utgråad",transparency:"Transparens",grey_color:"Grå färg"},Vo={card:Uo,editor:Go};const Wo={cs:Object.freeze({__proto__:null,card:eo,editor:to,default:oo}),en:Object.freeze({__proto__:null,card:io,editor:ao,default:no}),de:Object.freeze({__proto__:null,card:ro,editor:lo,default:so}),dk:Object.freeze({__proto__:null,card:co,editor:uo,default:ho}),pt:Object.freeze({__proto__:null,card:po,editor:vo,default:_o}),pt_BR:Object.freeze({__proto__:null,card:mo,editor:fo,default:yo}),es:Object.freeze({__proto__:null,card:go,editor:bo,default:wo}),nl:Object.freeze({__proto__:null,card:xo,editor:ko,default:So}),it:Object.freeze({__proto__:null,card:$o,editor:Co,default:Eo}),fr:Object.freeze({__proto__:null,card:Ao,editor:Mo,default:Po}),ru:Object.freeze({__proto__:null,card:zo,editor:Do,default:To}),fi:Object.freeze({__proto__:null,card:Oo,editor:No,default:jo}),pl:Object.freeze({__proto__:null,card:Bo,editor:Lo,default:Io}),sk:Object.freeze({__proto__:null,card:Ho,editor:Ro,default:Fo}),sv:Object.freeze({__proto__:null,card:Uo,editor:Go,default:Vo})},Zo="en";function Ko(e,t){try{return e.split(".").reduce(((e,t)=>e[t]),Wo[t])}catch(e){return}}function Yo(e){let t=Ko(e,(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_"));return t||(t=Ko(e,Zo)),null!=t?t:e}function Xo(){return{type:"expandable",title:Yo("editor.combined"),schema:[{name:"entity",selector:{entity:{}}}]}}function qo(){return{type:"expandable",title:Yo("editor.separated"),name:"entity",schema:[{name:"consumption",label:"Consumption Entity",selector:{entity:{}}},{name:"production",label:"Production Entity",selector:{entity:{}}}]}}const Jo={name:"color",title:Yo("editor.custom_colors"),type:"expandable",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"consumption",label:"Consumption",selector:{color_rgb:{}}},{name:"production",label:"Production",selector:{color_rgb:{}}}]}]},Qo=[{name:"entity",selector:{entity:{}}},{name:"template",label:"Template (overrides entity, save to update)",selector:{template:{}}},{type:"grid",column_min_width:"200px",schema:[{name:"icon",selector:{icon:{}}},{name:"unit_of_measurement",label:"Unit of Measurement",selector:{text:{}}},{name:"decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:10,step:1}}},{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"unit_white_space",label:"Unit White Space",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}}},{name:"accept_negative",label:"Accept Negative",selector:{boolean:{}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}}]}],ei=[{name:"color_icon",label:"Color of Icon",selector:{select:{options:[{value:!1,label:"Do not Color"},{value:!0,label:"Color dynamically"},{value:"production",label:"Production"},{value:"consumption",label:"Consumption"}],custom_value:!0}}},{name:"color_circle",label:"Color of Circle",selector:{select:{options:[{value:!0,label:"Color dynamically"},{value:!1,label:"Consumption"},{value:"production",label:"Production"}],custom_value:!0}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{min:0,max:1e6,step:1,mode:"box"}}},{name:"display_state",label:"Display State",selector:{select:{options:[{value:"two_way",label:"Two Way"},{value:"one_way_no_zero",label:"One Way"},{value:"one_way",label:"One Way (Show Zero)"}],custom_value:!0}}}];function ti(e){const t={type:"grid",column_min_width:"200px",schema:[{name:"name",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]};return"battery"!==e&&"grid"!==e||t.schema.push(...ei),t}const oi=Object.assign(Object.assign({},ti("grid")),{schema:[...ti("grid").schema,{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}},{name:"color_value",label:"Color of Value",selector:{boolean:{}}}]}),ii=[Xo(),qo(),oi,Jo,{title:Yo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Qo},{title:Yo("editor.power_outage"),name:"power_outage",type:"expandable",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"entity",selector:{entity:{}}},{name:"entity_generator",label:"Generator Entity",selector:{entity:{}}},{name:"label_alert",label:"Outage Label",selector:{text:{}}},{name:"icon_alert",label:"Outage Icon",selector:{icon:{}}},{name:"state_alert",label:"Outage State",selector:{text:{}}}]}]}],ai=Object.assign(Object.assign({},ti("battery")),{schema:[...ti("battery").schema,{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"color_value",label:"Color of Value",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]}),ni=[Xo(),qo(),{title:Yo("editor.state_of_charge"),name:"",type:"expandable",schema:[{name:"state_of_charge",label:"State of Charge Entity",selector:{entity:{}}},{name:"",type:"grid",column_min_width:"200px",schema:[{name:"state_of_charge_unit",label:"Unit",selector:{text:{}}},{name:"state_of_charge_unit_white_space",label:"Unit White Space",selector:{boolean:{}}},{name:"state_of_charge_decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:4,step:1}}},{name:"show_state_of_charge",label:"Show State of Charge",selector:{boolean:{}}},{name:"color_state_of_charge_value",label:"Color of Value",selector:{select:{options:[{value:!1,label:"Do Not Color"},{value:!0,label:"Color dynamically"},{value:"consumption",label:"Consumption"},{value:"production",label:"Production"}],custom_value:!0}}}]}]},ai,Jo],ri=[{name:"entity",selector:{entity:{}}},Object.assign(Object.assign({},ti()),{schema:[...ti().schema,{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"color_icon",label:"Color Icon",selector:{boolean:{}}},{name:"display_zero_state",label:"Display State When Zero?",selector:{boolean:{}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"invert_state",label:"Invert State",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]}),{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Yo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Qo}],li=[{name:"entity",selector:{entity:{}}},Object.assign(Object.assign({},ti()),{schema:[...ti().schema,{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"color_icon",label:"Color Icon",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"display_zero_state",label:"Display Zero State",selector:{boolean:{}}},{name:"unit_of_measurement",label:"Unit of Measurement",selector:{text:{}}},{name:"calculate_flow_rate",label:"Calculate Flow Rate",selector:{boolean:{}}},{name:"decimals",label:"Decimals",selector:{number:{mode:"box",min:0,max:4,step:1}}},{name:"inverted_animation",label:"Invert Animation",selector:{boolean:{}}},{name:"show_direction",label:"Show Direction",selector:{boolean:{}}},{name:"unit_white_space",label:"Unit White Space",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]}),{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Yo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Qo}],si=[{name:"entity",selector:{entity:{}}},Object.assign(Object.assign({},ti()),{schema:[...ti().schema,{name:"state_type",label:"State Type",selector:{select:{options:[{value:"power",label:"Power"},{value:"percentage",label:"Percentage"}],custom_value:!0}}},{name:"color_value",label:"Color Value",selector:{boolean:{}}},{name:"color_icon",label:"Color Icon",selector:{boolean:{}}},{name:"display_zero",label:"Display Zero",selector:{boolean:{}}},{name:"display_zero_tolerance",label:"Display Zero Tolerance",selector:{number:{mode:"box",min:0,max:1e6,step:.1}}},{name:"display_zero_state",label:"Display Zero State",selector:{boolean:{}}},{name:"unit_white_space",label:"Unit White Space",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]}),{name:"color",label:"Color",selector:{color_rgb:{}}},{title:Yo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Qo}],di=[{name:"entity",selector:{entity:{}}},Object.assign(Object.assign({},ti()),{schema:[...ti().schema,{name:"color_value",label:"Color Value",selector:{select:{options:[{value:!0,label:"Color dynamically"},{value:!1,label:"Do Not Color"},{value:"solar",label:"Solar"},{value:"grid",label:"Grid"},{value:"battery",label:"Battery"}],custom_value:!0}}},{name:"color_icon",label:"Color Icon",selector:{select:{options:[{value:!0,label:"Color dynamically"},{value:!1,label:"Do Not Color"},{value:"solar",label:"Solar"},{value:"grid",label:"Grid"},{value:"battery",label:"Battery"}],custom_value:!0}}},{name:"subtract_individual",label:"Subtract Individual",selector:{boolean:{}}},{name:"override_state",label:"Override State (With Home Entity)",selector:{boolean:{}}},{name:"use_metadata",label:"Use Metadata",selector:{boolean:{}}}]}),{title:Yo("editor.secondary_info"),name:"secondary_info",type:"expandable",schema:Qo}],ci={name:"grey_color",selector:{color_rgb:{}}},ui={name:"transparency",selector:{number:{min:0,max:100,step:1,mode:"box"}}},hi={name:"",type:"grid",column_min_width:"200px",schema:[ui,ci]},pi=e=>{switch(e){case"grey_out":return ci;case"transparency":return ui;case"custom":return hi;default:return[]}},vi=Qt(((e,t)=>[{name:"display_zero_lines",type:"grid",column_min_width:"400px",schema:[{name:"mode",selector:{select:{mode:"dropdown",options:[{value:"show",label:e("editor.show")},{value:"hide",label:e("editor.hide")},{value:"transparency",label:e("editor.transparency")},{value:"grey_out",label:e("editor.grey_out")},{value:"custom",label:e("editor.custom")}]}}},pi(t)]}]));var _i="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";const mi=function(...e){const t="type"===e[0].type,o=e.map((e=>e.schema)),i=Object.assign({},...o);return t?function(e){const t=Object.keys(e);return new Ht({type:"type",schema:e,*entries(o){if(Nt(o))for(const i of t)yield[i,o[i],e[i]]},validator:e=>Nt(e)||`Expected an object, but received: ${jt(e)}`,coercer:e=>Nt(e)?{...e}:e})}(i):Kt(i)}(Kt({type:Xt(),view_layout:Gt()}),Kt({title:Yt(Xt()),theme:Yt(Xt()),dashboard_link:Yt(Xt()),dashboard_link_label:Yt(Xt()),second_dashboard_link:Yt(Xt()),second_dashboard_link_label:Yt(Xt()),inverted_entities:Yt(Gt()),w_decimals:Yt(Wt()),kw_decimals:Yt(Wt()),min_flow_rate:Yt(Zt()),max_flow_rate:Yt(Zt()),min_expected_power:Yt(Zt()),max_expected_power:Yt(Zt()),watt_threshold:Yt(Zt()),clickable_entities:Yt(Vt()),transparency_zero_lines:Yt(Zt()),greyout_zero_lines:Yt(Vt()),display_zero_lines:Yt(Gt()),use_new_flow_rate_model:Yt(Vt()),full_size:Yt(Vt()),style_ha_card:Yt(Gt()),style_card_content:Yt(Gt()),disable_dots:Yt(Vt()),entities:Kt({battery:Yt(Gt()),grid:Yt(Gt()),solar:Yt(Gt()),home:Yt(Gt()),fossil_fuel_percentage:Yt(Gt()),individual:Yt(Gt())})})),fi=[{name:"title",label:"Title",selector:{text:{}}}];Qt((e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:e("editor.grid"),name:"grid",type:"expandable",iconPath:"M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z",schema:ii},{title:e("editor.solar"),name:"solar",type:"expandable",iconPath:"M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9M12,2L14.39,5.42C13.65,5.15 12.84,5 12,5C11.16,5 10.35,5.15 9.61,5.42L12,2M3.34,7L7.5,6.65C6.9,7.16 6.36,7.78 5.94,8.5C5.5,9.24 5.25,10 5.11,10.79L3.34,7M3.36,17L5.12,13.23C5.26,14 5.53,14.78 5.95,15.5C6.37,16.24 6.91,16.86 7.5,17.37L3.36,17M20.65,7L18.88,10.79C18.74,10 18.47,9.23 18.05,8.5C17.63,7.78 17.1,7.15 16.5,6.64L20.65,7M20.64,17L16.5,17.36C17.09,16.85 17.62,16.22 18.04,15.5C18.46,14.77 18.73,14 18.87,13.21L20.64,17M12,22L9.59,18.56C10.33,18.83 11.14,19 12,19C12.82,19 13.63,18.83 14.37,18.56L12,22Z",schema:ri},{title:e("editor.battery"),name:"battery",type:"expandable",iconPath:"M16 20H8V6H16M16.67 4H15V2H9V4H7.33C6.6 4 6 4.6 6 5.33V20.67C6 21.4 6.6 22 7.33 22H16.67C17.41 22 18 21.41 18 20.67V5.33C18 4.6 17.4 4 16.67 4M15 16H9V19H15V16M15 7H9V10H15V7M15 11.5H9V14.5H15V11.5Z",schema:ni},{title:e("editor.fossil_fuel_percentage"),name:"fossil_fuel_percentage",type:"expandable",iconPath:"M17,8C8,10 5.9,16.17 3.82,21.34L5.71,22L6.66,19.7C7.14,19.87 7.64,20 8,20C19,20 22,3 22,3C21,5 14,5.25 9,6.25C4,7.25 2,11.5 2,13.5C2,15.5 3.75,17.25 3.75,17.25C7,8 17,8 17,8Z",schema:si},{title:e("editor.home"),name:"home",type:"expandable",iconPath:"M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",schema:di}]}]));const yi=Qt((e=>[{name:"entities",type:"grid",column_min_width:"400px",schema:[{title:`${e("editor.individual")} 1`,name:"individual1",type:"expandable",schema:li},{title:`${e("editor.individual")} 2`,name:"individual2",type:"expandable",schema:li}]}])),gi=Qt(((e,t)=>[{type:"grid",column_min_width:"200px",schema:[{name:"dashboard_link",label:"Dashboard Link",selector:{navigation:{}}},{name:"dashboard_link_label",label:"Dashboard Link Label",selector:{text:{}}},{name:"w_decimals",label:"Watt Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"kw_decimals",label:"kW Decimals",selector:{number:{mode:"box",min:0,max:5,step:1}}},{name:"max_flow_rate",label:"Max Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_flow_rate",label:"Min Flow Rate (Sec/Dot)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"max_expected_power",label:"Max Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"min_expected_power",label:"Min Expected Power (in Watts)",selector:{number:{mode:"box",min:0,max:1e6,step:.01}}},{name:"watt_threshold",label:"Watt to Kilowatt Threshold",selector:{number:{mode:"box",min:0,max:1e6,step:1}}},{name:"clickable_entities",label:"Clickable Entities",selector:{boolean:{}}},{name:"disable_dots",label:"Disable Moving Dots",selector:{boolean:{}}},{name:"use_new_flow_rate_model",label:"New Flow Model?",selector:{boolean:{}}}]},{type:"expandable",title:e("editor.display_zero_lines"),schema:[...vi(e,t)]}])),bi="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,wi=(e,t,o=null)=>{for(;t!==o;){const o=t.nextSibling;e.removeChild(t),t=o}},xi=`{{lit-${String(Math.random()).slice(2)}}}`,ki=`\x3c!--${xi}--\x3e`,Si=new RegExp(`${xi}|${ki}`),$i="$lit$";class Ci{constructor(e,t){this.parts=[],this.element=t;const o=[],i=[],a=document.createTreeWalker(t.content,133,null,!1);let n=0,r=-1,l=0;const{strings:s,values:{length:d}}=e;for(;l<d;){const e=a.nextNode();if(null!==e){if(r++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:o}=t;let i=0;for(let e=0;e<o;e++)Ei(t[e].name,$i)&&i++;for(;i-- >0;){const t=s[l],o=Pi.exec(t)[2],i=o.toLowerCase()+$i,a=e.getAttribute(i);e.removeAttribute(i);const n=a.split(Si);this.parts.push({type:"attribute",index:r,name:o,strings:n}),l+=n.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),a.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(xi)>=0){const i=e.parentNode,a=t.split(Si),n=a.length-1;for(let t=0;t<n;t++){let o,n=a[t];if(""===n)o=Mi();else{const e=Pi.exec(n);null!==e&&Ei(e[2],$i)&&(n=n.slice(0,e.index)+e[1]+e[2].slice(0,-5)+e[3]),o=document.createTextNode(n)}i.insertBefore(o,e),this.parts.push({type:"node",index:++r})}""===a[n]?(i.insertBefore(Mi(),e),o.push(e)):e.data=a[n],l+=n}}else if(8===e.nodeType)if(e.data===xi){const t=e.parentNode;null!==e.previousSibling&&r!==n||(r++,t.insertBefore(Mi(),e)),n=r,this.parts.push({type:"node",index:r}),null===e.nextSibling?e.data="":(o.push(e),r--),l++}else{let t=-1;for(;-1!==(t=e.data.indexOf(xi,t+1));)this.parts.push({type:"node",index:-1}),l++}}else a.currentNode=i.pop()}for(const e of o)e.parentNode.removeChild(e)}}const Ei=(e,t)=>{const o=e.length-t.length;return o>=0&&e.slice(o)===t},Ai=e=>-1!==e.index,Mi=()=>document.createComment(""),Pi=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function zi(e,t){const{element:{content:o},parts:i}=e,a=document.createTreeWalker(o,133,null,!1);let n=Ti(i),r=i[n],l=-1,s=0;const d=[];let c=null;for(;a.nextNode();){l++;const e=a.currentNode;for(e.previousSibling===c&&(c=null),t.has(e)&&(d.push(e),null===c&&(c=e)),null!==c&&s++;void 0!==r&&r.index===l;)r.index=null!==c?-1:r.index-s,n=Ti(i,n),r=i[n]}d.forEach((e=>e.parentNode.removeChild(e)))}const Di=e=>{let t=11===e.nodeType?0:1;const o=document.createTreeWalker(e,133,null,!1);for(;o.nextNode();)t++;return t},Ti=(e,t=-1)=>{for(let o=t+1;o<e.length;o++){const t=e[o];if(Ai(t))return o}return-1};const Oi=new WeakMap,Ni=e=>"function"==typeof e&&Oi.has(e),ji={},Bi={};class Li{constructor(e,t,o){this.__parts=[],this.template=e,this.processor=t,this.options=o}update(e){let t=0;for(const o of this.__parts)void 0!==o&&o.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=bi?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],o=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let a,n=0,r=0,l=i.nextNode();for(;n<o.length;)if(a=o[n],Ai(a)){for(;r<a.index;)r++,"TEMPLATE"===l.nodeName&&(t.push(l),i.currentNode=l.content),null===(l=i.nextNode())&&(i.currentNode=t.pop(),l=i.nextNode());if("node"===a.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(l.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,a.name,a.strings,this.options));n++}else this.__parts.push(void 0),n++;return bi&&(document.adoptNode(e),customElements.upgrade(e)),e}}const Ii=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:e=>e}),Hi=` ${xi} `;class Ri{constructor(e,t,o,i){this.strings=e,this.values=t,this.type=o,this.processor=i}getHTML(){const e=this.strings.length-1;let t="",o=!1;for(let i=0;i<e;i++){const e=this.strings[i],a=e.lastIndexOf("\x3c!--");o=(a>-1||o)&&-1===e.indexOf("--\x3e",a+1);const n=Pi.exec(e);t+=null===n?e+(o?Hi:ki):e.substr(0,n.index)+n[1]+n[2]+$i+n[3]+xi}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");let t=this.getHTML();return void 0!==Ii&&(t=Ii.createHTML(t)),e.innerHTML=t,e}}class Fi{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(Mi()),this.endNode=e.appendChild(Mi())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=Mi()),e.__insert(this.endNode=Mi())}insertAfterPart(e){e.__insert(this.startNode=Mi()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){if(null===this.startNode.parentNode)return;for(;Ni(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=ji,e(this)}const e=this.__pendingValue;e!==ji&&((e=>null===e||!("object"==typeof e||"function"==typeof e))(e)?e!==this.value&&this.__commitText(e):e instanceof Ri?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):(e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]))(e)?this.__commitIterable(e):e===Bi?(this.value=Bi,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,o="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=o:this.__commitNode(document.createTextNode(o)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof Li&&this.value.template===t)this.value.update(e.values);else{const o=new Li(t,e.processor,this.options),i=o._clone();o.update(e.values),this.__commitNode(i),this.value=o}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let o,i=0;for(const a of e)o=t[i],void 0===o&&(o=new Fi(this.options),t.push(o),0===i?o.appendIntoPart(this):o.insertAfterPart(t[i-1])),o.setValue(a),o.commit(),i++;i<t.length&&(t.length=i,this.clear(o&&o.endNode))}clear(e=this.startNode){wi(this.startNode.parentNode,e.nextSibling,this.endNode)}}let Ui=!1;function Gi(e){let t=Vi.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},Vi.set(e.type,t));let o=t.stringsArray.get(e.strings);if(void 0!==o)return o;const i=e.strings.join(xi);return o=t.keyString.get(i),void 0===o&&(o=new Ci(e,e.getTemplateElement()),t.keyString.set(i,o)),t.stringsArray.set(e.strings,o),o}(()=>{try{const e={get capture(){return Ui=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();const Vi=new Map,Wi=new WeakMap;"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const Zi=(e,t)=>`${e}--${t}`;let Ki=!0;void 0===window.ShadyCSS?Ki=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),Ki=!1);const Yi=e=>t=>{const o=Zi(t.type,e);let i=Vi.get(o);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},Vi.set(o,i));let a=i.stringsArray.get(t.strings);if(void 0!==a)return a;const n=t.strings.join(xi);if(a=i.keyString.get(n),void 0===a){const o=t.getTemplateElement();Ki&&window.ShadyCSS.prepareTemplateDom(o,e),a=new Ci(t,o),i.keyString.set(n,a)}return i.stringsArray.set(t.strings,a),a},Xi=["html","svg"],qi=new Set,Ji=(e,t,o)=>{qi.add(e);const i=o?o.element:document.createElement("template"),a=t.querySelectorAll("style"),{length:n}=a;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(i,e);const r=document.createElement("style");for(let e=0;e<n;e++){const t=a[e];t.parentNode.removeChild(t),r.textContent+=t.textContent}(e=>{Xi.forEach((t=>{const o=Vi.get(Zi(t,e));void 0!==o&&o.keyString.forEach((e=>{const{element:{content:t}}=e,o=new Set;Array.from(t.querySelectorAll("style")).forEach((e=>{o.add(e)})),zi(e,o)}))}))})(e);const l=i.content;o?function(e,t,o=null){const{element:{content:i},parts:a}=e;if(null==o)return void i.appendChild(t);const n=document.createTreeWalker(i,133,null,!1);let r=Ti(a),l=0,s=-1;for(;n.nextNode();)for(s++,n.currentNode===o&&(l=Di(t),o.parentNode.insertBefore(t,o));-1!==r&&a[r].index===s;){if(l>0){for(;-1!==r;)a[r].index+=l,r=Ti(a,r);return}r=Ti(a,r)}}(o,r,l.firstChild):l.insertBefore(r,l.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const s=l.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==s)t.insertBefore(s.cloneNode(!0),t.firstChild);else if(o){l.insertBefore(r,l.firstChild);const e=new Set;e.add(r),zi(o,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Qi={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},ea=(e,t)=>t!==e&&(t==t||e==e),ta={attribute:!0,type:String,converter:Qi,reflect:!1,hasChanged:ea},oa="finalized";class ia extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach(((t,o)=>{const i=this._attributeNameForProperty(o,t);void 0!==i&&(this._attributeToPropertyMap.set(i,o),e.push(i))})),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach(((e,t)=>this._classProperties.set(t,e)))}}static createProperty(e,t=ta){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const o="symbol"==typeof e?Symbol():`__${e}`,i=this.getPropertyDescriptor(e,o,t);void 0!==i&&Object.defineProperty(this.prototype,e,i)}static getPropertyDescriptor(e,t,o){return{get(){return this[t]},set(i){const a=this[e];this[t]=i,this.requestUpdateInternal(e,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||ta}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(oa)||e.finalize(),this[oa]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const o of t)this.createProperty(o,e[o])}}static _attributeNameForProperty(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,o=ea){return o(e,t)}static _propertyValueFromAttribute(e,t){const o=t.type,i=t.converter||Qi,a="function"==typeof i?i:i.fromAttribute;return a?a(e,o):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const o=t.type,i=t.converter;return(i&&i.toAttribute||Qi.toAttribute)(e,o)}initialize(){this._updateState=0,this._updatePromise=new Promise((e=>this._enableUpdatingResolver=e)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((e,t)=>this[t]=e)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,o){t!==o&&this._attributeToProperty(e,o)}_propertyToAttribute(e,t,o=ta){const i=this.constructor,a=i._attributeNameForProperty(e,o);if(void 0!==a){const e=i._propertyValueToAttribute(t,o);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(a):this.setAttribute(a,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const o=this.constructor,i=o._attributeToPropertyMap.get(e);if(void 0!==i){const e=o.getPropertyOptions(i);this._updateState=16|this._updateState,this[i]=o._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}requestUpdateInternal(e,t,o){let i=!0;if(void 0!==e){const a=this.constructor;o=o||a.getPropertyOptions(e),a._valueHasChanged(this[e],t,o.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==o.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,o))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this.requestUpdateInternal(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((e,t)=>this._propertyToAttribute(t,this[t],e))),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}ia[oa]=!0;const aa=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:o,elements:i}=t;return{kind:o,elements:i,finisher(t){window.customElements.define(e,t)}}})(e,t),na=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(o){o.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(o){o.createProperty(t.key,e)}},ra=(e,t,o)=>{t.constructor.createProperty(o,e)};function la(e){return(t,o)=>void 0!==o?ra(e,t,o):na(e,t)}const sa=e=>function(e){return la({attribute:!1,hasChanged:null==e?void 0:e.hasChanged})}(e);const da=(e,t,o)=>{Object.defineProperty(t,o,e)},ca=(e,t)=>({kind:"method",placement:"prototype",key:t.key,descriptor:e}),ua=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ha=Symbol();class pa{constructor(e,t){if(t!==ha)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(ua?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const va={};class _a extends ia{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(Array.isArray(e)){const t=(e,o)=>e.reduceRight(((e,o)=>Array.isArray(o)?t(o,e):(e.add(o),e)),o),o=t(e,new Set),i=[];o.forEach((e=>i.unshift(e))),this._styles=i}else this._styles=void 0===e?[]:[e];this._styles=this._styles.map((e=>{if(e instanceof CSSStyleSheet&&!ua){const t=Array.prototype.slice.call(e.cssRules).reduce(((e,t)=>e+t.cssText),"");return new pa(String(t),ha)}return e}))}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ua?this.renderRoot.adoptedStyleSheets=e.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map((e=>e.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==va&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)})))}render(){return va}}_a.finalized=!0,_a.render=(e,t,o)=>{if(!o||"object"!=typeof o||!o.scopeName)throw new Error("The `scopeName` option is required.");const i=o.scopeName,a=Wi.has(t),n=Ki&&11===t.nodeType&&!!t.host,r=n&&!qi.has(i),l=r?document.createDocumentFragment():t;if(((e,t,o)=>{let i=Wi.get(t);void 0===i&&(wi(t,t.firstChild),Wi.set(t,i=new Fi(Object.assign({templateFactory:Gi},o))),i.appendInto(t)),i.setValue(e),i.commit()})(e,l,Object.assign({templateFactory:Yi(i)},o)),r){const e=Wi.get(l);Wi.delete(l);const o=e.value instanceof Li?e.value.template:void 0;Ji(i,l,o),wi(t,t.firstChild),t.appendChild(l),Wi.set(t,e)}!a&&n&&window.ShadyCSS.styleElement(t.host)},_a.shadowRootOptions={mode:"open"};const{I:ma}=ae,fa=()=>document.createComment(""),ya=(e,t,o)=>{var i;const a=e._$AA.parentNode,n=void 0===t?e._$AB:t._$AA;if(void 0===o){const t=a.insertBefore(fa(),n),i=a.insertBefore(fa(),n);o=new ma(t,i,e,e.options)}else{const t=o._$AB.nextSibling,r=o._$AM,l=r!==e;if(l){let t;null===(i=o._$AQ)||void 0===i||i.call(o,e),o._$AM=e,void 0!==o._$AP&&(t=e._$AU)!==r._$AU&&o._$AP(t)}if(t!==n||l){let e=o._$AA;for(;e!==t;){const t=e.nextSibling;a.insertBefore(e,n),e=t}}}return o},ga=(e,t,o=e)=>(e._$AI(t,o),e),ba={},wa=(e,t=ba)=>e._$AH=t,xa=e=>{var t;null===(t=e._$AP)||void 0===t||t.call(e,!1,!0);let o=e._$AA;const i=e._$AB.nextSibling;for(;o!==i;){const e=o.nextSibling;o.remove(),o=e}},ka=(e,t,o)=>{const i=new Map;for(let a=t;a<=o;a++)i.set(e[a],a);return i},Sa=yt(class extends gt{constructor(e){if(super(e),e.type!==ft)throw Error("repeat() can only be used in text expressions")}ct(e,t,o){let i;void 0===o?o=t:void 0!==t&&(i=t);const a=[],n=[];let r=0;for(const t of e)a[r]=i?i(t,r):r,n[r]=o(t,r),r++;return{values:n,keys:a}}render(e,t,o){return this.ct(e,t,o).values}update(e,[t,o,i]){var a;const n=(e=>e._$AH)(e),{values:r,keys:l}=this.ct(t,o,i);if(!Array.isArray(n))return this.ut=l,r;const s=null!==(a=this.ut)&&void 0!==a?a:this.ut=[],d=[];let c,u,h=0,p=n.length-1,v=0,_=r.length-1;for(;h<=p&&v<=_;)if(null===n[h])h++;else if(null===n[p])p--;else if(s[h]===l[v])d[v]=ga(n[h],r[v]),h++,v++;else if(s[p]===l[_])d[_]=ga(n[p],r[_]),p--,_--;else if(s[h]===l[_])d[_]=ga(n[h],r[_]),ya(e,d[_+1],n[h]),h++,_--;else if(s[p]===l[v])d[v]=ga(n[p],r[v]),ya(e,n[h],n[p]),p--,v++;else if(void 0===c&&(c=ka(l,v,_),u=ka(s,h,p)),c.has(s[h]))if(c.has(s[p])){const t=u.get(l[v]),o=void 0!==t?n[t]:null;if(null===o){const t=ya(e,n[h]);ga(t,r[v]),d[v]=t}else d[v]=ga(o,r[v]),ya(e,n[h],o),n[t]=null;v++}else xa(n[p]),p--;else xa(n[h]),h++;for(;v<=_;){const t=ya(e,d[_+1]);ga(t,r[v]),d[v++]=t}for(;h<=p;){const e=n[h++];null!==e&&xa(e)}return this.ut=l,wa(e,d),F}});let $a;const Ca=(e,t,o,i)=>{i=i||{},o=null==o?{}:o;const a=new Event(t,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return a.detail=o,e.dispatchEvent(a),a},Ea=r`#sortable a:nth-of-type(2n) paper-icon-item{animation-name:keyframes1;animation-iteration-count:infinite;transform-origin:50% 10%;animation-delay:-.75s;animation-duration:.25s}#sortable a:nth-of-type(2n-1) paper-icon-item{animation-name:keyframes2;animation-iteration-count:infinite;animation-direction:alternate;transform-origin:30% 5%;animation-delay:-.5s;animation-duration:.33s}#sortable a{height:48px;display:flex}#sortable{outline:0;display:block!important}.hidden-panel{display:flex!important}.sortable-fallback{display:none}.sortable-ghost{opacity:.4}.sortable-fallback{opacity:0}@keyframes keyframes1{0%{transform:rotate(-1deg);animation-timing-function:ease-in}50%{transform:rotate(1.5deg);animation-timing-function:ease-out}}@keyframes keyframes2{0%{transform:rotate(1deg);animation-timing-function:ease-in}50%{transform:rotate(-1.5deg);animation-timing-function:ease-out}}.hide-panel,.show-panel{display:none;position:absolute;top:0;right:4px;--mdc-icon-button-size:40px}:host([rtl]) .show-panel{right:initial;left:4px}.hide-panel{top:4px;right:8px}:host([rtl]) .hide-panel{right:initial;left:8px}:host([expanded]) .hide-panel{display:block}:host([expanded]) .show-panel{display:inline-flex}paper-icon-item.hidden-panel,paper-icon-item.hidden-panel ha-icon[slot=item-icon],paper-icon-item.hidden-panel span{color:var(--secondary-text-color);cursor:pointer}`,Aa=async()=>{var e,t,o,i;if(customElements.get("ha-form")||null===(e=customElements.get("hui-button-card"))||void 0===e||e.getConfigElement(),customElements.get("ha-entity-picker")||null===(t=customElements.get("hui-entities-card"))||void 0===t||t.getConfigElement(),customElements.get("ha-form"))return;await(null===(i=(o=window).loadCardHelpers)||void 0===i?void 0:i.call(o))};let Ma=class extends se{constructor(){super(...arguments),this._indexBeingEdited=-1,this._entityKeys=new WeakMap,this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${null==e?void 0:e.name}`)||Yo(`editor.${null==e?void 0:e.name}`)}connectedCallback(){super.connectedCallback(),Aa()}disconnectedCallback(){super.disconnectedCallback(),this._destroySortable()}_editRowElement(e){this._indexBeingEdited=e}_getKey(e){return this._entityKeys.has(e)||this._entityKeys.set(e,Math.random().toString()),this._entityKeys.get(e)}render(){return this.entities&&this.hass?-1!==this._indexBeingEdited?H`<div class="individual-header"><h4>${this._indexBeingEdited+1} / ${this.entities.length} ${Yo("editor.individual")}</h4><ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.clear")}" .path="${_i}" class="remove-icon" @click="${()=>this._indexBeingEdited=-1}"></ha-icon-button></div><ha-form .hass="${this.hass}" .data="${this.entities[this._indexBeingEdited]}" .schema="${li}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._configChanged}"></ha-form>`:H`<div class="entities">${Sa(this.entities,(e=>this._getKey(e)),((e,t)=>H`<div class="entity"><div class="handle"><ha-svg-icon .path="${"M7,19V17H9V19H7M11,19V17H13V19H11M15,19V17H17V19H15M7,15V13H9V15H7M11,15V13H13V15H11M15,15V13H17V15H15M7,11V9H9V11H7M11,11V9H13V11H11M15,11V9H17V11H15M7,7V5H9V7H7M11,7V5H13V7H11M15,7V5H17V7H15Z"}"></ha-svg-icon></div>${e.type?H`<div class="special-row"><div><span>${this.hass.localize(`ui.panel.lovelace.editor.card.entities.entity_row.${e.type}`)} </span><span class="secondary">${this.hass.localize("ui.panel.lovelace.editor.card.entities.edit_special_row")}</span></div></div>`:H`<ha-entity-picker allow-custom-entity hideClearIcon .hass="${this.hass}" .value="${e.entity}" .index="${t}" @value-changed="${this._valueChanged}"></ha-entity-picker>`}<ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.clear")}" .path="${_i}" class="remove-icon" .index="${t}" @click="${this._removeRow}"></ha-icon-button><ha-icon-button .label="${this.hass.localize("ui.components.entity.entity-picker.edit")}" .path="${"M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"}" class="edit-icon" .index="${t}" @click="${()=>this._editRowElement(t)}"></ha-icon-button></div>`))}</div>${this.entities.length>=4?U:H`<ha-entity-picker class="add-entity" .hass="${this.hass}" @value-changed="${this._addEntity}"></ha-entity-picker>`}`:H`<p>No entities configured.</p>`}_configChanged(e){const t=e.detail.value||"";if(!this.config||!this.hass)return;Array.isArray(this.config.entities.individual)||(this.config.entities.individual=[]);const o=[...this.config.entities.individual];if(!o)return;o[this._indexBeingEdited]=t;const i=Object.assign(Object.assign({},this.config),{entities:Object.assign(Object.assign({},this.config.entities),{individual:o})});Ca(this,"config-changed",{config:i})}firstUpdated(){this._createSortable()}async _createSortable(){const e=await(async()=>($a||($a=(await Promise.resolve().then((function(){return Ur}))).default),$a))();this._sortable=new e(this.shadowRoot.querySelector(".entities"),{animation:150,fallbackClass:"sortable-fallback",handle:".handle",onChoose:e=>{e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder)},onEnd:e=>{e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder),this._rowMoved(e)}})}_destroySortable(){var e;null===(e=this._sortable)||void 0===e||e.destroy(),this._sortable=void 0}async _addEntity(e){const t=e.detail.value;if(""===t)return;const o=this.entities.concat({entity:t});e.target.value="",Ca(this,"entities-changed",{entities:o})}_rowMoved(e){if(e.oldIndex===e.newIndex)return;const t=this.entities.concat();t.splice(e.newIndex,0,t.splice(e.oldIndex,1)[0]),Ca(this,"entities-changed",{entities:t})}_removeRow(e){const t=e.currentTarget.index,o=this.entities.concat();o.splice(t,1),Ca(this,"entities-changed",{entities:o})}_valueChanged(e){const t=e.detail.value,o=e.target.index,i=this.entities.concat();""===t||void 0===t?i.splice(o,1):i[o]=Object.assign(Object.assign({},i[o]),{entity:t}),Ca(this,"entities-changed",{entities:i})}_editRow(e){const t=e.currentTarget.index;Ca(this,"edit-detail-element",{subElementConfig:{index:t,type:"row",elementConfig:this.entities[t]}})}static get styles(){return[Ea,r`ha-entity-picker{margin-top:8px}.individual-header{display:flex;justify-content:space-between;align-items:center;margin-inline:.2rem;margin-bottom:1rem}.add-entity{display:block;margin-left:31px;margin-right:71px;margin-inline-start:31px;margin-inline-end:71px;direction:var(--direction)}.entity{display:flex;align-items:center}.entity .handle{padding-right:8px;cursor:move;padding-inline-end:8px;padding-inline-start:initial;direction:var(--direction)}.entity .handle>*{pointer-events:none}.entity ha-entity-picker{flex-grow:1}.special-row{height:60px;font-size:16px;display:flex;align-items:center;justify-content:space-between;flex-grow:1}.special-row div{display:flex;flex-direction:column}.edit-icon,.remove-icon{--mdc-icon-button-size:36px;color:var(--secondary-text-color)}.secondary{font-size:12px;color:var(--secondary-text-color)}`]}};e([pe({attribute:!1})],Ma.prototype,"hass",void 0),e([pe({attribute:!1})],Ma.prototype,"config",void 0),e([pe({attribute:!1})],Ma.prototype,"entities",void 0),e([pe()],Ma.prototype,"label",void 0),e([ve()],Ma.prototype,"_indexBeingEdited",void 0),Ma=e([ce("individual-row-editor")],Ma);let Pa=class extends se{constructor(){super(...arguments),this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${null==e?void 0:e.name}`)||Yo(`editor.${null==e?void 0:e.name}`)}render(){return this.config&&this.hass?(this._configEntities=this.config.entities.individual,this._subElementEditorConfig?H`<ha-form .hass="${this.hass}" @value-changed="${this._valueChanged}" .data="${this.config}" .schema="${yi(this.hass)}" .computeLabel="${this._computeLabelCallback}"></ha-form>`:H`<individual-row-editor .hass="${this.hass}" .config="${this.config}" .entities="${this._configEntities||[]}" @open-sub-element-editor="${this._editDetailElement}" @entities-changed="${this._entitiesChanged}" style="width:100%"></individual-row-editor>`):H`<div>no config</div>`}_valueChanged(e){let t=e.detail.value||"";this.config&&this.hass&&Ae(this,"config-changed",{config:t})}_entitiesChanged(e){let t=this.config;t=Object.assign(Object.assign({},t),{entities:Object.assign(Object.assign({},t.entities),{individual:e.detail.entities})}),this._configEntities=t.entities.individual.map((e=>"string"==typeof e?{entity:e}:e)),Ae(this,"config-changed",{config:t})}_editDetailElement(e){this._subElementEditorConfig=e.detail.subElementConfig}static get styles(){return r``}};e([la({attribute:!1})],Pa.prototype,"config",void 0),e([sa()],Pa.prototype,"_subElementEditorConfig",void 0),e([sa()],Pa.prototype,"_configEntities",void 0),Pa=e([aa("individual-devices-editor")],Pa);let za=class extends se{constructor(){super(...arguments),this.outlined=!1,this.leftChevron=!1,this.icon="mdi:format-list-bulleted-type"}render(){return H`<div class="link-subpage" @click="${this._openSubElementPage}" @keydown="${this._openSubElementPage}" @focus="${this._focusChanged}" @blur="${this._focusChanged}" role="button"><ha-icon icon="${this.icon}" class="summary-icon"></ha-icon><slot name="header"><div class="header">${this.header}<slot class="secondary" name="secondary">${this.secondary}</slot></div></slot><ha-svg-icon .path="${"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}" class="summary-icon-right"></ha-svg-icon></div>`}_focusChanged(e){this.shadowRoot.querySelector(".top").classList.toggle("focused","focus"===e.type)}_openSubElementPage(){Ae(this,"open-sub-element-editor",{open:!0})}static get styles(){return r`:host{display:block}:host([outlined]){box-shadow:none;border-width:1px;border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));border-radius:var(--ha-card-border-radius,12px)}:host([leftchevron]) .summary-icon{margin-left:0;margin-right:8px}.link-subpage{width:100%;display:flex;gap:1rem;padding:var(--expansion-panel-summary-padding,0 8px);min-height:48px;align-items:center;cursor:pointer;overflow:hidden;font-weight:500;outline:0}.summary-icon{transition:transform 150ms cubic-bezier(.4,0,.2,1);direction:var(--direction);color:var(--secondary-text-color)}.header,::slotted([slot=header]){flex:1}.container{padding:var(--expansion-panel-content-padding,0 8px);overflow:hidden;transition:height .3s cubic-bezier(.4,0,.2,1);height:0}.container.expanded{height:auto}.secondary{display:block;color:var(--secondary-text-color);font-size:12px}`}};var Da,Ta;e([la({type:String})],za.prototype,"path",void 0),e([la({type:Boolean,reflect:!0})],za.prototype,"outlined",void 0),e([la({type:Boolean,reflect:!0})],za.prototype,"leftChevron",void 0),e([la()],za.prototype,"header",void 0),e([la({type:String})],za.prototype,"icon",void 0),e([la()],za.prototype,"secondary",void 0),e([(Da=".container",(e,t)=>{const o={get(){return this.renderRoot.querySelector(Da)},enumerable:!0,configurable:!0};if(Ta){const i=void 0!==t?t:e.key,a="symbol"==typeof i?Symbol():`__${i}`;o.get=function(){return void 0===this[a]&&(this[a]=this.renderRoot.querySelector(Da)),this[a]}}return void 0!==t?da(o,e,t):ca(o,e)})],za.prototype,"_container",void 0),za=e([aa("link-subpage")],za);let Oa=class extends se{render(){return H`<div class="header"><div class="back-title"><ha-icon-button .label="${"Go Back"}" .path="${"M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z"}" @click="${this._goBack}"></ha-icon-button><span>${Yo(`editor.${this.page}`)}</span></div></div>`}_goBack(){Ae(this,"go-back")}static get styles(){return r`.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem}.back-title{display:flex;align-items:center;font-size:18px}`}};e([la({attribute:!1})],Oa.prototype,"config",void 0),e([la()],Oa.prototype,"page",void 0),Oa=e([aa("subpage-header")],Oa);const Na=[{page:"grid",icon:"mdi:transmission-tower",schema:ii},{page:"solar",icon:"mdi:solar-power",schema:ri},{page:"battery",icon:"mdi:battery-high",schema:ni},{page:"fossil_fuel_percentage",icon:"mdi:leaf",schema:si},{page:"home",icon:"mdi:home",schema:di},{page:"individual",icon:"mdi:dots-horizontal-circle-outline"},{page:"advanced",icon:"mdi:cog",schema:gi}];let ja=class extends se{constructor(){super(...arguments),this._configEntities=[],this._currentConfigPage=null,this._computeLabelCallback=e=>this.hass.localize(`ui.panel.lovelace.editor.card.generic.${null==e?void 0:e.name}`)||Yo(`editor.${null==e?void 0:e.name}`)}async setConfig(e){Rt(e,mi),this._config=e}connectedCallback(){super.connectedCallback(),Aa()}_editDetailElement(e){this._currentConfigPage=e}_goBack(){this._currentConfigPage=null}render(){var e,t,o,i,a,n,r,l,s;if(!this.hass||!this._config)return U;const d=Object.assign(Object.assign({},this._config),{display_zero_lines:{mode:null!==(t=null===(e=this._config.display_zero_lines)||void 0===e?void 0:e.mode)&&void 0!==t?t:we.displayZeroLines.mode,transparency:null!==(i=null===(o=this._config.display_zero_lines)||void 0===o?void 0:o.transparency)&&void 0!==i?i:we.displayZeroLines.transparency,grey_color:null!==(n=null===(a=this._config.display_zero_lines)||void 0===a?void 0:a.grey_color)&&void 0!==n?n:we.displayZeroLines.grey_color}});if(null!==this._currentConfigPage){if("individual"===this._currentConfigPage)return H`<subpage-header @go-back="${this._goBack}" page="${this._currentConfigPage}"></subpage-header><individual-devices-editor .hass="${this.hass}" .config="${this._config}" @config-changed="${this._valueChanged}"></individual-devices-editor>`;const e=this._currentConfigPage,t="advanced"===e?gi(Yo,null!==(l=null===(r=this._config.display_zero_lines)||void 0===r?void 0:r.mode)&&void 0!==l?l:we.displayZeroLines.mode):null===(s=Na.find((t=>t.page===e)))||void 0===s?void 0:s.schema,o="advanced"===e?d:d.entities[e];return H`<subpage-header @go-back="${this._goBack}" page="${this._currentConfigPage}"></subpage-header><ha-form .hass="${this.hass}" .data="${o}" .schema="${t}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form>`}const c=(e,t="mdi:dots-horizontal-circle-outline")=>{if(null===e)return H``;const o=(()=>{var o,i;return"individual"===e||"advanced"===e?t:(null===(i=null===(o=null==this?void 0:this._config)||void 0===o?void 0:o.entities[e])||void 0===i?void 0:i.icon)||t})();return H`<link-subpage path="${e}" header="${Yo(`editor.${e}`)}" @open-sub-element-editor="${()=>this._editDetailElement(e)}" icon="${o}"></link-subpage>`};return H`<div class="card-config"><ha-form .hass="${this.hass}" .data="${d}" .schema="${fi}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form>${Na.map((e=>c(e.page,e.icon)))}</div>`}_valueChanged(e){let t=e.detail.value||"";this._config&&this.hass&&(null!==this._currentConfigPage&&"advanced"!==this._currentConfigPage&&"individual"!==this._currentConfigPage&&(t=Object.assign(Object.assign({},this._config),{entities:Object.assign(Object.assign({},this._config.entities),{[this._currentConfigPage]:t})})),Ae(this,"config-changed",{config:t}))}static get styles(){return r`ha-form{width:100%}ha-icon-button{align-self:center}.entities-section *{background-color:red}.card-config{display:flex;flex-direction:column;gap:1.5rem;margin-bottom:10px}.config-header{display:flex;flex-direction:row;justify-content:space-between;align-items:center;width:100%}.config-header.sub-header{margin-top:24px}ha-icon{padding-bottom:2px;position:relative;top:-4px;right:1px}`}};e([pe({attribute:!1})],ja.prototype,"hass",void 0),e([ve()],ja.prototype,"_config",void 0),e([ve()],ja.prototype,"_configEntities",void 0),e([ve()],ja.prototype,"_currentConfigPage",void 0),ja=e([ce("power-flow-card-plus-editor")],ja);var Ba=Object.freeze({__proto__:null,get PowerFlowCardPlusEditor(){return ja}});function La(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)}return o}function Ia(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?La(Object(o),!0).forEach((function(t){Ra(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):La(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function Ha(e){return Ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ha(e)}function Ra(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function Fa(){return Fa=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},Fa.apply(this,arguments)}function Ua(e,t){if(null==e)return{};var o,i,a=function(e,t){if(null==e)return{};var o,i,a={},n=Object.keys(e);for(i=0;i<n.length;i++)o=n[i],t.indexOf(o)>=0||(a[o]=e[o]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i<n.length;i++)o=n[i],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}function Ga(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var Va=Ga(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Wa=Ga(/Edge/i),Za=Ga(/firefox/i),Ka=Ga(/safari/i)&&!Ga(/chrome/i)&&!Ga(/android/i),Ya=Ga(/iP(ad|od|hone)/i),Xa=Ga(/chrome/i)&&Ga(/android/i),qa={capture:!1,passive:!1};function Ja(e,t,o){e.addEventListener(t,o,!Va&&qa)}function Qa(e,t,o){e.removeEventListener(t,o,!Va&&qa)}function en(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function tn(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function on(e,t,o,i){if(e){o=o||document;do{if(null!=t&&(">"===t[0]?e.parentNode===o&&en(e,t):en(e,t))||i&&e===o)return e;if(e===o)break}while(e=tn(e))}return null}var an,nn=/\s+/g;function rn(e,t,o){if(e&&t)if(e.classList)e.classList[o?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(nn," ").replace(" "+t+" "," ");e.className=(i+(o?" "+t:"")).replace(nn," ")}}function ln(e,t,o){var i=e&&e.style;if(i){if(void 0===o)return document.defaultView&&document.defaultView.getComputedStyle?o=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(o=e.currentStyle),void 0===t?o:o[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=o+("string"==typeof o?"":"px")}}function sn(e,t){var o="";if("string"==typeof e)o=e;else do{var i=ln(e,"transform");i&&"none"!==i&&(o=i+" "+o)}while(!t&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(o)}function dn(e,t,o){if(e){var i=e.getElementsByTagName(t),a=0,n=i.length;if(o)for(;a<n;a++)o(i[a],a);return i}return[]}function cn(){var e=document.scrollingElement;return e||document.documentElement}function un(e,t,o,i,a){if(e.getBoundingClientRect||e===window){var n,r,l,s,d,c,u;if(e!==window&&e.parentNode&&e!==cn()?(r=(n=e.getBoundingClientRect()).top,l=n.left,s=n.bottom,d=n.right,c=n.height,u=n.width):(r=0,l=0,s=window.innerHeight,d=window.innerWidth,c=window.innerHeight,u=window.innerWidth),(t||o)&&e!==window&&(a=a||e.parentNode,!Va))do{if(a&&a.getBoundingClientRect&&("none"!==ln(a,"transform")||o&&"static"!==ln(a,"position"))){var h=a.getBoundingClientRect();r-=h.top+parseInt(ln(a,"border-top-width")),l-=h.left+parseInt(ln(a,"border-left-width")),s=r+n.height,d=l+n.width;break}}while(a=a.parentNode);if(i&&e!==window){var p=sn(a||e),v=p&&p.a,_=p&&p.d;p&&(s=(r/=_)+(c/=_),d=(l/=v)+(u/=v))}return{top:r,left:l,bottom:s,right:d,width:u,height:c}}}function hn(e,t,o){for(var i=fn(e,!0),a=un(e)[t];i;){var n=un(i)[o];if(!("top"===o||"left"===o?a>=n:a<=n))return i;if(i===cn())break;i=fn(i,!1)}return!1}function pn(e,t,o,i){for(var a=0,n=0,r=e.children;n<r.length;){if("none"!==r[n].style.display&&r[n]!==wr.ghost&&(i||r[n]!==wr.dragged)&&on(r[n],o.draggable,e,!1)){if(a===t)return r[n];a++}n++}return null}function vn(e,t){for(var o=e.lastElementChild;o&&(o===wr.ghost||"none"===ln(o,"display")||t&&!en(o,t));)o=o.previousElementSibling;return o||null}function _n(e,t){var o=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===wr.clone||t&&!en(e,t)||o++;return o}function mn(e){var t=0,o=0,i=cn();if(e)do{var a=sn(e),n=a.a,r=a.d;t+=e.scrollLeft*n,o+=e.scrollTop*r}while(e!==i&&(e=e.parentNode));return[t,o]}function fn(e,t){if(!e||!e.getBoundingClientRect)return cn();var o=e,i=!1;do{if(o.clientWidth<o.scrollWidth||o.clientHeight<o.scrollHeight){var a=ln(o);if(o.clientWidth<o.scrollWidth&&("auto"==a.overflowX||"scroll"==a.overflowX)||o.clientHeight<o.scrollHeight&&("auto"==a.overflowY||"scroll"==a.overflowY)){if(!o.getBoundingClientRect||o===document.body)return cn();if(i||t)return o;i=!0}}}while(o=o.parentNode);return cn()}function yn(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function gn(e,t){return function(){if(!an){var o=arguments;1===o.length?e.call(this,o[0]):e.apply(this,o),an=setTimeout((function(){an=void 0}),t)}}}function bn(e,t,o){e.scrollLeft+=t,e.scrollTop+=o}function wn(e){var t=window.Polymer,o=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):o?o(e).clone(!0)[0]:e.cloneNode(!0)}function xn(e,t,o){var i={};return Array.from(e.children).forEach((function(a){var n,r,l,s;if(on(a,t.draggable,e,!1)&&!a.animated&&a!==o){var d=un(a);i.left=Math.min(null!==(n=i.left)&&void 0!==n?n:1/0,d.left),i.top=Math.min(null!==(r=i.top)&&void 0!==r?r:1/0,d.top),i.right=Math.max(null!==(l=i.right)&&void 0!==l?l:-1/0,d.right),i.bottom=Math.max(null!==(s=i.bottom)&&void 0!==s?s:-1/0,d.bottom)}})),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var kn="Sortable"+(new Date).getTime();function Sn(){var e,t=[];return{captureAnimationState:function(){(t=[],this.options.animation)&&[].slice.call(this.el.children).forEach((function(e){if("none"!==ln(e,"display")&&e!==wr.ghost){t.push({target:e,rect:un(e)});var o=Ia({},t[t.length-1].rect);if(e.thisAnimationDuration){var i=sn(e,!0);i&&(o.top-=i.f,o.left-=i.e)}e.fromRect=o}}))},addAnimationState:function(e){t.push(e)},removeAnimationState:function(e){t.splice(function(e,t){for(var o in e)if(e.hasOwnProperty(o))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[o][i])return Number(o);return-1}(t,{target:e}),1)},animateAll:function(o){var i=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof o&&o());var a=!1,n=0;t.forEach((function(e){var t=0,o=e.target,r=o.fromRect,l=un(o),s=o.prevFromRect,d=o.prevToRect,c=e.rect,u=sn(o,!0);u&&(l.top-=u.f,l.left-=u.e),o.toRect=l,o.thisAnimationDuration&&yn(s,l)&&!yn(r,l)&&(c.top-l.top)/(c.left-l.left)==(r.top-l.top)/(r.left-l.left)&&(t=function(e,t,o,i){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-o.top,2)+Math.pow(t.left-o.left,2))*i.animation}(c,s,d,i.options)),yn(l,r)||(o.prevFromRect=r,o.prevToRect=l,t||(t=i.options.animation),i.animate(o,c,l,t)),t&&(a=!0,n=Math.max(n,t),clearTimeout(o.animationResetTimer),o.animationResetTimer=setTimeout((function(){o.animationTime=0,o.prevFromRect=null,o.fromRect=null,o.prevToRect=null,o.thisAnimationDuration=null}),t),o.thisAnimationDuration=t)})),clearTimeout(e),a?e=setTimeout((function(){"function"==typeof o&&o()}),n):"function"==typeof o&&o(),t=[]},animate:function(e,t,o,i){if(i){ln(e,"transition",""),ln(e,"transform","");var a=sn(this.el),n=a&&a.a,r=a&&a.d,l=(t.left-o.left)/(n||1),s=(t.top-o.top)/(r||1);e.animatingX=!!l,e.animatingY=!!s,ln(e,"transform","translate3d("+l+"px,"+s+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),ln(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),ln(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){ln(e,"transition",""),ln(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),i)}}}}var $n=[],Cn={initializeByDefault:!0},En={mount:function(e){for(var t in Cn)Cn.hasOwnProperty(t)&&!(t in e)&&(e[t]=Cn[t]);$n.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),$n.push(e)},pluginEvent:function(e,t,o){var i=this;this.eventCanceled=!1,o.cancel=function(){i.eventCanceled=!0};var a=e+"Global";$n.forEach((function(i){t[i.pluginName]&&(t[i.pluginName][a]&&t[i.pluginName][a](Ia({sortable:t},o)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](Ia({sortable:t},o)))}))},initializePlugins:function(e,t,o,i){for(var a in $n.forEach((function(i){var a=i.pluginName;if(e.options[a]||i.initializeByDefault){var n=new i(e,t,e.options);n.sortable=e,n.options=e.options,e[a]=n,Fa(o,n.defaults)}})),e.options)if(e.options.hasOwnProperty(a)){var n=this.modifyOption(e,a,e.options[a]);void 0!==n&&(e.options[a]=n)}},getEventProperties:function(e,t){var o={};return $n.forEach((function(i){"function"==typeof i.eventProperties&&Fa(o,i.eventProperties.call(t[i.pluginName],e))})),o},modifyOption:function(e,t,o){var i;return $n.forEach((function(a){e[a.pluginName]&&a.optionListeners&&"function"==typeof a.optionListeners[t]&&(i=a.optionListeners[t].call(e[a.pluginName],o))})),i}};var An=["evt"],Mn=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=o.evt,a=Ua(o,An);En.pluginEvent.bind(wr)(e,t,Ia({dragEl:zn,parentEl:Dn,ghostEl:Tn,rootEl:On,nextEl:Nn,lastDownEl:jn,cloneEl:Bn,cloneHidden:Ln,dragStarted:qn,putSortable:Gn,activeSortable:wr.active,originalEvent:i,oldIndex:In,oldDraggableIndex:Rn,newIndex:Hn,newDraggableIndex:Fn,hideGhostForTarget:fr,unhideGhostForTarget:yr,cloneNowHidden:function(){Ln=!0},cloneNowShown:function(){Ln=!1},dispatchSortableEvent:function(e){Pn({sortable:t,name:e,originalEvent:i})}},a))};function Pn(e){!function(e){var t=e.sortable,o=e.rootEl,i=e.name,a=e.targetEl,n=e.cloneEl,r=e.toEl,l=e.fromEl,s=e.oldIndex,d=e.newIndex,c=e.oldDraggableIndex,u=e.newDraggableIndex,h=e.originalEvent,p=e.putSortable,v=e.extraEventProperties;if(t=t||o&&o[kn]){var _,m=t.options,f="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||Va||Wa?(_=document.createEvent("Event")).initEvent(i,!0,!0):_=new CustomEvent(i,{bubbles:!0,cancelable:!0}),_.to=r||o,_.from=l||o,_.item=a||o,_.clone=n,_.oldIndex=s,_.newIndex=d,_.oldDraggableIndex=c,_.newDraggableIndex=u,_.originalEvent=h,_.pullMode=p?p.lastPutMode:void 0;var y=Ia(Ia({},v),En.getEventProperties(i,t));for(var g in y)_[g]=y[g];o&&o.dispatchEvent(_),m[f]&&m[f].call(t,_)}}(Ia({putSortable:Gn,cloneEl:Bn,targetEl:zn,rootEl:On,oldIndex:In,oldDraggableIndex:Rn,newIndex:Hn,newDraggableIndex:Fn},e))}var zn,Dn,Tn,On,Nn,jn,Bn,Ln,In,Hn,Rn,Fn,Un,Gn,Vn,Wn,Zn,Kn,Yn,Xn,qn,Jn,Qn,er,tr,or=!1,ir=!1,ar=[],nr=!1,rr=!1,lr=[],sr=!1,dr=[],cr="undefined"!=typeof document,ur=Ya,hr=Wa||Va?"cssFloat":"float",pr=cr&&!Xa&&!Ya&&"draggable"in document.createElement("div"),vr=function(){if(cr){if(Va)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),_r=function(e,t){var o=ln(e),i=parseInt(o.width)-parseInt(o.paddingLeft)-parseInt(o.paddingRight)-parseInt(o.borderLeftWidth)-parseInt(o.borderRightWidth),a=pn(e,0,t),n=pn(e,1,t),r=a&&ln(a),l=n&&ln(n),s=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+un(a).width,d=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+un(n).width;if("flex"===o.display)return"column"===o.flexDirection||"column-reverse"===o.flexDirection?"vertical":"horizontal";if("grid"===o.display)return o.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&r.float&&"none"!==r.float){var c="left"===r.float?"left":"right";return!n||"both"!==l.clear&&l.clear!==c?"horizontal":"vertical"}return a&&("block"===r.display||"flex"===r.display||"table"===r.display||"grid"===r.display||s>=i&&"none"===o[hr]||n&&"none"===o[hr]&&s+d>i)?"vertical":"horizontal"},mr=function(e){function t(e,o){return function(i,a,n,r){var l=i.options.group.name&&a.options.group.name&&i.options.group.name===a.options.group.name;if(null==e&&(o||l))return!0;if(null==e||!1===e)return!1;if(o&&"clone"===e)return e;if("function"==typeof e)return t(e(i,a,n,r),o)(i,a,n,r);var s=(o?i:a).options.group.name;return!0===e||"string"==typeof e&&e===s||e.join&&e.indexOf(s)>-1}}var o={},i=e.group;i&&"object"==Ha(i)||(i={name:i}),o.name=i.name,o.checkPull=t(i.pull,!0),o.checkPut=t(i.put),o.revertClone=i.revertClone,e.group=o},fr=function(){!vr&&Tn&&ln(Tn,"display","none")},yr=function(){!vr&&Tn&&ln(Tn,"display","")};cr&&!Xa&&document.addEventListener("click",(function(e){if(ir)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ir=!1,!1}),!0);var gr=function(e){if(zn){var t=function(e,t){var o;return ar.some((function(i){var a=i[kn].options.emptyInsertThreshold;if(a&&!vn(i)){var n=un(i),r=e>=n.left-a&&e<=n.right+a,l=t>=n.top-a&&t<=n.bottom+a;return r&&l?o=i:void 0}})),o}((e=e.touches?e.touches[0]:e).clientX,e.clientY);if(t){var o={};for(var i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[kn]._onDragOver(o)}}},br=function(e){zn&&zn.parentNode[kn]._isOutsideThisEl(e.target)};function wr(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=Fa({},t),e[kn]=this;var o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return _r(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:!1!==wr.supportPointer&&"PointerEvent"in window&&!Ka,emptyInsertThreshold:5};for(var i in En.initializePlugins(this,e,o),o)!(i in t)&&(t[i]=o[i]);for(var a in mr(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&pr,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?Ja(e,"pointerdown",this._onTapStart):(Ja(e,"mousedown",this._onTapStart),Ja(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(Ja(e,"dragover",this),Ja(e,"dragenter",this)),ar.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),Fa(this,Sn())}function xr(e,t,o,i,a,n,r,l){var s,d,c=e[kn],u=c.options.onMove;return!window.CustomEvent||Va||Wa?(s=document.createEvent("Event")).initEvent("move",!0,!0):s=new CustomEvent("move",{bubbles:!0,cancelable:!0}),s.to=t,s.from=e,s.dragged=o,s.draggedRect=i,s.related=a||t,s.relatedRect=n||un(t),s.willInsertAfter=l,s.originalEvent=r,e.dispatchEvent(s),u&&(d=u.call(c,s,r)),d}function kr(e){e.draggable=!1}function Sr(){sr=!1}function $r(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,o=t.length,i=0;o--;)i+=t.charCodeAt(o);return i.toString(36)}function Cr(e){return setTimeout(e,0)}function Er(e){return clearTimeout(e)}wr.prototype={constructor:wr,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Jn=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,zn):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,o=this.el,i=this.options,a=i.preventOnFilter,n=e.type,r=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,l=(r||e).target,s=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||l,d=i.filter;if(function(e){dr.length=0;var t=e.getElementsByTagName("input"),o=t.length;for(;o--;){var i=t[o];i.checked&&dr.push(i)}}(o),!zn&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||i.disabled)&&!s.isContentEditable&&(this.nativeDraggable||!Ka||!l||"SELECT"!==l.tagName.toUpperCase())&&!((l=on(l,i.draggable,o,!1))&&l.animated||jn===l)){if(In=_n(l),Rn=_n(l,i.draggable),"function"==typeof d){if(d.call(this,e,l,this))return Pn({sortable:t,rootEl:s,name:"filter",targetEl:l,toEl:o,fromEl:o}),Mn("filter",t,{evt:e}),void(a&&e.cancelable&&e.preventDefault())}else if(d&&(d=d.split(",").some((function(i){if(i=on(s,i.trim(),o,!1))return Pn({sortable:t,rootEl:i,name:"filter",targetEl:l,fromEl:o,toEl:o}),Mn("filter",t,{evt:e}),!0}))))return void(a&&e.cancelable&&e.preventDefault());i.handle&&!on(s,i.handle,o,!1)||this._prepareDragStart(e,r,l)}}},_prepareDragStart:function(e,t,o){var i,a=this,n=a.el,r=a.options,l=n.ownerDocument;if(o&&!zn&&o.parentNode===n){var s=un(o);if(On=n,Dn=(zn=o).parentNode,Nn=zn.nextSibling,jn=o,Un=r.group,wr.dragged=zn,Vn={target:zn,clientX:(t||e).clientX,clientY:(t||e).clientY},Yn=Vn.clientX-s.left,Xn=Vn.clientY-s.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,zn.style["will-change"]="all",i=function(){Mn("delayEnded",a,{evt:e}),wr.eventCanceled?a._onDrop():(a._disableDelayedDragEvents(),!Za&&a.nativeDraggable&&(zn.draggable=!0),a._triggerDragStart(e,t),Pn({sortable:a,name:"choose",originalEvent:e}),rn(zn,r.chosenClass,!0))},r.ignore.split(",").forEach((function(e){dn(zn,e.trim(),kr)})),Ja(l,"dragover",gr),Ja(l,"mousemove",gr),Ja(l,"touchmove",gr),Ja(l,"mouseup",a._onDrop),Ja(l,"touchend",a._onDrop),Ja(l,"touchcancel",a._onDrop),Za&&this.nativeDraggable&&(this.options.touchStartThreshold=4,zn.draggable=!0),Mn("delayStart",this,{evt:e}),!r.delay||r.delayOnTouchOnly&&!t||this.nativeDraggable&&(Wa||Va))i();else{if(wr.eventCanceled)return void this._onDrop();Ja(l,"mouseup",a._disableDelayedDrag),Ja(l,"touchend",a._disableDelayedDrag),Ja(l,"touchcancel",a._disableDelayedDrag),Ja(l,"mousemove",a._delayedDragTouchMoveHandler),Ja(l,"touchmove",a._delayedDragTouchMoveHandler),r.supportPointer&&Ja(l,"pointermove",a._delayedDragTouchMoveHandler),a._dragStartTimer=setTimeout(i,r.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){zn&&kr(zn),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;Qa(e,"mouseup",this._disableDelayedDrag),Qa(e,"touchend",this._disableDelayedDrag),Qa(e,"touchcancel",this._disableDelayedDrag),Qa(e,"mousemove",this._delayedDragTouchMoveHandler),Qa(e,"touchmove",this._delayedDragTouchMoveHandler),Qa(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?Ja(document,"pointermove",this._onTouchMove):Ja(document,t?"touchmove":"mousemove",this._onTouchMove):(Ja(zn,"dragend",this),Ja(On,"dragstart",this._onDragStart));try{document.selection?Cr((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(or=!1,On&&zn){Mn("dragStarted",this,{evt:t}),this.nativeDraggable&&Ja(document,"dragover",br);var o=this.options;!e&&rn(zn,o.dragClass,!1),rn(zn,o.ghostClass,!0),wr.active=this,e&&this._appendGhost(),Pn({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Wn){this._lastX=Wn.clientX,this._lastY=Wn.clientY,fr();for(var e=document.elementFromPoint(Wn.clientX,Wn.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Wn.clientX,Wn.clientY))!==t;)t=e;if(zn.parentNode[kn]._isOutsideThisEl(e),t)do{if(t[kn]){if(t[kn]._onDragOver({clientX:Wn.clientX,clientY:Wn.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}e=t}while(t=t.parentNode);yr()}},_onTouchMove:function(e){if(Vn){var t=this.options,o=t.fallbackTolerance,i=t.fallbackOffset,a=e.touches?e.touches[0]:e,n=Tn&&sn(Tn,!0),r=Tn&&n&&n.a,l=Tn&&n&&n.d,s=ur&&tr&&mn(tr),d=(a.clientX-Vn.clientX+i.x)/(r||1)+(s?s[0]-lr[0]:0)/(r||1),c=(a.clientY-Vn.clientY+i.y)/(l||1)+(s?s[1]-lr[1]:0)/(l||1);if(!wr.active&&!or){if(o&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))<o)return;this._onDragStart(e,!0)}if(Tn){n?(n.e+=d-(Zn||0),n.f+=c-(Kn||0)):n={a:1,b:0,c:0,d:1,e:d,f:c};var u="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")");ln(Tn,"webkitTransform",u),ln(Tn,"mozTransform",u),ln(Tn,"msTransform",u),ln(Tn,"transform",u),Zn=d,Kn=c,Wn=a}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Tn){var e=this.options.fallbackOnBody?document.body:On,t=un(zn,!0,ur,!0,e),o=this.options;if(ur){for(tr=e;"static"===ln(tr,"position")&&"none"===ln(tr,"transform")&&tr!==document;)tr=tr.parentNode;tr!==document.body&&tr!==document.documentElement?(tr===document&&(tr=cn()),t.top+=tr.scrollTop,t.left+=tr.scrollLeft):tr=cn(),lr=mn(tr)}rn(Tn=zn.cloneNode(!0),o.ghostClass,!1),rn(Tn,o.fallbackClass,!0),rn(Tn,o.dragClass,!0),ln(Tn,"transition",""),ln(Tn,"transform",""),ln(Tn,"box-sizing","border-box"),ln(Tn,"margin",0),ln(Tn,"top",t.top),ln(Tn,"left",t.left),ln(Tn,"width",t.width),ln(Tn,"height",t.height),ln(Tn,"opacity","0.8"),ln(Tn,"position",ur?"absolute":"fixed"),ln(Tn,"zIndex","100000"),ln(Tn,"pointerEvents","none"),wr.ghost=Tn,e.appendChild(Tn),ln(Tn,"transform-origin",Yn/parseInt(Tn.style.width)*100+"% "+Xn/parseInt(Tn.style.height)*100+"%")}},_onDragStart:function(e,t){var o=this,i=e.dataTransfer,a=o.options;Mn("dragStart",this,{evt:e}),wr.eventCanceled?this._onDrop():(Mn("setupClone",this),wr.eventCanceled||((Bn=wn(zn)).removeAttribute("id"),Bn.draggable=!1,Bn.style["will-change"]="",this._hideClone(),rn(Bn,this.options.chosenClass,!1),wr.clone=Bn),o.cloneId=Cr((function(){Mn("clone",o),wr.eventCanceled||(o.options.removeCloneOnHide||On.insertBefore(Bn,zn),o._hideClone(),Pn({sortable:o,name:"clone"}))})),!t&&rn(zn,a.dragClass,!0),t?(ir=!0,o._loopId=setInterval(o._emulateDragOver,50)):(Qa(document,"mouseup",o._onDrop),Qa(document,"touchend",o._onDrop),Qa(document,"touchcancel",o._onDrop),i&&(i.effectAllowed="move",a.setData&&a.setData.call(o,i,zn)),Ja(document,"drop",o),ln(zn,"transform","translateZ(0)")),or=!0,o._dragStartId=Cr(o._dragStarted.bind(o,t,e)),Ja(document,"selectstart",o),qn=!0,Ka&&ln(document.body,"user-select","none"))},_onDragOver:function(e){var t,o,i,a,n=this.el,r=e.target,l=this.options,s=l.group,d=wr.active,c=Un===s,u=l.sort,h=Gn||d,p=this,v=!1;if(!sr){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),r=on(r,l.draggable,n,!0),M("dragOver"),wr.eventCanceled)return v;if(zn.contains(e.target)||r.animated&&r.animatingX&&r.animatingY||p._ignoreWhileAnimating===r)return z(!1);if(ir=!1,d&&!l.disabled&&(c?u||(i=Dn!==On):Gn===this||(this.lastPutMode=Un.checkPull(this,d,zn,e))&&s.checkPut(this,d,zn,e))){if(a="vertical"===this._getDirection(e,r),t=un(zn),M("dragOverValid"),wr.eventCanceled)return v;if(i)return Dn=On,P(),this._hideClone(),M("revert"),wr.eventCanceled||(Nn?On.insertBefore(zn,Nn):On.appendChild(zn)),z(!0);var _=vn(n,l.draggable);if(!_||function(e,t,o){var i=un(vn(o.el,o.options.draggable)),a=xn(o.el,o.options,Tn),n=10;return t?e.clientX>a.right+n||e.clientY>i.bottom&&e.clientX>i.left:e.clientY>a.bottom+n||e.clientX>i.right&&e.clientY>i.top}(e,a,this)&&!_.animated){if(_===zn)return z(!1);if(_&&n===e.target&&(r=_),r&&(o=un(r)),!1!==xr(On,n,zn,t,r,o,e,!!r))return P(),_&&_.nextSibling?n.insertBefore(zn,_.nextSibling):n.appendChild(zn),Dn=n,D(),z(!0)}else if(_&&function(e,t,o){var i=un(pn(o.el,0,o.options,!0)),a=xn(o.el,o.options,Tn),n=10;return t?e.clientX<a.left-n||e.clientY<i.top&&e.clientX<i.right:e.clientY<a.top-n||e.clientY<i.bottom&&e.clientX<i.left}(e,a,this)){var m=pn(n,0,l,!0);if(m===zn)return z(!1);if(o=un(r=m),!1!==xr(On,n,zn,t,r,o,e,!1))return P(),n.insertBefore(zn,m),Dn=n,D(),z(!0)}else if(r.parentNode===n){o=un(r);var f,y,g,b=zn.parentNode!==n,w=!function(e,t,o){var i=o?e.left:e.top,a=o?e.right:e.bottom,n=o?e.width:e.height,r=o?t.left:t.top,l=o?t.right:t.bottom,s=o?t.width:t.height;return i===r||a===l||i+n/2===r+s/2}(zn.animated&&zn.toRect||t,r.animated&&r.toRect||o,a),x=a?"top":"left",k=hn(r,"top","top")||hn(zn,"top","top"),S=k?k.scrollTop:void 0;if(Jn!==r&&(y=o[x],nr=!1,rr=!w&&l.invertSwap||b),f=function(e,t,o,i,a,n,r,l){var s=i?e.clientY:e.clientX,d=i?o.height:o.width,c=i?o.top:o.left,u=i?o.bottom:o.right,h=!1;if(!r)if(l&&er<d*a){if(!nr&&(1===Qn?s>c+d*n/2:s<u-d*n/2)&&(nr=!0),nr)h=!0;else if(1===Qn?s<c+er:s>u-er)return-Qn}else if(s>c+d*(1-a)/2&&s<u-d*(1-a)/2)return function(e){return _n(zn)<_n(e)?1:-1}(t);if((h=h||r)&&(s<c+d*n/2||s>u-d*n/2))return s>c+d/2?1:-1;return 0}(e,r,o,a,w?1:l.swapThreshold,null==l.invertedSwapThreshold?l.swapThreshold:l.invertedSwapThreshold,rr,Jn===r),0!==f){var $=_n(zn);do{$-=f,g=Dn.children[$]}while(g&&("none"===ln(g,"display")||g===Tn))}if(0===f||g===r)return z(!1);Jn=r,Qn=f;var C=r.nextElementSibling,E=!1,A=xr(On,n,zn,t,r,o,e,E=1===f);if(!1!==A)return 1!==A&&-1!==A||(E=1===A),sr=!0,setTimeout(Sr,30),P(),E&&!C?n.appendChild(zn):r.parentNode.insertBefore(zn,E?C:r),k&&bn(k,0,S-k.scrollTop),Dn=zn.parentNode,void 0===y||rr||(er=Math.abs(y-un(r)[x])),D(),z(!0)}if(n.contains(zn))return z(!1)}return!1}function M(l,s){Mn(l,p,Ia({evt:e,isOwner:c,axis:a?"vertical":"horizontal",revert:i,dragRect:t,targetRect:o,canSort:u,fromSortable:h,target:r,completed:z,onMove:function(o,i){return xr(On,n,zn,t,o,un(o),e,i)},changed:D},s))}function P(){M("dragOverAnimationCapture"),p.captureAnimationState(),p!==h&&h.captureAnimationState()}function z(t){return M("dragOverCompleted",{insertion:t}),t&&(c?d._hideClone():d._showClone(p),p!==h&&(rn(zn,Gn?Gn.options.ghostClass:d.options.ghostClass,!1),rn(zn,l.ghostClass,!0)),Gn!==p&&p!==wr.active?Gn=p:p===wr.active&&Gn&&(Gn=null),h===p&&(p._ignoreWhileAnimating=r),p.animateAll((function(){M("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==h&&(h.animateAll(),h._ignoreWhileAnimating=null)),(r===zn&&!zn.animated||r===n&&!r.animated)&&(Jn=null),l.dragoverBubble||e.rootEl||r===document||(zn.parentNode[kn]._isOutsideThisEl(e.target),!t&&gr(e)),!l.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),v=!0}function D(){Hn=_n(zn),Fn=_n(zn,l.draggable),Pn({sortable:p,name:"change",toEl:n,newIndex:Hn,newDraggableIndex:Fn,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){Qa(document,"mousemove",this._onTouchMove),Qa(document,"touchmove",this._onTouchMove),Qa(document,"pointermove",this._onTouchMove),Qa(document,"dragover",gr),Qa(document,"mousemove",gr),Qa(document,"touchmove",gr)},_offUpEvents:function(){var e=this.el.ownerDocument;Qa(e,"mouseup",this._onDrop),Qa(e,"touchend",this._onDrop),Qa(e,"pointerup",this._onDrop),Qa(e,"touchcancel",this._onDrop),Qa(document,"selectstart",this)},_onDrop:function(e){var t=this.el,o=this.options;Hn=_n(zn),Fn=_n(zn,o.draggable),Mn("drop",this,{evt:e}),Dn=zn&&zn.parentNode,Hn=_n(zn),Fn=_n(zn,o.draggable),wr.eventCanceled||(or=!1,rr=!1,nr=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Er(this.cloneId),Er(this._dragStartId),this.nativeDraggable&&(Qa(document,"drop",this),Qa(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Ka&&ln(document.body,"user-select",""),ln(zn,"transform",""),e&&(qn&&(e.cancelable&&e.preventDefault(),!o.dropBubble&&e.stopPropagation()),Tn&&Tn.parentNode&&Tn.parentNode.removeChild(Tn),(On===Dn||Gn&&"clone"!==Gn.lastPutMode)&&Bn&&Bn.parentNode&&Bn.parentNode.removeChild(Bn),zn&&(this.nativeDraggable&&Qa(zn,"dragend",this),kr(zn),zn.style["will-change"]="",qn&&!or&&rn(zn,Gn?Gn.options.ghostClass:this.options.ghostClass,!1),rn(zn,this.options.chosenClass,!1),Pn({sortable:this,name:"unchoose",toEl:Dn,newIndex:null,newDraggableIndex:null,originalEvent:e}),On!==Dn?(Hn>=0&&(Pn({rootEl:Dn,name:"add",toEl:Dn,fromEl:On,originalEvent:e}),Pn({sortable:this,name:"remove",toEl:Dn,originalEvent:e}),Pn({rootEl:Dn,name:"sort",toEl:Dn,fromEl:On,originalEvent:e}),Pn({sortable:this,name:"sort",toEl:Dn,originalEvent:e})),Gn&&Gn.save()):Hn!==In&&Hn>=0&&(Pn({sortable:this,name:"update",toEl:Dn,originalEvent:e}),Pn({sortable:this,name:"sort",toEl:Dn,originalEvent:e})),wr.active&&(null!=Hn&&-1!==Hn||(Hn=In,Fn=Rn),Pn({sortable:this,name:"end",toEl:Dn,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Mn("nulling",this),On=zn=Dn=Tn=Nn=Bn=jn=Ln=Vn=Wn=qn=Hn=Fn=In=Rn=Jn=Qn=Gn=Un=wr.dragged=wr.ghost=wr.clone=wr.active=null,dr.forEach((function(e){e.checked=!0})),dr.length=Zn=Kn=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":zn&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],o=this.el.children,i=0,a=o.length,n=this.options;i<a;i++)on(e=o[i],n.draggable,this.el,!1)&&t.push(e.getAttribute(n.dataIdAttr)||$r(e));return t},sort:function(e,t){var o={},i=this.el;this.toArray().forEach((function(e,t){var a=i.children[t];on(a,this.options.draggable,i,!1)&&(o[e]=a)}),this),t&&this.captureAnimationState(),e.forEach((function(e){o[e]&&(i.removeChild(o[e]),i.appendChild(o[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return on(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var o=this.options;if(void 0===t)return o[e];var i=En.modifyOption(this,e,t);o[e]=void 0!==i?i:t,"group"===e&&mr(o)},destroy:function(){Mn("destroy",this);var e=this.el;e[kn]=null,Qa(e,"mousedown",this._onTapStart),Qa(e,"touchstart",this._onTapStart),Qa(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(Qa(e,"dragover",this),Qa(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ar.splice(ar.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Ln){if(Mn("hideClone",this),wr.eventCanceled)return;ln(Bn,"display","none"),this.options.removeCloneOnHide&&Bn.parentNode&&Bn.parentNode.removeChild(Bn),Ln=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Ln){if(Mn("showClone",this),wr.eventCanceled)return;zn.parentNode!=On||this.options.group.revertClone?Nn?On.insertBefore(Bn,Nn):On.appendChild(Bn):On.insertBefore(Bn,zn),this.options.group.revertClone&&this.animate(zn,Bn),ln(Bn,"display",""),Ln=!1}}else this._hideClone()}},cr&&Ja(document,"touchmove",(function(e){(wr.active||or)&&e.cancelable&&e.preventDefault()})),wr.utils={on:Ja,off:Qa,css:ln,find:dn,is:function(e,t){return!!on(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);return e},throttle:gn,closest:on,toggleClass:rn,clone:wn,index:_n,nextTick:Cr,cancelNextTick:Er,detectDirection:_r,getChild:pn},wr.get=function(e){return e[kn]},wr.mount=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(wr.utils=Ia(Ia({},wr.utils),e.utils)),En.mount(e)}))},wr.create=function(e,t){return new wr(e,t)},wr.version="1.15.2";var Ar,Mr,Pr,zr,Dr,Tr,Or=[],Nr=!1;function jr(){Or.forEach((function(e){clearInterval(e.pid)})),Or=[]}function Br(){clearInterval(Tr)}var Lr=gn((function(e,t,o,i){if(t.scroll){var a,n=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,l=t.scrollSensitivity,s=t.scrollSpeed,d=cn(),c=!1;Mr!==o&&(Mr=o,jr(),Ar=t.scroll,a=t.scrollFn,!0===Ar&&(Ar=fn(o,!0)));var u=0,h=Ar;do{var p=h,v=un(p),_=v.top,m=v.bottom,f=v.left,y=v.right,g=v.width,b=v.height,w=void 0,x=void 0,k=p.scrollWidth,S=p.scrollHeight,$=ln(p),C=p.scrollLeft,E=p.scrollTop;p===d?(w=g<k&&("auto"===$.overflowX||"scroll"===$.overflowX||"visible"===$.overflowX),x=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY||"visible"===$.overflowY)):(w=g<k&&("auto"===$.overflowX||"scroll"===$.overflowX),x=b<S&&("auto"===$.overflowY||"scroll"===$.overflowY));var A=w&&(Math.abs(y-n)<=l&&C+g<k)-(Math.abs(f-n)<=l&&!!C),M=x&&(Math.abs(m-r)<=l&&E+b<S)-(Math.abs(_-r)<=l&&!!E);if(!Or[u])for(var P=0;P<=u;P++)Or[P]||(Or[P]={});Or[u].vx==A&&Or[u].vy==M&&Or[u].el===p||(Or[u].el=p,Or[u].vx=A,Or[u].vy=M,clearInterval(Or[u].pid),0==A&&0==M||(c=!0,Or[u].pid=setInterval(function(){i&&0===this.layer&&wr.active._onTouchMove(Dr);var t=Or[this.layer].vy?Or[this.layer].vy*s:0,o=Or[this.layer].vx?Or[this.layer].vx*s:0;"function"==typeof a&&"continue"!==a.call(wr.dragged.parentNode[kn],o,t,e,Dr,Or[this.layer].el)||bn(Or[this.layer].el,o,t)}.bind({layer:u}),24))),u++}while(t.bubbleScroll&&h!==d&&(h=fn(h,!1)));Nr=c}}),30),Ir=function(e){var t=e.originalEvent,o=e.putSortable,i=e.dragEl,a=e.activeSortable,n=e.dispatchSortableEvent,r=e.hideGhostForTarget,l=e.unhideGhostForTarget;if(t){var s=o||a;r();var d=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,c=document.elementFromPoint(d.clientX,d.clientY);l(),s&&!s.el.contains(c)&&(n("spill"),this.onSpill({dragEl:i,putSortable:o}))}};function Hr(){}function Rr(){}Hr.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,o=e.putSortable;this.sortable.captureAnimationState(),o&&o.captureAnimationState();var i=pn(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),o&&o.animateAll()},drop:Ir},Fa(Hr,{pluginName:"revertOnSpill"}),Rr.prototype={onSpill:function(e){var t=e.dragEl,o=e.putSortable||this.sortable;o.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),o.animateAll()},drop:Ir},Fa(Rr,{pluginName:"removeOnSpill"});var Fr=[Rr,Hr];wr.mount(Fr,new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?Ja(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Ja(document,"pointermove",this._handleFallbackAutoScroll):t.touches?Ja(document,"touchmove",this._handleFallbackAutoScroll):Ja(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?Qa(document,"dragover",this._handleAutoScroll):(Qa(document,"pointermove",this._handleFallbackAutoScroll),Qa(document,"touchmove",this._handleFallbackAutoScroll),Qa(document,"mousemove",this._handleFallbackAutoScroll)),Br(),jr(),clearTimeout(an),an=void 0},nulling:function(){Dr=Mr=Ar=Nr=Tr=Pr=zr=null,Or.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var o=this,i=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,n=document.elementFromPoint(i,a);if(Dr=e,t||this.options.forceAutoScrollFallback||Wa||Va||Ka){Lr(e,this.options,n,t);var r=fn(n,!0);!Nr||Tr&&i===Pr&&a===zr||(Tr&&Br(),Tr=setInterval((function(){var n=fn(document.elementFromPoint(i,a),!0);n!==r&&(r=n,jr()),Lr(e,o.options,n,t)}),10),Pr=i,zr=a)}else{if(!this.options.bubbleScroll||fn(n,!0)===cn())return void jr();Lr(e,this.options,fn(n,!1),!1)}}},Fa(e,{pluginName:"scroll",initializeByDefault:!0})});var Ur=Object.freeze({__proto__:null,default:wr});export{Tt as PowerFlowCardPlus};