40 lines
105 KiB
JavaScript
40 lines
105 KiB
JavaScript
function e(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function t(e,t,n,a){var l,s=arguments.length,i=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,a);else for(var o=e.length-1;o>=0;o--)(l=e[o])&&(i=(s<3?l(i):s>3?l(t,n,i):l(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i}"function"==typeof SuppressedError&&SuppressedError;
|
||
/**
|
||
* @license
|
||
* Copyright 2019 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/
|
||
const n=globalThis,a=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),s=new WeakMap;let i=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==l)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(a&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=s.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&s.set(t,e))}return e}toString(){return this.cssText}};const o=(e,...t)=>{const n=1===e.length?e[0]:t.reduce(((t,n,a)=>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.")})(n)+e[a+1]),e[0]);return new i(n,e,l)},r=a?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new i("string"==typeof e?e:e+"",void 0,l))(t)})(e):e
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/,{is:c,defineProperty:_,getOwnPropertyDescriptor:h,getOwnPropertyNames:d,getOwnPropertySymbols:g,getPrototypeOf:p}=Object,m=globalThis,u=m.trustedTypes,v=u?u.emptyScript:"",f=m.reactiveElementPolyfillSupport,b=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},w=(e,t)=>!c(e,t),C={attribute:!0,type:String,converter:y,reflect:!1,useDefault:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let x=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),a=this.getPropertyDescriptor(e,n,t);void 0!==a&&_(this.prototype,e,a)}}static getPropertyDescriptor(e,t,n){const{get:a,set:l}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:a,set(t){const s=a?.call(this);l?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??C}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const e=p(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const e=this.properties,t=[...d(e),...g(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(r(e))}else void 0!==e&&t.push(r(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(a)e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const a of t){const t=document.createElement("style"),l=n.litNonce;void 0!==l&&t.setAttribute("nonce",l),t.textContent=a.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),a=this.constructor._$Eu(e,n);if(void 0!==a&&!0===n.reflect){const l=(void 0!==n.converter?.toAttribute?n.converter:y).toAttribute(t,n.type);this._$Em=e,null==l?this.removeAttribute(a):this.setAttribute(a,l),this._$Em=null}}_$AK(e,t){const n=this.constructor,a=n._$Eh.get(e);if(void 0!==a&&this._$Em!==a){const e=n.getPropertyOptions(a),l="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=a,this[a]=l.fromAttribute(t,e.type)??this._$Ej?.get(a)??null,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const a=this.constructor,l=this[e];if(n??=a.getPropertyOptions(e),!((n.hasChanged??w)(l,t)||n.useDefault&&n.reflect&&l===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:a,wrapped:l},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==l||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===a&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,a=this[t];!0!==e||this._$AL.has(t)||void 0===a||this.C(t,void 0,n,a)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(e){}firstUpdated(e){}};x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[b("elementProperties")]=new Map,x[b("finalized")]=new Map,f?.({ReactiveElement:x}),(m.reactiveElementVersions??=[]).push("2.1.0");
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/
|
||
const S=globalThis,k=S.trustedTypes,A=k?k.createPolicy("lit-html",{createHTML:e=>e}):void 0,M="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,V="?"+$,T=`<${V}>`,E=document,O=()=>E.createComment(""),z=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,N="[ \t\n\f\r]",U=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,B=/>/g,P=RegExp(`>|${N}(?:([^\\s"'>=/]+)(${N}*=${N}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),j=/'/g,L=/"/g,H=/^(?:script|style|textarea|title)$/i,I=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),F=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),J=new WeakMap,q=E.createTreeWalker(E,129);function W(e,t){if(!D(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(t):t}const Z=(e,t)=>{const n=e.length-1,a=[];let l,s=2===t?"<svg>":3===t?"<math>":"",i=U;for(let t=0;t<n;t++){const n=e[t];let o,r,c=-1,_=0;for(;_<n.length&&(i.lastIndex=_,r=i.exec(n),null!==r);)_=i.lastIndex,i===U?"!--"===r[1]?i=R:void 0!==r[1]?i=B:void 0!==r[2]?(H.test(r[2])&&(l=RegExp("</"+r[2],"g")),i=P):void 0!==r[3]&&(i=P):i===P?">"===r[0]?(i=l??U,c=-1):void 0===r[1]?c=-2:(c=i.lastIndex-r[2].length,o=r[1],i=void 0===r[3]?P:'"'===r[3]?L:j):i===L||i===j?i=P:i===R||i===B?i=U:(i=P,l=void 0);const h=i===P&&e[t+1].startsWith("/>")?" ":"";s+=i===U?n+T:c>=0?(a.push(o),n.slice(0,c)+M+n.slice(c)+$+h):n+$+(-2===c?t:h)}return[W(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),a]};class G{constructor({strings:e,_$litType$:t},n){let a;this.parts=[];let l=0,s=0;const i=e.length-1,o=this.parts,[r,c]=Z(e,t);if(this.el=G.createElement(r,n),q.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=q.nextNode())&&o.length<i;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith(M)){const t=c[s++],n=a.getAttribute(e).split($),i=/([.?@])?(.*)/.exec(t);o.push({type:1,index:l,name:i[2],strings:n,ctor:"."===i[1]?te:"?"===i[1]?ne:"@"===i[1]?ae:ee}),a.removeAttribute(e)}else e.startsWith($)&&(o.push({type:6,index:l}),a.removeAttribute(e));if(H.test(a.tagName)){const e=a.textContent.split($),t=e.length-1;if(t>0){a.textContent=k?k.emptyScript:"";for(let n=0;n<t;n++)a.append(e[n],O()),q.nextNode(),o.push({type:2,index:++l});a.append(e[t],O())}}}else if(8===a.nodeType)if(a.data===V)o.push({type:2,index:l});else{let e=-1;for(;-1!==(e=a.data.indexOf($,e+1));)o.push({type:7,index:l}),e+=$.length-1}l++}}static createElement(e,t){const n=E.createElement("template");return n.innerHTML=e,n}}function Y(e,t,n=e,a){if(t===F)return t;let l=void 0!==a?n._$Co?.[a]:n._$Cl;const s=z(t)?void 0:t._$litDirective$;return l?.constructor!==s&&(l?._$AO?.(!1),void 0===s?l=void 0:(l=new s(e),l._$AT(e,n,a)),void 0!==a?(n._$Co??=[])[a]=l:n._$Cl=l),void 0!==l&&(t=Y(e,l._$AS(e,t.values),l,a)),t}class Q{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){const{el:{content:t},parts:n}=this._$AD,a=(e?.creationScope??E).importNode(t,!0);q.currentNode=a;let l=q.nextNode(),s=0,i=0,o=n[0];for(;void 0!==o;){if(s===o.index){let t;2===o.type?t=new X(l,l.nextSibling,this,e):1===o.type?t=new o.ctor(l,o.name,o.strings,this,e):6===o.type&&(t=new le(l,this,e)),this._$AV.push(t),o=n[++i]}s!==o?.index&&(l=q.nextNode(),s++)}return q.currentNode=E,a}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,a){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=a,this._$Cv=a?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===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),z(e)?e===K||null==e||""===e?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==F&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>D(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&z(this._$AH)?this._$AA.nextSibling.data=e:this.T(E.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,a="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=G.createElement(W(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===a)this._$AH.p(t);else{const e=new Q(a,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new G(e)),t}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,a=0;for(const l of e)a===t.length?t.push(n=new X(this.O(O()),this.O(O()),this,this.options)):n=t[a],n._$AI(l),a++;a<t.length&&(this._$AR(n&&n._$AB.nextSibling,a),t.length=a)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,a,l){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,this._$AM=a,this.options=l,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=K}_$AI(e,t=this,n,a){const l=this.strings;let s=!1;if(void 0===l)e=Y(this,e,t,0),s=!z(e)||e!==this._$AH&&e!==F,s&&(this._$AH=e);else{const a=e;let i,o;for(e=l[0],i=0;i<l.length-1;i++)o=Y(this,a[n+i],t,i),o===F&&(o=this._$AH[i]),s||=!z(o)||o!==this._$AH[i],o===K?e=K:e!==K&&(e+=(o??"")+l[i+1]),this._$AH[i]=o}s&&!a&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class te extends ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}}class ne extends ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}}class ae extends ee{constructor(e,t,n,a,l){super(e,t,n,a,l),this.type=5}_$AI(e,t=this){if((e=Y(this,e,t,0)??K)===F)return;const n=this._$AH,a=e===K&&n!==K||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,l=e!==K&&(n===K||a);a&&this.element.removeEventListener(this.name,this,n),l&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class le{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Y(this,e)}}const se=S.litHtmlPolyfillSupport;se?.(G,X),(S.litHtmlVersions??=[]).push("3.3.0");const ie=globalThis;
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/class oe extends x{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const a=n?.renderBefore??t;let l=a._$litPart$;if(void 0===l){const e=n?.renderBefore??null;a._$litPart$=l=new X(t.insertBefore(O(),e),e,void 0,n??{})}return l._$AI(e),l})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return F}}oe._$litElement$=!0,oe.finalized=!0,ie.litElementHydrateSupport?.({LitElement:oe});const re=ie.litElementPolyfillSupport;re?.({LitElement:oe}),(ie.litElementVersions??=[]).push("4.2.0");
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/
|
||
const ce=e=>(t,n)=>{void 0!==n?n.addInitializer((()=>{customElements.define(e,t)})):customElements.define(e,t)}
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/,_e={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:w},he=(e=_e,t,n)=>{const{kind:a,metadata:l}=n;let s=globalThis.litPropertyMetadata.get(l);if(void 0===s&&globalThis.litPropertyMetadata.set(l,s=new Map),"setter"===a&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===a){const{name:a}=n;return{set(n){const l=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,l,e)},init(t){return void 0!==t&&this.C(a,void 0,e,t),t}}}if("setter"===a){const{name:a}=n;return function(n){const l=this[a];t.call(this,n),this.requestUpdate(a,l,e)}}throw Error("Unsupported decorator location: "+a)};function de(e){return(t,n)=>"object"==typeof n?he(e,t,n):((e,t,n)=>{const a=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),a?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)
|
||
/**
|
||
* @license
|
||
* Copyright 2017 Google LLC
|
||
* SPDX-License-Identifier: BSD-3-Clause
|
||
*/}const ge="jk-bms-content-card-editor",pe="jk-bms-card";var me;!function(e){e.delta_cell_voltage="delta_cell_voltage",e.balancing="balancing",e.balancing_current="balancing_current",e.power="power",e.balance_trigger_voltage="balance_trigger_voltage",e.balance_starting_voltage="balance_starting_voltage",e.total_runtime_formatted="total_runtime_formatted",e.charging="charging",e.charging_power="charging_power",e.discharging="discharging",e.discharging_power="discharging_power",e.balancer="balancer",e.heater="heater",e.total_voltage="total_voltage",e.total_battery_capacity_setting="total_battery_capacity_setting",e.total_charging_cycle_capacity="total_charging_cycle_capacity",e.average_cell_voltage="average_cell_voltage",e.current="current",e.state_of_charge="state_of_charge",e.capacity_remaining="capacity_remaining",e.charging_cycles="charging_cycles",e.power_tube_temperature="power_tube_temperature",e.min_voltage_cell="min_voltage_cell",e.max_voltage_cell="max_voltage_cell",e.min_cell_voltage="min_cell_voltage",e.max_cell_voltage="max_cell_voltage",e.errors="errors",e.software_version="software_version",e.hardware_version="hardware_version",e.cell_voltage_1="cell_voltage_1",e.cell_voltage_2="cell_voltage_2",e.cell_voltage_3="cell_voltage_3",e.cell_voltage_4="cell_voltage_4",e.cell_voltage_5="cell_voltage_5",e.cell_voltage_6="cell_voltage_6",e.cell_voltage_7="cell_voltage_7",e.cell_voltage_8="cell_voltage_8",e.cell_voltage_9="cell_voltage_9",e.cell_voltage_10="cell_voltage_10",e.cell_voltage_11="cell_voltage_11",e.cell_voltage_12="cell_voltage_12",e.cell_voltage_13="cell_voltage_13",e.cell_voltage_14="cell_voltage_14",e.cell_voltage_15="cell_voltage_15",e.cell_voltage_16="cell_voltage_16",e.cell_voltage_17="cell_voltage_17",e.cell_voltage_18="cell_voltage_18",e.cell_voltage_19="cell_voltage_19",e.cell_voltage_20="cell_voltage_20",e.cell_voltage_21="cell_voltage_21",e.cell_voltage_22="cell_voltage_22",e.cell_voltage_23="cell_voltage_23",e.cell_voltage_24="cell_voltage_24",e.cell_voltage_25="cell_voltage_25",e.cell_voltage_26="cell_voltage_26",e.cell_voltage_27="cell_voltage_27",e.cell_voltage_28="cell_voltage_28",e.cell_voltage_29="cell_voltage_29",e.cell_voltage_30="cell_voltage_30",e.cell_voltage_31="cell_voltage_31",e.cell_voltage_32="cell_voltage_32",e.cell_voltage_33="cell_voltage_33",e.cell_voltage_34="cell_voltage_34",e.cell_voltage_35="cell_voltage_35",e.cell_voltage_36="cell_voltage_36",e.cell_voltage_37="cell_voltage_37",e.cell_voltage_38="cell_voltage_38",e.cell_voltage_39="cell_voltage_39",e.cell_voltage_40="cell_voltage_40",e.cell_voltage_41="cell_voltage_41",e.cell_voltage_42="cell_voltage_42",e.cell_voltage_43="cell_voltage_43",e.cell_voltage_44="cell_voltage_44",e.cell_voltage_45="cell_voltage_45",e.cell_voltage_46="cell_voltage_46",e.cell_voltage_47="cell_voltage_47",e.cell_voltage_48="cell_voltage_48",e.cell_voltage_49="cell_voltage_49",e.cell_voltage_50="cell_voltage_50",e.cell_voltage_51="cell_voltage_51",e.cell_voltage_52="cell_voltage_52",e.cell_voltage_53="cell_voltage_53",e.cell_voltage_54="cell_voltage_54",e.cell_voltage_55="cell_voltage_55",e.cell_voltage_56="cell_voltage_56",e.cell_voltage_57="cell_voltage_57",e.cell_voltage_58="cell_voltage_58",e.cell_voltage_59="cell_voltage_59",e.cell_voltage_60="cell_voltage_60",e.cell_voltage_61="cell_voltage_61",e.cell_voltage_62="cell_voltage_62",e.cell_voltage_63="cell_voltage_63",e.cell_voltage_64="cell_voltage_64",e.cell_voltage_65="cell_voltage_65",e.cell_voltage_66="cell_voltage_66",e.cell_voltage_67="cell_voltage_67",e.cell_voltage_68="cell_voltage_68",e.cell_voltage_69="cell_voltage_69",e.cell_voltage_70="cell_voltage_70",e.cell_voltage_71="cell_voltage_71",e.cell_voltage_72="cell_voltage_72",e.cell_voltage_73="cell_voltage_73",e.cell_voltage_74="cell_voltage_74",e.cell_voltage_75="cell_voltage_75",e.cell_voltage_76="cell_voltage_76",e.cell_voltage_77="cell_voltage_77",e.cell_voltage_78="cell_voltage_78",e.cell_voltage_79="cell_voltage_79",e.cell_voltage_80="cell_voltage_80",e.cell_voltage_81="cell_voltage_81",e.cell_voltage_82="cell_voltage_82",e.cell_voltage_83="cell_voltage_83",e.cell_voltage_84="cell_voltage_84",e.cell_voltage_85="cell_voltage_85",e.cell_voltage_86="cell_voltage_86",e.cell_voltage_87="cell_voltage_87",e.cell_voltage_88="cell_voltage_88",e.cell_voltage_89="cell_voltage_89",e.cell_voltage_90="cell_voltage_90",e.cell_voltage_91="cell_voltage_91",e.cell_voltage_92="cell_voltage_92",e.cell_voltage_93="cell_voltage_93",e.cell_voltage_94="cell_voltage_94",e.cell_voltage_95="cell_voltage_95",e.cell_voltage_96="cell_voltage_96",e.cell_resistance_1="cell_resistance_1",e.cell_resistance_2="cell_resistance_2",e.cell_resistance_3="cell_resistance_3",e.cell_resistance_4="cell_resistance_4",e.cell_resistance_5="cell_resistance_5",e.cell_resistance_6="cell_resistance_6",e.cell_resistance_7="cell_resistance_7",e.cell_resistance_8="cell_resistance_8",e.cell_resistance_9="cell_resistance_9",e.cell_resistance_10="cell_resistance_10",e.cell_resistance_11="cell_resistance_11",e.cell_resistance_12="cell_resistance_12",e.cell_resistance_13="cell_resistance_13",e.cell_resistance_14="cell_resistance_14",e.cell_resistance_15="cell_resistance_15",e.cell_resistance_16="cell_resistance_16",e.cell_resistance_17="cell_resistance_17",e.cell_resistance_18="cell_resistance_18",e.cell_resistance_19="cell_resistance_19",e.cell_resistance_20="cell_resistance_20",e.cell_resistance_21="cell_resistance_21",e.cell_resistance_22="cell_resistance_22",e.cell_resistance_23="cell_resistance_23",e.cell_resistance_24="cell_resistance_24",e.cell_resistance_25="cell_resistance_25",e.cell_resistance_26="cell_resistance_26",e.cell_resistance_27="cell_resistance_27",e.cell_resistance_28="cell_resistance_28",e.cell_resistance_29="cell_resistance_29",e.cell_resistance_30="cell_resistance_30",e.cell_resistance_31="cell_resistance_31",e.cell_resistance_32="cell_resistance_32",e.cell_resistance_33="cell_resistance_33",e.cell_resistance_34="cell_resistance_34",e.cell_resistance_35="cell_resistance_35",e.cell_resistance_36="cell_resistance_36",e.cell_resistance_37="cell_resistance_37",e.cell_resistance_38="cell_resistance_38",e.cell_resistance_39="cell_resistance_39",e.cell_resistance_40="cell_resistance_40",e.cell_resistance_41="cell_resistance_41",e.cell_resistance_42="cell_resistance_42",e.cell_resistance_43="cell_resistance_43",e.cell_resistance_44="cell_resistance_44",e.cell_resistance_45="cell_resistance_45",e.cell_resistance_46="cell_resistance_46",e.cell_resistance_47="cell_resistance_47",e.cell_resistance_48="cell_resistance_48",e.cell_resistance_49="cell_resistance_49",e.cell_resistance_50="cell_resistance_50",e.cell_resistance_51="cell_resistance_51",e.cell_resistance_52="cell_resistance_52",e.cell_resistance_53="cell_resistance_53",e.cell_resistance_54="cell_resistance_54",e.cell_resistance_55="cell_resistance_55",e.cell_resistance_56="cell_resistance_56",e.cell_resistance_57="cell_resistance_57",e.cell_resistance_58="cell_resistance_58",e.cell_resistance_59="cell_resistance_59",e.cell_resistance_60="cell_resistance_60",e.cell_resistance_61="cell_resistance_61",e.cell_resistance_62="cell_resistance_62",e.cell_resistance_63="cell_resistance_63",e.cell_resistance_64="cell_resistance_64",e.cell_resistance_65="cell_resistance_65",e.cell_resistance_66="cell_resistance_66",e.cell_resistance_67="cell_resistance_67",e.cell_resistance_68="cell_resistance_68",e.cell_resistance_69="cell_resistance_69",e.cell_resistance_70="cell_resistance_70",e.cell_resistance_71="cell_resistance_71",e.cell_resistance_72="cell_resistance_72",e.cell_resistance_73="cell_resistance_73",e.cell_resistance_74="cell_resistance_74",e.cell_resistance_75="cell_resistance_75",e.cell_resistance_76="cell_resistance_76",e.cell_resistance_77="cell_resistance_77",e.cell_resistance_78="cell_resistance_78",e.cell_resistance_79="cell_resistance_79",e.cell_resistance_80="cell_resistance_80",e.cell_resistance_81="cell_resistance_81",e.cell_resistance_82="cell_resistance_82",e.cell_resistance_83="cell_resistance_83",e.cell_resistance_84="cell_resistance_84",e.cell_resistance_85="cell_resistance_85",e.cell_resistance_86="cell_resistance_86",e.cell_resistance_87="cell_resistance_87",e.cell_resistance_88="cell_resistance_88",e.cell_resistance_89="cell_resistance_89",e.cell_resistance_90="cell_resistance_90",e.cell_resistance_91="cell_resistance_91",e.cell_resistance_92="cell_resistance_92",e.cell_resistance_93="cell_resistance_93",e.cell_resistance_94="cell_resistance_94",e.cell_resistance_95="cell_resistance_95",e.cell_resistance_96="cell_resistance_96",e.temperature_sensor_1="temperature_sensor_1",e.temperature_sensor_2="temperature_sensor_2",e.temperature_sensor_3="temperature_sensor_3",e.temperature_sensor_4="temperature_sensor_4"}(me||(me={}));var ue={title:"JK BMS Card",description:"A customizable Home Assistant card to emulate the JK BMS screen",version:"Version"},ve={language:"Language",title:"Title",prefix:"Prefix of the sensors",batteryName:"Battery name",cellCount:"Number of cells",cellColumns:"Number of columns",cellLayout:"Cell Layout",layout:"Layout",deltaVoltageUnit:"Delta Voltage Unit",resistanceUnit:"Resistance Unit",cellColorMode:"Cell Color Mode",cellOrientation:"Cell Orientation",minCellVoltage:"Min Cell Voltage (V)",maxCellVoltage:"Max Cell Voltage (V)",manualAssignment:"Manual entity assignment",tempSensorsCount:"No. of temp. sensors available",hasHeater:"Heater option is used",socDecimals:"SoC Decimals",customDecimals:"Custom Decimals",titleShowHide:"Show / Hide zones",showTitle:"Title",showButtons:"Buttons",showMain:"Main",showCondensed:"Condensed",showMainStats:"Stats",showCells:"Cells",showResistances:"Cell R.",showCardVersion:"Version"},fe={charge:"Charge",discharge:"Discharge",balance:"Balance",heater:"Heater"},be={power:"Power:",capacity:"Capacity:",cycleCapacity:"Cycle Cap:",averageCellV:"Avg Cell V:",balanceCurrent:"Balance Cur:",stateOfCharge:"SOC:",remainingAmps:"Remaining:",cycles:"Cycles:",delta:"Delta Voltage:",mosfetTemp:"MOS Temp:",minCellV:"Min Cell V:",maxCellV:"Max Cell V:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},ye={capacity:"Capacity",time:"Time","grid-solar":"Grid/Solar",load:"Load","total-voltage":"Total Voltage",current:"Current",mosfetTemp:"MOS Temp",delta:"Delta",temperature_sensor:"Temp",balancing:"Balancing",volt:"V",charge:"Charge",discharge:"Discharge",remaining:"Remaining"},we={common:ue,config:ve,switches:fe,stats:be,html_texts:ye},Ce={title:"Карта JK BMS",description:"Налаштовувана картка Home Assistant для емуляції екрану JK BMS",version:"Версія"},xe={language:"Мова",title:"Заголовок",prefix:"Префікс сенсорів",batteryName:"Назва батареї",cellCount:"Кількість комірок",cellColumns:"Кількість стовпців",cellLayout:"Розташування комірок",layout:"Макет",deltaVoltageUnit:"Одиниця дельта напруги",resistanceUnit:"Одиниця вимірювання опору",cellColorMode:"Режим кольору комірок",cellOrientation:"Орієнтація комірок",minCellVoltage:"Мін. напруга комірки (В)",maxCellVoltage:"Макс. напруга комірки (В)",manualAssignment:"Ручне призначення сутності",tempSensorsCount:"Кількість доступних датчиків температури",hasHeater:"Використовується опція підігріву",socDecimals:"знаки від коми",customDecimals:"Власні десяткові дроби",titleShowHide:"Показати / Сховати зони",showTitle:"Заголовок",showButtons:"Кнопки",showMain:"Панель",showCondensed:"Компактно",showMainStats:"Стат.",showCells:"Елементи",showResistances:"Опір ел",showCardVersion:"Версія"},Se={charge:"Заряд",discharge:"Розряд",balance:"Баланс",heater:"Підігрів"},ke={power:"Потужн.:",capacity:"Ємн.:",cycleCapacity:"Цикл. ємн.:",averageCellV:"Сер V ком.:",balanceCurrent:"Бал. струм:",stateOfCharge:"SOC:",remainingAmps:"Залишок:",cycles:"Цикли:",delta:"Δ напруга:",mosfetTemp:"Темп MOS:",minCellV:"Мін V ком.:",maxCellV:"Макс V ком.:",temperature_sensor_1:"Темп. 1:",temperature_sensor_2:"Темп. 2:",temperature_sensor_3:"Темп. 3:",temperature_sensor_4:"Темп. 4:"},Ae={capacity:"Ємність",time:"Час","grid-solar":"Мережа/Сонячна",load:"Навантаження","total-voltage":"Загальна напруга",current:"Струм",mosfetTemp:"Темп. MOS",delta:"Дельта",temperature_sensor:"Темп",balancing:"Балансування",volt:"В",charge:"Заряд",discharge:"Розряд",remaining:"Залишок"},Me={common:Ce,config:xe,switches:Se,stats:ke,html_texts:Ae},$e={title:"Card JK BMS",description:"Un card Home Assistant personalizabil care imită ecranul JK BMS",version:"Versiune"},Ve={language:"Limba",title:"Titlu",prefix:"Prefixul senzorilor",batteryName:"Numele bateriei",cellCount:"Număr de celule",cellColumns:"Număr de coloane",cellLayout:"Aranjament celule",layout:"Aranjament general",deltaVoltageUnit:"UM pentru diferență tensiune",resistanceUnit:"UM pentru rezistență",cellColorMode:"Mod colorare celule",cellOrientation:"Orientare celule",minCellVoltage:"Tensiune minimă celulă (V)",maxCellVoltage:"Tensiune maximă celulă (V)",manualAssignment:"Atribuire manuală entități",tempSensorsCount:"Număr senzori temperatură",hasHeater:"Opțiunea încălzitor este utilizată",socDecimals:"Zecimale SoC",customDecimals:"Zecimale alte controale",titleShowHide:"Afișează / Ascunde zone",showTitle:"Titlul",showButtons:"Butoane",showMain:"Principală",showCondensed:"Compact",showMainStats:"Stat.",showCells:"Celule",showResistances:"Rezist.",showCardVersion:"Versiune"},Te={charge:"Încărcare",discharge:"Descărcare",balance:"Echilibrare",heater:"Încălzitor"},Ee={power:"Putere:",capacity:"Capac.:",cycleCapacity:"Cap. Ciclu:",averageCellV:"V Cel. Med:",balanceCurrent:"Cur. Bal:",stateOfCharge:"SOC:",remainingAmps:"Rămas:",cycles:"Cicluri:",delta:"Δ Tensiune:",mosfetTemp:"Temp MOS:",minCellV:"Min V Cel.:",maxCellV:"Max V Cel.:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},Oe={capacity:"Capacitate",time:"Timp","grid-solar":"Rețea/Solar",load:"Consum","total-voltage":"Tensiune totală",current:"Curent",mosfetTemp:"Temp. MOSFET",delta:"Diferență",temperature_sensor:"Temp",balancing:"Echilibrare",volt:"V",charge:"Încărcare",discharge:"Descărcare",remaining:"Rămas"},ze={common:$e,config:Ve,switches:Te,stats:Ee,html_texts:Oe},De={title:"JK BMS Karte",description:"Eine anpassbare Home Assistant Karte, die den JK BMS Bildschirm nachbildet",version:"Version"},Ne={language:"Sprache",title:"Titel",prefix:"Präfix der Sensoren",batteryName:"Batteriename",cellCount:"Anzahl der Zellen",cellColumns:"Anzahl der Spalten",cellLayout:"Zellen-Layout",layout:"Layout",deltaVoltageUnit:"Einheit der Spannungsdifferenz",resistanceUnit:"Einheit des elektrischen Widerstands",cellColorMode:"Zellen-Farbmodus",cellOrientation:"Zellen-Ausrichtung",minCellVoltage:"Min. Zellspannung (V)",maxCellVoltage:"Max. Zellspannung (V)",manualAssignment:"Manuelle Entitäten-Zuweisung",tempSensorsCount:"Anzahl verfügbarer Temperatursensoren",hasHeater:"Heizungs-Option wird verwendet",socDecimals:"SOC Dezimalstellen",customDecimals:"Benutzerdefinierte Dezimalzahlen",titleShowHide:"Zonen ein-/ausblenden",showTitle:"Titel",showButtons:"Schaltfl.",showMain:"Hauptteil",showCondensed:"Kompakt",showMainStats:"Stats",showCells:"Zellen",showResistances:"Zellen R.",showCardVersion:"Kartenvers."},Ue={charge:"Laden",discharge:"Entladen",balance:"Balancing",heater:"Heizung"},Re={power:"Leistung:",capacity:"Kapaz.:",cycleCapacity:"Zykl. Kap.:",averageCellV:"Ø Zell V:",balanceCurrent:"Bal. Strom:",stateOfCharge:"SOC:",remainingAmps:"Rest:",cycles:"Zyklen:",delta:"Δ Spannung:",mosfetTemp:"MOS Temp:",minCellV:"Min Zell V:",maxCellV:"Max Zell V:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},Be={capacity:"Kapazität",time:"Zeit","grid-solar":"Netz/Solar",load:"Last","total-voltage":"Gesamtspannung",current:"Stromstärke",mosfetTemp:"MOS Temp",delta:"Differenz",temperature_sensor:"Temp",balancing:"Balancing",volt:"V",charge:"Laden",discharge:"Entladen",remaining:"Restzeit"},Pe={common:De,config:Ne,switches:Ue,stats:Re,html_texts:Be},je={title:"Карта JK BMS",description:"Настраиваемая карточка Home Assistant для эмуляции экрана JK BMS",version:"Версия"},Le={language:"Язык",title:"Заголовок",prefix:"Префикс датчиков",batteryName:"Название батареи",cellCount:"Количество ячеек",cellColumns:"Количество столбцов",cellLayout:"Расположение ячеек",layout:"Макет",deltaVoltageUnit:"Единица дельта-напряжения",resistanceUnit:"Единица измерения сопротивления",cellColorMode:"Режим цвета ячеек",cellOrientation:"Ориентация ячеек",minCellVoltage:"Мин. напряжение ячейки (В)",maxCellVoltage:"Макс. напряжение ячейки (В)",manualAssignment:"Ручное назначение сущностей",tempSensorsCount:"Количество доступных датчиков температуры",hasHeater:"Используется подогрев",socDecimals:"Знаков после запятой",customDecimals:"Пользовательские десятичные",titleShowHide:"Показать / Скрыть зоны",showTitle:"Заголовок",showButtons:"Кнопки",showMain:"Панель",showCondensed:"Компактно",showMainStats:"Стат.",showCells:"Ячейки",showResistances:"Сопр. яч.",showCardVersion:"Версия"},He={charge:"Заряд",discharge:"Разряд",balance:"Балансировка",heater:"Подогрев"},Ie={power:"Мощн.:",capacity:"Ёмк.:",cycleCapacity:"Цикл. ёмк.:",averageCellV:"Ср V яч.:",balanceCurrent:"Бал. ток:",stateOfCharge:"SOC:",remainingAmps:"Остаток:",cycles:"Циклы:",delta:"Δ напр.:",mosfetTemp:"Темп MOS:",minCellV:"Мин V яч.:",maxCellV:"Макс V яч.:",temperature_sensor_1:"Темп. 1:",temperature_sensor_2:"Темп. 2:",temperature_sensor_3:"Темп. 3:",temperature_sensor_4:"Темп. 4:"},Fe={capacity:"Ёмкость",time:"Время","grid-solar":"Сеть/Солнце",load:"Нагрузка","total-voltage":"Общее напряжение",current:"Ток",mosfetTemp:"Темп. MOS",delta:"Дельта",temperature_sensor:"Темп",balancing:"Балансировка",volt:"В",charge:"Заряд",discharge:"Разряд",remaining:"Остаток"},Ke={common:je,config:Le,switches:He,stats:Ie,html_texts:Fe},Je={title:"JK 电池管理系统",description:"用于显示 JK-BMS 实时状态 de 自定义卡片",version:"版本"},qe={language:"语言",title:"标题",prefix:"实体前缀",batteryName:"电池名称",cellCount:"电芯数量",cellColumns:"每行电芯数",cellLayout:"电芯布局方式",layout:"布局",deltaVoltageUnit:"电压差单位",resistanceUnit:"电阻单位",cellColorMode:"电池颜色模式",cellOrientation:"电池方向",minCellVoltage:"最小电池电压 (V)",maxCellVoltage:"最大电池电压 (V)",manualAssignment:"手动分配实体",tempSensorsCount:"温度传感器数量",hasHeater:"是否有加热器",socDecimals:"SOC 小数位数",customDecimals:"自定义小数位",titleShowHide:"显示 / 隐藏区域",showTitle:"标题",showButtons:"按钮",showMain:"主面板",showCondensed:"紧凑",showMainStats:"统计",showCells:"电池",showResistances:"电池 R.",showCardVersion:"版本"},We={charge:"充电",discharge:"放电",balance:"均衡",heater:"加热"},Ze={power:"功率:",capacity:"容量:",cycleCapacity:"循环:",averageCellV:"平均V:",balanceCurrent:"均衡:",stateOfCharge:"SOC:",remainingAmps:"剩余:",cycles:"循环数:",delta:"ΔV:",mosfetTemp:"MOS温:",minCellV:"最低V:",maxCellV:"最高V:",temperature_sensor_1:"温度1:",temperature_sensor_2:"温度2:",temperature_sensor_3:"温度3:",temperature_sensor_4:"温度4:"},Ge={capacity:"总容量设定",time:"运行时长","grid-solar":"电网/太阳能",load:"负载","total-voltage":"总电压",current:"实时电流",mosfetTemp:"功率管温度",delta:"单体电池压差",temperature_sensor:"温度传感器",balancing:"均衡状态",volt:"V",charge:"充电状态",discharge:"放电状态",remaining:"剩余容量"},Ye={common:Je,config:qe,switches:We,stats:Ze,html_texts:Ge},Qe={title:"JK BMS Karta",description:"Konfigurowalna karta Home Assistant do emulacji ekranu JK BMS",version:"Wersja"},Xe={language:"Język",title:"Tytuł",prefix:"Prefiks sensorów",batteryName:"Nazwa baterii",cellCount:"Liczba ogniw",cellColumns:"Liczba kolumn",cellLayout:"Układ ogniw",layout:"Układ",deltaVoltageUnit:"Jednostka różnicy napięcia",resistanceUnit:"Jednostka miary rezystancji",cellColorMode:"Tryb koloru ogniw",cellOrientation:"Orientacja ogniw",minCellVoltage:"Minimalne napięcie ogniwa (V)",maxCellVoltage:"Maksymalne napięcie ogniwa (V)",manualAssignment:"Ręczne przypisanie encji",tempSensorsCount:"Liczba dostępnych czujników temperatury",hasHeater:"Opcja grzałki włączona",socDecimals:"Miejsca po przecinku SOC",customDecimals:"Własne miejsca po przecinku",titleShowHide:"Pokaż / Ukryj strefy",showTitle:"Tytuł",showButtons:"Przyciski",showMain:"Panel",showCondensed:"Zwarte",showMainStats:"Stat.",showCells:"Ogniwa",showResistances:"R. ogniwa",showCardVersion:"Wersja"},et={charge:"Ładowanie",discharge:"Rozładowanie",balance:"Balansowanie",heater:"Grzałka"},tt={power:"Moc:",capacity:"Pojem.:",cycleCapacity:"Poj. Cykl:",averageCellV:"Śr V Ogniwa:",balanceCurrent:"Prąd Bal:",stateOfCharge:"SOC:",remainingAmps:"Pozostało:",cycles:"Cykle:",delta:"Δ Napięcie:",mosfetTemp:"Temp MOS:",minCellV:"Min V Ogniwa:",maxCellV:"Max V Ogniwa:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},nt={capacity:"Pojemność",time:"Czas","grid-solar":"Sieć/Solar",load:"Obciążenie","total-voltage":"Całkowite napięcie",current:"Prąd",mosfetTemp:"Temp. MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Balansowanie",volt:"V",charge:"Ładowanie",discharge:"Rozładowanie",remaining:"Pozostałe"},at={common:Qe,config:Xe,switches:et,stats:tt,html_texts:nt},lt={title:"Tarjeta JK BMS",description:"Una tarjeta personalizable de Home Assistant para emular la pantalla JK BMS",version:"Versión"},st={language:"Idioma",title:"Título",prefix:"Prefijo de los sensores",batteryName:"Nombre de la batería",cellCount:"Número de celdas",cellColumns:"Número de columnas",cellLayout:"Diseño de celdas",layout:"Diseño",deltaVoltageUnit:"Unidad de medida de voltaje delta",resistanceUnit:"Unidad de medida de la resistencia",cellColorMode:"Modo de color de celdas",cellOrientation:"Orientación de celdas",minCellVoltage:"Voltaje mínimo de celda (V)",maxCellVoltage:"Voltaje máximo de celda (V)",manualAssignment:"Asignación manual de entidades",tempSensorsCount:"Número de sensores de temperatura disponibles",hasHeater:"Opción de calefactor activada",socDecimals:"Decimales de SOC",customDecimals:"Decimales personalizados",titleShowHide:"Mostrar / Ocultar zonas",showTitle:"Título",showButtons:"Botones",showMain:"Principal",showCondensed:"Condensado",showMainStats:"Stats",showCells:"Celdas",showResistances:"R. celda",showCardVersion:"Versión"},it={charge:"Cargar",discharge:"Descargar",balance:"Balancear",heater:"Calefactor"},ot={power:"Potencia:",capacity:"Capac.:",cycleCapacity:"Cap. Ciclo:",averageCellV:"V Celda Prom:",balanceCurrent:"Bal. Corr:",stateOfCharge:"SOC:",remainingAmps:"Restante:",cycles:"Ciclos:",delta:"Δ Voltaje:",mosfetTemp:"Temp MOS:",minCellV:"Min V Celda:",maxCellV:"Max V Celda:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},rt={capacity:"Capacidad",time:"Tiempo","grid-solar":"Red/Solar",load:"Carga","total-voltage":"Voltaje total",current:"Corriente",mosfetTemp:"Temp MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Balanceo",volt:"V",charge:"Cargar",discharge:"Descargar",remaining:"Restante"},ct={common:lt,config:st,switches:it,stats:ot,html_texts:rt},_t={title:"Carte JK BMS",description:"Une carte Home Assistant personnalisable pour émuler l'écran JK BMS",version:"Version"},ht={language:"Langue",title:"Titre",prefix:"Préfixe des capteurs",batteryName:"Nom de la batterie",cellCount:"Nombre de cellules",cellColumns:"Nombre de colonnes",cellLayout:"Disposition des cellules",layout:"Disposition",deltaVoltageUnit:"Unité de mesure de tension delta",resistanceUnit:"Unité de mesure de la résistance",cellColorMode:"Mode couleur des cellules",cellOrientation:"Orientation des cellules",minCellVoltage:"Tension minimale de la cellule (V)",maxCellVoltage:"Tension maximale de la cellule (V)",manualAssignment:"Attribution manuelle des entités",tempSensorsCount:"Nombre de capteurs de température disponibles",hasHeater:"Option chauffage activée",socDecimals:"Décimales SOC",customDecimals:"Décimales personnalisées",titleShowHide:"Afficher / Masquer les zones",showTitle:"Titre",showButtons:"Boutons",showMain:"Principal",showCondensed:"Condensé",showMainStats:"Stats",showCells:"Cellules",showResistances:"R. cellule",showCardVersion:"Version"},dt={charge:"Charge",discharge:"Décharge",balance:"Équilibrage",heater:"Chauffage"},gt={power:"Puiss.:",capacity:"Capac.:",cycleCapacity:"Cap. Cycle:",averageCellV:"V Cell Moy:",balanceCurrent:"Cour. Bal:",stateOfCharge:"SOC:",remainingAmps:"Restant:",cycles:"Cycles:",delta:"Δ Tension:",mosfetTemp:"Temp MOS:",minCellV:"Min V Cell:",maxCellV:"Max V Cell:",temperature_sensor_1:"Temp. 1:",temperature_sensor_2:"Temp. 2:",temperature_sensor_3:"Temp. 3:",temperature_sensor_4:"Temp. 4:"},pt={capacity:"Capacité",time:"Temps","grid-solar":"Réseau/Solaire",load:"Charge","total-voltage":"Tension totale",current:"Courant",mosfetTemp:"Temp MOSFET",delta:"Delta",temperature_sensor:"Temp",balancing:"Équilibrage",volt:"V",charge:"Charge",discharge:"Décharge",remaining:"Restant"},mt={common:_t,config:ht,switches:dt,stats:gt,html_texts:pt};const ut={hass:null},vt={en:Object.freeze({__proto__:null,common:ue,config:ve,default:we,html_texts:ye,stats:be,switches:fe}),uk:Object.freeze({__proto__:null,common:Ce,config:xe,default:Me,html_texts:Ae,stats:ke,switches:Se}),ro:Object.freeze({__proto__:null,common:$e,config:Ve,default:ze,html_texts:Oe,stats:Ee,switches:Te}),de:Object.freeze({__proto__:null,common:De,config:Ne,default:Pe,html_texts:Be,stats:Re,switches:Ue}),ru:Object.freeze({__proto__:null,common:je,config:Le,default:Ke,html_texts:Fe,stats:Ie,switches:He}),zh:Object.freeze({__proto__:null,common:Je,config:qe,default:Ye,html_texts:Ge,stats:Ze,switches:We}),pl:Object.freeze({__proto__:null,common:Qe,config:Xe,default:at,html_texts:nt,stats:tt,switches:et}),es:Object.freeze({__proto__:null,common:lt,config:st,default:ct,html_texts:rt,stats:ot,switches:it}),fr:Object.freeze({__proto__:null,common:_t,config:ht,default:mt,html_texts:pt,stats:gt,switches:dt})};function ft(e,t="",n=""){try{let a=ut.cardConfig?.language,l=localStorage.getItem("selectedLanguage");null===l&&(l=localStorage.getItem("assist_debug_language")),null===l&&(l=localStorage.getItem("editor-language")),null===l&&(l="en"),l=l.replace(/['"]+/g,"").replace("-","_");const s=ut.hass?.selectedLanguage||ut.hass?.locale?.language||ut.hass?.language,i=a&&"auto"!==a?a:s||l;let o;try{o=e?.split(".").reduce(((e,t)=>e[t]),vt[i])}catch(t){o=e?.split(".")?.reduce(((e,t)=>e[t]),vt.en)}return void 0===o&&(o=e?.split(".")?.reduce(((e,t)=>e[t]),vt.en)),""!==t&&""!==n&&(o=o.replace(t,n)),o}catch(t){return e}}var bt="1.2.20";function yt(e,t,n,a){a=a||{},n=null==n?{}:n;const l=new Event(t,{bubbles:void 0===a.bubbles||a.bubbles,cancelable:Boolean(a.cancelable),composed:void 0===a.composed||a.composed});return l.detail=n,e.dispatchEvent(l),l}const wt=(e,t)=>{const n=e?.entities[t]?.toString()?.trim();return n&&n.length>1?n:t?.toString()},Ct=(e,t,n,a="sensor")=>{if(!e)return;e.stopPropagation();const l=wt(t,n),s=l.includes("sensor.")||l.includes("switch.")||l.includes("number.")||l.includes("binary_sensor.")?l:a+"."+t?.prefix+"_"+l;let i=new CustomEvent("hass-more-info",{detail:{entityId:s},composed:!0});e.target.dispatchEvent(i)},xt=(e,t,n,a="sensor")=>{const l=wt(t,n);if(!l)return null;const s=l.includes(".")?l:"".concat(a,".").concat(t.prefix,"_").concat(l);return e?.states[s]??null},St=(e,t,n,a=2,l="",s="sensor")=>{const i=xt(e,t,n,s);if(!i)return l;const o=i.state,r=Number(o);return isNaN(r)?o??l:r.toFixed(a)},kt=(e,t,n,a="sensor")=>{const l=xt(e,t,n,a);return l?.attributes?.unit_of_measurement??""},At=e=>{if(!e)return null;switch(e.trim().toLowerCase()){case"v":return"V";case"mv":return"mV";case"ω":case"ohm":case"ohms":return"Ω";case"mω":case"mohm":case"mohms":return"mΩ";default:return null}},Mt={V:{toBase:1},mV:{toBase:.001},"Ω":{toBase:1},"mΩ":{toBase:.001}},$t=(e,t,n)=>{const a="string"==typeof n?parseFloat(n):n;if(isNaN(a))return"-";const l=At(e),s=At(t);if(!l||!s)return"".concat(a," ").concat(t??"").trim();const i=a*Mt[l].toBase/Mt[s].toBase,o=s.startsWith("m")?0:3,r=i.toLocaleString("en-US",{minimumFractionDigits:o,maximumFractionDigits:o});return"".concat(r," ").concat(s)};var Vt,Tt,Et,Ot,zt,Dt,Nt,Ut,Rt,Bt,Pt,jt,Lt,Ht,It,Ft,Kt,Jt,qt,Wt,Zt,Gt,Yt,Qt,Xt;let en=class extends oe{constructor(){super(...arguments),this.minCellId="",this.maxCellId="",this.deltaV=0,this.shouldBalance=!1,this.VERSION=bt}_navigate(e,t,n="sensor"){Ct(e,this.config,t,n)}getState(e,t=2,n="",a="sensor"){return St(this.hass,this.config,e,t,n,a)}getUnit(e){return kt(this.hass,this.config,e)}_renderSwitch(t,n){const a=this.getState(t,0,"","switch"),l="on"===a?"status-on":"status-off";return I(Vt||(Vt=e(['\n <div class="button-border button-padding center clickable" @click=',">\n ",': <span class="','">',"</span>\n </div>\n "])),(e=>this._navigate(e,t,"switch")),ft("switches."+n),l,a.toUpperCase())}configOrEnum(e){return wt(this.config,e)}render(){if(ut.hass=this.hass,!this.hass||!this.config)return I(Tt||(Tt=e([""])));const t=this.getState(me.hardware_version),n=this.getState(me.software_version),a=this.getState(me.total_runtime_formatted),l=a&&"unknown"!=a?I(Et||(Et=e(["",': <b><font color="#3090C7">',"</font></b>"])),ft("html_texts.time"),a.toUpperCase()):"",s=this.config.batteryName||"",i=this.config.title&&this.config.title.toLocaleLowerCase()!=ft("config.title").toLocaleLowerCase()?this.config.title:I(Ot||(Ot=e(["","",": <b> "," Ah</b></br>\n HW: <b>","</b> | SW: <b>","</b> | ",""])),""===s?"":s+" | ",ft("html_texts.capacity"),this.getState(me.total_battery_capacity_setting),t,n,l);this.deltaV=parseFloat(this.getState(me.delta_cell_voltage,3,"0"));const o=parseFloat(this.getState(me.balancing_current,2,"0")),r=parseFloat(this.getState(me.power,2,"0"));this.shouldBalance=0!=o;const c=r>0?"power-positive":r<0?"power-negative":"power-even",_=o>0?"balance-positive":o<0?"balance-negative":"balance-even",h=this.shouldBalance?"delta-needs-balancing":"delta-ok",d=this.config.socDecimals??0,g=this.config.customDecimals??0,p=this.config.showTitle,m=this.config.showButtons,u=this.config.showMain,v=this.config.showCondensed,f=this.config.showCells,b=this.config.showResistances,y=this.config.showCardVersion,w=v?"stats data-row":"stats data-row split";this.minCellId=this.getState(me.min_voltage_cell,0),this.maxCellId=this.getState(me.max_voltage_cell,0);const C=e=>{if(null==e||""===e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>=0},x=C(this.minCellId)&&C(this.maxCellId),S=(e=>{if(null==e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>0})(this.deltaV);return x&&S||this.calculateDynamicMinMaxCellId(this.config?.cellCount??16),I(zt||(zt=e(['\n <ha-card>\n <div class="grid grid-1 p-3 section-padding">\n <div class="center clickable" @click=',">\n ","\n </div>\n </div>\n\n ","\n \n ","\n \n ","\n \n ","\n ","\n \n </ha-card>\n "])),(e=>this._navigate(e,me.total_runtime_formatted)),p?i:"",m?I(Dt||(Dt=e(['\n <div class="grid grid-','">\n ',"\n ","\n ","\n ","\n </div> \n "])),"1"==this.config.hasHeater?"4":"3",this._renderSwitch(me.charging,"charge"),this._renderSwitch(me.discharging,"discharge"),this._renderSwitch(me.balancer,"balance"),"1"==this.config.hasHeater?this._renderSwitch(me.heater,"heater"):""):I(Nt||(Nt=e([""]))),this._renderError(),u?I(Ut||(Ut=e(['\n <div class="grid grid-2 section-padding">\n <div class="stats-padding stats-border">\n <div class="clickable center" @click=','>\n <b><font color="#41CD52" size="6">'," ",'</font></b>\n </div>\n <div class="','">',' <span class="label clickable ','" @click=',">",' W</span></div>\n <div class="','">',' <span class="label clickable" @click=',">",' Ah</span></div>\n <div class="','">',' <span class="label clickable" @click=',">",' Ah</span></div>\n <div class="','">',' <span class="label clickable" @click=',">"," ","</span></div>\n ",'\n <div class="','">',' <span class="label ','">'," A</span></div>\n ",'\n </div>\n\n <div class="stats-padding stats-border">\n <div class="clickable center" @click=','>\n <b><font color="#41CD52" size="6">',' A</font></b>\n </div>\n <div class="','">',' <span class="label clickable" @click=',">",' %</span></div>\n <div class="','">',' <span class="label clickable" @click=',">",' Ah</span></div>\n <div class="','">',' <span class="label clickable" @click=',">",'</span></div>\n <div class="','">',' <span class="label ','" @click=',"> "," </span></div>\n ",'\n <div class="','">',' <span class="label clickable" @click=',">"," ","</span></div>\n ","\n </div>\n </div>\n \n "," \n "])),(e=>this._navigate(e,me.total_voltage)),this.getState(me.total_voltage),ft("html_texts.volt"),w,ft("stats.power"),c,(e=>this._navigate(e,me.power)),this.getState(me.power,g),w,ft("stats.capacity"),(e=>this._navigate(e,me.total_battery_capacity_setting)),this.getState(me.total_battery_capacity_setting,g),w,ft("stats.cycleCapacity"),(e=>this._navigate(e,me.total_charging_cycle_capacity)),this.getState(me.total_charging_cycle_capacity,g),w,ft("stats.averageCellV"),(e=>this._navigate(e,me.average_cell_voltage)),this.getState(me.average_cell_voltage,3),ft("html_texts.volt"),me.min_cell_voltage&&""!=this.getState(me.min_cell_voltage)?I(Rt||(Rt=e(['<div class="','">',' <span class="label clickable" @click=',">"," ","</span></div>"])),w,ft("stats.minCellV"),(e=>this._navigate(e,me.min_cell_voltage)),this.getState(me.min_cell_voltage,3),ft("html_texts.volt")):"",w,ft("stats.balanceCurrent"),_,o.toFixed(1),this._renderTemps(1),(e=>this._navigate(e,me.current)),this.getState(me.current),w,ft("stats.stateOfCharge"),(e=>this._navigate(e,me.state_of_charge)),this.getState(me.state_of_charge,d),w,ft("stats.remainingAmps"),(e=>this._navigate(e,me.capacity_remaining)),this.getState(me.capacity_remaining,g),w,ft("stats.cycles"),(e=>this._navigate(e,me.charging_cycles)),this.getState(me.charging_cycles,g),w,ft("stats.delta"),h,(e=>this._navigate(e,me.delta_cell_voltage)),$t(this.getUnit(me.delta_cell_voltage)??"V",this.config.deltaVoltageUnit??"V",this.deltaV),me.max_cell_voltage&&""!=this.getState(me.max_cell_voltage)?I(Bt||(Bt=e(['<div class="','">',' <span class="label clickable" @click=',">"," ","</span></div>"])),w,ft("stats.maxCellV"),(e=>this._navigate(e,me.max_cell_voltage)),this.getState(me.max_cell_voltage,3),ft("html_texts.volt")):"",w,ft("stats.mosfetTemp"),(e=>this._navigate(e,me.power_tube_temperature)),this.getState(me.power_tube_temperature),this.getUnit(me.power_tube_temperature),this._renderTemps(2),this.shouldBalance?I(Pt||(Pt=e(['\n <svg class="flow-line" id="flow-svg">\n <path id="flow-path" fill="none" />\n </svg>']))):""):I(jt||(jt=e([""]))),f?I(Lt||(Lt=e(['\n <div class="grid grid-','">\n ',"\n </div> \n "])),this.config.cellColumns??2,this._renderCells("bankMode"==this.config.cellLayout,b)):I(Ht||(Ht=e([""]))),y?I(It||(It=e(['\n <div class="cardVersion">\n <span class="version">\n v.',"\n </span>\n </div>\n "])),this.VERSION):I(Ft||(Ft=e([""]))))}updated(){requestAnimationFrame((()=>this._updateFlowLine()))}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._updateFlowLine.bind(this))}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._updateFlowLine.bind(this))}_renderError(){const t=this.getState(me.errors,0);return t.trim().length<=1||"0"==t?I(Kt||(Kt=e([""]))):I(Jt||(Jt=e(['<span class="error-message">',"</span>"])),t)}_renderTemps(t){const n=[],a=this.config?.tempSensorsCount??0,l=this.config.showCondensed?"data-row":"data-row split";for(let s=t;s<=a;s+=2)n.push(I(qt||(qt=e(['\n <div class="','">',' <span class="label clickable" @click=',">"," ","</span></div>"])),l,ft("stats.temperature_sensor_"+s),(e=>this._navigate(e,me["temperature_sensor_"+s])),this.getState(me["temperature_sensor_"+s]),this.getUnit(me["temperature_sensor_"+s])));return I(Wt||(Wt=e(["",""])),n)}_renderCells(t=!0,n){const a=[],l=this.config?.cellColumns??2,s=this.config?.cellCount??16,i=Math.floor(s/l),o=t?Math.ceil(s/l):s,r=s%l;for(let e=1;e<=o;e++)if(t&&r&&e==o?a.push(this._createCell(s,l,n)):a.push(this._createCell(e,l,n)),t&&(e<o||!r))for(let t=1;t<l;t++)a.push(this._createCell(e+i*t,l,n));return I(Zt||(Zt=e(["",""])),a)}calculateDynamicMinMaxCellId(e){let t=1/0,n=-1/0,a=0,l=0;for(let s=1;s<=e;s++){const e=this.getState(me["cell_voltage_".concat(s)],3,""),i=parseFloat(e);isNaN(i)||(i>n&&(n=i,l=s),i<t&&(t=i,a=s))}this.minCellId=String(a),this.maxCellId=String(l),this.deltaV=Number((n-t).toFixed(3))}_createCell(t,n,a){const l=this.getState(me["cell_voltage_".concat(t)],3,"0.0"),s=this.getUnit(me["cell_resistance_".concat(t)])??"Ω",i=this.config?.resistanceUnit??s,o=$t(s,i,this.getState(me["cell_resistance_".concat(t)],3)).replace(" ",""),r=this.minCellId,c=this.maxCellId,_=t.toString()===r?"voltage-low":t.toString()===c?"voltage-high":"",h=a&&"-"!==o,d=ft("html_texts.volt");let g=h?I(Gt||(Gt=e(['\n <span class="label clickable" @click=',">\n ","","\n </span>"])),(e=>this._navigate(e,me["cell_resistance_".concat(t)])),n<=3?I(Yt||(Yt=e([" / "]))):"",o):"";return I(Qt||(Qt=e(['\n <div class="center cell-container" id="cell-','">\n <div class="cell-div-','">\n <div class="clickable ','" @click=','>\n <span class="pill">','</span>\n <span class="label ','">',"","</span>\n ","\n </div>\n </div>\n </div>\n "])),t,t,n>4||n>3&&!0===h?"multi-line":"single-line",(e=>this._navigate(e,me["cell_voltage_".concat(t)])),t.toString().padStart(2,"0"),_,l,h?d:"",g)}_updateFlowLine(){const e=parseFloat(this.getState(me.balancing_current,3,"0")),t=this.renderRoot.querySelector(".cell-div-".concat(this.minCellId)),n=this.renderRoot.querySelector(".cell-div-".concat(this.maxCellId)),a=this.renderRoot.querySelector("#flow-path");if(!a||!t||!n)return;if(!this.shouldBalance&&0===e)return a.setAttribute("d",""),void(a.style.display="none");a.style.display="inline";const l=(this.renderRoot instanceof ShadowRoot?this.renderRoot.host:this).getBoundingClientRect(),s=t.getBoundingClientRect(),i=n.getBoundingClientRect(),o=this.config?.cellColumns??2,r=l.width/o,c=Math.floor((i.left+i.width/2-l.left)/r),_=Math.floor((s.left+s.width/2-l.left)/r),h=(e,t)=>({x:"right"===t?e.right-l.left:e.left-l.left,y:e.top+e.height/2-l.top});let d,g;if(Math.abs(i.top-s.top)<10)d=i.left<s.left?"right":"left",g=i.left<s.left?"left":"right";else if(c===_){d=g=c<o/2?"right":"left"}else{const e=c<_?"rightToLeft":"leftToRight";1===Math.abs(c-_)?0===c?(d="right",g=1===_?"right":"left"):c===o-1?(d="left",g=_===o-2?"left":"right"):(d="rightToLeft"===e?"right":"left",g="rightToLeft"===e?"left":"right"):(d="rightToLeft"===e?"right":"left",g="rightToLeft"===e?"left":"right")}const p=h(i,d),m=h(s,g);let u;if(d===g){const e="right"===d?Math.max(p.x,m.x)+14:Math.min(p.x,m.x)-14;u="M ".concat(p.x,",").concat(p.y," L ").concat(e,",").concat(p.y," L ").concat(e,",").concat(m.y," L ").concat(m.x,",").concat(m.y)}else{const e=(p.x+m.x)/2;u="M ".concat(p.x,",").concat(p.y," L ").concat(e,",").concat(p.y," L ").concat(e,",").concat(m.y," L ").concat(m.x,",").concat(m.y)}a.setAttribute("d",u)}};var tn,nn,an,ln,sn,on,rn,cn,_n,hn,dn,gn,pn,mn,un,vn,fn,bn,yn,wn,Cn,xn,Sn,kn,An,Mn,$n,Vn,Tn,En,On,zn;en.styles=o(Xt||(Xt=e(['\n .grid {\n display: grid;\n gap: 4px;\n margin: 4px;\n align-content: center;\n min-width: 300px;\n }\n\n .grid-1 {\n grid-template-columns: 1fr;\n }\n\n .grid-2 {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .grid-3 {\n grid-template-columns: repeat(3, 1fr);\n }\n\n .grid-4 {\n grid-template-columns: repeat(4, 1fr);\n }\n\n .grid-5 {\n grid-template-columns: repeat(5, 1fr);\n }\n\n .grid-6 {\n grid-template-columns: repeat(6, 1fr);\n }\n\n .grid-7 {\n grid-template-columns: repeat(7, 1fr);\n }\n\n .grid-8 {\n grid-template-columns: repeat(8, 1fr);\n }\n\n .center {\n text-align: center !important;\n align-content: center !important;\n }\n\n .cell-container {\n display: flex;\n flex-direction: row;\n container-type: inline-size;\n align-items: center;\n justify-content:center;\n container-type: inline-size;\n }\n\n div[class^="cell-div-"] {\n width: auto;\n padding-left: 5px;\n padding-right: 5px;\n }\n\n .multi-line {\n display: flex !important;\n flex-direction: column !important; \n align-items: center; \n justify-content: center;\n padding: 5px 0px;\n gap: 2px; \n }\n\n .single-line {\n display: flex !important;\n flex-direction: row !important;\n align-items: center;\n gap: 5px;\n }\n\n .multi-line, .single-line {\n width: 100%; \n height: 100%;\n align-items: center;\n justify-content: center;\n }\n\n .label {\n font-size: clamp(0.68rem, round(20cqi + 0.2rem, 0.1rem), 1rem) !important;\n white-space: nowrap;\n }\n \n .label.stats {\n font-size: clamp(0.48rem, round(14cqi + 0.2rem, 0.1rem), 1rem) !important;\n width: 100%;\n }\n \n .label.res {\n font-size: clamp(0.64rem, round(14cqi + 0.2rem, 0.1rem), 0.8rem) !important;\n }\n\n .clickable {\n cursor: pointer;\n }\n\n .section-padding {\n padding-top: 0.45rem;\n padding-bottom: 0.75rem;\n }\n\n .stats-padding {\n padding-top: 0.75rem;\n padding-left: 0.75rem;\n }\n \n .data-row {\n display: flex;\n justify-content: flex-start;\n gap: 4px;\n }\n\n .data-row.split {\n justify-content: space-between;\n margin-right: 4px;\n white-space: nowrap;\n }\n\n .power-negative {\n color: red\n }\n\n .power-positive {\n color: #41cd52\n }\n\n .power-even {\n color: #808080\n }\n\n .balance-positive {\n color: red\n }\n\n .balance-negative {\n color: #3090C7\n }\n\n .balance-even {\n color: #808080\n }\n\n .delta-needs-balancing {\n color: #FFA500\n }\n\n .delta-ok {\n color: #41CD52\n }\n\n .stats-border {\n border-width: var(--ha-card-border-width, 1px);\n border-style: solid;\n border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));\n }\n\n .button-border {\n border-width: var(--ha-card-border-width, 1px);\n border-style: solid;\n border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));\n }\n\n .error-message {\n color: red;\n font-style: italic;\n }\n\n .button-padding {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n }\n\n .status-on {\n color: #41cd52;\n }\n\n .status-off {\n color: red;\n }\n\n .voltage-high {\n color: #3090C7;\n }\n\n .voltage-low {\n color: red;\n }\n\n .pill {\n display: inline-block;\n padding: 0.2rem 0.2rem;\n background-color: #195569;\n color: #e4f3f8;\n border-radius: 999px;\n font-weight: 500;\n font-family: sans-serif;\n font-size: clamp(0.8rem, round(10cqi + 0.2rem, 0.2rem), 0.9rem);\n min-width: 1.8rem;\n text-align: center;\n }\n\n .flow-line {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 1;\n }\n\n line {\n stroke: #3090C7;\n stroke-width: 2;\n stroke-dasharray: 6;\n animation: dashmove 1s linear infinite;\n filter: drop-shadow(0 0 4px #41cd52);\n }\n\n path {\n stroke: #3090C7;\n stroke-width: 3;\n stroke-linecap: round;\n fill: none;\n stroke-dasharray: 10;\n stroke-dashoffset: 0;\n animation: dashmove 1.2s linear infinite;\n filter: drop-shadow(0 0 4px #41cd52);\n }\n\n .cardVersion {\n text-align: right;\n margin-right: 5px;\n }\n \n .version {\n font-style: italic;\n font-size: 0.8rem;\n }\n\n @keyframes dashmove {\n from {\n stroke-dashoffset: 0;\n }\n to {\n stroke-dashoffset: -20;\n }\n }\n ']))),t([de()],en.prototype,"hass",void 0),t([de()],en.prototype,"config",void 0),en=t([ce("jk-bms-default-layout")],en);let Dn=class extends oe{constructor(){super(...arguments),this.minCellId="",this.maxCellId="",this.deltaV=0,this.shouldBalance=!1,this.tempSensorsCount=0,this.VERSION=bt,this.historyData={}}firstUpdated(){this.fetchHistory(),this._historyInterval=window.setInterval((()=>this.fetchHistory()),6e4)}_navigate(e,t,n="sensor"){Ct(e,this.config,t,n)}updated(e){e.has("hass")&&this._updateRealtimeHistory()}_updateRealtimeHistory(){if(!this.hass||!this.config)return;const e=[me.total_voltage,me.current,me.power_tube_temperature,me.delta_cell_voltage],t=Date.now()-36e5;e.forEach((e=>{const n=this._resolveEntityId(e);if(!n)return;const a=this.hass.states[n];if(!a)return;const l=parseFloat(a.state),s=new Date(a.last_updated).getTime();if(isNaN(l))return;const i=this.historyData[n]||[],o=i.length>0?i[i.length-1]:null;if(!o||s>o.time){const e=[...i,{state:l,time:s}];for(;e.length>0&&e[0].time<t;)e.shift();this.historyData={...this.historyData,[n]:e}}}))}disconnectedCallback(){super.disconnectedCallback(),this._historyInterval&&clearInterval(this._historyInterval)}async fetchHistory(){if(!this.hass||!this.config)return;const e=[this._resolveEntityId(me.total_voltage),this._resolveEntityId(me.current),this._resolveEntityId(me.power_tube_temperature),this._resolveEntityId(me.delta_cell_voltage),this._resolveEntityId(me.temperature_sensor_1),this._resolveEntityId(me.temperature_sensor_2),this._resolveEntityId(me.temperature_sensor_3),this._resolveEntityId(me.temperature_sensor_4),this._resolveEntityId(me.balancing_current)].filter((e=>e)),t=[...new Set(e)];if(0===t.length)return;const n=new Date,a=new Date(n.getTime()-36e5);try{const e=await this.hass.callWS({type:"history/history_during_period",start_time:a.toISOString(),end_time:n.toISOString(),entity_ids:t,minimal_response:!0,no_attributes:!0});if(e){const t={};Object.keys(e).forEach((n=>{const a=e[n];Array.isArray(a)&&(t[n]=a.map((e=>({state:parseFloat(e.s||e.state),time:1e3*(e.lu||new Date(e.last_updated).getTime()/1e3)}))).filter((e=>!isNaN(e.state))))})),this.historyData={...this.historyData,...t}}}catch(e){console.warn("JK BMS Card: Failed to fetch history via WS",e)}}configOrEnum(e){return wt(this.config,e)}_resolveEntityId(e){const t=this.configOrEnum(e);if(t)return t.includes(".")?t:"sensor.".concat(this.config.prefix,"_").concat(t)}_renderSparkline(t,n){const a=this._resolveEntityId(t);if(!a||!this.historyData[a]||this.historyData[a].length<2)return I(tn||(tn=e([""])));const l=this.historyData[a];let s=1/0,i=-1/0;l.forEach((e=>{const t=Number(Number(e.state).toFixed(3));t<s&&(s=t),t>i&&(i=t)}));let o=i-s;if(o<1){const e=(s+i)/2;s=e-.5,i=e+.5}else s-=.05*o,i+=.05*o;const r=l[0].time,c=l[l.length-1].time-r;if(c<=0)return I(nn||(nn=e([""])));let _="";return l.forEach(((e,t)=>{const n=(e.time-r)/c*100,a=100-(e.state-s)/(i-s)*100;_+="".concat(0===t?"M":"L"," ").concat(n.toFixed(1),",").concat(a.toFixed(1)," ")})),I(an||(an=e(['\n <div class="sparkline-container">\n <svg class="sparkline-svg" viewBox="0 0 100 100" preserveAspectRatio="none">\n <path class="spark-line" d="','" stroke="','"/>\n <path class="spark-area" d="',' L 100,100 L 0,100 Z" fill="','"/>\n </svg>\n </div>\n '])),_,n,_,n)}getState(e,t=2,n="",a="sensor"){return St(this.hass,this.config,e,t,n,a)}getUnit(e){return kt(this.hass,this.config,e)}render(){if(ut.hass=this.hass,!this.hass||!this.config)return I(ln||(ln=e([""])));const t=this.config.socDecimals??0,n=this.getState(me.state_of_charge,t),a=this.config.customDecimals??0,l=this.getState(me.hardware_version),s=this.getState(me.software_version),i=this.getState(me.total_battery_capacity_setting,a),o=this.getState(me.total_runtime_formatted),r=o&&"unknown"!=o?I(sn||(sn=e([" | ",": <span>","</span>"])),ft("html_texts.time"),o.toUpperCase()):"",c=this.config.batteryName||"",_=this.config.title&&this.config.title.toLocaleLowerCase()!=ft("config.title").toLocaleLowerCase()?this.config.title:I(on||(on=e(["","",": <b>"," Ah</b></br>\n HW: <b>","</b> | SW: <b>","</b>",""])),""===c?"":c+" | ",ft("html_texts.capacity"),i,l,s,r),h=parseFloat(this.getState(me.current)),d=this.getState(me.charging_power,a),g=this.getState(me.discharging_power,a),p=h>0,m=h<0,u="on"===this.getState(me.charging,0,"","switch"),v="on"===this.getState(me.discharging,0,"","switch"),f="on"===this.getState(me.balancing,0,"","binary_sensor"),b=parseFloat(this.getState(me.balancing_current)),y=this.getState(me.total_voltage),w=this.getState(me.power_tube_temperature),C=this.getUnit(me.power_tube_temperature),x=this.getState(me.total_charging_cycle_capacity,a),S=parseFloat(this.getState(me.charging_cycles)).toFixed(0).toString();this.tempSensorsCount=this.config.tempSensorsCount;const k=this.config.showTitle,A=this.config.showButtons,M=this.config.showMain,$=this.config.showCells,V=this.config.showResistances,T=this.config.showCardVersion;this.minCellId=this.getState(me.min_voltage_cell,0),this.maxCellId=this.getState(me.max_voltage_cell,0),this.deltaV=parseFloat(this.getState(me.delta_cell_voltage,3,"0"));const E=e=>{if(null==e||""===e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>=0},O=E(this.minCellId)&&E(this.maxCellId),z=(e=>{if(null==e)return!1;const t=Number(e);return!isNaN(t)&&isFinite(t)&&t>0})(this.deltaV);O&&z||this.calculateDynamicMinMax();const D=this.config.showMainStats;return I(rn||(rn=e(['\n <ha-card class="container">\n ',"\n \n ","\n \n \x3c!-- Cells --\x3e\n ","\n ","\n </ha-card>\n "])),k?I(cn||(cn=e(['\n <div class="header clickable" @click=',">\n ","\n </div> \n "])),(e=>this._navigate(e,me.total_runtime_formatted)),_):"",M?I(_n||(_n=e(['\n <div class="top-section">\n \x3c!-- Solar/Grid Node --\x3e\n <div class="flow-node">\n <div class="icon-circle','" \n @click=',' >\n <ha-icon icon="mdi:solar-power" style="color: ',';"></ha-icon>\n </div>\n <div class="node-label">',"</div>\n ",'\n <div class="node-status">\n <div class="stat-value val-white clickable"\n @click=',">",' W\n </div>\n </div>\n </div>\n\n \x3c!-- Reactor (SOC) --\x3e\n <div class="reactor-container">\n <div class="reactor-ring ',' clickable" \n @click=','>\n <div class="soc-label">SoC:</div>\n <div class="soc-value">',"%</div>\n ",'\n </div>\n </div>\n\n \x3c!-- Load Node --\x3e\n <div class="flow-node">\n <div class="icon-circle','" \n @click=','>\n <ha-icon icon="mdi:power-plug" style="color: ',';"></ha-icon>\n </div>\n <div class="node-label">',"</div>\n ",'\n \n <div class="node-status">\n <div class="stat-value val-white clickable"\n @click=',">",' W\n </div>\n </div>\n </div>\n\n \x3c!-- SVG Flow Lines --\x3e\n <svg class="flow-svg" viewBox="0 0 400 180" preserveAspectRatio="xMidYMid meet">\n \x3c!-- Left path (Charge) - Rough coordinates for now, will refine --\x3e\n <path d="M 60,70 Q 120,70 125,90" class="','"/>\n \x3c!-- Right path (Discharge) --\x3e\n <path d="M 275,90 Q 280,70 340,70"\n class="','"\n marker-end="url(#arrow)"/>\n\n <defs>\n <marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto"\n markerUnits="strokeWidth">\n <path d="M0,0 L0,6 L9,3 z" fill="','"/>\n </marker>\n </defs>\n </svg>\n </div> \n \n \x3c!-- Stats Panels --\x3e\n ',"\n \n "])),A?" clickable":"",A?e=>this._navigate(e,me.charging,"switch"):void 0,p?"var(--solar-color)":"#444",ft("html_texts.grid-solar"),A?I(hn||(hn=e(['\n <div class="node-status">\n ',': <span\n class="','">',"</span>\n </div> \n "])),ft("html_texts.charge"),u?"status-on":"status-off",u?"ON":"OFF"):I(dn||(dn=e([""]))),(e=>this._navigate(e,me.charging_power)),d,f&&0!=b?"reactor-ring-balancing":"reactor-ring-base",(e=>this._navigate(e,me.state_of_charge)),n,f&&0!=b?I(gn||(gn=e(['<div class="capacity-val capacity-val-balancing clickable"\n @click=',">\n ",":<br>"," A</div>"])),(e=>this._navigate(e,me.balancing_current)),ft("html_texts.balancing"),this.getState(me.balancing_current)):I(pn||(pn=e(['<div class="capacity-val capacity-val-base clickable"\n @click=',">\n ",":<br>"," Ah</div>"])),(e=>this._navigate(e,me.capacity_remaining)),ft("html_texts.remaining"),this.getState(me.capacity_remaining,a)),A?" clickable":"",A?e=>this._navigate(e,me.discharging,"switch"):void 0,m?"var(--discharge-color)":"#444",ft("html_texts.load"),A?I(mn||(mn=e(['\n <div class="node-status">\n ',': <span\n class="','">',"</span>\n </div> \n "])),ft("html_texts.discharge"),v?"status-on":"status-off",v?"ON":"OFF"):I(un||(un=e([""]))),(e=>this._navigate(e,me.discharging_power)),g,p?"path-charge":"path-inactive",m?"path-discharge":"path-inactive",v?"#3090c7":"#444",D?I(vn||(vn=e(['\n <div class="middle-grid">\n <div class="stats-panel">\n <div class="metric-group">\n ','\n <div class="stat-label">',':</div>\n <div class="stat-value val-white clickable"\n @click=',">"," ",'\n </div>\n </div>\n\n <div class="metric-group">\n ','\n <div class="stat-label">',':</div>\n <div class="stat-value val-white clickable"\n @click=',">",' A\n </div>\n </div>\n </div>\n\n <div class="stats-panel">\n <div class="metric-group">\n ','\n <div class="stat-label">',':</div>\n <div class="stat-value val-white clickable"\n @click=',">"," ",'\n </div>\n </div>\n\n <div class="metric-group">\n ','\n <div class="stat-label">'," ",':</div>\n <div class="stat-value val-green clickable"\n @click=',">\n ","\n </div>\n </div>\n </div>\n \n ",'\n\n \x3c!-- Add cycle capacity --\x3e\n <div class="stats-panel" style="padding:0px 10px 0px 10px; height: fit-content;">\n <div class="metric-group" style="height:auto;">\n <div class="stat-label">','</div>\n <div class="icon-stats">\n <div class="icon-circle">\n <ha-icon icon="mdi:fuel-cell"/>\n </div>\n <div class="stat-value val-white clickable"\n @click=',">",' Ah\n </div>\n </div>\n </div>\n </div>\n \n \x3c!-- Add number of cycles --\x3e\n <div class="stats-panel" style="padding:0px 10px 0px 10px; height: fit-content;">\n <div class="metric-group" style="height:auto;">\n <div class="stat-label">','</div>\n <div class="icon-stats">\n <div class="icon-circle">\n <ha-icon icon="mdi:battery-sync"/>\n </div>\n <div class="stat-value val-white clickable"\n @click=',">","\n </div>\n </div>\n </div>\n </div>\n </div> \n "])),this._renderSparkline(me.total_voltage,"#41CD52"),ft("html_texts.total-voltage"),(e=>this._navigate(e,me.total_voltage)),y,ft("html_texts.volt"),this._renderSparkline(me.current,"#3090c7"),ft("html_texts.current"),(e=>this._navigate(e,me.current)),h,this._renderSparkline(me.power_tube_temperature,"#FFA500"),ft("html_texts.mosfetTemp"),(e=>this._navigate(e,me.power_tube_temperature)),w,C,this._renderSparkline(me.delta_cell_voltage,"#41CD52"),ft("html_texts.delta"),this.config.deltaVoltageUnit||ft("html_texts.volt"),(e=>this._navigate(e,me.delta_cell_voltage)),$t(this.getUnit(me.delta_cell_voltage),this.config.deltaVoltageUnit??"V",this.deltaV),this.renderTemperatureSensors(),ft("stats.cycleCapacity"),(e=>this._navigate(e,me.total_charging_cycle_capacity)),x,ft("stats.cycles"),(e=>this._navigate(e,me.charging_cycles)),S):I(fn||(fn=e([""])))):I(bn||(bn=e([""]))),$?I(yn||(yn=e(['\n <div class="cell-grid grid-','">\n ',"\n </div>"])),this.config.cellColumns??2,this._renderCells(V)):I(wn||(wn=e([""]))),T?I(Cn||(Cn=e(['\n <div class="cardVersion">\n <span class="version">\n v.',"\n </span>\n </div>\n "])),this.VERSION):I(xn||(xn=e([""]))))}calculateDynamicMinMax(){let e=1/0,t=-1/0,n=-1,a=-1;const l=this.config.cellCount||16;for(let s=1;s<=l;s++){const l=this.getState(me["cell_voltage_".concat(s)],3,""),i=parseFloat(l);isNaN(i)||(i<e&&(e=i,n=s),i>t&&(t=i,a=s))}e===1/0||t===-1/0?(this.deltaV=0,this.minCellId="",this.maxCellId=""):(this.minCellId=n.toString(),this.maxCellId=a.toString(),this.deltaV=parseFloat((t-e).toFixed(3)))}getTemperatureColor(e,t="°C"){("°F"===t||"F"===t)&&(e=5*(e-32)/9);const n=[{temp:-10,color:"#0000FF"},{temp:0,color:"#00BFFF"},{temp:20,color:"#41CD52"},{temp:30,color:"#FFD700"},{temp:40,color:"#FF8C00"},{temp:50,color:"#FF4500"},{temp:60,color:"#DC143C"}];for(let t=0;t<n.length-1;t++){const a=n[t],l=n[t+1];if(e<=a.temp)return a.color;if(e>=l.temp)continue;const s=(e-a.temp)/(l.temp-a.temp),i=parseInt(a.color.slice(1,3),16),o=parseInt(a.color.slice(3,5),16),r=parseInt(a.color.slice(5,7),16),c=parseInt(l.color.slice(1,3),16),_=parseInt(l.color.slice(3,5),16),h=parseInt(l.color.slice(5,7),16),d=Math.round(i+s*(c-i)),g=Math.round(o+s*(_-o)),p=Math.round(r+s*(h-r));return"#".concat(d.toString(16).padStart(2,"0")).concat(g.toString(16).padStart(2,"0")).concat(p.toString(16).padStart(2,"0"))}return n[n.length-1].color}renderTemperatureSensors(){if(!this.tempSensorsCount||0===this.tempSensorsCount)return I(Sn||(Sn=e([""])));const t=this.tempSensorsCount>=1,n=this.tempSensorsCount>=2,a=this.tempSensorsCount>=3,l=this.tempSensorsCount>=4,s=(t,n)=>{const a=this.getState(t,1,"—"),l=this.getUnit(t)||"°C",s=parseFloat(a),i=isNaN(s)?"#777777":this.getTemperatureColor(s,l);return I(kn||(kn=e(['\n <div class="metric-group">\n ','\n <div class="stat-label">\n '," ",'\n </div>\n <div class="stat-value clickable"\n style="color: ',';"\n @click=',">\n "," ","\n </div>\n </div>\n "])),this._renderSparkline(t,i),ft("html_texts.temperature_sensor"),n,i,(e=>this._navigate(e,t)),a,l)};return I(An||(An=e(['\n \x3c!-- Left column (1 and 3) --\x3e\n <div class="stats-panel">\n ',"\n ",'\n </div>\n\n \x3c!-- Right column (2 and 4) --\x3e\n <div class="stats-panel">\n ',"\n ","\n </div>\n "])),t?s(me.temperature_sensor_1,1):"",a?s(me.temperature_sensor_3,3):"",n?s(me.temperature_sensor_2,2):"",l?s(me.temperature_sensor_4,4):"")}_renderCells(e){const t=[],n="bankMode"===this.config.cellLayout,a=this.config.cellColumns||2,l=this.config.cellCount||16,s=Math.floor(l/a),i=n?Math.ceil(l/a):l,o=l%a;for(let r=1;r<=i;r++){const c=[];if(n)if(o&&r===i)c.push(l);else for(let e=0;e<a;e++){const t=r+s*e;t<=l&&c.push(t)}else c.push(r);for(const n of c)this._renderSingleCell(t,n,e)}return t}_renderSingleCell(t,n,a){const l=this.getState(me["cell_voltage_".concat(n)],3,"0.000"),s=this.getUnit(me["cell_resistance_".concat(n)])??"Ω",i=this.config?.resistanceUnit??s,o=this.getState(me["cell_resistance_".concat(n)],3,"0.000"),r=String(n)===this.minCellId,c=String(n)===this.maxCellId;let _=r?"cell-low":c?"cell-high":"val-white";const h=parseFloat(l),d=this.config.minCellVoltage??2.8,g=this.config.maxCellVoltage??3.65;let p=0;isNaN(h)||(p=(h-d)/(g-d)*100,p<0&&(p=0),p>100&&(p=100));const m=parseFloat(o),u=!isNaN(m)&&m>0&&a,v=$t(s,i,m).replace(" ",""),f=this.config.cellColorMode||"progress";let b="";if("gradient"===f){const e=[{r:180,g:60,b:60},{r:180,g:180,b:50},{r:60,g:180,b:60},{r:60,g:120,b:200},{r:90,g:60,b:200}];let t=Math.floor(p/25);t>=4&&(t=3);const n=p%25/25,a=e[t],l=e[t+1],s=Math.round(a.r+(l.r-a.r)*n),i=Math.round(a.g+(l.g-a.g)*n),o=Math.round(a.b+(l.b-a.b)*n);b="background: rgba(".concat(s,", ").concat(i,", ").concat(o,", 0.85);")}const y="gradient"===f?"background: rgba(0, 0, 0, 0.25); padding: 1px 3px; border-radius: 3px;":"",w=this.config.cellColumns>4||!0===this.config.showResistances&&this.config.cellColumns>3?"vertical":this.config.cellOrientation||"horizontal",C="vertical"===w?"cell-item cell-item-vertical":"cell-item",x=ft("html_texts.volt");t.push(I(Mn||(Mn=e(['\n <div class="','" style="','">\n ',"\n ","\n </div>\n "])),C,b,"progress"===f?I($n||($n=e(['\n <div class="cell-item-bg" style="width: ','%;"></div>'])),p):"","vertical"===w?I(Vn||(Vn=e(['\n <span class="cell-id">','</span>\n <span class="cell-volts ',' clickable" style="','"\n @click=',">","","</span>\n ","\n "])),String(n).padStart(2,"0"),_,y,(e=>this._navigate(e,me["cell_voltage_".concat(n)])),l,u?x:"",u?I(Tn||(Tn=e(['\n <span class="cell-res clickable" style="','"\n @click=',">","</span>\n "])),y,(e=>this._navigate(e,me["cell_resistance_".concat(n)])),v):""):I(En||(En=e(['\n <span class="clickable"\n @click=','>\n <span class="cell-id">','</span>\n <span class="cell-volts ','" style="','">',"","</span>\n </span>\n ","\n "])),(e=>this._navigate(e,me["cell_voltage_".concat(n)])),String(n).padStart(2,"0"),_,y,l,u?x:"",u?I(On||(On=e(['\n <span class="cell-res clickable" style="','"\n @click=',"> ","</span>\n "])),y,(e=>this._navigate(e,me["cell_resistance_".concat(n)])),v):"")))}};var Nn,Un,Rn,Bn;Dn.styles=o(zn||(zn=e(["\n :host {\n --accent-color: #41cd52;\n --accent-color-dim: rgba(65, 205, 82, 0.2);\n --discharge-color: #3090c7;\n --discharge-color-dim: rgba(48, 144, 199, 0.2);\n --panel-bg: var(--secondary-background-color, rgba(255, 255, 255, 0.05));\n --panel-border: 1px solid var(--divider-color, rgba(255, 255, 255, 0.1));\n --solar-color: #ffd30f;\n --balancing-color: #ff6333;\n }\n\n .container {\n font-family: 'Roboto', sans-serif;\n color: var(--primary-text-color);\n padding: 8px;\n box-sizing: border-box;\n border-radius: var(--ha-card-border-radius, 12px);\n }\n\n .header {\n text-align: center;\n font-size: 1.1em;\n margin-bottom: 16px;\n color: var(--secondary-text-color);\n }\n\n .header span {\n color: var(--discharge-color);\n }\n /* Top Section: Flow & Reactor */\n\n .top-section {\n display: grid;\n grid-template-columns: 1fr 1.2fr 1fr;\n align-items: center;\n margin-bottom: 16px;\n position: relative;\n height: 180px;\n }\n\n .flow-node {\n display: flex;\n flex-direction: column;\n align-items: center;\n z-index: 2;\n }\n\n .icon-circle {\n width: 50px;\n height: 50px;\n border-radius: 50%;\n border: 2px solid var(--secondary-text-color);\n display: flex;\n align-items: center;\n justify-content: center;\n margin-bottom: 4px;\n background: var(--secondary-background-color, #2a2a2a);\n }\n\n .icon-circle ha-icon {\n --mdc-icon-size: clamp(20px, round(4cqi + 4px, 2px), 30px);\n }\n\n .node-label {\n font-size: 0.9em;\n color: var(--secondary-text-color);\n }\n\n .node-status {\n font-size: 0.85em;\n }\n\n .reactor-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: relative;\n z-index: 2;\n }\n\n .reactor-ring {\n width: 140px;\n height: 140px;\n border-radius: 50%;\n box-shadow: 0 0 15px var(--accent-color-dim);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: var(--card-background-color);\n }\n\n .reactor-ring-base {\n border: 6px solid var(--accent-color);\n }\n \n .reactor-ring-balancing {\n border: 6px solid var(--balancing-color);\n }\n\n .soc-label {\n font-size: 0.9em;\n color: var(--secondary-text-color);\n }\n\n .soc-value {\n font-size: 2.2em;\n font-weight: bold;\n color: var(--accent-color);\n }\n\n .capacity-val {\n font-size: 0.85em;\n margin-top: -4px;\n text-align: center;\n }\n\n .capacity-val-base {\n color: var(--secondary-text-color);\n }\n\n .capacity-val-balancing {\n color: var(--balancing-color);\n }\n\n /* Middle Grid */\n\n .middle-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 8px;\n margin-bottom: 16px;\n }\n\n .stats-panel {\n container-type: inline-size;\n background: var(--panel-bg);\n border: var(--panel-border);\n border-radius: 10px;\n padding: 10px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .stat-label {\n font-size: 0.85em;\n color: var(--secondary-text-color);\n margin-bottom: 4px;\n }\n\n .stat-value {\n font-size: 1.4em;\n font-weight: bold;\n }\n\n .stat-sub {\n font-size: 0.8em;\n color: var(--secondary-text-color);\n margin-top: 2px;\n }\n\n .val-white {\n color: var(--primary-text-color);\n }\n\n .val-green {\n color: var(--accent-color);\n }\n\n .val-blue {\n color: var(--discharge-color);\n }\n\n .val-orange {\n color: orange;\n }\n\n .icon-stats {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: center;\n gap: 8px; \n width: 100%;\n }\n\n .icon-stats > .icon-circle {\n display: flex;\n align-items: center;\n justify-content: center;\n width: clamp(20px, round(4cqi + 4px, 2px), 30px);\n height: clamp(20px, round(4cqi + 4px, 2px), 30px);\n justify-self: start;\n }\n\n .icon-stats > :nth-child(2) {\n justify-self: end;\n padding-right: 5px;\n }\n\n .icon-stats > .stat-value {\n white-space: nowrap;\n font-size: clamp(0.8em, round(8cqi + 0.25rem, 0.1em), 1.2em);\n font-weight: bold;\n }\n\n /* Cell Grid */\n\n .cell-grid {\n display: grid;\n gap: 6px;\n }\n\n .grid-1 {\n grid-template-columns: 1fr;\n }\n\n .grid-2 {\n grid-template-columns: repeat(2, 1fr);\n }\n\n .grid-3 {\n grid-template-columns: repeat(3, 1fr);\n }\n\n .grid-4 {\n grid-template-columns: repeat(4, 1fr);\n }\n\n .grid-5 {\n grid-template-columns: repeat(5, 1fr);\n }\n\n .grid-6 {\n grid-template-columns: repeat(6, 1fr);\n }\n\n .grid-7 {\n grid-template-columns: repeat(7, 1fr);\n }\n\n .grid-8 {\n grid-template-columns: repeat(8, 1fr);\n }\n\n .cell-item {\n container-type: inline-size;\n background: var(--secondary-background-color, #2a2a2a);\n border-radius: 8px;\n padding: 3px 2px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 4px;\n position: relative;\n z-index: 0;\n overflow: hidden;\n white-space: nowrap;\n }\n\n .cell-item-vertical {\n container-type: inline-size;\n flex-direction: column;\n justify-content: center;\n padding: 2px 3px;\n gap: 3px;\n white-space: nowrap;\n }\n\n .cell-item-vertical .cell-id {\n padding-top: 2px;\n }\n\n .cell-item-bg {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: rgba(48, 144, 199, 0.2);\n z-index: -1;\n transition: width 0.5s ease-out;\n }\n\n .cell-id {\n display: inline-block;\n padding: 0.2rem 0.5rem;\n background-color: #195569;\n color: #e4f3f8;\n border-radius: 999px;\n font-weight: 600;\n font-size: clamp(0.8rem, round(14cqi, 0.05rem), 1rem) !important;\n min-width: 1.2rem;\n text-align: center;\n margin-right: 3px;\n flex-shrink: 0;\n }\n\n .cell-volts {\n color: var(--primary-text-color);\n font-family: monospace;\n font-size: clamp(0.9rem, round(14cqi, 0.05rem), 1.2rem) !important;\n white-space: nowrap;\n }\n\n .cell-res {\n color: var(--secondary-text-color);\n font-family: monospace;\n font-size: clamp(0.6rem, round(12cqi, 0.05rem), 0.8rem) !important;\n white-space: nowrap;\n }\n\n .cell-low {\n color: #FFA500;\n }\n\n /* Example warning color */\n\n .cell-high {\n color: var(--discharge-color);\n }\n\n .status-on {\n color: var(--accent-color);\n font-weight: bold;\n }\n\n .status-off {\n color: var(--disabled-text-color, #666);\n font-weight: bold;\n }\n\n .clickable {\n cursor: pointer;\n }\n\n /* SVG Overlay for Lines */\n\n .flow-svg {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 1;\n }\n\n .flow-svg path {\n fill: none;\n stroke-width: 2;\n stroke-dasharray: 8;\n }\n\n .path-charge {\n stroke: var(--solar-color);\n animation: flow 1s linear infinite;\n }\n\n .path-discharge {\n stroke: var(--discharge-color);\n animation: flow 1s linear infinite;\n }\n\n .path-inactive {\n stroke: #444;\n stroke-dasharray: 0;\n animation: none;\n }\n\n @keyframes flow {\n from {\n stroke-dashoffset: 16;\n }\n to {\n stroke-dashoffset: 0;\n }\n }\n\n /* Sparkline CSS */\n /* Sparkline CSS */\n\n .metric-group {\n position: relative;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 1;\n }\n\n .sparkline-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n opacity: 0.3;\n z-index: -1;\n pointer-events: none;\n }\n\n .sparkline-svg {\n width: 100%;\n height: 100%;\n }\n\n .spark-line {\n fill: none;\n stroke-width: 2;\n vector-effect: non-scaling-stroke;\n }\n\n .spark-area {\n fill-opacity: 0.2;\n stroke: none;\n }\n \n .cardVersion {\n text-align: right;\n margin-right: 5px;\n }\n \n .version {\n font-style: italic;\n font-size: 0.8rem;\n }\n "]))),t([de()],Dn.prototype,"hass",void 0),t([de()],Dn.prototype,"config",void 0),t([de()],Dn.prototype,"historyData",void 0),Dn=t([ce("jk-bms-core-reactor-layout")],Dn);const Pn=bt;console.groupCollapsed("%c🔋 JK-BMS Battery Card%c ready! 🚀 (v".concat(Pn,")"),"background: linear-gradient(to right, #41cd52, #3090c7); color: white; font-weight: bold; padding: 2px 8px; border-radius: 6px;","background: none; color: #AAA; font-style: italic;"),console.log("%c📖 Docs:","color: #41cd52; font-weight: bold;","https://github.com/Pho3niX90/jk-bms-card"),console.groupEnd();let jn=Bn=class extends oe{setConfig(e){this._config=Bn.getStubConfig(),this._config={...this._config,...e},ut.cardConfig=this._config}static getStubConfig(){return{language:"auto",title:ft("title"),prefix:"jk_bms",batteryName:"",cellCount:16,cellColumns:2,cellLayout:"bankMode",deltaVoltageUnit:"V",resistanceUnit:"Ω",tempSensorsCount:0,hasHeater:0,socDecimals:2,customDecimals:2,showTitle:!0,showButtons:!0,showMain:!0,showCondensed:!0,showMainStats:!0,showCells:!0,showResistances:!0,showCardVersion:!1,entities:Object.keys(me).reduce(((e,t)=>(e[t]="",e)),{})}}static async getConfigElement(){return await Promise.resolve().then((function(){return qn})),document.createElement(ge)}getCardSize(){return 3}render(){return ut.hass=this.hass,this.hass&&this._config?"core-reactor"===this._config.layout?I(Un||(Un=e(["<jk-bms-core-reactor-layout .hass="," .config=","></jk-bms-core-reactor-layout>"])),this.hass,this._config):I(Rn||(Rn=e(["\n <jk-bms-default-layout .hass="," .config = ","></jk-bms-default-layout>\n "])),this.hass,this._config):I(Nn||(Nn=e([""])))}};var Ln,Hn,In,Fn,Kn;t([de()],jn.prototype,"hass",void 0),t([de()],jn.prototype,"_config",void 0),jn=Bn=t([ce(pe)],jn),window.customCards.push({type:pe,name:"JK BMS Card",preview:!0,description:ft("common.description"),configurable:!0});let Jn=class extends oe{constructor(){super(...arguments),this._dynamicEntitySchema=[],this._fixedEntities=Object.values(me).filter((e=>!e.startsWith("cell_voltage_")&&!e.startsWith("cell_resistance_"))),this._computeLabelCallback=e=>ft("config.".concat(e.name))??e.name}static get styles(){return o(Ln||(Ln=e(["\n .boolean-wrapper {\n display: block;\n padding: 12px 0;\n }\n .boolean-row {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-bottom: 16px;\n gap: 6px;\n }\n .label {\n font-size: 14px;\n color: var(--primary-text-color);\n line-height: 1.3;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n max-height: 2.6em;\n word-break: break-word;\n }\n "])))}setConfig(e){this._config={...e},this._updateDynamicEntitySchema()}_updateDynamicEntitySchema(){const e=Math.min(this._config?.cellCount??16,96),t=[];for(let n=1;n<=e;n++){const e="cell_voltage_".concat(n);e in me&&t.push({name:e,selector:{entity:{}}})}for(let n=1;n<=e;n++){const e="cell_resistance_".concat(n);e in me&&t.push({name:e,selector:{entity:{}}})}this._dynamicEntitySchema=t}willUpdate(e){if(super.willUpdate(e),e.has("_config")){const t=e.get("_config");t?.cellCount!==this._config?.cellCount&&this._updateDynamicEntitySchema()}}renderBoolean(t,n){return I(Hn||(Hn=e(['\n <div class="boolean-row">\n <span class="label">',"</span>\n <ha-switch\n .checked=","\n @change=","\n ></ha-switch>\n </div>\n "])),t,Boolean(this._config?.[n]??!1),(e=>this._handleSwitchChange(n,e)))}_handleSwitchChange(e,t){const n=!!t.target.checked,a={...this._config};a[e]=n;const l=!0===a.showMain&&"core-reactor"===a.layout;l||void 0===a.showMainStats||delete a.showMainStats,l&&void 0===a.showMainStats&&(a.showMainStats=!0),this._config=a,yt(this,"config-changed",{config:this._config})}render(){if(!this._config||!this.hass)return I(In||(In=e([""])));const t=[...this._fixedEntities.map((e=>({name:e,selector:{entity:{}}}))),...this._dynamicEntitySchema];return I(Fn||(Fn=e(["\n\t\t\t<ha-form\n\t\t\t\t.hass=","\n\t\t\t\t.data=","\n\t\t\t\t.computeLabel=","\n\t\t\t\t.schema=","\n\t\t\t\t@value-changed=","\n\t\t\t></ha-form>\n\n ","\n\t\t"])),this.hass,this._config,this._computeLabelCallback.bind(this),[{type:"grid",title:ft("config.language"),schema:[{type:"grid",schema:[{name:"language",selector:{select:{options:[{label:"Auto (follow HA)",value:"auto"},{label:"English",value:"en"},{label:"Română",value:"ro"},{label:"Українська",value:"uk"},{label:"German",value:"de"},{label:"Русский",value:"ru"},{label:"Polski",value:"pl"},{label:"Français",value:"fr"},{label:"Español",value:"es"},{label:"中文",value:"zh"}],mode:"dropdown"}}}]}]},{type:"grid",title:ft("config.title"),schema:[{type:"grid",schema:[{name:"title",selector:{text:{}}}]}]},{type:"grid",title:ft("config.prefix"),schema:[{type:"grid",column_min_width:"200px",schema:[{name:"prefix",selector:{text:{}}},{name:"batteryName",selector:{text:{}}}]}]},{type:"grid",title:ft("config.layout"),schema:[{type:"grid",schema:[{name:"layout",selector:{select:{options:[{label:"Default",value:"default"},{label:"Core Reactor",value:"core-reactor"}]}}},{name:"deltaVoltageUnit",selector:{select:{options:[{label:"Volts (V)",value:"V"},{label:"Millivolts (mV)",value:"mV"}]}}},{name:"resistanceUnit",selector:{select:{options:[{label:"Ohms (Ω)",value:"Ω"},{label:"MilliOhms (mΩ)",value:"mΩ"}]}}}]},{type:"grid",column_min_width:"200px",schema:[{name:"cellColorMode",selector:{select:{options:[{label:"Progress Bar",value:"progress"},{label:"Voltage Gradient",value:"gradient"}]}}},{name:"cellOrientation",selector:{select:{options:[{label:"Vertical",value:"vertical"},{label:"Horizontal",value:"horizontal"}]}}}]}]},{type:"grid",schema:[{type:"grid",column_min_width:"200px",schema:[{name:"minCellVoltage",selector:{number:{min:2,max:4,step:.01,mode:"box"}}},{name:"maxCellVoltage",selector:{number:{min:2,max:4,step:.01,mode:"box"}}}]}]},{type:"grid",title:ft("config.cellCount"),schema:[{type:"grid",schema:[{name:"cellCount",selector:{number:{min:2,max:48,step:2}}},{name:"cellColumns",selector:{number:{min:1,max:8,step:1}}}]}]},{type:"grid",schema:[{name:"cellLayout",selector:{select:{options:[{label:"Incremental",value:"incremental"},{label:"Bank Mode",value:"bankMode"}]}}},{name:"socDecimals",title:ft("config.socDecimals"),selector:{number:{min:0,max:2,step:1}}}]},{type:"grid",title:ft("config.tempSensorsCount"),schema:[{type:"grid",schema:[{name:"tempSensorsCount",selector:{number:{min:0,max:4,step:2}}},{name:"customDecimals",title:ft("config.customDecimals"),selector:{number:{min:0,max:2,step:1}}}]}]},{type:"grid",title:ft("config.hasHeater"),schema:[{type:"grid",schema:[{name:"hasHeater",selector:{select:{multiple:!1,mode:"list",options:[{label:"Yes",value:"1"},{label:"No",value:"0"}]}}}]}]},{type:"expandable",title:ft("config.manualAssignment"),schema:[{name:"entities",type:"grid",schema:t}]}],this._valueChanged.bind(this),I(Kn||(Kn=e(['\n <ha-expansion-panel outlined style="margin-top: 10px;">\n <div slot="header" style="padding: 8px 16px; font-weight: 500;">\n ','\n </div>\n <div style="padding: 16px; \n display: grid; \n grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); \n gap: 16px;">\n ',"\n ","\n ","\n ","\n ","\n\n ","\n ","\n ","\n </div>\n </ha-expansion-panel>\n "])),ft("config.titleShowHide"),this.renderBoolean(ft("config.showTitle"),"showTitle"),!0===this._config?.showMain&&"core-reactor"===this._config?.layout||"default"===this._config?.layout?this.renderBoolean(ft("config.showButtons"),"showButtons"):"",this.renderBoolean(ft("config.showMain"),"showMain"),!0===this._config?.showMain&&"default"===this._config?.layout?this.renderBoolean(ft("config.showCondensed"),"showCondensed"):"",!0===this._config?.showMain&&"core-reactor"===this._config?.layout?this.renderBoolean(ft("config.showMainStats"),"showMainStats"):"",this.renderBoolean(ft("config.showCells"),"showCells"),!0===this._config?.showCells?this.renderBoolean(ft("config.showResistances"),"showResistances"):"",this.renderBoolean(ft("config.showCardVersion"),"showCardVersion")))}_valueChanged(e){const t={...this._config};Object.assign(t,e.detail.value),this._config=t,"cellCount"in e.detail.value&&this._updateDynamicEntitySchema();const n=!0===t?.showMain&&"core-reactor"===t?.layout,a=!0===t?.showCells;n||void 0===t.showMainStats||delete t.showMainStats,n&&void 0===t.showMainStats&&(t.showMainStats=!0),a||void 0===t.showResistances||delete t.showResistances,a&&void 0===t.showResistances&&(t.showResistances=!0),yt(this,"config-changed",{config:this._config})}};t([de()],Jn.prototype,"hass",void 0),t([de()],Jn.prototype,"_config",void 0),t([de()],Jn.prototype,"lovelace",void 0),t([function(e){return de({...e,state:!0,attribute:!1})}()],Jn.prototype,"_dynamicEntitySchema",void 0),Jn=t([ce(ge)],Jn);var qn=Object.freeze({__proto__:null,get JkBmsCardEditor(){return Jn}});export{Pn as CARD_VERSION,jn as JkBmsCard};
|