diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index f464b056..cc7eb065 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -244,8 +244,7 @@ struct CloudConfig { uint8_t interval; char hostname[64]; uint16_t port; - char clientId[17]; - char clientSecret[17]; + uint8_t clientId[16]; }; class AmsConfiguration { diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index bd596646..1c6b5a2a 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -784,15 +784,12 @@ bool AmsConfiguration::setCloudConfig(CloudConfig& config) { cloudChanged |= config.interval!= existing.interval; cloudChanged |= config.port!= existing.port; cloudChanged |= strcmp(config.hostname, existing.hostname) != 0; - cloudChanged |= strcmp(config.clientId, existing.clientId) != 0; - cloudChanged |= strcmp(config.clientSecret, existing.clientSecret) != 0; + cloudChanged |= memcmp(config.clientId, existing.clientId, 16) != 0; } else { cloudChanged = true; } stripNonAscii((uint8_t*) config.hostname, 64); - stripNonAscii((uint8_t*) config.clientId, 17); - stripNonAscii((uint8_t*) config.clientSecret, 17); EEPROM.begin(EEPROM_SIZE); EEPROM.put(CONFIG_CLOUD_START, config); @@ -806,8 +803,7 @@ void AmsConfiguration::clearCloudConfig(CloudConfig& config) { strcpy(config.hostname, "cloud.amsleser.no"); config.port = 7443; config.interval = 10; - strcpy(config.clientId, ""); - strcpy(config.clientSecret, ""); + memset(config.clientId, 0, 16); } bool AmsConfiguration::isCloudChanged() { diff --git a/lib/CloudConnector/include/CloudConnector.h b/lib/CloudConnector/include/CloudConnector.h index fe291bdc..e9537fba 100644 --- a/lib/CloudConnector/include/CloudConnector.h +++ b/lib/CloudConnector/include/CloudConnector.h @@ -21,6 +21,7 @@ #include "AmsData.h" #include "EnergyAccounting.h" #include "HwTools.h" +#include "AmsMqttHandler.h" #if defined(ESP8266) #include @@ -37,8 +38,10 @@ static const char CC_JSON_POWER[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu}"; static const char CC_JSON_POWER_LIST3[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu,\"tP\":%.3f,\"tQ\":%.3f}"; -static const char CC_JSON_PHASE[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%.2f}"; -static const char CC_JSON_PHASE_LIST4[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%.2f,\"Pim\":%lu,\"Pex\":%lu,\"pf\":%.2f}"; +static const char CC_JSON_PHASE[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s}"; +static const char CC_JSON_PHASE_LIST4[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s,\"Pim\":%lu,\"Pex\":%lu,\"pf\":%.2f}"; +static const char CC_JSON_STATUS[] PROGMEM = ",\"status\":{\"esp\":{\"state\":%d,\"error\":%d},\"han\":{\"state\":%d,\"error\":%d},\"wifi\":{\"state\":%d,\"error\":%d},\"mqtt\":{\"state\":%d,\"error\":%d}}"; +static const char CC_JSON_INIT[] PROGMEM = "{\"id\":\"%s\",\"init\":{\"mac\":\"%s\",\"apmac\":\"%s\",\"version\":\"%s\"},\"meter\":{\"manufacturerId\":%d,\"manufacturer\":\"%s\",\"model\":\"%s\",\"id\":\"%s\",\"system\":\"%s\",\"fuse\":%d,\"import\":%d,\"export\":%d}"; struct CloudData { uint8_t type; @@ -48,19 +51,27 @@ struct CloudData { class CloudConnector { public: CloudConnector(RemoteDebug*); - void setup(CloudConfig& config, HwTools* hw); + bool setup(CloudConfig& config, MeterConfig& meter, HwTools* hw); + void setMqttHandler(AmsMqttHandler* mqttHandler); void update(AmsData& data, EnergyAccounting& ea); void forceUpdate(); private: RemoteDebug* debugger; HwTools* hw; + AmsMqttHandler* mqttHandler = NULL; CloudConfig config; HTTPClient http; WiFiUDP udp; + int maxPwr = 0; + uint8_t distributionSystem = 0; + uint16_t mainFuse = 0, productionCapacity = 0; + + String uuid; bool initialized = false; unsigned long lastUpdate = 0; char mac[18]; + char apmac[18]; char clearBuffer[CC_BUF_SIZE]; unsigned char encryptedBuffer[256]; @@ -84,5 +95,13 @@ private: return F(""); } + String distributionSystemStr(uint8_t ds) { + switch(ds) { + case 1: return F("IT"); + case 2: return F("TN"); + } + return F(""); + } + }; #endif \ No newline at end of file diff --git a/lib/CloudConnector/src/CloudConnector.cpp b/lib/CloudConnector/src/CloudConnector.cpp index be242145..257d3257 100644 --- a/lib/CloudConnector/src/CloudConnector.cpp +++ b/lib/CloudConnector/src/CloudConnector.cpp @@ -9,6 +9,7 @@ #include "crc.h" #include "Uptime.h" #include "hexutils.h" +#include CloudConnector::CloudConnector(RemoteDebug* debugger) { this->debugger = debugger; @@ -20,22 +21,49 @@ CloudConnector::CloudConnector(RemoteDebug* debugger) { http.useHTTP10(true); uint8_t mac[6]; + uint8_t apmac[6]; #if defined(ESP8266) wifi_get_macaddr(STATION_IF, mac); + wifi_get_macaddr(SOFTAP_IF, apmac); #elif defined(ESP32) esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac); + esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_AP, apmac); #endif sprintf(this->mac, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + sprintf(this->apmac, "%02X:%02X:%02X:%02X:%02X:%02X", apmac[0], apmac[1], apmac[2], apmac[3], apmac[4], apmac[5]); } -void CloudConnector::setup(CloudConfig& config, HwTools* hw) { +bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, HwTools* hw) { + bool ret = false; + if(!ESPRandom::isValidV4Uuid(config.clientId)) { + ESPRandom::uuid4(config.clientId); + ret = true; + } + uuid = ESPRandom::uuidToString(config.clientId); + this->config = config; this->hw = hw; + + this->maxPwr = 0; + this->distributionSystem = distributionSystem; + this->mainFuse = mainFuse; + this->productionCapacity = productionCapacity; + + this->initialized = false; + + return ret; +} + +void CloudConnector::setMqttHandler(AmsMqttHandler* mqttHandler) { + this->mqttHandler = mqttHandler; } bool CloudConnector::init() { - if(config.enabled && strlen(config.hostname) > 0 && config.port > 0) { + if(config.enabled) { + if(config.port == 0) config.port = 7443; + if(strlen(config.hostname) == 0) strcpy(config.hostname, "cloud.amsleser.no"); + snprintf_P(clearBuffer, CC_BUF_SIZE, PSTR("http://%s/hub/cloud/public.key"), config.hostname); if(debugger->isActive(RemoteDebug::INFO)) debugger->printf("(CloudConnector) Downloading public key from %s\n", clearBuffer); #if defined(ESP8266) @@ -97,12 +125,12 @@ bool CloudConnector::init() { } void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { - if(!config.enabled || strlen(config.hostname) == 0 || config.port == 0) return; + if(!config.enabled) return; unsigned long now = millis(); if(now-lastUpdate < config.interval*1000) return; lastUpdate = now; - if(strlen(config.clientId) == 0 || strlen(config.clientSecret) == 0) { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf("(CloudConnector) Client ID and secret is missing\n"); + if(!ESPRandom::isValidV4Uuid(config.clientId)) { + if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf("(CloudConnector) Client ID is not valid\n"); return; } if(data.getListType() < 2) return; @@ -111,9 +139,67 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { int pos = 0; if(initialized) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\",\"secret\":\"%s\",\"data\":{\"clock\":%lu,\"up\":%lu,\"lastUpdate\":%lu,\"est\":%s"), - config.clientId, - config.clientSecret, + float vcc = hw->getVcc(); + int rssi = hw->getWifiRssi(); + + uint8_t espStatus; + #if defined(ESP8266) + if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage + espStatus = 1; + } else if(vcc > 2.8 && vcc < 3.5) { + espStatus = 1; + } else if(vcc > 2.7 && vcc < 3.6) { + espStatus = 2; + } else { + espStatus = 3; + } + #elif defined(ESP32) + if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage + espStatus = 1; + } else if(vcc > 3.1 && vcc < 3.5) { + espStatus = 1; + } else if(vcc > 3.0 && vcc < 3.6) { + espStatus = 2; + } else { + espStatus = 3; + } + #endif + + uint8_t hanStatus; + if(data.getLastError() != 0) { + hanStatus = 3; + } else if(data.getLastUpdateMillis() == 0 && now < 30000) { + hanStatus = 0; + } else if(now - data.getLastUpdateMillis() < 15000) { + hanStatus = 1; + } else if(now - data.getLastUpdateMillis() < 30000) { + hanStatus = 2; + } else { + hanStatus = 3; + } + + uint8_t wifiStatus; + if(rssi > -75) { + wifiStatus = 1; + } else if(rssi > -95) { + wifiStatus = 2; + } else { + wifiStatus = 3; + } + + uint8_t mqttStatus; + if(mqttHandler == NULL) { + mqttStatus = 0; + } else if(mqttHandler->connected()) { + mqttStatus = 1; + } else if(mqttHandler->lastError() == 0) { + mqttStatus = 2; + } else { + mqttStatus = 3; + } + + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\",\"data\":{\"clock\":%lu,\"up\":%lu,\"lastUpdate\":%lu,\"est\":%s"), + uuid.c_str(), (uint32_t) time(nullptr), (uint32_t) (millis64()/1000), (uint32_t) (data.getLastUpdateMillis()/1000), @@ -135,25 +221,25 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { bool first = true; if(data.getL1Voltage() > 0.0) { if(data.getListType() > 3) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 1, data.getL1Voltage(), data.getL1Current(), data.getL1ActiveImportPower(), data.getL1ActiveExportPower(), data.getL1PowerFactor()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str(), data.getL1ActiveImportPower(), data.getL1ActiveExportPower(), data.getL1PowerFactor()); } else { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 1, data.getL1Voltage(), data.getL1Current()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str()); } first = false; } if(data.getL2Voltage() > 0.0) { if(data.getListType() > 3) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 2, data.getL2Voltage(), data.getL2Current(), data.getL2ActiveImportPower(), data.getL2ActiveExportPower(), data.getL2PowerFactor()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 2, data.getL2Voltage(), String(data.getL2Current(), 2).c_str(), data.getL2ActiveImportPower(), data.getL2ActiveExportPower(), data.getL2PowerFactor()); } else { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 2, data.getL2Voltage(), data.getL2Current()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 2, data.getL2Voltage(), data.isL2currentMissing() ? "null" : String(data.getL2Current(), 2).c_str()); } first = false; } if(data.getL3Voltage() > 0.0) { if(data.getListType() > 3) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 3, data.getL3Voltage(), data.getL3Current(), data.getL3ActiveImportPower(), data.getL3ActiveExportPower(), data.getL3PowerFactor()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str(), data.getL3ActiveImportPower(), data.getL3ActiveExportPower(), data.getL3PowerFactor()); } else { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 3, data.getL3Voltage(), data.getL3Current()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str()); } first = false; } @@ -164,7 +250,13 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { } pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"realtime\":{\"import\":%.3f,\"export\":%.3f}"), ea.getUseThisHour(), ea.getProducedThisHour()); - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"vcc\":%.2f,\"temp\":%.2f,\"rssi\":%d,\"free\":%d"), hw->getVcc(), hw->getTemperature(), hw->getWifiRssi(), ESP.getFreeHeap()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"vcc\":%.2f,\"temp\":%.2f,\"rssi\":%d,\"free\":%d"), vcc, hw->getTemperature(), hw->getWifiRssi(), ESP.getFreeHeap()); + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_STATUS, + espStatus, 0, + hanStatus, data.getLastError(), + wifiStatus, 0, + mqttStatus, mqttHandler == NULL ? 0 : mqttHandler->lastError() + ); pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}")); } else { @@ -172,14 +264,32 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf("Unable to initialize cloud connector\n"); return; } - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\",\"secret\":\"%s\",\"init\":{\"mac\":\"%s\",\"version\":\"%s\"},\"meter\":{\"manufacturer\":\"%s\",\"model\":\"%s\",\"id\":\"%s\"}"), - config.clientId, - config.clientSecret, + + if(mainFuse > 0 && distributionSystem > 0) { + int voltage = distributionSystem == 2 ? 400 : 230; + if(data.isThreePhase()) { + maxPwr = mainFuse * sqrt(3) * voltage; + } else if(data.isTwoPhase()) { + maxPwr = mainFuse * voltage; + } else { + maxPwr = mainFuse * 230; + } + } + + + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_INIT, + uuid.c_str(), mac, + apmac, FirmwareVersion::VersionString, + data.getMeterType(), meterManufacturer(data.getMeterType()).c_str(), data.getMeterModel().c_str(), - data.getMeterId().c_str() + data.getMeterId().c_str(), + distributionSystemStr(distributionSystem), + mainFuse, + maxPwr, + productionCapacity ); initialized = true; } diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index a1278793..9be02df7 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(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 u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).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 pe(){}function rl(t,e){for(const l in e)t[l]=e[l];return t}function _c(t){return t()}function ka(){return Object.create(null)}function ze(t){t.forEach(_c)}function uo(t){return typeof t=="function"}function Ee(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let fs;function ds(t,e){return fs||(fs=document.createElement("a")),fs.href=e,t===fs.href}function m1(t){return Object.keys(t).length===0}function fo(t,...e){if(t==null)return pe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function si(t){let e;return fo(t,l=>e=l)(),e}function dl(t,e,l){t.$$.on_destroy.push(fo(e,l))}function co(t,e,l,n){if(t){const i=pc(t,e,l,n);return t[0](i)}}function pc(t,e,l,n){return t[1]&&n?rl(l.ctx.slice(),t[1](n(e))):l.ctx}function mo(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=[],u=Math.max(e.dirty.length,i.length);for(let c=0;c32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Mi(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const p1=["width","height"];function oi(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&&p1.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function ge(t){return t===""?null:+t}function d1(t){return Array.from(t.childNodes)}function J(t,e){e=""+e,t.data!==e&&(t.data=e)}function v1(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function h1(t,e,l){~_1.indexOf(l)?v1(t,e):J(t,e)}function ie(t,e){t.value=e==null?"":e}function vo(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Me(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),S(n)}}function g1(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function wa(t,e){return new t(e)}let Si;function yi(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function dc(t){Ti().$$.on_mount.push(t)}function k1(t){Ti().$$.on_destroy.push(t)}function w1(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=g1(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Ci(t,e){return Ti().$$.context.set(t,e),e}function Hl(t){return Ti().$$.context.get(t)}const li=[],bs=[];let ni=[];const ya=[],vc=Promise.resolve();let Ys=!1;function hc(){Ys||(Ys=!0,vc.then(bc))}function y1(){return hc(),vc}function We(t){ni.push(t)}const Hs=new Set;let ei=0;function bc(){if(ei!==0)return;const t=Si;do{try{for(;eit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ni=e}const ps=new Set;let rn;function Ae(){rn={r:0,c:[],p:rn}}function Pe(){rn.r||ze(rn.c),rn=rn.p}function R(t,e){t&&t.i&&(ps.delete(t),t.i(e))}function B(t,e,l,n){if(t&&t.o){if(ps.has(t))return;ps.add(t),rn.c.push(()=>{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function gc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],c=e[o];if(c){for(const a in u)a in c||(n[a]=1);for(const a in c)i[a]||(l[a]=c[a],i[a]=1);t[o]=c}else for(const a in u)i[a]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Ca(t){return typeof t=="object"&&t!==null?t:{}}function re(t){t&&t.c()}function se(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||We(()=>{const u=t.$$.on_mount.map(_c).filter(uo);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),o.forEach(We)}function oe(t,e){const l=t.$$;l.fragment!==null&&(S1(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function M1(t,e){t.$$.dirty[0]===-1&&(li.push(t),hc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=v.length?v[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&M1(t,_)),h}):[],f.update(),p=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=d1(e.target);f.fragment&&f.fragment.l(_),_.forEach(S)}else f.fragment&&f.fragment.c();e.intro&&R(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),bc()}yi(a)}class Re{$destroy(){oe(this,1),this.$destroy=pe}$on(e,l){if(!uo(l))return pe;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&&!m1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sa=t=>typeof t>"u",kc=t=>typeof t=="function",wc=t=>typeof t=="number";function T1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yc(){let t=0;return()=>t++}function $1(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function Cc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Sc=(t,e)=>t?{}:{style:e},Qs=t=>({"aria-hidden":"true",...Sc(t,"display:none;")}),ti=[];function Mc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=pe){let l;const n=new Set;function i(c){if(Ee(t,c)&&(t=c,l)){const a=!ti.length;for(const f of n)f[1](),ti.push(f,t);if(a){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function N1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Mc(l,u=>{let c=!1;const a=[];let f=0,p=pe;const _=()=>{if(f)return;p();const v=e(n?a[0]:a,u);o?u(v):p=uo(v)?v:pe},h=i.map((v,d)=>fo(v,g=>{a[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Xs=$i("LOCATION"),ri=$i("ROUTER"),Tc=$i("ROUTE"),E1=$i("ROUTE_PARAMS"),A1=$i("FOCUS_ELEM"),$c=/^:(.+)/,gi=(t,e,l)=>t.substr(e,l),Zs=(t,e)=>gi(t,0,e.length)===e,P1=t=>t==="",D1=t=>$c.test(t),Nc=t=>t[0]==="*",L1=t=>t.replace(/\*.*$/,""),Ec=t=>t.replace(/(^\/+|\/+$)/g,"");function hl(t,e=!1){const l=Ec(t).split("/");return e?l.filter(Boolean):l}const Ws=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${Ec(t)}`;function Ni(...t){const e=n=>hl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,ys=2,_n=3,R1=4,Ac=5,I1=6,Pc=7,O1=8,F1=9,Dc=10,Lc=11,q1={[go]:"Link",[ys]:"Route",[_n]:"Router",[R1]:"useFocus",[Ac]:"useLocation",[I1]:"useMatch",[Pc]:"useNavigate",[O1]:"useParams",[F1]:"useResolvable",[Dc]:"useResolve",[Lc]:"navigate"},ko=t=>q1[t];function B1(t,e){let l;return t===ys?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===_n&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function U1(t,e,l,n){const i=l&&B1(n||t,l),o=i?` +(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 u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).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 pe(){}function rl(t,e){for(const l in e)t[l]=e[l];return t}function _c(t){return t()}function ka(){return Object.create(null)}function Ge(t){t.forEach(_c)}function uo(t){return typeof t=="function"}function Ee(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let us;function ps(t,e){return us||(us=document.createElement("a")),us.href=e,t===us.href}function m1(t){return Object.keys(t).length===0}function fo(t,...e){if(t==null)return pe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ni(t){let e;return fo(t,l=>e=l)(),e}function hl(t,e,l){t.$$.on_destroy.push(fo(e,l))}function co(t,e,l,n){if(t){const i=pc(t,e,l,n);return t[0](i)}}function pc(t,e,l,n){return t[1]&&n?rl(l.ctx.slice(),t[1](n(e))):l.ctx}function mo(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=[],u=Math.max(e.dirty.length,i.length);for(let c=0;c32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ci(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const p1=["width","height"];function ii(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&&p1.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function ge(t){return t===""?null:+t}function d1(t){return Array.from(t.childNodes)}function J(t,e){e=""+e,t.data!==e&&(t.data=e)}function h1(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function v1(t,e,l){~_1.indexOf(l)?h1(t,e):J(t,e)}function oe(t,e){t.value=e==null?"":e}function ho(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Me(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),S(n)}}function g1(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function wa(t,e){return new t(e)}let yi;function ki(t){yi=t}function Si(){if(!yi)throw new Error("Function called outside component initialization");return yi}function dc(t){Si().$$.on_mount.push(t)}function k1(t){Si().$$.on_destroy.push(t)}function w1(){const t=Si();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=g1(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Si().$$.context.set(t,e),e}function jl(t){return Si().$$.context.get(t)}const ei=[],vs=[];let ti=[];const ya=[],hc=Promise.resolve();let Ys=!1;function vc(){Ys||(Ys=!0,hc.then(bc))}function y1(){return vc(),hc}function ze(t){ti.push(t)}const Hs=new Set;let Jn=0;function bc(){if(Jn!==0)return;const t=yi;do{try{for(;Jnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ti=e}const _s=new Set;let on;function Ae(){on={r:0,c:[],p:on}}function Pe(){on.r||Ge(on.c),on=on.p}function I(t,e){t&&t.i&&(_s.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(_s.has(t))return;_s.add(t),on.c.push(()=>{_s.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function gc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],c=e[o];if(c){for(const a in u)a in c||(n[a]=1);for(const a in c)i[a]||(l[a]=c[a],i[a]=1);t[o]=c}else for(const a in u)i[a]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Ca(t){return typeof t=="object"&&t!==null?t:{}}function se(t){t&&t.c()}function ne(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||ze(()=>{const u=t.$$.on_mount.map(_c).filter(uo);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ge(u),t.$$.on_mount=[]}),o.forEach(ze)}function ie(t,e){const l=t.$$;l.fragment!==null&&(S1(l.after_update),Ge(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function M1(t,e){t.$$.dirty[0]===-1&&(ei.push(t),vc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=h.length?h[0]:v;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&M1(t,_)),v}):[],f.update(),p=!0,Ge(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=d1(e.target);f.fragment&&f.fragment.l(_),_.forEach(S)}else f.fragment&&f.fragment.c();e.intro&&I(t.$$.fragment),ne(t,e.target,e.anchor,e.customElement),bc()}ki(a)}class Re{$destroy(){ie(this,1),this.$destroy=pe}$on(e,l){if(!uo(l))return pe;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&&!m1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sa=t=>typeof t>"u",kc=t=>typeof t=="function",wc=t=>typeof t=="number";function T1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function yc(){let t=0;return()=>t++}function $1(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function Cc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Sc=(t,e)=>t?{}:{style:e},Qs=t=>({"aria-hidden":"true",...Sc(t,"display:none;")}),xn=[];function Mc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=pe){let l;const n=new Set;function i(c){if(Ee(t,c)&&(t=c,l)){const a=!xn.length;for(const f of n)f[1](),xn.push(f,t);if(a){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function N1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return Mc(l,u=>{let c=!1;const a=[];let f=0,p=pe;const _=()=>{if(f)return;p();const h=e(n?a[0]:a,u);o?u(h):p=uo(h)?h:pe},v=i.map((h,d)=>fo(h,g=>{a[d]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,Xs=Mi("LOCATION"),si=Mi("ROUTER"),Tc=Mi("ROUTE"),E1=Mi("ROUTE_PARAMS"),A1=Mi("FOCUS_ELEM"),$c=/^:(.+)/,vi=(t,e,l)=>t.substr(e,l),Zs=(t,e)=>vi(t,0,e.length)===e,P1=t=>t==="",D1=t=>$c.test(t),Nc=t=>t[0]==="*",L1=t=>t.replace(/\*.*$/,""),Ec=t=>t.replace(/(^\/+|\/+$)/g,"");function bl(t,e=!1){const l=Ec(t).split("/");return e?l.filter(Boolean):l}const Ws=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${Ec(t)}`;function Ti(...t){const e=n=>bl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,ws=2,mn=3,R1=4,Ac=5,I1=6,Pc=7,O1=8,F1=9,Dc=10,Lc=11,B1={[go]:"Link",[ws]:"Route",[mn]:"Router",[R1]:"useFocus",[Ac]:"useLocation",[I1]:"useMatch",[Pc]:"useNavigate",[O1]:"useParams",[F1]:"useResolvable",[Dc]:"useResolve",[Lc]:"navigate"},ko=t=>B1[t];function q1(t,e){let l;return t===ws?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function U1(t,e,l,n){const i=l&&q1(n||t,l),o=i?` -Occurred in: ${i}`:"",u=ko(t),c=kc(e)?e(u):e;return`<${u}> ${c}${o}`}const Rc=t=>(...e)=>t(U1(...e)),Ic=Rc(t=>{throw new Error(t)}),gs=Rc(console.warn),Ma=4,j1=3,H1=2,W1=1,z1=1;function G1(t,e){const l=t.default?0:hl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ma,P1(i)?o+=z1:D1(i)?o+=H1:Nc(i)?o-=Ma+W1:o+=j1,o},0);return{route:t,score:l,index:e}}function V1(t){return t.map(G1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Oc(t,e){let l,n;const[i]=e.split("?"),o=hl(i),u=o[0]==="",c=V1(t);for(let a=0,f=c.length;a({...p,params:h,uri:D});if(p.default){n=v(e);continue}const d=hl(p.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w{f===".."?a.pop():f!=="."&&a.push(f)}),Ws(`/${a.join("/")}`,n)}function Ta(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=hl(e,!0),c=hl(l,!0);for(;u.length;)u[0]!==c[0]&&Ic(_n,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),c.shift();return{pathname:Ni(...c),hash:n,search:i,state:o}}const $a=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?$a(gi(t,l)):"",u=i?gi(t,0,l):t,c=n?$a(gi(u,e)):"";return{pathname:(n?gi(u,0,e):u)||"/",search:c,hash:o}},Y1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Q1(t,e,l){return Ni(l,K1(t,e))}function X1(t,e){const l=bo(L1(t)),n=hl(l,!0),i=hl(e,!0).slice(0,n.length),o=Fc({fullPath:l},Ni(...i));return o&&o.uri}const zs="POP",Z1="PUSH",J1="REPLACE";function Gs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function x1(t){let e=[],l=Gs(t),n=zs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Gs(t),n=zs,i([o])};i([o]);const c=Cc(t,"popstate",u);return()=>{c(),e=e.filter(a=>a!==o)}},navigate(o,u){const{state:c={},replace:a=!1}=u||{};if(n=a?J1:Z1,wc(o))u&&gs(Lc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=zs,t.history.go(o);else{const f={...c,_key:$1()};try{t.history[a?"replaceState":"pushState"](f,"",o)}catch{t.location[a?"replace":"assign"](o)}}l=Gs(t),i()}}}function Vs(t,e){return{...wo(e),state:t}}function e0(t="/"){let e=0,l=[Vs(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(Vs(n,o))},replaceState(n,i,o){l[e]=Vs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const t0=!!(!Wl&&window.document&&window.document.createElement),l0=!Wl&&window.location.origin==="null",qc=x1(t0&&!l0?window:e0()),{navigate:mn}=qc;let Tl=null,Bc=!0;function n0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&n0(t.routerId,Tl.routerId))&&(Tl=t)}function s0(){Tl=null}function o0(){Bc=!1}function Na(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Cc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function r0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function a0(t){return/^H[1-6]$/i.test(t.tagName)}function Ea(t,e=document){return e.querySelector(t)}function u0(t){let l=Ea(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!r0(l,t);){if(a0(l))return l;const n=Ea("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function f0(t){Promise.resolve(si(t.focusElement)).then(e=>{const l=e||u0(t.id);l||gs(_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,ys),!Na(l)&&Na(document.documentElement)})}const c0=(t,e,l)=>(n,i)=>y1().then(()=>{if(!Tl||Bc){o0();return}if(n&&f0(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:c,params:a,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:c,params:a,uri:f},si(l));Promise.resolve(p).then(_=>{e.set(_)})}s0()}),m0="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 _0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Sc(t[6],m0)],i={};for(let o=0;o`Navigated to ${te.uri}`,announcements:!0,...d},D=p,T=bo(p),E=Hl(Xs),F=Hl(ri),I=!E,O=d0(),C=v&&!(F&&!F.manageFocus),A=it("");dl(t,A,te=>l(0,c=te));const le=F?F.disableInlineStyles:g,H=it([]);dl(t,H,te=>l(20,u=te));const z=it(null);dl(t,z,te=>l(18,i=te));let U=!1;const K=I?0:F.level+1,G=I?it((()=>Ta(Wl?wo(_):h.location,T))()):E;dl(t,G,te=>l(17,n=te));const X=it(n);dl(t,X,te=>l(19,o=te));const Y=c0(w,A,G),j=te=>V=>V.filter(W=>W.id!==te);function x(te){if(Wl){if(U)return;const V=Fc(te,n.pathname);if(V)return U=!0,V}else H.update(V=>{const W=j(te.id)(V);return W.push(te),W})}function ae(te){H.update(j(te))}return!I&&p!==Aa&&gs(_n,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),I&&(dc(()=>h.listen(V=>{const W=Ta(V.location,T);X.set(n),G.set(W)})),Ci(Xs,G)),Ci(ri,{activeRoute:z,registerRoute:x,unregisterRoute:ae,manageFocus:C,level:K,id:O,history:I?h:F.history,basepath:I?T:F.basepath,disableInlineStyles:le}),t.$$set=te=>{"basepath"in te&&l(11,p=te.basepath),"url"in te&&l(12,_=te.url),"history"in te&&l(13,h=te.history),"primary"in te&&l(14,v=te.primary),"a11y"in te&&l(15,d=te.a11y),"disableInlineStyles"in te&&l(16,g=te.disableInlineStyles),"$$scope"in te&&l(21,f=te.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==D&&gs(_n,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const te=Oc(u,n.pathname);z.set(te)}if(t.$$.dirty[0]&655360&&I){const te=!!n.hash,V=!te&&C,W=!te||n.pathname!==o.pathname;Y(V,W)}t.$$.dirty[0]&262144&&C&&i&&i.primary&&i0({level:K,routerId:O,route:i})},[c,w,I,O,C,A,le,H,z,G,X,p,_,h,v,d,g,n,i,o,u,f,a]}class h0 extends Re{constructor(e){super(),Le(this,e,v0,p0,Ee,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Uc=h0;function Ei(t,e,l=ri,n=_n){Hl(l)||Ic(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const b0=t=>{const{subscribe:e}=Hl(t);return{subscribe:e}};function jc(){return Ei(Ac),b0(Xs)}function Hc(){const{history:t}=Hl(ri);return t}function Wc(){const t=Hl(Tc);return t?N1(t,e=>e.base):it("/")}function zc(){Ei(Dc);const t=Wc(),{basepath:e}=Hl(ri);return n=>Q1(n,si(t),e)}function g0(){Ei(Pc);const t=zc(),{navigate:e}=Hc();return(n,i)=>{const o=wc(n)?n:t(n);return e(o,i)}}const k0=t=>({params:t&16,location:t&8}),Pa=t=>({params:Wl?si(t[10]):t[4],location:t[3],navigate:t[11]});function Da(t){let e,l;return e=new Uc({props:{primary:t[1],$$slots:{default:[C0]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(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||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function w0(t){let e;const l=t[18].default,n=co(l,t,t[19],Pa);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&_o(n,l,i,i[19],e?mo(l,i[19],o,k0):po(i[19]),Pa)},i(i){e||(R(n,i),e=!0)},o(i){B(n,i),e=!1},d(i){n&&n.d(i)}}}function y0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Wl?si(t[10]):t[4],t[12]];var o=t[0];function u(c){let a={};for(let f=0;f{oe(p,1)}),Pe()}o?(e=wa(o,u()),re(e.$$.fragment),R(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(c){n||(e&&R(e.$$.fragment,c),n=!0)},o(c){e&&B(e.$$.fragment,c),n=!1},d(c){c&&S(l),e&&oe(e,c)}}}function C0(t){let e,l,n,i;const o=[y0,w0],u=[];function c(a,f){return a[0]!==null?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),B(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),R(l,1),l.m(n.parentNode,n))},i(a){i||(R(l),i=!0)},o(a){B(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function S0(t){let e,l,n,i,o,u=[Qs(t[7]),{"data-svnav-route-start":t[5]}],c={};for(let _=0;_{a=null}),Pe())},i(_){o||(R(a),o=!0)},o(_){B(a),o=!1},d(_){_&&S(e),_&&S(l),a&&a.d(_),_&&S(n),_&&S(i)}}}const M0=yc();function T0(t,e,l){let n;const i=["path","component","meta","primary"];let o=hs(e,i),u,c,a,f,{$$slots:p={},$$scope:_}=e,{path:h=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Ei(ys,e);const w=M0(),{registerRoute:D,unregisterRoute:T,activeRoute:E,disableInlineStyles:F}=Hl(ri);dl(t,E,U=>l(16,u=U));const I=Wc();dl(t,I,U=>l(17,a=U));const O=jc();dl(t,O,U=>l(3,c=U));const C=it(null);let A;const le=it(),H=it({});dl(t,H,U=>l(4,f=U)),Ci(Tc,le),Ci(E1,H),Ci(A1,C);const z=g0();return Wl||k1(()=>T(w)),t.$$set=U=>{l(24,e=rl(rl({},e),vs(U))),l(12,o=hs(e,i)),"path"in U&&l(13,h=U.path),"component"in U&&l(0,v=U.component),"meta"in U&&l(14,d=U.meta),"primary"in U&&l(1,g=U.primary),"$$scope"in U&&l(19,_=U.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const U=h==="",K=Ni(a,h),Q={id:w,path:h,meta:d,default:U,fullPath:U?"":K,base:U?a:X1(K,c.pathname),primary:g,focusElement:C};le.set(Q),l(15,A=D(Q))}if(t.$$.dirty&98304&&l(2,n=!!(A||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:U}=A||u;H.set(U)}},e=vs(e),[v,g,n,c,f,w,E,F,I,O,H,z,o,h,d,A,u,a,p,_]}class $0 extends Re{constructor(e){super(),Le(this,e,T0,S0,Ee,{path:13,component:0,meta:14,primary:1})}}const _l=$0;function N0(t){let e,l,n,i;const o=t[13].default,u=co(o,t,t[12],null);let c=[{href:t[0]},t[2],t[1]],a={};for(let f=0;fl(11,_=C));const E=w1(),F=zc(),{navigate:I}=Hc();function O(C){E("click",C),T1(C)&&(C.preventDefault(),I(n,{state:w,replace:u||g}))}return t.$$set=C=>{l(19,e=rl(rl({},e),vs(C))),l(18,p=hs(e,f)),"to"in C&&l(5,d=C.to),"replace"in C&&l(6,g=C.replace),"state"in C&&l(7,w=C.state),"getProps"in C&&l(8,D=C.getProps),"$$scope"in C&&l(12,v=C.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(d,_)),t.$$.dirty&2049&&l(10,i=Zs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===Y1(_)),t.$$.dirty&512&&l(2,c=o?{"aria-current":"page"}:{}),l(1,a=(()=>{if(kc(D)){const C=D({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...C}}return p})())},e=vs(e),[n,a,c,T,O,d,g,w,D,o,i,_,v,h]}class A0 extends Re{constructor(e){super(),Le(this,e,E0,N0,Ee,{to:5,replace:6,state:7,getProps:8})}}const Xt=A0;let Js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function P0(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Gc(t,e){let l;return e?t>90?l="#d90000":t>85?l="#e31000":t>80?l="#ffa900":t>75?l="#dcc300":l="#32c500":t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l}function D0(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ks(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 Ue(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function he(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 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"\xB5HAN 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"}}function La(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ra(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Ia(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Oa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function ii(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Xe(t,e){return t==1||t==2&&e}function It(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ke(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function vl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function qa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Ba(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function $l(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 pl={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}};const zt=it(pl);async function yo(){pl=await(await $l("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),zt.set(pl)}let ms=0,Ua=-127,ja=null,L0={};const Vc=Mc(L0,t=>{let e;async function l(){$l("data.json").then(n=>n.json()).then(n=>{t(n),Ua!=n.t&&(Ua=n.t,setTimeout(Zc,2e3)),ja==null&&n.pe&&n.p!=null&&(ja=n.p,Yc()),pl.upgrading?window.location.reload():(!pl||!pl.chip||pl.booting||ms>1&&!ii(pl.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(So,2e3),un&&clearTimeout(un),un=setTimeout(Mo,3e3));let i=5e3;if(ii(pl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ms=0}).catch(n=>{ms++,ms>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ii(pl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let xs={},ki;const Co=it(xs);async function Kc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Ue(l)]==null){t=l<12;break}e[Ue(l)]=e[Ue(l+1)]}return e}),t)Yc();else{let e=new Date;ki=setTimeout(Kc,(60-e.getMinutes())*6e4)}}async function Yc(){ki&&(clearTimeout(ki),ki=0),xs=await(await $l("energyprice.json")).json(),Co.set(xs);let e=new Date;ki=setTimeout(Kc,(60-e.getMinutes())*6e4)}let eo={},an;async function So(){an&&(clearTimeout(an),an=0),eo=await(await $l("dayplot.json")).json(),Qc.set(eo);let e=new Date;an=setTimeout(So,(60-e.getMinutes())*6e4+20)}const Qc=it(eo,t=>(So(),function(){}));let to={},un;async function Mo(){un&&(clearTimeout(un),un=0),to=await(await $l("monthplot.json")).json(),Xc.set(to);let e=new Date;un=setTimeout(Mo,(24-e.getHours())*36e5+40)}const Xc=it(to,t=>(Mo(),function(){}));let lo={};async function Zc(){lo=await(await $l("temperature.json")).json(),Jc.set(lo)}const Jc=it(lo,t=>(Zc(),function(){}));let no={},_s;async function xc(){_s&&(clearTimeout(_s),_s=0),no=await(await $l("tariff.json")).json(),e1.set(no);let e=new Date;_s=setTimeout(xc,(60-e.getMinutes())*6e4+30)}const e1=it(no,t=>function(){});let io=[];const To=it(io);async function R0(){io=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),To.set(io)}let so={};async function I0(){so=await(await $l("realtime.json")).json(),t1.set(so)}const t1=it(so,t=>(I0(),function(){}));function ws(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 l1(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function n1(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let c,a,f;for(let p=0;po&&(c=_):g==i+1&&(a=_);else if(d==n+1)if(f){let D=f.tag_name.substring(1).split(".");parseInt(D[0]);let T=parseInt(D[1]);parseInt(D[2]),g==T&&(f=_)}else f=_}return a||f||c||!1}else return e[0]}const Ha="/github.svg";function Wa(t){let e,l;function n(u,c){return u[1]>1?H0:u[1]>0?j0:u[2]>1?U0:u[2]>0?B0:u[3]>1?q0:u[3]>0?F0:O0}let i=n(t),o=i(t);return{c(){e=N(`Up - `),o.c(),l=Ve()},m(u,c){M(u,e,c),o.m(u,c),M(u,l,c)},p(u,c){i===(i=n(u))&&o?o.p(u,c):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&S(e),o.d(u),u&&S(l)}}}function O0(t){let e,l;return{c(){e=N(t[0]),l=N(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&J(e,n[0])},d(n){n&&S(e),n&&S(l)}}}function F0(t){let e,l;return{c(){e=N(t[3]),l=N(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function q0(t){let e,l;return{c(){e=N(t[3]),l=N(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function B0(t){let e,l;return{c(){e=N(t[2]),l=N(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function U0(t){let e,l;return{c(){e=N(t[2]),l=N(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function j0(t){let e,l;return{c(){e=N(t[1]),l=N(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function H0(t){let e,l;return{c(){e=N(t[1]),l=N(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function W0(t){let e,l=t[0]&&Wa(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function z0(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class G0 extends Re{constructor(e){super(),Le(this,e,z0,W0,Ee,{epoch:0})}}function V0(t){let e,l,n;return{c(){e=m("span"),l=N(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&J(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:pe,o:pe,d(i){i&&S(e)}}}function K0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends Re{constructor(e){super(),Le(this,e,K0,V0,Ee,{color:0,title:1,text:2})}}function Y0(t){let e,l=`${Ue(t[0].getDate())}.${Ue(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=N(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ue(i[0].getDate())}.${Ue(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ue(i[0].getHours())}:${Ue(i[0].getMinutes())}`)&&J(n,l),o&2&&r(e,"class",i[1])},d(i){i&&S(e)}}}function Q0(t){let e=`${Ue(t[0].getDate())}. ${Js[t[0].getMonth()]} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Ue(n[0].getDate())}. ${Js[n[0].getMonth()]} ${Ue(n[0].getHours())}:${Ue(n[0].getMinutes())}`)&&J(l,e)},d(n){n&&S(l)}}}function X0(t){let e;function l(o,u){return o[2]?Q0:Y0}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:pe,o:pe,d(o){i.d(o),o&&S(e)}}}function Z0(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=c=>{"timestamp"in c&&l(0,n=c.timestamp),"fullTimeColor"in c&&l(1,i=c.fullTimeColor),"offset"in c&&l(3,o=c.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||vl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class i1 extends Re{constructor(e){super(),Le(this,e,Z0,X0,Ee,{timestamp:0,fullTimeColor:1,offset:3})}}function J0(t){let e,l,n;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:pe,i:pe,o:pe,d(i){i&&S(e)}}}class x0 extends Re{constructor(e){super(),Le(this,e,null,J0,Ee,{})}}function em(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class tm extends Re{constructor(e){super(),Le(this,e,null,em,Ee,{})}}function lm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class Rt extends Re{constructor(e){super(),Le(this,e,null,lm,Ee,{})}}function nm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class s1 extends Re{constructor(e){super(),Le(this,e,null,nm,Ee,{})}}function im(t){let e,l,n=t[2].version+"",i;return{c(){e=N("AMS reader "),l=m("span"),i=N(n)},m(o,u){M(o,e,u),M(o,l,u),s(l,i)},p(o,u){u&4&&n!==(n=o[2].version+"")&&J(i,n)},d(o){o&&S(e),o&&S(l)}}}function za(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=N(l),i=N("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&J(n,l)},d(o){o&&S(e)}}}function Ga(t){let e,l="HAN: "+La(t[1].he),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="HAN: "+La(i[1].he))&&J(n,l)},d(i){i&&S(e)}}}function Va(t){let e,l="MQTT: "+Ra(t[1].me),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="MQTT: "+Ra(i[1].me))&&J(n,l)},d(i){i&&S(e)}}}function Ka(t){let e,l="Price service: "+Ia(t[1].ee),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="Price service: "+Ia(i[1].ee))&&J(n,l)},d(i){i&&S(e)}}}function Ya(t){let e,l,n,i,o,u;return l=new Xt({props:{to:"/configuration",$$slots:{default:[sm]},$$scope:{ctx:t}}}),o=new Xt({props:{to:"/status",$$slots:{default:[om]},$$scope:{ctx:t}}}),{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("div"),re(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(c,a){M(c,e,a),se(l,e,null),M(c,n,a),M(c,i,a),se(o,i,null),u=!0},i(c){u||(R(l.$$.fragment,c),R(o.$$.fragment,c),u=!0)},o(c){B(l.$$.fragment,c),B(o.$$.fragment,c),u=!1},d(c){c&&S(e),oe(l),c&&S(n),c&&S(i),oe(o)}}}function sm(t){let e,l;return e=new x0({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function om(t){let e,l;return e=new tm({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Qa(t){let e,l,n,i,o;const u=[am,rm],c=[];function a(f,p){return f[2].security==0||f[1].a?0:1}return l=a(t),n=c[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),c[l].m(e,null),o=!0},p(f,p){let _=l;l=a(f),l===_?c[l].p(f,p):(Ae(),B(c[_],1,1,()=>{c[_]=null}),Pe(),n=c[l],n?n.p(f,p):(n=c[l]=u[l](f),n.c()),R(n,1),n.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&r(e,"title",i)},i(f){o||(R(n),o=!0)},o(f){B(n),o=!1},d(f){f&&S(e),c[l].d()}}}function rm(t){let e,l,n=t[3].tag_name+"",i;return{c(){e=m("span"),l=N("New version: "),i=N(n)},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&8&&n!==(n=o[3].tag_name+"")&&J(i,n)},i:pe,o:pe,d(o){o&&S(e)}}}function am(t){let e,l,n,i=t[3].tag_name+"",o,u,c,a,f,p;return c=new s1({}),{c(){e=m("button"),l=m("span"),n=N("New version: "),o=N(i),u=b(),re(c.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,h){M(_,e,h),s(e,l),s(l,n),s(l,o),s(e,u),se(c,e,null),a=!0,f||(p=ee(e,"click",t[4]),f=!0)},p(_,h){(!a||h&8)&&i!==(i=_[3].tag_name+"")&&J(o,i)},i(_){a||(R(c.$$.fragment,_),a=!0)},o(_){B(c.$$.fragment,_),a=!1},d(_){_&&S(e),oe(c),f=!1,p()}}}function um(t){let e,l,n,i,o,u,c,a,f,p,_,h,v=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se;i=new Xt({props:{to:"/",$$slots:{default:[im]},$$scope:{ctx:t}}}),a=new G0({props:{epoch:t[1].u}});let ye=t[1].t>-50&&za(t);T=new fn({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:jl(t[2].booting?2:t[1].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:jl(t[2].booting?9:t[1].hm)}}),O=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:jl(t[2].booting?9:t[1].wm)}}),A=new fn({props:{title:"MQTT",text:"MQTT",color:jl(t[2].booting?9:t[1].mm)}});let ve=(t[1].he<0||t[1].he>0)&&Ga(t),$e=t[1].me<0&&Va(t),be=(t[1].ee>0||t[1].ee<0)&&Ka(t);ae=new i1({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let $=t[2].vndcfg&&t[2].usrcfg&&Ya(t);He=new Rt({});let y=t[2].fwconsent===1&&t[3]&&Qa(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),re(i.$$.fragment),o=b(),u=m("div"),c=m("div"),re(a.$$.fragment),f=b(),ye&&ye.c(),p=b(),_=m("div"),h=N("Free mem: "),d=N(v),g=N("kb"),w=b(),D=m("div"),re(T.$$.fragment),E=b(),re(F.$$.fragment),I=b(),re(O.$$.fragment),C=b(),re(A.$$.fragment),le=b(),ve&&ve.c(),H=b(),$e&&$e.c(),z=b(),be&&be.c(),U=b(),K=m("div"),Q=m("div"),G=m("a"),X=m("img"),j=b(),x=m("div"),re(ae.$$.fragment),te=b(),$&&$.c(),V=b(),W=m("div"),we=m("a"),re(He.$$.fragment),Ie=b(),y&&y.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(c,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(D,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(X,"class","gh-logo"),ds(X.src,Y=t[0]+Ha)||r(X,"src",Y),r(X,"alt","GitHub repo"),r(G,"class","float-right"),r(G,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(G,"target","_blank"),r(G,"rel","noreferrer"),r(G,"aria-label","GitHub"),r(Q,"class","flex-none"),r(x,"class","flex-none my-auto px-2"),r(we,"href",It("")),r(we,"target","_blank"),r(we,"rel","noreferrer"),r(W,"class","flex-none px-1 mt-1"),r(W,"title","Documentation"),r(K,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","hdr")},m(k,P){M(k,e,P),s(e,l),s(l,n),se(i,n,null),s(l,o),s(l,u),s(u,c),se(a,c,null),s(u,f),ye&&ye.m(u,null),s(u,p),s(u,_),s(_,h),s(_,d),s(_,g),s(l,w),s(l,D),se(T,D,null),s(D,E),se(F,D,null),s(D,I),se(O,D,null),s(D,C),se(A,D,null),s(l,le),ve&&ve.m(l,null),s(l,H),$e&&$e.m(l,null),s(l,z),be&&be.m(l,null),s(l,U),s(l,K),s(K,Q),s(Q,G),s(G,X),s(K,j),s(K,x),se(ae,x,null),s(K,te),$&&$.m(K,null),s(K,V),s(K,W),s(W,we),se(He,we,null),s(K,Ie),y&&y.m(K,null),Se=!0},p(k,[P]){const L={};P&36&&(L.$$scope={dirty:P,ctx:k}),i.$set(L);const Z={};P&2&&(Z.epoch=k[1].u),a.$set(Z),k[1].t>-50?ye?ye.p(k,P):(ye=za(k),ye.c(),ye.m(u,p)):ye&&(ye.d(1),ye=null),(!Se||P&2)&&v!==(v=(k[1].m?(k[1].m/1e3).toFixed(1):"-")+"")&&J(d,v);const ne={};P&6&&(ne.text=k[2].booting?"Booting":k[1].v>2?k[1].v.toFixed(2)+"V":"ESP"),P&6&&(ne.color=jl(k[2].booting?2:k[1].em)),T.$set(ne);const fe={};P&6&&(fe.color=jl(k[2].booting?9:k[1].hm)),F.$set(fe);const de={};P&2&&(de.text=k[1].r?k[1].r.toFixed(0)+"dBm":"WiFi"),P&6&&(de.color=jl(k[2].booting?9:k[1].wm)),O.$set(de);const Ce={};P&6&&(Ce.color=jl(k[2].booting?9:k[1].mm)),A.$set(Ce),k[1].he<0||k[1].he>0?ve?ve.p(k,P):(ve=Ga(k),ve.c(),ve.m(l,H)):ve&&(ve.d(1),ve=null),k[1].me<0?$e?$e.p(k,P):($e=Va(k),$e.c(),$e.m(l,z)):$e&&($e.d(1),$e=null),k[1].ee>0||k[1].ee<0?be?be.p(k,P):(be=Ka(k),be.c(),be.m(l,U)):be&&(be.d(1),be=null),(!Se||P&1&&!ds(X.src,Y=k[0]+Ha))&&r(X,"src",Y);const Oe={};P&2&&(Oe.timestamp=k[1].c?new Date(k[1].c*1e3):new Date(0)),P&4&&(Oe.offset=k[2].clock_offset),ae.$set(Oe),k[2].vndcfg&&k[2].usrcfg?$?P&4&&R($,1):($=Ya(k),$.c(),R($,1),$.m(K,V)):$&&(Ae(),B($,1,1,()=>{$=null}),Pe()),k[2].fwconsent===1&&k[3]?y?(y.p(k,P),P&12&&R(y,1)):(y=Qa(k),y.c(),R(y,1),y.m(K,null)):y&&(Ae(),B(y,1,1,()=>{y=null}),Pe())},i(k){Se||(R(i.$$.fragment,k),R(a.$$.fragment,k),R(T.$$.fragment,k),R(F.$$.fragment,k),R(O.$$.fragment,k),R(A.$$.fragment,k),R(ae.$$.fragment,k),R($),R(He.$$.fragment,k),R(y),Se=!0)},o(k){B(i.$$.fragment,k),B(a.$$.fragment,k),B(T.$$.fragment,k),B(F.$$.fragment,k),B(O.$$.fragment,k),B(A.$$.fragment,k),B(ae.$$.fragment,k),B($),B(He.$$.fragment,k),B(y),Se=!1},d(k){k&&S(e),oe(i),oe(a),ye&&ye.d(),oe(T),oe(F),oe(O),oe(A),ve&&ve.d(),$e&&$e.d(),be&&be.d(),oe(ae),$&&$.d(),oe(He),y&&y.d()}}}function fm(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={},u={};function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!ii(o.board)||confirm(ws(he(o.chip,o.board))))&&(zt.update(a=>(a.upgrading=!0,a)),l1(u.tag_name))}return zt.subscribe(a=>{l(2,o=a),a.fwconsent===1&&R0()}),To.subscribe(a=>{l(3,u=n1(o.version,a))}),t.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,u,c]}class cm extends Re{constructor(e){super(),Le(this,e,fm,um,Ee,{basepath:0,data:1})}}function mm(t){let e,l,n,i;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"d",Ks(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Ks(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){M(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Ks(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:pe,o:pe,d(o){o&&S(e)}}}function Xa(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 Ks(t,e,l,n,i){var o=Xa(t,e,l,i),u=Xa(t,e,l,n),c=i-n<=180?"0":"1",a=["M",o.x,o.y,"A",l,l,0,c,0,u.x,u.y].join(" ");return a}function _m(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 pm extends Re{constructor(e){super(),Le(this,e,_m,mm,Ee,{pct:0,color:1})}}function Za(t){let e,l,n,i,o,u,c,a;return{c(){e=m("br"),l=b(),n=m("span"),i=N(t[3]),o=b(),u=m("span"),c=N(t[4]),a=N("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),M(f,o,p),M(f,u,p),s(u,c),s(u,a)},p(f,p){p&8&&J(i,f[3]),p&16&&J(c,f[4])},d(f){f&&S(e),f&&S(l),f&&S(n),f&&S(o),f&&S(u)}}}function dm(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w;l=new pm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let D=t[3]&&Za(t);return{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("span"),o=m("span"),u=N(t[2]),c=b(),a=m("br"),f=b(),p=m("span"),_=N(t[0]),h=b(),v=m("span"),d=N(t[1]),g=b(),D&&D.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(T,E){M(T,e,E),se(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,c),s(i,a),s(i,f),s(i,p),s(p,_),s(i,h),s(i,v),s(v,d),s(i,g),D&&D.m(i,null),w=!0},p(T,[E]){const F={};E&64&&(F.pct=T[6]),E&96&&(F.color=T[5](T[6],document.documentElement.classList.contains("dark"))),l.$set(F),(!w||E&4)&&J(u,T[2]),(!w||E&1)&&J(_,T[0]),(!w||E&2)&&J(d,T[1]),T[3]?D?D.p(T,E):(D=Za(T),D.c(),D.m(i,null)):D&&(D.d(1),D=null)},i(T){w||(R(l.$$.fragment,T),w=!0)},o(T){B(l.$$.fragment,T),w=!1},d(T){T&&S(e),oe(l),D&&D.d()}}}function vm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:c=""}=e,{subunit:a=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,c=_.sub),"subunit"in _&&l(4,a=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,c,a,f,p,i]}class o1 extends Re{constructor(e){super(),Le(this,e,vm,dm,Ee,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Ja(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function xa(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function eu(t,e,l){const n=t.slice();return n[15]=e[l],n}function tu(t){let e,l,n,i,o,u,c=t[0].title&&lu(t),a=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,n),i=ho(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&J(n,l)},d(o){o&&S(e),i()}}}function nu(t){let e,l,n,i=t[15].label+"",o,u,c,a;return{c(){e=De("g"),l=De("line"),n=De("text"),o=N(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",u=t[15].align=="right"?"85%":""),r(e,"class",c="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",a="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&J(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&r(n,"x",u),p&1&&c!==(c="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",c),p&129&&a!==(a="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",a)},d(f){f&&S(e)}}}function iu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&nu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function su(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ou(t);return{c(){e=De("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=ou(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&S(e),n&&n.d()}}}function ou(t){let e,l=t[11].label+"",n,i;return{c(){e=De("text"),n=N(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){M(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&J(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&S(e)}}}function ru(t){let e=!isNaN(t[6](t[13])),l,n=e&&su(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=su(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function au(t){let e,l,n=t[11].value!==void 0&&uu(t),i=t[11].value2>1e-4&&mu(t);return{c(){e=De("g"),n&&n.c(),l=De("g"),i&&i.c()},m(o,u){M(o,e,u),n&&n.m(e,null),M(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=uu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&S(e),n&&n.d(),o&&S(l),i&&i.d()}}}function uu(t){let e,l,n,i,o,u,c,a=t[3]>15&&fu(t);return{c(){e=De("rect"),a&&a.c(),c=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),p&1&&u!==(u=f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=fu(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function fu(t){let e,l=t[11].label+"",n,i,o,u,c,a,f=t[11].title&&cu(t);return{c(){e=De("text"),n=N(l),f&&f.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",c="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]p[7](0)-p[8]?p[11].color:"white")&&r(e,"fill",u),_&457&&c!==(c="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&_u(t);return{c(){e=De("rect"),a&&a.c(),c=Ve(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&128&&n!==(n=f[7](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=_u(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function _u(t){let e,l=t[11].label2+"",n,i,o,u,c,a=t[11].title2&&pu(t);return{c(){e=De("text"),n=N(l),a&&a.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=ho(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=tu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:pe,o:pe,d(i){i&&S(e),n&&n.d(),l()}}}let cn=30;function bm(t,e,l){let{config:n}=e,i,o,u,c,a,f,p,_=0;function h(){_=this.clientHeight,l(5,_)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-_);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,p=un.y.max?D=n.padding.bottom:wf||D<0?0:D})}},[n,i,o,u,f,_,c,a,p,h,v]}class pn extends Re{constructor(e){super(),Le(this,e,bm,hm,Ee,{config:0})}}function gm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,c={};function a(f){return{label:ke(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:P0(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(a(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(a(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(a(o))),l(0,c={title:"Voltage",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:f},points:p})}},[c,n,i,o,u]}class wm extends Re{constructor(e){super(),Le(this,e,km,gm,Ee,{u1:1,u2:2,u3:3,ds:4})}}function ym(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:c}=e,{i2e:a}=e,{i3:f}=e,{max:p}=e,_={};function h(v){return{label:ke(v)+"A",title:v.toFixed(1)+" A",value:isNaN(v)?0:v,color:Gc(v?v/p*100:0,document.documentElement.classList.contains("dark"))}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,c=v.i2),"i2e"in v&&l(6,a=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,p=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(h(u))),i>0&&(a?(v.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(v.push({label:"L2"}),d.push(h(c)))),o>0&&(v.push({label:"L3"}),d.push(h(f))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:p,ticks:[{value:0,label:"0%"},{value:p/4,label:"25%"},{value:p/2,label:"50%"},{value:p/4*3,label:"75%"},{value:p,label:"100%"}]},x:{ticks:v},points:d})}},[_,n,i,o,u,c,a,f,p]}class Sm extends Re{constructor(e){super(),Le(this,e,Cm,ym,Ee,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function Mm(t){let e,l,n,i,o,u,c,a=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,h,v,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,D,T,E,F,I,O,C=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",A,le,H,z,U,K,Q=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",G,X;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",u=b(),c=m("div"),f=N(a),p=N(" VAr"),_=b(),h=m("div"),h.textContent="Instant out",v=b(),d=m("div"),w=N(g),D=N(" VAr"),T=b(),E=m("div"),F=m("div"),F.textContent="Total in",I=b(),O=m("div"),A=N(C),le=N(" kVArh"),H=b(),z=m("div"),z.textContent="Total out",U=b(),K=m("div"),G=N(Q),X=N(" kVArh"),r(c,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(O,"class","text-right"),r(K,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(Y,j){M(Y,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,c),s(c,f),s(c,p),s(i,_),s(i,h),s(i,v),s(i,d),s(d,w),s(d,D),s(e,T),s(e,E),s(E,F),s(E,I),s(E,O),s(O,A),s(O,le),s(E,H),s(E,z),s(E,U),s(E,K),s(K,G),s(K,X)},p(Y,[j]){j&1&&a!==(a=(typeof Y[0]<"u"?Y[0].toFixed(0):"-")+"")&&J(f,a),j&2&&g!==(g=(typeof Y[1]<"u"?Y[1].toFixed(0):"-")+"")&&J(w,g),j&4&&C!==(C=(typeof Y[2]<"u"?Y[2].toFixed(1):"-")+"")&&J(A,C),j&8&&Q!==(Q=(typeof Y[3]<"u"?Y[3].toFixed(1):"-")+"")&&J(G,Q)},i:pe,o:pe,d(Y){Y&&S(e)}}}function Tm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=c=>{"importInstant"in c&&l(0,n=c.importInstant),"exportInstant"in c&&l(1,i=c.exportInstant),"importTotal"in c&&l(2,o=c.importTotal),"exportTotal"in c&&l(3,u=c.exportTotal)},[n,i,o,u]}class $m extends Re{constructor(e){super(),Le(this,e,Tm,Mm,Ee,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function vu(t){let e;function l(o,u){return o[3]?Em:Nm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&S(e)}}}function Nm(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,h,v,d=ke(t[1].d.u,1)+"",g,w,D,T,E,F,I=ke(t[1].m.u)+"",O,C,A,le,H,z,U=ke(t[0].last_month.u)+"",K,Q,G,X,Y=t[4]&&hu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),_=m("div"),_.textContent="Day",h=b(),v=m("div"),g=N(d),w=N(" kWh"),D=b(),T=m("div"),T.textContent="Month",E=b(),F=m("div"),O=N(I),C=N(" kWh"),A=b(),le=m("div"),le.textContent="Last month",H=b(),z=m("div"),K=N(U),Q=N(" kWh"),G=b(),Y&&Y.c(),X=Ve(),r(u,"class","text-right"),r(v,"class","text-right"),r(F,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(j,x){M(j,e,x),M(j,l,x),M(j,n,x),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),s(n,_),s(n,h),s(n,v),s(v,g),s(v,w),s(n,D),s(n,T),s(n,E),s(n,F),s(F,O),s(F,C),s(n,A),s(n,le),s(n,H),s(n,z),s(z,K),s(z,Q),M(j,G,x),Y&&Y.m(j,x),M(j,X,x)},p(j,x){x&2&&c!==(c=ke(j[1].h.u,2)+"")&&J(a,c),x&2&&d!==(d=ke(j[1].d.u,1)+"")&&J(g,d),x&2&&I!==(I=ke(j[1].m.u)+"")&&J(O,I),x&1&&U!==(U=ke(j[0].last_month.u)+"")&&J(K,U),j[4]?Y?Y.p(j,x):(Y=hu(j),Y.c(),Y.m(X.parentNode,X)):Y&&(Y.d(1),Y=null)},d(j){j&&S(e),j&&S(l),j&&S(n),j&&S(G),Y&&Y.d(j),j&&S(X)}}}function Em(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,h,v,d,g=ke(t[1].d.u,1)+"",w,D,T,E,F,I,O,C=ke(t[1].m.u)+"",A,le,H,z,U,K,Q,G=ke(t[0].last_month.u)+"",X,Y,j,x,ae,te,V,W,we,He,Ie,Se=ke(t[1].h.p,2)+"",ye,ve,$e,be,$,y,k,P=ke(t[1].d.p,1)+"",L,Z,ne,fe,de,Ce,Oe,ue=ke(t[1].m.p)+"",Te,Je,Ot,st,wt,nt,Ft,Qe=ke(t[0].last_month.p)+"",Zt,Gt,vt,xe,Ge=t[4]&&bu(t),Ke=t[4]&&gu(t),Ne=t[4]&&ku(t),Ze=t[4]&&wu(t),et=t[4]&&yu(t),qe=t[4]&&Cu(t),Fe=t[4]&&Su(t),_e=t[4]&&Mu(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),Ge&&Ge.c(),_=b(),h=m("div"),h.textContent="Day",v=b(),d=m("div"),w=N(g),D=N(" kWh"),T=b(),Ke&&Ke.c(),E=b(),F=m("div"),F.textContent="Month",I=b(),O=m("div"),A=N(C),le=N(" kWh"),H=b(),Ne&&Ne.c(),z=b(),U=m("div"),U.textContent="Last mo.",K=b(),Q=m("div"),X=N(G),Y=N(" kWh"),j=b(),Ze&&Ze.c(),ae=b(),te=m("strong"),te.textContent="Export",V=b(),W=m("div"),we=m("div"),we.textContent="Hour",He=b(),Ie=m("div"),ye=N(Se),ve=N(" kWh"),$e=b(),et&&et.c(),be=b(),$=m("div"),$.textContent="Day",y=b(),k=m("div"),L=N(P),Z=N(" kWh"),ne=b(),qe&&qe.c(),fe=b(),de=m("div"),de.textContent="Month",Ce=b(),Oe=m("div"),Te=N(ue),Je=N(" kWh"),Ot=b(),Fe&&Fe.c(),st=b(),wt=m("div"),wt.textContent="Last mo.",nt=b(),Ft=m("div"),Zt=N(Qe),Gt=N(" kWh"),vt=b(),_e&&_e.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(O,"class","text-right"),r(Q,"class","text-right"),r(n,"class",x="grid grid-cols-"+t[5]+" mb-3"),r(Ie,"class","text-right"),r(k,"class","text-right"),r(Oe,"class","text-right"),r(Ft,"class","text-right"),r(W,"class",xe="grid grid-cols-"+t[5])},m(ce,Be){M(ce,e,Be),M(ce,l,Be),M(ce,n,Be),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),Ge&&Ge.m(n,null),s(n,_),s(n,h),s(n,v),s(n,d),s(d,w),s(d,D),s(n,T),Ke&&Ke.m(n,null),s(n,E),s(n,F),s(n,I),s(n,O),s(O,A),s(O,le),s(n,H),Ne&&Ne.m(n,null),s(n,z),s(n,U),s(n,K),s(n,Q),s(Q,X),s(Q,Y),s(n,j),Ze&&Ze.m(n,null),M(ce,ae,Be),M(ce,te,Be),M(ce,V,Be),M(ce,W,Be),s(W,we),s(W,He),s(W,Ie),s(Ie,ye),s(Ie,ve),s(W,$e),et&&et.m(W,null),s(W,be),s(W,$),s(W,y),s(W,k),s(k,L),s(k,Z),s(W,ne),qe&&qe.m(W,null),s(W,fe),s(W,de),s(W,Ce),s(W,Oe),s(Oe,Te),s(Oe,Je),s(W,Ot),Fe&&Fe.m(W,null),s(W,st),s(W,wt),s(W,nt),s(W,Ft),s(Ft,Zt),s(Ft,Gt),s(W,vt),_e&&_e.m(W,null)},p(ce,Be){Be&2&&c!==(c=ke(ce[1].h.u,2)+"")&&J(a,c),ce[4]?Ge?Ge.p(ce,Be):(Ge=bu(ce),Ge.c(),Ge.m(n,_)):Ge&&(Ge.d(1),Ge=null),Be&2&&g!==(g=ke(ce[1].d.u,1)+"")&&J(w,g),ce[4]?Ke?Ke.p(ce,Be):(Ke=gu(ce),Ke.c(),Ke.m(n,E)):Ke&&(Ke.d(1),Ke=null),Be&2&&C!==(C=ke(ce[1].m.u)+"")&&J(A,C),ce[4]?Ne?Ne.p(ce,Be):(Ne=ku(ce),Ne.c(),Ne.m(n,z)):Ne&&(Ne.d(1),Ne=null),Be&1&&G!==(G=ke(ce[0].last_month.u)+"")&&J(X,G),ce[4]?Ze?Ze.p(ce,Be):(Ze=wu(ce),Ze.c(),Ze.m(n,null)):Ze&&(Ze.d(1),Ze=null),Be&32&&x!==(x="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",x),Be&2&&Se!==(Se=ke(ce[1].h.p,2)+"")&&J(ye,Se),ce[4]?et?et.p(ce,Be):(et=yu(ce),et.c(),et.m(W,be)):et&&(et.d(1),et=null),Be&2&&P!==(P=ke(ce[1].d.p,1)+"")&&J(L,P),ce[4]?qe?qe.p(ce,Be):(qe=Cu(ce),qe.c(),qe.m(W,fe)):qe&&(qe.d(1),qe=null),Be&2&&ue!==(ue=ke(ce[1].m.p)+"")&&J(Te,ue),ce[4]?Fe?Fe.p(ce,Be):(Fe=Su(ce),Fe.c(),Fe.m(W,st)):Fe&&(Fe.d(1),Fe=null),Be&1&&Qe!==(Qe=ke(ce[0].last_month.p)+"")&&J(Zt,Qe),ce[4]?_e?_e.p(ce,Be):(_e=Mu(ce),_e.c(),_e.m(W,null)):_e&&(_e.d(1),_e=null),Be&32&&xe!==(xe="grid grid-cols-"+ce[5])&&r(W,"class",xe)},d(ce){ce&&S(e),ce&&S(l),ce&&S(n),Ge&&Ge.d(),Ke&&Ke.d(),Ne&&Ne.d(),Ze&&Ze.d(),ce&&S(ae),ce&&S(te),ce&&S(V),ce&&S(W),et&&et.d(),qe&&qe.d(),Fe&&Fe.d(),_e&&_e.d()}}}function hu(t){let e,l,n,i,o,u,c=ke(t[1].h.c,2)+"",a,f,p,_,h,v,d,g=ke(t[1].d.c,1)+"",w,D,T,E,F,I,O,C=ke(t[1].m.c)+"",A,le,H,z,U,K,Q,G=ke(t[0].last_month.c)+"",X,Y,j;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=b(),p=N(t[2]),_=b(),h=m("div"),h.textContent="Day",v=b(),d=m("div"),w=N(g),D=b(),T=N(t[2]),E=b(),F=m("div"),F.textContent="Month",I=b(),O=m("div"),A=N(C),le=b(),H=N(t[2]),z=b(),U=m("div"),U.textContent="Last month",K=b(),Q=m("div"),X=N(G),Y=b(),j=N(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(O,"class","text-right"),r(Q,"class","text-right"),r(n,"class","grid grid-cols-2")},m(x,ae){M(x,e,ae),M(x,l,ae),M(x,n,ae),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(u,p),s(n,_),s(n,h),s(n,v),s(n,d),s(d,w),s(d,D),s(d,T),s(n,E),s(n,F),s(n,I),s(n,O),s(O,A),s(O,le),s(O,H),s(n,z),s(n,U),s(n,K),s(n,Q),s(Q,X),s(Q,Y),s(Q,j)},p(x,ae){ae&2&&c!==(c=ke(x[1].h.c,2)+"")&&J(a,c),ae&4&&J(p,x[2]),ae&2&&g!==(g=ke(x[1].d.c,1)+"")&&J(w,g),ae&4&&J(T,x[2]),ae&2&&C!==(C=ke(x[1].m.c)+"")&&J(A,C),ae&4&&J(H,x[2]),ae&1&&G!==(G=ke(x[0].last_month.c)+"")&&J(X,G),ae&4&&J(j,x[2])},d(x){x&&S(e),x&&S(l),x&&S(n)}}}function bu(t){let e,l=ke(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.c,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function gu(t){let e,l=ke(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.c,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function ku(t){let e,l=ke(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function wu(t){let e,l=ke(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function yu(t){let e,l=ke(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.i,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Cu(t){let e,l=ke(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.i,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Su(t){let e,l=ke(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Mu(t){let e,l=ke(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Am(t){let e,l,n,i,o,u,c=t[1]&&vu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),u=b(),c&&c.c(),r(e,"class","mx-2 text-sm")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),c&&c.m(e,null)},p(a,[f]){a[1]?c?c.p(a,f):(c=vu(a),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:pe,o:pe,d(a){a&&S(e),c&&c.d()}}}function Pm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,c=!1,a=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,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(5,a=c?3:2))},[n,i,o,u,c,a]}class Dm extends Re{constructor(e){super(),Le(this,e,Pm,Am,Ee,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Lm(t){let e,l,n=qa(t[0].source)+"",i,o,u,c,a;return c=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=N("Provided by: "),i=N(n),u=b(),re(c.$$.fragment),r(e,"href",o=Ba(t[0].source)),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,l),s(e,i),M(f,u,p),se(c,f,p),a=!0},p(f,[p]){(!a||p&1)&&n!==(n=qa(f[0].source)+"")&&J(i,n),(!a||p&1&&o!==(o=Ba(f[0].source)))&&r(e,"href",o);const _={};p&2&&(_.config=f[1]),c.$set(_)},i(f){a||(R(c.$$.fragment,f),a=!0)},o(f){B(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(u),oe(c,f)}}}function Rm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,c,a=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&l(0,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=n.currency,p=new Date().getUTCHours(),_=0,h=0,v=0,d=[],g=[],w=[];l(4,c=l(3,u=0));let D=new Date;for(vl(D,i.clock_offset-(24+D.getHours()-D.getUTCHours())%24),_=p;_<24&&(h=n[Ue(v++)],h!=null);_++)g.push({label:Ue(D.getHours())}),w.push(h*100),l(4,c=Math.min(c,h*100)),l(3,u=Math.max(u,h*100)),vl(D,1);for(_=0;_<24&&(h=n[Ue(v++)],h!=null);_++)g.push({label:Ue(D.getHours())}),w.push(h*100),l(4,c=Math.min(c,h*100)),l(3,u=Math.max(u,h*100)),vl(D,1);if(c>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(l(4,c*=100),l(3,u*=100),_=0;_=0?O.toFixed(C):"",title:O>=0?O.toFixed(2)+" "+f:"",value:h>=0?Math.abs(h):0,label2:O<0?O.toFixed(C):"",title2:O<0?O.toFixed(2)+" "+f:"",value2:h<0?Math.abs(h):0,color:a?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(c));if(c<0){l(4,c=Math.min(E/4*-1,c));let O=Math.ceil(Math.abs(c)/E*4),C=c/O;for(_=1;_{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];l(4,c=l(3,u=0));let v=vl(new Date,-24),d=new Date().getUTCHours();for(vl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),f=d;f<24;f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(v.getHours())}),h.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:E.toFixed(1),title2:E.toFixed(2)+" kWh",value2:E*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E*10)),l(3,u=Math.max(u,T*10)),vl(v,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];l(4,c=l(3,u=0));let v=new Date,d=new Date;for(vl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),vl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=v.getDate();f<=d.getDate();f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(f)}),h.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E)),l(3,u=Math.max(u,T))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,p=[],_=[],h=[];n.s&&n.s.forEach((g,w)=>{var D=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:D.slice(-4)}),h.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),l(3,c=Math.min(c,f)),l(2,u=Math.max(u,f))}),l(2,u=Math.ceil(u)),l(3,c=Math.floor(c));let v=u;c<0&&(v+=Math.abs(c));let d=v/4;for(a=0;a<5;a++)f=c+d*a,p.push({value:f,label:f.toFixed(1)});l(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:u,ticks:p},x:{ticks:_},points:h})}},[o,n,u,c]}class zm extends Re{constructor(e){super(),Le(this,e,Wm,Hm,Ee,{json:1})}}function Gm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}let Vm=0;function Km(t,e,l){let n=document.documentElement.classList.contains("dark"),i={},o=0,u;return e1.subscribe(c=>{l(2,u=c)}),xc(),t.$$.update=()=>{if(t.$$.dirty&6){let c=0,a=[],f=[],p=[];if(a.push({value:0,label:0}),u&&u.p)for(c=0;c0?Ue(_.d)+"."+Js[new Date().getMonth()]:"-"}),l(1,o=Math.max(o,_.v))}if(u&&u.t){for(c=0;c=o)break;a.push({value:_,label:_})}a.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(a.push({label:u.c.toFixed(0),color:"orange",value:u.c}),l(1,o=Math.max(o,u.c))),l(1,o=Math.ceil(o)),l(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Vm,max:o,ticks:a},x:{ticks:f},points:p})}},[i,o,u]}class Ym extends Re{constructor(e){super(),Le(this,e,Km,Gm,Ee,{})}}function Tu(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function $u(t,e,l){const n=t.slice();return n[23]=e[l],n}function Nu(t){let e,l,n,i,o,u=t[7],c=[];for(let p=0;pt[15].call(e))},m(f,p){M(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),a&&a.m(e,null),c=ho(e,t[15].bind(e))},p(f,[p]){p&1024&&J(i,f[10]),f[7]?a?a.p(f,p):(a=Nu(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:pe,o:pe,d(f){f&&S(e),a&&a.d(),c()}}}let Xm=12;function Zm(t,e,l){let n=document.documentElement.classList.contains("dark"),i;t1.subscribe(C=>{l(12,i=C)});let o,u=0,c=0;function a(){o&&clearTimeout(o),o=setTimeout(a,1e4),i.data.unshift(c),l(12,i.data=i.data.slice(0,i.size),i),u+=10}Vc.subscribe(C=>{u==0&&(o&&clearTimeout(o),o=setTimeout(a,1e4)),c=C.i-C.e,u=C.u});let f,p,_,h,v,d,g,w,D,T,E,F,I;function O(){_=this.clientWidth,h=this.clientHeight,l(0,_),l(1,h)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(l(2,v=parseInt(h)-50),l(3,d=_-35),l(9,F=d/i.size),l(14,p=0),l(13,f=0),i.data)){for(let A in i.data){let le=i.data[A];l(13,f=Math.max(Math.ceil(le/1e3)*1e3,f)),l(14,p=Math.min(Math.ceil(le/1e3)*1e3,p))}l(10,I=f>2500?"kW":"W"),l(7,T=[]);for(let A=p;A2500?(A/1e3).toFixed(1):A});l(8,E=[]);for(let A=p;A0||t[0].e>0}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function Uu(t){let e,l,n;return l=new Ym({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),se(l,e,null),n=!0},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function ju(t){let e,l,n;return l=new Jm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function Hu(t){let e,l,n;return l=new Im({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function Wu(t){let e,l,n;return l=new qm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function zu(t){let e,l,n;return l=new jm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function Gu(t){let e,l,n;return l=new zm({props:{json:t[5]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function xm(t){let e,l=Xe(t[1].ui.i,t[0].i),n,i=Xe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Xe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),c,a=Xe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Xe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=Xe(t[1].ui.c,t[0].ea),v,d=Xe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,w=Xe(t[1].ui.l),D,T=Xe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),E,F=Xe(t[1].ui.d,t[3]),I,O=Xe(t[1].ui.m,t[4]),C,A=Xe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),le,H=l&&Ru(t),z=i&&Iu(t),U=u&&Ou(t),K=a&&Fu(t),Q=p&&qu(t),G=h&&Bu(t),X=d&&Uu(),Y=w&&ju(),j=T&&Hu(t),x=F&&Wu(t),ae=O&&zu(t),te=A&&Gu(t);return{c(){e=m("div"),H&&H.c(),n=b(),z&&z.c(),o=b(),U&&U.c(),c=b(),K&&K.c(),f=b(),Q&&Q.c(),_=b(),G&&G.c(),v=b(),X&&X.c(),g=b(),Y&&Y.c(),D=b(),j&&j.c(),E=b(),x&&x.c(),I=b(),ae&&ae.c(),C=b(),te&&te.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(V,W){M(V,e,W),H&&H.m(e,null),s(e,n),z&&z.m(e,null),s(e,o),U&&U.m(e,null),s(e,c),K&&K.m(e,null),s(e,f),Q&&Q.m(e,null),s(e,_),G&&G.m(e,null),s(e,v),X&&X.m(e,null),s(e,g),Y&&Y.m(e,null),s(e,D),j&&j.m(e,null),s(e,E),x&&x.m(e,null),s(e,I),ae&&ae.m(e,null),s(e,C),te&&te.m(e,null),le=!0},p(V,[W]){W&3&&(l=Xe(V[1].ui.i,V[0].i)),l?H?(H.p(V,W),W&3&&R(H,1)):(H=Ru(V),H.c(),R(H,1),H.m(e,n)):H&&(Ae(),B(H,1,1,()=>{H=null}),Pe()),W&3&&(i=Xe(V[1].ui.e,V[0].om||V[0].e>0)),i?z?(z.p(V,W),W&3&&R(z,1)):(z=Iu(V),z.c(),R(z,1),z.m(e,o)):z&&(Ae(),B(z,1,1,()=>{z=null}),Pe()),W&3&&(u=Xe(V[1].ui.v,V[0].u1>100||V[0].u2>100||V[0].u3>100)),u?U?(U.p(V,W),W&3&&R(U,1)):(U=Ou(V),U.c(),R(U,1),U.m(e,c)):U&&(Ae(),B(U,1,1,()=>{U=null}),Pe()),W&3&&(a=Xe(V[1].ui.a,V[0].i1>.01||V[0].i2>.01||V[0].i3>.01)),a?K?(K.p(V,W),W&3&&R(K,1)):(K=Fu(V),K.c(),R(K,1),K.m(e,f)):K&&(Ae(),B(K,1,1,()=>{K=null}),Pe()),W&3&&(p=Xe(V[1].ui.r,V[0].ri>0||V[0].re>0||V[0].ric>0||V[0].rec>0)),p?Q?(Q.p(V,W),W&3&&R(Q,1)):(Q=qu(V),Q.c(),R(Q,1),Q.m(e,_)):Q&&(Ae(),B(Q,1,1,()=>{Q=null}),Pe()),W&3&&(h=Xe(V[1].ui.c,V[0].ea)),h?G?(G.p(V,W),W&3&&R(G,1)):(G=Bu(V),G.c(),R(G,1),G.m(e,v)):G&&(Ae(),B(G,1,1,()=>{G=null}),Pe()),W&3&&(d=Xe(V[1].ui.t,V[0].pr&&(V[0].pr.startsWith("10YNO")||V[0].pr.startsWith("10Y1001A1001A4")))),d?X?W&3&&R(X,1):(X=Uu(),X.c(),R(X,1),X.m(e,g)):X&&(Ae(),B(X,1,1,()=>{X=null}),Pe()),W&2&&(w=Xe(V[1].ui.l)),w?Y?W&2&&R(Y,1):(Y=ju(),Y.c(),R(Y,1),Y.m(e,D)):Y&&(Ae(),B(Y,1,1,()=>{Y=null}),Pe()),W&3&&(T=Xe(V[1].ui.p,V[0].pe&&!Number.isNaN(V[0].p))),T?j?(j.p(V,W),W&3&&R(j,1)):(j=Hu(V),j.c(),R(j,1),j.m(e,E)):j&&(Ae(),B(j,1,1,()=>{j=null}),Pe()),W&10&&(F=Xe(V[1].ui.d,V[3])),F?x?(x.p(V,W),W&10&&R(x,1)):(x=Wu(V),x.c(),R(x,1),x.m(e,I)):x&&(Ae(),B(x,1,1,()=>{x=null}),Pe()),W&18&&(O=Xe(V[1].ui.m,V[4])),O?ae?(ae.p(V,W),W&18&&R(ae,1)):(ae=zu(V),ae.c(),R(ae,1),ae.m(e,C)):ae&&(Ae(),B(ae,1,1,()=>{ae=null}),Pe()),W&35&&(A=Xe(V[1].ui.s,V[0].t&&V[0].t!=-127&&V[5].c>1)),A?te?(te.p(V,W),W&35&&R(te,1)):(te=Gu(V),te.c(),R(te,1),te.m(e,null)):te&&(Ae(),B(te,1,1,()=>{te=null}),Pe())},i(V){le||(R(H),R(z),R(U),R(K),R(Q),R(G),R(X),R(Y),R(j),R(x),R(ae),R(te),le=!0)},o(V){B(H),B(z),B(U),B(K),B(Q),B(G),B(X),B(Y),B(j),B(x),B(ae),B(te),le=!1},d(V){V&&S(e),H&&H.d(),z&&z.d(),U&&U.d(),K&&K.d(),Q&&Q.d(),G&&G.d(),X&&X.d(),Y&&Y.d(),j&&j.d(),x&&x.d(),ae&&ae.d(),te&&te.d()}}}function e_(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},c={},a={};return Co.subscribe(f=>{l(2,o=f)}),Qc.subscribe(f=>{l(3,u=f)}),Xc.subscribe(f=>{l(4,c=f)}),Jc.subscribe(f=>{l(5,a=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,c,a]}class t_ extends Re{constructor(e){super(),Le(this,e,e_,xm,Ee,{data:0,sysinfo:1})}}let oo={};const wi=it(oo);async function l_(){oo=await(await fetch("configuration.json")).json(),wi.set(oo)}let ro={};const r1=it(ro);async function n_(){ro=await(await fetch("priceconfig.json")).json(),r1.set(ro)}function Vu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function i_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function s_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Ku(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Yu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&S(e),i&&S(l),i&&S(n)}}}function Qu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Xu(t){let e,l,n;return{c(){e=m("option"),l=N("GPIO"),n=N(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&S(e)}}}function Zu(t){let e,l=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&S(e)}}}function o_(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?s_:i_}let c=u(t),a=c(t),f=t[0]=="esp8266"&&Ku(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Yu(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Qu(),h={length:t[1]+1},v=[];for(let d=0;d{"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=19);break}},[n,i]}class ao extends Re{constructor(e){super(),Le(this,e,r_,o_,Ee,{chip:0})}}function Ju(t){let e,l,n=t[1]&&xu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&S(e),n&&n.d()}}}function xu(t){let e,l;return{c(){e=m("div"),l=N(t[1]),r(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){M(n,e,i),s(e,l)},p(n,i){i&2&&J(l,n[1])},d(n){n&&S(e)}}}function a_(t){let e,l=t[0]&&Ju(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ju(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function u_(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 kt extends Re{constructor(e){super(),Le(this,e,u_,a_,Ee,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=N("Europe/"),i=N(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,l),s(e,i)},p:pe,d(o){o&&S(e)}}}function f_(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,P=0;P0;y--)P[y]=P[y]?P[y-1]^I.EXPONENT[A._modN(I.LOG[P[y]]+$)]:P[y-1];P[0]=I.EXPONENT[A._modN(I.LOG[P[0]]+$)]}for($=0;$<=k;$++)P[$]=I.LOG[P[$]]},_checkBadness:function(){var $,y,k,P,L,Z=0,ne=this._badness,fe=this.buffer,de=this.width;for(L=0;Lde*de;)ue-=de*de,Oe++;for(Z+=Oe*A.N4,P=0;P=ne-2&&($=ne-2,L>9&&$--);var fe=$;if(L>9){for(Z[fe+2]=0,Z[fe+3]=0;fe--;)y=Z[fe],Z[fe+3]|=255&y<<4,Z[fe+2]=y>>4;Z[2]|=255&$<<4,Z[1]=$>>4,Z[0]=64|$>>12}else{for(Z[fe+1]=0,Z[fe+2]=0;fe--;)y=Z[fe],Z[fe+2]|=255&y<<4,Z[fe+1]=y>>4;Z[1]|=255&$<<4,Z[0]=64|$>>4}for(fe=$+3-(L<10);fe=5&&(k+=A.N1+P[y]-5);for(y=3;y<$-1;y+=2)P[y-2]===P[y+2]&&P[y+2]===P[y-1]&&P[y-1]===P[y+1]&&P[y-1]*3===P[y]&&(P[y-3]===0||y+3>$||P[y-3]*3>=P[y]*4||P[y+3]*3>=P[y]*4)&&(k+=A.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var $,y,k=0,P=3e4;for(y=0;y<8&&(this._applyMask(y),$=this._checkBadness(),$>=1)P&1&&(L[Z-1-y+Z*8]=1,y<6?L[8+Z*y]=1:L[8+Z*(y+1)]=1);for(y=0;y<7;y++,P>>=1)P&1&&(L[8+Z*(Z-7+y)]=1,y?L[6-y+Z*8]=1:L[7+Z*8]=1)},_interleaveBlocks:function(){var $,y,k=this._dataBlock,P=this._ecc,L=this._eccBlock,Z=0,ne=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,Ce=this._stringBuffer;for($=0;$1)for($=D.BLOCK[P],k=L-7;;){for(y=L-7;y>$-3&&(this._addAlignment(y,k),!(y<$));)y-=$;if(k<=$+9)break;k-=$,this._addAlignment(6,k),this._addAlignment(k,6)}},_insertFinders:function(){var $,y,k,P,L=this.buffer,Z=this.width;for($=0;$<3;$++){for(y=0,P=0,$===1&&(y=Z-7),$===2&&(P=Z-7),L[P+3+Z*(y+3)]=1,k=0;k<6;k++)L[P+k+Z*y]=1,L[P+Z*(y+k+1)]=1,L[P+6+Z*(y+k)]=1,L[P+k+1+Z*(y+6)]=1;for(k=1;k<5;k++)this._setMask(P+k,y+1),this._setMask(P+1,y+k+1),this._setMask(P+5,y+k),this._setMask(P+k+1,y+5);for(k=2;k<4;k++)L[P+k+Z*(y+2)]=1,L[P+2+Z*(y+k+1)]=1,L[P+4+Z*(y+k)]=1,L[P+k+1+Z*(y+4)]=1}},_insertTimingGap:function(){var $,y,k=this.width;for(y=0;y<7;y++)this._setMask(7,y),this._setMask(k-8,y),this._setMask(7,y+k-7);for($=0;$<8;$++)this._setMask($,7),this._setMask($+k-8,7),this._setMask($,k-8)},_insertTimingRowAndColumn:function(){var $,y=this.buffer,k=this.width;for($=0;$6)for($=C.BLOCK[Z-7],y=17,k=0;k<6;k++)for(P=0;P<3;P++,y--)1&(y>11?Z>>y-12:$>>y)?(L[5-k+ne*(2-P+ne-11)]=1,L[2-P+ne-11+ne*(5-k)]=1):(this._setMask(5-k,2-P+ne-11),this._setMask(2-P+ne-11,5-k))},_isMasked:function($,y){var k=A._getMaskBit($,y);return this._mask[k]===1},_pack:function(){var $,y,k,P=1,L=1,Z=this.width,ne=Z-1,fe=Z-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(y=0;yy&&(k=$,$=y,y=k),k=y,k+=y*y,k>>=1,k+=$,k},_modN:function($){for(;$>=255;)$-=255,$=($>>8)+($&255);return $},N1:3,N2:3,N3:40,N4:10}),le=A,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),z=H,U=_.extend(function($,y,k,P){this.name=$,this.modifiable=Boolean(y),this.defaultValue=k,this._valueTransformer=P},{transform:function($){var y=this._valueTransformer;return typeof y=="function"?y($,this):$}}),K=U,Q=_.extend(null,{abs:function($){return $!=null?Math.abs($):null},hasOwn:function($,y){return Object.prototype.hasOwnProperty.call($,y)},noop:function(){},toUpperCase:function($){return $!=null?$.toUpperCase():null}}),G=Q,X=_.extend(function($){this.options={},$.forEach(function(y){this.options[y.name]=y},this)},{exists:function($){return this.options[$]!=null},get:function($,y){return X._get(this.options[$],y)},getAll:function($){var y,k=this.options,P={};for(y in k)G.hasOwn(k,y)&&(P[y]=X._get(k[y],$));return P},init:function($,y,k){typeof k!="function"&&(k=G.noop);var P,L;for(P in this.options)G.hasOwn(this.options,P)&&(L=this.options[P],X._set(L,L.defaultValue,y),X._createAccessor(L,y,k));this._setAll($,y,!0)},set:function($,y,k){return this._set($,y,k)},setAll:function($,y){return this._setAll($,y)},_set:function($,y,k,P){var L=this.options[$];if(!L)throw new Error("Invalid option: "+$);if(!L.modifiable&&!P)throw new Error("Option cannot be modified: "+$);return X._set(L,y,k)},_setAll:function($,y,k){if(!$)return!1;var P,L=!1;for(P in $)G.hasOwn($,P)&&this._set(P,$[P],y,k)&&(L=!0);return L}},{_createAccessor:function($,y,k){var P={get:function(){return X._get($,y)}};$.modifiable&&(P.set=function(L){X._set($,L,y)&&k(L,$)}),Object.defineProperty(y,$.name,P)},_get:function($,y){return y["_"+$.name]},_set:function($,y,k){var P="_"+$.name,L=k[P],Z=$.transform(y!=null?y:$.defaultValue);return k[P]=Z,Z!==L}}),Y=X,j=_.extend(function(){this._services={}},{getService:function($){var y=this._services[$];if(!y)throw new Error("Service is not being managed with name: "+$);return y},setService:function($,y){if(this._services[$])throw new Error("Service is already managed with name: "+$);y&&(this._services[$]=y)}}),x=j,ae=new Y([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,G.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,G.abs),new K("level",!0,"L",G.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,G.abs),new K("size",!0,100,G.abs),new K("value",!0,"")]),te=new x,V=_.extend(function($){ae.init($,this,this.update.bind(this));var y=ae.get("element",this),k=te.getService("element"),P=y&&k.isCanvas(y)?y:k.createCanvas(),L=y&&k.isImage(y)?y:k.createImage();this._canvasRenderer=new g(this,P,!0),this._imageRenderer=new z(this,L,L===y),this.update()},{get:function(){return ae.getAll(this)},set:function($){ae.setAll($,this)&&this.update()},toDataURL:function($){return this.canvas.toDataURL($||this.mime)},update:function(){var $=new le({level:this.level,value:this.value});this._canvasRenderer.render($),this._imageRenderer.render($)}},{use:function($){te.setService($.getName(),$)}});Object.defineProperties(V.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var W=V,we=W,He=_.extend({getName:function(){}}),Ie=He,Se=Ie.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function($){},isImage:function($){}}),ye=Se,ve=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function($){return $ instanceof HTMLCanvasElement},isImage:function($){return $ instanceof HTMLImageElement}}),$e=ve;we.use(new $e);var be=we;return be})})(u1);const v_=u1.exports;function h_(t){let e,l;return{c(){e=m("img"),ds(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!ds(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:pe,o:pe,d(n){n&&S(e)}}}function b_(t,e,l){const n=new v_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:c="200"}=e,{value:a=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function h(){n.set({background:o,foreground:u,level:i,padding:f,size:c,value:a}),l(2,_=n.toDataURL("image/jpeg"))}return dc(()=>{h()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,c=v.size),"value"in v&&l(0,a=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&a&&h()},[a,p,_,i,o,u,c,f]}class g_ extends Re{constructor(e){super(),Le(this,e,b_,h_,Ee,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function lf(t,e,l){const n=t.slice();return n[103]=e[l],n[104]=e,n[105]=l,n}function nf(t,e,l){const n=t.slice();return n[106]=e[l],n[107]=e,n[108]=l,n}function k_(t,e,l){const n=t.slice();return n[109]=e[l],n}function w_(t,e,l){const n=t.slice();return n[112]=e[l],n}function y_(t){let e,l;return{c(){e=m("option"),l=N(t[112]),e.__value=t[112],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:pe,d(n){n&&S(e)}}}function C_(t){let e;return{c(){e=N("Configure price")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,l,u),ie(l,t[3].p.t),n||(i=ee(l,"input",t[21]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ie(l,o[3].p.t)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;return{c(){e=m("div"),l=N("Username"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(o,"maxlength","36"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(_,"maxlength","36"),r(c,"class","my-1")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].g.u),M(d,u,g),M(d,c,g),s(c,a),s(c,f),s(c,p),s(c,_),ie(_,t[3].g.p),h||(v=[ee(o,"input",t[23]),ee(_,"input",t[24])],h=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ie(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ie(_,d[3].g.p)},d(d){d&&S(e),d&&S(u),d&&S(c),h=!1,ze(v)}}}function S_(t){let e,l=t[109]*100+"",n;return{c(){e=m("option"),n=N(l),e.__value=t[109]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:pe,d(i){i&&S(e)}}}function rf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){M(o,e,u),M(o,l,u),ie(l,t[3].m.e.k),n||(i=ee(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ie(l,o[3].m.e.k)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function af(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].m.e.a),u||(c=ee(o,"input",t[36]),u=!0)},p(a,f){f[0]&8&&o.value!==a[3].m.e.a&&ie(o,a[3].m.e.a)},d(a){a&&S(e),u=!1,c()}}}function uf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H;return{c(){e=m("div"),l=m("div"),n=N("Watt"),i=m("br"),o=b(),u=m("input"),c=b(),a=m("div"),f=N("Volt"),p=m("br"),_=b(),h=m("input"),v=b(),d=m("div"),g=N("Amp"),w=m("br"),D=b(),T=m("input"),E=b(),F=m("div"),I=N("kWh"),O=m("br"),C=b(),A=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(h,"name","mmv"),r(h,"type","number"),r(h,"min","0.00"),r(h,"max","1000"),r(h,"step","0.001"),r(h,"class","in-m tr w-full"),r(a,"class","w-1/4"),r(T,"name","mma"),r(T,"type","number"),r(T,"min","0.00"),r(T,"max","1000"),r(T,"step","0.001"),r(T,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(A,"name","mmc"),r(A,"type","number"),r(A,"min","0.00"),r(A,"max","1000"),r(A,"step","0.001"),r(A,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(z,U){M(z,e,U),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ie(u,t[3].m.m.w),s(e,c),s(e,a),s(a,f),s(a,p),s(a,_),s(a,h),ie(h,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),ie(T,t[3].m.m.a),s(e,E),s(e,F),s(F,I),s(F,O),s(F,C),s(F,A),ie(A,t[3].m.m.c),le||(H=[ee(u,"input",t[38]),ee(h,"input",t[39]),ee(T,"input",t[40]),ee(A,"input",t[41])],le=!0)},p(z,U){U[0]&8&&ge(u.value)!==z[3].m.m.w&&ie(u,z[3].m.m.w),U[0]&8&&ge(h.value)!==z[3].m.m.v&&ie(h,z[3].m.m.v),U[0]&8&&ge(T.value)!==z[3].m.m.a&&ie(T,z[3].m.m.a),U[0]&8&&ge(A.value)!==z[3].m.m.c&&ie(A,z[3].m.m.c)},d(z){z&&S(e),le=!1,ze(H)}}}function ff(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function cf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),h=b(),v=m("div"),d=m("div"),g=N("Power saving"),w=m("br"),D=b(),T=m("select"),E=m("option"),E.textContent="Default",F=m("option"),F.textContent="Off",I=m("option"),I.textContent="Minimum",O=m("option"),O.textContent="Maximum",C=b(),A=m("div"),le=N("Power"),H=m("br"),z=b(),U=m("div"),K=m("input"),Q=b(),G=m("span"),G.textContent="dBm",X=b(),Y=m("div"),j=m("label"),x=m("input"),ae=N(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(c,"class","my-1"),E.__value=255,E.value=E.__value,F.__value=0,F.value=F.__value,I.__value=1,I.value=I.__value,O.__value=2,O.value=O.__value,r(T,"name","wz"),r(T,"class","in-s"),t[3].w.z===void 0&&We(()=>t[45].call(T)),r(d,"class","w-1/2"),r(K,"name","ww"),r(K,"type","number"),r(K,"min","0"),r(K,"max","20.5"),r(K,"step","0.5"),r(K,"class","in-f tr w-full"),r(G,"class","in-post"),r(U,"class","flex"),r(A,"class","ml-2 w-1/2"),r(v,"class","my-1 flex"),r(x,"type","checkbox"),r(x,"name","wb"),x.__value="true",x.value=x.__value,r(x,"class","rounded mb-1"),r(Y,"class","my-3")},m(W,we){M(W,e,we),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].w.s),M(W,u,we),M(W,c,we),s(c,a),s(c,f),s(c,p),s(c,_),ie(_,t[3].w.p),M(W,h,we),M(W,v,we),s(v,d),s(d,g),s(d,w),s(d,D),s(d,T),s(T,E),s(T,F),s(T,I),s(T,O),Me(T,t[3].w.z,!0),s(v,C),s(v,A),s(A,le),s(A,H),s(A,z),s(A,U),s(U,K),ie(K,t[3].w.w),s(U,Q),s(U,G),M(W,X,we),M(W,Y,we),s(Y,j),s(j,x),x.checked=t[3].w.b,s(j,ae),te||(V=[ee(o,"input",t[43]),ee(_,"input",t[44]),ee(T,"change",t[45]),ee(K,"input",t[46]),ee(x,"change",t[47])],te=!0)},p(W,we){we[0]&8&&o.value!==W[3].w.s&&ie(o,W[3].w.s),we[0]&8&&_.value!==W[3].w.p&&ie(_,W[3].w.p),we[0]&8&&Me(T,W[3].w.z),we[0]&8&&ge(K.value)!==W[3].w.w&&ie(K,W[3].w.w),we[0]&8&&(x.checked=W[3].w.b)},d(W){W&&S(e),W&&S(u),W&&S(c),W&&S(h),W&&S(v),W&&S(X),W&&S(Y),te=!1,ze(V)}}}function mf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w;return{c(){e=m("div"),l=N("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("DNS"),f=m("br"),p=b(),_=m("div"),h=m("input"),v=b(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(h,"name","nd1"),r(h,"type","text"),r(h,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(c,"class","my-1")},m(D,T){M(D,e,T),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].n.g),M(D,u,T),M(D,c,T),s(c,a),s(c,f),s(c,p),s(c,_),s(_,h),ie(h,t[3].n.d1),s(_,v),s(_,d),ie(d,t[3].n.d2),g||(w=[ee(o,"input",t[51]),ee(h,"input",t[52]),ee(d,"input",t[53])],g=!0)},p(D,T){T[0]&8&&o.value!==D[3].n.g&&ie(o,D[3].n.g),T[0]&8&&h.value!==D[3].n.d1&&ie(h,D[3].n.d1),T[0]&8&&d.value!==D[3].n.d2&&ie(d,D[3].n.d2)},d(D){D&&S(e),D&&S(u),D&&S(c),g=!1,ze(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=N(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,c){M(u,e,c),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[57]),ee(l,"change",t[14])],i=!0)},p(u,c){c[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&S(e),i=!1,ze(o)}}}function pf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;const d=[T_,M_],g=[];function w(C,A){return C[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const D=[A_,E_],T=[];function E(C,A){return C[3].q.s.r?0:1}c=E(t),a=T[c]=D[c](t);const F=[R_,L_],I=[];function O(C,A){return C[3].q.s.k?0:1}return _=O(t),h=I[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),a.c(),f=b(),p=m("span"),h.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(C,A){M(C,e,A),s(e,l),g[n].m(l,null),s(e,o),s(e,u),T[c].m(u,null),s(e,f),s(e,p),I[_].m(p,null),v=!0},p(C,A){let le=n;n=w(C),n===le?g[n].p(C,A):(Ae(),B(g[le],1,1,()=>{g[le]=null}),Pe(),i=g[n],i?i.p(C,A):(i=g[n]=d[n](C),i.c()),R(i,1),i.m(l,null));let H=c;c=E(C),c===H?T[c].p(C,A):(Ae(),B(T[H],1,1,()=>{T[H]=null}),Pe(),a=T[c],a?a.p(C,A):(a=T[c]=D[c](C),a.c()),R(a,1),a.m(u,null));let z=_;_=O(C),_===z?I[_].p(C,A):(Ae(),B(I[z],1,1,()=>{I[z]=null}),Pe(),h=I[_],h?h.p(C,A):(h=I[_]=F[_](C),h.c()),R(h,1),h.m(p,null))},i(C){v||(R(i),R(a),R(h),v=!0)},o(C){B(i),B(a),B(h),v=!1},d(C){C&&S(e),g[n].d(),T[c].d(),I[_].d()}}}function M_(t){let e,l;return e=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[$_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function T_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[N_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function $_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function N_(t){let e;return{c(){e=N("CA OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function E_(t){let e,l;return e=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[P_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function A_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[D_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function P_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function D_(t){let e;return{c(){e=N("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function L_(t){let e,l;return e=new Xt({props:{to:"/mqtt-key",$$slots:{default:[I_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function R_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-key",$$slots:{default:[O_]},$$scope:{ctx:t}}}),o=new Cs({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),se(l,e,null),M(f,n,p),M(f,i,p),se(o,i,null),u=!0,c||(a=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],c=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(R(l.$$.fragment,f),R(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&S(e),oe(l),f&&S(n),f&&S(i),oe(o),c=!1,ze(a)}}}function I_(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function O_(t){let e;return{c(){e=N("Key OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function df(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("div"),_=N("Electricity IDX"),h=m("br"),v=b(),d=m("input"),g=b(),w=m("div"),D=N("Current IDX"),T=m("br"),E=b(),F=m("input"),I=b(),O=m("div"),C=N(`Voltage IDX: L1, L2 & L3 - `),A=m("div"),le=m("input"),H=b(),z=m("input"),U=b(),K=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","o"),c.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(le,"name","ou1"),r(le,"type","text"),r(le,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(K,"name","ou3"),r(K,"type","text"),r(K,"class","in-l tr w-1/3"),r(A,"class","flex"),r(O,"class","my-1"),r(e,"class","cnt")},m(Y,j){M(Y,e,j),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),ie(d,t[3].o.e),s(f,g),s(f,w),s(w,D),s(w,T),s(w,E),s(w,F),ie(F,t[3].o.c),s(e,I),s(e,O),s(O,C),s(O,A),s(A,le),ie(le,t[3].o.u1),s(A,H),s(A,z),ie(z,t[3].o.u2),s(A,U),s(A,K),ie(K,t[3].o.u3),Q=!0,G||(X=[ee(d,"input",t[65]),ee(F,"input",t[66]),ee(le,"input",t[67]),ee(z,"input",t[68]),ee(K,"input",t[69])],G=!0)},p(Y,j){j[0]&8&&d.value!==Y[3].o.e&&ie(d,Y[3].o.e),j[0]&8&&F.value!==Y[3].o.c&&ie(F,Y[3].o.c),j[0]&8&&le.value!==Y[3].o.u1&&ie(le,Y[3].o.u1),j[0]&8&&z.value!==Y[3].o.u2&&ie(z,Y[3].o.u2),j[0]&8&&K.value!==Y[3].o.u3&&ie(K,Y[3].o.u3)},i(Y){Q||(R(o.$$.fragment,Y),Q=!0)},o(Y){B(o.$$.fragment,Y),Q=!1},d(Y){Y&&S(e),oe(o),G=!1,ze(X)}}}function vf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=N("Discovery topic prefix"),_=m("br"),h=b(),v=m("input"),d=b(),g=m("div"),w=N("Hostname for URL"),D=m("br"),T=b(),E=m("input"),I=b(),O=m("div"),C=N("Name tag"),A=m("br"),le=b(),H=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","h"),c.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(H,"name","hn"),r(H,"type","text"),r(H,"class","in-s"),r(O,"class","my-1"),r(e,"class","cnt")},m(Q,G){M(Q,e,G),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),s(f,h),s(f,v),ie(v,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,D),s(g,T),s(g,E),ie(E,t[3].h.h),s(e,I),s(e,O),s(O,C),s(O,A),s(O,le),s(O,H),ie(H,t[3].h.n),z=!0,U||(K=[ee(v,"input",t[70]),ee(E,"input",t[71]),ee(H,"input",t[72])],U=!0)},p(Q,G){G[0]&8&&v.value!==Q[3].h.t&&ie(v,Q[3].h.t),(!z||G[0]&8&&F!==(F=Q[3].g.h+".local"))&&r(E,"placeholder",F),G[0]&8&&E.value!==Q[3].h.h&&ie(E,Q[3].h.h),G[0]&8&&H.value!==Q[3].h.n&&ie(H,Q[3].h.n)},i(Q){z||(R(o.$$.fragment,Q),z=!0)},o(Q){B(o.$$.fragment,Q),z=!1},d(Q){Q&&S(e),oe(o),U=!1,ze(K)}}}function hf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae;o=new Rt({});let te=t[3].c.es&&bf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),re(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("label"),_=m("input"),h=N(" Enable cloud upload"),v=b(),d=m("div"),g=N("Client ID"),w=m("br"),D=b(),T=m("input"),I=b(),O=m("div"),C=N("Client secret"),A=m("br"),le=b(),H=m("input"),U=b(),K=m("div"),Q=m("label"),G=m("input"),X=N(" Energy Speedometer"),Y=b(),te&&te.c(),r(l,"class","text-sm"),r(i,"href",It("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","c"),c.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(T,"name","ci"),r(T,"type","text"),r(T,"class","in-s"),r(T,"pattern",E=t[3].c.e?"[A-Z0-9]{16}":".*"),T.required=F=t[3].c.e,r(d,"class","my-1"),r(H,"name","cs"),r(H,"type","text"),r(H,"class","in-s"),r(H,"pattern",z=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(O,"class","my-1"),r(G,"type","checkbox"),r(G,"class","rounded mb-1"),r(G,"name","ces"),G.__value="true",G.value=G.__value,r(K,"class","my-1"),r(e,"class","cnt")},m(V,W){M(V,e,W),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,v),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),ie(T,t[3].c.i),s(e,I),s(e,O),s(O,C),s(O,A),s(O,le),s(O,H),ie(H,t[3].c.s),s(e,U),s(e,K),s(K,Q),s(Q,G),G.checked=t[3].c.es,s(Q,X),s(K,Y),te&&te.m(K,null),j=!0,x||(ae=[ee(_,"change",t[73]),ee(T,"input",t[74]),ee(H,"input",t[75]),ee(G,"change",t[76])],x=!0)},p(V,W){W[0]&8&&(_.checked=V[3].c.e),(!j||W[0]&8&&E!==(E=V[3].c.e?"[A-Z0-9]{16}":".*"))&&r(T,"pattern",E),(!j||W[0]&8&&F!==(F=V[3].c.e))&&(T.required=F),W[0]&8&&T.value!==V[3].c.i&&ie(T,V[3].c.i),(!j||W[0]&8&&z!==(z=V[3].c.e&&V[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(H,"pattern",z),W[0]&8&&H.value!==V[3].c.s&&ie(H,V[3].c.s),W[0]&8&&(G.checked=V[3].c.es),V[3].c.es?te?(te.p(V,W),W[0]&8&&R(te,1)):(te=bf(V),te.c(),R(te,1),te.m(K,null)):te&&(Ae(),B(te,1,1,()=>{te=null}),Pe())},i(V){j||(R(o.$$.fragment,V),R(te),j=!0)},o(V){B(o.$$.fragment,V),B(te),j=!1},d(V){V&&S(e),oe(o),te&&te.d(),x=!1,ze(ae)}}}function bf(t){let e,l,n=t[0].mac+"",i,o,u,c,a=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,h,v=t[0].mac&&t[0].meter.id&&gf(t);return{c(){e=m("div"),l=N("MAC: "),i=N(n),o=b(),u=m("div"),c=N("Meter ID: "),f=N(a),p=b(),v&&v.c(),_=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,l),s(e,i),M(d,o,g),M(d,u,g),s(u,c),s(u,f),M(d,p,g),v&&v.m(d,g),M(d,_,g),h=!0},p(d,g){(!h||g[0]&1)&&n!==(n=d[0].mac+"")&&J(i,n),(!h||g[0]&1)&&a!==(a=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&J(f,a),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&R(v,1)):(v=gf(d),v.c(),R(v,1),v.m(_.parentNode,_)):v&&(Ae(),B(v,1,1,()=>{v=null}),Pe())},i(d){h||(R(v),h=!0)},o(d){B(v),h=!1},d(d){d&&S(e),d&&S(o),d&&S(u),d&&S(p),v&&v.d(d),d&&S(_)}}}function gf(t){let e,l,n;return l=new g_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(R(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&S(e),oe(l)}}}function kf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E;o=new Rt({});let F={length:9},I=[];for(let O=0;O20&&Sf(t),_=t[3].i.d.d>0&&$f(t),h=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),re(o.$$.fragment),u=b(),p&&p.c(),c=b(),_&&_.c(),a=b(),h&&h.c(),r(l,"class","text-sm"),r(i,"href",It("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,c),_&&_.m(e,null),s(e,a),h&&h.m(e,null),f=!0},p(v,d){v[0].board>20?p?(p.p(v,d),d[0]&1&&R(p,1)):(p=Sf(v),p.c(),R(p,1),p.m(e,c)):p&&(Ae(),B(p,1,1,()=>{p=null}),Pe()),v[3].i.d.d>0?_?_.p(v,d):(_=$f(v),_.c(),_.m(e,a)):_&&(_.d(1),_=null),v[0].chip=="esp8266"?h?h.p(v,d):(h=Nf(v),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(v){f||(R(o.$$.fragment,v),R(p),f=!0)},o(v){B(o.$$.fragment,v),B(p),f=!1},d(v){v&&S(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function Sf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et;f=new ao({props:{chip:t[0].chip}}),w=new ao({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&Mf(t),Fe=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("HAN RX"),u=m("br"),c=b(),a=m("select"),re(f.$$.fragment),p=b(),_=m("div"),h=N("HAN TX"),v=m("br"),d=b(),g=m("select"),re(w.$$.fragment),D=b(),T=m("div"),E=m("label"),F=m("input"),I=N(" pullup"),O=b(),C=m("div"),A=m("div"),le=N("AP button"),H=m("br"),z=b(),U=m("input"),K=b(),Q=m("div"),G=N("LED"),X=m("br"),Y=b(),j=m("div"),x=m("input"),ae=b(),te=m("div"),V=m("label"),W=m("input"),we=N(" inverted"),He=b(),Ie=m("div"),Se=N("RGB"),ye=m("label"),ve=m("input"),$e=N(" inverted"),be=m("br"),$=b(),y=m("div"),k=m("input"),P=b(),L=m("input"),Z=b(),ne=m("input"),fe=b(),de=m("div"),Ce=m("div"),Oe=N(`LED dis. GPIO - `),ue=m("input"),Te=b(),Je=m("div"),Ot=N("Temperature"),st=m("br"),wt=b(),nt=m("input"),Ft=b(),Qe=m("div"),Zt=N("Analog temp"),Gt=m("br"),vt=b(),xe=m("input"),Ge=b(),qe&&qe.c(),Ke=b(),Fe&&Fe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihp"),r(a,"class","in-f w-full"),t[3].i.h.p===void 0&&We(()=>t[80].call(a)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&We(()=>t[81].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(E,"class","ml-2"),r(T,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(U,"name","ia"),r(U,"type","number"),r(U,"min","0"),r(U,"max",t[6]),r(U,"class","in-f tr w-full"),r(A,"class","w-1/3"),r(x,"name","ilp"),r(x,"type","number"),r(x,"min","0"),r(x,"max",t[6]),r(x,"class","in-l tr w-full"),r(j,"class","flex"),r(Q,"class","w-1/3"),r(W,"name","ili"),W.__value="true",W.value=W.__value,r(W,"type","checkbox"),r(W,"class","rounded mb-1"),r(V,"class","ml-4"),r(te,"class","w-1/3"),r(ve,"name","iri"),ve.__value="true",ve.value=ve.__value,r(ve,"type","checkbox"),r(ve,"class","rounded mb-1"),r(ye,"class","ml-4"),r(k,"name","irr"),r(k,"type","number"),r(k,"min","0"),r(k,"max",t[6]),r(k,"class","in-f tr w-1/3"),r(L,"name","irg"),r(L,"type","number"),r(L,"min","0"),r(L,"max",t[6]),r(L,"class","in-m tr w-1/3"),r(ne,"name","irb"),r(ne,"type","number"),r(ne,"min","0"),r(ne,"max",t[6]),r(ne,"class","in-l tr w-1/3"),r(y,"class","flex"),r(Ie,"class","w-full"),r(ue,"name","idd"),r(ue,"type","number"),r(ue,"min","0"),r(ue,"max",t[6]),r(ue,"class","in-s tr"),r(Ce,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(nt,"name","itd"),r(nt,"type","number"),r(nt,"min","0"),r(nt,"max",t[6]),r(nt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(xe,"name","ita"),r(xe,"type","number"),r(xe,"min","0"),r(xe,"max",t[6]),r(xe,"class","in-l tr w-full"),r(Qe,"class","my-1 pr-1 w-1/3"),r(C,"class","flex flex-wrap")},m(_e,ce){M(_e,e,ce),M(_e,l,ce),M(_e,n,ce),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),se(f,a,null),Me(a,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,h),s(_,v),s(_,d),s(_,g),se(w,g,null),Me(g,t[3].i.h.t,!0),s(n,D),s(n,T),s(T,E),s(E,F),F.checked=t[3].i.h.u,s(E,I),M(_e,O,ce),M(_e,C,ce),s(C,A),s(A,le),s(A,H),s(A,z),s(A,U),ie(U,t[3].i.a),s(C,K),s(C,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),ie(x,t[3].i.l.p),s(C,ae),s(C,te),s(te,V),s(V,W),W.checked=t[3].i.l.i,s(V,we),s(C,He),s(C,Ie),s(Ie,Se),s(Ie,ye),s(ye,ve),ve.checked=t[3].i.r.i,s(ye,$e),s(Ie,be),s(Ie,$),s(Ie,y),s(y,k),ie(k,t[3].i.r.r),s(y,P),s(y,L),ie(L,t[3].i.r.g),s(y,Z),s(y,ne),ie(ne,t[3].i.r.b),s(C,fe),s(C,de),s(de,Ce),s(Ce,Oe),s(Ce,ue),ie(ue,t[3].i.d.d),s(C,Te),s(C,Je),s(Je,Ot),s(Je,st),s(Je,wt),s(Je,nt),ie(nt,t[3].i.t.d),s(C,Ft),s(C,Qe),s(Qe,Zt),s(Qe,Gt),s(Qe,vt),s(Qe,xe),ie(xe,t[3].i.t.a),s(C,Ge),qe&&qe.m(C,null),s(C,Ke),Fe&&Fe.m(C,null),Ne=!0,Ze||(et=[ee(a,"change",t[80]),ee(g,"change",t[81]),ee(F,"change",t[82]),ee(U,"input",t[83]),ee(x,"input",t[84]),ee(W,"change",t[85]),ee(ve,"change",t[86]),ee(k,"input",t[87]),ee(L,"input",t[88]),ee(ne,"input",t[89]),ee(ue,"input",t[90]),ee(nt,"input",t[91]),ee(xe,"input",t[92])],Ze=!0)},p(_e,ce){const Be={};ce[0]&1&&(Be.chip=_e[0].chip),f.$set(Be),ce[0]&8&&Me(a,_e[3].i.h.p);const pt={};ce[0]&1&&(pt.chip=_e[0].chip),w.$set(pt),ce[0]&8&&Me(g,_e[3].i.h.t),ce[0]&8&&(F.checked=_e[3].i.h.u),(!Ne||ce[0]&64)&&r(U,"max",_e[6]),ce[0]&8&&ge(U.value)!==_e[3].i.a&&ie(U,_e[3].i.a),(!Ne||ce[0]&64)&&r(x,"max",_e[6]),ce[0]&8&&ge(x.value)!==_e[3].i.l.p&&ie(x,_e[3].i.l.p),ce[0]&8&&(W.checked=_e[3].i.l.i),ce[0]&8&&(ve.checked=_e[3].i.r.i),(!Ne||ce[0]&64)&&r(k,"max",_e[6]),ce[0]&8&&ge(k.value)!==_e[3].i.r.r&&ie(k,_e[3].i.r.r),(!Ne||ce[0]&64)&&r(L,"max",_e[6]),ce[0]&8&&ge(L.value)!==_e[3].i.r.g&&ie(L,_e[3].i.r.g),(!Ne||ce[0]&64)&&r(ne,"max",_e[6]),ce[0]&8&&ge(ne.value)!==_e[3].i.r.b&&ie(ne,_e[3].i.r.b),(!Ne||ce[0]&64)&&r(ue,"max",_e[6]),ce[0]&8&&ge(ue.value)!==_e[3].i.d.d&&ie(ue,_e[3].i.d.d),(!Ne||ce[0]&64)&&r(nt,"max",_e[6]),ce[0]&8&&ge(nt.value)!==_e[3].i.t.d&&ie(nt,_e[3].i.t.d),(!Ne||ce[0]&64)&&r(xe,"max",_e[6]),ce[0]&8&&ge(xe.value)!==_e[3].i.t.a&&ie(xe,_e[3].i.t.a),_e[0].chip!="esp8266"?qe?qe.p(_e,ce):(qe=Mf(_e),qe.c(),qe.m(C,Ke)):qe&&(qe.d(1),qe=null),_e[3].i.v.p>0?Fe?Fe.p(_e,ce):(Fe=Tf(_e),Fe.c(),Fe.m(C,null)):Fe&&(Fe.d(1),Fe=null)},i(_e){Ne||(R(f.$$.fragment,_e),R(w.$$.fragment,_e),Ne=!0)},o(_e){B(f.$$.fragment,_e),B(w.$$.fragment,_e),Ne=!1},d(_e){_e&&S(e),_e&&S(l),_e&&S(n),oe(f),oe(w),_e&&S(O),_e&&S(C),qe&&qe.d(),Fe&&Fe.d(),Ze=!1,ze(et)}}}function Mf(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].i.v.p),u||(c=ee(o,"input",t[93]),u=!0)},p(a,f){f[0]&64&&r(o,"max",a[6]),f[0]&8&&ge(o.value)!==a[3].i.v.p&&ie(o,a[3].i.v.p)},d(a){a&&S(e),u=!1,c()}}}function Tf(t){let e,l,n,i,o,u,c,a,f,p;return{c(){e=m("div"),l=N("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),c=b(),a=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(a,"name","ivdg"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-l tr w-full"),r(a,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,h){M(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ie(u,t[3].i.v.d.v),s(o,c),s(o,a),ie(a,t[3].i.v.d.g),f||(p=[ee(u,"input",t[94]),ee(a,"input",t[95])],f=!0)},p(_,h){h[0]&8&&ge(u.value)!==_[3].i.v.d.v&&ie(u,_[3].i.v.d.v),h[0]&8&&ge(a.value)!==_[3].i.v.d.g&&ie(a,_[3].i.v.d.g)},d(_){_&&S(e),f=!1,ze(p)}}}function $f(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N(`LED behaviour - `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&We(()=>t[96].call(n)),r(e,"class","my-1 w-full")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Me(n,t[3].i.d.b,!0),u||(c=ee(n,"change",t[96]),u=!0)},p(a,f){f[0]&8&&Me(n,a[3].i.d.b)},d(a){a&&S(e),u=!1,c()}}}function Nf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("Vcc offset"),u=m("br"),c=b(),a=m("input"),f=b(),p=m("div"),_=N("Multiplier"),h=m("br"),v=b(),d=m("input"),g=b(),T&&T.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(a,"name","ivo"),r(a,"type","number"),r(a,"min","0.0"),r(a,"max","3.5"),r(a,"step","0.01"),r(a,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,F){M(E,e,F),M(E,l,F),M(E,n,F),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),ie(a,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,h),s(p,v),s(p,d),ie(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(D=[ee(a,"input",t[97]),ee(d,"input",t[98])],w=!0)},p(E,F){F[0]&8&&ge(a.value)!==E[3].i.v.o&&ie(a,E[3].i.v.o),F[0]&8&&ge(d.value)!==E[3].i.v.m&&ie(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,F):(T=Ef(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&S(e),E&&S(l),E&&S(n),T&&T.d(),w=!1,ze(D)}}}function Ef(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(o,t[3].i.v.b),u||(c=ee(o,"input",t[99]),u=!0)},p(a,f){f[0]&8&&ge(o.value)!==a[3].i.v.b&&ie(o,a[3].i.v.b)},d(a){a&&S(e),u=!1,c()}}}function Af(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D=t[3].d.t&&Pf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=N(" Enable telnet"),c=b(),D&&D.c(),a=b(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",h=m("option"),h.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&We(()=>t[102].call(p)),r(f,"class","my-1")},m(T,E){M(T,e,E),M(T,l,E),M(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(T,c,E),D&&D.m(T,E),M(T,a,E),M(T,f,E),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),Me(p,t[3].d.l,!0),g||(w=[ee(o,"change",t[101]),ee(p,"change",t[102])],g=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?D||(D=Pf(),D.c(),D.m(a.parentNode,a)):D&&(D.d(1),D=null),E[0]&8&&Me(p,T[3].d.l)},d(T){T&&S(e),T&&S(l),T&&S(n),T&&S(c),D&&D.d(T),T&&S(a),T&&S(f),g=!1,ze(w)}}}function Pf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function F_(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Nl,El,Al,Ai,ai,bl,Pi,Di,Li,yt,Ri,je,dn,Ii,Pl,Dl,Oi,zl,Fi,Gl,qi,gl,Bi,Ye,Ct,ht,Vl,Ll,Rl,Vt,vn,No,Ss,Eo,ui,Jt,Ao,Po,Il,al,Ol,Do,Ui,Lo,bt,Fl,Ro,ji,hn,bn,gn,kn,Hi,Io,qt,Wi,Oo,Kl,Fo,qo,Bo,ul,wn,yn,Uo,Cn,Yl,jo,Ho,Wo,Sn,xt,zo,zi,Go,Ql,Vo,Ko,Yo,Mn,el,Qo,Gi,Xo,Ms,Zo,Xl,Vi,tl,Jo,xo,er,Ts,Ki,ll,tr,lr,nr,Bt,Yi,ir,Tn,$n,sr,fi,or,Zl,rr,ar,ur,Kt,Nn,En,fr,cr,mt,Qi,mr,An,Pn,_r,Jl,pr,dr,vr,ql,fl,Dn,Ln,hr,Ut,Xi,Zi,br,jt,Rn,Ji,xi,gr,$s,es,ts,nl,kr,wr,ci,yr,Bl,Cr,mi,il,Sr,Mr,Tr,ls,kl,$r,lt,ns,Nr,In,On,Er,_i,Ar,cl,Pr,Ns,Dr,Lr,Fn,wl,Rr,sl,Ir,Es,xl,Or,Fr,qr,yl,Br,en,Ur,jr,Hr,Cl,Wr,qn,Bn,zr,Gr,Vr,Sl,Kr,Un,Yr,Qr,Xr,St,jn,Hn,Wn,zn,Gn,Vn,Zr,tn,Jr,xr,ea,Ml,ta,As,Ps,Ds,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Rs,ml,is,la,Kn,Yn,na,pi,ia,di,sa,Is,Ht,ss,oa,Qn,Xn,ra,vi,aa,os,rs,ol,ua,fa,ca,Ul,Os,Zn,ma,as,Jn,_a,us,Fs,ln,qs,nn,Bs,sn,Us,on,Yt,js,pa;c=new Rt({}),A=new m_({});let f1=["NOK","SEK","DKK","EUR","CHF"],hi=[];for(let q=0;q<5;q+=1)hi[q]=y_(w_(t,f1,q));vt=new Xt({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[C_]},$$scope:{ctx:t}}});let Mt=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),Tt=t[3].g.s>0&&of(t);Dl=new Rt({});let c1=[24,48,96,192,384,576,1152],bi=[];for(let q=0;q<7;q+=1)bi[q]=S_(k_(t,c1,q));let $t=t[3].m.e.e&&rf(t),Nt=t[3].m.e.e&&af(t),Et=t[3].m.m.e&&uf(t);$n=new Rt({});let Wt=t[0].if&&t[0].if.eth&&ff(),At=(t[3].n.c==1||t[3].n.c==2)&&cf(t);Pn=new Rt({}),Rn=new a1({});let Pt=t[3].n.m=="static"&&mf(t);On=new Rt({});let Dt=t[0].chip!="esp8266"&&_f(t),ot=t[3].q.s.e&&pf(t),rt=t[3].q.m==3&&df(t),at=t[3].q.m==4&&vf(t),ut=t[3].c.es!=null&&hf(t),ft=Ls&&kf(t);Yn=new Rt({});let xn=t[7],gt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Cf(t);Xn=new Rt({});let Lt=t[3].d.s&&Af(t);return ln=new kt({props:{active:t[1],message:"Loading configuration"}}),nn=new kt({props:{active:t[2],message:"Saving configuration"}}),sn=new kt({props:{active:t[4],message:"Performing factory reset"}}),on=new kt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),re(c.$$.fragment),a=b(),f=m("input"),p=b(),_=m("div"),h=m("div"),v=m("div"),d=N("Hostname"),g=m("br"),w=b(),D=m("input"),T=b(),E=m("div"),F=N("Time zone"),I=m("br"),O=b(),C=m("select"),re(A.$$.fragment),le=b(),H=m("input"),z=b(),U=m("div"),K=m("div"),Q=m("div"),G=N("Price region"),X=m("br"),Y=b(),j=m("select"),x=m("optgroup"),ae=m("option"),ae.textContent="NO1",te=m("option"),te.textContent="NO2",V=m("option"),V.textContent="NO3",W=m("option"),W.textContent="NO4",we=m("option"),we.textContent="NO5",He=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",Se=m("option"),Se.textContent="SE2",ye=m("option"),ye.textContent="SE3",ve=m("option"),ve.textContent="SE4",$e=m("optgroup"),be=m("option"),be.textContent="DK1",$=m("option"),$.textContent="DK2",y=m("option"),y.textContent="Austria",k=m("option"),k.textContent="Belgium",P=m("option"),P.textContent="Czech Republic",L=m("option"),L.textContent="Estonia",Z=m("option"),Z.textContent="Finland",ne=m("option"),ne.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",Ce=m("option"),Ce.textContent="Latvia",Oe=m("option"),Oe.textContent="Lithuania",ue=m("option"),ue.textContent="Netherland",Te=m("option"),Te.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",Ot=b(),st=m("div"),wt=N("Currency"),nt=m("br"),Ft=b(),Qe=m("select");for(let q=0;q<5;q+=1)hi[q].c();Zt=b(),Gt=m("div"),re(vt.$$.fragment),xe=b(),Ge=m("div"),Ke=m("label"),Ne=m("input"),Ze=N(" Enable price fetch from remote server"),et=b(),Mt&&Mt.c(),qe=b(),Fe=m("div"),_e=N("Security"),ce=m("br"),Be=b(),pt=m("select"),Nl=m("option"),Nl.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Ai=b(),Tt&&Tt.c(),ai=b(),bl=m("div"),Pi=N("Context"),Di=m("br"),Li=b(),yt=m("input"),Ri=b(),je=m("div"),dn=m("strong"),dn.textContent="Meter",Ii=b(),Pl=m("a"),re(Dl.$$.fragment),Oi=b(),zl=m("input"),Fi=b(),Gl=m("input"),qi=b(),gl=m("div"),Bi=N("Communication"),Ye=m("br"),Ct=b(),ht=m("select"),Vl=m("option"),Vl.textContent="Passive (Push)",Ll=m("option"),Ll.textContent="Kamstrup (Pull)",Rl=b(),Vt=m("div"),vn=m("span"),vn.textContent="Buffer size",No=b(),Ss=m("span"),Ss.textContent="Serial conf.",Eo=b(),ui=m("label"),Jt=m("input"),Ao=N(" inverted"),Po=b(),Il=m("div"),al=m("select"),Ol=m("option"),Do=N("Autodetect");for(let q=0;q<7;q+=1)bi[q].c();Lo=b(),bt=m("select"),Fl=m("option"),Ro=N("-"),hn=m("option"),hn.textContent="7N1",bn=m("option"),bn.textContent="8N1",gn=m("option"),gn.textContent="7E1",kn=m("option"),kn.textContent="8E1",Io=b(),qt=m("input"),Oo=b(),Kl=m("div"),Fo=N("Voltage"),qo=m("br"),Bo=b(),ul=m("select"),wn=m("option"),wn.textContent="400V (TN)",yn=m("option"),yn.textContent="230V (IT/TT)",Uo=b(),Cn=m("div"),Yl=m("div"),jo=N("Main fuse"),Ho=m("br"),Wo=b(),Sn=m("label"),xt=m("input"),zo=b(),zi=m("span"),zi.textContent="A",Go=b(),Ql=m("div"),Vo=N("Production"),Ko=m("br"),Yo=b(),Mn=m("label"),el=m("input"),Qo=b(),Gi=m("span"),Gi.textContent="kWp",Xo=b(),Ms=m("div"),Zo=b(),Xl=m("div"),Vi=m("label"),tl=m("input"),Jo=N(" Meter is encrypted"),xo=b(),$t&&$t.c(),er=b(),Nt&&Nt.c(),Ts=b(),Ki=m("label"),ll=m("input"),tr=N(" Multipliers"),lr=b(),Et&&Et.c(),nr=b(),Bt=m("div"),Yi=m("strong"),Yi.textContent="Connection",ir=b(),Tn=m("a"),re($n.$$.fragment),sr=b(),fi=m("input"),or=b(),Zl=m("div"),rr=N("Connection"),ar=m("br"),ur=b(),Kt=m("select"),Nn=m("option"),Nn.textContent="WiFi",En=m("option"),En.textContent="Access point",Wt&&Wt.c(),fr=b(),At&&At.c(),cr=b(),mt=m("div"),Qi=m("strong"),Qi.textContent="Network",mr=b(),An=m("a"),re(Pn.$$.fragment),_r=b(),Jl=m("div"),pr=N("IP"),dr=m("br"),vr=b(),ql=m("div"),fl=m("select"),Dn=m("option"),Dn.textContent="DHCP",Ln=m("option"),Ln.textContent="Static",hr=b(),Ut=m("input"),br=b(),jt=m("select"),re(Rn.$$.fragment),gr=b(),Pt&&Pt.c(),$s=b(),es=m("div"),ts=m("label"),nl=m("input"),kr=N(" enable mDNS"),wr=b(),ci=m("input"),yr=b(),Bl=m("div"),Cr=N("NTP "),mi=m("label"),il=m("input"),Sr=N(" obtain from DHCP"),Mr=m("br"),Tr=b(),ls=m("div"),kl=m("input"),$r=b(),lt=m("div"),ns=m("strong"),ns.textContent="MQTT",Nr=b(),In=m("a"),re(On.$$.fragment),Er=b(),_i=m("input"),Ar=b(),cl=m("div"),Pr=N(`Server - `),Dt&&Dt.c(),Ns=b(),Dr=m("br"),Lr=b(),Fn=m("div"),wl=m("input"),Rr=b(),sl=m("input"),Ir=b(),ot&&ot.c(),Es=b(),xl=m("div"),Or=N("Username"),Fr=m("br"),qr=b(),yl=m("input"),Br=b(),en=m("div"),Ur=N("Password"),jr=m("br"),Hr=b(),Cl=m("input"),Wr=b(),qn=m("div"),Bn=m("div"),zr=N("Client ID"),Gr=m("br"),Vr=b(),Sl=m("input"),Kr=b(),Un=m("div"),Yr=N("Payload"),Qr=m("br"),Xr=b(),St=m("select"),jn=m("option"),jn.textContent="JSON",Hn=m("option"),Hn.textContent="Raw (minimal)",Wn=m("option"),Wn.textContent="Raw (full)",zn=m("option"),zn.textContent="Domoticz",Gn=m("option"),Gn.textContent="HomeAssistant",Vn=m("option"),Vn.textContent="HEX dump",Zr=b(),tn=m("div"),Jr=N("Publish topic"),xr=m("br"),ea=b(),Ml=m("input"),ta=b(),rt&&rt.c(),As=b(),at&&at.c(),Ps=b(),ut&&ut.c(),Ds=b(),ft&&ft.c(),Rs=b(),ml=m("div"),is=m("strong"),is.textContent="User interface",la=b(),Kn=m("a"),re(Yn.$$.fragment),na=b(),pi=m("input"),ia=b(),di=m("div");for(let q=0;qSave',Fs=b(),re(ln.$$.fragment),qs=b(),re(nn.$$.fragment),Bs=b(),re(sn.$$.fragment),Us=b(),re(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",It("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(D,"name","gh"),r(D,"type","text"),r(D,"class","in-f w-full"),r(D,"pattern","[A-Za-z0-9-]+"),r(C,"name","gt"),r(C,"class","in-l w-full"),t[3].g.t===void 0&&We(()=>t[17].call(C)),r(h,"class","flex"),r(_,"class","my-1"),r(H,"type","hidden"),r(H,"name","p"),H.value="true",ae.__value="10YNO-1--------2",ae.value=ae.__value,te.__value="10YNO-2--------T",te.value=te.__value,V.__value="10YNO-3--------J",V.value=V.__value,W.__value="10YNO-4--------9",W.value=W.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,r(x,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,Se.__value="10Y1001A1001A45N",Se.value=Se.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,ve.__value="10Y1001A1001A47J",ve.value=ve.__value,r(He,"label","Sweden"),be.__value="10YDK-1--------W",be.value=be.__value,$.__value="10YDK-2--------M",$.value=$.__value,r($e,"label","Denmark"),y.__value="10YAT-APG------L",y.value=y.__value,k.__value="10YBE----------2",k.value=k.__value,P.__value="10YCZ-CEPS-----N",P.value=P.__value,L.__value="10Y1001A1001A39I",L.value=L.__value,Z.__value="10YFI-1--------U",Z.value=Z.__value,ne.__value="10YFR-RTE------C",ne.value=ne.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,Ce.__value="10YLV-1001A00074",Ce.value=Ce.__value,Oe.__value="10YLT-1001A0008Q",Oe.value=Oe.__value,ue.__value="10YNL----------L",ue.value=ue.__value,Te.__value="10YPL-AREA-----S",Te.value=Te.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(j,"name","pr"),r(j,"class","in-f w-full"),t[3].p.r===void 0&&We(()=>t[18].call(j)),r(Q,"class","w-full"),r(Qe,"name","pc"),r(Qe,"class","in-l"),t[3].p.c===void 0&&We(()=>t[19].call(Qe)),r(K,"class","flex"),r(U,"class","my-1"),r(Gt,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",Ne.value=Ne.__value,r(Ne,"class","rounded mb-1"),r(Ge,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(pt,"name","gs"),r(pt,"class","in-s"),t[3].g.s===void 0&&We(()=>t[22].call(pt)),r(Fe,"class","my-1"),r(yt,"name","gc"),r(yt,"type","text"),r(yt,"pattern","[A-Za-z0-9]+"),r(yt,"placeholder","[root]"),r(yt,"class","in-s"),r(yt,"maxlength","36"),r(bl,"class","my-1"),r(n,"class","cnt"),r(dn,"class","text-sm"),r(Pl,"href",It("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(zl,"type","hidden"),r(zl,"name","m"),zl.value="true",r(Gl,"type","hidden"),r(Gl,"name","mo"),Gl.value="1",Vl.__value=0,Vl.value=Vl.__value,Ll.__value=9,Ll.value=Ll.__value,r(ht,"name","ma"),r(ht,"class","in-s"),t[3].m.a===void 0&&We(()=>t[26].call(ht)),r(gl,"class","my-1"),r(vn,"class","float-right"),r(Jt,"name","mi"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"type","checkbox"),r(Jt,"class","rounded mb-1"),r(ui,"class","mt-2 ml-3 whitespace-nowrap"),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Ui=t[3].m.b!=0,r(al,"name","mb"),r(al,"class","in-f tr w-1/2"),t[3].m.b===void 0&&We(()=>t[28].call(al)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=ji=t[3].m.b!=0,hn.__value=2,hn.value=hn.__value,bn.__value=3,bn.value=bn.__value,gn.__value=10,gn.value=gn.__value,kn.__value=11,kn.value=kn.__value,r(bt,"name","mp"),r(bt,"class","in-m"),bt.disabled=Hi=t[3].m.b==0,t[3].m.p===void 0&&We(()=>t[29].call(bt)),r(qt,"name","ms"),r(qt,"type","number"),r(qt,"min",64),r(qt,"max",Wi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(qt,"step",64),r(qt,"class","in-l tr w-1/2"),r(Il,"class","flex w-full"),r(Vt,"class","my-1"),wn.__value=2,wn.value=wn.__value,yn.__value=1,yn.value=yn.__value,r(ul,"name","md"),r(ul,"class","in-s"),t[3].m.d===void 0&&We(()=>t[31].call(ul)),r(Kl,"class","my-1"),r(xt,"name","mf"),r(xt,"type","number"),r(xt,"min","5"),r(xt,"max","65535"),r(xt,"class","in-f tr w-full"),r(zi,"class","in-post"),r(Sn,"class","flex"),r(Yl,"class","mx-1"),r(el,"name","mr"),r(el,"type","number"),r(el,"min","0"),r(el,"max","65535"),r(el,"class","in-f tr w-full"),r(Gi,"class","in-post"),r(Mn,"class","flex"),r(Ql,"class","mx-1"),r(Cn,"class","my-1 flex"),r(Ms,"class","my-1"),r(tl,"type","checkbox"),r(tl,"name","me"),tl.__value="true",tl.value=tl.__value,r(tl,"class","rounded mb-1"),r(Xl,"class","my-1"),r(ll,"type","checkbox"),r(ll,"name","mm"),ll.__value="true",ll.value=ll.__value,r(ll,"class","rounded mb-1"),r(je,"class","cnt"),r(Yi,"class","text-sm"),r(Tn,"href",It("WiFi-configuration")),r(Tn,"target","_blank"),r(Tn,"class","float-right"),r(fi,"type","hidden"),r(fi,"name","w"),fi.value="true",Nn.__value=1,Nn.value=Nn.__value,En.__value=2,En.value=En.__value,r(Kt,"name","nc"),r(Kt,"class","in-s"),t[3].n.c===void 0&&We(()=>t[42].call(Kt)),r(Zl,"class","my-1"),r(Bt,"class","cnt"),r(Qi,"class","text-sm"),r(An,"href",It("Network-configuration")),r(An,"target","_blank"),r(An,"class","float-right"),Dn.__value="dhcp",Dn.value=Dn.__value,Ln.__value="static",Ln.value=Ln.__value,r(fl,"name","nm"),r(fl,"class","in-f"),t[3].n.m===void 0&&We(()=>t[48].call(fl)),r(Ut,"name","ni"),r(Ut,"type","text"),r(Ut,"class","in-m w-full"),Ut.disabled=Xi=t[3].n.m=="dhcp",Ut.required=Zi=t[3].n.m=="static",r(jt,"name","ns"),r(jt,"class","in-l"),jt.disabled=Ji=t[3].n.m=="dhcp",jt.required=xi=t[3].n.m=="static",t[3].n.s===void 0&&We(()=>t[50].call(jt)),r(ql,"class","flex"),r(Jl,"class","my-1"),r(nl,"name","nd"),nl.__value="true",nl.value=nl.__value,r(nl,"type","checkbox"),r(nl,"class","rounded mb-1"),r(es,"class","my-1"),r(ci,"type","hidden"),r(ci,"name","ntp"),ci.value="true",r(il,"name","ntpd"),il.__value="true",il.value=il.__value,r(il,"type","checkbox"),r(il,"class","rounded mb-1"),r(mi,"class","ml-4"),r(kl,"name","ntph"),r(kl,"type","text"),r(kl,"class","in-s"),r(ls,"class","flex"),r(Bl,"class","my-1"),r(mt,"class","cnt"),r(ns,"class","text-sm"),r(In,"href",It("MQTT-configuration")),r(In,"target","_blank"),r(In,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","q"),_i.value="true",r(wl,"name","qh"),r(wl,"type","text"),r(wl,"class","in-f w-3/4"),r(sl,"name","qp"),r(sl,"type","number"),r(sl,"min","1024"),r(sl,"max","65535"),r(sl,"class","in-l tr w-1/4"),r(Fn,"class","flex"),r(cl,"class","my-1"),r(yl,"name","qu"),r(yl,"type","text"),r(yl,"class","in-s"),r(xl,"class","my-1"),r(Cl,"name","qa"),r(Cl,"type","password"),r(Cl,"class","in-s"),r(en,"class","my-1"),r(Sl,"name","qc"),r(Sl,"type","text"),r(Sl,"class","in-f w-full"),jn.__value=0,jn.value=jn.__value,Hn.__value=1,Hn.value=Hn.__value,Wn.__value=2,Wn.value=Wn.__value,zn.__value=3,zn.value=zn.__value,Gn.__value=4,Gn.value=Gn.__value,Vn.__value=255,Vn.value=Vn.__value,r(St,"name","qm"),r(St,"class","in-l"),t[3].q.m===void 0&&We(()=>t[63].call(St)),r(qn,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(lt,"class","cnt"),r(is,"class","text-sm"),r(Kn,"href",It("User-interface")),r(Kn,"target","_blank"),r(Kn,"class","float-right"),r(pi,"type","hidden"),r(pi,"name","u"),pi.value="true",r(di,"class","flex flex-wrap"),r(ml,"class","cnt"),r(ss,"class","text-sm"),r(Qn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Qn,"target","_blank"),r(Qn,"class","float-right"),r(vi,"type","hidden"),r(vi,"name","d"),vi.value="true",r(ol,"type","checkbox"),r(ol,"name","ds"),ol.__value="true",ol.value=ol.__value,r(ol,"class","rounded mb-1"),r(os,"class","mt-3"),r(Ht,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Zn,"type","button"),r(Zn,"class","btn-red"),r(Jn,"type","button"),r(Jn,"class","btn-yellow"),r(as,"class","text-center"),r(us,"class","text-right"),r(Ul,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(q,me){M(q,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(c,u,null),s(n,a),s(n,f),s(n,p),s(n,_),s(_,h),s(h,v),s(v,d),s(v,g),s(v,w),s(v,D),ie(D,t[3].g.h),s(h,T),s(h,E),s(E,F),s(E,I),s(E,O),s(E,C),se(A,C,null),Me(C,t[3].g.t,!0),s(n,le),s(n,H),s(n,z),s(n,U),s(U,K),s(K,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),s(x,ae),s(x,te),s(x,V),s(x,W),s(x,we),s(j,He),s(He,Ie),s(He,Se),s(He,ye),s(He,ve),s(j,$e),s($e,be),s($e,$),s(j,y),s(j,k),s(j,P),s(j,L),s(j,Z),s(j,ne),s(j,fe),s(j,de),s(j,Ce),s(j,Oe),s(j,ue),s(j,Te),s(j,Je),Me(j,t[3].p.r,!0),s(K,Ot),s(K,st),s(st,wt),s(st,nt),s(st,Ft),s(st,Qe);for(let _t=0;_t<5;_t+=1)hi[_t]&&hi[_t].m(Qe,null);Me(Qe,t[3].p.c,!0),s(n,Zt),s(n,Gt),se(vt,Gt,null),s(n,xe),s(n,Ge),s(Ge,Ke),s(Ke,Ne),Ne.checked=t[3].p.e,s(Ke,Ze),s(Ge,et),Mt&&Mt.m(Ge,null),s(n,qe),s(n,Fe),s(Fe,_e),s(Fe,ce),s(Fe,Be),s(Fe,pt),s(pt,Nl),s(pt,El),s(pt,Al),Me(pt,t[3].g.s,!0),s(n,Ai),Tt&&Tt.m(n,null),s(n,ai),s(n,bl),s(bl,Pi),s(bl,Di),s(bl,Li),s(bl,yt),ie(yt,t[3].g.c),s(l,Ri),s(l,je),s(je,dn),s(je,Ii),s(je,Pl),se(Dl,Pl,null),s(je,Oi),s(je,zl),s(je,Fi),s(je,Gl),s(je,qi),s(je,gl),s(gl,Bi),s(gl,Ye),s(gl,Ct),s(gl,ht),s(ht,Vl),s(ht,Ll),Me(ht,t[3].m.a,!0),s(je,Rl),s(je,Vt),s(Vt,vn),s(Vt,No),s(Vt,Ss),s(Vt,Eo),s(Vt,ui),s(ui,Jt),Jt.checked=t[3].m.i,s(ui,Ao),s(Vt,Po),s(Vt,Il),s(Il,al),s(al,Ol),s(Ol,Do);for(let _t=0;_t<7;_t+=1)bi[_t]&&bi[_t].m(al,null);Me(al,t[3].m.b,!0),s(Il,Lo),s(Il,bt),s(bt,Fl),s(Fl,Ro),s(bt,hn),s(bt,bn),s(bt,gn),s(bt,kn),Me(bt,t[3].m.p,!0),s(Il,Io),s(Il,qt),ie(qt,t[3].m.s),s(je,Oo),s(je,Kl),s(Kl,Fo),s(Kl,qo),s(Kl,Bo),s(Kl,ul),s(ul,wn),s(ul,yn),Me(ul,t[3].m.d,!0),s(je,Uo),s(je,Cn),s(Cn,Yl),s(Yl,jo),s(Yl,Ho),s(Yl,Wo),s(Yl,Sn),s(Sn,xt),ie(xt,t[3].m.f),s(Sn,zo),s(Sn,zi),s(Cn,Go),s(Cn,Ql),s(Ql,Vo),s(Ql,Ko),s(Ql,Yo),s(Ql,Mn),s(Mn,el),ie(el,t[3].m.r),s(Mn,Qo),s(Mn,Gi),s(je,Xo),s(je,Ms),s(je,Zo),s(je,Xl),s(Xl,Vi),s(Vi,tl),tl.checked=t[3].m.e.e,s(Vi,Jo),s(Xl,xo),$t&&$t.m(Xl,null),s(je,er),Nt&&Nt.m(je,null),s(je,Ts),s(je,Ki),s(Ki,ll),ll.checked=t[3].m.m.e,s(Ki,tr),s(je,lr),Et&&Et.m(je,null),s(l,nr),s(l,Bt),s(Bt,Yi),s(Bt,ir),s(Bt,Tn),se($n,Tn,null),s(Bt,sr),s(Bt,fi),s(Bt,or),s(Bt,Zl),s(Zl,rr),s(Zl,ar),s(Zl,ur),s(Zl,Kt),s(Kt,Nn),s(Kt,En),Wt&&Wt.m(Kt,null),Me(Kt,t[3].n.c,!0),s(Bt,fr),At&&At.m(Bt,null),s(l,cr),s(l,mt),s(mt,Qi),s(mt,mr),s(mt,An),se(Pn,An,null),s(mt,_r),s(mt,Jl),s(Jl,pr),s(Jl,dr),s(Jl,vr),s(Jl,ql),s(ql,fl),s(fl,Dn),s(fl,Ln),Me(fl,t[3].n.m,!0),s(ql,hr),s(ql,Ut),ie(Ut,t[3].n.i),s(ql,br),s(ql,jt),se(Rn,jt,null),Me(jt,t[3].n.s,!0),s(mt,gr),Pt&&Pt.m(mt,null),s(mt,$s),s(mt,es),s(es,ts),s(ts,nl),nl.checked=t[3].n.d,s(ts,kr),s(mt,wr),s(mt,ci),s(mt,yr),s(mt,Bl),s(Bl,Cr),s(Bl,mi),s(mi,il),il.checked=t[3].n.h,s(mi,Sr),s(Bl,Mr),s(Bl,Tr),s(Bl,ls),s(ls,kl),ie(kl,t[3].n.n1),s(l,$r),s(l,lt),s(lt,ns),s(lt,Nr),s(lt,In),se(On,In,null),s(lt,Er),s(lt,_i),s(lt,Ar),s(lt,cl),s(cl,Pr),Dt&&Dt.m(cl,null),s(cl,Ns),s(cl,Dr),s(cl,Lr),s(cl,Fn),s(Fn,wl),ie(wl,t[3].q.h),s(Fn,Rr),s(Fn,sl),ie(sl,t[3].q.p),s(lt,Ir),ot&&ot.m(lt,null),s(lt,Es),s(lt,xl),s(xl,Or),s(xl,Fr),s(xl,qr),s(xl,yl),ie(yl,t[3].q.u),s(lt,Br),s(lt,en),s(en,Ur),s(en,jr),s(en,Hr),s(en,Cl),ie(Cl,t[3].q.a),s(lt,Wr),s(lt,qn),s(qn,Bn),s(Bn,zr),s(Bn,Gr),s(Bn,Vr),s(Bn,Sl),ie(Sl,t[3].q.c),s(qn,Kr),s(qn,Un),s(Un,Yr),s(Un,Qr),s(Un,Xr),s(Un,St),s(St,jn),s(St,Hn),s(St,Wn),s(St,zn),s(St,Gn),s(St,Vn),Me(St,t[3].q.m,!0),s(lt,Zr),s(lt,tn),s(tn,Jr),s(tn,xr),s(tn,ea),s(tn,Ml),ie(Ml,t[3].q.b),s(l,ta),rt&&rt.m(l,null),s(l,As),at&&at.m(l,null),s(l,Ps),ut&&ut.m(l,null),s(l,Ds),ft&&ft.m(l,null),s(l,Rs),s(l,ml),s(ml,is),s(ml,la),s(ml,Kn),se(Yn,Kn,null),s(ml,na),s(ml,pi),s(ml,ia),s(ml,di);for(let _t=0;_t0?Tt?Tt.p(q,me):(Tt=of(q),Tt.c(),Tt.m(n,ai)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&yt.value!==q[3].g.c&&ie(yt,q[3].g.c),me[0]&8&&Me(ht,q[3].m.a),me[0]&8&&(Jt.checked=q[3].m.i),(!Yt||me[0]&8&&Ui!==(Ui=q[3].m.b!=0))&&(Ol.disabled=Ui),me[0]&8&&Me(al,q[3].m.b),(!Yt||me[0]&8&&ji!==(ji=q[3].m.b!=0))&&(Fl.disabled=ji),(!Yt||me[0]&8&&Hi!==(Hi=q[3].m.b==0))&&(bt.disabled=Hi),me[0]&8&&Me(bt,q[3].m.p),(!Yt||me[0]&9&&Wi!==(Wi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&r(qt,"max",Wi),me[0]&8&&ge(qt.value)!==q[3].m.s&&ie(qt,q[3].m.s),me[0]&8&&Me(ul,q[3].m.d),me[0]&8&&ge(xt.value)!==q[3].m.f&&ie(xt,q[3].m.f),me[0]&8&&ge(el.value)!==q[3].m.r&&ie(el,q[3].m.r),me[0]&8&&(tl.checked=q[3].m.e.e),q[3].m.e.e?$t?$t.p(q,me):($t=rf(q),$t.c(),$t.m(Xl,null)):$t&&($t.d(1),$t=null),q[3].m.e.e?Nt?Nt.p(q,me):(Nt=af(q),Nt.c(),Nt.m(je,Ts)):Nt&&(Nt.d(1),Nt=null),me[0]&8&&(ll.checked=q[3].m.m.e),q[3].m.m.e?Et?Et.p(q,me):(Et=uf(q),Et.c(),Et.m(je,null)):Et&&(Et.d(1),Et=null),q[0].if&&q[0].if.eth?Wt||(Wt=ff(),Wt.c(),Wt.m(Kt,null)):Wt&&(Wt.d(1),Wt=null),me[0]&8&&Me(Kt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?At?At.p(q,me):(At=cf(q),At.c(),At.m(Bt,null)):At&&(At.d(1),At=null),me[0]&8&&Me(fl,q[3].n.m),(!Yt||me[0]&8&&Xi!==(Xi=q[3].n.m=="dhcp"))&&(Ut.disabled=Xi),(!Yt||me[0]&8&&Zi!==(Zi=q[3].n.m=="static"))&&(Ut.required=Zi),me[0]&8&&Ut.value!==q[3].n.i&&ie(Ut,q[3].n.i),(!Yt||me[0]&8&&Ji!==(Ji=q[3].n.m=="dhcp"))&&(jt.disabled=Ji),(!Yt||me[0]&8&&xi!==(xi=q[3].n.m=="static"))&&(jt.required=xi),me[0]&8&&Me(jt,q[3].n.s),q[3].n.m=="static"?Pt?Pt.p(q,me):(Pt=mf(q),Pt.c(),Pt.m(mt,$s)):Pt&&(Pt.d(1),Pt=null),me[0]&8&&(nl.checked=q[3].n.d),me[0]&8&&(il.checked=q[3].n.h),me[0]&8&&kl.value!==q[3].n.n1&&ie(kl,q[3].n.n1),q[0].chip!="esp8266"?Dt?Dt.p(q,me):(Dt=_f(q),Dt.c(),Dt.m(cl,Ns)):Dt&&(Dt.d(1),Dt=null),me[0]&8&&wl.value!==q[3].q.h&&ie(wl,q[3].q.h),me[0]&8&&ge(sl.value)!==q[3].q.p&&ie(sl,q[3].q.p),q[3].q.s.e?ot?(ot.p(q,me),me[0]&8&&R(ot,1)):(ot=pf(q),ot.c(),R(ot,1),ot.m(lt,Es)):ot&&(Ae(),B(ot,1,1,()=>{ot=null}),Pe()),me[0]&8&&yl.value!==q[3].q.u&&ie(yl,q[3].q.u),me[0]&8&&Cl.value!==q[3].q.a&&ie(Cl,q[3].q.a),me[0]&8&&Sl.value!==q[3].q.c&&ie(Sl,q[3].q.c),me[0]&8&&Me(St,q[3].q.m),me[0]&8&&Ml.value!==q[3].q.b&&ie(Ml,q[3].q.b),q[3].q.m==3?rt?(rt.p(q,me),me[0]&8&&R(rt,1)):(rt=df(q),rt.c(),R(rt,1),rt.m(l,As)):rt&&(Ae(),B(rt,1,1,()=>{rt=null}),Pe()),q[3].q.m==4?at?(at.p(q,me),me[0]&8&&R(at,1)):(at=vf(q),at.c(),R(at,1),at.m(l,Ps)):at&&(Ae(),B(at,1,1,()=>{at=null}),Pe()),q[3].c.es!=null?ut?(ut.p(q,me),me[0]&8&&R(ut,1)):(ut=hf(q),ut.c(),R(ut,1),ut.m(l,Ds)):ut&&(Ae(),B(ut,1,1,()=>{ut=null}),Pe()),me[0]&8&&(Ls=q[3].p.r.startsWith("10YNO")||q[3].p.r.startsWith("10Y1001A1001A4")),Ls?ft?(ft.p(q,me),me[0]&8&&R(ft,1)):(ft=kf(q),ft.c(),R(ft,1),ft.m(l,Rs)):ft&&(Ae(),B(ft,1,1,()=>{ft=null}),Pe()),me[0]&136){xn=q[7];let Qt;for(Qt=0;Qt20||q[0].chip=="esp8266"||q[3].i.d.d>0?ct?(ct.p(q,me),me[0]&9&&R(ct,1)):(ct=Cf(q),ct.c(),R(ct,1),ct.m(l,Is)):ct&&(Ae(),B(ct,1,1,()=>{ct=null}),Pe()),me[0]&8&&(ol.checked=q[3].d.s),q[3].d.s?Lt?Lt.p(q,me):(Lt=Af(q),Lt.c(),Lt.m(Ht,null)):Lt&&(Lt.d(1),Lt=null);const da={};me[0]&2&&(da.active=q[1]),ln.$set(da);const va={};me[0]&4&&(va.active=q[2]),nn.$set(va);const ha={};me[0]&16&&(ha.active=q[4]),sn.$set(ha);const ba={};me[0]&32&&(ba.active=q[5]),on.$set(ba)},i(q){Yt||(R(c.$$.fragment,q),R(A.$$.fragment,q),R(vt.$$.fragment,q),R(Dl.$$.fragment,q),R($n.$$.fragment,q),R(Pn.$$.fragment,q),R(Rn.$$.fragment,q),R(On.$$.fragment,q),R(ot),R(rt),R(at),R(ut),R(ft),R(Yn.$$.fragment,q),R(ct),R(Xn.$$.fragment,q),R(ln.$$.fragment,q),R(nn.$$.fragment,q),R(sn.$$.fragment,q),R(on.$$.fragment,q),Yt=!0)},o(q){B(c.$$.fragment,q),B(A.$$.fragment,q),B(vt.$$.fragment,q),B(Dl.$$.fragment,q),B($n.$$.fragment,q),B(Pn.$$.fragment,q),B(Rn.$$.fragment,q),B(On.$$.fragment,q),B(ot),B(rt),B(at),B(ut),B(ft),B(Yn.$$.fragment,q),B(ct),B(Xn.$$.fragment,q),B(ln.$$.fragment,q),B(nn.$$.fragment,q),B(sn.$$.fragment,q),B(on.$$.fragment,q),Yt=!1},d(q){q&&S(e),oe(c),oe(A),dt(hi,q),oe(vt),Mt&&Mt.d(),Tt&&Tt.d(),oe(Dl),dt(bi,q),$t&&$t.d(),Nt&&Nt.d(),Et&&Et.d(),oe($n),Wt&&Wt.d(),At&&At.d(),oe(Pn),oe(Rn),Pt&&Pt.d(),oe(On),Dt&&Dt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),oe(Yn),dt(gt,q),ct&&ct.d(),oe(Xn),Lt&&Lt.d(),q&&S(Fs),oe(ln,q),q&&S(qs),oe(nn,q),q&&S(Bs),oe(sn,q),q&&S(Us),oe(on,q),js=!1,ze(pa)}}}async function q_(){await(await fetch("reboot",{method:"POST"})).json()}function B_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{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"}],u=!0,c=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};wi.subscribe(Ye=>{Ye.version&&(l(3,a=Ye),l(1,u=!1))}),l_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Ye=new URLSearchParams;Ye.append("perform","true");let ht=await(await fetch("reset",{method:"POST",body:Ye})).json();l(4,f=!1),l(5,p=ht.success)}}async function h(Ye){l(2,c=!0);const Ct=new FormData(Ye.target),ht=new URLSearchParams;for(let Rl of Ct){const[Vt,vn]=Rl;ht.append(Vt,vn)}let Ll=await(await fetch("save",{method:"POST",body:ht})).json();zt.update(Rl=>(Rl.booting=Ll.reboot,Rl.ui=a.u,Rl)),l(2,c=!1),mn(n)}const v=function(){confirm("Are you sure you want to reboot the device?")&&(zt.update(Ye=>(Ye.booting=!0,Ye)),q_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.c=!1,Ct)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.r=!1,Ct)))}async function w(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),wi.update(Ct=>(Ct.q.s.k=!1,Ct)))}const D=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function E(){a.g.h=this.value,l(3,a)}function F(){a.g.t=tt(this),l(3,a)}function I(){a.p.r=tt(this),l(3,a)}function O(){a.p.c=tt(this),l(3,a)}function C(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function le(){a.g.s=tt(this),l(3,a)}function H(){a.g.u=this.value,l(3,a)}function z(){a.g.p=this.value,l(3,a)}function U(){a.g.c=this.value,l(3,a)}function K(){a.m.a=tt(this),l(3,a)}function Q(){a.m.i=this.checked,l(3,a)}function G(){a.m.b=tt(this),l(3,a)}function X(){a.m.p=tt(this),l(3,a)}function Y(){a.m.s=ge(this.value),l(3,a)}function j(){a.m.d=tt(this),l(3,a)}function x(){a.m.f=ge(this.value),l(3,a)}function ae(){a.m.r=ge(this.value),l(3,a)}function te(){a.m.e.e=this.checked,l(3,a)}function V(){a.m.e.k=this.value,l(3,a)}function W(){a.m.e.a=this.value,l(3,a)}function we(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=ge(this.value),l(3,a)}function Ie(){a.m.m.v=ge(this.value),l(3,a)}function Se(){a.m.m.a=ge(this.value),l(3,a)}function ye(){a.m.m.c=ge(this.value),l(3,a)}function ve(){a.n.c=tt(this),l(3,a)}function $e(){a.w.s=this.value,l(3,a)}function be(){a.w.p=this.value,l(3,a)}function $(){a.w.z=tt(this),l(3,a)}function y(){a.w.w=ge(this.value),l(3,a)}function k(){a.w.b=this.checked,l(3,a)}function P(){a.n.m=tt(this),l(3,a)}function L(){a.n.i=this.value,l(3,a)}function Z(){a.n.s=tt(this),l(3,a)}function ne(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function Ce(){a.n.d=this.checked,l(3,a)}function Oe(){a.n.h=this.checked,l(3,a)}function ue(){a.n.n1=this.value,l(3,a)}function Te(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function Ot(){a.q.p=ge(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function wt(){a.q.a=this.value,l(3,a)}function nt(){a.q.c=this.value,l(3,a)}function Ft(){a.q.m=tt(this),l(3,a)}function Qe(){a.q.b=this.value,l(3,a)}function Zt(){a.o.e=this.value,l(3,a)}function Gt(){a.o.c=this.value,l(3,a)}function vt(){a.o.u1=this.value,l(3,a)}function xe(){a.o.u2=this.value,l(3,a)}function Ge(){a.o.u3=this.value,l(3,a)}function Ke(){a.h.t=this.value,l(3,a)}function Ne(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function qe(){a.c.i=this.value,l(3,a)}function Fe(){a.c.s=this.value,l(3,a)}function _e(){a.c.es=this.checked,l(3,a)}function ce(Ye){a.t.t[Ye]=ge(this.value),l(3,a)}function Be(){a.t.h=ge(this.value),l(3,a)}function pt(Ye){a.u[Ye.key]=tt(this),l(3,a)}function Nl(){a.i.h.p=tt(this),l(3,a)}function El(){a.i.h.t=tt(this),l(3,a)}function Al(){a.i.h.u=this.checked,l(3,a)}function Ai(){a.i.a=ge(this.value),l(3,a)}function ai(){a.i.l.p=ge(this.value),l(3,a)}function bl(){a.i.l.i=this.checked,l(3,a)}function Pi(){a.i.r.i=this.checked,l(3,a)}function Di(){a.i.r.r=ge(this.value),l(3,a)}function Li(){a.i.r.g=ge(this.value),l(3,a)}function yt(){a.i.r.b=ge(this.value),l(3,a)}function Ri(){a.i.d.d=ge(this.value),l(3,a)}function je(){a.i.t.d=ge(this.value),l(3,a)}function dn(){a.i.t.a=ge(this.value),l(3,a)}function Ii(){a.i.v.p=ge(this.value),l(3,a)}function Pl(){a.i.v.d.v=ge(this.value),l(3,a)}function Dl(){a.i.v.d.g=ge(this.value),l(3,a)}function Oi(){a.i.d.b=tt(this),l(3,a)}function zl(){a.i.v.o=ge(this.value),l(3,a)}function Fi(){a.i.v.m=ge(this.value),l(3,a)}function Gl(){a.i.v.b=ge(this.value),l(3,a)}function qi(){a.d.s=this.checked,l(3,a)}function gl(){a.d.t=this.checked,l(3,a)}function Bi(){a.d.l=tt(this),l(3,a)}return t.$$set=Ye=>{"basepath"in Ye&&l(15,n=Ye.basepath),"sysinfo"in Ye&&l(0,i=Ye.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,c,a,f,p,T,o,_,h,v,d,g,w,D,n,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j,x,ae,te,V,W,we,He,Ie,Se,ye,ve,$e,be,$,y,k,P,L,Z,ne,fe,de,Ce,Oe,ue,Te,Je,Ot,st,wt,nt,Ft,Qe,Zt,Gt,vt,xe,Ge,Ke,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Nl,El,Al,Ai,ai,bl,Pi,Di,Li,yt,Ri,je,dn,Ii,Pl,Dl,Oi,zl,Fi,Gl,qi,gl,Bi]}class U_ extends Re{constructor(e){super(),Le(this,e,B_,F_,Ee,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function j_(t){let e=he(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=he(n[1].chip,n[1].board)+"")&&J(l,e)},d(n){n&&S(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,u,c,a,f,p,_,h,v=Fa(t[1])+"",d,g,w=t[1].boot_reason+"",D,T,E=t[1].ex_cause+"",F,I,O;const C=[W_,H_],A=[];function le(H,z){return H[0].u>0?0:1}return a=le(t),f=A[a]=C[a](t),{c(){e=m("div"),l=N("AP MAC: "),i=N(n),o=b(),u=m("div"),c=N(`Last boot: - `),f.c(),p=b(),_=m("div"),h=N("Reason: "),d=N(v),g=N(" ("),D=N(w),T=N("/"),F=N(E),I=N(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(H,z){M(H,e,z),s(e,l),s(e,i),M(H,o,z),M(H,u,z),s(u,c),A[a].m(u,null),M(H,p,z),M(H,_,z),s(_,h),s(_,d),s(_,g),s(_,D),s(_,T),s(_,F),s(_,I),O=!0},p(H,z){(!O||z&2)&&n!==(n=H[1].apmac+"")&&J(i,n);let U=a;a=le(H),a===U?A[a].p(H,z):(Ae(),B(A[U],1,1,()=>{A[U]=null}),Pe(),f=A[a],f?f.p(H,z):(f=A[a]=C[a](H),f.c()),R(f,1),f.m(u,null)),(!O||z&2)&&v!==(v=Fa(H[1])+"")&&J(d,v),(!O||z&2)&&w!==(w=H[1].boot_reason+"")&&J(D,w),(!O||z&2)&&E!==(E=H[1].ex_cause+"")&&J(F,E)},i(H){O||(R(f),O=!0)},o(H){B(f),O=!1},d(H){H&&S(e),H&&S(o),H&&S(u),A[a].d(),H&&S(p),H&&S(_)}}}function H_(t){let e;return{c(){e=N("-")},m(l,n){M(l,e,n)},p:pe,i:pe,o:pe,d(l){l&&S(e)}}}function W_(t){let e,l;return e=new i1({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function z_(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:pe,d(l){l&&S(e)}}}function Rf(t){let e,l,n,i,o,u=ks(t[1].meter.mfg)+"",c,a,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,v,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",D;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=N("Manufacturer: "),c=N(u),a=b(),f=m("div"),p=N("Model: "),h=N(_),v=b(),d=m("div"),g=N("ID: "),D=N(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(T,E){M(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,D)},p(T,E){E&2&&u!==(u=ks(T[1].meter.mfg)+"")&&J(c,u),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&J(h,_),E&2&&w!==(w=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&J(D,w)},d(T){T&&S(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",c,a,f,p,_=t[1].net.mask+"",h,v,d,g,w=t[1].net.gw+"",D,T,E,F,I=t[1].net.dns1+"",O,C,A=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=N("IP: "),c=N(u),a=b(),f=m("div"),p=N("Mask: "),h=N(_),v=b(),d=m("div"),g=N("Gateway: "),D=N(w),T=b(),E=m("div"),F=N("DNS: "),O=N(I),C=b(),A&&A.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(le,H){M(le,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,D),s(e,T),s(e,E),s(E,F),s(E,O),s(E,C),A&&A.m(E,null)},p(le,H){H&2&&u!==(u=le[1].net.ip+"")&&J(c,u),H&2&&_!==(_=le[1].net.mask+"")&&J(h,_),H&2&&w!==(w=le[1].net.gw+"")&&J(D,w),H&2&&I!==(I=le[1].net.dns1+"")&&J(O,I),le[1].net.dns2?A?A.p(le,H):(A=Of(le),A.c(),A.m(E,null)):A&&(A.d(1),A=null)},d(le){le&&S(e),A&&A.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&J(n,l)},d(i){i&&S(e),i&&S(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.f+"",o,u,c=t[1].upgrade.t+"",a,f,p=Oa(t[1].upgrade.e)+"",_;return{c(){e=m("div"),l=m("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),a=N(c),f=N(" failed. "),_=N(p),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(h,v){M(h,e,v),s(e,l),s(l,n),s(l,o),s(l,u),s(l,a),s(l,f),s(l,_)},p(h,v){v&2&&i!==(i=h[1].upgrade.f+"")&&J(o,i),v&2&&c!==(c=h[1].upgrade.t+"")&&J(a,c),v&2&&p!==(p=Oa(h[1].upgrade.e)+"")&&J(_,p)},d(h){h&&S(e)}}}function qf(t){let e,l,n,i=t[2].tag_name+"",o,u,c,a,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Bf(t),h=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=N(`Latest version: - `),n=m("a"),o=N(i),c=b(),_&&_.c(),a=b(),h&&h.c(),f=Ve(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,c),_&&_.m(e,null),M(v,a,d),h&&h.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&4)&&i!==(i=v[2].tag_name+"")&&J(o,i),(!p||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?_?(_.p(v,d),d&7&&R(_,1)):(_=Bf(v),_.c(),R(_,1),_.m(e,null)):_&&(Ae(),B(_,1,1,()=>{_=null}),Pe()),v[1].fwconsent===2?h||(h=Uf(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(v){p||(R(_),p=!0)},o(v){B(_),p=!1},d(v){v&&S(e),_&&_.d(),v&&S(a),h&&h.d(v),v&&S(f)}}}function Bf(t){let e,l,n,i,o,u;return n=new s1({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(c,a){M(c,e,a),s(e,l),se(n,l,null),i=!0,o||(u=ee(l,"click",t[10]),o=!0)},p:pe,i(c){i||(R(n.$$.fragment,c),i=!0)},o(c){B(n.$$.fragment,c),i=!1},d(c){c&&S(e),oe(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function jf(t){let e,l=ws(he(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ws(he(i[1].chip,i[1].board))+"")&&J(n,l)},d(i){i&&S(e)}}}function Hf(t){let e,l,n,i,o,u;function c(p,_){return p[4].length==0?V_:G_}let a=c(t),f=a(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),f.c(),vo(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(p,_){a===(a=c(p))&&f?f.p(p,_):(f.d(1),f=a(p),f&&(f.c(),f.m(l,null)))},d(p){p&&S(e),t[12](null),f.d(),o=!1,ze(u)}}}function G_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&J(l,e)},d(o){o&&S(l),o&&S(n),o&&S(i)}}}function V_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:pe,d(i){i&&S(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g=t[9],w=[];for(let I=0;I Include Secrets
(SSID, PSK, passwords and tokens)',a=b(),D&&D.c(),f=b(),p=m("form"),_=m("input"),h=b(),F.c(),r(l,"class","text-sm"),r(c,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),vo(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(I,O){M(I,e,O),s(e,l),s(e,n),s(e,i),s(i,o);for(let C=0;C{P=null}),Pe());const Ot={};Te&8388608&&(Ot.$$scope={dirty:Te,ctx:ue}),le.$set(Ot),ue[1].meter?L?L.p(ue,Te):(L=Rf(ue),L.c(),L.m(e,K)):L&&(L.d(1),L=null),ue[1].net?Z?Z.p(ue,Te):(Z=If(ue),Z.c(),Z.m(e,Q)):Z&&(Z.d(1),Z=null),(!$||Te&2)&&ae!==(ae=ue[1].version+"")&&J(te,ae),ue[1].upgrade.t&&ue[1].upgrade.t!=ue[1].version?ne?ne.p(ue,Te):(ne=Ff(ue),ne.c(),ne.m(G,W)):ne&&(ne.d(1),ne=null),ue[2]?fe?(fe.p(ue,Te),Te&4&&R(fe,1)):(fe=qf(ue),fe.c(),R(fe,1),fe.m(G,we)):fe&&(Ae(),B(fe,1,1,()=>{fe=null}),Pe()),Te&3&&(He=(ue[1].security==0||ue[0].a)&&ii(ue[1].board)),He?de?de.p(ue,Te):(de=jf(ue),de.c(),de.m(G,Ie)):de&&(de.d(1),de=null),ue[1].security==0||ue[0].a?Ce?Ce.p(ue,Te):(Ce=Hf(ue),Ce.c(),Ce.m(G,null)):Ce&&(Ce.d(1),Ce=null),ue[1].security==0||ue[0].a?Oe?Oe.p(ue,Te):(Oe=Wf(ue),Oe.c(),Oe.m(e,null)):Oe&&(Oe.d(1),Oe=null);const st={};Te&32&&(st.active=ue[5]),ve.$set(st);const wt={};Te&256&&(wt.active=ue[8]),be.$set(wt)},i(ue){$||(R(w.$$.fragment,ue),R(P),R(le.$$.fragment,ue),R(fe),R(ve.$$.fragment,ue),R(be.$$.fragment,ue),$=!0)},o(ue){B(w.$$.fragment,ue),B(P),B(le.$$.fragment,ue),B(fe),B(ve.$$.fragment,ue),B(be.$$.fragment,ue),$=!1},d(ue){ue&&S(e),oe(w),P&&P.d(),oe(le),L&&L.d(),Z&&Z.d(),ne&&ne.d(),fe&&fe.d(),de&&de.d(),Ce&&Ce.d(),Oe&&Oe.d(),ue&&S(ye),oe(ve,ue),ue&&S($e),oe(be,ue),y=!1,k()}}}async function X_(){await(await fetch("reboot",{method:"POST"})).json()}function Z_(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 API",key:"is"}],u={};To.subscribe(C=>{l(2,u=n1(i.version,C)),u||l(2,u=C[0])});function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ws(he(i.chip,i.board))))&&(zt.update(C=>(C.upgrading=!0,C)),l1(u.tag_name))}const a=function(){confirm("Are you sure you want to reboot the device?")&&(zt.update(C=>(C.booting=!0,C)),X_())};let f,p=[],_=!1,h,v=[],d=!1;yo();function g(C){bs[C?"unshift":"push"](()=>{f=C,l(3,f)})}function w(){p=this.files,l(4,p)}const D=()=>{f.click()},T=()=>l(5,_=!0);function E(C){bs[C?"unshift":"push"](()=>{h=C,l(6,h)})}function F(){v=this.files,l(7,v)}const I=()=>{h.click()},O=()=>l(8,d=!0);return t.$$set=C=>{"data"in C&&l(0,n=C.data),"sysinfo"in C&&l(1,i=C.sysinfo)},[n,i,u,f,p,_,h,v,d,o,c,a,g,w,D,T,E,F,I,O]}class J_ extends Re{constructor(e){super(),Le(this,e,Z_,Q_,Ee,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],5)+"",c,a,f=he(t[0],4)+"",p,_,h=he(t[0],3)+"",v,d,g,w,D=he(t[0],2)+"",T,E,F=he(t[0],1)+"",I,O,C=he(t[0],0)+"",A,le,H,z,U=he(t[0],101)+"",K,Q,G=he(t[0],100)+"",X;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),v=N(h),d=b(),g=m("optgroup"),w=m("option"),T=N(D),E=m("option"),I=N(F),O=m("option"),A=N(C),le=b(),H=m("optgroup"),z=m("option"),K=N(U),Q=m("option"),X=N(G),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,a.__value=4,a.value=a.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,O.__value=0,O.value=O.__value,r(g,"label","Custom hardware"),z.__value=101,z.value=z.__value,Q.__value=100,Q.value=Q.__value,r(H,"label","Generic hardware")},m(Y,j){M(Y,e,j),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,v),M(Y,d,j),M(Y,g,j),s(g,w),s(w,T),s(g,E),s(E,I),s(g,O),s(O,A),M(Y,le,j),M(Y,H,j),s(H,z),s(z,K),s(H,Q),s(Q,X)},p(Y,j){j&1&&n!==(n=he(Y[0],7)+"")&&J(i,n),j&1&&u!==(u=he(Y[0],5)+"")&&J(c,u),j&1&&f!==(f=he(Y[0],4)+"")&&J(p,f),j&1&&h!==(h=he(Y[0],3)+"")&&J(v,h),j&1&&D!==(D=he(Y[0],2)+"")&&J(T,D),j&1&&F!==(F=he(Y[0],1)+"")&&J(I,F),j&1&&C!==(C=he(Y[0],0)+"")&&J(A,C),j&1&&U!==(U=he(Y[0],101)+"")&&J(K,U),j&1&&G!==(G=he(Y[0],100)+"")&&J(X,G)},d(Y){Y&&S(e),Y&&S(d),Y&&S(g),Y&&S(le),Y&&S(H)}}}function Kf(t){let e,l,n=he(t[0],201)+"",i,o,u=he(t[0],202)+"",c,a,f=he(t[0],203)+"",p,_,h=he(t[0],241)+"",v,d,g=he(t[0],242)+"",w,D,T=he(t[0],243)+"",E,F,I=he(t[0],200)+"",O;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),v=N(h),d=m("option"),w=N(g),D=m("option"),E=N(T),F=m("option"),O=N(I),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,a.__value=203,a.value=a.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,D.__value=243,D.value=D.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(C,A){M(C,e,A),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,v),s(e,d),s(d,w),s(e,D),s(D,E),s(e,F),s(F,O)},p(C,A){A&1&&n!==(n=he(C[0],201)+"")&&J(i,n),A&1&&u!==(u=he(C[0],202)+"")&&J(c,u),A&1&&f!==(f=he(C[0],203)+"")&&J(p,f),A&1&&h!==(h=he(C[0],241)+"")&&J(v,h),A&1&&g!==(g=he(C[0],242)+"")&&J(w,g),A&1&&T!==(T=he(C[0],243)+"")&&J(E,T),A&1&&I!==(I=he(C[0],200)+"")&&J(O,I)},d(C){C&&S(e)}}}function Yf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],6)+"",c,a,f=he(t[0],5)+"",p,_,h,v,d=he(t[0],51)+"",g,w,D=he(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=b(),h=m("optgroup"),v=m("option"),g=N(d),w=m("option"),T=N(D),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,a.__value=5,a.value=a.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(h,"label","Generic hardware")},m(E,F){M(E,e,F),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),M(E,_,F),M(E,h,F),s(h,v),s(v,g),s(h,w),s(w,T)},p(E,F){F&1&&n!==(n=he(E[0],7)+"")&&J(i,n),F&1&&u!==(u=he(E[0],6)+"")&&J(c,u),F&1&&f!==(f=he(E[0],5)+"")&&J(p,f),F&1&&d!==(d=he(E[0],51)+"")&&J(g,d),F&1&&D!==(D=he(E[0],50)+"")&&J(T,D)},d(E){E&&S(e),E&&S(_),E&&S(h)}}}function Qf(t){let e,l,n=he(t[0],8)+"",i,o,u,c,a=he(t[0],71)+"",f,p,_=he(t[0],70)+"",h;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=b(),u=m("optgroup"),c=m("option"),f=N(a),p=m("option"),h=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),c.__value=71,c.value=c.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,u,d),s(u,c),s(c,f),s(u,p),s(p,h)},p(v,d){d&1&&n!==(n=he(v[0],8)+"")&&J(i,n),d&1&&a!==(a=he(v[0],71)+"")&&J(f,a),d&1&&_!==(_=he(v[0],70)+"")&&J(h,_)},d(v){v&&S(e),v&&S(o),v&&S(u)}}}function Xf(t){let e,l,n=he(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],200)+"")&&J(i,n)},d(o){o&&S(e)}}}function Zf(t){let e,l,n=he(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],80)+"")&&J(i,n)},d(o){o&&S(e)}}}function x_(t){let e,l,n,i,o,u,c,a,f=t[0]=="esp8266"&&Vf(t),p=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),h=t[0]=="esp32c3"&&Qf(t),v=t[0]=="esp32solo"&&Xf(t),d=t[0]=="esp32s3"&&Zf(t);return{c(){e=m("option"),l=b(),f&&f.c(),n=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),h&&h.c(),u=b(),v&&v.c(),c=b(),d&&d.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),h&&h.m(g,w),M(g,u,w),v&&v.m(g,w),M(g,c,w),d&&d.m(g,w),M(g,a,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Vf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Kf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Yf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?h?h.p(g,w):(h=Qf(g),h.c(),h.m(u.parentNode,u)):h&&(h.d(1),h=null),g[0]=="esp32solo"?v?v.p(g,w):(v=Xf(g),v.c(),v.m(c.parentNode,c)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Zf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i:pe,o:pe,d(g){g&&S(e),g&&S(l),f&&f.d(g),g&&S(n),p&&p.d(g),g&&S(i),_&&_.d(g),g&&S(o),h&&h.d(g),g&&S(u),v&&v.d(g),g&&S(c),d&&d.d(g),g&&S(a)}}}function ep(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class tp extends Re{constructor(e){super(),Le(this,e,ep,x_,Ee,{chip:0})}}function Jf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function xf(t){let e,l,n,i,o,u,c;return u=new ao({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=b(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),c=!0},p(a,f){const p={};f&1&&(p.chip=a[0].chip),u.$set(p)},i(a){c||(R(u.$$.fragment,a),c=!0)},o(a){B(u.$$.fragment,a),c=!1},d(a){a&&S(e),oe(u)}}}function lp(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q=t[0].usrcfg&&Jf();d=new tp({props:{chip:t[0].chip}});let G=t[0].board&&t[0].board>20&&xf(t);return H=new kt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",c=b(),Q&&Q.c(),a=b(),f=m("div"),p=N("Board type"),_=m("br"),h=b(),v=m("select"),re(d.$$.fragment),g=b(),G&&G.c(),w=b(),D=m("div"),T=m("label"),E=m("input"),F=N(" Clear all other configuration"),I=b(),O=m("div"),O.innerHTML='',C=b(),A=m("span"),A.textContent="\xA0",le=b(),re(H.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&We(()=>t[5].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(D,"class","my-3"),r(O,"class","my-3"),r(A,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(X,Y){M(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),Q&&Q.m(n,null),s(n,a),s(n,f),s(f,p),s(f,_),s(f,h),s(f,v),se(d,v,null),Me(v,t[0].board,!0),s(n,g),G&&G.m(n,null),s(n,w),s(n,D),s(D,T),s(T,E),E.checked=t[2],s(T,F),s(n,I),s(n,O),s(n,C),s(n,A),M(X,le,Y),se(H,X,Y),z=!0,U||(K=[ee(v,"change",t[5]),ee(E,"change",t[6]),ee(n,"submit",Mi(t[3]))],U=!0)},p(X,[Y]){X[0].usrcfg?Q||(Q=Jf(),Q.c(),Q.m(n,a)):Q&&(Q.d(1),Q=null);const j={};Y&1&&(j.chip=X[0].chip),d.$set(j),Y&1&&Me(v,X[0].board),X[0].board&&X[0].board>20?G?(G.p(X,Y),Y&1&&R(G,1)):(G=xf(X),G.c(),R(G,1),G.m(n,w)):G&&(Ae(),B(G,1,1,()=>{G=null}),Pe()),Y&4&&(E.checked=X[2]);const x={};Y&2&&(x.active=X[1]),H.$set(x)},i(X){z||(R(d.$$.fragment,X),R(G),R(H.$$.fragment,X),z=!0)},o(X){B(d.$$.fragment,X),B(G),B(H.$$.fragment,X),z=!1},d(X){X&&S(e),Q&&Q.d(),oe(d),G&&G.d(),X&&S(le),oe(H,X),U=!1,ze(K)}}}function np(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){l(1,o=!0);const _=new FormData(p.target),h=new URLSearchParams;for(let g of _){const[w,D]=g;h.append(w,D)}let d=await(await fetch("save",{method:"POST",body:h})).json();l(1,o=!1),zt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),mn(n+(i.usrcfg?"/":"/setup"))}let c=!1;zt.subscribe(p=>{l(0,i=p),p.fwconsent===1&&l(2,c=!i.usrcfg)});function a(){i.board=tt(this),l(0,i)}function f(){c=this.checked,l(2,c)}return t.$$set=p=>{"basepath"in p&&l(4,n=p.basepath),"sysinfo"in p&&l(0,i=p.sysinfo)},[i,o,c,u,n,a,f]}class ip extends Re{constructor(e){super(),Le(this,e,np,lp,Ee,{basepath:4,sysinfo:0})}}function ec(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function tc(t){let e,l,n,i,o,u,c,a,f,p,_,h,v;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),c=b(),a=m("div"),f=N("PSK"),p=m("br"),_=b(),h=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(h,"name","sp"),r(h,"type","password"),r(h,"class","in-s"),r(h,"autocomplete","off"),h.required=v=t[2]==2,r(a,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,c,g),M(d,a,g),s(a,f),s(a,p),s(a,_),s(a,h)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(h.required=v)},d(d){d&&S(e),d&&S(c),d&&S(a)}}}function lc(t){let e,l,n,i,o,u,c,a;return c=new a1({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),re(c.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),se(c,u,null),a=!0},p(f,p){(!a||p&2)&&(i.required=f[1]),(!a||p&2)&&(u.required=f[1])},i(f){a||(R(c.$$.fragment,f),a=!0)},o(f){B(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(l),f&&S(n),oe(c)}}}function nc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",u=ko(t),c=kc(e)?e(u):e;return`<${u}> ${c}${o}`}const Rc=t=>(...e)=>t(U1(...e)),Ic=Rc(t=>{throw new Error(t)}),bs=Rc(console.warn),Ma=4,j1=3,H1=2,W1=1,z1=1;function G1(t,e){const l=t.default?0:bl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ma,P1(i)?o+=z1:D1(i)?o+=H1:Nc(i)?o-=Ma+W1:o+=j1,o},0);return{route:t,score:l,index:e}}function V1(t){return t.map(G1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Oc(t,e){let l,n;const[i]=e.split("?"),o=bl(i),u=o[0]==="",c=V1(t);for(let a=0,f=c.length;a({...p,params:v,uri:D});if(p.default){n=h(e);continue}const d=bl(p.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w{f===".."?a.pop():f!=="."&&a.push(f)}),Ws(`/${a.join("/")}`,n)}function Ta(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=bl(e,!0),c=bl(l,!0);for(;u.length;)u[0]!==c[0]&&Ic(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),c.shift();return{pathname:Ti(...c),hash:n,search:i,state:o}}const $a=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?$a(vi(t,l)):"",u=i?vi(t,0,l):t,c=n?$a(vi(u,e)):"";return{pathname:(n?vi(u,0,e):u)||"/",search:c,hash:o}},Y1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Q1(t,e,l){return Ti(l,K1(t,e))}function X1(t,e){const l=bo(L1(t)),n=bl(l,!0),i=bl(e,!0).slice(0,n.length),o=Fc({fullPath:l},Ti(...i));return o&&o.uri}const zs="POP",Z1="PUSH",J1="REPLACE";function Gs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function x1(t){let e=[],l=Gs(t),n=zs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Gs(t),n=zs,i([o])};i([o]);const c=Cc(t,"popstate",u);return()=>{c(),e=e.filter(a=>a!==o)}},navigate(o,u){const{state:c={},replace:a=!1}=u||{};if(n=a?J1:Z1,wc(o))u&&bs(Lc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=zs,t.history.go(o);else{const f={...c,_key:$1()};try{t.history[a?"replaceState":"pushState"](f,"",o)}catch{t.location[a?"replace":"assign"](o)}}l=Gs(t),i()}}}function Vs(t,e){return{...wo(e),state:t}}function e0(t="/"){let e=0,l=[Vs(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(Vs(n,o))},replaceState(n,i,o){l[e]=Vs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const t0=!!(!Hl&&window.document&&window.document.createElement),l0=!Hl&&window.location.origin==="null",Bc=x1(t0&&!l0?window:e0()),{navigate:cn}=Bc;let Tl=null,qc=!0;function n0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&n0(t.routerId,Tl.routerId))&&(Tl=t)}function s0(){Tl=null}function o0(){qc=!1}function Na(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=Cc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function r0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function a0(t){return/^H[1-6]$/i.test(t.tagName)}function Ea(t,e=document){return e.querySelector(t)}function u0(t){let l=Ea(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!r0(l,t);){if(a0(l))return l;const n=Ea("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function f0(t){Promise.resolve(ni(t.focusElement)).then(e=>{const l=e||u0(t.id);l||bs(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,ws),!Na(l)&&Na(document.documentElement)})}const c0=(t,e,l)=>(n,i)=>y1().then(()=>{if(!Tl||qc){o0();return}if(n&&f0(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:c,params:a,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:c,params:a,uri:f},ni(l));Promise.resolve(p).then(_=>{e.set(_)})}s0()}),m0="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 _0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Sc(t[6],m0)],i={};for(let o=0;o`Navigated to ${re.uri}`,announcements:!0,...d},D=p,T=bo(p),E=jl(Xs),F=jl(si),O=!E,R=d0(),y=h&&!(F&&!F.manageFocus),A=it("");hl(t,A,re=>l(0,c=re));const te=F?F.disableInlineStyles:g,W=it([]);hl(t,W,re=>l(20,u=re));const j=it(null);hl(t,j,re=>l(18,i=re));let U=!1;const K=O?0:F.level+1,G=O?it((()=>Ta(Hl?wo(_):v.location,T))()):E;hl(t,G,re=>l(17,n=re));const Z=it(n);hl(t,Z,re=>l(19,o=re));const V=c0(w,A,G),H=re=>Q=>Q.filter(z=>z.id!==re);function x(re){if(Hl){if(U)return;const Q=Fc(re,n.pathname);if(Q)return U=!0,Q}else W.update(Q=>{const z=H(re.id)(Q);return z.push(re),z})}function ue(re){W.update(H(re))}return!O&&p!==Aa&&bs(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),O&&(dc(()=>v.listen(Q=>{const z=Ta(Q.location,T);Z.set(n),G.set(z)})),wi(Xs,G)),wi(si,{activeRoute:j,registerRoute:x,unregisterRoute:ue,manageFocus:y,level:K,id:R,history:O?v:F.history,basepath:O?T:F.basepath,disableInlineStyles:te}),t.$$set=re=>{"basepath"in re&&l(11,p=re.basepath),"url"in re&&l(12,_=re.url),"history"in re&&l(13,v=re.history),"primary"in re&&l(14,h=re.primary),"a11y"in re&&l(15,d=re.a11y),"disableInlineStyles"in re&&l(16,g=re.disableInlineStyles),"$$scope"in re&&l(21,f=re.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==D&&bs(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const re=Oc(u,n.pathname);j.set(re)}if(t.$$.dirty[0]&655360&&O){const re=!!n.hash,Q=!re&&y,z=!re||n.pathname!==o.pathname;V(Q,z)}t.$$.dirty[0]&262144&&y&&i&&i.primary&&i0({level:K,routerId:R,route:i})},[c,w,O,R,y,A,te,W,j,G,Z,p,_,v,h,d,g,n,i,o,u,f,a]}class v0 extends Re{constructor(e){super(),Le(this,e,h0,p0,Ee,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Uc=v0;function $i(t,e,l=si,n=mn){jl(l)||Ic(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const b0=t=>{const{subscribe:e}=jl(t);return{subscribe:e}};function jc(){return $i(Ac),b0(Xs)}function Hc(){const{history:t}=jl(si);return t}function Wc(){const t=jl(Tc);return t?N1(t,e=>e.base):it("/")}function zc(){$i(Dc);const t=Wc(),{basepath:e}=jl(si);return n=>Q1(n,ni(t),e)}function g0(){$i(Pc);const t=zc(),{navigate:e}=Hc();return(n,i)=>{const o=wc(n)?n:t(n);return e(o,i)}}const k0=t=>({params:t&16,location:t&8}),Pa=t=>({params:Hl?ni(t[10]):t[4],location:t[3],navigate:t[11]});function Da(t){let e,l;return e=new Uc({props:{primary:t[1],$$slots:{default:[C0]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(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||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function w0(t){let e;const l=t[18].default,n=co(l,t,t[19],Pa);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&_o(n,l,i,i[19],e?mo(l,i[19],o,k0):po(i[19]),Pa)},i(i){e||(I(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function y0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Hl?ni(t[10]):t[4],t[12]];var o=t[0];function u(c){let a={};for(let f=0;f{ie(p,1)}),Pe()}o?(e=wa(o,u()),se(e.$$.fragment),I(e.$$.fragment,1),ne(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(c){n||(e&&I(e.$$.fragment,c),n=!0)},o(c){e&&q(e.$$.fragment,c),n=!1},d(c){c&&S(l),e&&ie(e,c)}}}function C0(t){let e,l,n,i;const o=[y0,w0],u=[];function c(a,f){return a[0]!==null?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),q(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),I(l,1),l.m(n.parentNode,n))},i(a){i||(I(l),i=!0)},o(a){q(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function S0(t){let e,l,n,i,o,u=[Qs(t[7]),{"data-svnav-route-start":t[5]}],c={};for(let _=0;_{a=null}),Pe())},i(_){o||(I(a),o=!0)},o(_){q(a),o=!1},d(_){_&&S(e),_&&S(l),a&&a.d(_),_&&S(n),_&&S(i)}}}const M0=yc();function T0(t,e,l){let n;const i=["path","component","meta","primary"];let o=hs(e,i),u,c,a,f,{$$slots:p={},$$scope:_}=e,{path:v=""}=e,{component:h=null}=e,{meta:d={}}=e,{primary:g=!0}=e;$i(ws,e);const w=M0(),{registerRoute:D,unregisterRoute:T,activeRoute:E,disableInlineStyles:F}=jl(si);hl(t,E,U=>l(16,u=U));const O=Wc();hl(t,O,U=>l(17,a=U));const R=jc();hl(t,R,U=>l(3,c=U));const y=it(null);let A;const te=it(),W=it({});hl(t,W,U=>l(4,f=U)),wi(Tc,te),wi(E1,W),wi(A1,y);const j=g0();return Hl||k1(()=>T(w)),t.$$set=U=>{l(24,e=rl(rl({},e),ds(U))),l(12,o=hs(e,i)),"path"in U&&l(13,v=U.path),"component"in U&&l(0,h=U.component),"meta"in U&&l(14,d=U.meta),"primary"in U&&l(1,g=U.primary),"$$scope"in U&&l(19,_=U.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const U=v==="",K=Ti(a,v),Y={id:w,path:v,meta:d,default:U,fullPath:U?"":K,base:U?a:X1(K,c.pathname),primary:g,focusElement:y};te.set(Y),l(15,A=D(Y))}if(t.$$.dirty&98304&&l(2,n=!!(A||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:U}=A||u;W.set(U)}},e=ds(e),[h,g,n,c,f,w,E,F,O,R,W,j,o,v,d,A,u,a,p,_]}class $0 extends Re{constructor(e){super(),Le(this,e,T0,S0,Ee,{path:13,component:0,meta:14,primary:1})}}const pl=$0;function N0(t){let e,l,n,i;const o=t[13].default,u=co(o,t,t[12],null);let c=[{href:t[0]},t[2],t[1]],a={};for(let f=0;fl(11,_=y));const E=w1(),F=zc(),{navigate:O}=Hc();function R(y){E("click",y),T1(y)&&(y.preventDefault(),O(n,{state:w,replace:u||g}))}return t.$$set=y=>{l(19,e=rl(rl({},e),ds(y))),l(18,p=hs(e,f)),"to"in y&&l(5,d=y.to),"replace"in y&&l(6,g=y.replace),"state"in y&&l(7,w=y.state),"getProps"in y&&l(8,D=y.getProps),"$$scope"in y&&l(12,h=y.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(d,_)),t.$$.dirty&2049&&l(10,i=Zs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===Y1(_)),t.$$.dirty&512&&l(2,c=o?{"aria-current":"page"}:{}),l(1,a=(()=>{if(kc(D)){const y=D({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...y}}return p})())},e=ds(e),[n,a,c,T,R,d,g,w,D,o,i,_,h,v]}class A0 extends Re{constructor(e){super(),Le(this,e,E0,N0,Ee,{to:5,replace:6,state:7,getProps:8})}}const Xt=A0;let Js=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function P0(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Gc(t,e){let l;return e?t>90?l="#d90000":t>85?l="#e31000":t>80?l="#ffa900":t>75?l="#dcc300":l="#32c500":t>90?l="#d90000":t>85?l="#e32100":t>80?l="#ffb800":t>75?l="#dcd800":l="#32d900",l}function D0(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function gs(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 Ue(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(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 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"\xB5HAN 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"}}function La(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ra(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Ia(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Oa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function li(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Xe(t,e){return t==1||t==2&&e}function Rt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ke(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function vl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Ba(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function qa(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function $l(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 dl={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}};const Wt=it(dl);async function yo(){dl=await(await $l("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Wt.set(dl)}let cs=0,Ua=-127,ja=null,L0={};const Vc=Mc(L0,t=>{let e;async function l(){$l("data.json").then(n=>n.json()).then(n=>{t(n),Ua!=n.t&&(Ua=n.t,setTimeout(Zc,2e3)),ja==null&&n.pe&&n.p!=null&&(ja=n.p,Yc()),dl.upgrading?window.location.reload():(!dl||!dl.chip||dl.booting||cs>1&&!li(dl.board))&&(yo(),rn&&clearTimeout(rn),rn=setTimeout(So,2e3),an&&clearTimeout(an),an=setTimeout(Mo,3e3));let i=5e3;if(li(dl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),cs=0}).catch(n=>{cs++,cs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,li(dl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let xs={},bi;const Co=it(xs);async function Kc(){let t=!1;if(Co.update(e=>{for(var l=0;l<36;l++){if(e[Ue(l)]==null){t=l<12;break}e[Ue(l)]=e[Ue(l+1)]}return e}),t)Yc();else{let e=new Date;bi=setTimeout(Kc,(60-e.getMinutes())*6e4)}}async function Yc(){bi&&(clearTimeout(bi),bi=0),xs=await(await $l("energyprice.json")).json(),Co.set(xs);let e=new Date;bi=setTimeout(Kc,(60-e.getMinutes())*6e4)}let eo={},rn;async function So(){rn&&(clearTimeout(rn),rn=0),eo=await(await $l("dayplot.json")).json(),Qc.set(eo);let e=new Date;rn=setTimeout(So,(60-e.getMinutes())*6e4+20)}const Qc=it(eo,t=>(So(),function(){}));let to={},an;async function Mo(){an&&(clearTimeout(an),an=0),to=await(await $l("monthplot.json")).json(),Xc.set(to);let e=new Date;an=setTimeout(Mo,(24-e.getHours())*36e5+40)}const Xc=it(to,t=>(Mo(),function(){}));let lo={};async function Zc(){lo=await(await $l("temperature.json")).json(),Jc.set(lo)}const Jc=it(lo,t=>(Zc(),function(){}));let no={},ms;async function xc(){ms&&(clearTimeout(ms),ms=0),no=await(await $l("tariff.json")).json(),e1.set(no);let e=new Date;ms=setTimeout(xc,(60-e.getMinutes())*6e4+30)}const e1=it(no,t=>function(){});let io=[];const To=it(io);async function R0(){io=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),To.set(io)}let so={};async function I0(){so=await(await $l("realtime.json")).json(),t1.set(so)}const t1=it(so,t=>(I0(),function(){}));function ks(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 l1(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function n1(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let c,a,f;for(let p=0;po&&(c=_):g==i+1&&(a=_);else if(d==n+1)if(f){let D=f.tag_name.substring(1).split(".");parseInt(D[0]);let T=parseInt(D[1]);parseInt(D[2]),g==T&&(f=_)}else f=_}return a||f||c||!1}else return e[0]}const Ha="/github.svg";function Wa(t){let e,l;function n(u,c){return u[1]>1?H0:u[1]>0?j0:u[2]>1?U0:u[2]>0?q0:u[3]>1?B0:u[3]>0?F0:O0}let i=n(t),o=i(t);return{c(){e=N(`Up + `),o.c(),l=Ke()},m(u,c){M(u,e,c),o.m(u,c),M(u,l,c)},p(u,c){i===(i=n(u))&&o?o.p(u,c):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&S(e),o.d(u),u&&S(l)}}}function O0(t){let e,l;return{c(){e=N(t[0]),l=N(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&J(e,n[0])},d(n){n&&S(e),n&&S(l)}}}function F0(t){let e,l;return{c(){e=N(t[3]),l=N(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function B0(t){let e,l;return{c(){e=N(t[3]),l=N(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&S(e),n&&S(l)}}}function q0(t){let e,l;return{c(){e=N(t[2]),l=N(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function U0(t){let e,l;return{c(){e=N(t[2]),l=N(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&S(e),n&&S(l)}}}function j0(t){let e,l;return{c(){e=N(t[1]),l=N(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function H0(t){let e,l;return{c(){e=N(t[1]),l=N(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&S(e),n&&S(l)}}}function W0(t){let e,l=t[0]&&Wa(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Wa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function z0(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class G0 extends Re{constructor(e){super(),Le(this,e,z0,W0,Ee,{epoch:0})}}function V0(t){let e,l,n;return{c(){e=m("span"),l=N(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&J(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:pe,o:pe,d(i){i&&S(e)}}}function K0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class un extends Re{constructor(e){super(),Le(this,e,K0,V0,Ee,{color:0,title:1,text:2})}}function Y0(t){let e,l=`${Ue(t[0].getDate())}.${Ue(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=N(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ue(i[0].getDate())}.${Ue(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ue(i[0].getHours())}:${Ue(i[0].getMinutes())}`)&&J(n,l),o&2&&r(e,"class",i[1])},d(i){i&&S(e)}}}function Q0(t){let e=`${Ue(t[0].getDate())}. ${Js[t[0].getMonth()]} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Ue(n[0].getDate())}. ${Js[n[0].getMonth()]} ${Ue(n[0].getHours())}:${Ue(n[0].getMinutes())}`)&&J(l,e)},d(n){n&&S(l)}}}function X0(t){let e;function l(o,u){return o[2]?Q0:Y0}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:pe,o:pe,d(o){i.d(o),o&&S(e)}}}function Z0(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=c=>{"timestamp"in c&&l(0,n=c.timestamp),"fullTimeColor"in c&&l(1,i=c.fullTimeColor),"offset"in c&&l(3,o=c.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||vl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class i1 extends Re{constructor(e){super(),Le(this,e,Z0,X0,Ee,{timestamp:0,fullTimeColor:1,offset:3})}}function J0(t){let e,l,n;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:pe,i:pe,o:pe,d(i){i&&S(e)}}}class x0 extends Re{constructor(e){super(),Le(this,e,null,J0,Ee,{})}}function em(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class tm extends Re{constructor(e){super(),Le(this,e,null,em,Ee,{})}}function lm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(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"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class Lt extends Re{constructor(e){super(),Le(this,e,null,lm,Ee,{})}}function nm(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&S(e)}}}class s1 extends Re{constructor(e){super(),Le(this,e,null,nm,Ee,{})}}function im(t){let e,l,n=t[2].version+"",i;return{c(){e=N("AMS reader "),l=m("span"),i=N(n)},m(o,u){M(o,e,u),M(o,l,u),s(l,i)},p(o,u){u&4&&n!==(n=o[2].version+"")&&J(i,n)},d(o){o&&S(e),o&&S(l)}}}function za(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=N(l),i=N("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&J(n,l)},d(o){o&&S(e)}}}function Ga(t){let e,l="HAN: "+La(t[1].he),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="HAN: "+La(i[1].he))&&J(n,l)},d(i){i&&S(e)}}}function Va(t){let e,l="MQTT: "+Ra(t[1].me),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="MQTT: "+Ra(i[1].me))&&J(n,l)},d(i){i&&S(e)}}}function Ka(t){let e,l="Price service: "+Ia(t[1].ee),n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l="Price service: "+Ia(i[1].ee))&&J(n,l)},d(i){i&&S(e)}}}function Ya(t){let e,l,n,i,o,u;return l=new Xt({props:{to:"/configuration",$$slots:{default:[sm]},$$scope:{ctx:t}}}),o=new Xt({props:{to:"/status",$$slots:{default:[om]},$$scope:{ctx:t}}}),{c(){e=m("div"),se(l.$$.fragment),n=b(),i=m("div"),se(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(c,a){M(c,e,a),ne(l,e,null),M(c,n,a),M(c,i,a),ne(o,i,null),u=!0},i(c){u||(I(l.$$.fragment,c),I(o.$$.fragment,c),u=!0)},o(c){q(l.$$.fragment,c),q(o.$$.fragment,c),u=!1},d(c){c&&S(e),ie(l),c&&S(n),c&&S(i),ie(o)}}}function sm(t){let e,l;return e=new x0({}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function om(t){let e,l;return e=new tm({}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Qa(t){let e,l,n,i,o;const u=[am,rm],c=[];function a(f,p){return f[2].security==0||f[1].a?0:1}return l=a(t),n=c[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),c[l].m(e,null),o=!0},p(f,p){let _=l;l=a(f),l===_?c[l].p(f,p):(Ae(),q(c[_],1,1,()=>{c[_]=null}),Pe(),n=c[l],n?n.p(f,p):(n=c[l]=u[l](f),n.c()),I(n,1),n.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&r(e,"title",i)},i(f){o||(I(n),o=!0)},o(f){q(n),o=!1},d(f){f&&S(e),c[l].d()}}}function rm(t){let e,l,n=t[3].tag_name+"",i;return{c(){e=m("span"),l=N("New version: "),i=N(n)},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&8&&n!==(n=o[3].tag_name+"")&&J(i,n)},i:pe,o:pe,d(o){o&&S(e)}}}function am(t){let e,l,n,i=t[3].tag_name+"",o,u,c,a,f,p;return c=new s1({}),{c(){e=m("button"),l=m("span"),n=N("New version: "),o=N(i),u=b(),se(c.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,v){M(_,e,v),s(e,l),s(l,n),s(l,o),s(e,u),ne(c,e,null),a=!0,f||(p=ee(e,"click",t[4]),f=!0)},p(_,v){(!a||v&8)&&i!==(i=_[3].tag_name+"")&&J(o,i)},i(_){a||(I(c.$$.fragment,_),a=!0)},o(_){q(c.$$.fragment,_),a=!1},d(_){_&&S(e),ie(c),f=!1,p()}}}function um(t){let e,l,n,i,o,u,c,a,f,p,_,v,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se;i=new Xt({props:{to:"/",$$slots:{default:[im]},$$scope:{ctx:t}}}),a=new G0({props:{epoch:t[1].u}});let ye=t[1].t>-50&&za(t);T=new un({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:Ul(t[2].booting?2:t[1].em)}}),F=new un({props:{title:"HAN",text:"HAN",color:Ul(t[2].booting?9:t[1].hm)}}),R=new un({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[2].booting?9:t[1].wm)}}),A=new un({props:{title:"MQTT",text:"MQTT",color:Ul(t[2].booting?9:t[1].mm)}});let he=(t[1].he<0||t[1].he>0)&&Ga(t),$e=t[1].me<0&&Va(t),be=(t[1].ee>0||t[1].ee<0)&&Ka(t);ue=new i1({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let $=t[2].vndcfg&&t[2].usrcfg&&Ya(t);He=new Lt({});let C=t[2].fwconsent===1&&t[3]&&Qa(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),se(i.$$.fragment),o=b(),u=m("div"),c=m("div"),se(a.$$.fragment),f=b(),ye&&ye.c(),p=b(),_=m("div"),v=N("Free mem: "),d=N(h),g=N("kb"),w=b(),D=m("div"),se(T.$$.fragment),E=b(),se(F.$$.fragment),O=b(),se(R.$$.fragment),y=b(),se(A.$$.fragment),te=b(),he&&he.c(),W=b(),$e&&$e.c(),j=b(),be&&be.c(),U=b(),K=m("div"),Y=m("div"),G=m("a"),Z=m("img"),H=b(),x=m("div"),se(ue.$$.fragment),re=b(),$&&$.c(),Q=b(),z=m("div"),we=m("a"),se(He.$$.fragment),Ie=b(),C&&C.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(c,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(D,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(Z,"class","gh-logo"),ps(Z.src,V=t[0]+Ha)||r(Z,"src",V),r(Z,"alt","GitHub repo"),r(G,"class","float-right"),r(G,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(G,"target","_blank"),r(G,"rel","noreferrer"),r(G,"aria-label","GitHub"),r(Y,"class","flex-none"),r(x,"class","flex-none my-auto px-2"),r(we,"href",Rt("")),r(we,"target","_blank"),r(we,"rel","noreferrer"),r(z,"class","flex-none px-1 mt-1"),r(z,"title","Documentation"),r(K,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","hdr")},m(k,P){M(k,e,P),s(e,l),s(l,n),ne(i,n,null),s(l,o),s(l,u),s(u,c),ne(a,c,null),s(u,f),ye&&ye.m(u,null),s(u,p),s(u,_),s(_,v),s(_,d),s(_,g),s(l,w),s(l,D),ne(T,D,null),s(D,E),ne(F,D,null),s(D,O),ne(R,D,null),s(D,y),ne(A,D,null),s(l,te),he&&he.m(l,null),s(l,W),$e&&$e.m(l,null),s(l,j),be&&be.m(l,null),s(l,U),s(l,K),s(K,Y),s(Y,G),s(G,Z),s(K,H),s(K,x),ne(ue,x,null),s(K,re),$&&$.m(K,null),s(K,Q),s(K,z),s(z,we),ne(He,we,null),s(K,Ie),C&&C.m(K,null),Se=!0},p(k,[P]){const L={};P&36&&(L.$$scope={dirty:P,ctx:k}),i.$set(L);const X={};P&2&&(X.epoch=k[1].u),a.$set(X),k[1].t>-50?ye?ye.p(k,P):(ye=za(k),ye.c(),ye.m(u,p)):ye&&(ye.d(1),ye=null),(!Se||P&2)&&h!==(h=(k[1].m?(k[1].m/1e3).toFixed(1):"-")+"")&&J(d,h);const le={};P&6&&(le.text=k[2].booting?"Booting":k[1].v>2?k[1].v.toFixed(2)+"V":"ESP"),P&6&&(le.color=Ul(k[2].booting?2:k[1].em)),T.$set(le);const fe={};P&6&&(fe.color=Ul(k[2].booting?9:k[1].hm)),F.$set(fe);const de={};P&2&&(de.text=k[1].r?k[1].r.toFixed(0)+"dBm":"WiFi"),P&6&&(de.color=Ul(k[2].booting?9:k[1].wm)),R.$set(de);const Ce={};P&6&&(Ce.color=Ul(k[2].booting?9:k[1].mm)),A.$set(Ce),k[1].he<0||k[1].he>0?he?he.p(k,P):(he=Ga(k),he.c(),he.m(l,W)):he&&(he.d(1),he=null),k[1].me<0?$e?$e.p(k,P):($e=Va(k),$e.c(),$e.m(l,j)):$e&&($e.d(1),$e=null),k[1].ee>0||k[1].ee<0?be?be.p(k,P):(be=Ka(k),be.c(),be.m(l,U)):be&&(be.d(1),be=null),(!Se||P&1&&!ps(Z.src,V=k[0]+Ha))&&r(Z,"src",V);const Oe={};P&2&&(Oe.timestamp=k[1].c?new Date(k[1].c*1e3):new Date(0)),P&4&&(Oe.offset=k[2].clock_offset),ue.$set(Oe),k[2].vndcfg&&k[2].usrcfg?$?P&4&&I($,1):($=Ya(k),$.c(),I($,1),$.m(K,Q)):$&&(Ae(),q($,1,1,()=>{$=null}),Pe()),k[2].fwconsent===1&&k[3]?C?(C.p(k,P),P&12&&I(C,1)):(C=Qa(k),C.c(),I(C,1),C.m(K,null)):C&&(Ae(),q(C,1,1,()=>{C=null}),Pe())},i(k){Se||(I(i.$$.fragment,k),I(a.$$.fragment,k),I(T.$$.fragment,k),I(F.$$.fragment,k),I(R.$$.fragment,k),I(A.$$.fragment,k),I(ue.$$.fragment,k),I($),I(He.$$.fragment,k),I(C),Se=!0)},o(k){q(i.$$.fragment,k),q(a.$$.fragment,k),q(T.$$.fragment,k),q(F.$$.fragment,k),q(R.$$.fragment,k),q(A.$$.fragment,k),q(ue.$$.fragment,k),q($),q(He.$$.fragment,k),q(C),Se=!1},d(k){k&&S(e),ie(i),ie(a),ye&&ye.d(),ie(T),ie(F),ie(R),ie(A),he&&he.d(),$e&&$e.d(),be&&be.d(),ie(ue),$&&$.d(),ie(He),C&&C.d()}}}function fm(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={},u={};function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!li(o.board)||confirm(ks(ve(o.chip,o.board))))&&(Wt.update(a=>(a.upgrading=!0,a)),l1(u.tag_name))}return Wt.subscribe(a=>{l(2,o=a),a.fwconsent===1&&R0()}),To.subscribe(a=>{l(3,u=n1(o.version,a))}),t.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,u,c]}class cm extends Re{constructor(e){super(),Le(this,e,fm,um,Ee,{basepath:0,data:1})}}function mm(t){let e,l,n,i;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"d",Ks(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Ks(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){M(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Ks(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:pe,o:pe,d(o){o&&S(e)}}}function Xa(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 Ks(t,e,l,n,i){var o=Xa(t,e,l,i),u=Xa(t,e,l,n),c=i-n<=180?"0":"1",a=["M",o.x,o.y,"A",l,l,0,c,0,u.x,u.y].join(" ");return a}function _m(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 pm extends Re{constructor(e){super(),Le(this,e,_m,mm,Ee,{pct:0,color:1})}}function Za(t){let e,l,n,i,o,u,c,a;return{c(){e=m("br"),l=b(),n=m("span"),i=N(t[3]),o=b(),u=m("span"),c=N(t[4]),a=N("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),M(f,o,p),M(f,u,p),s(u,c),s(u,a)},p(f,p){p&8&&J(i,f[3]),p&16&&J(c,f[4])},d(f){f&&S(e),f&&S(l),f&&S(n),f&&S(o),f&&S(u)}}}function dm(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w;l=new pm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let D=t[3]&&Za(t);return{c(){e=m("div"),se(l.$$.fragment),n=b(),i=m("span"),o=m("span"),u=N(t[2]),c=b(),a=m("br"),f=b(),p=m("span"),_=N(t[0]),v=b(),h=m("span"),d=N(t[1]),g=b(),D&&D.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(h,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(T,E){M(T,e,E),ne(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,c),s(i,a),s(i,f),s(i,p),s(p,_),s(i,v),s(i,h),s(h,d),s(i,g),D&&D.m(i,null),w=!0},p(T,[E]){const F={};E&64&&(F.pct=T[6]),E&96&&(F.color=T[5](T[6],document.documentElement.classList.contains("dark"))),l.$set(F),(!w||E&4)&&J(u,T[2]),(!w||E&1)&&J(_,T[0]),(!w||E&2)&&J(d,T[1]),T[3]?D?D.p(T,E):(D=Za(T),D.c(),D.m(i,null)):D&&(D.d(1),D=null)},i(T){w||(I(l.$$.fragment,T),w=!0)},o(T){q(l.$$.fragment,T),w=!1},d(T){T&&S(e),ie(l),D&&D.d()}}}function hm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:c=""}=e,{subunit:a=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,c=_.sub),"subunit"in _&&l(4,a=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,c,a,f,p,i]}class o1 extends Re{constructor(e){super(),Le(this,e,hm,dm,Ee,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Ja(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function xa(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function eu(t,e,l){const n=t.slice();return n[15]=e[l],n}function tu(t){let e,l,n,i,o,u,c=t[0].title&&lu(t),a=t[0].y.ticks,f=[];for(let d=0;dt[9].call(e))},m(o,u){M(o,e,u),s(e,n),i=vo(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&J(n,l)},d(o){o&&S(e),i()}}}function nu(t){let e,l,n,i=t[15].label+"",o,u,c,a;return{c(){e=De("g"),l=De("line"),n=De("text"),o=N(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",u=t[15].align=="right"?"85%":""),r(e,"class",c="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",a="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&J(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&r(n,"x",u),p&1&&c!==(c="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",c),p&129&&a!==(a="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",a)},d(f){f&&S(e)}}}function iu(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&nu(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function su(t){let e,l,n=(t[3]>20||t[13]%2==0)&&ou(t);return{c(){e=De("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=ou(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&S(e),n&&n.d()}}}function ou(t){let e,l=t[11].label+"",n,i;return{c(){e=De("text"),n=N(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){M(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&J(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&S(e)}}}function ru(t){let e=!isNaN(t[6](t[13])),l,n=e&&su(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=su(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&S(l)}}}function au(t){let e,l,n=t[11].value!==void 0&&uu(t),i=t[11].value2>1e-4&&mu(t);return{c(){e=De("g"),n&&n.c(),l=De("g"),i&&i.c()},m(o,u){M(o,e,u),n&&n.m(e,null),M(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=uu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=mu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&S(e),n&&n.d(),o&&S(l),i&&i.d()}}}function uu(t){let e,l,n,i,o,u,c,a=t[3]>15&&fu(t);return{c(){e=De("rect"),a&&a.c(),c=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),p&1&&u!==(u=f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=fu(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function fu(t){let e,l=t[11].label+"",n,i,o,u,c,a,f=t[11].title&&cu(t);return{c(){e=De("text"),n=N(l),f&&f.c(),a=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",c="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]p[7](0)-p[8]?p[11].color:"white")&&r(e,"fill",u),_&457&&c!==(c="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]15&&_u(t);return{c(){e=De("rect"),a&&a.c(),c=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),a&&a.m(f,p),M(f,c,p)},p(f,p){p&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),p&128&&n!==(n=f[7](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",u),f[3]>15?a?a.p(f,p):(a=_u(f),a.c(),a.m(c.parentNode,c)):a&&(a.d(1),a=null)},d(f){f&&S(e),a&&a.d(f),f&&S(c)}}}function _u(t){let e,l=t[11].label2+"",n,i,o,u,c,a=t[11].title2&&pu(t);return{c(){e=De("text"),n=N(l),a&&a.c(),c=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=vo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=tu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:pe,o:pe,d(i){i&&S(e),n&&n.d(),l()}}}let fn=30;function bm(t,e,l){let{config:n}=e,i,o,u,c,a,f,p,_=0;function v(){_=this.clientHeight,l(5,_)}function h(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-_);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,p=un.y.max?D=n.padding.bottom:wf||D<0?0:D})}},[n,i,o,u,f,_,c,a,p,v,h]}class _n extends Re{constructor(e){super(),Le(this,e,bm,vm,Ee,{config:0})}}function gm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,c={};function a(f){return{label:ke(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:P0(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(a(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(a(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(a(o))),l(0,c={title:"Voltage",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:f},points:p})}},[c,n,i,o,u]}class wm extends Re{constructor(e){super(),Le(this,e,km,gm,Ee,{u1:1,u2:2,u3:3,ds:4})}}function ym(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Cm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:c}=e,{i2e:a}=e,{i3:f}=e,{max:p}=e,_={};function v(h){return{label:ke(h)+"A",title:h.toFixed(1)+" A",value:isNaN(h)?0:h,color:Gc(h?h/p*100:0,document.documentElement.classList.contains("dark"))}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,u=h.i1),"i2"in h&&l(5,c=h.i2),"i2e"in h&&l(6,a=h.i2e),"i3"in h&&l(7,f=h.i3),"max"in h&&l(8,p=h.max)},t.$$.update=()=>{if(t.$$.dirty&510){let h=[],d=[];n>0&&(h.push({label:"L1"}),d.push(v(u))),i>0&&(a?(h.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(h.push({label:"L2"}),d.push(v(c)))),o>0&&(h.push({label:"L3"}),d.push(v(f))),l(0,_={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:p,ticks:[{value:0,label:"0%"},{value:p/4,label:"25%"},{value:p/2,label:"50%"},{value:p/4*3,label:"75%"},{value:p,label:"100%"}]},x:{ticks:h},points:d})}},[_,n,i,o,u,c,a,f,p]}class Sm extends Re{constructor(e){super(),Le(this,e,Cm,ym,Ee,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function Mm(t){let e,l,n,i,o,u,c,a=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,v,h,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,D,T,E,F,O,R,y=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",A,te,W,j,U,K,Y=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",G,Z;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",u=b(),c=m("div"),f=N(a),p=N(" VAr"),_=b(),v=m("div"),v.textContent="Instant out",h=b(),d=m("div"),w=N(g),D=N(" VAr"),T=b(),E=m("div"),F=m("div"),F.textContent="Total in",O=b(),R=m("div"),A=N(y),te=N(" kVArh"),W=b(),j=m("div"),j.textContent="Total out",U=b(),K=m("div"),G=N(Y),Z=N(" kVArh"),r(c,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(R,"class","text-right"),r(K,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,c),s(c,f),s(c,p),s(i,_),s(i,v),s(i,h),s(i,d),s(d,w),s(d,D),s(e,T),s(e,E),s(E,F),s(E,O),s(E,R),s(R,A),s(R,te),s(E,W),s(E,j),s(E,U),s(E,K),s(K,G),s(K,Z)},p(V,[H]){H&1&&a!==(a=(typeof V[0]<"u"?V[0].toFixed(0):"-")+"")&&J(f,a),H&2&&g!==(g=(typeof V[1]<"u"?V[1].toFixed(0):"-")+"")&&J(w,g),H&4&&y!==(y=(typeof V[2]<"u"?V[2].toFixed(1):"-")+"")&&J(A,y),H&8&&Y!==(Y=(typeof V[3]<"u"?V[3].toFixed(1):"-")+"")&&J(G,Y)},i:pe,o:pe,d(V){V&&S(e)}}}function Tm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=c=>{"importInstant"in c&&l(0,n=c.importInstant),"exportInstant"in c&&l(1,i=c.exportInstant),"importTotal"in c&&l(2,o=c.importTotal),"exportTotal"in c&&l(3,u=c.exportTotal)},[n,i,o,u]}class $m extends Re{constructor(e){super(),Le(this,e,Tm,Mm,Ee,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function hu(t){let e;function l(o,u){return o[3]?Em:Nm}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&S(e)}}}function Nm(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,v,h,d=ke(t[1].d.u,1)+"",g,w,D,T,E,F,O=ke(t[1].m.u)+"",R,y,A,te,W,j,U=ke(t[0].last_month.u)+"",K,Y,G,Z,V=t[4]&&vu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),_=m("div"),_.textContent="Day",v=b(),h=m("div"),g=N(d),w=N(" kWh"),D=b(),T=m("div"),T.textContent="Month",E=b(),F=m("div"),R=N(O),y=N(" kWh"),A=b(),te=m("div"),te.textContent="Last month",W=b(),j=m("div"),K=N(U),Y=N(" kWh"),G=b(),V&&V.c(),Z=Ke(),r(u,"class","text-right"),r(h,"class","text-right"),r(F,"class","text-right"),r(j,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(H,x){M(H,e,x),M(H,l,x),M(H,n,x),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),s(n,_),s(n,v),s(n,h),s(h,g),s(h,w),s(n,D),s(n,T),s(n,E),s(n,F),s(F,R),s(F,y),s(n,A),s(n,te),s(n,W),s(n,j),s(j,K),s(j,Y),M(H,G,x),V&&V.m(H,x),M(H,Z,x)},p(H,x){x&2&&c!==(c=ke(H[1].h.u,2)+"")&&J(a,c),x&2&&d!==(d=ke(H[1].d.u,1)+"")&&J(g,d),x&2&&O!==(O=ke(H[1].m.u)+"")&&J(R,O),x&1&&U!==(U=ke(H[0].last_month.u)+"")&&J(K,U),H[4]?V?V.p(H,x):(V=vu(H),V.c(),V.m(Z.parentNode,Z)):V&&(V.d(1),V=null)},d(H){H&&S(e),H&&S(l),H&&S(n),H&&S(G),V&&V.d(H),H&&S(Z)}}}function Em(t){let e,l,n,i,o,u,c=ke(t[1].h.u,2)+"",a,f,p,_,v,h,d,g=ke(t[1].d.u,1)+"",w,D,T,E,F,O,R,y=ke(t[1].m.u)+"",A,te,W,j,U,K,Y,G=ke(t[0].last_month.u)+"",Z,V,H,x,ue,re,Q,z,we,He,Ie,Se=ke(t[1].h.p,2)+"",ye,he,$e,be,$,C,k,P=ke(t[1].d.p,1)+"",L,X,le,fe,de,Ce,Oe,ae=ke(t[1].m.p)+"",Te,Je,It,st,kt,nt,Ot,Qe=ke(t[0].last_month.p)+"",Zt,zt,ht,xe,Ve=t[4]&&bu(t),Ye=t[4]&&gu(t),Ne=t[4]&&ku(t),Ze=t[4]&&wu(t),et=t[4]&&yu(t),Be=t[4]&&Cu(t),Fe=t[4]&&Su(t),_e=t[4]&&Mu(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=N(" kWh"),p=b(),Ve&&Ve.c(),_=b(),v=m("div"),v.textContent="Day",h=b(),d=m("div"),w=N(g),D=N(" kWh"),T=b(),Ye&&Ye.c(),E=b(),F=m("div"),F.textContent="Month",O=b(),R=m("div"),A=N(y),te=N(" kWh"),W=b(),Ne&&Ne.c(),j=b(),U=m("div"),U.textContent="Last mo.",K=b(),Y=m("div"),Z=N(G),V=N(" kWh"),H=b(),Ze&&Ze.c(),ue=b(),re=m("strong"),re.textContent="Export",Q=b(),z=m("div"),we=m("div"),we.textContent="Hour",He=b(),Ie=m("div"),ye=N(Se),he=N(" kWh"),$e=b(),et&&et.c(),be=b(),$=m("div"),$.textContent="Day",C=b(),k=m("div"),L=N(P),X=N(" kWh"),le=b(),Be&&Be.c(),fe=b(),de=m("div"),de.textContent="Month",Ce=b(),Oe=m("div"),Te=N(ae),Je=N(" kWh"),It=b(),Fe&&Fe.c(),st=b(),kt=m("div"),kt.textContent="Last mo.",nt=b(),Ot=m("div"),Zt=N(Qe),zt=N(" kWh"),ht=b(),_e&&_e.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(Y,"class","text-right"),r(n,"class",x="grid grid-cols-"+t[5]+" mb-3"),r(Ie,"class","text-right"),r(k,"class","text-right"),r(Oe,"class","text-right"),r(Ot,"class","text-right"),r(z,"class",xe="grid grid-cols-"+t[5])},m(ce,qe){M(ce,e,qe),M(ce,l,qe),M(ce,n,qe),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(n,p),Ve&&Ve.m(n,null),s(n,_),s(n,v),s(n,h),s(n,d),s(d,w),s(d,D),s(n,T),Ye&&Ye.m(n,null),s(n,E),s(n,F),s(n,O),s(n,R),s(R,A),s(R,te),s(n,W),Ne&&Ne.m(n,null),s(n,j),s(n,U),s(n,K),s(n,Y),s(Y,Z),s(Y,V),s(n,H),Ze&&Ze.m(n,null),M(ce,ue,qe),M(ce,re,qe),M(ce,Q,qe),M(ce,z,qe),s(z,we),s(z,He),s(z,Ie),s(Ie,ye),s(Ie,he),s(z,$e),et&&et.m(z,null),s(z,be),s(z,$),s(z,C),s(z,k),s(k,L),s(k,X),s(z,le),Be&&Be.m(z,null),s(z,fe),s(z,de),s(z,Ce),s(z,Oe),s(Oe,Te),s(Oe,Je),s(z,It),Fe&&Fe.m(z,null),s(z,st),s(z,kt),s(z,nt),s(z,Ot),s(Ot,Zt),s(Ot,zt),s(z,ht),_e&&_e.m(z,null)},p(ce,qe){qe&2&&c!==(c=ke(ce[1].h.u,2)+"")&&J(a,c),ce[4]?Ve?Ve.p(ce,qe):(Ve=bu(ce),Ve.c(),Ve.m(n,_)):Ve&&(Ve.d(1),Ve=null),qe&2&&g!==(g=ke(ce[1].d.u,1)+"")&&J(w,g),ce[4]?Ye?Ye.p(ce,qe):(Ye=gu(ce),Ye.c(),Ye.m(n,E)):Ye&&(Ye.d(1),Ye=null),qe&2&&y!==(y=ke(ce[1].m.u)+"")&&J(A,y),ce[4]?Ne?Ne.p(ce,qe):(Ne=ku(ce),Ne.c(),Ne.m(n,j)):Ne&&(Ne.d(1),Ne=null),qe&1&&G!==(G=ke(ce[0].last_month.u)+"")&&J(Z,G),ce[4]?Ze?Ze.p(ce,qe):(Ze=wu(ce),Ze.c(),Ze.m(n,null)):Ze&&(Ze.d(1),Ze=null),qe&32&&x!==(x="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",x),qe&2&&Se!==(Se=ke(ce[1].h.p,2)+"")&&J(ye,Se),ce[4]?et?et.p(ce,qe):(et=yu(ce),et.c(),et.m(z,be)):et&&(et.d(1),et=null),qe&2&&P!==(P=ke(ce[1].d.p,1)+"")&&J(L,P),ce[4]?Be?Be.p(ce,qe):(Be=Cu(ce),Be.c(),Be.m(z,fe)):Be&&(Be.d(1),Be=null),qe&2&&ae!==(ae=ke(ce[1].m.p)+"")&&J(Te,ae),ce[4]?Fe?Fe.p(ce,qe):(Fe=Su(ce),Fe.c(),Fe.m(z,st)):Fe&&(Fe.d(1),Fe=null),qe&1&&Qe!==(Qe=ke(ce[0].last_month.p)+"")&&J(Zt,Qe),ce[4]?_e?_e.p(ce,qe):(_e=Mu(ce),_e.c(),_e.m(z,null)):_e&&(_e.d(1),_e=null),qe&32&&xe!==(xe="grid grid-cols-"+ce[5])&&r(z,"class",xe)},d(ce){ce&&S(e),ce&&S(l),ce&&S(n),Ve&&Ve.d(),Ye&&Ye.d(),Ne&&Ne.d(),Ze&&Ze.d(),ce&&S(ue),ce&&S(re),ce&&S(Q),ce&&S(z),et&&et.d(),Be&&Be.d(),Fe&&Fe.d(),_e&&_e.d()}}}function vu(t){let e,l,n,i,o,u,c=ke(t[1].h.c,2)+"",a,f,p,_,v,h,d,g=ke(t[1].d.c,1)+"",w,D,T,E,F,O,R,y=ke(t[1].m.c)+"",A,te,W,j,U,K,Y,G=ke(t[0].last_month.c)+"",Z,V,H;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),a=N(c),f=b(),p=N(t[2]),_=b(),v=m("div"),v.textContent="Day",h=b(),d=m("div"),w=N(g),D=b(),T=N(t[2]),E=b(),F=m("div"),F.textContent="Month",O=b(),R=m("div"),A=N(y),te=b(),W=N(t[2]),j=b(),U=m("div"),U.textContent="Last month",K=b(),Y=m("div"),Z=N(G),V=b(),H=N(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(Y,"class","text-right"),r(n,"class","grid grid-cols-2")},m(x,ue){M(x,e,ue),M(x,l,ue),M(x,n,ue),s(n,i),s(n,o),s(n,u),s(u,a),s(u,f),s(u,p),s(n,_),s(n,v),s(n,h),s(n,d),s(d,w),s(d,D),s(d,T),s(n,E),s(n,F),s(n,O),s(n,R),s(R,A),s(R,te),s(R,W),s(n,j),s(n,U),s(n,K),s(n,Y),s(Y,Z),s(Y,V),s(Y,H)},p(x,ue){ue&2&&c!==(c=ke(x[1].h.c,2)+"")&&J(a,c),ue&4&&J(p,x[2]),ue&2&&g!==(g=ke(x[1].d.c,1)+"")&&J(w,g),ue&4&&J(T,x[2]),ue&2&&y!==(y=ke(x[1].m.c)+"")&&J(A,y),ue&4&&J(W,x[2]),ue&1&&G!==(G=ke(x[0].last_month.c)+"")&&J(Z,G),ue&4&&J(H,x[2])},d(x){x&&S(e),x&&S(l),x&&S(n)}}}function bu(t){let e,l=ke(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.c,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function gu(t){let e,l=ke(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.c,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function ku(t){let e,l=ke(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function wu(t){let e,l=ke(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.c)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function yu(t){let e,l=ke(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].h.i,2)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Cu(t){let e,l=ke(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].d.i,1)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Su(t){let e,l=ke(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&2&&l!==(l=ke(u[1].m.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Mu(t){let e,l=ke(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=N(l),i=b(),o=N(t[2]),r(e,"class","text-right")},m(u,c){M(u,e,c),s(e,n),s(e,i),s(e,o)},p(u,c){c&1&&l!==(l=ke(u[0].last_month.i)+"")&&J(n,l),c&4&&J(o,u[2])},d(u){u&&S(e)}}}function Am(t){let e,l,n,i,o,u,c=t[1]&&hu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),u=b(),c&&c.c(),r(e,"class","mx-2 text-sm")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),c&&c.m(e,null)},p(a,[f]){a[1]?c?c.p(a,f):(c=hu(a),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:pe,o:pe,d(a){a&&S(e),c&&c.d()}}}function Pm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,c=!1,a=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,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(5,a=c?3:2))},[n,i,o,u,c,a]}class Dm extends Re{constructor(e){super(),Le(this,e,Pm,Am,Ee,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Lm(t){let e,l,n=Ba(t[0].source)+"",i,o,u,c,a;return c=new _n({props:{config:t[1]}}),{c(){e=m("a"),l=N("Provided by: "),i=N(n),u=b(),se(c.$$.fragment),r(e,"href",o=qa(t[0].source)),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,l),s(e,i),M(f,u,p),ne(c,f,p),a=!0},p(f,[p]){(!a||p&1)&&n!==(n=Ba(f[0].source)+"")&&J(i,n),(!a||p&1&&o!==(o=qa(f[0].source)))&&r(e,"href",o);const _={};p&2&&(_.config=f[1]),c.$set(_)},i(f){a||(I(c.$$.fragment,f),a=!0)},o(f){q(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(u),ie(c,f)}}}function Rm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,c,a=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&l(0,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=n.currency,p=new Date().getUTCHours(),_=0,v=0,h=0,d=[],g=[],w=[];l(4,c=l(3,u=0));let D=new Date;for(vl(D,i.clock_offset-(24+D.getHours()-D.getUTCHours())%24),_=p;_<24&&(v=n[Ue(h++)],v!=null);_++)g.push({label:Ue(D.getHours())}),w.push(v*100),l(4,c=Math.min(c,v*100)),l(3,u=Math.max(u,v*100)),vl(D,1);for(_=0;_<24&&(v=n[Ue(h++)],v!=null);_++)g.push({label:Ue(D.getHours())}),w.push(v*100),l(4,c=Math.min(c,v*100)),l(3,u=Math.max(u,v*100)),vl(D,1);if(c>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(l(4,c*=100),l(3,u*=100),_=0;_=0?R.toFixed(y):"",title:R>=0?R.toFixed(2)+" "+f:"",value:v>=0?Math.abs(v):0,label2:R<0?R.toFixed(y):"",title2:R<0?R.toFixed(2)+" "+f:"",value2:v<0?Math.abs(v):0,color:a?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(c));if(c<0){l(4,c=Math.min(E/4*-1,c));let R=Math.ceil(Math.abs(c)/E*4),y=c/R;for(_=1;_{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,c=l(3,u=0));let h=vl(new Date,-24),d=new Date().getUTCHours();for(vl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),f=d;f<24;f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(h.getHours())}),v.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:E.toFixed(1),title2:E.toFixed(2)+" kWh",value2:E*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E*10)),l(3,u=Math.max(u,T*10)),vl(h,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],v=[];l(4,c=l(3,u=0));let h=new Date,d=new Date;for(vl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),vl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=h.getDate();f<=d.getDate();f++){let T=n["i"+Ue(f)],E=n["e"+Ue(f)];T===void 0&&(T=0),E===void 0&&(E=0),_.push({label:Ue(f)}),v.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(4,c=Math.max(c,E)),l(3,u=Math.max(u,T))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,p=[],_=[],v=[];n.s&&n.s.forEach((g,w)=>{var D=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:D.slice(-4)}),v.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),l(3,c=Math.min(c,f)),l(2,u=Math.max(u,f))}),l(2,u=Math.ceil(u)),l(3,c=Math.floor(c));let h=u;c<0&&(h+=Math.abs(c));let d=h/4;for(a=0;a<5;a++)f=c+d*a,p.push({value:f,label:f.toFixed(1)});l(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:u,ticks:p},x:{ticks:_},points:v})}},[o,n,u,c]}class zm extends Re{constructor(e){super(),Le(this,e,Wm,Hm,Ee,{json:1})}}function Gm(t){let e,l;return e=new _n({props:{config:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}let Vm=0;function Km(t,e,l){let n=document.documentElement.classList.contains("dark"),i={},o=0,u;return e1.subscribe(c=>{l(2,u=c)}),xc(),t.$$.update=()=>{if(t.$$.dirty&6){let c=0,a=[],f=[],p=[];if(a.push({value:0,label:0}),u&&u.p)for(c=0;c0?Ue(_.d)+"."+Js[new Date().getMonth()]:"-"}),l(1,o=Math.max(o,_.v))}if(u&&u.t){for(c=0;c=o)break;a.push({value:_,label:_})}a.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(a.push({label:u.c.toFixed(0),color:"orange",value:u.c}),l(1,o=Math.max(o,u.c))),l(1,o=Math.ceil(o)),l(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Vm,max:o,ticks:a},x:{ticks:f},points:p})}},[i,o,u]}class Ym extends Re{constructor(e){super(),Le(this,e,Km,Gm,Ee,{})}}function Tu(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function $u(t,e,l){const n=t.slice();return n[23]=e[l],n}function Nu(t){let e,l,n,i,o,u=t[7],c=[];for(let p=0;pt[15].call(e))},m(f,p){M(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),a&&a.m(e,null),c=vo(e,t[15].bind(e))},p(f,[p]){p&1024&&J(i,f[10]),f[7]?a?a.p(f,p):(a=Nu(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:pe,o:pe,d(f){f&&S(e),a&&a.d(),c()}}}let Xm=12;function Zm(t,e,l){let n=document.documentElement.classList.contains("dark"),i;t1.subscribe(y=>{l(12,i=y)});let o,u=0,c=0;function a(){o&&clearTimeout(o),o=setTimeout(a,1e4),i.data.unshift(c),l(12,i.data=i.data.slice(0,i.size),i),u+=10}Vc.subscribe(y=>{u==0&&(o&&clearTimeout(o),o=setTimeout(a,1e4)),c=y.i-y.e,u=y.u});let f,p,_,v,h,d,g,w,D,T,E,F,O;function R(){_=this.clientWidth,v=this.clientHeight,l(0,_),l(1,v)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(l(2,h=parseInt(v)-50),l(3,d=_-35),l(9,F=d/i.size),l(14,p=0),l(13,f=0),i.data)){for(let A in i.data){let te=i.data[A];l(13,f=Math.max(Math.ceil(te/1e3)*1e3,f)),l(14,p=Math.min(Math.ceil(te/1e3)*1e3,p))}l(10,O=f>2500?"kW":"W"),l(7,T=[]);for(let A=p;A2500?(A/1e3).toFixed(1):A});l(8,E=[]);for(let A=p;A0||t[0].e>0}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Uu(t){let e,l,n;return l=new Ym({}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function ju(t){let e,l,n;return l=new Jm({}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Hu(t){let e,l,n;return l=new Im({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Wu(t){let e,l,n;return l=new Bm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function zu(t){let e,l,n;return l=new jm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function Gu(t){let e,l,n;return l=new zm({props:{json:t[5]}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function xm(t){let e,l=Xe(t[1].ui.i,t[0].i),n,i=Xe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Xe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),c,a=Xe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Xe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,v=Xe(t[1].ui.c,t[0].ea),h,d=Xe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,w=Xe(t[1].ui.l),D,T=Xe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),E,F=Xe(t[1].ui.d,t[3]),O,R=Xe(t[1].ui.m,t[4]),y,A=Xe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),te,W=l&&Ru(t),j=i&&Iu(t),U=u&&Ou(t),K=a&&Fu(t),Y=p&&Bu(t),G=v&&qu(t),Z=d&&Uu(),V=w&&ju(),H=T&&Hu(t),x=F&&Wu(t),ue=R&&zu(t),re=A&&Gu(t);return{c(){e=m("div"),W&&W.c(),n=b(),j&&j.c(),o=b(),U&&U.c(),c=b(),K&&K.c(),f=b(),Y&&Y.c(),_=b(),G&&G.c(),h=b(),Z&&Z.c(),g=b(),V&&V.c(),D=b(),H&&H.c(),E=b(),x&&x.c(),O=b(),ue&&ue.c(),y=b(),re&&re.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(Q,z){M(Q,e,z),W&&W.m(e,null),s(e,n),j&&j.m(e,null),s(e,o),U&&U.m(e,null),s(e,c),K&&K.m(e,null),s(e,f),Y&&Y.m(e,null),s(e,_),G&&G.m(e,null),s(e,h),Z&&Z.m(e,null),s(e,g),V&&V.m(e,null),s(e,D),H&&H.m(e,null),s(e,E),x&&x.m(e,null),s(e,O),ue&&ue.m(e,null),s(e,y),re&&re.m(e,null),te=!0},p(Q,[z]){z&3&&(l=Xe(Q[1].ui.i,Q[0].i)),l?W?(W.p(Q,z),z&3&&I(W,1)):(W=Ru(Q),W.c(),I(W,1),W.m(e,n)):W&&(Ae(),q(W,1,1,()=>{W=null}),Pe()),z&3&&(i=Xe(Q[1].ui.e,Q[0].om||Q[0].e>0)),i?j?(j.p(Q,z),z&3&&I(j,1)):(j=Iu(Q),j.c(),I(j,1),j.m(e,o)):j&&(Ae(),q(j,1,1,()=>{j=null}),Pe()),z&3&&(u=Xe(Q[1].ui.v,Q[0].u1>100||Q[0].u2>100||Q[0].u3>100)),u?U?(U.p(Q,z),z&3&&I(U,1)):(U=Ou(Q),U.c(),I(U,1),U.m(e,c)):U&&(Ae(),q(U,1,1,()=>{U=null}),Pe()),z&3&&(a=Xe(Q[1].ui.a,Q[0].i1>.01||Q[0].i2>.01||Q[0].i3>.01)),a?K?(K.p(Q,z),z&3&&I(K,1)):(K=Fu(Q),K.c(),I(K,1),K.m(e,f)):K&&(Ae(),q(K,1,1,()=>{K=null}),Pe()),z&3&&(p=Xe(Q[1].ui.r,Q[0].ri>0||Q[0].re>0||Q[0].ric>0||Q[0].rec>0)),p?Y?(Y.p(Q,z),z&3&&I(Y,1)):(Y=Bu(Q),Y.c(),I(Y,1),Y.m(e,_)):Y&&(Ae(),q(Y,1,1,()=>{Y=null}),Pe()),z&3&&(v=Xe(Q[1].ui.c,Q[0].ea)),v?G?(G.p(Q,z),z&3&&I(G,1)):(G=qu(Q),G.c(),I(G,1),G.m(e,h)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),z&3&&(d=Xe(Q[1].ui.t,Q[0].pr&&(Q[0].pr.startsWith("10YNO")||Q[0].pr.startsWith("10Y1001A1001A4")))),d?Z?z&3&&I(Z,1):(Z=Uu(),Z.c(),I(Z,1),Z.m(e,g)):Z&&(Ae(),q(Z,1,1,()=>{Z=null}),Pe()),z&2&&(w=Xe(Q[1].ui.l)),w?V?z&2&&I(V,1):(V=ju(),V.c(),I(V,1),V.m(e,D)):V&&(Ae(),q(V,1,1,()=>{V=null}),Pe()),z&3&&(T=Xe(Q[1].ui.p,Q[0].pe&&!Number.isNaN(Q[0].p))),T?H?(H.p(Q,z),z&3&&I(H,1)):(H=Hu(Q),H.c(),I(H,1),H.m(e,E)):H&&(Ae(),q(H,1,1,()=>{H=null}),Pe()),z&10&&(F=Xe(Q[1].ui.d,Q[3])),F?x?(x.p(Q,z),z&10&&I(x,1)):(x=Wu(Q),x.c(),I(x,1),x.m(e,O)):x&&(Ae(),q(x,1,1,()=>{x=null}),Pe()),z&18&&(R=Xe(Q[1].ui.m,Q[4])),R?ue?(ue.p(Q,z),z&18&&I(ue,1)):(ue=zu(Q),ue.c(),I(ue,1),ue.m(e,y)):ue&&(Ae(),q(ue,1,1,()=>{ue=null}),Pe()),z&35&&(A=Xe(Q[1].ui.s,Q[0].t&&Q[0].t!=-127&&Q[5].c>1)),A?re?(re.p(Q,z),z&35&&I(re,1)):(re=Gu(Q),re.c(),I(re,1),re.m(e,null)):re&&(Ae(),q(re,1,1,()=>{re=null}),Pe())},i(Q){te||(I(W),I(j),I(U),I(K),I(Y),I(G),I(Z),I(V),I(H),I(x),I(ue),I(re),te=!0)},o(Q){q(W),q(j),q(U),q(K),q(Y),q(G),q(Z),q(V),q(H),q(x),q(ue),q(re),te=!1},d(Q){Q&&S(e),W&&W.d(),j&&j.d(),U&&U.d(),K&&K.d(),Y&&Y.d(),G&&G.d(),Z&&Z.d(),V&&V.d(),H&&H.d(),x&&x.d(),ue&&ue.d(),re&&re.d()}}}function e_(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},c={},a={};return Co.subscribe(f=>{l(2,o=f)}),Qc.subscribe(f=>{l(3,u=f)}),Xc.subscribe(f=>{l(4,c=f)}),Jc.subscribe(f=>{l(5,a=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,c,a]}class t_ extends Re{constructor(e){super(),Le(this,e,e_,xm,Ee,{data:0,sysinfo:1})}}let oo={};const gi=it(oo);async function l_(){oo=await(await fetch("configuration.json")).json(),gi.set(oo)}let ro={};const r1=it(ro);async function n_(){ro=await(await fetch("priceconfig.json")).json(),r1.set(ro)}function Vu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function i_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function s_(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Ku(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Yu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&S(e),i&&S(l),i&&S(n)}}}function Qu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function Xu(t){let e,l,n;return{c(){e=m("option"),l=N("GPIO"),n=N(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&S(e)}}}function Zu(t){let e,l=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&S(e)}}}function o_(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?s_:i_}let c=u(t),a=c(t),f=t[0]=="esp8266"&&Ku(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Yu(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Qu(),v={length:t[1]+1},h=[];for(let d=0;d{"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=19);break}},[n,i]}class ao extends Re{constructor(e){super(),Le(this,e,r_,o_,Ee,{chip:0})}}function Ju(t){let e,l,n=t[1]&&xu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&S(e),n&&n.d()}}}function xu(t){let e,l;return{c(){e=m("div"),l=N(t[1]),r(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){M(n,e,i),s(e,l)},p(n,i){i&2&&J(l,n[1])},d(n){n&&S(e)}}}function a_(t){let e,l=t[0]&&Ju(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ju(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&S(e)}}}function u_(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 gt extends Re{constructor(e){super(),Le(this,e,u_,a_,Ee,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=N("Europe/"),i=N(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,l),s(e,i)},p:pe,d(o){o&&S(e)}}}function f_(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,P=0;P0;C--)P[C]=P[C]?P[C-1]^O.EXPONENT[A._modN(O.LOG[P[C]]+$)]:P[C-1];P[0]=O.EXPONENT[A._modN(O.LOG[P[0]]+$)]}for($=0;$<=k;$++)P[$]=O.LOG[P[$]]},_checkBadness:function(){var $,C,k,P,L,X=0,le=this._badness,fe=this.buffer,de=this.width;for(L=0;Lde*de;)ae-=de*de,Oe++;for(X+=Oe*A.N4,P=0;P=le-2&&($=le-2,L>9&&$--);var fe=$;if(L>9){for(X[fe+2]=0,X[fe+3]=0;fe--;)C=X[fe],X[fe+3]|=255&C<<4,X[fe+2]=C>>4;X[2]|=255&$<<4,X[1]=$>>4,X[0]=64|$>>12}else{for(X[fe+1]=0,X[fe+2]=0;fe--;)C=X[fe],X[fe+2]|=255&C<<4,X[fe+1]=C>>4;X[1]|=255&$<<4,X[0]=64|$>>4}for(fe=$+3-(L<10);fe=5&&(k+=A.N1+P[C]-5);for(C=3;C<$-1;C+=2)P[C-2]===P[C+2]&&P[C+2]===P[C-1]&&P[C-1]===P[C+1]&&P[C-1]*3===P[C]&&(P[C-3]===0||C+3>$||P[C-3]*3>=P[C]*4||P[C+3]*3>=P[C]*4)&&(k+=A.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var $,C,k=0,P=3e4;for(C=0;C<8&&(this._applyMask(C),$=this._checkBadness(),$>=1)P&1&&(L[X-1-C+X*8]=1,C<6?L[8+X*C]=1:L[8+X*(C+1)]=1);for(C=0;C<7;C++,P>>=1)P&1&&(L[8+X*(X-7+C)]=1,C?L[6-C+X*8]=1:L[7+X*8]=1)},_interleaveBlocks:function(){var $,C,k=this._dataBlock,P=this._ecc,L=this._eccBlock,X=0,le=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,Ce=this._stringBuffer;for($=0;$1)for($=D.BLOCK[P],k=L-7;;){for(C=L-7;C>$-3&&(this._addAlignment(C,k),!(C<$));)C-=$;if(k<=$+9)break;k-=$,this._addAlignment(6,k),this._addAlignment(k,6)}},_insertFinders:function(){var $,C,k,P,L=this.buffer,X=this.width;for($=0;$<3;$++){for(C=0,P=0,$===1&&(C=X-7),$===2&&(P=X-7),L[P+3+X*(C+3)]=1,k=0;k<6;k++)L[P+k+X*C]=1,L[P+X*(C+k+1)]=1,L[P+6+X*(C+k)]=1,L[P+k+1+X*(C+6)]=1;for(k=1;k<5;k++)this._setMask(P+k,C+1),this._setMask(P+1,C+k+1),this._setMask(P+5,C+k),this._setMask(P+k+1,C+5);for(k=2;k<4;k++)L[P+k+X*(C+2)]=1,L[P+2+X*(C+k+1)]=1,L[P+4+X*(C+k)]=1,L[P+k+1+X*(C+4)]=1}},_insertTimingGap:function(){var $,C,k=this.width;for(C=0;C<7;C++)this._setMask(7,C),this._setMask(k-8,C),this._setMask(7,C+k-7);for($=0;$<8;$++)this._setMask($,7),this._setMask($+k-8,7),this._setMask($,k-8)},_insertTimingRowAndColumn:function(){var $,C=this.buffer,k=this.width;for($=0;$6)for($=y.BLOCK[X-7],C=17,k=0;k<6;k++)for(P=0;P<3;P++,C--)1&(C>11?X>>C-12:$>>C)?(L[5-k+le*(2-P+le-11)]=1,L[2-P+le-11+le*(5-k)]=1):(this._setMask(5-k,2-P+le-11),this._setMask(2-P+le-11,5-k))},_isMasked:function($,C){var k=A._getMaskBit($,C);return this._mask[k]===1},_pack:function(){var $,C,k,P=1,L=1,X=this.width,le=X-1,fe=X-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(C=0;CC&&(k=$,$=C,C=k),k=C,k+=C*C,k>>=1,k+=$,k},_modN:function($){for(;$>=255;)$-=255,$=($>>8)+($&255);return $},N1:3,N2:3,N3:40,N4:10}),te=A,W=h.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var $=this.element;$.width=$.height=this.qrious.size}}),j=W,U=_.extend(function($,C,k,P){this.name=$,this.modifiable=Boolean(C),this.defaultValue=k,this._valueTransformer=P},{transform:function($){var C=this._valueTransformer;return typeof C=="function"?C($,this):$}}),K=U,Y=_.extend(null,{abs:function($){return $!=null?Math.abs($):null},hasOwn:function($,C){return Object.prototype.hasOwnProperty.call($,C)},noop:function(){},toUpperCase:function($){return $!=null?$.toUpperCase():null}}),G=Y,Z=_.extend(function($){this.options={},$.forEach(function(C){this.options[C.name]=C},this)},{exists:function($){return this.options[$]!=null},get:function($,C){return Z._get(this.options[$],C)},getAll:function($){var C,k=this.options,P={};for(C in k)G.hasOwn(k,C)&&(P[C]=Z._get(k[C],$));return P},init:function($,C,k){typeof k!="function"&&(k=G.noop);var P,L;for(P in this.options)G.hasOwn(this.options,P)&&(L=this.options[P],Z._set(L,L.defaultValue,C),Z._createAccessor(L,C,k));this._setAll($,C,!0)},set:function($,C,k){return this._set($,C,k)},setAll:function($,C){return this._setAll($,C)},_set:function($,C,k,P){var L=this.options[$];if(!L)throw new Error("Invalid option: "+$);if(!L.modifiable&&!P)throw new Error("Option cannot be modified: "+$);return Z._set(L,C,k)},_setAll:function($,C,k){if(!$)return!1;var P,L=!1;for(P in $)G.hasOwn($,P)&&this._set(P,$[P],C,k)&&(L=!0);return L}},{_createAccessor:function($,C,k){var P={get:function(){return Z._get($,C)}};$.modifiable&&(P.set=function(L){Z._set($,L,C)&&k(L,$)}),Object.defineProperty(C,$.name,P)},_get:function($,C){return C["_"+$.name]},_set:function($,C,k){var P="_"+$.name,L=k[P],X=$.transform(C!=null?C:$.defaultValue);return k[P]=X,X!==L}}),V=Z,H=_.extend(function(){this._services={}},{getService:function($){var C=this._services[$];if(!C)throw new Error("Service is not being managed with name: "+$);return C},setService:function($,C){if(this._services[$])throw new Error("Service is already managed with name: "+$);C&&(this._services[$]=C)}}),x=H,ue=new V([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,G.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,G.abs),new K("level",!0,"L",G.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,G.abs),new K("size",!0,100,G.abs),new K("value",!0,"")]),re=new x,Q=_.extend(function($){ue.init($,this,this.update.bind(this));var C=ue.get("element",this),k=re.getService("element"),P=C&&k.isCanvas(C)?C:k.createCanvas(),L=C&&k.isImage(C)?C:k.createImage();this._canvasRenderer=new g(this,P,!0),this._imageRenderer=new j(this,L,L===C),this.update()},{get:function(){return ue.getAll(this)},set:function($){ue.setAll($,this)&&this.update()},toDataURL:function($){return this.canvas.toDataURL($||this.mime)},update:function(){var $=new te({level:this.level,value:this.value});this._canvasRenderer.render($),this._imageRenderer.render($)}},{use:function($){re.setService($.getName(),$)}});Object.defineProperties(Q.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var z=Q,we=z,He=_.extend({getName:function(){}}),Ie=He,Se=Ie.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function($){},isImage:function($){}}),ye=Se,he=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function($){return $ instanceof HTMLCanvasElement},isImage:function($){return $ instanceof HTMLImageElement}}),$e=he;we.use(new $e);var be=we;return be})})(u1);const h_=u1.exports;function v_(t){let e,l;return{c(){e=m("img"),ps(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!ps(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:pe,o:pe,d(n){n&&S(e)}}}function b_(t,e,l){const n=new h_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:c="200"}=e,{value:a=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function v(){n.set({background:o,foreground:u,level:i,padding:f,size:c,value:a}),l(2,_=n.toDataURL("image/jpeg"))}return dc(()=>{v()}),t.$$set=h=>{"errorCorrection"in h&&l(3,i=h.errorCorrection),"background"in h&&l(4,o=h.background),"color"in h&&l(5,u=h.color),"size"in h&&l(6,c=h.size),"value"in h&&l(0,a=h.value),"padding"in h&&l(7,f=h.padding),"className"in h&&l(1,p=h.className)},t.$$.update=()=>{t.$$.dirty&1&&a&&v()},[a,p,_,i,o,u,c,f]}class g_ extends Re{constructor(e){super(),Le(this,e,b_,v_,Ee,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function lf(t,e,l){const n=t.slice();return n[101]=e[l],n[102]=e,n[103]=l,n}function nf(t,e,l){const n=t.slice();return n[104]=e[l],n[105]=e,n[106]=l,n}function k_(t,e,l){const n=t.slice();return n[107]=e[l],n}function w_(t,e,l){const n=t.slice();return n[110]=e[l],n}function y_(t){let e,l;return{c(){e=m("option"),l=N(t[110]),e.__value=t[110],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:pe,d(n){n&&S(e)}}}function C_(t){let e;return{c(){e=N("Configure price")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,l,u),oe(l,t[3].p.t),n||(i=ee(l,"input",t[21]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&oe(l,o[3].p.t)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;return{c(){e=m("div"),l=N("Username"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(o,"maxlength","36"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(_,"maxlength","36"),r(c,"class","my-1")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].g.u),M(d,u,g),M(d,c,g),s(c,a),s(c,f),s(c,p),s(c,_),oe(_,t[3].g.p),v||(h=[ee(o,"input",t[23]),ee(_,"input",t[24])],v=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&oe(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&oe(_,d[3].g.p)},d(d){d&&S(e),d&&S(u),d&&S(c),v=!1,Ge(h)}}}function S_(t){let e,l=t[107]*100+"",n;return{c(){e=m("option"),n=N(l),e.__value=t[107]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:pe,d(i){i&&S(e)}}}function rf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){M(o,e,u),M(o,l,u),oe(l,t[3].m.e.k),n||(i=ee(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&oe(l,o[3].m.e.k)},d(o){o&&S(e),o&&S(l),n=!1,i()}}}function af(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].m.e.a),u||(c=ee(o,"input",t[36]),u=!0)},p(a,f){f[0]&8&&o.value!==a[3].m.e.a&&oe(o,a[3].m.e.a)},d(a){a&&S(e),u=!1,c()}}}function uf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W;return{c(){e=m("div"),l=m("div"),n=N("Watt"),i=m("br"),o=b(),u=m("input"),c=b(),a=m("div"),f=N("Volt"),p=m("br"),_=b(),v=m("input"),h=b(),d=m("div"),g=N("Amp"),w=m("br"),D=b(),T=m("input"),E=b(),F=m("div"),O=N("kWh"),R=m("br"),y=b(),A=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(v,"name","mmv"),r(v,"type","number"),r(v,"min","0.00"),r(v,"max","1000"),r(v,"step","0.001"),r(v,"class","in-m tr w-full"),r(a,"class","w-1/4"),r(T,"name","mma"),r(T,"type","number"),r(T,"min","0.00"),r(T,"max","1000"),r(T,"step","0.001"),r(T,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(A,"name","mmc"),r(A,"type","number"),r(A,"min","0.00"),r(A,"max","1000"),r(A,"step","0.001"),r(A,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(j,U){M(j,e,U),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),oe(u,t[3].m.m.w),s(e,c),s(e,a),s(a,f),s(a,p),s(a,_),s(a,v),oe(v,t[3].m.m.v),s(e,h),s(e,d),s(d,g),s(d,w),s(d,D),s(d,T),oe(T,t[3].m.m.a),s(e,E),s(e,F),s(F,O),s(F,R),s(F,y),s(F,A),oe(A,t[3].m.m.c),te||(W=[ee(u,"input",t[38]),ee(v,"input",t[39]),ee(T,"input",t[40]),ee(A,"input",t[41])],te=!0)},p(j,U){U[0]&8&&ge(u.value)!==j[3].m.m.w&&oe(u,j[3].m.m.w),U[0]&8&&ge(v.value)!==j[3].m.m.v&&oe(v,j[3].m.m.v),U[0]&8&&ge(T.value)!==j[3].m.m.a&&oe(T,j[3].m.m.a),U[0]&8&&ge(A.value)!==j[3].m.m.c&&oe(A,j[3].m.m.c)},d(j){j&&S(e),te=!1,Ge(W)}}}function ff(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function cf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("Password"),f=m("br"),p=b(),_=m("input"),v=b(),h=m("div"),d=m("div"),g=N("Power saving"),w=m("br"),D=b(),T=m("select"),E=m("option"),E.textContent="Default",F=m("option"),F.textContent="Off",O=m("option"),O.textContent="Minimum",R=m("option"),R.textContent="Maximum",y=b(),A=m("div"),te=N("Power"),W=m("br"),j=b(),U=m("div"),K=m("input"),Y=b(),G=m("span"),G.textContent="dBm",Z=b(),V=m("div"),H=m("label"),x=m("input"),ue=N(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(c,"class","my-1"),E.__value=255,E.value=E.__value,F.__value=0,F.value=F.__value,O.__value=1,O.value=O.__value,R.__value=2,R.value=R.__value,r(T,"name","wz"),r(T,"class","in-s"),t[3].w.z===void 0&&ze(()=>t[45].call(T)),r(d,"class","w-1/2"),r(K,"name","ww"),r(K,"type","number"),r(K,"min","0"),r(K,"max","20.5"),r(K,"step","0.5"),r(K,"class","in-f tr w-full"),r(G,"class","in-post"),r(U,"class","flex"),r(A,"class","ml-2 w-1/2"),r(h,"class","my-1 flex"),r(x,"type","checkbox"),r(x,"name","wb"),x.__value="true",x.value=x.__value,r(x,"class","rounded mb-1"),r(V,"class","my-3")},m(z,we){M(z,e,we),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].w.s),M(z,u,we),M(z,c,we),s(c,a),s(c,f),s(c,p),s(c,_),oe(_,t[3].w.p),M(z,v,we),M(z,h,we),s(h,d),s(d,g),s(d,w),s(d,D),s(d,T),s(T,E),s(T,F),s(T,O),s(T,R),Me(T,t[3].w.z,!0),s(h,y),s(h,A),s(A,te),s(A,W),s(A,j),s(A,U),s(U,K),oe(K,t[3].w.w),s(U,Y),s(U,G),M(z,Z,we),M(z,V,we),s(V,H),s(H,x),x.checked=t[3].w.b,s(H,ue),re||(Q=[ee(o,"input",t[43]),ee(_,"input",t[44]),ee(T,"change",t[45]),ee(K,"input",t[46]),ee(x,"change",t[47])],re=!0)},p(z,we){we[0]&8&&o.value!==z[3].w.s&&oe(o,z[3].w.s),we[0]&8&&_.value!==z[3].w.p&&oe(_,z[3].w.p),we[0]&8&&Me(T,z[3].w.z),we[0]&8&&ge(K.value)!==z[3].w.w&&oe(K,z[3].w.w),we[0]&8&&(x.checked=z[3].w.b)},d(z){z&&S(e),z&&S(u),z&&S(c),z&&S(v),z&&S(h),z&&S(Z),z&&S(V),re=!1,Ge(Q)}}}function mf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w;return{c(){e=m("div"),l=N("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),c=m("div"),a=N("DNS"),f=m("br"),p=b(),_=m("div"),v=m("input"),h=b(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(v,"name","nd1"),r(v,"type","text"),r(v,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(c,"class","my-1")},m(D,T){M(D,e,T),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].n.g),M(D,u,T),M(D,c,T),s(c,a),s(c,f),s(c,p),s(c,_),s(_,v),oe(v,t[3].n.d1),s(_,h),s(_,d),oe(d,t[3].n.d2),g||(w=[ee(o,"input",t[51]),ee(v,"input",t[52]),ee(d,"input",t[53])],g=!0)},p(D,T){T[0]&8&&o.value!==D[3].n.g&&oe(o,D[3].n.g),T[0]&8&&v.value!==D[3].n.d1&&oe(v,D[3].n.d1),T[0]&8&&d.value!==D[3].n.d2&&oe(d,D[3].n.d2)},d(D){D&&S(e),D&&S(u),D&&S(c),g=!1,Ge(w)}}}function _f(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=N(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,c){M(u,e,c),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[57]),ee(l,"change",t[14])],i=!0)},p(u,c){c[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&S(e),i=!1,Ge(o)}}}function pf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;const d=[T_,M_],g=[];function w(y,A){return y[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const D=[A_,E_],T=[];function E(y,A){return y[3].q.s.r?0:1}c=E(t),a=T[c]=D[c](t);const F=[R_,L_],O=[];function R(y,A){return y[3].q.s.k?0:1}return _=R(t),v=O[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),a.c(),f=b(),p=m("span"),v.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(y,A){M(y,e,A),s(e,l),g[n].m(l,null),s(e,o),s(e,u),T[c].m(u,null),s(e,f),s(e,p),O[_].m(p,null),h=!0},p(y,A){let te=n;n=w(y),n===te?g[n].p(y,A):(Ae(),q(g[te],1,1,()=>{g[te]=null}),Pe(),i=g[n],i?i.p(y,A):(i=g[n]=d[n](y),i.c()),I(i,1),i.m(l,null));let W=c;c=E(y),c===W?T[c].p(y,A):(Ae(),q(T[W],1,1,()=>{T[W]=null}),Pe(),a=T[c],a?a.p(y,A):(a=T[c]=D[c](y),a.c()),I(a,1),a.m(u,null));let j=_;_=R(y),_===j?O[_].p(y,A):(Ae(),q(O[j],1,1,()=>{O[j]=null}),Pe(),v=O[_],v?v.p(y,A):(v=O[_]=F[_](y),v.c()),I(v,1),v.m(p,null))},i(y){h||(I(i),I(a),I(v),h=!0)},o(y){q(i),q(a),q(v),h=!1},d(y){y&&S(e),g[n].d(),T[c].d(),O[_].d()}}}function M_(t){let e,l;return e=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[$_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function T_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-ca",$$slots:{default:[N_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function $_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function N_(t){let e;return{c(){e=N("CA OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function E_(t){let e,l;return e=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[P_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function A_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-cert",$$slots:{default:[D_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function P_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function D_(t){let e;return{c(){e=N("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function L_(t){let e,l;return e=new Xt({props:{to:"/mqtt-key",$$slots:{default:[I_]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function R_(t){let e,l,n,i,o,u,c,a;return l=new Xt({props:{to:"/mqtt-key",$$slots:{default:[O_]},$$scope:{ctx:t}}}),o=new ys({}),{c(){e=m("span"),se(l.$$.fragment),n=b(),i=m("span"),se(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),ne(l,e,null),M(f,n,p),M(f,i,p),ne(o,i,null),u=!0,c||(a=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],c=!0)},p(f,p){const _={};p[3]&1048576&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(I(l.$$.fragment,f),I(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&S(e),ie(l),f&&S(n),f&&S(i),ie(o),c=!1,Ge(a)}}}function I_(t){let e,l;return e=new un({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function O_(t){let e;return{c(){e=N("Key OK")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function df(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("div"),_=N("Electricity IDX"),v=m("br"),h=b(),d=m("input"),g=b(),w=m("div"),D=N("Current IDX"),T=m("br"),E=b(),F=m("input"),O=b(),R=m("div"),y=N(`Voltage IDX: L1, L2 & L3 + `),A=m("div"),te=m("input"),W=b(),j=m("input"),U=b(),K=m("input"),r(l,"class","text-sm"),r(i,"href",Rt("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","o"),c.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(te,"name","ou1"),r(te,"type","text"),r(te,"class","in-f tr w-1/3"),r(j,"name","ou2"),r(j,"type","text"),r(j,"class","in-m tr w-1/3"),r(K,"name","ou3"),r(K,"type","text"),r(K,"class","in-l tr w-1/3"),r(A,"class","flex"),r(R,"class","my-1"),r(e,"class","cnt")},m(V,H){M(V,e,H),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),oe(d,t[3].o.e),s(f,g),s(f,w),s(w,D),s(w,T),s(w,E),s(w,F),oe(F,t[3].o.c),s(e,O),s(e,R),s(R,y),s(R,A),s(A,te),oe(te,t[3].o.u1),s(A,W),s(A,j),oe(j,t[3].o.u2),s(A,U),s(A,K),oe(K,t[3].o.u3),Y=!0,G||(Z=[ee(d,"input",t[65]),ee(F,"input",t[66]),ee(te,"input",t[67]),ee(j,"input",t[68]),ee(K,"input",t[69])],G=!0)},p(V,H){H[0]&8&&d.value!==V[3].o.e&&oe(d,V[3].o.e),H[0]&8&&F.value!==V[3].o.c&&oe(F,V[3].o.c),H[0]&8&&te.value!==V[3].o.u1&&oe(te,V[3].o.u1),H[0]&8&&j.value!==V[3].o.u2&&oe(j,V[3].o.u2),H[0]&8&&K.value!==V[3].o.u3&&oe(K,V[3].o.u3)},i(V){Y||(I(o.$$.fragment,V),Y=!0)},o(V){q(o.$$.fragment,V),Y=!1},d(V){V&&S(e),ie(o),G=!1,Ge(Z)}}}function hf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=N("Discovery topic prefix"),_=m("br"),v=b(),h=m("input"),d=b(),g=m("div"),w=N("Hostname for URL"),D=m("br"),T=b(),E=m("input"),O=b(),R=m("div"),y=N("Name tag"),A=m("br"),te=b(),W=m("input"),r(l,"class","text-sm"),r(i,"href",Rt("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","h"),c.value="true",r(h,"name","ht"),r(h,"type","text"),r(h,"class","in-s"),r(h,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(W,"name","hn"),r(W,"type","text"),r(W,"class","in-s"),r(R,"class","my-1"),r(e,"class","cnt")},m(Y,G){M(Y,e,G),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),s(f,v),s(f,h),oe(h,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,D),s(g,T),s(g,E),oe(E,t[3].h.h),s(e,O),s(e,R),s(R,y),s(R,A),s(R,te),s(R,W),oe(W,t[3].h.n),j=!0,U||(K=[ee(h,"input",t[70]),ee(E,"input",t[71]),ee(W,"input",t[72])],U=!0)},p(Y,G){G[0]&8&&h.value!==Y[3].h.t&&oe(h,Y[3].h.t),(!j||G[0]&8&&F!==(F=Y[3].g.h+".local"))&&r(E,"placeholder",F),G[0]&8&&E.value!==Y[3].h.h&&oe(E,Y[3].h.h),G[0]&8&&W.value!==Y[3].h.n&&oe(W,Y[3].h.n)},i(Y){j||(I(o.$$.fragment,Y),j=!0)},o(Y){q(o.$$.fragment,Y),j=!1},d(Y){Y&&S(e),ie(o),U=!1,Ge(K)}}}function vf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O;o=new Lt({});let R=t[3].c.es&&bf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),se(o.$$.fragment),u=b(),c=m("input"),a=b(),f=m("div"),p=m("label"),_=m("input"),v=N(" AMSreader cloud"),h=b(),d=m("div"),g=m("label"),w=m("input"),D=N(" Energy Speedometer"),T=b(),R&&R.c(),r(l,"class","text-sm"),r(i,"href",Rt("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"type","hidden"),r(c,"name","c"),c.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(w,"type","checkbox"),r(w,"class","rounded mb-1"),r(w,"name","ces"),w.__value="true",w.value=w.__value,r(d,"class","my-1"),r(e,"class","cnt")},m(y,A){M(y,e,A),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,v),s(e,h),s(e,d),s(d,g),s(g,w),w.checked=t[3].c.es,s(g,D),s(d,T),R&&R.m(d,null),E=!0,F||(O=[ee(_,"change",t[73]),ee(w,"change",t[74])],F=!0)},p(y,A){A[0]&8&&(_.checked=y[3].c.e),A[0]&8&&(w.checked=y[3].c.es),y[3].c.es?R?(R.p(y,A),A[0]&8&&I(R,1)):(R=bf(y),R.c(),I(R,1),R.m(d,null)):R&&(Ae(),q(R,1,1,()=>{R=null}),Pe())},i(y){E||(I(o.$$.fragment,y),I(R),E=!0)},o(y){q(o.$$.fragment,y),q(R),E=!1},d(y){y&&S(e),ie(o),R&&R.d(),F=!1,Ge(O)}}}function bf(t){let e,l,n=t[0].mac+"",i,o,u,c,a=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,v,h=t[0].mac&&t[0].meter.id&&gf(t);return{c(){e=m("div"),l=N("MAC: "),i=N(n),o=b(),u=m("div"),c=N("Meter ID: "),f=N(a),p=b(),h&&h.c(),_=Ke(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,l),s(e,i),M(d,o,g),M(d,u,g),s(u,c),s(u,f),M(d,p,g),h&&h.m(d,g),M(d,_,g),v=!0},p(d,g){(!v||g[0]&1)&&n!==(n=d[0].mac+"")&&J(i,n),(!v||g[0]&1)&&a!==(a=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&J(f,a),d[0].mac&&d[0].meter.id?h?(h.p(d,g),g[0]&1&&I(h,1)):(h=gf(d),h.c(),I(h,1),h.m(_.parentNode,_)):h&&(Ae(),q(h,1,1,()=>{h=null}),Pe())},i(d){v||(I(h),v=!0)},o(d){q(h),v=!1},d(d){d&&S(e),d&&S(o),d&&S(u),d&&S(p),h&&h.d(d),d&&S(_)}}}function gf(t){let e,l,n;return l=new g_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),se(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),ne(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(I(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&S(e),ie(l)}}}function kf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E;o=new Lt({});let F={length:9},O=[];for(let R=0;R20&&Sf(t),_=t[3].i.d.d>0&&$f(t),v=t[0].chip=="esp8266"&&Nf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),se(o.$$.fragment),u=b(),p&&p.c(),c=b(),_&&_.c(),a=b(),v&&v.c(),r(l,"class","text-sm"),r(i,"href",Rt("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(h,d){M(h,e,d),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),p&&p.m(e,null),s(e,c),_&&_.m(e,null),s(e,a),v&&v.m(e,null),f=!0},p(h,d){h[0].board>20?p?(p.p(h,d),d[0]&1&&I(p,1)):(p=Sf(h),p.c(),I(p,1),p.m(e,c)):p&&(Ae(),q(p,1,1,()=>{p=null}),Pe()),h[3].i.d.d>0?_?_.p(h,d):(_=$f(h),_.c(),_.m(e,a)):_&&(_.d(1),_=null),h[0].chip=="esp8266"?v?v.p(h,d):(v=Nf(h),v.c(),v.m(e,null)):v&&(v.d(1),v=null)},i(h){f||(I(o.$$.fragment,h),I(p),f=!0)},o(h){q(o.$$.fragment,h),q(p),f=!1},d(h){h&&S(e),ie(o),p&&p.d(),_&&_.d(),v&&v.d()}}}function Sf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et;f=new ao({props:{chip:t[0].chip}}),w=new ao({props:{chip:t[0].chip}});let Be=t[0].chip!="esp8266"&&Mf(t),Fe=t[3].i.v.p>0&&Tf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("HAN RX"),u=m("br"),c=b(),a=m("select"),se(f.$$.fragment),p=b(),_=m("div"),v=N("HAN TX"),h=m("br"),d=b(),g=m("select"),se(w.$$.fragment),D=b(),T=m("div"),E=m("label"),F=m("input"),O=N(" pullup"),R=b(),y=m("div"),A=m("div"),te=N("AP button"),W=m("br"),j=b(),U=m("input"),K=b(),Y=m("div"),G=N("LED"),Z=m("br"),V=b(),H=m("div"),x=m("input"),ue=b(),re=m("div"),Q=m("label"),z=m("input"),we=N(" inverted"),He=b(),Ie=m("div"),Se=N("RGB"),ye=m("label"),he=m("input"),$e=N(" inverted"),be=m("br"),$=b(),C=m("div"),k=m("input"),P=b(),L=m("input"),X=b(),le=m("input"),fe=b(),de=m("div"),Ce=m("div"),Oe=N(`LED dis. GPIO + `),ae=m("input"),Te=b(),Je=m("div"),It=N("Temperature"),st=m("br"),kt=b(),nt=m("input"),Ot=b(),Qe=m("div"),Zt=N("Analog temp"),zt=m("br"),ht=b(),xe=m("input"),Ve=b(),Be&&Be.c(),Ye=b(),Fe&&Fe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(a,"name","ihp"),r(a,"class","in-f w-full"),t[3].i.h.p===void 0&&ze(()=>t[78].call(a)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&ze(()=>t[79].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(E,"class","ml-2"),r(T,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(U,"name","ia"),r(U,"type","number"),r(U,"min","0"),r(U,"max",t[6]),r(U,"class","in-f tr w-full"),r(A,"class","w-1/3"),r(x,"name","ilp"),r(x,"type","number"),r(x,"min","0"),r(x,"max",t[6]),r(x,"class","in-l tr w-full"),r(H,"class","flex"),r(Y,"class","w-1/3"),r(z,"name","ili"),z.__value="true",z.value=z.__value,r(z,"type","checkbox"),r(z,"class","rounded mb-1"),r(Q,"class","ml-4"),r(re,"class","w-1/3"),r(he,"name","iri"),he.__value="true",he.value=he.__value,r(he,"type","checkbox"),r(he,"class","rounded mb-1"),r(ye,"class","ml-4"),r(k,"name","irr"),r(k,"type","number"),r(k,"min","0"),r(k,"max",t[6]),r(k,"class","in-f tr w-1/3"),r(L,"name","irg"),r(L,"type","number"),r(L,"min","0"),r(L,"max",t[6]),r(L,"class","in-m tr w-1/3"),r(le,"name","irb"),r(le,"type","number"),r(le,"min","0"),r(le,"max",t[6]),r(le,"class","in-l tr w-1/3"),r(C,"class","flex"),r(Ie,"class","w-full"),r(ae,"name","idd"),r(ae,"type","number"),r(ae,"min","0"),r(ae,"max",t[6]),r(ae,"class","in-s tr"),r(Ce,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(nt,"name","itd"),r(nt,"type","number"),r(nt,"min","0"),r(nt,"max",t[6]),r(nt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(xe,"name","ita"),r(xe,"type","number"),r(xe,"min","0"),r(xe,"max",t[6]),r(xe,"class","in-l tr w-full"),r(Qe,"class","my-1 pr-1 w-1/3"),r(y,"class","flex flex-wrap")},m(_e,ce){M(_e,e,ce),M(_e,l,ce),M(_e,n,ce),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),ne(f,a,null),Me(a,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,v),s(_,h),s(_,d),s(_,g),ne(w,g,null),Me(g,t[3].i.h.t,!0),s(n,D),s(n,T),s(T,E),s(E,F),F.checked=t[3].i.h.u,s(E,O),M(_e,R,ce),M(_e,y,ce),s(y,A),s(A,te),s(A,W),s(A,j),s(A,U),oe(U,t[3].i.a),s(y,K),s(y,Y),s(Y,G),s(Y,Z),s(Y,V),s(Y,H),s(H,x),oe(x,t[3].i.l.p),s(y,ue),s(y,re),s(re,Q),s(Q,z),z.checked=t[3].i.l.i,s(Q,we),s(y,He),s(y,Ie),s(Ie,Se),s(Ie,ye),s(ye,he),he.checked=t[3].i.r.i,s(ye,$e),s(Ie,be),s(Ie,$),s(Ie,C),s(C,k),oe(k,t[3].i.r.r),s(C,P),s(C,L),oe(L,t[3].i.r.g),s(C,X),s(C,le),oe(le,t[3].i.r.b),s(y,fe),s(y,de),s(de,Ce),s(Ce,Oe),s(Ce,ae),oe(ae,t[3].i.d.d),s(y,Te),s(y,Je),s(Je,It),s(Je,st),s(Je,kt),s(Je,nt),oe(nt,t[3].i.t.d),s(y,Ot),s(y,Qe),s(Qe,Zt),s(Qe,zt),s(Qe,ht),s(Qe,xe),oe(xe,t[3].i.t.a),s(y,Ve),Be&&Be.m(y,null),s(y,Ye),Fe&&Fe.m(y,null),Ne=!0,Ze||(et=[ee(a,"change",t[78]),ee(g,"change",t[79]),ee(F,"change",t[80]),ee(U,"input",t[81]),ee(x,"input",t[82]),ee(z,"change",t[83]),ee(he,"change",t[84]),ee(k,"input",t[85]),ee(L,"input",t[86]),ee(le,"input",t[87]),ee(ae,"input",t[88]),ee(nt,"input",t[89]),ee(xe,"input",t[90])],Ze=!0)},p(_e,ce){const qe={};ce[0]&1&&(qe.chip=_e[0].chip),f.$set(qe),ce[0]&8&&Me(a,_e[3].i.h.p);const pt={};ce[0]&1&&(pt.chip=_e[0].chip),w.$set(pt),ce[0]&8&&Me(g,_e[3].i.h.t),ce[0]&8&&(F.checked=_e[3].i.h.u),(!Ne||ce[0]&64)&&r(U,"max",_e[6]),ce[0]&8&&ge(U.value)!==_e[3].i.a&&oe(U,_e[3].i.a),(!Ne||ce[0]&64)&&r(x,"max",_e[6]),ce[0]&8&&ge(x.value)!==_e[3].i.l.p&&oe(x,_e[3].i.l.p),ce[0]&8&&(z.checked=_e[3].i.l.i),ce[0]&8&&(he.checked=_e[3].i.r.i),(!Ne||ce[0]&64)&&r(k,"max",_e[6]),ce[0]&8&&ge(k.value)!==_e[3].i.r.r&&oe(k,_e[3].i.r.r),(!Ne||ce[0]&64)&&r(L,"max",_e[6]),ce[0]&8&&ge(L.value)!==_e[3].i.r.g&&oe(L,_e[3].i.r.g),(!Ne||ce[0]&64)&&r(le,"max",_e[6]),ce[0]&8&&ge(le.value)!==_e[3].i.r.b&&oe(le,_e[3].i.r.b),(!Ne||ce[0]&64)&&r(ae,"max",_e[6]),ce[0]&8&&ge(ae.value)!==_e[3].i.d.d&&oe(ae,_e[3].i.d.d),(!Ne||ce[0]&64)&&r(nt,"max",_e[6]),ce[0]&8&&ge(nt.value)!==_e[3].i.t.d&&oe(nt,_e[3].i.t.d),(!Ne||ce[0]&64)&&r(xe,"max",_e[6]),ce[0]&8&&ge(xe.value)!==_e[3].i.t.a&&oe(xe,_e[3].i.t.a),_e[0].chip!="esp8266"?Be?Be.p(_e,ce):(Be=Mf(_e),Be.c(),Be.m(y,Ye)):Be&&(Be.d(1),Be=null),_e[3].i.v.p>0?Fe?Fe.p(_e,ce):(Fe=Tf(_e),Fe.c(),Fe.m(y,null)):Fe&&(Fe.d(1),Fe=null)},i(_e){Ne||(I(f.$$.fragment,_e),I(w.$$.fragment,_e),Ne=!0)},o(_e){q(f.$$.fragment,_e),q(w.$$.fragment,_e),Ne=!1},d(_e){_e&&S(e),_e&&S(l),_e&&S(n),ie(f),ie(w),_e&&S(R),_e&&S(y),Be&&Be.d(),Fe&&Fe.d(),Ze=!1,Ge(et)}}}function Mf(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.p),u||(c=ee(o,"input",t[91]),u=!0)},p(a,f){f[0]&64&&r(o,"max",a[6]),f[0]&8&&ge(o.value)!==a[3].i.v.p&&oe(o,a[3].i.v.p)},d(a){a&&S(e),u=!1,c()}}}function Tf(t){let e,l,n,i,o,u,c,a,f,p;return{c(){e=m("div"),l=N("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),c=b(),a=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(a,"name","ivdg"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-l tr w-full"),r(a,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,v){M(_,e,v),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),oe(u,t[3].i.v.d.v),s(o,c),s(o,a),oe(a,t[3].i.v.d.g),f||(p=[ee(u,"input",t[92]),ee(a,"input",t[93])],f=!0)},p(_,v){v[0]&8&&ge(u.value)!==_[3].i.v.d.v&&oe(u,_[3].i.v.d.v),v[0]&8&&ge(a.value)!==_[3].i.v.d.g&&oe(a,_[3].i.v.d.g)},d(_){_&&S(e),f=!1,Ge(p)}}}function $f(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N(`LED behaviour + `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&ze(()=>t[94].call(n)),r(e,"class","my-1 w-full")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Me(n,t[3].i.d.b,!0),u||(c=ee(n,"change",t[94]),u=!0)},p(a,f){f[0]&8&&Me(n,a[3].i.d.b)},d(a){a&&S(e),u=!1,c()}}}function Nf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T=(t[0].board==2||t[0].board==100)&&Ef(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=N("Vcc offset"),u=m("br"),c=b(),a=m("input"),f=b(),p=m("div"),_=N("Multiplier"),v=m("br"),h=b(),d=m("input"),g=b(),T&&T.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(a,"name","ivo"),r(a,"type","number"),r(a,"min","0.0"),r(a,"max","3.5"),r(a,"step","0.01"),r(a,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,F){M(E,e,F),M(E,l,F),M(E,n,F),s(n,i),s(i,o),s(i,u),s(i,c),s(i,a),oe(a,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,v),s(p,h),s(p,d),oe(d,t[3].i.v.m),s(n,g),T&&T.m(n,null),w||(D=[ee(a,"input",t[95]),ee(d,"input",t[96])],w=!0)},p(E,F){F[0]&8&&ge(a.value)!==E[3].i.v.o&&oe(a,E[3].i.v.o),F[0]&8&&ge(d.value)!==E[3].i.v.m&&oe(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,F):(T=Ef(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&S(e),E&&S(l),E&&S(n),T&&T.d(),w=!1,Ge(D)}}}function Ef(t){let e,l,n,i,o,u,c;return{c(){e=m("div"),l=N("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.b),u||(c=ee(o,"input",t[97]),u=!0)},p(a,f){f[0]&8&&ge(o.value)!==a[3].i.v.b&&oe(o,a[3].i.v.b)},d(a){a&&S(e),u=!1,c()}}}function Af(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D=t[3].d.t&&Pf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=N(" Enable telnet"),c=b(),D&&D.c(),a=b(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",v=m("option"),v.textContent="Debug",h=m("option"),h.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,v.__value=2,v.value=v.__value,h.__value=3,h.value=h.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&ze(()=>t[100].call(p)),r(f,"class","my-1")},m(T,E){M(T,e,E),M(T,l,E),M(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(T,c,E),D&&D.m(T,E),M(T,a,E),M(T,f,E),s(f,p),s(p,_),s(p,v),s(p,h),s(p,d),Me(p,t[3].d.l,!0),g||(w=[ee(o,"change",t[99]),ee(p,"change",t[100])],g=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?D||(D=Pf(),D.c(),D.m(a.parentNode,a)):D&&(D.d(1),D=null),E[0]&8&&Me(p,T[3].d.l)},d(T){T&&S(e),T&&S(l),T&&S(n),T&&S(c),D&&D.d(T),T&&S(a),T&&S(f),g=!1,Ge(w)}}}function Pf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function F_(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et,Be,Fe,_e,ce,qe,pt,Nl,El,Al,Ni,oi,gl,Ei,Ai,Pi,wt,Di,je,pn,Li,Pl,Dl,Ri,Wl,Ii,zl,Oi,We,yt,Gl,Cs,Gt,Vt,Ll,Fi,al,Bi,No,Ss,Eo,ri,Jt,Ao,Po,Rl,ul,Il,Do,qi,Lo,vt,Ol,Ro,Ui,dn,hn,vn,bn,ji,Io,Ft,Hi,Oo,Vl,Fo,Bo,qo,fl,gn,kn,Uo,wn,Kl,jo,Ho,Wo,yn,xt,zo,Wi,Go,Yl,Vo,Ko,Yo,Cn,el,Qo,zi,Xo,Ms,Zo,Ql,Gi,tl,Jo,xo,er,Ts,Vi,ll,tr,lr,nr,Bt,Ki,ir,Sn,Mn,sr,ai,or,Xl,rr,ar,ur,Kt,Tn,$n,fr,cr,mt,Yi,mr,Nn,En,_r,Zl,pr,dr,hr,Fl,cl,An,Pn,vr,qt,Qi,Xi,br,Ut,Dn,Zi,Ji,gr,$s,xi,es,nl,kr,wr,ui,yr,Bl,Cr,fi,il,Sr,Mr,Tr,ts,kl,$r,lt,ls,Nr,Ln,Rn,Er,ci,Ar,ml,Pr,Ns,Dr,Lr,In,wl,Rr,sl,Ir,Es,Jl,Or,Fr,Br,yl,qr,xl,Ur,jr,Hr,Cl,Wr,On,Fn,zr,Gr,Vr,Sl,Kr,Bn,Yr,Qr,Xr,Ct,qn,Un,jn,Hn,Wn,zn,Zr,en,Jr,xr,ea,Ml,ta,As,Ps,Ds,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Rs,_l,ns,la,Gn,Vn,na,mi,ia,_i,sa,Is,jt,is,oa,Kn,Yn,ra,pi,aa,ss,os,ol,ua,fa,ca,ql,Os,Qn,ma,rs,Xn,_a,as,Fs,tn,Bs,ln,qs,nn,Us,sn,Yt,js,pa;c=new Lt({}),A=new m_({});let f1=["NOK","SEK","DKK","EUR","CHF"],di=[];for(let B=0;B<5;B+=1)di[B]=y_(w_(t,f1,B));ht=new Xt({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[C_]},$$scope:{ctx:t}}});let St=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),Mt=t[3].g.s>0&&of(t);Dl=new Lt({});let c1=[24,48,96,192,384,576,1152],hi=[];for(let B=0;B<7;B+=1)hi[B]=S_(k_(t,c1,B));let Tt=t[3].m.e.e&&rf(t),$t=t[3].m.e.e&&af(t),Nt=t[3].m.m.e&&uf(t);Mn=new Lt({});let Ht=t[0].if&&t[0].if.eth&&ff(),Et=(t[3].n.c==1||t[3].n.c==2)&&cf(t);En=new Lt({}),Dn=new a1({});let At=t[3].n.m=="static"&&mf(t);Rn=new Lt({});let Pt=t[0].chip!="esp8266"&&_f(t),ot=t[3].q.s.e&&pf(t),rt=t[3].q.m==3&&df(t),at=t[3].q.m==4&&hf(t),ut=t[3].c.es!=null&&vf(t),ft=Ls&&kf(t);Vn=new Lt({});let Zn=t[7],bt=[];for(let B=0;B20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&Cf(t);Yn=new Lt({});let Dt=t[3].d.s&&Af(t);return tn=new gt({props:{active:t[1],message:"Loading configuration"}}),ln=new gt({props:{active:t[2],message:"Saving configuration"}}),nn=new gt({props:{active:t[4],message:"Performing factory reset"}}),sn=new gt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),se(c.$$.fragment),a=b(),f=m("input"),p=b(),_=m("div"),v=m("div"),h=m("div"),d=N("Hostname"),g=m("br"),w=b(),D=m("input"),T=b(),E=m("div"),F=N("Time zone"),O=m("br"),R=b(),y=m("select"),se(A.$$.fragment),te=b(),W=m("input"),j=b(),U=m("div"),K=m("div"),Y=m("div"),G=N("Price region"),Z=m("br"),V=b(),H=m("select"),x=m("optgroup"),ue=m("option"),ue.textContent="NO1",re=m("option"),re.textContent="NO2",Q=m("option"),Q.textContent="NO3",z=m("option"),z.textContent="NO4",we=m("option"),we.textContent="NO5",He=m("optgroup"),Ie=m("option"),Ie.textContent="SE1",Se=m("option"),Se.textContent="SE2",ye=m("option"),ye.textContent="SE3",he=m("option"),he.textContent="SE4",$e=m("optgroup"),be=m("option"),be.textContent="DK1",$=m("option"),$.textContent="DK2",C=m("option"),C.textContent="Austria",k=m("option"),k.textContent="Belgium",P=m("option"),P.textContent="Czech Republic",L=m("option"),L.textContent="Estonia",X=m("option"),X.textContent="Finland",le=m("option"),le.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",Ce=m("option"),Ce.textContent="Latvia",Oe=m("option"),Oe.textContent="Lithuania",ae=m("option"),ae.textContent="Netherland",Te=m("option"),Te.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",It=b(),st=m("div"),kt=N("Currency"),nt=m("br"),Ot=b(),Qe=m("select");for(let B=0;B<5;B+=1)di[B].c();Zt=b(),zt=m("div"),se(ht.$$.fragment),xe=b(),Ve=m("div"),Ye=m("label"),Ne=m("input"),Ze=N(" Enable price fetch from remote server"),et=b(),St&&St.c(),Be=b(),Fe=m("div"),_e=N("Security"),ce=m("br"),qe=b(),pt=m("select"),Nl=m("option"),Nl.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Ni=b(),Mt&&Mt.c(),oi=b(),gl=m("div"),Ei=N("Context"),Ai=m("br"),Pi=b(),wt=m("input"),Di=b(),je=m("div"),pn=m("strong"),pn.textContent="Meter",Li=b(),Pl=m("a"),se(Dl.$$.fragment),Ri=b(),Wl=m("input"),Ii=b(),zl=m("input"),Oi=b(),We=m("div"),yt=N("Communication"),Gl=m("br"),Cs=b(),Gt=m("select"),Vt=m("option"),Vt.textContent="Passive (Push)",Ll=m("option"),Ll.textContent="Kamstrup (Pull)",Fi=b(),al=m("div"),Bi=m("span"),Bi.textContent="Buffer size",No=b(),Ss=m("span"),Ss.textContent="Serial conf.",Eo=b(),ri=m("label"),Jt=m("input"),Ao=N(" inverted"),Po=b(),Rl=m("div"),ul=m("select"),Il=m("option"),Do=N("Autodetect");for(let B=0;B<7;B+=1)hi[B].c();Lo=b(),vt=m("select"),Ol=m("option"),Ro=N("-"),dn=m("option"),dn.textContent="7N1",hn=m("option"),hn.textContent="8N1",vn=m("option"),vn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Io=b(),Ft=m("input"),Oo=b(),Vl=m("div"),Fo=N("Voltage"),Bo=m("br"),qo=b(),fl=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Uo=b(),wn=m("div"),Kl=m("div"),jo=N("Main fuse"),Ho=m("br"),Wo=b(),yn=m("label"),xt=m("input"),zo=b(),Wi=m("span"),Wi.textContent="A",Go=b(),Yl=m("div"),Vo=N("Production"),Ko=m("br"),Yo=b(),Cn=m("label"),el=m("input"),Qo=b(),zi=m("span"),zi.textContent="kWp",Xo=b(),Ms=m("div"),Zo=b(),Ql=m("div"),Gi=m("label"),tl=m("input"),Jo=N(" Meter is encrypted"),xo=b(),Tt&&Tt.c(),er=b(),$t&&$t.c(),Ts=b(),Vi=m("label"),ll=m("input"),tr=N(" Multipliers"),lr=b(),Nt&&Nt.c(),nr=b(),Bt=m("div"),Ki=m("strong"),Ki.textContent="Connection",ir=b(),Sn=m("a"),se(Mn.$$.fragment),sr=b(),ai=m("input"),or=b(),Xl=m("div"),rr=N("Connection"),ar=m("br"),ur=b(),Kt=m("select"),Tn=m("option"),Tn.textContent="WiFi",$n=m("option"),$n.textContent="Access point",Ht&&Ht.c(),fr=b(),Et&&Et.c(),cr=b(),mt=m("div"),Yi=m("strong"),Yi.textContent="Network",mr=b(),Nn=m("a"),se(En.$$.fragment),_r=b(),Zl=m("div"),pr=N("IP"),dr=m("br"),hr=b(),Fl=m("div"),cl=m("select"),An=m("option"),An.textContent="DHCP",Pn=m("option"),Pn.textContent="Static",vr=b(),qt=m("input"),br=b(),Ut=m("select"),se(Dn.$$.fragment),gr=b(),At&&At.c(),$s=b(),xi=m("div"),es=m("label"),nl=m("input"),kr=N(" enable mDNS"),wr=b(),ui=m("input"),yr=b(),Bl=m("div"),Cr=N("NTP "),fi=m("label"),il=m("input"),Sr=N(" obtain from DHCP"),Mr=m("br"),Tr=b(),ts=m("div"),kl=m("input"),$r=b(),lt=m("div"),ls=m("strong"),ls.textContent="MQTT",Nr=b(),Ln=m("a"),se(Rn.$$.fragment),Er=b(),ci=m("input"),Ar=b(),ml=m("div"),Pr=N(`Server + `),Pt&&Pt.c(),Ns=b(),Dr=m("br"),Lr=b(),In=m("div"),wl=m("input"),Rr=b(),sl=m("input"),Ir=b(),ot&&ot.c(),Es=b(),Jl=m("div"),Or=N("Username"),Fr=m("br"),Br=b(),yl=m("input"),qr=b(),xl=m("div"),Ur=N("Password"),jr=m("br"),Hr=b(),Cl=m("input"),Wr=b(),On=m("div"),Fn=m("div"),zr=N("Client ID"),Gr=m("br"),Vr=b(),Sl=m("input"),Kr=b(),Bn=m("div"),Yr=N("Payload"),Qr=m("br"),Xr=b(),Ct=m("select"),qn=m("option"),qn.textContent="JSON",Un=m("option"),Un.textContent="Raw (minimal)",jn=m("option"),jn.textContent="Raw (full)",Hn=m("option"),Hn.textContent="Domoticz",Wn=m("option"),Wn.textContent="HomeAssistant",zn=m("option"),zn.textContent="HEX dump",Zr=b(),en=m("div"),Jr=N("Publish topic"),xr=m("br"),ea=b(),Ml=m("input"),ta=b(),rt&&rt.c(),As=b(),at&&at.c(),Ps=b(),ut&&ut.c(),Ds=b(),ft&&ft.c(),Rs=b(),_l=m("div"),ns=m("strong"),ns.textContent="User interface",la=b(),Gn=m("a"),se(Vn.$$.fragment),na=b(),mi=m("input"),ia=b(),_i=m("div");for(let B=0;BSave',Fs=b(),se(tn.$$.fragment),Bs=b(),se(ln.$$.fragment),qs=b(),se(nn.$$.fragment),Us=b(),se(sn.$$.fragment),r(i,"class","text-sm"),r(u,"href",Rt("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(D,"name","gh"),r(D,"type","text"),r(D,"class","in-f w-full"),r(D,"pattern","[A-Za-z0-9-]+"),r(y,"name","gt"),r(y,"class","in-l w-full"),t[3].g.t===void 0&&ze(()=>t[17].call(y)),r(v,"class","flex"),r(_,"class","my-1"),r(W,"type","hidden"),r(W,"name","p"),W.value="true",ue.__value="10YNO-1--------2",ue.value=ue.__value,re.__value="10YNO-2--------T",re.value=re.__value,Q.__value="10YNO-3--------J",Q.value=Q.__value,z.__value="10YNO-4--------9",z.value=z.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,r(x,"label","Norway"),Ie.__value="10Y1001A1001A44P",Ie.value=Ie.__value,Se.__value="10Y1001A1001A45N",Se.value=Se.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,he.__value="10Y1001A1001A47J",he.value=he.__value,r(He,"label","Sweden"),be.__value="10YDK-1--------W",be.value=be.__value,$.__value="10YDK-2--------M",$.value=$.__value,r($e,"label","Denmark"),C.__value="10YAT-APG------L",C.value=C.__value,k.__value="10YBE----------2",k.value=k.__value,P.__value="10YCZ-CEPS-----N",P.value=P.__value,L.__value="10Y1001A1001A39I",L.value=L.__value,X.__value="10YFI-1--------U",X.value=X.__value,le.__value="10YFR-RTE------C",le.value=le.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,Ce.__value="10YLV-1001A00074",Ce.value=Ce.__value,Oe.__value="10YLT-1001A0008Q",Oe.value=Oe.__value,ae.__value="10YNL----------L",ae.value=ae.__value,Te.__value="10YPL-AREA-----S",Te.value=Te.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(H,"name","pr"),r(H,"class","in-f w-full"),t[3].p.r===void 0&&ze(()=>t[18].call(H)),r(Y,"class","w-full"),r(Qe,"name","pc"),r(Qe,"class","in-l"),t[3].p.c===void 0&&ze(()=>t[19].call(Qe)),r(K,"class","flex"),r(U,"class","my-1"),r(zt,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",Ne.value=Ne.__value,r(Ne,"class","rounded mb-1"),r(Ve,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(pt,"name","gs"),r(pt,"class","in-s"),t[3].g.s===void 0&&ze(()=>t[22].call(pt)),r(Fe,"class","my-1"),r(wt,"name","gc"),r(wt,"type","text"),r(wt,"pattern","[A-Za-z0-9]+"),r(wt,"placeholder","[root]"),r(wt,"class","in-s"),r(wt,"maxlength","36"),r(gl,"class","my-1"),r(n,"class","cnt"),r(pn,"class","text-sm"),r(Pl,"href",Rt("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(Wl,"type","hidden"),r(Wl,"name","m"),Wl.value="true",r(zl,"type","hidden"),r(zl,"name","mo"),zl.value="1",Vt.__value=0,Vt.value=Vt.__value,Ll.__value=9,Ll.value=Ll.__value,r(Gt,"name","ma"),r(Gt,"class","in-s"),t[3].m.a===void 0&&ze(()=>t[26].call(Gt)),r(We,"class","my-1"),r(Bi,"class","float-right"),r(Jt,"name","mi"),Jt.__value="true",Jt.value=Jt.__value,r(Jt,"type","checkbox"),r(Jt,"class","rounded mb-1"),r(ri,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=qi=t[3].m.b!=0,r(ul,"name","mb"),r(ul,"class","in-f tr w-1/2"),t[3].m.b===void 0&&ze(()=>t[28].call(ul)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Ui=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,hn.__value=3,hn.value=hn.__value,vn.__value=10,vn.value=vn.__value,bn.__value=11,bn.value=bn.__value,r(vt,"name","mp"),r(vt,"class","in-m"),vt.disabled=ji=t[3].m.b==0,t[3].m.p===void 0&&ze(()=>t[29].call(vt)),r(Ft,"name","ms"),r(Ft,"type","number"),r(Ft,"min",64),r(Ft,"max",Hi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(Ft,"step",64),r(Ft,"class","in-l tr w-1/2"),r(Rl,"class","flex w-full"),r(al,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,r(fl,"name","md"),r(fl,"class","in-s"),t[3].m.d===void 0&&ze(()=>t[31].call(fl)),r(Vl,"class","my-1"),r(xt,"name","mf"),r(xt,"type","number"),r(xt,"min","5"),r(xt,"max","65535"),r(xt,"class","in-f tr w-full"),r(Wi,"class","in-post"),r(yn,"class","flex"),r(Kl,"class","mx-1"),r(el,"name","mr"),r(el,"type","number"),r(el,"min","0"),r(el,"max","65535"),r(el,"class","in-f tr w-full"),r(zi,"class","in-post"),r(Cn,"class","flex"),r(Yl,"class","mx-1"),r(wn,"class","my-1 flex"),r(Ms,"class","my-1"),r(tl,"type","checkbox"),r(tl,"name","me"),tl.__value="true",tl.value=tl.__value,r(tl,"class","rounded mb-1"),r(Ql,"class","my-1"),r(ll,"type","checkbox"),r(ll,"name","mm"),ll.__value="true",ll.value=ll.__value,r(ll,"class","rounded mb-1"),r(je,"class","cnt"),r(Ki,"class","text-sm"),r(Sn,"href",Rt("WiFi-configuration")),r(Sn,"target","_blank"),r(Sn,"class","float-right"),r(ai,"type","hidden"),r(ai,"name","w"),ai.value="true",Tn.__value=1,Tn.value=Tn.__value,$n.__value=2,$n.value=$n.__value,r(Kt,"name","nc"),r(Kt,"class","in-s"),t[3].n.c===void 0&&ze(()=>t[42].call(Kt)),r(Xl,"class","my-1"),r(Bt,"class","cnt"),r(Yi,"class","text-sm"),r(Nn,"href",Rt("Network-configuration")),r(Nn,"target","_blank"),r(Nn,"class","float-right"),An.__value="dhcp",An.value=An.__value,Pn.__value="static",Pn.value=Pn.__value,r(cl,"name","nm"),r(cl,"class","in-f"),t[3].n.m===void 0&&ze(()=>t[48].call(cl)),r(qt,"name","ni"),r(qt,"type","text"),r(qt,"class","in-m w-full"),qt.disabled=Qi=t[3].n.m=="dhcp",qt.required=Xi=t[3].n.m=="static",r(Ut,"name","ns"),r(Ut,"class","in-l"),Ut.disabled=Zi=t[3].n.m=="dhcp",Ut.required=Ji=t[3].n.m=="static",t[3].n.s===void 0&&ze(()=>t[50].call(Ut)),r(Fl,"class","flex"),r(Zl,"class","my-1"),r(nl,"name","nd"),nl.__value="true",nl.value=nl.__value,r(nl,"type","checkbox"),r(nl,"class","rounded mb-1"),r(xi,"class","my-1"),r(ui,"type","hidden"),r(ui,"name","ntp"),ui.value="true",r(il,"name","ntpd"),il.__value="true",il.value=il.__value,r(il,"type","checkbox"),r(il,"class","rounded mb-1"),r(fi,"class","ml-4"),r(kl,"name","ntph"),r(kl,"type","text"),r(kl,"class","in-s"),r(ts,"class","flex"),r(Bl,"class","my-1"),r(mt,"class","cnt"),r(ls,"class","text-sm"),r(Ln,"href",Rt("MQTT-configuration")),r(Ln,"target","_blank"),r(Ln,"class","float-right"),r(ci,"type","hidden"),r(ci,"name","q"),ci.value="true",r(wl,"name","qh"),r(wl,"type","text"),r(wl,"class","in-f w-3/4"),r(sl,"name","qp"),r(sl,"type","number"),r(sl,"min","1024"),r(sl,"max","65535"),r(sl,"class","in-l tr w-1/4"),r(In,"class","flex"),r(ml,"class","my-1"),r(yl,"name","qu"),r(yl,"type","text"),r(yl,"class","in-s"),r(Jl,"class","my-1"),r(Cl,"name","qa"),r(Cl,"type","password"),r(Cl,"class","in-s"),r(xl,"class","my-1"),r(Sl,"name","qc"),r(Sl,"type","text"),r(Sl,"class","in-f w-full"),qn.__value=0,qn.value=qn.__value,Un.__value=1,Un.value=Un.__value,jn.__value=2,jn.value=jn.__value,Hn.__value=3,Hn.value=Hn.__value,Wn.__value=4,Wn.value=Wn.__value,zn.__value=255,zn.value=zn.__value,r(Ct,"name","qm"),r(Ct,"class","in-l"),t[3].q.m===void 0&&ze(()=>t[63].call(Ct)),r(On,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(en,"class","my-1"),r(lt,"class","cnt"),r(ns,"class","text-sm"),r(Gn,"href",Rt("User-interface")),r(Gn,"target","_blank"),r(Gn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","u"),mi.value="true",r(_i,"class","flex flex-wrap"),r(_l,"class","cnt"),r(is,"class","text-sm"),r(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Kn,"target","_blank"),r(Kn,"class","float-right"),r(pi,"type","hidden"),r(pi,"name","d"),pi.value="true",r(ol,"type","checkbox"),r(ol,"name","ds"),ol.__value="true",ol.value=ol.__value,r(ol,"class","rounded mb-1"),r(ss,"class","mt-3"),r(jt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Qn,"type","button"),r(Qn,"class","btn-red"),r(Xn,"type","button"),r(Xn,"class","btn-yellow"),r(rs,"class","text-center"),r(as,"class","text-right"),r(ql,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(B,me){M(B,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),ne(c,u,null),s(n,a),s(n,f),s(n,p),s(n,_),s(_,v),s(v,h),s(h,d),s(h,g),s(h,w),s(h,D),oe(D,t[3].g.h),s(v,T),s(v,E),s(E,F),s(E,O),s(E,R),s(E,y),ne(A,y,null),Me(y,t[3].g.t,!0),s(n,te),s(n,W),s(n,j),s(n,U),s(U,K),s(K,Y),s(Y,G),s(Y,Z),s(Y,V),s(Y,H),s(H,x),s(x,ue),s(x,re),s(x,Q),s(x,z),s(x,we),s(H,He),s(He,Ie),s(He,Se),s(He,ye),s(He,he),s(H,$e),s($e,be),s($e,$),s(H,C),s(H,k),s(H,P),s(H,L),s(H,X),s(H,le),s(H,fe),s(H,de),s(H,Ce),s(H,Oe),s(H,ae),s(H,Te),s(H,Je),Me(H,t[3].p.r,!0),s(K,It),s(K,st),s(st,kt),s(st,nt),s(st,Ot),s(st,Qe);for(let _t=0;_t<5;_t+=1)di[_t]&&di[_t].m(Qe,null);Me(Qe,t[3].p.c,!0),s(n,Zt),s(n,zt),ne(ht,zt,null),s(n,xe),s(n,Ve),s(Ve,Ye),s(Ye,Ne),Ne.checked=t[3].p.e,s(Ye,Ze),s(Ve,et),St&&St.m(Ve,null),s(n,Be),s(n,Fe),s(Fe,_e),s(Fe,ce),s(Fe,qe),s(Fe,pt),s(pt,Nl),s(pt,El),s(pt,Al),Me(pt,t[3].g.s,!0),s(n,Ni),Mt&&Mt.m(n,null),s(n,oi),s(n,gl),s(gl,Ei),s(gl,Ai),s(gl,Pi),s(gl,wt),oe(wt,t[3].g.c),s(l,Di),s(l,je),s(je,pn),s(je,Li),s(je,Pl),ne(Dl,Pl,null),s(je,Ri),s(je,Wl),s(je,Ii),s(je,zl),s(je,Oi),s(je,We),s(We,yt),s(We,Gl),s(We,Cs),s(We,Gt),s(Gt,Vt),s(Gt,Ll),Me(Gt,t[3].m.a,!0),s(je,Fi),s(je,al),s(al,Bi),s(al,No),s(al,Ss),s(al,Eo),s(al,ri),s(ri,Jt),Jt.checked=t[3].m.i,s(ri,Ao),s(al,Po),s(al,Rl),s(Rl,ul),s(ul,Il),s(Il,Do);for(let _t=0;_t<7;_t+=1)hi[_t]&&hi[_t].m(ul,null);Me(ul,t[3].m.b,!0),s(Rl,Lo),s(Rl,vt),s(vt,Ol),s(Ol,Ro),s(vt,dn),s(vt,hn),s(vt,vn),s(vt,bn),Me(vt,t[3].m.p,!0),s(Rl,Io),s(Rl,Ft),oe(Ft,t[3].m.s),s(je,Oo),s(je,Vl),s(Vl,Fo),s(Vl,Bo),s(Vl,qo),s(Vl,fl),s(fl,gn),s(fl,kn),Me(fl,t[3].m.d,!0),s(je,Uo),s(je,wn),s(wn,Kl),s(Kl,jo),s(Kl,Ho),s(Kl,Wo),s(Kl,yn),s(yn,xt),oe(xt,t[3].m.f),s(yn,zo),s(yn,Wi),s(wn,Go),s(wn,Yl),s(Yl,Vo),s(Yl,Ko),s(Yl,Yo),s(Yl,Cn),s(Cn,el),oe(el,t[3].m.r),s(Cn,Qo),s(Cn,zi),s(je,Xo),s(je,Ms),s(je,Zo),s(je,Ql),s(Ql,Gi),s(Gi,tl),tl.checked=t[3].m.e.e,s(Gi,Jo),s(Ql,xo),Tt&&Tt.m(Ql,null),s(je,er),$t&&$t.m(je,null),s(je,Ts),s(je,Vi),s(Vi,ll),ll.checked=t[3].m.m.e,s(Vi,tr),s(je,lr),Nt&&Nt.m(je,null),s(l,nr),s(l,Bt),s(Bt,Ki),s(Bt,ir),s(Bt,Sn),ne(Mn,Sn,null),s(Bt,sr),s(Bt,ai),s(Bt,or),s(Bt,Xl),s(Xl,rr),s(Xl,ar),s(Xl,ur),s(Xl,Kt),s(Kt,Tn),s(Kt,$n),Ht&&Ht.m(Kt,null),Me(Kt,t[3].n.c,!0),s(Bt,fr),Et&&Et.m(Bt,null),s(l,cr),s(l,mt),s(mt,Yi),s(mt,mr),s(mt,Nn),ne(En,Nn,null),s(mt,_r),s(mt,Zl),s(Zl,pr),s(Zl,dr),s(Zl,hr),s(Zl,Fl),s(Fl,cl),s(cl,An),s(cl,Pn),Me(cl,t[3].n.m,!0),s(Fl,vr),s(Fl,qt),oe(qt,t[3].n.i),s(Fl,br),s(Fl,Ut),ne(Dn,Ut,null),Me(Ut,t[3].n.s,!0),s(mt,gr),At&&At.m(mt,null),s(mt,$s),s(mt,xi),s(xi,es),s(es,nl),nl.checked=t[3].n.d,s(es,kr),s(mt,wr),s(mt,ui),s(mt,yr),s(mt,Bl),s(Bl,Cr),s(Bl,fi),s(fi,il),il.checked=t[3].n.h,s(fi,Sr),s(Bl,Mr),s(Bl,Tr),s(Bl,ts),s(ts,kl),oe(kl,t[3].n.n1),s(l,$r),s(l,lt),s(lt,ls),s(lt,Nr),s(lt,Ln),ne(Rn,Ln,null),s(lt,Er),s(lt,ci),s(lt,Ar),s(lt,ml),s(ml,Pr),Pt&&Pt.m(ml,null),s(ml,Ns),s(ml,Dr),s(ml,Lr),s(ml,In),s(In,wl),oe(wl,t[3].q.h),s(In,Rr),s(In,sl),oe(sl,t[3].q.p),s(lt,Ir),ot&&ot.m(lt,null),s(lt,Es),s(lt,Jl),s(Jl,Or),s(Jl,Fr),s(Jl,Br),s(Jl,yl),oe(yl,t[3].q.u),s(lt,qr),s(lt,xl),s(xl,Ur),s(xl,jr),s(xl,Hr),s(xl,Cl),oe(Cl,t[3].q.a),s(lt,Wr),s(lt,On),s(On,Fn),s(Fn,zr),s(Fn,Gr),s(Fn,Vr),s(Fn,Sl),oe(Sl,t[3].q.c),s(On,Kr),s(On,Bn),s(Bn,Yr),s(Bn,Qr),s(Bn,Xr),s(Bn,Ct),s(Ct,qn),s(Ct,Un),s(Ct,jn),s(Ct,Hn),s(Ct,Wn),s(Ct,zn),Me(Ct,t[3].q.m,!0),s(lt,Zr),s(lt,en),s(en,Jr),s(en,xr),s(en,ea),s(en,Ml),oe(Ml,t[3].q.b),s(l,ta),rt&&rt.m(l,null),s(l,As),at&&at.m(l,null),s(l,Ps),ut&&ut.m(l,null),s(l,Ds),ft&&ft.m(l,null),s(l,Rs),s(l,_l),s(_l,ns),s(_l,la),s(_l,Gn),ne(Vn,Gn,null),s(_l,na),s(_l,mi),s(_l,ia),s(_l,_i);for(let _t=0;_t0?Mt?Mt.p(B,me):(Mt=of(B),Mt.c(),Mt.m(n,oi)):Mt&&(Mt.d(1),Mt=null),me[0]&8&&wt.value!==B[3].g.c&&oe(wt,B[3].g.c),me[0]&8&&Me(Gt,B[3].m.a),me[0]&8&&(Jt.checked=B[3].m.i),(!Yt||me[0]&8&&qi!==(qi=B[3].m.b!=0))&&(Il.disabled=qi),me[0]&8&&Me(ul,B[3].m.b),(!Yt||me[0]&8&&Ui!==(Ui=B[3].m.b!=0))&&(Ol.disabled=Ui),(!Yt||me[0]&8&&ji!==(ji=B[3].m.b==0))&&(vt.disabled=ji),me[0]&8&&Me(vt,B[3].m.p),(!Yt||me[0]&9&&Hi!==(Hi=B[0].chip=="esp8266"?B[3].i.h.p==3||B[3].i.h.p==113?512:128:4096))&&r(Ft,"max",Hi),me[0]&8&&ge(Ft.value)!==B[3].m.s&&oe(Ft,B[3].m.s),me[0]&8&&Me(fl,B[3].m.d),me[0]&8&&ge(xt.value)!==B[3].m.f&&oe(xt,B[3].m.f),me[0]&8&&ge(el.value)!==B[3].m.r&&oe(el,B[3].m.r),me[0]&8&&(tl.checked=B[3].m.e.e),B[3].m.e.e?Tt?Tt.p(B,me):(Tt=rf(B),Tt.c(),Tt.m(Ql,null)):Tt&&(Tt.d(1),Tt=null),B[3].m.e.e?$t?$t.p(B,me):($t=af(B),$t.c(),$t.m(je,Ts)):$t&&($t.d(1),$t=null),me[0]&8&&(ll.checked=B[3].m.m.e),B[3].m.m.e?Nt?Nt.p(B,me):(Nt=uf(B),Nt.c(),Nt.m(je,null)):Nt&&(Nt.d(1),Nt=null),B[0].if&&B[0].if.eth?Ht||(Ht=ff(),Ht.c(),Ht.m(Kt,null)):Ht&&(Ht.d(1),Ht=null),me[0]&8&&Me(Kt,B[3].n.c),B[3].n.c==1||B[3].n.c==2?Et?Et.p(B,me):(Et=cf(B),Et.c(),Et.m(Bt,null)):Et&&(Et.d(1),Et=null),me[0]&8&&Me(cl,B[3].n.m),(!Yt||me[0]&8&&Qi!==(Qi=B[3].n.m=="dhcp"))&&(qt.disabled=Qi),(!Yt||me[0]&8&&Xi!==(Xi=B[3].n.m=="static"))&&(qt.required=Xi),me[0]&8&&qt.value!==B[3].n.i&&oe(qt,B[3].n.i),(!Yt||me[0]&8&&Zi!==(Zi=B[3].n.m=="dhcp"))&&(Ut.disabled=Zi),(!Yt||me[0]&8&&Ji!==(Ji=B[3].n.m=="static"))&&(Ut.required=Ji),me[0]&8&&Me(Ut,B[3].n.s),B[3].n.m=="static"?At?At.p(B,me):(At=mf(B),At.c(),At.m(mt,$s)):At&&(At.d(1),At=null),me[0]&8&&(nl.checked=B[3].n.d),me[0]&8&&(il.checked=B[3].n.h),me[0]&8&&kl.value!==B[3].n.n1&&oe(kl,B[3].n.n1),B[0].chip!="esp8266"?Pt?Pt.p(B,me):(Pt=_f(B),Pt.c(),Pt.m(ml,Ns)):Pt&&(Pt.d(1),Pt=null),me[0]&8&&wl.value!==B[3].q.h&&oe(wl,B[3].q.h),me[0]&8&&ge(sl.value)!==B[3].q.p&&oe(sl,B[3].q.p),B[3].q.s.e?ot?(ot.p(B,me),me[0]&8&&I(ot,1)):(ot=pf(B),ot.c(),I(ot,1),ot.m(lt,Es)):ot&&(Ae(),q(ot,1,1,()=>{ot=null}),Pe()),me[0]&8&&yl.value!==B[3].q.u&&oe(yl,B[3].q.u),me[0]&8&&Cl.value!==B[3].q.a&&oe(Cl,B[3].q.a),me[0]&8&&Sl.value!==B[3].q.c&&oe(Sl,B[3].q.c),me[0]&8&&Me(Ct,B[3].q.m),me[0]&8&&Ml.value!==B[3].q.b&&oe(Ml,B[3].q.b),B[3].q.m==3?rt?(rt.p(B,me),me[0]&8&&I(rt,1)):(rt=df(B),rt.c(),I(rt,1),rt.m(l,As)):rt&&(Ae(),q(rt,1,1,()=>{rt=null}),Pe()),B[3].q.m==4?at?(at.p(B,me),me[0]&8&&I(at,1)):(at=hf(B),at.c(),I(at,1),at.m(l,Ps)):at&&(Ae(),q(at,1,1,()=>{at=null}),Pe()),B[3].c.es!=null?ut?(ut.p(B,me),me[0]&8&&I(ut,1)):(ut=vf(B),ut.c(),I(ut,1),ut.m(l,Ds)):ut&&(Ae(),q(ut,1,1,()=>{ut=null}),Pe()),me[0]&8&&(Ls=B[3].p.r.startsWith("10YNO")||B[3].p.r.startsWith("10Y1001A1001A4")),Ls?ft?(ft.p(B,me),me[0]&8&&I(ft,1)):(ft=kf(B),ft.c(),I(ft,1),ft.m(l,Rs)):ft&&(Ae(),q(ft,1,1,()=>{ft=null}),Pe()),me[0]&136){Zn=B[7];let Qt;for(Qt=0;Qt20||B[0].chip=="esp8266"||B[3].i.d.d>0?ct?(ct.p(B,me),me[0]&9&&I(ct,1)):(ct=Cf(B),ct.c(),I(ct,1),ct.m(l,Is)):ct&&(Ae(),q(ct,1,1,()=>{ct=null}),Pe()),me[0]&8&&(ol.checked=B[3].d.s),B[3].d.s?Dt?Dt.p(B,me):(Dt=Af(B),Dt.c(),Dt.m(jt,null)):Dt&&(Dt.d(1),Dt=null);const da={};me[0]&2&&(da.active=B[1]),tn.$set(da);const ha={};me[0]&4&&(ha.active=B[2]),ln.$set(ha);const va={};me[0]&16&&(va.active=B[4]),nn.$set(va);const ba={};me[0]&32&&(ba.active=B[5]),sn.$set(ba)},i(B){Yt||(I(c.$$.fragment,B),I(A.$$.fragment,B),I(ht.$$.fragment,B),I(Dl.$$.fragment,B),I(Mn.$$.fragment,B),I(En.$$.fragment,B),I(Dn.$$.fragment,B),I(Rn.$$.fragment,B),I(ot),I(rt),I(at),I(ut),I(ft),I(Vn.$$.fragment,B),I(ct),I(Yn.$$.fragment,B),I(tn.$$.fragment,B),I(ln.$$.fragment,B),I(nn.$$.fragment,B),I(sn.$$.fragment,B),Yt=!0)},o(B){q(c.$$.fragment,B),q(A.$$.fragment,B),q(ht.$$.fragment,B),q(Dl.$$.fragment,B),q(Mn.$$.fragment,B),q(En.$$.fragment,B),q(Dn.$$.fragment,B),q(Rn.$$.fragment,B),q(ot),q(rt),q(at),q(ut),q(ft),q(Vn.$$.fragment,B),q(ct),q(Yn.$$.fragment,B),q(tn.$$.fragment,B),q(ln.$$.fragment,B),q(nn.$$.fragment,B),q(sn.$$.fragment,B),Yt=!1},d(B){B&&S(e),ie(c),ie(A),dt(di,B),ie(ht),St&&St.d(),Mt&&Mt.d(),ie(Dl),dt(hi,B),Tt&&Tt.d(),$t&&$t.d(),Nt&&Nt.d(),ie(Mn),Ht&&Ht.d(),Et&&Et.d(),ie(En),ie(Dn),At&&At.d(),ie(Rn),Pt&&Pt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),ie(Vn),dt(bt,B),ct&&ct.d(),ie(Yn),Dt&&Dt.d(),B&&S(Fs),ie(tn,B),B&&S(Bs),ie(ln,B),B&&S(qs),ie(nn,B),B&&S(Us),ie(sn,B),js=!1,Ge(pa)}}}async function B_(){await(await fetch("reboot",{method:"POST"})).json()}function q_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{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"}],u=!0,c=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};gi.subscribe(We=>{We.version&&(l(3,a=We),l(1,u=!1))}),l_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const We=new URLSearchParams;We.append("perform","true");let Gl=await(await fetch("reset",{method:"POST",body:We})).json();l(4,f=!1),l(5,p=Gl.success)}}async function v(We){l(2,c=!0);const yt=new FormData(We.target),Gl=new URLSearchParams;for(let Vt of yt){const[Ll,Fi]=Vt;Gl.append(Ll,Fi)}let Gt=await(await fetch("save",{method:"POST",body:Gl})).json();Wt.update(Vt=>(Vt.booting=Gt.reboot,Vt.ui=a.u,Vt)),l(2,c=!1),cn(n)}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(We=>(We.booting=!0,We)),B_())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.c=!1,yt)))}async function g(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.r=!1,yt)))}async function w(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),gi.update(yt=>(yt.q.s.k=!1,yt)))}const D=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let T=44;function E(){a.g.h=this.value,l(3,a)}function F(){a.g.t=tt(this),l(3,a)}function O(){a.p.r=tt(this),l(3,a)}function R(){a.p.c=tt(this),l(3,a)}function y(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function te(){a.g.s=tt(this),l(3,a)}function W(){a.g.u=this.value,l(3,a)}function j(){a.g.p=this.value,l(3,a)}function U(){a.g.c=this.value,l(3,a)}function K(){a.m.a=tt(this),l(3,a)}function Y(){a.m.i=this.checked,l(3,a)}function G(){a.m.b=tt(this),l(3,a)}function Z(){a.m.p=tt(this),l(3,a)}function V(){a.m.s=ge(this.value),l(3,a)}function H(){a.m.d=tt(this),l(3,a)}function x(){a.m.f=ge(this.value),l(3,a)}function ue(){a.m.r=ge(this.value),l(3,a)}function re(){a.m.e.e=this.checked,l(3,a)}function Q(){a.m.e.k=this.value,l(3,a)}function z(){a.m.e.a=this.value,l(3,a)}function we(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=ge(this.value),l(3,a)}function Ie(){a.m.m.v=ge(this.value),l(3,a)}function Se(){a.m.m.a=ge(this.value),l(3,a)}function ye(){a.m.m.c=ge(this.value),l(3,a)}function he(){a.n.c=tt(this),l(3,a)}function $e(){a.w.s=this.value,l(3,a)}function be(){a.w.p=this.value,l(3,a)}function $(){a.w.z=tt(this),l(3,a)}function C(){a.w.w=ge(this.value),l(3,a)}function k(){a.w.b=this.checked,l(3,a)}function P(){a.n.m=tt(this),l(3,a)}function L(){a.n.i=this.value,l(3,a)}function X(){a.n.s=tt(this),l(3,a)}function le(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function Ce(){a.n.d=this.checked,l(3,a)}function Oe(){a.n.h=this.checked,l(3,a)}function ae(){a.n.n1=this.value,l(3,a)}function Te(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function It(){a.q.p=ge(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function kt(){a.q.a=this.value,l(3,a)}function nt(){a.q.c=this.value,l(3,a)}function Ot(){a.q.m=tt(this),l(3,a)}function Qe(){a.q.b=this.value,l(3,a)}function Zt(){a.o.e=this.value,l(3,a)}function zt(){a.o.c=this.value,l(3,a)}function ht(){a.o.u1=this.value,l(3,a)}function xe(){a.o.u2=this.value,l(3,a)}function Ve(){a.o.u3=this.value,l(3,a)}function Ye(){a.h.t=this.value,l(3,a)}function Ne(){a.h.h=this.value,l(3,a)}function Ze(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function Be(){a.c.es=this.checked,l(3,a)}function Fe(We){a.t.t[We]=ge(this.value),l(3,a)}function _e(){a.t.h=ge(this.value),l(3,a)}function ce(We){a.u[We.key]=tt(this),l(3,a)}function qe(){a.i.h.p=tt(this),l(3,a)}function pt(){a.i.h.t=tt(this),l(3,a)}function Nl(){a.i.h.u=this.checked,l(3,a)}function El(){a.i.a=ge(this.value),l(3,a)}function Al(){a.i.l.p=ge(this.value),l(3,a)}function Ni(){a.i.l.i=this.checked,l(3,a)}function oi(){a.i.r.i=this.checked,l(3,a)}function gl(){a.i.r.r=ge(this.value),l(3,a)}function Ei(){a.i.r.g=ge(this.value),l(3,a)}function Ai(){a.i.r.b=ge(this.value),l(3,a)}function Pi(){a.i.d.d=ge(this.value),l(3,a)}function wt(){a.i.t.d=ge(this.value),l(3,a)}function Di(){a.i.t.a=ge(this.value),l(3,a)}function je(){a.i.v.p=ge(this.value),l(3,a)}function pn(){a.i.v.d.v=ge(this.value),l(3,a)}function Li(){a.i.v.d.g=ge(this.value),l(3,a)}function Pl(){a.i.d.b=tt(this),l(3,a)}function Dl(){a.i.v.o=ge(this.value),l(3,a)}function Ri(){a.i.v.m=ge(this.value),l(3,a)}function Wl(){a.i.v.b=ge(this.value),l(3,a)}function Ii(){a.d.s=this.checked,l(3,a)}function zl(){a.d.t=this.checked,l(3,a)}function Oi(){a.d.l=tt(this),l(3,a)}return t.$$set=We=>{"basepath"in We&&l(15,n=We.basepath),"sysinfo"in We&&l(0,i=We.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,c,a,f,p,T,o,_,v,h,d,g,w,D,n,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H,x,ue,re,Q,z,we,He,Ie,Se,ye,he,$e,be,$,C,k,P,L,X,le,fe,de,Ce,Oe,ae,Te,Je,It,st,kt,nt,Ot,Qe,Zt,zt,ht,xe,Ve,Ye,Ne,Ze,et,Be,Fe,_e,ce,qe,pt,Nl,El,Al,Ni,oi,gl,Ei,Ai,Pi,wt,Di,je,pn,Li,Pl,Dl,Ri,Wl,Ii,zl,Oi]}class U_ extends Re{constructor(e){super(),Le(this,e,q_,F_,Ee,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Df(t,e,l){const n=t.slice();return n[20]=e[l],n}function j_(t){let e=ve(t[1].chip,t[1].board)+"",l;return{c(){l=N(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=ve(n[1].chip,n[1].board)+"")&&J(l,e)},d(n){n&&S(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,u,c,a,f,p,_,v,h=Fa(t[1])+"",d,g,w=t[1].boot_reason+"",D,T,E=t[1].ex_cause+"",F,O,R;const y=[W_,H_],A=[];function te(W,j){return W[0].u>0?0:1}return a=te(t),f=A[a]=y[a](t),{c(){e=m("div"),l=N("AP MAC: "),i=N(n),o=b(),u=m("div"),c=N(`Last boot: + `),f.c(),p=b(),_=m("div"),v=N("Reason: "),d=N(h),g=N(" ("),D=N(w),T=N("/"),F=N(E),O=N(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(W,j){M(W,e,j),s(e,l),s(e,i),M(W,o,j),M(W,u,j),s(u,c),A[a].m(u,null),M(W,p,j),M(W,_,j),s(_,v),s(_,d),s(_,g),s(_,D),s(_,T),s(_,F),s(_,O),R=!0},p(W,j){(!R||j&2)&&n!==(n=W[1].apmac+"")&&J(i,n);let U=a;a=te(W),a===U?A[a].p(W,j):(Ae(),q(A[U],1,1,()=>{A[U]=null}),Pe(),f=A[a],f?f.p(W,j):(f=A[a]=y[a](W),f.c()),I(f,1),f.m(u,null)),(!R||j&2)&&h!==(h=Fa(W[1])+"")&&J(d,h),(!R||j&2)&&w!==(w=W[1].boot_reason+"")&&J(D,w),(!R||j&2)&&E!==(E=W[1].ex_cause+"")&&J(F,E)},i(W){R||(I(f),R=!0)},o(W){q(f),R=!1},d(W){W&&S(e),W&&S(o),W&&S(u),A[a].d(),W&&S(p),W&&S(_)}}}function H_(t){let e;return{c(){e=N("-")},m(l,n){M(l,e,n)},p:pe,i:pe,o:pe,d(l){l&&S(e)}}}function W_(t){let e,l;return e=new i1({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function z_(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:pe,d(l){l&&S(e)}}}function Rf(t){let e,l,n,i,o,u=gs(t[1].meter.mfg)+"",c,a,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",v,h,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",D;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=N("Manufacturer: "),c=N(u),a=b(),f=m("div"),p=N("Model: "),v=N(_),h=b(),d=m("div"),g=N("ID: "),D=N(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(T,E){M(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,D)},p(T,E){E&2&&u!==(u=gs(T[1].meter.mfg)+"")&&J(c,u),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&J(v,_),E&2&&w!==(w=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&J(D,w)},d(T){T&&S(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",c,a,f,p,_=t[1].net.mask+"",v,h,d,g,w=t[1].net.gw+"",D,T,E,F,O=t[1].net.dns1+"",R,y,A=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=N("IP: "),c=N(u),a=b(),f=m("div"),p=N("Mask: "),v=N(_),h=b(),d=m("div"),g=N("Gateway: "),D=N(w),T=b(),E=m("div"),F=N("DNS: "),R=N(O),y=b(),A&&A.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(te,W){M(te,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,c),s(e,a),s(e,f),s(f,p),s(f,v),s(e,h),s(e,d),s(d,g),s(d,D),s(e,T),s(e,E),s(E,F),s(E,R),s(E,y),A&&A.m(E,null)},p(te,W){W&2&&u!==(u=te[1].net.ip+"")&&J(c,u),W&2&&_!==(_=te[1].net.mask+"")&&J(v,_),W&2&&w!==(w=te[1].net.gw+"")&&J(D,w),W&2&&O!==(O=te[1].net.dns1+"")&&J(R,O),te[1].net.dns2?A?A.p(te,W):(A=Of(te),A.c(),A.m(E,null)):A&&(A.d(1),A=null)},d(te){te&&S(e),A&&A.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=N("/ "),n=N(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&J(n,l)},d(i){i&&S(e),i&&S(n)}}}function Ff(t){let e,l,n,i=t[1].upgrade.f+"",o,u,c=t[1].upgrade.t+"",a,f,p=Oa(t[1].upgrade.e)+"",_;return{c(){e=m("div"),l=m("div"),n=N("Previous upgrade attempt from "),o=N(i),u=N(" to "),a=N(c),f=N(" failed. "),_=N(p),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(v,h){M(v,e,h),s(e,l),s(l,n),s(l,o),s(l,u),s(l,a),s(l,f),s(l,_)},p(v,h){h&2&&i!==(i=v[1].upgrade.f+"")&&J(o,i),h&2&&c!==(c=v[1].upgrade.t+"")&&J(a,c),h&2&&p!==(p=Oa(v[1].upgrade.e)+"")&&J(_,p)},d(v){v&&S(e)}}}function Bf(t){let e,l,n,i=t[2].tag_name+"",o,u,c,a,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&qf(t),v=t[1].fwconsent===2&&Uf();return{c(){e=m("div"),l=N(`Latest version: + `),n=m("a"),o=N(i),c=b(),_&&_.c(),a=b(),v&&v.c(),f=Ke(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(h,d){M(h,e,d),s(e,l),s(e,n),s(n,o),s(e,c),_&&_.m(e,null),M(h,a,d),v&&v.m(h,d),M(h,f,d),p=!0},p(h,d){(!p||d&4)&&i!==(i=h[2].tag_name+"")&&J(o,i),(!p||d&4&&u!==(u=h[2].html_url))&&r(n,"href",u),(h[1].security==0||h[0].a)&&h[1].fwconsent===1&&h[2]&&h[2].tag_name!=h[1].version?_?(_.p(h,d),d&7&&I(_,1)):(_=qf(h),_.c(),I(_,1),_.m(e,null)):_&&(Ae(),q(_,1,1,()=>{_=null}),Pe()),h[1].fwconsent===2?v||(v=Uf(),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},i(h){p||(I(_),p=!0)},o(h){q(_),p=!1},d(h){h&&S(e),_&&_.d(),h&&S(a),v&&v.d(h),h&&S(f)}}}function qf(t){let e,l,n,i,o,u;return n=new s1({}),{c(){e=m("div"),l=m("button"),se(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(c,a){M(c,e,a),s(e,l),ne(n,l,null),i=!0,o||(u=ee(l,"click",t[10]),o=!0)},p:pe,i(c){i||(I(n.$$.fragment,c),i=!0)},o(c){q(n.$$.fragment,c),i=!1},d(c){c&&S(e),ie(n),o=!1,u()}}}function Uf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function jf(t){let e,l=ks(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=N(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=ks(ve(i[1].chip,i[1].board))+"")&&J(n,l)},d(i){i&&S(e)}}}function Hf(t){let e,l,n,i,o,u;function c(p,_){return p[4].length==0?V_:G_}let a=c(t),f=a(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),f.c(),ho(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(p,_){a===(a=c(p))&&f?f.p(p,_):(f.d(1),f=a(p),f&&(f.c(),f.m(l,null)))},d(p){p&&S(e),t[12](null),f.d(),o=!1,Ge(u)}}}function G_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=N(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){M(o,l,u),M(o,n,u),M(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&J(l,e)},d(o){o&&S(l),o&&S(n),o&&S(i)}}}function V_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:pe,d(i){i&&S(e),l=!1,n()}}}function Wf(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g=t[9],w=[];for(let O=0;O Include Secrets
(SSID, PSK, passwords and tokens)',a=b(),D&&D.c(),f=b(),p=m("form"),_=m("input"),v=b(),F.c(),r(l,"class","text-sm"),r(c,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),ho(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(O,R){M(O,e,R),s(e,l),s(e,n),s(e,i),s(i,o);for(let y=0;y{P=null}),Pe());const It={};Te&8388608&&(It.$$scope={dirty:Te,ctx:ae}),te.$set(It),ae[1].meter?L?L.p(ae,Te):(L=Rf(ae),L.c(),L.m(e,K)):L&&(L.d(1),L=null),ae[1].net?X?X.p(ae,Te):(X=If(ae),X.c(),X.m(e,Y)):X&&(X.d(1),X=null),(!$||Te&2)&&ue!==(ue=ae[1].version+"")&&J(re,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?le?le.p(ae,Te):(le=Ff(ae),le.c(),le.m(G,z)):le&&(le.d(1),le=null),ae[2]?fe?(fe.p(ae,Te),Te&4&&I(fe,1)):(fe=Bf(ae),fe.c(),I(fe,1),fe.m(G,we)):fe&&(Ae(),q(fe,1,1,()=>{fe=null}),Pe()),Te&3&&(He=(ae[1].security==0||ae[0].a)&&li(ae[1].board)),He?de?de.p(ae,Te):(de=jf(ae),de.c(),de.m(G,Ie)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?Ce?Ce.p(ae,Te):(Ce=Hf(ae),Ce.c(),Ce.m(G,null)):Ce&&(Ce.d(1),Ce=null),ae[1].security==0||ae[0].a?Oe?Oe.p(ae,Te):(Oe=Wf(ae),Oe.c(),Oe.m(e,null)):Oe&&(Oe.d(1),Oe=null);const st={};Te&32&&(st.active=ae[5]),he.$set(st);const kt={};Te&256&&(kt.active=ae[8]),be.$set(kt)},i(ae){$||(I(w.$$.fragment,ae),I(P),I(te.$$.fragment,ae),I(fe),I(he.$$.fragment,ae),I(be.$$.fragment,ae),$=!0)},o(ae){q(w.$$.fragment,ae),q(P),q(te.$$.fragment,ae),q(fe),q(he.$$.fragment,ae),q(be.$$.fragment,ae),$=!1},d(ae){ae&&S(e),ie(w),P&&P.d(),ie(te),L&&L.d(),X&&X.d(),le&&le.d(),fe&&fe.d(),de&&de.d(),Ce&&Ce.d(),Oe&&Oe.d(),ae&&S(ye),ie(he,ae),ae&&S($e),ie(be,ae),C=!1,k()}}}async function X_(){await(await fetch("reboot",{method:"POST"})).json()}function Z_(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 API",key:"is"}],u={};To.subscribe(y=>{l(2,u=n1(i.version,y)),u||l(2,u=y[0])});function c(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(ks(ve(i.chip,i.board))))&&(Wt.update(y=>(y.upgrading=!0,y)),l1(u.tag_name))}const a=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(y=>(y.booting=!0,y)),X_())};let f,p=[],_=!1,v,h=[],d=!1;yo();function g(y){vs[y?"unshift":"push"](()=>{f=y,l(3,f)})}function w(){p=this.files,l(4,p)}const D=()=>{f.click()},T=()=>l(5,_=!0);function E(y){vs[y?"unshift":"push"](()=>{v=y,l(6,v)})}function F(){h=this.files,l(7,h)}const O=()=>{v.click()},R=()=>l(8,d=!0);return t.$$set=y=>{"data"in y&&l(0,n=y.data),"sysinfo"in y&&l(1,i=y.sysinfo)},[n,i,u,f,p,_,v,h,d,o,c,a,g,w,D,T,E,F,O,R]}class J_ extends Re{constructor(e){super(),Le(this,e,Z_,Q_,Ee,{data:0,sysinfo:1})}}function Vf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",c,a,f=ve(t[0],4)+"",p,_,v=ve(t[0],3)+"",h,d,g,w,D=ve(t[0],2)+"",T,E,F=ve(t[0],1)+"",O,R,y=ve(t[0],0)+"",A,te,W,j,U=ve(t[0],101)+"",K,Y,G=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),h=N(v),d=b(),g=m("optgroup"),w=m("option"),T=N(D),E=m("option"),O=N(F),R=m("option"),A=N(y),te=b(),W=m("optgroup"),j=m("option"),K=N(U),Y=m("option"),Z=N(G),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,a.__value=4,a.value=a.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,E.__value=1,E.value=E.__value,R.__value=0,R.value=R.__value,r(g,"label","Custom hardware"),j.__value=101,j.value=j.__value,Y.__value=100,Y.value=Y.__value,r(W,"label","Generic hardware")},m(V,H){M(V,e,H),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,h),M(V,d,H),M(V,g,H),s(g,w),s(w,T),s(g,E),s(E,O),s(g,R),s(R,A),M(V,te,H),M(V,W,H),s(W,j),s(j,K),s(W,Y),s(Y,Z)},p(V,H){H&1&&n!==(n=ve(V[0],7)+"")&&J(i,n),H&1&&u!==(u=ve(V[0],5)+"")&&J(c,u),H&1&&f!==(f=ve(V[0],4)+"")&&J(p,f),H&1&&v!==(v=ve(V[0],3)+"")&&J(h,v),H&1&&D!==(D=ve(V[0],2)+"")&&J(T,D),H&1&&F!==(F=ve(V[0],1)+"")&&J(O,F),H&1&&y!==(y=ve(V[0],0)+"")&&J(A,y),H&1&&U!==(U=ve(V[0],101)+"")&&J(K,U),H&1&&G!==(G=ve(V[0],100)+"")&&J(Z,G)},d(V){V&&S(e),V&&S(d),V&&S(g),V&&S(te),V&&S(W)}}}function Kf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",c,a,f=ve(t[0],203)+"",p,_,v=ve(t[0],241)+"",h,d,g=ve(t[0],242)+"",w,D,T=ve(t[0],243)+"",E,F,O=ve(t[0],200)+"",R;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=m("option"),h=N(v),d=m("option"),w=N(g),D=m("option"),E=N(T),F=m("option"),R=N(O),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,a.__value=203,a.value=a.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,D.__value=243,D.value=D.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(y,A){M(y,e,A),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),s(e,_),s(_,h),s(e,d),s(d,w),s(e,D),s(D,E),s(e,F),s(F,R)},p(y,A){A&1&&n!==(n=ve(y[0],201)+"")&&J(i,n),A&1&&u!==(u=ve(y[0],202)+"")&&J(c,u),A&1&&f!==(f=ve(y[0],203)+"")&&J(p,f),A&1&&v!==(v=ve(y[0],241)+"")&&J(h,v),A&1&&g!==(g=ve(y[0],242)+"")&&J(w,g),A&1&&T!==(T=ve(y[0],243)+"")&&J(E,T),A&1&&O!==(O=ve(y[0],200)+"")&&J(R,O)},d(y){y&&S(e)}}}function Yf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",c,a,f=ve(t[0],5)+"",p,_,v,h,d=ve(t[0],51)+"",g,w,D=ve(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=m("option"),c=N(u),a=m("option"),p=N(f),_=b(),v=m("optgroup"),h=m("option"),g=N(d),w=m("option"),T=N(D),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,a.__value=5,a.value=a.__value,r(e,"label","amsleser.no"),h.__value=51,h.value=h.__value,w.__value=50,w.value=w.__value,r(v,"label","Generic hardware")},m(E,F){M(E,e,F),s(e,l),s(l,i),s(e,o),s(o,c),s(e,a),s(a,p),M(E,_,F),M(E,v,F),s(v,h),s(h,g),s(v,w),s(w,T)},p(E,F){F&1&&n!==(n=ve(E[0],7)+"")&&J(i,n),F&1&&u!==(u=ve(E[0],6)+"")&&J(c,u),F&1&&f!==(f=ve(E[0],5)+"")&&J(p,f),F&1&&d!==(d=ve(E[0],51)+"")&&J(g,d),F&1&&D!==(D=ve(E[0],50)+"")&&J(T,D)},d(E){E&&S(e),E&&S(_),E&&S(v)}}}function Qf(t){let e,l,n=ve(t[0],8)+"",i,o,u,c,a=ve(t[0],71)+"",f,p,_=ve(t[0],70)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=N(n),o=b(),u=m("optgroup"),c=m("option"),f=N(a),p=m("option"),v=N(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),c.__value=71,c.value=c.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(h,d){M(h,e,d),s(e,l),s(l,i),M(h,o,d),M(h,u,d),s(u,c),s(c,f),s(u,p),s(p,v)},p(h,d){d&1&&n!==(n=ve(h[0],8)+"")&&J(i,n),d&1&&a!==(a=ve(h[0],71)+"")&&J(f,a),d&1&&_!==(_=ve(h[0],70)+"")&&J(v,_)},d(h){h&&S(e),h&&S(o),h&&S(u)}}}function Xf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&J(i,n)},d(o){o&&S(e)}}}function Zf(t){let e,l,n=ve(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=N(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],80)+"")&&J(i,n)},d(o){o&&S(e)}}}function x_(t){let e,l,n,i,o,u,c,a,f=t[0]=="esp8266"&&Vf(t),p=t[0]=="esp32"&&Kf(t),_=t[0]=="esp32s2"&&Yf(t),v=t[0]=="esp32c3"&&Qf(t),h=t[0]=="esp32solo"&&Xf(t),d=t[0]=="esp32s3"&&Zf(t);return{c(){e=m("option"),l=b(),f&&f.c(),n=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),v&&v.c(),u=b(),h&&h.c(),c=b(),d&&d.c(),a=Ke(),e.__value=-1,e.value=e.__value},m(g,w){M(g,e,w),M(g,l,w),f&&f.m(g,w),M(g,n,w),p&&p.m(g,w),M(g,i,w),_&&_.m(g,w),M(g,o,w),v&&v.m(g,w),M(g,u,w),h&&h.m(g,w),M(g,c,w),d&&d.m(g,w),M(g,a,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Vf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,w):(p=Kf(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,w):(_=Yf(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?v?v.p(g,w):(v=Qf(g),v.c(),v.m(u.parentNode,u)):v&&(v.d(1),v=null),g[0]=="esp32solo"?h?h.p(g,w):(h=Xf(g),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null),g[0]=="esp32s3"?d?d.p(g,w):(d=Zf(g),d.c(),d.m(a.parentNode,a)):d&&(d.d(1),d=null)},i:pe,o:pe,d(g){g&&S(e),g&&S(l),f&&f.d(g),g&&S(n),p&&p.d(g),g&&S(i),_&&_.d(g),g&&S(o),v&&v.d(g),g&&S(u),h&&h.d(g),g&&S(c),d&&d.d(g),g&&S(a)}}}function ep(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class tp extends Re{constructor(e){super(),Le(this,e,ep,x_,Ee,{chip:0})}}function Jf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function xf(t){let e,l,n,i,o,u,c;return u=new ao({props:{chip:t[0].chip}}),{c(){e=m("div"),l=N("HAN GPIO"),n=m("br"),i=b(),o=m("select"),se(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(a,f){M(a,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(u,o,null),c=!0},p(a,f){const p={};f&1&&(p.chip=a[0].chip),u.$set(p)},i(a){c||(I(u.$$.fragment,a),c=!0)},o(a){q(u.$$.fragment,a),c=!1},d(a){a&&S(e),ie(u)}}}function lp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y=t[0].usrcfg&&Jf();d=new tp({props:{chip:t[0].chip}});let G=t[0].board&&t[0].board>20&&xf(t);return W=new gt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",c=b(),Y&&Y.c(),a=b(),f=m("div"),p=N("Board type"),_=m("br"),v=b(),h=m("select"),se(d.$$.fragment),g=b(),G&&G.c(),w=b(),D=m("div"),T=m("label"),E=m("input"),F=N(" Clear all other configuration"),O=b(),R=m("div"),R.innerHTML='',y=b(),A=m("span"),A.textContent="\xA0",te=b(),se(W.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(h,"name","vb"),r(h,"class","in-s"),t[0].board===void 0&&ze(()=>t[5].call(h)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(D,"class","my-3"),r(R,"class","my-3"),r(A,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),Y&&Y.m(n,null),s(n,a),s(n,f),s(f,p),s(f,_),s(f,v),s(f,h),ne(d,h,null),Me(h,t[0].board,!0),s(n,g),G&&G.m(n,null),s(n,w),s(n,D),s(D,T),s(T,E),E.checked=t[2],s(T,F),s(n,O),s(n,R),s(n,y),s(n,A),M(Z,te,V),ne(W,Z,V),j=!0,U||(K=[ee(h,"change",t[5]),ee(E,"change",t[6]),ee(n,"submit",Ci(t[3]))],U=!0)},p(Z,[V]){Z[0].usrcfg?Y||(Y=Jf(),Y.c(),Y.m(n,a)):Y&&(Y.d(1),Y=null);const H={};V&1&&(H.chip=Z[0].chip),d.$set(H),V&1&&Me(h,Z[0].board),Z[0].board&&Z[0].board>20?G?(G.p(Z,V),V&1&&I(G,1)):(G=xf(Z),G.c(),I(G,1),G.m(n,w)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),V&4&&(E.checked=Z[2]);const x={};V&2&&(x.active=Z[1]),W.$set(x)},i(Z){j||(I(d.$$.fragment,Z),I(G),I(W.$$.fragment,Z),j=!0)},o(Z){q(d.$$.fragment,Z),q(G),q(W.$$.fragment,Z),j=!1},d(Z){Z&&S(e),Y&&Y.d(),ie(d),G&&G.d(),Z&&S(te),ie(W,Z),U=!1,Ge(K)}}}function np(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){l(1,o=!0);const _=new FormData(p.target),v=new URLSearchParams;for(let g of _){const[w,D]=g;v.append(w,D)}let d=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),Wt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),cn(n+(i.usrcfg?"/":"/setup"))}let c=!1;Wt.subscribe(p=>{l(0,i=p),p.fwconsent===1&&l(2,c=!i.usrcfg)});function a(){i.board=tt(this),l(0,i)}function f(){c=this.checked,l(2,c)}return t.$$set=p=>{"basepath"in p&&l(4,n=p.basepath),"sysinfo"in p&&l(0,i=p.sysinfo)},[i,o,c,u,n,a,f]}class ip extends Re{constructor(e){super(),Le(this,e,np,lp,Ee,{basepath:4,sysinfo:0})}}function ec(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function tc(t){let e,l,n,i,o,u,c,a,f,p,_,v,h;return{c(){e=m("div"),l=N("SSID"),n=m("br"),i=b(),o=m("input"),c=b(),a=m("div"),f=N("PSK"),p=m("br"),_=b(),v=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(v,"name","sp"),r(v,"type","password"),r(v,"class","in-s"),r(v,"autocomplete","off"),v.required=h=t[2]==2,r(a,"class","my-3")},m(d,g){M(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),M(d,c,g),M(d,a,g),s(a,f),s(a,p),s(a,_),s(a,v)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&h!==(h=d[2]==2)&&(v.required=h)},d(d){d&&S(e),d&&S(c),d&&S(a)}}}function lc(t){let e,l,n,i,o,u,c,a;return c=new a1({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),se(c.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,u),ne(c,u,null),a=!0},p(f,p){(!a||p&2)&&(i.required=f[1]),(!a||p&2)&&(u.required=f[1])},i(f){a||(I(c.$$.fragment,f),a=!0)},o(f){q(c.$$.fragment,f),a=!1},d(f){f&&S(e),f&&S(l),f&&S(n),ie(c)}}}function nc(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sp(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G,X,Y,j=t[0].if&&t[0].if.eth&&ec(),x=(t[2]==1||t[2]==2)&&tc(t),ae=t[1]&&lc(t),te=t[1]&&nc();return Q=new kt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Setup",c=b(),a=m("div"),f=N("Connection"),p=m("br"),_=b(),h=m("select"),v=m("option"),v.textContent="Connect to WiFi",d=m("option"),d.textContent="Standalone access point",j&&j.c(),g=b(),x&&x.c(),w=b(),D=m("div"),T=N(`Hostname - `),E=m("input"),F=b(),I=m("div"),O=m("label"),C=m("input"),A=N(" Static IP"),le=b(),ae&&ae.c(),H=b(),te&&te.c(),z=b(),U=m("div"),U.innerHTML='',K=b(),re(Q.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,r(h,"name","sc"),r(h,"class","in-s"),t[2]===void 0&&We(()=>t[5].call(h)),r(a,"class","my-3"),r(E,"name","sh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"maxlength","32"),r(E,"pattern","[a-z0-9_-]+"),r(E,"placeholder","Optional, ex.: ams-reader"),r(E,"autocomplete","off"),r(C,"type","checkbox"),r(C,"name","sm"),C.__value="static",C.value=C.__value,r(C,"class","rounded mb-1"),r(I,"class","my-3"),r(U,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,W){M(V,e,W),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,h),s(h,v),s(h,d),j&&j.m(h,null),Me(h,t[2],!0),s(n,g),x&&x.m(n,null),s(n,w),s(n,D),s(D,T),s(D,E),ie(E,t[0].hostname),s(n,F),s(n,I),s(I,O),s(O,C),C.checked=t[1],s(O,A),s(I,le),ae&&ae.m(I,null),s(n,H),te&&te.m(n,null),s(n,z),s(n,U),M(V,K,W),se(Q,V,W),G=!0,X||(Y=[ee(h,"change",t[5]),ee(E,"input",t[6]),ee(C,"change",t[7]),ee(n,"submit",Mi(t[4]))],X=!0)},p(V,[W]){V[0].if&&V[0].if.eth?j||(j=ec(),j.c(),j.m(h,null)):j&&(j.d(1),j=null),W&4&&Me(h,V[2]),V[2]==1||V[2]==2?x?x.p(V,W):(x=tc(V),x.c(),x.m(n,w)):x&&(x.d(1),x=null),W&1&&E.value!==V[0].hostname&&ie(E,V[0].hostname),W&2&&(C.checked=V[1]),V[1]?ae?(ae.p(V,W),W&2&&R(ae,1)):(ae=lc(V),ae.c(),R(ae,1),ae.m(I,null)):ae&&(Ae(),B(ae,1,1,()=>{ae=null}),Pe()),V[1]?te||(te=nc(),te.c(),te.m(n,z)):te&&(te.d(1),te=null);const we={};W&8&&(we.active=V[3]),Q.$set(we)},i(V){G||(R(ae),R(Q.$$.fragment,V),G=!0)},o(V){B(ae),B(Q.$$.fragment,V),G=!1},d(V){V&&S(e),j&&j.d(),x&&x.d(),ae&&ae.d(),te&&te.d(),V&&S(K),oe(Q,V),X=!1,ze(Y)}}}function op(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,c=0;function a(){var v="";c++;var d=function(){setTimeout(a,1e3)};if(n.net.ip&&c%3==0){if(!n.net.ip){d();return}v="http://"+n.net.ip}else n.hostname&&c%3==1?v="http://"+n.hostname:n.hostname&&c%3==2?v="http://"+n.hostname+".local":v="";console&&console.log("Trying url "+v),zt.update(w=>(w.trying=v,w));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(w){window.location.href=v||"/"}),g.open("GET",v+"/is-alive",!0),g.send()}async function f(v){l(3,u=!0);const d=new FormData(v.target),g=new URLSearchParams;for(let T of d){const[E,F]=T;g.append(E,F)}let D=await(await fetch("save",{method:"POST",body:g})).json();l(3,u=!1),zt.update(T=>(T.hostname=d.get("sh"),T.usrcfg=D.success,T.booting=D.reboot,i&&(T.net.ip=d.get("si"),T.net.mask=d.get("su"),T.net.gw=d.get("sg"),T.net.dns1=d.get("sd")),setTimeout(a,5e3),T))}function p(){o=tt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function h(){i=this.checked,l(1,i)}return t.$$set=v=>{"sysinfo"in v&&l(0,n=v.sysinfo)},[n,i,o,u,f,p,_,h]}class rp extends Re{constructor(e){super(),Le(this,e,op,sp,Ee,{sysinfo:0})}}function ap(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D;return d=new kt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=N("Upload "),o=N(t[1]),u=b(),c=m("p"),c.textContent="Select a suitable file and click upload",a=b(),f=m("form"),p=m("input"),_=b(),h=m("div"),h.innerHTML='',v=b(),re(d.$$.fragment),r(c,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(h,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,E){M(T,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,c),s(l,a),s(l,f),s(f,p),s(f,_),s(f,h),M(T,v,E),se(d,T,E),g=!0,w||(D=ee(f,"submit",t[3]),w=!0)},p(T,[E]){(!g||E&2)&&J(o,T[1]),(!g||E&1)&&r(f,"action",T[0]);const F={};E&4&&(F.active=T[2]),d.$set(F)},i(T){g||(R(d.$$.fragment,T),g=!0)},o(T){B(d.$$.fragment,T),g=!1},d(T){T&&S(e),T&&S(v),oe(d,T),w=!1,D()}}}function up(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,u]}class $o extends Re{constructor(e){super(),Le(this,e,up,ap,Ee,{action:0,title:1})}}function fp(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O,C,A,le,H,z,U,K,Q,G;return U=new kt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=m("hr"),c=b(),a=m("div"),f=N("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=b(),h=m("a"),v=N("Read more"),d=m("br"),g=b(),w=m("label"),D=m("input"),E=N(" Yes"),F=m("label"),I=m("input"),C=N(" No"),A=m("br"),le=b(),H=m("div"),H.innerHTML='',z=b(),re(U.$$.fragment),r(h,"href",It("Data-collection-on-one-click-firmware-upgrade")),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r(D,"type","radio"),r(D,"name","sf"),D.value=1,D.checked=T=t[0].fwconsent===1,r(D,"class","rounded m-2"),D.required=!0,r(I,"type","radio"),r(I,"name","sf"),I.value=2,I.checked=O=t[0].fwconsent===2,r(I,"class","rounded m-2"),I.required=!0,r(a,"class","my-3"),r(H,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(X,Y){M(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,h),s(h,v),s(a,d),s(a,g),s(a,w),s(w,D),s(w,E),s(a,F),s(F,I),s(F,C),s(a,A),s(n,le),s(n,H),M(X,z,Y),se(U,X,Y),K=!0,Q||(G=ee(n,"submit",Mi(t[2])),Q=!0)},p(X,[Y]){(!K||Y&1&&T!==(T=X[0].fwconsent===1))&&(D.checked=T),(!K||Y&1&&O!==(O=X[0].fwconsent===2))&&(I.checked=O);const j={};Y&2&&(j.active=X[1]),U.$set(j)},i(X){K||(R(U.$$.fragment,X),K=!0)},o(X){B(U.$$.fragment,X),K=!1},d(X){X&&S(e),X&&S(z),oe(U,X),Q=!1,G()}}}function cp(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(c){l(1,o=!0);const a=new FormData(c.target),f=new URLSearchParams;for(let h of a){const[v,d]=h;f.append(v,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();l(1,o=!1),zt.update(h=>(h.fwconsent=a.sf===!0?1:a.sf===!1?2:0,h.booting=_.reboot,h)),mn(n)}return t.$$set=c=>{"basepath"in c&&l(3,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,u,n]}class mp extends Re{constructor(e){super(),Le(this,e,cp,fp,Ee,{basepath:3,sysinfo:0})}}function ic(t,e,l){const n=t.slice();return n[18]=e[l],n[19]=e,n[20]=l,n}function sc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function oc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function rc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function ac(t){let e,l,n=t[0].o,i=[];for(let u=0;uB(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',F=b(),re(I.$$.fragment),O=b(),re(C.$$.fragment),r(l,"class","text-sm"),r(i,"href",It("Price-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"class","m-3"),r(p,"type","hidden"),r(p,"name","r"),p.value="true",r(g,"type","button"),r(g,"class","btn-pri"),r(D,"class","text-center"),r(E,"class","text-right"),r(v,"class","grid grid-cols-3"),r(f,"autocomplete","off"),r(e,"class","cnt")},m(U,K){M(U,e,K),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),z&&z.m(f,null),s(f,h),s(f,v),s(v,d),s(d,g),s(v,w),s(v,D),s(v,T),s(v,E),M(U,F,K),se(I,U,K),M(U,O,K),se(C,U,K),A=!0,le||(H=[ee(g,"click",t[6]),ee(f,"submit",Mi(t[4]))],le=!0)},p(U,[K]){U[0].o?z?(z.p(U,K),K&1&&R(z,1)):(z=ac(U),z.c(),R(z,1),z.m(f,h)):z&&(Ae(),B(z,1,1,()=>{z=null}),Pe());const Q={};K&2&&(Q.active=U[1]),I.$set(Q);const G={};K&4&&(G.active=U[2]),C.$set(G)},i(U){A||(R(o.$$.fragment,U),R(z),R(I.$$.fragment,U),R(C.$$.fragment,U),A=!0)},o(U){B(o.$$.fragment,U),B(z),B(I.$$.fragment,U),B(C.$$.fragment,U),A=!1},d(U){U&&S(e),oe(o),z&&z.d(),U&&S(F),oe(I,U),U&&S(O),oe(C,U),le=!1,ze(H)}}}function pp(t,e,l){let{basepath:n="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,c=!1;r1.subscribe(I=>{I.o&&(l(0,o=I),l(1,u=!1))}),n_();async function a(I){l(2,c=!0);const O=new URLSearchParams;O.append("r","true"),O.append("rc",o.o.length),o.o.forEach(function(A,le){O.append("rt"+le,A.t),O.append("rn"+le,A.n),O.append("rd"+le,A.d),O.append("ra"+le,A.a),O.append("rh"+le,A.h),O.append("rv"+le,A.v)}),await(await fetch("save",{method:"POST",body:O})).json(),l(2,c=!1),mn(n+"configuration")}let f=function(I,O){return I.includes(O)?I=I.filter(function(C){return C!==O}):I.push(O),I},p=function(){let I=o.o;I.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:.01}),l(0,o.o=I,o)},_=function(I){let O=o.o;O.splice(I,1),l(0,o.o=O,o)};function h(I,O){I[O].n=this.value,l(0,o)}function v(I,O){I[O].d=tt(this),l(0,o)}function d(I,O){I[O].t=tt(this),l(0,o)}function g(I,O){I[O].v=ge(this.value),l(0,o)}const w=(I,O,C,A)=>l(0,C[A].a=f(I.a,O),o),D=(I,O,C,A)=>l(0,C[A].h=f(I.h,O),o),T=(I,O,C,A)=>l(0,C[A].h=f(I.h,O+12),o),E=I=>_(I),F=I=>_(I);return t.$$set=I=>{"basepath"in I&&l(8,n=I.basepath)},[o,u,c,i,a,f,p,_,n,h,v,d,g,w,D,T,E,F]}class dp extends Re{constructor(e){super(),Le(this,e,pp,_p,Ee,{basepath:8})}}function vp(t){let e,l;return e=new t_({props:{data:t[2],sysinfo:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function hp(t){let e,l;return e=new U_({props:{sysinfo:t[1],basepath:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function bp(t){let e,l;return e=new dp({props:{basepath:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function gp(t){let e,l;return e=new J_({props:{sysinfo:t[1],data:t[2]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function kp(t){let e,l;return e=new $o({props:{title:"CA",action:"/mqtt-ca"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function wp(t){let e,l;return e=new $o({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function yp(t){let e,l;return e=new $o({props:{title:"private key",action:"/mqtt-key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Cp(t){let e,l;return e=new mp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Sp(t){let e,l;return e=new rp({props:{sysinfo:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Mp(t){let e,l;return e=new ip({props:{sysinfo:t[1],basepath:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Tp(t){let e,l,n,i,o,u,c,a,f,p,_,h,v,d,g,w,D,T,E,F,I,O;return e=new cm({props:{data:t[2],basepath:t[0]}}),n=new _l({props:{path:"/",$$slots:{default:[vp]},$$scope:{ctx:t}}}),o=new _l({props:{path:"/configuration",$$slots:{default:[hp]},$$scope:{ctx:t}}}),c=new _l({props:{path:"/priceconfig",$$slots:{default:[bp]},$$scope:{ctx:t}}}),f=new _l({props:{path:"/status",$$slots:{default:[gp]},$$scope:{ctx:t}}}),_=new _l({props:{path:"/mqtt-ca",$$slots:{default:[kp]},$$scope:{ctx:t}}}),v=new _l({props:{path:"/mqtt-cert",$$slots:{default:[wp]},$$scope:{ctx:t}}}),g=new _l({props:{path:"/mqtt-key",$$slots:{default:[yp]},$$scope:{ctx:t}}}),D=new _l({props:{path:"/consent",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),E=new _l({props:{path:"/setup",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),I=new _l({props:{path:"/vendor",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment),l=b(),re(n.$$.fragment),i=b(),re(o.$$.fragment),u=b(),re(c.$$.fragment),a=b(),re(f.$$.fragment),p=b(),re(_.$$.fragment),h=b(),re(v.$$.fragment),d=b(),re(g.$$.fragment),w=b(),re(D.$$.fragment),T=b(),re(E.$$.fragment),F=b(),re(I.$$.fragment)},m(C,A){se(e,C,A),M(C,l,A),se(n,C,A),M(C,i,A),se(o,C,A),M(C,u,A),se(c,C,A),M(C,a,A),se(f,C,A),M(C,p,A),se(_,C,A),M(C,h,A),se(v,C,A),M(C,d,A),se(g,C,A),M(C,w,A),se(D,C,A),M(C,T,A),se(E,C,A),M(C,F,A),se(I,C,A),O=!0},p(C,A){const le={};A&4&&(le.data=C[2]),A&1&&(le.basepath=C[0]),e.$set(le);const H={};A&14&&(H.$$scope={dirty:A,ctx:C}),n.$set(H);const z={};A&11&&(z.$$scope={dirty:A,ctx:C}),o.$set(z);const U={};A&9&&(U.$$scope={dirty:A,ctx:C}),c.$set(U);const K={};A&14&&(K.$$scope={dirty:A,ctx:C}),f.$set(K);const Q={};A&8&&(Q.$$scope={dirty:A,ctx:C}),_.$set(Q);const G={};A&8&&(G.$$scope={dirty:A,ctx:C}),v.$set(G);const X={};A&8&&(X.$$scope={dirty:A,ctx:C}),g.$set(X);const Y={};A&11&&(Y.$$scope={dirty:A,ctx:C}),D.$set(Y);const j={};A&10&&(j.$$scope={dirty:A,ctx:C}),E.$set(j);const x={};A&11&&(x.$$scope={dirty:A,ctx:C}),I.$set(x)},i(C){O||(R(e.$$.fragment,C),R(n.$$.fragment,C),R(o.$$.fragment,C),R(c.$$.fragment,C),R(f.$$.fragment,C),R(_.$$.fragment,C),R(v.$$.fragment,C),R(g.$$.fragment,C),R(D.$$.fragment,C),R(E.$$.fragment,C),R(I.$$.fragment,C),O=!0)},o(C){B(e.$$.fragment,C),B(n.$$.fragment,C),B(o.$$.fragment,C),B(c.$$.fragment,C),B(f.$$.fragment,C),B(_.$$.fragment,C),B(v.$$.fragment,C),B(g.$$.fragment,C),B(D.$$.fragment,C),B(E.$$.fragment,C),B(I.$$.fragment,C),O=!1},d(C){oe(e,C),C&&S(l),oe(n,C),C&&S(i),oe(o,C),C&&S(u),oe(c,C),C&&S(a),oe(f,C),C&&S(p),oe(_,C),C&&S(h),oe(v,C),C&&S(d),oe(g,C),C&&S(w),oe(D,C),C&&S(T),oe(E,C),C&&S(F),oe(I,C)}}}function $p(t){let e,l,n,i;const o=[Ap,Ep],u=[];function c(a,f){return a[1].trying?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),B(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),R(l,1),l.m(n.parentNode,n))},i(a){i||(R(l),i=!0)},o(a){B(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function Np(t){let e,l;return e=new kt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ep(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:pe,i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ap(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+n[1].trying),e.$set(o)},i(n){l||(R(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Pp(t){let e,l,n,i,o,u;l=new Uc({props:{basepath:t[0],$$slots:{default:[Tp]},$$scope:{ctx:t}}});const c=[Np,$p],a=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=a[i]=c[i](t)),{c(){e=m("div"),re(l.$$.fragment),n=b(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),se(l,e,null),s(e,n),~i&&a[i].m(e,null),u=!0},p(p,[_]){const h={};_&1&&(h.basepath=p[0]),_&15&&(h.$$scope={dirty:_,ctx:p}),l.$set(h);let v=i;i=f(p),i===v?~i&&a[i].p(p,_):(o&&(Ae(),B(a[v],1,1,()=>{a[v]=null}),Pe()),~i?(o=a[i],o?o.p(p,_):(o=a[i]=c[i](p),o.c()),R(o,1),o.m(e,null)):o=null)},i(p){u||(R(l.$$.fragment,p),R(o),u=!0)},o(p){B(l.$$.fragment,p),B(o),u=!1},d(p){p&&S(e),oe(l),~i&&a[i].d()}}}function Dp(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};zt.subscribe(u=>{l(1,i=u),i.vndcfg===!1?mn(n+"vendor"):i.usrcfg===!1?mn(n+"setup"):i.fwconsent===0&&mn(n+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let o={};return Vc.subscribe(u=>{l(2,o=u)}),[n,i,o]}class Lp extends Re{constructor(e){super(),Le(this,e,Dp,Pp,Ee,{})}}new Lp({target:document.getElementById("app")}); +
`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&S(e)}}}function sp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G,Z,V,H=t[0].if&&t[0].if.eth&&ec(),x=(t[2]==1||t[2]==2)&&tc(t),ue=t[1]&&lc(t),re=t[1]&&nc();return Y=new gt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Setup",c=b(),a=m("div"),f=N("Connection"),p=m("br"),_=b(),v=m("select"),h=m("option"),h.textContent="Connect to WiFi",d=m("option"),d.textContent="Standalone access point",H&&H.c(),g=b(),x&&x.c(),w=b(),D=m("div"),T=N(`Hostname + `),E=m("input"),F=b(),O=m("div"),R=m("label"),y=m("input"),A=N(" Static IP"),te=b(),ue&&ue.c(),W=b(),re&&re.c(),j=b(),U=m("div"),U.innerHTML='',K=b(),se(Y.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),h.__value=1,h.value=h.__value,d.__value=2,d.value=d.__value,r(v,"name","sc"),r(v,"class","in-s"),t[2]===void 0&&ze(()=>t[5].call(v)),r(a,"class","my-3"),r(E,"name","sh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"maxlength","32"),r(E,"pattern","[a-z0-9_-]+"),r(E,"placeholder","Optional, ex.: ams-reader"),r(E,"autocomplete","off"),r(y,"type","checkbox"),r(y,"name","sm"),y.__value="static",y.value=y.__value,r(y,"class","rounded mb-1"),r(O,"class","my-3"),r(U,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Q,z){M(Q,e,z),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,v),s(v,h),s(v,d),H&&H.m(v,null),Me(v,t[2],!0),s(n,g),x&&x.m(n,null),s(n,w),s(n,D),s(D,T),s(D,E),oe(E,t[0].hostname),s(n,F),s(n,O),s(O,R),s(R,y),y.checked=t[1],s(R,A),s(O,te),ue&&ue.m(O,null),s(n,W),re&&re.m(n,null),s(n,j),s(n,U),M(Q,K,z),ne(Y,Q,z),G=!0,Z||(V=[ee(v,"change",t[5]),ee(E,"input",t[6]),ee(y,"change",t[7]),ee(n,"submit",Ci(t[4]))],Z=!0)},p(Q,[z]){Q[0].if&&Q[0].if.eth?H||(H=ec(),H.c(),H.m(v,null)):H&&(H.d(1),H=null),z&4&&Me(v,Q[2]),Q[2]==1||Q[2]==2?x?x.p(Q,z):(x=tc(Q),x.c(),x.m(n,w)):x&&(x.d(1),x=null),z&1&&E.value!==Q[0].hostname&&oe(E,Q[0].hostname),z&2&&(y.checked=Q[1]),Q[1]?ue?(ue.p(Q,z),z&2&&I(ue,1)):(ue=lc(Q),ue.c(),I(ue,1),ue.m(O,null)):ue&&(Ae(),q(ue,1,1,()=>{ue=null}),Pe()),Q[1]?re||(re=nc(),re.c(),re.m(n,j)):re&&(re.d(1),re=null);const we={};z&8&&(we.active=Q[3]),Y.$set(we)},i(Q){G||(I(ue),I(Y.$$.fragment,Q),G=!0)},o(Q){q(ue),q(Y.$$.fragment,Q),G=!1},d(Q){Q&&S(e),H&&H.d(),x&&x.d(),ue&&ue.d(),re&&re.d(),Q&&S(K),ie(Y,Q),Z=!1,Ge(V)}}}function op(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,c=0;function a(){var h="";c++;var d=function(){setTimeout(a,1e3)};if(n.net.ip&&c%3==0){if(!n.net.ip){d();return}h="http://"+n.net.ip}else n.hostname&&c%3==1?h="http://"+n.hostname:n.hostname&&c%3==2?h="http://"+n.hostname+".local":h="";console&&console.log("Trying url "+h),Wt.update(w=>(w.trying=h,w));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(w){window.location.href=h||"/"}),g.open("GET",h+"/is-alive",!0),g.send()}async function f(h){l(3,u=!0);const d=new FormData(h.target),g=new URLSearchParams;for(let T of d){const[E,F]=T;g.append(E,F)}let D=await(await fetch("save",{method:"POST",body:g})).json();l(3,u=!1),Wt.update(T=>(T.hostname=d.get("sh"),T.usrcfg=D.success,T.booting=D.reboot,i&&(T.net.ip=d.get("si"),T.net.mask=d.get("su"),T.net.gw=d.get("sg"),T.net.dns1=d.get("sd")),setTimeout(a,5e3),T))}function p(){o=tt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function v(){i=this.checked,l(1,i)}return t.$$set=h=>{"sysinfo"in h&&l(0,n=h.sysinfo)},[n,i,o,u,f,p,_,v]}class rp extends Re{constructor(e){super(),Le(this,e,op,sp,Ee,{sysinfo:0})}}function ap(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D;return d=new gt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=N("Upload "),o=N(t[1]),u=b(),c=m("p"),c.textContent="Select a suitable file and click upload",a=b(),f=m("form"),p=m("input"),_=b(),v=m("div"),v.innerHTML='',h=b(),se(d.$$.fragment),r(c,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(v,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,E){M(T,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,c),s(l,a),s(l,f),s(f,p),s(f,_),s(f,v),M(T,h,E),ne(d,T,E),g=!0,w||(D=ee(f,"submit",t[3]),w=!0)},p(T,[E]){(!g||E&2)&&J(o,T[1]),(!g||E&1)&&r(f,"action",T[0]);const F={};E&4&&(F.active=T[2]),d.$set(F)},i(T){g||(I(d.$$.fragment,T),g=!0)},o(T){q(d.$$.fragment,T),g=!1},d(T){T&&S(e),T&&S(h),ie(d,T),w=!1,D()}}}function up(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,u]}class $o extends Re{constructor(e){super(),Le(this,e,up,ap,Ee,{action:0,title:1})}}function fp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R,y,A,te,W,j,U,K,Y,G;return U=new gt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=m("hr"),c=b(),a=m("div"),f=N("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=b(),v=m("a"),h=N("Read more"),d=m("br"),g=b(),w=m("label"),D=m("input"),E=N(" Yes"),F=m("label"),O=m("input"),y=N(" No"),A=m("br"),te=b(),W=m("div"),W.innerHTML='',j=b(),se(U.$$.fragment),r(v,"href",Rt("Data-collection-on-one-click-firmware-upgrade")),r(v,"target","_blank"),r(v,"class","text-blue-600 hover:text-blue-800"),r(D,"type","radio"),r(D,"name","sf"),D.value=1,D.checked=T=t[0].fwconsent===1,r(D,"class","rounded m-2"),D.required=!0,r(O,"type","radio"),r(O,"name","sf"),O.value=2,O.checked=R=t[0].fwconsent===2,r(O,"class","rounded m-2"),O.required=!0,r(a,"class","my-3"),r(W,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,V){M(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,c),s(n,a),s(a,f),s(a,p),s(a,_),s(a,v),s(v,h),s(a,d),s(a,g),s(a,w),s(w,D),s(w,E),s(a,F),s(F,O),s(F,y),s(a,A),s(n,te),s(n,W),M(Z,j,V),ne(U,Z,V),K=!0,Y||(G=ee(n,"submit",Ci(t[2])),Y=!0)},p(Z,[V]){(!K||V&1&&T!==(T=Z[0].fwconsent===1))&&(D.checked=T),(!K||V&1&&R!==(R=Z[0].fwconsent===2))&&(O.checked=R);const H={};V&2&&(H.active=Z[1]),U.$set(H)},i(Z){K||(I(U.$$.fragment,Z),K=!0)},o(Z){q(U.$$.fragment,Z),K=!1},d(Z){Z&&S(e),Z&&S(j),ie(U,Z),Y=!1,G()}}}function cp(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(c){l(1,o=!0);const a=new FormData(c.target),f=new URLSearchParams;for(let v of a){const[h,d]=v;f.append(h,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();l(1,o=!1),Wt.update(v=>(v.fwconsent=a.sf===!0?1:a.sf===!1?2:0,v.booting=_.reboot,v)),cn(n)}return t.$$set=c=>{"basepath"in c&&l(3,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,u,n]}class mp extends Re{constructor(e){super(),Le(this,e,cp,fp,Ee,{basepath:3,sysinfo:0})}}function ic(t,e,l){const n=t.slice();return n[18]=e[l],n[19]=e,n[20]=l,n}function sc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function oc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function rc(t,e,l){const n=t.slice();return n[21]=e[l],n[23]=l,n}function ac(t){let e,l,n=t[0].o,i=[];for(let u=0;uq(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;uSave',F=b(),se(O.$$.fragment),R=b(),se(y.$$.fragment),r(l,"class","text-sm"),r(i,"href",Rt("Price-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(c,"class","m-3"),r(p,"type","hidden"),r(p,"name","r"),p.value="true",r(g,"type","button"),r(g,"class","btn-pri"),r(D,"class","text-center"),r(E,"class","text-right"),r(h,"class","grid grid-cols-3"),r(f,"autocomplete","off"),r(e,"class","cnt")},m(U,K){M(U,e,K),s(e,l),s(e,n),s(e,i),ne(o,i,null),s(e,u),s(e,c),s(e,a),s(e,f),s(f,p),s(f,_),j&&j.m(f,null),s(f,v),s(f,h),s(h,d),s(d,g),s(h,w),s(h,D),s(h,T),s(h,E),M(U,F,K),ne(O,U,K),M(U,R,K),ne(y,U,K),A=!0,te||(W=[ee(g,"click",t[6]),ee(f,"submit",Ci(t[4]))],te=!0)},p(U,[K]){U[0].o?j?(j.p(U,K),K&1&&I(j,1)):(j=ac(U),j.c(),I(j,1),j.m(f,v)):j&&(Ae(),q(j,1,1,()=>{j=null}),Pe());const Y={};K&2&&(Y.active=U[1]),O.$set(Y);const G={};K&4&&(G.active=U[2]),y.$set(G)},i(U){A||(I(o.$$.fragment,U),I(j),I(O.$$.fragment,U),I(y.$$.fragment,U),A=!0)},o(U){q(o.$$.fragment,U),q(j),q(O.$$.fragment,U),q(y.$$.fragment,U),A=!1},d(U){U&&S(e),ie(o),j&&j.d(),U&&S(F),ie(O,U),U&&S(R),ie(y,U),te=!1,Ge(W)}}}function pp(t,e,l){let{basepath:n="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,c=!1;r1.subscribe(O=>{O.o&&(l(0,o=O),l(1,u=!1))}),n_();async function a(O){l(2,c=!0);const R=new URLSearchParams;R.append("r","true"),R.append("rc",o.o.length),o.o.forEach(function(A,te){R.append("rt"+te,A.t),R.append("rn"+te,A.n),R.append("rd"+te,A.d),R.append("ra"+te,A.a),R.append("rh"+te,A.h),R.append("rv"+te,A.v)}),await(await fetch("save",{method:"POST",body:R})).json(),l(2,c=!1),cn(n+"configuration")}let f=function(O,R){return O.includes(R)?O=O.filter(function(y){return y!==R}):O.push(R),O},p=function(){let O=o.o;O.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:.01}),l(0,o.o=O,o)},_=function(O){let R=o.o;R.splice(O,1),l(0,o.o=R,o)};function v(O,R){O[R].n=this.value,l(0,o)}function h(O,R){O[R].d=tt(this),l(0,o)}function d(O,R){O[R].t=tt(this),l(0,o)}function g(O,R){O[R].v=ge(this.value),l(0,o)}const w=(O,R,y,A)=>l(0,y[A].a=f(O.a,R),o),D=(O,R,y,A)=>l(0,y[A].h=f(O.h,R),o),T=(O,R,y,A)=>l(0,y[A].h=f(O.h,R+12),o),E=O=>_(O),F=O=>_(O);return t.$$set=O=>{"basepath"in O&&l(8,n=O.basepath)},[o,u,c,i,a,f,p,_,n,v,h,d,g,w,D,T,E,F]}class dp extends Re{constructor(e){super(),Le(this,e,pp,_p,Ee,{basepath:8})}}function hp(t){let e,l;return e=new t_({props:{data:t[2],sysinfo:t[1]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function vp(t){let e,l;return e=new U_({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function bp(t){let e,l;return e=new dp({props:{basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function gp(t){let e,l;return e=new J_({props:{sysinfo:t[1],data:t[2]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function kp(t){let e,l;return e=new $o({props:{title:"CA",action:"/mqtt-ca"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function wp(t){let e,l;return e=new $o({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function yp(t){let e,l;return e=new $o({props:{title:"private key",action:"/mqtt-key"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Cp(t){let e,l;return e=new mp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Sp(t){let e,l;return e=new rp({props:{sysinfo:t[1]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Mp(t){let e,l;return e=new ip({props:{sysinfo:t[1],basepath:t[0]}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Tp(t){let e,l,n,i,o,u,c,a,f,p,_,v,h,d,g,w,D,T,E,F,O,R;return e=new cm({props:{data:t[2],basepath:t[0]}}),n=new pl({props:{path:"/",$$slots:{default:[hp]},$$scope:{ctx:t}}}),o=new pl({props:{path:"/configuration",$$slots:{default:[vp]},$$scope:{ctx:t}}}),c=new pl({props:{path:"/priceconfig",$$slots:{default:[bp]},$$scope:{ctx:t}}}),f=new pl({props:{path:"/status",$$slots:{default:[gp]},$$scope:{ctx:t}}}),_=new pl({props:{path:"/mqtt-ca",$$slots:{default:[kp]},$$scope:{ctx:t}}}),h=new pl({props:{path:"/mqtt-cert",$$slots:{default:[wp]},$$scope:{ctx:t}}}),g=new pl({props:{path:"/mqtt-key",$$slots:{default:[yp]},$$scope:{ctx:t}}}),D=new pl({props:{path:"/consent",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),E=new pl({props:{path:"/setup",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),O=new pl({props:{path:"/vendor",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),{c(){se(e.$$.fragment),l=b(),se(n.$$.fragment),i=b(),se(o.$$.fragment),u=b(),se(c.$$.fragment),a=b(),se(f.$$.fragment),p=b(),se(_.$$.fragment),v=b(),se(h.$$.fragment),d=b(),se(g.$$.fragment),w=b(),se(D.$$.fragment),T=b(),se(E.$$.fragment),F=b(),se(O.$$.fragment)},m(y,A){ne(e,y,A),M(y,l,A),ne(n,y,A),M(y,i,A),ne(o,y,A),M(y,u,A),ne(c,y,A),M(y,a,A),ne(f,y,A),M(y,p,A),ne(_,y,A),M(y,v,A),ne(h,y,A),M(y,d,A),ne(g,y,A),M(y,w,A),ne(D,y,A),M(y,T,A),ne(E,y,A),M(y,F,A),ne(O,y,A),R=!0},p(y,A){const te={};A&4&&(te.data=y[2]),A&1&&(te.basepath=y[0]),e.$set(te);const W={};A&14&&(W.$$scope={dirty:A,ctx:y}),n.$set(W);const j={};A&11&&(j.$$scope={dirty:A,ctx:y}),o.$set(j);const U={};A&9&&(U.$$scope={dirty:A,ctx:y}),c.$set(U);const K={};A&14&&(K.$$scope={dirty:A,ctx:y}),f.$set(K);const Y={};A&8&&(Y.$$scope={dirty:A,ctx:y}),_.$set(Y);const G={};A&8&&(G.$$scope={dirty:A,ctx:y}),h.$set(G);const Z={};A&8&&(Z.$$scope={dirty:A,ctx:y}),g.$set(Z);const V={};A&11&&(V.$$scope={dirty:A,ctx:y}),D.$set(V);const H={};A&10&&(H.$$scope={dirty:A,ctx:y}),E.$set(H);const x={};A&11&&(x.$$scope={dirty:A,ctx:y}),O.$set(x)},i(y){R||(I(e.$$.fragment,y),I(n.$$.fragment,y),I(o.$$.fragment,y),I(c.$$.fragment,y),I(f.$$.fragment,y),I(_.$$.fragment,y),I(h.$$.fragment,y),I(g.$$.fragment,y),I(D.$$.fragment,y),I(E.$$.fragment,y),I(O.$$.fragment,y),R=!0)},o(y){q(e.$$.fragment,y),q(n.$$.fragment,y),q(o.$$.fragment,y),q(c.$$.fragment,y),q(f.$$.fragment,y),q(_.$$.fragment,y),q(h.$$.fragment,y),q(g.$$.fragment,y),q(D.$$.fragment,y),q(E.$$.fragment,y),q(O.$$.fragment,y),R=!1},d(y){ie(e,y),y&&S(l),ie(n,y),y&&S(i),ie(o,y),y&&S(u),ie(c,y),y&&S(a),ie(f,y),y&&S(p),ie(_,y),y&&S(v),ie(h,y),y&&S(d),ie(g,y),y&&S(w),ie(D,y),y&&S(T),ie(E,y),y&&S(F),ie(O,y)}}}function $p(t){let e,l,n,i;const o=[Ap,Ep],u=[];function c(a,f){return a[1].trying?0:1}return e=c(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(a,f){u[e].m(a,f),M(a,n,f),i=!0},p(a,f){let p=e;e=c(a),e===p?u[e].p(a,f):(Ae(),q(u[p],1,1,()=>{u[p]=null}),Pe(),l=u[e],l?l.p(a,f):(l=u[e]=o[e](a),l.c()),I(l,1),l.m(n.parentNode,n))},i(a){i||(I(l),i=!0)},o(a){q(l),i=!1},d(a){u[e].d(a),a&&S(n)}}}function Np(t){let e,l;return e=new gt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Ep(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p:pe,i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Ap(t){let e,l;return e=new gt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){se(e.$$.fragment)},m(n,i){ne(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+n[1].trying),e.$set(o)},i(n){l||(I(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ie(e,n)}}}function Pp(t){let e,l,n,i,o,u;l=new Uc({props:{basepath:t[0],$$slots:{default:[Tp]},$$scope:{ctx:t}}});const c=[Np,$p],a=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=a[i]=c[i](t)),{c(){e=m("div"),se(l.$$.fragment),n=b(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),ne(l,e,null),s(e,n),~i&&a[i].m(e,null),u=!0},p(p,[_]){const v={};_&1&&(v.basepath=p[0]),_&15&&(v.$$scope={dirty:_,ctx:p}),l.$set(v);let h=i;i=f(p),i===h?~i&&a[i].p(p,_):(o&&(Ae(),q(a[h],1,1,()=>{a[h]=null}),Pe()),~i?(o=a[i],o?o.p(p,_):(o=a[i]=c[i](p),o.c()),I(o,1),o.m(e,null)):o=null)},i(p){u||(I(l.$$.fragment,p),I(o),u=!0)},o(p){q(l.$$.fragment,p),q(o),u=!1},d(p){p&&S(e),ie(l),~i&&a[i].d()}}}function Dp(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Wt.subscribe(u=>{l(1,i=u),i.vndcfg===!1?cn(n+"vendor"):i.usrcfg===!1?cn(n+"setup"):i.fwconsent===0&&cn(n+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let o={};return Vc.subscribe(u=>{l(2,o=u)}),[n,i,o]}class Lp extends Re{constructor(e){super(),Le(this,e,Dp,Pp,Ee,{})}}new Lp({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index 4e386144..eca0eaea 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -636,15 +636,7 @@
- -
-
- Client ID
- -
-
- Client secret
- +
diff --git a/lib/SvelteUi/json/conf_cloud.json b/lib/SvelteUi/json/conf_cloud.json index 0379bc52..f6963762 100644 --- a/lib/SvelteUi/json/conf_cloud.json +++ b/lib/SvelteUi/json/conf_cloud.json @@ -1,6 +1,5 @@ "c": { "e" : %s, "i" : "%s", - "s" : "%s", "es": %s } diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index a5676661..6151820b 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -1095,7 +1095,6 @@ void AmsWebServer::configurationJson() { snprintf_P(buf, BufferSize, CONF_CLOUD_JSON, cloud.enabled ? "true" : "false", cloud.clientId, - strlen(cloud.clientSecret) > 0 ? "***" : "", #if defined(ESP32) && defined(ENERGY_SPEEDOMETER_PASS) sysConfig.energyspeedometer == 7 ? "true" : "false" #else @@ -1704,20 +1703,6 @@ void AmsWebServer::handleSave() { CloudConfig cloud; config->getCloudConfig(cloud); cloud.enabled = server.hasArg(F("ce")) && server.arg(F("ce")) == F("true"); - if(cloud.enabled) { - String host = server.arg("ch"); - if(!host.isEmpty()) { - strcpy(cloud.hostname, host.c_str()); - } - String clientId = server.arg(F("ci")).c_str(); - if(!clientId.isEmpty()) { - strcpy(cloud.clientId, clientId.c_str()); - } - String secret = server.arg(F("cs")); - if(!secret.isEmpty() && !secret.equals("***")) { - strcpy(cloud.clientSecret, secret.c_str()); - } - } config->setCloudConfig(cloud); } diff --git a/platformio.ini b/platformio.ini index 07361ffe..51854415 100755 --- a/platformio.ini +++ b/platformio.ini @@ -2,7 +2,7 @@ extra_configs = platformio-user.ini [common] -lib_deps = EEPROM, LittleFS, DNSServer, https://github.com/256dpi/arduino-mqtt.git, OneWireNg@0.10.0, DallasTemperature@3.9.1, EspSoftwareSerial@6.14.1, https://github.com/gskjold/RemoteDebug.git, Time@1.6.1, Timezone@1.2.4, FirmwareVersion, AmsConfiguration, AmsData, AmsDataStorage, HwTools, Uptime, AmsDecoder, PriceService, EnergyAccounting, AmsMqttHandler, RawMqttHandler, JsonMqttHandler, DomoticzMqttHandler, HomeAssistantMqttHandler, RealtimePlot, ConnectionHandler, SvelteUi +lib_deps = EEPROM, LittleFS, DNSServer, https://github.com/256dpi/arduino-mqtt.git, OneWireNg@0.10.0, DallasTemperature@3.9.1, EspSoftwareSerial@6.14.1, https://github.com/gskjold/RemoteDebug.git, Time@1.6.1, Timezone@1.2.4, mulmer89/ESPRandom@1.5.0, FirmwareVersion, AmsConfiguration, AmsData, AmsDataStorage, HwTools, Uptime, AmsDecoder, PriceService, EnergyAccounting, AmsMqttHandler, RawMqttHandler, JsonMqttHandler, DomoticzMqttHandler, HomeAssistantMqttHandler, RealtimePlot, ConnectionHandler, SvelteUi lib_ignore = OneWire extra_scripts = pre:scripts/addversion.py diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index 67258265..84a4b382 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -623,23 +623,25 @@ void loop() { if(end - start > 1000) { debugW_P(PSTR("Used %dms to handle mqtt"), millis()-start); } - - #if defined(ESP32) - if(config.isCloudChanged()) { - CloudConfig cc; - if(config.getCloudConfig(cc) && cc.enabled) { - if(cloud == NULL) { - cloud = new CloudConnector(&Debug); - } - cloud->setup(cc, &hw); - } - config.ackCloudConfig(); - } - if(cloud != NULL) { - cloud->update(meterState, ea); - } - #endif } + + #if defined(ESP32) + if(config.isCloudChanged()) { + CloudConfig cc; + if(config.getCloudConfig(cc) && cc.enabled) { + if(cloud == NULL) { + cloud = new CloudConnector(&Debug); + } + if(cloud->setup(cc, meterConfig, &hw)) { + config.setCloudConfig(cc); + } + } + config.ackCloudConfig(); + } + if(cloud != NULL) { + cloud->update(meterState, ea); + } + #endif /* if(now - lastVoltageCheck > 500) { handleVoltageCheck();