From 29c8011cdad4e309ea0a4e1b0d0a111461189f38 Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Sat, 6 Apr 2024 11:34:04 +0200 Subject: [PATCH] Changes for cloud --- .../include/AmsConfiguration.h | 6 + lib/CloudConnector/include/CloudConnector.h | 17 +- lib/CloudConnector/src/CloudConnector.cpp | 318 +++++++++++------- lib/RealtimePlot/src/RealtimePlot.cpp | 2 +- lib/SvelteUi/app/dist/index.js | 12 +- lib/SvelteUi/app/src/lib/Dashboard.svelte | 2 +- lib/SvelteUi/app/src/lib/Helpers.js | 1 + lib/SvelteUi/app/src/lib/StatusPage.svelte | 2 +- lib/SvelteUi/include/AmsWebServer.h | 6 - lib/SvelteUi/src/AmsWebServer.cpp | 3 + src/AmsToMqttBridge.cpp | 11 +- 11 files changed, 229 insertions(+), 151 deletions(-) diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 93104868..0488059b 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -50,6 +50,12 @@ #define LED_BEHAVIOUR_ERROR_ONLY 3 #define LED_BEHAVIOUR_OFF 9 +struct ResetDataContainer { + uint8_t cause; + uint8_t last_cause; + uint8_t magic; +}; + struct SystemConfig { uint8_t boardType; bool vendorConfigured; diff --git a/lib/CloudConnector/include/CloudConnector.h b/lib/CloudConnector/include/CloudConnector.h index e9537fba..4af2b01f 100644 --- a/lib/CloudConnector/include/CloudConnector.h +++ b/lib/CloudConnector/include/CloudConnector.h @@ -22,6 +22,7 @@ #include "EnergyAccounting.h" #include "HwTools.h" #include "AmsMqttHandler.h" +#include "ConnectionHandler.h" #if defined(ESP8266) #include @@ -34,14 +35,14 @@ #warning "Unsupported board type" #endif -#define CC_BUF_SIZE 1024 +#define CC_BUF_SIZE 2048 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\":%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}"; +static const char CC_JSON_INIT[] PROGMEM = ",\"init\":{\"mac\":\"%s\",\"apmac\":\"%s\",\"version\":\"%s\",\"boardType\":%d,\"bootReason\":%d,\"bootCause\":%d,\"utcOffset\":%d},\"meter\":{\"manufacturerId\":%d,\"manufacturer\":\"%s\",\"model\":\"%s\",\"id\":\"%s\",\"system\":\"%s\",\"fuse\":%d,\"import\":%d,\"export\":%d},\"network\":{\"ip\":\"%s\",\"mask\":\"%s\",\"gw\":\"%s\",\"dns1\":\"%s\",\"dns2\":\"%s\"}"; struct CloudData { uint8_t type; @@ -51,19 +52,25 @@ struct CloudData { class CloudConnector { public: CloudConnector(RemoteDebug*); - bool setup(CloudConfig& config, MeterConfig& meter, HwTools* hw); + bool setup(CloudConfig& config, MeterConfig& meter, SystemConfig& system, HwTools* hw, ResetDataContainer* rdc); void setMqttHandler(AmsMqttHandler* mqttHandler); void update(AmsData& data, EnergyAccounting& ea); void forceUpdate(); + void setTimezone(Timezone* tz); + void setConnectionHandler(ConnectionHandler* ch); private: - RemoteDebug* debugger; - HwTools* hw; + RemoteDebug* debugger = NULL; + HwTools* hw = NULL; + ConnectionHandler* ch = NULL; + ResetDataContainer* rdc = NULL; + Timezone* tz = NULL; AmsMqttHandler* mqttHandler = NULL; CloudConfig config; HTTPClient http; WiFiUDP udp; int maxPwr = 0; + uint8_t boardType = 0; uint8_t distributionSystem = 0; uint16_t mainFuse = 0, productionCapacity = 0; diff --git a/lib/CloudConnector/src/CloudConnector.cpp b/lib/CloudConnector/src/CloudConnector.cpp index a03143a8..69bc824f 100644 --- a/lib/CloudConnector/src/CloudConnector.cpp +++ b/lib/CloudConnector/src/CloudConnector.cpp @@ -13,6 +13,16 @@ #include #endif +#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4 +#include "esp32/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S2 +#include "esp32s2/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32C3 +#include "esp32c3/rom/rtc.h" +#elif CONFIG_IDF_TARGET_ESP32S3 +#include "esp32s3/rom/rtc.h" +#endif + CloudConnector::CloudConnector(RemoteDebug* debugger) { this->debugger = debugger; @@ -36,7 +46,7 @@ CloudConnector::CloudConnector(RemoteDebug* debugger) { sprintf_P(this->apmac, PSTR("%02X:%02X:%02X:%02X:%02X:%02X"), apmac[0], apmac[1], apmac[2], apmac[3], apmac[4], apmac[5]); } -bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, HwTools* hw) { +bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, SystemConfig& system, HwTools* hw, ResetDataContainer* rdc) { bool ret = false; #if defined(ESP32) if(!ESPRandom::isValidV4Uuid(config.clientId)) { @@ -48,6 +58,9 @@ bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, HwTools* hw) this->config = config; this->hw = hw; + this->rdc = rdc; + + this->boardType = system.boardType; this->maxPwr = 0; this->distributionSystem = meter.distributionSystem; @@ -134,143 +147,25 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { if(!config.enabled) return; unsigned long now = millis(); if(now-lastUpdate < config.interval*1000) return; - lastUpdate = now; if(!ESPRandom::isValidV4Uuid(config.clientId)) { if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("(CloudConnector) Client ID is not valid\n")); return; } if(data.getListType() < 2) return; + if(!initialized && !init()) { + if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Unable to initialize cloud connector\n")); + return; + } + initialized = true; + memset(clearBuffer, 0, CC_BUF_SIZE); int pos = 0; - if(initialized) { - 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), - data.isCounterEstimated() ? "true" : "false" - ); - if(data.getListType() > 2) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "import", data.getActiveImportPower(), data.getReactiveImportPower(), data.getActiveImportCounter(), data.getReactiveImportCounter()); - } else { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "import", data.getActiveImportPower(), data.getReactiveImportPower()); - } - if(data.getListType() > 2) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "export", data.getActiveExportPower(), data.getReactiveExportPower(), data.getActiveExportCounter(), data.getReactiveExportCounter()); - } else { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "export", data.getActiveExportPower(), data.getReactiveExportPower()); - } - - if(data.getListType() > 1) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"phases\":{")); - 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(), 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(), 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(), 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.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(), 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(), String(data.getL3Current(), 2).c_str()); - } - first = false; - } - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}")); - } - if(data.getListType() > 3) { - pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"pf\":%.2f"), data.getPowerFactor()); - } - - 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"), 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 { - if(!init()) { - if(debugger->isActive(RemoteDebug::WARNING)) debugger->printf_P(PSTR("Unable to initialize cloud connector\n")); - return; - } + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\""), uuid.c_str()); + if(lastUpdate == 0) { if(mainFuse > 0 && distributionSystem > 0) { int voltage = distributionSystem == 2 ? 400 : 230; if(data.isThreePhase()) { @@ -282,12 +177,34 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { } } + IPAddress localIp; + IPAddress subnet; + IPAddress gateway; + IPAddress dns1; + IPAddress dns2; + + if(ch == NULL) { + localIp = WiFi.softAPIP(); + subnet = IPAddress(255,255,255,0); + gateway = WiFi.subnetMask(); + dns1 = WiFi.dnsIP(0); + dns2 = WiFi.dnsIP(1); + } else { + localIp = ch->getIP(); + subnet = ch->getSubnetMask(); + gateway = ch->getGateway(); + dns1 = ch->getDns(0); + dns2 = ch->getDns(1); + } pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_INIT, - uuid.c_str(), mac, apmac, FirmwareVersion::VersionString, + boardType, + rtc_get_reset_reason(0), + rdc == NULL ? 0 : rdc->last_cause, + tz == NULL ? 0 : (tz->toLocal(now)-now)/3600, data.getMeterType(), meterManufacturer(data.getMeterType()).c_str(), data.getMeterModel().c_str(), @@ -295,10 +212,141 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { distributionSystemStr(distributionSystem).c_str(), mainFuse, maxPwr, - productionCapacity + productionCapacity, + localIp.toString().c_str(), + subnet.toString().c_str(), + gateway.toString().c_str(), + dns1.toString().c_str(), + dns2.toString().c_str() ); - initialized = true; } + + float vcc = 0.0; + int rssi = 0; + float temperature = -127; + if(hw != NULL) { + vcc = hw->getVcc(); + rssi = hw->getWifiRssi(); + temperature = hw->getTemperature(); + } + + 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(",\"data\":{\"clock\":%lu,\"up\":%lu,\"lastUpdate\":%lu,\"est\":%s"), + (uint32_t) time(nullptr), + (uint32_t) (millis64()/1000), + (uint32_t) (data.getLastUpdateMillis()/1000), + data.isCounterEstimated() ? "true" : "false" + ); + if(data.getListType() > 2) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "import", data.getActiveImportPower(), data.getReactiveImportPower(), data.getActiveImportCounter(), data.getReactiveImportCounter()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "import", data.getActiveImportPower(), data.getReactiveImportPower()); + } + if(data.getListType() > 2) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "export", data.getActiveExportPower(), data.getReactiveExportPower(), data.getActiveExportCounter(), data.getReactiveExportCounter()); + } else { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "export", data.getActiveExportPower(), data.getReactiveExportPower()); + } + + if(data.getListType() > 1) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"phases\":{")); + 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(), 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(), 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(), 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.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(), 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(), String(data.getL3Current(), 2).c_str()); + } + first = false; + } + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}")); + } + if(data.getListType() > 3) { + pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"pf\":%.2f"), data.getPowerFactor()); + } + + 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"), vcc, temperature, rssi, 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("}")); + uint16_t crc = crc16((uint8_t*) clearBuffer, pos); pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"crc\":\"%04X\"}"), crc); @@ -328,12 +376,22 @@ void CloudConnector::update(AmsData& data, EnergyAccounting& ea) { } } udp.endPacket(); + + lastUpdate = now; } void CloudConnector::forceUpdate() { lastUpdate = 0; } +void CloudConnector::setTimezone(Timezone* tz) { + this->tz = tz; +} + +void CloudConnector::setConnectionHandler(ConnectionHandler* ch) { + this->ch = ch; +} + void CloudConnector::debugPrint(byte *buffer, int start, int length) { for (int i = start; i < start + length; i++) { if (buffer[i] < 0x10) diff --git a/lib/RealtimePlot/src/RealtimePlot.cpp b/lib/RealtimePlot/src/RealtimePlot.cpp index 684d15fc..1b9a9e12 100644 --- a/lib/RealtimePlot/src/RealtimePlot.cpp +++ b/lib/RealtimePlot/src/RealtimePlot.cpp @@ -59,7 +59,7 @@ void RealtimePlot::update(AmsData& data) { } int32_t RealtimePlot::getValue(uint16_t req) { - if(req > REALTIME_SAMPLE) return 0; + if(req > REALTIME_SIZE) return 0; unsigned long now = millis(); if(req * REALTIME_SAMPLE > now) return 0; diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index e0ebd16c..f396d8e8 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,7 +1,7 @@ -(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.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 f of o.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).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 ze(){}function mn(e,t){for(const l in t)e[l]=t[l];return e}function Fd(e){return e()}function qm(){return Object.create(null)}function Et(e){e.forEach(Fd)}function ff(e){return typeof e=="function"}function ct(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let qo;function jo(e,t){return qo||(qo=document.createElement("a")),qo.href=t,e===qo.href}function Lv(e){return Object.keys(e).length===0}function uf(e,...t){if(e==null)return ze;const l=e.subscribe(...t);return l.unsubscribe?()=>l.unsubscribe():l}function is(e){let t;return uf(e,l=>t=l)(),t}function Cn(e,t,l){e.$$.on_destroy.push(uf(t,l))}function rf(e,t,l,n){if(e){const i=Bd(e,t,l,n);return e[0](i)}}function Bd(e,t,l,n){return e[1]&&n?mn(l.ctx.slice(),e[1](n(t))):l.ctx}function cf(e,t,l,n){if(e[2]&&n){const i=e[2](n(l));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],f=Math.max(t.dirty.length,i.length);for(let r=0;r32){const t=[],l=e.ctx.length/32;for(let n=0;ne.removeEventListener(t,l,n)}function as(e){return function(t){return t.preventDefault(),e.call(this,t)}}function u(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}const Fv=["width","height"];function ss(e,t){const l=Object.getOwnPropertyDescriptors(e.__proto__);for(const n in t)t[n]==null?e.removeAttribute(n):n==="style"?e.style.cssText=t[n]:n==="__value"?e.value=e[n]=t[n]:l[n]&&l[n].set&&Fv.indexOf(n)===-1?e[n]=t[n]:u(e,n,t[n])}function Ze(e){return e===""?null:+e}function Bv(e){return Array.from(e.childNodes)}function C(e,t){t=""+t,e.data!==t&&(e.data=t)}function Uv(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function jv(e,t,l){~Rv.indexOf(l)?Uv(e,t):C(e,t)}function be(e,t){e.value=t==null?"":t}function As(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,n?"important":"")}function Je(e,t,l){for(let n=0;n{f.source===n.contentWindow&&t()})):(n.src="about:blank",n.onload=()=>{o=re(n.contentWindow,"resize",t),t()}),s(e,n),()=>{(i||o&&n.contentWindow)&&o(),T(n)}}function yv(e,t,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,l,n,t),i}function Om(e,t){return new e(t)}let Os;function Ds(e){Os=e}function Rs(){if(!Os)throw new Error("Function called outside component initialization");return Os}function Ud(e){Rs().$$.on_mount.push(e)}function zv(e){Rs().$$.on_destroy.push(e)}function Wv(){const e=Rs();return(t,l,{cancelable:n=!1}={})=>{const i=e.$$.callbacks[t];if(i){const o=yv(t,l,{cancelable:n});return i.slice().forEach(f=>{f.call(e,o)}),!o.defaultPrevented}return!0}}function qs(e,t){return Rs().$$.context.set(e,t),t}function $n(e){return Rs().$$.context.get(e)}const ts=[],zo=[];let ls=[];const Im=[],jd=Promise.resolve();let Ka=!1;function Hd(){Ka||(Ka=!0,jd.then(yd))}function Gv(){return Hd(),jd}function Ct(e){ls.push(e)}const ja=new Set;let $i=0;function yd(){if($i!==0)return;const e=Os;do{try{for(;$ie.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),ls=t}const Fo=new Set;let _i;function pt(){_i={r:0,c:[],p:_i}}function dt(){_i.r||Et(_i.c),_i=_i.p}function Q(e,t){e&&e.i&&(Fo.delete(e),e.i(t))}function ee(e,t,l,n){if(e&&e.o){if(Fo.has(e))return;Fo.add(e),_i.c.push(()=>{Fo.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function zd(e,t){const l={},n={},i={$$scope:1};let o=e.length;for(;o--;){const f=e[o],r=t[o];if(r){for(const c in f)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);e[o]=r}else for(const c in f)i[c]=1}for(const f in n)f in l||(l[f]=void 0);return l}function Lm(e){return typeof e=="object"&&e!==null?e:{}}function Ne(e){e&&e.c()}function Se(e,t,l,n){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,l),n||Ct(()=>{const f=e.$$.on_mount.map(Fd).filter(ff);e.$$.on_destroy?e.$$.on_destroy.push(...f):Et(f),e.$$.on_mount=[]}),o.forEach(Ct)}function Ce(e,t){const l=e.$$;l.fragment!==null&&(Kv(l.after_update),Et(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Yv(e,t){e.$$.dirty[0]===-1&&(ts.push(e),Hd(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const h=d.length?d[0]:v;return a.ctx&&i(a.ctx[p],a.ctx[p]=h)&&(!a.skip_bound&&a.bound[p]&&a.bound[p](h),_&&Yv(e,p)),v}):[],a.update(),_=!0,Et(a.before_update),a.fragment=n?n(a.ctx):!1,t.target){if(t.hydrate){const p=Bv(t.target);a.fragment&&a.fragment.l(p),p.forEach(T)}else a.fragment&&a.fragment.c();t.intro&&Q(e.$$.fragment),Se(e,t.target,t.anchor,t.customElement),yd()}Ds(c)}class mt{$destroy(){Ce(this,1),this.$destroy=ze}$on(t,l){if(!ff(l))return ze;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Lv(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Rm=e=>typeof e>"u",Wd=e=>typeof e=="function",Gd=e=>typeof e=="number";function Qv(e){return!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Vd(){let e=0;return()=>e++}function Xv(){return Math.random().toString(36).substring(2)}const xn=typeof window>"u";function Kd(e,t,l){return e.addEventListener(t,l),()=>e.removeEventListener(t,l)}const Yd=(e,t)=>e?{}:{style:t},Ya=e=>({"aria-hidden":"true",...Yd(e,"display:none;")}),xi=[];function Qd(e,t){return{subscribe:xt(e,t).subscribe}}function xt(e,t=ze){let l;const n=new Set;function i(r){if(ct(e,r)&&(e=r,l)){const c=!xi.length;for(const a of n)a[1](),xi.push(a,e);if(c){for(let a=0;a{n.delete(a),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:f}}function Zv(e,t,l){const n=!Array.isArray(e),i=n?[e]:e,o=t.length<2;return Qd(l,f=>{let r=!1;const c=[];let a=0,_=ze;const p=()=>{if(a)return;_();const d=t(n?c[0]:c,f);o?f(d):_=ff(d)?d:ze},v=i.map((d,h)=>uf(d,g=>{c[h]=g,a&=~(1<{a|=1<`@@svnav-ctx__${e}`,Qa=Fs("LOCATION"),os=Fs("ROUTER"),Xd=Fs("ROUTE"),Jv=Fs("ROUTE_PARAMS"),$v=Fs("FOCUS_ELEM"),Zd=/^:(.+)/,Ts=(e,t,l)=>e.substr(t,l),Xa=(e,t)=>Ts(e,0,t.length)===t,xv=e=>e==="",eh=e=>Zd.test(e),Jd=e=>e[0]==="*",th=e=>e.replace(/\*.*$/,""),$d=e=>e.replace(/(^\/+|\/+$)/g,"");function Tn(e,t=!1){const l=$d(e).split("/");return t?l.filter(Boolean):l}const Ha=(e,t)=>e+(t?`?${t}`:""),df=e=>`/${$d(e)}`;function Bs(...e){const t=n=>Tn(n,!0).join("/"),l=e.map(t).join("/");return df(l)}const vf=1,Ko=2,bi=3,lh=4,xd=5,nh=6,ev=7,ih=8,sh=9,tv=10,lv=11,oh={[vf]:"Link",[Ko]:"Route",[bi]:"Router",[lh]:"useFocus",[xd]:"useLocation",[nh]:"useMatch",[ev]:"useNavigate",[ih]:"useParams",[sh]:"useResolvable",[tv]:"useResolve",[lv]:"navigate"},hf=e=>oh[e];function ah(e,t){let l;return e===Ko?l=t.path?`path="${t.path}"`:"default":e===vf?l=`to="${t.to}"`:e===bi&&(l=`basepath="${t.basepath||""}"`),`<${hf(e)} ${l||""} />`}function fh(e,t,l,n){const i=l&&ah(n||e,l),o=i?` +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.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 f of o.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&n(f)}).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 ze(){}function mn(e,t){for(const l in t)e[l]=t[l];return e}function Bd(e){return e()}function qm(){return Object.create(null)}function Et(e){e.forEach(Bd)}function ff(e){return typeof e=="function"}function rt(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let qo;function jo(e,t){return qo||(qo=document.createElement("a")),qo.href=t,e===qo.href}function Rv(e){return Object.keys(e).length===0}function uf(e,...t){if(e==null)return ze;const l=e.subscribe(...t);return l.unsubscribe?()=>l.unsubscribe():l}function is(e){let t;return uf(e,l=>t=l)(),t}function Cn(e,t,l){e.$$.on_destroy.push(uf(t,l))}function rf(e,t,l,n){if(e){const i=Ud(e,t,l,n);return e[0](i)}}function Ud(e,t,l,n){return e[1]&&n?mn(l.ctx.slice(),e[1](n(t))):l.ctx}function cf(e,t,l,n){if(e[2]&&n){const i=e[2](n(l));if(t.dirty===void 0)return i;if(typeof i=="object"){const o=[],f=Math.max(t.dirty.length,i.length);for(let r=0;r32){const t=[],l=e.ctx.length/32;for(let n=0;ne.removeEventListener(t,l,n)}function as(e){return function(t){return t.preventDefault(),e.call(this,t)}}function u(e,t,l){l==null?e.removeAttribute(t):e.getAttribute(t)!==l&&e.setAttribute(t,l)}const Bv=["width","height"];function ss(e,t){const l=Object.getOwnPropertyDescriptors(e.__proto__);for(const n in t)t[n]==null?e.removeAttribute(n):n==="style"?e.style.cssText=t[n]:n==="__value"?e.value=e[n]=t[n]:l[n]&&l[n].set&&Bv.indexOf(n)===-1?e[n]=t[n]:u(e,n,t[n])}function Ze(e){return e===""?null:+e}function Uv(e){return Array.from(e.childNodes)}function C(e,t){t=""+t,e.data!==t&&(e.data=t)}function jv(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function Hv(e,t,l){~Fv.indexOf(l)?jv(e,t):C(e,t)}function ge(e,t){e.value=t==null?"":t}function As(e,t,l,n){l==null?e.style.removeProperty(t):e.style.setProperty(t,l,n?"important":"")}function Je(e,t,l){for(let n=0;n{f.source===n.contentWindow&&t()})):(n.src="about:blank",n.onload=()=>{o=re(n.contentWindow,"resize",t),t()}),s(e,n),()=>{(i||o&&n.contentWindow)&&o(),T(n)}}function zv(e,t,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(e,l,n,t),i}function Om(e,t){return new e(t)}let Os;function Ds(e){Os=e}function Rs(){if(!Os)throw new Error("Function called outside component initialization");return Os}function jd(e){Rs().$$.on_mount.push(e)}function Wv(e){Rs().$$.on_destroy.push(e)}function Gv(){const e=Rs();return(t,l,{cancelable:n=!1}={})=>{const i=e.$$.callbacks[t];if(i){const o=zv(t,l,{cancelable:n});return i.slice().forEach(f=>{f.call(e,o)}),!o.defaultPrevented}return!0}}function qs(e,t){return Rs().$$.context.set(e,t),t}function $n(e){return Rs().$$.context.get(e)}const ts=[],zo=[];let ls=[];const Im=[],Hd=Promise.resolve();let Ka=!1;function yd(){Ka||(Ka=!0,Hd.then(zd))}function Vv(){return yd(),Hd}function Ct(e){ls.push(e)}const ja=new Set;let $i=0;function zd(){if($i!==0)return;const e=Os;do{try{for(;$ie.indexOf(n)===-1?t.push(n):l.push(n)),l.forEach(n=>n()),ls=t}const Fo=new Set;let _i;function pt(){_i={r:0,c:[],p:_i}}function dt(){_i.r||Et(_i.c),_i=_i.p}function Y(e,t){e&&e.i&&(Fo.delete(e),e.i(t))}function ee(e,t,l,n){if(e&&e.o){if(Fo.has(e))return;Fo.add(e),_i.c.push(()=>{Fo.delete(e),n&&(l&&e.d(1),n())}),e.o(t)}else n&&n()}function Wd(e,t){const l={},n={},i={$$scope:1};let o=e.length;for(;o--;){const f=e[o],r=t[o];if(r){for(const c in f)c in r||(n[c]=1);for(const c in r)i[c]||(l[c]=r[c],i[c]=1);e[o]=r}else for(const c in f)i[c]=1}for(const f in n)f in l||(l[f]=void 0);return l}function Lm(e){return typeof e=="object"&&e!==null?e:{}}function Pe(e){e&&e.c()}function Ce(e,t,l,n){const{fragment:i,after_update:o}=e.$$;i&&i.m(t,l),n||Ct(()=>{const f=e.$$.on_mount.map(Bd).filter(ff);e.$$.on_destroy?e.$$.on_destroy.push(...f):Et(f),e.$$.on_mount=[]}),o.forEach(Ct)}function Ne(e,t){const l=e.$$;l.fragment!==null&&(Yv(l.after_update),Et(l.on_destroy),l.fragment&&l.fragment.d(t),l.on_destroy=l.fragment=null,l.ctx=[])}function Qv(e,t){e.$$.dirty[0]===-1&&(ts.push(e),yd(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const h=d.length?d[0]:v;return a.ctx&&i(a.ctx[p],a.ctx[p]=h)&&(!a.skip_bound&&a.bound[p]&&a.bound[p](h),_&&Qv(e,p)),v}):[],a.update(),_=!0,Et(a.before_update),a.fragment=n?n(a.ctx):!1,t.target){if(t.hydrate){const p=Uv(t.target);a.fragment&&a.fragment.l(p),p.forEach(T)}else a.fragment&&a.fragment.c();t.intro&&Y(e.$$.fragment),Ce(e,t.target,t.anchor,t.customElement),zd()}Ds(c)}class mt{$destroy(){Ne(this,1),this.$destroy=ze}$on(t,l){if(!ff(l))return ze;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Rv(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Rm=e=>typeof e>"u",Gd=e=>typeof e=="function",Vd=e=>typeof e=="number";function Xv(e){return!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Kd(){let e=0;return()=>e++}function Zv(){return Math.random().toString(36).substring(2)}const xn=typeof window>"u";function Yd(e,t,l){return e.addEventListener(t,l),()=>e.removeEventListener(t,l)}const Qd=(e,t)=>e?{}:{style:t},Ya=e=>({"aria-hidden":"true",...Qd(e,"display:none;")}),xi=[];function Xd(e,t){return{subscribe:$t(e,t).subscribe}}function $t(e,t=ze){let l;const n=new Set;function i(r){if(rt(e,r)&&(e=r,l)){const c=!xi.length;for(const a of n)a[1](),xi.push(a,e);if(c){for(let a=0;a{n.delete(a),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:f}}function Jv(e,t,l){const n=!Array.isArray(e),i=n?[e]:e,o=t.length<2;return Xd(l,f=>{let r=!1;const c=[];let a=0,_=ze;const p=()=>{if(a)return;_();const d=t(n?c[0]:c,f);o?f(d):_=ff(d)?d:ze},v=i.map((d,h)=>uf(d,g=>{c[h]=g,a&=~(1<{a|=1<`@@svnav-ctx__${e}`,Qa=Fs("LOCATION"),os=Fs("ROUTER"),Zd=Fs("ROUTE"),$v=Fs("ROUTE_PARAMS"),xv=Fs("FOCUS_ELEM"),Jd=/^:(.+)/,Ts=(e,t,l)=>e.substr(t,l),Xa=(e,t)=>Ts(e,0,t.length)===t,eh=e=>e==="",th=e=>Jd.test(e),$d=e=>e[0]==="*",lh=e=>e.replace(/\*.*$/,""),xd=e=>e.replace(/(^\/+|\/+$)/g,"");function Tn(e,t=!1){const l=xd(e).split("/");return t?l.filter(Boolean):l}const Ha=(e,t)=>e+(t?`?${t}`:""),df=e=>`/${xd(e)}`;function Bs(...e){const t=n=>Tn(n,!0).join("/"),l=e.map(t).join("/");return df(l)}const vf=1,Ko=2,bi=3,nh=4,ev=5,ih=6,tv=7,sh=8,oh=9,lv=10,nv=11,ah={[vf]:"Link",[Ko]:"Route",[bi]:"Router",[nh]:"useFocus",[ev]:"useLocation",[ih]:"useMatch",[tv]:"useNavigate",[sh]:"useParams",[oh]:"useResolvable",[lv]:"useResolve",[nv]:"navigate"},hf=e=>ah[e];function fh(e,t){let l;return e===Ko?l=t.path?`path="${t.path}"`:"default":e===vf?l=`to="${t.to}"`:e===bi&&(l=`basepath="${t.basepath||""}"`),`<${hf(e)} ${l||""} />`}function uh(e,t,l,n){const i=l&&fh(n||e,l),o=i?` -Occurred in: ${i}`:"",f=hf(e),r=Wd(t)?t(f):t;return`<${f}> ${r}${o}`}const nv=e=>(...t)=>e(fh(...t)),iv=nv(e=>{throw new Error(e)}),Wo=nv(console.warn),Fm=4,uh=3,rh=2,ch=1,_h=1;function mh(e,t){const l=e.default?0:Tn(e.fullPath).reduce((n,i)=>{let o=n;return o+=Fm,xv(i)?o+=_h:eh(i)?o+=rh:Jd(i)?o-=Fm+ch:o+=uh,o},0);return{route:e,score:l,index:t}}function ph(e){return e.map(mh).sort((t,l)=>t.scorel.score?-1:t.index-l.index)}function sv(e,t){let l,n;const[i]=t.split("?"),o=Tn(i),f=o[0]==="",r=ph(e);for(let c=0,a=r.length;c({..._,params:v,uri:A});if(_.default){n=d(t);continue}const h=Tn(_.fullPath),g=Math.max(o.length,h.length);let M=0;for(;M{a===".."?c.pop():a!=="."&&c.push(a)}),Ha(`/${c.join("/")}`,n)}function Bm(e,t){const{pathname:l,hash:n="",search:i="",state:o}=e,f=Tn(t,!0),r=Tn(l,!0);for(;f.length;)f[0]!==r[0]&&iv(bi,`Invalid state: All locations must begin with the basepath "${t}", found "${l}"`),f.shift(),r.shift();return{pathname:Bs(...r),hash:n,search:i,state:o}}const Um=e=>e.length===1?"":e,bf=e=>{const t=e.indexOf("?"),l=e.indexOf("#"),n=t!==-1,i=l!==-1,o=i?Um(Ts(e,l)):"",f=i?Ts(e,0,l):e,r=n?Um(Ts(f,t)):"";return{pathname:(n?Ts(f,0,t):f)||"/",search:r,hash:o}},vh=e=>{const{pathname:t,search:l,hash:n}=e;return t+l+n};function hh(e,t,l){return Bs(l,dh(e,t))}function bh(e,t){const l=df(th(e)),n=Tn(l,!0),i=Tn(t,!0).slice(0,n.length),o=ov({fullPath:l},Bs(...i));return o&&o.uri}const ya="POP",gh="PUSH",kh="REPLACE";function za(e){return{...e.location,pathname:encodeURI(decodeURI(e.location.pathname)),state:e.history.state,_key:e.history.state&&e.history.state._key||"initial"}}function wh(e){let t=[],l=za(e),n=ya;const i=(o=t)=>o.forEach(f=>f({location:l,action:n}));return{get location(){return l},listen(o){t.push(o);const f=()=>{l=za(e),n=ya,i([o])};i([o]);const r=Kd(e,"popstate",f);return()=>{r(),t=t.filter(c=>c!==o)}},navigate(o,f){const{state:r={},replace:c=!1}=f||{};if(n=c?kh:gh,Gd(o))f&&Wo(lv,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=ya,e.history.go(o);else{const a={...r,_key:Xv()};try{e.history[c?"replaceState":"pushState"](a,"",o)}catch{e.location[c?"replace":"assign"](o)}}l=za(e),i()}}}function Wa(e,t){return{...bf(t),state:e}}function Mh(e="/"){let t=0,l=[Wa(null,e)];return{get entries(){return l},get location(){return l[t]},addEventListener(){},removeEventListener(){},history:{get state(){return l[t].state},pushState(n,i,o){t++,l=l.slice(0,t),l.push(Wa(n,o))},replaceState(n,i,o){l[t]=Wa(n,o)},go(n){const i=t+n;i<0||i>l.length-1||(t=i)}}}}const Sh=!!(!xn&&window.document&&window.document.createElement),Ch=!xn&&window.location.origin==="null",av=wh(Sh&&!Ch?window:Mh()),{navigate:hi}=av;let jn=null,fv=!0;function Nh(e,t){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;njn.level||e.level===jn.level&&Nh(e.routerId,jn.routerId))&&(jn=e)}function Ph(){jn=null}function Eh(){fv=!1}function jm(e){if(!e)return!1;const t="tabindex";try{if(!e.hasAttribute(t)){e.setAttribute(t,"-1");let l;l=Kd(e,"blur",()=>{e.removeAttribute(t),l()})}return e.focus(),document.activeElement===e}catch{return!1}}function Ah(e,t){return Number(e.dataset.svnavRouteEnd)===t}function Dh(e){return/^H[1-6]$/i.test(e.tagName)}function Hm(e,t=document){return t.querySelector(e)}function qh(e){let l=Hm(`[data-svnav-route-start="${e}"]`).nextElementSibling;for(;!Ah(l,e);){if(Dh(l))return l;const n=Hm("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function Oh(e){Promise.resolve(is(e.focusElement)).then(t=>{const l=t||qh(e.id);l||Wo(bi,`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.`,e,Ko),!jm(l)&&jm(document.documentElement)})}const Ih=(e,t,l)=>(n,i)=>Gv().then(()=>{if(!jn||fv){Eh();return}if(n&&Oh(jn.route),e.announcements&&i){const{path:o,fullPath:f,meta:r,params:c,uri:a}=jn.route,_=e.createAnnouncement({path:o,fullPath:f,meta:r,params:c,uri:a},is(l));Promise.resolve(_).then(p=>{t.set(p)})}Ph()}),Lh="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 Rh(e){let t,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Yd(e[6],Lh)],i={};for(let o=0;o`Navigated to ${ie.uri}`,announcements:!0,...h},A=_,I=df(_),q=$n(Qa),L=$n(os),O=!q,U=Bh(),E=d&&!(L&&!L.manageFocus),B=xt("");Cn(e,B,ie=>l(0,r=ie));const z=L?L.disableInlineStyles:g,W=xt([]);Cn(e,W,ie=>l(20,f=ie));const F=xt(null);Cn(e,F,ie=>l(18,i=ie));let R=!1;const K=O?0:L.level+1,H=O?xt((()=>Bm(xn?bf(p):v.location,I))()):q;Cn(e,H,ie=>l(17,n=ie));const Y=xt(n);Cn(e,Y,ie=>l(19,o=ie));const X=Ih(M,B,H),J=ie=>oe=>oe.filter(ae=>ae.id!==ie);function $(ie){if(xn){if(R)return;const oe=ov(ie,n.pathname);if(oe)return R=!0,oe}else W.update(oe=>{const ae=J(ie.id)(oe);return ae.push(ie),ae})}function ce(ie){W.update(J(ie))}return!O&&_!==ym&&Wo(bi,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),O&&(Ud(()=>v.listen(oe=>{const ae=Bm(oe.location,I);Y.set(n),H.set(ae)})),qs(Qa,H)),qs(os,{activeRoute:F,registerRoute:$,unregisterRoute:ce,manageFocus:E,level:K,id:U,history:O?v:L.history,basepath:O?I:L.basepath,disableInlineStyles:z}),e.$$set=ie=>{"basepath"in ie&&l(11,_=ie.basepath),"url"in ie&&l(12,p=ie.url),"history"in ie&&l(13,v=ie.history),"primary"in ie&&l(14,d=ie.primary),"a11y"in ie&&l(15,h=ie.a11y),"disableInlineStyles"in ie&&l(16,g=ie.disableInlineStyles),"$$scope"in ie&&l(21,a=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&2048&&_!==A&&Wo(bi,'You cannot change the "basepath" prop. It is ignored.'),e.$$.dirty[0]&1179648){const ie=sv(f,n.pathname);F.set(ie)}if(e.$$.dirty[0]&655360&&O){const ie=!!n.hash,oe=!ie&&E,ae=!ie||n.pathname!==o.pathname;X(oe,ae)}e.$$.dirty[0]&262144&&E&&i&&i.primary&&Th({level:K,routerId:U,route:i})},[r,M,O,U,E,B,z,W,F,H,Y,_,p,v,d,h,g,n,i,o,f,a,c]}class jh extends mt{constructor(t){super(),_t(this,t,Uh,Fh,ct,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const uv=jh;function Us(e,t,l=os,n=bi){$n(l)||iv(e,o=>`You cannot use ${o} outside of a ${hf(n)}.`,t)}const Hh=e=>{const{subscribe:t}=$n(e);return{subscribe:t}};function rv(){return Us(xd),Hh(Qa)}function cv(){const{history:e}=$n(os);return e}function _v(){const e=$n(Xd);return e?Zv(e,t=>t.base):xt("/")}function mv(){Us(tv);const e=_v(),{basepath:t}=$n(os);return n=>hh(n,is(e),t)}function yh(){Us(ev);const e=mv(),{navigate:t}=cv();return(n,i)=>{const o=Gd(n)?n:e(n);return t(o,i)}}const zh=e=>({params:e&16,location:e&8}),zm=e=>({params:xn?is(e[10]):e[4],location:e[3],navigate:e[11]});function Wm(e){let t,l;return t=new uv({props:{primary:e[1],$$slots:{default:[Vh]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wh(e){let t;const l=e[18].default,n=rf(l,e,e[19],zm);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),t=!0},p(i,o){n&&n.p&&(!t||o&524312)&&_f(n,l,i,i[19],t?cf(l,i[19],o,zh):mf(i[19]),zm)},i(i){t||(Q(n,i),t=!0)},o(i){ee(n,i),t=!1},d(i){n&&n.d(i)}}}function Gh(e){let t,l,n;const i=[{location:e[3]},{navigate:e[11]},xn?is(e[10]):e[4],e[12]];var o=e[0];function f(r){let c={};for(let a=0;a{Ce(_,1)}),dt()}o?(t=Om(o,f()),Ne(t.$$.fragment),Q(t.$$.fragment,1),Se(t,l.parentNode,l)):t=null}else o&&t.$set(a)},i(r){n||(t&&Q(t.$$.fragment,r),n=!0)},o(r){t&&ee(t.$$.fragment,r),n=!1},d(r){r&&T(l),t&&Ce(t,r)}}}function Vh(e){let t,l,n,i;const o=[Gh,Wh],f=[];function r(c,a){return c[0]!==null?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=Ut()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Q(l,1),l.m(n.parentNode,n))},i(c){i||(Q(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function Kh(e){let t,l,n,i,o,f=[Ya(e[7]),{"data-svnav-route-start":e[5]}],r={};for(let p=0;p{c=null}),dt())},i(p){o||(Q(c),o=!0)},o(p){ee(c),o=!1},d(p){p&&T(t),p&&T(l),c&&c.d(p),p&&T(n),p&&T(i)}}}const Yh=Vd();function Qh(e,t,l){let n;const i=["path","component","meta","primary"];let o=yo(t,i),f,r,c,a,{$$slots:_={},$$scope:p}=t,{path:v=""}=t,{component:d=null}=t,{meta:h={}}=t,{primary:g=!0}=t;Us(Ko,t);const M=Yh(),{registerRoute:A,unregisterRoute:I,activeRoute:q,disableInlineStyles:L}=$n(os);Cn(e,q,R=>l(16,f=R));const O=_v();Cn(e,O,R=>l(17,c=R));const U=rv();Cn(e,U,R=>l(3,r=R));const E=xt(null);let B;const z=xt(),W=xt({});Cn(e,W,R=>l(4,a=R)),qs(Xd,z),qs(Jv,W),qs($v,E);const F=yh();return xn||zv(()=>I(M)),e.$$set=R=>{l(24,t=mn(mn({},t),Ho(R))),l(12,o=yo(t,i)),"path"in R&&l(13,v=R.path),"component"in R&&l(0,d=R.component),"meta"in R&&l(14,h=R.meta),"primary"in R&&l(1,g=R.primary),"$$scope"in R&&l(19,p=R.$$scope)},e.$$.update=()=>{if(e.$$.dirty&155658){const R=v==="",K=Bs(c,v),y={id:M,path:v,meta:h,default:R,fullPath:R?"":K,base:R?c:bh(K,r.pathname),primary:g,focusElement:E};z.set(y),l(15,B=A(y))}if(e.$$.dirty&98304&&l(2,n=!!(B||f&&f.id===M)),e.$$.dirty&98308&&n){const{params:R}=B||f;W.set(R)}},t=Ho(t),[d,g,n,r,a,M,q,L,O,U,W,F,o,v,h,B,f,c,_,p]}class Xh extends mt{constructor(t){super(),_t(this,t,Qh,Kh,ct,{path:13,component:0,meta:14,primary:1})}}const Sn=Xh;function Zh(e){let t,l,n,i;const o=e[13].default,f=rf(o,e,e[12],null);let r=[{href:e[0]},e[2],e[1]],c={};for(let a=0;al(11,p=E));const q=Wv(),L=mv(),{navigate:O}=cv();function U(E){q("click",E),Qv(E)&&(E.preventDefault(),O(n,{state:M,replace:f||g}))}return e.$$set=E=>{l(19,t=mn(mn({},t),Ho(E))),l(18,_=yo(t,a)),"to"in E&&l(5,h=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,M=E.state),"getProps"in E&&l(8,A=E.getProps),"$$scope"in E&&l(12,d=E.$$scope)},e.$$.update=()=>{e.$$.dirty&2080&&l(0,n=L(h,p)),e.$$.dirty&2049&&l(10,i=Xa(p.pathname,n)),e.$$.dirty&2049&&l(9,o=n===p.pathname),e.$$.dirty&2049&&(f=bf(n)===vh(p)),e.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Wd(A)){const E=A({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...E}}return _})())},t=Ho(t),[n,c,r,I,U,h,g,M,A,o,i,p,d,v]}class $h extends mt{constructor(t){super(),_t(this,t,Jh,Zh,ct,{to:5,replace:6,state:7,getProps:8})}}const nn=$h;function Jn(e){return e===1?"green":e===2?"yellow":e===3?"red":"gray"}function xh(e,t){return e>218&&e<242?"#23ac05":e>212&&e<248?"#b1d900":e>208&&e<252?"#a3b200":"#b20000"}function gf(e,t){let l;return e>90?l="#b20000":e>85?l="#b19601":e>80?l="#a3b200":e>75?l="#569f12":l="#23ac05",l}function Is(e){return e>75?"#23ac05":e>50?"#77d900":e>25?"#94d900":"#569f12"}function Go(e){switch(e){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 ht(e){for(e=e.toString();e.length<2;)e="0"+e;return e}function Ge(e,t){switch(t){case 5:switch(e){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(e){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 ns(e){switch(e){case 2:case 4:case 7:return!0}return!1}function Ot(e,t){return e==1||e==2&&t}function Wl(e){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+e}function Bt(e,t){return isNaN(e)?"-":(isNaN(t)&&(t=e<1?2:e<10?1:0),e.toFixed(t))}function Nn(e,t){return e.setTime(e.getTime()+t*36e5),e}function Gm(e){return e=="EOE"?"ENTSO-E":e=="HKS"?"hvakosterstrommen.no":e=="EDS"?"Energi Data Service":e=="MIX"?"Mixed sources":"Unknown ("+e+")"}function Vm(e){return e=="EOE"?"https://transparency.entsoe.eu/-E":e=="HKS"?"https://www.hvakosterstrommen.no/":e=="EDS"?"https://www.energidataservice.dk/":"#"}let Io=0;function Ls(e,t){var l="";Io++;var n=function(){setTimeout(Ls,1e3,e,t)};if(e.net.ip&&Io%3==0){if(!e.net.ip){n();return}l="http://"+e.net.ip}else e.hostname&&Io%3==1?l="http://"+e.hostname:e.hostname&&Io%3==2?l="http://"+e.hostname+".local":l="";console&&console.log("Trying url "+l),t&&t(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function Vt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Km(e){return e.startsWith("esp32")?"esp32":e}function gl(e,t){let l=[e,t];return typeof e>"u"?(l[0]="-",l[1]=t):e>=1e9?(l[0]=(e/1e6).toFixed(e>1e10?0:1),l[1]="M"+t):e>1e4?(l[0]=(e/1e3).toFixed(e>1e6?0:e>1e5?1:2),l[1]="k"+t):(l[0]=e.toFixed(0),l[1]=t),l}let Bo={},Za=[];async function eb(e,t={}){const{timeout:l=8e3}=t,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(e,{...t,signal:n.signal});return clearTimeout(i),o}let Ga;async function pv(){if(Za.length){let e=Za.shift();delete Bo[e.resource];try{let t=await eb(e.resource,e.options);for(let l in e.callbacks)e.callbacks[l](t)}catch(t){console.error("Error calling "+e.resource,t);for(let l in e.callbacks)e.callbacks[l]()}}Ga&&clearTimeout(Ga),Ga=setTimeout(pv,100)}pv();async function pn(e,t={}){let l;return Bo[e]?l=Bo[e]:(l={resource:e,options:t,callbacks:[]},Bo[e]=l,Za.push(l)),new Promise(i=>l.callbacks.push(i))}let _n={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 wl=xt(_n);async function kf(){_n=await(await pn("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),wl.set(_n)}function tb(e){wl.update(t=>(t.trying=e,t))}let Lo=0,Ym=-127,Qm=null,lb={};const dv=Qd(lb,e=>{let t,l;async function n(){pn("data.json").then(i=>i.json()).then(i=>{e(i),Ym!=i.t&&(Ym=i.t,setTimeout(kv,2e3)),Qm==null&&i.pe&&i.p!=null&&(Qm=i.p,hv()),_n.upgrading?window.location.reload():(!_n||!_n.chip||_n.booting||Lo>1&&!ns(_n.board))&&(kf(),mi&&clearTimeout(mi),mi=setTimeout(Mf,2e3),pi&&clearTimeout(pi),pi=setTimeout(Sf,3e3));let o=5e3;if(ns(_n.board)&&i.v>2.5){let f=3.3-Math.min(3.3,i.v);f>0&&(o=Math.max(f,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),t&&clearTimeout(t),t=setTimeout(n,o),Lo=0}).catch(i=>{Lo++,Lo>3?(e({em:3,hm:0,wm:0,mm:0}),t=setTimeout(n,15e3),l||(l=setTimeout(Ls,5e3,_n,tb))):t=setTimeout(n,ns(_n.board)?1e4:5e3)})}return n(),function(){clearTimeout(t)}});let Ja={},Ps;const wf=xt(Ja);async function vv(){let e=!1;if(wf.update(t=>{for(var l=0;l<36;l++){if(t[ht(l)]==null){e=l<12;break}t[ht(l)]=t[ht(l+1)]}return t}),e)hv();else{let t=new Date;Ps=setTimeout(vv,(60-t.getMinutes())*6e4)}}async function hv(){Ps&&(clearTimeout(Ps),Ps=0),Ja=await(await pn("energyprice.json")).json(),wf.set(Ja);let t=new Date;Ps=setTimeout(vv,(60-t.getMinutes())*6e4)}let $a={},mi;async function Mf(){mi&&(clearTimeout(mi),mi=0),$a=await(await pn("dayplot.json")).json(),bv.set($a);let t=new Date;mi=setTimeout(Mf,(60-t.getMinutes())*6e4+20)}const bv=xt($a,e=>(Mf(),function(){}));let xa={},pi;async function Sf(){pi&&(clearTimeout(pi),pi=0),xa=await(await pn("monthplot.json")).json(),gv.set(xa);let t=new Date;pi=setTimeout(Sf,(24-t.getHours())*36e5+40)}const gv=xt(xa,e=>(Sf(),function(){}));let ef={};async function kv(){ef=await(await pn("temperature.json")).json(),wv.set(ef)}const wv=xt(ef,e=>(kv(),function(){}));let tf={},Ro;async function Mv(){Ro&&(clearTimeout(Ro),Ro=0),tf=await(await pn("tariff.json")).json(),Sv.set(tf);let t=new Date;Ro=setTimeout(Mv,(60-t.getMinutes())*6e4+30)}const Sv=xt(tf,e=>function(){});let lf=[];const Cf=xt(lf);async function nb(){lf=await(await pn("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Cf.set(lf)}let es=0,ib={data:[]};async function Uo(){let t=await(await pn(es<0?"realtime.json":"realtime.json?offset="+es)).json();Cv.update(l=>{for(let n=0;n=0&&(es+=t.size,eso&&(r=p):g==i+1&&(c=p);else if(h==n+1)if(a){let A=a.tag_name.substring(1).split(".");parseInt(A[0]);let I=parseInt(A[1]);parseInt(A[2]),g==I&&(a=p)}else a=p}return c||a||r||!1}else return t[0]}function Xm(e){var c,a;let t=((a=(c=e[1].header)==null?void 0:c.uptime)!=null?a:"Up")+"",l,n,i;function o(_,p){return _[2]>1?cb:_[2]>0?rb:_[3]>1?ub:_[3]>0?fb:_[4]>1?ab:_[4]>0?ob:sb}let f=o(e),r=f(e);return{c(){l=k(t),n=b(),r.c(),i=Ut()},m(_,p){P(_,l,p),P(_,n,p),r.m(_,p),P(_,i,p)},p(_,p){var v,d;p&2&&t!==(t=((d=(v=_[1].header)==null?void 0:v.uptime)!=null?d:"Up")+"")&&C(l,t),f===(f=o(_))&&r?r.p(_,p):(r.d(1),r=f(_),r&&(r.c(),r.m(i.parentNode,i)))},d(_){_&&T(l),_&&T(n),r.d(_),_&&T(i)}}}function sb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.seconds)!=null?f:"s")+"",i;return{c(){t=k(e[0]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&1&&C(t,r[0]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.seconds)!=null?_:"s")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ob(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minute)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minute)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ab(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minutes)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minutes)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function fb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hour)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hour)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ub(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hours)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hours)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function rb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.day)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.day)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function cb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.days)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.days)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function _b(e){let t,l=e[0]&&Xm(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Xm(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function mb(e,t,l){let{epoch:n}=t,i={};Ml.subscribe(c=>{l(1,i=c)});let o=0,f=0,r=0;return e.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},e.$$.update=()=>{e.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,f=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,o,f,r]}class pb extends mt{constructor(t){super(),_t(this,t,mb,_b,ct,{epoch:0})}}function db(e){let t,l,n;return{c(){t=m("span"),l=k(e[2]),u(t,"title",e[1]),u(t,"class",n="bd-"+e[0])},m(i,o){P(i,t,o),s(t,l)},p(i,[o]){o&4&&C(l,i[2]),o&2&&u(t,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(t,"class",n)},i:ze,o:ze,d(i){i&&T(t)}}}function vb(e,t,l){let{color:n}=t,{title:i}=t,{text:o}=t;return e.$$set=f=>{"color"in f&&l(0,n=f.color),"title"in f&&l(1,i=f.title),"text"in f&&l(2,o=f.text)},[n,i,o]}class di extends mt{constructor(t){super(),_t(this,t,vb,db,ct,{color:0,title:1,text:2})}}function hb(e){let t,l=`${ht(e[0].getDate())}.${ht(e[0].getMonth()+1)}.${e[0].getFullYear()} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,n;return{c(){t=m("span"),n=k(l),u(t,"class",e[1])},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&1&&l!==(l=`${ht(i[0].getDate())}.${ht(i[0].getMonth()+1)}.${i[0].getFullYear()} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(n,l),o&2&&u(t,"class",i[1])},d(i){i&&T(t)}}}function bb(e){var n;let t=`${ht(e[0].getDate())}. ${e[2].months?(n=e[2].months)==null?void 0:n[e[0].getMonth()]:ht(e[0].getMonth())} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,l;return{c(){l=k(t)},m(i,o){P(i,l,o)},p(i,o){var f;o&5&&t!==(t=`${ht(i[0].getDate())}. ${i[2].months?(f=i[2].months)==null?void 0:f[i[0].getMonth()]:ht(i[0].getMonth())} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(l,t)},d(i){i&&T(l)}}}function gb(e){let t;function l(o,f){return o[3]?bb:hb}let n=l(e),i=n(e);return{c(){i.c(),t=Ut()},m(o,f){i.m(o,f),P(o,t,f)},p(o,[f]){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},i:ze,o:ze,d(o){i.d(o),o&&T(t)}}}function kb(e,t,l){let n={};Ml.subscribe(c=>{l(2,n=c)});let{timestamp:i}=t,{fullTimeColor:o}=t,{offset:f}=t,r;return e.$$set=c=>{"timestamp"in c&&l(0,i=c.timestamp),"fullTimeColor"in c&&l(1,o=c.fullTimeColor),"offset"in c&&l(4,f=c.offset)},e.$$.update=()=>{e.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(f)||Nn(i,f-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,r,f]}class Ev extends mt{constructor(t){super(),_t(this,t,kb,gb,ct,{timestamp:0,fullTimeColor:1,offset:4})}}function wb(e){let t,l,n;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(i,o){P(i,t,o),s(t,l),s(t,n)},p:ze,i:ze,o:ze,d(i){i&&T(t)}}}class Mb extends mt{constructor(t){super(),_t(this,t,null,wb,ct,{})}}function Sb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Cb extends mt{constructor(t){super(),_t(this,t,null,Sb,ct,{})}}function Nb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Tb extends mt{constructor(t){super(),_t(this,t,null,Nb,ct,{})}}function Pb(e){let t,l,n=e[2].version+"",i;return{c(){t=k("AMS reader "),l=m("span"),i=k(n)},m(o,f){P(o,t,f),P(o,l,f),s(l,i)},p(o,f){f&4&&n!==(n=o[2].version+"")&&C(i,n)},d(o){o&&T(t),o&&T(l)}}}function Zm(e){let t,l=(e[1].t>-50?e[1].t.toFixed(1):"-")+"",n,i;return{c(){t=m("div"),n=k(l),i=k("\xB0C"),u(t,"class","flex-none my-auto")},m(o,f){P(o,t,f),s(t,n),s(t,i)},p(o,f){f&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&C(n,l)},d(o){o&&T(t)}}}function Jm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.han)!=null?o:"HAN")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.han)==null?void 0:r[e[1].he])!=null?c:e[1].he),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.han)!=null?v:"HAN")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.han)==null?void 0:h[a[1].he])!=null?g:a[1].he))&&C(n,l)},d(a){a&&T(t)}}}function $m(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.mqtt)!=null?o:"MQTT")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.mqtt)==null?void 0:r[e[1].me])!=null?c:e[1].me),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.mqtt)!=null?v:"MQTT")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.mqtt)==null?void 0:h[a[1].me])!=null?g:a[1].me))&&C(n,l)},d(a){a&&T(t)}}}function xm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.price)!=null?o:"PS")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.price)==null?void 0:r[e[1].ee])!=null?c:e[1].ee),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.price)!=null?v:"PS")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.price)==null?void 0:h[a[1].ee])!=null?g:a[1].ee))&&C(n,l)},d(a){a&&T(t)}}}function ep(e){let t,l,n,i,o,f,r,c;return l=new nn({props:{to:"/configuration",$$slots:{default:[Eb]},$$scope:{ctx:e}}}),f=new nn({props:{to:"/status",$$slots:{default:[Ab]},$$scope:{ctx:e}}}),{c(){var a,_,p,v;t=m("div"),Ne(l.$$.fragment),i=b(),o=m("div"),Ne(f.$$.fragment),u(t,"class","flex-none px-1 mt-1"),u(t,"title",n=(_=(a=e[4].header)==null?void 0:a.config)!=null?_:""),u(o,"class","flex-none px-1 mt-1"),u(o,"title",r=(v=(p=e[4].header)==null?void 0:p.status)!=null?v:"")},m(a,_){P(a,t,_),Se(l,t,null),P(a,i,_),P(a,o,_),Se(f,o,null),c=!0},p(a,_){var d,h,g,M;const p={};_&64&&(p.$$scope={dirty:_,ctx:a}),l.$set(p),(!c||_&16&&n!==(n=(h=(d=a[4].header)==null?void 0:d.config)!=null?h:""))&&u(t,"title",n);const v={};_&64&&(v.$$scope={dirty:_,ctx:a}),f.$set(v),(!c||_&16&&r!==(r=(M=(g=a[4].header)==null?void 0:g.status)!=null?M:""))&&u(o,"title",r)},i(a){c||(Q(l.$$.fragment,a),Q(f.$$.fragment,a),c=!0)},o(a){ee(l.$$.fragment,a),ee(f.$$.fragment,a),c=!1},d(a){a&&T(t),Ce(l),a&&T(i),a&&T(o),Ce(f)}}}function Eb(e){let t,l;return t=new Mb({}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Ab(e){let t,l;return t=new Cb({}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function tp(e){let t,l;function n(f,r){return f[2].security==0||f[1].a?qb:Db}let i=n(e),o=i(e);return{c(){var f,r;t=m("div"),o.c(),u(t,"class","flex-none mr-3 text-yellow-500"),u(t,"title",l=((r=(f=e[4].header)==null?void 0:f.new_version)!=null?r:"New version")+": "+e[3].tag_name)},m(f,r){P(f,t,r),o.m(t,null)},p(f,r){var c,a;i===(i=n(f))&&o?o.p(f,r):(o.d(1),o=i(f),o&&(o.c(),o.m(t,null))),r&24&&l!==(l=((a=(c=f[4].header)==null?void 0:c.new_version)!=null?a:"New version")+": "+f[3].tag_name)&&u(t,"title",l)},d(f){f&&T(t),o.d()}}}function Db(e){var r,c;let t,l=((c=(r=e[4].header)==null?void 0:r.new_version)!=null?c:"New version")+"",n,i,o=e[3].tag_name+"",f;return{c(){t=m("span"),n=k(l),i=k(": "),f=k(o)},m(a,_){P(a,t,_),s(t,n),s(t,i),s(t,f)},p(a,_){var p,v;_&16&&l!==(l=((v=(p=a[4].header)==null?void 0:p.new_version)!=null?v:"New version")+"")&&C(n,l),_&8&&o!==(o=a[3].tag_name+"")&&C(f,o)},d(a){a&&T(t)}}}function qb(e){var _,p;let t,l,n=((p=(_=e[4].header)==null?void 0:_.new_version)!=null?p:"New version")+"",i,o,f=e[3].tag_name+"",r,c,a;return{c(){t=m("button"),l=m("span"),i=k(n),o=k(": "),r=k(f),u(l,"class","mt-1"),u(t,"class","flex")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(l,o),s(l,r),c||(a=re(t,"click",e[5]),c=!0)},p(v,d){var h,g;d&16&&n!==(n=((g=(h=v[4].header)==null?void 0:h.new_version)!=null?g:"New version")+"")&&C(i,n),d&8&&f!==(f=v[3].tag_name+"")&&C(r,f)},d(v){v&&T(t),c=!1,a()}}}function Ob(e){var te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te;let t,l,n,i,o,f,r,c,a,_,p,v=((le=(te=e[4].header)==null?void 0:te.mem)!=null?le:"Free")+"",d,h,g=(e[1].m?(e[1].m/1e3).toFixed(1):"-")+"",M,A,I,q,L,O,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge;i=new nn({props:{to:"/",$$slots:{default:[Pb]},$$scope:{ctx:e}}}),c=new pb({props:{epoch:e[1].u}});let ve=e[1].t>-50&&Zm(e);L=new di({props:{title:(de=(fe=e[4].header)==null?void 0:fe.esp)!=null?de:"ESP",text:e[2].booting?(Pe=(qe=e[4].header)==null?void 0:qe.booting)!=null?Pe:"Booting":e[1].v>2?e[1].v.toFixed(2)+"V":(Fe=(we=e[4].header)==null?void 0:we.esp)!=null?Fe:"ESP",color:Jn(e[2].booting?2:e[1].em)}}),U=new di({props:{title:(ke=(Ae=e[4].header)==null?void 0:Ae.han)!=null?ke:"HAN",text:(He=(De=e[4].header)==null?void 0:De.han)!=null?He:"HAN",color:Jn(e[2].booting?9:e[1].hm)}}),B=new di({props:{title:(je=(Oe=e[4].header)==null?void 0:Oe.wifi)!=null?je:"WiFi",text:e[1].r?e[1].r.toFixed(0)+"dBm":(We=(Ye=e[4].header)==null?void 0:Ye.wifi)!=null?We:"WiFi",color:Jn(e[2].booting?9:e[1].wm)}}),W=new di({props:{title:(xe=($e=e[4].header)==null?void 0:$e.mqtt)!=null?xe:"MQTT",text:(Te=(tt=e[4].header)==null?void 0:tt.mqtt)!=null?Te:"MQTT",color:Jn(e[2].booting?9:e[1].mm)}});let S=(e[1].he<0||e[1].he>0)&&Jm(e),w=e[1].me<0&&$m(e),N=(e[1].ee>0||e[1].ee<0)&&xm(e);oe=new Ev({props:{timestamp:e[1].c?new Date(e[1].c*1e3):new Date(0),offset:e[2].clock_offset,fullTimeColor:"text-red-500"}});let D=e[2].vndcfg&&e[2].usrcfg&&ep(e);pe=new Tb({});let j=e[2].fwconsent===1&&e[3]&&tp(e);return{c(){var ue,Ie;t=m("nav"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),r=m("div"),Ne(c.$$.fragment),a=b(),ve&&ve.c(),_=b(),p=m("div"),d=k(v),h=k(": "),M=k(g),A=k("kb"),I=b(),q=m("div"),Ne(L.$$.fragment),O=b(),Ne(U.$$.fragment),E=b(),Ne(B.$$.fragment),z=b(),Ne(W.$$.fragment),F=b(),S&&S.c(),R=b(),w&&w.c(),K=b(),N&&N.c(),y=b(),H=m("div"),Y=m("div"),X=m("a"),J=m("img"),ce=b(),ie=m("div"),Ne(oe.$$.fragment),ae=b(),D&&D.c(),se=b(),x=m("div"),me=m("a"),Ne(pe.$$.fragment),Z=b(),j&&j.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(p,"class","flex-none my-auto"),u(f,"class","flex-none my-auto p-2 flex space-x-4"),u(q,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(J,"class","logo"),jo(J.src,$=(e[0]+"/logo.svg").replace("//","/"))||u(J,"src",$),u(J,"alt","GitHub repo"),u(X,"class","float-right"),u(X,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(X,"target","_blank"),u(X,"rel","noreferrer"),u(X,"aria-label","GitHub"),u(Y,"class","flex-none"),u(ie,"class","flex-none my-auto px-2"),u(me,"href",Wl("")),u(me,"target","_blank"),u(me,"rel","noreferrer"),u(x,"class","flex-none px-1 mt-1"),u(x,"title",V=(Ie=(ue=e[4].header)==null?void 0:ue.doc)!=null?Ie:""),u(H,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(t,"class","hdr")},m(ue,Ie){P(ue,t,Ie),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(f,r),Se(c,r,null),s(f,a),ve&&ve.m(f,null),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(p,A),s(l,I),s(l,q),Se(L,q,null),s(q,O),Se(U,q,null),s(q,E),Se(B,q,null),s(q,z),Se(W,q,null),s(l,F),S&&S.m(l,null),s(l,R),w&&w.m(l,null),s(l,K),N&&N.m(l,null),s(l,y),s(l,H),s(H,Y),s(Y,X),s(X,J),s(H,ce),s(H,ie),Se(oe,ie,null),s(H,ae),D&&D.m(H,null),s(H,se),s(H,x),s(x,me),Se(pe,me,null),s(H,Z),j&&j.m(H,null),ge=!0},p(ue,[Ie]){var gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt;const kt={};Ie&68&&(kt.$$scope={dirty:Ie,ctx:ue}),i.$set(kt);const lt={};Ie&2&&(lt.epoch=ue[1].u),c.$set(lt),ue[1].t>-50?ve?ve.p(ue,Ie):(ve=Zm(ue),ve.c(),ve.m(f,_)):ve&&(ve.d(1),ve=null),(!ge||Ie&16)&&v!==(v=((At=(gt=ue[4].header)==null?void 0:gt.mem)!=null?At:"Free")+"")&&C(d,v),(!ge||Ie&2)&&g!==(g=(ue[1].m?(ue[1].m/1e3).toFixed(1):"-")+"")&&C(M,g);const wt={};Ie&16&&(wt.title=(Be=(Pt=ue[4].header)==null?void 0:Pt.esp)!=null?Be:"ESP"),Ie&22&&(wt.text=ue[2].booting?(It=(ye=ue[4].header)==null?void 0:ye.booting)!=null?It:"Booting":ue[1].v>2?ue[1].v.toFixed(2)+"V":(nt=(vt=ue[4].header)==null?void 0:vt.esp)!=null?nt:"ESP"),Ie&6&&(wt.color=Jn(ue[2].booting?2:ue[1].em)),L.$set(wt);const st={};Ie&16&&(st.title=(it=(Tt=ue[4].header)==null?void 0:Tt.han)!=null?it:"HAN"),Ie&16&&(st.text=(rt=(at=ue[4].header)==null?void 0:at.han)!=null?rt:"HAN"),Ie&6&&(st.color=Jn(ue[2].booting?9:ue[1].hm)),U.$set(st);const ot={};Ie&16&&(ot.title=(Lt=(jt=ue[4].header)==null?void 0:jt.wifi)!=null?Lt:"WiFi"),Ie&18&&(ot.text=ue[1].r?ue[1].r.toFixed(0)+"dBm":(yt=(Ht=ue[4].header)==null?void 0:Ht.wifi)!=null?yt:"WiFi"),Ie&6&&(ot.color=Jn(ue[2].booting?9:ue[1].wm)),B.$set(ot);const et={};Ie&16&&(et.title=(Ve=(Me=ue[4].header)==null?void 0:Me.mqtt)!=null?Ve:"MQTT"),Ie&16&&(et.text=(Gt=(Rt=ue[4].header)==null?void 0:Rt.mqtt)!=null?Gt:"MQTT"),Ie&6&&(et.color=Jn(ue[2].booting?9:ue[1].mm)),W.$set(et),ue[1].he<0||ue[1].he>0?S?S.p(ue,Ie):(S=Jm(ue),S.c(),S.m(l,R)):S&&(S.d(1),S=null),ue[1].me<0?w?w.p(ue,Ie):(w=$m(ue),w.c(),w.m(l,K)):w&&(w.d(1),w=null),ue[1].ee>0||ue[1].ee<0?N?N.p(ue,Ie):(N=xm(ue),N.c(),N.m(l,y)):N&&(N.d(1),N=null),(!ge||Ie&1&&!jo(J.src,$=(ue[0]+"/logo.svg").replace("//","/")))&&u(J,"src",$);const Nt={};Ie&2&&(Nt.timestamp=ue[1].c?new Date(ue[1].c*1e3):new Date(0)),Ie&4&&(Nt.offset=ue[2].clock_offset),oe.$set(Nt),ue[2].vndcfg&&ue[2].usrcfg?D?(D.p(ue,Ie),Ie&4&&Q(D,1)):(D=ep(ue),D.c(),Q(D,1),D.m(H,se)):D&&(pt(),ee(D,1,1,()=>{D=null}),dt()),(!ge||Ie&16&&V!==(V=(Dt=(zt=ue[4].header)==null?void 0:zt.doc)!=null?Dt:""))&&u(x,"title",V),ue[2].fwconsent===1&&ue[3]?j?j.p(ue,Ie):(j=tp(ue),j.c(),j.m(H,null)):j&&(j.d(1),j=null)},i(ue){ge||(Q(i.$$.fragment,ue),Q(c.$$.fragment,ue),Q(L.$$.fragment,ue),Q(U.$$.fragment,ue),Q(B.$$.fragment,ue),Q(W.$$.fragment,ue),Q(oe.$$.fragment,ue),Q(D),Q(pe.$$.fragment,ue),ge=!0)},o(ue){ee(i.$$.fragment,ue),ee(c.$$.fragment,ue),ee(L.$$.fragment,ue),ee(U.$$.fragment,ue),ee(B.$$.fragment,ue),ee(W.$$.fragment,ue),ee(oe.$$.fragment,ue),ee(D),ee(pe.$$.fragment,ue),ge=!1},d(ue){ue&&T(t),Ce(i),Ce(c),ve&&ve.d(),Ce(L),Ce(U),Ce(B),Ce(W),S&&S.d(),w&&w.d(),N&&N.d(),Ce(oe),D&&D.d(),Ce(pe),j&&j.d()}}}function Ib(e,t,l){let{basepath:n="/"}=t,{data:i={}}=t,o={},f={};function r(){var a,_;confirm(((_=(a=c.header)==null?void 0:a.upgrade)!=null?_:"Upgrade to {0}?").replace("{0}",f.tag_name))&&(!ns(o.board)||confirm(Vo(Ge(o.chip,o.board))))&&(wl.update(p=>(p.upgrading=!0,p)),Tv(f.tag_name))}wl.subscribe(a=>{l(2,o=a),a.fwconsent===1&&nb()}),Cf.subscribe(a=>{l(3,f=Pv(o.version,a))});let c={};return Ml.subscribe(a=>{l(4,c=a)}),e.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,f,c,r]}class Lb extends mt{constructor(t){super(),_t(this,t,Ib,Ob,ct,{basepath:0,data:1})}}function Rb(e){let t,l,n,i;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"d",Va(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Va(150,150,115,210,210+300*e[0]/100)),u(n,"stroke",e[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(t,"viewBox","0 0 300 300"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"height","100%")},m(o,f){P(o,t,f),s(t,l),s(t,n)},p(o,[f]){f&1&&i!==(i=Va(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),f&2&&u(n,"stroke",o[1])},i:ze,o:ze,d(o){o&&T(t)}}}function lp(e,t,l,n){var i=(n-90)*Math.PI/180;return{x:e+l*Math.cos(i),y:t+l*Math.sin(i)}}function Va(e,t,l,n,i){var o=lp(e,t,l,i),f=lp(e,t,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,f.x,f.y].join(" ");return c}function Fb(e,t,l){let{pct:n=0}=t,{color:i="red"}=t;return e.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Bb extends mt{constructor(t){super(),_t(this,t,Fb,Rb,ct,{pct:0,color:1})}}function np(e){let t,l,n,i,o,f,r,c;return{c(){t=m("br"),l=b(),n=m("span"),i=k(e[1]),o=b(),f=m("span"),r=k(e[2]),c=k("/kWh"),u(n,"class","pl-sub"),u(f,"class","pl-snt")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),P(a,o,_),P(a,f,_),s(f,r),s(f,c)},p(a,_){_&2&&C(i,a[1]),_&4&&C(r,a[2])},d(a){a&&T(t),a&&T(l),a&&T(n),a&&T(o),a&&T(f)}}}function Ub(e){let t,l,n,i,o,f,r,c,a,_,p=e[4][0]+"",v,d,h,g=e[4][1]+"",M,A,I;l=new Bb({props:{pct:e[5],color:e[3](e[5],document.documentElement.classList.contains("dark"))}});let q=e[1]&&np(e);return{c(){t=m("div"),Ne(l.$$.fragment),n=b(),i=m("span"),o=m("span"),f=k(e[0]),r=b(),c=m("br"),a=b(),_=m("span"),v=k(p),d=b(),h=m("span"),M=k(g),A=b(),q&&q.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(h,"class","pl-unt"),u(i,"class","pl-ov"),u(t,"class","pl-root")},m(L,O){P(L,t,O),Se(l,t,null),s(t,n),s(t,i),s(i,o),s(o,f),s(i,r),s(i,c),s(i,a),s(i,_),s(_,v),s(i,d),s(i,h),s(h,M),s(i,A),q&&q.m(i,null),I=!0},p(L,[O]){const U={};O&32&&(U.pct=L[5]),O&40&&(U.color=L[3](L[5],document.documentElement.classList.contains("dark"))),l.$set(U),(!I||O&1)&&C(f,L[0]),(!I||O&16)&&p!==(p=L[4][0]+"")&&C(v,p),(!I||O&16)&&g!==(g=L[4][1]+"")&&C(M,g),L[1]?q?q.p(L,O):(q=np(L),q.c(),q.m(i,null)):q&&(q.d(1),q=null)},i(L){I||(Q(l.$$.fragment,L),I=!0)},o(L){ee(l.$$.fragment,L),I=!1},d(L){L&&T(t),Ce(l),q&&q.d()}}}function jb(e,t,l){let{val:n}=t,{max:i}=t,{unit:o}=t,{label:f}=t,{sub:r=""}=t,{subunit:c=""}=t,{colorFn:a}=t,_,p=0;return e.$$set=v=>{"val"in v&&l(6,n=v.val),"max"in v&&l(7,i=v.max),"unit"in v&&l(8,o=v.unit),"label"in v&&l(0,f=v.label),"sub"in v&&l(1,r=v.sub),"subunit"in v&&l(2,c=v.subunit),"colorFn"in v&&l(3,a=v.colorFn)},e.$$.update=()=>{e.$$.dirty&448&&(l(4,_=gl(n,o)),l(5,p=Math.min(n,i)/i*100))},[f,r,c,a,_,p,n,i,o]}class Av extends mt{constructor(t){super(),_t(this,t,jb,Ub,ct,{val:6,max:7,unit:8,label:0,sub:1,subunit:2,colorFn:3})}}function ip(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function sp(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function op(e,t,l){const n=e.slice();return n[15]=t[l],n}function ap(e){let t,l,n,i,o,f,r=e[0].title&&fp(e),c=e[0].y.ticks,a=[];for(let h=0;he[9].call(t))},m(o,f){P(o,t,f),s(t,n),i=pf(t,e[9].bind(t))},p(o,f){f&1&&l!==(l=o[0].title+"")&&C(n,l)},d(o){o&&T(t),i()}}}function up(e){let t,l,n,i=e[15].label+"",o,f,r,c;return{c(){t=bt("g"),l=bt("line"),n=bt("text"),o=k(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",f=e[15].align=="right"?"85%":""),u(t,"class",r="tick tick-"+e[15].value+" tick-"+e[15].color),u(t,"transform",c="translate(0, "+e[7](e[15].value)+")")},m(a,_){P(a,t,_),s(t,l),s(t,n),s(n,o)},p(a,_){_&1&&i!==(i=a[15].label+"")&&C(o,i),_&1&&f!==(f=a[15].align=="right"?"85%":"")&&u(n,"x",f),_&1&&r!==(r="tick tick-"+a[15].value+" tick-"+a[15].color)&&u(t,"class",r),_&129&&c!==(c="translate(0, "+a[7](a[15].value)+")")&&u(t,"transform",c)},d(a){a&&T(t)}}}function rp(e){let t=!isNaN(e[7](e[15].value)),l,n=t&&up(e);return{c(){n&&n.c(),l=Ut()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&129&&(t=!isNaN(i[7](i[15].value))),t?n?n.p(i,o):(n=up(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function cp(e){let t,l,n=(e[3]>20||e[13]%2==0)&&_p(e);return{c(){t=bt("g"),n&&n.c(),u(t,"class","tick"),u(t,"transform",l="translate("+e[6](e[13])+","+e[4]+")")},m(i,o){P(i,t,o),n&&n.m(t,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=_p(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(t,"transform",l)},d(i){i&&T(t),n&&n.d()}}}function _p(e){let t,l=e[11].label+"",n,i;return{c(){t=bt("text"),n=k(l),u(t,"x",i=e[3]/2),u(t,"y","-4")},m(o,f){P(o,t,f),s(t,n)},p(o,f){f&1&&l!==(l=o[11].label+"")&&C(n,l),f&8&&i!==(i=o[3]/2)&&u(t,"x",i)},d(o){o&&T(t)}}}function mp(e){let t=!isNaN(e[6](e[13])),l,n=t&&cp(e);return{c(){n&&n.c(),l=Ut()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&64&&(t=!isNaN(i[6](i[13]))),t?n?n.p(i,o):(n=cp(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function pp(e){let t,l,n=e[11].value!==void 0&&dp(e),i=e[11].value2>1e-4&&bp(e);return{c(){t=bt("g"),n&&n.c(),l=bt("g"),i&&i.c()},m(o,f){P(o,t,f),n&&n.m(t,null),P(o,l,f),i&&i.m(l,null)},p(o,f){o[11].value!==void 0?n?n.p(o,f):(n=dp(o),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,f):(i=bp(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&T(t),n&&n.d(),o&&T(l),i&&i.d()}}}function dp(e){let t,l,n,i,o,f,r,c=e[3]>15&&vp(e);return{c(){t=bt("rect"),c&&c.c(),r=Ut(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](e[11].value)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](Math.min(e[0].y.min,0)+e[11].value)),u(t,"fill",f=e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&129&&n!==(n=a[7](a[11].value))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](Math.min(a[0].y.min,0)+a[11].value))&&u(t,"height",o),_&1&&f!==(f=a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=vp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function vp(e){let t,l=e[11].label+"",n,i,o,f,r,c,a=e[11].title&&hp(e);return{c(){t=bt("text"),n=k(l),a&&a.c(),c=Ut(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor",o=e[3]e[7](0)-e[8]?e[11].color:"white"),u(t,"transform",r="translate("+(e[6](e[13])+e[3]/2)+" "+(e[7](e[11].value)>e[7](0)-e[8]?e[7](e[11].value)-e[8]:e[7](e[11].value)+10)+") rotate("+(e[11].labelAngle?e[11].labelAngle:e[3]_[7](0)-_[8]?_[11].color:"white")&&u(t,"fill",f),p&457&&r!==(r="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]15&&gp(e);return{c(){t=bt("rect"),c&&c.c(),r=Ut(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](0)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](e[0].y.min+e[11].value2)),u(t,"fill",f=e[11].color2?e[11].color2:e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&128&&n!==(n=a[7](0))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](a[0].y.min+a[11].value2))&&u(t,"height",o),_&1&&f!==(f=a[11].color2?a[11].color2:a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=gp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function gp(e){let t,l=e[11].label2+"",n,i,o,f,r,c=e[11].title2&&kp(e);return{c(){t=bt("text"),n=k(l),c&&c.c(),r=Ut(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor","middle"),u(t,"fill",o=e[7](-e[11].value2)e[10].call(t))},m(i,o){P(i,t,o),n&&n.m(t,null),l=pf(t,e[10].bind(t))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ap(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null)},i:ze,o:ze,d(i){i&&T(t),n&&n.d(),l()}}}let vi=30;function yb(e,t,l){let{config:n}=t,i,o,f,r,c,a,_,p=0;function v(){p=this.clientHeight,l(5,p)}function d(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return e.$$set=h=>{"config"in h&&l(0,n=h.config)},e.$$.update=()=>{if(e.$$.dirty&63){l(4,a=o-p);let h=i-(n.padding.left+n.padding.right);l(3,f=h/n.points.length),l(8,_=fn.y.max?A=n.padding.bottom:Ma||A<0?0:A})}},[n,i,o,f,a,p,r,c,_,v,d]}class gi extends mt{constructor(t){super(),_t(this,t,yb,Hb,ct,{config:0})}}function zb(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wb(e,t,l){let{title:n}=t,{u1:i}=t,{u2:o}=t,{u3:f}=t,{ds:r}=t,c={};function a(_){return{label:Bt(_)+"V",title:_.toFixed(1)+" V",value:isNaN(_)?0:_,color:xh(_||0,document.documentElement.classList.contains("dark"))}}return e.$$set=_=>{"title"in _&&l(1,n=_.title),"u1"in _&&l(2,i=_.u1),"u2"in _&&l(3,o=_.u2),"u3"in _&&l(4,f=_.u3),"ds"in _&&l(5,r=_.ds)},e.$$.update=()=>{if(e.$$.dirty&62){let _=[],p=[];i>0&&(_.push({label:r===1?"L1-L2":"L1"}),p.push(a(i))),o>0&&(_.push({label:r===1?"L1-L3":"L2"}),p.push(a(o))),f>0&&(_.push({label:r===1?"L2-L3":"L3"}),p.push(a(f))),l(0,c={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:_},points:p})}},[c,n,i,o,f,r]}class Gb extends mt{constructor(t){super(),_t(this,t,Wb,zb,ct,{title:1,u1:2,u2:3,u3:4,ds:5})}}function Vb(e){var D,j,te,le,fe,de,qe,Pe,we,Fe;let t,l,n=((j=(D=e[0].reactive)==null?void 0:D.title)!=null?j:"Reactive")+"",i,o,f,r,c=((le=(te=e[0].reactive)==null?void 0:te.instant_in)!=null?le:"Instant in")+"",a,_,p,v=e[1][0]+"",d,h,g=e[1][1]+"",M,A,I,q=((de=(fe=e[0].reactive)==null?void 0:fe.instant_out)!=null?de:"Instant out")+"",L,O,U,E=e[2][0]+"",B,z,W=e[2][1]+"",F,R,K,y,H=((Pe=(qe=e[0].reactive)==null?void 0:qe.total_in)!=null?Pe:"Total in")+"",Y,X,J,$=e[3][0]+"",ce,ie,oe=e[3][1]+"",ae,se,x,me=((Fe=(we=e[0].reactive)==null?void 0:we.total_out)!=null?Fe:"Total out")+"",pe,V,Z,ge=e[4][0]+"",ve,S,w=e[4][1]+"",N;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),r=m("div"),a=k(c),_=b(),p=m("div"),d=k(v),h=b(),M=k(g),A=b(),I=m("div"),L=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),K=m("div"),y=m("div"),Y=k(H),X=b(),J=m("div"),ce=k($),ie=b(),ae=k(oe),se=b(),x=m("div"),pe=k(me),V=b(),Z=m("div"),ve=k(ge),S=b(),N=k(w),u(p,"class","text-right"),u(U,"class","text-right"),u(f,"class","grid grid-cols-2 mt-4"),u(J,"class","text-right"),u(Z,"class","text-right"),u(K,"class","grid grid-cols-2 mt-4"),u(t,"class","mx-2 text-sm")},m(Ae,ke){P(Ae,t,ke),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(r,a),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(f,A),s(f,I),s(I,L),s(f,O),s(f,U),s(U,B),s(U,z),s(U,F),s(t,R),s(t,K),s(K,y),s(y,Y),s(K,X),s(K,J),s(J,ce),s(J,ie),s(J,ae),s(K,se),s(K,x),s(x,pe),s(K,V),s(K,Z),s(Z,ve),s(Z,S),s(Z,N)},p(Ae,[ke]){var De,He,Oe,je,Ye,We,$e,xe,tt,Te;ke&1&&n!==(n=((He=(De=Ae[0].reactive)==null?void 0:De.title)!=null?He:"Reactive")+"")&&C(i,n),ke&1&&c!==(c=((je=(Oe=Ae[0].reactive)==null?void 0:Oe.instant_in)!=null?je:"Instant in")+"")&&C(a,c),ke&2&&v!==(v=Ae[1][0]+"")&&C(d,v),ke&2&&g!==(g=Ae[1][1]+"")&&C(M,g),ke&1&&q!==(q=((We=(Ye=Ae[0].reactive)==null?void 0:Ye.instant_out)!=null?We:"Instant out")+"")&&C(L,q),ke&4&&E!==(E=Ae[2][0]+"")&&C(B,E),ke&4&&W!==(W=Ae[2][1]+"")&&C(F,W),ke&1&&H!==(H=((xe=($e=Ae[0].reactive)==null?void 0:$e.total_in)!=null?xe:"Total in")+"")&&C(Y,H),ke&8&&$!==($=Ae[3][0]+"")&&C(ce,$),ke&8&&oe!==(oe=Ae[3][1]+"")&&C(ae,oe),ke&1&&me!==(me=((Te=(tt=Ae[0].reactive)==null?void 0:tt.total_out)!=null?Te:"Total out")+"")&&C(pe,me),ke&16&&ge!==(ge=Ae[4][0]+"")&&C(ve,ge),ke&16&&w!==(w=Ae[4][1]+"")&&C(N,w)},i:ze,o:ze,d(Ae){Ae&&T(t)}}}function Kb(e,t,l){let{importInstant:n}=t,{exportInstant:i}=t,{importTotal:o}=t,{exportTotal:f}=t,r={};Ml.subscribe(v=>{l(0,r=v)});let c,a,_,p;return e.$$set=v=>{"importInstant"in v&&l(5,n=v.importInstant),"exportInstant"in v&&l(6,i=v.exportInstant),"importTotal"in v&&l(7,o=v.importTotal),"exportTotal"in v&&l(8,f=v.exportTotal)},e.$$.update=()=>{e.$$.dirty&480&&(l(1,c=gl(n,"VAr")),l(2,a=gl(i,"VAr")),l(3,_=gl(o*1e3,"VArh")),l(4,p=gl(f*1e3,"VArh")))},[r,c,a,_,p,n,i,o,f]}class Yb extends mt{constructor(t){super(),_t(this,t,Kb,Vb,ct,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8})}}function Mp(e){let t;function l(o,f){return o[3]?Xb:Qb}let n=l(e),i=n(e);return{c(){i.c(),t=Ut()},m(o,f){i.m(o,f),P(o,t,f)},p(o,f){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},d(o){i.d(o),o&&T(t)}}}function Qb(e){var j,te,le,fe,de,qe,Pe,we,Fe,Ae;let t,l=((te=(j=e[5].realtime)==null?void 0:j.consumption)!=null?te:"Consumption")+"",n,i,o,f,r=Vt((fe=(le=e[5].common)==null?void 0:le.hour)!=null?fe:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,I=Vt((qe=(de=e[5].common)==null?void 0:de.day)!=null?qe:"Day")+"",q,L,O,U=e[7][0]+"",E,B,z=e[7][1]+"",W,F,R,K=Vt((we=(Pe=e[5].common)==null?void 0:Pe.month)!=null?we:"Month")+"",y,H,Y,X=e[8][0]+"",J,$,ce=e[8][1]+"",ie,oe,ae,se=((Ae=(Fe=e[5].realtime)==null?void 0:Fe.last_month)!=null?Ae:"Last month")+"",x,me,pe,V=e[9][0]+"",Z,ge,ve=e[9][1]+"",S,w,N,D=e[4]&&Sp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),A=m("div"),q=k(I),L=b(),O=m("div"),E=k(U),B=b(),W=k(z),F=b(),R=m("div"),y=k(K),H=b(),Y=m("div"),J=k(X),$=b(),ie=k(ce),oe=b(),ae=m("div"),x=k(se),me=b(),pe=m("div"),Z=k(V),ge=b(),S=k(ve),w=b(),D&&D.c(),N=Ut(),u(_,"class","text-right"),u(O,"class","text-right"),u(Y,"class","text-right"),u(pe,"class","text-right"),u(o,"class","grid grid-cols-2 mb-3")},m(ke,De){P(ke,t,De),s(t,n),P(ke,i,De),P(ke,o,De),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),s(o,A),s(A,q),s(o,L),s(o,O),s(O,E),s(O,B),s(O,W),s(o,F),s(o,R),s(R,y),s(o,H),s(o,Y),s(Y,J),s(Y,$),s(Y,ie),s(o,oe),s(o,ae),s(ae,x),s(o,me),s(o,pe),s(pe,Z),s(pe,ge),s(pe,S),P(ke,w,De),D&&D.m(ke,De),P(ke,N,De)},p(ke,De){var He,Oe,je,Ye,We,$e,xe,tt,Te,ue;De&32&&l!==(l=((Oe=(He=ke[5].realtime)==null?void 0:He.consumption)!=null?Oe:"Consumption")+"")&&C(n,l),De&32&&r!==(r=Vt((Ye=(je=ke[5].common)==null?void 0:je.hour)!=null?Ye:"Hour")+"")&&C(c,r),De&64&&p!==(p=ke[6][0]+"")&&C(v,p),De&64&&h!==(h=ke[6][1]+"")&&C(g,h),De&32&&I!==(I=Vt(($e=(We=ke[5].common)==null?void 0:We.day)!=null?$e:"Day")+"")&&C(q,I),De&128&&U!==(U=ke[7][0]+"")&&C(E,U),De&128&&z!==(z=ke[7][1]+"")&&C(W,z),De&32&&K!==(K=Vt((tt=(xe=ke[5].common)==null?void 0:xe.month)!=null?tt:"Month")+"")&&C(y,K),De&256&&X!==(X=ke[8][0]+"")&&C(J,X),De&256&&ce!==(ce=ke[8][1]+"")&&C(ie,ce),De&32&&se!==(se=((ue=(Te=ke[5].realtime)==null?void 0:Te.last_month)!=null?ue:"Last month")+"")&&C(x,se),De&512&&V!==(V=ke[9][0]+"")&&C(Z,V),De&512&&ve!==(ve=ke[9][1]+"")&&C(S,ve),ke[4]?D?D.p(ke,De):(D=Sp(ke),D.c(),D.m(N.parentNode,N)):D&&(D.d(1),D=null)},d(ke){ke&&T(t),ke&&T(i),ke&&T(o),ke&&T(w),D&&D.d(ke),ke&&T(N)}}}function Xb(e){var Yt,ll,fl,ul,Sl,rl,Cl,nl,_l,dl,Nl,Tl,Qt,Ee,qt,Pn,Jl,dn,En,Re;let t,l=((ll=(Yt=e[5].common)==null?void 0:Yt.import)!=null?ll:"Import")+"",n,i,o,f,r=Vt((ul=(fl=e[5].common)==null?void 0:fl.hour)!=null?ul:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,I,q=Vt((rl=(Sl=e[5].common)==null?void 0:Sl.day)!=null?rl:"Day")+"",L,O,U,E=e[7][0]+"",B,z,W=e[7][1]+"",F,R,K,y,H=Vt((nl=(Cl=e[5].common)==null?void 0:Cl.month)!=null?nl:"Month")+"",Y,X,J,$=e[8][0]+"",ce,ie,oe=e[8][1]+"",ae,se,x,me,pe=((dl=(_l=e[5].realtime)==null?void 0:_l.last_mo)!=null?dl:"Last mo.")+"",V,Z,ge,ve=e[9][0]+"",S,w,N=e[9][1]+"",D,j,te,le,fe,de=((Tl=(Nl=e[5].common)==null?void 0:Nl.export)!=null?Tl:"Export")+"",qe,Pe,we,Fe,Ae=Vt((Ee=(Qt=e[5].common)==null?void 0:Qt.hour)!=null?Ee:"Hour")+"",ke,De,He,Oe=e[10][0]+"",je,Ye,We=e[10][1]+"",$e,xe,tt,Te,ue=Vt((Pn=(qt=e[5].common)==null?void 0:qt.day)!=null?Pn:"Day")+"",Ie,kt,lt,wt=e[11][0]+"",st,ot,et=e[11][1]+"",Nt,gt,At,Pt,Be=Vt((dn=(Jl=e[5].common)==null?void 0:Jl.month)!=null?dn:"Month")+"",ye,It,vt,nt=e[12][0]+"",Tt,it,at=e[12][1]+"",rt,jt,Lt,Ht,yt=((Re=(En=e[5].realtime)==null?void 0:En.last_mo)!=null?Re:"Last mo.")+"",Me,Ve,Rt,Gt=e[13][0]+"",zt,Dt,Kt=e[13][1]+"",Zt,tl,Jt,ft=e[4]&&Cp(e),Mt=e[4]&&Np(e),Ke=e[4]&&Tp(e),ne=e[4]&&Pp(e),Ue=e[4]&&Ep(e),Le=e[4]&&Ap(e),St=e[4]&&Dp(e),ut=e[4]&&qp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),ft&&ft.c(),A=b(),I=m("div"),L=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),Mt&&Mt.c(),K=b(),y=m("div"),Y=k(H),X=b(),J=m("div"),ce=k($),ie=b(),ae=k(oe),se=b(),Ke&&Ke.c(),x=b(),me=m("div"),V=k(pe),Z=b(),ge=m("div"),S=k(ve),w=b(),D=k(N),j=b(),ne&&ne.c(),le=b(),fe=m("strong"),qe=k(de),Pe=b(),we=m("div"),Fe=m("div"),ke=k(Ae),De=b(),He=m("div"),je=k(Oe),Ye=b(),$e=k(We),xe=b(),Ue&&Ue.c(),tt=b(),Te=m("div"),Ie=k(ue),kt=b(),lt=m("div"),st=k(wt),ot=b(),Nt=k(et),gt=b(),Le&&Le.c(),At=b(),Pt=m("div"),ye=k(Be),It=b(),vt=m("div"),Tt=k(nt),it=b(),rt=k(at),jt=b(),St&&St.c(),Lt=b(),Ht=m("div"),Me=k(yt),Ve=b(),Rt=m("div"),zt=k(Gt),Dt=b(),Zt=k(Kt),tl=b(),ut&&ut.c(),u(_,"class","text-right"),u(U,"class","text-right"),u(J,"class","text-right"),u(ge,"class","text-right"),u(o,"class",te="grid grid-cols-"+e[14]+" mb-3"),u(He,"class","text-right"),u(lt,"class","text-right"),u(vt,"class","text-right"),u(Rt,"class","text-right"),u(we,"class",Jt="grid grid-cols-"+e[14])},m(he,Qe){P(he,t,Qe),s(t,n),P(he,i,Qe),P(he,o,Qe),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),ft&&ft.m(o,null),s(o,A),s(o,I),s(I,L),s(o,O),s(o,U),s(U,B),s(U,z),s(U,F),s(o,R),Mt&&Mt.m(o,null),s(o,K),s(o,y),s(y,Y),s(o,X),s(o,J),s(J,ce),s(J,ie),s(J,ae),s(o,se),Ke&&Ke.m(o,null),s(o,x),s(o,me),s(me,V),s(o,Z),s(o,ge),s(ge,S),s(ge,w),s(ge,D),s(o,j),ne&&ne.m(o,null),P(he,le,Qe),P(he,fe,Qe),s(fe,qe),P(he,Pe,Qe),P(he,we,Qe),s(we,Fe),s(Fe,ke),s(we,De),s(we,He),s(He,je),s(He,Ye),s(He,$e),s(we,xe),Ue&&Ue.m(we,null),s(we,tt),s(we,Te),s(Te,Ie),s(we,kt),s(we,lt),s(lt,st),s(lt,ot),s(lt,Nt),s(we,gt),Le&&Le.m(we,null),s(we,At),s(we,Pt),s(Pt,ye),s(we,It),s(we,vt),s(vt,Tt),s(vt,it),s(vt,rt),s(we,jt),St&&St.m(we,null),s(we,Lt),s(we,Ht),s(Ht,Me),s(we,Ve),s(we,Rt),s(Rt,zt),s(Rt,Dt),s(Rt,Zt),s(we,tl),ut&&ut.m(we,null)},p(he,Qe){var vn,An,Hn,yn,ml,$l,xl,zn,en,Gl,hn,Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl;Qe&32&&l!==(l=((An=(vn=he[5].common)==null?void 0:vn.import)!=null?An:"Import")+"")&&C(n,l),Qe&32&&r!==(r=Vt((yn=(Hn=he[5].common)==null?void 0:Hn.hour)!=null?yn:"Hour")+"")&&C(c,r),Qe&64&&p!==(p=he[6][0]+"")&&C(v,p),Qe&64&&h!==(h=he[6][1]+"")&&C(g,h),he[4]?ft?ft.p(he,Qe):(ft=Cp(he),ft.c(),ft.m(o,A)):ft&&(ft.d(1),ft=null),Qe&32&&q!==(q=Vt(($l=(ml=he[5].common)==null?void 0:ml.day)!=null?$l:"Day")+"")&&C(L,q),Qe&128&&E!==(E=he[7][0]+"")&&C(B,E),Qe&128&&W!==(W=he[7][1]+"")&&C(F,W),he[4]?Mt?Mt.p(he,Qe):(Mt=Np(he),Mt.c(),Mt.m(o,K)):Mt&&(Mt.d(1),Mt=null),Qe&32&&H!==(H=Vt((zn=(xl=he[5].common)==null?void 0:xl.month)!=null?zn:"Month")+"")&&C(Y,H),Qe&256&&$!==($=he[8][0]+"")&&C(ce,$),Qe&256&&oe!==(oe=he[8][1]+"")&&C(ae,oe),he[4]?Ke?Ke.p(he,Qe):(Ke=Tp(he),Ke.c(),Ke.m(o,x)):Ke&&(Ke.d(1),Ke=null),Qe&32&&pe!==(pe=((Gl=(en=he[5].realtime)==null?void 0:en.last_mo)!=null?Gl:"Last mo.")+"")&&C(V,pe),Qe&512&&ve!==(ve=he[9][0]+"")&&C(S,ve),Qe&512&&N!==(N=he[9][1]+"")&&C(D,N),he[4]?ne?ne.p(he,Qe):(ne=Pp(he),ne.c(),ne.m(o,null)):ne&&(ne.d(1),ne=null),Qe&16384&&te!==(te="grid grid-cols-"+he[14]+" mb-3")&&u(o,"class",te),Qe&32&&de!==(de=((Dn=(hn=he[5].common)==null?void 0:hn.export)!=null?Dn:"Export")+"")&&C(qe,de),Qe&32&&Ae!==(Ae=Vt((Gn=(Wn=he[5].common)==null?void 0:Wn.hour)!=null?Gn:"Hour")+"")&&C(ke,Ae),Qe&1024&&Oe!==(Oe=he[10][0]+"")&&C(je,Oe),Qe&1024&&We!==(We=he[10][1]+"")&&C($e,We),he[4]?Ue?Ue.p(he,Qe):(Ue=Ep(he),Ue.c(),Ue.m(we,tt)):Ue&&(Ue.d(1),Ue=null),Qe&32&&ue!==(ue=Vt((cl=(tn=he[5].common)==null?void 0:tn.day)!=null?cl:"Day")+"")&&C(Ie,ue),Qe&2048&&wt!==(wt=he[11][0]+"")&&C(st,wt),Qe&2048&&et!==(et=he[11][1]+"")&&C(Nt,et),he[4]?Le?Le.p(he,Qe):(Le=Ap(he),Le.c(),Le.m(we,At)):Le&&(Le.d(1),Le=null),Qe&32&&Be!==(Be=Vt((bn=(Vn=he[5].common)==null?void 0:Vn.month)!=null?bn:"Month")+"")&&C(ye,Be),Qe&4096&&nt!==(nt=he[12][0]+"")&&C(Tt,nt),Qe&4096&&at!==(at=he[12][1]+"")&&C(rt,at),he[4]?St?St.p(he,Qe):(St=Dp(he),St.c(),St.m(we,Lt)):St&&(St.d(1),St=null),Qe&32&&yt!==(yt=((Vl=(Kn=he[5].realtime)==null?void 0:Kn.last_mo)!=null?Vl:"Last mo.")+"")&&C(Me,yt),Qe&8192&&Gt!==(Gt=he[13][0]+"")&&C(zt,Gt),Qe&8192&&Kt!==(Kt=he[13][1]+"")&&C(Zt,Kt),he[4]?ut?ut.p(he,Qe):(ut=qp(he),ut.c(),ut.m(we,null)):ut&&(ut.d(1),ut=null),Qe&16384&&Jt!==(Jt="grid grid-cols-"+he[14])&&u(we,"class",Jt)},d(he){he&&T(t),he&&T(i),he&&T(o),ft&&ft.d(),Mt&&Mt.d(),Ke&&Ke.d(),ne&&ne.d(),he&&T(le),he&&T(fe),he&&T(Pe),he&&T(we),Ue&&Ue.d(),Le&&Le.d(),St&&St.d(),ut&&ut.d()}}}function Sp(e){var Z,ge,ve,S,w,N,D,j,te,le;let t,l=((ge=(Z=e[5].realtime)==null?void 0:Z.cost)!=null?ge:"Cost")+"",n,i,o,f,r=Vt((S=(ve=e[5].common)==null?void 0:ve.hour)!=null?S:"Hour")+"",c,a,_,p=Bt(e[1].h.c,2)+"",v,d,h,g,M,A=Vt((N=(w=e[5].common)==null?void 0:w.day)!=null?N:"Day")+"",I,q,L,O=Bt(e[1].d.c,1)+"",U,E,B,z,W,F=Vt((j=(D=e[5].common)==null?void 0:D.month)!=null?j:"Month")+"",R,K,y,H=Bt(e[1].m.c)+"",Y,X,J,$,ce,ie=((le=(te=e[5].realtime)==null?void 0:te.last_month)!=null?le:"Last month")+"",oe,ae,se,x=Bt(e[0].last_month.c)+"",me,pe,V;return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),h=k(e[2]),g=b(),M=m("div"),I=k(A),q=b(),L=m("div"),U=k(O),E=b(),B=k(e[2]),z=b(),W=m("div"),R=k(F),K=b(),y=m("div"),Y=k(H),X=b(),J=k(e[2]),$=b(),ce=m("div"),oe=k(ie),ae=b(),se=m("div"),me=k(x),pe=b(),V=k(e[2]),u(_,"class","text-right"),u(L,"class","text-right"),u(y,"class","text-right"),u(se,"class","text-right"),u(o,"class","grid grid-cols-2")},m(fe,de){P(fe,t,de),s(t,n),P(fe,i,de),P(fe,o,de),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,h),s(o,g),s(o,M),s(M,I),s(o,q),s(o,L),s(L,U),s(L,E),s(L,B),s(o,z),s(o,W),s(W,R),s(o,K),s(o,y),s(y,Y),s(y,X),s(y,J),s(o,$),s(o,ce),s(ce,oe),s(o,ae),s(o,se),s(se,me),s(se,pe),s(se,V)},p(fe,de){var qe,Pe,we,Fe,Ae,ke,De,He,Oe,je;de&32&&l!==(l=((Pe=(qe=fe[5].realtime)==null?void 0:qe.cost)!=null?Pe:"Cost")+"")&&C(n,l),de&32&&r!==(r=Vt((Fe=(we=fe[5].common)==null?void 0:we.hour)!=null?Fe:"Hour")+"")&&C(c,r),de&2&&p!==(p=Bt(fe[1].h.c,2)+"")&&C(v,p),de&4&&C(h,fe[2]),de&32&&A!==(A=Vt((ke=(Ae=fe[5].common)==null?void 0:Ae.day)!=null?ke:"Day")+"")&&C(I,A),de&2&&O!==(O=Bt(fe[1].d.c,1)+"")&&C(U,O),de&4&&C(B,fe[2]),de&32&&F!==(F=Vt((He=(De=fe[5].common)==null?void 0:De.month)!=null?He:"Month")+"")&&C(R,F),de&2&&H!==(H=Bt(fe[1].m.c)+"")&&C(Y,H),de&4&&C(J,fe[2]),de&32&&ie!==(ie=((je=(Oe=fe[5].realtime)==null?void 0:Oe.last_month)!=null?je:"Last month")+"")&&C(oe,ie),de&1&&x!==(x=Bt(fe[0].last_month.c)+"")&&C(me,x),de&4&&C(V,fe[2])},d(fe){fe&&T(t),fe&&T(i),fe&&T(o)}}}function Cp(e){let t,l=Bt(e[1].h.c,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].h.c,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Np(e){let t,l=Bt(e[1].d.c,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].d.c,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Tp(e){let t,l=Bt(e[1].m.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].m.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Pp(e){let t,l=Bt(e[0].last_month.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Bt(f[0].last_month.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ep(e){let t,l=Bt(e[1].h.i,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].h.i,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ap(e){let t,l=Bt(e[1].d.i,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].d.i,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Dp(e){let t,l=Bt(e[1].m.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Bt(f[1].m.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function qp(e){let t,l=Bt(e[0].last_month.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Bt(f[0].last_month.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Zb(e){var _,p;let t,l,n=((p=(_=e[5].realtime)==null?void 0:_.title)!=null?p:"Real time calculations")+"",i,o,f,r,c,a=e[1]&&Mp(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("br"),r=m("br"),c=b(),a&&a.c(),u(t,"class","mx-2 text-sm")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),s(t,r),s(t,c),a&&a.m(t,null)},p(v,[d]){var h,g;d&32&&n!==(n=((g=(h=v[5].realtime)==null?void 0:h.title)!=null?g:"Real time calculations")+"")&&C(i,n),v[1]?a?a.p(v,d):(a=Mp(v),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(v){v&&T(t),a&&a.d()}}}function Jb(e,t,l){let{sysinfo:n}=t,{data:i}=t,{currency:o}=t,{hasExport:f}=t,r={};Ml.subscribe(I=>{l(5,r=I)});let c,a,_,p,v,d,h,g,M=!1,A=3;return e.$$set=I=>{"sysinfo"in I&&l(0,n=I.sysinfo),"data"in I&&l(1,i=I.data),"currency"in I&&l(2,o=I.currency),"hasExport"in I&&l(3,f=I.hasExport)},e.$$.update=()=>{var I,q,L,O,U,E,B,z;e.$$.dirty&19&&(l(4,M=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,A=M?3:2),l(6,c=gl(((I=i==null?void 0:i.h)==null?void 0:I.u)*1e3,"Wh")),l(7,a=gl(((q=i==null?void 0:i.d)==null?void 0:q.u)*1e3,"Wh")),l(8,_=gl(((L=i==null?void 0:i.m)==null?void 0:L.u)*1e3,"Wh")),l(9,p=gl(((O=n==null?void 0:n.last_month)==null?void 0:O.c)*1e3,"Wh")),l(10,v=gl(((U=i==null?void 0:i.h)==null?void 0:U.p)*1e3,"Wh")),l(11,d=gl(((E=i==null?void 0:i.d)==null?void 0:E.p)*1e3,"Wh")),l(12,h=gl(((B=i==null?void 0:i.m)==null?void 0:B.p)*1e3,"Wh")),l(13,g=gl(((z=n==null?void 0:n.last_month)==null?void 0:z.p)*1e3,"Wh")))},[n,i,o,f,M,r,c,a,_,p,v,d,h,g,A]}class $b extends mt{constructor(t){super(),_t(this,t,Jb,Zb,ct,{sysinfo:0,data:1,currency:2,hasExport:3})}}function xb(e){let t,l,n=Gm(e[0].source)+"",i,o,f,r,c;return r=new gi({props:{config:e[1]}}),{c(){t=m("a"),l=k("Provided by: "),i=k(n),f=b(),Ne(r.$$.fragment),u(t,"href",o=Vm(e[0].source)),u(t,"target","_blank"),u(t,"class","text-xs float-right z-40")},m(a,_){P(a,t,_),s(t,l),s(t,i),P(a,f,_),Se(r,a,_),c=!0},p(a,[_]){(!c||_&1)&&n!==(n=Gm(a[0].source)+"")&&C(i,n),(!c||_&1&&o!==(o=Vm(a[0].source)))&&u(t,"href",o);const p={};_&2&&(p.config=a[1]),r.$set(p)},i(a){c||(Q(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(f),Ce(r,a)}}}function e4(e,t,l){let{title:n}=t,{json:i}=t,{sysinfo:o}=t,f={},r,c,a=document.documentElement.classList.contains("dark");return e.$$set=_=>{"title"in _&&l(2,n=_.title),"json"in _&&l(0,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&61){let _=i.currency,p=new Date().getUTCHours(),v=0,d=0,h=0,g=[],M=[],A=[];l(5,c=l(4,r=0));let I=new Date;for(Nn(I,o.clock_offset-(24+I.getHours()-I.getUTCHours())%24),v=p;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(I.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(I,1);for(v=0;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(I.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(I,1);if(c>-100&&r<100){switch(_){case"NOK":case"DKK":_="\xF8re";break;case"SEK":_="\xF6re";break;case"EUR":_="cent";break;case"CHF":_="rp.";break;default:_=_+"/100"}for(l(5,c*=100),l(4,r*=100),v=0;v=0?E.toFixed(B):"",title:E>=0?E.toFixed(2)+" "+_:"",value:d>=0?Math.abs(d):0,label2:E<0?E.toFixed(B):"",title2:E<0?E.toFixed(2)+" "+_:"",value2:d<0?Math.abs(d):0,color:a?"#5c2da5":"#7c3aed"})}let L=Math.max(r,Math.abs(c));if(c<0){l(5,c=Math.min(L/4*-1,c));let E=Math.ceil(Math.abs(c)/L*4),B=c/E;for(v=1;v{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=Nn(new Date,-24),g=new Date().getUTCHours();for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),_=g;_<24;_++){let q=i["i"+ht(_)],L=i["e"+ht(_)];q===void 0&&(q=0),L===void 0&&(L=0),v.push({label:ht(h.getHours())}),d.push({label:q.toFixed(1),title:q.toFixed(2)+" kWh",value:q*10,label2:L.toFixed(1),title2:L.toFixed(2)+" kWh",value2:L*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,L*10)),l(4,r=Math.max(r,q*10)),Nn(h,1)}for(_=0;_{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=new Date,g=new Date;for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),Nn(g,o.clock_offset-(24+g.getHours()-g.getUTCHours())%24),g.setDate(0),_=h.getDate();_<=g.getDate();_++){let q=i["i"+ht(_)],L=i["e"+ht(_)];q===void 0&&(q=0),L===void 0&&(L=0),v.push({label:ht(_)}),d.push({label:q.toFixed(q<10?1:0),title:q.toFixed(2)+" kWh",value:q,label2:L.toFixed(L<10?1:0),title2:L.toFixed(2)+" kWh",value2:L,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,L)),l(4,r=Math.max(r,q))}for(_=1;_{"title"in a&&l(1,n=a.title),"json"in a&&l(2,i=a.json)},e.$$.update=()=>{if(e.$$.dirty&30){let a=0,_=0,p=[],v=[],d=[];i.s&&i.s.forEach((M,A)=>{var I=M.n?M.n:M.a;_=M.v,_==-127&&(_=0),v.push({label:I.slice(-4)}),d.push({label:_.toFixed(1),value:_,color:o?"#5c2da5":"#7c3aed"}),l(4,c=Math.min(c,_)),l(3,r=Math.max(r,_))}),l(3,r=Math.ceil(r)),l(4,c=Math.floor(c));let h=r;c<0&&(h+=Math.abs(c));let g=h/4;for(a=0;a<5;a++)_=c+g*a,p.push({value:_,label:_.toFixed(1)});l(0,f={title:n+" (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:r,ticks:p},x:{ticks:v},points:d})}},[f,n,i,r,c]}class r4 extends mt{constructor(t){super(),_t(this,t,u4,f4,ct,{title:1,json:2})}}function c4(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}let _4=0;function m4(e,t,l){let n={};Ml.subscribe(a=>{l(2,n=a)});let{title:i}=t,o=document.documentElement.classList.contains("dark"),f={},r=0,c;return Sv.subscribe(a=>{l(4,c=a)}),Mv(),e.$$set=a=>{"title"in a&&l(1,i=a.title)},e.$$.update=()=>{var a;if(e.$$.dirty&30){let _=0,p=[],v=[],d=[];if(p.push({value:0,label:0}),c&&c.p)for(_=0;_0?ht(h.d)+"."+((a=n.months)==null?void 0:a[new Date().getMonth()]):"-"}),l(3,r=Math.max(r,h.v))}if(c&&c.t){for(_=0;_=r)break;p.push({value:h,label:h})}p.push({label:c.m.toFixed(1),align:"right",color:"green",value:c.m})}c&&c.c&&(p.push({label:c.c.toFixed(0),color:"orange",value:c.c}),l(3,r=Math.max(r,c.c))),l(3,r=Math.ceil(r)),l(0,f={title:i,padding:{top:20,right:35,bottom:20,left:35},y:{min:_4,max:r,ticks:p},x:{ticks:v},points:d})}},[f,i,n,r,c]}class p4 extends mt{constructor(t){super(),_t(this,t,m4,c4,ct,{title:1})}}function Op(e,t,l){const n=e.slice();return n[23]=t[l],n[25]=l,n}function Ip(e,t,l){const n=e.slice();return n[26]=t[l],n}function Lp(e){let t,l,n,i,o,f=e[8],r=[];for(let _=0;_e[16].call(t))},m(_,p){P(_,t,p),s(t,l),s(l,n),s(l,i),s(l,o),s(l,f),s(t,r),a&&a.m(t,null),c=pf(t,e[16].bind(t))},p(_,[p]){p&1&&C(n,_[0]),p&2048&&C(o,_[11]),_[8]?a?a.p(_,p):(a=Lp(_),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(_){_&&T(t),a&&a.d(),c()}}}function v4(e,t,l){let{title:n}=t,i=document.documentElement.classList.contains("dark"),o=0,f=0,r=0,c=!1,a=null,_;Cv.subscribe(W=>{l(13,a=W),r=o,_&&clearTimeout(_),_=setTimeout(Uo,6e5)});function p(){if(r>o||r-o>300)Uo();else for(;o>r;)a.data.unshift(f),l(13,a.data=a.data.slice(0,a.size),a),r+=10}dv.subscribe(W=>{var F;if(f=W.i-W.e,o=W.u,!c){Uo(),c=!0;return}!((F=a==null?void 0:a.data)!=null&&F.length)||p()});let v,d,h,g,M,A,I,q,L,O,U,E,B;function z(){h=this.clientWidth,g=this.clientHeight,l(1,h),l(2,g)}return e.$$set=W=>{"title"in W&&l(0,n=W.title)},e.$$.update=()=>{if(e.$$.dirty&58366&&(l(3,M=parseInt(g)-50),l(4,A=h-35),l(10,E=A/a.size),l(15,d=0),l(14,v=0),a.data)){for(let F in a.data){let R=a.data[F];isNaN(R)&&(R=0),l(14,v=Math.max(Math.ceil(R/1e3)*1e3,v)),l(15,d=Math.min(Math.ceil(R/1e3)*1e3,d))}l(11,B=v>2500?"kW":"W"),l(8,O=[]);for(let F=d;F2500?(F/1e3).toFixed(1):F});l(9,U=[]);for(let F=0;F900?O/1e3:O)+(O>900?"k":"")+i,title:O.toFixed(2)+" "+i,value:isNaN(O)?0:O,color:A(O?O/g*100:0,document.documentElement.classList.contains("dark")),label2:Bt(U>900?U/1e3:U)+(U>900?"k":"")+i,title2:U.toFixed(2)+" "+i,value2:isNaN(U)?0:U,color2:I(U?U/M*100:0)}}return e.$$set=O=>{"title"in O&&l(1,n=O.title),"unit"in O&&l(2,i=O.unit),"l1"in O&&l(3,o=O.l1),"l2"in O&&l(4,f=O.l2),"l2x"in O&&l(5,r=O.l2x),"l3"in O&&l(6,c=O.l3),"l1i"in O&&l(7,a=O.l1i),"l2i"in O&&l(8,_=O.l2i),"l3i"in O&&l(9,p=O.l3i),"l1e"in O&&l(10,v=O.l1e),"l2e"in O&&l(11,d=O.l2e),"l3e"in O&&l(12,h=O.l3e),"maxImport"in O&&l(13,g=O.maxImport),"maxExport"in O&&l(14,M=O.maxExport),"importColorFn"in O&&l(15,A=O.importColorFn),"exportColorFn"in O&&l(16,I=O.exportColorFn)},e.$$.update=()=>{if(e.$$.dirty&32762){let O=[],U=[];o&&(O.push({label:"L1"}),U.push(L(a,v))),f&&(r?(O.push({label:"L2"}),U.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(O.push({label:"L2"}),U.push(L(_,d)))),c&&(O.push({label:"L3"}),U.push(L(p,h)));let E=[];M&&(E.push({value:-M,label:"-100%"}),E.push({value:-M/4*3,label:"-75%"}),E.push({value:-M/2,label:"-50%"}),E.push({value:-M/4,label:"-25%"})),E.push({value:0,label:"0%"}),g&&(E.push({value:g/4,label:"25%"}),E.push({value:g/2,label:"50%"}),E.push({value:g/4*3,label:"75%"}),E.push({value:g,label:"100%"})),l(0,q={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:-M,max:g,ticks:E},x:{ticks:O},points:U})}},[q,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I]}class Nf extends mt{constructor(t){super(),_t(this,t,g4,b4,ct,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function jp(e){var A,I;let t,l,n,i,o,f,r=(e[0].mt?Go(e[0].mt):"-")+"",c,a,_,p=e[7][0]+"",v,d,h=e[7][1]+"",g,M;return i=new Av({props:{val:e[0].i?e[0].i:0,max:e[0].im?e[0].im:15e3,unit:"W",label:(I=(A=e[6].common)==null?void 0:A.import)!=null?I:"Import",sub:e[0].p,subunit:e[0].pc,colorFn:gf}}),{c(){t=m("div"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(q,L){P(q,t,L),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(f,c),s(l,a),s(l,_),s(_,v),s(_,d),s(_,g),M=!0},p(q,L){var U,E;const O={};L&1&&(O.val=q[0].i?q[0].i:0),L&1&&(O.max=q[0].im?q[0].im:15e3),L&64&&(O.label=(E=(U=q[6].common)==null?void 0:U.import)!=null?E:"Import"),L&1&&(O.sub=q[0].p),L&1&&(O.subunit=q[0].pc),i.$set(O),(!M||L&1)&&r!==(r=(q[0].mt?Go(q[0].mt):"-")+"")&&C(c,r),(!M||L&128)&&p!==(p=q[7][0]+"")&&C(v,p),(!M||L&128)&&h!==(h=q[7][1]+"")&&C(g,h)},i(q){M||(Q(i.$$.fragment,q),M=!0)},o(q){ee(i.$$.fragment,q),M=!1},d(q){q&&T(t),Ce(i)}}}function Hp(e){var g,M;let t,l,n,i,o,f,r,c,a=e[8][0]+"",_,p,v=e[8][1]+"",d,h;return i=new Av({props:{val:e[0].e?e[0].e:0,max:e[0].om?e[0].om*1e3:1e4,unit:"W",label:(M=(g=e[6].common)==null?void 0:g.export)!=null?M:"Export",colorFn:Is}}),{c(){t=m("div"),l=m("div"),n=m("div"),Ne(i.$$.fragment),o=b(),f=m("div"),r=b(),c=m("div"),_=k(a),p=b(),d=k(v),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(A,I){P(A,t,I),s(t,l),s(l,n),Se(i,n,null),s(l,o),s(l,f),s(l,r),s(l,c),s(c,_),s(c,p),s(c,d),h=!0},p(A,I){var L,O;const q={};I&1&&(q.val=A[0].e?A[0].e:0),I&1&&(q.max=A[0].om?A[0].om*1e3:1e4),I&64&&(q.label=(O=(L=A[6].common)==null?void 0:L.export)!=null?O:"Export"),i.$set(q),(!h||I&256)&&a!==(a=A[8][0]+"")&&C(_,a),(!h||I&256)&&v!==(v=A[8][1]+"")&&C(d,v)},i(A){h||(Q(i.$$.fragment,A),h=!0)},o(A){ee(i.$$.fragment,A),h=!1},d(A){A&&T(t),Ce(i)}}}function yp(e){let t,l,n=e[0].l1&&zp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=zp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function zp(e){var n,i;let t,l;return t=new Gb({props:{title:(i=(n=e[6].common)==null?void 0:n.voltage)!=null?i:"Volt",u1:e[0].l1.u,u2:e[0].l2.u,u3:e[0].l3.u,ds:e[0].ds}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.voltage)!=null?a:"Volt"),f&1&&(r.u1=o[0].l1.u),f&1&&(r.u2=o[0].l2.u),f&1&&(r.u3=o[0].l3.u),f&1&&(r.ds=o[0].ds),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Wp(e){let t,l,n=e[0].l1&&Gp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Gp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Gp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].common)==null?void 0:n.amperage)!=null?i:"Amp",unit:"A",importColorFn:gf,exportColorFn:Is,maxImport:e[0].mf,maxExport:e[0].om?e[9]?e[0].om/.4/Math.sqrt(3):e[0].om/.23:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l2x:e[0].i2e,l1i:Math.max(e[0].l1.i,0),l2i:Math.max(e[0].l2.i,0),l3i:Math.max(e[0].l3.i,0),l1e:Math.max(e[0].l1.e,0),l2e:Math.max(e[0].l2.e,0),l3e:Math.max(e[0].l3.e,0)}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.amperage)!=null?a:"Amp"),f&1&&(r.maxImport=o[0].mf),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om/.4/Math.sqrt(3):o[0].om/.23:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l2x=o[0].i2e),f&1&&(r.l1i=Math.max(o[0].l1.i,0)),f&1&&(r.l2i=Math.max(o[0].l2.i,0)),f&1&&(r.l3i=Math.max(o[0].l3.i,0)),f&1&&(r.l1e=Math.max(o[0].l1.e,0)),f&1&&(r.l2e=Math.max(o[0].l2.e,0)),f&1&&(r.l3e=Math.max(o[0].l3.e,0)),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Vp(e){let t,l,n=e[0].l1&&Kp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Kp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Kp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.phase)!=null?i:"Phase",unit:"W",importColorFn:gf,exportColorFn:Is,maxImport:(e[0].mf?e[0].mf:32)*230,maxExport:e[0].om?e[9]?e[0].om*1e3/Math.sqrt(3):e[0].om*1e3:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.p,l2i:e[0].l2.p,l3i:e[0].l3.p,l1e:e[0].l1.q,l2e:e[0].l2.q,l3e:e[0].l3.q}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.phase)!=null?a:"Phase"),f&1&&(r.maxImport=(o[0].mf?o[0].mf:32)*230),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om*1e3/Math.sqrt(3):o[0].om*1e3:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.p),f&1&&(r.l2i=o[0].l2.p),f&1&&(r.l3i=o[0].l3.p),f&1&&(r.l1e=o[0].l1.q),f&1&&(r.l2e=o[0].l2.q),f&1&&(r.l3e=o[0].l3.q),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Yp(e){let t,l,n=e[0].l1&&Qp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Q(n,1)):(n=Qp(i),n.c(),Q(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Q(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Qp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.pf)!=null?i:"Pf",importColorFn:Is,exportColorFn:Is,maxImport:1,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.f,l2i:e[0].l2.f,l3i:e[0].l3.f}}),{c(){Ne(t.$$.fragment)},m(o,f){Se(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.pf)!=null?a:"Pf"),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.f),f&1&&(r.l2i=o[0].l2.f),f&1&&(r.l3i=o[0].l3.f),t.$set(r)},i(o){l||(Q(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ce(t,o)}}}function Xp(e){let t,l,n;return l=new Yb({props:{importInstant:e[0].ri,exportInstant:e[0].re,importTotal:e[0].ric,exportTotal:e[0].rec}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o&1&&(f.importInstant=i[0].ri),o&1&&(f.exportInstant=i[0].re),o&1&&(f.importTotal=i[0].ric),o&1&&(f.exportTotal=i[0].rec),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function Zp(e){let t,l,n;return l=new $b({props:{sysinfo:e[1],data:e[0].ea,currency:e[0].pc,hasExport:e[0].om>0||e[0].e>0}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o&2&&(f.sysinfo=i[1]),o&1&&(f.data=i[0].ea),o&1&&(f.currency=i[0].pc),o&1&&(f.hasExport=i[0].om>0||i[0].e>0),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function Jp(e){var i,o;let t,l,n;return l=new p4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.tariffpeak)!=null?o:"Tariff peaks"}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt h-64")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.tariffpeak)!=null?_:"Tariff peaks"),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function $p(e){var i,o;let t,l,n;return l=new h4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.realtime)!=null?o:"Real time"}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.realtime)!=null?_:"Real time"),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function xp(e){var i,o;let t,l,n;return l=new t4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.price)!=null?o:"Price",json:e[2],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.price)!=null?_:"Price"),r&4&&(c.json=f[2]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function e2(e){var i,o;let t,l,n;return l=new i4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.day)!=null?o:"24 hours",json:e[3],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.day)!=null?_:"24 hours"),r&8&&(c.json=f[3]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function t2(e){var i,o;let t,l,n;return l=new a4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.month)!=null?o:"{0} days",json:e[4],sysinfo:e[1]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.month)!=null?_:"{0} days"),r&16&&(c.json=f[4]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function l2(e){var i,o;let t,l,n;return l=new r4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.temperature)!=null?o:"Temperature",json:e[5]}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Se(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.temperature)!=null?_:"Temperature"),r&32&&(c.json=f[5]),l.$set(c)},i(f){n||(Q(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ce(l)}}}function k4(e){let t,l=Ot(e[1].ui.i,e[0].i),n,i=Ot(e[1].ui.e,e[0].om||e[0].e>0),o,f=Ot(e[1].ui.v,e[0].l1&&(e[0].l1.u>100||e[0].l2.u>100||e[0].l3.u>100)),r,c=Ot(e[1].ui.a,e[0].l1&&(e[0].l1.i>.01||e[0].l2.i>.01||e[0].l3.i>.01)),a,_=Ot(e[1].ui.h,e[0].l1&&(e[0].l1.p>.01||e[0].l2.p>.01||e[0].l3.p>.01||e[0].l1.q>.01||e[0].l2.q>.01||e[0].l3.q>.01)),p,v=Ot(e[1].ui.f,e[0].l1&&(e[0].l1.f>.01||e[0].l2.f>.01||e[0].l3.f>.01)),d,h=Ot(e[1].ui.r,e[0].ri>0||e[0].re>0||e[0].ric>0||e[0].rec>0),g,M=Ot(e[1].ui.c,e[0].ea),A,I=Ot(e[1].ui.t,e[0].pr&&(e[0].pr.startsWith("NO")||e[0].pr.startsWith("10YNO")||e[0].pr.startsWith("10Y1001A1001A4"))),q,L=Ot(e[1].ui.l),O,U=Ot(e[1].ui.p,e[0].pe&&!Number.isNaN(e[0].p)),E,B=Ot(e[1].ui.d,e[3]),z,W=Ot(e[1].ui.m,e[4]),F,R=Ot(e[1].ui.s,e[0].t&&e[0].t!=-127&&e[5].c>1),K,y=l&&jp(e),H=i&&Hp(e),Y=f&&yp(e),X=c&&Wp(e),J=_&&Vp(e),$=v&&Yp(e),ce=h&&Xp(e),ie=M&&Zp(e),oe=I&&Jp(e),ae=L&&$p(e),se=U&&xp(e),x=B&&e2(e),me=W&&t2(e),pe=R&&l2(e);return{c(){t=m("div"),y&&y.c(),n=b(),H&&H.c(),o=b(),Y&&Y.c(),r=b(),X&&X.c(),a=b(),J&&J.c(),p=b(),$&&$.c(),d=b(),ce&&ce.c(),g=b(),ie&&ie.c(),A=b(),oe&&oe.c(),q=b(),ae&&ae.c(),O=b(),se&&se.c(),E=b(),x&&x.c(),z=b(),me&&me.c(),F=b(),pe&&pe.c(),u(t,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(V,Z){P(V,t,Z),y&&y.m(t,null),s(t,n),H&&H.m(t,null),s(t,o),Y&&Y.m(t,null),s(t,r),X&&X.m(t,null),s(t,a),J&&J.m(t,null),s(t,p),$&&$.m(t,null),s(t,d),ce&&ce.m(t,null),s(t,g),ie&&ie.m(t,null),s(t,A),oe&&oe.m(t,null),s(t,q),ae&&ae.m(t,null),s(t,O),se&&se.m(t,null),s(t,E),x&&x.m(t,null),s(t,z),me&&me.m(t,null),s(t,F),pe&&pe.m(t,null),K=!0},p(V,[Z]){Z&3&&(l=Ot(V[1].ui.i,V[0].i)),l?y?(y.p(V,Z),Z&3&&Q(y,1)):(y=jp(V),y.c(),Q(y,1),y.m(t,n)):y&&(pt(),ee(y,1,1,()=>{y=null}),dt()),Z&3&&(i=Ot(V[1].ui.e,V[0].om||V[0].e>0)),i?H?(H.p(V,Z),Z&3&&Q(H,1)):(H=Hp(V),H.c(),Q(H,1),H.m(t,o)):H&&(pt(),ee(H,1,1,()=>{H=null}),dt()),Z&3&&(f=Ot(V[1].ui.v,V[0].l1&&(V[0].l1.u>100||V[0].l2.u>100||V[0].l3.u>100))),f?Y?(Y.p(V,Z),Z&3&&Q(Y,1)):(Y=yp(V),Y.c(),Q(Y,1),Y.m(t,r)):Y&&(pt(),ee(Y,1,1,()=>{Y=null}),dt()),Z&3&&(c=Ot(V[1].ui.a,V[0].l1&&(V[0].l1.i>.01||V[0].l2.i>.01||V[0].l3.i>.01))),c?X?(X.p(V,Z),Z&3&&Q(X,1)):(X=Wp(V),X.c(),Q(X,1),X.m(t,a)):X&&(pt(),ee(X,1,1,()=>{X=null}),dt()),Z&3&&(_=Ot(V[1].ui.h,V[0].l1&&(V[0].l1.p>.01||V[0].l2.p>.01||V[0].l3.p>.01||V[0].l1.q>.01||V[0].l2.q>.01||V[0].l3.q>.01))),_?J?(J.p(V,Z),Z&3&&Q(J,1)):(J=Vp(V),J.c(),Q(J,1),J.m(t,p)):J&&(pt(),ee(J,1,1,()=>{J=null}),dt()),Z&3&&(v=Ot(V[1].ui.f,V[0].l1&&(V[0].l1.f>.01||V[0].l2.f>.01||V[0].l3.f>.01))),v?$?($.p(V,Z),Z&3&&Q($,1)):($=Yp(V),$.c(),Q($,1),$.m(t,d)):$&&(pt(),ee($,1,1,()=>{$=null}),dt()),Z&3&&(h=Ot(V[1].ui.r,V[0].ri>0||V[0].re>0||V[0].ric>0||V[0].rec>0)),h?ce?(ce.p(V,Z),Z&3&&Q(ce,1)):(ce=Xp(V),ce.c(),Q(ce,1),ce.m(t,g)):ce&&(pt(),ee(ce,1,1,()=>{ce=null}),dt()),Z&3&&(M=Ot(V[1].ui.c,V[0].ea)),M?ie?(ie.p(V,Z),Z&3&&Q(ie,1)):(ie=Zp(V),ie.c(),Q(ie,1),ie.m(t,A)):ie&&(pt(),ee(ie,1,1,()=>{ie=null}),dt()),Z&3&&(I=Ot(V[1].ui.t,V[0].pr&&(V[0].pr.startsWith("NO")||V[0].pr.startsWith("10YNO")||V[0].pr.startsWith("10Y1001A1001A4")))),I?oe?(oe.p(V,Z),Z&3&&Q(oe,1)):(oe=Jp(V),oe.c(),Q(oe,1),oe.m(t,q)):oe&&(pt(),ee(oe,1,1,()=>{oe=null}),dt()),Z&2&&(L=Ot(V[1].ui.l)),L?ae?(ae.p(V,Z),Z&2&&Q(ae,1)):(ae=$p(V),ae.c(),Q(ae,1),ae.m(t,O)):ae&&(pt(),ee(ae,1,1,()=>{ae=null}),dt()),Z&3&&(U=Ot(V[1].ui.p,V[0].pe&&!Number.isNaN(V[0].p))),U?se?(se.p(V,Z),Z&3&&Q(se,1)):(se=xp(V),se.c(),Q(se,1),se.m(t,E)):se&&(pt(),ee(se,1,1,()=>{se=null}),dt()),Z&10&&(B=Ot(V[1].ui.d,V[3])),B?x?(x.p(V,Z),Z&10&&Q(x,1)):(x=e2(V),x.c(),Q(x,1),x.m(t,z)):x&&(pt(),ee(x,1,1,()=>{x=null}),dt()),Z&18&&(W=Ot(V[1].ui.m,V[4])),W?me?(me.p(V,Z),Z&18&&Q(me,1)):(me=t2(V),me.c(),Q(me,1),me.m(t,F)):me&&(pt(),ee(me,1,1,()=>{me=null}),dt()),Z&35&&(R=Ot(V[1].ui.s,V[0].t&&V[0].t!=-127&&V[5].c>1)),R?pe?(pe.p(V,Z),Z&35&&Q(pe,1)):(pe=l2(V),pe.c(),Q(pe,1),pe.m(t,null)):pe&&(pt(),ee(pe,1,1,()=>{pe=null}),dt())},i(V){K||(Q(y),Q(H),Q(Y),Q(X),Q(J),Q($),Q(ce),Q(ie),Q(oe),Q(ae),Q(se),Q(x),Q(me),Q(pe),K=!0)},o(V){ee(y),ee(H),ee(Y),ee(X),ee(J),ee($),ee(ce),ee(ie),ee(oe),ee(ae),ee(se),ee(x),ee(me),ee(pe),K=!1},d(V){V&&T(t),y&&y.d(),H&&H.d(),Y&&Y.d(),X&&X.d(),J&&J.d(),$&&$.d(),ce&&ce.d(),ie&&ie.d(),oe&&oe.d(),ae&&ae.d(),se&&se.d(),x&&x.d(),me&&me.d(),pe&&pe.d()}}}function w4(e,t,l){let{data:n={}}=t,{sysinfo:i={}}=t,o={},f={},r={},c={};wf.subscribe(d=>{l(2,o=d)}),bv.subscribe(d=>{l(3,f=d)}),gv.subscribe(d=>{l(4,r=d)}),wv.subscribe(d=>{l(5,c=d)});let a={};Ml.subscribe(d=>{l(6,a=d)});let _,p,v;return e.$$set=d=>{"data"in d&&l(0,n=d.data),"sysinfo"in d&&l(1,i=d.sysinfo)},e.$$.update=()=>{var d,h,g;e.$$.dirty&1&&(l(7,_=gl((n==null?void 0:n.ic)*1e3,"Wh")),l(8,p=gl((n==null?void 0:n.ec)*1e3,"Wh")),l(9,v=((d=n==null?void 0:n.l1)==null?void 0:d.u)>100&&((h=n==null?void 0:n.l2)==null?void 0:h.u)>100&&((g=n==null?void 0:n.l3)==null?void 0:g.u)>100))},[n,i,o,f,r,c,a,_,p,v]}class M4 extends mt{constructor(t){super(),_t(this,t,w4,k4,ct,{data:0,sysinfo:1})}}let sf={};const Es=xt(sf);async function S4(){sf=await(await fetch("configuration.json")).json(),Es.set(sf)}let of={};const Dv=xt(of);async function C4(){of=await(await fetch("priceconfig.json")).json(),Dv.set(of)}function n2(e,t,l){const n=e.slice();return n[2]=t[l],n[4]=l,n}function N4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=3,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function T4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=20,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function i2(e){let t;return{c(){t=m("option"),t.textContent="UART2",t.__value=113,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function s2(e){let t,l,n;return{c(){t=m("option"),t.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",t.__value=9,t.value=t.__value,n.__value=16,n.value=n.__value},m(i,o){P(i,t,o),P(i,l,o),P(i,n,o)},d(i){i&&T(t),i&&T(l),i&&T(n)}}}function o2(e){let t;return{c(){t=m("option"),t.textContent="UART1",t.__value=18,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function a2(e){let t,l,n;return{c(){t=m("option"),l=k("GPIO"),n=k(e[4]),t.__value=e[4],t.value=t.__value},m(i,o){P(i,t,o),s(t,l),s(t,n)},d(i){i&&T(t)}}}function f2(e){let t,l=e[4]>1&&!(e[0]=="esp32"&&(e[4]==9||e[4]==16))&&!((e[0]=="esp32s2"||e[0]=="esp32s3")&&e[4]==18)&&!(e[0]=="esp8266"&&(e[4]==3||e[4]==113))&&a2(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,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=a2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&T(t)}}}function P4(e){let t,l,n,i,o;function f(h,g){return h[0]=="esp32c3"?T4:N4}let r=f(e),c=r(e),a=e[0]=="esp8266"&&i2(),_=(e[0]=="esp32"||e[0]=="esp32solo")&&s2(),p=(e[0]=="esp32s2"||e[0]=="esp32s3")&&o2(),v={length:e[1]+1},d=[];for(let h=0;h{"chip"in o&&l(0,n=o.chip)},e.$$.update=()=>{if(e.$$.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 af extends mt{constructor(t){super(),_t(this,t,E4,P4,ct,{chip:0})}}function u2(e){let t,l,n=e[1]&&r2(e);return{c(){t=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(t,"class","z-50"),u(t,"aria-modal","true")},m(i,o){P(i,t,o),s(t,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=r2(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&T(t),n&&n.d()}}}function r2(e){let t,l;return{c(){t=m("div"),l=k(e[1]),u(t,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,t,i),s(t,l)},p(n,i){i&2&&C(l,n[1])},d(n){n&&T(t)}}}function A4(e){let t,l=e[0]&&u2(e);return{c(){l&&l.c(),t=Ut()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=u2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function D4(e,t,l){let{active:n}=t,{message:i}=t;return e.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class kl extends mt{constructor(t){super(),_t(this,t,D4,A4,ct,{active:0,message:1})}}function c2(e,t,l){const n=e.slice();return n[1]=t[l],n}function _2(e){let t,l,n=e[1]+"",i;return{c(){t=m("option"),l=k("Europe/"),i=k(n),t.__value="Europe/"+e[1],t.value=t.__value},m(o,f){P(o,t,f),s(t,l),s(t,i)},p:ze,d(o){o&&T(t)}}}function q4(e){let t,l,n,i=e[0],o=[];for(let f=0;f>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^O.EXPONENT[B._modN(O.LOG[D[w]]+S)]:D[w-1];D[0]=O.EXPONENT[B._modN(O.LOG[D[0]]+S)]}for(S=0;S<=N;S++)D[S]=O.LOG[D[S]]},_checkBadness:function(){var S,w,N,D,j,te=0,le=this._badness,fe=this.buffer,de=this.width;for(j=0;jde*de;)we-=de*de,Pe++;for(te+=Pe*B.N4,D=0;D=le-2&&(S=le-2,j>9&&S--);var fe=S;if(j>9){for(te[fe+2]=0,te[fe+3]=0;fe--;)w=te[fe],te[fe+3]|=255&w<<4,te[fe+2]=w>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[fe+1]=0,te[fe+2]=0;fe--;)w=te[fe],te[fe+2]|=255&w<<4,te[fe+1]=w>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(fe=S+3-(j<10);fe=5&&(N+=B.N1+D[w]-5);for(w=3;wS||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(N+=B.N3);return N},_finish:function(){this._stringBuffer=this.buffer.slice();var S,w,N=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),S=this._checkBadness(),S>=1)D&1&&(j[te-1-w+te*8]=1,w<6?j[8+te*w]=1:j[8+te*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(j[8+te*(te-7+w)]=1,w?j[6-w+te*8]=1:j[7+te*8]=1)},_interleaveBlocks:function(){var S,w,N=this._dataBlock,D=this._ecc,j=this._eccBlock,te=0,le=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,qe=this._stringBuffer;for(S=0;S1)for(S=A.BLOCK[D],N=j-7;;){for(w=j-7;w>S-3&&(this._addAlignment(w,N),!(w6)for(S=E.BLOCK[te-7],w=17,N=0;N<6;N++)for(D=0;D<3;D++,w--)1&(w>11?te>>w-12:S>>w)?(j[5-N+le*(2-D+le-11)]=1,j[2-D+le-11+le*(5-N)]=1):(this._setMask(5-N,2-D+le-11),this._setMask(2-D+le-11,5-N))},_isMasked:function(S,w){var N=B._getMaskBit(S,w);return this._mask[N]===1},_pack:function(){var S,w,N,D=1,j=1,te=this.width,le=te-1,fe=te-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(N=S,S=w,w=N),N=w,N+=w*w,N>>=1,N+=S,N},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),z=B,W=d.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),F=W,R=p.extend(function(S,w,N,D){this.name=S,this.modifiable=Boolean(w),this.defaultValue=N,this._valueTransformer=D},{transform:function(S){var w=this._valueTransformer;return typeof w=="function"?w(S,this):S}}),K=R,y=p.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,w){return Object.prototype.hasOwnProperty.call(S,w)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),H=y,Y=p.extend(function(S){this.options={},S.forEach(function(w){this.options[w.name]=w},this)},{exists:function(S){return this.options[S]!=null},get:function(S,w){return Y._get(this.options[S],w)},getAll:function(S){var w,N=this.options,D={};for(w in N)H.hasOwn(N,w)&&(D[w]=Y._get(N[w],S));return D},init:function(S,w,N){typeof N!="function"&&(N=H.noop);var D,j;for(D in this.options)H.hasOwn(this.options,D)&&(j=this.options[D],Y._set(j,j.defaultValue,w),Y._createAccessor(j,w,N));this._setAll(S,w,!0)},set:function(S,w,N){return this._set(S,w,N)},setAll:function(S,w){return this._setAll(S,w)},_set:function(S,w,N,D){var j=this.options[S];if(!j)throw new Error("Invalid option: "+S);if(!j.modifiable&&!D)throw new Error("Option cannot be modified: "+S);return Y._set(j,w,N)},_setAll:function(S,w,N){if(!S)return!1;var D,j=!1;for(D in S)H.hasOwn(S,D)&&this._set(D,S[D],w,N)&&(j=!0);return j}},{_createAccessor:function(S,w,N){var D={get:function(){return Y._get(S,w)}};S.modifiable&&(D.set=function(j){Y._set(S,j,w)&&N(j,S)}),Object.defineProperty(w,S.name,D)},_get:function(S,w){return w["_"+S.name]},_set:function(S,w,N){var D="_"+S.name,j=N[D],te=S.transform(w!=null?w:S.defaultValue);return N[D]=te,te!==j}}),X=Y,J=p.extend(function(){this._services={}},{getService:function(S){var w=this._services[S];if(!w)throw new Error("Service is not being managed with name: "+S);return w},setService:function(S,w){if(this._services[S])throw new Error("Service is already managed with name: "+S);w&&(this._services[S]=w)}}),$=J,ce=new X([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,H.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,H.abs),new K("level",!0,"L",H.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,H.abs),new K("size",!0,100,H.abs),new K("value",!0,"")]),ie=new $,oe=p.extend(function(S){ce.init(S,this,this.update.bind(this));var w=ce.get("element",this),N=ie.getService("element"),D=w&&N.isCanvas(w)?w:N.createCanvas(),j=w&&N.isImage(w)?w:N.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new F(this,j,j===w),this.update()},{get:function(){return ce.getAll(this)},set:function(S){ce.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new z({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){ie.setService(S.getName(),S)}});Object.defineProperties(oe.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ae=oe,se=ae,x=p.extend({getName:function(){}}),me=x,pe=me.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),V=pe,Z=V.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),ge=Z;se.use(new ge);var ve=se;return ve})})(Ov);const F4=Ov.exports;function B4(e){let t,l;return{c(){t=m("img"),jo(t.src,l=e[2])||u(t,"src",l),u(t,"alt",e[0]),u(t,"class",e[1])},m(n,i){P(n,t,i)},p(n,[i]){i&4&&!jo(t.src,l=n[2])&&u(t,"src",l),i&1&&u(t,"alt",n[0]),i&2&&u(t,"class",n[1])},i:ze,o:ze,d(n){n&&T(t)}}}function U4(e,t,l){const n=new F4;let{errorCorrection:i="L"}=t,{background:o="#fff"}=t,{color:f="#000"}=t,{size:r="200"}=t,{value:c=""}=t,{padding:a=0}=t,{className:_="qrcode"}=t,p="";function v(){n.set({background:o,foreground:f,level:i,padding:a,size:r,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return Ud(()=>{v()}),e.$$set=d=>{"errorCorrection"in d&&l(3,i=d.errorCorrection),"background"in d&&l(4,o=d.background),"color"in d&&l(5,f=d.color),"size"in d&&l(6,r=d.size),"value"in d&&l(0,c=d.value),"padding"in d&&l(7,a=d.padding),"className"in d&&l(1,_=d.className)},e.$$.update=()=>{e.$$.dirty&1&&c&&v()},[c,_,p,i,o,f,r,a]}class j4 extends mt{constructor(t){super(),_t(this,t,U4,B4,ct,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function m2(e,t,l){const n=e.slice();return n[107]=t[l],n}function p2(e,t,l){const n=e.slice();return n[110]=t[l],n[111]=t,n[112]=l,n}function d2(e,t,l){const n=e.slice();return n[113]=t[l],n[114]=t,n[115]=l,n}function H4(e,t,l){const n=e.slice();return n[116]=t[l],n}function y4(e,t,l){const n=e.slice();return n[119]=t[l],n}function v2(e){let t,l,n,i,o;return{c(){t=m("option"),t.textContent="NO1 with support",l=m("option"),l.textContent="NO2 with support",n=m("option"),n.textContent="NO3 with support",i=m("option"),i.textContent="NO4 with support",o=m("option"),o.textContent="NO5 with support",t.__value="NO1S",t.value=t.__value,l.__value="NO2S",l.value=l.__value,n.__value="NO3S",n.value=n.__value,i.__value="NO4S",i.value=i.__value,o.__value="NO5S",o.value=o.__value},m(f,r){P(f,t,r),P(f,l,r),P(f,n,r),P(f,i,r),P(f,o,r)},d(f){f&&T(t),f&&T(l),f&&T(n),f&&T(i),f&&T(o)}}}function z4(e){let t,l;return{c(){t=m("option"),l=k(e[119]),t.__value=e[119],t.value=t.__value},m(n,i){P(n,t,i),s(t,l)},p:ze,d(n){n&&T(t)}}}function W4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.price)==null?void 0:i.conf)!=null?o:"Configure")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.conf)!=null?_:"Configure")+"")&&C(l,t)},d(f){f&&T(l)}}}function h2(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=(c=(r=(f=e[1].conf)==null?void 0:f.price)==null?void 0:r.api_key_placeholder)!=null?c:"")},m(f,r){P(f,t,r),P(f,l,r),be(l,e[4].p.t),i||(o=re(l,"input",e[24]),i=!0)},p(f,r){var c,a,_;r[0]&2&&n!==(n=(_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.api_key_placeholder)!=null?_:"")&&u(l,"placeholder",n),r[0]&16&&l.value!==f[4].p.t&&be(l,f[4].p.t)},d(f){f&&T(t),f&&T(l),i=!1,o()}}}function b2(e){var M,A,I,q,L,O,U,E;let t,l=((q=(I=(A=(M=e[1].conf)==null?void 0:M.general)==null?void 0:A.security)==null?void 0:I.username)!=null?q:"Username")+"",n,i,o,f,r,c,a=((E=(U=(O=(L=e[1].conf)==null?void 0:L.general)==null?void 0:O.security)==null?void 0:U.password)!=null?E:"Password")+"",_,p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),u(f,"name","gu"),u(f,"type","text"),u(f,"class","in-s"),u(f,"maxlength","36"),u(t,"class","my-1"),u(d,"name","gp"),u(d,"type","password"),u(d,"class","in-s"),u(d,"maxlength","36"),u(c,"class","my-1")},m(B,z){P(B,t,z),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].g.u),P(B,r,z),P(B,c,z),s(c,_),s(c,p),s(c,v),s(c,d),be(d,e[4].g.p),h||(g=[re(f,"input",e[26]),re(d,"input",e[27])],h=!0)},p(B,z){var W,F,R,K,y,H,Y,X;z[0]&2&&l!==(l=((K=(R=(F=(W=B[1].conf)==null?void 0:W.general)==null?void 0:F.security)==null?void 0:R.username)!=null?K:"Username")+"")&&C(n,l),z[0]&16&&f.value!==B[4].g.u&&be(f,B[4].g.u),z[0]&2&&a!==(a=((X=(Y=(H=(y=B[1].conf)==null?void 0:y.general)==null?void 0:H.security)==null?void 0:Y.password)!=null?X:"Password")+"")&&C(_,a),z[0]&16&&d.value!==B[4].g.p&&be(d,B[4].g.p)},d(B){B&&T(t),B&&T(r),B&&T(c),h=!1,Et(g)}}}function G4(e){var ae,se,x,me,pe,V,Z,ge,ve;let t,l,n=((x=(se=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:se.buffer)!=null?x:"Buffer size")+"",i,o,f,r=((V=(pe=(me=e[1].conf)==null?void 0:me.meter)==null?void 0:pe.serial)!=null?V:"Serial conf.")+"",c,a,_,p,v,d=((ve=(ge=(Z=e[1].conf)==null?void 0:Z.meter)==null?void 0:ge.inverted)!=null?ve:"inverted")+"",h,g,M,A,I,q,L,O,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie=[3,12,24,48,96,192,384,576,1152],oe=[];for(let S=0;S<9;S+=1)oe[S]=K4(H4(e,ie,S));return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("span"),c=k(r),a=b(),_=m("label"),p=m("input"),v=b(),h=k(d),g=b(),M=m("div"),A=m("select"),I=m("option"),q=k("Autodetect");for(let S=0;S<9;S+=1)oe[S].c();O=b(),U=m("select"),E=m("option"),B=k("-"),W=m("option"),W.textContent="7N1",F=m("option"),F.textContent="8N1",R=m("option"),R.textContent="8N2",K=m("option"),K.textContent="7E1",y=m("option"),y.textContent="8E1",Y=b(),X=m("input"),u(l,"class","float-right"),u(p,"name","mi"),p.__value="true",p.value=p.__value,u(p,"type","checkbox"),u(p,"class","rounded mb-1"),u(_,"class","mt-2 ml-3 whitespace-nowrap"),I.__value=0,I.value=I.__value,I.disabled=L=e[4].m.b!=0,u(A,"name","mb"),u(A,"class","in-f tr w-1/2"),e[4].m.b===void 0&&Ct(()=>e[32].call(A)),E.__value=0,E.value=E.__value,E.disabled=z=e[4].m.b!=0,W.__value=2,W.value=W.__value,F.__value=3,F.value=F.__value,R.__value=7,R.value=R.__value,K.__value=10,K.value=K.__value,y.__value=11,y.value=y.__value,u(U,"name","mp"),u(U,"class","in-m"),U.disabled=H=e[4].m.b==0,e[4].m.p===void 0&&Ct(()=>e[33].call(U)),u(X,"name","ms"),u(X,"type","number"),u(X,"min",64),u(X,"max",J=e[0].chip=="esp8266"?e[4].i.h.p==3||e[4].i.h.p==113?512:128:4096),u(X,"step",64),u(X,"class","in-l tr w-1/2"),u(M,"class","flex w-full"),u(t,"class","my-1")},m(S,w){P(S,t,w),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(t,a),s(t,_),s(_,p),p.checked=e[4].m.i,s(_,v),s(_,h),s(t,g),s(t,M),s(M,A),s(A,I),s(I,q);for(let N=0;N<9;N+=1)oe[N]&&oe[N].m(A,null);Je(A,e[4].m.b,!0),s(M,O),s(M,U),s(U,E),s(E,B),s(U,W),s(U,F),s(U,R),s(U,K),s(U,y),Je(U,e[4].m.p,!0),s(M,Y),s(M,X),be(X,e[4].m.s),$||(ce=[re(p,"change",e[31]),re(A,"change",e[32]),re(U,"change",e[33]),re(X,"input",e[34])],$=!0)},p(S,w){var N,D,j,te,le,fe,de,qe,Pe;w[0]&2&&n!==(n=((j=(D=(N=S[1].conf)==null?void 0:N.meter)==null?void 0:D.buffer)!=null?j:"Buffer size")+"")&&C(i,n),w[0]&2&&r!==(r=((fe=(le=(te=S[1].conf)==null?void 0:te.meter)==null?void 0:le.serial)!=null?fe:"Serial conf.")+"")&&C(c,r),w[0]&16&&(p.checked=S[4].m.i),w[0]&2&&d!==(d=((Pe=(qe=(de=S[1].conf)==null?void 0:de.meter)==null?void 0:qe.inverted)!=null?Pe:"inverted")+"")&&C(h,d),w[0]&16&&L!==(L=S[4].m.b!=0)&&(I.disabled=L),w[0]&16&&Je(A,S[4].m.b),w[0]&16&&z!==(z=S[4].m.b!=0)&&(E.disabled=z),w[0]&16&&H!==(H=S[4].m.b==0)&&(U.disabled=H),w[0]&16&&Je(U,S[4].m.p),w[0]&17&&J!==(J=S[0].chip=="esp8266"?S[4].i.h.p==3||S[4].i.h.p==113?512:128:4096)&&u(X,"max",J),w[0]&16&&Ze(X.value)!==S[4].m.s&&be(X,S[4].m.s)},d(S){S&&T(t),Xt(oe,S),$=!1,Et(ce)}}}function V4(e){var a,_,p;let t,l,n=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.pulses)!=null?p:"Pulses per kWh")+"",i,o,f,r,c;return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("input"),u(f,"name","mb"),u(f,"class","in-s tr"),u(f,"type","number"),u(f,"min",1),u(f,"max",3600),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),be(f,e[4].m.b),r||(c=re(f,"input",e[30]),r=!0)},p(v,d){var h,g,M;d[0]&2&&n!==(n=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.pulses)!=null?M:"Pulses per kWh")+"")&&C(i,n),d[0]&16&&Ze(f.value)!==v[4].m.b&&be(f,v[4].m.b)},d(v){v&&T(t),r=!1,c()}}}function K4(e){let t,l=e[116]*100+"",n;return{c(){t=m("option"),n=k(l),t.__value=e[116]*100,t.value=t.__value},m(i,o){P(i,t,o),s(t,n)},p:ze,d(i){i&&T(t)}}}function g2(e){let t,l,n,i;return{c(){t=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,f){P(o,t,f),P(o,l,f),be(l,e[4].m.e.k),n||(i=re(l,"input",e[39]),n=!0)},p(o,f){f[0]&16&&l.value!==o[4].m.e.k&&be(l,o[4].m.e.k)},d(o){o&&T(t),o&&T(l),n=!1,i()}}}function k2(e){var a,_,p;let t,l=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.authkey)!=null?p:"Authentication key")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","mea"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].m.e.a),r||(c=re(f,"input",e[40]),r=!0)},p(v,d){var h,g,M;d[0]&2&&l!==(l=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.authkey)!=null?M:"Authentication key")+"")&&C(n,l),d[0]&16&&f.value!==v[4].m.e.a&&be(f,v[4].m.e.a)},d(v){v&&T(t),r=!1,c()}}}function w2(e){var H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge;let t,l,n=((J=(X=(Y=(H=e[1].conf)==null?void 0:H.meter)==null?void 0:Y.multipliers)==null?void 0:X.watt)!=null?J:"Watt")+"",i,o,f,r,c,a,_=((oe=(ie=(ce=($=e[1].conf)==null?void 0:$.meter)==null?void 0:ce.multipliers)==null?void 0:ie.volt)!=null?oe:"Volt")+"",p,v,d,h,g,M,A=((me=(x=(se=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:se.multipliers)==null?void 0:x.amp)!=null?me:"Amp")+"",I,q,L,O,U,E,B=((ge=(Z=(V=(pe=e[1].conf)==null?void 0:pe.meter)==null?void 0:V.multipliers)==null?void 0:Z.kwh)!=null?ge:"kWh")+"",z,W,F,R,K,y;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),g=b(),M=m("div"),I=k(A),q=m("br"),L=b(),O=m("input"),U=b(),E=m("div"),z=k(B),W=m("br"),F=b(),R=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(h,"name","mmv"),u(h,"type","number"),u(h,"min","0.00"),u(h,"max","1000"),u(h,"step","0.001"),u(h,"class","in-m tr w-full"),u(a,"class","w-1/4"),u(O,"name","mma"),u(O,"type","number"),u(O,"min","0.00"),u(O,"max","1000"),u(O,"step","0.001"),u(O,"class","in-m tr w-full"),u(M,"class","w-1/4"),u(R,"name","mmc"),u(R,"type","number"),u(R,"min","0.00"),u(R,"max","1000"),u(R,"step","0.001"),u(R,"class","in-l tr w-full"),u(E,"class","w-1/4"),u(t,"class","flex my-1")},m(ve,S){P(ve,t,S),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),be(r,e[4].m.m.w),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h),be(h,e[4].m.m.v),s(t,g),s(t,M),s(M,I),s(M,q),s(M,L),s(M,O),be(O,e[4].m.m.a),s(t,U),s(t,E),s(E,z),s(E,W),s(E,F),s(E,R),be(R,e[4].m.m.c),K||(y=[re(r,"input",e[42]),re(h,"input",e[43]),re(O,"input",e[44]),re(R,"input",e[45])],K=!0)},p(ve,S){var w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He;S[0]&2&&n!==(n=((j=(D=(N=(w=ve[1].conf)==null?void 0:w.meter)==null?void 0:N.multipliers)==null?void 0:D.watt)!=null?j:"Watt")+"")&&C(i,n),S[0]&16&&Ze(r.value)!==ve[4].m.m.w&&be(r,ve[4].m.m.w),S[0]&2&&_!==(_=((de=(fe=(le=(te=ve[1].conf)==null?void 0:te.meter)==null?void 0:le.multipliers)==null?void 0:fe.volt)!=null?de:"Volt")+"")&&C(p,_),S[0]&16&&Ze(h.value)!==ve[4].m.m.v&&be(h,ve[4].m.m.v),S[0]&2&&A!==(A=((Fe=(we=(Pe=(qe=ve[1].conf)==null?void 0:qe.meter)==null?void 0:Pe.multipliers)==null?void 0:we.amp)!=null?Fe:"Amp")+"")&&C(I,A),S[0]&16&&Ze(O.value)!==ve[4].m.m.a&&be(O,ve[4].m.m.a),S[0]&2&&B!==(B=((He=(De=(ke=(Ae=ve[1].conf)==null?void 0:Ae.meter)==null?void 0:ke.multipliers)==null?void 0:De.kwh)!=null?He:"kWh")+"")&&C(z,B),S[0]&16&&Ze(R.value)!==ve[4].m.m.c&&be(R,ve[4].m.m.c)},d(ve){ve&&T(t),K=!1,Et(y)}}}function M2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function S2(e){var te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt,At,Pt;let t,l=((fe=(le=(te=e[1].conf)==null?void 0:te.connection)==null?void 0:le.ssid)!=null?fe:"SSID")+"",n,i,o,f,r,c,a=((Pe=(qe=(de=e[1].conf)==null?void 0:de.connection)==null?void 0:qe.psk)!=null?Pe:"Password")+"",_,p,v,d,h,g,M,A=((ke=(Ae=(Fe=(we=e[1].conf)==null?void 0:we.connection)==null?void 0:Fe.ps)==null?void 0:Ae.title)!=null?ke:"Power saving")+"",I,q,L,O,U,E=((je=(Oe=(He=(De=e[1].conf)==null?void 0:De.connection)==null?void 0:He.ps)==null?void 0:Oe.default)!=null?je:"Default")+"",B,z,W=((xe=($e=(We=(Ye=e[1].conf)==null?void 0:Ye.connection)==null?void 0:We.ps)==null?void 0:$e.off)!=null?xe:"Off")+"",F,R,K=((Ie=(ue=(Te=(tt=e[1].conf)==null?void 0:tt.connection)==null?void 0:Te.ps)==null?void 0:ue.min)!=null?Ie:"Min")+"",y,H,Y=((st=(wt=(lt=(kt=e[1].conf)==null?void 0:kt.connection)==null?void 0:lt.ps)==null?void 0:wt.max)!=null?st:"Max")+"",X,J,$,ce=((Nt=(et=(ot=e[1].conf)==null?void 0:ot.connection)==null?void 0:et.pwr)!=null?Nt:"Power")+"",ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w=((Pt=(At=(gt=e[1].conf)==null?void 0:gt.connection)==null?void 0:At.tick_11b)!=null?Pt:"802.11b")+"",N,D,j;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),h=b(),g=m("div"),M=m("div"),I=k(A),q=m("br"),L=b(),O=m("select"),U=m("option"),B=k(E),z=m("option"),F=k(W),R=m("option"),y=k(K),H=m("option"),X=k(Y),J=b(),$=m("div"),ie=k(ce),oe=m("br"),ae=b(),se=m("div"),x=m("input"),me=b(),pe=m("span"),pe.textContent="dBm",V=b(),Z=m("div"),ge=m("label"),ve=m("input"),S=b(),N=k(w),u(f,"name","ws"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(d,"name","wp"),u(d,"type","password"),u(d,"class","in-s"),u(c,"class","my-1"),U.__value=255,U.value=U.__value,z.__value=0,z.value=z.__value,R.__value=1,R.value=R.__value,H.__value=2,H.value=H.__value,u(O,"name","wz"),u(O,"class","in-s"),e[4].w.z===void 0&&Ct(()=>e[49].call(O)),u(M,"class","w-1/2"),u(x,"name","ww"),u(x,"type","number"),u(x,"min","0"),u(x,"max","20.5"),u(x,"step","0.5"),u(x,"class","in-f tr w-full"),u(pe,"class","in-post"),u(se,"class","flex"),u($,"class","ml-2 w-1/2"),u(g,"class","my-1 flex"),u(ve,"type","checkbox"),u(ve,"name","wb"),ve.__value="true",ve.value=ve.__value,u(ve,"class","rounded mb-1"),u(Z,"class","my-3")},m(Be,ye){P(Be,t,ye),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].w.s),P(Be,r,ye),P(Be,c,ye),s(c,_),s(c,p),s(c,v),s(c,d),be(d,e[4].w.p),P(Be,h,ye),P(Be,g,ye),s(g,M),s(M,I),s(M,q),s(M,L),s(M,O),s(O,U),s(U,B),s(O,z),s(z,F),s(O,R),s(R,y),s(O,H),s(H,X),Je(O,e[4].w.z,!0),s(g,J),s(g,$),s($,ie),s($,oe),s($,ae),s($,se),s(se,x),be(x,e[4].w.w),s(se,me),s(se,pe),P(Be,V,ye),P(Be,Z,ye),s(Z,ge),s(ge,ve),ve.checked=e[4].w.b,s(ge,S),s(ge,N),D||(j=[re(f,"input",e[47]),re(d,"input",e[48]),re(O,"change",e[49]),re(x,"input",e[50]),re(ve,"change",e[51])],D=!0)},p(Be,ye){var It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le,St,ut,Yt,ll,fl;ye[0]&2&&l!==(l=((nt=(vt=(It=Be[1].conf)==null?void 0:It.connection)==null?void 0:vt.ssid)!=null?nt:"SSID")+"")&&C(n,l),ye[0]&16&&f.value!==Be[4].w.s&&be(f,Be[4].w.s),ye[0]&2&&a!==(a=((at=(it=(Tt=Be[1].conf)==null?void 0:Tt.connection)==null?void 0:it.psk)!=null?at:"Password")+"")&&C(_,a),ye[0]&16&&d.value!==Be[4].w.p&&be(d,Be[4].w.p),ye[0]&2&&A!==(A=((Ht=(Lt=(jt=(rt=Be[1].conf)==null?void 0:rt.connection)==null?void 0:jt.ps)==null?void 0:Lt.title)!=null?Ht:"Power saving")+"")&&C(I,A),ye[0]&2&&E!==(E=((Rt=(Ve=(Me=(yt=Be[1].conf)==null?void 0:yt.connection)==null?void 0:Me.ps)==null?void 0:Ve.default)!=null?Rt:"Default")+"")&&C(B,E),ye[0]&2&&W!==(W=((Kt=(Dt=(zt=(Gt=Be[1].conf)==null?void 0:Gt.connection)==null?void 0:zt.ps)==null?void 0:Dt.off)!=null?Kt:"Off")+"")&&C(F,W),ye[0]&2&&K!==(K=((ft=(Jt=(tl=(Zt=Be[1].conf)==null?void 0:Zt.connection)==null?void 0:tl.ps)==null?void 0:Jt.min)!=null?ft:"Min")+"")&&C(y,K),ye[0]&2&&Y!==(Y=((Ue=(ne=(Ke=(Mt=Be[1].conf)==null?void 0:Mt.connection)==null?void 0:Ke.ps)==null?void 0:ne.max)!=null?Ue:"Max")+"")&&C(X,Y),ye[0]&16&&Je(O,Be[4].w.z),ye[0]&2&&ce!==(ce=((ut=(St=(Le=Be[1].conf)==null?void 0:Le.connection)==null?void 0:St.pwr)!=null?ut:"Power")+"")&&C(ie,ce),ye[0]&16&&Ze(x.value)!==Be[4].w.w&&be(x,Be[4].w.w),ye[0]&16&&(ve.checked=Be[4].w.b),ye[0]&2&&w!==(w=((fl=(ll=(Yt=Be[1].conf)==null?void 0:Yt.connection)==null?void 0:ll.tick_11b)!=null?fl:"802.11b")+"")&&C(N,w)},d(Be){Be&&T(t),Be&&T(r),Be&&T(c),Be&&T(h),Be&&T(g),Be&&T(V),Be&&T(Z),D=!1,Et(j)}}}function C2(e){var q,L,O,U,E,B;let t,l=((O=(L=(q=e[1].conf)==null?void 0:q.network)==null?void 0:L.gw)!=null?O:"Gateway")+"",n,i,o,f,r,c,a=((B=(E=(U=e[1].conf)==null?void 0:U.network)==null?void 0:E.dns)!=null?B:"DNS")+"",_,p,v,d,h,g,M,A,I;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("div"),h=m("input"),g=b(),M=m("input"),u(f,"name","ng"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(h,"name","nd1"),u(h,"type","text"),u(h,"class","in-f w-full"),u(M,"name","nd2"),u(M,"type","text"),u(M,"class","in-l w-full"),u(d,"class","flex"),u(c,"class","my-1")},m(z,W){P(z,t,W),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].n.g),P(z,r,W),P(z,c,W),s(c,_),s(c,p),s(c,v),s(c,d),s(d,h),be(h,e[4].n.d1),s(d,g),s(d,M),be(M,e[4].n.d2),A||(I=[re(f,"input",e[55]),re(h,"input",e[56]),re(M,"input",e[57])],A=!0)},p(z,W){var F,R,K,y,H,Y;W[0]&2&&l!==(l=((K=(R=(F=z[1].conf)==null?void 0:F.network)==null?void 0:R.gw)!=null?K:"Gateway")+"")&&C(n,l),W[0]&16&&f.value!==z[4].n.g&&be(f,z[4].n.g),W[0]&2&&a!==(a=((Y=(H=(y=z[1].conf)==null?void 0:y.network)==null?void 0:H.dns)!=null?Y:"DNS")+"")&&C(_,a),W[0]&16&&h.value!==z[4].n.d1&&be(h,z[4].n.d1),W[0]&16&&M.value!==z[4].n.d2&&be(M,z[4].n.d2)},d(z){z&&T(t),z&&T(r),z&&T(c),A=!1,Et(I)}}}function N2(e){let t,l,n,i,o;return{c(){t=m("label"),l=m("input"),n=k(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(t,"class","float-right mr-3")},m(f,r){P(f,t,r),s(t,l),l.checked=e[4].q.s.e,s(t,n),i||(o=[re(l,"change",e[62]),re(l,"change",e[16])],i=!0)},p(f,r){r[0]&16&&(l.checked=f[4].q.s.e)},d(f){f&&T(t),i=!1,Et(o)}}}function T2(e){let t,l,n,i,o,f,r,c,a,_,p,v,d;const h=[Q4,Y4],g=[];function M(E,B){return E[4].q.s.c?0:1}n=M(e),i=g[n]=h[n](e);const A=[$4,J4],I=[];function q(E,B){return E[4].q.s.r?0:1}r=q(e),c=I[r]=A[r](e);const L=[lg,tg],O=[];function U(E,B){return E[4].q.s.k?0:1}return p=U(e),v=O[p]=L[p](e),{c(){t=m("div"),l=m("span"),i.c(),o=b(),f=m("span"),c.c(),a=b(),_=m("span"),v.c(),u(l,"class","flex pr-2"),u(f,"class","flex pr-2"),u(_,"class","flex pr-2"),u(t,"class","my-1 flex")},m(E,B){P(E,t,B),s(t,l),g[n].m(l,null),s(t,o),s(t,f),I[r].m(f,null),s(t,a),s(t,_),O[p].m(_,null),d=!0},p(E,B){let z=n;n=M(E),n===z?g[n].p(E,B):(pt(),ee(g[z],1,1,()=>{g[z]=null}),dt(),i=g[n],i?i.p(E,B):(i=g[n]=h[n](E),i.c()),Q(i,1),i.m(l,null));let W=r;r=q(E),r===W?I[r].p(E,B):(pt(),ee(I[W],1,1,()=>{I[W]=null}),dt(),c=I[r],c?c.p(E,B):(c=I[r]=A[r](E),c.c()),Q(c,1),c.m(f,null));let F=p;p=U(E),p===F?O[p].p(E,B):(pt(),ee(O[F],1,1,()=>{O[F]=null}),dt(),v=O[p],v?v.p(E,B):(v=O[p]=L[p](E),v.c()),Q(v,1),v.m(_,null))},i(E){d||(Q(i),Q(c),Q(v),d=!0)},o(E){ee(i),ee(c),ee(v),d=!1},d(E){E&&T(t),g[n].d(),I[r].d(),O[p].d()}}}function Y4(e){let t,l;return t=new nn({props:{to:"/mqtt-ca",$$slots:{default:[X4]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Q4(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-ca",$$slots:{default:[Z4]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[13]),re(i,"keypress",e[13])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function X4(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)!=null?o:"Upload CA",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_ca)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_ca_upload)!=null?h:"Upload CA"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_ca)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function Z4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)!=null?o:"CA OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.ca_ok)!=null?_:"CA OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function J4(e){let t,l;return t=new nn({props:{to:"/mqtt-cert",$$slots:{default:[x4]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function $4(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-cert",$$slots:{default:[eg]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[14]),re(i,"keypress",e[14])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function x4(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)!=null?o:"Upload cert",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_crt)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_crt_upload)!=null?h:"Upload cert"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_crt)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function eg(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)!=null?o:"Cert OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.crt_ok)!=null?_:"Cert OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function tg(e){let t,l;return t=new nn({props:{to:"/mqtt-key",$$slots:{default:[ng]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function lg(e){let t,l,n,i,o,f,r;return l=new nn({props:{to:"/mqtt-key",$$slots:{default:[ig]},$$scope:{ctx:e}}}),{c(){t=m("span"),Ne(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Se(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[15]),re(i,"keypress",e[15])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Q(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ce(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function ng(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)!=null?o:"Upload key",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_key)!=null?c:""}}),{c(){Ne(t.$$.fragment)},m(a,_){Se(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_key_upload)!=null?h:"Upload key"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_key)!=null?A:""),t.$set(p)},i(a){l||(Q(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ce(t,a)}}}function ig(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)!=null?o:"Key OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.key_ok)!=null?_:"Key OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function P2(e){var oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te;let t,l,n=((x=(se=(ae=(oe=e[1].conf)==null?void 0:oe.mqtt)==null?void 0:ae.domoticz)==null?void 0:se.title)!=null?x:"Domoticz")+"",i,o,f,r,c,a,_,p,v,d=((Z=(V=(pe=(me=e[1].conf)==null?void 0:me.mqtt)==null?void 0:pe.domoticz)==null?void 0:V.eidx)!=null?Z:"Electricity IDX")+"",h,g,M,A,I,q,L=((w=(S=(ve=(ge=e[1].conf)==null?void 0:ge.mqtt)==null?void 0:ve.domoticz)==null?void 0:S.cidx)!=null?w:"Current IDX")+"",O,U,E,B,z,W,F=((te=(j=(D=(N=e[1].conf)==null?void 0:N.mqtt)==null?void 0:D.domoticz)==null?void 0:j.vidx)!=null?te:"Voltage IDX")+"",R,K,y,H,Y,X,J,$,ce,ie;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("input"),I=b(),q=m("div"),O=k(L),U=m("br"),E=b(),B=m("input"),z=b(),W=m("div"),R=k(F),K=k(`: L1, L2 & L3 - `),y=m("div"),H=m("input"),Y=b(),X=m("input"),J=b(),$=m("input"),u(l,"class","text-sm"),u(f,"href",Wl("MQTT-configuration#domoticz")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(A,"name","oe"),u(A,"type","text"),u(A,"class","in-f tr w-full"),u(v,"class","w-1/2"),u(B,"name","oc"),u(B,"type","text"),u(B,"class","in-l tr w-full"),u(q,"class","w-1/2"),u(p,"class","my-1 flex"),u(H,"name","ou1"),u(H,"type","text"),u(H,"class","in-f tr w-1/3"),u(X,"name","ou2"),u(X,"type","text"),u(X,"class","in-m tr w-1/3"),u($,"name","ou3"),u($,"type","text"),u($,"class","in-l tr w-1/3"),u(y,"class","flex"),u(W,"class","my-1"),u(t,"class","cnt")},m(le,fe){P(le,t,fe),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,h),s(v,g),s(v,M),s(v,A),be(A,e[4].o.e),s(p,I),s(p,q),s(q,O),s(q,U),s(q,E),s(q,B),be(B,e[4].o.c),s(t,z),s(t,W),s(W,R),s(W,K),s(W,y),s(y,H),be(H,e[4].o.u1),s(y,Y),s(y,X),be(X,e[4].o.u2),s(y,J),s(y,$),be($,e[4].o.u3),ce||(ie=[re(A,"input",e[70]),re(B,"input",e[71]),re(H,"input",e[72]),re(X,"input",e[73]),re($,"input",e[74])],ce=!0)},p(le,fe){var de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt;fe[0]&2&&n!==(n=((we=(Pe=(qe=(de=le[1].conf)==null?void 0:de.mqtt)==null?void 0:qe.domoticz)==null?void 0:Pe.title)!=null?we:"Domoticz")+"")&&C(i,n),fe[0]&2&&d!==(d=((De=(ke=(Ae=(Fe=le[1].conf)==null?void 0:Fe.mqtt)==null?void 0:Ae.domoticz)==null?void 0:ke.eidx)!=null?De:"Electricity IDX")+"")&&C(h,d),fe[0]&16&&A.value!==le[4].o.e&&be(A,le[4].o.e),fe[0]&2&&L!==(L=((Ye=(je=(Oe=(He=le[1].conf)==null?void 0:He.mqtt)==null?void 0:Oe.domoticz)==null?void 0:je.cidx)!=null?Ye:"Current IDX")+"")&&C(O,L),fe[0]&16&&B.value!==le[4].o.c&&be(B,le[4].o.c),fe[0]&2&&F!==(F=((tt=(xe=($e=(We=le[1].conf)==null?void 0:We.mqtt)==null?void 0:$e.domoticz)==null?void 0:xe.vidx)!=null?tt:"Voltage IDX")+"")&&C(R,F),fe[0]&16&&H.value!==le[4].o.u1&&be(H,le[4].o.u1),fe[0]&16&&X.value!==le[4].o.u2&&be(X,le[4].o.u2),fe[0]&16&&$.value!==le[4].o.u3&&be($,le[4].o.u3)},d(le){le&&T(t),ce=!1,Et(ie)}}}function E2(e){var J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w;let t,l,n=((ie=(ce=($=(J=e[1].conf)==null?void 0:J.mqtt)==null?void 0:$.ha)==null?void 0:ce.title)!=null?ie:"Home-Assistant")+"",i,o,f,r,c,a,_,p,v=((x=(se=(ae=(oe=e[1].conf)==null?void 0:oe.mqtt)==null?void 0:ae.ha)==null?void 0:se.discovery)!=null?x:"Discovery topic prefix")+"",d,h,g,M,A,I,q=((Z=(V=(pe=(me=e[1].conf)==null?void 0:me.mqtt)==null?void 0:pe.ha)==null?void 0:V.hostname)!=null?Z:"Hostname for URL")+"",L,O,U,E,B,z,W,F=((w=(S=(ve=(ge=e[1].conf)==null?void 0:ge.mqtt)==null?void 0:ve.ha)==null?void 0:S.tag)!=null?w:"Name tag")+"",R,K,y,H,Y,X;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),I=m("div"),L=k(q),O=m("br"),U=b(),E=m("input"),z=b(),W=m("div"),R=k(F),K=m("br"),y=b(),H=m("input"),u(l,"class","text-sm"),u(f,"href",Wl("MQTT-configuration#home-assistant")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(M,"name","ht"),u(M,"type","text"),u(M,"class","in-s"),u(M,"placeholder","homeassistant"),u(p,"class","my-1"),u(E,"name","hh"),u(E,"type","text"),u(E,"class","in-s"),u(E,"placeholder",B=e[4].g.h+".local"),u(I,"class","my-1"),u(H,"name","hn"),u(H,"type","text"),u(H,"class","in-s"),u(W,"class","my-1"),u(t,"class","cnt")},m(N,D){P(N,t,D),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,d),s(p,h),s(p,g),s(p,M),be(M,e[4].h.t),s(t,A),s(t,I),s(I,L),s(I,O),s(I,U),s(I,E),be(E,e[4].h.h),s(t,z),s(t,W),s(W,R),s(W,K),s(W,y),s(W,H),be(H,e[4].h.n),Y||(X=[re(M,"input",e[75]),re(E,"input",e[76]),re(H,"input",e[77])],Y=!0)},p(N,D){var j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye;D[0]&2&&n!==(n=((fe=(le=(te=(j=N[1].conf)==null?void 0:j.mqtt)==null?void 0:te.ha)==null?void 0:le.title)!=null?fe:"Home-Assistant")+"")&&C(i,n),D[0]&2&&v!==(v=((we=(Pe=(qe=(de=N[1].conf)==null?void 0:de.mqtt)==null?void 0:qe.ha)==null?void 0:Pe.discovery)!=null?we:"Discovery topic prefix")+"")&&C(d,v),D[0]&16&&M.value!==N[4].h.t&&be(M,N[4].h.t),D[0]&2&&q!==(q=((De=(ke=(Ae=(Fe=N[1].conf)==null?void 0:Fe.mqtt)==null?void 0:Ae.ha)==null?void 0:ke.hostname)!=null?De:"Hostname for URL")+"")&&C(L,q),D[0]&16&&B!==(B=N[4].g.h+".local")&&u(E,"placeholder",B),D[0]&16&&E.value!==N[4].h.h&&be(E,N[4].h.h),D[0]&2&&F!==(F=((Ye=(je=(Oe=(He=N[1].conf)==null?void 0:He.mqtt)==null?void 0:Oe.ha)==null?void 0:je.tag)!=null?Ye:"Name tag")+"")&&C(R,F),D[0]&16&&H.value!==N[4].h.n&&be(H,N[4].h.n)},d(N){N&&T(t),Y=!1,Et(X)}}}function A2(e){var K,y,H,Y,X,J,$,ce,ie;let t,l,n=((H=(y=(K=e[1].conf)==null?void 0:K.cloud)==null?void 0:y.title)!=null?H:"Cloud connections")+"",i,o,f,r,c,a,_,p,v,d,h,g=((J=(X=(Y=e[1].conf)==null?void 0:Y.cloud)==null?void 0:X.ams)!=null?J:"AMS reader cloud")+"",M,A,I,q,L,O,U=((ie=(ce=($=e[1].conf)==null?void 0:$.cloud)==null?void 0:ce.es)!=null?ie:"Energy Speedometer")+"",E,B,z,W,F,R=e[4].c.es&&D2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("label"),d=m("input"),h=b(),M=k(g),A=b(),I=m("div"),q=m("label"),L=m("input"),O=b(),E=k(U),B=b(),R&&R.c(),u(l,"class","text-sm"),u(f,"href",Wl("Cloud")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","c"),a.value="true",u(d,"type","checkbox"),u(d,"name","ce"),d.__value="true",d.value=d.__value,u(d,"class","rounded mb-1"),u(p,"class","my-1"),u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(L,"name","ces"),L.__value="true",L.value=L.__value,u(I,"class","my-1"),u(t,"class","cnt")},m(oe,ae){P(oe,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,d),d.checked=e[4].c.e,s(v,h),s(v,M),s(t,A),s(t,I),s(I,q),s(q,L),L.checked=e[4].c.es,s(q,O),s(q,E),s(I,B),R&&R.m(I,null),z=!0,W||(F=[re(d,"change",e[78]),re(L,"change",e[79])],W=!0)},p(oe,ae){var se,x,me,pe,V,Z,ge,ve,S;(!z||ae[0]&2)&&n!==(n=((me=(x=(se=oe[1].conf)==null?void 0:se.cloud)==null?void 0:x.title)!=null?me:"Cloud connections")+"")&&C(i,n),ae[0]&16&&(d.checked=oe[4].c.e),(!z||ae[0]&2)&&g!==(g=((Z=(V=(pe=oe[1].conf)==null?void 0:pe.cloud)==null?void 0:V.ams)!=null?Z:"AMS reader cloud")+"")&&C(M,g),ae[0]&16&&(L.checked=oe[4].c.es),(!z||ae[0]&2)&&U!==(U=((S=(ve=(ge=oe[1].conf)==null?void 0:ge.cloud)==null?void 0:ve.es)!=null?S:"Energy Speedometer")+"")&&C(E,U),oe[4].c.es?R?(R.p(oe,ae),ae[0]&16&&Q(R,1)):(R=D2(oe),R.c(),Q(R,1),R.m(I,null)):R&&(pt(),ee(R,1,1,()=>{R=null}),dt())},i(oe){z||(Q(R),z=!0)},o(oe){ee(R),z=!1},d(oe){oe&&T(t),R&&R.d(),W=!1,Et(F)}}}function D2(e){let t,l,n=e[0].mac+"",i,o,f,r,c=(e[0].meter.id?e[0].meter.id:"missing, required")+"",a,_,p,v,d=e[0].mac&&e[0].meter.id&&q2(e);return{c(){t=m("div"),l=k("MAC: "),i=k(n),o=b(),f=m("div"),r=k("Meter ID: "),a=k(c),_=b(),d&&d.c(),p=Ut(),u(t,"class","pl-5"),u(f,"class","pl-5")},m(h,g){P(h,t,g),s(t,l),s(t,i),P(h,o,g),P(h,f,g),s(f,r),s(f,a),P(h,_,g),d&&d.m(h,g),P(h,p,g),v=!0},p(h,g){(!v||g[0]&1)&&n!==(n=h[0].mac+"")&&C(i,n),(!v||g[0]&1)&&c!==(c=(h[0].meter.id?h[0].meter.id:"missing, required")+"")&&C(a,c),h[0].mac&&h[0].meter.id?d?(d.p(h,g),g[0]&1&&Q(d,1)):(d=q2(h),d.c(),Q(d,1),d.m(p.parentNode,p)):d&&(pt(),ee(d,1,1,()=>{d=null}),dt())},i(h){v||(Q(d),v=!0)},o(h){ee(d),v=!1},d(h){h&&T(t),h&&T(o),h&&T(f),h&&T(_),d&&d.d(h),h&&T(p)}}}function q2(e){let t,l,n;return l=new j4({props:{value:'{"mac":"'+e[0].mac+'","meter":"'+e[0].meter.id+'"}'}}),{c(){t=m("div"),Ne(l.$$.fragment),u(t,"class","pl-2")},m(i,o){P(i,t,o),Se(l,t,null),n=!0},p(i,o){const f={};o[0]&1&&(f.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(f)},i(i){n||(Q(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ce(l)}}}function O2(e){var F,R,K,y,H,Y,X,J;let t,l,n=((K=(R=(F=e[1].conf)==null?void 0:F.thresholds)==null?void 0:R.title)!=null?K:"Thresholds")+"",i,o,f,r,c,a,_,p,v,d,h,g=((Y=(H=(y=e[1].conf)==null?void 0:y.thresholds)==null?void 0:H.avg)!=null?Y:"Average of")+"",M,A,I,q,L,O=((J=(X=e[1].common)==null?void 0:X.hours)!=null?J:"hours")+"",U,E,B,z={length:9},W=[];for(let $=0;$20&&B2(e),d=e[4].i.d.d>0&&H2(e),h=e[0].chip=="esp8266"&&y2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),v&&v.c(),a=b(),d&&d.c(),_=b(),h&&h.c(),u(l,"class","text-sm"),u(f,"href",Wl("GPIO-configuration")),u(f,"target","_blank"),u(f,"class","float-right"),u(t,"class","cnt")},m(I,q){P(I,t,q),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),v&&v.m(t,null),s(t,a),d&&d.m(t,null),s(t,_),h&&h.m(t,null),p=!0},p(I,q){var L,O,U;(!p||q[0]&2)&&n!==(n=((U=(O=(L=I[1].conf)==null?void 0:L.hw)==null?void 0:O.title)!=null?U:"Hardware")+"")&&C(i,n),I[0].board>20?v?(v.p(I,q),q[0]&1&&Q(v,1)):(v=B2(I),v.c(),Q(v,1),v.m(t,a)):v&&(pt(),ee(v,1,1,()=>{v=null}),dt()),I[4].i.d.d>0?d?d.p(I,q):(d=H2(I),d.c(),d.m(t,_)):d&&(d.d(1),d=null),I[0].chip=="esp8266"?h?h.p(I,q):(h=y2(I),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},i(I){p||(Q(v),p=!0)},o(I){ee(v),p=!1},d(I){I&&T(t),v&&v.d(),d&&d.d(),h&&h.d()}}}function B2(e){var jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le,St,ut,Yt,ll,fl,ul,Sl,rl,Cl,nl,_l,dl,Nl,Tl,Qt,Ee,qt,Pn,Jl,dn,En;let t,l,n,i,o=((yt=(Ht=(Lt=(jt=e[1].conf)==null?void 0:jt.hw)==null?void 0:Lt.han)==null?void 0:Ht.rx)!=null?yt:"HAN RX")+"",f,r,c,a,_,p,v,d=((Gt=(Rt=(Ve=(Me=e[1].conf)==null?void 0:Me.hw)==null?void 0:Ve.han)==null?void 0:Rt.tx)!=null?Gt:"HAN TX")+"",h,g,M,A,I,q,L,O,U,E,B=((Zt=(Kt=(Dt=(zt=e[1].conf)==null?void 0:zt.hw)==null?void 0:Dt.han)==null?void 0:Kt.pullup)!=null?Zt:"pullup")+"",z,W,F,R,K=((ft=(Jt=(tl=e[1].conf)==null?void 0:tl.hw)==null?void 0:Jt.ap_btn)!=null?ft:"AP button")+"",y,H,Y,X,J,$,ce=((Ue=(ne=(Ke=(Mt=e[1].conf)==null?void 0:Mt.hw)==null?void 0:Ke.led)==null?void 0:ne.title)!=null?Ue:"LED")+"",ie,oe,ae,se,x,me,pe,V,Z,ge,ve=((Yt=(ut=(St=(Le=e[1].conf)==null?void 0:Le.hw)==null?void 0:St.led)==null?void 0:ut.inverted)!=null?Yt:"inverted")+"",S,w,N,D=((Sl=(ul=(fl=(ll=e[1].conf)==null?void 0:ll.hw)==null?void 0:fl.led)==null?void 0:ul.rgb)!=null?Sl:"RGB")+"",j,te,le,fe,de=((_l=(nl=(Cl=(rl=e[1].conf)==null?void 0:rl.hw)==null?void 0:Cl.led)==null?void 0:nl.inverted)!=null?_l:"inverted")+"",qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e=((Qt=(Tl=(Nl=(dl=e[1].conf)==null?void 0:dl.hw)==null?void 0:Nl.led)==null?void 0:Tl.disable)!=null?Qt:"LED dis. GPIO")+"",xe,tt,Te,ue,Ie,kt=((Pn=(qt=(Ee=e[1].conf)==null?void 0:Ee.hw)==null?void 0:qt.temp)!=null?Pn:"Temperature")+"",lt,wt,st,ot,et,Nt,gt=((En=(dn=(Jl=e[1].conf)==null?void 0:Jl.hw)==null?void 0:dn.temp_analog)!=null?En:"Analog temp")+"",At,Pt,Be,ye,It,vt,nt,Tt,it;_=new af({props:{chip:e[0].chip}}),I=new af({props:{chip:e[0].chip}});let at=e[0].chip!="esp8266"&&U2(e),rt=e[4].i.v.p>0&&j2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("select"),Ne(_.$$.fragment),p=b(),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("select"),Ne(I.$$.fragment),q=b(),L=m("div"),O=m("label"),U=m("input"),E=b(),z=k(B),W=b(),F=m("div"),R=m("div"),y=k(K),H=m("br"),Y=b(),X=m("input"),J=b(),$=m("div"),ie=k(ce),oe=m("br"),ae=b(),se=m("div"),x=m("input"),me=b(),pe=m("div"),V=m("label"),Z=m("input"),ge=b(),S=k(ve),w=b(),N=m("div"),j=k(D),te=m("label"),le=m("input"),fe=b(),qe=k(de),Pe=m("br"),we=b(),Fe=m("div"),Ae=m("input"),ke=b(),De=m("input"),He=b(),Oe=m("input"),je=b(),Ye=m("div"),We=m("div"),xe=k($e),tt=b(),Te=m("input"),ue=b(),Ie=m("div"),lt=k(kt),wt=m("br"),st=b(),ot=m("input"),et=b(),Nt=m("div"),At=k(gt),Pt=m("br"),Be=b(),ye=m("input"),It=b(),at&&at.c(),vt=b(),rt&&rt.c(),u(t,"type","hidden"),u(t,"name","i"),t.value="true",u(a,"name","ihp"),u(a,"class","in-f w-full"),e[4].i.h.p===void 0&&Ct(()=>e[84].call(a)),u(i,"class","w-1/3"),u(A,"name","iht"),u(A,"class","in-l w-full"),e[4].i.h.t===void 0&&Ct(()=>e[85].call(A)),u(v,"class","w-1/3"),u(U,"name","ihu"),U.__value="true",U.value=U.__value,u(U,"type","checkbox"),u(U,"class","rounded mb-1"),u(O,"class","ml-2"),u(L,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(X,"name","ia"),u(X,"type","number"),u(X,"min","0"),u(X,"max",e[8]),u(X,"class","in-f tr w-full"),u(R,"class","w-1/3"),u(x,"name","ilp"),u(x,"type","number"),u(x,"min","0"),u(x,"max",e[8]),u(x,"class","in-l tr w-full"),u(se,"class","flex"),u($,"class","w-1/3"),u(Z,"name","ili"),Z.__value="true",Z.value=Z.__value,u(Z,"type","checkbox"),u(Z,"class","rounded mb-1"),u(V,"class","ml-4"),u(pe,"class","w-1/3"),u(le,"name","iri"),le.__value="true",le.value=le.__value,u(le,"type","checkbox"),u(le,"class","rounded mb-1"),u(te,"class","ml-4"),u(Ae,"name","irr"),u(Ae,"type","number"),u(Ae,"min","0"),u(Ae,"max",e[8]),u(Ae,"class","in-f tr w-1/3"),u(De,"name","irg"),u(De,"type","number"),u(De,"min","0"),u(De,"max",e[8]),u(De,"class","in-m tr w-1/3"),u(Oe,"name","irb"),u(Oe,"type","number"),u(Oe,"min","0"),u(Oe,"max",e[8]),u(Oe,"class","in-l tr w-1/3"),u(Fe,"class","flex"),u(N,"class","w-full"),u(Te,"name","idd"),u(Te,"type","number"),u(Te,"min","0"),u(Te,"max",e[8]),u(Te,"class","in-s tr"),u(We,"class","my-1 pr-1 w-1/3"),u(Ye,"class","w-full"),u(ot,"name","itd"),u(ot,"type","number"),u(ot,"min","0"),u(ot,"max",e[8]),u(ot,"class","in-f tr w-full"),u(Ie,"class","my-1 w-1/3"),u(ye,"name","ita"),u(ye,"type","number"),u(ye,"min","0"),u(ye,"max",e[8]),u(ye,"class","in-l tr w-full"),u(Nt,"class","my-1 pr-1 w-1/3"),u(F,"class","flex flex-wrap")},m(Re,he){P(Re,t,he),P(Re,l,he),P(Re,n,he),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),Se(_,a,null),Je(a,e[4].i.h.p,!0),s(n,p),s(n,v),s(v,h),s(v,g),s(v,M),s(v,A),Se(I,A,null),Je(A,e[4].i.h.t,!0),s(n,q),s(n,L),s(L,O),s(O,U),U.checked=e[4].i.h.u,s(O,E),s(O,z),P(Re,W,he),P(Re,F,he),s(F,R),s(R,y),s(R,H),s(R,Y),s(R,X),be(X,e[4].i.a),s(F,J),s(F,$),s($,ie),s($,oe),s($,ae),s($,se),s(se,x),be(x,e[4].i.l.p),s(F,me),s(F,pe),s(pe,V),s(V,Z),Z.checked=e[4].i.l.i,s(V,ge),s(V,S),s(F,w),s(F,N),s(N,j),s(N,te),s(te,le),le.checked=e[4].i.r.i,s(te,fe),s(te,qe),s(N,Pe),s(N,we),s(N,Fe),s(Fe,Ae),be(Ae,e[4].i.r.r),s(Fe,ke),s(Fe,De),be(De,e[4].i.r.g),s(Fe,He),s(Fe,Oe),be(Oe,e[4].i.r.b),s(F,je),s(F,Ye),s(Ye,We),s(We,xe),s(We,tt),s(We,Te),be(Te,e[4].i.d.d),s(F,ue),s(F,Ie),s(Ie,lt),s(Ie,wt),s(Ie,st),s(Ie,ot),be(ot,e[4].i.t.d),s(F,et),s(F,Nt),s(Nt,At),s(Nt,Pt),s(Nt,Be),s(Nt,ye),be(ye,e[4].i.t.a),s(F,It),at&&at.m(F,null),s(F,vt),rt&&rt.m(F,null),nt=!0,Tt||(it=[re(a,"change",e[84]),re(A,"change",e[85]),re(U,"change",e[86]),re(X,"input",e[87]),re(x,"input",e[88]),re(Z,"change",e[89]),re(le,"change",e[90]),re(Ae,"input",e[91]),re(De,"input",e[92]),re(Oe,"input",e[93]),re(Te,"input",e[94]),re(ot,"input",e[95]),re(ye,"input",e[96])],Tt=!0)},p(Re,he){var An,Hn,yn,ml,$l,xl,zn,en,Gl,hn,Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl,ei,ki,fs,us,qn,Pl,rs,ti,cs,wi,_s,gn,Yn,El,ms,li,Mi,ps,ds,Si,Qn,Al;(!nt||he[0]&2)&&o!==(o=((ml=(yn=(Hn=(An=Re[1].conf)==null?void 0:An.hw)==null?void 0:Hn.han)==null?void 0:yn.rx)!=null?ml:"HAN RX")+"")&&C(f,o);const Qe={};he[0]&1&&(Qe.chip=Re[0].chip),_.$set(Qe),he[0]&16&&Je(a,Re[4].i.h.p),(!nt||he[0]&2)&&d!==(d=((en=(zn=(xl=($l=Re[1].conf)==null?void 0:$l.hw)==null?void 0:xl.han)==null?void 0:zn.tx)!=null?en:"HAN TX")+"")&&C(h,d);const vn={};he[0]&1&&(vn.chip=Re[0].chip),I.$set(vn),he[0]&16&&Je(A,Re[4].i.h.t),he[0]&16&&(U.checked=Re[4].i.h.u),(!nt||he[0]&2)&&B!==(B=((Wn=(Dn=(hn=(Gl=Re[1].conf)==null?void 0:Gl.hw)==null?void 0:hn.han)==null?void 0:Dn.pullup)!=null?Wn:"pullup")+"")&&C(z,B),(!nt||he[0]&2)&&K!==(K=((cl=(tn=(Gn=Re[1].conf)==null?void 0:Gn.hw)==null?void 0:tn.ap_btn)!=null?cl:"AP button")+"")&&C(y,K),(!nt||he[0]&256)&&u(X,"max",Re[8]),he[0]&16&&Ze(X.value)!==Re[4].i.a&&be(X,Re[4].i.a),(!nt||he[0]&2)&&ce!==(ce=((Vl=(Kn=(bn=(Vn=Re[1].conf)==null?void 0:Vn.hw)==null?void 0:bn.led)==null?void 0:Kn.title)!=null?Vl:"LED")+"")&&C(ie,ce),(!nt||he[0]&256)&&u(x,"max",Re[8]),he[0]&16&&Ze(x.value)!==Re[4].i.l.p&&be(x,Re[4].i.l.p),he[0]&16&&(Z.checked=Re[4].i.l.i),(!nt||he[0]&2)&&ve!==(ve=((us=(fs=(ki=(ei=Re[1].conf)==null?void 0:ei.hw)==null?void 0:ki.led)==null?void 0:fs.inverted)!=null?us:"inverted")+"")&&C(S,ve),(!nt||he[0]&2)&&D!==(D=((ti=(rs=(Pl=(qn=Re[1].conf)==null?void 0:qn.hw)==null?void 0:Pl.led)==null?void 0:rs.rgb)!=null?ti:"RGB")+"")&&C(j,D),he[0]&16&&(le.checked=Re[4].i.r.i),(!nt||he[0]&2)&&de!==(de=((gn=(_s=(wi=(cs=Re[1].conf)==null?void 0:cs.hw)==null?void 0:wi.led)==null?void 0:_s.inverted)!=null?gn:"inverted")+"")&&C(qe,de),(!nt||he[0]&256)&&u(Ae,"max",Re[8]),he[0]&16&&Ze(Ae.value)!==Re[4].i.r.r&&be(Ae,Re[4].i.r.r),(!nt||he[0]&256)&&u(De,"max",Re[8]),he[0]&16&&Ze(De.value)!==Re[4].i.r.g&&be(De,Re[4].i.r.g),(!nt||he[0]&256)&&u(Oe,"max",Re[8]),he[0]&16&&Ze(Oe.value)!==Re[4].i.r.b&&be(Oe,Re[4].i.r.b),(!nt||he[0]&2)&&$e!==($e=((li=(ms=(El=(Yn=Re[1].conf)==null?void 0:Yn.hw)==null?void 0:El.led)==null?void 0:ms.disable)!=null?li:"LED dis. GPIO")+"")&&C(xe,$e),(!nt||he[0]&256)&&u(Te,"max",Re[8]),he[0]&16&&Ze(Te.value)!==Re[4].i.d.d&&be(Te,Re[4].i.d.d),(!nt||he[0]&2)&&kt!==(kt=((ds=(ps=(Mi=Re[1].conf)==null?void 0:Mi.hw)==null?void 0:ps.temp)!=null?ds:"Temperature")+"")&&C(lt,kt),(!nt||he[0]&256)&&u(ot,"max",Re[8]),he[0]&16&&Ze(ot.value)!==Re[4].i.t.d&&be(ot,Re[4].i.t.d),(!nt||he[0]&2)&>!==(gt=((Al=(Qn=(Si=Re[1].conf)==null?void 0:Si.hw)==null?void 0:Qn.temp_analog)!=null?Al:"Analog temp")+"")&&C(At,gt),(!nt||he[0]&256)&&u(ye,"max",Re[8]),he[0]&16&&Ze(ye.value)!==Re[4].i.t.a&&be(ye,Re[4].i.t.a),Re[0].chip!="esp8266"?at?at.p(Re,he):(at=U2(Re),at.c(),at.m(F,vt)):at&&(at.d(1),at=null),Re[4].i.v.p>0?rt?rt.p(Re,he):(rt=j2(Re),rt.c(),rt.m(F,null)):rt&&(rt.d(1),rt=null)},i(Re){nt||(Q(_.$$.fragment,Re),Q(I.$$.fragment,Re),nt=!0)},o(Re){ee(_.$$.fragment,Re),ee(I.$$.fragment,Re),nt=!1},d(Re){Re&&T(t),Re&&T(l),Re&&T(n),Ce(_),Ce(I),Re&&T(W),Re&&T(F),at&&at.d(),rt&&rt.d(),Tt=!1,Et(it)}}}function U2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.title)!=null?v:"Vcc")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivp"),u(f,"type","number"),u(f,"min","0"),u(f,"max",e[8]),u(f,"class","in-s tr w-full"),u(t,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].i.v.p),r||(c=re(f,"input",e[97]),r=!0)},p(d,h){var g,M,A,I;h[0]&2&&l!==(l=((I=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.title)!=null?I:"Vcc")+"")&&C(n,l),h[0]&256&&u(f,"max",d[8]),h[0]&16&&Ze(f.value)!==d[4].i.v.p&&be(f,d[4].i.v.p)},d(d){d&&T(t),r=!1,c()}}}function j2(e){var h,g,M,A;let t,l=((A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.vcc)==null?void 0:M.divider)!=null?A:"Voltage divider")+"",n,i,o,f,r,c,a,_,p,v,d;return{c(){var I,q,L,O,U,E,B,z;t=m("div"),n=k(l),i=m("br"),o=b(),f=m("div"),r=m("input"),a=b(),_=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",c=(O=(L=(q=(I=e[1].conf)==null?void 0:I.hw)==null?void 0:q.vcc)==null?void 0:L.div_vcc)!=null?O:"VCC"),u(_,"name","ivdg"),u(_,"type","number"),u(_,"min","0"),u(_,"max","65535"),u(_,"class","in-l tr w-full"),u(_,"placeholder",p=(z=(B=(E=(U=e[1].conf)==null?void 0:U.hw)==null?void 0:E.vcc)==null?void 0:B.div_gnd)!=null?z:"GND"),u(f,"class","flex"),u(t,"class","my-1")},m(I,q){P(I,t,q),s(t,n),s(t,i),s(t,o),s(t,f),s(f,r),be(r,e[4].i.v.d.v),s(f,a),s(f,_),be(_,e[4].i.v.d.g),v||(d=[re(r,"input",e[98]),re(_,"input",e[99])],v=!0)},p(I,q){var L,O,U,E,B,z,W,F,R,K,y,H;q[0]&2&&l!==(l=((E=(U=(O=(L=I[1].conf)==null?void 0:L.hw)==null?void 0:O.vcc)==null?void 0:U.divider)!=null?E:"Voltage divider")+"")&&C(n,l),q[0]&2&&c!==(c=(F=(W=(z=(B=I[1].conf)==null?void 0:B.hw)==null?void 0:z.vcc)==null?void 0:W.div_vcc)!=null?F:"VCC")&&u(r,"placeholder",c),q[0]&16&&Ze(r.value)!==I[4].i.v.d.v&&be(r,I[4].i.v.d.v),q[0]&2&&p!==(p=(H=(y=(K=(R=I[1].conf)==null?void 0:R.hw)==null?void 0:K.vcc)==null?void 0:y.div_gnd)!=null?H:"GND")&&u(_,"placeholder",p),q[0]&16&&Ze(_.value)!==I[4].i.v.d.g&&be(_,I[4].i.v.d.g)},d(I){I&&T(t),v=!1,Et(d)}}}function H2(e){var h,g,M,A,I,q,L,O,U,E,B,z,W,F,R;let t,l=((I=(A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.led)==null?void 0:M.behaviour)==null?void 0:A.title)!=null?I:"LED behaviour")+"",n,i,o,f,r=((E=(U=(O=(L=(q=e[1].conf)==null?void 0:q.hw)==null?void 0:L.led)==null?void 0:O.behaviour)==null?void 0:U.enabled)!=null?E:"Enabled")+"",c,a,_=((R=(F=(W=(z=(B=e[1].conf)==null?void 0:B.hw)==null?void 0:z.led)==null?void 0:W.behaviour)==null?void 0:F.disabled)!=null?R:"Disabled")+"",p,v,d;return{c(){t=m("div"),n=k(l),i=b(),o=m("select"),f=m("option"),c=k(r),a=m("option"),p=k(_),f.__value=0,f.value=f.__value,a.__value=1,a.value=a.__value,u(o,"name","idb"),u(o,"class","in-s"),e[4].i.d.b===void 0&&Ct(()=>e[100].call(o)),u(t,"class","my-1 w-full")},m(K,y){P(K,t,y),s(t,n),s(t,i),s(t,o),s(o,f),s(f,c),s(o,a),s(a,p),Je(o,e[4].i.d.b,!0),v||(d=re(o,"change",e[100]),v=!0)},p(K,y){var H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z;y[0]&2&&l!==(l=(($=(J=(X=(Y=(H=K[1].conf)==null?void 0:H.hw)==null?void 0:Y.led)==null?void 0:X.behaviour)==null?void 0:J.title)!=null?$:"LED behaviour")+"")&&C(n,l),y[0]&2&&r!==(r=((se=(ae=(oe=(ie=(ce=K[1].conf)==null?void 0:ce.hw)==null?void 0:ie.led)==null?void 0:oe.behaviour)==null?void 0:ae.enabled)!=null?se:"Enabled")+"")&&C(c,r),y[0]&2&&_!==(_=((Z=(V=(pe=(me=(x=K[1].conf)==null?void 0:x.hw)==null?void 0:me.led)==null?void 0:pe.behaviour)==null?void 0:V.disabled)!=null?Z:"Disabled")+"")&&C(p,_),y[0]&16&&Je(o,K[4].i.d.b)},d(K){K&&T(t),v=!1,d()}}}function y2(e){var O,U,E,B,z,W,F,R;let t,l,n,i,o=((B=(E=(U=(O=e[1].conf)==null?void 0:O.hw)==null?void 0:U.vcc)==null?void 0:E.offset)!=null?B:"Vcc offset")+"",f,r,c,a,_,p,v=((R=(F=(W=(z=e[1].conf)==null?void 0:z.hw)==null?void 0:W.vcc)==null?void 0:F.multiplier)!=null?R:"Multiplier")+"",d,h,g,M,A,I,q,L=(e[0].board==2||e[0].board==100)&&z2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),L&&L.c(),u(t,"type","hidden"),u(t,"name","iv"),t.value="true",u(a,"name","ivo"),u(a,"type","number"),u(a,"min","0.0"),u(a,"max","3.5"),u(a,"step","0.01"),u(a,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(M,"name","ivm"),u(M,"type","number"),u(M,"min","0.1"),u(M,"max","10"),u(M,"step","0.01"),u(M,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(K,y){P(K,t,y),P(K,l,y),P(K,n,y),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),be(a,e[4].i.v.o),s(n,_),s(n,p),s(p,d),s(p,h),s(p,g),s(p,M),be(M,e[4].i.v.m),s(n,A),L&&L.m(n,null),I||(q=[re(a,"input",e[101]),re(M,"input",e[102])],I=!0)},p(K,y){var H,Y,X,J,$,ce,ie,oe;y[0]&2&&o!==(o=((J=(X=(Y=(H=K[1].conf)==null?void 0:H.hw)==null?void 0:Y.vcc)==null?void 0:X.offset)!=null?J:"Vcc offset")+"")&&C(f,o),y[0]&16&&Ze(a.value)!==K[4].i.v.o&&be(a,K[4].i.v.o),y[0]&2&&v!==(v=((oe=(ie=(ce=($=K[1].conf)==null?void 0:$.hw)==null?void 0:ce.vcc)==null?void 0:ie.multiplier)!=null?oe:"Multiplier")+"")&&C(d,v),y[0]&16&&Ze(M.value)!==K[4].i.v.m&&be(M,K[4].i.v.m),K[0].board==2||K[0].board==100?L?L.p(K,y):(L=z2(K),L.c(),L.m(n,null)):L&&(L.d(1),L=null)},d(K){K&&T(t),K&&T(l),K&&T(n),L&&L.d(),I=!1,Et(q)}}}function z2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.boot)!=null?v:"Boot limit")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivb"),u(f,"type","number"),u(f,"min","2.5"),u(f,"max","3.5"),u(f,"step","0.1"),u(f,"class","in-s tr w-full"),u(t,"class","w-1/3 pl-1")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),be(f,e[4].i.v.b),r||(c=re(f,"input",e[103]),r=!0)},p(d,h){var g,M,A,I;h[0]&2&&l!==(l=((I=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.boot)!=null?I:"Boot limit")+"")&&C(n,l),h[0]&16&&Ze(f.value)!==d[4].i.v.b&&be(f,d[4].i.v.b)},d(d){d&&T(t),r=!1,c()}}}function W2(e){var U,E,B,z,W,F;let t,l=((B=(E=(U=e[1].conf)==null?void 0:U.debug)==null?void 0:E.danger)!=null?B:"Disable when done")+"",n,i,o,f,r,c,a=((F=(W=(z=e[1].conf)==null?void 0:z.debug)==null?void 0:W.telnet)!=null?F:"Enable telnet")+"",_,p,v,d,h,g,M,A,I,q,L,O=e[4].d.t&&G2(e);return{c(){t=m("div"),n=k(l),i=b(),o=m("div"),f=m("label"),r=m("input"),c=b(),_=k(a),p=b(),O&&O.c(),v=b(),d=m("div"),h=m("select"),g=m("option"),g.textContent="Verbose",M=m("option"),M.textContent="Debug",A=m("option"),A.textContent="Info",I=m("option"),I.textContent="Warning",u(t,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",r.value=r.__value,u(r,"class","rounded mb-1"),u(o,"class","my-1"),g.__value=1,g.value=g.__value,M.__value=2,M.value=M.__value,A.__value=3,A.value=A.__value,I.__value=4,I.value=I.__value,u(h,"name","dl"),u(h,"class","in-s"),e[4].d.l===void 0&&Ct(()=>e[106].call(h)),u(d,"class","my-1")},m(R,K){P(R,t,K),s(t,n),P(R,i,K),P(R,o,K),s(o,f),s(f,r),r.checked=e[4].d.t,s(f,c),s(f,_),P(R,p,K),O&&O.m(R,K),P(R,v,K),P(R,d,K),s(d,h),s(h,g),s(h,M),s(h,A),s(h,I),Je(h,e[4].d.l,!0),q||(L=[re(r,"change",e[105]),re(h,"change",e[106])],q=!0)},p(R,K){var y,H,Y,X,J,$;K[0]&2&&l!==(l=((Y=(H=(y=R[1].conf)==null?void 0:y.debug)==null?void 0:H.danger)!=null?Y:"Disable when done")+"")&&C(n,l),K[0]&16&&(r.checked=R[4].d.t),K[0]&2&&a!==(a=(($=(J=(X=R[1].conf)==null?void 0:X.debug)==null?void 0:J.telnet)!=null?$:"Enable telnet")+"")&&C(_,a),R[4].d.t?O?O.p(R,K):(O=G2(R),O.c(),O.m(v.parentNode,v)):O&&(O.d(1),O=null),K[0]&16&&Je(h,R[4].d.l)},d(R){R&&T(t),R&&T(i),R&&T(o),R&&T(p),O&&O.d(R),R&&T(v),R&&T(d),q=!1,Et(L)}}}function G2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)!=null?f:"Disable when done")+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.debug)==null?void 0:_.telnet_danger)!=null?p:"Disable when done")+"")&&C(n,l)},d(r){r&&T(t)}}}function sg(e){var Hu,yu,zu,Wu,Gu,Vu,Ku,Yu,Qu,Xu,Zu,Ju,$u,xu,er,tr,lr,nr,ir,sr,or,ar,fr,ur,rr,cr,_r,mr,pr,dr,vr,hr,br,gr,kr,wr,Mr,Sr,Cr,Nr,Tr,Pr,Er,Ar,Dr,qr,Or,Ir,Lr,Rr,Fr,Br,Ur,jr,Hr,yr,zr,Wr,Gr,Vr,Kr,Yr,Qr,Xr,Zr,Jr,$r,xr,e1,t1,l1,n1,i1,s1,o1,a1,f1,u1,r1,c1,_1,m1,p1,d1,v1,h1,b1,g1,k1,w1,M1,S1,C1,N1,T1,P1,E1,A1,D1,q1,O1,I1,L1,R1,F1,B1,U1,j1,H1,y1,z1,W1,G1,V1,K1,Y1,Q1,X1,Z1,J1,$1,x1,e0,t0,l0,n0,i0,s0,o0,a0,f0,u0,r0,c0,_0,m0,p0,d0,v0,h0,b0,g0,k0,w0,M0,S0,C0,N0,T0,P0,E0,A0,D0,q0,O0,I0;let t,l,n,i,o=((zu=(yu=(Hu=e[1].conf)==null?void 0:Hu.general)==null?void 0:yu.title)!=null?zu:"General")+"",f,r,c,a,_,p,v,d,h,g,M=((Vu=(Gu=(Wu=e[1].conf)==null?void 0:Wu.general)==null?void 0:Gu.hostname)!=null?Vu:"Hostname")+"",A,I,q,L,O,U,E=((Qu=(Yu=(Ku=e[1].conf)==null?void 0:Ku.general)==null?void 0:Yu.timezone)!=null?Qu:"Time zone")+"",B,z,W,F,R,K,y,H,Y,X,J,$=((Ju=(Zu=(Xu=e[1].conf)==null?void 0:Xu.price)==null?void 0:Zu.region)!=null?Ju:"Price region")+"",ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e=((er=(xu=($u=e[1].conf)==null?void 0:$u.price)==null?void 0:xu.currency)!=null?er:"Currency")+"",xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt=((nr=(lr=(tr=e[1].conf)==null?void 0:tr.price)==null?void 0:lr.enabled)!=null?nr:"Enabled")+"",At,Pt,Be,ye,It=((ar=(or=(sr=(ir=e[1].conf)==null?void 0:ir.general)==null?void 0:sr.security)==null?void 0:or.title)!=null?ar:"Security")+"",vt,nt,Tt,it,at,rt=((cr=(rr=(ur=(fr=e[1].conf)==null?void 0:fr.general)==null?void 0:ur.security)==null?void 0:rr.none)!=null?cr:"None")+"",jt,Lt,Ht=((dr=(pr=(mr=(_r=e[1].conf)==null?void 0:_r.general)==null?void 0:mr.security)==null?void 0:pr.conf)!=null?dr:"Conf")+"",yt,Me,Ve=((gr=(br=(hr=(vr=e[1].conf)==null?void 0:vr.general)==null?void 0:hr.security)==null?void 0:br.all)!=null?gr:"All")+"",Rt,Gt,zt,Dt,Kt=((Mr=(wr=(kr=e[1].conf)==null?void 0:kr.general)==null?void 0:wr.context)!=null?Mr:"Context")+"",Zt,tl,Jt,ft,Mt,Ke,ne,Ue,Le=((Nr=(Cr=(Sr=e[1].conf)==null?void 0:Sr.meter)==null?void 0:Cr.title)!=null?Nr:"Meter")+"",St,ut,Yt,ll,fl,ul,Sl,rl,Cl,nl,_l=((Ar=(Er=(Pr=(Tr=e[1].conf)==null?void 0:Tr.meter)==null?void 0:Pr.comm)==null?void 0:Er.title)!=null?Ar:"Communication")+"",dl,Nl,Tl,Qt,Ee,qt=((Ir=(Or=(qr=(Dr=e[1].conf)==null?void 0:Dr.meter)==null?void 0:qr.comm)==null?void 0:Or.passive)!=null?Ir:"Passive")+"",Pn,Jl,dn=((Br=(Fr=(Rr=(Lr=e[1].conf)==null?void 0:Lr.meter)==null?void 0:Rr.comm)==null?void 0:Fr.pulse)!=null?Br:"Pulse")+"",En,Re,he,Qe,vn=((jr=(Ur=e[1].common)==null?void 0:Ur.voltage)!=null?jr:"Voltage")+"",An,Hn,yn,ml,$l,xl,zn,en,Gl,hn=((zr=(yr=(Hr=e[1].conf)==null?void 0:Hr.meter)==null?void 0:yr.fuse)!=null?zr:"Main fuse")+"",Dn,Wn,Gn,tn,cl,Vn,bn,Kn,Vl,ei=((Vr=(Gr=(Wr=e[1].conf)==null?void 0:Wr.meter)==null?void 0:Gr.prod)!=null?Vr:"Production")+"",ki,fs,us,qn,Pl,rs,ti,cs,wi,_s,gn,Yn,El,ms,li=((Qr=(Yr=(Kr=e[1].conf)==null?void 0:Kr.meter)==null?void 0:Yr.encrypted)!=null?Qr:"Encrypted")+"",Mi,ps,ds,Si,Qn,Al,Pf,js=(($r=(Jr=(Zr=(Xr=e[1].conf)==null?void 0:Xr.meter)==null?void 0:Zr.multipliers)==null?void 0:Jr.title)!=null?$r:"Multipliers")+"",Yo,Ef,Af,Kl,Hs,ys=((t1=(e1=(xr=e[1].conf)==null?void 0:xr.connection)==null?void 0:e1.title)!=null?t1:"Connection")+"",Qo,Df,Ci,qf,Of,vs,If,zs,ln,Ni,Ws=((i1=(n1=(l1=e[1].conf)==null?void 0:l1.connection)==null?void 0:n1.wifi)!=null?i1:"WiFi")+"",Xo,Ti,Gs=((a1=(o1=(s1=e[1].conf)==null?void 0:s1.connection)==null?void 0:o1.ap)!=null?a1:"AP")+"",Zo,Lf,Rf,il,Vs,Ks=((r1=(u1=(f1=e[1].conf)==null?void 0:f1.network)==null?void 0:u1.title)!=null?r1:"Network")+"",Jo,Ff,Pi,Bf,Uf,ni,Ys=((m1=(_1=(c1=e[1].conf)==null?void 0:c1.network)==null?void 0:_1.ip)!=null?m1:"IP")+"",$o,jf,Hf,Xn,kn,Ei,Qs=((v1=(d1=(p1=e[1].conf)==null?void 0:p1.network)==null?void 0:d1.dhcp)!=null?v1:"DHCP")+"",xo,Ai,Xs=((g1=(b1=(h1=e[1].conf)==null?void 0:h1.network)==null?void 0:b1.static)!=null?g1:"Static")+"",ea,yf,Yl,Zs,Js,zf,Ql,Di,$s,xs,Wf,ta,eo,to,sn,Gf,Vf,lo,hs,on,Kf,no=((M1=(w1=(k1=e[1].conf)==null?void 0:k1.network)==null?void 0:w1.tick_mdns)!=null?M1:"mDNS")+"",la,Yf,bs,Qf,On,io=((N1=(C1=(S1=e[1].conf)==null?void 0:S1.network)==null?void 0:C1.ntp)!=null?N1:"NTP")+"",na,Xf,qi,an,Zf,so=((E1=(P1=(T1=e[1].conf)==null?void 0:T1.network)==null?void 0:P1.tick_ntp_dhcp)!=null?E1:"from DHCP")+"",ia,Jf,$f,oo,In,xf,$t,ao,fo=((q1=(D1=(A1=e[1].conf)==null?void 0:A1.mqtt)==null?void 0:D1.title)!=null?q1:"MQTT")+"",sa,eu,Oi,tu,lu,gs,nu,fn,uo=((L1=(I1=(O1=e[1].conf)==null?void 0:O1.mqtt)==null?void 0:I1.server)!=null?L1:"Server")+"",oa,iu,aa,su,ou,Ii,Ln,au,un,fu,fa,ii,ro=((B1=(F1=(R1=e[1].conf)==null?void 0:R1.mqtt)==null?void 0:F1.user)!=null?B1:"Username")+"",ua,uu,ru,Rn,cu,si,co=((H1=(j1=(U1=e[1].conf)==null?void 0:U1.mqtt)==null?void 0:j1.pass)!=null?H1:"Password")+"",ra,_u,mu,Fn,pu,Li,Ri,_o=((W1=(z1=(y1=e[1].conf)==null?void 0:y1.mqtt)==null?void 0:z1.id)!=null?W1:"Client ID")+"",ca,du,vu,Bn,hu,Fi,mo=((K1=(V1=(G1=e[1].conf)==null?void 0:G1.mqtt)==null?void 0:V1.payload)!=null?K1:"Payload")+"",_a,bu,gu,pl,Bi,Ui,ji,po=((Z1=(X1=(Q1=(Y1=e[1].conf)==null?void 0:Y1.mqtt)==null?void 0:Q1.domoticz)==null?void 0:X1.title)!=null?Z1:"Domoticz")+"",ma,Hi,vo=((e0=(x1=($1=(J1=e[1].conf)==null?void 0:J1.mqtt)==null?void 0:$1.ha)==null?void 0:x1.title)!=null?e0:"Home-Assistant")+"",pa,yi,zi,Wi,Gi,ku,oi,ho=((n0=(l0=(t0=e[1].conf)==null?void 0:t0.mqtt)==null?void 0:l0.publish)!=null?n0:"Publish topic")+"",da,wu,Mu,Un,Su,va,ha,ba,ga=e[4].p.r.startsWith("NO")||e[4].p.r.startsWith("10YNO")||e[4].p.r.startsWith("10Y1001A1001A4"),ka,wn,bo,go=((o0=(s0=(i0=e[1].conf)==null?void 0:i0.ui)==null?void 0:s0.title)!=null?o0:"User interface")+"",wa,Cu,Vi,Nu,Tu,ks,Pu,ai,Ma,Ki,ko=((u0=(f0=(a0=e[1].conf)==null?void 0:a0.ui)==null?void 0:f0.lang)!=null?u0:"Language")+"",Sa,Eu,rn,Au,Ca,Xl,wo,Mo=((_0=(c0=(r0=e[1].conf)==null?void 0:r0.debug)==null?void 0:c0.title)!=null?_0:"Debugging")+"",Na,Du,Yi,qu,ws,Ou,So,Ms,cn,Iu,Co=((d0=(p0=(m0=e[1].conf)==null?void 0:m0.debug)==null?void 0:p0.enable)!=null?d0:"Enable debugging")+"",Ta,Lu,Ru,Zn,Pa,Qi,No=((h0=(v0=e[1].conf)==null?void 0:v0.btn_reset)!=null?h0:"Factory reset")+"",Ea,Fu,To,Xi,Po=((g0=(b0=e[1].btn)==null?void 0:b0.reboot)!=null?g0:"Reboot")+"",Aa,Bu,Eo,Ss,Ao=((w0=(k0=e[1].btn)==null?void 0:k0.save)!=null?w0:"Save")+"",Da,qa,fi,Oa,ui,Ia,ri,La,ci,Xe,Ra,Uu;R=new I4({});let Zl=!e[4].p.t&&v2(),Iv=["NOK","SEK","DKK","EUR","CHF"],Cs=[];for(let G=0;G<5;G+=1)Cs[G]=z4(y4(e,Iv,G));lt=new nn({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[W4]},$$scope:{ctx:e}}});let Dl=e[4].p.e&&e[0].chip!="esp8266"&&h2(e),ql=e[4].g.s>0&&b2(e);function ju(G,_e){return G[4].m.a===2?V4:G4}let Do=ju(e),Mn=Do(e),Ol=e[4].m.e.e&&g2(e),Il=e[4].m.e.e&&k2(e),Ll=e[4].m.m.e&&w2(e),Rl=e[0].if&&e[0].if.eth&&M2(e),Fl=(e[4].n.c==1||e[4].n.c==2)&&S2(e);Di=new qv({});let Bl=e[4].n.m=="static"&&C2(e),Ul=e[0].chip!="esp8266"&&N2(e),sl=e[4].q.s.e&&T2(e),jl=e[4].q.m==3&&P2(e),Hl=e[4].q.m==4&&E2(e),ol=e[4].c.es!=null&&A2(e),yl=ga&&O2(e),Zi=e[9],vl=[];for(let G=0;G20||e[0].chip=="esp8266"||e[4].i.d.d>0)&&F2(e),zl=e[4].d.s&&W2(e);return fi=new kl({props:{active:e[2],message:(C0=(S0=(M0=e[1].conf)==null?void 0:M0.mask)==null?void 0:S0.loading)!=null?C0:"Loading"}}),ui=new kl({props:{active:e[3],message:(P0=(T0=(N0=e[1].conf)==null?void 0:N0.mask)==null?void 0:T0.saving)!=null?P0:"Saving"}}),ri=new kl({props:{active:e[6],message:(D0=(A0=(E0=e[1].conf)==null?void 0:E0.mask)==null?void 0:A0.reset)!=null?D0:"Factory reset"}}),ci=new kl({props:{active:e[7],message:(I0=(O0=(q0=e[1].conf)==null?void 0:q0.mask)==null?void 0:O0.reset_done)!=null?I0:"Done"}}),{c(){var G,_e,el;t=m("form"),l=m("div"),n=m("div"),i=m("strong"),f=k(o),r=b(),c=m("a"),a=k("\u24D8"),_=b(),p=m("input"),v=b(),d=m("div"),h=m("div"),g=m("div"),A=k(M),I=m("br"),q=b(),L=m("input"),O=b(),U=m("div"),B=k(E),z=m("br"),W=b(),F=m("select"),Ne(R.$$.fragment),K=b(),y=m("input"),H=b(),Y=m("div"),X=m("div"),J=m("div"),ce=k($),ie=m("br"),oe=b(),ae=m("select"),se=m("optgroup"),Zl&&Zl.c(),x=m("option"),x.textContent="NO1",me=m("option"),me.textContent="NO2",pe=m("option"),pe.textContent="NO3",V=m("option"),V.textContent="NO4",Z=m("option"),Z.textContent="NO5",ge=m("optgroup"),ve=m("option"),ve.textContent="SE1",S=m("option"),S.textContent="SE2",w=m("option"),w.textContent="SE3",N=m("option"),N.textContent="SE4",D=m("optgroup"),j=m("option"),j.textContent="DK1",te=m("option"),te.textContent="DK2",le=m("option"),le.textContent="Austria",fe=m("option"),fe.textContent="Belgium",de=m("option"),de.textContent="Czech Republic",qe=m("option"),qe.textContent="Estonia",Pe=m("option"),Pe.textContent="Finland",we=m("option"),we.textContent="France",Fe=m("option"),Fe.textContent="Germany",Ae=m("option"),Ae.textContent="Great Britain",ke=m("option"),ke.textContent="Latvia",De=m("option"),De.textContent="Lithuania",He=m("option"),He.textContent="Netherland",Oe=m("option"),Oe.textContent="Poland",je=m("option"),je.textContent="Switzerland",Ye=b(),We=m("div"),xe=k($e),tt=m("br"),Te=b(),ue=m("select");for(let bl=0;bl<5;bl+=1)Cs[bl].c();Ie=b(),kt=m("div"),Ne(lt.$$.fragment),wt=b(),st=m("div"),ot=m("label"),et=m("input"),Nt=b(),At=k(gt),Pt=b(),Dl&&Dl.c(),Be=b(),ye=m("div"),vt=k(It),nt=m("br"),Tt=b(),it=m("select"),at=m("option"),jt=k(rt),Lt=m("option"),yt=k(Ht),Me=m("option"),Rt=k(Ve),Gt=b(),ql&&ql.c(),zt=b(),Dt=m("div"),Zt=k(Kt),tl=m("br"),Jt=b(),ft=m("input"),Ke=b(),ne=m("div"),Ue=m("strong"),St=k(Le),ut=b(),Yt=m("a"),ll=k("\u24D8"),fl=b(),ul=m("input"),Sl=b(),rl=m("input"),Cl=b(),nl=m("div"),dl=k(_l),Nl=m("br"),Tl=b(),Qt=m("select"),Ee=m("option"),Pn=k(qt),Jl=m("option"),En=k(dn),Re=b(),Mn.c(),he=b(),Qe=m("div"),An=k(vn),Hn=m("br"),yn=b(),ml=m("select"),$l=m("option"),$l.textContent="400V (TN)",xl=m("option"),xl.textContent="230V (IT/TT)",zn=b(),en=m("div"),Gl=m("div"),Dn=k(hn),Wn=m("br"),Gn=b(),tn=m("label"),cl=m("input"),Vn=b(),bn=m("span"),bn.textContent="A",Kn=b(),Vl=m("div"),ki=k(ei),fs=m("br"),us=b(),qn=m("label"),Pl=m("input"),rs=b(),ti=m("span"),ti.textContent="kWp",cs=b(),wi=m("div"),_s=b(),gn=m("div"),Yn=m("label"),El=m("input"),ms=b(),Mi=k(li),ps=b(),Ol&&Ol.c(),ds=b(),Il&&Il.c(),Si=b(),Qn=m("label"),Al=m("input"),Pf=b(),Yo=k(js),Ef=b(),Ll&&Ll.c(),Af=b(),Kl=m("div"),Hs=m("strong"),Qo=k(ys),Df=b(),Ci=m("a"),qf=k("\u24D8"),Of=b(),vs=m("input"),If=b(),zs=m("div"),ln=m("select"),Ni=m("option"),Xo=k(Ws),Ti=m("option"),Zo=k(Gs),Rl&&Rl.c(),Lf=b(),Fl&&Fl.c(),Rf=b(),il=m("div"),Vs=m("strong"),Jo=k(Ks),Ff=b(),Pi=m("a"),Bf=k("\u24D8"),Uf=b(),ni=m("div"),$o=k(Ys),jf=m("br"),Hf=b(),Xn=m("div"),kn=m("select"),Ei=m("option"),xo=k(Qs),Ai=m("option"),ea=k(Xs),yf=b(),Yl=m("input"),zf=b(),Ql=m("select"),Ne(Di.$$.fragment),Wf=b(),Bl&&Bl.c(),ta=b(),eo=m("div"),to=m("label"),sn=m("input"),Gf=k(" IPv6"),Vf=b(),lo=m("div"),hs=m("label"),on=m("input"),Kf=b(),la=k(no),Yf=b(),bs=m("input"),Qf=b(),On=m("div"),na=k(io),Xf=b(),qi=m("label"),an=m("input"),Zf=b(),ia=k(so),Jf=m("br"),$f=b(),oo=m("div"),In=m("input"),xf=b(),$t=m("div"),ao=m("strong"),sa=k(fo),eu=b(),Oi=m("a"),tu=k("\u24D8"),lu=b(),gs=m("input"),nu=b(),fn=m("div"),oa=k(uo),iu=b(),Ul&&Ul.c(),aa=b(),su=m("br"),ou=b(),Ii=m("div"),Ln=m("input"),au=b(),un=m("input"),fu=b(),sl&&sl.c(),fa=b(),ii=m("div"),ua=k(ro),uu=m("br"),ru=b(),Rn=m("input"),cu=b(),si=m("div"),ra=k(co),_u=m("br"),mu=b(),Fn=m("input"),pu=b(),Li=m("div"),Ri=m("div"),ca=k(_o),du=m("br"),vu=b(),Bn=m("input"),hu=b(),Fi=m("div"),_a=k(mo),bu=m("br"),gu=b(),pl=m("select"),Bi=m("option"),Bi.textContent="Raw (minimal)",Ui=m("option"),Ui.textContent="Raw (full)",ji=m("option"),ma=k(po),Hi=m("option"),pa=k(vo),yi=m("option"),yi.textContent="JSON (classic)",zi=m("option"),zi.textContent="JSON (multi topic)",Wi=m("option"),Wi.textContent="JSON (flat)",Gi=m("option"),Gi.textContent="HEX dump",ku=b(),oi=m("div"),da=k(ho),wu=m("br"),Mu=b(),Un=m("input"),Su=b(),jl&&jl.c(),va=b(),Hl&&Hl.c(),ha=b(),ol&&ol.c(),ba=b(),yl&&yl.c(),ka=b(),wn=m("div"),bo=m("strong"),wa=k(go),Cu=b(),Vi=m("a"),Nu=k("\u24D8"),Tu=b(),ks=m("input"),Pu=b(),ai=m("div");for(let bl=0;ble[20].call(F)),u(h,"class","flex"),u(d,"class","my-1"),u(y,"type","hidden"),u(y,"name","p"),y.value="true",x.__value="10YNO-1--------2",x.value=x.__value,me.__value="10YNO-2--------T",me.value=me.__value,pe.__value="10YNO-3--------J",pe.value=pe.__value,V.__value="10YNO-4--------9",V.value=V.__value,Z.__value="10Y1001A1001A48H",Z.value=Z.__value,u(se,"label","Norway"),ve.__value="10Y1001A1001A44P",ve.value=ve.__value,S.__value="10Y1001A1001A45N",S.value=S.__value,w.__value="10Y1001A1001A46L",w.value=w.__value,N.__value="10Y1001A1001A47J",N.value=N.__value,u(ge,"label","Sweden"),j.__value="10YDK-1--------W",j.value=j.__value,te.__value="10YDK-2--------M",te.value=te.__value,u(D,"label","Denmark"),le.__value="10YAT-APG------L",le.value=le.__value,fe.__value="10YBE----------2",fe.value=fe.__value,de.__value="10YCZ-CEPS-----N",de.value=de.__value,qe.__value="10Y1001A1001A39I",qe.value=qe.__value,Pe.__value="10YFI-1--------U",Pe.value=Pe.__value,we.__value="10YFR-RTE------C",we.value=we.__value,Fe.__value="10Y1001A1001A83F",Fe.value=Fe.__value,Ae.__value="10YGB----------A",Ae.value=Ae.__value,ke.__value="10YLV-1001A00074",ke.value=ke.__value,De.__value="10YLT-1001A0008Q",De.value=De.__value,He.__value="10YNL----------L",He.value=He.__value,Oe.__value="10YPL-AREA-----S",Oe.value=Oe.__value,je.__value="10YCH-SWISSGRIDZ",je.value=je.__value,u(ae,"name","pr"),u(ae,"class","in-f w-full"),e[4].p.r===void 0&&Ct(()=>e[21].call(ae)),u(J,"class","w-full"),u(ue,"name","pc"),u(ue,"class","in-l"),e[4].p.c===void 0&&Ct(()=>e[22].call(ue)),u(X,"class","flex"),u(Y,"class","my-1"),u(kt,"class","my-1"),u(et,"type","checkbox"),u(et,"name","pe"),et.__value="true",et.value=et.__value,u(et,"class","rounded mb-1"),u(st,"class","my-1"),at.__value=0,at.value=at.__value,Lt.__value=1,Lt.value=Lt.__value,Me.__value=2,Me.value=Me.__value,u(it,"name","gs"),u(it,"class","in-s"),e[4].g.s===void 0&&Ct(()=>e[25].call(it)),u(ye,"class","my-1"),u(ft,"name","gc"),u(ft,"type","text"),u(ft,"pattern","[A-Za-z0-9]+"),u(ft,"placeholder",Mt=(el=(_e=(G=e[1].conf)==null?void 0:G.general)==null?void 0:_e.context_placeholder)!=null?el:"/"),u(ft,"class","in-s"),u(ft,"maxlength","36"),u(Dt,"class","my-1"),u(n,"class","cnt"),u(Ue,"class","text-sm"),u(Yt,"href",Wl("Meter-configuration")),u(Yt,"target","_blank"),u(Yt,"class","float-right"),u(ul,"type","hidden"),u(ul,"name","m"),ul.value="true",u(rl,"type","hidden"),u(rl,"name","mo"),rl.value="1",Ee.__value=0,Ee.value=Ee.__value,Jl.__value=2,Jl.value=Jl.__value,u(Qt,"name","ma"),u(Qt,"class","in-s"),e[4].m.a===void 0&&Ct(()=>e[29].call(Qt)),u(nl,"class","my-1"),$l.__value=2,$l.value=$l.__value,xl.__value=1,xl.value=xl.__value,u(ml,"name","md"),u(ml,"class","in-s"),e[4].m.d===void 0&&Ct(()=>e[35].call(ml)),u(Qe,"class","my-1"),u(cl,"name","mf"),u(cl,"type","number"),u(cl,"min","5"),u(cl,"max","65535"),u(cl,"class","in-f tr w-full"),u(bn,"class","in-post"),u(tn,"class","flex"),u(Gl,"class","mx-1"),u(Pl,"name","mr"),u(Pl,"type","number"),u(Pl,"min","0"),u(Pl,"max","65535"),u(Pl,"class","in-f tr w-full"),u(ti,"class","in-post"),u(qn,"class","flex"),u(Vl,"class","mx-1"),u(en,"class","my-1 flex"),u(wi,"class","my-1"),u(El,"type","checkbox"),u(El,"name","me"),El.__value="true",El.value=El.__value,u(El,"class","rounded mb-1"),u(gn,"class","my-1"),u(Al,"type","checkbox"),u(Al,"name","mm"),Al.__value="true",Al.value=Al.__value,u(Al,"class","rounded mb-1"),u(ne,"class","cnt"),u(Hs,"class","text-sm"),u(Ci,"href",Wl("WiFi-configuration")),u(Ci,"target","_blank"),u(Ci,"class","float-right"),u(vs,"type","hidden"),u(vs,"name","w"),vs.value="true",Ni.__value=1,Ni.value=Ni.__value,Ti.__value=2,Ti.value=Ti.__value,u(ln,"name","nc"),u(ln,"class","in-s"),e[4].n.c===void 0&&Ct(()=>e[46].call(ln)),u(zs,"class","my-1"),u(Kl,"class","cnt"),u(Vs,"class","text-sm"),u(Pi,"href",Wl("Network-configuration")),u(Pi,"target","_blank"),u(Pi,"class","float-right"),Ei.__value="dhcp",Ei.value=Ei.__value,Ai.__value="static",Ai.value=Ai.__value,u(kn,"name","nm"),u(kn,"class","in-f"),e[4].n.m===void 0&&Ct(()=>e[52].call(kn)),u(Yl,"name","ni"),u(Yl,"type","text"),u(Yl,"class","in-m w-full"),Yl.disabled=Zs=e[4].n.m=="dhcp",Yl.required=Js=e[4].n.m=="static",u(Ql,"name","ns"),u(Ql,"class","in-l"),Ql.disabled=$s=e[4].n.m=="dhcp",Ql.required=xs=e[4].n.m=="static",e[4].n.s===void 0&&Ct(()=>e[54].call(Ql)),u(Xn,"class","flex"),u(ni,"class","my-1"),u(sn,"name","nx"),sn.__value="true",sn.value=sn.__value,u(sn,"type","checkbox"),u(sn,"class","rounded mb-1"),u(eo,"class","my-1"),u(on,"name","nd"),on.__value="true",on.value=on.__value,u(on,"type","checkbox"),u(on,"class","rounded mb-1"),u(lo,"class","my-1"),u(bs,"type","hidden"),u(bs,"name","ntp"),bs.value="true",u(an,"name","ntpd"),an.__value="true",an.value=an.__value,u(an,"type","checkbox"),u(an,"class","rounded mb-1"),u(qi,"class","ml-4"),u(In,"name","ntph"),u(In,"type","text"),u(In,"class","in-s"),u(oo,"class","flex"),u(On,"class","my-1"),u(il,"class","cnt"),u(ao,"class","text-sm"),u(Oi,"href",Wl("MQTT-configuration")),u(Oi,"target","_blank"),u(Oi,"class","float-right"),u(gs,"type","hidden"),u(gs,"name","q"),gs.value="true",u(Ln,"name","qh"),u(Ln,"type","text"),u(Ln,"class","in-f w-2/3"),u(un,"name","qp"),u(un,"type","number"),u(un,"min","1024"),u(un,"max","65535"),u(un,"class","in-l tr w-1/3"),u(Ii,"class","flex"),u(fn,"class","my-1"),u(Rn,"name","qu"),u(Rn,"type","text"),u(Rn,"class","in-s"),u(ii,"class","my-1"),u(Fn,"name","qa"),u(Fn,"type","password"),u(Fn,"class","in-s"),u(si,"class","my-1"),u(Bn,"name","qc"),u(Bn,"type","text"),u(Bn,"class","in-f w-full"),Bi.__value=1,Bi.value=Bi.__value,Ui.__value=2,Ui.value=Ui.__value,ji.__value=3,ji.value=ji.__value,Hi.__value=4,Hi.value=Hi.__value,yi.__value=0,yi.value=yi.__value,zi.__value=5,zi.value=zi.__value,Wi.__value=6,Wi.value=Wi.__value,Gi.__value=255,Gi.value=Gi.__value,u(pl,"name","qm"),u(pl,"class","in-l"),e[4].q.m===void 0&&Ct(()=>e[68].call(pl)),u(Li,"class","my-1 flex"),u(Un,"name","qb"),u(Un,"type","text"),u(Un,"class","in-s"),u(oi,"class","my-1"),u($t,"class","cnt"),u(bo,"class","text-sm"),u(Vi,"href",Wl("User-interface")),u(Vi,"target","_blank"),u(Vi,"class","float-right"),u(ks,"type","hidden"),u(ks,"name","u"),ks.value="true",u(rn,"name","ulang"),u(rn,"class","in-s"),e[4].u.lang===void 0&&Ct(()=>e[83].call(rn)),u(Ki,"class","w-1/2"),u(ai,"class","flex flex-wrap"),u(wn,"class","cnt"),u(wo,"class","text-sm"),u(Yi,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Yi,"target","_blank"),u(Yi,"class","float-right"),u(ws,"type","hidden"),u(ws,"name","d"),ws.value="true",u(cn,"type","checkbox"),u(cn,"name","ds"),cn.__value="true",cn.value=cn.__value,u(cn,"class","rounded mb-1"),u(So,"class","mt-3"),u(Xl,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Qi,"type","button"),u(Qi,"class","btn-red"),u(Xi,"type","button"),u(Xi,"class","btn-yellow"),u(To,"class","text-center"),u(Ss,"type","submit"),u(Ss,"class","btn-pri"),u(Eo,"class","text-right"),u(Zn,"class","grid grid-cols-3 mt-3"),u(t,"autocomplete","off")},m(G,_e){P(G,t,_e),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(c,a),s(n,_),s(n,p),s(n,v),s(n,d),s(d,h),s(h,g),s(g,A),s(g,I),s(g,q),s(g,L),be(L,e[4].g.h),s(h,O),s(h,U),s(U,B),s(U,z),s(U,W),s(U,F),Se(R,F,null),Je(F,e[4].g.t,!0),s(n,K),s(n,y),s(n,H),s(n,Y),s(Y,X),s(X,J),s(J,ce),s(J,ie),s(J,oe),s(J,ae),s(ae,se),Zl&&Zl.m(se,null),s(se,x),s(se,me),s(se,pe),s(se,V),s(se,Z),s(ae,ge),s(ge,ve),s(ge,S),s(ge,w),s(ge,N),s(ae,D),s(D,j),s(D,te),s(ae,le),s(ae,fe),s(ae,de),s(ae,qe),s(ae,Pe),s(ae,we),s(ae,Fe),s(ae,Ae),s(ae,ke),s(ae,De),s(ae,He),s(ae,Oe),s(ae,je),Je(ae,e[4].p.r,!0),s(X,Ye),s(X,We),s(We,xe),s(We,tt),s(We,Te),s(We,ue);for(let el=0;el<5;el+=1)Cs[el]&&Cs[el].m(ue,null);Je(ue,e[4].p.c,!0),s(n,Ie),s(n,kt),Se(lt,kt,null),s(n,wt),s(n,st),s(st,ot),s(ot,et),et.checked=e[4].p.e,s(ot,Nt),s(ot,At),s(st,Pt),Dl&&Dl.m(st,null),s(n,Be),s(n,ye),s(ye,vt),s(ye,nt),s(ye,Tt),s(ye,it),s(it,at),s(at,jt),s(it,Lt),s(Lt,yt),s(it,Me),s(Me,Rt),Je(it,e[4].g.s,!0),s(n,Gt),ql&&ql.m(n,null),s(n,zt),s(n,Dt),s(Dt,Zt),s(Dt,tl),s(Dt,Jt),s(Dt,ft),be(ft,e[4].g.c),s(l,Ke),s(l,ne),s(ne,Ue),s(Ue,St),s(ne,ut),s(ne,Yt),s(Yt,ll),s(ne,fl),s(ne,ul),s(ne,Sl),s(ne,rl),s(ne,Cl),s(ne,nl),s(nl,dl),s(nl,Nl),s(nl,Tl),s(nl,Qt),s(Qt,Ee),s(Ee,Pn),s(Qt,Jl),s(Jl,En),Je(Qt,e[4].m.a,!0),s(ne,Re),Mn.m(ne,null),s(ne,he),s(ne,Qe),s(Qe,An),s(Qe,Hn),s(Qe,yn),s(Qe,ml),s(ml,$l),s(ml,xl),Je(ml,e[4].m.d,!0),s(ne,zn),s(ne,en),s(en,Gl),s(Gl,Dn),s(Gl,Wn),s(Gl,Gn),s(Gl,tn),s(tn,cl),be(cl,e[4].m.f),s(tn,Vn),s(tn,bn),s(en,Kn),s(en,Vl),s(Vl,ki),s(Vl,fs),s(Vl,us),s(Vl,qn),s(qn,Pl),be(Pl,e[4].m.r),s(qn,rs),s(qn,ti),s(ne,cs),s(ne,wi),s(ne,_s),s(ne,gn),s(gn,Yn),s(Yn,El),El.checked=e[4].m.e.e,s(Yn,ms),s(Yn,Mi),s(gn,ps),Ol&&Ol.m(gn,null),s(ne,ds),Il&&Il.m(ne,null),s(ne,Si),s(ne,Qn),s(Qn,Al),Al.checked=e[4].m.m.e,s(Qn,Pf),s(Qn,Yo),s(ne,Ef),Ll&&Ll.m(ne,null),s(l,Af),s(l,Kl),s(Kl,Hs),s(Hs,Qo),s(Kl,Df),s(Kl,Ci),s(Ci,qf),s(Kl,Of),s(Kl,vs),s(Kl,If),s(Kl,zs),s(zs,ln),s(ln,Ni),s(Ni,Xo),s(ln,Ti),s(Ti,Zo),Rl&&Rl.m(ln,null),Je(ln,e[4].n.c,!0),s(Kl,Lf),Fl&&Fl.m(Kl,null),s(l,Rf),s(l,il),s(il,Vs),s(Vs,Jo),s(il,Ff),s(il,Pi),s(Pi,Bf),s(il,Uf),s(il,ni),s(ni,$o),s(ni,jf),s(ni,Hf),s(ni,Xn),s(Xn,kn),s(kn,Ei),s(Ei,xo),s(kn,Ai),s(Ai,ea),Je(kn,e[4].n.m,!0),s(Xn,yf),s(Xn,Yl),be(Yl,e[4].n.i),s(Xn,zf),s(Xn,Ql),Se(Di,Ql,null),Je(Ql,e[4].n.s,!0),s(il,Wf),Bl&&Bl.m(il,null),s(il,ta),s(il,eo),s(eo,to),s(to,sn),sn.checked=e[4].n.x,s(to,Gf),s(il,Vf),s(il,lo),s(lo,hs),s(hs,on),on.checked=e[4].n.d,s(hs,Kf),s(hs,la),s(il,Yf),s(il,bs),s(il,Qf),s(il,On),s(On,na),s(On,Xf),s(On,qi),s(qi,an),an.checked=e[4].n.h,s(qi,Zf),s(qi,ia),s(On,Jf),s(On,$f),s(On,oo),s(oo,In),be(In,e[4].n.n1),s(l,xf),s(l,$t),s($t,ao),s(ao,sa),s($t,eu),s($t,Oi),s(Oi,tu),s($t,lu),s($t,gs),s($t,nu),s($t,fn),s(fn,oa),s(fn,iu),Ul&&Ul.m(fn,null),s(fn,aa),s(fn,su),s(fn,ou),s(fn,Ii),s(Ii,Ln),be(Ln,e[4].q.h),s(Ii,au),s(Ii,un),be(un,e[4].q.p),s($t,fu),sl&&sl.m($t,null),s($t,fa),s($t,ii),s(ii,ua),s(ii,uu),s(ii,ru),s(ii,Rn),be(Rn,e[4].q.u),s($t,cu),s($t,si),s(si,ra),s(si,_u),s(si,mu),s(si,Fn),be(Fn,e[4].q.a),s($t,pu),s($t,Li),s(Li,Ri),s(Ri,ca),s(Ri,du),s(Ri,vu),s(Ri,Bn),be(Bn,e[4].q.c),s(Li,hu),s(Li,Fi),s(Fi,_a),s(Fi,bu),s(Fi,gu),s(Fi,pl),s(pl,Bi),s(pl,Ui),s(pl,ji),s(ji,ma),s(pl,Hi),s(Hi,pa),s(pl,yi),s(pl,zi),s(pl,Wi),s(pl,Gi),Je(pl,e[4].q.m,!0),s($t,ku),s($t,oi),s(oi,da),s(oi,wu),s(oi,Mu),s(oi,Un),be(Un,e[4].q.b),s(l,Su),jl&&jl.m(l,null),s(l,va),Hl&&Hl.m(l,null),s(l,ha),ol&&ol.m(l,null),s(l,ba),yl&&yl.m(l,null),s(l,ka),s(l,wn),s(wn,bo),s(bo,wa),s(wn,Cu),s(wn,Vi),s(Vi,Nu),s(wn,Tu),s(wn,ks),s(wn,Pu),s(wn,ai);for(let el=0;el0?ql?ql.p(G,_e):(ql=b2(G),ql.c(),ql.m(n,zt)):ql&&(ql.d(1),ql=null),(!Xe||_e[0]&2)&&Kt!==(Kt=((vc=(dc=(pc=G[1].conf)==null?void 0:pc.general)==null?void 0:dc.context)!=null?vc:"Context")+"")&&C(Zt,Kt),(!Xe||_e[0]&2&&Mt!==(Mt=(gc=(bc=(hc=G[1].conf)==null?void 0:hc.general)==null?void 0:bc.context_placeholder)!=null?gc:"/"))&&u(ft,"placeholder",Mt),_e[0]&16&&ft.value!==G[4].g.c&&be(ft,G[4].g.c),(!Xe||_e[0]&2)&&Le!==(Le=((Mc=(wc=(kc=G[1].conf)==null?void 0:kc.meter)==null?void 0:wc.title)!=null?Mc:"Meter")+"")&&C(St,Le),(!Xe||_e[0]&2)&&_l!==(_l=((Tc=(Nc=(Cc=(Sc=G[1].conf)==null?void 0:Sc.meter)==null?void 0:Cc.comm)==null?void 0:Nc.title)!=null?Tc:"Communication")+"")&&C(dl,_l),(!Xe||_e[0]&2)&&qt!==(qt=((Dc=(Ac=(Ec=(Pc=G[1].conf)==null?void 0:Pc.meter)==null?void 0:Ec.comm)==null?void 0:Ac.passive)!=null?Dc:"Passive")+"")&&C(Pn,qt),(!Xe||_e[0]&2)&&dn!==(dn=((Lc=(Ic=(Oc=(qc=G[1].conf)==null?void 0:qc.meter)==null?void 0:Oc.comm)==null?void 0:Ic.pulse)!=null?Lc:"Pulse")+"")&&C(En,dn),_e[0]&16&&Je(Qt,G[4].m.a),Do===(Do=ju(G))&&Mn?Mn.p(G,_e):(Mn.d(1),Mn=Do(G),Mn&&(Mn.c(),Mn.m(ne,he))),(!Xe||_e[0]&2)&&vn!==(vn=((Fc=(Rc=G[1].common)==null?void 0:Rc.voltage)!=null?Fc:"Voltage")+"")&&C(An,vn),_e[0]&16&&Je(ml,G[4].m.d),(!Xe||_e[0]&2)&&hn!==(hn=((jc=(Uc=(Bc=G[1].conf)==null?void 0:Bc.meter)==null?void 0:Uc.fuse)!=null?jc:"Main fuse")+"")&&C(Dn,hn),_e[0]&16&&Ze(cl.value)!==G[4].m.f&&be(cl,G[4].m.f),(!Xe||_e[0]&2)&&ei!==(ei=((zc=(yc=(Hc=G[1].conf)==null?void 0:Hc.meter)==null?void 0:yc.prod)!=null?zc:"Production")+"")&&C(ki,ei),_e[0]&16&&Ze(Pl.value)!==G[4].m.r&&be(Pl,G[4].m.r),_e[0]&16&&(El.checked=G[4].m.e.e),(!Xe||_e[0]&2)&&li!==(li=((Vc=(Gc=(Wc=G[1].conf)==null?void 0:Wc.meter)==null?void 0:Gc.encrypted)!=null?Vc:"Encrypted")+"")&&C(Mi,li),G[4].m.e.e?Ol?Ol.p(G,_e):(Ol=g2(G),Ol.c(),Ol.m(gn,null)):Ol&&(Ol.d(1),Ol=null),G[4].m.e.e?Il?Il.p(G,_e):(Il=k2(G),Il.c(),Il.m(ne,Si)):Il&&(Il.d(1),Il=null),_e[0]&16&&(Al.checked=G[4].m.m.e),(!Xe||_e[0]&2)&&js!==(js=((Xc=(Qc=(Yc=(Kc=G[1].conf)==null?void 0:Kc.meter)==null?void 0:Yc.multipliers)==null?void 0:Qc.title)!=null?Xc:"Multipliers")+"")&&C(Yo,js),G[4].m.m.e?Ll?Ll.p(G,_e):(Ll=w2(G),Ll.c(),Ll.m(ne,null)):Ll&&(Ll.d(1),Ll=null),(!Xe||_e[0]&2)&&ys!==(ys=(($c=(Jc=(Zc=G[1].conf)==null?void 0:Zc.connection)==null?void 0:Jc.title)!=null?$c:"Connection")+"")&&C(Qo,ys),(!Xe||_e[0]&2)&&Ws!==(Ws=((t_=(e_=(xc=G[1].conf)==null?void 0:xc.connection)==null?void 0:e_.wifi)!=null?t_:"WiFi")+"")&&C(Xo,Ws),(!Xe||_e[0]&2)&&Gs!==(Gs=((i_=(n_=(l_=G[1].conf)==null?void 0:l_.connection)==null?void 0:n_.ap)!=null?i_:"AP")+"")&&C(Zo,Gs),G[0].if&&G[0].if.eth?Rl?Rl.p(G,_e):(Rl=M2(G),Rl.c(),Rl.m(ln,null)):Rl&&(Rl.d(1),Rl=null),_e[0]&16&&Je(ln,G[4].n.c),G[4].n.c==1||G[4].n.c==2?Fl?Fl.p(G,_e):(Fl=S2(G),Fl.c(),Fl.m(Kl,null)):Fl&&(Fl.d(1),Fl=null),(!Xe||_e[0]&2)&&Ks!==(Ks=((a_=(o_=(s_=G[1].conf)==null?void 0:s_.network)==null?void 0:o_.title)!=null?a_:"Network")+"")&&C(Jo,Ks),(!Xe||_e[0]&2)&&Ys!==(Ys=((r_=(u_=(f_=G[1].conf)==null?void 0:f_.network)==null?void 0:u_.ip)!=null?r_:"IP")+"")&&C($o,Ys),(!Xe||_e[0]&2)&&Qs!==(Qs=((m_=(__=(c_=G[1].conf)==null?void 0:c_.network)==null?void 0:__.dhcp)!=null?m_:"DHCP")+"")&&C(xo,Qs),(!Xe||_e[0]&2)&&Xs!==(Xs=((v_=(d_=(p_=G[1].conf)==null?void 0:p_.network)==null?void 0:d_.static)!=null?v_:"Static")+"")&&C(ea,Xs),_e[0]&16&&Je(kn,G[4].n.m),(!Xe||_e[0]&16&&Zs!==(Zs=G[4].n.m=="dhcp"))&&(Yl.disabled=Zs),(!Xe||_e[0]&16&&Js!==(Js=G[4].n.m=="static"))&&(Yl.required=Js),_e[0]&16&&Yl.value!==G[4].n.i&&be(Yl,G[4].n.i),(!Xe||_e[0]&16&&$s!==($s=G[4].n.m=="dhcp"))&&(Ql.disabled=$s),(!Xe||_e[0]&16&&xs!==(xs=G[4].n.m=="static"))&&(Ql.required=xs),_e[0]&16&&Je(Ql,G[4].n.s),G[4].n.m=="static"?Bl?Bl.p(G,_e):(Bl=C2(G),Bl.c(),Bl.m(il,ta)):Bl&&(Bl.d(1),Bl=null),_e[0]&16&&(sn.checked=G[4].n.x),_e[0]&16&&(on.checked=G[4].n.d),(!Xe||_e[0]&2)&&no!==(no=((g_=(b_=(h_=G[1].conf)==null?void 0:h_.network)==null?void 0:b_.tick_mdns)!=null?g_:"mDNS")+"")&&C(la,no),(!Xe||_e[0]&2)&&io!==(io=((M_=(w_=(k_=G[1].conf)==null?void 0:k_.network)==null?void 0:w_.ntp)!=null?M_:"NTP")+"")&&C(na,io),_e[0]&16&&(an.checked=G[4].n.h),(!Xe||_e[0]&2)&&so!==(so=((N_=(C_=(S_=G[1].conf)==null?void 0:S_.network)==null?void 0:C_.tick_ntp_dhcp)!=null?N_:"from DHCP")+"")&&C(ia,so),_e[0]&16&&In.value!==G[4].n.n1&&be(In,G[4].n.n1),(!Xe||_e[0]&2)&&fo!==(fo=((E_=(P_=(T_=G[1].conf)==null?void 0:T_.mqtt)==null?void 0:P_.title)!=null?E_:"MQTT")+"")&&C(sa,fo),(!Xe||_e[0]&2)&&uo!==(uo=((q_=(D_=(A_=G[1].conf)==null?void 0:A_.mqtt)==null?void 0:D_.server)!=null?q_:"Server")+"")&&C(oa,uo),G[0].chip!="esp8266"?Ul?Ul.p(G,_e):(Ul=N2(G),Ul.c(),Ul.m(fn,aa)):Ul&&(Ul.d(1),Ul=null),_e[0]&16&&Ln.value!==G[4].q.h&&be(Ln,G[4].q.h),_e[0]&16&&Ze(un.value)!==G[4].q.p&&be(un,G[4].q.p),G[4].q.s.e?sl?(sl.p(G,_e),_e[0]&16&&Q(sl,1)):(sl=T2(G),sl.c(),Q(sl,1),sl.m($t,fa)):sl&&(pt(),ee(sl,1,1,()=>{sl=null}),dt()),(!Xe||_e[0]&2)&&ro!==(ro=((L_=(I_=(O_=G[1].conf)==null?void 0:O_.mqtt)==null?void 0:I_.user)!=null?L_:"Username")+"")&&C(ua,ro),_e[0]&16&&Rn.value!==G[4].q.u&&be(Rn,G[4].q.u),(!Xe||_e[0]&2)&&co!==(co=((B_=(F_=(R_=G[1].conf)==null?void 0:R_.mqtt)==null?void 0:F_.pass)!=null?B_:"Password")+"")&&C(ra,co),_e[0]&16&&Fn.value!==G[4].q.a&&be(Fn,G[4].q.a),(!Xe||_e[0]&2)&&_o!==(_o=((H_=(j_=(U_=G[1].conf)==null?void 0:U_.mqtt)==null?void 0:j_.id)!=null?H_:"Client ID")+"")&&C(ca,_o),_e[0]&16&&Bn.value!==G[4].q.c&&be(Bn,G[4].q.c),(!Xe||_e[0]&2)&&mo!==(mo=((W_=(z_=(y_=G[1].conf)==null?void 0:y_.mqtt)==null?void 0:z_.payload)!=null?W_:"Payload")+"")&&C(_a,mo),(!Xe||_e[0]&2)&&po!==(po=((Y_=(K_=(V_=(G_=G[1].conf)==null?void 0:G_.mqtt)==null?void 0:V_.domoticz)==null?void 0:K_.title)!=null?Y_:"Domoticz")+"")&&C(ma,po),(!Xe||_e[0]&2)&&vo!==(vo=((J_=(Z_=(X_=(Q_=G[1].conf)==null?void 0:Q_.mqtt)==null?void 0:X_.ha)==null?void 0:Z_.title)!=null?J_:"Home-Assistant")+"")&&C(pa,vo),_e[0]&16&&Je(pl,G[4].q.m),(!Xe||_e[0]&2)&&ho!==(ho=((em=(x_=($_=G[1].conf)==null?void 0:$_.mqtt)==null?void 0:x_.publish)!=null?em:"Publish topic")+"")&&C(da,ho),_e[0]&16&&Un.value!==G[4].q.b&&be(Un,G[4].q.b),G[4].q.m==3?jl?jl.p(G,_e):(jl=P2(G),jl.c(),jl.m(l,va)):jl&&(jl.d(1),jl=null),G[4].q.m==4?Hl?Hl.p(G,_e):(Hl=E2(G),Hl.c(),Hl.m(l,ha)):Hl&&(Hl.d(1),Hl=null),G[4].c.es!=null?ol?(ol.p(G,_e),_e[0]&16&&Q(ol,1)):(ol=A2(G),ol.c(),Q(ol,1),ol.m(l,ba)):ol&&(pt(),ee(ol,1,1,()=>{ol=null}),dt()),_e[0]&16&&(ga=G[4].p.r.startsWith("NO")||G[4].p.r.startsWith("10YNO")||G[4].p.r.startsWith("10Y1001A1001A4")),ga?yl?yl.p(G,_e):(yl=O2(G),yl.c(),yl.m(l,ka)):yl&&(yl.d(1),yl=null),(!Xe||_e[0]&2)&&go!==(go=((nm=(lm=(tm=G[1].conf)==null?void 0:tm.ui)==null?void 0:lm.title)!=null?nm:"User interface")+"")&&C(wa,go),_e[0]&530){Zi=G[9];let Wt;for(Wt=0;Wt20||G[0].chip=="esp8266"||G[4].i.d.d>0?al?(al.p(G,_e),_e[0]&17&&Q(al,1)):(al=F2(G),al.c(),Q(al,1),al.m(l,Ca)):al&&(pt(),ee(al,1,1,()=>{al=null}),dt()),(!Xe||_e[0]&2)&&Mo!==(Mo=((um=(fm=(am=G[1].conf)==null?void 0:am.debug)==null?void 0:fm.title)!=null?um:"Debugging")+"")&&C(Na,Mo),_e[0]&16&&(cn.checked=G[4].d.s),(!Xe||_e[0]&2)&&Co!==(Co=((_m=(cm=(rm=G[1].conf)==null?void 0:rm.debug)==null?void 0:cm.enable)!=null?_m:"Enable debugging")+"")&&C(Ta,Co),G[4].d.s?zl?zl.p(G,_e):(zl=W2(G),zl.c(),zl.m(Xl,null)):zl&&(zl.d(1),zl=null),(!Xe||_e[0]&2)&&No!==(No=((pm=(mm=G[1].conf)==null?void 0:mm.btn_reset)!=null?pm:"Factory reset")+"")&&C(Ea,No),(!Xe||_e[0]&2)&&Po!==(Po=((vm=(dm=G[1].btn)==null?void 0:dm.reboot)!=null?vm:"Reboot")+"")&&C(Aa,Po),(!Xe||_e[0]&2)&&Ao!==(Ao=((bm=(hm=G[1].btn)==null?void 0:hm.save)!=null?bm:"Save")+"")&&C(Da,Ao);const bl={};_e[0]&4&&(bl.active=G[2]),_e[0]&2&&(bl.message=(wm=(km=(gm=G[1].conf)==null?void 0:gm.mask)==null?void 0:km.loading)!=null?wm:"Loading"),fi.$set(bl);const Fa={};_e[0]&8&&(Fa.active=G[3]),_e[0]&2&&(Fa.message=(Cm=(Sm=(Mm=G[1].conf)==null?void 0:Mm.mask)==null?void 0:Sm.saving)!=null?Cm:"Saving"),ui.$set(Fa);const Ba={};_e[0]&64&&(Ba.active=G[6]),_e[0]&2&&(Ba.message=(Pm=(Tm=(Nm=G[1].conf)==null?void 0:Nm.mask)==null?void 0:Tm.reset)!=null?Pm:"Factory reset"),ri.$set(Ba);const Ua={};_e[0]&128&&(Ua.active=G[7]),_e[0]&2&&(Ua.message=(Dm=(Am=(Em=G[1].conf)==null?void 0:Em.mask)==null?void 0:Am.reset_done)!=null?Dm:"Done"),ci.$set(Ua)},i(G){Xe||(Q(R.$$.fragment,G),Q(lt.$$.fragment,G),Q(Di.$$.fragment,G),Q(sl),Q(ol),Q(al),Q(fi.$$.fragment,G),Q(ui.$$.fragment,G),Q(ri.$$.fragment,G),Q(ci.$$.fragment,G),Xe=!0)},o(G){ee(R.$$.fragment,G),ee(lt.$$.fragment,G),ee(Di.$$.fragment,G),ee(sl),ee(ol),ee(al),ee(fi.$$.fragment,G),ee(ui.$$.fragment,G),ee(ri.$$.fragment,G),ee(ci.$$.fragment,G),Xe=!1},d(G){G&&T(t),Ce(R),Zl&&Zl.d(),Xt(Cs,G),Ce(lt),Dl&&Dl.d(),ql&&ql.d(),Mn.d(),Ol&&Ol.d(),Il&&Il.d(),Ll&&Ll.d(),Rl&&Rl.d(),Fl&&Fl.d(),Ce(Di),Bl&&Bl.d(),Ul&&Ul.d(),sl&&sl.d(),jl&&jl.d(),Hl&&Hl.d(),ol&&ol.d(),yl&&yl.d(),Xt(vl,G),Xt(hl,G),al&&al.d(),zl&&zl.d(),G&&T(qa),Ce(fi,G),G&&T(Oa),Ce(ui,G),G&&T(Ia),Ce(ri,G),G&&T(La),Ce(ci,G),Ra=!1,Et(Uu)}}}async function og(){await(await fetch("reboot",{method:"POST"})).json()}function ag(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(Ke=>{l(1,o=Ke)});let f=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],r=!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,x:!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,lang:"en"},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,es:null}},_=[];Es.subscribe(Ke=>{var ne,Ue;Ke.version&&(l(4,a=Ke),l(2,r=!1),l(5,_=[{code:"en",name:"English"}]),a.u.lang&&a.u.lang!="en"&&_.push({code:a.u.lang,name:(Ue=(ne=o.language)==null?void 0:ne.name)!=null?Ue:"Unknown"}),_.push({code:"hub",name:"Load from server"}))}),S4();let p=!1,v=!1;async function d(){if(confirm("Factory reset?")){l(6,p=!0);const Ke=new URLSearchParams;Ke.append("perform","true");let Ue=await(await fetch("reset",{method:"POST",body:Ke})).json();l(6,p=!1),l(7,v=Ue.success)}}async function h(Ke){l(3,c=!0);const ne=new FormData(Ke.target),Ue=new URLSearchParams;for(let ut of ne){const[Yt,ll]=ut;Ue.append(Yt,ll)}let St=await(await fetch("save",{method:"POST",body:Ue})).json();wl.update(ut=>(ut.hostname=ne.get("gh"),ut.usrcfg=St.success,ut.booting=St.reboot,ne.get("nm")=="static"&&(ut.net.ip=ne.get("ni"),ut.net.mask=ne.get("nu"),ut.net.gw=ne.get("ng"),ut.net.dns1=ne.get("nd")),ut.ui=a.u,ut)),l(3,c=!1),hi(n)}const g=function(){confirm("Reboot?")&&(wl.update(Ke=>(Ke.booting=!0,Ke)),og())};async function M(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.c=!1,ne)))}async function A(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.r=!1,ne)))}async function I(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Es.update(ne=>(ne.q.s.k=!1,ne)))}const q=function(){a.q.s.e?a.q.p==1883&&l(4,a.q.p=8883,a):a.q.p==8883&&l(4,a.q.p=1883,a)};async function L(){if(a.u.lang=="hub"){const Ke=await pn("http://hub.amsleser.no/hub/language/list.json");l(5,_=await Ke.json()),l(4,a.u.lang=o.language.code,a)}}let O=44;function U(){a.g.h=this.value,l(4,a)}function E(){a.g.t=Ft(this),l(4,a)}function B(){a.p.r=Ft(this),l(4,a)}function z(){a.p.c=Ft(this),l(4,a)}function W(){a.p.e=this.checked,l(4,a)}function F(){a.p.t=this.value,l(4,a)}function R(){a.g.s=Ft(this),l(4,a)}function K(){a.g.u=this.value,l(4,a)}function y(){a.g.p=this.value,l(4,a)}function H(){a.g.c=this.value,l(4,a)}function Y(){a.m.a=Ft(this),l(4,a)}function X(){a.m.b=Ze(this.value),l(4,a)}function J(){a.m.i=this.checked,l(4,a)}function $(){a.m.b=Ft(this),l(4,a)}function ce(){a.m.p=Ft(this),l(4,a)}function ie(){a.m.s=Ze(this.value),l(4,a)}function oe(){a.m.d=Ft(this),l(4,a)}function ae(){a.m.f=Ze(this.value),l(4,a)}function se(){a.m.r=Ze(this.value),l(4,a)}function x(){a.m.e.e=this.checked,l(4,a)}function me(){a.m.e.k=this.value,l(4,a)}function pe(){a.m.e.a=this.value,l(4,a)}function V(){a.m.m.e=this.checked,l(4,a)}function Z(){a.m.m.w=Ze(this.value),l(4,a)}function ge(){a.m.m.v=Ze(this.value),l(4,a)}function ve(){a.m.m.a=Ze(this.value),l(4,a)}function S(){a.m.m.c=Ze(this.value),l(4,a)}function w(){a.n.c=Ft(this),l(4,a)}function N(){a.w.s=this.value,l(4,a)}function D(){a.w.p=this.value,l(4,a)}function j(){a.w.z=Ft(this),l(4,a)}function te(){a.w.w=Ze(this.value),l(4,a)}function le(){a.w.b=this.checked,l(4,a)}function fe(){a.n.m=Ft(this),l(4,a)}function de(){a.n.i=this.value,l(4,a)}function qe(){a.n.s=Ft(this),l(4,a)}function Pe(){a.n.g=this.value,l(4,a)}function we(){a.n.d1=this.value,l(4,a)}function Fe(){a.n.d2=this.value,l(4,a)}function Ae(){a.n.x=this.checked,l(4,a)}function ke(){a.n.d=this.checked,l(4,a)}function De(){a.n.h=this.checked,l(4,a)}function He(){a.n.n1=this.value,l(4,a)}function Oe(){a.q.s.e=this.checked,l(4,a)}function je(){a.q.h=this.value,l(4,a)}function Ye(){a.q.p=Ze(this.value),l(4,a)}function We(){a.q.u=this.value,l(4,a)}function $e(){a.q.a=this.value,l(4,a)}function xe(){a.q.c=this.value,l(4,a)}function tt(){a.q.m=Ft(this),l(4,a)}function Te(){a.q.b=this.value,l(4,a)}function ue(){a.o.e=this.value,l(4,a)}function Ie(){a.o.c=this.value,l(4,a)}function kt(){a.o.u1=this.value,l(4,a)}function lt(){a.o.u2=this.value,l(4,a)}function wt(){a.o.u3=this.value,l(4,a)}function st(){a.h.t=this.value,l(4,a)}function ot(){a.h.h=this.value,l(4,a)}function et(){a.h.n=this.value,l(4,a)}function Nt(){a.c.e=this.checked,l(4,a)}function gt(){a.c.es=this.checked,l(4,a)}function At(Ke){a.t.t[Ke]=Ze(this.value),l(4,a)}function Pt(){a.t.h=Ze(this.value),l(4,a)}function Be(Ke){a.u[Ke.key]=Ft(this),l(4,a)}function ye(){a.u.lang=Ft(this),l(4,a)}function It(){a.i.h.p=Ft(this),l(4,a)}function vt(){a.i.h.t=Ft(this),l(4,a)}function nt(){a.i.h.u=this.checked,l(4,a)}function Tt(){a.i.a=Ze(this.value),l(4,a)}function it(){a.i.l.p=Ze(this.value),l(4,a)}function at(){a.i.l.i=this.checked,l(4,a)}function rt(){a.i.r.i=this.checked,l(4,a)}function jt(){a.i.r.r=Ze(this.value),l(4,a)}function Lt(){a.i.r.g=Ze(this.value),l(4,a)}function Ht(){a.i.r.b=Ze(this.value),l(4,a)}function yt(){a.i.d.d=Ze(this.value),l(4,a)}function Me(){a.i.t.d=Ze(this.value),l(4,a)}function Ve(){a.i.t.a=Ze(this.value),l(4,a)}function Rt(){a.i.v.p=Ze(this.value),l(4,a)}function Gt(){a.i.v.d.v=Ze(this.value),l(4,a)}function zt(){a.i.v.d.g=Ze(this.value),l(4,a)}function Dt(){a.i.d.b=Ft(this),l(4,a)}function Kt(){a.i.v.o=Ze(this.value),l(4,a)}function Zt(){a.i.v.m=Ze(this.value),l(4,a)}function tl(){a.i.v.b=Ze(this.value),l(4,a)}function Jt(){a.d.s=this.checked,l(4,a)}function ft(){a.d.t=this.checked,l(4,a)}function Mt(){a.d.l=Ft(this),l(4,a)}return e.$$set=Ke=>{"basepath"in Ke&&l(18,n=Ke.basepath),"sysinfo"in Ke&&l(0,i=Ke.sysinfo)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(8,O=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,r,c,a,_,p,v,O,f,d,h,g,M,A,I,q,L,n,U,E,B,z,W,F,R,K,y,H,Y,X,J,$,ce,ie,oe,ae,se,x,me,pe,V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie,kt,lt,wt,st,ot,et,Nt,gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt,Lt,Ht,yt,Me,Ve,Rt,Gt,zt,Dt,Kt,Zt,tl,Jt,ft,Mt]}class fg extends mt{constructor(t){super(),_t(this,t,ag,sg,ct,{basepath:18,sysinfo:0},null,[-1,-1,-1,-1])}}function V2(e,t,l){const n=e.slice();return n[22]=t[l],n}function ug(e){let t=Ge(e[1].chip,e[1].board)+"",l;return{c(){l=k(t)},m(n,i){P(n,l,i)},p(n,i){i&2&&t!==(t=Ge(n[1].chip,n[1].board)+"")&&C(l,t)},d(n){n&&T(l)}}}function K2(e){var Y,X,J,$,ce,ie,oe,ae,se,x,me,pe;let t,l=((J=(X=(Y=e[3].status)==null?void 0:Y.device)==null?void 0:X.apmac)!=null?J:"AP MAC")+"",n,i,o=e[1].apmac+"",f,r,c,a=((ie=(ce=($=e[3].status)==null?void 0:$.device)==null?void 0:ce.last_boot)!=null?ie:"Last boot")+"",_,p,v,d,h,g,M=((se=(ae=(oe=e[3].status)==null?void 0:oe.device)==null?void 0:ae.reason)!=null?se:"Reason")+"",A,I,q=((pe=(me=(x=e[3][Km(e[1].chip)])==null?void 0:x.reason)==null?void 0:me[e[1].boot_reason])!=null?pe:e[1].boot_reason)+"",L,O,U=e[1].boot_reason+"",E,B,z=e[1].ex_cause+"",W,F,R;const K=[cg,rg],y=[];function H(V,Z){return V[0].u>0?0:1}return v=H(e),d=y[v]=K[v](e),{c(){t=m("div"),n=k(l),i=k(": "),f=k(o),r=b(),c=m("div"),_=k(a),p=k(`: - `),d.c(),h=b(),g=m("div"),A=k(M),I=k(": "),L=k(q),O=k(" ("),E=k(U),B=k("/"),W=k(z),F=k(")"),u(t,"class","my-2"),u(c,"class","my-2"),u(g,"class","my-2")},m(V,Z){P(V,t,Z),s(t,n),s(t,i),s(t,f),P(V,r,Z),P(V,c,Z),s(c,_),s(c,p),y[v].m(c,null),P(V,h,Z),P(V,g,Z),s(g,A),s(g,I),s(g,L),s(g,O),s(g,E),s(g,B),s(g,W),s(g,F),R=!0},p(V,Z){var ve,S,w,N,D,j,te,le,fe,de,qe,Pe;(!R||Z&8)&&l!==(l=((w=(S=(ve=V[3].status)==null?void 0:ve.device)==null?void 0:S.apmac)!=null?w:"AP MAC")+"")&&C(n,l),(!R||Z&2)&&o!==(o=V[1].apmac+"")&&C(f,o),(!R||Z&8)&&a!==(a=((j=(D=(N=V[3].status)==null?void 0:N.device)==null?void 0:D.last_boot)!=null?j:"Last boot")+"")&&C(_,a);let ge=v;v=H(V),v===ge?y[v].p(V,Z):(pt(),ee(y[ge],1,1,()=>{y[ge]=null}),dt(),d=y[v],d?d.p(V,Z):(d=y[v]=K[v](V),d.c()),Q(d,1),d.m(c,null)),(!R||Z&8)&&M!==(M=((fe=(le=(te=V[3].status)==null?void 0:te.device)==null?void 0:le.reason)!=null?fe:"Reason")+"")&&C(A,M),(!R||Z&10)&&q!==(q=((Pe=(qe=(de=V[3][Km(V[1].chip)])==null?void 0:de.reason)==null?void 0:qe[V[1].boot_reason])!=null?Pe:V[1].boot_reason)+"")&&C(L,q),(!R||Z&2)&&U!==(U=V[1].boot_reason+"")&&C(E,U),(!R||Z&2)&&z!==(z=V[1].ex_cause+"")&&C(W,z)},i(V){R||(Q(d),R=!0)},o(V){ee(d),R=!1},d(V){V&&T(t),V&&T(r),V&&T(c),y[v].d(),V&&T(h),V&&T(g)}}}function rg(e){let t;return{c(){t=k("-")},m(l,n){P(l,t,n)},p:ze,i:ze,o:ze,d(l){l&&T(t)}}}function cg(e){let t,l;return t=new Ev({props:{timestamp:new Date(new Date().getTime()-e[0].u*1e3),fullTimeColor:""}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function _g(e){var i,o,f;let t,l=((f=(o=(i=e[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)!=null?f:"Consents")+"",n;return{c(){t=m("span"),n=k(l),u(t,"class","btn-pri-sm")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&8&&l!==(l=((p=(_=(a=r[3].status)==null?void 0:a.device)==null?void 0:_.btn_consents)!=null?p:"Consents")+"")&&C(n,l)},d(r){r&&T(t)}}}function Y2(e){var W,F,R,K,y,H,Y,X,J,$,ce,ie;let t,l,n=((R=(F=(W=e[3].status)==null?void 0:W.meter)==null?void 0:F.title)!=null?R:"Meter")+"",i,o,f,r=((H=(y=(K=e[3].status)==null?void 0:K.meter)==null?void 0:y.manufacturer)!=null?H:"Manufacturer")+"",c,a,_=Go(e[1].meter.mfg)+"",p,v,d,h=((J=(X=(Y=e[3].status)==null?void 0:Y.meter)==null?void 0:X.model)!=null?J:"Model")+"",g,M,A=(e[1].meter.model?e[1].meter.model:"unknown")+"",I,q,L,O=((ie=(ce=($=e[3].status)==null?void 0:$.meter)==null?void 0:ce.id)!=null?ie:"ID")+"",U,E,B=(e[1].meter.id?e[1].meter.id:"unknown")+"",z;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),I=k(A),q=b(),L=m("div"),U=k(O),E=k(": "),z=k(B),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(L,"class","my-2"),u(t,"class","cnt")},m(oe,ae){P(oe,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,I),s(t,q),s(t,L),s(L,U),s(L,E),s(L,z)},p(oe,ae){var se,x,me,pe,V,Z,ge,ve,S,w,N,D;ae&8&&n!==(n=((me=(x=(se=oe[3].status)==null?void 0:se.meter)==null?void 0:x.title)!=null?me:"Meter")+"")&&C(i,n),ae&8&&r!==(r=((Z=(V=(pe=oe[3].status)==null?void 0:pe.meter)==null?void 0:V.manufacturer)!=null?Z:"Manufacturer")+"")&&C(c,r),ae&2&&_!==(_=Go(oe[1].meter.mfg)+"")&&C(p,_),ae&8&&h!==(h=((S=(ve=(ge=oe[3].status)==null?void 0:ge.meter)==null?void 0:ve.model)!=null?S:"Model")+"")&&C(g,h),ae&2&&A!==(A=(oe[1].meter.model?oe[1].meter.model:"unknown")+"")&&C(I,A),ae&8&&O!==(O=((D=(N=(w=oe[3].status)==null?void 0:w.meter)==null?void 0:N.id)!=null?D:"ID")+"")&&C(U,O),ae&2&&B!==(B=(oe[1].meter.id?oe[1].meter.id:"unknown")+"")&&C(z,B)},d(oe){oe&&T(t)}}}function Q2(e){var X,J,$,ce,ie,oe,ae,se,x,me,pe,V;let t,l,n=(($=(J=(X=e[3].status)==null?void 0:X.network)==null?void 0:J.title)!=null?$:"Network")+"",i,o,f,r=((oe=(ie=(ce=e[3].conf)==null?void 0:ce.network)==null?void 0:ie.ip)!=null?oe:"IP")+"",c,a,_=e[1].net.ip+"",p,v,d,h=((x=(se=(ae=e[3].conf)==null?void 0:ae.network)==null?void 0:se.mask)!=null?x:"Mask")+"",g,M,A=e[1].net.mask+"",I,q,L,O=((V=(pe=(me=e[3].conf)==null?void 0:me.network)==null?void 0:pe.gw)!=null?V:"Gateway")+"",U,E,B=e[1].net.gw+"",z,W,F,R,K,y=e[1].net.dns1&&X2(e),H=e[1].net.dns2&&Z2(e),Y=e[1].net.ipv6&&J2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),I=k(A),q=b(),L=m("div"),U=k(O),E=k(": "),z=k(B),W=b(),F=m("div"),y&&y.c(),R=b(),H&&H.c(),K=b(),Y&&Y.c(),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(L,"class","my-2"),u(F,"class","my-2"),u(t,"class","cnt")},m(Z,ge){P(Z,t,ge),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,I),s(t,q),s(t,L),s(L,U),s(L,E),s(L,z),s(t,W),s(t,F),y&&y.m(F,null),s(F,R),H&&H.m(F,null),s(t,K),Y&&Y.m(t,null)},p(Z,ge){var ve,S,w,N,D,j,te,le,fe,de,qe,Pe;ge&8&&n!==(n=((w=(S=(ve=Z[3].status)==null?void 0:ve.network)==null?void 0:S.title)!=null?w:"Network")+"")&&C(i,n),ge&8&&r!==(r=((j=(D=(N=Z[3].conf)==null?void 0:N.network)==null?void 0:D.ip)!=null?j:"IP")+"")&&C(c,r),ge&2&&_!==(_=Z[1].net.ip+"")&&C(p,_),ge&8&&h!==(h=((fe=(le=(te=Z[3].conf)==null?void 0:te.network)==null?void 0:le.mask)!=null?fe:"Mask")+"")&&C(g,h),ge&2&&A!==(A=Z[1].net.mask+"")&&C(I,A),ge&8&&O!==(O=((Pe=(qe=(de=Z[3].conf)==null?void 0:de.network)==null?void 0:qe.gw)!=null?Pe:"Gateway")+"")&&C(U,O),ge&2&&B!==(B=Z[1].net.gw+"")&&C(z,B),Z[1].net.dns1?y?y.p(Z,ge):(y=X2(Z),y.c(),y.m(F,R)):y&&(y.d(1),y=null),Z[1].net.dns2?H?H.p(Z,ge):(H=Z2(Z),H.c(),H.m(F,null)):H&&(H.d(1),H=null),Z[1].net.ipv6?Y?Y.p(Z,ge):(Y=J2(Z),Y.c(),Y.m(t,null)):Y&&(Y.d(1),Y=null)},d(Z){Z&&T(t),y&&y.d(),H&&H.d(),Y&&Y.d()}}}function X2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns1+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns1+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function Z2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns2+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns2+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function J2(e){let t,l,n=e[1].net.ipv6+"",i,o,f,r,c=e[1].net.dns1v6&&$2(e),a=e[1].net.dns2v6&&x2(e);return{c(){t=m("div"),l=k("IPv6: "),i=k(n),o=b(),f=m("div"),c&&c.c(),r=b(),a&&a.c(),u(t,"class","my-2"),u(f,"class","my-2")},m(_,p){P(_,t,p),s(t,l),s(t,i),P(_,o,p),P(_,f,p),c&&c.m(f,null),s(f,r),a&&a.m(f,null)},p(_,p){p&2&&n!==(n=_[1].net.ipv6+"")&&C(i,n),_[1].net.dns1v6?c?c.p(_,p):(c=$2(_),c.c(),c.m(f,r)):c&&(c.d(1),c=null),_[1].net.dns2v6?a?a.p(_,p):(a=x2(_),a.c(),a.m(f,null)):a&&(a.d(1),a=null)},d(_){_&&T(t),_&&T(o),_&&T(f),c&&c.d(),a&&a.d()}}}function $2(e){let t,l=e[1].net.dns1v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns1v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function x2(e){let t,l=e[1].net.dns2v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function ed(e){var c,a,_,p,v,d;let t,l,n=((_=(a=(c=e[3].status)==null?void 0:c.firmware)==null?void 0:a.failed)!=null?_:"Upgrade from {0} to {1} failed").replace("{0}",e[1].upgrade.f).replace("{1}",e[1].upgrade.t)+"",i,o,f=((d=(v=(p=e[3].errors)==null?void 0:p.http)==null?void 0:v[e[1].upgrade.e])!=null?d:e[1].upgrade.e)+"",r;return{c(){t=m("div"),l=m("div"),i=k(n),o=b(),r=k(f),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(h,g){P(h,t,g),s(t,l),s(l,i),s(l,o),s(l,r)},p(h,g){var M,A,I,q,L,O;g&10&&n!==(n=((I=(A=(M=h[3].status)==null?void 0:M.firmware)==null?void 0:A.failed)!=null?I:"Upgrade from {0} to {1} failed").replace("{0}",h[1].upgrade.f).replace("{1}",h[1].upgrade.t)+"")&&C(i,n),g&10&&f!==(f=((O=(L=(q=h[3].errors)==null?void 0:q.http)==null?void 0:L[h[1].upgrade.e])!=null?O:h[1].upgrade.e)+"")&&C(r,f)},d(h){h&&T(t)}}}function td(e){var h,g,M;let t,l=((M=(g=(h=e[3].status)==null?void 0:h.firmware)==null?void 0:g.latest)!=null?M:"Latest")+"",n,i,o,f=e[4].tag_name+"",r,c,a,_,p,v=(e[1].security==0||e[0].a)&&e[1].fwconsent===1&&e[4]&&e[4].tag_name!=e[1].version&&ld(e),d=e[1].fwconsent===2&&nd(e);return{c(){t=m("div"),n=k(l),i=k(`: - `),o=m("a"),r=k(f),a=b(),v&&v.c(),_=b(),d&&d.c(),p=Ut(),u(o,"href",c=e[4].html_url),u(o,"class","ml-2 text-blue-600 hover:text-blue-800"),u(o,"target","_blank"),u(o,"rel","noreferrer"),u(t,"class","my-2 flex")},m(A,I){P(A,t,I),s(t,n),s(t,i),s(t,o),s(o,r),s(t,a),v&&v.m(t,null),P(A,_,I),d&&d.m(A,I),P(A,p,I)},p(A,I){var q,L,O;I&8&&l!==(l=((O=(L=(q=A[3].status)==null?void 0:q.firmware)==null?void 0:L.latest)!=null?O:"Latest")+"")&&C(n,l),I&16&&f!==(f=A[4].tag_name+"")&&C(r,f),I&16&&c!==(c=A[4].html_url)&&u(o,"href",c),(A[1].security==0||A[0].a)&&A[1].fwconsent===1&&A[4]&&A[4].tag_name!=A[1].version?v?v.p(A,I):(v=ld(A),v.c(),v.m(t,null)):v&&(v.d(1),v=null),A[1].fwconsent===2?d?d.p(A,I):(d=nd(A),d.c(),d.m(p.parentNode,p)):d&&(d.d(1),d=null)},d(A){A&&T(t),v&&v.d(),A&&T(_),d&&d.d(A),A&&T(p)}}}function ld(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("div"),l=m("button"),l.textContent="\u21D3",u(t,"class","flex-none ml-2 text-green-500"),u(t,"title",n=(c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.install)!=null?c:"Install")},m(f,r){P(f,t,r),s(t,l),i||(o=re(l,"click",e[11]),i=!0)},p(f,r){var c,a,_;r&8&&n!==(n=(_=(a=(c=f[3].status)==null?void 0:c.firmware)==null?void 0:a.install)!=null?_:"Install")&&u(t,"title",n)},d(f){f&&T(t),i=!1,o()}}}function nd(e){var o,f,r;let t,l,n=((r=(f=(o=e[3].status)==null?void 0:o.firmware)==null?void 0:f.no_one_click)!=null?r:"One-click upgrade disabled")+"",i;return{c(){t=m("div"),l=m("div"),i=k(n),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(c,a){P(c,t,a),s(t,l),s(l,i)},p(c,a){var _,p,v;a&8&&n!==(n=((v=(p=(_=c[3].status)==null?void 0:_.firmware)==null?void 0:p.no_one_click)!=null?v:"One-click upgrade disabled")+"")&&C(i,n)},d(c){c&&T(t)}}}function id(e){let t,l=Vo(Ge(e[1].chip,e[1].board))+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&2&&l!==(l=Vo(Ge(i[1].chip,i[1].board))+"")&&C(n,l)},d(i){i&&T(t)}}}function sd(e){let t,l,n,i,o,f;function r(_,p){return _[6].length==0?pg:mg}let c=r(e),a=c(e);return{c(){t=m("div"),l=m("form"),n=m("input"),i=b(),a.c(),As(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(t,"class","my-2 flex")},m(_,p){P(_,t,p),s(t,l),s(l,n),e[14](n),s(l,i),a.m(l,null),o||(f=[re(n,"change",e[15]),re(l,"submit",e[17])],o=!0)},p(_,p){c===(c=r(_))&&a?a.p(_,p):(a.d(1),a=c(_),a&&(a.c(),a.m(l,null)))},d(_){_&&T(t),e[14](null),a.d(),o=!1,Et(f)}}}function mg(e){var r,c;let t=e[6][0].name+"",l,n,i,o=((c=(r=e[3].btn)==null?void 0:r.upload)!=null?c:"Upload")+"",f;return{c(){l=k(t),n=b(),i=m("button"),f=k(o),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(a,_){P(a,l,_),P(a,n,_),P(a,i,_),s(i,f)},p(a,_){var p,v;_&64&&t!==(t=a[6][0].name+"")&&C(l,t),_&8&&o!==(o=((v=(p=a[3].btn)==null?void 0:p.upload)!=null?v:"Upload")+"")&&C(f,o)},d(a){a&&T(l),a&&T(n),a&&T(i)}}}function pg(e){var f,r,c;let t,l=((c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.btn_select_file)!=null?c:"Select file")+"",n,i,o;return{c(){t=m("button"),n=k(l),u(t,"type","button"),u(t,"class","btn-pri-sm float-right")},m(a,_){P(a,t,_),s(t,n),i||(o=re(t,"click",e[16]),i=!0)},p(a,_){var p,v,d;_&8&&l!==(l=((d=(v=(p=a[3].status)==null?void 0:p.firmware)==null?void 0:v.btn_select_file)!=null?d:"Select file")+"")&&C(n,l)},d(a){a&&T(t),i=!1,o()}}}function od(e){var H,Y,X,J,$,ce,ie,oe,ae;let t,l,n=((X=(Y=(H=e[3].status)==null?void 0:H.backup)==null?void 0:Y.title)!=null?X:"Backup")+"",i,o,f,r,c,a,_,p,v=((ce=($=(J=e[3].status)==null?void 0:J.backup)==null?void 0:$.secrets)!=null?ce:"Include secrets")+"",d,h,g,M=((ae=(oe=(ie=e[3].status)==null?void 0:ie.backup)==null?void 0:oe.secrets_desc)!=null?ae:"")+"",A,I,q,L,O,U,E,B,z=e[10],W=[];for(let se=0;se{Oe=null}),dt());const Gt={};Ve&33554440&&(Gt.$$scope={dirty:Ve,ctx:Me}),X.$set(Gt),(!ke||Ve&8)&&ce!==(ce=((Yt=(ut=Me[3].btn)==null?void 0:ut.reboot)!=null?Yt:"Reboot")+"")&&C(ie,ce),Me[1].meter?je?je.p(Me,Ve):(je=Y2(Me),je.c(),je.m(t,ae)):je&&(je.d(1),je=null),Me[1].net?Ye?Ye.p(Me,Ve):(Ye=Q2(Me),Ye.c(),Ye.m(t,se)):Ye&&(Ye.d(1),Ye=null),(!ke||Ve&8)&&pe!==(pe=((ul=(fl=(ll=Me[3].status)==null?void 0:ll.firmware)==null?void 0:fl.title)!=null?ul:"Firmware")+"")&&C(V,pe),(!ke||Ve&8)&&ve!==(ve=((Cl=(rl=(Sl=Me[3].status)==null?void 0:Sl.firmware)==null?void 0:rl.installed)!=null?Cl:"Installed")+"")&&C(S,ve),(!ke||Ve&2)&&N!==(N=Me[1].version+"")&&C(D,N),Me[1].upgrade.t&&Me[1].upgrade.t!=Me[1].version?We?We.p(Me,Ve):(We=ed(Me),We.c(),We.m(x,te)):We&&(We.d(1),We=null),Me[4]?$e?$e.p(Me,Ve):($e=td(Me),$e.c(),$e.m(x,le)):$e&&($e.d(1),$e=null),Ve&3&&(fe=(Me[1].security==0||Me[0].a)&&ns(Me[1].board)),fe?xe?xe.p(Me,Ve):(xe=id(Me),xe.c(),xe.m(x,de)):xe&&(xe.d(1),xe=null),Me[1].security==0||Me[0].a?tt?tt.p(Me,Ve):(tt=sd(Me),tt.c(),tt.m(x,null)):tt&&(tt.d(1),tt=null),Me[1].security==0||Me[0].a?Te?Te.p(Me,Ve):(Te=od(Me),Te.c(),Te.m(t,null)):Te&&(Te.d(1),Te=null);const zt={};Ve&128&&(zt.active=Me[7]),Ve&8&&(zt.message=(dl=(_l=(nl=Me[3].status)==null?void 0:nl.mask)==null?void 0:_l.firmware)!=null?dl:"Uploading"),we.$set(zt);const Dt={};Ve&512&&(Dt.active=Me[9]),Ve&8&&(Dt.message=(Qt=(Tl=(Nl=Me[3].status)==null?void 0:Nl.mask)==null?void 0:Tl.config)!=null?Qt:"Uploading"),Ae.$set(Dt)},i(Me){ke||(Q(U.$$.fragment,Me),Q(Oe),Q(X.$$.fragment,Me),Q(we.$$.fragment,Me),Q(Ae.$$.fragment,Me),ke=!0)},o(Me){ee(U.$$.fragment,Me),ee(Oe),ee(X.$$.fragment,Me),ee(we.$$.fragment,Me),ee(Ae.$$.fragment,Me),ke=!1},d(Me){Me&&T(t),Ce(U),Oe&&Oe.d(),Ce(X),je&&je.d(),Ye&&Ye.d(),We&&We.d(),$e&&$e.d(),xe&&xe.d(),tt&&tt.d(),Te&&Te.d(),Me&&T(Pe),Ce(we,Me),Me&&T(Fe),Ce(Ae,Me),De=!1,He()}}}async function bg(){await(await fetch("reboot",{method:"POST"})).json()}function gg(e,t,l){let{data:n}=t,{sysinfo:i}=t,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],f={};Ml.subscribe(z=>{l(3,f=z)});let r={};Cf.subscribe(z=>{l(4,r=Pv(i.version,z)),r||l(4,r=z[0])});function c(){var z,W;confirm(((W=(z=f.header)==null?void 0:z.upgrade)!=null?W:"Upgrade to {0}?").replace("{0}",r.tag_name))&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Vo(Ge(i.chip,i.board))))&&(wl.update(F=>(F.upgrading=!0,F)),Tv(r.tag_name))}const a=function(){var z,W;confirm((W=(z=f.device)==null?void 0:z.reboot_confirm)!=null?W:"Reboot?")&&(wl.update(F=>(F.booting=!0,F)),bg())};let _,p=[],v=!1,d,h=[],g=!1;kf();let M={hostname:"",ip:""};function A(z){l(9,g=!0);const W=new FormData;W.append("file",h[0]),fetch("/configfile",{method:"POST",body:W}).then(F=>F.json()).then(F=>{wl.update(R=>(M&&M.hostname&&(R.hostname=M.hostname),R.booting=F.reboot,M&&M.ip&&(R.net.ip=M.ip),setTimeout(Ls,5e3,i),R))}).catch(F=>{console.error("Error:",F),setTimeout(Ls,5e3,i)})}function I(z){zo[z?"unshift":"push"](()=>{_=z,l(5,_)})}function q(){p=this.files,l(6,p)}const L=()=>{_.click()},O=()=>l(7,v=!0);function U(z){zo[z?"unshift":"push"](()=>{d=z,l(8,d)})}function E(){h=this.files,l(2,h)}const B=()=>{d.click()};return e.$$set=z=>{"data"in z&&l(0,n=z.data),"sysinfo"in z&&l(1,i=z.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&4&&h.length==1){let z=h[0],W=new FileReader,F=R=>{let K=R.target.result.split(` -`);for(let y in K){let H=K[y];H.startsWith("hostname ")?M.hostname=H.split(" ")[1]:H.startsWith("ip ")&&(M.ip=H.split(" ")[1])}};W.onload=F,W.readAsText(z)}},[n,i,h,f,r,_,p,v,d,g,o,c,a,A,I,q,L,O,U,E,B]}class kg extends mt{constructor(t){super(),_t(this,t,gg,hg,ct,{data:0,sysinfo:1})}}function ud(e){let t,l,n=Ge(e[0],7)+"",i,o,f=Ge(e[0],5)+"",r,c,a=Ge(e[0],4)+"",_,p,v=Ge(e[0],3)+"",d,h,g,M,A=Ge(e[0],2)+"",I,q,L=Ge(e[0],1)+"",O,U,E=Ge(e[0],0)+"",B,z,W,F,R=Ge(e[0],101)+"",K,y,H=Ge(e[0],100)+"",Y;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=b(),g=m("optgroup"),M=m("option"),I=k(A),q=m("option"),O=k(L),U=m("option"),B=k(E),z=b(),W=m("optgroup"),F=m("option"),K=k(R),y=m("option"),Y=k(H),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,u(t,"label","amsleser.no"),M.__value=2,M.value=M.__value,q.__value=1,q.value=q.__value,U.__value=0,U.value=U.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,y.__value=100,y.value=y.__value,u(W,"label","Generic hardware")},m(X,J){P(X,t,J),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),P(X,h,J),P(X,g,J),s(g,M),s(M,I),s(g,q),s(q,O),s(g,U),s(U,B),P(X,z,J),P(X,W,J),s(W,F),s(F,K),s(W,y),s(y,Y)},p(X,J){J&1&&n!==(n=Ge(X[0],7)+"")&&C(i,n),J&1&&f!==(f=Ge(X[0],5)+"")&&C(r,f),J&1&&a!==(a=Ge(X[0],4)+"")&&C(_,a),J&1&&v!==(v=Ge(X[0],3)+"")&&C(d,v),J&1&&A!==(A=Ge(X[0],2)+"")&&C(I,A),J&1&&L!==(L=Ge(X[0],1)+"")&&C(O,L),J&1&&E!==(E=Ge(X[0],0)+"")&&C(B,E),J&1&&R!==(R=Ge(X[0],101)+"")&&C(K,R),J&1&&H!==(H=Ge(X[0],100)+"")&&C(Y,H)},d(X){X&&T(t),X&&T(h),X&&T(g),X&&T(z),X&&T(W)}}}function rd(e){let t,l,n=Ge(e[0],201)+"",i,o,f=Ge(e[0],202)+"",r,c,a=Ge(e[0],203)+"",_,p,v=Ge(e[0],241)+"",d,h,g=Ge(e[0],242)+"",M,A,I=Ge(e[0],243)+"",q,L,O=Ge(e[0],200)+"",U;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=m("option"),M=k(g),A=m("option"),q=k(I),L=m("option"),U=k(O),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=241,p.value=p.__value,h.__value=242,h.value=h.__value,A.__value=243,A.value=A.__value,L.__value=200,L.value=L.__value,u(t,"label","Generic hardware")},m(E,B){P(E,t,B),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),s(t,h),s(h,M),s(t,A),s(A,q),s(t,L),s(L,U)},p(E,B){B&1&&n!==(n=Ge(E[0],201)+"")&&C(i,n),B&1&&f!==(f=Ge(E[0],202)+"")&&C(r,f),B&1&&a!==(a=Ge(E[0],203)+"")&&C(_,a),B&1&&v!==(v=Ge(E[0],241)+"")&&C(d,v),B&1&&g!==(g=Ge(E[0],242)+"")&&C(M,g),B&1&&I!==(I=Ge(E[0],243)+"")&&C(q,I),B&1&&O!==(O=Ge(E[0],200)+"")&&C(U,O)},d(E){E&&T(t)}}}function cd(e){let t,l,n=Ge(e[0],7)+"",i,o,f=Ge(e[0],6)+"",r,c,a=Ge(e[0],5)+"",_,p,v,d,h=Ge(e[0],51)+"",g,M,A=Ge(e[0],50)+"",I;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=b(),v=m("optgroup"),d=m("option"),g=k(h),M=m("option"),I=k(A),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(t,"label","amsleser.no"),d.__value=51,d.value=d.__value,M.__value=50,M.value=M.__value,u(v,"label","Generic hardware")},m(q,L){P(q,t,L),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),P(q,p,L),P(q,v,L),s(v,d),s(d,g),s(v,M),s(M,I)},p(q,L){L&1&&n!==(n=Ge(q[0],7)+"")&&C(i,n),L&1&&f!==(f=Ge(q[0],6)+"")&&C(r,f),L&1&&a!==(a=Ge(q[0],5)+"")&&C(_,a),L&1&&h!==(h=Ge(q[0],51)+"")&&C(g,h),L&1&&A!==(A=Ge(q[0],50)+"")&&C(I,A)},d(q){q&&T(t),q&&T(p),q&&T(v)}}}function _d(e){let t,l,n=Ge(e[0],8)+"",i,o,f,r,c=Ge(e[0],71)+"",a,_,p=Ge(e[0],70)+"",v;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=b(),f=m("optgroup"),r=m("option"),a=k(c),_=m("option"),v=k(p),l.__value=8,l.value=l.__value,u(t,"label","Custom hardware"),r.__value=71,r.value=r.__value,_.__value=70,_.value=_.__value,u(f,"label","Generic hardware")},m(d,h){P(d,t,h),s(t,l),s(l,i),P(d,o,h),P(d,f,h),s(f,r),s(r,a),s(f,_),s(_,v)},p(d,h){h&1&&n!==(n=Ge(d[0],8)+"")&&C(i,n),h&1&&c!==(c=Ge(d[0],71)+"")&&C(a,c),h&1&&p!==(p=Ge(d[0],70)+"")&&C(v,p)},d(d){d&&T(t),d&&T(o),d&&T(f)}}}function md(e){let t,l,n=Ge(e[0],200)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=200,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ge(o[0],200)+"")&&C(i,n)},d(o){o&&T(t)}}}function pd(e){let t,l,n=Ge(e[0],80)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=80,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ge(o[0],80)+"")&&C(i,n)},d(o){o&&T(t)}}}function wg(e){let t,l,n,i,o,f,r,c,a=e[0]=="esp8266"&&ud(e),_=e[0]=="esp32"&&rd(e),p=e[0]=="esp32s2"&&cd(e),v=e[0]=="esp32c3"&&_d(e),d=e[0]=="esp32solo"&&md(e),h=e[0]=="esp32s3"&&pd(e);return{c(){t=m("option"),l=b(),a&&a.c(),n=b(),_&&_.c(),i=b(),p&&p.c(),o=b(),v&&v.c(),f=b(),d&&d.c(),r=b(),h&&h.c(),c=Ut(),t.__value=-1,t.value=t.__value},m(g,M){P(g,t,M),P(g,l,M),a&&a.m(g,M),P(g,n,M),_&&_.m(g,M),P(g,i,M),p&&p.m(g,M),P(g,o,M),v&&v.m(g,M),P(g,f,M),d&&d.m(g,M),P(g,r,M),h&&h.m(g,M),P(g,c,M)},p(g,[M]){g[0]=="esp8266"?a?a.p(g,M):(a=ud(g),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null),g[0]=="esp32"?_?_.p(g,M):(_=rd(g),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g[0]=="esp32s2"?p?p.p(g,M):(p=cd(g),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),g[0]=="esp32c3"?v?v.p(g,M):(v=_d(g),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null),g[0]=="esp32solo"?d?d.p(g,M):(d=md(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[0]=="esp32s3"?h?h.p(g,M):(h=pd(g),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null)},i:ze,o:ze,d(g){g&&T(t),g&&T(l),a&&a.d(g),g&&T(n),_&&_.d(g),g&&T(i),p&&p.d(g),g&&T(o),v&&v.d(g),g&&T(f),d&&d.d(g),g&&T(r),h&&h.d(g),g&&T(c)}}}function Mg(e,t,l){let{chip:n}=t;return e.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Sg extends mt{constructor(t){super(),_t(this,t,Mg,wg,ct,{chip:0})}}function dd(e){let t;return{c(){t=m("div"),t.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(t,"class","bd-red")},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function vd(e){let t,l,n,i,o,f,r;return f=new af({props:{chip:e[0].chip}}),{c(){t=m("div"),l=k("HAN GPIO"),n=m("br"),i=b(),o=m("select"),Ne(f.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(t,"class","my-3")},m(c,a){P(c,t,a),s(t,l),s(t,n),s(t,i),s(t,o),Se(f,o,null),r=!0},p(c,a){const _={};a&1&&(_.chip=c[0].chip),f.$set(_)},i(c){r||(Q(f.$$.fragment,c),r=!0)},o(c){ee(f.$$.fragment,c),r=!1},d(c){c&&T(t),Ce(f)}}}function Cg(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I,q,L,O,U,E,B,z,W,F,R,K,y=e[0].usrcfg&&dd();h=new Sg({props:{chip:e[0].chip}});let H=e[0].board&&e[0].board>20&&vd(e);return W=new kl({props:{active:e[1],message:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),f.textContent="Initial configuration",r=b(),y&&y.c(),c=b(),a=m("div"),_=k("Board type"),p=m("br"),v=b(),d=m("select"),Ne(h.$$.fragment),g=b(),H&&H.c(),M=b(),A=m("div"),I=m("label"),q=m("input"),L=k(" Clear all other configuration"),O=b(),U=m("div"),U.innerHTML='',E=b(),B=m("span"),B.textContent="\xA0",z=b(),Ne(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(f,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),e[0].board===void 0&&Ct(()=>e[5].call(d)),u(a,"class","my-3"),u(q,"type","checkbox"),u(q,"name","vr"),q.__value="true",q.value=q.__value,u(q,"class","rounded mb-1"),u(A,"class","my-3"),u(U,"class","my-3"),u(B,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Y,X){P(Y,t,X),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(n,r),y&&y.m(n,null),s(n,c),s(n,a),s(a,_),s(a,p),s(a,v),s(a,d),Se(h,d,null),Je(d,e[0].board,!0),s(n,g),H&&H.m(n,null),s(n,M),s(n,A),s(A,I),s(I,q),q.checked=e[2],s(I,L),s(n,O),s(n,U),s(n,E),s(n,B),P(Y,z,X),Se(W,Y,X),F=!0,R||(K=[re(d,"change",e[5]),re(q,"change",e[6]),re(n,"submit",as(e[3]))],R=!0)},p(Y,[X]){Y[0].usrcfg?y||(y=dd(),y.c(),y.m(n,c)):y&&(y.d(1),y=null);const J={};X&1&&(J.chip=Y[0].chip),h.$set(J),X&1&&Je(d,Y[0].board),Y[0].board&&Y[0].board>20?H?(H.p(Y,X),X&1&&Q(H,1)):(H=vd(Y),H.c(),Q(H,1),H.m(n,M)):H&&(pt(),ee(H,1,1,()=>{H=null}),dt()),X&4&&(q.checked=Y[2]);const $={};X&2&&($.active=Y[1]),W.$set($)},i(Y){F||(Q(h.$$.fragment,Y),Q(H),Q(W.$$.fragment,Y),F=!0)},o(Y){ee(h.$$.fragment,Y),ee(H),ee(W.$$.fragment,Y),F=!1},d(Y){Y&&T(t),y&&y.d(),Ce(h),H&&H.d(),Y&&T(z),Ce(W,Y),R=!1,Et(K)}}}function Ng(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o=!1;async function f(_){l(1,o=!0);const p=new FormData(_.target),v=new URLSearchParams;for(let g of p){const[M,A]=g;v.append(M,A)}let h=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),wl.update(g=>(g.vndcfg=h.success,g.booting=h.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),hi(n+(i.usrcfg?"/":"/setup"))}let r=!1;wl.subscribe(_=>{l(0,i=_),_.fwconsent===1&&l(2,r=!i.usrcfg)});function c(){i.board=Ft(this),l(0,i)}function a(){r=this.checked,l(2,r)}return e.$$set=_=>{"basepath"in _&&l(4,n=_.basepath),"sysinfo"in _&&l(0,i=_.sysinfo)},[i,o,r,f,n,c,a]}class Tg extends mt{constructor(t){super(),_t(this,t,Ng,Cg,ct,{basepath:4,sysinfo:0})}}function hd(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function bd(e){var M,A,I,q,L,O;let t,l=((I=(A=(M=e[1].conf)==null?void 0:M.connection)==null?void 0:A.ssid)!=null?I:"SSID")+"",n,i,o,f,r,c,a,_=((O=(L=(q=e[1].conf)==null?void 0:q.connection)==null?void 0:L.psk)!=null?O:"Password")+"",p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(f,"name","ss"),u(f,"type","text"),u(f,"class","in-s"),f.required=r=e[3]==1||e[3]==2,u(t,"class","my-3"),u(h,"name","sp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"autocomplete","off"),h.required=g=e[3]==2,u(a,"class","my-3")},m(U,E){P(U,t,E),s(t,n),s(t,i),s(t,o),s(t,f),P(U,c,E),P(U,a,E),s(a,p),s(a,v),s(a,d),s(a,h)},p(U,E){var B,z,W,F,R,K;E&2&&l!==(l=((W=(z=(B=U[1].conf)==null?void 0:B.connection)==null?void 0:z.ssid)!=null?W:"SSID")+"")&&C(n,l),E&8&&r!==(r=U[3]==1||U[3]==2)&&(f.required=r),E&2&&_!==(_=((K=(R=(F=U[1].conf)==null?void 0:F.connection)==null?void 0:R.psk)!=null?K:"Password")+"")&&C(p,_),E&8&&g!==(g=U[3]==2)&&(h.required=g)},d(U){U&&T(t),U&&T(c),U&&T(a)}}}function gd(e){let t,l,n,i,o,f,r,c;return r=new qv({}),{c(){t=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),f=m("select"),Ne(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=e[2],u(f,"name","su"),u(f,"class","in-l"),f.required=e[2],u(n,"class","flex")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),s(n,o),s(n,f),Se(r,f,null),c=!0},p(a,_){(!c||_&4)&&(i.required=a[2]),(!c||_&4)&&(f.required=a[2])},i(a){c||(Q(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(l),a&&T(n),Ce(r)}}}function kd(e){var g,M,A,I,q,L;let t,l,n=((A=(M=(g=e[1].conf)==null?void 0:g.network)==null?void 0:M.gw)!=null?A:"Gateway")+"",i,o,f,r,c,a,_=((L=(q=(I=e[1].conf)==null?void 0:I.network)==null?void 0:q.dns)!=null?L:"DNS")+"",p,v,d,h;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(r,"name","sg"),u(r,"type","text"),u(r,"class","in-f w-full"),u(h,"name","sd"),u(h,"type","text"),u(h,"class","in-l w-full"),u(t,"class","my-3 flex")},m(O,U){P(O,t,U),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h)},p(O,U){var E,B,z,W,F,R;U&2&&n!==(n=((z=(B=(E=O[1].conf)==null?void 0:E.network)==null?void 0:B.gw)!=null?z:"Gateway")+"")&&C(i,n),U&2&&_!==(_=((R=(F=(W=O[1].conf)==null?void 0:W.network)==null?void 0:F.dns)!=null?R:"DNS")+"")&&C(p,_)},d(O){O&&T(t)}}}function Pg(e){var j,te,le,fe,de,qe,Pe,we,Fe,Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt;let t,l,n,i,o,f,r=((te=(j=e[1].setup)==null?void 0:j.title)!=null?te:"Setup")+"",c,a,_,p=((de=(fe=(le=e[1].conf)==null?void 0:le.connection)==null?void 0:fe.title)!=null?de:"Connection")+"",v,d,h,g,M,A=((we=(Pe=(qe=e[1].conf)==null?void 0:qe.connection)==null?void 0:Pe.wifi)!=null?we:"Connect to WiFi")+"",I,q,L=((ke=(Ae=(Fe=e[1].conf)==null?void 0:Fe.connection)==null?void 0:Ae.ap)!=null?ke:"Standalone access point")+"",O,U,E,B,z=((Oe=(He=(De=e[1].conf)==null?void 0:De.general)==null?void 0:He.hostname)!=null?Oe:"Hostname")+"",W,F,R,K,y,H,Y,X,J=((Ye=(je=e[1].setup)==null?void 0:je.static)!=null?Ye:"Static IP")+"",$,ce,ie,oe,ae,se,x=(($e=(We=e[1].btn)==null?void 0:We.save)!=null?$e:"Save")+"",me,pe,V,Z,ge,ve,S=e[0].if&&e[0].if.eth&&hd(e),w=(e[3]==1||e[3]==2)&&bd(e),N=e[2]&&gd(e),D=e[2]&&kd(e);return V=new kl({props:{active:e[4],message:(tt=(xe=e[1].setup)==null?void 0:xe.mask)!=null?tt:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),c=k(r),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("select"),M=m("option"),I=k(A),q=m("option"),O=k(L),S&&S.c(),U=b(),w&&w.c(),E=b(),B=m("div"),W=k(z),F=b(),R=m("input"),K=b(),y=m("div"),H=m("label"),Y=m("input"),X=b(),$=k(J),ce=b(),N&&N.c(),ie=b(),D&&D.c(),oe=b(),ae=m("div"),se=m("button"),me=k(x),pe=b(),Ne(V.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(f,"class","text-sm"),M.__value=1,M.value=M.__value,q.__value=2,q.value=q.__value,u(g,"name","sc"),u(g,"class","in-s"),e[3]===void 0&&Ct(()=>e[6].call(g)),u(_,"class","my-3"),u(R,"name","sh"),u(R,"type","text"),u(R,"class","in-s"),u(R,"maxlength","32"),u(R,"pattern","[a-z0-9_-]+"),u(R,"placeholder","Optional, ex.: ams-reader"),u(R,"autocomplete","off"),u(Y,"type","checkbox"),u(Y,"name","sm"),Y.__value="static",Y.value=Y.__value,u(Y,"class","rounded mb-1"),u(y,"class","my-3"),u(se,"type","submit"),u(se,"class","btn-pri"),u(ae,"class","my-3"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Te,ue){P(Te,t,ue),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(f,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,M),s(M,I),s(g,q),s(q,O),S&&S.m(g,null),Je(g,e[3],!0),s(n,U),w&&w.m(n,null),s(n,E),s(n,B),s(B,W),s(B,F),s(B,R),be(R,e[0].hostname),s(n,K),s(n,y),s(y,H),s(H,Y),Y.checked=e[2],s(H,X),s(H,$),s(y,ce),N&&N.m(y,null),s(n,ie),D&&D.m(n,null),s(n,oe),s(n,ae),s(ae,se),s(se,me),P(Te,pe,ue),Se(V,Te,ue),Z=!0,ge||(ve=[re(g,"change",e[6]),re(R,"input",e[7]),re(Y,"change",e[8]),re(n,"submit",as(e[5]))],ge=!0)},p(Te,[ue]){var kt,lt,wt,st,ot,et,Nt,gt,At,Pt,Be,ye,It,vt,nt,Tt,it,at,rt,jt;(!Z||ue&2)&&r!==(r=((lt=(kt=Te[1].setup)==null?void 0:kt.title)!=null?lt:"Setup")+"")&&C(c,r),(!Z||ue&2)&&p!==(p=((ot=(st=(wt=Te[1].conf)==null?void 0:wt.connection)==null?void 0:st.title)!=null?ot:"Connection")+"")&&C(v,p),(!Z||ue&2)&&A!==(A=((gt=(Nt=(et=Te[1].conf)==null?void 0:et.connection)==null?void 0:Nt.wifi)!=null?gt:"Connect to WiFi")+"")&&C(I,A),(!Z||ue&2)&&L!==(L=((Be=(Pt=(At=Te[1].conf)==null?void 0:At.connection)==null?void 0:Pt.ap)!=null?Be:"Standalone access point")+"")&&C(O,L),Te[0].if&&Te[0].if.eth?S?S.p(Te,ue):(S=hd(Te),S.c(),S.m(g,null)):S&&(S.d(1),S=null),ue&8&&Je(g,Te[3]),Te[3]==1||Te[3]==2?w?w.p(Te,ue):(w=bd(Te),w.c(),w.m(n,E)):w&&(w.d(1),w=null),(!Z||ue&2)&&z!==(z=((vt=(It=(ye=Te[1].conf)==null?void 0:ye.general)==null?void 0:It.hostname)!=null?vt:"Hostname")+"")&&C(W,z),ue&1&&R.value!==Te[0].hostname&&be(R,Te[0].hostname),ue&4&&(Y.checked=Te[2]),(!Z||ue&2)&&J!==(J=((Tt=(nt=Te[1].setup)==null?void 0:nt.static)!=null?Tt:"Static IP")+"")&&C($,J),Te[2]?N?(N.p(Te,ue),ue&4&&Q(N,1)):(N=gd(Te),N.c(),Q(N,1),N.m(y,null)):N&&(pt(),ee(N,1,1,()=>{N=null}),dt()),Te[2]?D?D.p(Te,ue):(D=kd(Te),D.c(),D.m(n,oe)):D&&(D.d(1),D=null),(!Z||ue&2)&&x!==(x=((at=(it=Te[1].btn)==null?void 0:it.save)!=null?at:"Save")+"")&&C(me,x);const Ie={};ue&16&&(Ie.active=Te[4]),ue&2&&(Ie.message=(jt=(rt=Te[1].setup)==null?void 0:rt.mask)!=null?jt:"Saving"),V.$set(Ie)},i(Te){Z||(Q(N),Q(V.$$.fragment,Te),Z=!0)},o(Te){ee(N),ee(V.$$.fragment,Te),Z=!1},d(Te){Te&&T(t),S&&S.d(),w&&w.d(),N&&N.d(),D&&D.d(),Te&&T(pe),Ce(V,Te),ge=!1,Et(ve)}}}function Eg(e,t,l){let n={};Ml.subscribe(d=>{l(1,n=d)});let{sysinfo:i={}}=t,o=!1,f=1,r=!1;function c(d){wl.update(h=>(h.trying=d,h))}async function a(d){l(4,r=!0);const h=new FormData(d.target),g=new URLSearchParams;for(let I of h){const[q,L]=I;g.append(q,L)}let A=await(await fetch("save",{method:"POST",body:g})).json();l(4,r=!1),wl.update(I=>(I.hostname=h.get("sh"),I.usrcfg=A.success,I.booting=A.reboot,o&&(I.net.ip=h.get("si"),I.net.mask=h.get("su"),I.net.gw=h.get("sg"),I.net.dns1=h.get("sd")),A.reboot&&setTimeout(Ls,5e3,i,c),I))}function _(){f=Ft(this),l(3,f)}function p(){i.hostname=this.value,l(0,i)}function v(){o=this.checked,l(2,o)}return e.$$set=d=>{"sysinfo"in d&&l(0,i=d.sysinfo)},[i,n,o,f,r,a,_,p,v]}class Ag extends mt{constructor(t){super(),_t(this,t,Eg,Pg,ct,{sysinfo:0})}}function Dg(e){var W,F,R,K,y,H,Y,X;let t,l,n,i=((F=(W=e[2].upload)==null?void 0:W.title)!=null?F:"Upload")+"",o,f,r,c,a,_=((K=(R=e[2].upload)==null?void 0:R.desc)!=null?K:"")+"",p,v,d,h,g,M,A,I,q=((H=(y=e[2].btn)==null?void 0:y.upload)!=null?H:"Upload")+"",L,O,U,E,B,z;return U=new kl({props:{active:e[3],message:(X=(Y=e[2].upload)==null?void 0:Y.mask)!=null?X:"Uploading"}}),{c(){t=m("div"),l=m("div"),n=m("strong"),o=k(i),f=b(),r=k(e[1]),c=b(),a=m("p"),p=k(_),v=b(),d=m("form"),h=m("input"),g=b(),M=m("div"),A=m("button"),I=m("p"),L=k(q),O=b(),Ne(U.$$.fragment),u(a,"class","mb-4"),u(h,"name","file"),u(h,"type","file"),u(I,"class","mb-4"),u(A,"type","submit"),u(A,"class","btn-pri"),u(M,"class","w-full text-right mt-4"),u(d,"action",e[0]),u(d,"enctype","multipart/form-data"),u(d,"method","post"),u(d,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(J,$){P(J,t,$),s(t,l),s(l,n),s(n,o),s(n,f),s(n,r),s(l,c),s(l,a),s(a,p),s(l,v),s(l,d),s(d,h),s(d,g),s(d,M),s(M,A),s(A,I),s(I,L),P(J,O,$),Se(U,J,$),E=!0,B||(z=re(d,"submit",e[4]),B=!0)},p(J,[$]){var ie,oe,ae,se,x,me,pe,V;(!E||$&4)&&i!==(i=((oe=(ie=J[2].upload)==null?void 0:ie.title)!=null?oe:"Upload")+"")&&C(o,i),(!E||$&2)&&C(r,J[1]),(!E||$&4)&&_!==(_=((se=(ae=J[2].upload)==null?void 0:ae.desc)!=null?se:"")+"")&&C(p,_),(!E||$&4)&&q!==(q=((me=(x=J[2].btn)==null?void 0:x.upload)!=null?me:"Upload")+"")&&C(L,q),(!E||$&1)&&u(d,"action",J[0]);const ce={};$&8&&(ce.active=J[3]),$&4&&(ce.message=(V=(pe=J[2].upload)==null?void 0:pe.mask)!=null?V:"Uploading"),U.$set(ce)},i(J){E||(Q(U.$$.fragment,J),E=!0)},o(J){ee(U.$$.fragment,J),E=!1},d(J){J&&T(t),J&&T(O),Ce(U,J),B=!1,z()}}}function qg(e,t,l){let{action:n}=t,{title:i}=t,o={};Ml.subscribe(c=>{l(2,o=c)});let f=!1;const r=()=>l(3,f=!0);return e.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,f,r]}class Tf extends mt{constructor(t){super(),_t(this,t,qg,Dg,ct,{action:0,title:1})}}function Og(e){var V,Z,ge,ve,S,w,N,D,j,te,le,fe,de,qe;let t,l,n,i,o=((Z=(V=e[1].consent)==null?void 0:V.title)!=null?Z:"Consents")+"",f,r,c,a,_,p=((ve=(ge=e[1].consent)==null?void 0:ge.one_click)!=null?ve:"One-click")+"",v,d,h,g,M=((w=(S=e[1].consent)==null?void 0:S.read_more)!=null?w:"Read more")+"",A,I,q,L,O,U,E,B=((D=(N=e[1].consent)==null?void 0:N.yes)!=null?D:"Yes")+"",z,W,F,R,K,y,H=((te=(j=e[1].consent)==null?void 0:j.no)!=null?te:"No")+"",Y,X,J,$,ce,ie=((fe=(le=e[1].btn)==null?void 0:le.save)!=null?fe:"Save")+"",oe,ae,se,x,me,pe;return se=new kl({props:{active:e[2],message:(qe=(de=e[1].consent)==null?void 0:de.mask_saving)!=null?qe:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("div"),f=k(o),r=b(),c=m("hr"),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("a"),A=k(M),I=m("br"),q=b(),L=m("label"),O=m("input"),E=b(),z=k(B),W=b(),F=m("label"),R=m("input"),y=b(),Y=k(H),X=m("br"),J=b(),$=m("div"),ce=m("button"),oe=k(ie),ae=b(),Ne(se.$$.fragment),u(g,"href",Wl("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(O,"type","radio"),u(O,"name","sf"),O.value=1,O.checked=U=e[0].fwconsent===1,u(O,"class","rounded m-2"),O.required=!0,u(R,"type","radio"),u(R,"name","sf"),R.value=2,R.checked=K=e[0].fwconsent===2,u(R,"class","rounded m-2"),R.required=!0,u(_,"class","my-3"),u(ce,"type","submit"),u(ce,"class","btn-pri"),u($,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Pe,we){P(Pe,t,we),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,A),s(_,I),s(_,q),s(_,L),s(L,O),s(L,E),s(L,z),s(_,W),s(_,F),s(F,R),s(F,y),s(F,Y),s(_,X),s(n,J),s(n,$),s($,ce),s(ce,oe),P(Pe,ae,we),Se(se,Pe,we),x=!0,me||(pe=re(n,"submit",as(e[3])),me=!0)},p(Pe,[we]){var Ae,ke,De,He,Oe,je,Ye,We,$e,xe,tt,Te,ue,Ie;(!x||we&2)&&o!==(o=((ke=(Ae=Pe[1].consent)==null?void 0:Ae.title)!=null?ke:"Consents")+"")&&C(f,o),(!x||we&2)&&p!==(p=((He=(De=Pe[1].consent)==null?void 0:De.one_click)!=null?He:"One-click")+"")&&C(v,p),(!x||we&2)&&M!==(M=((je=(Oe=Pe[1].consent)==null?void 0:Oe.read_more)!=null?je:"Read more")+"")&&C(A,M),(!x||we&1&&U!==(U=Pe[0].fwconsent===1))&&(O.checked=U),(!x||we&2)&&B!==(B=((We=(Ye=Pe[1].consent)==null?void 0:Ye.yes)!=null?We:"Yes")+"")&&C(z,B),(!x||we&1&&K!==(K=Pe[0].fwconsent===2))&&(R.checked=K),(!x||we&2)&&H!==(H=((xe=($e=Pe[1].consent)==null?void 0:$e.no)!=null?xe:"No")+"")&&C(Y,H),(!x||we&2)&&ie!==(ie=((Te=(tt=Pe[1].btn)==null?void 0:tt.save)!=null?Te:"Save")+"")&&C(oe,ie);const Fe={};we&4&&(Fe.active=Pe[2]),we&2&&(Fe.message=(Ie=(ue=Pe[1].consent)==null?void 0:ue.mask_saving)!=null?Ie:"Saving"),se.$set(Fe)},i(Pe){x||(Q(se.$$.fragment,Pe),x=!0)},o(Pe){ee(se.$$.fragment,Pe),x=!1},d(Pe){Pe&&T(t),Pe&&T(ae),Ce(se,Pe),me=!1,pe()}}}function Ig(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(c=>{l(1,o=c)});let f=!1;async function r(c){l(2,f=!0);const a=new FormData(c.target),_=new URLSearchParams;for(let d of a){const[h,g]=d;_.append(h,g)}let v=await(await fetch("save",{method:"POST",body:_})).json();l(2,f=!1),wl.update(d=>(d.fwconsent=a.sf===!0?1:a.sf===!1?2:0,d.booting=v.reboot,d)),hi(n)}return e.$$set=c=>{"basepath"in c&&l(4,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,f,r,n]}class Lg extends mt{constructor(t){super(),_t(this,t,Ig,Og,ct,{basepath:4,sysinfo:0})}}function wd(e,t,l){const n=e.slice();return n[24]=t[l],n[25]=t,n[26]=l,n}function Md(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Rg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Sd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Fg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Cd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Nd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Td(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Pd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Ed(e){let t,l=e[1].o,n=[];for(let i=0;i{l(0,i=F)});let o=["mo","tu","we","th","fr","sa","su"],f={},r=!0,c=!1;Dv.subscribe(F=>{F.o&&(l(1,f=F),l(2,r=!1))}),C4();async function a(F){l(3,c=!0);const R=new URLSearchParams;R.append("r","true"),R.append("rc",f.o.length),f.o.forEach(function(y,H){R.append("rt"+H,y.t),R.append("rn"+H,y.n),R.append("rd"+H,y.d),R.append("ra"+H,y.a),R.append("rh"+H,y.h),R.append("rv"+H,y.v),R.append("rsm"+H,y.s.m),R.append("rsd"+H,y.s.d),R.append("rem"+H,y.e.m),R.append("red"+H,y.e.d)}),await(await fetch("save",{method:"POST",body:R})).json(),l(3,c=!1),hi(n+"configuration")}let _=function(F,R){return F.includes(R)?F=F.filter(function(K){return K!==R}):F.push(R),F},p=function(){let F=f.o;F.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,f.o=F,f)},v=function(F){let R=f.o;R.splice(F,1),l(1,f.o=R,f)};function d(F,R){F[R].n=this.value,l(1,f)}function h(F,R){F[R].d=Ft(this),l(1,f)}function g(F,R){F[R].t=Ft(this),l(1,f)}function M(F,R){F[R].v=Ze(this.value),l(1,f)}const A=(F,R,K,y)=>l(1,K[y].a=_(F.a,R),f),I=(F,R,K,y)=>l(1,K[y].h=_(F.h,R),f),q=(F,R,K,y)=>l(1,K[y].h=_(F.h,R+8),f),L=(F,R,K,y)=>l(1,K[y].h=_(F.h,R+16),f);function O(F,R){F[R].s.m=Ft(this),l(1,f)}function U(F,R){F[R].s.d=Ft(this),l(1,f)}function E(F,R){F[R].e.m=Ft(this),l(1,f)}function B(F,R){F[R].e.d=Ft(this),l(1,f)}const z=F=>v(F),W=F=>v(F);return e.$$set=F=>{"basepath"in F&&l(9,n=F.basepath)},[i,f,r,c,o,a,_,p,v,n,d,h,g,M,A,I,q,L,O,U,E,B,z,W]}class yg extends mt{constructor(t){super(),_t(this,t,Hg,jg,ct,{basepath:9},null,[-1,-1])}}function zg(e){let t,l;return t=new M4({props:{data:e[2],sysinfo:e[1]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Wg(e){let t,l;return t=new fg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Gg(e){let t,l;return t=new yg({props:{basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Vg(e){let t,l;return t=new kg({props:{sysinfo:e[1],data:e[2]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Kg(e){let t,l;return t=new Tf({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Yg(e){let t,l;return t=new Tf({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Qg(e){let t,l;return t=new Tf({props:{title:"private key",action:"/mqtt-key"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Xg(e){let t,l;return t=new Lg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Zg(e){let t,l;return t=new Ag({props:{sysinfo:e[1]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function Jg(e){let t,l;return t=new Tg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function $g(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,I,q,L,O,U;return t=new Lb({props:{data:e[2],basepath:e[0]}}),n=new Sn({props:{path:"/",$$slots:{default:[zg]},$$scope:{ctx:e}}}),o=new Sn({props:{path:"/configuration",$$slots:{default:[Wg]},$$scope:{ctx:e}}}),r=new Sn({props:{path:"/priceconfig",$$slots:{default:[Gg]},$$scope:{ctx:e}}}),a=new Sn({props:{path:"/status",$$slots:{default:[Vg]},$$scope:{ctx:e}}}),p=new Sn({props:{path:"/mqtt-ca",$$slots:{default:[Kg]},$$scope:{ctx:e}}}),d=new Sn({props:{path:"/mqtt-cert",$$slots:{default:[Yg]},$$scope:{ctx:e}}}),g=new Sn({props:{path:"/mqtt-key",$$slots:{default:[Qg]},$$scope:{ctx:e}}}),A=new Sn({props:{path:"/consent",$$slots:{default:[Xg]},$$scope:{ctx:e}}}),q=new Sn({props:{path:"/setup",$$slots:{default:[Zg]},$$scope:{ctx:e}}}),O=new Sn({props:{path:"/vendor",$$slots:{default:[Jg]},$$scope:{ctx:e}}}),{c(){Ne(t.$$.fragment),l=b(),Ne(n.$$.fragment),i=b(),Ne(o.$$.fragment),f=b(),Ne(r.$$.fragment),c=b(),Ne(a.$$.fragment),_=b(),Ne(p.$$.fragment),v=b(),Ne(d.$$.fragment),h=b(),Ne(g.$$.fragment),M=b(),Ne(A.$$.fragment),I=b(),Ne(q.$$.fragment),L=b(),Ne(O.$$.fragment)},m(E,B){Se(t,E,B),P(E,l,B),Se(n,E,B),P(E,i,B),Se(o,E,B),P(E,f,B),Se(r,E,B),P(E,c,B),Se(a,E,B),P(E,_,B),Se(p,E,B),P(E,v,B),Se(d,E,B),P(E,h,B),Se(g,E,B),P(E,M,B),Se(A,E,B),P(E,I,B),Se(q,E,B),P(E,L,B),Se(O,E,B),U=!0},p(E,B){const z={};B&4&&(z.data=E[2]),B&1&&(z.basepath=E[0]),t.$set(z);const W={};B&22&&(W.$$scope={dirty:B,ctx:E}),n.$set(W);const F={};B&19&&(F.$$scope={dirty:B,ctx:E}),o.$set(F);const R={};B&17&&(R.$$scope={dirty:B,ctx:E}),r.$set(R);const K={};B&22&&(K.$$scope={dirty:B,ctx:E}),a.$set(K);const y={};B&16&&(y.$$scope={dirty:B,ctx:E}),p.$set(y);const H={};B&16&&(H.$$scope={dirty:B,ctx:E}),d.$set(H);const Y={};B&16&&(Y.$$scope={dirty:B,ctx:E}),g.$set(Y);const X={};B&19&&(X.$$scope={dirty:B,ctx:E}),A.$set(X);const J={};B&18&&(J.$$scope={dirty:B,ctx:E}),q.$set(J);const $={};B&19&&($.$$scope={dirty:B,ctx:E}),O.$set($)},i(E){U||(Q(t.$$.fragment,E),Q(n.$$.fragment,E),Q(o.$$.fragment,E),Q(r.$$.fragment,E),Q(a.$$.fragment,E),Q(p.$$.fragment,E),Q(d.$$.fragment,E),Q(g.$$.fragment,E),Q(A.$$.fragment,E),Q(q.$$.fragment,E),Q(O.$$.fragment,E),U=!0)},o(E){ee(t.$$.fragment,E),ee(n.$$.fragment,E),ee(o.$$.fragment,E),ee(r.$$.fragment,E),ee(a.$$.fragment,E),ee(p.$$.fragment,E),ee(d.$$.fragment,E),ee(g.$$.fragment,E),ee(A.$$.fragment,E),ee(q.$$.fragment,E),ee(O.$$.fragment,E),U=!1},d(E){Ce(t,E),E&&T(l),Ce(n,E),E&&T(i),Ce(o,E),E&&T(f),Ce(r,E),E&&T(c),Ce(a,E),E&&T(_),Ce(p,E),E&&T(v),Ce(d,E),E&&T(h),Ce(g,E),E&&T(M),Ce(A,E),E&&T(I),Ce(q,E),E&&T(L),Ce(O,E)}}}function xg(e){let t,l,n,i;const o=[l3,t3],f=[];function r(c,a){return c[1].trying?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=Ut()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Q(l,1),l.m(n.parentNode,n))},i(c){i||(Q(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function e3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function t3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,n,i),l=!0},p:ze,i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function l3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+e[1].trying}}),{c(){Ne(t.$$.fragment)},m(n,i){Se(t,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),t.$set(o)},i(n){l||(Q(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ce(t,n)}}}function n3(e){let t,l,n,i,o,f;l=new uv({props:{basepath:e[0],$$slots:{default:[$g]},$$scope:{ctx:e}}});const r=[e3,xg],c=[];function a(_,p){return _[1].upgrading?0:_[1].booting?1:-1}return~(i=a(e))&&(o=c[i]=r[i](e)),{c(){t=m("div"),Ne(l.$$.fragment),n=b(),o&&o.c(),u(t,"class","container mx-auto m-3")},m(_,p){P(_,t,p),Se(l,t,null),s(t,n),~i&&c[i].m(t,null),f=!0},p(_,[p]){const v={};p&1&&(v.basepath=_[0]),p&23&&(v.$$scope={dirty:p,ctx:_}),l.$set(v);let d=i;i=a(_),i===d?~i&&c[i].p(_,p):(o&&(pt(),ee(c[d],1,1,()=>{c[d]=null}),dt()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=r[i](_),o.c()),Q(o,1),o.m(t,null)):o=null)},i(_){f||(Q(l.$$.fragment,_),Q(o),f=!0)},o(_){ee(l.$$.fragment,_),ee(o),f=!1},d(_){_&&T(t),Ce(l),~i&&c[i].d()}}}function i3(e,t,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Ml.subscribe(r=>{i=r});let o={};wl.subscribe(r=>{var c;l(1,o=r),o.vndcfg===!1?hi(n+"vendor"):o.usrcfg===!1?hi(n+"setup"):o.fwconsent===0&&hi(n+"consent"),o.ui.k===1?document.documentElement.classList.add("dark"):o.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),o.ui.lang&&o.ui.lang!=((c=i==null?void 0:i.language)==null?void 0:c.code)&&Nv(o.ui.lang)}),kf();let f={};return dv.subscribe(r=>{l(2,f=r)}),[n,o,f]}class s3 extends mt{constructor(t){super(),_t(this,t,i3,n3,ct,{})}}new s3({target:document.getElementById("app")}); +Occurred in: ${i}`:"",f=hf(e),r=Gd(t)?t(f):t;return`<${f}> ${r}${o}`}const iv=e=>(...t)=>e(uh(...t)),sv=iv(e=>{throw new Error(e)}),Wo=iv(console.warn),Fm=4,rh=3,ch=2,_h=1,mh=1;function ph(e,t){const l=e.default?0:Tn(e.fullPath).reduce((n,i)=>{let o=n;return o+=Fm,eh(i)?o+=mh:th(i)?o+=ch:$d(i)?o-=Fm+_h:o+=rh,o},0);return{route:e,score:l,index:t}}function dh(e){return e.map(ph).sort((t,l)=>t.scorel.score?-1:t.index-l.index)}function ov(e,t){let l,n;const[i]=t.split("?"),o=Tn(i),f=o[0]==="",r=dh(e);for(let c=0,a=r.length;c({..._,params:v,uri:A});if(_.default){n=d(t);continue}const h=Tn(_.fullPath),g=Math.max(o.length,h.length);let M=0;for(;M{a===".."?c.pop():a!=="."&&c.push(a)}),Ha(`/${c.join("/")}`,n)}function Bm(e,t){const{pathname:l,hash:n="",search:i="",state:o}=e,f=Tn(t,!0),r=Tn(l,!0);for(;f.length;)f[0]!==r[0]&&sv(bi,`Invalid state: All locations must begin with the basepath "${t}", found "${l}"`),f.shift(),r.shift();return{pathname:Bs(...r),hash:n,search:i,state:o}}const Um=e=>e.length===1?"":e,bf=e=>{const t=e.indexOf("?"),l=e.indexOf("#"),n=t!==-1,i=l!==-1,o=i?Um(Ts(e,l)):"",f=i?Ts(e,0,l):e,r=n?Um(Ts(f,t)):"";return{pathname:(n?Ts(f,0,t):f)||"/",search:r,hash:o}},hh=e=>{const{pathname:t,search:l,hash:n}=e;return t+l+n};function bh(e,t,l){return Bs(l,vh(e,t))}function gh(e,t){const l=df(lh(e)),n=Tn(l,!0),i=Tn(t,!0).slice(0,n.length),o=av({fullPath:l},Bs(...i));return o&&o.uri}const ya="POP",kh="PUSH",wh="REPLACE";function za(e){return{...e.location,pathname:encodeURI(decodeURI(e.location.pathname)),state:e.history.state,_key:e.history.state&&e.history.state._key||"initial"}}function Mh(e){let t=[],l=za(e),n=ya;const i=(o=t)=>o.forEach(f=>f({location:l,action:n}));return{get location(){return l},listen(o){t.push(o);const f=()=>{l=za(e),n=ya,i([o])};i([o]);const r=Yd(e,"popstate",f);return()=>{r(),t=t.filter(c=>c!==o)}},navigate(o,f){const{state:r={},replace:c=!1}=f||{};if(n=c?wh:kh,Vd(o))f&&Wo(nv,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=ya,e.history.go(o);else{const a={...r,_key:Zv()};try{e.history[c?"replaceState":"pushState"](a,"",o)}catch{e.location[c?"replace":"assign"](o)}}l=za(e),i()}}}function Wa(e,t){return{...bf(t),state:e}}function Sh(e="/"){let t=0,l=[Wa(null,e)];return{get entries(){return l},get location(){return l[t]},addEventListener(){},removeEventListener(){},history:{get state(){return l[t].state},pushState(n,i,o){t++,l=l.slice(0,t),l.push(Wa(n,o))},replaceState(n,i,o){l[t]=Wa(n,o)},go(n){const i=t+n;i<0||i>l.length-1||(t=i)}}}}const Ch=!!(!xn&&window.document&&window.document.createElement),Nh=!xn&&window.location.origin==="null",fv=Mh(Ch&&!Nh?window:Sh()),{navigate:hi}=fv;let jn=null,uv=!0;function Th(e,t){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;njn.level||e.level===jn.level&&Th(e.routerId,jn.routerId))&&(jn=e)}function Eh(){jn=null}function Ah(){uv=!1}function jm(e){if(!e)return!1;const t="tabindex";try{if(!e.hasAttribute(t)){e.setAttribute(t,"-1");let l;l=Yd(e,"blur",()=>{e.removeAttribute(t),l()})}return e.focus(),document.activeElement===e}catch{return!1}}function Dh(e,t){return Number(e.dataset.svnavRouteEnd)===t}function qh(e){return/^H[1-6]$/i.test(e.tagName)}function Hm(e,t=document){return t.querySelector(e)}function Oh(e){let l=Hm(`[data-svnav-route-start="${e}"]`).nextElementSibling;for(;!Dh(l,e);){if(qh(l))return l;const n=Hm("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function Ih(e){Promise.resolve(is(e.focusElement)).then(t=>{const l=t||Oh(e.id);l||Wo(bi,`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.`,e,Ko),!jm(l)&&jm(document.documentElement)})}const Lh=(e,t,l)=>(n,i)=>Vv().then(()=>{if(!jn||uv){Ah();return}if(n&&Ih(jn.route),e.announcements&&i){const{path:o,fullPath:f,meta:r,params:c,uri:a}=jn.route,_=e.createAnnouncement({path:o,fullPath:f,meta:r,params:c,uri:a},is(l));Promise.resolve(_).then(p=>{t.set(p)})}Eh()}),Rh="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 Fh(e){let t,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Qd(e[6],Rh)],i={};for(let o=0;o`Navigated to ${ie.uri}`,announcements:!0,...h},A=_,L=df(_),q=$n(Qa),I=$n(os),O=!q,U=Uh(),E=d&&!(I&&!I.manageFocus),B=$t("");Cn(e,B,ie=>l(0,r=ie));const z=I?I.disableInlineStyles:g,W=$t([]);Cn(e,W,ie=>l(20,f=ie));const F=$t(null);Cn(e,F,ie=>l(18,i=ie));let R=!1;const K=O?0:I.level+1,y=O?$t((()=>Bm(xn?bf(p):v.location,L))()):q;Cn(e,y,ie=>l(17,n=ie));const Q=$t(n);Cn(e,Q,ie=>l(19,o=ie));const Z=Lh(M,B,y),J=ie=>x=>x.filter(ae=>ae.id!==ie);function $(ie){if(xn){if(R)return;const x=av(ie,n.pathname);if(x)return R=!0,x}else W.update(x=>{const ae=J(ie.id)(x);return ae.push(ie),ae})}function ce(ie){W.update(J(ie))}return!O&&_!==ym&&Wo(bi,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),O&&(jd(()=>v.listen(x=>{const ae=Bm(x.location,L);Q.set(n),y.set(ae)})),qs(Qa,y)),qs(os,{activeRoute:F,registerRoute:$,unregisterRoute:ce,manageFocus:E,level:K,id:U,history:O?v:I.history,basepath:O?L:I.basepath,disableInlineStyles:z}),e.$$set=ie=>{"basepath"in ie&&l(11,_=ie.basepath),"url"in ie&&l(12,p=ie.url),"history"in ie&&l(13,v=ie.history),"primary"in ie&&l(14,d=ie.primary),"a11y"in ie&&l(15,h=ie.a11y),"disableInlineStyles"in ie&&l(16,g=ie.disableInlineStyles),"$$scope"in ie&&l(21,a=ie.$$scope)},e.$$.update=()=>{if(e.$$.dirty[0]&2048&&_!==A&&Wo(bi,'You cannot change the "basepath" prop. It is ignored.'),e.$$.dirty[0]&1179648){const ie=ov(f,n.pathname);F.set(ie)}if(e.$$.dirty[0]&655360&&O){const ie=!!n.hash,x=!ie&&E,ae=!ie||n.pathname!==o.pathname;Z(x,ae)}e.$$.dirty[0]&262144&&E&&i&&i.primary&&Ph({level:K,routerId:U,route:i})},[r,M,O,U,E,B,z,W,F,y,Q,_,p,v,d,h,g,n,i,o,f,a,c]}class Hh extends mt{constructor(t){super(),_t(this,t,jh,Bh,rt,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const rv=Hh;function Us(e,t,l=os,n=bi){$n(l)||sv(e,o=>`You cannot use ${o} outside of a ${hf(n)}.`,t)}const yh=e=>{const{subscribe:t}=$n(e);return{subscribe:t}};function cv(){return Us(ev),yh(Qa)}function _v(){const{history:e}=$n(os);return e}function mv(){const e=$n(Zd);return e?Jv(e,t=>t.base):$t("/")}function pv(){Us(lv);const e=mv(),{basepath:t}=$n(os);return n=>bh(n,is(e),t)}function zh(){Us(tv);const e=pv(),{navigate:t}=_v();return(n,i)=>{const o=Vd(n)?n:e(n);return t(o,i)}}const Wh=e=>({params:e&16,location:e&8}),zm=e=>({params:xn?is(e[10]):e[4],location:e[3],navigate:e[11]});function Wm(e){let t,l;return t=new rv({props:{primary:e[1],$$slots:{default:[Kh]},$$scope:{ctx:e}}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Gh(e){let t;const l=e[18].default,n=rf(l,e,e[19],zm);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),t=!0},p(i,o){n&&n.p&&(!t||o&524312)&&_f(n,l,i,i[19],t?cf(l,i[19],o,Wh):mf(i[19]),zm)},i(i){t||(Y(n,i),t=!0)},o(i){ee(n,i),t=!1},d(i){n&&n.d(i)}}}function Vh(e){let t,l,n;const i=[{location:e[3]},{navigate:e[11]},xn?is(e[10]):e[4],e[12]];var o=e[0];function f(r){let c={};for(let a=0;a{Ne(_,1)}),dt()}o?(t=Om(o,f()),Pe(t.$$.fragment),Y(t.$$.fragment,1),Ce(t,l.parentNode,l)):t=null}else o&&t.$set(a)},i(r){n||(t&&Y(t.$$.fragment,r),n=!0)},o(r){t&&ee(t.$$.fragment,r),n=!1},d(r){r&&T(l),t&&Ne(t,r)}}}function Kh(e){let t,l,n,i;const o=[Vh,Gh],f=[];function r(c,a){return c[0]!==null?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=jt()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Y(l,1),l.m(n.parentNode,n))},i(c){i||(Y(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function Yh(e){let t,l,n,i,o,f=[Ya(e[7]),{"data-svnav-route-start":e[5]}],r={};for(let p=0;p{c=null}),dt())},i(p){o||(Y(c),o=!0)},o(p){ee(c),o=!1},d(p){p&&T(t),p&&T(l),c&&c.d(p),p&&T(n),p&&T(i)}}}const Qh=Kd();function Xh(e,t,l){let n;const i=["path","component","meta","primary"];let o=yo(t,i),f,r,c,a,{$$slots:_={},$$scope:p}=t,{path:v=""}=t,{component:d=null}=t,{meta:h={}}=t,{primary:g=!0}=t;Us(Ko,t);const M=Qh(),{registerRoute:A,unregisterRoute:L,activeRoute:q,disableInlineStyles:I}=$n(os);Cn(e,q,R=>l(16,f=R));const O=mv();Cn(e,O,R=>l(17,c=R));const U=cv();Cn(e,U,R=>l(3,r=R));const E=$t(null);let B;const z=$t(),W=$t({});Cn(e,W,R=>l(4,a=R)),qs(Zd,z),qs($v,W),qs(xv,E);const F=zh();return xn||Wv(()=>L(M)),e.$$set=R=>{l(24,t=mn(mn({},t),Ho(R))),l(12,o=yo(t,i)),"path"in R&&l(13,v=R.path),"component"in R&&l(0,d=R.component),"meta"in R&&l(14,h=R.meta),"primary"in R&&l(1,g=R.primary),"$$scope"in R&&l(19,p=R.$$scope)},e.$$.update=()=>{if(e.$$.dirty&155658){const R=v==="",K=Bs(c,v),H={id:M,path:v,meta:h,default:R,fullPath:R?"":K,base:R?c:gh(K,r.pathname),primary:g,focusElement:E};z.set(H),l(15,B=A(H))}if(e.$$.dirty&98304&&l(2,n=!!(B||f&&f.id===M)),e.$$.dirty&98308&&n){const{params:R}=B||f;W.set(R)}},t=Ho(t),[d,g,n,r,a,M,q,I,O,U,W,F,o,v,h,B,f,c,_,p]}class Zh extends mt{constructor(t){super(),_t(this,t,Xh,Yh,rt,{path:13,component:0,meta:14,primary:1})}}const Sn=Zh;function Jh(e){let t,l,n,i;const o=e[13].default,f=rf(o,e,e[12],null);let r=[{href:e[0]},e[2],e[1]],c={};for(let a=0;al(11,p=E));const q=Gv(),I=pv(),{navigate:O}=_v();function U(E){q("click",E),Xv(E)&&(E.preventDefault(),O(n,{state:M,replace:f||g}))}return e.$$set=E=>{l(19,t=mn(mn({},t),Ho(E))),l(18,_=yo(t,a)),"to"in E&&l(5,h=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,M=E.state),"getProps"in E&&l(8,A=E.getProps),"$$scope"in E&&l(12,d=E.$$scope)},e.$$.update=()=>{e.$$.dirty&2080&&l(0,n=I(h,p)),e.$$.dirty&2049&&l(10,i=Xa(p.pathname,n)),e.$$.dirty&2049&&l(9,o=n===p.pathname),e.$$.dirty&2049&&(f=bf(n)===hh(p)),e.$$.dirty&512&&l(2,r=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(Gd(A)){const E=A({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...E}}return _})())},t=Ho(t),[n,c,r,L,U,h,g,M,A,o,i,p,d,v]}class xh extends mt{constructor(t){super(),_t(this,t,$h,Jh,rt,{to:5,replace:6,state:7,getProps:8})}}const ln=xh;function Jn(e){return e===1?"green":e===2?"yellow":e===3?"red":"gray"}function eb(e,t){return e>218&&e<242?"#23ac05":e>212&&e<248?"#b1d900":e>208&&e<252?"#a3b200":"#b20000"}function gf(e,t){let l;return e>90?l="#b20000":e>85?l="#b19601":e>80?l="#a3b200":e>75?l="#569f12":l="#23ac05",l}function Is(e){return e>75?"#23ac05":e>50?"#77d900":e>25?"#94d900":"#569f12"}function Go(e){switch(e){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 ht(e){for(e=e.toString();e.length<2;)e="0"+e;return e}function Ve(e,t){switch(t){case 5:switch(e){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(e){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"}return"Unknown"}function ns(e){switch(e){case 2:case 4:case 7:return!0}return!1}function Ot(e,t){return e==1||e==2&&t}function zl(e){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+e}function Ut(e,t){return isNaN(e)?"-":(isNaN(t)&&(t=e<1?2:e<10?1:0),e.toFixed(t))}function Nn(e,t){return e.setTime(e.getTime()+t*36e5),e}function Gm(e){return e=="EOE"?"ENTSO-E":e=="HKS"?"hvakosterstrommen.no":e=="EDS"?"Energi Data Service":e=="MIX"?"Mixed sources":"Unknown ("+e+")"}function Vm(e){return e=="EOE"?"https://transparency.entsoe.eu/-E":e=="HKS"?"https://www.hvakosterstrommen.no/":e=="EDS"?"https://www.energidataservice.dk/":"#"}let Io=0;function Ls(e,t){var l="";Io++;var n=function(){setTimeout(Ls,1e3,e,t)};if(e.net.ip&&Io%3==0){if(!e.net.ip){n();return}l="http://"+e.net.ip}else e.hostname&&Io%3==1?l="http://"+e.hostname:e.hostname&&Io%3==2?l="http://"+e.hostname+".local":l="";console&&console.log("Trying url "+l),t&&t(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function Vt(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Km(e){return e.startsWith("esp32")?"esp32":e}function gl(e,t){let l=[e,t];return typeof e>"u"?(l[0]="-",l[1]=t):e>=1e9?(l[0]=(e/1e6).toFixed(e>1e10?0:1),l[1]="M"+t):e>1e4?(l[0]=(e/1e3).toFixed(e>1e6?0:e>1e5?1:2),l[1]="k"+t):(l[0]=e.toFixed(0),l[1]=t),l}let Bo={},Za=[];async function tb(e,t={}){const{timeout:l=8e3}=t,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(e,{...t,signal:n.signal});return clearTimeout(i),o}let Ga;async function dv(){if(Za.length){let e=Za.shift();delete Bo[e.resource];try{let t=await tb(e.resource,e.options);for(let l in e.callbacks)e.callbacks[l](t)}catch(t){console.error("Error calling "+e.resource,t);for(let l in e.callbacks)e.callbacks[l]()}}Ga&&clearTimeout(Ga),Ga=setTimeout(dv,100)}dv();async function pn(e,t={}){let l;return Bo[e]?l=Bo[e]:(l={resource:e,options:t,callbacks:[]},Bo[e]=l,Za.push(l)),new Promise(i=>l.callbacks.push(i))}let _n={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 wl=$t(_n);async function kf(){_n=await(await pn("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),wl.set(_n)}function lb(e){wl.update(t=>(t.trying=e,t))}let Lo=0,Ym=-127,Qm=null,nb={};const vv=Xd(nb,e=>{let t,l;async function n(){pn("data.json").then(i=>i.json()).then(i=>{e(i),Ym!=i.t&&(Ym=i.t,setTimeout(wv,2e3)),Qm==null&&i.pe&&i.p!=null&&(Qm=i.p,bv()),_n.upgrading?window.location.reload():(!_n||!_n.chip||_n.booting||Lo>1&&!ns(_n.board))&&(kf(),mi&&clearTimeout(mi),mi=setTimeout(Mf,2e3),pi&&clearTimeout(pi),pi=setTimeout(Sf,3e3));let o=5e3;if(ns(_n.board)&&i.v>2.5){let f=3.3-Math.min(3.3,i.v);f>0&&(o=Math.max(f,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),t&&clearTimeout(t),t=setTimeout(n,o),Lo=0}).catch(i=>{Lo++,Lo>3?(e({em:3,hm:0,wm:0,mm:0}),t=setTimeout(n,15e3),l||(l=setTimeout(Ls,5e3,_n,lb))):t=setTimeout(n,ns(_n.board)?1e4:5e3)})}return n(),function(){clearTimeout(t)}});let Ja={},Ps;const wf=$t(Ja);async function hv(){let e=!1;if(wf.update(t=>{for(var l=0;l<36;l++){if(t[ht(l)]==null){e=l<12;break}t[ht(l)]=t[ht(l+1)]}return t}),e)bv();else{let t=new Date;Ps=setTimeout(hv,(60-t.getMinutes())*6e4)}}async function bv(){Ps&&(clearTimeout(Ps),Ps=0),Ja=await(await pn("energyprice.json")).json(),wf.set(Ja);let t=new Date;Ps=setTimeout(hv,(60-t.getMinutes())*6e4)}let $a={},mi;async function Mf(){mi&&(clearTimeout(mi),mi=0),$a=await(await pn("dayplot.json")).json(),gv.set($a);let t=new Date;mi=setTimeout(Mf,(60-t.getMinutes())*6e4+20)}const gv=$t($a,e=>(Mf(),function(){}));let xa={},pi;async function Sf(){pi&&(clearTimeout(pi),pi=0),xa=await(await pn("monthplot.json")).json(),kv.set(xa);let t=new Date;pi=setTimeout(Sf,(24-t.getHours())*36e5+40)}const kv=$t(xa,e=>(Sf(),function(){}));let ef={};async function wv(){ef=await(await pn("temperature.json")).json(),Mv.set(ef)}const Mv=$t(ef,e=>(wv(),function(){}));let tf={},Ro;async function Sv(){Ro&&(clearTimeout(Ro),Ro=0),tf=await(await pn("tariff.json")).json(),Cv.set(tf);let t=new Date;Ro=setTimeout(Sv,(60-t.getMinutes())*6e4+30)}const Cv=$t(tf,e=>function(){});let lf=[];const Cf=$t(lf);async function ib(){lf=await(await pn("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Cf.set(lf)}let es=0,sb={data:[]};async function Uo(){let t=await(await pn(es<0?"realtime.json":"realtime.json?offset="+es)).json();Nv.update(l=>{for(let n=0;n=0&&(es+=t.size,eso&&(r=p):g==i+1&&(c=p);else if(h==n+1)if(a){let A=a.tag_name.substring(1).split(".");parseInt(A[0]);let L=parseInt(A[1]);parseInt(A[2]),g==L&&(a=p)}else a=p}return c||a||r||!1}else return t[0]}function Xm(e){var c,a;let t=((a=(c=e[1].header)==null?void 0:c.uptime)!=null?a:"Up")+"",l,n,i;function o(_,p){return _[2]>1?_b:_[2]>0?cb:_[3]>1?rb:_[3]>0?ub:_[4]>1?fb:_[4]>0?ab:ob}let f=o(e),r=f(e);return{c(){l=k(t),n=b(),r.c(),i=jt()},m(_,p){P(_,l,p),P(_,n,p),r.m(_,p),P(_,i,p)},p(_,p){var v,d;p&2&&t!==(t=((d=(v=_[1].header)==null?void 0:v.uptime)!=null?d:"Up")+"")&&C(l,t),f===(f=o(_))&&r?r.p(_,p):(r.d(1),r=f(_),r&&(r.c(),r.m(i.parentNode,i)))},d(_){_&&T(l),_&&T(n),r.d(_),_&&T(i)}}}function ob(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.seconds)!=null?f:"s")+"",i;return{c(){t=k(e[0]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&1&&C(t,r[0]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.seconds)!=null?_:"s")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ab(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minute)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minute)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function fb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.minutes)!=null?f:"m")+"",i;return{c(){t=k(e[4]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&16&&C(t,r[4]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.minutes)!=null?_:"m")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function ub(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hour)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hour)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function rb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.hours)!=null?f:"h")+"",i;return{c(){t=k(e[3]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&8&&C(t,r[3]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.hours)!=null?_:"h")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function cb(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.day)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.day)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function _b(e){var o,f;let t,l,n=((f=(o=e[1].common)==null?void 0:o.days)!=null?f:"d")+"",i;return{c(){t=k(e[2]),l=b(),i=k(n)},m(r,c){P(r,t,c),P(r,l,c),P(r,i,c)},p(r,c){var a,_;c&4&&C(t,r[2]),c&2&&n!==(n=((_=(a=r[1].common)==null?void 0:a.days)!=null?_:"d")+"")&&C(i,n)},d(r){r&&T(t),r&&T(l),r&&T(i)}}}function mb(e){let t,l=e[0]&&Xm(e);return{c(){l&&l.c(),t=jt()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Xm(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function pb(e,t,l){let{epoch:n}=t,i={};Ml.subscribe(c=>{l(1,i=c)});let o=0,f=0,r=0;return e.$$set=c=>{"epoch"in c&&l(0,n=c.epoch)},e.$$.update=()=>{e.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,f=Math.floor(n/3600)),l(4,r=Math.floor(n/60)))},[n,i,o,f,r]}class db extends mt{constructor(t){super(),_t(this,t,pb,mb,rt,{epoch:0})}}function vb(e){let t,l,n;return{c(){t=m("span"),l=k(e[2]),u(t,"title",e[1]),u(t,"class",n="bd-"+e[0])},m(i,o){P(i,t,o),s(t,l)},p(i,[o]){o&4&&C(l,i[2]),o&2&&u(t,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(t,"class",n)},i:ze,o:ze,d(i){i&&T(t)}}}function hb(e,t,l){let{color:n}=t,{title:i}=t,{text:o}=t;return e.$$set=f=>{"color"in f&&l(0,n=f.color),"title"in f&&l(1,i=f.title),"text"in f&&l(2,o=f.text)},[n,i,o]}class di extends mt{constructor(t){super(),_t(this,t,hb,vb,rt,{color:0,title:1,text:2})}}function bb(e){let t,l=`${ht(e[0].getDate())}.${ht(e[0].getMonth()+1)}.${e[0].getFullYear()} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,n;return{c(){t=m("span"),n=k(l),u(t,"class",e[1])},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&1&&l!==(l=`${ht(i[0].getDate())}.${ht(i[0].getMonth()+1)}.${i[0].getFullYear()} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(n,l),o&2&&u(t,"class",i[1])},d(i){i&&T(t)}}}function gb(e){var n;let t=`${ht(e[0].getDate())}. ${e[2].months?(n=e[2].months)==null?void 0:n[e[0].getMonth()]:ht(e[0].getMonth())} ${ht(e[0].getHours())}:${ht(e[0].getMinutes())}`,l;return{c(){l=k(t)},m(i,o){P(i,l,o)},p(i,o){var f;o&5&&t!==(t=`${ht(i[0].getDate())}. ${i[2].months?(f=i[2].months)==null?void 0:f[i[0].getMonth()]:ht(i[0].getMonth())} ${ht(i[0].getHours())}:${ht(i[0].getMinutes())}`)&&C(l,t)},d(i){i&&T(l)}}}function kb(e){let t;function l(o,f){return o[3]?gb:bb}let n=l(e),i=n(e);return{c(){i.c(),t=jt()},m(o,f){i.m(o,f),P(o,t,f)},p(o,[f]){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},i:ze,o:ze,d(o){i.d(o),o&&T(t)}}}function wb(e,t,l){let n={};Ml.subscribe(c=>{l(2,n=c)});let{timestamp:i}=t,{fullTimeColor:o}=t,{offset:f}=t,r;return e.$$set=c=>{"timestamp"in c&&l(0,i=c.timestamp),"fullTimeColor"in c&&l(1,o=c.fullTimeColor),"offset"in c&&l(4,f=c.offset)},e.$$.update=()=>{e.$$.dirty&17&&(l(3,r=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(f)||Nn(i,f-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,r,f]}class Av extends mt{constructor(t){super(),_t(this,t,wb,kb,rt,{timestamp:0,fullTimeColor:1,offset:4})}}function Mb(e){let t,l,n;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(i,o){P(i,t,o),s(t,l),s(t,n)},p:ze,i:ze,o:ze,d(i){i&&T(t)}}}class Sb extends mt{constructor(t){super(),_t(this,t,null,Mb,rt,{})}}function Cb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Nb extends mt{constructor(t){super(),_t(this,t,null,Cb,rt,{})}}function Tb(e){let t,l;return{c(){t=bt("svg"),l=bt("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"fill","none"),u(t,"viewBox","0 0 24 24"),u(t,"stroke-width","1.5"),u(t,"stroke","currentColor"),u(t,"class","w-6 h-6")},m(n,i){P(n,t,i),s(t,l)},p:ze,i:ze,o:ze,d(n){n&&T(t)}}}class Pb extends mt{constructor(t){super(),_t(this,t,null,Tb,rt,{})}}function Eb(e){let t,l,n=e[2].version+"",i;return{c(){t=k("AMS reader "),l=m("span"),i=k(n)},m(o,f){P(o,t,f),P(o,l,f),s(l,i)},p(o,f){f&4&&n!==(n=o[2].version+"")&&C(i,n)},d(o){o&&T(t),o&&T(l)}}}function Zm(e){let t,l=(e[1].t>-50?e[1].t.toFixed(1):"-")+"",n,i;return{c(){t=m("div"),n=k(l),i=k("\xB0C"),u(t,"class","flex-none my-auto")},m(o,f){P(o,t,f),s(t,n),s(t,i)},p(o,f){f&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&C(n,l)},d(o){o&&T(t)}}}function Jm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.han)!=null?o:"HAN")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.han)==null?void 0:r[e[1].he])!=null?c:e[1].he),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.han)!=null?v:"HAN")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.han)==null?void 0:h[a[1].he])!=null?g:a[1].he))&&C(n,l)},d(a){a&&T(t)}}}function $m(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.mqtt)!=null?o:"MQTT")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.mqtt)==null?void 0:r[e[1].me])!=null?c:e[1].me),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.mqtt)!=null?v:"MQTT")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.mqtt)==null?void 0:h[a[1].me])!=null?g:a[1].me))&&C(n,l)},d(a){a&&T(t)}}}function xm(e){var i,o,f,r,c;let t,l=((o=(i=e[4].header)==null?void 0:i.price)!=null?o:"PS")+": "+((c=(r=(f=e[4].errors)==null?void 0:f.price)==null?void 0:r[e[1].ee])!=null?c:e[1].ee),n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(a,_){P(a,t,_),s(t,n)},p(a,_){var p,v,d,h,g;_&18&&l!==(l=((v=(p=a[4].header)==null?void 0:p.price)!=null?v:"PS")+": "+((g=(h=(d=a[4].errors)==null?void 0:d.price)==null?void 0:h[a[1].ee])!=null?g:a[1].ee))&&C(n,l)},d(a){a&&T(t)}}}function ep(e){let t,l,n,i,o,f,r,c;return l=new ln({props:{to:"/configuration",$$slots:{default:[Ab]},$$scope:{ctx:e}}}),f=new ln({props:{to:"/status",$$slots:{default:[Db]},$$scope:{ctx:e}}}),{c(){var a,_,p,v;t=m("div"),Pe(l.$$.fragment),i=b(),o=m("div"),Pe(f.$$.fragment),u(t,"class","flex-none px-1 mt-1"),u(t,"title",n=(_=(a=e[4].header)==null?void 0:a.config)!=null?_:""),u(o,"class","flex-none px-1 mt-1"),u(o,"title",r=(v=(p=e[4].header)==null?void 0:p.status)!=null?v:"")},m(a,_){P(a,t,_),Ce(l,t,null),P(a,i,_),P(a,o,_),Ce(f,o,null),c=!0},p(a,_){var d,h,g,M;const p={};_&64&&(p.$$scope={dirty:_,ctx:a}),l.$set(p),(!c||_&16&&n!==(n=(h=(d=a[4].header)==null?void 0:d.config)!=null?h:""))&&u(t,"title",n);const v={};_&64&&(v.$$scope={dirty:_,ctx:a}),f.$set(v),(!c||_&16&&r!==(r=(M=(g=a[4].header)==null?void 0:g.status)!=null?M:""))&&u(o,"title",r)},i(a){c||(Y(l.$$.fragment,a),Y(f.$$.fragment,a),c=!0)},o(a){ee(l.$$.fragment,a),ee(f.$$.fragment,a),c=!1},d(a){a&&T(t),Ne(l),a&&T(i),a&&T(o),Ne(f)}}}function Ab(e){let t,l;return t=new Sb({}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Db(e){let t,l;return t=new Nb({}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function tp(e){let t,l;function n(f,r){return f[2].security==0||f[1].a?Ob:qb}let i=n(e),o=i(e);return{c(){var f,r;t=m("div"),o.c(),u(t,"class","flex-none mr-3 text-yellow-500"),u(t,"title",l=((r=(f=e[4].header)==null?void 0:f.new_version)!=null?r:"New version")+": "+e[3].tag_name)},m(f,r){P(f,t,r),o.m(t,null)},p(f,r){var c,a;i===(i=n(f))&&o?o.p(f,r):(o.d(1),o=i(f),o&&(o.c(),o.m(t,null))),r&24&&l!==(l=((a=(c=f[4].header)==null?void 0:c.new_version)!=null?a:"New version")+": "+f[3].tag_name)&&u(t,"title",l)},d(f){f&&T(t),o.d()}}}function qb(e){var r,c;let t,l=((c=(r=e[4].header)==null?void 0:r.new_version)!=null?c:"New version")+"",n,i,o=e[3].tag_name+"",f;return{c(){t=m("span"),n=k(l),i=k(": "),f=k(o)},m(a,_){P(a,t,_),s(t,n),s(t,i),s(t,f)},p(a,_){var p,v;_&16&&l!==(l=((v=(p=a[4].header)==null?void 0:p.new_version)!=null?v:"New version")+"")&&C(n,l),_&8&&o!==(o=a[3].tag_name+"")&&C(f,o)},d(a){a&&T(t)}}}function Ob(e){var _,p;let t,l,n=((p=(_=e[4].header)==null?void 0:_.new_version)!=null?p:"New version")+"",i,o,f=e[3].tag_name+"",r,c,a;return{c(){t=m("button"),l=m("span"),i=k(n),o=k(": "),r=k(f),u(l,"class","mt-1"),u(t,"class","flex")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(l,o),s(l,r),c||(a=re(t,"click",e[5]),c=!0)},p(v,d){var h,g;d&16&&n!==(n=((g=(h=v[4].header)==null?void 0:h.new_version)!=null?g:"New version")+"")&&C(i,n),d&8&&f!==(f=v[3].tag_name+"")&&C(r,f)},d(v){v&&T(t),c=!1,a()}}}function Ib(e){var te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct,qe;let t,l,n,i,o,f,r,c,a,_,p,v=((ne=(te=e[4].header)==null?void 0:te.mem)!=null?ne:"Free")+"",d,h,g=(e[1].m?(e[1].m/1e3).toFixed(1):"-")+"",M,A,L,q,I,O,U,E,B,z,W,F,R,K,H,y,Q,Z,J,$,ce,ie,x,ae,oe,se,de,me,V,X,we;i=new ln({props:{to:"/",$$slots:{default:[Eb]},$$scope:{ctx:e}}}),c=new db({props:{epoch:e[1].u}});let ve=e[1].t>-50&&Zm(e);I=new di({props:{title:(pe=(fe=e[4].header)==null?void 0:fe.esp)!=null?pe:"ESP",text:e[2].booting?(Te=(Ae=e[4].header)==null?void 0:Ae.booting)!=null?Te:"Booting":e[1].v>2?e[1].v.toFixed(2)+"V":(Be=(be=e[4].header)==null?void 0:be.esp)!=null?Be:"ESP",color:Jn(e[2].booting?2:e[1].em)}}),U=new di({props:{title:(ke=(De=e[4].header)==null?void 0:De.han)!=null?ke:"HAN",text:(Le=(Me=e[4].header)==null?void 0:Me.han)!=null?Le:"HAN",color:Jn(e[2].booting?9:e[1].hm)}}),B=new di({props:{title:(He=(Ie=e[4].header)==null?void 0:Ie.wifi)!=null?He:"WiFi",text:e[1].r?e[1].r.toFixed(0)+"dBm":(We=(Ye=e[4].header)==null?void 0:Ye.wifi)!=null?We:"WiFi",color:Jn(e[2].booting?9:e[1].wm)}}),W=new di({props:{title:(xe=($e=e[4].header)==null?void 0:$e.mqtt)!=null?xe:"MQTT",text:(qe=(ct=e[4].header)==null?void 0:ct.mqtt)!=null?qe:"MQTT",color:Jn(e[2].booting?9:e[1].mm)}});let S=(e[1].he<0||e[1].he>0)&&Jm(e),w=e[1].me<0&&$m(e),N=(e[1].ee>0||e[1].ee<0)&&xm(e);x=new Av({props:{timestamp:e[1].c?new Date(e[1].c*1e3):new Date(0),offset:e[2].clock_offset,fullTimeColor:"text-red-500"}});let D=e[2].vndcfg&&e[2].usrcfg&&ep(e);me=new Pb({});let j=e[2].fwconsent===1&&e[3]&&tp(e);return{c(){var ue,Oe;t=m("nav"),l=m("div"),n=m("div"),Pe(i.$$.fragment),o=b(),f=m("div"),r=m("div"),Pe(c.$$.fragment),a=b(),ve&&ve.c(),_=b(),p=m("div"),d=k(v),h=k(": "),M=k(g),A=k("kb"),L=b(),q=m("div"),Pe(I.$$.fragment),O=b(),Pe(U.$$.fragment),E=b(),Pe(B.$$.fragment),z=b(),Pe(W.$$.fragment),F=b(),S&&S.c(),R=b(),w&&w.c(),K=b(),N&&N.c(),H=b(),y=m("div"),Q=m("div"),Z=m("a"),J=m("img"),ce=b(),ie=m("div"),Pe(x.$$.fragment),ae=b(),D&&D.c(),oe=b(),se=m("div"),de=m("a"),Pe(me.$$.fragment),X=b(),j&&j.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(r,"class","flex-none my-auto"),u(p,"class","flex-none my-auto"),u(f,"class","flex-none my-auto p-2 flex space-x-4"),u(q,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(J,"class","logo"),jo(J.src,$=(e[0]+"/logo.svg").replace("//","/"))||u(J,"src",$),u(J,"alt","GitHub repo"),u(Z,"class","float-right"),u(Z,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(Z,"target","_blank"),u(Z,"rel","noreferrer"),u(Z,"aria-label","GitHub"),u(Q,"class","flex-none"),u(ie,"class","flex-none my-auto px-2"),u(de,"href",zl("")),u(de,"target","_blank"),u(de,"rel","noreferrer"),u(se,"class","flex-none px-1 mt-1"),u(se,"title",V=(Oe=(ue=e[4].header)==null?void 0:ue.doc)!=null?Oe:""),u(y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(t,"class","hdr")},m(ue,Oe){P(ue,t,Oe),s(t,l),s(l,n),Ce(i,n,null),s(l,o),s(l,f),s(f,r),Ce(c,r,null),s(f,a),ve&&ve.m(f,null),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(p,A),s(l,L),s(l,q),Ce(I,q,null),s(q,O),Ce(U,q,null),s(q,E),Ce(B,q,null),s(q,z),Ce(W,q,null),s(l,F),S&&S.m(l,null),s(l,R),w&&w.m(l,null),s(l,K),N&&N.m(l,null),s(l,H),s(l,y),s(y,Q),s(Q,Z),s(Z,J),s(y,ce),s(y,ie),Ce(x,ie,null),s(y,ae),D&&D.m(y,null),s(y,oe),s(y,se),s(se,de),Ce(me,de,null),s(y,X),j&&j.m(y,null),we=!0},p(ue,[Oe]){var gt,At,Pt,Ue,ye,It,vt,lt,Tt,nt,ot,ut,Ht,Lt,Se,Ge,Rt,Wt,Dt,yt,Gt,Ft;const kt={};Oe&68&&(kt.$$scope={dirty:Oe,ctx:ue}),i.$set(kt);const tt={};Oe&2&&(tt.epoch=ue[1].u),c.$set(tt),ue[1].t>-50?ve?ve.p(ue,Oe):(ve=Zm(ue),ve.c(),ve.m(f,_)):ve&&(ve.d(1),ve=null),(!we||Oe&16)&&v!==(v=((At=(gt=ue[4].header)==null?void 0:gt.mem)!=null?At:"Free")+"")&&C(d,v),(!we||Oe&2)&&g!==(g=(ue[1].m?(ue[1].m/1e3).toFixed(1):"-")+"")&&C(M,g);const wt={};Oe&16&&(wt.title=(Ue=(Pt=ue[4].header)==null?void 0:Pt.esp)!=null?Ue:"ESP"),Oe&22&&(wt.text=ue[2].booting?(It=(ye=ue[4].header)==null?void 0:ye.booting)!=null?It:"Booting":ue[1].v>2?ue[1].v.toFixed(2)+"V":(lt=(vt=ue[4].header)==null?void 0:vt.esp)!=null?lt:"ESP"),Oe&6&&(wt.color=Jn(ue[2].booting?2:ue[1].em)),I.$set(wt);const it={};Oe&16&&(it.title=(nt=(Tt=ue[4].header)==null?void 0:Tt.han)!=null?nt:"HAN"),Oe&16&&(it.text=(ut=(ot=ue[4].header)==null?void 0:ot.han)!=null?ut:"HAN"),Oe&6&&(it.color=Jn(ue[2].booting?9:ue[1].hm)),U.$set(it);const st={};Oe&16&&(st.title=(Lt=(Ht=ue[4].header)==null?void 0:Ht.wifi)!=null?Lt:"WiFi"),Oe&18&&(st.text=ue[1].r?ue[1].r.toFixed(0)+"dBm":(Ge=(Se=ue[4].header)==null?void 0:Se.wifi)!=null?Ge:"WiFi"),Oe&6&&(st.color=Jn(ue[2].booting?9:ue[1].wm)),B.$set(st);const et={};Oe&16&&(et.title=(Wt=(Rt=ue[4].header)==null?void 0:Rt.mqtt)!=null?Wt:"MQTT"),Oe&16&&(et.text=(yt=(Dt=ue[4].header)==null?void 0:Dt.mqtt)!=null?yt:"MQTT"),Oe&6&&(et.color=Jn(ue[2].booting?9:ue[1].mm)),W.$set(et),ue[1].he<0||ue[1].he>0?S?S.p(ue,Oe):(S=Jm(ue),S.c(),S.m(l,R)):S&&(S.d(1),S=null),ue[1].me<0?w?w.p(ue,Oe):(w=$m(ue),w.c(),w.m(l,K)):w&&(w.d(1),w=null),ue[1].ee>0||ue[1].ee<0?N?N.p(ue,Oe):(N=xm(ue),N.c(),N.m(l,H)):N&&(N.d(1),N=null),(!we||Oe&1&&!jo(J.src,$=(ue[0]+"/logo.svg").replace("//","/")))&&u(J,"src",$);const Nt={};Oe&2&&(Nt.timestamp=ue[1].c?new Date(ue[1].c*1e3):new Date(0)),Oe&4&&(Nt.offset=ue[2].clock_offset),x.$set(Nt),ue[2].vndcfg&&ue[2].usrcfg?D?(D.p(ue,Oe),Oe&4&&Y(D,1)):(D=ep(ue),D.c(),Y(D,1),D.m(y,oe)):D&&(pt(),ee(D,1,1,()=>{D=null}),dt()),(!we||Oe&16&&V!==(V=(Ft=(Gt=ue[4].header)==null?void 0:Gt.doc)!=null?Ft:""))&&u(se,"title",V),ue[2].fwconsent===1&&ue[3]?j?j.p(ue,Oe):(j=tp(ue),j.c(),j.m(y,null)):j&&(j.d(1),j=null)},i(ue){we||(Y(i.$$.fragment,ue),Y(c.$$.fragment,ue),Y(I.$$.fragment,ue),Y(U.$$.fragment,ue),Y(B.$$.fragment,ue),Y(W.$$.fragment,ue),Y(x.$$.fragment,ue),Y(D),Y(me.$$.fragment,ue),we=!0)},o(ue){ee(i.$$.fragment,ue),ee(c.$$.fragment,ue),ee(I.$$.fragment,ue),ee(U.$$.fragment,ue),ee(B.$$.fragment,ue),ee(W.$$.fragment,ue),ee(x.$$.fragment,ue),ee(D),ee(me.$$.fragment,ue),we=!1},d(ue){ue&&T(t),Ne(i),Ne(c),ve&&ve.d(),Ne(I),Ne(U),Ne(B),Ne(W),S&&S.d(),w&&w.d(),N&&N.d(),Ne(x),D&&D.d(),Ne(me),j&&j.d()}}}function Lb(e,t,l){let{basepath:n="/"}=t,{data:i={}}=t,o={},f={};function r(){var a,_;confirm(((_=(a=c.header)==null?void 0:a.upgrade)!=null?_:"Upgrade to {0}?").replace("{0}",f.tag_name))&&(!ns(o.board)||confirm(Vo(Ve(o.chip,o.board))))&&(wl.update(p=>(p.upgrading=!0,p)),Pv(f.tag_name))}wl.subscribe(a=>{l(2,o=a),a.fwconsent===1&&ib()}),Cf.subscribe(a=>{l(3,f=Ev(o.version,a))});let c={};return Ml.subscribe(a=>{l(4,c=a)}),e.$$set=a=>{"basepath"in a&&l(0,n=a.basepath),"data"in a&&l(1,i=a.data)},[n,i,o,f,c,r]}class Rb extends mt{constructor(t){super(),_t(this,t,Lb,Ib,rt,{basepath:0,data:1})}}function Fb(e){let t,l,n,i;return{c(){t=bt("svg"),l=bt("path"),n=bt("path"),u(l,"d",Va(150,150,115,210,510)),u(l,"stroke","rgba(128, 128, 128, 0.15)"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Va(150,150,115,210,210+300*e[0]/100)),u(n,"stroke",e[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(t,"viewBox","0 0 300 300"),u(t,"xmlns","http://www.w3.org/2000/svg"),u(t,"height","100%")},m(o,f){P(o,t,f),s(t,l),s(t,n)},p(o,[f]){f&1&&i!==(i=Va(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),f&2&&u(n,"stroke",o[1])},i:ze,o:ze,d(o){o&&T(t)}}}function lp(e,t,l,n){var i=(n-90)*Math.PI/180;return{x:e+l*Math.cos(i),y:t+l*Math.sin(i)}}function Va(e,t,l,n,i){var o=lp(e,t,l,i),f=lp(e,t,l,n),r=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,r,0,f.x,f.y].join(" ");return c}function Bb(e,t,l){let{pct:n=0}=t,{color:i="red"}=t;return e.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Ub extends mt{constructor(t){super(),_t(this,t,Bb,Fb,rt,{pct:0,color:1})}}function np(e){let t,l,n,i,o,f,r,c;return{c(){t=m("br"),l=b(),n=m("span"),i=k(e[1]),o=b(),f=m("span"),r=k(e[2]),c=k("/kWh"),u(n,"class","pl-sub"),u(f,"class","pl-snt")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),P(a,o,_),P(a,f,_),s(f,r),s(f,c)},p(a,_){_&2&&C(i,a[1]),_&4&&C(r,a[2])},d(a){a&&T(t),a&&T(l),a&&T(n),a&&T(o),a&&T(f)}}}function jb(e){let t,l,n,i,o,f,r,c,a,_,p=e[4][0]+"",v,d,h,g=e[4][1]+"",M,A,L;l=new Ub({props:{pct:e[5],color:e[3](e[5],document.documentElement.classList.contains("dark"))}});let q=e[1]&&np(e);return{c(){t=m("div"),Pe(l.$$.fragment),n=b(),i=m("span"),o=m("span"),f=k(e[0]),r=b(),c=m("br"),a=b(),_=m("span"),v=k(p),d=b(),h=m("span"),M=k(g),A=b(),q&&q.c(),u(o,"class","pl-lab"),u(_,"class","pl-val"),u(h,"class","pl-unt"),u(i,"class","pl-ov"),u(t,"class","pl-root")},m(I,O){P(I,t,O),Ce(l,t,null),s(t,n),s(t,i),s(i,o),s(o,f),s(i,r),s(i,c),s(i,a),s(i,_),s(_,v),s(i,d),s(i,h),s(h,M),s(i,A),q&&q.m(i,null),L=!0},p(I,[O]){const U={};O&32&&(U.pct=I[5]),O&40&&(U.color=I[3](I[5],document.documentElement.classList.contains("dark"))),l.$set(U),(!L||O&1)&&C(f,I[0]),(!L||O&16)&&p!==(p=I[4][0]+"")&&C(v,p),(!L||O&16)&&g!==(g=I[4][1]+"")&&C(M,g),I[1]?q?q.p(I,O):(q=np(I),q.c(),q.m(i,null)):q&&(q.d(1),q=null)},i(I){L||(Y(l.$$.fragment,I),L=!0)},o(I){ee(l.$$.fragment,I),L=!1},d(I){I&&T(t),Ne(l),q&&q.d()}}}function Hb(e,t,l){let{val:n}=t,{max:i}=t,{unit:o}=t,{label:f}=t,{sub:r=""}=t,{subunit:c=""}=t,{colorFn:a}=t,_,p=0;return e.$$set=v=>{"val"in v&&l(6,n=v.val),"max"in v&&l(7,i=v.max),"unit"in v&&l(8,o=v.unit),"label"in v&&l(0,f=v.label),"sub"in v&&l(1,r=v.sub),"subunit"in v&&l(2,c=v.subunit),"colorFn"in v&&l(3,a=v.colorFn)},e.$$.update=()=>{e.$$.dirty&448&&(l(4,_=gl(n,o)),l(5,p=Math.min(n,i)/i*100))},[f,r,c,a,_,p,n,i,o]}class Dv extends mt{constructor(t){super(),_t(this,t,Hb,jb,rt,{val:6,max:7,unit:8,label:0,sub:1,subunit:2,colorFn:3})}}function ip(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function sp(e,t,l){const n=e.slice();return n[11]=t[l],n[13]=l,n}function op(e,t,l){const n=e.slice();return n[15]=t[l],n}function ap(e){let t,l,n,i,o,f,r=e[0].title&&fp(e),c=e[0].y.ticks,a=[];for(let h=0;he[9].call(t))},m(o,f){P(o,t,f),s(t,n),i=pf(t,e[9].bind(t))},p(o,f){f&1&&l!==(l=o[0].title+"")&&C(n,l)},d(o){o&&T(t),i()}}}function up(e){let t,l,n,i=e[15].label+"",o,f,r,c;return{c(){t=bt("g"),l=bt("line"),n=bt("text"),o=k(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",f=e[15].align=="right"?"85%":""),u(t,"class",r="tick tick-"+e[15].value+" tick-"+e[15].color),u(t,"transform",c="translate(0, "+e[7](e[15].value)+")")},m(a,_){P(a,t,_),s(t,l),s(t,n),s(n,o)},p(a,_){_&1&&i!==(i=a[15].label+"")&&C(o,i),_&1&&f!==(f=a[15].align=="right"?"85%":"")&&u(n,"x",f),_&1&&r!==(r="tick tick-"+a[15].value+" tick-"+a[15].color)&&u(t,"class",r),_&129&&c!==(c="translate(0, "+a[7](a[15].value)+")")&&u(t,"transform",c)},d(a){a&&T(t)}}}function rp(e){let t=!isNaN(e[7](e[15].value)),l,n=t&&up(e);return{c(){n&&n.c(),l=jt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&129&&(t=!isNaN(i[7](i[15].value))),t?n?n.p(i,o):(n=up(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function cp(e){let t,l,n=(e[3]>20||e[13]%2==0)&&_p(e);return{c(){t=bt("g"),n&&n.c(),u(t,"class","tick"),u(t,"transform",l="translate("+e[6](e[13])+","+e[4]+")")},m(i,o){P(i,t,o),n&&n.m(t,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=_p(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&u(t,"transform",l)},d(i){i&&T(t),n&&n.d()}}}function _p(e){let t,l=e[11].label+"",n,i;return{c(){t=bt("text"),n=k(l),u(t,"x",i=e[3]/2),u(t,"y","-4")},m(o,f){P(o,t,f),s(t,n)},p(o,f){f&1&&l!==(l=o[11].label+"")&&C(n,l),f&8&&i!==(i=o[3]/2)&&u(t,"x",i)},d(o){o&&T(t)}}}function mp(e){let t=!isNaN(e[6](e[13])),l,n=t&&cp(e);return{c(){n&&n.c(),l=jt()},m(i,o){n&&n.m(i,o),P(i,l,o)},p(i,o){o&64&&(t=!isNaN(i[6](i[13]))),t?n?n.p(i,o):(n=cp(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&T(l)}}}function pp(e){let t,l,n=e[11].value!==void 0&&dp(e),i=e[11].value2>1e-4&&bp(e);return{c(){t=bt("g"),n&&n.c(),l=bt("g"),i&&i.c()},m(o,f){P(o,t,f),n&&n.m(t,null),P(o,l,f),i&&i.m(l,null)},p(o,f){o[11].value!==void 0?n?n.p(o,f):(n=dp(o),n.c(),n.m(t,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,f):(i=bp(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&T(t),n&&n.d(),o&&T(l),i&&i.d()}}}function dp(e){let t,l,n,i,o,f,r,c=e[3]>15&&vp(e);return{c(){t=bt("rect"),c&&c.c(),r=jt(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](e[11].value)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](Math.min(e[0].y.min,0)+e[11].value)),u(t,"fill",f=e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&129&&n!==(n=a[7](a[11].value))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](Math.min(a[0].y.min,0)+a[11].value))&&u(t,"height",o),_&1&&f!==(f=a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=vp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function vp(e){let t,l=e[11].label+"",n,i,o,f,r,c,a=e[11].title&&hp(e);return{c(){t=bt("text"),n=k(l),a&&a.c(),c=jt(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor",o=e[3]e[7](0)-e[8]?e[11].color:"white"),u(t,"transform",r="translate("+(e[6](e[13])+e[3]/2)+" "+(e[7](e[11].value)>e[7](0)-e[8]?e[7](e[11].value)-e[8]:e[7](e[11].value)+10)+") rotate("+(e[11].labelAngle?e[11].labelAngle:e[3]_[7](0)-_[8]?_[11].color:"white")&&u(t,"fill",f),p&457&&r!==(r="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]15&&gp(e);return{c(){t=bt("rect"),c&&c.c(),r=jt(),u(t,"x",l=e[6](e[13])+2),u(t,"y",n=e[7](0)),u(t,"width",i=e[3]-4),u(t,"height",o=e[7](e[0].y.min)-e[7](e[0].y.min+e[11].value2)),u(t,"fill",f=e[11].color2?e[11].color2:e[11].color)},m(a,_){P(a,t,_),c&&c.m(a,_),P(a,r,_)},p(a,_){_&64&&l!==(l=a[6](a[13])+2)&&u(t,"x",l),_&128&&n!==(n=a[7](0))&&u(t,"y",n),_&8&&i!==(i=a[3]-4)&&u(t,"width",i),_&129&&o!==(o=a[7](a[0].y.min)-a[7](a[0].y.min+a[11].value2))&&u(t,"height",o),_&1&&f!==(f=a[11].color2?a[11].color2:a[11].color)&&u(t,"fill",f),a[3]>15?c?c.p(a,_):(c=gp(a),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null)},d(a){a&&T(t),c&&c.d(a),a&&T(r)}}}function gp(e){let t,l=e[11].label2+"",n,i,o,f,r,c=e[11].title2&&kp(e);return{c(){t=bt("text"),n=k(l),c&&c.c(),r=jt(),u(t,"width",i=e[3]-4),u(t,"dominant-baseline","middle"),u(t,"text-anchor","middle"),u(t,"fill",o=e[7](-e[11].value2)e[10].call(t))},m(i,o){P(i,t,o),n&&n.m(t,null),l=pf(t,e[10].bind(t))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ap(i),n.c(),n.m(t,null)):n&&(n.d(1),n=null)},i:ze,o:ze,d(i){i&&T(t),n&&n.d(),l()}}}let vi=30;function zb(e,t,l){let{config:n}=t,i,o,f,r,c,a,_,p=0;function v(){p=this.clientHeight,l(5,p)}function d(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return e.$$set=h=>{"config"in h&&l(0,n=h.config)},e.$$.update=()=>{if(e.$$.dirty&63){l(4,a=o-p);let h=i-(n.padding.left+n.padding.right);l(3,f=h/n.points.length),l(8,_=fn.y.max?A=n.padding.bottom:Ma||A<0?0:A})}},[n,i,o,f,a,p,r,c,_,v,d]}class gi extends mt{constructor(t){super(),_t(this,t,zb,yb,rt,{config:0})}}function Wb(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Gb(e,t,l){let{title:n}=t,{u1:i}=t,{u2:o}=t,{u3:f}=t,{ds:r}=t,c={};function a(_){return{label:Ut(_)+"V",title:_.toFixed(1)+" V",value:isNaN(_)?0:_,color:eb(_||0,document.documentElement.classList.contains("dark"))}}return e.$$set=_=>{"title"in _&&l(1,n=_.title),"u1"in _&&l(2,i=_.u1),"u2"in _&&l(3,o=_.u2),"u3"in _&&l(4,f=_.u3),"ds"in _&&l(5,r=_.ds)},e.$$.update=()=>{if(e.$$.dirty&62){let _=[],p=[];i>0&&(_.push({label:r===1?"L1-L2":"L1"}),p.push(a(i))),o>0&&(_.push({label:r===1?"L1-L3":"L2"}),p.push(a(o))),f>0&&(_.push({label:r===1?"L2-L3":"L3"}),p.push(a(f))),l(0,c={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:_},points:p})}},[c,n,i,o,f,r]}class Vb extends mt{constructor(t){super(),_t(this,t,Gb,Wb,rt,{title:1,u1:2,u2:3,u3:4,ds:5})}}function Kb(e){var D,j,te,ne,fe,pe,Ae,Te,be,Be;let t,l,n=((j=(D=e[0].reactive)==null?void 0:D.title)!=null?j:"Reactive")+"",i,o,f,r,c=((ne=(te=e[0].reactive)==null?void 0:te.instant_in)!=null?ne:"Instant in")+"",a,_,p,v=e[1][0]+"",d,h,g=e[1][1]+"",M,A,L,q=((pe=(fe=e[0].reactive)==null?void 0:fe.instant_out)!=null?pe:"Instant out")+"",I,O,U,E=e[2][0]+"",B,z,W=e[2][1]+"",F,R,K,H,y=((Te=(Ae=e[0].reactive)==null?void 0:Ae.total_in)!=null?Te:"Total in")+"",Q,Z,J,$=e[3][0]+"",ce,ie,x=e[3][1]+"",ae,oe,se,de=((Be=(be=e[0].reactive)==null?void 0:be.total_out)!=null?Be:"Total out")+"",me,V,X,we=e[4][0]+"",ve,S,w=e[4][1]+"",N;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),r=m("div"),a=k(c),_=b(),p=m("div"),d=k(v),h=b(),M=k(g),A=b(),L=m("div"),I=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),K=m("div"),H=m("div"),Q=k(y),Z=b(),J=m("div"),ce=k($),ie=b(),ae=k(x),oe=b(),se=m("div"),me=k(de),V=b(),X=m("div"),ve=k(we),S=b(),N=k(w),u(p,"class","text-right"),u(U,"class","text-right"),u(f,"class","grid grid-cols-2 mt-4"),u(J,"class","text-right"),u(X,"class","text-right"),u(K,"class","grid grid-cols-2 mt-4"),u(t,"class","mx-2 text-sm")},m(De,ke){P(De,t,ke),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(r,a),s(f,_),s(f,p),s(p,d),s(p,h),s(p,M),s(f,A),s(f,L),s(L,I),s(f,O),s(f,U),s(U,B),s(U,z),s(U,F),s(t,R),s(t,K),s(K,H),s(H,Q),s(K,Z),s(K,J),s(J,ce),s(J,ie),s(J,ae),s(K,oe),s(K,se),s(se,me),s(K,V),s(K,X),s(X,ve),s(X,S),s(X,N)},p(De,[ke]){var Me,Le,Ie,He,Ye,We,$e,xe,ct,qe;ke&1&&n!==(n=((Le=(Me=De[0].reactive)==null?void 0:Me.title)!=null?Le:"Reactive")+"")&&C(i,n),ke&1&&c!==(c=((He=(Ie=De[0].reactive)==null?void 0:Ie.instant_in)!=null?He:"Instant in")+"")&&C(a,c),ke&2&&v!==(v=De[1][0]+"")&&C(d,v),ke&2&&g!==(g=De[1][1]+"")&&C(M,g),ke&1&&q!==(q=((We=(Ye=De[0].reactive)==null?void 0:Ye.instant_out)!=null?We:"Instant out")+"")&&C(I,q),ke&4&&E!==(E=De[2][0]+"")&&C(B,E),ke&4&&W!==(W=De[2][1]+"")&&C(F,W),ke&1&&y!==(y=((xe=($e=De[0].reactive)==null?void 0:$e.total_in)!=null?xe:"Total in")+"")&&C(Q,y),ke&8&&$!==($=De[3][0]+"")&&C(ce,$),ke&8&&x!==(x=De[3][1]+"")&&C(ae,x),ke&1&&de!==(de=((qe=(ct=De[0].reactive)==null?void 0:ct.total_out)!=null?qe:"Total out")+"")&&C(me,de),ke&16&&we!==(we=De[4][0]+"")&&C(ve,we),ke&16&&w!==(w=De[4][1]+"")&&C(N,w)},i:ze,o:ze,d(De){De&&T(t)}}}function Yb(e,t,l){let{importInstant:n}=t,{exportInstant:i}=t,{importTotal:o}=t,{exportTotal:f}=t,r={};Ml.subscribe(v=>{l(0,r=v)});let c,a,_,p;return e.$$set=v=>{"importInstant"in v&&l(5,n=v.importInstant),"exportInstant"in v&&l(6,i=v.exportInstant),"importTotal"in v&&l(7,o=v.importTotal),"exportTotal"in v&&l(8,f=v.exportTotal)},e.$$.update=()=>{e.$$.dirty&480&&(l(1,c=gl(n,"VAr")),l(2,a=gl(i,"VAr")),l(3,_=gl(o*1e3,"VArh")),l(4,p=gl(f*1e3,"VArh")))},[r,c,a,_,p,n,i,o,f]}class Qb extends mt{constructor(t){super(),_t(this,t,Yb,Kb,rt,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8})}}function Mp(e){let t;function l(o,f){return o[3]?Zb:Xb}let n=l(e),i=n(e);return{c(){i.c(),t=jt()},m(o,f){i.m(o,f),P(o,t,f)},p(o,f){n===(n=l(o))&&i?i.p(o,f):(i.d(1),i=n(o),i&&(i.c(),i.m(t.parentNode,t)))},d(o){i.d(o),o&&T(t)}}}function Xb(e){var j,te,ne,fe,pe,Ae,Te,be,Be,De;let t,l=((te=(j=e[5].realtime)==null?void 0:j.consumption)!=null?te:"Consumption")+"",n,i,o,f,r=Vt((fe=(ne=e[5].common)==null?void 0:ne.hour)!=null?fe:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,L=Vt((Ae=(pe=e[5].common)==null?void 0:pe.day)!=null?Ae:"Day")+"",q,I,O,U=e[7][0]+"",E,B,z=e[7][1]+"",W,F,R,K=Vt((be=(Te=e[5].common)==null?void 0:Te.month)!=null?be:"Month")+"",H,y,Q,Z=e[8][0]+"",J,$,ce=e[8][1]+"",ie,x,ae,oe=((De=(Be=e[5].realtime)==null?void 0:Be.last_month)!=null?De:"Last month")+"",se,de,me,V=e[9][0]+"",X,we,ve=e[9][1]+"",S,w,N,D=e[4]&&Sp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),A=m("div"),q=k(L),I=b(),O=m("div"),E=k(U),B=b(),W=k(z),F=b(),R=m("div"),H=k(K),y=b(),Q=m("div"),J=k(Z),$=b(),ie=k(ce),x=b(),ae=m("div"),se=k(oe),de=b(),me=m("div"),X=k(V),we=b(),S=k(ve),w=b(),D&&D.c(),N=jt(),u(_,"class","text-right"),u(O,"class","text-right"),u(Q,"class","text-right"),u(me,"class","text-right"),u(o,"class","grid grid-cols-2 mb-3")},m(ke,Me){P(ke,t,Me),s(t,n),P(ke,i,Me),P(ke,o,Me),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),s(o,A),s(A,q),s(o,I),s(o,O),s(O,E),s(O,B),s(O,W),s(o,F),s(o,R),s(R,H),s(o,y),s(o,Q),s(Q,J),s(Q,$),s(Q,ie),s(o,x),s(o,ae),s(ae,se),s(o,de),s(o,me),s(me,X),s(me,we),s(me,S),P(ke,w,Me),D&&D.m(ke,Me),P(ke,N,Me)},p(ke,Me){var Le,Ie,He,Ye,We,$e,xe,ct,qe,ue;Me&32&&l!==(l=((Ie=(Le=ke[5].realtime)==null?void 0:Le.consumption)!=null?Ie:"Consumption")+"")&&C(n,l),Me&32&&r!==(r=Vt((Ye=(He=ke[5].common)==null?void 0:He.hour)!=null?Ye:"Hour")+"")&&C(c,r),Me&64&&p!==(p=ke[6][0]+"")&&C(v,p),Me&64&&h!==(h=ke[6][1]+"")&&C(g,h),Me&32&&L!==(L=Vt(($e=(We=ke[5].common)==null?void 0:We.day)!=null?$e:"Day")+"")&&C(q,L),Me&128&&U!==(U=ke[7][0]+"")&&C(E,U),Me&128&&z!==(z=ke[7][1]+"")&&C(W,z),Me&32&&K!==(K=Vt((ct=(xe=ke[5].common)==null?void 0:xe.month)!=null?ct:"Month")+"")&&C(H,K),Me&256&&Z!==(Z=ke[8][0]+"")&&C(J,Z),Me&256&&ce!==(ce=ke[8][1]+"")&&C(ie,ce),Me&32&&oe!==(oe=((ue=(qe=ke[5].realtime)==null?void 0:qe.last_month)!=null?ue:"Last month")+"")&&C(se,oe),Me&512&&V!==(V=ke[9][0]+"")&&C(X,V),Me&512&&ve!==(ve=ke[9][1]+"")&&C(S,ve),ke[4]?D?D.p(ke,Me):(D=Sp(ke),D.c(),D.m(N.parentNode,N)):D&&(D.d(1),D=null)},d(ke){ke&&T(t),ke&&T(i),ke&&T(o),ke&&T(w),D&&D.d(ke),ke&&T(N)}}}function Zb(e){var Yt,tl,fl,ul,Sl,rl,Cl,ll,_l,dl,Nl,nn,nl,Ee,qt,Pn,Zl,dn,En,Fe;let t,l=((tl=(Yt=e[5].common)==null?void 0:Yt.import)!=null?tl:"Import")+"",n,i,o,f,r=Vt((ul=(fl=e[5].common)==null?void 0:fl.hour)!=null?ul:"Hour")+"",c,a,_,p=e[6][0]+"",v,d,h=e[6][1]+"",g,M,A,L,q=Vt((rl=(Sl=e[5].common)==null?void 0:Sl.day)!=null?rl:"Day")+"",I,O,U,E=e[7][0]+"",B,z,W=e[7][1]+"",F,R,K,H,y=Vt((ll=(Cl=e[5].common)==null?void 0:Cl.month)!=null?ll:"Month")+"",Q,Z,J,$=e[8][0]+"",ce,ie,x=e[8][1]+"",ae,oe,se,de,me=((dl=(_l=e[5].realtime)==null?void 0:_l.last_mo)!=null?dl:"Last mo.")+"",V,X,we,ve=e[9][0]+"",S,w,N=e[9][1]+"",D,j,te,ne,fe,pe=((nn=(Nl=e[5].common)==null?void 0:Nl.export)!=null?nn:"Export")+"",Ae,Te,be,Be,De=Vt((Ee=(nl=e[5].common)==null?void 0:nl.hour)!=null?Ee:"Hour")+"",ke,Me,Le,Ie=e[10][0]+"",He,Ye,We=e[10][1]+"",$e,xe,ct,qe,ue=Vt((Pn=(qt=e[5].common)==null?void 0:qt.day)!=null?Pn:"Day")+"",Oe,kt,tt,wt=e[11][0]+"",it,st,et=e[11][1]+"",Nt,gt,At,Pt,Ue=Vt((dn=(Zl=e[5].common)==null?void 0:Zl.month)!=null?dn:"Month")+"",ye,It,vt,lt=e[12][0]+"",Tt,nt,ot=e[12][1]+"",ut,Ht,Lt,Se,Ge=((Fe=(En=e[5].realtime)==null?void 0:En.last_mo)!=null?Fe:"Last mo.")+"",Rt,Wt,Dt,yt=e[13][0]+"",Gt,Ft,Kt=e[13][1]+"",Xt,el,Zt,at=e[4]&&Cp(e),Mt=e[4]&&Np(e),Ke=e[4]&&Tp(e),le=e[4]&&Pp(e),je=e[4]&&Ep(e),Re=e[4]&&Ap(e),St=e[4]&&Dp(e),ft=e[4]&&qp(e);return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),M=b(),at&&at.c(),A=b(),L=m("div"),I=k(q),O=b(),U=m("div"),B=k(E),z=b(),F=k(W),R=b(),Mt&&Mt.c(),K=b(),H=m("div"),Q=k(y),Z=b(),J=m("div"),ce=k($),ie=b(),ae=k(x),oe=b(),Ke&&Ke.c(),se=b(),de=m("div"),V=k(me),X=b(),we=m("div"),S=k(ve),w=b(),D=k(N),j=b(),le&&le.c(),ne=b(),fe=m("strong"),Ae=k(pe),Te=b(),be=m("div"),Be=m("div"),ke=k(De),Me=b(),Le=m("div"),He=k(Ie),Ye=b(),$e=k(We),xe=b(),je&&je.c(),ct=b(),qe=m("div"),Oe=k(ue),kt=b(),tt=m("div"),it=k(wt),st=b(),Nt=k(et),gt=b(),Re&&Re.c(),At=b(),Pt=m("div"),ye=k(Ue),It=b(),vt=m("div"),Tt=k(lt),nt=b(),ut=k(ot),Ht=b(),St&&St.c(),Lt=b(),Se=m("div"),Rt=k(Ge),Wt=b(),Dt=m("div"),Gt=k(yt),Ft=b(),Xt=k(Kt),el=b(),ft&&ft.c(),u(_,"class","text-right"),u(U,"class","text-right"),u(J,"class","text-right"),u(we,"class","text-right"),u(o,"class",te="grid grid-cols-"+e[14]+" mb-3"),u(Le,"class","text-right"),u(tt,"class","text-right"),u(vt,"class","text-right"),u(Dt,"class","text-right"),u(be,"class",Zt="grid grid-cols-"+e[14])},m(he,Qe){P(he,t,Qe),s(t,n),P(he,i,Qe),P(he,o,Qe),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,g),s(o,M),at&&at.m(o,null),s(o,A),s(o,L),s(L,I),s(o,O),s(o,U),s(U,B),s(U,z),s(U,F),s(o,R),Mt&&Mt.m(o,null),s(o,K),s(o,H),s(H,Q),s(o,Z),s(o,J),s(J,ce),s(J,ie),s(J,ae),s(o,oe),Ke&&Ke.m(o,null),s(o,se),s(o,de),s(de,V),s(o,X),s(o,we),s(we,S),s(we,w),s(we,D),s(o,j),le&&le.m(o,null),P(he,ne,Qe),P(he,fe,Qe),s(fe,Ae),P(he,Te,Qe),P(he,be,Qe),s(be,Be),s(Be,ke),s(be,Me),s(be,Le),s(Le,He),s(Le,Ye),s(Le,$e),s(be,xe),je&&je.m(be,null),s(be,ct),s(be,qe),s(qe,Oe),s(be,kt),s(be,tt),s(tt,it),s(tt,st),s(tt,Nt),s(be,gt),Re&&Re.m(be,null),s(be,At),s(be,Pt),s(Pt,ye),s(be,It),s(be,vt),s(vt,Tt),s(vt,nt),s(vt,ut),s(be,Ht),St&&St.m(be,null),s(be,Lt),s(be,Se),s(Se,Rt),s(be,Wt),s(be,Dt),s(Dt,Gt),s(Dt,Ft),s(Dt,Xt),s(be,el),ft&&ft.m(be,null)},p(he,Qe){var vn,An,Hn,yn,ml,Jl,$l,zn,xl,Wl,hn,Dn,Wn,Gn,en,cl,Vn,bn,Kn,Gl;Qe&32&&l!==(l=((An=(vn=he[5].common)==null?void 0:vn.import)!=null?An:"Import")+"")&&C(n,l),Qe&32&&r!==(r=Vt((yn=(Hn=he[5].common)==null?void 0:Hn.hour)!=null?yn:"Hour")+"")&&C(c,r),Qe&64&&p!==(p=he[6][0]+"")&&C(v,p),Qe&64&&h!==(h=he[6][1]+"")&&C(g,h),he[4]?at?at.p(he,Qe):(at=Cp(he),at.c(),at.m(o,A)):at&&(at.d(1),at=null),Qe&32&&q!==(q=Vt((Jl=(ml=he[5].common)==null?void 0:ml.day)!=null?Jl:"Day")+"")&&C(I,q),Qe&128&&E!==(E=he[7][0]+"")&&C(B,E),Qe&128&&W!==(W=he[7][1]+"")&&C(F,W),he[4]?Mt?Mt.p(he,Qe):(Mt=Np(he),Mt.c(),Mt.m(o,K)):Mt&&(Mt.d(1),Mt=null),Qe&32&&y!==(y=Vt((zn=($l=he[5].common)==null?void 0:$l.month)!=null?zn:"Month")+"")&&C(Q,y),Qe&256&&$!==($=he[8][0]+"")&&C(ce,$),Qe&256&&x!==(x=he[8][1]+"")&&C(ae,x),he[4]?Ke?Ke.p(he,Qe):(Ke=Tp(he),Ke.c(),Ke.m(o,se)):Ke&&(Ke.d(1),Ke=null),Qe&32&&me!==(me=((Wl=(xl=he[5].realtime)==null?void 0:xl.last_mo)!=null?Wl:"Last mo.")+"")&&C(V,me),Qe&512&&ve!==(ve=he[9][0]+"")&&C(S,ve),Qe&512&&N!==(N=he[9][1]+"")&&C(D,N),he[4]?le?le.p(he,Qe):(le=Pp(he),le.c(),le.m(o,null)):le&&(le.d(1),le=null),Qe&16384&&te!==(te="grid grid-cols-"+he[14]+" mb-3")&&u(o,"class",te),Qe&32&&pe!==(pe=((Dn=(hn=he[5].common)==null?void 0:hn.export)!=null?Dn:"Export")+"")&&C(Ae,pe),Qe&32&&De!==(De=Vt((Gn=(Wn=he[5].common)==null?void 0:Wn.hour)!=null?Gn:"Hour")+"")&&C(ke,De),Qe&1024&&Ie!==(Ie=he[10][0]+"")&&C(He,Ie),Qe&1024&&We!==(We=he[10][1]+"")&&C($e,We),he[4]?je?je.p(he,Qe):(je=Ep(he),je.c(),je.m(be,ct)):je&&(je.d(1),je=null),Qe&32&&ue!==(ue=Vt((cl=(en=he[5].common)==null?void 0:en.day)!=null?cl:"Day")+"")&&C(Oe,ue),Qe&2048&&wt!==(wt=he[11][0]+"")&&C(it,wt),Qe&2048&&et!==(et=he[11][1]+"")&&C(Nt,et),he[4]?Re?Re.p(he,Qe):(Re=Ap(he),Re.c(),Re.m(be,At)):Re&&(Re.d(1),Re=null),Qe&32&&Ue!==(Ue=Vt((bn=(Vn=he[5].common)==null?void 0:Vn.month)!=null?bn:"Month")+"")&&C(ye,Ue),Qe&4096&<!==(lt=he[12][0]+"")&&C(Tt,lt),Qe&4096&&ot!==(ot=he[12][1]+"")&&C(ut,ot),he[4]?St?St.p(he,Qe):(St=Dp(he),St.c(),St.m(be,Lt)):St&&(St.d(1),St=null),Qe&32&&Ge!==(Ge=((Gl=(Kn=he[5].realtime)==null?void 0:Kn.last_mo)!=null?Gl:"Last mo.")+"")&&C(Rt,Ge),Qe&8192&&yt!==(yt=he[13][0]+"")&&C(Gt,yt),Qe&8192&&Kt!==(Kt=he[13][1]+"")&&C(Xt,Kt),he[4]?ft?ft.p(he,Qe):(ft=qp(he),ft.c(),ft.m(be,null)):ft&&(ft.d(1),ft=null),Qe&16384&&Zt!==(Zt="grid grid-cols-"+he[14])&&u(be,"class",Zt)},d(he){he&&T(t),he&&T(i),he&&T(o),at&&at.d(),Mt&&Mt.d(),Ke&&Ke.d(),le&&le.d(),he&&T(ne),he&&T(fe),he&&T(Te),he&&T(be),je&&je.d(),Re&&Re.d(),St&&St.d(),ft&&ft.d()}}}function Sp(e){var X,we,ve,S,w,N,D,j,te,ne;let t,l=((we=(X=e[5].realtime)==null?void 0:X.cost)!=null?we:"Cost")+"",n,i,o,f,r=Vt((S=(ve=e[5].common)==null?void 0:ve.hour)!=null?S:"Hour")+"",c,a,_,p=Ut(e[1].h.c,2)+"",v,d,h,g,M,A=Vt((N=(w=e[5].common)==null?void 0:w.day)!=null?N:"Day")+"",L,q,I,O=Ut(e[1].d.c,1)+"",U,E,B,z,W,F=Vt((j=(D=e[5].common)==null?void 0:D.month)!=null?j:"Month")+"",R,K,H,y=Ut(e[1].m.c)+"",Q,Z,J,$,ce,ie=((ne=(te=e[5].realtime)==null?void 0:te.last_month)!=null?ne:"Last month")+"",x,ae,oe,se=Ut(e[0].last_month.c)+"",de,me,V;return{c(){t=m("strong"),n=k(l),i=b(),o=m("div"),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),h=k(e[2]),g=b(),M=m("div"),L=k(A),q=b(),I=m("div"),U=k(O),E=b(),B=k(e[2]),z=b(),W=m("div"),R=k(F),K=b(),H=m("div"),Q=k(y),Z=b(),J=k(e[2]),$=b(),ce=m("div"),x=k(ie),ae=b(),oe=m("div"),de=k(se),me=b(),V=k(e[2]),u(_,"class","text-right"),u(I,"class","text-right"),u(H,"class","text-right"),u(oe,"class","text-right"),u(o,"class","grid grid-cols-2")},m(fe,pe){P(fe,t,pe),s(t,n),P(fe,i,pe),P(fe,o,pe),s(o,f),s(f,c),s(o,a),s(o,_),s(_,v),s(_,d),s(_,h),s(o,g),s(o,M),s(M,L),s(o,q),s(o,I),s(I,U),s(I,E),s(I,B),s(o,z),s(o,W),s(W,R),s(o,K),s(o,H),s(H,Q),s(H,Z),s(H,J),s(o,$),s(o,ce),s(ce,x),s(o,ae),s(o,oe),s(oe,de),s(oe,me),s(oe,V)},p(fe,pe){var Ae,Te,be,Be,De,ke,Me,Le,Ie,He;pe&32&&l!==(l=((Te=(Ae=fe[5].realtime)==null?void 0:Ae.cost)!=null?Te:"Cost")+"")&&C(n,l),pe&32&&r!==(r=Vt((Be=(be=fe[5].common)==null?void 0:be.hour)!=null?Be:"Hour")+"")&&C(c,r),pe&2&&p!==(p=Ut(fe[1].h.c,2)+"")&&C(v,p),pe&4&&C(h,fe[2]),pe&32&&A!==(A=Vt((ke=(De=fe[5].common)==null?void 0:De.day)!=null?ke:"Day")+"")&&C(L,A),pe&2&&O!==(O=Ut(fe[1].d.c,1)+"")&&C(U,O),pe&4&&C(B,fe[2]),pe&32&&F!==(F=Vt((Le=(Me=fe[5].common)==null?void 0:Me.month)!=null?Le:"Month")+"")&&C(R,F),pe&2&&y!==(y=Ut(fe[1].m.c)+"")&&C(Q,y),pe&4&&C(J,fe[2]),pe&32&&ie!==(ie=((He=(Ie=fe[5].realtime)==null?void 0:Ie.last_month)!=null?He:"Last month")+"")&&C(x,ie),pe&1&&se!==(se=Ut(fe[0].last_month.c)+"")&&C(de,se),pe&4&&C(V,fe[2])},d(fe){fe&&T(t),fe&&T(i),fe&&T(o)}}}function Cp(e){let t,l=Ut(e[1].h.c,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].h.c,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Np(e){let t,l=Ut(e[1].d.c,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].d.c,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Tp(e){let t,l=Ut(e[1].m.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].m.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Pp(e){let t,l=Ut(e[0].last_month.c)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Ut(f[0].last_month.c)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ep(e){let t,l=Ut(e[1].h.i,2)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].h.i,2)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Ap(e){let t,l=Ut(e[1].d.i,1)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].d.i,1)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Dp(e){let t,l=Ut(e[1].m.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&2&&l!==(l=Ut(f[1].m.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function qp(e){let t,l=Ut(e[0].last_month.i)+"",n,i,o;return{c(){t=m("div"),n=k(l),i=b(),o=k(e[2]),u(t,"class","text-right")},m(f,r){P(f,t,r),s(t,n),s(t,i),s(t,o)},p(f,r){r&1&&l!==(l=Ut(f[0].last_month.i)+"")&&C(n,l),r&4&&C(o,f[2])},d(f){f&&T(t)}}}function Jb(e){var _,p;let t,l,n=((p=(_=e[5].realtime)==null?void 0:_.title)!=null?p:"Real time calculations")+"",i,o,f,r,c,a=e[1]&&Mp(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("br"),r=m("br"),c=b(),a&&a.c(),u(t,"class","mx-2 text-sm")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),s(t,r),s(t,c),a&&a.m(t,null)},p(v,[d]){var h,g;d&32&&n!==(n=((g=(h=v[5].realtime)==null?void 0:h.title)!=null?g:"Real time calculations")+"")&&C(i,n),v[1]?a?a.p(v,d):(a=Mp(v),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(v){v&&T(t),a&&a.d()}}}function $b(e,t,l){let{sysinfo:n}=t,{data:i}=t,{currency:o}=t,{hasExport:f}=t,r={};Ml.subscribe(L=>{l(5,r=L)});let c,a,_,p,v,d,h,g,M=!1,A=3;return e.$$set=L=>{"sysinfo"in L&&l(0,n=L.sysinfo),"data"in L&&l(1,i=L.data),"currency"in L&&l(2,o=L.currency),"hasExport"in L&&l(3,f=L.hasExport)},e.$$.update=()=>{var L,q,I,O,U,E,B,z;e.$$.dirty&19&&(l(4,M=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,A=M?3:2),l(6,c=gl(((L=i==null?void 0:i.h)==null?void 0:L.u)*1e3,"Wh")),l(7,a=gl(((q=i==null?void 0:i.d)==null?void 0:q.u)*1e3,"Wh")),l(8,_=gl(((I=i==null?void 0:i.m)==null?void 0:I.u)*1e3,"Wh")),l(9,p=gl(((O=n==null?void 0:n.last_month)==null?void 0:O.c)*1e3,"Wh")),l(10,v=gl(((U=i==null?void 0:i.h)==null?void 0:U.p)*1e3,"Wh")),l(11,d=gl(((E=i==null?void 0:i.d)==null?void 0:E.p)*1e3,"Wh")),l(12,h=gl(((B=i==null?void 0:i.m)==null?void 0:B.p)*1e3,"Wh")),l(13,g=gl(((z=n==null?void 0:n.last_month)==null?void 0:z.p)*1e3,"Wh")))},[n,i,o,f,M,r,c,a,_,p,v,d,h,g,A]}class xb extends mt{constructor(t){super(),_t(this,t,$b,Jb,rt,{sysinfo:0,data:1,currency:2,hasExport:3})}}function e4(e){let t,l,n=Gm(e[0].source)+"",i,o,f,r,c;return r=new gi({props:{config:e[1]}}),{c(){t=m("a"),l=k("Provided by: "),i=k(n),f=b(),Pe(r.$$.fragment),u(t,"href",o=Vm(e[0].source)),u(t,"target","_blank"),u(t,"class","text-xs float-right z-40")},m(a,_){P(a,t,_),s(t,l),s(t,i),P(a,f,_),Ce(r,a,_),c=!0},p(a,[_]){(!c||_&1)&&n!==(n=Gm(a[0].source)+"")&&C(i,n),(!c||_&1&&o!==(o=Vm(a[0].source)))&&u(t,"href",o);const p={};_&2&&(p.config=a[1]),r.$set(p)},i(a){c||(Y(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(f),Ne(r,a)}}}function t4(e,t,l){let{title:n}=t,{json:i}=t,{sysinfo:o}=t,f={},r,c,a=document.documentElement.classList.contains("dark");return e.$$set=_=>{"title"in _&&l(2,n=_.title),"json"in _&&l(0,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&61){let _=i.currency,p=new Date().getUTCHours(),v=0,d=0,h=0,g=[],M=[],A=[];l(5,c=l(4,r=0));let L=new Date;for(Nn(L,o.clock_offset-(24+L.getHours()-L.getUTCHours())%24),v=p;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(L.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(L,1);for(v=0;v<24&&(d=i[ht(h++)],d!=null);v++)M.push({label:ht(L.getHours())}),A.push(d*100),l(5,c=Math.min(c,d*100)),l(4,r=Math.max(r,d*100)),Nn(L,1);if(c>-100&&r<100){switch(_){case"NOK":case"DKK":_="\xF8re";break;case"SEK":_="\xF6re";break;case"EUR":_="cent";break;case"CHF":_="rp.";break;default:_=_+"/100"}for(l(5,c*=100),l(4,r*=100),v=0;v=0?E.toFixed(B):"",title:E>=0?E.toFixed(2)+" "+_:"",value:d>=0?Math.abs(d):0,label2:E<0?E.toFixed(B):"",title2:E<0?E.toFixed(2)+" "+_:"",value2:d<0?Math.abs(d):0,color:a?"#5c2da5":"#7c3aed"})}let I=Math.max(r,Math.abs(c));if(c<0){l(5,c=Math.min(I/4*-1,c));let E=Math.ceil(Math.abs(c)/I*4),B=c/E;for(v=1;v{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=Nn(new Date,-24),g=new Date().getUTCHours();for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),_=g;_<24;_++){let q=i["i"+ht(_)],I=i["e"+ht(_)];q===void 0&&(q=0),I===void 0&&(I=0),v.push({label:ht(h.getHours())}),d.push({label:q.toFixed(1),title:q.toFixed(2)+" kWh",value:q*10,label2:I.toFixed(1),title2:I.toFixed(2)+" kWh",value2:I*10,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,I*10)),l(4,r=Math.max(r,q*10)),Nn(h,1)}for(_=0;_{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&62){let _=0,p=[],v=[],d=[];l(5,c=l(4,r=0));let h=new Date,g=new Date;for(Nn(h,o.clock_offset-(24+h.getHours()-h.getUTCHours())%24),Nn(g,o.clock_offset-(24+g.getHours()-g.getUTCHours())%24),g.setDate(0),_=h.getDate();_<=g.getDate();_++){let q=i["i"+ht(_)],I=i["e"+ht(_)];q===void 0&&(q=0),I===void 0&&(I=0),v.push({label:ht(_)}),d.push({label:q.toFixed(q<10?1:0),title:q.toFixed(2)+" kWh",value:q,label2:I.toFixed(I<10?1:0),title2:I.toFixed(2)+" kWh",value2:I,color:a?"#5c2da5":"#7c3aed",color2:a?"#27728e":"#37829e"}),l(5,c=Math.max(c,I)),l(4,r=Math.max(r,q))}for(_=1;_{"title"in a&&l(1,n=a.title),"json"in a&&l(2,i=a.json)},e.$$.update=()=>{if(e.$$.dirty&30){let a=0,_=0,p=[],v=[],d=[];i.s&&i.s.forEach((M,A)=>{var L=M.n?M.n:M.a;_=M.v,_==-127&&(_=0),v.push({label:L.slice(-4)}),d.push({label:_.toFixed(1),value:_,color:o?"#5c2da5":"#7c3aed"}),l(4,c=Math.min(c,_)),l(3,r=Math.max(r,_))}),l(3,r=Math.ceil(r)),l(4,c=Math.floor(c));let h=r;c<0&&(h+=Math.abs(c));let g=h/4;for(a=0;a<5;a++)_=c+g*a,p.push({value:_,label:_.toFixed(1)});l(0,f={title:n+" (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:c,max:r,ticks:p},x:{ticks:v},points:d})}},[f,n,i,r,c]}class c4 extends mt{constructor(t){super(),_t(this,t,r4,u4,rt,{title:1,json:2})}}function _4(e){let t,l;return t=new gi({props:{config:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}let m4=0;function p4(e,t,l){let n={};Ml.subscribe(a=>{l(2,n=a)});let{title:i}=t,o=document.documentElement.classList.contains("dark"),f={},r=0,c;return Cv.subscribe(a=>{l(4,c=a)}),Sv(),e.$$set=a=>{"title"in a&&l(1,i=a.title)},e.$$.update=()=>{var a;if(e.$$.dirty&30){let _=0,p=[],v=[],d=[];if(p.push({value:0,label:0}),c&&c.p)for(_=0;_0?ht(h.d)+"."+((a=n.months)==null?void 0:a[new Date().getMonth()]):"-"}),l(3,r=Math.max(r,h.v))}if(c&&c.t){for(_=0;_=r)break;p.push({value:h,label:h})}p.push({label:c.m.toFixed(1),align:"right",color:"green",value:c.m})}c&&c.c&&(p.push({label:c.c.toFixed(0),color:"orange",value:c.c}),l(3,r=Math.max(r,c.c))),l(3,r=Math.ceil(r)),l(0,f={title:i,padding:{top:20,right:35,bottom:20,left:35},y:{min:m4,max:r,ticks:p},x:{ticks:v},points:d})}},[f,i,n,r,c]}class d4 extends mt{constructor(t){super(),_t(this,t,p4,_4,rt,{title:1})}}function Op(e,t,l){const n=e.slice();return n[23]=t[l],n[25]=l,n}function Ip(e,t,l){const n=e.slice();return n[26]=t[l],n}function Lp(e){let t,l,n,i,o,f=e[8],r=[];for(let _=0;_e[16].call(t))},m(_,p){P(_,t,p),s(t,l),s(l,n),s(l,i),s(l,o),s(l,f),s(t,r),a&&a.m(t,null),c=pf(t,e[16].bind(t))},p(_,[p]){p&1&&C(n,_[0]),p&2048&&C(o,_[11]),_[8]?a?a.p(_,p):(a=Lp(_),a.c(),a.m(t,null)):a&&(a.d(1),a=null)},i:ze,o:ze,d(_){_&&T(t),a&&a.d(),c()}}}function h4(e,t,l){let{title:n}=t,i=document.documentElement.classList.contains("dark"),o=0,f=0,r=0,c=!1,a=null,_;Nv.subscribe(W=>{l(13,a=W),r=o,_&&clearTimeout(_),_=setTimeout(Uo,6e5)});function p(){if(r>o||r-o>300)Uo();else for(;o>r;)a.data.unshift(f),l(13,a.data=a.data.slice(0,a.size),a),r+=10}vv.subscribe(W=>{var F;if(f=W.i-W.e,o=W.u,!c){Uo(),c=!0;return}!((F=a==null?void 0:a.data)!=null&&F.length)||p()});let v,d,h,g,M,A,L,q,I,O,U,E,B;function z(){h=this.clientWidth,g=this.clientHeight,l(1,h),l(2,g)}return e.$$set=W=>{"title"in W&&l(0,n=W.title)},e.$$.update=()=>{if(e.$$.dirty&58366&&(l(3,M=parseInt(g)-50),l(4,A=h-35),l(10,E=A/a.size),l(15,d=0),l(14,v=0),a.data)){for(let F in a.data){let R=a.data[F];isNaN(R)&&(R=0),l(14,v=Math.max(Math.ceil(R/1e3)*1e3,v)),l(15,d=Math.min(Math.ceil(R/1e3)*1e3,d))}l(11,B=v>2500?"kW":"W"),l(8,O=[]);for(let F=d;F2500?(F/1e3).toFixed(1):F});l(9,U=[]);for(let F=0;F900?O/1e3:O)+(O>900?"k":"")+i,title:O.toFixed(2)+" "+i,value:isNaN(O)?0:O,color:A(O?O/g*100:0,document.documentElement.classList.contains("dark")),label2:Ut(U>900?U/1e3:U)+(U>900?"k":"")+i,title2:U.toFixed(2)+" "+i,value2:isNaN(U)?0:U,color2:L(U?U/M*100:0)}}return e.$$set=O=>{"title"in O&&l(1,n=O.title),"unit"in O&&l(2,i=O.unit),"l1"in O&&l(3,o=O.l1),"l2"in O&&l(4,f=O.l2),"l2x"in O&&l(5,r=O.l2x),"l3"in O&&l(6,c=O.l3),"l1i"in O&&l(7,a=O.l1i),"l2i"in O&&l(8,_=O.l2i),"l3i"in O&&l(9,p=O.l3i),"l1e"in O&&l(10,v=O.l1e),"l2e"in O&&l(11,d=O.l2e),"l3e"in O&&l(12,h=O.l3e),"maxImport"in O&&l(13,g=O.maxImport),"maxExport"in O&&l(14,M=O.maxExport),"importColorFn"in O&&l(15,A=O.importColorFn),"exportColorFn"in O&&l(16,L=O.exportColorFn)},e.$$.update=()=>{if(e.$$.dirty&32762){let O=[],U=[];o&&(O.push({label:"L1"}),U.push(I(a,v))),f&&(r?(O.push({label:"L2"}),U.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(O.push({label:"L2"}),U.push(I(_,d)))),c&&(O.push({label:"L3"}),U.push(I(p,h)));let E=[];M&&(E.push({value:-M,label:"-100%"}),E.push({value:-M/4*3,label:"-75%"}),E.push({value:-M/2,label:"-50%"}),E.push({value:-M/4,label:"-25%"})),E.push({value:0,label:"0%"}),g&&(E.push({value:g/4,label:"25%"}),E.push({value:g/2,label:"50%"}),E.push({value:g/4*3,label:"75%"}),E.push({value:g,label:"100%"})),l(0,q={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:-M,max:g,ticks:E},x:{ticks:O},points:U})}},[q,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,L]}class Nf extends mt{constructor(t){super(),_t(this,t,k4,g4,rt,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function jp(e){var A,L;let t,l,n,i,o,f,r=(e[0].mt?Go(e[0].mt):"-")+"",c,a,_,p=e[7][0]+"",v,d,h=e[7][1]+"",g,M;return i=new Dv({props:{val:e[0].i?e[0].i:0,max:e[0].im?e[0].im:15e3,unit:"W",label:(L=(A=e[6].common)==null?void 0:A.import)!=null?L:"Import",sub:e[0].p,subunit:e[0].pc,colorFn:gf}}),{c(){t=m("div"),l=m("div"),n=m("div"),Pe(i.$$.fragment),o=b(),f=m("div"),c=k(r),a=b(),_=m("div"),v=k(p),d=b(),g=k(h),u(n,"class","col-span-2"),u(_,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(q,I){P(q,t,I),s(t,l),s(l,n),Ce(i,n,null),s(l,o),s(l,f),s(f,c),s(l,a),s(l,_),s(_,v),s(_,d),s(_,g),M=!0},p(q,I){var U,E;const O={};I&1&&(O.val=q[0].i?q[0].i:0),I&1&&(O.max=q[0].im?q[0].im:15e3),I&64&&(O.label=(E=(U=q[6].common)==null?void 0:U.import)!=null?E:"Import"),I&1&&(O.sub=q[0].p),I&1&&(O.subunit=q[0].pc),i.$set(O),(!M||I&1)&&r!==(r=(q[0].mt?Go(q[0].mt):"-")+"")&&C(c,r),(!M||I&128)&&p!==(p=q[7][0]+"")&&C(v,p),(!M||I&128)&&h!==(h=q[7][1]+"")&&C(g,h)},i(q){M||(Y(i.$$.fragment,q),M=!0)},o(q){ee(i.$$.fragment,q),M=!1},d(q){q&&T(t),Ne(i)}}}function Hp(e){var g,M;let t,l,n,i,o,f,r,c,a=e[8][0]+"",_,p,v=e[8][1]+"",d,h;return i=new Dv({props:{val:e[0].e?e[0].e:0,max:e[0].om?e[0].om*1e3:1e4,unit:"W",label:(M=(g=e[6].common)==null?void 0:g.export)!=null?M:"Export",colorFn:Is}}),{c(){t=m("div"),l=m("div"),n=m("div"),Pe(i.$$.fragment),o=b(),f=m("div"),r=b(),c=m("div"),_=k(a),p=b(),d=k(v),u(n,"class","col-span-2"),u(c,"class","text-right"),u(l,"class","grid grid-cols-2"),u(t,"class","cnt")},m(A,L){P(A,t,L),s(t,l),s(l,n),Ce(i,n,null),s(l,o),s(l,f),s(l,r),s(l,c),s(c,_),s(c,p),s(c,d),h=!0},p(A,L){var I,O;const q={};L&1&&(q.val=A[0].e?A[0].e:0),L&1&&(q.max=A[0].om?A[0].om*1e3:1e4),L&64&&(q.label=(O=(I=A[6].common)==null?void 0:I.export)!=null?O:"Export"),i.$set(q),(!h||L&256)&&a!==(a=A[8][0]+"")&&C(_,a),(!h||L&256)&&v!==(v=A[8][1]+"")&&C(d,v)},i(A){h||(Y(i.$$.fragment,A),h=!0)},o(A){ee(i.$$.fragment,A),h=!1},d(A){A&&T(t),Ne(i)}}}function yp(e){let t,l,n=e[0].l1&&zp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Y(n,1)):(n=zp(i),n.c(),Y(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Y(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function zp(e){var n,i;let t,l;return t=new Vb({props:{title:(i=(n=e[6].common)==null?void 0:n.voltage)!=null?i:"Volt",u1:e[0].l1.u,u2:e[0].l2.u,u3:e[0].l3.u,ds:e[0].ds}}),{c(){Pe(t.$$.fragment)},m(o,f){Ce(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.voltage)!=null?a:"Volt"),f&1&&(r.u1=o[0].l1.u),f&1&&(r.u2=o[0].l2.u),f&1&&(r.u3=o[0].l3.u),f&1&&(r.ds=o[0].ds),t.$set(r)},i(o){l||(Y(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ne(t,o)}}}function Wp(e){let t,l,n=e[0].l1&&Gp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Y(n,1)):(n=Gp(i),n.c(),Y(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Y(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Gp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].common)==null?void 0:n.amperage)!=null?i:"Amp",unit:"A",importColorFn:gf,exportColorFn:Is,maxImport:e[0].mf,maxExport:e[0].om?e[9]?e[0].om/.4/Math.sqrt(3):e[0].om/.23:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l2x:e[0].i2e,l1i:Math.max(e[0].l1.i,0),l2i:Math.max(e[0].l2.i,0),l3i:Math.max(e[0].l3.i,0),l1e:Math.max(e[0].l1.e,0),l2e:Math.max(e[0].l2.e,0),l3e:Math.max(e[0].l3.e,0)}}),{c(){Pe(t.$$.fragment)},m(o,f){Ce(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].common)==null?void 0:c.amperage)!=null?a:"Amp"),f&1&&(r.maxImport=o[0].mf),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om/.4/Math.sqrt(3):o[0].om/.23:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l2x=o[0].i2e),f&1&&(r.l1i=Math.max(o[0].l1.i,0)),f&1&&(r.l2i=Math.max(o[0].l2.i,0)),f&1&&(r.l3i=Math.max(o[0].l3.i,0)),f&1&&(r.l1e=Math.max(o[0].l1.e,0)),f&1&&(r.l2e=Math.max(o[0].l2.e,0)),f&1&&(r.l3e=Math.max(o[0].l3.e,0)),t.$set(r)},i(o){l||(Y(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ne(t,o)}}}function Vp(e){let t,l,n=e[0].l1&&Kp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Y(n,1)):(n=Kp(i),n.c(),Y(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Y(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Kp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.phase)!=null?i:"Phase",unit:"W",importColorFn:gf,exportColorFn:Is,maxImport:(e[0].mf?e[0].mf:32)*230,maxExport:e[0].om?e[9]?e[0].om*1e3/Math.sqrt(3):e[0].om*1e3:0,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.p,l2i:e[0].l2.p,l3i:e[0].l3.p,l1e:e[0].l1.q,l2e:e[0].l2.q,l3e:e[0].l3.q}}),{c(){Pe(t.$$.fragment)},m(o,f){Ce(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.phase)!=null?a:"Phase"),f&1&&(r.maxImport=(o[0].mf?o[0].mf:32)*230),f&513&&(r.maxExport=o[0].om?o[9]?o[0].om*1e3/Math.sqrt(3):o[0].om*1e3:0),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.p),f&1&&(r.l2i=o[0].l2.p),f&1&&(r.l3i=o[0].l3.p),f&1&&(r.l1e=o[0].l1.q),f&1&&(r.l2e=o[0].l2.q),f&1&&(r.l3e=o[0].l3.q),t.$set(r)},i(o){l||(Y(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ne(t,o)}}}function Yp(e){let t,l,n=e[0].l1&&Qp(e);return{c(){t=m("div"),n&&n.c(),u(t,"class","cnt")},m(i,o){P(i,t,o),n&&n.m(t,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&Y(n,1)):(n=Qp(i),n.c(),Y(n,1),n.m(t,null)):n&&(pt(),ee(n,1,1,()=>{n=null}),dt())},i(i){l||(Y(n),l=!0)},o(i){ee(n),l=!1},d(i){i&&T(t),n&&n.d()}}}function Qp(e){var n,i;let t,l;return t=new Nf({props:{title:(i=(n=e[6].dashboard)==null?void 0:n.pf)!=null?i:"Pf",importColorFn:Is,exportColorFn:Is,maxImport:1,l1:e[0].l1&&e[0].l1.u>100,l2:e[0].l2&&e[0].l2.u>100,l3:e[0].l3&&e[0].l3.u>100,l1i:e[0].l1.f,l2i:e[0].l2.f,l3i:e[0].l3.f}}),{c(){Pe(t.$$.fragment)},m(o,f){Ce(t,o,f),l=!0},p(o,f){var c,a;const r={};f&64&&(r.title=(a=(c=o[6].dashboard)==null?void 0:c.pf)!=null?a:"Pf"),f&1&&(r.l1=o[0].l1&&o[0].l1.u>100),f&1&&(r.l2=o[0].l2&&o[0].l2.u>100),f&1&&(r.l3=o[0].l3&&o[0].l3.u>100),f&1&&(r.l1i=o[0].l1.f),f&1&&(r.l2i=o[0].l2.f),f&1&&(r.l3i=o[0].l3.f),t.$set(r)},i(o){l||(Y(t.$$.fragment,o),l=!0)},o(o){ee(t.$$.fragment,o),l=!1},d(o){Ne(t,o)}}}function Xp(e){let t,l,n;return l=new Qb({props:{importInstant:e[0].ri,exportInstant:e[0].re,importTotal:e[0].ric,exportTotal:e[0].rec}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Ce(l,t,null),n=!0},p(i,o){const f={};o&1&&(f.importInstant=i[0].ri),o&1&&(f.exportInstant=i[0].re),o&1&&(f.importTotal=i[0].ric),o&1&&(f.exportTotal=i[0].rec),l.$set(f)},i(i){n||(Y(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ne(l)}}}function Zp(e){let t,l,n;return l=new xb({props:{sysinfo:e[1],data:e[0].ea,currency:e[0].pc,hasExport:e[0].om>0||e[0].e>0}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt")},m(i,o){P(i,t,o),Ce(l,t,null),n=!0},p(i,o){const f={};o&2&&(f.sysinfo=i[1]),o&1&&(f.data=i[0].ea),o&1&&(f.currency=i[0].pc),o&1&&(f.hasExport=i[0].om>0||i[0].e>0),l.$set(f)},i(i){n||(Y(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ne(l)}}}function Jp(e){var i,o;let t,l,n;return l=new d4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.tariffpeak)!=null?o:"Tariff peaks"}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt h-64")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.tariffpeak)!=null?_:"Tariff peaks"),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function $p(e){var i,o;let t,l,n;return l=new b4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.realtime)!=null?o:"Real time"}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.realtime)!=null?_:"Real time"),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function xp(e){var i,o;let t,l,n;return l=new l4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.price)!=null?o:"Price",json:e[2],sysinfo:e[1]}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.price)!=null?_:"Price"),r&4&&(c.json=f[2]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function e2(e){var i,o;let t,l,n;return l=new s4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.day)!=null?o:"24 hours",json:e[3],sysinfo:e[1]}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.day)!=null?_:"24 hours"),r&8&&(c.json=f[3]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function t2(e){var i,o;let t,l,n;return l=new f4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.month)!=null?o:"{0} days",json:e[4],sysinfo:e[1]}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.month)!=null?_:"{0} days"),r&16&&(c.json=f[4]),r&2&&(c.sysinfo=f[1]),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function l2(e){var i,o;let t,l,n;return l=new c4({props:{title:(o=(i=e[6].dashboard)==null?void 0:i.temperature)!=null?o:"Temperature",json:e[5]}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","cnt gwf")},m(f,r){P(f,t,r),Ce(l,t,null),n=!0},p(f,r){var a,_;const c={};r&64&&(c.title=(_=(a=f[6].dashboard)==null?void 0:a.temperature)!=null?_:"Temperature"),r&32&&(c.json=f[5]),l.$set(c)},i(f){n||(Y(l.$$.fragment,f),n=!0)},o(f){ee(l.$$.fragment,f),n=!1},d(f){f&&T(t),Ne(l)}}}function w4(e){let t,l=Ot(e[1].ui.i,e[0].i),n,i=Ot(e[1].ui.e,e[0].om||e[0].e>0),o,f=Ot(e[1].ui.v,e[0].l1&&(e[0].l1.u>100||e[0].l2.u>100||e[0].l3.u>100)),r,c=Ot(e[1].ui.a,e[0].l1&&(e[0].l1.i>.01||e[0].l2.i>.01||e[0].l3.i>.01)),a,_=Ot(e[1].ui.h,e[0].l1&&(e[0].l1.p>.01||e[0].l2.p>.01||e[0].l3.p>.01||e[0].l1.q>.01||e[0].l2.q>.01||e[0].l3.q>.01)),p,v=Ot(e[1].ui.f,e[0].l1&&(e[0].l1.f>.01||e[0].l2.f>.01||e[0].l3.f>.01)),d,h=Ot(e[1].ui.r,e[0].ri>0||e[0].re>0||e[0].ric>0||e[0].rec>0),g,M=Ot(e[1].ui.c,e[0].ea),A,L=Ot(e[1].ui.t,e[0].pr&&(e[0].pr.startsWith("NO")||e[0].pr.startsWith("10YNO")||e[0].pr.startsWith("10Y1001A1001A4"))),q,I=Ot(e[1].ui.l,e[0].hm==1),O,U=Ot(e[1].ui.p,e[0].pe&&!Number.isNaN(e[0].p)),E,B=Ot(e[1].ui.d,e[3]),z,W=Ot(e[1].ui.m,e[4]),F,R=Ot(e[1].ui.s,e[0].t&&e[0].t!=-127&&e[5].c>1),K,H=l&&jp(e),y=i&&Hp(e),Q=f&&yp(e),Z=c&&Wp(e),J=_&&Vp(e),$=v&&Yp(e),ce=h&&Xp(e),ie=M&&Zp(e),x=L&&Jp(e),ae=I&&$p(e),oe=U&&xp(e),se=B&&e2(e),de=W&&t2(e),me=R&&l2(e);return{c(){t=m("div"),H&&H.c(),n=b(),y&&y.c(),o=b(),Q&&Q.c(),r=b(),Z&&Z.c(),a=b(),J&&J.c(),p=b(),$&&$.c(),d=b(),ce&&ce.c(),g=b(),ie&&ie.c(),A=b(),x&&x.c(),q=b(),ae&&ae.c(),O=b(),oe&&oe.c(),E=b(),se&&se.c(),z=b(),de&&de.c(),F=b(),me&&me.c(),u(t,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(V,X){P(V,t,X),H&&H.m(t,null),s(t,n),y&&y.m(t,null),s(t,o),Q&&Q.m(t,null),s(t,r),Z&&Z.m(t,null),s(t,a),J&&J.m(t,null),s(t,p),$&&$.m(t,null),s(t,d),ce&&ce.m(t,null),s(t,g),ie&&ie.m(t,null),s(t,A),x&&x.m(t,null),s(t,q),ae&&ae.m(t,null),s(t,O),oe&&oe.m(t,null),s(t,E),se&&se.m(t,null),s(t,z),de&&de.m(t,null),s(t,F),me&&me.m(t,null),K=!0},p(V,[X]){X&3&&(l=Ot(V[1].ui.i,V[0].i)),l?H?(H.p(V,X),X&3&&Y(H,1)):(H=jp(V),H.c(),Y(H,1),H.m(t,n)):H&&(pt(),ee(H,1,1,()=>{H=null}),dt()),X&3&&(i=Ot(V[1].ui.e,V[0].om||V[0].e>0)),i?y?(y.p(V,X),X&3&&Y(y,1)):(y=Hp(V),y.c(),Y(y,1),y.m(t,o)):y&&(pt(),ee(y,1,1,()=>{y=null}),dt()),X&3&&(f=Ot(V[1].ui.v,V[0].l1&&(V[0].l1.u>100||V[0].l2.u>100||V[0].l3.u>100))),f?Q?(Q.p(V,X),X&3&&Y(Q,1)):(Q=yp(V),Q.c(),Y(Q,1),Q.m(t,r)):Q&&(pt(),ee(Q,1,1,()=>{Q=null}),dt()),X&3&&(c=Ot(V[1].ui.a,V[0].l1&&(V[0].l1.i>.01||V[0].l2.i>.01||V[0].l3.i>.01))),c?Z?(Z.p(V,X),X&3&&Y(Z,1)):(Z=Wp(V),Z.c(),Y(Z,1),Z.m(t,a)):Z&&(pt(),ee(Z,1,1,()=>{Z=null}),dt()),X&3&&(_=Ot(V[1].ui.h,V[0].l1&&(V[0].l1.p>.01||V[0].l2.p>.01||V[0].l3.p>.01||V[0].l1.q>.01||V[0].l2.q>.01||V[0].l3.q>.01))),_?J?(J.p(V,X),X&3&&Y(J,1)):(J=Vp(V),J.c(),Y(J,1),J.m(t,p)):J&&(pt(),ee(J,1,1,()=>{J=null}),dt()),X&3&&(v=Ot(V[1].ui.f,V[0].l1&&(V[0].l1.f>.01||V[0].l2.f>.01||V[0].l3.f>.01))),v?$?($.p(V,X),X&3&&Y($,1)):($=Yp(V),$.c(),Y($,1),$.m(t,d)):$&&(pt(),ee($,1,1,()=>{$=null}),dt()),X&3&&(h=Ot(V[1].ui.r,V[0].ri>0||V[0].re>0||V[0].ric>0||V[0].rec>0)),h?ce?(ce.p(V,X),X&3&&Y(ce,1)):(ce=Xp(V),ce.c(),Y(ce,1),ce.m(t,g)):ce&&(pt(),ee(ce,1,1,()=>{ce=null}),dt()),X&3&&(M=Ot(V[1].ui.c,V[0].ea)),M?ie?(ie.p(V,X),X&3&&Y(ie,1)):(ie=Zp(V),ie.c(),Y(ie,1),ie.m(t,A)):ie&&(pt(),ee(ie,1,1,()=>{ie=null}),dt()),X&3&&(L=Ot(V[1].ui.t,V[0].pr&&(V[0].pr.startsWith("NO")||V[0].pr.startsWith("10YNO")||V[0].pr.startsWith("10Y1001A1001A4")))),L?x?(x.p(V,X),X&3&&Y(x,1)):(x=Jp(V),x.c(),Y(x,1),x.m(t,q)):x&&(pt(),ee(x,1,1,()=>{x=null}),dt()),X&3&&(I=Ot(V[1].ui.l,V[0].hm==1)),I?ae?(ae.p(V,X),X&3&&Y(ae,1)):(ae=$p(V),ae.c(),Y(ae,1),ae.m(t,O)):ae&&(pt(),ee(ae,1,1,()=>{ae=null}),dt()),X&3&&(U=Ot(V[1].ui.p,V[0].pe&&!Number.isNaN(V[0].p))),U?oe?(oe.p(V,X),X&3&&Y(oe,1)):(oe=xp(V),oe.c(),Y(oe,1),oe.m(t,E)):oe&&(pt(),ee(oe,1,1,()=>{oe=null}),dt()),X&10&&(B=Ot(V[1].ui.d,V[3])),B?se?(se.p(V,X),X&10&&Y(se,1)):(se=e2(V),se.c(),Y(se,1),se.m(t,z)):se&&(pt(),ee(se,1,1,()=>{se=null}),dt()),X&18&&(W=Ot(V[1].ui.m,V[4])),W?de?(de.p(V,X),X&18&&Y(de,1)):(de=t2(V),de.c(),Y(de,1),de.m(t,F)):de&&(pt(),ee(de,1,1,()=>{de=null}),dt()),X&35&&(R=Ot(V[1].ui.s,V[0].t&&V[0].t!=-127&&V[5].c>1)),R?me?(me.p(V,X),X&35&&Y(me,1)):(me=l2(V),me.c(),Y(me,1),me.m(t,null)):me&&(pt(),ee(me,1,1,()=>{me=null}),dt())},i(V){K||(Y(H),Y(y),Y(Q),Y(Z),Y(J),Y($),Y(ce),Y(ie),Y(x),Y(ae),Y(oe),Y(se),Y(de),Y(me),K=!0)},o(V){ee(H),ee(y),ee(Q),ee(Z),ee(J),ee($),ee(ce),ee(ie),ee(x),ee(ae),ee(oe),ee(se),ee(de),ee(me),K=!1},d(V){V&&T(t),H&&H.d(),y&&y.d(),Q&&Q.d(),Z&&Z.d(),J&&J.d(),$&&$.d(),ce&&ce.d(),ie&&ie.d(),x&&x.d(),ae&&ae.d(),oe&&oe.d(),se&&se.d(),de&&de.d(),me&&me.d()}}}function M4(e,t,l){let{data:n={}}=t,{sysinfo:i={}}=t,o={},f={},r={},c={};wf.subscribe(d=>{l(2,o=d)}),gv.subscribe(d=>{l(3,f=d)}),kv.subscribe(d=>{l(4,r=d)}),Mv.subscribe(d=>{l(5,c=d)});let a={};Ml.subscribe(d=>{l(6,a=d)});let _,p,v;return e.$$set=d=>{"data"in d&&l(0,n=d.data),"sysinfo"in d&&l(1,i=d.sysinfo)},e.$$.update=()=>{var d,h,g;e.$$.dirty&1&&(l(7,_=gl((n==null?void 0:n.ic)*1e3,"Wh")),l(8,p=gl((n==null?void 0:n.ec)*1e3,"Wh")),l(9,v=((d=n==null?void 0:n.l1)==null?void 0:d.u)>100&&((h=n==null?void 0:n.l2)==null?void 0:h.u)>100&&((g=n==null?void 0:n.l3)==null?void 0:g.u)>100))},[n,i,o,f,r,c,a,_,p,v]}class S4 extends mt{constructor(t){super(),_t(this,t,M4,w4,rt,{data:0,sysinfo:1})}}let sf={};const Es=$t(sf);async function C4(){sf=await(await fetch("configuration.json")).json(),Es.set(sf)}let of={};const qv=$t(of);async function N4(){of=await(await fetch("priceconfig.json")).json(),qv.set(of)}function n2(e,t,l){const n=e.slice();return n[2]=t[l],n[4]=l,n}function T4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=3,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function P4(e){let t;return{c(){t=m("option"),t.textContent="UART0",t.__value=20,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function i2(e){let t;return{c(){t=m("option"),t.textContent="UART2",t.__value=113,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function s2(e){let t,l,n;return{c(){t=m("option"),t.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",t.__value=9,t.value=t.__value,n.__value=16,n.value=n.__value},m(i,o){P(i,t,o),P(i,l,o),P(i,n,o)},d(i){i&&T(t),i&&T(l),i&&T(n)}}}function o2(e){let t;return{c(){t=m("option"),t.textContent="UART1",t.__value=18,t.value=t.__value},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function a2(e){let t,l,n;return{c(){t=m("option"),l=k("GPIO"),n=k(e[4]),t.__value=e[4],t.value=t.__value},m(i,o){P(i,t,o),s(t,l),s(t,n)},d(i){i&&T(t)}}}function f2(e){let t,l=e[4]>1&&!(e[0]=="esp32"&&(e[4]==9||e[4]==16))&&!((e[0]=="esp32s2"||e[0]=="esp32s3")&&e[4]==18)&&!(e[0]=="esp8266"&&(e[4]==3||e[4]==113))&&a2(e);return{c(){l&&l.c(),t=jt()},m(n,i){l&&l.m(n,i),P(n,t,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=a2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&T(t)}}}function E4(e){let t,l,n,i,o;function f(h,g){return h[0]=="esp32c3"?P4:T4}let r=f(e),c=r(e),a=e[0]=="esp8266"&&i2(),_=(e[0]=="esp32"||e[0]=="esp32solo")&&s2(),p=(e[0]=="esp32s2"||e[0]=="esp32s3")&&o2(),v={length:e[1]+1},d=[];for(let h=0;h{"chip"in o&&l(0,n=o.chip)},e.$$.update=()=>{if(e.$$.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 af extends mt{constructor(t){super(),_t(this,t,A4,E4,rt,{chip:0})}}function u2(e){let t,l,n=e[1]&&r2(e);return{c(){t=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),u(t,"class","z-50"),u(t,"aria-modal","true")},m(i,o){P(i,t,o),s(t,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=r2(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&T(t),n&&n.d()}}}function r2(e){let t,l;return{c(){t=m("div"),l=k(e[1]),u(t,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){P(n,t,i),s(t,l)},p(n,i){i&2&&C(l,n[1])},d(n){n&&T(t)}}}function D4(e){let t,l=e[0]&&u2(e);return{c(){l&&l.c(),t=jt()},m(n,i){l&&l.m(n,i),P(n,t,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=u2(n),l.c(),l.m(t.parentNode,t)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){l&&l.d(n),n&&T(t)}}}function q4(e,t,l){let{active:n}=t,{message:i}=t;return e.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class kl extends mt{constructor(t){super(),_t(this,t,q4,D4,rt,{active:0,message:1})}}function c2(e,t,l){const n=e.slice();return n[1]=t[l],n}function _2(e){let t,l,n=e[1]+"",i;return{c(){t=m("option"),l=k("Europe/"),i=k(n),t.__value="Europe/"+e[1],t.value=t.__value},m(o,f){P(o,t,f),s(t,l),s(t,i)},p:ze,d(o){o&&T(t)}}}function O4(e){let t,l,n,i=e[0],o=[];for(let f=0;f>1&1,D=0;D0;w--)D[w]=D[w]?D[w-1]^O.EXPONENT[B._modN(O.LOG[D[w]]+S)]:D[w-1];D[0]=O.EXPONENT[B._modN(O.LOG[D[0]]+S)]}for(S=0;S<=N;S++)D[S]=O.LOG[D[S]]},_checkBadness:function(){var S,w,N,D,j,te=0,ne=this._badness,fe=this.buffer,pe=this.width;for(j=0;jpe*pe;)be-=pe*pe,Te++;for(te+=Te*B.N4,D=0;D=ne-2&&(S=ne-2,j>9&&S--);var fe=S;if(j>9){for(te[fe+2]=0,te[fe+3]=0;fe--;)w=te[fe],te[fe+3]|=255&w<<4,te[fe+2]=w>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[fe+1]=0,te[fe+2]=0;fe--;)w=te[fe],te[fe+2]|=255&w<<4,te[fe+1]=w>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(fe=S+3-(j<10);fe=5&&(N+=B.N1+D[w]-5);for(w=3;wS||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(N+=B.N3);return N},_finish:function(){this._stringBuffer=this.buffer.slice();var S,w,N=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),S=this._checkBadness(),S>=1)D&1&&(j[te-1-w+te*8]=1,w<6?j[8+te*w]=1:j[8+te*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(j[8+te*(te-7+w)]=1,w?j[6-w+te*8]=1:j[7+te*8]=1)},_interleaveBlocks:function(){var S,w,N=this._dataBlock,D=this._ecc,j=this._eccBlock,te=0,ne=this._calculateMaxLength(),fe=this._neccBlock1,pe=this._neccBlock2,Ae=this._stringBuffer;for(S=0;S1)for(S=A.BLOCK[D],N=j-7;;){for(w=j-7;w>S-3&&(this._addAlignment(w,N),!(w6)for(S=E.BLOCK[te-7],w=17,N=0;N<6;N++)for(D=0;D<3;D++,w--)1&(w>11?te>>w-12:S>>w)?(j[5-N+ne*(2-D+ne-11)]=1,j[2-D+ne-11+ne*(5-N)]=1):(this._setMask(5-N,2-D+ne-11),this._setMask(2-D+ne-11,5-N))},_isMasked:function(S,w){var N=B._getMaskBit(S,w);return this._mask[N]===1},_pack:function(){var S,w,N,D=1,j=1,te=this.width,ne=te-1,fe=te-1,pe=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;ww&&(N=S,S=w,w=N),N=w,N+=w*w,N>>=1,N+=S,N},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),z=B,W=d.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),F=W,R=p.extend(function(S,w,N,D){this.name=S,this.modifiable=Boolean(w),this.defaultValue=N,this._valueTransformer=D},{transform:function(S){var w=this._valueTransformer;return typeof w=="function"?w(S,this):S}}),K=R,H=p.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,w){return Object.prototype.hasOwnProperty.call(S,w)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),y=H,Q=p.extend(function(S){this.options={},S.forEach(function(w){this.options[w.name]=w},this)},{exists:function(S){return this.options[S]!=null},get:function(S,w){return Q._get(this.options[S],w)},getAll:function(S){var w,N=this.options,D={};for(w in N)y.hasOwn(N,w)&&(D[w]=Q._get(N[w],S));return D},init:function(S,w,N){typeof N!="function"&&(N=y.noop);var D,j;for(D in this.options)y.hasOwn(this.options,D)&&(j=this.options[D],Q._set(j,j.defaultValue,w),Q._createAccessor(j,w,N));this._setAll(S,w,!0)},set:function(S,w,N){return this._set(S,w,N)},setAll:function(S,w){return this._setAll(S,w)},_set:function(S,w,N,D){var j=this.options[S];if(!j)throw new Error("Invalid option: "+S);if(!j.modifiable&&!D)throw new Error("Option cannot be modified: "+S);return Q._set(j,w,N)},_setAll:function(S,w,N){if(!S)return!1;var D,j=!1;for(D in S)y.hasOwn(S,D)&&this._set(D,S[D],w,N)&&(j=!0);return j}},{_createAccessor:function(S,w,N){var D={get:function(){return Q._get(S,w)}};S.modifiable&&(D.set=function(j){Q._set(S,j,w)&&N(j,S)}),Object.defineProperty(w,S.name,D)},_get:function(S,w){return w["_"+S.name]},_set:function(S,w,N){var D="_"+S.name,j=N[D],te=S.transform(w!=null?w:S.defaultValue);return N[D]=te,te!==j}}),Z=Q,J=p.extend(function(){this._services={}},{getService:function(S){var w=this._services[S];if(!w)throw new Error("Service is not being managed with name: "+S);return w},setService:function(S,w){if(this._services[S])throw new Error("Service is already managed with name: "+S);w&&(this._services[S]=w)}}),$=J,ce=new Z([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,y.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,y.abs),new K("level",!0,"L",y.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,y.abs),new K("size",!0,100,y.abs),new K("value",!0,"")]),ie=new $,x=p.extend(function(S){ce.init(S,this,this.update.bind(this));var w=ce.get("element",this),N=ie.getService("element"),D=w&&N.isCanvas(w)?w:N.createCanvas(),j=w&&N.isImage(w)?w:N.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new F(this,j,j===w),this.update()},{get:function(){return ce.getAll(this)},set:function(S){ce.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new z({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){ie.setService(S.getName(),S)}});Object.defineProperties(x.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ae=x,oe=ae,se=p.extend({getName:function(){}}),de=se,me=de.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),V=me,X=V.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),we=X;oe.use(new we);var ve=oe;return ve})})(Iv);const B4=Iv.exports;function U4(e){let t,l;return{c(){t=m("img"),jo(t.src,l=e[2])||u(t,"src",l),u(t,"alt",e[0]),u(t,"class",e[1])},m(n,i){P(n,t,i)},p(n,[i]){i&4&&!jo(t.src,l=n[2])&&u(t,"src",l),i&1&&u(t,"alt",n[0]),i&2&&u(t,"class",n[1])},i:ze,o:ze,d(n){n&&T(t)}}}function j4(e,t,l){const n=new B4;let{errorCorrection:i="L"}=t,{background:o="#fff"}=t,{color:f="#000"}=t,{size:r="200"}=t,{value:c=""}=t,{padding:a=0}=t,{className:_="qrcode"}=t,p="";function v(){n.set({background:o,foreground:f,level:i,padding:a,size:r,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return jd(()=>{v()}),e.$$set=d=>{"errorCorrection"in d&&l(3,i=d.errorCorrection),"background"in d&&l(4,o=d.background),"color"in d&&l(5,f=d.color),"size"in d&&l(6,r=d.size),"value"in d&&l(0,c=d.value),"padding"in d&&l(7,a=d.padding),"className"in d&&l(1,_=d.className)},e.$$.update=()=>{e.$$.dirty&1&&c&&v()},[c,_,p,i,o,f,r,a]}class H4 extends mt{constructor(t){super(),_t(this,t,j4,U4,rt,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function m2(e,t,l){const n=e.slice();return n[107]=t[l],n}function p2(e,t,l){const n=e.slice();return n[110]=t[l],n[111]=t,n[112]=l,n}function d2(e,t,l){const n=e.slice();return n[113]=t[l],n[114]=t,n[115]=l,n}function y4(e,t,l){const n=e.slice();return n[116]=t[l],n}function z4(e,t,l){const n=e.slice();return n[119]=t[l],n}function v2(e){let t,l,n,i,o;return{c(){t=m("option"),t.textContent="NO1 with support",l=m("option"),l.textContent="NO2 with support",n=m("option"),n.textContent="NO3 with support",i=m("option"),i.textContent="NO4 with support",o=m("option"),o.textContent="NO5 with support",t.__value="NO1S",t.value=t.__value,l.__value="NO2S",l.value=l.__value,n.__value="NO3S",n.value=n.__value,i.__value="NO4S",i.value=i.__value,o.__value="NO5S",o.value=o.__value},m(f,r){P(f,t,r),P(f,l,r),P(f,n,r),P(f,i,r),P(f,o,r)},d(f){f&&T(t),f&&T(l),f&&T(n),f&&T(i),f&&T(o)}}}function W4(e){let t,l;return{c(){t=m("option"),l=k(e[119]),t.__value=e[119],t.value=t.__value},m(n,i){P(n,t,i),s(t,l)},p:ze,d(n){n&&T(t)}}}function G4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.price)==null?void 0:i.conf)!=null?o:"Configure")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.conf)!=null?_:"Configure")+"")&&C(l,t)},d(f){f&&T(l)}}}function h2(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder",n=(c=(r=(f=e[1].conf)==null?void 0:f.price)==null?void 0:r.api_key_placeholder)!=null?c:"")},m(f,r){P(f,t,r),P(f,l,r),ge(l,e[4].p.t),i||(o=re(l,"input",e[24]),i=!0)},p(f,r){var c,a,_;r[0]&2&&n!==(n=(_=(a=(c=f[1].conf)==null?void 0:c.price)==null?void 0:a.api_key_placeholder)!=null?_:"")&&u(l,"placeholder",n),r[0]&16&&l.value!==f[4].p.t&&ge(l,f[4].p.t)},d(f){f&&T(t),f&&T(l),i=!1,o()}}}function b2(e){var M,A,L,q,I,O,U,E;let t,l=((q=(L=(A=(M=e[1].conf)==null?void 0:M.general)==null?void 0:A.security)==null?void 0:L.username)!=null?q:"Username")+"",n,i,o,f,r,c,a=((E=(U=(O=(I=e[1].conf)==null?void 0:I.general)==null?void 0:O.security)==null?void 0:U.password)!=null?E:"Password")+"",_,p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),u(f,"name","gu"),u(f,"type","text"),u(f,"class","in-s"),u(f,"maxlength","36"),u(t,"class","my-1"),u(d,"name","gp"),u(d,"type","password"),u(d,"class","in-s"),u(d,"maxlength","36"),u(c,"class","my-1")},m(B,z){P(B,t,z),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].g.u),P(B,r,z),P(B,c,z),s(c,_),s(c,p),s(c,v),s(c,d),ge(d,e[4].g.p),h||(g=[re(f,"input",e[26]),re(d,"input",e[27])],h=!0)},p(B,z){var W,F,R,K,H,y,Q,Z;z[0]&2&&l!==(l=((K=(R=(F=(W=B[1].conf)==null?void 0:W.general)==null?void 0:F.security)==null?void 0:R.username)!=null?K:"Username")+"")&&C(n,l),z[0]&16&&f.value!==B[4].g.u&&ge(f,B[4].g.u),z[0]&2&&a!==(a=((Z=(Q=(y=(H=B[1].conf)==null?void 0:H.general)==null?void 0:y.security)==null?void 0:Q.password)!=null?Z:"Password")+"")&&C(_,a),z[0]&16&&d.value!==B[4].g.p&&ge(d,B[4].g.p)},d(B){B&&T(t),B&&T(r),B&&T(c),h=!1,Et(g)}}}function V4(e){var ae,oe,se,de,me,V,X,we,ve;let t,l,n=((se=(oe=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:oe.buffer)!=null?se:"Buffer size")+"",i,o,f,r=((V=(me=(de=e[1].conf)==null?void 0:de.meter)==null?void 0:me.serial)!=null?V:"Serial conf.")+"",c,a,_,p,v,d=((ve=(we=(X=e[1].conf)==null?void 0:X.meter)==null?void 0:we.inverted)!=null?ve:"inverted")+"",h,g,M,A,L,q,I,O,U,E,B,z,W,F,R,K,H,y,Q,Z,J,$,ce,ie=[3,12,24,48,96,192,384,576,1152],x=[];for(let S=0;S<9;S+=1)x[S]=Y4(y4(e,ie,S));return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("span"),c=k(r),a=b(),_=m("label"),p=m("input"),v=b(),h=k(d),g=b(),M=m("div"),A=m("select"),L=m("option"),q=k("Autodetect");for(let S=0;S<9;S+=1)x[S].c();O=b(),U=m("select"),E=m("option"),B=k("-"),W=m("option"),W.textContent="7N1",F=m("option"),F.textContent="8N1",R=m("option"),R.textContent="8N2",K=m("option"),K.textContent="7E1",H=m("option"),H.textContent="8E1",Q=b(),Z=m("input"),u(l,"class","float-right"),u(p,"name","mi"),p.__value="true",p.value=p.__value,u(p,"type","checkbox"),u(p,"class","rounded mb-1"),u(_,"class","mt-2 ml-3 whitespace-nowrap"),L.__value=0,L.value=L.__value,L.disabled=I=e[4].m.b!=0,u(A,"name","mb"),u(A,"class","in-f tr w-1/2"),e[4].m.b===void 0&&Ct(()=>e[32].call(A)),E.__value=0,E.value=E.__value,E.disabled=z=e[4].m.b!=0,W.__value=2,W.value=W.__value,F.__value=3,F.value=F.__value,R.__value=7,R.value=R.__value,K.__value=10,K.value=K.__value,H.__value=11,H.value=H.__value,u(U,"name","mp"),u(U,"class","in-m"),U.disabled=y=e[4].m.b==0,e[4].m.p===void 0&&Ct(()=>e[33].call(U)),u(Z,"name","ms"),u(Z,"type","number"),u(Z,"min",64),u(Z,"max",J=e[0].chip=="esp8266"?e[4].i.h.p==3||e[4].i.h.p==113?512:128:4096),u(Z,"step",64),u(Z,"class","in-l tr w-1/2"),u(M,"class","flex w-full"),u(t,"class","my-1")},m(S,w){P(S,t,w),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(t,a),s(t,_),s(_,p),p.checked=e[4].m.i,s(_,v),s(_,h),s(t,g),s(t,M),s(M,A),s(A,L),s(L,q);for(let N=0;N<9;N+=1)x[N]&&x[N].m(A,null);Je(A,e[4].m.b,!0),s(M,O),s(M,U),s(U,E),s(E,B),s(U,W),s(U,F),s(U,R),s(U,K),s(U,H),Je(U,e[4].m.p,!0),s(M,Q),s(M,Z),ge(Z,e[4].m.s),$||(ce=[re(p,"change",e[31]),re(A,"change",e[32]),re(U,"change",e[33]),re(Z,"input",e[34])],$=!0)},p(S,w){var N,D,j,te,ne,fe,pe,Ae,Te;w[0]&2&&n!==(n=((j=(D=(N=S[1].conf)==null?void 0:N.meter)==null?void 0:D.buffer)!=null?j:"Buffer size")+"")&&C(i,n),w[0]&2&&r!==(r=((fe=(ne=(te=S[1].conf)==null?void 0:te.meter)==null?void 0:ne.serial)!=null?fe:"Serial conf.")+"")&&C(c,r),w[0]&16&&(p.checked=S[4].m.i),w[0]&2&&d!==(d=((Te=(Ae=(pe=S[1].conf)==null?void 0:pe.meter)==null?void 0:Ae.inverted)!=null?Te:"inverted")+"")&&C(h,d),w[0]&16&&I!==(I=S[4].m.b!=0)&&(L.disabled=I),w[0]&16&&Je(A,S[4].m.b),w[0]&16&&z!==(z=S[4].m.b!=0)&&(E.disabled=z),w[0]&16&&y!==(y=S[4].m.b==0)&&(U.disabled=y),w[0]&16&&Je(U,S[4].m.p),w[0]&17&&J!==(J=S[0].chip=="esp8266"?S[4].i.h.p==3||S[4].i.h.p==113?512:128:4096)&&u(Z,"max",J),w[0]&16&&Ze(Z.value)!==S[4].m.s&&ge(Z,S[4].m.s)},d(S){S&&T(t),Qt(x,S),$=!1,Et(ce)}}}function K4(e){var a,_,p;let t,l,n=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.pulses)!=null?p:"Pulses per kWh")+"",i,o,f,r,c;return{c(){t=m("div"),l=m("span"),i=k(n),o=b(),f=m("input"),u(f,"name","mb"),u(f,"class","in-s tr"),u(f,"type","number"),u(f,"min",1),u(f,"max",3600),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,l),s(l,i),s(t,o),s(t,f),ge(f,e[4].m.b),r||(c=re(f,"input",e[30]),r=!0)},p(v,d){var h,g,M;d[0]&2&&n!==(n=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.pulses)!=null?M:"Pulses per kWh")+"")&&C(i,n),d[0]&16&&Ze(f.value)!==v[4].m.b&&ge(f,v[4].m.b)},d(v){v&&T(t),r=!1,c()}}}function Y4(e){let t,l=e[116]*100+"",n;return{c(){t=m("option"),n=k(l),t.__value=e[116]*100,t.value=t.__value},m(i,o){P(i,t,o),s(t,n)},p:ze,d(i){i&&T(t)}}}function g2(e){let t,l,n,i;return{c(){t=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,f){P(o,t,f),P(o,l,f),ge(l,e[4].m.e.k),n||(i=re(l,"input",e[39]),n=!0)},p(o,f){f[0]&16&&l.value!==o[4].m.e.k&&ge(l,o[4].m.e.k)},d(o){o&&T(t),o&&T(l),n=!1,i()}}}function k2(e){var a,_,p;let t,l=((p=(_=(a=e[1].conf)==null?void 0:a.meter)==null?void 0:_.authkey)!=null?p:"Authentication key")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","mea"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1")},m(v,d){P(v,t,d),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].m.e.a),r||(c=re(f,"input",e[40]),r=!0)},p(v,d){var h,g,M;d[0]&2&&l!==(l=((M=(g=(h=v[1].conf)==null?void 0:h.meter)==null?void 0:g.authkey)!=null?M:"Authentication key")+"")&&C(n,l),d[0]&16&&f.value!==v[4].m.e.a&&ge(f,v[4].m.e.a)},d(v){v&&T(t),r=!1,c()}}}function w2(e){var y,Q,Z,J,$,ce,ie,x,ae,oe,se,de,me,V,X,we;let t,l,n=((J=(Z=(Q=(y=e[1].conf)==null?void 0:y.meter)==null?void 0:Q.multipliers)==null?void 0:Z.watt)!=null?J:"Watt")+"",i,o,f,r,c,a,_=((x=(ie=(ce=($=e[1].conf)==null?void 0:$.meter)==null?void 0:ce.multipliers)==null?void 0:ie.volt)!=null?x:"Volt")+"",p,v,d,h,g,M,A=((de=(se=(oe=(ae=e[1].conf)==null?void 0:ae.meter)==null?void 0:oe.multipliers)==null?void 0:se.amp)!=null?de:"Amp")+"",L,q,I,O,U,E,B=((we=(X=(V=(me=e[1].conf)==null?void 0:me.meter)==null?void 0:V.multipliers)==null?void 0:X.kwh)!=null?we:"kWh")+"",z,W,F,R,K,H;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),g=b(),M=m("div"),L=k(A),q=m("br"),I=b(),O=m("input"),U=b(),E=m("div"),z=k(B),W=m("br"),F=b(),R=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(h,"name","mmv"),u(h,"type","number"),u(h,"min","0.00"),u(h,"max","1000"),u(h,"step","0.001"),u(h,"class","in-m tr w-full"),u(a,"class","w-1/4"),u(O,"name","mma"),u(O,"type","number"),u(O,"min","0.00"),u(O,"max","1000"),u(O,"step","0.001"),u(O,"class","in-m tr w-full"),u(M,"class","w-1/4"),u(R,"name","mmc"),u(R,"type","number"),u(R,"min","0.00"),u(R,"max","1000"),u(R,"step","0.001"),u(R,"class","in-l tr w-full"),u(E,"class","w-1/4"),u(t,"class","flex my-1")},m(ve,S){P(ve,t,S),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),ge(r,e[4].m.m.w),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h),ge(h,e[4].m.m.v),s(t,g),s(t,M),s(M,L),s(M,q),s(M,I),s(M,O),ge(O,e[4].m.m.a),s(t,U),s(t,E),s(E,z),s(E,W),s(E,F),s(E,R),ge(R,e[4].m.m.c),K||(H=[re(r,"input",e[42]),re(h,"input",e[43]),re(O,"input",e[44]),re(R,"input",e[45])],K=!0)},p(ve,S){var w,N,D,j,te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le;S[0]&2&&n!==(n=((j=(D=(N=(w=ve[1].conf)==null?void 0:w.meter)==null?void 0:N.multipliers)==null?void 0:D.watt)!=null?j:"Watt")+"")&&C(i,n),S[0]&16&&Ze(r.value)!==ve[4].m.m.w&&ge(r,ve[4].m.m.w),S[0]&2&&_!==(_=((pe=(fe=(ne=(te=ve[1].conf)==null?void 0:te.meter)==null?void 0:ne.multipliers)==null?void 0:fe.volt)!=null?pe:"Volt")+"")&&C(p,_),S[0]&16&&Ze(h.value)!==ve[4].m.m.v&&ge(h,ve[4].m.m.v),S[0]&2&&A!==(A=((Be=(be=(Te=(Ae=ve[1].conf)==null?void 0:Ae.meter)==null?void 0:Te.multipliers)==null?void 0:be.amp)!=null?Be:"Amp")+"")&&C(L,A),S[0]&16&&Ze(O.value)!==ve[4].m.m.a&&ge(O,ve[4].m.m.a),S[0]&2&&B!==(B=((Le=(Me=(ke=(De=ve[1].conf)==null?void 0:De.meter)==null?void 0:ke.multipliers)==null?void 0:Me.kwh)!=null?Le:"kWh")+"")&&C(z,B),S[0]&16&&Ze(R.value)!==ve[4].m.m.c&&ge(R,ve[4].m.m.c)},d(ve){ve&&T(t),K=!1,Et(H)}}}function M2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function S2(e){var te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct,qe,ue,Oe,kt,tt,wt,it,st,et,Nt,gt,At,Pt;let t,l=((fe=(ne=(te=e[1].conf)==null?void 0:te.connection)==null?void 0:ne.ssid)!=null?fe:"SSID")+"",n,i,o,f,r,c,a=((Te=(Ae=(pe=e[1].conf)==null?void 0:pe.connection)==null?void 0:Ae.psk)!=null?Te:"Password")+"",_,p,v,d,h,g,M,A=((ke=(De=(Be=(be=e[1].conf)==null?void 0:be.connection)==null?void 0:Be.ps)==null?void 0:De.title)!=null?ke:"Power saving")+"",L,q,I,O,U,E=((He=(Ie=(Le=(Me=e[1].conf)==null?void 0:Me.connection)==null?void 0:Le.ps)==null?void 0:Ie.default)!=null?He:"Default")+"",B,z,W=((xe=($e=(We=(Ye=e[1].conf)==null?void 0:Ye.connection)==null?void 0:We.ps)==null?void 0:$e.off)!=null?xe:"Off")+"",F,R,K=((Oe=(ue=(qe=(ct=e[1].conf)==null?void 0:ct.connection)==null?void 0:qe.ps)==null?void 0:ue.min)!=null?Oe:"Min")+"",H,y,Q=((it=(wt=(tt=(kt=e[1].conf)==null?void 0:kt.connection)==null?void 0:tt.ps)==null?void 0:wt.max)!=null?it:"Max")+"",Z,J,$,ce=((Nt=(et=(st=e[1].conf)==null?void 0:st.connection)==null?void 0:et.pwr)!=null?Nt:"Power")+"",ie,x,ae,oe,se,de,me,V,X,we,ve,S,w=((Pt=(At=(gt=e[1].conf)==null?void 0:gt.connection)==null?void 0:At.tick_11b)!=null?Pt:"802.11b")+"",N,D,j;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("input"),h=b(),g=m("div"),M=m("div"),L=k(A),q=m("br"),I=b(),O=m("select"),U=m("option"),B=k(E),z=m("option"),F=k(W),R=m("option"),H=k(K),y=m("option"),Z=k(Q),J=b(),$=m("div"),ie=k(ce),x=m("br"),ae=b(),oe=m("div"),se=m("input"),de=b(),me=m("span"),me.textContent="dBm",V=b(),X=m("div"),we=m("label"),ve=m("input"),S=b(),N=k(w),u(f,"name","ws"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(d,"name","wp"),u(d,"type","password"),u(d,"class","in-s"),u(c,"class","my-1"),U.__value=255,U.value=U.__value,z.__value=0,z.value=z.__value,R.__value=1,R.value=R.__value,y.__value=2,y.value=y.__value,u(O,"name","wz"),u(O,"class","in-s"),e[4].w.z===void 0&&Ct(()=>e[49].call(O)),u(M,"class","w-1/2"),u(se,"name","ww"),u(se,"type","number"),u(se,"min","0"),u(se,"max","20.5"),u(se,"step","0.5"),u(se,"class","in-f tr w-full"),u(me,"class","in-post"),u(oe,"class","flex"),u($,"class","ml-2 w-1/2"),u(g,"class","my-1 flex"),u(ve,"type","checkbox"),u(ve,"name","wb"),ve.__value="true",ve.value=ve.__value,u(ve,"class","rounded mb-1"),u(X,"class","my-3")},m(Ue,ye){P(Ue,t,ye),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].w.s),P(Ue,r,ye),P(Ue,c,ye),s(c,_),s(c,p),s(c,v),s(c,d),ge(d,e[4].w.p),P(Ue,h,ye),P(Ue,g,ye),s(g,M),s(M,L),s(M,q),s(M,I),s(M,O),s(O,U),s(U,B),s(O,z),s(z,F),s(O,R),s(R,H),s(O,y),s(y,Z),Je(O,e[4].w.z,!0),s(g,J),s(g,$),s($,ie),s($,x),s($,ae),s($,oe),s(oe,se),ge(se,e[4].w.w),s(oe,de),s(oe,me),P(Ue,V,ye),P(Ue,X,ye),s(X,we),s(we,ve),ve.checked=e[4].w.b,s(we,S),s(we,N),D||(j=[re(f,"input",e[47]),re(d,"input",e[48]),re(O,"change",e[49]),re(se,"input",e[50]),re(ve,"change",e[51])],D=!0)},p(Ue,ye){var It,vt,lt,Tt,nt,ot,ut,Ht,Lt,Se,Ge,Rt,Wt,Dt,yt,Gt,Ft,Kt,Xt,el,Zt,at,Mt,Ke,le,je,Re,St,ft,Yt,tl,fl;ye[0]&2&&l!==(l=((lt=(vt=(It=Ue[1].conf)==null?void 0:It.connection)==null?void 0:vt.ssid)!=null?lt:"SSID")+"")&&C(n,l),ye[0]&16&&f.value!==Ue[4].w.s&&ge(f,Ue[4].w.s),ye[0]&2&&a!==(a=((ot=(nt=(Tt=Ue[1].conf)==null?void 0:Tt.connection)==null?void 0:nt.psk)!=null?ot:"Password")+"")&&C(_,a),ye[0]&16&&d.value!==Ue[4].w.p&&ge(d,Ue[4].w.p),ye[0]&2&&A!==(A=((Se=(Lt=(Ht=(ut=Ue[1].conf)==null?void 0:ut.connection)==null?void 0:Ht.ps)==null?void 0:Lt.title)!=null?Se:"Power saving")+"")&&C(L,A),ye[0]&2&&E!==(E=((Dt=(Wt=(Rt=(Ge=Ue[1].conf)==null?void 0:Ge.connection)==null?void 0:Rt.ps)==null?void 0:Wt.default)!=null?Dt:"Default")+"")&&C(B,E),ye[0]&2&&W!==(W=((Kt=(Ft=(Gt=(yt=Ue[1].conf)==null?void 0:yt.connection)==null?void 0:Gt.ps)==null?void 0:Ft.off)!=null?Kt:"Off")+"")&&C(F,W),ye[0]&2&&K!==(K=((at=(Zt=(el=(Xt=Ue[1].conf)==null?void 0:Xt.connection)==null?void 0:el.ps)==null?void 0:Zt.min)!=null?at:"Min")+"")&&C(H,K),ye[0]&2&&Q!==(Q=((je=(le=(Ke=(Mt=Ue[1].conf)==null?void 0:Mt.connection)==null?void 0:Ke.ps)==null?void 0:le.max)!=null?je:"Max")+"")&&C(Z,Q),ye[0]&16&&Je(O,Ue[4].w.z),ye[0]&2&&ce!==(ce=((ft=(St=(Re=Ue[1].conf)==null?void 0:Re.connection)==null?void 0:St.pwr)!=null?ft:"Power")+"")&&C(ie,ce),ye[0]&16&&Ze(se.value)!==Ue[4].w.w&&ge(se,Ue[4].w.w),ye[0]&16&&(ve.checked=Ue[4].w.b),ye[0]&2&&w!==(w=((fl=(tl=(Yt=Ue[1].conf)==null?void 0:Yt.connection)==null?void 0:tl.tick_11b)!=null?fl:"802.11b")+"")&&C(N,w)},d(Ue){Ue&&T(t),Ue&&T(r),Ue&&T(c),Ue&&T(h),Ue&&T(g),Ue&&T(V),Ue&&T(X),D=!1,Et(j)}}}function C2(e){var q,I,O,U,E,B;let t,l=((O=(I=(q=e[1].conf)==null?void 0:q.network)==null?void 0:I.gw)!=null?O:"Gateway")+"",n,i,o,f,r,c,a=((B=(E=(U=e[1].conf)==null?void 0:U.network)==null?void 0:E.dns)!=null?B:"DNS")+"",_,p,v,d,h,g,M,A,L;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),r=b(),c=m("div"),_=k(a),p=m("br"),v=b(),d=m("div"),h=m("input"),g=b(),M=m("input"),u(f,"name","ng"),u(f,"type","text"),u(f,"class","in-s"),u(t,"class","my-1"),u(h,"name","nd1"),u(h,"type","text"),u(h,"class","in-f w-full"),u(M,"name","nd2"),u(M,"type","text"),u(M,"class","in-l w-full"),u(d,"class","flex"),u(c,"class","my-1")},m(z,W){P(z,t,W),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].n.g),P(z,r,W),P(z,c,W),s(c,_),s(c,p),s(c,v),s(c,d),s(d,h),ge(h,e[4].n.d1),s(d,g),s(d,M),ge(M,e[4].n.d2),A||(L=[re(f,"input",e[55]),re(h,"input",e[56]),re(M,"input",e[57])],A=!0)},p(z,W){var F,R,K,H,y,Q;W[0]&2&&l!==(l=((K=(R=(F=z[1].conf)==null?void 0:F.network)==null?void 0:R.gw)!=null?K:"Gateway")+"")&&C(n,l),W[0]&16&&f.value!==z[4].n.g&&ge(f,z[4].n.g),W[0]&2&&a!==(a=((Q=(y=(H=z[1].conf)==null?void 0:H.network)==null?void 0:y.dns)!=null?Q:"DNS")+"")&&C(_,a),W[0]&16&&h.value!==z[4].n.d1&&ge(h,z[4].n.d1),W[0]&16&&M.value!==z[4].n.d2&&ge(M,z[4].n.d2)},d(z){z&&T(t),z&&T(r),z&&T(c),A=!1,Et(L)}}}function N2(e){let t,l,n,i,o;return{c(){t=m("label"),l=m("input"),n=k(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(t,"class","float-right mr-3")},m(f,r){P(f,t,r),s(t,l),l.checked=e[4].q.s.e,s(t,n),i||(o=[re(l,"change",e[62]),re(l,"change",e[16])],i=!0)},p(f,r){r[0]&16&&(l.checked=f[4].q.s.e)},d(f){f&&T(t),i=!1,Et(o)}}}function T2(e){let t,l,n,i,o,f,r,c,a,_,p,v,d;const h=[X4,Q4],g=[];function M(E,B){return E[4].q.s.c?0:1}n=M(e),i=g[n]=h[n](e);const A=[x4,$4],L=[];function q(E,B){return E[4].q.s.r?0:1}r=q(e),c=L[r]=A[r](e);const I=[ng,lg],O=[];function U(E,B){return E[4].q.s.k?0:1}return p=U(e),v=O[p]=I[p](e),{c(){t=m("div"),l=m("span"),i.c(),o=b(),f=m("span"),c.c(),a=b(),_=m("span"),v.c(),u(l,"class","flex pr-2"),u(f,"class","flex pr-2"),u(_,"class","flex pr-2"),u(t,"class","my-1 flex")},m(E,B){P(E,t,B),s(t,l),g[n].m(l,null),s(t,o),s(t,f),L[r].m(f,null),s(t,a),s(t,_),O[p].m(_,null),d=!0},p(E,B){let z=n;n=M(E),n===z?g[n].p(E,B):(pt(),ee(g[z],1,1,()=>{g[z]=null}),dt(),i=g[n],i?i.p(E,B):(i=g[n]=h[n](E),i.c()),Y(i,1),i.m(l,null));let W=r;r=q(E),r===W?L[r].p(E,B):(pt(),ee(L[W],1,1,()=>{L[W]=null}),dt(),c=L[r],c?c.p(E,B):(c=L[r]=A[r](E),c.c()),Y(c,1),c.m(f,null));let F=p;p=U(E),p===F?O[p].p(E,B):(pt(),ee(O[F],1,1,()=>{O[F]=null}),dt(),v=O[p],v?v.p(E,B):(v=O[p]=I[p](E),v.c()),Y(v,1),v.m(_,null))},i(E){d||(Y(i),Y(c),Y(v),d=!0)},o(E){ee(i),ee(c),ee(v),d=!1},d(E){E&&T(t),g[n].d(),L[r].d(),O[p].d()}}}function Q4(e){let t,l;return t=new ln({props:{to:"/mqtt-ca",$$slots:{default:[Z4]},$$scope:{ctx:e}}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function X4(e){let t,l,n,i,o,f,r;return l=new ln({props:{to:"/mqtt-ca",$$slots:{default:[J4]},$$scope:{ctx:e}}}),{c(){t=m("span"),Pe(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Ce(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[13]),re(i,"keypress",e[13])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Y(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ne(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function Z4(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)!=null?o:"Upload CA",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_ca)!=null?c:""}}),{c(){Pe(t.$$.fragment)},m(a,_){Ce(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_ca_upload)!=null?h:"Upload CA"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_ca)!=null?A:""),t.$set(p)},i(a){l||(Y(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ne(t,a)}}}function J4(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)!=null?o:"CA OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.ca_ok)!=null?_:"CA OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function $4(e){let t,l;return t=new ln({props:{to:"/mqtt-cert",$$slots:{default:[eg]},$$scope:{ctx:e}}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function x4(e){let t,l,n,i,o,f,r;return l=new ln({props:{to:"/mqtt-cert",$$slots:{default:[tg]},$$scope:{ctx:e}}}),{c(){t=m("span"),Pe(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Ce(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[14]),re(i,"keypress",e[14])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Y(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ne(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function eg(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)!=null?o:"Upload cert",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_crt)!=null?c:""}}),{c(){Pe(t.$$.fragment)},m(a,_){Ce(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_crt_upload)!=null?h:"Upload cert"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_crt)!=null?A:""),t.$set(p)},i(a){l||(Y(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ne(t,a)}}}function tg(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)!=null?o:"Cert OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.crt_ok)!=null?_:"Cert OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function lg(e){let t,l;return t=new ln({props:{to:"/mqtt-key",$$slots:{default:[ig]},$$scope:{ctx:e}}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i[0]&2|i[3]&536870912&&(o.$$scope={dirty:i,ctx:n}),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function ng(e){let t,l,n,i,o,f,r;return l=new ln({props:{to:"/mqtt-key",$$slots:{default:[sg]},$$scope:{ctx:e}}}),{c(){t=m("span"),Pe(l.$$.fragment),n=b(),i=m("span"),i.textContent="\u{1F5D1}",u(t,"class","bd-on"),u(i,"class","bd-off")},m(c,a){P(c,t,a),Ce(l,t,null),P(c,n,a),P(c,i,a),o=!0,f||(r=[re(i,"click",e[15]),re(i,"keypress",e[15])],f=!0)},p(c,a){const _={};a[0]&2|a[3]&536870912&&(_.$$scope={dirty:a,ctx:c}),l.$set(_)},i(c){o||(Y(l.$$.fragment,c),o=!0)},o(c){ee(l.$$.fragment,c),o=!1},d(c){c&&T(t),Ne(l),c&&T(n),c&&T(i),f=!1,Et(r)}}}function ig(e){var n,i,o,f,r,c;let t,l;return t=new di({props:{color:"blue",text:(o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)!=null?o:"Upload key",title:(c=(r=(f=e[1].conf)==null?void 0:f.mqtt)==null?void 0:r.title_key)!=null?c:""}}),{c(){Pe(t.$$.fragment)},m(a,_){Ce(t,a,_),l=!0},p(a,_){var v,d,h,g,M,A;const p={};_[0]&2&&(p.text=(h=(d=(v=a[1].conf)==null?void 0:v.mqtt)==null?void 0:d.btn_key_upload)!=null?h:"Upload key"),_[0]&2&&(p.title=(A=(M=(g=a[1].conf)==null?void 0:g.mqtt)==null?void 0:M.title_key)!=null?A:""),t.$set(p)},i(a){l||(Y(t.$$.fragment,a),l=!0)},o(a){ee(t.$$.fragment,a),l=!1},d(a){Ne(t,a)}}}function sg(e){var n,i,o;let t=((o=(i=(n=e[1].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)!=null?o:"Key OK")+"",l;return{c(){l=k(t)},m(f,r){P(f,l,r)},p(f,r){var c,a,_;r[0]&2&&t!==(t=((_=(a=(c=f[1].conf)==null?void 0:c.mqtt)==null?void 0:a.key_ok)!=null?_:"Key OK")+"")&&C(l,t)},d(f){f&&T(l)}}}function P2(e){var x,ae,oe,se,de,me,V,X,we,ve,S,w,N,D,j,te;let t,l,n=((se=(oe=(ae=(x=e[1].conf)==null?void 0:x.mqtt)==null?void 0:ae.domoticz)==null?void 0:oe.title)!=null?se:"Domoticz")+"",i,o,f,r,c,a,_,p,v,d=((X=(V=(me=(de=e[1].conf)==null?void 0:de.mqtt)==null?void 0:me.domoticz)==null?void 0:V.eidx)!=null?X:"Electricity IDX")+"",h,g,M,A,L,q,I=((w=(S=(ve=(we=e[1].conf)==null?void 0:we.mqtt)==null?void 0:ve.domoticz)==null?void 0:S.cidx)!=null?w:"Current IDX")+"",O,U,E,B,z,W,F=((te=(j=(D=(N=e[1].conf)==null?void 0:N.mqtt)==null?void 0:D.domoticz)==null?void 0:j.vidx)!=null?te:"Voltage IDX")+"",R,K,H,y,Q,Z,J,$,ce,ie;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("input"),L=b(),q=m("div"),O=k(I),U=m("br"),E=b(),B=m("input"),z=b(),W=m("div"),R=k(F),K=k(`: L1, L2 & L3 + `),H=m("div"),y=m("input"),Q=b(),Z=m("input"),J=b(),$=m("input"),u(l,"class","text-sm"),u(f,"href",zl("MQTT-configuration#domoticz")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(A,"name","oe"),u(A,"type","text"),u(A,"class","in-f tr w-full"),u(v,"class","w-1/2"),u(B,"name","oc"),u(B,"type","text"),u(B,"class","in-l tr w-full"),u(q,"class","w-1/2"),u(p,"class","my-1 flex"),u(y,"name","ou1"),u(y,"type","text"),u(y,"class","in-f tr w-1/3"),u(Z,"name","ou2"),u(Z,"type","text"),u(Z,"class","in-m tr w-1/3"),u($,"name","ou3"),u($,"type","text"),u($,"class","in-l tr w-1/3"),u(H,"class","flex"),u(W,"class","my-1"),u(t,"class","cnt")},m(ne,fe){P(ne,t,fe),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,h),s(v,g),s(v,M),s(v,A),ge(A,e[4].o.e),s(p,L),s(p,q),s(q,O),s(q,U),s(q,E),s(q,B),ge(B,e[4].o.c),s(t,z),s(t,W),s(W,R),s(W,K),s(W,H),s(H,y),ge(y,e[4].o.u1),s(H,Q),s(H,Z),ge(Z,e[4].o.u2),s(H,J),s(H,$),ge($,e[4].o.u3),ce||(ie=[re(A,"input",e[70]),re(B,"input",e[71]),re(y,"input",e[72]),re(Z,"input",e[73]),re($,"input",e[74])],ce=!0)},p(ne,fe){var pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct;fe[0]&2&&n!==(n=((be=(Te=(Ae=(pe=ne[1].conf)==null?void 0:pe.mqtt)==null?void 0:Ae.domoticz)==null?void 0:Te.title)!=null?be:"Domoticz")+"")&&C(i,n),fe[0]&2&&d!==(d=((Me=(ke=(De=(Be=ne[1].conf)==null?void 0:Be.mqtt)==null?void 0:De.domoticz)==null?void 0:ke.eidx)!=null?Me:"Electricity IDX")+"")&&C(h,d),fe[0]&16&&A.value!==ne[4].o.e&&ge(A,ne[4].o.e),fe[0]&2&&I!==(I=((Ye=(He=(Ie=(Le=ne[1].conf)==null?void 0:Le.mqtt)==null?void 0:Ie.domoticz)==null?void 0:He.cidx)!=null?Ye:"Current IDX")+"")&&C(O,I),fe[0]&16&&B.value!==ne[4].o.c&&ge(B,ne[4].o.c),fe[0]&2&&F!==(F=((ct=(xe=($e=(We=ne[1].conf)==null?void 0:We.mqtt)==null?void 0:$e.domoticz)==null?void 0:xe.vidx)!=null?ct:"Voltage IDX")+"")&&C(R,F),fe[0]&16&&y.value!==ne[4].o.u1&&ge(y,ne[4].o.u1),fe[0]&16&&Z.value!==ne[4].o.u2&&ge(Z,ne[4].o.u2),fe[0]&16&&$.value!==ne[4].o.u3&&ge($,ne[4].o.u3)},d(ne){ne&&T(t),ce=!1,Et(ie)}}}function E2(e){var J,$,ce,ie,x,ae,oe,se,de,me,V,X,we,ve,S,w;let t,l,n=((ie=(ce=($=(J=e[1].conf)==null?void 0:J.mqtt)==null?void 0:$.ha)==null?void 0:ce.title)!=null?ie:"Home-Assistant")+"",i,o,f,r,c,a,_,p,v=((se=(oe=(ae=(x=e[1].conf)==null?void 0:x.mqtt)==null?void 0:ae.ha)==null?void 0:oe.discovery)!=null?se:"Discovery topic prefix")+"",d,h,g,M,A,L,q=((X=(V=(me=(de=e[1].conf)==null?void 0:de.mqtt)==null?void 0:me.ha)==null?void 0:V.hostname)!=null?X:"Hostname for URL")+"",I,O,U,E,B,z,W,F=((w=(S=(ve=(we=e[1].conf)==null?void 0:we.mqtt)==null?void 0:ve.ha)==null?void 0:S.tag)!=null?w:"Name tag")+"",R,K,H,y,Q,Z;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),L=m("div"),I=k(q),O=m("br"),U=b(),E=m("input"),z=b(),W=m("div"),R=k(F),K=m("br"),H=b(),y=m("input"),u(l,"class","text-sm"),u(f,"href",zl("MQTT-configuration#home-assistant")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(M,"name","ht"),u(M,"type","text"),u(M,"class","in-s"),u(M,"placeholder","homeassistant"),u(p,"class","my-1"),u(E,"name","hh"),u(E,"type","text"),u(E,"class","in-s"),u(E,"placeholder",B=e[4].g.h+".local"),u(L,"class","my-1"),u(y,"name","hn"),u(y,"type","text"),u(y,"class","in-s"),u(W,"class","my-1"),u(t,"class","cnt")},m(N,D){P(N,t,D),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,d),s(p,h),s(p,g),s(p,M),ge(M,e[4].h.t),s(t,A),s(t,L),s(L,I),s(L,O),s(L,U),s(L,E),ge(E,e[4].h.h),s(t,z),s(t,W),s(W,R),s(W,K),s(W,H),s(W,y),ge(y,e[4].h.n),Q||(Z=[re(M,"input",e[75]),re(E,"input",e[76]),re(y,"input",e[77])],Q=!0)},p(N,D){var j,te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye;D[0]&2&&n!==(n=((fe=(ne=(te=(j=N[1].conf)==null?void 0:j.mqtt)==null?void 0:te.ha)==null?void 0:ne.title)!=null?fe:"Home-Assistant")+"")&&C(i,n),D[0]&2&&v!==(v=((be=(Te=(Ae=(pe=N[1].conf)==null?void 0:pe.mqtt)==null?void 0:Ae.ha)==null?void 0:Te.discovery)!=null?be:"Discovery topic prefix")+"")&&C(d,v),D[0]&16&&M.value!==N[4].h.t&&ge(M,N[4].h.t),D[0]&2&&q!==(q=((Me=(ke=(De=(Be=N[1].conf)==null?void 0:Be.mqtt)==null?void 0:De.ha)==null?void 0:ke.hostname)!=null?Me:"Hostname for URL")+"")&&C(I,q),D[0]&16&&B!==(B=N[4].g.h+".local")&&u(E,"placeholder",B),D[0]&16&&E.value!==N[4].h.h&&ge(E,N[4].h.h),D[0]&2&&F!==(F=((Ye=(He=(Ie=(Le=N[1].conf)==null?void 0:Le.mqtt)==null?void 0:Ie.ha)==null?void 0:He.tag)!=null?Ye:"Name tag")+"")&&C(R,F),D[0]&16&&y.value!==N[4].h.n&&ge(y,N[4].h.n)},d(N){N&&T(t),Q=!1,Et(Z)}}}function A2(e){var K,H,y,Q,Z,J,$,ce,ie;let t,l,n=((y=(H=(K=e[1].conf)==null?void 0:K.cloud)==null?void 0:H.title)!=null?y:"Cloud connections")+"",i,o,f,r,c,a,_,p,v,d,h,g=((J=(Z=(Q=e[1].conf)==null?void 0:Q.cloud)==null?void 0:Z.ams)!=null?J:"AMS reader cloud")+"",M,A,L,q,I,O,U=((ie=(ce=($=e[1].conf)==null?void 0:$.cloud)==null?void 0:ce.es)!=null?ie:"Energy Speedometer")+"",E,B,z,W,F,R=e[4].c.es&&D2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),a=m("input"),_=b(),p=m("div"),v=m("label"),d=m("input"),h=b(),M=k(g),A=b(),L=m("div"),q=m("label"),I=m("input"),O=b(),E=k(U),B=b(),R&&R.c(),u(l,"class","text-sm"),u(f,"href",zl("Cloud")),u(f,"target","_blank"),u(f,"class","float-right"),u(a,"type","hidden"),u(a,"name","c"),a.value="true",u(d,"type","checkbox"),u(d,"name","ce"),d.__value="true",d.value=d.__value,u(d,"class","rounded mb-1"),u(p,"class","my-1"),u(I,"type","checkbox"),u(I,"class","rounded mb-1"),u(I,"name","ces"),I.__value="true",I.value=I.__value,u(L,"class","my-1"),u(t,"class","cnt")},m(x,ae){P(x,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),s(t,a),s(t,_),s(t,p),s(p,v),s(v,d),d.checked=e[4].c.e,s(v,h),s(v,M),s(t,A),s(t,L),s(L,q),s(q,I),I.checked=e[4].c.es,s(q,O),s(q,E),s(L,B),R&&R.m(L,null),z=!0,W||(F=[re(d,"change",e[78]),re(I,"change",e[79])],W=!0)},p(x,ae){var oe,se,de,me,V,X,we,ve,S;(!z||ae[0]&2)&&n!==(n=((de=(se=(oe=x[1].conf)==null?void 0:oe.cloud)==null?void 0:se.title)!=null?de:"Cloud connections")+"")&&C(i,n),ae[0]&16&&(d.checked=x[4].c.e),(!z||ae[0]&2)&&g!==(g=((X=(V=(me=x[1].conf)==null?void 0:me.cloud)==null?void 0:V.ams)!=null?X:"AMS reader cloud")+"")&&C(M,g),ae[0]&16&&(I.checked=x[4].c.es),(!z||ae[0]&2)&&U!==(U=((S=(ve=(we=x[1].conf)==null?void 0:we.cloud)==null?void 0:ve.es)!=null?S:"Energy Speedometer")+"")&&C(E,U),x[4].c.es?R?(R.p(x,ae),ae[0]&16&&Y(R,1)):(R=D2(x),R.c(),Y(R,1),R.m(L,null)):R&&(pt(),ee(R,1,1,()=>{R=null}),dt())},i(x){z||(Y(R),z=!0)},o(x){ee(R),z=!1},d(x){x&&T(t),R&&R.d(),W=!1,Et(F)}}}function D2(e){let t,l,n=e[0].mac+"",i,o,f,r,c=(e[0].meter.id?e[0].meter.id:"missing, required")+"",a,_,p,v,d=e[0].mac&&e[0].meter.id&&q2(e);return{c(){t=m("div"),l=k("MAC: "),i=k(n),o=b(),f=m("div"),r=k("Meter ID: "),a=k(c),_=b(),d&&d.c(),p=jt(),u(t,"class","pl-5"),u(f,"class","pl-5")},m(h,g){P(h,t,g),s(t,l),s(t,i),P(h,o,g),P(h,f,g),s(f,r),s(f,a),P(h,_,g),d&&d.m(h,g),P(h,p,g),v=!0},p(h,g){(!v||g[0]&1)&&n!==(n=h[0].mac+"")&&C(i,n),(!v||g[0]&1)&&c!==(c=(h[0].meter.id?h[0].meter.id:"missing, required")+"")&&C(a,c),h[0].mac&&h[0].meter.id?d?(d.p(h,g),g[0]&1&&Y(d,1)):(d=q2(h),d.c(),Y(d,1),d.m(p.parentNode,p)):d&&(pt(),ee(d,1,1,()=>{d=null}),dt())},i(h){v||(Y(d),v=!0)},o(h){ee(d),v=!1},d(h){h&&T(t),h&&T(o),h&&T(f),h&&T(_),d&&d.d(h),h&&T(p)}}}function q2(e){let t,l,n;return l=new H4({props:{value:'{"mac":"'+e[0].mac+'","meter":"'+e[0].meter.id+'"}'}}),{c(){t=m("div"),Pe(l.$$.fragment),u(t,"class","pl-2")},m(i,o){P(i,t,o),Ce(l,t,null),n=!0},p(i,o){const f={};o[0]&1&&(f.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(f)},i(i){n||(Y(l.$$.fragment,i),n=!0)},o(i){ee(l.$$.fragment,i),n=!1},d(i){i&&T(t),Ne(l)}}}function O2(e){var F,R,K,H,y,Q,Z,J;let t,l,n=((K=(R=(F=e[1].conf)==null?void 0:F.thresholds)==null?void 0:R.title)!=null?K:"Thresholds")+"",i,o,f,r,c,a,_,p,v,d,h,g=((Q=(y=(H=e[1].conf)==null?void 0:H.thresholds)==null?void 0:y.avg)!=null?Q:"Average of")+"",M,A,L,q,I,O=((J=(Z=e[1].common)==null?void 0:Z.hours)!=null?J:"hours")+"",U,E,B,z={length:9},W=[];for(let $=0;$20&&B2(e),d=e[4].i.d.d>0&&H2(e),h=e[0].chip=="esp8266"&&y2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("a"),r=k("\u24D8"),c=b(),v&&v.c(),a=b(),d&&d.c(),_=b(),h&&h.c(),u(l,"class","text-sm"),u(f,"href",zl("GPIO-configuration")),u(f,"target","_blank"),u(f,"class","float-right"),u(t,"class","cnt")},m(L,q){P(L,t,q),s(t,l),s(l,i),s(t,o),s(t,f),s(f,r),s(t,c),v&&v.m(t,null),s(t,a),d&&d.m(t,null),s(t,_),h&&h.m(t,null),p=!0},p(L,q){var I,O,U;(!p||q[0]&2)&&n!==(n=((U=(O=(I=L[1].conf)==null?void 0:I.hw)==null?void 0:O.title)!=null?U:"Hardware")+"")&&C(i,n),L[0].board>20?v?(v.p(L,q),q[0]&1&&Y(v,1)):(v=B2(L),v.c(),Y(v,1),v.m(t,a)):v&&(pt(),ee(v,1,1,()=>{v=null}),dt()),L[4].i.d.d>0?d?d.p(L,q):(d=H2(L),d.c(),d.m(t,_)):d&&(d.d(1),d=null),L[0].chip=="esp8266"?h?h.p(L,q):(h=y2(L),h.c(),h.m(t,null)):h&&(h.d(1),h=null)},i(L){p||(Y(v),p=!0)},o(L){ee(v),p=!1},d(L){L&&T(t),v&&v.d(),d&&d.d(),h&&h.d()}}}function B2(e){var Ht,Lt,Se,Ge,Rt,Wt,Dt,yt,Gt,Ft,Kt,Xt,el,Zt,at,Mt,Ke,le,je,Re,St,ft,Yt,tl,fl,ul,Sl,rl,Cl,ll,_l,dl,Nl,nn,nl,Ee,qt,Pn,Zl,dn,En;let t,l,n,i,o=((Ge=(Se=(Lt=(Ht=e[1].conf)==null?void 0:Ht.hw)==null?void 0:Lt.han)==null?void 0:Se.rx)!=null?Ge:"HAN RX")+"",f,r,c,a,_,p,v,d=((yt=(Dt=(Wt=(Rt=e[1].conf)==null?void 0:Rt.hw)==null?void 0:Wt.han)==null?void 0:Dt.tx)!=null?yt:"HAN TX")+"",h,g,M,A,L,q,I,O,U,E,B=((Xt=(Kt=(Ft=(Gt=e[1].conf)==null?void 0:Gt.hw)==null?void 0:Ft.han)==null?void 0:Kt.pullup)!=null?Xt:"pullup")+"",z,W,F,R,K=((at=(Zt=(el=e[1].conf)==null?void 0:el.hw)==null?void 0:Zt.ap_btn)!=null?at:"AP button")+"",H,y,Q,Z,J,$,ce=((je=(le=(Ke=(Mt=e[1].conf)==null?void 0:Mt.hw)==null?void 0:Ke.led)==null?void 0:le.title)!=null?je:"LED")+"",ie,x,ae,oe,se,de,me,V,X,we,ve=((Yt=(ft=(St=(Re=e[1].conf)==null?void 0:Re.hw)==null?void 0:St.led)==null?void 0:ft.inverted)!=null?Yt:"inverted")+"",S,w,N,D=((Sl=(ul=(fl=(tl=e[1].conf)==null?void 0:tl.hw)==null?void 0:fl.led)==null?void 0:ul.rgb)!=null?Sl:"RGB")+"",j,te,ne,fe,pe=((_l=(ll=(Cl=(rl=e[1].conf)==null?void 0:rl.hw)==null?void 0:Cl.led)==null?void 0:ll.inverted)!=null?_l:"inverted")+"",Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e=((nl=(nn=(Nl=(dl=e[1].conf)==null?void 0:dl.hw)==null?void 0:Nl.led)==null?void 0:nn.disable)!=null?nl:"LED dis. GPIO")+"",xe,ct,qe,ue,Oe,kt=((Pn=(qt=(Ee=e[1].conf)==null?void 0:Ee.hw)==null?void 0:qt.temp)!=null?Pn:"Temperature")+"",tt,wt,it,st,et,Nt,gt=((En=(dn=(Zl=e[1].conf)==null?void 0:Zl.hw)==null?void 0:dn.temp_analog)!=null?En:"Analog temp")+"",At,Pt,Ue,ye,It,vt,lt,Tt,nt;_=new af({props:{chip:e[0].chip}}),L=new af({props:{chip:e[0].chip}});let ot=e[0].chip!="esp8266"&&U2(e),ut=e[4].i.v.p>0&&j2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("select"),Pe(_.$$.fragment),p=b(),v=m("div"),h=k(d),g=m("br"),M=b(),A=m("select"),Pe(L.$$.fragment),q=b(),I=m("div"),O=m("label"),U=m("input"),E=b(),z=k(B),W=b(),F=m("div"),R=m("div"),H=k(K),y=m("br"),Q=b(),Z=m("input"),J=b(),$=m("div"),ie=k(ce),x=m("br"),ae=b(),oe=m("div"),se=m("input"),de=b(),me=m("div"),V=m("label"),X=m("input"),we=b(),S=k(ve),w=b(),N=m("div"),j=k(D),te=m("label"),ne=m("input"),fe=b(),Ae=k(pe),Te=m("br"),be=b(),Be=m("div"),De=m("input"),ke=b(),Me=m("input"),Le=b(),Ie=m("input"),He=b(),Ye=m("div"),We=m("div"),xe=k($e),ct=b(),qe=m("input"),ue=b(),Oe=m("div"),tt=k(kt),wt=m("br"),it=b(),st=m("input"),et=b(),Nt=m("div"),At=k(gt),Pt=m("br"),Ue=b(),ye=m("input"),It=b(),ot&&ot.c(),vt=b(),ut&&ut.c(),u(t,"type","hidden"),u(t,"name","i"),t.value="true",u(a,"name","ihp"),u(a,"class","in-f w-full"),e[4].i.h.p===void 0&&Ct(()=>e[84].call(a)),u(i,"class","w-1/3"),u(A,"name","iht"),u(A,"class","in-l w-full"),e[4].i.h.t===void 0&&Ct(()=>e[85].call(A)),u(v,"class","w-1/3"),u(U,"name","ihu"),U.__value="true",U.value=U.__value,u(U,"type","checkbox"),u(U,"class","rounded mb-1"),u(O,"class","ml-2"),u(I,"class","w-1/3"),u(n,"class","flex flex-wrap"),u(Z,"name","ia"),u(Z,"type","number"),u(Z,"min","0"),u(Z,"max",e[8]),u(Z,"class","in-f tr w-full"),u(R,"class","w-1/3"),u(se,"name","ilp"),u(se,"type","number"),u(se,"min","0"),u(se,"max",e[8]),u(se,"class","in-l tr w-full"),u(oe,"class","flex"),u($,"class","w-1/3"),u(X,"name","ili"),X.__value="true",X.value=X.__value,u(X,"type","checkbox"),u(X,"class","rounded mb-1"),u(V,"class","ml-4"),u(me,"class","w-1/3"),u(ne,"name","iri"),ne.__value="true",ne.value=ne.__value,u(ne,"type","checkbox"),u(ne,"class","rounded mb-1"),u(te,"class","ml-4"),u(De,"name","irr"),u(De,"type","number"),u(De,"min","0"),u(De,"max",e[8]),u(De,"class","in-f tr w-1/3"),u(Me,"name","irg"),u(Me,"type","number"),u(Me,"min","0"),u(Me,"max",e[8]),u(Me,"class","in-m tr w-1/3"),u(Ie,"name","irb"),u(Ie,"type","number"),u(Ie,"min","0"),u(Ie,"max",e[8]),u(Ie,"class","in-l tr w-1/3"),u(Be,"class","flex"),u(N,"class","w-full"),u(qe,"name","idd"),u(qe,"type","number"),u(qe,"min","0"),u(qe,"max",e[8]),u(qe,"class","in-s tr"),u(We,"class","my-1 pr-1 w-1/3"),u(Ye,"class","w-full"),u(st,"name","itd"),u(st,"type","number"),u(st,"min","0"),u(st,"max",e[8]),u(st,"class","in-f tr w-full"),u(Oe,"class","my-1 w-1/3"),u(ye,"name","ita"),u(ye,"type","number"),u(ye,"min","0"),u(ye,"max",e[8]),u(ye,"class","in-l tr w-full"),u(Nt,"class","my-1 pr-1 w-1/3"),u(F,"class","flex flex-wrap")},m(Fe,he){P(Fe,t,he),P(Fe,l,he),P(Fe,n,he),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),Ce(_,a,null),Je(a,e[4].i.h.p,!0),s(n,p),s(n,v),s(v,h),s(v,g),s(v,M),s(v,A),Ce(L,A,null),Je(A,e[4].i.h.t,!0),s(n,q),s(n,I),s(I,O),s(O,U),U.checked=e[4].i.h.u,s(O,E),s(O,z),P(Fe,W,he),P(Fe,F,he),s(F,R),s(R,H),s(R,y),s(R,Q),s(R,Z),ge(Z,e[4].i.a),s(F,J),s(F,$),s($,ie),s($,x),s($,ae),s($,oe),s(oe,se),ge(se,e[4].i.l.p),s(F,de),s(F,me),s(me,V),s(V,X),X.checked=e[4].i.l.i,s(V,we),s(V,S),s(F,w),s(F,N),s(N,j),s(N,te),s(te,ne),ne.checked=e[4].i.r.i,s(te,fe),s(te,Ae),s(N,Te),s(N,be),s(N,Be),s(Be,De),ge(De,e[4].i.r.r),s(Be,ke),s(Be,Me),ge(Me,e[4].i.r.g),s(Be,Le),s(Be,Ie),ge(Ie,e[4].i.r.b),s(F,He),s(F,Ye),s(Ye,We),s(We,xe),s(We,ct),s(We,qe),ge(qe,e[4].i.d.d),s(F,ue),s(F,Oe),s(Oe,tt),s(Oe,wt),s(Oe,it),s(Oe,st),ge(st,e[4].i.t.d),s(F,et),s(F,Nt),s(Nt,At),s(Nt,Pt),s(Nt,Ue),s(Nt,ye),ge(ye,e[4].i.t.a),s(F,It),ot&&ot.m(F,null),s(F,vt),ut&&ut.m(F,null),lt=!0,Tt||(nt=[re(a,"change",e[84]),re(A,"change",e[85]),re(U,"change",e[86]),re(Z,"input",e[87]),re(se,"input",e[88]),re(X,"change",e[89]),re(ne,"change",e[90]),re(De,"input",e[91]),re(Me,"input",e[92]),re(Ie,"input",e[93]),re(qe,"input",e[94]),re(st,"input",e[95]),re(ye,"input",e[96])],Tt=!0)},p(Fe,he){var An,Hn,yn,ml,Jl,$l,zn,xl,Wl,hn,Dn,Wn,Gn,en,cl,Vn,bn,Kn,Gl,ei,ki,fs,us,qn,Tl,rs,ti,cs,wi,_s,gn,Yn,Pl,ms,li,Mi,ps,ds,Si,Qn,El;(!lt||he[0]&2)&&o!==(o=((ml=(yn=(Hn=(An=Fe[1].conf)==null?void 0:An.hw)==null?void 0:Hn.han)==null?void 0:yn.rx)!=null?ml:"HAN RX")+"")&&C(f,o);const Qe={};he[0]&1&&(Qe.chip=Fe[0].chip),_.$set(Qe),he[0]&16&&Je(a,Fe[4].i.h.p),(!lt||he[0]&2)&&d!==(d=((xl=(zn=($l=(Jl=Fe[1].conf)==null?void 0:Jl.hw)==null?void 0:$l.han)==null?void 0:zn.tx)!=null?xl:"HAN TX")+"")&&C(h,d);const vn={};he[0]&1&&(vn.chip=Fe[0].chip),L.$set(vn),he[0]&16&&Je(A,Fe[4].i.h.t),he[0]&16&&(U.checked=Fe[4].i.h.u),(!lt||he[0]&2)&&B!==(B=((Wn=(Dn=(hn=(Wl=Fe[1].conf)==null?void 0:Wl.hw)==null?void 0:hn.han)==null?void 0:Dn.pullup)!=null?Wn:"pullup")+"")&&C(z,B),(!lt||he[0]&2)&&K!==(K=((cl=(en=(Gn=Fe[1].conf)==null?void 0:Gn.hw)==null?void 0:en.ap_btn)!=null?cl:"AP button")+"")&&C(H,K),(!lt||he[0]&256)&&u(Z,"max",Fe[8]),he[0]&16&&Ze(Z.value)!==Fe[4].i.a&&ge(Z,Fe[4].i.a),(!lt||he[0]&2)&&ce!==(ce=((Gl=(Kn=(bn=(Vn=Fe[1].conf)==null?void 0:Vn.hw)==null?void 0:bn.led)==null?void 0:Kn.title)!=null?Gl:"LED")+"")&&C(ie,ce),(!lt||he[0]&256)&&u(se,"max",Fe[8]),he[0]&16&&Ze(se.value)!==Fe[4].i.l.p&&ge(se,Fe[4].i.l.p),he[0]&16&&(X.checked=Fe[4].i.l.i),(!lt||he[0]&2)&&ve!==(ve=((us=(fs=(ki=(ei=Fe[1].conf)==null?void 0:ei.hw)==null?void 0:ki.led)==null?void 0:fs.inverted)!=null?us:"inverted")+"")&&C(S,ve),(!lt||he[0]&2)&&D!==(D=((ti=(rs=(Tl=(qn=Fe[1].conf)==null?void 0:qn.hw)==null?void 0:Tl.led)==null?void 0:rs.rgb)!=null?ti:"RGB")+"")&&C(j,D),he[0]&16&&(ne.checked=Fe[4].i.r.i),(!lt||he[0]&2)&&pe!==(pe=((gn=(_s=(wi=(cs=Fe[1].conf)==null?void 0:cs.hw)==null?void 0:wi.led)==null?void 0:_s.inverted)!=null?gn:"inverted")+"")&&C(Ae,pe),(!lt||he[0]&256)&&u(De,"max",Fe[8]),he[0]&16&&Ze(De.value)!==Fe[4].i.r.r&&ge(De,Fe[4].i.r.r),(!lt||he[0]&256)&&u(Me,"max",Fe[8]),he[0]&16&&Ze(Me.value)!==Fe[4].i.r.g&&ge(Me,Fe[4].i.r.g),(!lt||he[0]&256)&&u(Ie,"max",Fe[8]),he[0]&16&&Ze(Ie.value)!==Fe[4].i.r.b&&ge(Ie,Fe[4].i.r.b),(!lt||he[0]&2)&&$e!==($e=((li=(ms=(Pl=(Yn=Fe[1].conf)==null?void 0:Yn.hw)==null?void 0:Pl.led)==null?void 0:ms.disable)!=null?li:"LED dis. GPIO")+"")&&C(xe,$e),(!lt||he[0]&256)&&u(qe,"max",Fe[8]),he[0]&16&&Ze(qe.value)!==Fe[4].i.d.d&&ge(qe,Fe[4].i.d.d),(!lt||he[0]&2)&&kt!==(kt=((ds=(ps=(Mi=Fe[1].conf)==null?void 0:Mi.hw)==null?void 0:ps.temp)!=null?ds:"Temperature")+"")&&C(tt,kt),(!lt||he[0]&256)&&u(st,"max",Fe[8]),he[0]&16&&Ze(st.value)!==Fe[4].i.t.d&&ge(st,Fe[4].i.t.d),(!lt||he[0]&2)&>!==(gt=((El=(Qn=(Si=Fe[1].conf)==null?void 0:Si.hw)==null?void 0:Qn.temp_analog)!=null?El:"Analog temp")+"")&&C(At,gt),(!lt||he[0]&256)&&u(ye,"max",Fe[8]),he[0]&16&&Ze(ye.value)!==Fe[4].i.t.a&&ge(ye,Fe[4].i.t.a),Fe[0].chip!="esp8266"?ot?ot.p(Fe,he):(ot=U2(Fe),ot.c(),ot.m(F,vt)):ot&&(ot.d(1),ot=null),Fe[4].i.v.p>0?ut?ut.p(Fe,he):(ut=j2(Fe),ut.c(),ut.m(F,null)):ut&&(ut.d(1),ut=null)},i(Fe){lt||(Y(_.$$.fragment,Fe),Y(L.$$.fragment,Fe),lt=!0)},o(Fe){ee(_.$$.fragment,Fe),ee(L.$$.fragment,Fe),lt=!1},d(Fe){Fe&&T(t),Fe&&T(l),Fe&&T(n),Ne(_),Ne(L),Fe&&T(W),Fe&&T(F),ot&&ot.d(),ut&&ut.d(),Tt=!1,Et(nt)}}}function U2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.title)!=null?v:"Vcc")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivp"),u(f,"type","number"),u(f,"min","0"),u(f,"max",e[8]),u(f,"class","in-s tr w-full"),u(t,"class","my-1 pl-1 w-1/3")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].i.v.p),r||(c=re(f,"input",e[97]),r=!0)},p(d,h){var g,M,A,L;h[0]&2&&l!==(l=((L=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.title)!=null?L:"Vcc")+"")&&C(n,l),h[0]&256&&u(f,"max",d[8]),h[0]&16&&Ze(f.value)!==d[4].i.v.p&&ge(f,d[4].i.v.p)},d(d){d&&T(t),r=!1,c()}}}function j2(e){var h,g,M,A;let t,l=((A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.vcc)==null?void 0:M.divider)!=null?A:"Voltage divider")+"",n,i,o,f,r,c,a,_,p,v,d;return{c(){var L,q,I,O,U,E,B,z;t=m("div"),n=k(l),i=m("br"),o=b(),f=m("div"),r=m("input"),a=b(),_=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder",c=(O=(I=(q=(L=e[1].conf)==null?void 0:L.hw)==null?void 0:q.vcc)==null?void 0:I.div_vcc)!=null?O:"VCC"),u(_,"name","ivdg"),u(_,"type","number"),u(_,"min","0"),u(_,"max","65535"),u(_,"class","in-l tr w-full"),u(_,"placeholder",p=(z=(B=(E=(U=e[1].conf)==null?void 0:U.hw)==null?void 0:E.vcc)==null?void 0:B.div_gnd)!=null?z:"GND"),u(f,"class","flex"),u(t,"class","my-1")},m(L,q){P(L,t,q),s(t,n),s(t,i),s(t,o),s(t,f),s(f,r),ge(r,e[4].i.v.d.v),s(f,a),s(f,_),ge(_,e[4].i.v.d.g),v||(d=[re(r,"input",e[98]),re(_,"input",e[99])],v=!0)},p(L,q){var I,O,U,E,B,z,W,F,R,K,H,y;q[0]&2&&l!==(l=((E=(U=(O=(I=L[1].conf)==null?void 0:I.hw)==null?void 0:O.vcc)==null?void 0:U.divider)!=null?E:"Voltage divider")+"")&&C(n,l),q[0]&2&&c!==(c=(F=(W=(z=(B=L[1].conf)==null?void 0:B.hw)==null?void 0:z.vcc)==null?void 0:W.div_vcc)!=null?F:"VCC")&&u(r,"placeholder",c),q[0]&16&&Ze(r.value)!==L[4].i.v.d.v&&ge(r,L[4].i.v.d.v),q[0]&2&&p!==(p=(y=(H=(K=(R=L[1].conf)==null?void 0:R.hw)==null?void 0:K.vcc)==null?void 0:H.div_gnd)!=null?y:"GND")&&u(_,"placeholder",p),q[0]&16&&Ze(_.value)!==L[4].i.v.d.g&&ge(_,L[4].i.v.d.g)},d(L){L&&T(t),v=!1,Et(d)}}}function H2(e){var h,g,M,A,L,q,I,O,U,E,B,z,W,F,R;let t,l=((L=(A=(M=(g=(h=e[1].conf)==null?void 0:h.hw)==null?void 0:g.led)==null?void 0:M.behaviour)==null?void 0:A.title)!=null?L:"LED behaviour")+"",n,i,o,f,r=((E=(U=(O=(I=(q=e[1].conf)==null?void 0:q.hw)==null?void 0:I.led)==null?void 0:O.behaviour)==null?void 0:U.enabled)!=null?E:"Enabled")+"",c,a,_=((R=(F=(W=(z=(B=e[1].conf)==null?void 0:B.hw)==null?void 0:z.led)==null?void 0:W.behaviour)==null?void 0:F.disabled)!=null?R:"Disabled")+"",p,v,d;return{c(){t=m("div"),n=k(l),i=b(),o=m("select"),f=m("option"),c=k(r),a=m("option"),p=k(_),f.__value=0,f.value=f.__value,a.__value=1,a.value=a.__value,u(o,"name","idb"),u(o,"class","in-s"),e[4].i.d.b===void 0&&Ct(()=>e[100].call(o)),u(t,"class","my-1 w-full")},m(K,H){P(K,t,H),s(t,n),s(t,i),s(t,o),s(o,f),s(f,c),s(o,a),s(a,p),Je(o,e[4].i.d.b,!0),v||(d=re(o,"change",e[100]),v=!0)},p(K,H){var y,Q,Z,J,$,ce,ie,x,ae,oe,se,de,me,V,X;H[0]&2&&l!==(l=(($=(J=(Z=(Q=(y=K[1].conf)==null?void 0:y.hw)==null?void 0:Q.led)==null?void 0:Z.behaviour)==null?void 0:J.title)!=null?$:"LED behaviour")+"")&&C(n,l),H[0]&2&&r!==(r=((oe=(ae=(x=(ie=(ce=K[1].conf)==null?void 0:ce.hw)==null?void 0:ie.led)==null?void 0:x.behaviour)==null?void 0:ae.enabled)!=null?oe:"Enabled")+"")&&C(c,r),H[0]&2&&_!==(_=((X=(V=(me=(de=(se=K[1].conf)==null?void 0:se.hw)==null?void 0:de.led)==null?void 0:me.behaviour)==null?void 0:V.disabled)!=null?X:"Disabled")+"")&&C(p,_),H[0]&16&&Je(o,K[4].i.d.b)},d(K){K&&T(t),v=!1,d()}}}function y2(e){var O,U,E,B,z,W,F,R;let t,l,n,i,o=((B=(E=(U=(O=e[1].conf)==null?void 0:O.hw)==null?void 0:U.vcc)==null?void 0:E.offset)!=null?B:"Vcc offset")+"",f,r,c,a,_,p,v=((R=(F=(W=(z=e[1].conf)==null?void 0:z.hw)==null?void 0:W.vcc)==null?void 0:F.multiplier)!=null?R:"Multiplier")+"",d,h,g,M,A,L,q,I=(e[0].board==2||e[0].board==100)&&z2(e);return{c(){t=m("input"),l=b(),n=m("div"),i=m("div"),f=k(o),r=m("br"),c=b(),a=m("input"),_=b(),p=m("div"),d=k(v),h=m("br"),g=b(),M=m("input"),A=b(),I&&I.c(),u(t,"type","hidden"),u(t,"name","iv"),t.value="true",u(a,"name","ivo"),u(a,"type","number"),u(a,"min","0.0"),u(a,"max","3.5"),u(a,"step","0.01"),u(a,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(M,"name","ivm"),u(M,"type","number"),u(M,"min","0.1"),u(M,"max","10"),u(M,"step","0.01"),u(M,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(K,H){P(K,t,H),P(K,l,H),P(K,n,H),s(n,i),s(i,f),s(i,r),s(i,c),s(i,a),ge(a,e[4].i.v.o),s(n,_),s(n,p),s(p,d),s(p,h),s(p,g),s(p,M),ge(M,e[4].i.v.m),s(n,A),I&&I.m(n,null),L||(q=[re(a,"input",e[101]),re(M,"input",e[102])],L=!0)},p(K,H){var y,Q,Z,J,$,ce,ie,x;H[0]&2&&o!==(o=((J=(Z=(Q=(y=K[1].conf)==null?void 0:y.hw)==null?void 0:Q.vcc)==null?void 0:Z.offset)!=null?J:"Vcc offset")+"")&&C(f,o),H[0]&16&&Ze(a.value)!==K[4].i.v.o&&ge(a,K[4].i.v.o),H[0]&2&&v!==(v=((x=(ie=(ce=($=K[1].conf)==null?void 0:$.hw)==null?void 0:ce.vcc)==null?void 0:ie.multiplier)!=null?x:"Multiplier")+"")&&C(d,v),H[0]&16&&Ze(M.value)!==K[4].i.v.m&&ge(M,K[4].i.v.m),K[0].board==2||K[0].board==100?I?I.p(K,H):(I=z2(K),I.c(),I.m(n,null)):I&&(I.d(1),I=null)},d(K){K&&T(t),K&&T(l),K&&T(n),I&&I.d(),L=!1,Et(q)}}}function z2(e){var a,_,p,v;let t,l=((v=(p=(_=(a=e[1].conf)==null?void 0:a.hw)==null?void 0:_.vcc)==null?void 0:p.boot)!=null?v:"Boot limit")+"",n,i,o,f,r,c;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),u(f,"name","ivb"),u(f,"type","number"),u(f,"min","2.5"),u(f,"max","3.5"),u(f,"step","0.1"),u(f,"class","in-s tr w-full"),u(t,"class","w-1/3 pl-1")},m(d,h){P(d,t,h),s(t,n),s(t,i),s(t,o),s(t,f),ge(f,e[4].i.v.b),r||(c=re(f,"input",e[103]),r=!0)},p(d,h){var g,M,A,L;h[0]&2&&l!==(l=((L=(A=(M=(g=d[1].conf)==null?void 0:g.hw)==null?void 0:M.vcc)==null?void 0:A.boot)!=null?L:"Boot limit")+"")&&C(n,l),h[0]&16&&Ze(f.value)!==d[4].i.v.b&&ge(f,d[4].i.v.b)},d(d){d&&T(t),r=!1,c()}}}function W2(e){var U,E,B,z,W,F;let t,l=((B=(E=(U=e[1].conf)==null?void 0:U.debug)==null?void 0:E.danger)!=null?B:"Disable when done")+"",n,i,o,f,r,c,a=((F=(W=(z=e[1].conf)==null?void 0:z.debug)==null?void 0:W.telnet)!=null?F:"Enable telnet")+"",_,p,v,d,h,g,M,A,L,q,I,O=e[4].d.t&&G2(e);return{c(){t=m("div"),n=k(l),i=b(),o=m("div"),f=m("label"),r=m("input"),c=b(),_=k(a),p=b(),O&&O.c(),v=b(),d=m("div"),h=m("select"),g=m("option"),g.textContent="Verbose",M=m("option"),M.textContent="Debug",A=m("option"),A.textContent="Info",L=m("option"),L.textContent="Warning",u(t,"class","bd-red"),u(r,"type","checkbox"),u(r,"name","dt"),r.__value="true",r.value=r.__value,u(r,"class","rounded mb-1"),u(o,"class","my-1"),g.__value=1,g.value=g.__value,M.__value=2,M.value=M.__value,A.__value=3,A.value=A.__value,L.__value=4,L.value=L.__value,u(h,"name","dl"),u(h,"class","in-s"),e[4].d.l===void 0&&Ct(()=>e[106].call(h)),u(d,"class","my-1")},m(R,K){P(R,t,K),s(t,n),P(R,i,K),P(R,o,K),s(o,f),s(f,r),r.checked=e[4].d.t,s(f,c),s(f,_),P(R,p,K),O&&O.m(R,K),P(R,v,K),P(R,d,K),s(d,h),s(h,g),s(h,M),s(h,A),s(h,L),Je(h,e[4].d.l,!0),q||(I=[re(r,"change",e[105]),re(h,"change",e[106])],q=!0)},p(R,K){var H,y,Q,Z,J,$;K[0]&2&&l!==(l=((Q=(y=(H=R[1].conf)==null?void 0:H.debug)==null?void 0:y.danger)!=null?Q:"Disable when done")+"")&&C(n,l),K[0]&16&&(r.checked=R[4].d.t),K[0]&2&&a!==(a=(($=(J=(Z=R[1].conf)==null?void 0:Z.debug)==null?void 0:J.telnet)!=null?$:"Enable telnet")+"")&&C(_,a),R[4].d.t?O?O.p(R,K):(O=G2(R),O.c(),O.m(v.parentNode,v)):O&&(O.d(1),O=null),K[0]&16&&Je(h,R[4].d.l)},d(R){R&&T(t),R&&T(i),R&&T(o),R&&T(p),O&&O.d(R),R&&T(v),R&&T(d),q=!1,Et(I)}}}function G2(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)!=null?f:"Disable when done")+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c[0]&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.debug)==null?void 0:_.telnet_danger)!=null?p:"Disable when done")+"")&&C(n,l)},d(r){r&&T(t)}}}function og(e){var Hu,yu,zu,Wu,Gu,Vu,Ku,Yu,Qu,Xu,Zu,Ju,$u,xu,er,tr,lr,nr,ir,sr,or,ar,fr,ur,rr,cr,_r,mr,pr,dr,vr,hr,br,gr,kr,wr,Mr,Sr,Cr,Nr,Tr,Pr,Er,Ar,Dr,qr,Or,Ir,Lr,Rr,Fr,Br,Ur,jr,Hr,yr,zr,Wr,Gr,Vr,Kr,Yr,Qr,Xr,Zr,Jr,$r,xr,e1,t1,l1,n1,i1,s1,o1,a1,f1,u1,r1,c1,_1,m1,p1,d1,v1,h1,b1,g1,k1,w1,M1,S1,C1,N1,T1,P1,E1,A1,D1,q1,O1,I1,L1,R1,F1,B1,U1,j1,H1,y1,z1,W1,G1,V1,K1,Y1,Q1,X1,Z1,J1,$1,x1,e0,t0,l0,n0,i0,s0,o0,a0,f0,u0,r0,c0,_0,m0,p0,d0,v0,h0,b0,g0,k0,w0,M0,S0,C0,N0,T0,P0,E0,A0,D0,q0,O0,I0;let t,l,n,i,o=((zu=(yu=(Hu=e[1].conf)==null?void 0:Hu.general)==null?void 0:yu.title)!=null?zu:"General")+"",f,r,c,a,_,p,v,d,h,g,M=((Vu=(Gu=(Wu=e[1].conf)==null?void 0:Wu.general)==null?void 0:Gu.hostname)!=null?Vu:"Hostname")+"",A,L,q,I,O,U,E=((Qu=(Yu=(Ku=e[1].conf)==null?void 0:Ku.general)==null?void 0:Yu.timezone)!=null?Qu:"Time zone")+"",B,z,W,F,R,K,H,y,Q,Z,J,$=((Ju=(Zu=(Xu=e[1].conf)==null?void 0:Xu.price)==null?void 0:Zu.region)!=null?Ju:"Price region")+"",ce,ie,x,ae,oe,se,de,me,V,X,we,ve,S,w,N,D,j,te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e=((er=(xu=($u=e[1].conf)==null?void 0:$u.price)==null?void 0:xu.currency)!=null?er:"Currency")+"",xe,ct,qe,ue,Oe,kt,tt,wt,it,st,et,Nt,gt=((nr=(lr=(tr=e[1].conf)==null?void 0:tr.price)==null?void 0:lr.enabled)!=null?nr:"Enabled")+"",At,Pt,Ue,ye,It=((ar=(or=(sr=(ir=e[1].conf)==null?void 0:ir.general)==null?void 0:sr.security)==null?void 0:or.title)!=null?ar:"Security")+"",vt,lt,Tt,nt,ot,ut=((cr=(rr=(ur=(fr=e[1].conf)==null?void 0:fr.general)==null?void 0:ur.security)==null?void 0:rr.none)!=null?cr:"None")+"",Ht,Lt,Se=((dr=(pr=(mr=(_r=e[1].conf)==null?void 0:_r.general)==null?void 0:mr.security)==null?void 0:pr.conf)!=null?dr:"Conf")+"",Ge,Rt,Wt=((gr=(br=(hr=(vr=e[1].conf)==null?void 0:vr.general)==null?void 0:hr.security)==null?void 0:br.all)!=null?gr:"All")+"",Dt,yt,Gt,Ft,Kt=((Mr=(wr=(kr=e[1].conf)==null?void 0:kr.general)==null?void 0:wr.context)!=null?Mr:"Context")+"",Xt,el,Zt,at,Mt,Ke,le,je,Re=((Nr=(Cr=(Sr=e[1].conf)==null?void 0:Sr.meter)==null?void 0:Cr.title)!=null?Nr:"Meter")+"",St,ft,Yt,tl,fl,ul,Sl,rl,Cl,ll,_l=((Ar=(Er=(Pr=(Tr=e[1].conf)==null?void 0:Tr.meter)==null?void 0:Pr.comm)==null?void 0:Er.title)!=null?Ar:"Communication")+"",dl,Nl,nn,nl,Ee,qt=((Ir=(Or=(qr=(Dr=e[1].conf)==null?void 0:Dr.meter)==null?void 0:qr.comm)==null?void 0:Or.passive)!=null?Ir:"Passive")+"",Pn,Zl,dn=((Br=(Fr=(Rr=(Lr=e[1].conf)==null?void 0:Lr.meter)==null?void 0:Rr.comm)==null?void 0:Fr.pulse)!=null?Br:"Pulse")+"",En,Fe,he,Qe,vn=((jr=(Ur=e[1].common)==null?void 0:Ur.voltage)!=null?jr:"Voltage")+"",An,Hn,yn,ml,Jl,$l,zn,xl,Wl,hn=((zr=(yr=(Hr=e[1].conf)==null?void 0:Hr.meter)==null?void 0:yr.fuse)!=null?zr:"Main fuse")+"",Dn,Wn,Gn,en,cl,Vn,bn,Kn,Gl,ei=((Vr=(Gr=(Wr=e[1].conf)==null?void 0:Wr.meter)==null?void 0:Gr.prod)!=null?Vr:"Production")+"",ki,fs,us,qn,Tl,rs,ti,cs,wi,_s,gn,Yn,Pl,ms,li=((Qr=(Yr=(Kr=e[1].conf)==null?void 0:Kr.meter)==null?void 0:Yr.encrypted)!=null?Qr:"Encrypted")+"",Mi,ps,ds,Si,Qn,El,Pf,js=(($r=(Jr=(Zr=(Xr=e[1].conf)==null?void 0:Xr.meter)==null?void 0:Zr.multipliers)==null?void 0:Jr.title)!=null?$r:"Multipliers")+"",Yo,Ef,Af,Vl,Hs,ys=((t1=(e1=(xr=e[1].conf)==null?void 0:xr.connection)==null?void 0:e1.title)!=null?t1:"Connection")+"",Qo,Df,Ci,qf,Of,vs,If,zs,tn,Ni,Ws=((i1=(n1=(l1=e[1].conf)==null?void 0:l1.connection)==null?void 0:n1.wifi)!=null?i1:"WiFi")+"",Xo,Ti,Gs=((a1=(o1=(s1=e[1].conf)==null?void 0:s1.connection)==null?void 0:o1.ap)!=null?a1:"AP")+"",Zo,Lf,Rf,il,Vs,Ks=((r1=(u1=(f1=e[1].conf)==null?void 0:f1.network)==null?void 0:u1.title)!=null?r1:"Network")+"",Jo,Ff,Pi,Bf,Uf,ni,Ys=((m1=(_1=(c1=e[1].conf)==null?void 0:c1.network)==null?void 0:_1.ip)!=null?m1:"IP")+"",$o,jf,Hf,Xn,kn,Ei,Qs=((v1=(d1=(p1=e[1].conf)==null?void 0:p1.network)==null?void 0:d1.dhcp)!=null?v1:"DHCP")+"",xo,Ai,Xs=((g1=(b1=(h1=e[1].conf)==null?void 0:h1.network)==null?void 0:b1.static)!=null?g1:"Static")+"",ea,yf,Kl,Zs,Js,zf,Yl,Di,$s,xs,Wf,ta,eo,to,sn,Gf,Vf,lo,hs,on,Kf,no=((M1=(w1=(k1=e[1].conf)==null?void 0:k1.network)==null?void 0:w1.tick_mdns)!=null?M1:"mDNS")+"",la,Yf,bs,Qf,On,io=((N1=(C1=(S1=e[1].conf)==null?void 0:S1.network)==null?void 0:C1.ntp)!=null?N1:"NTP")+"",na,Xf,qi,an,Zf,so=((E1=(P1=(T1=e[1].conf)==null?void 0:T1.network)==null?void 0:P1.tick_ntp_dhcp)!=null?E1:"from DHCP")+"",ia,Jf,$f,oo,In,xf,Jt,ao,fo=((q1=(D1=(A1=e[1].conf)==null?void 0:A1.mqtt)==null?void 0:D1.title)!=null?q1:"MQTT")+"",sa,eu,Oi,tu,lu,gs,nu,fn,uo=((L1=(I1=(O1=e[1].conf)==null?void 0:O1.mqtt)==null?void 0:I1.server)!=null?L1:"Server")+"",oa,iu,aa,su,ou,Ii,Ln,au,un,fu,fa,ii,ro=((B1=(F1=(R1=e[1].conf)==null?void 0:R1.mqtt)==null?void 0:F1.user)!=null?B1:"Username")+"",ua,uu,ru,Rn,cu,si,co=((H1=(j1=(U1=e[1].conf)==null?void 0:U1.mqtt)==null?void 0:j1.pass)!=null?H1:"Password")+"",ra,_u,mu,Fn,pu,Li,Ri,_o=((W1=(z1=(y1=e[1].conf)==null?void 0:y1.mqtt)==null?void 0:z1.id)!=null?W1:"Client ID")+"",ca,du,vu,Bn,hu,Fi,mo=((K1=(V1=(G1=e[1].conf)==null?void 0:G1.mqtt)==null?void 0:V1.payload)!=null?K1:"Payload")+"",_a,bu,gu,pl,Bi,Ui,ji,po=((Z1=(X1=(Q1=(Y1=e[1].conf)==null?void 0:Y1.mqtt)==null?void 0:Q1.domoticz)==null?void 0:X1.title)!=null?Z1:"Domoticz")+"",ma,Hi,vo=((e0=(x1=($1=(J1=e[1].conf)==null?void 0:J1.mqtt)==null?void 0:$1.ha)==null?void 0:x1.title)!=null?e0:"Home-Assistant")+"",pa,yi,zi,Wi,Gi,ku,oi,ho=((n0=(l0=(t0=e[1].conf)==null?void 0:t0.mqtt)==null?void 0:l0.publish)!=null?n0:"Publish topic")+"",da,wu,Mu,Un,Su,va,ha,ba,ga=e[4].p.r.startsWith("NO")||e[4].p.r.startsWith("10YNO")||e[4].p.r.startsWith("10Y1001A1001A4"),ka,wn,bo,go=((o0=(s0=(i0=e[1].conf)==null?void 0:i0.ui)==null?void 0:s0.title)!=null?o0:"User interface")+"",wa,Cu,Vi,Nu,Tu,ks,Pu,ai,Ma,Ki,ko=((u0=(f0=(a0=e[1].conf)==null?void 0:a0.ui)==null?void 0:f0.lang)!=null?u0:"Language")+"",Sa,Eu,rn,Au,Ca,Ql,wo,Mo=((_0=(c0=(r0=e[1].conf)==null?void 0:r0.debug)==null?void 0:c0.title)!=null?_0:"Debugging")+"",Na,Du,Yi,qu,ws,Ou,So,Ms,cn,Iu,Co=((d0=(p0=(m0=e[1].conf)==null?void 0:m0.debug)==null?void 0:p0.enable)!=null?d0:"Enable debugging")+"",Ta,Lu,Ru,Zn,Pa,Qi,No=((h0=(v0=e[1].conf)==null?void 0:v0.btn_reset)!=null?h0:"Factory reset")+"",Ea,Fu,To,Xi,Po=((g0=(b0=e[1].btn)==null?void 0:b0.reboot)!=null?g0:"Reboot")+"",Aa,Bu,Eo,Ss,Ao=((w0=(k0=e[1].btn)==null?void 0:k0.save)!=null?w0:"Save")+"",Da,qa,fi,Oa,ui,Ia,ri,La,ci,Xe,Ra,Uu;R=new L4({});let Xl=!e[4].p.t&&v2(),Lv=["NOK","SEK","DKK","EUR","CHF"],Cs=[];for(let G=0;G<5;G+=1)Cs[G]=W4(z4(e,Lv,G));tt=new ln({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[G4]},$$scope:{ctx:e}}});let Al=e[4].p.e&&e[0].chip!="esp8266"&&h2(e),Dl=e[4].g.s>0&&b2(e);function ju(G,_e){return G[4].m.a===2?K4:V4}let Do=ju(e),Mn=Do(e),ql=e[4].m.e.e&&g2(e),Ol=e[4].m.e.e&&k2(e),Il=e[4].m.m.e&&w2(e),Ll=e[0].if&&e[0].if.eth&&M2(e),Rl=(e[4].n.c==1||e[4].n.c==2)&&S2(e);Di=new Ov({});let Fl=e[4].n.m=="static"&&C2(e),Bl=e[0].chip!="esp8266"&&N2(e),sl=e[4].q.s.e&&T2(e),Ul=e[4].q.m==3&&P2(e),jl=e[4].q.m==4&&E2(e),ol=e[4].c.es!=null&&A2(e),Hl=ga&&O2(e),Zi=e[9],vl=[];for(let G=0;G20||e[0].chip=="esp8266"||e[4].i.d.d>0)&&F2(e),yl=e[4].d.s&&W2(e);return fi=new kl({props:{active:e[2],message:(C0=(S0=(M0=e[1].conf)==null?void 0:M0.mask)==null?void 0:S0.loading)!=null?C0:"Loading"}}),ui=new kl({props:{active:e[3],message:(P0=(T0=(N0=e[1].conf)==null?void 0:N0.mask)==null?void 0:T0.saving)!=null?P0:"Saving"}}),ri=new kl({props:{active:e[6],message:(D0=(A0=(E0=e[1].conf)==null?void 0:E0.mask)==null?void 0:A0.reset)!=null?D0:"Factory reset"}}),ci=new kl({props:{active:e[7],message:(I0=(O0=(q0=e[1].conf)==null?void 0:q0.mask)==null?void 0:O0.reset_done)!=null?I0:"Done"}}),{c(){var G,_e,xt;t=m("form"),l=m("div"),n=m("div"),i=m("strong"),f=k(o),r=b(),c=m("a"),a=k("\u24D8"),_=b(),p=m("input"),v=b(),d=m("div"),h=m("div"),g=m("div"),A=k(M),L=m("br"),q=b(),I=m("input"),O=b(),U=m("div"),B=k(E),z=m("br"),W=b(),F=m("select"),Pe(R.$$.fragment),K=b(),H=m("input"),y=b(),Q=m("div"),Z=m("div"),J=m("div"),ce=k($),ie=m("br"),x=b(),ae=m("select"),oe=m("optgroup"),Xl&&Xl.c(),se=m("option"),se.textContent="NO1",de=m("option"),de.textContent="NO2",me=m("option"),me.textContent="NO3",V=m("option"),V.textContent="NO4",X=m("option"),X.textContent="NO5",we=m("optgroup"),ve=m("option"),ve.textContent="SE1",S=m("option"),S.textContent="SE2",w=m("option"),w.textContent="SE3",N=m("option"),N.textContent="SE4",D=m("optgroup"),j=m("option"),j.textContent="DK1",te=m("option"),te.textContent="DK2",ne=m("option"),ne.textContent="Austria",fe=m("option"),fe.textContent="Belgium",pe=m("option"),pe.textContent="Czech Republic",Ae=m("option"),Ae.textContent="Estonia",Te=m("option"),Te.textContent="Finland",be=m("option"),be.textContent="France",Be=m("option"),Be.textContent="Germany",De=m("option"),De.textContent="Great Britain",ke=m("option"),ke.textContent="Latvia",Me=m("option"),Me.textContent="Lithuania",Le=m("option"),Le.textContent="Netherland",Ie=m("option"),Ie.textContent="Poland",He=m("option"),He.textContent="Switzerland",Ye=b(),We=m("div"),xe=k($e),ct=m("br"),qe=b(),ue=m("select");for(let bl=0;bl<5;bl+=1)Cs[bl].c();Oe=b(),kt=m("div"),Pe(tt.$$.fragment),wt=b(),it=m("div"),st=m("label"),et=m("input"),Nt=b(),At=k(gt),Pt=b(),Al&&Al.c(),Ue=b(),ye=m("div"),vt=k(It),lt=m("br"),Tt=b(),nt=m("select"),ot=m("option"),Ht=k(ut),Lt=m("option"),Ge=k(Se),Rt=m("option"),Dt=k(Wt),yt=b(),Dl&&Dl.c(),Gt=b(),Ft=m("div"),Xt=k(Kt),el=m("br"),Zt=b(),at=m("input"),Ke=b(),le=m("div"),je=m("strong"),St=k(Re),ft=b(),Yt=m("a"),tl=k("\u24D8"),fl=b(),ul=m("input"),Sl=b(),rl=m("input"),Cl=b(),ll=m("div"),dl=k(_l),Nl=m("br"),nn=b(),nl=m("select"),Ee=m("option"),Pn=k(qt),Zl=m("option"),En=k(dn),Fe=b(),Mn.c(),he=b(),Qe=m("div"),An=k(vn),Hn=m("br"),yn=b(),ml=m("select"),Jl=m("option"),Jl.textContent="400V (TN)",$l=m("option"),$l.textContent="230V (IT/TT)",zn=b(),xl=m("div"),Wl=m("div"),Dn=k(hn),Wn=m("br"),Gn=b(),en=m("label"),cl=m("input"),Vn=b(),bn=m("span"),bn.textContent="A",Kn=b(),Gl=m("div"),ki=k(ei),fs=m("br"),us=b(),qn=m("label"),Tl=m("input"),rs=b(),ti=m("span"),ti.textContent="kWp",cs=b(),wi=m("div"),_s=b(),gn=m("div"),Yn=m("label"),Pl=m("input"),ms=b(),Mi=k(li),ps=b(),ql&&ql.c(),ds=b(),Ol&&Ol.c(),Si=b(),Qn=m("label"),El=m("input"),Pf=b(),Yo=k(js),Ef=b(),Il&&Il.c(),Af=b(),Vl=m("div"),Hs=m("strong"),Qo=k(ys),Df=b(),Ci=m("a"),qf=k("\u24D8"),Of=b(),vs=m("input"),If=b(),zs=m("div"),tn=m("select"),Ni=m("option"),Xo=k(Ws),Ti=m("option"),Zo=k(Gs),Ll&&Ll.c(),Lf=b(),Rl&&Rl.c(),Rf=b(),il=m("div"),Vs=m("strong"),Jo=k(Ks),Ff=b(),Pi=m("a"),Bf=k("\u24D8"),Uf=b(),ni=m("div"),$o=k(Ys),jf=m("br"),Hf=b(),Xn=m("div"),kn=m("select"),Ei=m("option"),xo=k(Qs),Ai=m("option"),ea=k(Xs),yf=b(),Kl=m("input"),zf=b(),Yl=m("select"),Pe(Di.$$.fragment),Wf=b(),Fl&&Fl.c(),ta=b(),eo=m("div"),to=m("label"),sn=m("input"),Gf=k(" IPv6"),Vf=b(),lo=m("div"),hs=m("label"),on=m("input"),Kf=b(),la=k(no),Yf=b(),bs=m("input"),Qf=b(),On=m("div"),na=k(io),Xf=b(),qi=m("label"),an=m("input"),Zf=b(),ia=k(so),Jf=m("br"),$f=b(),oo=m("div"),In=m("input"),xf=b(),Jt=m("div"),ao=m("strong"),sa=k(fo),eu=b(),Oi=m("a"),tu=k("\u24D8"),lu=b(),gs=m("input"),nu=b(),fn=m("div"),oa=k(uo),iu=b(),Bl&&Bl.c(),aa=b(),su=m("br"),ou=b(),Ii=m("div"),Ln=m("input"),au=b(),un=m("input"),fu=b(),sl&&sl.c(),fa=b(),ii=m("div"),ua=k(ro),uu=m("br"),ru=b(),Rn=m("input"),cu=b(),si=m("div"),ra=k(co),_u=m("br"),mu=b(),Fn=m("input"),pu=b(),Li=m("div"),Ri=m("div"),ca=k(_o),du=m("br"),vu=b(),Bn=m("input"),hu=b(),Fi=m("div"),_a=k(mo),bu=m("br"),gu=b(),pl=m("select"),Bi=m("option"),Bi.textContent="Raw (minimal)",Ui=m("option"),Ui.textContent="Raw (full)",ji=m("option"),ma=k(po),Hi=m("option"),pa=k(vo),yi=m("option"),yi.textContent="JSON (classic)",zi=m("option"),zi.textContent="JSON (multi topic)",Wi=m("option"),Wi.textContent="JSON (flat)",Gi=m("option"),Gi.textContent="HEX dump",ku=b(),oi=m("div"),da=k(ho),wu=m("br"),Mu=b(),Un=m("input"),Su=b(),Ul&&Ul.c(),va=b(),jl&&jl.c(),ha=b(),ol&&ol.c(),ba=b(),Hl&&Hl.c(),ka=b(),wn=m("div"),bo=m("strong"),wa=k(go),Cu=b(),Vi=m("a"),Nu=k("\u24D8"),Tu=b(),ks=m("input"),Pu=b(),ai=m("div");for(let bl=0;ble[20].call(F)),u(h,"class","flex"),u(d,"class","my-1"),u(H,"type","hidden"),u(H,"name","p"),H.value="true",se.__value="10YNO-1--------2",se.value=se.__value,de.__value="10YNO-2--------T",de.value=de.__value,me.__value="10YNO-3--------J",me.value=me.__value,V.__value="10YNO-4--------9",V.value=V.__value,X.__value="10Y1001A1001A48H",X.value=X.__value,u(oe,"label","Norway"),ve.__value="10Y1001A1001A44P",ve.value=ve.__value,S.__value="10Y1001A1001A45N",S.value=S.__value,w.__value="10Y1001A1001A46L",w.value=w.__value,N.__value="10Y1001A1001A47J",N.value=N.__value,u(we,"label","Sweden"),j.__value="10YDK-1--------W",j.value=j.__value,te.__value="10YDK-2--------M",te.value=te.__value,u(D,"label","Denmark"),ne.__value="10YAT-APG------L",ne.value=ne.__value,fe.__value="10YBE----------2",fe.value=fe.__value,pe.__value="10YCZ-CEPS-----N",pe.value=pe.__value,Ae.__value="10Y1001A1001A39I",Ae.value=Ae.__value,Te.__value="10YFI-1--------U",Te.value=Te.__value,be.__value="10YFR-RTE------C",be.value=be.__value,Be.__value="10Y1001A1001A83F",Be.value=Be.__value,De.__value="10YGB----------A",De.value=De.__value,ke.__value="10YLV-1001A00074",ke.value=ke.__value,Me.__value="10YLT-1001A0008Q",Me.value=Me.__value,Le.__value="10YNL----------L",Le.value=Le.__value,Ie.__value="10YPL-AREA-----S",Ie.value=Ie.__value,He.__value="10YCH-SWISSGRIDZ",He.value=He.__value,u(ae,"name","pr"),u(ae,"class","in-f w-full"),e[4].p.r===void 0&&Ct(()=>e[21].call(ae)),u(J,"class","w-full"),u(ue,"name","pc"),u(ue,"class","in-l"),e[4].p.c===void 0&&Ct(()=>e[22].call(ue)),u(Z,"class","flex"),u(Q,"class","my-1"),u(kt,"class","my-1"),u(et,"type","checkbox"),u(et,"name","pe"),et.__value="true",et.value=et.__value,u(et,"class","rounded mb-1"),u(it,"class","my-1"),ot.__value=0,ot.value=ot.__value,Lt.__value=1,Lt.value=Lt.__value,Rt.__value=2,Rt.value=Rt.__value,u(nt,"name","gs"),u(nt,"class","in-s"),e[4].g.s===void 0&&Ct(()=>e[25].call(nt)),u(ye,"class","my-1"),u(at,"name","gc"),u(at,"type","text"),u(at,"pattern","[A-Za-z0-9]+"),u(at,"placeholder",Mt=(xt=(_e=(G=e[1].conf)==null?void 0:G.general)==null?void 0:_e.context_placeholder)!=null?xt:"/"),u(at,"class","in-s"),u(at,"maxlength","36"),u(Ft,"class","my-1"),u(n,"class","cnt"),u(je,"class","text-sm"),u(Yt,"href",zl("Meter-configuration")),u(Yt,"target","_blank"),u(Yt,"class","float-right"),u(ul,"type","hidden"),u(ul,"name","m"),ul.value="true",u(rl,"type","hidden"),u(rl,"name","mo"),rl.value="1",Ee.__value=0,Ee.value=Ee.__value,Zl.__value=2,Zl.value=Zl.__value,u(nl,"name","ma"),u(nl,"class","in-s"),e[4].m.a===void 0&&Ct(()=>e[29].call(nl)),u(ll,"class","my-1"),Jl.__value=2,Jl.value=Jl.__value,$l.__value=1,$l.value=$l.__value,u(ml,"name","md"),u(ml,"class","in-s"),e[4].m.d===void 0&&Ct(()=>e[35].call(ml)),u(Qe,"class","my-1"),u(cl,"name","mf"),u(cl,"type","number"),u(cl,"min","5"),u(cl,"max","65535"),u(cl,"class","in-f tr w-full"),u(bn,"class","in-post"),u(en,"class","flex"),u(Wl,"class","mx-1"),u(Tl,"name","mr"),u(Tl,"type","number"),u(Tl,"min","0"),u(Tl,"max","65535"),u(Tl,"class","in-f tr w-full"),u(ti,"class","in-post"),u(qn,"class","flex"),u(Gl,"class","mx-1"),u(xl,"class","my-1 flex"),u(wi,"class","my-1"),u(Pl,"type","checkbox"),u(Pl,"name","me"),Pl.__value="true",Pl.value=Pl.__value,u(Pl,"class","rounded mb-1"),u(gn,"class","my-1"),u(El,"type","checkbox"),u(El,"name","mm"),El.__value="true",El.value=El.__value,u(El,"class","rounded mb-1"),u(le,"class","cnt"),u(Hs,"class","text-sm"),u(Ci,"href",zl("WiFi-configuration")),u(Ci,"target","_blank"),u(Ci,"class","float-right"),u(vs,"type","hidden"),u(vs,"name","w"),vs.value="true",Ni.__value=1,Ni.value=Ni.__value,Ti.__value=2,Ti.value=Ti.__value,u(tn,"name","nc"),u(tn,"class","in-s"),e[4].n.c===void 0&&Ct(()=>e[46].call(tn)),u(zs,"class","my-1"),u(Vl,"class","cnt"),u(Vs,"class","text-sm"),u(Pi,"href",zl("Network-configuration")),u(Pi,"target","_blank"),u(Pi,"class","float-right"),Ei.__value="dhcp",Ei.value=Ei.__value,Ai.__value="static",Ai.value=Ai.__value,u(kn,"name","nm"),u(kn,"class","in-f"),e[4].n.m===void 0&&Ct(()=>e[52].call(kn)),u(Kl,"name","ni"),u(Kl,"type","text"),u(Kl,"class","in-m w-full"),Kl.disabled=Zs=e[4].n.m=="dhcp",Kl.required=Js=e[4].n.m=="static",u(Yl,"name","ns"),u(Yl,"class","in-l"),Yl.disabled=$s=e[4].n.m=="dhcp",Yl.required=xs=e[4].n.m=="static",e[4].n.s===void 0&&Ct(()=>e[54].call(Yl)),u(Xn,"class","flex"),u(ni,"class","my-1"),u(sn,"name","nx"),sn.__value="true",sn.value=sn.__value,u(sn,"type","checkbox"),u(sn,"class","rounded mb-1"),u(eo,"class","my-1"),u(on,"name","nd"),on.__value="true",on.value=on.__value,u(on,"type","checkbox"),u(on,"class","rounded mb-1"),u(lo,"class","my-1"),u(bs,"type","hidden"),u(bs,"name","ntp"),bs.value="true",u(an,"name","ntpd"),an.__value="true",an.value=an.__value,u(an,"type","checkbox"),u(an,"class","rounded mb-1"),u(qi,"class","ml-4"),u(In,"name","ntph"),u(In,"type","text"),u(In,"class","in-s"),u(oo,"class","flex"),u(On,"class","my-1"),u(il,"class","cnt"),u(ao,"class","text-sm"),u(Oi,"href",zl("MQTT-configuration")),u(Oi,"target","_blank"),u(Oi,"class","float-right"),u(gs,"type","hidden"),u(gs,"name","q"),gs.value="true",u(Ln,"name","qh"),u(Ln,"type","text"),u(Ln,"class","in-f w-2/3"),u(un,"name","qp"),u(un,"type","number"),u(un,"min","1024"),u(un,"max","65535"),u(un,"class","in-l tr w-1/3"),u(Ii,"class","flex"),u(fn,"class","my-1"),u(Rn,"name","qu"),u(Rn,"type","text"),u(Rn,"class","in-s"),u(ii,"class","my-1"),u(Fn,"name","qa"),u(Fn,"type","password"),u(Fn,"class","in-s"),u(si,"class","my-1"),u(Bn,"name","qc"),u(Bn,"type","text"),u(Bn,"class","in-f w-full"),Bi.__value=1,Bi.value=Bi.__value,Ui.__value=2,Ui.value=Ui.__value,ji.__value=3,ji.value=ji.__value,Hi.__value=4,Hi.value=Hi.__value,yi.__value=0,yi.value=yi.__value,zi.__value=5,zi.value=zi.__value,Wi.__value=6,Wi.value=Wi.__value,Gi.__value=255,Gi.value=Gi.__value,u(pl,"name","qm"),u(pl,"class","in-l"),e[4].q.m===void 0&&Ct(()=>e[68].call(pl)),u(Li,"class","my-1 flex"),u(Un,"name","qb"),u(Un,"type","text"),u(Un,"class","in-s"),u(oi,"class","my-1"),u(Jt,"class","cnt"),u(bo,"class","text-sm"),u(Vi,"href",zl("User-interface")),u(Vi,"target","_blank"),u(Vi,"class","float-right"),u(ks,"type","hidden"),u(ks,"name","u"),ks.value="true",u(rn,"name","ulang"),u(rn,"class","in-s"),e[4].u.lang===void 0&&Ct(()=>e[83].call(rn)),u(Ki,"class","w-1/2"),u(ai,"class","flex flex-wrap"),u(wn,"class","cnt"),u(wo,"class","text-sm"),u(Yi,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Yi,"target","_blank"),u(Yi,"class","float-right"),u(ws,"type","hidden"),u(ws,"name","d"),ws.value="true",u(cn,"type","checkbox"),u(cn,"name","ds"),cn.__value="true",cn.value=cn.__value,u(cn,"class","rounded mb-1"),u(So,"class","mt-3"),u(Ql,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Qi,"type","button"),u(Qi,"class","btn-red"),u(Xi,"type","button"),u(Xi,"class","btn-yellow"),u(To,"class","text-center"),u(Ss,"type","submit"),u(Ss,"class","btn-pri"),u(Eo,"class","text-right"),u(Zn,"class","grid grid-cols-3 mt-3"),u(t,"autocomplete","off")},m(G,_e){P(G,t,_e),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(c,a),s(n,_),s(n,p),s(n,v),s(n,d),s(d,h),s(h,g),s(g,A),s(g,L),s(g,q),s(g,I),ge(I,e[4].g.h),s(h,O),s(h,U),s(U,B),s(U,z),s(U,W),s(U,F),Ce(R,F,null),Je(F,e[4].g.t,!0),s(n,K),s(n,H),s(n,y),s(n,Q),s(Q,Z),s(Z,J),s(J,ce),s(J,ie),s(J,x),s(J,ae),s(ae,oe),Xl&&Xl.m(oe,null),s(oe,se),s(oe,de),s(oe,me),s(oe,V),s(oe,X),s(ae,we),s(we,ve),s(we,S),s(we,w),s(we,N),s(ae,D),s(D,j),s(D,te),s(ae,ne),s(ae,fe),s(ae,pe),s(ae,Ae),s(ae,Te),s(ae,be),s(ae,Be),s(ae,De),s(ae,ke),s(ae,Me),s(ae,Le),s(ae,Ie),s(ae,He),Je(ae,e[4].p.r,!0),s(Z,Ye),s(Z,We),s(We,xe),s(We,ct),s(We,qe),s(We,ue);for(let xt=0;xt<5;xt+=1)Cs[xt]&&Cs[xt].m(ue,null);Je(ue,e[4].p.c,!0),s(n,Oe),s(n,kt),Ce(tt,kt,null),s(n,wt),s(n,it),s(it,st),s(st,et),et.checked=e[4].p.e,s(st,Nt),s(st,At),s(it,Pt),Al&&Al.m(it,null),s(n,Ue),s(n,ye),s(ye,vt),s(ye,lt),s(ye,Tt),s(ye,nt),s(nt,ot),s(ot,Ht),s(nt,Lt),s(Lt,Ge),s(nt,Rt),s(Rt,Dt),Je(nt,e[4].g.s,!0),s(n,yt),Dl&&Dl.m(n,null),s(n,Gt),s(n,Ft),s(Ft,Xt),s(Ft,el),s(Ft,Zt),s(Ft,at),ge(at,e[4].g.c),s(l,Ke),s(l,le),s(le,je),s(je,St),s(le,ft),s(le,Yt),s(Yt,tl),s(le,fl),s(le,ul),s(le,Sl),s(le,rl),s(le,Cl),s(le,ll),s(ll,dl),s(ll,Nl),s(ll,nn),s(ll,nl),s(nl,Ee),s(Ee,Pn),s(nl,Zl),s(Zl,En),Je(nl,e[4].m.a,!0),s(le,Fe),Mn.m(le,null),s(le,he),s(le,Qe),s(Qe,An),s(Qe,Hn),s(Qe,yn),s(Qe,ml),s(ml,Jl),s(ml,$l),Je(ml,e[4].m.d,!0),s(le,zn),s(le,xl),s(xl,Wl),s(Wl,Dn),s(Wl,Wn),s(Wl,Gn),s(Wl,en),s(en,cl),ge(cl,e[4].m.f),s(en,Vn),s(en,bn),s(xl,Kn),s(xl,Gl),s(Gl,ki),s(Gl,fs),s(Gl,us),s(Gl,qn),s(qn,Tl),ge(Tl,e[4].m.r),s(qn,rs),s(qn,ti),s(le,cs),s(le,wi),s(le,_s),s(le,gn),s(gn,Yn),s(Yn,Pl),Pl.checked=e[4].m.e.e,s(Yn,ms),s(Yn,Mi),s(gn,ps),ql&&ql.m(gn,null),s(le,ds),Ol&&Ol.m(le,null),s(le,Si),s(le,Qn),s(Qn,El),El.checked=e[4].m.m.e,s(Qn,Pf),s(Qn,Yo),s(le,Ef),Il&&Il.m(le,null),s(l,Af),s(l,Vl),s(Vl,Hs),s(Hs,Qo),s(Vl,Df),s(Vl,Ci),s(Ci,qf),s(Vl,Of),s(Vl,vs),s(Vl,If),s(Vl,zs),s(zs,tn),s(tn,Ni),s(Ni,Xo),s(tn,Ti),s(Ti,Zo),Ll&&Ll.m(tn,null),Je(tn,e[4].n.c,!0),s(Vl,Lf),Rl&&Rl.m(Vl,null),s(l,Rf),s(l,il),s(il,Vs),s(Vs,Jo),s(il,Ff),s(il,Pi),s(Pi,Bf),s(il,Uf),s(il,ni),s(ni,$o),s(ni,jf),s(ni,Hf),s(ni,Xn),s(Xn,kn),s(kn,Ei),s(Ei,xo),s(kn,Ai),s(Ai,ea),Je(kn,e[4].n.m,!0),s(Xn,yf),s(Xn,Kl),ge(Kl,e[4].n.i),s(Xn,zf),s(Xn,Yl),Ce(Di,Yl,null),Je(Yl,e[4].n.s,!0),s(il,Wf),Fl&&Fl.m(il,null),s(il,ta),s(il,eo),s(eo,to),s(to,sn),sn.checked=e[4].n.x,s(to,Gf),s(il,Vf),s(il,lo),s(lo,hs),s(hs,on),on.checked=e[4].n.d,s(hs,Kf),s(hs,la),s(il,Yf),s(il,bs),s(il,Qf),s(il,On),s(On,na),s(On,Xf),s(On,qi),s(qi,an),an.checked=e[4].n.h,s(qi,Zf),s(qi,ia),s(On,Jf),s(On,$f),s(On,oo),s(oo,In),ge(In,e[4].n.n1),s(l,xf),s(l,Jt),s(Jt,ao),s(ao,sa),s(Jt,eu),s(Jt,Oi),s(Oi,tu),s(Jt,lu),s(Jt,gs),s(Jt,nu),s(Jt,fn),s(fn,oa),s(fn,iu),Bl&&Bl.m(fn,null),s(fn,aa),s(fn,su),s(fn,ou),s(fn,Ii),s(Ii,Ln),ge(Ln,e[4].q.h),s(Ii,au),s(Ii,un),ge(un,e[4].q.p),s(Jt,fu),sl&&sl.m(Jt,null),s(Jt,fa),s(Jt,ii),s(ii,ua),s(ii,uu),s(ii,ru),s(ii,Rn),ge(Rn,e[4].q.u),s(Jt,cu),s(Jt,si),s(si,ra),s(si,_u),s(si,mu),s(si,Fn),ge(Fn,e[4].q.a),s(Jt,pu),s(Jt,Li),s(Li,Ri),s(Ri,ca),s(Ri,du),s(Ri,vu),s(Ri,Bn),ge(Bn,e[4].q.c),s(Li,hu),s(Li,Fi),s(Fi,_a),s(Fi,bu),s(Fi,gu),s(Fi,pl),s(pl,Bi),s(pl,Ui),s(pl,ji),s(ji,ma),s(pl,Hi),s(Hi,pa),s(pl,yi),s(pl,zi),s(pl,Wi),s(pl,Gi),Je(pl,e[4].q.m,!0),s(Jt,ku),s(Jt,oi),s(oi,da),s(oi,wu),s(oi,Mu),s(oi,Un),ge(Un,e[4].q.b),s(l,Su),Ul&&Ul.m(l,null),s(l,va),jl&&jl.m(l,null),s(l,ha),ol&&ol.m(l,null),s(l,ba),Hl&&Hl.m(l,null),s(l,ka),s(l,wn),s(wn,bo),s(bo,wa),s(wn,Cu),s(wn,Vi),s(Vi,Nu),s(wn,Tu),s(wn,ks),s(wn,Pu),s(wn,ai);for(let xt=0;xt0?Dl?Dl.p(G,_e):(Dl=b2(G),Dl.c(),Dl.m(n,Gt)):Dl&&(Dl.d(1),Dl=null),(!Xe||_e[0]&2)&&Kt!==(Kt=((vc=(dc=(pc=G[1].conf)==null?void 0:pc.general)==null?void 0:dc.context)!=null?vc:"Context")+"")&&C(Xt,Kt),(!Xe||_e[0]&2&&Mt!==(Mt=(gc=(bc=(hc=G[1].conf)==null?void 0:hc.general)==null?void 0:bc.context_placeholder)!=null?gc:"/"))&&u(at,"placeholder",Mt),_e[0]&16&&at.value!==G[4].g.c&&ge(at,G[4].g.c),(!Xe||_e[0]&2)&&Re!==(Re=((Mc=(wc=(kc=G[1].conf)==null?void 0:kc.meter)==null?void 0:wc.title)!=null?Mc:"Meter")+"")&&C(St,Re),(!Xe||_e[0]&2)&&_l!==(_l=((Tc=(Nc=(Cc=(Sc=G[1].conf)==null?void 0:Sc.meter)==null?void 0:Cc.comm)==null?void 0:Nc.title)!=null?Tc:"Communication")+"")&&C(dl,_l),(!Xe||_e[0]&2)&&qt!==(qt=((Dc=(Ac=(Ec=(Pc=G[1].conf)==null?void 0:Pc.meter)==null?void 0:Ec.comm)==null?void 0:Ac.passive)!=null?Dc:"Passive")+"")&&C(Pn,qt),(!Xe||_e[0]&2)&&dn!==(dn=((Lc=(Ic=(Oc=(qc=G[1].conf)==null?void 0:qc.meter)==null?void 0:Oc.comm)==null?void 0:Ic.pulse)!=null?Lc:"Pulse")+"")&&C(En,dn),_e[0]&16&&Je(nl,G[4].m.a),Do===(Do=ju(G))&&Mn?Mn.p(G,_e):(Mn.d(1),Mn=Do(G),Mn&&(Mn.c(),Mn.m(le,he))),(!Xe||_e[0]&2)&&vn!==(vn=((Fc=(Rc=G[1].common)==null?void 0:Rc.voltage)!=null?Fc:"Voltage")+"")&&C(An,vn),_e[0]&16&&Je(ml,G[4].m.d),(!Xe||_e[0]&2)&&hn!==(hn=((jc=(Uc=(Bc=G[1].conf)==null?void 0:Bc.meter)==null?void 0:Uc.fuse)!=null?jc:"Main fuse")+"")&&C(Dn,hn),_e[0]&16&&Ze(cl.value)!==G[4].m.f&&ge(cl,G[4].m.f),(!Xe||_e[0]&2)&&ei!==(ei=((zc=(yc=(Hc=G[1].conf)==null?void 0:Hc.meter)==null?void 0:yc.prod)!=null?zc:"Production")+"")&&C(ki,ei),_e[0]&16&&Ze(Tl.value)!==G[4].m.r&&ge(Tl,G[4].m.r),_e[0]&16&&(Pl.checked=G[4].m.e.e),(!Xe||_e[0]&2)&&li!==(li=((Vc=(Gc=(Wc=G[1].conf)==null?void 0:Wc.meter)==null?void 0:Gc.encrypted)!=null?Vc:"Encrypted")+"")&&C(Mi,li),G[4].m.e.e?ql?ql.p(G,_e):(ql=g2(G),ql.c(),ql.m(gn,null)):ql&&(ql.d(1),ql=null),G[4].m.e.e?Ol?Ol.p(G,_e):(Ol=k2(G),Ol.c(),Ol.m(le,Si)):Ol&&(Ol.d(1),Ol=null),_e[0]&16&&(El.checked=G[4].m.m.e),(!Xe||_e[0]&2)&&js!==(js=((Xc=(Qc=(Yc=(Kc=G[1].conf)==null?void 0:Kc.meter)==null?void 0:Yc.multipliers)==null?void 0:Qc.title)!=null?Xc:"Multipliers")+"")&&C(Yo,js),G[4].m.m.e?Il?Il.p(G,_e):(Il=w2(G),Il.c(),Il.m(le,null)):Il&&(Il.d(1),Il=null),(!Xe||_e[0]&2)&&ys!==(ys=(($c=(Jc=(Zc=G[1].conf)==null?void 0:Zc.connection)==null?void 0:Jc.title)!=null?$c:"Connection")+"")&&C(Qo,ys),(!Xe||_e[0]&2)&&Ws!==(Ws=((t_=(e_=(xc=G[1].conf)==null?void 0:xc.connection)==null?void 0:e_.wifi)!=null?t_:"WiFi")+"")&&C(Xo,Ws),(!Xe||_e[0]&2)&&Gs!==(Gs=((i_=(n_=(l_=G[1].conf)==null?void 0:l_.connection)==null?void 0:n_.ap)!=null?i_:"AP")+"")&&C(Zo,Gs),G[0].if&&G[0].if.eth?Ll?Ll.p(G,_e):(Ll=M2(G),Ll.c(),Ll.m(tn,null)):Ll&&(Ll.d(1),Ll=null),_e[0]&16&&Je(tn,G[4].n.c),G[4].n.c==1||G[4].n.c==2?Rl?Rl.p(G,_e):(Rl=S2(G),Rl.c(),Rl.m(Vl,null)):Rl&&(Rl.d(1),Rl=null),(!Xe||_e[0]&2)&&Ks!==(Ks=((a_=(o_=(s_=G[1].conf)==null?void 0:s_.network)==null?void 0:o_.title)!=null?a_:"Network")+"")&&C(Jo,Ks),(!Xe||_e[0]&2)&&Ys!==(Ys=((r_=(u_=(f_=G[1].conf)==null?void 0:f_.network)==null?void 0:u_.ip)!=null?r_:"IP")+"")&&C($o,Ys),(!Xe||_e[0]&2)&&Qs!==(Qs=((m_=(__=(c_=G[1].conf)==null?void 0:c_.network)==null?void 0:__.dhcp)!=null?m_:"DHCP")+"")&&C(xo,Qs),(!Xe||_e[0]&2)&&Xs!==(Xs=((v_=(d_=(p_=G[1].conf)==null?void 0:p_.network)==null?void 0:d_.static)!=null?v_:"Static")+"")&&C(ea,Xs),_e[0]&16&&Je(kn,G[4].n.m),(!Xe||_e[0]&16&&Zs!==(Zs=G[4].n.m=="dhcp"))&&(Kl.disabled=Zs),(!Xe||_e[0]&16&&Js!==(Js=G[4].n.m=="static"))&&(Kl.required=Js),_e[0]&16&&Kl.value!==G[4].n.i&&ge(Kl,G[4].n.i),(!Xe||_e[0]&16&&$s!==($s=G[4].n.m=="dhcp"))&&(Yl.disabled=$s),(!Xe||_e[0]&16&&xs!==(xs=G[4].n.m=="static"))&&(Yl.required=xs),_e[0]&16&&Je(Yl,G[4].n.s),G[4].n.m=="static"?Fl?Fl.p(G,_e):(Fl=C2(G),Fl.c(),Fl.m(il,ta)):Fl&&(Fl.d(1),Fl=null),_e[0]&16&&(sn.checked=G[4].n.x),_e[0]&16&&(on.checked=G[4].n.d),(!Xe||_e[0]&2)&&no!==(no=((g_=(b_=(h_=G[1].conf)==null?void 0:h_.network)==null?void 0:b_.tick_mdns)!=null?g_:"mDNS")+"")&&C(la,no),(!Xe||_e[0]&2)&&io!==(io=((M_=(w_=(k_=G[1].conf)==null?void 0:k_.network)==null?void 0:w_.ntp)!=null?M_:"NTP")+"")&&C(na,io),_e[0]&16&&(an.checked=G[4].n.h),(!Xe||_e[0]&2)&&so!==(so=((N_=(C_=(S_=G[1].conf)==null?void 0:S_.network)==null?void 0:C_.tick_ntp_dhcp)!=null?N_:"from DHCP")+"")&&C(ia,so),_e[0]&16&&In.value!==G[4].n.n1&&ge(In,G[4].n.n1),(!Xe||_e[0]&2)&&fo!==(fo=((E_=(P_=(T_=G[1].conf)==null?void 0:T_.mqtt)==null?void 0:P_.title)!=null?E_:"MQTT")+"")&&C(sa,fo),(!Xe||_e[0]&2)&&uo!==(uo=((q_=(D_=(A_=G[1].conf)==null?void 0:A_.mqtt)==null?void 0:D_.server)!=null?q_:"Server")+"")&&C(oa,uo),G[0].chip!="esp8266"?Bl?Bl.p(G,_e):(Bl=N2(G),Bl.c(),Bl.m(fn,aa)):Bl&&(Bl.d(1),Bl=null),_e[0]&16&&Ln.value!==G[4].q.h&&ge(Ln,G[4].q.h),_e[0]&16&&Ze(un.value)!==G[4].q.p&&ge(un,G[4].q.p),G[4].q.s.e?sl?(sl.p(G,_e),_e[0]&16&&Y(sl,1)):(sl=T2(G),sl.c(),Y(sl,1),sl.m(Jt,fa)):sl&&(pt(),ee(sl,1,1,()=>{sl=null}),dt()),(!Xe||_e[0]&2)&&ro!==(ro=((L_=(I_=(O_=G[1].conf)==null?void 0:O_.mqtt)==null?void 0:I_.user)!=null?L_:"Username")+"")&&C(ua,ro),_e[0]&16&&Rn.value!==G[4].q.u&&ge(Rn,G[4].q.u),(!Xe||_e[0]&2)&&co!==(co=((B_=(F_=(R_=G[1].conf)==null?void 0:R_.mqtt)==null?void 0:F_.pass)!=null?B_:"Password")+"")&&C(ra,co),_e[0]&16&&Fn.value!==G[4].q.a&&ge(Fn,G[4].q.a),(!Xe||_e[0]&2)&&_o!==(_o=((H_=(j_=(U_=G[1].conf)==null?void 0:U_.mqtt)==null?void 0:j_.id)!=null?H_:"Client ID")+"")&&C(ca,_o),_e[0]&16&&Bn.value!==G[4].q.c&&ge(Bn,G[4].q.c),(!Xe||_e[0]&2)&&mo!==(mo=((W_=(z_=(y_=G[1].conf)==null?void 0:y_.mqtt)==null?void 0:z_.payload)!=null?W_:"Payload")+"")&&C(_a,mo),(!Xe||_e[0]&2)&&po!==(po=((Y_=(K_=(V_=(G_=G[1].conf)==null?void 0:G_.mqtt)==null?void 0:V_.domoticz)==null?void 0:K_.title)!=null?Y_:"Domoticz")+"")&&C(ma,po),(!Xe||_e[0]&2)&&vo!==(vo=((J_=(Z_=(X_=(Q_=G[1].conf)==null?void 0:Q_.mqtt)==null?void 0:X_.ha)==null?void 0:Z_.title)!=null?J_:"Home-Assistant")+"")&&C(pa,vo),_e[0]&16&&Je(pl,G[4].q.m),(!Xe||_e[0]&2)&&ho!==(ho=((em=(x_=($_=G[1].conf)==null?void 0:$_.mqtt)==null?void 0:x_.publish)!=null?em:"Publish topic")+"")&&C(da,ho),_e[0]&16&&Un.value!==G[4].q.b&&ge(Un,G[4].q.b),G[4].q.m==3?Ul?Ul.p(G,_e):(Ul=P2(G),Ul.c(),Ul.m(l,va)):Ul&&(Ul.d(1),Ul=null),G[4].q.m==4?jl?jl.p(G,_e):(jl=E2(G),jl.c(),jl.m(l,ha)):jl&&(jl.d(1),jl=null),G[4].c.es!=null?ol?(ol.p(G,_e),_e[0]&16&&Y(ol,1)):(ol=A2(G),ol.c(),Y(ol,1),ol.m(l,ba)):ol&&(pt(),ee(ol,1,1,()=>{ol=null}),dt()),_e[0]&16&&(ga=G[4].p.r.startsWith("NO")||G[4].p.r.startsWith("10YNO")||G[4].p.r.startsWith("10Y1001A1001A4")),ga?Hl?Hl.p(G,_e):(Hl=O2(G),Hl.c(),Hl.m(l,ka)):Hl&&(Hl.d(1),Hl=null),(!Xe||_e[0]&2)&&go!==(go=((nm=(lm=(tm=G[1].conf)==null?void 0:tm.ui)==null?void 0:lm.title)!=null?nm:"User interface")+"")&&C(wa,go),_e[0]&530){Zi=G[9];let zt;for(zt=0;zt20||G[0].chip=="esp8266"||G[4].i.d.d>0?al?(al.p(G,_e),_e[0]&17&&Y(al,1)):(al=F2(G),al.c(),Y(al,1),al.m(l,Ca)):al&&(pt(),ee(al,1,1,()=>{al=null}),dt()),(!Xe||_e[0]&2)&&Mo!==(Mo=((um=(fm=(am=G[1].conf)==null?void 0:am.debug)==null?void 0:fm.title)!=null?um:"Debugging")+"")&&C(Na,Mo),_e[0]&16&&(cn.checked=G[4].d.s),(!Xe||_e[0]&2)&&Co!==(Co=((_m=(cm=(rm=G[1].conf)==null?void 0:rm.debug)==null?void 0:cm.enable)!=null?_m:"Enable debugging")+"")&&C(Ta,Co),G[4].d.s?yl?yl.p(G,_e):(yl=W2(G),yl.c(),yl.m(Ql,null)):yl&&(yl.d(1),yl=null),(!Xe||_e[0]&2)&&No!==(No=((pm=(mm=G[1].conf)==null?void 0:mm.btn_reset)!=null?pm:"Factory reset")+"")&&C(Ea,No),(!Xe||_e[0]&2)&&Po!==(Po=((vm=(dm=G[1].btn)==null?void 0:dm.reboot)!=null?vm:"Reboot")+"")&&C(Aa,Po),(!Xe||_e[0]&2)&&Ao!==(Ao=((bm=(hm=G[1].btn)==null?void 0:hm.save)!=null?bm:"Save")+"")&&C(Da,Ao);const bl={};_e[0]&4&&(bl.active=G[2]),_e[0]&2&&(bl.message=(wm=(km=(gm=G[1].conf)==null?void 0:gm.mask)==null?void 0:km.loading)!=null?wm:"Loading"),fi.$set(bl);const Fa={};_e[0]&8&&(Fa.active=G[3]),_e[0]&2&&(Fa.message=(Cm=(Sm=(Mm=G[1].conf)==null?void 0:Mm.mask)==null?void 0:Sm.saving)!=null?Cm:"Saving"),ui.$set(Fa);const Ba={};_e[0]&64&&(Ba.active=G[6]),_e[0]&2&&(Ba.message=(Pm=(Tm=(Nm=G[1].conf)==null?void 0:Nm.mask)==null?void 0:Tm.reset)!=null?Pm:"Factory reset"),ri.$set(Ba);const Ua={};_e[0]&128&&(Ua.active=G[7]),_e[0]&2&&(Ua.message=(Dm=(Am=(Em=G[1].conf)==null?void 0:Em.mask)==null?void 0:Am.reset_done)!=null?Dm:"Done"),ci.$set(Ua)},i(G){Xe||(Y(R.$$.fragment,G),Y(tt.$$.fragment,G),Y(Di.$$.fragment,G),Y(sl),Y(ol),Y(al),Y(fi.$$.fragment,G),Y(ui.$$.fragment,G),Y(ri.$$.fragment,G),Y(ci.$$.fragment,G),Xe=!0)},o(G){ee(R.$$.fragment,G),ee(tt.$$.fragment,G),ee(Di.$$.fragment,G),ee(sl),ee(ol),ee(al),ee(fi.$$.fragment,G),ee(ui.$$.fragment,G),ee(ri.$$.fragment,G),ee(ci.$$.fragment,G),Xe=!1},d(G){G&&T(t),Ne(R),Xl&&Xl.d(),Qt(Cs,G),Ne(tt),Al&&Al.d(),Dl&&Dl.d(),Mn.d(),ql&&ql.d(),Ol&&Ol.d(),Il&&Il.d(),Ll&&Ll.d(),Rl&&Rl.d(),Ne(Di),Fl&&Fl.d(),Bl&&Bl.d(),sl&&sl.d(),Ul&&Ul.d(),jl&&jl.d(),ol&&ol.d(),Hl&&Hl.d(),Qt(vl,G),Qt(hl,G),al&&al.d(),yl&&yl.d(),G&&T(qa),Ne(fi,G),G&&T(Oa),Ne(ui,G),G&&T(Ia),Ne(ri,G),G&&T(La),Ne(ci,G),Ra=!1,Et(Uu)}}}async function ag(){await(await fetch("reboot",{method:"POST"})).json()}function fg(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(Ke=>{l(1,o=Ke)});let f=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],r=!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,x:!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,lang:"en"},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,es:null}},_=[];Es.subscribe(Ke=>{var le,je;Ke.version&&(l(4,a=Ke),l(2,r=!1),l(5,_=[{code:"en",name:"English"}]),a.u.lang&&a.u.lang!="en"&&_.push({code:a.u.lang,name:(je=(le=o.language)==null?void 0:le.name)!=null?je:"Unknown"}),_.push({code:"hub",name:"Load from server"}))}),C4();let p=!1,v=!1;async function d(){if(confirm("Factory reset?")){l(6,p=!0);const Ke=new URLSearchParams;Ke.append("perform","true");let je=await(await fetch("reset",{method:"POST",body:Ke})).json();l(6,p=!1),l(7,v=je.success)}}async function h(Ke){l(3,c=!0);const le=new FormData(Ke.target),je=new URLSearchParams;for(let ft of le){const[Yt,tl]=ft;je.append(Yt,tl)}let St=await(await fetch("save",{method:"POST",body:je})).json();wl.update(ft=>(ft.hostname=le.get("gh"),ft.usrcfg=St.success,ft.booting=St.reboot,le.get("nm")=="static"&&(ft.net.ip=le.get("ni"),ft.net.mask=le.get("nu"),ft.net.gw=le.get("ng"),ft.net.dns1=le.get("nd")),ft.ui=a.u,ft)),l(3,c=!1),hi(n)}const g=function(){confirm("Reboot?")&&(wl.update(Ke=>(Ke.booting=!0,Ke)),ag())};async function M(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Es.update(le=>(le.q.s.c=!1,le)))}async function A(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Es.update(le=>(le.q.s.r=!1,le)))}async function L(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Es.update(le=>(le.q.s.k=!1,le)))}const q=function(){a.q.s.e?a.q.p==1883&&l(4,a.q.p=8883,a):a.q.p==8883&&l(4,a.q.p=1883,a)};async function I(){if(a.u.lang=="hub"){const Ke=await pn("http://hub.amsleser.no/hub/language/list.json");l(5,_=await Ke.json()),l(4,a.u.lang=o.language.code,a)}}let O=44;function U(){a.g.h=this.value,l(4,a)}function E(){a.g.t=Bt(this),l(4,a)}function B(){a.p.r=Bt(this),l(4,a)}function z(){a.p.c=Bt(this),l(4,a)}function W(){a.p.e=this.checked,l(4,a)}function F(){a.p.t=this.value,l(4,a)}function R(){a.g.s=Bt(this),l(4,a)}function K(){a.g.u=this.value,l(4,a)}function H(){a.g.p=this.value,l(4,a)}function y(){a.g.c=this.value,l(4,a)}function Q(){a.m.a=Bt(this),l(4,a)}function Z(){a.m.b=Ze(this.value),l(4,a)}function J(){a.m.i=this.checked,l(4,a)}function $(){a.m.b=Bt(this),l(4,a)}function ce(){a.m.p=Bt(this),l(4,a)}function ie(){a.m.s=Ze(this.value),l(4,a)}function x(){a.m.d=Bt(this),l(4,a)}function ae(){a.m.f=Ze(this.value),l(4,a)}function oe(){a.m.r=Ze(this.value),l(4,a)}function se(){a.m.e.e=this.checked,l(4,a)}function de(){a.m.e.k=this.value,l(4,a)}function me(){a.m.e.a=this.value,l(4,a)}function V(){a.m.m.e=this.checked,l(4,a)}function X(){a.m.m.w=Ze(this.value),l(4,a)}function we(){a.m.m.v=Ze(this.value),l(4,a)}function ve(){a.m.m.a=Ze(this.value),l(4,a)}function S(){a.m.m.c=Ze(this.value),l(4,a)}function w(){a.n.c=Bt(this),l(4,a)}function N(){a.w.s=this.value,l(4,a)}function D(){a.w.p=this.value,l(4,a)}function j(){a.w.z=Bt(this),l(4,a)}function te(){a.w.w=Ze(this.value),l(4,a)}function ne(){a.w.b=this.checked,l(4,a)}function fe(){a.n.m=Bt(this),l(4,a)}function pe(){a.n.i=this.value,l(4,a)}function Ae(){a.n.s=Bt(this),l(4,a)}function Te(){a.n.g=this.value,l(4,a)}function be(){a.n.d1=this.value,l(4,a)}function Be(){a.n.d2=this.value,l(4,a)}function De(){a.n.x=this.checked,l(4,a)}function ke(){a.n.d=this.checked,l(4,a)}function Me(){a.n.h=this.checked,l(4,a)}function Le(){a.n.n1=this.value,l(4,a)}function Ie(){a.q.s.e=this.checked,l(4,a)}function He(){a.q.h=this.value,l(4,a)}function Ye(){a.q.p=Ze(this.value),l(4,a)}function We(){a.q.u=this.value,l(4,a)}function $e(){a.q.a=this.value,l(4,a)}function xe(){a.q.c=this.value,l(4,a)}function ct(){a.q.m=Bt(this),l(4,a)}function qe(){a.q.b=this.value,l(4,a)}function ue(){a.o.e=this.value,l(4,a)}function Oe(){a.o.c=this.value,l(4,a)}function kt(){a.o.u1=this.value,l(4,a)}function tt(){a.o.u2=this.value,l(4,a)}function wt(){a.o.u3=this.value,l(4,a)}function it(){a.h.t=this.value,l(4,a)}function st(){a.h.h=this.value,l(4,a)}function et(){a.h.n=this.value,l(4,a)}function Nt(){a.c.e=this.checked,l(4,a)}function gt(){a.c.es=this.checked,l(4,a)}function At(Ke){a.t.t[Ke]=Ze(this.value),l(4,a)}function Pt(){a.t.h=Ze(this.value),l(4,a)}function Ue(Ke){a.u[Ke.key]=Bt(this),l(4,a)}function ye(){a.u.lang=Bt(this),l(4,a)}function It(){a.i.h.p=Bt(this),l(4,a)}function vt(){a.i.h.t=Bt(this),l(4,a)}function lt(){a.i.h.u=this.checked,l(4,a)}function Tt(){a.i.a=Ze(this.value),l(4,a)}function nt(){a.i.l.p=Ze(this.value),l(4,a)}function ot(){a.i.l.i=this.checked,l(4,a)}function ut(){a.i.r.i=this.checked,l(4,a)}function Ht(){a.i.r.r=Ze(this.value),l(4,a)}function Lt(){a.i.r.g=Ze(this.value),l(4,a)}function Se(){a.i.r.b=Ze(this.value),l(4,a)}function Ge(){a.i.d.d=Ze(this.value),l(4,a)}function Rt(){a.i.t.d=Ze(this.value),l(4,a)}function Wt(){a.i.t.a=Ze(this.value),l(4,a)}function Dt(){a.i.v.p=Ze(this.value),l(4,a)}function yt(){a.i.v.d.v=Ze(this.value),l(4,a)}function Gt(){a.i.v.d.g=Ze(this.value),l(4,a)}function Ft(){a.i.d.b=Bt(this),l(4,a)}function Kt(){a.i.v.o=Ze(this.value),l(4,a)}function Xt(){a.i.v.m=Ze(this.value),l(4,a)}function el(){a.i.v.b=Ze(this.value),l(4,a)}function Zt(){a.d.s=this.checked,l(4,a)}function at(){a.d.t=this.checked,l(4,a)}function Mt(){a.d.l=Bt(this),l(4,a)}return e.$$set=Ke=>{"basepath"in Ke&&l(18,n=Ke.basepath),"sysinfo"in Ke&&l(0,i=Ke.sysinfo)},e.$$.update=()=>{e.$$.dirty[0]&1&&l(8,O=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,r,c,a,_,p,v,O,f,d,h,g,M,A,L,q,I,n,U,E,B,z,W,F,R,K,H,y,Q,Z,J,$,ce,ie,x,ae,oe,se,de,me,V,X,we,ve,S,w,N,D,j,te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct,qe,ue,Oe,kt,tt,wt,it,st,et,Nt,gt,At,Pt,Ue,ye,It,vt,lt,Tt,nt,ot,ut,Ht,Lt,Se,Ge,Rt,Wt,Dt,yt,Gt,Ft,Kt,Xt,el,Zt,at,Mt]}class ug extends mt{constructor(t){super(),_t(this,t,fg,og,rt,{basepath:18,sysinfo:0},null,[-1,-1,-1,-1])}}function V2(e,t,l){const n=e.slice();return n[22]=t[l],n}function K2(e){let t,l=e[1].cpu+"",n,i;return{c(){t=k("("),n=k(l),i=k("MHz)")},m(o,f){P(o,t,f),P(o,n,f),P(o,i,f)},p(o,f){f&2&&l!==(l=o[1].cpu+"")&&C(n,l)},d(o){o&&T(t),o&&T(n),o&&T(i)}}}function rg(e){let t=Ve(e[1].chip,e[1].board)+"",l;return{c(){l=k(t)},m(n,i){P(n,l,i)},p(n,i){i&2&&t!==(t=Ve(n[1].chip,n[1].board)+"")&&C(l,t)},d(n){n&&T(l)}}}function Y2(e){var Q,Z,J,$,ce,ie,x,ae,oe,se,de,me;let t,l=((J=(Z=(Q=e[3].status)==null?void 0:Q.device)==null?void 0:Z.apmac)!=null?J:"AP MAC")+"",n,i,o=e[1].apmac+"",f,r,c,a=((ie=(ce=($=e[3].status)==null?void 0:$.device)==null?void 0:ce.last_boot)!=null?ie:"Last boot")+"",_,p,v,d,h,g,M=((oe=(ae=(x=e[3].status)==null?void 0:x.device)==null?void 0:ae.reason)!=null?oe:"Reason")+"",A,L,q=((me=(de=(se=e[3][Km(e[1].chip)])==null?void 0:se.reason)==null?void 0:de[e[1].boot_reason])!=null?me:e[1].boot_reason)+"",I,O,U=e[1].boot_reason+"",E,B,z=e[1].ex_cause+"",W,F,R;const K=[_g,cg],H=[];function y(V,X){return V[0].u>0?0:1}return v=y(e),d=H[v]=K[v](e),{c(){t=m("div"),n=k(l),i=k(": "),f=k(o),r=b(),c=m("div"),_=k(a),p=k(`: + `),d.c(),h=b(),g=m("div"),A=k(M),L=k(": "),I=k(q),O=k(" ("),E=k(U),B=k("/"),W=k(z),F=k(")"),u(t,"class","my-2"),u(c,"class","my-2"),u(g,"class","my-2")},m(V,X){P(V,t,X),s(t,n),s(t,i),s(t,f),P(V,r,X),P(V,c,X),s(c,_),s(c,p),H[v].m(c,null),P(V,h,X),P(V,g,X),s(g,A),s(g,L),s(g,I),s(g,O),s(g,E),s(g,B),s(g,W),s(g,F),R=!0},p(V,X){var ve,S,w,N,D,j,te,ne,fe,pe,Ae,Te;(!R||X&8)&&l!==(l=((w=(S=(ve=V[3].status)==null?void 0:ve.device)==null?void 0:S.apmac)!=null?w:"AP MAC")+"")&&C(n,l),(!R||X&2)&&o!==(o=V[1].apmac+"")&&C(f,o),(!R||X&8)&&a!==(a=((j=(D=(N=V[3].status)==null?void 0:N.device)==null?void 0:D.last_boot)!=null?j:"Last boot")+"")&&C(_,a);let we=v;v=y(V),v===we?H[v].p(V,X):(pt(),ee(H[we],1,1,()=>{H[we]=null}),dt(),d=H[v],d?d.p(V,X):(d=H[v]=K[v](V),d.c()),Y(d,1),d.m(c,null)),(!R||X&8)&&M!==(M=((fe=(ne=(te=V[3].status)==null?void 0:te.device)==null?void 0:ne.reason)!=null?fe:"Reason")+"")&&C(A,M),(!R||X&10)&&q!==(q=((Te=(Ae=(pe=V[3][Km(V[1].chip)])==null?void 0:pe.reason)==null?void 0:Ae[V[1].boot_reason])!=null?Te:V[1].boot_reason)+"")&&C(I,q),(!R||X&2)&&U!==(U=V[1].boot_reason+"")&&C(E,U),(!R||X&2)&&z!==(z=V[1].ex_cause+"")&&C(W,z)},i(V){R||(Y(d),R=!0)},o(V){ee(d),R=!1},d(V){V&&T(t),V&&T(r),V&&T(c),H[v].d(),V&&T(h),V&&T(g)}}}function cg(e){let t;return{c(){t=k("-")},m(l,n){P(l,t,n)},p:ze,i:ze,o:ze,d(l){l&&T(t)}}}function _g(e){let t,l;return t=new Av({props:{timestamp:new Date(new Date().getTime()-e[0].u*1e3),fullTimeColor:""}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function mg(e){var i,o,f;let t,l=((f=(o=(i=e[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)!=null?f:"Consents")+"",n;return{c(){t=m("span"),n=k(l),u(t,"class","btn-pri-sm")},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&8&&l!==(l=((p=(_=(a=r[3].status)==null?void 0:a.device)==null?void 0:_.btn_consents)!=null?p:"Consents")+"")&&C(n,l)},d(r){r&&T(t)}}}function Q2(e){var W,F,R,K,H,y,Q,Z,J,$,ce,ie;let t,l,n=((R=(F=(W=e[3].status)==null?void 0:W.meter)==null?void 0:F.title)!=null?R:"Meter")+"",i,o,f,r=((y=(H=(K=e[3].status)==null?void 0:K.meter)==null?void 0:H.manufacturer)!=null?y:"Manufacturer")+"",c,a,_=Go(e[1].meter.mfg)+"",p,v,d,h=((J=(Z=(Q=e[3].status)==null?void 0:Q.meter)==null?void 0:Z.model)!=null?J:"Model")+"",g,M,A=(e[1].meter.model?e[1].meter.model:"unknown")+"",L,q,I,O=((ie=(ce=($=e[3].status)==null?void 0:$.meter)==null?void 0:ce.id)!=null?ie:"ID")+"",U,E,B=(e[1].meter.id?e[1].meter.id:"unknown")+"",z;return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),L=k(A),q=b(),I=m("div"),U=k(O),E=k(": "),z=k(B),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(I,"class","my-2"),u(t,"class","cnt")},m(x,ae){P(x,t,ae),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,L),s(t,q),s(t,I),s(I,U),s(I,E),s(I,z)},p(x,ae){var oe,se,de,me,V,X,we,ve,S,w,N,D;ae&8&&n!==(n=((de=(se=(oe=x[3].status)==null?void 0:oe.meter)==null?void 0:se.title)!=null?de:"Meter")+"")&&C(i,n),ae&8&&r!==(r=((X=(V=(me=x[3].status)==null?void 0:me.meter)==null?void 0:V.manufacturer)!=null?X:"Manufacturer")+"")&&C(c,r),ae&2&&_!==(_=Go(x[1].meter.mfg)+"")&&C(p,_),ae&8&&h!==(h=((S=(ve=(we=x[3].status)==null?void 0:we.meter)==null?void 0:ve.model)!=null?S:"Model")+"")&&C(g,h),ae&2&&A!==(A=(x[1].meter.model?x[1].meter.model:"unknown")+"")&&C(L,A),ae&8&&O!==(O=((D=(N=(w=x[3].status)==null?void 0:w.meter)==null?void 0:N.id)!=null?D:"ID")+"")&&C(U,O),ae&2&&B!==(B=(x[1].meter.id?x[1].meter.id:"unknown")+"")&&C(z,B)},d(x){x&&T(t)}}}function X2(e){var Z,J,$,ce,ie,x,ae,oe,se,de,me,V;let t,l,n=(($=(J=(Z=e[3].status)==null?void 0:Z.network)==null?void 0:J.title)!=null?$:"Network")+"",i,o,f,r=((x=(ie=(ce=e[3].conf)==null?void 0:ce.network)==null?void 0:ie.ip)!=null?x:"IP")+"",c,a,_=e[1].net.ip+"",p,v,d,h=((se=(oe=(ae=e[3].conf)==null?void 0:ae.network)==null?void 0:oe.mask)!=null?se:"Mask")+"",g,M,A=e[1].net.mask+"",L,q,I,O=((V=(me=(de=e[3].conf)==null?void 0:de.network)==null?void 0:me.gw)!=null?V:"Gateway")+"",U,E,B=e[1].net.gw+"",z,W,F,R,K,H=e[1].net.dns1&&Z2(e),y=e[1].net.dns2&&J2(e),Q=e[1].net.ipv6&&$2(e);return{c(){t=m("div"),l=m("strong"),i=k(n),o=b(),f=m("div"),c=k(r),a=k(": "),p=k(_),v=b(),d=m("div"),g=k(h),M=k(": "),L=k(A),q=b(),I=m("div"),U=k(O),E=k(": "),z=k(B),W=b(),F=m("div"),H&&H.c(),R=b(),y&&y.c(),K=b(),Q&&Q.c(),u(l,"class","text-sm"),u(f,"class","my-2"),u(d,"class","my-2"),u(I,"class","my-2"),u(F,"class","my-2"),u(t,"class","cnt")},m(X,we){P(X,t,we),s(t,l),s(l,i),s(t,o),s(t,f),s(f,c),s(f,a),s(f,p),s(t,v),s(t,d),s(d,g),s(d,M),s(d,L),s(t,q),s(t,I),s(I,U),s(I,E),s(I,z),s(t,W),s(t,F),H&&H.m(F,null),s(F,R),y&&y.m(F,null),s(t,K),Q&&Q.m(t,null)},p(X,we){var ve,S,w,N,D,j,te,ne,fe,pe,Ae,Te;we&8&&n!==(n=((w=(S=(ve=X[3].status)==null?void 0:ve.network)==null?void 0:S.title)!=null?w:"Network")+"")&&C(i,n),we&8&&r!==(r=((j=(D=(N=X[3].conf)==null?void 0:N.network)==null?void 0:D.ip)!=null?j:"IP")+"")&&C(c,r),we&2&&_!==(_=X[1].net.ip+"")&&C(p,_),we&8&&h!==(h=((fe=(ne=(te=X[3].conf)==null?void 0:te.network)==null?void 0:ne.mask)!=null?fe:"Mask")+"")&&C(g,h),we&2&&A!==(A=X[1].net.mask+"")&&C(L,A),we&8&&O!==(O=((Te=(Ae=(pe=X[3].conf)==null?void 0:pe.network)==null?void 0:Ae.gw)!=null?Te:"Gateway")+"")&&C(U,O),we&2&&B!==(B=X[1].net.gw+"")&&C(z,B),X[1].net.dns1?H?H.p(X,we):(H=Z2(X),H.c(),H.m(F,R)):H&&(H.d(1),H=null),X[1].net.dns2?y?y.p(X,we):(y=J2(X),y.c(),y.m(F,null)):y&&(y.d(1),y=null),X[1].net.ipv6?Q?Q.p(X,we):(Q=$2(X),Q.c(),Q.m(t,null)):Q&&(Q.d(1),Q=null)},d(X){X&&T(t),H&&H.d(),y&&y.d(),Q&&Q.d()}}}function Z2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns1+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns1+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function J2(e){var f,r,c;let t=((c=(r=(f=e[3].conf)==null?void 0:f.network)==null?void 0:r.dns)!=null?c:"DNS")+"",l,n,i=e[1].net.dns2+"",o;return{c(){l=k(t),n=k(": "),o=k(i)},m(a,_){P(a,l,_),P(a,n,_),P(a,o,_)},p(a,_){var p,v,d;_&8&&t!==(t=((d=(v=(p=a[3].conf)==null?void 0:p.network)==null?void 0:v.dns)!=null?d:"DNS")+"")&&C(l,t),_&2&&i!==(i=a[1].net.dns2+"")&&C(o,i)},d(a){a&&T(l),a&&T(n),a&&T(o)}}}function $2(e){let t,l,n=e[1].net.ipv6+"",i,o,f,r,c=e[1].net.dns1v6&&x2(e),a=e[1].net.dns2v6&&ed(e);return{c(){t=m("div"),l=k("IPv6: "),i=k(n),o=b(),f=m("div"),c&&c.c(),r=b(),a&&a.c(),u(t,"class","my-2"),u(f,"class","my-2")},m(_,p){P(_,t,p),s(t,l),s(t,i),P(_,o,p),P(_,f,p),c&&c.m(f,null),s(f,r),a&&a.m(f,null)},p(_,p){p&2&&n!==(n=_[1].net.ipv6+"")&&C(i,n),_[1].net.dns1v6?c?c.p(_,p):(c=x2(_),c.c(),c.m(f,r)):c&&(c.d(1),c=null),_[1].net.dns2v6?a?a.p(_,p):(a=ed(_),a.c(),a.m(f,null)):a&&(a.d(1),a=null)},d(_){_&&T(t),_&&T(o),_&&T(f),c&&c.d(),a&&a.d()}}}function x2(e){let t,l=e[1].net.dns1v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns1v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function ed(e){let t,l=e[1].net.dns2v6+"",n;return{c(){t=k("DNSv6: "),n=k(l)},m(i,o){P(i,t,o),P(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2v6+"")&&C(n,l)},d(i){i&&T(t),i&&T(n)}}}function td(e){var c,a,_,p,v,d;let t,l,n=((_=(a=(c=e[3].status)==null?void 0:c.firmware)==null?void 0:a.failed)!=null?_:"Upgrade from {0} to {1} failed").replace("{0}",e[1].upgrade.f).replace("{1}",e[1].upgrade.t)+"",i,o,f=((d=(v=(p=e[3].errors)==null?void 0:p.http)==null?void 0:v[e[1].upgrade.e])!=null?d:e[1].upgrade.e)+"",r;return{c(){t=m("div"),l=m("div"),i=k(n),o=b(),r=k(f),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(h,g){P(h,t,g),s(t,l),s(l,i),s(l,o),s(l,r)},p(h,g){var M,A,L,q,I,O;g&10&&n!==(n=((L=(A=(M=h[3].status)==null?void 0:M.firmware)==null?void 0:A.failed)!=null?L:"Upgrade from {0} to {1} failed").replace("{0}",h[1].upgrade.f).replace("{1}",h[1].upgrade.t)+"")&&C(i,n),g&10&&f!==(f=((O=(I=(q=h[3].errors)==null?void 0:q.http)==null?void 0:I[h[1].upgrade.e])!=null?O:h[1].upgrade.e)+"")&&C(r,f)},d(h){h&&T(t)}}}function ld(e){var h,g,M;let t,l=((M=(g=(h=e[3].status)==null?void 0:h.firmware)==null?void 0:g.latest)!=null?M:"Latest")+"",n,i,o,f=e[4].tag_name+"",r,c,a,_,p,v=(e[1].security==0||e[0].a)&&e[1].fwconsent===1&&e[4]&&e[4].tag_name!=e[1].version&&nd(e),d=e[1].fwconsent===2&&id(e);return{c(){t=m("div"),n=k(l),i=k(`: + `),o=m("a"),r=k(f),a=b(),v&&v.c(),_=b(),d&&d.c(),p=jt(),u(o,"href",c=e[4].html_url),u(o,"class","ml-2 text-blue-600 hover:text-blue-800"),u(o,"target","_blank"),u(o,"rel","noreferrer"),u(t,"class","my-2 flex")},m(A,L){P(A,t,L),s(t,n),s(t,i),s(t,o),s(o,r),s(t,a),v&&v.m(t,null),P(A,_,L),d&&d.m(A,L),P(A,p,L)},p(A,L){var q,I,O;L&8&&l!==(l=((O=(I=(q=A[3].status)==null?void 0:q.firmware)==null?void 0:I.latest)!=null?O:"Latest")+"")&&C(n,l),L&16&&f!==(f=A[4].tag_name+"")&&C(r,f),L&16&&c!==(c=A[4].html_url)&&u(o,"href",c),(A[1].security==0||A[0].a)&&A[1].fwconsent===1&&A[4]&&A[4].tag_name!=A[1].version?v?v.p(A,L):(v=nd(A),v.c(),v.m(t,null)):v&&(v.d(1),v=null),A[1].fwconsent===2?d?d.p(A,L):(d=id(A),d.c(),d.m(p.parentNode,p)):d&&(d.d(1),d=null)},d(A){A&&T(t),v&&v.d(),A&&T(_),d&&d.d(A),A&&T(p)}}}function nd(e){let t,l,n,i,o;return{c(){var f,r,c;t=m("div"),l=m("button"),l.textContent="\u21D3",u(t,"class","flex-none ml-2 text-green-500"),u(t,"title",n=(c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.install)!=null?c:"Install")},m(f,r){P(f,t,r),s(t,l),i||(o=re(l,"click",e[11]),i=!0)},p(f,r){var c,a,_;r&8&&n!==(n=(_=(a=(c=f[3].status)==null?void 0:c.firmware)==null?void 0:a.install)!=null?_:"Install")&&u(t,"title",n)},d(f){f&&T(t),i=!1,o()}}}function id(e){var o,f,r;let t,l,n=((r=(f=(o=e[3].status)==null?void 0:o.firmware)==null?void 0:f.no_one_click)!=null?r:"One-click upgrade disabled")+"",i;return{c(){t=m("div"),l=m("div"),i=k(n),u(l,"class","bd-yellow"),u(t,"class","my-2")},m(c,a){P(c,t,a),s(t,l),s(l,i)},p(c,a){var _,p,v;a&8&&n!==(n=((v=(p=(_=c[3].status)==null?void 0:_.firmware)==null?void 0:p.no_one_click)!=null?v:"One-click upgrade disabled")+"")&&C(i,n)},d(c){c&&T(t)}}}function sd(e){let t,l=Vo(Ve(e[1].chip,e[1].board))+"",n;return{c(){t=m("div"),n=k(l),u(t,"class","bd-red")},m(i,o){P(i,t,o),s(t,n)},p(i,o){o&2&&l!==(l=Vo(Ve(i[1].chip,i[1].board))+"")&&C(n,l)},d(i){i&&T(t)}}}function od(e){let t,l,n,i,o,f;function r(_,p){return _[6].length==0?dg:pg}let c=r(e),a=c(e);return{c(){t=m("div"),l=m("form"),n=m("input"),i=b(),a.c(),As(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(t,"class","my-2 flex")},m(_,p){P(_,t,p),s(t,l),s(l,n),e[14](n),s(l,i),a.m(l,null),o||(f=[re(n,"change",e[15]),re(l,"submit",e[17])],o=!0)},p(_,p){c===(c=r(_))&&a?a.p(_,p):(a.d(1),a=c(_),a&&(a.c(),a.m(l,null)))},d(_){_&&T(t),e[14](null),a.d(),o=!1,Et(f)}}}function pg(e){var r,c;let t=e[6][0].name+"",l,n,i,o=((c=(r=e[3].btn)==null?void 0:r.upload)!=null?c:"Upload")+"",f;return{c(){l=k(t),n=b(),i=m("button"),f=k(o),u(i,"type","submit"),u(i,"class","btn-pri-sm float-right ml-2")},m(a,_){P(a,l,_),P(a,n,_),P(a,i,_),s(i,f)},p(a,_){var p,v;_&64&&t!==(t=a[6][0].name+"")&&C(l,t),_&8&&o!==(o=((v=(p=a[3].btn)==null?void 0:p.upload)!=null?v:"Upload")+"")&&C(f,o)},d(a){a&&T(l),a&&T(n),a&&T(i)}}}function dg(e){var f,r,c;let t,l=((c=(r=(f=e[3].status)==null?void 0:f.firmware)==null?void 0:r.btn_select_file)!=null?c:"Select file")+"",n,i,o;return{c(){t=m("button"),n=k(l),u(t,"type","button"),u(t,"class","btn-pri-sm float-right")},m(a,_){P(a,t,_),s(t,n),i||(o=re(t,"click",e[16]),i=!0)},p(a,_){var p,v,d;_&8&&l!==(l=((d=(v=(p=a[3].status)==null?void 0:p.firmware)==null?void 0:v.btn_select_file)!=null?d:"Select file")+"")&&C(n,l)},d(a){a&&T(t),i=!1,o()}}}function ad(e){var y,Q,Z,J,$,ce,ie,x,ae;let t,l,n=((Z=(Q=(y=e[3].status)==null?void 0:y.backup)==null?void 0:Q.title)!=null?Z:"Backup")+"",i,o,f,r,c,a,_,p,v=((ce=($=(J=e[3].status)==null?void 0:J.backup)==null?void 0:$.secrets)!=null?ce:"Include secrets")+"",d,h,g,M=((ae=(x=(ie=e[3].status)==null?void 0:ie.backup)==null?void 0:x.secrets_desc)!=null?ae:"")+"",A,L,q,I,O,U,E,B,z=e[10],W=[];for(let oe=0;oe{Me=null}),dt());const Wt={};Ge&33554440&&(Wt.$$scope={dirty:Ge,ctx:Se}),H.$set(Wt),(!be||Ge&8)&&Z!==(Z=((St=(Re=Se[3].btn)==null?void 0:Re.reboot)!=null?St:"Reboot")+"")&&C(J,Z),Se[1].meter?Le?Le.p(Se,Ge):(Le=Q2(Se),Le.c(),Le.m(t,ce)):Le&&(Le.d(1),Le=null),Se[1].net?Ie?Ie.p(Se,Ge):(Ie=X2(Se),Ie.c(),Ie.m(t,ie)):Ie&&(Ie.d(1),Ie=null),(!be||Ge&8)&&oe!==(oe=((tl=(Yt=(ft=Se[3].status)==null?void 0:ft.firmware)==null?void 0:Yt.title)!=null?tl:"Firmware")+"")&&C(se,oe),(!be||Ge&8)&&V!==(V=((Sl=(ul=(fl=Se[3].status)==null?void 0:fl.firmware)==null?void 0:ul.installed)!=null?Sl:"Installed")+"")&&C(X,V),(!be||Ge&2)&&ve!==(ve=Se[1].version+"")&&C(S,ve),Se[1].upgrade.t&&Se[1].upgrade.t!=Se[1].version?He?He.p(Se,Ge):(He=td(Se),He.c(),He.m(x,N)):He&&(He.d(1),He=null),Se[4]?Ye?Ye.p(Se,Ge):(Ye=ld(Se),Ye.c(),Ye.m(x,D)):Ye&&(Ye.d(1),Ye=null),Ge&3&&(j=(Se[1].security==0||Se[0].a)&&ns(Se[1].board)),j?We?We.p(Se,Ge):(We=sd(Se),We.c(),We.m(x,te)):We&&(We.d(1),We=null),Se[1].security==0||Se[0].a?$e?$e.p(Se,Ge):($e=od(Se),$e.c(),$e.m(x,null)):$e&&($e.d(1),$e=null),Se[1].security==0||Se[0].a?xe?xe.p(Se,Ge):(xe=ad(Se),xe.c(),xe.m(t,null)):xe&&(xe.d(1),xe=null);const Dt={};Ge&128&&(Dt.active=Se[7]),Ge&8&&(Dt.message=(ll=(Cl=(rl=Se[3].status)==null?void 0:rl.mask)==null?void 0:Cl.firmware)!=null?ll:"Uploading"),pe.$set(Dt);const yt={};Ge&512&&(yt.active=Se[9]),Ge&8&&(yt.message=(Nl=(dl=(_l=Se[3].status)==null?void 0:_l.mask)==null?void 0:dl.config)!=null?Nl:"Uploading"),Te.$set(yt)},i(Se){be||(Y(q.$$.fragment,Se),Y(Me),Y(H.$$.fragment,Se),Y(pe.$$.fragment,Se),Y(Te.$$.fragment,Se),be=!0)},o(Se){ee(q.$$.fragment,Se),ee(Me),ee(H.$$.fragment,Se),ee(pe.$$.fragment,Se),ee(Te.$$.fragment,Se),be=!1},d(Se){Se&&T(t),ke&&ke.d(),Ne(q),Me&&Me.d(),Ne(H),Le&&Le.d(),Ie&&Ie.d(),He&&He.d(),Ye&&Ye.d(),We&&We.d(),$e&&$e.d(),xe&&xe.d(),Se&&T(fe),Ne(pe,Se),Se&&T(Ae),Ne(Te,Se),Be=!1,De()}}}async function gg(){await(await fetch("reboot",{method:"POST"})).json()}function kg(e,t,l){let{data:n}=t,{sysinfo:i}=t,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],f={};Ml.subscribe(z=>{l(3,f=z)});let r={};Cf.subscribe(z=>{l(4,r=Ev(i.version,z)),r||l(4,r=z[0])});function c(){var z,W;confirm(((W=(z=f.header)==null?void 0:z.upgrade)!=null?W:"Upgrade to {0}?").replace("{0}",r.tag_name))&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Vo(Ve(i.chip,i.board))))&&(wl.update(F=>(F.upgrading=!0,F)),Pv(r.tag_name))}const a=function(){var z,W;confirm((W=(z=f.device)==null?void 0:z.reboot_confirm)!=null?W:"Reboot?")&&(wl.update(F=>(F.booting=!0,F)),gg())};let _,p=[],v=!1,d,h=[],g=!1;kf();let M={hostname:"",ip:""};function A(z){l(9,g=!0);const W=new FormData;W.append("file",h[0]),fetch("/configfile",{method:"POST",body:W}).then(F=>F.json()).then(F=>{wl.update(R=>(M&&M.hostname&&(R.hostname=M.hostname),R.booting=F.reboot,M&&M.ip&&(R.net.ip=M.ip),setTimeout(Ls,5e3,i),R))}).catch(F=>{console.error("Error:",F),setTimeout(Ls,5e3,i)})}function L(z){zo[z?"unshift":"push"](()=>{_=z,l(5,_)})}function q(){p=this.files,l(6,p)}const I=()=>{_.click()},O=()=>l(7,v=!0);function U(z){zo[z?"unshift":"push"](()=>{d=z,l(8,d)})}function E(){h=this.files,l(2,h)}const B=()=>{d.click()};return e.$$set=z=>{"data"in z&&l(0,n=z.data),"sysinfo"in z&&l(1,i=z.sysinfo)},e.$$.update=()=>{if(e.$$.dirty&4&&h.length==1){let z=h[0],W=new FileReader,F=R=>{let K=R.target.result.split(` +`);for(let H in K){let y=K[H];y.startsWith("hostname ")?M.hostname=y.split(" ")[1]:y.startsWith("ip ")&&(M.ip=y.split(" ")[1])}};W.onload=F,W.readAsText(z)}},[n,i,h,f,r,_,p,v,d,g,o,c,a,A,L,q,I,O,U,E,B]}class wg extends mt{constructor(t){super(),_t(this,t,kg,bg,rt,{data:0,sysinfo:1})}}function rd(e){let t,l,n=Ve(e[0],7)+"",i,o,f=Ve(e[0],5)+"",r,c,a=Ve(e[0],4)+"",_,p,v=Ve(e[0],3)+"",d,h,g,M,A=Ve(e[0],2)+"",L,q,I=Ve(e[0],1)+"",O,U,E=Ve(e[0],0)+"",B,z,W,F,R=Ve(e[0],101)+"",K,H,y=Ve(e[0],100)+"",Q;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=b(),g=m("optgroup"),M=m("option"),L=k(A),q=m("option"),O=k(I),U=m("option"),B=k(E),z=b(),W=m("optgroup"),F=m("option"),K=k(R),H=m("option"),Q=k(y),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,u(t,"label","amsleser.no"),M.__value=2,M.value=M.__value,q.__value=1,q.value=q.__value,U.__value=0,U.value=U.__value,u(g,"label","Custom hardware"),F.__value=101,F.value=F.__value,H.__value=100,H.value=H.__value,u(W,"label","Generic hardware")},m(Z,J){P(Z,t,J),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),P(Z,h,J),P(Z,g,J),s(g,M),s(M,L),s(g,q),s(q,O),s(g,U),s(U,B),P(Z,z,J),P(Z,W,J),s(W,F),s(F,K),s(W,H),s(H,Q)},p(Z,J){J&1&&n!==(n=Ve(Z[0],7)+"")&&C(i,n),J&1&&f!==(f=Ve(Z[0],5)+"")&&C(r,f),J&1&&a!==(a=Ve(Z[0],4)+"")&&C(_,a),J&1&&v!==(v=Ve(Z[0],3)+"")&&C(d,v),J&1&&A!==(A=Ve(Z[0],2)+"")&&C(L,A),J&1&&I!==(I=Ve(Z[0],1)+"")&&C(O,I),J&1&&E!==(E=Ve(Z[0],0)+"")&&C(B,E),J&1&&R!==(R=Ve(Z[0],101)+"")&&C(K,R),J&1&&y!==(y=Ve(Z[0],100)+"")&&C(Q,y)},d(Z){Z&&T(t),Z&&T(h),Z&&T(g),Z&&T(z),Z&&T(W)}}}function cd(e){let t,l,n=Ve(e[0],201)+"",i,o,f=Ve(e[0],202)+"",r,c,a=Ve(e[0],203)+"",_,p,v=Ve(e[0],241)+"",d,h,g=Ve(e[0],242)+"",M,A,L=Ve(e[0],243)+"",q,I,O=Ve(e[0],200)+"",U;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=m("option"),d=k(v),h=m("option"),M=k(g),A=m("option"),q=k(L),I=m("option"),U=k(O),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=241,p.value=p.__value,h.__value=242,h.value=h.__value,A.__value=243,A.value=A.__value,I.__value=200,I.value=I.__value,u(t,"label","Generic hardware")},m(E,B){P(E,t,B),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),s(t,p),s(p,d),s(t,h),s(h,M),s(t,A),s(A,q),s(t,I),s(I,U)},p(E,B){B&1&&n!==(n=Ve(E[0],201)+"")&&C(i,n),B&1&&f!==(f=Ve(E[0],202)+"")&&C(r,f),B&1&&a!==(a=Ve(E[0],203)+"")&&C(_,a),B&1&&v!==(v=Ve(E[0],241)+"")&&C(d,v),B&1&&g!==(g=Ve(E[0],242)+"")&&C(M,g),B&1&&L!==(L=Ve(E[0],243)+"")&&C(q,L),B&1&&O!==(O=Ve(E[0],200)+"")&&C(U,O)},d(E){E&&T(t)}}}function _d(e){let t,l,n=Ve(e[0],7)+"",i,o,f=Ve(e[0],6)+"",r,c,a=Ve(e[0],5)+"",_,p,v,d,h=Ve(e[0],51)+"",g,M,A=Ve(e[0],50)+"",L;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=m("option"),r=k(f),c=m("option"),_=k(a),p=b(),v=m("optgroup"),d=m("option"),g=k(h),M=m("option"),L=k(A),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,u(t,"label","amsleser.no"),d.__value=51,d.value=d.__value,M.__value=50,M.value=M.__value,u(v,"label","Generic hardware")},m(q,I){P(q,t,I),s(t,l),s(l,i),s(t,o),s(o,r),s(t,c),s(c,_),P(q,p,I),P(q,v,I),s(v,d),s(d,g),s(v,M),s(M,L)},p(q,I){I&1&&n!==(n=Ve(q[0],7)+"")&&C(i,n),I&1&&f!==(f=Ve(q[0],6)+"")&&C(r,f),I&1&&a!==(a=Ve(q[0],5)+"")&&C(_,a),I&1&&h!==(h=Ve(q[0],51)+"")&&C(g,h),I&1&&A!==(A=Ve(q[0],50)+"")&&C(L,A)},d(q){q&&T(t),q&&T(p),q&&T(v)}}}function md(e){let t,l,n=Ve(e[0],8)+"",i,o,f,r,c=Ve(e[0],71)+"",a,_,p=Ve(e[0],70)+"",v;return{c(){t=m("optgroup"),l=m("option"),i=k(n),o=b(),f=m("optgroup"),r=m("option"),a=k(c),_=m("option"),v=k(p),l.__value=8,l.value=l.__value,u(t,"label","Custom hardware"),r.__value=71,r.value=r.__value,_.__value=70,_.value=_.__value,u(f,"label","Generic hardware")},m(d,h){P(d,t,h),s(t,l),s(l,i),P(d,o,h),P(d,f,h),s(f,r),s(r,a),s(f,_),s(_,v)},p(d,h){h&1&&n!==(n=Ve(d[0],8)+"")&&C(i,n),h&1&&c!==(c=Ve(d[0],71)+"")&&C(a,c),h&1&&p!==(p=Ve(d[0],70)+"")&&C(v,p)},d(d){d&&T(t),d&&T(o),d&&T(f)}}}function pd(e){let t,l,n=Ve(e[0],200)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=200,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ve(o[0],200)+"")&&C(i,n)},d(o){o&&T(t)}}}function dd(e){let t,l,n=Ve(e[0],80)+"",i;return{c(){t=m("optgroup"),l=m("option"),i=k(n),l.__value=80,l.value=l.__value,u(t,"label","Generic hardware")},m(o,f){P(o,t,f),s(t,l),s(l,i)},p(o,f){f&1&&n!==(n=Ve(o[0],80)+"")&&C(i,n)},d(o){o&&T(t)}}}function Mg(e){let t,l,n,i,o,f,r,c,a=e[0]=="esp8266"&&rd(e),_=e[0]=="esp32"&&cd(e),p=e[0]=="esp32s2"&&_d(e),v=e[0]=="esp32c3"&&md(e),d=e[0]=="esp32solo"&&pd(e),h=e[0]=="esp32s3"&&dd(e);return{c(){t=m("option"),l=b(),a&&a.c(),n=b(),_&&_.c(),i=b(),p&&p.c(),o=b(),v&&v.c(),f=b(),d&&d.c(),r=b(),h&&h.c(),c=jt(),t.__value=-1,t.value=t.__value},m(g,M){P(g,t,M),P(g,l,M),a&&a.m(g,M),P(g,n,M),_&&_.m(g,M),P(g,i,M),p&&p.m(g,M),P(g,o,M),v&&v.m(g,M),P(g,f,M),d&&d.m(g,M),P(g,r,M),h&&h.m(g,M),P(g,c,M)},p(g,[M]){g[0]=="esp8266"?a?a.p(g,M):(a=rd(g),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null),g[0]=="esp32"?_?_.p(g,M):(_=cd(g),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g[0]=="esp32s2"?p?p.p(g,M):(p=_d(g),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),g[0]=="esp32c3"?v?v.p(g,M):(v=md(g),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null),g[0]=="esp32solo"?d?d.p(g,M):(d=pd(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null),g[0]=="esp32s3"?h?h.p(g,M):(h=dd(g),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null)},i:ze,o:ze,d(g){g&&T(t),g&&T(l),a&&a.d(g),g&&T(n),_&&_.d(g),g&&T(i),p&&p.d(g),g&&T(o),v&&v.d(g),g&&T(f),d&&d.d(g),g&&T(r),h&&h.d(g),g&&T(c)}}}function Sg(e,t,l){let{chip:n}=t;return e.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Cg extends mt{constructor(t){super(),_t(this,t,Sg,Mg,rt,{chip:0})}}function vd(e){let t;return{c(){t=m("div"),t.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(t,"class","bd-red")},m(l,n){P(l,t,n)},d(l){l&&T(t)}}}function hd(e){let t,l,n,i,o,f,r;return f=new af({props:{chip:e[0].chip}}),{c(){t=m("div"),l=k("HAN GPIO"),n=m("br"),i=b(),o=m("select"),Pe(f.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(t,"class","my-3")},m(c,a){P(c,t,a),s(t,l),s(t,n),s(t,i),s(t,o),Ce(f,o,null),r=!0},p(c,a){const _={};a&1&&(_.chip=c[0].chip),f.$set(_)},i(c){r||(Y(f.$$.fragment,c),r=!0)},o(c){ee(f.$$.fragment,c),r=!1},d(c){c&&T(t),Ne(f)}}}function Ng(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,L,q,I,O,U,E,B,z,W,F,R,K,H=e[0].usrcfg&&vd();h=new Cg({props:{chip:e[0].chip}});let y=e[0].board&&e[0].board>20&&hd(e);return W=new kl({props:{active:e[1],message:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),f.textContent="Initial configuration",r=b(),H&&H.c(),c=b(),a=m("div"),_=k("Board type"),p=m("br"),v=b(),d=m("select"),Pe(h.$$.fragment),g=b(),y&&y.c(),M=b(),A=m("div"),L=m("label"),q=m("input"),I=k(" Clear all other configuration"),O=b(),U=m("div"),U.innerHTML='',E=b(),B=m("span"),B.textContent="\xA0",z=b(),Pe(W.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(f,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),e[0].board===void 0&&Ct(()=>e[5].call(d)),u(a,"class","my-3"),u(q,"type","checkbox"),u(q,"name","vr"),q.__value="true",q.value=q.__value,u(q,"class","rounded mb-1"),u(A,"class","my-3"),u(U,"class","my-3"),u(B,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Q,Z){P(Q,t,Z),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(n,r),H&&H.m(n,null),s(n,c),s(n,a),s(a,_),s(a,p),s(a,v),s(a,d),Ce(h,d,null),Je(d,e[0].board,!0),s(n,g),y&&y.m(n,null),s(n,M),s(n,A),s(A,L),s(L,q),q.checked=e[2],s(L,I),s(n,O),s(n,U),s(n,E),s(n,B),P(Q,z,Z),Ce(W,Q,Z),F=!0,R||(K=[re(d,"change",e[5]),re(q,"change",e[6]),re(n,"submit",as(e[3]))],R=!0)},p(Q,[Z]){Q[0].usrcfg?H||(H=vd(),H.c(),H.m(n,c)):H&&(H.d(1),H=null);const J={};Z&1&&(J.chip=Q[0].chip),h.$set(J),Z&1&&Je(d,Q[0].board),Q[0].board&&Q[0].board>20?y?(y.p(Q,Z),Z&1&&Y(y,1)):(y=hd(Q),y.c(),Y(y,1),y.m(n,M)):y&&(pt(),ee(y,1,1,()=>{y=null}),dt()),Z&4&&(q.checked=Q[2]);const $={};Z&2&&($.active=Q[1]),W.$set($)},i(Q){F||(Y(h.$$.fragment,Q),Y(y),Y(W.$$.fragment,Q),F=!0)},o(Q){ee(h.$$.fragment,Q),ee(y),ee(W.$$.fragment,Q),F=!1},d(Q){Q&&T(t),H&&H.d(),Ne(h),y&&y.d(),Q&&T(z),Ne(W,Q),R=!1,Et(K)}}}function Tg(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o=!1;async function f(_){l(1,o=!0);const p=new FormData(_.target),v=new URLSearchParams;for(let g of p){const[M,A]=g;v.append(M,A)}let h=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),wl.update(g=>(g.vndcfg=h.success,g.booting=h.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),hi(n+(i.usrcfg?"/":"/setup"))}let r=!1;wl.subscribe(_=>{l(0,i=_),_.fwconsent===1&&l(2,r=!i.usrcfg)});function c(){i.board=Bt(this),l(0,i)}function a(){r=this.checked,l(2,r)}return e.$$set=_=>{"basepath"in _&&l(4,n=_.basepath),"sysinfo"in _&&l(0,i=_.sysinfo)},[i,o,r,f,n,c,a]}class Pg extends mt{constructor(t){super(),_t(this,t,Tg,Ng,rt,{basepath:4,sysinfo:0})}}function bd(e){var i,o,f;let t,l=((f=(o=(i=e[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)!=null?f:"Ethernet")+"",n;return{c(){t=m("option"),n=k(l),t.__value=3,t.value=t.__value},m(r,c){P(r,t,c),s(t,n)},p(r,c){var a,_,p;c&2&&l!==(l=((p=(_=(a=r[1].conf)==null?void 0:a.connection)==null?void 0:_.eth)!=null?p:"Ethernet")+"")&&C(n,l)},d(r){r&&T(t)}}}function gd(e){var M,A,L,q,I,O;let t,l=((L=(A=(M=e[1].conf)==null?void 0:M.connection)==null?void 0:A.ssid)!=null?L:"SSID")+"",n,i,o,f,r,c,a,_=((O=(I=(q=e[1].conf)==null?void 0:q.connection)==null?void 0:I.psk)!=null?O:"Password")+"",p,v,d,h,g;return{c(){t=m("div"),n=k(l),i=m("br"),o=b(),f=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(f,"name","ss"),u(f,"type","text"),u(f,"class","in-s"),f.required=r=e[3]==1||e[3]==2,u(t,"class","my-3"),u(h,"name","sp"),u(h,"type","password"),u(h,"class","in-s"),u(h,"autocomplete","off"),h.required=g=e[3]==2,u(a,"class","my-3")},m(U,E){P(U,t,E),s(t,n),s(t,i),s(t,o),s(t,f),P(U,c,E),P(U,a,E),s(a,p),s(a,v),s(a,d),s(a,h)},p(U,E){var B,z,W,F,R,K;E&2&&l!==(l=((W=(z=(B=U[1].conf)==null?void 0:B.connection)==null?void 0:z.ssid)!=null?W:"SSID")+"")&&C(n,l),E&8&&r!==(r=U[3]==1||U[3]==2)&&(f.required=r),E&2&&_!==(_=((K=(R=(F=U[1].conf)==null?void 0:F.connection)==null?void 0:R.psk)!=null?K:"Password")+"")&&C(p,_),E&8&&g!==(g=U[3]==2)&&(h.required=g)},d(U){U&&T(t),U&&T(c),U&&T(a)}}}function kd(e){let t,l,n,i,o,f,r,c;return r=new Ov({}),{c(){t=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),f=m("select"),Pe(r.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=e[2],u(f,"name","su"),u(f,"class","in-l"),f.required=e[2],u(n,"class","flex")},m(a,_){P(a,t,_),P(a,l,_),P(a,n,_),s(n,i),s(n,o),s(n,f),Ce(r,f,null),c=!0},p(a,_){(!c||_&4)&&(i.required=a[2]),(!c||_&4)&&(f.required=a[2])},i(a){c||(Y(r.$$.fragment,a),c=!0)},o(a){ee(r.$$.fragment,a),c=!1},d(a){a&&T(t),a&&T(l),a&&T(n),Ne(r)}}}function wd(e){var g,M,A,L,q,I;let t,l,n=((A=(M=(g=e[1].conf)==null?void 0:g.network)==null?void 0:M.gw)!=null?A:"Gateway")+"",i,o,f,r,c,a,_=((I=(q=(L=e[1].conf)==null?void 0:L.network)==null?void 0:q.dns)!=null?I:"DNS")+"",p,v,d,h;return{c(){t=m("div"),l=m("div"),i=k(n),o=m("br"),f=b(),r=m("input"),c=b(),a=m("div"),p=k(_),v=m("br"),d=b(),h=m("input"),u(r,"name","sg"),u(r,"type","text"),u(r,"class","in-f w-full"),u(h,"name","sd"),u(h,"type","text"),u(h,"class","in-l w-full"),u(t,"class","my-3 flex")},m(O,U){P(O,t,U),s(t,l),s(l,i),s(l,o),s(l,f),s(l,r),s(t,c),s(t,a),s(a,p),s(a,v),s(a,d),s(a,h)},p(O,U){var E,B,z,W,F,R;U&2&&n!==(n=((z=(B=(E=O[1].conf)==null?void 0:E.network)==null?void 0:B.gw)!=null?z:"Gateway")+"")&&C(i,n),U&2&&_!==(_=((R=(F=(W=O[1].conf)==null?void 0:W.network)==null?void 0:F.dns)!=null?R:"DNS")+"")&&C(p,_)},d(O){O&&T(t)}}}function Eg(e){var j,te,ne,fe,pe,Ae,Te,be,Be,De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct;let t,l,n,i,o,f,r=((te=(j=e[1].setup)==null?void 0:j.title)!=null?te:"Setup")+"",c,a,_,p=((pe=(fe=(ne=e[1].conf)==null?void 0:ne.connection)==null?void 0:fe.title)!=null?pe:"Connection")+"",v,d,h,g,M,A=((be=(Te=(Ae=e[1].conf)==null?void 0:Ae.connection)==null?void 0:Te.wifi)!=null?be:"Connect to WiFi")+"",L,q,I=((ke=(De=(Be=e[1].conf)==null?void 0:Be.connection)==null?void 0:De.ap)!=null?ke:"Standalone access point")+"",O,U,E,B,z=((Ie=(Le=(Me=e[1].conf)==null?void 0:Me.general)==null?void 0:Le.hostname)!=null?Ie:"Hostname")+"",W,F,R,K,H,y,Q,Z,J=((Ye=(He=e[1].setup)==null?void 0:He.static)!=null?Ye:"Static IP")+"",$,ce,ie,x,ae,oe,se=(($e=(We=e[1].btn)==null?void 0:We.save)!=null?$e:"Save")+"",de,me,V,X,we,ve,S=e[0].if&&e[0].if.eth&&bd(e),w=(e[3]==1||e[3]==2)&&gd(e),N=e[2]&&kd(e),D=e[2]&&wd(e);return V=new kl({props:{active:e[4],message:(ct=(xe=e[1].setup)==null?void 0:xe.mask)!=null?ct:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),f=m("strong"),c=k(r),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("select"),M=m("option"),L=k(A),q=m("option"),O=k(I),S&&S.c(),U=b(),w&&w.c(),E=b(),B=m("div"),W=k(z),F=b(),R=m("input"),K=b(),H=m("div"),y=m("label"),Q=m("input"),Z=b(),$=k(J),ce=b(),N&&N.c(),ie=b(),D&&D.c(),x=b(),ae=m("div"),oe=m("button"),de=k(se),me=b(),Pe(V.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(f,"class","text-sm"),M.__value=1,M.value=M.__value,q.__value=2,q.value=q.__value,u(g,"name","sc"),u(g,"class","in-s"),e[3]===void 0&&Ct(()=>e[6].call(g)),u(_,"class","my-3"),u(R,"name","sh"),u(R,"type","text"),u(R,"class","in-s"),u(R,"maxlength","32"),u(R,"pattern","[a-z0-9_-]+"),u(R,"placeholder","Optional, ex.: ams-reader"),u(R,"autocomplete","off"),u(Q,"type","checkbox"),u(Q,"name","sm"),Q.__value="static",Q.value=Q.__value,u(Q,"class","rounded mb-1"),u(H,"class","my-3"),u(oe,"type","submit"),u(oe,"class","btn-pri"),u(ae,"class","my-3"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(qe,ue){P(qe,t,ue),s(t,l),s(l,n),s(n,i),s(n,o),s(n,f),s(f,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,M),s(M,L),s(g,q),s(q,O),S&&S.m(g,null),Je(g,e[3],!0),s(n,U),w&&w.m(n,null),s(n,E),s(n,B),s(B,W),s(B,F),s(B,R),ge(R,e[0].hostname),s(n,K),s(n,H),s(H,y),s(y,Q),Q.checked=e[2],s(y,Z),s(y,$),s(H,ce),N&&N.m(H,null),s(n,ie),D&&D.m(n,null),s(n,x),s(n,ae),s(ae,oe),s(oe,de),P(qe,me,ue),Ce(V,qe,ue),X=!0,we||(ve=[re(g,"change",e[6]),re(R,"input",e[7]),re(Q,"change",e[8]),re(n,"submit",as(e[5]))],we=!0)},p(qe,[ue]){var kt,tt,wt,it,st,et,Nt,gt,At,Pt,Ue,ye,It,vt,lt,Tt,nt,ot,ut,Ht;(!X||ue&2)&&r!==(r=((tt=(kt=qe[1].setup)==null?void 0:kt.title)!=null?tt:"Setup")+"")&&C(c,r),(!X||ue&2)&&p!==(p=((st=(it=(wt=qe[1].conf)==null?void 0:wt.connection)==null?void 0:it.title)!=null?st:"Connection")+"")&&C(v,p),(!X||ue&2)&&A!==(A=((gt=(Nt=(et=qe[1].conf)==null?void 0:et.connection)==null?void 0:Nt.wifi)!=null?gt:"Connect to WiFi")+"")&&C(L,A),(!X||ue&2)&&I!==(I=((Ue=(Pt=(At=qe[1].conf)==null?void 0:At.connection)==null?void 0:Pt.ap)!=null?Ue:"Standalone access point")+"")&&C(O,I),qe[0].if&&qe[0].if.eth?S?S.p(qe,ue):(S=bd(qe),S.c(),S.m(g,null)):S&&(S.d(1),S=null),ue&8&&Je(g,qe[3]),qe[3]==1||qe[3]==2?w?w.p(qe,ue):(w=gd(qe),w.c(),w.m(n,E)):w&&(w.d(1),w=null),(!X||ue&2)&&z!==(z=((vt=(It=(ye=qe[1].conf)==null?void 0:ye.general)==null?void 0:It.hostname)!=null?vt:"Hostname")+"")&&C(W,z),ue&1&&R.value!==qe[0].hostname&&ge(R,qe[0].hostname),ue&4&&(Q.checked=qe[2]),(!X||ue&2)&&J!==(J=((Tt=(lt=qe[1].setup)==null?void 0:lt.static)!=null?Tt:"Static IP")+"")&&C($,J),qe[2]?N?(N.p(qe,ue),ue&4&&Y(N,1)):(N=kd(qe),N.c(),Y(N,1),N.m(H,null)):N&&(pt(),ee(N,1,1,()=>{N=null}),dt()),qe[2]?D?D.p(qe,ue):(D=wd(qe),D.c(),D.m(n,x)):D&&(D.d(1),D=null),(!X||ue&2)&&se!==(se=((ot=(nt=qe[1].btn)==null?void 0:nt.save)!=null?ot:"Save")+"")&&C(de,se);const Oe={};ue&16&&(Oe.active=qe[4]),ue&2&&(Oe.message=(Ht=(ut=qe[1].setup)==null?void 0:ut.mask)!=null?Ht:"Saving"),V.$set(Oe)},i(qe){X||(Y(N),Y(V.$$.fragment,qe),X=!0)},o(qe){ee(N),ee(V.$$.fragment,qe),X=!1},d(qe){qe&&T(t),S&&S.d(),w&&w.d(),N&&N.d(),D&&D.d(),qe&&T(me),Ne(V,qe),we=!1,Et(ve)}}}function Ag(e,t,l){let n={};Ml.subscribe(d=>{l(1,n=d)});let{sysinfo:i={}}=t,o=!1,f=1,r=!1;function c(d){wl.update(h=>(h.trying=d,h))}async function a(d){l(4,r=!0);const h=new FormData(d.target),g=new URLSearchParams;for(let L of h){const[q,I]=L;g.append(q,I)}let A=await(await fetch("save",{method:"POST",body:g})).json();l(4,r=!1),wl.update(L=>(L.hostname=h.get("sh"),L.usrcfg=A.success,L.booting=A.reboot,o&&(L.net.ip=h.get("si"),L.net.mask=h.get("su"),L.net.gw=h.get("sg"),L.net.dns1=h.get("sd")),A.reboot&&setTimeout(Ls,5e3,i,c),L))}function _(){f=Bt(this),l(3,f)}function p(){i.hostname=this.value,l(0,i)}function v(){o=this.checked,l(2,o)}return e.$$set=d=>{"sysinfo"in d&&l(0,i=d.sysinfo)},[i,n,o,f,r,a,_,p,v]}class Dg extends mt{constructor(t){super(),_t(this,t,Ag,Eg,rt,{sysinfo:0})}}function qg(e){var W,F,R,K,H,y,Q,Z;let t,l,n,i=((F=(W=e[2].upload)==null?void 0:W.title)!=null?F:"Upload")+"",o,f,r,c,a,_=((K=(R=e[2].upload)==null?void 0:R.desc)!=null?K:"")+"",p,v,d,h,g,M,A,L,q=((y=(H=e[2].btn)==null?void 0:H.upload)!=null?y:"Upload")+"",I,O,U,E,B,z;return U=new kl({props:{active:e[3],message:(Z=(Q=e[2].upload)==null?void 0:Q.mask)!=null?Z:"Uploading"}}),{c(){t=m("div"),l=m("div"),n=m("strong"),o=k(i),f=b(),r=k(e[1]),c=b(),a=m("p"),p=k(_),v=b(),d=m("form"),h=m("input"),g=b(),M=m("div"),A=m("button"),L=m("p"),I=k(q),O=b(),Pe(U.$$.fragment),u(a,"class","mb-4"),u(h,"name","file"),u(h,"type","file"),u(L,"class","mb-4"),u(A,"type","submit"),u(A,"class","btn-pri"),u(M,"class","w-full text-right mt-4"),u(d,"action",e[0]),u(d,"enctype","multipart/form-data"),u(d,"method","post"),u(d,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(J,$){P(J,t,$),s(t,l),s(l,n),s(n,o),s(n,f),s(n,r),s(l,c),s(l,a),s(a,p),s(l,v),s(l,d),s(d,h),s(d,g),s(d,M),s(M,A),s(A,L),s(L,I),P(J,O,$),Ce(U,J,$),E=!0,B||(z=re(d,"submit",e[4]),B=!0)},p(J,[$]){var ie,x,ae,oe,se,de,me,V;(!E||$&4)&&i!==(i=((x=(ie=J[2].upload)==null?void 0:ie.title)!=null?x:"Upload")+"")&&C(o,i),(!E||$&2)&&C(r,J[1]),(!E||$&4)&&_!==(_=((oe=(ae=J[2].upload)==null?void 0:ae.desc)!=null?oe:"")+"")&&C(p,_),(!E||$&4)&&q!==(q=((de=(se=J[2].btn)==null?void 0:se.upload)!=null?de:"Upload")+"")&&C(I,q),(!E||$&1)&&u(d,"action",J[0]);const ce={};$&8&&(ce.active=J[3]),$&4&&(ce.message=(V=(me=J[2].upload)==null?void 0:me.mask)!=null?V:"Uploading"),U.$set(ce)},i(J){E||(Y(U.$$.fragment,J),E=!0)},o(J){ee(U.$$.fragment,J),E=!1},d(J){J&&T(t),J&&T(O),Ne(U,J),B=!1,z()}}}function Og(e,t,l){let{action:n}=t,{title:i}=t,o={};Ml.subscribe(c=>{l(2,o=c)});let f=!1;const r=()=>l(3,f=!0);return e.$$set=c=>{"action"in c&&l(0,n=c.action),"title"in c&&l(1,i=c.title)},[n,i,o,f,r]}class Tf extends mt{constructor(t){super(),_t(this,t,Og,qg,rt,{action:0,title:1})}}function Ig(e){var V,X,we,ve,S,w,N,D,j,te,ne,fe,pe,Ae;let t,l,n,i,o=((X=(V=e[1].consent)==null?void 0:V.title)!=null?X:"Consents")+"",f,r,c,a,_,p=((ve=(we=e[1].consent)==null?void 0:we.one_click)!=null?ve:"One-click")+"",v,d,h,g,M=((w=(S=e[1].consent)==null?void 0:S.read_more)!=null?w:"Read more")+"",A,L,q,I,O,U,E,B=((D=(N=e[1].consent)==null?void 0:N.yes)!=null?D:"Yes")+"",z,W,F,R,K,H,y=((te=(j=e[1].consent)==null?void 0:j.no)!=null?te:"No")+"",Q,Z,J,$,ce,ie=((fe=(ne=e[1].btn)==null?void 0:ne.save)!=null?fe:"Save")+"",x,ae,oe,se,de,me;return oe=new kl({props:{active:e[2],message:(Ae=(pe=e[1].consent)==null?void 0:pe.mask_saving)!=null?Ae:"Saving"}}),{c(){t=m("div"),l=m("div"),n=m("form"),i=m("div"),f=k(o),r=b(),c=m("hr"),a=b(),_=m("div"),v=k(p),d=m("br"),h=b(),g=m("a"),A=k(M),L=m("br"),q=b(),I=m("label"),O=m("input"),E=b(),z=k(B),W=b(),F=m("label"),R=m("input"),H=b(),Q=k(y),Z=m("br"),J=b(),$=m("div"),ce=m("button"),x=k(ie),ae=b(),Pe(oe.$$.fragment),u(g,"href",zl("Data-collection-on-one-click-firmware-upgrade")),u(g,"target","_blank"),u(g,"class","text-blue-600 hover:text-blue-800"),u(O,"type","radio"),u(O,"name","sf"),O.value=1,O.checked=U=e[0].fwconsent===1,u(O,"class","rounded m-2"),O.required=!0,u(R,"type","radio"),u(R,"name","sf"),R.value=2,R.checked=K=e[0].fwconsent===2,u(R,"class","rounded m-2"),R.required=!0,u(_,"class","my-3"),u(ce,"type","submit"),u(ce,"class","btn-pri"),u($,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(t,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Te,be){P(Te,t,be),s(t,l),s(l,n),s(n,i),s(i,f),s(n,r),s(n,c),s(n,a),s(n,_),s(_,v),s(_,d),s(_,h),s(_,g),s(g,A),s(_,L),s(_,q),s(_,I),s(I,O),s(I,E),s(I,z),s(_,W),s(_,F),s(F,R),s(F,H),s(F,Q),s(_,Z),s(n,J),s(n,$),s($,ce),s(ce,x),P(Te,ae,be),Ce(oe,Te,be),se=!0,de||(me=re(n,"submit",as(e[3])),de=!0)},p(Te,[be]){var De,ke,Me,Le,Ie,He,Ye,We,$e,xe,ct,qe,ue,Oe;(!se||be&2)&&o!==(o=((ke=(De=Te[1].consent)==null?void 0:De.title)!=null?ke:"Consents")+"")&&C(f,o),(!se||be&2)&&p!==(p=((Le=(Me=Te[1].consent)==null?void 0:Me.one_click)!=null?Le:"One-click")+"")&&C(v,p),(!se||be&2)&&M!==(M=((He=(Ie=Te[1].consent)==null?void 0:Ie.read_more)!=null?He:"Read more")+"")&&C(A,M),(!se||be&1&&U!==(U=Te[0].fwconsent===1))&&(O.checked=U),(!se||be&2)&&B!==(B=((We=(Ye=Te[1].consent)==null?void 0:Ye.yes)!=null?We:"Yes")+"")&&C(z,B),(!se||be&1&&K!==(K=Te[0].fwconsent===2))&&(R.checked=K),(!se||be&2)&&y!==(y=((xe=($e=Te[1].consent)==null?void 0:$e.no)!=null?xe:"No")+"")&&C(Q,y),(!se||be&2)&&ie!==(ie=((qe=(ct=Te[1].btn)==null?void 0:ct.save)!=null?qe:"Save")+"")&&C(x,ie);const Be={};be&4&&(Be.active=Te[2]),be&2&&(Be.message=(Oe=(ue=Te[1].consent)==null?void 0:ue.mask_saving)!=null?Oe:"Saving"),oe.$set(Be)},i(Te){se||(Y(oe.$$.fragment,Te),se=!0)},o(Te){ee(oe.$$.fragment,Te),se=!1},d(Te){Te&&T(t),Te&&T(ae),Ne(oe,Te),de=!1,me()}}}function Lg(e,t,l){let{basepath:n="/"}=t,{sysinfo:i={}}=t,o={};Ml.subscribe(c=>{l(1,o=c)});let f=!1;async function r(c){l(2,f=!0);const a=new FormData(c.target),_=new URLSearchParams;for(let d of a){const[h,g]=d;_.append(h,g)}let v=await(await fetch("save",{method:"POST",body:_})).json();l(2,f=!1),wl.update(d=>(d.fwconsent=a.sf===!0?1:a.sf===!1?2:0,d.booting=v.reboot,d)),hi(n)}return e.$$set=c=>{"basepath"in c&&l(4,n=c.basepath),"sysinfo"in c&&l(0,i=c.sysinfo)},[i,o,f,r,n]}class Rg extends mt{constructor(t){super(),_t(this,t,Lg,Ig,rt,{basepath:4,sysinfo:0})}}function Md(e,t,l){const n=e.slice();return n[24]=t[l],n[25]=t,n[26]=l,n}function Sd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Fg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Cd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Bg(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Nd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Td(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Pd(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Ed(e,t,l){const n=e.slice();return n[27]=t[l],n[29]=l,n}function Ad(e){let t,l=e[1].o,n=[];for(let i=0;i{l(0,i=F)});let o=["mo","tu","we","th","fr","sa","su"],f={},r=!0,c=!1;qv.subscribe(F=>{F.o&&(l(1,f=F),l(2,r=!1))}),N4();async function a(F){l(3,c=!0);const R=new URLSearchParams;R.append("r","true"),R.append("rc",f.o.length),f.o.forEach(function(H,y){R.append("rt"+y,H.t),R.append("rn"+y,H.n),R.append("rd"+y,H.d),R.append("ra"+y,H.a),R.append("rh"+y,H.h),R.append("rv"+y,H.v),R.append("rsm"+y,H.s.m),R.append("rsd"+y,H.s.d),R.append("rem"+y,H.e.m),R.append("red"+y,H.e.d)}),await(await fetch("save",{method:"POST",body:R})).json(),l(3,c=!1),hi(n+"configuration")}let _=function(F,R){return F.includes(R)?F=F.filter(function(K){return K!==R}):F.push(R),F},p=function(){let F=f.o;F.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,f.o=F,f)},v=function(F){let R=f.o;R.splice(F,1),l(1,f.o=R,f)};function d(F,R){F[R].n=this.value,l(1,f)}function h(F,R){F[R].d=Bt(this),l(1,f)}function g(F,R){F[R].t=Bt(this),l(1,f)}function M(F,R){F[R].v=Ze(this.value),l(1,f)}const A=(F,R,K,H)=>l(1,K[H].a=_(F.a,R),f),L=(F,R,K,H)=>l(1,K[H].h=_(F.h,R),f),q=(F,R,K,H)=>l(1,K[H].h=_(F.h,R+8),f),I=(F,R,K,H)=>l(1,K[H].h=_(F.h,R+16),f);function O(F,R){F[R].s.m=Bt(this),l(1,f)}function U(F,R){F[R].s.d=Bt(this),l(1,f)}function E(F,R){F[R].e.m=Bt(this),l(1,f)}function B(F,R){F[R].e.d=Bt(this),l(1,f)}const z=F=>v(F),W=F=>v(F);return e.$$set=F=>{"basepath"in F&&l(9,n=F.basepath)},[i,f,r,c,o,a,_,p,v,n,d,h,g,M,A,L,q,I,O,U,E,B,z,W]}class zg extends mt{constructor(t){super(),_t(this,t,yg,Hg,rt,{basepath:9},null,[-1,-1])}}function Wg(e){let t,l;return t=new S4({props:{data:e[2],sysinfo:e[1]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&4&&(o.data=n[2]),i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Gg(e){let t,l;return t=new ug({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Vg(e){let t,l;return t=new zg({props:{basepath:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Kg(e){let t,l;return t=new wg({props:{sysinfo:e[1],data:e[2]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&4&&(o.data=n[2]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Yg(e){let t,l;return t=new Tf({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p:ze,i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Qg(e){let t,l;return t=new Tf({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p:ze,i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Xg(e){let t,l;return t=new Tf({props:{title:"private key",action:"/mqtt-key"}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p:ze,i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Zg(e){let t,l;return t=new Rg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function Jg(e){let t,l;return t=new Dg({props:{sysinfo:e[1]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function $g(e){let t,l;return t=new Pg({props:{sysinfo:e[1],basepath:e[0]}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p(n,i){const o={};i&2&&(o.sysinfo=n[1]),i&1&&(o.basepath=n[0]),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function xg(e){let t,l,n,i,o,f,r,c,a,_,p,v,d,h,g,M,A,L,q,I,O,U;return t=new Rb({props:{data:e[2],basepath:e[0]}}),n=new Sn({props:{path:"/",$$slots:{default:[Wg]},$$scope:{ctx:e}}}),o=new Sn({props:{path:"/configuration",$$slots:{default:[Gg]},$$scope:{ctx:e}}}),r=new Sn({props:{path:"/priceconfig",$$slots:{default:[Vg]},$$scope:{ctx:e}}}),a=new Sn({props:{path:"/status",$$slots:{default:[Kg]},$$scope:{ctx:e}}}),p=new Sn({props:{path:"/mqtt-ca",$$slots:{default:[Yg]},$$scope:{ctx:e}}}),d=new Sn({props:{path:"/mqtt-cert",$$slots:{default:[Qg]},$$scope:{ctx:e}}}),g=new Sn({props:{path:"/mqtt-key",$$slots:{default:[Xg]},$$scope:{ctx:e}}}),A=new Sn({props:{path:"/consent",$$slots:{default:[Zg]},$$scope:{ctx:e}}}),q=new Sn({props:{path:"/setup",$$slots:{default:[Jg]},$$scope:{ctx:e}}}),O=new Sn({props:{path:"/vendor",$$slots:{default:[$g]},$$scope:{ctx:e}}}),{c(){Pe(t.$$.fragment),l=b(),Pe(n.$$.fragment),i=b(),Pe(o.$$.fragment),f=b(),Pe(r.$$.fragment),c=b(),Pe(a.$$.fragment),_=b(),Pe(p.$$.fragment),v=b(),Pe(d.$$.fragment),h=b(),Pe(g.$$.fragment),M=b(),Pe(A.$$.fragment),L=b(),Pe(q.$$.fragment),I=b(),Pe(O.$$.fragment)},m(E,B){Ce(t,E,B),P(E,l,B),Ce(n,E,B),P(E,i,B),Ce(o,E,B),P(E,f,B),Ce(r,E,B),P(E,c,B),Ce(a,E,B),P(E,_,B),Ce(p,E,B),P(E,v,B),Ce(d,E,B),P(E,h,B),Ce(g,E,B),P(E,M,B),Ce(A,E,B),P(E,L,B),Ce(q,E,B),P(E,I,B),Ce(O,E,B),U=!0},p(E,B){const z={};B&4&&(z.data=E[2]),B&1&&(z.basepath=E[0]),t.$set(z);const W={};B&22&&(W.$$scope={dirty:B,ctx:E}),n.$set(W);const F={};B&19&&(F.$$scope={dirty:B,ctx:E}),o.$set(F);const R={};B&17&&(R.$$scope={dirty:B,ctx:E}),r.$set(R);const K={};B&22&&(K.$$scope={dirty:B,ctx:E}),a.$set(K);const H={};B&16&&(H.$$scope={dirty:B,ctx:E}),p.$set(H);const y={};B&16&&(y.$$scope={dirty:B,ctx:E}),d.$set(y);const Q={};B&16&&(Q.$$scope={dirty:B,ctx:E}),g.$set(Q);const Z={};B&19&&(Z.$$scope={dirty:B,ctx:E}),A.$set(Z);const J={};B&18&&(J.$$scope={dirty:B,ctx:E}),q.$set(J);const $={};B&19&&($.$$scope={dirty:B,ctx:E}),O.$set($)},i(E){U||(Y(t.$$.fragment,E),Y(n.$$.fragment,E),Y(o.$$.fragment,E),Y(r.$$.fragment,E),Y(a.$$.fragment,E),Y(p.$$.fragment,E),Y(d.$$.fragment,E),Y(g.$$.fragment,E),Y(A.$$.fragment,E),Y(q.$$.fragment,E),Y(O.$$.fragment,E),U=!0)},o(E){ee(t.$$.fragment,E),ee(n.$$.fragment,E),ee(o.$$.fragment,E),ee(r.$$.fragment,E),ee(a.$$.fragment,E),ee(p.$$.fragment,E),ee(d.$$.fragment,E),ee(g.$$.fragment,E),ee(A.$$.fragment,E),ee(q.$$.fragment,E),ee(O.$$.fragment,E),U=!1},d(E){Ne(t,E),E&&T(l),Ne(n,E),E&&T(i),Ne(o,E),E&&T(f),Ne(r,E),E&&T(c),Ne(a,E),E&&T(_),Ne(p,E),E&&T(v),Ne(d,E),E&&T(h),Ne(g,E),E&&T(M),Ne(A,E),E&&T(L),Ne(q,E),E&&T(I),Ne(O,E)}}}function e3(e){let t,l,n,i;const o=[n3,l3],f=[];function r(c,a){return c[1].trying?0:1}return t=r(e),l=f[t]=o[t](e),{c(){l.c(),n=jt()},m(c,a){f[t].m(c,a),P(c,n,a),i=!0},p(c,a){let _=t;t=r(c),t===_?f[t].p(c,a):(pt(),ee(f[_],1,1,()=>{f[_]=null}),dt(),l=f[t],l?l.p(c,a):(l=f[t]=o[t](c),l.c()),Y(l,1),l.m(n.parentNode,n))},i(c){i||(Y(l),i=!0)},o(c){ee(l),i=!1},d(c){f[t].d(c),c&&T(n)}}}function t3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p:ze,i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function l3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,n,i),l=!0},p:ze,i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function n3(e){let t,l;return t=new kl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+e[1].trying}}),{c(){Pe(t.$$.fragment)},m(n,i){Ce(t,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),t.$set(o)},i(n){l||(Y(t.$$.fragment,n),l=!0)},o(n){ee(t.$$.fragment,n),l=!1},d(n){Ne(t,n)}}}function i3(e){let t,l,n,i,o,f;l=new rv({props:{basepath:e[0],$$slots:{default:[xg]},$$scope:{ctx:e}}});const r=[t3,e3],c=[];function a(_,p){return _[1].upgrading?0:_[1].booting?1:-1}return~(i=a(e))&&(o=c[i]=r[i](e)),{c(){t=m("div"),Pe(l.$$.fragment),n=b(),o&&o.c(),u(t,"class","container mx-auto m-3")},m(_,p){P(_,t,p),Ce(l,t,null),s(t,n),~i&&c[i].m(t,null),f=!0},p(_,[p]){const v={};p&1&&(v.basepath=_[0]),p&23&&(v.$$scope={dirty:p,ctx:_}),l.$set(v);let d=i;i=a(_),i===d?~i&&c[i].p(_,p):(o&&(pt(),ee(c[d],1,1,()=>{c[d]=null}),dt()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=r[i](_),o.c()),Y(o,1),o.m(t,null)):o=null)},i(_){f||(Y(l.$$.fragment,_),Y(o),f=!0)},o(_){ee(l.$$.fragment,_),ee(o),f=!1},d(_){_&&T(t),Ne(l),~i&&c[i].d()}}}function s3(e,t,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i={};Ml.subscribe(r=>{i=r});let o={};wl.subscribe(r=>{var c;l(1,o=r),o.vndcfg===!1?hi(n+"vendor"):o.usrcfg===!1?hi(n+"setup"):o.fwconsent===0&&hi(n+"consent"),o.ui.k===1?document.documentElement.classList.add("dark"):o.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),o.ui.lang&&o.ui.lang!=((c=i==null?void 0:i.language)==null?void 0:c.code)&&Tv(o.ui.lang)}),kf();let f={};return vv.subscribe(r=>{l(2,f=r)}),[n,o,f]}class o3 extends mt{constructor(t){super(),_t(this,t,s3,i3,rt,{})}}new o3({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/Dashboard.svelte b/lib/SvelteUi/app/src/lib/Dashboard.svelte index df25cf90..1e0e1cbf 100644 --- a/lib/SvelteUi/app/src/lib/Dashboard.svelte +++ b/lib/SvelteUi/app/src/lib/Dashboard.svelte @@ -145,7 +145,7 @@ {/if} - {#if uiVisibility(sysinfo.ui.l)} + {#if uiVisibility(sysinfo.ui.l, data.hm == 1)}
diff --git a/lib/SvelteUi/app/src/lib/Helpers.js b/lib/SvelteUi/app/src/lib/Helpers.js index 40167572..2f663a3a 100644 --- a/lib/SvelteUi/app/src/lib/Helpers.js +++ b/lib/SvelteUi/app/src/lib/Helpers.js @@ -110,6 +110,7 @@ export function boardtype(c, b) { case 80: return "Generic ESP32-S3"; } + return "Unknown"; } export function isBusPowered(boardType) { diff --git a/lib/SvelteUi/app/src/lib/StatusPage.svelte b/lib/SvelteUi/app/src/lib/StatusPage.svelte index 4a835244..b3cc52ca 100644 --- a/lib/SvelteUi/app/src/lib/StatusPage.svelte +++ b/lib/SvelteUi/app/src/lib/StatusPage.svelte @@ -141,7 +141,7 @@
{translations.status?.device.title ?? "Device"}
- {translations.status?.device?.chip ?? "Chip"}: {sysinfo.chip} ({sysinfo.cpu}MHz) + {translations.status?.device?.chip ?? "Chip"}: {sysinfo.chip} {#if sysinfo.cpu}({sysinfo.cpu}MHz){/if}
{translations.status?.device?.device ?? "Device"}: {boardtype(sysinfo.chip, sysinfo.board)} diff --git a/lib/SvelteUi/include/AmsWebServer.h b/lib/SvelteUi/include/AmsWebServer.h index c742dd37..34bc0228 100644 --- a/lib/SvelteUi/include/AmsWebServer.h +++ b/lib/SvelteUi/include/AmsWebServer.h @@ -39,12 +39,6 @@ #include "LittleFS.h" -struct ResetDataContainer { - uint8_t cause; - uint8_t last_cause; - uint8_t magic; -}; - class AmsWebServer { public: AmsWebServer(uint8_t* buf, RemoteDebug* Debug, HwTools* hw, ResetDataContainer* rdc); diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index 81a7525f..839917fb 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -252,6 +252,9 @@ void AmsWebServer::logoSvg() { } void AmsWebServer::sysinfoJson() { + if(!checkSecurity(2, true)) + return; + SystemConfig sys; config->getSystemConfig(sys); diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index 539f139d..4813aa60 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -674,7 +674,7 @@ void loop() { if(cloud == NULL) { cloud = new CloudConnector(&Debug); } - if(cloud->setup(cc, meterConfig, &hw)) { + if(cloud->setup(cc, meterConfig, sysConfig, &hw, &rdc)) { config.setCloudConfig(cc); } } @@ -929,6 +929,11 @@ void handleNtpChange() { ws.setTimezone(tz); ds.setTimezone(tz); ea.setTimezone(tz); + #if defined(ESP32) + if(cloud != NULL) { + cloud->setTimezone(tz); + } + #endif } config.ackNtpChange(); @@ -1149,6 +1154,10 @@ void connectToNetwork() { } ch->connect(network, sysConfig); ws.setConnectionHandler(ch); + #if defined(ESP32) + if(cloud != NULL) + cloud->setConnectionHandler(ch); + #endif } else { setupMode = false; toggleSetupMode();