From 49cf16278f6f81a7d53e967a70730dc3b0ca5480 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Mar 2026 07:01:09 +0000 Subject: [PATCH] Fix month-dependent day dropdowns in PriceConfig.svelte Co-authored-by: gskjold <4446828+gskjold@users.noreply.github.com> Agent-Logs-Url: https://github.com/UtilitechAS/amsreader-firmware/sessions/cc7b8eba-e39b-461a-bd3b-7a560279afcc --- lib/SvelteUi/app/dist/index.js | 16 ++++++++-------- lib/SvelteUi/app/src/lib/PriceConfig.svelte | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index b4a0b3b4..e9129873 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,9 +1,9 @@ -var iu=Object.defineProperty;var ou=(t,e,l)=>e in t?iu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var Ti=(t,e,l)=>(ou(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ze(){}function Ml(t,e){for(const l in e)t[l]=e[l];return t}function sr(t){return t()}function ko(){return Object.create(null)}function Ut(t){t.forEach(sr)}function Si(t){return typeof t=="function"}function Ct(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let fi;function vi(t,e){return t===e?!0:(fi||(fi=document.createElement("a")),fi.href=e,t===fi.href)}function su(t){return Object.keys(t).length===0}function lo(t,...e){if(t==null){for(const n of e)n(void 0);return ze}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function un(t){let e;return lo(t,l=>e=l)(),e}function Nl(t,e,l){t.$$.on_destroy.push(lo(e,l))}function no(t,e,l,n){if(t){const i=ar(t,e,l,n);return t[0](i)}}function ar(t,e,l,n){return t[1]&&n?Ml(l.ctx.slice(),t[1](n(e))):l.ctx}function io(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function dn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const ru=["width","height"];function Sn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&ru.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function ye(t){return t===""?null:+t}function uu(t){return Array.from(t.childNodes)}function D(t,e){e=""+e,t.data!==e&&(t.data=e)}function cu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function _u(t,e,l){~fu.indexOf(l)?cu(t,e):D(t,e)}function z(t,e){t.value=e??""}function Sl(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Be(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ce(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),N(n)}}function pu(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function wo(t,e){return new t(e)}let ei;function $n(t){ei=t}function ii(){if(!ei)throw new Error("Function called outside component initialization");return ei}function ao(t){ii().$$.on_mount.push(t)}function du(t){ii().$$.on_destroy.push(t)}function hu(){const t=ii();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=pu(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function xn(t,e){return ii().$$.context.set(t,e),e}function on(t){return ii().$$.context.get(t)}const gn=[],ki=[];let Pn=[];const Co=[],fr=Promise.resolve();let Bi=!1;function rr(){Bi||(Bi=!0,fr.then(ur))}function vu(){return rr(),fr}function Mt(t){Pn.push(t)}const qi=new Set;let vn=0;function ur(){if(vn!==0)return;const t=ei;do{try{for(;vnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),Pn=e}const di=new Set;let an;function ct(){an={r:0,c:[],p:an}}function _t(){an.r||Ut(an.c),an=an.p}function X(t,e){t&&t.i&&(di.delete(t),t.i(e))}function x(t,e,l,n){if(t&&t.o){if(di.has(t))return;di.add(t),an.c.push(()=>{di.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ft(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Ui(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const f in a)f in u||(n[f]=1);for(const f in u)i[f]||(l[f]=u[f],i[f]=1);t[o]=u}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function ui(t){return typeof t=="object"&&t!==null?t:{}}function Se(t){t&&t.c()}function Ce(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),Mt(()=>{const o=t.$$.on_mount.map(sr).filter(Si);t.$$.on_destroy?t.$$.on_destroy.push(...o):Ut(o),t.$$.on_mount=[]}),i.forEach(Mt)}function Pe(t,e){const l=t.$$;l.fragment!==null&&(gu(l.after_update),Ut(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function ku(t,e){t.$$.dirty[0]===-1&&(gn.push(t),rr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:v;return c.ctx&&i(c.ctx[_],c.ctx[_]=d)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](d),m&&ku(t,_)),v}):[],c.update(),m=!0,Ut(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=uu(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&X(t.$$.fragment),Ce(t,e.target,e.anchor),ur()}$n(f)}class Et{constructor(){Ti(this,"$$");Ti(this,"$$set")}$destroy(){Pe(this,1),this.$destroy=ze}$on(e,l){if(!Si(l))return ze;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&&!su(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const wu="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(wu);const Po=t=>typeof t>"u",cr=t=>typeof t=="function",_r=t=>typeof t=="number";function Cu(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mr(){let t=0;return()=>t++}function Pu(){return Math.random().toString(36).substring(2)}const Rl=typeof window>"u";function pr(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const dr=(t,e)=>t?{}:{style:e},zi=t=>({"aria-hidden":"true",...dr(t,"display:none;")}),bn=[];function hr(t,e){return{subscribe:ul(t,e).subscribe}}function ul(t,e=ze){let l;const n=new Set;function i(u){if(Ct(t,u)&&(t=u,l)){const f=!bn.length;for(const c of n)c[1](),bn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Su(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return hr(l,(a,u)=>{let f=!1;const c=[];let m=0,_=ze;const v=()=>{if(m)return;_();const d=e(n?c[0]:c,a,u);o?a(d):_=Si(d)?d:ze},b=i.map((d,h)=>lo(d,g=>{c[h]=g,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,ji=oi("LOCATION"),Mn=oi("ROUTER"),vr=oi("ROUTE"),Mu=oi("ROUTE_PARAMS"),Iu=oi("FOCUS_ELEM"),br=/^:(.+)/,Zn=(t,e,l)=>t.substr(e,l),Hi=(t,e)=>Zn(t,0,e.length)===e,Eu=t=>t==="",Nu=t=>br.test(t),gr=t=>t[0]==="*",Tu=t=>t.replace(/\*.*$/,""),kr=t=>t.replace(/(^\/+|\/+$)/g,"");function Tl(t,e=!1){const l=kr(t).split("/");return e?l.filter(Boolean):l}const Di=(t,e)=>t+(e?`?${e}`:""),fo=t=>`/${kr(t)}`;function si(...t){const e=n=>Tl(n,!0).join("/"),l=t.map(e).join("/");return fo(l)}const ro=1,Ii=2,pn=3,qu=4,wr=5,Du=6,Cr=7,Au=8,Ru=9,Pr=10,Sr=11,Ou={[ro]:"Link",[Ii]:"Route",[pn]:"Router",[qu]:"useFocus",[wr]:"useLocation",[Du]:"useMatch",[Cr]:"useNavigate",[Au]:"useParams",[Ru]:"useResolvable",[Pr]:"useResolve",[Sr]:"navigate"},uo=t=>Ou[t];function Lu(t,e){let l;return t===Ii?l=e.path?`path="${e.path}"`:"default":t===ro?l=`to="${e.to}"`:t===pn&&(l=`basepath="${e.basepath||""}"`),`<${uo(t)} ${l||""} />`}function Fu(t,e,l,n){const i=l&&Lu(n||t,l),o=i?` +var uu=Object.defineProperty;var cu=(t,e,l)=>e in t?uu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var Ti=(t,e,l)=>(cu(t,typeof e!="symbol"?e+"":e,l),l);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function He(){}function Ml(t,e){for(const l in e)t[l]=e[l];return t}function _r(t){return t()}function wo(){return Object.create(null)}function Wt(t){t.forEach(_r)}function Mi(t){return typeof t=="function"}function Nt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ri;function bi(t,e){return t===e?!0:(ri||(ri=document.createElement("a")),ri.href=e,t===ri.href)}function _u(t){return Object.keys(t).length===0}function no(t,...e){if(t==null){for(const n of e)n(void 0);return He}const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function un(t){let e;return no(t,l=>e=l)(),e}function Nl(t,e,l){t.$$.on_destroy.push(no(e,l))}function io(t,e,l,n){if(t){const i=mr(t,e,l,n);return t[0](i)}}function mr(t,e,l,n){return t[1]&&n?Ml(l.ctx.slice(),t[1](n(e))):l.ctx}function oo(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function dn(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const du=["width","height"];function Sn(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&du.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function Ue(t){return t===""?null:+t}function hu(t){return Array.from(t.childNodes)}function q(t,e){e=""+e,t.data!==e&&(t.data=e)}function vu(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function bu(t,e,l){~pu.indexOf(l)?vu(t,e):q(t,e)}function U(t,e){t.value=e??""}function Sl(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function ze(t,e,l){for(let n=0;n{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ue(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),N(n)}}function ku(t,e,{bubbles:l=!1,cancelable:n=!1}={}){return new CustomEvent(t,{detail:e,bubbles:l,cancelable:n})}function Co(t,e){return new t(e)}let ti;function xn(t){ti=t}function oi(){if(!ti)throw new Error("Function called outside component initialization");return ti}function fo(t){oi().$$.on_mount.push(t)}function wu(t){oi().$$.on_destroy.push(t)}function Cu(){const t=oi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=ku(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function ei(t,e){return oi().$$.context.set(t,e),e}function on(t){return oi().$$.context.get(t)}const gn=[],wi=[];let Pn=[];const Po=[],pr=Promise.resolve();let Ui=!1;function dr(){Ui||(Ui=!0,pr.then(hr))}function Pu(){return dr(),pr}function qt(t){Pn.push(t)}const qi=new Set;let vn=0;function hr(){if(vn!==0)return;const t=ti;do{try{for(;vnt.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),Pn=e}const hi=new Set;let an;function mt(){an={r:0,c:[],p:an}}function pt(){an.r||Wt(an.c),an=an.p}function X(t,e){t&&t.i&&(hi.delete(t),t.i(e))}function te(t,e,l,n){if(t&&t.o){if(hi.has(t))return;hi.add(t),an.c.push(()=>{hi.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function rt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function zi(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const f in a)f in u||(n[f]=1);for(const f in u)i[f]||(l[f]=u[f],i[f]=1);t[o]=u}else for(const f in a)i[f]=1}for(const a in n)a in l||(l[a]=void 0);return l}function ci(t){return typeof t=="object"&&t!==null?t:{}}function Me(t){t&&t.c()}function Pe(t,e,l){const{fragment:n,after_update:i}=t.$$;n&&n.m(e,l),qt(()=>{const o=t.$$.on_mount.map(_r).filter(Mi);t.$$.on_destroy?t.$$.on_destroy.push(...o):Wt(o),t.$$.on_mount=[]}),i.forEach(qt)}function Se(t,e){const l=t.$$;l.fragment!==null&&(Mu(l.after_update),Wt(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function Iu(t,e){t.$$.dirty[0]===-1&&(gn.push(t),dr(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:v;return c.ctx&&i(c.ctx[_],c.ctx[_]=d)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](d),m&&Iu(t,_)),v}):[],c.update(),m=!0,Wt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=hu(e.target);c.fragment&&c.fragment.l(_),_.forEach(N)}else c.fragment&&c.fragment.c();e.intro&&X(t.$$.fragment),Pe(t,e.target,e.anchor),hr()}xn(f)}class Rt{constructor(){Ti(this,"$$");Ti(this,"$$set")}$destroy(){Se(this,1),this.$destroy=He}$on(e,l){if(!Mi(l))return He;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&&!_u(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Eu="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Eu);const So=t=>typeof t>"u",vr=t=>typeof t=="function",br=t=>typeof t=="number";function Nu(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function gr(){let t=0;return()=>t++}function Du(){return Math.random().toString(36).substring(2)}const Rl=typeof window>"u";function kr(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const wr=(t,e)=>t?{}:{style:e},ji=t=>({"aria-hidden":"true",...wr(t,"display:none;")}),bn=[];function Cr(t,e){return{subscribe:cl(t,e).subscribe}}function cl(t,e=He){let l;const n=new Set;function i(u){if(Nt(t,u)&&(t=u,l)){const f=!bn.length;for(const c of n)c[1](),bn.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function Tu(t,e,l){const n=!Array.isArray(t),i=n?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=e.length<2;return Cr(l,(a,u)=>{let f=!1;const c=[];let m=0,_=He;const v=()=>{if(m)return;_();const d=e(n?c[0]:c,a,u);o?a(d):_=Mi(d)?d:He},b=i.map((d,h)=>no(d,g=>{c[h]=g,m&=~(1<{m|=1<`@@svnav-ctx__${t}`,Hi=si("LOCATION"),Mn=si("ROUTER"),Pr=si("ROUTE"),qu=si("ROUTE_PARAMS"),Au=si("FOCUS_ELEM"),Sr=/^:(.+)/,Zn=(t,e,l)=>t.substr(e,l),Wi=(t,e)=>Zn(t,0,e.length)===e,Ru=t=>t==="",Ou=t=>Sr.test(t),Mr=t=>t[0]==="*",Lu=t=>t.replace(/\*.*$/,""),Ir=t=>t.replace(/(^\/+|\/+$)/g,"");function Dl(t,e=!1){const l=Ir(t).split("/");return e?l.filter(Boolean):l}const Ai=(t,e)=>t+(e?`?${e}`:""),ro=t=>`/${Ir(t)}`;function ai(...t){const e=n=>Dl(n,!0).join("/"),l=t.map(e).join("/");return ro(l)}const uo=1,Ei=2,pn=3,Fu=4,Er=5,yu=6,Nr=7,Bu=8,Uu=9,Dr=10,Tr=11,zu={[uo]:"Link",[Ei]:"Route",[pn]:"Router",[Fu]:"useFocus",[Er]:"useLocation",[yu]:"useMatch",[Nr]:"useNavigate",[Bu]:"useParams",[Uu]:"useResolvable",[Dr]:"useResolve",[Tr]:"navigate"},co=t=>zu[t];function ju(t,e){let l;return t===Ei?l=e.path?`path="${e.path}"`:"default":t===uo?l=`to="${e.to}"`:t===pn&&(l=`basepath="${e.basepath||""}"`),`<${co(t)} ${l||""} />`}function Hu(t,e,l,n){const i=l&&ju(n||t,l),o=i?` -Occurred in: ${i}`:"",a=uo(t),u=cr(e)?e(a):e;return`<${a}> ${u}${o}`}const Mr=t=>(...e)=>t(Fu(...e)),Ir=Mr(t=>{throw new Error(t)}),wi=Mr(console.warn),So=4,yu=3,Bu=2,Uu=1,zu=1;function ju(t,e){const l=t.default?0:Tl(t.fullPath).reduce((n,i)=>{let o=n;return o+=So,Eu(i)?o+=zu:Nu(i)?o+=Bu:gr(i)?o-=So+Uu:o+=yu,o},0);return{route:t,score:l,index:e}}function Hu(t){return t.map(ju).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Er(t,e){let l,n;const[i]=e.split("?"),o=Tl(i),a=o[0]==="",u=Hu(t);for(let f=0,c=u.length;f({...m,params:v,uri:k});if(m.default){n=b(e);continue}const d=Tl(m.fullPath),h=Math.max(o.length,d.length);let g=0;for(;g{c===".."?f.pop():c!=="."&&f.push(c)}),Di(`/${f.join("/")}`,n)}function Mo(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Tl(e,!0),u=Tl(l,!0);for(;a.length;)a[0]!==u[0]&&Ir(pn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:si(...u),hash:n,search:i,state:o}}const Io=t=>t.length===1?"":t,co=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Io(Zn(t,l)):"",a=i?Zn(t,0,l):t,u=n?Io(Zn(a,e)):"";return{pathname:(n?Zn(a,0,e):a)||"/",search:u,hash:o}},Vu=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Gu(t,e,l){return si(l,Wu(t,e))}function Ku(t,e){const l=fo(Tu(t)),n=Tl(l,!0),i=Tl(e,!0).slice(0,n.length),o=Nr({fullPath:l},si(...i));return o&&o.uri}const Ai="POP",Yu="PUSH",Qu="REPLACE";function Ri(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function Xu(t){let e=[],l=Ri(t),n=Ai;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Ri(t),n=Ai,i([o])};i([o]);const u=pr(t,"popstate",a);return()=>{u(),e=e.filter(f=>f!==o)}},navigate(o,a){const{state:u={},replace:f=!1}=a||{};if(n=f?Qu:Yu,_r(o))a&&wi(Sr,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ai,t.history.go(o);else{const c={...u,_key:Pu()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Ri(t),i()}}}function Oi(t,e){return{...co(e),state:t}}function Zu(t="/"){let e=0,l=[Oi(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Oi(n,o))},replaceState(n,i,o){l[e]=Oi(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Ju=!!(!Rl&&window.document&&window.document.createElement),$u=!Rl&&window.location.origin==="null",Tr=Xu(Ju&&!$u?window:Zu()),{navigate:nn}=Tr;let ql=null,qr=!0;function xu(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nql.level||t.level===ql.level&&xu(t.routerId,ql.routerId))&&(ql=t)}function t0(){ql=null}function l0(){qr=!1}function Eo(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=pr(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function n0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function i0(t){return/^H[1-6]$/i.test(t.tagName)}function No(t,e=document){return e.querySelector(t)}function o0(t){let l=No(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!n0(l,t);){if(i0(l))return l;const n=No("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function s0(t){Promise.resolve(un(t.focusElement)).then(e=>{const l=e||o0(t.id);l||wi(pn,`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,Ii),!Eo(l)&&Eo(document.documentElement)})}const a0=(t,e,l)=>(n,i)=>vu().then(()=>{if(!ql||qr){l0();return}if(n&&s0(ql.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:f,uri:c}=ql.route,m=t.createAnnouncement({path:o,fullPath:a,meta:u,params:f,uri:c},un(l));Promise.resolve(m).then(_=>{e.set(_)})}t0()}),f0="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 r0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},dr(t[6],f0)],i={};for(let o=0;o`Navigated to ${Q.uri}`,announcements:!0,...d},k=m,C=fo(m),I=on(ji),R=on(Mn),E=!I,O=c0(),L=b&&!(R&&!R.manageFocus),j=ul("");Nl(t,j,Q=>l(0,u=Q));const K=R?R.disableInlineStyles:h,U=ul([]);Nl(t,U,Q=>l(20,a=Q));const q=ul(null);Nl(t,q,Q=>l(18,i=Q));let y=!1;const Z=E?0:R.level+1,Y=E?ul((()=>Mo(Rl?co(_):v.location,C))()):I;Nl(t,Y,Q=>l(17,n=Q));const V=ul(n);Nl(t,V,Q=>l(19,o=Q));const B=a0(g,j,Y),H=Q=>ie=>ie.filter(ue=>ue.id!==Q);function ne(Q){if(Rl){if(y)return;const ie=Nr(Q,n.pathname);if(ie)return y=!0,ie}else U.update(ie=>{const ue=H(Q.id)(ie);return ue.push(Q),ue})}function ee(Q){U.update(H(Q))}return!E&&m!==To&&wi(pn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),E&&(ao(()=>v.listen(ie=>{const ue=Mo(ie.location,C);V.set(n),Y.set(ue)})),xn(ji,Y)),xn(Mn,{activeRoute:q,registerRoute:ne,unregisterRoute:ee,manageFocus:L,level:Z,id:O,history:E?v:R.history,basepath:E?C:R.basepath,disableInlineStyles:K}),t.$$set=Q=>{"basepath"in Q&&l(11,m=Q.basepath),"url"in Q&&l(12,_=Q.url),"history"in Q&&l(13,v=Q.history),"primary"in Q&&l(14,b=Q.primary),"a11y"in Q&&l(15,d=Q.a11y),"disableInlineStyles"in Q&&l(16,h=Q.disableInlineStyles),"$$scope"in Q&&l(21,c=Q.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&wi(pn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const Q=Er(a,n.pathname);q.set(Q)}if(t.$$.dirty[0]&655360&&E){const Q=!!n.hash,ie=!Q&&L,ue=!Q||n.pathname!==o.pathname;B(ie,ue)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&e0({level:Z,routerId:O,route:i})},[u,g,E,O,L,j,K,U,q,Y,V,m,_,v,b,d,h,n,i,o,a,c,f]}class m0 extends Et{constructor(e){super(),It(this,e,_0,u0,Ct,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dr=m0;function ai(t,e,l=Mn,n=pn){on(l)||Ir(t,o=>`You cannot use ${o} outside of a ${uo(n)}.`,e)}const p0=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function Ar(){return ai(wr),p0(ji)}function Rr(){const{history:t}=on(Mn);return t}function Or(){const t=on(vr);return t?Su(t,e=>e.base):ul("/")}function Lr(){ai(Pr);const t=Or(),{basepath:e}=on(Mn);return n=>Gu(n,un(t),e)}function d0(){ai(Cr);const t=Lr(),{navigate:e}=Rr();return(n,i)=>{const o=_r(n)?n:t(n);return e(o,i)}}const h0=t=>({params:t&16,location:t&8}),qo=t=>({params:Rl?un(t[10]):t[4],location:t[3],navigate:t[11]});function Do(t){let e,l;return e=new Dr({props:{primary:t[1],$$slots:{default:[g0]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function v0(t){let e;const l=t[18].default,n=no(l,t,t[19],qo);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&oo(n,l,i,i[19],e?io(l,i[19],o,h0):so(i[19]),qo)},i(i){e||(X(n,i),e=!0)},o(i){x(n,i),e=!1},d(i){n&&n.d(i)}}}function b0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Rl?un(t[10]):t[4],t[12]];var o=t[0];function a(u,f){let c={};for(let m=0;m{Pe(c,1)}),_t()}o?(e=wo(o,a(u,f)),Se(e.$$.fragment),X(e.$$.fragment,1),Ce(e,l.parentNode,l)):e=null}else if(o){const c=f&7192?Ui(i,[f&8&&{location:u[3]},f&2048&&{navigate:u[11]},f&1040&&ui(Rl?un(u[10]):u[4]),f&4096&&ui(u[12])]):{};e.$set(c)}},i(u){n||(e&&X(e.$$.fragment,u),n=!0)},o(u){e&&x(e.$$.fragment,u),n=!1},d(u){u&&N(l),e&&Pe(e,u)}}}function g0(t){let e,l,n,i;const o=[b0,v0],a=[];function u(f,c){return f[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),T(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function k0(t){let e,l,n,i,o,a=[zi(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let _=0;_{f=null}),_t())},i(_){o||(X(f),o=!0)},o(_){x(f),o=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const w0=mr();function C0(t,e,l){let n;const i=["path","component","meta","primary"];let o=gi(e,i),a,u,f,c,{$$slots:m={},$$scope:_}=e,{path:v=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:h=!0}=e;ai(Ii,e);const g=w0(),{registerRoute:k,unregisterRoute:C,activeRoute:I,disableInlineStyles:R}=on(Mn);Nl(t,I,y=>l(16,a=y));const E=Or();Nl(t,E,y=>l(17,f=y));const O=Ar();Nl(t,O,y=>l(3,u=y));const L=ul(null);let j;const K=ul(),U=ul({});Nl(t,U,y=>l(4,c=y)),xn(vr,K),xn(Mu,U),xn(Iu,L);const q=d0();return Rl||du(()=>C(g)),t.$$set=y=>{l(24,e=Ml(Ml({},e),bi(y))),l(12,o=gi(e,i)),"path"in y&&l(13,v=y.path),"component"in y&&l(0,b=y.component),"meta"in y&&l(14,d=y.meta),"primary"in y&&l(1,h=y.primary),"$$scope"in y&&l(19,_=y.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const y=v==="",Z=si(f,v),G={id:g,path:v,meta:d,default:y,fullPath:y?"":Z,base:y?f:Ku(Z,u.pathname),primary:h,focusElement:L};K.set(G),l(15,j=k(G))}if(t.$$.dirty&98304&&l(2,n=!!(j||a&&a.id===g)),t.$$.dirty&98308&&n){const{params:y}=j||a;U.set(y)}},e=bi(e),[b,h,n,u,c,g,I,R,E,O,U,q,o,v,d,j,a,f,m,_]}class P0 extends Et{constructor(e){super(),It(this,e,C0,k0,Ct,{path:13,component:0,meta:14,primary:1})}}const Pl=P0;function S0(t){let e,l,n,i;const o=t[13].default,a=no(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=L));const I=hu(),R=Lr(),{navigate:E}=Rr();function O(L){I("click",L),Cu(L)&&(L.preventDefault(),E(n,{state:g,replace:a||h}))}return t.$$set=L=>{l(19,e=Ml(Ml({},e),bi(L))),l(18,m=gi(e,c)),"to"in L&&l(5,d=L.to),"replace"in L&&l(6,h=L.replace),"state"in L&&l(7,g=L.state),"getProps"in L&&l(8,k=L.getProps),"$$scope"in L&&l(12,b=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=R(d,_)),t.$$.dirty&2049&&l(10,i=Hi(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=co(n)===Vu(_)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(cr(k)){const L=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...L}}return m})())},e=bi(e),[n,f,u,C,O,d,h,g,k,o,i,_,b,v]}class I0 extends Et{constructor(e){super(),It(this,e,M0,S0,Ct,{to:5,replace:6,state:7,getProps:8})}}const wl=I0;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function E0(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Ei(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function ti(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function Ci(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function At(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ze(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function cn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function xt(t,e){return t==1||t==2&&e}function bl(t){let e="https://wiki.amsleser.no";return t&&(e+="/en/firmware#"+t),e}function tl(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function _n(t,e){return t.setTime(t.getTime()+e*36e5),t}function N0(t,e){return t.setTime(t.getTime()+e*6e4),t}function T0(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function q0(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let ci=0;function li(t,e){var l="";ci++;var n=function(){setTimeout(li,1e3,t,e)};if(t.net.ip&&ci%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&ci%3==1?l="http://"+t.hostname:t.hostname&&ci%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function sl(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ao(t){return t.startsWith("esp32")?"esp32":t}function pl(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function ni(t,e){let l=[tl(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=tl(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let mn="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Ol="[\\x20-\\x7E]+",In="[\\x20-\\xFF]+",Pi="[A-Za-z0-9_\\-]+",Fr="[0-9A-Fa-f]+",Xn="[0-9]+",hi={},Wi=[];async function D0(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 Li;async function yr(){if(Wi.length){let t=Wi.shift();delete hi[t.resource];try{let e=await D0(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}Li&&clearTimeout(Li),Li=setTimeout(yr,100)}yr();async function Cl(t,e={}){let l;return hi[t]?l=hi[t]:(l={resource:t,options:e,callbacks:[]},hi[t]=l,Wi.push(l)),new Promise(i=>l.callbacks.push(i))}let El={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function Ni(){El=await(await Cl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),hl.set(El)}const hl=ul(El,t=>(Ni(),function(){}));function A0(t){hl.update(e=>(e.trying=t,e))}let _i=0,Ro=-127,Oo=null,R0={};const O0=hr(R0,t=>{let e,l;async function n(){Cl("data.json").then(i=>i.json()).then(i=>{t(i),Ro!=i.t&&(Ro=i.t,setTimeout(L0,2e3)),i.pe&&i.p!=Oo&&(Oo=i.p,zr()),(!El||!El.chip||El.booting||_i>1&&!cn(El.board))&&(Ni(),Dl&&clearTimeout(Dl),Dl=setTimeout(Ki,2e3),Al&&clearTimeout(Al),Al=setTimeout(Qi,3e3)),i.u,Dl||(Dl=Ki()),Al||(Al=Qi());let o=5e3;if(cn(El.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(o=Math.max(a,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),e&&clearTimeout(e),e=setTimeout(n,o),_i=0}).catch(i=>{_i++,_i>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(li,5e3,El,A0))):e=setTimeout(n,cn(El.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let mi,kn={};const Br=ul(kn);let Vi={};const Ur=ul(Vi);async function zr(){mi&&(clearTimeout(mi),mi=0),kn=await(await Cl("importprice.json")).json(),Br.set(kn),kn!=null&&kn.importExportPriceDifferent&&(Vi=await(await Cl("exportprice.json")).json(),Ur.set(Vi)),mi=setTimeout(zr,(24-new Date().getHours())*36e5+10)}let Gi={},Dl;async function Ki(){Dl&&(clearTimeout(Dl),Dl=0),Gi=await(await Cl("dayplot.json")).json(),jr.set(Gi),Dl=setTimeout(Ki,(60-new Date().getMinutes())*6e4+20)}const jr=ul(Gi,t=>function(){});let Yi={},Al;async function Qi(){Al&&(clearTimeout(Al),Al=0),Yi=await(await Cl("monthplot.json")).json(),Hr.set(Yi),Al=setTimeout(Qi,(24-new Date().getHours())*36e5+40)}const Hr=ul(Yi,t=>function(){});let Xi={};async function L0(){Xi=await(await Cl("temperature.json")).json(),Wr.set(Xi)}const Wr=ul(Xi,t=>function(){});let Zi={},pi;async function Vr(){pi&&(clearTimeout(pi),pi=0),Zi=await(await Cl("tariff.json")).json(),Gr.set(Zi),pi=setTimeout(Vr,(60-new Date().getMinutes())*6e4+30)}const Gr=ul(Zi,t=>function(){});let wn={c:-1,n:[]};async function F0(){let e=await(await Cl("wifiscan.json",{timeout:3e4})).json(),l=[];wn.c=0,wn.n=[];for(let n=0;n(F0(),function(){}));let Ji=!1;const Il=ul(Ji);async function Kr(t){Ji=await(await Cl("translations.json"+(t?"?lang="+t:""))).json(),Il.set(Ji)}Kr();function Lo(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 Yr(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function Fo(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function o(c,m){return c[2]>1?W0:c[2]>0?H0:c[3]>1?j0:c[3]>0?z0:c[4]>1?U0:c[4]>0?B0:y0}let a=o(t),u=a(t);return{c(){l=M(e),n=w(),u.c(),i=Wt()},m(c,m){T(c,l,m),T(c,n,m),u.m(c,m),T(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&D(l,e),a===(a=o(c))&&u?u.p(c,m):(u.d(1),u=a(c),u&&(u.c(),u.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),u.d(c)}}}function y0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.seconds)??"s")+"",i;return{c(){e=M(t[0]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&1&&D(e,a[0]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function B0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minute)??"m")+"",i;return{c(){e=M(t[4]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&16&&D(e,a[4]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function U0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minutes)??"m")+"",i;return{c(){e=M(t[4]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&16&&D(e,a[4]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function z0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hour)??"h")+"",i;return{c(){e=M(t[3]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&8&&D(e,a[3]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function j0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hours)??"h")+"",i;return{c(){e=M(t[3]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&8&&D(e,a[3]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function H0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.day)??"d")+"",i;return{c(){e=M(t[2]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&4&&D(e,a[2]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function W0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.days)??"d")+"",i;return{c(){e=M(t[2]),l=w(),i=M(n)},m(a,u){T(a,e,u),T(a,l,u),T(a,i,u)},p(a,u){var f;u&4&&D(e,a[2]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&D(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function V0(t){let e,l=t[0]&&Fo(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),T(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Fo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){n&&N(e),l&&l.d(n)}}}function G0(t,e,l){let{epoch:n}=e,i={};Il.subscribe(f=>{l(1,i=f)});let o=0,a=0,u=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,u=Math.floor(n/60)))},[n,i,o,a,u]}class K0 extends Et{constructor(e){super(),It(this,e,G0,V0,Ct,{epoch:0})}}function Y0(t){let e,l,n;return{c(){e=p("span"),l=M(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){T(i,e,o),s(e,l)},p(i,[o]){o&4&&D(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:ze,o:ze,d(i){i&&N(e)}}}function Q0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Et{constructor(e){super(),It(this,e,Q0,Y0,Ct,{color:0,title:1,text:2})}}function X0(t){let e,l=`${At(t[0].getDate())}.${At(t[0].getMonth()+1)}.${t[0].getFullYear()} ${At(t[0].getHours())}:${At(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=M(l),r(e,"class",t[1])},m(i,o){T(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${At(i[0].getDate())}.${At(i[0].getMonth()+1)}.${i[0].getFullYear()} ${At(i[0].getHours())}:${At(i[0].getMinutes())}`)&&D(n,l),o&2&&r(e,"class",i[1])},d(i){i&&N(e)}}}function Z0(t){var n;let e=`${At(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:At(t[0].getMonth()+1)} ${At(t[0].getHours())}:${At(t[0].getMinutes())}`,l;return{c(){l=M(e)},m(i,o){T(i,l,o)},p(i,o){var a;o&5&&e!==(e=`${At(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:At(i[0].getMonth()+1)} ${At(i[0].getHours())}:${At(i[0].getMinutes())}`)&&D(l,e)},d(i){i&&N(l)}}}function J0(t){let e;function l(o,a){return o[3]?Z0:X0}let n=l(t),i=n(t);return{c(){i.c(),e=Wt()},m(o,a){i.m(o,a),T(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ze,o:ze,d(o){o&&N(e),i.d(o)}}}function $0(t,e,l){let n={};Il.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:o}=e,{offset:a}=e,u;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,o=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,u=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||_n(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,u,a]}class Qr extends Et{constructor(e){super(),It(this,e,$0,J0,Ct,{timestamp:0,fullTimeColor:1,offset:4})}}function x0(t){let e,l,n;return{c(){e=Bt("svg"),l=Bt("path"),n=Bt("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){T(i,e,o),s(e,l),s(e,n)},p:ze,i:ze,o:ze,d(i){i&&N(e)}}}class ec extends Et{constructor(e){super(),It(this,e,null,x0,Ct,{})}}function tc(t){let e,l;return{c(){e=Bt("svg"),l=Bt("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){T(n,e,i),s(e,l)},p:ze,i:ze,o:ze,d(n){n&&N(e)}}}class lc extends Et{constructor(e){super(),It(this,e,null,tc,Ct,{})}}function nc(t){let e,l;return{c(){e=Bt("svg"),l=Bt("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){T(n,e,i),s(e,l)},p:ze,i:ze,o:ze,d(n){n&&N(e)}}}class ic extends Et{constructor(e){super(),It(this,e,null,nc,Ct,{})}}function oc(t){let e,l,n=t[2].version+"",i;return{c(){e=M("AMS reader "),l=p("span"),i=M(n)},m(o,a){T(o,e,a),T(o,l,a),s(l,i)},p(o,a){a&4&&n!==(n=o[2].version+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function yo(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=M(l),i=M("°C"),r(e,"class","flex-none my-auto")},m(o,a){T(o,e,a),s(e,n),s(e,i)},p(o,a){a&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&D(n,l)},d(o){o&&N(e)}}}function Bo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(o=t[4].errors)==null?void 0:o.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){T(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=u[4].errors)==null?void 0:m.han)==null?void 0:_[u[1].he])??u[1].he))&&D(n,l)},d(u){u&&N(e)}}}function Uo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(o=t[4].errors)==null?void 0:o.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){T(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=u[4].errors)==null?void 0:m.mqtt)==null?void 0:_[u[1].me])??u[1].me))&&D(n,l)},d(u){u&&N(e)}}}function zo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(o=t[4].errors)==null?void 0:o.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){T(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=u[4].errors)==null?void 0:m.price)==null?void 0:_[u[1].ee])??u[1].ee))&&D(n,l)},d(u){u&&N(e)}}}function jo(t){let e,l,n,i,o,a,u,f;return l=new wl({props:{to:"/configuration",$$slots:{default:[sc]},$$scope:{ctx:t}}}),a=new wl({props:{to:"/status",$$slots:{default:[ac]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Se(l.$$.fragment),i=w(),o=p("div"),Se(a.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),r(o,"class","flex-none px-1 mt-1"),r(o,"title",u=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){T(c,e,m),Ce(l,e,null),T(c,i,m),T(c,o,m),Ce(a,o,null),f=!0},p(c,m){var b,d;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((b=c[4].header)==null?void 0:b.config)??""))&&r(e,"title",n);const v={};m&64&&(v.$$scope={dirty:m,ctx:c}),a.$set(v),(!f||m&16&&u!==(u=((d=c[4].header)==null?void 0:d.status)??""))&&r(o,"title",u)},i(c){f||(X(l.$$.fragment,c),X(a.$$.fragment,c),f=!0)},o(c){x(l.$$.fragment,c),x(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(o)),Pe(l),Pe(a)}}}function sc(t){let e,l;return e=new ec({}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function ac(t){let e,l;return e=new lc({}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function fc(t){let e,l;function n(a,u){return a[2].security==0||a[1].a?cc:uc}let i=n(t),o=i(t);return{c(){var a;e=p("div"),o.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,u){T(a,e,u),o.m(e,null)},p(a,u){var f;i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null))),u&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&r(e,"title",l)},d(a){a&&N(e),o.d()}}}function rc(t){let e,l,n=t[2].upgrade.t+"",i,o,a=t[3].toFixed(1)+"",u,f;return{c(){e=p("div"),l=M("Upgrading to "),i=M(n),o=M(", "),u=M(a),f=M("%"),r(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){T(c,e,m),s(e,l),s(e,i),s(e,o),s(e,u),s(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&D(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&D(u,a)},d(c){c&&N(e)}}}function uc(t){var u;let e,l=(((u=t[4].header)==null?void 0:u.new_version)??"New version")+"",n,i,o=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=M(l),i=M(": "),a=M(o)},m(f,c){T(f,e,c),s(e,n),s(e,i),s(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&D(n,l),c&4&&o!==(o=f[2].upgrade.n+"")&&D(a,o)},d(f){f&&N(e)}}}function cc(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,o,a=t[2].upgrade.n+"",u,f,c;return{c(){e=p("button"),l=p("span"),i=M(n),o=M(": "),u=M(a),r(l,"class","mt-1"),r(e,"class","flex")},m(_,v){T(_,e,v),s(e,l),s(l,i),s(l,o),s(l,u),f||(c=ce(e,"click",t[5]),f=!0)},p(_,v){var b;v&16&&n!==(n=(((b=_[4].header)==null?void 0:b.new_version)??"New version")+"")&&D(i,n),v&4&&a!==(a=_[2].upgrade.n+"")&&D(u,a)},d(_){_&&N(e),f=!1,c()}}}function _c(t){var be,ke;let e,l,n,i,o,a,u,f,c,m,_,v=(((be=t[4].header)==null?void 0:be.mem)??"Free")+"",b,d,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",g,k,C,I,R,E,O,L,j,K,U,q,y,Z,G,Y,V,B,H,ne,ee,Q,ie,ue,fe,le,de,oe,me,se,pe;i=new wl({props:{to:"/",$$slots:{default:[oc]},$$scope:{ctx:t}}}),f=new K0({props:{epoch:t[1].u}});let we=t[1].t>-50&&yo(t);R=new fn({props:{title:"ESP",text:t[2].booting?((ke=t[4].header)==null?void 0:ke.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),O=new fn({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),j=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),U=new fn({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let S=(t[1].he<0||t[1].he>0)&&Bo(t),P=t[1].me<0&&Uo(t),F=(t[1].ee>0||t[1].ee<0)&&zo(t);ie=new Qr({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let A=t[2].vndcfg&&t[2].usrcfg&&jo(t);oe=new ic({});function W(J,ve){if(J[2].upgrading)return rc;if(J[2].fwconsent===1&&J[2].upgrade.n)return fc}let te=W(t),re=te&&te(t);return{c(){var J;e=p("nav"),l=p("div"),n=p("div"),Se(i.$$.fragment),o=w(),a=p("div"),u=p("div"),Se(f.$$.fragment),c=w(),we&&we.c(),m=w(),_=p("div"),b=M(v),d=M(": "),g=M(h),k=M("kb"),C=w(),I=p("div"),Se(R.$$.fragment),E=w(),Se(O.$$.fragment),L=w(),Se(j.$$.fragment),K=w(),Se(U.$$.fragment),q=w(),S&&S.c(),y=w(),P&&P.c(),Z=w(),F&&F.c(),G=w(),Y=p("div"),V=p("div"),B=p("a"),H=p("img"),ee=w(),Q=p("div"),Se(ie.$$.fragment),ue=w(),A&&A.c(),fe=w(),le=p("div"),de=p("a"),Se(oe.$$.fragment),se=w(),re&&re.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r(I,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(H,"class","logo"),vi(H.src,ne=(t[0]+"/logo.svg").replace("//","/"))||r(H,"src",ne),r(H,"alt","GitHub repo"),r(B,"class","float-right"),r(B,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(B,"target","_blank"),r(B,"rel","noreferrer"),r(B,"aria-label","GitHub"),r(V,"class","flex-none"),r(Q,"class","flex-none my-auto px-2"),r(de,"href",bl("")),r(de,"target","_blank"),r(de,"rel","noreferrer"),r(le,"class","flex-none px-1 mt-1"),r(le,"title",me=((J=t[4].header)==null?void 0:J.doc)??""),r(Y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","hdr")},m(J,ve){T(J,e,ve),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,u),Ce(f,u,null),s(a,c),we&&we.m(a,null),s(a,m),s(a,_),s(_,b),s(_,d),s(_,g),s(_,k),s(l,C),s(l,I),Ce(R,I,null),s(I,E),Ce(O,I,null),s(I,L),Ce(j,I,null),s(I,K),Ce(U,I,null),s(l,q),S&&S.m(l,null),s(l,y),P&&P.m(l,null),s(l,Z),F&&F.m(l,null),s(l,G),s(l,Y),s(Y,V),s(V,B),s(B,H),s(Y,ee),s(Y,Q),Ce(ie,Q,null),s(Y,ue),A&&A.m(Y,null),s(Y,fe),s(Y,le),s(le,de),Ce(oe,de,null),s(Y,se),re&&re.m(Y,null),pe=!0},p(J,[ve]){var Le,$e,xe;const ge={};ve&68&&(ge.$$scope={dirty:ve,ctx:J}),i.$set(ge);const Ne={};ve&2&&(Ne.epoch=J[1].u),f.$set(Ne),J[1].t>-50?we?we.p(J,ve):(we=yo(J),we.c(),we.m(a,m)):we&&(we.d(1),we=null),(!pe||ve&16)&&v!==(v=(((Le=J[4].header)==null?void 0:Le.mem)??"Free")+"")&&D(b,v),(!pe||ve&2)&&h!==(h=(J[1].m?(J[1].m/1e3).toFixed(1):"-")+"")&&D(g,h);const Ie={};ve&22&&(Ie.text=J[2].booting?(($e=J[4].header)==null?void 0:$e.booting)??"Booting":J[1].v>2?J[1].v.toFixed(2)+"V":"ESP"),ve&6&&(Ie.color=ln(J[2].booting?2:J[1].em)),R.$set(Ie);const De={};ve&6&&(De.color=ln(J[2].booting?9:J[1].hm)),O.$set(De);const Ae={};ve&2&&(Ae.text=J[1].r?J[1].r.toFixed(0)+"dBm":"WiFi"),ve&6&&(Ae.color=ln(J[2].booting?9:J[1].wm)),j.$set(Ae);const Me={};ve&6&&(Me.color=ln(J[2].booting?9:J[1].mm)),U.$set(Me),J[1].he<0||J[1].he>0?S?S.p(J,ve):(S=Bo(J),S.c(),S.m(l,y)):S&&(S.d(1),S=null),J[1].me<0?P?P.p(J,ve):(P=Uo(J),P.c(),P.m(l,Z)):P&&(P.d(1),P=null),J[1].ee>0||J[1].ee<0?F?F.p(J,ve):(F=zo(J),F.c(),F.m(l,G)):F&&(F.d(1),F=null),(!pe||ve&1&&!vi(H.src,ne=(J[0]+"/logo.svg").replace("//","/")))&&r(H,"src",ne);const qe={};ve&2&&(qe.timestamp=J[1].c?new Date(J[1].c*1e3):new Date(0)),ve&4&&(qe.offset=J[2].clock_offset),ie.$set(qe),J[2].vndcfg&&J[2].usrcfg?A?(A.p(J,ve),ve&4&&X(A,1)):(A=jo(J),A.c(),X(A,1),A.m(Y,fe)):A&&(ct(),x(A,1,1,()=>{A=null}),_t()),(!pe||ve&16&&me!==(me=((xe=J[4].header)==null?void 0:xe.doc)??""))&&r(le,"title",me),te===(te=W(J))&&re?re.p(J,ve):(re&&re.d(1),re=te&&te(J),re&&(re.c(),re.m(Y,null)))},i(J){pe||(X(i.$$.fragment,J),X(f.$$.fragment,J),X(R.$$.fragment,J),X(O.$$.fragment,J),X(j.$$.fragment,J),X(U.$$.fragment,J),X(ie.$$.fragment,J),X(A),X(oe.$$.fragment,J),pe=!0)},o(J){x(i.$$.fragment,J),x(f.$$.fragment,J),x(R.$$.fragment,J),x(O.$$.fragment,J),x(j.$$.fragment,J),x(U.$$.fragment,J),x(ie.$$.fragment,J),x(A),x(oe.$$.fragment,J),pe=!1},d(J){J&&N(e),Pe(i),Pe(f),we&&we.d(),Pe(R),Pe(O),Pe(j),Pe(U),S&&S.d(),P&&P.d(),F&&F.d(),Pe(ie),A&&A.d(),Pe(oe),re&&re.d()}}}function mc(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",o.upgrade.n))&&(Yr(o.upgrade.n),hl.update(m=>(m.upgrade.t=o.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let u;hl.subscribe(c=>{l(2,o=c)});let f={};return Il.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,u=Math.max(0,o.upgrade.p))},[n,i,o,u,f,a]}class pc extends Et{constructor(e){super(),It(this,e,mc,_c,Ct,{basepath:0,data:1})}}function dc(t){let e,l,n,i;return{c(){e=Bt("svg"),l=Bt("path"),n=Bt("path"),r(l,"d",Fi(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Fi(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){T(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=Fi(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:ze,o:ze,d(o){o&&N(e)}}}function Ho(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Fi(t,e,l,n,i){var o=Ho(t,e,l,i),a=Ho(t,e,l,n),u=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return f}function hc(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 vc extends Et{constructor(e){super(),It(this,e,hc,dc,Ct,{pct:0,color:1})}}function Wo(t){let e,l,n,i=t[1][0]+"",o,a,u,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=w(),n=p("span"),o=M(i),a=w(),u=p("span"),c=M(f),m=M("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(_,v){T(_,e,v),T(_,l,v),T(_,n,v),s(n,o),T(_,a,v),T(_,u,v),s(u,c),s(u,m)},p(_,v){v&2&&i!==(i=_[1][0]+"")&&D(o,i),v&2&&f!==(f=_[1][1]+"")&&D(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(u))}}}function bc(t){let e,l,n,i,o,a,u,f,c,m,_=t[3][0]+"",v,b,d,h=t[3][1]+"",g,k,C;l=new vc({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let I=t[1]&&Wo(t);return{c(){e=p("div"),Se(l.$$.fragment),n=w(),i=p("span"),o=p("span"),a=M(t[0]),u=w(),f=p("br"),c=w(),m=p("span"),v=M(_),b=w(),d=p("span"),g=M(h),k=w(),I&&I.c(),r(o,"class","pl-lab"),r(m,"class","pl-val"),r(d,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(R,E){T(R,e,E),Ce(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,f),s(i,c),s(i,m),s(m,v),s(i,b),s(i,d),s(d,g),s(i,k),I&&I.m(i,null),C=!0},p(R,[E]){const O={};E&16&&(O.pct=R[4]),E&20&&(O.color=R[2](R[4],document.documentElement.classList.contains("dark"))),l.$set(O),(!C||E&1)&&D(a,R[0]),(!C||E&8)&&_!==(_=R[3][0]+"")&&D(v,_),(!C||E&8)&&h!==(h=R[3][1]+"")&&D(g,h),R[1]?I?I.p(R,E):(I=Wo(R),I.c(),I.m(i,null)):I&&(I.d(1),I=null)},i(R){C||(X(l.$$.fragment,R),C=!0)},o(R){x(l.$$.fragment,R),C=!1},d(R){R&&N(e),Pe(l),I&&I.d()}}}function gc(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,o=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,u=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=pl(n,o)),l(4,m=Math.min(n,i)/i*100))},[a,u,f,c,m,n,i,o]}class Xr extends Et{constructor(e){super(),It(this,e,gc,bc,Ct,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function kc(t){let e,l,n;return{c(){e=p("div"),l=M(t[0]),r(e,"class","tooltip"),Sl(e,"top",t[2]-t[4]-10+"px"),Sl(e,"left",t[1]-t[3]/2+"px"),Mt(()=>t[5].call(e))},m(i,o){T(i,e,o),s(e,l),n=Mi(e,t[5].bind(e))},p(i,[o]){o&1&&D(l,i[0]),o&20&&Sl(e,"top",i[2]-i[4]-10+"px"),o&10&&Sl(e,"left",i[1]-i[3]/2+"px")},i:ze,o:ze,d(i){i&&N(e),n()}}}function wc(t,e,l){let{title:n}=e,{x:i}=e,{y:o}=e,a,u;function f(){u=this.clientHeight,a=this.clientWidth,l(4,u),l(3,a)}return t.$$set=c=>{"title"in c&&l(0,n=c.title),"x"in c&&l(1,i=c.x),"y"in c&&l(2,o=c.y)},[n,i,o,a,u,f]}class Cc extends Et{constructor(e){super(),It(this,e,wc,kc,Ct,{title:0,x:1,y:2})}}function Pc(t){let e,l;function n(o){l&&l.$destroy(),e=t.dataset.title||t.getAttribute("title");var a=t.getBoundingClientRect();l=new Cc({props:{title:e,x:a.left+window.scrollX+a.width/2,y:a.top+window.scrollY},target:document.body})}function i(){l&&setTimeout(()=>{l.$destroy(),l=null},500)}return t.addEventListener("click",n),t.addEventListener("mouseleave",i),{destroy(){t.removeEventListener("click",n),t.removeEventListener("mouseleave",i)}}}function Vo(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Go(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ko(t,e,l){const n=t.slice();return n[15]=e[l],n}function Yo(t){let e,l,n,i,o,a,u,f=(t[0].title||t[0].link)&&Qo(t),c=ft(t[0].y.ticks),m=[];for(let h=0;h{f=null}),_t()),g&129){c=ft(h[0].y.ticks);let k;for(k=0;k{o=null}),_t())},i(a){n||(X(o),n=!0)},o(a){x(o),n=!1},d(a){a&&N(e),i&&i.d(),o&&o.d()}}}function Xo(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=M(l),r(e,"class","text-sm font-bold"),Mt(()=>t[9].call(e))},m(o,a){T(o,e,a),s(e,n),i=Mi(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&D(n,l)},d(o){o&&N(e),i()}}}function Zo(t){let e,l,n,i;const o=[Mc,Sc],a=[];function u(f,c){return f[0].link.route?0:1}return l=u(t),n=a[l]=o[l](t),{c(){e=p("div"),n.c(),r(e,"class","text-xs text-right")},m(f,c){T(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=u(f),l===m?a[l].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),n=a[l],n?n.p(f,c):(n=a[l]=o[l](f),n.c()),X(n,1),n.m(e,null))},i(f){i||(X(n),i=!0)},o(f){x(n),i=!1},d(f){f&&N(e),a[l].d()}}}function Sc(t){let e,l=t[0].link.text+"",n,i,o;return{c(){e=p("a"),n=M(l),r(e,"href",i=t[0].link.url),r(e,"target",o=t[0].link.target)},m(a,u){T(a,e,u),s(e,n)},p(a,u){u&1&&l!==(l=a[0].link.text+"")&&D(n,l),u&1&&i!==(i=a[0].link.url)&&r(e,"href",i),u&1&&o!==(o=a[0].link.target)&&r(e,"target",o)},i:ze,o:ze,d(a){a&&N(e)}}}function Mc(t){let e,l;return e=new wl({props:{to:t[0].link.url,$$slots:{default:[Ic]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.to=n[0].link.url),i&262145&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function Ic(t){let e=t[0].link.text+"",l;return{c(){l=M(e)},m(n,i){T(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&D(l,e)},d(n){n&&N(l)}}}function Jo(t){let e,l,n,i=t[15].label+"",o,a,u,f;return{c(){e=Bt("g"),l=Bt("line"),n=Bt("text"),o=M(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[15].align=="right"?"90%":""),r(e,"class",u="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){T(c,e,m),s(e,l),s(e,n),s(n,o)},p(c,m){m&1&&i!==(i=c[15].label+"")&&D(o,i),m&1&&a!==(a=c[15].align=="right"?"90%":"")&&r(n,"x",a),m&1&&u!==(u="tick tick-"+c[15].value+" tick-"+c[15].color)&&r(e,"class",u),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&r(e,"transform",f)},d(c){c&&N(e)}}}function $o(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Jo(t);return{c(){n&&n.c(),l=Wt()},m(i,o){n&&n.m(i,o),T(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=Jo(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function xo(t){let e,l,n=(t[3]>20||t[13]%2==0||!t[0].x.ticks[t[13]-1].label)&&es(t);return{c(){e=Bt("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){T(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0||!i[0].x.ticks[i[13]-1].label?n?n.p(i,o):(n=es(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function es(t){let e,l=t[11].label+"",n,i;return{c(){e=Bt("text"),n=M(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){T(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&D(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&N(e)}}}function ts(t){let e=!isNaN(t[6](t[13])),l,n=e&&xo(t);return{c(){n&&n.c(),l=Wt()},m(i,o){n&&n.m(i,o),T(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=xo(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function ls(t){let e,l,n,i,o,a=t[11].value!==void 0&&ns(t),u=t[11].value2>1e-4&&os(t);return{c(){e=Bt("g"),a&&a.c(),n=Bt("g"),u&&u.c(),r(e,"data-title",l=t[11].title)},m(f,c){T(f,e,c),a&&a.m(e,null),T(f,n,c),u&&u.m(n,null),i||(o=au(Pc.call(null,e)),i=!0)},p(f,c){f[11].value!==void 0?a?a.p(f,c):(a=ns(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null),c&1&&l!==(l=f[11].title)&&r(e,"data-title",l),f[11].value2>1e-4?u?u.p(f,c):(u=os(f),u.c(),u.m(n,null)):u&&(u.d(1),u=null)},d(f){f&&(N(e),N(n)),a&&a.d(),u&&u.d(),i=!1,o()}}}function ns(t){let e,l,n,i,o,a,u,f=t[3]>15&&is(t);return{c(){e=Bt("rect"),f&&f.c(),u=Wt(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]*.95),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",a=t[11].color)},m(c,m){T(c,e,m),f&&f.m(c,m),T(c,u,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&r(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&r(e,"y",n),m&8&&i!==(i=c[3]*.95)&&r(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&r(e,"height",o),m&1&&a!==(a=c[11].color)&&r(e,"fill",a),c[3]>15?f?f.p(c,m):(f=is(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(u)),f&&f.d(c)}}}function is(t){let e,l=t[11].label+"",n,i,o,a,u;return{c(){e=Bt("text"),n=M(l),r(e,"width",i=t[3]*.95),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]f[7](0)-f[8]&&!f[0].dark?f[11].color:"white")&&r(e,"fill",a),c&457&&u!==(u="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](f[11].value)>f[7](0)-f[8]?f[7](f[11].value)-f[8]:f[7](f[11].value)+10)+") rotate("+(f[11].labelAngle?f[11].labelAngle:f[3]15&&ss(t);return{c(){e=Bt("rect"),f&&f.c(),u=Wt(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]*.95),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){T(c,e,m),f&&f.m(c,m),T(c,u,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&r(e,"x",l),m&128&&n!==(n=c[7](0))&&r(e,"y",n),m&8&&i!==(i=c[3]*.95)&&r(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&r(e,"height",o),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&r(e,"fill",a),c[3]>15?f?f.p(c,m):(f=ss(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(u)),f&&f.d(c)}}}function ss(t){let e,l=t[11].label2+"",n,i,o,a,u,f=t[11].title2&&as(t);return{c(){e=Bt("text"),n=M(l),f&&f.c(),u=Wt(),r(e,"width",i=t[3]*.95),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(o,a){T(o,e,a),i&&i.m(e,null),l=Mi(e,t[10].bind(e)),n=!0},p(o,[a]){o[0].x.ticks&&o[0].points&&o[4]?i?(i.p(o,a),a&17&&X(i,1)):(i=Yo(o),i.c(),X(i,1),i.m(e,null)):i&&(ct(),x(i,1,1,()=>{i=null}),_t())},i(o){n||(X(i),n=!0)},o(o){x(i),n=!1},d(o){o&&N(e),i&&i.d(),l()}}}let rn=30;function Nc(t,e,l){let{config:n}=e,i,o,a,u,f,c,m,_=0;function v(){_=this.clientHeight,l(5,_)}function b(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=o-_);let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(8,m=an.y.max?k=n.padding.bottom:gc||k<0?0:k})}},[n,i,o,a,c,_,u,f,m,v,b]}class hn extends Et{constructor(e){super(),It(this,e,Nc,Ec,Ct,{config:0})}}function Tc(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function qc(t,e,l){let{title:n}=e,{u1:i}=e,{u2:o}=e,{u3:a}=e,{ds:u}=e,f={};function c(m){return{label:tl(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:E0(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,o=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,u=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:u===1?"L1-L2":"L1"}),_.push(c(i))),o>0&&(m.push({label:u===1?"L1-L3":"L2"}),_.push(c(o))),a>0&&(m.push({label:u===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:m},points:_})}},[f,n,i,o,a,u]}class Dc extends Et{constructor(e){super(),It(this,e,qc,Tc,Ct,{title:1,u1:2,u2:3,u3:4,ds:5})}}function Ac(t){var A,W,te,re,be;let e,l,n=(((A=t[0].reactive)==null?void 0:A.title)??"Reactive")+"",i,o,a,u,f=(((W=t[0].reactive)==null?void 0:W.instant_in)??"Instant in")+"",c,m,_,v=t[1][0]+"",b,d,h=t[1][1]+"",g,k,C,I=(((te=t[0].reactive)==null?void 0:te.instant_out)??"Instant out")+"",R,E,O,L=t[2][0]+"",j,K,U=t[2][1]+"",q,y,Z,G,Y=(((re=t[0].reactive)==null?void 0:re.total_in)??"Total in")+"",V,B,H,ne=t[3][0]+"",ee,Q,ie=t[3][1]+"",ue,fe,le,de=(((be=t[0].reactive)==null?void 0:be.total_out)??"Total out")+"",oe,me,se,pe=t[4][0]+"",we,S,P=t[4][1]+"",F;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),u=p("div"),c=M(f),m=w(),_=p("div"),b=M(v),d=w(),g=M(h),k=w(),C=p("div"),R=M(I),E=w(),O=p("div"),j=M(L),K=w(),q=M(U),y=w(),Z=p("div"),G=p("div"),V=M(Y),B=w(),H=p("div"),ee=M(ne),Q=w(),ue=M(ie),fe=w(),le=p("div"),oe=M(de),me=w(),se=p("div"),we=M(pe),S=w(),F=M(P),r(_,"class","text-right"),r(O,"class","text-right"),r(a,"class","grid grid-cols-2 mt-4"),r(H,"class","text-right"),r(se,"class","text-right"),r(Z,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(ke,J){T(ke,e,J),s(e,l),s(l,i),s(e,o),s(e,a),s(a,u),s(u,c),s(a,m),s(a,_),s(_,b),s(_,d),s(_,g),s(a,k),s(a,C),s(C,R),s(a,E),s(a,O),s(O,j),s(O,K),s(O,q),s(e,y),s(e,Z),s(Z,G),s(G,V),s(Z,B),s(Z,H),s(H,ee),s(H,Q),s(H,ue),s(Z,fe),s(Z,le),s(le,oe),s(Z,me),s(Z,se),s(se,we),s(se,S),s(se,F)},p(ke,[J]){var ve,ge,Ne,Ie,De;J&1&&n!==(n=(((ve=ke[0].reactive)==null?void 0:ve.title)??"Reactive")+"")&&D(i,n),J&1&&f!==(f=(((ge=ke[0].reactive)==null?void 0:ge.instant_in)??"Instant in")+"")&&D(c,f),J&2&&v!==(v=ke[1][0]+"")&&D(b,v),J&2&&h!==(h=ke[1][1]+"")&&D(g,h),J&1&&I!==(I=(((Ne=ke[0].reactive)==null?void 0:Ne.instant_out)??"Instant out")+"")&&D(R,I),J&4&&L!==(L=ke[2][0]+"")&&D(j,L),J&4&&U!==(U=ke[2][1]+"")&&D(q,U),J&1&&Y!==(Y=(((Ie=ke[0].reactive)==null?void 0:Ie.total_in)??"Total in")+"")&&D(V,Y),J&8&&ne!==(ne=ke[3][0]+"")&&D(ee,ne),J&8&&ie!==(ie=ke[3][1]+"")&&D(ue,ie),J&1&&de!==(de=(((De=ke[0].reactive)==null?void 0:De.total_out)??"Total out")+"")&&D(oe,de),J&16&&pe!==(pe=ke[4][0]+"")&&D(we,pe),J&16&&P!==(P=ke[4][1]+"")&&D(F,P)},i:ze,o:ze,d(ke){ke&&N(e)}}}function Rc(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e,{translations:u={}}=e,f,c,m,_;return t.$$set=v=>{"importInstant"in v&&l(5,n=v.importInstant),"exportInstant"in v&&l(6,i=v.exportInstant),"importTotal"in v&&l(7,o=v.importTotal),"exportTotal"in v&&l(8,a=v.exportTotal),"translations"in v&&l(0,u=v.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=pl(n,"VAr")),l(2,c=pl(i,"VAr")),l(3,m=pl(o*1e3,"VArh")),l(4,_=pl(a*1e3,"VArh")))},[u,f,c,m,_,n,i,o,a]}class Oc extends Et{constructor(e){super(),It(this,e,Rc,Ac,Ct,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function rs(t){let e;function l(o,a){return o[3]?Fc:Lc}let n=l(t),i=n(t);return{c(){i.c(),e=Wt()},m(o,a){i.m(o,a),T(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&N(e),i.d(o)}}}function Lc(t){var W,te,re,be,ke;let e,l=(((W=t[4].realtime)==null?void 0:W.consumption)??"Consumption")+"",n,i,o,a,u=sl(((te=t[4].common)==null?void 0:te.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",v,b,d=t[6][1]+"",h,g,k,C=sl(((re=t[4].common)==null?void 0:re.day)??"Day")+"",I,R,E,O=t[7][0]+"",L,j,K=t[7][1]+"",U,q,y,Z=sl(((be=t[4].common)==null?void 0:be.month)??"Month")+"",G,Y,V,B=t[8][0]+"",H,ne,ee=t[8][1]+"",Q,ie,ue,fe=(((ke=t[4].realtime)==null?void 0:ke.last_month)??"Last month")+"",le,de,oe,me=t[9][0]+"",se,pe,we=t[9][1]+"",S,P,F,A=t[5]&&us(t);return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),g=w(),k=p("div"),I=M(C),R=w(),E=p("div"),L=M(O),j=w(),U=M(K),q=w(),y=p("div"),G=M(Z),Y=w(),V=p("div"),H=M(B),ne=w(),Q=M(ee),ie=w(),ue=p("div"),le=M(fe),de=w(),oe=p("div"),se=M(me),pe=w(),S=M(we),P=w(),A&&A.c(),F=Wt(),r(m,"class","text-right"),r(E,"class","text-right"),r(V,"class","text-right"),r(oe,"class","text-right"),r(o,"class","grid grid-cols-2 mb-3")},m(J,ve){T(J,e,ve),s(e,n),T(J,i,ve),T(J,o,ve),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,h),s(o,g),s(o,k),s(k,I),s(o,R),s(o,E),s(E,L),s(E,j),s(E,U),s(o,q),s(o,y),s(y,G),s(o,Y),s(o,V),s(V,H),s(V,ne),s(V,Q),s(o,ie),s(o,ue),s(ue,le),s(o,de),s(o,oe),s(oe,se),s(oe,pe),s(oe,S),T(J,P,ve),A&&A.m(J,ve),T(J,F,ve)},p(J,ve){var ge,Ne,Ie,De,Ae;ve&16&&l!==(l=(((ge=J[4].realtime)==null?void 0:ge.consumption)??"Consumption")+"")&&D(n,l),ve&16&&u!==(u=sl(((Ne=J[4].common)==null?void 0:Ne.hour)??"Hour")+"")&&D(f,u),ve&64&&_!==(_=J[6][0]+"")&&D(v,_),ve&64&&d!==(d=J[6][1]+"")&&D(h,d),ve&16&&C!==(C=sl(((Ie=J[4].common)==null?void 0:Ie.day)??"Day")+"")&&D(I,C),ve&128&&O!==(O=J[7][0]+"")&&D(L,O),ve&128&&K!==(K=J[7][1]+"")&&D(U,K),ve&16&&Z!==(Z=sl(((De=J[4].common)==null?void 0:De.month)??"Month")+"")&&D(G,Z),ve&256&&B!==(B=J[8][0]+"")&&D(H,B),ve&256&&ee!==(ee=J[8][1]+"")&&D(Q,ee),ve&16&&fe!==(fe=(((Ae=J[4].realtime)==null?void 0:Ae.last_month)??"Last month")+"")&&D(le,fe),ve&512&&me!==(me=J[9][0]+"")&&D(se,me),ve&512&&we!==(we=J[9][1]+"")&&D(S,we),J[5]?A?A.p(J,ve):(A=us(J),A.c(),A.m(F.parentNode,F)):A&&(A.d(1),A=null)},d(J){J&&(N(e),N(i),N(o),N(P),N(F)),A&&A.d(J)}}}function Fc(t){var Oe,He,Gt,Kt,wt,cl,ol,jt,Ht,rl;let e,l=(((Oe=t[4].common)==null?void 0:Oe.import)??"Import")+"",n,i,o,a,u=sl(((He=t[4].common)==null?void 0:He.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",v,b,d=t[6][1]+"",h,g,k,C,I=sl(((Gt=t[4].common)==null?void 0:Gt.day)??"Day")+"",R,E,O,L=t[7][0]+"",j,K,U=t[7][1]+"",q,y,Z,G,Y=sl(((Kt=t[4].common)==null?void 0:Kt.month)??"Month")+"",V,B,H,ne=t[8][0]+"",ee,Q,ie=t[8][1]+"",ue,fe,le,de,oe=(((wt=t[4].realtime)==null?void 0:wt.last_mo)??"Last mo.")+"",me,se,pe,we=t[9][0]+"",S,P,F=t[9][1]+"",A,W,te,re,be,ke=(((cl=t[4].common)==null?void 0:cl.export)??"Export")+"",J,ve,ge,Ne,Ie=sl(((ol=t[4].common)==null?void 0:ol.hour)??"Hour")+"",De,Ae,Me,qe=t[10][0]+"",Le,$e,xe=t[10][1]+"",rt,Pt,dt,ut,ot=sl(((jt=t[4].common)==null?void 0:jt.day)??"Day")+"",ht,Rt,Je,Fe=t[11][0]+"",je,tt,Ve=t[11][1]+"",Ge,Qe,_e,ae,Ee=sl(((Ht=t[4].common)==null?void 0:Ht.month)??"Month")+"",Ke,Tt,vt,Xe=t[12][0]+"",Nt,at,mt=t[12][1]+"",lt,yt,el,pt,nt=(((rl=t[4].realtime)==null?void 0:rl.last_mo)??"Last mo.")+"",Qt,Jt,Ot,Zt=t[13][0]+"",$t,Vt,Xt=t[13][1]+"",ll,Ye,st,St=t[5]&&cs(t),Lt=t[5]&&_s(t),kt=t[5]&&ms(t),gt=t[5]&&ps(t),zt=t[5]&&ds(t),et=t[5]&&hs(t),Ft=t[5]&&vs(t),he=t[5]&&bs(t);return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),g=w(),St&&St.c(),k=w(),C=p("div"),R=M(I),E=w(),O=p("div"),j=M(L),K=w(),q=M(U),y=w(),Lt&&Lt.c(),Z=w(),G=p("div"),V=M(Y),B=w(),H=p("div"),ee=M(ne),Q=w(),ue=M(ie),fe=w(),kt&&kt.c(),le=w(),de=p("div"),me=M(oe),se=w(),pe=p("div"),S=M(we),P=w(),A=M(F),W=w(),gt&>.c(),re=w(),be=p("strong"),J=M(ke),ve=w(),ge=p("div"),Ne=p("div"),De=M(Ie),Ae=w(),Me=p("div"),Le=M(qe),$e=w(),rt=M(xe),Pt=w(),zt&&zt.c(),dt=w(),ut=p("div"),ht=M(ot),Rt=w(),Je=p("div"),je=M(Fe),tt=w(),Ge=M(Ve),Qe=w(),et&&et.c(),_e=w(),ae=p("div"),Ke=M(Ee),Tt=w(),vt=p("div"),Nt=M(Xe),at=w(),lt=M(mt),yt=w(),Ft&&Ft.c(),el=w(),pt=p("div"),Qt=M(nt),Jt=w(),Ot=p("div"),$t=M(Zt),Vt=w(),ll=M(Xt),Ye=w(),he&&he.c(),r(m,"class","text-right"),r(O,"class","text-right"),r(H,"class","text-right"),r(pe,"class","text-right"),r(o,"class",te="grid grid-cols-"+t[14]+" mb-3"),r(Me,"class","text-right"),r(Je,"class","text-right"),r(vt,"class","text-right"),r(Ot,"class","text-right"),r(ge,"class",st="grid grid-cols-"+t[14])},m(Te,$){T(Te,e,$),s(e,n),T(Te,i,$),T(Te,o,$),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,h),s(o,g),St&&St.m(o,null),s(o,k),s(o,C),s(C,R),s(o,E),s(o,O),s(O,j),s(O,K),s(O,q),s(o,y),Lt&&Lt.m(o,null),s(o,Z),s(o,G),s(G,V),s(o,B),s(o,H),s(H,ee),s(H,Q),s(H,ue),s(o,fe),kt&&kt.m(o,null),s(o,le),s(o,de),s(de,me),s(o,se),s(o,pe),s(pe,S),s(pe,P),s(pe,A),s(o,W),gt&>.m(o,null),T(Te,re,$),T(Te,be,$),s(be,J),T(Te,ve,$),T(Te,ge,$),s(ge,Ne),s(Ne,De),s(ge,Ae),s(ge,Me),s(Me,Le),s(Me,$e),s(Me,rt),s(ge,Pt),zt&&zt.m(ge,null),s(ge,dt),s(ge,ut),s(ut,ht),s(ge,Rt),s(ge,Je),s(Je,je),s(Je,tt),s(Je,Ge),s(ge,Qe),et&&et.m(ge,null),s(ge,_e),s(ge,ae),s(ae,Ke),s(ge,Tt),s(ge,vt),s(vt,Nt),s(vt,at),s(vt,lt),s(ge,yt),Ft&&Ft.m(ge,null),s(ge,el),s(ge,pt),s(pt,Qt),s(ge,Jt),s(ge,Ot),s(Ot,$t),s(Ot,Vt),s(Ot,ll),s(ge,Ye),he&&he.m(ge,null)},p(Te,$){var Re,_l,it,qt,al,ml,vl,fl,gl,kl;$&16&&l!==(l=(((Re=Te[4].common)==null?void 0:Re.import)??"Import")+"")&&D(n,l),$&16&&u!==(u=sl(((_l=Te[4].common)==null?void 0:_l.hour)??"Hour")+"")&&D(f,u),$&64&&_!==(_=Te[6][0]+"")&&D(v,_),$&64&&d!==(d=Te[6][1]+"")&&D(h,d),Te[5]?St?St.p(Te,$):(St=cs(Te),St.c(),St.m(o,k)):St&&(St.d(1),St=null),$&16&&I!==(I=sl(((it=Te[4].common)==null?void 0:it.day)??"Day")+"")&&D(R,I),$&128&&L!==(L=Te[7][0]+"")&&D(j,L),$&128&&U!==(U=Te[7][1]+"")&&D(q,U),Te[5]?Lt?Lt.p(Te,$):(Lt=_s(Te),Lt.c(),Lt.m(o,Z)):Lt&&(Lt.d(1),Lt=null),$&16&&Y!==(Y=sl(((qt=Te[4].common)==null?void 0:qt.month)??"Month")+"")&&D(V,Y),$&256&&ne!==(ne=Te[8][0]+"")&&D(ee,ne),$&256&&ie!==(ie=Te[8][1]+"")&&D(ue,ie),Te[5]?kt?kt.p(Te,$):(kt=ms(Te),kt.c(),kt.m(o,le)):kt&&(kt.d(1),kt=null),$&16&&oe!==(oe=(((al=Te[4].realtime)==null?void 0:al.last_mo)??"Last mo.")+"")&&D(me,oe),$&512&&we!==(we=Te[9][0]+"")&&D(S,we),$&512&&F!==(F=Te[9][1]+"")&&D(A,F),Te[5]?gt?gt.p(Te,$):(gt=ps(Te),gt.c(),gt.m(o,null)):gt&&(gt.d(1),gt=null),$&16384&&te!==(te="grid grid-cols-"+Te[14]+" mb-3")&&r(o,"class",te),$&16&&ke!==(ke=(((ml=Te[4].common)==null?void 0:ml.export)??"Export")+"")&&D(J,ke),$&16&&Ie!==(Ie=sl(((vl=Te[4].common)==null?void 0:vl.hour)??"Hour")+"")&&D(De,Ie),$&1024&&qe!==(qe=Te[10][0]+"")&&D(Le,qe),$&1024&&xe!==(xe=Te[10][1]+"")&&D(rt,xe),Te[5]?zt?zt.p(Te,$):(zt=ds(Te),zt.c(),zt.m(ge,dt)):zt&&(zt.d(1),zt=null),$&16&&ot!==(ot=sl(((fl=Te[4].common)==null?void 0:fl.day)??"Day")+"")&&D(ht,ot),$&2048&&Fe!==(Fe=Te[11][0]+"")&&D(je,Fe),$&2048&&Ve!==(Ve=Te[11][1]+"")&&D(Ge,Ve),Te[5]?et?et.p(Te,$):(et=hs(Te),et.c(),et.m(ge,_e)):et&&(et.d(1),et=null),$&16&&Ee!==(Ee=sl(((gl=Te[4].common)==null?void 0:gl.month)??"Month")+"")&&D(Ke,Ee),$&4096&&Xe!==(Xe=Te[12][0]+"")&&D(Nt,Xe),$&4096&&mt!==(mt=Te[12][1]+"")&&D(lt,mt),Te[5]?Ft?Ft.p(Te,$):(Ft=vs(Te),Ft.c(),Ft.m(ge,el)):Ft&&(Ft.d(1),Ft=null),$&16&&nt!==(nt=(((kl=Te[4].realtime)==null?void 0:kl.last_mo)??"Last mo.")+"")&&D(Qt,nt),$&8192&&Zt!==(Zt=Te[13][0]+"")&&D($t,Zt),$&8192&&Xt!==(Xt=Te[13][1]+"")&&D(ll,Xt),Te[5]?he?he.p(Te,$):(he=bs(Te),he.c(),he.m(ge,null)):he&&(he.d(1),he=null),$&16384&&st!==(st="grid grid-cols-"+Te[14])&&r(ge,"class",st)},d(Te){Te&&(N(e),N(i),N(o),N(re),N(be),N(ve),N(ge)),St&&St.d(),Lt&&Lt.d(),kt&&kt.d(),gt&>.d(),zt&&zt.d(),et&&et.d(),Ft&&Ft.d(),he&&he.d()}}}function us(t){var se,pe,we,S,P,F;let e,l=(((se=t[4].realtime)==null?void 0:se.cost)??"Cost")+"",n,i,o,a,u=sl(((pe=t[4].common)==null?void 0:pe.hour)??"Hour")+"",f,c,m,_=tl(t[1].h.c,2)+"",v,b,d,h,g,k=sl(((we=t[4].common)==null?void 0:we.day)??"Day")+"",C,I,R,E=tl(t[1].d.c,1)+"",O,L,j,K,U,q=sl(((S=t[4].common)==null?void 0:S.month)??"Month")+"",y,Z,G,Y=tl(t[1].m.c)+"",V,B,H,ne,ee,Q=(((P=t[4].realtime)==null?void 0:P.last_month)??"Last month")+"",ie,ue,fe,le=tl((F=t[0].last_month)==null?void 0:F.c)+"",de,oe,me;return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),d=M(t[2]),h=w(),g=p("div"),C=M(k),I=w(),R=p("div"),O=M(E),L=w(),j=M(t[2]),K=w(),U=p("div"),y=M(q),Z=w(),G=p("div"),V=M(Y),B=w(),H=M(t[2]),ne=w(),ee=p("div"),ie=M(Q),ue=w(),fe=p("div"),de=M(le),oe=w(),me=M(t[2]),r(m,"class","text-right"),r(R,"class","text-right"),r(G,"class","text-right"),r(fe,"class","text-right"),r(o,"class","grid grid-cols-2")},m(A,W){T(A,e,W),s(e,n),T(A,i,W),T(A,o,W),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,d),s(o,h),s(o,g),s(g,C),s(o,I),s(o,R),s(R,O),s(R,L),s(R,j),s(o,K),s(o,U),s(U,y),s(o,Z),s(o,G),s(G,V),s(G,B),s(G,H),s(o,ne),s(o,ee),s(ee,ie),s(o,ue),s(o,fe),s(fe,de),s(fe,oe),s(fe,me)},p(A,W){var te,re,be,ke,J,ve;W&16&&l!==(l=(((te=A[4].realtime)==null?void 0:te.cost)??"Cost")+"")&&D(n,l),W&16&&u!==(u=sl(((re=A[4].common)==null?void 0:re.hour)??"Hour")+"")&&D(f,u),W&2&&_!==(_=tl(A[1].h.c,2)+"")&&D(v,_),W&4&&D(d,A[2]),W&16&&k!==(k=sl(((be=A[4].common)==null?void 0:be.day)??"Day")+"")&&D(C,k),W&2&&E!==(E=tl(A[1].d.c,1)+"")&&D(O,E),W&4&&D(j,A[2]),W&16&&q!==(q=sl(((ke=A[4].common)==null?void 0:ke.month)??"Month")+"")&&D(y,q),W&2&&Y!==(Y=tl(A[1].m.c)+"")&&D(V,Y),W&4&&D(H,A[2]),W&16&&Q!==(Q=(((J=A[4].realtime)==null?void 0:J.last_month)??"Last month")+"")&&D(ie,Q),W&1&&le!==(le=tl((ve=A[0].last_month)==null?void 0:ve.c)+"")&&D(de,le),W&4&&D(me,A[2])},d(A){A&&(N(e),N(i),N(o))}}}function cs(t){let e,l=tl(t[1].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].h.c,2)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function _s(t){let e,l=tl(t[1].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].d.c,1)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function ms(t){let e,l=tl(t[1].m.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].m.c)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function ps(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(u,f){T(u,e,f),s(e,n),s(e,i),s(e,o)},p(u,f){var c;f&1&&l!==(l=tl((c=u[0].last_month)==null?void 0:c.c)+"")&&D(n,l),f&4&&D(o,u[2])},d(u){u&&N(e)}}}function ds(t){let e,l=tl(t[1].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].h.i,2)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function hs(t){let e,l=tl(t[1].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].d.i,1)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function vs(t){let e,l=tl(t[1].m.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=tl(a[1].m.i)+"")&&D(n,l),u&4&&D(o,a[2])},d(a){a&&N(e)}}}function bs(t){var a;let e,l=tl((a=t[0].last_month)==null?void 0:a.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(u,f){T(u,e,f),s(e,n),s(e,i),s(e,o)},p(u,f){var c;f&1&&l!==(l=tl((c=u[0].last_month)==null?void 0:c.i)+"")&&D(n,l),f&4&&D(o,u[2])},d(u){u&&N(e)}}}function yc(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,o,a,u,f,c=t[1]&&rs(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("br"),u=p("br"),f=w(),c&&c.c(),r(e,"class","mx-2 text-sm")},m(_,v){T(_,e,v),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),c&&c.m(e,null)},p(_,[v]){var b;v&16&&n!==(n=(((b=_[4].realtime)==null?void 0:b.title)??"Real time calculations")+"")&&D(i,n),_[1]?c?c.p(_,v):(c=rs(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:ze,o:ze,d(_){_&&N(e),c&&c.d()}}}function Bc(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,{translations:u={}}=e,f,c,m,_,v,b,d,h,g=!1,k=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,a=C.hasExport),"translations"in C&&l(4,u=C.translations)},t.$$.update=()=>{var C,I,R,E,O,L,j,K;t.$$.dirty&35&&(l(5,g=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,k=g?3:2),l(6,f=pl(((C=i==null?void 0:i.h)==null?void 0:C.u)*1e3,"Wh")),l(7,c=pl(((I=i==null?void 0:i.d)==null?void 0:I.u)*1e3,"Wh")),l(8,m=pl(((R=i==null?void 0:i.m)==null?void 0:R.u)*1e3,"Wh")),l(9,_=pl(((E=n==null?void 0:n.last_month)==null?void 0:E.u)*1e3,"Wh")),l(10,v=pl(((O=i==null?void 0:i.h)==null?void 0:O.p)*1e3,"Wh")),l(11,b=pl(((L=i==null?void 0:i.d)==null?void 0:L.p)*1e3,"Wh")),l(12,d=pl(((j=i==null?void 0:i.m)==null?void 0:j.p)*1e3,"Wh")),l(13,h=pl(((K=n==null?void 0:n.last_month)==null?void 0:K.p)*1e3,"Wh")))},[n,i,o,a,u,g,f,c,m,_,v,b,d,h,k]}class Uc extends Et{constructor(e){super(),It(this,e,Bc,yc,Ct,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function gs(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function zc(t){let e,l,n=t[0].points&&t[0].points.length>0&&gs(t);return{c(){n&&n.c(),e=Wt()},m(i,o){n&&n.m(i,o),T(i,e,o),l=!0},p(i,[o]){i[0].points&&i[0].points.length>0?n?(n.p(i,o),o&1&&X(n,1)):(n=gs(i),n.c(),X(n,1),n.m(e.parentNode,e)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d(i)}}}function jc(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:o}=e,a={},u,f,c=document.documentElement.classList.contains("dark"),m=new Date;return ao(()=>{let _;function v(){l(6,m=new Date),_=setTimeout(()=>{v()},(15-m.getMinutes()%15)*6e4)}return v(),()=>{clearTimeout(_)}}),t.$$set=_=>{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},t.$$.update=()=>{var _,v;if(t.$$.dirty&126&&((_=i==null?void 0:i.prices)==null?void 0:_.length)>0){l(6,m=new Date);let b=i==null?void 0:i.currency,d=0,h=[],g=[],k=[];l(5,f=l(4,u=0)),_n(m,o.clock_offset-(24+m.getHours()-m.getUTCHours())%24);let C=i!=null&&i.cursor?i.cursor:0;for(m.setMinutes(Math.floor(m.getMinutes()/(i==null?void 0:i.resolution))*(i==null?void 0:i.resolution),0,0);C<((v=i==null?void 0:i.prices)==null?void 0:v.length)&&(d=i.prices[C],d!=null);)g.push({label:k.length>0&&(i==null?void 0:i.resolution)<60&&m.getMinutes()!=0?"":At(m.getHours())}),k.push(d*100),l(5,f=Math.min(f,d*100)),l(4,u=Math.max(u,d*100)),N0(m,i==null?void 0:i.resolution),C++;let I=ni(Math.max(Math.abs(f)/100,Math.abs(u)/100),b);if(I&&I[1]&&I[1]!=b)for(b=I[1],l(5,f*=100),l(4,u*=100),C=0;C=0?j.toFixed(K):"",title:j>=0?j.toFixed(2)+" "+b:"",value:d>=0?Math.abs(d):0,label2:j<0?j.toFixed(K):"",title2:j<0?j.toFixed(2)+" "+b:"",value2:d<0?Math.abs(d):0,color:c?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(f));if(f<0){l(5,f=Math.min(E/4*-1,f));let j=Math.ceil(Math.abs(f)/E*4),K=f/j;for(C=1;C{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],v=[],b=[];l(5,f=l(4,u=0));let d=new Date,h=new Date;h.setDate(0),h.setHours(12);let g=(h.getHours()-h.getUTCHours())%24-o.clock_offset,k=d.getUTCHours();for(_n(d,-g-24),m=k;m<24;m++){let E=i["i"+At(m)],O=i["e"+At(m)];E===void 0&&(E=0),O===void 0&&(O=0),v.push({label:At(d.getHours())}),b.push({label:E.toFixed(1),title:E.toFixed(2)+" kWh",value:E*10,label2:O.toFixed(1),title2:O.toFixed(2)+" kWh",value2:O*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,O*10)),l(4,u=Math.max(u,E*10)),_n(d,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],v=[],b=[];l(5,f=l(4,u=0));let d=new Date,h=new Date;h.setDate(0),h.setHours(12);let g=(h.getHours()-h.getUTCHours())%24-o.clock_offset;for(_n(d,-g),_n(h,-g),m=d.getDate();m<=h.getDate();m++){let R=i["i"+At(m)],E=i["e"+At(m)];R===void 0&&(R=0),E===void 0&&(E=0),v.push({label:At(m)}),b.push({label:R.toFixed(R<10?1:0),title:R.toFixed(2)+" kWh",value:R,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,E)),l(4,u=Math.max(u,R))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],v=[],b=[];i.s&&i.s.forEach((g,k)=>{var C=g.n?g.n:g.a;m=g.v,m==-127&&(m=0),v.push({label:C.slice(-4)}),b.push({label:m.toFixed(1),value:m,color:o?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,u=Math.max(u,m))}),l(3,u=Math.ceil(u)),l(4,f=Math.floor(f));let d=u;f<0&&(d+=Math.abs(f));let h=d/4;for(c=0;c<5;c++)m=f+h*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:u,ticks:_},x:{ticks:v},points:b})}},[a,n,i,u,f]}class Zc extends Et{constructor(e){super(),It(this,e,Xc,Qc,Ct,{title:1,json:2})}}function Jc(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}let $c=0;function xc(t,e,l){let{title:n}=e,{translations:i={}}=e,o=document.documentElement.classList.contains("dark"),a={},u=0,{tariffData:f}=e,{realtime:c}=e;return t.$$set=m=>{"title"in m&&l(1,n=m.title),"translations"in m&&l(2,i=m.translations),"tariffData"in m&&l(3,f=m.tariffData),"realtime"in m&&l(4,c=m.realtime)},t.$$.update=()=>{var m,_,v,b;if(t.$$.dirty&62){let d=0,h=[],g=[],k=[];if(h.push({value:0,label:0}),f&&!isNaN((m=c==null?void 0:c.h)==null?void 0:m.u)&&(k.push({label:c.h.u.toFixed(2),value:c.h.u,title:(((_=i.common)==null?void 0:_.now)??"Now")+": "+c.h.u.toFixed(2)+" kWh",color:Ei(c.h.u/f.c*100)}),g.push({label:((v=i.common)==null?void 0:v.now)??"Now"})),f&&f.p)for(d=0;d0&&(R=At(C.d)+".",I=At(C.d)+"."+(i.months?(b=i.months)==null?void 0:b[new Date().getMonth()]:At(new Date().getMonth()+1)),f.p.length<4&&(R=I)),isNaN(C.h)||(I=I+" "+At(C.h)+":00"),I=I+": "+C.v.toFixed(2)+" kWh",k.push({label:C.v.toFixed(2),value:C.v,title:I,color:o?"#5c2da5":"#7c3aed"}),g.push({label:R}),l(5,u=Math.max(u,C.v))}if(f&&f.t){for(d=0;d=u)break;h.push({value:C,label:C})}h.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(h.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(5,u=Math.max(u,f.c))),l(5,u=Math.ceil(u)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:20,bottom:20,left:20},y:{min:$c,max:u,ticks:h},x:{ticks:g},points:k})}},[a,n,i,f,c,u]}class e1 extends Et{constructor(e){super(),It(this,e,xc,Jc,Ct,{title:1,translations:2,tariffData:3,realtime:4})}}let sn=0,t1={data:[]};async function po(){let e=await(await Cl(sn<0?"realtime.json":"realtime.json?offset="+sn)).json();ho.update(l=>{for(let n=0;n=0&&(sn+=e.size,snCn||$i-Cn>300?(po(),yi=0):ho.update(t=>{if(t.lastUpdate)for(;Cn>t.lastUpdate;)t.data.unshift(Zr),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,yi++;else t.lastUpdate=Cn;return t})}function i1(t){if(Zr=t.i-t.e,Cn=t.u,!ks){po(),ks=!0,$i=Cn;return}l1()&&n1()}function ws(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function Cs(t,e,l){const n=t.slice();return n[21]=e[l],n}function o1(t){let e,l,n;return{c(){e=p("strong"),l=M(t[0]),n=M(" not available"),r(e,"class","text-sm")},m(i,o){T(i,e,o),s(e,l),s(e,n)},p(i,o){o&1&&D(l,i[0])},d(i){i&&N(e)}}}function s1(t){let e,l,n,i,o,a,u,f=t[8]&&Ps(t);return{c(){e=p("strong"),l=M(t[0]),n=M(" ("),i=M(t[12]),o=M(")"),a=w(),f&&f.c(),u=Wt(),r(e,"class","text-sm")},m(c,m){T(c,e,m),s(e,l),s(e,n),s(e,i),s(e,o),T(c,a,m),f&&f.m(c,m),T(c,u,m)},p(c,m){m&1&&D(l,c[0]),m&4096&&D(i,c[12]),c[8]?f?f.p(c,m):(f=Ps(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(u)),f&&f.d(c)}}}function Ps(t){let e,l,n,i,o,a=ft(t[8]),u=[];for(let m=0;mt[17].call(e))},m(a,u){T(a,e,u),o.m(e,null),l=Mi(e,t[17].bind(e))},p(a,[u]){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null)))},i:ze,o:ze,d(a){a&&N(e),o.d(),l()}}}function f1(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),o=null;ho.subscribe(E=>{l(16,o=E)});let a=!1,u,f,c,m,_,v,b,d=function(E,O,L){return Math.ceil(_-(E-O)/(L-O)*_)-25},h=function(E){return 30+Math.ceil(E/o.size*(v-35))},g,k,C,I;function R(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=E=>{"title"in E&&l(0,n=E.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,v=c-35),l(10,C=v/o.size),l(2,f=0),l(1,u=0),o.data&&_>10&&v>100&&C>.1){l(11,a=!0);for(let L in o.data){let j=o.data[L];isNaN(j)&&(j=0),l(1,u=Math.max(Math.ceil(j/1e3)*1e3,u)),l(2,f=Math.min(Math.floor(j/1e3)*1e3,f))}let E=u-f;l(12,I=u>2500?"kW":"W"),l(8,g=[]);for(let L=f;L2500?(L/1e3).toFixed(1):L}),!(g.length>6));L+=E/5);l(9,k=[]);for(let L=0;L12));L+=Math.round(o.size/Math.round(v/120)));let O=o.size;l(7,b=h(o.size)+","+d(0,f,u)+" "+h(1)+","+d(0,f,u));for(let L in o.data){if(O<0)break;let j=o.data[L];isNaN(j)&&(j=0),l(7,b=h(O--)+","+d(j,f,u)+" "+b)}}else l(11,a=!1)},[n,u,f,c,m,_,v,b,g,k,C,a,I,i,d,h,o,R]}class r1 extends Et{constructor(e){super(),It(this,e,f1,a1,Ct,{title:0})}}function u1(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function c1(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:o=!1}=e,{l2:a=!1}=e,{l2x:u=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:v=0}=e,{l2e:b=0}=e,{l3e:d=0}=e,{maxImport:h=0}=e,{maxExport:g=0}=e,{importColorFn:k}=e,{exportColorFn:C}=e,I={};function R(E,O){return{label:tl(E>900?E/1e3:E)+(E>900?"k":"")+i,title:E.toFixed(2)+" "+i,value:isNaN(E)?0:E,color:k(E?E/h*100:0,document.documentElement.classList.contains("dark")),label2:tl(O>900?O/1e3:O)+(O>900?"k":"")+i,title2:O.toFixed(2)+" "+i,value2:isNaN(O)?0:O,color2:C(O?O/g*100:0)}}return t.$$set=E=>{"title"in E&&l(1,n=E.title),"unit"in E&&l(2,i=E.unit),"l1"in E&&l(3,o=E.l1),"l2"in E&&l(4,a=E.l2),"l2x"in E&&l(5,u=E.l2x),"l3"in E&&l(6,f=E.l3),"l1i"in E&&l(7,c=E.l1i),"l2i"in E&&l(8,m=E.l2i),"l3i"in E&&l(9,_=E.l3i),"l1e"in E&&l(10,v=E.l1e),"l2e"in E&&l(11,b=E.l2e),"l3e"in E&&l(12,d=E.l3e),"maxImport"in E&&l(13,h=E.maxImport),"maxExport"in E&&l(14,g=E.maxExport),"importColorFn"in E&&l(15,k=E.importColorFn),"exportColorFn"in E&&l(16,C=E.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let E=[],O=[];o&&(E.push({label:"L1"}),O.push(R(c,v))),a&&(u?(E.push({label:"L2"}),O.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(E.push({label:"L2"}),O.push(R(m,b)))),f&&(E.push({label:"L3"}),O.push(R(_,d)));let L=[];if(g){let j=g>h?4:g*4/h;L.push({value:-g,label:"-100%"}),j>=4&&L.push({value:-g/4*3,label:"-75%"}),j>=2&&L.push({value:-g/2,label:"-50%"}),j>=4&&L.push({value:-g/4,label:"-25%"})}if(L.push({value:0,label:"0%"}),h){let j=h>g?4:h*4/g;L.push({value:h/4,label:"25%"}),j>=4&&L.push({value:h/2,label:"50%"}),j>=2&&L.push({value:h/4*3,label:"75%"}),j>=4&&L.push({value:h,label:"100%"})}l(0,I={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-g,max:h,ticks:L},x:{ticks:E},points:O})}},[I,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C]}class vo extends Et{constructor(e){super(),It(this,e,c1,u1,Ct,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Ns(t){var k;let e,l,n,i,o,a,u=(t[0].mt?Ci(t[0].mt):"-")+"",f,c,m,_=t[12][0]+"",v,b,d=t[12][1]+"",h,g;return i=new Xr({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((k=t[7].common)==null?void 0:k.import)??"Import",sub:ni(t[0].p,t[0].pc),colorFn:Ei}}),{c(){e=p("div"),l=p("div"),n=p("div"),Se(i.$$.fragment),o=w(),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),r(n,"class","col-span-2"),r(m,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(C,I){T(C,e,I),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(a,f),s(l,c),s(l,m),s(m,v),s(m,b),s(m,h),g=!0},p(C,I){var E;const R={};I&1&&(R.val=C[0].i?C[0].i:0),I&1&&(R.max=C[0].im?C[0].im:15e3),I&128&&(R.label=((E=C[7].common)==null?void 0:E.import)??"Import"),I&1&&(R.sub=ni(C[0].p,C[0].pc)),i.$set(R),(!g||I&1)&&u!==(u=(C[0].mt?Ci(C[0].mt):"-")+"")&&D(f,u),(!g||I&4096)&&_!==(_=C[12][0]+"")&&D(v,_),(!g||I&4096)&&d!==(d=C[12][1]+"")&&D(h,d)},i(C){g||(X(i.$$.fragment,C),g=!0)},o(C){x(i.$$.fragment,C),g=!1},d(C){C&&N(e),Pe(i)}}}function Ts(t){var h;let e,l,n,i,o,a,u,f,c=t[13][0]+"",m,_,v=t[13][1]+"",b,d;return i=new Xr({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((h=t[7].common)==null?void 0:h.export)??"Export",sub:ni(t[0].px,t[0].pc),colorFn:ti}}),{c(){e=p("div"),l=p("div"),n=p("div"),Se(i.$$.fragment),o=w(),a=p("div"),u=w(),f=p("div"),m=M(c),_=w(),b=M(v),r(n,"class","col-span-2"),r(f,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(g,k){T(g,e,k),s(e,l),s(l,n),Ce(i,n,null),s(l,o),s(l,a),s(l,u),s(l,f),s(f,m),s(f,_),s(f,b),d=!0},p(g,k){var I;const C={};k&1&&(C.val=g[0].e?g[0].e:0),k&1&&(C.max=g[0].om?g[0].om*1e3:1e4),k&128&&(C.label=((I=g[7].common)==null?void 0:I.export)??"Export"),k&1&&(C.sub=ni(g[0].px,g[0].pc)),i.$set(C),(!d||k&8192)&&c!==(c=g[13][0]+"")&&D(m,c),(!d||k&8192)&&v!==(v=g[13][1]+"")&&D(b,v)},i(g){d||(X(i.$$.fragment,g),d=!0)},o(g){x(i.$$.fragment,g),d=!1},d(g){g&&N(e),Pe(i)}}}function qs(t){let e,l,n=t[0].l1&&Ds(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){T(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ds(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ds(t){var n;let e,l;return e=new Dc({props:{title:((n=t[7].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Se(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].common)==null?void 0:u.voltage)??"Volt"),o&1&&(a.u1=i[0].l1.u),o&1&&(a.u2=i[0].l2.u),o&1&&(a.u3=i[0].l3.u),o&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Pe(e,i)}}}function As(t){let e,l,n=t[0].l1&&Rs(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){T(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Rs(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Rs(t){var n;let e,l;return e=new vo({props:{title:((n=t[7].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Ei,exportColorFn:ti,maxImport:t[0].mf,l1:t[9],l2:t[10],l3:t[11],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Se(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].common)==null?void 0:u.amperage)??"Amp"),o&1&&(a.maxImport=i[0].mf),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l2x=i[0].l2.e),o&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),o&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),o&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Pe(e,i)}}}function Os(t){let e,l,n=t[0].l1&&Ls(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){T(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Ls(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Ls(t){var n;let e,l;return e=new vo({props:{title:((n=t[7].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Ei,exportColorFn:ti,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[14]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Se(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].dashboard)==null?void 0:u.phase)??"Phase"),o&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),o&16385&&(a.maxExport=i[0].om?i[14]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.p),o&1&&(a.l2i=i[0].l2.p),o&1&&(a.l3i=i[0].l3.p),o&1&&(a.l1e=i[0].l1.q),o&1&&(a.l2e=i[0].l2.q),o&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Pe(e,i)}}}function Fs(t){let e,l,n=t[0].l1&&ys(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){T(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=ys(i),n.c(),X(n,1),n.m(e,null)):n&&(ct(),x(n,1,1,()=>{n=null}),_t())},i(i){l||(X(n),l=!0)},o(i){x(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function ys(t){var n;let e,l;return e=new vo({props:{title:((n=t[7].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:ti,exportColorFn:ti,maxImport:1,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Se(e.$$.fragment)},m(i,o){Ce(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].dashboard)==null?void 0:u.pf)??"Pf"),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.f),o&1&&(a.l2i=i[0].l2.f),o&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){x(e.$$.fragment,i),l=!1},d(i){Pe(e,i)}}}function Bs(t){let e,l,n;return l=new Oc({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[7]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt")},m(i,o){T(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Pe(l)}}}function Us(t){let e,l,n;return l=new Uc({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[7]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt")},m(i,o){T(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Pe(l)}}}function zs(t){var i;let e,l,n;return l=new e1({props:{title:((i=t[7].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[8],realtime:t[0].ea,translations:t[7]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt h-64")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&256&&(u.tariffData=o[8]),a&1&&(u.realtime=o[0].ea),a&128&&(u.translations=o[7]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function js(t){var i;let e,l,n;return l=new r1({props:{title:((i=t[7].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function Hs(t){let e,l,n,i;const o=[m1,_1],a=[];function u(f,c){var m;return(m=f[2])!=null&&m.importExportPriceDifferent&&(f[0].om||f[0].e>0)?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),T(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function _1(t){var i;let e,l,n;return l=new mo({props:{title:((i=t[7].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price)??"Price"),a&4&&(u.json=o[2]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function m1(t){var i;let e,l,n;return l=new mo({props:{title:((i=t[7].dashboard)==null?void 0:i.price_import)??"Price import",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price_import)??"Price import"),a&4&&(u.json=o[2]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function Ws(t){var i;let e,l,n;return l=new mo({props:{title:((i=t[7].dashboard)==null?void 0:i.price_export)??"Price export",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price_export)??"Price export"),a&8&&(u.json=o[3]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function Vs(t){var i;let e,l,n;return l=new Vc({props:{title:((i=t[7].dashboard)==null?void 0:i.day)??"24 hours",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.day)??"24 hours"),a&16&&(u.json=o[4]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function Gs(t){var i;let e,l,n;return l=new Yc({props:{title:((i=t[7].dashboard)==null?void 0:i.month)??"{0} days",json:t[5],sysinfo:t[1]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.month)??"{0} days"),a&32&&(u.json=o[5]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function Ks(t){var i;let e,l,n;return l=new Zc({props:{title:((i=t[7].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[6]}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){T(o,e,a),Ce(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.temperature)??"Temperature"),a&64&&(u.json=o[6]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){x(l.$$.fragment,o),n=!1},d(o){o&&N(e),Pe(l)}}}function p1(t){var we;let e,l=xt(t[1].ui.i,t[0].i),n,i=xt(t[1].ui.e,t[0].om||t[0].e>0),o,a=xt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),u,f=xt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=xt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,v=xt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),b,d=xt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),h,g=xt(t[1].ui.c,t[0].ea),k,C=xt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),I,R=xt(t[1].ui.l,t[0].hm==1),E,O=xt(t[1].ui.p,t[0].p&&!Number.isNaN(t[0].p)),L,j=((we=t[2])==null?void 0:we.importExportPriceDifferent)&&(t[0].om||t[0].e>0)&&xt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].pe)),K,U=xt(t[1].ui.d,t[4]),q,y=xt(t[1].ui.m,t[5]),Z,G=xt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[6].c>1),Y,V=l&&Ns(t),B=i&&Ts(t),H=a&&qs(t),ne=f&&As(t),ee=m&&Os(t),Q=v&&Fs(t),ie=d&&Bs(t),ue=g&&Us(t),fe=C&&zs(t),le=R&&js(t),de=O&&Hs(t),oe=j&&Ws(t),me=U&&Vs(t),se=y&&Gs(t),pe=G&&Ks(t);return{c(){e=p("div"),V&&V.c(),n=w(),B&&B.c(),o=w(),H&&H.c(),u=w(),ne&&ne.c(),c=w(),ee&&ee.c(),_=w(),Q&&Q.c(),b=w(),ie&&ie.c(),h=w(),ue&&ue.c(),k=w(),fe&&fe.c(),I=w(),le&&le.c(),E=w(),de&&de.c(),L=w(),oe&&oe.c(),K=w(),me&&me.c(),q=w(),se&&se.c(),Z=w(),pe&&pe.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(S,P){T(S,e,P),V&&V.m(e,null),s(e,n),B&&B.m(e,null),s(e,o),H&&H.m(e,null),s(e,u),ne&&ne.m(e,null),s(e,c),ee&&ee.m(e,null),s(e,_),Q&&Q.m(e,null),s(e,b),ie&&ie.m(e,null),s(e,h),ue&&ue.m(e,null),s(e,k),fe&&fe.m(e,null),s(e,I),le&&le.m(e,null),s(e,E),de&&de.m(e,null),s(e,L),oe&&oe.m(e,null),s(e,K),me&&me.m(e,null),s(e,q),se&&se.m(e,null),s(e,Z),pe&&pe.m(e,null),Y=!0},p(S,[P]){var F;P&3&&(l=xt(S[1].ui.i,S[0].i)),l?V?(V.p(S,P),P&3&&X(V,1)):(V=Ns(S),V.c(),X(V,1),V.m(e,n)):V&&(ct(),x(V,1,1,()=>{V=null}),_t()),P&3&&(i=xt(S[1].ui.e,S[0].om||S[0].e>0)),i?B?(B.p(S,P),P&3&&X(B,1)):(B=Ts(S),B.c(),X(B,1),B.m(e,o)):B&&(ct(),x(B,1,1,()=>{B=null}),_t()),P&3&&(a=xt(S[1].ui.v,S[0].l1&&(S[0].l1.u>100||S[0].l2.u>100||S[0].l3.u>100))),a?H?(H.p(S,P),P&3&&X(H,1)):(H=qs(S),H.c(),X(H,1),H.m(e,u)):H&&(ct(),x(H,1,1,()=>{H=null}),_t()),P&3&&(f=xt(S[1].ui.a,S[0].l1&&(S[0].l1.i>.01||S[0].l2.i>.01||S[0].l3.i>.01))),f?ne?(ne.p(S,P),P&3&&X(ne,1)):(ne=As(S),ne.c(),X(ne,1),ne.m(e,c)):ne&&(ct(),x(ne,1,1,()=>{ne=null}),_t()),P&3&&(m=xt(S[1].ui.h,S[0].l1&&(S[0].l1.p>.01||S[0].l2.p>.01||S[0].l3.p>.01||S[0].l1.q>.01||S[0].l2.q>.01||S[0].l3.q>.01))),m?ee?(ee.p(S,P),P&3&&X(ee,1)):(ee=Os(S),ee.c(),X(ee,1),ee.m(e,_)):ee&&(ct(),x(ee,1,1,()=>{ee=null}),_t()),P&3&&(v=xt(S[1].ui.f,S[0].l1&&(S[0].l1.f>.01||S[0].l2.f>.01||S[0].l3.f>.01))),v?Q?(Q.p(S,P),P&3&&X(Q,1)):(Q=Fs(S),Q.c(),X(Q,1),Q.m(e,b)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),P&3&&(d=xt(S[1].ui.r,S[0].ri>0||S[0].re>0||S[0].ric>0||S[0].rec>0)),d?ie?(ie.p(S,P),P&3&&X(ie,1)):(ie=Bs(S),ie.c(),X(ie,1),ie.m(e,h)):ie&&(ct(),x(ie,1,1,()=>{ie=null}),_t()),P&3&&(g=xt(S[1].ui.c,S[0].ea)),g?ue?(ue.p(S,P),P&3&&X(ue,1)):(ue=Us(S),ue.c(),X(ue,1),ue.m(e,k)):ue&&(ct(),x(ue,1,1,()=>{ue=null}),_t()),P&3&&(C=xt(S[1].ui.t,S[0].pr&&(S[0].pr.startsWith("NO")||S[0].pr.startsWith("10YNO")||S[0].pr.startsWith("10Y1001A1001A4")))),C?fe?(fe.p(S,P),P&3&&X(fe,1)):(fe=zs(S),fe.c(),X(fe,1),fe.m(e,I)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),P&3&&(R=xt(S[1].ui.l,S[0].hm==1)),R?le?(le.p(S,P),P&3&&X(le,1)):(le=js(S),le.c(),X(le,1),le.m(e,E)):le&&(ct(),x(le,1,1,()=>{le=null}),_t()),P&3&&(O=xt(S[1].ui.p,S[0].p&&!Number.isNaN(S[0].p))),O?de?(de.p(S,P),P&3&&X(de,1)):(de=Hs(S),de.c(),X(de,1),de.m(e,L)):de&&(ct(),x(de,1,1,()=>{de=null}),_t()),P&7&&(j=((F=S[2])==null?void 0:F.importExportPriceDifferent)&&(S[0].om||S[0].e>0)&&xt(S[1].ui.p,S[0].pe&&!Number.isNaN(S[0].pe))),j?oe?(oe.p(S,P),P&7&&X(oe,1)):(oe=Ws(S),oe.c(),X(oe,1),oe.m(e,K)):oe&&(ct(),x(oe,1,1,()=>{oe=null}),_t()),P&18&&(U=xt(S[1].ui.d,S[4])),U?me?(me.p(S,P),P&18&&X(me,1)):(me=Vs(S),me.c(),X(me,1),me.m(e,q)):me&&(ct(),x(me,1,1,()=>{me=null}),_t()),P&34&&(y=xt(S[1].ui.m,S[5])),y?se?(se.p(S,P),P&34&&X(se,1)):(se=Gs(S),se.c(),X(se,1),se.m(e,Z)):se&&(ct(),x(se,1,1,()=>{se=null}),_t()),P&67&&(G=xt(S[1].ui.s,S[0].t&&S[0].t!=-127&&S[6].c>1)),G?pe?(pe.p(S,P),P&67&&X(pe,1)):(pe=Ks(S),pe.c(),X(pe,1),pe.m(e,null)):pe&&(ct(),x(pe,1,1,()=>{pe=null}),_t())},i(S){Y||(X(V),X(B),X(H),X(ne),X(ee),X(Q),X(ie),X(ue),X(fe),X(le),X(de),X(oe),X(me),X(se),X(pe),Y=!0)},o(S){x(V),x(B),x(H),x(ne),x(ee),x(Q),x(ie),x(ue),x(fe),x(le),x(de),x(oe),x(me),x(se),x(pe),Y=!1},d(S){S&&N(e),V&&V.d(),B&&B.d(),H&&H.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),ue&&ue.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),me&&me.d(),se&&se.d(),pe&&pe.d()}}}function d1(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{importPrices:o={}}=e,{exportPrices:a={}}=e,{dayPlot:u={}}=e,{monthPlot:f={}}=e,{temperatures:c={}}=e,{translations:m={}}=e,{tariffData:_={}}=e,v,b,d,h,g,k;return t.$$set=C=>{"data"in C&&l(0,n=C.data),"sysinfo"in C&&l(1,i=C.sysinfo),"importPrices"in C&&l(2,o=C.importPrices),"exportPrices"in C&&l(3,a=C.exportPrices),"dayPlot"in C&&l(4,u=C.dayPlot),"monthPlot"in C&&l(5,f=C.monthPlot),"temperatures"in C&&l(6,c=C.temperatures),"translations"in C&&l(7,m=C.translations),"tariffData"in C&&l(8,_=C.tariffData)},t.$$.update=()=>{var C,I,R,E,O,L,j,K,U,q,y,Z,G,Y,V;t.$$.dirty&3585&&(l(12,v=pl((n==null?void 0:n.ic)*1e3,"Wh")),l(13,b=pl((n==null?void 0:n.ec)*1e3,"Wh")),((C=n==null?void 0:n.l1)==null?void 0:C.u)==0&&((I=n==null?void 0:n.l2)==null?void 0:I.u)==0&&((R=n==null?void 0:n.l3)==null?void 0:R.u)==0?l(9,h=l(10,g=l(11,k=l(14,d=!0)))):(l(9,h=((E=n==null?void 0:n.l1)==null?void 0:E.u)>0||((O=n==null?void 0:n.l1)==null?void 0:O.i)>0||((L=n==null?void 0:n.l1)==null?void 0:L.p)>0||((j=n==null?void 0:n.l1)==null?void 0:j.q)>0),l(10,g=((K=n==null?void 0:n.l2)==null?void 0:K.u)>0||((U=n==null?void 0:n.l2)==null?void 0:U.i)>0||((q=n==null?void 0:n.l2)==null?void 0:q.p)>0||((y=n==null?void 0:n.l2)==null?void 0:y.q)>0),l(11,k=((Z=n==null?void 0:n.l3)==null?void 0:Z.u)>0||((G=n==null?void 0:n.l3)==null?void 0:G.i)>0||((Y=n==null?void 0:n.l3)==null?void 0:Y.p)>0||((V=n==null?void 0:n.l3)==null?void 0:V.q)>0),l(14,d=h&&g&&k)))},[n,i,o,a,u,f,c,m,_,h,g,k,v,b,d]}class h1 extends Et{constructor(e){super(),It(this,e,d1,p1,Ct,{data:0,sysinfo:1,importPrices:2,exportPrices:3,dayPlot:4,monthPlot:5,temperatures:6,translations:7,tariffData:8})}}let xi={};const Jn=ul(xi);async function v1(){xi=await(await fetch("configuration.json")).json(),Jn.set(xi)}let eo={};const Jr=ul(eo);async function b1(){eo=await(await fetch("priceconfig.json")).json(),Jr.set(eo)}function Ys(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Qs(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=w(),n=p("option"),n.textContent="UART2",e.__value=3,z(e,e.__value),n.__value=113,z(n,n.__value)},m(i,o){T(i,e,o),T(i,l,o),T(i,n,o)},d(i){i&&(N(e),N(l),N(n))}}}function Xs(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],z(e,e.__value)},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function Zs(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xs(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),T(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function g1(t){let e,l,n,i,o=t[0]=="esp8266"&&Qs(),a=ft({length:t[1]+1}),u=[];for(let f=0;f{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class to extends Et{constructor(e){super(),It(this,e,k1,g1,Ct,{chip:0})}}function Js(t){let e,l,n=t[1]&&$s(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){T(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=$s(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function $s(t){let e,l;return{c(){e=p("div"),l=M(t[1]),r(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){T(n,e,i),s(e,l)},p(n,i){i&2&&D(l,n[1])},d(n){n&&N(e)}}}function w1(t){let e,l=t[0]&&Js(t);return{c(){l&&l.c(),e=Wt()},m(n,i){l&&l.m(n,i),T(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Js(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ze,o:ze,d(n){n&&N(e),l&&l.d(n)}}}function C1(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class dl extends Et{constructor(e){super(),It(this,e,C1,w1,Ct,{active:0,message:1})}}function xs(t,e,l){const n=t.slice();return n[1]=e[l],n}function ea(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=M("Europe/"),i=M(n),e.__value="Europe/"+t[1],z(e,e.__value)},m(o,a){T(o,e,a),s(e,l),s(e,i)},p:ze,d(o){o&&N(e)}}}function P1(t){let e,l,n,i=ft(t[0]),o=[];for(let a=0;a>1&1,A=0;A0;P--)A[P]=A[P]?A[P-1]^E.EXPONENT[j._modN(E.LOG[A[P]]+S)]:A[P-1];A[0]=E.EXPONENT[j._modN(E.LOG[A[0]]+S)]}for(S=0;S<=F;S++)A[S]=E.LOG[A[S]]},_checkBadness:function(){var S,P,F,A,W,te=0,re=this._badness,be=this.buffer,ke=this.width;for(W=0;Wke*ke;)ge-=ke*ke,ve++;for(te+=ve*j.N4,A=0;A=re-2&&(S=re-2,W>9&&S--);var be=S;if(W>9){for(te[be+2]=0,te[be+3]=0;be--;)P=te[be],te[be+3]|=255&P<<4,te[be+2]=P>>4;te[2]|=255&S<<4,te[1]=S>>4,te[0]=64|S>>12}else{for(te[be+1]=0,te[be+2]=0;be--;)P=te[be],te[be+2]|=255&P<<4,te[be+1]=P>>4;te[1]|=255&S<<4,te[0]=64|S>>4}for(be=S+3-(W<10);be=5&&(F+=j.N1+A[P]-5);for(P=3;PS||A[P-3]*3>=A[P]*4||A[P+3]*3>=A[P]*4)&&(F+=j.N3);return F},_finish:function(){this._stringBuffer=this.buffer.slice();var S,P,F=0,A=3e4;for(P=0;P<8&&(this._applyMask(P),S=this._checkBadness(),S>=1)A&1&&(W[te-1-P+te*8]=1,P<6?W[8+te*P]=1:W[8+te*(P+1)]=1);for(P=0;P<7;P++,A>>=1)A&1&&(W[8+te*(te-7+P)]=1,P?W[6-P+te*8]=1:W[7+te*8]=1)},_interleaveBlocks:function(){var S,P,F=this._dataBlock,A=this._ecc,W=this._eccBlock,te=0,re=this._calculateMaxLength(),be=this._neccBlock1,ke=this._neccBlock2,J=this._stringBuffer;for(S=0;S1)for(S=k.BLOCK[A],F=W-7;;){for(P=W-7;P>S-3&&(this._addAlignment(P,F),!(P6)for(S=L.BLOCK[te-7],P=17,F=0;F<6;F++)for(A=0;A<3;A++,P--)1&(P>11?te>>P-12:S>>P)?(W[5-F+re*(2-A+re-11)]=1,W[2-A+re-11+re*(5-F)]=1):(this._setMask(5-F,2-A+re-11),this._setMask(2-A+re-11,5-F))},_isMasked:function(S,P){var F=j._getMaskBit(S,P);return this._mask[F]===1},_pack:function(){var S,P,F,A=1,W=1,te=this.width,re=te-1,be=te-1,ke=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(P=0;PP&&(F=S,S=P,P=F),F=P,F+=P*P,F>>=1,F+=S,F},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),K=j,U=b.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),q=U,y=_.extend(function(S,P,F,A){this.name=S,this.modifiable=!!P,this.defaultValue=F,this._valueTransformer=A},{transform:function(S){var P=this._valueTransformer;return typeof P=="function"?P(S,this):S}}),Z=y,G=_.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,P){return Object.prototype.hasOwnProperty.call(S,P)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),Y=G,V=_.extend(function(S){this.options={},S.forEach(function(P){this.options[P.name]=P},this)},{exists:function(S){return this.options[S]!=null},get:function(S,P){return V._get(this.options[S],P)},getAll:function(S){var P,F=this.options,A={};for(P in F)Y.hasOwn(F,P)&&(A[P]=V._get(F[P],S));return A},init:function(S,P,F){typeof F!="function"&&(F=Y.noop);var A,W;for(A in this.options)Y.hasOwn(this.options,A)&&(W=this.options[A],V._set(W,W.defaultValue,P),V._createAccessor(W,P,F));this._setAll(S,P,!0)},set:function(S,P,F){return this._set(S,P,F)},setAll:function(S,P){return this._setAll(S,P)},_set:function(S,P,F,A){var W=this.options[S];if(!W)throw new Error("Invalid option: "+S);if(!W.modifiable&&!A)throw new Error("Option cannot be modified: "+S);return V._set(W,P,F)},_setAll:function(S,P,F){if(!S)return!1;var A,W=!1;for(A in S)Y.hasOwn(S,A)&&this._set(A,S[A],P,F)&&(W=!0);return W}},{_createAccessor:function(S,P,F){var A={get:function(){return V._get(S,P)}};S.modifiable&&(A.set=function(W){V._set(S,W,P)&&F(W,S)}),Object.defineProperty(P,S.name,A)},_get:function(S,P){return P["_"+S.name]},_set:function(S,P,F){var A="_"+S.name,W=F[A],te=S.transform(P??S.defaultValue);return F[A]=te,te!==W}}),B=V,H=_.extend(function(){this._services={}},{getService:function(S){var P=this._services[S];if(!P)throw new Error("Service is not being managed with name: "+S);return P},setService:function(S,P){if(this._services[S])throw new Error("Service is already managed with name: "+S);P&&(this._services[S]=P)}}),ne=H,ee=new B([new Z("background",!0,"white"),new Z("backgroundAlpha",!0,1,Y.abs),new Z("element"),new Z("foreground",!0,"black"),new Z("foregroundAlpha",!0,1,Y.abs),new Z("level",!0,"L",Y.toUpperCase),new Z("mime",!0,"image/png"),new Z("padding",!0,null,Y.abs),new Z("size",!0,100,Y.abs),new Z("value",!0,"")]),Q=new ne,ie=_.extend(function(S){ee.init(S,this,this.update.bind(this));var P=ee.get("element",this),F=Q.getService("element"),A=P&&F.isCanvas(P)?P:F.createCanvas(),W=P&&F.isImage(P)?P:F.createImage();this._canvasRenderer=new h(this,A,!0),this._imageRenderer=new q(this,W,W===P),this.update()},{get:function(){return ee.getAll(this)},set:function(S){ee.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new K({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){Q.setService(S.getName(),S)}});Object.defineProperties(ie.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ue=ie,fe=ue,le=_.extend({getName:function(){}}),de=le,oe=de.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),me=oe,se=me.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),pe=se;fe.use(new pe);var we=fe;return we})})(tu);var E1=tu.exports;const N1=eu(E1);function T1(t){let e,l;return{c(){e=p("img"),vi(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){T(n,e,i)},p(n,[i]){i&4&&!vi(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:ze,o:ze,d(n){n&&N(e)}}}function q1(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:o="#000"}=e,{size:a="200"}=e,{value:u=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function v(){_.set({background:i,foreground:o,level:n,padding:f,size:a,value:u}),l(2,m=_.toDataURL("image/jpeg"))}function b(){return m}return ao(()=>{l(9,_=new N1),u&&v()}),t.$$set=d=>{"errorCorrection"in d&&l(3,n=d.errorCorrection),"background"in d&&l(4,i=d.background),"color"in d&&l(5,o=d.color),"size"in d&&l(6,a=d.size),"value"in d&&l(0,u=d.value),"padding"in d&&l(7,f=d.padding),"className"in d&&l(1,c=d.className)},t.$$.update=()=>{t.$$.dirty&513&&u&&_&&v()},[u,c,m,n,i,o,a,f,b,_]}class D1 extends Et{constructor(e){super(),It(this,e,q1,T1,Ct,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function ta(t,e,l){const n=t.slice();return n[127]=e[l],n}function la(t,e,l){const n=t.slice();return n[130]=e[l],n[131]=e,n[132]=l,n}function na(t,e,l){const n=t.slice();return n[133]=e[l],n[134]=e,n[135]=l,n}function ia(t,e,l){const n=t.slice();return n[136]=e[l],n}function A1(t,e,l){const n=t.slice();return n[139]=e[l],n}function R1(t,e,l){const n=t.slice();return n[142]=e[l],n}function O1(t,e,l){const n=t.slice();return n[145]=e[l],n}function oa(t){var rl,Te,$,Re,_l,it,qt,al,ml,vl,fl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl,We,bt;let e,l,n=(((Te=(rl=t[2].conf)==null?void 0:rl.general)==null?void 0:Te.title)??"General")+"",i,o,a,u,f,c,m,_,v,b=(((Re=($=t[2].conf)==null?void 0:$.general)==null?void 0:Re.hostname)??"Hostname")+"",d,h,g,k,C,I,R=(((it=(_l=t[2].conf)==null?void 0:_l.general)==null?void 0:it.timezone)??"Time zone")+"",E,O,L,j,K,U,q,y,Z,G,Y,V=(((al=(qt=t[2].conf)==null?void 0:qt.price)==null?void 0:al.region)??"Price region")+"",B,H,ne,ee,Q,ie,ue,fe,le,de,oe,me,se,pe,we,S,P,F,A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De,Ae,Me,qe,Le,$e=(((vl=(ml=t[2].conf)==null?void 0:ml.price)==null?void 0:vl.resolution)??"Resolution")+"",xe,rt,Pt,dt,ut,ot,ht=(((gl=(fl=t[2].conf)==null?void 0:fl.price)==null?void 0:gl.currency)??"Currency")+"",Rt,Je,Fe,je,tt,Ve,Ge,Qe,_e,ae,Ee,Ke,Tt=(((Ll=(kl=t[2].conf)==null?void 0:kl.price)==null?void 0:Ll.enabled)??"Enabled")+"",vt,Xe,Nt,at,mt=(((Bl=(yl=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:yl.security)==null?void 0:Bl.title)??"Security")+"",lt,yt,el,pt,nt,Qt=(((jl=(zl=(Ul=t[2].conf)==null?void 0:Ul.general)==null?void 0:zl.security)==null?void 0:jl.none)??"None")+"",Jt,Ot,Zt=(((Vl=(Wl=(Hl=t[2].conf)==null?void 0:Hl.general)==null?void 0:Wl.security)==null?void 0:Vl.conf)??"Conf")+"",$t,Vt,Xt=(((Yl=(Kl=(Gl=t[2].conf)==null?void 0:Gl.general)==null?void 0:Kl.security)==null?void 0:Yl.all)??"All")+"",ll,Ye,st,St,Lt=(((bt=(We=t[2].conf)==null?void 0:We.general)==null?void 0:bt.context)??"Context")+"",kt,gt,zt,et,Ft,he,Oe,He;K=new M1({});let Gt=!t[6].p.t&&sa(),Kt=ft([15,60]),wt=[];for(let Ue=0;Ue<2;Ue+=1)wt[Ue]=L1(O1(t,Kt,Ue));let cl=ft(["NOK","SEK","DKK","EUR","CHF"]),ol=[];for(let Ue=0;Ue<5;Ue+=1)ol[Ue]=F1(R1(t,cl,Ue));Ge=new wl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[y1]},$$scope:{ctx:t}}});let jt=t[6].p.e&&t[0].chip!="esp8266"&&t[6].p.t&&aa(t),Ht=t[6].g.s>0&&fa(t);return{c(){var Ue,Dt;e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("div"),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),C=w(),I=p("div"),E=M(R),O=p("br"),L=w(),j=p("select"),Se(K.$$.fragment),U=w(),q=p("input"),y=w(),Z=p("div"),G=p("div"),Y=p("div"),B=M(V),H=p("br"),ne=w(),ee=p("select"),Q=p("optgroup"),Gt&&Gt.c(),ie=p("option"),ie.textContent="NO1",ue=p("option"),ue.textContent="NO2",fe=p("option"),fe.textContent="NO3",le=p("option"),le.textContent="NO4",de=p("option"),de.textContent="NO5",oe=p("optgroup"),me=p("option"),me.textContent="SE1",se=p("option"),se.textContent="SE2",pe=p("option"),pe.textContent="SE3",we=p("option"),we.textContent="SE4",S=p("optgroup"),P=p("option"),P.textContent="DK1",F=p("option"),F.textContent="DK2",A=p("option"),A.textContent="Austria",W=p("option"),W.textContent="Belgium",te=p("option"),te.textContent="Czech Republic",re=p("option"),re.textContent="Estonia",be=p("option"),be.textContent="Finland",ke=p("option"),ke.textContent="France",J=p("option"),J.textContent="Germany",ve=p("option"),ve.textContent="Great Britain",ge=p("option"),ge.textContent="Latvia",Ne=p("option"),Ne.textContent="Lithuania",Ie=p("option"),Ie.textContent="Netherland",De=p("option"),De.textContent="Poland",Ae=p("option"),Ae.textContent="Slovenia",Me=p("option"),Me.textContent="Switzerland",qe=w(),Le=p("div"),xe=M($e),rt=p("br"),Pt=w(),dt=p("select");for(let il=0;il<2;il+=1)wt[il].c();ut=w(),ot=p("div"),Rt=M(ht),Je=p("br"),Fe=w(),je=p("select");for(let il=0;il<5;il+=1)ol[il].c();tt=w(),Ve=p("div"),Se(Ge.$$.fragment),Qe=w(),_e=p("div"),ae=p("label"),Ee=p("input"),Ke=w(),vt=M(Tt),Xe=w(),jt&&jt.c(),Nt=w(),at=p("div"),lt=M(mt),yt=p("br"),el=w(),pt=p("select"),nt=p("option"),Jt=M(Qt),Ot=p("option"),$t=M(Zt),Vt=p("option"),ll=M(Xt),Ye=w(),Ht&&Ht.c(),st=w(),St=p("div"),kt=M(Lt),gt=p("br"),zt=w(),et=p("input"),r(l,"class","text-sm"),r(a,"href",bl("general")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(k,"name","gh"),r(k,"type","text"),r(k,"class","in-f w-full"),r(k,"pattern",Pi),r(j,"name","gt"),r(j,"class","in-l w-full"),t[6].g.t===void 0&&Mt(()=>t[26].call(j)),r(_,"class","flex"),r(m,"class","my-1"),r(q,"type","hidden"),r(q,"name","p"),q.value="true",ie.__value="10YNO-1--------2",z(ie,ie.__value),ue.__value="10YNO-2--------T",z(ue,ue.__value),fe.__value="10YNO-3--------J",z(fe,fe.__value),le.__value="10YNO-4--------9",z(le,le.__value),de.__value="10Y1001A1001A48H",z(de,de.__value),r(Q,"label","Norway"),me.__value="10Y1001A1001A44P",z(me,me.__value),se.__value="10Y1001A1001A45N",z(se,se.__value),pe.__value="10Y1001A1001A46L",z(pe,pe.__value),we.__value="10Y1001A1001A47J",z(we,we.__value),r(oe,"label","Sweden"),P.__value="10YDK-1--------W",z(P,P.__value),F.__value="10YDK-2--------M",z(F,F.__value),r(S,"label","Denmark"),A.__value="10YAT-APG------L",z(A,A.__value),W.__value="10YBE----------2",z(W,W.__value),te.__value="10YCZ-CEPS-----N",z(te,te.__value),re.__value="10Y1001A1001A39I",z(re,re.__value),be.__value="10YFI-1--------U",z(be,be.__value),ke.__value="10YFR-RTE------C",z(ke,ke.__value),J.__value="10Y1001A1001A83F",z(J,J.__value),ve.__value="10YGB----------A",z(ve,ve.__value),ge.__value="10YLV-1001A00074",z(ge,ge.__value),Ne.__value="10YLT-1001A0008Q",z(Ne,Ne.__value),Ie.__value="10YNL----------L",z(Ie,Ie.__value),De.__value="10YPL-AREA-----S",z(De,De.__value),Ae.__value="10YSI-ELES-----O",z(Ae,Ae.__value),Me.__value="10YCH-SWISSGRIDZ",z(Me,Me.__value),r(ee,"name","pr"),r(ee,"class","in-f w-full"),t[6].p.r===void 0&&Mt(()=>t[27].call(ee)),r(Y,"class","w-full"),r(dt,"name","pm"),r(dt,"class","in-m"),t[6].p.m===void 0&&Mt(()=>t[28].call(dt)),r(je,"name","pc"),r(je,"class","in-l"),t[6].p.c===void 0&&Mt(()=>t[29].call(je)),r(G,"class","flex"),r(Z,"class","my-1"),r(Ve,"class","my-1"),r(Ee,"type","checkbox"),r(Ee,"name","pe"),Ee.__value="true",z(Ee,Ee.__value),r(Ee,"class","rounded mb-1"),r(_e,"class","my-1"),nt.__value=0,z(nt,nt.__value),Ot.__value=1,z(Ot,Ot.__value),Vt.__value=2,z(Vt,Vt.__value),r(pt,"name","gs"),r(pt,"class","in-s"),t[6].g.s===void 0&&Mt(()=>t[32].call(pt)),r(at,"class","my-1"),r(et,"name","gc"),r(et,"type","text"),r(et,"pattern",Pi),r(et,"placeholder",Ft=((Dt=(Ue=t[2].conf)==null?void 0:Ue.general)==null?void 0:Dt.context_placeholder)??"/"),r(et,"class","in-s"),r(et,"maxlength","36"),r(St,"class","my-1"),r(e,"class","cnt")},m(Ue,Dt){T(Ue,e,Dt),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),s(v,d),s(v,h),s(v,g),s(v,k),z(k,t[6].g.h),s(_,C),s(_,I),s(I,E),s(I,O),s(I,L),s(I,j),Ce(K,j,null),Be(j,t[6].g.t,!0),s(e,U),s(e,q),s(e,y),s(e,Z),s(Z,G),s(G,Y),s(Y,B),s(Y,H),s(Y,ne),s(Y,ee),s(ee,Q),Gt&&Gt.m(Q,null),s(Q,ie),s(Q,ue),s(Q,fe),s(Q,le),s(Q,de),s(ee,oe),s(oe,me),s(oe,se),s(oe,pe),s(oe,we),s(ee,S),s(S,P),s(S,F),s(ee,A),s(ee,W),s(ee,te),s(ee,re),s(ee,be),s(ee,ke),s(ee,J),s(ee,ve),s(ee,ge),s(ee,Ne),s(ee,Ie),s(ee,De),s(ee,Ae),s(ee,Me),Be(ee,t[6].p.r,!0),s(G,qe),s(G,Le),s(Le,xe),s(Le,rt),s(Le,Pt),s(Le,dt);for(let il=0;il<2;il+=1)wt[il]&&wt[il].m(dt,null);Be(dt,t[6].p.m,!0),s(G,ut),s(G,ot),s(ot,Rt),s(ot,Je),s(ot,Fe),s(ot,je);for(let il=0;il<5;il+=1)ol[il]&&ol[il].m(je,null);Be(je,t[6].p.c,!0),s(e,tt),s(e,Ve),Ce(Ge,Ve,null),s(e,Qe),s(e,_e),s(_e,ae),s(ae,Ee),Ee.checked=t[6].p.e,s(ae,Ke),s(ae,vt),s(_e,Xe),jt&&jt.m(_e,null),s(e,Nt),s(e,at),s(at,lt),s(at,yt),s(at,el),s(at,pt),s(pt,nt),s(nt,Jt),s(pt,Ot),s(Ot,$t),s(pt,Vt),s(Vt,ll),Be(pt,t[6].g.s,!0),s(e,Ye),Ht&&Ht.m(e,null),s(e,st),s(e,St),s(St,kt),s(St,gt),s(St,zt),s(St,et),z(et,t[6].g.c),he=!0,Oe||(He=[ce(k,"input",t[25]),ce(j,"change",t[26]),ce(ee,"change",t[27]),ce(ee,"change",t[22]),ce(dt,"change",t[28]),ce(je,"change",t[29]),ce(Ee,"change",t[30]),ce(pt,"change",t[32]),ce(et,"input",t[35])],Oe=!0)},p(Ue,Dt){var Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Tn,qn,Dn,An,Rn,On,Ln,Fn,yn,Bn,Un,zn,jn,Hn,Wn,Vn,Gn,Kn,Yn,Qn,go;(!he||Dt[0]&4)&&n!==(n=(((Xl=(Ql=Ue[2].conf)==null?void 0:Ql.general)==null?void 0:Xl.title)??"General")+"")&&D(i,n),(!he||Dt[0]&4)&&b!==(b=(((Jl=(Zl=Ue[2].conf)==null?void 0:Zl.general)==null?void 0:Jl.hostname)??"Hostname")+"")&&D(d,b),Dt[0]&64&&k.value!==Ue[6].g.h&&z(k,Ue[6].g.h),(!he||Dt[0]&4)&&R!==(R=(((xl=($l=Ue[2].conf)==null?void 0:$l.general)==null?void 0:xl.timezone)??"Time zone")+"")&&D(E,R),Dt[0]&64&&Be(j,Ue[6].g.t),(!he||Dt[0]&4)&&V!==(V=(((tn=(en=Ue[2].conf)==null?void 0:en.price)==null?void 0:tn.region)??"Price region")+"")&&D(B,V),Ue[6].p.t?Gt&&(Gt.d(1),Gt=null):Gt||(Gt=sa(),Gt.c(),Gt.m(Q,ie)),Dt[0]&64&&Be(ee,Ue[6].p.r),(!he||Dt[0]&4)&&$e!==($e=(((Tn=(Nn=Ue[2].conf)==null?void 0:Nn.price)==null?void 0:Tn.resolution)??"Resolution")+"")&&D(xe,$e),Dt[0]&64&&Be(dt,Ue[6].p.m),(!he||Dt[0]&4)&&ht!==(ht=(((Dn=(qn=Ue[2].conf)==null?void 0:qn.price)==null?void 0:Dn.currency)??"Currency")+"")&&D(Rt,ht),Dt[0]&64&&Be(je,Ue[6].p.c);const il={};Dt[0]&4|Dt[4]&16777216&&(il.$$scope={dirty:Dt,ctx:Ue}),Ge.$set(il),Dt[0]&64&&(Ee.checked=Ue[6].p.e),(!he||Dt[0]&4)&&Tt!==(Tt=(((Rn=(An=Ue[2].conf)==null?void 0:An.price)==null?void 0:Rn.enabled)??"Enabled")+"")&&D(vt,Tt),Ue[6].p.e&&Ue[0].chip!="esp8266"&&Ue[6].p.t?jt?jt.p(Ue,Dt):(jt=aa(Ue),jt.c(),jt.m(_e,null)):jt&&(jt.d(1),jt=null),(!he||Dt[0]&4)&&mt!==(mt=(((Fn=(Ln=(On=Ue[2].conf)==null?void 0:On.general)==null?void 0:Ln.security)==null?void 0:Fn.title)??"Security")+"")&&D(lt,mt),(!he||Dt[0]&4)&&Qt!==(Qt=(((Un=(Bn=(yn=Ue[2].conf)==null?void 0:yn.general)==null?void 0:Bn.security)==null?void 0:Un.none)??"None")+"")&&D(Jt,Qt),(!he||Dt[0]&4)&&Zt!==(Zt=(((Hn=(jn=(zn=Ue[2].conf)==null?void 0:zn.general)==null?void 0:jn.security)==null?void 0:Hn.conf)??"Conf")+"")&&D($t,Zt),(!he||Dt[0]&4)&&Xt!==(Xt=(((Gn=(Vn=(Wn=Ue[2].conf)==null?void 0:Wn.general)==null?void 0:Vn.security)==null?void 0:Gn.all)??"All")+"")&&D(ll,Xt),Dt[0]&64&&Be(pt,Ue[6].g.s),Ue[6].g.s>0?Ht?Ht.p(Ue,Dt):(Ht=fa(Ue),Ht.c(),Ht.m(e,st)):Ht&&(Ht.d(1),Ht=null),(!he||Dt[0]&4)&&Lt!==(Lt=(((Yn=(Kn=Ue[2].conf)==null?void 0:Kn.general)==null?void 0:Yn.context)??"Context")+"")&&D(kt,Lt),(!he||Dt[0]&4&&Ft!==(Ft=((go=(Qn=Ue[2].conf)==null?void 0:Qn.general)==null?void 0:go.context_placeholder)??"/"))&&r(et,"placeholder",Ft),Dt[0]&64&&et.value!==Ue[6].g.c&&z(et,Ue[6].g.c)},i(Ue){he||(X(K.$$.fragment,Ue),X(Ge.$$.fragment,Ue),he=!0)},o(Ue){x(K.$$.fragment,Ue),x(Ge.$$.fragment,Ue),he=!1},d(Ue){Ue&&N(e),Pe(K),Gt&&Gt.d(),nl(wt,Ue),nl(ol,Ue),Pe(Ge),jt&&jt.d(),Ht&&Ht.d(),Oe=!1,Ut(He)}}}function sa(t){let e,l,n,i,o;return{c(){e=p("option"),e.textContent="NO1 w/support",l=p("option"),l.textContent="NO2 w/support",n=p("option"),n.textContent="NO3 w/support",i=p("option"),i.textContent="NO4 w/support",o=p("option"),o.textContent="NO5 w/support",e.__value="NO1S",z(e,e.__value),l.__value="NO2S",z(l,l.__value),n.__value="NO3S",z(n,n.__value),i.__value="NO4S",z(i,i.__value),o.__value="NO5S",z(o,o.__value)},m(a,u){T(a,e,u),T(a,l,u),T(a,n,u),T(a,i,u),T(a,o,u)},d(a){a&&(N(e),N(l),N(n),N(i),N(o))}}}function L1(t){let e;return{c(){e=p("option"),e.textContent=`${t[145]}M`,e.__value=t[145],z(e,e.__value)},m(l,n){T(l,e,n)},p:ze,d(l){l&&N(e)}}}function F1(t){let e;return{c(){e=p("option"),e.textContent=`${t[142]}`,e.__value=t[142],z(e,e.__value)},m(l,n){T(l,e,n)},p:ze,d(l){l&&N(e)}}}function y1(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=M(e)},m(o,a){T(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.price)==null?void 0:f.conf)??"Configure")+"")&&D(l,e)},d(o){o&&N(l)}}}function aa(t){let e,l,n,i,o,a;return{c(){e=p("input"),l=w(),n=p("br"),i=p("input"),r(e,"name","pt"),r(e,"type","hidden"),r(i,"type","text"),r(i,"class","in-s"),r(i,"placeholder","ENTSO-E API key disabled, ref issue #1030"),i.disabled=!0},m(u,f){T(u,e,f),z(e,t[6].p.t),T(u,l,f),T(u,n,f),T(u,i,f),o||(a=ce(e,"input",t[31]),o=!0)},p(u,f){f[0]&64&&z(e,u[6].p.t)},d(u){u&&(N(e),N(l),N(n),N(i)),o=!1,a()}}}function fa(t){var g,k,C,I,R,E;let e,l=(((C=(k=(g=t[2].conf)==null?void 0:g.general)==null?void 0:k.security)==null?void 0:C.username)??"Username")+"",n,i,o,a,u,f,c=(((E=(R=(I=t[2].conf)==null?void 0:I.general)==null?void 0:R.security)==null?void 0:E.password)??"Password")+"",m,_,v,b,d,h;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),u=w(),f=p("div"),m=M(c),_=p("br"),v=w(),b=p("input"),r(a,"name","gu"),r(a,"type","text"),r(a,"class","in-s"),r(a,"maxlength","36"),r(a,"pattern",Ol),r(e,"class","my-1"),r(b,"name","gp"),r(b,"type","password"),r(b,"class","in-s"),r(b,"maxlength","36"),r(b,"pattern",Ol),r(f,"class","my-1")},m(O,L){T(O,e,L),s(e,n),s(e,i),s(e,o),s(e,a),z(a,t[6].g.u),T(O,u,L),T(O,f,L),s(f,m),s(f,_),s(f,v),s(f,b),z(b,t[6].g.p),d||(h=[ce(a,"input",t[33]),ce(b,"input",t[34])],d=!0)},p(O,L){var j,K,U,q,y,Z;L[0]&4&&l!==(l=(((U=(K=(j=O[2].conf)==null?void 0:j.general)==null?void 0:K.security)==null?void 0:U.username)??"Username")+"")&&D(n,l),L[0]&64&&a.value!==O[6].g.u&&z(a,O[6].g.u),L[0]&4&&c!==(c=(((Z=(y=(q=O[2].conf)==null?void 0:q.general)==null?void 0:y.security)==null?void 0:Z.password)??"Password")+"")&&D(m,c),L[0]&64&&b.value!==O[6].g.p&&z(b,O[6].g.p)},d(O){O&&(N(e),N(u),N(f)),d=!1,Ut(h)}}}function ra(t){var _e,ae,Ee,Ke,Tt,vt,Xe,Nt,at,mt,lt,yt,el,pt,nt,Qt,Jt,Ot,Zt,$t,Vt,Xt,ll;let e,l,n=(((ae=(_e=t[2].conf)==null?void 0:_e.meter)==null?void 0:ae.title)??"Meter")+"",i,o,a,u,f,c,m,_,v,b=(((Tt=(Ke=(Ee=t[2].conf)==null?void 0:Ee.meter)==null?void 0:Ke.comm)==null?void 0:Tt.title)??"Communication")+"",d,h,g,k,C,I=(((Nt=(Xe=(vt=t[2].conf)==null?void 0:vt.meter)==null?void 0:Xe.comm)==null?void 0:Nt.passive)??"Passive")+"",R,E,O=(((lt=(mt=(at=t[2].conf)==null?void 0:at.meter)==null?void 0:mt.comm)==null?void 0:lt.pulse)??"Pulse")+"",L,j=(el=(yt=t[0])==null?void 0:yt.features)==null?void 0:el.includes("kmp"),K,U,q,y=(((pt=t[2].common)==null?void 0:pt.voltage)??"Voltage")+"",Z,G,Y,V,B,H,ne,ee,Q,ie=(((Qt=(nt=t[2].conf)==null?void 0:nt.meter)==null?void 0:Qt.fuse)??"Main fuse")+"",ue,fe,le,de,oe,me,se,pe,we,S=(((Ot=(Jt=t[2].conf)==null?void 0:Jt.meter)==null?void 0:Ot.prod)??"Production")+"",P,F,A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De,Ae=((($t=(Zt=t[2].conf)==null?void 0:Zt.meter)==null?void 0:$t.encrypted)??"Encrypted")+"",Me,qe,Le,$e,xe,rt,Pt,dt=(((ll=(Xt=(Vt=t[2].conf)==null?void 0:Vt.meter)==null?void 0:Xt.multipliers)==null?void 0:ll.title)??"Multipliers")+"",ut,ot,ht,Rt,Je=j&&ua();function Fe(Ye,st){return Ye[6].m.a===2?U1:B1}let je=Fe(t),tt=je(t),Ve=t[6].m.e.e&&ca(t),Ge=t[6].m.e.e&&_a(t),Qe=t[6].m.m.e&&ma(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("input"),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("select"),C=p("option"),R=M(I),E=p("option"),L=M(O),Je&&Je.c(),K=w(),tt.c(),U=w(),q=p("div"),Z=M(y),G=p("br"),Y=w(),V=p("select"),B=p("option"),B.textContent="400V (TN)",H=p("option"),H.textContent="230V (IT/TT)",ne=w(),ee=p("div"),Q=p("div"),ue=M(ie),fe=p("br"),le=w(),de=p("label"),oe=p("input"),me=w(),se=p("span"),se.textContent="A",pe=w(),we=p("div"),P=M(S),F=p("br"),A=w(),W=p("label"),te=p("input"),re=w(),be=p("span"),be.textContent="kWp",ke=w(),J=p("div"),J.innerHTML="",ve=w(),ge=p("div"),Ne=p("label"),Ie=p("input"),De=w(),Me=M(Ae),qe=w(),Ve&&Ve.c(),Le=w(),Ge&&Ge.c(),$e=w(),xe=p("label"),rt=p("input"),Pt=w(),ut=M(dt),ot=w(),Qe&&Qe.c(),r(l,"class","text-sm"),r(a,"href",bl("meter")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","m"),f.value="true",r(m,"type","hidden"),r(m,"name","mo"),m.value="1",C.__value=0,z(C,C.__value),E.__value=2,z(E,E.__value),r(k,"name","ma"),r(k,"class","in-s"),t[6].m.a===void 0&&Mt(()=>t[36].call(k)),r(v,"class","my-1"),B.__value=2,z(B,B.__value),H.__value=1,z(H,H.__value),r(V,"name","md"),r(V,"class","in-s"),t[6].m.d===void 0&&Mt(()=>t[42].call(V)),r(q,"class","my-1"),r(oe,"name","mf"),r(oe,"type","number"),r(oe,"min","5"),r(oe,"max","65535"),r(oe,"class","in-f tr w-full"),r(se,"class","in-post"),r(de,"class","flex"),r(Q,"class","mx-1"),r(te,"name","mr"),r(te,"type","number"),r(te,"min","0"),r(te,"max","65535"),r(te,"class","in-f tr w-full"),r(be,"class","in-post"),r(W,"class","flex"),r(we,"class","mx-1"),r(ee,"class","my-1 flex"),r(J,"class","my-1"),r(Ie,"type","checkbox"),r(Ie,"name","me"),Ie.__value="true",z(Ie,Ie.__value),r(Ie,"class","rounded mb-1"),r(ge,"class","my-1"),r(rt,"type","checkbox"),r(rt,"name","mm"),rt.__value="true",z(rt,rt.__value),r(rt,"class","rounded mb-1"),r(e,"class","cnt")},m(Ye,st){T(Ye,e,st),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(e,_),s(e,v),s(v,d),s(v,h),s(v,g),s(v,k),s(k,C),s(C,R),s(k,E),s(E,L),Je&&Je.m(k,null),Be(k,t[6].m.a,!0),s(e,K),tt.m(e,null),s(e,U),s(e,q),s(q,Z),s(q,G),s(q,Y),s(q,V),s(V,B),s(V,H),Be(V,t[6].m.d,!0),s(e,ne),s(e,ee),s(ee,Q),s(Q,ue),s(Q,fe),s(Q,le),s(Q,de),s(de,oe),z(oe,t[6].m.f),s(de,me),s(de,se),s(ee,pe),s(ee,we),s(we,P),s(we,F),s(we,A),s(we,W),s(W,te),z(te,t[6].m.r),s(W,re),s(W,be),s(e,ke),s(e,J),s(e,ve),s(e,ge),s(ge,Ne),s(Ne,Ie),Ie.checked=t[6].m.e.e,s(Ne,De),s(Ne,Me),s(ge,qe),Ve&&Ve.m(ge,null),s(e,Le),Ge&&Ge.m(e,null),s(e,$e),s(e,xe),s(xe,rt),rt.checked=t[6].m.m.e,s(xe,Pt),s(xe,ut),s(e,ot),Qe&&Qe.m(e,null),ht||(Rt=[ce(k,"change",t[36]),ce(V,"change",t[42]),ce(oe,"input",t[43]),ce(te,"input",t[44]),ce(Ie,"change",t[45]),ce(rt,"change",t[48])],ht=!0)},p(Ye,st){var St,Lt,kt,gt,zt,et,Ft,he,Oe,He,Gt,Kt,wt,cl,ol,jt,Ht,rl,Te,$,Re,_l,it;st[0]&4&&n!==(n=(((Lt=(St=Ye[2].conf)==null?void 0:St.meter)==null?void 0:Lt.title)??"Meter")+"")&&D(i,n),st[0]&4&&b!==(b=(((zt=(gt=(kt=Ye[2].conf)==null?void 0:kt.meter)==null?void 0:gt.comm)==null?void 0:zt.title)??"Communication")+"")&&D(d,b),st[0]&4&&I!==(I=(((he=(Ft=(et=Ye[2].conf)==null?void 0:et.meter)==null?void 0:Ft.comm)==null?void 0:he.passive)??"Passive")+"")&&D(R,I),st[0]&4&&O!==(O=(((Gt=(He=(Oe=Ye[2].conf)==null?void 0:Oe.meter)==null?void 0:He.comm)==null?void 0:Gt.pulse)??"Pulse")+"")&&D(L,O),st[0]&1&&(j=(wt=(Kt=Ye[0])==null?void 0:Kt.features)==null?void 0:wt.includes("kmp")),j?Je||(Je=ua(),Je.c(),Je.m(k,null)):Je&&(Je.d(1),Je=null),st[0]&64&&Be(k,Ye[6].m.a),je===(je=Fe(Ye))&&tt?tt.p(Ye,st):(tt.d(1),tt=je(Ye),tt&&(tt.c(),tt.m(e,U))),st[0]&4&&y!==(y=(((cl=Ye[2].common)==null?void 0:cl.voltage)??"Voltage")+"")&&D(Z,y),st[0]&64&&Be(V,Ye[6].m.d),st[0]&4&&ie!==(ie=(((jt=(ol=Ye[2].conf)==null?void 0:ol.meter)==null?void 0:jt.fuse)??"Main fuse")+"")&&D(ue,ie),st[0]&64&&ye(oe.value)!==Ye[6].m.f&&z(oe,Ye[6].m.f),st[0]&4&&S!==(S=(((rl=(Ht=Ye[2].conf)==null?void 0:Ht.meter)==null?void 0:rl.prod)??"Production")+"")&&D(P,S),st[0]&64&&ye(te.value)!==Ye[6].m.r&&z(te,Ye[6].m.r),st[0]&64&&(Ie.checked=Ye[6].m.e.e),st[0]&4&&Ae!==(Ae=((($=(Te=Ye[2].conf)==null?void 0:Te.meter)==null?void 0:$.encrypted)??"Encrypted")+"")&&D(Me,Ae),Ye[6].m.e.e?Ve?Ve.p(Ye,st):(Ve=ca(Ye),Ve.c(),Ve.m(ge,null)):Ve&&(Ve.d(1),Ve=null),Ye[6].m.e.e?Ge?Ge.p(Ye,st):(Ge=_a(Ye),Ge.c(),Ge.m(e,$e)):Ge&&(Ge.d(1),Ge=null),st[0]&64&&(rt.checked=Ye[6].m.m.e),st[0]&4&&dt!==(dt=(((it=(_l=(Re=Ye[2].conf)==null?void 0:Re.meter)==null?void 0:_l.multipliers)==null?void 0:it.title)??"Multipliers")+"")&&D(ut,dt),Ye[6].m.m.e?Qe?Qe.p(Ye,st):(Qe=ma(Ye),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Ye){Ye&&N(e),Je&&Je.d(),tt.d(),Ve&&Ve.d(),Ge&&Ge.d(),Qe&&Qe.d(),ht=!1,Ut(Rt)}}}function ua(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,z(e,e.__value)},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function B1(t){var ue,fe,le,de,oe,me;let e,l,n=(((fe=(ue=t[2].conf)==null?void 0:ue.meter)==null?void 0:fe.buffer)??"Buffer size")+"",i,o,a,u=(((de=(le=t[2].conf)==null?void 0:le.meter)==null?void 0:de.serial)??"Serial conf.")+"",f,c,m,_,v,b=(((me=(oe=t[2].conf)==null?void 0:oe.meter)==null?void 0:me.inverted)??"inverted")+"",d,h,g,k,C,I,R,E,O,L,j,K,U,q,y,Z,G,Y,V,B,H,ne,ee,Q=ft([3,12,24,48,96,192,384,576,1152]),ie=[];for(let se=0;se<9;se+=1)ie[se]=z1(A1(t,Q,se));return{c(){e=p("div"),l=p("span"),i=M(n),o=w(),a=p("span"),f=M(u),c=w(),m=p("label"),_=p("input"),v=w(),d=M(b),h=w(),g=p("div"),k=p("select"),C=p("option"),I=M("Autodetect");for(let se=0;se<9;se+=1)ie[se].c();E=w(),O=p("select"),L=p("option"),j=M("-"),U=p("option"),U.textContent="7N1",q=p("option"),q.textContent="8N1",y=p("option"),y.textContent="8N2",Z=p("option"),Z.textContent="7E1",G=p("option"),G.textContent="8E1",V=w(),B=p("input"),r(l,"class","float-right"),r(_,"name","mi"),_.__value="true",z(_,_.__value),r(_,"type","checkbox"),r(_,"class","rounded mb-1"),r(m,"class","mt-2 ml-3 whitespace-nowrap"),C.__value=0,z(C,C.__value),C.disabled=R=t[6].m.b!=0,r(k,"name","mb"),r(k,"class","in-f tr w-1/2"),t[6].m.b===void 0&&Mt(()=>t[39].call(k)),L.__value=0,z(L,L.__value),L.disabled=K=t[6].m.b!=0,U.__value=2,z(U,U.__value),q.__value=3,z(q,q.__value),y.__value=7,z(y,y.__value),Z.__value=10,z(Z,Z.__value),G.__value=11,z(G,G.__value),r(O,"name","mp"),r(O,"class","in-m"),O.disabled=Y=t[6].m.b==0,t[6].m.p===void 0&&Mt(()=>t[40].call(O)),r(B,"name","ms"),r(B,"type","number"),r(B,"min",64),r(B,"max",H=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),r(B,"step",64),r(B,"class","in-l tr w-1/2"),r(g,"class","flex w-full"),r(e,"class","my-1")},m(se,pe){T(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(e,c),s(e,m),s(m,_),_.checked=t[6].m.i,s(m,v),s(m,d),s(e,h),s(e,g),s(g,k),s(k,C),s(C,I);for(let we=0;we<9;we+=1)ie[we]&&ie[we].m(k,null);Be(k,t[6].m.b,!0),s(g,E),s(g,O),s(O,L),s(L,j),s(O,U),s(O,q),s(O,y),s(O,Z),s(O,G),Be(O,t[6].m.p,!0),s(g,V),s(g,B),z(B,t[6].m.s),ne||(ee=[ce(_,"change",t[38]),ce(k,"change",t[39]),ce(O,"change",t[40]),ce(B,"input",t[41])],ne=!0)},p(se,pe){var we,S,P,F,A,W;pe[0]&4&&n!==(n=(((S=(we=se[2].conf)==null?void 0:we.meter)==null?void 0:S.buffer)??"Buffer size")+"")&&D(i,n),pe[0]&4&&u!==(u=(((F=(P=se[2].conf)==null?void 0:P.meter)==null?void 0:F.serial)??"Serial conf.")+"")&&D(f,u),pe[0]&64&&(_.checked=se[6].m.i),pe[0]&4&&b!==(b=(((W=(A=se[2].conf)==null?void 0:A.meter)==null?void 0:W.inverted)??"inverted")+"")&&D(d,b),pe[0]&64&&R!==(R=se[6].m.b!=0)&&(C.disabled=R),pe[0]&64&&Be(k,se[6].m.b),pe[0]&64&&K!==(K=se[6].m.b!=0)&&(L.disabled=K),pe[0]&64&&Y!==(Y=se[6].m.b==0)&&(O.disabled=Y),pe[0]&64&&Be(O,se[6].m.p),pe[0]&65&&H!==(H=se[0].chip=="esp8266"?se[6].i.h.p==3||se[6].i.h.p==113?512:256:4096)&&r(B,"max",H),pe[0]&64&&ye(B.value)!==se[6].m.s&&z(B,se[6].m.s)},d(se){se&&N(e),nl(ie,se),ne=!1,Ut(ee)}}}function U1(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,o,a,u,f;return{c(){e=p("div"),l=p("span"),i=M(n),o=w(),a=p("input"),r(a,"name","mb"),r(a,"class","in-s tr"),r(a,"type","number"),r(a,"min",1),r(a,"max",3600),r(e,"class","my-1")},m(_,v){T(_,e,v),s(e,l),s(l,i),s(e,o),s(e,a),z(a,t[6].m.b),u||(f=ce(a,"input",t[37]),u=!0)},p(_,v){var b,d;v[0]&4&&n!==(n=(((d=(b=_[2].conf)==null?void 0:b.meter)==null?void 0:d.pulses)??"Pulses per kWh")+"")&&D(i,n),v[0]&64&&ye(a.value)!==_[6].m.b&&z(a,_[6].m.b)},d(_){_&&N(e),u=!1,f()}}}function z1(t){let e;return{c(){e=p("option"),e.textContent=`${t[139]*100}`,e.__value=t[139]*100,z(e,e.__value)},m(l,n){T(l,e,n)},p:ze,d(l){l&&N(e)}}}function ca(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s"),r(l,"pattern",Fr)},m(o,a){T(o,e,a),T(o,l,a),z(l,t[6].m.e.k),n||(i=ce(l,"input",t[46]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].m.e.k&&z(l,o[6].m.e.k)},d(o){o&&(N(e),N(l)),n=!1,i()}}}function _a(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","mea"),r(a,"type","text"),r(a,"class","in-s"),r(a,"pattern",Fr),r(e,"class","my-1")},m(_,v){T(_,e,v),s(e,n),s(e,i),s(e,o),s(e,a),z(a,t[6].m.e.a),u||(f=ce(a,"input",t[47]),u=!0)},p(_,v){var b,d;v[0]&4&&l!==(l=(((d=(b=_[2].conf)==null?void 0:b.meter)==null?void 0:d.authkey)??"Authentication key")+"")&&D(n,l),v[0]&64&&a.value!==_[6].m.e.a&&z(a,_[6].m.e.a)},d(_){_&&N(e),u=!1,f()}}}function ma(t){var Y,V,B,H,ne,ee,Q,ie,ue,fe,le,de;let e,l,n=(((B=(V=(Y=t[2].conf)==null?void 0:Y.meter)==null?void 0:V.multipliers)==null?void 0:B.watt)??"Watt")+"",i,o,a,u,f,c,m=(((ee=(ne=(H=t[2].conf)==null?void 0:H.meter)==null?void 0:ne.multipliers)==null?void 0:ee.volt)??"Volt")+"",_,v,b,d,h,g,k=(((ue=(ie=(Q=t[2].conf)==null?void 0:Q.meter)==null?void 0:ie.multipliers)==null?void 0:ue.amp)??"Amp")+"",C,I,R,E,O,L,j=(((de=(le=(fe=t[2].conf)==null?void 0:fe.meter)==null?void 0:le.multipliers)==null?void 0:de.kwh)??"kWh")+"",K,U,q,y,Z,G;return{c(){e=p("div"),l=p("div"),i=M(n),o=p("br"),a=w(),u=p("input"),f=w(),c=p("div"),_=M(m),v=p("br"),b=w(),d=p("input"),h=w(),g=p("div"),C=M(k),I=p("br"),R=w(),E=p("input"),O=w(),L=p("div"),K=M(j),U=p("br"),q=w(),y=p("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(d,"name","mmv"),r(d,"type","number"),r(d,"min","0.00"),r(d,"max","1000"),r(d,"step","0.001"),r(d,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(E,"name","mma"),r(E,"type","number"),r(E,"min","0.00"),r(E,"max","1000"),r(E,"step","0.001"),r(E,"class","in-m tr w-full"),r(g,"class","w-1/4"),r(y,"name","mmc"),r(y,"type","number"),r(y,"min","0.00"),r(y,"max","1000"),r(y,"step","0.001"),r(y,"class","in-l tr w-full"),r(L,"class","w-1/4"),r(e,"class","flex my-1")},m(oe,me){T(oe,e,me),s(e,l),s(l,i),s(l,o),s(l,a),s(l,u),z(u,t[6].m.m.w),s(e,f),s(e,c),s(c,_),s(c,v),s(c,b),s(c,d),z(d,t[6].m.m.v),s(e,h),s(e,g),s(g,C),s(g,I),s(g,R),s(g,E),z(E,t[6].m.m.a),s(e,O),s(e,L),s(L,K),s(L,U),s(L,q),s(L,y),z(y,t[6].m.m.c),Z||(G=[ce(u,"input",t[49]),ce(d,"input",t[50]),ce(E,"input",t[51]),ce(y,"input",t[52])],Z=!0)},p(oe,me){var se,pe,we,S,P,F,A,W,te,re,be,ke;me[0]&4&&n!==(n=(((we=(pe=(se=oe[2].conf)==null?void 0:se.meter)==null?void 0:pe.multipliers)==null?void 0:we.watt)??"Watt")+"")&&D(i,n),me[0]&64&&ye(u.value)!==oe[6].m.m.w&&z(u,oe[6].m.m.w),me[0]&4&&m!==(m=(((F=(P=(S=oe[2].conf)==null?void 0:S.meter)==null?void 0:P.multipliers)==null?void 0:F.volt)??"Volt")+"")&&D(_,m),me[0]&64&&ye(d.value)!==oe[6].m.m.v&&z(d,oe[6].m.m.v),me[0]&4&&k!==(k=(((te=(W=(A=oe[2].conf)==null?void 0:A.meter)==null?void 0:W.multipliers)==null?void 0:te.amp)??"Amp")+"")&&D(C,k),me[0]&64&&ye(E.value)!==oe[6].m.m.a&&z(E,oe[6].m.m.a),me[0]&4&&j!==(j=(((ke=(be=(re=oe[2].conf)==null?void 0:re.meter)==null?void 0:be.multipliers)==null?void 0:ke.kwh)??"kWh")+"")&&D(K,j),me[0]&64&&ye(y.value)!==oe[6].m.m.c&&z(y,oe[6].m.m.c)},d(oe){oe&&N(e),Z=!1,Ut(G)}}}function pa(t){var L,j,K,U,q,y;let e,l,n=(((j=(L=t[2].conf)==null?void 0:L.connection)==null?void 0:j.title)??"Connection")+"",i,o,a,u,f,c,m,_,v,b=(((U=(K=t[2].conf)==null?void 0:K.connection)==null?void 0:U.wifi)??"WiFi")+"",d,h,g=(((y=(q=t[2].conf)==null?void 0:q.connection)==null?void 0:y.ap)??"AP")+"",k,C,I,R,E=t[0].if&&t[0].if.eth&&da(t),O=(t[6].n.c==1||t[6].n.c==2)&&ha(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("select"),v=p("option"),d=M(b),h=p("option"),k=M(g),E&&E.c(),C=w(),O&&O.c(),r(l,"class","text-sm"),r(a,"href",bl("connection")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","w"),f.value="true",v.__value=1,z(v,v.__value),h.__value=2,z(h,h.__value),r(_,"name","nc"),r(_,"class","in-s"),t[6].n.c===void 0&&Mt(()=>t[53].call(_)),r(m,"class","my-1"),r(e,"class","cnt")},m(Z,G){T(Z,e,G),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),s(v,d),s(_,h),s(h,k),E&&E.m(_,null),Be(_,t[6].n.c,!0),s(e,C),O&&O.m(e,null),I||(R=ce(_,"change",t[53]),I=!0)},p(Z,G){var Y,V,B,H,ne,ee;G[0]&4&&n!==(n=(((V=(Y=Z[2].conf)==null?void 0:Y.connection)==null?void 0:V.title)??"Connection")+"")&&D(i,n),G[0]&4&&b!==(b=(((H=(B=Z[2].conf)==null?void 0:B.connection)==null?void 0:H.wifi)??"WiFi")+"")&&D(d,b),G[0]&4&&g!==(g=(((ee=(ne=Z[2].conf)==null?void 0:ne.connection)==null?void 0:ee.ap)??"AP")+"")&&D(k,g),Z[0].if&&Z[0].if.eth?E?E.p(Z,G):(E=da(Z),E.c(),E.m(_,null)):E&&(E.d(1),E=null),G[0]&64&&Be(_,Z[6].n.c),Z[6].n.c==1||Z[6].n.c==2?O?O.p(Z,G):(O=ha(Z),O.c(),O.m(e,null)):O&&(O.d(1),O=null)},d(Z){Z&&N(e),E&&E.d(),O&&O.d(),I=!1,R()}}}function da(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,z(e,e.__value)},m(a,u){T(a,e,u),s(e,n)},p(a,u){var f,c;u[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&D(n,l)},d(a){a&&N(e)}}}function ha(t){var Ne,Ie,De,Ae,Me,qe,Le,$e,xe,rt,Pt,dt,ut,ot,ht,Rt,Je,Fe,je,tt,Ve,Ge,Qe;let e,l=(((Ie=(Ne=t[2].conf)==null?void 0:Ne.connection)==null?void 0:Ie.ssid)??"SSID")+"",n,i,o,a,u,f,c,m,_,v,b=(((Ae=(De=t[2].conf)==null?void 0:De.connection)==null?void 0:Ae.psk)??"Password")+"",d,h,g,k,C,I,R,E=(((Le=(qe=(Me=t[2].conf)==null?void 0:Me.connection)==null?void 0:qe.ps)==null?void 0:Le.title)??"Power saving")+"",O,L,j,K,U,q=(((rt=(xe=($e=t[2].conf)==null?void 0:$e.connection)==null?void 0:xe.ps)==null?void 0:rt.default)??"Default")+"",y,Z,G=(((ut=(dt=(Pt=t[2].conf)==null?void 0:Pt.connection)==null?void 0:dt.ps)==null?void 0:ut.off)??"Off")+"",Y,V,B=(((Rt=(ht=(ot=t[2].conf)==null?void 0:ot.connection)==null?void 0:ht.ps)==null?void 0:Rt.min)??"Min")+"",H,ne,ee=(((je=(Fe=(Je=t[2].conf)==null?void 0:Je.connection)==null?void 0:Fe.ps)==null?void 0:je.max)??"Max")+"",Q,ie,ue,fe=(((Ve=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:Ve.pwr)??"Power")+"",le,de,oe,me,se,pe,we,S,P,F,A,W,te=(((Qe=(Ge=t[2].conf)==null?void 0:Ge.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",re,be,ke;function J(_e,ae){return _e[8]?H1:j1}let ve=J(t),ge=ve(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("label"),a=p("input"),u=M(" manual"),f=w(),c=p("br"),m=w(),ge.c(),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),C=w(),I=p("div"),R=p("div"),O=M(E),L=p("br"),j=w(),K=p("select"),U=p("option"),y=M(q),Z=p("option"),Y=M(G),V=p("option"),H=M(B),ne=p("option"),Q=M(ee),ie=w(),ue=p("div"),le=M(fe),de=p("br"),oe=w(),me=p("div"),se=p("input"),pe=w(),we=p("span"),we.textContent="dBm",S=w(),P=p("div"),F=p("label"),A=p("input"),W=w(),re=M(te),r(a,"type","checkbox"),a.__value="true",z(a,a.__value),r(a,"class","rounded mb-1"),r(o,"class","float-right mr-3"),r(e,"class","my-1"),r(k,"name","wp"),r(k,"type","password"),r(k,"class","in-s"),r(k,"pattern",In),r(v,"class","my-1"),U.__value=255,z(U,U.__value),Z.__value=0,z(Z,Z.__value),V.__value=1,z(V,V.__value),ne.__value=2,z(ne,ne.__value),r(K,"name","wz"),r(K,"class","in-s"),t[6].w.z===void 0&&Mt(()=>t[58].call(K)),r(R,"class","w-1/2"),r(se,"name","ww"),r(se,"type","number"),r(se,"min","0"),r(se,"max","20.5"),r(se,"step","0.5"),r(se,"class","in-f tr w-full"),r(we,"class","in-post"),r(me,"class","flex"),r(ue,"class","ml-2 w-1/2"),r(I,"class","my-1 flex"),r(A,"type","checkbox"),r(A,"name","wb"),A.__value="true",z(A,A.__value),r(A,"class","rounded mb-1"),r(P,"class","my-3")},m(_e,ae){T(_e,e,ae),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[8],s(o,u),s(e,f),s(e,c),s(e,m),ge.m(e,null),T(_e,_,ae),T(_e,v,ae),s(v,d),s(v,h),s(v,g),s(v,k),z(k,t[6].w.p),T(_e,C,ae),T(_e,I,ae),s(I,R),s(R,O),s(R,L),s(R,j),s(R,K),s(K,U),s(U,y),s(K,Z),s(Z,Y),s(K,V),s(V,H),s(K,ne),s(ne,Q),Be(K,t[6].w.z,!0),s(I,ie),s(I,ue),s(ue,le),s(ue,de),s(ue,oe),s(ue,me),s(me,se),z(se,t[6].w.w),s(me,pe),s(me,we),T(_e,S,ae),T(_e,P,ae),s(P,F),s(F,A),A.checked=t[6].w.b,s(F,W),s(F,re),be||(ke=[ce(a,"change",t[54]),ce(k,"input",t[57]),ce(K,"change",t[58]),ce(se,"input",t[59]),ce(A,"change",t[60])],be=!0)},p(_e,ae){var Ee,Ke,Tt,vt,Xe,Nt,at,mt,lt,yt,el,pt,nt,Qt,Jt,Ot,Zt,$t,Vt,Xt,ll,Ye,st;ae[0]&4&&l!==(l=(((Ke=(Ee=_e[2].conf)==null?void 0:Ee.connection)==null?void 0:Ke.ssid)??"SSID")+"")&&D(n,l),ae[0]&256&&(a.checked=_e[8]),ve===(ve=J(_e))&&ge?ge.p(_e,ae):(ge.d(1),ge=ve(_e),ge&&(ge.c(),ge.m(e,null))),ae[0]&4&&b!==(b=(((vt=(Tt=_e[2].conf)==null?void 0:Tt.connection)==null?void 0:vt.psk)??"Password")+"")&&D(d,b),ae[0]&64&&k.value!==_e[6].w.p&&z(k,_e[6].w.p),ae[0]&4&&E!==(E=(((at=(Nt=(Xe=_e[2].conf)==null?void 0:Xe.connection)==null?void 0:Nt.ps)==null?void 0:at.title)??"Power saving")+"")&&D(O,E),ae[0]&4&&q!==(q=(((yt=(lt=(mt=_e[2].conf)==null?void 0:mt.connection)==null?void 0:lt.ps)==null?void 0:yt.default)??"Default")+"")&&D(y,q),ae[0]&4&&G!==(G=(((nt=(pt=(el=_e[2].conf)==null?void 0:el.connection)==null?void 0:pt.ps)==null?void 0:nt.off)??"Off")+"")&&D(Y,G),ae[0]&4&&B!==(B=(((Ot=(Jt=(Qt=_e[2].conf)==null?void 0:Qt.connection)==null?void 0:Jt.ps)==null?void 0:Ot.min)??"Min")+"")&&D(H,B),ae[0]&4&&ee!==(ee=(((Vt=($t=(Zt=_e[2].conf)==null?void 0:Zt.connection)==null?void 0:$t.ps)==null?void 0:Vt.max)??"Max")+"")&&D(Q,ee),ae[0]&64&&Be(K,_e[6].w.z),ae[0]&4&&fe!==(fe=(((ll=(Xt=_e[2].conf)==null?void 0:Xt.connection)==null?void 0:ll.pwr)??"Power")+"")&&D(le,fe),ae[0]&64&&ye(se.value)!==_e[6].w.w&&z(se,_e[6].w.w),ae[0]&64&&(A.checked=_e[6].w.b),ae[0]&4&&te!==(te=(((st=(Ye=_e[2].conf)==null?void 0:Ye.connection)==null?void 0:st.tick_11b)??"802.11b")+"")&&D(re,te)},d(_e){_e&&(N(e),N(_),N(v),N(C),N(I),N(S),N(P)),ge.d(),be=!1,Ut(ke)}}}function j1(t){var f,c;let e,l,n,i,o,a=((f=t[9])==null?void 0:f.c)==-1&&va(),u=((c=t[9])==null?void 0:c.n)&&ba(t);return{c(){e=p("select"),a&&a.c(),l=Wt(),u&&u.c(),r(e,"name","ws"),r(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&Mt(()=>t[56].call(e))},m(m,_){T(m,e,_),a&&a.m(e,null),s(e,l),u&&u.m(e,null),Be(e,t[6].w.s,!0),i||(o=ce(e,"change",t[56]),i=!0)},p(m,_){var v,b;((v=m[9])==null?void 0:v.c)==-1?a||(a=va(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(b=m[9])!=null&&b.n?u?u.p(m,_):(u=ba(m),u.c(),u.m(e,null)):u&&(u.d(1),u=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&Be(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),u&&u.d(),i=!1,o()}}}function H1(t){let e,l,n,i;return{c(){e=p("input"),r(e,"name","ws"),r(e,"type","text"),r(e,"class","in-s"),r(e,"pattern",In),e.required=l=t[6].n.c==1||t[6].n.c==2},m(o,a){T(o,e,a),z(e,t[6].w.s),n||(i=ce(e,"input",t[55]),n=!0)},p(o,a){a[0]&64&&l!==(l=o[6].n.c==1||o[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==o[6].w.s&&z(e,o[6].w.s)},d(o){o&&N(e),n=!1,i()}}}function va(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",z(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function ba(t){var i;let e,l=ft((i=t[9])==null?void 0:i.n),n=[];for(let o=0;ot[61].call(d)),r(O,"name","ni"),r(O,"type","text"),r(O,"class","in-m w-full"),O.disabled=L=t[6].n.m=="dhcp",O.required=j=t[6].n.m=="static",r(O,"pattern",mn),r(U,"name","ns"),r(U,"class","in-l"),U.disabled=y=t[6].n.m=="dhcp",U.required=Z=t[6].n.m=="static",t[6].n.s===void 0&&Mt(()=>t[63].call(U)),r(b,"class","flex"),r(f,"class","my-1"),r(H,"name","nx"),H.__value="true",z(H,H.__value),r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(V,"class","my-1"),r(ue,"name","nd"),ue.__value="true",z(ue,ue.__value),r(ue,"type","checkbox"),r(ue,"class","rounded mb-1"),r(Q,"class","my-1"),r(me,"type","hidden"),r(me,"name","ntp"),me.value="true",r(A,"name","ntpd"),A.__value="true",z(A,A.__value),r(A,"type","checkbox"),r(A,"class","rounded mb-1"),r(F,"class","ml-4"),r(ve,"name","ntph"),r(ve,"type","text"),r(ve,"class","in-s"),r(ve,"pattern",Ol),r(J,"class","flex"),r(pe,"class","my-1"),r(e,"class","cnt")},m(Fe,je){T(Fe,e,je),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(f,m),s(f,_),s(f,v),s(f,b),s(b,d),s(d,h),s(h,k),s(d,C),s(C,R),Be(d,t[6].n.m,!0),s(b,E),s(b,O),z(O,t[6].n.i),s(b,K),s(b,U),Ce(q,U,null),Be(U,t[6].n.s,!0),s(e,G),De&&De.m(e,null),s(e,Y),s(e,V),s(V,B),s(B,H),H.checked=t[6].n.x,s(B,ne),s(e,ee),s(e,Q),s(Q,ie),s(ie,ue),ue.checked=t[6].n.d,s(ie,fe),s(ie,de),s(e,oe),s(e,me),s(e,se),s(e,pe),s(pe,S),s(pe,P),s(pe,F),s(F,A),A.checked=t[6].n.h,s(F,W),s(F,re),s(pe,be),s(pe,ke),s(pe,J),s(J,ve),z(ve,t[6].n.n1),ge=!0,Ne||(Ie=[ce(d,"change",t[61]),ce(O,"input",t[62]),ce(U,"change",t[63]),ce(H,"change",t[67]),ce(ue,"change",t[68]),ce(A,"change",t[69]),ce(ve,"input",t[70])],Ne=!0)},p(Fe,je){var tt,Ve,Ge,Qe,_e,ae,Ee,Ke,Tt,vt,Xe,Nt,at,mt;(!ge||je[0]&4)&&n!==(n=(((Ve=(tt=Fe[2].conf)==null?void 0:tt.network)==null?void 0:Ve.title)??"Network")+"")&&D(i,n),(!ge||je[0]&4)&&c!==(c=(((Qe=(Ge=Fe[2].conf)==null?void 0:Ge.network)==null?void 0:Qe.ip)??"IP")+"")&&D(m,c),(!ge||je[0]&4)&&g!==(g=(((ae=(_e=Fe[2].conf)==null?void 0:_e.network)==null?void 0:ae.dhcp)??"DHCP")+"")&&D(k,g),(!ge||je[0]&4)&&I!==(I=(((Ke=(Ee=Fe[2].conf)==null?void 0:Ee.network)==null?void 0:Ke.static)??"Static")+"")&&D(R,I),je[0]&64&&Be(d,Fe[6].n.m),(!ge||je[0]&64&&L!==(L=Fe[6].n.m=="dhcp"))&&(O.disabled=L),(!ge||je[0]&64&&j!==(j=Fe[6].n.m=="static"))&&(O.required=j),je[0]&64&&O.value!==Fe[6].n.i&&z(O,Fe[6].n.i),(!ge||je[0]&64&&y!==(y=Fe[6].n.m=="dhcp"))&&(U.disabled=y),(!ge||je[0]&64&&Z!==(Z=Fe[6].n.m=="static"))&&(U.required=Z),je[0]&64&&Be(U,Fe[6].n.s),Fe[6].n.m=="static"?De?De.p(Fe,je):(De=wa(Fe),De.c(),De.m(e,Y)):De&&(De.d(1),De=null),je[0]&64&&(H.checked=Fe[6].n.x),je[0]&64&&(ue.checked=Fe[6].n.d),(!ge||je[0]&4)&&le!==(le=(((vt=(Tt=Fe[2].conf)==null?void 0:Tt.network)==null?void 0:vt.tick_mdns)??"mDNS")+"")&&D(de,le),(!ge||je[0]&4)&&we!==(we=(((Nt=(Xe=Fe[2].conf)==null?void 0:Xe.network)==null?void 0:Nt.ntp)??"NTP")+"")&&D(S,we),je[0]&64&&(A.checked=Fe[6].n.h),(!ge||je[0]&4)&&te!==(te=(((mt=(at=Fe[2].conf)==null?void 0:at.network)==null?void 0:mt.tick_ntp_dhcp)??"from DHCP")+"")&&D(re,te),je[0]&64&&ve.value!==Fe[6].n.n1&&z(ve,Fe[6].n.n1)},i(Fe){ge||(X(q.$$.fragment,Fe),ge=!0)},o(Fe){x(q.$$.fragment,Fe),ge=!1},d(Fe){Fe&&N(e),Pe(q),De&&De.d(),Ne=!1,Ut(Ie)}}}function wa(t){var I,R,E,O;let e,l=(((R=(I=t[2].conf)==null?void 0:I.network)==null?void 0:R.gw)??"Gateway")+"",n,i,o,a,u,f,c=(((O=(E=t[2].conf)==null?void 0:E.network)==null?void 0:O.dns)??"DNS")+"",m,_,v,b,d,h,g,k,C;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),u=w(),f=p("div"),m=M(c),_=p("br"),v=w(),b=p("div"),d=p("input"),h=w(),g=p("input"),r(a,"name","ng"),r(a,"type","text"),r(a,"class","in-s"),r(a,"pattern",mn),r(e,"class","my-1"),r(d,"name","nd1"),r(d,"type","text"),r(d,"class","in-f w-full"),r(d,"pattern",mn),r(g,"name","nd2"),r(g,"type","text"),r(g,"class","in-l w-full"),r(g,"pattern",mn),r(b,"class","flex"),r(f,"class","my-1")},m(L,j){T(L,e,j),s(e,n),s(e,i),s(e,o),s(e,a),z(a,t[6].n.g),T(L,u,j),T(L,f,j),s(f,m),s(f,_),s(f,v),s(f,b),s(b,d),z(d,t[6].n.d1),s(b,h),s(b,g),z(g,t[6].n.d2),k||(C=[ce(a,"input",t[64]),ce(d,"input",t[65]),ce(g,"input",t[66])],k=!0)},p(L,j){var K,U,q,y;j[0]&4&&l!==(l=(((U=(K=L[2].conf)==null?void 0:K.network)==null?void 0:U.gw)??"Gateway")+"")&&D(n,l),j[0]&64&&a.value!==L[6].n.g&&z(a,L[6].n.g),j[0]&4&&c!==(c=(((y=(q=L[2].conf)==null?void 0:q.network)==null?void 0:y.dns)??"DNS")+"")&&D(m,c),j[0]&64&&d.value!==L[6].n.d1&&z(d,L[6].n.d1),j[0]&64&&g.value!==L[6].n.d2&&z(g,L[6].n.d2)},d(L){L&&(N(e),N(u),N(f)),k=!1,Ut(C)}}}function Ca(t){var cl,ol,jt,Ht,rl,Te,$,Re,_l,it,qt,al,ml,vl,fl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl;let e,l,n=(((ol=(cl=t[2].conf)==null?void 0:cl.mqtt)==null?void 0:ol.title)??"MQTT")+"",i,o,a,u,f,c,m,_=(((Ht=(jt=t[2].conf)==null?void 0:jt.mqtt)==null?void 0:Ht.server)??"Server")+"",v,b,d,h,g,k,C,I,R,E,O,L,j=(((Te=(rl=t[2].conf)==null?void 0:rl.mqtt)==null?void 0:Te.user)??"Username")+"",K,U,q,y,Z,G,Y=(((Re=($=t[2].conf)==null?void 0:$.mqtt)==null?void 0:Re.pass)??"Password")+"",V,B,H,ne,ee,Q,ie,ue=(((it=(_l=t[2].conf)==null?void 0:_l.mqtt)==null?void 0:it.id)??"Client ID")+"",fe,le,de,oe,me,se,pe,we=(((al=(qt=t[2].conf)==null?void 0:qt.mqtt)==null?void 0:al.payload)??"Payload")+"",S,P,F,A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De=(((vl=(ml=t[2].conf)==null?void 0:ml.mqtt)==null?void 0:vl.publish)??"Publish topic")+"",Ae,Me,qe,Le,$e,xe,rt=(((gl=(fl=t[2].conf)==null?void 0:fl.mqtt)==null?void 0:gl.subscribe)??"Subscribe topic")+"",Pt,dt,ut,ot,ht,Rt,Je,Fe=(((Ll=(kl=t[2].conf)==null?void 0:kl.mqtt)==null?void 0:Ll.update)??"Update method")+"",je,tt,Ve,Ge=(((yl=(Fl=t[2].conf)==null?void 0:Fl.mqtt)==null?void 0:yl.interval)??"Interval")+"",Qe,_e,ae,Ee,Ke,Tt=(((Ul=(Bl=t[2].conf)==null?void 0:Bl.mqtt)==null?void 0:Ul.realtime)??"Real time")+"",vt,Xe,Nt=(((jl=(zl=t[2].conf)==null?void 0:zl.mqtt)==null?void 0:jl.interval)??"Interval")+"",at,mt,lt,yt,el,pt,nt,Qt,Jt=(((Wl=(Hl=t[2].conf)==null?void 0:Hl.mqtt)==null?void 0:Wl.timeout)??"Timeout")+"",Ot,Zt,$t,Vt=(((Gl=(Vl=t[2].conf)==null?void 0:Vl.mqtt)==null?void 0:Gl.keepalive)??"Keep-alive")+"",Xt,ll,Ye,st=(((Yl=(Kl=t[2].conf)==null?void 0:Kl.mqtt)==null?void 0:Yl.autoreboot)??"Auto-reboot")+"",St,Lt,kt,gt,zt,et,Ft,he,Oe,He,Gt,Kt=t[0].chip!="esp8266"&&Pa(t),wt=t[6].q.s.e&&Sa(t);return{c(){var We,bt;e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),v=M(_),b=w(),Kt&&Kt.c(),d=w(),h=p("br"),g=w(),k=p("div"),C=p("input"),I=w(),R=p("input"),E=w(),wt&&wt.c(),O=w(),L=p("div"),K=M(j),U=p("br"),q=w(),y=p("input"),Z=w(),G=p("div"),V=M(Y),B=p("br"),H=w(),ne=p("input"),ee=w(),Q=p("div"),ie=p("div"),fe=M(ue),le=p("br"),de=w(),oe=p("input"),se=w(),pe=p("div"),S=M(we),P=p("br"),F=w(),A=p("select"),W=p("option"),W.textContent="Raw (minimal)",te=p("option"),te.textContent="Raw (full)",re=p("option"),re.textContent="Domoticz",be=p("option"),be.textContent="Home-Assistant",ke=p("option"),ke.textContent="JSON (classic)",J=p("option"),J.textContent="JSON (multi topic)",ve=p("option"),ve.textContent="JSON (flat)",ge=p("option"),ge.textContent="HEX dump",Ne=w(),Ie=p("div"),Ae=M(De),Me=p("br"),qe=w(),Le=p("input"),$e=w(),xe=p("div"),Pt=M(rt),dt=p("br"),ut=w(),ot=p("input"),Rt=w(),Je=p("div"),je=M(Fe),tt=w(),Ve=p("span"),Qe=M(Ge),_e=w(),ae=p("div"),Ee=p("select"),Ke=p("option"),vt=M(Tt),Xe=p("option"),at=M(Nt),mt=w(),lt=p("input"),el=w(),pt=p("div"),nt=p("div"),Qt=p("p"),Ot=M(Jt),Zt=w(),$t=p("p"),Xt=M(Vt),ll=w(),Ye=p("p"),St=M(st),Lt=w(),kt=p("div"),gt=p("input"),zt=w(),et=p("input"),Ft=w(),he=p("input"),r(l,"class","text-sm"),r(a,"href",bl("mqtt")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","q"),f.value="true",r(C,"name","qh"),r(C,"type","text"),r(C,"class","in-f w-2/3"),r(C,"pattern",Ol),r(R,"name","qp"),r(R,"type","number"),r(R,"min","1024"),r(R,"max","65535"),r(R,"class","in-l tr w-1/3"),r(k,"class","flex"),r(m,"class","my-1"),r(y,"name","qu"),r(y,"type","text"),r(y,"class","in-s"),r(y,"pattern",In),r(L,"class","my-1"),r(ne,"name","qa"),r(ne,"type","password"),r(ne,"class","in-s"),r(ne,"pattern",In),r(G,"class","my-1"),r(oe,"name","qc"),r(oe,"type","text"),r(oe,"class","in-f w-full"),oe.required=me=t[6].q.h,r(oe,"pattern",Pi),W.__value=1,z(W,W.__value),te.__value=2,z(te,te.__value),re.__value=3,z(re,re.__value),be.__value=4,z(be,be.__value),ke.__value=0,z(ke,ke.__value),J.__value=5,z(J,J.__value),ve.__value=6,z(ve,ve.__value),ge.__value=255,z(ge,ge.__value),r(A,"name","qm"),r(A,"class","in-l"),t[6].q.m===void 0&&Mt(()=>t[77].call(A)),r(Q,"class","my-1 flex"),r(Le,"name","qb"),r(Le,"type","text"),r(Le,"class","in-s"),r(Le,"pattern",Ol),r(Ie,"class","my-1"),r(ot,"name","qr"),r(ot,"type","text"),r(ot,"class","in-s"),r(ot,"pattern",Ol),r(ot,"placeholder",ht=t[6].q.b+"/command"),r(xe,"class","my-1"),r(Ve,"class","float-right"),Ke.__value=0,z(Ke,Ke.__value),Xe.__value=1,z(Xe,Xe.__value),r(Ee,"name","qt"),r(Ee,"class","in-f w-1/2"),t[6].q.t===void 0&&Mt(()=>t[80].call(Ee)),r(lt,"name","qd"),r(lt,"type","number"),r(lt,"min","1"),r(lt,"max","3600"),r(lt,"class","in-l tr w-1/2"),lt.disabled=yt=((bt=(We=t[6])==null?void 0:We.q)==null?void 0:bt.t)!=1,r(ae,"class","flex"),r(Je,"class","my-1"),r(nt,"class","grid grid-cols-3"),r(gt,"name","qi"),r(gt,"type","number"),r(gt,"min","500"),r(gt,"max","10000"),r(gt,"class","in-f tr w-1/2"),r(et,"name","qk"),r(et,"type","number"),r(et,"min","5"),r(et,"max","180"),r(et,"class","in-m tr w-1/2"),r(he,"name","qe"),r(he,"type","number"),r(he,"min","0"),r(he,"max","240"),r(he,"class","in-l tr w-1/2"),r(kt,"class","flex"),r(pt,"class","my-1"),r(e,"class","cnt")},m(We,bt){T(We,e,bt),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,v),s(m,b),Kt&&Kt.m(m,null),s(m,d),s(m,h),s(m,g),s(m,k),s(k,C),z(C,t[6].q.h),s(k,I),s(k,R),z(R,t[6].q.p),s(e,E),wt&&wt.m(e,null),s(e,O),s(e,L),s(L,K),s(L,U),s(L,q),s(L,y),z(y,t[6].q.u),s(e,Z),s(e,G),s(G,V),s(G,B),s(G,H),s(G,ne),z(ne,t[6].q.a),s(e,ee),s(e,Q),s(Q,ie),s(ie,fe),s(ie,le),s(ie,de),s(ie,oe),z(oe,t[6].q.c),s(Q,se),s(Q,pe),s(pe,S),s(pe,P),s(pe,F),s(pe,A),s(A,W),s(A,te),s(A,re),s(A,be),s(A,ke),s(A,J),s(A,ve),s(A,ge),Be(A,t[6].q.m,!0),s(e,Ne),s(e,Ie),s(Ie,Ae),s(Ie,Me),s(Ie,qe),s(Ie,Le),z(Le,t[6].q.b),s(e,$e),s(e,xe),s(xe,Pt),s(xe,dt),s(xe,ut),s(xe,ot),z(ot,t[6].q.r),s(e,Rt),s(e,Je),s(Je,je),s(Je,tt),s(Je,Ve),s(Ve,Qe),s(Je,_e),s(Je,ae),s(ae,Ee),s(Ee,Ke),s(Ke,vt),s(Ee,Xe),s(Xe,at),Be(Ee,t[6].q.t,!0),s(ae,mt),s(ae,lt),z(lt,t[6].q.d),s(e,el),s(e,pt),s(pt,nt),s(nt,Qt),s(Qt,Ot),s(nt,Zt),s(nt,$t),s($t,Xt),s(nt,ll),s(nt,Ye),s(Ye,St),s(pt,Lt),s(pt,kt),s(kt,gt),z(gt,t[6].q.i),s(kt,zt),s(kt,et),z(et,t[6].q.k),s(kt,Ft),s(kt,he),z(he,t[6].q.e),Oe=!0,He||(Gt=[ce(C,"input",t[72]),ce(R,"input",t[73]),ce(y,"input",t[74]),ce(ne,"input",t[75]),ce(oe,"input",t[76]),ce(A,"change",t[77]),ce(Le,"input",t[78]),ce(ot,"input",t[79]),ce(Ee,"change",t[80]),ce(lt,"input",t[81]),ce(gt,"input",t[82]),ce(et,"input",t[83]),ce(he,"input",t[84])],He=!0)},p(We,bt){var Ue,Dt,il,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Tn,qn,Dn,An,Rn,On,Ln,Fn,yn,Bn,Un,zn,jn,Hn,Wn,Vn,Gn,Kn,Yn,Qn;(!Oe||bt[0]&4)&&n!==(n=(((Dt=(Ue=We[2].conf)==null?void 0:Ue.mqtt)==null?void 0:Dt.title)??"MQTT")+"")&&D(i,n),(!Oe||bt[0]&4)&&_!==(_=(((Ql=(il=We[2].conf)==null?void 0:il.mqtt)==null?void 0:Ql.server)??"Server")+"")&&D(v,_),We[0].chip!="esp8266"?Kt?Kt.p(We,bt):(Kt=Pa(We),Kt.c(),Kt.m(m,d)):Kt&&(Kt.d(1),Kt=null),bt[0]&64&&C.value!==We[6].q.h&&z(C,We[6].q.h),bt[0]&64&&ye(R.value)!==We[6].q.p&&z(R,We[6].q.p),We[6].q.s.e?wt?(wt.p(We,bt),bt[0]&64&&X(wt,1)):(wt=Sa(We),wt.c(),X(wt,1),wt.m(e,O)):wt&&(ct(),x(wt,1,1,()=>{wt=null}),_t()),(!Oe||bt[0]&4)&&j!==(j=(((Zl=(Xl=We[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.user)??"Username")+"")&&D(K,j),bt[0]&64&&y.value!==We[6].q.u&&z(y,We[6].q.u),(!Oe||bt[0]&4)&&Y!==(Y=((($l=(Jl=We[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.pass)??"Password")+"")&&D(V,Y),bt[0]&64&&ne.value!==We[6].q.a&&z(ne,We[6].q.a),(!Oe||bt[0]&4)&&ue!==(ue=(((en=(xl=We[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.id)??"Client ID")+"")&&D(fe,ue),(!Oe||bt[0]&64&&me!==(me=We[6].q.h))&&(oe.required=me),bt[0]&64&&oe.value!==We[6].q.c&&z(oe,We[6].q.c),(!Oe||bt[0]&4)&&we!==(we=(((Nn=(tn=We[2].conf)==null?void 0:tn.mqtt)==null?void 0:Nn.payload)??"Payload")+"")&&D(S,we),bt[0]&64&&Be(A,We[6].q.m),(!Oe||bt[0]&4)&&De!==(De=(((qn=(Tn=We[2].conf)==null?void 0:Tn.mqtt)==null?void 0:qn.publish)??"Publish topic")+"")&&D(Ae,De),bt[0]&64&&Le.value!==We[6].q.b&&z(Le,We[6].q.b),(!Oe||bt[0]&4)&&rt!==(rt=(((An=(Dn=We[2].conf)==null?void 0:Dn.mqtt)==null?void 0:An.subscribe)??"Subscribe topic")+"")&&D(Pt,rt),(!Oe||bt[0]&64&&ht!==(ht=We[6].q.b+"/command"))&&r(ot,"placeholder",ht),bt[0]&64&&ot.value!==We[6].q.r&&z(ot,We[6].q.r),(!Oe||bt[0]&4)&&Fe!==(Fe=(((On=(Rn=We[2].conf)==null?void 0:Rn.mqtt)==null?void 0:On.update)??"Update method")+"")&&D(je,Fe),(!Oe||bt[0]&4)&&Ge!==(Ge=(((Fn=(Ln=We[2].conf)==null?void 0:Ln.mqtt)==null?void 0:Fn.interval)??"Interval")+"")&&D(Qe,Ge),(!Oe||bt[0]&4)&&Tt!==(Tt=(((Bn=(yn=We[2].conf)==null?void 0:yn.mqtt)==null?void 0:Bn.realtime)??"Real time")+"")&&D(vt,Tt),(!Oe||bt[0]&4)&&Nt!==(Nt=(((zn=(Un=We[2].conf)==null?void 0:Un.mqtt)==null?void 0:zn.interval)??"Interval")+"")&&D(at,Nt),bt[0]&64&&Be(Ee,We[6].q.t),(!Oe||bt[0]&64&&yt!==(yt=((Hn=(jn=We[6])==null?void 0:jn.q)==null?void 0:Hn.t)!=1))&&(lt.disabled=yt),bt[0]&64&&ye(lt.value)!==We[6].q.d&&z(lt,We[6].q.d),(!Oe||bt[0]&4)&&Jt!==(Jt=(((Vn=(Wn=We[2].conf)==null?void 0:Wn.mqtt)==null?void 0:Vn.timeout)??"Timeout")+"")&&D(Ot,Jt),(!Oe||bt[0]&4)&&Vt!==(Vt=(((Kn=(Gn=We[2].conf)==null?void 0:Gn.mqtt)==null?void 0:Kn.keepalive)??"Keep-alive")+"")&&D(Xt,Vt),(!Oe||bt[0]&4)&&st!==(st=(((Qn=(Yn=We[2].conf)==null?void 0:Yn.mqtt)==null?void 0:Qn.autoreboot)??"Auto-reboot")+"")&&D(St,st),bt[0]&64&&ye(gt.value)!==We[6].q.i&&z(gt,We[6].q.i),bt[0]&64&&ye(et.value)!==We[6].q.k&&z(et,We[6].q.k),bt[0]&64&&ye(he.value)!==We[6].q.e&&z(he,We[6].q.e)},i(We){Oe||(X(wt),Oe=!0)},o(We){x(wt),Oe=!1},d(We){We&&N(e),Kt&&Kt.d(),wt&&wt.d(),He=!1,Ut(Gt)}}}function Pa(t){let e,l,n,i,o;return{c(){e=p("label"),l=p("input"),n=M(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",z(l,l.__value),r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){T(a,e,u),s(e,l),l.checked=t[6].q.s.e,s(e,n),i||(o=[ce(l,"change",t[71]),ce(l,"change",t[20])],i=!0)},p(a,u){u[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,Ut(o)}}}function Sa(t){let e,l,n,i,o,a,u,f,c,m,_,v,b;const d=[V1,W1],h=[];function g(L,j){return L[6].q.s.c?0:1}n=g(t),i=h[n]=d[n](t);const k=[Q1,Y1],C=[];function I(L,j){return L[6].q.s.r?0:1}u=I(t),f=C[u]=k[u](t);const R=[$1,J1],E=[];function O(L,j){return L[6].q.s.k?0:1}return _=O(t),v=E[_]=R[_](t),{c(){e=p("div"),l=p("span"),i.c(),o=w(),a=p("span"),f.c(),c=w(),m=p("span"),v.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(m,"class","flex pr-2"),r(e,"class","my-1 flex")},m(L,j){T(L,e,j),s(e,l),h[n].m(l,null),s(e,o),s(e,a),C[u].m(a,null),s(e,c),s(e,m),E[_].m(m,null),b=!0},p(L,j){let K=n;n=g(L),n===K?h[n].p(L,j):(ct(),x(h[K],1,1,()=>{h[K]=null}),_t(),i=h[n],i?i.p(L,j):(i=h[n]=d[n](L),i.c()),X(i,1),i.m(l,null));let U=u;u=I(L),u===U?C[u].p(L,j):(ct(),x(C[U],1,1,()=>{C[U]=null}),_t(),f=C[u],f?f.p(L,j):(f=C[u]=k[u](L),f.c()),X(f,1),f.m(a,null));let q=_;_=O(L),_===q?E[_].p(L,j):(ct(),x(E[q],1,1,()=>{E[q]=null}),_t(),v=E[_],v?v.p(L,j):(v=E[_]=R[_](L),v.c()),X(v,1),v.m(m,null))},i(L){b||(X(i),X(f),X(v),b=!0)},o(L){x(i),x(f),x(v),b=!1},d(L){L&&N(e),h[n].d(),C[u].d(),E[_].d()}}}function W1(t){let e,l;return e=new wl({props:{to:"/mqtt-ca",$$slots:{default:[G1]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function V1(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-ca",$$slots:{default:[K1]},$$scope:{ctx:t}}}),{c(){e=p("span"),Se(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){T(f,e,c),Ce(l,e,null),T(f,n,c),T(f,i,c),o=!0,a||(u=[ce(i,"click",t[17]),ce(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Pe(l),a=!1,Ut(u)}}}function G1(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Se(e.$$.fragment)},m(u,f){Ce(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_ca)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){x(e.$$.fragment,u),l=!1},d(u){Pe(e,u)}}}function K1(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=M(e)},m(o,a){T(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function Y1(t){let e,l;return e=new wl({props:{to:"/mqtt-cert",$$slots:{default:[X1]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function Q1(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-cert",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){e=p("span"),Se(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){T(f,e,c),Ce(l,e,null),T(f,n,c),T(f,i,c),o=!0,a||(u=[ce(i,"click",t[18]),ce(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Pe(l),a=!1,Ut(u)}}}function X1(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Se(e.$$.fragment)},m(u,f){Ce(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_crt)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){x(e.$$.fragment,u),l=!1},d(u){Pe(e,u)}}}function Z1(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=M(e)},m(o,a){T(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function J1(t){let e,l;return e=new wl({props:{to:"/mqtt-key",$$slots:{default:[x1]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function $1(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-key",$$slots:{default:[e_]},$$scope:{ctx:t}}}),{c(){e=p("span"),Se(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){T(f,e,c),Ce(l,e,null),T(f,n,c),T(f,i,c),o=!0,a||(u=[ce(i,"click",t[19]),ce(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){x(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Pe(l),a=!1,Ut(u)}}}function x1(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_key)??""}}),{c(){Se(e.$$.fragment)},m(u,f){Ce(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_key)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){x(e.$$.fragment,u),l=!1},d(u){Pe(e,u)}}}function e_(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=M(e)},m(o,a){T(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&D(l,e)},d(o){o&&N(l)}}}function Ma(t){var Q,ie,ue,fe,le,de,oe,me,se,pe,we,S;let e,l,n=(((ue=(ie=(Q=t[2].conf)==null?void 0:Q.mqtt)==null?void 0:ie.domoticz)==null?void 0:ue.title)??"Domoticz")+"",i,o,a,u,f,c,m,_,v=(((de=(le=(fe=t[2].conf)==null?void 0:fe.mqtt)==null?void 0:le.domoticz)==null?void 0:de.eidx)??"Electricity IDX")+"",b,d,h,g,k,C,I=(((se=(me=(oe=t[2].conf)==null?void 0:oe.mqtt)==null?void 0:me.domoticz)==null?void 0:se.cidx)??"Current IDX")+"",R,E,O,L,j,K,U=(((S=(we=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:we.domoticz)==null?void 0:S.vidx)??"Voltage IDX")+"",q,y,Z,G,Y,V,B,H,ne,ee;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("div"),b=M(v),d=p("br"),h=w(),g=p("input"),k=w(),C=p("div"),R=M(I),E=p("br"),O=w(),L=p("input"),j=w(),K=p("div"),q=M(U),y=M(`: L1, L2 & L3 - `),Z=p("div"),G=p("input"),Y=w(),V=p("input"),B=w(),H=p("input"),r(l,"class","text-sm"),r(a,"href",bl("MQTT-configuration#domoticz")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","o"),f.value="true",r(g,"name","oe"),r(g,"type","text"),r(g,"class","in-f tr w-full"),r(g,"pattern",Xn),r(_,"class","w-1/2"),r(L,"name","oc"),r(L,"type","text"),r(L,"class","in-l tr w-full"),r(L,"pattern",Xn),r(C,"class","w-1/2"),r(m,"class","my-1 flex"),r(G,"name","ou1"),r(G,"type","text"),r(G,"class","in-f tr w-1/3"),r(G,"pattern",Xn),r(V,"name","ou2"),r(V,"type","text"),r(V,"class","in-m tr w-1/3"),r(V,"pattern",Xn),r(H,"name","ou3"),r(H,"type","text"),r(H,"class","in-l tr w-1/3"),r(H,"pattern",Xn),r(Z,"class","flex"),r(K,"class","my-1"),r(e,"class","cnt")},m(P,F){T(P,e,F),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,b),s(_,d),s(_,h),s(_,g),z(g,t[6].o.e),s(m,k),s(m,C),s(C,R),s(C,E),s(C,O),s(C,L),z(L,t[6].o.c),s(e,j),s(e,K),s(K,q),s(K,y),s(K,Z),s(Z,G),z(G,t[6].o.u1),s(Z,Y),s(Z,V),z(V,t[6].o.u2),s(Z,B),s(Z,H),z(H,t[6].o.u3),ne||(ee=[ce(g,"input",t[85]),ce(L,"input",t[86]),ce(G,"input",t[87]),ce(V,"input",t[88]),ce(H,"input",t[89])],ne=!0)},p(P,F){var A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De;F[0]&4&&n!==(n=(((te=(W=(A=P[2].conf)==null?void 0:A.mqtt)==null?void 0:W.domoticz)==null?void 0:te.title)??"Domoticz")+"")&&D(i,n),F[0]&4&&v!==(v=(((ke=(be=(re=P[2].conf)==null?void 0:re.mqtt)==null?void 0:be.domoticz)==null?void 0:ke.eidx)??"Electricity IDX")+"")&&D(b,v),F[0]&64&&g.value!==P[6].o.e&&z(g,P[6].o.e),F[0]&4&&I!==(I=(((ge=(ve=(J=P[2].conf)==null?void 0:J.mqtt)==null?void 0:ve.domoticz)==null?void 0:ge.cidx)??"Current IDX")+"")&&D(R,I),F[0]&64&&L.value!==P[6].o.c&&z(L,P[6].o.c),F[0]&4&&U!==(U=(((De=(Ie=(Ne=P[2].conf)==null?void 0:Ne.mqtt)==null?void 0:Ie.domoticz)==null?void 0:De.vidx)??"Voltage IDX")+"")&&D(q,U),F[0]&64&&G.value!==P[6].o.u1&&z(G,P[6].o.u1),F[0]&64&&V.value!==P[6].o.u2&&z(V,P[6].o.u2),F[0]&64&&H.value!==P[6].o.u3&&z(H,P[6].o.u3)},d(P){P&&N(e),ne=!1,Ut(ee)}}}function Ia(t){var B,H,ne,ee,Q,ie,ue,fe,le,de,oe,me;let e,l,n=(((ne=(H=(B=t[2].conf)==null?void 0:B.mqtt)==null?void 0:H.ha)==null?void 0:ne.title)??"Home-Assistant")+"",i,o,a,u,f,c,m,_=(((ie=(Q=(ee=t[2].conf)==null?void 0:ee.mqtt)==null?void 0:Q.ha)==null?void 0:ie.discovery)??"Discovery topic prefix")+"",v,b,d,h,g,k,C=(((le=(fe=(ue=t[2].conf)==null?void 0:ue.mqtt)==null?void 0:fe.ha)==null?void 0:le.hostname)??"Hostname for URL")+"",I,R,E,O,L,j,K,U=(((me=(oe=(de=t[2].conf)==null?void 0:de.mqtt)==null?void 0:oe.ha)==null?void 0:me.tag)??"Name tag")+"",q,y,Z,G,Y,V;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),v=M(_),b=p("br"),d=w(),h=p("input"),g=w(),k=p("div"),I=M(C),R=p("br"),E=w(),O=p("input"),j=w(),K=p("div"),q=M(U),y=p("br"),Z=w(),G=p("input"),r(l,"class","text-sm"),r(a,"href",bl("MQTT-configuration#home-assistant")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","h"),f.value="true",r(h,"name","ht"),r(h,"type","text"),r(h,"class","in-s"),r(h,"placeholder","homeassistant"),r(h,"pattern",Ol),r(m,"class","my-1"),r(O,"name","hh"),r(O,"type","text"),r(O,"class","in-s"),r(O,"placeholder",L=t[6].g.h+".local"),r(O,"pattern",Ol),r(k,"class","my-1"),r(G,"name","hn"),r(G,"type","text"),r(G,"class","in-s"),r(G,"pattern",Ol),r(K,"class","my-1"),r(e,"class","cnt")},m(se,pe){T(se,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,v),s(m,b),s(m,d),s(m,h),z(h,t[6].h.t),s(e,g),s(e,k),s(k,I),s(k,R),s(k,E),s(k,O),z(O,t[6].h.h),s(e,j),s(e,K),s(K,q),s(K,y),s(K,Z),s(K,G),z(G,t[6].h.n),Y||(V=[ce(h,"input",t[90]),ce(O,"input",t[91]),ce(G,"input",t[92])],Y=!0)},p(se,pe){var we,S,P,F,A,W,te,re,be,ke,J,ve;pe[0]&4&&n!==(n=(((P=(S=(we=se[2].conf)==null?void 0:we.mqtt)==null?void 0:S.ha)==null?void 0:P.title)??"Home-Assistant")+"")&&D(i,n),pe[0]&4&&_!==(_=(((W=(A=(F=se[2].conf)==null?void 0:F.mqtt)==null?void 0:A.ha)==null?void 0:W.discovery)??"Discovery topic prefix")+"")&&D(v,_),pe[0]&64&&h.value!==se[6].h.t&&z(h,se[6].h.t),pe[0]&4&&C!==(C=(((be=(re=(te=se[2].conf)==null?void 0:te.mqtt)==null?void 0:re.ha)==null?void 0:be.hostname)??"Hostname for URL")+"")&&D(I,C),pe[0]&64&&L!==(L=se[6].g.h+".local")&&r(O,"placeholder",L),pe[0]&64&&O.value!==se[6].h.h&&z(O,se[6].h.h),pe[0]&4&&U!==(U=(((ve=(J=(ke=se[2].conf)==null?void 0:ke.mqtt)==null?void 0:J.ha)==null?void 0:ve.tag)??"Name tag")+"")&&D(q,U),pe[0]&64&&G.value!==se[6].h.n&&z(G,se[6].h.n)},d(se){se&&N(e),Y=!1,Ut(V)}}}function Ea(t){var q,y,Z,G,Y,V,B,H,ne,ee;let e,l,n=(((y=(q=t[2].conf)==null?void 0:q.cloud)==null?void 0:y.title)??"Cloud connections")+"",i,o,a,u,f,c,m=(G=(Z=t[0])==null?void 0:Z.features)==null?void 0:G.includes("cloud"),_,v,b,d,h,g=(((V=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:V.es)??"Energy Speedometer")+"",k,C,I,R=(H=(B=t[0])==null?void 0:B.features)==null?void 0:H.includes("zc"),E,O,L,j=m&&Na(t),K=((ee=(ne=t[6])==null?void 0:ne.c)==null?void 0:ee.es)&&Aa(t),U=R&&Oa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),j&&j.c(),_=w(),v=p("div"),b=p("label"),d=p("input"),h=w(),k=M(g),C=w(),K&&K.c(),I=w(),U&&U.c(),r(l,"class","text-sm"),r(a,"href",bl("cloud-connections")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","c"),f.value="true",r(d,"type","checkbox"),r(d,"class","rounded mb-1"),r(d,"name","ces"),d.__value="true",z(d,d.__value),r(v,"class","my-1"),r(e,"class","cnt")},m(Q,ie){T(Q,e,ie),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),j&&j.m(e,null),s(e,_),s(e,v),s(v,b),s(b,d),d.checked=t[6].c.es,s(b,h),s(b,k),s(v,C),K&&K.m(v,null),s(e,I),U&&U.m(e,null),E=!0,O||(L=ce(d,"change",t[95]),O=!0)},p(Q,ie){var ue,fe,le,de,oe,me,se,pe,we,S;(!E||ie[0]&4)&&n!==(n=(((fe=(ue=Q[2].conf)==null?void 0:ue.cloud)==null?void 0:fe.title)??"Cloud connections")+"")&&D(i,n),ie[0]&1&&(m=(de=(le=Q[0])==null?void 0:le.features)==null?void 0:de.includes("cloud")),m?j?j.p(Q,ie):(j=Na(Q),j.c(),j.m(e,_)):j&&(j.d(1),j=null),ie[0]&64&&(d.checked=Q[6].c.es),(!E||ie[0]&4)&&g!==(g=(((me=(oe=Q[2].conf)==null?void 0:oe.cloud)==null?void 0:me.es)??"Energy Speedometer")+"")&&D(k,g),(pe=(se=Q[6])==null?void 0:se.c)!=null&&pe.es?K?(K.p(Q,ie),ie[0]&64&&X(K,1)):(K=Aa(Q),K.c(),X(K,1),K.m(v,null)):K&&(ct(),x(K,1,1,()=>{K=null}),_t()),ie[0]&1&&(R=(S=(we=Q[0])==null?void 0:we.features)==null?void 0:S.includes("zc")),R?U?U.p(Q,ie):(U=Oa(Q),U.c(),U.m(e,null)):U&&(U.d(1),U=null)},i(Q){E||(X(K),E=!0)},o(Q){x(K),E=!1},d(Q){Q&&N(e),j&&j.d(),K&&K.d(),U&&U.d(),O=!1,L()}}}function Na(t){var _,v;let e,l,n,i,o=(((v=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:v.ams)??"AMS reader cloud")+"",a,u,f,c,m=t[6].c.e&&Ta(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=w(),a=M(o),u=w(),m&&m.c(),r(n,"type","checkbox"),r(n,"name","ce"),n.__value="true",z(n,n.__value),r(n,"class","rounded mb-1"),r(e,"class","my-1")},m(b,d){T(b,e,d),s(e,l),s(l,n),n.checked=t[6].c.e,s(l,i),s(l,a),s(e,u),m&&m.m(e,null),f||(c=ce(n,"change",t[93]),f=!0)},p(b,d){var h,g;d[0]&64&&(n.checked=b[6].c.e),d[0]&4&&o!==(o=(((g=(h=b[2].conf)==null?void 0:h.cloud)==null?void 0:g.ams)??"AMS reader cloud")+"")&&D(a,o),b[6].c.e?m?m.p(b,d):(m=Ta(b),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(b){b&&N(e),m&&m.d(),f=!1,c()}}}function Ta(t){let e,l,n,i,o,a,u,f,c,m,_=t[6].c.p==0&&qa(),v=t[5]&&Da(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=w(),i=p("select"),_&&_.c(),o=p("option"),o.textContent="TCP",a=p("option"),a.textContent="HTTP",u=w(),v&&v.c(),f=Wt(),r(l,"for","cp"),o.__value=1,z(o,o.__value),a.__value=2,z(a,a.__value),r(i,"name","cp"),r(i,"class","in-s"),t[6].c.p===void 0&&Mt(()=>t[94].call(i)),r(e,"class","ml-6")},m(b,d){T(b,e,d),s(e,l),s(e,n),s(e,i),_&&_.m(i,null),s(i,o),s(i,a),Be(i,t[6].c.p,!0),T(b,u,d),v&&v.m(b,d),T(b,f,d),c||(m=ce(i,"change",t[94]),c=!0)},p(b,d){b[6].c.p==0?_||(_=qa(),_.c(),_.m(i,o)):_&&(_.d(1),_=null),d[0]&64&&Be(i,b[6].c.p),b[5]?v?v.p(b,d):(v=Da(b),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},d(b){b&&(N(e),N(u),N(f)),_&&_.d(),v&&v.d(b),c=!1,m()}}}function qa(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,z(e,e.__value),r(e,"title","No longer recommended")},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function Da(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",r(e,"type","button"),r(e,"class","text-blue-500 ml-6")},m(i,o){T(i,e,o),l||(n=ce(e,"click",t[23]),l=!0)},p:ze,d(i){i&&N(e),l=!1,n()}}}function Aa(t){let e,l,n=t[0].mac+"",i,o,a,u,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,v,b=t[0].mac&&t[0].meter.id&&Ra(t);return{c(){e=p("div"),l=M("MAC: "),i=M(n),o=w(),a=p("div"),u=M("Meter ID: "),c=M(f),m=w(),b&&b.c(),_=Wt(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,h){T(d,e,h),s(e,l),s(e,i),T(d,o,h),T(d,a,h),s(a,u),s(a,c),T(d,m,h),b&&b.m(d,h),T(d,_,h),v=!0},p(d,h){(!v||h[0]&1)&&n!==(n=d[0].mac+"")&&D(i,n),(!v||h[0]&1)&&f!==(f=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&D(c,f),d[0].mac&&d[0].meter.id?b?(b.p(d,h),h[0]&1&&X(b,1)):(b=Ra(d),b.c(),X(b,1),b.m(_.parentNode,_)):b&&(ct(),x(b,1,1,()=>{b=null}),_t())},i(d){v||(X(b),v=!0)},o(d){x(b),v=!1},d(d){d&&(N(e),N(o),N(a),N(m),N(_)),b&&b.d(d)}}}function Ra(t){let e,l,n;return l=new D1({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Se(l.$$.fragment),r(e,"class","pl-2")},m(i,o){T(i,e,o),Ce(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){x(l.$$.fragment,i),n=!1},d(i){i&&N(e),Pe(l)}}}function Oa(t){let e,l,n,i,o,a,u,f,c=t[6].c.ze&&La(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=M(" ZmartCharge"),o=w(),c&&c.c(),a=Wt(),r(n,"type","checkbox"),r(n,"name","cze"),n.__value="true",z(n,n.__value),r(n,"class","rounded mb-1"),r(e,"class","my-1")},m(m,_){T(m,e,_),s(e,l),s(l,n),n.checked=t[6].c.ze,s(l,i),T(m,o,_),c&&c.m(m,_),T(m,a,_),u||(f=ce(n,"change",t[96]),u=!0)},p(m,_){_[0]&64&&(n.checked=m[6].c.ze),m[6].c.ze?c?c.p(m,_):(c=La(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(N(e),N(o),N(a)),c&&c.d(m),u=!1,f()}}}function La(t){let e,l,n,i;return{c(){e=p("div"),l=p("input"),r(l,"name","czt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ZmartCharge token"),r(e,"class","my-1")},m(o,a){T(o,e,a),s(e,l),z(l,t[6].c.zt),n||(i=ce(l,"input",t[97]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].c.zt&&z(l,o[6].c.zt)},d(o){o&&N(e),n=!1,i()}}}function Fa(t){var U,q,y,Z,G;let e,l,n=(((q=(U=t[2].conf)==null?void 0:U.thresholds)==null?void 0:q.title)??"Thresholds")+"",i,o,a,u,f,c,m,_,v,b,d=(((Z=(y=t[2].conf)==null?void 0:y.thresholds)==null?void 0:Z.avg)??"Average of")+"",h,g,k,C,I,R=(((G=t[2].common)==null?void 0:G.hours)??"hours")+"",E,O,L,j=ft({length:9}),K=[];for(let Y=0;Yt[101].call(g)),r(v,"class","w-1/2"),r(m,"class","flex flex-wrap"),r(e,"class","cnt")},m(q,y){T(q,e,y),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m);for(let Z=0;Z20&&Ha(t),d=((E=(R=(I=t[6])==null?void 0:I.i)==null?void 0:R.d)==null?void 0:E.d)>0&&Ga(t),h=m&&Ka(t),g=t[0].chip=="esp8266"&&Ya(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),b&&b.c(),f=w(),d&&d.c(),c=w(),h&&h.c(),_=w(),g&&g.c(),r(l,"class","text-sm"),r(a,"href",bl("hardware")),r(a,"target","_blank"),r(a,"class","float-right"),r(e,"class","cnt")},m(O,L){T(O,e,L),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),b&&b.m(e,null),s(e,f),d&&d.m(e,null),s(e,c),h&&h.m(e,null),s(e,_),g&&g.m(e,null),v=!0},p(O,L){var j,K,U,q,y;(!v||L[0]&4)&&n!==(n=(((K=(j=O[2].conf)==null?void 0:j.hw)==null?void 0:K.title)??"Hardware")+"")&&D(i,n),O[0].board>20?b?(b.p(O,L),L[0]&1&&X(b,1)):(b=Ha(O),b.c(),X(b,1),b.m(e,f)):b&&(ct(),x(b,1,1,()=>{b=null}),_t()),((y=(q=(U=O[6])==null?void 0:U.i)==null?void 0:q.d)==null?void 0:y.d)>0?d?d.p(O,L):(d=Ga(O),d.c(),d.m(e,c)):d&&(d.d(1),d=null),L[0]&1&&(m=cn(O[0].board)),m?h?h.p(O,L):(h=Ka(O),h.c(),h.m(e,_)):h&&(h.d(1),h=null),O[0].chip=="esp8266"?g?g.p(O,L):(g=Ya(O),g.c(),g.m(e,null)):g&&(g.d(1),g=null)},i(O){v||(X(b),v=!0)},o(O){x(b),v=!1},d(O){O&&N(e),b&&b.d(),d&&d.d(),h&&h.d(),g&&g.d()}}}function Ha(t){var yt,el,pt,nt,Qt,Jt,Ot,Zt,$t,Vt,Xt,ll,Ye,st,St,Lt,kt,gt,zt,et,Ft,he,Oe,He,Gt,Kt,wt,cl,ol,jt,Ht,rl,Te;let e,l,n,i,o=(((pt=(el=(yt=t[2].conf)==null?void 0:yt.hw)==null?void 0:el.han)==null?void 0:pt.rx)??"HAN RX")+"",a,u,f,c,m,_,v,b=(((Jt=(Qt=(nt=t[2].conf)==null?void 0:nt.hw)==null?void 0:Qt.han)==null?void 0:Jt.tx)??"HAN TX")+"",d,h,g,k,C,I,R,E,O,L,j=((($t=(Zt=(Ot=t[2].conf)==null?void 0:Ot.hw)==null?void 0:Zt.han)==null?void 0:$t.pullup)??"pullup")+"",K,U,q,y,Z=(((Xt=(Vt=t[2].conf)==null?void 0:Vt.hw)==null?void 0:Xt.ap_btn)??"AP button")+"",G,Y,V,B,H,ne,ee=(((st=(Ye=(ll=t[2].conf)==null?void 0:ll.hw)==null?void 0:Ye.led)==null?void 0:st.title)??"LED")+"",Q,ie,ue,fe,le,de,oe,me,se,pe,we=(((kt=(Lt=(St=t[2].conf)==null?void 0:St.hw)==null?void 0:Lt.led)==null?void 0:kt.inverted)??"inverted")+"",S,P,F,A=(((et=(zt=(gt=t[2].conf)==null?void 0:gt.hw)==null?void 0:zt.led)==null?void 0:et.rgb)??"RGB")+"",W,te,re,be,ke=(((Oe=(he=(Ft=t[2].conf)==null?void 0:Ft.hw)==null?void 0:he.led)==null?void 0:Oe.inverted)??"inverted")+"",J,ve,ge,Ne,Ie,De,Ae,Me,qe,Le,$e,xe,rt=(((Kt=(Gt=(He=t[2].conf)==null?void 0:He.hw)==null?void 0:Gt.led)==null?void 0:Kt.disable)??"LED dis. GPIO")+"",Pt,dt,ut,ot,ht,Rt=(((cl=(wt=t[2].conf)==null?void 0:wt.hw)==null?void 0:cl.temp)??"Temperature")+"",Je,Fe,je,tt,Ve,Ge,Qe=(((jt=(ol=t[2].conf)==null?void 0:ol.hw)==null?void 0:jt.temp_analog)??"Analog temp")+"",_e,ae,Ee,Ke,Tt,vt,Xe,Nt,at;m=new to({props:{chip:t[0].chip}}),C=new to({props:{chip:t[0].chip}});let mt=t[0].chip!="esp8266"&&Wa(t),lt=((Te=(rl=(Ht=t[6])==null?void 0:Ht.i)==null?void 0:rl.v)==null?void 0:Te.p)>0&&Va(t);return{c(){e=p("input"),l=w(),n=p("div"),i=p("div"),a=M(o),u=p("br"),f=w(),c=p("select"),Se(m.$$.fragment),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("select"),Se(C.$$.fragment),I=w(),R=p("div"),E=p("label"),O=p("input"),L=w(),K=M(j),U=w(),q=p("div"),y=p("div"),G=M(Z),Y=p("br"),V=w(),B=p("input"),H=w(),ne=p("div"),Q=M(ee),ie=p("br"),ue=w(),fe=p("div"),le=p("input"),de=w(),oe=p("div"),me=p("label"),se=p("input"),pe=w(),S=M(we),P=w(),F=p("div"),W=M(A),te=p("label"),re=p("input"),be=w(),J=M(ke),ve=p("br"),ge=w(),Ne=p("div"),Ie=p("input"),De=w(),Ae=p("input"),Me=w(),qe=p("input"),Le=w(),$e=p("div"),xe=p("div"),Pt=M(rt),dt=w(),ut=p("input"),ot=w(),ht=p("div"),Je=M(Rt),Fe=p("br"),je=w(),tt=p("input"),Ve=w(),Ge=p("div"),_e=M(Qe),ae=p("br"),Ee=w(),Ke=p("input"),Tt=w(),mt&&mt.c(),vt=w(),lt&<.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(c,"name","ihp"),r(c,"class","in-f w-full"),t[6].i.h.p===void 0&&Mt(()=>t[102].call(c)),r(i,"class","w-1/3"),r(k,"name","iht"),r(k,"class","in-l w-full"),t[6].i.h.t===void 0&&Mt(()=>t[103].call(k)),r(v,"class","w-1/3"),r(O,"name","ihu"),O.__value="true",z(O,O.__value),r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(E,"class","ml-2"),r(R,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(B,"name","ia"),r(B,"type","number"),r(B,"min","0"),r(B,"max",t[12]),r(B,"class","in-f tr w-full"),r(y,"class","w-1/3"),r(le,"name","ilp"),r(le,"type","number"),r(le,"min","0"),r(le,"max",t[12]),r(le,"class","in-l tr w-full"),r(fe,"class","flex"),r(ne,"class","w-1/3"),r(se,"name","ili"),se.__value="true",z(se,se.__value),r(se,"type","checkbox"),r(se,"class","rounded mb-1"),r(me,"class","ml-4"),r(oe,"class","w-1/3"),r(re,"name","iri"),re.__value="true",z(re,re.__value),r(re,"type","checkbox"),r(re,"class","rounded mb-1"),r(te,"class","ml-4"),r(Ie,"name","irr"),r(Ie,"type","number"),r(Ie,"min","0"),r(Ie,"max",t[12]),r(Ie,"class","in-f tr w-1/3"),r(Ae,"name","irg"),r(Ae,"type","number"),r(Ae,"min","0"),r(Ae,"max",t[12]),r(Ae,"class","in-m tr w-1/3"),r(qe,"name","irb"),r(qe,"type","number"),r(qe,"min","0"),r(qe,"max",t[12]),r(qe,"class","in-l tr w-1/3"),r(Ne,"class","flex"),r(F,"class","w-full"),r(ut,"name","idd"),r(ut,"type","number"),r(ut,"min","0"),r(ut,"max",t[12]),r(ut,"class","in-s tr"),r(xe,"class","my-1 pr-1 w-1/3"),r($e,"class","w-full"),r(tt,"name","itd"),r(tt,"type","number"),r(tt,"min","0"),r(tt,"max",t[12]),r(tt,"class","in-f tr w-full"),r(ht,"class","my-1 w-1/3"),r(Ke,"name","ita"),r(Ke,"type","number"),r(Ke,"min","0"),r(Ke,"max",t[12]),r(Ke,"class","in-l tr w-full"),r(Ge,"class","my-1 pr-1 w-1/3"),r(q,"class","flex flex-wrap")},m($,Re){T($,e,Re),T($,l,Re),T($,n,Re),s(n,i),s(i,a),s(i,u),s(i,f),s(i,c),Ce(m,c,null),Be(c,t[6].i.h.p,!0),s(n,_),s(n,v),s(v,d),s(v,h),s(v,g),s(v,k),Ce(C,k,null),Be(k,t[6].i.h.t,!0),s(n,I),s(n,R),s(R,E),s(E,O),O.checked=t[6].i.h.u,s(E,L),s(E,K),T($,U,Re),T($,q,Re),s(q,y),s(y,G),s(y,Y),s(y,V),s(y,B),z(B,t[6].i.a),s(q,H),s(q,ne),s(ne,Q),s(ne,ie),s(ne,ue),s(ne,fe),s(fe,le),z(le,t[6].i.l.p),s(q,de),s(q,oe),s(oe,me),s(me,se),se.checked=t[6].i.l.i,s(me,pe),s(me,S),s(q,P),s(q,F),s(F,W),s(F,te),s(te,re),re.checked=t[6].i.r.i,s(te,be),s(te,J),s(F,ve),s(F,ge),s(F,Ne),s(Ne,Ie),z(Ie,t[6].i.r.r),s(Ne,De),s(Ne,Ae),z(Ae,t[6].i.r.g),s(Ne,Me),s(Ne,qe),z(qe,t[6].i.r.b),s(q,Le),s(q,$e),s($e,xe),s(xe,Pt),s(xe,dt),s(xe,ut),z(ut,t[6].i.d.d),s(q,ot),s(q,ht),s(ht,Je),s(ht,Fe),s(ht,je),s(ht,tt),z(tt,t[6].i.t.d),s(q,Ve),s(q,Ge),s(Ge,_e),s(Ge,ae),s(Ge,Ee),s(Ge,Ke),z(Ke,t[6].i.t.a),s(q,Tt),mt&&mt.m(q,null),s(q,vt),lt&<.m(q,null),Xe=!0,Nt||(at=[ce(c,"change",t[102]),ce(k,"change",t[103]),ce(O,"change",t[104]),ce(B,"input",t[105]),ce(le,"input",t[106]),ce(se,"change",t[107]),ce(re,"change",t[108]),ce(Ie,"input",t[109]),ce(Ae,"input",t[110]),ce(qe,"input",t[111]),ce(ut,"input",t[112]),ce(tt,"input",t[113]),ce(Ke,"input",t[114])],Nt=!0)},p($,Re){var qt,al,ml,vl,fl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl,We,bt,Ue,Dt,il,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Xe||Re[0]&4)&&o!==(o=(((ml=(al=(qt=$[2].conf)==null?void 0:qt.hw)==null?void 0:al.han)==null?void 0:ml.rx)??"HAN RX")+"")&&D(a,o);const _l={};Re[0]&1&&(_l.chip=$[0].chip),m.$set(_l),Re[0]&64&&Be(c,$[6].i.h.p),(!Xe||Re[0]&4)&&b!==(b=(((gl=(fl=(vl=$[2].conf)==null?void 0:vl.hw)==null?void 0:fl.han)==null?void 0:gl.tx)??"HAN TX")+"")&&D(d,b);const it={};Re[0]&1&&(it.chip=$[0].chip),C.$set(it),Re[0]&64&&Be(k,$[6].i.h.t),Re[0]&64&&(O.checked=$[6].i.h.u),(!Xe||Re[0]&4)&&j!==(j=(((Fl=(Ll=(kl=$[2].conf)==null?void 0:kl.hw)==null?void 0:Ll.han)==null?void 0:Fl.pullup)??"pullup")+"")&&D(K,j),(!Xe||Re[0]&4)&&Z!==(Z=(((Bl=(yl=$[2].conf)==null?void 0:yl.hw)==null?void 0:Bl.ap_btn)??"AP button")+"")&&D(G,Z),(!Xe||Re[0]&4096)&&r(B,"max",$[12]),Re[0]&64&&ye(B.value)!==$[6].i.a&&z(B,$[6].i.a),(!Xe||Re[0]&4)&&ee!==(ee=(((jl=(zl=(Ul=$[2].conf)==null?void 0:Ul.hw)==null?void 0:zl.led)==null?void 0:jl.title)??"LED")+"")&&D(Q,ee),(!Xe||Re[0]&4096)&&r(le,"max",$[12]),Re[0]&64&&ye(le.value)!==$[6].i.l.p&&z(le,$[6].i.l.p),Re[0]&64&&(se.checked=$[6].i.l.i),(!Xe||Re[0]&4)&&we!==(we=(((Vl=(Wl=(Hl=$[2].conf)==null?void 0:Hl.hw)==null?void 0:Wl.led)==null?void 0:Vl.inverted)??"inverted")+"")&&D(S,we),(!Xe||Re[0]&4)&&A!==(A=(((Yl=(Kl=(Gl=$[2].conf)==null?void 0:Gl.hw)==null?void 0:Kl.led)==null?void 0:Yl.rgb)??"RGB")+"")&&D(W,A),Re[0]&64&&(re.checked=$[6].i.r.i),(!Xe||Re[0]&4)&&ke!==(ke=(((Ue=(bt=(We=$[2].conf)==null?void 0:We.hw)==null?void 0:bt.led)==null?void 0:Ue.inverted)??"inverted")+"")&&D(J,ke),(!Xe||Re[0]&4096)&&r(Ie,"max",$[12]),Re[0]&64&&ye(Ie.value)!==$[6].i.r.r&&z(Ie,$[6].i.r.r),(!Xe||Re[0]&4096)&&r(Ae,"max",$[12]),Re[0]&64&&ye(Ae.value)!==$[6].i.r.g&&z(Ae,$[6].i.r.g),(!Xe||Re[0]&4096)&&r(qe,"max",$[12]),Re[0]&64&&ye(qe.value)!==$[6].i.r.b&&z(qe,$[6].i.r.b),(!Xe||Re[0]&4)&&rt!==(rt=(((Ql=(il=(Dt=$[2].conf)==null?void 0:Dt.hw)==null?void 0:il.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&D(Pt,rt),(!Xe||Re[0]&4096)&&r(ut,"max",$[12]),Re[0]&64&&ye(ut.value)!==$[6].i.d.d&&z(ut,$[6].i.d.d),(!Xe||Re[0]&4)&&Rt!==(Rt=(((Zl=(Xl=$[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&D(Je,Rt),(!Xe||Re[0]&4096)&&r(tt,"max",$[12]),Re[0]&64&&ye(tt.value)!==$[6].i.t.d&&z(tt,$[6].i.t.d),(!Xe||Re[0]&4)&&Qe!==(Qe=((($l=(Jl=$[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&D(_e,Qe),(!Xe||Re[0]&4096)&&r(Ke,"max",$[12]),Re[0]&64&&ye(Ke.value)!==$[6].i.t.a&&z(Ke,$[6].i.t.a),$[0].chip!="esp8266"?mt?mt.p($,Re):(mt=Wa($),mt.c(),mt.m(q,vt)):mt&&(mt.d(1),mt=null),((tn=(en=(xl=$[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?lt?lt.p($,Re):(lt=Va($),lt.c(),lt.m(q,null)):lt&&(lt.d(1),lt=null)},i($){Xe||(X(m.$$.fragment,$),X(C.$$.fragment,$),Xe=!0)},o($){x(m.$$.fragment,$),x(C.$$.fragment,$),Xe=!1},d($){$&&(N(e),N(l),N(n),N(U),N(q)),Pe(m),Pe(C),mt&&mt.d(),lt&<.d(),Nt=!1,Ut(at)}}}function Wa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","ivp"),r(a,"type","number"),r(a,"min","0"),r(a,"max",t[12]),r(a,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(v,b){T(v,e,b),s(e,n),s(e,i),s(e,o),s(e,a),z(a,t[6].i.v.p),u||(f=ce(a,"input",t[115]),u=!0)},p(v,b){var d,h,g;b[0]&4&&l!==(l=(((g=(h=(d=v[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.title)??"Vcc")+"")&&D(n,l),b[0]&4096&&r(a,"max",v[12]),b[0]&64&&ye(a.value)!==v[6].i.v.p&&z(a,v[6].i.v.p)},d(v){v&&N(e),u=!1,f()}}}function Va(t){var d,h,g;let e,l=(((g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.divider)??"Voltage divider")+"",n,i,o,a,u,f,c,m,_,v,b;return{c(){var k,C,I,R,E,O;e=p("div"),n=M(l),i=p("br"),o=w(),a=p("div"),u=p("input"),c=w(),m=p("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder",f=((I=(C=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:C.vcc)==null?void 0:I.div_vcc)??"VCC"),r(m,"name","ivdg"),r(m,"type","number"),r(m,"min","0"),r(m,"max","65535"),r(m,"class","in-l tr w-full"),r(m,"placeholder",_=((O=(E=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:E.vcc)==null?void 0:O.div_gnd)??"GND"),r(a,"class","flex"),r(e,"class","my-1")},m(k,C){T(k,e,C),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),z(u,t[6].i.v.d.v),s(a,c),s(a,m),z(m,t[6].i.v.d.g),v||(b=[ce(u,"input",t[116]),ce(m,"input",t[117])],v=!0)},p(k,C){var I,R,E,O,L,j,K,U,q;C[0]&4&&l!==(l=(((E=(R=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:R.vcc)==null?void 0:E.divider)??"Voltage divider")+"")&&D(n,l),C[0]&4&&f!==(f=((j=(L=(O=k[2].conf)==null?void 0:O.hw)==null?void 0:L.vcc)==null?void 0:j.div_vcc)??"VCC")&&r(u,"placeholder",f),C[0]&64&&ye(u.value)!==k[6].i.v.d.v&&z(u,k[6].i.v.d.v),C[0]&4&&_!==(_=((q=(U=(K=k[2].conf)==null?void 0:K.hw)==null?void 0:U.vcc)==null?void 0:q.div_gnd)??"GND")&&r(m,"placeholder",_),C[0]&64&&ye(m.value)!==k[6].i.v.d.g&&z(m,k[6].i.v.d.g)},d(k){k&&N(e),v=!1,Ut(b)}}}function Ga(t){var d,h,g,k,C,I,R,E,O,L,j,K;let e,l=(((k=(g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.led)==null?void 0:g.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,o,a,u=(((E=(R=(I=(C=t[2].conf)==null?void 0:C.hw)==null?void 0:I.led)==null?void 0:R.behaviour)==null?void 0:E.enabled)??"Enabled")+"",f,c,m=(((K=(j=(L=(O=t[2].conf)==null?void 0:O.hw)==null?void 0:L.led)==null?void 0:j.behaviour)==null?void 0:K.disabled)??"Disabled")+"",_,v,b;return{c(){e=p("div"),n=M(l),i=w(),o=p("select"),a=p("option"),f=M(u),c=p("option"),_=M(m),a.__value=0,z(a,a.__value),c.__value=1,z(c,c.__value),r(o,"name","idb"),r(o,"class","in-s"),t[6].i.d.b===void 0&&Mt(()=>t[118].call(o)),r(e,"class","my-1 w-full")},m(U,q){T(U,e,q),s(e,n),s(e,i),s(e,o),s(o,a),s(a,f),s(o,c),s(c,_),Be(o,t[6].i.d.b,!0),v||(b=ce(o,"change",t[118]),v=!0)},p(U,q){var y,Z,G,Y,V,B,H,ne,ee,Q,ie,ue;q[0]&4&&l!==(l=(((Y=(G=(Z=(y=U[2].conf)==null?void 0:y.hw)==null?void 0:Z.led)==null?void 0:G.behaviour)==null?void 0:Y.title)??"LED behaviour")+"")&&D(n,l),q[0]&4&&u!==(u=(((ne=(H=(B=(V=U[2].conf)==null?void 0:V.hw)==null?void 0:B.led)==null?void 0:H.behaviour)==null?void 0:ne.enabled)??"Enabled")+"")&&D(f,u),q[0]&4&&m!==(m=(((ue=(ie=(Q=(ee=U[2].conf)==null?void 0:ee.hw)==null?void 0:Q.led)==null?void 0:ie.behaviour)==null?void 0:ue.disabled)??"Disabled")+"")&&D(_,m),q[0]&64&&Be(o,U[6].i.d.b)},d(U){U&&N(e),v=!1,b()}}}function Ka(t){var _,v,b,d,h,g;let e,l,n,i=(((b=(v=(_=t[2].conf)==null?void 0:_.hw)==null?void 0:v.powersaving)==null?void 0:b[0])??"Normal")+"",o,a,u=(((g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.powersaving)==null?void 0:g[3])??"Extreme (Experimental)")+"",f,c,m;return{c(){e=M(`Power saving: - `),l=p("select"),n=p("option"),o=M(i),a=p("option"),f=M(u),n.__value=0,z(n,n.__value),a.__value=3,z(a,a.__value),r(l,"name","ip"),r(l,"class","in-s"),t[6].i.p===void 0&&Mt(()=>t[119].call(l))},m(k,C){T(k,e,C),T(k,l,C),s(l,n),s(n,o),s(l,a),s(a,f),Be(l,t[6].i.p,!0),c||(m=ce(l,"change",t[119]),c=!0)},p(k,C){var I,R,E,O,L,j;C[0]&4&&i!==(i=(((E=(R=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:R.powersaving)==null?void 0:E[0])??"Normal")+"")&&D(o,i),C[0]&4&&u!==(u=(((j=(L=(O=k[2].conf)==null?void 0:O.hw)==null?void 0:L.powersaving)==null?void 0:j[3])??"Extreme (Experimental)")+"")&&D(f,u),C[0]&64&&Be(l,k[6].i.p)},d(k){k&&(N(e),N(l)),c=!1,m()}}}function Ya(t){var E,O,L,j,K,U;let e,l,n,i,o=(((L=(O=(E=t[2].conf)==null?void 0:E.hw)==null?void 0:O.vcc)==null?void 0:L.offset)??"Vcc offset")+"",a,u,f,c,m,_,v=(((U=(K=(j=t[2].conf)==null?void 0:j.hw)==null?void 0:K.vcc)==null?void 0:U.multiplier)??"Multiplier")+"",b,d,h,g,k,C,I,R=(t[0].board==2||t[0].board==100)&&Qa(t);return{c(){e=p("input"),l=w(),n=p("div"),i=p("div"),a=M(o),u=p("br"),f=w(),c=p("input"),m=w(),_=p("div"),b=M(v),d=p("br"),h=w(),g=p("input"),k=w(),R&&R.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(g,"name","ivm"),r(g,"type","number"),r(g,"min","0.1"),r(g,"max","10"),r(g,"step","0.01"),r(g,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(q,y){T(q,e,y),T(q,l,y),T(q,n,y),s(n,i),s(i,a),s(i,u),s(i,f),s(i,c),z(c,t[6].i.v.o),s(n,m),s(n,_),s(_,b),s(_,d),s(_,h),s(_,g),z(g,t[6].i.v.m),s(n,k),R&&R.m(n,null),C||(I=[ce(c,"input",t[120]),ce(g,"input",t[121])],C=!0)},p(q,y){var Z,G,Y,V,B,H;y[0]&4&&o!==(o=(((Y=(G=(Z=q[2].conf)==null?void 0:Z.hw)==null?void 0:G.vcc)==null?void 0:Y.offset)??"Vcc offset")+"")&&D(a,o),y[0]&64&&ye(c.value)!==q[6].i.v.o&&z(c,q[6].i.v.o),y[0]&4&&v!==(v=(((H=(B=(V=q[2].conf)==null?void 0:V.hw)==null?void 0:B.vcc)==null?void 0:H.multiplier)??"Multiplier")+"")&&D(b,v),y[0]&64&&ye(g.value)!==q[6].i.v.m&&z(g,q[6].i.v.m),q[0].board==2||q[0].board==100?R?R.p(q,y):(R=Qa(q),R.c(),R.m(n,null)):R&&(R.d(1),R=null)},d(q){q&&(N(e),N(l),N(n)),R&&R.d(),C=!1,Ut(I)}}}function Qa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","ivb"),r(a,"type","number"),r(a,"min","2.5"),r(a,"max","3.5"),r(a,"step","0.1"),r(a,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(v,b){T(v,e,b),s(e,n),s(e,i),s(e,o),s(e,a),z(a,t[6].i.v.b),u||(f=ce(a,"input",t[122]),u=!0)},p(v,b){var d,h,g;b[0]&4&&l!==(l=(((g=(h=(d=v[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.boot)??"Boot limit")+"")&&D(n,l),b[0]&64&&ye(a.value)!==v[6].i.v.b&&z(a,v[6].i.v.b)},d(v){v&&N(e),u=!1,f()}}}function Xa(t){var R,E,O,L,j,K;let e,l,n=(((E=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:E.title)??"Debugging")+"",i,o,a,u,f,c,m,_,v,b,d=(((L=(O=t[2].conf)==null?void 0:O.debug)==null?void 0:L.enable)??"Enable debugging")+"",h,g,k,C,I=((K=(j=t[6])==null?void 0:j.d)==null?void 0:K.s)&&Za(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("label"),v=p("input"),b=w(),h=M(d),g=w(),I&&I.c(),r(l,"class","text-sm"),r(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","d"),f.value="true",r(v,"type","checkbox"),r(v,"name","ds"),v.__value="true",z(v,v.__value),r(v,"class","rounded mb-1"),r(m,"class","mt-3"),r(e,"class","cnt")},m(U,q){T(U,e,q),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),v.checked=t[6].d.s,s(_,b),s(_,h),s(e,g),I&&I.m(e,null),k||(C=ce(v,"change",t[123]),k=!0)},p(U,q){var y,Z,G,Y,V,B;q[0]&4&&n!==(n=(((Z=(y=U[2].conf)==null?void 0:y.debug)==null?void 0:Z.title)??"Debugging")+"")&&D(i,n),q[0]&64&&(v.checked=U[6].d.s),q[0]&4&&d!==(d=(((Y=(G=U[2].conf)==null?void 0:G.debug)==null?void 0:Y.enable)??"Enable debugging")+"")&&D(h,d),(B=(V=U[6])==null?void 0:V.d)!=null&&B.s?I?I.p(U,q):(I=Za(U),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(U){U&&N(e),I&&I.d(),k=!1,C()}}}function Za(t){var O,L,j,K;let e,l=(((L=(O=t[2].conf)==null?void 0:O.debug)==null?void 0:L.danger)??"Disable when done")+"",n,i,o,a,u,f,c=(((K=(j=t[2].conf)==null?void 0:j.debug)==null?void 0:K.telnet)??"Enable telnet")+"",m,_,v,b,d,h,g,k,C,I,R,E=t[6].d.t&&Ja(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("div"),a=p("label"),u=p("input"),f=w(),m=M(c),_=w(),E&&E.c(),v=w(),b=p("div"),d=p("select"),h=p("option"),h.textContent="Verbose",g=p("option"),g.textContent="Debug",k=p("option"),k.textContent="Info",C=p("option"),C.textContent="Warning",r(e,"class","bd-red"),r(u,"type","checkbox"),r(u,"name","dt"),u.__value="true",z(u,u.__value),r(u,"class","rounded mb-1"),r(o,"class","my-1"),h.__value=1,z(h,h.__value),g.__value=2,z(g,g.__value),k.__value=3,z(k,k.__value),C.__value=4,z(C,C.__value),r(d,"name","dl"),r(d,"class","in-s"),t[6].d.l===void 0&&Mt(()=>t[125].call(d)),r(b,"class","my-1")},m(U,q){T(U,e,q),s(e,n),T(U,i,q),T(U,o,q),s(o,a),s(a,u),u.checked=t[6].d.t,s(a,f),s(a,m),T(U,_,q),E&&E.m(U,q),T(U,v,q),T(U,b,q),s(b,d),s(d,h),s(d,g),s(d,k),s(d,C),Be(d,t[6].d.l,!0),I||(R=[ce(u,"change",t[124]),ce(d,"change",t[125])],I=!0)},p(U,q){var y,Z,G,Y;q[0]&4&&l!==(l=(((Z=(y=U[2].conf)==null?void 0:y.debug)==null?void 0:Z.danger)??"Disable when done")+"")&&D(n,l),q[0]&64&&(u.checked=U[6].d.t),q[0]&4&&c!==(c=(((Y=(G=U[2].conf)==null?void 0:G.debug)==null?void 0:Y.telnet)??"Enable telnet")+"")&&D(m,c),U[6].d.t?E?E.p(U,q):(E=Ja(U),E.c(),E.m(v.parentNode,v)):E&&(E.d(1),E=null),q[0]&64&&Be(d,U[6].d.l)},d(U){U&&(N(e),N(i),N(o),N(_),N(v),N(b)),E&&E.d(U),I=!1,Ut(R)}}}function Ja(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(a,u){T(a,e,u),s(e,n)},p(a,u){var f,c;u[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&D(n,l)},d(a){a&&N(e)}}}function $a(t){var v,b;let e,l,n=(((v=t[2].conf)==null?void 0:v.btn_reset)??"Factory reset")+"",i,o,a,u,f=(((b=t[2].btn)==null?void 0:b.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=M(n),o=w(),a=p("div"),u=p("button"),c=M(f),r(l,"type","button"),r(l,"class","btn-red"),r(u,"type","button"),r(u,"class","btn-yellow"),r(a,"class","text-center")},m(d,h){T(d,e,h),s(e,l),s(l,i),T(d,o,h),T(d,a,h),s(a,u),s(u,c),m||(_=[ce(l,"click",t[14]),ce(u,"click",t[16])],m=!0)},p(d,h){var g,k;h[0]&4&&n!==(n=(((g=d[2].conf)==null?void 0:g.btn_reset)??"Factory reset")+"")&&D(i,n),h[0]&4&&f!==(f=(((k=d[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&D(c,f)},d(d){d&&(N(e),N(o),N(a)),m=!1,Ut(_)}}}function xa(t){var o;let e,l,n=(((o=t[2].btn)==null?void 0:o.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=M(n),r(l,"type","submit"),r(l,"class","btn-pri"),r(e,"class","text-right")},m(a,u){T(a,e,u),s(e,l),s(l,i)},p(a,u){var f;u[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&D(i,n)},d(a){a&&N(e)}}}function t_(t){var me,se,pe,we,S,P,F,A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De,Ae,Me,qe,Le,$e,xe,rt,Pt,dt,ut,ot,ht,Rt,Je,Fe,je,tt,Ve,Ge,Qe;let e,l,n,i,o,a,u,f,c,m,_=((pe=(se=(me=t[6])==null?void 0:me.p)==null?void 0:se.r)==null?void 0:pe.startsWith("NO"))||((P=(S=(we=t[6])==null?void 0:we.p)==null?void 0:S.r)==null?void 0:P.startsWith("10YNO"))||((W=(A=(F=t[6])==null?void 0:F.p)==null?void 0:A.r)==null?void 0:W.startsWith("10Y1001A1001A4")),v,b,d,h=((te=t[6])==null?void 0:te.d)&&((be=(re=t[0])==null?void 0:re.features)==null?void 0:be.includes("rdebug")),g,k,C,I,R,E,O,L,j,K,U,q,y,Z,G=((ke=t[6])==null?void 0:ke.g)&&oa(t),Y=((J=t[6])==null?void 0:J.m)&&ra(t),V=((ve=t[6])==null?void 0:ve.w)&&pa(t),B=((ge=t[6])==null?void 0:ge.n)&&ka(t),H=((Ne=t[6])==null?void 0:Ne.q)&&Ca(t),ne=((De=(Ie=t[6])==null?void 0:Ie.q)==null?void 0:De.m)==3&&Ma(t),ee=((Me=(Ae=t[6])==null?void 0:Ae.q)==null?void 0:Me.m)==4&&Ia(t),Q=((qe=t[6])==null?void 0:qe.c)&&Ea(t),ie=_&&Fa(t),ue=((Le=t[6])==null?void 0:Le.u)&&Ba(t),fe=((xe=($e=t[6])==null?void 0:$e.i)==null?void 0:xe.h)&&(((rt=t[0])==null?void 0:rt.board)>20||((Pt=t[0])==null?void 0:Pt.chip)=="esp8266"||((ot=(ut=(dt=t[6])==null?void 0:dt.i)==null?void 0:ut.d)==null?void 0:ot.d)>0)&&ja(t),le=h&&Xa(t),de=((ht=t[1])==null?void 0:ht.a)&&$a(t),oe=t[6]&&xa(t);return R=new dl({props:{active:t[3],message:((Je=(Rt=t[2].conf)==null?void 0:Rt.mask)==null?void 0:Je.loading)??"Loading"}}),O=new dl({props:{active:t[4],message:((je=(Fe=t[2].conf)==null?void 0:Fe.mask)==null?void 0:je.saving)??"Saving"}}),j=new dl({props:{active:t[10],message:((Ve=(tt=t[2].conf)==null?void 0:tt.mask)==null?void 0:Ve.reset)??"Factory reset"}}),U=new dl({props:{active:t[11],message:((Qe=(Ge=t[2].conf)==null?void 0:Ge.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),G&&G.c(),n=w(),Y&&Y.c(),i=w(),V&&V.c(),o=w(),B&&B.c(),a=w(),H&&H.c(),u=w(),ne&&ne.c(),f=w(),ee&&ee.c(),c=w(),Q&&Q.c(),m=w(),ie&&ie.c(),v=w(),ue&&ue.c(),b=w(),fe&&fe.c(),d=w(),le&&le.c(),g=w(),k=p("div"),de&&de.c(),C=w(),oe&&oe.c(),I=w(),Se(R.$$.fragment),E=w(),Se(O.$$.fragment),L=w(),Se(j.$$.fragment),K=w(),Se(U.$$.fragment),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(k,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(_e,ae){T(_e,e,ae),s(e,l),G&&G.m(l,null),s(l,n),Y&&Y.m(l,null),s(l,i),V&&V.m(l,null),s(l,o),B&&B.m(l,null),s(l,a),H&&H.m(l,null),s(l,u),ne&&ne.m(l,null),s(l,f),ee&&ee.m(l,null),s(l,c),Q&&Q.m(l,null),s(l,m),ie&&ie.m(l,null),s(l,v),ue&&ue.m(l,null),s(l,b),fe&&fe.m(l,null),s(l,d),le&&le.m(l,null),s(e,g),s(e,k),de&&de.m(k,null),s(k,C),oe&&oe.m(k,null),T(_e,I,ae),Ce(R,_e,ae),T(_e,E,ae),Ce(O,_e,ae),T(_e,L,ae),Ce(j,_e,ae),T(_e,K,ae),Ce(U,_e,ae),q=!0,y||(Z=ce(e,"submit",dn(t[15])),y=!0)},p(_e,ae){var Xe,Nt,at,mt,lt,yt,el,pt,nt,Qt,Jt,Ot,Zt,$t,Vt,Xt,ll,Ye,st,St,Lt,kt,gt,zt,et,Ft,he,Oe,He,Gt,Kt,wt,cl,ol,jt,Ht,rl,Te,$;(Xe=_e[6])!=null&&Xe.g?G?(G.p(_e,ae),ae[0]&64&&X(G,1)):(G=oa(_e),G.c(),X(G,1),G.m(l,n)):G&&(ct(),x(G,1,1,()=>{G=null}),_t()),(Nt=_e[6])!=null&&Nt.m?Y?Y.p(_e,ae):(Y=ra(_e),Y.c(),Y.m(l,i)):Y&&(Y.d(1),Y=null),(at=_e[6])!=null&&at.w?V?V.p(_e,ae):(V=pa(_e),V.c(),V.m(l,o)):V&&(V.d(1),V=null),(mt=_e[6])!=null&&mt.n?B?(B.p(_e,ae),ae[0]&64&&X(B,1)):(B=ka(_e),B.c(),X(B,1),B.m(l,a)):B&&(ct(),x(B,1,1,()=>{B=null}),_t()),(lt=_e[6])!=null&<.q?H?(H.p(_e,ae),ae[0]&64&&X(H,1)):(H=Ca(_e),H.c(),X(H,1),H.m(l,u)):H&&(ct(),x(H,1,1,()=>{H=null}),_t()),((el=(yt=_e[6])==null?void 0:yt.q)==null?void 0:el.m)==3?ne?ne.p(_e,ae):(ne=Ma(_e),ne.c(),ne.m(l,f)):ne&&(ne.d(1),ne=null),((nt=(pt=_e[6])==null?void 0:pt.q)==null?void 0:nt.m)==4?ee?ee.p(_e,ae):(ee=Ia(_e),ee.c(),ee.m(l,c)):ee&&(ee.d(1),ee=null),(Qt=_e[6])!=null&&Qt.c?Q?(Q.p(_e,ae),ae[0]&64&&X(Q,1)):(Q=Ea(_e),Q.c(),X(Q,1),Q.m(l,m)):Q&&(ct(),x(Q,1,1,()=>{Q=null}),_t()),ae[0]&64&&(_=((Zt=(Ot=(Jt=_e[6])==null?void 0:Jt.p)==null?void 0:Ot.r)==null?void 0:Zt.startsWith("NO"))||((Xt=(Vt=($t=_e[6])==null?void 0:$t.p)==null?void 0:Vt.r)==null?void 0:Xt.startsWith("10YNO"))||((st=(Ye=(ll=_e[6])==null?void 0:ll.p)==null?void 0:Ye.r)==null?void 0:st.startsWith("10Y1001A1001A4"))),_?ie?ie.p(_e,ae):(ie=Fa(_e),ie.c(),ie.m(l,v)):ie&&(ie.d(1),ie=null),(St=_e[6])!=null&&St.u?ue?ue.p(_e,ae):(ue=Ba(_e),ue.c(),ue.m(l,b)):ue&&(ue.d(1),ue=null),(kt=(Lt=_e[6])==null?void 0:Lt.i)!=null&&kt.h&&(((gt=_e[0])==null?void 0:gt.board)>20||((zt=_e[0])==null?void 0:zt.chip)=="esp8266"||((he=(Ft=(et=_e[6])==null?void 0:et.i)==null?void 0:Ft.d)==null?void 0:he.d)>0)?fe?(fe.p(_e,ae),ae[0]&65&&X(fe,1)):(fe=ja(_e),fe.c(),X(fe,1),fe.m(l,d)):fe&&(ct(),x(fe,1,1,()=>{fe=null}),_t()),ae[0]&65&&(h=((Oe=_e[6])==null?void 0:Oe.d)&&((Gt=(He=_e[0])==null?void 0:He.features)==null?void 0:Gt.includes("rdebug"))),h?le?le.p(_e,ae):(le=Xa(_e),le.c(),le.m(l,null)):le&&(le.d(1),le=null),(Kt=_e[1])!=null&&Kt.a?de?de.p(_e,ae):(de=$a(_e),de.c(),de.m(k,C)):de&&(de.d(1),de=null),_e[6]?oe?oe.p(_e,ae):(oe=xa(_e),oe.c(),oe.m(k,null)):oe&&(oe.d(1),oe=null);const Ee={};ae[0]&8&&(Ee.active=_e[3]),ae[0]&4&&(Ee.message=((cl=(wt=_e[2].conf)==null?void 0:wt.mask)==null?void 0:cl.loading)??"Loading"),R.$set(Ee);const Ke={};ae[0]&16&&(Ke.active=_e[4]),ae[0]&4&&(Ke.message=((jt=(ol=_e[2].conf)==null?void 0:ol.mask)==null?void 0:jt.saving)??"Saving"),O.$set(Ke);const Tt={};ae[0]&1024&&(Tt.active=_e[10]),ae[0]&4&&(Tt.message=((rl=(Ht=_e[2].conf)==null?void 0:Ht.mask)==null?void 0:rl.reset)??"Factory reset"),j.$set(Tt);const vt={};ae[0]&2048&&(vt.active=_e[11]),ae[0]&4&&(vt.message=(($=(Te=_e[2].conf)==null?void 0:Te.mask)==null?void 0:$.reset_done)??"Done"),U.$set(vt)},i(_e){q||(X(G),X(B),X(H),X(Q),X(fe),X(R.$$.fragment,_e),X(O.$$.fragment,_e),X(j.$$.fragment,_e),X(U.$$.fragment,_e),q=!0)},o(_e){x(G),x(B),x(H),x(Q),x(fe),x(R.$$.fragment,_e),x(O.$$.fragment,_e),x(j.$$.fragment,_e),x(U.$$.fragment,_e),q=!1},d(_e){_e&&(N(e),N(I),N(E),N(L),N(K)),G&&G.d(),Y&&Y.d(),V&&V.d(),B&&B.d(),H&&H.d(),ne&&ne.d(),ee&&ee.d(),Q&&Q.d(),ie&&ie.d(),ue&&ue.d(),fe&&fe.d(),le&&le.d(),de&&de.d(),oe&&oe.d(),Pe(R,_e),Pe(O,_e),Pe(j,_e),Pe(U,_e),y=!1,Z()}}}async function l_(){await(await fetch("reboot",{method:"POST"})).json()}function n_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:o}=e,a={};Il.subscribe(it=>{l(2,a=it)});let u=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,v=[];Jn.subscribe(it=>{var qt,al,ml;it.version&&(l(5,m=(qt=it==null?void 0:it.c)==null?void 0:qt.e),l(6,_=it),l(3,f=!1),l(7,v=[{code:"en",name:"English"}]),(al=_==null?void 0:_.u)!=null&&al.lang&&_.u.lang!="en"&&v.push({code:_.u.lang,name:((ml=a.language)==null?void 0:ml.name)??"Unknown"}),v.push({code:"hub",name:"Load from server"}))}),v1();let b=!0,d={};_o.subscribe(it=>{var qt;l(8,b=!0);for(let al=0;al(fl.hostname=qt.get("gh"),fl.usrcfg=vl.success,fl.booting=vl.reboot,qt.get("nm")=="static"&&(fl.net.ip=qt.get("ni"),fl.net.mask=qt.get("nu"),fl.net.gw=qt.get("ng"),fl.net.dns1=qt.get("nd")),fl.ui=_.u,fl)),l(4,c=!1),nn(n)}const I=function(){confirm("Reboot?")&&(hl.update(it=>(it.booting=!0,it)),l_())};async function R(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Jn.update(qt=>(qt.q.s.c=!1,qt)))}async function E(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Jn.update(qt=>(qt.q.s.r=!1,qt)))}async function O(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Jn.update(qt=>(qt.q.s.k=!1,qt)))}const L=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function j(){if(_.u.lang=="hub"){const it=await Cl("http://hub.amsleser.no/hub/language/list.json");l(7,v=await it.json()),l(6,_.u.lang=a.language.code,_)}}async function K(){l(6,_.p.e=!0,_)}let U=44;async function q(){const it=await Cl("cloudkey.json");if(it.status==200){let qt=await it.json();window.open("https://www.amsleser.cloud/device/"+qt.seed)}else alert("Not able to bind to cloud")}const y=window||global;y.bindToCloud=function(){console.log("BIND CALLED")};function Z(){_.g.h=this.value,l(6,_)}function G(){_.g.t=Yt(this),l(6,_)}function Y(){_.p.r=Yt(this),l(6,_)}function V(){_.p.m=Yt(this),l(6,_)}function B(){_.p.c=Yt(this),l(6,_)}function H(){_.p.e=this.checked,l(6,_)}function ne(){_.p.t=this.value,l(6,_)}function ee(){_.g.s=Yt(this),l(6,_)}function Q(){_.g.u=this.value,l(6,_)}function ie(){_.g.p=this.value,l(6,_)}function ue(){_.g.c=this.value,l(6,_)}function fe(){_.m.a=Yt(this),l(6,_)}function le(){_.m.b=ye(this.value),l(6,_)}function de(){_.m.i=this.checked,l(6,_)}function oe(){_.m.b=Yt(this),l(6,_)}function me(){_.m.p=Yt(this),l(6,_)}function se(){_.m.s=ye(this.value),l(6,_)}function pe(){_.m.d=Yt(this),l(6,_)}function we(){_.m.f=ye(this.value),l(6,_)}function S(){_.m.r=ye(this.value),l(6,_)}function P(){_.m.e.e=this.checked,l(6,_)}function F(){_.m.e.k=this.value,l(6,_)}function A(){_.m.e.a=this.value,l(6,_)}function W(){_.m.m.e=this.checked,l(6,_)}function te(){_.m.m.w=ye(this.value),l(6,_)}function re(){_.m.m.v=ye(this.value),l(6,_)}function be(){_.m.m.a=ye(this.value),l(6,_)}function ke(){_.m.m.c=ye(this.value),l(6,_)}function J(){_.n.c=Yt(this),l(6,_)}function ve(){b=this.checked,l(8,b)}function ge(){_.w.s=this.value,l(6,_)}function Ne(){_.w.s=Yt(this),l(6,_)}function Ie(){_.w.p=this.value,l(6,_)}function De(){_.w.z=Yt(this),l(6,_)}function Ae(){_.w.w=ye(this.value),l(6,_)}function Me(){_.w.b=this.checked,l(6,_)}function qe(){_.n.m=Yt(this),l(6,_)}function Le(){_.n.i=this.value,l(6,_)}function $e(){_.n.s=Yt(this),l(6,_)}function xe(){_.n.g=this.value,l(6,_)}function rt(){_.n.d1=this.value,l(6,_)}function Pt(){_.n.d2=this.value,l(6,_)}function dt(){_.n.x=this.checked,l(6,_)}function ut(){_.n.d=this.checked,l(6,_)}function ot(){_.n.h=this.checked,l(6,_)}function ht(){_.n.n1=this.value,l(6,_)}function Rt(){_.q.s.e=this.checked,l(6,_)}function Je(){_.q.h=this.value,l(6,_)}function Fe(){_.q.p=ye(this.value),l(6,_)}function je(){_.q.u=this.value,l(6,_)}function tt(){_.q.a=this.value,l(6,_)}function Ve(){_.q.c=this.value,l(6,_)}function Ge(){_.q.m=Yt(this),l(6,_)}function Qe(){_.q.b=this.value,l(6,_)}function _e(){_.q.r=this.value,l(6,_)}function ae(){_.q.t=Yt(this),l(6,_)}function Ee(){_.q.d=ye(this.value),l(6,_)}function Ke(){_.q.i=ye(this.value),l(6,_)}function Tt(){_.q.k=ye(this.value),l(6,_)}function vt(){_.q.e=ye(this.value),l(6,_)}function Xe(){_.o.e=this.value,l(6,_)}function Nt(){_.o.c=this.value,l(6,_)}function at(){_.o.u1=this.value,l(6,_)}function mt(){_.o.u2=this.value,l(6,_)}function lt(){_.o.u3=this.value,l(6,_)}function yt(){_.h.t=this.value,l(6,_)}function el(){_.h.h=this.value,l(6,_)}function pt(){_.h.n=this.value,l(6,_)}function nt(){_.c.e=this.checked,l(6,_)}function Qt(){_.c.p=Yt(this),l(6,_)}function Jt(){_.c.es=this.checked,l(6,_)}function Ot(){_.c.ze=this.checked,l(6,_)}function Zt(){_.c.zt=this.value,l(6,_)}function $t(it){_.t.t[it]=ye(this.value),l(6,_)}function Vt(){_.t.h=ye(this.value),l(6,_)}function Xt(it){_.u[it.key]=Yt(this),l(6,_)}function ll(){_.u.lang=Yt(this),l(6,_)}function Ye(){_.i.h.p=Yt(this),l(6,_)}function st(){_.i.h.t=Yt(this),l(6,_)}function St(){_.i.h.u=this.checked,l(6,_)}function Lt(){_.i.a=ye(this.value),l(6,_)}function kt(){_.i.l.p=ye(this.value),l(6,_)}function gt(){_.i.l.i=this.checked,l(6,_)}function zt(){_.i.r.i=this.checked,l(6,_)}function et(){_.i.r.r=ye(this.value),l(6,_)}function Ft(){_.i.r.g=ye(this.value),l(6,_)}function he(){_.i.r.b=ye(this.value),l(6,_)}function Oe(){_.i.d.d=ye(this.value),l(6,_)}function He(){_.i.t.d=ye(this.value),l(6,_)}function Gt(){_.i.t.a=ye(this.value),l(6,_)}function Kt(){_.i.v.p=ye(this.value),l(6,_)}function wt(){_.i.v.d.v=ye(this.value),l(6,_)}function cl(){_.i.v.d.g=ye(this.value),l(6,_)}function ol(){_.i.d.b=Yt(this),l(6,_)}function jt(){_.i.p=Yt(this),l(6,_)}function Ht(){_.i.v.o=ye(this.value),l(6,_)}function rl(){_.i.v.m=ye(this.value),l(6,_)}function Te(){_.i.v.b=ye(this.value),l(6,_)}function $(){_.d.s=this.checked,l(6,_)}function Re(){_.d.t=this.checked,l(6,_)}function _l(){_.d.l=Yt(this),l(6,_)}return t.$$set=it=>{"basepath"in it&&l(24,n=it.basepath),"sysinfo"in it&&l(0,i=it.sysinfo),"data"in it&&l(1,o=it.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,U=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,a,f,c,m,_,v,b,d,h,g,U,u,k,C,I,R,E,O,L,j,K,q,n,Z,G,Y,V,B,H,ne,ee,Q,ie,ue,fe,le,de,oe,me,se,pe,we,S,P,F,A,W,te,re,be,ke,J,ve,ge,Ne,Ie,De,Ae,Me,qe,Le,$e,xe,rt,Pt,dt,ut,ot,ht,Rt,Je,Fe,je,tt,Ve,Ge,Qe,_e,ae,Ee,Ke,Tt,vt,Xe,Nt,at,mt,lt,yt,el,pt,nt,Qt,Jt,Ot,Zt,$t,Vt,Xt,ll,Ye,st,St,Lt,kt,gt,zt,et,Ft,he,Oe,He,Gt,Kt,wt,cl,ol,jt,Ht,rl,Te,$,Re,_l]}class i_ extends Et{constructor(e){super(),It(this,e,n_,t_,Ct,{basepath:24,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}var lu={exports:{}};(function(t){(function(e){const l="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${l}\\.${l}\\.${l}\\.${l}$`,"i"),threeOctet:new RegExp(`^${l}\\.${l}\\.${l}$`,"i"),twoOctet:new RegExp(`^${l}\\.${l}$`,"i"),longValue:new RegExp(`^${l}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${l}\\.${l}\\.${l}\\.${l}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${l}\\.${l}\\.${l}\\.${l}(${a})?$`,"i")};function c(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let g=0,k=-1,C=(d.match(f.zoneIndex)||[])[0],I,R;for(C&&(C=C.substring(1),d=d.replace(/%.+$/,""));(k=d.indexOf(":",k+1))>=0;)g++;if(d.substr(0,2)==="::"&&g--,d.substr(-2,2)==="::"&&g--,g>h)return null;for(R=h-g,I=":";R--;)I+="0:";return d=d.replace("::",I),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){const E=d.split(":"),O=[];for(let L=0;L0;){if(I=g-k,I<0&&(I=0),d[C]>>I!==h[C]>>I)return!1;k-=g,C+=1}return!0}function _(d){if(o.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(i.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function v(d,h){for(;d.length=0;C-=1)if(I=this.octets[C],I in k){if(R=k[I],g&&R!==0)return null;R!==8&&(g=!0),h+=R}else return null;return 32-h},d.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return b.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),b.IPv4.broadcastAddressFromCIDR=function(d){try{const h=this.parseCIDR(d),g=h[0].toByteArray(),k=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[];let I=0;for(;I<4;)C.push(parseInt(g[I],10)|parseInt(k[I],10)^255),I++;return new this(C)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.isIPv4=function(d){return this.parser(d)!==null},b.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},b.IPv4.isValidCIDR=function(d){try{return this.parseCIDR(d),!0}catch{return!1}},b.IPv4.isValidFourPartDecimal=function(d){return!!(b.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},b.IPv4.isValidCIDRFourPartDecimal=function(d){const h=d.match(/^(.+)\/(\d+)$/);return!b.IPv4.isValidCIDR(d)||!h?!1:b.IPv4.isValidFourPartDecimal(h[1])},b.IPv4.networkAddressFromCIDR=function(d){let h,g,k,C,I;try{for(h=this.parseCIDR(d),k=h[0].toByteArray(),I=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[],g=0;g<4;)C.push(parseInt(k[g],10)&parseInt(I[g],10)),g++;return new this(C)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.parse=function(d){const h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},b.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){const g=parseInt(h[2]);if(g>=0&&g<=32){const k=[this.parse(h[1]),g];return Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(d){let h,g,k;if(h=d.match(n.fourOctet))return function(){const C=h.slice(1,6),I=[];for(let R=0;R4294967295||k<0)throw new Error("ipaddr: address outside defined range");return function(){const C=[];let I;for(I=0;I<=24;I+=8)C.push(k>>I&255);return C}().reverse()}else return(h=d.match(n.twoOctet))?function(){const C=h.slice(1,4),I=[];if(k=_(C[1]),k>16777215||k<0)throw new Error("ipaddr: address outside defined range");return I.push(_(C[0])),I.push(k>>16&255),I.push(k>>8&255),I.push(k&255),I}():(h=d.match(n.threeOctet))?function(){const C=h.slice(1,5),I=[];if(k=_(C[2]),k>65535||k<0)throw new Error("ipaddr: address outside defined range");return I.push(_(C[0])),I.push(_(C[1])),I.push(k>>8&255),I.push(k&255),I}():null},b.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");const h=[0,0,0,0];let g=0;const k=Math.floor(d/8);for(;g=0;R-=1)if(C=this.parts[R],C in k){if(I=k[C],g&&I!==0)return null;I!==16&&(g=!0),h+=I}else return null;return 128-h},d.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h;const g=[],k=this.parts;for(let C=0;C>8),g.push(h&255);return g},d.prototype.toFixedLengthString=function(){const h=(function(){const k=[];for(let C=0;C>8,g&255,k>>8,k&255])},d.prototype.toNormalizedString=function(){const h=(function(){const k=[];for(let C=0;CC&&(k=I.index,C=I[0].length);return C<0?g:`${g.substring(0,k)}::${g.substring(k+C)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),b.IPv6.broadcastAddressFromCIDR=function(d){try{const h=this.parseCIDR(d),g=h[0].toByteArray(),k=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[];let I=0;for(;I<16;)C.push(parseInt(g[I],10)|parseInt(k[I],10)^255),I++;return new this(C)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},b.IPv6.isIPv6=function(d){return this.parser(d)!==null},b.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{const h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},b.IPv6.isValidCIDR=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{return this.parseCIDR(d),!0}catch{return!1}},b.IPv6.networkAddressFromCIDR=function(d){let h,g,k,C,I;try{for(h=this.parseCIDR(d),k=h[0].toByteArray(),I=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[],g=0;g<16;)C.push(parseInt(k[g],10)&parseInt(I[g],10)),g++;return new this(C)}catch(R){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${R})`)}},b.IPv6.parse=function(d){const h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},b.IPv6.parseCIDR=function(d){let h,g,k;if((g=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(g[2]),h>=0&&h<=128))return k=[this.parse(g[1]),h],Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(d){let h,g,k,C,I,R;if(k=d.match(f.deprecatedTransitional))return this.parser(`::ffff:${k[1]}`);if(f.native.test(d))return c(d,8);if((k=d.match(f.transitional))&&(R=k[6]||"",h=k[1],k[1].endsWith("::")||(h=h.slice(0,-1)),h=c(h+R,6),h.parts)){for(I=[parseInt(k[2]),parseInt(k[3]),parseInt(k[4]),parseInt(k[5])],g=0;g128)throw new Error("ipaddr: invalid IPv6 prefix length");const h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let g=0;const k=Math.floor(d/8);for(;g0?0:1}return v=Y(t),b=G[v]=Z[v](t),{c(){e=p("div"),n=M(l),i=M(": "),a=M(o),u=w(),f=p("div"),m=M(c),_=M(`: - `),b.c(),d=w(),h=p("div"),k=M(g),C=M(": "),R=M(I),E=M(" ("),L=M(O),j=M("/"),U=M(K),q=M(")"),r(e,"class","my-2"),r(f,"class","my-2"),r(h,"class","my-2")},m(fe,le){T(fe,e,le),s(e,n),s(e,i),s(e,a),T(fe,u,le),T(fe,f,le),s(f,m),s(f,_),G[v].m(f,null),T(fe,d,le),T(fe,h,le),s(h,k),s(h,C),s(h,R),s(h,E),s(h,L),s(h,j),s(h,U),s(h,q),y=!0},p(fe,le){var oe,me,se,pe,we,S,P,F;(!y||le&8)&&l!==(l=(((me=(oe=fe[3].status)==null?void 0:oe.device)==null?void 0:me.apmac)??"AP MAC")+"")&&D(n,l),(!y||le&1)&&o!==(o=fe[0].apmac+"")&&D(a,o),(!y||le&8)&&c!==(c=(((pe=(se=fe[3].status)==null?void 0:se.device)==null?void 0:pe.last_boot)??"Last boot")+"")&&D(m,c);let de=v;v=Y(fe),v===de?G[v].p(fe,le):(ct(),x(G[de],1,1,()=>{G[de]=null}),_t(),b=G[v],b?b.p(fe,le):(b=G[v]=Z[v](fe),b.c()),X(b,1),b.m(f,null)),(!y||le&8)&&g!==(g=(((S=(we=fe[3].status)==null?void 0:we.device)==null?void 0:S.reason)??"Reason")+"")&&D(k,g),(!y||le&9)&&I!==(I=(((F=(P=fe[3][Ao(fe[0].chip)])==null?void 0:P.reason)==null?void 0:F[fe[0].boot_reason])??fe[0].boot_reason)+"")&&D(R,I),(!y||le&1)&&O!==(O=fe[0].boot_reason+"")&&D(L,O),(!y||le&1)&&K!==(K=fe[0].ex_cause+"")&&D(U,K)},i(fe){y||(X(b),y=!0)},o(fe){x(b),y=!1},d(fe){fe&&(N(e),N(u),N(f),N(d),N(h)),G[v].d()}}}function a_(t){let e;return{c(){e=M("-")},m(l,n){T(l,e,n)},p:ze,i:ze,o:ze,d(l){l&&N(e)}}}function f_(t){let e,l;return e=new Qr({props:{timestamp:new Date(new Date().getTime()-t[1].u*1e3),fullTimeColor:"",offset:t[0].clock_offset}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.timestamp=new Date(new Date().getTime()-n[1].u*1e3)),i&1&&(o.offset=n[0].clock_offset),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function nf(t){var m;let e,l,n,i,o=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,u,f,c;return l=new wl({props:{to:"/consent",$$slots:{default:[r_]},$$scope:{ctx:t}}}),{c(){e=p("div"),Se(l.$$.fragment),n=w(),i=p("button"),a=M(o),r(i,"class","btn-yellow-sm float-right"),r(e,"class","my-2")},m(_,v){T(_,e,v),Ce(l,e,null),s(e,n),s(e,i),s(i,a),u=!0,f||(c=ce(i,"click",t[11]),f=!0)},p(_,v){var d;const b={};v&67108872&&(b.$$scope={dirty:v,ctx:_}),l.$set(b),(!u||v&8)&&o!==(o=(((d=_[3].btn)==null?void 0:d.reboot)??"Reboot")+"")&&D(a,o)},i(_){u||(X(l.$$.fragment,_),u=!0)},o(_){x(l.$$.fragment,_),u=!1},d(_){_&&N(e),Pe(l),f=!1,c()}}}function r_(t){var i,o;let e,l=(((o=(i=t[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=M(l),r(e,"class","btn-pri-sm")},m(a,u){T(a,e,u),s(e,n)},p(a,u){var f,c;u&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&D(n,l)},d(a){a&&N(e)}}}function of(t){var U,q,y,Z,G,Y,V,B;let e,l,n=(((q=(U=t[3].status)==null?void 0:U.meter)==null?void 0:q.title)??"Meter")+"",i,o,a,u=(((Z=(y=t[3].status)==null?void 0:y.meter)==null?void 0:Z.manufacturer)??"Manufacturer")+"",f,c,m=Ci(t[0].meter.mfg)+"",_,v,b,d=(((Y=(G=t[3].status)==null?void 0:G.meter)==null?void 0:Y.model)??"Model")+"",h,g,k=(t[0].meter.model?t[0].meter.model:"unknown")+"",C,I,R,E=(((B=(V=t[3].status)==null?void 0:V.meter)==null?void 0:B.id)??"ID")+"",O,L,j=(t[0].meter.id?t[0].meter.id:"unknown")+"",K;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),f=M(u),c=M(": "),_=M(m),v=w(),b=p("div"),h=M(d),g=M(": "),C=M(k),I=w(),R=p("div"),O=M(E),L=M(": "),K=M(j),r(l,"class","text-sm"),r(a,"class","my-2"),r(b,"class","my-2"),r(R,"class","my-2"),r(e,"class","cnt")},m(H,ne){T(H,e,ne),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,v),s(e,b),s(b,h),s(b,g),s(b,C),s(e,I),s(e,R),s(R,O),s(R,L),s(R,K)},p(H,ne){var ee,Q,ie,ue,fe,le,de,oe;ne&8&&n!==(n=(((Q=(ee=H[3].status)==null?void 0:ee.meter)==null?void 0:Q.title)??"Meter")+"")&&D(i,n),ne&8&&u!==(u=(((ue=(ie=H[3].status)==null?void 0:ie.meter)==null?void 0:ue.manufacturer)??"Manufacturer")+"")&&D(f,u),ne&1&&m!==(m=Ci(H[0].meter.mfg)+"")&&D(_,m),ne&8&&d!==(d=(((le=(fe=H[3].status)==null?void 0:fe.meter)==null?void 0:le.model)??"Model")+"")&&D(h,d),ne&1&&k!==(k=(H[0].meter.model?H[0].meter.model:"unknown")+"")&&D(C,k),ne&8&&E!==(E=(((oe=(de=H[3].status)==null?void 0:de.meter)==null?void 0:oe.id)??"ID")+"")&&D(O,E),ne&1&&j!==(j=(H[0].meter.id?H[0].meter.id:"unknown")+"")&&D(K,j)},d(H){H&&N(e)}}}function sf(t){var B,H,ne,ee,Q,ie,ue,fe;let e,l,n=(((H=(B=t[3].status)==null?void 0:B.network)==null?void 0:H.title)??"Network")+"",i,o,a,u=(((ee=(ne=t[3].conf)==null?void 0:ne.network)==null?void 0:ee.ip)??"IP")+"",f,c,m=t[0].net.ip+"",_,v,b,d=(((ie=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:ie.mask)??"Mask")+"",h,g,k=t[0].net.mask+"",C,I,R,E=(((fe=(ue=t[3].conf)==null?void 0:ue.network)==null?void 0:fe.gw)??"Gateway")+"",O,L,j=t[0].net.gw+"",K,U,q,y,Z,G=t[0].net.dns1&&af(t),Y=t[0].net.dns2&&ff(t),V=t[0].net.ipv6&&rf(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),f=M(u),c=M(": "),_=M(m),v=w(),b=p("div"),h=M(d),g=M(": "),C=M(k),I=w(),R=p("div"),O=M(E),L=M(": "),K=M(j),U=w(),q=p("div"),G&&G.c(),y=w(),Y&&Y.c(),Z=w(),V&&V.c(),r(l,"class","text-sm"),r(a,"class","my-2"),r(b,"class","my-2"),r(R,"class","my-2"),r(q,"class","my-2"),r(e,"class","cnt")},m(le,de){T(le,e,de),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,v),s(e,b),s(b,h),s(b,g),s(b,C),s(e,I),s(e,R),s(R,O),s(R,L),s(R,K),s(e,U),s(e,q),G&&G.m(q,null),s(q,y),Y&&Y.m(q,null),s(e,Z),V&&V.m(e,null)},p(le,de){var oe,me,se,pe,we,S,P,F;de&8&&n!==(n=(((me=(oe=le[3].status)==null?void 0:oe.network)==null?void 0:me.title)??"Network")+"")&&D(i,n),de&8&&u!==(u=(((pe=(se=le[3].conf)==null?void 0:se.network)==null?void 0:pe.ip)??"IP")+"")&&D(f,u),de&1&&m!==(m=le[0].net.ip+"")&&D(_,m),de&8&&d!==(d=(((S=(we=le[3].conf)==null?void 0:we.network)==null?void 0:S.mask)??"Mask")+"")&&D(h,d),de&1&&k!==(k=le[0].net.mask+"")&&D(C,k),de&8&&E!==(E=(((F=(P=le[3].conf)==null?void 0:P.network)==null?void 0:F.gw)??"Gateway")+"")&&D(O,E),de&1&&j!==(j=le[0].net.gw+"")&&D(K,j),le[0].net.dns1?G?G.p(le,de):(G=af(le),G.c(),G.m(q,y)):G&&(G.d(1),G=null),le[0].net.dns2?Y?Y.p(le,de):(Y=ff(le),Y.c(),Y.m(q,null)):Y&&(Y.d(1),Y=null),le[0].net.ipv6?V?V.p(le,de):(V=rf(le),V.c(),V.m(e,null)):V&&(V.d(1),V=null)},d(le){le&&N(e),G&&G.d(),Y&&Y.d(),V&&V.d()}}}function af(t){var a,u;let e=(((u=(a=t[3].conf)==null?void 0:a.network)==null?void 0:u.dns)??"DNS")+"",l,n,i=t[0].net.dns1+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){T(f,l,c),T(f,n,c),T(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&D(l,e),c&1&&i!==(i=f[0].net.dns1+"")&&D(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function ff(t){var a,u;let e=(((u=(a=t[3].conf)==null?void 0:a.network)==null?void 0:u.dns)??"DNS")+"",l,n,i=t[0].net.dns2+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){T(f,l,c),T(f,n,c),T(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&D(l,e),c&1&&i!==(i=f[0].net.dns2+"")&&D(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function rf(t){let e,l,n,i=En.parse(t[0].net.ipv6)+"",o,a,u,f,c=t[0].net.dns1v6&&uf(t),m=t[0].net.dns2v6&&cf(t);return{c(){e=p("div"),l=M("IPv6: "),n=p("span"),o=M(i),a=w(),u=p("div"),c&&c.c(),f=w(),m&&m.c(),Sl(n,"font-size","14px"),r(e,"class","my-2"),r(u,"class","my-2")},m(_,v){T(_,e,v),s(e,l),s(e,n),s(n,o),T(_,a,v),T(_,u,v),c&&c.m(u,null),s(u,f),m&&m.m(u,null)},p(_,v){v&1&&i!==(i=En.parse(_[0].net.ipv6)+"")&&D(o,i),_[0].net.dns1v6?c?c.p(_,v):(c=uf(_),c.c(),c.m(u,f)):c&&(c.d(1),c=null),_[0].net.dns2v6?m?m.p(_,v):(m=cf(_),m.c(),m.m(u,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(u)),c&&c.d(),m&&m.d()}}}function uf(t){let e,l,n=En.parse(t[0].net.dns1v6)+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){T(o,e,a),T(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=En.parse(o[0].net.dns1v6)+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function cf(t){let e,l,n=En.parse(t[0].net.dns2v6)+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){T(o,e,a),T(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=En.parse(o[0].net.dns2v6)+"")&&D(i,n)},d(o){o&&(N(e),N(l))}}}function _f(t){let e,l,n,i,o,a,u,f,c;return{c(){e=p("div"),l=M(`Channel: - `),n=p("select"),i=p("option"),i.textContent="Stable",o=p("option"),o.textContent="Early",a=p("option"),a.textContent="Release Candidate",u=p("option"),u.textContent="Snapshot",i.__value=0,z(i,i.__value),o.__value=1,z(o,o.__value),a.__value=2,z(a,a.__value),u.__value=3,z(u,u.__value),u.disabled=!0,r(n,"class","in-s w-full"),t[0].upgrade.c===void 0&&Mt(()=>t[14].call(n)),r(e,"class","my-2")},m(m,_){T(m,e,_),s(e,l),s(e,n),s(n,i),s(n,o),s(n,a),s(n,u),Be(n,t[0].upgrade.c,!0),f||(c=[ce(n,"change",t[14]),ce(n,"change",t[13])],f=!0)},p(m,_){_&1&&Be(n,m[0].upgrade.c)},d(m){m&&N(e),f=!1,Ut(c)}}}function mf(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[0].upgrade.f).replace("{1}",t[0].upgrade.t)+"",i,o,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[0].upgrade.e])??t[0].upgrade.e)+"",u;return{c(){e=p("div"),l=p("div"),i=M(n),o=w(),u=M(a),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(v,b){T(v,e,b),s(e,l),s(l,i),s(l,o),s(l,u)},p(v,b){var d,h,g,k;b&9&&n!==(n=(((h=(d=v[3].status)==null?void 0:d.firmware)==null?void 0:h.failed)??"Upgrade from {0} to {1} failed").replace("{0}",v[0].upgrade.f).replace("{1}",v[0].upgrade.t)+"")&&D(i,n),b&9&&a!==(a=(((k=(g=v[3].errors)==null?void 0:g.upgrade)==null?void 0:k[v[0].upgrade.e])??v[0].upgrade.e)+"")&&D(u,a)},d(v){v&&N(e)}}}function pf(t){var d,h;let e,l=(((h=(d=t[3].status)==null?void 0:d.firmware)==null?void 0:h.latest)??"Latest")+"",n,i,o,a=t[0].upgrade.n+"",u,f,c,m,_,v=(t[0].security==0||t[1].a)&&t[0].fwconsent===1&&t[0].upgrade.n&&t[0].upgrade.n!=t[0].version&&df(t),b=t[0].fwconsent===2&&hf(t);return{c(){e=p("div"),n=M(l),i=M(`: - `),o=p("a"),u=M(a),c=w(),v&&v.c(),m=w(),b&&b.c(),_=Wt(),r(o,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[0].upgrade.n),r(o,"class","ml-2 text-blue-600 hover:text-blue-800"),r(o,"target","_blank"),r(o,"rel","noreferrer"),r(e,"class","my-2 flex")},m(g,k){T(g,e,k),s(e,n),s(e,i),s(e,o),s(o,u),s(e,c),v&&v.m(e,null),T(g,m,k),b&&b.m(g,k),T(g,_,k)},p(g,k){var C,I;k&8&&l!==(l=(((I=(C=g[3].status)==null?void 0:C.firmware)==null?void 0:I.latest)??"Latest")+"")&&D(n,l),k&1&&a!==(a=g[0].upgrade.n+"")&&D(u,a),k&1&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+g[0].upgrade.n)&&r(o,"href",f),(g[0].security==0||g[1].a)&&g[0].fwconsent===1&&g[0].upgrade.n&&g[0].upgrade.n!=g[0].version?v?v.p(g,k):(v=df(g),v.c(),v.m(e,null)):v&&(v.d(1),v=null),g[0].fwconsent===2?b?b.p(g,k):(b=hf(g),b.c(),b.m(_.parentNode,_)):b&&(b.d(1),b=null)},d(g){g&&(N(e),N(m),N(_)),v&&v.d(),b&&b.d(g)}}}function df(t){let e,l,n,i,o;return{c(){var a,u;e=p("div"),l=p("button"),l.textContent="⇓",r(e,"class","flex-none ml-2 text-green-500"),r(e,"title",n=((u=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:u.install)??"Install")},m(a,u){T(a,e,u),s(e,l),i||(o=ce(l,"click",t[10]),i=!0)},p(a,u){var f,c;u&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&r(e,"title",n)},d(a){a&&N(e),i=!1,o()}}}function hf(t){var o,a;let e,l,n=(((a=(o=t[3].status)==null?void 0:o.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=M(n),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(u,f){T(u,e,f),s(e,l),s(l,i)},p(u,f){var c,m;f&8&&n!==(n=(((m=(c=u[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&D(i,n)},d(u){u&&N(e)}}}function vf(t){let e,l=Lo(Ze(t[0].chip,t[0].board))+"",n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(i,o){T(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=Lo(Ze(i[0].chip,i[0].board))+"")&&D(n,l)},d(i){i&&N(e)}}}function bf(t){let e,l,n,i,o,a;function u(m,_){return m[5].length==0?c_:u_}let f=u(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=w(),c.c(),Sl(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(m,_){T(m,e,_),s(e,l),s(l,n),t[15](n),s(l,i),c.m(l,null),o||(a=[ce(n,"change",t[16]),ce(l,"submit",t[18])],o=!0)},p(m,_){f===(f=u(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[15](null),c.d(),o=!1,Ut(a)}}}function u_(t){var u;let e=t[5][0].name+"",l,n,i,o=(((u=t[3].btn)==null?void 0:u.upload)??"Upload")+"",a;return{c(){l=M(e),n=w(),i=p("button"),a=M(o),r(i,"type","submit"),r(i,"class","btn-pri-sm float-right ml-2")},m(f,c){T(f,l,c),T(f,n,c),T(f,i,c),s(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&D(l,e),c&8&&o!==(o=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&D(a,o)},d(f){f&&(N(l),N(n),N(i))}}}function c_(t){var a,u;let e,l=(((u=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:u.btn_select_file)??"Select file")+"",n,i,o;return{c(){e=p("button"),n=M(l),r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(f,c){T(f,e,c),s(e,n),i||(o=ce(e,"click",t[17]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&D(n,l)},d(f){f&&N(e),i=!1,o()}}}function gf(t){var Y,V,B,H,ne,ee;let e,l,n=(((V=(Y=t[3].status)==null?void 0:Y.backup)==null?void 0:V.title)??"Backup")+"",i,o,a,u,f,c,m,_,v=(((H=(B=t[3].status)==null?void 0:B.backup)==null?void 0:H.secrets)??"Include secrets")+"",b,d,h,g=(((ee=(ne=t[3].status)==null?void 0:ne.backup)==null?void 0:ee.secrets_desc)??"")+"",k,C,I,R,E,O,L,j,K=ft(t[9]),U=[];for(let Q=0;Q{ve=null}),_t()),(pt=ae[1])!=null&&pt.a?ge?(ge.p(ae,Ee),Ee&2&&X(ge,1)):(ge=nf(ae),ge.c(),X(ge,1),ge.m(l,null)):ge&&(ct(),x(ge,1,1,()=>{ge=null}),_t()),ae[0].meter?Ne?Ne.p(ae,Ee):(Ne=of(ae),Ne.c(),Ne.m(e,G)):Ne&&(Ne.d(1),Ne=null),ae[0].net?Ie?Ie.p(ae,Ee):(Ie=sf(ae),Ie.c(),Ie.m(e,Y)):Ie&&(Ie.d(1),Ie=null),(!ke||Ee&8)&&H!==(H=(((Qt=(nt=ae[3].status)==null?void 0:nt.firmware)==null?void 0:Qt.title)??"Firmware")+"")&&D(ne,H),ae[0].fwconsent===1?De?De.p(ae,Ee):(De=_f(ae),De.c(),De.m(V,ue)):De&&(De.d(1),De=null),(!ke||Ee&8)&&le!==(le=(((Ot=(Jt=ae[3].status)==null?void 0:Jt.firmware)==null?void 0:Ot.installed)??"Installed")+"")&&D(de,le),(!ke||Ee&1)&&me!==(me=ae[0].version+"")&&D(se,me),ae[0].upgrade.t&&ae[0].upgrade.t!=ae[0].version&&ae[0].upgrade.e!=0&&ae[0].upgrade.e!=123?Ae?Ae.p(ae,Ee):(Ae=mf(ae),Ae.c(),Ae.m(V,we)):Ae&&(Ae.d(1),Ae=null),ae[0].upgrade.n?Me?Me.p(ae,Ee):(Me=pf(ae),Me.c(),Me.m(V,S)):Me&&(Me.d(1),Me=null),Ee&3&&(P=(ae[0].security==0||ae[1].a)&&cn(ae[0].board)),P?qe?qe.p(ae,Ee):(qe=vf(ae),qe.c(),qe.m(V,F)):qe&&(qe.d(1),qe=null),ae[0].security==0||ae[1].a?Le?Le.p(ae,Ee):(Le=bf(ae),Le.c(),Le.m(V,null)):Le&&(Le.d(1),Le=null),ae[0].security==0||ae[1].a?$e?$e.p(ae,Ee):($e=gf(ae),$e.c(),$e.m(e,null)):$e&&($e.d(1),$e=null);const Tt={};Ee&64&&(Tt.active=ae[6]),Ee&8&&(Tt.message=(($t=(Zt=ae[3].status)==null?void 0:Zt.mask)==null?void 0:$t.firmware)??"Uploading"),te.$set(Tt);const vt={};Ee&256&&(vt.active=ae[8]),Ee&8&&(vt.message=((Xt=(Vt=ae[3].status)==null?void 0:Vt.mask)==null?void 0:Xt.config)??"Uploading"),be.$set(vt)},i(ae){ke||(X(I.$$.fragment,ae),X(ve),X(ge),X(te.$$.fragment,ae),X(be.$$.fragment,ae),ke=!0)},o(ae){x(I.$$.fragment,ae),x(ve),x(ge),x(te.$$.fragment,ae),x(be.$$.fragment,ae),ke=!1},d(ae){ae&&(N(e),N(W),N(re)),J&&J.d(),Pe(I),ve&&ve.d(),ge&&ge.d(),Ne&&Ne.d(),Ie&&Ie.d(),De&&De.d(),Ae&&Ae.d(),Me&&Me.d(),qe&&qe.d(),Le&&Le.d(),$e&&$e.d(),Pe(te,ae),Pe(be,ae)}}}async function d_(){await(await fetch("reboot",{method:"POST"})).json()}function h_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],a={};Il.subscribe(U=>{l(3,a=U)});function u(){var U;confirm((((U=a.header)==null?void 0:U.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(Yr(i.upgrade.n),hl.update(q=>(q.upgrade.t=i.upgrade.n,q.upgrade.p=0,q.upgrading=!0,q)))}const f=function(){var U;confirm(((U=a.device)==null?void 0:U.reboot_confirm)??"Reboot?")&&(hl.update(q=>(q.booting=!0,q)),d_())};let c,m=[],_=!1,v,b=[],d=!1;Ni();let h={hostname:"",ip:""};function g(U){l(8,d=!0);const q=new FormData;q.append("file",b[0]),fetch("configfile",{method:"POST",body:q}).then(y=>y.json()).then(y=>{hl.update(Z=>(h&&h.hostname&&(Z.hostname=h.hostname),Z.booting=y.reboot,h&&h.ip&&(Z.net.ip=h.ip),setTimeout(li,5e3,i),Z))}).catch(y=>{console.error("Error:",y),setTimeout(li,5e3,i)})}function k(){const U=new FormData;U.append("channel",i.upgrade.c),fetch("fwchannel",{method:"POST",body:U})}function C(){i.upgrade.c=Yt(this),l(0,i)}function I(U){ki[U?"unshift":"push"](()=>{c=U,l(4,c)})}function R(){m=this.files,l(5,m)}const E=()=>{c.click()},O=()=>l(6,_=!0);function L(U){ki[U?"unshift":"push"](()=>{v=U,l(7,v)})}function j(){b=this.files,l(2,b)}const K=()=>{v.click()};return t.$$set=U=>{"data"in U&&l(1,n=U.data),"sysinfo"in U&&l(0,i=U.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&b.length==1){let U=b[0],q=new FileReader,y=Z=>{let G=Z.target.result.split(` -`);for(let Y in G){let V=G[Y];V.startsWith("hostname ")?h.hostname=V.split(" ")[1]:V.startsWith("ip ")&&(h.ip=V.split(" ")[1])}};q.onload=y,q.readAsText(U)}},[i,n,b,a,c,m,_,v,d,o,u,f,g,k,C,I,R,E,O,L,j,K]}class v_ extends Et{constructor(e){super(),It(this,e,h_,p_,Ct,{data:1,sysinfo:0})}}function Cf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],5)+"",u,f,c=Ze(t[0],4)+"",m,_,v=Ze(t[0],3)+"",b,d,h,g,k=Ze(t[0],2)+"",C,I,R=Ze(t[0],1)+"",E,O,L=Ze(t[0],0)+"",j,K,U,q,y=Ze(t[0],101)+"",Z,G,Y=Ze(t[0],100)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=p("option"),b=M(v),d=w(),h=p("optgroup"),g=p("option"),C=M(k),I=p("option"),E=M(R),O=p("option"),j=M(L),K=w(),U=p("optgroup"),q=p("option"),Z=M(y),G=p("option"),V=M(Y),l.__value=7,z(l,l.__value),o.__value=5,z(o,o.__value),f.__value=4,z(f,f.__value),_.__value=3,z(_,_.__value),r(e,"label","amsleser.no"),g.__value=2,z(g,g.__value),I.__value=1,z(I,I.__value),O.__value=0,z(O,O.__value),r(h,"label","Custom hardware"),q.__value=101,z(q,q.__value),G.__value=100,z(G,G.__value),r(U,"label","Generic hardware")},m(B,H){T(B,e,H),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),s(e,_),s(_,b),T(B,d,H),T(B,h,H),s(h,g),s(g,C),s(h,I),s(I,E),s(h,O),s(O,j),T(B,K,H),T(B,U,H),s(U,q),s(q,Z),s(U,G),s(G,V)},p(B,H){H&1&&n!==(n=Ze(B[0],7)+"")&&D(i,n),H&1&&a!==(a=Ze(B[0],5)+"")&&D(u,a),H&1&&c!==(c=Ze(B[0],4)+"")&&D(m,c),H&1&&v!==(v=Ze(B[0],3)+"")&&D(b,v),H&1&&k!==(k=Ze(B[0],2)+"")&&D(C,k),H&1&&R!==(R=Ze(B[0],1)+"")&&D(E,R),H&1&&L!==(L=Ze(B[0],0)+"")&&D(j,L),H&1&&y!==(y=Ze(B[0],101)+"")&&D(Z,y),H&1&&Y!==(Y=Ze(B[0],100)+"")&&D(V,Y)},d(B){B&&(N(e),N(d),N(h),N(K),N(U))}}}function Pf(t){let e,l,n=Ze(t[0],201)+"",i,o,a=Ze(t[0],202)+"",u,f,c=Ze(t[0],203)+"",m,_,v=Ze(t[0],241)+"",b,d,h=Ze(t[0],242)+"",g,k,C=Ze(t[0],243)+"",I,R,E=Ze(t[0],245)+"",O,L,j=Ze(t[0],200)+"",K;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=p("option"),b=M(v),d=p("option"),g=M(h),k=p("option"),I=M(C),R=p("option"),O=M(E),L=p("option"),K=M(j),l.__value=201,z(l,l.__value),o.__value=202,z(o,o.__value),f.__value=203,z(f,f.__value),_.__value=241,z(_,_.__value),d.__value=242,z(d,d.__value),k.__value=243,z(k,k.__value),R.__value=245,z(R,R.__value),L.__value=200,z(L,L.__value),r(e,"label","Generic hardware")},m(U,q){T(U,e,q),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),s(e,_),s(_,b),s(e,d),s(d,g),s(e,k),s(k,I),s(e,R),s(R,O),s(e,L),s(L,K)},p(U,q){q&1&&n!==(n=Ze(U[0],201)+"")&&D(i,n),q&1&&a!==(a=Ze(U[0],202)+"")&&D(u,a),q&1&&c!==(c=Ze(U[0],203)+"")&&D(m,c),q&1&&v!==(v=Ze(U[0],241)+"")&&D(b,v),q&1&&h!==(h=Ze(U[0],242)+"")&&D(g,h),q&1&&C!==(C=Ze(U[0],243)+"")&&D(I,C),q&1&&E!==(E=Ze(U[0],245)+"")&&D(O,E),q&1&&j!==(j=Ze(U[0],200)+"")&&D(K,j)},d(U){U&&N(e)}}}function Sf(t){let e,l,n=Ze(t[0],7)+"",i,o,a=Ze(t[0],6)+"",u,f,c=Ze(t[0],5)+"",m,_,v,b,d=Ze(t[0],51)+"",h,g,k=Ze(t[0],50)+"",C;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=w(),v=p("optgroup"),b=p("option"),h=M(d),g=p("option"),C=M(k),l.__value=7,z(l,l.__value),o.__value=6,z(o,o.__value),f.__value=5,z(f,f.__value),r(e,"label","amsleser.no"),b.__value=51,z(b,b.__value),g.__value=50,z(g,g.__value),r(v,"label","Generic hardware")},m(I,R){T(I,e,R),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),T(I,_,R),T(I,v,R),s(v,b),s(b,h),s(v,g),s(g,C)},p(I,R){R&1&&n!==(n=Ze(I[0],7)+"")&&D(i,n),R&1&&a!==(a=Ze(I[0],6)+"")&&D(u,a),R&1&&c!==(c=Ze(I[0],5)+"")&&D(m,c),R&1&&d!==(d=Ze(I[0],51)+"")&&D(h,d),R&1&&k!==(k=Ze(I[0],50)+"")&&D(C,k)},d(I){I&&(N(e),N(_),N(v))}}}function Mf(t){let e,l,n=Ze(t[0],8)+"",i,o,a,u,f=Ze(t[0],71)+"",c,m,_=Ze(t[0],70)+"",v;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=w(),a=p("optgroup"),u=p("option"),c=M(f),m=p("option"),v=M(_),l.__value=8,z(l,l.__value),r(e,"label","Custom hardware"),u.__value=71,z(u,u.__value),m.__value=70,z(m,m.__value),r(a,"label","Generic hardware")},m(b,d){T(b,e,d),s(e,l),s(l,i),T(b,o,d),T(b,a,d),s(a,u),s(u,c),s(a,m),s(m,v)},p(b,d){d&1&&n!==(n=Ze(b[0],8)+"")&&D(i,n),d&1&&f!==(f=Ze(b[0],71)+"")&&D(c,f),d&1&&_!==(_=Ze(b[0],70)+"")&&D(v,_)},d(b){b&&(N(e),N(o),N(a))}}}function If(t){let e,l,n=Ze(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=200,z(l,l.__value),r(e,"label","Generic hardware")},m(o,a){T(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],200)+"")&&D(i,n)},d(o){o&&N(e)}}}function Ef(t){let e,l,n=Ze(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=80,z(l,l.__value),r(e,"label","Generic hardware")},m(o,a){T(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=Ze(o[0],80)+"")&&D(i,n)},d(o){o&&N(e)}}}function b_(t){let e,l,n,i,o,a,u,f,c=t[0]=="esp8266"&&Cf(t),m=t[0]=="esp32"&&Pf(t),_=t[0]=="esp32s2"&&Sf(t),v=t[0]=="esp32c3"&&Mf(t),b=t[0]=="esp32solo"&&If(t),d=t[0]=="esp32s3"&&Ef(t);return{c(){e=p("option"),l=w(),c&&c.c(),n=w(),m&&m.c(),i=w(),_&&_.c(),o=w(),v&&v.c(),a=w(),b&&b.c(),u=w(),d&&d.c(),f=Wt(),e.__value=-1,z(e,e.__value)},m(h,g){T(h,e,g),T(h,l,g),c&&c.m(h,g),T(h,n,g),m&&m.m(h,g),T(h,i,g),_&&_.m(h,g),T(h,o,g),v&&v.m(h,g),T(h,a,g),b&&b.m(h,g),T(h,u,g),d&&d.m(h,g),T(h,f,g)},p(h,[g]){h[0]=="esp8266"?c?c.p(h,g):(c=Cf(h),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),h[0]=="esp32"?m?m.p(h,g):(m=Pf(h),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),h[0]=="esp32s2"?_?_.p(h,g):(_=Sf(h),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),h[0]=="esp32c3"?v?v.p(h,g):(v=Mf(h),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),h[0]=="esp32solo"?b?b.p(h,g):(b=If(h),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null),h[0]=="esp32s3"?d?d.p(h,g):(d=Ef(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},i:ze,o:ze,d(h){h&&(N(e),N(l),N(n),N(i),N(o),N(a),N(u),N(f)),c&&c.d(h),m&&m.d(h),_&&_.d(h),v&&v.d(h),b&&b.d(h),d&&d.d(h)}}}function g_(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class k_ extends Et{constructor(e){super(),It(this,e,g_,b_,Ct,{chip:0})}}function Nf(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function Tf(t){let e,l,n,i,o,a,u;return a=new to({props:{chip:t[0].chip}}),{c(){e=p("div"),l=M("HAN GPIO"),n=p("br"),i=w(),o=p("select"),Se(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(f,c){T(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Ce(a,o,null),u=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){u||(X(a.$$.fragment,f),u=!0)},o(f){x(a.$$.fragment,f),u=!1},d(f){f&&N(e),Pe(a)}}}function w_(t){let e,l,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C,I,R,E,O,L,j,K,U,q,y,Z,G=t[0].usrcfg&&Nf();d=new k_({props:{chip:t[0].chip}});let Y=t[0].board&&t[0].board>20&&Tf(t);return U=new dl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=w(),a=p("strong"),a.textContent="Initial configuration",u=w(),G&&G.c(),f=w(),c=p("div"),m=M("Board type"),_=p("br"),v=w(),b=p("select"),Se(d.$$.fragment),h=w(),Y&&Y.c(),g=w(),k=p("div"),C=p("label"),I=p("input"),R=M(" Clear all other configuration"),E=w(),O=p("div"),O.innerHTML='',L=w(),j=p("span"),j.textContent=" ",K=w(),Se(U.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(b,"name","vb"),r(b,"class","in-s"),t[0].board===void 0&&Mt(()=>t[5].call(b)),r(c,"class","my-3"),r(I,"type","checkbox"),r(I,"name","vr"),I.__value="true",z(I,I.__value),r(I,"class","rounded mb-1"),r(k,"class","my-3"),r(O,"class","my-3"),r(j,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,B){T(V,e,B),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),G&&G.m(n,null),s(n,f),s(n,c),s(c,m),s(c,_),s(c,v),s(c,b),Ce(d,b,null),Be(b,t[0].board,!0),s(n,h),Y&&Y.m(n,null),s(n,g),s(n,k),s(k,C),s(C,I),I.checked=t[2],s(C,R),s(n,E),s(n,O),s(n,L),s(n,j),T(V,K,B),Ce(U,V,B),q=!0,y||(Z=[ce(b,"change",t[5]),ce(I,"change",t[6]),ce(n,"submit",dn(t[3]))],y=!0)},p(V,[B]){V[0].usrcfg?G||(G=Nf(),G.c(),G.m(n,f)):G&&(G.d(1),G=null);const H={};B&1&&(H.chip=V[0].chip),d.$set(H),B&1&&Be(b,V[0].board),V[0].board&&V[0].board>20?Y?(Y.p(V,B),B&1&&X(Y,1)):(Y=Tf(V),Y.c(),X(Y,1),Y.m(n,g)):Y&&(ct(),x(Y,1,1,()=>{Y=null}),_t()),B&4&&(I.checked=V[2]);const ne={};B&2&&(ne.active=V[1]),U.$set(ne)},i(V){q||(X(d.$$.fragment,V),X(Y),X(U.$$.fragment,V),q=!0)},o(V){x(d.$$.fragment,V),x(Y),x(U.$$.fragment,V),q=!1},d(V){V&&(N(e),N(K)),G&&G.d(),Pe(d),Y&&Y.d(),Pe(U,V),y=!1,Ut(Z)}}}function C_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function a(m){l(1,o=!0);const _=new FormData(m.target),v=new URLSearchParams;for(let h of _){const[g,k]=h;v.append(g,k)}let d=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),hl.update(h=>(h.vndcfg=d.success,h.booting=d.reboot,h.if.eth=h.boardType>240&&h.boardType<250,h)),nn(n+(i.usrcfg?"":"setup"))}let u=!0;hl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,u=!i.usrcfg)});function f(){i.board=Yt(this),l(0,i)}function c(){u=this.checked,l(2,u)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,o,u,a,n,f,c]}class P_ extends Et{constructor(e){super(),It(this,e,C_,w_,Ct,{basepath:4,sysinfo:0})}}function qf(t,e,l){const n=t.slice();return n[13]=e[l],n}function Df(t){var i,o;let e,l=(((o=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,z(e,e.__value)},m(a,u){T(a,e,u),s(e,n)},p(a,u){var f,c;u&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&D(n,l)},d(a){a&&N(e)}}}function Af(t){var j,K,U,q;let e,l=(((K=(j=t[1].conf)==null?void 0:j.connection)==null?void 0:K.ssid)??"SSID")+"",n,i,o,a,u,f,c,m,_,v,b=(((q=(U=t[1].conf)==null?void 0:U.connection)==null?void 0:q.psk)??"Password")+"",d,h,g,k,C,I,R;function E(y,Z){return y[2]?M_:S_}let O=E(t),L=O(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("label"),a=p("input"),u=M(" manual"),f=w(),c=p("br"),m=w(),L.c(),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),r(a,"type","checkbox"),a.__value="true",z(a,a.__value),r(a,"class","rounded mb-1"),r(o,"class","float-right mr-3"),r(e,"class","my-3"),r(k,"name","sp"),r(k,"type","password"),r(k,"pattern",In),r(k,"class","in-s"),r(k,"autocomplete","off"),k.required=C=t[5]==2,r(v,"class","my-3")},m(y,Z){T(y,e,Z),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[2],s(o,u),s(e,f),s(e,c),s(e,m),L.m(e,null),T(y,_,Z),T(y,v,Z),s(v,d),s(v,h),s(v,g),s(v,k),I||(R=ce(a,"change",t[9]),I=!0)},p(y,Z){var G,Y,V,B;Z&2&&l!==(l=(((Y=(G=y[1].conf)==null?void 0:G.connection)==null?void 0:Y.ssid)??"SSID")+"")&&D(n,l),Z&4&&(a.checked=y[2]),O===(O=E(y))&&L?L.p(y,Z):(L.d(1),L=O(y),L&&(L.c(),L.m(e,null))),Z&2&&b!==(b=(((B=(V=y[1].conf)==null?void 0:V.connection)==null?void 0:B.psk)??"Password")+"")&&D(d,b),Z&32&&C!==(C=y[5]==2)&&(k.required=C)},d(y){y&&(N(e),N(_),N(v)),L.d(),I=!1,R()}}}function S_(t){var a,u;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&Rf(),o=((u=t[3])==null?void 0:u.n)&&Of(t);return{c(){e=p("select"),i&&i.c(),l=Wt(),o&&o.c(),r(e,"name","ss"),r(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){T(f,e,c),i&&i.m(e,null),s(e,l),o&&o.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=Rf(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?o?o.p(f,c):(o=Of(f),o.c(),o.m(e,null)):o&&(o.d(1),o=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),o&&o.d()}}}function M_(t){let e,l;return{c(){e=p("input"),r(e,"name","ss"),r(e,"type","text"),r(e,"pattern",In),r(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){T(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function Rf(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",z(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){T(l,e,n)},d(l){l&&N(e)}}}function Of(t){var i;let e,l=ft((i=t[3])==null?void 0:i.n),n=[];for(let o=0;ot[8].call(h)),r(m,"class","my-3"),r(y,"name","sh"),r(y,"type","text"),r(y,"class","in-s"),r(y,"maxlength","32"),r(y,"pattern",Pi),r(y,"placeholder","Optional, ex.: ams-reader"),r(y,"autocomplete","off"),r(V,"type","checkbox"),r(V,"name","sm"),V.__value="static",z(V,V.__value),r(V,"class","rounded mb-1"),r(G,"class","my-3"),r(fe,"type","submit"),r(fe,"class","btn-pri"),r(ue,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Me,qe){T(Me,e,qe),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(a,f),s(n,c),s(n,m),s(m,v),s(m,b),s(m,d),s(m,h),s(h,g),s(g,C),s(h,I),s(I,E),S&&S.m(h,null),Be(h,t[5],!0),s(n,O),P&&P.m(n,null),s(n,L),s(n,j),s(j,U),s(j,q),s(j,y),z(y,t[0].hostname),s(n,Z),s(n,G),s(G,Y),s(Y,V),V.checked=t[4],s(Y,B),s(Y,ne),s(G,ee),F&&F.m(G,null),s(n,Q),A&&A.m(n,null),s(n,ie),s(n,ue),s(ue,fe),s(fe,de),T(Me,oe,qe),Ce(me,Me,qe),se=!0,pe||(we=[ce(h,"change",t[8]),ce(y,"input",t[10]),ce(V,"change",t[11]),ce(n,"submit",dn(t[7]))],pe=!0)},p(Me,[qe]){var $e,xe,rt,Pt,dt,ut,ot,ht,Rt,Je,Fe,je;(!se||qe&2)&&u!==(u=((($e=Me[1].setup)==null?void 0:$e.title)??"Setup")+"")&&D(f,u),(!se||qe&2)&&_!==(_=(((rt=(xe=Me[1].conf)==null?void 0:xe.connection)==null?void 0:rt.title)??"Connection")+"")&&D(v,_),(!se||qe&2)&&k!==(k=(((dt=(Pt=Me[1].conf)==null?void 0:Pt.connection)==null?void 0:dt.wifi)??"Connect to WiFi")+"")&&D(C,k),(!se||qe&2)&&R!==(R=(((ot=(ut=Me[1].conf)==null?void 0:ut.connection)==null?void 0:ot.ap)??"Standalone access point")+"")&&D(E,R),Me[0].if&&Me[0].if.eth?S?S.p(Me,qe):(S=Df(Me),S.c(),S.m(h,null)):S&&(S.d(1),S=null),qe&32&&Be(h,Me[5]),Me[5]==1||Me[5]==2?P?P.p(Me,qe):(P=Af(Me),P.c(),P.m(n,L)):P&&(P.d(1),P=null),(!se||qe&2)&&K!==(K=(((Rt=(ht=Me[1].conf)==null?void 0:ht.general)==null?void 0:Rt.hostname)??"Hostname")+"")&&D(U,K),qe&1&&y.value!==Me[0].hostname&&z(y,Me[0].hostname),qe&16&&(V.checked=Me[4]),(!se||qe&2)&&H!==(H=(((Je=Me[1].setup)==null?void 0:Je.static)??"Static IP")+"")&&D(ne,H),Me[4]?F?(F.p(Me,qe),qe&16&&X(F,1)):(F=Ff(Me),F.c(),X(F,1),F.m(G,null)):F&&(ct(),x(F,1,1,()=>{F=null}),_t()),Me[4]?A?A.p(Me,qe):(A=yf(Me),A.c(),A.m(n,ie)):A&&(A.d(1),A=null),(!se||qe&2)&&le!==(le=(((Fe=Me[1].btn)==null?void 0:Fe.save)??"Save")+"")&&D(de,le);const Le={};qe&64&&(Le.active=Me[6]),qe&2&&(Le.message=((je=Me[1].setup)==null?void 0:je.mask)??"Saving"),me.$set(Le)},i(Me){se||(X(F),X(me.$$.fragment,Me),se=!0)},o(Me){x(F),x(me.$$.fragment,Me),se=!1},d(Me){Me&&(N(e),N(oe)),S&&S.d(),P&&P.d(),F&&F.d(),A&&A.d(),Pe(me,Me),pe=!1,Ut(we)}}}function E_(t,e,l){let n={};Il.subscribe(g=>{l(1,n=g)});let i=!1,o={};_o.subscribe(g=>{l(3,o=g)});let{sysinfo:a={}}=e,u=!1,f=1,c=!1;function m(g){hl.update(k=>(k.trying=g,k))}async function _(g){l(6,c=!0);const k=new FormData(g.target),C=new URLSearchParams;for(let E of k){const[O,L]=E;C.append(O,L)}let R=await(await fetch("save",{method:"POST",body:C})).json();l(6,c=!1),hl.update(E=>(E.hostname=k.get("sh"),E.usrcfg=R.success,E.booting=R.reboot,u&&(E.net.ip=k.get("si"),E.net.mask=k.get("su"),E.net.gw=k.get("sg"),E.net.dns1=k.get("sd")),R.reboot&&setTimeout(li,5e3,a,m),E))}function v(){f=Yt(this),l(5,f)}function b(){i=this.checked,l(2,i)}function d(){a.hostname=this.value,l(0,a)}function h(){u=this.checked,l(4,u)}return t.$$set=g=>{"sysinfo"in g&&l(0,a=g.sysinfo)},[a,n,i,o,u,f,c,_,v,b,d,h]}class N_ extends Et{constructor(e){super(),It(this,e,E_,I_,Ct,{sysinfo:0})}}function T_(t){var U,q,y,Z;let e,l,n,i=(((U=t[2].upload)==null?void 0:U.title)??"Upload")+"",o,a,u,f,c,m=(((q=t[2].upload)==null?void 0:q.desc)??"")+"",_,v,b,d,h,g,k,C,I=(((y=t[2].btn)==null?void 0:y.upload)??"Upload")+"",R,E,O,L,j,K;return O=new dl({props:{active:t[3],message:((Z=t[2].upload)==null?void 0:Z.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),o=M(i),a=w(),u=M(t[1]),f=w(),c=p("p"),_=M(m),v=w(),b=p("form"),d=p("input"),h=w(),g=p("div"),k=p("button"),C=p("p"),R=M(I),E=w(),Se(O.$$.fragment),r(c,"class","mb-4"),r(d,"name","file"),r(d,"type","file"),r(C,"class","mb-4"),r(k,"type","submit"),r(k,"class","btn-pri"),r(g,"class","w-full text-right mt-4"),r(b,"action",t[0]),r(b,"enctype","multipart/form-data"),r(b,"method","post"),r(b,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(G,Y){T(G,e,Y),s(e,l),s(l,n),s(n,o),s(n,a),s(n,u),s(l,f),s(l,c),s(c,_),s(l,v),s(l,b),s(b,d),s(b,h),s(b,g),s(g,k),s(k,C),s(C,R),T(G,E,Y),Ce(O,G,Y),L=!0,j||(K=ce(b,"submit",t[4]),j=!0)},p(G,[Y]){var B,H,ne,ee;(!L||Y&4)&&i!==(i=(((B=G[2].upload)==null?void 0:B.title)??"Upload")+"")&&D(o,i),(!L||Y&2)&&D(u,G[1]),(!L||Y&4)&&m!==(m=(((H=G[2].upload)==null?void 0:H.desc)??"")+"")&&D(_,m),(!L||Y&4)&&I!==(I=(((ne=G[2].btn)==null?void 0:ne.upload)??"Upload")+"")&&D(R,I),(!L||Y&1)&&r(b,"action",G[0]);const V={};Y&8&&(V.active=G[3]),Y&4&&(V.message=((ee=G[2].upload)==null?void 0:ee.mask)??"Uploading"),O.$set(V)},i(G){L||(X(O.$$.fragment,G),L=!0)},o(G){x(O.$$.fragment,G),L=!1},d(G){G&&(N(e),N(E)),Pe(O,G),j=!1,K()}}}function q_(t,e,l){let{action:n}=e,{title:i}=e,o={};Il.subscribe(f=>{l(2,o=f)});let a=!1;const u=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,o,a,u]}class bo extends Et{constructor(e){super(),It(this,e,q_,T_,Ct,{action:0,title:1})}}function D_(t){var me,se,pe,we,S,P,F;let e,l,n,i,o=(((me=t[1].consent)==null?void 0:me.title)??"Consents")+"",a,u,f,c,m,_=(((se=t[1].consent)==null?void 0:se.one_click)??"One-click")+"",v,b,d,h,g=(((pe=t[1].consent)==null?void 0:pe.read_more)??"Read more")+"",k,C,I,R,E,O,L,j=(((we=t[1].consent)==null?void 0:we.yes)??"Yes")+"",K,U,q,y,Z,G,Y=(((S=t[1].consent)==null?void 0:S.no)??"No")+"",V,B,H,ne,ee,Q=(((P=t[1].btn)==null?void 0:P.save)??"Save")+"",ie,ue,fe,le,de,oe;return fe=new dl({props:{active:t[2],message:((F=t[1].consent)==null?void 0:F.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=M(o),u=w(),f=p("hr"),c=w(),m=p("div"),v=M(_),b=p("br"),d=w(),h=p("a"),k=M(g),C=p("br"),I=w(),R=p("label"),E=p("input"),L=w(),K=M(j),U=w(),q=p("label"),y=p("input"),G=w(),V=M(Y),B=p("br"),H=w(),ne=p("div"),ee=p("button"),ie=M(Q),ue=w(),Se(fe.$$.fragment),r(h,"href","https://github.com/UtilitechAS/amsreader-firmware/wiki/Data-collection-on-one-click-firmware-upgrade"),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r(E,"type","radio"),r(E,"name","sf"),E.value=1,E.checked=O=t[0].fwconsent===1,r(E,"class","rounded m-2"),E.required=!0,r(y,"type","radio"),r(y,"name","sf"),y.value=2,y.checked=Z=t[0].fwconsent===2,r(y,"class","rounded m-2"),y.required=!0,r(m,"class","my-3"),r(ee,"type","submit"),r(ee,"class","btn-pri"),r(ne,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(A,W){T(A,e,W),s(e,l),s(l,n),s(n,i),s(i,a),s(n,u),s(n,f),s(n,c),s(n,m),s(m,v),s(m,b),s(m,d),s(m,h),s(h,k),s(m,C),s(m,I),s(m,R),s(R,E),s(R,L),s(R,K),s(m,U),s(m,q),s(q,y),s(q,G),s(q,V),s(m,B),s(n,H),s(n,ne),s(ne,ee),s(ee,ie),T(A,ue,W),Ce(fe,A,W),le=!0,de||(oe=ce(n,"submit",dn(t[3])),de=!0)},p(A,[W]){var re,be,ke,J,ve,ge,Ne;(!le||W&2)&&o!==(o=(((re=A[1].consent)==null?void 0:re.title)??"Consents")+"")&&D(a,o),(!le||W&2)&&_!==(_=(((be=A[1].consent)==null?void 0:be.one_click)??"One-click")+"")&&D(v,_),(!le||W&2)&&g!==(g=(((ke=A[1].consent)==null?void 0:ke.read_more)??"Read more")+"")&&D(k,g),(!le||W&1&&O!==(O=A[0].fwconsent===1))&&(E.checked=O),(!le||W&2)&&j!==(j=(((J=A[1].consent)==null?void 0:J.yes)??"Yes")+"")&&D(K,j),(!le||W&1&&Z!==(Z=A[0].fwconsent===2))&&(y.checked=Z),(!le||W&2)&&Y!==(Y=(((ve=A[1].consent)==null?void 0:ve.no)??"No")+"")&&D(V,Y),(!le||W&2)&&Q!==(Q=(((ge=A[1].btn)==null?void 0:ge.save)??"Save")+"")&&D(ie,Q);const te={};W&4&&(te.active=A[2]),W&2&&(te.message=((Ne=A[1].consent)==null?void 0:Ne.mask_saving)??"Saving"),fe.$set(te)},i(A){le||(X(fe.$$.fragment,A),le=!0)},o(A){x(fe.$$.fragment,A),le=!1},d(A){A&&(N(e),N(ue)),Pe(fe,A),de=!1,oe()}}}function A_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o={};Il.subscribe(f=>{l(1,o=f)});let a=!1;async function u(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let b of c){const[d,h]=b;m.append(d,h)}let v=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),hl.update(b=>(b.fwconsent=c.sf===!0?1:c.sf===!1?2:0,b.booting=v.reboot,b)),nn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,o,a,u,n]}class R_ extends Et{constructor(e){super(),It(this,e,A_,D_,Ct,{basepath:4,sysinfo:0})}}function Bf(t,e,l){const n=t.slice();return n[30]=e[l],n[31]=e,n[32]=l,n}function Uf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function O_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function zf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function L_(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function jf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Hf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Wf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Vf(t,e,l){const n=t.slice();return n[33]=e[l],n[35]=l,n}function Gf(t){let e,l=ft(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),r(Le,"class",xe=t[32]{l(0,i=B)});let o=["mo","tu","we","th","fr","sa","su"],a={},u=!0,f=!1;Jr.subscribe(B=>{B.o&&(l(1,a=B),l(2,u=!1))}),b1();async function c(B){l(3,f=!0);const H=new URLSearchParams;H.append("r","true"),H.append("rc",a.o.length),a.o.forEach(function(ee,Q){H.append("rt"+Q,ee.t),H.append("rn"+Q,ee.n),H.append("rd"+Q,ee.d),H.append("ra"+Q,ee.a),H.append("rh"+Q,ee.h),H.append("rv"+Q,ee.v),H.append("rsm"+Q,ee.s.m),H.append("rsd"+Q,ee.s.d),H.append("rem"+Q,ee.e.m),H.append("red"+Q,ee.e.d)}),await(await fetch("save",{method:"POST",body:H})).json(),l(3,f=!1),nn(n+"configuration")}let m=function(B,H){return B.includes(H)?B=B.filter(function(ne){return ne!==H}):B.push(H),B},_=function(){let B=a.o;B.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=B,a)},v=function(B){let H=a.o;H.splice(B,1),l(1,a.o=H,a)},b=function(B){if(B<=0)return;let H=a.o;var ne=H[B];H[B]=H[B-1],H[B-1]=ne,l(1,a.o=H,a)},d=function(B){let H=a.o;if(!(B>=H.length-1)){var ne=H[B];H[B]=H[B+1],H[B+1]=ne,l(1,a.o=H,a)}};function h(B,H){B[H].n=this.value,l(1,a)}function g(B,H){B[H].d=Yt(this),l(1,a)}function k(B,H){B[H].t=Yt(this),l(1,a)}function C(B,H){B[H].v=ye(this.value),l(1,a)}const I=(B,H,ne,ee)=>l(1,ne[ee].a=m(B.a,H),a),R=(B,H,ne,ee)=>l(1,ne[ee].h=m(B.h,H),a),E=(B,H,ne,ee)=>l(1,ne[ee].h=m(B.h,H+8),a),O=(B,H,ne,ee)=>l(1,ne[ee].h=m(B.h,H+16),a);function L(B,H){B[H].s.d=Yt(this),l(1,a)}function j(B,H){B[H].s.m=Yt(this),l(1,a)}function K(B,H){B[H].e.d=Yt(this),l(1,a)}function U(B,H){B[H].e.m=Yt(this),l(1,a)}const q=B=>b(B),y=B=>b(B),Z=B=>d(B),G=B=>d(B),Y=B=>v(B),V=B=>v(B);return t.$$set=B=>{"basepath"in B&&l(11,n=B.basepath)},[i,a,u,f,o,c,m,_,v,b,d,n,h,g,k,C,I,R,E,O,L,j,K,U,q,y,Z,G,Y,V]}class z_ extends Et{constructor(e){super(),It(this,e,U_,B_,Ct,{basepath:11},null,[-1,-1])}}function xf(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function er(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function tr(t){let e,l,n,i=ft(t[1]),o=[];for(let a=0;a{l(3,u=g)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let g in i)(g.startsWith("i")||g.startsWith("e"))&&l(0,i[g]=0,i)}let v=!1;async function b(g){l(5,v=!0);const k=new FormData(g.target),C=new URLSearchParams;for(let R of k){const[E,O]=R;C.append(E,O)}await(await fetch(o,{method:"POST",body:C})).json(),l(5,v=!1),nn(a)}function d(g){i[g.key]=ye(this.value),l(0,i)}function h(g){i[g.key]=ye(this.value),l(0,i)}return t.$$set=g=>{"prefix"in g&&l(8,n=g.prefix),"data"in g&&l(0,i=g.data),"url"in g&&l(9,o=g.url),"basepath"in g&&l(10,a=g.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let g in i){let k=[];g.startsWith("i")?k=c:g.startsWith("e")&&(k=m,i[g]&&l(4,f=!0)),k.push({key:g,name:n+" "+g.substring(1),value:i[g]})}}},[i,c,m,u,f,v,_,b,n,o,a,d,h]}class nu extends Et{constructor(e){super(),It(this,e,H_,j_,Ct,{prefix:8,data:0,url:9,basepath:10})}}function W_(t){let e,l;return e=new h1({props:{data:t[7],sysinfo:t[8],importPrices:t[1],exportPrices:t[2],dayPlot:t[3],monthPlot:t[4],temperatures:t[5],translations:t[6],tariffData:t[9]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&128&&(o.data=n[7]),i&256&&(o.sysinfo=n[8]),i&2&&(o.importPrices=n[1]),i&4&&(o.exportPrices=n[2]),i&8&&(o.dayPlot=n[3]),i&16&&(o.monthPlot=n[4]),i&32&&(o.temperatures=n[5]),i&64&&(o.translations=n[6]),i&512&&(o.tariffData=n[9]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function V_(t){let e,l;return e=new i_({props:{sysinfo:t[8],basepath:t[0],data:t[7]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function G_(t){let e,l;return e=new z_({props:{basepath:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function K_(t){let e,l;return e=new v_({props:{sysinfo:t[8],data:t[7]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function Y_(t){let e,l;return e=new bo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:ze,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function Q_(t){let e,l;return e=new bo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:ze,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function X_(t){let e,l;return e=new bo({props:{title:"private key",action:"/mqtt-key"}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:ze,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function Z_(t){let e,l;return e=new R_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function J_(t){let e,l;return e=new N_({props:{sysinfo:t[8]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function $_(t){let e,l;return e=new P_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function x_(t){let e,l;return e=new nu({props:{prefix:"UTC Hour",data:t[3],url:"/dayplot",basepath:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&8&&(o.data=n[3]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function em(t){let e,l;return e=new nu({props:{prefix:"Day",data:t[4],url:"/monthplot",basepath:t[0]}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&16&&(o.data=n[4]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function tm(t){let e,l,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C,I,R,E,O,L,j,K,U;return e=new pc({props:{data:t[7],basepath:t[0]}}),n=new Pl({props:{path:"/",$$slots:{default:[W_]},$$scope:{ctx:t}}}),o=new Pl({props:{path:"/configuration",$$slots:{default:[V_]},$$scope:{ctx:t}}}),u=new Pl({props:{path:"/priceconfig",$$slots:{default:[G_]},$$scope:{ctx:t}}}),c=new Pl({props:{path:"/status",$$slots:{default:[K_]},$$scope:{ctx:t}}}),_=new Pl({props:{path:"/mqtt-ca",$$slots:{default:[Y_]},$$scope:{ctx:t}}}),b=new Pl({props:{path:"/mqtt-cert",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),h=new Pl({props:{path:"/mqtt-key",$$slots:{default:[X_]},$$scope:{ctx:t}}}),k=new Pl({props:{path:"/consent",$$slots:{default:[Z_]},$$scope:{ctx:t}}}),I=new Pl({props:{path:"/setup",$$slots:{default:[J_]},$$scope:{ctx:t}}}),E=new Pl({props:{path:"/vendor",$$slots:{default:[$_]},$$scope:{ctx:t}}}),L=new Pl({props:{path:"/edit-day",$$slots:{default:[x_]},$$scope:{ctx:t}}}),K=new Pl({props:{path:"/edit-month",$$slots:{default:[em]},$$scope:{ctx:t}}}),{c(){Se(e.$$.fragment),l=w(),Se(n.$$.fragment),i=w(),Se(o.$$.fragment),a=w(),Se(u.$$.fragment),f=w(),Se(c.$$.fragment),m=w(),Se(_.$$.fragment),v=w(),Se(b.$$.fragment),d=w(),Se(h.$$.fragment),g=w(),Se(k.$$.fragment),C=w(),Se(I.$$.fragment),R=w(),Se(E.$$.fragment),O=w(),Se(L.$$.fragment),j=w(),Se(K.$$.fragment)},m(q,y){Ce(e,q,y),T(q,l,y),Ce(n,q,y),T(q,i,y),Ce(o,q,y),T(q,a,y),Ce(u,q,y),T(q,f,y),Ce(c,q,y),T(q,m,y),Ce(_,q,y),T(q,v,y),Ce(b,q,y),T(q,d,y),Ce(h,q,y),T(q,g,y),Ce(k,q,y),T(q,C,y),Ce(I,q,y),T(q,R,y),Ce(E,q,y),T(q,O,y),Ce(L,q,y),T(q,j,y),Ce(K,q,y),U=!0},p(q,y){const Z={};y&128&&(Z.data=q[7]),y&1&&(Z.basepath=q[0]),e.$set(Z);const G={};y&5118&&(G.$$scope={dirty:y,ctx:q}),n.$set(G);const Y={};y&4481&&(Y.$$scope={dirty:y,ctx:q}),o.$set(Y);const V={};y&4097&&(V.$$scope={dirty:y,ctx:q}),u.$set(V);const B={};y&4480&&(B.$$scope={dirty:y,ctx:q}),c.$set(B);const H={};y&4096&&(H.$$scope={dirty:y,ctx:q}),_.$set(H);const ne={};y&4096&&(ne.$$scope={dirty:y,ctx:q}),b.$set(ne);const ee={};y&4096&&(ee.$$scope={dirty:y,ctx:q}),h.$set(ee);const Q={};y&4353&&(Q.$$scope={dirty:y,ctx:q}),k.$set(Q);const ie={};y&4352&&(ie.$$scope={dirty:y,ctx:q}),I.$set(ie);const ue={};y&4353&&(ue.$$scope={dirty:y,ctx:q}),E.$set(ue);const fe={};y&4105&&(fe.$$scope={dirty:y,ctx:q}),L.$set(fe);const le={};y&4113&&(le.$$scope={dirty:y,ctx:q}),K.$set(le)},i(q){U||(X(e.$$.fragment,q),X(n.$$.fragment,q),X(o.$$.fragment,q),X(u.$$.fragment,q),X(c.$$.fragment,q),X(_.$$.fragment,q),X(b.$$.fragment,q),X(h.$$.fragment,q),X(k.$$.fragment,q),X(I.$$.fragment,q),X(E.$$.fragment,q),X(L.$$.fragment,q),X(K.$$.fragment,q),U=!0)},o(q){x(e.$$.fragment,q),x(n.$$.fragment,q),x(o.$$.fragment,q),x(u.$$.fragment,q),x(c.$$.fragment,q),x(_.$$.fragment,q),x(b.$$.fragment,q),x(h.$$.fragment,q),x(k.$$.fragment,q),x(I.$$.fragment,q),x(E.$$.fragment,q),x(L.$$.fragment,q),x(K.$$.fragment,q),U=!1},d(q){q&&(N(l),N(i),N(a),N(f),N(m),N(v),N(d),N(g),N(C),N(R),N(O),N(j)),Pe(e,q),Pe(n,q),Pe(o,q),Pe(u,q),Pe(c,q),Pe(_,q),Pe(b,q),Pe(h,q),Pe(k,q),Pe(I,q),Pe(E,q),Pe(L,q),Pe(K,q)}}}function or(t){let e,l,n,i;const o=[nm,lm],a=[];function u(f,c){return f[8].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Wt()},m(f,c){a[e].m(f,c),T(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(ct(),x(a[m],1,1,()=>{a[m]=null}),_t(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){x(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function lm(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p:ze,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function nm(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[8].trying}}),{c(){Se(e.$$.fragment)},m(n,i){Ce(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.message="Device is booting, please wait. Trying to reach it on "+n[8].trying),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){x(e.$$.fragment,n),l=!1},d(n){Pe(e,n)}}}function im(t){let e,l,n,i;l=new Dr({props:{basepath:t[0],$$slots:{default:[tm]},$$scope:{ctx:t}}});let o=t[8].booting&&or(t);return{c(){e=p("div"),Se(l.$$.fragment),n=w(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(a,u){T(a,e,u),Ce(l,e,null),s(e,n),o&&o.m(e,null),i=!0},p(a,[u]){const f={};u&1&&(f.basepath=a[0]),u&5119&&(f.$$scope={dirty:u,ctx:a}),l.$set(f),a[8].booting?o?(o.p(a,u),u&256&&X(o,1)):(o=or(a),o.c(),X(o,1),o.m(e,null)):o&&(ct(),x(o,1,1,()=>{o=null}),_t())},i(a){i||(X(l.$$.fragment,a),X(o),i=!0)},o(a){x(l.$$.fragment,a),x(o),i=!1},d(a){a&&N(e),Pe(l),o&&o.d()}}}function om(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Br.subscribe(h=>{l(1,i=h)});let o;Ur.subscribe(h=>{l(2,o=h)});let a;jr.subscribe(h=>{l(3,a=h)});let u;Hr.subscribe(h=>{l(4,u=h)});let f;Wr.subscribe(h=>{l(5,f=h)});let c={};Il.subscribe(h=>{l(6,c=h)});let m,_={},v={},b;hl.subscribe(h=>{var g;l(8,v=h),v.vndcfg===!1?nn(n+"vendor"):v.usrcfg===!1?nn(n+"setup"):v.fwconsent===0&&nn(n+"consent"),v.ui.k===1?document.documentElement.classList.add("dark"):v.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),v.ui.lang&&v.ui.lang!=((g=c==null?void 0:c.language)==null?void 0:g.code)&&Kr(v.ui.lang),v.version&&b&&v.version!=b&&window.location.reload(),b=v.version,m&&clearTimeout(m),m=setTimeout(Ni,!_||!_.u||_.u<30||v!=null&&v.upgrading?1e4:3e5)}),O0.subscribe(h=>{l(7,_=h),i1(h)});let d={};return Gr.subscribe(h=>{l(9,d=h)}),Vr(),[n,i,o,a,u,f,c,_,v,d]}class sm extends Et{constructor(e){super(),It(this,e,om,im,Ct,{})}}new sm({target:document.getElementById("app")}); +Occurred in: ${i}`:"",a=co(t),u=vr(e)?e(a):e;return`<${a}> ${u}${o}`}const qr=t=>(...e)=>t(Hu(...e)),Ar=qr(t=>{throw new Error(t)}),Ci=qr(console.warn),Mo=4,Wu=3,Vu=2,Gu=1,Ku=1;function Yu(t,e){const l=t.default?0:Dl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Mo,Ru(i)?o+=Ku:Ou(i)?o+=Vu:Mr(i)?o-=Mo+Gu:o+=Wu,o},0);return{route:t,score:l,index:e}}function Qu(t){return t.map(Yu).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Rr(t,e){let l,n;const[i]=e.split("?"),o=Dl(i),a=o[0]==="",u=Qu(t);for(let f=0,c=u.length;f({...m,params:v,uri:k});if(m.default){n=b(e);continue}const d=Dl(m.fullPath),h=Math.max(o.length,d.length);let g=0;for(;g{c===".."?f.pop():c!=="."&&f.push(c)}),Ai(`/${f.join("/")}`,n)}function Io(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=Dl(e,!0),u=Dl(l,!0);for(;a.length;)a[0]!==u[0]&&Ar(pn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:ai(...u),hash:n,search:i,state:o}}const Eo=t=>t.length===1?"":t,_o=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Eo(Zn(t,l)):"",a=i?Zn(t,0,l):t,u=n?Eo(Zn(a,e)):"";return{pathname:(n?Zn(a,0,e):a)||"/",search:u,hash:o}},Zu=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function Ju(t,e,l){return ai(l,Xu(t,e))}function $u(t,e){const l=ro(Lu(t)),n=Dl(l,!0),i=Dl(e,!0).slice(0,n.length),o=Or({fullPath:l},ai(...i));return o&&o.uri}const Ri="POP",xu="PUSH",e0="REPLACE";function Oi(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function t0(t){let e=[],l=Oi(t),n=Ri;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Oi(t),n=Ri,i([o])};i([o]);const u=kr(t,"popstate",a);return()=>{u(),e=e.filter(f=>f!==o)}},navigate(o,a){const{state:u={},replace:f=!1}=a||{};if(n=f?e0:xu,br(o))a&&Ci(Tr,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ri,t.history.go(o);else{const c={...u,_key:Du()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Oi(t),i()}}}function Li(t,e){return{..._o(e),state:t}}function l0(t="/"){let e=0,l=[Li(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(Li(n,o))},replaceState(n,i,o){l[e]=Li(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const n0=!!(!Rl&&window.document&&window.document.createElement),i0=!Rl&&window.location.origin==="null",Lr=t0(n0&&!i0?window:l0()),{navigate:nn}=Lr;let Tl=null,Fr=!0;function o0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&o0(t.routerId,Tl.routerId))&&(Tl=t)}function a0(){Tl=null}function f0(){Fr=!1}function No(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=kr(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function r0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function u0(t){return/^H[1-6]$/i.test(t.tagName)}function Do(t,e=document){return e.querySelector(t)}function c0(t){let l=Do(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!r0(l,t);){if(u0(l))return l;const n=Do("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function _0(t){Promise.resolve(un(t.focusElement)).then(e=>{const l=e||c0(t.id);l||Ci(pn,`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,Ei),!No(l)&&No(document.documentElement)})}const m0=(t,e,l)=>(n,i)=>Pu().then(()=>{if(!Tl||Fr){f0();return}if(n&&_0(Tl.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:f,uri:c}=Tl.route,m=t.createAnnouncement({path:o,fullPath:a,meta:u,params:f,uri:c},un(l));Promise.resolve(m).then(_=>{e.set(_)})}a0()}),p0="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 d0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},wr(t[6],p0)],i={};for(let o=0;o`Navigated to ${K.uri}`,announcements:!0,...d},k=m,C=ro(m),I=on(Hi),R=on(Mn),E=!I,O=v0(),L=b&&!(R&&!R.manageFocus),z=cl("");Nl(t,z,K=>l(0,u=K));const V=R?R.disableInlineStyles:h,B=cl([]);Nl(t,B,K=>l(20,a=K));const T=cl(null);Nl(t,T,K=>l(18,i=K));let y=!1;const J=E?0:R.level+1,Y=E?cl((()=>Io(Rl?_o(_):v.location,C))()):I;Nl(t,Y,K=>l(17,n=K));const H=cl(n);Nl(t,H,K=>l(19,o=K));const G=m0(g,z,Y),$=K=>ee=>ee.filter(ae=>ae.id!==K);function Q(K){if(Rl){if(y)return;const ee=Or(K,n.pathname);if(ee)return y=!0,ee}else B.update(ee=>{const ae=$(K.id)(ee);return ae.push(K),ae})}function Z(K){B.update($(K))}return!E&&m!==To&&Ci(pn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:m}),E&&(fo(()=>v.listen(ee=>{const ae=Io(ee.location,C);H.set(n),Y.set(ae)})),ei(Hi,Y)),ei(Mn,{activeRoute:T,registerRoute:Q,unregisterRoute:Z,manageFocus:L,level:J,id:O,history:E?v:R.history,basepath:E?C:R.basepath,disableInlineStyles:V}),t.$$set=K=>{"basepath"in K&&l(11,m=K.basepath),"url"in K&&l(12,_=K.url),"history"in K&&l(13,v=K.history),"primary"in K&&l(14,b=K.primary),"a11y"in K&&l(15,d=K.a11y),"disableInlineStyles"in K&&l(16,h=K.disableInlineStyles),"$$scope"in K&&l(21,c=K.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&m!==k&&Ci(pn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const K=Rr(a,n.pathname);T.set(K)}if(t.$$.dirty[0]&655360&&E){const K=!!n.hash,ee=!K&&L,ae=!K||n.pathname!==o.pathname;G(ee,ae)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&s0({level:J,routerId:O,route:i})},[u,g,E,O,L,z,V,B,T,Y,H,m,_,v,b,d,h,n,i,o,a,c,f]}class g0 extends Rt{constructor(e){super(),At(this,e,b0,h0,Nt,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const yr=g0;function fi(t,e,l=Mn,n=pn){on(l)||Ar(t,o=>`You cannot use ${o} outside of a ${co(n)}.`,e)}const k0=t=>{const{subscribe:e}=on(t);return{subscribe:e}};function Br(){return fi(Er),k0(Hi)}function Ur(){const{history:t}=on(Mn);return t}function zr(){const t=on(Pr);return t?Tu(t,e=>e.base):cl("/")}function jr(){fi(Dr);const t=zr(),{basepath:e}=on(Mn);return n=>Ju(n,un(t),e)}function w0(){fi(Nr);const t=jr(),{navigate:e}=Ur();return(n,i)=>{const o=br(n)?n:t(n);return e(o,i)}}const C0=t=>({params:t&16,location:t&8}),qo=t=>({params:Rl?un(t[10]):t[4],location:t[3],navigate:t[11]});function Ao(t){let e,l;return e=new yr({props:{primary:t[1],$$slots:{default:[M0]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function P0(t){let e;const l=t[18].default,n=io(l,t,t[19],qo);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&so(n,l,i,i[19],e?oo(l,i[19],o,C0):ao(i[19]),qo)},i(i){e||(X(n,i),e=!0)},o(i){te(n,i),e=!1},d(i){n&&n.d(i)}}}function S0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Rl?un(t[10]):t[4],t[12]];var o=t[0];function a(u,f){let c={};for(let m=0;m{Se(c,1)}),pt()}o?(e=Co(o,a(u,f)),Me(e.$$.fragment),X(e.$$.fragment,1),Pe(e,l.parentNode,l)):e=null}else if(o){const c=f&7192?zi(i,[f&8&&{location:u[3]},f&2048&&{navigate:u[11]},f&1040&&ci(Rl?un(u[10]):u[4]),f&4096&&ci(u[12])]):{};e.$set(c)}},i(u){n||(e&&X(e.$$.fragment,u),n=!0)},o(u){e&&te(e.$$.fragment,u),n=!1},d(u){u&&N(l),e&&Se(e,u)}}}function M0(t){let e,l,n,i;const o=[S0,P0],a=[];function u(f,c){return f[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Qt()},m(f,c){a[e].m(f,c),D(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(mt(),te(a[m],1,1,()=>{a[m]=null}),pt(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){te(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function I0(t){let e,l,n,i,o,a=[ji(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let _=0;_{f=null}),pt())},i(_){o||(X(f),o=!0)},o(_){te(f),o=!1},d(_){_&&(N(e),N(l),N(n),N(i)),f&&f.d(_)}}}const E0=gr();function N0(t,e,l){let n;const i=["path","component","meta","primary"];let o=ki(e,i),a,u,f,c,{$$slots:m={},$$scope:_}=e,{path:v=""}=e,{component:b=null}=e,{meta:d={}}=e,{primary:h=!0}=e;fi(Ei,e);const g=E0(),{registerRoute:k,unregisterRoute:C,activeRoute:I,disableInlineStyles:R}=on(Mn);Nl(t,I,y=>l(16,a=y));const E=zr();Nl(t,E,y=>l(17,f=y));const O=Br();Nl(t,O,y=>l(3,u=y));const L=cl(null);let z;const V=cl(),B=cl({});Nl(t,B,y=>l(4,c=y)),ei(Pr,V),ei(qu,B),ei(Au,L);const T=w0();return Rl||wu(()=>C(g)),t.$$set=y=>{l(24,e=Ml(Ml({},e),gi(y))),l(12,o=ki(e,i)),"path"in y&&l(13,v=y.path),"component"in y&&l(0,b=y.component),"meta"in y&&l(14,d=y.meta),"primary"in y&&l(1,h=y.primary),"$$scope"in y&&l(19,_=y.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const y=v==="",J=ai(f,v),W={id:g,path:v,meta:d,default:y,fullPath:y?"":J,base:y?f:$u(J,u.pathname),primary:h,focusElement:L};V.set(W),l(15,z=k(W))}if(t.$$.dirty&98304&&l(2,n=!!(z||a&&a.id===g)),t.$$.dirty&98308&&n){const{params:y}=z||a;B.set(y)}},e=gi(e),[b,h,n,u,c,g,I,R,E,O,B,T,o,v,d,z,a,f,m,_]}class D0 extends Rt{constructor(e){super(),At(this,e,N0,I0,Nt,{path:13,component:0,meta:14,primary:1})}}const Pl=D0;function T0(t){let e,l,n,i;const o=t[13].default,a=io(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=L));const I=Cu(),R=jr(),{navigate:E}=Ur();function O(L){I("click",L),Nu(L)&&(L.preventDefault(),E(n,{state:g,replace:a||h}))}return t.$$set=L=>{l(19,e=Ml(Ml({},e),gi(L))),l(18,m=ki(e,c)),"to"in L&&l(5,d=L.to),"replace"in L&&l(6,h=L.replace),"state"in L&&l(7,g=L.state),"getProps"in L&&l(8,k=L.getProps),"$$scope"in L&&l(12,b=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=R(d,_)),t.$$.dirty&2049&&l(10,i=Wi(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=_o(n)===Zu(_)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(vr(k)){const L=k({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...m,...L}}return m})())},e=gi(e),[n,f,u,C,O,d,h,g,k,o,i,_,b,v]}class A0 extends Rt{constructor(e){super(),At(this,e,q0,T0,Nt,{to:5,replace:6,state:7,getProps:8})}}const wl=A0;function ln(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function R0(t,e){return t>218&&t<242?"#23ac05":t>212&&t<248?"#b1d900":t>208&&t<252?"#a3b200":"#b20000"}function Ni(t,e){let l;return t>90?l="#b20000":t>85?l="#b19601":t>80?l="#a3b200":t>75?l="#569f12":l="#23ac05",l}function li(t){return t>75?"#23ac05":t>50?"#77d900":t>25?"#94d900":"#569f12"}function Pi(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function yt(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function xe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 245:return"wESP32";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}return"Unknown"}function cn(t){switch(t){case 2:case 4:case 7:return!0}return!1}function tl(t,e){return t==1||t==2&&e}function bl(t){let e="https://wiki.amsleser.no";return t&&(e+="/en/firmware#"+t),e}function ll(t,e){return t==null||isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function _n(t,e){return t.setTime(t.getTime()+e*36e5),t}function O0(t,e){return t.setTime(t.getTime()+e*6e4),t}function L0(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function F0(t){return t=="EOE"?"https://transparency.entsoe.eu/":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let _i=0;function ni(t,e){var l="";_i++;var n=function(){setTimeout(ni,1e3,t,e)};if(t.net.ip&&_i%3==0){if(!t.net.ip){n();return}l="http://"+t.net.ip}else t.hostname&&_i%3==1?l="http://"+t.hostname:t.hostname&&_i%3==2?l="http://"+t.hostname+".local":l="";console&&console.log("Trying url "+l),e&&e(l);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",n),i.addEventListener("error",n),i.addEventListener("timeout",n),i.addEventListener("load",function(o){window.location.href=l||"/"}),i.open("GET",l+"/is-alive",!0),i.send()}function al(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ro(t){return t.startsWith("esp32")?"esp32":t}function pl(t,e){let l=[t,e];return typeof t>"u"?(l[0]="-",l[1]=e):t>=1e9?(l[0]=(t/1e6).toFixed(t>1e10?0:1),l[1]="M"+e):t>1e4?(l[0]=(t/1e3).toFixed(t>1e6?0:t>1e5?1:2),l[1]="k"+e):(l[0]=t.toFixed(0),l[1]=e),l}function ii(t,e){let l=[ll(t,2),e];if(typeof t>"u")l[0]="-",l[1]=e;else if(Math.abs(t*100)<100){switch(l[0]=ll(t*100,2),e){case"NOK":case"DKK":e="øre";break;case"SEK":e="öre";break;case"EUR":e="cent";break;case"CHF":e="rp.";break;default:e=e+"/100"}l[1]=e}return l}let mn="((25[0-5]|(2[0-4]|1\\d|[1-9]|)\\d)\\.?\\b){4}",Ol="[\\x20-\\x7E]+",In="[\\x20-\\xFF]+",Si="[A-Za-z0-9_\\-]+",Hr="[0-9A-Fa-f]+",Xn="[0-9]+",vi={},Vi=[];async function y0(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 Fi;async function Wr(){if(Vi.length){let t=Vi.shift();delete vi[t.resource];try{let e=await y0(t.resource,t.options);for(let l in t.callbacks)t.callbacks[l](e.clone())}catch(e){console.error("Error calling "+t.resource,e);for(let l in t.callbacks)t.callbacks[l]()}}Fi&&clearTimeout(Fi),Fi=setTimeout(Wr,100)}Wr();async function Cl(t,e={}){let l;return vi[t]?l=vi[t]:(l={resource:t,options:e,callbacks:[]},vi[t]=l,Vi.push(l)),new Promise(i=>l.callbacks.push(i))}let El={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};async function Di(){El=await(await Cl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),hl.set(El)}const hl=cl(El,t=>(Di(),function(){}));function B0(t){hl.update(e=>(e.trying=t,e))}let mi=0,Oo=-127,Lo=null,U0={};const z0=Cr(U0,t=>{let e,l;async function n(){Cl("data.json").then(i=>i.json()).then(i=>{t(i),Oo!=i.t&&(Oo=i.t,setTimeout(j0,2e3)),i.pe&&i.p!=Lo&&(Lo=i.p,Kr()),(!El||!El.chip||El.booting||mi>1&&!cn(El.board))&&(Di(),ql&&clearTimeout(ql),ql=setTimeout(Yi,2e3),Al&&clearTimeout(Al),Al=setTimeout(Xi,3e3)),i.u,ql||(ql=Yi()),Al||(Al=Xi());let o=5e3;if(cn(El.board)&&i.v>2.5){let a=3.3-Math.min(3.3,i.v);a>0&&(o=Math.max(a,.1)*10*5e3)}o>5e3&&console.log("Next in "+o+"ms"),e&&clearTimeout(e),e=setTimeout(n,o),mi=0}).catch(i=>{mi++,mi>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3),l||(l=setTimeout(ni,5e3,El,B0))):e=setTimeout(n,cn(El.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let pi,kn={};const Vr=cl(kn);let Gi={};const Gr=cl(Gi);async function Kr(){pi&&(clearTimeout(pi),pi=0),kn=await(await Cl("importprice.json")).json(),Vr.set(kn),kn!=null&&kn.importExportPriceDifferent&&(Gi=await(await Cl("exportprice.json")).json(),Gr.set(Gi)),pi=setTimeout(Kr,(24-new Date().getHours())*36e5+10)}let Ki={},ql;async function Yi(){ql&&(clearTimeout(ql),ql=0),Ki=await(await Cl("dayplot.json")).json(),Yr.set(Ki),ql=setTimeout(Yi,(60-new Date().getMinutes())*6e4+20)}const Yr=cl(Ki,t=>function(){});let Qi={},Al;async function Xi(){Al&&(clearTimeout(Al),Al=0),Qi=await(await Cl("monthplot.json")).json(),Qr.set(Qi),Al=setTimeout(Xi,(24-new Date().getHours())*36e5+40)}const Qr=cl(Qi,t=>function(){});let Zi={};async function j0(){Zi=await(await Cl("temperature.json")).json(),Xr.set(Zi)}const Xr=cl(Zi,t=>function(){});let Ji={},di;async function Zr(){di&&(clearTimeout(di),di=0),Ji=await(await Cl("tariff.json")).json(),Jr.set(Ji),di=setTimeout(Zr,(60-new Date().getMinutes())*6e4+30)}const Jr=cl(Ji,t=>function(){});let wn={c:-1,n:[]};async function H0(){let e=await(await Cl("wifiscan.json",{timeout:3e4})).json(),l=[];wn.c=0,wn.n=[];for(let n=0;n(H0(),function(){}));let $i=!1;const Il=cl($i);async function $r(t){$i=await(await Cl("translations.json"+(t?"?lang="+t:""))).json(),Il.set($i)}$r();function Fo(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 xr(t){return await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function yo(t){var f;let e=(((f=t[1].header)==null?void 0:f.uptime)??"Up")+"",l,n,i;function o(c,m){return c[2]>1?X0:c[2]>0?Q0:c[3]>1?Y0:c[3]>0?K0:c[4]>1?G0:c[4]>0?V0:W0}let a=o(t),u=a(t);return{c(){l=M(e),n=w(),u.c(),i=Qt()},m(c,m){D(c,l,m),D(c,n,m),u.m(c,m),D(c,i,m)},p(c,m){var _;m&2&&e!==(e=(((_=c[1].header)==null?void 0:_.uptime)??"Up")+"")&&q(l,e),a===(a=o(c))&&u?u.p(c,m):(u.d(1),u=a(c),u&&(u.c(),u.m(i.parentNode,i)))},d(c){c&&(N(l),N(n),N(i)),u.d(c)}}}function W0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.seconds)??"s")+"",i;return{c(){e=M(t[0]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&1&&q(e,a[0]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.seconds)??"s")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function V0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minute)??"m")+"",i;return{c(){e=M(t[4]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&16&&q(e,a[4]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minute)??"m")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function G0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.minutes)??"m")+"",i;return{c(){e=M(t[4]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&16&&q(e,a[4]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.minutes)??"m")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function K0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hour)??"h")+"",i;return{c(){e=M(t[3]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&8&&q(e,a[3]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hour)??"h")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function Y0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.hours)??"h")+"",i;return{c(){e=M(t[3]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&8&&q(e,a[3]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.hours)??"h")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function Q0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.day)??"d")+"",i;return{c(){e=M(t[2]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&4&&q(e,a[2]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.day)??"d")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function X0(t){var o;let e,l,n=(((o=t[1].common)==null?void 0:o.days)??"d")+"",i;return{c(){e=M(t[2]),l=w(),i=M(n)},m(a,u){D(a,e,u),D(a,l,u),D(a,i,u)},p(a,u){var f;u&4&&q(e,a[2]),u&2&&n!==(n=(((f=a[1].common)==null?void 0:f.days)??"d")+"")&&q(i,n)},d(a){a&&(N(e),N(l),N(i))}}}function Z0(t){let e,l=t[0]&&yo(t);return{c(){l&&l.c(),e=Qt()},m(n,i){l&&l.m(n,i),D(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=yo(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:He,o:He,d(n){n&&N(e),l&&l.d(n)}}}function J0(t,e,l){let{epoch:n}=e,i={};Il.subscribe(f=>{l(1,i=f)});let o=0,a=0,u=0;return t.$$set=f=>{"epoch"in f&&l(0,n=f.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(2,o=Math.floor(n/86400)),l(3,a=Math.floor(n/3600)),l(4,u=Math.floor(n/60)))},[n,i,o,a,u]}class $0 extends Rt{constructor(e){super(),At(this,e,J0,Z0,Nt,{epoch:0})}}function x0(t){let e,l,n;return{c(){e=p("span"),l=M(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){D(i,e,o),s(e,l)},p(i,[o]){o&4&&q(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:He,o:He,d(i){i&&N(e)}}}function ec(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class fn extends Rt{constructor(e){super(),At(this,e,ec,x0,Nt,{color:0,title:1,text:2})}}function tc(t){let e,l=`${yt(t[0].getDate())}.${yt(t[0].getMonth()+1)}.${t[0].getFullYear()} ${yt(t[0].getHours())}:${yt(t[0].getMinutes())}`,n;return{c(){e=p("span"),n=M(l),r(e,"class",t[1])},m(i,o){D(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${yt(i[0].getDate())}.${yt(i[0].getMonth()+1)}.${i[0].getFullYear()} ${yt(i[0].getHours())}:${yt(i[0].getMinutes())}`)&&q(n,l),o&2&&r(e,"class",i[1])},d(i){i&&N(e)}}}function lc(t){var n;let e=`${yt(t[0].getDate())}. ${t[2].months?(n=t[2].months)==null?void 0:n[t[0].getMonth()]:yt(t[0].getMonth()+1)} ${yt(t[0].getHours())}:${yt(t[0].getMinutes())}`,l;return{c(){l=M(e)},m(i,o){D(i,l,o)},p(i,o){var a;o&5&&e!==(e=`${yt(i[0].getDate())}. ${i[2].months?(a=i[2].months)==null?void 0:a[i[0].getMonth()]:yt(i[0].getMonth()+1)} ${yt(i[0].getHours())}:${yt(i[0].getMinutes())}`)&&q(l,e)},d(i){i&&N(l)}}}function nc(t){let e;function l(o,a){return o[3]?lc:tc}let n=l(t),i=n(t);return{c(){i.c(),e=Qt()},m(o,a){i.m(o,a),D(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:He,o:He,d(o){o&&N(e),i.d(o)}}}function ic(t,e,l){let n={};Il.subscribe(f=>{l(2,n=f)});let{timestamp:i}=e,{fullTimeColor:o}=e,{offset:a}=e,u;return t.$$set=f=>{"timestamp"in f&&l(0,i=f.timestamp),"fullTimeColor"in f&&l(1,o=f.fullTimeColor),"offset"in f&&l(4,a=f.offset)},t.$$.update=()=>{t.$$.dirty&17&&(l(3,u=Math.abs(new Date().getTime()-i.getTime())<3e5),isNaN(a)||_n(i,a-(24+i.getHours()-i.getUTCHours())%24))},[i,o,n,u,a]}class eu extends Rt{constructor(e){super(),At(this,e,ic,nc,Nt,{timestamp:0,fullTimeColor:1,offset:4})}}function oc(t){let e,l,n;return{c(){e=Ht("svg"),l=Ht("path"),n=Ht("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){D(i,e,o),s(e,l),s(e,n)},p:He,i:He,o:He,d(i){i&&N(e)}}}class sc extends Rt{constructor(e){super(),At(this,e,null,oc,Nt,{})}}function ac(t){let e,l;return{c(){e=Ht("svg"),l=Ht("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){D(n,e,i),s(e,l)},p:He,i:He,o:He,d(n){n&&N(e)}}}class fc extends Rt{constructor(e){super(),At(this,e,null,ac,Nt,{})}}function rc(t){let e,l;return{c(){e=Ht("svg"),l=Ht("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){D(n,e,i),s(e,l)},p:He,i:He,o:He,d(n){n&&N(e)}}}class uc extends Rt{constructor(e){super(),At(this,e,null,rc,Nt,{})}}function cc(t){let e,l,n=t[2].version+"",i;return{c(){e=M("AMS reader "),l=p("span"),i=M(n)},m(o,a){D(o,e,a),D(o,l,a),s(l,i)},p(o,a){a&4&&n!==(n=o[2].version+"")&&q(i,n)},d(o){o&&(N(e),N(l))}}}function Bo(t){let e,l=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",n,i;return{c(){e=p("div"),n=M(l),i=M("°C"),r(e,"class","flex-none my-auto")},m(o,a){D(o,e,a),s(e,n),s(e,i)},p(o,a){a&2&&l!==(l=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&q(n,l)},d(o){o&&N(e)}}}function Uo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.han)??"HAN")+": "+(((a=(o=t[4].errors)==null?void 0:o.han)==null?void 0:a[t[1].he])??t[1].he),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){D(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.han)??"HAN")+": "+(((_=(m=u[4].errors)==null?void 0:m.han)==null?void 0:_[u[1].he])??u[1].he))&&q(n,l)},d(u){u&&N(e)}}}function zo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.mqtt)??"MQTT")+": "+(((a=(o=t[4].errors)==null?void 0:o.mqtt)==null?void 0:a[t[1].me])??t[1].me),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){D(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.mqtt)??"MQTT")+": "+(((_=(m=u[4].errors)==null?void 0:m.mqtt)==null?void 0:_[u[1].me])??u[1].me))&&q(n,l)},d(u){u&&N(e)}}}function jo(t){var i,o,a;let e,l=(((i=t[4].header)==null?void 0:i.price)??"PS")+": "+(((a=(o=t[4].errors)==null?void 0:o.price)==null?void 0:a[t[1].ee])??t[1].ee),n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(u,f){D(u,e,f),s(e,n)},p(u,f){var c,m,_;f&18&&l!==(l=(((c=u[4].header)==null?void 0:c.price)??"PS")+": "+(((_=(m=u[4].errors)==null?void 0:m.price)==null?void 0:_[u[1].ee])??u[1].ee))&&q(n,l)},d(u){u&&N(e)}}}function Ho(t){let e,l,n,i,o,a,u,f;return l=new wl({props:{to:"/configuration",$$slots:{default:[_c]},$$scope:{ctx:t}}}),a=new wl({props:{to:"/status",$$slots:{default:[mc]},$$scope:{ctx:t}}}),{c(){var c,m;e=p("div"),Me(l.$$.fragment),i=w(),o=p("div"),Me(a.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title",n=((c=t[4].header)==null?void 0:c.config)??""),r(o,"class","flex-none px-1 mt-1"),r(o,"title",u=((m=t[4].header)==null?void 0:m.status)??"")},m(c,m){D(c,e,m),Pe(l,e,null),D(c,i,m),D(c,o,m),Pe(a,o,null),f=!0},p(c,m){var b,d;const _={};m&64&&(_.$$scope={dirty:m,ctx:c}),l.$set(_),(!f||m&16&&n!==(n=((b=c[4].header)==null?void 0:b.config)??""))&&r(e,"title",n);const v={};m&64&&(v.$$scope={dirty:m,ctx:c}),a.$set(v),(!f||m&16&&u!==(u=((d=c[4].header)==null?void 0:d.status)??""))&&r(o,"title",u)},i(c){f||(X(l.$$.fragment,c),X(a.$$.fragment,c),f=!0)},o(c){te(l.$$.fragment,c),te(a.$$.fragment,c),f=!1},d(c){c&&(N(e),N(i),N(o)),Se(l),Se(a)}}}function _c(t){let e,l;return e=new sc({}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function mc(t){let e,l;return e=new fc({}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function pc(t){let e,l;function n(a,u){return a[2].security==0||a[1].a?vc:hc}let i=n(t),o=i(t);return{c(){var a;e=p("div"),o.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",l=(((a=t[4].header)==null?void 0:a.new_version)??"New version")+": "+t[2].upgrade.n)},m(a,u){D(a,e,u),o.m(e,null)},p(a,u){var f;i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null))),u&20&&l!==(l=(((f=a[4].header)==null?void 0:f.new_version)??"New version")+": "+a[2].upgrade.n)&&r(e,"title",l)},d(a){a&&N(e),o.d()}}}function dc(t){let e,l,n=t[2].upgrade.t+"",i,o,a=t[3].toFixed(1)+"",u,f;return{c(){e=p("div"),l=M("Upgrading to "),i=M(n),o=M(", "),u=M(a),f=M("%"),r(e,"class","flex-none mr-3 mt-1 text-yellow-300")},m(c,m){D(c,e,m),s(e,l),s(e,i),s(e,o),s(e,u),s(e,f)},p(c,m){m&4&&n!==(n=c[2].upgrade.t+"")&&q(i,n),m&8&&a!==(a=c[3].toFixed(1)+"")&&q(u,a)},d(c){c&&N(e)}}}function hc(t){var u;let e,l=(((u=t[4].header)==null?void 0:u.new_version)??"New version")+"",n,i,o=t[2].upgrade.n+"",a;return{c(){e=p("span"),n=M(l),i=M(": "),a=M(o)},m(f,c){D(f,e,c),s(e,n),s(e,i),s(e,a)},p(f,c){var m;c&16&&l!==(l=(((m=f[4].header)==null?void 0:m.new_version)??"New version")+"")&&q(n,l),c&4&&o!==(o=f[2].upgrade.n+"")&&q(a,o)},d(f){f&&N(e)}}}function vc(t){var m;let e,l,n=(((m=t[4].header)==null?void 0:m.new_version)??"New version")+"",i,o,a=t[2].upgrade.n+"",u,f,c;return{c(){e=p("button"),l=p("span"),i=M(n),o=M(": "),u=M(a),r(l,"class","mt-1"),r(e,"class","flex")},m(_,v){D(_,e,v),s(e,l),s(l,i),s(l,o),s(l,u),f||(c=ue(e,"click",t[5]),f=!0)},p(_,v){var b;v&16&&n!==(n=(((b=_[4].header)==null?void 0:b.new_version)??"New version")+"")&&q(i,n),v&4&&a!==(a=_[2].upgrade.n+"")&&q(u,a)},d(_){_&&N(e),f=!1,c()}}}function bc(t){var he,be;let e,l,n,i,o,a,u,f,c,m,_,v=(((he=t[4].header)==null?void 0:he.mem)??"Free")+"",b,d,h=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",g,k,C,I,R,E,O,L,z,V,B,T,y,J,W,Y,H,G,$,Q,Z,K,ee,ae,fe,ne,pe,ie,_e,oe,me;i=new wl({props:{to:"/",$$slots:{default:[cc]},$$scope:{ctx:t}}}),f=new $0({props:{epoch:t[1].u}});let we=t[1].t>-50&&Bo(t);R=new fn({props:{title:"ESP",text:t[2].booting?((be=t[4].header)==null?void 0:be.booting)??"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:ln(t[2].booting?2:t[1].em)}}),O=new fn({props:{title:"HAN",text:"HAN",color:ln(t[2].booting?9:t[1].hm)}}),z=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:ln(t[2].booting?9:t[1].wm)}}),B=new fn({props:{title:"MQTT",text:"MQTT",color:ln(t[2].booting?9:t[1].mm)}});let S=(t[1].he<0||t[1].he>0)&&Uo(t),P=t[1].me<0&&zo(t),F=(t[1].ee>0||t[1].ee<0)&&jo(t);ee=new eu({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let A=t[2].vndcfg&&t[2].usrcfg&&Ho(t);ie=new uc({});function j(x,de){if(x[2].upgrading)return dc;if(x[2].fwconsent===1&&x[2].upgrade.n)return pc}let le=j(t),re=le&&le(t);return{c(){var x;e=p("nav"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=w(),a=p("div"),u=p("div"),Me(f.$$.fragment),c=w(),we&&we.c(),m=w(),_=p("div"),b=M(v),d=M(": "),g=M(h),k=M("kb"),C=w(),I=p("div"),Me(R.$$.fragment),E=w(),Me(O.$$.fragment),L=w(),Me(z.$$.fragment),V=w(),Me(B.$$.fragment),T=w(),S&&S.c(),y=w(),P&&P.c(),J=w(),F&&F.c(),W=w(),Y=p("div"),H=p("div"),G=p("a"),$=p("img"),Z=w(),K=p("div"),Me(ee.$$.fragment),ae=w(),A&&A.c(),fe=w(),ne=p("div"),pe=p("a"),Me(ie.$$.fragment),oe=w(),re&&re.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r(I,"class","flex-auto flex-wrap my-auto justify-center p-2"),r($,"class","logo"),bi($.src,Q=(t[0]+"/logo.svg").replace("//","/"))||r($,"src",Q),r($,"alt","GitHub repo"),r(G,"class","float-right"),r(G,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(G,"target","_blank"),r(G,"rel","noreferrer"),r(G,"aria-label","GitHub"),r(H,"class","flex-none"),r(K,"class","flex-none my-auto px-2"),r(pe,"href",bl("")),r(pe,"target","_blank"),r(pe,"rel","noreferrer"),r(ne,"class","flex-none px-1 mt-1"),r(ne,"title",_e=((x=t[4].header)==null?void 0:x.doc)??""),r(Y,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","hdr")},m(x,de){D(x,e,de),s(e,l),s(l,n),Pe(i,n,null),s(l,o),s(l,a),s(a,u),Pe(f,u,null),s(a,c),we&&we.m(a,null),s(a,m),s(a,_),s(_,b),s(_,d),s(_,g),s(_,k),s(l,C),s(l,I),Pe(R,I,null),s(I,E),Pe(O,I,null),s(I,L),Pe(z,I,null),s(I,V),Pe(B,I,null),s(l,T),S&&S.m(l,null),s(l,y),P&&P.m(l,null),s(l,J),F&&F.m(l,null),s(l,W),s(l,Y),s(Y,H),s(H,G),s(G,$),s(Y,Z),s(Y,K),Pe(ee,K,null),s(Y,ae),A&&A.m(Y,null),s(Y,fe),s(Y,ne),s(ne,pe),Pe(ie,pe,null),s(Y,oe),re&&re.m(Y,null),me=!0},p(x,[de]){var Fe,tt,lt;const ve={};de&68&&(ve.$$scope={dirty:de,ctx:x}),i.$set(ve);const De={};de&2&&(De.epoch=x[1].u),f.$set(De),x[1].t>-50?we?we.p(x,de):(we=Bo(x),we.c(),we.m(a,m)):we&&(we.d(1),we=null),(!me||de&16)&&v!==(v=(((Fe=x[4].header)==null?void 0:Fe.mem)??"Free")+"")&&q(b,v),(!me||de&2)&&h!==(h=(x[1].m?(x[1].m/1e3).toFixed(1):"-")+"")&&q(g,h);const Ee={};de&22&&(Ee.text=x[2].booting?((tt=x[4].header)==null?void 0:tt.booting)??"Booting":x[1].v>2?x[1].v.toFixed(2)+"V":"ESP"),de&6&&(Ee.color=ln(x[2].booting?2:x[1].em)),R.$set(Ee);const Ae={};de&6&&(Ae.color=ln(x[2].booting?9:x[1].hm)),O.$set(Ae);const Oe={};de&2&&(Oe.text=x[1].r?x[1].r.toFixed(0)+"dBm":"WiFi"),de&6&&(Oe.color=ln(x[2].booting?9:x[1].wm)),z.$set(Oe);const Ie={};de&6&&(Ie.color=ln(x[2].booting?9:x[1].mm)),B.$set(Ie),x[1].he<0||x[1].he>0?S?S.p(x,de):(S=Uo(x),S.c(),S.m(l,y)):S&&(S.d(1),S=null),x[1].me<0?P?P.p(x,de):(P=zo(x),P.c(),P.m(l,J)):P&&(P.d(1),P=null),x[1].ee>0||x[1].ee<0?F?F.p(x,de):(F=jo(x),F.c(),F.m(l,W)):F&&(F.d(1),F=null),(!me||de&1&&!bi($.src,Q=(x[0]+"/logo.svg").replace("//","/")))&&r($,"src",Q);const qe={};de&2&&(qe.timestamp=x[1].c?new Date(x[1].c*1e3):new Date(0)),de&4&&(qe.offset=x[2].clock_offset),ee.$set(qe),x[2].vndcfg&&x[2].usrcfg?A?(A.p(x,de),de&4&&X(A,1)):(A=Ho(x),A.c(),X(A,1),A.m(Y,fe)):A&&(mt(),te(A,1,1,()=>{A=null}),pt()),(!me||de&16&&_e!==(_e=((lt=x[4].header)==null?void 0:lt.doc)??""))&&r(ne,"title",_e),le===(le=j(x))&&re?re.p(x,de):(re&&re.d(1),re=le&&le(x),re&&(re.c(),re.m(Y,null)))},i(x){me||(X(i.$$.fragment,x),X(f.$$.fragment,x),X(R.$$.fragment,x),X(O.$$.fragment,x),X(z.$$.fragment,x),X(B.$$.fragment,x),X(ee.$$.fragment,x),X(A),X(ie.$$.fragment,x),me=!0)},o(x){te(i.$$.fragment,x),te(f.$$.fragment,x),te(R.$$.fragment,x),te(O.$$.fragment,x),te(z.$$.fragment,x),te(B.$$.fragment,x),te(ee.$$.fragment,x),te(A),te(ie.$$.fragment,x),me=!1},d(x){x&&N(e),Se(i),Se(f),we&&we.d(),Se(R),Se(O),Se(z),Se(B),S&&S.d(),P&&P.d(),F&&F.d(),Se(ee),A&&A.d(),Se(ie),re&&re.d()}}}function gc(t,e,l){let{basepath:n="/"}=e,{data:i={}}=e,o={};function a(){var c;confirm((((c=f.header)==null?void 0:c.upgrade)??"Upgrade to {0}?").replace("{0}",o.upgrade.n))&&(xr(o.upgrade.n),hl.update(m=>(m.upgrade.t=o.upgrade.n,m.upgrade.p=0,m.upgrading=!0,m)))}let u;hl.subscribe(c=>{l(2,o=c)});let f={};return Il.subscribe(c=>{l(4,f=c)}),t.$$set=c=>{"basepath"in c&&l(0,n=c.basepath),"data"in c&&l(1,i=c.data)},t.$$.update=()=>{t.$$.dirty&4&&l(3,u=Math.max(0,o.upgrade.p))},[n,i,o,u,f,a]}class kc extends Rt{constructor(e){super(),At(this,e,gc,bc,Nt,{basepath:0,data:1})}}function wc(t){let e,l,n,i;return{c(){e=Ht("svg"),l=Ht("path"),n=Ht("path"),r(l,"d",yi(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=yi(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){D(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=yi(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:He,o:He,d(o){o&&N(e)}}}function Wo(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 yi(t,e,l,n,i){var o=Wo(t,e,l,i),a=Wo(t,e,l,n),u=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return f}function Cc(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 Pc extends Rt{constructor(e){super(),At(this,e,Cc,wc,Nt,{pct:0,color:1})}}function Vo(t){let e,l,n,i=t[1][0]+"",o,a,u,f=t[1][1]+"",c,m;return{c(){e=p("br"),l=w(),n=p("span"),o=M(i),a=w(),u=p("span"),c=M(f),m=M("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(_,v){D(_,e,v),D(_,l,v),D(_,n,v),s(n,o),D(_,a,v),D(_,u,v),s(u,c),s(u,m)},p(_,v){v&2&&i!==(i=_[1][0]+"")&&q(o,i),v&2&&f!==(f=_[1][1]+"")&&q(c,f)},d(_){_&&(N(e),N(l),N(n),N(a),N(u))}}}function Sc(t){let e,l,n,i,o,a,u,f,c,m,_=t[3][0]+"",v,b,d,h=t[3][1]+"",g,k,C;l=new Pc({props:{pct:t[4],color:t[2](t[4],document.documentElement.classList.contains("dark"))}});let I=t[1]&&Vo(t);return{c(){e=p("div"),Me(l.$$.fragment),n=w(),i=p("span"),o=p("span"),a=M(t[0]),u=w(),f=p("br"),c=w(),m=p("span"),v=M(_),b=w(),d=p("span"),g=M(h),k=w(),I&&I.c(),r(o,"class","pl-lab"),r(m,"class","pl-val"),r(d,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(R,E){D(R,e,E),Pe(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,f),s(i,c),s(i,m),s(m,v),s(i,b),s(i,d),s(d,g),s(i,k),I&&I.m(i,null),C=!0},p(R,[E]){const O={};E&16&&(O.pct=R[4]),E&20&&(O.color=R[2](R[4],document.documentElement.classList.contains("dark"))),l.$set(O),(!C||E&1)&&q(a,R[0]),(!C||E&8)&&_!==(_=R[3][0]+"")&&q(v,_),(!C||E&8)&&h!==(h=R[3][1]+"")&&q(g,h),R[1]?I?I.p(R,E):(I=Vo(R),I.c(),I.m(i,null)):I&&(I.d(1),I=null)},i(R){C||(X(l.$$.fragment,R),C=!0)},o(R){te(l.$$.fragment,R),C=!1},d(R){R&&N(e),Se(l),I&&I.d()}}}function Mc(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=["",""]}=e,{colorFn:f}=e,c,m=0;return t.$$set=_=>{"val"in _&&l(5,n=_.val),"max"in _&&l(6,i=_.max),"unit"in _&&l(7,o=_.unit),"label"in _&&l(0,a=_.label),"sub"in _&&l(1,u=_.sub),"colorFn"in _&&l(2,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&224&&(l(3,c=pl(n,o)),l(4,m=Math.min(n,i)/i*100))},[a,u,f,c,m,n,i,o]}class tu extends Rt{constructor(e){super(),At(this,e,Mc,Sc,Nt,{val:5,max:6,unit:7,label:0,sub:1,colorFn:2})}}function Ic(t){let e,l,n;return{c(){e=p("div"),l=M(t[0]),r(e,"class","tooltip"),Sl(e,"top",t[2]-t[4]-10+"px"),Sl(e,"left",t[1]-t[3]/2+"px"),qt(()=>t[5].call(e))},m(i,o){D(i,e,o),s(e,l),n=Ii(e,t[5].bind(e))},p(i,[o]){o&1&&q(l,i[0]),o&20&&Sl(e,"top",i[2]-i[4]-10+"px"),o&10&&Sl(e,"left",i[1]-i[3]/2+"px")},i:He,o:He,d(i){i&&N(e),n()}}}function Ec(t,e,l){let{title:n}=e,{x:i}=e,{y:o}=e,a,u;function f(){u=this.clientHeight,a=this.clientWidth,l(4,u),l(3,a)}return t.$$set=c=>{"title"in c&&l(0,n=c.title),"x"in c&&l(1,i=c.x),"y"in c&&l(2,o=c.y)},[n,i,o,a,u,f]}class Nc extends Rt{constructor(e){super(),At(this,e,Ec,Ic,Nt,{title:0,x:1,y:2})}}function Dc(t){let e,l;function n(o){l&&l.$destroy(),e=t.dataset.title||t.getAttribute("title");var a=t.getBoundingClientRect();l=new Nc({props:{title:e,x:a.left+window.scrollX+a.width/2,y:a.top+window.scrollY},target:document.body})}function i(){l&&setTimeout(()=>{l.$destroy(),l=null},500)}return t.addEventListener("click",n),t.addEventListener("mouseleave",i),{destroy(){t.removeEventListener("click",n),t.removeEventListener("mouseleave",i)}}}function Go(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ko(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Yo(t,e,l){const n=t.slice();return n[15]=e[l],n}function Qo(t){let e,l,n,i,o,a,u,f=(t[0].title||t[0].link)&&Xo(t),c=rt(t[0].y.ticks),m=[];for(let h=0;h{f=null}),pt()),g&129){c=rt(h[0].y.ticks);let k;for(k=0;k{o=null}),pt())},i(a){n||(X(o),n=!0)},o(a){te(o),n=!1},d(a){a&&N(e),i&&i.d(),o&&o.d()}}}function Zo(t){let e,l=t[0].title+"",n,i;return{c(){e=p("div"),n=M(l),r(e,"class","text-sm font-bold"),qt(()=>t[9].call(e))},m(o,a){D(o,e,a),s(e,n),i=Ii(e,t[9].bind(e))},p(o,a){a&1&&l!==(l=o[0].title+"")&&q(n,l)},d(o){o&&N(e),i()}}}function Jo(t){let e,l,n,i;const o=[qc,Tc],a=[];function u(f,c){return f[0].link.route?0:1}return l=u(t),n=a[l]=o[l](t),{c(){e=p("div"),n.c(),r(e,"class","text-xs text-right")},m(f,c){D(f,e,c),a[l].m(e,null),i=!0},p(f,c){let m=l;l=u(f),l===m?a[l].p(f,c):(mt(),te(a[m],1,1,()=>{a[m]=null}),pt(),n=a[l],n?n.p(f,c):(n=a[l]=o[l](f),n.c()),X(n,1),n.m(e,null))},i(f){i||(X(n),i=!0)},o(f){te(n),i=!1},d(f){f&&N(e),a[l].d()}}}function Tc(t){let e,l=t[0].link.text+"",n,i,o;return{c(){e=p("a"),n=M(l),r(e,"href",i=t[0].link.url),r(e,"target",o=t[0].link.target)},m(a,u){D(a,e,u),s(e,n)},p(a,u){u&1&&l!==(l=a[0].link.text+"")&&q(n,l),u&1&&i!==(i=a[0].link.url)&&r(e,"href",i),u&1&&o!==(o=a[0].link.target)&&r(e,"target",o)},i:He,o:He,d(a){a&&N(e)}}}function qc(t){let e,l;return e=new wl({props:{to:t[0].link.url,$$slots:{default:[Ac]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.to=n[0].link.url),i&262145&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Ac(t){let e=t[0].link.text+"",l;return{c(){l=M(e)},m(n,i){D(n,l,i)},p(n,i){i&1&&e!==(e=n[0].link.text+"")&&q(l,e)},d(n){n&&N(l)}}}function $o(t){let e,l,n,i=t[15].label+"",o,a,u,f;return{c(){e=Ht("g"),l=Ht("line"),n=Ht("text"),o=M(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[15].align=="right"?"90%":""),r(e,"class",u="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",f="translate(0, "+t[7](t[15].value)+")")},m(c,m){D(c,e,m),s(e,l),s(e,n),s(n,o)},p(c,m){m&1&&i!==(i=c[15].label+"")&&q(o,i),m&1&&a!==(a=c[15].align=="right"?"90%":"")&&r(n,"x",a),m&1&&u!==(u="tick tick-"+c[15].value+" tick-"+c[15].color)&&r(e,"class",u),m&129&&f!==(f="translate(0, "+c[7](c[15].value)+")")&&r(e,"transform",f)},d(c){c&&N(e)}}}function xo(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&$o(t);return{c(){n&&n.c(),l=Qt()},m(i,o){n&&n.m(i,o),D(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=$o(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function es(t){let e,l,n=(t[3]>20||t[13]%2==0||!t[0].x.ticks[t[13]-1].label)&&ts(t);return{c(){e=Ht("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){D(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0||!i[0].x.ticks[i[13]-1].label?n?n.p(i,o):(n=ts(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&N(e),n&&n.d()}}}function ts(t){let e,l=t[11].label+"",n,i;return{c(){e=Ht("text"),n=M(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){D(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[11].label+"")&&q(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&N(e)}}}function ls(t){let e=!isNaN(t[6](t[13])),l,n=e&&es(t);return{c(){n&&n.c(),l=Qt()},m(i,o){n&&n.m(i,o),D(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=es(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){i&&N(l),n&&n.d(i)}}}function ns(t){let e,l,n,i,o,a=t[11].value!==void 0&&is(t),u=t[11].value2>1e-4&&ss(t);return{c(){e=Ht("g"),a&&a.c(),n=Ht("g"),u&&u.c(),r(e,"data-title",l=t[11].title)},m(f,c){D(f,e,c),a&&a.m(e,null),D(f,n,c),u&&u.m(n,null),i||(o=mu(Dc.call(null,e)),i=!0)},p(f,c){f[11].value!==void 0?a?a.p(f,c):(a=is(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null),c&1&&l!==(l=f[11].title)&&r(e,"data-title",l),f[11].value2>1e-4?u?u.p(f,c):(u=ss(f),u.c(),u.m(n,null)):u&&(u.d(1),u=null)},d(f){f&&(N(e),N(n)),a&&a.d(),u&&u.d(),i=!1,o()}}}function is(t){let e,l,n,i,o,a,u,f=t[3]>15&&os(t);return{c(){e=Ht("rect"),f&&f.c(),u=Qt(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]*.95),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",a=t[11].color)},m(c,m){D(c,e,m),f&&f.m(c,m),D(c,u,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&r(e,"x",l),m&129&&n!==(n=c[7](c[11].value))&&r(e,"y",n),m&8&&i!==(i=c[3]*.95)&&r(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](Math.min(c[0].y.min,0)+c[11].value))&&r(e,"height",o),m&1&&a!==(a=c[11].color)&&r(e,"fill",a),c[3]>15?f?f.p(c,m):(f=os(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(u)),f&&f.d(c)}}}function os(t){let e,l=t[11].label+"",n,i,o,a,u;return{c(){e=Ht("text"),n=M(l),r(e,"width",i=t[3]*.95),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[7](0)-t[8]&&!t[0].dark?t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]f[7](0)-f[8]&&!f[0].dark?f[11].color:"white")&&r(e,"fill",a),c&457&&u!==(u="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](f[11].value)>f[7](0)-f[8]?f[7](f[11].value)-f[8]:f[7](f[11].value)+10)+") rotate("+(f[11].labelAngle?f[11].labelAngle:f[3]15&&as(t);return{c(){e=Ht("rect"),f&&f.c(),u=Qt(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]*.95),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",a=t[11].color2?t[11].color2:t[11].color)},m(c,m){D(c,e,m),f&&f.m(c,m),D(c,u,m)},p(c,m){m&64&&l!==(l=c[6](c[13])+2)&&r(e,"x",l),m&128&&n!==(n=c[7](0))&&r(e,"y",n),m&8&&i!==(i=c[3]*.95)&&r(e,"width",i),m&129&&o!==(o=c[7](c[0].y.min)-c[7](c[0].y.min+c[11].value2))&&r(e,"height",o),m&1&&a!==(a=c[11].color2?c[11].color2:c[11].color)&&r(e,"fill",a),c[3]>15?f?f.p(c,m):(f=as(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(u)),f&&f.d(c)}}}function as(t){let e,l=t[11].label2+"",n,i,o,a,u,f=t[11].title2&&fs(t);return{c(){e=Ht("text"),n=M(l),f&&f.c(),u=Qt(),r(e,"width",i=t[3]*.95),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)t[10].call(e))},m(o,a){D(o,e,a),i&&i.m(e,null),l=Ii(e,t[10].bind(e)),n=!0},p(o,[a]){o[0].x.ticks&&o[0].points&&o[4]?i?(i.p(o,a),a&17&&X(i,1)):(i=Qo(o),i.c(),X(i,1),i.m(e,null)):i&&(mt(),te(i,1,1,()=>{i=null}),pt())},i(o){n||(X(i),n=!0)},o(o){te(i),n=!1},d(o){o&&N(e),i&&i.d(),l()}}}let rn=30;function Oc(t,e,l){let{config:n}=e,i,o,a,u,f,c,m,_=0;function v(){_=this.clientHeight,l(5,_)}function b(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,c=o-_);let d=i-(n.padding.left+n.padding.right);l(3,a=d/n.points.length),l(8,m=an.y.max?k=n.padding.bottom:gc||k<0?0:k})}},[n,i,o,a,c,_,u,f,m,v,b]}class hn extends Rt{constructor(e){super(),At(this,e,Oc,Rc,Nt,{config:0})}}function Lc(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Fc(t,e,l){let{title:n}=e,{u1:i}=e,{u2:o}=e,{u3:a}=e,{ds:u}=e,f={};function c(m){return{label:ll(m)+"V",title:m.toFixed(1)+" V",value:isNaN(m)?0:m,color:R0(m||0,document.documentElement.classList.contains("dark"))}}return t.$$set=m=>{"title"in m&&l(1,n=m.title),"u1"in m&&l(2,i=m.u1),"u2"in m&&l(3,o=m.u2),"u3"in m&&l(4,a=m.u3),"ds"in m&&l(5,u=m.ds)},t.$$.update=()=>{if(t.$$.dirty&62){let m=[],_=[];i>0&&(m.push({label:u===1?"L1-L2":"L1"}),_.push(c(i))),o>0&&(m.push({label:u===1?"L1-L3":"L2"}),_.push(c(o))),a>0&&(m.push({label:u===1?"L2-L3":"L3"}),_.push(c(a))),l(0,f={title:n,padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:m},points:_})}},[f,n,i,o,a,u]}class yc extends Rt{constructor(e){super(),At(this,e,Fc,Lc,Nt,{title:1,u1:2,u2:3,u3:4,ds:5})}}function Bc(t){var A,j,le,re,he;let e,l,n=(((A=t[0].reactive)==null?void 0:A.title)??"Reactive")+"",i,o,a,u,f=(((j=t[0].reactive)==null?void 0:j.instant_in)??"Instant in")+"",c,m,_,v=t[1][0]+"",b,d,h=t[1][1]+"",g,k,C,I=(((le=t[0].reactive)==null?void 0:le.instant_out)??"Instant out")+"",R,E,O,L=t[2][0]+"",z,V,B=t[2][1]+"",T,y,J,W,Y=(((re=t[0].reactive)==null?void 0:re.total_in)??"Total in")+"",H,G,$,Q=t[3][0]+"",Z,K,ee=t[3][1]+"",ae,fe,ne,pe=(((he=t[0].reactive)==null?void 0:he.total_out)??"Total out")+"",ie,_e,oe,me=t[4][0]+"",we,S,P=t[4][1]+"",F;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),u=p("div"),c=M(f),m=w(),_=p("div"),b=M(v),d=w(),g=M(h),k=w(),C=p("div"),R=M(I),E=w(),O=p("div"),z=M(L),V=w(),T=M(B),y=w(),J=p("div"),W=p("div"),H=M(Y),G=w(),$=p("div"),Z=M(Q),K=w(),ae=M(ee),fe=w(),ne=p("div"),ie=M(pe),_e=w(),oe=p("div"),we=M(me),S=w(),F=M(P),r(_,"class","text-right"),r(O,"class","text-right"),r(a,"class","grid grid-cols-2 mt-4"),r($,"class","text-right"),r(oe,"class","text-right"),r(J,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(be,x){D(be,e,x),s(e,l),s(l,i),s(e,o),s(e,a),s(a,u),s(u,c),s(a,m),s(a,_),s(_,b),s(_,d),s(_,g),s(a,k),s(a,C),s(C,R),s(a,E),s(a,O),s(O,z),s(O,V),s(O,T),s(e,y),s(e,J),s(J,W),s(W,H),s(J,G),s(J,$),s($,Z),s($,K),s($,ae),s(J,fe),s(J,ne),s(ne,ie),s(J,_e),s(J,oe),s(oe,we),s(oe,S),s(oe,F)},p(be,[x]){var de,ve,De,Ee,Ae;x&1&&n!==(n=(((de=be[0].reactive)==null?void 0:de.title)??"Reactive")+"")&&q(i,n),x&1&&f!==(f=(((ve=be[0].reactive)==null?void 0:ve.instant_in)??"Instant in")+"")&&q(c,f),x&2&&v!==(v=be[1][0]+"")&&q(b,v),x&2&&h!==(h=be[1][1]+"")&&q(g,h),x&1&&I!==(I=(((De=be[0].reactive)==null?void 0:De.instant_out)??"Instant out")+"")&&q(R,I),x&4&&L!==(L=be[2][0]+"")&&q(z,L),x&4&&B!==(B=be[2][1]+"")&&q(T,B),x&1&&Y!==(Y=(((Ee=be[0].reactive)==null?void 0:Ee.total_in)??"Total in")+"")&&q(H,Y),x&8&&Q!==(Q=be[3][0]+"")&&q(Z,Q),x&8&&ee!==(ee=be[3][1]+"")&&q(ae,ee),x&1&&pe!==(pe=(((Ae=be[0].reactive)==null?void 0:Ae.total_out)??"Total out")+"")&&q(ie,pe),x&16&&me!==(me=be[4][0]+"")&&q(we,me),x&16&&P!==(P=be[4][1]+"")&&q(F,P)},i:He,o:He,d(be){be&&N(e)}}}function Uc(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e,{translations:u={}}=e,f,c,m,_;return t.$$set=v=>{"importInstant"in v&&l(5,n=v.importInstant),"exportInstant"in v&&l(6,i=v.exportInstant),"importTotal"in v&&l(7,o=v.importTotal),"exportTotal"in v&&l(8,a=v.exportTotal),"translations"in v&&l(0,u=v.translations)},t.$$.update=()=>{t.$$.dirty&480&&(l(1,f=pl(n,"VAr")),l(2,c=pl(i,"VAr")),l(3,m=pl(o*1e3,"VArh")),l(4,_=pl(a*1e3,"VArh")))},[u,f,c,m,_,n,i,o,a]}class zc extends Rt{constructor(e){super(),At(this,e,Uc,Bc,Nt,{importInstant:5,exportInstant:6,importTotal:7,exportTotal:8,translations:0})}}function us(t){let e;function l(o,a){return o[3]?Hc:jc}let n=l(t),i=n(t);return{c(){i.c(),e=Qt()},m(o,a){i.m(o,a),D(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){o&&N(e),i.d(o)}}}function jc(t){var j,le,re,he,be;let e,l=(((j=t[4].realtime)==null?void 0:j.consumption)??"Consumption")+"",n,i,o,a,u=al(((le=t[4].common)==null?void 0:le.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",v,b,d=t[6][1]+"",h,g,k,C=al(((re=t[4].common)==null?void 0:re.day)??"Day")+"",I,R,E,O=t[7][0]+"",L,z,V=t[7][1]+"",B,T,y,J=al(((he=t[4].common)==null?void 0:he.month)??"Month")+"",W,Y,H,G=t[8][0]+"",$,Q,Z=t[8][1]+"",K,ee,ae,fe=(((be=t[4].realtime)==null?void 0:be.last_month)??"Last month")+"",ne,pe,ie,_e=t[9][0]+"",oe,me,we=t[9][1]+"",S,P,F,A=t[5]&&cs(t);return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),g=w(),k=p("div"),I=M(C),R=w(),E=p("div"),L=M(O),z=w(),B=M(V),T=w(),y=p("div"),W=M(J),Y=w(),H=p("div"),$=M(G),Q=w(),K=M(Z),ee=w(),ae=p("div"),ne=M(fe),pe=w(),ie=p("div"),oe=M(_e),me=w(),S=M(we),P=w(),A&&A.c(),F=Qt(),r(m,"class","text-right"),r(E,"class","text-right"),r(H,"class","text-right"),r(ie,"class","text-right"),r(o,"class","grid grid-cols-2 mb-3")},m(x,de){D(x,e,de),s(e,n),D(x,i,de),D(x,o,de),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,h),s(o,g),s(o,k),s(k,I),s(o,R),s(o,E),s(E,L),s(E,z),s(E,B),s(o,T),s(o,y),s(y,W),s(o,Y),s(o,H),s(H,$),s(H,Q),s(H,K),s(o,ee),s(o,ae),s(ae,ne),s(o,pe),s(o,ie),s(ie,oe),s(ie,me),s(ie,S),D(x,P,de),A&&A.m(x,de),D(x,F,de)},p(x,de){var ve,De,Ee,Ae,Oe;de&16&&l!==(l=(((ve=x[4].realtime)==null?void 0:ve.consumption)??"Consumption")+"")&&q(n,l),de&16&&u!==(u=al(((De=x[4].common)==null?void 0:De.hour)??"Hour")+"")&&q(f,u),de&64&&_!==(_=x[6][0]+"")&&q(v,_),de&64&&d!==(d=x[6][1]+"")&&q(h,d),de&16&&C!==(C=al(((Ee=x[4].common)==null?void 0:Ee.day)??"Day")+"")&&q(I,C),de&128&&O!==(O=x[7][0]+"")&&q(L,O),de&128&&V!==(V=x[7][1]+"")&&q(B,V),de&16&&J!==(J=al(((Ae=x[4].common)==null?void 0:Ae.month)??"Month")+"")&&q(W,J),de&256&&G!==(G=x[8][0]+"")&&q($,G),de&256&&Z!==(Z=x[8][1]+"")&&q(K,Z),de&16&&fe!==(fe=(((Oe=x[4].realtime)==null?void 0:Oe.last_month)??"Last month")+"")&&q(ne,fe),de&512&&_e!==(_e=x[9][0]+"")&&q(oe,_e),de&512&&we!==(we=x[9][1]+"")&&q(S,we),x[5]?A?A.p(x,de):(A=cs(x),A.c(),A.m(F.parentNode,F)):A&&(A.d(1),A=null)},d(x){x&&(N(e),N(i),N(o),N(P),N(F)),A&&A.d(x)}}}function Hc(t){var Ct,Ce,Be,Le,Et,_l,sl,Kt,Yt,ul;let e,l=(((Ct=t[4].common)==null?void 0:Ct.import)??"Import")+"",n,i,o,a,u=al(((Ce=t[4].common)==null?void 0:Ce.hour)??"Hour")+"",f,c,m,_=t[6][0]+"",v,b,d=t[6][1]+"",h,g,k,C,I=al(((Be=t[4].common)==null?void 0:Be.day)??"Day")+"",R,E,O,L=t[7][0]+"",z,V,B=t[7][1]+"",T,y,J,W,Y=al(((Le=t[4].common)==null?void 0:Le.month)??"Month")+"",H,G,$,Q=t[8][0]+"",Z,K,ee=t[8][1]+"",ae,fe,ne,pe,ie=(((Et=t[4].realtime)==null?void 0:Et.last_mo)??"Last mo.")+"",_e,oe,me,we=t[9][0]+"",S,P,F=t[9][1]+"",A,j,le,re,he,be=(((_l=t[4].common)==null?void 0:_l.export)??"Export")+"",x,de,ve,De,Ee=al(((sl=t[4].common)==null?void 0:sl.hour)??"Hour")+"",Ae,Oe,Ie,qe=t[10][0]+"",Fe,tt,lt=t[10][1]+"",ct,Dt,ht,_t,at=al(((Kt=t[4].common)==null?void 0:Kt.day)??"Day")+"",vt,Bt,et,ye=t[11][0]+"",We,it,Ge=t[11][1]+"",Ke,Qe,ce,se,Ne=al(((Yt=t[4].common)==null?void 0:Yt.month)??"Month")+"",Ye,Mt,ot,Je=t[12][0]+"",Ot,ut,dt=t[12][1]+"",st,Vt,Pt,St,kt=(((ul=t[4].realtime)==null?void 0:ul.last_mo)??"Last mo.")+"",bt,$t,Ut,xt=t[13][0]+"",el,Xt,Jt=t[13][1]+"",il,Xe,ft,Tt=t[5]&&_s(t),zt=t[5]&&ms(t),It=t[5]&&ps(t),wt=t[5]&&ds(t),Gt=t[5]&&hs(t),nt=t[5]&&vs(t),jt=t[5]&&bs(t),$e=t[5]&&gs(t);return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),g=w(),Tt&&Tt.c(),k=w(),C=p("div"),R=M(I),E=w(),O=p("div"),z=M(L),V=w(),T=M(B),y=w(),zt&&zt.c(),J=w(),W=p("div"),H=M(Y),G=w(),$=p("div"),Z=M(Q),K=w(),ae=M(ee),fe=w(),It&&It.c(),ne=w(),pe=p("div"),_e=M(ie),oe=w(),me=p("div"),S=M(we),P=w(),A=M(F),j=w(),wt&&wt.c(),re=w(),he=p("strong"),x=M(be),de=w(),ve=p("div"),De=p("div"),Ae=M(Ee),Oe=w(),Ie=p("div"),Fe=M(qe),tt=w(),ct=M(lt),Dt=w(),Gt&&Gt.c(),ht=w(),_t=p("div"),vt=M(at),Bt=w(),et=p("div"),We=M(ye),it=w(),Ke=M(Ge),Qe=w(),nt&&nt.c(),ce=w(),se=p("div"),Ye=M(Ne),Mt=w(),ot=p("div"),Ot=M(Je),ut=w(),st=M(dt),Vt=w(),jt&&jt.c(),Pt=w(),St=p("div"),bt=M(kt),$t=w(),Ut=p("div"),el=M(xt),Xt=w(),il=M(Jt),Xe=w(),$e&&$e.c(),r(m,"class","text-right"),r(O,"class","text-right"),r($,"class","text-right"),r(me,"class","text-right"),r(o,"class",le="grid grid-cols-"+t[14]+" mb-3"),r(Ie,"class","text-right"),r(et,"class","text-right"),r(ot,"class","text-right"),r(Ut,"class","text-right"),r(ve,"class",ft="grid grid-cols-"+t[14])},m(Te,ge){D(Te,e,ge),s(e,n),D(Te,i,ge),D(Te,o,ge),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,h),s(o,g),Tt&&Tt.m(o,null),s(o,k),s(o,C),s(C,R),s(o,E),s(o,O),s(O,z),s(O,V),s(O,T),s(o,y),zt&&zt.m(o,null),s(o,J),s(o,W),s(W,H),s(o,G),s(o,$),s($,Z),s($,K),s($,ae),s(o,fe),It&&It.m(o,null),s(o,ne),s(o,pe),s(pe,_e),s(o,oe),s(o,me),s(me,S),s(me,P),s(me,A),s(o,j),wt&&wt.m(o,null),D(Te,re,ge),D(Te,he,ge),s(he,x),D(Te,de,ge),D(Te,ve,ge),s(ve,De),s(De,Ae),s(ve,Oe),s(ve,Ie),s(Ie,Fe),s(Ie,tt),s(Ie,ct),s(ve,Dt),Gt&&Gt.m(ve,null),s(ve,ht),s(ve,_t),s(_t,vt),s(ve,Bt),s(ve,et),s(et,We),s(et,it),s(et,Ke),s(ve,Qe),nt&&nt.m(ve,null),s(ve,ce),s(ve,se),s(se,Ye),s(ve,Mt),s(ve,ot),s(ot,Ot),s(ot,ut),s(ot,st),s(ve,Vt),jt&&jt.m(ve,null),s(ve,Pt),s(ve,St),s(St,bt),s(ve,$t),s(ve,Ut),s(Ut,el),s(Ut,Xt),s(Ut,il),s(ve,Xe),$e&&$e.m(ve,null)},p(Te,ge){var Ze,ke,Re,Lt,fl,ml,vl,rl,gl,kl;ge&16&&l!==(l=(((Ze=Te[4].common)==null?void 0:Ze.import)??"Import")+"")&&q(n,l),ge&16&&u!==(u=al(((ke=Te[4].common)==null?void 0:ke.hour)??"Hour")+"")&&q(f,u),ge&64&&_!==(_=Te[6][0]+"")&&q(v,_),ge&64&&d!==(d=Te[6][1]+"")&&q(h,d),Te[5]?Tt?Tt.p(Te,ge):(Tt=_s(Te),Tt.c(),Tt.m(o,k)):Tt&&(Tt.d(1),Tt=null),ge&16&&I!==(I=al(((Re=Te[4].common)==null?void 0:Re.day)??"Day")+"")&&q(R,I),ge&128&&L!==(L=Te[7][0]+"")&&q(z,L),ge&128&&B!==(B=Te[7][1]+"")&&q(T,B),Te[5]?zt?zt.p(Te,ge):(zt=ms(Te),zt.c(),zt.m(o,J)):zt&&(zt.d(1),zt=null),ge&16&&Y!==(Y=al(((Lt=Te[4].common)==null?void 0:Lt.month)??"Month")+"")&&q(H,Y),ge&256&&Q!==(Q=Te[8][0]+"")&&q(Z,Q),ge&256&&ee!==(ee=Te[8][1]+"")&&q(ae,ee),Te[5]?It?It.p(Te,ge):(It=ps(Te),It.c(),It.m(o,ne)):It&&(It.d(1),It=null),ge&16&&ie!==(ie=(((fl=Te[4].realtime)==null?void 0:fl.last_mo)??"Last mo.")+"")&&q(_e,ie),ge&512&&we!==(we=Te[9][0]+"")&&q(S,we),ge&512&&F!==(F=Te[9][1]+"")&&q(A,F),Te[5]?wt?wt.p(Te,ge):(wt=ds(Te),wt.c(),wt.m(o,null)):wt&&(wt.d(1),wt=null),ge&16384&&le!==(le="grid grid-cols-"+Te[14]+" mb-3")&&r(o,"class",le),ge&16&&be!==(be=(((ml=Te[4].common)==null?void 0:ml.export)??"Export")+"")&&q(x,be),ge&16&&Ee!==(Ee=al(((vl=Te[4].common)==null?void 0:vl.hour)??"Hour")+"")&&q(Ae,Ee),ge&1024&&qe!==(qe=Te[10][0]+"")&&q(Fe,qe),ge&1024&<!==(lt=Te[10][1]+"")&&q(ct,lt),Te[5]?Gt?Gt.p(Te,ge):(Gt=hs(Te),Gt.c(),Gt.m(ve,ht)):Gt&&(Gt.d(1),Gt=null),ge&16&&at!==(at=al(((rl=Te[4].common)==null?void 0:rl.day)??"Day")+"")&&q(vt,at),ge&2048&&ye!==(ye=Te[11][0]+"")&&q(We,ye),ge&2048&&Ge!==(Ge=Te[11][1]+"")&&q(Ke,Ge),Te[5]?nt?nt.p(Te,ge):(nt=vs(Te),nt.c(),nt.m(ve,ce)):nt&&(nt.d(1),nt=null),ge&16&&Ne!==(Ne=al(((gl=Te[4].common)==null?void 0:gl.month)??"Month")+"")&&q(Ye,Ne),ge&4096&&Je!==(Je=Te[12][0]+"")&&q(Ot,Je),ge&4096&&dt!==(dt=Te[12][1]+"")&&q(st,dt),Te[5]?jt?jt.p(Te,ge):(jt=bs(Te),jt.c(),jt.m(ve,Pt)):jt&&(jt.d(1),jt=null),ge&16&&kt!==(kt=(((kl=Te[4].realtime)==null?void 0:kl.last_mo)??"Last mo.")+"")&&q(bt,kt),ge&8192&&xt!==(xt=Te[13][0]+"")&&q(el,xt),ge&8192&&Jt!==(Jt=Te[13][1]+"")&&q(il,Jt),Te[5]?$e?$e.p(Te,ge):($e=gs(Te),$e.c(),$e.m(ve,null)):$e&&($e.d(1),$e=null),ge&16384&&ft!==(ft="grid grid-cols-"+Te[14])&&r(ve,"class",ft)},d(Te){Te&&(N(e),N(i),N(o),N(re),N(he),N(de),N(ve)),Tt&&Tt.d(),zt&&zt.d(),It&&It.d(),wt&&wt.d(),Gt&&Gt.d(),nt&&nt.d(),jt&&jt.d(),$e&&$e.d()}}}function cs(t){var oe,me,we,S,P,F;let e,l=(((oe=t[4].realtime)==null?void 0:oe.cost)??"Cost")+"",n,i,o,a,u=al(((me=t[4].common)==null?void 0:me.hour)??"Hour")+"",f,c,m,_=ll(t[1].h.c,2)+"",v,b,d,h,g,k=al(((we=t[4].common)==null?void 0:we.day)??"Day")+"",C,I,R,E=ll(t[1].d.c,1)+"",O,L,z,V,B,T=al(((S=t[4].common)==null?void 0:S.month)??"Month")+"",y,J,W,Y=ll(t[1].m.c)+"",H,G,$,Q,Z,K=(((P=t[4].realtime)==null?void 0:P.last_month)??"Last month")+"",ee,ae,fe,ne=ll((F=t[0].last_month)==null?void 0:F.c)+"",pe,ie,_e;return{c(){e=p("strong"),n=M(l),i=w(),o=p("div"),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),d=M(t[2]),h=w(),g=p("div"),C=M(k),I=w(),R=p("div"),O=M(E),L=w(),z=M(t[2]),V=w(),B=p("div"),y=M(T),J=w(),W=p("div"),H=M(Y),G=w(),$=M(t[2]),Q=w(),Z=p("div"),ee=M(K),ae=w(),fe=p("div"),pe=M(ne),ie=w(),_e=M(t[2]),r(m,"class","text-right"),r(R,"class","text-right"),r(W,"class","text-right"),r(fe,"class","text-right"),r(o,"class","grid grid-cols-2")},m(A,j){D(A,e,j),s(e,n),D(A,i,j),D(A,o,j),s(o,a),s(a,f),s(o,c),s(o,m),s(m,v),s(m,b),s(m,d),s(o,h),s(o,g),s(g,C),s(o,I),s(o,R),s(R,O),s(R,L),s(R,z),s(o,V),s(o,B),s(B,y),s(o,J),s(o,W),s(W,H),s(W,G),s(W,$),s(o,Q),s(o,Z),s(Z,ee),s(o,ae),s(o,fe),s(fe,pe),s(fe,ie),s(fe,_e)},p(A,j){var le,re,he,be,x,de;j&16&&l!==(l=(((le=A[4].realtime)==null?void 0:le.cost)??"Cost")+"")&&q(n,l),j&16&&u!==(u=al(((re=A[4].common)==null?void 0:re.hour)??"Hour")+"")&&q(f,u),j&2&&_!==(_=ll(A[1].h.c,2)+"")&&q(v,_),j&4&&q(d,A[2]),j&16&&k!==(k=al(((he=A[4].common)==null?void 0:he.day)??"Day")+"")&&q(C,k),j&2&&E!==(E=ll(A[1].d.c,1)+"")&&q(O,E),j&4&&q(z,A[2]),j&16&&T!==(T=al(((be=A[4].common)==null?void 0:be.month)??"Month")+"")&&q(y,T),j&2&&Y!==(Y=ll(A[1].m.c)+"")&&q(H,Y),j&4&&q($,A[2]),j&16&&K!==(K=(((x=A[4].realtime)==null?void 0:x.last_month)??"Last month")+"")&&q(ee,K),j&1&&ne!==(ne=ll((de=A[0].last_month)==null?void 0:de.c)+"")&&q(pe,ne),j&4&&q(_e,A[2])},d(A){A&&(N(e),N(i),N(o))}}}function _s(t){let e,l=ll(t[1].h.c,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].h.c,2)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function ms(t){let e,l=ll(t[1].d.c,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].d.c,1)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function ps(t){let e,l=ll(t[1].m.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].m.c)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function ds(t){var a;let e,l=ll((a=t[0].last_month)==null?void 0:a.c)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(u,f){D(u,e,f),s(e,n),s(e,i),s(e,o)},p(u,f){var c;f&1&&l!==(l=ll((c=u[0].last_month)==null?void 0:c.c)+"")&&q(n,l),f&4&&q(o,u[2])},d(u){u&&N(e)}}}function hs(t){let e,l=ll(t[1].h.i,2)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].h.i,2)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function vs(t){let e,l=ll(t[1].d.i,1)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].d.i,1)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function bs(t){let e,l=ll(t[1].m.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ll(a[1].m.i)+"")&&q(n,l),u&4&&q(o,a[2])},d(a){a&&N(e)}}}function gs(t){var a;let e,l=ll((a=t[0].last_month)==null?void 0:a.i)+"",n,i,o;return{c(){e=p("div"),n=M(l),i=w(),o=M(t[2]),r(e,"class","text-right")},m(u,f){D(u,e,f),s(e,n),s(e,i),s(e,o)},p(u,f){var c;f&1&&l!==(l=ll((c=u[0].last_month)==null?void 0:c.i)+"")&&q(n,l),f&4&&q(o,u[2])},d(u){u&&N(e)}}}function Wc(t){var m;let e,l,n=(((m=t[4].realtime)==null?void 0:m.title)??"Real time calculations")+"",i,o,a,u,f,c=t[1]&&us(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("br"),u=p("br"),f=w(),c&&c.c(),r(e,"class","mx-2 text-sm")},m(_,v){D(_,e,v),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),c&&c.m(e,null)},p(_,[v]){var b;v&16&&n!==(n=(((b=_[4].realtime)==null?void 0:b.title)??"Real time calculations")+"")&&q(i,n),_[1]?c?c.p(_,v):(c=us(_),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:He,o:He,d(_){_&&N(e),c&&c.d()}}}function Vc(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,{translations:u={}}=e,f,c,m,_,v,b,d,h,g=!1,k=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,a=C.hasExport),"translations"in C&&l(4,u=C.translations)},t.$$.update=()=>{var C,I,R,E,O,L,z,V;t.$$.dirty&35&&(l(5,g=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(14,k=g?3:2),l(6,f=pl(((C=i==null?void 0:i.h)==null?void 0:C.u)*1e3,"Wh")),l(7,c=pl(((I=i==null?void 0:i.d)==null?void 0:I.u)*1e3,"Wh")),l(8,m=pl(((R=i==null?void 0:i.m)==null?void 0:R.u)*1e3,"Wh")),l(9,_=pl(((E=n==null?void 0:n.last_month)==null?void 0:E.u)*1e3,"Wh")),l(10,v=pl(((O=i==null?void 0:i.h)==null?void 0:O.p)*1e3,"Wh")),l(11,b=pl(((L=i==null?void 0:i.d)==null?void 0:L.p)*1e3,"Wh")),l(12,d=pl(((z=i==null?void 0:i.m)==null?void 0:z.p)*1e3,"Wh")),l(13,h=pl(((V=n==null?void 0:n.last_month)==null?void 0:V.p)*1e3,"Wh")))},[n,i,o,a,u,g,f,c,m,_,v,b,d,h,k]}class Gc extends Rt{constructor(e){super(),At(this,e,Vc,Wc,Nt,{sysinfo:0,data:1,currency:2,hasExport:3,translations:4})}}function ks(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Kc(t){let e,l,n=t[0].points&&t[0].points.length>0&&ks(t);return{c(){n&&n.c(),e=Qt()},m(i,o){n&&n.m(i,o),D(i,e,o),l=!0},p(i,[o]){i[0].points&&i[0].points.length>0?n?(n.p(i,o),o&1&&X(n,1)):(n=ks(i),n.c(),X(n,1),n.m(e.parentNode,e)):n&&(mt(),te(n,1,1,()=>{n=null}),pt())},i(i){l||(X(n),l=!0)},o(i){te(n),l=!1},d(i){i&&N(e),n&&n.d(i)}}}function Yc(t,e,l){let{title:n}=e,{json:i}=e,{sysinfo:o}=e,a={},u,f,c=document.documentElement.classList.contains("dark"),m=new Date;return fo(()=>{let _;function v(){l(6,m=new Date),_=setTimeout(()=>{v()},(15-m.getMinutes()%15)*6e4)}return v(),()=>{clearTimeout(_)}}),t.$$set=_=>{"title"in _&&l(1,n=_.title),"json"in _&&l(2,i=_.json),"sysinfo"in _&&l(3,o=_.sysinfo)},t.$$.update=()=>{var _,v;if(t.$$.dirty&126&&((_=i==null?void 0:i.prices)==null?void 0:_.length)>0){l(6,m=new Date);let b=i==null?void 0:i.currency,d=0,h=[],g=[],k=[];l(5,f=l(4,u=0)),_n(m,o.clock_offset-(24+m.getHours()-m.getUTCHours())%24);let C=i!=null&&i.cursor?i.cursor:0;for(m.setMinutes(Math.floor(m.getMinutes()/(i==null?void 0:i.resolution))*(i==null?void 0:i.resolution),0,0);C<((v=i==null?void 0:i.prices)==null?void 0:v.length)&&(d=i.prices[C],d!=null);)g.push({label:k.length>0&&(i==null?void 0:i.resolution)<60&&m.getMinutes()!=0?"":yt(m.getHours())}),k.push(d*100),l(5,f=Math.min(f,d*100)),l(4,u=Math.max(u,d*100)),O0(m,i==null?void 0:i.resolution),C++;let I=ii(Math.max(Math.abs(f)/100,Math.abs(u)/100),b);if(I&&I[1]&&I[1]!=b)for(b=I[1],l(5,f*=100),l(4,u*=100),C=0;C=0?z.toFixed(V):"",title:z>=0?z.toFixed(2)+" "+b:"",value:d>=0?Math.abs(d):0,label2:z<0?z.toFixed(V):"",title2:z<0?z.toFixed(2)+" "+b:"",value2:d<0?Math.abs(d):0,color:c?"#5c2da5":"#7c3aed"})}let E=Math.max(u,Math.abs(f));if(f<0){l(5,f=Math.min(E/4*-1,f));let z=Math.ceil(Math.abs(f)/E*4),V=f/z;for(C=1;C{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],v=[],b=[];l(5,f=l(4,u=0));let d=new Date,h=new Date;h.setDate(0),h.setHours(12);let g=(h.getHours()-h.getUTCHours())%24-o.clock_offset,k=d.getUTCHours();for(_n(d,-g-24),m=k;m<24;m++){let E=i["i"+yt(m)],O=i["e"+yt(m)];E===void 0&&(E=0),O===void 0&&(O=0),v.push({label:yt(d.getHours())}),b.push({label:E.toFixed(1),title:E.toFixed(2)+" kWh",value:E*10,label2:O.toFixed(1),title2:O.toFixed(2)+" kWh",value2:O*10,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,O*10)),l(4,u=Math.max(u,E*10)),_n(d,1)}for(m=0;m{"title"in m&&l(1,n=m.title),"json"in m&&l(2,i=m.json),"sysinfo"in m&&l(3,o=m.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&62){let m=0,_=[],v=[],b=[];l(5,f=l(4,u=0));let d=new Date,h=new Date;h.setDate(0),h.setHours(12);let g=(h.getHours()-h.getUTCHours())%24-o.clock_offset;for(_n(d,-g),_n(h,-g),m=d.getDate();m<=h.getDate();m++){let R=i["i"+yt(m)],E=i["e"+yt(m)];R===void 0&&(R=0),E===void 0&&(E=0),v.push({label:yt(m)}),b.push({label:R.toFixed(R<10?1:0),title:R.toFixed(2)+" kWh",value:R,label2:E.toFixed(E<10?1:0),title2:E.toFixed(2)+" kWh",value2:E,color:c?"#5c2da5":"#7c3aed",color2:c?"#27728e":"#37829e"}),l(5,f=Math.max(f,E)),l(4,u=Math.max(u,R))}for(m=1;m{"title"in c&&l(1,n=c.title),"json"in c&&l(2,i=c.json)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,m=0,_=[],v=[],b=[];i.s&&i.s.forEach((g,k)=>{var C=g.n?g.n:g.a;m=g.v,m==-127&&(m=0),v.push({label:C.slice(-4)}),b.push({label:m.toFixed(1),value:m,color:o?"#5c2da5":"#7c3aed"}),l(4,f=Math.min(f,m)),l(3,u=Math.max(u,m))}),l(3,u=Math.ceil(u)),l(4,f=Math.floor(f));let d=u;f<0&&(d+=Math.abs(f));let h=d/4;for(c=0;c<5;c++)m=f+h*c,_.push({value:m,label:m.toFixed(1)});l(0,a={title:n+" (°C)",dark:document.documentElement.classList.contains("dark"),height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:f,max:u,ticks:_},x:{ticks:v},points:b})}},[a,n,i,u,f]}class l1 extends Rt{constructor(e){super(),At(this,e,t1,e1,Nt,{title:1,json:2})}}function n1(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}let i1=0;function o1(t,e,l){let{title:n}=e,{translations:i={}}=e,o=document.documentElement.classList.contains("dark"),a={},u=0,{tariffData:f}=e,{realtime:c}=e;return t.$$set=m=>{"title"in m&&l(1,n=m.title),"translations"in m&&l(2,i=m.translations),"tariffData"in m&&l(3,f=m.tariffData),"realtime"in m&&l(4,c=m.realtime)},t.$$.update=()=>{var m,_,v,b;if(t.$$.dirty&62){let d=0,h=[],g=[],k=[];if(h.push({value:0,label:0}),f&&!isNaN((m=c==null?void 0:c.h)==null?void 0:m.u)&&(k.push({label:c.h.u.toFixed(2),value:c.h.u,title:(((_=i.common)==null?void 0:_.now)??"Now")+": "+c.h.u.toFixed(2)+" kWh",color:Ni(c.h.u/f.c*100)}),g.push({label:((v=i.common)==null?void 0:v.now)??"Now"})),f&&f.p)for(d=0;d0&&(R=yt(C.d)+".",I=yt(C.d)+"."+(i.months?(b=i.months)==null?void 0:b[new Date().getMonth()]:yt(new Date().getMonth()+1)),f.p.length<4&&(R=I)),isNaN(C.h)||(I=I+" "+yt(C.h)+":00"),I=I+": "+C.v.toFixed(2)+" kWh",k.push({label:C.v.toFixed(2),value:C.v,title:I,color:o?"#5c2da5":"#7c3aed"}),g.push({label:R}),l(5,u=Math.max(u,C.v))}if(f&&f.t){for(d=0;d=u)break;h.push({value:C,label:C})}h.push({label:f.m.toFixed(1),align:"right",color:"green",value:f.m})}f&&f.c&&(h.push({label:f.c.toFixed(0),color:"orange",value:f.c}),l(5,u=Math.max(u,f.c))),l(5,u=Math.ceil(u)),l(0,a={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:20,bottom:20,left:20},y:{min:i1,max:u,ticks:h},x:{ticks:g},points:k})}},[a,n,i,f,c,u]}class s1 extends Rt{constructor(e){super(),At(this,e,o1,n1,Nt,{title:1,translations:2,tariffData:3,realtime:4})}}let sn=0,a1={data:[]};async function ho(){let e=await(await Cl(sn<0?"realtime.json":"realtime.json?offset="+sn)).json();vo.update(l=>{for(let n=0;n=0&&(sn+=e.size,snCn||xi-Cn>300?(ho(),Bi=0):vo.update(t=>{if(t.lastUpdate)for(;Cn>t.lastUpdate;)t.data.unshift(lu),t.data=t.data.slice(0,t.size),t.lastUpdate+=10,Bi++;else t.lastUpdate=Cn;return t})}function u1(t){if(lu=t.i-t.e,Cn=t.u,!ws){ho(),ws=!0,xi=Cn;return}f1()&&r1()}function Cs(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function Ps(t,e,l){const n=t.slice();return n[21]=e[l],n}function c1(t){let e,l,n;return{c(){e=p("strong"),l=M(t[0]),n=M(" not available"),r(e,"class","text-sm")},m(i,o){D(i,e,o),s(e,l),s(e,n)},p(i,o){o&1&&q(l,i[0])},d(i){i&&N(e)}}}function _1(t){let e,l,n,i,o,a,u,f=t[8]&&Ss(t);return{c(){e=p("strong"),l=M(t[0]),n=M(" ("),i=M(t[12]),o=M(")"),a=w(),f&&f.c(),u=Qt(),r(e,"class","text-sm")},m(c,m){D(c,e,m),s(e,l),s(e,n),s(e,i),s(e,o),D(c,a,m),f&&f.m(c,m),D(c,u,m)},p(c,m){m&1&&q(l,c[0]),m&4096&&q(i,c[12]),c[8]?f?f.p(c,m):(f=Ss(c),f.c(),f.m(u.parentNode,u)):f&&(f.d(1),f=null)},d(c){c&&(N(e),N(a),N(u)),f&&f.d(c)}}}function Ss(t){let e,l,n,i,o,a=rt(t[8]),u=[];for(let m=0;mt[17].call(e))},m(a,u){D(a,e,u),o.m(e,null),l=Ii(e,t[17].bind(e))},p(a,[u]){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(e,null)))},i:He,o:He,d(a){a&&N(e),o.d(),l()}}}function p1(t,e,l){let{title:n}=e,i=document.documentElement.classList.contains("dark"),o=null;vo.subscribe(E=>{l(16,o=E)});let a=!1,u,f,c,m,_,v,b,d=function(E,O,L){return Math.ceil(_-(E-O)/(L-O)*_)-25},h=function(E){return 30+Math.ceil(E/o.size*(v-35))},g,k,C,I;function R(){c=this.clientWidth,m=this.clientHeight,l(3,c),l(4,m)}return t.$$set=E=>{"title"in E&&l(0,n=E.title)},t.$$.update=()=>{if(t.$$.dirty&67582)if(l(5,_=parseInt(m)-50),l(6,v=c-35),l(10,C=v/o.size),l(2,f=0),l(1,u=0),o.data&&_>10&&v>100&&C>.1){l(11,a=!0);for(let L in o.data){let z=o.data[L];isNaN(z)&&(z=0),l(1,u=Math.max(Math.ceil(z/1e3)*1e3,u)),l(2,f=Math.min(Math.floor(z/1e3)*1e3,f))}let E=u-f;l(12,I=u>2500?"kW":"W"),l(8,g=[]);for(let L=f;L2500?(L/1e3).toFixed(1):L}),!(g.length>6));L+=E/5);l(9,k=[]);for(let L=0;L12));L+=Math.round(o.size/Math.round(v/120)));let O=o.size;l(7,b=h(o.size)+","+d(0,f,u)+" "+h(1)+","+d(0,f,u));for(let L in o.data){if(O<0)break;let z=o.data[L];isNaN(z)&&(z=0),l(7,b=h(O--)+","+d(z,f,u)+" "+b)}}else l(11,a=!1)},[n,u,f,c,m,_,v,b,g,k,C,a,I,i,d,h,o,R]}class d1 extends Rt{constructor(e){super(),At(this,e,p1,m1,Nt,{title:0})}}function h1(t){let e,l;return e=new hn({props:{config:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function v1(t,e,l){let{title:n}=e,{unit:i=""}=e,{l1:o=!1}=e,{l2:a=!1}=e,{l2x:u=!1}=e,{l3:f=!1}=e,{l1i:c=0}=e,{l2i:m=0}=e,{l3i:_=0}=e,{l1e:v=0}=e,{l2e:b=0}=e,{l3e:d=0}=e,{maxImport:h=0}=e,{maxExport:g=0}=e,{importColorFn:k}=e,{exportColorFn:C}=e,I={};function R(E,O){return{label:ll(E>900?E/1e3:E)+(E>900?"k":"")+i,title:E.toFixed(2)+" "+i,value:isNaN(E)?0:E,color:k(E?E/h*100:0,document.documentElement.classList.contains("dark")),label2:ll(O>900?O/1e3:O)+(O>900?"k":"")+i,title2:O.toFixed(2)+" "+i,value2:isNaN(O)?0:O,color2:C(O?O/g*100:0)}}return t.$$set=E=>{"title"in E&&l(1,n=E.title),"unit"in E&&l(2,i=E.unit),"l1"in E&&l(3,o=E.l1),"l2"in E&&l(4,a=E.l2),"l2x"in E&&l(5,u=E.l2x),"l3"in E&&l(6,f=E.l3),"l1i"in E&&l(7,c=E.l1i),"l2i"in E&&l(8,m=E.l2i),"l3i"in E&&l(9,_=E.l3i),"l1e"in E&&l(10,v=E.l1e),"l2e"in E&&l(11,b=E.l2e),"l3e"in E&&l(12,d=E.l3e),"maxImport"in E&&l(13,h=E.maxImport),"maxExport"in E&&l(14,g=E.maxExport),"importColorFn"in E&&l(15,k=E.importColorFn),"exportColorFn"in E&&l(16,C=E.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let E=[],O=[];o&&(E.push({label:"L1"}),O.push(R(c,v))),a&&(u?(E.push({label:"L2"}),O.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(E.push({label:"L2"}),O.push(R(m,b)))),f&&(E.push({label:"L3"}),O.push(R(_,d)));let L=[];if(g){let z=g>h?4:g*4/h;L.push({value:-g,label:"-100%"}),z>=4&&L.push({value:-g/4*3,label:"-75%"}),z>=2&&L.push({value:-g/2,label:"-50%"}),z>=4&&L.push({value:-g/4,label:"-25%"})}if(L.push({value:0,label:"0%"}),h){let z=h>g?4:h*4/g;L.push({value:h/4,label:"25%"}),z>=4&&L.push({value:h/2,label:"50%"}),z>=2&&L.push({value:h/4*3,label:"75%"}),z>=4&&L.push({value:h,label:"100%"})}l(0,I={title:n,dark:document.documentElement.classList.contains("dark"),padding:{top:20,right:15,bottom:20,left:35},y:{min:-g,max:h,ticks:L},x:{ticks:E},points:O})}},[I,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C]}class bo extends Rt{constructor(e){super(),At(this,e,v1,h1,Nt,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Ds(t){var k;let e,l,n,i,o,a,u=(t[0].mt?Pi(t[0].mt):"-")+"",f,c,m,_=t[12][0]+"",v,b,d=t[12][1]+"",h,g;return i=new tu({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:((k=t[7].common)==null?void 0:k.import)??"Import",sub:ii(t[0].p,t[0].pc),colorFn:Ni}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=w(),a=p("div"),f=M(u),c=w(),m=p("div"),v=M(_),b=w(),h=M(d),r(n,"class","col-span-2"),r(m,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(C,I){D(C,e,I),s(e,l),s(l,n),Pe(i,n,null),s(l,o),s(l,a),s(a,f),s(l,c),s(l,m),s(m,v),s(m,b),s(m,h),g=!0},p(C,I){var E;const R={};I&1&&(R.val=C[0].i?C[0].i:0),I&1&&(R.max=C[0].im?C[0].im:15e3),I&128&&(R.label=((E=C[7].common)==null?void 0:E.import)??"Import"),I&1&&(R.sub=ii(C[0].p,C[0].pc)),i.$set(R),(!g||I&1)&&u!==(u=(C[0].mt?Pi(C[0].mt):"-")+"")&&q(f,u),(!g||I&4096)&&_!==(_=C[12][0]+"")&&q(v,_),(!g||I&4096)&&d!==(d=C[12][1]+"")&&q(h,d)},i(C){g||(X(i.$$.fragment,C),g=!0)},o(C){te(i.$$.fragment,C),g=!1},d(C){C&&N(e),Se(i)}}}function Ts(t){var h;let e,l,n,i,o,a,u,f,c=t[13][0]+"",m,_,v=t[13][1]+"",b,d;return i=new tu({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:((h=t[7].common)==null?void 0:h.export)??"Export",sub:ii(t[0].px,t[0].pc),colorFn:li}}),{c(){e=p("div"),l=p("div"),n=p("div"),Me(i.$$.fragment),o=w(),a=p("div"),u=w(),f=p("div"),m=M(c),_=w(),b=M(v),r(n,"class","col-span-2"),r(f,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(g,k){D(g,e,k),s(e,l),s(l,n),Pe(i,n,null),s(l,o),s(l,a),s(l,u),s(l,f),s(f,m),s(f,_),s(f,b),d=!0},p(g,k){var I;const C={};k&1&&(C.val=g[0].e?g[0].e:0),k&1&&(C.max=g[0].om?g[0].om*1e3:1e4),k&128&&(C.label=((I=g[7].common)==null?void 0:I.export)??"Export"),k&1&&(C.sub=ii(g[0].px,g[0].pc)),i.$set(C),(!d||k&8192)&&c!==(c=g[13][0]+"")&&q(m,c),(!d||k&8192)&&v!==(v=g[13][1]+"")&&q(b,v)},i(g){d||(X(i.$$.fragment,g),d=!0)},o(g){te(i.$$.fragment,g),d=!1},d(g){g&&N(e),Se(i)}}}function qs(t){let e,l,n=t[0].l1&&As(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){D(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=As(i),n.c(),X(n,1),n.m(e,null)):n&&(mt(),te(n,1,1,()=>{n=null}),pt())},i(i){l||(X(n),l=!0)},o(i){te(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function As(t){var n;let e,l;return e=new yc({props:{title:((n=t[7].common)==null?void 0:n.voltage)??"Volt",u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){Me(e.$$.fragment)},m(i,o){Pe(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].common)==null?void 0:u.voltage)??"Volt"),o&1&&(a.u1=i[0].l1.u),o&1&&(a.u2=i[0].l2.u),o&1&&(a.u3=i[0].l3.u),o&1&&(a.ds=i[0].ds),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){te(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Rs(t){let e,l,n=t[0].l1&&Os(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){D(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Os(i),n.c(),X(n,1),n.m(e,null)):n&&(mt(),te(n,1,1,()=>{n=null}),pt())},i(i){l||(X(n),l=!0)},o(i){te(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Os(t){var n;let e,l;return e=new bo({props:{title:((n=t[7].common)==null?void 0:n.amperage)??"Amp",unit:"A",importColorFn:Ni,exportColorFn:li,maxImport:t[0].mf,l1:t[9],l2:t[10],l3:t[11],l2x:t[0].l2.e,l1i:Math.max(Math.abs(t[0].l1.i),0),l2i:Math.max(Math.abs(t[0].l2.i),0),l3i:Math.max(Math.abs(t[0].l3.i),0)}}),{c(){Me(e.$$.fragment)},m(i,o){Pe(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].common)==null?void 0:u.amperage)??"Amp"),o&1&&(a.maxImport=i[0].mf),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l2x=i[0].l2.e),o&1&&(a.l1i=Math.max(Math.abs(i[0].l1.i),0)),o&1&&(a.l2i=Math.max(Math.abs(i[0].l2.i),0)),o&1&&(a.l3i=Math.max(Math.abs(i[0].l3.i),0)),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){te(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Ls(t){let e,l,n=t[0].l1&&Fs(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){D(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Fs(i),n.c(),X(n,1),n.m(e,null)):n&&(mt(),te(n,1,1,()=>{n=null}),pt())},i(i){l||(X(n),l=!0)},o(i){te(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Fs(t){var n;let e,l;return e=new bo({props:{title:((n=t[7].dashboard)==null?void 0:n.phase)??"Phase",unit:"W",importColorFn:Ni,exportColorFn:li,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om?t[14]?t[0].om*1e3/Math.sqrt(3):t[0].om*1e3:0,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.p,l2i:t[0].l2.p,l3i:t[0].l3.p,l1e:t[0].l1.q,l2e:t[0].l2.q,l3e:t[0].l3.q}}),{c(){Me(e.$$.fragment)},m(i,o){Pe(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].dashboard)==null?void 0:u.phase)??"Phase"),o&1&&(a.maxImport=(i[0].mf?i[0].mf:32)*230),o&16385&&(a.maxExport=i[0].om?i[14]?i[0].om*1e3/Math.sqrt(3):i[0].om*1e3:0),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.p),o&1&&(a.l2i=i[0].l2.p),o&1&&(a.l3i=i[0].l3.p),o&1&&(a.l1e=i[0].l1.q),o&1&&(a.l2e=i[0].l2.q),o&1&&(a.l3e=i[0].l3.q),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){te(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function ys(t){let e,l,n=t[0].l1&&Bs(t);return{c(){e=p("div"),n&&n.c(),r(e,"class","cnt")},m(i,o){D(i,e,o),n&&n.m(e,null),l=!0},p(i,o){i[0].l1?n?(n.p(i,o),o&1&&X(n,1)):(n=Bs(i),n.c(),X(n,1),n.m(e,null)):n&&(mt(),te(n,1,1,()=>{n=null}),pt())},i(i){l||(X(n),l=!0)},o(i){te(n),l=!1},d(i){i&&N(e),n&&n.d()}}}function Bs(t){var n;let e,l;return e=new bo({props:{title:((n=t[7].dashboard)==null?void 0:n.pf)??"Pf",importColorFn:li,exportColorFn:li,maxImport:1,l1:t[9],l2:t[10],l3:t[11],l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){Me(e.$$.fragment)},m(i,o){Pe(e,i,o),l=!0},p(i,o){var u;const a={};o&128&&(a.title=((u=i[7].dashboard)==null?void 0:u.pf)??"Pf"),o&512&&(a.l1=i[9]),o&1024&&(a.l2=i[10]),o&2048&&(a.l3=i[11]),o&1&&(a.l1i=i[0].l1.f),o&1&&(a.l2i=i[0].l2.f),o&1&&(a.l3i=i[0].l3.f),e.$set(a)},i(i){l||(X(e.$$.fragment,i),l=!0)},o(i){te(e.$$.fragment,i),l=!1},d(i){Se(e,i)}}}function Us(t){let e,l,n;return l=new zc({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt")},m(i,o){D(i,e,o),Pe(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){te(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function zs(t){let e,l,n;return l=new Gc({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt")},m(i,o){D(i,e,o),Pe(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),o&128&&(a.translations=i[7]),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){te(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function js(t){var i;let e,l,n;return l=new s1({props:{title:((i=t[7].dashboard)==null?void 0:i.tariffpeak)??"Tariff peaks",tariffData:t[8],realtime:t[0].ea,translations:t[7]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt h-64")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.tariffpeak)??"Tariff peaks"),a&256&&(u.tariffData=o[8]),a&1&&(u.realtime=o[0].ea),a&128&&(u.translations=o[7]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Hs(t){var i;let e,l,n;return l=new d1({props:{title:((i=t[7].dashboard)==null?void 0:i.realtime)??"Real time"}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.realtime)??"Real time"),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Ws(t){let e,l,n,i;const o=[g1,b1],a=[];function u(f,c){var m;return(m=f[2])!=null&&m.importExportPriceDifferent&&(f[0].om||f[0].e>0)?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Qt()},m(f,c){a[e].m(f,c),D(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(mt(),te(a[m],1,1,()=>{a[m]=null}),pt(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){te(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function b1(t){var i;let e,l,n;return l=new po({props:{title:((i=t[7].dashboard)==null?void 0:i.price)??"Price",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price)??"Price"),a&4&&(u.json=o[2]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function g1(t){var i;let e,l,n;return l=new po({props:{title:((i=t[7].dashboard)==null?void 0:i.price_import)??"Price import",json:t[2],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price_import)??"Price import"),a&4&&(u.json=o[2]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Vs(t){var i;let e,l,n;return l=new po({props:{title:((i=t[7].dashboard)==null?void 0:i.price_export)??"Price export",json:t[3],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.price_export)??"Price export"),a&8&&(u.json=o[3]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Gs(t){var i;let e,l,n;return l=new Zc({props:{title:((i=t[7].dashboard)==null?void 0:i.day)??"24 hours",json:t[4],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.day)??"24 hours"),a&16&&(u.json=o[4]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Ks(t){var i;let e,l,n;return l=new xc({props:{title:((i=t[7].dashboard)==null?void 0:i.month)??"{0} days",json:t[5],sysinfo:t[1]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.month)??"{0} days"),a&32&&(u.json=o[5]),a&2&&(u.sysinfo=o[1]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function Ys(t){var i;let e,l,n;return l=new l1({props:{title:((i=t[7].dashboard)==null?void 0:i.temperature)??"Temperature",json:t[6]}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","cnt gwf")},m(o,a){D(o,e,a),Pe(l,e,null),n=!0},p(o,a){var f;const u={};a&128&&(u.title=((f=o[7].dashboard)==null?void 0:f.temperature)??"Temperature"),a&64&&(u.json=o[6]),l.$set(u)},i(o){n||(X(l.$$.fragment,o),n=!0)},o(o){te(l.$$.fragment,o),n=!1},d(o){o&&N(e),Se(l)}}}function k1(t){var we;let e,l=tl(t[1].ui.i,t[0].i),n,i=tl(t[1].ui.e,t[0].om||t[0].e>0),o,a=tl(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),u,f=tl(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),c,m=tl(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,v=tl(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),b,d=tl(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),h,g=tl(t[1].ui.c,t[0].ea),k,C=tl(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("NO")||t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),I,R=tl(t[1].ui.l,t[0].hm==1),E,O=tl(t[1].ui.p,t[0].p&&!Number.isNaN(t[0].p)),L,z=((we=t[2])==null?void 0:we.importExportPriceDifferent)&&(t[0].om||t[0].e>0)&&tl(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].pe)),V,B=tl(t[1].ui.d,t[4]),T,y=tl(t[1].ui.m,t[5]),J,W=tl(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[6].c>1),Y,H=l&&Ds(t),G=i&&Ts(t),$=a&&qs(t),Q=f&&Rs(t),Z=m&&Ls(t),K=v&&ys(t),ee=d&&Us(t),ae=g&&zs(t),fe=C&&js(t),ne=R&&Hs(t),pe=O&&Ws(t),ie=z&&Vs(t),_e=B&&Gs(t),oe=y&&Ks(t),me=W&&Ys(t);return{c(){e=p("div"),H&&H.c(),n=w(),G&&G.c(),o=w(),$&&$.c(),u=w(),Q&&Q.c(),c=w(),Z&&Z.c(),_=w(),K&&K.c(),b=w(),ee&&ee.c(),h=w(),ae&&ae.c(),k=w(),fe&&fe.c(),I=w(),ne&&ne.c(),E=w(),pe&&pe.c(),L=w(),ie&&ie.c(),V=w(),_e&&_e.c(),T=w(),oe&&oe.c(),J=w(),me&&me.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(S,P){D(S,e,P),H&&H.m(e,null),s(e,n),G&&G.m(e,null),s(e,o),$&&$.m(e,null),s(e,u),Q&&Q.m(e,null),s(e,c),Z&&Z.m(e,null),s(e,_),K&&K.m(e,null),s(e,b),ee&&ee.m(e,null),s(e,h),ae&&ae.m(e,null),s(e,k),fe&&fe.m(e,null),s(e,I),ne&&ne.m(e,null),s(e,E),pe&&pe.m(e,null),s(e,L),ie&&ie.m(e,null),s(e,V),_e&&_e.m(e,null),s(e,T),oe&&oe.m(e,null),s(e,J),me&&me.m(e,null),Y=!0},p(S,[P]){var F;P&3&&(l=tl(S[1].ui.i,S[0].i)),l?H?(H.p(S,P),P&3&&X(H,1)):(H=Ds(S),H.c(),X(H,1),H.m(e,n)):H&&(mt(),te(H,1,1,()=>{H=null}),pt()),P&3&&(i=tl(S[1].ui.e,S[0].om||S[0].e>0)),i?G?(G.p(S,P),P&3&&X(G,1)):(G=Ts(S),G.c(),X(G,1),G.m(e,o)):G&&(mt(),te(G,1,1,()=>{G=null}),pt()),P&3&&(a=tl(S[1].ui.v,S[0].l1&&(S[0].l1.u>100||S[0].l2.u>100||S[0].l3.u>100))),a?$?($.p(S,P),P&3&&X($,1)):($=qs(S),$.c(),X($,1),$.m(e,u)):$&&(mt(),te($,1,1,()=>{$=null}),pt()),P&3&&(f=tl(S[1].ui.a,S[0].l1&&(S[0].l1.i>.01||S[0].l2.i>.01||S[0].l3.i>.01))),f?Q?(Q.p(S,P),P&3&&X(Q,1)):(Q=Rs(S),Q.c(),X(Q,1),Q.m(e,c)):Q&&(mt(),te(Q,1,1,()=>{Q=null}),pt()),P&3&&(m=tl(S[1].ui.h,S[0].l1&&(S[0].l1.p>.01||S[0].l2.p>.01||S[0].l3.p>.01||S[0].l1.q>.01||S[0].l2.q>.01||S[0].l3.q>.01))),m?Z?(Z.p(S,P),P&3&&X(Z,1)):(Z=Ls(S),Z.c(),X(Z,1),Z.m(e,_)):Z&&(mt(),te(Z,1,1,()=>{Z=null}),pt()),P&3&&(v=tl(S[1].ui.f,S[0].l1&&(S[0].l1.f>.01||S[0].l2.f>.01||S[0].l3.f>.01))),v?K?(K.p(S,P),P&3&&X(K,1)):(K=ys(S),K.c(),X(K,1),K.m(e,b)):K&&(mt(),te(K,1,1,()=>{K=null}),pt()),P&3&&(d=tl(S[1].ui.r,S[0].ri>0||S[0].re>0||S[0].ric>0||S[0].rec>0)),d?ee?(ee.p(S,P),P&3&&X(ee,1)):(ee=Us(S),ee.c(),X(ee,1),ee.m(e,h)):ee&&(mt(),te(ee,1,1,()=>{ee=null}),pt()),P&3&&(g=tl(S[1].ui.c,S[0].ea)),g?ae?(ae.p(S,P),P&3&&X(ae,1)):(ae=zs(S),ae.c(),X(ae,1),ae.m(e,k)):ae&&(mt(),te(ae,1,1,()=>{ae=null}),pt()),P&3&&(C=tl(S[1].ui.t,S[0].pr&&(S[0].pr.startsWith("NO")||S[0].pr.startsWith("10YNO")||S[0].pr.startsWith("10Y1001A1001A4")))),C?fe?(fe.p(S,P),P&3&&X(fe,1)):(fe=js(S),fe.c(),X(fe,1),fe.m(e,I)):fe&&(mt(),te(fe,1,1,()=>{fe=null}),pt()),P&3&&(R=tl(S[1].ui.l,S[0].hm==1)),R?ne?(ne.p(S,P),P&3&&X(ne,1)):(ne=Hs(S),ne.c(),X(ne,1),ne.m(e,E)):ne&&(mt(),te(ne,1,1,()=>{ne=null}),pt()),P&3&&(O=tl(S[1].ui.p,S[0].p&&!Number.isNaN(S[0].p))),O?pe?(pe.p(S,P),P&3&&X(pe,1)):(pe=Ws(S),pe.c(),X(pe,1),pe.m(e,L)):pe&&(mt(),te(pe,1,1,()=>{pe=null}),pt()),P&7&&(z=((F=S[2])==null?void 0:F.importExportPriceDifferent)&&(S[0].om||S[0].e>0)&&tl(S[1].ui.p,S[0].pe&&!Number.isNaN(S[0].pe))),z?ie?(ie.p(S,P),P&7&&X(ie,1)):(ie=Vs(S),ie.c(),X(ie,1),ie.m(e,V)):ie&&(mt(),te(ie,1,1,()=>{ie=null}),pt()),P&18&&(B=tl(S[1].ui.d,S[4])),B?_e?(_e.p(S,P),P&18&&X(_e,1)):(_e=Gs(S),_e.c(),X(_e,1),_e.m(e,T)):_e&&(mt(),te(_e,1,1,()=>{_e=null}),pt()),P&34&&(y=tl(S[1].ui.m,S[5])),y?oe?(oe.p(S,P),P&34&&X(oe,1)):(oe=Ks(S),oe.c(),X(oe,1),oe.m(e,J)):oe&&(mt(),te(oe,1,1,()=>{oe=null}),pt()),P&67&&(W=tl(S[1].ui.s,S[0].t&&S[0].t!=-127&&S[6].c>1)),W?me?(me.p(S,P),P&67&&X(me,1)):(me=Ys(S),me.c(),X(me,1),me.m(e,null)):me&&(mt(),te(me,1,1,()=>{me=null}),pt())},i(S){Y||(X(H),X(G),X($),X(Q),X(Z),X(K),X(ee),X(ae),X(fe),X(ne),X(pe),X(ie),X(_e),X(oe),X(me),Y=!0)},o(S){te(H),te(G),te($),te(Q),te(Z),te(K),te(ee),te(ae),te(fe),te(ne),te(pe),te(ie),te(_e),te(oe),te(me),Y=!1},d(S){S&&N(e),H&&H.d(),G&&G.d(),$&&$.d(),Q&&Q.d(),Z&&Z.d(),K&&K.d(),ee&&ee.d(),ae&&ae.d(),fe&&fe.d(),ne&&ne.d(),pe&&pe.d(),ie&&ie.d(),_e&&_e.d(),oe&&oe.d(),me&&me.d()}}}function w1(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,{importPrices:o={}}=e,{exportPrices:a={}}=e,{dayPlot:u={}}=e,{monthPlot:f={}}=e,{temperatures:c={}}=e,{translations:m={}}=e,{tariffData:_={}}=e,v,b,d,h,g,k;return t.$$set=C=>{"data"in C&&l(0,n=C.data),"sysinfo"in C&&l(1,i=C.sysinfo),"importPrices"in C&&l(2,o=C.importPrices),"exportPrices"in C&&l(3,a=C.exportPrices),"dayPlot"in C&&l(4,u=C.dayPlot),"monthPlot"in C&&l(5,f=C.monthPlot),"temperatures"in C&&l(6,c=C.temperatures),"translations"in C&&l(7,m=C.translations),"tariffData"in C&&l(8,_=C.tariffData)},t.$$.update=()=>{var C,I,R,E,O,L,z,V,B,T,y,J,W,Y,H;t.$$.dirty&3585&&(l(12,v=pl((n==null?void 0:n.ic)*1e3,"Wh")),l(13,b=pl((n==null?void 0:n.ec)*1e3,"Wh")),((C=n==null?void 0:n.l1)==null?void 0:C.u)==0&&((I=n==null?void 0:n.l2)==null?void 0:I.u)==0&&((R=n==null?void 0:n.l3)==null?void 0:R.u)==0?l(9,h=l(10,g=l(11,k=l(14,d=!0)))):(l(9,h=((E=n==null?void 0:n.l1)==null?void 0:E.u)>0||((O=n==null?void 0:n.l1)==null?void 0:O.i)>0||((L=n==null?void 0:n.l1)==null?void 0:L.p)>0||((z=n==null?void 0:n.l1)==null?void 0:z.q)>0),l(10,g=((V=n==null?void 0:n.l2)==null?void 0:V.u)>0||((B=n==null?void 0:n.l2)==null?void 0:B.i)>0||((T=n==null?void 0:n.l2)==null?void 0:T.p)>0||((y=n==null?void 0:n.l2)==null?void 0:y.q)>0),l(11,k=((J=n==null?void 0:n.l3)==null?void 0:J.u)>0||((W=n==null?void 0:n.l3)==null?void 0:W.i)>0||((Y=n==null?void 0:n.l3)==null?void 0:Y.p)>0||((H=n==null?void 0:n.l3)==null?void 0:H.q)>0),l(14,d=h&&g&&k)))},[n,i,o,a,u,f,c,m,_,h,g,k,v,b,d]}class C1 extends Rt{constructor(e){super(),At(this,e,w1,k1,Nt,{data:0,sysinfo:1,importPrices:2,exportPrices:3,dayPlot:4,monthPlot:5,temperatures:6,translations:7,tariffData:8})}}let eo={};const Jn=cl(eo);async function P1(){eo=await(await fetch("configuration.json")).json(),Jn.set(eo)}let to={};const nu=cl(to);async function S1(){to=await(await fetch("priceconfig.json")).json(),nu.set(to)}function Qs(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Xs(t){let e,l,n;return{c(){e=p("option"),e.textContent="UART0",l=w(),n=p("option"),n.textContent="UART2",e.__value=3,U(e,e.__value),n.__value=113,U(n,n.__value)},m(i,o){D(i,e,o),D(i,l,o),D(i,n,o)},d(i){i&&(N(e),N(l),N(n))}}}function Zs(t){let e;return{c(){e=p("option"),e.textContent=`GPIO${t[4]}`,e.__value=t[4],U(e,e.__value)},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function Js(t){let e,l=t[4]>1&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Zs(t);return{c(){l&&l.c(),e=Qt()},m(n,i){l&&l.m(n,i),D(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Zs(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){n&&N(e),l&&l.d(n)}}}function M1(t){let e,l,n,i,o=t[0]=="esp8266"&&Xs(),a=rt({length:t[1]+1}),u=[];for(let f=0;f{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=21);break}},[n,i]}class lo extends Rt{constructor(e){super(),At(this,e,I1,M1,Nt,{chip:0})}}function $s(t){let e,l,n=t[1]&&xs(t);return{c(){e=p("div"),l=p("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){D(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xs(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&N(e),n&&n.d()}}}function xs(t){let e,l;return{c(){e=p("div"),l=M(t[1]),r(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){D(n,e,i),s(e,l)},p(n,i){i&2&&q(l,n[1])},d(n){n&&N(e)}}}function E1(t){let e,l=t[0]&&$s(t);return{c(){l&&l.c(),e=Qt()},m(n,i){l&&l.m(n,i),D(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=$s(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:He,o:He,d(n){n&&N(e),l&&l.d(n)}}}function N1(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class dl extends Rt{constructor(e){super(),At(this,e,N1,E1,Nt,{active:0,message:1})}}function ea(t,e,l){const n=t.slice();return n[1]=e[l],n}function ta(t){let e,l,n=t[1]+"",i;return{c(){e=p("option"),l=M("Europe/"),i=M(n),e.__value="Europe/"+t[1],U(e,e.__value)},m(o,a){D(o,e,a),s(e,l),s(e,i)},p:He,d(o){o&&N(e)}}}function D1(t){let e,l,n,i=rt(t[0]),o=[];for(let a=0;a>1&1,A=0;A0;P--)A[P]=A[P]?A[P-1]^E.EXPONENT[z._modN(E.LOG[A[P]]+S)]:A[P-1];A[0]=E.EXPONENT[z._modN(E.LOG[A[0]]+S)]}for(S=0;S<=F;S++)A[S]=E.LOG[A[S]]},_checkBadness:function(){var S,P,F,A,j,le=0,re=this._badness,he=this.buffer,be=this.width;for(j=0;jbe*be;)ve-=be*be,de++;for(le+=de*z.N4,A=0;A=re-2&&(S=re-2,j>9&&S--);var he=S;if(j>9){for(le[he+2]=0,le[he+3]=0;he--;)P=le[he],le[he+3]|=255&P<<4,le[he+2]=P>>4;le[2]|=255&S<<4,le[1]=S>>4,le[0]=64|S>>12}else{for(le[he+1]=0,le[he+2]=0;he--;)P=le[he],le[he+2]|=255&P<<4,le[he+1]=P>>4;le[1]|=255&S<<4,le[0]=64|S>>4}for(he=S+3-(j<10);he=5&&(F+=z.N1+A[P]-5);for(P=3;PS||A[P-3]*3>=A[P]*4||A[P+3]*3>=A[P]*4)&&(F+=z.N3);return F},_finish:function(){this._stringBuffer=this.buffer.slice();var S,P,F=0,A=3e4;for(P=0;P<8&&(this._applyMask(P),S=this._checkBadness(),S>=1)A&1&&(j[le-1-P+le*8]=1,P<6?j[8+le*P]=1:j[8+le*(P+1)]=1);for(P=0;P<7;P++,A>>=1)A&1&&(j[8+le*(le-7+P)]=1,P?j[6-P+le*8]=1:j[7+le*8]=1)},_interleaveBlocks:function(){var S,P,F=this._dataBlock,A=this._ecc,j=this._eccBlock,le=0,re=this._calculateMaxLength(),he=this._neccBlock1,be=this._neccBlock2,x=this._stringBuffer;for(S=0;S1)for(S=k.BLOCK[A],F=j-7;;){for(P=j-7;P>S-3&&(this._addAlignment(P,F),!(P6)for(S=L.BLOCK[le-7],P=17,F=0;F<6;F++)for(A=0;A<3;A++,P--)1&(P>11?le>>P-12:S>>P)?(j[5-F+re*(2-A+re-11)]=1,j[2-A+re-11+re*(5-F)]=1):(this._setMask(5-F,2-A+re-11),this._setMask(2-A+re-11,5-F))},_isMasked:function(S,P){var F=z._getMaskBit(S,P);return this._mask[F]===1},_pack:function(){var S,P,F,A=1,j=1,le=this.width,re=le-1,he=le-1,be=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(P=0;PP&&(F=S,S=P,P=F),F=P,F+=P*P,F>>=1,F+=S,F},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),V=z,B=b.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),T=B,y=_.extend(function(S,P,F,A){this.name=S,this.modifiable=!!P,this.defaultValue=F,this._valueTransformer=A},{transform:function(S){var P=this._valueTransformer;return typeof P=="function"?P(S,this):S}}),J=y,W=_.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,P){return Object.prototype.hasOwnProperty.call(S,P)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),Y=W,H=_.extend(function(S){this.options={},S.forEach(function(P){this.options[P.name]=P},this)},{exists:function(S){return this.options[S]!=null},get:function(S,P){return H._get(this.options[S],P)},getAll:function(S){var P,F=this.options,A={};for(P in F)Y.hasOwn(F,P)&&(A[P]=H._get(F[P],S));return A},init:function(S,P,F){typeof F!="function"&&(F=Y.noop);var A,j;for(A in this.options)Y.hasOwn(this.options,A)&&(j=this.options[A],H._set(j,j.defaultValue,P),H._createAccessor(j,P,F));this._setAll(S,P,!0)},set:function(S,P,F){return this._set(S,P,F)},setAll:function(S,P){return this._setAll(S,P)},_set:function(S,P,F,A){var j=this.options[S];if(!j)throw new Error("Invalid option: "+S);if(!j.modifiable&&!A)throw new Error("Option cannot be modified: "+S);return H._set(j,P,F)},_setAll:function(S,P,F){if(!S)return!1;var A,j=!1;for(A in S)Y.hasOwn(S,A)&&this._set(A,S[A],P,F)&&(j=!0);return j}},{_createAccessor:function(S,P,F){var A={get:function(){return H._get(S,P)}};S.modifiable&&(A.set=function(j){H._set(S,j,P)&&F(j,S)}),Object.defineProperty(P,S.name,A)},_get:function(S,P){return P["_"+S.name]},_set:function(S,P,F){var A="_"+S.name,j=F[A],le=S.transform(P??S.defaultValue);return F[A]=le,le!==j}}),G=H,$=_.extend(function(){this._services={}},{getService:function(S){var P=this._services[S];if(!P)throw new Error("Service is not being managed with name: "+S);return P},setService:function(S,P){if(this._services[S])throw new Error("Service is already managed with name: "+S);P&&(this._services[S]=P)}}),Q=$,Z=new G([new J("background",!0,"white"),new J("backgroundAlpha",!0,1,Y.abs),new J("element"),new J("foreground",!0,"black"),new J("foregroundAlpha",!0,1,Y.abs),new J("level",!0,"L",Y.toUpperCase),new J("mime",!0,"image/png"),new J("padding",!0,null,Y.abs),new J("size",!0,100,Y.abs),new J("value",!0,"")]),K=new Q,ee=_.extend(function(S){Z.init(S,this,this.update.bind(this));var P=Z.get("element",this),F=K.getService("element"),A=P&&F.isCanvas(P)?P:F.createCanvas(),j=P&&F.isImage(P)?P:F.createImage();this._canvasRenderer=new h(this,A,!0),this._imageRenderer=new T(this,j,j===P),this.update()},{get:function(){return Z.getAll(this)},set:function(S){Z.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new V({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){K.setService(S.getName(),S)}});Object.defineProperties(ee.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var ae=ee,fe=ae,ne=_.extend({getName:function(){}}),pe=ne,ie=pe.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),_e=ie,oe=_e.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(S){return S instanceof HTMLCanvasElement},isImage:function(S){return S instanceof HTMLImageElement}}),me=oe;fe.use(new me);var we=fe;return we})})(au);var R1=au.exports;const O1=su(R1);function L1(t){let e,l;return{c(){e=p("img"),bi(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){D(n,e,i)},p(n,[i]){i&4&&!bi(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:He,o:He,d(n){n&&N(e)}}}function F1(t,e,l){let{errorCorrection:n="L"}=e,{background:i="#fff"}=e,{color:o="#000"}=e,{size:a="200"}=e,{value:u=""}=e,{padding:f=0}=e,{className:c="qrcode"}=e,m="",_;function v(){_.set({background:i,foreground:o,level:n,padding:f,size:a,value:u}),l(2,m=_.toDataURL("image/jpeg"))}function b(){return m}return fo(()=>{l(9,_=new O1),u&&v()}),t.$$set=d=>{"errorCorrection"in d&&l(3,n=d.errorCorrection),"background"in d&&l(4,i=d.background),"color"in d&&l(5,o=d.color),"size"in d&&l(6,a=d.size),"value"in d&&l(0,u=d.value),"padding"in d&&l(7,f=d.padding),"className"in d&&l(1,c=d.className)},t.$$.update=()=>{t.$$.dirty&513&&u&&_&&v()},[u,c,m,n,i,o,a,f,b,_]}class y1 extends Rt{constructor(e){super(),At(this,e,F1,L1,Nt,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1,getImage:8})}get getImage(){return this.$$.ctx[8]}}function la(t,e,l){const n=t.slice();return n[127]=e[l],n}function na(t,e,l){const n=t.slice();return n[130]=e[l],n[131]=e,n[132]=l,n}function ia(t,e,l){const n=t.slice();return n[133]=e[l],n[134]=e,n[135]=l,n}function oa(t,e,l){const n=t.slice();return n[136]=e[l],n}function B1(t,e,l){const n=t.slice();return n[139]=e[l],n}function U1(t,e,l){const n=t.slice();return n[142]=e[l],n}function z1(t,e,l){const n=t.slice();return n[145]=e[l],n}function sa(t){var ul,Te,ge,Ze,ke,Re,Lt,fl,ml,vl,rl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl,Ve,gt;let e,l,n=(((Te=(ul=t[2].conf)==null?void 0:ul.general)==null?void 0:Te.title)??"General")+"",i,o,a,u,f,c,m,_,v,b=(((Ze=(ge=t[2].conf)==null?void 0:ge.general)==null?void 0:Ze.hostname)??"Hostname")+"",d,h,g,k,C,I,R=(((Re=(ke=t[2].conf)==null?void 0:ke.general)==null?void 0:Re.timezone)??"Time zone")+"",E,O,L,z,V,B,T,y,J,W,Y,H=(((fl=(Lt=t[2].conf)==null?void 0:Lt.price)==null?void 0:fl.region)??"Price region")+"",G,$,Q,Z,K,ee,ae,fe,ne,pe,ie,_e,oe,me,we,S,P,F,A,j,le,re,he,be,x,de,ve,De,Ee,Ae,Oe,Ie,qe,Fe,tt=(((vl=(ml=t[2].conf)==null?void 0:ml.price)==null?void 0:vl.resolution)??"Resolution")+"",lt,ct,Dt,ht,_t,at,vt=(((gl=(rl=t[2].conf)==null?void 0:rl.price)==null?void 0:gl.currency)??"Currency")+"",Bt,et,ye,We,it,Ge,Ke,Qe,ce,se,Ne,Ye,Mt=(((Ll=(kl=t[2].conf)==null?void 0:kl.price)==null?void 0:Ll.enabled)??"Enabled")+"",ot,Je,Ot,ut,dt=(((Bl=(yl=(Fl=t[2].conf)==null?void 0:Fl.general)==null?void 0:yl.security)==null?void 0:Bl.title)??"Security")+"",st,Vt,Pt,St,kt,bt=(((jl=(zl=(Ul=t[2].conf)==null?void 0:Ul.general)==null?void 0:zl.security)==null?void 0:jl.none)??"None")+"",$t,Ut,xt=(((Vl=(Wl=(Hl=t[2].conf)==null?void 0:Hl.general)==null?void 0:Wl.security)==null?void 0:Vl.conf)??"Conf")+"",el,Xt,Jt=(((Yl=(Kl=(Gl=t[2].conf)==null?void 0:Gl.general)==null?void 0:Kl.security)==null?void 0:Yl.all)??"All")+"",il,Xe,ft,Tt,zt=(((gt=(Ve=t[2].conf)==null?void 0:Ve.general)==null?void 0:gt.context)??"Context")+"",It,wt,Gt,nt,jt,$e,Ct,Ce;V=new q1({});let Be=!t[6].p.t&&aa(),Le=rt([15,60]),Et=[];for(let je=0;je<2;je+=1)Et[je]=j1(z1(t,Le,je));let _l=rt(["NOK","SEK","DKK","EUR","CHF"]),sl=[];for(let je=0;je<5;je+=1)sl[je]=H1(U1(t,_l,je));Ke=new wl({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[W1]},$$scope:{ctx:t}}});let Kt=t[6].p.e&&t[0].chip!="esp8266"&&t[6].p.t&&fa(t),Yt=t[6].g.s>0&&ra(t);return{c(){var je,Ft;e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("div"),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),C=w(),I=p("div"),E=M(R),O=p("br"),L=w(),z=p("select"),Me(V.$$.fragment),B=w(),T=p("input"),y=w(),J=p("div"),W=p("div"),Y=p("div"),G=M(H),$=p("br"),Q=w(),Z=p("select"),K=p("optgroup"),Be&&Be.c(),ee=p("option"),ee.textContent="NO1",ae=p("option"),ae.textContent="NO2",fe=p("option"),fe.textContent="NO3",ne=p("option"),ne.textContent="NO4",pe=p("option"),pe.textContent="NO5",ie=p("optgroup"),_e=p("option"),_e.textContent="SE1",oe=p("option"),oe.textContent="SE2",me=p("option"),me.textContent="SE3",we=p("option"),we.textContent="SE4",S=p("optgroup"),P=p("option"),P.textContent="DK1",F=p("option"),F.textContent="DK2",A=p("option"),A.textContent="Austria",j=p("option"),j.textContent="Belgium",le=p("option"),le.textContent="Czech Republic",re=p("option"),re.textContent="Estonia",he=p("option"),he.textContent="Finland",be=p("option"),be.textContent="France",x=p("option"),x.textContent="Germany",de=p("option"),de.textContent="Great Britain",ve=p("option"),ve.textContent="Latvia",De=p("option"),De.textContent="Lithuania",Ee=p("option"),Ee.textContent="Netherland",Ae=p("option"),Ae.textContent="Poland",Oe=p("option"),Oe.textContent="Slovenia",Ie=p("option"),Ie.textContent="Switzerland",qe=w(),Fe=p("div"),lt=M(tt),ct=p("br"),Dt=w(),ht=p("select");for(let ol=0;ol<2;ol+=1)Et[ol].c();_t=w(),at=p("div"),Bt=M(vt),et=p("br"),ye=w(),We=p("select");for(let ol=0;ol<5;ol+=1)sl[ol].c();it=w(),Ge=p("div"),Me(Ke.$$.fragment),Qe=w(),ce=p("div"),se=p("label"),Ne=p("input"),Ye=w(),ot=M(Mt),Je=w(),Kt&&Kt.c(),Ot=w(),ut=p("div"),st=M(dt),Vt=p("br"),Pt=w(),St=p("select"),kt=p("option"),$t=M(bt),Ut=p("option"),el=M(xt),Xt=p("option"),il=M(Jt),Xe=w(),Yt&&Yt.c(),ft=w(),Tt=p("div"),It=M(zt),wt=p("br"),Gt=w(),nt=p("input"),r(l,"class","text-sm"),r(a,"href",bl("general")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(k,"name","gh"),r(k,"type","text"),r(k,"class","in-f w-full"),r(k,"pattern",Si),r(z,"name","gt"),r(z,"class","in-l w-full"),t[6].g.t===void 0&&qt(()=>t[26].call(z)),r(_,"class","flex"),r(m,"class","my-1"),r(T,"type","hidden"),r(T,"name","p"),T.value="true",ee.__value="10YNO-1--------2",U(ee,ee.__value),ae.__value="10YNO-2--------T",U(ae,ae.__value),fe.__value="10YNO-3--------J",U(fe,fe.__value),ne.__value="10YNO-4--------9",U(ne,ne.__value),pe.__value="10Y1001A1001A48H",U(pe,pe.__value),r(K,"label","Norway"),_e.__value="10Y1001A1001A44P",U(_e,_e.__value),oe.__value="10Y1001A1001A45N",U(oe,oe.__value),me.__value="10Y1001A1001A46L",U(me,me.__value),we.__value="10Y1001A1001A47J",U(we,we.__value),r(ie,"label","Sweden"),P.__value="10YDK-1--------W",U(P,P.__value),F.__value="10YDK-2--------M",U(F,F.__value),r(S,"label","Denmark"),A.__value="10YAT-APG------L",U(A,A.__value),j.__value="10YBE----------2",U(j,j.__value),le.__value="10YCZ-CEPS-----N",U(le,le.__value),re.__value="10Y1001A1001A39I",U(re,re.__value),he.__value="10YFI-1--------U",U(he,he.__value),be.__value="10YFR-RTE------C",U(be,be.__value),x.__value="10Y1001A1001A83F",U(x,x.__value),de.__value="10YGB----------A",U(de,de.__value),ve.__value="10YLV-1001A00074",U(ve,ve.__value),De.__value="10YLT-1001A0008Q",U(De,De.__value),Ee.__value="10YNL----------L",U(Ee,Ee.__value),Ae.__value="10YPL-AREA-----S",U(Ae,Ae.__value),Oe.__value="10YSI-ELES-----O",U(Oe,Oe.__value),Ie.__value="10YCH-SWISSGRIDZ",U(Ie,Ie.__value),r(Z,"name","pr"),r(Z,"class","in-f w-full"),t[6].p.r===void 0&&qt(()=>t[27].call(Z)),r(Y,"class","w-full"),r(ht,"name","pm"),r(ht,"class","in-m"),t[6].p.m===void 0&&qt(()=>t[28].call(ht)),r(We,"name","pc"),r(We,"class","in-l"),t[6].p.c===void 0&&qt(()=>t[29].call(We)),r(W,"class","flex"),r(J,"class","my-1"),r(Ge,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",U(Ne,Ne.__value),r(Ne,"class","rounded mb-1"),r(ce,"class","my-1"),kt.__value=0,U(kt,kt.__value),Ut.__value=1,U(Ut,Ut.__value),Xt.__value=2,U(Xt,Xt.__value),r(St,"name","gs"),r(St,"class","in-s"),t[6].g.s===void 0&&qt(()=>t[32].call(St)),r(ut,"class","my-1"),r(nt,"name","gc"),r(nt,"type","text"),r(nt,"pattern",Si),r(nt,"placeholder",jt=((Ft=(je=t[2].conf)==null?void 0:je.general)==null?void 0:Ft.context_placeholder)??"/"),r(nt,"class","in-s"),r(nt,"maxlength","36"),r(Tt,"class","my-1"),r(e,"class","cnt")},m(je,Ft){D(je,e,Ft),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),s(v,d),s(v,h),s(v,g),s(v,k),U(k,t[6].g.h),s(_,C),s(_,I),s(I,E),s(I,O),s(I,L),s(I,z),Pe(V,z,null),ze(z,t[6].g.t,!0),s(e,B),s(e,T),s(e,y),s(e,J),s(J,W),s(W,Y),s(Y,G),s(Y,$),s(Y,Q),s(Y,Z),s(Z,K),Be&&Be.m(K,null),s(K,ee),s(K,ae),s(K,fe),s(K,ne),s(K,pe),s(Z,ie),s(ie,_e),s(ie,oe),s(ie,me),s(ie,we),s(Z,S),s(S,P),s(S,F),s(Z,A),s(Z,j),s(Z,le),s(Z,re),s(Z,he),s(Z,be),s(Z,x),s(Z,de),s(Z,ve),s(Z,De),s(Z,Ee),s(Z,Ae),s(Z,Oe),s(Z,Ie),ze(Z,t[6].p.r,!0),s(W,qe),s(W,Fe),s(Fe,lt),s(Fe,ct),s(Fe,Dt),s(Fe,ht);for(let ol=0;ol<2;ol+=1)Et[ol]&&Et[ol].m(ht,null);ze(ht,t[6].p.m,!0),s(W,_t),s(W,at),s(at,Bt),s(at,et),s(at,ye),s(at,We);for(let ol=0;ol<5;ol+=1)sl[ol]&&sl[ol].m(We,null);ze(We,t[6].p.c,!0),s(e,it),s(e,Ge),Pe(Ke,Ge,null),s(e,Qe),s(e,ce),s(ce,se),s(se,Ne),Ne.checked=t[6].p.e,s(se,Ye),s(se,ot),s(ce,Je),Kt&&Kt.m(ce,null),s(e,Ot),s(e,ut),s(ut,st),s(ut,Vt),s(ut,Pt),s(ut,St),s(St,kt),s(kt,$t),s(St,Ut),s(Ut,el),s(St,Xt),s(Xt,il),ze(St,t[6].g.s,!0),s(e,Xe),Yt&&Yt.m(e,null),s(e,ft),s(e,Tt),s(Tt,It),s(Tt,wt),s(Tt,Gt),s(Tt,nt),U(nt,t[6].g.c),$e=!0,Ct||(Ce=[ue(k,"input",t[25]),ue(z,"change",t[26]),ue(Z,"change",t[27]),ue(Z,"change",t[22]),ue(ht,"change",t[28]),ue(We,"change",t[29]),ue(Ne,"change",t[30]),ue(St,"change",t[32]),ue(nt,"input",t[35])],Ct=!0)},p(je,Ft){var Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Dn,Tn,qn,An,Rn,On,Ln,Fn,yn,Bn,Un,zn,jn,Hn,Wn,Vn,Gn,Kn,Yn,Qn,ko;(!$e||Ft[0]&4)&&n!==(n=(((Xl=(Ql=je[2].conf)==null?void 0:Ql.general)==null?void 0:Xl.title)??"General")+"")&&q(i,n),(!$e||Ft[0]&4)&&b!==(b=(((Jl=(Zl=je[2].conf)==null?void 0:Zl.general)==null?void 0:Jl.hostname)??"Hostname")+"")&&q(d,b),Ft[0]&64&&k.value!==je[6].g.h&&U(k,je[6].g.h),(!$e||Ft[0]&4)&&R!==(R=(((xl=($l=je[2].conf)==null?void 0:$l.general)==null?void 0:xl.timezone)??"Time zone")+"")&&q(E,R),Ft[0]&64&&ze(z,je[6].g.t),(!$e||Ft[0]&4)&&H!==(H=(((tn=(en=je[2].conf)==null?void 0:en.price)==null?void 0:tn.region)??"Price region")+"")&&q(G,H),je[6].p.t?Be&&(Be.d(1),Be=null):Be||(Be=aa(),Be.c(),Be.m(K,ee)),Ft[0]&64&&ze(Z,je[6].p.r),(!$e||Ft[0]&4)&&tt!==(tt=(((Dn=(Nn=je[2].conf)==null?void 0:Nn.price)==null?void 0:Dn.resolution)??"Resolution")+"")&&q(lt,tt),Ft[0]&64&&ze(ht,je[6].p.m),(!$e||Ft[0]&4)&&vt!==(vt=(((qn=(Tn=je[2].conf)==null?void 0:Tn.price)==null?void 0:qn.currency)??"Currency")+"")&&q(Bt,vt),Ft[0]&64&&ze(We,je[6].p.c);const ol={};Ft[0]&4|Ft[4]&16777216&&(ol.$$scope={dirty:Ft,ctx:je}),Ke.$set(ol),Ft[0]&64&&(Ne.checked=je[6].p.e),(!$e||Ft[0]&4)&&Mt!==(Mt=(((Rn=(An=je[2].conf)==null?void 0:An.price)==null?void 0:Rn.enabled)??"Enabled")+"")&&q(ot,Mt),je[6].p.e&&je[0].chip!="esp8266"&&je[6].p.t?Kt?Kt.p(je,Ft):(Kt=fa(je),Kt.c(),Kt.m(ce,null)):Kt&&(Kt.d(1),Kt=null),(!$e||Ft[0]&4)&&dt!==(dt=(((Fn=(Ln=(On=je[2].conf)==null?void 0:On.general)==null?void 0:Ln.security)==null?void 0:Fn.title)??"Security")+"")&&q(st,dt),(!$e||Ft[0]&4)&&bt!==(bt=(((Un=(Bn=(yn=je[2].conf)==null?void 0:yn.general)==null?void 0:Bn.security)==null?void 0:Un.none)??"None")+"")&&q($t,bt),(!$e||Ft[0]&4)&&xt!==(xt=(((Hn=(jn=(zn=je[2].conf)==null?void 0:zn.general)==null?void 0:jn.security)==null?void 0:Hn.conf)??"Conf")+"")&&q(el,xt),(!$e||Ft[0]&4)&&Jt!==(Jt=(((Gn=(Vn=(Wn=je[2].conf)==null?void 0:Wn.general)==null?void 0:Vn.security)==null?void 0:Gn.all)??"All")+"")&&q(il,Jt),Ft[0]&64&&ze(St,je[6].g.s),je[6].g.s>0?Yt?Yt.p(je,Ft):(Yt=ra(je),Yt.c(),Yt.m(e,ft)):Yt&&(Yt.d(1),Yt=null),(!$e||Ft[0]&4)&&zt!==(zt=(((Yn=(Kn=je[2].conf)==null?void 0:Kn.general)==null?void 0:Yn.context)??"Context")+"")&&q(It,zt),(!$e||Ft[0]&4&&jt!==(jt=((ko=(Qn=je[2].conf)==null?void 0:Qn.general)==null?void 0:ko.context_placeholder)??"/"))&&r(nt,"placeholder",jt),Ft[0]&64&&nt.value!==je[6].g.c&&U(nt,je[6].g.c)},i(je){$e||(X(V.$$.fragment,je),X(Ke.$$.fragment,je),$e=!0)},o(je){te(V.$$.fragment,je),te(Ke.$$.fragment,je),$e=!1},d(je){je&&N(e),Se(V),Be&&Be.d(),nl(Et,je),nl(sl,je),Se(Ke),Kt&&Kt.d(),Yt&&Yt.d(),Ct=!1,Wt(Ce)}}}function aa(t){let e,l,n,i,o;return{c(){e=p("option"),e.textContent="NO1 w/support",l=p("option"),l.textContent="NO2 w/support",n=p("option"),n.textContent="NO3 w/support",i=p("option"),i.textContent="NO4 w/support",o=p("option"),o.textContent="NO5 w/support",e.__value="NO1S",U(e,e.__value),l.__value="NO2S",U(l,l.__value),n.__value="NO3S",U(n,n.__value),i.__value="NO4S",U(i,i.__value),o.__value="NO5S",U(o,o.__value)},m(a,u){D(a,e,u),D(a,l,u),D(a,n,u),D(a,i,u),D(a,o,u)},d(a){a&&(N(e),N(l),N(n),N(i),N(o))}}}function j1(t){let e;return{c(){e=p("option"),e.textContent=`${t[145]}M`,e.__value=t[145],U(e,e.__value)},m(l,n){D(l,e,n)},p:He,d(l){l&&N(e)}}}function H1(t){let e;return{c(){e=p("option"),e.textContent=`${t[142]}`,e.__value=t[142],U(e,e.__value)},m(l,n){D(l,e,n)},p:He,d(l){l&&N(e)}}}function W1(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.price)==null?void 0:i.conf)??"Configure")+"",l;return{c(){l=M(e)},m(o,a){D(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.price)==null?void 0:f.conf)??"Configure")+"")&&q(l,e)},d(o){o&&N(l)}}}function fa(t){let e,l,n,i,o,a;return{c(){e=p("input"),l=w(),n=p("br"),i=p("input"),r(e,"name","pt"),r(e,"type","hidden"),r(i,"type","text"),r(i,"class","in-s"),r(i,"placeholder","ENTSO-E API key disabled, ref issue #1030"),i.disabled=!0},m(u,f){D(u,e,f),U(e,t[6].p.t),D(u,l,f),D(u,n,f),D(u,i,f),o||(a=ue(e,"input",t[31]),o=!0)},p(u,f){f[0]&64&&U(e,u[6].p.t)},d(u){u&&(N(e),N(l),N(n),N(i)),o=!1,a()}}}function ra(t){var g,k,C,I,R,E;let e,l=(((C=(k=(g=t[2].conf)==null?void 0:g.general)==null?void 0:k.security)==null?void 0:C.username)??"Username")+"",n,i,o,a,u,f,c=(((E=(R=(I=t[2].conf)==null?void 0:I.general)==null?void 0:R.security)==null?void 0:E.password)??"Password")+"",m,_,v,b,d,h;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),u=w(),f=p("div"),m=M(c),_=p("br"),v=w(),b=p("input"),r(a,"name","gu"),r(a,"type","text"),r(a,"class","in-s"),r(a,"maxlength","36"),r(a,"pattern",Ol),r(e,"class","my-1"),r(b,"name","gp"),r(b,"type","password"),r(b,"class","in-s"),r(b,"maxlength","36"),r(b,"pattern",Ol),r(f,"class","my-1")},m(O,L){D(O,e,L),s(e,n),s(e,i),s(e,o),s(e,a),U(a,t[6].g.u),D(O,u,L),D(O,f,L),s(f,m),s(f,_),s(f,v),s(f,b),U(b,t[6].g.p),d||(h=[ue(a,"input",t[33]),ue(b,"input",t[34])],d=!0)},p(O,L){var z,V,B,T,y,J;L[0]&4&&l!==(l=(((B=(V=(z=O[2].conf)==null?void 0:z.general)==null?void 0:V.security)==null?void 0:B.username)??"Username")+"")&&q(n,l),L[0]&64&&a.value!==O[6].g.u&&U(a,O[6].g.u),L[0]&4&&c!==(c=(((J=(y=(T=O[2].conf)==null?void 0:T.general)==null?void 0:y.security)==null?void 0:J.password)??"Password")+"")&&q(m,c),L[0]&64&&b.value!==O[6].g.p&&U(b,O[6].g.p)},d(O){O&&(N(e),N(u),N(f)),d=!1,Wt(h)}}}function ua(t){var ce,se,Ne,Ye,Mt,ot,Je,Ot,ut,dt,st,Vt,Pt,St,kt,bt,$t,Ut,xt,el,Xt,Jt,il;let e,l,n=(((se=(ce=t[2].conf)==null?void 0:ce.meter)==null?void 0:se.title)??"Meter")+"",i,o,a,u,f,c,m,_,v,b=(((Mt=(Ye=(Ne=t[2].conf)==null?void 0:Ne.meter)==null?void 0:Ye.comm)==null?void 0:Mt.title)??"Communication")+"",d,h,g,k,C,I=(((Ot=(Je=(ot=t[2].conf)==null?void 0:ot.meter)==null?void 0:Je.comm)==null?void 0:Ot.passive)??"Passive")+"",R,E,O=(((st=(dt=(ut=t[2].conf)==null?void 0:ut.meter)==null?void 0:dt.comm)==null?void 0:st.pulse)??"Pulse")+"",L,z=(Pt=(Vt=t[0])==null?void 0:Vt.features)==null?void 0:Pt.includes("kmp"),V,B,T,y=(((St=t[2].common)==null?void 0:St.voltage)??"Voltage")+"",J,W,Y,H,G,$,Q,Z,K,ee=(((bt=(kt=t[2].conf)==null?void 0:kt.meter)==null?void 0:bt.fuse)??"Main fuse")+"",ae,fe,ne,pe,ie,_e,oe,me,we,S=(((Ut=($t=t[2].conf)==null?void 0:$t.meter)==null?void 0:Ut.prod)??"Production")+"",P,F,A,j,le,re,he,be,x,de,ve,De,Ee,Ae,Oe=(((el=(xt=t[2].conf)==null?void 0:xt.meter)==null?void 0:el.encrypted)??"Encrypted")+"",Ie,qe,Fe,tt,lt,ct,Dt,ht=(((il=(Jt=(Xt=t[2].conf)==null?void 0:Xt.meter)==null?void 0:Jt.multipliers)==null?void 0:il.title)??"Multipliers")+"",_t,at,vt,Bt,et=z&&ca();function ye(Xe,ft){return Xe[6].m.a===2?G1:V1}let We=ye(t),it=We(t),Ge=t[6].m.e.e&&_a(t),Ke=t[6].m.e.e&&ma(t),Qe=t[6].m.m.e&&pa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("input"),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("select"),C=p("option"),R=M(I),E=p("option"),L=M(O),et&&et.c(),V=w(),it.c(),B=w(),T=p("div"),J=M(y),W=p("br"),Y=w(),H=p("select"),G=p("option"),G.textContent="400V (TN)",$=p("option"),$.textContent="230V (IT/TT)",Q=w(),Z=p("div"),K=p("div"),ae=M(ee),fe=p("br"),ne=w(),pe=p("label"),ie=p("input"),_e=w(),oe=p("span"),oe.textContent="A",me=w(),we=p("div"),P=M(S),F=p("br"),A=w(),j=p("label"),le=p("input"),re=w(),he=p("span"),he.textContent="kWp",be=w(),x=p("div"),x.innerHTML="",de=w(),ve=p("div"),De=p("label"),Ee=p("input"),Ae=w(),Ie=M(Oe),qe=w(),Ge&&Ge.c(),Fe=w(),Ke&&Ke.c(),tt=w(),lt=p("label"),ct=p("input"),Dt=w(),_t=M(ht),at=w(),Qe&&Qe.c(),r(l,"class","text-sm"),r(a,"href",bl("meter")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","m"),f.value="true",r(m,"type","hidden"),r(m,"name","mo"),m.value="1",C.__value=0,U(C,C.__value),E.__value=2,U(E,E.__value),r(k,"name","ma"),r(k,"class","in-s"),t[6].m.a===void 0&&qt(()=>t[36].call(k)),r(v,"class","my-1"),G.__value=2,U(G,G.__value),$.__value=1,U($,$.__value),r(H,"name","md"),r(H,"class","in-s"),t[6].m.d===void 0&&qt(()=>t[42].call(H)),r(T,"class","my-1"),r(ie,"name","mf"),r(ie,"type","number"),r(ie,"min","5"),r(ie,"max","65535"),r(ie,"class","in-f tr w-full"),r(oe,"class","in-post"),r(pe,"class","flex"),r(K,"class","mx-1"),r(le,"name","mr"),r(le,"type","number"),r(le,"min","0"),r(le,"max","65535"),r(le,"class","in-f tr w-full"),r(he,"class","in-post"),r(j,"class","flex"),r(we,"class","mx-1"),r(Z,"class","my-1 flex"),r(x,"class","my-1"),r(Ee,"type","checkbox"),r(Ee,"name","me"),Ee.__value="true",U(Ee,Ee.__value),r(Ee,"class","rounded mb-1"),r(ve,"class","my-1"),r(ct,"type","checkbox"),r(ct,"name","mm"),ct.__value="true",U(ct,ct.__value),r(ct,"class","rounded mb-1"),r(e,"class","cnt")},m(Xe,ft){D(Xe,e,ft),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(e,_),s(e,v),s(v,d),s(v,h),s(v,g),s(v,k),s(k,C),s(C,R),s(k,E),s(E,L),et&&et.m(k,null),ze(k,t[6].m.a,!0),s(e,V),it.m(e,null),s(e,B),s(e,T),s(T,J),s(T,W),s(T,Y),s(T,H),s(H,G),s(H,$),ze(H,t[6].m.d,!0),s(e,Q),s(e,Z),s(Z,K),s(K,ae),s(K,fe),s(K,ne),s(K,pe),s(pe,ie),U(ie,t[6].m.f),s(pe,_e),s(pe,oe),s(Z,me),s(Z,we),s(we,P),s(we,F),s(we,A),s(we,j),s(j,le),U(le,t[6].m.r),s(j,re),s(j,he),s(e,be),s(e,x),s(e,de),s(e,ve),s(ve,De),s(De,Ee),Ee.checked=t[6].m.e.e,s(De,Ae),s(De,Ie),s(ve,qe),Ge&&Ge.m(ve,null),s(e,Fe),Ke&&Ke.m(e,null),s(e,tt),s(e,lt),s(lt,ct),ct.checked=t[6].m.m.e,s(lt,Dt),s(lt,_t),s(e,at),Qe&&Qe.m(e,null),vt||(Bt=[ue(k,"change",t[36]),ue(H,"change",t[42]),ue(ie,"input",t[43]),ue(le,"input",t[44]),ue(Ee,"change",t[45]),ue(ct,"change",t[48])],vt=!0)},p(Xe,ft){var Tt,zt,It,wt,Gt,nt,jt,$e,Ct,Ce,Be,Le,Et,_l,sl,Kt,Yt,ul,Te,ge,Ze,ke,Re;ft[0]&4&&n!==(n=(((zt=(Tt=Xe[2].conf)==null?void 0:Tt.meter)==null?void 0:zt.title)??"Meter")+"")&&q(i,n),ft[0]&4&&b!==(b=(((Gt=(wt=(It=Xe[2].conf)==null?void 0:It.meter)==null?void 0:wt.comm)==null?void 0:Gt.title)??"Communication")+"")&&q(d,b),ft[0]&4&&I!==(I=((($e=(jt=(nt=Xe[2].conf)==null?void 0:nt.meter)==null?void 0:jt.comm)==null?void 0:$e.passive)??"Passive")+"")&&q(R,I),ft[0]&4&&O!==(O=(((Be=(Ce=(Ct=Xe[2].conf)==null?void 0:Ct.meter)==null?void 0:Ce.comm)==null?void 0:Be.pulse)??"Pulse")+"")&&q(L,O),ft[0]&1&&(z=(Et=(Le=Xe[0])==null?void 0:Le.features)==null?void 0:Et.includes("kmp")),z?et||(et=ca(),et.c(),et.m(k,null)):et&&(et.d(1),et=null),ft[0]&64&&ze(k,Xe[6].m.a),We===(We=ye(Xe))&&it?it.p(Xe,ft):(it.d(1),it=We(Xe),it&&(it.c(),it.m(e,B))),ft[0]&4&&y!==(y=(((_l=Xe[2].common)==null?void 0:_l.voltage)??"Voltage")+"")&&q(J,y),ft[0]&64&&ze(H,Xe[6].m.d),ft[0]&4&&ee!==(ee=(((Kt=(sl=Xe[2].conf)==null?void 0:sl.meter)==null?void 0:Kt.fuse)??"Main fuse")+"")&&q(ae,ee),ft[0]&64&&Ue(ie.value)!==Xe[6].m.f&&U(ie,Xe[6].m.f),ft[0]&4&&S!==(S=(((ul=(Yt=Xe[2].conf)==null?void 0:Yt.meter)==null?void 0:ul.prod)??"Production")+"")&&q(P,S),ft[0]&64&&Ue(le.value)!==Xe[6].m.r&&U(le,Xe[6].m.r),ft[0]&64&&(Ee.checked=Xe[6].m.e.e),ft[0]&4&&Oe!==(Oe=(((ge=(Te=Xe[2].conf)==null?void 0:Te.meter)==null?void 0:ge.encrypted)??"Encrypted")+"")&&q(Ie,Oe),Xe[6].m.e.e?Ge?Ge.p(Xe,ft):(Ge=_a(Xe),Ge.c(),Ge.m(ve,null)):Ge&&(Ge.d(1),Ge=null),Xe[6].m.e.e?Ke?Ke.p(Xe,ft):(Ke=ma(Xe),Ke.c(),Ke.m(e,tt)):Ke&&(Ke.d(1),Ke=null),ft[0]&64&&(ct.checked=Xe[6].m.m.e),ft[0]&4&&ht!==(ht=(((Re=(ke=(Ze=Xe[2].conf)==null?void 0:Ze.meter)==null?void 0:ke.multipliers)==null?void 0:Re.title)??"Multipliers")+"")&&q(_t,ht),Xe[6].m.m.e?Qe?Qe.p(Xe,ft):(Qe=pa(Xe),Qe.c(),Qe.m(e,null)):Qe&&(Qe.d(1),Qe=null)},d(Xe){Xe&&N(e),et&&et.d(),it.d(),Ge&&Ge.d(),Ke&&Ke.d(),Qe&&Qe.d(),vt=!1,Wt(Bt)}}}function ca(t){let e;return{c(){e=p("option"),e.textContent="KMP",e.__value=9,U(e,e.__value)},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function V1(t){var ae,fe,ne,pe,ie,_e;let e,l,n=(((fe=(ae=t[2].conf)==null?void 0:ae.meter)==null?void 0:fe.buffer)??"Buffer size")+"",i,o,a,u=(((pe=(ne=t[2].conf)==null?void 0:ne.meter)==null?void 0:pe.serial)??"Serial conf.")+"",f,c,m,_,v,b=(((_e=(ie=t[2].conf)==null?void 0:ie.meter)==null?void 0:_e.inverted)??"inverted")+"",d,h,g,k,C,I,R,E,O,L,z,V,B,T,y,J,W,Y,H,G,$,Q,Z,K=rt([3,12,24,48,96,192,384,576,1152]),ee=[];for(let oe=0;oe<9;oe+=1)ee[oe]=K1(B1(t,K,oe));return{c(){e=p("div"),l=p("span"),i=M(n),o=w(),a=p("span"),f=M(u),c=w(),m=p("label"),_=p("input"),v=w(),d=M(b),h=w(),g=p("div"),k=p("select"),C=p("option"),I=M("Autodetect");for(let oe=0;oe<9;oe+=1)ee[oe].c();E=w(),O=p("select"),L=p("option"),z=M("-"),B=p("option"),B.textContent="7N1",T=p("option"),T.textContent="8N1",y=p("option"),y.textContent="8N2",J=p("option"),J.textContent="7E1",W=p("option"),W.textContent="8E1",H=w(),G=p("input"),r(l,"class","float-right"),r(_,"name","mi"),_.__value="true",U(_,_.__value),r(_,"type","checkbox"),r(_,"class","rounded mb-1"),r(m,"class","mt-2 ml-3 whitespace-nowrap"),C.__value=0,U(C,C.__value),C.disabled=R=t[6].m.b!=0,r(k,"name","mb"),r(k,"class","in-f tr w-1/2"),t[6].m.b===void 0&&qt(()=>t[39].call(k)),L.__value=0,U(L,L.__value),L.disabled=V=t[6].m.b!=0,B.__value=2,U(B,B.__value),T.__value=3,U(T,T.__value),y.__value=7,U(y,y.__value),J.__value=10,U(J,J.__value),W.__value=11,U(W,W.__value),r(O,"name","mp"),r(O,"class","in-m"),O.disabled=Y=t[6].m.b==0,t[6].m.p===void 0&&qt(()=>t[40].call(O)),r(G,"name","ms"),r(G,"type","number"),r(G,"min",64),r(G,"max",$=t[0].chip=="esp8266"?t[6].i.h.p==3||t[6].i.h.p==113?512:256:4096),r(G,"step",64),r(G,"class","in-l tr w-1/2"),r(g,"class","flex w-full"),r(e,"class","my-1")},m(oe,me){D(oe,e,me),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(e,c),s(e,m),s(m,_),_.checked=t[6].m.i,s(m,v),s(m,d),s(e,h),s(e,g),s(g,k),s(k,C),s(C,I);for(let we=0;we<9;we+=1)ee[we]&&ee[we].m(k,null);ze(k,t[6].m.b,!0),s(g,E),s(g,O),s(O,L),s(L,z),s(O,B),s(O,T),s(O,y),s(O,J),s(O,W),ze(O,t[6].m.p,!0),s(g,H),s(g,G),U(G,t[6].m.s),Q||(Z=[ue(_,"change",t[38]),ue(k,"change",t[39]),ue(O,"change",t[40]),ue(G,"input",t[41])],Q=!0)},p(oe,me){var we,S,P,F,A,j;me[0]&4&&n!==(n=(((S=(we=oe[2].conf)==null?void 0:we.meter)==null?void 0:S.buffer)??"Buffer size")+"")&&q(i,n),me[0]&4&&u!==(u=(((F=(P=oe[2].conf)==null?void 0:P.meter)==null?void 0:F.serial)??"Serial conf.")+"")&&q(f,u),me[0]&64&&(_.checked=oe[6].m.i),me[0]&4&&b!==(b=(((j=(A=oe[2].conf)==null?void 0:A.meter)==null?void 0:j.inverted)??"inverted")+"")&&q(d,b),me[0]&64&&R!==(R=oe[6].m.b!=0)&&(C.disabled=R),me[0]&64&&ze(k,oe[6].m.b),me[0]&64&&V!==(V=oe[6].m.b!=0)&&(L.disabled=V),me[0]&64&&Y!==(Y=oe[6].m.b==0)&&(O.disabled=Y),me[0]&64&&ze(O,oe[6].m.p),me[0]&65&&$!==($=oe[0].chip=="esp8266"?oe[6].i.h.p==3||oe[6].i.h.p==113?512:256:4096)&&r(G,"max",$),me[0]&64&&Ue(G.value)!==oe[6].m.s&&U(G,oe[6].m.s)},d(oe){oe&&N(e),nl(ee,oe),Q=!1,Wt(Z)}}}function G1(t){var c,m;let e,l,n=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.pulses)??"Pulses per kWh")+"",i,o,a,u,f;return{c(){e=p("div"),l=p("span"),i=M(n),o=w(),a=p("input"),r(a,"name","mb"),r(a,"class","in-s tr"),r(a,"type","number"),r(a,"min",1),r(a,"max",3600),r(e,"class","my-1")},m(_,v){D(_,e,v),s(e,l),s(l,i),s(e,o),s(e,a),U(a,t[6].m.b),u||(f=ue(a,"input",t[37]),u=!0)},p(_,v){var b,d;v[0]&4&&n!==(n=(((d=(b=_[2].conf)==null?void 0:b.meter)==null?void 0:d.pulses)??"Pulses per kWh")+"")&&q(i,n),v[0]&64&&Ue(a.value)!==_[6].m.b&&U(a,_[6].m.b)},d(_){_&&N(e),u=!1,f()}}}function K1(t){let e;return{c(){e=p("option"),e.textContent=`${t[139]*100}`,e.__value=t[139]*100,U(e,e.__value)},m(l,n){D(l,e,n)},p:He,d(l){l&&N(e)}}}function _a(t){let e,l,n,i;return{c(){e=p("br"),l=p("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s"),r(l,"pattern",Hr)},m(o,a){D(o,e,a),D(o,l,a),U(l,t[6].m.e.k),n||(i=ue(l,"input",t[46]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].m.e.k&&U(l,o[6].m.e.k)},d(o){o&&(N(e),N(l)),n=!1,i()}}}function ma(t){var c,m;let e,l=(((m=(c=t[2].conf)==null?void 0:c.meter)==null?void 0:m.authkey)??"Authentication key")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","mea"),r(a,"type","text"),r(a,"class","in-s"),r(a,"pattern",Hr),r(e,"class","my-1")},m(_,v){D(_,e,v),s(e,n),s(e,i),s(e,o),s(e,a),U(a,t[6].m.e.a),u||(f=ue(a,"input",t[47]),u=!0)},p(_,v){var b,d;v[0]&4&&l!==(l=(((d=(b=_[2].conf)==null?void 0:b.meter)==null?void 0:d.authkey)??"Authentication key")+"")&&q(n,l),v[0]&64&&a.value!==_[6].m.e.a&&U(a,_[6].m.e.a)},d(_){_&&N(e),u=!1,f()}}}function pa(t){var Y,H,G,$,Q,Z,K,ee,ae,fe,ne,pe;let e,l,n=(((G=(H=(Y=t[2].conf)==null?void 0:Y.meter)==null?void 0:H.multipliers)==null?void 0:G.watt)??"Watt")+"",i,o,a,u,f,c,m=(((Z=(Q=($=t[2].conf)==null?void 0:$.meter)==null?void 0:Q.multipliers)==null?void 0:Z.volt)??"Volt")+"",_,v,b,d,h,g,k=(((ae=(ee=(K=t[2].conf)==null?void 0:K.meter)==null?void 0:ee.multipliers)==null?void 0:ae.amp)??"Amp")+"",C,I,R,E,O,L,z=(((pe=(ne=(fe=t[2].conf)==null?void 0:fe.meter)==null?void 0:ne.multipliers)==null?void 0:pe.kwh)??"kWh")+"",V,B,T,y,J,W;return{c(){e=p("div"),l=p("div"),i=M(n),o=p("br"),a=w(),u=p("input"),f=w(),c=p("div"),_=M(m),v=p("br"),b=w(),d=p("input"),h=w(),g=p("div"),C=M(k),I=p("br"),R=w(),E=p("input"),O=w(),L=p("div"),V=M(z),B=p("br"),T=w(),y=p("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(d,"name","mmv"),r(d,"type","number"),r(d,"min","0.00"),r(d,"max","1000"),r(d,"step","0.001"),r(d,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(E,"name","mma"),r(E,"type","number"),r(E,"min","0.00"),r(E,"max","1000"),r(E,"step","0.001"),r(E,"class","in-m tr w-full"),r(g,"class","w-1/4"),r(y,"name","mmc"),r(y,"type","number"),r(y,"min","0.00"),r(y,"max","1000"),r(y,"step","0.001"),r(y,"class","in-l tr w-full"),r(L,"class","w-1/4"),r(e,"class","flex my-1")},m(ie,_e){D(ie,e,_e),s(e,l),s(l,i),s(l,o),s(l,a),s(l,u),U(u,t[6].m.m.w),s(e,f),s(e,c),s(c,_),s(c,v),s(c,b),s(c,d),U(d,t[6].m.m.v),s(e,h),s(e,g),s(g,C),s(g,I),s(g,R),s(g,E),U(E,t[6].m.m.a),s(e,O),s(e,L),s(L,V),s(L,B),s(L,T),s(L,y),U(y,t[6].m.m.c),J||(W=[ue(u,"input",t[49]),ue(d,"input",t[50]),ue(E,"input",t[51]),ue(y,"input",t[52])],J=!0)},p(ie,_e){var oe,me,we,S,P,F,A,j,le,re,he,be;_e[0]&4&&n!==(n=(((we=(me=(oe=ie[2].conf)==null?void 0:oe.meter)==null?void 0:me.multipliers)==null?void 0:we.watt)??"Watt")+"")&&q(i,n),_e[0]&64&&Ue(u.value)!==ie[6].m.m.w&&U(u,ie[6].m.m.w),_e[0]&4&&m!==(m=(((F=(P=(S=ie[2].conf)==null?void 0:S.meter)==null?void 0:P.multipliers)==null?void 0:F.volt)??"Volt")+"")&&q(_,m),_e[0]&64&&Ue(d.value)!==ie[6].m.m.v&&U(d,ie[6].m.m.v),_e[0]&4&&k!==(k=(((le=(j=(A=ie[2].conf)==null?void 0:A.meter)==null?void 0:j.multipliers)==null?void 0:le.amp)??"Amp")+"")&&q(C,k),_e[0]&64&&Ue(E.value)!==ie[6].m.m.a&&U(E,ie[6].m.m.a),_e[0]&4&&z!==(z=(((be=(he=(re=ie[2].conf)==null?void 0:re.meter)==null?void 0:he.multipliers)==null?void 0:be.kwh)??"kWh")+"")&&q(V,z),_e[0]&64&&Ue(y.value)!==ie[6].m.m.c&&U(y,ie[6].m.m.c)},d(ie){ie&&N(e),J=!1,Wt(W)}}}function da(t){var L,z,V,B,T,y;let e,l,n=(((z=(L=t[2].conf)==null?void 0:L.connection)==null?void 0:z.title)??"Connection")+"",i,o,a,u,f,c,m,_,v,b=(((B=(V=t[2].conf)==null?void 0:V.connection)==null?void 0:B.wifi)??"WiFi")+"",d,h,g=(((y=(T=t[2].conf)==null?void 0:T.connection)==null?void 0:y.ap)??"AP")+"",k,C,I,R,E=t[0].if&&t[0].if.eth&&ha(t),O=(t[6].n.c==1||t[6].n.c==2)&&va(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("select"),v=p("option"),d=M(b),h=p("option"),k=M(g),E&&E.c(),C=w(),O&&O.c(),r(l,"class","text-sm"),r(a,"href",bl("connection")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","w"),f.value="true",v.__value=1,U(v,v.__value),h.__value=2,U(h,h.__value),r(_,"name","nc"),r(_,"class","in-s"),t[6].n.c===void 0&&qt(()=>t[53].call(_)),r(m,"class","my-1"),r(e,"class","cnt")},m(J,W){D(J,e,W),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),s(v,d),s(_,h),s(h,k),E&&E.m(_,null),ze(_,t[6].n.c,!0),s(e,C),O&&O.m(e,null),I||(R=ue(_,"change",t[53]),I=!0)},p(J,W){var Y,H,G,$,Q,Z;W[0]&4&&n!==(n=(((H=(Y=J[2].conf)==null?void 0:Y.connection)==null?void 0:H.title)??"Connection")+"")&&q(i,n),W[0]&4&&b!==(b=((($=(G=J[2].conf)==null?void 0:G.connection)==null?void 0:$.wifi)??"WiFi")+"")&&q(d,b),W[0]&4&&g!==(g=(((Z=(Q=J[2].conf)==null?void 0:Q.connection)==null?void 0:Z.ap)??"AP")+"")&&q(k,g),J[0].if&&J[0].if.eth?E?E.p(J,W):(E=ha(J),E.c(),E.m(_,null)):E&&(E.d(1),E=null),W[0]&64&&ze(_,J[6].n.c),J[6].n.c==1||J[6].n.c==2?O?O.p(J,W):(O=va(J),O.c(),O.m(e,null)):O&&(O.d(1),O=null)},d(J){J&&N(e),E&&E.d(),O&&O.d(),I=!1,R()}}}function ha(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,U(e,e.__value)},m(a,u){D(a,e,u),s(e,n)},p(a,u){var f,c;u[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&q(n,l)},d(a){a&&N(e)}}}function va(t){var De,Ee,Ae,Oe,Ie,qe,Fe,tt,lt,ct,Dt,ht,_t,at,vt,Bt,et,ye,We,it,Ge,Ke,Qe;let e,l=(((Ee=(De=t[2].conf)==null?void 0:De.connection)==null?void 0:Ee.ssid)??"SSID")+"",n,i,o,a,u,f,c,m,_,v,b=(((Oe=(Ae=t[2].conf)==null?void 0:Ae.connection)==null?void 0:Oe.psk)??"Password")+"",d,h,g,k,C,I,R,E=(((Fe=(qe=(Ie=t[2].conf)==null?void 0:Ie.connection)==null?void 0:qe.ps)==null?void 0:Fe.title)??"Power saving")+"",O,L,z,V,B,T=(((ct=(lt=(tt=t[2].conf)==null?void 0:tt.connection)==null?void 0:lt.ps)==null?void 0:ct.default)??"Default")+"",y,J,W=(((_t=(ht=(Dt=t[2].conf)==null?void 0:Dt.connection)==null?void 0:ht.ps)==null?void 0:_t.off)??"Off")+"",Y,H,G=(((Bt=(vt=(at=t[2].conf)==null?void 0:at.connection)==null?void 0:vt.ps)==null?void 0:Bt.min)??"Min")+"",$,Q,Z=(((We=(ye=(et=t[2].conf)==null?void 0:et.connection)==null?void 0:ye.ps)==null?void 0:We.max)??"Max")+"",K,ee,ae,fe=(((Ge=(it=t[2].conf)==null?void 0:it.connection)==null?void 0:Ge.pwr)??"Power")+"",ne,pe,ie,_e,oe,me,we,S,P,F,A,j,le=(((Qe=(Ke=t[2].conf)==null?void 0:Ke.connection)==null?void 0:Qe.tick_11b)??"802.11b")+"",re,he,be;function x(ce,se){return ce[8]?Q1:Y1}let de=x(t),ve=de(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("label"),a=p("input"),u=M(" manual"),f=w(),c=p("br"),m=w(),ve.c(),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),C=w(),I=p("div"),R=p("div"),O=M(E),L=p("br"),z=w(),V=p("select"),B=p("option"),y=M(T),J=p("option"),Y=M(W),H=p("option"),$=M(G),Q=p("option"),K=M(Z),ee=w(),ae=p("div"),ne=M(fe),pe=p("br"),ie=w(),_e=p("div"),oe=p("input"),me=w(),we=p("span"),we.textContent="dBm",S=w(),P=p("div"),F=p("label"),A=p("input"),j=w(),re=M(le),r(a,"type","checkbox"),a.__value="true",U(a,a.__value),r(a,"class","rounded mb-1"),r(o,"class","float-right mr-3"),r(e,"class","my-1"),r(k,"name","wp"),r(k,"type","password"),r(k,"class","in-s"),r(k,"pattern",In),r(v,"class","my-1"),B.__value=255,U(B,B.__value),J.__value=0,U(J,J.__value),H.__value=1,U(H,H.__value),Q.__value=2,U(Q,Q.__value),r(V,"name","wz"),r(V,"class","in-s"),t[6].w.z===void 0&&qt(()=>t[58].call(V)),r(R,"class","w-1/2"),r(oe,"name","ww"),r(oe,"type","number"),r(oe,"min","0"),r(oe,"max","20.5"),r(oe,"step","0.5"),r(oe,"class","in-f tr w-full"),r(we,"class","in-post"),r(_e,"class","flex"),r(ae,"class","ml-2 w-1/2"),r(I,"class","my-1 flex"),r(A,"type","checkbox"),r(A,"name","wb"),A.__value="true",U(A,A.__value),r(A,"class","rounded mb-1"),r(P,"class","my-3")},m(ce,se){D(ce,e,se),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[8],s(o,u),s(e,f),s(e,c),s(e,m),ve.m(e,null),D(ce,_,se),D(ce,v,se),s(v,d),s(v,h),s(v,g),s(v,k),U(k,t[6].w.p),D(ce,C,se),D(ce,I,se),s(I,R),s(R,O),s(R,L),s(R,z),s(R,V),s(V,B),s(B,y),s(V,J),s(J,Y),s(V,H),s(H,$),s(V,Q),s(Q,K),ze(V,t[6].w.z,!0),s(I,ee),s(I,ae),s(ae,ne),s(ae,pe),s(ae,ie),s(ae,_e),s(_e,oe),U(oe,t[6].w.w),s(_e,me),s(_e,we),D(ce,S,se),D(ce,P,se),s(P,F),s(F,A),A.checked=t[6].w.b,s(F,j),s(F,re),he||(be=[ue(a,"change",t[54]),ue(k,"input",t[57]),ue(V,"change",t[58]),ue(oe,"input",t[59]),ue(A,"change",t[60])],he=!0)},p(ce,se){var Ne,Ye,Mt,ot,Je,Ot,ut,dt,st,Vt,Pt,St,kt,bt,$t,Ut,xt,el,Xt,Jt,il,Xe,ft;se[0]&4&&l!==(l=(((Ye=(Ne=ce[2].conf)==null?void 0:Ne.connection)==null?void 0:Ye.ssid)??"SSID")+"")&&q(n,l),se[0]&256&&(a.checked=ce[8]),de===(de=x(ce))&&ve?ve.p(ce,se):(ve.d(1),ve=de(ce),ve&&(ve.c(),ve.m(e,null))),se[0]&4&&b!==(b=(((ot=(Mt=ce[2].conf)==null?void 0:Mt.connection)==null?void 0:ot.psk)??"Password")+"")&&q(d,b),se[0]&64&&k.value!==ce[6].w.p&&U(k,ce[6].w.p),se[0]&4&&E!==(E=(((ut=(Ot=(Je=ce[2].conf)==null?void 0:Je.connection)==null?void 0:Ot.ps)==null?void 0:ut.title)??"Power saving")+"")&&q(O,E),se[0]&4&&T!==(T=(((Vt=(st=(dt=ce[2].conf)==null?void 0:dt.connection)==null?void 0:st.ps)==null?void 0:Vt.default)??"Default")+"")&&q(y,T),se[0]&4&&W!==(W=(((kt=(St=(Pt=ce[2].conf)==null?void 0:Pt.connection)==null?void 0:St.ps)==null?void 0:kt.off)??"Off")+"")&&q(Y,W),se[0]&4&&G!==(G=(((Ut=($t=(bt=ce[2].conf)==null?void 0:bt.connection)==null?void 0:$t.ps)==null?void 0:Ut.min)??"Min")+"")&&q($,G),se[0]&4&&Z!==(Z=(((Xt=(el=(xt=ce[2].conf)==null?void 0:xt.connection)==null?void 0:el.ps)==null?void 0:Xt.max)??"Max")+"")&&q(K,Z),se[0]&64&&ze(V,ce[6].w.z),se[0]&4&&fe!==(fe=(((il=(Jt=ce[2].conf)==null?void 0:Jt.connection)==null?void 0:il.pwr)??"Power")+"")&&q(ne,fe),se[0]&64&&Ue(oe.value)!==ce[6].w.w&&U(oe,ce[6].w.w),se[0]&64&&(A.checked=ce[6].w.b),se[0]&4&&le!==(le=(((ft=(Xe=ce[2].conf)==null?void 0:Xe.connection)==null?void 0:ft.tick_11b)??"802.11b")+"")&&q(re,le)},d(ce){ce&&(N(e),N(_),N(v),N(C),N(I),N(S),N(P)),ve.d(),he=!1,Wt(be)}}}function Y1(t){var f,c;let e,l,n,i,o,a=((f=t[9])==null?void 0:f.c)==-1&&ba(),u=((c=t[9])==null?void 0:c.n)&&ga(t);return{c(){e=p("select"),a&&a.c(),l=Qt(),u&&u.c(),r(e,"name","ws"),r(e,"class","in-s"),e.required=n=t[6].n.c==1||t[6].n.c==2,t[6].w.s===void 0&&qt(()=>t[56].call(e))},m(m,_){D(m,e,_),a&&a.m(e,null),s(e,l),u&&u.m(e,null),ze(e,t[6].w.s,!0),i||(o=ue(e,"change",t[56]),i=!0)},p(m,_){var v,b;((v=m[9])==null?void 0:v.c)==-1?a||(a=ba(),a.c(),a.m(e,l)):a&&(a.d(1),a=null),(b=m[9])!=null&&b.n?u?u.p(m,_):(u=ga(m),u.c(),u.m(e,null)):u&&(u.d(1),u=null),_[0]&64&&n!==(n=m[6].n.c==1||m[6].n.c==2)&&(e.required=n),_[0]&64&&ze(e,m[6].w.s)},d(m){m&&N(e),a&&a.d(),u&&u.d(),i=!1,o()}}}function Q1(t){let e,l,n,i;return{c(){e=p("input"),r(e,"name","ws"),r(e,"type","text"),r(e,"class","in-s"),r(e,"pattern",In),e.required=l=t[6].n.c==1||t[6].n.c==2},m(o,a){D(o,e,a),U(e,t[6].w.s),n||(i=ue(e,"input",t[55]),n=!0)},p(o,a){a[0]&64&&l!==(l=o[6].n.c==1||o[6].n.c==2)&&(e.required=l),a[0]&64&&e.value!==o[6].w.s&&U(e,o[6].w.s)},d(o){o&&N(e),n=!1,i()}}}function ba(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",U(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function ga(t){var i;let e,l=rt((i=t[9])==null?void 0:i.n),n=[];for(let o=0;ot[61].call(d)),r(O,"name","ni"),r(O,"type","text"),r(O,"class","in-m w-full"),O.disabled=L=t[6].n.m=="dhcp",O.required=z=t[6].n.m=="static",r(O,"pattern",mn),r(B,"name","ns"),r(B,"class","in-l"),B.disabled=y=t[6].n.m=="dhcp",B.required=J=t[6].n.m=="static",t[6].n.s===void 0&&qt(()=>t[63].call(B)),r(b,"class","flex"),r(f,"class","my-1"),r($,"name","nx"),$.__value="true",U($,$.__value),r($,"type","checkbox"),r($,"class","rounded mb-1"),r(H,"class","my-1"),r(ae,"name","nd"),ae.__value="true",U(ae,ae.__value),r(ae,"type","checkbox"),r(ae,"class","rounded mb-1"),r(K,"class","my-1"),r(_e,"type","hidden"),r(_e,"name","ntp"),_e.value="true",r(A,"name","ntpd"),A.__value="true",U(A,A.__value),r(A,"type","checkbox"),r(A,"class","rounded mb-1"),r(F,"class","ml-4"),r(de,"name","ntph"),r(de,"type","text"),r(de,"class","in-s"),r(de,"pattern",Ol),r(x,"class","flex"),r(me,"class","my-1"),r(e,"class","cnt")},m(ye,We){D(ye,e,We),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(f,m),s(f,_),s(f,v),s(f,b),s(b,d),s(d,h),s(h,k),s(d,C),s(C,R),ze(d,t[6].n.m,!0),s(b,E),s(b,O),U(O,t[6].n.i),s(b,V),s(b,B),Pe(T,B,null),ze(B,t[6].n.s,!0),s(e,W),Ae&&Ae.m(e,null),s(e,Y),s(e,H),s(H,G),s(G,$),$.checked=t[6].n.x,s(G,Q),s(e,Z),s(e,K),s(K,ee),s(ee,ae),ae.checked=t[6].n.d,s(ee,fe),s(ee,pe),s(e,ie),s(e,_e),s(e,oe),s(e,me),s(me,S),s(me,P),s(me,F),s(F,A),A.checked=t[6].n.h,s(F,j),s(F,re),s(me,he),s(me,be),s(me,x),s(x,de),U(de,t[6].n.n1),ve=!0,De||(Ee=[ue(d,"change",t[61]),ue(O,"input",t[62]),ue(B,"change",t[63]),ue($,"change",t[67]),ue(ae,"change",t[68]),ue(A,"change",t[69]),ue(de,"input",t[70])],De=!0)},p(ye,We){var it,Ge,Ke,Qe,ce,se,Ne,Ye,Mt,ot,Je,Ot,ut,dt;(!ve||We[0]&4)&&n!==(n=(((Ge=(it=ye[2].conf)==null?void 0:it.network)==null?void 0:Ge.title)??"Network")+"")&&q(i,n),(!ve||We[0]&4)&&c!==(c=(((Qe=(Ke=ye[2].conf)==null?void 0:Ke.network)==null?void 0:Qe.ip)??"IP")+"")&&q(m,c),(!ve||We[0]&4)&&g!==(g=(((se=(ce=ye[2].conf)==null?void 0:ce.network)==null?void 0:se.dhcp)??"DHCP")+"")&&q(k,g),(!ve||We[0]&4)&&I!==(I=(((Ye=(Ne=ye[2].conf)==null?void 0:Ne.network)==null?void 0:Ye.static)??"Static")+"")&&q(R,I),We[0]&64&&ze(d,ye[6].n.m),(!ve||We[0]&64&&L!==(L=ye[6].n.m=="dhcp"))&&(O.disabled=L),(!ve||We[0]&64&&z!==(z=ye[6].n.m=="static"))&&(O.required=z),We[0]&64&&O.value!==ye[6].n.i&&U(O,ye[6].n.i),(!ve||We[0]&64&&y!==(y=ye[6].n.m=="dhcp"))&&(B.disabled=y),(!ve||We[0]&64&&J!==(J=ye[6].n.m=="static"))&&(B.required=J),We[0]&64&&ze(B,ye[6].n.s),ye[6].n.m=="static"?Ae?Ae.p(ye,We):(Ae=Ca(ye),Ae.c(),Ae.m(e,Y)):Ae&&(Ae.d(1),Ae=null),We[0]&64&&($.checked=ye[6].n.x),We[0]&64&&(ae.checked=ye[6].n.d),(!ve||We[0]&4)&&ne!==(ne=(((ot=(Mt=ye[2].conf)==null?void 0:Mt.network)==null?void 0:ot.tick_mdns)??"mDNS")+"")&&q(pe,ne),(!ve||We[0]&4)&&we!==(we=(((Ot=(Je=ye[2].conf)==null?void 0:Je.network)==null?void 0:Ot.ntp)??"NTP")+"")&&q(S,we),We[0]&64&&(A.checked=ye[6].n.h),(!ve||We[0]&4)&&le!==(le=(((dt=(ut=ye[2].conf)==null?void 0:ut.network)==null?void 0:dt.tick_ntp_dhcp)??"from DHCP")+"")&&q(re,le),We[0]&64&&de.value!==ye[6].n.n1&&U(de,ye[6].n.n1)},i(ye){ve||(X(T.$$.fragment,ye),ve=!0)},o(ye){te(T.$$.fragment,ye),ve=!1},d(ye){ye&&N(e),Se(T),Ae&&Ae.d(),De=!1,Wt(Ee)}}}function Ca(t){var I,R,E,O;let e,l=(((R=(I=t[2].conf)==null?void 0:I.network)==null?void 0:R.gw)??"Gateway")+"",n,i,o,a,u,f,c=(((O=(E=t[2].conf)==null?void 0:E.network)==null?void 0:O.dns)??"DNS")+"",m,_,v,b,d,h,g,k,C;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),u=w(),f=p("div"),m=M(c),_=p("br"),v=w(),b=p("div"),d=p("input"),h=w(),g=p("input"),r(a,"name","ng"),r(a,"type","text"),r(a,"class","in-s"),r(a,"pattern",mn),r(e,"class","my-1"),r(d,"name","nd1"),r(d,"type","text"),r(d,"class","in-f w-full"),r(d,"pattern",mn),r(g,"name","nd2"),r(g,"type","text"),r(g,"class","in-l w-full"),r(g,"pattern",mn),r(b,"class","flex"),r(f,"class","my-1")},m(L,z){D(L,e,z),s(e,n),s(e,i),s(e,o),s(e,a),U(a,t[6].n.g),D(L,u,z),D(L,f,z),s(f,m),s(f,_),s(f,v),s(f,b),s(b,d),U(d,t[6].n.d1),s(b,h),s(b,g),U(g,t[6].n.d2),k||(C=[ue(a,"input",t[64]),ue(d,"input",t[65]),ue(g,"input",t[66])],k=!0)},p(L,z){var V,B,T,y;z[0]&4&&l!==(l=(((B=(V=L[2].conf)==null?void 0:V.network)==null?void 0:B.gw)??"Gateway")+"")&&q(n,l),z[0]&64&&a.value!==L[6].n.g&&U(a,L[6].n.g),z[0]&4&&c!==(c=(((y=(T=L[2].conf)==null?void 0:T.network)==null?void 0:y.dns)??"DNS")+"")&&q(m,c),z[0]&64&&d.value!==L[6].n.d1&&U(d,L[6].n.d1),z[0]&64&&g.value!==L[6].n.d2&&U(g,L[6].n.d2)},d(L){L&&(N(e),N(u),N(f)),k=!1,Wt(C)}}}function Pa(t){var _l,sl,Kt,Yt,ul,Te,ge,Ze,ke,Re,Lt,fl,ml,vl,rl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl;let e,l,n=(((sl=(_l=t[2].conf)==null?void 0:_l.mqtt)==null?void 0:sl.title)??"MQTT")+"",i,o,a,u,f,c,m,_=(((Yt=(Kt=t[2].conf)==null?void 0:Kt.mqtt)==null?void 0:Yt.server)??"Server")+"",v,b,d,h,g,k,C,I,R,E,O,L,z=(((Te=(ul=t[2].conf)==null?void 0:ul.mqtt)==null?void 0:Te.user)??"Username")+"",V,B,T,y,J,W,Y=(((Ze=(ge=t[2].conf)==null?void 0:ge.mqtt)==null?void 0:Ze.pass)??"Password")+"",H,G,$,Q,Z,K,ee,ae=(((Re=(ke=t[2].conf)==null?void 0:ke.mqtt)==null?void 0:Re.id)??"Client ID")+"",fe,ne,pe,ie,_e,oe,me,we=(((fl=(Lt=t[2].conf)==null?void 0:Lt.mqtt)==null?void 0:fl.payload)??"Payload")+"",S,P,F,A,j,le,re,he,be,x,de,ve,De,Ee,Ae=(((vl=(ml=t[2].conf)==null?void 0:ml.mqtt)==null?void 0:vl.publish)??"Publish topic")+"",Oe,Ie,qe,Fe,tt,lt,ct=(((gl=(rl=t[2].conf)==null?void 0:rl.mqtt)==null?void 0:gl.subscribe)??"Subscribe topic")+"",Dt,ht,_t,at,vt,Bt,et,ye=(((Ll=(kl=t[2].conf)==null?void 0:kl.mqtt)==null?void 0:Ll.update)??"Update method")+"",We,it,Ge,Ke=(((yl=(Fl=t[2].conf)==null?void 0:Fl.mqtt)==null?void 0:yl.interval)??"Interval")+"",Qe,ce,se,Ne,Ye,Mt=(((Ul=(Bl=t[2].conf)==null?void 0:Bl.mqtt)==null?void 0:Ul.realtime)??"Real time")+"",ot,Je,Ot=(((jl=(zl=t[2].conf)==null?void 0:zl.mqtt)==null?void 0:jl.interval)??"Interval")+"",ut,dt,st,Vt,Pt,St,kt,bt,$t=(((Wl=(Hl=t[2].conf)==null?void 0:Hl.mqtt)==null?void 0:Wl.timeout)??"Timeout")+"",Ut,xt,el,Xt=(((Gl=(Vl=t[2].conf)==null?void 0:Vl.mqtt)==null?void 0:Gl.keepalive)??"Keep-alive")+"",Jt,il,Xe,ft=(((Yl=(Kl=t[2].conf)==null?void 0:Kl.mqtt)==null?void 0:Yl.autoreboot)??"Auto-reboot")+"",Tt,zt,It,wt,Gt,nt,jt,$e,Ct,Ce,Be,Le=t[0].chip!="esp8266"&&Sa(t),Et=t[6].q.s.e&&Ma(t);return{c(){var Ve,gt;e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),v=M(_),b=w(),Le&&Le.c(),d=w(),h=p("br"),g=w(),k=p("div"),C=p("input"),I=w(),R=p("input"),E=w(),Et&&Et.c(),O=w(),L=p("div"),V=M(z),B=p("br"),T=w(),y=p("input"),J=w(),W=p("div"),H=M(Y),G=p("br"),$=w(),Q=p("input"),Z=w(),K=p("div"),ee=p("div"),fe=M(ae),ne=p("br"),pe=w(),ie=p("input"),oe=w(),me=p("div"),S=M(we),P=p("br"),F=w(),A=p("select"),j=p("option"),j.textContent="Raw (minimal)",le=p("option"),le.textContent="Raw (full)",re=p("option"),re.textContent="Domoticz",he=p("option"),he.textContent="Home-Assistant",be=p("option"),be.textContent="JSON (classic)",x=p("option"),x.textContent="JSON (multi topic)",de=p("option"),de.textContent="JSON (flat)",ve=p("option"),ve.textContent="HEX dump",De=w(),Ee=p("div"),Oe=M(Ae),Ie=p("br"),qe=w(),Fe=p("input"),tt=w(),lt=p("div"),Dt=M(ct),ht=p("br"),_t=w(),at=p("input"),Bt=w(),et=p("div"),We=M(ye),it=w(),Ge=p("span"),Qe=M(Ke),ce=w(),se=p("div"),Ne=p("select"),Ye=p("option"),ot=M(Mt),Je=p("option"),ut=M(Ot),dt=w(),st=p("input"),Pt=w(),St=p("div"),kt=p("div"),bt=p("p"),Ut=M($t),xt=w(),el=p("p"),Jt=M(Xt),il=w(),Xe=p("p"),Tt=M(ft),zt=w(),It=p("div"),wt=p("input"),Gt=w(),nt=p("input"),jt=w(),$e=p("input"),r(l,"class","text-sm"),r(a,"href",bl("mqtt")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","q"),f.value="true",r(C,"name","qh"),r(C,"type","text"),r(C,"class","in-f w-2/3"),r(C,"pattern",Ol),r(R,"name","qp"),r(R,"type","number"),r(R,"min","1024"),r(R,"max","65535"),r(R,"class","in-l tr w-1/3"),r(k,"class","flex"),r(m,"class","my-1"),r(y,"name","qu"),r(y,"type","text"),r(y,"class","in-s"),r(y,"pattern",In),r(L,"class","my-1"),r(Q,"name","qa"),r(Q,"type","password"),r(Q,"class","in-s"),r(Q,"pattern",In),r(W,"class","my-1"),r(ie,"name","qc"),r(ie,"type","text"),r(ie,"class","in-f w-full"),ie.required=_e=t[6].q.h,r(ie,"pattern",Si),j.__value=1,U(j,j.__value),le.__value=2,U(le,le.__value),re.__value=3,U(re,re.__value),he.__value=4,U(he,he.__value),be.__value=0,U(be,be.__value),x.__value=5,U(x,x.__value),de.__value=6,U(de,de.__value),ve.__value=255,U(ve,ve.__value),r(A,"name","qm"),r(A,"class","in-l"),t[6].q.m===void 0&&qt(()=>t[77].call(A)),r(K,"class","my-1 flex"),r(Fe,"name","qb"),r(Fe,"type","text"),r(Fe,"class","in-s"),r(Fe,"pattern",Ol),r(Ee,"class","my-1"),r(at,"name","qr"),r(at,"type","text"),r(at,"class","in-s"),r(at,"pattern",Ol),r(at,"placeholder",vt=t[6].q.b+"/command"),r(lt,"class","my-1"),r(Ge,"class","float-right"),Ye.__value=0,U(Ye,Ye.__value),Je.__value=1,U(Je,Je.__value),r(Ne,"name","qt"),r(Ne,"class","in-f w-1/2"),t[6].q.t===void 0&&qt(()=>t[80].call(Ne)),r(st,"name","qd"),r(st,"type","number"),r(st,"min","1"),r(st,"max","3600"),r(st,"class","in-l tr w-1/2"),st.disabled=Vt=((gt=(Ve=t[6])==null?void 0:Ve.q)==null?void 0:gt.t)!=1,r(se,"class","flex"),r(et,"class","my-1"),r(kt,"class","grid grid-cols-3"),r(wt,"name","qi"),r(wt,"type","number"),r(wt,"min","500"),r(wt,"max","10000"),r(wt,"class","in-f tr w-1/2"),r(nt,"name","qk"),r(nt,"type","number"),r(nt,"min","5"),r(nt,"max","180"),r(nt,"class","in-m tr w-1/2"),r($e,"name","qe"),r($e,"type","number"),r($e,"min","0"),r($e,"max","240"),r($e,"class","in-l tr w-1/2"),r(It,"class","flex"),r(St,"class","my-1"),r(e,"class","cnt")},m(Ve,gt){D(Ve,e,gt),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,v),s(m,b),Le&&Le.m(m,null),s(m,d),s(m,h),s(m,g),s(m,k),s(k,C),U(C,t[6].q.h),s(k,I),s(k,R),U(R,t[6].q.p),s(e,E),Et&&Et.m(e,null),s(e,O),s(e,L),s(L,V),s(L,B),s(L,T),s(L,y),U(y,t[6].q.u),s(e,J),s(e,W),s(W,H),s(W,G),s(W,$),s(W,Q),U(Q,t[6].q.a),s(e,Z),s(e,K),s(K,ee),s(ee,fe),s(ee,ne),s(ee,pe),s(ee,ie),U(ie,t[6].q.c),s(K,oe),s(K,me),s(me,S),s(me,P),s(me,F),s(me,A),s(A,j),s(A,le),s(A,re),s(A,he),s(A,be),s(A,x),s(A,de),s(A,ve),ze(A,t[6].q.m,!0),s(e,De),s(e,Ee),s(Ee,Oe),s(Ee,Ie),s(Ee,qe),s(Ee,Fe),U(Fe,t[6].q.b),s(e,tt),s(e,lt),s(lt,Dt),s(lt,ht),s(lt,_t),s(lt,at),U(at,t[6].q.r),s(e,Bt),s(e,et),s(et,We),s(et,it),s(et,Ge),s(Ge,Qe),s(et,ce),s(et,se),s(se,Ne),s(Ne,Ye),s(Ye,ot),s(Ne,Je),s(Je,ut),ze(Ne,t[6].q.t,!0),s(se,dt),s(se,st),U(st,t[6].q.d),s(e,Pt),s(e,St),s(St,kt),s(kt,bt),s(bt,Ut),s(kt,xt),s(kt,el),s(el,Jt),s(kt,il),s(kt,Xe),s(Xe,Tt),s(St,zt),s(St,It),s(It,wt),U(wt,t[6].q.i),s(It,Gt),s(It,nt),U(nt,t[6].q.k),s(It,jt),s(It,$e),U($e,t[6].q.e),Ct=!0,Ce||(Be=[ue(C,"input",t[72]),ue(R,"input",t[73]),ue(y,"input",t[74]),ue(Q,"input",t[75]),ue(ie,"input",t[76]),ue(A,"change",t[77]),ue(Fe,"input",t[78]),ue(at,"input",t[79]),ue(Ne,"change",t[80]),ue(st,"input",t[81]),ue(wt,"input",t[82]),ue(nt,"input",t[83]),ue($e,"input",t[84])],Ce=!0)},p(Ve,gt){var je,Ft,ol,Ql,Xl,Zl,Jl,$l,xl,en,tn,Nn,Dn,Tn,qn,An,Rn,On,Ln,Fn,yn,Bn,Un,zn,jn,Hn,Wn,Vn,Gn,Kn,Yn,Qn;(!Ct||gt[0]&4)&&n!==(n=(((Ft=(je=Ve[2].conf)==null?void 0:je.mqtt)==null?void 0:Ft.title)??"MQTT")+"")&&q(i,n),(!Ct||gt[0]&4)&&_!==(_=(((Ql=(ol=Ve[2].conf)==null?void 0:ol.mqtt)==null?void 0:Ql.server)??"Server")+"")&&q(v,_),Ve[0].chip!="esp8266"?Le?Le.p(Ve,gt):(Le=Sa(Ve),Le.c(),Le.m(m,d)):Le&&(Le.d(1),Le=null),gt[0]&64&&C.value!==Ve[6].q.h&&U(C,Ve[6].q.h),gt[0]&64&&Ue(R.value)!==Ve[6].q.p&&U(R,Ve[6].q.p),Ve[6].q.s.e?Et?(Et.p(Ve,gt),gt[0]&64&&X(Et,1)):(Et=Ma(Ve),Et.c(),X(Et,1),Et.m(e,O)):Et&&(mt(),te(Et,1,1,()=>{Et=null}),pt()),(!Ct||gt[0]&4)&&z!==(z=(((Zl=(Xl=Ve[2].conf)==null?void 0:Xl.mqtt)==null?void 0:Zl.user)??"Username")+"")&&q(V,z),gt[0]&64&&y.value!==Ve[6].q.u&&U(y,Ve[6].q.u),(!Ct||gt[0]&4)&&Y!==(Y=((($l=(Jl=Ve[2].conf)==null?void 0:Jl.mqtt)==null?void 0:$l.pass)??"Password")+"")&&q(H,Y),gt[0]&64&&Q.value!==Ve[6].q.a&&U(Q,Ve[6].q.a),(!Ct||gt[0]&4)&&ae!==(ae=(((en=(xl=Ve[2].conf)==null?void 0:xl.mqtt)==null?void 0:en.id)??"Client ID")+"")&&q(fe,ae),(!Ct||gt[0]&64&&_e!==(_e=Ve[6].q.h))&&(ie.required=_e),gt[0]&64&&ie.value!==Ve[6].q.c&&U(ie,Ve[6].q.c),(!Ct||gt[0]&4)&&we!==(we=(((Nn=(tn=Ve[2].conf)==null?void 0:tn.mqtt)==null?void 0:Nn.payload)??"Payload")+"")&&q(S,we),gt[0]&64&&ze(A,Ve[6].q.m),(!Ct||gt[0]&4)&&Ae!==(Ae=(((Tn=(Dn=Ve[2].conf)==null?void 0:Dn.mqtt)==null?void 0:Tn.publish)??"Publish topic")+"")&&q(Oe,Ae),gt[0]&64&&Fe.value!==Ve[6].q.b&&U(Fe,Ve[6].q.b),(!Ct||gt[0]&4)&&ct!==(ct=(((An=(qn=Ve[2].conf)==null?void 0:qn.mqtt)==null?void 0:An.subscribe)??"Subscribe topic")+"")&&q(Dt,ct),(!Ct||gt[0]&64&&vt!==(vt=Ve[6].q.b+"/command"))&&r(at,"placeholder",vt),gt[0]&64&&at.value!==Ve[6].q.r&&U(at,Ve[6].q.r),(!Ct||gt[0]&4)&&ye!==(ye=(((On=(Rn=Ve[2].conf)==null?void 0:Rn.mqtt)==null?void 0:On.update)??"Update method")+"")&&q(We,ye),(!Ct||gt[0]&4)&&Ke!==(Ke=(((Fn=(Ln=Ve[2].conf)==null?void 0:Ln.mqtt)==null?void 0:Fn.interval)??"Interval")+"")&&q(Qe,Ke),(!Ct||gt[0]&4)&&Mt!==(Mt=(((Bn=(yn=Ve[2].conf)==null?void 0:yn.mqtt)==null?void 0:Bn.realtime)??"Real time")+"")&&q(ot,Mt),(!Ct||gt[0]&4)&&Ot!==(Ot=(((zn=(Un=Ve[2].conf)==null?void 0:Un.mqtt)==null?void 0:zn.interval)??"Interval")+"")&&q(ut,Ot),gt[0]&64&&ze(Ne,Ve[6].q.t),(!Ct||gt[0]&64&&Vt!==(Vt=((Hn=(jn=Ve[6])==null?void 0:jn.q)==null?void 0:Hn.t)!=1))&&(st.disabled=Vt),gt[0]&64&&Ue(st.value)!==Ve[6].q.d&&U(st,Ve[6].q.d),(!Ct||gt[0]&4)&&$t!==($t=(((Vn=(Wn=Ve[2].conf)==null?void 0:Wn.mqtt)==null?void 0:Vn.timeout)??"Timeout")+"")&&q(Ut,$t),(!Ct||gt[0]&4)&&Xt!==(Xt=(((Kn=(Gn=Ve[2].conf)==null?void 0:Gn.mqtt)==null?void 0:Kn.keepalive)??"Keep-alive")+"")&&q(Jt,Xt),(!Ct||gt[0]&4)&&ft!==(ft=(((Qn=(Yn=Ve[2].conf)==null?void 0:Yn.mqtt)==null?void 0:Qn.autoreboot)??"Auto-reboot")+"")&&q(Tt,ft),gt[0]&64&&Ue(wt.value)!==Ve[6].q.i&&U(wt,Ve[6].q.i),gt[0]&64&&Ue(nt.value)!==Ve[6].q.k&&U(nt,Ve[6].q.k),gt[0]&64&&Ue($e.value)!==Ve[6].q.e&&U($e,Ve[6].q.e)},i(Ve){Ct||(X(Et),Ct=!0)},o(Ve){te(Et),Ct=!1},d(Ve){Ve&&N(e),Le&&Le.d(),Et&&Et.d(),Ce=!1,Wt(Be)}}}function Sa(t){let e,l,n,i,o;return{c(){e=p("label"),l=p("input"),n=M(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",U(l,l.__value),r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){D(a,e,u),s(e,l),l.checked=t[6].q.s.e,s(e,n),i||(o=[ue(l,"change",t[71]),ue(l,"change",t[20])],i=!0)},p(a,u){u[0]&64&&(l.checked=a[6].q.s.e)},d(a){a&&N(e),i=!1,Wt(o)}}}function Ma(t){let e,l,n,i,o,a,u,f,c,m,_,v,b;const d=[Z1,X1],h=[];function g(L,z){return L[6].q.s.c?0:1}n=g(t),i=h[n]=d[n](t);const k=[e_,x1],C=[];function I(L,z){return L[6].q.s.r?0:1}u=I(t),f=C[u]=k[u](t);const R=[i_,n_],E=[];function O(L,z){return L[6].q.s.k?0:1}return _=O(t),v=E[_]=R[_](t),{c(){e=p("div"),l=p("span"),i.c(),o=w(),a=p("span"),f.c(),c=w(),m=p("span"),v.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(m,"class","flex pr-2"),r(e,"class","my-1 flex")},m(L,z){D(L,e,z),s(e,l),h[n].m(l,null),s(e,o),s(e,a),C[u].m(a,null),s(e,c),s(e,m),E[_].m(m,null),b=!0},p(L,z){let V=n;n=g(L),n===V?h[n].p(L,z):(mt(),te(h[V],1,1,()=>{h[V]=null}),pt(),i=h[n],i?i.p(L,z):(i=h[n]=d[n](L),i.c()),X(i,1),i.m(l,null));let B=u;u=I(L),u===B?C[u].p(L,z):(mt(),te(C[B],1,1,()=>{C[B]=null}),pt(),f=C[u],f?f.p(L,z):(f=C[u]=k[u](L),f.c()),X(f,1),f.m(a,null));let T=_;_=O(L),_===T?E[_].p(L,z):(mt(),te(E[T],1,1,()=>{E[T]=null}),pt(),v=E[_],v?v.p(L,z):(v=E[_]=R[_](L),v.c()),X(v,1),v.m(m,null))},i(L){b||(X(i),X(f),X(v),b=!0)},o(L){te(i),te(f),te(v),b=!1},d(L){L&&N(e),h[n].d(),C[u].d(),E[_].d()}}}function X1(t){let e,l;return e=new wl({props:{to:"/mqtt-ca",$$slots:{default:[J1]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Z1(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-ca",$$slots:{default:[$1]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){D(f,e,c),Pe(l,e,null),D(f,n,c),D(f,i,c),o=!0,a||(u=[ue(i,"click",t[17]),ue(i,"keypress",t[17])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){te(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,Wt(u)}}}function J1(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_ca_upload)??"Upload CA",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_ca)??""}}),{c(){Me(e.$$.fragment)},m(u,f){Pe(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_ca_upload)??"Upload CA"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_ca)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){te(e.$$.fragment,u),l=!1},d(u){Se(e,u)}}}function $1(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.ca_ok)??"CA OK")+"",l;return{c(){l=M(e)},m(o,a){D(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.ca_ok)??"CA OK")+"")&&q(l,e)},d(o){o&&N(l)}}}function x1(t){let e,l;return e=new wl({props:{to:"/mqtt-cert",$$slots:{default:[t_]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function e_(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-cert",$$slots:{default:[l_]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){D(f,e,c),Pe(l,e,null),D(f,n,c),D(f,i,c),o=!0,a||(u=[ue(i,"click",t[18]),ue(i,"keypress",t[18])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){te(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,Wt(u)}}}function t_(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_crt_upload)??"Upload cert",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_crt)??""}}),{c(){Me(e.$$.fragment)},m(u,f){Pe(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_crt_upload)??"Upload cert"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_crt)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){te(e.$$.fragment,u),l=!1},d(u){Se(e,u)}}}function l_(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.crt_ok)??"Cert OK")+"",l;return{c(){l=M(e)},m(o,a){D(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.crt_ok)??"Cert OK")+"")&&q(l,e)},d(o){o&&N(l)}}}function n_(t){let e,l;return e=new wl({props:{to:"/mqtt-key",$$slots:{default:[o_]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i[0]&4|i[4]&16777216&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function i_(t){let e,l,n,i,o,a,u;return l=new wl({props:{to:"/mqtt-key",$$slots:{default:[s_]},$$scope:{ctx:t}}}),{c(){e=p("span"),Me(l.$$.fragment),n=w(),i=p("span"),i.textContent="🗑",r(e,"class","bd-on"),r(i,"class","bd-off")},m(f,c){D(f,e,c),Pe(l,e,null),D(f,n,c),D(f,i,c),o=!0,a||(u=[ue(i,"click",t[19]),ue(i,"keypress",t[19])],a=!0)},p(f,c){const m={};c[0]&4|c[4]&16777216&&(m.$$scope={dirty:c,ctx:f}),l.$set(m)},i(f){o||(X(l.$$.fragment,f),o=!0)},o(f){te(l.$$.fragment,f),o=!1},d(f){f&&(N(e),N(n),N(i)),Se(l),a=!1,Wt(u)}}}function o_(t){var n,i,o,a;let e,l;return e=new fn({props:{color:"blue",text:((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.btn_key_upload)??"Upload key",title:((a=(o=t[2].conf)==null?void 0:o.mqtt)==null?void 0:a.title_key)??""}}),{c(){Me(e.$$.fragment)},m(u,f){Pe(e,u,f),l=!0},p(u,f){var m,_,v,b;const c={};f[0]&4&&(c.text=((_=(m=u[2].conf)==null?void 0:m.mqtt)==null?void 0:_.btn_key_upload)??"Upload key"),f[0]&4&&(c.title=((b=(v=u[2].conf)==null?void 0:v.mqtt)==null?void 0:b.title_key)??""),e.$set(c)},i(u){l||(X(e.$$.fragment,u),l=!0)},o(u){te(e.$$.fragment,u),l=!1},d(u){Se(e,u)}}}function s_(t){var n,i;let e=(((i=(n=t[2].conf)==null?void 0:n.mqtt)==null?void 0:i.key_ok)??"Key OK")+"",l;return{c(){l=M(e)},m(o,a){D(o,l,a)},p(o,a){var u,f;a[0]&4&&e!==(e=(((f=(u=o[2].conf)==null?void 0:u.mqtt)==null?void 0:f.key_ok)??"Key OK")+"")&&q(l,e)},d(o){o&&N(l)}}}function Ia(t){var K,ee,ae,fe,ne,pe,ie,_e,oe,me,we,S;let e,l,n=(((ae=(ee=(K=t[2].conf)==null?void 0:K.mqtt)==null?void 0:ee.domoticz)==null?void 0:ae.title)??"Domoticz")+"",i,o,a,u,f,c,m,_,v=(((pe=(ne=(fe=t[2].conf)==null?void 0:fe.mqtt)==null?void 0:ne.domoticz)==null?void 0:pe.eidx)??"Electricity IDX")+"",b,d,h,g,k,C,I=(((oe=(_e=(ie=t[2].conf)==null?void 0:ie.mqtt)==null?void 0:_e.domoticz)==null?void 0:oe.cidx)??"Current IDX")+"",R,E,O,L,z,V,B=(((S=(we=(me=t[2].conf)==null?void 0:me.mqtt)==null?void 0:we.domoticz)==null?void 0:S.vidx)??"Voltage IDX")+"",T,y,J,W,Y,H,G,$,Q,Z;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("div"),b=M(v),d=p("br"),h=w(),g=p("input"),k=w(),C=p("div"),R=M(I),E=p("br"),O=w(),L=p("input"),z=w(),V=p("div"),T=M(B),y=M(`: L1, L2 & L3 + `),J=p("div"),W=p("input"),Y=w(),H=p("input"),G=w(),$=p("input"),r(l,"class","text-sm"),r(a,"href",bl("MQTT-configuration#domoticz")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","o"),f.value="true",r(g,"name","oe"),r(g,"type","text"),r(g,"class","in-f tr w-full"),r(g,"pattern",Xn),r(_,"class","w-1/2"),r(L,"name","oc"),r(L,"type","text"),r(L,"class","in-l tr w-full"),r(L,"pattern",Xn),r(C,"class","w-1/2"),r(m,"class","my-1 flex"),r(W,"name","ou1"),r(W,"type","text"),r(W,"class","in-f tr w-1/3"),r(W,"pattern",Xn),r(H,"name","ou2"),r(H,"type","text"),r(H,"class","in-m tr w-1/3"),r(H,"pattern",Xn),r($,"name","ou3"),r($,"type","text"),r($,"class","in-l tr w-1/3"),r($,"pattern",Xn),r(J,"class","flex"),r(V,"class","my-1"),r(e,"class","cnt")},m(P,F){D(P,e,F),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,b),s(_,d),s(_,h),s(_,g),U(g,t[6].o.e),s(m,k),s(m,C),s(C,R),s(C,E),s(C,O),s(C,L),U(L,t[6].o.c),s(e,z),s(e,V),s(V,T),s(V,y),s(V,J),s(J,W),U(W,t[6].o.u1),s(J,Y),s(J,H),U(H,t[6].o.u2),s(J,G),s(J,$),U($,t[6].o.u3),Q||(Z=[ue(g,"input",t[85]),ue(L,"input",t[86]),ue(W,"input",t[87]),ue(H,"input",t[88]),ue($,"input",t[89])],Q=!0)},p(P,F){var A,j,le,re,he,be,x,de,ve,De,Ee,Ae;F[0]&4&&n!==(n=(((le=(j=(A=P[2].conf)==null?void 0:A.mqtt)==null?void 0:j.domoticz)==null?void 0:le.title)??"Domoticz")+"")&&q(i,n),F[0]&4&&v!==(v=(((be=(he=(re=P[2].conf)==null?void 0:re.mqtt)==null?void 0:he.domoticz)==null?void 0:be.eidx)??"Electricity IDX")+"")&&q(b,v),F[0]&64&&g.value!==P[6].o.e&&U(g,P[6].o.e),F[0]&4&&I!==(I=(((ve=(de=(x=P[2].conf)==null?void 0:x.mqtt)==null?void 0:de.domoticz)==null?void 0:ve.cidx)??"Current IDX")+"")&&q(R,I),F[0]&64&&L.value!==P[6].o.c&&U(L,P[6].o.c),F[0]&4&&B!==(B=(((Ae=(Ee=(De=P[2].conf)==null?void 0:De.mqtt)==null?void 0:Ee.domoticz)==null?void 0:Ae.vidx)??"Voltage IDX")+"")&&q(T,B),F[0]&64&&W.value!==P[6].o.u1&&U(W,P[6].o.u1),F[0]&64&&H.value!==P[6].o.u2&&U(H,P[6].o.u2),F[0]&64&&$.value!==P[6].o.u3&&U($,P[6].o.u3)},d(P){P&&N(e),Q=!1,Wt(Z)}}}function Ea(t){var G,$,Q,Z,K,ee,ae,fe,ne,pe,ie,_e;let e,l,n=(((Q=($=(G=t[2].conf)==null?void 0:G.mqtt)==null?void 0:$.ha)==null?void 0:Q.title)??"Home-Assistant")+"",i,o,a,u,f,c,m,_=(((ee=(K=(Z=t[2].conf)==null?void 0:Z.mqtt)==null?void 0:K.ha)==null?void 0:ee.discovery)??"Discovery topic prefix")+"",v,b,d,h,g,k,C=(((ne=(fe=(ae=t[2].conf)==null?void 0:ae.mqtt)==null?void 0:fe.ha)==null?void 0:ne.hostname)??"Hostname for URL")+"",I,R,E,O,L,z,V,B=(((_e=(ie=(pe=t[2].conf)==null?void 0:pe.mqtt)==null?void 0:ie.ha)==null?void 0:_e.tag)??"Name tag")+"",T,y,J,W,Y,H;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),v=M(_),b=p("br"),d=w(),h=p("input"),g=w(),k=p("div"),I=M(C),R=p("br"),E=w(),O=p("input"),z=w(),V=p("div"),T=M(B),y=p("br"),J=w(),W=p("input"),r(l,"class","text-sm"),r(a,"href",bl("MQTT-configuration#home-assistant")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","h"),f.value="true",r(h,"name","ht"),r(h,"type","text"),r(h,"class","in-s"),r(h,"placeholder","homeassistant"),r(h,"pattern",Ol),r(m,"class","my-1"),r(O,"name","hh"),r(O,"type","text"),r(O,"class","in-s"),r(O,"placeholder",L=t[6].g.h+".local"),r(O,"pattern",Ol),r(k,"class","my-1"),r(W,"name","hn"),r(W,"type","text"),r(W,"class","in-s"),r(W,"pattern",Ol),r(V,"class","my-1"),r(e,"class","cnt")},m(oe,me){D(oe,e,me),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,v),s(m,b),s(m,d),s(m,h),U(h,t[6].h.t),s(e,g),s(e,k),s(k,I),s(k,R),s(k,E),s(k,O),U(O,t[6].h.h),s(e,z),s(e,V),s(V,T),s(V,y),s(V,J),s(V,W),U(W,t[6].h.n),Y||(H=[ue(h,"input",t[90]),ue(O,"input",t[91]),ue(W,"input",t[92])],Y=!0)},p(oe,me){var we,S,P,F,A,j,le,re,he,be,x,de;me[0]&4&&n!==(n=(((P=(S=(we=oe[2].conf)==null?void 0:we.mqtt)==null?void 0:S.ha)==null?void 0:P.title)??"Home-Assistant")+"")&&q(i,n),me[0]&4&&_!==(_=(((j=(A=(F=oe[2].conf)==null?void 0:F.mqtt)==null?void 0:A.ha)==null?void 0:j.discovery)??"Discovery topic prefix")+"")&&q(v,_),me[0]&64&&h.value!==oe[6].h.t&&U(h,oe[6].h.t),me[0]&4&&C!==(C=(((he=(re=(le=oe[2].conf)==null?void 0:le.mqtt)==null?void 0:re.ha)==null?void 0:he.hostname)??"Hostname for URL")+"")&&q(I,C),me[0]&64&&L!==(L=oe[6].g.h+".local")&&r(O,"placeholder",L),me[0]&64&&O.value!==oe[6].h.h&&U(O,oe[6].h.h),me[0]&4&&B!==(B=(((de=(x=(be=oe[2].conf)==null?void 0:be.mqtt)==null?void 0:x.ha)==null?void 0:de.tag)??"Name tag")+"")&&q(T,B),me[0]&64&&W.value!==oe[6].h.n&&U(W,oe[6].h.n)},d(oe){oe&&N(e),Y=!1,Wt(H)}}}function Na(t){var T,y,J,W,Y,H,G,$,Q,Z;let e,l,n=(((y=(T=t[2].conf)==null?void 0:T.cloud)==null?void 0:y.title)??"Cloud connections")+"",i,o,a,u,f,c,m=(W=(J=t[0])==null?void 0:J.features)==null?void 0:W.includes("cloud"),_,v,b,d,h,g=(((H=(Y=t[2].conf)==null?void 0:Y.cloud)==null?void 0:H.es)??"Energy Speedometer")+"",k,C,I,R=($=(G=t[0])==null?void 0:G.features)==null?void 0:$.includes("zc"),E,O,L,z=m&&Da(t),V=((Z=(Q=t[6])==null?void 0:Q.c)==null?void 0:Z.es)&&Ra(t),B=R&&La(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),z&&z.c(),_=w(),v=p("div"),b=p("label"),d=p("input"),h=w(),k=M(g),C=w(),V&&V.c(),I=w(),B&&B.c(),r(l,"class","text-sm"),r(a,"href",bl("cloud-connections")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","c"),f.value="true",r(d,"type","checkbox"),r(d,"class","rounded mb-1"),r(d,"name","ces"),d.__value="true",U(d,d.__value),r(v,"class","my-1"),r(e,"class","cnt")},m(K,ee){D(K,e,ee),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),z&&z.m(e,null),s(e,_),s(e,v),s(v,b),s(b,d),d.checked=t[6].c.es,s(b,h),s(b,k),s(v,C),V&&V.m(v,null),s(e,I),B&&B.m(e,null),E=!0,O||(L=ue(d,"change",t[95]),O=!0)},p(K,ee){var ae,fe,ne,pe,ie,_e,oe,me,we,S;(!E||ee[0]&4)&&n!==(n=(((fe=(ae=K[2].conf)==null?void 0:ae.cloud)==null?void 0:fe.title)??"Cloud connections")+"")&&q(i,n),ee[0]&1&&(m=(pe=(ne=K[0])==null?void 0:ne.features)==null?void 0:pe.includes("cloud")),m?z?z.p(K,ee):(z=Da(K),z.c(),z.m(e,_)):z&&(z.d(1),z=null),ee[0]&64&&(d.checked=K[6].c.es),(!E||ee[0]&4)&&g!==(g=(((_e=(ie=K[2].conf)==null?void 0:ie.cloud)==null?void 0:_e.es)??"Energy Speedometer")+"")&&q(k,g),(me=(oe=K[6])==null?void 0:oe.c)!=null&&me.es?V?(V.p(K,ee),ee[0]&64&&X(V,1)):(V=Ra(K),V.c(),X(V,1),V.m(v,null)):V&&(mt(),te(V,1,1,()=>{V=null}),pt()),ee[0]&1&&(R=(S=(we=K[0])==null?void 0:we.features)==null?void 0:S.includes("zc")),R?B?B.p(K,ee):(B=La(K),B.c(),B.m(e,null)):B&&(B.d(1),B=null)},i(K){E||(X(V),E=!0)},o(K){te(V),E=!1},d(K){K&&N(e),z&&z.d(),V&&V.d(),B&&B.d(),O=!1,L()}}}function Da(t){var _,v;let e,l,n,i,o=(((v=(_=t[2].conf)==null?void 0:_.cloud)==null?void 0:v.ams)??"AMS reader cloud")+"",a,u,f,c,m=t[6].c.e&&Ta(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=w(),a=M(o),u=w(),m&&m.c(),r(n,"type","checkbox"),r(n,"name","ce"),n.__value="true",U(n,n.__value),r(n,"class","rounded mb-1"),r(e,"class","my-1")},m(b,d){D(b,e,d),s(e,l),s(l,n),n.checked=t[6].c.e,s(l,i),s(l,a),s(e,u),m&&m.m(e,null),f||(c=ue(n,"change",t[93]),f=!0)},p(b,d){var h,g;d[0]&64&&(n.checked=b[6].c.e),d[0]&4&&o!==(o=(((g=(h=b[2].conf)==null?void 0:h.cloud)==null?void 0:g.ams)??"AMS reader cloud")+"")&&q(a,o),b[6].c.e?m?m.p(b,d):(m=Ta(b),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},d(b){b&&N(e),m&&m.d(),f=!1,c()}}}function Ta(t){let e,l,n,i,o,a,u,f,c,m,_=t[6].c.p==0&&qa(),v=t[5]&&Aa(t);return{c(){e=p("div"),l=p("label"),l.textContent="Protocol",n=w(),i=p("select"),_&&_.c(),o=p("option"),o.textContent="TCP",a=p("option"),a.textContent="HTTP",u=w(),v&&v.c(),f=Qt(),r(l,"for","cp"),o.__value=1,U(o,o.__value),a.__value=2,U(a,a.__value),r(i,"name","cp"),r(i,"class","in-s"),t[6].c.p===void 0&&qt(()=>t[94].call(i)),r(e,"class","ml-6")},m(b,d){D(b,e,d),s(e,l),s(e,n),s(e,i),_&&_.m(i,null),s(i,o),s(i,a),ze(i,t[6].c.p,!0),D(b,u,d),v&&v.m(b,d),D(b,f,d),c||(m=ue(i,"change",t[94]),c=!0)},p(b,d){b[6].c.p==0?_||(_=qa(),_.c(),_.m(i,o)):_&&(_.d(1),_=null),d[0]&64&&ze(i,b[6].c.p),b[5]?v?v.p(b,d):(v=Aa(b),v.c(),v.m(f.parentNode,f)):v&&(v.d(1),v=null)},d(b){b&&(N(e),N(u),N(f)),_&&_.d(),v&&v.d(b),c=!1,m()}}}function qa(t){let e;return{c(){e=p("option"),e.textContent="UDP",e.__value=0,U(e,e.__value),r(e,"title","No longer recommended")},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function Aa(t){let e,l,n;return{c(){e=p("button"),e.textContent="Connect device to my cloud account",r(e,"type","button"),r(e,"class","text-blue-500 ml-6")},m(i,o){D(i,e,o),l||(n=ue(e,"click",t[23]),l=!0)},p:He,d(i){i&&N(e),l=!1,n()}}}function Ra(t){let e,l,n=t[0].mac+"",i,o,a,u,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,m,_,v,b=t[0].mac&&t[0].meter.id&&Oa(t);return{c(){e=p("div"),l=M("MAC: "),i=M(n),o=w(),a=p("div"),u=M("Meter ID: "),c=M(f),m=w(),b&&b.c(),_=Qt(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,h){D(d,e,h),s(e,l),s(e,i),D(d,o,h),D(d,a,h),s(a,u),s(a,c),D(d,m,h),b&&b.m(d,h),D(d,_,h),v=!0},p(d,h){(!v||h[0]&1)&&n!==(n=d[0].mac+"")&&q(i,n),(!v||h[0]&1)&&f!==(f=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&q(c,f),d[0].mac&&d[0].meter.id?b?(b.p(d,h),h[0]&1&&X(b,1)):(b=Oa(d),b.c(),X(b,1),b.m(_.parentNode,_)):b&&(mt(),te(b,1,1,()=>{b=null}),pt())},i(d){v||(X(b),v=!0)},o(d){te(b),v=!1},d(d){d&&(N(e),N(o),N(a),N(m),N(_)),b&&b.d(d)}}}function Oa(t){let e,l,n;return l=new y1({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=p("div"),Me(l.$$.fragment),r(e,"class","pl-2")},m(i,o){D(i,e,o),Pe(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(X(l.$$.fragment,i),n=!0)},o(i){te(l.$$.fragment,i),n=!1},d(i){i&&N(e),Se(l)}}}function La(t){let e,l,n,i,o,a,u,f,c=t[6].c.ze&&Fa(t);return{c(){e=p("div"),l=p("label"),n=p("input"),i=M(" ZmartCharge"),o=w(),c&&c.c(),a=Qt(),r(n,"type","checkbox"),r(n,"name","cze"),n.__value="true",U(n,n.__value),r(n,"class","rounded mb-1"),r(e,"class","my-1")},m(m,_){D(m,e,_),s(e,l),s(l,n),n.checked=t[6].c.ze,s(l,i),D(m,o,_),c&&c.m(m,_),D(m,a,_),u||(f=ue(n,"change",t[96]),u=!0)},p(m,_){_[0]&64&&(n.checked=m[6].c.ze),m[6].c.ze?c?c.p(m,_):(c=Fa(m),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(m){m&&(N(e),N(o),N(a)),c&&c.d(m),u=!1,f()}}}function Fa(t){let e,l,n,i;return{c(){e=p("div"),l=p("input"),r(l,"name","czt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ZmartCharge token"),r(e,"class","my-1")},m(o,a){D(o,e,a),s(e,l),U(l,t[6].c.zt),n||(i=ue(l,"input",t[97]),n=!0)},p(o,a){a[0]&64&&l.value!==o[6].c.zt&&U(l,o[6].c.zt)},d(o){o&&N(e),n=!1,i()}}}function ya(t){var B,T,y,J,W;let e,l,n=(((T=(B=t[2].conf)==null?void 0:B.thresholds)==null?void 0:T.title)??"Thresholds")+"",i,o,a,u,f,c,m,_,v,b,d=(((J=(y=t[2].conf)==null?void 0:y.thresholds)==null?void 0:J.avg)??"Average of")+"",h,g,k,C,I,R=(((W=t[2].common)==null?void 0:W.hours)??"hours")+"",E,O,L,z=rt({length:9}),V=[];for(let Y=0;Yt[101].call(g)),r(v,"class","w-1/2"),r(m,"class","flex flex-wrap"),r(e,"class","cnt")},m(T,y){D(T,e,y),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m);for(let J=0;J20&&Wa(t),d=((E=(R=(I=t[6])==null?void 0:I.i)==null?void 0:R.d)==null?void 0:E.d)>0&&Ka(t),h=m&&Ya(t),g=t[0].chip=="esp8266"&&Qa(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),b&&b.c(),f=w(),d&&d.c(),c=w(),h&&h.c(),_=w(),g&&g.c(),r(l,"class","text-sm"),r(a,"href",bl("hardware")),r(a,"target","_blank"),r(a,"class","float-right"),r(e,"class","cnt")},m(O,L){D(O,e,L),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),b&&b.m(e,null),s(e,f),d&&d.m(e,null),s(e,c),h&&h.m(e,null),s(e,_),g&&g.m(e,null),v=!0},p(O,L){var z,V,B,T,y;(!v||L[0]&4)&&n!==(n=(((V=(z=O[2].conf)==null?void 0:z.hw)==null?void 0:V.title)??"Hardware")+"")&&q(i,n),O[0].board>20?b?(b.p(O,L),L[0]&1&&X(b,1)):(b=Wa(O),b.c(),X(b,1),b.m(e,f)):b&&(mt(),te(b,1,1,()=>{b=null}),pt()),((y=(T=(B=O[6])==null?void 0:B.i)==null?void 0:T.d)==null?void 0:y.d)>0?d?d.p(O,L):(d=Ka(O),d.c(),d.m(e,c)):d&&(d.d(1),d=null),L[0]&1&&(m=cn(O[0].board)),m?h?h.p(O,L):(h=Ya(O),h.c(),h.m(e,_)):h&&(h.d(1),h=null),O[0].chip=="esp8266"?g?g.p(O,L):(g=Qa(O),g.c(),g.m(e,null)):g&&(g.d(1),g=null)},i(O){v||(X(b),v=!0)},o(O){te(b),v=!1},d(O){O&&N(e),b&&b.d(),d&&d.d(),h&&h.d(),g&&g.d()}}}function Wa(t){var Vt,Pt,St,kt,bt,$t,Ut,xt,el,Xt,Jt,il,Xe,ft,Tt,zt,It,wt,Gt,nt,jt,$e,Ct,Ce,Be,Le,Et,_l,sl,Kt,Yt,ul,Te;let e,l,n,i,o=(((St=(Pt=(Vt=t[2].conf)==null?void 0:Vt.hw)==null?void 0:Pt.han)==null?void 0:St.rx)??"HAN RX")+"",a,u,f,c,m,_,v,b=((($t=(bt=(kt=t[2].conf)==null?void 0:kt.hw)==null?void 0:bt.han)==null?void 0:$t.tx)??"HAN TX")+"",d,h,g,k,C,I,R,E,O,L,z=(((el=(xt=(Ut=t[2].conf)==null?void 0:Ut.hw)==null?void 0:xt.han)==null?void 0:el.pullup)??"pullup")+"",V,B,T,y,J=(((Jt=(Xt=t[2].conf)==null?void 0:Xt.hw)==null?void 0:Jt.ap_btn)??"AP button")+"",W,Y,H,G,$,Q,Z=(((ft=(Xe=(il=t[2].conf)==null?void 0:il.hw)==null?void 0:Xe.led)==null?void 0:ft.title)??"LED")+"",K,ee,ae,fe,ne,pe,ie,_e,oe,me,we=(((It=(zt=(Tt=t[2].conf)==null?void 0:Tt.hw)==null?void 0:zt.led)==null?void 0:It.inverted)??"inverted")+"",S,P,F,A=(((nt=(Gt=(wt=t[2].conf)==null?void 0:wt.hw)==null?void 0:Gt.led)==null?void 0:nt.rgb)??"RGB")+"",j,le,re,he,be=(((Ct=($e=(jt=t[2].conf)==null?void 0:jt.hw)==null?void 0:$e.led)==null?void 0:Ct.inverted)??"inverted")+"",x,de,ve,De,Ee,Ae,Oe,Ie,qe,Fe,tt,lt,ct=(((Le=(Be=(Ce=t[2].conf)==null?void 0:Ce.hw)==null?void 0:Be.led)==null?void 0:Le.disable)??"LED dis. GPIO")+"",Dt,ht,_t,at,vt,Bt=(((_l=(Et=t[2].conf)==null?void 0:Et.hw)==null?void 0:_l.temp)??"Temperature")+"",et,ye,We,it,Ge,Ke,Qe=(((Kt=(sl=t[2].conf)==null?void 0:sl.hw)==null?void 0:Kt.temp_analog)??"Analog temp")+"",ce,se,Ne,Ye,Mt,ot,Je,Ot,ut;m=new lo({props:{chip:t[0].chip}}),C=new lo({props:{chip:t[0].chip}});let dt=t[0].chip!="esp8266"&&Va(t),st=((Te=(ul=(Yt=t[6])==null?void 0:Yt.i)==null?void 0:ul.v)==null?void 0:Te.p)>0&&Ga(t);return{c(){e=p("input"),l=w(),n=p("div"),i=p("div"),a=M(o),u=p("br"),f=w(),c=p("select"),Me(m.$$.fragment),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("select"),Me(C.$$.fragment),I=w(),R=p("div"),E=p("label"),O=p("input"),L=w(),V=M(z),B=w(),T=p("div"),y=p("div"),W=M(J),Y=p("br"),H=w(),G=p("input"),$=w(),Q=p("div"),K=M(Z),ee=p("br"),ae=w(),fe=p("div"),ne=p("input"),pe=w(),ie=p("div"),_e=p("label"),oe=p("input"),me=w(),S=M(we),P=w(),F=p("div"),j=M(A),le=p("label"),re=p("input"),he=w(),x=M(be),de=p("br"),ve=w(),De=p("div"),Ee=p("input"),Ae=w(),Oe=p("input"),Ie=w(),qe=p("input"),Fe=w(),tt=p("div"),lt=p("div"),Dt=M(ct),ht=w(),_t=p("input"),at=w(),vt=p("div"),et=M(Bt),ye=p("br"),We=w(),it=p("input"),Ge=w(),Ke=p("div"),ce=M(Qe),se=p("br"),Ne=w(),Ye=p("input"),Mt=w(),dt&&dt.c(),ot=w(),st&&st.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(c,"name","ihp"),r(c,"class","in-f w-full"),t[6].i.h.p===void 0&&qt(()=>t[102].call(c)),r(i,"class","w-1/3"),r(k,"name","iht"),r(k,"class","in-l w-full"),t[6].i.h.t===void 0&&qt(()=>t[103].call(k)),r(v,"class","w-1/3"),r(O,"name","ihu"),O.__value="true",U(O,O.__value),r(O,"type","checkbox"),r(O,"class","rounded mb-1"),r(E,"class","ml-2"),r(R,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(G,"name","ia"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[12]),r(G,"class","in-f tr w-full"),r(y,"class","w-1/3"),r(ne,"name","ilp"),r(ne,"type","number"),r(ne,"min","0"),r(ne,"max",t[12]),r(ne,"class","in-l tr w-full"),r(fe,"class","flex"),r(Q,"class","w-1/3"),r(oe,"name","ili"),oe.__value="true",U(oe,oe.__value),r(oe,"type","checkbox"),r(oe,"class","rounded mb-1"),r(_e,"class","ml-4"),r(ie,"class","w-1/3"),r(re,"name","iri"),re.__value="true",U(re,re.__value),r(re,"type","checkbox"),r(re,"class","rounded mb-1"),r(le,"class","ml-4"),r(Ee,"name","irr"),r(Ee,"type","number"),r(Ee,"min","0"),r(Ee,"max",t[12]),r(Ee,"class","in-f tr w-1/3"),r(Oe,"name","irg"),r(Oe,"type","number"),r(Oe,"min","0"),r(Oe,"max",t[12]),r(Oe,"class","in-m tr w-1/3"),r(qe,"name","irb"),r(qe,"type","number"),r(qe,"min","0"),r(qe,"max",t[12]),r(qe,"class","in-l tr w-1/3"),r(De,"class","flex"),r(F,"class","w-full"),r(_t,"name","idd"),r(_t,"type","number"),r(_t,"min","0"),r(_t,"max",t[12]),r(_t,"class","in-s tr"),r(lt,"class","my-1 pr-1 w-1/3"),r(tt,"class","w-full"),r(it,"name","itd"),r(it,"type","number"),r(it,"min","0"),r(it,"max",t[12]),r(it,"class","in-f tr w-full"),r(vt,"class","my-1 w-1/3"),r(Ye,"name","ita"),r(Ye,"type","number"),r(Ye,"min","0"),r(Ye,"max",t[12]),r(Ye,"class","in-l tr w-full"),r(Ke,"class","my-1 pr-1 w-1/3"),r(T,"class","flex flex-wrap")},m(ge,Ze){D(ge,e,Ze),D(ge,l,Ze),D(ge,n,Ze),s(n,i),s(i,a),s(i,u),s(i,f),s(i,c),Pe(m,c,null),ze(c,t[6].i.h.p,!0),s(n,_),s(n,v),s(v,d),s(v,h),s(v,g),s(v,k),Pe(C,k,null),ze(k,t[6].i.h.t,!0),s(n,I),s(n,R),s(R,E),s(E,O),O.checked=t[6].i.h.u,s(E,L),s(E,V),D(ge,B,Ze),D(ge,T,Ze),s(T,y),s(y,W),s(y,Y),s(y,H),s(y,G),U(G,t[6].i.a),s(T,$),s(T,Q),s(Q,K),s(Q,ee),s(Q,ae),s(Q,fe),s(fe,ne),U(ne,t[6].i.l.p),s(T,pe),s(T,ie),s(ie,_e),s(_e,oe),oe.checked=t[6].i.l.i,s(_e,me),s(_e,S),s(T,P),s(T,F),s(F,j),s(F,le),s(le,re),re.checked=t[6].i.r.i,s(le,he),s(le,x),s(F,de),s(F,ve),s(F,De),s(De,Ee),U(Ee,t[6].i.r.r),s(De,Ae),s(De,Oe),U(Oe,t[6].i.r.g),s(De,Ie),s(De,qe),U(qe,t[6].i.r.b),s(T,Fe),s(T,tt),s(tt,lt),s(lt,Dt),s(lt,ht),s(lt,_t),U(_t,t[6].i.d.d),s(T,at),s(T,vt),s(vt,et),s(vt,ye),s(vt,We),s(vt,it),U(it,t[6].i.t.d),s(T,Ge),s(T,Ke),s(Ke,ce),s(Ke,se),s(Ke,Ne),s(Ke,Ye),U(Ye,t[6].i.t.a),s(T,Mt),dt&&dt.m(T,null),s(T,ot),st&&st.m(T,null),Je=!0,Ot||(ut=[ue(c,"change",t[102]),ue(k,"change",t[103]),ue(O,"change",t[104]),ue(G,"input",t[105]),ue(ne,"input",t[106]),ue(oe,"change",t[107]),ue(re,"change",t[108]),ue(Ee,"input",t[109]),ue(Oe,"input",t[110]),ue(qe,"input",t[111]),ue(_t,"input",t[112]),ue(it,"input",t[113]),ue(Ye,"input",t[114])],Ot=!0)},p(ge,Ze){var Lt,fl,ml,vl,rl,gl,kl,Ll,Fl,yl,Bl,Ul,zl,jl,Hl,Wl,Vl,Gl,Kl,Yl,Ve,gt,je,Ft,ol,Ql,Xl,Zl,Jl,$l,xl,en,tn;(!Je||Ze[0]&4)&&o!==(o=(((ml=(fl=(Lt=ge[2].conf)==null?void 0:Lt.hw)==null?void 0:fl.han)==null?void 0:ml.rx)??"HAN RX")+"")&&q(a,o);const ke={};Ze[0]&1&&(ke.chip=ge[0].chip),m.$set(ke),Ze[0]&64&&ze(c,ge[6].i.h.p),(!Je||Ze[0]&4)&&b!==(b=(((gl=(rl=(vl=ge[2].conf)==null?void 0:vl.hw)==null?void 0:rl.han)==null?void 0:gl.tx)??"HAN TX")+"")&&q(d,b);const Re={};Ze[0]&1&&(Re.chip=ge[0].chip),C.$set(Re),Ze[0]&64&&ze(k,ge[6].i.h.t),Ze[0]&64&&(O.checked=ge[6].i.h.u),(!Je||Ze[0]&4)&&z!==(z=(((Fl=(Ll=(kl=ge[2].conf)==null?void 0:kl.hw)==null?void 0:Ll.han)==null?void 0:Fl.pullup)??"pullup")+"")&&q(V,z),(!Je||Ze[0]&4)&&J!==(J=(((Bl=(yl=ge[2].conf)==null?void 0:yl.hw)==null?void 0:Bl.ap_btn)??"AP button")+"")&&q(W,J),(!Je||Ze[0]&4096)&&r(G,"max",ge[12]),Ze[0]&64&&Ue(G.value)!==ge[6].i.a&&U(G,ge[6].i.a),(!Je||Ze[0]&4)&&Z!==(Z=(((jl=(zl=(Ul=ge[2].conf)==null?void 0:Ul.hw)==null?void 0:zl.led)==null?void 0:jl.title)??"LED")+"")&&q(K,Z),(!Je||Ze[0]&4096)&&r(ne,"max",ge[12]),Ze[0]&64&&Ue(ne.value)!==ge[6].i.l.p&&U(ne,ge[6].i.l.p),Ze[0]&64&&(oe.checked=ge[6].i.l.i),(!Je||Ze[0]&4)&&we!==(we=(((Vl=(Wl=(Hl=ge[2].conf)==null?void 0:Hl.hw)==null?void 0:Wl.led)==null?void 0:Vl.inverted)??"inverted")+"")&&q(S,we),(!Je||Ze[0]&4)&&A!==(A=(((Yl=(Kl=(Gl=ge[2].conf)==null?void 0:Gl.hw)==null?void 0:Kl.led)==null?void 0:Yl.rgb)??"RGB")+"")&&q(j,A),Ze[0]&64&&(re.checked=ge[6].i.r.i),(!Je||Ze[0]&4)&&be!==(be=(((je=(gt=(Ve=ge[2].conf)==null?void 0:Ve.hw)==null?void 0:gt.led)==null?void 0:je.inverted)??"inverted")+"")&&q(x,be),(!Je||Ze[0]&4096)&&r(Ee,"max",ge[12]),Ze[0]&64&&Ue(Ee.value)!==ge[6].i.r.r&&U(Ee,ge[6].i.r.r),(!Je||Ze[0]&4096)&&r(Oe,"max",ge[12]),Ze[0]&64&&Ue(Oe.value)!==ge[6].i.r.g&&U(Oe,ge[6].i.r.g),(!Je||Ze[0]&4096)&&r(qe,"max",ge[12]),Ze[0]&64&&Ue(qe.value)!==ge[6].i.r.b&&U(qe,ge[6].i.r.b),(!Je||Ze[0]&4)&&ct!==(ct=(((Ql=(ol=(Ft=ge[2].conf)==null?void 0:Ft.hw)==null?void 0:ol.led)==null?void 0:Ql.disable)??"LED dis. GPIO")+"")&&q(Dt,ct),(!Je||Ze[0]&4096)&&r(_t,"max",ge[12]),Ze[0]&64&&Ue(_t.value)!==ge[6].i.d.d&&U(_t,ge[6].i.d.d),(!Je||Ze[0]&4)&&Bt!==(Bt=(((Zl=(Xl=ge[2].conf)==null?void 0:Xl.hw)==null?void 0:Zl.temp)??"Temperature")+"")&&q(et,Bt),(!Je||Ze[0]&4096)&&r(it,"max",ge[12]),Ze[0]&64&&Ue(it.value)!==ge[6].i.t.d&&U(it,ge[6].i.t.d),(!Je||Ze[0]&4)&&Qe!==(Qe=((($l=(Jl=ge[2].conf)==null?void 0:Jl.hw)==null?void 0:$l.temp_analog)??"Analog temp")+"")&&q(ce,Qe),(!Je||Ze[0]&4096)&&r(Ye,"max",ge[12]),Ze[0]&64&&Ue(Ye.value)!==ge[6].i.t.a&&U(Ye,ge[6].i.t.a),ge[0].chip!="esp8266"?dt?dt.p(ge,Ze):(dt=Va(ge),dt.c(),dt.m(T,ot)):dt&&(dt.d(1),dt=null),((tn=(en=(xl=ge[6])==null?void 0:xl.i)==null?void 0:en.v)==null?void 0:tn.p)>0?st?st.p(ge,Ze):(st=Ga(ge),st.c(),st.m(T,null)):st&&(st.d(1),st=null)},i(ge){Je||(X(m.$$.fragment,ge),X(C.$$.fragment,ge),Je=!0)},o(ge){te(m.$$.fragment,ge),te(C.$$.fragment,ge),Je=!1},d(ge){ge&&(N(e),N(l),N(n),N(B),N(T)),Se(m),Se(C),dt&&dt.d(),st&&st.d(),Ot=!1,Wt(ut)}}}function Va(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.title)??"Vcc")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","ivp"),r(a,"type","number"),r(a,"min","0"),r(a,"max",t[12]),r(a,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(v,b){D(v,e,b),s(e,n),s(e,i),s(e,o),s(e,a),U(a,t[6].i.v.p),u||(f=ue(a,"input",t[115]),u=!0)},p(v,b){var d,h,g;b[0]&4&&l!==(l=(((g=(h=(d=v[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.title)??"Vcc")+"")&&q(n,l),b[0]&4096&&r(a,"max",v[12]),b[0]&64&&Ue(a.value)!==v[6].i.v.p&&U(a,v[6].i.v.p)},d(v){v&&N(e),u=!1,f()}}}function Ga(t){var d,h,g;let e,l=(((g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.divider)??"Voltage divider")+"",n,i,o,a,u,f,c,m,_,v,b;return{c(){var k,C,I,R,E,O;e=p("div"),n=M(l),i=p("br"),o=w(),a=p("div"),u=p("input"),c=w(),m=p("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder",f=((I=(C=(k=t[2].conf)==null?void 0:k.hw)==null?void 0:C.vcc)==null?void 0:I.div_vcc)??"VCC"),r(m,"name","ivdg"),r(m,"type","number"),r(m,"min","0"),r(m,"max","65535"),r(m,"class","in-l tr w-full"),r(m,"placeholder",_=((O=(E=(R=t[2].conf)==null?void 0:R.hw)==null?void 0:E.vcc)==null?void 0:O.div_gnd)??"GND"),r(a,"class","flex"),r(e,"class","my-1")},m(k,C){D(k,e,C),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),U(u,t[6].i.v.d.v),s(a,c),s(a,m),U(m,t[6].i.v.d.g),v||(b=[ue(u,"input",t[116]),ue(m,"input",t[117])],v=!0)},p(k,C){var I,R,E,O,L,z,V,B,T;C[0]&4&&l!==(l=(((E=(R=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:R.vcc)==null?void 0:E.divider)??"Voltage divider")+"")&&q(n,l),C[0]&4&&f!==(f=((z=(L=(O=k[2].conf)==null?void 0:O.hw)==null?void 0:L.vcc)==null?void 0:z.div_vcc)??"VCC")&&r(u,"placeholder",f),C[0]&64&&Ue(u.value)!==k[6].i.v.d.v&&U(u,k[6].i.v.d.v),C[0]&4&&_!==(_=((T=(B=(V=k[2].conf)==null?void 0:V.hw)==null?void 0:B.vcc)==null?void 0:T.div_gnd)??"GND")&&r(m,"placeholder",_),C[0]&64&&Ue(m.value)!==k[6].i.v.d.g&&U(m,k[6].i.v.d.g)},d(k){k&&N(e),v=!1,Wt(b)}}}function Ka(t){var d,h,g,k,C,I,R,E,O,L,z,V;let e,l=(((k=(g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.led)==null?void 0:g.behaviour)==null?void 0:k.title)??"LED behaviour")+"",n,i,o,a,u=(((E=(R=(I=(C=t[2].conf)==null?void 0:C.hw)==null?void 0:I.led)==null?void 0:R.behaviour)==null?void 0:E.enabled)??"Enabled")+"",f,c,m=(((V=(z=(L=(O=t[2].conf)==null?void 0:O.hw)==null?void 0:L.led)==null?void 0:z.behaviour)==null?void 0:V.disabled)??"Disabled")+"",_,v,b;return{c(){e=p("div"),n=M(l),i=w(),o=p("select"),a=p("option"),f=M(u),c=p("option"),_=M(m),a.__value=0,U(a,a.__value),c.__value=1,U(c,c.__value),r(o,"name","idb"),r(o,"class","in-s"),t[6].i.d.b===void 0&&qt(()=>t[118].call(o)),r(e,"class","my-1 w-full")},m(B,T){D(B,e,T),s(e,n),s(e,i),s(e,o),s(o,a),s(a,f),s(o,c),s(c,_),ze(o,t[6].i.d.b,!0),v||(b=ue(o,"change",t[118]),v=!0)},p(B,T){var y,J,W,Y,H,G,$,Q,Z,K,ee,ae;T[0]&4&&l!==(l=(((Y=(W=(J=(y=B[2].conf)==null?void 0:y.hw)==null?void 0:J.led)==null?void 0:W.behaviour)==null?void 0:Y.title)??"LED behaviour")+"")&&q(n,l),T[0]&4&&u!==(u=(((Q=($=(G=(H=B[2].conf)==null?void 0:H.hw)==null?void 0:G.led)==null?void 0:$.behaviour)==null?void 0:Q.enabled)??"Enabled")+"")&&q(f,u),T[0]&4&&m!==(m=(((ae=(ee=(K=(Z=B[2].conf)==null?void 0:Z.hw)==null?void 0:K.led)==null?void 0:ee.behaviour)==null?void 0:ae.disabled)??"Disabled")+"")&&q(_,m),T[0]&64&&ze(o,B[6].i.d.b)},d(B){B&&N(e),v=!1,b()}}}function Ya(t){var _,v,b,d,h,g;let e,l,n,i=(((b=(v=(_=t[2].conf)==null?void 0:_.hw)==null?void 0:v.powersaving)==null?void 0:b[0])??"Normal")+"",o,a,u=(((g=(h=(d=t[2].conf)==null?void 0:d.hw)==null?void 0:h.powersaving)==null?void 0:g[3])??"Extreme (Experimental)")+"",f,c,m;return{c(){e=M(`Power saving: + `),l=p("select"),n=p("option"),o=M(i),a=p("option"),f=M(u),n.__value=0,U(n,n.__value),a.__value=3,U(a,a.__value),r(l,"name","ip"),r(l,"class","in-s"),t[6].i.p===void 0&&qt(()=>t[119].call(l))},m(k,C){D(k,e,C),D(k,l,C),s(l,n),s(n,o),s(l,a),s(a,f),ze(l,t[6].i.p,!0),c||(m=ue(l,"change",t[119]),c=!0)},p(k,C){var I,R,E,O,L,z;C[0]&4&&i!==(i=(((E=(R=(I=k[2].conf)==null?void 0:I.hw)==null?void 0:R.powersaving)==null?void 0:E[0])??"Normal")+"")&&q(o,i),C[0]&4&&u!==(u=(((z=(L=(O=k[2].conf)==null?void 0:O.hw)==null?void 0:L.powersaving)==null?void 0:z[3])??"Extreme (Experimental)")+"")&&q(f,u),C[0]&64&&ze(l,k[6].i.p)},d(k){k&&(N(e),N(l)),c=!1,m()}}}function Qa(t){var E,O,L,z,V,B;let e,l,n,i,o=(((L=(O=(E=t[2].conf)==null?void 0:E.hw)==null?void 0:O.vcc)==null?void 0:L.offset)??"Vcc offset")+"",a,u,f,c,m,_,v=(((B=(V=(z=t[2].conf)==null?void 0:z.hw)==null?void 0:V.vcc)==null?void 0:B.multiplier)??"Multiplier")+"",b,d,h,g,k,C,I,R=(t[0].board==2||t[0].board==100)&&Xa(t);return{c(){e=p("input"),l=w(),n=p("div"),i=p("div"),a=M(o),u=p("br"),f=w(),c=p("input"),m=w(),_=p("div"),b=M(v),d=p("br"),h=w(),g=p("input"),k=w(),R&&R.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(g,"name","ivm"),r(g,"type","number"),r(g,"min","0.1"),r(g,"max","10"),r(g,"step","0.01"),r(g,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(T,y){D(T,e,y),D(T,l,y),D(T,n,y),s(n,i),s(i,a),s(i,u),s(i,f),s(i,c),U(c,t[6].i.v.o),s(n,m),s(n,_),s(_,b),s(_,d),s(_,h),s(_,g),U(g,t[6].i.v.m),s(n,k),R&&R.m(n,null),C||(I=[ue(c,"input",t[120]),ue(g,"input",t[121])],C=!0)},p(T,y){var J,W,Y,H,G,$;y[0]&4&&o!==(o=(((Y=(W=(J=T[2].conf)==null?void 0:J.hw)==null?void 0:W.vcc)==null?void 0:Y.offset)??"Vcc offset")+"")&&q(a,o),y[0]&64&&Ue(c.value)!==T[6].i.v.o&&U(c,T[6].i.v.o),y[0]&4&&v!==(v=((($=(G=(H=T[2].conf)==null?void 0:H.hw)==null?void 0:G.vcc)==null?void 0:$.multiplier)??"Multiplier")+"")&&q(b,v),y[0]&64&&Ue(g.value)!==T[6].i.v.m&&U(g,T[6].i.v.m),T[0].board==2||T[0].board==100?R?R.p(T,y):(R=Xa(T),R.c(),R.m(n,null)):R&&(R.d(1),R=null)},d(T){T&&(N(e),N(l),N(n)),R&&R.d(),C=!1,Wt(I)}}}function Xa(t){var c,m,_;let e,l=(((_=(m=(c=t[2].conf)==null?void 0:c.hw)==null?void 0:m.vcc)==null?void 0:_.boot)??"Boot limit")+"",n,i,o,a,u,f;return{c(){e=p("div"),n=M(l),i=p("br"),o=w(),a=p("input"),r(a,"name","ivb"),r(a,"type","number"),r(a,"min","2.5"),r(a,"max","3.5"),r(a,"step","0.1"),r(a,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(v,b){D(v,e,b),s(e,n),s(e,i),s(e,o),s(e,a),U(a,t[6].i.v.b),u||(f=ue(a,"input",t[122]),u=!0)},p(v,b){var d,h,g;b[0]&4&&l!==(l=(((g=(h=(d=v[2].conf)==null?void 0:d.hw)==null?void 0:h.vcc)==null?void 0:g.boot)??"Boot limit")+"")&&q(n,l),b[0]&64&&Ue(a.value)!==v[6].i.v.b&&U(a,v[6].i.v.b)},d(v){v&&N(e),u=!1,f()}}}function Za(t){var R,E,O,L,z,V;let e,l,n=(((E=(R=t[2].conf)==null?void 0:R.debug)==null?void 0:E.title)??"Debugging")+"",i,o,a,u,f,c,m,_,v,b,d=(((L=(O=t[2].conf)==null?void 0:O.debug)==null?void 0:L.enable)??"Enable debugging")+"",h,g,k,C,I=((V=(z=t[6])==null?void 0:z.d)==null?void 0:V.s)&&Ja(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("a"),a.textContent="ⓘ",u=w(),f=p("input"),c=w(),m=p("div"),_=p("label"),v=p("input"),b=w(),h=M(d),g=w(),I&&I.c(),r(l,"class","text-sm"),r(a,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","d"),f.value="true",r(v,"type","checkbox"),r(v,"name","ds"),v.__value="true",U(v,v.__value),r(v,"class","rounded mb-1"),r(m,"class","mt-3"),r(e,"class","cnt")},m(B,T){D(B,e,T),s(e,l),s(l,i),s(e,o),s(e,a),s(e,u),s(e,f),s(e,c),s(e,m),s(m,_),s(_,v),v.checked=t[6].d.s,s(_,b),s(_,h),s(e,g),I&&I.m(e,null),k||(C=ue(v,"change",t[123]),k=!0)},p(B,T){var y,J,W,Y,H,G;T[0]&4&&n!==(n=(((J=(y=B[2].conf)==null?void 0:y.debug)==null?void 0:J.title)??"Debugging")+"")&&q(i,n),T[0]&64&&(v.checked=B[6].d.s),T[0]&4&&d!==(d=(((Y=(W=B[2].conf)==null?void 0:W.debug)==null?void 0:Y.enable)??"Enable debugging")+"")&&q(h,d),(G=(H=B[6])==null?void 0:H.d)!=null&&G.s?I?I.p(B,T):(I=Ja(B),I.c(),I.m(e,null)):I&&(I.d(1),I=null)},d(B){B&&N(e),I&&I.d(),k=!1,C()}}}function Ja(t){var O,L,z,V;let e,l=(((L=(O=t[2].conf)==null?void 0:O.debug)==null?void 0:L.danger)??"Disable when done")+"",n,i,o,a,u,f,c=(((V=(z=t[2].conf)==null?void 0:z.debug)==null?void 0:V.telnet)??"Enable telnet")+"",m,_,v,b,d,h,g,k,C,I,R,E=t[6].d.t&&$a(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("div"),a=p("label"),u=p("input"),f=w(),m=M(c),_=w(),E&&E.c(),v=w(),b=p("div"),d=p("select"),h=p("option"),h.textContent="Verbose",g=p("option"),g.textContent="Debug",k=p("option"),k.textContent="Info",C=p("option"),C.textContent="Warning",r(e,"class","bd-red"),r(u,"type","checkbox"),r(u,"name","dt"),u.__value="true",U(u,u.__value),r(u,"class","rounded mb-1"),r(o,"class","my-1"),h.__value=1,U(h,h.__value),g.__value=2,U(g,g.__value),k.__value=3,U(k,k.__value),C.__value=4,U(C,C.__value),r(d,"name","dl"),r(d,"class","in-s"),t[6].d.l===void 0&&qt(()=>t[125].call(d)),r(b,"class","my-1")},m(B,T){D(B,e,T),s(e,n),D(B,i,T),D(B,o,T),s(o,a),s(a,u),u.checked=t[6].d.t,s(a,f),s(a,m),D(B,_,T),E&&E.m(B,T),D(B,v,T),D(B,b,T),s(b,d),s(d,h),s(d,g),s(d,k),s(d,C),ze(d,t[6].d.l,!0),I||(R=[ue(u,"change",t[124]),ue(d,"change",t[125])],I=!0)},p(B,T){var y,J,W,Y;T[0]&4&&l!==(l=(((J=(y=B[2].conf)==null?void 0:y.debug)==null?void 0:J.danger)??"Disable when done")+"")&&q(n,l),T[0]&64&&(u.checked=B[6].d.t),T[0]&4&&c!==(c=(((Y=(W=B[2].conf)==null?void 0:W.debug)==null?void 0:Y.telnet)??"Enable telnet")+"")&&q(m,c),B[6].d.t?E?E.p(B,T):(E=$a(B),E.c(),E.m(v.parentNode,v)):E&&(E.d(1),E=null),T[0]&64&&ze(d,B[6].d.l)},d(B){B&&(N(e),N(i),N(o),N(_),N(v),N(b)),E&&E.d(B),I=!1,Wt(R)}}}function $a(t){var i,o;let e,l=(((o=(i=t[2].conf)==null?void 0:i.debug)==null?void 0:o.telnet_danger)??"Disable when done")+"",n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(a,u){D(a,e,u),s(e,n)},p(a,u){var f,c;u[0]&4&&l!==(l=(((c=(f=a[2].conf)==null?void 0:f.debug)==null?void 0:c.telnet_danger)??"Disable when done")+"")&&q(n,l)},d(a){a&&N(e)}}}function xa(t){var v,b;let e,l,n=(((v=t[2].conf)==null?void 0:v.btn_reset)??"Factory reset")+"",i,o,a,u,f=(((b=t[2].btn)==null?void 0:b.reboot)??"Reboot")+"",c,m,_;return{c(){e=p("div"),l=p("button"),i=M(n),o=w(),a=p("div"),u=p("button"),c=M(f),r(l,"type","button"),r(l,"class","btn-red"),r(u,"type","button"),r(u,"class","btn-yellow"),r(a,"class","text-center")},m(d,h){D(d,e,h),s(e,l),s(l,i),D(d,o,h),D(d,a,h),s(a,u),s(u,c),m||(_=[ue(l,"click",t[14]),ue(u,"click",t[16])],m=!0)},p(d,h){var g,k;h[0]&4&&n!==(n=(((g=d[2].conf)==null?void 0:g.btn_reset)??"Factory reset")+"")&&q(i,n),h[0]&4&&f!==(f=(((k=d[2].btn)==null?void 0:k.reboot)??"Reboot")+"")&&q(c,f)},d(d){d&&(N(e),N(o),N(a)),m=!1,Wt(_)}}}function ef(t){var o;let e,l,n=(((o=t[2].btn)==null?void 0:o.save)??"Save")+"",i;return{c(){e=p("div"),l=p("button"),i=M(n),r(l,"type","submit"),r(l,"class","btn-pri"),r(e,"class","text-right")},m(a,u){D(a,e,u),s(e,l),s(l,i)},p(a,u){var f;u[0]&4&&n!==(n=(((f=a[2].btn)==null?void 0:f.save)??"Save")+"")&&q(i,n)},d(a){a&&N(e)}}}function a_(t){var _e,oe,me,we,S,P,F,A,j,le,re,he,be,x,de,ve,De,Ee,Ae,Oe,Ie,qe,Fe,tt,lt,ct,Dt,ht,_t,at,vt,Bt,et,ye,We,it,Ge,Ke,Qe;let e,l,n,i,o,a,u,f,c,m,_=((me=(oe=(_e=t[6])==null?void 0:_e.p)==null?void 0:oe.r)==null?void 0:me.startsWith("NO"))||((P=(S=(we=t[6])==null?void 0:we.p)==null?void 0:S.r)==null?void 0:P.startsWith("10YNO"))||((j=(A=(F=t[6])==null?void 0:F.p)==null?void 0:A.r)==null?void 0:j.startsWith("10Y1001A1001A4")),v,b,d,h=((le=t[6])==null?void 0:le.d)&&((he=(re=t[0])==null?void 0:re.features)==null?void 0:he.includes("rdebug")),g,k,C,I,R,E,O,L,z,V,B,T,y,J,W=((be=t[6])==null?void 0:be.g)&&sa(t),Y=((x=t[6])==null?void 0:x.m)&&ua(t),H=((de=t[6])==null?void 0:de.w)&&da(t),G=((ve=t[6])==null?void 0:ve.n)&&wa(t),$=((De=t[6])==null?void 0:De.q)&&Pa(t),Q=((Ae=(Ee=t[6])==null?void 0:Ee.q)==null?void 0:Ae.m)==3&&Ia(t),Z=((Ie=(Oe=t[6])==null?void 0:Oe.q)==null?void 0:Ie.m)==4&&Ea(t),K=((qe=t[6])==null?void 0:qe.c)&&Na(t),ee=_&&ya(t),ae=((Fe=t[6])==null?void 0:Fe.u)&&Ua(t),fe=((lt=(tt=t[6])==null?void 0:tt.i)==null?void 0:lt.h)&&(((ct=t[0])==null?void 0:ct.board)>20||((Dt=t[0])==null?void 0:Dt.chip)=="esp8266"||((at=(_t=(ht=t[6])==null?void 0:ht.i)==null?void 0:_t.d)==null?void 0:at.d)>0)&&Ha(t),ne=h&&Za(t),pe=((vt=t[1])==null?void 0:vt.a)&&xa(t),ie=t[6]&&ef(t);return R=new dl({props:{active:t[3],message:((et=(Bt=t[2].conf)==null?void 0:Bt.mask)==null?void 0:et.loading)??"Loading"}}),O=new dl({props:{active:t[4],message:((We=(ye=t[2].conf)==null?void 0:ye.mask)==null?void 0:We.saving)??"Saving"}}),z=new dl({props:{active:t[10],message:((Ge=(it=t[2].conf)==null?void 0:it.mask)==null?void 0:Ge.reset)??"Factory reset"}}),B=new dl({props:{active:t[11],message:((Qe=(Ke=t[2].conf)==null?void 0:Ke.mask)==null?void 0:Qe.reset_done)??"Done"}}),{c(){e=p("form"),l=p("div"),W&&W.c(),n=w(),Y&&Y.c(),i=w(),H&&H.c(),o=w(),G&&G.c(),a=w(),$&&$.c(),u=w(),Q&&Q.c(),f=w(),Z&&Z.c(),c=w(),K&&K.c(),m=w(),ee&&ee.c(),v=w(),ae&&ae.c(),b=w(),fe&&fe.c(),d=w(),ne&&ne.c(),g=w(),k=p("div"),pe&&pe.c(),C=w(),ie&&ie.c(),I=w(),Me(R.$$.fragment),E=w(),Me(O.$$.fragment),L=w(),Me(z.$$.fragment),V=w(),Me(B.$$.fragment),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(k,"class","grid grid-cols-3 mt-3"),r(e,"autocomplete","off")},m(ce,se){D(ce,e,se),s(e,l),W&&W.m(l,null),s(l,n),Y&&Y.m(l,null),s(l,i),H&&H.m(l,null),s(l,o),G&&G.m(l,null),s(l,a),$&&$.m(l,null),s(l,u),Q&&Q.m(l,null),s(l,f),Z&&Z.m(l,null),s(l,c),K&&K.m(l,null),s(l,m),ee&&ee.m(l,null),s(l,v),ae&&ae.m(l,null),s(l,b),fe&&fe.m(l,null),s(l,d),ne&&ne.m(l,null),s(e,g),s(e,k),pe&&pe.m(k,null),s(k,C),ie&&ie.m(k,null),D(ce,I,se),Pe(R,ce,se),D(ce,E,se),Pe(O,ce,se),D(ce,L,se),Pe(z,ce,se),D(ce,V,se),Pe(B,ce,se),T=!0,y||(J=ue(e,"submit",dn(t[15])),y=!0)},p(ce,se){var Je,Ot,ut,dt,st,Vt,Pt,St,kt,bt,$t,Ut,xt,el,Xt,Jt,il,Xe,ft,Tt,zt,It,wt,Gt,nt,jt,$e,Ct,Ce,Be,Le,Et,_l,sl,Kt,Yt,ul,Te,ge;(Je=ce[6])!=null&&Je.g?W?(W.p(ce,se),se[0]&64&&X(W,1)):(W=sa(ce),W.c(),X(W,1),W.m(l,n)):W&&(mt(),te(W,1,1,()=>{W=null}),pt()),(Ot=ce[6])!=null&&Ot.m?Y?Y.p(ce,se):(Y=ua(ce),Y.c(),Y.m(l,i)):Y&&(Y.d(1),Y=null),(ut=ce[6])!=null&&ut.w?H?H.p(ce,se):(H=da(ce),H.c(),H.m(l,o)):H&&(H.d(1),H=null),(dt=ce[6])!=null&&dt.n?G?(G.p(ce,se),se[0]&64&&X(G,1)):(G=wa(ce),G.c(),X(G,1),G.m(l,a)):G&&(mt(),te(G,1,1,()=>{G=null}),pt()),(st=ce[6])!=null&&st.q?$?($.p(ce,se),se[0]&64&&X($,1)):($=Pa(ce),$.c(),X($,1),$.m(l,u)):$&&(mt(),te($,1,1,()=>{$=null}),pt()),((Pt=(Vt=ce[6])==null?void 0:Vt.q)==null?void 0:Pt.m)==3?Q?Q.p(ce,se):(Q=Ia(ce),Q.c(),Q.m(l,f)):Q&&(Q.d(1),Q=null),((kt=(St=ce[6])==null?void 0:St.q)==null?void 0:kt.m)==4?Z?Z.p(ce,se):(Z=Ea(ce),Z.c(),Z.m(l,c)):Z&&(Z.d(1),Z=null),(bt=ce[6])!=null&&bt.c?K?(K.p(ce,se),se[0]&64&&X(K,1)):(K=Na(ce),K.c(),X(K,1),K.m(l,m)):K&&(mt(),te(K,1,1,()=>{K=null}),pt()),se[0]&64&&(_=((xt=(Ut=($t=ce[6])==null?void 0:$t.p)==null?void 0:Ut.r)==null?void 0:xt.startsWith("NO"))||((Jt=(Xt=(el=ce[6])==null?void 0:el.p)==null?void 0:Xt.r)==null?void 0:Jt.startsWith("10YNO"))||((ft=(Xe=(il=ce[6])==null?void 0:il.p)==null?void 0:Xe.r)==null?void 0:ft.startsWith("10Y1001A1001A4"))),_?ee?ee.p(ce,se):(ee=ya(ce),ee.c(),ee.m(l,v)):ee&&(ee.d(1),ee=null),(Tt=ce[6])!=null&&Tt.u?ae?ae.p(ce,se):(ae=Ua(ce),ae.c(),ae.m(l,b)):ae&&(ae.d(1),ae=null),(It=(zt=ce[6])==null?void 0:zt.i)!=null&&It.h&&(((wt=ce[0])==null?void 0:wt.board)>20||((Gt=ce[0])==null?void 0:Gt.chip)=="esp8266"||(($e=(jt=(nt=ce[6])==null?void 0:nt.i)==null?void 0:jt.d)==null?void 0:$e.d)>0)?fe?(fe.p(ce,se),se[0]&65&&X(fe,1)):(fe=Ha(ce),fe.c(),X(fe,1),fe.m(l,d)):fe&&(mt(),te(fe,1,1,()=>{fe=null}),pt()),se[0]&65&&(h=((Ct=ce[6])==null?void 0:Ct.d)&&((Be=(Ce=ce[0])==null?void 0:Ce.features)==null?void 0:Be.includes("rdebug"))),h?ne?ne.p(ce,se):(ne=Za(ce),ne.c(),ne.m(l,null)):ne&&(ne.d(1),ne=null),(Le=ce[1])!=null&&Le.a?pe?pe.p(ce,se):(pe=xa(ce),pe.c(),pe.m(k,C)):pe&&(pe.d(1),pe=null),ce[6]?ie?ie.p(ce,se):(ie=ef(ce),ie.c(),ie.m(k,null)):ie&&(ie.d(1),ie=null);const Ne={};se[0]&8&&(Ne.active=ce[3]),se[0]&4&&(Ne.message=((_l=(Et=ce[2].conf)==null?void 0:Et.mask)==null?void 0:_l.loading)??"Loading"),R.$set(Ne);const Ye={};se[0]&16&&(Ye.active=ce[4]),se[0]&4&&(Ye.message=((Kt=(sl=ce[2].conf)==null?void 0:sl.mask)==null?void 0:Kt.saving)??"Saving"),O.$set(Ye);const Mt={};se[0]&1024&&(Mt.active=ce[10]),se[0]&4&&(Mt.message=((ul=(Yt=ce[2].conf)==null?void 0:Yt.mask)==null?void 0:ul.reset)??"Factory reset"),z.$set(Mt);const ot={};se[0]&2048&&(ot.active=ce[11]),se[0]&4&&(ot.message=((ge=(Te=ce[2].conf)==null?void 0:Te.mask)==null?void 0:ge.reset_done)??"Done"),B.$set(ot)},i(ce){T||(X(W),X(G),X($),X(K),X(fe),X(R.$$.fragment,ce),X(O.$$.fragment,ce),X(z.$$.fragment,ce),X(B.$$.fragment,ce),T=!0)},o(ce){te(W),te(G),te($),te(K),te(fe),te(R.$$.fragment,ce),te(O.$$.fragment,ce),te(z.$$.fragment,ce),te(B.$$.fragment,ce),T=!1},d(ce){ce&&(N(e),N(I),N(E),N(L),N(V)),W&&W.d(),Y&&Y.d(),H&&H.d(),G&&G.d(),$&&$.d(),Q&&Q.d(),Z&&Z.d(),K&&K.d(),ee&&ee.d(),ae&&ae.d(),fe&&fe.d(),ne&&ne.d(),pe&&pe.d(),ie&&ie.d(),Se(R,ce),Se(O,ce),Se(z,ce),Se(B,ce),y=!1,J()}}}async function f_(){await(await fetch("reboot",{method:"POST"})).json()}function r_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,{data:o}=e,a={};Il.subscribe(Re=>{l(2,a=Re)});let u=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],f=!0,c=!1,m=!1,_,v=[];Jn.subscribe(Re=>{var Lt,fl,ml;Re.version&&(l(5,m=(Lt=Re==null?void 0:Re.c)==null?void 0:Lt.e),l(6,_=Re),l(3,f=!1),l(7,v=[{code:"en",name:"English"}]),(fl=_==null?void 0:_.u)!=null&&fl.lang&&_.u.lang!="en"&&v.push({code:_.u.lang,name:((ml=a.language)==null?void 0:ml.name)??"Unknown"}),v.push({code:"hub",name:"Load from server"}))}),P1();let b=!0,d={};mo.subscribe(Re=>{var Lt;l(8,b=!0);for(let fl=0;fl(rl.hostname=Lt.get("gh"),rl.usrcfg=vl.success,rl.booting=vl.reboot,Lt.get("nm")=="static"&&(rl.net.ip=Lt.get("ni"),rl.net.mask=Lt.get("nu"),rl.net.gw=Lt.get("ng"),rl.net.dns1=Lt.get("nd")),rl.ui=_.u,rl)),l(4,c=!1),nn(n)}const I=function(){confirm("Reboot?")&&(hl.update(Re=>(Re.booting=!0,Re)),f_())};async function R(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),Jn.update(Lt=>(Lt.q.s.c=!1,Lt)))}async function E(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),Jn.update(Lt=>(Lt.q.s.r=!1,Lt)))}async function O(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),Jn.update(Lt=>(Lt.q.s.k=!1,Lt)))}const L=function(){_.q.s.e?_.q.p==1883&&l(6,_.q.p=8883,_):_.q.p==8883&&l(6,_.q.p=1883,_)};async function z(){if(_.u.lang=="hub"){const Re=await Cl("http://hub.amsleser.no/hub/language/list.json");l(7,v=await Re.json()),l(6,_.u.lang=a.language.code,_)}}async function V(){l(6,_.p.e=!0,_)}let B=44;async function T(){const Re=await Cl("cloudkey.json");if(Re.status==200){let Lt=await Re.json();window.open("https://www.amsleser.cloud/device/"+Lt.seed)}else alert("Not able to bind to cloud")}const y=window||global;y.bindToCloud=function(){console.log("BIND CALLED")};function J(){_.g.h=this.value,l(6,_)}function W(){_.g.t=Zt(this),l(6,_)}function Y(){_.p.r=Zt(this),l(6,_)}function H(){_.p.m=Zt(this),l(6,_)}function G(){_.p.c=Zt(this),l(6,_)}function $(){_.p.e=this.checked,l(6,_)}function Q(){_.p.t=this.value,l(6,_)}function Z(){_.g.s=Zt(this),l(6,_)}function K(){_.g.u=this.value,l(6,_)}function ee(){_.g.p=this.value,l(6,_)}function ae(){_.g.c=this.value,l(6,_)}function fe(){_.m.a=Zt(this),l(6,_)}function ne(){_.m.b=Ue(this.value),l(6,_)}function pe(){_.m.i=this.checked,l(6,_)}function ie(){_.m.b=Zt(this),l(6,_)}function _e(){_.m.p=Zt(this),l(6,_)}function oe(){_.m.s=Ue(this.value),l(6,_)}function me(){_.m.d=Zt(this),l(6,_)}function we(){_.m.f=Ue(this.value),l(6,_)}function S(){_.m.r=Ue(this.value),l(6,_)}function P(){_.m.e.e=this.checked,l(6,_)}function F(){_.m.e.k=this.value,l(6,_)}function A(){_.m.e.a=this.value,l(6,_)}function j(){_.m.m.e=this.checked,l(6,_)}function le(){_.m.m.w=Ue(this.value),l(6,_)}function re(){_.m.m.v=Ue(this.value),l(6,_)}function he(){_.m.m.a=Ue(this.value),l(6,_)}function be(){_.m.m.c=Ue(this.value),l(6,_)}function x(){_.n.c=Zt(this),l(6,_)}function de(){b=this.checked,l(8,b)}function ve(){_.w.s=this.value,l(6,_)}function De(){_.w.s=Zt(this),l(6,_)}function Ee(){_.w.p=this.value,l(6,_)}function Ae(){_.w.z=Zt(this),l(6,_)}function Oe(){_.w.w=Ue(this.value),l(6,_)}function Ie(){_.w.b=this.checked,l(6,_)}function qe(){_.n.m=Zt(this),l(6,_)}function Fe(){_.n.i=this.value,l(6,_)}function tt(){_.n.s=Zt(this),l(6,_)}function lt(){_.n.g=this.value,l(6,_)}function ct(){_.n.d1=this.value,l(6,_)}function Dt(){_.n.d2=this.value,l(6,_)}function ht(){_.n.x=this.checked,l(6,_)}function _t(){_.n.d=this.checked,l(6,_)}function at(){_.n.h=this.checked,l(6,_)}function vt(){_.n.n1=this.value,l(6,_)}function Bt(){_.q.s.e=this.checked,l(6,_)}function et(){_.q.h=this.value,l(6,_)}function ye(){_.q.p=Ue(this.value),l(6,_)}function We(){_.q.u=this.value,l(6,_)}function it(){_.q.a=this.value,l(6,_)}function Ge(){_.q.c=this.value,l(6,_)}function Ke(){_.q.m=Zt(this),l(6,_)}function Qe(){_.q.b=this.value,l(6,_)}function ce(){_.q.r=this.value,l(6,_)}function se(){_.q.t=Zt(this),l(6,_)}function Ne(){_.q.d=Ue(this.value),l(6,_)}function Ye(){_.q.i=Ue(this.value),l(6,_)}function Mt(){_.q.k=Ue(this.value),l(6,_)}function ot(){_.q.e=Ue(this.value),l(6,_)}function Je(){_.o.e=this.value,l(6,_)}function Ot(){_.o.c=this.value,l(6,_)}function ut(){_.o.u1=this.value,l(6,_)}function dt(){_.o.u2=this.value,l(6,_)}function st(){_.o.u3=this.value,l(6,_)}function Vt(){_.h.t=this.value,l(6,_)}function Pt(){_.h.h=this.value,l(6,_)}function St(){_.h.n=this.value,l(6,_)}function kt(){_.c.e=this.checked,l(6,_)}function bt(){_.c.p=Zt(this),l(6,_)}function $t(){_.c.es=this.checked,l(6,_)}function Ut(){_.c.ze=this.checked,l(6,_)}function xt(){_.c.zt=this.value,l(6,_)}function el(Re){_.t.t[Re]=Ue(this.value),l(6,_)}function Xt(){_.t.h=Ue(this.value),l(6,_)}function Jt(Re){_.u[Re.key]=Zt(this),l(6,_)}function il(){_.u.lang=Zt(this),l(6,_)}function Xe(){_.i.h.p=Zt(this),l(6,_)}function ft(){_.i.h.t=Zt(this),l(6,_)}function Tt(){_.i.h.u=this.checked,l(6,_)}function zt(){_.i.a=Ue(this.value),l(6,_)}function It(){_.i.l.p=Ue(this.value),l(6,_)}function wt(){_.i.l.i=this.checked,l(6,_)}function Gt(){_.i.r.i=this.checked,l(6,_)}function nt(){_.i.r.r=Ue(this.value),l(6,_)}function jt(){_.i.r.g=Ue(this.value),l(6,_)}function $e(){_.i.r.b=Ue(this.value),l(6,_)}function Ct(){_.i.d.d=Ue(this.value),l(6,_)}function Ce(){_.i.t.d=Ue(this.value),l(6,_)}function Be(){_.i.t.a=Ue(this.value),l(6,_)}function Le(){_.i.v.p=Ue(this.value),l(6,_)}function Et(){_.i.v.d.v=Ue(this.value),l(6,_)}function _l(){_.i.v.d.g=Ue(this.value),l(6,_)}function sl(){_.i.d.b=Zt(this),l(6,_)}function Kt(){_.i.p=Zt(this),l(6,_)}function Yt(){_.i.v.o=Ue(this.value),l(6,_)}function ul(){_.i.v.m=Ue(this.value),l(6,_)}function Te(){_.i.v.b=Ue(this.value),l(6,_)}function ge(){_.d.s=this.checked,l(6,_)}function Ze(){_.d.t=this.checked,l(6,_)}function ke(){_.d.l=Zt(this),l(6,_)}return t.$$set=Re=>{"basepath"in Re&&l(24,n=Re.basepath),"sysinfo"in Re&&l(0,i=Re.sysinfo),"data"in Re&&l(1,o=Re.data)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(12,B=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,o,a,f,c,m,_,v,b,d,h,g,B,u,k,C,I,R,E,O,L,z,V,T,n,J,W,Y,H,G,$,Q,Z,K,ee,ae,fe,ne,pe,ie,_e,oe,me,we,S,P,F,A,j,le,re,he,be,x,de,ve,De,Ee,Ae,Oe,Ie,qe,Fe,tt,lt,ct,Dt,ht,_t,at,vt,Bt,et,ye,We,it,Ge,Ke,Qe,ce,se,Ne,Ye,Mt,ot,Je,Ot,ut,dt,st,Vt,Pt,St,kt,bt,$t,Ut,xt,el,Xt,Jt,il,Xe,ft,Tt,zt,It,wt,Gt,nt,jt,$e,Ct,Ce,Be,Le,Et,_l,sl,Kt,Yt,ul,Te,ge,Ze,ke]}class u_ extends Rt{constructor(e){super(),At(this,e,r_,a_,Nt,{basepath:24,sysinfo:0,data:1},null,[-1,-1,-1,-1,-1])}}var fu={exports:{}};(function(t){(function(e){const l="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${l}\\.${l}\\.${l}\\.${l}$`,"i"),threeOctet:new RegExp(`^${l}\\.${l}\\.${l}$`,"i"),twoOctet:new RegExp(`^${l}\\.${l}$`,"i"),longValue:new RegExp(`^${l}$`,"i")},i=new RegExp("^0[0-7]+$","i"),o=new RegExp("^0x[a-f0-9]+$","i"),a="%[0-9a-z]{1,}",u="(?:[0-9a-f]+::?)+",f={zoneIndex:new RegExp(a,"i"),native:new RegExp(`^(::)?(${u})?([0-9a-f]+)?(::)?(${a})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${l}\\.${l}\\.${l}\\.${l}(${a})?)$`,"i"),transitional:new RegExp(`^((?:${u})|(?:::)(?:${u})?)${l}\\.${l}\\.${l}\\.${l}(${a})?$`,"i")};function c(d,h){if(d.indexOf("::")!==d.lastIndexOf("::"))return null;let g=0,k=-1,C=(d.match(f.zoneIndex)||[])[0],I,R;for(C&&(C=C.substring(1),d=d.replace(/%.+$/,""));(k=d.indexOf(":",k+1))>=0;)g++;if(d.substr(0,2)==="::"&&g--,d.substr(-2,2)==="::"&&g--,g>h)return null;for(R=h-g,I=":";R--;)I+="0:";return d=d.replace("::",I),d[0]===":"&&(d=d.slice(1)),d[d.length-1]===":"&&(d=d.slice(0,-1)),h=function(){const E=d.split(":"),O=[];for(let L=0;L0;){if(I=g-k,I<0&&(I=0),d[C]>>I!==h[C]>>I)return!1;k-=g,C+=1}return!0}function _(d){if(o.test(d))return parseInt(d,16);if(d[0]==="0"&&!isNaN(parseInt(d[1],10))){if(i.test(d))return parseInt(d,8);throw new Error(`ipaddr: cannot parse ${d} as octal`)}return parseInt(d,10)}function v(d,h){for(;d.length=0;C-=1)if(I=this.octets[C],I in k){if(R=k[I],g&&R!==0)return null;R!==8&&(g=!0),h+=R}else return null;return 32-h},d.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){return this.octets.slice(0)},d.prototype.toIPv4MappedAddress=function(){return b.IPv6.parse(`::ffff:${this.toString()}`)},d.prototype.toNormalizedString=function(){return this.toString()},d.prototype.toString=function(){return this.octets.join(".")},d}(),b.IPv4.broadcastAddressFromCIDR=function(d){try{const h=this.parseCIDR(d),g=h[0].toByteArray(),k=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[];let I=0;for(;I<4;)C.push(parseInt(g[I],10)|parseInt(k[I],10)^255),I++;return new this(C)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.isIPv4=function(d){return this.parser(d)!==null},b.IPv4.isValid=function(d){try{return new this(this.parser(d)),!0}catch{return!1}},b.IPv4.isValidCIDR=function(d){try{return this.parseCIDR(d),!0}catch{return!1}},b.IPv4.isValidFourPartDecimal=function(d){return!!(b.IPv4.isValid(d)&&d.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},b.IPv4.isValidCIDRFourPartDecimal=function(d){const h=d.match(/^(.+)\/(\d+)$/);return!b.IPv4.isValidCIDR(d)||!h?!1:b.IPv4.isValidFourPartDecimal(h[1])},b.IPv4.networkAddressFromCIDR=function(d){let h,g,k,C,I;try{for(h=this.parseCIDR(d),k=h[0].toByteArray(),I=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[],g=0;g<4;)C.push(parseInt(k[g],10)&parseInt(I[g],10)),g++;return new this(C)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},b.IPv4.parse=function(d){const h=this.parser(d);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},b.IPv4.parseCIDR=function(d){let h;if(h=d.match(/^(.+)\/(\d+)$/)){const g=parseInt(h[2]);if(g>=0&&g<=32){const k=[this.parse(h[1]),g];return Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},b.IPv4.parser=function(d){let h,g,k;if(h=d.match(n.fourOctet))return function(){const C=h.slice(1,6),I=[];for(let R=0;R4294967295||k<0)throw new Error("ipaddr: address outside defined range");return function(){const C=[];let I;for(I=0;I<=24;I+=8)C.push(k>>I&255);return C}().reverse()}else return(h=d.match(n.twoOctet))?function(){const C=h.slice(1,4),I=[];if(k=_(C[1]),k>16777215||k<0)throw new Error("ipaddr: address outside defined range");return I.push(_(C[0])),I.push(k>>16&255),I.push(k>>8&255),I.push(k&255),I}():(h=d.match(n.threeOctet))?function(){const C=h.slice(1,5),I=[];if(k=_(C[2]),k>65535||k<0)throw new Error("ipaddr: address outside defined range");return I.push(_(C[0])),I.push(_(C[1])),I.push(k>>8&255),I.push(k&255),I}():null},b.IPv4.subnetMaskFromPrefixLength=function(d){if(d=parseInt(d),d<0||d>32)throw new Error("ipaddr: invalid IPv4 prefix length");const h=[0,0,0,0];let g=0;const k=Math.floor(d/8);for(;g=0;R-=1)if(C=this.parts[R],C in k){if(I=k[C],g&&I!==0)return null;I!==16&&(g=!0),h+=I}else return null;return 128-h},d.prototype.range=function(){return b.subnetMatch(this,this.SpecialRanges)},d.prototype.toByteArray=function(){let h;const g=[],k=this.parts;for(let C=0;C>8),g.push(h&255);return g},d.prototype.toFixedLengthString=function(){const h=(function(){const k=[];for(let C=0;C>8,g&255,k>>8,k&255])},d.prototype.toNormalizedString=function(){const h=(function(){const k=[];for(let C=0;CC&&(k=I.index,C=I[0].length);return C<0?g:`${g.substring(0,k)}::${g.substring(k+C)}`},d.prototype.toString=function(){return this.toRFC5952String()},d}(),b.IPv6.broadcastAddressFromCIDR=function(d){try{const h=this.parseCIDR(d),g=h[0].toByteArray(),k=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[];let I=0;for(;I<16;)C.push(parseInt(g[I],10)|parseInt(k[I],10)^255),I++;return new this(C)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},b.IPv6.isIPv6=function(d){return this.parser(d)!==null},b.IPv6.isValid=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{const h=this.parser(d);return new this(h.parts,h.zoneId),!0}catch{return!1}},b.IPv6.isValidCIDR=function(d){if(typeof d=="string"&&d.indexOf(":")===-1)return!1;try{return this.parseCIDR(d),!0}catch{return!1}},b.IPv6.networkAddressFromCIDR=function(d){let h,g,k,C,I;try{for(h=this.parseCIDR(d),k=h[0].toByteArray(),I=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),C=[],g=0;g<16;)C.push(parseInt(k[g],10)&parseInt(I[g],10)),g++;return new this(C)}catch(R){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${R})`)}},b.IPv6.parse=function(d){const h=this.parser(d);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},b.IPv6.parseCIDR=function(d){let h,g,k;if((g=d.match(/^(.+)\/(\d+)$/))&&(h=parseInt(g[2]),h>=0&&h<=128))return k=[this.parse(g[1]),h],Object.defineProperty(k,"toString",{value:function(){return this.join("/")}}),k;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},b.IPv6.parser=function(d){let h,g,k,C,I,R;if(k=d.match(f.deprecatedTransitional))return this.parser(`::ffff:${k[1]}`);if(f.native.test(d))return c(d,8);if((k=d.match(f.transitional))&&(R=k[6]||"",h=k[1],k[1].endsWith("::")||(h=h.slice(0,-1)),h=c(h+R,6),h.parts)){for(I=[parseInt(k[2]),parseInt(k[3]),parseInt(k[4]),parseInt(k[5])],g=0;g128)throw new Error("ipaddr: invalid IPv6 prefix length");const h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let g=0;const k=Math.floor(d/8);for(;g0?0:1}return v=Y(t),b=W[v]=J[v](t),{c(){e=p("div"),n=M(l),i=M(": "),a=M(o),u=w(),f=p("div"),m=M(c),_=M(`: + `),b.c(),d=w(),h=p("div"),k=M(g),C=M(": "),R=M(I),E=M(" ("),L=M(O),z=M("/"),B=M(V),T=M(")"),r(e,"class","my-2"),r(f,"class","my-2"),r(h,"class","my-2")},m(fe,ne){D(fe,e,ne),s(e,n),s(e,i),s(e,a),D(fe,u,ne),D(fe,f,ne),s(f,m),s(f,_),W[v].m(f,null),D(fe,d,ne),D(fe,h,ne),s(h,k),s(h,C),s(h,R),s(h,E),s(h,L),s(h,z),s(h,B),s(h,T),y=!0},p(fe,ne){var ie,_e,oe,me,we,S,P,F;(!y||ne&8)&&l!==(l=(((_e=(ie=fe[3].status)==null?void 0:ie.device)==null?void 0:_e.apmac)??"AP MAC")+"")&&q(n,l),(!y||ne&1)&&o!==(o=fe[0].apmac+"")&&q(a,o),(!y||ne&8)&&c!==(c=(((me=(oe=fe[3].status)==null?void 0:oe.device)==null?void 0:me.last_boot)??"Last boot")+"")&&q(m,c);let pe=v;v=Y(fe),v===pe?W[v].p(fe,ne):(mt(),te(W[pe],1,1,()=>{W[pe]=null}),pt(),b=W[v],b?b.p(fe,ne):(b=W[v]=J[v](fe),b.c()),X(b,1),b.m(f,null)),(!y||ne&8)&&g!==(g=(((S=(we=fe[3].status)==null?void 0:we.device)==null?void 0:S.reason)??"Reason")+"")&&q(k,g),(!y||ne&9)&&I!==(I=(((F=(P=fe[3][Ro(fe[0].chip)])==null?void 0:P.reason)==null?void 0:F[fe[0].boot_reason])??fe[0].boot_reason)+"")&&q(R,I),(!y||ne&1)&&O!==(O=fe[0].boot_reason+"")&&q(L,O),(!y||ne&1)&&V!==(V=fe[0].ex_cause+"")&&q(B,V)},i(fe){y||(X(b),y=!0)},o(fe){te(b),y=!1},d(fe){fe&&(N(e),N(u),N(f),N(d),N(h)),W[v].d()}}}function m_(t){let e;return{c(){e=M("-")},m(l,n){D(l,e,n)},p:He,i:He,o:He,d(l){l&&N(e)}}}function p_(t){let e,l;return e=new eu({props:{timestamp:new Date(new Date().getTime()-t[1].u*1e3),fullTimeColor:"",offset:t[0].clock_offset}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.timestamp=new Date(new Date().getTime()-n[1].u*1e3)),i&1&&(o.offset=n[0].clock_offset),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function of(t){var m;let e,l,n,i,o=(((m=t[3].btn)==null?void 0:m.reboot)??"Reboot")+"",a,u,f,c;return l=new wl({props:{to:"/consent",$$slots:{default:[d_]},$$scope:{ctx:t}}}),{c(){e=p("div"),Me(l.$$.fragment),n=w(),i=p("button"),a=M(o),r(i,"class","btn-yellow-sm float-right"),r(e,"class","my-2")},m(_,v){D(_,e,v),Pe(l,e,null),s(e,n),s(e,i),s(i,a),u=!0,f||(c=ue(i,"click",t[11]),f=!0)},p(_,v){var d;const b={};v&67108872&&(b.$$scope={dirty:v,ctx:_}),l.$set(b),(!u||v&8)&&o!==(o=(((d=_[3].btn)==null?void 0:d.reboot)??"Reboot")+"")&&q(a,o)},i(_){u||(X(l.$$.fragment,_),u=!0)},o(_){te(l.$$.fragment,_),u=!1},d(_){_&&N(e),Se(l),f=!1,c()}}}function d_(t){var i,o;let e,l=(((o=(i=t[3].status)==null?void 0:i.device)==null?void 0:o.btn_consents)??"Consents")+"",n;return{c(){e=p("span"),n=M(l),r(e,"class","btn-pri-sm")},m(a,u){D(a,e,u),s(e,n)},p(a,u){var f,c;u&8&&l!==(l=(((c=(f=a[3].status)==null?void 0:f.device)==null?void 0:c.btn_consents)??"Consents")+"")&&q(n,l)},d(a){a&&N(e)}}}function sf(t){var B,T,y,J,W,Y,H,G;let e,l,n=(((T=(B=t[3].status)==null?void 0:B.meter)==null?void 0:T.title)??"Meter")+"",i,o,a,u=(((J=(y=t[3].status)==null?void 0:y.meter)==null?void 0:J.manufacturer)??"Manufacturer")+"",f,c,m=Pi(t[0].meter.mfg)+"",_,v,b,d=(((Y=(W=t[3].status)==null?void 0:W.meter)==null?void 0:Y.model)??"Model")+"",h,g,k=(t[0].meter.model?t[0].meter.model:"unknown")+"",C,I,R,E=(((G=(H=t[3].status)==null?void 0:H.meter)==null?void 0:G.id)??"ID")+"",O,L,z=(t[0].meter.id?t[0].meter.id:"unknown")+"",V;return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),f=M(u),c=M(": "),_=M(m),v=w(),b=p("div"),h=M(d),g=M(": "),C=M(k),I=w(),R=p("div"),O=M(E),L=M(": "),V=M(z),r(l,"class","text-sm"),r(a,"class","my-2"),r(b,"class","my-2"),r(R,"class","my-2"),r(e,"class","cnt")},m($,Q){D($,e,Q),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,v),s(e,b),s(b,h),s(b,g),s(b,C),s(e,I),s(e,R),s(R,O),s(R,L),s(R,V)},p($,Q){var Z,K,ee,ae,fe,ne,pe,ie;Q&8&&n!==(n=(((K=(Z=$[3].status)==null?void 0:Z.meter)==null?void 0:K.title)??"Meter")+"")&&q(i,n),Q&8&&u!==(u=(((ae=(ee=$[3].status)==null?void 0:ee.meter)==null?void 0:ae.manufacturer)??"Manufacturer")+"")&&q(f,u),Q&1&&m!==(m=Pi($[0].meter.mfg)+"")&&q(_,m),Q&8&&d!==(d=(((ne=(fe=$[3].status)==null?void 0:fe.meter)==null?void 0:ne.model)??"Model")+"")&&q(h,d),Q&1&&k!==(k=($[0].meter.model?$[0].meter.model:"unknown")+"")&&q(C,k),Q&8&&E!==(E=(((ie=(pe=$[3].status)==null?void 0:pe.meter)==null?void 0:ie.id)??"ID")+"")&&q(O,E),Q&1&&z!==(z=($[0].meter.id?$[0].meter.id:"unknown")+"")&&q(V,z)},d($){$&&N(e)}}}function af(t){var G,$,Q,Z,K,ee,ae,fe;let e,l,n=((($=(G=t[3].status)==null?void 0:G.network)==null?void 0:$.title)??"Network")+"",i,o,a,u=(((Z=(Q=t[3].conf)==null?void 0:Q.network)==null?void 0:Z.ip)??"IP")+"",f,c,m=t[0].net.ip+"",_,v,b,d=(((ee=(K=t[3].conf)==null?void 0:K.network)==null?void 0:ee.mask)??"Mask")+"",h,g,k=t[0].net.mask+"",C,I,R,E=(((fe=(ae=t[3].conf)==null?void 0:ae.network)==null?void 0:fe.gw)??"Gateway")+"",O,L,z=t[0].net.gw+"",V,B,T,y,J,W=t[0].net.dns1&&ff(t),Y=t[0].net.dns2&&rf(t),H=t[0].net.ipv6&&uf(t);return{c(){e=p("div"),l=p("strong"),i=M(n),o=w(),a=p("div"),f=M(u),c=M(": "),_=M(m),v=w(),b=p("div"),h=M(d),g=M(": "),C=M(k),I=w(),R=p("div"),O=M(E),L=M(": "),V=M(z),B=w(),T=p("div"),W&&W.c(),y=w(),Y&&Y.c(),J=w(),H&&H.c(),r(l,"class","text-sm"),r(a,"class","my-2"),r(b,"class","my-2"),r(R,"class","my-2"),r(T,"class","my-2"),r(e,"class","cnt")},m(ne,pe){D(ne,e,pe),s(e,l),s(l,i),s(e,o),s(e,a),s(a,f),s(a,c),s(a,_),s(e,v),s(e,b),s(b,h),s(b,g),s(b,C),s(e,I),s(e,R),s(R,O),s(R,L),s(R,V),s(e,B),s(e,T),W&&W.m(T,null),s(T,y),Y&&Y.m(T,null),s(e,J),H&&H.m(e,null)},p(ne,pe){var ie,_e,oe,me,we,S,P,F;pe&8&&n!==(n=(((_e=(ie=ne[3].status)==null?void 0:ie.network)==null?void 0:_e.title)??"Network")+"")&&q(i,n),pe&8&&u!==(u=(((me=(oe=ne[3].conf)==null?void 0:oe.network)==null?void 0:me.ip)??"IP")+"")&&q(f,u),pe&1&&m!==(m=ne[0].net.ip+"")&&q(_,m),pe&8&&d!==(d=(((S=(we=ne[3].conf)==null?void 0:we.network)==null?void 0:S.mask)??"Mask")+"")&&q(h,d),pe&1&&k!==(k=ne[0].net.mask+"")&&q(C,k),pe&8&&E!==(E=(((F=(P=ne[3].conf)==null?void 0:P.network)==null?void 0:F.gw)??"Gateway")+"")&&q(O,E),pe&1&&z!==(z=ne[0].net.gw+"")&&q(V,z),ne[0].net.dns1?W?W.p(ne,pe):(W=ff(ne),W.c(),W.m(T,y)):W&&(W.d(1),W=null),ne[0].net.dns2?Y?Y.p(ne,pe):(Y=rf(ne),Y.c(),Y.m(T,null)):Y&&(Y.d(1),Y=null),ne[0].net.ipv6?H?H.p(ne,pe):(H=uf(ne),H.c(),H.m(e,null)):H&&(H.d(1),H=null)},d(ne){ne&&N(e),W&&W.d(),Y&&Y.d(),H&&H.d()}}}function ff(t){var a,u;let e=(((u=(a=t[3].conf)==null?void 0:a.network)==null?void 0:u.dns)??"DNS")+"",l,n,i=t[0].net.dns1+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){D(f,l,c),D(f,n,c),D(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&q(l,e),c&1&&i!==(i=f[0].net.dns1+"")&&q(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function rf(t){var a,u;let e=(((u=(a=t[3].conf)==null?void 0:a.network)==null?void 0:u.dns)??"DNS")+"",l,n,i=t[0].net.dns2+"",o;return{c(){l=M(e),n=M(": "),o=M(i)},m(f,c){D(f,l,c),D(f,n,c),D(f,o,c)},p(f,c){var m,_;c&8&&e!==(e=(((_=(m=f[3].conf)==null?void 0:m.network)==null?void 0:_.dns)??"DNS")+"")&&q(l,e),c&1&&i!==(i=f[0].net.dns2+"")&&q(o,i)},d(f){f&&(N(l),N(n),N(o))}}}function uf(t){let e,l,n,i=En.parse(t[0].net.ipv6)+"",o,a,u,f,c=t[0].net.dns1v6&&cf(t),m=t[0].net.dns2v6&&_f(t);return{c(){e=p("div"),l=M("IPv6: "),n=p("span"),o=M(i),a=w(),u=p("div"),c&&c.c(),f=w(),m&&m.c(),Sl(n,"font-size","14px"),r(e,"class","my-2"),r(u,"class","my-2")},m(_,v){D(_,e,v),s(e,l),s(e,n),s(n,o),D(_,a,v),D(_,u,v),c&&c.m(u,null),s(u,f),m&&m.m(u,null)},p(_,v){v&1&&i!==(i=En.parse(_[0].net.ipv6)+"")&&q(o,i),_[0].net.dns1v6?c?c.p(_,v):(c=cf(_),c.c(),c.m(u,f)):c&&(c.d(1),c=null),_[0].net.dns2v6?m?m.p(_,v):(m=_f(_),m.c(),m.m(u,null)):m&&(m.d(1),m=null)},d(_){_&&(N(e),N(a),N(u)),c&&c.d(),m&&m.d()}}}function cf(t){let e,l,n=En.parse(t[0].net.dns1v6)+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){D(o,e,a),D(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=En.parse(o[0].net.dns1v6)+"")&&q(i,n)},d(o){o&&(N(e),N(l))}}}function _f(t){let e,l,n=En.parse(t[0].net.dns2v6)+"",i;return{c(){e=M("DNSv6: "),l=p("span"),i=M(n),Sl(l,"font-size","14px")},m(o,a){D(o,e,a),D(o,l,a),s(l,i)},p(o,a){a&1&&n!==(n=En.parse(o[0].net.dns2v6)+"")&&q(i,n)},d(o){o&&(N(e),N(l))}}}function mf(t){let e,l,n,i,o,a,u,f,c;return{c(){e=p("div"),l=M(`Channel: + `),n=p("select"),i=p("option"),i.textContent="Stable",o=p("option"),o.textContent="Early",a=p("option"),a.textContent="Release Candidate",u=p("option"),u.textContent="Snapshot",i.__value=0,U(i,i.__value),o.__value=1,U(o,o.__value),a.__value=2,U(a,a.__value),u.__value=3,U(u,u.__value),u.disabled=!0,r(n,"class","in-s w-full"),t[0].upgrade.c===void 0&&qt(()=>t[14].call(n)),r(e,"class","my-2")},m(m,_){D(m,e,_),s(e,l),s(e,n),s(n,i),s(n,o),s(n,a),s(n,u),ze(n,t[0].upgrade.c,!0),f||(c=[ue(n,"change",t[14]),ue(n,"change",t[13])],f=!0)},p(m,_){_&1&&ze(n,m[0].upgrade.c)},d(m){m&&N(e),f=!1,Wt(c)}}}function pf(t){var f,c,m,_;let e,l,n=(((c=(f=t[3].status)==null?void 0:f.firmware)==null?void 0:c.failed)??"Upgrade from {0} to {1} failed").replace("{0}",t[0].upgrade.f).replace("{1}",t[0].upgrade.t)+"",i,o,a=(((_=(m=t[3].errors)==null?void 0:m.upgrade)==null?void 0:_[t[0].upgrade.e])??t[0].upgrade.e)+"",u;return{c(){e=p("div"),l=p("div"),i=M(n),o=w(),u=M(a),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(v,b){D(v,e,b),s(e,l),s(l,i),s(l,o),s(l,u)},p(v,b){var d,h,g,k;b&9&&n!==(n=(((h=(d=v[3].status)==null?void 0:d.firmware)==null?void 0:h.failed)??"Upgrade from {0} to {1} failed").replace("{0}",v[0].upgrade.f).replace("{1}",v[0].upgrade.t)+"")&&q(i,n),b&9&&a!==(a=(((k=(g=v[3].errors)==null?void 0:g.upgrade)==null?void 0:k[v[0].upgrade.e])??v[0].upgrade.e)+"")&&q(u,a)},d(v){v&&N(e)}}}function df(t){var d,h;let e,l=(((h=(d=t[3].status)==null?void 0:d.firmware)==null?void 0:h.latest)??"Latest")+"",n,i,o,a=t[0].upgrade.n+"",u,f,c,m,_,v=(t[0].security==0||t[1].a)&&t[0].fwconsent===1&&t[0].upgrade.n&&t[0].upgrade.n!=t[0].version&&hf(t),b=t[0].fwconsent===2&&vf(t);return{c(){e=p("div"),n=M(l),i=M(`: + `),o=p("a"),u=M(a),c=w(),v&&v.c(),m=w(),b&&b.c(),_=Qt(),r(o,"href",f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+t[0].upgrade.n),r(o,"class","ml-2 text-blue-600 hover:text-blue-800"),r(o,"target","_blank"),r(o,"rel","noreferrer"),r(e,"class","my-2 flex")},m(g,k){D(g,e,k),s(e,n),s(e,i),s(e,o),s(o,u),s(e,c),v&&v.m(e,null),D(g,m,k),b&&b.m(g,k),D(g,_,k)},p(g,k){var C,I;k&8&&l!==(l=(((I=(C=g[3].status)==null?void 0:C.firmware)==null?void 0:I.latest)??"Latest")+"")&&q(n,l),k&1&&a!==(a=g[0].upgrade.n+"")&&q(u,a),k&1&&f!==(f="https://github.com/UtilitechAS/amsreader-firmware/releases/tag/"+g[0].upgrade.n)&&r(o,"href",f),(g[0].security==0||g[1].a)&&g[0].fwconsent===1&&g[0].upgrade.n&&g[0].upgrade.n!=g[0].version?v?v.p(g,k):(v=hf(g),v.c(),v.m(e,null)):v&&(v.d(1),v=null),g[0].fwconsent===2?b?b.p(g,k):(b=vf(g),b.c(),b.m(_.parentNode,_)):b&&(b.d(1),b=null)},d(g){g&&(N(e),N(m),N(_)),v&&v.d(),b&&b.d(g)}}}function hf(t){let e,l,n,i,o;return{c(){var a,u;e=p("div"),l=p("button"),l.textContent="⇓",r(e,"class","flex-none ml-2 text-green-500"),r(e,"title",n=((u=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:u.install)??"Install")},m(a,u){D(a,e,u),s(e,l),i||(o=ue(l,"click",t[10]),i=!0)},p(a,u){var f,c;u&8&&n!==(n=((c=(f=a[3].status)==null?void 0:f.firmware)==null?void 0:c.install)??"Install")&&r(e,"title",n)},d(a){a&&N(e),i=!1,o()}}}function vf(t){var o,a;let e,l,n=(((a=(o=t[3].status)==null?void 0:o.firmware)==null?void 0:a.no_one_click)??"One-click upgrade disabled")+"",i;return{c(){e=p("div"),l=p("div"),i=M(n),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(u,f){D(u,e,f),s(e,l),s(l,i)},p(u,f){var c,m;f&8&&n!==(n=(((m=(c=u[3].status)==null?void 0:c.firmware)==null?void 0:m.no_one_click)??"One-click upgrade disabled")+"")&&q(i,n)},d(u){u&&N(e)}}}function bf(t){let e,l=Fo(xe(t[0].chip,t[0].board))+"",n;return{c(){e=p("div"),n=M(l),r(e,"class","bd-red")},m(i,o){D(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=Fo(xe(i[0].chip,i[0].board))+"")&&q(n,l)},d(i){i&&N(e)}}}function gf(t){let e,l,n,i,o,a;function u(m,_){return m[5].length==0?v_:h_}let f=u(t),c=f(t);return{c(){e=p("div"),l=p("form"),n=p("input"),i=w(),c.c(),Sl(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(m,_){D(m,e,_),s(e,l),s(l,n),t[15](n),s(l,i),c.m(l,null),o||(a=[ue(n,"change",t[16]),ue(l,"submit",t[18])],o=!0)},p(m,_){f===(f=u(m))&&c?c.p(m,_):(c.d(1),c=f(m),c&&(c.c(),c.m(l,null)))},d(m){m&&N(e),t[15](null),c.d(),o=!1,Wt(a)}}}function h_(t){var u;let e=t[5][0].name+"",l,n,i,o=(((u=t[3].btn)==null?void 0:u.upload)??"Upload")+"",a;return{c(){l=M(e),n=w(),i=p("button"),a=M(o),r(i,"type","submit"),r(i,"class","btn-pri-sm float-right ml-2")},m(f,c){D(f,l,c),D(f,n,c),D(f,i,c),s(i,a)},p(f,c){var m;c&32&&e!==(e=f[5][0].name+"")&&q(l,e),c&8&&o!==(o=(((m=f[3].btn)==null?void 0:m.upload)??"Upload")+"")&&q(a,o)},d(f){f&&(N(l),N(n),N(i))}}}function v_(t){var a,u;let e,l=(((u=(a=t[3].status)==null?void 0:a.firmware)==null?void 0:u.btn_select_file)??"Select file")+"",n,i,o;return{c(){e=p("button"),n=M(l),r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(f,c){D(f,e,c),s(e,n),i||(o=ue(e,"click",t[17]),i=!0)},p(f,c){var m,_;c&8&&l!==(l=(((_=(m=f[3].status)==null?void 0:m.firmware)==null?void 0:_.btn_select_file)??"Select file")+"")&&q(n,l)},d(f){f&&N(e),i=!1,o()}}}function kf(t){var Y,H,G,$,Q,Z;let e,l,n=(((H=(Y=t[3].status)==null?void 0:Y.backup)==null?void 0:H.title)??"Backup")+"",i,o,a,u,f,c,m,_,v=((($=(G=t[3].status)==null?void 0:G.backup)==null?void 0:$.secrets)??"Include secrets")+"",b,d,h,g=(((Z=(Q=t[3].status)==null?void 0:Q.backup)==null?void 0:Z.secrets_desc)??"")+"",k,C,I,R,E,O,L,z,V=rt(t[9]),B=[];for(let K=0;K{de=null}),pt()),(St=se[1])!=null&&St.a?ve?(ve.p(se,Ne),Ne&2&&X(ve,1)):(ve=of(se),ve.c(),X(ve,1),ve.m(l,null)):ve&&(mt(),te(ve,1,1,()=>{ve=null}),pt()),se[0].meter?De?De.p(se,Ne):(De=sf(se),De.c(),De.m(e,W)):De&&(De.d(1),De=null),se[0].net?Ee?Ee.p(se,Ne):(Ee=af(se),Ee.c(),Ee.m(e,Y)):Ee&&(Ee.d(1),Ee=null),(!be||Ne&8)&&$!==($=(((bt=(kt=se[3].status)==null?void 0:kt.firmware)==null?void 0:bt.title)??"Firmware")+"")&&q(Q,$),se[0].fwconsent===1?Ae?Ae.p(se,Ne):(Ae=mf(se),Ae.c(),Ae.m(H,ae)):Ae&&(Ae.d(1),Ae=null),(!be||Ne&8)&&ne!==(ne=(((Ut=($t=se[3].status)==null?void 0:$t.firmware)==null?void 0:Ut.installed)??"Installed")+"")&&q(pe,ne),(!be||Ne&1)&&_e!==(_e=se[0].version+"")&&q(oe,_e),se[0].upgrade.t&&se[0].upgrade.t!=se[0].version&&se[0].upgrade.e!=0&&se[0].upgrade.e!=123?Oe?Oe.p(se,Ne):(Oe=pf(se),Oe.c(),Oe.m(H,we)):Oe&&(Oe.d(1),Oe=null),se[0].upgrade.n?Ie?Ie.p(se,Ne):(Ie=df(se),Ie.c(),Ie.m(H,S)):Ie&&(Ie.d(1),Ie=null),Ne&3&&(P=(se[0].security==0||se[1].a)&&cn(se[0].board)),P?qe?qe.p(se,Ne):(qe=bf(se),qe.c(),qe.m(H,F)):qe&&(qe.d(1),qe=null),se[0].security==0||se[1].a?Fe?Fe.p(se,Ne):(Fe=gf(se),Fe.c(),Fe.m(H,null)):Fe&&(Fe.d(1),Fe=null),se[0].security==0||se[1].a?tt?tt.p(se,Ne):(tt=kf(se),tt.c(),tt.m(e,null)):tt&&(tt.d(1),tt=null);const Mt={};Ne&64&&(Mt.active=se[6]),Ne&8&&(Mt.message=((el=(xt=se[3].status)==null?void 0:xt.mask)==null?void 0:el.firmware)??"Uploading"),le.$set(Mt);const ot={};Ne&256&&(ot.active=se[8]),Ne&8&&(ot.message=((Jt=(Xt=se[3].status)==null?void 0:Xt.mask)==null?void 0:Jt.config)??"Uploading"),he.$set(ot)},i(se){be||(X(I.$$.fragment,se),X(de),X(ve),X(le.$$.fragment,se),X(he.$$.fragment,se),be=!0)},o(se){te(I.$$.fragment,se),te(de),te(ve),te(le.$$.fragment,se),te(he.$$.fragment,se),be=!1},d(se){se&&(N(e),N(j),N(re)),x&&x.d(),Se(I),de&&de.d(),ve&&ve.d(),De&&De.d(),Ee&&Ee.d(),Ae&&Ae.d(),Oe&&Oe.d(),Ie&&Ie.d(),qe&&qe.d(),Fe&&Fe.d(),tt&&tt.d(),Se(le,se),Se(he,se)}}}async function w_(){await(await fetch("reboot",{method:"POST"})).json()}function C_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price",key:"is"}],a={};Il.subscribe(B=>{l(3,a=B)});function u(){var B;confirm((((B=a.header)==null?void 0:B.upgrade)??"Upgrade to {0}?").replace("{0}",i.upgrade.n))&&(xr(i.upgrade.n),hl.update(T=>(T.upgrade.t=i.upgrade.n,T.upgrade.p=0,T.upgrading=!0,T)))}const f=function(){var B;confirm(((B=a.device)==null?void 0:B.reboot_confirm)??"Reboot?")&&(hl.update(T=>(T.booting=!0,T)),w_())};let c,m=[],_=!1,v,b=[],d=!1;Di();let h={hostname:"",ip:""};function g(B){l(8,d=!0);const T=new FormData;T.append("file",b[0]),fetch("configfile",{method:"POST",body:T}).then(y=>y.json()).then(y=>{hl.update(J=>(h&&h.hostname&&(J.hostname=h.hostname),J.booting=y.reboot,h&&h.ip&&(J.net.ip=h.ip),setTimeout(ni,5e3,i),J))}).catch(y=>{console.error("Error:",y),setTimeout(ni,5e3,i)})}function k(){const B=new FormData;B.append("channel",i.upgrade.c),fetch("fwchannel",{method:"POST",body:B})}function C(){i.upgrade.c=Zt(this),l(0,i)}function I(B){wi[B?"unshift":"push"](()=>{c=B,l(4,c)})}function R(){m=this.files,l(5,m)}const E=()=>{c.click()},O=()=>l(6,_=!0);function L(B){wi[B?"unshift":"push"](()=>{v=B,l(7,v)})}function z(){b=this.files,l(2,b)}const V=()=>{v.click()};return t.$$set=B=>{"data"in B&&l(1,n=B.data),"sysinfo"in B&&l(0,i=B.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&b.length==1){let B=b[0],T=new FileReader,y=J=>{let W=J.target.result.split(` +`);for(let Y in W){let H=W[Y];H.startsWith("hostname ")?h.hostname=H.split(" ")[1]:H.startsWith("ip ")&&(h.ip=H.split(" ")[1])}};T.onload=y,T.readAsText(B)}},[i,n,b,a,c,m,_,v,d,o,u,f,g,k,C,I,R,E,O,L,z,V]}class P_ extends Rt{constructor(e){super(),At(this,e,C_,k_,Nt,{data:1,sysinfo:0})}}function Pf(t){let e,l,n=xe(t[0],7)+"",i,o,a=xe(t[0],5)+"",u,f,c=xe(t[0],4)+"",m,_,v=xe(t[0],3)+"",b,d,h,g,k=xe(t[0],2)+"",C,I,R=xe(t[0],1)+"",E,O,L=xe(t[0],0)+"",z,V,B,T,y=xe(t[0],101)+"",J,W,Y=xe(t[0],100)+"",H;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=p("option"),b=M(v),d=w(),h=p("optgroup"),g=p("option"),C=M(k),I=p("option"),E=M(R),O=p("option"),z=M(L),V=w(),B=p("optgroup"),T=p("option"),J=M(y),W=p("option"),H=M(Y),l.__value=7,U(l,l.__value),o.__value=5,U(o,o.__value),f.__value=4,U(f,f.__value),_.__value=3,U(_,_.__value),r(e,"label","amsleser.no"),g.__value=2,U(g,g.__value),I.__value=1,U(I,I.__value),O.__value=0,U(O,O.__value),r(h,"label","Custom hardware"),T.__value=101,U(T,T.__value),W.__value=100,U(W,W.__value),r(B,"label","Generic hardware")},m(G,$){D(G,e,$),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),s(e,_),s(_,b),D(G,d,$),D(G,h,$),s(h,g),s(g,C),s(h,I),s(I,E),s(h,O),s(O,z),D(G,V,$),D(G,B,$),s(B,T),s(T,J),s(B,W),s(W,H)},p(G,$){$&1&&n!==(n=xe(G[0],7)+"")&&q(i,n),$&1&&a!==(a=xe(G[0],5)+"")&&q(u,a),$&1&&c!==(c=xe(G[0],4)+"")&&q(m,c),$&1&&v!==(v=xe(G[0],3)+"")&&q(b,v),$&1&&k!==(k=xe(G[0],2)+"")&&q(C,k),$&1&&R!==(R=xe(G[0],1)+"")&&q(E,R),$&1&&L!==(L=xe(G[0],0)+"")&&q(z,L),$&1&&y!==(y=xe(G[0],101)+"")&&q(J,y),$&1&&Y!==(Y=xe(G[0],100)+"")&&q(H,Y)},d(G){G&&(N(e),N(d),N(h),N(V),N(B))}}}function Sf(t){let e,l,n=xe(t[0],201)+"",i,o,a=xe(t[0],202)+"",u,f,c=xe(t[0],203)+"",m,_,v=xe(t[0],241)+"",b,d,h=xe(t[0],242)+"",g,k,C=xe(t[0],243)+"",I,R,E=xe(t[0],245)+"",O,L,z=xe(t[0],200)+"",V;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=p("option"),b=M(v),d=p("option"),g=M(h),k=p("option"),I=M(C),R=p("option"),O=M(E),L=p("option"),V=M(z),l.__value=201,U(l,l.__value),o.__value=202,U(o,o.__value),f.__value=203,U(f,f.__value),_.__value=241,U(_,_.__value),d.__value=242,U(d,d.__value),k.__value=243,U(k,k.__value),R.__value=245,U(R,R.__value),L.__value=200,U(L,L.__value),r(e,"label","Generic hardware")},m(B,T){D(B,e,T),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),s(e,_),s(_,b),s(e,d),s(d,g),s(e,k),s(k,I),s(e,R),s(R,O),s(e,L),s(L,V)},p(B,T){T&1&&n!==(n=xe(B[0],201)+"")&&q(i,n),T&1&&a!==(a=xe(B[0],202)+"")&&q(u,a),T&1&&c!==(c=xe(B[0],203)+"")&&q(m,c),T&1&&v!==(v=xe(B[0],241)+"")&&q(b,v),T&1&&h!==(h=xe(B[0],242)+"")&&q(g,h),T&1&&C!==(C=xe(B[0],243)+"")&&q(I,C),T&1&&E!==(E=xe(B[0],245)+"")&&q(O,E),T&1&&z!==(z=xe(B[0],200)+"")&&q(V,z)},d(B){B&&N(e)}}}function Mf(t){let e,l,n=xe(t[0],7)+"",i,o,a=xe(t[0],6)+"",u,f,c=xe(t[0],5)+"",m,_,v,b,d=xe(t[0],51)+"",h,g,k=xe(t[0],50)+"",C;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=p("option"),u=M(a),f=p("option"),m=M(c),_=w(),v=p("optgroup"),b=p("option"),h=M(d),g=p("option"),C=M(k),l.__value=7,U(l,l.__value),o.__value=6,U(o,o.__value),f.__value=5,U(f,f.__value),r(e,"label","amsleser.no"),b.__value=51,U(b,b.__value),g.__value=50,U(g,g.__value),r(v,"label","Generic hardware")},m(I,R){D(I,e,R),s(e,l),s(l,i),s(e,o),s(o,u),s(e,f),s(f,m),D(I,_,R),D(I,v,R),s(v,b),s(b,h),s(v,g),s(g,C)},p(I,R){R&1&&n!==(n=xe(I[0],7)+"")&&q(i,n),R&1&&a!==(a=xe(I[0],6)+"")&&q(u,a),R&1&&c!==(c=xe(I[0],5)+"")&&q(m,c),R&1&&d!==(d=xe(I[0],51)+"")&&q(h,d),R&1&&k!==(k=xe(I[0],50)+"")&&q(C,k)},d(I){I&&(N(e),N(_),N(v))}}}function If(t){let e,l,n=xe(t[0],8)+"",i,o,a,u,f=xe(t[0],71)+"",c,m,_=xe(t[0],70)+"",v;return{c(){e=p("optgroup"),l=p("option"),i=M(n),o=w(),a=p("optgroup"),u=p("option"),c=M(f),m=p("option"),v=M(_),l.__value=8,U(l,l.__value),r(e,"label","Custom hardware"),u.__value=71,U(u,u.__value),m.__value=70,U(m,m.__value),r(a,"label","Generic hardware")},m(b,d){D(b,e,d),s(e,l),s(l,i),D(b,o,d),D(b,a,d),s(a,u),s(u,c),s(a,m),s(m,v)},p(b,d){d&1&&n!==(n=xe(b[0],8)+"")&&q(i,n),d&1&&f!==(f=xe(b[0],71)+"")&&q(c,f),d&1&&_!==(_=xe(b[0],70)+"")&&q(v,_)},d(b){b&&(N(e),N(o),N(a))}}}function Ef(t){let e,l,n=xe(t[0],200)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=200,U(l,l.__value),r(e,"label","Generic hardware")},m(o,a){D(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=xe(o[0],200)+"")&&q(i,n)},d(o){o&&N(e)}}}function Nf(t){let e,l,n=xe(t[0],80)+"",i;return{c(){e=p("optgroup"),l=p("option"),i=M(n),l.__value=80,U(l,l.__value),r(e,"label","Generic hardware")},m(o,a){D(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=xe(o[0],80)+"")&&q(i,n)},d(o){o&&N(e)}}}function S_(t){let e,l,n,i,o,a,u,f,c=t[0]=="esp8266"&&Pf(t),m=t[0]=="esp32"&&Sf(t),_=t[0]=="esp32s2"&&Mf(t),v=t[0]=="esp32c3"&&If(t),b=t[0]=="esp32solo"&&Ef(t),d=t[0]=="esp32s3"&&Nf(t);return{c(){e=p("option"),l=w(),c&&c.c(),n=w(),m&&m.c(),i=w(),_&&_.c(),o=w(),v&&v.c(),a=w(),b&&b.c(),u=w(),d&&d.c(),f=Qt(),e.__value=-1,U(e,e.__value)},m(h,g){D(h,e,g),D(h,l,g),c&&c.m(h,g),D(h,n,g),m&&m.m(h,g),D(h,i,g),_&&_.m(h,g),D(h,o,g),v&&v.m(h,g),D(h,a,g),b&&b.m(h,g),D(h,u,g),d&&d.m(h,g),D(h,f,g)},p(h,[g]){h[0]=="esp8266"?c?c.p(h,g):(c=Pf(h),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),h[0]=="esp32"?m?m.p(h,g):(m=Sf(h),m.c(),m.m(i.parentNode,i)):m&&(m.d(1),m=null),h[0]=="esp32s2"?_?_.p(h,g):(_=Mf(h),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),h[0]=="esp32c3"?v?v.p(h,g):(v=If(h),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),h[0]=="esp32solo"?b?b.p(h,g):(b=Ef(h),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null),h[0]=="esp32s3"?d?d.p(h,g):(d=Nf(h),d.c(),d.m(f.parentNode,f)):d&&(d.d(1),d=null)},i:He,o:He,d(h){h&&(N(e),N(l),N(n),N(i),N(o),N(a),N(u),N(f)),c&&c.d(h),m&&m.d(h),_&&_.d(h),v&&v.d(h),b&&b.d(h),d&&d.d(h)}}}function M_(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class I_ extends Rt{constructor(e){super(),At(this,e,M_,S_,Nt,{chip:0})}}function Df(t){let e;return{c(){e=p("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function Tf(t){let e,l,n,i,o,a,u;return a=new lo({props:{chip:t[0].chip}}),{c(){e=p("div"),l=M("HAN GPIO"),n=p("br"),i=w(),o=p("select"),Me(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(f,c){D(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Pe(a,o,null),u=!0},p(f,c){const m={};c&1&&(m.chip=f[0].chip),a.$set(m)},i(f){u||(X(a.$$.fragment,f),u=!0)},o(f){te(a.$$.fragment,f),u=!1},d(f){f&&N(e),Se(a)}}}function E_(t){let e,l,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C,I,R,E,O,L,z,V,B,T,y,J,W=t[0].usrcfg&&Df();d=new I_({props:{chip:t[0].chip}});let Y=t[0].board&&t[0].board>20&&Tf(t);return B=new dl({props:{active:t[1],message:"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("input"),o=w(),a=p("strong"),a.textContent="Initial configuration",u=w(),W&&W.c(),f=w(),c=p("div"),m=M("Board type"),_=p("br"),v=w(),b=p("select"),Me(d.$$.fragment),h=w(),Y&&Y.c(),g=w(),k=p("div"),C=p("label"),I=p("input"),R=M(" Clear all other configuration"),E=w(),O=p("div"),O.innerHTML='',L=w(),z=p("span"),z.textContent=" ",V=w(),Me(B.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(b,"name","vb"),r(b,"class","in-s"),t[0].board===void 0&&qt(()=>t[5].call(b)),r(c,"class","my-3"),r(I,"type","checkbox"),r(I,"name","vr"),I.__value="true",U(I,I.__value),r(I,"class","rounded mb-1"),r(k,"class","my-3"),r(O,"class","my-3"),r(z,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(H,G){D(H,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),W&&W.m(n,null),s(n,f),s(n,c),s(c,m),s(c,_),s(c,v),s(c,b),Pe(d,b,null),ze(b,t[0].board,!0),s(n,h),Y&&Y.m(n,null),s(n,g),s(n,k),s(k,C),s(C,I),I.checked=t[2],s(C,R),s(n,E),s(n,O),s(n,L),s(n,z),D(H,V,G),Pe(B,H,G),T=!0,y||(J=[ue(b,"change",t[5]),ue(I,"change",t[6]),ue(n,"submit",dn(t[3]))],y=!0)},p(H,[G]){H[0].usrcfg?W||(W=Df(),W.c(),W.m(n,f)):W&&(W.d(1),W=null);const $={};G&1&&($.chip=H[0].chip),d.$set($),G&1&&ze(b,H[0].board),H[0].board&&H[0].board>20?Y?(Y.p(H,G),G&1&&X(Y,1)):(Y=Tf(H),Y.c(),X(Y,1),Y.m(n,g)):Y&&(mt(),te(Y,1,1,()=>{Y=null}),pt()),G&4&&(I.checked=H[2]);const Q={};G&2&&(Q.active=H[1]),B.$set(Q)},i(H){T||(X(d.$$.fragment,H),X(Y),X(B.$$.fragment,H),T=!0)},o(H){te(d.$$.fragment,H),te(Y),te(B.$$.fragment,H),T=!1},d(H){H&&(N(e),N(V)),W&&W.d(),Se(d),Y&&Y.d(),Se(B,H),y=!1,Wt(J)}}}function N_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o=!1;async function a(m){l(1,o=!0);const _=new FormData(m.target),v=new URLSearchParams;for(let h of _){const[g,k]=h;v.append(g,k)}let d=await(await fetch("save",{method:"POST",body:v})).json();l(1,o=!1),hl.update(h=>(h.vndcfg=d.success,h.booting=d.reboot,h.if.eth=h.boardType>240&&h.boardType<250,h)),nn(n+(i.usrcfg?"":"setup"))}let u=!0;hl.subscribe(m=>{l(0,i=m),m.fwconsent===1&&l(2,u=!i.usrcfg)});function f(){i.board=Zt(this),l(0,i)}function c(){u=this.checked,l(2,u)}return t.$$set=m=>{"basepath"in m&&l(4,n=m.basepath),"sysinfo"in m&&l(0,i=m.sysinfo)},[i,o,u,a,n,f,c]}class D_ extends Rt{constructor(e){super(),At(this,e,N_,E_,Nt,{basepath:4,sysinfo:0})}}function qf(t,e,l){const n=t.slice();return n[13]=e[l],n}function Af(t){var i,o;let e,l=(((o=(i=t[1].conf)==null?void 0:i.connection)==null?void 0:o.eth)??"Ethernet")+"",n;return{c(){e=p("option"),n=M(l),e.__value=3,U(e,e.__value)},m(a,u){D(a,e,u),s(e,n)},p(a,u){var f,c;u&2&&l!==(l=(((c=(f=a[1].conf)==null?void 0:f.connection)==null?void 0:c.eth)??"Ethernet")+"")&&q(n,l)},d(a){a&&N(e)}}}function Rf(t){var z,V,B,T;let e,l=(((V=(z=t[1].conf)==null?void 0:z.connection)==null?void 0:V.ssid)??"SSID")+"",n,i,o,a,u,f,c,m,_,v,b=(((T=(B=t[1].conf)==null?void 0:B.connection)==null?void 0:T.psk)??"Password")+"",d,h,g,k,C,I,R;function E(y,J){return y[2]?q_:T_}let O=E(t),L=O(t);return{c(){e=p("div"),n=M(l),i=w(),o=p("label"),a=p("input"),u=M(" manual"),f=w(),c=p("br"),m=w(),L.c(),_=w(),v=p("div"),d=M(b),h=p("br"),g=w(),k=p("input"),r(a,"type","checkbox"),a.__value="true",U(a,a.__value),r(a,"class","rounded mb-1"),r(o,"class","float-right mr-3"),r(e,"class","my-3"),r(k,"name","sp"),r(k,"type","password"),r(k,"pattern",In),r(k,"class","in-s"),r(k,"autocomplete","off"),k.required=C=t[5]==2,r(v,"class","my-3")},m(y,J){D(y,e,J),s(e,n),s(e,i),s(e,o),s(o,a),a.checked=t[2],s(o,u),s(e,f),s(e,c),s(e,m),L.m(e,null),D(y,_,J),D(y,v,J),s(v,d),s(v,h),s(v,g),s(v,k),I||(R=ue(a,"change",t[9]),I=!0)},p(y,J){var W,Y,H,G;J&2&&l!==(l=(((Y=(W=y[1].conf)==null?void 0:W.connection)==null?void 0:Y.ssid)??"SSID")+"")&&q(n,l),J&4&&(a.checked=y[2]),O===(O=E(y))&&L?L.p(y,J):(L.d(1),L=O(y),L&&(L.c(),L.m(e,null))),J&2&&b!==(b=(((G=(H=y[1].conf)==null?void 0:H.connection)==null?void 0:G.psk)??"Password")+"")&&q(d,b),J&32&&C!==(C=y[5]==2)&&(k.required=C)},d(y){y&&(N(e),N(_),N(v)),L.d(),I=!1,R()}}}function T_(t){var a,u;let e,l,n,i=((a=t[3])==null?void 0:a.c)==-1&&Of(),o=((u=t[3])==null?void 0:u.n)&&Lf(t);return{c(){e=p("select"),i&&i.c(),l=Qt(),o&&o.c(),r(e,"name","ss"),r(e,"class","in-s"),e.required=n=t[5]==1||t[5]==2},m(f,c){D(f,e,c),i&&i.m(e,null),s(e,l),o&&o.m(e,null)},p(f,c){var m,_;((m=f[3])==null?void 0:m.c)==-1?i||(i=Of(),i.c(),i.m(e,l)):i&&(i.d(1),i=null),(_=f[3])!=null&&_.n?o?o.p(f,c):(o=Lf(f),o.c(),o.m(e,null)):o&&(o.d(1),o=null),c&32&&n!==(n=f[5]==1||f[5]==2)&&(e.required=n)},d(f){f&&N(e),i&&i.d(),o&&o.d()}}}function q_(t){let e,l;return{c(){e=p("input"),r(e,"name","ss"),r(e,"type","text"),r(e,"pattern",In),r(e,"class","in-s"),e.required=l=t[5]==1||t[5]==2},m(n,i){D(n,e,i)},p(n,i){i&32&&l!==(l=n[5]==1||n[5]==2)&&(e.required=l)},d(n){n&&N(e)}}}function Of(t){let e;return{c(){e=p("option"),e.textContent="Scanning...",e.__value="",U(e,e.__value),e.selected=!0,e.disabled=!0},m(l,n){D(l,e,n)},d(l){l&&N(e)}}}function Lf(t){var i;let e,l=rt((i=t[3])==null?void 0:i.n),n=[];for(let o=0;ot[8].call(h)),r(m,"class","my-3"),r(y,"name","sh"),r(y,"type","text"),r(y,"class","in-s"),r(y,"maxlength","32"),r(y,"pattern",Si),r(y,"placeholder","Optional, ex.: ams-reader"),r(y,"autocomplete","off"),r(H,"type","checkbox"),r(H,"name","sm"),H.__value="static",U(H,H.__value),r(H,"class","rounded mb-1"),r(W,"class","my-3"),r(fe,"type","submit"),r(fe,"class","btn-pri"),r(ae,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Ie,qe){D(Ie,e,qe),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(a,f),s(n,c),s(n,m),s(m,v),s(m,b),s(m,d),s(m,h),s(h,g),s(g,C),s(h,I),s(I,E),S&&S.m(h,null),ze(h,t[5],!0),s(n,O),P&&P.m(n,null),s(n,L),s(n,z),s(z,B),s(z,T),s(z,y),U(y,t[0].hostname),s(n,J),s(n,W),s(W,Y),s(Y,H),H.checked=t[4],s(Y,G),s(Y,Q),s(W,Z),F&&F.m(W,null),s(n,K),A&&A.m(n,null),s(n,ee),s(n,ae),s(ae,fe),s(fe,pe),D(Ie,ie,qe),Pe(_e,Ie,qe),oe=!0,me||(we=[ue(h,"change",t[8]),ue(y,"input",t[10]),ue(H,"change",t[11]),ue(n,"submit",dn(t[7]))],me=!0)},p(Ie,[qe]){var tt,lt,ct,Dt,ht,_t,at,vt,Bt,et,ye,We;(!oe||qe&2)&&u!==(u=(((tt=Ie[1].setup)==null?void 0:tt.title)??"Setup")+"")&&q(f,u),(!oe||qe&2)&&_!==(_=(((ct=(lt=Ie[1].conf)==null?void 0:lt.connection)==null?void 0:ct.title)??"Connection")+"")&&q(v,_),(!oe||qe&2)&&k!==(k=(((ht=(Dt=Ie[1].conf)==null?void 0:Dt.connection)==null?void 0:ht.wifi)??"Connect to WiFi")+"")&&q(C,k),(!oe||qe&2)&&R!==(R=(((at=(_t=Ie[1].conf)==null?void 0:_t.connection)==null?void 0:at.ap)??"Standalone access point")+"")&&q(E,R),Ie[0].if&&Ie[0].if.eth?S?S.p(Ie,qe):(S=Af(Ie),S.c(),S.m(h,null)):S&&(S.d(1),S=null),qe&32&&ze(h,Ie[5]),Ie[5]==1||Ie[5]==2?P?P.p(Ie,qe):(P=Rf(Ie),P.c(),P.m(n,L)):P&&(P.d(1),P=null),(!oe||qe&2)&&V!==(V=(((Bt=(vt=Ie[1].conf)==null?void 0:vt.general)==null?void 0:Bt.hostname)??"Hostname")+"")&&q(B,V),qe&1&&y.value!==Ie[0].hostname&&U(y,Ie[0].hostname),qe&16&&(H.checked=Ie[4]),(!oe||qe&2)&&$!==($=(((et=Ie[1].setup)==null?void 0:et.static)??"Static IP")+"")&&q(Q,$),Ie[4]?F?(F.p(Ie,qe),qe&16&&X(F,1)):(F=yf(Ie),F.c(),X(F,1),F.m(W,null)):F&&(mt(),te(F,1,1,()=>{F=null}),pt()),Ie[4]?A?A.p(Ie,qe):(A=Bf(Ie),A.c(),A.m(n,ee)):A&&(A.d(1),A=null),(!oe||qe&2)&&ne!==(ne=(((ye=Ie[1].btn)==null?void 0:ye.save)??"Save")+"")&&q(pe,ne);const Fe={};qe&64&&(Fe.active=Ie[6]),qe&2&&(Fe.message=((We=Ie[1].setup)==null?void 0:We.mask)??"Saving"),_e.$set(Fe)},i(Ie){oe||(X(F),X(_e.$$.fragment,Ie),oe=!0)},o(Ie){te(F),te(_e.$$.fragment,Ie),oe=!1},d(Ie){Ie&&(N(e),N(ie)),S&&S.d(),P&&P.d(),F&&F.d(),A&&A.d(),Se(_e,Ie),me=!1,Wt(we)}}}function R_(t,e,l){let n={};Il.subscribe(g=>{l(1,n=g)});let i=!1,o={};mo.subscribe(g=>{l(3,o=g)});let{sysinfo:a={}}=e,u=!1,f=1,c=!1;function m(g){hl.update(k=>(k.trying=g,k))}async function _(g){l(6,c=!0);const k=new FormData(g.target),C=new URLSearchParams;for(let E of k){const[O,L]=E;C.append(O,L)}let R=await(await fetch("save",{method:"POST",body:C})).json();l(6,c=!1),hl.update(E=>(E.hostname=k.get("sh"),E.usrcfg=R.success,E.booting=R.reboot,u&&(E.net.ip=k.get("si"),E.net.mask=k.get("su"),E.net.gw=k.get("sg"),E.net.dns1=k.get("sd")),R.reboot&&setTimeout(ni,5e3,a,m),E))}function v(){f=Zt(this),l(5,f)}function b(){i=this.checked,l(2,i)}function d(){a.hostname=this.value,l(0,a)}function h(){u=this.checked,l(4,u)}return t.$$set=g=>{"sysinfo"in g&&l(0,a=g.sysinfo)},[a,n,i,o,u,f,c,_,v,b,d,h]}class O_ extends Rt{constructor(e){super(),At(this,e,R_,A_,Nt,{sysinfo:0})}}function L_(t){var B,T,y,J;let e,l,n,i=(((B=t[2].upload)==null?void 0:B.title)??"Upload")+"",o,a,u,f,c,m=(((T=t[2].upload)==null?void 0:T.desc)??"")+"",_,v,b,d,h,g,k,C,I=(((y=t[2].btn)==null?void 0:y.upload)??"Upload")+"",R,E,O,L,z,V;return O=new dl({props:{active:t[3],message:((J=t[2].upload)==null?void 0:J.mask)??"Uploading"}}),{c(){e=p("div"),l=p("div"),n=p("strong"),o=M(i),a=w(),u=M(t[1]),f=w(),c=p("p"),_=M(m),v=w(),b=p("form"),d=p("input"),h=w(),g=p("div"),k=p("button"),C=p("p"),R=M(I),E=w(),Me(O.$$.fragment),r(c,"class","mb-4"),r(d,"name","file"),r(d,"type","file"),r(C,"class","mb-4"),r(k,"type","submit"),r(k,"class","btn-pri"),r(g,"class","w-full text-right mt-4"),r(b,"action",t[0]),r(b,"enctype","multipart/form-data"),r(b,"method","post"),r(b,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(W,Y){D(W,e,Y),s(e,l),s(l,n),s(n,o),s(n,a),s(n,u),s(l,f),s(l,c),s(c,_),s(l,v),s(l,b),s(b,d),s(b,h),s(b,g),s(g,k),s(k,C),s(C,R),D(W,E,Y),Pe(O,W,Y),L=!0,z||(V=ue(b,"submit",t[4]),z=!0)},p(W,[Y]){var G,$,Q,Z;(!L||Y&4)&&i!==(i=(((G=W[2].upload)==null?void 0:G.title)??"Upload")+"")&&q(o,i),(!L||Y&2)&&q(u,W[1]),(!L||Y&4)&&m!==(m=((($=W[2].upload)==null?void 0:$.desc)??"")+"")&&q(_,m),(!L||Y&4)&&I!==(I=(((Q=W[2].btn)==null?void 0:Q.upload)??"Upload")+"")&&q(R,I),(!L||Y&1)&&r(b,"action",W[0]);const H={};Y&8&&(H.active=W[3]),Y&4&&(H.message=((Z=W[2].upload)==null?void 0:Z.mask)??"Uploading"),O.$set(H)},i(W){L||(X(O.$$.fragment,W),L=!0)},o(W){te(O.$$.fragment,W),L=!1},d(W){W&&(N(e),N(E)),Se(O,W),z=!1,V()}}}function F_(t,e,l){let{action:n}=e,{title:i}=e,o={};Il.subscribe(f=>{l(2,o=f)});let a=!1;const u=()=>l(3,a=!0);return t.$$set=f=>{"action"in f&&l(0,n=f.action),"title"in f&&l(1,i=f.title)},[n,i,o,a,u]}class go extends Rt{constructor(e){super(),At(this,e,F_,L_,Nt,{action:0,title:1})}}function y_(t){var _e,oe,me,we,S,P,F;let e,l,n,i,o=(((_e=t[1].consent)==null?void 0:_e.title)??"Consents")+"",a,u,f,c,m,_=(((oe=t[1].consent)==null?void 0:oe.one_click)??"One-click")+"",v,b,d,h,g=(((me=t[1].consent)==null?void 0:me.read_more)??"Read more")+"",k,C,I,R,E,O,L,z=(((we=t[1].consent)==null?void 0:we.yes)??"Yes")+"",V,B,T,y,J,W,Y=(((S=t[1].consent)==null?void 0:S.no)??"No")+"",H,G,$,Q,Z,K=(((P=t[1].btn)==null?void 0:P.save)??"Save")+"",ee,ae,fe,ne,pe,ie;return fe=new dl({props:{active:t[2],message:((F=t[1].consent)==null?void 0:F.mask_saving)??"Saving"}}),{c(){e=p("div"),l=p("div"),n=p("form"),i=p("div"),a=M(o),u=w(),f=p("hr"),c=w(),m=p("div"),v=M(_),b=p("br"),d=w(),h=p("a"),k=M(g),C=p("br"),I=w(),R=p("label"),E=p("input"),L=w(),V=M(z),B=w(),T=p("label"),y=p("input"),W=w(),H=M(Y),G=p("br"),$=w(),Q=p("div"),Z=p("button"),ee=M(K),ae=w(),Me(fe.$$.fragment),r(h,"href","https://github.com/UtilitechAS/amsreader-firmware/wiki/Data-collection-on-one-click-firmware-upgrade"),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r(E,"type","radio"),r(E,"name","sf"),E.value=1,E.checked=O=t[0].fwconsent===1,r(E,"class","rounded m-2"),E.required=!0,r(y,"type","radio"),r(y,"name","sf"),y.value=2,y.checked=J=t[0].fwconsent===2,r(y,"class","rounded m-2"),y.required=!0,r(m,"class","my-3"),r(Z,"type","submit"),r(Z,"class","btn-pri"),r(Q,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(A,j){D(A,e,j),s(e,l),s(l,n),s(n,i),s(i,a),s(n,u),s(n,f),s(n,c),s(n,m),s(m,v),s(m,b),s(m,d),s(m,h),s(h,k),s(m,C),s(m,I),s(m,R),s(R,E),s(R,L),s(R,V),s(m,B),s(m,T),s(T,y),s(T,W),s(T,H),s(m,G),s(n,$),s(n,Q),s(Q,Z),s(Z,ee),D(A,ae,j),Pe(fe,A,j),ne=!0,pe||(ie=ue(n,"submit",dn(t[3])),pe=!0)},p(A,[j]){var re,he,be,x,de,ve,De;(!ne||j&2)&&o!==(o=(((re=A[1].consent)==null?void 0:re.title)??"Consents")+"")&&q(a,o),(!ne||j&2)&&_!==(_=(((he=A[1].consent)==null?void 0:he.one_click)??"One-click")+"")&&q(v,_),(!ne||j&2)&&g!==(g=(((be=A[1].consent)==null?void 0:be.read_more)??"Read more")+"")&&q(k,g),(!ne||j&1&&O!==(O=A[0].fwconsent===1))&&(E.checked=O),(!ne||j&2)&&z!==(z=(((x=A[1].consent)==null?void 0:x.yes)??"Yes")+"")&&q(V,z),(!ne||j&1&&J!==(J=A[0].fwconsent===2))&&(y.checked=J),(!ne||j&2)&&Y!==(Y=(((de=A[1].consent)==null?void 0:de.no)??"No")+"")&&q(H,Y),(!ne||j&2)&&K!==(K=(((ve=A[1].btn)==null?void 0:ve.save)??"Save")+"")&&q(ee,K);const le={};j&4&&(le.active=A[2]),j&2&&(le.message=((De=A[1].consent)==null?void 0:De.mask_saving)??"Saving"),fe.$set(le)},i(A){ne||(X(fe.$$.fragment,A),ne=!0)},o(A){te(fe.$$.fragment,A),ne=!1},d(A){A&&(N(e),N(ae)),Se(fe,A),pe=!1,ie()}}}function B_(t,e,l){let{basepath:n="/"}=e,{sysinfo:i={}}=e,o={};Il.subscribe(f=>{l(1,o=f)});let a=!1;async function u(f){l(2,a=!0);const c=new FormData(f.target),m=new URLSearchParams;for(let b of c){const[d,h]=b;m.append(d,h)}let v=await(await fetch("save",{method:"POST",body:m})).json();l(2,a=!1),hl.update(b=>(b.fwconsent=c.sf===!0?1:c.sf===!1?2:0,b.booting=v.reboot,b)),nn(n)}return t.$$set=f=>{"basepath"in f&&l(4,n=f.basepath),"sysinfo"in f&&l(0,i=f.sysinfo)},[i,o,a,u,n]}class U_ extends Rt{constructor(e){super(),At(this,e,B_,y_,Nt,{basepath:4,sysinfo:0})}}function Uf(t,e,l){const n=t.slice();return n[32]=e[l],n[33]=e,n[34]=l,n}function zf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function jf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Hf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Wf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Vf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Gf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Kf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Yf(t,e,l){const n=t.slice();return n[35]=e[l],n[37]=l,n}function Qf(t){let e,l=rt(t[1].o),n=[];for(let i=0;i0?"text-green-600":"text-gray-300"),r(Fe,"class",lt=t[34]l&&(t.d=l)}function j_(t,e,l){let{basepath:n="/"}=e,i={};Il.subscribe(Q=>{l(0,i=Q)});let o=["mo","tu","we","th","fr","sa","su"],a={},u=!0,f=!1;nu.subscribe(Q=>{Q.o&&(l(1,a=Q),l(2,u=!1))}),S1();async function c(Q){l(3,f=!0);const Z=new URLSearchParams;Z.append("r","true"),Z.append("rc",a.o.length),a.o.forEach(function(ee,ae){Z.append("rt"+ae,ee.t),Z.append("rn"+ae,ee.n),Z.append("rd"+ae,ee.d),Z.append("ra"+ae,ee.a),Z.append("rh"+ae,ee.h),Z.append("rv"+ae,ee.v),Z.append("rsm"+ae,ee.s.m),Z.append("rsd"+ae,ee.s.d),Z.append("rem"+ae,ee.e.m),Z.append("red"+ae,ee.e.d)}),await(await fetch("save",{method:"POST",body:Z})).json(),l(3,f=!1),nn(n+"configuration")}let m=function(Q,Z){return Q.includes(Z)?Q=Q.filter(function(K){return K!==Z}):Q.push(Z),Q},_=function(){let Q=a.o;Q.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),l(1,a.o=Q,a)},v=function(Q){let Z=a.o;Z.splice(Q,1),l(1,a.o=Z,a)},b=function(Q){if(Q<=0)return;let Z=a.o;var K=Z[Q];Z[Q]=Z[Q-1],Z[Q-1]=K,l(1,a.o=Z,a)},d=function(Q){let Z=a.o;if(!(Q>=Z.length-1)){var K=Z[Q];Z[Q]=Z[Q+1],Z[Q+1]=K,l(1,a.o=Z,a)}};function h(Q,Z){Q[Z].n=this.value,l(1,a)}function g(Q,Z){Q[Z].d=Zt(this),l(1,a)}function k(Q,Z){Q[Z].t=Zt(this),l(1,a)}function C(Q,Z){Q[Z].v=Ue(this.value),l(1,a)}const I=(Q,Z,K,ee)=>l(1,K[ee].a=m(Q.a,Z),a),R=(Q,Z,K,ee)=>l(1,K[ee].h=m(Q.h,Z),a),E=(Q,Z,K,ee)=>l(1,K[ee].h=m(Q.h,Z+8),a),O=(Q,Z,K,ee)=>l(1,K[ee].h=m(Q.h,Z+16),a);function L(Q,Z){Q[Z].s.d=Zt(this),l(1,a)}function z(Q,Z){Q[Z].s.m=Zt(this),l(1,a)}const V=Q=>ir(Q.s,Q.s.m);function B(Q,Z){Q[Z].e.d=Zt(this),l(1,a)}function T(Q,Z){Q[Z].e.m=Zt(this),l(1,a)}const y=Q=>ir(Q.e,Q.e.m),J=Q=>b(Q),W=Q=>b(Q),Y=Q=>d(Q),H=Q=>d(Q),G=Q=>v(Q),$=Q=>v(Q);return t.$$set=Q=>{"basepath"in Q&&l(11,n=Q.basepath)},[i,a,u,f,o,c,m,_,v,b,d,n,h,g,k,C,I,R,E,O,L,z,V,B,T,y,J,W,Y,H,G,$]}class H_ extends Rt{constructor(e){super(),At(this,e,j_,z_,Nt,{basepath:11},null,[-1,-1])}}function or(t,e,l){const n=t.slice();return n[13]=e[l],n[14]=e,n[15]=l,n}function sr(t,e,l){const n=t.slice();return n[13]=e[l],n[16]=e,n[17]=l,n}function ar(t){let e,l,n,i=rt(t[1]),o=[];for(let a=0;a{l(3,u=g)});let f=!1,c,m;async function _(){if(confirm("Clear all data?"))for(let g in i)(g.startsWith("i")||g.startsWith("e"))&&l(0,i[g]=0,i)}let v=!1;async function b(g){l(5,v=!0);const k=new FormData(g.target),C=new URLSearchParams;for(let R of k){const[E,O]=R;C.append(E,O)}await(await fetch(o,{method:"POST",body:C})).json(),l(5,v=!1),nn(a)}function d(g){i[g.key]=Ue(this.value),l(0,i)}function h(g){i[g.key]=Ue(this.value),l(0,i)}return t.$$set=g=>{"prefix"in g&&l(8,n=g.prefix),"data"in g&&l(0,i=g.data),"url"in g&&l(9,o=g.url),"basepath"in g&&l(10,a=g.basepath)},t.$$.update=()=>{if(t.$$.dirty&263){l(1,c=[]),l(2,m=[]);for(let g in i){let k=[];g.startsWith("i")?k=c:g.startsWith("e")&&(k=m,i[g]&&l(4,f=!0)),k.push({key:g,name:n+" "+g.substring(1),value:i[g]})}}},[i,c,m,u,f,v,_,b,n,o,a,d,h]}class ru extends Rt{constructor(e){super(),At(this,e,V_,W_,Nt,{prefix:8,data:0,url:9,basepath:10})}}function G_(t){let e,l;return e=new C1({props:{data:t[7],sysinfo:t[8],importPrices:t[1],exportPrices:t[2],dayPlot:t[3],monthPlot:t[4],temperatures:t[5],translations:t[6],tariffData:t[9]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&128&&(o.data=n[7]),i&256&&(o.sysinfo=n[8]),i&2&&(o.importPrices=n[1]),i&4&&(o.exportPrices=n[2]),i&8&&(o.dayPlot=n[3]),i&16&&(o.monthPlot=n[4]),i&32&&(o.temperatures=n[5]),i&64&&(o.translations=n[6]),i&512&&(o.tariffData=n[9]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function K_(t){let e,l;return e=new u_({props:{sysinfo:t[8],basepath:t[0],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Y_(t){let e,l;return e=new H_({props:{basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Q_(t){let e,l;return e=new P_({props:{sysinfo:t[8],data:t[7]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&128&&(o.data=n[7]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function X_(t){let e,l;return e=new go({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p:He,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function Z_(t){let e,l;return e=new go({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p:He,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function J_(t){let e,l;return e=new go({props:{title:"private key",action:"/mqtt-key"}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p:He,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function $_(t){let e,l;return e=new U_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function x_(t){let e,l;return e=new O_({props:{sysinfo:t[8]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function em(t){let e,l;return e=new D_({props:{sysinfo:t[8],basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.sysinfo=n[8]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function tm(t){let e,l;return e=new ru({props:{prefix:"UTC Hour",data:t[3],url:"/dayplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&8&&(o.data=n[3]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function lm(t){let e,l;return e=new ru({props:{prefix:"Day",data:t[4],url:"/monthplot",basepath:t[0]}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&16&&(o.data=n[4]),i&1&&(o.basepath=n[0]),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function nm(t){let e,l,n,i,o,a,u,f,c,m,_,v,b,d,h,g,k,C,I,R,E,O,L,z,V,B;return e=new kc({props:{data:t[7],basepath:t[0]}}),n=new Pl({props:{path:"/",$$slots:{default:[G_]},$$scope:{ctx:t}}}),o=new Pl({props:{path:"/configuration",$$slots:{default:[K_]},$$scope:{ctx:t}}}),u=new Pl({props:{path:"/priceconfig",$$slots:{default:[Y_]},$$scope:{ctx:t}}}),c=new Pl({props:{path:"/status",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),_=new Pl({props:{path:"/mqtt-ca",$$slots:{default:[X_]},$$scope:{ctx:t}}}),b=new Pl({props:{path:"/mqtt-cert",$$slots:{default:[Z_]},$$scope:{ctx:t}}}),h=new Pl({props:{path:"/mqtt-key",$$slots:{default:[J_]},$$scope:{ctx:t}}}),k=new Pl({props:{path:"/consent",$$slots:{default:[$_]},$$scope:{ctx:t}}}),I=new Pl({props:{path:"/setup",$$slots:{default:[x_]},$$scope:{ctx:t}}}),E=new Pl({props:{path:"/vendor",$$slots:{default:[em]},$$scope:{ctx:t}}}),L=new Pl({props:{path:"/edit-day",$$slots:{default:[tm]},$$scope:{ctx:t}}}),V=new Pl({props:{path:"/edit-month",$$slots:{default:[lm]},$$scope:{ctx:t}}}),{c(){Me(e.$$.fragment),l=w(),Me(n.$$.fragment),i=w(),Me(o.$$.fragment),a=w(),Me(u.$$.fragment),f=w(),Me(c.$$.fragment),m=w(),Me(_.$$.fragment),v=w(),Me(b.$$.fragment),d=w(),Me(h.$$.fragment),g=w(),Me(k.$$.fragment),C=w(),Me(I.$$.fragment),R=w(),Me(E.$$.fragment),O=w(),Me(L.$$.fragment),z=w(),Me(V.$$.fragment)},m(T,y){Pe(e,T,y),D(T,l,y),Pe(n,T,y),D(T,i,y),Pe(o,T,y),D(T,a,y),Pe(u,T,y),D(T,f,y),Pe(c,T,y),D(T,m,y),Pe(_,T,y),D(T,v,y),Pe(b,T,y),D(T,d,y),Pe(h,T,y),D(T,g,y),Pe(k,T,y),D(T,C,y),Pe(I,T,y),D(T,R,y),Pe(E,T,y),D(T,O,y),Pe(L,T,y),D(T,z,y),Pe(V,T,y),B=!0},p(T,y){const J={};y&128&&(J.data=T[7]),y&1&&(J.basepath=T[0]),e.$set(J);const W={};y&5118&&(W.$$scope={dirty:y,ctx:T}),n.$set(W);const Y={};y&4481&&(Y.$$scope={dirty:y,ctx:T}),o.$set(Y);const H={};y&4097&&(H.$$scope={dirty:y,ctx:T}),u.$set(H);const G={};y&4480&&(G.$$scope={dirty:y,ctx:T}),c.$set(G);const $={};y&4096&&($.$$scope={dirty:y,ctx:T}),_.$set($);const Q={};y&4096&&(Q.$$scope={dirty:y,ctx:T}),b.$set(Q);const Z={};y&4096&&(Z.$$scope={dirty:y,ctx:T}),h.$set(Z);const K={};y&4353&&(K.$$scope={dirty:y,ctx:T}),k.$set(K);const ee={};y&4352&&(ee.$$scope={dirty:y,ctx:T}),I.$set(ee);const ae={};y&4353&&(ae.$$scope={dirty:y,ctx:T}),E.$set(ae);const fe={};y&4105&&(fe.$$scope={dirty:y,ctx:T}),L.$set(fe);const ne={};y&4113&&(ne.$$scope={dirty:y,ctx:T}),V.$set(ne)},i(T){B||(X(e.$$.fragment,T),X(n.$$.fragment,T),X(o.$$.fragment,T),X(u.$$.fragment,T),X(c.$$.fragment,T),X(_.$$.fragment,T),X(b.$$.fragment,T),X(h.$$.fragment,T),X(k.$$.fragment,T),X(I.$$.fragment,T),X(E.$$.fragment,T),X(L.$$.fragment,T),X(V.$$.fragment,T),B=!0)},o(T){te(e.$$.fragment,T),te(n.$$.fragment,T),te(o.$$.fragment,T),te(u.$$.fragment,T),te(c.$$.fragment,T),te(_.$$.fragment,T),te(b.$$.fragment,T),te(h.$$.fragment,T),te(k.$$.fragment,T),te(I.$$.fragment,T),te(E.$$.fragment,T),te(L.$$.fragment,T),te(V.$$.fragment,T),B=!1},d(T){T&&(N(l),N(i),N(a),N(f),N(m),N(v),N(d),N(g),N(C),N(R),N(O),N(z)),Se(e,T),Se(n,T),Se(o,T),Se(u,T),Se(c,T),Se(_,T),Se(b,T),Se(h,T),Se(k,T),Se(I,T),Se(E,T),Se(L,T),Se(V,T)}}}function cr(t){let e,l,n,i;const o=[om,im],a=[];function u(f,c){return f[8].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Qt()},m(f,c){a[e].m(f,c),D(f,n,c),i=!0},p(f,c){let m=e;e=u(f),e===m?a[e].p(f,c):(mt(),te(a[m],1,1,()=>{a[m]=null}),pt(),l=a[e],l?l.p(f,c):(l=a[e]=o[e](f),l.c()),X(l,1),l.m(n.parentNode,n))},i(f){i||(X(l),i=!0)},o(f){te(l),i=!1},d(f){f&&N(n),a[e].d(f)}}}function im(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p:He,i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function om(t){let e,l;return e=new dl({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[8].trying}}),{c(){Me(e.$$.fragment)},m(n,i){Pe(e,n,i),l=!0},p(n,i){const o={};i&256&&(o.message="Device is booting, please wait. Trying to reach it on "+n[8].trying),e.$set(o)},i(n){l||(X(e.$$.fragment,n),l=!0)},o(n){te(e.$$.fragment,n),l=!1},d(n){Se(e,n)}}}function sm(t){let e,l,n,i;l=new yr({props:{basepath:t[0],$$slots:{default:[nm]},$$scope:{ctx:t}}});let o=t[8].booting&&cr(t);return{c(){e=p("div"),Me(l.$$.fragment),n=w(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(a,u){D(a,e,u),Pe(l,e,null),s(e,n),o&&o.m(e,null),i=!0},p(a,[u]){const f={};u&1&&(f.basepath=a[0]),u&5119&&(f.$$scope={dirty:u,ctx:a}),l.$set(f),a[8].booting?o?(o.p(a,u),u&256&&X(o,1)):(o=cr(a),o.c(),X(o,1),o.m(e,null)):o&&(mt(),te(o,1,1,()=>{o=null}),pt())},i(a){i||(X(l.$$.fragment,a),X(o),i=!0)},o(a){te(l.$$.fragment,a),te(o),i=!1},d(a){a&&N(e),Se(l),o&&o.d()}}}function am(t,e,l){let n=document.getElementsByTagName("base")[0].getAttribute("href");n||(n="/");let i;Vr.subscribe(h=>{l(1,i=h)});let o;Gr.subscribe(h=>{l(2,o=h)});let a;Yr.subscribe(h=>{l(3,a=h)});let u;Qr.subscribe(h=>{l(4,u=h)});let f;Xr.subscribe(h=>{l(5,f=h)});let c={};Il.subscribe(h=>{l(6,c=h)});let m,_={},v={},b;hl.subscribe(h=>{var g;l(8,v=h),v.vndcfg===!1?nn(n+"vendor"):v.usrcfg===!1?nn(n+"setup"):v.fwconsent===0&&nn(n+"consent"),v.ui.k===1?document.documentElement.classList.add("dark"):v.ui.k===0?document.documentElement.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),v.ui.lang&&v.ui.lang!=((g=c==null?void 0:c.language)==null?void 0:g.code)&&$r(v.ui.lang),v.version&&b&&v.version!=b&&window.location.reload(),b=v.version,m&&clearTimeout(m),m=setTimeout(Di,!_||!_.u||_.u<30||v!=null&&v.upgrading?1e4:3e5)}),z0.subscribe(h=>{l(7,_=h),u1(h)});let d={};return Jr.subscribe(h=>{l(9,d=h)}),Zr(),[n,i,o,a,u,f,c,_,v,d]}class fm extends Rt{constructor(e){super(),At(this,e,am,sm,Nt,{})}}new fm({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/lib/PriceConfig.svelte b/lib/SvelteUi/app/src/lib/PriceConfig.svelte index f513e172..07b01c55 100644 --- a/lib/SvelteUi/app/src/lib/PriceConfig.svelte +++ b/lib/SvelteUi/app/src/lib/PriceConfig.svelte @@ -97,6 +97,16 @@ configuration.o = arr }; + function daysInMonth(month) { + if (month === 0) return 31; + return new Date(2024, month, 0).getDate(); + } + + function clampDay(dateObj, month) { + const max = daysInMonth(month); + if (dateObj.d > max) dateObj.d = max; + } + let moveDown = function(rn) { let arr = configuration.o; if(rn >= arr.length-1) return; @@ -163,11 +173,11 @@
- clampDay(c.s, c.s.m)}> {#each {length: 12} as _,i} @@ -176,11 +186,11 @@ - clampDay(c.e, c.e.m)}> {#each {length: 12} as _,i}