From 6b6e5ac148f5c65612f5a1b2cfd21f52519a1565 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Fri, 21 Nov 2025 12:17:10 +0100 Subject: [PATCH] Various changes for 2.5.0-rc3 --- .../include/AmsConfiguration.h | 16 ++- lib/AmsConfiguration/src/AmsConfiguration.cpp | 6 +- lib/AmsMqttHandler/include/AmsMqttHandler.h | 2 + lib/AmsMqttHandler/src/AmsMqttHandler.cpp | 6 +- lib/SvelteUi/app/dist/index.js | 15 +-- .../app/src/lib/ConfigurationPanel.svelte | 9 +- .../app/src/lib/TariffPeakChart.svelte | 15 ++- lib/SvelteUi/json/conf_gpio.json | 3 +- lib/SvelteUi/src/AmsWebServer.cpp | 28 +++-- src/AmsToMqttBridge.cpp | 113 ++++++++++-------- 10 files changed, 130 insertions(+), 83 deletions(-) diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 6fea9791..cc949e2b 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -55,6 +55,17 @@ #define FIRMWARE_CHANNEL_RC 2 #define FIRMWARE_CHANNEL_SNAPSHOT 3 +#define REBOOT_CAUSE_WEB_SYSINFO_JSON 1 +#define REBOOT_CAUSE_WEB_SAVE 2 +#define REBOOT_CAUSE_WEB_REBOOT 3 +#define REBOOT_CAUSE_WEB_FACTORY_RESET 4 +#define REBOOT_CAUSE_BTN_FACTORY_RESET 5 +#define REBOOT_CAUSE_REPARTITION 6 +#define REBOOT_CAUSE_CONFIG_FILE_UPDATE 7 +#define REBOOT_CAUSE_FIRMWARE_UPDATE 8 +#define REBOOT_CAUSE_MQTT_DISCONNECTED 9 +#define REBOOT_CAUSE_SMART_CONFIG 10 + struct ResetDataContainer { uint8_t cause; uint8_t last_cause; @@ -69,7 +80,7 @@ struct SystemConfig { char country[3]; uint8_t energyspeedometer; uint8_t firmwareChannel; -}; // 8 +}; // 9 struct NetworkConfig { char ssid[32]; @@ -164,7 +175,8 @@ struct GpioConfig { uint16_t vccResistorVcc; uint8_t ledDisablePin; uint8_t ledBehaviour; -}; // 21 + uint8_t powersaving; +}; // 22 struct GpioConfig103 { uint8_t hanPin; diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 5204fc60..9391c011 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -517,6 +517,7 @@ bool AmsConfiguration::getGpioConfig(GpioConfig& config) { if(configVersion == EEPROM_CHECK_SUM || configVersion == EEPROM_CLEARED_INDICATOR) { EEPROM.get(CONFIG_GPIO_START, config); EEPROM.end(); + if(config.powersaving > 4) config.powersaving = 0; return true; } else { clearGpio(config); @@ -590,6 +591,7 @@ void AmsConfiguration::clearGpio(GpioConfig& config, bool all) { config.tempAnalogSensorPin = 0xFF; config.vccPin = 0xFF; config.ledDisablePin = 0xFF; + config.powersaving = 0; if(all) { config.vccOffset = 0; @@ -1151,7 +1153,8 @@ bool AmsConfiguration::relocateConfig103() { gpio103.vccResistorGnd, gpio103.vccResistorVcc, gpio103.ledDisablePin, - gpio103.ledBehaviour + gpio103.ledBehaviour, + 0 }; WebConfig web = {web103.security}; @@ -1323,6 +1326,7 @@ void AmsConfiguration::print(Print* debugger) debugger->printf_P(PSTR("Vcc pin: %i\r\n"), gpio.vccPin); debugger->printf_P(PSTR("LED disable pin: %i\r\n"), gpio.ledDisablePin); debugger->printf_P(PSTR("LED behaviour: %i\r\n"), gpio.ledBehaviour); + debugger->printf_P(PSTR("Power saving: %i\r\n"), gpio.powersaving); if(gpio.vccMultiplier > 0) { debugger->printf_P(PSTR("Vcc multiplier: %f\r\n"), gpio.vccMultiplier / 1000.0); } diff --git a/lib/AmsMqttHandler/include/AmsMqttHandler.h b/lib/AmsMqttHandler/include/AmsMqttHandler.h index b90b3517..8dc4fe54 100644 --- a/lib/AmsMqttHandler/include/AmsMqttHandler.h +++ b/lib/AmsMqttHandler/include/AmsMqttHandler.h @@ -47,6 +47,7 @@ public: lwmqtt_err_t lastError(); bool connected(); bool loop(); + bool isRebootSuggested(); virtual uint8_t getFormat() { return 0; }; @@ -88,6 +89,7 @@ protected: String subTopic; AmsFirmwareUpdater* updater = NULL; + bool rebootSuggested = false; }; #endif diff --git a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp index 9164e1c6..220df4ad 100644 --- a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp +++ b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp @@ -177,7 +177,7 @@ bool AmsMqttHandler::loop() { if (debugger->isActive(RemoteDebug::WARNING)) #endif debugger->printf_P(PSTR("MQTT connection lost for over %d minutes, rebooting device\n"), mqttConfig.rebootMinutes); - ESP.restart(); + rebootSuggested = true; } } delay(10); // Needed to preserve power. After adding this, the voltage is super smooth on a HAN powered device @@ -188,4 +188,8 @@ bool AmsMqttHandler::loop() { ESP.wdtFeed(); #endif return ret; +} + +bool AmsMqttHandler::isRebootSuggested() { + return rebootSuggested; } \ No newline at end of file diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index 095a023e..7856505a 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,8 +1,9 @@ -var xu=Object.defineProperty;var er=(t,e,l)=>e in t?xu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var qi=(t,e,l)=>(er(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function je(){}function Ml(t,e){for(const l in e)t[l]=e[l];return t}function iu(t){return t()}function go(){return Object.create(null)}function zt(t){t.forEach(iu)}function Si(t){return typeof t=="function"}function Ct(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ai;function hi(t,e){return t===e?!0:(ai||(ai=document.createElement("a")),ai.href=e,t===ai.href)}function tr(t){return Object.keys(t).length===0}function to(t,...e){if(t==null){for(const n of e)n(void 0);return je}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function rn(t){let e;return to(t,l=>e=l)(),e}function ql(t,e,l){t.$$.on_destroy.push(to(e,l))}function lo(t,e,l,n){if(t){const i=ou(t,e,l,n);return t[0](i)}}function ou(t,e,l,n){return t[1]&&n?Ml(l.ctx.slice(),t[1](n(e))):l.ctx}function no(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function mn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const ir=["width","height"];function Sn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&ir.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function Be(t){return t===""?null:+t}function or(t){return Array.from(t.childNodes)}function E(t,e){e=""+e,t.data!==e&&(t.data=e)}function sr(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function ar(t,e,l){~nr.indexOf(l)?sr(t,e):E(t,e)}function j(t,e){t.value=e??""}function Sl(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function ze(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ce(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),N(n)}}function ur(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function ko(t,e){return new t(e)}let xn;function Zn(t){xn=t}function ni(){if(!xn)throw new Error("Function called outside component initialization");return xn}function so(t){ni().$$.on_mount.push(t)}function rr(t){ni().$$.on_destroy.push(t)}function cr(){const t=ni();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=ur(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function Jn(t,e){return ni().$$.context.set(t,e),e}function on(t){return ni().$$.context.get(t)}const vn=[],gi=[];let wn=[];const wo=[],su=Promise.resolve();let Bi=!1;function au(){Bi||(Bi=!0,su.then(fu))}function _r(){return au(),su}function Et(t){wn.push(t)}const Ei=new Set;let dn=0;function fu(){if(dn!==0)return;const t=xn;do{try{for(;dnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),wn=e}const pi=new Set;let an;function ct(){an={r:0,c:[],p:an}}function _t(){an.r||zt(an.c),an=an.p}function X(t,e){t&&t.i&&(pi.delete(t),t.i(e))}function x(t,e,l,n){if(t&&t.o){if(pi.has(t))return;pi.add(t),an.c.push(()=>{pi.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ft(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ui(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[o]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function ui(t){return typeof t=="object"&&t!==null?t:{}}function Me(t){t&&t.c()}function Ce(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),Et(()=>{const o=t.$$.on_mount.map(iu).filter(Si);t.$$.on_destroy?t.$$.on_destroy.push(...o):zt(o),t.$$.on_mount=[]}),i.forEach(Et)}function Se(t,e){const l=t.$$;l.fragment!==null&&(pr(l.after_update),zt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function dr(t,e){t.$$.dirty[0]===-1&&(vn.push(t),au(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=h.length?h[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=g)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](g),m&&dr(t,_)),d}):[],c.update(),m=!0,zt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=or(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&X(t.$$.fragment),Ce(t,e.target,e.anchor),fu()}Zn(f)}class Tt{constructor(){qi(this,"$$");qi(this,"$$set")}$destroy(){Se(this,1),this.$destroy=je}$on(e,l){if(!Si(l))return je;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!tr(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const hr="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(hr);const Co=t=>typeof t>"u",uu=t=>typeof t=="function",ru=t=>typeof t=="number";function vr(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function cu(){let t=0;return()=>t++}function br(){return Math.random().toString(36).substring(2)}const Ol=typeof window>"u";function _u(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const mu=(t,e)=>t?{}:{style:e},zi=t=>({"aria-hidden":"true",...mu(t,"display:none;")}),hn=[];function pu(t,e){return{subscribe:rl(t,e).subscribe}}function rl(t,e=je){let l;const n=new Set;function i(r){if(Ct(t,r)&&(t=r,l)){const f=!hn.length;for(const c of n)c[1](),hn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function gr(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return pu(l,(a,r)=>{let f=!1;const c=[];let m=0,_=je;const d=()=>{if(m)return;_();const g=e(n?c[0]:c,a,r);o?a(g):_=Si(g)?g:je},h=i.map((g,b)=>to(g,C=>{c[b]=C,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,ji=ii("LOCATION"),Mn=ii("ROUTER"),du=ii("ROUTE"),kr=ii("ROUTE_PARAMS"),wr=ii("FOCUS_ELEM"),hu=/^:(.+)/,Qn=(t,e,l)=>t.substr(e,l),Hi=(t,e)=>Qn(t,0,e.length)===e,Cr=t=>t==="",Sr=t=>hu.test(t),vu=t=>t[0]==="*",Mr=t=>t.replace(/\*.*$/,""),bu=t=>t.replace(/(^\/+|\/+$)/g,"");function El(t,e=!1){const l=bu(t).split("/");return e?l.filter(Boolean):l}const Di=(t,e)=>t+(e?`?${e}`:""),ao=t=>`/${bu(t)}`;function oi(...t){const e=n=>El(n,!0).join("/"),l=t.map(e).join("/");return ao(l)}const fo=1,Ni=2,_n=3,Nr=4,gu=5,Pr=6,ku=7,Tr=8,qr=9,wu=10,Cu=11,Er={[fo]:"Link",[Ni]:"Route",[_n]:"Router",[Nr]:"useFocus",[gu]:"useLocation",[Pr]:"useMatch",[ku]:"useNavigate",[Tr]:"useParams",[qr]:"useResolvable",[wu]:"useResolve",[Cu]:"navigate"},uo=t=>Er[t];function Dr(t,e){let l;return t===Ni?l=e.path?`path="${e.path}"`:"default":t===fo?l=`to="${e.to}"`:t===_n&&(l=`basepath="${e.basepath||""}"`),`<${uo(t)} ${l||""} />`}function Ar(t,e,l,n){const i=l&&Dr(n||t,l),o=i?` +var er=Object.defineProperty;var tr=(t,e,l)=>e in t?er(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var qi=(t,e,l)=>(tr(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function je(){}function Nl(t,e){for(const l in e)t[l]=e[l];return t}function ou(t){return t()}function go(){return Object.create(null)}function zt(t){t.forEach(ou)}function Si(t){return typeof t=="function"}function Ct(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ai;function hi(t,e){return t===e?!0:(ai||(ai=document.createElement("a")),ai.href=e,t===ai.href)}function lr(t){return Object.keys(t).length===0}function to(t,...e){if(t==null){for(const n of e)n(void 0);return je}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function rn(t){let e;return to(t,l=>e=l)(),e}function ql(t,e,l){t.$$.on_destroy.push(to(e,l))}function lo(t,e,l,n){if(t){const i=su(t,e,l,n);return t[0](i)}}function su(t,e,l,n){return t[1]&&n?Nl(l.ctx.slice(),t[1](n(e))):l.ctx}function no(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let r=0;r32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function pn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const or=["width","height"];function Mn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&or.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function Be(t){return t===""?null:+t}function sr(t){return Array.from(t.childNodes)}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function ar(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function fr(t,e,l){~ir.indexOf(l)?ar(t,e):D(t,e)}function j(t,e){t.value=e??""}function Ml(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Ue(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ce(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),N(n)}}function rr(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function ko(t,e){return new t(e)}let xn;function Jn(t){xn=t}function ni(){if(!xn)throw new Error("Function called outside component initialization");return xn}function so(t){ni().$$.on_mount.push(t)}function cr(t){ni().$$.on_destroy.push(t)}function _r(){const t=ni();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=rr(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function $n(t,e){return ni().$$.context.set(t,e),e}function on(t){return ni().$$.context.get(t)}const bn=[],gi=[];let Cn=[];const wo=[],au=Promise.resolve();let Bi=!1;function fu(){Bi||(Bi=!0,au.then(uu))}function mr(){return fu(),au}function Nt(t){Cn.push(t)}const Ei=new Set;let hn=0;function uu(){if(hn!==0)return;const t=xn;do{try{for(;hnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),Cn=e}const pi=new Set;let an;function ct(){an={r:0,c:[],p:an}}function _t(){an.r||zt(an.c),an=an.p}function X(t,e){t&&t.i&&(pi.delete(t),t.i(e))}function x(t,e,l,n){if(t&&t.o){if(pi.has(t))return;pi.add(t),an.c.push(()=>{pi.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ft(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ui(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],r=e[o];if(r){for(const f in a)f in r||(n[f]=1);for(const f in r)i[f]||(l[f]=r[f],i[f]=1);t[o]=r}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function ui(t){return typeof t=="object"&&t!==null?t:{}}function Me(t){t&&t.c()}function Ce(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),Nt(()=>{const o=t.$$.on_mount.map(ou).filter(Si);t.$$.on_destroy?t.$$.on_destroy.push(...o):zt(o),t.$$.on_mount=[]}),i.forEach(Nt)}function Se(t,e){const l=t.$$;l.fragment!==null&&(dr(l.after_update),zt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function hr(t,e){t.$$.dirty[0]===-1&&(bn.push(t),fu(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=h.length?h[0]:d;return c.ctx&&i(c.ctx[_],c.ctx[_]=g)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](g),m&&hr(t,_)),d}):[],c.update(),m=!0,zt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=sr(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&X(t.$$.fragment),Ce(t,e.target,e.anchor),uu()}Jn(f)}class Tt{constructor(){qi(this,"$$");qi(this,"$$set")}$destroy(){Se(this,1),this.$destroy=je}$on(e,l){if(!Si(l))return je;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!lr(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const vr="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(vr);const Co=t=>typeof t>"u",ru=t=>typeof t=="function",cu=t=>typeof t=="number";function br(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _u(){let t=0;return()=>t++}function gr(){return Math.random().toString(36).substring(2)}const Ol=typeof window>"u";function mu(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const pu=(t,e)=>t?{}:{style:e},zi=t=>({"aria-hidden":"true",...pu(t,"display:none;")}),vn=[];function du(t,e){return{subscribe:rl(t,e).subscribe}}function rl(t,e=je){let l;const n=new Set;function i(r){if(Ct(t,r)&&(t=r,l)){const f=!vn.length;for(const c of n)c[1](),vn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function kr(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return du(l,(a,r)=>{let f=!1;const c=[];let m=0,_=je;const d=()=>{if(m)return;_();const g=e(n?c[0]:c,a,r);o?a(g):_=Si(g)?g:je},h=i.map((g,b)=>to(g,k=>{c[b]=k,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,ji=ii("LOCATION"),Nn=ii("ROUTER"),hu=ii("ROUTE"),wr=ii("ROUTE_PARAMS"),Cr=ii("FOCUS_ELEM"),vu=/^:(.+)/,Xn=(t,e,l)=>t.substr(e,l),Hi=(t,e)=>Xn(t,0,e.length)===e,Sr=t=>t==="",Mr=t=>vu.test(t),bu=t=>t[0]==="*",Nr=t=>t.replace(/\*.*$/,""),gu=t=>t.replace(/(^\/+|\/+$)/g,"");function El(t,e=!1){const l=gu(t).split("/");return e?l.filter(Boolean):l}const Di=(t,e)=>t+(e?`?${e}`:""),ao=t=>`/${gu(t)}`;function oi(...t){const e=n=>El(n,!0).join("/"),l=t.map(e).join("/");return ao(l)}const fo=1,Ni=2,mn=3,Pr=4,ku=5,Tr=6,wu=7,qr=8,Er=9,Cu=10,Su=11,Dr={[fo]:"Link",[Ni]:"Route",[mn]:"Router",[Pr]:"useFocus",[ku]:"useLocation",[Tr]:"useMatch",[wu]:"useNavigate",[qr]:"useParams",[Er]:"useResolvable",[Cu]:"useResolve",[Su]:"navigate"},uo=t=>Dr[t];function Ar(t,e){let l;return t===Ni?l=e.path?`path="${e.path}"`:"default":t===fo?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${uo(t)} ${l||""} />`}function Lr(t,e,l,n){const i=l&&Ar(n||t,l),o=i?` -Occurred in: ${i}`:"",a=uo(t),r=uu(e)?e(a):e;return`<${a}> ${r}${o}`}const Su=t=>(...e)=>t(Ar(...e)),Mu=Su(t=>{throw new Error(t)}),ki=Su(console.warn),So=4,Lr=3,Or=2,Ir=1,Rr=1;function Fr(t,e){const l=t.default?0:El(t.fullPath).reduce((n,i)=>{let o=n;return o+=So,Cr(i)?o+=Rr:Sr(i)?o+=Or:vu(i)?o-=So+Ir:o+=Lr,o},0);return{route:t,score:l,index:e}}function Br(t){return t.map(Fr).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Nu(t,e){let l,n;const[i]=e.split("?"),o=El(i),a=o[0]==="",r=Br(t);for(let f=0,c=r.length;f({...m,params:d,uri:k});if(m.default){n=h(e);continue}const g=El(m.fullPath),b=Math.max(o.length,g.length);let C=0;for(;C{c===".."?f.pop():c!=="."&&f.push(c)}),Di(`/${f.join("/")}`,n)}function Mo(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=El(e,!0),r=El(l,!0);for(;a.length;)a[0]!==r[0]&&Mu(_n,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:oi(...r),hash:n,search:i,state:o}}const No=t=>t.length===1?"":t,ro=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?No(Qn(t,l)):"",a=i?Qn(t,0,l):t,r=n?No(Qn(a,e)):"";return{pathname:(n?Qn(a,0,e):a)||"/",search:r,hash:o}},zr=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function jr(t,e,l){return oi(l,Ur(t,e))}function Hr(t,e){const l=ao(Mr(t)),n=El(l,!0),i=El(e,!0).slice(0,n.length),o=Pu({fullPath:l},oi(...i));return o&&o.uri}const Ai="POP",yr="PUSH",Wr="REPLACE";function Li(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Gr(t){let e=[],l=Li(t),n=Ai;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Li(t),n=Ai,i([o])};i([o]);const r=_u(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==o)}},navigate(o,a){const{state:r={},replace:f=!1}=a||{};if(n=f?Wr:yr,ru(o))a&&ki(Cu,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ai,t.history.go(o);else{const c={...r,_key:br()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Li(t),i()}}}function Oi(t,e){return{...ro(e),state:t}}function Vr(t="/"){let e=0,l=[Oi(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Oi(n,o))},replaceState(n,i,o){l[e]=Oi(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Kr=!!(!Ol&&window.document&&window.document.createElement),Yr=!Ol&&window.location.origin==="null",Tu=Gr(Kr&&!Yr?window:Vr()),{navigate:nn}=Tu;let Dl=null,qu=!0;function Qr(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nDl.level||t.level===Dl.level&&Qr(t.routerId,Dl.routerId))&&(Dl=t)}function Zr(){Dl=null}function Jr(){qu=!1}function Po(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=_u(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function $r(t,e){return Number(t.dataset.svnavRouteEnd)===e}function xr(t){return/^H[1-6]$/i.test(t.tagName)}function To(t,e=document){return e.querySelector(t)}function e0(t){let l=To(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!$r(l,t);){if(xr(l))return l;const n=To("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function t0(t){Promise.resolve(rn(t.focusElement)).then(e=>{const l=e||e0(t.id);l||ki(_n,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ni),!Po(l)&&Po(document.documentElement)})}const l0=(t,e,l)=>(n,i)=>_r().then(()=>{if(!Dl||qu){Jr();return}if(n&&t0(Dl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:f,uri:c}=Dl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:f,uri:c},rn(l));Promise.resolve(m).then(_=>{e.set(_)})}Zr()}),n0="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function i0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},mu(t[6],n0)],i={};for(let o=0;o`Navigated to ${Q.uri}`,announcements:!0,...g},k=m,A=ao(m),I=on(ji),R=on(Mn),T=!I,F=s0(),L=h&&!(R&&!R.manageFocus),H=rl("");ql(t,H,Q=>l(0,r=Q));const K=R?R.disableInlineStyles:b,z=rl([]);ql(t,z,Q=>l(20,a=Q));const q=rl(null);ql(t,q,Q=>l(18,i=Q));let B=!1;const Z=T?0:R.level+1,Y=T?rl((()=>Mo(Ol?ro(_):d.location,A))()):I;ql(t,Y,Q=>l(17,n=Q));const G=rl(n);ql(t,G,Q=>l(19,o=Q));const U=l0(C,H,Y),y=Q=>ie=>ie.filter(re=>re.id!==Q);function ne(Q){if(Ol){if(B)return;const ie=Pu(Q,n.pathname);if(ie)return B=!0,ie}else z.update(ie=>{const re=y(Q.id)(ie);return re.push(Q),re})}function ee(Q){z.update(y(Q))}return!T&&m!==qo&&ki(_n,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),T&&(so(()=>d.listen(ie=>{const re=Mo(ie.location,A);G.set(n),Y.set(re)})),Jn(ji,Y)),Jn(Mn,{activeRoute:q,registerRoute:ne,unregisterRoute:ee,manageFocus:L,level:Z,id:F,history:T?d:R.history,basepath:T?A:R.basepath,disableInlineStyles:K}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,g=Q.a11y),"disableInlineStyles"in Q&&l(16,b=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&ki(_n,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=Nu(a,n.pathname);q.set(Q)}if(t.$$.dirty[0]&655360&&T){const Q=!!n.hash,ie=!Q&&L,re=!Q||n.pathname!==o.pathname;U(ie,re)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&Xr({level:Z,routerId:F,route:i})},[r,C,T,F,L,H,K,z,q,Y,G,m,_,d,h,g,b,n,i,o,a,c,f]}class f0 extends Tt{constructor(e){super(),Pt(this,e,a0,o0,Ct,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Eu=f0;function si(t,e,l=Mn,n=_n){on(l)||Mu(t,o=>`You cannot use ${o} outside of a ${uo(n)}.`,e)}const u0=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function Du(){return si(gu),u0(ji)}function Au(){const{history:t}=on(Mn);return t}function Lu(){const t=on(du);return t?gr(t,e=>e.base):rl("/")}function Ou(){si(wu);const t=Lu(),{basepath:e}=on(Mn);return n=>jr(n,rn(t),e)}function r0(){si(ku);const t=Ou(),{navigate:e}=Au();return(n,i)=>{const o=ru(n)?n:t(n);return e(o,i)}}const c0=t=>({params:t&16,location:t&8}),Eo=t=>({params:Ol?rn(t[10]):t[4],location:t[3],navigate:t[11]});function Do(t){let e,l;return e=new Eu({props:{primary:t[1],$$slots:{default:[p0]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function _0(t){let e;const l=t[18].default,n=lo(l,t,t[19],Eo);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&io(n,l,i,i[19],e?no(l,i[19],o,c0):oo(i[19]),Eo)},i(i){e||(X(n,i),e=!0)},o(i){x(n,i),e=!1},d(i){n&&n.d(i)}}}function m0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ol?rn(t[10]):t[4],t[12]];var o=t[0];function a(r,f){let c={};for(let m=0;m{Se(c,1)}),_t()}o?(e=ko(o,a(r,f)),Me(e.$$.fragment),X(e.$$.fragment,1),Ce(e,l.parentNode,l)):e=null}else if(o){const c=f&7192?Ui(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&ui(Ol?rn(r[10]):r[4]),f&4096&&ui(r[12])]):{};e.$set(c)}},i(r){n||(e&&X(e.$$.fragment,r),n=!0)},o(r){e&&x(e.$$.fragment,r),n=!1},d(r){r&&N(l),e&&Se(e,r)}}}function p0(t){let e,l,n,i;const o=[m0,_0],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function d0(t){let e,l,n,i,o,a=[zi(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{f=null}),_t())},i(_){o||(X(f),o=!0)},o(_){x(f),o=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const h0=cu();function v0(t,e,l){let n;const i=["path","component","meta","primary"];let o=bi(e,i),a,r,f,c,{$$slots:m={},$$scope:_}=e,{path:d=""}=e,{component:h=null}=e,{meta:g={}}=e,{primary:b=!0}=e;si(Ni,e);const C=h0(),{registerRoute:k,unregisterRoute:A,activeRoute:I,disableInlineStyles:R}=on(Mn);ql(t,I,B=>l(16,a=B));const T=Lu();ql(t,T,B=>l(17,f=B));const F=Du();ql(t,F,B=>l(3,r=B));const L=rl(null);let H;const K=rl(),z=rl({});ql(t,z,B=>l(4,c=B)),Jn(du,K),Jn(kr,z),Jn(wr,L);const q=r0();return Ol||rr(()=>A(C)),t.$$set=B=>{l(24,e=Ml(Ml({},e),vi(B))),l(12,o=bi(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,g=B.meta),"primary"in B&&l(1,b=B.primary),"$$scope"in B&&l(19,_=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",Z=oi(f,d),V={id:C,path:d,meta:g,default:B,fullPath:B?"":Z,base:B?f:Hr(Z,r.pathname),primary:b,focusElement:L};K.set(V),l(15,H=k(V))}if(t.$$.dirty&98304&&l(2,n=!!(H||a&&a.id===C)),t.$$.dirty&98308&&n){const{params:B}=H||a;z.set(B)}},e=vi(e),[h,b,n,r,c,C,I,R,T,F,z,q,o,d,g,H,a,f,m,_]}class b0 extends Tt{constructor(e){super(),Pt(this,e,v0,d0,Ct,{path:13,component:0,meta:14,primary:1})}}const Cl=b0;function g0(t){let e,l,n,i;const o=t[13].default,a=lo(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=L));const I=cr(),R=Ou(),{navigate:T}=Au();function F(L){I("click",L),vr(L)&&(L.preventDefault(),T(n,{state:C,replace:a||b}))}return t.$$set=L=>{l(19,e=Ml(Ml({},e),vi(L))),l(18,m=bi(e,c)),"to"in L&&l(5,g=L.to),"replace"in L&&l(6,b=L.replace),"state"in L&&l(7,C=L.state),"getProps"in L&&l(8,k=L.getProps),"$$scope"in L&&l(12,h=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=R(g,_)),t.$$.dirty&2049&&l(10,i=Hi(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=ro(n)===zr(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(uu(k)){const L=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...L}}return m})())},e=vi(e),[n,f,r,A,F,g,b,C,k,o,i,_,h,d]}class w0 extends Tt{constructor(e){super(),Pt(this,e,k0,g0,Ct,{to:5,replace:6,state:7,getProps:8})}}const kl=w0;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function C0(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Pi(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function ei(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function wi(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Ft(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ze(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function $n(t){switch(t){case 2:case 4:case 7:return!0}return!1}function xt(t,e){return t==1||t==2&&e}function hl(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function tl(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Cn(t,e){return t.setTime(t.getTime()+e*36e5),t}function S0(t,e){return t.setTime(t.getTime()+e*6e4),t}function M0(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function N0(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let ri=0;function ti(t,e){var l="";ri++;var n=function(){setTimeout(ti,1e3,t,e)};if(t.net.ip&&ri%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&ri%3==1?l="http://"+t.hostname:t.hostname&&ri%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function sl(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ao(t){return t.startsWith("esp32")?"esp32":t}function ml(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function li(t,e){let l=[tl(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=tl(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let cn="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Il="[\\x20-\\x7E]+",Nn="[\\x20-\\xFF]+",Ci="[A-Za-z0-9_\\-]+",Iu="[0-9A-Fa-f]+",Yn="[0-9]+",di={},yi=[];async function P0(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Ii;async function Ru(){if(yi.length){let t=yi.shift();delete di[t.resource];try{let e=await P0(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}Ii&&clearTimeout(Ii),Ii=setTimeout(Ru,100)}Ru();async function wl(t,e={}){let l;return di[t]?l=di[t]:(l={resource:t,options:e,callbacks:[]},di[t]=l,yi.push(l)),new Promise(i=>l.callbacks.push(i))}let Tl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function Ti(){Tl=await(await wl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),dl.set(Tl)}const dl=rl(Tl,t=>(Ti(),function(){}));function T0(t){dl.update(e=>(e.trying=t,e))}let ci=0,Lo=-127,Oo=null,q0={};const E0=pu(q0,t=>{let e,l;async function n(){wl("data.json").then(i=>i.json()).then(i=>{t(i),Lo!=i.t&&(Lo=i.t,setTimeout(D0,2e3)),i.pe&&i.p!=Oo&&(Oo=i.p,Uu()),(!Tl||!Tl.chip||Tl.booting||ci>1&&!$n(Tl.board))&&(Ti(),Al&&clearTimeout(Al),Al=setTimeout(Vi,2e3),Ll&&clearTimeout(Ll),Ll=setTimeout(Yi,3e3)),i.u,Al||(Al=Vi()),Ll||(Ll=Yi());let o=5e3;if($n(Tl.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(o=Math.max(a,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),e&&clearTimeout(e),e=setTimeout(n,o),ci=0}).catch(i=>{ci++,ci>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(ti,5e3,Tl,T0))):e=setTimeout(n,$n(Tl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let _i,bn={};const Fu=rl(bn);let Wi={};const Bu=rl(Wi);async function Uu(){_i&&(clearTimeout(_i),_i=0),bn=await(await wl("importprice.json")).json(),Fu.set(bn),bn!=null&&bn.importExportPriceDifferent&&(Wi=await(await wl("exportprice.json")).json(),Bu.set(Wi)),_i=setTimeout(Uu,(24-new Date().getHours())*36e5+10)}let Gi={},Al;async function Vi(){Al&&(clearTimeout(Al),Al=0),Gi=await(await wl("dayplot.json")).json(),zu.set(Gi),Al=setTimeout(Vi,(60-new Date().getMinutes())*6e4+20)}const zu=rl(Gi,t=>function(){});let Ki={},Ll;async function Yi(){Ll&&(clearTimeout(Ll),Ll=0),Ki=await(await wl("monthplot.json")).json(),ju.set(Ki),Ll=setTimeout(Yi,(24-new Date().getHours())*36e5+40)}const ju=rl(Ki,t=>function(){});let Qi={};async function D0(){Qi=await(await wl("temperature.json")).json(),Hu.set(Qi)}const Hu=rl(Qi,t=>function(){});let Xi={},mi;async function yu(){mi&&(clearTimeout(mi),mi=0),Xi=await(await wl("tariff.json")).json(),Wu.set(Xi),mi=setTimeout(yu,(60-new Date().getMinutes())*6e4+30)}const Wu=rl(Xi,t=>function(){});let gn={c:-1,n:[]};async function A0(){let e=await(await wl("wifiscan.json",{timeout:3e4})).json(),l=[];gn.c=0,gn.n=[];for(let n=0;n(A0(),function(){}));let Zi=!1;const Nl=rl(Zi);async function Gu(t){Zi=await(await wl("translations.json"+(t?"?lang="+t:""))).json(),Nl.set(Zi)}Gu();function Io(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Vu(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function Ro(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function o(c,m){return c[2]>1?U0:c[2]>0?B0:c[3]>1?F0:c[3]>0?R0:c[4]>1?I0:c[4]>0?O0:L0}let a=o(t),r=a(t);return{c(){l=M(e),n=v(),r.c(),i=Wt()},m(c,m){P(c,l,m),P(c,n,m),r.m(c,m),P(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&E(l,e),a===(a=o(c))&&r?r.p(c,m):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),r.d(c)}}}function L0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.seconds)??"s")+"",i;return{c(){e=M(t[0]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&E(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function O0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minute)??"m")+"",i;return{c(){e=M(t[4]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function I0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minutes)??"m")+"",i;return{c(){e=M(t[4]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&E(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function R0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hour)??"h")+"",i;return{c(){e=M(t[3]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function F0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hours)??"h")+"",i;return{c(){e=M(t[3]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&E(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function B0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.day)??"d")+"",i;return{c(){e=M(t[2]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function U0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.days)??"d")+"",i;return{c(){e=M(t[2]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&E(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&E(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function z0(t){let e,l=t[0]&&Ro(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ro(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:je,o:je,d(n){n&&N(e),l&&l.d(n)}}}function j0(t,e,l){let{epoch:n}=e,i={};Nl.subscribe(f=>{l(1,i=f)});let o=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,o,a,r]}class H0 extends Tt{constructor(e){super(),Pt(this,e,j0,z0,Ct,{epoch:0})}}function y0(t){let e,l,n;return{c(){e=p("span"),l=M(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){P(i,e,o),s(e,l)},p(i,[o]){o&4&&E(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:je,o:je,d(i){i&&N(e)}}}function W0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Tt{constructor(e){super(),Pt(this,e,W0,y0,Ct,{color:0,title:1,text:2})}}function G0(t){let e,l=`${Ft(t[0].getDate())}.${Ft(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ft(t[0].getHours())}:${Ft(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=M(l),u(e,"class",t[1])},m(i,o){P(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ft(i[0].getDate())}.${Ft(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ft(i[0].getHours())}:${Ft(i[0].getMinutes())}`)&&E(n,l),o&2&&u(e,"class",i[1])},d(i){i&&N(e)}}}function V0(t){var n;let e=`${Ft(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:Ft(t[0].getMonth()+1)} ${Ft(t[0].getHours())}:${Ft(t[0].getMinutes())}`,l;return{c(){l=M(e)},m(i,o){P(i,l,o)},p(i,o){var a;o&5&&e!==(e=`${Ft(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:Ft(i[0].getMonth()+1)} ${Ft(i[0].getHours())}:${Ft(i[0].getMinutes())}`)&&E(l,e)},d(i){i&&N(l)}}}function K0(t){let e;function l(o,a){return o[3]?V0:G0}let n=l(t),i=n(t);return{c(){i.c(),e=Wt()},m(o,a){i.m(o,a),P(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:je,o:je,d(o){o&&N(e),i.d(o)}}}function Y0(t,e,l){let n={};Nl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:o}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,o=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Cn(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,r,a]}class Ku extends Tt{constructor(e){super(),Pt(this,e,Y0,K0,Ct,{timestamp:0,fullTimeColor:1,offset:4})}}function Q0(t){let e,l,n;return{c(){e=Ut("svg"),l=Ut("path"),n=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){P(i,e,o),s(e,l),s(e,n)},p:je,i:je,o:je,d(i){i&&N(e)}}}class X0 extends Tt{constructor(e){super(),Pt(this,e,null,Q0,Ct,{})}}function Z0(t){let e,l;return{c(){e=Ut("svg"),l=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),s(e,l)},p:je,i:je,o:je,d(n){n&&N(e)}}}class J0 extends Tt{constructor(e){super(),Pt(this,e,null,Z0,Ct,{})}}function $0(t){let e,l;return{c(){e=Ut("svg"),l=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),s(e,l)},p:je,i:je,o:je,d(n){n&&N(e)}}}class x0 extends Tt{constructor(e){super(),Pt(this,e,null,$0,Ct,{})}}function e1(t){let e,l,n=t[2].version+"",i;return{c(){e=M("AMS reader "),l=p("span"),i=M(n)},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&4&&n!==(n=o[2].version+"")&&E(i,n)},d(o){o&&(N(e),N(l))}}}function Fo(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=M(l),i=M("°C"),u(e,"class","flex-none my-auto")},m(o,a){P(o,e,a),s(e,n),s(e,i)},p(o,a){a&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&E(n,l)},d(o){o&&N(e)}}}function Bo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(o=t[4].errors)==null?void 0:o.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=r[4].errors)==null?void 0:m.han)==null?void 0:_[r[1].he])??r[1].he))&&E(n,l)},d(r){r&&N(e)}}}function Uo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(o=t[4].errors)==null?void 0:o.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=r[4].errors)==null?void 0:m.mqtt)==null?void 0:_[r[1].me])??r[1].me))&&E(n,l)},d(r){r&&N(e)}}}function zo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(o=t[4].errors)==null?void 0:o.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=r[4].errors)==null?void 0:m.price)==null?void 0:_[r[1].ee])??r[1].ee))&&E(n,l)},d(r){r&&N(e)}}}function jo(t){let e,l,n,i,o,a,r,f;return l=new kl({props:{to:"/configuration",$$slots:{default:[t1]},$$scope:{ctx:t}}}),a=new kl({props:{to:"/status",$$slots:{default:[l1]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Me(l.$$.fragment),i=v(),o=p("div"),Me(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(o,"class","flex-none px-1 mt-1"),u(o,"title",r=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){P(c,e,m),Ce(l,e,null),P(c,i,m),P(c,o,m),Ce(a,o,null),f=!0},p(c,m){var h,g;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};m&64&&(d.$$scope={dirty:m,ctx:c}),a.$set(d),(!f||m&16&&r!==(r=((g=c[4].header)==null?void 0:g.status)??""))&&u(o,"title",r)},i(c){f||(X(l.$$.fragment,c),X(a.$$.fragment,c),f=!0)},o(c){x(l.$$.fragment,c),x(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(o)),Se(l),Se(a)}}}function t1(t){let e,l;return e=new X0({}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function l1(t){let e,l;return e=new J0({}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function n1(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?s1:o1}let i=n(t),o=i(t);return{c(){var a;e=p("div"),o.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,r){P(a,e,r),o.m(e,null)},p(a,r){var f;i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null))),r&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&u(e,"title",l)},d(a){a&&N(e),o.d()}}}function i1(t){let e,l,n=t[2].upgrade.t+"",i,o,a=t[3].toFixed(1)+"",r,f;return{c(){e=p("div"),l=M("Upgrading to "),i=M(n),o=M(", "),r=M(a),f=M("%"),u(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){P(c,e,m),s(e,l),s(e,i),s(e,o),s(e,r),s(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&E(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&E(r,a)},d(c){c&&N(e)}}}function o1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,o=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=M(l),i=M(": "),a=M(o)},m(f,c){P(f,e,c),s(e,n),s(e,i),s(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&E(n,l),c&4&&o!==(o=f[2].upgrade.n+"")&&E(a,o)},d(f){f&&N(e)}}}function s1(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,o,a=t[2].upgrade.n+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=M(n),o=M(": "),r=M(a),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(l,o),s(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(_,d){var h;d&16&&n!==(n=(((h=_[4].header)==null?void 0:h.new_version)??"New version")+"")&&E(i,n),d&4&&a!==(a=_[2].upgrade.n+"")&&E(r,a)},d(_){_&&N(e),f=!1,c()}}}function a1(t){var be,ke;let e,l,n,i,o,a,r,f,c,m,_,d=(((be=t[4].header)==null?void 0:be.mem)??"Free")+"",h,g,b=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",C,k,A,I,R,T,F,L,H,K,z,q,B,Z,V,Y,G,U,y,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe;i=new kl({props:{to:"/",$$slots:{default:[e1]},$$scope:{ctx:t}}}),f=new H0({props:{epoch:t[1].u}});let we=t[1].t>-50&&Fo(t);R=new fn({props:{title:"ESP",text:t[2].booting?((ke=t[4].header)==null?void 0:ke.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),H=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),z=new fn({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let S=(t[1].he<0||t[1].he>0)&&Bo(t),w=t[1].me<0&&Uo(t),O=(t[1].ee>0||t[1].ee<0)&&zo(t);ie=new Ku({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let D=t[2].vndcfg&&t[2].usrcfg&&jo(t);oe=new x0({});function W(J,ve){if(J[2].upgrading)return i1;if(J[2].fwconsent===1&&J[2].upgrade.n)return n1}let te=W(t),ue=te&&te(t);return{c(){var J;e=p("nav"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),r=p("div"),Me(f.$$.fragment),c=v(),we&&we.c(),m=v(),_=p("div"),h=M(d),g=M(": "),C=M(b),k=M("kb"),A=v(),I=p("div"),Me(R.$$.fragment),T=v(),Me(F.$$.fragment),L=v(),Me(H.$$.fragment),K=v(),Me(z.$$.fragment),q=v(),S&&S.c(),B=v(),w&&w.c(),Z=v(),O&&O.c(),V=v(),Y=p("div"),G=p("div"),U=p("a"),y=p("img"),ee=v(),Q=p("div"),Me(ie.$$.fragment),re=v(),D&&D.c(),fe=v(),le=p("div"),de=p("a"),Me(oe.$$.fragment),se=v(),ue&&ue.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(I,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(y,"class","logo"),hi(y.src,ne=(t[0]+"/logo.svg").replace("//","/"))||u(y,"src",ne),u(y,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(G,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(de,"href",hl("")),u(de,"target","_blank"),u(de,"rel","noreferrer"),u(le,"class","flex-none px-1 mt-1"),u(le,"title",me=((J=t[4].header)==null?void 0:J.doc)??""),u(Y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","hdr")},m(J,ve){P(J,e,ve),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,r),Ce(f,r,null),s(a,c),we&&we.m(a,null),s(a,m),s(a,_),s(_,h),s(_,g),s(_,C),s(_,k),s(l,A),s(l,I),Ce(R,I,null),s(I,T),Ce(F,I,null),s(I,L),Ce(H,I,null),s(I,K),Ce(z,I,null),s(l,q),S&&S.m(l,null),s(l,B),w&&w.m(l,null),s(l,Z),O&&O.m(l,null),s(l,V),s(l,Y),s(Y,G),s(G,U),s(U,y),s(Y,ee),s(Y,Q),Ce(ie,Q,null),s(Y,re),D&&D.m(Y,null),s(Y,fe),s(Y,le),s(le,de),Ce(oe,de,null),s(Y,se),ue&&ue.m(Y,null),pe=!0},p(J,[ve]){var Re,$e,xe;const ge={};ve&68&&(ge.$$scope={dirty:ve,ctx:J}),i.$set(ge);const qe={};ve&2&&(qe.epoch=J[1].u),f.$set(qe),J[1].t>-50?we?we.p(J,ve):(we=Fo(J),we.c(),we.m(a,m)):we&&(we.d(1),we=null),(!pe||ve&16)&&d!==(d=(((Re=J[4].header)==null?void 0:Re.mem)??"Free")+"")&&E(h,d),(!pe||ve&2)&&b!==(b=(J[1].m?(J[1].m/1e3).toFixed(1):"-")+"")&&E(C,b);const Pe={};ve&22&&(Pe.text=J[2].booting?(($e=J[4].header)==null?void 0:$e.booting)??"Booting":J[1].v>2?J[1].v.toFixed(2)+"V":"ESP"),ve&6&&(Pe.color=ln(J[2].booting?2:J[1].em)),R.$set(Pe);const Ae={};ve&6&&(Ae.color=ln(J[2].booting?9:J[1].hm)),F.$set(Ae);const Le={};ve&2&&(Le.text=J[1].r?J[1].r.toFixed(0)+"dBm":"WiFi"),ve&6&&(Le.color=ln(J[2].booting?9:J[1].wm)),H.$set(Le);const Ne={};ve&6&&(Ne.color=ln(J[2].booting?9:J[1].mm)),z.$set(Ne),J[1].he<0||J[1].he>0?S?S.p(J,ve):(S=Bo(J),S.c(),S.m(l,B)):S&&(S.d(1),S=null),J[1].me<0?w?w.p(J,ve):(w=Uo(J),w.c(),w.m(l,Z)):w&&(w.d(1),w=null),J[1].ee>0||J[1].ee<0?O?O.p(J,ve):(O=zo(J),O.c(),O.m(l,V)):O&&(O.d(1),O=null),(!pe||ve&1&&!hi(y.src,ne=(J[0]+"/logo.svg").replace("//","/")))&&u(y,"src",ne);const De={};ve&2&&(De.timestamp=J[1].c?new Date(J[1].c*1e3):new Date(0)),ve&4&&(De.offset=J[2].clock_offset),ie.$set(De),J[2].vndcfg&&J[2].usrcfg?D?(D.p(J,ve),ve&4&&X(D,1)):(D=jo(J),D.c(),X(D,1),D.m(Y,fe)):D&&(ct(),x(D,1,1,()=>{D=null}),_t()),(!pe||ve&16&&me!==(me=((xe=J[4].header)==null?void 0:xe.doc)??""))&&u(le,"title",me),te===(te=W(J))&&ue?ue.p(J,ve):(ue&&ue.d(1),ue=te&&te(J),ue&&(ue.c(),ue.m(Y,null)))},i(J){pe||(X(i.$$.fragment,J),X(f.$$.fragment,J),X(R.$$.fragment,J),X(F.$$.fragment,J),X(H.$$.fragment,J),X(z.$$.fragment,J),X(ie.$$.fragment,J),X(D),X(oe.$$.fragment,J),pe=!0)},o(J){x(i.$$.fragment,J),x(f.$$.fragment,J),x(R.$$.fragment,J),x(F.$$.fragment,J),x(H.$$.fragment,J),x(z.$$.fragment,J),x(ie.$$.fragment,J),x(D),x(oe.$$.fragment,J),pe=!1},d(J){J&&N(e),Se(i),Se(f),we&&we.d(),Se(R),Se(F),Se(H),Se(z),S&&S.d(),w&&w.d(),O&&O.d(),Se(ie),D&&D.d(),Se(oe),ue&&ue.d()}}}function f1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",o.upgrade.n))&&(Vu(o.upgrade.n),dl.update(m=>(m.upgrade.t=o.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let r;dl.subscribe(c=>{l(2,o=c)});let f={};return Nl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,r=Math.max(0,o.upgrade.p))},[n,i,o,r,f,a]}class u1 extends Tt{constructor(e){super(),Pt(this,e,f1,a1,Ct,{basepath:0,data:1})}}function r1(t){let e,l,n,i;return{c(){e=Ut("svg"),l=Ut("path"),n=Ut("path"),u(l,"d",Ri(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Ri(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){P(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Ri(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:je,o:je,d(o){o&&N(e)}}}function Ho(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Ri(t,e,l,n,i){var o=Ho(t,e,l,i),a=Ho(t,e,l,n),r=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function c1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class _1 extends Tt{constructor(e){super(),Pt(this,e,c1,r1,Ct,{pct:0,color:1})}}function yo(t){let e,l,n,i=t[1][0]+"",o,a,r,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=v(),n=p("span"),o=M(i),a=v(),r=p("span"),c=M(f),m=M("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(_,d){P(_,e,d),P(_,l,d),P(_,n,d),s(n,o),P(_,a,d),P(_,r,d),s(r,c),s(r,m)},p(_,d){d&2&&i!==(i=_[1][0]+"")&&E(o,i),d&2&&f!==(f=_[1][1]+"")&&E(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(r))}}}function m1(t){let e,l,n,i,o,a,r,f,c,m,_=t[3][0]+"",d,h,g,b=t[3][1]+"",C,k,A;l=new _1({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let I=t[1]&&yo(t);return{c(){e=p("div"),Me(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=M(t[0]),r=v(),f=p("br"),c=v(),m=p("span"),d=M(_),h=v(),g=p("span"),C=M(b),k=v(),I&&I.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(g,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(R,T){P(R,e,T),Ce(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,f),s(i,c),s(i,m),s(m,d),s(i,h),s(i,g),s(g,C),s(i,k),I&&I.m(i,null),A=!0},p(R,[T]){const F={};T&16&&(F.pct=R[4]),T&20&&(F.color=R[2](R[4],document.documentElement.classList.contains("dark"))),l.$set(F),(!A||T&1)&&E(a,R[0]),(!A||T&8)&&_!==(_=R[3][0]+"")&&E(d,_),(!A||T&8)&&b!==(b=R[3][1]+"")&&E(C,b),R[1]?I?I.p(R,T):(I=yo(R),I.c(),I.m(i,null)):I&&(I.d(1),I=null)},i(R){A||(X(l.$$.fragment,R),A=!0)},o(R){x(l.$$.fragment,R),A=!1},d(R){R&&N(e),Se(l),I&&I.d()}}}function p1(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,o=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,r=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=ml(n,o)),l(4,m=Math.min(n,i)/i*100))},[a,r,f,c,m,n,i,o]}class Yu extends Tt{constructor(e){super(),Pt(this,e,p1,m1,Ct,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function d1(t){let e,l,n;return{c(){e=p("div"),l=M(t[0]),u(e,"class","tooltip"),Sl(e,"top",t[2]-t[4]-10+"px"),Sl(e,"left",t[1]-t[3]/2+"px"),Et(()=>t[5].call(e))},m(i,o){P(i,e,o),s(e,l),n=Mi(e,t[5].bind(e))},p(i,[o]){o&1&&E(l,i[0]),o&20&&Sl(e,"top",i[2]-i[4]-10+"px"),o&10&&Sl(e,"left",i[1]-i[3]/2+"px")},i:je,o:je,d(i){i&&N(e),n()}}}function h1(t,e,l){let{title:n}=e,{x:i}=e,{y:o}=e,a,r;function f(){r=this.clientHeight,a=this.clientWidth,l(4,r),l(3,a)}return t.$$set=c=>{"title"in c&&l(0,n=c.title),"x"in c&&l(1,i=c.x),"y"in c&&l(2,o=c.y)},[n,i,o,a,r,f]}class v1 extends Tt{constructor(e){super(),Pt(this,e,h1,d1,Ct,{title:0,x:1,y:2})}}function b1(t){let e,l;function n(o){l&&l.$destroy(),e=t.dataset.title||t.getAttribute("title");var a=t.getBoundingClientRect();l=new v1({props:{title:e,x:a.left+window.scrollX+a.width/2,y:a.top+window.scrollY},target:document.body})}function i(){l&&setTimeout(()=>{l.$destroy(),l=null},500)}return t.addEventListener("click",n),t.addEventListener("mouseleave",i),{destroy(){t.removeEventListener("click",n),t.removeEventListener("mouseleave",i)}}}function Wo(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Go(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Vo(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ko(t){let e,l,n,i,o,a,r,f=(t[0].title||t[0].link)&&Yo(t),c=ft(t[0].y.ticks),m=[];for(let b=0;b{f=null}),_t()),C&129){c=ft(b[0].y.ticks);let k;for(k=0;k{o=null}),_t())},i(a){n||(X(o),n=!0)},o(a){x(o),n=!1},d(a){a&&N(e),i&&i.d(),o&&o.d()}}}function Qo(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=M(l),u(e,"class","text-sm font-bold"),Et(()=>t[9].call(e))},m(o,a){P(o,e,a),s(e,n),i=Mi(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&E(n,l)},d(o){o&&N(e),i()}}}function Xo(t){let e,l,n,i;const o=[k1,g1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=o[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=r(f),l===m?a[l].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),n=a[l],n?n.p(f,c):(n=a[l]=o[l](f),n.c()),X(n,1),n.m(e,null))},i(f){i||(X(n),i=!0)},o(f){x(n),i=!1},d(f){f&&N(e),a[l].d()}}}function g1(t){let e,l=t[0].link.text+"",n,i,o;return{c(){e=p("a"),n=M(l),u(e,"href",i=t[0].link.url),u(e,"target",o=t[0].link.target)},m(a,r){P(a,e,r),s(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&E(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&o!==(o=a[0].link.target)&&u(e,"target",o)},i:je,o:je,d(a){a&&N(e)}}}function k1(t){let e,l;return e=new kl({props:{to:t[0].link.url,$$slots:{default:[w1]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.to=n[0].link.url),i&262145&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function w1(t){let e=t[0].link.text+"",l;return{c(){l=M(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&E(l,e)},d(n){n&&N(l)}}}function Zo(t){let e,l,n,i=t[15].label+"",o,a,r,f;return{c(){e=Ut("g"),l=Ut("line"),n=Ut("text"),o=M(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"90%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){P(c,e,m),s(e,l),s(e,n),s(n,o)},p(c,m){m&1&&i!==(i=c[15].label+"")&&E(o,i),m&1&&a!==(a=c[15].align=="right"?"90%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&N(e)}}}function Jo(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Zo(t);return{c(){n&&n.c(),l=Wt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=Zo(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function $o(t){let e,l,n=(t[3]>20||t[13]%2==0)&&xo(t);return{c(){e=Ut("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){P(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=xo(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function xo(t){let e,l=t[11].label+"",n,i;return{c(){e=Ut("text"),n=M(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,a){P(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&E(n,l),a&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&N(e)}}}function es(t){let e=!isNaN(t[6](t[13])),l,n=e&&$o(t);return{c(){n&&n.c(),l=Wt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=$o(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function ts(t){let e,l,n,i,o,a=t[11].value!==void 0&&ls(t),r=t[11].value2>1e-4&&is(t);return{c(){e=Ut("g"),a&&a.c(),n=Ut("g"),r&&r.c(),u(e,"data-title",l=t[11].title)},m(f,c){P(f,e,c),a&&a.m(e,null),P(f,n,c),r&&r.m(n,null),i||(o=lr(b1.call(null,e)),i=!0)},p(f,c){f[11].value!==void 0?a?a.p(f,c):(a=ls(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null),c&1&&l!==(l=f[11].title)&&u(e,"data-title",l),f[11].value2>1e-4?r?r.p(f,c):(r=is(f),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},d(f){f&&(N(e),N(n)),a&&a.d(),r&&r.d(),i=!1,o()}}}function ls(t){let e,l,n,i,o,a,r,f=t[3]>15&&ns(t);return{c(){e=Ut("rect"),f&&f.c(),r=Wt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]*.95),u(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),m&8&&i!==(i=c[3]*.95)&&u(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",o),m&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=ns(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function ns(t){let e,l=t[11].label+"",n,i,o,a,r;return{c(){e=Ut("text"),n=M(l),u(e,"width",i=t[3]*.95),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]f[7](0)-f[8]&&!f[0].dark?f[11].color:"white")&&u(e,"fill",a),c&457&&r!==(r="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](f[11].value)>f[7](0)-f[8]?f[7](f[11].value)-f[8]:f[7](f[11].value)+10)+") rotate("+(f[11].labelAngle?f[11].labelAngle:f[3]15&&os(t);return{c(){e=Ut("rect"),f&&f.c(),r=Wt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]*.95),u(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&128&&n!==(n=c[7](0))&&u(e,"y",n),m&8&&i!==(i=c[3]*.95)&&u(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",o),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=os(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function os(t){let e,l=t[11].label2+"",n,i,o,a,r,f=t[11].title2&&ss(t);return{c(){e=Ut("text"),n=M(l),f&&f.c(),r=Wt(),u(e,"width",i=t[3]*.95),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(o,a){P(o,e,a),i&&i.m(e,null),l=Mi(e,t[10].bind(e)),n=!0},p(o,[a]){o[0].x.ticks&&o[0].points&&o[4]?i?(i.p(o,a),a&17&&X(i,1)):(i=Ko(o),i.c(),X(i,1),i.m(e,null)):i&&(ct(),x(i,1,1,()=>{i=null}),_t())},i(o){n||(X(i),n=!0)},o(o){x(i),n=!1},d(o){o&&N(e),i&&i.d(),l()}}}let un=30;function S1(t,e,l){let{config:n}=e,i,o,a,r,f,c,m,_=0;function d(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=g=>{"config"in g&&l(0,n=g.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=o-_);let g=i-(n.padding.left+n.padding.right);l(3,a=g/n.points.length),l(8,m=an.y.max?k=n.padding.bottom:Cc||k<0?0:k})}},[n,i,o,a,c,_,r,f,m,d,h]}class pn extends Tt{constructor(e){super(),Pt(this,e,S1,C1,Ct,{config:0})}}function M1(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function N1(t,e,l){let{title:n}=e,{u1:i}=e,{u2:o}=e,{u3:a}=e,{ds:r}=e,f={};function c(m){return{label:tl(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:C0(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,o=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,r=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:r===1?"L1-L2":"L1"}),_.push(c(i))),o>0&&(m.push({label:r===1?"L1-L3":"L2"}),_.push(c(o))),a>0&&(m.push({label:r===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:m},points:_})}},[f,n,i,o,a,r]}class P1 extends Tt{constructor(e){super(),Pt(this,e,N1,M1,Ct,{title:1,u1:2,u2:3,u3:4,ds:5})}}function T1(t){var D,W,te,ue,be;let e,l,n=(((D=t[0].reactive)==null?void 0:D.title)??"Reactive")+"",i,o,a,r,f=(((W=t[0].reactive)==null?void 0:W.instant_in)??"Instant in")+"",c,m,_,d=t[1][0]+"",h,g,b=t[1][1]+"",C,k,A,I=(((te=t[0].reactive)==null?void 0:te.instant_out)??"Instant out")+"",R,T,F,L=t[2][0]+"",H,K,z=t[2][1]+"",q,B,Z,V,Y=(((ue=t[0].reactive)==null?void 0:ue.total_in)??"Total in")+"",G,U,y,ne=t[3][0]+"",ee,Q,ie=t[3][1]+"",re,fe,le,de=(((be=t[0].reactive)==null?void 0:be.total_out)??"Total out")+"",oe,me,se,pe=t[4][0]+"",we,S,w=t[4][1]+"",O;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),r=p("div"),c=M(f),m=v(),_=p("div"),h=M(d),g=v(),C=M(b),k=v(),A=p("div"),R=M(I),T=v(),F=p("div"),H=M(L),K=v(),q=M(z),B=v(),Z=p("div"),V=p("div"),G=M(Y),U=v(),y=p("div"),ee=M(ne),Q=v(),re=M(ie),fe=v(),le=p("div"),oe=M(de),me=v(),se=p("div"),we=M(pe),S=v(),O=M(w),u(_,"class","text-right"),u(F,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(y,"class","text-right"),u(se,"class","text-right"),u(Z,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(ke,J){P(ke,e,J),s(e,l),s(l,i),s(e,o),s(e,a),s(a,r),s(r,c),s(a,m),s(a,_),s(_,h),s(_,g),s(_,C),s(a,k),s(a,A),s(A,R),s(a,T),s(a,F),s(F,H),s(F,K),s(F,q),s(e,B),s(e,Z),s(Z,V),s(V,G),s(Z,U),s(Z,y),s(y,ee),s(y,Q),s(y,re),s(Z,fe),s(Z,le),s(le,oe),s(Z,me),s(Z,se),s(se,we),s(se,S),s(se,O)},p(ke,[J]){var ve,ge,qe,Pe,Ae;J&1&&n!==(n=(((ve=ke[0].reactive)==null?void 0:ve.title)??"Reactive")+"")&&E(i,n),J&1&&f!==(f=(((ge=ke[0].reactive)==null?void 0:ge.instant_in)??"Instant in")+"")&&E(c,f),J&2&&d!==(d=ke[1][0]+"")&&E(h,d),J&2&&b!==(b=ke[1][1]+"")&&E(C,b),J&1&&I!==(I=(((qe=ke[0].reactive)==null?void 0:qe.instant_out)??"Instant out")+"")&&E(R,I),J&4&&L!==(L=ke[2][0]+"")&&E(H,L),J&4&&z!==(z=ke[2][1]+"")&&E(q,z),J&1&&Y!==(Y=(((Pe=ke[0].reactive)==null?void 0:Pe.total_in)??"Total in")+"")&&E(G,Y),J&8&&ne!==(ne=ke[3][0]+"")&&E(ee,ne),J&8&&ie!==(ie=ke[3][1]+"")&&E(re,ie),J&1&&de!==(de=(((Ae=ke[0].reactive)==null?void 0:Ae.total_out)??"Total out")+"")&&E(oe,de),J&16&&pe!==(pe=ke[4][0]+"")&&E(we,pe),J&16&&w!==(w=ke[4][1]+"")&&E(O,w)},i:je,o:je,d(ke){ke&&N(e)}}}function q1(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,m,_;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,o=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=ml(n,"VAr")),l(2,c=ml(i,"VAr")),l(3,m=ml(o*1e3,"VArh")),l(4,_=ml(a*1e3,"VArh")))},[r,f,c,m,_,n,i,o,a]}class E1 extends Tt{constructor(e){super(),Pt(this,e,q1,T1,Ct,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function fs(t){let e;function l(o,a){return o[3]?A1:D1}let n=l(t),i=n(t);return{c(){i.c(),e=Wt()},m(o,a){i.m(o,a),P(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&N(e),i.d(o)}}}function D1(t){var W,te,ue,be,ke;let e,l=(((W=t[4].realtime)==null?void 0:W.consumption)??"Consumption")+"",n,i,o,a,r=sl(((te=t[4].common)==null?void 0:te.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,g=t[6][1]+"",b,C,k,A=sl(((ue=t[4].common)==null?void 0:ue.day)??"Day")+"",I,R,T,F=t[7][0]+"",L,H,K=t[7][1]+"",z,q,B,Z=sl(((be=t[4].common)==null?void 0:be.month)??"Month")+"",V,Y,G,U=t[8][0]+"",y,ne,ee=t[8][1]+"",Q,ie,re,fe=(((ke=t[4].realtime)==null?void 0:ke.last_month)??"Last month")+"",le,de,oe,me=t[9][0]+"",se,pe,we=t[9][1]+"",S,w,O,D=t[5]&&us(t);return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),C=v(),k=p("div"),I=M(A),R=v(),T=p("div"),L=M(F),H=v(),z=M(K),q=v(),B=p("div"),V=M(Z),Y=v(),G=p("div"),y=M(U),ne=v(),Q=M(ee),ie=v(),re=p("div"),le=M(fe),de=v(),oe=p("div"),se=M(me),pe=v(),S=M(we),w=v(),D&&D.c(),O=Wt(),u(m,"class","text-right"),u(T,"class","text-right"),u(G,"class","text-right"),u(oe,"class","text-right"),u(o,"class","grid grid-cols-2 mb-3")},m(J,ve){P(J,e,ve),s(e,n),P(J,i,ve),P(J,o,ve),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,b),s(o,C),s(o,k),s(k,I),s(o,R),s(o,T),s(T,L),s(T,H),s(T,z),s(o,q),s(o,B),s(B,V),s(o,Y),s(o,G),s(G,y),s(G,ne),s(G,Q),s(o,ie),s(o,re),s(re,le),s(o,de),s(o,oe),s(oe,se),s(oe,pe),s(oe,S),P(J,w,ve),D&&D.m(J,ve),P(J,O,ve)},p(J,ve){var ge,qe,Pe,Ae,Le;ve&16&&l!==(l=(((ge=J[4].realtime)==null?void 0:ge.consumption)??"Consumption")+"")&&E(n,l),ve&16&&r!==(r=sl(((qe=J[4].common)==null?void 0:qe.hour)??"Hour")+"")&&E(f,r),ve&64&&_!==(_=J[6][0]+"")&&E(d,_),ve&64&&g!==(g=J[6][1]+"")&&E(b,g),ve&16&&A!==(A=sl(((Pe=J[4].common)==null?void 0:Pe.day)??"Day")+"")&&E(I,A),ve&128&&F!==(F=J[7][0]+"")&&E(L,F),ve&128&&K!==(K=J[7][1]+"")&&E(z,K),ve&16&&Z!==(Z=sl(((Ae=J[4].common)==null?void 0:Ae.month)??"Month")+"")&&E(V,Z),ve&256&&U!==(U=J[8][0]+"")&&E(y,U),ve&256&&ee!==(ee=J[8][1]+"")&&E(Q,ee),ve&16&&fe!==(fe=(((Le=J[4].realtime)==null?void 0:Le.last_month)??"Last month")+"")&&E(le,fe),ve&512&&me!==(me=J[9][0]+"")&&E(se,me),ve&512&&we!==(we=J[9][1]+"")&&E(S,we),J[5]?D?D.p(J,ve):(D=us(J),D.c(),D.m(O.parentNode,O)):D&&(D.d(1),D=null)},d(J){J&&(N(e),N(i),N(o),N(w),N(O)),D&&D.d(J)}}}function A1(t){var Ie,ye,Vt,Kt,wt,cl,ol,Ht,yt,ul;let e,l=(((Ie=t[4].common)==null?void 0:Ie.import)??"Import")+"",n,i,o,a,r=sl(((ye=t[4].common)==null?void 0:ye.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,g=t[6][1]+"",b,C,k,A,I=sl(((Vt=t[4].common)==null?void 0:Vt.day)??"Day")+"",R,T,F,L=t[7][0]+"",H,K,z=t[7][1]+"",q,B,Z,V,Y=sl(((Kt=t[4].common)==null?void 0:Kt.month)??"Month")+"",G,U,y,ne=t[8][0]+"",ee,Q,ie=t[8][1]+"",re,fe,le,de,oe=(((wt=t[4].realtime)==null?void 0:wt.last_mo)??"Last mo.")+"",me,se,pe,we=t[9][0]+"",S,w,O=t[9][1]+"",D,W,te,ue,be,ke=(((cl=t[4].common)==null?void 0:cl.export)??"Export")+"",J,ve,ge,qe,Pe=sl(((ol=t[4].common)==null?void 0:ol.hour)??"Hour")+"",Ae,Le,Ne,De=t[10][0]+"",Re,$e,xe=t[10][1]+"",ut,St,dt,rt,ot=sl(((Ht=t[4].common)==null?void 0:Ht.day)??"Day")+"",ht,Lt,Je,Fe=t[11][0]+"",He,tt,Ge=t[11][1]+"",Ve,Qe,_e,ae,Te=sl(((yt=t[4].common)==null?void 0:yt.month)??"Month")+"",Ke,Dt,vt,Xe=t[12][0]+"",qt,at,mt=t[12][1]+"",lt,Bt,el,pt,nt=(((ul=t[4].realtime)==null?void 0:ul.last_mo)??"Last mo.")+"",Yt,Jt,Ot,Zt=t[13][0]+"",$t,Gt,Qt=t[13][1]+"",ll,Ye,st,Mt=t[5]&&rs(t),It=t[5]&&cs(t),kt=t[5]&&_s(t),gt=t[5]&&ms(t),jt=t[5]&&ps(t),et=t[5]&&ds(t),Rt=t[5]&&hs(t),he=t[5]&&vs(t);return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),C=v(),Mt&&Mt.c(),k=v(),A=p("div"),R=M(I),T=v(),F=p("div"),H=M(L),K=v(),q=M(z),B=v(),It&&It.c(),Z=v(),V=p("div"),G=M(Y),U=v(),y=p("div"),ee=M(ne),Q=v(),re=M(ie),fe=v(),kt&&kt.c(),le=v(),de=p("div"),me=M(oe),se=v(),pe=p("div"),S=M(we),w=v(),D=M(O),W=v(),gt&>.c(),ue=v(),be=p("strong"),J=M(ke),ve=v(),ge=p("div"),qe=p("div"),Ae=M(Pe),Le=v(),Ne=p("div"),Re=M(De),$e=v(),ut=M(xe),St=v(),jt&&jt.c(),dt=v(),rt=p("div"),ht=M(ot),Lt=v(),Je=p("div"),He=M(Fe),tt=v(),Ve=M(Ge),Qe=v(),et&&et.c(),_e=v(),ae=p("div"),Ke=M(Te),Dt=v(),vt=p("div"),qt=M(Xe),at=v(),lt=M(mt),Bt=v(),Rt&&Rt.c(),el=v(),pt=p("div"),Yt=M(nt),Jt=v(),Ot=p("div"),$t=M(Zt),Gt=v(),ll=M(Qt),Ye=v(),he&&he.c(),u(m,"class","text-right"),u(F,"class","text-right"),u(y,"class","text-right"),u(pe,"class","text-right"),u(o,"class",te="grid grid-cols-"+t[14]+" mb-3"),u(Ne,"class","text-right"),u(Je,"class","text-right"),u(vt,"class","text-right"),u(Ot,"class","text-right"),u(ge,"class",st="grid grid-cols-"+t[14])},m(Ee,$){P(Ee,e,$),s(e,n),P(Ee,i,$),P(Ee,o,$),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,b),s(o,C),Mt&&Mt.m(o,null),s(o,k),s(o,A),s(A,R),s(o,T),s(o,F),s(F,H),s(F,K),s(F,q),s(o,B),It&&It.m(o,null),s(o,Z),s(o,V),s(V,G),s(o,U),s(o,y),s(y,ee),s(y,Q),s(y,re),s(o,fe),kt&&kt.m(o,null),s(o,le),s(o,de),s(de,me),s(o,se),s(o,pe),s(pe,S),s(pe,w),s(pe,D),s(o,W),gt&>.m(o,null),P(Ee,ue,$),P(Ee,be,$),s(be,J),P(Ee,ve,$),P(Ee,ge,$),s(ge,qe),s(qe,Ae),s(ge,Le),s(ge,Ne),s(Ne,Re),s(Ne,$e),s(Ne,ut),s(ge,St),jt&&jt.m(ge,null),s(ge,dt),s(ge,rt),s(rt,ht),s(ge,Lt),s(ge,Je),s(Je,He),s(Je,tt),s(Je,Ve),s(ge,Qe),et&&et.m(ge,null),s(ge,_e),s(ge,ae),s(ae,Ke),s(ge,Dt),s(ge,vt),s(vt,qt),s(vt,at),s(vt,lt),s(ge,Bt),Rt&&Rt.m(ge,null),s(ge,el),s(ge,pt),s(pt,Yt),s(ge,Jt),s(ge,Ot),s(Ot,$t),s(Ot,Gt),s(Ot,ll),s(ge,Ye),he&&he.m(ge,null)},p(Ee,$){var Oe,it,Nt,al,_l,vl,fl,bl,gl,Pl;$&16&&l!==(l=(((Oe=Ee[4].common)==null?void 0:Oe.import)??"Import")+"")&&E(n,l),$&16&&r!==(r=sl(((it=Ee[4].common)==null?void 0:it.hour)??"Hour")+"")&&E(f,r),$&64&&_!==(_=Ee[6][0]+"")&&E(d,_),$&64&&g!==(g=Ee[6][1]+"")&&E(b,g),Ee[5]?Mt?Mt.p(Ee,$):(Mt=rs(Ee),Mt.c(),Mt.m(o,k)):Mt&&(Mt.d(1),Mt=null),$&16&&I!==(I=sl(((Nt=Ee[4].common)==null?void 0:Nt.day)??"Day")+"")&&E(R,I),$&128&&L!==(L=Ee[7][0]+"")&&E(H,L),$&128&&z!==(z=Ee[7][1]+"")&&E(q,z),Ee[5]?It?It.p(Ee,$):(It=cs(Ee),It.c(),It.m(o,Z)):It&&(It.d(1),It=null),$&16&&Y!==(Y=sl(((al=Ee[4].common)==null?void 0:al.month)??"Month")+"")&&E(G,Y),$&256&&ne!==(ne=Ee[8][0]+"")&&E(ee,ne),$&256&&ie!==(ie=Ee[8][1]+"")&&E(re,ie),Ee[5]?kt?kt.p(Ee,$):(kt=_s(Ee),kt.c(),kt.m(o,le)):kt&&(kt.d(1),kt=null),$&16&&oe!==(oe=(((_l=Ee[4].realtime)==null?void 0:_l.last_mo)??"Last mo.")+"")&&E(me,oe),$&512&&we!==(we=Ee[9][0]+"")&&E(S,we),$&512&&O!==(O=Ee[9][1]+"")&&E(D,O),Ee[5]?gt?gt.p(Ee,$):(gt=ms(Ee),gt.c(),gt.m(o,null)):gt&&(gt.d(1),gt=null),$&16384&&te!==(te="grid grid-cols-"+Ee[14]+" mb-3")&&u(o,"class",te),$&16&&ke!==(ke=(((vl=Ee[4].common)==null?void 0:vl.export)??"Export")+"")&&E(J,ke),$&16&&Pe!==(Pe=sl(((fl=Ee[4].common)==null?void 0:fl.hour)??"Hour")+"")&&E(Ae,Pe),$&1024&&De!==(De=Ee[10][0]+"")&&E(Re,De),$&1024&&xe!==(xe=Ee[10][1]+"")&&E(ut,xe),Ee[5]?jt?jt.p(Ee,$):(jt=ps(Ee),jt.c(),jt.m(ge,dt)):jt&&(jt.d(1),jt=null),$&16&&ot!==(ot=sl(((bl=Ee[4].common)==null?void 0:bl.day)??"Day")+"")&&E(ht,ot),$&2048&&Fe!==(Fe=Ee[11][0]+"")&&E(He,Fe),$&2048&&Ge!==(Ge=Ee[11][1]+"")&&E(Ve,Ge),Ee[5]?et?et.p(Ee,$):(et=ds(Ee),et.c(),et.m(ge,_e)):et&&(et.d(1),et=null),$&16&&Te!==(Te=sl(((gl=Ee[4].common)==null?void 0:gl.month)??"Month")+"")&&E(Ke,Te),$&4096&&Xe!==(Xe=Ee[12][0]+"")&&E(qt,Xe),$&4096&&mt!==(mt=Ee[12][1]+"")&&E(lt,mt),Ee[5]?Rt?Rt.p(Ee,$):(Rt=hs(Ee),Rt.c(),Rt.m(ge,el)):Rt&&(Rt.d(1),Rt=null),$&16&&nt!==(nt=(((Pl=Ee[4].realtime)==null?void 0:Pl.last_mo)??"Last mo.")+"")&&E(Yt,nt),$&8192&&Zt!==(Zt=Ee[13][0]+"")&&E($t,Zt),$&8192&&Qt!==(Qt=Ee[13][1]+"")&&E(ll,Qt),Ee[5]?he?he.p(Ee,$):(he=vs(Ee),he.c(),he.m(ge,null)):he&&(he.d(1),he=null),$&16384&&st!==(st="grid grid-cols-"+Ee[14])&&u(ge,"class",st)},d(Ee){Ee&&(N(e),N(i),N(o),N(ue),N(be),N(ve),N(ge)),Mt&&Mt.d(),It&&It.d(),kt&&kt.d(),gt&>.d(),jt&&jt.d(),et&&et.d(),Rt&&Rt.d(),he&&he.d()}}}function us(t){var se,pe,we,S,w,O;let e,l=(((se=t[4].realtime)==null?void 0:se.cost)??"Cost")+"",n,i,o,a,r=sl(((pe=t[4].common)==null?void 0:pe.hour)??"Hour")+"",f,c,m,_=tl(t[1].h.c,2)+"",d,h,g,b,C,k=sl(((we=t[4].common)==null?void 0:we.day)??"Day")+"",A,I,R,T=tl(t[1].d.c,1)+"",F,L,H,K,z,q=sl(((S=t[4].common)==null?void 0:S.month)??"Month")+"",B,Z,V,Y=tl(t[1].m.c)+"",G,U,y,ne,ee,Q=(((w=t[4].realtime)==null?void 0:w.last_month)??"Last month")+"",ie,re,fe,le=tl((O=t[0].last_month)==null?void 0:O.c)+"",de,oe,me;return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),g=M(t[2]),b=v(),C=p("div"),A=M(k),I=v(),R=p("div"),F=M(T),L=v(),H=M(t[2]),K=v(),z=p("div"),B=M(q),Z=v(),V=p("div"),G=M(Y),U=v(),y=M(t[2]),ne=v(),ee=p("div"),ie=M(Q),re=v(),fe=p("div"),de=M(le),oe=v(),me=M(t[2]),u(m,"class","text-right"),u(R,"class","text-right"),u(V,"class","text-right"),u(fe,"class","text-right"),u(o,"class","grid grid-cols-2")},m(D,W){P(D,e,W),s(e,n),P(D,i,W),P(D,o,W),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,g),s(o,b),s(o,C),s(C,A),s(o,I),s(o,R),s(R,F),s(R,L),s(R,H),s(o,K),s(o,z),s(z,B),s(o,Z),s(o,V),s(V,G),s(V,U),s(V,y),s(o,ne),s(o,ee),s(ee,ie),s(o,re),s(o,fe),s(fe,de),s(fe,oe),s(fe,me)},p(D,W){var te,ue,be,ke,J,ve;W&16&&l!==(l=(((te=D[4].realtime)==null?void 0:te.cost)??"Cost")+"")&&E(n,l),W&16&&r!==(r=sl(((ue=D[4].common)==null?void 0:ue.hour)??"Hour")+"")&&E(f,r),W&2&&_!==(_=tl(D[1].h.c,2)+"")&&E(d,_),W&4&&E(g,D[2]),W&16&&k!==(k=sl(((be=D[4].common)==null?void 0:be.day)??"Day")+"")&&E(A,k),W&2&&T!==(T=tl(D[1].d.c,1)+"")&&E(F,T),W&4&&E(H,D[2]),W&16&&q!==(q=sl(((ke=D[4].common)==null?void 0:ke.month)??"Month")+"")&&E(B,q),W&2&&Y!==(Y=tl(D[1].m.c)+"")&&E(G,Y),W&4&&E(y,D[2]),W&16&&Q!==(Q=(((J=D[4].realtime)==null?void 0:J.last_month)??"Last month")+"")&&E(ie,Q),W&1&&le!==(le=tl((ve=D[0].last_month)==null?void 0:ve.c)+"")&&E(de,le),W&4&&E(me,D[2])},d(D){D&&(N(e),N(i),N(o))}}}function rs(t){let e,l=tl(t[1].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].h.c,2)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function cs(t){let e,l=tl(t[1].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].d.c,1)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function _s(t){let e,l=tl(t[1].m.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].m.c)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function ms(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),s(e,n),s(e,i),s(e,o)},p(r,f){var c;f&1&&l!==(l=tl((c=r[0].last_month)==null?void 0:c.c)+"")&&E(n,l),f&4&&E(o,r[2])},d(r){r&&N(e)}}}function ps(t){let e,l=tl(t[1].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].h.i,2)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function ds(t){let e,l=tl(t[1].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].d.i,1)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function hs(t){let e,l=tl(t[1].m.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].m.i)+"")&&E(n,l),r&4&&E(o,a[2])},d(a){a&&N(e)}}}function vs(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),s(e,n),s(e,i),s(e,o)},p(r,f){var c;f&1&&l!==(l=tl((c=r[0].last_month)==null?void 0:c.i)+"")&&E(n,l),f&4&&E(o,r[2])},d(r){r&&N(e)}}}function L1(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,o,a,r,f,c=t[1]&&fs(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),c&&c.m(e,null)},p(_,[d]){var h;d&16&&n!==(n=(((h=_[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&E(i,n),_[1]?c?c.p(_,d):(c=fs(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:je,o:je,d(_){_&&N(e),c&&c.d()}}}function O1(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,m,_,d,h,g,b,C=!1,k=3;return t.$$set=A=>{"sysinfo"in A&&l(0,n=A.sysinfo),"data"in A&&l(1,i=A.data),"currency"in A&&l(2,o=A.currency),"hasExport"in A&&l(3,a=A.hasExport),"translations"in A&&l(4,r=A.translations)},t.$$.update=()=>{var A,I,R,T,F,L,H,K;t.$$.dirty&35&&(l(5,C=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,k=C?3:2),l(6,f=ml(((A=i==null?void 0:i.h)==null?void 0:A.u)*1e3,"Wh")),l(7,c=ml(((I=i==null?void 0:i.d)==null?void 0:I.u)*1e3,"Wh")),l(8,m=ml(((R=i==null?void 0:i.m)==null?void 0:R.u)*1e3,"Wh")),l(9,_=ml(((T=n==null?void 0:n.last_month)==null?void 0:T.u)*1e3,"Wh")),l(10,d=ml(((F=i==null?void 0:i.h)==null?void 0:F.p)*1e3,"Wh")),l(11,h=ml(((L=i==null?void 0:i.d)==null?void 0:L.p)*1e3,"Wh")),l(12,g=ml(((H=i==null?void 0:i.m)==null?void 0:H.p)*1e3,"Wh")),l(13,b=ml(((K=n==null?void 0:n.last_month)==null?void 0:K.p)*1e3,"Wh")))},[n,i,o,a,r,C,f,c,m,_,d,h,g,b,k]}class I1 extends Tt{constructor(e){super(),Pt(this,e,O1,L1,Ct,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function bs(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function R1(t){let e,l,n=t[0].points&&t[0].points.length>0&&bs(t);return{c(){n&&n.c(),e=Wt()},m(i,o){n&&n.m(i,o),P(i,e,o),l=!0},p(i,[o]){i[0].points&&i[0].points.length>0?n?(n.p(i,o),o&1&&X(n,1)):(n=bs(i),n.c(),X(n,1),n.m(e.parentNode,e)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d(i)}}}function F1(t,e,l){let{title:n}=e,{json:i}=e,o={},a,r,f=document.documentElement.classList.contains("dark"),c=new Date;return so(()=>{let m;function _(){l(5,c=new Date),m=setTimeout(()=>{_()},(15-c.getMinutes()%15)*6e4)}return _(),()=>{clearTimeout(m)}}),t.$$set=m=>{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json)},t.$$.update=()=>{var m,_;if(t.$$.dirty&62&&((m=i==null?void 0:i.prices)==null?void 0:m.length)>0){l(5,c=new Date);let d=i==null?void 0:i.currency,h=0,g=[],b=[],C=[];l(4,r=l(3,a=0));let k=Math.floor((c.getHours()*60+c.getMinutes())/(i==null?void 0:i.resolution));for(c.setMinutes(Math.floor(c.getMinutes()/(i==null?void 0:i.resolution))*(i==null?void 0:i.resolution),0,0);k<((_=i==null?void 0:i.prices)==null?void 0:_.length)&&(h=i.prices[k],h!=null);)b.push({label:C.length>0&&(i==null?void 0:i.resolution)<60&&c.getMinutes()!=0?"":Ft(c.getHours())}),C.push(h*100),l(4,r=Math.min(r,h*100)),l(3,a=Math.max(a,h*100)),S0(c,i==null?void 0:i.resolution),k++;let A=li(Math.max(Math.abs(r)/100,Math.abs(a)/100),d);if(A&&A[1]&&A[1]!=d)for(d=A[1],l(4,r*=100),l(3,a*=100),k=0;k=0?L.toFixed(H):"",title:L>=0?L.toFixed(2)+" "+d:"",value:h>=0?Math.abs(h):0,label2:L<0?L.toFixed(H):"",title2:L<0?L.toFixed(2)+" "+d:"",value2:h<0?Math.abs(h):0,color:f?"#5c2da5":"#7c3aed"})}let R=Math.max(a,Math.abs(r));if(r<0){l(4,r=Math.min(R/4*-1,r));let L=Math.ceil(Math.abs(r)/R*4),H=r/L;for(k=1;k{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let g=new Date,b=new Date;b.setDate(0),b.setHours(12);let C=(b.getHours()-b.getUTCHours())%24-o.clock_offset,k=g.getUTCHours();for(Cn(g,-C-24),m=k;m<24;m++){let T=i["i"+Ft(m)],F=i["e"+Ft(m)];T===void 0&&(T=0),F===void 0&&(F=0),d.push({label:Ft(g.getHours())}),h.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:F.toFixed(1),title2:F.toFixed(2)+" kWh",value2:F*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,F*10)),l(4,r=Math.max(r,T*10)),Cn(g,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let g=new Date,b=new Date;b.setDate(0),b.setHours(12);let C=(b.getHours()-b.getUTCHours())%24-o.clock_offset;for(Cn(g,-C),Cn(b,-C),m=g.getDate();m<=b.getDate();m++){let R=i["i"+Ft(m)],T=i["e"+Ft(m)];R===void 0&&(R=0),T===void 0&&(T=0),d.push({label:Ft(m)}),h.push({label:R.toFixed(R<10?1:0),title:R.toFixed(2)+" kWh",value:R,label2:T.toFixed(T<10?1:0),title2:T.toFixed(2)+" kWh",value2:T,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,T)),l(4,r=Math.max(r,R))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],d=[],h=[];i.s&&i.s.forEach((C,k)=>{var A=C.n?C.n:C.a;m=C.v,m==-127&&(m=0),d.push({label:A.slice(-4)}),h.push({label:m.toFixed(1),value:m,color:o?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,r=Math.max(r,m))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let g=r;f<0&&(g+=Math.abs(f));let b=g/4;for(c=0;c<5;c++)m=f+b*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,r,f]}class V1 extends Tt{constructor(e){super(),Pt(this,e,G1,W1,Ct,{title:1,json:2})}}function K1(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}let Y1=0;function Q1(t,e,l){let{title:n}=e,{translations:i={}}=e,o=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e,{realtime:c}=e;return t.$$set=m=>{"title"in m&&l(1,n=m.title),"translations"in m&&l(2,i=m.translations),"tariffData"in m&&l(3,f=m.tariffData),"realtime"in m&&l(4,c=m.realtime)},t.$$.update=()=>{var m,_,d;if(t.$$.dirty&62){let h=0,g=[],b=[],C=[];if(g.push({value:0,label:0}),f&&!isNaN((m=c==null?void 0:c.h)==null?void 0:m.u)&&(C.push({label:c.h.u.toFixed(2),value:c.h.u,title:c.h.u.toFixed(2)+" kWh",color:Pi(c.h.u/f.c*100)}),b.push({label:((_=i.common)==null?void 0:_.now)??"Now"})),f&&f.p)for(h=0;h0?Ft(k.d)+"."+(i.months?(d=i.months)==null?void 0:d[new Date().getMonth()]:Ft(new Date().getMonth()+1)):"-",I=A;isNaN(k.h)||(I=I+" "+Ft(k.h)+":00"),I=I+": "+k.v.toFixed(2)+" kWh",C.push({label:k.v.toFixed(2),title:k.v.toFixed(2)+" kWh",value:k.v,title:I,color:o?"#5c2da5":"#7c3aed"}),b.push({label:A}),l(5,r=Math.max(r,k.v))}if(f&&f.t){for(h=0;h=r)break;g.push({value:k,label:k})}g.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(g.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(5,r=Math.max(r,f.c))),l(5,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:20,bottom:20,left:20},y:{min:Y1,max:r,ticks:g},x:{ticks:b},points:C})}},[a,n,i,f,c,r]}class X1 extends Tt{constructor(e){super(),Pt(this,e,Q1,K1,Ct,{title:1,translations:2,tariffData:3,realtime:4})}}let sn=0,Z1={data:[]};async function mo(){let e=await(await wl(sn<0?"realtime.json":"realtime.json?offset="+sn)).json();po.update(l=>{for(let n=0;n=0&&(sn+=e.size,snkn||Ji-kn>300?(mo(),Fi=0):po.update(t=>{if(t.lastUpdate)for(;kn>t.lastUpdate;)t.data.unshift(Qu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,Fi++;else t.lastUpdate=kn;return t})}function x1(t){if(Qu=t.i-t.e,kn=t.u,!gs){mo(),gs=!0,Ji=kn;return}J1()&&$1()}function ks(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function ws(t,e,l){const n=t.slice();return n[21]=e[l],n}function ec(t){let e,l,n;return{c(){e=p("strong"),l=M(t[0]),n=M(" not available"),u(e,"class","text-sm")},m(i,o){P(i,e,o),s(e,l),s(e,n)},p(i,o){o&1&&E(l,i[0])},d(i){i&&N(e)}}}function tc(t){let e,l,n,i,o,a,r,f=t[8]&&Cs(t);return{c(){e=p("strong"),l=M(t[0]),n=M(" ("),i=M(t[12]),o=M(")"),a=v(),f&&f.c(),r=Wt(),u(e,"class","text-sm")},m(c,m){P(c,e,m),s(e,l),s(e,n),s(e,i),s(e,o),P(c,a,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&1&&E(l,c[0]),m&4096&&E(i,c[12]),c[8]?f?f.p(c,m):(f=Cs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(r)),f&&f.d(c)}}}function Cs(t){let e,l,n,i,o,a=ft(t[8]),r=[];for(let m=0;mt[17].call(e))},m(a,r){P(a,e,r),o.m(e,null),l=Mi(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null)))},i:je,o:je,d(a){a&&N(e),o.d(),l()}}}function nc(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),o=null;po.subscribe(T=>{l(16,o=T)});let a=!1,r,f,c,m,_,d,h,g=function(T,F,L){return Math.ceil(_-(T-F)/(L-F)*_)-25},b=function(T){return 30+Math.ceil(T/o.size*(d-35))},C,k,A,I;function R(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=T=>{"title"in T&&l(0,n=T.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,d=c-35),l(10,A=d/o.size),l(2,f=0),l(1,r=0),o.data&&_>10&&d>100&&A>.1){l(11,a=!0);for(let L in o.data){let H=o.data[L];isNaN(H)&&(H=0),l(1,r=Math.max(Math.ceil(H/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(H/1e3)*1e3,f))}let T=r-f;l(12,I=r>2500?"kW":"W"),l(8,C=[]);for(let L=f;L2500?(L/1e3).toFixed(1):L}),!(C.length>6));L+=T/5);l(9,k=[]);for(let L=0;L12));L+=Math.round(o.size/Math.round(d/120)));let F=o.size;l(7,h=b(o.size)+","+g(0,f,r)+" "+b(1)+","+g(0,f,r));for(let L in o.data){if(F<0)break;let H=o.data[L];isNaN(H)&&(H=0),l(7,h=b(F--)+","+g(H,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,m,_,d,h,C,k,A,a,I,i,g,b,o,R]}class ic extends Tt{constructor(e){super(),Pt(this,e,nc,lc,Ct,{title:0})}}function oc(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function sc(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:o=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:g=0}=e,{maxImport:b=0}=e,{maxExport:C=0}=e,{importColorFn:k}=e,{exportColorFn:A}=e,I={};function R(T,F){return{label:tl(T>900?T/1e3:T)+(T>900?"k":"")+i,title:T.toFixed(2)+" "+i,value:isNaN(T)?0:T,color:k(T?T/b*100:0,document.documentElement.classList.contains("dark")),label2:tl(F>900?F/1e3:F)+(F>900?"k":"")+i,title2:F.toFixed(2)+" "+i,value2:isNaN(F)?0:F,color2:A(F?F/C*100:0)}}return t.$$set=T=>{"title"in T&&l(1,n=T.title),"unit"in T&&l(2,i=T.unit),"l1"in T&&l(3,o=T.l1),"l2"in T&&l(4,a=T.l2),"l2x"in T&&l(5,r=T.l2x),"l3"in T&&l(6,f=T.l3),"l1i"in T&&l(7,c=T.l1i),"l2i"in T&&l(8,m=T.l2i),"l3i"in T&&l(9,_=T.l3i),"l1e"in T&&l(10,d=T.l1e),"l2e"in T&&l(11,h=T.l2e),"l3e"in T&&l(12,g=T.l3e),"maxImport"in T&&l(13,b=T.maxImport),"maxExport"in T&&l(14,C=T.maxExport),"importColorFn"in T&&l(15,k=T.importColorFn),"exportColorFn"in T&&l(16,A=T.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let T=[],F=[];o&&(T.push({label:"L1"}),F.push(R(c,d))),a&&(r?(T.push({label:"L2"}),F.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(T.push({label:"L2"}),F.push(R(m,h)))),f&&(T.push({label:"L3"}),F.push(R(_,g)));let L=[];if(C){let H=C>b?4:C*4/b;L.push({value:-C,label:"-100%"}),H>=4&&L.push({value:-C/4*3,label:"-75%"}),H>=2&&L.push({value:-C/2,label:"-50%"}),H>=4&&L.push({value:-C/4,label:"-25%"})}if(L.push({value:0,label:"0%"}),b){let H=b>C?4:b*4/C;L.push({value:b/4,label:"25%"}),H>=4&&L.push({value:b/2,label:"50%"}),H>=2&&L.push({value:b/4*3,label:"75%"}),H>=4&&L.push({value:b,label:"100%"})}l(0,I={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-C,max:b,ticks:L},x:{ticks:T},points:F})}},[I,n,i,o,a,r,f,c,m,_,d,h,g,b,C,k,A]}class ho extends Tt{constructor(e){super(),Pt(this,e,sc,oc,Ct,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Ts(t){var k;let e,l,n,i,o,a,r=(t[0].mt?wi(t[0].mt):"-")+"",f,c,m,_=t[12][0]+"",d,h,g=t[12][1]+"",b,C;return i=new Yu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((k=t[7].common)==null?void 0:k.import)??"Import",sub:li(t[0].p,t[0].pc),colorFn:Pi}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(A,I){P(A,e,I),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,f),s(l,c),s(l,m),s(m,d),s(m,h),s(m,b),C=!0},p(A,I){var T;const R={};I&1&&(R.val=A[0].i?A[0].i:0),I&1&&(R.max=A[0].im?A[0].im:15e3),I&128&&(R.label=((T=A[7].common)==null?void 0:T.import)??"Import"),I&1&&(R.sub=li(A[0].p,A[0].pc)),i.$set(R),(!C||I&1)&&r!==(r=(A[0].mt?wi(A[0].mt):"-")+"")&&E(f,r),(!C||I&4096)&&_!==(_=A[12][0]+"")&&E(d,_),(!C||I&4096)&&g!==(g=A[12][1]+"")&&E(b,g)},i(A){C||(X(i.$$.fragment,A),C=!0)},o(A){x(i.$$.fragment,A),C=!1},d(A){A&&N(e),Se(i)}}}function qs(t){var b;let e,l,n,i,o,a,r,f,c=t[13][0]+"",m,_,d=t[13][1]+"",h,g;return i=new Yu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((b=t[7].common)==null?void 0:b.export)??"Export",sub:li(t[0].px,t[0].pc),colorFn:ei}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),r=v(),f=p("div"),m=M(c),_=v(),h=M(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(C,k){P(C,e,k),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(l,r),s(l,f),s(f,m),s(f,_),s(f,h),g=!0},p(C,k){var I;const A={};k&1&&(A.val=C[0].e?C[0].e:0),k&1&&(A.max=C[0].om?C[0].om*1e3:1e4),k&128&&(A.label=((I=C[7].common)==null?void 0:I.export)??"Export"),k&1&&(A.sub=li(C[0].px,C[0].pc)),i.$set(A),(!g||k&8192)&&c!==(c=C[13][0]+"")&&E(m,c),(!g||k&8192)&&d!==(d=C[13][1]+"")&&E(h,d)},i(C){g||(X(i.$$.fragment,C),g=!0)},o(C){x(i.$$.fragment,C),g=!1},d(C){C&&N(e),Se(i)}}}function Es(t){let e,l,n=t[0].l1&&Ds(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ds(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ds(t){var n;let e,l;return e=new P1({props:{title:((n=t[7].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].common)==null?void 0:r.voltage)??"Volt"),o&1&&(a.u1=i[0].l1.u),o&1&&(a.u2=i[0].l2.u),o&1&&(a.u3=i[0].l3.u),o&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function As(t){let e,l,n=t[0].l1&&Ls(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ls(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ls(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Pi,exportColorFn:ei,maxImport:t[0].mf,l1:t[9],l2:t[10],l3:t[11],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].common)==null?void 0:r.amperage)??"Amp"),o&1&&(a.maxImport=i[0].mf),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l2x=i[0].l2.e),o&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),o&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),o&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Os(t){let e,l,n=t[0].l1&&Is(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Is(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Is(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Pi,exportColorFn:ei,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[14]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].dashboard)==null?void 0:r.phase)??"Phase"),o&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),o&16385&&(a.maxExport=i[0].om?i[14]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.p),o&1&&(a.l2i=i[0].l2.p),o&1&&(a.l3i=i[0].l3.p),o&1&&(a.l1e=i[0].l1.q),o&1&&(a.l2e=i[0].l2.q),o&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Rs(t){let e,l,n=t[0].l1&&Fs(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Fs(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Fs(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:ei,exportColorFn:ei,maxImport:1,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].dashboard)==null?void 0:r.pf)??"Pf"),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.f),o&1&&(a.l2i=i[0].l2.f),o&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Bs(t){let e,l,n;return l=new E1({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function Us(t){let e,l,n;return l=new I1({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function zs(t){var i;let e,l,n;return l=new X1({props:{title:((i=t[7].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[8],realtime:t[0].ea,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt h-64")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&256&&(r.tariffData=o[8]),a&1&&(r.realtime=o[0].ea),a&128&&(r.translations=o[7]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function js(t){var i;let e,l,n;return l=new ic({props:{title:((i=t[7].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Hs(t){let e,l,n,i;const o=[fc,ac],a=[];function r(f,c){var m;return(m=f[2])!=null&&m.importExportPriceDifferent&&(f[0].om||f[0].e>0)?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function ac(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price)??"Price",json:t[2]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=o[2]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function fc(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price_import)??"Price import",json:t[2]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price_import)??"Price import"),a&4&&(r.json=o[2]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function ys(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price_export)??"Price export",json:t[3]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price_export)??"Price export"),a&8&&(r.json=o[3]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Ws(t){var i;let e,l,n;return l=new z1({props:{title:((i=t[7].dashboard)==null?void 0:i.day)??"24 hours",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.day)??"24 hours"),a&16&&(r.json=o[4]),a&2&&(r.sysinfo=o[1]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Gs(t){var i;let e,l,n;return l=new y1({props:{title:((i=t[7].dashboard)==null?void 0:i.month)??"{0} days",json:t[5],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.month)??"{0} days"),a&32&&(r.json=o[5]),a&2&&(r.sysinfo=o[1]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Vs(t){var i;let e,l,n;return l=new V1({props:{title:((i=t[7].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[6]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.temperature)??"Temperature"),a&64&&(r.json=o[6]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function uc(t){var we;let e,l=xt(t[1].ui.i,t[0].i),n,i=xt(t[1].ui.e,t[0].om||t[0].e>0),o,a=xt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=xt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=xt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,d=xt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,g=xt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),b,C=xt(t[1].ui.c,t[0].ea),k,A=xt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),I,R=xt(t[1].ui.l,t[0].hm==1),T,F=xt(t[1].ui.p,t[0].p&&!Number.isNaN(t[0].p)),L,H=((we=t[2])==null?void 0:we.importExportPriceDifferent)&&(t[0].om||t[0].e>0)&&xt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].pe)),K,z=xt(t[1].ui.d,t[4]),q,B=xt(t[1].ui.m,t[5]),Z,V=xt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[6].c>1),Y,G=l&&Ts(t),U=i&&qs(t),y=a&&Es(t),ne=f&&As(t),ee=m&&Os(t),Q=d&&Rs(t),ie=g&&Bs(t),re=C&&Us(t),fe=A&&zs(t),le=R&&js(t),de=F&&Hs(t),oe=H&&ys(t),me=z&&Ws(t),se=B&&Gs(t),pe=V&&Vs(t);return{c(){e=p("div"),G&&G.c(),n=v(),U&&U.c(),o=v(),y&&y.c(),r=v(),ne&&ne.c(),c=v(),ee&&ee.c(),_=v(),Q&&Q.c(),h=v(),ie&&ie.c(),b=v(),re&&re.c(),k=v(),fe&&fe.c(),I=v(),le&&le.c(),T=v(),de&&de.c(),L=v(),oe&&oe.c(),K=v(),me&&me.c(),q=v(),se&&se.c(),Z=v(),pe&&pe.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(S,w){P(S,e,w),G&&G.m(e,null),s(e,n),U&&U.m(e,null),s(e,o),y&&y.m(e,null),s(e,r),ne&&ne.m(e,null),s(e,c),ee&&ee.m(e,null),s(e,_),Q&&Q.m(e,null),s(e,h),ie&&ie.m(e,null),s(e,b),re&&re.m(e,null),s(e,k),fe&&fe.m(e,null),s(e,I),le&&le.m(e,null),s(e,T),de&&de.m(e,null),s(e,L),oe&&oe.m(e,null),s(e,K),me&&me.m(e,null),s(e,q),se&&se.m(e,null),s(e,Z),pe&&pe.m(e,null),Y=!0},p(S,[w]){var O;w&3&&(l=xt(S[1].ui.i,S[0].i)),l?G?(G.p(S,w),w&3&&X(G,1)):(G=Ts(S),G.c(),X(G,1),G.m(e,n)):G&&(ct(),x(G,1,1,()=>{G=null}),_t()),w&3&&(i=xt(S[1].ui.e,S[0].om||S[0].e>0)),i?U?(U.p(S,w),w&3&&X(U,1)):(U=qs(S),U.c(),X(U,1),U.m(e,o)):U&&(ct(),x(U,1,1,()=>{U=null}),_t()),w&3&&(a=xt(S[1].ui.v,S[0].l1&&(S[0].l1.u>100||S[0].l2.u>100||S[0].l3.u>100))),a?y?(y.p(S,w),w&3&&X(y,1)):(y=Es(S),y.c(),X(y,1),y.m(e,r)):y&&(ct(),x(y,1,1,()=>{y=null}),_t()),w&3&&(f=xt(S[1].ui.a,S[0].l1&&(S[0].l1.i>.01||S[0].l2.i>.01||S[0].l3.i>.01))),f?ne?(ne.p(S,w),w&3&&X(ne,1)):(ne=As(S),ne.c(),X(ne,1),ne.m(e,c)):ne&&(ct(),x(ne,1,1,()=>{ne=null}),_t()),w&3&&(m=xt(S[1].ui.h,S[0].l1&&(S[0].l1.p>.01||S[0].l2.p>.01||S[0].l3.p>.01||S[0].l1.q>.01||S[0].l2.q>.01||S[0].l3.q>.01))),m?ee?(ee.p(S,w),w&3&&X(ee,1)):(ee=Os(S),ee.c(),X(ee,1),ee.m(e,_)):ee&&(ct(),x(ee,1,1,()=>{ee=null}),_t()),w&3&&(d=xt(S[1].ui.f,S[0].l1&&(S[0].l1.f>.01||S[0].l2.f>.01||S[0].l3.f>.01))),d?Q?(Q.p(S,w),w&3&&X(Q,1)):(Q=Rs(S),Q.c(),X(Q,1),Q.m(e,h)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),w&3&&(g=xt(S[1].ui.r,S[0].ri>0||S[0].re>0||S[0].ric>0||S[0].rec>0)),g?ie?(ie.p(S,w),w&3&&X(ie,1)):(ie=Bs(S),ie.c(),X(ie,1),ie.m(e,b)):ie&&(ct(),x(ie,1,1,()=>{ie=null}),_t()),w&3&&(C=xt(S[1].ui.c,S[0].ea)),C?re?(re.p(S,w),w&3&&X(re,1)):(re=Us(S),re.c(),X(re,1),re.m(e,k)):re&&(ct(),x(re,1,1,()=>{re=null}),_t()),w&3&&(A=xt(S[1].ui.t,S[0].pr&&(S[0].pr.startsWith("NO")||S[0].pr.startsWith("10YNO")||S[0].pr.startsWith("10Y1001A1001A4")))),A?fe?(fe.p(S,w),w&3&&X(fe,1)):(fe=zs(S),fe.c(),X(fe,1),fe.m(e,I)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),w&3&&(R=xt(S[1].ui.l,S[0].hm==1)),R?le?(le.p(S,w),w&3&&X(le,1)):(le=js(S),le.c(),X(le,1),le.m(e,T)):le&&(ct(),x(le,1,1,()=>{le=null}),_t()),w&3&&(F=xt(S[1].ui.p,S[0].p&&!Number.isNaN(S[0].p))),F?de?(de.p(S,w),w&3&&X(de,1)):(de=Hs(S),de.c(),X(de,1),de.m(e,L)):de&&(ct(),x(de,1,1,()=>{de=null}),_t()),w&7&&(H=((O=S[2])==null?void 0:O.importExportPriceDifferent)&&(S[0].om||S[0].e>0)&&xt(S[1].ui.p,S[0].pe&&!Number.isNaN(S[0].pe))),H?oe?(oe.p(S,w),w&7&&X(oe,1)):(oe=ys(S),oe.c(),X(oe,1),oe.m(e,K)):oe&&(ct(),x(oe,1,1,()=>{oe=null}),_t()),w&18&&(z=xt(S[1].ui.d,S[4])),z?me?(me.p(S,w),w&18&&X(me,1)):(me=Ws(S),me.c(),X(me,1),me.m(e,q)):me&&(ct(),x(me,1,1,()=>{me=null}),_t()),w&34&&(B=xt(S[1].ui.m,S[5])),B?se?(se.p(S,w),w&34&&X(se,1)):(se=Gs(S),se.c(),X(se,1),se.m(e,Z)):se&&(ct(),x(se,1,1,()=>{se=null}),_t()),w&67&&(V=xt(S[1].ui.s,S[0].t&&S[0].t!=-127&&S[6].c>1)),V?pe?(pe.p(S,w),w&67&&X(pe,1)):(pe=Vs(S),pe.c(),X(pe,1),pe.m(e,null)):pe&&(ct(),x(pe,1,1,()=>{pe=null}),_t())},i(S){Y||(X(G),X(U),X(y),X(ne),X(ee),X(Q),X(ie),X(re),X(fe),X(le),X(de),X(oe),X(me),X(se),X(pe),Y=!0)},o(S){x(G),x(U),x(y),x(ne),x(ee),x(Q),x(ie),x(re),x(fe),x(le),x(de),x(oe),x(me),x(se),x(pe),Y=!1},d(S){S&&N(e),G&&G.d(),U&&U.d(),y&&y.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),re&&re.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),me&&me.d(),se&&se.d(),pe&&pe.d()}}}function rc(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{importPrices:o={}}=e,{exportPrices:a={}}=e,{dayPlot:r={}}=e,{monthPlot:f={}}=e,{temperatures:c={}}=e,{translations:m={}}=e,{tariffData:_={}}=e,d,h,g,b,C,k;return t.$$set=A=>{"data"in A&&l(0,n=A.data),"sysinfo"in A&&l(1,i=A.sysinfo),"importPrices"in A&&l(2,o=A.importPrices),"exportPrices"in A&&l(3,a=A.exportPrices),"dayPlot"in A&&l(4,r=A.dayPlot),"monthPlot"in A&&l(5,f=A.monthPlot),"temperatures"in A&&l(6,c=A.temperatures),"translations"in A&&l(7,m=A.translations),"tariffData"in A&&l(8,_=A.tariffData)},t.$$.update=()=>{var A,I,R,T,F,L,H,K,z,q,B,Z,V,Y,G;t.$$.dirty&3585&&(l(12,d=ml((n==null?void 0:n.ic)*1e3,"Wh")),l(13,h=ml((n==null?void 0:n.ec)*1e3,"Wh")),((A=n==null?void 0:n.l1)==null?void 0:A.u)==0&&((I=n==null?void 0:n.l2)==null?void 0:I.u)==0&&((R=n==null?void 0:n.l3)==null?void 0:R.u)==0?l(9,b=l(10,C=l(11,k=l(14,g=!0)))):(l(9,b=((T=n==null?void 0:n.l1)==null?void 0:T.u)>0||((F=n==null?void 0:n.l1)==null?void 0:F.i)>0||((L=n==null?void 0:n.l1)==null?void 0:L.p)>0||((H=n==null?void 0:n.l1)==null?void 0:H.q)>0),l(10,C=((K=n==null?void 0:n.l2)==null?void 0:K.u)>0||((z=n==null?void 0:n.l2)==null?void 0:z.i)>0||((q=n==null?void 0:n.l2)==null?void 0:q.p)>0||((B=n==null?void 0:n.l2)==null?void 0:B.q)>0),l(11,k=((Z=n==null?void 0:n.l3)==null?void 0:Z.u)>0||((V=n==null?void 0:n.l3)==null?void 0:V.i)>0||((Y=n==null?void 0:n.l3)==null?void 0:Y.p)>0||((G=n==null?void 0:n.l3)==null?void 0:G.q)>0),l(14,g=b&&C&&k)))},[n,i,o,a,r,f,c,m,_,b,C,k,d,h,g]}class cc extends Tt{constructor(e){super(),Pt(this,e,rc,uc,Ct,{data:0,sysinfo:1,importPrices:2,exportPrices:3,dayPlot:4,monthPlot:5,temperatures:6,translations:7,tariffData:8})}}let $i={};const Xn=rl($i);async function _c(){$i=await(await fetch("configuration.json")).json(),Xn.set($i)}let xi={};const Xu=rl(xi);async function mc(){xi=await(await fetch("priceconfig.json")).json(),Xu.set(xi)}function Ks(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Ys(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,j(e,e.__value),n.__value=113,j(n,n.__value)},m(i,o){P(i,e,o),P(i,l,o),P(i,n,o)},d(i){i&&(N(e),N(l),N(n))}}}function Qs(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],j(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Xs(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Qs(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Qs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function pc(t){let e,l,n,i,o=t[0]=="esp8266"&&Ys(),a=ft({length:t[1]+1}),r=[];for(let f=0;f{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class eo extends Tt{constructor(e){super(),Pt(this,e,dc,pc,Ct,{chip:0})}}function Zs(t){let e,l,n=t[1]&&Js(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){P(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Js(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function Js(t){let e,l;return{c(){e=p("div"),l=M(t[1]),u(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,e,i),s(e,l)},p(n,i){i&2&&E(l,n[1])},d(n){n&&N(e)}}}function hc(t){let e,l=t[0]&&Zs(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Zs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:je,o:je,d(n){n&&N(e),l&&l.d(n)}}}function vc(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class pl extends Tt{constructor(e){super(),Pt(this,e,vc,hc,Ct,{active:0,message:1})}}function $s(t,e,l){const n=t.slice();return n[1]=e[l],n}function xs(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=M("Europe/"),i=M(n),e.__value="Europe/"+t[1],j(e,e.__value)},m(o,a){P(o,e,a),s(e,l),s(e,i)},p:je,d(o){o&&N(e)}}}function bc(t){let e,l,n,i=ft(t[0]),o=[];for(let a=0;a>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^T.EXPONENT[H._modN(T.LOG[D[w]]+S)]:D[w-1];D[0]=T.EXPONENT[H._modN(T.LOG[D[0]]+S)]}for(S=0;S<=O;S++)D[S]=T.LOG[D[S]]},_checkBadness:function(){var S,w,O,D,W,te=0,ue=this._badness,be=this.buffer,ke=this.width;for(W=0;Wke*ke;)ge-=ke*ke,ve++;for(te+=ve*H.N4,D=0;D=ue-2&&(S=ue-2,W>9&&S--);var be=S;if(W>9){for(te[be+2]=0,te[be+3]=0;be--;)w=te[be],te[be+3]|=255&w<<4,te[be+2]=w>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[be+1]=0,te[be+2]=0;be--;)w=te[be],te[be+2]|=255&w<<4,te[be+1]=w>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(be=S+3-(W<10);be=5&&(O+=H.N1+D[w]-5);for(w=3;wS||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(O+=H.N3);return O},_finish:function(){this._stringBuffer=this.buffer.slice();var S,w,O=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),S=this._checkBadness(),S>=1)D&1&&(W[te-1-w+te*8]=1,w<6?W[8+te*w]=1:W[8+te*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(W[8+te*(te-7+w)]=1,w?W[6-w+te*8]=1:W[7+te*8]=1)},_interleaveBlocks:function(){var S,w,O=this._dataBlock,D=this._ecc,W=this._eccBlock,te=0,ue=this._calculateMaxLength(),be=this._neccBlock1,ke=this._neccBlock2,J=this._stringBuffer;for(S=0;S1)for(S=k.BLOCK[D],O=W-7;;){for(w=W-7;w>S-3&&(this._addAlignment(w,O),!(w6)for(S=L.BLOCK[te-7],w=17,O=0;O<6;O++)for(D=0;D<3;D++,w--)1&(w>11?te>>w-12:S>>w)?(W[5-O+ue*(2-D+ue-11)]=1,W[2-D+ue-11+ue*(5-O)]=1):(this._setMask(5-O,2-D+ue-11),this._setMask(2-D+ue-11,5-O))},_isMasked:function(S,w){var O=H._getMaskBit(S,w);return this._mask[O]===1},_pack:function(){var S,w,O,D=1,W=1,te=this.width,ue=te-1,be=te-1,ke=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(O=S,S=w,w=O),O=w,O+=w*w,O>>=1,O+=S,O},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),K=H,z=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),q=z,B=_.extend(function(S,w,O,D){this.name=S,this.modifiable=!!w,this.defaultValue=O,this._valueTransformer=D},{transform:function(S){var w=this._valueTransformer;return typeof w=="function"?w(S,this):S}}),Z=B,V=_.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,w){return Object.prototype.hasOwnProperty.call(S,w)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),Y=V,G=_.extend(function(S){this.options={},S.forEach(function(w){this.options[w.name]=w},this)},{exists:function(S){return this.options[S]!=null},get:function(S,w){return G._get(this.options[S],w)},getAll:function(S){var w,O=this.options,D={};for(w in O)Y.hasOwn(O,w)&&(D[w]=G._get(O[w],S));return D},init:function(S,w,O){typeof O!="function"&&(O=Y.noop);var D,W;for(D in this.options)Y.hasOwn(this.options,D)&&(W=this.options[D],G._set(W,W.defaultValue,w),G._createAccessor(W,w,O));this._setAll(S,w,!0)},set:function(S,w,O){return this._set(S,w,O)},setAll:function(S,w){return this._setAll(S,w)},_set:function(S,w,O,D){var W=this.options[S];if(!W)throw new Error("Invalid option: "+S);if(!W.modifiable&&!D)throw new Error("Option cannot be modified: "+S);return G._set(W,w,O)},_setAll:function(S,w,O){if(!S)return!1;var D,W=!1;for(D in S)Y.hasOwn(S,D)&&this._set(D,S[D],w,O)&&(W=!0);return W}},{_createAccessor:function(S,w,O){var D={get:function(){return G._get(S,w)}};S.modifiable&&(D.set=function(W){G._set(S,W,w)&&O(W,S)}),Object.defineProperty(w,S.name,D)},_get:function(S,w){return w["_"+S.name]},_set:function(S,w,O){var D="_"+S.name,W=O[D],te=S.transform(w??S.defaultValue);return O[D]=te,te!==W}}),U=G,y=_.extend(function(){this._services={}},{getService:function(S){var w=this._services[S];if(!w)throw new Error("Service is not being managed with name: "+S);return w},setService:function(S,w){if(this._services[S])throw new Error("Service is already managed with name: "+S);w&&(this._services[S]=w)}}),ne=y,ee=new U([new Z("background",!0,"white"),new Z("backgroundAlpha",!0,1,Y.abs),new Z("element"),new Z("foreground",!0,"black"),new Z("foregroundAlpha",!0,1,Y.abs),new Z("level",!0,"L",Y.toUpperCase),new Z("mime",!0,"image/png"),new Z("padding",!0,null,Y.abs),new Z("size",!0,100,Y.abs),new Z("value",!0,"")]),Q=new ne,ie=_.extend(function(S){ee.init(S,this,this.update.bind(this));var w=ee.get("element",this),O=Q.getService("element"),D=w&&O.isCanvas(w)?w:O.createCanvas(),W=w&&O.isImage(w)?w:O.createImage();this._canvasRenderer=new b(this,D,!0),this._imageRenderer=new q(this,W,W===w),this.update()},{get:function(){return ee.getAll(this)},set:function(S){ee.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new K({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){Q.setService(S.getName(),S)}});Object.defineProperties(ie.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var re=ie,fe=re,le=_.extend({getName:function(){}}),de=le,oe=de.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),me=oe,se=me.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),pe=se;fe.use(new pe);var we=fe;return we})})(Ju);var Mc=Ju.exports;const Nc=Sc(Mc);function Pc(t){let e,l;return{c(){e=p("img"),hi(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!hi(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:je,o:je,d(n){n&&N(e)}}}function Tc(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:o="#000"}=e,{size:a="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function d(){_.set({background:i,foreground:o,level:n,padding:f,size:a,value:r}),l(2,m=_.toDataURL("image/jpeg"))}function h(){return m}return so(()=>{l(9,_=new Nc),r&&d()}),t.$$set=g=>{"errorCorrection"in g&&l(3,n=g.errorCorrection),"background"in g&&l(4,i=g.background),"color"in g&&l(5,o=g.color),"size"in g&&l(6,a=g.size),"value"in g&&l(0,r=g.value),"padding"in g&&l(7,f=g.padding),"className"in g&&l(1,c=g.className)},t.$$.update=()=>{t.$$.dirty&513&&r&&_&&d()},[r,c,m,n,i,o,a,f,h,_]}class qc extends Tt{constructor(e){super(),Pt(this,e,Tc,Pc,Ct,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function ea(t,e,l){const n=t.slice();return n[126]=e[l],n}function ta(t,e,l){const n=t.slice();return n[129]=e[l],n[130]=e,n[131]=l,n}function la(t,e,l){const n=t.slice();return n[132]=e[l],n[133]=e,n[134]=l,n}function na(t,e,l){const n=t.slice();return n[135]=e[l],n}function Ec(t,e,l){const n=t.slice();return n[138]=e[l],n}function Dc(t,e,l){const n=t.slice();return n[141]=e[l],n}function Ac(t,e,l){const n=t.slice();return n[144]=e[l],n}function ia(t){var ul,Ee,$,Oe,it,Nt,al,_l,vl,fl,bl,gl,Pl,Rl,Fl,Bl,Ul,zl,jl,Hl,yl,Wl,Gl,Vl,Kl,Yl,We,bt;let e,l,n=(((Ee=(ul=t[2].conf)==null?void 0:ul.general)==null?void 0:Ee.title)??"General")+"",i,o,a,r,f,c,m,_,d,h=(((Oe=($=t[2].conf)==null?void 0:$.general)==null?void 0:Oe.hostname)??"Hostname")+"",g,b,C,k,A,I,R=(((Nt=(it=t[2].conf)==null?void 0:it.general)==null?void 0:Nt.timezone)??"Time zone")+"",T,F,L,H,K,z,q,B,Z,V,Y,G=(((_l=(al=t[2].conf)==null?void 0:al.price)==null?void 0:_l.region)??"Price region")+"",U,y,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe,we,S,w,O,D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e=(((fl=(vl=t[2].conf)==null?void 0:vl.price)==null?void 0:fl.resolution)??"Resolution")+"",xe,ut,St,dt,rt,ot,ht=(((gl=(bl=t[2].conf)==null?void 0:bl.price)==null?void 0:gl.currency)??"Currency")+"",Lt,Je,Fe,He,tt,Ge,Ve,Qe,_e,ae,Te,Ke,Dt=(((Rl=(Pl=t[2].conf)==null?void 0:Pl.price)==null?void 0:Rl.enabled)??"Enabled")+"",vt,Xe,qt,at,mt=(((Ul=(Bl=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:Bl.security)==null?void 0:Ul.title)??"Security")+"",lt,Bt,el,pt,nt,Yt=(((Hl=(jl=(zl=t[2].conf)==null?void 0:zl.general)==null?void 0:jl.security)==null?void 0:Hl.none)??"None")+"",Jt,Ot,Zt=(((Gl=(Wl=(yl=t[2].conf)==null?void 0:yl.general)==null?void 0:Wl.security)==null?void 0:Gl.conf)??"Conf")+"",$t,Gt,Qt=(((Yl=(Kl=(Vl=t[2].conf)==null?void 0:Vl.general)==null?void 0:Kl.security)==null?void 0:Yl.all)??"All")+"",ll,Ye,st,Mt,It=(((bt=(We=t[2].conf)==null?void 0:We.general)==null?void 0:bt.context)??"Context")+"",kt,gt,jt,et,Rt,he,Ie,ye;K=new kc({});let Vt=!t[6].p.t&&oa(),Kt=ft([15,60]),wt=[];for(let Ue=0;Ue<2;Ue+=1)wt[Ue]=Lc(Ac(t,Kt,Ue));let cl=ft(["NOK","SEK","DKK","EUR","CHF"]),ol=[];for(let Ue=0;Ue<5;Ue+=1)ol[Ue]=Oc(Dc(t,cl,Ue));Ve=new kl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[Ic]},$$scope:{ctx:t}}});let Ht=t[6].p.e&&t[0].chip!="esp8266"&&t[6].p.t&&sa(t),yt=t[6].g.s>0&&aa(t);return{c(){var Ue,At;e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),d=p("div"),g=M(h),b=p("br"),C=v(),k=p("input"),A=v(),I=p("div"),T=M(R),F=p("br"),L=v(),H=p("select"),Me(K.$$.fragment),z=v(),q=p("input"),B=v(),Z=p("div"),V=p("div"),Y=p("div"),U=M(G),y=p("br"),ne=v(),ee=p("select"),Q=p("optgroup"),Vt&&Vt.c(),ie=p("option"),ie.textContent="NO1",re=p("option"),re.textContent="NO2",fe=p("option"),fe.textContent="NO3",le=p("option"),le.textContent="NO4",de=p("option"),de.textContent="NO5",oe=p("optgroup"),me=p("option"),me.textContent="SE1",se=p("option"),se.textContent="SE2",pe=p("option"),pe.textContent="SE3",we=p("option"),we.textContent="SE4",S=p("optgroup"),w=p("option"),w.textContent="DK1",O=p("option"),O.textContent="DK2",D=p("option"),D.textContent="Austria",W=p("option"),W.textContent="Belgium",te=p("option"),te.textContent="Czech Republic",ue=p("option"),ue.textContent="Estonia",be=p("option"),be.textContent="Finland",ke=p("option"),ke.textContent="France",J=p("option"),J.textContent="Germany",ve=p("option"),ve.textContent="Great Britain",ge=p("option"),ge.textContent="Latvia",qe=p("option"),qe.textContent="Lithuania",Pe=p("option"),Pe.textContent="Netherland",Ae=p("option"),Ae.textContent="Poland",Le=p("option"),Le.textContent="Slovenia",Ne=p("option"),Ne.textContent="Switzerland",De=v(),Re=p("div"),xe=M($e),ut=p("br"),St=v(),dt=p("select");for(let il=0;il<2;il+=1)wt[il].c();rt=v(),ot=p("div"),Lt=M(ht),Je=p("br"),Fe=v(),He=p("select");for(let il=0;il<5;il+=1)ol[il].c();tt=v(),Ge=p("div"),Me(Ve.$$.fragment),Qe=v(),_e=p("div"),ae=p("label"),Te=p("input"),Ke=v(),vt=M(Dt),Xe=v(),Ht&&Ht.c(),qt=v(),at=p("div"),lt=M(mt),Bt=p("br"),el=v(),pt=p("select"),nt=p("option"),Jt=M(Yt),Ot=p("option"),$t=M(Zt),Gt=p("option"),ll=M(Qt),Ye=v(),yt&&yt.c(),st=v(),Mt=p("div"),kt=M(It),gt=p("br"),jt=v(),et=p("input"),u(l,"class","text-sm"),u(a,"href",hl("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(k,"name","gh"),u(k,"type","text"),u(k,"class","in-f w-full"),u(k,"pattern",Ci),u(H,"name","gt"),u(H,"class","in-l w-full"),t[6].g.t===void 0&&Et(()=>t[26].call(H)),u(_,"class","flex"),u(m,"class","my-1"),u(q,"type","hidden"),u(q,"name","p"),q.value="true",ie.__value="10YNO-1--------2",j(ie,ie.__value),re.__value="10YNO-2--------T",j(re,re.__value),fe.__value="10YNO-3--------J",j(fe,fe.__value),le.__value="10YNO-4--------9",j(le,le.__value),de.__value="10Y1001A1001A48H",j(de,de.__value),u(Q,"label","Norway"),me.__value="10Y1001A1001A44P",j(me,me.__value),se.__value="10Y1001A1001A45N",j(se,se.__value),pe.__value="10Y1001A1001A46L",j(pe,pe.__value),we.__value="10Y1001A1001A47J",j(we,we.__value),u(oe,"label","Sweden"),w.__value="10YDK-1--------W",j(w,w.__value),O.__value="10YDK-2--------M",j(O,O.__value),u(S,"label","Denmark"),D.__value="10YAT-APG------L",j(D,D.__value),W.__value="10YBE----------2",j(W,W.__value),te.__value="10YCZ-CEPS-----N",j(te,te.__value),ue.__value="10Y1001A1001A39I",j(ue,ue.__value),be.__value="10YFI-1--------U",j(be,be.__value),ke.__value="10YFR-RTE------C",j(ke,ke.__value),J.__value="10Y1001A1001A83F",j(J,J.__value),ve.__value="10YGB----------A",j(ve,ve.__value),ge.__value="10YLV-1001A00074",j(ge,ge.__value),qe.__value="10YLT-1001A0008Q",j(qe,qe.__value),Pe.__value="10YNL----------L",j(Pe,Pe.__value),Ae.__value="10YPL-AREA-----S",j(Ae,Ae.__value),Le.__value="10YSI-ELES-----O",j(Le,Le.__value),Ne.__value="10YCH-SWISSGRIDZ",j(Ne,Ne.__value),u(ee,"name","pr"),u(ee,"class","in-f w-full"),t[6].p.r===void 0&&Et(()=>t[27].call(ee)),u(Y,"class","w-full"),u(dt,"name","pm"),u(dt,"class","in-m"),t[6].p.m===void 0&&Et(()=>t[28].call(dt)),u(He,"name","pc"),u(He,"class","in-l"),t[6].p.c===void 0&&Et(()=>t[29].call(He)),u(V,"class","flex"),u(Z,"class","my-1"),u(Ge,"class","my-1"),u(Te,"type","checkbox"),u(Te,"name","pe"),Te.__value="true",j(Te,Te.__value),u(Te,"class","rounded mb-1"),u(_e,"class","my-1"),nt.__value=0,j(nt,nt.__value),Ot.__value=1,j(Ot,Ot.__value),Gt.__value=2,j(Gt,Gt.__value),u(pt,"name","gs"),u(pt,"class","in-s"),t[6].g.s===void 0&&Et(()=>t[32].call(pt)),u(at,"class","my-1"),u(et,"name","gc"),u(et,"type","text"),u(et,"pattern",Ci),u(et,"placeholder",Rt=((At=(Ue=t[2].conf)==null?void 0:Ue.general)==null?void 0:At.context_placeholder)??"/"),u(et,"class","in-s"),u(et,"maxlength","36"),u(Mt,"class","my-1"),u(e,"class","cnt")},m(Ue,At){P(Ue,e,At),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),s(d,g),s(d,b),s(d,C),s(d,k),j(k,t[6].g.h),s(_,A),s(_,I),s(I,T),s(I,F),s(I,L),s(I,H),Ce(K,H,null),ze(H,t[6].g.t,!0),s(e,z),s(e,q),s(e,B),s(e,Z),s(Z,V),s(V,Y),s(Y,U),s(Y,y),s(Y,ne),s(Y,ee),s(ee,Q),Vt&&Vt.m(Q,null),s(Q,ie),s(Q,re),s(Q,fe),s(Q,le),s(Q,de),s(ee,oe),s(oe,me),s(oe,se),s(oe,pe),s(oe,we),s(ee,S),s(S,w),s(S,O),s(ee,D),s(ee,W),s(ee,te),s(ee,ue),s(ee,be),s(ee,ke),s(ee,J),s(ee,ve),s(ee,ge),s(ee,qe),s(ee,Pe),s(ee,Ae),s(ee,Le),s(ee,Ne),ze(ee,t[6].p.r,!0),s(V,De),s(V,Re),s(Re,xe),s(Re,ut),s(Re,St),s(Re,dt);for(let il=0;il<2;il+=1)wt[il]&&wt[il].m(dt,null);ze(dt,t[6].p.m,!0),s(V,rt),s(V,ot),s(ot,Lt),s(ot,Je),s(ot,Fe),s(ot,He);for(let il=0;il<5;il+=1)ol[il]&&ol[il].m(He,null);ze(He,t[6].p.c,!0),s(e,tt),s(e,Ge),Ce(Ve,Ge,null),s(e,Qe),s(e,_e),s(_e,ae),s(ae,Te),Te.checked=t[6].p.e,s(ae,Ke),s(ae,vt),s(_e,Xe),Ht&&Ht.m(_e,null),s(e,qt),s(e,at),s(at,lt),s(at,Bt),s(at,el),s(at,pt),s(pt,nt),s(nt,Jt),s(pt,Ot),s(Ot,$t),s(pt,Gt),s(Gt,ll),ze(pt,t[6].g.s,!0),s(e,Ye),yt&&yt.m(e,null),s(e,st),s(e,Mt),s(Mt,kt),s(Mt,gt),s(Mt,jt),s(Mt,et),j(et,t[6].g.c),he=!0,Ie||(ye=[ce(k,"input",t[25]),ce(H,"change",t[26]),ce(ee,"change",t[27]),ce(ee,"change",t[22]),ce(dt,"change",t[28]),ce(He,"change",t[29]),ce(Te,"change",t[30]),ce(pt,"change",t[32]),ce(et,"input",t[35])],Ie=!0)},p(Ue,At){var Ql,Xl,Zl,Jl,$l,xl,en,tn,Pn,Tn,qn,En,Dn,An,Ln,On,In,Rn,Fn,Bn,Un,zn,jn,Hn,yn,Wn,Gn,Vn,Kn,bo;(!he||At[0]&4)&&n!==(n=(((Xl=(Ql=Ue[2].conf)==null?void 0:Ql.general)==null?void 0:Xl.title)??"General")+"")&&E(i,n),(!he||At[0]&4)&&h!==(h=(((Jl=(Zl=Ue[2].conf)==null?void 0:Zl.general)==null?void 0:Jl.hostname)??"Hostname")+"")&&E(g,h),At[0]&64&&k.value!==Ue[6].g.h&&j(k,Ue[6].g.h),(!he||At[0]&4)&&R!==(R=(((xl=($l=Ue[2].conf)==null?void 0:$l.general)==null?void 0:xl.timezone)??"Time zone")+"")&&E(T,R),At[0]&64&&ze(H,Ue[6].g.t),(!he||At[0]&4)&&G!==(G=(((tn=(en=Ue[2].conf)==null?void 0:en.price)==null?void 0:tn.region)??"Price region")+"")&&E(U,G),Ue[6].p.t?Vt&&(Vt.d(1),Vt=null):Vt||(Vt=oa(),Vt.c(),Vt.m(Q,ie)),At[0]&64&&ze(ee,Ue[6].p.r),(!he||At[0]&4)&&$e!==($e=(((Tn=(Pn=Ue[2].conf)==null?void 0:Pn.price)==null?void 0:Tn.resolution)??"Resolution")+"")&&E(xe,$e),At[0]&64&&ze(dt,Ue[6].p.m),(!he||At[0]&4)&&ht!==(ht=(((En=(qn=Ue[2].conf)==null?void 0:qn.price)==null?void 0:En.currency)??"Currency")+"")&&E(Lt,ht),At[0]&64&&ze(He,Ue[6].p.c);const il={};At[0]&4|At[4]&8388608&&(il.$$scope={dirty:At,ctx:Ue}),Ve.$set(il),At[0]&64&&(Te.checked=Ue[6].p.e),(!he||At[0]&4)&&Dt!==(Dt=(((An=(Dn=Ue[2].conf)==null?void 0:Dn.price)==null?void 0:An.enabled)??"Enabled")+"")&&E(vt,Dt),Ue[6].p.e&&Ue[0].chip!="esp8266"&&Ue[6].p.t?Ht?Ht.p(Ue,At):(Ht=sa(Ue),Ht.c(),Ht.m(_e,null)):Ht&&(Ht.d(1),Ht=null),(!he||At[0]&4)&&mt!==(mt=(((In=(On=(Ln=Ue[2].conf)==null?void 0:Ln.general)==null?void 0:On.security)==null?void 0:In.title)??"Security")+"")&&E(lt,mt),(!he||At[0]&4)&&Yt!==(Yt=(((Bn=(Fn=(Rn=Ue[2].conf)==null?void 0:Rn.general)==null?void 0:Fn.security)==null?void 0:Bn.none)??"None")+"")&&E(Jt,Yt),(!he||At[0]&4)&&Zt!==(Zt=(((jn=(zn=(Un=Ue[2].conf)==null?void 0:Un.general)==null?void 0:zn.security)==null?void 0:jn.conf)??"Conf")+"")&&E($t,Zt),(!he||At[0]&4)&&Qt!==(Qt=(((Wn=(yn=(Hn=Ue[2].conf)==null?void 0:Hn.general)==null?void 0:yn.security)==null?void 0:Wn.all)??"All")+"")&&E(ll,Qt),At[0]&64&&ze(pt,Ue[6].g.s),Ue[6].g.s>0?yt?yt.p(Ue,At):(yt=aa(Ue),yt.c(),yt.m(e,st)):yt&&(yt.d(1),yt=null),(!he||At[0]&4)&&It!==(It=(((Vn=(Gn=Ue[2].conf)==null?void 0:Gn.general)==null?void 0:Vn.context)??"Context")+"")&&E(kt,It),(!he||At[0]&4&&Rt!==(Rt=((bo=(Kn=Ue[2].conf)==null?void 0:Kn.general)==null?void 0:bo.context_placeholder)??"/"))&&u(et,"placeholder",Rt),At[0]&64&&et.value!==Ue[6].g.c&&j(et,Ue[6].g.c)},i(Ue){he||(X(K.$$.fragment,Ue),X(Ve.$$.fragment,Ue),he=!0)},o(Ue){x(K.$$.fragment,Ue),x(Ve.$$.fragment,Ue),he=!1},d(Ue){Ue&&N(e),Se(K),Vt&&Vt.d(),nl(wt,Ue),nl(ol,Ue),Se(Ve),Ht&&Ht.d(),yt&&yt.d(),Ie=!1,zt(ye)}}}function oa(t){let e,l,n,i,o;return{c(){e=p("option"),e.textContent="NO1 w/support",l=p("option"),l.textContent="NO2 w/support",n=p("option"),n.textContent="NO3 w/support",i=p("option"),i.textContent="NO4 w/support",o=p("option"),o.textContent="NO5 w/support",e.__value="NO1S",j(e,e.__value),l.__value="NO2S",j(l,l.__value),n.__value="NO3S",j(n,n.__value),i.__value="NO4S",j(i,i.__value),o.__value="NO5S",j(o,o.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,o,r)},d(a){a&&(N(e),N(l),N(n),N(i),N(o))}}}function Lc(t){let e;return{c(){e=p("option"),e.textContent=`${t[144]}M`,e.__value=t[144],j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function Oc(t){let e;return{c(){e=p("option"),e.textContent=`${t[141]}`,e.__value=t[141],j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function Ic(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&E(l,e)},d(o){o&&N(l)}}}function sa(t){let e,l,n,i,o,a;return{c(){e=p("input"),l=v(),n=p("br"),i=p("input"),u(e,"name","pt"),u(e,"type","hidden"),u(i,"type","text"),u(i,"class","in-s"),u(i,"placeholder","ENTSO-E API key disabled, ref issue #1030"),i.disabled=!0},m(r,f){P(r,e,f),j(e,t[6].p.t),P(r,l,f),P(r,n,f),P(r,i,f),o||(a=ce(e,"input",t[31]),o=!0)},p(r,f){f[0]&64&&j(e,r[6].p.t)},d(r){r&&(N(e),N(l),N(n),N(i)),o=!1,a()}}}function aa(t){var C,k,A,I,R,T;let e,l=(((A=(k=(C=t[2].conf)==null?void 0:C.general)==null?void 0:k.security)==null?void 0:A.username)??"Username")+"",n,i,o,a,r,f,c=(((T=(R=(I=t[2].conf)==null?void 0:I.general)==null?void 0:R.security)==null?void 0:T.password)??"Password")+"",m,_,d,h,g,b;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),r=v(),f=p("div"),m=M(c),_=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(a,"pattern",Il),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(h,"pattern",Il),u(f,"class","my-1")},m(F,L){P(F,e,L),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].g.u),P(F,r,L),P(F,f,L),s(f,m),s(f,_),s(f,d),s(f,h),j(h,t[6].g.p),g||(b=[ce(a,"input",t[33]),ce(h,"input",t[34])],g=!0)},p(F,L){var H,K,z,q,B,Z;L[0]&4&&l!==(l=(((z=(K=(H=F[2].conf)==null?void 0:H.general)==null?void 0:K.security)==null?void 0:z.username)??"Username")+"")&&E(n,l),L[0]&64&&a.value!==F[6].g.u&&j(a,F[6].g.u),L[0]&4&&c!==(c=(((Z=(B=(q=F[2].conf)==null?void 0:q.general)==null?void 0:B.security)==null?void 0:Z.password)??"Password")+"")&&E(m,c),L[0]&64&&h.value!==F[6].g.p&&j(h,F[6].g.p)},d(F){F&&(N(e),N(r),N(f)),g=!1,zt(b)}}}function fa(t){var _e,ae,Te,Ke,Dt,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Yt,Jt,Ot,Zt,$t,Gt,Qt,ll;let e,l,n=(((ae=(_e=t[2].conf)==null?void 0:_e.meter)==null?void 0:ae.title)??"Meter")+"",i,o,a,r,f,c,m,_,d,h=(((Dt=(Ke=(Te=t[2].conf)==null?void 0:Te.meter)==null?void 0:Ke.comm)==null?void 0:Dt.title)??"Communication")+"",g,b,C,k,A,I=(((qt=(Xe=(vt=t[2].conf)==null?void 0:vt.meter)==null?void 0:Xe.comm)==null?void 0:qt.passive)??"Passive")+"",R,T,F=(((lt=(mt=(at=t[2].conf)==null?void 0:at.meter)==null?void 0:mt.comm)==null?void 0:lt.pulse)??"Pulse")+"",L,H=(el=(Bt=t[0])==null?void 0:Bt.features)==null?void 0:el.includes("kmp"),K,z,q,B=(((pt=t[2].common)==null?void 0:pt.voltage)??"Voltage")+"",Z,V,Y,G,U,y,ne,ee,Q,ie=(((Yt=(nt=t[2].conf)==null?void 0:nt.meter)==null?void 0:Yt.fuse)??"Main fuse")+"",re,fe,le,de,oe,me,se,pe,we,S=(((Ot=(Jt=t[2].conf)==null?void 0:Jt.meter)==null?void 0:Ot.prod)??"Production")+"",w,O,D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le=((($t=(Zt=t[2].conf)==null?void 0:Zt.meter)==null?void 0:$t.encrypted)??"Encrypted")+"",Ne,De,Re,$e,xe,ut,St,dt=(((ll=(Qt=(Gt=t[2].conf)==null?void 0:Gt.meter)==null?void 0:Qt.multipliers)==null?void 0:ll.title)??"Multipliers")+"",rt,ot,ht,Lt,Je=H&&ua();function Fe(Ye,st){return Ye[6].m.a===2?Fc:Rc}let He=Fe(t),tt=He(t),Ge=t[6].m.e.e&&ra(t),Ve=t[6].m.e.e&&ca(t),Qe=t[6].m.m.e&&_a(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("input"),_=v(),d=p("div"),g=M(h),b=p("br"),C=v(),k=p("select"),A=p("option"),R=M(I),T=p("option"),L=M(F),Je&&Je.c(),K=v(),tt.c(),z=v(),q=p("div"),Z=M(B),V=p("br"),Y=v(),G=p("select"),U=p("option"),U.textContent="400V (TN)",y=p("option"),y.textContent="230V (IT/TT)",ne=v(),ee=p("div"),Q=p("div"),re=M(ie),fe=p("br"),le=v(),de=p("label"),oe=p("input"),me=v(),se=p("span"),se.textContent="A",pe=v(),we=p("div"),w=M(S),O=p("br"),D=v(),W=p("label"),te=p("input"),ue=v(),be=p("span"),be.textContent="kWp",ke=v(),J=p("div"),J.innerHTML="",ve=v(),ge=p("div"),qe=p("label"),Pe=p("input"),Ae=v(),Ne=M(Le),De=v(),Ge&&Ge.c(),Re=v(),Ve&&Ve.c(),$e=v(),xe=p("label"),ut=p("input"),St=v(),rt=M(dt),ot=v(),Qe&&Qe.c(),u(l,"class","text-sm"),u(a,"href",hl("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(m,"type","hidden"),u(m,"name","mo"),m.value="1",A.__value=0,j(A,A.__value),T.__value=2,j(T,T.__value),u(k,"name","ma"),u(k,"class","in-s"),t[6].m.a===void 0&&Et(()=>t[36].call(k)),u(d,"class","my-1"),U.__value=2,j(U,U.__value),y.__value=1,j(y,y.__value),u(G,"name","md"),u(G,"class","in-s"),t[6].m.d===void 0&&Et(()=>t[42].call(G)),u(q,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u(se,"class","in-post"),u(de,"class","flex"),u(Q,"class","mx-1"),u(te,"name","mr"),u(te,"type","number"),u(te,"min","0"),u(te,"max","65535"),u(te,"class","in-f tr w-full"),u(be,"class","in-post"),u(W,"class","flex"),u(we,"class","mx-1"),u(ee,"class","my-1 flex"),u(J,"class","my-1"),u(Pe,"type","checkbox"),u(Pe,"name","me"),Pe.__value="true",j(Pe,Pe.__value),u(Pe,"class","rounded mb-1"),u(ge,"class","my-1"),u(ut,"type","checkbox"),u(ut,"name","mm"),ut.__value="true",j(ut,ut.__value),u(ut,"class","rounded mb-1"),u(e,"class","cnt")},m(Ye,st){P(Ye,e,st),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(e,_),s(e,d),s(d,g),s(d,b),s(d,C),s(d,k),s(k,A),s(A,R),s(k,T),s(T,L),Je&&Je.m(k,null),ze(k,t[6].m.a,!0),s(e,K),tt.m(e,null),s(e,z),s(e,q),s(q,Z),s(q,V),s(q,Y),s(q,G),s(G,U),s(G,y),ze(G,t[6].m.d,!0),s(e,ne),s(e,ee),s(ee,Q),s(Q,re),s(Q,fe),s(Q,le),s(Q,de),s(de,oe),j(oe,t[6].m.f),s(de,me),s(de,se),s(ee,pe),s(ee,we),s(we,w),s(we,O),s(we,D),s(we,W),s(W,te),j(te,t[6].m.r),s(W,ue),s(W,be),s(e,ke),s(e,J),s(e,ve),s(e,ge),s(ge,qe),s(qe,Pe),Pe.checked=t[6].m.e.e,s(qe,Ae),s(qe,Ne),s(ge,De),Ge&&Ge.m(ge,null),s(e,Re),Ve&&Ve.m(e,null),s(e,$e),s(e,xe),s(xe,ut),ut.checked=t[6].m.m.e,s(xe,St),s(xe,rt),s(e,ot),Qe&&Qe.m(e,null),ht||(Lt=[ce(k,"change",t[36]),ce(G,"change",t[42]),ce(oe,"input",t[43]),ce(te,"input",t[44]),ce(Pe,"change",t[45]),ce(ut,"change",t[48])],ht=!0)},p(Ye,st){var Mt,It,kt,gt,jt,et,Rt,he,Ie,ye,Vt,Kt,wt,cl,ol,Ht,yt,ul,Ee,$,Oe,it,Nt;st[0]&4&&n!==(n=(((It=(Mt=Ye[2].conf)==null?void 0:Mt.meter)==null?void 0:It.title)??"Meter")+"")&&E(i,n),st[0]&4&&h!==(h=(((jt=(gt=(kt=Ye[2].conf)==null?void 0:kt.meter)==null?void 0:gt.comm)==null?void 0:jt.title)??"Communication")+"")&&E(g,h),st[0]&4&&I!==(I=(((he=(Rt=(et=Ye[2].conf)==null?void 0:et.meter)==null?void 0:Rt.comm)==null?void 0:he.passive)??"Passive")+"")&&E(R,I),st[0]&4&&F!==(F=(((Vt=(ye=(Ie=Ye[2].conf)==null?void 0:Ie.meter)==null?void 0:ye.comm)==null?void 0:Vt.pulse)??"Pulse")+"")&&E(L,F),st[0]&1&&(H=(wt=(Kt=Ye[0])==null?void 0:Kt.features)==null?void 0:wt.includes("kmp")),H?Je||(Je=ua(),Je.c(),Je.m(k,null)):Je&&(Je.d(1),Je=null),st[0]&64&&ze(k,Ye[6].m.a),He===(He=Fe(Ye))&&tt?tt.p(Ye,st):(tt.d(1),tt=He(Ye),tt&&(tt.c(),tt.m(e,z))),st[0]&4&&B!==(B=(((cl=Ye[2].common)==null?void 0:cl.voltage)??"Voltage")+"")&&E(Z,B),st[0]&64&&ze(G,Ye[6].m.d),st[0]&4&&ie!==(ie=(((Ht=(ol=Ye[2].conf)==null?void 0:ol.meter)==null?void 0:Ht.fuse)??"Main fuse")+"")&&E(re,ie),st[0]&64&&Be(oe.value)!==Ye[6].m.f&&j(oe,Ye[6].m.f),st[0]&4&&S!==(S=(((ul=(yt=Ye[2].conf)==null?void 0:yt.meter)==null?void 0:ul.prod)??"Production")+"")&&E(w,S),st[0]&64&&Be(te.value)!==Ye[6].m.r&&j(te,Ye[6].m.r),st[0]&64&&(Pe.checked=Ye[6].m.e.e),st[0]&4&&Le!==(Le=((($=(Ee=Ye[2].conf)==null?void 0:Ee.meter)==null?void 0:$.encrypted)??"Encrypted")+"")&&E(Ne,Le),Ye[6].m.e.e?Ge?Ge.p(Ye,st):(Ge=ra(Ye),Ge.c(),Ge.m(ge,null)):Ge&&(Ge.d(1),Ge=null),Ye[6].m.e.e?Ve?Ve.p(Ye,st):(Ve=ca(Ye),Ve.c(),Ve.m(e,$e)):Ve&&(Ve.d(1),Ve=null),st[0]&64&&(ut.checked=Ye[6].m.m.e),st[0]&4&&dt!==(dt=(((Nt=(it=(Oe=Ye[2].conf)==null?void 0:Oe.meter)==null?void 0:it.multipliers)==null?void 0:Nt.title)??"Multipliers")+"")&&E(rt,dt),Ye[6].m.m.e?Qe?Qe.p(Ye,st):(Qe=_a(Ye),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Ye){Ye&&N(e),Je&&Je.d(),tt.d(),Ge&&Ge.d(),Ve&&Ve.d(),Qe&&Qe.d(),ht=!1,zt(Lt)}}}function ua(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,j(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Rc(t){var re,fe,le,de,oe,me;let e,l,n=(((fe=(re=t[2].conf)==null?void 0:re.meter)==null?void 0:fe.buffer)??"Buffer size")+"",i,o,a,r=(((de=(le=t[2].conf)==null?void 0:le.meter)==null?void 0:de.serial)??"Serial conf.")+"",f,c,m,_,d,h=(((me=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:me.inverted)??"inverted")+"",g,b,C,k,A,I,R,T,F,L,H,K,z,q,B,Z,V,Y,G,U,y,ne,ee,Q=ft([3,12,24,48,96,192,384,576,1152]),ie=[];for(let se=0;se<9;se+=1)ie[se]=Bc(Ec(t,Q,se));return{c(){e=p("div"),l=p("span"),i=M(n),o=v(),a=p("span"),f=M(r),c=v(),m=p("label"),_=p("input"),d=v(),g=M(h),b=v(),C=p("div"),k=p("select"),A=p("option"),I=M("Autodetect");for(let se=0;se<9;se+=1)ie[se].c();T=v(),F=p("select"),L=p("option"),H=M("-"),z=p("option"),z.textContent="7N1",q=p("option"),q.textContent="8N1",B=p("option"),B.textContent="8N2",Z=p("option"),Z.textContent="7E1",V=p("option"),V.textContent="8E1",G=v(),U=p("input"),u(l,"class","float-right"),u(_,"name","mi"),_.__value="true",j(_,_.__value),u(_,"type","checkbox"),u(_,"class","rounded mb-1"),u(m,"class","mt-2 ml-3 whitespace-nowrap"),A.__value=0,j(A,A.__value),A.disabled=R=t[6].m.b!=0,u(k,"name","mb"),u(k,"class","in-f tr w-1/2"),t[6].m.b===void 0&&Et(()=>t[39].call(k)),L.__value=0,j(L,L.__value),L.disabled=K=t[6].m.b!=0,z.__value=2,j(z,z.__value),q.__value=3,j(q,q.__value),B.__value=7,j(B,B.__value),Z.__value=10,j(Z,Z.__value),V.__value=11,j(V,V.__value),u(F,"name","mp"),u(F,"class","in-m"),F.disabled=Y=t[6].m.b==0,t[6].m.p===void 0&&Et(()=>t[40].call(F)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",y=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(C,"class","flex w-full"),u(e,"class","my-1")},m(se,pe){P(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(e,c),s(e,m),s(m,_),_.checked=t[6].m.i,s(m,d),s(m,g),s(e,b),s(e,C),s(C,k),s(k,A),s(A,I);for(let we=0;we<9;we+=1)ie[we]&&ie[we].m(k,null);ze(k,t[6].m.b,!0),s(C,T),s(C,F),s(F,L),s(L,H),s(F,z),s(F,q),s(F,B),s(F,Z),s(F,V),ze(F,t[6].m.p,!0),s(C,G),s(C,U),j(U,t[6].m.s),ne||(ee=[ce(_,"change",t[38]),ce(k,"change",t[39]),ce(F,"change",t[40]),ce(U,"input",t[41])],ne=!0)},p(se,pe){var we,S,w,O,D,W;pe[0]&4&&n!==(n=(((S=(we=se[2].conf)==null?void 0:we.meter)==null?void 0:S.buffer)??"Buffer size")+"")&&E(i,n),pe[0]&4&&r!==(r=(((O=(w=se[2].conf)==null?void 0:w.meter)==null?void 0:O.serial)??"Serial conf.")+"")&&E(f,r),pe[0]&64&&(_.checked=se[6].m.i),pe[0]&4&&h!==(h=(((W=(D=se[2].conf)==null?void 0:D.meter)==null?void 0:W.inverted)??"inverted")+"")&&E(g,h),pe[0]&64&&R!==(R=se[6].m.b!=0)&&(A.disabled=R),pe[0]&64&&ze(k,se[6].m.b),pe[0]&64&&K!==(K=se[6].m.b!=0)&&(L.disabled=K),pe[0]&64&&Y!==(Y=se[6].m.b==0)&&(F.disabled=Y),pe[0]&64&&ze(F,se[6].m.p),pe[0]&65&&y!==(y=se[0].chip=="esp8266"?se[6].i.h.p==3||se[6].i.h.p==113?512:256:4096)&&u(U,"max",y),pe[0]&64&&Be(U.value)!==se[6].m.s&&j(U,se[6].m.s)},d(se){se&&N(e),nl(ie,se),ne=!1,zt(ee)}}}function Fc(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,o,a,r,f;return{c(){e=p("div"),l=p("span"),i=M(n),o=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(e,o),s(e,a),j(a,t[6].m.b),r||(f=ce(a,"input",t[37]),r=!0)},p(_,d){var h,g;d[0]&4&&n!==(n=(((g=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:g.pulses)??"Pulses per kWh")+"")&&E(i,n),d[0]&64&&Be(a.value)!==_[6].m.b&&j(a,_[6].m.b)},d(_){_&&N(e),r=!1,f()}}}function Bc(t){let e;return{c(){e=p("option"),e.textContent=`${t[138]*100}`,e.__value=t[138]*100,j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function ra(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s"),u(l,"pattern",Iu)},m(o,a){P(o,e,a),P(o,l,a),j(l,t[6].m.e.k),n||(i=ce(l,"input",t[46]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].m.e.k&&j(l,o[6].m.e.k)},d(o){o&&(N(e),N(l)),n=!1,i()}}}function ca(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",Iu),u(e,"class","my-1")},m(_,d){P(_,e,d),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].m.e.a),r||(f=ce(a,"input",t[47]),r=!0)},p(_,d){var h,g;d[0]&4&&l!==(l=(((g=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:g.authkey)??"Authentication key")+"")&&E(n,l),d[0]&64&&a.value!==_[6].m.e.a&&j(a,_[6].m.e.a)},d(_){_&&N(e),r=!1,f()}}}function _a(t){var Y,G,U,y,ne,ee,Q,ie,re,fe,le,de;let e,l,n=(((U=(G=(Y=t[2].conf)==null?void 0:Y.meter)==null?void 0:G.multipliers)==null?void 0:U.watt)??"Watt")+"",i,o,a,r,f,c,m=(((ee=(ne=(y=t[2].conf)==null?void 0:y.meter)==null?void 0:ne.multipliers)==null?void 0:ee.volt)??"Volt")+"",_,d,h,g,b,C,k=(((re=(ie=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ie.multipliers)==null?void 0:re.amp)??"Amp")+"",A,I,R,T,F,L,H=(((de=(le=(fe=t[2].conf)==null?void 0:fe.meter)==null?void 0:le.multipliers)==null?void 0:de.kwh)??"kWh")+"",K,z,q,B,Z,V;return{c(){e=p("div"),l=p("div"),i=M(n),o=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=M(m),d=p("br"),h=v(),g=p("input"),b=v(),C=p("div"),A=M(k),I=p("br"),R=v(),T=p("input"),F=v(),L=p("div"),K=M(H),z=p("br"),q=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(g,"name","mmv"),u(g,"type","number"),u(g,"min","0.00"),u(g,"max","1000"),u(g,"step","0.001"),u(g,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(T,"name","mma"),u(T,"type","number"),u(T,"min","0.00"),u(T,"max","1000"),u(T,"step","0.001"),u(T,"class","in-m tr w-full"),u(C,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(L,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,me){P(oe,e,me),s(e,l),s(l,i),s(l,o),s(l,a),s(l,r),j(r,t[6].m.m.w),s(e,f),s(e,c),s(c,_),s(c,d),s(c,h),s(c,g),j(g,t[6].m.m.v),s(e,b),s(e,C),s(C,A),s(C,I),s(C,R),s(C,T),j(T,t[6].m.m.a),s(e,F),s(e,L),s(L,K),s(L,z),s(L,q),s(L,B),j(B,t[6].m.m.c),Z||(V=[ce(r,"input",t[49]),ce(g,"input",t[50]),ce(T,"input",t[51]),ce(B,"input",t[52])],Z=!0)},p(oe,me){var se,pe,we,S,w,O,D,W,te,ue,be,ke;me[0]&4&&n!==(n=(((we=(pe=(se=oe[2].conf)==null?void 0:se.meter)==null?void 0:pe.multipliers)==null?void 0:we.watt)??"Watt")+"")&&E(i,n),me[0]&64&&Be(r.value)!==oe[6].m.m.w&&j(r,oe[6].m.m.w),me[0]&4&&m!==(m=(((O=(w=(S=oe[2].conf)==null?void 0:S.meter)==null?void 0:w.multipliers)==null?void 0:O.volt)??"Volt")+"")&&E(_,m),me[0]&64&&Be(g.value)!==oe[6].m.m.v&&j(g,oe[6].m.m.v),me[0]&4&&k!==(k=(((te=(W=(D=oe[2].conf)==null?void 0:D.meter)==null?void 0:W.multipliers)==null?void 0:te.amp)??"Amp")+"")&&E(A,k),me[0]&64&&Be(T.value)!==oe[6].m.m.a&&j(T,oe[6].m.m.a),me[0]&4&&H!==(H=(((ke=(be=(ue=oe[2].conf)==null?void 0:ue.meter)==null?void 0:be.multipliers)==null?void 0:ke.kwh)??"kWh")+"")&&E(K,H),me[0]&64&&Be(B.value)!==oe[6].m.m.c&&j(B,oe[6].m.m.c)},d(oe){oe&&N(e),Z=!1,zt(V)}}}function ma(t){var L,H,K,z,q,B;let e,l,n=(((H=(L=t[2].conf)==null?void 0:L.connection)==null?void 0:H.title)??"Connection")+"",i,o,a,r,f,c,m,_,d,h=(((z=(K=t[2].conf)==null?void 0:K.connection)==null?void 0:z.wifi)??"WiFi")+"",g,b,C=(((B=(q=t[2].conf)==null?void 0:q.connection)==null?void 0:B.ap)??"AP")+"",k,A,I,R,T=t[0].if&&t[0].if.eth&&pa(t),F=(t[6].n.c==1||t[6].n.c==2)&&da(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("select"),d=p("option"),g=M(h),b=p("option"),k=M(C),T&&T.c(),A=v(),F&&F.c(),u(l,"class","text-sm"),u(a,"href",hl("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,j(d,d.__value),b.__value=2,j(b,b.__value),u(_,"name","nc"),u(_,"class","in-s"),t[6].n.c===void 0&&Et(()=>t[53].call(_)),u(m,"class","my-1"),u(e,"class","cnt")},m(Z,V){P(Z,e,V),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),s(d,g),s(_,b),s(b,k),T&&T.m(_,null),ze(_,t[6].n.c,!0),s(e,A),F&&F.m(e,null),I||(R=ce(_,"change",t[53]),I=!0)},p(Z,V){var Y,G,U,y,ne,ee;V[0]&4&&n!==(n=(((G=(Y=Z[2].conf)==null?void 0:Y.connection)==null?void 0:G.title)??"Connection")+"")&&E(i,n),V[0]&4&&h!==(h=(((y=(U=Z[2].conf)==null?void 0:U.connection)==null?void 0:y.wifi)??"WiFi")+"")&&E(g,h),V[0]&4&&C!==(C=(((ee=(ne=Z[2].conf)==null?void 0:ne.connection)==null?void 0:ee.ap)??"AP")+"")&&E(k,C),Z[0].if&&Z[0].if.eth?T?T.p(Z,V):(T=pa(Z),T.c(),T.m(_,null)):T&&(T.d(1),T=null),V[0]&64&&ze(_,Z[6].n.c),Z[6].n.c==1||Z[6].n.c==2?F?F.p(Z,V):(F=da(Z),F.c(),F.m(e,null)):F&&(F.d(1),F=null)},d(Z){Z&&N(e),T&&T.d(),F&&F.d(),I=!1,R()}}}function pa(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,j(e,e.__value)},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function da(t){var qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Lt,Je,Fe,He,tt,Ge,Ve,Qe;let e,l=(((Pe=(qe=t[2].conf)==null?void 0:qe.connection)==null?void 0:Pe.ssid)??"SSID")+"",n,i,o,a,r,f,c,m,_,d,h=(((Le=(Ae=t[2].conf)==null?void 0:Ae.connection)==null?void 0:Le.psk)??"Password")+"",g,b,C,k,A,I,R,T=(((Re=(De=(Ne=t[2].conf)==null?void 0:Ne.connection)==null?void 0:De.ps)==null?void 0:Re.title)??"Power saving")+"",F,L,H,K,z,q=(((ut=(xe=($e=t[2].conf)==null?void 0:$e.connection)==null?void 0:xe.ps)==null?void 0:ut.default)??"Default")+"",B,Z,V=(((rt=(dt=(St=t[2].conf)==null?void 0:St.connection)==null?void 0:dt.ps)==null?void 0:rt.off)??"Off")+"",Y,G,U=(((Lt=(ht=(ot=t[2].conf)==null?void 0:ot.connection)==null?void 0:ht.ps)==null?void 0:Lt.min)??"Min")+"",y,ne,ee=(((He=(Fe=(Je=t[2].conf)==null?void 0:Je.connection)==null?void 0:Fe.ps)==null?void 0:He.max)??"Max")+"",Q,ie,re,fe=(((Ge=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:Ge.pwr)??"Power")+"",le,de,oe,me,se,pe,we,S,w,O,D,W,te=(((Qe=(Ve=t[2].conf)==null?void 0:Ve.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",ue,be,ke;function J(_e,ae){return _e[8]?zc:Uc}let ve=J(t),ge=ve(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("label"),a=p("input"),r=M(" manual"),f=v(),c=p("br"),m=v(),ge.c(),_=v(),d=p("div"),g=M(h),b=p("br"),C=v(),k=p("input"),A=v(),I=p("div"),R=p("div"),F=M(T),L=p("br"),H=v(),K=p("select"),z=p("option"),B=M(q),Z=p("option"),Y=M(V),G=p("option"),y=M(U),ne=p("option"),Q=M(ee),ie=v(),re=p("div"),le=M(fe),de=p("br"),oe=v(),me=p("div"),se=p("input"),pe=v(),we=p("span"),we.textContent="dBm",S=v(),w=p("div"),O=p("label"),D=p("input"),W=v(),ue=M(te),u(a,"type","checkbox"),a.__value="true",j(a,a.__value),u(a,"class","rounded mb-1"),u(o,"class","float-right mr-3"),u(e,"class","my-1"),u(k,"name","wp"),u(k,"type","password"),u(k,"class","in-s"),u(k,"pattern",Nn),u(d,"class","my-1"),z.__value=255,j(z,z.__value),Z.__value=0,j(Z,Z.__value),G.__value=1,j(G,G.__value),ne.__value=2,j(ne,ne.__value),u(K,"name","wz"),u(K,"class","in-s"),t[6].w.z===void 0&&Et(()=>t[58].call(K)),u(R,"class","w-1/2"),u(se,"name","ww"),u(se,"type","number"),u(se,"min","0"),u(se,"max","20.5"),u(se,"step","0.5"),u(se,"class","in-f tr w-full"),u(we,"class","in-post"),u(me,"class","flex"),u(re,"class","ml-2 w-1/2"),u(I,"class","my-1 flex"),u(D,"type","checkbox"),u(D,"name","wb"),D.__value="true",j(D,D.__value),u(D,"class","rounded mb-1"),u(w,"class","my-3")},m(_e,ae){P(_e,e,ae),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[8],s(o,r),s(e,f),s(e,c),s(e,m),ge.m(e,null),P(_e,_,ae),P(_e,d,ae),s(d,g),s(d,b),s(d,C),s(d,k),j(k,t[6].w.p),P(_e,A,ae),P(_e,I,ae),s(I,R),s(R,F),s(R,L),s(R,H),s(R,K),s(K,z),s(z,B),s(K,Z),s(Z,Y),s(K,G),s(G,y),s(K,ne),s(ne,Q),ze(K,t[6].w.z,!0),s(I,ie),s(I,re),s(re,le),s(re,de),s(re,oe),s(re,me),s(me,se),j(se,t[6].w.w),s(me,pe),s(me,we),P(_e,S,ae),P(_e,w,ae),s(w,O),s(O,D),D.checked=t[6].w.b,s(O,W),s(O,ue),be||(ke=[ce(a,"change",t[54]),ce(k,"input",t[57]),ce(K,"change",t[58]),ce(se,"input",t[59]),ce(D,"change",t[60])],be=!0)},p(_e,ae){var Te,Ke,Dt,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Yt,Jt,Ot,Zt,$t,Gt,Qt,ll,Ye,st;ae[0]&4&&l!==(l=(((Ke=(Te=_e[2].conf)==null?void 0:Te.connection)==null?void 0:Ke.ssid)??"SSID")+"")&&E(n,l),ae[0]&256&&(a.checked=_e[8]),ve===(ve=J(_e))&&ge?ge.p(_e,ae):(ge.d(1),ge=ve(_e),ge&&(ge.c(),ge.m(e,null))),ae[0]&4&&h!==(h=(((vt=(Dt=_e[2].conf)==null?void 0:Dt.connection)==null?void 0:vt.psk)??"Password")+"")&&E(g,h),ae[0]&64&&k.value!==_e[6].w.p&&j(k,_e[6].w.p),ae[0]&4&&T!==(T=(((at=(qt=(Xe=_e[2].conf)==null?void 0:Xe.connection)==null?void 0:qt.ps)==null?void 0:at.title)??"Power saving")+"")&&E(F,T),ae[0]&4&&q!==(q=(((Bt=(lt=(mt=_e[2].conf)==null?void 0:mt.connection)==null?void 0:lt.ps)==null?void 0:Bt.default)??"Default")+"")&&E(B,q),ae[0]&4&&V!==(V=(((nt=(pt=(el=_e[2].conf)==null?void 0:el.connection)==null?void 0:pt.ps)==null?void 0:nt.off)??"Off")+"")&&E(Y,V),ae[0]&4&&U!==(U=(((Ot=(Jt=(Yt=_e[2].conf)==null?void 0:Yt.connection)==null?void 0:Jt.ps)==null?void 0:Ot.min)??"Min")+"")&&E(y,U),ae[0]&4&&ee!==(ee=(((Gt=($t=(Zt=_e[2].conf)==null?void 0:Zt.connection)==null?void 0:$t.ps)==null?void 0:Gt.max)??"Max")+"")&&E(Q,ee),ae[0]&64&&ze(K,_e[6].w.z),ae[0]&4&&fe!==(fe=(((ll=(Qt=_e[2].conf)==null?void 0:Qt.connection)==null?void 0:ll.pwr)??"Power")+"")&&E(le,fe),ae[0]&64&&Be(se.value)!==_e[6].w.w&&j(se,_e[6].w.w),ae[0]&64&&(D.checked=_e[6].w.b),ae[0]&4&&te!==(te=(((st=(Ye=_e[2].conf)==null?void 0:Ye.connection)==null?void 0:st.tick_11b)??"802.11b")+"")&&E(ue,te)},d(_e){_e&&(N(e),N(_),N(d),N(A),N(I),N(S),N(w)),ge.d(),be=!1,zt(ke)}}}function Uc(t){var f,c;let e,l,n,i,o,a=((f=t[9])==null?void 0:f.c)==-1&&ha(),r=((c=t[9])==null?void 0:c.n)&&va(t);return{c(){e=p("select"),a&&a.c(),l=Wt(),r&&r.c(),u(e,"name","ws"),u(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&Et(()=>t[56].call(e))},m(m,_){P(m,e,_),a&&a.m(e,null),s(e,l),r&&r.m(e,null),ze(e,t[6].w.s,!0),i||(o=ce(e,"change",t[56]),i=!0)},p(m,_){var d,h;((d=m[9])==null?void 0:d.c)==-1?a||(a=ha(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(h=m[9])!=null&&h.n?r?r.p(m,_):(r=va(m),r.c(),r.m(e,null)):r&&(r.d(1),r=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&ze(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),r&&r.d(),i=!1,o()}}}function zc(t){let e,l,n,i;return{c(){e=p("input"),u(e,"name","ws"),u(e,"type","text"),u(e,"class","in-s"),u(e,"pattern",Nn),e.required=l=t[6].n.c==1||t[6].n.c==2},m(o,a){P(o,e,a),j(e,t[6].w.s),n||(i=ce(e,"input",t[55]),n=!0)},p(o,a){a[0]&64&&l!==(l=o[6].n.c==1||o[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==o[6].w.s&&j(e,o[6].w.s)},d(o){o&&N(e),n=!1,i()}}}function ha(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",j(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function va(t){var i;let e,l=ft((i=t[9])==null?void 0:i.n),n=[];for(let o=0;ot[61].call(g)),u(F,"name","ni"),u(F,"type","text"),u(F,"class","in-m w-full"),F.disabled=L=t[6].n.m=="dhcp",F.required=H=t[6].n.m=="static",u(F,"pattern",cn),u(z,"name","ns"),u(z,"class","in-l"),z.disabled=B=t[6].n.m=="dhcp",z.required=Z=t[6].n.m=="static",t[6].n.s===void 0&&Et(()=>t[63].call(z)),u(h,"class","flex"),u(f,"class","my-1"),u(y,"name","nx"),y.__value="true",j(y,y.__value),u(y,"type","checkbox"),u(y,"class","rounded mb-1"),u(G,"class","my-1"),u(re,"name","nd"),re.__value="true",j(re,re.__value),u(re,"type","checkbox"),u(re,"class","rounded mb-1"),u(Q,"class","my-1"),u(me,"type","hidden"),u(me,"name","ntp"),me.value="true",u(D,"name","ntpd"),D.__value="true",j(D,D.__value),u(D,"type","checkbox"),u(D,"class","rounded mb-1"),u(O,"class","ml-4"),u(ve,"name","ntph"),u(ve,"type","text"),u(ve,"class","in-s"),u(ve,"pattern",Il),u(J,"class","flex"),u(pe,"class","my-1"),u(e,"class","cnt")},m(Fe,He){P(Fe,e,He),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(f,m),s(f,_),s(f,d),s(f,h),s(h,g),s(g,b),s(b,k),s(g,A),s(A,R),ze(g,t[6].n.m,!0),s(h,T),s(h,F),j(F,t[6].n.i),s(h,K),s(h,z),Ce(q,z,null),ze(z,t[6].n.s,!0),s(e,V),Ae&&Ae.m(e,null),s(e,Y),s(e,G),s(G,U),s(U,y),y.checked=t[6].n.x,s(U,ne),s(e,ee),s(e,Q),s(Q,ie),s(ie,re),re.checked=t[6].n.d,s(ie,fe),s(ie,de),s(e,oe),s(e,me),s(e,se),s(e,pe),s(pe,S),s(pe,w),s(pe,O),s(O,D),D.checked=t[6].n.h,s(O,W),s(O,ue),s(pe,be),s(pe,ke),s(pe,J),s(J,ve),j(ve,t[6].n.n1),ge=!0,qe||(Pe=[ce(g,"change",t[61]),ce(F,"input",t[62]),ce(z,"change",t[63]),ce(y,"change",t[67]),ce(re,"change",t[68]),ce(D,"change",t[69]),ce(ve,"input",t[70])],qe=!0)},p(Fe,He){var tt,Ge,Ve,Qe,_e,ae,Te,Ke,Dt,vt,Xe,qt,at,mt;(!ge||He[0]&4)&&n!==(n=(((Ge=(tt=Fe[2].conf)==null?void 0:tt.network)==null?void 0:Ge.title)??"Network")+"")&&E(i,n),(!ge||He[0]&4)&&c!==(c=(((Qe=(Ve=Fe[2].conf)==null?void 0:Ve.network)==null?void 0:Qe.ip)??"IP")+"")&&E(m,c),(!ge||He[0]&4)&&C!==(C=(((ae=(_e=Fe[2].conf)==null?void 0:_e.network)==null?void 0:ae.dhcp)??"DHCP")+"")&&E(k,C),(!ge||He[0]&4)&&I!==(I=(((Ke=(Te=Fe[2].conf)==null?void 0:Te.network)==null?void 0:Ke.static)??"Static")+"")&&E(R,I),He[0]&64&&ze(g,Fe[6].n.m),(!ge||He[0]&64&&L!==(L=Fe[6].n.m=="dhcp"))&&(F.disabled=L),(!ge||He[0]&64&&H!==(H=Fe[6].n.m=="static"))&&(F.required=H),He[0]&64&&F.value!==Fe[6].n.i&&j(F,Fe[6].n.i),(!ge||He[0]&64&&B!==(B=Fe[6].n.m=="dhcp"))&&(z.disabled=B),(!ge||He[0]&64&&Z!==(Z=Fe[6].n.m=="static"))&&(z.required=Z),He[0]&64&&ze(z,Fe[6].n.s),Fe[6].n.m=="static"?Ae?Ae.p(Fe,He):(Ae=ka(Fe),Ae.c(),Ae.m(e,Y)):Ae&&(Ae.d(1),Ae=null),He[0]&64&&(y.checked=Fe[6].n.x),He[0]&64&&(re.checked=Fe[6].n.d),(!ge||He[0]&4)&&le!==(le=(((vt=(Dt=Fe[2].conf)==null?void 0:Dt.network)==null?void 0:vt.tick_mdns)??"mDNS")+"")&&E(de,le),(!ge||He[0]&4)&&we!==(we=(((qt=(Xe=Fe[2].conf)==null?void 0:Xe.network)==null?void 0:qt.ntp)??"NTP")+"")&&E(S,we),He[0]&64&&(D.checked=Fe[6].n.h),(!ge||He[0]&4)&&te!==(te=(((mt=(at=Fe[2].conf)==null?void 0:at.network)==null?void 0:mt.tick_ntp_dhcp)??"from DHCP")+"")&&E(ue,te),He[0]&64&&ve.value!==Fe[6].n.n1&&j(ve,Fe[6].n.n1)},i(Fe){ge||(X(q.$$.fragment,Fe),ge=!0)},o(Fe){x(q.$$.fragment,Fe),ge=!1},d(Fe){Fe&&N(e),Se(q),Ae&&Ae.d(),qe=!1,zt(Pe)}}}function ka(t){var I,R,T,F;let e,l=(((R=(I=t[2].conf)==null?void 0:I.network)==null?void 0:R.gw)??"Gateway")+"",n,i,o,a,r,f,c=(((F=(T=t[2].conf)==null?void 0:T.network)==null?void 0:F.dns)??"DNS")+"",m,_,d,h,g,b,C,k,A;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),r=v(),f=p("div"),m=M(c),_=p("br"),d=v(),h=p("div"),g=p("input"),b=v(),C=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",cn),u(e,"class","my-1"),u(g,"name","nd1"),u(g,"type","text"),u(g,"class","in-f w-full"),u(g,"pattern",cn),u(C,"name","nd2"),u(C,"type","text"),u(C,"class","in-l w-full"),u(C,"pattern",cn),u(h,"class","flex"),u(f,"class","my-1")},m(L,H){P(L,e,H),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].n.g),P(L,r,H),P(L,f,H),s(f,m),s(f,_),s(f,d),s(f,h),s(h,g),j(g,t[6].n.d1),s(h,b),s(h,C),j(C,t[6].n.d2),k||(A=[ce(a,"input",t[64]),ce(g,"input",t[65]),ce(C,"input",t[66])],k=!0)},p(L,H){var K,z,q,B;H[0]&4&&l!==(l=(((z=(K=L[2].conf)==null?void 0:K.network)==null?void 0:z.gw)??"Gateway")+"")&&E(n,l),H[0]&64&&a.value!==L[6].n.g&&j(a,L[6].n.g),H[0]&4&&c!==(c=(((B=(q=L[2].conf)==null?void 0:q.network)==null?void 0:B.dns)??"DNS")+"")&&E(m,c),H[0]&64&&g.value!==L[6].n.d1&&j(g,L[6].n.d1),H[0]&64&&C.value!==L[6].n.d2&&j(C,L[6].n.d2)},d(L){L&&(N(e),N(r),N(f)),k=!1,zt(A)}}}function wa(t){var cl,ol,Ht,yt,ul,Ee,$,Oe,it,Nt,al,_l,vl,fl,bl,gl,Pl,Rl,Fl,Bl,Ul,zl,jl,Hl,yl,Wl,Gl,Vl,Kl,Yl;let e,l,n=(((ol=(cl=t[2].conf)==null?void 0:cl.mqtt)==null?void 0:ol.title)??"MQTT")+"",i,o,a,r,f,c,m,_=(((yt=(Ht=t[2].conf)==null?void 0:Ht.mqtt)==null?void 0:yt.server)??"Server")+"",d,h,g,b,C,k,A,I,R,T,F,L,H=(((Ee=(ul=t[2].conf)==null?void 0:ul.mqtt)==null?void 0:Ee.user)??"Username")+"",K,z,q,B,Z,V,Y=(((Oe=($=t[2].conf)==null?void 0:$.mqtt)==null?void 0:Oe.pass)??"Password")+"",G,U,y,ne,ee,Q,ie,re=(((Nt=(it=t[2].conf)==null?void 0:it.mqtt)==null?void 0:Nt.id)??"Client ID")+"",fe,le,de,oe,me,se,pe,we=(((_l=(al=t[2].conf)==null?void 0:al.mqtt)==null?void 0:_l.payload)??"Payload")+"",S,w,O,D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae=(((fl=(vl=t[2].conf)==null?void 0:vl.mqtt)==null?void 0:fl.publish)??"Publish topic")+"",Le,Ne,De,Re,$e,xe,ut=(((gl=(bl=t[2].conf)==null?void 0:bl.mqtt)==null?void 0:gl.subscribe)??"Subscribe topic")+"",St,dt,rt,ot,ht,Lt,Je,Fe=(((Rl=(Pl=t[2].conf)==null?void 0:Pl.mqtt)==null?void 0:Rl.update)??"Update method")+"",He,tt,Ge,Ve=(((Bl=(Fl=t[2].conf)==null?void 0:Fl.mqtt)==null?void 0:Bl.interval)??"Interval")+"",Qe,_e,ae,Te,Ke,Dt=(((zl=(Ul=t[2].conf)==null?void 0:Ul.mqtt)==null?void 0:zl.realtime)??"Real time")+"",vt,Xe,qt=(((Hl=(jl=t[2].conf)==null?void 0:jl.mqtt)==null?void 0:Hl.interval)??"Interval")+"",at,mt,lt,Bt,el,pt,nt,Yt,Jt=(((Wl=(yl=t[2].conf)==null?void 0:yl.mqtt)==null?void 0:Wl.timeout)??"Timeout")+"",Ot,Zt,$t,Gt=(((Vl=(Gl=t[2].conf)==null?void 0:Gl.mqtt)==null?void 0:Vl.keepalive)??"Keep-alive")+"",Qt,ll,Ye,st=(((Yl=(Kl=t[2].conf)==null?void 0:Kl.mqtt)==null?void 0:Yl.autoreboot)??"Auto-reboot")+"",Mt,It,kt,gt,jt,et,Rt,he,Ie,ye,Vt,Kt=t[0].chip!="esp8266"&&Ca(t),wt=t[6].q.s.e&&Sa(t);return{c(){var We,bt;e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=M(_),h=v(),Kt&&Kt.c(),g=v(),b=p("br"),C=v(),k=p("div"),A=p("input"),I=v(),R=p("input"),T=v(),wt&&wt.c(),F=v(),L=p("div"),K=M(H),z=p("br"),q=v(),B=p("input"),Z=v(),V=p("div"),G=M(Y),U=p("br"),y=v(),ne=p("input"),ee=v(),Q=p("div"),ie=p("div"),fe=M(re),le=p("br"),de=v(),oe=p("input"),se=v(),pe=p("div"),S=M(we),w=p("br"),O=v(),D=p("select"),W=p("option"),W.textContent="Raw (minimal)",te=p("option"),te.textContent="Raw (full)",ue=p("option"),ue.textContent="Domoticz",be=p("option"),be.textContent="Home-Assistant",ke=p("option"),ke.textContent="JSON (classic)",J=p("option"),J.textContent="JSON (multi topic)",ve=p("option"),ve.textContent="JSON (flat)",ge=p("option"),ge.textContent="HEX dump",qe=v(),Pe=p("div"),Le=M(Ae),Ne=p("br"),De=v(),Re=p("input"),$e=v(),xe=p("div"),St=M(ut),dt=p("br"),rt=v(),ot=p("input"),Lt=v(),Je=p("div"),He=M(Fe),tt=v(),Ge=p("span"),Qe=M(Ve),_e=v(),ae=p("div"),Te=p("select"),Ke=p("option"),vt=M(Dt),Xe=p("option"),at=M(qt),mt=v(),lt=p("input"),el=v(),pt=p("div"),nt=p("div"),Yt=p("p"),Ot=M(Jt),Zt=v(),$t=p("p"),Qt=M(Gt),ll=v(),Ye=p("p"),Mt=M(st),It=v(),kt=p("div"),gt=p("input"),jt=v(),et=p("input"),Rt=v(),he=p("input"),u(l,"class","text-sm"),u(a,"href",hl("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(A,"name","qh"),u(A,"type","text"),u(A,"class","in-f w-2/3"),u(A,"pattern",Il),u(R,"name","qp"),u(R,"type","number"),u(R,"min","1024"),u(R,"max","65535"),u(R,"class","in-l tr w-1/3"),u(k,"class","flex"),u(m,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(B,"pattern",Nn),u(L,"class","my-1"),u(ne,"name","qa"),u(ne,"type","password"),u(ne,"class","in-s"),u(ne,"pattern",Nn),u(V,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=me=t[6].q.h,u(oe,"pattern",Ci),W.__value=1,j(W,W.__value),te.__value=2,j(te,te.__value),ue.__value=3,j(ue,ue.__value),be.__value=4,j(be,be.__value),ke.__value=0,j(ke,ke.__value),J.__value=5,j(J,J.__value),ve.__value=6,j(ve,ve.__value),ge.__value=255,j(ge,ge.__value),u(D,"name","qm"),u(D,"class","in-l"),t[6].q.m===void 0&&Et(()=>t[77].call(D)),u(Q,"class","my-1 flex"),u(Re,"name","qb"),u(Re,"type","text"),u(Re,"class","in-s"),u(Re,"pattern",Il),u(Pe,"class","my-1"),u(ot,"name","qr"),u(ot,"type","text"),u(ot,"class","in-s"),u(ot,"pattern",Il),u(ot,"placeholder",ht=t[6].q.b+"/command"),u(xe,"class","my-1"),u(Ge,"class","float-right"),Ke.__value=0,j(Ke,Ke.__value),Xe.__value=1,j(Xe,Xe.__value),u(Te,"name","qt"),u(Te,"class","in-f w-1/2"),t[6].q.t===void 0&&Et(()=>t[80].call(Te)),u(lt,"name","qd"),u(lt,"type","number"),u(lt,"min","1"),u(lt,"max","3600"),u(lt,"class","in-l tr w-1/2"),lt.disabled=Bt=((bt=(We=t[6])==null?void 0:We.q)==null?void 0:bt.t)!=1,u(ae,"class","flex"),u(Je,"class","my-1"),u(nt,"class","grid grid-cols-3"),u(gt,"name","qi"),u(gt,"type","number"),u(gt,"min","500"),u(gt,"max","10000"),u(gt,"class","in-f tr w-1/2"),u(et,"name","qk"),u(et,"type","number"),u(et,"min","5"),u(et,"max","180"),u(et,"class","in-m tr w-1/2"),u(he,"name","qe"),u(he,"type","number"),u(he,"min","0"),u(he,"max","240"),u(he,"class","in-l tr w-1/2"),u(kt,"class","flex"),u(pt,"class","my-1"),u(e,"class","cnt")},m(We,bt){P(We,e,bt),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,d),s(m,h),Kt&&Kt.m(m,null),s(m,g),s(m,b),s(m,C),s(m,k),s(k,A),j(A,t[6].q.h),s(k,I),s(k,R),j(R,t[6].q.p),s(e,T),wt&&wt.m(e,null),s(e,F),s(e,L),s(L,K),s(L,z),s(L,q),s(L,B),j(B,t[6].q.u),s(e,Z),s(e,V),s(V,G),s(V,U),s(V,y),s(V,ne),j(ne,t[6].q.a),s(e,ee),s(e,Q),s(Q,ie),s(ie,fe),s(ie,le),s(ie,de),s(ie,oe),j(oe,t[6].q.c),s(Q,se),s(Q,pe),s(pe,S),s(pe,w),s(pe,O),s(pe,D),s(D,W),s(D,te),s(D,ue),s(D,be),s(D,ke),s(D,J),s(D,ve),s(D,ge),ze(D,t[6].q.m,!0),s(e,qe),s(e,Pe),s(Pe,Le),s(Pe,Ne),s(Pe,De),s(Pe,Re),j(Re,t[6].q.b),s(e,$e),s(e,xe),s(xe,St),s(xe,dt),s(xe,rt),s(xe,ot),j(ot,t[6].q.r),s(e,Lt),s(e,Je),s(Je,He),s(Je,tt),s(Je,Ge),s(Ge,Qe),s(Je,_e),s(Je,ae),s(ae,Te),s(Te,Ke),s(Ke,vt),s(Te,Xe),s(Xe,at),ze(Te,t[6].q.t,!0),s(ae,mt),s(ae,lt),j(lt,t[6].q.d),s(e,el),s(e,pt),s(pt,nt),s(nt,Yt),s(Yt,Ot),s(nt,Zt),s(nt,$t),s($t,Qt),s(nt,ll),s(nt,Ye),s(Ye,Mt),s(pt,It),s(pt,kt),s(kt,gt),j(gt,t[6].q.i),s(kt,jt),s(kt,et),j(et,t[6].q.k),s(kt,Rt),s(kt,he),j(he,t[6].q.e),Ie=!0,ye||(Vt=[ce(A,"input",t[72]),ce(R,"input",t[73]),ce(B,"input",t[74]),ce(ne,"input",t[75]),ce(oe,"input",t[76]),ce(D,"change",t[77]),ce(Re,"input",t[78]),ce(ot,"input",t[79]),ce(Te,"change",t[80]),ce(lt,"input",t[81]),ce(gt,"input",t[82]),ce(et,"input",t[83]),ce(he,"input",t[84])],ye=!0)},p(We,bt){var Ue,At,il,Ql,Xl,Zl,Jl,$l,xl,en,tn,Pn,Tn,qn,En,Dn,An,Ln,On,In,Rn,Fn,Bn,Un,zn,jn,Hn,yn,Wn,Gn,Vn,Kn;(!Ie||bt[0]&4)&&n!==(n=(((At=(Ue=We[2].conf)==null?void 0:Ue.mqtt)==null?void 0:At.title)??"MQTT")+"")&&E(i,n),(!Ie||bt[0]&4)&&_!==(_=(((Ql=(il=We[2].conf)==null?void 0:il.mqtt)==null?void 0:Ql.server)??"Server")+"")&&E(d,_),We[0].chip!="esp8266"?Kt?Kt.p(We,bt):(Kt=Ca(We),Kt.c(),Kt.m(m,g)):Kt&&(Kt.d(1),Kt=null),bt[0]&64&&A.value!==We[6].q.h&&j(A,We[6].q.h),bt[0]&64&&Be(R.value)!==We[6].q.p&&j(R,We[6].q.p),We[6].q.s.e?wt?(wt.p(We,bt),bt[0]&64&&X(wt,1)):(wt=Sa(We),wt.c(),X(wt,1),wt.m(e,F)):wt&&(ct(),x(wt,1,1,()=>{wt=null}),_t()),(!Ie||bt[0]&4)&&H!==(H=(((Zl=(Xl=We[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.user)??"Username")+"")&&E(K,H),bt[0]&64&&B.value!==We[6].q.u&&j(B,We[6].q.u),(!Ie||bt[0]&4)&&Y!==(Y=((($l=(Jl=We[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.pass)??"Password")+"")&&E(G,Y),bt[0]&64&&ne.value!==We[6].q.a&&j(ne,We[6].q.a),(!Ie||bt[0]&4)&&re!==(re=(((en=(xl=We[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.id)??"Client ID")+"")&&E(fe,re),(!Ie||bt[0]&64&&me!==(me=We[6].q.h))&&(oe.required=me),bt[0]&64&&oe.value!==We[6].q.c&&j(oe,We[6].q.c),(!Ie||bt[0]&4)&&we!==(we=(((Pn=(tn=We[2].conf)==null?void 0:tn.mqtt)==null?void 0:Pn.payload)??"Payload")+"")&&E(S,we),bt[0]&64&&ze(D,We[6].q.m),(!Ie||bt[0]&4)&&Ae!==(Ae=(((qn=(Tn=We[2].conf)==null?void 0:Tn.mqtt)==null?void 0:qn.publish)??"Publish topic")+"")&&E(Le,Ae),bt[0]&64&&Re.value!==We[6].q.b&&j(Re,We[6].q.b),(!Ie||bt[0]&4)&&ut!==(ut=(((Dn=(En=We[2].conf)==null?void 0:En.mqtt)==null?void 0:Dn.subscribe)??"Subscribe topic")+"")&&E(St,ut),(!Ie||bt[0]&64&&ht!==(ht=We[6].q.b+"/command"))&&u(ot,"placeholder",ht),bt[0]&64&&ot.value!==We[6].q.r&&j(ot,We[6].q.r),(!Ie||bt[0]&4)&&Fe!==(Fe=(((Ln=(An=We[2].conf)==null?void 0:An.mqtt)==null?void 0:Ln.update)??"Update method")+"")&&E(He,Fe),(!Ie||bt[0]&4)&&Ve!==(Ve=(((In=(On=We[2].conf)==null?void 0:On.mqtt)==null?void 0:In.interval)??"Interval")+"")&&E(Qe,Ve),(!Ie||bt[0]&4)&&Dt!==(Dt=(((Fn=(Rn=We[2].conf)==null?void 0:Rn.mqtt)==null?void 0:Fn.realtime)??"Real time")+"")&&E(vt,Dt),(!Ie||bt[0]&4)&&qt!==(qt=(((Un=(Bn=We[2].conf)==null?void 0:Bn.mqtt)==null?void 0:Un.interval)??"Interval")+"")&&E(at,qt),bt[0]&64&&ze(Te,We[6].q.t),(!Ie||bt[0]&64&&Bt!==(Bt=((jn=(zn=We[6])==null?void 0:zn.q)==null?void 0:jn.t)!=1))&&(lt.disabled=Bt),bt[0]&64&&Be(lt.value)!==We[6].q.d&&j(lt,We[6].q.d),(!Ie||bt[0]&4)&&Jt!==(Jt=(((yn=(Hn=We[2].conf)==null?void 0:Hn.mqtt)==null?void 0:yn.timeout)??"Timeout")+"")&&E(Ot,Jt),(!Ie||bt[0]&4)&&Gt!==(Gt=(((Gn=(Wn=We[2].conf)==null?void 0:Wn.mqtt)==null?void 0:Gn.keepalive)??"Keep-alive")+"")&&E(Qt,Gt),(!Ie||bt[0]&4)&&st!==(st=(((Kn=(Vn=We[2].conf)==null?void 0:Vn.mqtt)==null?void 0:Kn.autoreboot)??"Auto-reboot")+"")&&E(Mt,st),bt[0]&64&&Be(gt.value)!==We[6].q.i&&j(gt,We[6].q.i),bt[0]&64&&Be(et.value)!==We[6].q.k&&j(et,We[6].q.k),bt[0]&64&&Be(he.value)!==We[6].q.e&&j(he,We[6].q.e)},i(We){Ie||(X(wt),Ie=!0)},o(We){x(wt),Ie=!1},d(We){We&&N(e),Kt&&Kt.d(),wt&&wt.d(),ye=!1,zt(Vt)}}}function Ca(t){let e,l,n,i,o;return{c(){e=p("label"),l=p("input"),n=M(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",j(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),s(e,l),l.checked=t[6].q.s.e,s(e,n),i||(o=[ce(l,"change",t[71]),ce(l,"change",t[20])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,zt(o)}}}function Sa(t){let e,l,n,i,o,a,r,f,c,m,_,d,h;const g=[Hc,jc],b=[];function C(L,H){return L[6].q.s.c?0:1}n=C(t),i=b[n]=g[n](t);const k=[Vc,Gc],A=[];function I(L,H){return L[6].q.s.r?0:1}r=I(t),f=A[r]=k[r](t);const R=[Xc,Qc],T=[];function F(L,H){return L[6].q.s.k?0:1}return _=F(t),d=T[_]=R[_](t),{c(){e=p("div"),l=p("span"),i.c(),o=v(),a=p("span"),f.c(),c=v(),m=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(m,"class","flex pr-2"),u(e,"class","my-1 flex")},m(L,H){P(L,e,H),s(e,l),b[n].m(l,null),s(e,o),s(e,a),A[r].m(a,null),s(e,c),s(e,m),T[_].m(m,null),h=!0},p(L,H){let K=n;n=C(L),n===K?b[n].p(L,H):(ct(),x(b[K],1,1,()=>{b[K]=null}),_t(),i=b[n],i?i.p(L,H):(i=b[n]=g[n](L),i.c()),X(i,1),i.m(l,null));let z=r;r=I(L),r===z?A[r].p(L,H):(ct(),x(A[z],1,1,()=>{A[z]=null}),_t(),f=A[r],f?f.p(L,H):(f=A[r]=k[r](L),f.c()),X(f,1),f.m(a,null));let q=_;_=F(L),_===q?T[_].p(L,H):(ct(),x(T[q],1,1,()=>{T[q]=null}),_t(),d=T[_],d?d.p(L,H):(d=T[_]=R[_](L),d.c()),X(d,1),d.m(m,null))},i(L){h||(X(i),X(f),X(d),h=!0)},o(L){x(i),x(f),x(d),h=!1},d(L){L&&N(e),b[n].d(),A[r].d(),T[_].d()}}}function jc(t){let e,l;return e=new kl({props:{to:"/mqtt-ca",$$slots:{default:[yc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&8388608&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Hc(t){let e,l,n,i,o,a,r;return l=new kl({props:{to:"/mqtt-ca",$$slots:{default:[Wc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&8388608&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function yc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function Wc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&E(l,e)},d(o){o&&N(l)}}}function Gc(t){let e,l;return e=new kl({props:{to:"/mqtt-cert",$$slots:{default:[Kc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&8388608&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Vc(t){let e,l,n,i,o,a,r;return l=new kl({props:{to:"/mqtt-cert",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[18]),ce(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&8388608&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function Kc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function Yc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&E(l,e)},d(o){o&&N(l)}}}function Qc(t){let e,l;return e=new kl({props:{to:"/mqtt-key",$$slots:{default:[Zc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&8388608&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Xc(t){let e,l,n,i,o,a,r;return l=new kl({props:{to:"/mqtt-key",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[19]),ce(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&8388608&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function Zc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_key)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function Jc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&E(l,e)},d(o){o&&N(l)}}}function Ma(t){var Q,ie,re,fe,le,de,oe,me,se,pe,we,S;let e,l,n=(((re=(ie=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ie.domoticz)==null?void 0:re.title)??"Domoticz")+"",i,o,a,r,f,c,m,_,d=(((de=(le=(fe=t[2].conf)==null?void 0:fe.mqtt)==null?void 0:le.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"",h,g,b,C,k,A,I=(((se=(me=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:me.domoticz)==null?void 0:se.cidx)??"Current IDX")+"",R,T,F,L,H,K,z=(((S=(we=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:we.domoticz)==null?void 0:S.vidx)??"Voltage IDX")+"",q,B,Z,V,Y,G,U,y,ne,ee;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),h=M(d),g=p("br"),b=v(),C=p("input"),k=v(),A=p("div"),R=M(I),T=p("br"),F=v(),L=p("input"),H=v(),K=p("div"),q=M(z),B=M(`: L1, L2 & L3 - `),Z=p("div"),V=p("input"),Y=v(),G=p("input"),U=v(),y=p("input"),u(l,"class","text-sm"),u(a,"href",hl("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(C,"name","oe"),u(C,"type","text"),u(C,"class","in-f tr w-full"),u(C,"pattern",Yn),u(_,"class","w-1/2"),u(L,"name","oc"),u(L,"type","text"),u(L,"class","in-l tr w-full"),u(L,"pattern",Yn),u(A,"class","w-1/2"),u(m,"class","my-1 flex"),u(V,"name","ou1"),u(V,"type","text"),u(V,"class","in-f tr w-1/3"),u(V,"pattern",Yn),u(G,"name","ou2"),u(G,"type","text"),u(G,"class","in-m tr w-1/3"),u(G,"pattern",Yn),u(y,"name","ou3"),u(y,"type","text"),u(y,"class","in-l tr w-1/3"),u(y,"pattern",Yn),u(Z,"class","flex"),u(K,"class","my-1"),u(e,"class","cnt")},m(w,O){P(w,e,O),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,h),s(_,g),s(_,b),s(_,C),j(C,t[6].o.e),s(m,k),s(m,A),s(A,R),s(A,T),s(A,F),s(A,L),j(L,t[6].o.c),s(e,H),s(e,K),s(K,q),s(K,B),s(K,Z),s(Z,V),j(V,t[6].o.u1),s(Z,Y),s(Z,G),j(G,t[6].o.u2),s(Z,U),s(Z,y),j(y,t[6].o.u3),ne||(ee=[ce(C,"input",t[85]),ce(L,"input",t[86]),ce(V,"input",t[87]),ce(G,"input",t[88]),ce(y,"input",t[89])],ne=!0)},p(w,O){var D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae;O[0]&4&&n!==(n=(((te=(W=(D=w[2].conf)==null?void 0:D.mqtt)==null?void 0:W.domoticz)==null?void 0:te.title)??"Domoticz")+"")&&E(i,n),O[0]&4&&d!==(d=(((ke=(be=(ue=w[2].conf)==null?void 0:ue.mqtt)==null?void 0:be.domoticz)==null?void 0:ke.eidx)??"Electricity IDX")+"")&&E(h,d),O[0]&64&&C.value!==w[6].o.e&&j(C,w[6].o.e),O[0]&4&&I!==(I=(((ge=(ve=(J=w[2].conf)==null?void 0:J.mqtt)==null?void 0:ve.domoticz)==null?void 0:ge.cidx)??"Current IDX")+"")&&E(R,I),O[0]&64&&L.value!==w[6].o.c&&j(L,w[6].o.c),O[0]&4&&z!==(z=(((Ae=(Pe=(qe=w[2].conf)==null?void 0:qe.mqtt)==null?void 0:Pe.domoticz)==null?void 0:Ae.vidx)??"Voltage IDX")+"")&&E(q,z),O[0]&64&&V.value!==w[6].o.u1&&j(V,w[6].o.u1),O[0]&64&&G.value!==w[6].o.u2&&j(G,w[6].o.u2),O[0]&64&&y.value!==w[6].o.u3&&j(y,w[6].o.u3)},d(w){w&&N(e),ne=!1,zt(ee)}}}function Na(t){var U,y,ne,ee,Q,ie,re,fe,le,de,oe,me;let e,l,n=(((ne=(y=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:y.ha)==null?void 0:ne.title)??"Home-Assistant")+"",i,o,a,r,f,c,m,_=(((ie=(Q=(ee=t[2].conf)==null?void 0:ee.mqtt)==null?void 0:Q.ha)==null?void 0:ie.discovery)??"Discovery topic prefix")+"",d,h,g,b,C,k,A=(((le=(fe=(re=t[2].conf)==null?void 0:re.mqtt)==null?void 0:fe.ha)==null?void 0:le.hostname)??"Hostname for URL")+"",I,R,T,F,L,H,K,z=(((me=(oe=(de=t[2].conf)==null?void 0:de.mqtt)==null?void 0:oe.ha)==null?void 0:me.tag)??"Name tag")+"",q,B,Z,V,Y,G;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=M(_),h=p("br"),g=v(),b=p("input"),C=v(),k=p("div"),I=M(A),R=p("br"),T=v(),F=p("input"),H=v(),K=p("div"),q=M(z),B=p("br"),Z=v(),V=p("input"),u(l,"class","text-sm"),u(a,"href",hl("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(b,"pattern",Il),u(m,"class","my-1"),u(F,"name","hh"),u(F,"type","text"),u(F,"class","in-s"),u(F,"placeholder",L=t[6].g.h+".local"),u(F,"pattern",Il),u(k,"class","my-1"),u(V,"name","hn"),u(V,"type","text"),u(V,"class","in-s"),u(V,"pattern",Il),u(K,"class","my-1"),u(e,"class","cnt")},m(se,pe){P(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,d),s(m,h),s(m,g),s(m,b),j(b,t[6].h.t),s(e,C),s(e,k),s(k,I),s(k,R),s(k,T),s(k,F),j(F,t[6].h.h),s(e,H),s(e,K),s(K,q),s(K,B),s(K,Z),s(K,V),j(V,t[6].h.n),Y||(G=[ce(b,"input",t[90]),ce(F,"input",t[91]),ce(V,"input",t[92])],Y=!0)},p(se,pe){var we,S,w,O,D,W,te,ue,be,ke,J,ve;pe[0]&4&&n!==(n=(((w=(S=(we=se[2].conf)==null?void 0:we.mqtt)==null?void 0:S.ha)==null?void 0:w.title)??"Home-Assistant")+"")&&E(i,n),pe[0]&4&&_!==(_=(((W=(D=(O=se[2].conf)==null?void 0:O.mqtt)==null?void 0:D.ha)==null?void 0:W.discovery)??"Discovery topic prefix")+"")&&E(d,_),pe[0]&64&&b.value!==se[6].h.t&&j(b,se[6].h.t),pe[0]&4&&A!==(A=(((be=(ue=(te=se[2].conf)==null?void 0:te.mqtt)==null?void 0:ue.ha)==null?void 0:be.hostname)??"Hostname for URL")+"")&&E(I,A),pe[0]&64&&L!==(L=se[6].g.h+".local")&&u(F,"placeholder",L),pe[0]&64&&F.value!==se[6].h.h&&j(F,se[6].h.h),pe[0]&4&&z!==(z=(((ve=(J=(ke=se[2].conf)==null?void 0:ke.mqtt)==null?void 0:J.ha)==null?void 0:ve.tag)??"Name tag")+"")&&E(q,z),pe[0]&64&&V.value!==se[6].h.n&&j(V,se[6].h.n)},d(se){se&&N(e),Y=!1,zt(G)}}}function Pa(t){var q,B,Z,V,Y,G,U,y,ne,ee;let e,l,n=(((B=(q=t[2].conf)==null?void 0:q.cloud)==null?void 0:B.title)??"Cloud connections")+"",i,o,a,r,f,c,m=(V=(Z=t[0])==null?void 0:Z.features)==null?void 0:V.includes("cloud"),_,d,h,g,b,C=(((G=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:G.es)??"Energy Speedometer")+"",k,A,I,R=(y=(U=t[0])==null?void 0:U.features)==null?void 0:y.includes("zc"),T,F,L,H=m&&Ta(t),K=((ee=(ne=t[6])==null?void 0:ne.c)==null?void 0:ee.es)&&Aa(t),z=R&&Oa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),H&&H.c(),_=v(),d=p("div"),h=p("label"),g=p("input"),b=v(),k=M(C),A=v(),K&&K.c(),I=v(),z&&z.c(),u(l,"class","text-sm"),u(a,"href",hl("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(g,"type","checkbox"),u(g,"class","rounded mb-1"),u(g,"name","ces"),g.__value="true",j(g,g.__value),u(d,"class","my-1"),u(e,"class","cnt")},m(Q,ie){P(Q,e,ie),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),H&&H.m(e,null),s(e,_),s(e,d),s(d,h),s(h,g),g.checked=t[6].c.es,s(h,b),s(h,k),s(d,A),K&&K.m(d,null),s(e,I),z&&z.m(e,null),T=!0,F||(L=ce(g,"change",t[95]),F=!0)},p(Q,ie){var re,fe,le,de,oe,me,se,pe,we,S;(!T||ie[0]&4)&&n!==(n=(((fe=(re=Q[2].conf)==null?void 0:re.cloud)==null?void 0:fe.title)??"Cloud connections")+"")&&E(i,n),ie[0]&1&&(m=(de=(le=Q[0])==null?void 0:le.features)==null?void 0:de.includes("cloud")),m?H?H.p(Q,ie):(H=Ta(Q),H.c(),H.m(e,_)):H&&(H.d(1),H=null),ie[0]&64&&(g.checked=Q[6].c.es),(!T||ie[0]&4)&&C!==(C=(((me=(oe=Q[2].conf)==null?void 0:oe.cloud)==null?void 0:me.es)??"Energy Speedometer")+"")&&E(k,C),(pe=(se=Q[6])==null?void 0:se.c)!=null&&pe.es?K?(K.p(Q,ie),ie[0]&64&&X(K,1)):(K=Aa(Q),K.c(),X(K,1),K.m(d,null)):K&&(ct(),x(K,1,1,()=>{K=null}),_t()),ie[0]&1&&(R=(S=(we=Q[0])==null?void 0:we.features)==null?void 0:S.includes("zc")),R?z?z.p(Q,ie):(z=Oa(Q),z.c(),z.m(e,null)):z&&(z.d(1),z=null)},i(Q){T||(X(K),T=!0)},o(Q){x(K),T=!1},d(Q){Q&&N(e),H&&H.d(),K&&K.d(),z&&z.d(),F=!1,L()}}}function Ta(t){var _,d;let e,l,n,i,o=(((d=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:d.ams)??"AMS reader cloud")+"",a,r,f,c,m=t[6].c.e&&qa(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=v(),a=M(o),r=v(),m&&m.c(),u(n,"type","checkbox"),u(n,"name","ce"),n.__value="true",j(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(h,g){P(h,e,g),s(e,l),s(l,n),n.checked=t[6].c.e,s(l,i),s(l,a),s(e,r),m&&m.m(e,null),f||(c=ce(n,"change",t[93]),f=!0)},p(h,g){var b,C;g[0]&64&&(n.checked=h[6].c.e),g[0]&4&&o!==(o=(((C=(b=h[2].conf)==null?void 0:b.cloud)==null?void 0:C.ams)??"AMS reader cloud")+"")&&E(a,o),h[6].c.e?m?m.p(h,g):(m=qa(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(h){h&&N(e),m&&m.d(),f=!1,c()}}}function qa(t){let e,l,n,i,o,a,r,f,c,m,_=t[6].c.p==0&&Ea(),d=t[5]&&Da(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),o=p("option"),o.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=Wt(),u(l,"for","cp"),o.__value=1,j(o,o.__value),a.__value=2,j(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&Et(()=>t[94].call(i)),u(e,"class","ml-6")},m(h,g){P(h,e,g),s(e,l),s(e,n),s(e,i),_&&_.m(i,null),s(i,o),s(i,a),ze(i,t[6].c.p,!0),P(h,r,g),d&&d.m(h,g),P(h,f,g),c||(m=ce(i,"change",t[94]),c=!0)},p(h,g){h[6].c.p==0?_||(_=Ea(),_.c(),_.m(i,o)):_&&(_.d(1),_=null),g[0]&64&&ze(i,h[6].c.p),h[5]?d?d.p(h,g):(d=Da(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(N(e),N(r),N(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function Ea(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,j(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Da(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,o){P(i,e,o),l||(n=ce(e,"click",t[23]),l=!0)},p:je,d(i){i&&N(e),l=!1,n()}}}function Aa(t){let e,l,n=t[0].mac+"",i,o,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&La(t);return{c(){e=p("div"),l=M("MAC: "),i=M(n),o=v(),a=p("div"),r=M("Meter ID: "),c=M(f),m=v(),h&&h.c(),_=Wt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(g,b){P(g,e,b),s(e,l),s(e,i),P(g,o,b),P(g,a,b),s(a,r),s(a,c),P(g,m,b),h&&h.m(g,b),P(g,_,b),d=!0},p(g,b){(!d||b[0]&1)&&n!==(n=g[0].mac+"")&&E(i,n),(!d||b[0]&1)&&f!==(f=(g[0].meter.id?g[0].meter.id:"missing, required")+"")&&E(c,f),g[0].mac&&g[0].meter.id?h?(h.p(g,b),b[0]&1&&X(h,1)):(h=La(g),h.c(),X(h,1),h.m(_.parentNode,_)):h&&(ct(),x(h,1,1,()=>{h=null}),_t())},i(g){d||(X(h),d=!0)},o(g){x(h),d=!1},d(g){g&&(N(e),N(o),N(a),N(m),N(_)),h&&h.d(g)}}}function La(t){let e,l,n;return l=new qc({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","pl-2")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function Oa(t){let e,l,n,i,o,a,r,f,c=t[6].c.ze&&Ia(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=M(" ZmartCharge"),o=v(),c&&c.c(),a=Wt(),u(n,"type","checkbox"),u(n,"name","cze"),n.__value="true",j(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(m,_){P(m,e,_),s(e,l),s(l,n),n.checked=t[6].c.ze,s(l,i),P(m,o,_),c&&c.m(m,_),P(m,a,_),r||(f=ce(n,"change",t[96]),r=!0)},p(m,_){_[0]&64&&(n.checked=m[6].c.ze),m[6].c.ze?c?c.p(m,_):(c=Ia(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(N(e),N(o),N(a)),c&&c.d(m),r=!1,f()}}}function Ia(t){let e,l,n,i;return{c(){e=p("div"),l=p("input"),u(l,"name","czt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder","ZmartCharge token"),u(e,"class","my-1")},m(o,a){P(o,e,a),s(e,l),j(l,t[6].c.zt),n||(i=ce(l,"input",t[97]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].c.zt&&j(l,o[6].c.zt)},d(o){o&&N(e),n=!1,i()}}}function Ra(t){var z,q,B,Z,V;let e,l,n=(((q=(z=t[2].conf)==null?void 0:z.thresholds)==null?void 0:q.title)??"Thresholds")+"",i,o,a,r,f,c,m,_,d,h,g=(((Z=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:Z.avg)??"Average of")+"",b,C,k,A,I,R=(((V=t[2].common)==null?void 0:V.hours)??"hours")+"",T,F,L,H=ft({length:9}),K=[];for(let Y=0;Yt[101].call(C)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(q,B){P(q,e,B),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m);for(let Z=0;Z20&&Ha(t),d=((A=(k=(C=t[6])==null?void 0:C.i)==null?void 0:k.d)==null?void 0:A.d)>0&&Ga(t),h=t[0].chip=="esp8266"&&Va(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),_&&_.c(),f=v(),d&&d.c(),c=v(),h&&h.c(),u(l,"class","text-sm"),u(a,"href",hl("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(I,R){P(I,e,R),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),_&&_.m(e,null),s(e,f),d&&d.m(e,null),s(e,c),h&&h.m(e,null),m=!0},p(I,R){var T,F,L,H,K;(!m||R[0]&4)&&n!==(n=(((F=(T=I[2].conf)==null?void 0:T.hw)==null?void 0:F.title)??"Hardware")+"")&&E(i,n),I[0].board>20?_?(_.p(I,R),R[0]&1&&X(_,1)):(_=Ha(I),_.c(),X(_,1),_.m(e,f)):_&&(ct(),x(_,1,1,()=>{_=null}),_t()),((K=(H=(L=I[6])==null?void 0:L.i)==null?void 0:H.d)==null?void 0:K.d)>0?d?d.p(I,R):(d=Ga(I),d.c(),d.m(e,c)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,R):(h=Va(I),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(I){m||(X(_),m=!0)},o(I){x(_),m=!1},d(I){I&&N(e),_&&_.d(),d&&d.d(),h&&h.d()}}}function Ha(t){var Bt,el,pt,nt,Yt,Jt,Ot,Zt,$t,Gt,Qt,ll,Ye,st,Mt,It,kt,gt,jt,et,Rt,he,Ie,ye,Vt,Kt,wt,cl,ol,Ht,yt,ul,Ee;let e,l,n,i,o=(((pt=(el=(Bt=t[2].conf)==null?void 0:Bt.hw)==null?void 0:el.han)==null?void 0:pt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((Jt=(Yt=(nt=t[2].conf)==null?void 0:nt.hw)==null?void 0:Yt.han)==null?void 0:Jt.tx)??"HAN TX")+"",g,b,C,k,A,I,R,T,F,L,H=((($t=(Zt=(Ot=t[2].conf)==null?void 0:Ot.hw)==null?void 0:Zt.han)==null?void 0:$t.pullup)??"pullup")+"",K,z,q,B,Z=(((Qt=(Gt=t[2].conf)==null?void 0:Gt.hw)==null?void 0:Qt.ap_btn)??"AP button")+"",V,Y,G,U,y,ne,ee=(((st=(Ye=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:Ye.led)==null?void 0:st.title)??"LED")+"",Q,ie,re,fe,le,de,oe,me,se,pe,we=(((kt=(It=(Mt=t[2].conf)==null?void 0:Mt.hw)==null?void 0:It.led)==null?void 0:kt.inverted)??"inverted")+"",S,w,O,D=(((et=(jt=(gt=t[2].conf)==null?void 0:gt.hw)==null?void 0:jt.led)==null?void 0:et.rgb)??"RGB")+"",W,te,ue,be,ke=(((Ie=(he=(Rt=t[2].conf)==null?void 0:Rt.hw)==null?void 0:he.led)==null?void 0:Ie.inverted)??"inverted")+"",J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut=(((Kt=(Vt=(ye=t[2].conf)==null?void 0:ye.hw)==null?void 0:Vt.led)==null?void 0:Kt.disable)??"LED dis. GPIO")+"",St,dt,rt,ot,ht,Lt=(((cl=(wt=t[2].conf)==null?void 0:wt.hw)==null?void 0:cl.temp)??"Temperature")+"",Je,Fe,He,tt,Ge,Ve,Qe=(((Ht=(ol=t[2].conf)==null?void 0:ol.hw)==null?void 0:Ht.temp_analog)??"Analog temp")+"",_e,ae,Te,Ke,Dt,vt,Xe,qt,at;m=new eo({props:{chip:t[0].chip}}),A=new eo({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&ya(t),lt=((Ee=(ul=(yt=t[6])==null?void 0:yt.i)==null?void 0:ul.v)==null?void 0:Ee.p)>0&&Wa(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=M(o),r=p("br"),f=v(),c=p("select"),Me(m.$$.fragment),_=v(),d=p("div"),g=M(h),b=p("br"),C=v(),k=p("select"),Me(A.$$.fragment),I=v(),R=p("div"),T=p("label"),F=p("input"),L=v(),K=M(H),z=v(),q=p("div"),B=p("div"),V=M(Z),Y=p("br"),G=v(),U=p("input"),y=v(),ne=p("div"),Q=M(ee),ie=p("br"),re=v(),fe=p("div"),le=p("input"),de=v(),oe=p("div"),me=p("label"),se=p("input"),pe=v(),S=M(we),w=v(),O=p("div"),W=M(D),te=p("label"),ue=p("input"),be=v(),J=M(ke),ve=p("br"),ge=v(),qe=p("div"),Pe=p("input"),Ae=v(),Le=p("input"),Ne=v(),De=p("input"),Re=v(),$e=p("div"),xe=p("div"),St=M(ut),dt=v(),rt=p("input"),ot=v(),ht=p("div"),Je=M(Lt),Fe=p("br"),He=v(),tt=p("input"),Ge=v(),Ve=p("div"),_e=M(Qe),ae=p("br"),Te=v(),Ke=p("input"),Dt=v(),mt&&mt.c(),vt=v(),lt&<.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&Et(()=>t[102].call(c)),u(i,"class","w-1/3"),u(k,"name","iht"),u(k,"class","in-l w-full"),t[6].i.h.t===void 0&&Et(()=>t[103].call(k)),u(d,"class","w-1/3"),u(F,"name","ihu"),F.__value="true",j(F,F.__value),u(F,"type","checkbox"),u(F,"class","rounded mb-1"),u(T,"class","ml-2"),u(R,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[12]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(le,"name","ilp"),u(le,"type","number"),u(le,"min","0"),u(le,"max",t[12]),u(le,"class","in-l tr w-full"),u(fe,"class","flex"),u(ne,"class","w-1/3"),u(se,"name","ili"),se.__value="true",j(se,se.__value),u(se,"type","checkbox"),u(se,"class","rounded mb-1"),u(me,"class","ml-4"),u(oe,"class","w-1/3"),u(ue,"name","iri"),ue.__value="true",j(ue,ue.__value),u(ue,"type","checkbox"),u(ue,"class","rounded mb-1"),u(te,"class","ml-4"),u(Pe,"name","irr"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[12]),u(Pe,"class","in-f tr w-1/3"),u(Le,"name","irg"),u(Le,"type","number"),u(Le,"min","0"),u(Le,"max",t[12]),u(Le,"class","in-m tr w-1/3"),u(De,"name","irb"),u(De,"type","number"),u(De,"min","0"),u(De,"max",t[12]),u(De,"class","in-l tr w-1/3"),u(qe,"class","flex"),u(O,"class","w-full"),u(rt,"name","idd"),u(rt,"type","number"),u(rt,"min","0"),u(rt,"max",t[12]),u(rt,"class","in-s tr"),u(xe,"class","my-1 pr-1 w-1/3"),u($e,"class","w-full"),u(tt,"name","itd"),u(tt,"type","number"),u(tt,"min","0"),u(tt,"max",t[12]),u(tt,"class","in-f tr w-full"),u(ht,"class","my-1 w-1/3"),u(Ke,"name","ita"),u(Ke,"type","number"),u(Ke,"min","0"),u(Ke,"max",t[12]),u(Ke,"class","in-l tr w-full"),u(Ve,"class","my-1 pr-1 w-1/3"),u(q,"class","flex flex-wrap")},m($,Oe){P($,e,Oe),P($,l,Oe),P($,n,Oe),s(n,i),s(i,a),s(i,r),s(i,f),s(i,c),Ce(m,c,null),ze(c,t[6].i.h.p,!0),s(n,_),s(n,d),s(d,g),s(d,b),s(d,C),s(d,k),Ce(A,k,null),ze(k,t[6].i.h.t,!0),s(n,I),s(n,R),s(R,T),s(T,F),F.checked=t[6].i.h.u,s(T,L),s(T,K),P($,z,Oe),P($,q,Oe),s(q,B),s(B,V),s(B,Y),s(B,G),s(B,U),j(U,t[6].i.a),s(q,y),s(q,ne),s(ne,Q),s(ne,ie),s(ne,re),s(ne,fe),s(fe,le),j(le,t[6].i.l.p),s(q,de),s(q,oe),s(oe,me),s(me,se),se.checked=t[6].i.l.i,s(me,pe),s(me,S),s(q,w),s(q,O),s(O,W),s(O,te),s(te,ue),ue.checked=t[6].i.r.i,s(te,be),s(te,J),s(O,ve),s(O,ge),s(O,qe),s(qe,Pe),j(Pe,t[6].i.r.r),s(qe,Ae),s(qe,Le),j(Le,t[6].i.r.g),s(qe,Ne),s(qe,De),j(De,t[6].i.r.b),s(q,Re),s(q,$e),s($e,xe),s(xe,St),s(xe,dt),s(xe,rt),j(rt,t[6].i.d.d),s(q,ot),s(q,ht),s(ht,Je),s(ht,Fe),s(ht,He),s(ht,tt),j(tt,t[6].i.t.d),s(q,Ge),s(q,Ve),s(Ve,_e),s(Ve,ae),s(Ve,Te),s(Ve,Ke),j(Ke,t[6].i.t.a),s(q,Dt),mt&&mt.m(q,null),s(q,vt),lt&<.m(q,null),Xe=!0,qt||(at=[ce(c,"change",t[102]),ce(k,"change",t[103]),ce(F,"change",t[104]),ce(U,"input",t[105]),ce(le,"input",t[106]),ce(se,"change",t[107]),ce(ue,"change",t[108]),ce(Pe,"input",t[109]),ce(Le,"input",t[110]),ce(De,"input",t[111]),ce(rt,"input",t[112]),ce(tt,"input",t[113]),ce(Ke,"input",t[114])],qt=!0)},p($,Oe){var al,_l,vl,fl,bl,gl,Pl,Rl,Fl,Bl,Ul,zl,jl,Hl,yl,Wl,Gl,Vl,Kl,Yl,We,bt,Ue,At,il,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Xe||Oe[0]&4)&&o!==(o=(((vl=(_l=(al=$[2].conf)==null?void 0:al.hw)==null?void 0:_l.han)==null?void 0:vl.rx)??"HAN RX")+"")&&E(a,o);const it={};Oe[0]&1&&(it.chip=$[0].chip),m.$set(it),Oe[0]&64&&ze(c,$[6].i.h.p),(!Xe||Oe[0]&4)&&h!==(h=(((gl=(bl=(fl=$[2].conf)==null?void 0:fl.hw)==null?void 0:bl.han)==null?void 0:gl.tx)??"HAN TX")+"")&&E(g,h);const Nt={};Oe[0]&1&&(Nt.chip=$[0].chip),A.$set(Nt),Oe[0]&64&&ze(k,$[6].i.h.t),Oe[0]&64&&(F.checked=$[6].i.h.u),(!Xe||Oe[0]&4)&&H!==(H=(((Fl=(Rl=(Pl=$[2].conf)==null?void 0:Pl.hw)==null?void 0:Rl.han)==null?void 0:Fl.pullup)??"pullup")+"")&&E(K,H),(!Xe||Oe[0]&4)&&Z!==(Z=(((Ul=(Bl=$[2].conf)==null?void 0:Bl.hw)==null?void 0:Ul.ap_btn)??"AP button")+"")&&E(V,Z),(!Xe||Oe[0]&4096)&&u(U,"max",$[12]),Oe[0]&64&&Be(U.value)!==$[6].i.a&&j(U,$[6].i.a),(!Xe||Oe[0]&4)&&ee!==(ee=(((Hl=(jl=(zl=$[2].conf)==null?void 0:zl.hw)==null?void 0:jl.led)==null?void 0:Hl.title)??"LED")+"")&&E(Q,ee),(!Xe||Oe[0]&4096)&&u(le,"max",$[12]),Oe[0]&64&&Be(le.value)!==$[6].i.l.p&&j(le,$[6].i.l.p),Oe[0]&64&&(se.checked=$[6].i.l.i),(!Xe||Oe[0]&4)&&we!==(we=(((Gl=(Wl=(yl=$[2].conf)==null?void 0:yl.hw)==null?void 0:Wl.led)==null?void 0:Gl.inverted)??"inverted")+"")&&E(S,we),(!Xe||Oe[0]&4)&&D!==(D=(((Yl=(Kl=(Vl=$[2].conf)==null?void 0:Vl.hw)==null?void 0:Kl.led)==null?void 0:Yl.rgb)??"RGB")+"")&&E(W,D),Oe[0]&64&&(ue.checked=$[6].i.r.i),(!Xe||Oe[0]&4)&&ke!==(ke=(((Ue=(bt=(We=$[2].conf)==null?void 0:We.hw)==null?void 0:bt.led)==null?void 0:Ue.inverted)??"inverted")+"")&&E(J,ke),(!Xe||Oe[0]&4096)&&u(Pe,"max",$[12]),Oe[0]&64&&Be(Pe.value)!==$[6].i.r.r&&j(Pe,$[6].i.r.r),(!Xe||Oe[0]&4096)&&u(Le,"max",$[12]),Oe[0]&64&&Be(Le.value)!==$[6].i.r.g&&j(Le,$[6].i.r.g),(!Xe||Oe[0]&4096)&&u(De,"max",$[12]),Oe[0]&64&&Be(De.value)!==$[6].i.r.b&&j(De,$[6].i.r.b),(!Xe||Oe[0]&4)&&ut!==(ut=(((Ql=(il=(At=$[2].conf)==null?void 0:At.hw)==null?void 0:il.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&E(St,ut),(!Xe||Oe[0]&4096)&&u(rt,"max",$[12]),Oe[0]&64&&Be(rt.value)!==$[6].i.d.d&&j(rt,$[6].i.d.d),(!Xe||Oe[0]&4)&&Lt!==(Lt=(((Zl=(Xl=$[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&E(Je,Lt),(!Xe||Oe[0]&4096)&&u(tt,"max",$[12]),Oe[0]&64&&Be(tt.value)!==$[6].i.t.d&&j(tt,$[6].i.t.d),(!Xe||Oe[0]&4)&&Qe!==(Qe=((($l=(Jl=$[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&E(_e,Qe),(!Xe||Oe[0]&4096)&&u(Ke,"max",$[12]),Oe[0]&64&&Be(Ke.value)!==$[6].i.t.a&&j(Ke,$[6].i.t.a),$[0].chip!="esp8266"?mt?mt.p($,Oe):(mt=ya($),mt.c(),mt.m(q,vt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=$[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?lt?lt.p($,Oe):(lt=Wa($),lt.c(),lt.m(q,null)):lt&&(lt.d(1),lt=null)},i($){Xe||(X(m.$$.fragment,$),X(A.$$.fragment,$),Xe=!0)},o($){x(m.$$.fragment,$),x(A.$$.fragment,$),Xe=!1},d($){$&&(N(e),N(l),N(n),N(z),N(q)),Se(m),Se(A),mt&&mt.d(),lt&<.d(),qt=!1,zt(at)}}}function ya(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[12]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].i.v.p),r||(f=ce(a,"input",t[115]),r=!0)},p(d,h){var g,b,C;h[0]&4&&l!==(l=(((C=(b=(g=d[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:C.title)??"Vcc")+"")&&E(n,l),h[0]&4096&&u(a,"max",d[12]),h[0]&64&&Be(a.value)!==d[6].i.v.p&&j(a,d[6].i.v.p)},d(d){d&&N(e),r=!1,f()}}}function Wa(t){var g,b,C;let e,l=(((C=(b=(g=t[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:C.divider)??"Voltage divider")+"",n,i,o,a,r,f,c,m,_,d,h;return{c(){var k,A,I,R,T,F;e=p("div"),n=M(l),i=p("br"),o=v(),a=p("div"),r=p("input"),c=v(),m=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",f=((I=(A=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:A.vcc)==null?void 0:I.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((F=(T=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:T.vcc)==null?void 0:F.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(k,A){P(k,e,A),s(e,n),s(e,i),s(e,o),s(e,a),s(a,r),j(r,t[6].i.v.d.v),s(a,c),s(a,m),j(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[116]),ce(m,"input",t[117])],d=!0)},p(k,A){var I,R,T,F,L,H,K,z,q;A[0]&4&&l!==(l=(((T=(R=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:R.vcc)==null?void 0:T.divider)??"Voltage divider")+"")&&E(n,l),A[0]&4&&f!==(f=((H=(L=(F=k[2].conf)==null?void 0:F.hw)==null?void 0:L.vcc)==null?void 0:H.div_vcc)??"VCC")&&u(r,"placeholder",f),A[0]&64&&Be(r.value)!==k[6].i.v.d.v&&j(r,k[6].i.v.d.v),A[0]&4&&_!==(_=((q=(z=(K=k[2].conf)==null?void 0:K.hw)==null?void 0:z.vcc)==null?void 0:q.div_gnd)??"GND")&&u(m,"placeholder",_),A[0]&64&&Be(m.value)!==k[6].i.v.d.g&&j(m,k[6].i.v.d.g)},d(k){k&&N(e),d=!1,zt(h)}}}function Ga(t){var g,b,C,k,A,I,R,T,F,L,H,K;let e,l=(((k=(C=(b=(g=t[2].conf)==null?void 0:g.hw)==null?void 0:b.led)==null?void 0:C.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,o,a,r=(((T=(R=(I=(A=t[2].conf)==null?void 0:A.hw)==null?void 0:I.led)==null?void 0:R.behaviour)==null?void 0:T.enabled)??"Enabled")+"",f,c,m=(((K=(H=(L=(F=t[2].conf)==null?void 0:F.hw)==null?void 0:L.led)==null?void 0:H.behaviour)==null?void 0:K.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=M(l),i=v(),o=p("select"),a=p("option"),f=M(r),c=p("option"),_=M(m),a.__value=0,j(a,a.__value),c.__value=1,j(c,c.__value),u(o,"name","idb"),u(o,"class","in-s"),t[6].i.d.b===void 0&&Et(()=>t[118].call(o)),u(e,"class","my-1 w-full")},m(z,q){P(z,e,q),s(e,n),s(e,i),s(e,o),s(o,a),s(a,f),s(o,c),s(c,_),ze(o,t[6].i.d.b,!0),d||(h=ce(o,"change",t[118]),d=!0)},p(z,q){var B,Z,V,Y,G,U,y,ne,ee,Q,ie,re;q[0]&4&&l!==(l=(((Y=(V=(Z=(B=z[2].conf)==null?void 0:B.hw)==null?void 0:Z.led)==null?void 0:V.behaviour)==null?void 0:Y.title)??"LED behaviour")+"")&&E(n,l),q[0]&4&&r!==(r=(((ne=(y=(U=(G=z[2].conf)==null?void 0:G.hw)==null?void 0:U.led)==null?void 0:y.behaviour)==null?void 0:ne.enabled)??"Enabled")+"")&&E(f,r),q[0]&4&&m!==(m=(((re=(ie=(Q=(ee=z[2].conf)==null?void 0:ee.hw)==null?void 0:Q.led)==null?void 0:ie.behaviour)==null?void 0:re.disabled)??"Disabled")+"")&&E(_,m),q[0]&64&&ze(o,z[6].i.d.b)},d(z){z&&N(e),d=!1,h()}}}function Va(t){var T,F,L,H,K,z;let e,l,n,i,o=(((L=(F=(T=t[2].conf)==null?void 0:T.hw)==null?void 0:F.vcc)==null?void 0:L.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((z=(K=(H=t[2].conf)==null?void 0:H.hw)==null?void 0:K.vcc)==null?void 0:z.multiplier)??"Multiplier")+"",h,g,b,C,k,A,I,R=(t[0].board==2||t[0].board==100)&&Ka(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=M(o),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=M(d),g=p("br"),b=v(),C=p("input"),k=v(),R&&R.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(C,"name","ivm"),u(C,"type","number"),u(C,"min","0.1"),u(C,"max","10"),u(C,"step","0.01"),u(C,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(q,B){P(q,e,B),P(q,l,B),P(q,n,B),s(n,i),s(i,a),s(i,r),s(i,f),s(i,c),j(c,t[6].i.v.o),s(n,m),s(n,_),s(_,h),s(_,g),s(_,b),s(_,C),j(C,t[6].i.v.m),s(n,k),R&&R.m(n,null),A||(I=[ce(c,"input",t[119]),ce(C,"input",t[120])],A=!0)},p(q,B){var Z,V,Y,G,U,y;B[0]&4&&o!==(o=(((Y=(V=(Z=q[2].conf)==null?void 0:Z.hw)==null?void 0:V.vcc)==null?void 0:Y.offset)??"Vcc offset")+"")&&E(a,o),B[0]&64&&Be(c.value)!==q[6].i.v.o&&j(c,q[6].i.v.o),B[0]&4&&d!==(d=(((y=(U=(G=q[2].conf)==null?void 0:G.hw)==null?void 0:U.vcc)==null?void 0:y.multiplier)??"Multiplier")+"")&&E(h,d),B[0]&64&&Be(C.value)!==q[6].i.v.m&&j(C,q[6].i.v.m),q[0].board==2||q[0].board==100?R?R.p(q,B):(R=Ka(q),R.c(),R.m(n,null)):R&&(R.d(1),R=null)},d(q){q&&(N(e),N(l),N(n)),R&&R.d(),A=!1,zt(I)}}}function Ka(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].i.v.b),r||(f=ce(a,"input",t[121]),r=!0)},p(d,h){var g,b,C;h[0]&4&&l!==(l=(((C=(b=(g=d[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:C.boot)??"Boot limit")+"")&&E(n,l),h[0]&64&&Be(a.value)!==d[6].i.v.b&&j(a,d[6].i.v.b)},d(d){d&&N(e),r=!1,f()}}}function Ya(t){var R,T,F,L,H,K;let e,l,n=(((T=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:T.title)??"Debugging")+"",i,o,a,r,f,c,m,_,d,h,g=(((L=(F=t[2].conf)==null?void 0:F.debug)==null?void 0:L.enable)??"Enable debugging")+"",b,C,k,A,I=((K=(H=t[6])==null?void 0:H.d)==null?void 0:K.s)&&Qa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),b=M(g),C=v(),I&&I.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",j(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(z,q){P(z,e,q),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),d.checked=t[6].d.s,s(_,h),s(_,b),s(e,C),I&&I.m(e,null),k||(A=ce(d,"change",t[122]),k=!0)},p(z,q){var B,Z,V,Y,G,U;q[0]&4&&n!==(n=(((Z=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:Z.title)??"Debugging")+"")&&E(i,n),q[0]&64&&(d.checked=z[6].d.s),q[0]&4&&g!==(g=(((Y=(V=z[2].conf)==null?void 0:V.debug)==null?void 0:Y.enable)??"Enable debugging")+"")&&E(b,g),(U=(G=z[6])==null?void 0:G.d)!=null&&U.s?I?I.p(z,q):(I=Qa(z),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(z){z&&N(e),I&&I.d(),k=!1,A()}}}function Qa(t){var F,L,H,K;let e,l=(((L=(F=t[2].conf)==null?void 0:F.debug)==null?void 0:L.danger)??"Disable when done")+"",n,i,o,a,r,f,c=(((K=(H=t[2].conf)==null?void 0:H.debug)==null?void 0:K.telnet)??"Enable telnet")+"",m,_,d,h,g,b,C,k,A,I,R,T=t[6].d.t&&Xa(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("div"),a=p("label"),r=p("input"),f=v(),m=M(c),_=v(),T&&T.c(),d=v(),h=p("div"),g=p("select"),b=p("option"),b.textContent="Verbose",C=p("option"),C.textContent="Debug",k=p("option"),k.textContent="Info",A=p("option"),A.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",j(r,r.__value),u(r,"class","rounded mb-1"),u(o,"class","my-1"),b.__value=1,j(b,b.__value),C.__value=2,j(C,C.__value),k.__value=3,j(k,k.__value),A.__value=4,j(A,A.__value),u(g,"name","dl"),u(g,"class","in-s"),t[6].d.l===void 0&&Et(()=>t[124].call(g)),u(h,"class","my-1")},m(z,q){P(z,e,q),s(e,n),P(z,i,q),P(z,o,q),s(o,a),s(a,r),r.checked=t[6].d.t,s(a,f),s(a,m),P(z,_,q),T&&T.m(z,q),P(z,d,q),P(z,h,q),s(h,g),s(g,b),s(g,C),s(g,k),s(g,A),ze(g,t[6].d.l,!0),I||(R=[ce(r,"change",t[123]),ce(g,"change",t[124])],I=!0)},p(z,q){var B,Z,V,Y;q[0]&4&&l!==(l=(((Z=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:Z.danger)??"Disable when done")+"")&&E(n,l),q[0]&64&&(r.checked=z[6].d.t),q[0]&4&&c!==(c=(((Y=(V=z[2].conf)==null?void 0:V.debug)==null?void 0:Y.telnet)??"Enable telnet")+"")&&E(m,c),z[6].d.t?T?T.p(z,q):(T=Xa(z),T.c(),T.m(d.parentNode,d)):T&&(T.d(1),T=null),q[0]&64&&ze(g,z[6].d.l)},d(z){z&&(N(e),N(i),N(o),N(_),N(d),N(h)),T&&T.d(z),I=!1,zt(R)}}}function Xa(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&E(n,l)},d(a){a&&N(e)}}}function Za(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,o,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=M(n),o=v(),a=p("div"),r=p("button"),c=M(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(g,b){P(g,e,b),s(e,l),s(l,i),P(g,o,b),P(g,a,b),s(a,r),s(r,c),m||(_=[ce(l,"click",t[14]),ce(r,"click",t[16])],m=!0)},p(g,b){var C,k;b[0]&4&&n!==(n=(((C=g[2].conf)==null?void 0:C.btn_reset)??"Factory reset")+"")&&E(i,n),b[0]&4&&f!==(f=(((k=g[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&E(c,f)},d(g){g&&(N(e),N(o),N(a)),m=!1,zt(_)}}}function Ja(t){var o;let e,l,n=(((o=t[2].btn)==null?void 0:o.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=M(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,l),s(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&E(i,n)},d(a){a&&N(e)}}}function $c(t){var me,se,pe,we,S,w,O,D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Lt,Je,Fe,He,tt,Ge,Ve,Qe;let e,l,n,i,o,a,r,f,c,m,_=((pe=(se=(me=t[6])==null?void 0:me.p)==null?void 0:se.r)==null?void 0:pe.startsWith("NO"))||((w=(S=(we=t[6])==null?void 0:we.p)==null?void 0:S.r)==null?void 0:w.startsWith("10YNO"))||((W=(D=(O=t[6])==null?void 0:O.p)==null?void 0:D.r)==null?void 0:W.startsWith("10Y1001A1001A4")),d,h,g,b=((te=t[6])==null?void 0:te.d)&&((be=(ue=t[0])==null?void 0:ue.features)==null?void 0:be.includes("rdebug")),C,k,A,I,R,T,F,L,H,K,z,q,B,Z,V=((ke=t[6])==null?void 0:ke.g)&&ia(t),Y=((J=t[6])==null?void 0:J.m)&&fa(t),G=((ve=t[6])==null?void 0:ve.w)&&ma(t),U=((ge=t[6])==null?void 0:ge.n)&&ga(t),y=((qe=t[6])==null?void 0:qe.q)&&wa(t),ne=((Ae=(Pe=t[6])==null?void 0:Pe.q)==null?void 0:Ae.m)==3&&Ma(t),ee=((Ne=(Le=t[6])==null?void 0:Le.q)==null?void 0:Ne.m)==4&&Na(t),Q=((De=t[6])==null?void 0:De.c)&&Pa(t),ie=_&&Ra(t),re=((Re=t[6])==null?void 0:Re.u)&&Ba(t),fe=((xe=($e=t[6])==null?void 0:$e.i)==null?void 0:xe.h)&&(((ut=t[0])==null?void 0:ut.board)>20||((St=t[0])==null?void 0:St.chip)=="esp8266"||((ot=(rt=(dt=t[6])==null?void 0:dt.i)==null?void 0:rt.d)==null?void 0:ot.d)>0)&&ja(t),le=b&&Ya(t),de=((ht=t[1])==null?void 0:ht.a)&&Za(t),oe=t[6]&&Ja(t);return R=new pl({props:{active:t[3],message:((Je=(Lt=t[2].conf)==null?void 0:Lt.mask)==null?void 0:Je.loading)??"Loading"}}),F=new pl({props:{active:t[4],message:((He=(Fe=t[2].conf)==null?void 0:Fe.mask)==null?void 0:He.saving)??"Saving"}}),H=new pl({props:{active:t[10],message:((Ge=(tt=t[2].conf)==null?void 0:tt.mask)==null?void 0:Ge.reset)??"Factory reset"}}),z=new pl({props:{active:t[11],message:((Qe=(Ve=t[2].conf)==null?void 0:Ve.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),V&&V.c(),n=v(),Y&&Y.c(),i=v(),G&&G.c(),o=v(),U&&U.c(),a=v(),y&&y.c(),r=v(),ne&&ne.c(),f=v(),ee&&ee.c(),c=v(),Q&&Q.c(),m=v(),ie&&ie.c(),d=v(),re&&re.c(),h=v(),fe&&fe.c(),g=v(),le&&le.c(),C=v(),k=p("div"),de&&de.c(),A=v(),oe&&oe.c(),I=v(),Me(R.$$.fragment),T=v(),Me(F.$$.fragment),L=v(),Me(H.$$.fragment),K=v(),Me(z.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(k,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(_e,ae){P(_e,e,ae),s(e,l),V&&V.m(l,null),s(l,n),Y&&Y.m(l,null),s(l,i),G&&G.m(l,null),s(l,o),U&&U.m(l,null),s(l,a),y&&y.m(l,null),s(l,r),ne&&ne.m(l,null),s(l,f),ee&&ee.m(l,null),s(l,c),Q&&Q.m(l,null),s(l,m),ie&&ie.m(l,null),s(l,d),re&&re.m(l,null),s(l,h),fe&&fe.m(l,null),s(l,g),le&&le.m(l,null),s(e,C),s(e,k),de&&de.m(k,null),s(k,A),oe&&oe.m(k,null),P(_e,I,ae),Ce(R,_e,ae),P(_e,T,ae),Ce(F,_e,ae),P(_e,L,ae),Ce(H,_e,ae),P(_e,K,ae),Ce(z,_e,ae),q=!0,B||(Z=ce(e,"submit",mn(t[15])),B=!0)},p(_e,ae){var Xe,qt,at,mt,lt,Bt,el,pt,nt,Yt,Jt,Ot,Zt,$t,Gt,Qt,ll,Ye,st,Mt,It,kt,gt,jt,et,Rt,he,Ie,ye,Vt,Kt,wt,cl,ol,Ht,yt,ul,Ee,$;(Xe=_e[6])!=null&&Xe.g?V?(V.p(_e,ae),ae[0]&64&&X(V,1)):(V=ia(_e),V.c(),X(V,1),V.m(l,n)):V&&(ct(),x(V,1,1,()=>{V=null}),_t()),(qt=_e[6])!=null&&qt.m?Y?Y.p(_e,ae):(Y=fa(_e),Y.c(),Y.m(l,i)):Y&&(Y.d(1),Y=null),(at=_e[6])!=null&&at.w?G?G.p(_e,ae):(G=ma(_e),G.c(),G.m(l,o)):G&&(G.d(1),G=null),(mt=_e[6])!=null&&mt.n?U?(U.p(_e,ae),ae[0]&64&&X(U,1)):(U=ga(_e),U.c(),X(U,1),U.m(l,a)):U&&(ct(),x(U,1,1,()=>{U=null}),_t()),(lt=_e[6])!=null&<.q?y?(y.p(_e,ae),ae[0]&64&&X(y,1)):(y=wa(_e),y.c(),X(y,1),y.m(l,r)):y&&(ct(),x(y,1,1,()=>{y=null}),_t()),((el=(Bt=_e[6])==null?void 0:Bt.q)==null?void 0:el.m)==3?ne?ne.p(_e,ae):(ne=Ma(_e),ne.c(),ne.m(l,f)):ne&&(ne.d(1),ne=null),((nt=(pt=_e[6])==null?void 0:pt.q)==null?void 0:nt.m)==4?ee?ee.p(_e,ae):(ee=Na(_e),ee.c(),ee.m(l,c)):ee&&(ee.d(1),ee=null),(Yt=_e[6])!=null&&Yt.c?Q?(Q.p(_e,ae),ae[0]&64&&X(Q,1)):(Q=Pa(_e),Q.c(),X(Q,1),Q.m(l,m)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),ae[0]&64&&(_=((Zt=(Ot=(Jt=_e[6])==null?void 0:Jt.p)==null?void 0:Ot.r)==null?void 0:Zt.startsWith("NO"))||((Qt=(Gt=($t=_e[6])==null?void 0:$t.p)==null?void 0:Gt.r)==null?void 0:Qt.startsWith("10YNO"))||((st=(Ye=(ll=_e[6])==null?void 0:ll.p)==null?void 0:Ye.r)==null?void 0:st.startsWith("10Y1001A1001A4"))),_?ie?ie.p(_e,ae):(ie=Ra(_e),ie.c(),ie.m(l,d)):ie&&(ie.d(1),ie=null),(Mt=_e[6])!=null&&Mt.u?re?re.p(_e,ae):(re=Ba(_e),re.c(),re.m(l,h)):re&&(re.d(1),re=null),(kt=(It=_e[6])==null?void 0:It.i)!=null&&kt.h&&(((gt=_e[0])==null?void 0:gt.board)>20||((jt=_e[0])==null?void 0:jt.chip)=="esp8266"||((he=(Rt=(et=_e[6])==null?void 0:et.i)==null?void 0:Rt.d)==null?void 0:he.d)>0)?fe?(fe.p(_e,ae),ae[0]&65&&X(fe,1)):(fe=ja(_e),fe.c(),X(fe,1),fe.m(l,g)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),ae[0]&65&&(b=((Ie=_e[6])==null?void 0:Ie.d)&&((Vt=(ye=_e[0])==null?void 0:ye.features)==null?void 0:Vt.includes("rdebug"))),b?le?le.p(_e,ae):(le=Ya(_e),le.c(),le.m(l,null)):le&&(le.d(1),le=null),(Kt=_e[1])!=null&&Kt.a?de?de.p(_e,ae):(de=Za(_e),de.c(),de.m(k,A)):de&&(de.d(1),de=null),_e[6]?oe?oe.p(_e,ae):(oe=Ja(_e),oe.c(),oe.m(k,null)):oe&&(oe.d(1),oe=null);const Te={};ae[0]&8&&(Te.active=_e[3]),ae[0]&4&&(Te.message=((cl=(wt=_e[2].conf)==null?void 0:wt.mask)==null?void 0:cl.loading)??"Loading"),R.$set(Te);const Ke={};ae[0]&16&&(Ke.active=_e[4]),ae[0]&4&&(Ke.message=((Ht=(ol=_e[2].conf)==null?void 0:ol.mask)==null?void 0:Ht.saving)??"Saving"),F.$set(Ke);const Dt={};ae[0]&1024&&(Dt.active=_e[10]),ae[0]&4&&(Dt.message=((ul=(yt=_e[2].conf)==null?void 0:yt.mask)==null?void 0:ul.reset)??"Factory reset"),H.$set(Dt);const vt={};ae[0]&2048&&(vt.active=_e[11]),ae[0]&4&&(vt.message=(($=(Ee=_e[2].conf)==null?void 0:Ee.mask)==null?void 0:$.reset_done)??"Done"),z.$set(vt)},i(_e){q||(X(V),X(U),X(y),X(Q),X(fe),X(R.$$.fragment,_e),X(F.$$.fragment,_e),X(H.$$.fragment,_e),X(z.$$.fragment,_e),q=!0)},o(_e){x(V),x(U),x(y),x(Q),x(fe),x(R.$$.fragment,_e),x(F.$$.fragment,_e),x(H.$$.fragment,_e),x(z.$$.fragment,_e),q=!1},d(_e){_e&&(N(e),N(I),N(T),N(L),N(K)),V&&V.d(),Y&&Y.d(),G&&G.d(),U&&U.d(),y&&y.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),re&&re.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),Se(R,_e),Se(F,_e),Se(H,_e),Se(z,_e),B=!1,Z()}}}async function xc(){await(await fetch("reboot",{method:"POST"})).json()}function e_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:o}=e,a={};Nl.subscribe(it=>{l(2,a=it)});let r=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,d=[];Xn.subscribe(it=>{var Nt,al,_l;it.version&&(l(5,m=(Nt=it==null?void 0:it.c)==null?void 0:Nt.e),l(6,_=it),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(al=_==null?void 0:_.u)!=null&&al.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((_l=a.language)==null?void 0:_l.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),_c();let h=!0,g={};co.subscribe(it=>{var Nt;l(8,h=!0);for(let al=0;al(fl.hostname=Nt.get("gh"),fl.usrcfg=vl.success,fl.booting=vl.reboot,Nt.get("nm")=="static"&&(fl.net.ip=Nt.get("ni"),fl.net.mask=Nt.get("nu"),fl.net.gw=Nt.get("ng"),fl.net.dns1=Nt.get("nd")),fl.ui=_.u,fl)),l(4,c=!1),nn(n)}const I=function(){confirm("Reboot?")&&(dl.update(it=>(it.booting=!0,it)),xc())};async function R(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Xn.update(Nt=>(Nt.q.s.c=!1,Nt)))}async function T(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Xn.update(Nt=>(Nt.q.s.r=!1,Nt)))}async function F(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Xn.update(Nt=>(Nt.q.s.k=!1,Nt)))}const L=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function H(){if(_.u.lang=="hub"){const it=await wl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await it.json()),l(6,_.u.lang=a.language.code,_)}}async function K(){l(6,_.p.e=!0,_)}let z=44;async function q(){const it=await wl("cloudkey.json");if(it.status==200){let Nt=await it.json();window.open("https://www.amsleser.cloud/device/"+Nt.seed)}else alert("Not able to bind to cloud")}const B=window||global;B.bindToCloud=function(){console.log("BIND CALLED")};function Z(){_.g.h=this.value,l(6,_)}function V(){_.g.t=Xt(this),l(6,_)}function Y(){_.p.r=Xt(this),l(6,_)}function G(){_.p.m=Xt(this),l(6,_)}function U(){_.p.c=Xt(this),l(6,_)}function y(){_.p.e=this.checked,l(6,_)}function ne(){_.p.t=this.value,l(6,_)}function ee(){_.g.s=Xt(this),l(6,_)}function Q(){_.g.u=this.value,l(6,_)}function ie(){_.g.p=this.value,l(6,_)}function re(){_.g.c=this.value,l(6,_)}function fe(){_.m.a=Xt(this),l(6,_)}function le(){_.m.b=Be(this.value),l(6,_)}function de(){_.m.i=this.checked,l(6,_)}function oe(){_.m.b=Xt(this),l(6,_)}function me(){_.m.p=Xt(this),l(6,_)}function se(){_.m.s=Be(this.value),l(6,_)}function pe(){_.m.d=Xt(this),l(6,_)}function we(){_.m.f=Be(this.value),l(6,_)}function S(){_.m.r=Be(this.value),l(6,_)}function w(){_.m.e.e=this.checked,l(6,_)}function O(){_.m.e.k=this.value,l(6,_)}function D(){_.m.e.a=this.value,l(6,_)}function W(){_.m.m.e=this.checked,l(6,_)}function te(){_.m.m.w=Be(this.value),l(6,_)}function ue(){_.m.m.v=Be(this.value),l(6,_)}function be(){_.m.m.a=Be(this.value),l(6,_)}function ke(){_.m.m.c=Be(this.value),l(6,_)}function J(){_.n.c=Xt(this),l(6,_)}function ve(){h=this.checked,l(8,h)}function ge(){_.w.s=this.value,l(6,_)}function qe(){_.w.s=Xt(this),l(6,_)}function Pe(){_.w.p=this.value,l(6,_)}function Ae(){_.w.z=Xt(this),l(6,_)}function Le(){_.w.w=Be(this.value),l(6,_)}function Ne(){_.w.b=this.checked,l(6,_)}function De(){_.n.m=Xt(this),l(6,_)}function Re(){_.n.i=this.value,l(6,_)}function $e(){_.n.s=Xt(this),l(6,_)}function xe(){_.n.g=this.value,l(6,_)}function ut(){_.n.d1=this.value,l(6,_)}function St(){_.n.d2=this.value,l(6,_)}function dt(){_.n.x=this.checked,l(6,_)}function rt(){_.n.d=this.checked,l(6,_)}function ot(){_.n.h=this.checked,l(6,_)}function ht(){_.n.n1=this.value,l(6,_)}function Lt(){_.q.s.e=this.checked,l(6,_)}function Je(){_.q.h=this.value,l(6,_)}function Fe(){_.q.p=Be(this.value),l(6,_)}function He(){_.q.u=this.value,l(6,_)}function tt(){_.q.a=this.value,l(6,_)}function Ge(){_.q.c=this.value,l(6,_)}function Ve(){_.q.m=Xt(this),l(6,_)}function Qe(){_.q.b=this.value,l(6,_)}function _e(){_.q.r=this.value,l(6,_)}function ae(){_.q.t=Xt(this),l(6,_)}function Te(){_.q.d=Be(this.value),l(6,_)}function Ke(){_.q.i=Be(this.value),l(6,_)}function Dt(){_.q.k=Be(this.value),l(6,_)}function vt(){_.q.e=Be(this.value),l(6,_)}function Xe(){_.o.e=this.value,l(6,_)}function qt(){_.o.c=this.value,l(6,_)}function at(){_.o.u1=this.value,l(6,_)}function mt(){_.o.u2=this.value,l(6,_)}function lt(){_.o.u3=this.value,l(6,_)}function Bt(){_.h.t=this.value,l(6,_)}function el(){_.h.h=this.value,l(6,_)}function pt(){_.h.n=this.value,l(6,_)}function nt(){_.c.e=this.checked,l(6,_)}function Yt(){_.c.p=Xt(this),l(6,_)}function Jt(){_.c.es=this.checked,l(6,_)}function Ot(){_.c.ze=this.checked,l(6,_)}function Zt(){_.c.zt=this.value,l(6,_)}function $t(it){_.t.t[it]=Be(this.value),l(6,_)}function Gt(){_.t.h=Be(this.value),l(6,_)}function Qt(it){_.u[it.key]=Xt(this),l(6,_)}function ll(){_.u.lang=Xt(this),l(6,_)}function Ye(){_.i.h.p=Xt(this),l(6,_)}function st(){_.i.h.t=Xt(this),l(6,_)}function Mt(){_.i.h.u=this.checked,l(6,_)}function It(){_.i.a=Be(this.value),l(6,_)}function kt(){_.i.l.p=Be(this.value),l(6,_)}function gt(){_.i.l.i=this.checked,l(6,_)}function jt(){_.i.r.i=this.checked,l(6,_)}function et(){_.i.r.r=Be(this.value),l(6,_)}function Rt(){_.i.r.g=Be(this.value),l(6,_)}function he(){_.i.r.b=Be(this.value),l(6,_)}function Ie(){_.i.d.d=Be(this.value),l(6,_)}function ye(){_.i.t.d=Be(this.value),l(6,_)}function Vt(){_.i.t.a=Be(this.value),l(6,_)}function Kt(){_.i.v.p=Be(this.value),l(6,_)}function wt(){_.i.v.d.v=Be(this.value),l(6,_)}function cl(){_.i.v.d.g=Be(this.value),l(6,_)}function ol(){_.i.d.b=Xt(this),l(6,_)}function Ht(){_.i.v.o=Be(this.value),l(6,_)}function yt(){_.i.v.m=Be(this.value),l(6,_)}function ul(){_.i.v.b=Be(this.value),l(6,_)}function Ee(){_.d.s=this.checked,l(6,_)}function $(){_.d.t=this.checked,l(6,_)}function Oe(){_.d.l=Xt(this),l(6,_)}return t.$$set=it=>{"basepath"in it&&l(24,n=it.basepath),"sysinfo"in it&&l(0,i=it.sysinfo),"data"in it&&l(1,o=it.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,z=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,a,f,c,m,_,d,h,g,b,C,z,r,k,A,I,R,T,F,L,H,K,q,n,Z,V,Y,G,U,y,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe,we,S,w,O,D,W,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Lt,Je,Fe,He,tt,Ge,Ve,Qe,_e,ae,Te,Ke,Dt,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Yt,Jt,Ot,Zt,$t,Gt,Qt,ll,Ye,st,Mt,It,kt,gt,jt,et,Rt,he,Ie,ye,Vt,Kt,wt,cl,ol,Ht,yt,ul,Ee,$,Oe]}class t_ extends Tt{constructor(e){super(),Pt(this,e,e_,$c,Ct,{basepath:24,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function $a(t,e,l){const n=t.slice();return n[23]=e[l],n}function xa(t){let e,l=t[0].cpu+"",n,i;return{c(){e=M("("),n=M(l),i=M("MHz)")},m(o,a){P(o,e,a),P(o,n,a),P(o,i,a)},p(o,a){a&1&&l!==(l=o[0].cpu+"")&&E(n,l)},d(o){o&&(N(e),N(n),N(i))}}}function l_(t){let e=Ze(t[0].chip,t[0].board)+"",l;return{c(){l=M(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=Ze(n[0].chip,n[0].board)+"")&&E(l,e)},d(n){n&&N(l)}}}function ef(t){var G,U,y,ne,ee,Q,ie,re;let e,l=(((U=(G=t[3].status)==null?void 0:G.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,o=t[0].apmac+"",a,r,f,c=(((ne=(y=t[3].status)==null?void 0:y.device)==null?void 0:ne.last_boot)??"Last boot")+"",m,_,d,h,g,b,C=(((Q=(ee=t[3].status)==null?void 0:ee.device)==null?void 0:Q.reason)??"Reason")+"",k,A,I=(((re=(ie=t[3][Ao(t[0].chip)])==null?void 0:ie.reason)==null?void 0:re[t[0].boot_reason])??t[0].boot_reason)+"",R,T,F=t[0].boot_reason+"",L,H,K=t[0].ex_cause+"",z,q,B;const Z=[i_,n_],V=[];function Y(fe,le){return fe[1].u>0?0:1}return d=Y(t),h=V[d]=Z[d](t),{c(){e=p("div"),n=M(l),i=M(": "),a=M(o),r=v(),f=p("div"),m=M(c),_=M(`: - `),h.c(),g=v(),b=p("div"),k=M(C),A=M(": "),R=M(I),T=M(" ("),L=M(F),H=M("/"),z=M(K),q=M(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(b,"class","my-2")},m(fe,le){P(fe,e,le),s(e,n),s(e,i),s(e,a),P(fe,r,le),P(fe,f,le),s(f,m),s(f,_),V[d].m(f,null),P(fe,g,le),P(fe,b,le),s(b,k),s(b,A),s(b,R),s(b,T),s(b,L),s(b,H),s(b,z),s(b,q),B=!0},p(fe,le){var oe,me,se,pe,we,S,w,O;(!B||le&8)&&l!==(l=(((me=(oe=fe[3].status)==null?void 0:oe.device)==null?void 0:me.apmac)??"AP MAC")+"")&&E(n,l),(!B||le&1)&&o!==(o=fe[0].apmac+"")&&E(a,o),(!B||le&8)&&c!==(c=(((pe=(se=fe[3].status)==null?void 0:se.device)==null?void 0:pe.last_boot)??"Last boot")+"")&&E(m,c);let de=d;d=Y(fe),d===de?V[d].p(fe,le):(ct(),x(V[de],1,1,()=>{V[de]=null}),_t(),h=V[d],h?h.p(fe,le):(h=V[d]=Z[d](fe),h.c()),X(h,1),h.m(f,null)),(!B||le&8)&&C!==(C=(((S=(we=fe[3].status)==null?void 0:we.device)==null?void 0:S.reason)??"Reason")+"")&&E(k,C),(!B||le&9)&&I!==(I=(((O=(w=fe[3][Ao(fe[0].chip)])==null?void 0:w.reason)==null?void 0:O[fe[0].boot_reason])??fe[0].boot_reason)+"")&&E(R,I),(!B||le&1)&&F!==(F=fe[0].boot_reason+"")&&E(L,F),(!B||le&1)&&K!==(K=fe[0].ex_cause+"")&&E(z,K)},i(fe){B||(X(h),B=!0)},o(fe){x(h),B=!1},d(fe){fe&&(N(e),N(r),N(f),N(g),N(b)),V[d].d()}}}function n_(t){let e;return{c(){e=M("-")},m(l,n){P(l,e,n)},p:je,i:je,o:je,d(l){l&&N(e)}}}function i_(t){let e,l;return e=new Ku({props:{timestamp:new Date(new Date().getTime()-t[1].u*1e3),fullTimeColor:"",offset:t[0].clock_offset}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.timestamp=new Date(new Date().getTime()-n[1].u*1e3)),i&1&&(o.offset=n[0].clock_offset),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function tf(t){var m;let e,l,n,i,o=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new kl({props:{to:"/consent",$$slots:{default:[o_]},$$scope:{ctx:t}}}),{c(){e=p("div"),Me(l.$$.fragment),n=v(),i=p("button"),a=M(o),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Ce(l,e,null),s(e,n),s(e,i),s(i,a),r=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,d){var g;const h={};d&67108872&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&o!==(o=(((g=_[3].btn)==null?void 0:g.reboot)??"Reboot")+"")&&E(a,o)},i(_){r||(X(l.$$.fragment,_),r=!0)},o(_){x(l.$$.fragment,_),r=!1},d(_){_&&N(e),Se(l),f=!1,c()}}}function o_(t){var i,o;let e,l=(((o=(i=t[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=M(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&E(n,l)},d(a){a&&N(e)}}}function lf(t){var z,q,B,Z,V,Y,G,U;let e,l,n=(((q=(z=t[3].status)==null?void 0:z.meter)==null?void 0:q.title)??"Meter")+"",i,o,a,r=(((Z=(B=t[3].status)==null?void 0:B.meter)==null?void 0:Z.manufacturer)??"Manufacturer")+"",f,c,m=wi(t[0].meter.mfg)+"",_,d,h,g=(((Y=(V=t[3].status)==null?void 0:V.meter)==null?void 0:Y.model)??"Model")+"",b,C,k=(t[0].meter.model?t[0].meter.model:"unknown")+"",A,I,R,T=(((U=(G=t[3].status)==null?void 0:G.meter)==null?void 0:U.id)??"ID")+"",F,L,H=(t[0].meter.id?t[0].meter.id:"unknown")+"",K;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),f=M(r),c=M(": "),_=M(m),d=v(),h=p("div"),b=M(g),C=M(": "),A=M(k),I=v(),R=p("div"),F=M(T),L=M(": "),K=M(H),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(R,"class","my-2"),u(e,"class","cnt")},m(y,ne){P(y,e,ne),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,d),s(e,h),s(h,b),s(h,C),s(h,A),s(e,I),s(e,R),s(R,F),s(R,L),s(R,K)},p(y,ne){var ee,Q,ie,re,fe,le,de,oe;ne&8&&n!==(n=(((Q=(ee=y[3].status)==null?void 0:ee.meter)==null?void 0:Q.title)??"Meter")+"")&&E(i,n),ne&8&&r!==(r=(((re=(ie=y[3].status)==null?void 0:ie.meter)==null?void 0:re.manufacturer)??"Manufacturer")+"")&&E(f,r),ne&1&&m!==(m=wi(y[0].meter.mfg)+"")&&E(_,m),ne&8&&g!==(g=(((le=(fe=y[3].status)==null?void 0:fe.meter)==null?void 0:le.model)??"Model")+"")&&E(b,g),ne&1&&k!==(k=(y[0].meter.model?y[0].meter.model:"unknown")+"")&&E(A,k),ne&8&&T!==(T=(((oe=(de=y[3].status)==null?void 0:de.meter)==null?void 0:oe.id)??"ID")+"")&&E(F,T),ne&1&&H!==(H=(y[0].meter.id?y[0].meter.id:"unknown")+"")&&E(K,H)},d(y){y&&N(e)}}}function nf(t){var U,y,ne,ee,Q,ie,re,fe;let e,l,n=(((y=(U=t[3].status)==null?void 0:U.network)==null?void 0:y.title)??"Network")+"",i,o,a,r=(((ee=(ne=t[3].conf)==null?void 0:ne.network)==null?void 0:ee.ip)??"IP")+"",f,c,m=t[0].net.ip+"",_,d,h,g=(((ie=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ie.mask)??"Mask")+"",b,C,k=t[0].net.mask+"",A,I,R,T=(((fe=(re=t[3].conf)==null?void 0:re.network)==null?void 0:fe.gw)??"Gateway")+"",F,L,H=t[0].net.gw+"",K,z,q,B,Z,V=t[0].net.dns1&&of(t),Y=t[0].net.dns2&&sf(t),G=t[0].net.ipv6&&af(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),f=M(r),c=M(": "),_=M(m),d=v(),h=p("div"),b=M(g),C=M(": "),A=M(k),I=v(),R=p("div"),F=M(T),L=M(": "),K=M(H),z=v(),q=p("div"),V&&V.c(),B=v(),Y&&Y.c(),Z=v(),G&&G.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(R,"class","my-2"),u(q,"class","my-2"),u(e,"class","cnt")},m(le,de){P(le,e,de),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,d),s(e,h),s(h,b),s(h,C),s(h,A),s(e,I),s(e,R),s(R,F),s(R,L),s(R,K),s(e,z),s(e,q),V&&V.m(q,null),s(q,B),Y&&Y.m(q,null),s(e,Z),G&&G.m(e,null)},p(le,de){var oe,me,se,pe,we,S,w,O;de&8&&n!==(n=(((me=(oe=le[3].status)==null?void 0:oe.network)==null?void 0:me.title)??"Network")+"")&&E(i,n),de&8&&r!==(r=(((pe=(se=le[3].conf)==null?void 0:se.network)==null?void 0:pe.ip)??"IP")+"")&&E(f,r),de&1&&m!==(m=le[0].net.ip+"")&&E(_,m),de&8&&g!==(g=(((S=(we=le[3].conf)==null?void 0:we.network)==null?void 0:S.mask)??"Mask")+"")&&E(b,g),de&1&&k!==(k=le[0].net.mask+"")&&E(A,k),de&8&&T!==(T=(((O=(w=le[3].conf)==null?void 0:w.network)==null?void 0:O.gw)??"Gateway")+"")&&E(F,T),de&1&&H!==(H=le[0].net.gw+"")&&E(K,H),le[0].net.dns1?V?V.p(le,de):(V=of(le),V.c(),V.m(q,B)):V&&(V.d(1),V=null),le[0].net.dns2?Y?Y.p(le,de):(Y=sf(le),Y.c(),Y.m(q,null)):Y&&(Y.d(1),Y=null),le[0].net.ipv6?G?G.p(le,de):(G=af(le),G.c(),G.m(e,null)):G&&(G.d(1),G=null)},d(le){le&&N(e),V&&V.d(),Y&&Y.d(),G&&G.d()}}}function of(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[0].net.dns1+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&1&&i!==(i=f[0].net.dns1+"")&&E(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function sf(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[0].net.dns2+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&E(l,e),c&1&&i!==(i=f[0].net.dns2+"")&&E(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function af(t){let e,l,n,i=t[0].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",o,a,r,f,c=t[0].net.dns1v6&&ff(t),m=t[0].net.dns2v6&&uf(t);return{c(){e=p("div"),l=M("IPv6: "),n=p("span"),o=M(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),Sl(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),s(e,l),s(e,n),s(n,o),P(_,a,d),P(_,r,d),c&&c.m(r,null),s(r,f),m&&m.m(r,null)},p(_,d){d&1&&i!==(i=_[0].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(o,i),_[0].net.dns1v6?c?c.p(_,d):(c=ff(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[0].net.dns2v6?m?m.p(_,d):(m=uf(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(r)),c&&c.d(),m&&m.d()}}}function ff(t){let e,l,n=t[0].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=o[0].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(o){o&&(N(e),N(l))}}}function uf(t){let e,l,n=t[0].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=o[0].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&E(i,n)},d(o){o&&(N(e),N(l))}}}function rf(t){let e,l,n,i,o,a,r,f,c;return{c(){e=p("div"),l=M(`Channel: - `),n=p("select"),i=p("option"),i.textContent="Stable",o=p("option"),o.textContent="Early",a=p("option"),a.textContent="Release Candidate",r=p("option"),r.textContent="Snapshot",i.__value=0,j(i,i.__value),o.__value=1,j(o,o.__value),a.__value=2,j(a,a.__value),r.__value=3,j(r,r.__value),r.disabled=!0,u(n,"class","in-s w-full"),t[0].upgrade.c===void 0&&Et(()=>t[14].call(n)),u(e,"class","my-2")},m(m,_){P(m,e,_),s(e,l),s(e,n),s(n,i),s(n,o),s(n,a),s(n,r),ze(n,t[0].upgrade.c,!0),f||(c=[ce(n,"change",t[14]),ce(n,"change",t[13])],f=!0)},p(m,_){_&1&&ze(n,m[0].upgrade.c)},d(m){m&&N(e),f=!1,zt(c)}}}function cf(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[0].upgrade.f).replace("{1}",t[0].upgrade.t)+"",i,o,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[0].upgrade.e])??t[0].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=M(n),o=v(),r=M(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),s(e,l),s(l,i),s(l,o),s(l,r)},p(d,h){var g,b,C,k;h&9&&n!==(n=(((b=(g=d[3].status)==null?void 0:g.firmware)==null?void 0:b.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[0].upgrade.f).replace("{1}",d[0].upgrade.t)+"")&&E(i,n),h&9&&a!==(a=(((k=(C=d[3].errors)==null?void 0:C.upgrade)==null?void 0:k[d[0].upgrade.e])??d[0].upgrade.e)+"")&&E(r,a)},d(d){d&&N(e)}}}function _f(t){var g,b;let e,l=(((b=(g=t[3].status)==null?void 0:g.firmware)==null?void 0:b.latest)??"Latest")+"",n,i,o,a=t[0].upgrade.n+"",r,f,c,m,_,d=(t[0].security==0||t[1].a)&&t[0].fwconsent===1&&t[0].upgrade.n&&t[0].upgrade.n!=t[0].version&&mf(t),h=t[0].fwconsent===2&&pf(t);return{c(){e=p("div"),n=M(l),i=M(`: - `),o=p("a"),r=M(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=Wt(),u(o,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[0].upgrade.n),u(o,"class","ml-2 text-blue-600 hover:text-blue-800"),u(o,"target","_blank"),u(o,"rel","noreferrer"),u(e,"class","my-2 flex")},m(C,k){P(C,e,k),s(e,n),s(e,i),s(e,o),s(o,r),s(e,c),d&&d.m(e,null),P(C,m,k),h&&h.m(C,k),P(C,_,k)},p(C,k){var A,I;k&8&&l!==(l=(((I=(A=C[3].status)==null?void 0:A.firmware)==null?void 0:I.latest)??"Latest")+"")&&E(n,l),k&1&&a!==(a=C[0].upgrade.n+"")&&E(r,a),k&1&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+C[0].upgrade.n)&&u(o,"href",f),(C[0].security==0||C[1].a)&&C[0].fwconsent===1&&C[0].upgrade.n&&C[0].upgrade.n!=C[0].version?d?d.p(C,k):(d=mf(C),d.c(),d.m(e,null)):d&&(d.d(1),d=null),C[0].fwconsent===2?h?h.p(C,k):(h=pf(C),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(C){C&&(N(e),N(m),N(_)),d&&d.d(),h&&h.d(C)}}}function mf(t){let e,l,n,i,o;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),s(e,l),i||(o=ce(l,"click",t[10]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&N(e),i=!1,o()}}}function pf(t){var o,a;let e,l,n=(((a=(o=t[3].status)==null?void 0:o.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=M(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),s(e,l),s(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&E(i,n)},d(r){r&&N(e)}}}function df(t){let e,l=Io(Ze(t[0].chip,t[0].board))+"",n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(i,o){P(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=Io(Ze(i[0].chip,i[0].board))+"")&&E(n,l)},d(i){i&&N(e)}}}function hf(t){let e,l,n,i,o,a;function r(m,_){return m[5].length==0?a_:s_}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),Sl(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){P(m,e,_),s(e,l),s(l,n),t[15](n),s(l,i),c.m(l,null),o||(a=[ce(n,"change",t[16]),ce(l,"submit",t[18])],o=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[15](null),c.d(),o=!1,zt(a)}}}function s_(t){var r;let e=t[5][0].name+"",l,n,i,o=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=M(e),n=v(),i=p("button"),a=M(o),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),s(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&E(l,e),c&8&&o!==(o=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&E(a,o)},d(f){f&&(N(l),N(n),N(i))}}}function a_(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,o;return{c(){e=p("button"),n=M(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),s(e,n),i||(o=ce(e,"click",t[17]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&E(n,l)},d(f){f&&N(e),i=!1,o()}}}function vf(t){var Y,G,U,y,ne,ee;let e,l,n=(((G=(Y=t[3].status)==null?void 0:Y.backup)==null?void 0:G.title)??"Backup")+"",i,o,a,r,f,c,m,_,d=(((y=(U=t[3].status)==null?void 0:U.backup)==null?void 0:y.secrets)??"Include secrets")+"",h,g,b,C=(((ee=(ne=t[3].status)==null?void 0:ne.backup)==null?void 0:ee.secrets_desc)??"")+"",k,A,I,R,T,F,L,H,K=ft(t[9]),z=[];for(let Q=0;Q{ve=null}),_t()),(pt=ae[1])!=null&&pt.a?ge?(ge.p(ae,Te),Te&2&&X(ge,1)):(ge=tf(ae),ge.c(),X(ge,1),ge.m(l,null)):ge&&(ct(),x(ge,1,1,()=>{ge=null}),_t()),ae[0].meter?qe?qe.p(ae,Te):(qe=lf(ae),qe.c(),qe.m(e,V)):qe&&(qe.d(1),qe=null),ae[0].net?Pe?Pe.p(ae,Te):(Pe=nf(ae),Pe.c(),Pe.m(e,Y)):Pe&&(Pe.d(1),Pe=null),(!ke||Te&8)&&y!==(y=(((Yt=(nt=ae[3].status)==null?void 0:nt.firmware)==null?void 0:Yt.title)??"Firmware")+"")&&E(ne,y),ae[0].fwconsent===1?Ae?Ae.p(ae,Te):(Ae=rf(ae),Ae.c(),Ae.m(G,re)):Ae&&(Ae.d(1),Ae=null),(!ke||Te&8)&&le!==(le=(((Ot=(Jt=ae[3].status)==null?void 0:Jt.firmware)==null?void 0:Ot.installed)??"Installed")+"")&&E(de,le),(!ke||Te&1)&&me!==(me=ae[0].version+"")&&E(se,me),ae[0].upgrade.t&&ae[0].upgrade.t!=ae[0].version&&ae[0].upgrade.e!=0&&ae[0].upgrade.e!=123?Le?Le.p(ae,Te):(Le=cf(ae),Le.c(),Le.m(G,we)):Le&&(Le.d(1),Le=null),ae[0].upgrade.n?Ne?Ne.p(ae,Te):(Ne=_f(ae),Ne.c(),Ne.m(G,S)):Ne&&(Ne.d(1),Ne=null),Te&3&&(w=(ae[0].security==0||ae[1].a)&&$n(ae[0].board)),w?De?De.p(ae,Te):(De=df(ae),De.c(),De.m(G,O)):De&&(De.d(1),De=null),ae[0].security==0||ae[1].a?Re?Re.p(ae,Te):(Re=hf(ae),Re.c(),Re.m(G,null)):Re&&(Re.d(1),Re=null),ae[0].security==0||ae[1].a?$e?$e.p(ae,Te):($e=vf(ae),$e.c(),$e.m(e,null)):$e&&($e.d(1),$e=null);const Dt={};Te&64&&(Dt.active=ae[6]),Te&8&&(Dt.message=(($t=(Zt=ae[3].status)==null?void 0:Zt.mask)==null?void 0:$t.firmware)??"Uploading"),te.$set(Dt);const vt={};Te&256&&(vt.active=ae[8]),Te&8&&(vt.message=((Qt=(Gt=ae[3].status)==null?void 0:Gt.mask)==null?void 0:Qt.config)??"Uploading"),be.$set(vt)},i(ae){ke||(X(I.$$.fragment,ae),X(ve),X(ge),X(te.$$.fragment,ae),X(be.$$.fragment,ae),ke=!0)},o(ae){x(I.$$.fragment,ae),x(ve),x(ge),x(te.$$.fragment,ae),x(be.$$.fragment,ae),ke=!1},d(ae){ae&&(N(e),N(W),N(ue)),J&&J.d(),Se(I),ve&&ve.d(),ge&&ge.d(),qe&&qe.d(),Pe&&Pe.d(),Ae&&Ae.d(),Le&&Le.d(),Ne&&Ne.d(),De&&De.d(),Re&&Re.d(),$e&&$e.d(),Se(te,ae),Se(be,ae)}}}async function c_(){await(await fetch("reboot",{method:"POST"})).json()}function __(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],a={};Nl.subscribe(z=>{l(3,a=z)});function r(){var z;confirm((((z=a.header)==null?void 0:z.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Vu(i.upgrade.n),dl.update(q=>(q.upgrade.t=i.upgrade.n,q.upgrade.p=0,q.upgrading=!0,q)))}const f=function(){var z;confirm(((z=a.device)==null?void 0:z.reboot_confirm)??"Reboot?")&&(dl.update(q=>(q.booting=!0,q)),c_())};let c,m=[],_=!1,d,h=[],g=!1;Ti();let b={hostname:"",ip:""};function C(z){l(8,g=!0);const q=new FormData;q.append("file",h[0]),fetch("configfile",{method:"POST",body:q}).then(B=>B.json()).then(B=>{dl.update(Z=>(b&&b.hostname&&(Z.hostname=b.hostname),Z.booting=B.reboot,b&&b.ip&&(Z.net.ip=b.ip),setTimeout(ti,5e3,i),Z))}).catch(B=>{console.error("Error:",B),setTimeout(ti,5e3,i)})}function k(){const z=new FormData;z.append("channel",i.upgrade.c),fetch("fwchannel",{method:"POST",body:z})}function A(){i.upgrade.c=Xt(this),l(0,i)}function I(z){gi[z?"unshift":"push"](()=>{c=z,l(4,c)})}function R(){m=this.files,l(5,m)}const T=()=>{c.click()},F=()=>l(6,_=!0);function L(z){gi[z?"unshift":"push"](()=>{d=z,l(7,d)})}function H(){h=this.files,l(2,h)}const K=()=>{d.click()};return t.$$set=z=>{"data"in z&&l(1,n=z.data),"sysinfo"in z&&l(0,i=z.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&h.length==1){let z=h[0],q=new FileReader,B=Z=>{let V=Z.target.result.split(` -`);for(let Y in V){let G=V[Y];G.startsWith("hostname ")?b.hostname=G.split(" ")[1]:G.startsWith("ip ")&&(b.ip=G.split(" ")[1])}};q.onload=B,q.readAsText(z)}},[i,n,h,a,c,m,_,d,g,o,r,f,C,k,A,I,R,T,F,L,H,K]}class m_ extends Tt{constructor(e){super(),Pt(this,e,__,r_,Ct,{data:1,sysinfo:0})}}function kf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],5)+"",r,f,c=Ze(t[0],4)+"",m,_,d=Ze(t[0],3)+"",h,g,b,C,k=Ze(t[0],2)+"",A,I,R=Ze(t[0],1)+"",T,F,L=Ze(t[0],0)+"",H,K,z,q,B=Ze(t[0],101)+"",Z,V,Y=Ze(t[0],100)+"",G;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=p("option"),h=M(d),g=v(),b=p("optgroup"),C=p("option"),A=M(k),I=p("option"),T=M(R),F=p("option"),H=M(L),K=v(),z=p("optgroup"),q=p("option"),Z=M(B),V=p("option"),G=M(Y),l.__value=7,j(l,l.__value),o.__value=5,j(o,o.__value),f.__value=4,j(f,f.__value),_.__value=3,j(_,_.__value),u(e,"label","amsleser.no"),C.__value=2,j(C,C.__value),I.__value=1,j(I,I.__value),F.__value=0,j(F,F.__value),u(b,"label","Custom hardware"),q.__value=101,j(q,q.__value),V.__value=100,j(V,V.__value),u(z,"label","Generic hardware")},m(U,y){P(U,e,y),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),s(e,_),s(_,h),P(U,g,y),P(U,b,y),s(b,C),s(C,A),s(b,I),s(I,T),s(b,F),s(F,H),P(U,K,y),P(U,z,y),s(z,q),s(q,Z),s(z,V),s(V,G)},p(U,y){y&1&&n!==(n=Ze(U[0],7)+"")&&E(i,n),y&1&&a!==(a=Ze(U[0],5)+"")&&E(r,a),y&1&&c!==(c=Ze(U[0],4)+"")&&E(m,c),y&1&&d!==(d=Ze(U[0],3)+"")&&E(h,d),y&1&&k!==(k=Ze(U[0],2)+"")&&E(A,k),y&1&&R!==(R=Ze(U[0],1)+"")&&E(T,R),y&1&&L!==(L=Ze(U[0],0)+"")&&E(H,L),y&1&&B!==(B=Ze(U[0],101)+"")&&E(Z,B),y&1&&Y!==(Y=Ze(U[0],100)+"")&&E(G,Y)},d(U){U&&(N(e),N(g),N(b),N(K),N(z))}}}function wf(t){let e,l,n=Ze(t[0],201)+"",i,o,a=Ze(t[0],202)+"",r,f,c=Ze(t[0],203)+"",m,_,d=Ze(t[0],241)+"",h,g,b=Ze(t[0],242)+"",C,k,A=Ze(t[0],243)+"",I,R,T=Ze(t[0],245)+"",F,L,H=Ze(t[0],200)+"",K;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=p("option"),h=M(d),g=p("option"),C=M(b),k=p("option"),I=M(A),R=p("option"),F=M(T),L=p("option"),K=M(H),l.__value=201,j(l,l.__value),o.__value=202,j(o,o.__value),f.__value=203,j(f,f.__value),_.__value=241,j(_,_.__value),g.__value=242,j(g,g.__value),k.__value=243,j(k,k.__value),R.__value=245,j(R,R.__value),L.__value=200,j(L,L.__value),u(e,"label","Generic hardware")},m(z,q){P(z,e,q),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),s(e,_),s(_,h),s(e,g),s(g,C),s(e,k),s(k,I),s(e,R),s(R,F),s(e,L),s(L,K)},p(z,q){q&1&&n!==(n=Ze(z[0],201)+"")&&E(i,n),q&1&&a!==(a=Ze(z[0],202)+"")&&E(r,a),q&1&&c!==(c=Ze(z[0],203)+"")&&E(m,c),q&1&&d!==(d=Ze(z[0],241)+"")&&E(h,d),q&1&&b!==(b=Ze(z[0],242)+"")&&E(C,b),q&1&&A!==(A=Ze(z[0],243)+"")&&E(I,A),q&1&&T!==(T=Ze(z[0],245)+"")&&E(F,T),q&1&&H!==(H=Ze(z[0],200)+"")&&E(K,H)},d(z){z&&N(e)}}}function Cf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],6)+"",r,f,c=Ze(t[0],5)+"",m,_,d,h,g=Ze(t[0],51)+"",b,C,k=Ze(t[0],50)+"",A;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=v(),d=p("optgroup"),h=p("option"),b=M(g),C=p("option"),A=M(k),l.__value=7,j(l,l.__value),o.__value=6,j(o,o.__value),f.__value=5,j(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,j(h,h.__value),C.__value=50,j(C,C.__value),u(d,"label","Generic hardware")},m(I,R){P(I,e,R),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),P(I,_,R),P(I,d,R),s(d,h),s(h,b),s(d,C),s(C,A)},p(I,R){R&1&&n!==(n=Ze(I[0],7)+"")&&E(i,n),R&1&&a!==(a=Ze(I[0],6)+"")&&E(r,a),R&1&&c!==(c=Ze(I[0],5)+"")&&E(m,c),R&1&&g!==(g=Ze(I[0],51)+"")&&E(b,g),R&1&&k!==(k=Ze(I[0],50)+"")&&E(A,k)},d(I){I&&(N(e),N(_),N(d))}}}function Sf(t){let e,l,n=Ze(t[0],8)+"",i,o,a,r,f=Ze(t[0],71)+"",c,m,_=Ze(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=v(),a=p("optgroup"),r=p("option"),c=M(f),m=p("option"),d=M(_),l.__value=8,j(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,j(r,r.__value),m.__value=70,j(m,m.__value),u(a,"label","Generic hardware")},m(h,g){P(h,e,g),s(e,l),s(l,i),P(h,o,g),P(h,a,g),s(a,r),s(r,c),s(a,m),s(m,d)},p(h,g){g&1&&n!==(n=Ze(h[0],8)+"")&&E(i,n),g&1&&f!==(f=Ze(h[0],71)+"")&&E(c,f),g&1&&_!==(_=Ze(h[0],70)+"")&&E(d,_)},d(h){h&&(N(e),N(o),N(a))}}}function Mf(t){let e,l,n=Ze(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=200,j(l,l.__value),u(e,"label","Generic hardware")},m(o,a){P(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],200)+"")&&E(i,n)},d(o){o&&N(e)}}}function Nf(t){let e,l,n=Ze(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=80,j(l,l.__value),u(e,"label","Generic hardware")},m(o,a){P(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],80)+"")&&E(i,n)},d(o){o&&N(e)}}}function p_(t){let e,l,n,i,o,a,r,f,c=t[0]=="esp8266"&&kf(t),m=t[0]=="esp32"&&wf(t),_=t[0]=="esp32s2"&&Cf(t),d=t[0]=="esp32c3"&&Sf(t),h=t[0]=="esp32solo"&&Mf(t),g=t[0]=="esp32s3"&&Nf(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),o=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),g&&g.c(),f=Wt(),e.__value=-1,j(e,e.__value)},m(b,C){P(b,e,C),P(b,l,C),c&&c.m(b,C),P(b,n,C),m&&m.m(b,C),P(b,i,C),_&&_.m(b,C),P(b,o,C),d&&d.m(b,C),P(b,a,C),h&&h.m(b,C),P(b,r,C),g&&g.m(b,C),P(b,f,C)},p(b,[C]){b[0]=="esp8266"?c?c.p(b,C):(c=kf(b),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),b[0]=="esp32"?m?m.p(b,C):(m=wf(b),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),b[0]=="esp32s2"?_?_.p(b,C):(_=Cf(b),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),b[0]=="esp32c3"?d?d.p(b,C):(d=Sf(b),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),b[0]=="esp32solo"?h?h.p(b,C):(h=Mf(b),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),b[0]=="esp32s3"?g?g.p(b,C):(g=Nf(b),g.c(),g.m(f.parentNode,f)):g&&(g.d(1),g=null)},i:je,o:je,d(b){b&&(N(e),N(l),N(n),N(i),N(o),N(a),N(r),N(f)),c&&c.d(b),m&&m.d(b),_&&_.d(b),d&&d.d(b),h&&h.d(b),g&&g.d(b)}}}function d_(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class h_ extends Tt{constructor(e){super(),Pt(this,e,d_,p_,Ct,{chip:0})}}function Pf(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Tf(t){let e,l,n,i,o,a,r;return a=new eo({props:{chip:t[0].chip}}),{c(){e=p("div"),l=M("HAN GPIO"),n=p("br"),i=v(),o=p("select"),Me(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Ce(a,o,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(X(a.$$.fragment,f),r=!0)},o(f){x(a.$$.fragment,f),r=!1},d(f){f&&N(e),Se(a)}}}function v_(t){let e,l,n,i,o,a,r,f,c,m,_,d,h,g,b,C,k,A,I,R,T,F,L,H,K,z,q,B,Z,V=t[0].usrcfg&&Pf();g=new h_({props:{chip:t[0].chip}});let Y=t[0].board&&t[0].board>20&&Tf(t);return z=new pl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),V&&V.c(),f=v(),c=p("div"),m=M("Board type"),_=p("br"),d=v(),h=p("select"),Me(g.$$.fragment),b=v(),Y&&Y.c(),C=v(),k=p("div"),A=p("label"),I=p("input"),R=M(" Clear all other configuration"),T=v(),F=p("div"),F.innerHTML='',L=v(),H=p("span"),H.textContent=" ",K=v(),Me(z.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&Et(()=>t[5].call(h)),u(c,"class","my-3"),u(I,"type","checkbox"),u(I,"name","vr"),I.__value="true",j(I,I.__value),u(I,"class","rounded mb-1"),u(k,"class","my-3"),u(F,"class","my-3"),u(H,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,U){P(G,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),V&&V.m(n,null),s(n,f),s(n,c),s(c,m),s(c,_),s(c,d),s(c,h),Ce(g,h,null),ze(h,t[0].board,!0),s(n,b),Y&&Y.m(n,null),s(n,C),s(n,k),s(k,A),s(A,I),I.checked=t[2],s(A,R),s(n,T),s(n,F),s(n,L),s(n,H),P(G,K,U),Ce(z,G,U),q=!0,B||(Z=[ce(h,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",mn(t[3]))],B=!0)},p(G,[U]){G[0].usrcfg?V||(V=Pf(),V.c(),V.m(n,f)):V&&(V.d(1),V=null);const y={};U&1&&(y.chip=G[0].chip),g.$set(y),U&1&&ze(h,G[0].board),G[0].board&&G[0].board>20?Y?(Y.p(G,U),U&1&&X(Y,1)):(Y=Tf(G),Y.c(),X(Y,1),Y.m(n,C)):Y&&(ct(),x(Y,1,1,()=>{Y=null}),_t()),U&4&&(I.checked=G[2]);const ne={};U&2&&(ne.active=G[1]),z.$set(ne)},i(G){q||(X(g.$$.fragment,G),X(Y),X(z.$$.fragment,G),q=!0)},o(G){x(g.$$.fragment,G),x(Y),x(z.$$.fragment,G),q=!1},d(G){G&&(N(e),N(K)),V&&V.d(),Se(g),Y&&Y.d(),Se(z,G),B=!1,zt(Z)}}}function b_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function a(m){l(1,o=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let b of _){const[C,k]=b;d.append(C,k)}let g=await(await fetch("save",{method:"POST",body:d})).json();l(1,o=!1),dl.update(b=>(b.vndcfg=g.success,b.booting=g.reboot,b.if.eth=b.boardType>240&&b.boardType<250,b)),nn(n+(i.usrcfg?"":"setup"))}let r=!0;dl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Xt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,o,r,a,n,f,c]}class g_ extends Tt{constructor(e){super(),Pt(this,e,b_,v_,Ct,{basepath:4,sysinfo:0})}}function qf(t,e,l){const n=t.slice();return n[13]=e[l],n}function Ef(t){var i,o;let e,l=(((o=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,j(e,e.__value)},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&E(n,l)},d(a){a&&N(e)}}}function Df(t){var H,K,z,q;let e,l=(((K=(H=t[1].conf)==null?void 0:H.connection)==null?void 0:K.ssid)??"SSID")+"",n,i,o,a,r,f,c,m,_,d,h=(((q=(z=t[1].conf)==null?void 0:z.connection)==null?void 0:q.psk)??"Password")+"",g,b,C,k,A,I,R;function T(B,Z){return B[2]?w_:k_}let F=T(t),L=F(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("label"),a=p("input"),r=M(" manual"),f=v(),c=p("br"),m=v(),L.c(),_=v(),d=p("div"),g=M(h),b=p("br"),C=v(),k=p("input"),u(a,"type","checkbox"),a.__value="true",j(a,a.__value),u(a,"class","rounded mb-1"),u(o,"class","float-right mr-3"),u(e,"class","my-3"),u(k,"name","sp"),u(k,"type","password"),u(k,"pattern",Nn),u(k,"class","in-s"),u(k,"autocomplete","off"),k.required=A=t[5]==2,u(d,"class","my-3")},m(B,Z){P(B,e,Z),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[2],s(o,r),s(e,f),s(e,c),s(e,m),L.m(e,null),P(B,_,Z),P(B,d,Z),s(d,g),s(d,b),s(d,C),s(d,k),I||(R=ce(a,"change",t[9]),I=!0)},p(B,Z){var V,Y,G,U;Z&2&&l!==(l=(((Y=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:Y.ssid)??"SSID")+"")&&E(n,l),Z&4&&(a.checked=B[2]),F===(F=T(B))&&L?L.p(B,Z):(L.d(1),L=F(B),L&&(L.c(),L.m(e,null))),Z&2&&h!==(h=(((U=(G=B[1].conf)==null?void 0:G.connection)==null?void 0:U.psk)??"Password")+"")&&E(g,h),Z&32&&A!==(A=B[5]==2)&&(k.required=A)},d(B){B&&(N(e),N(_),N(d)),L.d(),I=!1,R()}}}function k_(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&Af(),o=((r=t[3])==null?void 0:r.n)&&Lf(t);return{c(){e=p("select"),i&&i.c(),l=Wt(),o&&o.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),s(e,l),o&&o.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=Af(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?o?o.p(f,c):(o=Lf(f),o.c(),o.m(e,null)):o&&(o.d(1),o=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),o&&o.d()}}}function w_(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Nn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function Af(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",j(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Lf(t){var i;let e,l=ft((i=t[3])==null?void 0:i.n),n=[];for(let o=0;ot[8].call(b)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Ci),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(G,"type","checkbox"),u(G,"name","sm"),G.__value="static",j(G,G.__value),u(G,"class","rounded mb-1"),u(V,"class","my-3"),u(fe,"type","submit"),u(fe,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Ne,De){P(Ne,e,De),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(a,f),s(n,c),s(n,m),s(m,d),s(m,h),s(m,g),s(m,b),s(b,C),s(C,A),s(b,I),s(I,T),S&&S.m(b,null),ze(b,t[5],!0),s(n,F),w&&w.m(n,null),s(n,L),s(n,H),s(H,z),s(H,q),s(H,B),j(B,t[0].hostname),s(n,Z),s(n,V),s(V,Y),s(Y,G),G.checked=t[4],s(Y,U),s(Y,ne),s(V,ee),O&&O.m(V,null),s(n,Q),D&&D.m(n,null),s(n,ie),s(n,re),s(re,fe),s(fe,de),P(Ne,oe,De),Ce(me,Ne,De),se=!0,pe||(we=[ce(b,"change",t[8]),ce(B,"input",t[10]),ce(G,"change",t[11]),ce(n,"submit",mn(t[7]))],pe=!0)},p(Ne,[De]){var $e,xe,ut,St,dt,rt,ot,ht,Lt,Je,Fe,He;(!se||De&2)&&r!==(r=((($e=Ne[1].setup)==null?void 0:$e.title)??"Setup")+"")&&E(f,r),(!se||De&2)&&_!==(_=(((ut=(xe=Ne[1].conf)==null?void 0:xe.connection)==null?void 0:ut.title)??"Connection")+"")&&E(d,_),(!se||De&2)&&k!==(k=(((dt=(St=Ne[1].conf)==null?void 0:St.connection)==null?void 0:dt.wifi)??"Connect to WiFi")+"")&&E(A,k),(!se||De&2)&&R!==(R=(((ot=(rt=Ne[1].conf)==null?void 0:rt.connection)==null?void 0:ot.ap)??"Standalone access point")+"")&&E(T,R),Ne[0].if&&Ne[0].if.eth?S?S.p(Ne,De):(S=Ef(Ne),S.c(),S.m(b,null)):S&&(S.d(1),S=null),De&32&&ze(b,Ne[5]),Ne[5]==1||Ne[5]==2?w?w.p(Ne,De):(w=Df(Ne),w.c(),w.m(n,L)):w&&(w.d(1),w=null),(!se||De&2)&&K!==(K=(((Lt=(ht=Ne[1].conf)==null?void 0:ht.general)==null?void 0:Lt.hostname)??"Hostname")+"")&&E(z,K),De&1&&B.value!==Ne[0].hostname&&j(B,Ne[0].hostname),De&16&&(G.checked=Ne[4]),(!se||De&2)&&y!==(y=(((Je=Ne[1].setup)==null?void 0:Je.static)??"Static IP")+"")&&E(ne,y),Ne[4]?O?(O.p(Ne,De),De&16&&X(O,1)):(O=If(Ne),O.c(),X(O,1),O.m(V,null)):O&&(ct(),x(O,1,1,()=>{O=null}),_t()),Ne[4]?D?D.p(Ne,De):(D=Rf(Ne),D.c(),D.m(n,ie)):D&&(D.d(1),D=null),(!se||De&2)&&le!==(le=(((Fe=Ne[1].btn)==null?void 0:Fe.save)??"Save")+"")&&E(de,le);const Re={};De&64&&(Re.active=Ne[6]),De&2&&(Re.message=((He=Ne[1].setup)==null?void 0:He.mask)??"Saving"),me.$set(Re)},i(Ne){se||(X(O),X(me.$$.fragment,Ne),se=!0)},o(Ne){x(O),x(me.$$.fragment,Ne),se=!1},d(Ne){Ne&&(N(e),N(oe)),S&&S.d(),w&&w.d(),O&&O.d(),D&&D.d(),Se(me,Ne),pe=!1,zt(we)}}}function S_(t,e,l){let n={};Nl.subscribe(C=>{l(1,n=C)});let i=!1,o={};co.subscribe(C=>{l(3,o=C)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(C){dl.update(k=>(k.trying=C,k))}async function _(C){l(6,c=!0);const k=new FormData(C.target),A=new URLSearchParams;for(let T of k){const[F,L]=T;A.append(F,L)}let R=await(await fetch("save",{method:"POST",body:A})).json();l(6,c=!1),dl.update(T=>(T.hostname=k.get("sh"),T.usrcfg=R.success,T.booting=R.reboot,r&&(T.net.ip=k.get("si"),T.net.mask=k.get("su"),T.net.gw=k.get("sg"),T.net.dns1=k.get("sd")),R.reboot&&setTimeout(ti,5e3,a,m),T))}function d(){f=Xt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function g(){a.hostname=this.value,l(0,a)}function b(){r=this.checked,l(4,r)}return t.$$set=C=>{"sysinfo"in C&&l(0,a=C.sysinfo)},[a,n,i,o,r,f,c,_,d,h,g,b]}class M_ extends Tt{constructor(e){super(),Pt(this,e,S_,C_,Ct,{sysinfo:0})}}function N_(t){var z,q,B,Z;let e,l,n,i=(((z=t[2].upload)==null?void 0:z.title)??"Upload")+"",o,a,r,f,c,m=(((q=t[2].upload)==null?void 0:q.desc)??"")+"",_,d,h,g,b,C,k,A,I=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",R,T,F,L,H,K;return F=new pl({props:{active:t[3],message:((Z=t[2].upload)==null?void 0:Z.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),o=M(i),a=v(),r=M(t[1]),f=v(),c=p("p"),_=M(m),d=v(),h=p("form"),g=p("input"),b=v(),C=p("div"),k=p("button"),A=p("p"),R=M(I),T=v(),Me(F.$$.fragment),u(c,"class","mb-4"),u(g,"name","file"),u(g,"type","file"),u(A,"class","mb-4"),u(k,"type","submit"),u(k,"class","btn-pri"),u(C,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(V,Y){P(V,e,Y),s(e,l),s(l,n),s(n,o),s(n,a),s(n,r),s(l,f),s(l,c),s(c,_),s(l,d),s(l,h),s(h,g),s(h,b),s(h,C),s(C,k),s(k,A),s(A,R),P(V,T,Y),Ce(F,V,Y),L=!0,H||(K=ce(h,"submit",t[4]),H=!0)},p(V,[Y]){var U,y,ne,ee;(!L||Y&4)&&i!==(i=(((U=V[2].upload)==null?void 0:U.title)??"Upload")+"")&&E(o,i),(!L||Y&2)&&E(r,V[1]),(!L||Y&4)&&m!==(m=(((y=V[2].upload)==null?void 0:y.desc)??"")+"")&&E(_,m),(!L||Y&4)&&I!==(I=(((ne=V[2].btn)==null?void 0:ne.upload)??"Upload")+"")&&E(R,I),(!L||Y&1)&&u(h,"action",V[0]);const G={};Y&8&&(G.active=V[3]),Y&4&&(G.message=((ee=V[2].upload)==null?void 0:ee.mask)??"Uploading"),F.$set(G)},i(V){L||(X(F.$$.fragment,V),L=!0)},o(V){x(F.$$.fragment,V),L=!1},d(V){V&&(N(e),N(T)),Se(F,V),H=!1,K()}}}function P_(t,e,l){let{action:n}=e,{title:i}=e,o={};Nl.subscribe(f=>{l(2,o=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,o,a,r]}class vo extends Tt{constructor(e){super(),Pt(this,e,P_,N_,Ct,{action:0,title:1})}}function T_(t){var me,se,pe,we,S,w,O;let e,l,n,i,o=(((me=t[1].consent)==null?void 0:me.title)??"Consents")+"",a,r,f,c,m,_=(((se=t[1].consent)==null?void 0:se.one_click)??"One-click")+"",d,h,g,b,C=(((pe=t[1].consent)==null?void 0:pe.read_more)??"Read more")+"",k,A,I,R,T,F,L,H=(((we=t[1].consent)==null?void 0:we.yes)??"Yes")+"",K,z,q,B,Z,V,Y=(((S=t[1].consent)==null?void 0:S.no)??"No")+"",G,U,y,ne,ee,Q=(((w=t[1].btn)==null?void 0:w.save)??"Save")+"",ie,re,fe,le,de,oe;return fe=new pl({props:{active:t[2],message:((O=t[1].consent)==null?void 0:O.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=M(o),r=v(),f=p("hr"),c=v(),m=p("div"),d=M(_),h=p("br"),g=v(),b=p("a"),k=M(C),A=p("br"),I=v(),R=p("label"),T=p("input"),L=v(),K=M(H),z=v(),q=p("label"),B=p("input"),V=v(),G=M(Y),U=p("br"),y=v(),ne=p("div"),ee=p("button"),ie=M(Q),re=v(),Me(fe.$$.fragment),u(b,"href",hl("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u(T,"type","radio"),u(T,"name","sf"),T.value=1,T.checked=F=t[0].fwconsent===1,u(T,"class","rounded m-2"),T.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=Z=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(ee,"type","submit"),u(ee,"class","btn-pri"),u(ne,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(D,W){P(D,e,W),s(e,l),s(l,n),s(n,i),s(i,a),s(n,r),s(n,f),s(n,c),s(n,m),s(m,d),s(m,h),s(m,g),s(m,b),s(b,k),s(m,A),s(m,I),s(m,R),s(R,T),s(R,L),s(R,K),s(m,z),s(m,q),s(q,B),s(q,V),s(q,G),s(m,U),s(n,y),s(n,ne),s(ne,ee),s(ee,ie),P(D,re,W),Ce(fe,D,W),le=!0,de||(oe=ce(n,"submit",mn(t[3])),de=!0)},p(D,[W]){var ue,be,ke,J,ve,ge,qe;(!le||W&2)&&o!==(o=(((ue=D[1].consent)==null?void 0:ue.title)??"Consents")+"")&&E(a,o),(!le||W&2)&&_!==(_=(((be=D[1].consent)==null?void 0:be.one_click)??"One-click")+"")&&E(d,_),(!le||W&2)&&C!==(C=(((ke=D[1].consent)==null?void 0:ke.read_more)??"Read more")+"")&&E(k,C),(!le||W&1&&F!==(F=D[0].fwconsent===1))&&(T.checked=F),(!le||W&2)&&H!==(H=(((J=D[1].consent)==null?void 0:J.yes)??"Yes")+"")&&E(K,H),(!le||W&1&&Z!==(Z=D[0].fwconsent===2))&&(B.checked=Z),(!le||W&2)&&Y!==(Y=(((ve=D[1].consent)==null?void 0:ve.no)??"No")+"")&&E(G,Y),(!le||W&2)&&Q!==(Q=(((ge=D[1].btn)==null?void 0:ge.save)??"Save")+"")&&E(ie,Q);const te={};W&4&&(te.active=D[2]),W&2&&(te.message=((qe=D[1].consent)==null?void 0:qe.mask_saving)??"Saving"),fe.$set(te)},i(D){le||(X(fe.$$.fragment,D),le=!0)},o(D){x(fe.$$.fragment,D),le=!1},d(D){D&&(N(e),N(re)),Se(fe,D),de=!1,oe()}}}function q_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o={};Nl.subscribe(f=>{l(1,o=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[g,b]=h;m.append(g,b)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),dl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),nn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,o,a,r,n]}class E_ extends Tt{constructor(e){super(),Pt(this,e,q_,T_,Ct,{basepath:4,sysinfo:0})}}function Ff(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function Bf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function D_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Uf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function A_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function zf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function jf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Hf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function yf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Wf(t){let e,l=ft(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(Re,"class",xe=t[32]{l(0,i=U)});let o=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Xu.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),mc();async function c(U){l(3,f=!0);const y=new URLSearchParams;y.append("r","true"),y.append("rc",a.o.length),a.o.forEach(function(ee,Q){y.append("rt"+Q,ee.t),y.append("rn"+Q,ee.n),y.append("rd"+Q,ee.d),y.append("ra"+Q,ee.a),y.append("rh"+Q,ee.h),y.append("rv"+Q,ee.v),y.append("rsm"+Q,ee.s.m),y.append("rsd"+Q,ee.s.d),y.append("rem"+Q,ee.e.m),y.append("red"+Q,ee.e.d)}),await(await fetch("save",{method:"POST",body:y})).json(),l(3,f=!1),nn(n+"configuration")}let m=function(U,y){return U.includes(y)?U=U.filter(function(ne){return ne!==y}):U.push(y),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let y=a.o;y.splice(U,1),l(1,a.o=y,a)},h=function(U){if(U<=0)return;let y=a.o;var ne=y[U];y[U]=y[U-1],y[U-1]=ne,l(1,a.o=y,a)},g=function(U){let y=a.o;if(!(U>=y.length-1)){var ne=y[U];y[U]=y[U+1],y[U+1]=ne,l(1,a.o=y,a)}};function b(U,y){U[y].n=this.value,l(1,a)}function C(U,y){U[y].d=Xt(this),l(1,a)}function k(U,y){U[y].t=Xt(this),l(1,a)}function A(U,y){U[y].v=Be(this.value),l(1,a)}const I=(U,y,ne,ee)=>l(1,ne[ee].a=m(U.a,y),a),R=(U,y,ne,ee)=>l(1,ne[ee].h=m(U.h,y),a),T=(U,y,ne,ee)=>l(1,ne[ee].h=m(U.h,y+8),a),F=(U,y,ne,ee)=>l(1,ne[ee].h=m(U.h,y+16),a);function L(U,y){U[y].s.d=Xt(this),l(1,a)}function H(U,y){U[y].s.m=Xt(this),l(1,a)}function K(U,y){U[y].e.d=Xt(this),l(1,a)}function z(U,y){U[y].e.m=Xt(this),l(1,a)}const q=U=>h(U),B=U=>h(U),Z=U=>g(U),V=U=>g(U),Y=U=>d(U),G=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,o,c,m,_,d,h,g,n,b,C,k,A,I,R,T,F,L,H,K,z,q,B,Z,V,Y,G]}class F_ extends Tt{constructor(e){super(),Pt(this,e,R_,I_,Ct,{basepath:11},null,[-1,-1])}}function Jf(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function $f(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function xf(t){let e,l,n,i=ft(t[1]),o=[];for(let a=0;a{l(3,r=C)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let C in i)(C.startsWith("i")||C.startsWith("e"))&&l(0,i[C]=0,i)}let d=!1;async function h(C){l(5,d=!0);const k=new FormData(C.target),A=new URLSearchParams;for(let R of k){const[T,F]=R;A.append(T,F)}await(await fetch(o,{method:"POST",body:A})).json(),l(5,d=!1),nn(a)}function g(C){i[C.key]=Be(this.value),l(0,i)}function b(C){i[C.key]=Be(this.value),l(0,i)}return t.$$set=C=>{"prefix"in C&&l(8,n=C.prefix),"data"in C&&l(0,i=C.data),"url"in C&&l(9,o=C.url),"basepath"in C&&l(10,a=C.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let C in i){let k=[];C.startsWith("i")?k=c:C.startsWith("e")&&(k=m,i[C]&&l(4,f=!0)),k.push({key:C,name:n+" "+C.substring(1),value:i[C]})}}},[i,c,m,r,f,d,_,h,n,o,a,g,b]}class $u extends Tt{constructor(e){super(),Pt(this,e,U_,B_,Ct,{prefix:8,data:0,url:9,basepath:10})}}function z_(t){let e,l;return e=new cc({props:{data:t[7],sysinfo:t[8],importPrices:t[1],exportPrices:t[2],dayPlot:t[3],monthPlot:t[4],temperatures:t[5],translations:t[6],tariffData:t[9]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&128&&(o.data=n[7]),i&256&&(o.sysinfo=n[8]),i&2&&(o.importPrices=n[1]),i&4&&(o.exportPrices=n[2]),i&8&&(o.dayPlot=n[3]),i&16&&(o.monthPlot=n[4]),i&32&&(o.temperatures=n[5]),i&64&&(o.translations=n[6]),i&512&&(o.tariffData=n[9]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function j_(t){let e,l;return e=new t_({props:{sysinfo:t[8],basepath:t[0],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function H_(t){let e,l;return e=new F_({props:{basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function y_(t){let e,l;return e=new m_({props:{sysinfo:t[8],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function W_(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function G_(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function V_(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function K_(t){let e,l;return e=new E_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Y_(t){let e,l;return e=new M_({props:{sysinfo:t[8]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Q_(t){let e,l;return e=new g_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function X_(t){let e,l;return e=new $u({props:{prefix:"UTC Hour",data:t[3],url:"/dayplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&8&&(o.data=n[3]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Z_(t){let e,l;return e=new $u({props:{prefix:"Day",data:t[4],url:"/monthplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&16&&(o.data=n[4]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function J_(t){let e,l,n,i,o,a,r,f,c,m,_,d,h,g,b,C,k,A,I,R,T,F,L,H,K,z;return e=new u1({props:{data:t[7],basepath:t[0]}}),n=new Cl({props:{path:"/",$$slots:{default:[z_]},$$scope:{ctx:t}}}),o=new Cl({props:{path:"/configuration",$$slots:{default:[j_]},$$scope:{ctx:t}}}),r=new Cl({props:{path:"/priceconfig",$$slots:{default:[H_]},$$scope:{ctx:t}}}),c=new Cl({props:{path:"/status",$$slots:{default:[y_]},$$scope:{ctx:t}}}),_=new Cl({props:{path:"/mqtt-ca",$$slots:{default:[W_]},$$scope:{ctx:t}}}),h=new Cl({props:{path:"/mqtt-cert",$$slots:{default:[G_]},$$scope:{ctx:t}}}),b=new Cl({props:{path:"/mqtt-key",$$slots:{default:[V_]},$$scope:{ctx:t}}}),k=new Cl({props:{path:"/consent",$$slots:{default:[K_]},$$scope:{ctx:t}}}),I=new Cl({props:{path:"/setup",$$slots:{default:[Y_]},$$scope:{ctx:t}}}),T=new Cl({props:{path:"/vendor",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),L=new Cl({props:{path:"/edit-day",$$slots:{default:[X_]},$$scope:{ctx:t}}}),K=new Cl({props:{path:"/edit-month",$$slots:{default:[Z_]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment),l=v(),Me(n.$$.fragment),i=v(),Me(o.$$.fragment),a=v(),Me(r.$$.fragment),f=v(),Me(c.$$.fragment),m=v(),Me(_.$$.fragment),d=v(),Me(h.$$.fragment),g=v(),Me(b.$$.fragment),C=v(),Me(k.$$.fragment),A=v(),Me(I.$$.fragment),R=v(),Me(T.$$.fragment),F=v(),Me(L.$$.fragment),H=v(),Me(K.$$.fragment)},m(q,B){Ce(e,q,B),P(q,l,B),Ce(n,q,B),P(q,i,B),Ce(o,q,B),P(q,a,B),Ce(r,q,B),P(q,f,B),Ce(c,q,B),P(q,m,B),Ce(_,q,B),P(q,d,B),Ce(h,q,B),P(q,g,B),Ce(b,q,B),P(q,C,B),Ce(k,q,B),P(q,A,B),Ce(I,q,B),P(q,R,B),Ce(T,q,B),P(q,F,B),Ce(L,q,B),P(q,H,B),Ce(K,q,B),z=!0},p(q,B){const Z={};B&128&&(Z.data=q[7]),B&1&&(Z.basepath=q[0]),e.$set(Z);const V={};B&5118&&(V.$$scope={dirty:B,ctx:q}),n.$set(V);const Y={};B&4481&&(Y.$$scope={dirty:B,ctx:q}),o.$set(Y);const G={};B&4097&&(G.$$scope={dirty:B,ctx:q}),r.$set(G);const U={};B&4480&&(U.$$scope={dirty:B,ctx:q}),c.$set(U);const y={};B&4096&&(y.$$scope={dirty:B,ctx:q}),_.$set(y);const ne={};B&4096&&(ne.$$scope={dirty:B,ctx:q}),h.$set(ne);const ee={};B&4096&&(ee.$$scope={dirty:B,ctx:q}),b.$set(ee);const Q={};B&4353&&(Q.$$scope={dirty:B,ctx:q}),k.$set(Q);const ie={};B&4352&&(ie.$$scope={dirty:B,ctx:q}),I.$set(ie);const re={};B&4353&&(re.$$scope={dirty:B,ctx:q}),T.$set(re);const fe={};B&4105&&(fe.$$scope={dirty:B,ctx:q}),L.$set(fe);const le={};B&4113&&(le.$$scope={dirty:B,ctx:q}),K.$set(le)},i(q){z||(X(e.$$.fragment,q),X(n.$$.fragment,q),X(o.$$.fragment,q),X(r.$$.fragment,q),X(c.$$.fragment,q),X(_.$$.fragment,q),X(h.$$.fragment,q),X(b.$$.fragment,q),X(k.$$.fragment,q),X(I.$$.fragment,q),X(T.$$.fragment,q),X(L.$$.fragment,q),X(K.$$.fragment,q),z=!0)},o(q){x(e.$$.fragment,q),x(n.$$.fragment,q),x(o.$$.fragment,q),x(r.$$.fragment,q),x(c.$$.fragment,q),x(_.$$.fragment,q),x(h.$$.fragment,q),x(b.$$.fragment,q),x(k.$$.fragment,q),x(I.$$.fragment,q),x(T.$$.fragment,q),x(L.$$.fragment,q),x(K.$$.fragment,q),z=!1},d(q){q&&(N(l),N(i),N(a),N(f),N(m),N(d),N(g),N(C),N(A),N(R),N(F),N(H)),Se(e,q),Se(n,q),Se(o,q),Se(r,q),Se(c,q),Se(_,q),Se(h,q),Se(b,q),Se(k,q),Se(I,q),Se(T,q),Se(L,q),Se(K,q)}}}function nu(t){let e,l,n,i;const o=[x_,$_],a=[];function r(f,c){return f[8].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function $_(t){let e,l;return e=new pl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function x_(t){let e,l;return e=new pl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[8].trying}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.message="Device is booting, please wait. Trying to reach it on "+n[8].trying),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function em(t){let e,l,n,i;l=new Eu({props:{basepath:t[0],$$slots:{default:[J_]},$$scope:{ctx:t}}});let o=t[8].booting&&nu(t);return{c(){e=p("div"),Me(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Ce(l,e,null),s(e,n),o&&o.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&5119&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[8].booting?o?(o.p(a,r),r&256&&X(o,1)):(o=nu(a),o.c(),X(o,1),o.m(e,null)):o&&(ct(),x(o,1,1,()=>{o=null}),_t())},i(a){i||(X(l.$$.fragment,a),X(o),i=!0)},o(a){x(l.$$.fragment,a),x(o),i=!1},d(a){a&&N(e),Se(l),o&&o.d()}}}function tm(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Fu.subscribe(b=>{l(1,i=b)});let o;Bu.subscribe(b=>{l(2,o=b)});let a;zu.subscribe(b=>{l(3,a=b)});let r;ju.subscribe(b=>{l(4,r=b)});let f;Hu.subscribe(b=>{l(5,f=b)});let c={};Nl.subscribe(b=>{l(6,c=b)});let m,_={},d={},h;dl.subscribe(b=>{var C;l(8,d=b),d.vndcfg===!1?nn(n+"vendor"):d.usrcfg===!1?nn(n+"setup"):d.fwconsent===0&&nn(n+"consent"),d.ui.k===1?document.documentElement.classList.add("dark"):d.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),d.ui.lang&&d.ui.lang!=((C=c==null?void 0:c.language)==null?void 0:C.code)&&Gu(d.ui.lang),d.version&&h&&d.version!=h&&window.location.reload(),h=d.version,m&&clearTimeout(m),m=setTimeout(Ti,!_||!_.u||_.u<30||d!=null&&d.upgrading?1e4:3e5)}),E0.subscribe(b=>{l(7,_=b),x1(b)});let g={};return Wu.subscribe(b=>{l(9,g=b)}),yu(),[n,i,o,a,r,f,c,_,d,g]}class lm extends Tt{constructor(e){super(),Pt(this,e,tm,em,Ct,{})}}new lm({target:document.getElementById("app")}); +Occurred in: ${i}`:"",a=uo(t),r=ru(e)?e(a):e;return`<${a}> ${r}${o}`}const Mu=t=>(...e)=>t(Lr(...e)),Nu=Mu(t=>{throw new Error(t)}),ki=Mu(console.warn),So=4,Or=3,Ir=2,Rr=1,Fr=1;function Br(t,e){const l=t.default?0:El(t.fullPath).reduce((n,i)=>{let o=n;return o+=So,Sr(i)?o+=Fr:Mr(i)?o+=Ir:bu(i)?o-=So+Rr:o+=Or,o},0);return{route:t,score:l,index:e}}function Ur(t){return t.map(Br).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Pu(t,e){let l,n;const[i]=e.split("?"),o=El(i),a=o[0]==="",r=Ur(t);for(let f=0,c=r.length;f({...m,params:d,uri:w});if(m.default){n=h(e);continue}const g=El(m.fullPath),b=Math.max(o.length,g.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),Di(`/${f.join("/")}`,n)}function Mo(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=El(e,!0),r=El(l,!0);for(;a.length;)a[0]!==r[0]&&Nu(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),r.shift();return{pathname:oi(...r),hash:n,search:i,state:o}}const No=t=>t.length===1?"":t,ro=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?No(Xn(t,l)):"",a=i?Xn(t,0,l):t,r=n?No(Xn(a,e)):"";return{pathname:(n?Xn(a,0,e):a)||"/",search:r,hash:o}},jr=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Hr(t,e,l){return oi(l,zr(t,e))}function Wr(t,e){const l=ao(Nr(t)),n=El(l,!0),i=El(e,!0).slice(0,n.length),o=Tu({fullPath:l},oi(...i));return o&&o.uri}const Ai="POP",yr="PUSH",Gr="REPLACE";function Li(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Vr(t){let e=[],l=Li(t),n=Ai;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Li(t),n=Ai,i([o])};i([o]);const r=mu(t,"popstate",a);return()=>{r(),e=e.filter(f=>f!==o)}},navigate(o,a){const{state:r={},replace:f=!1}=a||{};if(n=f?Gr:yr,cu(o))a&&ki(Su,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ai,t.history.go(o);else{const c={...r,_key:gr()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Li(t),i()}}}function Oi(t,e){return{...ro(e),state:t}}function Kr(t="/"){let e=0,l=[Oi(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Oi(n,o))},replaceState(n,i,o){l[e]=Oi(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Yr=!!(!Ol&&window.document&&window.document.createElement),Qr=!Ol&&window.location.origin==="null",qu=Vr(Yr&&!Qr?window:Kr()),{navigate:nn}=qu;let Dl=null,Eu=!0;function Xr(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nDl.level||t.level===Dl.level&&Xr(t.routerId,Dl.routerId))&&(Dl=t)}function Jr(){Dl=null}function $r(){Eu=!1}function Po(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=mu(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function xr(t,e){return Number(t.dataset.svnavRouteEnd)===e}function e0(t){return/^H[1-6]$/i.test(t.tagName)}function To(t,e=document){return e.querySelector(t)}function t0(t){let l=To(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!xr(l,t);){if(e0(l))return l;const n=To("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function l0(t){Promise.resolve(rn(t.focusElement)).then(e=>{const l=e||t0(t.id);l||ki(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ni),!Po(l)&&Po(document.documentElement)})}const n0=(t,e,l)=>(n,i)=>mr().then(()=>{if(!Dl||Eu){$r();return}if(n&&l0(Dl.route),t.announcements&&i){const{path:o,fullPath:a,meta:r,params:f,uri:c}=Dl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:r,params:f,uri:c},rn(l));Promise.resolve(m).then(_=>{e.set(_)})}Jr()}),i0="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function o0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},pu(t[6],i0)],i={};for(let o=0;o`Navigated to ${Q.uri}`,announcements:!0,...g},w=m,E=ao(m),F=on(ji),R=on(Nn),T=!F,L=a0(),O=h&&!(R&&!R.manageFocus),H=rl("");ql(t,H,Q=>l(0,r=Q));const K=R?R.disableInlineStyles:b,z=rl([]);ql(t,z,Q=>l(20,a=Q));const q=rl(null);ql(t,q,Q=>l(18,i=Q));let B=!1;const Z=T?0:R.level+1,Y=T?rl((()=>Mo(Ol?ro(_):d.location,E))()):F;ql(t,Y,Q=>l(17,n=Q));const G=rl(n);ql(t,G,Q=>l(19,o=Q));const U=n0(k,H,Y),W=Q=>ie=>ie.filter(re=>re.id!==Q);function ne(Q){if(Ol){if(B)return;const ie=Tu(Q,n.pathname);if(ie)return B=!0,ie}else z.update(ie=>{const re=W(Q.id)(ie);return re.push(Q),re})}function ee(Q){z.update(W(Q))}return!T&&m!==qo&&ki(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),T&&(so(()=>d.listen(ie=>{const re=Mo(ie.location,E);G.set(n),Y.set(re)})),$n(ji,Y)),$n(Nn,{activeRoute:q,registerRoute:ne,unregisterRoute:ee,manageFocus:O,level:Z,id:L,history:T?d:R.history,basepath:T?E:R.basepath,disableInlineStyles:K}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,d=Q.history),"primary"in Q&&l(14,h=Q.primary),"a11y"in Q&&l(15,g=Q.a11y),"disableInlineStyles"in Q&&l(16,b=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==w&&ki(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=Pu(a,n.pathname);q.set(Q)}if(t.$$.dirty[0]&655360&&T){const Q=!!n.hash,ie=!Q&&O,re=!Q||n.pathname!==o.pathname;U(ie,re)}t.$$.dirty[0]&262144&&O&&i&&i.primary&&Zr({level:Z,routerId:L,route:i})},[r,k,T,L,O,H,K,z,q,Y,G,m,_,d,h,g,b,n,i,o,a,c,f]}class u0 extends Tt{constructor(e){super(),Pt(this,e,f0,s0,Ct,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Du=u0;function si(t,e,l=Nn,n=mn){on(l)||Nu(t,o=>`You cannot use ${o} outside of a ${uo(n)}.`,e)}const r0=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function Au(){return si(ku),r0(ji)}function Lu(){const{history:t}=on(Nn);return t}function Ou(){const t=on(hu);return t?kr(t,e=>e.base):rl("/")}function Iu(){si(Cu);const t=Ou(),{basepath:e}=on(Nn);return n=>Hr(n,rn(t),e)}function c0(){si(wu);const t=Iu(),{navigate:e}=Lu();return(n,i)=>{const o=cu(n)?n:t(n);return e(o,i)}}const _0=t=>({params:t&16,location:t&8}),Eo=t=>({params:Ol?rn(t[10]):t[4],location:t[3],navigate:t[11]});function Do(t){let e,l;return e=new Du({props:{primary:t[1],$$slots:{default:[d0]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function m0(t){let e;const l=t[18].default,n=lo(l,t,t[19],Eo);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&io(n,l,i,i[19],e?no(l,i[19],o,_0):oo(i[19]),Eo)},i(i){e||(X(n,i),e=!0)},o(i){x(n,i),e=!1},d(i){n&&n.d(i)}}}function p0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ol?rn(t[10]):t[4],t[12]];var o=t[0];function a(r,f){let c={};for(let m=0;m{Se(c,1)}),_t()}o?(e=ko(o,a(r,f)),Me(e.$$.fragment),X(e.$$.fragment,1),Ce(e,l.parentNode,l)):e=null}else if(o){const c=f&7192?Ui(i,[f&8&&{location:r[3]},f&2048&&{navigate:r[11]},f&1040&&ui(Ol?rn(r[10]):r[4]),f&4096&&ui(r[12])]):{};e.$set(c)}},i(r){n||(e&&X(e.$$.fragment,r),n=!0)},o(r){e&&x(e.$$.fragment,r),n=!1},d(r){r&&N(l),e&&Se(e,r)}}}function d0(t){let e,l,n,i;const o=[p0,m0],a=[];function r(f,c){return f[0]!==null?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function h0(t){let e,l,n,i,o,a=[zi(t[7]),{"data-svnav-route-start":t[5]}],r={};for(let _=0;_{f=null}),_t())},i(_){o||(X(f),o=!0)},o(_){x(f),o=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const v0=_u();function b0(t,e,l){let n;const i=["path","component","meta","primary"];let o=bi(e,i),a,r,f,c,{$$slots:m={},$$scope:_}=e,{path:d=""}=e,{component:h=null}=e,{meta:g={}}=e,{primary:b=!0}=e;si(Ni,e);const k=v0(),{registerRoute:w,unregisterRoute:E,activeRoute:F,disableInlineStyles:R}=on(Nn);ql(t,F,B=>l(16,a=B));const T=Ou();ql(t,T,B=>l(17,f=B));const L=Au();ql(t,L,B=>l(3,r=B));const O=rl(null);let H;const K=rl(),z=rl({});ql(t,z,B=>l(4,c=B)),$n(hu,K),$n(wr,z),$n(Cr,O);const q=c0();return Ol||cr(()=>E(k)),t.$$set=B=>{l(24,e=Nl(Nl({},e),vi(B))),l(12,o=bi(e,i)),"path"in B&&l(13,d=B.path),"component"in B&&l(0,h=B.component),"meta"in B&&l(14,g=B.meta),"primary"in B&&l(1,b=B.primary),"$$scope"in B&&l(19,_=B.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const B=d==="",Z=oi(f,d),V={id:k,path:d,meta:g,default:B,fullPath:B?"":Z,base:B?f:Wr(Z,r.pathname),primary:b,focusElement:O};K.set(V),l(15,H=w(V))}if(t.$$.dirty&98304&&l(2,n=!!(H||a&&a.id===k)),t.$$.dirty&98308&&n){const{params:B}=H||a;z.set(B)}},e=vi(e),[h,b,n,r,c,k,F,R,T,L,z,q,o,d,g,H,a,f,m,_]}class g0 extends Tt{constructor(e){super(),Pt(this,e,b0,h0,Ct,{path:13,component:0,meta:14,primary:1})}}const Sl=g0;function k0(t){let e,l,n,i;const o=t[13].default,a=lo(o,t,t[12],null);let r=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=O));const F=_r(),R=Iu(),{navigate:T}=Lu();function L(O){F("click",O),br(O)&&(O.preventDefault(),T(n,{state:k,replace:a||b}))}return t.$$set=O=>{l(19,e=Nl(Nl({},e),vi(O))),l(18,m=bi(e,c)),"to"in O&&l(5,g=O.to),"replace"in O&&l(6,b=O.replace),"state"in O&&l(7,k=O.state),"getProps"in O&&l(8,w=O.getProps),"$$scope"in O&&l(12,h=O.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=R(g,_)),t.$$.dirty&2049&&l(10,i=Hi(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=ro(n)===jr(_)),t.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(ru(w)){const O=w({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...O}}return m})())},e=vi(e),[n,f,r,E,L,g,b,k,w,o,i,_,h,d]}class C0 extends Tt{constructor(e){super(),Pt(this,e,w0,k0,Ct,{to:5,replace:6,state:7,getProps:8})}}const wl=C0;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function S0(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Pi(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function ei(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function wi(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Lt(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ze(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function cn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function xt(t,e){return t==1||t==2&&e}function vl(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function tl(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function Sn(t,e){return t.setTime(t.getTime()+e*36e5),t}function M0(t,e){return t.setTime(t.getTime()+e*6e4),t}function N0(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function P0(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let ri=0;function ti(t,e){var l="";ri++;var n=function(){setTimeout(ti,1e3,t,e)};if(t.net.ip&&ri%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&ri%3==1?l="http://"+t.hostname:t.hostname&&ri%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function sl(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ao(t){return t.startsWith("esp32")?"esp32":t}function pl(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function li(t,e){let l=[tl(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=tl(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let _n="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Il="[\\x20-\\x7E]+",Pn="[\\x20-\\xFF]+",Ci="[A-Za-z0-9_\\-]+",Ru="[0-9A-Fa-f]+",Qn="[0-9]+",di={},Wi=[];async function T0(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let Ii;async function Fu(){if(Wi.length){let t=Wi.shift();delete di[t.resource];try{let e=await T0(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}Ii&&clearTimeout(Ii),Ii=setTimeout(Fu,100)}Fu();async function Cl(t,e={}){let l;return di[t]?l=di[t]:(l={resource:t,options:e,callbacks:[]},di[t]=l,Wi.push(l)),new Promise(i=>l.callbacks.push(i))}let Tl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function Ti(){Tl=await(await Cl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),hl.set(Tl)}const hl=rl(Tl,t=>(Ti(),function(){}));function q0(t){hl.update(e=>(e.trying=t,e))}let ci=0,Lo=-127,Oo=null,E0={};const D0=du(E0,t=>{let e,l;async function n(){Cl("data.json").then(i=>i.json()).then(i=>{t(i),Lo!=i.t&&(Lo=i.t,setTimeout(A0,2e3)),i.pe&&i.p!=Oo&&(Oo=i.p,zu()),(!Tl||!Tl.chip||Tl.booting||ci>1&&!cn(Tl.board))&&(Ti(),Al&&clearTimeout(Al),Al=setTimeout(Vi,2e3),Ll&&clearTimeout(Ll),Ll=setTimeout(Yi,3e3)),i.u,Al||(Al=Vi()),Ll||(Ll=Yi());let o=5e3;if(cn(Tl.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(o=Math.max(a,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),e&&clearTimeout(e),e=setTimeout(n,o),ci=0}).catch(i=>{ci++,ci>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(ti,5e3,Tl,q0))):e=setTimeout(n,cn(Tl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let _i,gn={};const Bu=rl(gn);let yi={};const Uu=rl(yi);async function zu(){_i&&(clearTimeout(_i),_i=0),gn=await(await Cl("importprice.json")).json(),Bu.set(gn),gn!=null&&gn.importExportPriceDifferent&&(yi=await(await Cl("exportprice.json")).json(),Uu.set(yi)),_i=setTimeout(zu,(24-new Date().getHours())*36e5+10)}let Gi={},Al;async function Vi(){Al&&(clearTimeout(Al),Al=0),Gi=await(await Cl("dayplot.json")).json(),ju.set(Gi),Al=setTimeout(Vi,(60-new Date().getMinutes())*6e4+20)}const ju=rl(Gi,t=>function(){});let Ki={},Ll;async function Yi(){Ll&&(clearTimeout(Ll),Ll=0),Ki=await(await Cl("monthplot.json")).json(),Hu.set(Ki),Ll=setTimeout(Yi,(24-new Date().getHours())*36e5+40)}const Hu=rl(Ki,t=>function(){});let Qi={};async function A0(){Qi=await(await Cl("temperature.json")).json(),Wu.set(Qi)}const Wu=rl(Qi,t=>function(){});let Xi={},mi;async function yu(){mi&&(clearTimeout(mi),mi=0),Xi=await(await Cl("tariff.json")).json(),Gu.set(Xi),mi=setTimeout(yu,(60-new Date().getMinutes())*6e4+30)}const Gu=rl(Xi,t=>function(){});let kn={c:-1,n:[]};async function L0(){let e=await(await Cl("wifiscan.json",{timeout:3e4})).json(),l=[];kn.c=0,kn.n=[];for(let n=0;n(L0(),function(){}));let Zi=!1;const Pl=rl(Zi);async function Vu(t){Zi=await(await Cl("translations.json"+(t?"?lang="+t:""))).json(),Pl.set(Zi)}Vu();function Io(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Ku(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function Ro(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function o(c,m){return c[2]>1?z0:c[2]>0?U0:c[3]>1?B0:c[3]>0?F0:c[4]>1?R0:c[4]>0?I0:O0}let a=o(t),r=a(t);return{c(){l=M(e),n=v(),r.c(),i=yt()},m(c,m){P(c,l,m),P(c,n,m),r.m(c,m),P(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&D(l,e),a===(a=o(c))&&r?r.p(c,m):(r.d(1),r=a(c),r&&(r.c(),r.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),r.d(c)}}}function O0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.seconds)??"s")+"",i;return{c(){e=M(t[0]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&1&&D(e,a[0]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function I0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minute)??"m")+"",i;return{c(){e=M(t[4]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&D(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function R0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minutes)??"m")+"",i;return{c(){e=M(t[4]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&16&&D(e,a[4]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function F0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hour)??"h")+"",i;return{c(){e=M(t[3]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&D(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function B0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hours)??"h")+"",i;return{c(){e=M(t[3]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&8&&D(e,a[3]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function U0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.day)??"d")+"",i;return{c(){e=M(t[2]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&D(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function z0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.days)??"d")+"",i;return{c(){e=M(t[2]),l=v(),i=M(n)},m(a,r){P(a,e,r),P(a,l,r),P(a,i,r)},p(a,r){var f;r&4&&D(e,a[2]),r&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function j0(t){let e,l=t[0]&&Ro(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ro(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:je,o:je,d(n){n&&N(e),l&&l.d(n)}}}function H0(t,e,l){let{epoch:n}=e,i={};Pl.subscribe(f=>{l(1,i=f)});let o=0,a=0,r=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,o,a,r]}class W0 extends Tt{constructor(e){super(),Pt(this,e,H0,j0,Ct,{epoch:0})}}function y0(t){let e,l,n;return{c(){e=p("span"),l=M(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){P(i,e,o),s(e,l)},p(i,[o]){o&4&&D(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:je,o:je,d(i){i&&N(e)}}}function G0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Tt{constructor(e){super(),Pt(this,e,G0,y0,Ct,{color:0,title:1,text:2})}}function V0(t){let e,l=`${Lt(t[0].getDate())}.${Lt(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Lt(t[0].getHours())}:${Lt(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=M(l),u(e,"class",t[1])},m(i,o){P(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Lt(i[0].getDate())}.${Lt(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Lt(i[0].getHours())}:${Lt(i[0].getMinutes())}`)&&D(n,l),o&2&&u(e,"class",i[1])},d(i){i&&N(e)}}}function K0(t){var n;let e=`${Lt(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:Lt(t[0].getMonth()+1)} ${Lt(t[0].getHours())}:${Lt(t[0].getMinutes())}`,l;return{c(){l=M(e)},m(i,o){P(i,l,o)},p(i,o){var a;o&5&&e!==(e=`${Lt(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:Lt(i[0].getMonth()+1)} ${Lt(i[0].getHours())}:${Lt(i[0].getMinutes())}`)&&D(l,e)},d(i){i&&N(l)}}}function Y0(t){let e;function l(o,a){return o[3]?K0:V0}let n=l(t),i=n(t);return{c(){i.c(),e=yt()},m(o,a){i.m(o,a),P(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:je,o:je,d(o){o&&N(e),i.d(o)}}}function Q0(t,e,l){let n={};Pl.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:o}=e,{offset:a}=e,r;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,o=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||Sn(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,r,a]}class Yu extends Tt{constructor(e){super(),Pt(this,e,Q0,Y0,Ct,{timestamp:0,fullTimeColor:1,offset:4})}}function X0(t){let e,l,n;return{c(){e=Ut("svg"),l=Ut("path"),n=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){P(i,e,o),s(e,l),s(e,n)},p:je,i:je,o:je,d(i){i&&N(e)}}}class Z0 extends Tt{constructor(e){super(),Pt(this,e,null,X0,Ct,{})}}function J0(t){let e,l;return{c(){e=Ut("svg"),l=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),s(e,l)},p:je,i:je,o:je,d(n){n&&N(e)}}}class $0 extends Tt{constructor(e){super(),Pt(this,e,null,J0,Ct,{})}}function x0(t){let e,l;return{c(){e=Ut("svg"),l=Ut("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){P(n,e,i),s(e,l)},p:je,i:je,o:je,d(n){n&&N(e)}}}class e1 extends Tt{constructor(e){super(),Pt(this,e,null,x0,Ct,{})}}function t1(t){let e,l,n=t[2].version+"",i;return{c(){e=M("AMS reader "),l=p("span"),i=M(n)},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&4&&n!==(n=o[2].version+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function Fo(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=M(l),i=M("°C"),u(e,"class","flex-none my-auto")},m(o,a){P(o,e,a),s(e,n),s(e,i)},p(o,a){a&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&D(n,l)},d(o){o&&N(e)}}}function Bo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(o=t[4].errors)==null?void 0:o.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=r[4].errors)==null?void 0:m.han)==null?void 0:_[r[1].he])??r[1].he))&&D(n,l)},d(r){r&&N(e)}}}function Uo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(o=t[4].errors)==null?void 0:o.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=r[4].errors)==null?void 0:m.mqtt)==null?void 0:_[r[1].me])??r[1].me))&&D(n,l)},d(r){r&&N(e)}}}function zo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(o=t[4].errors)==null?void 0:o.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(r,f){P(r,e,f),s(e,n)},p(r,f){var c,m,_;f&18&&l!==(l=(((c=r[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=r[4].errors)==null?void 0:m.price)==null?void 0:_[r[1].ee])??r[1].ee))&&D(n,l)},d(r){r&&N(e)}}}function jo(t){let e,l,n,i,o,a,r,f;return l=new wl({props:{to:"/configuration",$$slots:{default:[l1]},$$scope:{ctx:t}}}),a=new wl({props:{to:"/status",$$slots:{default:[n1]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Me(l.$$.fragment),i=v(),o=p("div"),Me(a.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),u(o,"class","flex-none px-1 mt-1"),u(o,"title",r=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){P(c,e,m),Ce(l,e,null),P(c,i,m),P(c,o,m),Ce(a,o,null),f=!0},p(c,m){var h,g;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((h=c[4].header)==null?void 0:h.config)??""))&&u(e,"title",n);const d={};m&64&&(d.$$scope={dirty:m,ctx:c}),a.$set(d),(!f||m&16&&r!==(r=((g=c[4].header)==null?void 0:g.status)??""))&&u(o,"title",r)},i(c){f||(X(l.$$.fragment,c),X(a.$$.fragment,c),f=!0)},o(c){x(l.$$.fragment,c),x(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(o)),Se(l),Se(a)}}}function l1(t){let e,l;return e=new Z0({}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function n1(t){let e,l;return e=new $0({}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function i1(t){let e,l;function n(a,r){return a[2].security==0||a[1].a?a1:s1}let i=n(t),o=i(t);return{c(){var a;e=p("div"),o.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,r){P(a,e,r),o.m(e,null)},p(a,r){var f;i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null))),r&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&u(e,"title",l)},d(a){a&&N(e),o.d()}}}function o1(t){let e,l,n=t[2].upgrade.t+"",i,o,a=t[3].toFixed(1)+"",r,f;return{c(){e=p("div"),l=M("Upgrading to "),i=M(n),o=M(", "),r=M(a),f=M("%"),u(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){P(c,e,m),s(e,l),s(e,i),s(e,o),s(e,r),s(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&D(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&D(r,a)},d(c){c&&N(e)}}}function s1(t){var r;let e,l=(((r=t[4].header)==null?void 0:r.new_version)??"New version")+"",n,i,o=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=M(l),i=M(": "),a=M(o)},m(f,c){P(f,e,c),s(e,n),s(e,i),s(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&D(n,l),c&4&&o!==(o=f[2].upgrade.n+"")&&D(a,o)},d(f){f&&N(e)}}}function a1(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,o,a=t[2].upgrade.n+"",r,f,c;return{c(){e=p("button"),l=p("span"),i=M(n),o=M(": "),r=M(a),u(l,"class","mt-1"),u(e,"class","flex")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(l,o),s(l,r),f||(c=ce(e,"click",t[5]),f=!0)},p(_,d){var h;d&16&&n!==(n=(((h=_[4].header)==null?void 0:h.new_version)??"New version")+"")&&D(i,n),d&4&&a!==(a=_[2].upgrade.n+"")&&D(r,a)},d(_){_&&N(e),f=!1,c()}}}function f1(t){var be,ke;let e,l,n,i,o,a,r,f,c,m,_,d=(((be=t[4].header)==null?void 0:be.mem)??"Free")+"",h,g,b=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",k,w,E,F,R,T,L,O,H,K,z,q,B,Z,V,Y,G,U,W,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe;i=new wl({props:{to:"/",$$slots:{default:[t1]},$$scope:{ctx:t}}}),f=new W0({props:{epoch:t[1].u}});let we=t[1].t>-50&&Fo(t);R=new fn({props:{title:"ESP",text:t[2].booting?((ke=t[4].header)==null?void 0:ke.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),L=new fn({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),H=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),z=new fn({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let S=(t[1].he<0||t[1].he>0)&&Bo(t),C=t[1].me<0&&Uo(t),I=(t[1].ee>0||t[1].ee<0)&&zo(t);ie=new Yu({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let A=t[2].vndcfg&&t[2].usrcfg&&jo(t);oe=new e1({});function y(J,ve){if(J[2].upgrading)return o1;if(J[2].fwconsent===1&&J[2].upgrade.n)return i1}let te=y(t),ue=te&&te(t);return{c(){var J;e=p("nav"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),r=p("div"),Me(f.$$.fragment),c=v(),we&&we.c(),m=v(),_=p("div"),h=M(d),g=M(": "),k=M(b),w=M("kb"),E=v(),F=p("div"),Me(R.$$.fragment),T=v(),Me(L.$$.fragment),O=v(),Me(H.$$.fragment),K=v(),Me(z.$$.fragment),q=v(),S&&S.c(),B=v(),C&&C.c(),Z=v(),I&&I.c(),V=v(),Y=p("div"),G=p("div"),U=p("a"),W=p("img"),ee=v(),Q=p("div"),Me(ie.$$.fragment),re=v(),A&&A.c(),fe=v(),le=p("div"),de=p("a"),Me(oe.$$.fragment),se=v(),ue&&ue.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(a,"class","flex-none my-auto p-2 flex space-x-4"),u(F,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(W,"class","logo"),hi(W.src,ne=(t[0]+"/logo.svg").replace("//","/"))||u(W,"src",ne),u(W,"alt","GitHub repo"),u(U,"class","float-right"),u(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(U,"target","_blank"),u(U,"rel","noreferrer"),u(U,"aria-label","GitHub"),u(G,"class","flex-none"),u(Q,"class","flex-none my-auto px-2"),u(de,"href",vl("")),u(de,"target","_blank"),u(de,"rel","noreferrer"),u(le,"class","flex-none px-1 mt-1"),u(le,"title",me=((J=t[4].header)==null?void 0:J.doc)??""),u(Y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","hdr")},m(J,ve){P(J,e,ve),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,r),Ce(f,r,null),s(a,c),we&&we.m(a,null),s(a,m),s(a,_),s(_,h),s(_,g),s(_,k),s(_,w),s(l,E),s(l,F),Ce(R,F,null),s(F,T),Ce(L,F,null),s(F,O),Ce(H,F,null),s(F,K),Ce(z,F,null),s(l,q),S&&S.m(l,null),s(l,B),C&&C.m(l,null),s(l,Z),I&&I.m(l,null),s(l,V),s(l,Y),s(Y,G),s(G,U),s(U,W),s(Y,ee),s(Y,Q),Ce(ie,Q,null),s(Y,re),A&&A.m(Y,null),s(Y,fe),s(Y,le),s(le,de),Ce(oe,de,null),s(Y,se),ue&&ue.m(Y,null),pe=!0},p(J,[ve]){var Re,$e,xe;const ge={};ve&68&&(ge.$$scope={dirty:ve,ctx:J}),i.$set(ge);const qe={};ve&2&&(qe.epoch=J[1].u),f.$set(qe),J[1].t>-50?we?we.p(J,ve):(we=Fo(J),we.c(),we.m(a,m)):we&&(we.d(1),we=null),(!pe||ve&16)&&d!==(d=(((Re=J[4].header)==null?void 0:Re.mem)??"Free")+"")&&D(h,d),(!pe||ve&2)&&b!==(b=(J[1].m?(J[1].m/1e3).toFixed(1):"-")+"")&&D(k,b);const Pe={};ve&22&&(Pe.text=J[2].booting?(($e=J[4].header)==null?void 0:$e.booting)??"Booting":J[1].v>2?J[1].v.toFixed(2)+"V":"ESP"),ve&6&&(Pe.color=ln(J[2].booting?2:J[1].em)),R.$set(Pe);const Ae={};ve&6&&(Ae.color=ln(J[2].booting?9:J[1].hm)),L.$set(Ae);const Le={};ve&2&&(Le.text=J[1].r?J[1].r.toFixed(0)+"dBm":"WiFi"),ve&6&&(Le.color=ln(J[2].booting?9:J[1].wm)),H.$set(Le);const Ne={};ve&6&&(Ne.color=ln(J[2].booting?9:J[1].mm)),z.$set(Ne),J[1].he<0||J[1].he>0?S?S.p(J,ve):(S=Bo(J),S.c(),S.m(l,B)):S&&(S.d(1),S=null),J[1].me<0?C?C.p(J,ve):(C=Uo(J),C.c(),C.m(l,Z)):C&&(C.d(1),C=null),J[1].ee>0||J[1].ee<0?I?I.p(J,ve):(I=zo(J),I.c(),I.m(l,V)):I&&(I.d(1),I=null),(!pe||ve&1&&!hi(W.src,ne=(J[0]+"/logo.svg").replace("//","/")))&&u(W,"src",ne);const De={};ve&2&&(De.timestamp=J[1].c?new Date(J[1].c*1e3):new Date(0)),ve&4&&(De.offset=J[2].clock_offset),ie.$set(De),J[2].vndcfg&&J[2].usrcfg?A?(A.p(J,ve),ve&4&&X(A,1)):(A=jo(J),A.c(),X(A,1),A.m(Y,fe)):A&&(ct(),x(A,1,1,()=>{A=null}),_t()),(!pe||ve&16&&me!==(me=((xe=J[4].header)==null?void 0:xe.doc)??""))&&u(le,"title",me),te===(te=y(J))&&ue?ue.p(J,ve):(ue&&ue.d(1),ue=te&&te(J),ue&&(ue.c(),ue.m(Y,null)))},i(J){pe||(X(i.$$.fragment,J),X(f.$$.fragment,J),X(R.$$.fragment,J),X(L.$$.fragment,J),X(H.$$.fragment,J),X(z.$$.fragment,J),X(ie.$$.fragment,J),X(A),X(oe.$$.fragment,J),pe=!0)},o(J){x(i.$$.fragment,J),x(f.$$.fragment,J),x(R.$$.fragment,J),x(L.$$.fragment,J),x(H.$$.fragment,J),x(z.$$.fragment,J),x(ie.$$.fragment,J),x(A),x(oe.$$.fragment,J),pe=!1},d(J){J&&N(e),Se(i),Se(f),we&&we.d(),Se(R),Se(L),Se(H),Se(z),S&&S.d(),C&&C.d(),I&&I.d(),Se(ie),A&&A.d(),Se(oe),ue&&ue.d()}}}function u1(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",o.upgrade.n))&&(Ku(o.upgrade.n),hl.update(m=>(m.upgrade.t=o.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let r;hl.subscribe(c=>{l(2,o=c)});let f={};return Pl.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,r=Math.max(0,o.upgrade.p))},[n,i,o,r,f,a]}class r1 extends Tt{constructor(e){super(),Pt(this,e,u1,f1,Ct,{basepath:0,data:1})}}function c1(t){let e,l,n,i;return{c(){e=Ut("svg"),l=Ut("path"),n=Ut("path"),u(l,"d",Ri(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Ri(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,a){P(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Ri(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),a&2&&u(n,"stroke",o[1])},i:je,o:je,d(o){o&&N(e)}}}function Ho(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Ri(t,e,l,n,i){var o=Ho(t,e,l,i),a=Ho(t,e,l,n),r=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,r,0,a.x,a.y].join(" ");return f}function _1(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class m1 extends Tt{constructor(e){super(),Pt(this,e,_1,c1,Ct,{pct:0,color:1})}}function Wo(t){let e,l,n,i=t[1][0]+"",o,a,r,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=v(),n=p("span"),o=M(i),a=v(),r=p("span"),c=M(f),m=M("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(_,d){P(_,e,d),P(_,l,d),P(_,n,d),s(n,o),P(_,a,d),P(_,r,d),s(r,c),s(r,m)},p(_,d){d&2&&i!==(i=_[1][0]+"")&&D(o,i),d&2&&f!==(f=_[1][1]+"")&&D(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(r))}}}function p1(t){let e,l,n,i,o,a,r,f,c,m,_=t[3][0]+"",d,h,g,b=t[3][1]+"",k,w,E;l=new m1({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let F=t[1]&&Wo(t);return{c(){e=p("div"),Me(l.$$.fragment),n=v(),i=p("span"),o=p("span"),a=M(t[0]),r=v(),f=p("br"),c=v(),m=p("span"),d=M(_),h=v(),g=p("span"),k=M(b),w=v(),F&&F.c(),u(o,"class","pl-lab"),u(m,"class","pl-val"),u(g,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(R,T){P(R,e,T),Ce(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,r),s(i,f),s(i,c),s(i,m),s(m,d),s(i,h),s(i,g),s(g,k),s(i,w),F&&F.m(i,null),E=!0},p(R,[T]){const L={};T&16&&(L.pct=R[4]),T&20&&(L.color=R[2](R[4],document.documentElement.classList.contains("dark"))),l.$set(L),(!E||T&1)&&D(a,R[0]),(!E||T&8)&&_!==(_=R[3][0]+"")&&D(d,_),(!E||T&8)&&b!==(b=R[3][1]+"")&&D(k,b),R[1]?F?F.p(R,T):(F=Wo(R),F.c(),F.m(i,null)):F&&(F.d(1),F=null)},i(R){E||(X(l.$$.fragment,R),E=!0)},o(R){x(l.$$.fragment,R),E=!1},d(R){R&&N(e),Se(l),F&&F.d()}}}function d1(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:r=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,o=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,r=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=pl(n,o)),l(4,m=Math.min(n,i)/i*100))},[a,r,f,c,m,n,i,o]}class Qu extends Tt{constructor(e){super(),Pt(this,e,d1,p1,Ct,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function h1(t){let e,l,n;return{c(){e=p("div"),l=M(t[0]),u(e,"class","tooltip"),Ml(e,"top",t[2]-t[4]-10+"px"),Ml(e,"left",t[1]-t[3]/2+"px"),Nt(()=>t[5].call(e))},m(i,o){P(i,e,o),s(e,l),n=Mi(e,t[5].bind(e))},p(i,[o]){o&1&&D(l,i[0]),o&20&&Ml(e,"top",i[2]-i[4]-10+"px"),o&10&&Ml(e,"left",i[1]-i[3]/2+"px")},i:je,o:je,d(i){i&&N(e),n()}}}function v1(t,e,l){let{title:n}=e,{x:i}=e,{y:o}=e,a,r;function f(){r=this.clientHeight,a=this.clientWidth,l(4,r),l(3,a)}return t.$$set=c=>{"title"in c&&l(0,n=c.title),"x"in c&&l(1,i=c.x),"y"in c&&l(2,o=c.y)},[n,i,o,a,r,f]}class b1 extends Tt{constructor(e){super(),Pt(this,e,v1,h1,Ct,{title:0,x:1,y:2})}}function g1(t){let e,l;function n(o){l&&l.$destroy(),e=t.dataset.title||t.getAttribute("title");var a=t.getBoundingClientRect();l=new b1({props:{title:e,x:a.left+window.scrollX+a.width/2,y:a.top+window.scrollY},target:document.body})}function i(){l&&setTimeout(()=>{l.$destroy(),l=null},500)}return t.addEventListener("click",n),t.addEventListener("mouseleave",i),{destroy(){t.removeEventListener("click",n),t.removeEventListener("mouseleave",i)}}}function yo(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Go(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Vo(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ko(t){let e,l,n,i,o,a,r,f=(t[0].title||t[0].link)&&Yo(t),c=ft(t[0].y.ticks),m=[];for(let b=0;b{f=null}),_t()),k&129){c=ft(b[0].y.ticks);let w;for(w=0;w{o=null}),_t())},i(a){n||(X(o),n=!0)},o(a){x(o),n=!1},d(a){a&&N(e),i&&i.d(),o&&o.d()}}}function Qo(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=M(l),u(e,"class","text-sm font-bold"),Nt(()=>t[9].call(e))},m(o,a){P(o,e,a),s(e,n),i=Mi(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&D(n,l)},d(o){o&&N(e),i()}}}function Xo(t){let e,l,n,i;const o=[w1,k1],a=[];function r(f,c){return f[0].link.route?0:1}return l=r(t),n=a[l]=o[l](t),{c(){e=p("div"),n.c(),u(e,"class","text-xs text-right")},m(f,c){P(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=r(f),l===m?a[l].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),n=a[l],n?n.p(f,c):(n=a[l]=o[l](f),n.c()),X(n,1),n.m(e,null))},i(f){i||(X(n),i=!0)},o(f){x(n),i=!1},d(f){f&&N(e),a[l].d()}}}function k1(t){let e,l=t[0].link.text+"",n,i,o;return{c(){e=p("a"),n=M(l),u(e,"href",i=t[0].link.url),u(e,"target",o=t[0].link.target)},m(a,r){P(a,e,r),s(e,n)},p(a,r){r&1&&l!==(l=a[0].link.text+"")&&D(n,l),r&1&&i!==(i=a[0].link.url)&&u(e,"href",i),r&1&&o!==(o=a[0].link.target)&&u(e,"target",o)},i:je,o:je,d(a){a&&N(e)}}}function w1(t){let e,l;return e=new wl({props:{to:t[0].link.url,$$slots:{default:[C1]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.to=n[0].link.url),i&262145&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function C1(t){let e=t[0].link.text+"",l;return{c(){l=M(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&D(l,e)},d(n){n&&N(l)}}}function Zo(t){let e,l,n,i=t[15].label+"",o,a,r,f;return{c(){e=Ut("g"),l=Ut("line"),n=Ut("text"),o=M(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",a=t[15].align=="right"?"90%":""),u(e,"class",r="tick tick-"+t[15].value+" tick-"+t[15].color),u(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){P(c,e,m),s(e,l),s(e,n),s(n,o)},p(c,m){m&1&&i!==(i=c[15].label+"")&&D(o,i),m&1&&a!==(a=c[15].align=="right"?"90%":"")&&u(n,"x",a),m&1&&r!==(r="tick tick-"+c[15].value+" tick-"+c[15].color)&&u(e,"class",r),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&u(e,"transform",f)},d(c){c&&N(e)}}}function Jo(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Zo(t);return{c(){n&&n.c(),l=yt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=Zo(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function $o(t){let e,l,n=(t[3]>20||t[13]%2==0)&&xo(t);return{c(){e=Ut("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){P(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=xo(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function xo(t){let e,l=t[11].label+"",n,i;return{c(){e=Ut("text"),n=M(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,a){P(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&D(n,l),a&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&N(e)}}}function es(t){let e=!isNaN(t[6](t[13])),l,n=e&&$o(t);return{c(){n&&n.c(),l=yt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=$o(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function ts(t){let e,l,n,i,o,a=t[11].value!==void 0&&ls(t),r=t[11].value2>1e-4&&is(t);return{c(){e=Ut("g"),a&&a.c(),n=Ut("g"),r&&r.c(),u(e,"data-title",l=t[11].title)},m(f,c){P(f,e,c),a&&a.m(e,null),P(f,n,c),r&&r.m(n,null),i||(o=nr(g1.call(null,e)),i=!0)},p(f,c){f[11].value!==void 0?a?a.p(f,c):(a=ls(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null),c&1&&l!==(l=f[11].title)&&u(e,"data-title",l),f[11].value2>1e-4?r?r.p(f,c):(r=is(f),r.c(),r.m(n,null)):r&&(r.d(1),r=null)},d(f){f&&(N(e),N(n)),a&&a.d(),r&&r.d(),i=!1,o()}}}function ls(t){let e,l,n,i,o,a,r,f=t[3]>15&&ns(t);return{c(){e=Ut("rect"),f&&f.c(),r=yt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](t[11].value)),u(e,"width",i=t[3]*.95),u(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),u(e,"fill",a=t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&u(e,"y",n),m&8&&i!==(i=c[3]*.95)&&u(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&u(e,"height",o),m&1&&a!==(a=c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=ns(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function ns(t){let e,l=t[11].label+"",n,i,o,a,r;return{c(){e=Ut("text"),n=M(l),u(e,"width",i=t[3]*.95),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),u(e,"transform",r="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]f[7](0)-f[8]&&!f[0].dark?f[11].color:"white")&&u(e,"fill",a),c&457&&r!==(r="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](f[11].value)>f[7](0)-f[8]?f[7](f[11].value)-f[8]:f[7](f[11].value)+10)+") rotate("+(f[11].labelAngle?f[11].labelAngle:f[3]15&&os(t);return{c(){e=Ut("rect"),f&&f.c(),r=yt(),u(e,"x",l=t[6](t[13])+2),u(e,"y",n=t[7](0)),u(e,"width",i=t[3]*.95),u(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),u(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){P(c,e,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&u(e,"x",l),m&128&&n!==(n=c[7](0))&&u(e,"y",n),m&8&&i!==(i=c[3]*.95)&&u(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&u(e,"height",o),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&u(e,"fill",a),c[3]>15?f?f.p(c,m):(f=os(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(r)),f&&f.d(c)}}}function os(t){let e,l=t[11].label2+"",n,i,o,a,r,f=t[11].title2&&ss(t);return{c(){e=Ut("text"),n=M(l),f&&f.c(),r=yt(),u(e,"width",i=t[3]*.95),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(o,a){P(o,e,a),i&&i.m(e,null),l=Mi(e,t[10].bind(e)),n=!0},p(o,[a]){o[0].x.ticks&&o[0].points&&o[4]?i?(i.p(o,a),a&17&&X(i,1)):(i=Ko(o),i.c(),X(i,1),i.m(e,null)):i&&(ct(),x(i,1,1,()=>{i=null}),_t())},i(o){n||(X(i),n=!0)},o(o){x(i),n=!1},d(o){o&&N(e),i&&i.d(),l()}}}let un=30;function M1(t,e,l){let{config:n}=e,i,o,a,r,f,c,m,_=0;function d(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=g=>{"config"in g&&l(0,n=g.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=o-_);let g=i-(n.padding.left+n.padding.right);l(3,a=g/n.points.length),l(8,m=an.y.max?w=n.padding.bottom:kc||w<0?0:w})}},[n,i,o,a,c,_,r,f,m,d,h]}class dn extends Tt{constructor(e){super(),Pt(this,e,M1,S1,Ct,{config:0})}}function N1(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function P1(t,e,l){let{title:n}=e,{u1:i}=e,{u2:o}=e,{u3:a}=e,{ds:r}=e,f={};function c(m){return{label:tl(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:S0(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,o=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,r=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:r===1?"L1-L2":"L1"}),_.push(c(i))),o>0&&(m.push({label:r===1?"L1-L3":"L2"}),_.push(c(o))),a>0&&(m.push({label:r===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:m},points:_})}},[f,n,i,o,a,r]}class T1 extends Tt{constructor(e){super(),Pt(this,e,P1,N1,Ct,{title:1,u1:2,u2:3,u3:4,ds:5})}}function q1(t){var A,y,te,ue,be;let e,l,n=(((A=t[0].reactive)==null?void 0:A.title)??"Reactive")+"",i,o,a,r,f=(((y=t[0].reactive)==null?void 0:y.instant_in)??"Instant in")+"",c,m,_,d=t[1][0]+"",h,g,b=t[1][1]+"",k,w,E,F=(((te=t[0].reactive)==null?void 0:te.instant_out)??"Instant out")+"",R,T,L,O=t[2][0]+"",H,K,z=t[2][1]+"",q,B,Z,V,Y=(((ue=t[0].reactive)==null?void 0:ue.total_in)??"Total in")+"",G,U,W,ne=t[3][0]+"",ee,Q,ie=t[3][1]+"",re,fe,le,de=(((be=t[0].reactive)==null?void 0:be.total_out)??"Total out")+"",oe,me,se,pe=t[4][0]+"",we,S,C=t[4][1]+"",I;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),r=p("div"),c=M(f),m=v(),_=p("div"),h=M(d),g=v(),k=M(b),w=v(),E=p("div"),R=M(F),T=v(),L=p("div"),H=M(O),K=v(),q=M(z),B=v(),Z=p("div"),V=p("div"),G=M(Y),U=v(),W=p("div"),ee=M(ne),Q=v(),re=M(ie),fe=v(),le=p("div"),oe=M(de),me=v(),se=p("div"),we=M(pe),S=v(),I=M(C),u(_,"class","text-right"),u(L,"class","text-right"),u(a,"class","grid grid-cols-2 mt-4"),u(W,"class","text-right"),u(se,"class","text-right"),u(Z,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(ke,J){P(ke,e,J),s(e,l),s(l,i),s(e,o),s(e,a),s(a,r),s(r,c),s(a,m),s(a,_),s(_,h),s(_,g),s(_,k),s(a,w),s(a,E),s(E,R),s(a,T),s(a,L),s(L,H),s(L,K),s(L,q),s(e,B),s(e,Z),s(Z,V),s(V,G),s(Z,U),s(Z,W),s(W,ee),s(W,Q),s(W,re),s(Z,fe),s(Z,le),s(le,oe),s(Z,me),s(Z,se),s(se,we),s(se,S),s(se,I)},p(ke,[J]){var ve,ge,qe,Pe,Ae;J&1&&n!==(n=(((ve=ke[0].reactive)==null?void 0:ve.title)??"Reactive")+"")&&D(i,n),J&1&&f!==(f=(((ge=ke[0].reactive)==null?void 0:ge.instant_in)??"Instant in")+"")&&D(c,f),J&2&&d!==(d=ke[1][0]+"")&&D(h,d),J&2&&b!==(b=ke[1][1]+"")&&D(k,b),J&1&&F!==(F=(((qe=ke[0].reactive)==null?void 0:qe.instant_out)??"Instant out")+"")&&D(R,F),J&4&&O!==(O=ke[2][0]+"")&&D(H,O),J&4&&z!==(z=ke[2][1]+"")&&D(q,z),J&1&&Y!==(Y=(((Pe=ke[0].reactive)==null?void 0:Pe.total_in)??"Total in")+"")&&D(G,Y),J&8&&ne!==(ne=ke[3][0]+"")&&D(ee,ne),J&8&&ie!==(ie=ke[3][1]+"")&&D(re,ie),J&1&&de!==(de=(((Ae=ke[0].reactive)==null?void 0:Ae.total_out)??"Total out")+"")&&D(oe,de),J&16&&pe!==(pe=ke[4][0]+"")&&D(we,pe),J&16&&C!==(C=ke[4][1]+"")&&D(I,C)},i:je,o:je,d(ke){ke&&N(e)}}}function E1(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e,{translations:r={}}=e,f,c,m,_;return t.$$set=d=>{"importInstant"in d&&l(5,n=d.importInstant),"exportInstant"in d&&l(6,i=d.exportInstant),"importTotal"in d&&l(7,o=d.importTotal),"exportTotal"in d&&l(8,a=d.exportTotal),"translations"in d&&l(0,r=d.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=pl(n,"VAr")),l(2,c=pl(i,"VAr")),l(3,m=pl(o*1e3,"VArh")),l(4,_=pl(a*1e3,"VArh")))},[r,f,c,m,_,n,i,o,a]}class D1 extends Tt{constructor(e){super(),Pt(this,e,E1,q1,Ct,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function fs(t){let e;function l(o,a){return o[3]?L1:A1}let n=l(t),i=n(t);return{c(){i.c(),e=yt()},m(o,a){i.m(o,a),P(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&N(e),i.d(o)}}}function A1(t){var y,te,ue,be,ke;let e,l=(((y=t[4].realtime)==null?void 0:y.consumption)??"Consumption")+"",n,i,o,a,r=sl(((te=t[4].common)==null?void 0:te.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,g=t[6][1]+"",b,k,w,E=sl(((ue=t[4].common)==null?void 0:ue.day)??"Day")+"",F,R,T,L=t[7][0]+"",O,H,K=t[7][1]+"",z,q,B,Z=sl(((be=t[4].common)==null?void 0:be.month)??"Month")+"",V,Y,G,U=t[8][0]+"",W,ne,ee=t[8][1]+"",Q,ie,re,fe=(((ke=t[4].realtime)==null?void 0:ke.last_month)??"Last month")+"",le,de,oe,me=t[9][0]+"",se,pe,we=t[9][1]+"",S,C,I,A=t[5]&&us(t);return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),k=v(),w=p("div"),F=M(E),R=v(),T=p("div"),O=M(L),H=v(),z=M(K),q=v(),B=p("div"),V=M(Z),Y=v(),G=p("div"),W=M(U),ne=v(),Q=M(ee),ie=v(),re=p("div"),le=M(fe),de=v(),oe=p("div"),se=M(me),pe=v(),S=M(we),C=v(),A&&A.c(),I=yt(),u(m,"class","text-right"),u(T,"class","text-right"),u(G,"class","text-right"),u(oe,"class","text-right"),u(o,"class","grid grid-cols-2 mb-3")},m(J,ve){P(J,e,ve),s(e,n),P(J,i,ve),P(J,o,ve),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,b),s(o,k),s(o,w),s(w,F),s(o,R),s(o,T),s(T,O),s(T,H),s(T,z),s(o,q),s(o,B),s(B,V),s(o,Y),s(o,G),s(G,W),s(G,ne),s(G,Q),s(o,ie),s(o,re),s(re,le),s(o,de),s(o,oe),s(oe,se),s(oe,pe),s(oe,S),P(J,C,ve),A&&A.m(J,ve),P(J,I,ve)},p(J,ve){var ge,qe,Pe,Ae,Le;ve&16&&l!==(l=(((ge=J[4].realtime)==null?void 0:ge.consumption)??"Consumption")+"")&&D(n,l),ve&16&&r!==(r=sl(((qe=J[4].common)==null?void 0:qe.hour)??"Hour")+"")&&D(f,r),ve&64&&_!==(_=J[6][0]+"")&&D(d,_),ve&64&&g!==(g=J[6][1]+"")&&D(b,g),ve&16&&E!==(E=sl(((Pe=J[4].common)==null?void 0:Pe.day)??"Day")+"")&&D(F,E),ve&128&&L!==(L=J[7][0]+"")&&D(O,L),ve&128&&K!==(K=J[7][1]+"")&&D(z,K),ve&16&&Z!==(Z=sl(((Ae=J[4].common)==null?void 0:Ae.month)??"Month")+"")&&D(V,Z),ve&256&&U!==(U=J[8][0]+"")&&D(W,U),ve&256&&ee!==(ee=J[8][1]+"")&&D(Q,ee),ve&16&&fe!==(fe=(((Le=J[4].realtime)==null?void 0:Le.last_month)??"Last month")+"")&&D(le,fe),ve&512&&me!==(me=J[9][0]+"")&&D(se,me),ve&512&&we!==(we=J[9][1]+"")&&D(S,we),J[5]?A?A.p(J,ve):(A=us(J),A.c(),A.m(I.parentNode,I)):A&&(A.d(1),A=null)},d(J){J&&(N(e),N(i),N(o),N(C),N(I)),A&&A.d(J)}}}function L1(t){var Ie,We,Vt,Kt,wt,cl,ol,Ht,Wt,ul;let e,l=(((Ie=t[4].common)==null?void 0:Ie.import)??"Import")+"",n,i,o,a,r=sl(((We=t[4].common)==null?void 0:We.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",d,h,g=t[6][1]+"",b,k,w,E,F=sl(((Vt=t[4].common)==null?void 0:Vt.day)??"Day")+"",R,T,L,O=t[7][0]+"",H,K,z=t[7][1]+"",q,B,Z,V,Y=sl(((Kt=t[4].common)==null?void 0:Kt.month)??"Month")+"",G,U,W,ne=t[8][0]+"",ee,Q,ie=t[8][1]+"",re,fe,le,de,oe=(((wt=t[4].realtime)==null?void 0:wt.last_mo)??"Last mo.")+"",me,se,pe,we=t[9][0]+"",S,C,I=t[9][1]+"",A,y,te,ue,be,ke=(((cl=t[4].common)==null?void 0:cl.export)??"Export")+"",J,ve,ge,qe,Pe=sl(((ol=t[4].common)==null?void 0:ol.hour)??"Hour")+"",Ae,Le,Ne,De=t[10][0]+"",Re,$e,xe=t[10][1]+"",ut,St,dt,rt,ot=sl(((Ht=t[4].common)==null?void 0:Ht.day)??"Day")+"",ht,Ot,Je,Fe=t[11][0]+"",He,tt,Ge=t[11][1]+"",Ve,Qe,_e,ae,Te=sl(((Wt=t[4].common)==null?void 0:Wt.month)??"Month")+"",Ke,Et,vt,Xe=t[12][0]+"",qt,at,mt=t[12][1]+"",lt,Bt,el,pt,nt=(((ul=t[4].realtime)==null?void 0:ul.last_mo)??"Last mo.")+"",Qt,Jt,It,Zt=t[13][0]+"",$t,Gt,Xt=t[13][1]+"",ll,Ye,st,Mt=t[5]&&rs(t),Rt=t[5]&&cs(t),kt=t[5]&&_s(t),gt=t[5]&&ms(t),jt=t[5]&&ps(t),et=t[5]&&ds(t),Ft=t[5]&&hs(t),he=t[5]&&vs(t);return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),k=v(),Mt&&Mt.c(),w=v(),E=p("div"),R=M(F),T=v(),L=p("div"),H=M(O),K=v(),q=M(z),B=v(),Rt&&Rt.c(),Z=v(),V=p("div"),G=M(Y),U=v(),W=p("div"),ee=M(ne),Q=v(),re=M(ie),fe=v(),kt&&kt.c(),le=v(),de=p("div"),me=M(oe),se=v(),pe=p("div"),S=M(we),C=v(),A=M(I),y=v(),gt&>.c(),ue=v(),be=p("strong"),J=M(ke),ve=v(),ge=p("div"),qe=p("div"),Ae=M(Pe),Le=v(),Ne=p("div"),Re=M(De),$e=v(),ut=M(xe),St=v(),jt&&jt.c(),dt=v(),rt=p("div"),ht=M(ot),Ot=v(),Je=p("div"),He=M(Fe),tt=v(),Ve=M(Ge),Qe=v(),et&&et.c(),_e=v(),ae=p("div"),Ke=M(Te),Et=v(),vt=p("div"),qt=M(Xe),at=v(),lt=M(mt),Bt=v(),Ft&&Ft.c(),el=v(),pt=p("div"),Qt=M(nt),Jt=v(),It=p("div"),$t=M(Zt),Gt=v(),ll=M(Xt),Ye=v(),he&&he.c(),u(m,"class","text-right"),u(L,"class","text-right"),u(W,"class","text-right"),u(pe,"class","text-right"),u(o,"class",te="grid grid-cols-"+t[14]+" mb-3"),u(Ne,"class","text-right"),u(Je,"class","text-right"),u(vt,"class","text-right"),u(It,"class","text-right"),u(ge,"class",st="grid grid-cols-"+t[14])},m(Ee,$){P(Ee,e,$),s(e,n),P(Ee,i,$),P(Ee,o,$),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,b),s(o,k),Mt&&Mt.m(o,null),s(o,w),s(o,E),s(E,R),s(o,T),s(o,L),s(L,H),s(L,K),s(L,q),s(o,B),Rt&&Rt.m(o,null),s(o,Z),s(o,V),s(V,G),s(o,U),s(o,W),s(W,ee),s(W,Q),s(W,re),s(o,fe),kt&&kt.m(o,null),s(o,le),s(o,de),s(de,me),s(o,se),s(o,pe),s(pe,S),s(pe,C),s(pe,A),s(o,y),gt&>.m(o,null),P(Ee,ue,$),P(Ee,be,$),s(be,J),P(Ee,ve,$),P(Ee,ge,$),s(ge,qe),s(qe,Ae),s(ge,Le),s(ge,Ne),s(Ne,Re),s(Ne,$e),s(Ne,ut),s(ge,St),jt&&jt.m(ge,null),s(ge,dt),s(ge,rt),s(rt,ht),s(ge,Ot),s(ge,Je),s(Je,He),s(Je,tt),s(Je,Ve),s(ge,Qe),et&&et.m(ge,null),s(ge,_e),s(ge,ae),s(ae,Ke),s(ge,Et),s(ge,vt),s(vt,qt),s(vt,at),s(vt,lt),s(ge,Bt),Ft&&Ft.m(ge,null),s(ge,el),s(ge,pt),s(pt,Qt),s(ge,Jt),s(ge,It),s(It,$t),s(It,Gt),s(It,ll),s(ge,Ye),he&&he.m(ge,null)},p(Ee,$){var Oe,_l,it,Dt,al,ml,bl,fl,gl,kl;$&16&&l!==(l=(((Oe=Ee[4].common)==null?void 0:Oe.import)??"Import")+"")&&D(n,l),$&16&&r!==(r=sl(((_l=Ee[4].common)==null?void 0:_l.hour)??"Hour")+"")&&D(f,r),$&64&&_!==(_=Ee[6][0]+"")&&D(d,_),$&64&&g!==(g=Ee[6][1]+"")&&D(b,g),Ee[5]?Mt?Mt.p(Ee,$):(Mt=rs(Ee),Mt.c(),Mt.m(o,w)):Mt&&(Mt.d(1),Mt=null),$&16&&F!==(F=sl(((it=Ee[4].common)==null?void 0:it.day)??"Day")+"")&&D(R,F),$&128&&O!==(O=Ee[7][0]+"")&&D(H,O),$&128&&z!==(z=Ee[7][1]+"")&&D(q,z),Ee[5]?Rt?Rt.p(Ee,$):(Rt=cs(Ee),Rt.c(),Rt.m(o,Z)):Rt&&(Rt.d(1),Rt=null),$&16&&Y!==(Y=sl(((Dt=Ee[4].common)==null?void 0:Dt.month)??"Month")+"")&&D(G,Y),$&256&&ne!==(ne=Ee[8][0]+"")&&D(ee,ne),$&256&&ie!==(ie=Ee[8][1]+"")&&D(re,ie),Ee[5]?kt?kt.p(Ee,$):(kt=_s(Ee),kt.c(),kt.m(o,le)):kt&&(kt.d(1),kt=null),$&16&&oe!==(oe=(((al=Ee[4].realtime)==null?void 0:al.last_mo)??"Last mo.")+"")&&D(me,oe),$&512&&we!==(we=Ee[9][0]+"")&&D(S,we),$&512&&I!==(I=Ee[9][1]+"")&&D(A,I),Ee[5]?gt?gt.p(Ee,$):(gt=ms(Ee),gt.c(),gt.m(o,null)):gt&&(gt.d(1),gt=null),$&16384&&te!==(te="grid grid-cols-"+Ee[14]+" mb-3")&&u(o,"class",te),$&16&&ke!==(ke=(((ml=Ee[4].common)==null?void 0:ml.export)??"Export")+"")&&D(J,ke),$&16&&Pe!==(Pe=sl(((bl=Ee[4].common)==null?void 0:bl.hour)??"Hour")+"")&&D(Ae,Pe),$&1024&&De!==(De=Ee[10][0]+"")&&D(Re,De),$&1024&&xe!==(xe=Ee[10][1]+"")&&D(ut,xe),Ee[5]?jt?jt.p(Ee,$):(jt=ps(Ee),jt.c(),jt.m(ge,dt)):jt&&(jt.d(1),jt=null),$&16&&ot!==(ot=sl(((fl=Ee[4].common)==null?void 0:fl.day)??"Day")+"")&&D(ht,ot),$&2048&&Fe!==(Fe=Ee[11][0]+"")&&D(He,Fe),$&2048&&Ge!==(Ge=Ee[11][1]+"")&&D(Ve,Ge),Ee[5]?et?et.p(Ee,$):(et=ds(Ee),et.c(),et.m(ge,_e)):et&&(et.d(1),et=null),$&16&&Te!==(Te=sl(((gl=Ee[4].common)==null?void 0:gl.month)??"Month")+"")&&D(Ke,Te),$&4096&&Xe!==(Xe=Ee[12][0]+"")&&D(qt,Xe),$&4096&&mt!==(mt=Ee[12][1]+"")&&D(lt,mt),Ee[5]?Ft?Ft.p(Ee,$):(Ft=hs(Ee),Ft.c(),Ft.m(ge,el)):Ft&&(Ft.d(1),Ft=null),$&16&&nt!==(nt=(((kl=Ee[4].realtime)==null?void 0:kl.last_mo)??"Last mo.")+"")&&D(Qt,nt),$&8192&&Zt!==(Zt=Ee[13][0]+"")&&D($t,Zt),$&8192&&Xt!==(Xt=Ee[13][1]+"")&&D(ll,Xt),Ee[5]?he?he.p(Ee,$):(he=vs(Ee),he.c(),he.m(ge,null)):he&&(he.d(1),he=null),$&16384&&st!==(st="grid grid-cols-"+Ee[14])&&u(ge,"class",st)},d(Ee){Ee&&(N(e),N(i),N(o),N(ue),N(be),N(ve),N(ge)),Mt&&Mt.d(),Rt&&Rt.d(),kt&&kt.d(),gt&>.d(),jt&&jt.d(),et&&et.d(),Ft&&Ft.d(),he&&he.d()}}}function us(t){var se,pe,we,S,C,I;let e,l=(((se=t[4].realtime)==null?void 0:se.cost)??"Cost")+"",n,i,o,a,r=sl(((pe=t[4].common)==null?void 0:pe.hour)??"Hour")+"",f,c,m,_=tl(t[1].h.c,2)+"",d,h,g,b,k,w=sl(((we=t[4].common)==null?void 0:we.day)??"Day")+"",E,F,R,T=tl(t[1].d.c,1)+"",L,O,H,K,z,q=sl(((S=t[4].common)==null?void 0:S.month)??"Month")+"",B,Z,V,Y=tl(t[1].m.c)+"",G,U,W,ne,ee,Q=(((C=t[4].realtime)==null?void 0:C.last_month)??"Last month")+"",ie,re,fe,le=tl((I=t[0].last_month)==null?void 0:I.c)+"",de,oe,me;return{c(){e=p("strong"),n=M(l),i=v(),o=p("div"),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),g=M(t[2]),b=v(),k=p("div"),E=M(w),F=v(),R=p("div"),L=M(T),O=v(),H=M(t[2]),K=v(),z=p("div"),B=M(q),Z=v(),V=p("div"),G=M(Y),U=v(),W=M(t[2]),ne=v(),ee=p("div"),ie=M(Q),re=v(),fe=p("div"),de=M(le),oe=v(),me=M(t[2]),u(m,"class","text-right"),u(R,"class","text-right"),u(V,"class","text-right"),u(fe,"class","text-right"),u(o,"class","grid grid-cols-2")},m(A,y){P(A,e,y),s(e,n),P(A,i,y),P(A,o,y),s(o,a),s(a,f),s(o,c),s(o,m),s(m,d),s(m,h),s(m,g),s(o,b),s(o,k),s(k,E),s(o,F),s(o,R),s(R,L),s(R,O),s(R,H),s(o,K),s(o,z),s(z,B),s(o,Z),s(o,V),s(V,G),s(V,U),s(V,W),s(o,ne),s(o,ee),s(ee,ie),s(o,re),s(o,fe),s(fe,de),s(fe,oe),s(fe,me)},p(A,y){var te,ue,be,ke,J,ve;y&16&&l!==(l=(((te=A[4].realtime)==null?void 0:te.cost)??"Cost")+"")&&D(n,l),y&16&&r!==(r=sl(((ue=A[4].common)==null?void 0:ue.hour)??"Hour")+"")&&D(f,r),y&2&&_!==(_=tl(A[1].h.c,2)+"")&&D(d,_),y&4&&D(g,A[2]),y&16&&w!==(w=sl(((be=A[4].common)==null?void 0:be.day)??"Day")+"")&&D(E,w),y&2&&T!==(T=tl(A[1].d.c,1)+"")&&D(L,T),y&4&&D(H,A[2]),y&16&&q!==(q=sl(((ke=A[4].common)==null?void 0:ke.month)??"Month")+"")&&D(B,q),y&2&&Y!==(Y=tl(A[1].m.c)+"")&&D(G,Y),y&4&&D(W,A[2]),y&16&&Q!==(Q=(((J=A[4].realtime)==null?void 0:J.last_month)??"Last month")+"")&&D(ie,Q),y&1&&le!==(le=tl((ve=A[0].last_month)==null?void 0:ve.c)+"")&&D(de,le),y&4&&D(me,A[2])},d(A){A&&(N(e),N(i),N(o))}}}function rs(t){let e,l=tl(t[1].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].h.c,2)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function cs(t){let e,l=tl(t[1].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].d.c,1)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function _s(t){let e,l=tl(t[1].m.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].m.c)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function ms(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),s(e,n),s(e,i),s(e,o)},p(r,f){var c;f&1&&l!==(l=tl((c=r[0].last_month)==null?void 0:c.c)+"")&&D(n,l),f&4&&D(o,r[2])},d(r){r&&N(e)}}}function ps(t){let e,l=tl(t[1].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].h.i,2)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function ds(t){let e,l=tl(t[1].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].d.i,1)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function hs(t){let e,l=tl(t[1].m.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,n),s(e,i),s(e,o)},p(a,r){r&2&&l!==(l=tl(a[1].m.i)+"")&&D(n,l),r&4&&D(o,a[2])},d(a){a&&N(e)}}}function vs(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=v(),o=M(t[2]),u(e,"class","text-right")},m(r,f){P(r,e,f),s(e,n),s(e,i),s(e,o)},p(r,f){var c;f&1&&l!==(l=tl((c=r[0].last_month)==null?void 0:c.i)+"")&&D(n,l),f&4&&D(o,r[2])},d(r){r&&N(e)}}}function O1(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,o,a,r,f,c=t[1]&&fs(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("br"),r=p("br"),f=v(),c&&c.c(),u(e,"class","mx-2 text-sm")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),c&&c.m(e,null)},p(_,[d]){var h;d&16&&n!==(n=(((h=_[4].realtime)==null?void 0:h.title)??"Real time calculations")+"")&&D(i,n),_[1]?c?c.p(_,d):(c=fs(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:je,o:je,d(_){_&&N(e),c&&c.d()}}}function I1(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,{translations:r={}}=e,f,c,m,_,d,h,g,b,k=!1,w=3;return t.$$set=E=>{"sysinfo"in E&&l(0,n=E.sysinfo),"data"in E&&l(1,i=E.data),"currency"in E&&l(2,o=E.currency),"hasExport"in E&&l(3,a=E.hasExport),"translations"in E&&l(4,r=E.translations)},t.$$.update=()=>{var E,F,R,T,L,O,H,K;t.$$.dirty&35&&(l(5,k=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,w=k?3:2),l(6,f=pl(((E=i==null?void 0:i.h)==null?void 0:E.u)*1e3,"Wh")),l(7,c=pl(((F=i==null?void 0:i.d)==null?void 0:F.u)*1e3,"Wh")),l(8,m=pl(((R=i==null?void 0:i.m)==null?void 0:R.u)*1e3,"Wh")),l(9,_=pl(((T=n==null?void 0:n.last_month)==null?void 0:T.u)*1e3,"Wh")),l(10,d=pl(((L=i==null?void 0:i.h)==null?void 0:L.p)*1e3,"Wh")),l(11,h=pl(((O=i==null?void 0:i.d)==null?void 0:O.p)*1e3,"Wh")),l(12,g=pl(((H=i==null?void 0:i.m)==null?void 0:H.p)*1e3,"Wh")),l(13,b=pl(((K=n==null?void 0:n.last_month)==null?void 0:K.p)*1e3,"Wh")))},[n,i,o,a,r,k,f,c,m,_,d,h,g,b,w]}class R1 extends Tt{constructor(e){super(),Pt(this,e,I1,O1,Ct,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function bs(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function F1(t){let e,l,n=t[0].points&&t[0].points.length>0&&bs(t);return{c(){n&&n.c(),e=yt()},m(i,o){n&&n.m(i,o),P(i,e,o),l=!0},p(i,[o]){i[0].points&&i[0].points.length>0?n?(n.p(i,o),o&1&&X(n,1)):(n=bs(i),n.c(),X(n,1),n.m(e.parentNode,e)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d(i)}}}function B1(t,e,l){let{title:n}=e,{json:i}=e,o={},a,r,f=document.documentElement.classList.contains("dark"),c=new Date;return so(()=>{let m;function _(){l(5,c=new Date),m=setTimeout(()=>{_()},(15-c.getMinutes()%15)*6e4)}return _(),()=>{clearTimeout(m)}}),t.$$set=m=>{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json)},t.$$.update=()=>{var m,_;if(t.$$.dirty&62&&((m=i==null?void 0:i.prices)==null?void 0:m.length)>0){l(5,c=new Date);let d=i==null?void 0:i.currency,h=0,g=[],b=[],k=[];l(4,r=l(3,a=0));let w=Math.floor((c.getHours()*60+c.getMinutes())/(i==null?void 0:i.resolution));for(c.setMinutes(Math.floor(c.getMinutes()/(i==null?void 0:i.resolution))*(i==null?void 0:i.resolution),0,0);w<((_=i==null?void 0:i.prices)==null?void 0:_.length)&&(h=i.prices[w],h!=null);)b.push({label:k.length>0&&(i==null?void 0:i.resolution)<60&&c.getMinutes()!=0?"":Lt(c.getHours())}),k.push(h*100),l(4,r=Math.min(r,h*100)),l(3,a=Math.max(a,h*100)),M0(c,i==null?void 0:i.resolution),w++;let E=li(Math.max(Math.abs(r)/100,Math.abs(a)/100),d);if(E&&E[1]&&E[1]!=d)for(d=E[1],l(4,r*=100),l(3,a*=100),w=0;w=0?O.toFixed(H):"",title:O>=0?O.toFixed(2)+" "+d:"",value:h>=0?Math.abs(h):0,label2:O<0?O.toFixed(H):"",title2:O<0?O.toFixed(2)+" "+d:"",value2:h<0?Math.abs(h):0,color:f?"#5c2da5":"#7c3aed"})}let R=Math.max(a,Math.abs(r));if(r<0){l(4,r=Math.min(R/4*-1,r));let O=Math.ceil(Math.abs(r)/R*4),H=r/O;for(w=1;w{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let g=new Date,b=new Date;b.setDate(0),b.setHours(12);let k=(b.getHours()-b.getUTCHours())%24-o.clock_offset,w=g.getUTCHours();for(Sn(g,-k-24),m=w;m<24;m++){let T=i["i"+Lt(m)],L=i["e"+Lt(m)];T===void 0&&(T=0),L===void 0&&(L=0),d.push({label:Lt(g.getHours())}),h.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:L.toFixed(1),title2:L.toFixed(2)+" kWh",value2:L*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,L*10)),l(4,r=Math.max(r,T*10)),Sn(g,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],d=[],h=[];l(5,f=l(4,r=0));let g=new Date,b=new Date;b.setDate(0),b.setHours(12);let k=(b.getHours()-b.getUTCHours())%24-o.clock_offset;for(Sn(g,-k),Sn(b,-k),m=g.getDate();m<=b.getDate();m++){let R=i["i"+Lt(m)],T=i["e"+Lt(m)];R===void 0&&(R=0),T===void 0&&(T=0),d.push({label:Lt(m)}),h.push({label:R.toFixed(R<10?1:0),title:R.toFixed(2)+" kWh",value:R,label2:T.toFixed(T<10?1:0),title2:T.toFixed(2)+" kWh",value2:T,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,T)),l(4,r=Math.max(r,R))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],d=[],h=[];i.s&&i.s.forEach((k,w)=>{var E=k.n?k.n:k.a;m=k.v,m==-127&&(m=0),d.push({label:E.slice(-4)}),h.push({label:m.toFixed(1),value:m,color:o?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,r=Math.max(r,m))}),l(3,r=Math.ceil(r)),l(4,f=Math.floor(f));let g=r;f<0&&(g+=Math.abs(f));let b=g/4;for(c=0;c<5;c++)m=f+b*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:r,ticks:_},x:{ticks:d},points:h})}},[a,n,i,r,f]}class K1 extends Tt{constructor(e){super(),Pt(this,e,V1,G1,Ct,{title:1,json:2})}}function Y1(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}let Q1=0;function X1(t,e,l){let{title:n}=e,{translations:i={}}=e,o=document.documentElement.classList.contains("dark"),a={},r=0,{tariffData:f}=e,{realtime:c}=e;return t.$$set=m=>{"title"in m&&l(1,n=m.title),"translations"in m&&l(2,i=m.translations),"tariffData"in m&&l(3,f=m.tariffData),"realtime"in m&&l(4,c=m.realtime)},t.$$.update=()=>{var m,_,d,h;if(t.$$.dirty&62){let g=0,b=[],k=[],w=[];if(b.push({value:0,label:0}),f&&!isNaN((m=c==null?void 0:c.h)==null?void 0:m.u)&&(w.push({label:c.h.u.toFixed(2),value:c.h.u,title:(((_=i.common)==null?void 0:_.now)??"Now")+": "+c.h.u.toFixed(2)+" kWh",color:Pi(c.h.u/f.c*100)}),k.push({label:((d=i.common)==null?void 0:d.now)??"Now"})),f&&f.p)for(g=0;g0&&(R=Lt(E.d)+".",F=Lt(E.d)+"."+(i.months?(h=i.months)==null?void 0:h[new Date().getMonth()]:Lt(new Date().getMonth()+1)),f.p.length<4&&(R=F)),isNaN(E.h)||(F=F+" "+Lt(E.h)+":00"),F=F+": "+E.v.toFixed(2)+" kWh",w.push({label:E.v.toFixed(2),value:E.v,title:F,color:o?"#5c2da5":"#7c3aed"}),k.push({label:R}),l(5,r=Math.max(r,E.v))}if(f&&f.t){for(g=0;g=r)break;b.push({value:E,label:E})}b.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(b.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(5,r=Math.max(r,f.c))),l(5,r=Math.ceil(r)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:20,bottom:20,left:20},y:{min:Q1,max:r,ticks:b},x:{ticks:k},points:w})}},[a,n,i,f,c,r]}class Z1 extends Tt{constructor(e){super(),Pt(this,e,X1,Y1,Ct,{title:1,translations:2,tariffData:3,realtime:4})}}let sn=0,J1={data:[]};async function mo(){let e=await(await Cl(sn<0?"realtime.json":"realtime.json?offset="+sn)).json();po.update(l=>{for(let n=0;n=0&&(sn+=e.size,snwn||Ji-wn>300?(mo(),Fi=0):po.update(t=>{if(t.lastUpdate)for(;wn>t.lastUpdate;)t.data.unshift(Xu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,Fi++;else t.lastUpdate=wn;return t})}function ec(t){if(Xu=t.i-t.e,wn=t.u,!gs){mo(),gs=!0,Ji=wn;return}$1()&&x1()}function ks(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function ws(t,e,l){const n=t.slice();return n[21]=e[l],n}function tc(t){let e,l,n;return{c(){e=p("strong"),l=M(t[0]),n=M(" not available"),u(e,"class","text-sm")},m(i,o){P(i,e,o),s(e,l),s(e,n)},p(i,o){o&1&&D(l,i[0])},d(i){i&&N(e)}}}function lc(t){let e,l,n,i,o,a,r,f=t[8]&&Cs(t);return{c(){e=p("strong"),l=M(t[0]),n=M(" ("),i=M(t[12]),o=M(")"),a=v(),f&&f.c(),r=yt(),u(e,"class","text-sm")},m(c,m){P(c,e,m),s(e,l),s(e,n),s(e,i),s(e,o),P(c,a,m),f&&f.m(c,m),P(c,r,m)},p(c,m){m&1&&D(l,c[0]),m&4096&&D(i,c[12]),c[8]?f?f.p(c,m):(f=Cs(c),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(r)),f&&f.d(c)}}}function Cs(t){let e,l,n,i,o,a=ft(t[8]),r=[];for(let m=0;mt[17].call(e))},m(a,r){P(a,e,r),o.m(e,null),l=Mi(e,t[17].bind(e))},p(a,[r]){i===(i=n(a))&&o?o.p(a,r):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null)))},i:je,o:je,d(a){a&&N(e),o.d(),l()}}}function ic(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),o=null;po.subscribe(T=>{l(16,o=T)});let a=!1,r,f,c,m,_,d,h,g=function(T,L,O){return Math.ceil(_-(T-L)/(O-L)*_)-25},b=function(T){return 30+Math.ceil(T/o.size*(d-35))},k,w,E,F;function R(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=T=>{"title"in T&&l(0,n=T.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,d=c-35),l(10,E=d/o.size),l(2,f=0),l(1,r=0),o.data&&_>10&&d>100&&E>.1){l(11,a=!0);for(let O in o.data){let H=o.data[O];isNaN(H)&&(H=0),l(1,r=Math.max(Math.ceil(H/1e3)*1e3,r)),l(2,f=Math.min(Math.floor(H/1e3)*1e3,f))}let T=r-f;l(12,F=r>2500?"kW":"W"),l(8,k=[]);for(let O=f;O2500?(O/1e3).toFixed(1):O}),!(k.length>6));O+=T/5);l(9,w=[]);for(let O=0;O12));O+=Math.round(o.size/Math.round(d/120)));let L=o.size;l(7,h=b(o.size)+","+g(0,f,r)+" "+b(1)+","+g(0,f,r));for(let O in o.data){if(L<0)break;let H=o.data[O];isNaN(H)&&(H=0),l(7,h=b(L--)+","+g(H,f,r)+" "+h)}}else l(11,a=!1)},[n,r,f,c,m,_,d,h,k,w,E,a,F,i,g,b,o,R]}class oc extends Tt{constructor(e){super(),Pt(this,e,ic,nc,Ct,{title:0})}}function sc(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function ac(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:o=!1}=e,{l2:a=!1}=e,{l2x:r=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:d=0}=e,{l2e:h=0}=e,{l3e:g=0}=e,{maxImport:b=0}=e,{maxExport:k=0}=e,{importColorFn:w}=e,{exportColorFn:E}=e,F={};function R(T,L){return{label:tl(T>900?T/1e3:T)+(T>900?"k":"")+i,title:T.toFixed(2)+" "+i,value:isNaN(T)?0:T,color:w(T?T/b*100:0,document.documentElement.classList.contains("dark")),label2:tl(L>900?L/1e3:L)+(L>900?"k":"")+i,title2:L.toFixed(2)+" "+i,value2:isNaN(L)?0:L,color2:E(L?L/k*100:0)}}return t.$$set=T=>{"title"in T&&l(1,n=T.title),"unit"in T&&l(2,i=T.unit),"l1"in T&&l(3,o=T.l1),"l2"in T&&l(4,a=T.l2),"l2x"in T&&l(5,r=T.l2x),"l3"in T&&l(6,f=T.l3),"l1i"in T&&l(7,c=T.l1i),"l2i"in T&&l(8,m=T.l2i),"l3i"in T&&l(9,_=T.l3i),"l1e"in T&&l(10,d=T.l1e),"l2e"in T&&l(11,h=T.l2e),"l3e"in T&&l(12,g=T.l3e),"maxImport"in T&&l(13,b=T.maxImport),"maxExport"in T&&l(14,k=T.maxExport),"importColorFn"in T&&l(15,w=T.importColorFn),"exportColorFn"in T&&l(16,E=T.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let T=[],L=[];o&&(T.push({label:"L1"}),L.push(R(c,d))),a&&(r?(T.push({label:"L2"}),L.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(T.push({label:"L2"}),L.push(R(m,h)))),f&&(T.push({label:"L3"}),L.push(R(_,g)));let O=[];if(k){let H=k>b?4:k*4/b;O.push({value:-k,label:"-100%"}),H>=4&&O.push({value:-k/4*3,label:"-75%"}),H>=2&&O.push({value:-k/2,label:"-50%"}),H>=4&&O.push({value:-k/4,label:"-25%"})}if(O.push({value:0,label:"0%"}),b){let H=b>k?4:b*4/k;O.push({value:b/4,label:"25%"}),H>=4&&O.push({value:b/2,label:"50%"}),H>=2&&O.push({value:b/4*3,label:"75%"}),H>=4&&O.push({value:b,label:"100%"})}l(0,F={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:b,ticks:O},x:{ticks:T},points:L})}},[F,n,i,o,a,r,f,c,m,_,d,h,g,b,k,w,E]}class ho extends Tt{constructor(e){super(),Pt(this,e,ac,sc,Ct,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Ts(t){var w;let e,l,n,i,o,a,r=(t[0].mt?wi(t[0].mt):"-")+"",f,c,m,_=t[12][0]+"",d,h,g=t[12][1]+"",b,k;return i=new Qu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((w=t[7].common)==null?void 0:w.import)??"Import",sub:li(t[0].p,t[0].pc),colorFn:Pi}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),f=M(r),c=v(),m=p("div"),d=M(_),h=v(),b=M(g),u(n,"class","col-span-2"),u(m,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(E,F){P(E,e,F),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,f),s(l,c),s(l,m),s(m,d),s(m,h),s(m,b),k=!0},p(E,F){var T;const R={};F&1&&(R.val=E[0].i?E[0].i:0),F&1&&(R.max=E[0].im?E[0].im:15e3),F&128&&(R.label=((T=E[7].common)==null?void 0:T.import)??"Import"),F&1&&(R.sub=li(E[0].p,E[0].pc)),i.$set(R),(!k||F&1)&&r!==(r=(E[0].mt?wi(E[0].mt):"-")+"")&&D(f,r),(!k||F&4096)&&_!==(_=E[12][0]+"")&&D(d,_),(!k||F&4096)&&g!==(g=E[12][1]+"")&&D(b,g)},i(E){k||(X(i.$$.fragment,E),k=!0)},o(E){x(i.$$.fragment,E),k=!1},d(E){E&&N(e),Se(i)}}}function qs(t){var b;let e,l,n,i,o,a,r,f,c=t[13][0]+"",m,_,d=t[13][1]+"",h,g;return i=new Qu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((b=t[7].common)==null?void 0:b.export)??"Export",sub:li(t[0].px,t[0].pc),colorFn:ei}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=v(),a=p("div"),r=v(),f=p("div"),m=M(c),_=v(),h=M(d),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(k,w){P(k,e,w),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(l,r),s(l,f),s(f,m),s(f,_),s(f,h),g=!0},p(k,w){var F;const E={};w&1&&(E.val=k[0].e?k[0].e:0),w&1&&(E.max=k[0].om?k[0].om*1e3:1e4),w&128&&(E.label=((F=k[7].common)==null?void 0:F.export)??"Export"),w&1&&(E.sub=li(k[0].px,k[0].pc)),i.$set(E),(!g||w&8192)&&c!==(c=k[13][0]+"")&&D(m,c),(!g||w&8192)&&d!==(d=k[13][1]+"")&&D(h,d)},i(k){g||(X(i.$$.fragment,k),g=!0)},o(k){x(i.$$.fragment,k),g=!1},d(k){k&&N(e),Se(i)}}}function Es(t){let e,l,n=t[0].l1&&Ds(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ds(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ds(t){var n;let e,l;return e=new T1({props:{title:((n=t[7].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].common)==null?void 0:r.voltage)??"Volt"),o&1&&(a.u1=i[0].l1.u),o&1&&(a.u2=i[0].l2.u),o&1&&(a.u3=i[0].l3.u),o&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function As(t){let e,l,n=t[0].l1&&Ls(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ls(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ls(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Pi,exportColorFn:ei,maxImport:t[0].mf,l1:t[9],l2:t[10],l3:t[11],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].common)==null?void 0:r.amperage)??"Amp"),o&1&&(a.maxImport=i[0].mf),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l2x=i[0].l2.e),o&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),o&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),o&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Os(t){let e,l,n=t[0].l1&&Is(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Is(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Is(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Pi,exportColorFn:ei,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[14]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].dashboard)==null?void 0:r.phase)??"Phase"),o&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),o&16385&&(a.maxExport=i[0].om?i[14]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.p),o&1&&(a.l2i=i[0].l2.p),o&1&&(a.l3i=i[0].l3.p),o&1&&(a.l1e=i[0].l1.q),o&1&&(a.l2e=i[0].l2.q),o&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Rs(t){let e,l,n=t[0].l1&&Fs(t);return{c(){e=p("div"),n&&n.c(),u(e,"class","cnt")},m(i,o){P(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Fs(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Fs(t){var n;let e,l;return e=new ho({props:{title:((n=t[7].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:ei,exportColorFn:ei,maxImport:1,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Me(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var r;const a={};o&128&&(a.title=((r=i[7].dashboard)==null?void 0:r.pf)??"Pf"),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.f),o&1&&(a.l2i=i[0].l2.f),o&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Bs(t){let e,l,n;return l=new D1({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function Us(t){let e,l,n;return l=new R1({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function zs(t){var i;let e,l,n;return l=new Z1({props:{title:((i=t[7].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[8],realtime:t[0].ea,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt h-64")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&256&&(r.tariffData=o[8]),a&1&&(r.realtime=o[0].ea),a&128&&(r.translations=o[7]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function js(t){var i;let e,l,n;return l=new oc({props:{title:((i=t[7].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Hs(t){let e,l,n,i;const o=[uc,fc],a=[];function r(f,c){var m;return(m=f[2])!=null&&m.importExportPriceDifferent&&(f[0].om||f[0].e>0)?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function fc(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price)??"Price",json:t[2]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price)??"Price"),a&4&&(r.json=o[2]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function uc(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price_import)??"Price import",json:t[2]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price_import)??"Price import"),a&4&&(r.json=o[2]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Ws(t){var i;let e,l,n;return l=new _o({props:{title:((i=t[7].dashboard)==null?void 0:i.price_export)??"Price export",json:t[3]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.price_export)??"Price export"),a&8&&(r.json=o[3]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function ys(t){var i;let e,l,n;return l=new j1({props:{title:((i=t[7].dashboard)==null?void 0:i.day)??"24 hours",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.day)??"24 hours"),a&16&&(r.json=o[4]),a&2&&(r.sysinfo=o[1]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Gs(t){var i;let e,l,n;return l=new y1({props:{title:((i=t[7].dashboard)==null?void 0:i.month)??"{0} days",json:t[5],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.month)??"{0} days"),a&32&&(r.json=o[5]),a&2&&(r.sysinfo=o[1]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Vs(t){var i;let e,l,n;return l=new K1({props:{title:((i=t[7].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[6]}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","cnt gwf")},m(o,a){P(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const r={};a&128&&(r.title=((f=o[7].dashboard)==null?void 0:f.temperature)??"Temperature"),a&64&&(r.json=o[6]),l.$set(r)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function rc(t){var we;let e,l=xt(t[1].ui.i,t[0].i),n,i=xt(t[1].ui.e,t[0].om||t[0].e>0),o,a=xt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),r,f=xt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=xt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,d=xt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),h,g=xt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),b,k=xt(t[1].ui.c,t[0].ea),w,E=xt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),F,R=xt(t[1].ui.l,t[0].hm==1),T,L=xt(t[1].ui.p,t[0].p&&!Number.isNaN(t[0].p)),O,H=((we=t[2])==null?void 0:we.importExportPriceDifferent)&&(t[0].om||t[0].e>0)&&xt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].pe)),K,z=xt(t[1].ui.d,t[4]),q,B=xt(t[1].ui.m,t[5]),Z,V=xt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[6].c>1),Y,G=l&&Ts(t),U=i&&qs(t),W=a&&Es(t),ne=f&&As(t),ee=m&&Os(t),Q=d&&Rs(t),ie=g&&Bs(t),re=k&&Us(t),fe=E&&zs(t),le=R&&js(t),de=L&&Hs(t),oe=H&&Ws(t),me=z&&ys(t),se=B&&Gs(t),pe=V&&Vs(t);return{c(){e=p("div"),G&&G.c(),n=v(),U&&U.c(),o=v(),W&&W.c(),r=v(),ne&&ne.c(),c=v(),ee&&ee.c(),_=v(),Q&&Q.c(),h=v(),ie&&ie.c(),b=v(),re&&re.c(),w=v(),fe&&fe.c(),F=v(),le&&le.c(),T=v(),de&&de.c(),O=v(),oe&&oe.c(),K=v(),me&&me.c(),q=v(),se&&se.c(),Z=v(),pe&&pe.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(S,C){P(S,e,C),G&&G.m(e,null),s(e,n),U&&U.m(e,null),s(e,o),W&&W.m(e,null),s(e,r),ne&&ne.m(e,null),s(e,c),ee&&ee.m(e,null),s(e,_),Q&&Q.m(e,null),s(e,h),ie&&ie.m(e,null),s(e,b),re&&re.m(e,null),s(e,w),fe&&fe.m(e,null),s(e,F),le&&le.m(e,null),s(e,T),de&&de.m(e,null),s(e,O),oe&&oe.m(e,null),s(e,K),me&&me.m(e,null),s(e,q),se&&se.m(e,null),s(e,Z),pe&&pe.m(e,null),Y=!0},p(S,[C]){var I;C&3&&(l=xt(S[1].ui.i,S[0].i)),l?G?(G.p(S,C),C&3&&X(G,1)):(G=Ts(S),G.c(),X(G,1),G.m(e,n)):G&&(ct(),x(G,1,1,()=>{G=null}),_t()),C&3&&(i=xt(S[1].ui.e,S[0].om||S[0].e>0)),i?U?(U.p(S,C),C&3&&X(U,1)):(U=qs(S),U.c(),X(U,1),U.m(e,o)):U&&(ct(),x(U,1,1,()=>{U=null}),_t()),C&3&&(a=xt(S[1].ui.v,S[0].l1&&(S[0].l1.u>100||S[0].l2.u>100||S[0].l3.u>100))),a?W?(W.p(S,C),C&3&&X(W,1)):(W=Es(S),W.c(),X(W,1),W.m(e,r)):W&&(ct(),x(W,1,1,()=>{W=null}),_t()),C&3&&(f=xt(S[1].ui.a,S[0].l1&&(S[0].l1.i>.01||S[0].l2.i>.01||S[0].l3.i>.01))),f?ne?(ne.p(S,C),C&3&&X(ne,1)):(ne=As(S),ne.c(),X(ne,1),ne.m(e,c)):ne&&(ct(),x(ne,1,1,()=>{ne=null}),_t()),C&3&&(m=xt(S[1].ui.h,S[0].l1&&(S[0].l1.p>.01||S[0].l2.p>.01||S[0].l3.p>.01||S[0].l1.q>.01||S[0].l2.q>.01||S[0].l3.q>.01))),m?ee?(ee.p(S,C),C&3&&X(ee,1)):(ee=Os(S),ee.c(),X(ee,1),ee.m(e,_)):ee&&(ct(),x(ee,1,1,()=>{ee=null}),_t()),C&3&&(d=xt(S[1].ui.f,S[0].l1&&(S[0].l1.f>.01||S[0].l2.f>.01||S[0].l3.f>.01))),d?Q?(Q.p(S,C),C&3&&X(Q,1)):(Q=Rs(S),Q.c(),X(Q,1),Q.m(e,h)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),C&3&&(g=xt(S[1].ui.r,S[0].ri>0||S[0].re>0||S[0].ric>0||S[0].rec>0)),g?ie?(ie.p(S,C),C&3&&X(ie,1)):(ie=Bs(S),ie.c(),X(ie,1),ie.m(e,b)):ie&&(ct(),x(ie,1,1,()=>{ie=null}),_t()),C&3&&(k=xt(S[1].ui.c,S[0].ea)),k?re?(re.p(S,C),C&3&&X(re,1)):(re=Us(S),re.c(),X(re,1),re.m(e,w)):re&&(ct(),x(re,1,1,()=>{re=null}),_t()),C&3&&(E=xt(S[1].ui.t,S[0].pr&&(S[0].pr.startsWith("NO")||S[0].pr.startsWith("10YNO")||S[0].pr.startsWith("10Y1001A1001A4")))),E?fe?(fe.p(S,C),C&3&&X(fe,1)):(fe=zs(S),fe.c(),X(fe,1),fe.m(e,F)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),C&3&&(R=xt(S[1].ui.l,S[0].hm==1)),R?le?(le.p(S,C),C&3&&X(le,1)):(le=js(S),le.c(),X(le,1),le.m(e,T)):le&&(ct(),x(le,1,1,()=>{le=null}),_t()),C&3&&(L=xt(S[1].ui.p,S[0].p&&!Number.isNaN(S[0].p))),L?de?(de.p(S,C),C&3&&X(de,1)):(de=Hs(S),de.c(),X(de,1),de.m(e,O)):de&&(ct(),x(de,1,1,()=>{de=null}),_t()),C&7&&(H=((I=S[2])==null?void 0:I.importExportPriceDifferent)&&(S[0].om||S[0].e>0)&&xt(S[1].ui.p,S[0].pe&&!Number.isNaN(S[0].pe))),H?oe?(oe.p(S,C),C&7&&X(oe,1)):(oe=Ws(S),oe.c(),X(oe,1),oe.m(e,K)):oe&&(ct(),x(oe,1,1,()=>{oe=null}),_t()),C&18&&(z=xt(S[1].ui.d,S[4])),z?me?(me.p(S,C),C&18&&X(me,1)):(me=ys(S),me.c(),X(me,1),me.m(e,q)):me&&(ct(),x(me,1,1,()=>{me=null}),_t()),C&34&&(B=xt(S[1].ui.m,S[5])),B?se?(se.p(S,C),C&34&&X(se,1)):(se=Gs(S),se.c(),X(se,1),se.m(e,Z)):se&&(ct(),x(se,1,1,()=>{se=null}),_t()),C&67&&(V=xt(S[1].ui.s,S[0].t&&S[0].t!=-127&&S[6].c>1)),V?pe?(pe.p(S,C),C&67&&X(pe,1)):(pe=Vs(S),pe.c(),X(pe,1),pe.m(e,null)):pe&&(ct(),x(pe,1,1,()=>{pe=null}),_t())},i(S){Y||(X(G),X(U),X(W),X(ne),X(ee),X(Q),X(ie),X(re),X(fe),X(le),X(de),X(oe),X(me),X(se),X(pe),Y=!0)},o(S){x(G),x(U),x(W),x(ne),x(ee),x(Q),x(ie),x(re),x(fe),x(le),x(de),x(oe),x(me),x(se),x(pe),Y=!1},d(S){S&&N(e),G&&G.d(),U&&U.d(),W&&W.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),re&&re.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),me&&me.d(),se&&se.d(),pe&&pe.d()}}}function cc(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{importPrices:o={}}=e,{exportPrices:a={}}=e,{dayPlot:r={}}=e,{monthPlot:f={}}=e,{temperatures:c={}}=e,{translations:m={}}=e,{tariffData:_={}}=e,d,h,g,b,k,w;return t.$$set=E=>{"data"in E&&l(0,n=E.data),"sysinfo"in E&&l(1,i=E.sysinfo),"importPrices"in E&&l(2,o=E.importPrices),"exportPrices"in E&&l(3,a=E.exportPrices),"dayPlot"in E&&l(4,r=E.dayPlot),"monthPlot"in E&&l(5,f=E.monthPlot),"temperatures"in E&&l(6,c=E.temperatures),"translations"in E&&l(7,m=E.translations),"tariffData"in E&&l(8,_=E.tariffData)},t.$$.update=()=>{var E,F,R,T,L,O,H,K,z,q,B,Z,V,Y,G;t.$$.dirty&3585&&(l(12,d=pl((n==null?void 0:n.ic)*1e3,"Wh")),l(13,h=pl((n==null?void 0:n.ec)*1e3,"Wh")),((E=n==null?void 0:n.l1)==null?void 0:E.u)==0&&((F=n==null?void 0:n.l2)==null?void 0:F.u)==0&&((R=n==null?void 0:n.l3)==null?void 0:R.u)==0?l(9,b=l(10,k=l(11,w=l(14,g=!0)))):(l(9,b=((T=n==null?void 0:n.l1)==null?void 0:T.u)>0||((L=n==null?void 0:n.l1)==null?void 0:L.i)>0||((O=n==null?void 0:n.l1)==null?void 0:O.p)>0||((H=n==null?void 0:n.l1)==null?void 0:H.q)>0),l(10,k=((K=n==null?void 0:n.l2)==null?void 0:K.u)>0||((z=n==null?void 0:n.l2)==null?void 0:z.i)>0||((q=n==null?void 0:n.l2)==null?void 0:q.p)>0||((B=n==null?void 0:n.l2)==null?void 0:B.q)>0),l(11,w=((Z=n==null?void 0:n.l3)==null?void 0:Z.u)>0||((V=n==null?void 0:n.l3)==null?void 0:V.i)>0||((Y=n==null?void 0:n.l3)==null?void 0:Y.p)>0||((G=n==null?void 0:n.l3)==null?void 0:G.q)>0),l(14,g=b&&k&&w)))},[n,i,o,a,r,f,c,m,_,b,k,w,d,h,g]}class _c extends Tt{constructor(e){super(),Pt(this,e,cc,rc,Ct,{data:0,sysinfo:1,importPrices:2,exportPrices:3,dayPlot:4,monthPlot:5,temperatures:6,translations:7,tariffData:8})}}let $i={};const Zn=rl($i);async function mc(){$i=await(await fetch("configuration.json")).json(),Zn.set($i)}let xi={};const Zu=rl(xi);async function pc(){xi=await(await fetch("priceconfig.json")).json(),Zu.set(xi)}function Ks(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Ys(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=v(),n=p("option"),n.textContent="UART2",e.__value=3,j(e,e.__value),n.__value=113,j(n,n.__value)},m(i,o){P(i,e,o),P(i,l,o),P(i,n,o)},d(i){i&&(N(e),N(l),N(n))}}}function Qs(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],j(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Xs(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Qs(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Qs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function dc(t){let e,l,n,i,o=t[0]=="esp8266"&&Ys(),a=ft({length:t[1]+1}),r=[];for(let f=0;f{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class eo extends Tt{constructor(e){super(),Pt(this,e,hc,dc,Ct,{chip:0})}}function Zs(t){let e,l,n=t[1]&&Js(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){P(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Js(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function Js(t){let e,l;return{c(){e=p("div"),l=M(t[1]),u(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,e,i),s(e,l)},p(n,i){i&2&&D(l,n[1])},d(n){n&&N(e)}}}function vc(t){let e,l=t[0]&&Zs(t);return{c(){l&&l.c(),e=yt()},m(n,i){l&&l.m(n,i),P(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Zs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:je,o:je,d(n){n&&N(e),l&&l.d(n)}}}function bc(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class dl extends Tt{constructor(e){super(),Pt(this,e,bc,vc,Ct,{active:0,message:1})}}function $s(t,e,l){const n=t.slice();return n[1]=e[l],n}function xs(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=M("Europe/"),i=M(n),e.__value="Europe/"+t[1],j(e,e.__value)},m(o,a){P(o,e,a),s(e,l),s(e,i)},p:je,d(o){o&&N(e)}}}function gc(t){let e,l,n,i=ft(t[0]),o=[];for(let a=0;a>1&1,A=0;A0;C--)A[C]=A[C]?A[C-1]^T.EXPONENT[H._modN(T.LOG[A[C]]+S)]:A[C-1];A[0]=T.EXPONENT[H._modN(T.LOG[A[0]]+S)]}for(S=0;S<=I;S++)A[S]=T.LOG[A[S]]},_checkBadness:function(){var S,C,I,A,y,te=0,ue=this._badness,be=this.buffer,ke=this.width;for(y=0;yke*ke;)ge-=ke*ke,ve++;for(te+=ve*H.N4,A=0;A=ue-2&&(S=ue-2,y>9&&S--);var be=S;if(y>9){for(te[be+2]=0,te[be+3]=0;be--;)C=te[be],te[be+3]|=255&C<<4,te[be+2]=C>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[be+1]=0,te[be+2]=0;be--;)C=te[be],te[be+2]|=255&C<<4,te[be+1]=C>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(be=S+3-(y<10);be=5&&(I+=H.N1+A[C]-5);for(C=3;CS||A[C-3]*3>=A[C]*4||A[C+3]*3>=A[C]*4)&&(I+=H.N3);return I},_finish:function(){this._stringBuffer=this.buffer.slice();var S,C,I=0,A=3e4;for(C=0;C<8&&(this._applyMask(C),S=this._checkBadness(),S>=1)A&1&&(y[te-1-C+te*8]=1,C<6?y[8+te*C]=1:y[8+te*(C+1)]=1);for(C=0;C<7;C++,A>>=1)A&1&&(y[8+te*(te-7+C)]=1,C?y[6-C+te*8]=1:y[7+te*8]=1)},_interleaveBlocks:function(){var S,C,I=this._dataBlock,A=this._ecc,y=this._eccBlock,te=0,ue=this._calculateMaxLength(),be=this._neccBlock1,ke=this._neccBlock2,J=this._stringBuffer;for(S=0;S1)for(S=w.BLOCK[A],I=y-7;;){for(C=y-7;C>S-3&&(this._addAlignment(C,I),!(C6)for(S=O.BLOCK[te-7],C=17,I=0;I<6;I++)for(A=0;A<3;A++,C--)1&(C>11?te>>C-12:S>>C)?(y[5-I+ue*(2-A+ue-11)]=1,y[2-A+ue-11+ue*(5-I)]=1):(this._setMask(5-I,2-A+ue-11),this._setMask(2-A+ue-11,5-I))},_isMasked:function(S,C){var I=H._getMaskBit(S,C);return this._mask[I]===1},_pack:function(){var S,C,I,A=1,y=1,te=this.width,ue=te-1,be=te-1,ke=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(C=0;CC&&(I=S,S=C,C=I),I=C,I+=C*C,I>>=1,I+=S,I},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),K=H,z=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),q=z,B=_.extend(function(S,C,I,A){this.name=S,this.modifiable=!!C,this.defaultValue=I,this._valueTransformer=A},{transform:function(S){var C=this._valueTransformer;return typeof C=="function"?C(S,this):S}}),Z=B,V=_.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,C){return Object.prototype.hasOwnProperty.call(S,C)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),Y=V,G=_.extend(function(S){this.options={},S.forEach(function(C){this.options[C.name]=C},this)},{exists:function(S){return this.options[S]!=null},get:function(S,C){return G._get(this.options[S],C)},getAll:function(S){var C,I=this.options,A={};for(C in I)Y.hasOwn(I,C)&&(A[C]=G._get(I[C],S));return A},init:function(S,C,I){typeof I!="function"&&(I=Y.noop);var A,y;for(A in this.options)Y.hasOwn(this.options,A)&&(y=this.options[A],G._set(y,y.defaultValue,C),G._createAccessor(y,C,I));this._setAll(S,C,!0)},set:function(S,C,I){return this._set(S,C,I)},setAll:function(S,C){return this._setAll(S,C)},_set:function(S,C,I,A){var y=this.options[S];if(!y)throw new Error("Invalid option: "+S);if(!y.modifiable&&!A)throw new Error("Option cannot be modified: "+S);return G._set(y,C,I)},_setAll:function(S,C,I){if(!S)return!1;var A,y=!1;for(A in S)Y.hasOwn(S,A)&&this._set(A,S[A],C,I)&&(y=!0);return y}},{_createAccessor:function(S,C,I){var A={get:function(){return G._get(S,C)}};S.modifiable&&(A.set=function(y){G._set(S,y,C)&&I(y,S)}),Object.defineProperty(C,S.name,A)},_get:function(S,C){return C["_"+S.name]},_set:function(S,C,I){var A="_"+S.name,y=I[A],te=S.transform(C??S.defaultValue);return I[A]=te,te!==y}}),U=G,W=_.extend(function(){this._services={}},{getService:function(S){var C=this._services[S];if(!C)throw new Error("Service is not being managed with name: "+S);return C},setService:function(S,C){if(this._services[S])throw new Error("Service is already managed with name: "+S);C&&(this._services[S]=C)}}),ne=W,ee=new U([new Z("background",!0,"white"),new Z("backgroundAlpha",!0,1,Y.abs),new Z("element"),new Z("foreground",!0,"black"),new Z("foregroundAlpha",!0,1,Y.abs),new Z("level",!0,"L",Y.toUpperCase),new Z("mime",!0,"image/png"),new Z("padding",!0,null,Y.abs),new Z("size",!0,100,Y.abs),new Z("value",!0,"")]),Q=new ne,ie=_.extend(function(S){ee.init(S,this,this.update.bind(this));var C=ee.get("element",this),I=Q.getService("element"),A=C&&I.isCanvas(C)?C:I.createCanvas(),y=C&&I.isImage(C)?C:I.createImage();this._canvasRenderer=new b(this,A,!0),this._imageRenderer=new q(this,y,y===C),this.update()},{get:function(){return ee.getAll(this)},set:function(S){ee.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new K({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){Q.setService(S.getName(),S)}});Object.defineProperties(ie.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var re=ie,fe=re,le=_.extend({getName:function(){}}),de=le,oe=de.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),me=oe,se=me.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),pe=se;fe.use(new pe);var we=fe;return we})})($u);var Nc=$u.exports;const Pc=Mc(Nc);function Tc(t){let e,l;return{c(){e=p("img"),hi(e.src,l=t[2])||u(e,"src",l),u(e,"alt",t[0]),u(e,"class",t[1])},m(n,i){P(n,e,i)},p(n,[i]){i&4&&!hi(e.src,l=n[2])&&u(e,"src",l),i&1&&u(e,"alt",n[0]),i&2&&u(e,"class",n[1])},i:je,o:je,d(n){n&&N(e)}}}function qc(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:o="#000"}=e,{size:a="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function d(){_.set({background:i,foreground:o,level:n,padding:f,size:a,value:r}),l(2,m=_.toDataURL("image/jpeg"))}function h(){return m}return so(()=>{l(9,_=new Pc),r&&d()}),t.$$set=g=>{"errorCorrection"in g&&l(3,n=g.errorCorrection),"background"in g&&l(4,i=g.background),"color"in g&&l(5,o=g.color),"size"in g&&l(6,a=g.size),"value"in g&&l(0,r=g.value),"padding"in g&&l(7,f=g.padding),"className"in g&&l(1,c=g.className)},t.$$.update=()=>{t.$$.dirty&513&&r&&_&&d()},[r,c,m,n,i,o,a,f,h,_]}class Ec extends Tt{constructor(e){super(),Pt(this,e,qc,Tc,Ct,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function ea(t,e,l){const n=t.slice();return n[127]=e[l],n}function ta(t,e,l){const n=t.slice();return n[130]=e[l],n[131]=e,n[132]=l,n}function la(t,e,l){const n=t.slice();return n[133]=e[l],n[134]=e,n[135]=l,n}function na(t,e,l){const n=t.slice();return n[136]=e[l],n}function Dc(t,e,l){const n=t.slice();return n[139]=e[l],n}function Ac(t,e,l){const n=t.slice();return n[142]=e[l],n}function Lc(t,e,l){const n=t.slice();return n[145]=e[l],n}function ia(t){var ul,Ee,$,Oe,_l,it,Dt,al,ml,bl,fl,gl,kl,Rl,Fl,Bl,Ul,zl,jl,Hl,Wl,yl,Gl,Vl,Kl,Yl,ye,bt;let e,l,n=(((Ee=(ul=t[2].conf)==null?void 0:ul.general)==null?void 0:Ee.title)??"General")+"",i,o,a,r,f,c,m,_,d,h=(((Oe=($=t[2].conf)==null?void 0:$.general)==null?void 0:Oe.hostname)??"Hostname")+"",g,b,k,w,E,F,R=(((it=(_l=t[2].conf)==null?void 0:_l.general)==null?void 0:it.timezone)??"Time zone")+"",T,L,O,H,K,z,q,B,Z,V,Y,G=(((al=(Dt=t[2].conf)==null?void 0:Dt.price)==null?void 0:al.region)??"Price region")+"",U,W,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe,we,S,C,I,A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e=(((bl=(ml=t[2].conf)==null?void 0:ml.price)==null?void 0:bl.resolution)??"Resolution")+"",xe,ut,St,dt,rt,ot,ht=(((gl=(fl=t[2].conf)==null?void 0:fl.price)==null?void 0:gl.currency)??"Currency")+"",Ot,Je,Fe,He,tt,Ge,Ve,Qe,_e,ae,Te,Ke,Et=(((Rl=(kl=t[2].conf)==null?void 0:kl.price)==null?void 0:Rl.enabled)??"Enabled")+"",vt,Xe,qt,at,mt=(((Ul=(Bl=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:Bl.security)==null?void 0:Ul.title)??"Security")+"",lt,Bt,el,pt,nt,Qt=(((Hl=(jl=(zl=t[2].conf)==null?void 0:zl.general)==null?void 0:jl.security)==null?void 0:Hl.none)??"None")+"",Jt,It,Zt=(((Gl=(yl=(Wl=t[2].conf)==null?void 0:Wl.general)==null?void 0:yl.security)==null?void 0:Gl.conf)??"Conf")+"",$t,Gt,Xt=(((Yl=(Kl=(Vl=t[2].conf)==null?void 0:Vl.general)==null?void 0:Kl.security)==null?void 0:Yl.all)??"All")+"",ll,Ye,st,Mt,Rt=(((bt=(ye=t[2].conf)==null?void 0:ye.general)==null?void 0:bt.context)??"Context")+"",kt,gt,jt,et,Ft,he,Ie,We;K=new wc({});let Vt=!t[6].p.t&&oa(),Kt=ft([15,60]),wt=[];for(let ze=0;ze<2;ze+=1)wt[ze]=Oc(Lc(t,Kt,ze));let cl=ft(["NOK","SEK","DKK","EUR","CHF"]),ol=[];for(let ze=0;ze<5;ze+=1)ol[ze]=Ic(Ac(t,cl,ze));Ve=new wl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[Rc]},$$scope:{ctx:t}}});let Ht=t[6].p.e&&t[0].chip!="esp8266"&&t[6].p.t&&sa(t),Wt=t[6].g.s>0&&aa(t);return{c(){var ze,At;e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),d=p("div"),g=M(h),b=p("br"),k=v(),w=p("input"),E=v(),F=p("div"),T=M(R),L=p("br"),O=v(),H=p("select"),Me(K.$$.fragment),z=v(),q=p("input"),B=v(),Z=p("div"),V=p("div"),Y=p("div"),U=M(G),W=p("br"),ne=v(),ee=p("select"),Q=p("optgroup"),Vt&&Vt.c(),ie=p("option"),ie.textContent="NO1",re=p("option"),re.textContent="NO2",fe=p("option"),fe.textContent="NO3",le=p("option"),le.textContent="NO4",de=p("option"),de.textContent="NO5",oe=p("optgroup"),me=p("option"),me.textContent="SE1",se=p("option"),se.textContent="SE2",pe=p("option"),pe.textContent="SE3",we=p("option"),we.textContent="SE4",S=p("optgroup"),C=p("option"),C.textContent="DK1",I=p("option"),I.textContent="DK2",A=p("option"),A.textContent="Austria",y=p("option"),y.textContent="Belgium",te=p("option"),te.textContent="Czech Republic",ue=p("option"),ue.textContent="Estonia",be=p("option"),be.textContent="Finland",ke=p("option"),ke.textContent="France",J=p("option"),J.textContent="Germany",ve=p("option"),ve.textContent="Great Britain",ge=p("option"),ge.textContent="Latvia",qe=p("option"),qe.textContent="Lithuania",Pe=p("option"),Pe.textContent="Netherland",Ae=p("option"),Ae.textContent="Poland",Le=p("option"),Le.textContent="Slovenia",Ne=p("option"),Ne.textContent="Switzerland",De=v(),Re=p("div"),xe=M($e),ut=p("br"),St=v(),dt=p("select");for(let il=0;il<2;il+=1)wt[il].c();rt=v(),ot=p("div"),Ot=M(ht),Je=p("br"),Fe=v(),He=p("select");for(let il=0;il<5;il+=1)ol[il].c();tt=v(),Ge=p("div"),Me(Ve.$$.fragment),Qe=v(),_e=p("div"),ae=p("label"),Te=p("input"),Ke=v(),vt=M(Et),Xe=v(),Ht&&Ht.c(),qt=v(),at=p("div"),lt=M(mt),Bt=p("br"),el=v(),pt=p("select"),nt=p("option"),Jt=M(Qt),It=p("option"),$t=M(Zt),Gt=p("option"),ll=M(Xt),Ye=v(),Wt&&Wt.c(),st=v(),Mt=p("div"),kt=M(Rt),gt=p("br"),jt=v(),et=p("input"),u(l,"class","text-sm"),u(a,"href",vl("General-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","g"),f.value="true",u(w,"name","gh"),u(w,"type","text"),u(w,"class","in-f w-full"),u(w,"pattern",Ci),u(H,"name","gt"),u(H,"class","in-l w-full"),t[6].g.t===void 0&&Nt(()=>t[26].call(H)),u(_,"class","flex"),u(m,"class","my-1"),u(q,"type","hidden"),u(q,"name","p"),q.value="true",ie.__value="10YNO-1--------2",j(ie,ie.__value),re.__value="10YNO-2--------T",j(re,re.__value),fe.__value="10YNO-3--------J",j(fe,fe.__value),le.__value="10YNO-4--------9",j(le,le.__value),de.__value="10Y1001A1001A48H",j(de,de.__value),u(Q,"label","Norway"),me.__value="10Y1001A1001A44P",j(me,me.__value),se.__value="10Y1001A1001A45N",j(se,se.__value),pe.__value="10Y1001A1001A46L",j(pe,pe.__value),we.__value="10Y1001A1001A47J",j(we,we.__value),u(oe,"label","Sweden"),C.__value="10YDK-1--------W",j(C,C.__value),I.__value="10YDK-2--------M",j(I,I.__value),u(S,"label","Denmark"),A.__value="10YAT-APG------L",j(A,A.__value),y.__value="10YBE----------2",j(y,y.__value),te.__value="10YCZ-CEPS-----N",j(te,te.__value),ue.__value="10Y1001A1001A39I",j(ue,ue.__value),be.__value="10YFI-1--------U",j(be,be.__value),ke.__value="10YFR-RTE------C",j(ke,ke.__value),J.__value="10Y1001A1001A83F",j(J,J.__value),ve.__value="10YGB----------A",j(ve,ve.__value),ge.__value="10YLV-1001A00074",j(ge,ge.__value),qe.__value="10YLT-1001A0008Q",j(qe,qe.__value),Pe.__value="10YNL----------L",j(Pe,Pe.__value),Ae.__value="10YPL-AREA-----S",j(Ae,Ae.__value),Le.__value="10YSI-ELES-----O",j(Le,Le.__value),Ne.__value="10YCH-SWISSGRIDZ",j(Ne,Ne.__value),u(ee,"name","pr"),u(ee,"class","in-f w-full"),t[6].p.r===void 0&&Nt(()=>t[27].call(ee)),u(Y,"class","w-full"),u(dt,"name","pm"),u(dt,"class","in-m"),t[6].p.m===void 0&&Nt(()=>t[28].call(dt)),u(He,"name","pc"),u(He,"class","in-l"),t[6].p.c===void 0&&Nt(()=>t[29].call(He)),u(V,"class","flex"),u(Z,"class","my-1"),u(Ge,"class","my-1"),u(Te,"type","checkbox"),u(Te,"name","pe"),Te.__value="true",j(Te,Te.__value),u(Te,"class","rounded mb-1"),u(_e,"class","my-1"),nt.__value=0,j(nt,nt.__value),It.__value=1,j(It,It.__value),Gt.__value=2,j(Gt,Gt.__value),u(pt,"name","gs"),u(pt,"class","in-s"),t[6].g.s===void 0&&Nt(()=>t[32].call(pt)),u(at,"class","my-1"),u(et,"name","gc"),u(et,"type","text"),u(et,"pattern",Ci),u(et,"placeholder",Ft=((At=(ze=t[2].conf)==null?void 0:ze.general)==null?void 0:At.context_placeholder)??"/"),u(et,"class","in-s"),u(et,"maxlength","36"),u(Mt,"class","my-1"),u(e,"class","cnt")},m(ze,At){P(ze,e,At),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),s(d,g),s(d,b),s(d,k),s(d,w),j(w,t[6].g.h),s(_,E),s(_,F),s(F,T),s(F,L),s(F,O),s(F,H),Ce(K,H,null),Ue(H,t[6].g.t,!0),s(e,z),s(e,q),s(e,B),s(e,Z),s(Z,V),s(V,Y),s(Y,U),s(Y,W),s(Y,ne),s(Y,ee),s(ee,Q),Vt&&Vt.m(Q,null),s(Q,ie),s(Q,re),s(Q,fe),s(Q,le),s(Q,de),s(ee,oe),s(oe,me),s(oe,se),s(oe,pe),s(oe,we),s(ee,S),s(S,C),s(S,I),s(ee,A),s(ee,y),s(ee,te),s(ee,ue),s(ee,be),s(ee,ke),s(ee,J),s(ee,ve),s(ee,ge),s(ee,qe),s(ee,Pe),s(ee,Ae),s(ee,Le),s(ee,Ne),Ue(ee,t[6].p.r,!0),s(V,De),s(V,Re),s(Re,xe),s(Re,ut),s(Re,St),s(Re,dt);for(let il=0;il<2;il+=1)wt[il]&&wt[il].m(dt,null);Ue(dt,t[6].p.m,!0),s(V,rt),s(V,ot),s(ot,Ot),s(ot,Je),s(ot,Fe),s(ot,He);for(let il=0;il<5;il+=1)ol[il]&&ol[il].m(He,null);Ue(He,t[6].p.c,!0),s(e,tt),s(e,Ge),Ce(Ve,Ge,null),s(e,Qe),s(e,_e),s(_e,ae),s(ae,Te),Te.checked=t[6].p.e,s(ae,Ke),s(ae,vt),s(_e,Xe),Ht&&Ht.m(_e,null),s(e,qt),s(e,at),s(at,lt),s(at,Bt),s(at,el),s(at,pt),s(pt,nt),s(nt,Jt),s(pt,It),s(It,$t),s(pt,Gt),s(Gt,ll),Ue(pt,t[6].g.s,!0),s(e,Ye),Wt&&Wt.m(e,null),s(e,st),s(e,Mt),s(Mt,kt),s(Mt,gt),s(Mt,jt),s(Mt,et),j(et,t[6].g.c),he=!0,Ie||(We=[ce(w,"input",t[25]),ce(H,"change",t[26]),ce(ee,"change",t[27]),ce(ee,"change",t[22]),ce(dt,"change",t[28]),ce(He,"change",t[29]),ce(Te,"change",t[30]),ce(pt,"change",t[32]),ce(et,"input",t[35])],Ie=!0)},p(ze,At){var Ql,Xl,Zl,Jl,$l,xl,en,tn,Tn,qn,En,Dn,An,Ln,On,In,Rn,Fn,Bn,Un,zn,jn,Hn,Wn,yn,Gn,Vn,Kn,Yn,bo;(!he||At[0]&4)&&n!==(n=(((Xl=(Ql=ze[2].conf)==null?void 0:Ql.general)==null?void 0:Xl.title)??"General")+"")&&D(i,n),(!he||At[0]&4)&&h!==(h=(((Jl=(Zl=ze[2].conf)==null?void 0:Zl.general)==null?void 0:Jl.hostname)??"Hostname")+"")&&D(g,h),At[0]&64&&w.value!==ze[6].g.h&&j(w,ze[6].g.h),(!he||At[0]&4)&&R!==(R=(((xl=($l=ze[2].conf)==null?void 0:$l.general)==null?void 0:xl.timezone)??"Time zone")+"")&&D(T,R),At[0]&64&&Ue(H,ze[6].g.t),(!he||At[0]&4)&&G!==(G=(((tn=(en=ze[2].conf)==null?void 0:en.price)==null?void 0:tn.region)??"Price region")+"")&&D(U,G),ze[6].p.t?Vt&&(Vt.d(1),Vt=null):Vt||(Vt=oa(),Vt.c(),Vt.m(Q,ie)),At[0]&64&&Ue(ee,ze[6].p.r),(!he||At[0]&4)&&$e!==($e=(((qn=(Tn=ze[2].conf)==null?void 0:Tn.price)==null?void 0:qn.resolution)??"Resolution")+"")&&D(xe,$e),At[0]&64&&Ue(dt,ze[6].p.m),(!he||At[0]&4)&&ht!==(ht=(((Dn=(En=ze[2].conf)==null?void 0:En.price)==null?void 0:Dn.currency)??"Currency")+"")&&D(Ot,ht),At[0]&64&&Ue(He,ze[6].p.c);const il={};At[0]&4|At[4]&16777216&&(il.$$scope={dirty:At,ctx:ze}),Ve.$set(il),At[0]&64&&(Te.checked=ze[6].p.e),(!he||At[0]&4)&&Et!==(Et=(((Ln=(An=ze[2].conf)==null?void 0:An.price)==null?void 0:Ln.enabled)??"Enabled")+"")&&D(vt,Et),ze[6].p.e&&ze[0].chip!="esp8266"&&ze[6].p.t?Ht?Ht.p(ze,At):(Ht=sa(ze),Ht.c(),Ht.m(_e,null)):Ht&&(Ht.d(1),Ht=null),(!he||At[0]&4)&&mt!==(mt=(((Rn=(In=(On=ze[2].conf)==null?void 0:On.general)==null?void 0:In.security)==null?void 0:Rn.title)??"Security")+"")&&D(lt,mt),(!he||At[0]&4)&&Qt!==(Qt=(((Un=(Bn=(Fn=ze[2].conf)==null?void 0:Fn.general)==null?void 0:Bn.security)==null?void 0:Un.none)??"None")+"")&&D(Jt,Qt),(!he||At[0]&4)&&Zt!==(Zt=(((Hn=(jn=(zn=ze[2].conf)==null?void 0:zn.general)==null?void 0:jn.security)==null?void 0:Hn.conf)??"Conf")+"")&&D($t,Zt),(!he||At[0]&4)&&Xt!==(Xt=(((Gn=(yn=(Wn=ze[2].conf)==null?void 0:Wn.general)==null?void 0:yn.security)==null?void 0:Gn.all)??"All")+"")&&D(ll,Xt),At[0]&64&&Ue(pt,ze[6].g.s),ze[6].g.s>0?Wt?Wt.p(ze,At):(Wt=aa(ze),Wt.c(),Wt.m(e,st)):Wt&&(Wt.d(1),Wt=null),(!he||At[0]&4)&&Rt!==(Rt=(((Kn=(Vn=ze[2].conf)==null?void 0:Vn.general)==null?void 0:Kn.context)??"Context")+"")&&D(kt,Rt),(!he||At[0]&4&&Ft!==(Ft=((bo=(Yn=ze[2].conf)==null?void 0:Yn.general)==null?void 0:bo.context_placeholder)??"/"))&&u(et,"placeholder",Ft),At[0]&64&&et.value!==ze[6].g.c&&j(et,ze[6].g.c)},i(ze){he||(X(K.$$.fragment,ze),X(Ve.$$.fragment,ze),he=!0)},o(ze){x(K.$$.fragment,ze),x(Ve.$$.fragment,ze),he=!1},d(ze){ze&&N(e),Se(K),Vt&&Vt.d(),nl(wt,ze),nl(ol,ze),Se(Ve),Ht&&Ht.d(),Wt&&Wt.d(),Ie=!1,zt(We)}}}function oa(t){let e,l,n,i,o;return{c(){e=p("option"),e.textContent="NO1 w/support",l=p("option"),l.textContent="NO2 w/support",n=p("option"),n.textContent="NO3 w/support",i=p("option"),i.textContent="NO4 w/support",o=p("option"),o.textContent="NO5 w/support",e.__value="NO1S",j(e,e.__value),l.__value="NO2S",j(l,l.__value),n.__value="NO3S",j(n,n.__value),i.__value="NO4S",j(i,i.__value),o.__value="NO5S",j(o,o.__value)},m(a,r){P(a,e,r),P(a,l,r),P(a,n,r),P(a,i,r),P(a,o,r)},d(a){a&&(N(e),N(l),N(n),N(i),N(o))}}}function Oc(t){let e;return{c(){e=p("option"),e.textContent=`${t[145]}M`,e.__value=t[145],j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function Ic(t){let e;return{c(){e=p("option"),e.textContent=`${t[142]}`,e.__value=t[142],j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function Rc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.price)==null?void 0:f.conf)??"Configure")+"")&&D(l,e)},d(o){o&&N(l)}}}function sa(t){let e,l,n,i,o,a;return{c(){e=p("input"),l=v(),n=p("br"),i=p("input"),u(e,"name","pt"),u(e,"type","hidden"),u(i,"type","text"),u(i,"class","in-s"),u(i,"placeholder","ENTSO-E API key disabled, ref issue #1030"),i.disabled=!0},m(r,f){P(r,e,f),j(e,t[6].p.t),P(r,l,f),P(r,n,f),P(r,i,f),o||(a=ce(e,"input",t[31]),o=!0)},p(r,f){f[0]&64&&j(e,r[6].p.t)},d(r){r&&(N(e),N(l),N(n),N(i)),o=!1,a()}}}function aa(t){var k,w,E,F,R,T;let e,l=(((E=(w=(k=t[2].conf)==null?void 0:k.general)==null?void 0:w.security)==null?void 0:E.username)??"Username")+"",n,i,o,a,r,f,c=(((T=(R=(F=t[2].conf)==null?void 0:F.general)==null?void 0:R.security)==null?void 0:T.password)??"Password")+"",m,_,d,h,g,b;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),r=v(),f=p("div"),m=M(c),_=p("br"),d=v(),h=p("input"),u(a,"name","gu"),u(a,"type","text"),u(a,"class","in-s"),u(a,"maxlength","36"),u(a,"pattern",Il),u(e,"class","my-1"),u(h,"name","gp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"maxlength","36"),u(h,"pattern",Il),u(f,"class","my-1")},m(L,O){P(L,e,O),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].g.u),P(L,r,O),P(L,f,O),s(f,m),s(f,_),s(f,d),s(f,h),j(h,t[6].g.p),g||(b=[ce(a,"input",t[33]),ce(h,"input",t[34])],g=!0)},p(L,O){var H,K,z,q,B,Z;O[0]&4&&l!==(l=(((z=(K=(H=L[2].conf)==null?void 0:H.general)==null?void 0:K.security)==null?void 0:z.username)??"Username")+"")&&D(n,l),O[0]&64&&a.value!==L[6].g.u&&j(a,L[6].g.u),O[0]&4&&c!==(c=(((Z=(B=(q=L[2].conf)==null?void 0:q.general)==null?void 0:B.security)==null?void 0:Z.password)??"Password")+"")&&D(m,c),O[0]&64&&h.value!==L[6].g.p&&j(h,L[6].g.p)},d(L){L&&(N(e),N(r),N(f)),g=!1,zt(b)}}}function fa(t){var _e,ae,Te,Ke,Et,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Qt,Jt,It,Zt,$t,Gt,Xt,ll;let e,l,n=(((ae=(_e=t[2].conf)==null?void 0:_e.meter)==null?void 0:ae.title)??"Meter")+"",i,o,a,r,f,c,m,_,d,h=(((Et=(Ke=(Te=t[2].conf)==null?void 0:Te.meter)==null?void 0:Ke.comm)==null?void 0:Et.title)??"Communication")+"",g,b,k,w,E,F=(((qt=(Xe=(vt=t[2].conf)==null?void 0:vt.meter)==null?void 0:Xe.comm)==null?void 0:qt.passive)??"Passive")+"",R,T,L=(((lt=(mt=(at=t[2].conf)==null?void 0:at.meter)==null?void 0:mt.comm)==null?void 0:lt.pulse)??"Pulse")+"",O,H=(el=(Bt=t[0])==null?void 0:Bt.features)==null?void 0:el.includes("kmp"),K,z,q,B=(((pt=t[2].common)==null?void 0:pt.voltage)??"Voltage")+"",Z,V,Y,G,U,W,ne,ee,Q,ie=(((Qt=(nt=t[2].conf)==null?void 0:nt.meter)==null?void 0:Qt.fuse)??"Main fuse")+"",re,fe,le,de,oe,me,se,pe,we,S=(((It=(Jt=t[2].conf)==null?void 0:Jt.meter)==null?void 0:It.prod)??"Production")+"",C,I,A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le=((($t=(Zt=t[2].conf)==null?void 0:Zt.meter)==null?void 0:$t.encrypted)??"Encrypted")+"",Ne,De,Re,$e,xe,ut,St,dt=(((ll=(Xt=(Gt=t[2].conf)==null?void 0:Gt.meter)==null?void 0:Xt.multipliers)==null?void 0:ll.title)??"Multipliers")+"",rt,ot,ht,Ot,Je=H&&ua();function Fe(Ye,st){return Ye[6].m.a===2?Bc:Fc}let He=Fe(t),tt=He(t),Ge=t[6].m.e.e&&ra(t),Ve=t[6].m.e.e&&ca(t),Qe=t[6].m.m.e&&_a(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("input"),_=v(),d=p("div"),g=M(h),b=p("br"),k=v(),w=p("select"),E=p("option"),R=M(F),T=p("option"),O=M(L),Je&&Je.c(),K=v(),tt.c(),z=v(),q=p("div"),Z=M(B),V=p("br"),Y=v(),G=p("select"),U=p("option"),U.textContent="400V (TN)",W=p("option"),W.textContent="230V (IT/TT)",ne=v(),ee=p("div"),Q=p("div"),re=M(ie),fe=p("br"),le=v(),de=p("label"),oe=p("input"),me=v(),se=p("span"),se.textContent="A",pe=v(),we=p("div"),C=M(S),I=p("br"),A=v(),y=p("label"),te=p("input"),ue=v(),be=p("span"),be.textContent="kWp",ke=v(),J=p("div"),J.innerHTML="",ve=v(),ge=p("div"),qe=p("label"),Pe=p("input"),Ae=v(),Ne=M(Le),De=v(),Ge&&Ge.c(),Re=v(),Ve&&Ve.c(),$e=v(),xe=p("label"),ut=p("input"),St=v(),rt=M(dt),ot=v(),Qe&&Qe.c(),u(l,"class","text-sm"),u(a,"href",vl("Meter-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","m"),f.value="true",u(m,"type","hidden"),u(m,"name","mo"),m.value="1",E.__value=0,j(E,E.__value),T.__value=2,j(T,T.__value),u(w,"name","ma"),u(w,"class","in-s"),t[6].m.a===void 0&&Nt(()=>t[36].call(w)),u(d,"class","my-1"),U.__value=2,j(U,U.__value),W.__value=1,j(W,W.__value),u(G,"name","md"),u(G,"class","in-s"),t[6].m.d===void 0&&Nt(()=>t[42].call(G)),u(q,"class","my-1"),u(oe,"name","mf"),u(oe,"type","number"),u(oe,"min","5"),u(oe,"max","65535"),u(oe,"class","in-f tr w-full"),u(se,"class","in-post"),u(de,"class","flex"),u(Q,"class","mx-1"),u(te,"name","mr"),u(te,"type","number"),u(te,"min","0"),u(te,"max","65535"),u(te,"class","in-f tr w-full"),u(be,"class","in-post"),u(y,"class","flex"),u(we,"class","mx-1"),u(ee,"class","my-1 flex"),u(J,"class","my-1"),u(Pe,"type","checkbox"),u(Pe,"name","me"),Pe.__value="true",j(Pe,Pe.__value),u(Pe,"class","rounded mb-1"),u(ge,"class","my-1"),u(ut,"type","checkbox"),u(ut,"name","mm"),ut.__value="true",j(ut,ut.__value),u(ut,"class","rounded mb-1"),u(e,"class","cnt")},m(Ye,st){P(Ye,e,st),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(e,_),s(e,d),s(d,g),s(d,b),s(d,k),s(d,w),s(w,E),s(E,R),s(w,T),s(T,O),Je&&Je.m(w,null),Ue(w,t[6].m.a,!0),s(e,K),tt.m(e,null),s(e,z),s(e,q),s(q,Z),s(q,V),s(q,Y),s(q,G),s(G,U),s(G,W),Ue(G,t[6].m.d,!0),s(e,ne),s(e,ee),s(ee,Q),s(Q,re),s(Q,fe),s(Q,le),s(Q,de),s(de,oe),j(oe,t[6].m.f),s(de,me),s(de,se),s(ee,pe),s(ee,we),s(we,C),s(we,I),s(we,A),s(we,y),s(y,te),j(te,t[6].m.r),s(y,ue),s(y,be),s(e,ke),s(e,J),s(e,ve),s(e,ge),s(ge,qe),s(qe,Pe),Pe.checked=t[6].m.e.e,s(qe,Ae),s(qe,Ne),s(ge,De),Ge&&Ge.m(ge,null),s(e,Re),Ve&&Ve.m(e,null),s(e,$e),s(e,xe),s(xe,ut),ut.checked=t[6].m.m.e,s(xe,St),s(xe,rt),s(e,ot),Qe&&Qe.m(e,null),ht||(Ot=[ce(w,"change",t[36]),ce(G,"change",t[42]),ce(oe,"input",t[43]),ce(te,"input",t[44]),ce(Pe,"change",t[45]),ce(ut,"change",t[48])],ht=!0)},p(Ye,st){var Mt,Rt,kt,gt,jt,et,Ft,he,Ie,We,Vt,Kt,wt,cl,ol,Ht,Wt,ul,Ee,$,Oe,_l,it;st[0]&4&&n!==(n=(((Rt=(Mt=Ye[2].conf)==null?void 0:Mt.meter)==null?void 0:Rt.title)??"Meter")+"")&&D(i,n),st[0]&4&&h!==(h=(((jt=(gt=(kt=Ye[2].conf)==null?void 0:kt.meter)==null?void 0:gt.comm)==null?void 0:jt.title)??"Communication")+"")&&D(g,h),st[0]&4&&F!==(F=(((he=(Ft=(et=Ye[2].conf)==null?void 0:et.meter)==null?void 0:Ft.comm)==null?void 0:he.passive)??"Passive")+"")&&D(R,F),st[0]&4&&L!==(L=(((Vt=(We=(Ie=Ye[2].conf)==null?void 0:Ie.meter)==null?void 0:We.comm)==null?void 0:Vt.pulse)??"Pulse")+"")&&D(O,L),st[0]&1&&(H=(wt=(Kt=Ye[0])==null?void 0:Kt.features)==null?void 0:wt.includes("kmp")),H?Je||(Je=ua(),Je.c(),Je.m(w,null)):Je&&(Je.d(1),Je=null),st[0]&64&&Ue(w,Ye[6].m.a),He===(He=Fe(Ye))&&tt?tt.p(Ye,st):(tt.d(1),tt=He(Ye),tt&&(tt.c(),tt.m(e,z))),st[0]&4&&B!==(B=(((cl=Ye[2].common)==null?void 0:cl.voltage)??"Voltage")+"")&&D(Z,B),st[0]&64&&Ue(G,Ye[6].m.d),st[0]&4&&ie!==(ie=(((Ht=(ol=Ye[2].conf)==null?void 0:ol.meter)==null?void 0:Ht.fuse)??"Main fuse")+"")&&D(re,ie),st[0]&64&&Be(oe.value)!==Ye[6].m.f&&j(oe,Ye[6].m.f),st[0]&4&&S!==(S=(((ul=(Wt=Ye[2].conf)==null?void 0:Wt.meter)==null?void 0:ul.prod)??"Production")+"")&&D(C,S),st[0]&64&&Be(te.value)!==Ye[6].m.r&&j(te,Ye[6].m.r),st[0]&64&&(Pe.checked=Ye[6].m.e.e),st[0]&4&&Le!==(Le=((($=(Ee=Ye[2].conf)==null?void 0:Ee.meter)==null?void 0:$.encrypted)??"Encrypted")+"")&&D(Ne,Le),Ye[6].m.e.e?Ge?Ge.p(Ye,st):(Ge=ra(Ye),Ge.c(),Ge.m(ge,null)):Ge&&(Ge.d(1),Ge=null),Ye[6].m.e.e?Ve?Ve.p(Ye,st):(Ve=ca(Ye),Ve.c(),Ve.m(e,$e)):Ve&&(Ve.d(1),Ve=null),st[0]&64&&(ut.checked=Ye[6].m.m.e),st[0]&4&&dt!==(dt=(((it=(_l=(Oe=Ye[2].conf)==null?void 0:Oe.meter)==null?void 0:_l.multipliers)==null?void 0:it.title)??"Multipliers")+"")&&D(rt,dt),Ye[6].m.m.e?Qe?Qe.p(Ye,st):(Qe=_a(Ye),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Ye){Ye&&N(e),Je&&Je.d(),tt.d(),Ge&&Ge.d(),Ve&&Ve.d(),Qe&&Qe.d(),ht=!1,zt(Ot)}}}function ua(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,j(e,e.__value)},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Fc(t){var re,fe,le,de,oe,me;let e,l,n=(((fe=(re=t[2].conf)==null?void 0:re.meter)==null?void 0:fe.buffer)??"Buffer size")+"",i,o,a,r=(((de=(le=t[2].conf)==null?void 0:le.meter)==null?void 0:de.serial)??"Serial conf.")+"",f,c,m,_,d,h=(((me=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:me.inverted)??"inverted")+"",g,b,k,w,E,F,R,T,L,O,H,K,z,q,B,Z,V,Y,G,U,W,ne,ee,Q=ft([3,12,24,48,96,192,384,576,1152]),ie=[];for(let se=0;se<9;se+=1)ie[se]=Uc(Dc(t,Q,se));return{c(){e=p("div"),l=p("span"),i=M(n),o=v(),a=p("span"),f=M(r),c=v(),m=p("label"),_=p("input"),d=v(),g=M(h),b=v(),k=p("div"),w=p("select"),E=p("option"),F=M("Autodetect");for(let se=0;se<9;se+=1)ie[se].c();T=v(),L=p("select"),O=p("option"),H=M("-"),z=p("option"),z.textContent="7N1",q=p("option"),q.textContent="8N1",B=p("option"),B.textContent="8N2",Z=p("option"),Z.textContent="7E1",V=p("option"),V.textContent="8E1",G=v(),U=p("input"),u(l,"class","float-right"),u(_,"name","mi"),_.__value="true",j(_,_.__value),u(_,"type","checkbox"),u(_,"class","rounded mb-1"),u(m,"class","mt-2 ml-3 whitespace-nowrap"),E.__value=0,j(E,E.__value),E.disabled=R=t[6].m.b!=0,u(w,"name","mb"),u(w,"class","in-f tr w-1/2"),t[6].m.b===void 0&&Nt(()=>t[39].call(w)),O.__value=0,j(O,O.__value),O.disabled=K=t[6].m.b!=0,z.__value=2,j(z,z.__value),q.__value=3,j(q,q.__value),B.__value=7,j(B,B.__value),Z.__value=10,j(Z,Z.__value),V.__value=11,j(V,V.__value),u(L,"name","mp"),u(L,"class","in-m"),L.disabled=Y=t[6].m.b==0,t[6].m.p===void 0&&Nt(()=>t[40].call(L)),u(U,"name","ms"),u(U,"type","number"),u(U,"min",64),u(U,"max",W=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),u(U,"step",64),u(U,"class","in-l tr w-1/2"),u(k,"class","flex w-full"),u(e,"class","my-1")},m(se,pe){P(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(e,c),s(e,m),s(m,_),_.checked=t[6].m.i,s(m,d),s(m,g),s(e,b),s(e,k),s(k,w),s(w,E),s(E,F);for(let we=0;we<9;we+=1)ie[we]&&ie[we].m(w,null);Ue(w,t[6].m.b,!0),s(k,T),s(k,L),s(L,O),s(O,H),s(L,z),s(L,q),s(L,B),s(L,Z),s(L,V),Ue(L,t[6].m.p,!0),s(k,G),s(k,U),j(U,t[6].m.s),ne||(ee=[ce(_,"change",t[38]),ce(w,"change",t[39]),ce(L,"change",t[40]),ce(U,"input",t[41])],ne=!0)},p(se,pe){var we,S,C,I,A,y;pe[0]&4&&n!==(n=(((S=(we=se[2].conf)==null?void 0:we.meter)==null?void 0:S.buffer)??"Buffer size")+"")&&D(i,n),pe[0]&4&&r!==(r=(((I=(C=se[2].conf)==null?void 0:C.meter)==null?void 0:I.serial)??"Serial conf.")+"")&&D(f,r),pe[0]&64&&(_.checked=se[6].m.i),pe[0]&4&&h!==(h=(((y=(A=se[2].conf)==null?void 0:A.meter)==null?void 0:y.inverted)??"inverted")+"")&&D(g,h),pe[0]&64&&R!==(R=se[6].m.b!=0)&&(E.disabled=R),pe[0]&64&&Ue(w,se[6].m.b),pe[0]&64&&K!==(K=se[6].m.b!=0)&&(O.disabled=K),pe[0]&64&&Y!==(Y=se[6].m.b==0)&&(L.disabled=Y),pe[0]&64&&Ue(L,se[6].m.p),pe[0]&65&&W!==(W=se[0].chip=="esp8266"?se[6].i.h.p==3||se[6].i.h.p==113?512:256:4096)&&u(U,"max",W),pe[0]&64&&Be(U.value)!==se[6].m.s&&j(U,se[6].m.s)},d(se){se&&N(e),nl(ie,se),ne=!1,zt(ee)}}}function Bc(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,o,a,r,f;return{c(){e=p("div"),l=p("span"),i=M(n),o=v(),a=p("input"),u(a,"name","mb"),u(a,"class","in-s tr"),u(a,"type","number"),u(a,"min",1),u(a,"max",3600),u(e,"class","my-1")},m(_,d){P(_,e,d),s(e,l),s(l,i),s(e,o),s(e,a),j(a,t[6].m.b),r||(f=ce(a,"input",t[37]),r=!0)},p(_,d){var h,g;d[0]&4&&n!==(n=(((g=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:g.pulses)??"Pulses per kWh")+"")&&D(i,n),d[0]&64&&Be(a.value)!==_[6].m.b&&j(a,_[6].m.b)},d(_){_&&N(e),r=!1,f()}}}function Uc(t){let e;return{c(){e=p("option"),e.textContent=`${t[139]*100}`,e.__value=t[139]*100,j(e,e.__value)},m(l,n){P(l,e,n)},p:je,d(l){l&&N(e)}}}function ra(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s"),u(l,"pattern",Ru)},m(o,a){P(o,e,a),P(o,l,a),j(l,t[6].m.e.k),n||(i=ce(l,"input",t[46]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].m.e.k&&j(l,o[6].m.e.k)},d(o){o&&(N(e),N(l)),n=!1,i()}}}function ca(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","mea"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",Ru),u(e,"class","my-1")},m(_,d){P(_,e,d),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].m.e.a),r||(f=ce(a,"input",t[47]),r=!0)},p(_,d){var h,g;d[0]&4&&l!==(l=(((g=(h=_[2].conf)==null?void 0:h.meter)==null?void 0:g.authkey)??"Authentication key")+"")&&D(n,l),d[0]&64&&a.value!==_[6].m.e.a&&j(a,_[6].m.e.a)},d(_){_&&N(e),r=!1,f()}}}function _a(t){var Y,G,U,W,ne,ee,Q,ie,re,fe,le,de;let e,l,n=(((U=(G=(Y=t[2].conf)==null?void 0:Y.meter)==null?void 0:G.multipliers)==null?void 0:U.watt)??"Watt")+"",i,o,a,r,f,c,m=(((ee=(ne=(W=t[2].conf)==null?void 0:W.meter)==null?void 0:ne.multipliers)==null?void 0:ee.volt)??"Volt")+"",_,d,h,g,b,k,w=(((re=(ie=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ie.multipliers)==null?void 0:re.amp)??"Amp")+"",E,F,R,T,L,O,H=(((de=(le=(fe=t[2].conf)==null?void 0:fe.meter)==null?void 0:le.multipliers)==null?void 0:de.kwh)??"kWh")+"",K,z,q,B,Z,V;return{c(){e=p("div"),l=p("div"),i=M(n),o=p("br"),a=v(),r=p("input"),f=v(),c=p("div"),_=M(m),d=p("br"),h=v(),g=p("input"),b=v(),k=p("div"),E=M(w),F=p("br"),R=v(),T=p("input"),L=v(),O=p("div"),K=M(H),z=p("br"),q=v(),B=p("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(g,"name","mmv"),u(g,"type","number"),u(g,"min","0.00"),u(g,"max","1000"),u(g,"step","0.001"),u(g,"class","in-m tr w-full"),u(c,"class","w-1/4"),u(T,"name","mma"),u(T,"type","number"),u(T,"min","0.00"),u(T,"max","1000"),u(T,"step","0.001"),u(T,"class","in-m tr w-full"),u(k,"class","w-1/4"),u(B,"name","mmc"),u(B,"type","number"),u(B,"min","0.00"),u(B,"max","1000"),u(B,"step","0.001"),u(B,"class","in-l tr w-full"),u(O,"class","w-1/4"),u(e,"class","flex my-1")},m(oe,me){P(oe,e,me),s(e,l),s(l,i),s(l,o),s(l,a),s(l,r),j(r,t[6].m.m.w),s(e,f),s(e,c),s(c,_),s(c,d),s(c,h),s(c,g),j(g,t[6].m.m.v),s(e,b),s(e,k),s(k,E),s(k,F),s(k,R),s(k,T),j(T,t[6].m.m.a),s(e,L),s(e,O),s(O,K),s(O,z),s(O,q),s(O,B),j(B,t[6].m.m.c),Z||(V=[ce(r,"input",t[49]),ce(g,"input",t[50]),ce(T,"input",t[51]),ce(B,"input",t[52])],Z=!0)},p(oe,me){var se,pe,we,S,C,I,A,y,te,ue,be,ke;me[0]&4&&n!==(n=(((we=(pe=(se=oe[2].conf)==null?void 0:se.meter)==null?void 0:pe.multipliers)==null?void 0:we.watt)??"Watt")+"")&&D(i,n),me[0]&64&&Be(r.value)!==oe[6].m.m.w&&j(r,oe[6].m.m.w),me[0]&4&&m!==(m=(((I=(C=(S=oe[2].conf)==null?void 0:S.meter)==null?void 0:C.multipliers)==null?void 0:I.volt)??"Volt")+"")&&D(_,m),me[0]&64&&Be(g.value)!==oe[6].m.m.v&&j(g,oe[6].m.m.v),me[0]&4&&w!==(w=(((te=(y=(A=oe[2].conf)==null?void 0:A.meter)==null?void 0:y.multipliers)==null?void 0:te.amp)??"Amp")+"")&&D(E,w),me[0]&64&&Be(T.value)!==oe[6].m.m.a&&j(T,oe[6].m.m.a),me[0]&4&&H!==(H=(((ke=(be=(ue=oe[2].conf)==null?void 0:ue.meter)==null?void 0:be.multipliers)==null?void 0:ke.kwh)??"kWh")+"")&&D(K,H),me[0]&64&&Be(B.value)!==oe[6].m.m.c&&j(B,oe[6].m.m.c)},d(oe){oe&&N(e),Z=!1,zt(V)}}}function ma(t){var O,H,K,z,q,B;let e,l,n=(((H=(O=t[2].conf)==null?void 0:O.connection)==null?void 0:H.title)??"Connection")+"",i,o,a,r,f,c,m,_,d,h=(((z=(K=t[2].conf)==null?void 0:K.connection)==null?void 0:z.wifi)??"WiFi")+"",g,b,k=(((B=(q=t[2].conf)==null?void 0:q.connection)==null?void 0:B.ap)??"AP")+"",w,E,F,R,T=t[0].if&&t[0].if.eth&&pa(t),L=(t[6].n.c==1||t[6].n.c==2)&&da(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("select"),d=p("option"),g=M(h),b=p("option"),w=M(k),T&&T.c(),E=v(),L&&L.c(),u(l,"class","text-sm"),u(a,"href",vl("Network-connection")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","w"),f.value="true",d.__value=1,j(d,d.__value),b.__value=2,j(b,b.__value),u(_,"name","nc"),u(_,"class","in-s"),t[6].n.c===void 0&&Nt(()=>t[53].call(_)),u(m,"class","my-1"),u(e,"class","cnt")},m(Z,V){P(Z,e,V),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),s(d,g),s(_,b),s(b,w),T&&T.m(_,null),Ue(_,t[6].n.c,!0),s(e,E),L&&L.m(e,null),F||(R=ce(_,"change",t[53]),F=!0)},p(Z,V){var Y,G,U,W,ne,ee;V[0]&4&&n!==(n=(((G=(Y=Z[2].conf)==null?void 0:Y.connection)==null?void 0:G.title)??"Connection")+"")&&D(i,n),V[0]&4&&h!==(h=(((W=(U=Z[2].conf)==null?void 0:U.connection)==null?void 0:W.wifi)??"WiFi")+"")&&D(g,h),V[0]&4&&k!==(k=(((ee=(ne=Z[2].conf)==null?void 0:ne.connection)==null?void 0:ee.ap)??"AP")+"")&&D(w,k),Z[0].if&&Z[0].if.eth?T?T.p(Z,V):(T=pa(Z),T.c(),T.m(_,null)):T&&(T.d(1),T=null),V[0]&64&&Ue(_,Z[6].n.c),Z[6].n.c==1||Z[6].n.c==2?L?L.p(Z,V):(L=da(Z),L.c(),L.m(e,null)):L&&(L.d(1),L=null)},d(Z){Z&&N(e),T&&T.d(),L&&L.d(),F=!1,R()}}}function pa(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,j(e,e.__value)},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&D(n,l)},d(a){a&&N(e)}}}function da(t){var qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Ot,Je,Fe,He,tt,Ge,Ve,Qe;let e,l=(((Pe=(qe=t[2].conf)==null?void 0:qe.connection)==null?void 0:Pe.ssid)??"SSID")+"",n,i,o,a,r,f,c,m,_,d,h=(((Le=(Ae=t[2].conf)==null?void 0:Ae.connection)==null?void 0:Le.psk)??"Password")+"",g,b,k,w,E,F,R,T=(((Re=(De=(Ne=t[2].conf)==null?void 0:Ne.connection)==null?void 0:De.ps)==null?void 0:Re.title)??"Power saving")+"",L,O,H,K,z,q=(((ut=(xe=($e=t[2].conf)==null?void 0:$e.connection)==null?void 0:xe.ps)==null?void 0:ut.default)??"Default")+"",B,Z,V=(((rt=(dt=(St=t[2].conf)==null?void 0:St.connection)==null?void 0:dt.ps)==null?void 0:rt.off)??"Off")+"",Y,G,U=(((Ot=(ht=(ot=t[2].conf)==null?void 0:ot.connection)==null?void 0:ht.ps)==null?void 0:Ot.min)??"Min")+"",W,ne,ee=(((He=(Fe=(Je=t[2].conf)==null?void 0:Je.connection)==null?void 0:Fe.ps)==null?void 0:He.max)??"Max")+"",Q,ie,re,fe=(((Ge=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:Ge.pwr)??"Power")+"",le,de,oe,me,se,pe,we,S,C,I,A,y,te=(((Qe=(Ve=t[2].conf)==null?void 0:Ve.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",ue,be,ke;function J(_e,ae){return _e[8]?jc:zc}let ve=J(t),ge=ve(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("label"),a=p("input"),r=M(" manual"),f=v(),c=p("br"),m=v(),ge.c(),_=v(),d=p("div"),g=M(h),b=p("br"),k=v(),w=p("input"),E=v(),F=p("div"),R=p("div"),L=M(T),O=p("br"),H=v(),K=p("select"),z=p("option"),B=M(q),Z=p("option"),Y=M(V),G=p("option"),W=M(U),ne=p("option"),Q=M(ee),ie=v(),re=p("div"),le=M(fe),de=p("br"),oe=v(),me=p("div"),se=p("input"),pe=v(),we=p("span"),we.textContent="dBm",S=v(),C=p("div"),I=p("label"),A=p("input"),y=v(),ue=M(te),u(a,"type","checkbox"),a.__value="true",j(a,a.__value),u(a,"class","rounded mb-1"),u(o,"class","float-right mr-3"),u(e,"class","my-1"),u(w,"name","wp"),u(w,"type","password"),u(w,"class","in-s"),u(w,"pattern",Pn),u(d,"class","my-1"),z.__value=255,j(z,z.__value),Z.__value=0,j(Z,Z.__value),G.__value=1,j(G,G.__value),ne.__value=2,j(ne,ne.__value),u(K,"name","wz"),u(K,"class","in-s"),t[6].w.z===void 0&&Nt(()=>t[58].call(K)),u(R,"class","w-1/2"),u(se,"name","ww"),u(se,"type","number"),u(se,"min","0"),u(se,"max","20.5"),u(se,"step","0.5"),u(se,"class","in-f tr w-full"),u(we,"class","in-post"),u(me,"class","flex"),u(re,"class","ml-2 w-1/2"),u(F,"class","my-1 flex"),u(A,"type","checkbox"),u(A,"name","wb"),A.__value="true",j(A,A.__value),u(A,"class","rounded mb-1"),u(C,"class","my-3")},m(_e,ae){P(_e,e,ae),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[8],s(o,r),s(e,f),s(e,c),s(e,m),ge.m(e,null),P(_e,_,ae),P(_e,d,ae),s(d,g),s(d,b),s(d,k),s(d,w),j(w,t[6].w.p),P(_e,E,ae),P(_e,F,ae),s(F,R),s(R,L),s(R,O),s(R,H),s(R,K),s(K,z),s(z,B),s(K,Z),s(Z,Y),s(K,G),s(G,W),s(K,ne),s(ne,Q),Ue(K,t[6].w.z,!0),s(F,ie),s(F,re),s(re,le),s(re,de),s(re,oe),s(re,me),s(me,se),j(se,t[6].w.w),s(me,pe),s(me,we),P(_e,S,ae),P(_e,C,ae),s(C,I),s(I,A),A.checked=t[6].w.b,s(I,y),s(I,ue),be||(ke=[ce(a,"change",t[54]),ce(w,"input",t[57]),ce(K,"change",t[58]),ce(se,"input",t[59]),ce(A,"change",t[60])],be=!0)},p(_e,ae){var Te,Ke,Et,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Qt,Jt,It,Zt,$t,Gt,Xt,ll,Ye,st;ae[0]&4&&l!==(l=(((Ke=(Te=_e[2].conf)==null?void 0:Te.connection)==null?void 0:Ke.ssid)??"SSID")+"")&&D(n,l),ae[0]&256&&(a.checked=_e[8]),ve===(ve=J(_e))&&ge?ge.p(_e,ae):(ge.d(1),ge=ve(_e),ge&&(ge.c(),ge.m(e,null))),ae[0]&4&&h!==(h=(((vt=(Et=_e[2].conf)==null?void 0:Et.connection)==null?void 0:vt.psk)??"Password")+"")&&D(g,h),ae[0]&64&&w.value!==_e[6].w.p&&j(w,_e[6].w.p),ae[0]&4&&T!==(T=(((at=(qt=(Xe=_e[2].conf)==null?void 0:Xe.connection)==null?void 0:qt.ps)==null?void 0:at.title)??"Power saving")+"")&&D(L,T),ae[0]&4&&q!==(q=(((Bt=(lt=(mt=_e[2].conf)==null?void 0:mt.connection)==null?void 0:lt.ps)==null?void 0:Bt.default)??"Default")+"")&&D(B,q),ae[0]&4&&V!==(V=(((nt=(pt=(el=_e[2].conf)==null?void 0:el.connection)==null?void 0:pt.ps)==null?void 0:nt.off)??"Off")+"")&&D(Y,V),ae[0]&4&&U!==(U=(((It=(Jt=(Qt=_e[2].conf)==null?void 0:Qt.connection)==null?void 0:Jt.ps)==null?void 0:It.min)??"Min")+"")&&D(W,U),ae[0]&4&&ee!==(ee=(((Gt=($t=(Zt=_e[2].conf)==null?void 0:Zt.connection)==null?void 0:$t.ps)==null?void 0:Gt.max)??"Max")+"")&&D(Q,ee),ae[0]&64&&Ue(K,_e[6].w.z),ae[0]&4&&fe!==(fe=(((ll=(Xt=_e[2].conf)==null?void 0:Xt.connection)==null?void 0:ll.pwr)??"Power")+"")&&D(le,fe),ae[0]&64&&Be(se.value)!==_e[6].w.w&&j(se,_e[6].w.w),ae[0]&64&&(A.checked=_e[6].w.b),ae[0]&4&&te!==(te=(((st=(Ye=_e[2].conf)==null?void 0:Ye.connection)==null?void 0:st.tick_11b)??"802.11b")+"")&&D(ue,te)},d(_e){_e&&(N(e),N(_),N(d),N(E),N(F),N(S),N(C)),ge.d(),be=!1,zt(ke)}}}function zc(t){var f,c;let e,l,n,i,o,a=((f=t[9])==null?void 0:f.c)==-1&&ha(),r=((c=t[9])==null?void 0:c.n)&&va(t);return{c(){e=p("select"),a&&a.c(),l=yt(),r&&r.c(),u(e,"name","ws"),u(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&Nt(()=>t[56].call(e))},m(m,_){P(m,e,_),a&&a.m(e,null),s(e,l),r&&r.m(e,null),Ue(e,t[6].w.s,!0),i||(o=ce(e,"change",t[56]),i=!0)},p(m,_){var d,h;((d=m[9])==null?void 0:d.c)==-1?a||(a=ha(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(h=m[9])!=null&&h.n?r?r.p(m,_):(r=va(m),r.c(),r.m(e,null)):r&&(r.d(1),r=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&Ue(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),r&&r.d(),i=!1,o()}}}function jc(t){let e,l,n,i;return{c(){e=p("input"),u(e,"name","ws"),u(e,"type","text"),u(e,"class","in-s"),u(e,"pattern",Pn),e.required=l=t[6].n.c==1||t[6].n.c==2},m(o,a){P(o,e,a),j(e,t[6].w.s),n||(i=ce(e,"input",t[55]),n=!0)},p(o,a){a[0]&64&&l!==(l=o[6].n.c==1||o[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==o[6].w.s&&j(e,o[6].w.s)},d(o){o&&N(e),n=!1,i()}}}function ha(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",j(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function va(t){var i;let e,l=ft((i=t[9])==null?void 0:i.n),n=[];for(let o=0;ot[61].call(g)),u(L,"name","ni"),u(L,"type","text"),u(L,"class","in-m w-full"),L.disabled=O=t[6].n.m=="dhcp",L.required=H=t[6].n.m=="static",u(L,"pattern",_n),u(z,"name","ns"),u(z,"class","in-l"),z.disabled=B=t[6].n.m=="dhcp",z.required=Z=t[6].n.m=="static",t[6].n.s===void 0&&Nt(()=>t[63].call(z)),u(h,"class","flex"),u(f,"class","my-1"),u(W,"name","nx"),W.__value="true",j(W,W.__value),u(W,"type","checkbox"),u(W,"class","rounded mb-1"),u(G,"class","my-1"),u(re,"name","nd"),re.__value="true",j(re,re.__value),u(re,"type","checkbox"),u(re,"class","rounded mb-1"),u(Q,"class","my-1"),u(me,"type","hidden"),u(me,"name","ntp"),me.value="true",u(A,"name","ntpd"),A.__value="true",j(A,A.__value),u(A,"type","checkbox"),u(A,"class","rounded mb-1"),u(I,"class","ml-4"),u(ve,"name","ntph"),u(ve,"type","text"),u(ve,"class","in-s"),u(ve,"pattern",Il),u(J,"class","flex"),u(pe,"class","my-1"),u(e,"class","cnt")},m(Fe,He){P(Fe,e,He),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(f,m),s(f,_),s(f,d),s(f,h),s(h,g),s(g,b),s(b,w),s(g,E),s(E,R),Ue(g,t[6].n.m,!0),s(h,T),s(h,L),j(L,t[6].n.i),s(h,K),s(h,z),Ce(q,z,null),Ue(z,t[6].n.s,!0),s(e,V),Ae&&Ae.m(e,null),s(e,Y),s(e,G),s(G,U),s(U,W),W.checked=t[6].n.x,s(U,ne),s(e,ee),s(e,Q),s(Q,ie),s(ie,re),re.checked=t[6].n.d,s(ie,fe),s(ie,de),s(e,oe),s(e,me),s(e,se),s(e,pe),s(pe,S),s(pe,C),s(pe,I),s(I,A),A.checked=t[6].n.h,s(I,y),s(I,ue),s(pe,be),s(pe,ke),s(pe,J),s(J,ve),j(ve,t[6].n.n1),ge=!0,qe||(Pe=[ce(g,"change",t[61]),ce(L,"input",t[62]),ce(z,"change",t[63]),ce(W,"change",t[67]),ce(re,"change",t[68]),ce(A,"change",t[69]),ce(ve,"input",t[70])],qe=!0)},p(Fe,He){var tt,Ge,Ve,Qe,_e,ae,Te,Ke,Et,vt,Xe,qt,at,mt;(!ge||He[0]&4)&&n!==(n=(((Ge=(tt=Fe[2].conf)==null?void 0:tt.network)==null?void 0:Ge.title)??"Network")+"")&&D(i,n),(!ge||He[0]&4)&&c!==(c=(((Qe=(Ve=Fe[2].conf)==null?void 0:Ve.network)==null?void 0:Qe.ip)??"IP")+"")&&D(m,c),(!ge||He[0]&4)&&k!==(k=(((ae=(_e=Fe[2].conf)==null?void 0:_e.network)==null?void 0:ae.dhcp)??"DHCP")+"")&&D(w,k),(!ge||He[0]&4)&&F!==(F=(((Ke=(Te=Fe[2].conf)==null?void 0:Te.network)==null?void 0:Ke.static)??"Static")+"")&&D(R,F),He[0]&64&&Ue(g,Fe[6].n.m),(!ge||He[0]&64&&O!==(O=Fe[6].n.m=="dhcp"))&&(L.disabled=O),(!ge||He[0]&64&&H!==(H=Fe[6].n.m=="static"))&&(L.required=H),He[0]&64&&L.value!==Fe[6].n.i&&j(L,Fe[6].n.i),(!ge||He[0]&64&&B!==(B=Fe[6].n.m=="dhcp"))&&(z.disabled=B),(!ge||He[0]&64&&Z!==(Z=Fe[6].n.m=="static"))&&(z.required=Z),He[0]&64&&Ue(z,Fe[6].n.s),Fe[6].n.m=="static"?Ae?Ae.p(Fe,He):(Ae=ka(Fe),Ae.c(),Ae.m(e,Y)):Ae&&(Ae.d(1),Ae=null),He[0]&64&&(W.checked=Fe[6].n.x),He[0]&64&&(re.checked=Fe[6].n.d),(!ge||He[0]&4)&&le!==(le=(((vt=(Et=Fe[2].conf)==null?void 0:Et.network)==null?void 0:vt.tick_mdns)??"mDNS")+"")&&D(de,le),(!ge||He[0]&4)&&we!==(we=(((qt=(Xe=Fe[2].conf)==null?void 0:Xe.network)==null?void 0:qt.ntp)??"NTP")+"")&&D(S,we),He[0]&64&&(A.checked=Fe[6].n.h),(!ge||He[0]&4)&&te!==(te=(((mt=(at=Fe[2].conf)==null?void 0:at.network)==null?void 0:mt.tick_ntp_dhcp)??"from DHCP")+"")&&D(ue,te),He[0]&64&&ve.value!==Fe[6].n.n1&&j(ve,Fe[6].n.n1)},i(Fe){ge||(X(q.$$.fragment,Fe),ge=!0)},o(Fe){x(q.$$.fragment,Fe),ge=!1},d(Fe){Fe&&N(e),Se(q),Ae&&Ae.d(),qe=!1,zt(Pe)}}}function ka(t){var F,R,T,L;let e,l=(((R=(F=t[2].conf)==null?void 0:F.network)==null?void 0:R.gw)??"Gateway")+"",n,i,o,a,r,f,c=(((L=(T=t[2].conf)==null?void 0:T.network)==null?void 0:L.dns)??"DNS")+"",m,_,d,h,g,b,k,w,E;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),r=v(),f=p("div"),m=M(c),_=p("br"),d=v(),h=p("div"),g=p("input"),b=v(),k=p("input"),u(a,"name","ng"),u(a,"type","text"),u(a,"class","in-s"),u(a,"pattern",_n),u(e,"class","my-1"),u(g,"name","nd1"),u(g,"type","text"),u(g,"class","in-f w-full"),u(g,"pattern",_n),u(k,"name","nd2"),u(k,"type","text"),u(k,"class","in-l w-full"),u(k,"pattern",_n),u(h,"class","flex"),u(f,"class","my-1")},m(O,H){P(O,e,H),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].n.g),P(O,r,H),P(O,f,H),s(f,m),s(f,_),s(f,d),s(f,h),s(h,g),j(g,t[6].n.d1),s(h,b),s(h,k),j(k,t[6].n.d2),w||(E=[ce(a,"input",t[64]),ce(g,"input",t[65]),ce(k,"input",t[66])],w=!0)},p(O,H){var K,z,q,B;H[0]&4&&l!==(l=(((z=(K=O[2].conf)==null?void 0:K.network)==null?void 0:z.gw)??"Gateway")+"")&&D(n,l),H[0]&64&&a.value!==O[6].n.g&&j(a,O[6].n.g),H[0]&4&&c!==(c=(((B=(q=O[2].conf)==null?void 0:q.network)==null?void 0:B.dns)??"DNS")+"")&&D(m,c),H[0]&64&&g.value!==O[6].n.d1&&j(g,O[6].n.d1),H[0]&64&&k.value!==O[6].n.d2&&j(k,O[6].n.d2)},d(O){O&&(N(e),N(r),N(f)),w=!1,zt(E)}}}function wa(t){var cl,ol,Ht,Wt,ul,Ee,$,Oe,_l,it,Dt,al,ml,bl,fl,gl,kl,Rl,Fl,Bl,Ul,zl,jl,Hl,Wl,yl,Gl,Vl,Kl,Yl;let e,l,n=(((ol=(cl=t[2].conf)==null?void 0:cl.mqtt)==null?void 0:ol.title)??"MQTT")+"",i,o,a,r,f,c,m,_=(((Wt=(Ht=t[2].conf)==null?void 0:Ht.mqtt)==null?void 0:Wt.server)??"Server")+"",d,h,g,b,k,w,E,F,R,T,L,O,H=(((Ee=(ul=t[2].conf)==null?void 0:ul.mqtt)==null?void 0:Ee.user)??"Username")+"",K,z,q,B,Z,V,Y=(((Oe=($=t[2].conf)==null?void 0:$.mqtt)==null?void 0:Oe.pass)??"Password")+"",G,U,W,ne,ee,Q,ie,re=(((it=(_l=t[2].conf)==null?void 0:_l.mqtt)==null?void 0:it.id)??"Client ID")+"",fe,le,de,oe,me,se,pe,we=(((al=(Dt=t[2].conf)==null?void 0:Dt.mqtt)==null?void 0:al.payload)??"Payload")+"",S,C,I,A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae=(((bl=(ml=t[2].conf)==null?void 0:ml.mqtt)==null?void 0:bl.publish)??"Publish topic")+"",Le,Ne,De,Re,$e,xe,ut=(((gl=(fl=t[2].conf)==null?void 0:fl.mqtt)==null?void 0:gl.subscribe)??"Subscribe topic")+"",St,dt,rt,ot,ht,Ot,Je,Fe=(((Rl=(kl=t[2].conf)==null?void 0:kl.mqtt)==null?void 0:Rl.update)??"Update method")+"",He,tt,Ge,Ve=(((Bl=(Fl=t[2].conf)==null?void 0:Fl.mqtt)==null?void 0:Bl.interval)??"Interval")+"",Qe,_e,ae,Te,Ke,Et=(((zl=(Ul=t[2].conf)==null?void 0:Ul.mqtt)==null?void 0:zl.realtime)??"Real time")+"",vt,Xe,qt=(((Hl=(jl=t[2].conf)==null?void 0:jl.mqtt)==null?void 0:Hl.interval)??"Interval")+"",at,mt,lt,Bt,el,pt,nt,Qt,Jt=(((yl=(Wl=t[2].conf)==null?void 0:Wl.mqtt)==null?void 0:yl.timeout)??"Timeout")+"",It,Zt,$t,Gt=(((Vl=(Gl=t[2].conf)==null?void 0:Gl.mqtt)==null?void 0:Vl.keepalive)??"Keep-alive")+"",Xt,ll,Ye,st=(((Yl=(Kl=t[2].conf)==null?void 0:Kl.mqtt)==null?void 0:Yl.autoreboot)??"Auto-reboot")+"",Mt,Rt,kt,gt,jt,et,Ft,he,Ie,We,Vt,Kt=t[0].chip!="esp8266"&&Ca(t),wt=t[6].q.s.e&&Sa(t);return{c(){var ye,bt;e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=M(_),h=v(),Kt&&Kt.c(),g=v(),b=p("br"),k=v(),w=p("div"),E=p("input"),F=v(),R=p("input"),T=v(),wt&&wt.c(),L=v(),O=p("div"),K=M(H),z=p("br"),q=v(),B=p("input"),Z=v(),V=p("div"),G=M(Y),U=p("br"),W=v(),ne=p("input"),ee=v(),Q=p("div"),ie=p("div"),fe=M(re),le=p("br"),de=v(),oe=p("input"),se=v(),pe=p("div"),S=M(we),C=p("br"),I=v(),A=p("select"),y=p("option"),y.textContent="Raw (minimal)",te=p("option"),te.textContent="Raw (full)",ue=p("option"),ue.textContent="Domoticz",be=p("option"),be.textContent="Home-Assistant",ke=p("option"),ke.textContent="JSON (classic)",J=p("option"),J.textContent="JSON (multi topic)",ve=p("option"),ve.textContent="JSON (flat)",ge=p("option"),ge.textContent="HEX dump",qe=v(),Pe=p("div"),Le=M(Ae),Ne=p("br"),De=v(),Re=p("input"),$e=v(),xe=p("div"),St=M(ut),dt=p("br"),rt=v(),ot=p("input"),Ot=v(),Je=p("div"),He=M(Fe),tt=v(),Ge=p("span"),Qe=M(Ve),_e=v(),ae=p("div"),Te=p("select"),Ke=p("option"),vt=M(Et),Xe=p("option"),at=M(qt),mt=v(),lt=p("input"),el=v(),pt=p("div"),nt=p("div"),Qt=p("p"),It=M(Jt),Zt=v(),$t=p("p"),Xt=M(Gt),ll=v(),Ye=p("p"),Mt=M(st),Rt=v(),kt=p("div"),gt=p("input"),jt=v(),et=p("input"),Ft=v(),he=p("input"),u(l,"class","text-sm"),u(a,"href",vl("MQTT-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","q"),f.value="true",u(E,"name","qh"),u(E,"type","text"),u(E,"class","in-f w-2/3"),u(E,"pattern",Il),u(R,"name","qp"),u(R,"type","number"),u(R,"min","1024"),u(R,"max","65535"),u(R,"class","in-l tr w-1/3"),u(w,"class","flex"),u(m,"class","my-1"),u(B,"name","qu"),u(B,"type","text"),u(B,"class","in-s"),u(B,"pattern",Pn),u(O,"class","my-1"),u(ne,"name","qa"),u(ne,"type","password"),u(ne,"class","in-s"),u(ne,"pattern",Pn),u(V,"class","my-1"),u(oe,"name","qc"),u(oe,"type","text"),u(oe,"class","in-f w-full"),oe.required=me=t[6].q.h,u(oe,"pattern",Ci),y.__value=1,j(y,y.__value),te.__value=2,j(te,te.__value),ue.__value=3,j(ue,ue.__value),be.__value=4,j(be,be.__value),ke.__value=0,j(ke,ke.__value),J.__value=5,j(J,J.__value),ve.__value=6,j(ve,ve.__value),ge.__value=255,j(ge,ge.__value),u(A,"name","qm"),u(A,"class","in-l"),t[6].q.m===void 0&&Nt(()=>t[77].call(A)),u(Q,"class","my-1 flex"),u(Re,"name","qb"),u(Re,"type","text"),u(Re,"class","in-s"),u(Re,"pattern",Il),u(Pe,"class","my-1"),u(ot,"name","qr"),u(ot,"type","text"),u(ot,"class","in-s"),u(ot,"pattern",Il),u(ot,"placeholder",ht=t[6].q.b+"/command"),u(xe,"class","my-1"),u(Ge,"class","float-right"),Ke.__value=0,j(Ke,Ke.__value),Xe.__value=1,j(Xe,Xe.__value),u(Te,"name","qt"),u(Te,"class","in-f w-1/2"),t[6].q.t===void 0&&Nt(()=>t[80].call(Te)),u(lt,"name","qd"),u(lt,"type","number"),u(lt,"min","1"),u(lt,"max","3600"),u(lt,"class","in-l tr w-1/2"),lt.disabled=Bt=((bt=(ye=t[6])==null?void 0:ye.q)==null?void 0:bt.t)!=1,u(ae,"class","flex"),u(Je,"class","my-1"),u(nt,"class","grid grid-cols-3"),u(gt,"name","qi"),u(gt,"type","number"),u(gt,"min","500"),u(gt,"max","10000"),u(gt,"class","in-f tr w-1/2"),u(et,"name","qk"),u(et,"type","number"),u(et,"min","5"),u(et,"max","180"),u(et,"class","in-m tr w-1/2"),u(he,"name","qe"),u(he,"type","number"),u(he,"min","0"),u(he,"max","240"),u(he,"class","in-l tr w-1/2"),u(kt,"class","flex"),u(pt,"class","my-1"),u(e,"class","cnt")},m(ye,bt){P(ye,e,bt),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,d),s(m,h),Kt&&Kt.m(m,null),s(m,g),s(m,b),s(m,k),s(m,w),s(w,E),j(E,t[6].q.h),s(w,F),s(w,R),j(R,t[6].q.p),s(e,T),wt&&wt.m(e,null),s(e,L),s(e,O),s(O,K),s(O,z),s(O,q),s(O,B),j(B,t[6].q.u),s(e,Z),s(e,V),s(V,G),s(V,U),s(V,W),s(V,ne),j(ne,t[6].q.a),s(e,ee),s(e,Q),s(Q,ie),s(ie,fe),s(ie,le),s(ie,de),s(ie,oe),j(oe,t[6].q.c),s(Q,se),s(Q,pe),s(pe,S),s(pe,C),s(pe,I),s(pe,A),s(A,y),s(A,te),s(A,ue),s(A,be),s(A,ke),s(A,J),s(A,ve),s(A,ge),Ue(A,t[6].q.m,!0),s(e,qe),s(e,Pe),s(Pe,Le),s(Pe,Ne),s(Pe,De),s(Pe,Re),j(Re,t[6].q.b),s(e,$e),s(e,xe),s(xe,St),s(xe,dt),s(xe,rt),s(xe,ot),j(ot,t[6].q.r),s(e,Ot),s(e,Je),s(Je,He),s(Je,tt),s(Je,Ge),s(Ge,Qe),s(Je,_e),s(Je,ae),s(ae,Te),s(Te,Ke),s(Ke,vt),s(Te,Xe),s(Xe,at),Ue(Te,t[6].q.t,!0),s(ae,mt),s(ae,lt),j(lt,t[6].q.d),s(e,el),s(e,pt),s(pt,nt),s(nt,Qt),s(Qt,It),s(nt,Zt),s(nt,$t),s($t,Xt),s(nt,ll),s(nt,Ye),s(Ye,Mt),s(pt,Rt),s(pt,kt),s(kt,gt),j(gt,t[6].q.i),s(kt,jt),s(kt,et),j(et,t[6].q.k),s(kt,Ft),s(kt,he),j(he,t[6].q.e),Ie=!0,We||(Vt=[ce(E,"input",t[72]),ce(R,"input",t[73]),ce(B,"input",t[74]),ce(ne,"input",t[75]),ce(oe,"input",t[76]),ce(A,"change",t[77]),ce(Re,"input",t[78]),ce(ot,"input",t[79]),ce(Te,"change",t[80]),ce(lt,"input",t[81]),ce(gt,"input",t[82]),ce(et,"input",t[83]),ce(he,"input",t[84])],We=!0)},p(ye,bt){var ze,At,il,Ql,Xl,Zl,Jl,$l,xl,en,tn,Tn,qn,En,Dn,An,Ln,On,In,Rn,Fn,Bn,Un,zn,jn,Hn,Wn,yn,Gn,Vn,Kn,Yn;(!Ie||bt[0]&4)&&n!==(n=(((At=(ze=ye[2].conf)==null?void 0:ze.mqtt)==null?void 0:At.title)??"MQTT")+"")&&D(i,n),(!Ie||bt[0]&4)&&_!==(_=(((Ql=(il=ye[2].conf)==null?void 0:il.mqtt)==null?void 0:Ql.server)??"Server")+"")&&D(d,_),ye[0].chip!="esp8266"?Kt?Kt.p(ye,bt):(Kt=Ca(ye),Kt.c(),Kt.m(m,g)):Kt&&(Kt.d(1),Kt=null),bt[0]&64&&E.value!==ye[6].q.h&&j(E,ye[6].q.h),bt[0]&64&&Be(R.value)!==ye[6].q.p&&j(R,ye[6].q.p),ye[6].q.s.e?wt?(wt.p(ye,bt),bt[0]&64&&X(wt,1)):(wt=Sa(ye),wt.c(),X(wt,1),wt.m(e,L)):wt&&(ct(),x(wt,1,1,()=>{wt=null}),_t()),(!Ie||bt[0]&4)&&H!==(H=(((Zl=(Xl=ye[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.user)??"Username")+"")&&D(K,H),bt[0]&64&&B.value!==ye[6].q.u&&j(B,ye[6].q.u),(!Ie||bt[0]&4)&&Y!==(Y=((($l=(Jl=ye[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.pass)??"Password")+"")&&D(G,Y),bt[0]&64&&ne.value!==ye[6].q.a&&j(ne,ye[6].q.a),(!Ie||bt[0]&4)&&re!==(re=(((en=(xl=ye[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.id)??"Client ID")+"")&&D(fe,re),(!Ie||bt[0]&64&&me!==(me=ye[6].q.h))&&(oe.required=me),bt[0]&64&&oe.value!==ye[6].q.c&&j(oe,ye[6].q.c),(!Ie||bt[0]&4)&&we!==(we=(((Tn=(tn=ye[2].conf)==null?void 0:tn.mqtt)==null?void 0:Tn.payload)??"Payload")+"")&&D(S,we),bt[0]&64&&Ue(A,ye[6].q.m),(!Ie||bt[0]&4)&&Ae!==(Ae=(((En=(qn=ye[2].conf)==null?void 0:qn.mqtt)==null?void 0:En.publish)??"Publish topic")+"")&&D(Le,Ae),bt[0]&64&&Re.value!==ye[6].q.b&&j(Re,ye[6].q.b),(!Ie||bt[0]&4)&&ut!==(ut=(((An=(Dn=ye[2].conf)==null?void 0:Dn.mqtt)==null?void 0:An.subscribe)??"Subscribe topic")+"")&&D(St,ut),(!Ie||bt[0]&64&&ht!==(ht=ye[6].q.b+"/command"))&&u(ot,"placeholder",ht),bt[0]&64&&ot.value!==ye[6].q.r&&j(ot,ye[6].q.r),(!Ie||bt[0]&4)&&Fe!==(Fe=(((On=(Ln=ye[2].conf)==null?void 0:Ln.mqtt)==null?void 0:On.update)??"Update method")+"")&&D(He,Fe),(!Ie||bt[0]&4)&&Ve!==(Ve=(((Rn=(In=ye[2].conf)==null?void 0:In.mqtt)==null?void 0:Rn.interval)??"Interval")+"")&&D(Qe,Ve),(!Ie||bt[0]&4)&&Et!==(Et=(((Bn=(Fn=ye[2].conf)==null?void 0:Fn.mqtt)==null?void 0:Bn.realtime)??"Real time")+"")&&D(vt,Et),(!Ie||bt[0]&4)&&qt!==(qt=(((zn=(Un=ye[2].conf)==null?void 0:Un.mqtt)==null?void 0:zn.interval)??"Interval")+"")&&D(at,qt),bt[0]&64&&Ue(Te,ye[6].q.t),(!Ie||bt[0]&64&&Bt!==(Bt=((Hn=(jn=ye[6])==null?void 0:jn.q)==null?void 0:Hn.t)!=1))&&(lt.disabled=Bt),bt[0]&64&&Be(lt.value)!==ye[6].q.d&&j(lt,ye[6].q.d),(!Ie||bt[0]&4)&&Jt!==(Jt=(((yn=(Wn=ye[2].conf)==null?void 0:Wn.mqtt)==null?void 0:yn.timeout)??"Timeout")+"")&&D(It,Jt),(!Ie||bt[0]&4)&&Gt!==(Gt=(((Vn=(Gn=ye[2].conf)==null?void 0:Gn.mqtt)==null?void 0:Vn.keepalive)??"Keep-alive")+"")&&D(Xt,Gt),(!Ie||bt[0]&4)&&st!==(st=(((Yn=(Kn=ye[2].conf)==null?void 0:Kn.mqtt)==null?void 0:Yn.autoreboot)??"Auto-reboot")+"")&&D(Mt,st),bt[0]&64&&Be(gt.value)!==ye[6].q.i&&j(gt,ye[6].q.i),bt[0]&64&&Be(et.value)!==ye[6].q.k&&j(et,ye[6].q.k),bt[0]&64&&Be(he.value)!==ye[6].q.e&&j(he,ye[6].q.e)},i(ye){Ie||(X(wt),Ie=!0)},o(ye){x(wt),Ie=!1},d(ye){ye&&N(e),Kt&&Kt.d(),wt&&wt.d(),We=!1,zt(Vt)}}}function Ca(t){let e,l,n,i,o;return{c(){e=p("label"),l=p("input"),n=M(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",j(l,l.__value),u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(a,r){P(a,e,r),s(e,l),l.checked=t[6].q.s.e,s(e,n),i||(o=[ce(l,"change",t[71]),ce(l,"change",t[20])],i=!0)},p(a,r){r[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,zt(o)}}}function Sa(t){let e,l,n,i,o,a,r,f,c,m,_,d,h;const g=[Wc,Hc],b=[];function k(O,H){return O[6].q.s.c?0:1}n=k(t),i=b[n]=g[n](t);const w=[Kc,Vc],E=[];function F(O,H){return O[6].q.s.r?0:1}r=F(t),f=E[r]=w[r](t);const R=[Zc,Xc],T=[];function L(O,H){return O[6].q.s.k?0:1}return _=L(t),d=T[_]=R[_](t),{c(){e=p("div"),l=p("span"),i.c(),o=v(),a=p("span"),f.c(),c=v(),m=p("span"),d.c(),u(l,"class","flex pr-2"),u(a,"class","flex pr-2"),u(m,"class","flex pr-2"),u(e,"class","my-1 flex")},m(O,H){P(O,e,H),s(e,l),b[n].m(l,null),s(e,o),s(e,a),E[r].m(a,null),s(e,c),s(e,m),T[_].m(m,null),h=!0},p(O,H){let K=n;n=k(O),n===K?b[n].p(O,H):(ct(),x(b[K],1,1,()=>{b[K]=null}),_t(),i=b[n],i?i.p(O,H):(i=b[n]=g[n](O),i.c()),X(i,1),i.m(l,null));let z=r;r=F(O),r===z?E[r].p(O,H):(ct(),x(E[z],1,1,()=>{E[z]=null}),_t(),f=E[r],f?f.p(O,H):(f=E[r]=w[r](O),f.c()),X(f,1),f.m(a,null));let q=_;_=L(O),_===q?T[_].p(O,H):(ct(),x(T[q],1,1,()=>{T[q]=null}),_t(),d=T[_],d?d.p(O,H):(d=T[_]=R[_](O),d.c()),X(d,1),d.m(m,null))},i(O){h||(X(i),X(f),X(d),h=!0)},o(O){x(i),x(f),x(d),h=!1},d(O){O&&N(e),b[n].d(),E[r].d(),T[_].d()}}}function Hc(t){let e,l;return e=new wl({props:{to:"/mqtt-ca",$$slots:{default:[yc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Wc(t){let e,l,n,i,o,a,r;return l=new wl({props:{to:"/mqtt-ca",$$slots:{default:[Gc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function yc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_ca)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function Gc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function Vc(t){let e,l;return e=new wl({props:{to:"/mqtt-cert",$$slots:{default:[Yc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Kc(t){let e,l,n,i,o,a,r;return l=new wl({props:{to:"/mqtt-cert",$$slots:{default:[Qc]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[18]),ce(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function Yc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_crt)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function Qc(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function Xc(t){let e,l;return e=new wl({props:{to:"/mqtt-key",$$slots:{default:[Jc]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Zc(t){let e,l,n,i,o,a,r;return l=new wl({props:{to:"/mqtt-key",$$slots:{default:[$c]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=v(),i=p("span"),i.textContent="🗑",u(e,"class","bd-on"),u(i,"class","bd-off")},m(f,c){P(f,e,c),Ce(l,e,null),P(f,n,c),P(f,i,c),o=!0,a||(r=[ce(i,"click",t[19]),ce(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,zt(r)}}}function Jc(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_key)??""}}),{c(){Me(e.$$.fragment)},m(r,f){Ce(e,r,f),l=!0},p(r,f){var m,_,d,h;const c={};f[0]&4&&(c.text=((_=(m=r[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((h=(d=r[2].conf)==null?void 0:d.mqtt)==null?void 0:h.title_key)??""),e.$set(c)},i(r){l||(X(e.$$.fragment,r),l=!0)},o(r){x(e.$$.fragment,r),l=!1},d(r){Se(e,r)}}}function $c(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=M(e)},m(o,a){P(o,l,a)},p(o,a){var r,f;a[0]&4&&e!==(e=(((f=(r=o[2].conf)==null?void 0:r.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function Ma(t){var Q,ie,re,fe,le,de,oe,me,se,pe,we,S;let e,l,n=(((re=(ie=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ie.domoticz)==null?void 0:re.title)??"Domoticz")+"",i,o,a,r,f,c,m,_,d=(((de=(le=(fe=t[2].conf)==null?void 0:fe.mqtt)==null?void 0:le.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"",h,g,b,k,w,E,F=(((se=(me=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:me.domoticz)==null?void 0:se.cidx)??"Current IDX")+"",R,T,L,O,H,K,z=(((S=(we=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:we.domoticz)==null?void 0:S.vidx)??"Voltage IDX")+"",q,B,Z,V,Y,G,U,W,ne,ee;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("div"),h=M(d),g=p("br"),b=v(),k=p("input"),w=v(),E=p("div"),R=M(F),T=p("br"),L=v(),O=p("input"),H=v(),K=p("div"),q=M(z),B=M(`: L1, L2 & L3 + `),Z=p("div"),V=p("input"),Y=v(),G=p("input"),U=v(),W=p("input"),u(l,"class","text-sm"),u(a,"href",vl("MQTT-configuration#domoticz")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","o"),f.value="true",u(k,"name","oe"),u(k,"type","text"),u(k,"class","in-f tr w-full"),u(k,"pattern",Qn),u(_,"class","w-1/2"),u(O,"name","oc"),u(O,"type","text"),u(O,"class","in-l tr w-full"),u(O,"pattern",Qn),u(E,"class","w-1/2"),u(m,"class","my-1 flex"),u(V,"name","ou1"),u(V,"type","text"),u(V,"class","in-f tr w-1/3"),u(V,"pattern",Qn),u(G,"name","ou2"),u(G,"type","text"),u(G,"class","in-m tr w-1/3"),u(G,"pattern",Qn),u(W,"name","ou3"),u(W,"type","text"),u(W,"class","in-l tr w-1/3"),u(W,"pattern",Qn),u(Z,"class","flex"),u(K,"class","my-1"),u(e,"class","cnt")},m(C,I){P(C,e,I),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,h),s(_,g),s(_,b),s(_,k),j(k,t[6].o.e),s(m,w),s(m,E),s(E,R),s(E,T),s(E,L),s(E,O),j(O,t[6].o.c),s(e,H),s(e,K),s(K,q),s(K,B),s(K,Z),s(Z,V),j(V,t[6].o.u1),s(Z,Y),s(Z,G),j(G,t[6].o.u2),s(Z,U),s(Z,W),j(W,t[6].o.u3),ne||(ee=[ce(k,"input",t[85]),ce(O,"input",t[86]),ce(V,"input",t[87]),ce(G,"input",t[88]),ce(W,"input",t[89])],ne=!0)},p(C,I){var A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae;I[0]&4&&n!==(n=(((te=(y=(A=C[2].conf)==null?void 0:A.mqtt)==null?void 0:y.domoticz)==null?void 0:te.title)??"Domoticz")+"")&&D(i,n),I[0]&4&&d!==(d=(((ke=(be=(ue=C[2].conf)==null?void 0:ue.mqtt)==null?void 0:be.domoticz)==null?void 0:ke.eidx)??"Electricity IDX")+"")&&D(h,d),I[0]&64&&k.value!==C[6].o.e&&j(k,C[6].o.e),I[0]&4&&F!==(F=(((ge=(ve=(J=C[2].conf)==null?void 0:J.mqtt)==null?void 0:ve.domoticz)==null?void 0:ge.cidx)??"Current IDX")+"")&&D(R,F),I[0]&64&&O.value!==C[6].o.c&&j(O,C[6].o.c),I[0]&4&&z!==(z=(((Ae=(Pe=(qe=C[2].conf)==null?void 0:qe.mqtt)==null?void 0:Pe.domoticz)==null?void 0:Ae.vidx)??"Voltage IDX")+"")&&D(q,z),I[0]&64&&V.value!==C[6].o.u1&&j(V,C[6].o.u1),I[0]&64&&G.value!==C[6].o.u2&&j(G,C[6].o.u2),I[0]&64&&W.value!==C[6].o.u3&&j(W,C[6].o.u3)},d(C){C&&N(e),ne=!1,zt(ee)}}}function Na(t){var U,W,ne,ee,Q,ie,re,fe,le,de,oe,me;let e,l,n=(((ne=(W=(U=t[2].conf)==null?void 0:U.mqtt)==null?void 0:W.ha)==null?void 0:ne.title)??"Home-Assistant")+"",i,o,a,r,f,c,m,_=(((ie=(Q=(ee=t[2].conf)==null?void 0:ee.mqtt)==null?void 0:Q.ha)==null?void 0:ie.discovery)??"Discovery topic prefix")+"",d,h,g,b,k,w,E=(((le=(fe=(re=t[2].conf)==null?void 0:re.mqtt)==null?void 0:fe.ha)==null?void 0:le.hostname)??"Hostname for URL")+"",F,R,T,L,O,H,K,z=(((me=(oe=(de=t[2].conf)==null?void 0:de.mqtt)==null?void 0:oe.ha)==null?void 0:me.tag)??"Name tag")+"",q,B,Z,V,Y,G;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),d=M(_),h=p("br"),g=v(),b=p("input"),k=v(),w=p("div"),F=M(E),R=p("br"),T=v(),L=p("input"),H=v(),K=p("div"),q=M(z),B=p("br"),Z=v(),V=p("input"),u(l,"class","text-sm"),u(a,"href",vl("MQTT-configuration#home-assistant")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","h"),f.value="true",u(b,"name","ht"),u(b,"type","text"),u(b,"class","in-s"),u(b,"placeholder","homeassistant"),u(b,"pattern",Il),u(m,"class","my-1"),u(L,"name","hh"),u(L,"type","text"),u(L,"class","in-s"),u(L,"placeholder",O=t[6].g.h+".local"),u(L,"pattern",Il),u(w,"class","my-1"),u(V,"name","hn"),u(V,"type","text"),u(V,"class","in-s"),u(V,"pattern",Il),u(K,"class","my-1"),u(e,"class","cnt")},m(se,pe){P(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,d),s(m,h),s(m,g),s(m,b),j(b,t[6].h.t),s(e,k),s(e,w),s(w,F),s(w,R),s(w,T),s(w,L),j(L,t[6].h.h),s(e,H),s(e,K),s(K,q),s(K,B),s(K,Z),s(K,V),j(V,t[6].h.n),Y||(G=[ce(b,"input",t[90]),ce(L,"input",t[91]),ce(V,"input",t[92])],Y=!0)},p(se,pe){var we,S,C,I,A,y,te,ue,be,ke,J,ve;pe[0]&4&&n!==(n=(((C=(S=(we=se[2].conf)==null?void 0:we.mqtt)==null?void 0:S.ha)==null?void 0:C.title)??"Home-Assistant")+"")&&D(i,n),pe[0]&4&&_!==(_=(((y=(A=(I=se[2].conf)==null?void 0:I.mqtt)==null?void 0:A.ha)==null?void 0:y.discovery)??"Discovery topic prefix")+"")&&D(d,_),pe[0]&64&&b.value!==se[6].h.t&&j(b,se[6].h.t),pe[0]&4&&E!==(E=(((be=(ue=(te=se[2].conf)==null?void 0:te.mqtt)==null?void 0:ue.ha)==null?void 0:be.hostname)??"Hostname for URL")+"")&&D(F,E),pe[0]&64&&O!==(O=se[6].g.h+".local")&&u(L,"placeholder",O),pe[0]&64&&L.value!==se[6].h.h&&j(L,se[6].h.h),pe[0]&4&&z!==(z=(((ve=(J=(ke=se[2].conf)==null?void 0:ke.mqtt)==null?void 0:J.ha)==null?void 0:ve.tag)??"Name tag")+"")&&D(q,z),pe[0]&64&&V.value!==se[6].h.n&&j(V,se[6].h.n)},d(se){se&&N(e),Y=!1,zt(G)}}}function Pa(t){var q,B,Z,V,Y,G,U,W,ne,ee;let e,l,n=(((B=(q=t[2].conf)==null?void 0:q.cloud)==null?void 0:B.title)??"Cloud connections")+"",i,o,a,r,f,c,m=(V=(Z=t[0])==null?void 0:Z.features)==null?void 0:V.includes("cloud"),_,d,h,g,b,k=(((G=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:G.es)??"Energy Speedometer")+"",w,E,F,R=(W=(U=t[0])==null?void 0:U.features)==null?void 0:W.includes("zc"),T,L,O,H=m&&Ta(t),K=((ee=(ne=t[6])==null?void 0:ne.c)==null?void 0:ee.es)&&Aa(t),z=R&&Oa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),H&&H.c(),_=v(),d=p("div"),h=p("label"),g=p("input"),b=v(),w=M(k),E=v(),K&&K.c(),F=v(),z&&z.c(),u(l,"class","text-sm"),u(a,"href",vl("Cloud")),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","c"),f.value="true",u(g,"type","checkbox"),u(g,"class","rounded mb-1"),u(g,"name","ces"),g.__value="true",j(g,g.__value),u(d,"class","my-1"),u(e,"class","cnt")},m(Q,ie){P(Q,e,ie),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),H&&H.m(e,null),s(e,_),s(e,d),s(d,h),s(h,g),g.checked=t[6].c.es,s(h,b),s(h,w),s(d,E),K&&K.m(d,null),s(e,F),z&&z.m(e,null),T=!0,L||(O=ce(g,"change",t[95]),L=!0)},p(Q,ie){var re,fe,le,de,oe,me,se,pe,we,S;(!T||ie[0]&4)&&n!==(n=(((fe=(re=Q[2].conf)==null?void 0:re.cloud)==null?void 0:fe.title)??"Cloud connections")+"")&&D(i,n),ie[0]&1&&(m=(de=(le=Q[0])==null?void 0:le.features)==null?void 0:de.includes("cloud")),m?H?H.p(Q,ie):(H=Ta(Q),H.c(),H.m(e,_)):H&&(H.d(1),H=null),ie[0]&64&&(g.checked=Q[6].c.es),(!T||ie[0]&4)&&k!==(k=(((me=(oe=Q[2].conf)==null?void 0:oe.cloud)==null?void 0:me.es)??"Energy Speedometer")+"")&&D(w,k),(pe=(se=Q[6])==null?void 0:se.c)!=null&&pe.es?K?(K.p(Q,ie),ie[0]&64&&X(K,1)):(K=Aa(Q),K.c(),X(K,1),K.m(d,null)):K&&(ct(),x(K,1,1,()=>{K=null}),_t()),ie[0]&1&&(R=(S=(we=Q[0])==null?void 0:we.features)==null?void 0:S.includes("zc")),R?z?z.p(Q,ie):(z=Oa(Q),z.c(),z.m(e,null)):z&&(z.d(1),z=null)},i(Q){T||(X(K),T=!0)},o(Q){x(K),T=!1},d(Q){Q&&N(e),H&&H.d(),K&&K.d(),z&&z.d(),L=!1,O()}}}function Ta(t){var _,d;let e,l,n,i,o=(((d=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:d.ams)??"AMS reader cloud")+"",a,r,f,c,m=t[6].c.e&&qa(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=v(),a=M(o),r=v(),m&&m.c(),u(n,"type","checkbox"),u(n,"name","ce"),n.__value="true",j(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(h,g){P(h,e,g),s(e,l),s(l,n),n.checked=t[6].c.e,s(l,i),s(l,a),s(e,r),m&&m.m(e,null),f||(c=ce(n,"change",t[93]),f=!0)},p(h,g){var b,k;g[0]&64&&(n.checked=h[6].c.e),g[0]&4&&o!==(o=(((k=(b=h[2].conf)==null?void 0:b.cloud)==null?void 0:k.ams)??"AMS reader cloud")+"")&&D(a,o),h[6].c.e?m?m.p(h,g):(m=qa(h),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(h){h&&N(e),m&&m.d(),f=!1,c()}}}function qa(t){let e,l,n,i,o,a,r,f,c,m,_=t[6].c.p==0&&Ea(),d=t[5]&&Da(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=v(),i=p("select"),_&&_.c(),o=p("option"),o.textContent="TCP",a=p("option"),a.textContent="HTTP",r=v(),d&&d.c(),f=yt(),u(l,"for","cp"),o.__value=1,j(o,o.__value),a.__value=2,j(a,a.__value),u(i,"name","cp"),u(i,"class","in-s"),t[6].c.p===void 0&&Nt(()=>t[94].call(i)),u(e,"class","ml-6")},m(h,g){P(h,e,g),s(e,l),s(e,n),s(e,i),_&&_.m(i,null),s(i,o),s(i,a),Ue(i,t[6].c.p,!0),P(h,r,g),d&&d.m(h,g),P(h,f,g),c||(m=ce(i,"change",t[94]),c=!0)},p(h,g){h[6].c.p==0?_||(_=Ea(),_.c(),_.m(i,o)):_&&(_.d(1),_=null),g[0]&64&&Ue(i,h[6].c.p),h[5]?d?d.p(h,g):(d=Da(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},d(h){h&&(N(e),N(r),N(f)),_&&_.d(),d&&d.d(h),c=!1,m()}}}function Ea(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,j(e,e.__value),u(e,"title","No longer recommended")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Da(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",u(e,"type","button"),u(e,"class","text-blue-500 ml-6")},m(i,o){P(i,e,o),l||(n=ce(e,"click",t[23]),l=!0)},p:je,d(i){i&&N(e),l=!1,n()}}}function Aa(t){let e,l,n=t[0].mac+"",i,o,a,r,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,d,h=t[0].mac&&t[0].meter.id&&La(t);return{c(){e=p("div"),l=M("MAC: "),i=M(n),o=v(),a=p("div"),r=M("Meter ID: "),c=M(f),m=v(),h&&h.c(),_=yt(),u(e,"class","pl-5"),u(a,"class","pl-5")},m(g,b){P(g,e,b),s(e,l),s(e,i),P(g,o,b),P(g,a,b),s(a,r),s(a,c),P(g,m,b),h&&h.m(g,b),P(g,_,b),d=!0},p(g,b){(!d||b[0]&1)&&n!==(n=g[0].mac+"")&&D(i,n),(!d||b[0]&1)&&f!==(f=(g[0].meter.id?g[0].meter.id:"missing, required")+"")&&D(c,f),g[0].mac&&g[0].meter.id?h?(h.p(g,b),b[0]&1&&X(h,1)):(h=La(g),h.c(),X(h,1),h.m(_.parentNode,_)):h&&(ct(),x(h,1,1,()=>{h=null}),_t())},i(g){d||(X(h),d=!0)},o(g){x(h),d=!1},d(g){g&&(N(e),N(o),N(a),N(m),N(_)),h&&h.d(g)}}}function La(t){let e,l,n;return l=new Ec({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Me(l.$$.fragment),u(e,"class","pl-2")},m(i,o){P(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function Oa(t){let e,l,n,i,o,a,r,f,c=t[6].c.ze&&Ia(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=M(" ZmartCharge"),o=v(),c&&c.c(),a=yt(),u(n,"type","checkbox"),u(n,"name","cze"),n.__value="true",j(n,n.__value),u(n,"class","rounded mb-1"),u(e,"class","my-1")},m(m,_){P(m,e,_),s(e,l),s(l,n),n.checked=t[6].c.ze,s(l,i),P(m,o,_),c&&c.m(m,_),P(m,a,_),r||(f=ce(n,"change",t[96]),r=!0)},p(m,_){_[0]&64&&(n.checked=m[6].c.ze),m[6].c.ze?c?c.p(m,_):(c=Ia(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(N(e),N(o),N(a)),c&&c.d(m),r=!1,f()}}}function Ia(t){let e,l,n,i;return{c(){e=p("div"),l=p("input"),u(l,"name","czt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder","ZmartCharge token"),u(e,"class","my-1")},m(o,a){P(o,e,a),s(e,l),j(l,t[6].c.zt),n||(i=ce(l,"input",t[97]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].c.zt&&j(l,o[6].c.zt)},d(o){o&&N(e),n=!1,i()}}}function Ra(t){var z,q,B,Z,V;let e,l,n=(((q=(z=t[2].conf)==null?void 0:z.thresholds)==null?void 0:q.title)??"Thresholds")+"",i,o,a,r,f,c,m,_,d,h,g=(((Z=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:Z.avg)??"Average of")+"",b,k,w,E,F,R=(((V=t[2].common)==null?void 0:V.hours)??"hours")+"",T,L,O,H=ft({length:9}),K=[];for(let Y=0;Yt[101].call(k)),u(d,"class","w-1/2"),u(m,"class","flex flex-wrap"),u(e,"class","cnt")},m(q,B){P(q,e,B),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m);for(let Z=0;Z20&&Ha(t),g=((T=(R=(F=t[6])==null?void 0:F.i)==null?void 0:R.d)==null?void 0:T.d)>0&&Ga(t),b=m&&Va(t),k=t[0].chip=="esp8266"&&Ka(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),h&&h.c(),f=v(),g&&g.c(),c=v(),b&&b.c(),_=v(),k&&k.c(),u(l,"class","text-sm"),u(a,"href",vl("GPIO-configuration")),u(a,"target","_blank"),u(a,"class","float-right"),u(e,"class","cnt")},m(L,O){P(L,e,O),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),h&&h.m(e,null),s(e,f),g&&g.m(e,null),s(e,c),b&&b.m(e,null),s(e,_),k&&k.m(e,null),d=!0},p(L,O){var H,K,z,q,B;(!d||O[0]&4)&&n!==(n=(((K=(H=L[2].conf)==null?void 0:H.hw)==null?void 0:K.title)??"Hardware")+"")&&D(i,n),L[0].board>20?h?(h.p(L,O),O[0]&1&&X(h,1)):(h=Ha(L),h.c(),X(h,1),h.m(e,f)):h&&(ct(),x(h,1,1,()=>{h=null}),_t()),((B=(q=(z=L[6])==null?void 0:z.i)==null?void 0:q.d)==null?void 0:B.d)>0?g?g.p(L,O):(g=Ga(L),g.c(),g.m(e,c)):g&&(g.d(1),g=null),O[0]&1&&(m=cn(L[0].board)),m?b?b.p(L,O):(b=Va(L),b.c(),b.m(e,_)):b&&(b.d(1),b=null),L[0].chip=="esp8266"?k?k.p(L,O):(k=Ka(L),k.c(),k.m(e,null)):k&&(k.d(1),k=null)},i(L){d||(X(h),d=!0)},o(L){x(h),d=!1},d(L){L&&N(e),h&&h.d(),g&&g.d(),b&&b.d(),k&&k.d()}}}function Ha(t){var Bt,el,pt,nt,Qt,Jt,It,Zt,$t,Gt,Xt,ll,Ye,st,Mt,Rt,kt,gt,jt,et,Ft,he,Ie,We,Vt,Kt,wt,cl,ol,Ht,Wt,ul,Ee;let e,l,n,i,o=(((pt=(el=(Bt=t[2].conf)==null?void 0:Bt.hw)==null?void 0:el.han)==null?void 0:pt.rx)??"HAN RX")+"",a,r,f,c,m,_,d,h=(((Jt=(Qt=(nt=t[2].conf)==null?void 0:nt.hw)==null?void 0:Qt.han)==null?void 0:Jt.tx)??"HAN TX")+"",g,b,k,w,E,F,R,T,L,O,H=((($t=(Zt=(It=t[2].conf)==null?void 0:It.hw)==null?void 0:Zt.han)==null?void 0:$t.pullup)??"pullup")+"",K,z,q,B,Z=(((Xt=(Gt=t[2].conf)==null?void 0:Gt.hw)==null?void 0:Xt.ap_btn)??"AP button")+"",V,Y,G,U,W,ne,ee=(((st=(Ye=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:Ye.led)==null?void 0:st.title)??"LED")+"",Q,ie,re,fe,le,de,oe,me,se,pe,we=(((kt=(Rt=(Mt=t[2].conf)==null?void 0:Mt.hw)==null?void 0:Rt.led)==null?void 0:kt.inverted)??"inverted")+"",S,C,I,A=(((et=(jt=(gt=t[2].conf)==null?void 0:gt.hw)==null?void 0:jt.led)==null?void 0:et.rgb)??"RGB")+"",y,te,ue,be,ke=(((Ie=(he=(Ft=t[2].conf)==null?void 0:Ft.hw)==null?void 0:he.led)==null?void 0:Ie.inverted)??"inverted")+"",J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut=(((Kt=(Vt=(We=t[2].conf)==null?void 0:We.hw)==null?void 0:Vt.led)==null?void 0:Kt.disable)??"LED dis. GPIO")+"",St,dt,rt,ot,ht,Ot=(((cl=(wt=t[2].conf)==null?void 0:wt.hw)==null?void 0:cl.temp)??"Temperature")+"",Je,Fe,He,tt,Ge,Ve,Qe=(((Ht=(ol=t[2].conf)==null?void 0:ol.hw)==null?void 0:Ht.temp_analog)??"Analog temp")+"",_e,ae,Te,Ke,Et,vt,Xe,qt,at;m=new eo({props:{chip:t[0].chip}}),E=new eo({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&Wa(t),lt=((Ee=(ul=(Wt=t[6])==null?void 0:Wt.i)==null?void 0:ul.v)==null?void 0:Ee.p)>0&&ya(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=M(o),r=p("br"),f=v(),c=p("select"),Me(m.$$.fragment),_=v(),d=p("div"),g=M(h),b=p("br"),k=v(),w=p("select"),Me(E.$$.fragment),F=v(),R=p("div"),T=p("label"),L=p("input"),O=v(),K=M(H),z=v(),q=p("div"),B=p("div"),V=M(Z),Y=p("br"),G=v(),U=p("input"),W=v(),ne=p("div"),Q=M(ee),ie=p("br"),re=v(),fe=p("div"),le=p("input"),de=v(),oe=p("div"),me=p("label"),se=p("input"),pe=v(),S=M(we),C=v(),I=p("div"),y=M(A),te=p("label"),ue=p("input"),be=v(),J=M(ke),ve=p("br"),ge=v(),qe=p("div"),Pe=p("input"),Ae=v(),Le=p("input"),Ne=v(),De=p("input"),Re=v(),$e=p("div"),xe=p("div"),St=M(ut),dt=v(),rt=p("input"),ot=v(),ht=p("div"),Je=M(Ot),Fe=p("br"),He=v(),tt=p("input"),Ge=v(),Ve=p("div"),_e=M(Qe),ae=p("br"),Te=v(),Ke=p("input"),Et=v(),mt&&mt.c(),vt=v(),lt&<.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(c,"name","ihp"),u(c,"class","in-f w-full"),t[6].i.h.p===void 0&&Nt(()=>t[102].call(c)),u(i,"class","w-1/3"),u(w,"name","iht"),u(w,"class","in-l w-full"),t[6].i.h.t===void 0&&Nt(()=>t[103].call(w)),u(d,"class","w-1/3"),u(L,"name","ihu"),L.__value="true",j(L,L.__value),u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(T,"class","ml-2"),u(R,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(U,"name","ia"),u(U,"type","number"),u(U,"min","0"),u(U,"max",t[12]),u(U,"class","in-f tr w-full"),u(B,"class","w-1/3"),u(le,"name","ilp"),u(le,"type","number"),u(le,"min","0"),u(le,"max",t[12]),u(le,"class","in-l tr w-full"),u(fe,"class","flex"),u(ne,"class","w-1/3"),u(se,"name","ili"),se.__value="true",j(se,se.__value),u(se,"type","checkbox"),u(se,"class","rounded mb-1"),u(me,"class","ml-4"),u(oe,"class","w-1/3"),u(ue,"name","iri"),ue.__value="true",j(ue,ue.__value),u(ue,"type","checkbox"),u(ue,"class","rounded mb-1"),u(te,"class","ml-4"),u(Pe,"name","irr"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[12]),u(Pe,"class","in-f tr w-1/3"),u(Le,"name","irg"),u(Le,"type","number"),u(Le,"min","0"),u(Le,"max",t[12]),u(Le,"class","in-m tr w-1/3"),u(De,"name","irb"),u(De,"type","number"),u(De,"min","0"),u(De,"max",t[12]),u(De,"class","in-l tr w-1/3"),u(qe,"class","flex"),u(I,"class","w-full"),u(rt,"name","idd"),u(rt,"type","number"),u(rt,"min","0"),u(rt,"max",t[12]),u(rt,"class","in-s tr"),u(xe,"class","my-1 pr-1 w-1/3"),u($e,"class","w-full"),u(tt,"name","itd"),u(tt,"type","number"),u(tt,"min","0"),u(tt,"max",t[12]),u(tt,"class","in-f tr w-full"),u(ht,"class","my-1 w-1/3"),u(Ke,"name","ita"),u(Ke,"type","number"),u(Ke,"min","0"),u(Ke,"max",t[12]),u(Ke,"class","in-l tr w-full"),u(Ve,"class","my-1 pr-1 w-1/3"),u(q,"class","flex flex-wrap")},m($,Oe){P($,e,Oe),P($,l,Oe),P($,n,Oe),s(n,i),s(i,a),s(i,r),s(i,f),s(i,c),Ce(m,c,null),Ue(c,t[6].i.h.p,!0),s(n,_),s(n,d),s(d,g),s(d,b),s(d,k),s(d,w),Ce(E,w,null),Ue(w,t[6].i.h.t,!0),s(n,F),s(n,R),s(R,T),s(T,L),L.checked=t[6].i.h.u,s(T,O),s(T,K),P($,z,Oe),P($,q,Oe),s(q,B),s(B,V),s(B,Y),s(B,G),s(B,U),j(U,t[6].i.a),s(q,W),s(q,ne),s(ne,Q),s(ne,ie),s(ne,re),s(ne,fe),s(fe,le),j(le,t[6].i.l.p),s(q,de),s(q,oe),s(oe,me),s(me,se),se.checked=t[6].i.l.i,s(me,pe),s(me,S),s(q,C),s(q,I),s(I,y),s(I,te),s(te,ue),ue.checked=t[6].i.r.i,s(te,be),s(te,J),s(I,ve),s(I,ge),s(I,qe),s(qe,Pe),j(Pe,t[6].i.r.r),s(qe,Ae),s(qe,Le),j(Le,t[6].i.r.g),s(qe,Ne),s(qe,De),j(De,t[6].i.r.b),s(q,Re),s(q,$e),s($e,xe),s(xe,St),s(xe,dt),s(xe,rt),j(rt,t[6].i.d.d),s(q,ot),s(q,ht),s(ht,Je),s(ht,Fe),s(ht,He),s(ht,tt),j(tt,t[6].i.t.d),s(q,Ge),s(q,Ve),s(Ve,_e),s(Ve,ae),s(Ve,Te),s(Ve,Ke),j(Ke,t[6].i.t.a),s(q,Et),mt&&mt.m(q,null),s(q,vt),lt&<.m(q,null),Xe=!0,qt||(at=[ce(c,"change",t[102]),ce(w,"change",t[103]),ce(L,"change",t[104]),ce(U,"input",t[105]),ce(le,"input",t[106]),ce(se,"change",t[107]),ce(ue,"change",t[108]),ce(Pe,"input",t[109]),ce(Le,"input",t[110]),ce(De,"input",t[111]),ce(rt,"input",t[112]),ce(tt,"input",t[113]),ce(Ke,"input",t[114])],qt=!0)},p($,Oe){var Dt,al,ml,bl,fl,gl,kl,Rl,Fl,Bl,Ul,zl,jl,Hl,Wl,yl,Gl,Vl,Kl,Yl,ye,bt,ze,At,il,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Xe||Oe[0]&4)&&o!==(o=(((ml=(al=(Dt=$[2].conf)==null?void 0:Dt.hw)==null?void 0:al.han)==null?void 0:ml.rx)??"HAN RX")+"")&&D(a,o);const _l={};Oe[0]&1&&(_l.chip=$[0].chip),m.$set(_l),Oe[0]&64&&Ue(c,$[6].i.h.p),(!Xe||Oe[0]&4)&&h!==(h=(((gl=(fl=(bl=$[2].conf)==null?void 0:bl.hw)==null?void 0:fl.han)==null?void 0:gl.tx)??"HAN TX")+"")&&D(g,h);const it={};Oe[0]&1&&(it.chip=$[0].chip),E.$set(it),Oe[0]&64&&Ue(w,$[6].i.h.t),Oe[0]&64&&(L.checked=$[6].i.h.u),(!Xe||Oe[0]&4)&&H!==(H=(((Fl=(Rl=(kl=$[2].conf)==null?void 0:kl.hw)==null?void 0:Rl.han)==null?void 0:Fl.pullup)??"pullup")+"")&&D(K,H),(!Xe||Oe[0]&4)&&Z!==(Z=(((Ul=(Bl=$[2].conf)==null?void 0:Bl.hw)==null?void 0:Ul.ap_btn)??"AP button")+"")&&D(V,Z),(!Xe||Oe[0]&4096)&&u(U,"max",$[12]),Oe[0]&64&&Be(U.value)!==$[6].i.a&&j(U,$[6].i.a),(!Xe||Oe[0]&4)&&ee!==(ee=(((Hl=(jl=(zl=$[2].conf)==null?void 0:zl.hw)==null?void 0:jl.led)==null?void 0:Hl.title)??"LED")+"")&&D(Q,ee),(!Xe||Oe[0]&4096)&&u(le,"max",$[12]),Oe[0]&64&&Be(le.value)!==$[6].i.l.p&&j(le,$[6].i.l.p),Oe[0]&64&&(se.checked=$[6].i.l.i),(!Xe||Oe[0]&4)&&we!==(we=(((Gl=(yl=(Wl=$[2].conf)==null?void 0:Wl.hw)==null?void 0:yl.led)==null?void 0:Gl.inverted)??"inverted")+"")&&D(S,we),(!Xe||Oe[0]&4)&&A!==(A=(((Yl=(Kl=(Vl=$[2].conf)==null?void 0:Vl.hw)==null?void 0:Kl.led)==null?void 0:Yl.rgb)??"RGB")+"")&&D(y,A),Oe[0]&64&&(ue.checked=$[6].i.r.i),(!Xe||Oe[0]&4)&&ke!==(ke=(((ze=(bt=(ye=$[2].conf)==null?void 0:ye.hw)==null?void 0:bt.led)==null?void 0:ze.inverted)??"inverted")+"")&&D(J,ke),(!Xe||Oe[0]&4096)&&u(Pe,"max",$[12]),Oe[0]&64&&Be(Pe.value)!==$[6].i.r.r&&j(Pe,$[6].i.r.r),(!Xe||Oe[0]&4096)&&u(Le,"max",$[12]),Oe[0]&64&&Be(Le.value)!==$[6].i.r.g&&j(Le,$[6].i.r.g),(!Xe||Oe[0]&4096)&&u(De,"max",$[12]),Oe[0]&64&&Be(De.value)!==$[6].i.r.b&&j(De,$[6].i.r.b),(!Xe||Oe[0]&4)&&ut!==(ut=(((Ql=(il=(At=$[2].conf)==null?void 0:At.hw)==null?void 0:il.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&D(St,ut),(!Xe||Oe[0]&4096)&&u(rt,"max",$[12]),Oe[0]&64&&Be(rt.value)!==$[6].i.d.d&&j(rt,$[6].i.d.d),(!Xe||Oe[0]&4)&&Ot!==(Ot=(((Zl=(Xl=$[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&D(Je,Ot),(!Xe||Oe[0]&4096)&&u(tt,"max",$[12]),Oe[0]&64&&Be(tt.value)!==$[6].i.t.d&&j(tt,$[6].i.t.d),(!Xe||Oe[0]&4)&&Qe!==(Qe=((($l=(Jl=$[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&D(_e,Qe),(!Xe||Oe[0]&4096)&&u(Ke,"max",$[12]),Oe[0]&64&&Be(Ke.value)!==$[6].i.t.a&&j(Ke,$[6].i.t.a),$[0].chip!="esp8266"?mt?mt.p($,Oe):(mt=Wa($),mt.c(),mt.m(q,vt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=$[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?lt?lt.p($,Oe):(lt=ya($),lt.c(),lt.m(q,null)):lt&&(lt.d(1),lt=null)},i($){Xe||(X(m.$$.fragment,$),X(E.$$.fragment,$),Xe=!0)},o($){x(m.$$.fragment,$),x(E.$$.fragment,$),Xe=!1},d($){$&&(N(e),N(l),N(n),N(z),N(q)),Se(m),Se(E),mt&&mt.d(),lt&<.d(),qt=!1,zt(at)}}}function Wa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","ivp"),u(a,"type","number"),u(a,"min","0"),u(a,"max",t[12]),u(a,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,e,h),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].i.v.p),r||(f=ce(a,"input",t[115]),r=!0)},p(d,h){var g,b,k;h[0]&4&&l!==(l=(((k=(b=(g=d[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:k.title)??"Vcc")+"")&&D(n,l),h[0]&4096&&u(a,"max",d[12]),h[0]&64&&Be(a.value)!==d[6].i.v.p&&j(a,d[6].i.v.p)},d(d){d&&N(e),r=!1,f()}}}function ya(t){var g,b,k;let e,l=(((k=(b=(g=t[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:k.divider)??"Voltage divider")+"",n,i,o,a,r,f,c,m,_,d,h;return{c(){var w,E,F,R,T,L;e=p("div"),n=M(l),i=p("br"),o=v(),a=p("div"),r=p("input"),c=v(),m=p("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",f=((F=(E=(w=t[2].conf)==null?void 0:w.hw)==null?void 0:E.vcc)==null?void 0:F.div_vcc)??"VCC"),u(m,"name","ivdg"),u(m,"type","number"),u(m,"min","0"),u(m,"max","65535"),u(m,"class","in-l tr w-full"),u(m,"placeholder",_=((L=(T=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:T.vcc)==null?void 0:L.div_gnd)??"GND"),u(a,"class","flex"),u(e,"class","my-1")},m(w,E){P(w,e,E),s(e,n),s(e,i),s(e,o),s(e,a),s(a,r),j(r,t[6].i.v.d.v),s(a,c),s(a,m),j(m,t[6].i.v.d.g),d||(h=[ce(r,"input",t[116]),ce(m,"input",t[117])],d=!0)},p(w,E){var F,R,T,L,O,H,K,z,q;E[0]&4&&l!==(l=(((T=(R=(F=w[2].conf)==null?void 0:F.hw)==null?void 0:R.vcc)==null?void 0:T.divider)??"Voltage divider")+"")&&D(n,l),E[0]&4&&f!==(f=((H=(O=(L=w[2].conf)==null?void 0:L.hw)==null?void 0:O.vcc)==null?void 0:H.div_vcc)??"VCC")&&u(r,"placeholder",f),E[0]&64&&Be(r.value)!==w[6].i.v.d.v&&j(r,w[6].i.v.d.v),E[0]&4&&_!==(_=((q=(z=(K=w[2].conf)==null?void 0:K.hw)==null?void 0:z.vcc)==null?void 0:q.div_gnd)??"GND")&&u(m,"placeholder",_),E[0]&64&&Be(m.value)!==w[6].i.v.d.g&&j(m,w[6].i.v.d.g)},d(w){w&&N(e),d=!1,zt(h)}}}function Ga(t){var g,b,k,w,E,F,R,T,L,O,H,K;let e,l=(((w=(k=(b=(g=t[2].conf)==null?void 0:g.hw)==null?void 0:b.led)==null?void 0:k.behaviour)==null?void 0:w.title)??"LED behaviour")+"",n,i,o,a,r=(((T=(R=(F=(E=t[2].conf)==null?void 0:E.hw)==null?void 0:F.led)==null?void 0:R.behaviour)==null?void 0:T.enabled)??"Enabled")+"",f,c,m=(((K=(H=(O=(L=t[2].conf)==null?void 0:L.hw)==null?void 0:O.led)==null?void 0:H.behaviour)==null?void 0:K.disabled)??"Disabled")+"",_,d,h;return{c(){e=p("div"),n=M(l),i=v(),o=p("select"),a=p("option"),f=M(r),c=p("option"),_=M(m),a.__value=0,j(a,a.__value),c.__value=1,j(c,c.__value),u(o,"name","idb"),u(o,"class","in-s"),t[6].i.d.b===void 0&&Nt(()=>t[118].call(o)),u(e,"class","my-1 w-full")},m(z,q){P(z,e,q),s(e,n),s(e,i),s(e,o),s(o,a),s(a,f),s(o,c),s(c,_),Ue(o,t[6].i.d.b,!0),d||(h=ce(o,"change",t[118]),d=!0)},p(z,q){var B,Z,V,Y,G,U,W,ne,ee,Q,ie,re;q[0]&4&&l!==(l=(((Y=(V=(Z=(B=z[2].conf)==null?void 0:B.hw)==null?void 0:Z.led)==null?void 0:V.behaviour)==null?void 0:Y.title)??"LED behaviour")+"")&&D(n,l),q[0]&4&&r!==(r=(((ne=(W=(U=(G=z[2].conf)==null?void 0:G.hw)==null?void 0:U.led)==null?void 0:W.behaviour)==null?void 0:ne.enabled)??"Enabled")+"")&&D(f,r),q[0]&4&&m!==(m=(((re=(ie=(Q=(ee=z[2].conf)==null?void 0:ee.hw)==null?void 0:Q.led)==null?void 0:ie.behaviour)==null?void 0:re.disabled)??"Disabled")+"")&&D(_,m),q[0]&64&&Ue(o,z[6].i.d.b)},d(z){z&&N(e),d=!1,h()}}}function Va(t){var _,d,h,g,b,k;let e,l,n,i=(((h=(d=(_=t[2].conf)==null?void 0:_.hw)==null?void 0:d.powersaving)==null?void 0:h[0])??"Normal")+"",o,a,r=(((k=(b=(g=t[2].conf)==null?void 0:g.hw)==null?void 0:b.powersaving)==null?void 0:k[3])??"Extreme (Experimental)")+"",f,c,m;return{c(){e=M(`Power saving: + `),l=p("select"),n=p("option"),o=M(i),a=p("option"),f=M(r),n.__value=0,j(n,n.__value),a.__value=3,j(a,a.__value),u(l,"name","ip"),u(l,"class","in-s"),t[6].i.p===void 0&&Nt(()=>t[119].call(l))},m(w,E){P(w,e,E),P(w,l,E),s(l,n),s(n,o),s(l,a),s(a,f),Ue(l,t[6].i.p,!0),c||(m=ce(l,"change",t[119]),c=!0)},p(w,E){var F,R,T,L,O,H;E[0]&4&&i!==(i=(((T=(R=(F=w[2].conf)==null?void 0:F.hw)==null?void 0:R.powersaving)==null?void 0:T[0])??"Normal")+"")&&D(o,i),E[0]&4&&r!==(r=(((H=(O=(L=w[2].conf)==null?void 0:L.hw)==null?void 0:O.powersaving)==null?void 0:H[3])??"Extreme (Experimental)")+"")&&D(f,r),E[0]&64&&Ue(l,w[6].i.p)},d(w){w&&(N(e),N(l)),c=!1,m()}}}function Ka(t){var T,L,O,H,K,z;let e,l,n,i,o=(((O=(L=(T=t[2].conf)==null?void 0:T.hw)==null?void 0:L.vcc)==null?void 0:O.offset)??"Vcc offset")+"",a,r,f,c,m,_,d=(((z=(K=(H=t[2].conf)==null?void 0:H.hw)==null?void 0:K.vcc)==null?void 0:z.multiplier)??"Multiplier")+"",h,g,b,k,w,E,F,R=(t[0].board==2||t[0].board==100)&&Ya(t);return{c(){e=p("input"),l=v(),n=p("div"),i=p("div"),a=M(o),r=p("br"),f=v(),c=p("input"),m=v(),_=p("div"),h=M(d),g=p("br"),b=v(),k=p("input"),w=v(),R&&R.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(c,"name","ivo"),u(c,"type","number"),u(c,"min","0.0"),u(c,"max","3.5"),u(c,"step","0.01"),u(c,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(k,"name","ivm"),u(k,"type","number"),u(k,"min","0.1"),u(k,"max","10"),u(k,"step","0.01"),u(k,"class","in-l tr w-full"),u(_,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(q,B){P(q,e,B),P(q,l,B),P(q,n,B),s(n,i),s(i,a),s(i,r),s(i,f),s(i,c),j(c,t[6].i.v.o),s(n,m),s(n,_),s(_,h),s(_,g),s(_,b),s(_,k),j(k,t[6].i.v.m),s(n,w),R&&R.m(n,null),E||(F=[ce(c,"input",t[120]),ce(k,"input",t[121])],E=!0)},p(q,B){var Z,V,Y,G,U,W;B[0]&4&&o!==(o=(((Y=(V=(Z=q[2].conf)==null?void 0:Z.hw)==null?void 0:V.vcc)==null?void 0:Y.offset)??"Vcc offset")+"")&&D(a,o),B[0]&64&&Be(c.value)!==q[6].i.v.o&&j(c,q[6].i.v.o),B[0]&4&&d!==(d=(((W=(U=(G=q[2].conf)==null?void 0:G.hw)==null?void 0:U.vcc)==null?void 0:W.multiplier)??"Multiplier")+"")&&D(h,d),B[0]&64&&Be(k.value)!==q[6].i.v.m&&j(k,q[6].i.v.m),q[0].board==2||q[0].board==100?R?R.p(q,B):(R=Ya(q),R.c(),R.m(n,null)):R&&(R.d(1),R=null)},d(q){q&&(N(e),N(l),N(n)),R&&R.d(),E=!1,zt(F)}}}function Ya(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,o,a,r,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=v(),a=p("input"),u(a,"name","ivb"),u(a,"type","number"),u(a,"min","2.5"),u(a,"max","3.5"),u(a,"step","0.1"),u(a,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(d,h){P(d,e,h),s(e,n),s(e,i),s(e,o),s(e,a),j(a,t[6].i.v.b),r||(f=ce(a,"input",t[122]),r=!0)},p(d,h){var g,b,k;h[0]&4&&l!==(l=(((k=(b=(g=d[2].conf)==null?void 0:g.hw)==null?void 0:b.vcc)==null?void 0:k.boot)??"Boot limit")+"")&&D(n,l),h[0]&64&&Be(a.value)!==d[6].i.v.b&&j(a,d[6].i.v.b)},d(d){d&&N(e),r=!1,f()}}}function Qa(t){var R,T,L,O,H,K;let e,l,n=(((T=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:T.title)??"Debugging")+"",i,o,a,r,f,c,m,_,d,h,g=(((O=(L=t[2].conf)==null?void 0:L.debug)==null?void 0:O.enable)??"Enable debugging")+"",b,k,w,E,F=((K=(H=t[6])==null?void 0:H.d)==null?void 0:K.s)&&Xa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("a"),a.textContent="ⓘ",r=v(),f=p("input"),c=v(),m=p("div"),_=p("label"),d=p("input"),h=v(),b=M(g),k=v(),F&&F.c(),u(l,"class","text-sm"),u(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(a,"target","_blank"),u(a,"class","float-right"),u(f,"type","hidden"),u(f,"name","d"),f.value="true",u(d,"type","checkbox"),u(d,"name","ds"),d.__value="true",j(d,d.__value),u(d,"class","rounded mb-1"),u(m,"class","mt-3"),u(e,"class","cnt")},m(z,q){P(z,e,q),s(e,l),s(l,i),s(e,o),s(e,a),s(e,r),s(e,f),s(e,c),s(e,m),s(m,_),s(_,d),d.checked=t[6].d.s,s(_,h),s(_,b),s(e,k),F&&F.m(e,null),w||(E=ce(d,"change",t[123]),w=!0)},p(z,q){var B,Z,V,Y,G,U;q[0]&4&&n!==(n=(((Z=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:Z.title)??"Debugging")+"")&&D(i,n),q[0]&64&&(d.checked=z[6].d.s),q[0]&4&&g!==(g=(((Y=(V=z[2].conf)==null?void 0:V.debug)==null?void 0:Y.enable)??"Enable debugging")+"")&&D(b,g),(U=(G=z[6])==null?void 0:G.d)!=null&&U.s?F?F.p(z,q):(F=Xa(z),F.c(),F.m(e,null)):F&&(F.d(1),F=null)},d(z){z&&N(e),F&&F.d(),w=!1,E()}}}function Xa(t){var L,O,H,K;let e,l=(((O=(L=t[2].conf)==null?void 0:L.debug)==null?void 0:O.danger)??"Disable when done")+"",n,i,o,a,r,f,c=(((K=(H=t[2].conf)==null?void 0:H.debug)==null?void 0:K.telnet)??"Enable telnet")+"",m,_,d,h,g,b,k,w,E,F,R,T=t[6].d.t&&Za(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("div"),a=p("label"),r=p("input"),f=v(),m=M(c),_=v(),T&&T.c(),d=v(),h=p("div"),g=p("select"),b=p("option"),b.textContent="Verbose",k=p("option"),k.textContent="Debug",w=p("option"),w.textContent="Info",E=p("option"),E.textContent="Warning",u(e,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",j(r,r.__value),u(r,"class","rounded mb-1"),u(o,"class","my-1"),b.__value=1,j(b,b.__value),k.__value=2,j(k,k.__value),w.__value=3,j(w,w.__value),E.__value=4,j(E,E.__value),u(g,"name","dl"),u(g,"class","in-s"),t[6].d.l===void 0&&Nt(()=>t[125].call(g)),u(h,"class","my-1")},m(z,q){P(z,e,q),s(e,n),P(z,i,q),P(z,o,q),s(o,a),s(a,r),r.checked=t[6].d.t,s(a,f),s(a,m),P(z,_,q),T&&T.m(z,q),P(z,d,q),P(z,h,q),s(h,g),s(g,b),s(g,k),s(g,w),s(g,E),Ue(g,t[6].d.l,!0),F||(R=[ce(r,"change",t[124]),ce(g,"change",t[125])],F=!0)},p(z,q){var B,Z,V,Y;q[0]&4&&l!==(l=(((Z=(B=z[2].conf)==null?void 0:B.debug)==null?void 0:Z.danger)??"Disable when done")+"")&&D(n,l),q[0]&64&&(r.checked=z[6].d.t),q[0]&4&&c!==(c=(((Y=(V=z[2].conf)==null?void 0:V.debug)==null?void 0:Y.telnet)??"Enable telnet")+"")&&D(m,c),z[6].d.t?T?T.p(z,q):(T=Za(z),T.c(),T.m(d.parentNode,d)):T&&(T.d(1),T=null),q[0]&64&&Ue(g,z[6].d.l)},d(z){z&&(N(e),N(i),N(o),N(_),N(d),N(h)),T&&T.d(z),F=!1,zt(R)}}}function Za(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&D(n,l)},d(a){a&&N(e)}}}function Ja(t){var d,h;let e,l,n=(((d=t[2].conf)==null?void 0:d.btn_reset)??"Factory reset")+"",i,o,a,r,f=(((h=t[2].btn)==null?void 0:h.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=M(n),o=v(),a=p("div"),r=p("button"),c=M(f),u(l,"type","button"),u(l,"class","btn-red"),u(r,"type","button"),u(r,"class","btn-yellow"),u(a,"class","text-center")},m(g,b){P(g,e,b),s(e,l),s(l,i),P(g,o,b),P(g,a,b),s(a,r),s(r,c),m||(_=[ce(l,"click",t[14]),ce(r,"click",t[16])],m=!0)},p(g,b){var k,w;b[0]&4&&n!==(n=(((k=g[2].conf)==null?void 0:k.btn_reset)??"Factory reset")+"")&&D(i,n),b[0]&4&&f!==(f=(((w=g[2].btn)==null?void 0:w.reboot)??"Reboot")+"")&&D(c,f)},d(g){g&&(N(e),N(o),N(a)),m=!1,zt(_)}}}function $a(t){var o;let e,l,n=(((o=t[2].btn)==null?void 0:o.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=M(n),u(l,"type","submit"),u(l,"class","btn-pri"),u(e,"class","text-right")},m(a,r){P(a,e,r),s(e,l),s(l,i)},p(a,r){var f;r[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&D(i,n)},d(a){a&&N(e)}}}function xc(t){var me,se,pe,we,S,C,I,A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Ot,Je,Fe,He,tt,Ge,Ve,Qe;let e,l,n,i,o,a,r,f,c,m,_=((pe=(se=(me=t[6])==null?void 0:me.p)==null?void 0:se.r)==null?void 0:pe.startsWith("NO"))||((C=(S=(we=t[6])==null?void 0:we.p)==null?void 0:S.r)==null?void 0:C.startsWith("10YNO"))||((y=(A=(I=t[6])==null?void 0:I.p)==null?void 0:A.r)==null?void 0:y.startsWith("10Y1001A1001A4")),d,h,g,b=((te=t[6])==null?void 0:te.d)&&((be=(ue=t[0])==null?void 0:ue.features)==null?void 0:be.includes("rdebug")),k,w,E,F,R,T,L,O,H,K,z,q,B,Z,V=((ke=t[6])==null?void 0:ke.g)&&ia(t),Y=((J=t[6])==null?void 0:J.m)&&fa(t),G=((ve=t[6])==null?void 0:ve.w)&&ma(t),U=((ge=t[6])==null?void 0:ge.n)&&ga(t),W=((qe=t[6])==null?void 0:qe.q)&&wa(t),ne=((Ae=(Pe=t[6])==null?void 0:Pe.q)==null?void 0:Ae.m)==3&&Ma(t),ee=((Ne=(Le=t[6])==null?void 0:Le.q)==null?void 0:Ne.m)==4&&Na(t),Q=((De=t[6])==null?void 0:De.c)&&Pa(t),ie=_&&Ra(t),re=((Re=t[6])==null?void 0:Re.u)&&Ba(t),fe=((xe=($e=t[6])==null?void 0:$e.i)==null?void 0:xe.h)&&(((ut=t[0])==null?void 0:ut.board)>20||((St=t[0])==null?void 0:St.chip)=="esp8266"||((ot=(rt=(dt=t[6])==null?void 0:dt.i)==null?void 0:rt.d)==null?void 0:ot.d)>0)&&ja(t),le=b&&Qa(t),de=((ht=t[1])==null?void 0:ht.a)&&Ja(t),oe=t[6]&&$a(t);return R=new dl({props:{active:t[3],message:((Je=(Ot=t[2].conf)==null?void 0:Ot.mask)==null?void 0:Je.loading)??"Loading"}}),L=new dl({props:{active:t[4],message:((He=(Fe=t[2].conf)==null?void 0:Fe.mask)==null?void 0:He.saving)??"Saving"}}),H=new dl({props:{active:t[10],message:((Ge=(tt=t[2].conf)==null?void 0:tt.mask)==null?void 0:Ge.reset)??"Factory reset"}}),z=new dl({props:{active:t[11],message:((Qe=(Ve=t[2].conf)==null?void 0:Ve.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),V&&V.c(),n=v(),Y&&Y.c(),i=v(),G&&G.c(),o=v(),U&&U.c(),a=v(),W&&W.c(),r=v(),ne&&ne.c(),f=v(),ee&&ee.c(),c=v(),Q&&Q.c(),m=v(),ie&&ie.c(),d=v(),re&&re.c(),h=v(),fe&&fe.c(),g=v(),le&&le.c(),k=v(),w=p("div"),de&&de.c(),E=v(),oe&&oe.c(),F=v(),Me(R.$$.fragment),T=v(),Me(L.$$.fragment),O=v(),Me(H.$$.fragment),K=v(),Me(z.$$.fragment),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(w,"class","grid grid-cols-3 mt-3"),u(e,"autocomplete","off")},m(_e,ae){P(_e,e,ae),s(e,l),V&&V.m(l,null),s(l,n),Y&&Y.m(l,null),s(l,i),G&&G.m(l,null),s(l,o),U&&U.m(l,null),s(l,a),W&&W.m(l,null),s(l,r),ne&&ne.m(l,null),s(l,f),ee&&ee.m(l,null),s(l,c),Q&&Q.m(l,null),s(l,m),ie&&ie.m(l,null),s(l,d),re&&re.m(l,null),s(l,h),fe&&fe.m(l,null),s(l,g),le&&le.m(l,null),s(e,k),s(e,w),de&&de.m(w,null),s(w,E),oe&&oe.m(w,null),P(_e,F,ae),Ce(R,_e,ae),P(_e,T,ae),Ce(L,_e,ae),P(_e,O,ae),Ce(H,_e,ae),P(_e,K,ae),Ce(z,_e,ae),q=!0,B||(Z=ce(e,"submit",pn(t[15])),B=!0)},p(_e,ae){var Xe,qt,at,mt,lt,Bt,el,pt,nt,Qt,Jt,It,Zt,$t,Gt,Xt,ll,Ye,st,Mt,Rt,kt,gt,jt,et,Ft,he,Ie,We,Vt,Kt,wt,cl,ol,Ht,Wt,ul,Ee,$;(Xe=_e[6])!=null&&Xe.g?V?(V.p(_e,ae),ae[0]&64&&X(V,1)):(V=ia(_e),V.c(),X(V,1),V.m(l,n)):V&&(ct(),x(V,1,1,()=>{V=null}),_t()),(qt=_e[6])!=null&&qt.m?Y?Y.p(_e,ae):(Y=fa(_e),Y.c(),Y.m(l,i)):Y&&(Y.d(1),Y=null),(at=_e[6])!=null&&at.w?G?G.p(_e,ae):(G=ma(_e),G.c(),G.m(l,o)):G&&(G.d(1),G=null),(mt=_e[6])!=null&&mt.n?U?(U.p(_e,ae),ae[0]&64&&X(U,1)):(U=ga(_e),U.c(),X(U,1),U.m(l,a)):U&&(ct(),x(U,1,1,()=>{U=null}),_t()),(lt=_e[6])!=null&<.q?W?(W.p(_e,ae),ae[0]&64&&X(W,1)):(W=wa(_e),W.c(),X(W,1),W.m(l,r)):W&&(ct(),x(W,1,1,()=>{W=null}),_t()),((el=(Bt=_e[6])==null?void 0:Bt.q)==null?void 0:el.m)==3?ne?ne.p(_e,ae):(ne=Ma(_e),ne.c(),ne.m(l,f)):ne&&(ne.d(1),ne=null),((nt=(pt=_e[6])==null?void 0:pt.q)==null?void 0:nt.m)==4?ee?ee.p(_e,ae):(ee=Na(_e),ee.c(),ee.m(l,c)):ee&&(ee.d(1),ee=null),(Qt=_e[6])!=null&&Qt.c?Q?(Q.p(_e,ae),ae[0]&64&&X(Q,1)):(Q=Pa(_e),Q.c(),X(Q,1),Q.m(l,m)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),ae[0]&64&&(_=((Zt=(It=(Jt=_e[6])==null?void 0:Jt.p)==null?void 0:It.r)==null?void 0:Zt.startsWith("NO"))||((Xt=(Gt=($t=_e[6])==null?void 0:$t.p)==null?void 0:Gt.r)==null?void 0:Xt.startsWith("10YNO"))||((st=(Ye=(ll=_e[6])==null?void 0:ll.p)==null?void 0:Ye.r)==null?void 0:st.startsWith("10Y1001A1001A4"))),_?ie?ie.p(_e,ae):(ie=Ra(_e),ie.c(),ie.m(l,d)):ie&&(ie.d(1),ie=null),(Mt=_e[6])!=null&&Mt.u?re?re.p(_e,ae):(re=Ba(_e),re.c(),re.m(l,h)):re&&(re.d(1),re=null),(kt=(Rt=_e[6])==null?void 0:Rt.i)!=null&&kt.h&&(((gt=_e[0])==null?void 0:gt.board)>20||((jt=_e[0])==null?void 0:jt.chip)=="esp8266"||((he=(Ft=(et=_e[6])==null?void 0:et.i)==null?void 0:Ft.d)==null?void 0:he.d)>0)?fe?(fe.p(_e,ae),ae[0]&65&&X(fe,1)):(fe=ja(_e),fe.c(),X(fe,1),fe.m(l,g)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),ae[0]&65&&(b=((Ie=_e[6])==null?void 0:Ie.d)&&((Vt=(We=_e[0])==null?void 0:We.features)==null?void 0:Vt.includes("rdebug"))),b?le?le.p(_e,ae):(le=Qa(_e),le.c(),le.m(l,null)):le&&(le.d(1),le=null),(Kt=_e[1])!=null&&Kt.a?de?de.p(_e,ae):(de=Ja(_e),de.c(),de.m(w,E)):de&&(de.d(1),de=null),_e[6]?oe?oe.p(_e,ae):(oe=$a(_e),oe.c(),oe.m(w,null)):oe&&(oe.d(1),oe=null);const Te={};ae[0]&8&&(Te.active=_e[3]),ae[0]&4&&(Te.message=((cl=(wt=_e[2].conf)==null?void 0:wt.mask)==null?void 0:cl.loading)??"Loading"),R.$set(Te);const Ke={};ae[0]&16&&(Ke.active=_e[4]),ae[0]&4&&(Ke.message=((Ht=(ol=_e[2].conf)==null?void 0:ol.mask)==null?void 0:Ht.saving)??"Saving"),L.$set(Ke);const Et={};ae[0]&1024&&(Et.active=_e[10]),ae[0]&4&&(Et.message=((ul=(Wt=_e[2].conf)==null?void 0:Wt.mask)==null?void 0:ul.reset)??"Factory reset"),H.$set(Et);const vt={};ae[0]&2048&&(vt.active=_e[11]),ae[0]&4&&(vt.message=(($=(Ee=_e[2].conf)==null?void 0:Ee.mask)==null?void 0:$.reset_done)??"Done"),z.$set(vt)},i(_e){q||(X(V),X(U),X(W),X(Q),X(fe),X(R.$$.fragment,_e),X(L.$$.fragment,_e),X(H.$$.fragment,_e),X(z.$$.fragment,_e),q=!0)},o(_e){x(V),x(U),x(W),x(Q),x(fe),x(R.$$.fragment,_e),x(L.$$.fragment,_e),x(H.$$.fragment,_e),x(z.$$.fragment,_e),q=!1},d(_e){_e&&(N(e),N(F),N(T),N(O),N(K)),V&&V.d(),Y&&Y.d(),G&&G.d(),U&&U.d(),W&&W.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),re&&re.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),Se(R,_e),Se(L,_e),Se(H,_e),Se(z,_e),B=!1,Z()}}}async function e_(){await(await fetch("reboot",{method:"POST"})).json()}function t_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:o}=e,a={};Pl.subscribe(it=>{l(2,a=it)});let r=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,d=[];Zn.subscribe(it=>{var Dt,al,ml;it.version&&(l(5,m=(Dt=it==null?void 0:it.c)==null?void 0:Dt.e),l(6,_=it),l(3,f=!1),l(7,d=[{code:"en",name:"English"}]),(al=_==null?void 0:_.u)!=null&&al.lang&&_.u.lang!="en"&&d.push({code:_.u.lang,name:((ml=a.language)==null?void 0:ml.name)??"Unknown"}),d.push({code:"hub",name:"Load from server"}))}),mc();let h=!0,g={};co.subscribe(it=>{var Dt;l(8,h=!0);for(let al=0;al(fl.hostname=Dt.get("gh"),fl.usrcfg=bl.success,fl.booting=bl.reboot,Dt.get("nm")=="static"&&(fl.net.ip=Dt.get("ni"),fl.net.mask=Dt.get("nu"),fl.net.gw=Dt.get("ng"),fl.net.dns1=Dt.get("nd")),fl.ui=_.u,fl)),l(4,c=!1),nn(n)}const F=function(){confirm("Reboot?")&&(hl.update(it=>(it.booting=!0,it)),e_())};async function R(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Zn.update(Dt=>(Dt.q.s.c=!1,Dt)))}async function T(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Zn.update(Dt=>(Dt.q.s.r=!1,Dt)))}async function L(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Zn.update(Dt=>(Dt.q.s.k=!1,Dt)))}const O=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function H(){if(_.u.lang=="hub"){const it=await Cl("http://hub.amsleser.no/hub/language/list.json");l(7,d=await it.json()),l(6,_.u.lang=a.language.code,_)}}async function K(){l(6,_.p.e=!0,_)}let z=44;async function q(){const it=await Cl("cloudkey.json");if(it.status==200){let Dt=await it.json();window.open("https://www.amsleser.cloud/device/"+Dt.seed)}else alert("Not able to bind to cloud")}const B=window||global;B.bindToCloud=function(){console.log("BIND CALLED")};function Z(){_.g.h=this.value,l(6,_)}function V(){_.g.t=Yt(this),l(6,_)}function Y(){_.p.r=Yt(this),l(6,_)}function G(){_.p.m=Yt(this),l(6,_)}function U(){_.p.c=Yt(this),l(6,_)}function W(){_.p.e=this.checked,l(6,_)}function ne(){_.p.t=this.value,l(6,_)}function ee(){_.g.s=Yt(this),l(6,_)}function Q(){_.g.u=this.value,l(6,_)}function ie(){_.g.p=this.value,l(6,_)}function re(){_.g.c=this.value,l(6,_)}function fe(){_.m.a=Yt(this),l(6,_)}function le(){_.m.b=Be(this.value),l(6,_)}function de(){_.m.i=this.checked,l(6,_)}function oe(){_.m.b=Yt(this),l(6,_)}function me(){_.m.p=Yt(this),l(6,_)}function se(){_.m.s=Be(this.value),l(6,_)}function pe(){_.m.d=Yt(this),l(6,_)}function we(){_.m.f=Be(this.value),l(6,_)}function S(){_.m.r=Be(this.value),l(6,_)}function C(){_.m.e.e=this.checked,l(6,_)}function I(){_.m.e.k=this.value,l(6,_)}function A(){_.m.e.a=this.value,l(6,_)}function y(){_.m.m.e=this.checked,l(6,_)}function te(){_.m.m.w=Be(this.value),l(6,_)}function ue(){_.m.m.v=Be(this.value),l(6,_)}function be(){_.m.m.a=Be(this.value),l(6,_)}function ke(){_.m.m.c=Be(this.value),l(6,_)}function J(){_.n.c=Yt(this),l(6,_)}function ve(){h=this.checked,l(8,h)}function ge(){_.w.s=this.value,l(6,_)}function qe(){_.w.s=Yt(this),l(6,_)}function Pe(){_.w.p=this.value,l(6,_)}function Ae(){_.w.z=Yt(this),l(6,_)}function Le(){_.w.w=Be(this.value),l(6,_)}function Ne(){_.w.b=this.checked,l(6,_)}function De(){_.n.m=Yt(this),l(6,_)}function Re(){_.n.i=this.value,l(6,_)}function $e(){_.n.s=Yt(this),l(6,_)}function xe(){_.n.g=this.value,l(6,_)}function ut(){_.n.d1=this.value,l(6,_)}function St(){_.n.d2=this.value,l(6,_)}function dt(){_.n.x=this.checked,l(6,_)}function rt(){_.n.d=this.checked,l(6,_)}function ot(){_.n.h=this.checked,l(6,_)}function ht(){_.n.n1=this.value,l(6,_)}function Ot(){_.q.s.e=this.checked,l(6,_)}function Je(){_.q.h=this.value,l(6,_)}function Fe(){_.q.p=Be(this.value),l(6,_)}function He(){_.q.u=this.value,l(6,_)}function tt(){_.q.a=this.value,l(6,_)}function Ge(){_.q.c=this.value,l(6,_)}function Ve(){_.q.m=Yt(this),l(6,_)}function Qe(){_.q.b=this.value,l(6,_)}function _e(){_.q.r=this.value,l(6,_)}function ae(){_.q.t=Yt(this),l(6,_)}function Te(){_.q.d=Be(this.value),l(6,_)}function Ke(){_.q.i=Be(this.value),l(6,_)}function Et(){_.q.k=Be(this.value),l(6,_)}function vt(){_.q.e=Be(this.value),l(6,_)}function Xe(){_.o.e=this.value,l(6,_)}function qt(){_.o.c=this.value,l(6,_)}function at(){_.o.u1=this.value,l(6,_)}function mt(){_.o.u2=this.value,l(6,_)}function lt(){_.o.u3=this.value,l(6,_)}function Bt(){_.h.t=this.value,l(6,_)}function el(){_.h.h=this.value,l(6,_)}function pt(){_.h.n=this.value,l(6,_)}function nt(){_.c.e=this.checked,l(6,_)}function Qt(){_.c.p=Yt(this),l(6,_)}function Jt(){_.c.es=this.checked,l(6,_)}function It(){_.c.ze=this.checked,l(6,_)}function Zt(){_.c.zt=this.value,l(6,_)}function $t(it){_.t.t[it]=Be(this.value),l(6,_)}function Gt(){_.t.h=Be(this.value),l(6,_)}function Xt(it){_.u[it.key]=Yt(this),l(6,_)}function ll(){_.u.lang=Yt(this),l(6,_)}function Ye(){_.i.h.p=Yt(this),l(6,_)}function st(){_.i.h.t=Yt(this),l(6,_)}function Mt(){_.i.h.u=this.checked,l(6,_)}function Rt(){_.i.a=Be(this.value),l(6,_)}function kt(){_.i.l.p=Be(this.value),l(6,_)}function gt(){_.i.l.i=this.checked,l(6,_)}function jt(){_.i.r.i=this.checked,l(6,_)}function et(){_.i.r.r=Be(this.value),l(6,_)}function Ft(){_.i.r.g=Be(this.value),l(6,_)}function he(){_.i.r.b=Be(this.value),l(6,_)}function Ie(){_.i.d.d=Be(this.value),l(6,_)}function We(){_.i.t.d=Be(this.value),l(6,_)}function Vt(){_.i.t.a=Be(this.value),l(6,_)}function Kt(){_.i.v.p=Be(this.value),l(6,_)}function wt(){_.i.v.d.v=Be(this.value),l(6,_)}function cl(){_.i.v.d.g=Be(this.value),l(6,_)}function ol(){_.i.d.b=Yt(this),l(6,_)}function Ht(){_.i.p=Yt(this),l(6,_)}function Wt(){_.i.v.o=Be(this.value),l(6,_)}function ul(){_.i.v.m=Be(this.value),l(6,_)}function Ee(){_.i.v.b=Be(this.value),l(6,_)}function $(){_.d.s=this.checked,l(6,_)}function Oe(){_.d.t=this.checked,l(6,_)}function _l(){_.d.l=Yt(this),l(6,_)}return t.$$set=it=>{"basepath"in it&&l(24,n=it.basepath),"sysinfo"in it&&l(0,i=it.sysinfo),"data"in it&&l(1,o=it.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,z=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,a,f,c,m,_,d,h,g,b,k,z,r,w,E,F,R,T,L,O,H,K,q,n,Z,V,Y,G,U,W,ne,ee,Q,ie,re,fe,le,de,oe,me,se,pe,we,S,C,I,A,y,te,ue,be,ke,J,ve,ge,qe,Pe,Ae,Le,Ne,De,Re,$e,xe,ut,St,dt,rt,ot,ht,Ot,Je,Fe,He,tt,Ge,Ve,Qe,_e,ae,Te,Ke,Et,vt,Xe,qt,at,mt,lt,Bt,el,pt,nt,Qt,Jt,It,Zt,$t,Gt,Xt,ll,Ye,st,Mt,Rt,kt,gt,jt,et,Ft,he,Ie,We,Vt,Kt,wt,cl,ol,Ht,Wt,ul,Ee,$,Oe,_l]}class l_ extends Tt{constructor(e){super(),Pt(this,e,t_,xc,Ct,{basepath:24,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}function xa(t,e,l){const n=t.slice();return n[23]=e[l],n}function ef(t){let e,l=t[0].cpu+"",n,i;return{c(){e=M("("),n=M(l),i=M("MHz)")},m(o,a){P(o,e,a),P(o,n,a),P(o,i,a)},p(o,a){a&1&&l!==(l=o[0].cpu+"")&&D(n,l)},d(o){o&&(N(e),N(n),N(i))}}}function n_(t){let e=Ze(t[0].chip,t[0].board)+"",l;return{c(){l=M(e)},m(n,i){P(n,l,i)},p(n,i){i&1&&e!==(e=Ze(n[0].chip,n[0].board)+"")&&D(l,e)},d(n){n&&N(l)}}}function tf(t){var G,U,W,ne,ee,Q,ie,re;let e,l=(((U=(G=t[3].status)==null?void 0:G.device)==null?void 0:U.apmac)??"AP MAC")+"",n,i,o=t[0].apmac+"",a,r,f,c=(((ne=(W=t[3].status)==null?void 0:W.device)==null?void 0:ne.last_boot)??"Last boot")+"",m,_,d,h,g,b,k=(((Q=(ee=t[3].status)==null?void 0:ee.device)==null?void 0:Q.reason)??"Reason")+"",w,E,F=(((re=(ie=t[3][Ao(t[0].chip)])==null?void 0:ie.reason)==null?void 0:re[t[0].boot_reason])??t[0].boot_reason)+"",R,T,L=t[0].boot_reason+"",O,H,K=t[0].ex_cause+"",z,q,B;const Z=[o_,i_],V=[];function Y(fe,le){return fe[1].u>0?0:1}return d=Y(t),h=V[d]=Z[d](t),{c(){e=p("div"),n=M(l),i=M(": "),a=M(o),r=v(),f=p("div"),m=M(c),_=M(`: + `),h.c(),g=v(),b=p("div"),w=M(k),E=M(": "),R=M(F),T=M(" ("),O=M(L),H=M("/"),z=M(K),q=M(")"),u(e,"class","my-2"),u(f,"class","my-2"),u(b,"class","my-2")},m(fe,le){P(fe,e,le),s(e,n),s(e,i),s(e,a),P(fe,r,le),P(fe,f,le),s(f,m),s(f,_),V[d].m(f,null),P(fe,g,le),P(fe,b,le),s(b,w),s(b,E),s(b,R),s(b,T),s(b,O),s(b,H),s(b,z),s(b,q),B=!0},p(fe,le){var oe,me,se,pe,we,S,C,I;(!B||le&8)&&l!==(l=(((me=(oe=fe[3].status)==null?void 0:oe.device)==null?void 0:me.apmac)??"AP MAC")+"")&&D(n,l),(!B||le&1)&&o!==(o=fe[0].apmac+"")&&D(a,o),(!B||le&8)&&c!==(c=(((pe=(se=fe[3].status)==null?void 0:se.device)==null?void 0:pe.last_boot)??"Last boot")+"")&&D(m,c);let de=d;d=Y(fe),d===de?V[d].p(fe,le):(ct(),x(V[de],1,1,()=>{V[de]=null}),_t(),h=V[d],h?h.p(fe,le):(h=V[d]=Z[d](fe),h.c()),X(h,1),h.m(f,null)),(!B||le&8)&&k!==(k=(((S=(we=fe[3].status)==null?void 0:we.device)==null?void 0:S.reason)??"Reason")+"")&&D(w,k),(!B||le&9)&&F!==(F=(((I=(C=fe[3][Ao(fe[0].chip)])==null?void 0:C.reason)==null?void 0:I[fe[0].boot_reason])??fe[0].boot_reason)+"")&&D(R,F),(!B||le&1)&&L!==(L=fe[0].boot_reason+"")&&D(O,L),(!B||le&1)&&K!==(K=fe[0].ex_cause+"")&&D(z,K)},i(fe){B||(X(h),B=!0)},o(fe){x(h),B=!1},d(fe){fe&&(N(e),N(r),N(f),N(g),N(b)),V[d].d()}}}function i_(t){let e;return{c(){e=M("-")},m(l,n){P(l,e,n)},p:je,i:je,o:je,d(l){l&&N(e)}}}function o_(t){let e,l;return e=new Yu({props:{timestamp:new Date(new Date().getTime()-t[1].u*1e3),fullTimeColor:"",offset:t[0].clock_offset}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.timestamp=new Date(new Date().getTime()-n[1].u*1e3)),i&1&&(o.offset=n[0].clock_offset),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function lf(t){var m;let e,l,n,i,o=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,r,f,c;return l=new wl({props:{to:"/consent",$$slots:{default:[s_]},$$scope:{ctx:t}}}),{c(){e=p("div"),Me(l.$$.fragment),n=v(),i=p("button"),a=M(o),u(i,"class","btn-yellow-sm float-right"),u(e,"class","my-2")},m(_,d){P(_,e,d),Ce(l,e,null),s(e,n),s(e,i),s(i,a),r=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,d){var g;const h={};d&67108872&&(h.$$scope={dirty:d,ctx:_}),l.$set(h),(!r||d&8)&&o!==(o=(((g=_[3].btn)==null?void 0:g.reboot)??"Reboot")+"")&&D(a,o)},i(_){r||(X(l.$$.fragment,_),r=!0)},o(_){x(l.$$.fragment,_),r=!1},d(_){_&&N(e),Se(l),f=!1,c()}}}function s_(t){var i,o;let e,l=(((o=(i=t[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=M(l),u(e,"class","btn-pri-sm")},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&D(n,l)},d(a){a&&N(e)}}}function nf(t){var z,q,B,Z,V,Y,G,U;let e,l,n=(((q=(z=t[3].status)==null?void 0:z.meter)==null?void 0:q.title)??"Meter")+"",i,o,a,r=(((Z=(B=t[3].status)==null?void 0:B.meter)==null?void 0:Z.manufacturer)??"Manufacturer")+"",f,c,m=wi(t[0].meter.mfg)+"",_,d,h,g=(((Y=(V=t[3].status)==null?void 0:V.meter)==null?void 0:Y.model)??"Model")+"",b,k,w=(t[0].meter.model?t[0].meter.model:"unknown")+"",E,F,R,T=(((U=(G=t[3].status)==null?void 0:G.meter)==null?void 0:U.id)??"ID")+"",L,O,H=(t[0].meter.id?t[0].meter.id:"unknown")+"",K;return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),f=M(r),c=M(": "),_=M(m),d=v(),h=p("div"),b=M(g),k=M(": "),E=M(w),F=v(),R=p("div"),L=M(T),O=M(": "),K=M(H),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(R,"class","my-2"),u(e,"class","cnt")},m(W,ne){P(W,e,ne),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,d),s(e,h),s(h,b),s(h,k),s(h,E),s(e,F),s(e,R),s(R,L),s(R,O),s(R,K)},p(W,ne){var ee,Q,ie,re,fe,le,de,oe;ne&8&&n!==(n=(((Q=(ee=W[3].status)==null?void 0:ee.meter)==null?void 0:Q.title)??"Meter")+"")&&D(i,n),ne&8&&r!==(r=(((re=(ie=W[3].status)==null?void 0:ie.meter)==null?void 0:re.manufacturer)??"Manufacturer")+"")&&D(f,r),ne&1&&m!==(m=wi(W[0].meter.mfg)+"")&&D(_,m),ne&8&&g!==(g=(((le=(fe=W[3].status)==null?void 0:fe.meter)==null?void 0:le.model)??"Model")+"")&&D(b,g),ne&1&&w!==(w=(W[0].meter.model?W[0].meter.model:"unknown")+"")&&D(E,w),ne&8&&T!==(T=(((oe=(de=W[3].status)==null?void 0:de.meter)==null?void 0:oe.id)??"ID")+"")&&D(L,T),ne&1&&H!==(H=(W[0].meter.id?W[0].meter.id:"unknown")+"")&&D(K,H)},d(W){W&&N(e)}}}function of(t){var U,W,ne,ee,Q,ie,re,fe;let e,l,n=(((W=(U=t[3].status)==null?void 0:U.network)==null?void 0:W.title)??"Network")+"",i,o,a,r=(((ee=(ne=t[3].conf)==null?void 0:ne.network)==null?void 0:ee.ip)??"IP")+"",f,c,m=t[0].net.ip+"",_,d,h,g=(((ie=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ie.mask)??"Mask")+"",b,k,w=t[0].net.mask+"",E,F,R,T=(((fe=(re=t[3].conf)==null?void 0:re.network)==null?void 0:fe.gw)??"Gateway")+"",L,O,H=t[0].net.gw+"",K,z,q,B,Z,V=t[0].net.dns1&&sf(t),Y=t[0].net.dns2&&af(t),G=t[0].net.ipv6&&ff(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=v(),a=p("div"),f=M(r),c=M(": "),_=M(m),d=v(),h=p("div"),b=M(g),k=M(": "),E=M(w),F=v(),R=p("div"),L=M(T),O=M(": "),K=M(H),z=v(),q=p("div"),V&&V.c(),B=v(),Y&&Y.c(),Z=v(),G&&G.c(),u(l,"class","text-sm"),u(a,"class","my-2"),u(h,"class","my-2"),u(R,"class","my-2"),u(q,"class","my-2"),u(e,"class","cnt")},m(le,de){P(le,e,de),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,d),s(e,h),s(h,b),s(h,k),s(h,E),s(e,F),s(e,R),s(R,L),s(R,O),s(R,K),s(e,z),s(e,q),V&&V.m(q,null),s(q,B),Y&&Y.m(q,null),s(e,Z),G&&G.m(e,null)},p(le,de){var oe,me,se,pe,we,S,C,I;de&8&&n!==(n=(((me=(oe=le[3].status)==null?void 0:oe.network)==null?void 0:me.title)??"Network")+"")&&D(i,n),de&8&&r!==(r=(((pe=(se=le[3].conf)==null?void 0:se.network)==null?void 0:pe.ip)??"IP")+"")&&D(f,r),de&1&&m!==(m=le[0].net.ip+"")&&D(_,m),de&8&&g!==(g=(((S=(we=le[3].conf)==null?void 0:we.network)==null?void 0:S.mask)??"Mask")+"")&&D(b,g),de&1&&w!==(w=le[0].net.mask+"")&&D(E,w),de&8&&T!==(T=(((I=(C=le[3].conf)==null?void 0:C.network)==null?void 0:I.gw)??"Gateway")+"")&&D(L,T),de&1&&H!==(H=le[0].net.gw+"")&&D(K,H),le[0].net.dns1?V?V.p(le,de):(V=sf(le),V.c(),V.m(q,B)):V&&(V.d(1),V=null),le[0].net.dns2?Y?Y.p(le,de):(Y=af(le),Y.c(),Y.m(q,null)):Y&&(Y.d(1),Y=null),le[0].net.ipv6?G?G.p(le,de):(G=ff(le),G.c(),G.m(e,null)):G&&(G.d(1),G=null)},d(le){le&&N(e),V&&V.d(),Y&&Y.d(),G&&G.d()}}}function sf(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[0].net.dns1+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&D(l,e),c&1&&i!==(i=f[0].net.dns1+"")&&D(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function af(t){var a,r;let e=(((r=(a=t[3].conf)==null?void 0:a.network)==null?void 0:r.dns)??"DNS")+"",l,n,i=t[0].net.dns2+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){P(f,l,c),P(f,n,c),P(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&D(l,e),c&1&&i!==(i=f[0].net.dns2+"")&&D(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function ff(t){let e,l,n,i=t[0].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"",o,a,r,f,c=t[0].net.dns1v6&&uf(t),m=t[0].net.dns2v6&&rf(t);return{c(){e=p("div"),l=M("IPv6: "),n=p("span"),o=M(i),a=v(),r=p("div"),c&&c.c(),f=v(),m&&m.c(),Ml(n,"font-size","14px"),u(e,"class","my-2"),u(r,"class","my-2")},m(_,d){P(_,e,d),s(e,l),s(e,n),s(n,o),P(_,a,d),P(_,r,d),c&&c.m(r,null),s(r,f),m&&m.m(r,null)},p(_,d){d&1&&i!==(i=_[0].net.ipv6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&D(o,i),_[0].net.dns1v6?c?c.p(_,d):(c=uf(_),c.c(),c.m(r,f)):c&&(c.d(1),c=null),_[0].net.dns2v6?m?m.p(_,d):(m=rf(_),m.c(),m.m(r,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(r)),c&&c.d(),m&&m.d()}}}function uf(t){let e,l,n=t[0].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Ml(l,"font-size","14px")},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=o[0].net.dns1v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function rf(t){let e,l,n=t[0].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Ml(l,"font-size","14px")},m(o,a){P(o,e,a),P(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=o[0].net.dns2v6.replace(/\b:?(?:0+:?){2,}/,"::")+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function cf(t){let e,l,n,i,o,a,r,f,c;return{c(){e=p("div"),l=M(`Channel: + `),n=p("select"),i=p("option"),i.textContent="Stable",o=p("option"),o.textContent="Early",a=p("option"),a.textContent="Release Candidate",r=p("option"),r.textContent="Snapshot",i.__value=0,j(i,i.__value),o.__value=1,j(o,o.__value),a.__value=2,j(a,a.__value),r.__value=3,j(r,r.__value),r.disabled=!0,u(n,"class","in-s w-full"),t[0].upgrade.c===void 0&&Nt(()=>t[14].call(n)),u(e,"class","my-2")},m(m,_){P(m,e,_),s(e,l),s(e,n),s(n,i),s(n,o),s(n,a),s(n,r),Ue(n,t[0].upgrade.c,!0),f||(c=[ce(n,"change",t[14]),ce(n,"change",t[13])],f=!0)},p(m,_){_&1&&Ue(n,m[0].upgrade.c)},d(m){m&&N(e),f=!1,zt(c)}}}function _f(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[0].upgrade.f).replace("{1}",t[0].upgrade.t)+"",i,o,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[0].upgrade.e])??t[0].upgrade.e)+"",r;return{c(){e=p("div"),l=p("div"),i=M(n),o=v(),r=M(a),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(d,h){P(d,e,h),s(e,l),s(l,i),s(l,o),s(l,r)},p(d,h){var g,b,k,w;h&9&&n!==(n=(((b=(g=d[3].status)==null?void 0:g.firmware)==null?void 0:b.failed)??"Upgrade from {0} to {1} failed").replace("{0}",d[0].upgrade.f).replace("{1}",d[0].upgrade.t)+"")&&D(i,n),h&9&&a!==(a=(((w=(k=d[3].errors)==null?void 0:k.upgrade)==null?void 0:w[d[0].upgrade.e])??d[0].upgrade.e)+"")&&D(r,a)},d(d){d&&N(e)}}}function mf(t){var g,b;let e,l=(((b=(g=t[3].status)==null?void 0:g.firmware)==null?void 0:b.latest)??"Latest")+"",n,i,o,a=t[0].upgrade.n+"",r,f,c,m,_,d=(t[0].security==0||t[1].a)&&t[0].fwconsent===1&&t[0].upgrade.n&&t[0].upgrade.n!=t[0].version&&pf(t),h=t[0].fwconsent===2&&df(t);return{c(){e=p("div"),n=M(l),i=M(`: + `),o=p("a"),r=M(a),c=v(),d&&d.c(),m=v(),h&&h.c(),_=yt(),u(o,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[0].upgrade.n),u(o,"class","ml-2 text-blue-600 hover:text-blue-800"),u(o,"target","_blank"),u(o,"rel","noreferrer"),u(e,"class","my-2 flex")},m(k,w){P(k,e,w),s(e,n),s(e,i),s(e,o),s(o,r),s(e,c),d&&d.m(e,null),P(k,m,w),h&&h.m(k,w),P(k,_,w)},p(k,w){var E,F;w&8&&l!==(l=(((F=(E=k[3].status)==null?void 0:E.firmware)==null?void 0:F.latest)??"Latest")+"")&&D(n,l),w&1&&a!==(a=k[0].upgrade.n+"")&&D(r,a),w&1&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+k[0].upgrade.n)&&u(o,"href",f),(k[0].security==0||k[1].a)&&k[0].fwconsent===1&&k[0].upgrade.n&&k[0].upgrade.n!=k[0].version?d?d.p(k,w):(d=pf(k),d.c(),d.m(e,null)):d&&(d.d(1),d=null),k[0].fwconsent===2?h?h.p(k,w):(h=df(k),h.c(),h.m(_.parentNode,_)):h&&(h.d(1),h=null)},d(k){k&&(N(e),N(m),N(_)),d&&d.d(),h&&h.d(k)}}}function pf(t){let e,l,n,i,o;return{c(){var a,r;e=p("div"),l=p("button"),l.textContent="⇓",u(e,"class","flex-none ml-2 text-green-500"),u(e,"title",n=((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.install)??"Install")},m(a,r){P(a,e,r),s(e,l),i||(o=ce(l,"click",t[10]),i=!0)},p(a,r){var f,c;r&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&u(e,"title",n)},d(a){a&&N(e),i=!1,o()}}}function df(t){var o,a;let e,l,n=(((a=(o=t[3].status)==null?void 0:o.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=M(n),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(r,f){P(r,e,f),s(e,l),s(l,i)},p(r,f){var c,m;f&8&&n!==(n=(((m=(c=r[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&D(i,n)},d(r){r&&N(e)}}}function hf(t){let e,l=Io(Ze(t[0].chip,t[0].board))+"",n;return{c(){e=p("div"),n=M(l),u(e,"class","bd-red")},m(i,o){P(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=Io(Ze(i[0].chip,i[0].board))+"")&&D(n,l)},d(i){i&&N(e)}}}function vf(t){let e,l,n,i,o,a;function r(m,_){return m[5].length==0?f_:a_}let f=r(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=v(),c.c(),Ml(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(m,_){P(m,e,_),s(e,l),s(l,n),t[15](n),s(l,i),c.m(l,null),o||(a=[ce(n,"change",t[16]),ce(l,"submit",t[18])],o=!0)},p(m,_){f===(f=r(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[15](null),c.d(),o=!1,zt(a)}}}function a_(t){var r;let e=t[5][0].name+"",l,n,i,o=(((r=t[3].btn)==null?void 0:r.upload)??"Upload")+"",a;return{c(){l=M(e),n=v(),i=p("button"),a=M(o),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(f,c){P(f,l,c),P(f,n,c),P(f,i,c),s(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&D(l,e),c&8&&o!==(o=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&D(a,o)},d(f){f&&(N(l),N(n),N(i))}}}function f_(t){var a,r;let e,l=(((r=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:r.btn_select_file)??"Select file")+"",n,i,o;return{c(){e=p("button"),n=M(l),u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(f,c){P(f,e,c),s(e,n),i||(o=ce(e,"click",t[17]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&D(n,l)},d(f){f&&N(e),i=!1,o()}}}function bf(t){var Y,G,U,W,ne,ee;let e,l,n=(((G=(Y=t[3].status)==null?void 0:Y.backup)==null?void 0:G.title)??"Backup")+"",i,o,a,r,f,c,m,_,d=(((W=(U=t[3].status)==null?void 0:U.backup)==null?void 0:W.secrets)??"Include secrets")+"",h,g,b,k=(((ee=(ne=t[3].status)==null?void 0:ne.backup)==null?void 0:ee.secrets_desc)??"")+"",w,E,F,R,T,L,O,H,K=ft(t[9]),z=[];for(let Q=0;Q{ve=null}),_t()),(pt=ae[1])!=null&&pt.a?ge?(ge.p(ae,Te),Te&2&&X(ge,1)):(ge=lf(ae),ge.c(),X(ge,1),ge.m(l,null)):ge&&(ct(),x(ge,1,1,()=>{ge=null}),_t()),ae[0].meter?qe?qe.p(ae,Te):(qe=nf(ae),qe.c(),qe.m(e,V)):qe&&(qe.d(1),qe=null),ae[0].net?Pe?Pe.p(ae,Te):(Pe=of(ae),Pe.c(),Pe.m(e,Y)):Pe&&(Pe.d(1),Pe=null),(!ke||Te&8)&&W!==(W=(((Qt=(nt=ae[3].status)==null?void 0:nt.firmware)==null?void 0:Qt.title)??"Firmware")+"")&&D(ne,W),ae[0].fwconsent===1?Ae?Ae.p(ae,Te):(Ae=cf(ae),Ae.c(),Ae.m(G,re)):Ae&&(Ae.d(1),Ae=null),(!ke||Te&8)&&le!==(le=(((It=(Jt=ae[3].status)==null?void 0:Jt.firmware)==null?void 0:It.installed)??"Installed")+"")&&D(de,le),(!ke||Te&1)&&me!==(me=ae[0].version+"")&&D(se,me),ae[0].upgrade.t&&ae[0].upgrade.t!=ae[0].version&&ae[0].upgrade.e!=0&&ae[0].upgrade.e!=123?Le?Le.p(ae,Te):(Le=_f(ae),Le.c(),Le.m(G,we)):Le&&(Le.d(1),Le=null),ae[0].upgrade.n?Ne?Ne.p(ae,Te):(Ne=mf(ae),Ne.c(),Ne.m(G,S)):Ne&&(Ne.d(1),Ne=null),Te&3&&(C=(ae[0].security==0||ae[1].a)&&cn(ae[0].board)),C?De?De.p(ae,Te):(De=hf(ae),De.c(),De.m(G,I)):De&&(De.d(1),De=null),ae[0].security==0||ae[1].a?Re?Re.p(ae,Te):(Re=vf(ae),Re.c(),Re.m(G,null)):Re&&(Re.d(1),Re=null),ae[0].security==0||ae[1].a?$e?$e.p(ae,Te):($e=bf(ae),$e.c(),$e.m(e,null)):$e&&($e.d(1),$e=null);const Et={};Te&64&&(Et.active=ae[6]),Te&8&&(Et.message=(($t=(Zt=ae[3].status)==null?void 0:Zt.mask)==null?void 0:$t.firmware)??"Uploading"),te.$set(Et);const vt={};Te&256&&(vt.active=ae[8]),Te&8&&(vt.message=((Xt=(Gt=ae[3].status)==null?void 0:Gt.mask)==null?void 0:Xt.config)??"Uploading"),be.$set(vt)},i(ae){ke||(X(F.$$.fragment,ae),X(ve),X(ge),X(te.$$.fragment,ae),X(be.$$.fragment,ae),ke=!0)},o(ae){x(F.$$.fragment,ae),x(ve),x(ge),x(te.$$.fragment,ae),x(be.$$.fragment,ae),ke=!1},d(ae){ae&&(N(e),N(y),N(ue)),J&&J.d(),Se(F),ve&&ve.d(),ge&&ge.d(),qe&&qe.d(),Pe&&Pe.d(),Ae&&Ae.d(),Le&&Le.d(),Ne&&Ne.d(),De&&De.d(),Re&&Re.d(),$e&&$e.d(),Se(te,ae),Se(be,ae)}}}async function __(){await(await fetch("reboot",{method:"POST"})).json()}function m_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],a={};Pl.subscribe(z=>{l(3,a=z)});function r(){var z;confirm((((z=a.header)==null?void 0:z.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Ku(i.upgrade.n),hl.update(q=>(q.upgrade.t=i.upgrade.n,q.upgrade.p=0,q.upgrading=!0,q)))}const f=function(){var z;confirm(((z=a.device)==null?void 0:z.reboot_confirm)??"Reboot?")&&(hl.update(q=>(q.booting=!0,q)),__())};let c,m=[],_=!1,d,h=[],g=!1;Ti();let b={hostname:"",ip:""};function k(z){l(8,g=!0);const q=new FormData;q.append("file",h[0]),fetch("configfile",{method:"POST",body:q}).then(B=>B.json()).then(B=>{hl.update(Z=>(b&&b.hostname&&(Z.hostname=b.hostname),Z.booting=B.reboot,b&&b.ip&&(Z.net.ip=b.ip),setTimeout(ti,5e3,i),Z))}).catch(B=>{console.error("Error:",B),setTimeout(ti,5e3,i)})}function w(){const z=new FormData;z.append("channel",i.upgrade.c),fetch("fwchannel",{method:"POST",body:z})}function E(){i.upgrade.c=Yt(this),l(0,i)}function F(z){gi[z?"unshift":"push"](()=>{c=z,l(4,c)})}function R(){m=this.files,l(5,m)}const T=()=>{c.click()},L=()=>l(6,_=!0);function O(z){gi[z?"unshift":"push"](()=>{d=z,l(7,d)})}function H(){h=this.files,l(2,h)}const K=()=>{d.click()};return t.$$set=z=>{"data"in z&&l(1,n=z.data),"sysinfo"in z&&l(0,i=z.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&h.length==1){let z=h[0],q=new FileReader,B=Z=>{let V=Z.target.result.split(` +`);for(let Y in V){let G=V[Y];G.startsWith("hostname ")?b.hostname=G.split(" ")[1]:G.startsWith("ip ")&&(b.ip=G.split(" ")[1])}};q.onload=B,q.readAsText(z)}},[i,n,h,a,c,m,_,d,g,o,r,f,k,w,E,F,R,T,L,O,H,K]}class p_ extends Tt{constructor(e){super(),Pt(this,e,m_,c_,Ct,{data:1,sysinfo:0})}}function wf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],5)+"",r,f,c=Ze(t[0],4)+"",m,_,d=Ze(t[0],3)+"",h,g,b,k,w=Ze(t[0],2)+"",E,F,R=Ze(t[0],1)+"",T,L,O=Ze(t[0],0)+"",H,K,z,q,B=Ze(t[0],101)+"",Z,V,Y=Ze(t[0],100)+"",G;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=p("option"),h=M(d),g=v(),b=p("optgroup"),k=p("option"),E=M(w),F=p("option"),T=M(R),L=p("option"),H=M(O),K=v(),z=p("optgroup"),q=p("option"),Z=M(B),V=p("option"),G=M(Y),l.__value=7,j(l,l.__value),o.__value=5,j(o,o.__value),f.__value=4,j(f,f.__value),_.__value=3,j(_,_.__value),u(e,"label","amsleser.no"),k.__value=2,j(k,k.__value),F.__value=1,j(F,F.__value),L.__value=0,j(L,L.__value),u(b,"label","Custom hardware"),q.__value=101,j(q,q.__value),V.__value=100,j(V,V.__value),u(z,"label","Generic hardware")},m(U,W){P(U,e,W),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),s(e,_),s(_,h),P(U,g,W),P(U,b,W),s(b,k),s(k,E),s(b,F),s(F,T),s(b,L),s(L,H),P(U,K,W),P(U,z,W),s(z,q),s(q,Z),s(z,V),s(V,G)},p(U,W){W&1&&n!==(n=Ze(U[0],7)+"")&&D(i,n),W&1&&a!==(a=Ze(U[0],5)+"")&&D(r,a),W&1&&c!==(c=Ze(U[0],4)+"")&&D(m,c),W&1&&d!==(d=Ze(U[0],3)+"")&&D(h,d),W&1&&w!==(w=Ze(U[0],2)+"")&&D(E,w),W&1&&R!==(R=Ze(U[0],1)+"")&&D(T,R),W&1&&O!==(O=Ze(U[0],0)+"")&&D(H,O),W&1&&B!==(B=Ze(U[0],101)+"")&&D(Z,B),W&1&&Y!==(Y=Ze(U[0],100)+"")&&D(G,Y)},d(U){U&&(N(e),N(g),N(b),N(K),N(z))}}}function Cf(t){let e,l,n=Ze(t[0],201)+"",i,o,a=Ze(t[0],202)+"",r,f,c=Ze(t[0],203)+"",m,_,d=Ze(t[0],241)+"",h,g,b=Ze(t[0],242)+"",k,w,E=Ze(t[0],243)+"",F,R,T=Ze(t[0],245)+"",L,O,H=Ze(t[0],200)+"",K;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=p("option"),h=M(d),g=p("option"),k=M(b),w=p("option"),F=M(E),R=p("option"),L=M(T),O=p("option"),K=M(H),l.__value=201,j(l,l.__value),o.__value=202,j(o,o.__value),f.__value=203,j(f,f.__value),_.__value=241,j(_,_.__value),g.__value=242,j(g,g.__value),w.__value=243,j(w,w.__value),R.__value=245,j(R,R.__value),O.__value=200,j(O,O.__value),u(e,"label","Generic hardware")},m(z,q){P(z,e,q),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),s(e,_),s(_,h),s(e,g),s(g,k),s(e,w),s(w,F),s(e,R),s(R,L),s(e,O),s(O,K)},p(z,q){q&1&&n!==(n=Ze(z[0],201)+"")&&D(i,n),q&1&&a!==(a=Ze(z[0],202)+"")&&D(r,a),q&1&&c!==(c=Ze(z[0],203)+"")&&D(m,c),q&1&&d!==(d=Ze(z[0],241)+"")&&D(h,d),q&1&&b!==(b=Ze(z[0],242)+"")&&D(k,b),q&1&&E!==(E=Ze(z[0],243)+"")&&D(F,E),q&1&&T!==(T=Ze(z[0],245)+"")&&D(L,T),q&1&&H!==(H=Ze(z[0],200)+"")&&D(K,H)},d(z){z&&N(e)}}}function Sf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],6)+"",r,f,c=Ze(t[0],5)+"",m,_,d,h,g=Ze(t[0],51)+"",b,k,w=Ze(t[0],50)+"",E;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),r=M(a),f=p("option"),m=M(c),_=v(),d=p("optgroup"),h=p("option"),b=M(g),k=p("option"),E=M(w),l.__value=7,j(l,l.__value),o.__value=6,j(o,o.__value),f.__value=5,j(f,f.__value),u(e,"label","amsleser.no"),h.__value=51,j(h,h.__value),k.__value=50,j(k,k.__value),u(d,"label","Generic hardware")},m(F,R){P(F,e,R),s(e,l),s(l,i),s(e,o),s(o,r),s(e,f),s(f,m),P(F,_,R),P(F,d,R),s(d,h),s(h,b),s(d,k),s(k,E)},p(F,R){R&1&&n!==(n=Ze(F[0],7)+"")&&D(i,n),R&1&&a!==(a=Ze(F[0],6)+"")&&D(r,a),R&1&&c!==(c=Ze(F[0],5)+"")&&D(m,c),R&1&&g!==(g=Ze(F[0],51)+"")&&D(b,g),R&1&&w!==(w=Ze(F[0],50)+"")&&D(E,w)},d(F){F&&(N(e),N(_),N(d))}}}function Mf(t){let e,l,n=Ze(t[0],8)+"",i,o,a,r,f=Ze(t[0],71)+"",c,m,_=Ze(t[0],70)+"",d;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=v(),a=p("optgroup"),r=p("option"),c=M(f),m=p("option"),d=M(_),l.__value=8,j(l,l.__value),u(e,"label","Custom hardware"),r.__value=71,j(r,r.__value),m.__value=70,j(m,m.__value),u(a,"label","Generic hardware")},m(h,g){P(h,e,g),s(e,l),s(l,i),P(h,o,g),P(h,a,g),s(a,r),s(r,c),s(a,m),s(m,d)},p(h,g){g&1&&n!==(n=Ze(h[0],8)+"")&&D(i,n),g&1&&f!==(f=Ze(h[0],71)+"")&&D(c,f),g&1&&_!==(_=Ze(h[0],70)+"")&&D(d,_)},d(h){h&&(N(e),N(o),N(a))}}}function Nf(t){let e,l,n=Ze(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=200,j(l,l.__value),u(e,"label","Generic hardware")},m(o,a){P(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],200)+"")&&D(i,n)},d(o){o&&N(e)}}}function Pf(t){let e,l,n=Ze(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=80,j(l,l.__value),u(e,"label","Generic hardware")},m(o,a){P(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],80)+"")&&D(i,n)},d(o){o&&N(e)}}}function d_(t){let e,l,n,i,o,a,r,f,c=t[0]=="esp8266"&&wf(t),m=t[0]=="esp32"&&Cf(t),_=t[0]=="esp32s2"&&Sf(t),d=t[0]=="esp32c3"&&Mf(t),h=t[0]=="esp32solo"&&Nf(t),g=t[0]=="esp32s3"&&Pf(t);return{c(){e=p("option"),l=v(),c&&c.c(),n=v(),m&&m.c(),i=v(),_&&_.c(),o=v(),d&&d.c(),a=v(),h&&h.c(),r=v(),g&&g.c(),f=yt(),e.__value=-1,j(e,e.__value)},m(b,k){P(b,e,k),P(b,l,k),c&&c.m(b,k),P(b,n,k),m&&m.m(b,k),P(b,i,k),_&&_.m(b,k),P(b,o,k),d&&d.m(b,k),P(b,a,k),h&&h.m(b,k),P(b,r,k),g&&g.m(b,k),P(b,f,k)},p(b,[k]){b[0]=="esp8266"?c?c.p(b,k):(c=wf(b),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),b[0]=="esp32"?m?m.p(b,k):(m=Cf(b),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),b[0]=="esp32s2"?_?_.p(b,k):(_=Sf(b),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),b[0]=="esp32c3"?d?d.p(b,k):(d=Mf(b),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null),b[0]=="esp32solo"?h?h.p(b,k):(h=Nf(b),h.c(),h.m(r.parentNode,r)):h&&(h.d(1),h=null),b[0]=="esp32s3"?g?g.p(b,k):(g=Pf(b),g.c(),g.m(f.parentNode,f)):g&&(g.d(1),g=null)},i:je,o:je,d(b){b&&(N(e),N(l),N(n),N(i),N(o),N(a),N(r),N(f)),c&&c.d(b),m&&m.d(b),_&&_.d(b),d&&d.d(b),h&&h.d(b),g&&g.d(b)}}}function h_(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class v_ extends Tt{constructor(e){super(),Pt(this,e,h_,d_,Ct,{chip:0})}}function Tf(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function qf(t){let e,l,n,i,o,a,r;return a=new eo({props:{chip:t[0].chip}}),{c(){e=p("div"),l=M("HAN GPIO"),n=p("br"),i=v(),o=p("select"),Me(a.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){P(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Ce(a,o,null),r=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){r||(X(a.$$.fragment,f),r=!0)},o(f){x(a.$$.fragment,f),r=!1},d(f){f&&N(e),Se(a)}}}function b_(t){let e,l,n,i,o,a,r,f,c,m,_,d,h,g,b,k,w,E,F,R,T,L,O,H,K,z,q,B,Z,V=t[0].usrcfg&&Tf();g=new v_({props:{chip:t[0].chip}});let Y=t[0].board&&t[0].board>20&&qf(t);return z=new dl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=v(),a=p("strong"),a.textContent="Initial configuration",r=v(),V&&V.c(),f=v(),c=p("div"),m=M("Board type"),_=p("br"),d=v(),h=p("select"),Me(g.$$.fragment),b=v(),Y&&Y.c(),k=v(),w=p("div"),E=p("label"),F=p("input"),R=M(" Clear all other configuration"),T=v(),L=p("div"),L.innerHTML='',O=v(),H=p("span"),H.textContent=" ",K=v(),Me(z.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(a,"class","text-sm"),u(h,"name","vb"),u(h,"class","in-s"),t[0].board===void 0&&Nt(()=>t[5].call(h)),u(c,"class","my-3"),u(F,"type","checkbox"),u(F,"name","vr"),F.__value="true",j(F,F.__value),u(F,"class","rounded mb-1"),u(w,"class","my-3"),u(L,"class","my-3"),u(H,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,U){P(G,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,r),V&&V.m(n,null),s(n,f),s(n,c),s(c,m),s(c,_),s(c,d),s(c,h),Ce(g,h,null),Ue(h,t[0].board,!0),s(n,b),Y&&Y.m(n,null),s(n,k),s(n,w),s(w,E),s(E,F),F.checked=t[2],s(E,R),s(n,T),s(n,L),s(n,O),s(n,H),P(G,K,U),Ce(z,G,U),q=!0,B||(Z=[ce(h,"change",t[5]),ce(F,"change",t[6]),ce(n,"submit",pn(t[3]))],B=!0)},p(G,[U]){G[0].usrcfg?V||(V=Tf(),V.c(),V.m(n,f)):V&&(V.d(1),V=null);const W={};U&1&&(W.chip=G[0].chip),g.$set(W),U&1&&Ue(h,G[0].board),G[0].board&&G[0].board>20?Y?(Y.p(G,U),U&1&&X(Y,1)):(Y=qf(G),Y.c(),X(Y,1),Y.m(n,k)):Y&&(ct(),x(Y,1,1,()=>{Y=null}),_t()),U&4&&(F.checked=G[2]);const ne={};U&2&&(ne.active=G[1]),z.$set(ne)},i(G){q||(X(g.$$.fragment,G),X(Y),X(z.$$.fragment,G),q=!0)},o(G){x(g.$$.fragment,G),x(Y),x(z.$$.fragment,G),q=!1},d(G){G&&(N(e),N(K)),V&&V.d(),Se(g),Y&&Y.d(),Se(z,G),B=!1,zt(Z)}}}function g_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function a(m){l(1,o=!0);const _=new FormData(m.target),d=new URLSearchParams;for(let b of _){const[k,w]=b;d.append(k,w)}let g=await(await fetch("save",{method:"POST",body:d})).json();l(1,o=!1),hl.update(b=>(b.vndcfg=g.success,b.booting=g.reboot,b.if.eth=b.boardType>240&&b.boardType<250,b)),nn(n+(i.usrcfg?"":"setup"))}let r=!0;hl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,r=!i.usrcfg)});function f(){i.board=Yt(this),l(0,i)}function c(){r=this.checked,l(2,r)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,o,r,a,n,f,c]}class k_ extends Tt{constructor(e){super(),Pt(this,e,g_,b_,Ct,{basepath:4,sysinfo:0})}}function Ef(t,e,l){const n=t.slice();return n[13]=e[l],n}function Df(t){var i,o;let e,l=(((o=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,j(e,e.__value)},m(a,r){P(a,e,r),s(e,n)},p(a,r){var f,c;r&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&D(n,l)},d(a){a&&N(e)}}}function Af(t){var H,K,z,q;let e,l=(((K=(H=t[1].conf)==null?void 0:H.connection)==null?void 0:K.ssid)??"SSID")+"",n,i,o,a,r,f,c,m,_,d,h=(((q=(z=t[1].conf)==null?void 0:z.connection)==null?void 0:q.psk)??"Password")+"",g,b,k,w,E,F,R;function T(B,Z){return B[2]?C_:w_}let L=T(t),O=L(t);return{c(){e=p("div"),n=M(l),i=v(),o=p("label"),a=p("input"),r=M(" manual"),f=v(),c=p("br"),m=v(),O.c(),_=v(),d=p("div"),g=M(h),b=p("br"),k=v(),w=p("input"),u(a,"type","checkbox"),a.__value="true",j(a,a.__value),u(a,"class","rounded mb-1"),u(o,"class","float-right mr-3"),u(e,"class","my-3"),u(w,"name","sp"),u(w,"type","password"),u(w,"pattern",Pn),u(w,"class","in-s"),u(w,"autocomplete","off"),w.required=E=t[5]==2,u(d,"class","my-3")},m(B,Z){P(B,e,Z),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[2],s(o,r),s(e,f),s(e,c),s(e,m),O.m(e,null),P(B,_,Z),P(B,d,Z),s(d,g),s(d,b),s(d,k),s(d,w),F||(R=ce(a,"change",t[9]),F=!0)},p(B,Z){var V,Y,G,U;Z&2&&l!==(l=(((Y=(V=B[1].conf)==null?void 0:V.connection)==null?void 0:Y.ssid)??"SSID")+"")&&D(n,l),Z&4&&(a.checked=B[2]),L===(L=T(B))&&O?O.p(B,Z):(O.d(1),O=L(B),O&&(O.c(),O.m(e,null))),Z&2&&h!==(h=(((U=(G=B[1].conf)==null?void 0:G.connection)==null?void 0:U.psk)??"Password")+"")&&D(g,h),Z&32&&E!==(E=B[5]==2)&&(w.required=E)},d(B){B&&(N(e),N(_),N(d)),O.d(),F=!1,R()}}}function w_(t){var a,r;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&Lf(),o=((r=t[3])==null?void 0:r.n)&&Of(t);return{c(){e=p("select"),i&&i.c(),l=yt(),o&&o.c(),u(e,"name","ss"),u(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){P(f,e,c),i&&i.m(e,null),s(e,l),o&&o.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=Lf(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?o?o.p(f,c):(o=Of(f),o.c(),o.m(e,null)):o&&(o.d(1),o=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),o&&o.d()}}}function C_(t){let e,l;return{c(){e=p("input"),u(e,"name","ss"),u(e,"type","text"),u(e,"pattern",Pn),u(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){P(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function Lf(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",j(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){P(l,e,n)},d(l){l&&N(e)}}}function Of(t){var i;let e,l=ft((i=t[3])==null?void 0:i.n),n=[];for(let o=0;ot[8].call(b)),u(m,"class","my-3"),u(B,"name","sh"),u(B,"type","text"),u(B,"class","in-s"),u(B,"maxlength","32"),u(B,"pattern",Ci),u(B,"placeholder","Optional, ex.: ams-reader"),u(B,"autocomplete","off"),u(G,"type","checkbox"),u(G,"name","sm"),G.__value="static",j(G,G.__value),u(G,"class","rounded mb-1"),u(V,"class","my-3"),u(fe,"type","submit"),u(fe,"class","btn-pri"),u(re,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Ne,De){P(Ne,e,De),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(a,f),s(n,c),s(n,m),s(m,d),s(m,h),s(m,g),s(m,b),s(b,k),s(k,E),s(b,F),s(F,T),S&&S.m(b,null),Ue(b,t[5],!0),s(n,L),C&&C.m(n,null),s(n,O),s(n,H),s(H,z),s(H,q),s(H,B),j(B,t[0].hostname),s(n,Z),s(n,V),s(V,Y),s(Y,G),G.checked=t[4],s(Y,U),s(Y,ne),s(V,ee),I&&I.m(V,null),s(n,Q),A&&A.m(n,null),s(n,ie),s(n,re),s(re,fe),s(fe,de),P(Ne,oe,De),Ce(me,Ne,De),se=!0,pe||(we=[ce(b,"change",t[8]),ce(B,"input",t[10]),ce(G,"change",t[11]),ce(n,"submit",pn(t[7]))],pe=!0)},p(Ne,[De]){var $e,xe,ut,St,dt,rt,ot,ht,Ot,Je,Fe,He;(!se||De&2)&&r!==(r=((($e=Ne[1].setup)==null?void 0:$e.title)??"Setup")+"")&&D(f,r),(!se||De&2)&&_!==(_=(((ut=(xe=Ne[1].conf)==null?void 0:xe.connection)==null?void 0:ut.title)??"Connection")+"")&&D(d,_),(!se||De&2)&&w!==(w=(((dt=(St=Ne[1].conf)==null?void 0:St.connection)==null?void 0:dt.wifi)??"Connect to WiFi")+"")&&D(E,w),(!se||De&2)&&R!==(R=(((ot=(rt=Ne[1].conf)==null?void 0:rt.connection)==null?void 0:ot.ap)??"Standalone access point")+"")&&D(T,R),Ne[0].if&&Ne[0].if.eth?S?S.p(Ne,De):(S=Df(Ne),S.c(),S.m(b,null)):S&&(S.d(1),S=null),De&32&&Ue(b,Ne[5]),Ne[5]==1||Ne[5]==2?C?C.p(Ne,De):(C=Af(Ne),C.c(),C.m(n,O)):C&&(C.d(1),C=null),(!se||De&2)&&K!==(K=(((Ot=(ht=Ne[1].conf)==null?void 0:ht.general)==null?void 0:Ot.hostname)??"Hostname")+"")&&D(z,K),De&1&&B.value!==Ne[0].hostname&&j(B,Ne[0].hostname),De&16&&(G.checked=Ne[4]),(!se||De&2)&&W!==(W=(((Je=Ne[1].setup)==null?void 0:Je.static)??"Static IP")+"")&&D(ne,W),Ne[4]?I?(I.p(Ne,De),De&16&&X(I,1)):(I=Rf(Ne),I.c(),X(I,1),I.m(V,null)):I&&(ct(),x(I,1,1,()=>{I=null}),_t()),Ne[4]?A?A.p(Ne,De):(A=Ff(Ne),A.c(),A.m(n,ie)):A&&(A.d(1),A=null),(!se||De&2)&&le!==(le=(((Fe=Ne[1].btn)==null?void 0:Fe.save)??"Save")+"")&&D(de,le);const Re={};De&64&&(Re.active=Ne[6]),De&2&&(Re.message=((He=Ne[1].setup)==null?void 0:He.mask)??"Saving"),me.$set(Re)},i(Ne){se||(X(I),X(me.$$.fragment,Ne),se=!0)},o(Ne){x(I),x(me.$$.fragment,Ne),se=!1},d(Ne){Ne&&(N(e),N(oe)),S&&S.d(),C&&C.d(),I&&I.d(),A&&A.d(),Se(me,Ne),pe=!1,zt(we)}}}function M_(t,e,l){let n={};Pl.subscribe(k=>{l(1,n=k)});let i=!1,o={};co.subscribe(k=>{l(3,o=k)});let{sysinfo:a={}}=e,r=!1,f=1,c=!1;function m(k){hl.update(w=>(w.trying=k,w))}async function _(k){l(6,c=!0);const w=new FormData(k.target),E=new URLSearchParams;for(let T of w){const[L,O]=T;E.append(L,O)}let R=await(await fetch("save",{method:"POST",body:E})).json();l(6,c=!1),hl.update(T=>(T.hostname=w.get("sh"),T.usrcfg=R.success,T.booting=R.reboot,r&&(T.net.ip=w.get("si"),T.net.mask=w.get("su"),T.net.gw=w.get("sg"),T.net.dns1=w.get("sd")),R.reboot&&setTimeout(ti,5e3,a,m),T))}function d(){f=Yt(this),l(5,f)}function h(){i=this.checked,l(2,i)}function g(){a.hostname=this.value,l(0,a)}function b(){r=this.checked,l(4,r)}return t.$$set=k=>{"sysinfo"in k&&l(0,a=k.sysinfo)},[a,n,i,o,r,f,c,_,d,h,g,b]}class N_ extends Tt{constructor(e){super(),Pt(this,e,M_,S_,Ct,{sysinfo:0})}}function P_(t){var z,q,B,Z;let e,l,n,i=(((z=t[2].upload)==null?void 0:z.title)??"Upload")+"",o,a,r,f,c,m=(((q=t[2].upload)==null?void 0:q.desc)??"")+"",_,d,h,g,b,k,w,E,F=(((B=t[2].btn)==null?void 0:B.upload)??"Upload")+"",R,T,L,O,H,K;return L=new dl({props:{active:t[3],message:((Z=t[2].upload)==null?void 0:Z.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),o=M(i),a=v(),r=M(t[1]),f=v(),c=p("p"),_=M(m),d=v(),h=p("form"),g=p("input"),b=v(),k=p("div"),w=p("button"),E=p("p"),R=M(F),T=v(),Me(L.$$.fragment),u(c,"class","mb-4"),u(g,"name","file"),u(g,"type","file"),u(E,"class","mb-4"),u(w,"type","submit"),u(w,"class","btn-pri"),u(k,"class","w-full text-right mt-4"),u(h,"action",t[0]),u(h,"enctype","multipart/form-data"),u(h,"method","post"),u(h,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(V,Y){P(V,e,Y),s(e,l),s(l,n),s(n,o),s(n,a),s(n,r),s(l,f),s(l,c),s(c,_),s(l,d),s(l,h),s(h,g),s(h,b),s(h,k),s(k,w),s(w,E),s(E,R),P(V,T,Y),Ce(L,V,Y),O=!0,H||(K=ce(h,"submit",t[4]),H=!0)},p(V,[Y]){var U,W,ne,ee;(!O||Y&4)&&i!==(i=(((U=V[2].upload)==null?void 0:U.title)??"Upload")+"")&&D(o,i),(!O||Y&2)&&D(r,V[1]),(!O||Y&4)&&m!==(m=(((W=V[2].upload)==null?void 0:W.desc)??"")+"")&&D(_,m),(!O||Y&4)&&F!==(F=(((ne=V[2].btn)==null?void 0:ne.upload)??"Upload")+"")&&D(R,F),(!O||Y&1)&&u(h,"action",V[0]);const G={};Y&8&&(G.active=V[3]),Y&4&&(G.message=((ee=V[2].upload)==null?void 0:ee.mask)??"Uploading"),L.$set(G)},i(V){O||(X(L.$$.fragment,V),O=!0)},o(V){x(L.$$.fragment,V),O=!1},d(V){V&&(N(e),N(T)),Se(L,V),H=!1,K()}}}function T_(t,e,l){let{action:n}=e,{title:i}=e,o={};Pl.subscribe(f=>{l(2,o=f)});let a=!1;const r=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,o,a,r]}class vo extends Tt{constructor(e){super(),Pt(this,e,T_,P_,Ct,{action:0,title:1})}}function q_(t){var me,se,pe,we,S,C,I;let e,l,n,i,o=(((me=t[1].consent)==null?void 0:me.title)??"Consents")+"",a,r,f,c,m,_=(((se=t[1].consent)==null?void 0:se.one_click)??"One-click")+"",d,h,g,b,k=(((pe=t[1].consent)==null?void 0:pe.read_more)??"Read more")+"",w,E,F,R,T,L,O,H=(((we=t[1].consent)==null?void 0:we.yes)??"Yes")+"",K,z,q,B,Z,V,Y=(((S=t[1].consent)==null?void 0:S.no)??"No")+"",G,U,W,ne,ee,Q=(((C=t[1].btn)==null?void 0:C.save)??"Save")+"",ie,re,fe,le,de,oe;return fe=new dl({props:{active:t[2],message:((I=t[1].consent)==null?void 0:I.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=M(o),r=v(),f=p("hr"),c=v(),m=p("div"),d=M(_),h=p("br"),g=v(),b=p("a"),w=M(k),E=p("br"),F=v(),R=p("label"),T=p("input"),O=v(),K=M(H),z=v(),q=p("label"),B=p("input"),V=v(),G=M(Y),U=p("br"),W=v(),ne=p("div"),ee=p("button"),ie=M(Q),re=v(),Me(fe.$$.fragment),u(b,"href",vl("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u(T,"type","radio"),u(T,"name","sf"),T.value=1,T.checked=L=t[0].fwconsent===1,u(T,"class","rounded m-2"),T.required=!0,u(B,"type","radio"),u(B,"name","sf"),B.value=2,B.checked=Z=t[0].fwconsent===2,u(B,"class","rounded m-2"),B.required=!0,u(m,"class","my-3"),u(ee,"type","submit"),u(ee,"class","btn-pri"),u(ne,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(A,y){P(A,e,y),s(e,l),s(l,n),s(n,i),s(i,a),s(n,r),s(n,f),s(n,c),s(n,m),s(m,d),s(m,h),s(m,g),s(m,b),s(b,w),s(m,E),s(m,F),s(m,R),s(R,T),s(R,O),s(R,K),s(m,z),s(m,q),s(q,B),s(q,V),s(q,G),s(m,U),s(n,W),s(n,ne),s(ne,ee),s(ee,ie),P(A,re,y),Ce(fe,A,y),le=!0,de||(oe=ce(n,"submit",pn(t[3])),de=!0)},p(A,[y]){var ue,be,ke,J,ve,ge,qe;(!le||y&2)&&o!==(o=(((ue=A[1].consent)==null?void 0:ue.title)??"Consents")+"")&&D(a,o),(!le||y&2)&&_!==(_=(((be=A[1].consent)==null?void 0:be.one_click)??"One-click")+"")&&D(d,_),(!le||y&2)&&k!==(k=(((ke=A[1].consent)==null?void 0:ke.read_more)??"Read more")+"")&&D(w,k),(!le||y&1&&L!==(L=A[0].fwconsent===1))&&(T.checked=L),(!le||y&2)&&H!==(H=(((J=A[1].consent)==null?void 0:J.yes)??"Yes")+"")&&D(K,H),(!le||y&1&&Z!==(Z=A[0].fwconsent===2))&&(B.checked=Z),(!le||y&2)&&Y!==(Y=(((ve=A[1].consent)==null?void 0:ve.no)??"No")+"")&&D(G,Y),(!le||y&2)&&Q!==(Q=(((ge=A[1].btn)==null?void 0:ge.save)??"Save")+"")&&D(ie,Q);const te={};y&4&&(te.active=A[2]),y&2&&(te.message=((qe=A[1].consent)==null?void 0:qe.mask_saving)??"Saving"),fe.$set(te)},i(A){le||(X(fe.$$.fragment,A),le=!0)},o(A){x(fe.$$.fragment,A),le=!1},d(A){A&&(N(e),N(re)),Se(fe,A),de=!1,oe()}}}function E_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o={};Pl.subscribe(f=>{l(1,o=f)});let a=!1;async function r(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let h of c){const[g,b]=h;m.append(g,b)}let d=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),hl.update(h=>(h.fwconsent=c.sf===!0?1:c.sf===!1?2:0,h.booting=d.reboot,h)),nn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,o,a,r,n]}class D_ extends Tt{constructor(e){super(),Pt(this,e,E_,q_,Ct,{basepath:4,sysinfo:0})}}function Bf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function Uf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function A_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function zf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function L_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function jf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Hf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function yf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Gf(t){let e,l=ft(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),u(Re,"class",xe=t[32]{l(0,i=U)});let o=["mo","tu","we","th","fr","sa","su"],a={},r=!0,f=!1;Zu.subscribe(U=>{U.o&&(l(1,a=U),l(2,r=!1))}),pc();async function c(U){l(3,f=!0);const W=new URLSearchParams;W.append("r","true"),W.append("rc",a.o.length),a.o.forEach(function(ee,Q){W.append("rt"+Q,ee.t),W.append("rn"+Q,ee.n),W.append("rd"+Q,ee.d),W.append("ra"+Q,ee.a),W.append("rh"+Q,ee.h),W.append("rv"+Q,ee.v),W.append("rsm"+Q,ee.s.m),W.append("rsd"+Q,ee.s.d),W.append("rem"+Q,ee.e.m),W.append("red"+Q,ee.e.d)}),await(await fetch("save",{method:"POST",body:W})).json(),l(3,f=!1),nn(n+"configuration")}let m=function(U,W){return U.includes(W)?U=U.filter(function(ne){return ne!==W}):U.push(W),U},_=function(){let U=a.o;U.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=U,a)},d=function(U){let W=a.o;W.splice(U,1),l(1,a.o=W,a)},h=function(U){if(U<=0)return;let W=a.o;var ne=W[U];W[U]=W[U-1],W[U-1]=ne,l(1,a.o=W,a)},g=function(U){let W=a.o;if(!(U>=W.length-1)){var ne=W[U];W[U]=W[U+1],W[U+1]=ne,l(1,a.o=W,a)}};function b(U,W){U[W].n=this.value,l(1,a)}function k(U,W){U[W].d=Yt(this),l(1,a)}function w(U,W){U[W].t=Yt(this),l(1,a)}function E(U,W){U[W].v=Be(this.value),l(1,a)}const F=(U,W,ne,ee)=>l(1,ne[ee].a=m(U.a,W),a),R=(U,W,ne,ee)=>l(1,ne[ee].h=m(U.h,W),a),T=(U,W,ne,ee)=>l(1,ne[ee].h=m(U.h,W+8),a),L=(U,W,ne,ee)=>l(1,ne[ee].h=m(U.h,W+16),a);function O(U,W){U[W].s.d=Yt(this),l(1,a)}function H(U,W){U[W].s.m=Yt(this),l(1,a)}function K(U,W){U[W].e.d=Yt(this),l(1,a)}function z(U,W){U[W].e.m=Yt(this),l(1,a)}const q=U=>h(U),B=U=>h(U),Z=U=>g(U),V=U=>g(U),Y=U=>d(U),G=U=>d(U);return t.$$set=U=>{"basepath"in U&&l(11,n=U.basepath)},[i,a,r,f,o,c,m,_,d,h,g,n,b,k,w,E,F,R,T,L,O,H,K,z,q,B,Z,V,Y,G]}class B_ extends Tt{constructor(e){super(),Pt(this,e,F_,R_,Ct,{basepath:11},null,[-1,-1])}}function $f(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function xf(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function eu(t){let e,l,n,i=ft(t[1]),o=[];for(let a=0;a{l(3,r=k)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let k in i)(k.startsWith("i")||k.startsWith("e"))&&l(0,i[k]=0,i)}let d=!1;async function h(k){l(5,d=!0);const w=new FormData(k.target),E=new URLSearchParams;for(let R of w){const[T,L]=R;E.append(T,L)}await(await fetch(o,{method:"POST",body:E})).json(),l(5,d=!1),nn(a)}function g(k){i[k.key]=Be(this.value),l(0,i)}function b(k){i[k.key]=Be(this.value),l(0,i)}return t.$$set=k=>{"prefix"in k&&l(8,n=k.prefix),"data"in k&&l(0,i=k.data),"url"in k&&l(9,o=k.url),"basepath"in k&&l(10,a=k.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let k in i){let w=[];k.startsWith("i")?w=c:k.startsWith("e")&&(w=m,i[k]&&l(4,f=!0)),w.push({key:k,name:n+" "+k.substring(1),value:i[k]})}}},[i,c,m,r,f,d,_,h,n,o,a,g,b]}class xu extends Tt{constructor(e){super(),Pt(this,e,z_,U_,Ct,{prefix:8,data:0,url:9,basepath:10})}}function j_(t){let e,l;return e=new _c({props:{data:t[7],sysinfo:t[8],importPrices:t[1],exportPrices:t[2],dayPlot:t[3],monthPlot:t[4],temperatures:t[5],translations:t[6],tariffData:t[9]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&128&&(o.data=n[7]),i&256&&(o.sysinfo=n[8]),i&2&&(o.importPrices=n[1]),i&4&&(o.exportPrices=n[2]),i&8&&(o.dayPlot=n[3]),i&16&&(o.monthPlot=n[4]),i&32&&(o.temperatures=n[5]),i&64&&(o.translations=n[6]),i&512&&(o.tariffData=n[9]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function H_(t){let e,l;return e=new l_({props:{sysinfo:t[8],basepath:t[0],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function W_(t){let e,l;return e=new B_({props:{basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function y_(t){let e,l;return e=new p_({props:{sysinfo:t[8],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function G_(t){let e,l;return e=new vo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function V_(t){let e,l;return e=new vo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function K_(t){let e,l;return e=new vo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Y_(t){let e,l;return e=new D_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Q_(t){let e,l;return e=new N_({props:{sysinfo:t[8]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function X_(t){let e,l;return e=new k_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Z_(t){let e,l;return e=new xu({props:{prefix:"UTC Hour",data:t[3],url:"/dayplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&8&&(o.data=n[3]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function J_(t){let e,l;return e=new xu({props:{prefix:"Day",data:t[4],url:"/monthplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&16&&(o.data=n[4]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function $_(t){let e,l,n,i,o,a,r,f,c,m,_,d,h,g,b,k,w,E,F,R,T,L,O,H,K,z;return e=new r1({props:{data:t[7],basepath:t[0]}}),n=new Sl({props:{path:"/",$$slots:{default:[j_]},$$scope:{ctx:t}}}),o=new Sl({props:{path:"/configuration",$$slots:{default:[H_]},$$scope:{ctx:t}}}),r=new Sl({props:{path:"/priceconfig",$$slots:{default:[W_]},$$scope:{ctx:t}}}),c=new Sl({props:{path:"/status",$$slots:{default:[y_]},$$scope:{ctx:t}}}),_=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[G_]},$$scope:{ctx:t}}}),h=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[V_]},$$scope:{ctx:t}}}),b=new Sl({props:{path:"/mqtt-key",$$slots:{default:[K_]},$$scope:{ctx:t}}}),w=new Sl({props:{path:"/consent",$$slots:{default:[Y_]},$$scope:{ctx:t}}}),F=new Sl({props:{path:"/setup",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),T=new Sl({props:{path:"/vendor",$$slots:{default:[X_]},$$scope:{ctx:t}}}),O=new Sl({props:{path:"/edit-day",$$slots:{default:[Z_]},$$scope:{ctx:t}}}),K=new Sl({props:{path:"/edit-month",$$slots:{default:[J_]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment),l=v(),Me(n.$$.fragment),i=v(),Me(o.$$.fragment),a=v(),Me(r.$$.fragment),f=v(),Me(c.$$.fragment),m=v(),Me(_.$$.fragment),d=v(),Me(h.$$.fragment),g=v(),Me(b.$$.fragment),k=v(),Me(w.$$.fragment),E=v(),Me(F.$$.fragment),R=v(),Me(T.$$.fragment),L=v(),Me(O.$$.fragment),H=v(),Me(K.$$.fragment)},m(q,B){Ce(e,q,B),P(q,l,B),Ce(n,q,B),P(q,i,B),Ce(o,q,B),P(q,a,B),Ce(r,q,B),P(q,f,B),Ce(c,q,B),P(q,m,B),Ce(_,q,B),P(q,d,B),Ce(h,q,B),P(q,g,B),Ce(b,q,B),P(q,k,B),Ce(w,q,B),P(q,E,B),Ce(F,q,B),P(q,R,B),Ce(T,q,B),P(q,L,B),Ce(O,q,B),P(q,H,B),Ce(K,q,B),z=!0},p(q,B){const Z={};B&128&&(Z.data=q[7]),B&1&&(Z.basepath=q[0]),e.$set(Z);const V={};B&5118&&(V.$$scope={dirty:B,ctx:q}),n.$set(V);const Y={};B&4481&&(Y.$$scope={dirty:B,ctx:q}),o.$set(Y);const G={};B&4097&&(G.$$scope={dirty:B,ctx:q}),r.$set(G);const U={};B&4480&&(U.$$scope={dirty:B,ctx:q}),c.$set(U);const W={};B&4096&&(W.$$scope={dirty:B,ctx:q}),_.$set(W);const ne={};B&4096&&(ne.$$scope={dirty:B,ctx:q}),h.$set(ne);const ee={};B&4096&&(ee.$$scope={dirty:B,ctx:q}),b.$set(ee);const Q={};B&4353&&(Q.$$scope={dirty:B,ctx:q}),w.$set(Q);const ie={};B&4352&&(ie.$$scope={dirty:B,ctx:q}),F.$set(ie);const re={};B&4353&&(re.$$scope={dirty:B,ctx:q}),T.$set(re);const fe={};B&4105&&(fe.$$scope={dirty:B,ctx:q}),O.$set(fe);const le={};B&4113&&(le.$$scope={dirty:B,ctx:q}),K.$set(le)},i(q){z||(X(e.$$.fragment,q),X(n.$$.fragment,q),X(o.$$.fragment,q),X(r.$$.fragment,q),X(c.$$.fragment,q),X(_.$$.fragment,q),X(h.$$.fragment,q),X(b.$$.fragment,q),X(w.$$.fragment,q),X(F.$$.fragment,q),X(T.$$.fragment,q),X(O.$$.fragment,q),X(K.$$.fragment,q),z=!0)},o(q){x(e.$$.fragment,q),x(n.$$.fragment,q),x(o.$$.fragment,q),x(r.$$.fragment,q),x(c.$$.fragment,q),x(_.$$.fragment,q),x(h.$$.fragment,q),x(b.$$.fragment,q),x(w.$$.fragment,q),x(F.$$.fragment,q),x(T.$$.fragment,q),x(O.$$.fragment,q),x(K.$$.fragment,q),z=!1},d(q){q&&(N(l),N(i),N(a),N(f),N(m),N(d),N(g),N(k),N(E),N(R),N(L),N(H)),Se(e,q),Se(n,q),Se(o,q),Se(r,q),Se(c,q),Se(_,q),Se(h,q),Se(b,q),Se(w,q),Se(F,q),Se(T,q),Se(O,q),Se(K,q)}}}function iu(t){let e,l,n,i;const o=[em,x_],a=[];function r(f,c){return f[8].trying?0:1}return e=r(t),l=a[e]=o[e](t),{c(){l.c(),n=yt()},m(f,c){a[e].m(f,c),P(f,n,c),i=!0},p(f,c){let m=e;e=r(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function x_(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:je,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function em(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[8].trying}}),{c(){Me(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.message="Device is booting, please wait. Trying to reach it on "+n[8].trying),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function tm(t){let e,l,n,i;l=new Du({props:{basepath:t[0],$$slots:{default:[$_]},$$scope:{ctx:t}}});let o=t[8].booting&&iu(t);return{c(){e=p("div"),Me(l.$$.fragment),n=v(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(a,r){P(a,e,r),Ce(l,e,null),s(e,n),o&&o.m(e,null),i=!0},p(a,[r]){const f={};r&1&&(f.basepath=a[0]),r&5119&&(f.$$scope={dirty:r,ctx:a}),l.$set(f),a[8].booting?o?(o.p(a,r),r&256&&X(o,1)):(o=iu(a),o.c(),X(o,1),o.m(e,null)):o&&(ct(),x(o,1,1,()=>{o=null}),_t())},i(a){i||(X(l.$$.fragment,a),X(o),i=!0)},o(a){x(l.$$.fragment,a),x(o),i=!1},d(a){a&&N(e),Se(l),o&&o.d()}}}function lm(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Bu.subscribe(b=>{l(1,i=b)});let o;Uu.subscribe(b=>{l(2,o=b)});let a;ju.subscribe(b=>{l(3,a=b)});let r;Hu.subscribe(b=>{l(4,r=b)});let f;Wu.subscribe(b=>{l(5,f=b)});let c={};Pl.subscribe(b=>{l(6,c=b)});let m,_={},d={},h;hl.subscribe(b=>{var k;l(8,d=b),d.vndcfg===!1?nn(n+"vendor"):d.usrcfg===!1?nn(n+"setup"):d.fwconsent===0&&nn(n+"consent"),d.ui.k===1?document.documentElement.classList.add("dark"):d.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),d.ui.lang&&d.ui.lang!=((k=c==null?void 0:c.language)==null?void 0:k.code)&&Vu(d.ui.lang),d.version&&h&&d.version!=h&&window.location.reload(),h=d.version,m&&clearTimeout(m),m=setTimeout(Ti,!_||!_.u||_.u<30||d!=null&&d.upgrading?1e4:3e5)}),D0.subscribe(b=>{l(7,_=b),ec(b)});let g={};return Gu.subscribe(b=>{l(9,g=b)}),yu(),[n,i,o,a,r,f,c,_,d,g]}class nm extends Tt{constructor(e){super(),Pt(this,e,lm,tm,Ct,{})}}new nm({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index c8d72a20..7c7c37b5 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -3,7 +3,7 @@ import { sysinfoStore, networksStore } from './DataStores.js'; import fetchWithTimeout from './fetchWithTimeout'; import { translationsStore } from './TranslationService'; - import { wiki, ipPattern, asciiPattern, asciiPatternExt, charAndNumPattern, hexPattern, numPattern } from './Helpers.js'; + import { wiki, ipPattern, asciiPattern, asciiPatternExt, charAndNumPattern, hexPattern, numPattern, isBusPowered } from './Helpers.js'; import UartSelectOptions from './UartSelectOptions.svelte'; import Mask from './Mask.svelte' import Badge from './Badge.svelte'; @@ -915,6 +915,13 @@ {/if} + {#if isBusPowered(sysinfo.board)} + Power saving: + + {/if} {#if sysinfo.chip == 'esp8266'}
diff --git a/lib/SvelteUi/app/src/lib/TariffPeakChart.svelte b/lib/SvelteUi/app/src/lib/TariffPeakChart.svelte index f2e42b13..98a81f36 100644 --- a/lib/SvelteUi/app/src/lib/TariffPeakChart.svelte +++ b/lib/SvelteUi/app/src/lib/TariffPeakChart.svelte @@ -29,7 +29,7 @@ points.push({ label: realtime.h.u.toFixed(2), value: realtime.h.u, - title: realtime.h.u.toFixed(2) + ' kWh', + title: (translations.common?.now ?? "Now") + ': ' + realtime.h.u.toFixed(2) + ' kWh', color: ampcol(realtime.h.u/tariffData.c*100.0) }); xTicks.push({ @@ -40,14 +40,21 @@ if(tariffData && tariffData.p) { for(i = 0; i < tariffData.p.length; i++) { let peak = tariffData.p[i]; - let daylabel = peak.d > 0 ? zeropad(peak.d) + "." + (translations.months ? translations.months?.[new Date().getMonth()] : zeropad(new Date().getMonth()+1)) : "-"; - let title = daylabel; + + let title = ""; + let daylabel = "-"; + if(peak.d > 0) { + daylabel = zeropad(peak.d) + "."; + title = zeropad(peak.d) + "." + (translations.months ? translations.months?.[new Date().getMonth()] : zeropad(new Date().getMonth()+1)); + if(tariffData.p.length < 4) { + daylabel = title; + } + } if(!isNaN(peak.h)) title = title + ' ' + zeropad(peak.h) + ':00'; title = title + ': ' + peak.v.toFixed(2) + ' kWh'; points.push({ label: peak.v.toFixed(2), - title: peak.v.toFixed(2) + ' kWh', value: peak.v, title: title, color: dark ? '#5c2da5' : '#7c3aed' diff --git a/lib/SvelteUi/json/conf_gpio.json b/lib/SvelteUi/json/conf_gpio.json index e7d45f70..b435c713 100644 --- a/lib/SvelteUi/json/conf_gpio.json +++ b/lib/SvelteUi/json/conf_gpio.json @@ -32,5 +32,6 @@ "g": %d }, "b": %.1f - } + }, + "p": %d }, diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index f2bbc61c..4cba8cd8 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -516,10 +516,9 @@ void AmsWebServer::sysinfoJson() { #endif debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); + rdc->cause = REBOOT_CAUSE_WEB_SYSINFO_JSON; delay(1000); - rdc->cause = 1; ESP.restart(); - performRestart = false; } } @@ -1080,7 +1079,8 @@ void AmsWebServer::configurationJson() { gpioConfig->vccMultiplier / 1000.0, gpioConfig->vccResistorVcc, gpioConfig->vccResistorGnd, - gpioConfig->vccBootLimit / 10.0 + gpioConfig->vccBootLimit / 10.0, + gpioConfig->powersaving ); server.sendContent(buf); snprintf_P(buf, BufferSize, CONF_UI_JSON, @@ -1562,6 +1562,11 @@ void AmsWebServer::handleSave() { config->setGpioConfig(*gpioConfig); } + if(server.hasArg(F("ip"))) { + gpioConfig->powersaving = server.hasArg(F("ip")) && !server.arg(F("ip")).isEmpty() ? server.arg(F("ip")).toInt() : 0; + config->setGpioConfig(*gpioConfig); + } + if(server.hasArg(F("iv")) && server.arg(F("iv")) == F("true")) { gpioConfig->vccOffset = server.hasArg(F("ivo")) && !server.arg(F("ivo")).isEmpty() ? server.arg(F("ivo")).toFloat() * 100 : 0; gpioConfig->vccMultiplier = server.hasArg(F("ivm")) && !server.arg(F("ivm")).isEmpty() ? server.arg(F("ivm")).toFloat() * 1000 : 1000; @@ -1780,9 +1785,8 @@ void AmsWebServer::handleSave() { #endif debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); + rdc->cause = REBOOT_CAUSE_WEB_SAVE; delay(1000); - rdc->cause = 2; - performRestart = false; ESP.restart(); } } @@ -1797,14 +1801,12 @@ void AmsWebServer::reboot() { delay(250); #if defined(AMS_REMOTE_DEBUG) -if (debugger->isActive(RemoteDebug::INFO)) -#endif -debugger->printf_P(PSTR("Rebooting\n")); + if (debugger->isActive(RemoteDebug::INFO)) + #endif + debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); - delay(1000); rdc->cause = 3; - - rdc->cause = 3; - performRestart = false; + rdc->cause = REBOOT_CAUSE_WEB_REBOOT; + delay(1000); ESP.restart(); } @@ -2064,8 +2066,8 @@ void AmsWebServer::factoryResetPost() { #endif debugger->printf_P(PSTR("Rebooting\n")); debugger->flush(); + rdc->cause = REBOOT_CAUSE_WEB_FACTORY_RESET; delay(1000); - rdc->cause = 5; ESP.restart(); } diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index 23ffc7b5..49538199 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -238,14 +238,24 @@ void handleEnergySpeedometer(); #if defined(AMS_CLOUD) void handleCloud(); #endif -void handleMqtt(); -void handleWebserver(); +unsigned long handleMqtt(); +unsigned long handleWebserver(); void handleSmartConfig(); void handleMeterConfig(); uint8_t pulses = 0; void onPulse(); +bool checkVoltageIfNeeded(float range) { + if(updater.getProgress() > 0) { + return true; // Skip voltage check during firmware update + } + if(gpioConfig.powersaving != 3) { + return true; // Skip voltage check if not in high power saving mode + } + return hw.isVoltageOptimal(range); +} + #if defined(ESP32) uint8_t dnsState = 0; ip_addr_t dns0; @@ -361,6 +371,8 @@ void setup() { if(!hw.ledBlink(LED_RED, 6)) { hw.ledBlink(LED_INTERNAL, 6); } + rdc.cause = REBOOT_CAUSE_BTN_FACTORY_RESET; + delay(250); ESP.restart(); return; } @@ -451,6 +463,8 @@ void setup() { } #if defined(ESP32) if(updater.relocateOrRepartitionIfNecessary()) { + rdc.cause = REBOOT_CAUSE_REPARTITION; + delay(250); ESP.restart(); return; } @@ -506,6 +520,7 @@ void setup() { configFileParse(); debugI_P(PSTR("Config update complete, restarting")); Debug.flush(); + rdc.cause = REBOOT_CAUSE_CONFIG_FILE_UPDATE; delay(250); ESP.restart(); return; @@ -578,7 +593,7 @@ void loop() { #endif unsigned long end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to handle debug"), millis()-start); + debugW_P(PSTR("Used %dms to handle debug"), end-start); } handleButton(now); @@ -607,10 +622,8 @@ void loop() { postConnect(); } - handleUpdater(); - // Only do these tasks if we have super-smooth voltage - if(hw.isVoltageOptimal(0.1)) { + if(checkVoltageIfNeeded(0.1)) { handleNtp(); #if defined(ESP8266) handleMdns(); @@ -631,20 +644,26 @@ void loop() { debugW_P(PSTR("Vcc below level 1")); } + unsigned long communicationTime = 0; // Only do these task if we have smooth voltage - if(hw.isVoltageOptimal(0.2)) { - handleMqtt(); + if(checkVoltageIfNeeded(0.2)) { + communicationTime += handleMqtt(); vccLevel2 = true; } else if(vccLevel2) { vccLevel2 = false; debugW_P(PSTR("Vcc below level 2")); } - handleWebserver(); + communicationTime += handleWebserver(); + if(communicationTime > 10 && updater.getProgress() >= 0) { + debugI_P(PSTR("Communication is active (%dms), forcing updater to wait"), communicationTime); + } else { + handleUpdater(); + } #if defined(ESP32) // At this point, if the voltage is not optimal, disconnect from WiFi to preserve power - if(!hw.isVoltageOptimal(0.35)) { + if(!checkVoltageIfNeeded(0.35)) { if(WiFi.getMode() == WIFI_STA) { debugW_P(PSTR("Vcc dropped below limit, disconnecting WiFi for 5 seconds to preserve power")); ch->disconnect(5000); @@ -687,28 +706,6 @@ void loop() { if(end-start > SLOW_PROC_TRIGGER_MS) { debugW_P(PSTR("Used %dms to handle language update"), end-start); } - start = millis(); - updater.loop(); - if(updater.isUpgradeInformationChanged()) { - UpgradeInformation upinfo; - updater.getUpgradeInformation(upinfo); - config.setUpgradeInformation(upinfo); - updater.ackUpgradeInformationChanged(); - if(mqttHandler != NULL) - mqttHandler->publishFirmware(); - - if(upinfo.errorCode == AMS_UPDATE_ERR_SUCCESS_SIGNAL) { - debugW_P(PSTR("Rebooting to firmware version %s"), upinfo.toVersion); - upinfo.errorCode == AMS_UPDATE_ERR_SUCCESS_CONFIRMED; - config.setUpgradeInformation(upinfo); - delay(1000); - ESP.restart(); - } - } - end = millis(); - if(end-start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to handle firmware updater"), end-start); - } } } else { handleSmartConfig(); @@ -726,9 +723,9 @@ void loop() { if(readHanPort() || now - meterState.getLastUpdateMillis() > 30000) { end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to read HAN port (true)"), millis()-start); + debugW_P(PSTR("Used %dms to read HAN port (true)"), end-start); } - if(hw.isVoltageOptimal(0.1)) { + if(checkVoltageIfNeeded(0.1)) { handleTemperature(now); handleSystem(now); } @@ -736,7 +733,7 @@ void loop() { } else { end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to read HAN port (false)"), millis()-start); + debugW_P(PSTR("Used %dms to read HAN port (false)"), end-start); } } if(millis() - meterState.getLastUpdateMillis() > 1800000 && !ds.isHappy(time(nullptr))) { @@ -781,7 +778,8 @@ void handleUpdater() { debugW_P(PSTR("Rebooting to firmware version %s"), upinfo.toVersion); upinfo.errorCode == AMS_UPDATE_ERR_SUCCESS_CONFIRMED; config.setUpgradeInformation(upinfo); - delay(1000); + rdc.cause = REBOOT_CAUSE_FIRMWARE_UPDATE; + delay(250); ESP.restart(); } } @@ -824,7 +822,7 @@ void handleMdns() { MDNS.update(); unsigned long end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to update mDNS"), millis()-start); + debugW_P(PSTR("Used %dms to update mDNS"), end-start); } } } @@ -902,7 +900,8 @@ void handleCloud() { } #endif -void handleMqtt() { +unsigned long handleMqtt() { + unsigned long start = millis(); if (mqttEnabled || config.isMqttChanged()) { if(mqttHandler == NULL || !mqttHandler->connected() || config.isMqttChanged()) { if(mqttHandler != NULL && config.isMqttChanged()) { @@ -916,22 +915,29 @@ void handleMqtt() { } if(mqttHandler != NULL) { - unsigned long start = millis(); mqttHandler->loop(); - unsigned long end = millis(); - if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to handle mqtt"), millis()-start); + if(mqttHandler->isRebootSuggested()) { + debugW_P(PSTR("Rebooting as suggested by MQTT handler")); + rdc.cause = REBOOT_CAUSE_MQTT_DISCONNECTED; + delay(250); + ESP.restart(); } } + unsigned long end = millis(); + if(end - start > SLOW_PROC_TRIGGER_MS) { + debugW_P(PSTR("Used %dms to handle mqtt"), end-start); + } + return end-start; } -void handleWebserver() { +unsigned long handleWebserver() { unsigned long start = millis(); ws.loop(); unsigned long end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to handle web"), millis()-start); + debugW_P(PSTR("Used %dms to handle web"), end-start); } + return end-start; } void handleSmartConfig() { @@ -953,7 +959,8 @@ void handleSmartConfig() { config.setSystemConfig(sys); config.save(); - delay(1000); + rdc.cause = REBOOT_CAUSE_SMART_CONFIG; + delay(250); ESP.restart(); } } @@ -1140,7 +1147,7 @@ void handleSystem(unsigned long now) { lastSysupdate = now; end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to send system update to MQTT"), millis()-start); + debugW_P(PSTR("Used %dms to send system update to MQTT"), end-start); } #if defined(ESP32) @@ -1168,7 +1175,7 @@ void handleTemperature(unsigned long now) { } end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to update temperature"), millis()-start); + debugW_P(PSTR("Used %dms to update temperature"), end-start); } } } @@ -1181,19 +1188,19 @@ void handlePriceService(unsigned long now) { if(ps->loop() && mqttHandler != NULL) { end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to update prices"), millis()-start); + debugW_P(PSTR("Used %dms to update prices"), end-start); } start = millis(); mqttHandler->publishPrices(ps); end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to publish prices to MQTT"), millis()-start); + debugW_P(PSTR("Used %dms to publish prices to MQTT"), end-start); } } else { end = millis(); if(end - start > SLOW_PROC_TRIGGER_MS) { - debugW_P(PSTR("Used %dms to handle price API"), millis()-start); + debugW_P(PSTR("Used %dms to handle price API"), end-start); } } } @@ -1294,7 +1301,7 @@ void connectToNetwork() { return; } lastConnectRetry = millis(); - if(!hw.isVoltageOptimal(0.1) && (millis() - lastConnectRetry) < 60000) { + if(!checkVoltageIfNeeded(0.1) && (millis() - lastConnectRetry) < 60000) { debugW_P(PSTR("Voltage is not high enough to reconnect")); return; } @@ -1448,7 +1455,7 @@ void handleDataSuccess(AmsData* data) { if(!setupMode && !hw.ledBlink(LED_GREEN, 1)) hw.ledBlink(LED_INTERNAL, 1); - if(mqttHandler != NULL && hw.isVoltageOptimal(0.2)) { + if(mqttHandler != NULL && checkVoltageIfNeeded(0.2)) { #if defined(ESP32) esp_task_wdt_reset(); #elif defined(ESP8266) @@ -1458,7 +1465,7 @@ void handleDataSuccess(AmsData* data) { mqttHandler->publish(data, &meterState, &ea, ps); } #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) - if(energySpeedometer != NULL && hw.isVoltageOptimal(0.1)) { + if(energySpeedometer != NULL && checkVoltageIfNeeded(0.1)) { energySpeedometer->publish(&meterState, &meterState, &ea, ps); } #endif