From 7c5a1b1fb83eb078f3da4e1e65401f4354e35112 Mon Sep 17 00:00:00 2001 From: david-beinder Date: Mon, 1 May 2023 17:47:46 +0200 Subject: [PATCH] Add option to disable 802.11b data rates --- .../include/AmsConfiguration.h | 2 +- lib/AmsConfiguration/src/AmsConfiguration.cpp | 5 +++-- lib/SvelteUi/app/dist/index.css | 2 +- lib/SvelteUi/app/dist/index.js | 18 +++++++-------- .../app/src/lib/ConfigurationPanel.svelte | 5 ++++- lib/SvelteUi/json/conf_wifi.json | 3 ++- lib/SvelteUi/src/AmsWebServer.cpp | 11 +++++++--- src/AmsToMqttBridge.cpp | 22 +++++++++++++++++-- 8 files changed, 48 insertions(+), 20 deletions(-) diff --git a/lib/AmsConfiguration/include/AmsConfiguration.h b/lib/AmsConfiguration/include/AmsConfiguration.h index 00f1f469..0fd9fc98 100644 --- a/lib/AmsConfiguration/include/AmsConfiguration.h +++ b/lib/AmsConfiguration/include/AmsConfiguration.h @@ -47,7 +47,7 @@ struct WiFiConfig { bool mdns; uint8_t power; uint8_t sleep; - uint8_t mode; + uint8_t use11b; bool autoreboot; }; // 213 diff --git a/lib/AmsConfiguration/src/AmsConfiguration.cpp b/lib/AmsConfiguration/src/AmsConfiguration.cpp index 9752b009..f1b3f8bf 100644 --- a/lib/AmsConfiguration/src/AmsConfiguration.cpp +++ b/lib/AmsConfiguration/src/AmsConfiguration.cpp @@ -56,7 +56,7 @@ bool AmsConfiguration::setWiFiConfig(WiFiConfig& config) { wifiChanged |= strcmp(config.hostname, existing.hostname) != 0; wifiChanged |= config.power != existing.power; wifiChanged |= config.sleep != existing.sleep; - wifiChanged |= config.mode != existing.mode; + wifiChanged |= config.use11b != existing.use11b; wifiChanged |= config.autoreboot != existing.autoreboot; } else { wifiChanged = true; @@ -94,6 +94,7 @@ void AmsConfiguration::clearWifi(WiFiConfig& config) { strcpy(config.hostname, (String("ams-") + String(chipId, HEX)).c_str()); config.mdns = true; config.sleep = 0xFF; + config.use11b = 1; } void AmsConfiguration::clearWifiIp(WiFiConfig& config) { @@ -1002,7 +1003,7 @@ bool AmsConfiguration::relocateConfig96() { WiFiConfig wifi; EEPROM.get(CONFIG_WIFI_START, wifi); - wifi.mode = 1; // WIFI_STA + wifi.use11b = 1; wifi.autoreboot = true; EEPROM.put(CONFIG_WIFI_START, wifi); diff --git a/lib/SvelteUi/app/dist/index.css b/lib/SvelteUi/app/dist/index.css index d3b8ffcc..b9318ec8 100644 --- a/lib/SvelteUi/app/dist/index.css +++ b/lib/SvelteUi/app/dist/index.css @@ -1 +1 @@ -/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{inset:0}.z-40{z-index:40}.z-50{z-index:50}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-bottom:.25rem;margin-top:.25rem}.my-2{margin-bottom:.5rem;margin-top:.5rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.mb-1{margin-bottom:.25rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-4{margin-left:1rem}.mr-3{margin-right:.75rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-6{height:1.5rem}.h-64{height:16rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.w-full{width:100%}.flex-auto{flex:1 1 auto}.flex-none{flex:none}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pb-4{padding-bottom:1rem}.pl-1{padding-left:.25rem}.pr-1{padding-right:.25rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.gh-logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;min-height:268px;padding:.5rem}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px}.in-post,.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}.in-post{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem;border-width:1px 1px 1px 0}.in-post,.in-txt{border-color:rgb(209 213 219/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(34 197 94/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(234 179 8/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(239 68 68/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(59 130 246/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.btn-pri{padding:.5rem 1rem}.btn-pri,.btn-pri-sm{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem}.btn-pri-sm{font-size:.75rem;line-height:1rem;padding:.25rem .5rem}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{font-family:Helvetica,Arial;font-size:.85em;font-weight:200}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#32d900!important}.tick.tick-green text{fill:#32d900!important}.tick.tick-orange line{stroke:#d95600!important}.tick.tick-orange text{fill:#d95600!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} +/*! tailwindcss v3.1.8 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}html{-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[multiple],[type=date],[type=datetime-local],[type=email],[type=month],[type=number],[type=password],[type=search],[type=tel],[type=text],[type=time],[type=url],[type=week],select,textarea{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-radius:0;border-width:1px;font-size:1rem;line-height:1.5rem;padding:.5rem .75rem}[multiple]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=email]:focus,[type=month]:focus,[type=number]:focus,[type=password]:focus,[type=search]:focus,[type=tel]:focus,[type=text]:focus,[type=time]:focus,[type=url]:focus,[type=week]:focus,select:focus,textarea:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);border-color:#2563eb;box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}input::-moz-placeholder,textarea::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder,textarea::placeholder{color:#6b7280;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-year-field{padding-bottom:0;padding-top:0}select{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:none;background-position:0 0;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{--tw-shadow:0 0 #0000;-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;background-origin:border-box;border-color:#6b7280;border-width:1px;color:#2563eb;display:inline-block;flex-shrink:0;height:1rem;padding:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1rem}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid transparent;outline-offset:2px}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E")}[type=radio]:checked{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 16 16' fill='%23fff' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E")}[type=checkbox]:checked:focus,[type=checkbox]:checked:hover,[type=radio]:checked:focus,[type=radio]:checked:hover{background-color:currentColor;border-color:transparent}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:transparent}[type=checkbox]:indeterminate:focus,[type=checkbox]:indeterminate:hover{background-color:currentColor;border-color:transparent}[type=file]{background:unset;border-color:inherit;border-radius:0;border-width:0;font-size:unset;line-height:inherit;padding:0}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.static{position:static}.fixed{position:fixed}.inset-0{bottom:0;left:0;right:0;top:0}.z-50{z-index:50}.z-40{z-index:40}.col-span-2{grid-column:span 2/span 2}.float-right{float:right}.clear-both{clear:both}.m-3{margin:.75rem}.m-1{margin:.25rem}.m-2{margin:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-1{margin-bottom:.25rem;margin-top:.25rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.my-3{margin-bottom:.75rem;margin-top:.75rem}.my-auto{margin-bottom:auto;margin-top:auto}.my-2{margin-bottom:.5rem;margin-top:.5rem}.mx-3{margin-left:.75rem;margin-right:.75rem}.mb-3{margin-bottom:.75rem}.mb-1{margin-bottom:.25rem}.mt-2{margin-top:.5rem}.ml-3{margin-left:.75rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.mr-3{margin-right:.75rem}.mt-3{margin-top:.75rem}.mb-4{margin-bottom:1rem}.mt-4{margin-top:1rem}.mt-1{margin-top:.25rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.h-64{height:16rem}.h-6{height:1.5rem}.w-full{width:100%}.w-1\/2{width:50%}.w-1\/4{width:25%}.w-3\/4{width:75%}.w-1\/3{width:33.333333%}.w-40{width:10rem}.w-6{width:1.5rem}.w-96{width:24rem}.flex-none{flex:none}.flex-auto{flex:1 1 auto}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row-reverse{flex-direction:row-reverse}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity))}.bg-violet-600{--tw-bg-opacity:1;background-color:rgb(124 58 237/var(--tw-bg-opacity))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-opacity-50{--tw-bg-opacity:.5}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.pr-1{padding-right:.25rem}.pl-1{padding-left:.25rem}.pb-4{padding-bottom:1rem}.text-center{text-align:center}.text-right{text-align:right}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.text-gray-100{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.gh-logo{height:2rem;width:2rem}.cnt{--tw-bg-opacity:1;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);background-color:rgb(255 255 255/var(--tw-bg-opacity));border-radius:.25rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);margin:.5rem;min-height:268px;padding:.5rem}.gwf{height:16rem}@media (min-width:640px){.gwf{grid-column:span 2/span 2}}@media (min-width:768px){.gwf{grid-column:span 3/span 3}}@media (min-width:1024px){.gwf{grid-column:span 4/span 4}}@media (min-width:1280px){.gwf{grid-column:span 5/span 5}}@media (min-width:1536px){.gwf{grid-column:span 6/span 6}}.in-pre{border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;border-width:1px 0 1px 1px}.in-post,.in-pre{--tw-border-opacity:1;--tw-bg-opacity:1;align-items:center;background-color:rgb(243 244 246/var(--tw-bg-opacity));display:flex;font-size:.875rem;line-height:1.25rem;padding-left:.75rem;padding-right:.75rem;white-space:nowrap}.in-post{border-bottom-right-radius:.375rem;border-top-right-radius:.375rem;border-width:1px 1px 1px 0}.in-post,.in-txt{border-color:rgb(209 213 219/var(--tw-border-opacity))}.in-txt{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-txt:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-f{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-left-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-top-left-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-f:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-m{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-m:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-l{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-bottom-right-radius:.375rem;border-color:rgb(209 213 219/var(--tw-border-opacity));border-left-width:0;border-top-right-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem}.in-l:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.in-s{--tw-border-opacity:1;--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);border-color:rgb(209 213 219/var(--tw-border-opacity));border-radius:.375rem;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);height:2.5rem;width:100%}.in-s:disabled{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.tr{text-align:right}.bd-green{background-color:rgb(34 197 94/var(--tw-bg-opacity));color:rgb(220 252 231/var(--tw-text-opacity))}.bd-green,.bd-yellow{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-yellow{background-color:rgb(234 179 8/var(--tw-bg-opacity));color:rgb(254 249 195/var(--tw-text-opacity))}.bd-red{background-color:rgb(239 68 68/var(--tw-bg-opacity));color:rgb(254 226 226/var(--tw-text-opacity))}.bd-blue,.bd-red{--tw-bg-opacity:1;--tw-text-opacity:1;border-radius:.25rem;font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.bd-blue{background-color:rgb(59 130 246/var(--tw-bg-opacity));color:rgb(219 234 254/var(--tw-text-opacity))}.bd-gray{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(243 244 246/var(--tw-text-opacity));font-size:.75rem;font-weight:600;line-height:1rem;margin-bottom:auto;margin-right:.5rem;margin-top:auto;padding:.125rem .625rem}.btn-pri{padding:.5rem 1rem}.btn-pri,.btn-pri-sm{--tw-bg-opacity:1;--tw-text-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity));border-radius:.25rem;color:rgb(255 255 255/var(--tw-text-opacity));margin-right:.75rem}.btn-pri-sm{font-size:.75rem;line-height:1rem;padding:.25rem .5rem}.pl-root{position:relative}.pl-ov{left:25%;position:absolute;text-align:center;top:27%;width:50%}.pl-val{font-size:1.7rem}.pl-unt{color:gray;font-size:1rem}.pl-sub{font-size:1rem;padding-top:10px}.pl-snt{color:gray;font-size:.7rem}.pl-lab{font-size:1rem}.chart{height:100%;margin:0 auto;width:100%}svg{position:relative;width:100%}.tick{font-family:Helvetica,Arial;font-size:.85em;font-weight:200}.tick line{stroke:#e2e2e2;stroke-dasharray:2}.tick text{fill:#999;text-anchor:start}.tick.tick-0 line{stroke-dasharray:0}.tick.tick-green line{stroke:#32d900!important}.tick.tick-green text{fill:#32d900!important}.tick.tick-orange line{stroke:#d95600!important}.tick.tick-orange text{fill:#d95600!important}.x-axis .tick text{text-anchor:middle}.bars rect{stroke:#000;stroke-opacity:.25;opacity:.9}.bars text{display:block;font-family:Helvetica,Arial;font-size:.85em;text-align:center}.hover\:text-blue-800:hover{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity))}@media (min-width:640px){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (min-width:768px){.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1024px){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (min-width:1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}}@media (min-width:1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}} diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index e9f24b4d..e1b7daa3 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,14 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).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 ne(){}function Jt(t,e){for(const l in e)t[l]=e[l];return t}function Gf(t){return t()}function Pr(){return Object.create(null)}function Ve(t){t.forEach(Gf)}function io(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let as;function qc(t,e){return as||(as=document.createElement("a")),as.href=e,t===as.href}function Hc(t){return Object.keys(t).length===0}function so(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function si(t){let e;return so(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(so(e,l))}function oo(t,e,l,n){if(t){const i=Bf(t,e,l,n);return t[0](i)}}function Bf(t,e,l,n){return t[1]&&n?Jt(l.ctx.slice(),t[1](n(e))):l.ctx}function uo(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function ks(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const Wc=["width","height"];function oi(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&Wc.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function ae(t){return t===""?null:+t}function Gc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.data!==e&&(t.data=e)}function Bc(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function zc(t,e,l){~jc.indexOf(l)?Bc(t,e):B(t,e)}function V(t,e){t.value=e==null?"":e}function zf(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Le(t,e,l){for(let n=0;n{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Kc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Nr(t,e){return new t(e)}let yi;function ki(t){yi=t}function Ci(){if(!yi)throw new Error("Function called outside component initialization");return yi}function Qc(t){Ci().$$.on_mount.push(t)}function Xc(t){Ci().$$.on_destroy.push(t)}function Zc(){const t=Ci();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Kc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Ci().$$.context.set(t,e),e}function Rl(t){return Ci().$$.context.get(t)}const ti=[],vs=[];let li=[];const Mr=[],Yf=Promise.resolve();let Ys=!1;function Vf(){Ys||(Ys=!0,Yf.then(Kf))}function Jc(){return Vf(),Yf}function tt(t){li.push(t)}const Hs=new Set;let xn=0;function Kf(){if(xn!==0)return;const t=yi;do{try{for(;xnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),li=e}const ps=new Set;let tn;function Te(){tn={r:0,c:[],p:tn}}function Se(){tn.r||Ve(tn.c),tn=tn.p}function N(t,e){t&&t.i&&(ps.delete(t),t.i(e))}function D(t,e,l,n){if(t&&t.o){if(ps.has(t))return;ps.add(t),tn.c.push(()=>{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Qf(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Ar(t){return typeof t=="object"&&t!==null?t:{}}function J(t){t&&t.c()}function X(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||tt(()=>{const r=t.$$.on_mount.map(Gf).filter(io);t.$$.on_destroy?t.$$.on_destroy.push(...r):Ve(r),t.$$.on_mount=[]}),o.forEach(tt)}function Z(t,e){const l=t.$$;l.fragment!==null&&(e1(l.after_update),Ve(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function t1(t,e){t.$$.dirty[0]===-1&&(ti.push(t),Vf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=d.length?d[0]:b;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&t1(t,_)),b}):[],c.update(),p=!0,Ve(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Gc(e.target);c.fragment&&c.fragment.l(_),_.forEach(w)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),X(t,e.target,e.anchor,e.customElement),Kf()}ki(f)}class Ce{$destroy(){Z(this,1),this.$destroy=ne}$on(e,l){if(!io(l))return ne;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Hc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Dr=t=>typeof t>"u",Xf=t=>typeof t=="function",Zf=t=>typeof t=="number";function l1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Jf(){let t=0;return()=>t++}function n1(){return Math.random().toString(36).substring(2)}const Ll=typeof window>"u";function xf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const ec=(t,e)=>t?{}:{style:e},Vs=t=>({"aria-hidden":"true",...ec(t,"display:none;")}),ei=[];function tc(t,e){return{subscribe:ut(t,e).subscribe}}function ut(t,e=ne){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const f=!ei.length;for(const c of n)c[1](),ei.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function i1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return tc(l,r=>{let a=!1;const f=[];let c=0,p=ne;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,r);o?r(d):p=io(d)?d:ne},b=i.map((d,v)=>so(d,g=>{f[v]=g,c&=~(1<{c|=1<`@@svnav-ctx__${t}`,Ks=$i("LOCATION"),ui=$i("ROUTER"),lc=$i("ROUTE"),s1=$i("ROUTE_PARAMS"),o1=$i("FOCUS_ELEM"),nc=/^:(.+)/,gi=(t,e,l)=>t.substr(e,l),Qs=(t,e)=>gi(t,0,e.length)===e,u1=t=>t==="",r1=t=>nc.test(t),ic=t=>t[0]==="*",a1=t=>t.replace(/\*.*$/,""),sc=t=>t.replace(/(^\/+|\/+$)/g,"");function cl(t,e=!1){const l=sc(t).split("/");return e?l.filter(Boolean):l}const js=(t,e)=>t+(e?`?${e}`:""),fo=t=>`/${sc(t)}`;function Ti(...t){const e=n=>cl(n,!0).join("/"),l=t.map(e).join("/");return fo(l)}const co=1,ws=2,on=3,f1=4,oc=5,c1=6,uc=7,m1=8,p1=9,rc=10,ac=11,_1={[co]:"Link",[ws]:"Route",[on]:"Router",[f1]:"useFocus",[oc]:"useLocation",[c1]:"useMatch",[uc]:"useNavigate",[m1]:"useParams",[p1]:"useResolvable",[rc]:"useResolve",[ac]:"navigate"},mo=t=>_1[t];function d1(t,e){let l;return t===ws?l=e.path?`path="${e.path}"`:"default":t===co?l=`to="${e.to}"`:t===on&&(l=`basepath="${e.basepath||""}"`),`<${mo(t)} ${l||""} />`}function v1(t,e,l,n){const i=l&&d1(n||t,l),o=i?` +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).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 ne(){}function Jt(t,e){for(const l in e)t[l]=e[l];return t}function Qf(t){return t()}function Er(){return Object.create(null)}function Ve(t){t.forEach(Qf)}function Xf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ms;function Bc(t,e){return ms||(ms=document.createElement("a")),ms.href=e,t===ms.href}function zc(t){return Object.keys(t).length===0}function ao(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function oi(t){let e;return ao(t,l=>e=l)(),e}function rl(t,e,l){t.$$.on_destroy.push(ao(e,l))}function fo(t,e,l,n){if(t){const i=Zf(t,e,l,n);return t[0](i)}}function Zf(t,e,l,n){return t[1]&&n?Jt(l.ctx.slice(),t[1](n(e))):l.ctx}function co(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ts(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function al(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ae(t){return t===""?null:+t}function Yc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function V(t,e){t.value=e==null?"":e}function Jf(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e){for(let l=0;l{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Qc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let yi;function ki(t){yi=t}function Ci(){if(!yi)throw new Error("Function called outside component initialization");return yi}function Xc(t){Ci().$$.on_mount.push(t)}function Zc(t){Ci().$$.on_destroy.push(t)}function Jc(){const t=Ci();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Qc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Ci().$$.context.set(t,e),e}function ql(t){return Ci().$$.context.get(t)}const bi=[],ws=[],hs=[],Fr=[],xf=Promise.resolve();let Zs=!1;function ec(){Zs||(Zs=!0,xf.then(tc))}function xc(){return ec(),xf}function tt(t){hs.push(t)}const zs=new Set;let _s=0;function tc(){const t=yi;do{for(;_s{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ui(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Rr(t){return typeof t=="object"&&t!==null?t:{}}function J(t){t&&t.c()}function X(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:r,after_update:a}=t.$$;i&&i.m(e,l),n||tt(()=>{const f=o.map(Qf).filter(Xf);r?r.push(...f):Ve(f),t.$$.on_mount=[]}),a.forEach(tt)}function Z(t,e){const l=t.$$;l.fragment!==null&&(Ve(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function t1(t,e){t.$$.dirty[0]===-1&&(bi.push(t),ec(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=d.length?d[0]:b;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&t1(t,_)),b}):[],c.update(),p=!0,Ve(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Yc(e.target);c.fragment&&c.fragment.l(_),_.forEach(w)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),X(t,e.target,e.anchor,e.customElement),tc()}ki(f)}class Ce{$destroy(){Z(this,1),this.$destroy=ne}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!zc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Lr=t=>typeof t>"u",lc=t=>typeof t=="function",nc=t=>typeof t=="number";function l1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ic(){let t=0;return()=>t++}function n1(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function sc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Js=(t,e)=>t?{}:{style:e},ni=t=>({"aria-hidden":"true",...Js(t,"display:none;")}),li=[];function oc(t,e){return{subscribe:rt(t,e).subscribe}}function rt(t,e=ne){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const f=!li.length;for(const c of n)c[1](),li.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function i1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return oc(l,r=>{let a=!1;const f=[];let c=0,p=ne;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,r);o?r(d):p=Xf(d)?d:ne},b=i.map((d,v)=>ao(d,g=>{f[v]=g,c&=~(1<{c|=1<`@@svnav-ctx__${t}`,xs=$i("LOCATION"),ri=$i("ROUTER"),uc=$i("ROUTE"),s1=$i("ROUTE_PARAMS"),o1=$i("FOCUS_ELEM"),rc=/^:(.+)/,gi=(t,e,l)=>t.substr(e,l),eo=(t,e)=>gi(t,0,e.length)===e,u1=t=>t==="",r1=t=>rc.test(t),ac=t=>t[0]==="*",a1=t=>t.replace(/\*.*$/,""),fc=t=>t.replace(/(^\/+|\/+$)/g,"");function pl(t,e=!1){const l=fc(t).split("/");return e?l.filter(Boolean):l}const Ys=(t,e)=>t+(e?`?${e}`:""),_o=t=>`/${fc(t)}`;function Ti(...t){const e=n=>pl(n,!0).join("/"),l=t.map(e).join("/");return _o(l)}const vo=1,Ss=2,cn=3,f1=4,cc=5,c1=6,mc=7,m1=8,p1=9,pc=10,_c=11,_1={[vo]:"Link",[Ss]:"Route",[cn]:"Router",[f1]:"useFocus",[cc]:"useLocation",[c1]:"useMatch",[mc]:"useNavigate",[m1]:"useParams",[p1]:"useResolvable",[pc]:"useResolve",[_c]:"navigate"},ho=t=>_1[t];function d1(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===vo?l=`to="${e.to}"`:t===cn&&(l=`basepath="${e.basepath||""}"`),`<${ho(t)} ${l||""} />`}function v1(t,e,l,n){const i=l&&d1(n||t,l),o=i?` -Occurred in: ${i}`:"",r=mo(t),a=Xf(e)?e(r):e;return`<${r}> ${a}${o}`}const fc=t=>(...e)=>t(v1(...e)),cc=fc(t=>{throw new Error(t)}),hs=fc(console.warn),Er=4,h1=3,b1=2,g1=1,k1=1;function w1(t,e){const l=t.default?0:cl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Er,u1(i)?o+=k1:r1(i)?o+=b1:ic(i)?o-=Er+g1:o+=h1,o},0);return{route:t,score:l,index:e}}function y1(t){return t.map(w1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function mc(t,e){let l,n;const[i]=e.split("?"),o=cl(i),r=o[0]==="",a=y1(t);for(let f=0,c=a.length;f({...p,params:b,uri:$});if(p.default){n=d(e);continue}const v=cl(p.fullPath),g=Math.max(o.length,v.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),js(`/${f.join("/")}`,n)}function Ir(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=cl(e,!0),a=cl(l,!0);for(;r.length;)r[0]!==a[0]&&cc(on,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Ti(...a),hash:n,search:i,state:o}}const Fr=t=>t.length===1?"":t,po=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Fr(gi(t,l)):"",r=i?gi(t,0,l):t,a=n?Fr(gi(r,e)):"";return{pathname:(n?gi(r,0,e):r)||"/",search:a,hash:o}},$1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function T1(t,e,l){return Ti(l,C1(t,e))}function S1(t,e){const l=fo(a1(t)),n=cl(l,!0),i=cl(e,!0).slice(0,n.length),o=pc({fullPath:l},Ti(...i));return o&&o.uri}const Ws="POP",P1="PUSH",N1="REPLACE";function Gs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function M1(t){let e=[],l=Gs(t),n=Ws;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Gs(t),n=Ws,i([o])};i([o]);const a=xf(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?N1:P1,Zf(o))r&&hs(ac,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ws,t.history.go(o);else{const c={...a,_key:n1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Gs(t),i()}}}function Bs(t,e){return{...po(e),state:t}}function A1(t="/"){let e=0,l=[Bs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Bs(n,o))},replaceState(n,i,o){l[e]=Bs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const D1=!!(!Ll&&window.document&&window.document.createElement),E1=!Ll&&window.location.origin==="null",_c=M1(D1&&!E1?window:A1()),{navigate:ni}=_c;let Tl=null,dc=!0;function I1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&I1(t.routerId,Tl.routerId))&&(Tl=t)}function R1(){Tl=null}function L1(){dc=!1}function Rr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=xf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function U1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function O1(t){return/^H[1-6]$/i.test(t.tagName)}function Lr(t,e=document){return e.querySelector(t)}function q1(t){let l=Lr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!U1(l,t);){if(O1(l))return l;const n=Lr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function H1(t){Promise.resolve(si(t.focusElement)).then(e=>{const l=e||q1(t.id);l||hs(on,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ws),!Rr(l)&&Rr(document.documentElement)})}const j1=(t,e,l)=>(n,i)=>Jc().then(()=>{if(!Tl||dc){L1();return}if(n&&H1(Tl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Tl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},si(l));Promise.resolve(p).then(_=>{e.set(_)})}R1()}),W1="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 G1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},ec(t[6],W1)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...v},$=p,T=fo(p),P=Rl(Ks),E=Rl(ui),S=!P,A=z1(),I=d&&!(E&&!E.manageFocus),F=ut("");ul(t,F,le=>l(0,a=le));const Y=E?E.disableInlineStyles:g,U=ut([]);ul(t,U,le=>l(20,r=le));const R=ut(null);ul(t,R,le=>l(18,i=le));let q=!1;const z=S?0:E.level+1,H=S?ut((()=>Ir(Ll?po(_):b.location,T))()):P;ul(t,H,le=>l(17,n=le));const G=ut(n);ul(t,G,le=>l(19,o=le));const L=j1(k,F,H),W=le=>de=>de.filter(ie=>ie.id!==le);function j(le){if(Ll){if(q)return;const de=pc(le,n.pathname);if(de)return q=!0,de}else U.update(de=>{const ie=W(le.id)(de);return ie.push(le),ie})}function te(le){U.update(W(le))}return!S&&p!==Ur&&hs(on,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(Qc(()=>b.listen(de=>{const ie=Ir(de.location,T);G.set(n),H.set(ie)})),wi(Ks,H)),wi(ui,{activeRoute:R,registerRoute:j,unregisterRoute:te,manageFocus:I,level:z,id:A,history:S?b:E.history,basepath:S?T:E.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&hs(on,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=mc(r,n.pathname);R.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,de=!le&&I,ie=!le||n.pathname!==o.pathname;L(de,ie)}t.$$.dirty[0]&262144&&I&&i&&i.primary&&F1({level:z,routerId:A,route:i})},[a,k,S,A,I,F,Y,U,R,H,G,p,_,b,d,v,g,n,i,o,r,c,f]}class V1 extends Ce{constructor(e){super(),ye(this,e,Y1,B1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const vc=V1;function Si(t,e,l=ui,n=on){Rl(l)||cc(t,o=>`You cannot use ${o} outside of a ${mo(n)}.`,e)}const K1=t=>{const{subscribe:e}=Rl(t);return{subscribe:e}};function hc(){return Si(oc),K1(Ks)}function bc(){const{history:t}=Rl(ui);return t}function gc(){const t=Rl(lc);return t?i1(t,e=>e.base):ut("/")}function kc(){Si(rc);const t=gc(),{basepath:e}=Rl(ui);return n=>T1(n,si(t),e)}function Q1(){Si(uc);const t=kc(),{navigate:e}=bc();return(n,i)=>{const o=Zf(n)?n:t(n);return e(o,i)}}const X1=t=>({params:t&16,location:t&8}),Or=t=>({params:Ll?si(t[10]):t[4],location:t[3],navigate:t[11]});function qr(t){let e,l;return e=new vc({props:{primary:t[1],$$slots:{default:[x1]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Z1(t){let e;const l=t[18].default,n=oo(l,t,t[19],Or);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&ro(n,l,i,i[19],e?uo(l,i[19],o,X1):ao(i[19]),Or)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function J1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ll?si(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c{Z(p,1)}),Se()}o?(e=Nr(o,r()),J(e.$$.fragment),N(e.$$.fragment,1),X(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&Z(e,a)}}}function x1(t){let e,l,n,i;const o=[J1,Z1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function em(t){let e,l,n,i,o,r=[Vs(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{f=null}),Se())},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&w(e),_&&w(l),f&&f.d(_),_&&w(n),_&&w(i)}}}const tm=Jf();function lm(t,e,l){let n;const i=["path","component","meta","primary"];let o=ds(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Si(ws,e);const k=tm(),{registerRoute:$,unregisterRoute:T,activeRoute:P,disableInlineStyles:E}=Rl(ui);ul(t,P,q=>l(16,r=q));const S=gc();ul(t,S,q=>l(17,f=q));const A=hc();ul(t,A,q=>l(3,a=q));const I=ut(null);let F;const Y=ut(),U=ut({});ul(t,U,q=>l(4,c=q)),wi(lc,Y),wi(s1,U),wi(o1,I);const R=Q1();return Ll||Xc(()=>T(k)),t.$$set=q=>{l(24,e=Jt(Jt({},e),_s(q))),l(12,o=ds(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Ti(f,b),O={id:k,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:S1(z,a.pathname),primary:g,focusElement:I};Y.set(O),l(15,F=$(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===k)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=_s(e),[d,g,n,a,c,k,P,E,S,A,U,R,o,b,v,F,r,f,p,_]}class nm extends Ce{constructor(e){super(),ye(this,e,lm,em,ke,{path:13,component:0,meta:14,primary:1})}}const $l=nm;function im(t){let e,l,n,i;const o=t[13].default,r=oo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=I));const P=Zc(),E=kc(),{navigate:S}=bc();function A(I){P("click",I),l1(I)&&(I.preventDefault(),S(n,{state:k,replace:r||g}))}return t.$$set=I=>{l(19,e=Jt(Jt({},e),_s(I))),l(18,p=ds(e,c)),"to"in I&&l(5,v=I.to),"replace"in I&&l(6,g=I.replace),"state"in I&&l(7,k=I.state),"getProps"in I&&l(8,$=I.getProps),"$$scope"in I&&l(12,d=I.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(v,_)),t.$$.dirty&2049&&l(10,i=Qs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=po(n)===$1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Xf($)){const I=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...I}}return p})())},e=_s(e),[n,f,a,T,A,v,g,k,$,o,i,_,d,b]}class om extends Ce{constructor(e){super(),ye(this,e,sm,im,ke,{to:5,replace:6,state:7,getProps:8})}}const Fl=om;let Xs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Il(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function um(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function wc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function rm(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function bs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Ee(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 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"}}function Hr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function jr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Wr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ii(t){switch(t){case 2:case 4:case 7:return!0}return!1}function ze(t,e){return t==1||t==2&&e}function Lt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ce(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function rl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Gr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Ul(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ol={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};const Ut=ut(ol);async function _o(){ol=await(await Ul("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ut.set(ol)}let cs=0,Br=-127,zr=null,am={};const fm=tc(am,t=>{let e;async function l(){Ul("/data.json").then(n=>n.json()).then(n=>{t(n),Br!=n.t&&(Br=n.t,setTimeout(Tc,2e3)),zr!=n.p&&n.pe&&(zr=n.p,setTimeout(cm,1e3)),ol.upgrading?window.location.reload():(!ol||!ol.chip||ol.booting||cs>1&&!ii(ol.board))&&(_o(),ln&&clearTimeout(ln),ln=setTimeout(vo,2e3),nn&&clearTimeout(nn),nn=setTimeout(ho,3e3));let i=5e3;if(ii(ol.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),cs=0}).catch(n=>{cs++,cs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ii(ol.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Zs={};const yc=ut(Zs);async function cm(){Zs=await(await Ul("/energyprice.json")).json(),yc.set(Zs)}let Js={},ln;async function vo(){ln&&(clearTimeout(ln),ln=0),Js=await(await Ul("/dayplot.json")).json(),Cc.set(Js);let e=new Date;ln=setTimeout(vo,(60-e.getMinutes())*6e4+20)}const Cc=ut(Js,t=>(vo(),function(){}));let xs={},nn;async function ho(){nn&&(clearTimeout(nn),nn=0),xs=await(await Ul("/monthplot.json")).json(),$c.set(xs);let e=new Date;nn=setTimeout(ho,(24-e.getHours())*36e5+40)}const $c=ut(xs,t=>(ho(),function(){}));let eo={};async function Tc(){eo=await(await Ul("/temperature.json")).json(),Sc.set(eo)}const Sc=ut(eo,t=>(Tc(),function(){}));let to={},ms;async function Pc(){ms&&(clearTimeout(ms),ms=0),to=await(await Ul("/tariff.json")).json(),Nc.set(to);let e=new Date;ms=setTimeout(Pc,(60-e.getMinutes())*6e4+30)}const Nc=ut(to,t=>function(){});let lo=[];const bo=ut(lo);async function mm(){lo=await(await Ul("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),bo.set(lo)}function gs(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Mc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Ac(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;po&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let $=c.tag_name.substring(1).split(".");parseInt($[0]);let T=parseInt($[1]);parseInt($[2]),g==T&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const pm="/github.svg";function Yr(t){let e,l;function n(r,a){return r[1]>1?km:r[1]>0?gm:r[2]>1?bm:r[2]>0?hm:r[3]>1?vm:r[3]>0?dm:_m}let i=n(t),o=i(t);return{c(){e=C(`Up - `),o.c(),l=We()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function _m(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function dm(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function vm(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function hm(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function bm(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function gm(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function km(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function wm(t){let e,l=t[0]&&Yr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Yr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function ym(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class Cm extends Ce{constructor(e){super(),ye(this,e,ym,wm,ke,{epoch:0})}}function $m(t){let e,l,n;return{c(){e=m("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&w(e)}}}function Tm(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class al extends Ce{constructor(e){super(),ye(this,e,Tm,$m,ke,{color:0,title:1,text:2})}}function Sm(t){let e,l=`${Ee(t[0].getDate())}.${Ee(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ee(i[0].getDate())}.${Ee(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ee(i[0].getHours())}:${Ee(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function Pm(t){let e=`${Ee(t[0].getDate())}. ${Xs[t[0].getMonth()]} ${Ee(t[0].getHours())}:${Ee(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${Ee(n[0].getDate())}. ${Xs[n[0].getMonth()]} ${Ee(n[0].getHours())}:${Ee(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function Nm(t){let e;function l(o,r){return o[2]?Pm:Sm}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&w(e)}}}function Mm(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||rl(n,o-(n.getHours()-n.getUTCHours())%24))},[n,i,r,o]}class Dc extends Ce{constructor(e){super(),ye(this,e,Mm,Nm,ke,{timestamp:0,fullTimeColor:1,offset:3})}}function Am(t){let e,l,n;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&w(e)}}}class Dm extends Ce{constructor(e){super(),ye(this,e,null,Am,ke,{})}}function Em(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Im extends Ce{constructor(e){super(),ye(this,e,null,Em,ke,{})}}function Fm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Rt extends Ce{constructor(e){super(),ye(this,e,null,Fm,ke,{})}}function Rm(t){let e,l;return{c(){e=qe("svg"),l=qe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Ec extends Ce{constructor(e){super(),ye(this,e,null,Rm,ke,{})}}function Lm(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=m("span"),i=C(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function Vr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function Kr(t){let e,l="HAN: "+Hr(t[0].he),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Hr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function Qr(t){let e,l="MQTT: "+jr(t[0].me),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+jr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function Xr(t){let e,l="PriceAPI: "+Wr(t[0].ee),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Wr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function Zr(t){let e,l,n,i,o,r;return l=new Fl({props:{to:"/configuration",$$slots:{default:[Um]},$$scope:{ctx:t}}}),o=new Fl({props:{to:"/status",$$slots:{default:[Om]},$$scope:{ctx:t}}}),{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),X(l,e,null),y(a,n,f),y(a,i,f),X(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){D(l.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&w(e),Z(l),a&&w(n),a&&w(i),Z(o)}}}function Um(t){let e,l;return e=new Dm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Om(t){let e,l;return e=new Im({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jr(t){let e,l,n,i,o;const r=[Hm,qm],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){y(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Te(),D(a[_],1,1,()=>{a[_]=null}),Se(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){D(n),o=!1},d(c){c&&w(e),a[l].d()}}}function qm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=C("New version: "),i=C(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ne,o:ne,d(o){o&&w(e)}}}function Hm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new Ec({}),{c(){e=m("button"),l=m("span"),n=C("New version: "),o=C(i),r=h(),J(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,b){y(_,e,b),s(e,l),s(l,n),s(l,o),s(e,r),X(a,e,null),f=!0,c||(p=K(e,"click",t[3]),c=!0)},p(_,b){(!f||b&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){f||(N(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&w(e),Z(a),c=!1,p()}}}function jm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Fe;i=new Fl({props:{to:"/",$$slots:{default:[Lm]},$$scope:{ctx:t}}}),f=new Cm({props:{epoch:t[0].u}});let ve=t[0].t>-50&&Vr(t);T=new al({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Il(t[1].booting?2:t[0].em)}}),E=new al({props:{title:"HAN",text:"HAN",color:Il(t[1].booting?9:t[0].hm)}}),A=new al({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Il(t[1].booting?9:t[0].wm)}}),F=new al({props:{title:"MQTT",text:"MQTT",color:Il(t[1].booting?9:t[0].mm)}});let Pe=(t[0].he<0||t[0].he>0)&&Kr(t),De=t[0].me<0&&Qr(t),me=(t[0].ee>0||t[0].ee<0)&&Xr(t);te=new Dc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&Zr(t);Ie=new Rt({});let pe=t[1].fwconsent===1&&t[2]&&Jr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=m("div"),J(f.$$.fragment),c=h(),ve&&ve.c(),p=h(),_=m("div"),b=C("Free mem: "),v=C(d),g=C("kb"),k=h(),$=m("div"),J(T.$$.fragment),P=h(),J(E.$$.fragment),S=h(),J(A.$$.fragment),I=h(),J(F.$$.fragment),Y=h(),Pe&&Pe.c(),U=h(),De&&De.c(),R=h(),me&&me.c(),q=h(),z=m("div"),O=m("div"),H=m("a"),G=m("img"),W=h(),j=m("div"),J(te.$$.fragment),le=h(),se&&se.c(),de=h(),ie=m("div"),we=m("a"),J(Ie.$$.fragment),$e=h(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u($,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),qc(G.src,L=pm)||u(G,"src",L),u(G,"alt","GitHub repo"),u(H,"class","float-right"),u(H,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(H,"target","_blank"),u(H,"rel","noreferrer"),u(H,"aria-label","GitHub"),u(O,"class","flex-none"),u(j,"class","flex-none my-auto px-2"),u(we,"href",Lt("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(z,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(Q,oe){y(Q,e,oe),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,a),X(f,a,null),s(r,c),ve&&ve.m(r,null),s(r,p),s(r,_),s(_,b),s(_,v),s(_,g),s(l,k),s(l,$),X(T,$,null),s($,P),X(E,$,null),s($,S),X(A,$,null),s($,I),X(F,$,null),s(l,Y),Pe&&Pe.m(l,null),s(l,U),De&&De.m(l,null),s(l,R),me&&me.m(l,null),s(l,q),s(l,z),s(z,O),s(O,H),s(H,G),s(z,W),s(z,j),X(te,j,null),s(z,le),se&&se.m(z,null),s(z,de),s(z,ie),s(ie,we),X(Ie,we,null),s(z,$e),pe&&pe.m(z,null),Fe=!0},p(Q,[oe]){const Ne={};oe&18&&(Ne.$$scope={dirty:oe,ctx:Q}),i.$set(Ne);const Me={};oe&1&&(Me.epoch=Q[0].u),f.$set(Me),Q[0].t>-50?ve?ve.p(Q,oe):(ve=Vr(Q),ve.c(),ve.m(r,p)):ve&&(ve.d(1),ve=null),(!Fe||oe&1)&&d!==(d=(Q[0].m?(Q[0].m/1e3).toFixed(1):"-")+"")&&B(v,d);const he={};oe&3&&(he.text=Q[1].booting?"Booting":Q[0].v>2?Q[0].v.toFixed(2)+"V":"ESP"),oe&3&&(he.color=Il(Q[1].booting?2:Q[0].em)),T.$set(he);const x={};oe&3&&(x.color=Il(Q[1].booting?9:Q[0].hm)),E.$set(x);const _e={};oe&1&&(_e.text=Q[0].r?Q[0].r.toFixed(0)+"dBm":"WiFi"),oe&3&&(_e.color=Il(Q[1].booting?9:Q[0].wm)),A.$set(_e);const Ue={};oe&3&&(Ue.color=Il(Q[1].booting?9:Q[0].mm)),F.$set(Ue),Q[0].he<0||Q[0].he>0?Pe?Pe.p(Q,oe):(Pe=Kr(Q),Pe.c(),Pe.m(l,U)):Pe&&(Pe.d(1),Pe=null),Q[0].me<0?De?De.p(Q,oe):(De=Qr(Q),De.c(),De.m(l,R)):De&&(De.d(1),De=null),Q[0].ee>0||Q[0].ee<0?me?me.p(Q,oe):(me=Xr(Q),me.c(),me.m(l,q)):me&&(me.d(1),me=null);const je={};oe&1&&(je.timestamp=Q[0].c?new Date(Q[0].c*1e3):new Date(0)),oe&2&&(je.offset=Q[1].clock_offset),te.$set(je),Q[1].vndcfg&&Q[1].usrcfg?se?oe&2&&N(se,1):(se=Zr(Q),se.c(),N(se,1),se.m(z,de)):se&&(Te(),D(se,1,1,()=>{se=null}),Se()),Q[1].fwconsent===1&&Q[2]?pe?(pe.p(Q,oe),oe&6&&N(pe,1)):(pe=Jr(Q),pe.c(),N(pe,1),pe.m(z,null)):pe&&(Te(),D(pe,1,1,()=>{pe=null}),Se())},i(Q){Fe||(N(i.$$.fragment,Q),N(f.$$.fragment,Q),N(T.$$.fragment,Q),N(E.$$.fragment,Q),N(A.$$.fragment,Q),N(F.$$.fragment,Q),N(te.$$.fragment,Q),N(se),N(Ie.$$.fragment,Q),N(pe),Fe=!0)},o(Q){D(i.$$.fragment,Q),D(f.$$.fragment,Q),D(T.$$.fragment,Q),D(E.$$.fragment,Q),D(A.$$.fragment,Q),D(F.$$.fragment,Q),D(te.$$.fragment,Q),D(se),D(Ie.$$.fragment,Q),D(pe),Fe=!1},d(Q){Q&&w(e),Z(i),Z(f),ve&&ve.d(),Z(T),Z(E),Z(A),Z(F),Pe&&Pe.d(),De&&De.d(),me&&me.d(),Z(te),se&&se.d(),Z(Ie),pe&&pe.d()}}}function Wm(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ii(i.board)||confirm(gs(fe(i.chip,i.board))))&&(Ut.update(a=>(a.upgrading=!0,a)),Mc(o.tag_name))}return Ut.subscribe(a=>{l(1,i=a),a.fwconsent===1&&mm()}),bo.subscribe(a=>{l(2,o=Ac(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Gm extends Ce{constructor(e){super(),ye(this,e,Wm,jm,ke,{data:0})}}function Bm(t){let e,l,n,i;return{c(){e=qe("svg"),l=qe("path"),n=qe("path"),u(l,"d",zs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=zs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){y(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=zs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ne,o:ne,d(o){o&&w(e)}}}function xr(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function zs(t,e,l,n,i){var o=xr(t,e,l,i),r=xr(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function zm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Ym extends Ce{constructor(e){super(),ye(this,e,zm,Bm,ke,{pct:0,color:1})}}function ea(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=h(),n=m("span"),i=C(t[3]),o=h(),r=m("span"),a=C(t[4]),f=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),y(c,o,p),y(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&B(i,c[3]),p&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function Vm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k;l=new Ym({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&ea(t);return{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("span"),o=m("span"),r=C(t[2]),a=h(),f=m("br"),c=h(),p=m("span"),_=C(t[0]),b=h(),d=m("span"),v=C(t[1]),g=h(),$&&$.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(d,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),X(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,b),s(i,d),s(d,v),s(i,g),$&&$.m(i,null),k=!0},p(T,[P]){const E={};P&64&&(E.pct=T[6]),P&96&&(E.color=T[5](T[6])),l.$set(E),(!k||P&4)&&B(r,T[2]),(!k||P&1)&&B(_,T[0]),(!k||P&2)&&B(v,T[1]),T[3]?$?$.p(T,P):($=ea(T),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(T){k||(N(l.$$.fragment,T),k=!0)},o(T){D(l.$$.fragment,T),k=!1},d(T){T&&w(e),Z(l),$&&$.d()}}}function Km(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class Ic extends Ce{constructor(e){super(),ye(this,e,Km,Vm,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function ta(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function la(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function na(t,e,l){const n=t.slice();return n[13]=e[l],n}function ia(t){let e,l,n,i,o,r=t[0].title&&sa(t),a=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&aa(t);return{c(){e=qe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){y(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=aa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function aa(t){let e,l=t[9].label+"",n,i;return{c(){e=qe("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){y(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&B(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&w(e)}}}function fa(t){let e=!isNaN(t[5](t[11])),l,n=e&&ra(t);return{c(){n&&n.c(),l=We()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=ra(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function ca(t){let e,l,n=t[9].value!==void 0&&ma(t),i=t[9].value2>1e-4&&da(t);return{c(){e=qe("g"),n&&n.c(),l=qe("g"),i&&i.c()},m(o,r){y(o,e,r),n&&n.m(e,null),y(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=ma(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=da(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ma(t){let e,l,n,i,o,r,a,f=t[3]>15&&pa(t);return{c(){e=qe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=pa(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function pa(t){let e,l=t[9].label+"",n,i,o,r,a,f,c=t[9].title&&_a(t);return{c(){e=qe("text"),n=C(l),c&&c.c(),f=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",r),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]15&&va(t);return{c(){e=qe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=va(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function va(t){let e,l=t[9].label2+"",n,i,o,r,a,f=t[9].title2&&ha(t);return{c(){e=qe("text"),n=C(l),f&&f.c(),a=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){y(i,e,o),n&&n.m(e,null),l=Vc(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ia(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&w(e),n&&n.d(),l()}}}let sn=30;function Xm(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,r=b/n.points.length),l(7,p=rn.y.max?g=n.padding.bottom:vc||g<0?0:g})}},[n,i,o,r,c,a,f,p,_]}class un extends Ce{constructor(e){super(),ye(this,e,Xm,Qm,ke,{config:0})}}function Zm(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:ce(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:um(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={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:c},points:p})}},[a,n,i,o,r]}class xm extends Ce{constructor(e){super(),ye(this,e,Jm,Zm,ke,{u1:1,u2:2,u3:3,ds:4})}}function ep(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function tp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(b){return{label:ce(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:wc(b?b/c*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,r=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,f=b.i3),"max"in b&&l(7,c=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],d=[];n>0&&(b.push({label:"L1"}),d.push(_(r))),i>0&&(b.push({label:"L2"}),d.push(_(a))),o>0&&(b.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:b},points:d})}},[p,n,i,o,r,a,f,c]}class lp extends Ce{constructor(e){super(),ye(this,e,tp,ep,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function np(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,b,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,$,T,P,E,S,A,I=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,Y,U,R,q,z,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",H,G;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",r=h(),a=m("div"),c=C(f),p=C(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",d=h(),v=m("div"),k=C(g),$=C(" VAr"),T=h(),P=m("div"),E=m("div"),E.textContent="Total in",S=h(),A=m("div"),F=C(I),Y=C(" kVArh"),U=h(),R=m("div"),R.textContent="Total out",q=h(),z=m("div"),H=C(O),G=C(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(z,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,b),s(i,d),s(i,v),s(v,k),s(v,$),s(e,T),s(e,P),s(P,E),s(P,S),s(P,A),s(A,F),s(A,Y),s(P,U),s(P,R),s(P,q),s(P,z),s(z,H),s(z,G)},p(L,[W]){W&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&B(c,f),W&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&B(k,g),W&4&&I!==(I=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&B(F,I),W&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&B(H,O)},i:ne,o:ne,d(L){L&&w(e)}}}function ip(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class sp extends Ce{constructor(e){super(),ye(this,e,ip,np,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ga(t){let e;function l(o,r){return o[3]?up:op}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function op(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v=ce(t[1].d.u,1)+"",g,k,$,T,P,E,S=ce(t[1].m.u)+"",A,I,F,Y,U,R,q=ce(t[0].last_month.u)+"",z,O,H,G,L=t[4]&&ka(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),d=m("div"),g=C(v),k=C(" kWh"),$=h(),T=m("div"),T.textContent="Month",P=h(),E=m("div"),A=C(S),I=C(" kWh"),F=h(),Y=m("div"),Y.textContent="Last month",U=h(),R=m("div"),z=C(q),O=C(" kWh"),H=h(),L&&L.c(),G=We(),u(r,"class","text-right"),u(d,"class","text-right"),u(E,"class","text-right"),u(R,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(W,j){y(W,e,j),y(W,l,j),y(W,n,j),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,b),s(n,d),s(d,g),s(d,k),s(n,$),s(n,T),s(n,P),s(n,E),s(E,A),s(E,I),s(n,F),s(n,Y),s(n,U),s(n,R),s(R,z),s(R,O),y(W,H,j),L&&L.m(W,j),y(W,G,j)},p(W,j){j&2&&a!==(a=ce(W[1].h.u,2)+"")&&B(f,a),j&2&&v!==(v=ce(W[1].d.u,1)+"")&&B(g,v),j&2&&S!==(S=ce(W[1].m.u)+"")&&B(A,S),j&1&&q!==(q=ce(W[0].last_month.u)+"")&&B(z,q),W[4]?L?L.p(W,j):(L=ka(W),L.c(),L.m(G.parentNode,G)):L&&(L.d(1),L=null)},d(W){W&&w(e),W&&w(l),W&&w(n),W&&w(H),L&&L.d(W),W&&w(G)}}}function up(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.u,1)+"",k,$,T,P,E,S,A,I=ce(t[1].m.u)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.u)+"",G,L,W,j,te,le,de,ie,we,Ie,$e,Fe=ce(t[1].h.p,2)+"",ve,Pe,De,me,se,pe,Q,oe=ce(t[1].d.p,1)+"",Ne,Me,he,x,_e,Ue,je,Ke=ce(t[1].m.p)+"",Re,He,re,ge,Ot,Ol,xt,ft=ce(t[0].last_month.p)+"",Sl,ml,qt,dt,Qe=t[4]&&wa(t),Xe=t[4]&&ya(t),Ze=t[4]&&Ca(t),Oe=t[4]&&$a(t),Je=t[4]&&Ta(t),Ge=t[4]&&Sa(t),xe=t[4]&&Pa(t),et=t[4]&&Na(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),Qe&&Qe.c(),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=C(" kWh"),T=h(),Xe&&Xe.c(),P=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=C(I),Y=C(" kWh"),U=h(),Ze&&Ze.c(),R=h(),q=m("div"),q.textContent="Last mo.",z=h(),O=m("div"),G=C(H),L=C(" kWh"),W=h(),Oe&&Oe.c(),te=h(),le=m("strong"),le.textContent="Export",de=h(),ie=m("div"),we=m("div"),we.textContent="Hour",Ie=h(),$e=m("div"),ve=C(Fe),Pe=C(" kWh"),De=h(),Je&&Je.c(),me=h(),se=m("div"),se.textContent="Day",pe=h(),Q=m("div"),Ne=C(oe),Me=C(" kWh"),he=h(),Ge&&Ge.c(),x=h(),_e=m("div"),_e.textContent="Month",Ue=h(),je=m("div"),Re=C(Ke),He=C(" kWh"),re=h(),xe&&xe.c(),ge=h(),Ot=m("div"),Ot.textContent="Last mo.",Ol=h(),xt=m("div"),Sl=C(ft),ml=C(" kWh"),qt=h(),et&&et.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",j="grid grid-cols-"+t[5]+" mb-3"),u($e,"class","text-right"),u(Q,"class","text-right"),u(je,"class","text-right"),u(xt,"class","text-right"),u(ie,"class",dt="grid grid-cols-"+t[5])},m(ue,be){y(ue,e,be),y(ue,l,be),y(ue,n,be),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Qe&&Qe.m(n,null),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(n,T),Xe&&Xe.m(n,null),s(n,P),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(n,U),Ze&&Ze.m(n,null),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(n,W),Oe&&Oe.m(n,null),y(ue,te,be),y(ue,le,be),y(ue,de,be),y(ue,ie,be),s(ie,we),s(ie,Ie),s(ie,$e),s($e,ve),s($e,Pe),s(ie,De),Je&&Je.m(ie,null),s(ie,me),s(ie,se),s(ie,pe),s(ie,Q),s(Q,Ne),s(Q,Me),s(ie,he),Ge&&Ge.m(ie,null),s(ie,x),s(ie,_e),s(ie,Ue),s(ie,je),s(je,Re),s(je,He),s(ie,re),xe&&xe.m(ie,null),s(ie,ge),s(ie,Ot),s(ie,Ol),s(ie,xt),s(xt,Sl),s(xt,ml),s(ie,qt),et&&et.m(ie,null)},p(ue,be){be&2&&a!==(a=ce(ue[1].h.u,2)+"")&&B(f,a),ue[4]?Qe?Qe.p(ue,be):(Qe=wa(ue),Qe.c(),Qe.m(n,_)):Qe&&(Qe.d(1),Qe=null),be&2&&g!==(g=ce(ue[1].d.u,1)+"")&&B(k,g),ue[4]?Xe?Xe.p(ue,be):(Xe=ya(ue),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),be&2&&I!==(I=ce(ue[1].m.u)+"")&&B(F,I),ue[4]?Ze?Ze.p(ue,be):(Ze=Ca(ue),Ze.c(),Ze.m(n,R)):Ze&&(Ze.d(1),Ze=null),be&1&&H!==(H=ce(ue[0].last_month.u)+"")&&B(G,H),ue[4]?Oe?Oe.p(ue,be):(Oe=$a(ue),Oe.c(),Oe.m(n,null)):Oe&&(Oe.d(1),Oe=null),be&32&&j!==(j="grid grid-cols-"+ue[5]+" mb-3")&&u(n,"class",j),be&2&&Fe!==(Fe=ce(ue[1].h.p,2)+"")&&B(ve,Fe),ue[4]?Je?Je.p(ue,be):(Je=Ta(ue),Je.c(),Je.m(ie,me)):Je&&(Je.d(1),Je=null),be&2&&oe!==(oe=ce(ue[1].d.p,1)+"")&&B(Ne,oe),ue[4]?Ge?Ge.p(ue,be):(Ge=Sa(ue),Ge.c(),Ge.m(ie,x)):Ge&&(Ge.d(1),Ge=null),be&2&&Ke!==(Ke=ce(ue[1].m.p)+"")&&B(Re,Ke),ue[4]?xe?xe.p(ue,be):(xe=Pa(ue),xe.c(),xe.m(ie,ge)):xe&&(xe.d(1),xe=null),be&1&&ft!==(ft=ce(ue[0].last_month.p)+"")&&B(Sl,ft),ue[4]?et?et.p(ue,be):(et=Na(ue),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),be&32&&dt!==(dt="grid grid-cols-"+ue[5])&&u(ie,"class",dt)},d(ue){ue&&w(e),ue&&w(l),ue&&w(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Oe&&Oe.d(),ue&&w(te),ue&&w(le),ue&&w(de),ue&&w(ie),Je&&Je.d(),Ge&&Ge.d(),xe&&xe.d(),et&&et.d()}}}function ka(t){let e,l,n,i,o,r,a=ce(t[1].h.c,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.c,1)+"",k,$,T,P,E,S,A,I=ce(t[1].m.c)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.c)+"",G,L,W;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=h(),p=C(t[2]),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=h(),T=C(t[2]),P=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=C(I),Y=h(),U=C(t[2]),R=h(),q=m("div"),q.textContent="Last month",z=h(),O=m("div"),G=C(H),L=h(),W=C(t[2]),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(j,te){y(j,e,te),y(j,l,te),y(j,n,te),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(v,T),s(n,P),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(A,U),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(O,W)},p(j,te){te&2&&a!==(a=ce(j[1].h.c,2)+"")&&B(f,a),te&4&&B(p,j[2]),te&2&&g!==(g=ce(j[1].d.c,1)+"")&&B(k,g),te&4&&B(T,j[2]),te&2&&I!==(I=ce(j[1].m.c)+"")&&B(F,I),te&4&&B(U,j[2]),te&1&&H!==(H=ce(j[0].last_month.c)+"")&&B(G,H),te&4&&B(W,j[2])},d(j){j&&w(e),j&&w(l),j&&w(n)}}}function wa(t){let e,l=ce(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.c,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ya(t){let e,l=ce(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.c,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ca(t){let e,l=ce(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function $a(t){let e,l=ce(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ta(t){let e,l=ce(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.i,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Sa(t){let e,l=ce(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.i,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Pa(t){let e,l=ce(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Na(t){let e,l=ce(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function rp(t){let e,l,n,i,o,r,a=t[1]&&ga(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),r=h(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=ga(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&w(e),a&&a.d()}}}function ap(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class fp extends Ce{constructor(e){super(),ye(this,e,ap,rp,ke,{sysinfo:0,data:1,currency:2,hasExport:3})}}function cp(t){let e,l,n,i;return n=new un({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),X(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){D(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function mp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,b=0,d=[],v=[],g=[];l(4,a=l(3,r=0));let k=new Date;for(rl(k,i.clock_offset),p=c;p<24&&(_=n[Ee(b++)],_!=null);p++)v.push({label:Ee(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),rl(k,1);for(p=0;p<24&&(_=n[Ee(b++)],_!=null);p++)v.push({label:Ee(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),rl(k,1);if(a>-100&&r<100){switch(f){case"NOK":case"SEK":case"DKK":f="\xF8re";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,r*=100),p=0;p=0?S.toFixed(A):"",title:S>=0?S.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:S<0?S.toFixed(A):"",title2:S<0?S.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let T=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(T/4*-1,a));let S=Math.ceil(Math.abs(a)/T*4),A=a/S;for(p=1;p{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=rl(new Date,-24),d=new Date().getUTCHours();for(rl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),f=d;f<24;f++){let k=n["i"+Ee(f)],$=n["e"+Ee(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:Ee(b.getHours())}),_.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,k*10)),rl(b,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=new Date,d=new Date;for(rl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),rl(d,i.clock_offset-(d.getHours()-d.getUTCHours())%24),d.setDate(0),f=b.getDate();f<=d.getDate();f++){let k=n["i"+Ee(f)],$=n["e"+Ee(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:Ee(f)}),_.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,k))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var k=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:k.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let b=o;r<0&&(b+=Math.abs(r));let d=b/4;for(a=0;a<5;a++)f=r+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class yp extends Ce{constructor(e){super(),ye(this,e,wp,kp,ke,{json:1})}}function Cp(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let $p=0;function Tp(t,e,l){let n={},i=0,o;return Nc.subscribe(r=>{l(2,o=r)}),Pc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?Ee(p.d)+"."+Xs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:$p,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class Sp extends Ce{constructor(e){super(),ye(this,e,Tp,Cp,ke,{})}}function Ma(t){let e,l,n,i,o,r,a=(t[0].mt?bs(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,d,v;return i=new Ic({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:wc}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),f=C(a),c=h(),p=m("div"),b=C(_),d=C(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,k){y(g,e,k),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,b),s(p,d),v=!0},p(g,k){const $={};k&1&&($.val=g[0].i?g[0].i:0),k&1&&($.max=g[0].im?g[0].im:15e3),k&1&&($.sub=g[0].p),k&1&&($.subunit=g[0].pc),i.$set($),(!v||k&1)&&a!==(a=(g[0].mt?bs(g[0].mt):"-")+"")&&B(f,a),(!v||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(b,_)},i(g){v||(N(i.$$.fragment,g),v=!0)},o(g){D(i.$$.fragment,g),v=!1},d(g){g&&w(e),Z(i)}}}function Aa(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Ic({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:rm}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=h(),f=m("div"),p=C(c),_=C(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(d,v){y(d,e,v),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),b=!0},p(d,v){const g={};v&1&&(g.val=d[0].e?d[0].e:0),v&1&&(g.max=d[0].om?d[0].om*1e3:1e4),i.$set(g),(!b||v&1)&&c!==(c=(d[0].ec?d[0].ec.toFixed(1):"-")+"")&&B(p,c)},i(d){b||(N(i.$$.fragment,d),b=!0)},o(d){D(i.$$.fragment,d),b=!1},d(d){d&&w(e),Z(i)}}}function Da(t){let e,l,n;return l=new xm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ea(t){let e,l,n;return l=new lp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ia(t){let e,l,n;return l=new sp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Fa(t){let e,l,n;return l=new fp({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ra(t){let e,l,n;return l=new Sp({}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),X(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function La(t){let e,l,n;return l=new pp({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ua(t){let e,l,n;return l=new vp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Oa(t){let e,l,n;return l=new gp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function qa(t){let e,l,n;return l=new yp({props:{json:t[5]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Pp(t){let e,l=ze(t[1].ui.i,t[0].i),n,i=ze(t[1].ui.e,t[0].om||t[0].e>0),o,r=ze(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=ze(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=ze(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=ze(t[1].ui.c,t[0].ea),d,v=ze(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,k=ze(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,T=ze(t[1].ui.d,t[3]),P,E=ze(t[1].ui.m,t[4]),S,A=ze(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),I,F=l&&Ma(t),Y=i&&Aa(t),U=r&&Da(t),R=f&&Ea(t),q=p&&Ia(t),z=b&&Fa(t),O=v&&Ra(),H=k&&La(t),G=T&&Ua(t),L=E&&Oa(t),W=A&&qa(t);return{c(){e=m("div"),F&&F.c(),n=h(),Y&&Y.c(),o=h(),U&&U.c(),a=h(),R&&R.c(),c=h(),q&&q.c(),_=h(),z&&z.c(),d=h(),O&&O.c(),g=h(),H&&H.c(),$=h(),G&&G.c(),P=h(),L&&L.c(),S=h(),W&&W.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(j,te){y(j,e,te),F&&F.m(e,null),s(e,n),Y&&Y.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),R&&R.m(e,null),s(e,c),q&&q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),O&&O.m(e,null),s(e,g),H&&H.m(e,null),s(e,$),G&&G.m(e,null),s(e,P),L&&L.m(e,null),s(e,S),W&&W.m(e,null),I=!0},p(j,[te]){te&3&&(l=ze(j[1].ui.i,j[0].i)),l?F?(F.p(j,te),te&3&&N(F,1)):(F=Ma(j),F.c(),N(F,1),F.m(e,n)):F&&(Te(),D(F,1,1,()=>{F=null}),Se()),te&3&&(i=ze(j[1].ui.e,j[0].om||j[0].e>0)),i?Y?(Y.p(j,te),te&3&&N(Y,1)):(Y=Aa(j),Y.c(),N(Y,1),Y.m(e,o)):Y&&(Te(),D(Y,1,1,()=>{Y=null}),Se()),te&3&&(r=ze(j[1].ui.v,j[0].u1>100||j[0].u2>100||j[0].u3>100)),r?U?(U.p(j,te),te&3&&N(U,1)):(U=Da(j),U.c(),N(U,1),U.m(e,a)):U&&(Te(),D(U,1,1,()=>{U=null}),Se()),te&3&&(f=ze(j[1].ui.a,j[0].i1>.01||j[0].i2>.01||j[0].i3>.01)),f?R?(R.p(j,te),te&3&&N(R,1)):(R=Ea(j),R.c(),N(R,1),R.m(e,c)):R&&(Te(),D(R,1,1,()=>{R=null}),Se()),te&3&&(p=ze(j[1].ui.r,j[0].ri>0||j[0].re>0||j[0].ric>0||j[0].rec>0)),p?q?(q.p(j,te),te&3&&N(q,1)):(q=Ia(j),q.c(),N(q,1),q.m(e,_)):q&&(Te(),D(q,1,1,()=>{q=null}),Se()),te&3&&(b=ze(j[1].ui.c,j[0].ea)),b?z?(z.p(j,te),te&3&&N(z,1)):(z=Fa(j),z.c(),N(z,1),z.m(e,d)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),te&3&&(v=ze(j[1].ui.t,j[0].pr&&(j[0].pr.startsWith("10YNO")||j[0].pr=="10Y1001A1001A48H"))),v?O?te&3&&N(O,1):(O=Ra(),O.c(),N(O,1),O.m(e,g)):O&&(Te(),D(O,1,1,()=>{O=null}),Se()),te&3&&(k=ze(j[1].ui.p,j[0].pe&&!Number.isNaN(j[0].p))),k?H?(H.p(j,te),te&3&&N(H,1)):(H=La(j),H.c(),N(H,1),H.m(e,$)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),te&10&&(T=ze(j[1].ui.d,j[3])),T?G?(G.p(j,te),te&10&&N(G,1)):(G=Ua(j),G.c(),N(G,1),G.m(e,P)):G&&(Te(),D(G,1,1,()=>{G=null}),Se()),te&18&&(E=ze(j[1].ui.m,j[4])),E?L?(L.p(j,te),te&18&&N(L,1)):(L=Oa(j),L.c(),N(L,1),L.m(e,S)):L&&(Te(),D(L,1,1,()=>{L=null}),Se()),te&35&&(A=ze(j[1].ui.s,j[0].t&&j[0].t!=-127&&j[5].c>1)),A?W?(W.p(j,te),te&35&&N(W,1)):(W=qa(j),W.c(),N(W,1),W.m(e,null)):W&&(Te(),D(W,1,1,()=>{W=null}),Se())},i(j){I||(N(F),N(Y),N(U),N(R),N(q),N(z),N(O),N(H),N(G),N(L),N(W),I=!0)},o(j){D(F),D(Y),D(U),D(R),D(q),D(z),D(O),D(H),D(G),D(L),D(W),I=!1},d(j){j&&w(e),F&&F.d(),Y&&Y.d(),U&&U.d(),R&&R.d(),q&&q.d(),z&&z.d(),O&&O.d(),H&&H.d(),G&&G.d(),L&&L.d(),W&&W.d()}}}function Np(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return yc.subscribe(c=>{l(2,o=c)}),Cc.subscribe(c=>{l(3,r=c)}),$c.subscribe(c=>{l(4,a=c)}),Sc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Mp extends Ce{constructor(e){super(),ye(this,e,Np,Pp,ke,{data:0,sysinfo:1})}}let no={};const Fc=ut(no);async function Ap(){no=await(await fetch("/configuration.json")).json(),Fc.set(no)}function Ha(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Dp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ep(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function ja(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Wa(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Ga(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ba(t){let e,l,n;return{c(){e=m("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function za(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Ba(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Ba(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Ip(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?Ep:Dp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&ja(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Wa(),_=t[0]=="esp32s2"&&Ga(),b={length:t[1]+1},d=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Rc extends Ce{constructor(e){super(),ye(this,e,Fp,Ip,ke,{chip:0})}}function Ya(t){let e,l,n=t[1]&&Va(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Va(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Va(t){let e,l;return{c(){e=m("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function Rp(t){let e,l=t[0]&&Ya(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ya(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function Lp(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class At extends Ce{constructor(e){super(),ye(this,e,Lp,Rp,ke,{active:0,message:1})}}function Ka(t,e,l){const n=t.slice();return n[1]=e[l],n}function Qa(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&w(e)}}}function Up(t){let e,l,n,i=t[0],o=[];for(let r=0;r{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Kp(t){let e,l;return e=new al({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Qp(t){let e,l;return e=new al({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Xp(t){let e,l,n,i;const o=[Qp,Kp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Zp(t){let e,l;return e=new al({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Jp(t){let e,l;return e=new al({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function xp(t){let e,l,n,i;const o=[Jp,Zp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function uf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H,G;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=m("div"),_=C("Electricity IDX"),b=m("br"),d=h(),v=m("input"),g=h(),k=m("div"),$=C("Current IDX"),T=m("br"),P=h(),E=m("input"),S=h(),A=m("div"),I=C(`Voltage IDX: L1, L2 & L3 - `),F=m("div"),Y=m("input"),U=h(),R=m("input"),q=h(),z=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u(k,"class","w-1/2"),u(c,"class","my-1 flex"),u(Y,"name","ou1"),u(Y,"type","text"),u(Y,"class","in-f tr w-1/3"),u(R,"name","ou2"),u(R,"type","text"),u(R,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].o.e),s(c,g),s(c,k),s(k,$),s(k,T),s(k,P),s(k,E),V(E,t[3].o.c),s(e,S),s(e,A),s(A,I),s(A,F),s(F,Y),V(Y,t[3].o.u1),s(F,U),s(F,R),V(R,t[3].o.u2),s(F,q),s(F,z),V(z,t[3].o.u3),O=!0,H||(G=[K(v,"input",t[60]),K(E,"input",t[61]),K(Y,"input",t[62]),K(R,"input",t[63]),K(z,"input",t[64])],H=!0)},p(L,W){W[0]&8&&v.value!==L[3].o.e&&V(v,L[3].o.e),W[0]&8&&E.value!==L[3].o.c&&V(E,L[3].o.c),W[0]&8&&Y.value!==L[3].o.u1&&V(Y,L[3].o.u1),W[0]&8&&R.value!==L[3].o.u2&&V(R,L[3].o.u2),W[0]&8&&z.value!==L[3].o.u3&&V(z,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){D(o.$$.fragment,L),O=!1},d(L){L&&w(e),Z(o),H=!1,Ve(G)}}}function rf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=C("Discovery topic prefix"),_=m("br"),b=h(),d=m("input"),v=h(),g=m("div"),k=C("Hostname for URL"),$=m("br"),T=h(),P=m("input"),S=h(),A=m("div"),I=C("Name tag"),F=m("br"),Y=h(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(d,"name","ht"),u(d,"type","text"),u(d,"class","in-s"),u(d,"placeholder","homeassistant"),u(c,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,H){y(O,e,H),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,b),s(c,d),V(d,t[3].h.t),s(e,v),s(e,g),s(g,k),s(g,$),s(g,T),s(g,P),V(P,t[3].h.h),s(e,S),s(e,A),s(A,I),s(A,F),s(A,Y),s(A,U),V(U,t[3].h.n),R=!0,q||(z=[K(d,"input",t[65]),K(P,"input",t[66]),K(U,"input",t[67])],q=!0)},p(O,H){H[0]&8&&d.value!==O[3].h.t&&V(d,O[3].h.t),(!R||H[0]&8&&E!==(E=O[3].g.h+".local"))&&u(P,"placeholder",E),H[0]&8&&P.value!==O[3].h.h&&V(P,O[3].h.h),H[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){R||(N(o.$$.fragment,O),R=!0)},o(O){D(o.$$.fragment,O),R=!1},d(O){O&&w(e),Z(o),q=!1,Ve(z)}}}function af(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P;o=new Rt({});let E={length:9},S=[];for(let A=0;A20&&pf(t),p=t[0].chip=="esp8266"&&vf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),J(o.$$.fragment),r=h(),c&&c.c(),a=h(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,b){_[0].board>20?c?(c.p(_,b),b[0]&1&&N(c,1)):(c=pf(_),c.c(),N(c,1),c.m(e,a)):c&&(Te(),D(c,1,1,()=>{c=null}),Se()),_[0].chip=="esp8266"?p?p.p(_,b):(p=vf(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(N(o.$$.fragment,_),N(c),f=!0)},o(_){D(o.$$.fragment,_),D(c),f=!1},d(_){_&&w(e),Z(o),c&&c.d(),p&&p.d()}}}function pf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Fe,ve,Pe,De,me,se,pe,Q,oe,Ne,Me,he,x,_e,Ue,je,Ke;b=new Rc({props:{chip:t[0].chip}});let Re=t[0].chip!="esp8266"&&_f(t),He=t[3].i.v.p>0&&df(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("HAN"),r=m("label"),a=m("input"),f=C(" pullup"),c=m("br"),p=h(),_=m("select"),J(b.$$.fragment),d=h(),v=m("div"),g=C("AP button"),k=m("br"),$=h(),T=m("input"),P=h(),E=m("div"),S=C("LED"),A=m("label"),I=m("input"),F=C(" inv"),Y=m("br"),U=h(),R=m("div"),q=m("input"),z=h(),O=m("div"),H=C("RGB"),G=m("label"),L=m("input"),W=C(" inverted"),j=m("br"),te=h(),le=m("div"),de=m("input"),ie=h(),we=m("input"),Ie=h(),$e=m("input"),Fe=h(),ve=m("div"),Pe=C("Temperature"),De=m("br"),me=h(),se=m("input"),pe=h(),Q=m("div"),oe=C("Analog temp"),Ne=m("br"),Me=h(),he=m("input"),x=h(),Re&&Re.c(),_e=h(),He&&He.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[72].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(I,"name","ili"),I.__value="true",I.value=I.__value,u(I,"type","checkbox"),u(I,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(R,"class","flex"),u(E,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(G,"class","ml-4"),u(de,"name","irr"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"class","in-f tr w-1/3"),u(we,"name","irg"),u(we,"type","number"),u(we,"min","0"),u(we,"max",t[6]),u(we,"class","in-m tr w-1/3"),u($e,"name","irb"),u($e,"type","number"),u($e,"min","0"),u($e,"max",t[6]),u($e,"class","in-l tr w-1/3"),u(le,"class","flex"),u(O,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(ve,"class","my-1 w-1/3"),u(he,"name","ita"),u(he,"type","number"),u(he,"min","0"),u(he,"max",t[6]),u(he,"class","in-l tr w-full"),u(Q,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(re,ge){y(re,e,ge),y(re,l,ge),y(re,n,ge),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,p),s(i,_),X(b,_,null),Le(_,t[3].i.h.p,!0),s(n,d),s(n,v),s(v,g),s(v,k),s(v,$),s(v,T),V(T,t[3].i.a),s(n,P),s(n,E),s(E,S),s(E,A),s(A,I),I.checked=t[3].i.l.i,s(A,F),s(E,Y),s(E,U),s(E,R),s(R,q),V(q,t[3].i.l.p),s(n,z),s(n,O),s(O,H),s(O,G),s(G,L),L.checked=t[3].i.r.i,s(G,W),s(O,j),s(O,te),s(O,le),s(le,de),V(de,t[3].i.r.r),s(le,ie),s(le,we),V(we,t[3].i.r.g),s(le,Ie),s(le,$e),V($e,t[3].i.r.b),s(n,Fe),s(n,ve),s(ve,Pe),s(ve,De),s(ve,me),s(ve,se),V(se,t[3].i.t.d),s(n,pe),s(n,Q),s(Q,oe),s(Q,Ne),s(Q,Me),s(Q,he),V(he,t[3].i.t.a),s(n,x),Re&&Re.m(n,null),s(n,_e),He&&He.m(n,null),Ue=!0,je||(Ke=[K(a,"change",t[71]),K(_,"change",t[72]),K(T,"input",t[73]),K(I,"change",t[74]),K(q,"input",t[75]),K(L,"change",t[76]),K(de,"input",t[77]),K(we,"input",t[78]),K($e,"input",t[79]),K(se,"input",t[80]),K(he,"input",t[81])],je=!0)},p(re,ge){ge[0]&8&&(a.checked=re[3].i.h.u);const Ot={};ge[0]&1&&(Ot.chip=re[0].chip),b.$set(Ot),ge[0]&8&&Le(_,re[3].i.h.p),(!Ue||ge[0]&64)&&u(T,"max",re[6]),ge[0]&8&&ae(T.value)!==re[3].i.a&&V(T,re[3].i.a),ge[0]&8&&(I.checked=re[3].i.l.i),(!Ue||ge[0]&64)&&u(q,"max",re[6]),ge[0]&8&&ae(q.value)!==re[3].i.l.p&&V(q,re[3].i.l.p),ge[0]&8&&(L.checked=re[3].i.r.i),(!Ue||ge[0]&64)&&u(de,"max",re[6]),ge[0]&8&&ae(de.value)!==re[3].i.r.r&&V(de,re[3].i.r.r),(!Ue||ge[0]&64)&&u(we,"max",re[6]),ge[0]&8&&ae(we.value)!==re[3].i.r.g&&V(we,re[3].i.r.g),(!Ue||ge[0]&64)&&u($e,"max",re[6]),ge[0]&8&&ae($e.value)!==re[3].i.r.b&&V($e,re[3].i.r.b),(!Ue||ge[0]&64)&&u(se,"max",re[6]),ge[0]&8&&ae(se.value)!==re[3].i.t.d&&V(se,re[3].i.t.d),(!Ue||ge[0]&64)&&u(he,"max",re[6]),ge[0]&8&&ae(he.value)!==re[3].i.t.a&&V(he,re[3].i.t.a),re[0].chip!="esp8266"?Re?Re.p(re,ge):(Re=_f(re),Re.c(),Re.m(n,_e)):Re&&(Re.d(1),Re=null),re[3].i.v.p>0?He?He.p(re,ge):(He=df(re),He.c(),He.m(n,null)):He&&(He.d(1),He=null)},i(re){Ue||(N(b.$$.fragment,re),Ue=!0)},o(re){D(b.$$.fragment,re),Ue=!1},d(re){re&&w(e),re&&w(l),re&&w(n),Z(b),Re&&Re.d(),He&&He.d(),je=!1,Ve(Ke)}}}function _f(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Vcc"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[82]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&ae(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&w(e),r=!1,a()}}}function df(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=C("Voltage divider"),n=m("br"),i=h(),o=m("div"),r=m("input"),a=h(),f=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","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(p=[K(r,"input",t[83]),K(f,"input",t[84])],c=!0)},p(_,b){b[0]&8&&ae(r.value)!==_[3].i.v.d.v&&V(r,_[3].i.v.d.v),b[0]&8&&ae(f.value)!==_[3].i.v.d.g&&V(f,_[3].i.v.d.g)},d(_){_&&w(e),c=!1,Ve(p)}}}function vf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T=(t[0].board==2||t[0].board==100)&&hf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("Vcc offset"),r=m("br"),a=h(),f=m("input"),c=h(),p=m("div"),_=C("Multiplier"),b=m("br"),d=h(),v=m("input"),g=h(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,E){y(P,e,E),y(P,l,E),y(P,n,E),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].i.v.m),s(n,g),T&&T.m(n,null),k||($=[K(f,"input",t[85]),K(v,"input",t[86])],k=!0)},p(P,E){E[0]&8&&ae(f.value)!==P[3].i.v.o&&V(f,P[3].i.v.o),E[0]&8&&ae(v.value)!==P[3].i.v.m&&V(v,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,E):(T=hf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),k=!1,Ve($)}}}function hf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Boot limit"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[87]),r=!0)},p(f,c){c[0]&8&&ae(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&w(e),r=!1,a()}}}function bf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$=t[3].d.t&&gf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),r=C(" Enable telnet"),a=h(),$&&$.c(),f=h(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[90].call(p)),u(c,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),y(T,a,P),$&&$.m(T,P),y(T,f,P),y(T,c,P),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),Le(p,t[3].d.l,!0),g||(k=[K(o,"change",t[89]),K(p,"change",t[90])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?$||($=gf(),$.c(),$.m(f.parentNode,f)):$&&($.d(1),$=null),P[0]&8&&Le(p,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(a),$&&$.d(T),T&&w(f),T&&w(c),g=!1,Ve(k)}}}function gf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function e0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Fe,ve,Pe,De,me,se,pe,Q,oe,Ne,Me,he,x,_e,Ue,je,Ke,Re,He,re,ge,Ot,Ol,xt,ft,Sl,ml,qt,dt,Qe,Xe,Ze,Oe,Je,Ge,xe,et,ue,be,Pi,pl,rn,Tt,Ni,Mi,Ai,_l,Di,Ei,Ii,St,Be,dl,Ht,ys,Fi,Ae,an,Ri,fn,cn,ko,ri,wo,el,Li,yo,Cs,Co,ai,jt,$o,To,Pl,tl,Nl,So,Ui,Po,mt,Ml,No,Oi,mn,pn,_n,dn,qi,Mo,Dt,Ao,ql,Do,Eo,Io,ll,vn,hn,Fo,bn,Hl,Ro,Lo,Uo,gn,Wt,Oo,Hi,qo,jl,Ho,jo,Wo,kn,Gt,Go,ji,Bo,$s,zo,Wl,Wi,Bt,Yo,Vo,Ko,Ts,Gi,zt,Qo,Xo,Zo,ct,Bi,Jo,wn,yn,xo,fi,eu,Gl,tu,lu,nu,vl,iu,Bl,su,ou,uu,hl,ru,Cn,zl,au,fu,cu,Et,$n,Tn,Sn,Pn,mu,Yl,pu,_u,du,Nn,It,vu,zi,hu,Yi,Vi,Yt,bu,gu,rt,Ki,ku,Mn,An,wu,Vl,yu,Cu,$u,Al,nl,Dn,En,Tu,Pt,Qi,Xi,Su,Nt,In,Zi,Ji,Pu,Ss,xi,es,Vt,Nu,Mu,ci,Au,Dl,Du,mi,Kt,Eu,Iu,Fu,ts,bl,Ru,Ye,ls,Lu,Fn,Rn,Uu,pi,Ou,il,qu,Ps,Hu,ju,Ln,gl,Wu,Qt,Gu,Ns,Kl,Bu,zu,Yu,kl,Vu,Ql,Ku,Qu,Xu,wl,Zu,Un,On,Ju,xu,er,yl,tr,qn,lr,nr,ir,vt,Hn,jn,Wn,Gn,Bn,zn,sr,Xl,or,ur,rr,Cl,ar,Ms,As,Ds=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Es,sl,ns,fr,Yn,Vn,cr,_i,mr,di,pr,Is,Mt,is,_r,Kn,Qn,dr,vi,vr,ss,os,Xt,hr,br,gr,El,Fs,Xn,kr,us,Zn,wr,rs,Rs,Zl,Ls,Jl,Us,xl,Os,en,Zt,qs,yr;a=new Rt({}),F=new qp({});let Uc=["NOK","SEK","DKK","EUR"],hi=[];for(let M=0;M<4;M+=1)hi[M]=Gp(Wp(t,Uc,M));let ht=t[3].p.e&&t[0].chip!="esp8266"&&Ja(t),bt=t[3].g.s>0&&xa(t);cn=new Rt({});let Oc=[24,48,96,192,384,576,1152],bi=[];for(let M=0;M<7;M+=1)bi[M]=Bp(jp(t,Oc,M));let gt=t[3].m.e.e&&ef(t),kt=t[3].m.e.e&&tf(t),wt=t[3].m.m.e&&lf(t);yn=new Rt({}),An=new Rt({}),In=new Lc({});let yt=t[3].n.m=="static"&&nf(t);Rn=new Rt({});let Ct=t[0].chip!="esp8266"&&sf(t),lt=t[3].q.s.e&&of(t),nt=t[3].q.m==3&&uf(t),it=t[3].q.m==4&&rf(t),st=Ds&&af(t);Vn=new Rt({});let Jn=t[7],pt=[];for(let M=0;M20||t[0].chip=="esp8266")&&mf(t);Qn=new Rt({});let $t=t[3].d.s&&bf(t);return Zl=new At({props:{active:t[1],message:"Loading configuration"}}),Jl=new At({props:{active:t[2],message:"Saving configuration"}}),xl=new At({props:{active:t[4],message:"Performing factory reset"}}),en=new At({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),r=m("a"),J(a.$$.fragment),f=h(),c=m("input"),p=h(),_=m("div"),b=m("div"),d=m("div"),v=C("Hostname"),g=m("br"),k=h(),$=m("input"),T=h(),P=m("div"),E=C("Time zone"),S=m("br"),A=h(),I=m("select"),J(F.$$.fragment),Y=h(),U=m("input"),R=h(),q=m("div"),z=m("div"),O=m("div"),H=C("Price region"),G=m("br"),L=h(),W=m("select"),j=m("optgroup"),te=m("option"),te.textContent="NO1",le=m("option"),le.textContent="NO2",de=m("option"),de.textContent="NO3",ie=m("option"),ie.textContent="NO4",we=m("option"),we.textContent="NO5",Ie=m("optgroup"),$e=m("option"),$e.textContent="SE1",Fe=m("option"),Fe.textContent="SE2",ve=m("option"),ve.textContent="SE3",Pe=m("option"),Pe.textContent="SE4",De=m("optgroup"),me=m("option"),me.textContent="DK1",se=m("option"),se.textContent="DK2",pe=m("option"),pe.textContent="Austria",Q=m("option"),Q.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",Ne=m("option"),Ne.textContent="Estonia",Me=m("option"),Me.textContent="Finland",he=m("option"),he.textContent="France",x=m("option"),x.textContent="Germany",_e=m("option"),_e.textContent="Great Britain",Ue=m("option"),Ue.textContent="Latvia",je=m("option"),je.textContent="Lithuania",Ke=m("option"),Ke.textContent="Netherland",Re=m("option"),Re.textContent="Poland",He=m("option"),He.textContent="Switzerland",re=h(),ge=m("div"),Ot=C("Currency"),Ol=m("br"),xt=h(),ft=m("select");for(let M=0;M<4;M+=1)hi[M].c();Sl=h(),ml=m("div"),qt=m("div"),dt=m("div"),Qe=C("Fixed price"),Xe=m("br"),Ze=h(),Oe=m("input"),Je=h(),Ge=m("div"),xe=C("Multiplier"),et=m("br"),ue=h(),be=m("input"),Pi=h(),pl=m("div"),rn=m("label"),Tt=m("input"),Ni=C(" Enable price fetch from remote server"),Mi=h(),ht&&ht.c(),Ai=h(),_l=m("div"),Di=C("Security"),Ei=m("br"),Ii=h(),St=m("select"),Be=m("option"),Be.textContent="None",dl=m("option"),dl.textContent="Only configuration",Ht=m("option"),Ht.textContent="Everything",ys=h(),bt&&bt.c(),Fi=h(),Ae=m("div"),an=m("strong"),an.textContent="Meter",Ri=h(),fn=m("a"),J(cn.$$.fragment),ko=h(),ri=m("input"),wo=h(),el=m("div"),Li=m("span"),Li.textContent="Buffer size",yo=h(),Cs=m("span"),Cs.textContent="Serial conf.",Co=h(),ai=m("label"),jt=m("input"),$o=C(" inverted"),To=h(),Pl=m("div"),tl=m("select"),Nl=m("option"),So=C("Autodetect");for(let M=0;M<7;M+=1)bi[M].c();Po=h(),mt=m("select"),Ml=m("option"),No=C("-"),mn=m("option"),mn.textContent="7N1",pn=m("option"),pn.textContent="8N1",_n=m("option"),_n.textContent="7E1",dn=m("option"),dn.textContent="8E1",Mo=h(),Dt=m("input"),Ao=h(),ql=m("div"),Do=C("Voltage"),Eo=m("br"),Io=h(),ll=m("select"),vn=m("option"),vn.textContent="400V (TN)",hn=m("option"),hn.textContent="230V (IT/TT)",Fo=h(),bn=m("div"),Hl=m("div"),Ro=C("Main fuse"),Lo=m("br"),Uo=h(),gn=m("label"),Wt=m("input"),Oo=h(),Hi=m("span"),Hi.textContent="A",qo=h(),jl=m("div"),Ho=C("Production"),jo=m("br"),Wo=h(),kn=m("label"),Gt=m("input"),Go=h(),ji=m("span"),ji.textContent="kWp",Bo=h(),$s=m("div"),zo=h(),Wl=m("div"),Wi=m("label"),Bt=m("input"),Yo=C(" Meter is encrypted"),Vo=h(),gt&>.c(),Ko=h(),kt&&kt.c(),Ts=h(),Gi=m("label"),zt=m("input"),Qo=C(" Multipliers"),Xo=h(),wt&&wt.c(),Zo=h(),ct=m("div"),Bi=m("strong"),Bi.textContent="WiFi",Jo=h(),wn=m("a"),J(yn.$$.fragment),xo=h(),fi=m("input"),eu=h(),Gl=m("div"),tu=C("SSID"),lu=m("br"),nu=h(),vl=m("input"),iu=h(),Bl=m("div"),su=C("Password"),ou=m("br"),uu=h(),hl=m("input"),ru=h(),Cn=m("div"),zl=m("div"),au=C("Power saving"),fu=m("br"),cu=h(),Et=m("select"),$n=m("option"),$n.textContent="Default",Tn=m("option"),Tn.textContent="Off",Sn=m("option"),Sn.textContent="Minimum",Pn=m("option"),Pn.textContent="Maximum",mu=h(),Yl=m("div"),pu=C("Power"),_u=m("br"),du=h(),Nn=m("div"),It=m("input"),vu=h(),zi=m("span"),zi.textContent="dBm",hu=h(),Yi=m("div"),Vi=m("label"),Yt=m("input"),bu=C(" Auto reboot on connection problem"),gu=h(),rt=m("div"),Ki=m("strong"),Ki.textContent="Network",ku=h(),Mn=m("a"),J(An.$$.fragment),wu=h(),Vl=m("div"),yu=C("IP"),Cu=m("br"),$u=h(),Al=m("div"),nl=m("select"),Dn=m("option"),Dn.textContent="DHCP",En=m("option"),En.textContent="Static",Tu=h(),Pt=m("input"),Su=h(),Nt=m("select"),J(In.$$.fragment),Pu=h(),yt&&yt.c(),Ss=h(),xi=m("div"),es=m("label"),Vt=m("input"),Nu=C(" enable mDNS"),Mu=h(),ci=m("input"),Au=h(),Dl=m("div"),Du=C("NTP "),mi=m("label"),Kt=m("input"),Eu=C(" obtain from DHCP"),Iu=m("br"),Fu=h(),ts=m("div"),bl=m("input"),Ru=h(),Ye=m("div"),ls=m("strong"),ls.textContent="MQTT",Lu=h(),Fn=m("a"),J(Rn.$$.fragment),Uu=h(),pi=m("input"),Ou=h(),il=m("div"),qu=C(`Server - `),Ct&&Ct.c(),Ps=h(),Hu=m("br"),ju=h(),Ln=m("div"),gl=m("input"),Wu=h(),Qt=m("input"),Gu=h(),lt&<.c(),Ns=h(),Kl=m("div"),Bu=C("Username"),zu=m("br"),Yu=h(),kl=m("input"),Vu=h(),Ql=m("div"),Ku=C("Password"),Qu=m("br"),Xu=h(),wl=m("input"),Zu=h(),Un=m("div"),On=m("div"),Ju=C("Client ID"),xu=m("br"),er=h(),yl=m("input"),tr=h(),qn=m("div"),lr=C("Payload"),nr=m("br"),ir=h(),vt=m("select"),Hn=m("option"),Hn.textContent="JSON",jn=m("option"),jn.textContent="Raw (minimal)",Wn=m("option"),Wn.textContent="Raw (full)",Gn=m("option"),Gn.textContent="Domoticz",Bn=m("option"),Bn.textContent="HomeAssistant",zn=m("option"),zn.textContent="HEX dump",sr=h(),Xl=m("div"),or=C("Publish topic"),ur=m("br"),rr=h(),Cl=m("input"),ar=h(),nt&&nt.c(),Ms=h(),it&&it.c(),As=h(),st&&st.c(),Es=h(),sl=m("div"),ns=m("strong"),ns.textContent="User interface",fr=h(),Yn=m("a"),J(Vn.$$.fragment),cr=h(),_i=m("input"),mr=h(),di=m("div");for(let M=0;MSave',Rs=h(),J(Zl.$$.fragment),Ls=h(),J(Jl.$$.fragment),Us=h(),J(xl.$$.fragment),Os=h(),J(en.$$.fragment),u(i,"class","text-sm"),u(r,"href",Lt("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u($,"name","gh"),u($,"type","text"),u($,"class","in-f w-full"),u($,"pattern","[A-Za-z0-9-]+"),u(I,"name","gt"),u(I,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[13].call(I)),u(b,"class","flex"),u(_,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",te.__value="10YNO-1--------2",te.value=te.__value,le.__value="10YNO-2--------T",le.value=le.__value,de.__value="10YNO-3--------J",de.value=de.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(j,"label","Norway"),$e.__value="10Y1001A1001A44P",$e.value=$e.__value,Fe.__value="10Y1001A1001A45N",Fe.value=Fe.__value,ve.__value="10Y1001A1001A46L",ve.value=ve.__value,Pe.__value="10Y1001A1001A47J",Pe.value=Pe.__value,u(Ie,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(De,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,Q.__value="10YBE----------2",Q.value=Q.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,Ne.__value="10Y1001A1001A39I",Ne.value=Ne.__value,Me.__value="10YFI-1--------U",Me.value=Me.__value,he.__value="10YFR-RTE------C",he.value=he.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,_e.__value="10YGB----------A",_e.value=_e.__value,Ue.__value="10YLV-1001A00074",Ue.value=Ue.__value,je.__value="10YLT-1001A0008Q",je.value=je.__value,Ke.__value="10YNL----------L",Ke.value=Ke.__value,Re.__value="10YPL-AREA-----S",Re.value=Re.__value,He.__value="10YCH-SWISSGRIDZ",He.value=He.__value,u(W,"name","pr"),u(W,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[14].call(W)),u(O,"class","w-full"),u(ft,"name","pc"),u(ft,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[15].call(ft)),u(z,"class","flex"),u(q,"class","my-1"),u(Oe,"name","pf"),u(Oe,"type","number"),u(Oe,"min","0.001"),u(Oe,"max","65"),u(Oe,"step","0.001"),u(Oe,"class","in-f tr w-full"),u(dt,"class","w-1/2"),u(be,"name","pm"),u(be,"type","number"),u(be,"min","0.001"),u(be,"max","1000"),u(be,"step","0.001"),u(be,"class","in-l tr w-full"),u(Ge,"class","w-1/2"),u(qt,"class","flex"),u(ml,"class","my-1"),u(Tt,"type","checkbox"),u(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,u(Tt,"class","rounded mb-1"),u(pl,"class","my-1"),Be.__value=0,Be.value=Be.__value,dl.__value=1,dl.value=dl.__value,Ht.__value=2,Ht.value=Ht.__value,u(St,"name","gs"),u(St,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[20].call(St)),u(_l,"class","my-1"),u(n,"class","cnt"),u(an,"class","text-sm"),u(fn,"href",Lt("Meter-configuration")),u(fn,"target","_blank"),u(fn,"class","float-right"),u(ri,"type","hidden"),u(ri,"name","m"),ri.value="true",u(Li,"class","float-right"),u(jt,"name","mi"),jt.__value="true",jt.value=jt.__value,u(jt,"type","checkbox"),u(jt,"class","rounded mb-1"),u(ai,"class","mt-2 ml-3 whitespace-nowrap"),Nl.__value=0,Nl.value=Nl.__value,Nl.disabled=Ui=t[3].m.b!=0,u(tl,"name","mb"),u(tl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[24].call(tl)),Ml.__value=0,Ml.value=Ml.__value,Ml.disabled=Oi=t[3].m.b!=0,mn.__value=2,mn.value=mn.__value,pn.__value=3,pn.value=pn.__value,_n.__value=10,_n.value=_n.__value,dn.__value=11,dn.value=dn.__value,u(mt,"name","mp"),u(mt,"class","in-m"),mt.disabled=qi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[25].call(mt)),u(Dt,"name","ms"),u(Dt,"type","number"),u(Dt,"min",64),u(Dt,"max",4096),u(Dt,"step",64),u(Dt,"class","in-l tr w-1/2"),u(Pl,"class","flex w-full"),u(el,"class","my-1"),vn.__value=2,vn.value=vn.__value,hn.__value=1,hn.value=hn.__value,u(ll,"name","md"),u(ll,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[27].call(ll)),u(ql,"class","my-1"),u(Wt,"name","mf"),u(Wt,"type","number"),u(Wt,"min","5"),u(Wt,"max","65535"),u(Wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(gn,"class","flex"),u(Hl,"class","mx-1"),u(Gt,"name","mr"),u(Gt,"type","number"),u(Gt,"min","0"),u(Gt,"max","65535"),u(Gt,"class","in-f tr w-full"),u(ji,"class","in-post"),u(kn,"class","flex"),u(jl,"class","mx-1"),u(bn,"class","my-1 flex"),u($s,"class","my-1"),u(Bt,"type","checkbox"),u(Bt,"name","me"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(Wl,"class","my-1"),u(zt,"type","checkbox"),u(zt,"name","mm"),zt.__value="true",zt.value=zt.__value,u(zt,"class","rounded mb-1"),u(Ae,"class","cnt"),u(Bi,"class","text-sm"),u(wn,"href",Lt("WiFi-configuration")),u(wn,"target","_blank"),u(wn,"class","float-right"),u(fi,"type","hidden"),u(fi,"name","w"),fi.value="true",u(vl,"name","ws"),u(vl,"type","text"),u(vl,"class","in-s"),u(Gl,"class","my-1"),u(hl,"name","wp"),u(hl,"type","password"),u(hl,"class","in-s"),u(Bl,"class","my-1"),$n.__value=255,$n.value=$n.__value,Tn.__value=0,Tn.value=Tn.__value,Sn.__value=1,Sn.value=Sn.__value,Pn.__value=2,Pn.value=Pn.__value,u(Et,"name","wz"),u(Et,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[40].call(Et)),u(zl,"class","w-1/2"),u(It,"name","ww"),u(It,"type","number"),u(It,"min","0"),u(It,"max","20.5"),u(It,"step","0.5"),u(It,"class","in-f tr w-full"),u(zi,"class","in-post"),u(Nn,"class","flex"),u(Yl,"class","ml-2 w-1/2"),u(Cn,"class","my-1 flex"),u(Yt,"type","checkbox"),u(Yt,"name","wa"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"class","rounded mb-1"),u(Yi,"class","my-3"),u(ct,"class","cnt"),u(Ki,"class","text-sm"),u(Mn,"href",Lt("Network-configuration")),u(Mn,"target","_blank"),u(Mn,"class","float-right"),Dn.__value="dhcp",Dn.value=Dn.__value,En.__value="static",En.value=En.__value,u(nl,"name","nm"),u(nl,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[43].call(nl)),u(Pt,"name","ni"),u(Pt,"type","text"),u(Pt,"class","in-m w-full"),Pt.disabled=Qi=t[3].n.m=="dhcp",Pt.required=Xi=t[3].n.m=="static",u(Nt,"name","ns"),u(Nt,"class","in-l"),Nt.disabled=Zi=t[3].n.m=="dhcp",Nt.required=Ji=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[45].call(Nt)),u(Al,"class","flex"),u(Vl,"class","my-1"),u(Vt,"name","nd"),Vt.__value="true",Vt.value=Vt.__value,u(Vt,"type","checkbox"),u(Vt,"class","rounded mb-1"),u(xi,"class","my-1"),u(ci,"type","hidden"),u(ci,"name","ntp"),ci.value="true",u(Kt,"name","ntpd"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"type","checkbox"),u(Kt,"class","rounded mb-1"),u(mi,"class","ml-4"),u(bl,"name","ntph"),u(bl,"type","text"),u(bl,"class","in-s"),u(ts,"class","flex"),u(Dl,"class","my-1"),u(rt,"class","cnt"),u(ls,"class","text-sm"),u(Fn,"href",Lt("MQTT-configuration")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(pi,"type","hidden"),u(pi,"name","q"),pi.value="true",u(gl,"name","qh"),u(gl,"type","text"),u(gl,"class","in-f w-3/4"),u(Qt,"name","qp"),u(Qt,"type","number"),u(Qt,"min","1024"),u(Qt,"max","65535"),u(Qt,"class","in-l tr w-1/4"),u(Ln,"class","flex"),u(il,"class","my-1"),u(kl,"name","qu"),u(kl,"type","text"),u(kl,"class","in-s"),u(Kl,"class","my-1"),u(wl,"name","qa"),u(wl,"type","password"),u(wl,"class","in-s"),u(Ql,"class","my-1"),u(yl,"name","qc"),u(yl,"type","text"),u(yl,"class","in-f w-full"),Hn.__value=0,Hn.value=Hn.__value,jn.__value=1,jn.value=jn.__value,Wn.__value=2,Wn.value=Wn.__value,Gn.__value=3,Gn.value=Gn.__value,Bn.__value=4,Bn.value=Bn.__value,zn.__value=255,zn.value=zn.__value,u(vt,"name","qm"),u(vt,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[58].call(vt)),u(Un,"class","my-1 flex"),u(Cl,"name","qb"),u(Cl,"type","text"),u(Cl,"class","in-s"),u(Xl,"class","my-1"),u(Ye,"class","cnt"),u(ns,"class","text-sm"),u(Yn,"href",Lt("User-interface")),u(Yn,"target","_blank"),u(Yn,"class","float-right"),u(_i,"type","hidden"),u(_i,"name","u"),_i.value="true",u(di,"class","flex flex-wrap"),u(sl,"class","cnt"),u(is,"class","text-sm"),u(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Kn,"target","_blank"),u(Kn,"class","float-right"),u(vi,"type","hidden"),u(vi,"name","d"),vi.value="true",u(Xt,"type","checkbox"),u(Xt,"name","ds"),Xt.__value="true",Xt.value=Xt.__value,u(Xt,"class","rounded mb-1"),u(ss,"class","mt-3"),u(Mt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Xn,"type","button"),u(Xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Zn,"type","button"),u(Zn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(us,"class","text-center"),u(rs,"class","text-right"),u(El,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(M,ee){y(M,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),X(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,b),s(b,d),s(d,v),s(d,g),s(d,k),s(d,$),V($,t[3].g.h),s(b,T),s(b,P),s(P,E),s(P,S),s(P,A),s(P,I),X(F,I,null),Le(I,t[3].g.t,!0),s(n,Y),s(n,U),s(n,R),s(n,q),s(q,z),s(z,O),s(O,H),s(O,G),s(O,L),s(O,W),s(W,j),s(j,te),s(j,le),s(j,de),s(j,ie),s(j,we),s(W,Ie),s(Ie,$e),s(Ie,Fe),s(Ie,ve),s(Ie,Pe),s(W,De),s(De,me),s(De,se),s(W,pe),s(W,Q),s(W,oe),s(W,Ne),s(W,Me),s(W,he),s(W,x),s(W,_e),s(W,Ue),s(W,je),s(W,Ke),s(W,Re),s(W,He),Le(W,t[3].p.r,!0),s(z,re),s(z,ge),s(ge,Ot),s(ge,Ol),s(ge,xt),s(ge,ft);for(let at=0;at<4;at+=1)hi[at]&&hi[at].m(ft,null);Le(ft,t[3].p.c,!0),s(n,Sl),s(n,ml),s(ml,qt),s(qt,dt),s(dt,Qe),s(dt,Xe),s(dt,Ze),s(dt,Oe),V(Oe,t[3].p.f),s(qt,Je),s(qt,Ge),s(Ge,xe),s(Ge,et),s(Ge,ue),s(Ge,be),V(be,t[3].p.m),s(n,Pi),s(n,pl),s(pl,rn),s(rn,Tt),Tt.checked=t[3].p.e,s(rn,Ni),s(pl,Mi),ht&&ht.m(pl,null),s(n,Ai),s(n,_l),s(_l,Di),s(_l,Ei),s(_l,Ii),s(_l,St),s(St,Be),s(St,dl),s(St,Ht),Le(St,t[3].g.s,!0),s(n,ys),bt&&bt.m(n,null),s(l,Fi),s(l,Ae),s(Ae,an),s(Ae,Ri),s(Ae,fn),X(cn,fn,null),s(Ae,ko),s(Ae,ri),s(Ae,wo),s(Ae,el),s(el,Li),s(el,yo),s(el,Cs),s(el,Co),s(el,ai),s(ai,jt),jt.checked=t[3].m.i,s(ai,$o),s(el,To),s(el,Pl),s(Pl,tl),s(tl,Nl),s(Nl,So);for(let at=0;at<7;at+=1)bi[at]&&bi[at].m(tl,null);Le(tl,t[3].m.b,!0),s(Pl,Po),s(Pl,mt),s(mt,Ml),s(Ml,No),s(mt,mn),s(mt,pn),s(mt,_n),s(mt,dn),Le(mt,t[3].m.p,!0),s(Pl,Mo),s(Pl,Dt),V(Dt,t[3].m.s),s(Ae,Ao),s(Ae,ql),s(ql,Do),s(ql,Eo),s(ql,Io),s(ql,ll),s(ll,vn),s(ll,hn),Le(ll,t[3].m.d,!0),s(Ae,Fo),s(Ae,bn),s(bn,Hl),s(Hl,Ro),s(Hl,Lo),s(Hl,Uo),s(Hl,gn),s(gn,Wt),V(Wt,t[3].m.f),s(gn,Oo),s(gn,Hi),s(bn,qo),s(bn,jl),s(jl,Ho),s(jl,jo),s(jl,Wo),s(jl,kn),s(kn,Gt),V(Gt,t[3].m.r),s(kn,Go),s(kn,ji),s(Ae,Bo),s(Ae,$s),s(Ae,zo),s(Ae,Wl),s(Wl,Wi),s(Wi,Bt),Bt.checked=t[3].m.e.e,s(Wi,Yo),s(Wl,Vo),gt&>.m(Wl,null),s(Ae,Ko),kt&&kt.m(Ae,null),s(Ae,Ts),s(Ae,Gi),s(Gi,zt),zt.checked=t[3].m.m.e,s(Gi,Qo),s(Ae,Xo),wt&&wt.m(Ae,null),s(l,Zo),s(l,ct),s(ct,Bi),s(ct,Jo),s(ct,wn),X(yn,wn,null),s(ct,xo),s(ct,fi),s(ct,eu),s(ct,Gl),s(Gl,tu),s(Gl,lu),s(Gl,nu),s(Gl,vl),V(vl,t[3].w.s),s(ct,iu),s(ct,Bl),s(Bl,su),s(Bl,ou),s(Bl,uu),s(Bl,hl),V(hl,t[3].w.p),s(ct,ru),s(ct,Cn),s(Cn,zl),s(zl,au),s(zl,fu),s(zl,cu),s(zl,Et),s(Et,$n),s(Et,Tn),s(Et,Sn),s(Et,Pn),Le(Et,t[3].w.z,!0),s(Cn,mu),s(Cn,Yl),s(Yl,pu),s(Yl,_u),s(Yl,du),s(Yl,Nn),s(Nn,It),V(It,t[3].w.w),s(Nn,vu),s(Nn,zi),s(ct,hu),s(ct,Yi),s(Yi,Vi),s(Vi,Yt),Yt.checked=t[3].w.a,s(Vi,bu),s(l,gu),s(l,rt),s(rt,Ki),s(rt,ku),s(rt,Mn),X(An,Mn,null),s(rt,wu),s(rt,Vl),s(Vl,yu),s(Vl,Cu),s(Vl,$u),s(Vl,Al),s(Al,nl),s(nl,Dn),s(nl,En),Le(nl,t[3].n.m,!0),s(Al,Tu),s(Al,Pt),V(Pt,t[3].n.i),s(Al,Su),s(Al,Nt),X(In,Nt,null),Le(Nt,t[3].n.s,!0),s(rt,Pu),yt&&yt.m(rt,null),s(rt,Ss),s(rt,xi),s(xi,es),s(es,Vt),Vt.checked=t[3].n.d,s(es,Nu),s(rt,Mu),s(rt,ci),s(rt,Au),s(rt,Dl),s(Dl,Du),s(Dl,mi),s(mi,Kt),Kt.checked=t[3].n.h,s(mi,Eu),s(Dl,Iu),s(Dl,Fu),s(Dl,ts),s(ts,bl),V(bl,t[3].n.n1),s(l,Ru),s(l,Ye),s(Ye,ls),s(Ye,Lu),s(Ye,Fn),X(Rn,Fn,null),s(Ye,Uu),s(Ye,pi),s(Ye,Ou),s(Ye,il),s(il,qu),Ct&&Ct.m(il,null),s(il,Ps),s(il,Hu),s(il,ju),s(il,Ln),s(Ln,gl),V(gl,t[3].q.h),s(Ln,Wu),s(Ln,Qt),V(Qt,t[3].q.p),s(Ye,Gu),lt&<.m(Ye,null),s(Ye,Ns),s(Ye,Kl),s(Kl,Bu),s(Kl,zu),s(Kl,Yu),s(Kl,kl),V(kl,t[3].q.u),s(Ye,Vu),s(Ye,Ql),s(Ql,Ku),s(Ql,Qu),s(Ql,Xu),s(Ql,wl),V(wl,t[3].q.a),s(Ye,Zu),s(Ye,Un),s(Un,On),s(On,Ju),s(On,xu),s(On,er),s(On,yl),V(yl,t[3].q.c),s(Un,tr),s(Un,qn),s(qn,lr),s(qn,nr),s(qn,ir),s(qn,vt),s(vt,Hn),s(vt,jn),s(vt,Wn),s(vt,Gn),s(vt,Bn),s(vt,zn),Le(vt,t[3].q.m,!0),s(Ye,sr),s(Ye,Xl),s(Xl,or),s(Xl,ur),s(Xl,rr),s(Xl,Cl),V(Cl,t[3].q.b),s(l,ar),nt&&nt.m(l,null),s(l,Ms),it&&it.m(l,null),s(l,As),st&&st.m(l,null),s(l,Es),s(l,sl),s(sl,ns),s(sl,fr),s(sl,Yn),X(Vn,Yn,null),s(sl,cr),s(sl,_i),s(sl,mr),s(sl,di);for(let at=0;at0?bt?bt.p(M,ee):(bt=xa(M),bt.c(),bt.m(n,null)):bt&&(bt.d(1),bt=null),ee[0]&8&&(jt.checked=M[3].m.i),(!Zt||ee[0]&8&&Ui!==(Ui=M[3].m.b!=0))&&(Nl.disabled=Ui),ee[0]&8&&Le(tl,M[3].m.b),(!Zt||ee[0]&8&&Oi!==(Oi=M[3].m.b!=0))&&(Ml.disabled=Oi),(!Zt||ee[0]&8&&qi!==(qi=M[3].m.b==0))&&(mt.disabled=qi),ee[0]&8&&Le(mt,M[3].m.p),ee[0]&8&&ae(Dt.value)!==M[3].m.s&&V(Dt,M[3].m.s),ee[0]&8&&Le(ll,M[3].m.d),ee[0]&8&&ae(Wt.value)!==M[3].m.f&&V(Wt,M[3].m.f),ee[0]&8&&ae(Gt.value)!==M[3].m.r&&V(Gt,M[3].m.r),ee[0]&8&&(Bt.checked=M[3].m.e.e),M[3].m.e.e?gt?gt.p(M,ee):(gt=ef(M),gt.c(),gt.m(Wl,null)):gt&&(gt.d(1),gt=null),M[3].m.e.e?kt?kt.p(M,ee):(kt=tf(M),kt.c(),kt.m(Ae,Ts)):kt&&(kt.d(1),kt=null),ee[0]&8&&(zt.checked=M[3].m.m.e),M[3].m.m.e?wt?wt.p(M,ee):(wt=lf(M),wt.c(),wt.m(Ae,null)):wt&&(wt.d(1),wt=null),ee[0]&8&&vl.value!==M[3].w.s&&V(vl,M[3].w.s),ee[0]&8&&hl.value!==M[3].w.p&&V(hl,M[3].w.p),ee[0]&8&&Le(Et,M[3].w.z),ee[0]&8&&ae(It.value)!==M[3].w.w&&V(It,M[3].w.w),ee[0]&8&&(Yt.checked=M[3].w.a),ee[0]&8&&Le(nl,M[3].n.m),(!Zt||ee[0]&8&&Qi!==(Qi=M[3].n.m=="dhcp"))&&(Pt.disabled=Qi),(!Zt||ee[0]&8&&Xi!==(Xi=M[3].n.m=="static"))&&(Pt.required=Xi),ee[0]&8&&Pt.value!==M[3].n.i&&V(Pt,M[3].n.i),(!Zt||ee[0]&8&&Zi!==(Zi=M[3].n.m=="dhcp"))&&(Nt.disabled=Zi),(!Zt||ee[0]&8&&Ji!==(Ji=M[3].n.m=="static"))&&(Nt.required=Ji),ee[0]&8&&Le(Nt,M[3].n.s),M[3].n.m=="static"?yt?yt.p(M,ee):(yt=nf(M),yt.c(),yt.m(rt,Ss)):yt&&(yt.d(1),yt=null),ee[0]&8&&(Vt.checked=M[3].n.d),ee[0]&8&&(Kt.checked=M[3].n.h),ee[0]&8&&bl.value!==M[3].n.n1&&V(bl,M[3].n.n1),M[0].chip!="esp8266"?Ct?Ct.p(M,ee):(Ct=sf(M),Ct.c(),Ct.m(il,Ps)):Ct&&(Ct.d(1),Ct=null),ee[0]&8&&gl.value!==M[3].q.h&&V(gl,M[3].q.h),ee[0]&8&&ae(Qt.value)!==M[3].q.p&&V(Qt,M[3].q.p),M[3].q.s.e?lt?(lt.p(M,ee),ee[0]&8&&N(lt,1)):(lt=of(M),lt.c(),N(lt,1),lt.m(Ye,Ns)):lt&&(Te(),D(lt,1,1,()=>{lt=null}),Se()),ee[0]&8&&kl.value!==M[3].q.u&&V(kl,M[3].q.u),ee[0]&8&&wl.value!==M[3].q.a&&V(wl,M[3].q.a),ee[0]&8&&yl.value!==M[3].q.c&&V(yl,M[3].q.c),ee[0]&8&&Le(vt,M[3].q.m),ee[0]&8&&Cl.value!==M[3].q.b&&V(Cl,M[3].q.b),M[3].q.m==3?nt?(nt.p(M,ee),ee[0]&8&&N(nt,1)):(nt=uf(M),nt.c(),N(nt,1),nt.m(l,Ms)):nt&&(Te(),D(nt,1,1,()=>{nt=null}),Se()),M[3].q.m==4?it?(it.p(M,ee),ee[0]&8&&N(it,1)):(it=rf(M),it.c(),N(it,1),it.m(l,As)):it&&(Te(),D(it,1,1,()=>{it=null}),Se()),ee[0]&8&&(Ds=M[3].p.r.startsWith("10YNO")||M[3].p.r=="10Y1001A1001A48H"),Ds?st?(st.p(M,ee),ee[0]&8&&N(st,1)):(st=af(M),st.c(),N(st,1),st.m(l,Es)):st&&(Te(),D(st,1,1,()=>{st=null}),Se()),ee[0]&136){Jn=M[7];let Ft;for(Ft=0;Ft20||M[0].chip=="esp8266"?ot?(ot.p(M,ee),ee[0]&1&&N(ot,1)):(ot=mf(M),ot.c(),N(ot,1),ot.m(l,Is)):ot&&(Te(),D(ot,1,1,()=>{ot=null}),Se()),ee[0]&8&&(Xt.checked=M[3].d.s),M[3].d.s?$t?$t.p(M,ee):($t=bf(M),$t.c(),$t.m(Mt,null)):$t&&($t.d(1),$t=null);const at={};ee[0]&2&&(at.active=M[1]),Zl.$set(at);const Cr={};ee[0]&4&&(Cr.active=M[2]),Jl.$set(Cr);const $r={};ee[0]&16&&($r.active=M[4]),xl.$set($r);const Tr={};ee[0]&32&&(Tr.active=M[5]),en.$set(Tr)},i(M){Zt||(N(a.$$.fragment,M),N(F.$$.fragment,M),N(cn.$$.fragment,M),N(yn.$$.fragment,M),N(An.$$.fragment,M),N(In.$$.fragment,M),N(Rn.$$.fragment,M),N(lt),N(nt),N(it),N(st),N(Vn.$$.fragment,M),N(ot),N(Qn.$$.fragment,M),N(Zl.$$.fragment,M),N(Jl.$$.fragment,M),N(xl.$$.fragment,M),N(en.$$.fragment,M),Zt=!0)},o(M){D(a.$$.fragment,M),D(F.$$.fragment,M),D(cn.$$.fragment,M),D(yn.$$.fragment,M),D(An.$$.fragment,M),D(In.$$.fragment,M),D(Rn.$$.fragment,M),D(lt),D(nt),D(it),D(st),D(Vn.$$.fragment,M),D(ot),D(Qn.$$.fragment,M),D(Zl.$$.fragment,M),D(Jl.$$.fragment,M),D(xl.$$.fragment,M),D(en.$$.fragment,M),Zt=!1},d(M){M&&w(e),Z(a),Z(F),fl(hi,M),ht&&ht.d(),bt&&bt.d(),Z(cn),fl(bi,M),gt&>.d(),kt&&kt.d(),wt&&wt.d(),Z(yn),Z(An),Z(In),yt&&yt.d(),Z(Rn),Ct&&Ct.d(),lt&<.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),Z(Vn),fl(pt,M),ot&&ot.d(),Z(Qn),$t&&$t.d(),M&&w(Rs),Z(Zl,M),M&&w(Ls),Z(Jl,M),M&&w(Us),Z(xl,M),M&&w(Os),Z(en,M),qs=!1,Ve(yr)}}}async function t0(){await(await fetch("/reboot",{method:"POST"})).json()}function l0(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!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},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};Fc.subscribe(Be=>{Be.version&&(l(3,a=Be),l(1,o=!1))}),Ap();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Be=new URLSearchParams;Be.append("perform","true");let Ht=await(await fetch("/reset",{method:"POST",body:Be})).json();l(4,f=!1),l(5,c=Ht.success)}}async function _(Be){l(2,r=!0);const dl=new FormData(Be.target),Ht=new URLSearchParams;for(let Ae of dl){const[an,Ri]=Ae;Ht.append(an,Ri)}let Fi=await(await fetch("/save",{method:"POST",body:Ht})).json();Ut.update(Ae=>(Ae.booting=Fi.reboot,Ae.ui=a.u,Ae)),l(2,r=!1),ni("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(Be=>(Be.booting=!0,Be)),t0())},d=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function k(){a.g.t=_t(this),l(3,a)}function $(){a.p.r=_t(this),l(3,a)}function T(){a.p.c=_t(this),l(3,a)}function P(){a.p.f=ae(this.value),l(3,a)}function E(){a.p.m=ae(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function I(){a.g.s=_t(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function Y(){a.g.p=this.value,l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function R(){a.m.b=_t(this),l(3,a)}function q(){a.m.p=_t(this),l(3,a)}function z(){a.m.s=ae(this.value),l(3,a)}function O(){a.m.d=_t(this),l(3,a)}function H(){a.m.f=ae(this.value),l(3,a)}function G(){a.m.r=ae(this.value),l(3,a)}function L(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function j(){a.m.e.a=this.value,l(3,a)}function te(){a.m.m.e=this.checked,l(3,a)}function le(){a.m.m.w=ae(this.value),l(3,a)}function de(){a.m.m.v=ae(this.value),l(3,a)}function ie(){a.m.m.a=ae(this.value),l(3,a)}function we(){a.m.m.c=ae(this.value),l(3,a)}function Ie(){a.w.s=this.value,l(3,a)}function $e(){a.w.p=this.value,l(3,a)}function Fe(){a.w.z=_t(this),l(3,a)}function ve(){a.w.w=ae(this.value),l(3,a)}function Pe(){a.w.a=this.checked,l(3,a)}function De(){a.n.m=_t(this),l(3,a)}function me(){a.n.i=this.value,l(3,a)}function se(){a.n.s=_t(this),l(3,a)}function pe(){a.n.g=this.value,l(3,a)}function Q(){a.n.d1=this.value,l(3,a)}function oe(){a.n.d2=this.value,l(3,a)}function Ne(){a.n.d=this.checked,l(3,a)}function Me(){a.n.h=this.checked,l(3,a)}function he(){a.n.n1=this.value,l(3,a)}function x(){a.q.s.e=this.checked,l(3,a)}function _e(){a.q.h=this.value,l(3,a)}function Ue(){a.q.p=ae(this.value),l(3,a)}function je(){a.q.u=this.value,l(3,a)}function Ke(){a.q.a=this.value,l(3,a)}function Re(){a.q.c=this.value,l(3,a)}function He(){a.q.m=_t(this),l(3,a)}function re(){a.q.b=this.value,l(3,a)}function ge(){a.o.e=this.value,l(3,a)}function Ot(){a.o.c=this.value,l(3,a)}function Ol(){a.o.u1=this.value,l(3,a)}function xt(){a.o.u2=this.value,l(3,a)}function ft(){a.o.u3=this.value,l(3,a)}function Sl(){a.h.t=this.value,l(3,a)}function ml(){a.h.h=this.value,l(3,a)}function qt(){a.h.n=this.value,l(3,a)}function dt(Be){a.t.t[Be]=ae(this.value),l(3,a)}function Qe(){a.t.h=ae(this.value),l(3,a)}function Xe(Be){a.u[Be.key]=_t(this),l(3,a)}function Ze(){a.i.h.u=this.checked,l(3,a)}function Oe(){a.i.h.p=_t(this),l(3,a)}function Je(){a.i.a=ae(this.value),l(3,a)}function Ge(){a.i.l.i=this.checked,l(3,a)}function xe(){a.i.l.p=ae(this.value),l(3,a)}function et(){a.i.r.i=this.checked,l(3,a)}function ue(){a.i.r.r=ae(this.value),l(3,a)}function be(){a.i.r.g=ae(this.value),l(3,a)}function Pi(){a.i.r.b=ae(this.value),l(3,a)}function pl(){a.i.t.d=ae(this.value),l(3,a)}function rn(){a.i.t.a=ae(this.value),l(3,a)}function Tt(){a.i.v.p=ae(this.value),l(3,a)}function Ni(){a.i.v.d.v=ae(this.value),l(3,a)}function Mi(){a.i.v.d.g=ae(this.value),l(3,a)}function Ai(){a.i.v.o=ae(this.value),l(3,a)}function _l(){a.i.v.m=ae(this.value),l(3,a)}function Di(){a.i.v.b=ae(this.value),l(3,a)}function Ei(){a.d.s=this.checked,l(3,a)}function Ii(){a.d.t=this.checked,l(3,a)}function St(){a.d.l=_t(this),l(3,a)}return t.$$set=Be=>{"sysinfo"in Be&&l(0,n=Be.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,v,i,p,_,b,d,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Fe,ve,Pe,De,me,se,pe,Q,oe,Ne,Me,he,x,_e,Ue,je,Ke,Re,He,re,ge,Ot,Ol,xt,ft,Sl,ml,qt,dt,Qe,Xe,Ze,Oe,Je,Ge,xe,et,ue,be,Pi,pl,rn,Tt,Ni,Mi,Ai,_l,Di,Ei,Ii,St]}class n0 extends Ce{constructor(e){super(),ye(this,e,l0,e0,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function kf(t,e,l){const n=t.slice();return n[20]=e[l],n}function i0(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function wf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,p,_,b,d=Gr(t[1])+"",v,g,k=t[1].boot_reason+"",$,T,P=t[1].ex_cause+"",E,S,A;const I=[o0,s0],F=[];function Y(U,R){return U[0].u>0?0:1}return f=Y(t),c=F[f]=I[f](t),{c(){e=m("div"),l=C("AP MAC: "),i=C(n),o=h(),r=m("div"),a=C(`Last boot: - `),c.c(),p=h(),_=m("div"),b=C("Reason: "),v=C(d),g=C(" ("),$=C(k),T=C("/"),E=C(P),S=C(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(_,"class","my-2")},m(U,R){y(U,e,R),s(e,l),s(e,i),y(U,o,R),y(U,r,R),s(r,a),F[f].m(r,null),y(U,p,R),y(U,_,R),s(_,b),s(_,v),s(_,g),s(_,$),s(_,T),s(_,E),s(_,S),A=!0},p(U,R){(!A||R&2)&&n!==(n=U[1].apmac+"")&&B(i,n);let q=f;f=Y(U),f===q?F[f].p(U,R):(Te(),D(F[q],1,1,()=>{F[q]=null}),Se(),c=F[f],c?c.p(U,R):(c=F[f]=I[f](U),c.c()),N(c,1),c.m(r,null)),(!A||R&2)&&d!==(d=Gr(U[1])+"")&&B(v,d),(!A||R&2)&&k!==(k=U[1].boot_reason+"")&&B($,k),(!A||R&2)&&P!==(P=U[1].ex_cause+"")&&B(E,P)},i(U){A||(N(c),A=!0)},o(U){D(c),A=!1},d(U){U&&w(e),U&&w(o),U&&w(r),F[f].d(),U&&w(p),U&&w(_)}}}function s0(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ne,i:ne,o:ne,d(l){l&&w(e)}}}function o0(t){let e,l;return e=new Dc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function u0(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ne,d(l){l&&w(e)}}}function yf(t){let e,l,n,i,o,r=bs(t[1].meter.mfg)+"",a,f,c,p,_=t[1].meter.model+"",b,d,v,g,k=t[1].meter.id+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=C("Manufacturer: "),a=C(r),f=h(),c=m("div"),p=C("Model: "),b=C(_),d=h(),v=m("div"),g=C("ID: "),$=C(k),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$)},p(T,P){P&2&&r!==(r=bs(T[1].meter.mfg)+"")&&B(a,r),P&2&&_!==(_=T[1].meter.model+"")&&B(b,_),P&2&&k!==(k=T[1].meter.id+"")&&B($,k)},d(T){T&&w(e)}}}function Cf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",b,d,v,g,k=t[1].net.gw+"",$,T,P,E,S=t[1].net.dns1+"",A,I,F=t[1].net.dns2&&$f(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=C("IP: "),a=C(r),f=h(),c=m("div"),p=C("Mask: "),b=C(_),d=h(),v=m("div"),g=C("Gateway: "),$=C(k),T=h(),P=m("div"),E=C("DNS: "),A=C(S),I=h(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(Y,U){y(Y,e,U),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$),s(e,T),s(e,P),s(P,E),s(P,A),s(P,I),F&&F.m(P,null)},p(Y,U){U&2&&r!==(r=Y[1].net.ip+"")&&B(a,r),U&2&&_!==(_=Y[1].net.mask+"")&&B(b,_),U&2&&k!==(k=Y[1].net.gw+"")&&B($,k),U&2&&S!==(S=Y[1].net.dns1+"")&&B(A,S),Y[1].net.dns2?F?F.p(Y,U):(F=$f(Y),F.c(),F.m(P,null)):F&&(F.d(1),F=null)},d(Y){Y&&w(e),F&&F.d()}}}function $f(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function Tf(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",f,c,p=t[1].upgrade.x+"",_,b,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=C("Previous upgrade attempt ("),o=C(i),r=C(") does not match current version ("),f=C(a),c=C(") ["),_=C(p),b=C("/"),v=C(d),g=C("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(k,$){y(k,e,$),s(e,l),s(l,n),s(l,o),s(l,r),s(l,f),s(l,c),s(l,_),s(l,b),s(l,v),s(l,g)},p(k,$){$&2&&i!==(i=k[1].upgrade.t+"")&&B(o,i),$&2&&a!==(a=k[1].version+"")&&B(f,a),$&2&&p!==(p=k[1].upgrade.x+"")&&B(_,p),$&2&&d!==(d=k[1].upgrade.e+"")&&B(v,d)},d(k){k&&w(e)}}}function Sf(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Pf(t),b=t[1].fwconsent===2&&Nf();return{c(){e=m("div"),l=C(`Latest version: - `),n=m("a"),o=C(i),a=h(),_&&_.c(),f=h(),b&&b.c(),c=We(),u(n,"href",r=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(d,v){y(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),y(d,f,v),b&&b.m(d,v),y(d,c,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&B(o,i),(!p||v&4&&r!==(r=d[2].html_url))&&u(n,"href",r),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&N(_,1)):(_=Pf(d),_.c(),N(_,1),_.m(e,null)):_&&(Te(),D(_,1,1,()=>{_=null}),Se()),d[1].fwconsent===2?b||(b=Nf(),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i(d){p||(N(_),p=!0)},o(d){D(_),p=!1},d(d){d&&w(e),_&&_.d(),d&&w(f),b&&b.d(d),d&&w(c)}}}function Pf(t){let e,l,n,i,o,r;return n=new Ec({}),{c(){e=m("div"),l=m("button"),J(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(a,f){y(a,e,f),s(e,l),X(n,l,null),i=!0,o||(r=K(l,"click",t[10]),o=!0)},p:ne,i(a){i||(N(n.$$.fragment,a),i=!0)},o(a){D(n.$$.fragment,a),i=!1},d(a){a&&w(e),Z(n),o=!1,r()}}}function Nf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Mf(t){let e,l=gs(fe(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=gs(fe(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function Af(t){let e,l,n,i,o,r;function a(p,_){return p[4].length==0?a0:r0}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),c.c(),zf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){y(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(r=[K(n,"change",t[13]),K(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&w(e),t[12](null),c.d(),o=!1,Ve(r)}}}function r0(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function a0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=K(e,"click",t[14]),l=!0)},p:ne,d(i){i&&w(e),l=!1,n()}}}function Df(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g=t[9],k=[];for(let S=0;S Include Secrets
(SSID, PSK, passwords and tokens)',f=h(),$&&$.c(),c=h(),p=m("form"),_=m("input"),b=h(),E.c(),u(l,"class","text-sm"),u(a,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),zf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(S,A){y(S,e,A),s(e,l),s(e,n),s(e,i),s(i,o);for(let I=0;I{me=null}),Se());const je={};_e&8388608&&(je.$$scope={dirty:_e,ctx:x}),S.$set(je),x[1].meter?se?se.p(x,_e):(se=yf(x),se.c(),se.m(e,Y)):se&&(se.d(1),se=null),x[1].net?pe?pe.p(x,_e):(pe=Cf(x),pe.c(),pe.m(e,U)):pe&&(pe.d(1),pe=null),(!ve||_e&2)&&G!==(G=x[1].version+"")&&B(L,G),x[1].upgrade.t&&x[1].upgrade.t!=x[1].version?Q?Q.p(x,_e):(Q=Tf(x),Q.c(),Q.m(R,j)):Q&&(Q.d(1),Q=null),x[2]?oe?(oe.p(x,_e),_e&4&&N(oe,1)):(oe=Sf(x),oe.c(),N(oe,1),oe.m(R,te)):oe&&(Te(),D(oe,1,1,()=>{oe=null}),Se()),_e&3&&(le=(x[1].security==0||x[0].a)&&ii(x[1].board)),le?Ne?Ne.p(x,_e):(Ne=Mf(x),Ne.c(),Ne.m(R,de)):Ne&&(Ne.d(1),Ne=null),x[1].security==0||x[0].a?Me?Me.p(x,_e):(Me=Af(x),Me.c(),Me.m(R,null)):Me&&(Me.d(1),Me=null),x[1].security==0||x[0].a?he?he.p(x,_e):(he=Df(x),he.c(),he.m(e,null)):he&&(he.d(1),he=null);const Ke={};_e&32&&(Ke.active=x[5]),Ie.$set(Ke);const Re={};_e&256&&(Re.active=x[8]),Fe.$set(Re)},i(x){ve||(N(b.$$.fragment,x),N(me),N(S.$$.fragment,x),N(oe),N(Ie.$$.fragment,x),N(Fe.$$.fragment,x),ve=!0)},o(x){D(b.$$.fragment,x),D(me),D(S.$$.fragment,x),D(oe),D(Ie.$$.fragment,x),D(Fe.$$.fragment,x),ve=!1},d(x){x&&w(e),Z(b),me&&me.d(),Z(S),se&&se.d(),pe&&pe.d(),Q&&Q.d(),oe&&oe.d(),Ne&&Ne.d(),Me&&Me.d(),he&&he.d(),x&&w(we),Z(Ie,x),x&&w($e),Z(Fe,x),Pe=!1,De()}}}async function p0(){await(await fetch("/reboot",{method:"POST"})).json()}function _0(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],r={};bo.subscribe(I=>{l(2,r=Ac(i.version,I)),r||l(2,r=I[0])});function a(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(gs(fe(i.chip,i.board))))&&(Ut.update(I=>(I.upgrading=!0,I)),Mc(r.tag_name))}const f=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(I=>(I.booting=!0,I)),p0())};let c,p=[],_=!1,b,d=[],v=!1;_o();function g(I){vs[I?"unshift":"push"](()=>{c=I,l(3,c)})}function k(){p=this.files,l(4,p)}const $=()=>{c.click()},T=()=>l(5,_=!0);function P(I){vs[I?"unshift":"push"](()=>{b=I,l(6,b)})}function E(){d=this.files,l(7,d)}const S=()=>{b.click()},A=()=>l(8,v=!0);return t.$$set=I=>{"data"in I&&l(0,n=I.data),"sysinfo"in I&&l(1,i=I.sysinfo)},[n,i,r,c,p,_,b,d,v,o,a,f,g,k,$,T,P,E,S,A]}class d0 extends Ce{constructor(e){super(),ye(this,e,_0,m0,ke,{data:0,sysinfo:1})}}function Ff(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],5)+"",a,f,c=fe(t[0],4)+"",p,_,b=fe(t[0],3)+"",d,v,g,k,$=fe(t[0],2)+"",T,P,E=fe(t[0],1)+"",S,A,I=fe(t[0],0)+"",F,Y,U,R,q=fe(t[0],101)+"",z,O,H=fe(t[0],100)+"",G;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),v=h(),g=m("optgroup"),k=m("option"),T=C($),P=m("option"),S=C(E),A=m("option"),F=C(I),Y=h(),U=m("optgroup"),R=m("option"),z=C(q),O=m("option"),G=C(H),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,P.__value=1,P.value=P.__value,A.__value=0,A.value=A.__value,u(g,"label","Custom hardware"),R.__value=101,R.value=R.__value,O.__value=100,O.value=O.__value,u(U,"label","Generic hardware")},m(L,W){y(L,e,W),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),y(L,v,W),y(L,g,W),s(g,k),s(k,T),s(g,P),s(P,S),s(g,A),s(A,F),y(L,Y,W),y(L,U,W),s(U,R),s(R,z),s(U,O),s(O,G)},p(L,W){W&1&&n!==(n=fe(L[0],7)+"")&&B(i,n),W&1&&r!==(r=fe(L[0],5)+"")&&B(a,r),W&1&&c!==(c=fe(L[0],4)+"")&&B(p,c),W&1&&b!==(b=fe(L[0],3)+"")&&B(d,b),W&1&&$!==($=fe(L[0],2)+"")&&B(T,$),W&1&&E!==(E=fe(L[0],1)+"")&&B(S,E),W&1&&I!==(I=fe(L[0],0)+"")&&B(F,I),W&1&&q!==(q=fe(L[0],101)+"")&&B(z,q),W&1&&H!==(H=fe(L[0],100)+"")&&B(G,H)},d(L){L&&w(e),L&&w(v),L&&w(g),L&&w(Y),L&&w(U)}}}function Rf(t){let e,l,n=fe(t[0],201)+"",i,o,r=fe(t[0],202)+"",a,f,c=fe(t[0],203)+"",p,_,b=fe(t[0],200)+"",d;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(v,g){y(v,e,g),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d)},p(v,g){g&1&&n!==(n=fe(v[0],201)+"")&&B(i,n),g&1&&r!==(r=fe(v[0],202)+"")&&B(a,r),g&1&&c!==(c=fe(v[0],203)+"")&&B(p,c),g&1&&b!==(b=fe(v[0],200)+"")&&B(d,b)},d(v){v&&w(e)}}}function Lf(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],6)+"",a,f,c=fe(t[0],5)+"",p,_,b,d,v=fe(t[0],51)+"",g,k,$=fe(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=h(),b=m("optgroup"),d=m("option"),g=C(v),k=m("option"),T=C($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,u(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,k.__value=50,k.value=k.__value,u(b,"label","Generic hardware")},m(P,E){y(P,e,E),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),y(P,_,E),y(P,b,E),s(b,d),s(d,g),s(b,k),s(k,T)},p(P,E){E&1&&n!==(n=fe(P[0],7)+"")&&B(i,n),E&1&&r!==(r=fe(P[0],6)+"")&&B(a,r),E&1&&c!==(c=fe(P[0],5)+"")&&B(p,c),E&1&&v!==(v=fe(P[0],51)+"")&&B(g,v),E&1&&$!==($=fe(P[0],50)+"")&&B(T,$)},d(P){P&&w(e),P&&w(_),P&&w(b)}}}function Uf(t){let e,l,n=fe(t[0],8)+"",i,o,r,a,f=fe(t[0],71)+"",c,p,_=fe(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=h(),r=m("optgroup"),a=m("option"),c=C(f),p=m("option"),b=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,u(r,"label","Generic hardware")},m(d,v){y(d,e,v),s(e,l),s(l,i),y(d,o,v),y(d,r,v),s(r,a),s(a,c),s(r,p),s(p,b)},p(d,v){v&1&&n!==(n=fe(d[0],8)+"")&&B(i,n),v&1&&f!==(f=fe(d[0],71)+"")&&B(c,f),v&1&&_!==(_=fe(d[0],70)+"")&&B(b,_)},d(d){d&&w(e),d&&w(o),d&&w(r)}}}function Of(t){let e,l,n=fe(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,r){y(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=fe(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function v0(t){let e,l,n,i,o,r,a,f=t[0]=="esp8266"&&Ff(t),c=t[0]=="esp32"&&Rf(t),p=t[0]=="esp32s2"&&Lf(t),_=t[0]=="esp32c3"&&Uf(t),b=t[0]=="esp32solo"&&Of(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),c&&c.c(),i=h(),p&&p.c(),o=h(),_&&_.c(),r=h(),b&&b.c(),a=We(),e.__value=-1,e.value=e.__value},m(d,v){y(d,e,v),y(d,l,v),f&&f.m(d,v),y(d,n,v),c&&c.m(d,v),y(d,i,v),p&&p.m(d,v),y(d,o,v),_&&_.m(d,v),y(d,r,v),b&&b.m(d,v),y(d,a,v)},p(d,[v]){d[0]=="esp8266"?f?f.p(d,v):(f=Ff(d),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"?c?c.p(d,v):(c=Rf(d),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Lf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Uf(d),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),d[0]=="esp32solo"?b?b.p(d,v):(b=Of(d),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:ne,o:ne,d(d){d&&w(e),d&&w(l),f&&f.d(d),d&&w(n),c&&c.d(d),d&&w(i),p&&p.d(d),d&&w(o),_&&_.d(d),d&&w(r),b&&b.d(d),d&&w(a)}}}function h0(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class b0 extends Ce{constructor(e){super(),ye(this,e,h0,v0,ke,{chip:0})}}function qf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Hf(t){let e,l,n,i,o,r,a;return r=new Rc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=C("HAN GPIO"),n=m("br"),i=h(),o=m("select"),J(r.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),X(r,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),r.$set(p)},i(f){a||(N(r.$$.fragment,f),a=!0)},o(f){D(r.$$.fragment,f),a=!1},d(f){f&&w(e),Z(r)}}}function g0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O=t[0].usrcfg&&qf();v=new b0({props:{chip:t[0].chip}});let H=t[0].board&&t[0].board>20&&Hf(t);return U=new At({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Initial configuration",a=h(),O&&O.c(),f=h(),c=m("div"),p=C("Board type"),_=m("br"),b=h(),d=m("select"),J(v.$$.fragment),g=h(),H&&H.c(),k=h(),$=m("div"),T=m("label"),P=m("input"),E=C(" Clear all other configuration"),S=h(),A=m("div"),A.innerHTML='',I=h(),F=m("span"),F.textContent="\xA0",Y=h(),J(U.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),t[0].board===void 0&&tt(()=>t[4].call(d)),u(c,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u($,"class","my-3"),u(A,"class","my-3"),u(F,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),O&&O.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,b),s(c,d),X(v,d,null),Le(d,t[0].board,!0),s(n,g),H&&H.m(n,null),s(n,k),s(n,$),s($,T),s(T,P),P.checked=t[2],s(T,E),s(n,S),s(n,A),s(n,I),s(n,F),y(G,Y,L),X(U,G,L),R=!0,q||(z=[K(d,"change",t[4]),K(P,"change",t[5]),K(n,"submit",ks(t[3]))],q=!0)},p(G,[L]){G[0].usrcfg?O||(O=qf(),O.c(),O.m(n,f)):O&&(O.d(1),O=null);const W={};L&1&&(W.chip=G[0].chip),v.$set(W),L&1&&Le(d,G[0].board),G[0].board&&G[0].board>20?H?(H.p(G,L),L&1&&N(H,1)):(H=Hf(G),H.c(),N(H,1),H.m(n,k)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),L&4&&(P.checked=G[2]);const j={};L&2&&(j.active=G[1]),U.$set(j)},i(G){R||(N(v.$$.fragment,G),N(H),N(U.$$.fragment,G),R=!0)},o(G){D(v.$$.fragment,G),D(H),D(U.$$.fragment,G),R=!1},d(G){G&&w(e),O&&O.d(),Z(v),H&&H.d(),G&&w(Y),Z(U,G),q=!1,Ve(z)}}}function k0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let v of p){const[g,k]=v;_.append(g,k)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Ut.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),ni(n.usrcfg?"/":"/setup")}let r=!1;function a(){n.board=_t(this),l(0,n)}function f(){r=this.checked,l(2,r),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,f]}class w0 extends Ce{constructor(e){super(),ye(this,e,k0,g0,ke,{sysinfo:0})}}function jf(t){let e,l,n,i,o,r,a,f;return a=new Lc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),r=m("select"),J(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.required=t[1],u(n,"class","flex")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),s(n,o),s(n,r),X(a,r,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(r.required=c[1])},i(c){f||(N(a.$$.fragment,c),f=!0)},o(c){D(a.$$.fragment,c),f=!1},d(c){c&&w(e),c&&w(l),c&&w(n),Z(a)}}}function Wf(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+Occurred in: ${i}`:"",r=ho(t),a=lc(e)?e(r):e;return`<${r}> ${a}${o}`}const dc=t=>(...e)=>t(v1(...e)),vc=dc(t=>{throw new Error(t)}),ys=dc(console.warn),Ur=4,h1=3,b1=2,g1=1,k1=1;function w1(t,e){const l=t.default?0:pl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ur,u1(i)?o+=k1:r1(i)?o+=b1:ac(i)?o-=Ur+g1:o+=h1,o},0);return{route:t,score:l,index:e}}function y1(t){return t.map(w1).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function hc(t,e){let l,n;const[i]=e.split("?"),o=pl(i),r=o[0]==="",a=y1(t);for(let f=0,c=a.length;f({...p,params:b,uri:$});if(p.default){n=d(e);continue}const v=pl(p.fullPath),g=Math.max(o.length,v.length);let k=0;for(;k{c===".."?f.pop():c!=="."&&f.push(c)}),Ys(`/${f.join("/")}`,n)}function Or(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=pl(e,!0),a=pl(l,!0);for(;r.length;)r[0]!==a[0]&&vc(cn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Ti(...a),hash:n,search:i,state:o}}const qr=t=>t.length===1?"":t,bo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?qr(gi(t,l)):"",r=i?gi(t,0,l):t,a=n?qr(gi(r,e)):"";return{pathname:(n?gi(r,0,e):r)||"/",search:a,hash:o}},$1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function T1(t,e,l){return Ti(l,C1(t,e))}function S1(t,e){const l=_o(a1(t)),n=pl(l,!0),i=pl(e,!0).slice(0,n.length),o=bc({fullPath:l},Ti(...i));return o&&o.uri}const Vs="POP",P1="PUSH",N1="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function M1(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=sc(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?N1:P1,nc(o))r&&ys(_c,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const c={...a,_key:n1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Ks(t),i()}}}function Qs(t,e){return{...bo(e),state:t}}function A1(t="/"){let e=0,l=[Qs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Qs(n,o))},replaceState(n,i,o){l[e]=Qs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const D1=!!(!Hl&&window.document&&window.document.createElement),I1=!Hl&&window.location.origin==="null",gc=M1(D1&&!I1?window:A1()),{navigate:ii}=gc;let Pl=null,kc=!0;function E1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nPl.level||t.level===Pl.level&&E1(t.routerId,Pl.routerId))&&(Pl=t)}function R1(){Pl=null}function L1(){kc=!1}function Hr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=sc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function U1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function O1(t){return/^H[1-6]$/i.test(t.tagName)}function jr(t,e=document){return e.querySelector(t)}function q1(t){let l=jr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!U1(l,t);){if(O1(l))return l;const n=jr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function H1(t){Promise.resolve(oi(t.focusElement)).then(e=>{const l=e||q1(t.id);l||ys(cn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Hr(l)&&Hr(document.documentElement)})}const j1=(t,e,l)=>(n,i)=>xc().then(()=>{if(!Pl||kc){L1();return}if(n&&H1(Pl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Pl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},oi(l));Promise.resolve(p).then(_=>{e.set(_)})}R1()}),Wr="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 W1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Js(t[6],Wr)],i={};for(let o=0;o`Navigated to ${le.uri}`,announcements:!0,...v},$=p,T=_o(p),P=ql(xs),I=ql(ri),S=!P,A=B1(),E=d&&!(I&&!I.manageFocus),F=rt("");rl(t,F,le=>l(0,a=le));const Y=I?I.disableInlineStyles:g,U=rt([]);rl(t,U,le=>l(20,r=le));const R=rt(null);rl(t,R,le=>l(18,i=le));let q=!1;const z=S?0:I.level+1,H=S?rt((()=>Or(Hl?bo(_):b.location,T))()):P;rl(t,H,le=>l(17,n=le));const G=rt(n);rl(t,G,le=>l(19,o=le));const L=j1(k,F,H),W=le=>de=>de.filter(ie=>ie.id!==le);function j(le){if(Hl){if(q)return;const de=bc(le,n.pathname);if(de)return q=!0,de}else U.update(de=>{const ie=W(le.id)(de);return ie.push(le),ie})}function te(le){U.update(W(le))}return!S&&p!==Gr&&ys(cn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(Xc(()=>b.listen(de=>{const ie=Or(de.location,T);G.set(n),H.set(ie)})),wi(xs,H)),wi(ri,{activeRoute:R,registerRoute:j,unregisterRoute:te,manageFocus:E,level:z,id:A,history:S?b:I.history,basepath:S?T:I.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ys(cn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=hc(r,n.pathname);R.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,de=!le&&E,ie=!le||n.pathname!==o.pathname;L(de,ie)}t.$$.dirty[0]&262144&&E&&i&&i.primary&&F1({level:z,routerId:A,route:i})},[a,k,S,A,E,F,Y,U,R,H,G,p,_,b,d,v,g,n,i,o,r,c,f]}class wc extends Ce{constructor(e){super(),ye(this,e,z1,G1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function Si(t,e,l=ri,n=cn){ql(l)||vc(t,o=>`You cannot use ${o} outside of a ${ho(n)}.`,e)}const Y1=t=>{const{subscribe:e}=ql(t);return{subscribe:e}};function yc(){return Si(cc),Y1(xs)}function Cc(){const{history:t}=ql(ri);return t}function $c(){const t=ql(uc);return t?i1(t,e=>e.base):rt("/")}function Tc(){Si(pc);const t=$c(),{basepath:e}=ql(ri);return n=>T1(n,oi(t),e)}function V1(){Si(mc);const t=Tc(),{navigate:e}=Cc();return(n,i)=>{const o=nc(n)?n:t(n);return e(o,i)}}const K1=t=>({params:t&16,location:t&8}),Br=t=>({params:Hl?oi(t[10]):t[4],location:t[3],navigate:t[11]});function zr(t){let e,l;return e=new wc({props:{primary:t[1],$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Q1(t){let e;const l=t[18].default,n=fo(l,t,t[19],Br);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&mo(n,l,i,i[19],e?co(l,i[19],o,K1):po(i[19]),Br)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function X1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Hl?oi(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c{Z(p,1)}),Se()}o?(e=new o(r()),J(e.$$.fragment),N(e.$$.fragment,1),X(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&Z(e,a)}}}function Z1(t){let e,l,n,i;const o=[X1,Q1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function J1(t){let e,l,n,i,o,r=[ni(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{f=null}),Se()),al(i,p=ui(c,[ni(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&w(e),_&&w(l),f&&f.d(_),_&&w(n),_&&w(i)}}}const x1=ic();function em(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Si(Ss,e);const k=x1(),{registerRoute:$,unregisterRoute:T,activeRoute:P,disableInlineStyles:I}=ql(ri);rl(t,P,q=>l(16,r=q));const S=$c();rl(t,S,q=>l(17,f=q));const A=yc();rl(t,A,q=>l(3,a=q));const E=rt(null);let F;const Y=rt(),U=rt({});rl(t,U,q=>l(4,c=q)),wi(uc,Y),wi(s1,U),wi(o1,E);const R=V1();return Hl||Zc(()=>T(k)),t.$$set=q=>{l(24,e=Jt(Jt({},e),gs(q))),l(12,o=ks(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Ti(f,b),O={id:k,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:S1(z,a.pathname),primary:g,focusElement:E};Y.set(O),l(15,F=$(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===k)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=gs(e),[d,g,n,a,c,k,P,I,S,A,U,R,o,b,v,F,r,f,p,_]}class Sl extends Ce{constructor(e){super(),ye(this,e,em,J1,ke,{path:13,component:0,meta:14,primary:1})}}function tm(t){let e,l,n,i;const o=t[13].default,r=fo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=E));const P=Jc(),I=Tc(),{navigate:S}=Cc();function A(E){P("click",E),l1(E)&&(E.preventDefault(),S(n,{state:k,replace:r||g}))}return t.$$set=E=>{l(19,e=Jt(Jt({},e),gs(E))),l(18,p=ks(e,c)),"to"in E&&l(5,v=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,k=E.state),"getProps"in E&&l(8,$=E.getProps),"$$scope"in E&&l(12,d=E.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=I(v,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=bo(n)===$1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(lc($)){const E=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...E}}return p})())},e=gs(e),[n,f,a,T,A,v,g,k,$,o,i,_,d,b]}class Ol extends Ce{constructor(e){super(),ye(this,e,lm,tm,ke,{to:5,replace:6,state:7,getProps:8})}}let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function nm(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Sc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function im(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function De(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 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"}}function Yr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Vr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Kr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function si(t){switch(t){case 2:case 4:case 7:return!0}return!1}function ze(t,e){return t==1||t==2&&e}function Lt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ce(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Qr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ul={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};const Ut=rt(ul);async function go(){ul=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ut.set(ul)}let ds=0,Xr=-127,Zr=null,sm={};const om=oc(sm,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),Xr!=n.t&&(Xr=n.t,setTimeout(Ac,2e3)),Zr!=n.p&&n.pe&&(Zr=n.p,setTimeout(um,1e3)),ul.upgrading?window.location.reload():(!ul||!ul.chip||ul.booting||ds>1&&!si(ul.board))&&(go(),rn&&clearTimeout(rn),rn=setTimeout(ko,2e3),an&&clearTimeout(an),an=setTimeout(wo,3e3));let i=5e3;if(si(ul.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,si(ul.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={};const Pc=rt(lo);async function um(){lo=await(await jl("/energyprice.json")).json(),Pc.set(lo)}let no={},rn;async function ko(){rn&&(clearTimeout(rn),rn=0),no=await(await jl("/dayplot.json")).json(),Nc.set(no);let e=new Date;rn=setTimeout(ko,(60-e.getMinutes())*6e4+20)}const Nc=rt(no,t=>(ko(),function(){}));let io={},an;async function wo(){an&&(clearTimeout(an),an=0),io=await(await jl("/monthplot.json")).json(),Mc.set(io);let e=new Date;an=setTimeout(wo,(24-e.getHours())*36e5+40)}const Mc=rt(io,t=>(wo(),function(){}));let so={};async function Ac(){so=await(await jl("/temperature.json")).json(),Dc.set(so)}const Dc=rt(so,t=>(Ac(),function(){}));let oo={},vs;async function Ic(){vs&&(clearTimeout(vs),vs=0),oo=await(await jl("/tariff.json")).json(),Ec.set(oo);let e=new Date;vs=setTimeout(Ic,(60-e.getMinutes())*6e4+30)}const Ec=rt(oo,t=>function(){});let uo=[];const yo=rt(uo);async function rm(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),yo.set(uo)}function $s(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Fc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Rc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;po&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let $=c.tag_name.substring(1).split(".");parseInt($[0]);let T=parseInt($[1]);parseInt($[2]),g==T&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const am="/github.svg";function Jr(t){let e,l;function n(r,a){return r[1]>1?vm:r[1]>0?dm:r[2]>1?_m:r[2]>0?pm:r[3]>1?mm:r[3]>0?cm:fm}let i=n(t),o=i(t);return{c(){e=C(`Up + `),o.c(),l=We()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function fm(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function cm(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function mm(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function pm(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function _m(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function dm(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function vm(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function hm(t){let e,l=t[0]&&Jr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Jr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function bm(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class gm extends Ce{constructor(e){super(),ye(this,e,bm,hm,ke,{epoch:0})}}function km(t){let e,l,n;return{c(){e=m("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&w(e)}}}function wm(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class cl extends Ce{constructor(e){super(),ye(this,e,wm,km,ke,{color:0,title:1,text:2})}}function ym(t){let e,l=`${De(t[0].getDate())}.${De(t[0].getMonth()+1)}.${t[0].getFullYear()} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${De(i[0].getDate())}.${De(i[0].getMonth()+1)}.${i[0].getFullYear()} ${De(i[0].getHours())}:${De(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function Cm(t){let e=`${De(t[0].getDate())}. ${to[t[0].getMonth()]} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${De(n[0].getDate())}. ${to[n[0].getMonth()]} ${De(n[0].getHours())}:${De(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function $m(t){let e;function l(o,r){return o[2]?Cm:ym}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&w(e)}}}function Tm(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(n.getHours()-n.getUTCHours())%24))},[n,i,r,o]}class Lc extends Ce{constructor(e){super(),ye(this,e,Tm,$m,ke,{timestamp:0,fullTimeColor:1,offset:3})}}function Sm(t){let e,l,n;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&w(e)}}}class Pm extends Ce{constructor(e){super(),ye(this,e,null,Sm,ke,{})}}function Nm(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Mm extends Ce{constructor(e){super(),ye(this,e,null,Nm,ke,{})}}function Am(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Rt extends Ce{constructor(e){super(),ye(this,e,null,Am,ke,{})}}function Dm(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Uc extends Ce{constructor(e){super(),ye(this,e,null,Dm,ke,{})}}function Im(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=m("span"),i=C(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function xr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function ea(t){let e,l="HAN: "+Yr(t[0].he),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Yr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function ta(t){let e,l="MQTT: "+Vr(t[0].me),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Vr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function la(t){let e,l="PriceAPI: "+Kr(t[0].ee),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Kr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function na(t){let e,l,n,i,o,r;return l=new Ol({props:{to:"/configuration",$$slots:{default:[Em]},$$scope:{ctx:t}}}),o=new Ol({props:{to:"/status",$$slots:{default:[Fm]},$$scope:{ctx:t}}}),{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),X(l,e,null),y(a,n,f),y(a,i,f),X(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){D(l.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&w(e),Z(l),a&&w(n),a&&w(i),Z(o)}}}function Em(t){let e,l;return e=new Pm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Fm(t){let e,l;return e=new Mm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function ia(t){let e,l,n,i,o;const r=[Lm,Rm],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){y(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Te(),D(a[_],1,1,()=>{a[_]=null}),Se(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){D(n),o=!1},d(c){c&&w(e),a[l].d()}}}function Rm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=C("New version: "),i=C(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ne,o:ne,d(o){o&&w(e)}}}function Lm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new Uc({}),{c(){e=m("button"),l=m("span"),n=C("New version: "),o=C(i),r=h(),J(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,b){y(_,e,b),s(e,l),s(l,n),s(l,o),s(e,r),X(a,e,null),f=!0,c||(p=K(e,"click",t[3]),c=!0)},p(_,b){(!f||b&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){f||(N(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&w(e),Z(a),c=!1,p()}}}function Um(t){let e,l,n,i,o,r,a,f,c,p,_,b,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee;i=new Ol({props:{to:"/",$$slots:{default:[Im]},$$scope:{ctx:t}}}),f=new gm({props:{epoch:t[0].u}});let ve=t[0].t>-50&&xr(t);T=new cl({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Ul(t[1].booting?2:t[0].em)}}),I=new cl({props:{title:"HAN",text:"HAN",color:Ul(t[1].booting?9:t[0].hm)}}),A=new cl({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[1].booting?9:t[0].wm)}}),F=new cl({props:{title:"MQTT",text:"MQTT",color:Ul(t[1].booting?9:t[0].mm)}});let Pe=(t[0].he<0||t[0].he>0)&&ea(t),Ae=t[0].me<0&&ta(t),me=(t[0].ee>0||t[0].ee<0)&&la(t);te=new Lc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&na(t);Ie=new Rt({});let pe=t[1].fwconsent===1&&t[2]&&ia(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=m("div"),J(f.$$.fragment),c=h(),ve&&ve.c(),p=h(),_=m("div"),b=C("Free mem: "),v=C(d),g=C("kb"),k=h(),$=m("div"),J(T.$$.fragment),P=h(),J(I.$$.fragment),S=h(),J(A.$$.fragment),E=h(),J(F.$$.fragment),Y=h(),Pe&&Pe.c(),U=h(),Ae&&Ae.c(),R=h(),me&&me.c(),q=h(),z=m("div"),O=m("div"),H=m("a"),G=m("img"),W=h(),j=m("div"),J(te.$$.fragment),le=h(),se&&se.c(),de=h(),ie=m("div"),we=m("a"),J(Ie.$$.fragment),$e=h(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u($,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Bc(G.src,L=am)||u(G,"src",L),u(G,"alt","GitHub repo"),u(H,"class","float-right"),u(H,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(H,"target","_blank"),u(H,"rel","noreferrer"),u(H,"aria-label","GitHub"),u(O,"class","flex-none"),u(j,"class","flex-none my-auto px-2"),u(we,"href",Lt("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(z,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(Q,oe){y(Q,e,oe),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,a),X(f,a,null),s(r,c),ve&&ve.m(r,null),s(r,p),s(r,_),s(_,b),s(_,v),s(_,g),s(l,k),s(l,$),X(T,$,null),s($,P),X(I,$,null),s($,S),X(A,$,null),s($,E),X(F,$,null),s(l,Y),Pe&&Pe.m(l,null),s(l,U),Ae&&Ae.m(l,null),s(l,R),me&&me.m(l,null),s(l,q),s(l,z),s(z,O),s(O,H),s(H,G),s(z,W),s(z,j),X(te,j,null),s(z,le),se&&se.m(z,null),s(z,de),s(z,ie),s(ie,we),X(Ie,we,null),s(z,$e),pe&&pe.m(z,null),Ee=!0},p(Q,[oe]){const Ne={};oe&18&&(Ne.$$scope={dirty:oe,ctx:Q}),i.$set(Ne);const Me={};oe&1&&(Me.epoch=Q[0].u),f.$set(Me),Q[0].t>-50?ve?ve.p(Q,oe):(ve=xr(Q),ve.c(),ve.m(r,p)):ve&&(ve.d(1),ve=null),(!Ee||oe&1)&&d!==(d=(Q[0].m?(Q[0].m/1e3).toFixed(1):"-")+"")&&B(v,d);const he={};oe&3&&(he.text=Q[1].booting?"Booting":Q[0].v>2?Q[0].v.toFixed(2)+"V":"ESP"),oe&3&&(he.color=Ul(Q[1].booting?2:Q[0].em)),T.$set(he);const x={};oe&3&&(x.color=Ul(Q[1].booting?9:Q[0].hm)),I.$set(x);const _e={};oe&1&&(_e.text=Q[0].r?Q[0].r.toFixed(0)+"dBm":"WiFi"),oe&3&&(_e.color=Ul(Q[1].booting?9:Q[0].wm)),A.$set(_e);const Le={};oe&3&&(Le.color=Ul(Q[1].booting?9:Q[0].mm)),F.$set(Le),Q[0].he<0||Q[0].he>0?Pe?Pe.p(Q,oe):(Pe=ea(Q),Pe.c(),Pe.m(l,U)):Pe&&(Pe.d(1),Pe=null),Q[0].me<0?Ae?Ae.p(Q,oe):(Ae=ta(Q),Ae.c(),Ae.m(l,R)):Ae&&(Ae.d(1),Ae=null),Q[0].ee>0||Q[0].ee<0?me?me.p(Q,oe):(me=la(Q),me.c(),me.m(l,q)):me&&(me.d(1),me=null);const je={};oe&1&&(je.timestamp=Q[0].c?new Date(Q[0].c*1e3):new Date(0)),oe&2&&(je.offset=Q[1].clock_offset),te.$set(je),Q[1].vndcfg&&Q[1].usrcfg?se?oe&2&&N(se,1):(se=na(Q),se.c(),N(se,1),se.m(z,de)):se&&(Te(),D(se,1,1,()=>{se=null}),Se()),Q[1].fwconsent===1&&Q[2]?pe?(pe.p(Q,oe),oe&6&&N(pe,1)):(pe=ia(Q),pe.c(),N(pe,1),pe.m(z,null)):pe&&(Te(),D(pe,1,1,()=>{pe=null}),Se())},i(Q){Ee||(N(i.$$.fragment,Q),N(f.$$.fragment,Q),N(T.$$.fragment,Q),N(I.$$.fragment,Q),N(A.$$.fragment,Q),N(F.$$.fragment,Q),N(te.$$.fragment,Q),N(se),N(Ie.$$.fragment,Q),N(pe),Ee=!0)},o(Q){D(i.$$.fragment,Q),D(f.$$.fragment,Q),D(T.$$.fragment,Q),D(I.$$.fragment,Q),D(A.$$.fragment,Q),D(F.$$.fragment,Q),D(te.$$.fragment,Q),D(se),D(Ie.$$.fragment,Q),D(pe),Ee=!1},d(Q){Q&&w(e),Z(i),Z(f),ve&&ve.d(),Z(T),Z(I),Z(A),Z(F),Pe&&Pe.d(),Ae&&Ae.d(),me&&me.d(),Z(te),se&&se.d(),Z(Ie),pe&&pe.d()}}}function Om(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!si(i.board)||confirm($s(fe(i.chip,i.board))))&&(Ut.update(a=>(a.upgrading=!0,a)),Fc(o.tag_name))}return Ut.subscribe(a=>{l(1,i=a),a.fwconsent===1&&rm()}),yo.subscribe(a=>{l(2,o=Rc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class qm extends Ce{constructor(e){super(),ye(this,e,Om,Um,ke,{data:0})}}function Hm(t){let e,l,n,i;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"d",Xs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Xs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){y(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=Xs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ne,o:ne,d(o){o&&w(e)}}}function sa(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Xs(t,e,l,n,i){var o=sa(t,e,l,i),r=sa(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function jm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Wm extends Ce{constructor(e){super(),ye(this,e,jm,Hm,ke,{pct:0,color:1})}}function oa(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=h(),n=m("span"),i=C(t[3]),o=h(),r=m("span"),a=C(t[4]),f=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),y(c,o,p),y(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&B(i,c[3]),p&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function Gm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k;l=new Wm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&oa(t);return{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("span"),o=m("span"),r=C(t[2]),a=h(),f=m("br"),c=h(),p=m("span"),_=C(t[0]),b=h(),d=m("span"),v=C(t[1]),g=h(),$&&$.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(d,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),X(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,b),s(i,d),s(d,v),s(i,g),$&&$.m(i,null),k=!0},p(T,[P]){const I={};P&64&&(I.pct=T[6]),P&96&&(I.color=T[5](T[6])),l.$set(I),(!k||P&4)&&B(r,T[2]),(!k||P&1)&&B(_,T[0]),(!k||P&2)&&B(v,T[1]),T[3]?$?$.p(T,P):($=oa(T),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(T){k||(N(l.$$.fragment,T),k=!0)},o(T){D(l.$$.fragment,T),k=!1},d(T){T&&w(e),Z(l),$&&$.d()}}}function Bm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class Oc extends Ce{constructor(e){super(),ye(this,e,Bm,Gm,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function ua(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function ra(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function aa(t,e,l){const n=t.slice();return n[13]=e[l],n}function fa(t){let e,l,n,i,o,r=t[0].title&&ca(t),a=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&da(t);return{c(){e=Oe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){y(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=da(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function da(t){let e,l=t[9].label+"",n,i;return{c(){e=Oe("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){y(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&B(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&w(e)}}}function va(t){let e=!isNaN(t[5](t[11])),l,n=e&&_a(t);return{c(){n&&n.c(),l=We()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=_a(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function ha(t){let e,l,n=t[9].value!==void 0&&ba(t),i=t[9].value2>1e-4&&wa(t);return{c(){e=Oe("g"),n&&n.c(),l=Oe("g"),i&&i.c()},m(o,r){y(o,e,r),n&&n.m(e,null),y(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=ba(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=wa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ba(t){let e,l,n,i,o,r,a,f=t[3]>15&&ga(t);return{c(){e=Oe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=ga(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ga(t){let e,l=t[9].label+"",n,i,o,r,a,f,c=t[9].title&&ka(t);return{c(){e=Oe("text"),n=C(l),c&&c.c(),f=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",r),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]15&&ya(t);return{c(){e=Oe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=ya(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ya(t){let e,l=t[9].label2+"",n,i,o,r,a,f=t[9].title2&&Ca(t);return{c(){e=Oe("text"),n=C(l),f&&f.c(),a=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){y(i,e,o),n&&n.m(e,null),l=Kc(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=fa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&w(e),n&&n.d(),l()}}}let fn=30;function Ym(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,r=b/n.points.length),l(7,p=rn.y.max?g=n.padding.bottom:vc||g<0?0:g})}},[n,i,o,r,c,a,f,p,_]}class mn extends Ce{constructor(e){super(),ye(this,e,Ym,zm,ke,{config:0})}}function Vm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:ce(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:nm(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={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:c},points:p})}},[a,n,i,o,r]}class Qm extends Ce{constructor(e){super(),ye(this,e,Km,Vm,ke,{u1:1,u2:2,u3:3,ds:4})}}function Xm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Zm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(b){return{label:ce(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Sc(b?b/c*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,r=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,f=b.i3),"max"in b&&l(7,c=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],d=[];n>0&&(b.push({label:"L1"}),d.push(_(r))),i>0&&(b.push({label:"L2"}),d.push(_(a))),o>0&&(b.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:b},points:d})}},[p,n,i,o,r,a,f,c]}class Jm extends Ce{constructor(e){super(),ye(this,e,Zm,Xm,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function xm(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,b,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,$,T,P,I,S,A,E=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,Y,U,R,q,z,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",H,G;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",r=h(),a=m("div"),c=C(f),p=C(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",d=h(),v=m("div"),k=C(g),$=C(" VAr"),T=h(),P=m("div"),I=m("div"),I.textContent="Total in",S=h(),A=m("div"),F=C(E),Y=C(" kVArh"),U=h(),R=m("div"),R.textContent="Total out",q=h(),z=m("div"),H=C(O),G=C(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(z,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,b),s(i,d),s(i,v),s(v,k),s(v,$),s(e,T),s(e,P),s(P,I),s(P,S),s(P,A),s(A,F),s(A,Y),s(P,U),s(P,R),s(P,q),s(P,z),s(z,H),s(z,G)},p(L,[W]){W&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&B(c,f),W&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&B(k,g),W&4&&E!==(E=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&B(F,E),W&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&B(H,O)},i:ne,o:ne,d(L){L&&w(e)}}}function ep(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class tp extends Ce{constructor(e){super(),ye(this,e,ep,xm,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Ta(t){let e;function l(o,r){return o[3]?np:lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function lp(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v=ce(t[1].d.u,1)+"",g,k,$,T,P,I,S=ce(t[1].m.u)+"",A,E,F,Y,U,R,q=ce(t[0].last_month.u)+"",z,O,H,G,L=t[4]&&Sa(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),d=m("div"),g=C(v),k=C(" kWh"),$=h(),T=m("div"),T.textContent="Month",P=h(),I=m("div"),A=C(S),E=C(" kWh"),F=h(),Y=m("div"),Y.textContent="Last month",U=h(),R=m("div"),z=C(q),O=C(" kWh"),H=h(),L&&L.c(),G=We(),u(r,"class","text-right"),u(d,"class","text-right"),u(I,"class","text-right"),u(R,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(W,j){y(W,e,j),y(W,l,j),y(W,n,j),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,b),s(n,d),s(d,g),s(d,k),s(n,$),s(n,T),s(n,P),s(n,I),s(I,A),s(I,E),s(n,F),s(n,Y),s(n,U),s(n,R),s(R,z),s(R,O),y(W,H,j),L&&L.m(W,j),y(W,G,j)},p(W,j){j&2&&a!==(a=ce(W[1].h.u,2)+"")&&B(f,a),j&2&&v!==(v=ce(W[1].d.u,1)+"")&&B(g,v),j&2&&S!==(S=ce(W[1].m.u)+"")&&B(A,S),j&1&&q!==(q=ce(W[0].last_month.u)+"")&&B(z,q),W[4]?L?L.p(W,j):(L=Sa(W),L.c(),L.m(G.parentNode,G)):L&&(L.d(1),L=null)},d(W){W&&w(e),W&&w(l),W&&w(n),W&&w(H),L&&L.d(W),W&&w(G)}}}function np(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.u,1)+"",k,$,T,P,I,S,A,E=ce(t[1].m.u)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.u)+"",G,L,W,j,te,le,de,ie,we,Ie,$e,Ee=ce(t[1].h.p,2)+"",ve,Pe,Ae,me,se,pe,Q,oe=ce(t[1].d.p,1)+"",Ne,Me,he,x,_e,Le,je,Ke=ce(t[1].m.p)+"",Fe,He,re,ge,Ot,Wl,xt,ft=ce(t[0].last_month.p)+"",Nl,_l,qt,pt,Qe=t[4]&&Pa(t),Xe=t[4]&&Na(t),Ze=t[4]&&Ma(t),Ue=t[4]&&Aa(t),Je=t[4]&&Da(t),Ge=t[4]&&Ia(t),xe=t[4]&&Ea(t),et=t[4]&&Fa(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),Qe&&Qe.c(),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=C(" kWh"),T=h(),Xe&&Xe.c(),P=h(),I=m("div"),I.textContent="Month",S=h(),A=m("div"),F=C(E),Y=C(" kWh"),U=h(),Ze&&Ze.c(),R=h(),q=m("div"),q.textContent="Last mo.",z=h(),O=m("div"),G=C(H),L=C(" kWh"),W=h(),Ue&&Ue.c(),te=h(),le=m("strong"),le.textContent="Export",de=h(),ie=m("div"),we=m("div"),we.textContent="Hour",Ie=h(),$e=m("div"),ve=C(Ee),Pe=C(" kWh"),Ae=h(),Je&&Je.c(),me=h(),se=m("div"),se.textContent="Day",pe=h(),Q=m("div"),Ne=C(oe),Me=C(" kWh"),he=h(),Ge&&Ge.c(),x=h(),_e=m("div"),_e.textContent="Month",Le=h(),je=m("div"),Fe=C(Ke),He=C(" kWh"),re=h(),xe&&xe.c(),ge=h(),Ot=m("div"),Ot.textContent="Last mo.",Wl=h(),xt=m("div"),Nl=C(ft),_l=C(" kWh"),qt=h(),et&&et.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",j="grid grid-cols-"+t[5]+" mb-3"),u($e,"class","text-right"),u(Q,"class","text-right"),u(je,"class","text-right"),u(xt,"class","text-right"),u(ie,"class",pt="grid grid-cols-"+t[5])},m(ue,be){y(ue,e,be),y(ue,l,be),y(ue,n,be),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Qe&&Qe.m(n,null),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(n,T),Xe&&Xe.m(n,null),s(n,P),s(n,I),s(n,S),s(n,A),s(A,F),s(A,Y),s(n,U),Ze&&Ze.m(n,null),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(n,W),Ue&&Ue.m(n,null),y(ue,te,be),y(ue,le,be),y(ue,de,be),y(ue,ie,be),s(ie,we),s(ie,Ie),s(ie,$e),s($e,ve),s($e,Pe),s(ie,Ae),Je&&Je.m(ie,null),s(ie,me),s(ie,se),s(ie,pe),s(ie,Q),s(Q,Ne),s(Q,Me),s(ie,he),Ge&&Ge.m(ie,null),s(ie,x),s(ie,_e),s(ie,Le),s(ie,je),s(je,Fe),s(je,He),s(ie,re),xe&&xe.m(ie,null),s(ie,ge),s(ie,Ot),s(ie,Wl),s(ie,xt),s(xt,Nl),s(xt,_l),s(ie,qt),et&&et.m(ie,null)},p(ue,be){be&2&&a!==(a=ce(ue[1].h.u,2)+"")&&B(f,a),ue[4]?Qe?Qe.p(ue,be):(Qe=Pa(ue),Qe.c(),Qe.m(n,_)):Qe&&(Qe.d(1),Qe=null),be&2&&g!==(g=ce(ue[1].d.u,1)+"")&&B(k,g),ue[4]?Xe?Xe.p(ue,be):(Xe=Na(ue),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),be&2&&E!==(E=ce(ue[1].m.u)+"")&&B(F,E),ue[4]?Ze?Ze.p(ue,be):(Ze=Ma(ue),Ze.c(),Ze.m(n,R)):Ze&&(Ze.d(1),Ze=null),be&1&&H!==(H=ce(ue[0].last_month.u)+"")&&B(G,H),ue[4]?Ue?Ue.p(ue,be):(Ue=Aa(ue),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),be&32&&j!==(j="grid grid-cols-"+ue[5]+" mb-3")&&u(n,"class",j),be&2&&Ee!==(Ee=ce(ue[1].h.p,2)+"")&&B(ve,Ee),ue[4]?Je?Je.p(ue,be):(Je=Da(ue),Je.c(),Je.m(ie,me)):Je&&(Je.d(1),Je=null),be&2&&oe!==(oe=ce(ue[1].d.p,1)+"")&&B(Ne,oe),ue[4]?Ge?Ge.p(ue,be):(Ge=Ia(ue),Ge.c(),Ge.m(ie,x)):Ge&&(Ge.d(1),Ge=null),be&2&&Ke!==(Ke=ce(ue[1].m.p)+"")&&B(Fe,Ke),ue[4]?xe?xe.p(ue,be):(xe=Ea(ue),xe.c(),xe.m(ie,ge)):xe&&(xe.d(1),xe=null),be&1&&ft!==(ft=ce(ue[0].last_month.p)+"")&&B(Nl,ft),ue[4]?et?et.p(ue,be):(et=Fa(ue),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),be&32&&pt!==(pt="grid grid-cols-"+ue[5])&&u(ie,"class",pt)},d(ue){ue&&w(e),ue&&w(l),ue&&w(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),ue&&w(te),ue&&w(le),ue&&w(de),ue&&w(ie),Je&&Je.d(),Ge&&Ge.d(),xe&&xe.d(),et&&et.d()}}}function Sa(t){let e,l,n,i,o,r,a=ce(t[1].h.c,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.c,1)+"",k,$,T,P,I,S,A,E=ce(t[1].m.c)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.c)+"",G,L,W;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=h(),p=C(t[2]),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=h(),T=C(t[2]),P=h(),I=m("div"),I.textContent="Month",S=h(),A=m("div"),F=C(E),Y=h(),U=C(t[2]),R=h(),q=m("div"),q.textContent="Last month",z=h(),O=m("div"),G=C(H),L=h(),W=C(t[2]),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(j,te){y(j,e,te),y(j,l,te),y(j,n,te),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(v,T),s(n,P),s(n,I),s(n,S),s(n,A),s(A,F),s(A,Y),s(A,U),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(O,W)},p(j,te){te&2&&a!==(a=ce(j[1].h.c,2)+"")&&B(f,a),te&4&&B(p,j[2]),te&2&&g!==(g=ce(j[1].d.c,1)+"")&&B(k,g),te&4&&B(T,j[2]),te&2&&E!==(E=ce(j[1].m.c)+"")&&B(F,E),te&4&&B(U,j[2]),te&1&&H!==(H=ce(j[0].last_month.c)+"")&&B(G,H),te&4&&B(W,j[2])},d(j){j&&w(e),j&&w(l),j&&w(n)}}}function Pa(t){let e,l=ce(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.c,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Na(t){let e,l=ce(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.c,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ma(t){let e,l=ce(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Aa(t){let e,l=ce(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Da(t){let e,l=ce(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.i,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ia(t){let e,l=ce(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.i,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ea(t){let e,l=ce(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Fa(t){let e,l=ce(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ip(t){let e,l,n,i,o,r,a=t[1]&&Ta(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),r=h(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=Ta(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&w(e),a&&a.d()}}}function sp(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class op extends Ce{constructor(e){super(),ye(this,e,sp,ip,ke,{sysinfo:0,data:1,currency:2,hasExport:3})}}function up(t){let e,l,n,i;return n=new mn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),X(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){D(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function rp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,b=0,d=[],v=[],g=[];l(4,a=l(3,r=0));let k=new Date;for(fl(k,i.clock_offset),p=c;p<24&&(_=n[De(b++)],_!=null);p++)v.push({label:De(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),fl(k,1);for(p=0;p<24&&(_=n[De(b++)],_!=null);p++)v.push({label:De(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),fl(k,1);if(a>-100&&r<100){switch(f){case"NOK":case"SEK":case"DKK":f="\xF8re";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,r*=100),p=0;p=0?S.toFixed(A):"",title:S>=0?S.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:S<0?S.toFixed(A):"",title2:S<0?S.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let T=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(T/4*-1,a));let S=Math.ceil(Math.abs(a)/T*4),A=a/S;for(p=1;p{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=fl(new Date,-24),d=new Date().getUTCHours();for(fl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),f=d;f<24;f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(b.getHours())}),_.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,k*10)),fl(b,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=new Date,d=new Date;for(fl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),fl(d,i.clock_offset-(d.getHours()-d.getUTCHours())%24),d.setDate(0),f=b.getDate();f<=d.getDate();f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(f)}),_.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,k))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var k=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:k.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let b=o;r<0&&(b+=Math.abs(r));let d=b/4;for(a=0;a<5;a++)f=r+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class bp extends Ce{constructor(e){super(),ye(this,e,hp,vp,ke,{json:1})}}function gp(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let kp=0;function wp(t,e,l){let n={},i=0,o;return Ec.subscribe(r=>{l(2,o=r)}),Ic(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r0?De(p.d)+"."+to[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:kp,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class yp extends Ce{constructor(e){super(),ye(this,e,wp,gp,ke,{})}}function Ra(t){let e,l,n,i,o,r,a=(t[0].mt?Cs(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,d,v;return i=new Oc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Sc}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),f=C(a),c=h(),p=m("div"),b=C(_),d=C(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,k){y(g,e,k),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,b),s(p,d),v=!0},p(g,k){const $={};k&1&&($.val=g[0].i?g[0].i:0),k&1&&($.max=g[0].im?g[0].im:15e3),k&1&&($.sub=g[0].p),k&1&&($.subunit=g[0].pc),i.$set($),(!v||k&1)&&a!==(a=(g[0].mt?Cs(g[0].mt):"-")+"")&&B(f,a),(!v||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(b,_)},i(g){v||(N(i.$$.fragment,g),v=!0)},o(g){D(i.$$.fragment,g),v=!1},d(g){g&&w(e),Z(i)}}}function La(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Oc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:im}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=h(),f=m("div"),p=C(c),_=C(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(d,v){y(d,e,v),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),b=!0},p(d,v){const g={};v&1&&(g.val=d[0].e?d[0].e:0),v&1&&(g.max=d[0].om?d[0].om*1e3:1e4),i.$set(g),(!b||v&1)&&c!==(c=(d[0].ec?d[0].ec.toFixed(1):"-")+"")&&B(p,c)},i(d){b||(N(i.$$.fragment,d),b=!0)},o(d){D(i.$$.fragment,d),b=!1},d(d){d&&w(e),Z(i)}}}function Ua(t){let e,l,n;return l=new Qm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Oa(t){let e,l,n;return l=new Jm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function qa(t){let e,l,n;return l=new tp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ha(t){let e,l,n;return l=new op({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ja(t){let e,l,n;return l=new yp({}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),X(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Wa(t){let e,l,n;return l=new ap({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ga(t){let e,l,n;return l=new mp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ba(t){let e,l,n;return l=new dp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function za(t){let e,l,n;return l=new bp({props:{json:t[5]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Cp(t){let e,l=ze(t[1].ui.i,t[0].i),n,i=ze(t[1].ui.e,t[0].om||t[0].e>0),o,r=ze(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=ze(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=ze(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=ze(t[1].ui.c,t[0].ea),d,v=ze(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,k=ze(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,T=ze(t[1].ui.d,t[3]),P,I=ze(t[1].ui.m,t[4]),S,A=ze(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),E,F=l&&Ra(t),Y=i&&La(t),U=r&&Ua(t),R=f&&Oa(t),q=p&&qa(t),z=b&&Ha(t),O=v&&ja(),H=k&&Wa(t),G=T&&Ga(t),L=I&&Ba(t),W=A&&za(t);return{c(){e=m("div"),F&&F.c(),n=h(),Y&&Y.c(),o=h(),U&&U.c(),a=h(),R&&R.c(),c=h(),q&&q.c(),_=h(),z&&z.c(),d=h(),O&&O.c(),g=h(),H&&H.c(),$=h(),G&&G.c(),P=h(),L&&L.c(),S=h(),W&&W.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(j,te){y(j,e,te),F&&F.m(e,null),s(e,n),Y&&Y.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),R&&R.m(e,null),s(e,c),q&&q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),O&&O.m(e,null),s(e,g),H&&H.m(e,null),s(e,$),G&&G.m(e,null),s(e,P),L&&L.m(e,null),s(e,S),W&&W.m(e,null),E=!0},p(j,[te]){te&3&&(l=ze(j[1].ui.i,j[0].i)),l?F?(F.p(j,te),te&3&&N(F,1)):(F=Ra(j),F.c(),N(F,1),F.m(e,n)):F&&(Te(),D(F,1,1,()=>{F=null}),Se()),te&3&&(i=ze(j[1].ui.e,j[0].om||j[0].e>0)),i?Y?(Y.p(j,te),te&3&&N(Y,1)):(Y=La(j),Y.c(),N(Y,1),Y.m(e,o)):Y&&(Te(),D(Y,1,1,()=>{Y=null}),Se()),te&3&&(r=ze(j[1].ui.v,j[0].u1>100||j[0].u2>100||j[0].u3>100)),r?U?(U.p(j,te),te&3&&N(U,1)):(U=Ua(j),U.c(),N(U,1),U.m(e,a)):U&&(Te(),D(U,1,1,()=>{U=null}),Se()),te&3&&(f=ze(j[1].ui.a,j[0].i1>.01||j[0].i2>.01||j[0].i3>.01)),f?R?(R.p(j,te),te&3&&N(R,1)):(R=Oa(j),R.c(),N(R,1),R.m(e,c)):R&&(Te(),D(R,1,1,()=>{R=null}),Se()),te&3&&(p=ze(j[1].ui.r,j[0].ri>0||j[0].re>0||j[0].ric>0||j[0].rec>0)),p?q?(q.p(j,te),te&3&&N(q,1)):(q=qa(j),q.c(),N(q,1),q.m(e,_)):q&&(Te(),D(q,1,1,()=>{q=null}),Se()),te&3&&(b=ze(j[1].ui.c,j[0].ea)),b?z?(z.p(j,te),te&3&&N(z,1)):(z=Ha(j),z.c(),N(z,1),z.m(e,d)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),te&3&&(v=ze(j[1].ui.t,j[0].pr&&(j[0].pr.startsWith("10YNO")||j[0].pr=="10Y1001A1001A48H"))),v?O?te&3&&N(O,1):(O=ja(),O.c(),N(O,1),O.m(e,g)):O&&(Te(),D(O,1,1,()=>{O=null}),Se()),te&3&&(k=ze(j[1].ui.p,j[0].pe&&!Number.isNaN(j[0].p))),k?H?(H.p(j,te),te&3&&N(H,1)):(H=Wa(j),H.c(),N(H,1),H.m(e,$)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),te&10&&(T=ze(j[1].ui.d,j[3])),T?G?(G.p(j,te),te&10&&N(G,1)):(G=Ga(j),G.c(),N(G,1),G.m(e,P)):G&&(Te(),D(G,1,1,()=>{G=null}),Se()),te&18&&(I=ze(j[1].ui.m,j[4])),I?L?(L.p(j,te),te&18&&N(L,1)):(L=Ba(j),L.c(),N(L,1),L.m(e,S)):L&&(Te(),D(L,1,1,()=>{L=null}),Se()),te&35&&(A=ze(j[1].ui.s,j[0].t&&j[0].t!=-127&&j[5].c>1)),A?W?(W.p(j,te),te&35&&N(W,1)):(W=za(j),W.c(),N(W,1),W.m(e,null)):W&&(Te(),D(W,1,1,()=>{W=null}),Se())},i(j){E||(N(F),N(Y),N(U),N(R),N(q),N(z),N(O),N(H),N(G),N(L),N(W),E=!0)},o(j){D(F),D(Y),D(U),D(R),D(q),D(z),D(O),D(H),D(G),D(L),D(W),E=!1},d(j){j&&w(e),F&&F.d(),Y&&Y.d(),U&&U.d(),R&&R.d(),q&&q.d(),z&&z.d(),O&&O.d(),H&&H.d(),G&&G.d(),L&&L.d(),W&&W.d()}}}function $p(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return Pc.subscribe(c=>{l(2,o=c)}),Nc.subscribe(c=>{l(3,r=c)}),Mc.subscribe(c=>{l(4,a=c)}),Dc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Tp extends Ce{constructor(e){super(),ye(this,e,$p,Cp,ke,{data:0,sysinfo:1})}}let ro={};const qc=rt(ro);async function Sp(){ro=await(await fetch("/configuration.json")).json(),qc.set(ro)}function Ya(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Pp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Np(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Va(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ka(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Qa(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Xa(t){let e,l,n;return{c(){e=m("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Za(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xa(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Mp(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?Np:Pp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&Va(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Ka(),_=t[0]=="esp32s2"&&Qa(),b={length:t[1]+1},d=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Hc extends Ce{constructor(e){super(),ye(this,e,Ap,Mp,ke,{chip:0})}}function Ja(t){let e,l,n=t[1]&&xa(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function xa(t){let e,l;return{c(){e=m("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function Dp(t){let e,l=t[0]&&Ja(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function Ip(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class At extends Ce{constructor(e){super(),ye(this,e,Ip,Dp,ke,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&w(e)}}}function Ep(t){let e,l,n,i=t[0],o=[];for(let r=0;r{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Bp(t){let e,l;return e=new cl({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zp(t){let e,l;return e=new cl({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Yp(t){let e,l,n,i;const o=[zp,Bp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Vp(t){let e,l;return e=new cl({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Kp(t){let e,l;return e=new cl({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Qp(t){let e,l,n,i;const o=[Kp,Vp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function pf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=m("div"),_=C("Electricity IDX"),b=m("br"),d=h(),v=m("input"),g=h(),k=m("div"),$=C("Current IDX"),T=m("br"),P=h(),I=m("input"),S=h(),A=m("div"),E=C(`Voltage IDX: L1, L2 & L3\r + `),F=m("div"),Y=m("input"),U=h(),R=m("input"),q=h(),z=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(I,"name","oc"),u(I,"type","text"),u(I,"class","in-l tr w-full"),u(k,"class","w-1/2"),u(c,"class","my-1 flex"),u(Y,"name","ou1"),u(Y,"type","text"),u(Y,"class","in-f tr w-1/3"),u(R,"name","ou2"),u(R,"type","text"),u(R,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].o.e),s(c,g),s(c,k),s(k,$),s(k,T),s(k,P),s(k,I),V(I,t[3].o.c),s(e,S),s(e,A),s(A,E),s(A,F),s(F,Y),V(Y,t[3].o.u1),s(F,U),s(F,R),V(R,t[3].o.u2),s(F,q),s(F,z),V(z,t[3].o.u3),O=!0,H||(G=[K(v,"input",t[61]),K(I,"input",t[62]),K(Y,"input",t[63]),K(R,"input",t[64]),K(z,"input",t[65])],H=!0)},p(L,W){W[0]&8&&v.value!==L[3].o.e&&V(v,L[3].o.e),W[0]&8&&I.value!==L[3].o.c&&V(I,L[3].o.c),W[0]&8&&Y.value!==L[3].o.u1&&V(Y,L[3].o.u1),W[0]&8&&R.value!==L[3].o.u2&&V(R,L[3].o.u2),W[0]&8&&z.value!==L[3].o.u3&&V(z,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){D(o.$$.fragment,L),O=!1},d(L){L&&w(e),Z(o),H=!1,Ve(G)}}}function _f(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=C("Discovery topic prefix"),_=m("br"),b=h(),d=m("input"),v=h(),g=m("div"),k=C("Hostname for URL"),$=m("br"),T=h(),P=m("input"),S=h(),A=m("div"),E=C("Name tag"),F=m("br"),Y=h(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(d,"name","ht"),u(d,"type","text"),u(d,"class","in-s"),u(d,"placeholder","homeassistant"),u(c,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",I=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,H){y(O,e,H),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,b),s(c,d),V(d,t[3].h.t),s(e,v),s(e,g),s(g,k),s(g,$),s(g,T),s(g,P),V(P,t[3].h.h),s(e,S),s(e,A),s(A,E),s(A,F),s(A,Y),s(A,U),V(U,t[3].h.n),R=!0,q||(z=[K(d,"input",t[66]),K(P,"input",t[67]),K(U,"input",t[68])],q=!0)},p(O,H){H[0]&8&&d.value!==O[3].h.t&&V(d,O[3].h.t),(!R||H[0]&8&&I!==(I=O[3].g.h+".local"))&&u(P,"placeholder",I),H[0]&8&&P.value!==O[3].h.h&&V(P,O[3].h.h),H[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){R||(N(o.$$.fragment,O),R=!0)},o(O){D(o.$$.fragment,O),R=!1},d(O){O&&w(e),Z(o),q=!1,Ve(z)}}}function df(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P;o=new Rt({});let I={length:9},S=[];for(let A=0;A20&&gf(t),p=t[0].chip=="esp8266"&&yf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),J(o.$$.fragment),r=h(),c&&c.c(),a=h(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,b){_[0].board>20?c?(c.p(_,b),b[0]&1&&N(c,1)):(c=gf(_),c.c(),N(c,1),c.m(e,a)):c&&(Te(),D(c,1,1,()=>{c=null}),Se()),_[0].chip=="esp8266"?p?p.p(_,b):(p=yf(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(N(o.$$.fragment,_),N(c),f=!0)},o(_){D(o.$$.fragment,_),D(c),f=!1},d(_){_&&w(e),Z(o),c&&c.d(),p&&p.d()}}}function gf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke;b=new Hc({props:{chip:t[0].chip}});let Fe=t[0].chip!="esp8266"&&kf(t),He=t[3].i.v.p>0&&wf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("HAN"),r=m("label"),a=m("input"),f=C(" pullup"),c=m("br"),p=h(),_=m("select"),J(b.$$.fragment),d=h(),v=m("div"),g=C("AP button"),k=m("br"),$=h(),T=m("input"),P=h(),I=m("div"),S=C("LED"),A=m("label"),E=m("input"),F=C(" inv"),Y=m("br"),U=h(),R=m("div"),q=m("input"),z=h(),O=m("div"),H=C("RGB"),G=m("label"),L=m("input"),W=C(" inverted"),j=m("br"),te=h(),le=m("div"),de=m("input"),ie=h(),we=m("input"),Ie=h(),$e=m("input"),Ee=h(),ve=m("div"),Pe=C("Temperature"),Ae=m("br"),me=h(),se=m("input"),pe=h(),Q=m("div"),oe=C("Analog temp"),Ne=m("br"),Me=h(),he=m("input"),x=h(),Fe&&Fe.c(),_e=h(),He&&He.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[73].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(E,"name","ili"),E.__value="true",E.value=E.__value,u(E,"type","checkbox"),u(E,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(R,"class","flex"),u(I,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(G,"class","ml-4"),u(de,"name","irr"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"class","in-f tr w-1/3"),u(we,"name","irg"),u(we,"type","number"),u(we,"min","0"),u(we,"max",t[6]),u(we,"class","in-m tr w-1/3"),u($e,"name","irb"),u($e,"type","number"),u($e,"min","0"),u($e,"max",t[6]),u($e,"class","in-l tr w-1/3"),u(le,"class","flex"),u(O,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(ve,"class","my-1 w-1/3"),u(he,"name","ita"),u(he,"type","number"),u(he,"min","0"),u(he,"max",t[6]),u(he,"class","in-l tr w-full"),u(Q,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(re,ge){y(re,e,ge),y(re,l,ge),y(re,n,ge),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,p),s(i,_),X(b,_,null),Re(_,t[3].i.h.p),s(n,d),s(n,v),s(v,g),s(v,k),s(v,$),s(v,T),V(T,t[3].i.a),s(n,P),s(n,I),s(I,S),s(I,A),s(A,E),E.checked=t[3].i.l.i,s(A,F),s(I,Y),s(I,U),s(I,R),s(R,q),V(q,t[3].i.l.p),s(n,z),s(n,O),s(O,H),s(O,G),s(G,L),L.checked=t[3].i.r.i,s(G,W),s(O,j),s(O,te),s(O,le),s(le,de),V(de,t[3].i.r.r),s(le,ie),s(le,we),V(we,t[3].i.r.g),s(le,Ie),s(le,$e),V($e,t[3].i.r.b),s(n,Ee),s(n,ve),s(ve,Pe),s(ve,Ae),s(ve,me),s(ve,se),V(se,t[3].i.t.d),s(n,pe),s(n,Q),s(Q,oe),s(Q,Ne),s(Q,Me),s(Q,he),V(he,t[3].i.t.a),s(n,x),Fe&&Fe.m(n,null),s(n,_e),He&&He.m(n,null),Le=!0,je||(Ke=[K(a,"change",t[72]),K(_,"change",t[73]),K(T,"input",t[74]),K(E,"change",t[75]),K(q,"input",t[76]),K(L,"change",t[77]),K(de,"input",t[78]),K(we,"input",t[79]),K($e,"input",t[80]),K(se,"input",t[81]),K(he,"input",t[82])],je=!0)},p(re,ge){ge[0]&8&&(a.checked=re[3].i.h.u);const Ot={};ge[0]&1&&(Ot.chip=re[0].chip),b.$set(Ot),ge[0]&8&&Re(_,re[3].i.h.p),(!Le||ge[0]&64)&&u(T,"max",re[6]),ge[0]&8&&ae(T.value)!==re[3].i.a&&V(T,re[3].i.a),ge[0]&8&&(E.checked=re[3].i.l.i),(!Le||ge[0]&64)&&u(q,"max",re[6]),ge[0]&8&&ae(q.value)!==re[3].i.l.p&&V(q,re[3].i.l.p),ge[0]&8&&(L.checked=re[3].i.r.i),(!Le||ge[0]&64)&&u(de,"max",re[6]),ge[0]&8&&ae(de.value)!==re[3].i.r.r&&V(de,re[3].i.r.r),(!Le||ge[0]&64)&&u(we,"max",re[6]),ge[0]&8&&ae(we.value)!==re[3].i.r.g&&V(we,re[3].i.r.g),(!Le||ge[0]&64)&&u($e,"max",re[6]),ge[0]&8&&ae($e.value)!==re[3].i.r.b&&V($e,re[3].i.r.b),(!Le||ge[0]&64)&&u(se,"max",re[6]),ge[0]&8&&ae(se.value)!==re[3].i.t.d&&V(se,re[3].i.t.d),(!Le||ge[0]&64)&&u(he,"max",re[6]),ge[0]&8&&ae(he.value)!==re[3].i.t.a&&V(he,re[3].i.t.a),re[0].chip!="esp8266"?Fe?Fe.p(re,ge):(Fe=kf(re),Fe.c(),Fe.m(n,_e)):Fe&&(Fe.d(1),Fe=null),re[3].i.v.p>0?He?He.p(re,ge):(He=wf(re),He.c(),He.m(n,null)):He&&(He.d(1),He=null)},i(re){Le||(N(b.$$.fragment,re),Le=!0)},o(re){D(b.$$.fragment,re),Le=!1},d(re){re&&w(e),re&&w(l),re&&w(n),Z(b),Fe&&Fe.d(),He&&He.d(),je=!1,Ve(Ke)}}}function kf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Vcc"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[83]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&ae(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&w(e),r=!1,a()}}}function wf(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=C("Voltage divider"),n=m("br"),i=h(),o=m("div"),r=m("input"),a=h(),f=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","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(p=[K(r,"input",t[84]),K(f,"input",t[85])],c=!0)},p(_,b){b[0]&8&&ae(r.value)!==_[3].i.v.d.v&&V(r,_[3].i.v.d.v),b[0]&8&&ae(f.value)!==_[3].i.v.d.g&&V(f,_[3].i.v.d.g)},d(_){_&&w(e),c=!1,Ve(p)}}}function yf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T=(t[0].board==2||t[0].board==100)&&Cf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("Vcc offset"),r=m("br"),a=h(),f=m("input"),c=h(),p=m("div"),_=C("Multiplier"),b=m("br"),d=h(),v=m("input"),g=h(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,I){y(P,e,I),y(P,l,I),y(P,n,I),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].i.v.m),s(n,g),T&&T.m(n,null),k||($=[K(f,"input",t[86]),K(v,"input",t[87])],k=!0)},p(P,I){I[0]&8&&ae(f.value)!==P[3].i.v.o&&V(f,P[3].i.v.o),I[0]&8&&ae(v.value)!==P[3].i.v.m&&V(v,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,I):(T=Cf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),k=!1,Ve($)}}}function Cf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Boot limit"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[88]),r=!0)},p(f,c){c[0]&8&&ae(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&w(e),r=!1,a()}}}function $f(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$=t[3].d.t&&Tf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),r=C(" Enable telnet"),a=h(),$&&$.c(),f=h(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[91].call(p)),u(c,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),y(T,a,P),$&&$.m(T,P),y(T,f,P),y(T,c,P),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),Re(p,t[3].d.l),g||(k=[K(o,"change",t[90]),K(p,"change",t[91])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?$||($=Tf(),$.c(),$.m(f.parentNode,f)):$&&($.d(1),$=null),P[0]&8&&Re(p,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(a),$&&$.d(T),T&&w(f),T&&w(c),g=!1,Ve(k)}}}function Tf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Xp(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke,Fe,He,re,ge,Ot,Wl,xt,ft,Nl,_l,qt,pt,Qe,Xe,Ze,Ue,Je,Ge,xe,et,ue,be,Pi,dl,pn,Tt,Ni,Mi,Ai,vl,Di,Ii,Ei,St,Ml,Be,hl,Gl,Ps,qe,el,Fi,Al,_n,$o,ai,To,tl,Ri,So,Ns,Po,fi,Ht,No,Mo,Dl,ll,Il,Ao,Li,Do,ct,El,Io,Ui,dn,vn,hn,bn,Oi,Eo,Dt,Fo,Bl,Ro,Lo,Uo,nl,gn,kn,Oo,wn,zl,qo,Ho,jo,yn,jt,Wo,qi,Go,Yl,Bo,zo,Yo,Cn,Wt,Vo,Hi,Ko,Ms,Qo,Vl,ji,Gt,Xo,Zo,Jo,As,Wi,Bt,xo,eu,tu,lt,Gi,lu,$n,Tn,nu,ci,iu,Kl,su,ou,uu,bl,ru,Ql,au,fu,cu,gl,mu,Sn,Xl,pu,_u,du,It,Pn,Nn,Mn,An,vu,Zl,hu,bu,gu,Dn,Et,ku,Bi,wu,zi,Yi,zt,yu,Cu,Vi,Ki,Yt,$u,Tu,at,Qi,Su,In,En,Pu,Jl,Nu,Mu,Au,Fl,il,Fn,Rn,Du,Pt,Xi,Zi,Iu,Nt,Ln,Ji,xi,Eu,Ds,es,ts,Vt,Fu,Ru,mi,Lu,Rl,Uu,pi,Kt,Ou,qu,Hu,ls,kl,ju,Ye,ns,Wu,Un,On,Gu,_i,Bu,sl,zu,Is,Yu,Vu,qn,wl,Ku,Qt,Qu,Es,xl,Xu,Zu,Ju,yl,xu,en,er,tr,lr,Cl,nr,Hn,jn,ir,sr,or,$l,ur,Wn,rr,ar,fr,_t,Gn,Bn,zn,Yn,Vn,Kn,cr,tn,mr,pr,_r,Tl,dr,Fs,Rs,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Us,ol,is,vr,Qn,Xn,hr,di,br,vi,gr,Os,Mt,ss,kr,Zn,Jn,wr,hi,yr,os,us,Xt,Cr,$r,Tr,Ll,qs,xn,Sr,rs,ei,Pr,as,Hs,ln,js,nn,Ws,sn,Gs,on,Zt,Bs,Nr;a=new Rt({}),F=new Rp({});let Wc=["NOK","SEK","DKK","EUR"],fs=[];for(let M=0;M<4;M+=1)fs[M]=qp(Op(t,Wc,M));let dt=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),vt=t[3].g.s>0&&of(t);_n=new Rt({});let Gc=[24,48,96,192,384,576,1152],cs=[];for(let M=0;M<7;M+=1)cs[M]=Hp(Up(t,Gc,M));let ht=t[3].m.e.e&&uf(t),bt=t[3].m.e.e&&rf(t),gt=t[3].m.m.e&&af(t);Tn=new Rt({}),En=new Rt({}),Ln=new jc({});let kt=t[3].n.m=="static"&&ff(t);On=new Rt({});let wt=t[0].chip!="esp8266"&&cf(t),nt=t[3].q.s.e&&mf(t),it=t[3].q.m==3&&pf(t),st=t[3].q.m==4&&_f(t),ot=Ls&&df(t);Xn=new Rt({});let ti=t[7],yt=[];for(let M=0;M20||t[0].chip=="esp8266")&&bf(t);Jn=new Rt({});let Ct=t[3].d.s&&$f(t);return ln=new At({props:{active:t[1],message:"Loading configuration"}}),nn=new At({props:{active:t[2],message:"Saving configuration"}}),sn=new At({props:{active:t[4],message:"Performing factory reset"}}),on=new At({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),r=m("a"),J(a.$$.fragment),f=h(),c=m("input"),p=h(),_=m("div"),b=m("div"),d=m("div"),v=C("Hostname"),g=m("br"),k=h(),$=m("input"),T=h(),P=m("div"),I=C("Time zone"),S=m("br"),A=h(),E=m("select"),J(F.$$.fragment),Y=h(),U=m("input"),R=h(),q=m("div"),z=m("div"),O=m("div"),H=C("Price region"),G=m("br"),L=h(),W=m("select"),j=m("optgroup"),te=m("option"),te.textContent="NO1",le=m("option"),le.textContent="NO2",de=m("option"),de.textContent="NO3",ie=m("option"),ie.textContent="NO4",we=m("option"),we.textContent="NO5",Ie=m("optgroup"),$e=m("option"),$e.textContent="SE1",Ee=m("option"),Ee.textContent="SE2",ve=m("option"),ve.textContent="SE3",Pe=m("option"),Pe.textContent="SE4",Ae=m("optgroup"),me=m("option"),me.textContent="DK1",se=m("option"),se.textContent="DK2",pe=m("option"),pe.textContent="Austria",Q=m("option"),Q.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",Ne=m("option"),Ne.textContent="Estonia",Me=m("option"),Me.textContent="Finland",he=m("option"),he.textContent="France",x=m("option"),x.textContent="Germany",_e=m("option"),_e.textContent="Great Britain",Le=m("option"),Le.textContent="Latvia",je=m("option"),je.textContent="Lithuania",Ke=m("option"),Ke.textContent="Netherland",Fe=m("option"),Fe.textContent="Poland",He=m("option"),He.textContent="Switzerland",re=h(),ge=m("div"),Ot=C("Currency"),Wl=m("br"),xt=h(),ft=m("select");for(let M=0;M<4;M+=1)fs[M].c();Nl=h(),_l=m("div"),qt=m("div"),pt=m("div"),Qe=C("Fixed price"),Xe=m("br"),Ze=h(),Ue=m("input"),Je=h(),Ge=m("div"),xe=C("Multiplier"),et=m("br"),ue=h(),be=m("input"),Pi=h(),dl=m("div"),pn=m("label"),Tt=m("input"),Ni=C(" Enable price fetch from remote server"),Mi=h(),dt&&dt.c(),Ai=h(),vl=m("div"),Di=C("Security"),Ii=m("br"),Ei=h(),St=m("select"),Ml=m("option"),Ml.textContent="None",Be=m("option"),Be.textContent="Only configuration",hl=m("option"),hl.textContent="Everything",Gl=h(),vt&&vt.c(),Ps=h(),qe=m("div"),el=m("strong"),el.textContent="Meter",Fi=h(),Al=m("a"),J(_n.$$.fragment),$o=h(),ai=m("input"),To=h(),tl=m("div"),Ri=m("span"),Ri.textContent="Buffer size",So=h(),Ns=m("span"),Ns.textContent="Serial conf.",Po=h(),fi=m("label"),Ht=m("input"),No=C(" inverted"),Mo=h(),Dl=m("div"),ll=m("select"),Il=m("option"),Ao=C("Autodetect");for(let M=0;M<7;M+=1)cs[M].c();Do=h(),ct=m("select"),El=m("option"),Io=C("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Eo=h(),Dt=m("input"),Fo=h(),Bl=m("div"),Ro=C("Voltage"),Lo=m("br"),Uo=h(),nl=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Oo=h(),wn=m("div"),zl=m("div"),qo=C("Main fuse"),Ho=m("br"),jo=h(),yn=m("label"),jt=m("input"),Wo=h(),qi=m("span"),qi.textContent="A",Go=h(),Yl=m("div"),Bo=C("Production"),zo=m("br"),Yo=h(),Cn=m("label"),Wt=m("input"),Vo=h(),Hi=m("span"),Hi.textContent="kWp",Ko=h(),Ms=m("div"),Qo=h(),Vl=m("div"),ji=m("label"),Gt=m("input"),Xo=C(" Meter is encrypted"),Zo=h(),ht&&ht.c(),Jo=h(),bt&&bt.c(),As=h(),Wi=m("label"),Bt=m("input"),xo=C(" Multipliers"),eu=h(),gt&>.c(),tu=h(),lt=m("div"),Gi=m("strong"),Gi.textContent="WiFi",lu=h(),$n=m("a"),J(Tn.$$.fragment),nu=h(),ci=m("input"),iu=h(),Kl=m("div"),su=C("SSID"),ou=m("br"),uu=h(),bl=m("input"),ru=h(),Ql=m("div"),au=C("Password"),fu=m("br"),cu=h(),gl=m("input"),mu=h(),Sn=m("div"),Xl=m("div"),pu=C("Power saving"),_u=m("br"),du=h(),It=m("select"),Pn=m("option"),Pn.textContent="Default",Nn=m("option"),Nn.textContent="Off",Mn=m("option"),Mn.textContent="Minimum",An=m("option"),An.textContent="Maximum",vu=h(),Zl=m("div"),hu=C("Power"),bu=m("br"),gu=h(),Dn=m("div"),Et=m("input"),ku=h(),Bi=m("span"),Bi.textContent="dBm",wu=h(),zi=m("div"),Yi=m("label"),zt=m("input"),yu=C(" Auto reboot on connection problem"),Cu=h(),Vi=m("div"),Ki=m("label"),Yt=m("input"),$u=C(" Allow 802.11b legacy rates"),Tu=h(),at=m("div"),Qi=m("strong"),Qi.textContent="Network",Su=h(),In=m("a"),J(En.$$.fragment),Pu=h(),Jl=m("div"),Nu=C("IP"),Mu=m("br"),Au=h(),Fl=m("div"),il=m("select"),Fn=m("option"),Fn.textContent="DHCP",Rn=m("option"),Rn.textContent="Static",Du=h(),Pt=m("input"),Iu=h(),Nt=m("select"),J(Ln.$$.fragment),Eu=h(),kt&&kt.c(),Ds=h(),es=m("div"),ts=m("label"),Vt=m("input"),Fu=C(" enable mDNS"),Ru=h(),mi=m("input"),Lu=h(),Rl=m("div"),Uu=C("NTP "),pi=m("label"),Kt=m("input"),Ou=C(" obtain from DHCP"),qu=m("br"),Hu=h(),ls=m("div"),kl=m("input"),ju=h(),Ye=m("div"),ns=m("strong"),ns.textContent="MQTT",Wu=h(),Un=m("a"),J(On.$$.fragment),Gu=h(),_i=m("input"),Bu=h(),sl=m("div"),zu=C(`Server\r + `),wt&&wt.c(),Is=h(),Yu=m("br"),Vu=h(),qn=m("div"),wl=m("input"),Ku=h(),Qt=m("input"),Qu=h(),nt&&nt.c(),Es=h(),xl=m("div"),Xu=C("Username"),Zu=m("br"),Ju=h(),yl=m("input"),xu=h(),en=m("div"),er=C("Password"),tr=m("br"),lr=h(),Cl=m("input"),nr=h(),Hn=m("div"),jn=m("div"),ir=C("Client ID"),sr=m("br"),or=h(),$l=m("input"),ur=h(),Wn=m("div"),rr=C("Payload"),ar=m("br"),fr=h(),_t=m("select"),Gn=m("option"),Gn.textContent="JSON",Bn=m("option"),Bn.textContent="Raw (minimal)",zn=m("option"),zn.textContent="Raw (full)",Yn=m("option"),Yn.textContent="Domoticz",Vn=m("option"),Vn.textContent="HomeAssistant",Kn=m("option"),Kn.textContent="HEX dump",cr=h(),tn=m("div"),mr=C("Publish topic"),pr=m("br"),_r=h(),Tl=m("input"),dr=h(),it&&it.c(),Fs=h(),st&&st.c(),Rs=h(),ot&&ot.c(),Us=h(),ol=m("div"),is=m("strong"),is.textContent="User interface",vr=h(),Qn=m("a"),J(Xn.$$.fragment),hr=h(),di=m("input"),br=h(),vi=m("div");for(let M=0;MSave',Hs=h(),J(ln.$$.fragment),js=h(),J(nn.$$.fragment),Ws=h(),J(sn.$$.fragment),Gs=h(),J(on.$$.fragment),u(i,"class","text-sm"),u(r,"href",Lt("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u($,"name","gh"),u($,"type","text"),u($,"class","in-f w-full"),u($,"pattern","[A-Za-z0-9-]+"),u(E,"name","gt"),u(E,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[13].call(E)),u(b,"class","flex"),u(_,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",te.__value="10YNO-1--------2",te.value=te.__value,le.__value="10YNO-2--------T",le.value=le.__value,de.__value="10YNO-3--------J",de.value=de.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(j,"label","Norway"),$e.__value="10Y1001A1001A44P",$e.value=$e.__value,Ee.__value="10Y1001A1001A45N",Ee.value=Ee.__value,ve.__value="10Y1001A1001A46L",ve.value=ve.__value,Pe.__value="10Y1001A1001A47J",Pe.value=Pe.__value,u(Ie,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(Ae,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,Q.__value="10YBE----------2",Q.value=Q.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,Ne.__value="10Y1001A1001A39I",Ne.value=Ne.__value,Me.__value="10YFI-1--------U",Me.value=Me.__value,he.__value="10YFR-RTE------C",he.value=he.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,_e.__value="10YGB----------A",_e.value=_e.__value,Le.__value="10YLV-1001A00074",Le.value=Le.__value,je.__value="10YLT-1001A0008Q",je.value=je.__value,Ke.__value="10YNL----------L",Ke.value=Ke.__value,Fe.__value="10YPL-AREA-----S",Fe.value=Fe.__value,He.__value="10YCH-SWISSGRIDZ",He.value=He.__value,u(W,"name","pr"),u(W,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[14].call(W)),u(O,"class","w-full"),u(ft,"name","pc"),u(ft,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[15].call(ft)),u(z,"class","flex"),u(q,"class","my-1"),u(Ue,"name","pf"),u(Ue,"type","number"),u(Ue,"min","0.001"),u(Ue,"max","65"),u(Ue,"step","0.001"),u(Ue,"class","in-f tr w-full"),u(pt,"class","w-1/2"),u(be,"name","pm"),u(be,"type","number"),u(be,"min","0.001"),u(be,"max","1000"),u(be,"step","0.001"),u(be,"class","in-l tr w-full"),u(Ge,"class","w-1/2"),u(qt,"class","flex"),u(_l,"class","my-1"),u(Tt,"type","checkbox"),u(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,u(Tt,"class","rounded mb-1"),u(dl,"class","my-1"),Ml.__value=0,Ml.value=Ml.__value,Be.__value=1,Be.value=Be.__value,hl.__value=2,hl.value=hl.__value,u(St,"name","gs"),u(St,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[20].call(St)),u(vl,"class","my-1"),u(n,"class","cnt"),u(el,"class","text-sm"),u(Al,"href",Lt("Meter-configuration")),u(Al,"target","_blank"),u(Al,"class","float-right"),u(ai,"type","hidden"),u(ai,"name","m"),ai.value="true",u(Ri,"class","float-right"),u(Ht,"name","mi"),Ht.__value="true",Ht.value=Ht.__value,u(Ht,"type","checkbox"),u(Ht,"class","rounded mb-1"),u(fi,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Li=t[3].m.b!=0,u(ll,"name","mb"),u(ll,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[24].call(ll)),El.__value=0,El.value=El.__value,El.disabled=Ui=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,u(ct,"name","mp"),u(ct,"class","in-m"),ct.disabled=Oi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[25].call(ct)),u(Dt,"name","ms"),u(Dt,"type","number"),u(Dt,"min",64),u(Dt,"max",4096),u(Dt,"step",64),u(Dt,"class","in-l tr w-1/2"),u(Dl,"class","flex w-full"),u(tl,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,u(nl,"name","md"),u(nl,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[27].call(nl)),u(Bl,"class","my-1"),u(jt,"name","mf"),u(jt,"type","number"),u(jt,"min","5"),u(jt,"max","65535"),u(jt,"class","in-f tr w-full"),u(qi,"class","in-post"),u(yn,"class","flex"),u(zl,"class","mx-1"),u(Wt,"name","mr"),u(Wt,"type","number"),u(Wt,"min","0"),u(Wt,"max","65535"),u(Wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(Cn,"class","flex"),u(Yl,"class","mx-1"),u(wn,"class","my-1 flex"),u(Ms,"class","my-1"),u(Gt,"type","checkbox"),u(Gt,"name","me"),Gt.__value="true",Gt.value=Gt.__value,u(Gt,"class","rounded mb-1"),u(Vl,"class","my-1"),u(Bt,"type","checkbox"),u(Bt,"name","mm"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(qe,"class","cnt"),u(Gi,"class","text-sm"),u($n,"href",Lt("WiFi-configuration")),u($n,"target","_blank"),u($n,"class","float-right"),u(ci,"type","hidden"),u(ci,"name","w"),ci.value="true",u(bl,"name","ws"),u(bl,"type","text"),u(bl,"class","in-s"),u(Kl,"class","my-1"),u(gl,"name","wp"),u(gl,"type","password"),u(gl,"class","in-s"),u(Ql,"class","my-1"),Pn.__value=255,Pn.value=Pn.__value,Nn.__value=0,Nn.value=Nn.__value,Mn.__value=1,Mn.value=Mn.__value,An.__value=2,An.value=An.__value,u(It,"name","wz"),u(It,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[40].call(It)),u(Xl,"class","w-1/2"),u(Et,"name","ww"),u(Et,"type","number"),u(Et,"min","0"),u(Et,"max","20.5"),u(Et,"step","0.5"),u(Et,"class","in-f tr w-full"),u(Bi,"class","in-post"),u(Dn,"class","flex"),u(Zl,"class","ml-2 w-1/2"),u(Sn,"class","my-1 flex"),u(zt,"type","checkbox"),u(zt,"name","wa"),zt.__value="true",zt.value=zt.__value,u(zt,"class","rounded mb-1"),u(zi,"class","my-3"),u(Yt,"type","checkbox"),u(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"class","rounded mb-1"),u(Vi,"class","my-3"),u(lt,"class","cnt"),u(Qi,"class","text-sm"),u(In,"href",Lt("Network-configuration")),u(In,"target","_blank"),u(In,"class","float-right"),Fn.__value="dhcp",Fn.value=Fn.__value,Rn.__value="static",Rn.value=Rn.__value,u(il,"name","nm"),u(il,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[44].call(il)),u(Pt,"name","ni"),u(Pt,"type","text"),u(Pt,"class","in-m w-full"),Pt.disabled=Xi=t[3].n.m=="dhcp",Pt.required=Zi=t[3].n.m=="static",u(Nt,"name","ns"),u(Nt,"class","in-l"),Nt.disabled=Ji=t[3].n.m=="dhcp",Nt.required=xi=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[46].call(Nt)),u(Fl,"class","flex"),u(Jl,"class","my-1"),u(Vt,"name","nd"),Vt.__value="true",Vt.value=Vt.__value,u(Vt,"type","checkbox"),u(Vt,"class","rounded mb-1"),u(es,"class","my-1"),u(mi,"type","hidden"),u(mi,"name","ntp"),mi.value="true",u(Kt,"name","ntpd"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"type","checkbox"),u(Kt,"class","rounded mb-1"),u(pi,"class","ml-4"),u(kl,"name","ntph"),u(kl,"type","text"),u(kl,"class","in-s"),u(ls,"class","flex"),u(Rl,"class","my-1"),u(at,"class","cnt"),u(ns,"class","text-sm"),u(Un,"href",Lt("MQTT-configuration")),u(Un,"target","_blank"),u(Un,"class","float-right"),u(_i,"type","hidden"),u(_i,"name","q"),_i.value="true",u(wl,"name","qh"),u(wl,"type","text"),u(wl,"class","in-f w-3/4"),u(Qt,"name","qp"),u(Qt,"type","number"),u(Qt,"min","1024"),u(Qt,"max","65535"),u(Qt,"class","in-l tr w-1/4"),u(qn,"class","flex"),u(sl,"class","my-1"),u(yl,"name","qu"),u(yl,"type","text"),u(yl,"class","in-s"),u(xl,"class","my-1"),u(Cl,"name","qa"),u(Cl,"type","password"),u(Cl,"class","in-s"),u(en,"class","my-1"),u($l,"name","qc"),u($l,"type","text"),u($l,"class","in-f w-full"),Gn.__value=0,Gn.value=Gn.__value,Bn.__value=1,Bn.value=Bn.__value,zn.__value=2,zn.value=zn.__value,Yn.__value=3,Yn.value=Yn.__value,Vn.__value=4,Vn.value=Vn.__value,Kn.__value=255,Kn.value=Kn.__value,u(_t,"name","qm"),u(_t,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[59].call(_t)),u(Hn,"class","my-1 flex"),u(Tl,"name","qb"),u(Tl,"type","text"),u(Tl,"class","in-s"),u(tn,"class","my-1"),u(Ye,"class","cnt"),u(is,"class","text-sm"),u(Qn,"href",Lt("User-interface")),u(Qn,"target","_blank"),u(Qn,"class","float-right"),u(di,"type","hidden"),u(di,"name","u"),di.value="true",u(vi,"class","flex flex-wrap"),u(ol,"class","cnt"),u(ss,"class","text-sm"),u(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Zn,"target","_blank"),u(Zn,"class","float-right"),u(hi,"type","hidden"),u(hi,"name","d"),hi.value="true",u(Xt,"type","checkbox"),u(Xt,"name","ds"),Xt.__value="true",Xt.value=Xt.__value,u(Xt,"class","rounded mb-1"),u(os,"class","mt-3"),u(Mt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(xn,"type","button"),u(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(ei,"type","button"),u(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(rs,"class","text-center"),u(as,"class","text-right"),u(Ll,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(M,ee){y(M,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),X(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,b),s(b,d),s(d,v),s(d,g),s(d,k),s(d,$),V($,t[3].g.h),s(b,T),s(b,P),s(P,I),s(P,S),s(P,A),s(P,E),X(F,E,null),Re(E,t[3].g.t),s(n,Y),s(n,U),s(n,R),s(n,q),s(q,z),s(z,O),s(O,H),s(O,G),s(O,L),s(O,W),s(W,j),s(j,te),s(j,le),s(j,de),s(j,ie),s(j,we),s(W,Ie),s(Ie,$e),s(Ie,Ee),s(Ie,ve),s(Ie,Pe),s(W,Ae),s(Ae,me),s(Ae,se),s(W,pe),s(W,Q),s(W,oe),s(W,Ne),s(W,Me),s(W,he),s(W,x),s(W,_e),s(W,Le),s(W,je),s(W,Ke),s(W,Fe),s(W,He),Re(W,t[3].p.r),s(z,re),s(z,ge),s(ge,Ot),s(ge,Wl),s(ge,xt),s(ge,ft);for(let $t=0;$t<4;$t+=1)fs[$t].m(ft,null);Re(ft,t[3].p.c),s(n,Nl),s(n,_l),s(_l,qt),s(qt,pt),s(pt,Qe),s(pt,Xe),s(pt,Ze),s(pt,Ue),V(Ue,t[3].p.f),s(qt,Je),s(qt,Ge),s(Ge,xe),s(Ge,et),s(Ge,ue),s(Ge,be),V(be,t[3].p.m),s(n,Pi),s(n,dl),s(dl,pn),s(pn,Tt),Tt.checked=t[3].p.e,s(pn,Ni),s(dl,Mi),dt&&dt.m(dl,null),s(n,Ai),s(n,vl),s(vl,Di),s(vl,Ii),s(vl,Ei),s(vl,St),s(St,Ml),s(St,Be),s(St,hl),Re(St,t[3].g.s),s(n,Gl),vt&&vt.m(n,null),s(l,Ps),s(l,qe),s(qe,el),s(qe,Fi),s(qe,Al),X(_n,Al,null),s(qe,$o),s(qe,ai),s(qe,To),s(qe,tl),s(tl,Ri),s(tl,So),s(tl,Ns),s(tl,Po),s(tl,fi),s(fi,Ht),Ht.checked=t[3].m.i,s(fi,No),s(tl,Mo),s(tl,Dl),s(Dl,ll),s(ll,Il),s(Il,Ao);for(let $t=0;$t<7;$t+=1)cs[$t].m(ll,null);Re(ll,t[3].m.b),s(Dl,Do),s(Dl,ct),s(ct,El),s(El,Io),s(ct,dn),s(ct,vn),s(ct,hn),s(ct,bn),Re(ct,t[3].m.p),s(Dl,Eo),s(Dl,Dt),V(Dt,t[3].m.s),s(qe,Fo),s(qe,Bl),s(Bl,Ro),s(Bl,Lo),s(Bl,Uo),s(Bl,nl),s(nl,gn),s(nl,kn),Re(nl,t[3].m.d),s(qe,Oo),s(qe,wn),s(wn,zl),s(zl,qo),s(zl,Ho),s(zl,jo),s(zl,yn),s(yn,jt),V(jt,t[3].m.f),s(yn,Wo),s(yn,qi),s(wn,Go),s(wn,Yl),s(Yl,Bo),s(Yl,zo),s(Yl,Yo),s(Yl,Cn),s(Cn,Wt),V(Wt,t[3].m.r),s(Cn,Vo),s(Cn,Hi),s(qe,Ko),s(qe,Ms),s(qe,Qo),s(qe,Vl),s(Vl,ji),s(ji,Gt),Gt.checked=t[3].m.e.e,s(ji,Xo),s(Vl,Zo),ht&&ht.m(Vl,null),s(qe,Jo),bt&&bt.m(qe,null),s(qe,As),s(qe,Wi),s(Wi,Bt),Bt.checked=t[3].m.m.e,s(Wi,xo),s(qe,eu),gt&>.m(qe,null),s(l,tu),s(l,lt),s(lt,Gi),s(lt,lu),s(lt,$n),X(Tn,$n,null),s(lt,nu),s(lt,ci),s(lt,iu),s(lt,Kl),s(Kl,su),s(Kl,ou),s(Kl,uu),s(Kl,bl),V(bl,t[3].w.s),s(lt,ru),s(lt,Ql),s(Ql,au),s(Ql,fu),s(Ql,cu),s(Ql,gl),V(gl,t[3].w.p),s(lt,mu),s(lt,Sn),s(Sn,Xl),s(Xl,pu),s(Xl,_u),s(Xl,du),s(Xl,It),s(It,Pn),s(It,Nn),s(It,Mn),s(It,An),Re(It,t[3].w.z),s(Sn,vu),s(Sn,Zl),s(Zl,hu),s(Zl,bu),s(Zl,gu),s(Zl,Dn),s(Dn,Et),V(Et,t[3].w.w),s(Dn,ku),s(Dn,Bi),s(lt,wu),s(lt,zi),s(zi,Yi),s(Yi,zt),zt.checked=t[3].w.a,s(Yi,yu),s(lt,Cu),s(lt,Vi),s(Vi,Ki),s(Ki,Yt),Yt.checked=t[3].w.b,s(Ki,$u),s(l,Tu),s(l,at),s(at,Qi),s(at,Su),s(at,In),X(En,In,null),s(at,Pu),s(at,Jl),s(Jl,Nu),s(Jl,Mu),s(Jl,Au),s(Jl,Fl),s(Fl,il),s(il,Fn),s(il,Rn),Re(il,t[3].n.m),s(Fl,Du),s(Fl,Pt),V(Pt,t[3].n.i),s(Fl,Iu),s(Fl,Nt),X(Ln,Nt,null),Re(Nt,t[3].n.s),s(at,Eu),kt&&kt.m(at,null),s(at,Ds),s(at,es),s(es,ts),s(ts,Vt),Vt.checked=t[3].n.d,s(ts,Fu),s(at,Ru),s(at,mi),s(at,Lu),s(at,Rl),s(Rl,Uu),s(Rl,pi),s(pi,Kt),Kt.checked=t[3].n.h,s(pi,Ou),s(Rl,qu),s(Rl,Hu),s(Rl,ls),s(ls,kl),V(kl,t[3].n.n1),s(l,ju),s(l,Ye),s(Ye,ns),s(Ye,Wu),s(Ye,Un),X(On,Un,null),s(Ye,Gu),s(Ye,_i),s(Ye,Bu),s(Ye,sl),s(sl,zu),wt&&wt.m(sl,null),s(sl,Is),s(sl,Yu),s(sl,Vu),s(sl,qn),s(qn,wl),V(wl,t[3].q.h),s(qn,Ku),s(qn,Qt),V(Qt,t[3].q.p),s(Ye,Qu),nt&&nt.m(Ye,null),s(Ye,Es),s(Ye,xl),s(xl,Xu),s(xl,Zu),s(xl,Ju),s(xl,yl),V(yl,t[3].q.u),s(Ye,xu),s(Ye,en),s(en,er),s(en,tr),s(en,lr),s(en,Cl),V(Cl,t[3].q.a),s(Ye,nr),s(Ye,Hn),s(Hn,jn),s(jn,ir),s(jn,sr),s(jn,or),s(jn,$l),V($l,t[3].q.c),s(Hn,ur),s(Hn,Wn),s(Wn,rr),s(Wn,ar),s(Wn,fr),s(Wn,_t),s(_t,Gn),s(_t,Bn),s(_t,zn),s(_t,Yn),s(_t,Vn),s(_t,Kn),Re(_t,t[3].q.m),s(Ye,cr),s(Ye,tn),s(tn,mr),s(tn,pr),s(tn,_r),s(tn,Tl),V(Tl,t[3].q.b),s(l,dr),it&&it.m(l,null),s(l,Fs),st&&st.m(l,null),s(l,Rs),ot&&ot.m(l,null),s(l,Us),s(l,ol),s(ol,is),s(ol,vr),s(ol,Qn),X(Xn,Qn,null),s(ol,hr),s(ol,di),s(ol,br),s(ol,vi);for(let $t=0;$t0?vt?vt.p(M,ee):(vt=of(M),vt.c(),vt.m(n,null)):vt&&(vt.d(1),vt=null),ee[0]&8&&(Ht.checked=M[3].m.i),(!Zt||ee[0]&8&&Li!==(Li=M[3].m.b!=0))&&(Il.disabled=Li),ee[0]&8&&Re(ll,M[3].m.b),(!Zt||ee[0]&8&&Ui!==(Ui=M[3].m.b!=0))&&(El.disabled=Ui),(!Zt||ee[0]&8&&Oi!==(Oi=M[3].m.b==0))&&(ct.disabled=Oi),ee[0]&8&&Re(ct,M[3].m.p),ee[0]&8&&ae(Dt.value)!==M[3].m.s&&V(Dt,M[3].m.s),ee[0]&8&&Re(nl,M[3].m.d),ee[0]&8&&ae(jt.value)!==M[3].m.f&&V(jt,M[3].m.f),ee[0]&8&&ae(Wt.value)!==M[3].m.r&&V(Wt,M[3].m.r),ee[0]&8&&(Gt.checked=M[3].m.e.e),M[3].m.e.e?ht?ht.p(M,ee):(ht=uf(M),ht.c(),ht.m(Vl,null)):ht&&(ht.d(1),ht=null),M[3].m.e.e?bt?bt.p(M,ee):(bt=rf(M),bt.c(),bt.m(qe,As)):bt&&(bt.d(1),bt=null),ee[0]&8&&(Bt.checked=M[3].m.m.e),M[3].m.m.e?gt?gt.p(M,ee):(gt=af(M),gt.c(),gt.m(qe,null)):gt&&(gt.d(1),gt=null),ee[0]&8&&bl.value!==M[3].w.s&&V(bl,M[3].w.s),ee[0]&8&&gl.value!==M[3].w.p&&V(gl,M[3].w.p),ee[0]&8&&Re(It,M[3].w.z),ee[0]&8&&ae(Et.value)!==M[3].w.w&&V(Et,M[3].w.w),ee[0]&8&&(zt.checked=M[3].w.a),ee[0]&8&&(Yt.checked=M[3].w.b),ee[0]&8&&Re(il,M[3].n.m),(!Zt||ee[0]&8&&Xi!==(Xi=M[3].n.m=="dhcp"))&&(Pt.disabled=Xi),(!Zt||ee[0]&8&&Zi!==(Zi=M[3].n.m=="static"))&&(Pt.required=Zi),ee[0]&8&&Pt.value!==M[3].n.i&&V(Pt,M[3].n.i),(!Zt||ee[0]&8&&Ji!==(Ji=M[3].n.m=="dhcp"))&&(Nt.disabled=Ji),(!Zt||ee[0]&8&&xi!==(xi=M[3].n.m=="static"))&&(Nt.required=xi),ee[0]&8&&Re(Nt,M[3].n.s),M[3].n.m=="static"?kt?kt.p(M,ee):(kt=ff(M),kt.c(),kt.m(at,Ds)):kt&&(kt.d(1),kt=null),ee[0]&8&&(Vt.checked=M[3].n.d),ee[0]&8&&(Kt.checked=M[3].n.h),ee[0]&8&&kl.value!==M[3].n.n1&&V(kl,M[3].n.n1),M[0].chip!="esp8266"?wt?wt.p(M,ee):(wt=cf(M),wt.c(),wt.m(sl,Is)):wt&&(wt.d(1),wt=null),ee[0]&8&&wl.value!==M[3].q.h&&V(wl,M[3].q.h),ee[0]&8&&ae(Qt.value)!==M[3].q.p&&V(Qt,M[3].q.p),M[3].q.s.e?nt?(nt.p(M,ee),ee[0]&8&&N(nt,1)):(nt=mf(M),nt.c(),N(nt,1),nt.m(Ye,Es)):nt&&(Te(),D(nt,1,1,()=>{nt=null}),Se()),ee[0]&8&&yl.value!==M[3].q.u&&V(yl,M[3].q.u),ee[0]&8&&Cl.value!==M[3].q.a&&V(Cl,M[3].q.a),ee[0]&8&&$l.value!==M[3].q.c&&V($l,M[3].q.c),ee[0]&8&&Re(_t,M[3].q.m),ee[0]&8&&Tl.value!==M[3].q.b&&V(Tl,M[3].q.b),M[3].q.m==3?it?(it.p(M,ee),ee[0]&8&&N(it,1)):(it=pf(M),it.c(),N(it,1),it.m(l,Fs)):it&&(Te(),D(it,1,1,()=>{it=null}),Se()),M[3].q.m==4?st?(st.p(M,ee),ee[0]&8&&N(st,1)):(st=_f(M),st.c(),N(st,1),st.m(l,Rs)):st&&(Te(),D(st,1,1,()=>{st=null}),Se()),ee[0]&8&&(Ls=M[3].p.r.startsWith("10YNO")||M[3].p.r=="10Y1001A1001A48H"),Ls?ot?(ot.p(M,ee),ee[0]&8&&N(ot,1)):(ot=df(M),ot.c(),N(ot,1),ot.m(l,Us)):ot&&(Te(),D(ot,1,1,()=>{ot=null}),Se()),ee[0]&136){ti=M[7];let Ft;for(Ft=0;Ft20||M[0].chip=="esp8266"?ut?(ut.p(M,ee),ee[0]&1&&N(ut,1)):(ut=bf(M),ut.c(),N(ut,1),ut.m(l,Os)):ut&&(Te(),D(ut,1,1,()=>{ut=null}),Se()),ee[0]&8&&(Xt.checked=M[3].d.s),M[3].d.s?Ct?Ct.p(M,ee):(Ct=$f(M),Ct.c(),Ct.m(Mt,null)):Ct&&(Ct.d(1),Ct=null);const $t={};ee[0]&2&&($t.active=M[1]),ln.$set($t);const Mr={};ee[0]&4&&(Mr.active=M[2]),nn.$set(Mr);const Ar={};ee[0]&16&&(Ar.active=M[4]),sn.$set(Ar);const Dr={};ee[0]&32&&(Dr.active=M[5]),on.$set(Dr)},i(M){Zt||(N(a.$$.fragment,M),N(F.$$.fragment,M),N(_n.$$.fragment,M),N(Tn.$$.fragment,M),N(En.$$.fragment,M),N(Ln.$$.fragment,M),N(On.$$.fragment,M),N(nt),N(it),N(st),N(ot),N(Xn.$$.fragment,M),N(ut),N(Jn.$$.fragment,M),N(ln.$$.fragment,M),N(nn.$$.fragment,M),N(sn.$$.fragment,M),N(on.$$.fragment,M),Zt=!0)},o(M){D(a.$$.fragment,M),D(F.$$.fragment,M),D(_n.$$.fragment,M),D(Tn.$$.fragment,M),D(En.$$.fragment,M),D(Ln.$$.fragment,M),D(On.$$.fragment,M),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,M),D(ut),D(Jn.$$.fragment,M),D(ln.$$.fragment,M),D(nn.$$.fragment,M),D(sn.$$.fragment,M),D(on.$$.fragment,M),Zt=!1},d(M){M&&w(e),Z(a),Z(F),ml(fs,M),dt&&dt.d(),vt&&vt.d(),Z(_n),ml(cs,M),ht&&ht.d(),bt&&bt.d(),gt&>.d(),Z(Tn),Z(En),Z(Ln),kt&&kt.d(),Z(On),wt&&wt.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),Z(Xn),ml(yt,M),ut&&ut.d(),Z(Jn),Ct&&Ct.d(),M&&w(Hs),Z(ln,M),M&&w(js),Z(nn,M),M&&w(Ws),Z(sn,M),M&&w(Gs),Z(on,M),Bs=!1,Ve(Nr)}}}async function Zp(){await(await fetch("/reboot",{method:"POST"})).json()}function Jp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};qc.subscribe(Be=>{Be.version&&(l(3,a=Be),l(1,o=!1))}),Sp();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Be=new URLSearchParams;Be.append("perform","true");let Gl=await(await fetch("/reset",{method:"POST",body:Be})).json();l(4,f=!1),l(5,c=Gl.success)}}async function _(Be){l(2,r=!0);const hl=new FormData(Be.target),Gl=new URLSearchParams;for(let el of hl){const[Fi,Al]=el;Gl.append(Fi,Al)}let qe=await(await fetch("/save",{method:"POST",body:Gl})).json();Ut.update(el=>(el.booting=qe.reboot,el.ui=a.u,el)),l(2,r=!1),ii("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(Be=>(Be.booting=!0,Be)),Zp())},d=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function k(){a.g.t=mt(this),l(3,a)}function $(){a.p.r=mt(this),l(3,a)}function T(){a.p.c=mt(this),l(3,a)}function P(){a.p.f=ae(this.value),l(3,a)}function I(){a.p.m=ae(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function E(){a.g.s=mt(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function Y(){a.g.p=this.value,l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function R(){a.m.b=mt(this),l(3,a)}function q(){a.m.p=mt(this),l(3,a)}function z(){a.m.s=ae(this.value),l(3,a)}function O(){a.m.d=mt(this),l(3,a)}function H(){a.m.f=ae(this.value),l(3,a)}function G(){a.m.r=ae(this.value),l(3,a)}function L(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function j(){a.m.e.a=this.value,l(3,a)}function te(){a.m.m.e=this.checked,l(3,a)}function le(){a.m.m.w=ae(this.value),l(3,a)}function de(){a.m.m.v=ae(this.value),l(3,a)}function ie(){a.m.m.a=ae(this.value),l(3,a)}function we(){a.m.m.c=ae(this.value),l(3,a)}function Ie(){a.w.s=this.value,l(3,a)}function $e(){a.w.p=this.value,l(3,a)}function Ee(){a.w.z=mt(this),l(3,a)}function ve(){a.w.w=ae(this.value),l(3,a)}function Pe(){a.w.a=this.checked,l(3,a)}function Ae(){a.w.b=this.checked,l(3,a)}function me(){a.n.m=mt(this),l(3,a)}function se(){a.n.i=this.value,l(3,a)}function pe(){a.n.s=mt(this),l(3,a)}function Q(){a.n.g=this.value,l(3,a)}function oe(){a.n.d1=this.value,l(3,a)}function Ne(){a.n.d2=this.value,l(3,a)}function Me(){a.n.d=this.checked,l(3,a)}function he(){a.n.h=this.checked,l(3,a)}function x(){a.n.n1=this.value,l(3,a)}function _e(){a.q.s.e=this.checked,l(3,a)}function Le(){a.q.h=this.value,l(3,a)}function je(){a.q.p=ae(this.value),l(3,a)}function Ke(){a.q.u=this.value,l(3,a)}function Fe(){a.q.a=this.value,l(3,a)}function He(){a.q.c=this.value,l(3,a)}function re(){a.q.m=mt(this),l(3,a)}function ge(){a.q.b=this.value,l(3,a)}function Ot(){a.o.e=this.value,l(3,a)}function Wl(){a.o.c=this.value,l(3,a)}function xt(){a.o.u1=this.value,l(3,a)}function ft(){a.o.u2=this.value,l(3,a)}function Nl(){a.o.u3=this.value,l(3,a)}function _l(){a.h.t=this.value,l(3,a)}function qt(){a.h.h=this.value,l(3,a)}function pt(){a.h.n=this.value,l(3,a)}function Qe(Be){a.t.t[Be]=ae(this.value),l(3,a)}function Xe(){a.t.h=ae(this.value),l(3,a)}function Ze(Be){a.u[Be.key]=mt(this),l(3,a)}function Ue(){a.i.h.u=this.checked,l(3,a)}function Je(){a.i.h.p=mt(this),l(3,a)}function Ge(){a.i.a=ae(this.value),l(3,a)}function xe(){a.i.l.i=this.checked,l(3,a)}function et(){a.i.l.p=ae(this.value),l(3,a)}function ue(){a.i.r.i=this.checked,l(3,a)}function be(){a.i.r.r=ae(this.value),l(3,a)}function Pi(){a.i.r.g=ae(this.value),l(3,a)}function dl(){a.i.r.b=ae(this.value),l(3,a)}function pn(){a.i.t.d=ae(this.value),l(3,a)}function Tt(){a.i.t.a=ae(this.value),l(3,a)}function Ni(){a.i.v.p=ae(this.value),l(3,a)}function Mi(){a.i.v.d.v=ae(this.value),l(3,a)}function Ai(){a.i.v.d.g=ae(this.value),l(3,a)}function vl(){a.i.v.o=ae(this.value),l(3,a)}function Di(){a.i.v.m=ae(this.value),l(3,a)}function Ii(){a.i.v.b=ae(this.value),l(3,a)}function Ei(){a.d.s=this.checked,l(3,a)}function St(){a.d.t=this.checked,l(3,a)}function Ml(){a.d.l=mt(this),l(3,a)}return t.$$set=Be=>{"sysinfo"in Be&&l(0,n=Be.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,v,i,p,_,b,d,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke,Fe,He,re,ge,Ot,Wl,xt,ft,Nl,_l,qt,pt,Qe,Xe,Ze,Ue,Je,Ge,xe,et,ue,be,Pi,dl,pn,Tt,Ni,Mi,Ai,vl,Di,Ii,Ei,St,Ml]}class xp extends Ce{constructor(e){super(),ye(this,e,Jp,Xp,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Sf(t,e,l){const n=t.slice();return n[20]=e[l],n}function e0(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function Pf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,p,_,b,d=Qr(t[1])+"",v,g,k=t[1].boot_reason+"",$,T,P=t[1].ex_cause+"",I,S,A;const E=[l0,t0],F=[];function Y(U,R){return U[0].u>0?0:1}return f=Y(t),c=F[f]=E[f](t),{c(){e=m("div"),l=C("AP MAC: "),i=C(n),o=h(),r=m("div"),a=C(`Last boot:\r + `),c.c(),p=h(),_=m("div"),b=C("Reason: "),v=C(d),g=C(" ("),$=C(k),T=C("/"),I=C(P),S=C(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(_,"class","my-2")},m(U,R){y(U,e,R),s(e,l),s(e,i),y(U,o,R),y(U,r,R),s(r,a),F[f].m(r,null),y(U,p,R),y(U,_,R),s(_,b),s(_,v),s(_,g),s(_,$),s(_,T),s(_,I),s(_,S),A=!0},p(U,R){(!A||R&2)&&n!==(n=U[1].apmac+"")&&B(i,n);let q=f;f=Y(U),f===q?F[f].p(U,R):(Te(),D(F[q],1,1,()=>{F[q]=null}),Se(),c=F[f],c?c.p(U,R):(c=F[f]=E[f](U),c.c()),N(c,1),c.m(r,null)),(!A||R&2)&&d!==(d=Qr(U[1])+"")&&B(v,d),(!A||R&2)&&k!==(k=U[1].boot_reason+"")&&B($,k),(!A||R&2)&&P!==(P=U[1].ex_cause+"")&&B(I,P)},i(U){A||(N(c),A=!0)},o(U){D(c),A=!1},d(U){U&&w(e),U&&w(o),U&&w(r),F[f].d(),U&&w(p),U&&w(_)}}}function t0(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ne,i:ne,o:ne,d(l){l&&w(e)}}}function l0(t){let e,l;return e=new Lc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function n0(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ne,d(l){l&&w(e)}}}function Nf(t){let e,l,n,i,o,r=Cs(t[1].meter.mfg)+"",a,f,c,p,_=t[1].meter.model+"",b,d,v,g,k=t[1].meter.id+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=C("Manufacturer: "),a=C(r),f=h(),c=m("div"),p=C("Model: "),b=C(_),d=h(),v=m("div"),g=C("ID: "),$=C(k),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$)},p(T,P){P&2&&r!==(r=Cs(T[1].meter.mfg)+"")&&B(a,r),P&2&&_!==(_=T[1].meter.model+"")&&B(b,_),P&2&&k!==(k=T[1].meter.id+"")&&B($,k)},d(T){T&&w(e)}}}function Mf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",b,d,v,g,k=t[1].net.gw+"",$,T,P,I,S=t[1].net.dns1+"",A,E,F=t[1].net.dns2&&Af(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=C("IP: "),a=C(r),f=h(),c=m("div"),p=C("Mask: "),b=C(_),d=h(),v=m("div"),g=C("Gateway: "),$=C(k),T=h(),P=m("div"),I=C("DNS: "),A=C(S),E=h(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(Y,U){y(Y,e,U),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$),s(e,T),s(e,P),s(P,I),s(P,A),s(P,E),F&&F.m(P,null)},p(Y,U){U&2&&r!==(r=Y[1].net.ip+"")&&B(a,r),U&2&&_!==(_=Y[1].net.mask+"")&&B(b,_),U&2&&k!==(k=Y[1].net.gw+"")&&B($,k),U&2&&S!==(S=Y[1].net.dns1+"")&&B(A,S),Y[1].net.dns2?F?F.p(Y,U):(F=Af(Y),F.c(),F.m(P,null)):F&&(F.d(1),F=null)},d(Y){Y&&w(e),F&&F.d()}}}function Af(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function Df(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",f,c,p=t[1].upgrade.x+"",_,b,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=C("Previous upgrade attempt ("),o=C(i),r=C(") does not match current version ("),f=C(a),c=C(") ["),_=C(p),b=C("/"),v=C(d),g=C("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(k,$){y(k,e,$),s(e,l),s(l,n),s(l,o),s(l,r),s(l,f),s(l,c),s(l,_),s(l,b),s(l,v),s(l,g)},p(k,$){$&2&&i!==(i=k[1].upgrade.t+"")&&B(o,i),$&2&&a!==(a=k[1].version+"")&&B(f,a),$&2&&p!==(p=k[1].upgrade.x+"")&&B(_,p),$&2&&d!==(d=k[1].upgrade.e+"")&&B(v,d)},d(k){k&&w(e)}}}function If(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Ef(t),b=t[1].fwconsent===2&&Ff();return{c(){e=m("div"),l=C(`Latest version: \r + `),n=m("a"),o=C(i),a=h(),_&&_.c(),f=h(),b&&b.c(),c=We(),u(n,"href",r=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(d,v){y(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),y(d,f,v),b&&b.m(d,v),y(d,c,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&B(o,i),(!p||v&4&&r!==(r=d[2].html_url))&&u(n,"href",r),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&N(_,1)):(_=Ef(d),_.c(),N(_,1),_.m(e,null)):_&&(Te(),D(_,1,1,()=>{_=null}),Se()),d[1].fwconsent===2?b||(b=Ff(),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i(d){p||(N(_),p=!0)},o(d){D(_),p=!1},d(d){d&&w(e),_&&_.d(),d&&w(f),b&&b.d(d),d&&w(c)}}}function Ef(t){let e,l,n,i,o,r;return n=new Uc({}),{c(){e=m("div"),l=m("button"),J(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(a,f){y(a,e,f),s(e,l),X(n,l,null),i=!0,o||(r=K(l,"click",t[10]),o=!0)},p:ne,i(a){i||(N(n.$$.fragment,a),i=!0)},o(a){D(n.$$.fragment,a),i=!1},d(a){a&&w(e),Z(n),o=!1,r()}}}function Ff(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Rf(t){let e,l=$s(fe(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=$s(fe(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function Lf(t){let e,l,n,i,o,r;function a(p,_){return p[4].length==0?s0:i0}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),c.c(),Jf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){y(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(r=[K(n,"change",t[13]),K(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&w(e),t[12](null),c.d(),o=!1,Ve(r)}}}function i0(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function s0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=K(e,"click",t[14]),l=!0)},p:ne,d(i){i&&w(e),l=!1,n()}}}function Uf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g=t[9],k=[];for(let S=0;S Include Secrets
(SSID, PSK, passwords and tokens)',f=h(),$&&$.c(),c=h(),p=m("form"),_=m("input"),b=h(),I.c(),u(l,"class","text-sm"),u(a,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),Jf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(S,A){y(S,e,A),s(e,l),s(e,n),s(e,i),s(i,o);for(let E=0;E{me=null}),Se());const je={};_e&8388608&&(je.$$scope={dirty:_e,ctx:x}),S.$set(je),x[1].meter?se?se.p(x,_e):(se=Nf(x),se.c(),se.m(e,Y)):se&&(se.d(1),se=null),x[1].net?pe?pe.p(x,_e):(pe=Mf(x),pe.c(),pe.m(e,U)):pe&&(pe.d(1),pe=null),(!ve||_e&2)&&G!==(G=x[1].version+"")&&B(L,G),x[1].upgrade.t&&x[1].upgrade.t!=x[1].version?Q?Q.p(x,_e):(Q=Df(x),Q.c(),Q.m(R,j)):Q&&(Q.d(1),Q=null),x[2]?oe?(oe.p(x,_e),_e&4&&N(oe,1)):(oe=If(x),oe.c(),N(oe,1),oe.m(R,te)):oe&&(Te(),D(oe,1,1,()=>{oe=null}),Se()),_e&3&&(le=(x[1].security==0||x[0].a)&&si(x[1].board)),le?Ne?Ne.p(x,_e):(Ne=Rf(x),Ne.c(),Ne.m(R,de)):Ne&&(Ne.d(1),Ne=null),x[1].security==0||x[0].a?Me?Me.p(x,_e):(Me=Lf(x),Me.c(),Me.m(R,null)):Me&&(Me.d(1),Me=null),x[1].security==0||x[0].a?he?he.p(x,_e):(he=Uf(x),he.c(),he.m(e,null)):he&&(he.d(1),he=null);const Ke={};_e&32&&(Ke.active=x[5]),Ie.$set(Ke);const Fe={};_e&256&&(Fe.active=x[8]),Ee.$set(Fe)},i(x){ve||(N(b.$$.fragment,x),N(me),N(S.$$.fragment,x),N(oe),N(Ie.$$.fragment,x),N(Ee.$$.fragment,x),ve=!0)},o(x){D(b.$$.fragment,x),D(me),D(S.$$.fragment,x),D(oe),D(Ie.$$.fragment,x),D(Ee.$$.fragment,x),ve=!1},d(x){x&&w(e),Z(b),me&&me.d(),Z(S),se&&se.d(),pe&&pe.d(),Q&&Q.d(),oe&&oe.d(),Ne&&Ne.d(),Me&&Me.d(),he&&he.d(),x&&w(we),Z(Ie,x),x&&w($e),Z(Ee,x),Pe=!1,Ae()}}}async function a0(){await(await fetch("/reboot",{method:"POST"})).json()}function f0(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],r={};yo.subscribe(E=>{l(2,r=Rc(i.version,E)),r||l(2,r=E[0])});function a(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm($s(fe(i.chip,i.board))))&&(Ut.update(E=>(E.upgrading=!0,E)),Fc(r.tag_name))}const f=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(E=>(E.booting=!0,E)),a0())};let c,p=[],_=!1,b,d=[],v=!1;go();function g(E){ws[E?"unshift":"push"](()=>{c=E,l(3,c)})}function k(){p=this.files,l(4,p)}const $=()=>{c.click()},T=()=>l(5,_=!0);function P(E){ws[E?"unshift":"push"](()=>{b=E,l(6,b)})}function I(){d=this.files,l(7,d)}const S=()=>{b.click()},A=()=>l(8,v=!0);return t.$$set=E=>{"data"in E&&l(0,n=E.data),"sysinfo"in E&&l(1,i=E.sysinfo)},[n,i,r,c,p,_,b,d,v,o,a,f,g,k,$,T,P,I,S,A]}class c0 extends Ce{constructor(e){super(),ye(this,e,f0,r0,ke,{data:0,sysinfo:1})}}function Hf(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],5)+"",a,f,c=fe(t[0],4)+"",p,_,b=fe(t[0],3)+"",d,v,g,k,$=fe(t[0],2)+"",T,P,I=fe(t[0],1)+"",S,A,E=fe(t[0],0)+"",F,Y,U,R,q=fe(t[0],101)+"",z,O,H=fe(t[0],100)+"",G;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),v=h(),g=m("optgroup"),k=m("option"),T=C($),P=m("option"),S=C(I),A=m("option"),F=C(E),Y=h(),U=m("optgroup"),R=m("option"),z=C(q),O=m("option"),G=C(H),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,P.__value=1,P.value=P.__value,A.__value=0,A.value=A.__value,u(g,"label","Custom hardware"),R.__value=101,R.value=R.__value,O.__value=100,O.value=O.__value,u(U,"label","Generic hardware")},m(L,W){y(L,e,W),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),y(L,v,W),y(L,g,W),s(g,k),s(k,T),s(g,P),s(P,S),s(g,A),s(A,F),y(L,Y,W),y(L,U,W),s(U,R),s(R,z),s(U,O),s(O,G)},p(L,W){W&1&&n!==(n=fe(L[0],7)+"")&&B(i,n),W&1&&r!==(r=fe(L[0],5)+"")&&B(a,r),W&1&&c!==(c=fe(L[0],4)+"")&&B(p,c),W&1&&b!==(b=fe(L[0],3)+"")&&B(d,b),W&1&&$!==($=fe(L[0],2)+"")&&B(T,$),W&1&&I!==(I=fe(L[0],1)+"")&&B(S,I),W&1&&E!==(E=fe(L[0],0)+"")&&B(F,E),W&1&&q!==(q=fe(L[0],101)+"")&&B(z,q),W&1&&H!==(H=fe(L[0],100)+"")&&B(G,H)},d(L){L&&w(e),L&&w(v),L&&w(g),L&&w(Y),L&&w(U)}}}function jf(t){let e,l,n=fe(t[0],201)+"",i,o,r=fe(t[0],202)+"",a,f,c=fe(t[0],203)+"",p,_,b=fe(t[0],200)+"",d;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(v,g){y(v,e,g),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d)},p(v,g){g&1&&n!==(n=fe(v[0],201)+"")&&B(i,n),g&1&&r!==(r=fe(v[0],202)+"")&&B(a,r),g&1&&c!==(c=fe(v[0],203)+"")&&B(p,c),g&1&&b!==(b=fe(v[0],200)+"")&&B(d,b)},d(v){v&&w(e)}}}function Wf(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],6)+"",a,f,c=fe(t[0],5)+"",p,_,b,d,v=fe(t[0],51)+"",g,k,$=fe(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=h(),b=m("optgroup"),d=m("option"),g=C(v),k=m("option"),T=C($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,u(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,k.__value=50,k.value=k.__value,u(b,"label","Generic hardware")},m(P,I){y(P,e,I),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),y(P,_,I),y(P,b,I),s(b,d),s(d,g),s(b,k),s(k,T)},p(P,I){I&1&&n!==(n=fe(P[0],7)+"")&&B(i,n),I&1&&r!==(r=fe(P[0],6)+"")&&B(a,r),I&1&&c!==(c=fe(P[0],5)+"")&&B(p,c),I&1&&v!==(v=fe(P[0],51)+"")&&B(g,v),I&1&&$!==($=fe(P[0],50)+"")&&B(T,$)},d(P){P&&w(e),P&&w(_),P&&w(b)}}}function Gf(t){let e,l,n=fe(t[0],8)+"",i,o,r,a,f=fe(t[0],71)+"",c,p,_=fe(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=h(),r=m("optgroup"),a=m("option"),c=C(f),p=m("option"),b=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,u(r,"label","Generic hardware")},m(d,v){y(d,e,v),s(e,l),s(l,i),y(d,o,v),y(d,r,v),s(r,a),s(a,c),s(r,p),s(p,b)},p(d,v){v&1&&n!==(n=fe(d[0],8)+"")&&B(i,n),v&1&&f!==(f=fe(d[0],71)+"")&&B(c,f),v&1&&_!==(_=fe(d[0],70)+"")&&B(b,_)},d(d){d&&w(e),d&&w(o),d&&w(r)}}}function Bf(t){let e,l,n=fe(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,r){y(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=fe(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function m0(t){let e,l,n,i,o,r,a,f=t[0]=="esp8266"&&Hf(t),c=t[0]=="esp32"&&jf(t),p=t[0]=="esp32s2"&&Wf(t),_=t[0]=="esp32c3"&&Gf(t),b=t[0]=="esp32solo"&&Bf(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),c&&c.c(),i=h(),p&&p.c(),o=h(),_&&_.c(),r=h(),b&&b.c(),a=We(),e.__value=-1,e.value=e.__value},m(d,v){y(d,e,v),y(d,l,v),f&&f.m(d,v),y(d,n,v),c&&c.m(d,v),y(d,i,v),p&&p.m(d,v),y(d,o,v),_&&_.m(d,v),y(d,r,v),b&&b.m(d,v),y(d,a,v)},p(d,[v]){d[0]=="esp8266"?f?f.p(d,v):(f=Hf(d),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"?c?c.p(d,v):(c=jf(d),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Wf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Gf(d),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),d[0]=="esp32solo"?b?b.p(d,v):(b=Bf(d),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:ne,o:ne,d(d){d&&w(e),d&&w(l),f&&f.d(d),d&&w(n),c&&c.d(d),d&&w(i),p&&p.d(d),d&&w(o),_&&_.d(d),d&&w(r),b&&b.d(d),d&&w(a)}}}function p0(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class _0 extends Ce{constructor(e){super(),ye(this,e,p0,m0,ke,{chip:0})}}function zf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Yf(t){let e,l,n,i,o,r,a;return r=new Hc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=C("HAN GPIO"),n=m("br"),i=h(),o=m("select"),J(r.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),X(r,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),r.$set(p)},i(f){a||(N(r.$$.fragment,f),a=!0)},o(f){D(r.$$.fragment,f),a=!1},d(f){f&&w(e),Z(r)}}}function d0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O=t[0].usrcfg&&zf();v=new _0({props:{chip:t[0].chip}});let H=t[0].board&&t[0].board>20&&Yf(t);return U=new At({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Initial configuration",a=h(),O&&O.c(),f=h(),c=m("div"),p=C("Board type"),_=m("br"),b=h(),d=m("select"),J(v.$$.fragment),g=h(),H&&H.c(),k=h(),$=m("div"),T=m("label"),P=m("input"),I=C(" Clear all other configuration"),S=h(),A=m("div"),A.innerHTML='',E=h(),F=m("span"),F.textContent="\xA0",Y=h(),J(U.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),t[0].board===void 0&&tt(()=>t[4].call(d)),u(c,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u($,"class","my-3"),u(A,"class","my-3"),u(F,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),O&&O.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,b),s(c,d),X(v,d,null),Re(d,t[0].board),s(n,g),H&&H.m(n,null),s(n,k),s(n,$),s($,T),s(T,P),P.checked=t[2],s(T,I),s(n,S),s(n,A),s(n,E),s(n,F),y(G,Y,L),X(U,G,L),R=!0,q||(z=[K(d,"change",t[4]),K(P,"change",t[5]),K(n,"submit",Ts(t[3]))],q=!0)},p(G,[L]){G[0].usrcfg?O||(O=zf(),O.c(),O.m(n,f)):O&&(O.d(1),O=null);const W={};L&1&&(W.chip=G[0].chip),v.$set(W),L&1&&Re(d,G[0].board),G[0].board&&G[0].board>20?H?(H.p(G,L),L&1&&N(H,1)):(H=Yf(G),H.c(),N(H,1),H.m(n,k)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),L&4&&(P.checked=G[2]);const j={};L&2&&(j.active=G[1]),U.$set(j)},i(G){R||(N(v.$$.fragment,G),N(H),N(U.$$.fragment,G),R=!0)},o(G){D(v.$$.fragment,G),D(H),D(U.$$.fragment,G),R=!1},d(G){G&&w(e),O&&O.d(),Z(v),H&&H.d(),G&&w(Y),Z(U,G),q=!1,Ve(z)}}}function v0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let v of p){const[g,k]=v;_.append(g,k)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Ut.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),ii(n.usrcfg?"/":"/setup")}let r=!1;function a(){n.board=mt(this),l(0,n)}function f(){r=this.checked,l(2,r),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,f]}class h0 extends Ce{constructor(e){super(),ye(this,e,v0,d0,ke,{sysinfo:0})}}function Vf(t){let e,l,n,i,o,r,a,f;return a=new jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),r=m("select"),J(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.required=t[1],u(n,"class","flex")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),s(n,o),s(n,r),X(a,r,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(r.required=c[1])},i(c){f||(N(a.$$.fragment,c),f=!0)},o(c){D(a.$$.fragment,c),f=!1},d(c){c&&w(e),c&&w(l),c&&w(n),Z(a)}}}function Kf(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
-
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function y0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z=t[1]&&jf(t),O=t[1]&&Wf();return Y=new At({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Setup",a=h(),f=m("div"),f.innerHTML=`SSID
+
`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function b0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z=t[1]&&Vf(t),O=t[1]&&Kf();return Y=new At({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Setup",a=h(),f=m("div"),f.innerHTML=`SSID
`,c=h(),p=m("div"),p.innerHTML=`PSK
`,_=h(),b=m("div"),d=C(`Hostname - `),v=m("input"),g=h(),k=m("div"),$=m("label"),T=m("input"),P=C(" Static IP"),E=h(),z&&z.c(),S=h(),O&&O.c(),A=h(),I=m("div"),I.innerHTML='',F=h(),J(Y.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"class","text-sm"),u(f,"class","my-3"),u(p,"class","my-3"),u(v,"name","sh"),u(v,"type","text"),u(v,"class","in-s"),u(v,"maxlength","32"),u(v,"pattern","[a-z0-9_-]+"),u(v,"placeholder","Optional, ex.: ams-reader"),u(v,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u(k,"class","my-3"),u(I,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(H,G){y(H,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(n,c),s(n,p),s(n,_),s(n,b),s(b,d),s(b,v),V(v,t[0].hostname),s(n,g),s(n,k),s(k,$),s($,T),T.checked=t[1],s($,P),s(k,E),z&&z.m(k,null),s(n,S),O&&O.m(n,null),s(n,A),s(n,I),y(H,F,G),X(Y,H,G),U=!0,R||(q=[K(v,"input",t[4]),K(T,"change",t[5]),K(n,"submit",ks(t[3]))],R=!0)},p(H,[G]){G&1&&v.value!==H[0].hostname&&V(v,H[0].hostname),G&2&&(T.checked=H[1]),H[1]?z?(z.p(H,G),G&2&&N(z,1)):(z=jf(H),z.c(),N(z,1),z.m(k,null)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),H[1]?O||(O=Wf(),O.c(),O.m(n,A)):O&&(O.d(1),O=null);const L={};G&4&&(L.active=H[2]),Y.$set(L)},i(H){U||(N(z),N(Y.$$.fragment,H),U=!0)},o(H){D(z),D(Y.$$.fragment,H),U=!1},d(H){H&&w(e),z&&z.d(),O&&O.d(),H&&w(F),Z(Y,H),R=!1,Ve(q)}}}function C0(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){b();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Ut.update(v=>(v.trying=_,v));var d=new XMLHttpRequest;d.timeout=5e3,d.addEventListener("abort",b),d.addEventListener("error",b),d.addEventListener("timeout",b),d.addEventListener("load",function(v){window.location.href=_||"/"}),d.open("GET",_+"/is-alive",!0),d.send()}async function f(_){l(2,o=!0);const b=new FormData(_.target),d=new URLSearchParams;for(let k of b){const[$,T]=k;d.append($,T)}let g=await(await fetch("/save",{method:"POST",body:d})).json();l(2,o=!1),Ut.update(k=>(k.hostname=b.get("sh"),k.usrcfg=g.success,k.booting=g.reboot,i&&(k.net.ip=b.get("si"),k.net.mask=b.get("su"),k.net.gw=b.get("sg"),k.net.dns1=b.get("sd")),setTimeout(a,5e3),k))}function c(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,f,c,p]}class $0 extends Ce{constructor(e){super(),ye(this,e,C0,y0,ke,{sysinfo:0})}}function T0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$;return v=new At({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=C("Upload "),o=C(t[1]),r=h(),a=m("p"),a.textContent="Select a suitable file and click upload",f=h(),c=m("form"),p=m("input"),_=h(),b=m("div"),b.innerHTML='',d=h(),J(v.$$.fragment),u(a,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(b,"class","w-full text-right mt-4"),u(c,"action",t[0]),u(c,"enctype","multipart/form-data"),u(c,"method","post"),u(c,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){y(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,r),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,b),y(T,d,P),X(v,T,P),g=!0,k||($=K(c,"submit",t[3]),k=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(c,"action",T[0]);const E={};P&4&&(E.active=T[2]),v.$set(E)},i(T){g||(N(v.$$.fragment,T),g=!0)},o(T){D(v.$$.fragment,T),g=!1},d(T){T&&w(e),T&&w(d),Z(v,T),k=!1,$()}}}function S0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}class go extends Ce{constructor(e){super(),ye(this,e,S0,T0,ke,{action:0,title:1})}}function P0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E,S,A,I,F,Y,U,R,q,z,O,H;return q=new At({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),r=m("hr"),a=h(),f=m("div"),c=C("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=h(),b=m("a"),d=C("Read more"),v=m("br"),g=h(),k=m("label"),$=m("input"),P=C(" Yes"),E=m("label"),S=m("input"),I=C(" No"),F=m("br"),Y=h(),U=m("div"),U.innerHTML='',R=h(),J(q.$$.fragment),u(b,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u($,"type","radio"),u($,"name","sf"),$.value=1,$.checked=T=t[0].fwconsent===1,u($,"class","rounded m-2"),$.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=A=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(f,"class","my-3"),u(U,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,b),s(b,d),s(f,v),s(f,g),s(f,k),s(k,$),s(k,P),s(f,E),s(E,S),s(E,I),s(f,F),s(n,Y),s(n,U),y(G,R,L),X(q,G,L),z=!0,O||(H=K(n,"submit",ks(t[2])),O=!0)},p(G,[L]){(!z||L&1&&T!==(T=G[0].fwconsent===1))&&($.checked=T),(!z||L&1&&A!==(A=G[0].fwconsent===2))&&(S.checked=A);const W={};L&2&&(W.active=G[1]),q.$set(W)},i(G){z||(N(q.$$.fragment,G),z=!0)},o(G){D(q.$$.fragment,G),z=!1},d(G){G&&w(e),G&&w(R),Z(q,G),O=!1,H()}}}function N0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),f=new URLSearchParams;for(let _ of a){const[b,d]=_;f.append(b,d)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),Ut.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),ni("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.sysinfo)},[n,i,o]}class M0 extends Ce{constructor(e){super(),ye(this,e,N0,P0,ke,{sysinfo:0})}}function A0(t){let e,l;return e=new Mp({props:{data:t[1],sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function D0(t){let e,l;return e=new n0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function E0(t){let e,l;return e=new d0({props:{sysinfo:t[0],data:t[1]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function I0(t){let e,l;return e=new go({props:{title:"CA",action:"/mqtt-ca"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function F0(t){let e,l;return e=new go({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function R0(t){let e,l;return e=new go({props:{title:"private key",action:"/mqtt-key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function L0(t){let e,l;return e=new M0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function U0(t){let e,l;return e=new $0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function O0(t){let e,l;return e=new w0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function q0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,E;return e=new Gm({props:{data:t[1]}}),n=new $l({props:{path:"/",$$slots:{default:[A0]},$$scope:{ctx:t}}}),o=new $l({props:{path:"/configuration",$$slots:{default:[D0]},$$scope:{ctx:t}}}),a=new $l({props:{path:"/status",$$slots:{default:[E0]},$$scope:{ctx:t}}}),c=new $l({props:{path:"/mqtt-ca",$$slots:{default:[I0]},$$scope:{ctx:t}}}),_=new $l({props:{path:"/mqtt-cert",$$slots:{default:[F0]},$$scope:{ctx:t}}}),d=new $l({props:{path:"/mqtt-key",$$slots:{default:[R0]},$$scope:{ctx:t}}}),g=new $l({props:{path:"/consent",$$slots:{default:[L0]},$$scope:{ctx:t}}}),$=new $l({props:{path:"/setup",$$slots:{default:[U0]},$$scope:{ctx:t}}}),P=new $l({props:{path:"/vendor",$$slots:{default:[O0]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment),l=h(),J(n.$$.fragment),i=h(),J(o.$$.fragment),r=h(),J(a.$$.fragment),f=h(),J(c.$$.fragment),p=h(),J(_.$$.fragment),b=h(),J(d.$$.fragment),v=h(),J(g.$$.fragment),k=h(),J($.$$.fragment),T=h(),J(P.$$.fragment)},m(S,A){X(e,S,A),y(S,l,A),X(n,S,A),y(S,i,A),X(o,S,A),y(S,r,A),X(a,S,A),y(S,f,A),X(c,S,A),y(S,p,A),X(_,S,A),y(S,b,A),X(d,S,A),y(S,v,A),X(g,S,A),y(S,k,A),X($,S,A),y(S,T,A),X(P,S,A),E=!0},p(S,A){const I={};A&2&&(I.data=S[1]),e.$set(I);const F={};A&7&&(F.$$scope={dirty:A,ctx:S}),n.$set(F);const Y={};A&5&&(Y.$$scope={dirty:A,ctx:S}),o.$set(Y);const U={};A&7&&(U.$$scope={dirty:A,ctx:S}),a.$set(U);const R={};A&4&&(R.$$scope={dirty:A,ctx:S}),c.$set(R);const q={};A&4&&(q.$$scope={dirty:A,ctx:S}),_.$set(q);const z={};A&4&&(z.$$scope={dirty:A,ctx:S}),d.$set(z);const O={};A&5&&(O.$$scope={dirty:A,ctx:S}),g.$set(O);const H={};A&5&&(H.$$scope={dirty:A,ctx:S}),$.$set(H);const G={};A&5&&(G.$$scope={dirty:A,ctx:S}),P.$set(G)},i(S){E||(N(e.$$.fragment,S),N(n.$$.fragment,S),N(o.$$.fragment,S),N(a.$$.fragment,S),N(c.$$.fragment,S),N(_.$$.fragment,S),N(d.$$.fragment,S),N(g.$$.fragment,S),N($.$$.fragment,S),N(P.$$.fragment,S),E=!0)},o(S){D(e.$$.fragment,S),D(n.$$.fragment,S),D(o.$$.fragment,S),D(a.$$.fragment,S),D(c.$$.fragment,S),D(_.$$.fragment,S),D(d.$$.fragment,S),D(g.$$.fragment,S),D($.$$.fragment,S),D(P.$$.fragment,S),E=!1},d(S){Z(e,S),S&&w(l),Z(n,S),S&&w(i),Z(o,S),S&&w(r),Z(a,S),S&&w(f),Z(c,S),S&&w(p),Z(_,S),S&&w(b),Z(d,S),S&&w(v),Z(g,S),S&&w(k),Z($,S),S&&w(T),Z(P,S)}}}function H0(t){let e,l,n,i;const o=[G0,W0],r=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function j0(t){let e,l;return e=new At({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function W0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function G0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function B0(t){let e,l,n,i,o,r;l=new vc({props:{$$slots:{default:[q0]},$$scope:{ctx:t}}});const a=[j0,H0],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),J(l.$$.fragment),n=h(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),X(l,e,null),s(e,n),~i&&f[i].m(e,null),r=!0},p(p,[_]){const b={};_&7&&(b.$$scope={dirty:_,ctx:p}),l.$set(b);let d=i;i=c(p),i===d?~i&&f[i].p(p,_):(o&&(Te(),D(f[d],1,1,()=>{f[d]=null}),Se()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),N(o,1),o.m(e,null)):o=null)},i(p){r||(N(l.$$.fragment,p),N(o),r=!0)},o(p){D(l.$$.fragment,p),D(o),r=!1},d(p){p&&w(e),Z(l),~i&&f[i].d()}}}function z0(t,e,l){let n={};Ut.subscribe(o=>{l(0,n=o),n.vndcfg===!1?ni("/vendor"):n.usrcfg===!1?ni("/setup"):n.fwconsent===0&&ni("/consent")}),_o();let i={};return fm.subscribe(o=>{l(1,i=o)}),[n,i]}class Y0 extends Ce{constructor(e){super(),ye(this,e,z0,B0,ke,{})}}new Y0({target:document.getElementById("app")}); + `),v=m("input"),g=h(),k=m("div"),$=m("label"),T=m("input"),P=C(" Static IP"),I=h(),z&&z.c(),S=h(),O&&O.c(),A=h(),E=m("div"),E.innerHTML='',F=h(),J(Y.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"class","text-sm"),u(f,"class","my-3"),u(p,"class","my-3"),u(v,"name","sh"),u(v,"type","text"),u(v,"class","in-s"),u(v,"maxlength","32"),u(v,"pattern","[a-z0-9_-]+"),u(v,"placeholder","Optional, ex.: ams-reader"),u(v,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u(k,"class","my-3"),u(E,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(H,G){y(H,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(n,c),s(n,p),s(n,_),s(n,b),s(b,d),s(b,v),V(v,t[0].hostname),s(n,g),s(n,k),s(k,$),s($,T),T.checked=t[1],s($,P),s(k,I),z&&z.m(k,null),s(n,S),O&&O.m(n,null),s(n,A),s(n,E),y(H,F,G),X(Y,H,G),U=!0,R||(q=[K(v,"input",t[4]),K(T,"change",t[5]),K(n,"submit",Ts(t[3]))],R=!0)},p(H,[G]){G&1&&v.value!==H[0].hostname&&V(v,H[0].hostname),G&2&&(T.checked=H[1]),H[1]?z?(z.p(H,G),G&2&&N(z,1)):(z=Vf(H),z.c(),N(z,1),z.m(k,null)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),H[1]?O||(O=Kf(),O.c(),O.m(n,A)):O&&(O.d(1),O=null);const L={};G&4&&(L.active=H[2]),Y.$set(L)},i(H){U||(N(z),N(Y.$$.fragment,H),U=!0)},o(H){D(z),D(Y.$$.fragment,H),U=!1},d(H){H&&w(e),z&&z.d(),O&&O.d(),H&&w(F),Z(Y,H),R=!1,Ve(q)}}}function g0(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){b();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Ut.update(v=>(v.trying=_,v));var d=new XMLHttpRequest;d.timeout=5e3,d.addEventListener("abort",b),d.addEventListener("error",b),d.addEventListener("timeout",b),d.addEventListener("load",function(v){window.location.href=_||"/"}),d.open("GET",_+"/is-alive",!0),d.send()}async function f(_){l(2,o=!0);const b=new FormData(_.target),d=new URLSearchParams;for(let k of b){const[$,T]=k;d.append($,T)}let g=await(await fetch("/save",{method:"POST",body:d})).json();l(2,o=!1),Ut.update(k=>(k.hostname=b.get("sh"),k.usrcfg=g.success,k.booting=g.reboot,i&&(k.net.ip=b.get("si"),k.net.mask=b.get("su"),k.net.gw=b.get("sg"),k.net.dns1=b.get("sd")),setTimeout(a,5e3),k))}function c(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,f,c,p]}class k0 extends Ce{constructor(e){super(),ye(this,e,g0,b0,ke,{sysinfo:0})}}function w0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$;return v=new At({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=C("Upload "),o=C(t[1]),r=h(),a=m("p"),a.textContent="Select a suitable file and click upload",f=h(),c=m("form"),p=m("input"),_=h(),b=m("div"),b.innerHTML='',d=h(),J(v.$$.fragment),u(a,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(b,"class","w-full text-right mt-4"),u(c,"action",t[0]),u(c,"enctype","multipart/form-data"),u(c,"method","post"),u(c,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){y(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,r),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,b),y(T,d,P),X(v,T,P),g=!0,k||($=K(c,"submit",t[3]),k=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(c,"action",T[0]);const I={};P&4&&(I.active=T[2]),v.$set(I)},i(T){g||(N(v.$$.fragment,T),g=!0)},o(T){D(v.$$.fragment,T),g=!1},d(T){T&&w(e),T&&w(d),Z(v,T),k=!1,$()}}}function y0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}class Co extends Ce{constructor(e){super(),ye(this,e,y0,w0,ke,{action:0,title:1})}}function C0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H;return q=new At({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),r=m("hr"),a=h(),f=m("div"),c=C("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=h(),b=m("a"),d=C("Read more"),v=m("br"),g=h(),k=m("label"),$=m("input"),P=C(" Yes"),I=m("label"),S=m("input"),E=C(" No"),F=m("br"),Y=h(),U=m("div"),U.innerHTML='',R=h(),J(q.$$.fragment),u(b,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u($,"type","radio"),u($,"name","sf"),$.value=1,$.checked=T=t[0].fwconsent===1,u($,"class","rounded m-2"),$.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=A=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(f,"class","my-3"),u(U,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,b),s(b,d),s(f,v),s(f,g),s(f,k),s(k,$),s(k,P),s(f,I),s(I,S),s(I,E),s(f,F),s(n,Y),s(n,U),y(G,R,L),X(q,G,L),z=!0,O||(H=K(n,"submit",Ts(t[2])),O=!0)},p(G,[L]){(!z||L&1&&T!==(T=G[0].fwconsent===1))&&($.checked=T),(!z||L&1&&A!==(A=G[0].fwconsent===2))&&(S.checked=A);const W={};L&2&&(W.active=G[1]),q.$set(W)},i(G){z||(N(q.$$.fragment,G),z=!0)},o(G){D(q.$$.fragment,G),z=!1},d(G){G&&w(e),G&&w(R),Z(q,G),O=!1,H()}}}function $0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),f=new URLSearchParams;for(let _ of a){const[b,d]=_;f.append(b,d)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),Ut.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),ii("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.sysinfo)},[n,i,o]}class T0 extends Ce{constructor(e){super(),ye(this,e,$0,C0,ke,{sysinfo:0})}}function S0(t){let e,l;return e=new Tp({props:{data:t[1],sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function P0(t){let e,l;return e=new xp({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function N0(t){let e,l;return e=new c0({props:{sysinfo:t[0],data:t[1]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function M0(t){let e,l;return e=new Co({props:{title:"CA",action:"/mqtt-ca"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function A0(t){let e,l;return e=new Co({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function D0(t){let e,l;return e=new Co({props:{title:"private key",action:"/mqtt-key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function I0(t){let e,l;return e=new T0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function E0(t){let e,l;return e=new k0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function F0(t){let e,l;return e=new h0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function R0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I;return e=new qm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[S0]},$$scope:{ctx:t}}}),o=new Sl({props:{path:"/configuration",$$slots:{default:[P0]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[N0]},$$scope:{ctx:t}}}),c=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[M0]},$$scope:{ctx:t}}}),_=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[A0]},$$scope:{ctx:t}}}),d=new Sl({props:{path:"/mqtt-key",$$slots:{default:[D0]},$$scope:{ctx:t}}}),g=new Sl({props:{path:"/consent",$$slots:{default:[I0]},$$scope:{ctx:t}}}),$=new Sl({props:{path:"/setup",$$slots:{default:[E0]},$$scope:{ctx:t}}}),P=new Sl({props:{path:"/vendor",$$slots:{default:[F0]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment),l=h(),J(n.$$.fragment),i=h(),J(o.$$.fragment),r=h(),J(a.$$.fragment),f=h(),J(c.$$.fragment),p=h(),J(_.$$.fragment),b=h(),J(d.$$.fragment),v=h(),J(g.$$.fragment),k=h(),J($.$$.fragment),T=h(),J(P.$$.fragment)},m(S,A){X(e,S,A),y(S,l,A),X(n,S,A),y(S,i,A),X(o,S,A),y(S,r,A),X(a,S,A),y(S,f,A),X(c,S,A),y(S,p,A),X(_,S,A),y(S,b,A),X(d,S,A),y(S,v,A),X(g,S,A),y(S,k,A),X($,S,A),y(S,T,A),X(P,S,A),I=!0},p(S,A){const E={};A&2&&(E.data=S[1]),e.$set(E);const F={};A&7&&(F.$$scope={dirty:A,ctx:S}),n.$set(F);const Y={};A&5&&(Y.$$scope={dirty:A,ctx:S}),o.$set(Y);const U={};A&7&&(U.$$scope={dirty:A,ctx:S}),a.$set(U);const R={};A&4&&(R.$$scope={dirty:A,ctx:S}),c.$set(R);const q={};A&4&&(q.$$scope={dirty:A,ctx:S}),_.$set(q);const z={};A&4&&(z.$$scope={dirty:A,ctx:S}),d.$set(z);const O={};A&5&&(O.$$scope={dirty:A,ctx:S}),g.$set(O);const H={};A&5&&(H.$$scope={dirty:A,ctx:S}),$.$set(H);const G={};A&5&&(G.$$scope={dirty:A,ctx:S}),P.$set(G)},i(S){I||(N(e.$$.fragment,S),N(n.$$.fragment,S),N(o.$$.fragment,S),N(a.$$.fragment,S),N(c.$$.fragment,S),N(_.$$.fragment,S),N(d.$$.fragment,S),N(g.$$.fragment,S),N($.$$.fragment,S),N(P.$$.fragment,S),I=!0)},o(S){D(e.$$.fragment,S),D(n.$$.fragment,S),D(o.$$.fragment,S),D(a.$$.fragment,S),D(c.$$.fragment,S),D(_.$$.fragment,S),D(d.$$.fragment,S),D(g.$$.fragment,S),D($.$$.fragment,S),D(P.$$.fragment,S),I=!1},d(S){Z(e,S),S&&w(l),Z(n,S),S&&w(i),Z(o,S),S&&w(r),Z(a,S),S&&w(f),Z(c,S),S&&w(p),Z(_,S),S&&w(b),Z(d,S),S&&w(v),Z(g,S),S&&w(k),Z($,S),S&&w(T),Z(P,S)}}}function L0(t){let e,l,n,i;const o=[q0,O0],r=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function U0(t){let e,l;return e=new At({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function O0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function q0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function H0(t){let e,l,n,i,o,r;l=new wc({props:{$$slots:{default:[R0]},$$scope:{ctx:t}}});const a=[U0,L0],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),J(l.$$.fragment),n=h(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),X(l,e,null),s(e,n),~i&&f[i].m(e,null),r=!0},p(p,[_]){const b={};_&7&&(b.$$scope={dirty:_,ctx:p}),l.$set(b);let d=i;i=c(p),i===d?~i&&f[i].p(p,_):(o&&(Te(),D(f[d],1,1,()=>{f[d]=null}),Se()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),N(o,1),o.m(e,null)):o=null)},i(p){r||(N(l.$$.fragment,p),N(o),r=!0)},o(p){D(l.$$.fragment,p),D(o),r=!1},d(p){p&&w(e),Z(l),~i&&f[i].d()}}}function j0(t,e,l){let n={};Ut.subscribe(o=>{l(0,n=o),n.vndcfg===!1?ii("/vendor"):n.usrcfg===!1?ii("/setup"):n.fwconsent===0&&ii("/consent")}),go();let i={};return om.subscribe(o=>{l(1,i=o)}),[n,i]}class W0 extends Ce{constructor(e){super(),ye(this,e,j0,H0,ke,{})}}new W0({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte index d3cc8a37..6b6a4225 100644 --- a/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte +++ b/lib/SvelteUi/app/src/lib/ConfigurationPanel.svelte @@ -60,7 +60,7 @@ e: { e: false, k: '', a: '' }, m: { e: false, w: false, v: false, a: false, c: false } }, - w: { s: '', p: '', w: 0.0, z: 255, a: true }, + w: { s: '', p: '', w: 0.0, z: 255, a: true, b: true }, n: { m: '', i: '', s: '', g: '', d1: '', d2: '', d: false, n1: '', n2: '', h: false }, @@ -404,6 +404,9 @@
+
+ +
Network diff --git a/lib/SvelteUi/json/conf_wifi.json b/lib/SvelteUi/json/conf_wifi.json index 3433a640..977a7538 100644 --- a/lib/SvelteUi/json/conf_wifi.json +++ b/lib/SvelteUi/json/conf_wifi.json @@ -3,5 +3,6 @@ "p": "%s", "w": %.1f, "z": %d, - "a": %s + "a": %s, + "b": %s }, diff --git a/lib/SvelteUi/src/AmsWebServer.cpp b/lib/SvelteUi/src/AmsWebServer.cpp index a3754653..2772b089 100644 --- a/lib/SvelteUi/src/AmsWebServer.cpp +++ b/lib/SvelteUi/src/AmsWebServer.cpp @@ -877,7 +877,8 @@ void AmsWebServer::configurationJson() { strlen(wifiConfig.psk) > 0 ? "***" : "", wifiConfig.power / 10.0, wifiConfig.sleep, - wifiConfig.autoreboot ? "true" : "false" + wifiConfig.autoreboot ? "true" : "false", + wifiConfig.use11b ? "true" : "false" ); server.sendContent(buf); snprintf_P(buf, BufferSize, CONF_NET_JSON, @@ -1131,7 +1132,6 @@ void AmsWebServer::handleSave() { if(!psk.equals("***")) { strcpy(wifi.psk, psk.c_str()); } - wifi.mode = 1; // WIFI_STA if(server.hasArg(F("sm")) && server.arg(F("sm")) == "static") { strcpy(wifi.ip, server.arg(F("si")).c_str()); @@ -1157,7 +1157,6 @@ void AmsWebServer::handleSave() { meterConfig->baud = 2400; meterConfig->parity = 3; // 8N1 case 2: // spenceme - case 8: // dbeinder: HAN mosquito case 50: // Generic ESP32-S2 case 51: // Wemos S2 mini case 70: // Generic ESP32-C3 @@ -1168,6 +1167,10 @@ void AmsWebServer::handleSave() { case 7: // Pow-U+ wifi.sleep = 2; // Light sleep break; + case 8: // dbeinder: HAN mosquito + wifi.sleep = 1; // Modem sleep + wifi.use11b = 0; + break; } config->setWiFiConfig(wifi); config->setMeterConfig(*meterConfig); @@ -1236,6 +1239,7 @@ void AmsWebServer::handleSave() { wifi.power = server.arg(F("ww")).toFloat() * 10; wifi.sleep = server.arg(F("wz")).toInt(); wifi.autoreboot = server.hasArg(F("wa")) && server.arg(F("wa")) == F("true"); + wifi.use11b = server.hasArg(F("wb")) && server.arg(F("wb")) == F("true"); config->setWiFiConfig(wifi); if(server.hasArg(F("nm"))) { @@ -1915,6 +1919,7 @@ void AmsWebServer::configFileDownload() { if(strlen(wifi.dns2) > 0) server.sendContent(buf, snprintf_P(buf, BufferSize, PSTR("dns2 %s\n"), wifi.dns2)); } server.sendContent(buf, snprintf_P(buf, BufferSize, PSTR("mdns %d\n"), wifi.mdns ? 1 : 0)); + server.sendContent(buf, snprintf_P(buf, BufferSize, PSTR("use11b %d\n"), wifi.use11b ? 1 : 0)); } if(includeMqtt) { diff --git a/src/AmsToMqttBridge.cpp b/src/AmsToMqttBridge.cpp index ded2e872..686b6333 100644 --- a/src/AmsToMqttBridge.cpp +++ b/src/AmsToMqttBridge.cpp @@ -30,6 +30,7 @@ ADC_MODE(ADC_VCC); #endif #if defined(ESP32) +#include #include #include #endif @@ -125,6 +126,7 @@ AmsDataStorage ds(&Debug); EnergyAccounting ea(&Debug); uint8_t wifiReconnectCount = 0; +bool wifiDisable11b = false; HDLCParser *hdlcParser = NULL; MBUSParser *mbusParser = NULL; @@ -167,6 +169,14 @@ uint8_t dnsState = 0; ip_addr_t dns0; void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) { switch(event) { + #if defined(ESP32) + case ARDUINO_EVENT_WIFI_READY: + if (wifiDisable11b) { + esp_wifi_config_11b_rate(WIFI_IF_AP, true); + esp_wifi_config_11b_rate(WIFI_IF_STA, true); + } + break; + #endif case ARDUINO_EVENT_WIFI_STA_GOT_IP: { const ip_addr_t* dns = dns_getserver(0); memcpy(&dns0, dns, sizeof(dns0)); @@ -315,6 +325,12 @@ void setup() { WiFi.softAPdisconnect(true); WiFi.mode(WIFI_OFF); + WiFiConfig wifiConf; + if(config.getWiFiConfig(wifiConf)) { + wifiDisable11b = !wifiConf.use11b; + } + WiFi.onEvent(WiFiEvent); + bool hasFs = false; #if defined(ESP32) debugD_P(PSTR("ESP32 LittleFS")); @@ -1381,8 +1397,7 @@ void WiFi_connect() { #if defined(ESP32) if(strlen(wifi.hostname) > 0) { WiFi.setHostname(wifi.hostname); - } - WiFi.onEvent(WiFiEvent); + } #endif WiFi.mode(WIFI_STA); @@ -1899,6 +1914,9 @@ void configFileParse() { } else if(strncmp_P(buf, PSTR("hostname "), 9) == 0) { if(!lWiFi) { config.getWiFiConfig(wifi); lWiFi = true; }; strcpy(wifi.hostname, buf+9); + } else if(strncmp_P(buf, PSTR("use11b "), 7) == 0) { + if(!lWiFi) { config.getWiFiConfig(wifi); lWiFi = true; }; + wifi.use11b = String(buf+7).toInt() == 1; } else if(strncmp_P(buf, PSTR("mdns "), 5) == 0) { if(!lWiFi) { config.getWiFiConfig(wifi); lWiFi = true; }; wifi.mdns = String(buf+5).toInt() == 1;;