diff --git a/lib/AmsData/include/OBIScodes.h b/lib/AmsData/include/OBIScodes.h index 4e5a7e29..7d5d1acc 100644 --- a/lib/AmsData/include/OBIScodes.h +++ b/lib/AmsData/include/OBIScodes.h @@ -37,6 +37,8 @@ struct OBIS_t { const OBIS_code_t OBIS_NULL PROGMEM = { 0, 0, 0 }; +const OBIS_code_t OBIS_FIRMWARE_VERSION PROGMEM = { 0, 2, 0 }; + const OBIS_code_t OBIS_VERSION PROGMEM = { 0, 2, 129 }; const OBIS_code_t OBIS_METER_MODEL PROGMEM = { 96, 1, 1 }; const OBIS_code_t OBIS_METER_MODEL_2 PROGMEM = { 96, 1, 7 }; diff --git a/lib/SvelteUi/app/dist/index.js b/lib/SvelteUi/app/dist/index.js index d412c847..5a69c341 100644 --- a/lib/SvelteUi/app/dist/index.js +++ b/lib/SvelteUi/app/dist/index.js @@ -1,22 +1,14 @@ -(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function _e(){}function sl(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function wa(){return Object.create(null)}function Ge(t){t.forEach(tc)}function co(t){return typeof t=="function"}function $e(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ps;function Xs(t,e){return ps||(ps=document.createElement("a")),ps.href=e,t===ps.href}function t0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return _e;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ri(t){let e;return mo(t,l=>e=l)(),e}function _l(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?sl(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ms(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 n0=["width","height"];function ai(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&&n0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function i0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function s0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~l0.indexOf(l)?s0(t,e):X(t,e)}function ne(t,e){t.value=e??""}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Se(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=le(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function a0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function ya(t,e){return new t(e)}let Si;function Ci(t){Si=t}function Ti(){if(!Si)throw new Error("Function called outside component initialization");return Si}function sc(t){Ti().$$.on_mount.push(t)}function u0(t){Ti().$$.on_destroy.push(t)}function f0(){const t=Ti();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=a0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Ti().$$.context.set(t,e),e}function Hl(t){return Ti().$$.context.get(t)}const ni=[],ks=[];let ii=[];const Ca=[],oc=Promise.resolve();let Zs=!1;function rc(){Zs||(Zs=!0,oc.then(ac))}function c0(){return rc(),oc}function Ke(t){ii.push(t)}const zs=new Set;let ti=0;function ac(){if(ti!==0)return;const t=Si;do{try{for(;tit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ii=e}const hs=new Set;let rn;function Ie(){rn={r:0,c:[],p:rn}}function Oe(){rn.r||Ge(rn.c),rn=rn.p}function O(t,e){t&&t.i&&(hs.delete(t),t.i(e))}function B(t,e,l,n){if(t&&t.o){if(hs.has(t))return;hs.add(t),rn.c.push(()=>{hs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function uc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Ma(t){return typeof t=="object"&&t!==null?t:{}}function re(t){t&&t.c()}function se(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Ke(()=>{const u=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ge(u),t.$$.on_mount=[]}),o.forEach(Ke)}function oe(t,e){const l=t.$$;l.fragment!==null&&(p0(l.after_update),Ge(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function _0(t,e){t.$$.dirty[0]===-1&&(ni.push(t),rc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=d.length?d[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=v)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](v),p&&_0(t,_)),h}):[],f.update(),p=!0,Ge(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=i0(e.target);f.fragment&&f.fragment.l(_),_.forEach(w)}else f.fragment&&f.fragment.c();e.intro&&O(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),ac()}Ci(c)}class De{$destroy(){oe(this,1),this.$destroy=_e}$on(e,l){if(!co(l))return _e;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&&!t0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Sa=t=>typeof t>"u",fc=t=>typeof t=="function",cc=t=>typeof t=="number";function d0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mc(){let t=0;return()=>t++}function v0(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function pc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const _c=(t,e)=>t?{}:{style:e},Js=t=>({"aria-hidden":"true",..._c(t,"display:none;")}),li=[];function dc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=_e){let l;const n=new Set;function i(a){if($e(t,a)&&(t=a,l)){const c=!li.length;for(const f of n)f[1](),li.push(f,t);if(c){for(let f=0;f{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function h0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return dc(l,u=>{let a=!1;const c=[];let f=0,p=_e;const _=()=>{if(f)return;p();const d=e(n?c[0]:c,u);o?u(d):p=co(d)?d:_e},h=i.map((d,v)=>mo(d,g=>{c[v]=g,f&=~(1<{f|=1<`@@svnav-ctx__${t}`,xs=$i("LOCATION"),ui=$i("ROUTER"),vc=$i("ROUTE"),b0=$i("ROUTE_PARAMS"),g0=$i("FOCUS_ELEM"),hc=/^:(.+)/,ki=(t,e,l)=>t.substr(e,l),eo=(t,e)=>ki(t,0,e.length)===e,k0=t=>t==="",w0=t=>hc.test(t),bc=t=>t[0]==="*",y0=t=>t.replace(/\*.*$/,""),gc=t=>t.replace(/(^\/+|\/+$)/g,"");function vl(t,e=!1){const l=gc(t).split("/");return e?l.filter(Boolean):l}const Gs=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${gc(t)}`;function Ni(...t){const e=n=>vl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ss=2,mn=3,C0=4,kc=5,M0=6,wc=7,S0=8,T0=9,yc=10,Cc=11,$0={[go]:"Link",[Ss]:"Route",[mn]:"Router",[C0]:"useFocus",[kc]:"useLocation",[M0]:"useMatch",[wc]:"useNavigate",[S0]:"useParams",[T0]:"useResolvable",[yc]:"useResolve",[Cc]:"navigate"},ko=t=>$0[t];function N0(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function A0(t,e,l,n){const i=l&&N0(n||t,l),o=i?` - -Occurred in: ${i}`:"",u=ko(t),a=fc(e)?e(u):e;return`<${u}> ${a}${o}`}const Mc=t=>(...e)=>t(A0(...e)),Sc=Mc(t=>{throw new Error(t)}),ws=Mc(console.warn),Ta=4,E0=3,P0=2,D0=1,I0=1;function O0(t,e){const l=t.default?0:vl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ta,k0(i)?o+=I0:w0(i)?o+=P0:bc(i)?o-=Ta+D0:o+=E0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(O0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Tc(t,e){let l,n;const[i]=e.split("?"),o=vl(i),u=o[0]==="",a=R0(t);for(let c=0,f=a.length;c({...p,params:h,uri:$});if(p.default){n=d(e);continue}const v=vl(p.fullPath),g=Math.max(o.length,v.length);let E=0;for(;E{f===".."?c.pop():f!=="."&&c.push(f)}),Gs(`/${c.join("/")}`,n)}function $a(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=vl(e,!0),a=vl(l,!0);for(;u.length;)u[0]!==a[0]&&Sc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ni(...a),hash:n,search:i,state:o}}const Na=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Na(ki(t,l)):"",u=i?ki(t,0,l):t,a=n?Na(ki(u,e)):"";return{pathname:(n?ki(u,0,e):u)||"/",search:a,hash:o}},F0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function q0(t,e,l){return Ni(l,L0(t,e))}function B0(t,e){const l=bo(y0(t)),n=vl(l,!0),i=vl(e,!0).slice(0,n.length),o=$c({fullPath:l},Ni(...i));return o&&o.uri}const Vs="POP",U0="PUSH",j0="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function H0(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=pc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?j0:U0,cc(o))u&&ws(Cc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const f={...a,_key:v0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Ks(t),i()}}}function Ys(t,e){return{...wo(e),state:t}}function W0(t="/"){let e=0,l=[Ys(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(Ys(n,o))},replaceState(n,i,o){l[e]=Ys(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const z0=!!(!Wl&&window.document&&window.document.createElement),G0=!Wl&&window.location.origin==="null",Nc=H0(z0&&!G0?window:W0()),{navigate:si}=Nc;let Tl=null,Ac=!0;function V0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nTl.level||t.level===Tl.level&&V0(t.routerId,Tl.routerId))&&(Tl=t)}function Y0(){Tl=null}function Q0(){Ac=!1}function Aa(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=pc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function X0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Z0(t){return/^H[1-6]$/i.test(t.tagName)}function Ea(t,e=document){return e.querySelector(t)}function J0(t){let l=Ea(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!X0(l,t);){if(Z0(l))return l;const n=Ea("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function x0(t){Promise.resolve(ri(t.focusElement)).then(e=>{const l=e||J0(t.id);l||ws(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Aa(l)&&Aa(document.documentElement)})}const e1=(t,e,l)=>(n,i)=>c0().then(()=>{if(!Tl||Ac){Q0();return}if(n&&x0(Tl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Tl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},ri(l));Promise.resolve(p).then(_=>{e.set(_)})}Y0()}),t1="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 l1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},_c(t[6],t1)],i={};for(let o=0;o`Navigated to ${x.uri}`,announcements:!0,...v},$=p,M=bo(p),P=Hl(xs),F=Hl(ui),A=!P,I=i1(),D=d&&!(F&&!F.manageFocus),L=it("");_l(t,L,x=>l(0,a=x));const ie=F?F.disableInlineStyles:g,H=it([]);_l(t,H,x=>l(20,u=x));const K=it(null);_l(t,K,x=>l(18,i=x));let G=!1;const Y=A?0:F.level+1,z=A?it((()=>$a(Wl?wo(_):h.location,M))()):P;_l(t,z,x=>l(17,n=x));const Z=it(n);_l(t,Z,x=>l(19,o=x));const V=e1(E,L,z),j=x=>W=>W.filter(U=>U.id!==x);function ee(x){if(Wl){if(G)return;const W=$c(x,n.pathname);if(W)return G=!0,W}else H.update(W=>{const U=j(x.id)(W);return U.push(x),U})}function ue(x){H.update(j(x))}return!A&&p!==Pa&&ws(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),A&&(sc(()=>h.listen(W=>{const U=$a(W.location,M);Z.set(n),z.set(U)})),Mi(xs,z)),Mi(ui,{activeRoute:K,registerRoute:ee,unregisterRoute:ue,manageFocus:D,level:Y,id:I,history:A?h:F.history,basepath:A?M:F.basepath,disableInlineStyles:ie}),t.$$set=x=>{"basepath"in x&&l(11,p=x.basepath),"url"in x&&l(12,_=x.url),"history"in x&&l(13,h=x.history),"primary"in x&&l(14,d=x.primary),"a11y"in x&&l(15,v=x.a11y),"disableInlineStyles"in x&&l(16,g=x.disableInlineStyles),"$$scope"in x&&l(21,f=x.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ws(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const x=Tc(u,n.pathname);K.set(x)}if(t.$$.dirty[0]&655360&&A){const x=!!n.hash,W=!x&&D,U=!x||n.pathname!==o.pathname;V(W,U)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&K0({level:Y,routerId:I,route:i})},[a,E,A,I,D,L,ie,H,K,z,Z,p,_,h,d,v,g,n,i,o,u,f,c]}class o1 extends De{constructor(e){super(),Pe(this,e,s1,n1,$e,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ec=o1;function Ai(t,e,l=ui,n=mn){Hl(l)||Sc(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const r1=t=>{const{subscribe:e}=Hl(t);return{subscribe:e}};function Pc(){return Ai(kc),r1(xs)}function Dc(){const{history:t}=Hl(ui);return t}function Ic(){const t=Hl(vc);return t?h0(t,e=>e.base):it("/")}function Oc(){Ai(yc);const t=Ic(),{basepath:e}=Hl(ui);return n=>q0(n,ri(t),e)}function a1(){Ai(wc);const t=Oc(),{navigate:e}=Dc();return(n,i)=>{const o=cc(n)?n:t(n);return e(o,i)}}const u1=t=>({params:t&16,location:t&8}),Da=t=>({params:Wl?ri(t[10]):t[4],location:t[3],navigate:t[11]});function Ia(t){let e,l;return e=new Ec({props:{primary:t[1],$$slots:{default:[m1]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function f1(t){let e;const l=t[18].default,n=po(l,t,t[19],Da);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,u1):ho(i[19]),Da)},i(i){e||(O(n,i),e=!0)},o(i){B(n,i),e=!1},d(i){n&&n.d(i)}}}function c1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Wl?ri(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f{oe(p,1)}),Oe()}o?(e=ya(o,u()),re(e.$$.fragment),O(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&O(e.$$.fragment,a),n=!0)},o(a){e&&B(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&oe(e,a)}}}function m1(t){let e,l,n,i;const o=[c1,f1],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),C(c,n,f),i=!0},p(c,f){let p=e;e=a(c),e===p?u[e].p(c,f):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Oe(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),O(l,1),l.m(n.parentNode,n))},i(c){i||(O(l),i=!0)},o(c){B(l),i=!1},d(c){u[e].d(c),c&&w(n)}}}function p1(t){let e,l,n,i,o,u=[Js(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{c=null}),Oe())},i(_){o||(O(c),o=!0)},o(_){B(c),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),_&&w(i)}}}const _1=mc();function d1(t,e,l){let n;const i=["path","component","meta","primary"];let o=gs(e,i),u,a,c,f,{$$slots:p={},$$scope:_}=e,{path:h=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Ai(Ss,e);const E=_1(),{registerRoute:$,unregisterRoute:M,activeRoute:P,disableInlineStyles:F}=Hl(ui);_l(t,P,G=>l(16,u=G));const A=Ic();_l(t,A,G=>l(17,c=G));const I=Pc();_l(t,I,G=>l(3,a=G));const D=it(null);let L;const ie=it(),H=it({});_l(t,H,G=>l(4,f=G)),Mi(vc,ie),Mi(b0,H),Mi(g0,D);const K=a1();return Wl||u0(()=>M(E)),t.$$set=G=>{l(24,e=sl(sl({},e),bs(G))),l(12,o=gs(e,i)),"path"in G&&l(13,h=G.path),"component"in G&&l(0,d=G.component),"meta"in G&&l(14,v=G.meta),"primary"in G&&l(1,g=G.primary),"$$scope"in G&&l(19,_=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=h==="",Y=Ni(c,h),Q={id:E,path:h,meta:v,default:G,fullPath:G?"":Y,base:G?c:B0(Y,a.pathname),primary:g,focusElement:D};ie.set(Q),l(15,L=$(Q))}if(t.$$.dirty&98304&&l(2,n=!!(L||u&&u.id===E)),t.$$.dirty&98308&&n){const{params:G}=L||u;H.set(G)}},e=bs(e),[d,g,n,a,f,E,P,F,A,I,H,K,o,h,v,L,u,c,p,_]}class v1 extends De{constructor(e){super(),Pe(this,e,d1,p1,$e,{path:13,component:0,meta:14,primary:1})}}const Sl=v1;function h1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;fl(11,_=D));const P=f0(),F=Oc(),{navigate:A}=Dc();function I(D){P("click",D),d0(D)&&(D.preventDefault(),A(n,{state:E,replace:u||g}))}return t.$$set=D=>{l(19,e=sl(sl({},e),bs(D))),l(18,p=gs(e,f)),"to"in D&&l(5,v=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,E=D.state),"getProps"in D&&l(8,$=D.getProps),"$$scope"in D&&l(12,d=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(v,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===F0(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(fc($)){const D=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...D}}return p})())},e=bs(e),[n,c,a,M,I,v,g,E,$,o,i,_,d,h]}class g1 extends De{constructor(e){super(),Pe(this,e,b1,h1,$e,{to:5,replace:6,state:7,getProps:8})}}const ol=g1;let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function k1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Rc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function w1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ys(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 Fe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µ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"}}function Oa(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ra(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function La(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Qe(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function be(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function dl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function qa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let pl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Yt=it(pl);async function yo(){pl=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(pl)}let ds=0,Ba=-127,Ua=null,y1={};const Lc=dc(y1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Ba!=n.t&&(Ba=n.t,setTimeout(jc,2e3)),Ua==null&&n.pe&&n.p!=null&&(Ua=n.p,qc()),pl.upgrading?window.location.reload():(!pl||!pl.chip||pl.booting||ds>1&&!oi(pl.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(Mo,2e3),un&&clearTimeout(un),un=setTimeout(So,3e3));let i=5e3;if(oi(pl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(pl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={},wi;const Co=it(lo);async function Fc(){let t=!1;Co.update(e=>{for(var l=0;l<36;l++){if(e[Fe(l)]==null){t=l<12;break}e[Fe(l)]=e[Fe(l+1)]}return e}),t?qc():wi=setTimeout(Fc,(60-new Date().getMinutes())*6e4)}async function qc(){wi&&(clearTimeout(wi),wi=0),lo=await(await $l("/energyprice.json")).json(),Co.set(lo),wi=setTimeout(Fc,(60-new Date().getMinutes())*6e4)}let no={},an;async function Mo(){an&&(clearTimeout(an),an=0),no=await(await $l("/dayplot.json")).json(),Bc.set(no),an=setTimeout(Mo,(60-new Date().getMinutes())*6e4+20)}const Bc=it(no,t=>(Mo(),function(){}));let io={},un;async function So(){un&&(clearTimeout(un),un=0),io=await(await $l("/monthplot.json")).json(),Uc.set(io),un=setTimeout(So,(24-new Date().getHours())*36e5+40)}const Uc=it(io,t=>(So(),function(){}));let so={};async function jc(){so=await(await $l("/temperature.json")).json(),Hc.set(so)}const Hc=it(so,t=>(jc(),function(){}));let oo={},vs;async function Wc(){vs&&(clearTimeout(vs),vs=0),oo=await(await $l("/tariff.json")).json(),zc.set(oo),vs=setTimeout(Wc,(60-new Date().getMinutes())*6e4+30)}const zc=it(oo,t=>function(){});let ro=[];const To=it(ro);async function C1(){ro=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),To.set(ro)}let ao={};async function M1(){ao=await(await $l("/realtime.json")).json(),Gc.set(ao)}const Gc=it(ao,t=>(M1(),function(){}));function Cs(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 Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let p=0;po&&(a=_):g==i+1&&(c=_);else if(v==n+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let M=parseInt($[1]);parseInt($[2]),g==M&&(f=_)}else f=_}return c||f||a||!1}else return e[0]}const S1="/github.svg";function ja(t){let e,l;function n(u,a){return u[1]>1?D1:u[1]>0?P1:u[2]>1?E1:u[2]>0?A1:u[3]>1?N1:u[3]>0?$1:T1}let i=n(t),o=i(t);return{c(){e=T(`Up - `),o.c(),l=Ve()},m(u,a){C(u,e,a),o.m(u,a),C(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&w(e),o.d(u),u&&w(l)}}}function T1(t){let e,l;return{c(){e=T(t[0]),l=T(" seconds")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function $1(t){let e,l;return{c(){e=T(t[3]),l=T(" minute")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function N1(t){let e,l;return{c(){e=T(t[3]),l=T(" minutes")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function A1(t){let e,l;return{c(){e=T(t[2]),l=T(" hour")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function E1(t){let e,l;return{c(){e=T(t[2]),l=T(" hours")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function P1(t){let e,l;return{c(){e=T(t[1]),l=T(" day")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function D1(t){let e,l;return{c(){e=T(t[1]),l=T(" days")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function I1(t){let e,l=t[0]&&ja(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&w(e)}}}function O1(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class R1 extends De{constructor(e){super(),Pe(this,e,O1,I1,$e,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=T(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){C(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:_e,o:_e,d(i){i&&w(e)}}}function F1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends De{constructor(e){super(),Pe(this,e,F1,L1,$e,{color:0,title:1,text:2})}}function q1(t){let e,l=`${Fe(t[0].getDate())}.${Fe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=T(l),r(e,"class",t[1])},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Fe(i[0].getDate())}.${Fe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Fe(i[0].getHours())}:${Fe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&w(e)}}}function B1(t){let e=`${Fe(t[0].getDate())}. ${to[t[0].getMonth()]} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,l;return{c(){l=T(e)},m(n,i){C(n,l,i)},p(n,i){i&1&&e!==(e=`${Fe(n[0].getDate())}. ${to[n[0].getMonth()]} ${Fe(n[0].getHours())}:${Fe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&w(l)}}}function U1(t){let e;function l(o,u){return o[2]?B1:q1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),C(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:_e,o:_e,d(o){i.d(o),o&&w(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||dl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Yc extends De{constructor(e){super(),Pe(this,e,j1,U1,$e,{timestamp:0,fullTimeColor:1,offset:3})}}function H1(t){let e,l,n;return{c(){e=Te("svg"),l=Te("path"),n=Te("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){C(i,e,o),s(e,l),s(e,n)},p:_e,i:_e,o:_e,d(i){i&&w(e)}}}class W1 extends De{constructor(e){super(),Pe(this,e,null,H1,$e,{})}}function z1(t){let e,l;return{c(){e=Te("svg"),l=Te("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){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&w(e)}}}class G1 extends De{constructor(e){super(),Pe(this,e,null,z1,$e,{})}}function V1(t){let e,l;return{c(){e=Te("svg"),l=Te("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){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&w(e)}}}class Bt extends De{constructor(e){super(),Pe(this,e,null,V1,$e,{})}}function K1(t){let e,l;return{c(){e=Te("svg"),l=Te("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&w(e)}}}class Qc extends De{constructor(e){super(),Pe(this,e,null,K1,$e,{})}}function Y1(t){let e,l,n=t[1].version+"",i;return{c(){e=T("AMS reader "),l=m("span"),i=T(n)},m(o,u){C(o,e,u),C(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&w(e),o&&w(l)}}}function Ha(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=T(l),i=T("°C"),r(e,"class","flex-none my-auto")},m(o,u){C(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&w(e)}}}function Wa(t){let e,l="HAN: "+Oa(t[0].he),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Oa(i[0].he))&&X(n,l)},d(i){i&&w(e)}}}function za(t){let e,l="MQTT: "+Ra(t[0].me),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Ra(i[0].me))&&X(n,l)},d(i){i&&w(e)}}}function Ga(t){let e,l="PriceAPI: "+La(t[0].ee),n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+La(i[0].ee))&&X(n,l)},d(i){i&&w(e)}}}function Va(t){let e,l,n,i,o,u;return l=new ol({props:{to:"/configuration",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),o=new ol({props:{to:"/status",$$slots:{default:[X1]},$$scope:{ctx:t}}}),{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("div"),re(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){C(a,e,c),se(l,e,null),C(a,n,c),C(a,i,c),se(o,i,null),u=!0},i(a){u||(O(l.$$.fragment,a),O(o.$$.fragment,a),u=!0)},o(a){B(l.$$.fragment,a),B(o.$$.fragment,a),u=!1},d(a){a&&w(e),oe(l),a&&w(n),a&&w(i),oe(o)}}}function Q1(t){let e,l;return e=new W1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function X1(t){let e,l;return e=new G1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ka(t){let e,l,n,i,o;const u=[J1,Z1],a=[];function c(f,p){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,p){C(f,e,p),a[l].m(e,null),o=!0},p(f,p){let _=l;l=c(f),l===_?a[l].p(f,p):(Ie(),B(a[_],1,1,()=>{a[_]=null}),Oe(),n=a[l],n?n.p(f,p):(n=a[l]=u[l](f),n.c()),O(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(O(n),o=!0)},o(f){B(n),o=!1},d(f){f&&w(e),a[l].d()}}}function Z1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=T("New version: "),i=T(n)},m(o,u){C(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:_e,o:_e,d(o){o&&w(e)}}}function J1(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,p;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=T("New version: "),o=T(i),u=b(),re(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,h){C(_,e,h),s(e,l),s(l,n),s(l,o),s(e,u),se(a,e,null),c=!0,f||(p=le(e,"click",t[3]),f=!0)},p(_,h){(!c||h&4)&&i!==(i=_[2].tag_name+"")&&X(o,i)},i(_){c||(O(a.$$.fragment,_),c=!0)},o(_){B(a.$$.fragment,_),c=!1},d(_){_&&w(e),oe(a),f=!1,p()}}}function x1(t){let e,l,n,i,o,u,a,c,f,p,_,h,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We;i=new ol({props:{to:"/",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),c=new R1({props:{epoch:t[0].u}});let Ne=t[0].t>-50&&Ha(t);M=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:jl(t[1].booting?2:t[0].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:jl(t[1].booting?9:t[0].hm)}}),I=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:jl(t[1].booting?9:t[0].wm)}}),L=new fn({props:{title:"MQTT",text:"MQTT",color:jl(t[1].booting?9:t[0].mm)}});let ge=(t[0].he<0||t[0].he>0)&&Wa(t),Re=t[0].me<0&&za(t),Me=(t[0].ee>0||t[0].ee<0)&&Ga(t);ue=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let S=t[1].vndcfg&&t[1].usrcfg&&Va(t);He=new Bt({});let k=t[1].fwconsent===1&&t[2]&&Ka(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),re(i.$$.fragment),o=b(),u=m("div"),a=m("div"),re(c.$$.fragment),f=b(),Ne&&Ne.c(),p=b(),_=m("div"),h=T("Free mem: "),v=T(d),g=T("kb"),E=b(),$=m("div"),re(M.$$.fragment),P=b(),re(F.$$.fragment),A=b(),re(I.$$.fragment),D=b(),re(L.$$.fragment),ie=b(),ge&&ge.c(),H=b(),Re&&Re.c(),K=b(),Me&&Me.c(),G=b(),Y=m("div"),Q=m("div"),z=m("a"),Z=m("img"),j=b(),ee=m("div"),re(ue.$$.fragment),x=b(),S&&S.c(),W=b(),U=m("div"),ke=m("a"),re(He.$$.fragment),Be=b(),k&&k.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(Z,"class","gh-logo"),Xs(Z.src,V=S1)||r(Z,"src",V),r(Z,"alt","GitHub repo"),r(z,"class","float-right"),r(z,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(z,"target","_blank"),r(z,"rel","noreferrer"),r(z,"aria-label","GitHub"),r(Q,"class","flex-none"),r(ee,"class","flex-none my-auto px-2"),r(ke,"href",Ut("")),r(ke,"target","_blank"),r(ke,"rel","noreferrer"),r(U,"class","flex-none px-1 mt-1"),r(U,"title","Documentation"),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","bg-violet-600 p-1 rounded-md mx-2")},m(y,N){C(y,e,N),s(e,l),s(l,n),se(i,n,null),s(l,o),s(l,u),s(u,a),se(c,a,null),s(u,f),Ne&&Ne.m(u,null),s(u,p),s(u,_),s(_,h),s(_,v),s(_,g),s(l,E),s(l,$),se(M,$,null),s($,P),se(F,$,null),s($,A),se(I,$,null),s($,D),se(L,$,null),s(l,ie),ge&&ge.m(l,null),s(l,H),Re&&Re.m(l,null),s(l,K),Me&&Me.m(l,null),s(l,G),s(l,Y),s(Y,Q),s(Q,z),s(z,Z),s(Y,j),s(Y,ee),se(ue,ee,null),s(Y,x),S&&S.m(Y,null),s(Y,W),s(Y,U),s(U,ke),se(He,ke,null),s(Y,Be),k&&k.m(Y,null),We=!0},p(y,[N]){const R={};N&18&&(R.$$scope={dirty:N,ctx:y}),i.$set(R);const J={};N&1&&(J.epoch=y[0].u),c.$set(J),y[0].t>-50?Ne?Ne.p(y,N):(Ne=Ha(y),Ne.c(),Ne.m(u,p)):Ne&&(Ne.d(1),Ne=null),(!We||N&1)&&d!==(d=(y[0].m?(y[0].m/1e3).toFixed(1):"-")+"")&&X(v,d);const te={};N&3&&(te.text=y[1].booting?"Booting":y[0].v>2?y[0].v.toFixed(2)+"V":"ESP"),N&3&&(te.color=jl(y[1].booting?2:y[0].em)),M.$set(te);const fe={};N&3&&(fe.color=jl(y[1].booting?9:y[0].hm)),F.$set(fe);const de={};N&1&&(de.text=y[0].r?y[0].r.toFixed(0)+"dBm":"WiFi"),N&3&&(de.color=jl(y[1].booting?9:y[0].wm)),I.$set(de);const we={};N&3&&(we.color=jl(y[1].booting?9:y[0].mm)),L.$set(we),y[0].he<0||y[0].he>0?ge?ge.p(y,N):(ge=Wa(y),ge.c(),ge.m(l,H)):ge&&(ge.d(1),ge=null),y[0].me<0?Re?Re.p(y,N):(Re=za(y),Re.c(),Re.m(l,K)):Re&&(Re.d(1),Re=null),y[0].ee>0||y[0].ee<0?Me?Me.p(y,N):(Me=Ga(y),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Ae={};N&1&&(Ae.timestamp=y[0].c?new Date(y[0].c*1e3):new Date(0)),N&2&&(Ae.offset=y[1].clock_offset),ue.$set(Ae),y[1].vndcfg&&y[1].usrcfg?S?N&2&&O(S,1):(S=Va(y),S.c(),O(S,1),S.m(Y,W)):S&&(Ie(),B(S,1,1,()=>{S=null}),Oe()),y[1].fwconsent===1&&y[2]?k?(k.p(y,N),N&6&&O(k,1)):(k=Ka(y),k.c(),O(k,1),k.m(Y,null)):k&&(Ie(),B(k,1,1,()=>{k=null}),Oe())},i(y){We||(O(i.$$.fragment,y),O(c.$$.fragment,y),O(M.$$.fragment,y),O(F.$$.fragment,y),O(I.$$.fragment,y),O(L.$$.fragment,y),O(ue.$$.fragment,y),O(S),O(He.$$.fragment,y),O(k),We=!0)},o(y){B(i.$$.fragment,y),B(c.$$.fragment,y),B(M.$$.fragment,y),B(F.$$.fragment,y),B(I.$$.fragment,y),B(L.$$.fragment,y),B(ue.$$.fragment,y),B(S),B(He.$$.fragment,y),B(k),We=!1},d(y){y&&w(e),oe(i),oe(c),Ne&&Ne.d(),oe(M),oe(F),oe(I),oe(L),ge&&ge.d(),Re&&Re.d(),Me&&Me.d(),oe(ue),S&&S.d(),oe(He),k&&k.d()}}}function em(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!oi(i.board)||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(a=>(a.upgrading=!0,a)),Vc(o.tag_name))}return Yt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&C1()}),To.subscribe(a=>{l(2,o=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class tm extends De{constructor(e){super(),Pe(this,e,em,x1,$e,{data:0})}}function lm(t){let e,l,n,i;return{c(){e=Te("svg"),l=Te("path"),n=Te("path"),r(l,"d",Qs(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=Qs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){C(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Qs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:_e,o:_e,d(o){o&&w(e)}}}function Ya(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 Qs(t,e,l,n,i){var o=Ya(t,e,l,i),u=Ya(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function nm(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 im extends De{constructor(e){super(),Pe(this,e,nm,lm,$e,{pct:0,color:1})}}function Qa(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=b(),n=m("span"),i=T(t[3]),o=b(),u=m("span"),a=T(t[4]),c=T("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,p){C(f,e,p),C(f,l,p),C(f,n,p),s(n,i),C(f,o,p),C(f,u,p),s(u,a),s(u,c)},p(f,p){p&8&&X(i,f[3]),p&16&&X(a,f[4])},d(f){f&&w(e),f&&w(l),f&&w(n),f&&w(o),f&&w(u)}}}function sm(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E;l=new im({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&Qa(t);return{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("span"),o=m("span"),u=T(t[2]),a=b(),c=m("br"),f=b(),p=m("span"),_=T(t[0]),h=b(),d=m("span"),v=T(t[1]),g=b(),$&&$.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(d,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(M,P){C(M,e,P),se(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,p),s(p,_),s(i,h),s(i,d),s(d,v),s(i,g),$&&$.m(i,null),E=!0},p(M,[P]){const F={};P&64&&(F.pct=M[6]),P&96&&(F.color=M[5](M[6])),l.$set(F),(!E||P&4)&&X(u,M[2]),(!E||P&1)&&X(_,M[0]),(!E||P&2)&&X(v,M[1]),M[3]?$?$.p(M,P):($=Qa(M),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(M){E||(O(l.$$.fragment,M),E=!0)},o(M){B(l.$$.fragment,M),E=!1},d(M){M&&w(e),oe(l),$&&$.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,a,c,f,p,i]}class Xc extends De{constructor(e){super(),Pe(this,e,om,sm,$e,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Xa(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Za(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Ja(t,e,l){const n=t.slice();return n[13]=e[l],n}function xa(t){let e,l,n,i,o,u=t[0].title&&eu(t),a=t[0].y.ticks,c=[];for(let d=0;d20||t[11]%2==0)&&iu(t);return{c(){e=Te("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){C(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=iu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function iu(t){let e,l=t[9].label+"",n,i;return{c(){e=Te("text"),n=T(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){C(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[9].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&w(e)}}}function su(t){let e=!isNaN(t[5](t[11])),l,n=e&&nu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),C(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function ou(t){let e,l,n=t[9].value!==void 0&&ru(t),i=t[9].value2>1e-4&&fu(t);return{c(){e=Te("g"),n&&n.c(),l=Te("g"),i&&i.c()},m(o,u){C(o,e,u),n&&n.m(e,null),C(o,l,u),i&&i.m(l,null)},p(o,u){o[9].value!==void 0?n?n.p(o,u):(n=ru(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,u):(i=fu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ru(t){let e,l,n,i,o,u,a,c=t[3]>15&&au(t);return{c(){e=Te("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",u=t[9].color)},m(f,p){C(f,e,p),c&&c.m(f,p),C(f,a,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),p&65&&n!==(n=f[6](f[9].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&r(e,"height",o),p&1&&u!==(u=f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,p):(c=au(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(a)}}}function au(t){let e,l=t[9].label+"",n,i,o,u,a,c,f=t[9].title&&uu(t);return{c(){e=Te("text"),n=T(l),f&&f.c(),c=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]p[6](0)-p[7]?p[9].color:"white")&&r(e,"fill",u),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]15&&cu(t);return{c(){e=Te("rect"),c&&c.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",u=t[9].color2?t[9].color2:t[9].color)},m(f,p){C(f,e,p),c&&c.m(f,p),C(f,a,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),p&64&&n!==(n=f[6](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&r(e,"height",o),p&1&&u!==(u=f[9].color2?f[9].color2:f[9].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,p):(c=cu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&w(e),c&&c.d(f),f&&w(a)}}}function cu(t){let e,l=t[9].label2+"",n,i,o,u,a,c=t[9].title2&&mu(t);return{c(){e=Te("text"),n=T(l),c&&c.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){C(i,e,o),n&&n.m(e,null),l=ic(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=xa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:_e,o:_e,d(i){i&&w(e),n&&n.d(),l()}}}let cn=30;function am(t,e,l){let{config:n}=e,i,o,u,a,c,f,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=h=>{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,f=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,u=h/n.points.length),l(7,p=un.y.max?g=n.padding.bottom:vf||g<0?0:g})}},[n,i,o,u,f,a,c,p,_]}class pn extends De{constructor(e){super(),Pe(this,e,am,rm,$e,{config:0})}}function um(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function fm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:be(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:k1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(c(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[a,n,i,o,u]}class cm extends De{constructor(e){super(),Pe(this,e,fm,um,$e,{u1:1,u2:2,u3:3,ds:4})}}function mm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function pm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i3:c}=e,{max:f}=e,p={};function _(h){return{label:be(h)+"A",title:h.toFixed(1)+" A",value:isNaN(h)?0:h,color:Rc(h?h/f*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,u=h.i1),"i2"in h&&l(5,a=h.i2),"i3"in h&&l(6,c=h.i3),"max"in h&&l(7,f=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],d=[];n>0&&(h.push({label:"L1"}),d.push(_(u))),i>0&&(h.push({label:"L2"}),d.push(_(a))),o>0&&(h.push({label:"L3"}),d.push(_(c))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:h},points:d})}},[p,n,i,o,u,a,c,f]}class _m extends De{constructor(e){super(),Pe(this,e,pm,mm,$e,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function dm(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,h,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",E,$,M,P,F,A,I,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",L,ie,H,K,G,Y,Q=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",z,Z;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",u=b(),a=m("div"),f=T(c),p=T(" VAr"),_=b(),h=m("div"),h.textContent="Instant out",d=b(),v=m("div"),E=T(g),$=T(" VAr"),M=b(),P=m("div"),F=m("div"),F.textContent="Total in",A=b(),I=m("div"),L=T(D),ie=T(" kVArh"),H=b(),K=m("div"),K.textContent="Total out",G=b(),Y=m("div"),z=T(Q),Z=T(" kVArh"),r(a,"class","text-right"),r(v,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(I,"class","text-right"),r(Y,"class","text-right"),r(P,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(V,j){C(V,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,p),s(i,_),s(i,h),s(i,d),s(i,v),s(v,E),s(v,$),s(e,M),s(e,P),s(P,F),s(P,A),s(P,I),s(I,L),s(I,ie),s(P,H),s(P,K),s(P,G),s(P,Y),s(Y,z),s(Y,Z)},p(V,[j]){j&1&&c!==(c=(typeof V[0]<"u"?V[0].toFixed(0):"-")+"")&&X(f,c),j&2&&g!==(g=(typeof V[1]<"u"?V[1].toFixed(0):"-")+"")&&X(E,g),j&4&&D!==(D=(typeof V[2]<"u"?V[2].toFixed(1):"-")+"")&&X(L,D),j&8&&Q!==(Q=(typeof V[3]<"u"?V[3].toFixed(1):"-")+"")&&X(z,Q)},i:_e,o:_e,d(V){V&&w(e)}}}function vm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class hm extends De{constructor(e){super(),Pe(this,e,vm,dm,$e,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function _u(t){let e;function l(o,u){return o[3]?gm:bm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),C(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function bm(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",c,f,p,_,h,d,v=be(t[1].d.u,1)+"",g,E,$,M,P,F,A=be(t[1].m.u)+"",I,D,L,ie,H,K,G=be(t[0].last_month.u)+"",Y,Q,z,Z,V=t[4]&&du(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),c=T(a),f=T(" kWh"),p=b(),_=m("div"),_.textContent="Day",h=b(),d=m("div"),g=T(v),E=T(" kWh"),$=b(),M=m("div"),M.textContent="Month",P=b(),F=m("div"),I=T(A),D=T(" kWh"),L=b(),ie=m("div"),ie.textContent="Last month",H=b(),K=m("div"),Y=T(G),Q=T(" kWh"),z=b(),V&&V.c(),Z=Ve(),r(u,"class","text-right"),r(d,"class","text-right"),r(F,"class","text-right"),r(K,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(j,ee){C(j,e,ee),C(j,l,ee),C(j,n,ee),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,p),s(n,_),s(n,h),s(n,d),s(d,g),s(d,E),s(n,$),s(n,M),s(n,P),s(n,F),s(F,I),s(F,D),s(n,L),s(n,ie),s(n,H),s(n,K),s(K,Y),s(K,Q),C(j,z,ee),V&&V.m(j,ee),C(j,Z,ee)},p(j,ee){ee&2&&a!==(a=be(j[1].h.u,2)+"")&&X(c,a),ee&2&&v!==(v=be(j[1].d.u,1)+"")&&X(g,v),ee&2&&A!==(A=be(j[1].m.u)+"")&&X(I,A),ee&1&&G!==(G=be(j[0].last_month.u)+"")&&X(Y,G),j[4]?V?V.p(j,ee):(V=du(j),V.c(),V.m(Z.parentNode,Z)):V&&(V.d(1),V=null)},d(j){j&&w(e),j&&w(l),j&&w(n),j&&w(z),V&&V.d(j),j&&w(Z)}}}function gm(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",c,f,p,_,h,d,v,g=be(t[1].d.u,1)+"",E,$,M,P,F,A,I,D=be(t[1].m.u)+"",L,ie,H,K,G,Y,Q,z=be(t[0].last_month.u)+"",Z,V,j,ee,ue,x,W,U,ke,He,Be,We=be(t[1].h.p,2)+"",Ne,ge,Re,Me,S,k,y,N=be(t[1].d.p,1)+"",R,J,te,fe,de,we,Ae,ae=be(t[1].m.p)+"",Ce,Je,At,st,ht,lt,Et,Ye=be(t[0].last_month.p)+"",Qt,Ht,bt,ze,xe=t[4]&&vu(t),Xe=t[4]&&hu(t),Ue=t[4]&&bu(t),qe=t[4]&&gu(t),et=t[4]&&ku(t),Ee=t[4]&&wu(t),Le=t[4]&&yu(t),pe=t[4]&&Cu(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),c=T(a),f=T(" kWh"),p=b(),xe&&xe.c(),_=b(),h=m("div"),h.textContent="Day",d=b(),v=m("div"),E=T(g),$=T(" kWh"),M=b(),Xe&&Xe.c(),P=b(),F=m("div"),F.textContent="Month",A=b(),I=m("div"),L=T(D),ie=T(" kWh"),H=b(),Ue&&Ue.c(),K=b(),G=m("div"),G.textContent="Last mo.",Y=b(),Q=m("div"),Z=T(z),V=T(" kWh"),j=b(),qe&&qe.c(),ue=b(),x=m("strong"),x.textContent="Export",W=b(),U=m("div"),ke=m("div"),ke.textContent="Hour",He=b(),Be=m("div"),Ne=T(We),ge=T(" kWh"),Re=b(),et&&et.c(),Me=b(),S=m("div"),S.textContent="Day",k=b(),y=m("div"),R=T(N),J=T(" kWh"),te=b(),Ee&&Ee.c(),fe=b(),de=m("div"),de.textContent="Month",we=b(),Ae=m("div"),Ce=T(ae),Je=T(" kWh"),At=b(),Le&&Le.c(),st=b(),ht=m("div"),ht.textContent="Last mo.",lt=b(),Et=m("div"),Qt=T(Ye),Ht=T(" kWh"),bt=b(),pe&&pe.c(),r(u,"class","text-right"),r(v,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class",ee="grid grid-cols-"+t[5]+" mb-3"),r(Be,"class","text-right"),r(y,"class","text-right"),r(Ae,"class","text-right"),r(Et,"class","text-right"),r(U,"class",ze="grid grid-cols-"+t[5])},m(ce,ye){C(ce,e,ye),C(ce,l,ye),C(ce,n,ye),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,p),xe&&xe.m(n,null),s(n,_),s(n,h),s(n,d),s(n,v),s(v,E),s(v,$),s(n,M),Xe&&Xe.m(n,null),s(n,P),s(n,F),s(n,A),s(n,I),s(I,L),s(I,ie),s(n,H),Ue&&Ue.m(n,null),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(n,j),qe&&qe.m(n,null),C(ce,ue,ye),C(ce,x,ye),C(ce,W,ye),C(ce,U,ye),s(U,ke),s(U,He),s(U,Be),s(Be,Ne),s(Be,ge),s(U,Re),et&&et.m(U,null),s(U,Me),s(U,S),s(U,k),s(U,y),s(y,R),s(y,J),s(U,te),Ee&&Ee.m(U,null),s(U,fe),s(U,de),s(U,we),s(U,Ae),s(Ae,Ce),s(Ae,Je),s(U,At),Le&&Le.m(U,null),s(U,st),s(U,ht),s(U,lt),s(U,Et),s(Et,Qt),s(Et,Ht),s(U,bt),pe&&pe.m(U,null)},p(ce,ye){ye&2&&a!==(a=be(ce[1].h.u,2)+"")&&X(c,a),ce[4]?xe?xe.p(ce,ye):(xe=vu(ce),xe.c(),xe.m(n,_)):xe&&(xe.d(1),xe=null),ye&2&&g!==(g=be(ce[1].d.u,1)+"")&&X(E,g),ce[4]?Xe?Xe.p(ce,ye):(Xe=hu(ce),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),ye&2&&D!==(D=be(ce[1].m.u)+"")&&X(L,D),ce[4]?Ue?Ue.p(ce,ye):(Ue=bu(ce),Ue.c(),Ue.m(n,K)):Ue&&(Ue.d(1),Ue=null),ye&1&&z!==(z=be(ce[0].last_month.u)+"")&&X(Z,z),ce[4]?qe?qe.p(ce,ye):(qe=gu(ce),qe.c(),qe.m(n,null)):qe&&(qe.d(1),qe=null),ye&32&&ee!==(ee="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",ee),ye&2&&We!==(We=be(ce[1].h.p,2)+"")&&X(Ne,We),ce[4]?et?et.p(ce,ye):(et=ku(ce),et.c(),et.m(U,Me)):et&&(et.d(1),et=null),ye&2&&N!==(N=be(ce[1].d.p,1)+"")&&X(R,N),ce[4]?Ee?Ee.p(ce,ye):(Ee=wu(ce),Ee.c(),Ee.m(U,fe)):Ee&&(Ee.d(1),Ee=null),ye&2&&ae!==(ae=be(ce[1].m.p)+"")&&X(Ce,ae),ce[4]?Le?Le.p(ce,ye):(Le=yu(ce),Le.c(),Le.m(U,st)):Le&&(Le.d(1),Le=null),ye&1&&Ye!==(Ye=be(ce[0].last_month.p)+"")&&X(Qt,Ye),ce[4]?pe?pe.p(ce,ye):(pe=Cu(ce),pe.c(),pe.m(U,null)):pe&&(pe.d(1),pe=null),ye&32&&ze!==(ze="grid grid-cols-"+ce[5])&&r(U,"class",ze)},d(ce){ce&&w(e),ce&&w(l),ce&&w(n),xe&&xe.d(),Xe&&Xe.d(),Ue&&Ue.d(),qe&&qe.d(),ce&&w(ue),ce&&w(x),ce&&w(W),ce&&w(U),et&&et.d(),Ee&&Ee.d(),Le&&Le.d(),pe&&pe.d()}}}function du(t){let e,l,n,i,o,u,a=be(t[1].h.c,2)+"",c,f,p,_,h,d,v,g=be(t[1].d.c,1)+"",E,$,M,P,F,A,I,D=be(t[1].m.c)+"",L,ie,H,K,G,Y,Q,z=be(t[0].last_month.c)+"",Z,V,j;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),c=T(a),f=b(),p=T(t[2]),_=b(),h=m("div"),h.textContent="Day",d=b(),v=m("div"),E=T(g),$=b(),M=T(t[2]),P=b(),F=m("div"),F.textContent="Month",A=b(),I=m("div"),L=T(D),ie=b(),H=T(t[2]),K=b(),G=m("div"),G.textContent="Last month",Y=b(),Q=m("div"),Z=T(z),V=b(),j=T(t[2]),r(u,"class","text-right"),r(v,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class","grid grid-cols-2")},m(ee,ue){C(ee,e,ue),C(ee,l,ue),C(ee,n,ue),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,p),s(n,_),s(n,h),s(n,d),s(n,v),s(v,E),s(v,$),s(v,M),s(n,P),s(n,F),s(n,A),s(n,I),s(I,L),s(I,ie),s(I,H),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(Q,j)},p(ee,ue){ue&2&&a!==(a=be(ee[1].h.c,2)+"")&&X(c,a),ue&4&&X(p,ee[2]),ue&2&&g!==(g=be(ee[1].d.c,1)+"")&&X(E,g),ue&4&&X(M,ee[2]),ue&2&&D!==(D=be(ee[1].m.c)+"")&&X(L,D),ue&4&&X(H,ee[2]),ue&1&&z!==(z=be(ee[0].last_month.c)+"")&&X(Z,z),ue&4&&X(j,ee[2])},d(ee){ee&&w(e),ee&&w(l),ee&&w(n)}}}function vu(t){let e,l=be(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function hu(t){let e,l=be(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function bu(t){let e,l=be(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function gu(t){let e,l=be(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function ku(t){let e,l=be(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function wu(t){let e,l=be(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function yu(t){let e,l=be(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function Cu(t){let e,l=be(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=T(l),i=b(),o=T(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&w(e)}}}function km(t){let e,l,n,i,o,u,a=t[1]&&_u(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),u=b(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=_u(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:_e,o:_e,d(c){c&&w(e),a&&a.d()}}}function wm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class ym extends De{constructor(e){super(),Pe(this,e,wm,km,$e,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Cm(t){let e,l,n=qa(t[0].source)+"",i,o,u,a;return u=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=T("Provided by: "),i=T(n),o=b(),re(u.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(c,f){C(c,e,f),s(e,l),s(e,i),C(c,o,f),se(u,c,f),a=!0},p(c,[f]){(!a||f&1)&&n!==(n=qa(c[0].source)+"")&&X(i,n);const p={};f&2&&(p.config=c[1]),u.$set(p)},i(c){a||(O(u.$$.fragment,c),a=!0)},o(c){B(u.$$.fragment,c),a=!1},d(c){c&&w(e),c&&w(o),oe(u,c)}}}function Mm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),p=0,_=0,h=0,d=[],v=[],g=[];l(4,a=l(3,u=0));let E=new Date;for(dl(E,i.clock_offset-(24+E.getHours()-E.getUTCHours())%24),p=f;p<24&&(_=n[Fe(h++)],_!=null);p++)v.push({label:Fe(E.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(E,1);for(p=0;p<24&&(_=n[Fe(h++)],_!=null);p++)v.push({label:Fe(E.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(E,1);if(a>-100&&u<100){switch(c){case"NOK":case"SEK":case"DKK":c="øre";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),p=0;p=0?A.toFixed(I):"",title:A>=0?A.toFixed(2)+" "+c:"",value:_>=0?Math.abs(_):0,label2:A<0?A.toFixed(I):"",title2:A<0?A.toFixed(2)+" "+c:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let M=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(M/4*-1,a));let A=Math.ceil(Math.abs(a)/M*4),I=a/A;for(p=1;p{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,a=l(3,u=0));let h=dl(new Date,-24),d=new Date().getUTCHours();for(dl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),c=d;c<24;c++){let $=n["i"+Fe(c)],M=n["e"+Fe(c)];$===void 0&&($=0),M===void 0&&(M=0),p.push({label:Fe(h.getHours())}),_.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:M.toFixed(1),title2:M.toFixed(2)+" kWh",value2:M*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M*10)),l(3,u=Math.max(u,$*10)),dl(h,1)}for(c=0;c{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,a=l(3,u=0));let h=new Date,d=new Date;for(dl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),dl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),c=h.getDate();c<=d.getDate();c++){let $=n["i"+Fe(c)],M=n["e"+Fe(c)];$===void 0&&($=0),M===void 0&&(M=0),p.push({label:Fe(c)}),_.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M)),l(3,u=Math.max(u,$))}for(c=1;c{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var E=v.n?v.n:v.a;c=v.v,c==-127&&(c=0),p.push({label:E.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let h=o;u<0&&(h+=Math.abs(u));let d=h/4;for(a=0;a<5;a++)c=u+d*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:p},points:_})}},[i,n,o,u]}class Om extends De{constructor(e){super(),Pe(this,e,Im,Dm,$e,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}let Lm=0;function Fm(t,e,l){let n={},i=0,o;return zc.subscribe(u=>{l(2,o=u)}),Wc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Fe(p.d)+"."+to[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class qm extends De{constructor(e){super(),Pe(this,e,Fm,Rm,$e,{})}}function Mu(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function Su(t,e,l){const n=t.slice();return n[21]=e[l],n}function Tu(t){let e,l,n,i,o,u=t[7],a=[];for(let p=0;pt[14].call(e))},m(f,p){C(f,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),c&&c.m(e,null),a=ic(e,t[14].bind(e))},p(f,[p]){p&1024&&X(i,f[10]),f[7]?c?c.p(f,p):(c=Tu(f),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:_e,o:_e,d(f){f&&w(e),c&&c.d(),a()}}}let Um=12;function jm(t,e,l){let n;Gc.subscribe(A=>{l(11,n=A)});let i,o=0;function u(){n.data.unshift(0),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)}Lc.subscribe(A=>{o>0?n.data&&A.u-o>=10&&(i&&clearTimeout(i),n.data.unshift(A.i-A.e),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)):o=A.u});let a,c,f,p,_,h,d,v,g,E,$,M,P;function F(){f=this.clientWidth,p=this.clientHeight,l(0,f),l(1,p)}return t.$$.update=()=>{if(t.$$.dirty&14847&&(l(2,_=parseInt(p)-50),l(3,h=f-35),l(9,M=h/n.size),l(13,c=0),l(12,a=0),n.data)){for(let I in n.data){let D=n.data[I];l(12,a=Math.max(Math.ceil(D/1e3)*1e3,a)),l(13,c=Math.min(Math.ceil(D/1e3)*1e3,c))}l(10,P=a>2500?"kW":"W"),l(7,E=[]);for(let I=c;I2500?(I/1e3).toFixed(1):I});l(8,$=[]);for(let I=c;I0||t[0].e>0}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function qu(t){let e,l,n;return l=new qm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){C(i,e,o),se(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function Bu(t){let e,l,n;return l=new Hm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function Uu(t){let e,l,n;return l=new Sm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function ju(t){let e,l,n;return l=new Nm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function Hu(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function Wu(t){let e,l,n;return l=new Om({props:{json:t[5]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function Wm(t){let e,l=Qe(t[1].ui.i,t[0].i),n,i=Qe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Qe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Qe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Qe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=Qe(t[1].ui.c,t[0].ea),d,v=Qe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,E=Qe(t[1].ui.l),$,M=Qe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),P,F=Qe(t[1].ui.d,t[3]),A,I=Qe(t[1].ui.m,t[4]),D,L=Qe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),ie,H=l&&Du(t),K=i&&Iu(t),G=u&&Ou(t),Y=c&&Ru(t),Q=p&&Lu(t),z=h&&Fu(t),Z=v&&qu(),V=E&&Bu(),j=M&&Uu(t),ee=F&&ju(t),ue=I&&Hu(t),x=L&&Wu(t);return{c(){e=m("div"),H&&H.c(),n=b(),K&&K.c(),o=b(),G&&G.c(),a=b(),Y&&Y.c(),f=b(),Q&&Q.c(),_=b(),z&&z.c(),d=b(),Z&&Z.c(),g=b(),V&&V.c(),$=b(),j&&j.c(),P=b(),ee&&ee.c(),A=b(),ue&&ue.c(),D=b(),x&&x.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(W,U){C(W,e,U),H&&H.m(e,null),s(e,n),K&&K.m(e,null),s(e,o),G&&G.m(e,null),s(e,a),Y&&Y.m(e,null),s(e,f),Q&&Q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),Z&&Z.m(e,null),s(e,g),V&&V.m(e,null),s(e,$),j&&j.m(e,null),s(e,P),ee&&ee.m(e,null),s(e,A),ue&&ue.m(e,null),s(e,D),x&&x.m(e,null),ie=!0},p(W,[U]){U&3&&(l=Qe(W[1].ui.i,W[0].i)),l?H?(H.p(W,U),U&3&&O(H,1)):(H=Du(W),H.c(),O(H,1),H.m(e,n)):H&&(Ie(),B(H,1,1,()=>{H=null}),Oe()),U&3&&(i=Qe(W[1].ui.e,W[0].om||W[0].e>0)),i?K?(K.p(W,U),U&3&&O(K,1)):(K=Iu(W),K.c(),O(K,1),K.m(e,o)):K&&(Ie(),B(K,1,1,()=>{K=null}),Oe()),U&3&&(u=Qe(W[1].ui.v,W[0].u1>100||W[0].u2>100||W[0].u3>100)),u?G?(G.p(W,U),U&3&&O(G,1)):(G=Ou(W),G.c(),O(G,1),G.m(e,a)):G&&(Ie(),B(G,1,1,()=>{G=null}),Oe()),U&3&&(c=Qe(W[1].ui.a,W[0].i1>.01||W[0].i2>.01||W[0].i3>.01)),c?Y?(Y.p(W,U),U&3&&O(Y,1)):(Y=Ru(W),Y.c(),O(Y,1),Y.m(e,f)):Y&&(Ie(),B(Y,1,1,()=>{Y=null}),Oe()),U&3&&(p=Qe(W[1].ui.r,W[0].ri>0||W[0].re>0||W[0].ric>0||W[0].rec>0)),p?Q?(Q.p(W,U),U&3&&O(Q,1)):(Q=Lu(W),Q.c(),O(Q,1),Q.m(e,_)):Q&&(Ie(),B(Q,1,1,()=>{Q=null}),Oe()),U&3&&(h=Qe(W[1].ui.c,W[0].ea)),h?z?(z.p(W,U),U&3&&O(z,1)):(z=Fu(W),z.c(),O(z,1),z.m(e,d)):z&&(Ie(),B(z,1,1,()=>{z=null}),Oe()),U&3&&(v=Qe(W[1].ui.t,W[0].pr&&(W[0].pr.startsWith("10YNO")||W[0].pr=="10Y1001A1001A48H"))),v?Z?U&3&&O(Z,1):(Z=qu(),Z.c(),O(Z,1),Z.m(e,g)):Z&&(Ie(),B(Z,1,1,()=>{Z=null}),Oe()),U&2&&(E=Qe(W[1].ui.l)),E?V?U&2&&O(V,1):(V=Bu(),V.c(),O(V,1),V.m(e,$)):V&&(Ie(),B(V,1,1,()=>{V=null}),Oe()),U&3&&(M=Qe(W[1].ui.p,W[0].pe&&!Number.isNaN(W[0].p))),M?j?(j.p(W,U),U&3&&O(j,1)):(j=Uu(W),j.c(),O(j,1),j.m(e,P)):j&&(Ie(),B(j,1,1,()=>{j=null}),Oe()),U&10&&(F=Qe(W[1].ui.d,W[3])),F?ee?(ee.p(W,U),U&10&&O(ee,1)):(ee=ju(W),ee.c(),O(ee,1),ee.m(e,A)):ee&&(Ie(),B(ee,1,1,()=>{ee=null}),Oe()),U&18&&(I=Qe(W[1].ui.m,W[4])),I?ue?(ue.p(W,U),U&18&&O(ue,1)):(ue=Hu(W),ue.c(),O(ue,1),ue.m(e,D)):ue&&(Ie(),B(ue,1,1,()=>{ue=null}),Oe()),U&35&&(L=Qe(W[1].ui.s,W[0].t&&W[0].t!=-127&&W[5].c>1)),L?x?(x.p(W,U),U&35&&O(x,1)):(x=Wu(W),x.c(),O(x,1),x.m(e,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Oe())},i(W){ie||(O(H),O(K),O(G),O(Y),O(Q),O(z),O(Z),O(V),O(j),O(ee),O(ue),O(x),ie=!0)},o(W){B(H),B(K),B(G),B(Y),B(Q),B(z),B(Z),B(V),B(j),B(ee),B(ue),B(x),ie=!1},d(W){W&&w(e),H&&H.d(),K&&K.d(),G&&G.d(),Y&&Y.d(),Q&&Q.d(),z&&z.d(),Z&&Z.d(),V&&V.d(),j&&j.d(),ee&&ee.d(),ue&&ue.d(),x&&x.d()}}}function zm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return Co.subscribe(f=>{l(2,o=f)}),Bc.subscribe(f=>{l(3,u=f)}),Uc.subscribe(f=>{l(4,a=f)}),Hc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Gm extends De{constructor(e){super(),Pe(this,e,zm,Wm,$e,{data:0,sysinfo:1})}}let uo={};const yi=it(uo);async function Vm(){uo=await(await fetch("/configuration.json")).json(),yi.set(uo)}function zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Km(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Ym(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Gu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Vu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){C(i,e,o),C(i,l,o),C(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Ku(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Yu(t){let e,l,n;return{c(){e=m("option"),l=T("GPIO"),n=T(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){C(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Qu(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Yu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Yu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Qm(t){let e,l,n,i,o;function u(v,g){return v[0]=="esp32c3"?Ym:Km}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Gu(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Vu(),_=t[0]=="esp32s2"&&Ku(),h={length:t[1]+1},d=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class fo extends De{constructor(e){super(),Pe(this,e,Xm,Qm,$e,{chip:0})}}function Xu(t){let e,l,n=t[1]&&Zu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){C(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Zu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function Zu(t){let e,l;return{c(){e=m("div"),l=T(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){C(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&w(e)}}}function Zm(t){let e,l=t[0]&&Xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&w(e)}}}function Jm(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 jt extends De{constructor(e){super(),Pe(this,e,Jm,Zm,$e,{active:0,message:1})}}function Ju(t,e,l){const n=t.slice();return n[1]=e[l],n}function xu(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=T("Europe/"),i=T(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){C(o,e,u),s(e,l),s(e,i)},p:_e,d(o){o&&w(e)}}}function xm(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,N=0;N0;k--)N[k]=N[k]?N[k-1]^A.EXPONENT[L._modN(A.LOG[N[k]]+S)]:N[k-1];N[0]=A.EXPONENT[L._modN(A.LOG[N[0]]+S)]}for(S=0;S<=y;S++)N[S]=A.LOG[N[S]]},_checkBadness:function(){var S,k,y,N,R,J=0,te=this._badness,fe=this.buffer,de=this.width;for(R=0;Rde*de;)ae-=de*de,Ae++;for(J+=Ae*L.N4,N=0;N=te-2&&(S=te-2,R>9&&S--);var fe=S;if(R>9){for(J[fe+2]=0,J[fe+3]=0;fe--;)k=J[fe],J[fe+3]|=255&k<<4,J[fe+2]=k>>4;J[2]|=255&S<<4,J[1]=S>>4,J[0]=64|S>>12}else{for(J[fe+1]=0,J[fe+2]=0;fe--;)k=J[fe],J[fe+2]|=255&k<<4,J[fe+1]=k>>4;J[1]|=255&S<<4,J[0]=64|S>>4}for(fe=S+3-(R<10);fe=5&&(y+=L.N1+N[k]-5);for(k=3;kS||N[k-3]*3>=N[k]*4||N[k+3]*3>=N[k]*4)&&(y+=L.N3);return y},_finish:function(){this._stringBuffer=this.buffer.slice();var S,k,y=0,N=3e4;for(k=0;k<8&&(this._applyMask(k),S=this._checkBadness(),S>=1)N&1&&(R[J-1-k+J*8]=1,k<6?R[8+J*k]=1:R[8+J*(k+1)]=1);for(k=0;k<7;k++,N>>=1)N&1&&(R[8+J*(J-7+k)]=1,k?R[6-k+J*8]=1:R[7+J*8]=1)},_interleaveBlocks:function(){var S,k,y=this._dataBlock,N=this._ecc,R=this._eccBlock,J=0,te=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,we=this._stringBuffer;for(S=0;S1)for(S=$.BLOCK[N],y=R-7;;){for(k=R-7;k>S-3&&(this._addAlignment(k,y),!(k6)for(S=D.BLOCK[J-7],k=17,y=0;y<6;y++)for(N=0;N<3;N++,k--)1&(k>11?J>>k-12:S>>k)?(R[5-y+te*(2-N+te-11)]=1,R[2-N+te-11+te*(5-y)]=1):(this._setMask(5-y,2-N+te-11),this._setMask(2-N+te-11,5-y))},_isMasked:function(S,k){var y=L._getMaskBit(S,k);return this._mask[y]===1},_pack:function(){var S,k,y,N=1,R=1,J=this.width,te=J-1,fe=J-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(k=0;kk&&(y=S,S=k,k=y),y=k,y+=k*k,y>>=1,y+=S,y},_modN:function(S){for(;S>=255;)S-=255,S=(S>>8)+(S&255);return S},N1:3,N2:3,N3:40,N4:10}),ie=L,H=d.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var S=this.element;S.width=S.height=this.qrious.size}}),K=H,G=_.extend(function(S,k,y,N){this.name=S,this.modifiable=!!k,this.defaultValue=y,this._valueTransformer=N},{transform:function(S){var k=this._valueTransformer;return typeof k=="function"?k(S,this):S}}),Y=G,Q=_.extend(null,{abs:function(S){return S!=null?Math.abs(S):null},hasOwn:function(S,k){return Object.prototype.hasOwnProperty.call(S,k)},noop:function(){},toUpperCase:function(S){return S!=null?S.toUpperCase():null}}),z=Q,Z=_.extend(function(S){this.options={},S.forEach(function(k){this.options[k.name]=k},this)},{exists:function(S){return this.options[S]!=null},get:function(S,k){return Z._get(this.options[S],k)},getAll:function(S){var k,y=this.options,N={};for(k in y)z.hasOwn(y,k)&&(N[k]=Z._get(y[k],S));return N},init:function(S,k,y){typeof y!="function"&&(y=z.noop);var N,R;for(N in this.options)z.hasOwn(this.options,N)&&(R=this.options[N],Z._set(R,R.defaultValue,k),Z._createAccessor(R,k,y));this._setAll(S,k,!0)},set:function(S,k,y){return this._set(S,k,y)},setAll:function(S,k){return this._setAll(S,k)},_set:function(S,k,y,N){var R=this.options[S];if(!R)throw new Error("Invalid option: "+S);if(!R.modifiable&&!N)throw new Error("Option cannot be modified: "+S);return Z._set(R,k,y)},_setAll:function(S,k,y){if(!S)return!1;var N,R=!1;for(N in S)z.hasOwn(S,N)&&this._set(N,S[N],k,y)&&(R=!0);return R}},{_createAccessor:function(S,k,y){var N={get:function(){return Z._get(S,k)}};S.modifiable&&(N.set=function(R){Z._set(S,R,k)&&y(R,S)}),Object.defineProperty(k,S.name,N)},_get:function(S,k){return k["_"+S.name]},_set:function(S,k,y){var N="_"+S.name,R=y[N],J=S.transform(k??S.defaultValue);return y[N]=J,J!==R}}),V=Z,j=_.extend(function(){this._services={}},{getService:function(S){var k=this._services[S];if(!k)throw new Error("Service is not being managed with name: "+S);return k},setService:function(S,k){if(this._services[S])throw new Error("Service is already managed with name: "+S);k&&(this._services[S]=k)}}),ee=j,ue=new V([new Y("background",!0,"white"),new Y("backgroundAlpha",!0,1,z.abs),new Y("element"),new Y("foreground",!0,"black"),new Y("foregroundAlpha",!0,1,z.abs),new Y("level",!0,"L",z.toUpperCase),new Y("mime",!0,"image/png"),new Y("padding",!0,null,z.abs),new Y("size",!0,100,z.abs),new Y("value",!0,"")]),x=new ee,W=_.extend(function(S){ue.init(S,this,this.update.bind(this));var k=ue.get("element",this),y=x.getService("element"),N=k&&y.isCanvas(k)?k:y.createCanvas(),R=k&&y.isImage(k)?k:y.createImage();this._canvasRenderer=new g(this,N,!0),this._imageRenderer=new K(this,R,R===k),this.update()},{get:function(){return ue.getAll(this)},set:function(S){ue.setAll(S,this)&&this.update()},toDataURL:function(S){return this.canvas.toDataURL(S||this.mime)},update:function(){var S=new ie({level:this.level,value:this.value});this._canvasRenderer.render(S),this._imageRenderer.render(S)}},{use:function(S){x.setService(S.getName(),S)}});Object.defineProperties(W.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var U=W,ke=U,He=_.extend({getName:function(){}}),Be=He,We=Be.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(S){},isImage:function(S){}}),Ne=We,ge=Ne.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}}),Re=ge;ke.use(new Re);var Me=ke;return Me})})(Jc);var op=Jc.exports;const rp=sp(op);function ap(t){let e,l;return{c(){e=m("img"),Xs(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){C(n,e,i)},p(n,[i]){i&4&&!Xs(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:_e,o:_e,d(n){n&&w(e)}}}function up(t,e,l){const n=new rp;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function h(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,_=n.toDataURL("image/jpeg"))}return sc(()=>{h()}),t.$$set=d=>{"errorCorrection"in d&&l(3,i=d.errorCorrection),"background"in d&&l(4,o=d.background),"color"in d&&l(5,u=d.color),"size"in d&&l(6,a=d.size),"value"in d&&l(0,c=d.value),"padding"in d&&l(7,f=d.padding),"className"in d&&l(1,p=d.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&h()},[c,p,_,i,o,u,a,f]}class fp extends De{constructor(e){super(),Pe(this,e,up,ap,$e,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function ef(t,e,l){const n=t.slice();return n[103]=e[l],n[104]=e,n[105]=l,n}function tf(t,e,l){const n=t.slice();return n[106]=e[l],n[107]=e,n[108]=l,n}function cp(t,e,l){const n=t.slice();return n[109]=e[l],n}function mp(t,e,l){const n=t.slice();return n[112]=e[l],n}function pp(t){let e,l;return{c(){e=m("option"),l=T(t[112]),e.__value=t[112],e.value=e.__value},m(n,i){C(n,e,i),s(e,l)},p:_e,d(n){n&&w(e)}}}function lf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){C(o,e,u),C(o,l,u),ne(l,t[3].p.t),n||(i=le(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ne(l,o[3].p.t)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function nf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d;return{c(){e=m("div"),l=T("Username"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),c=T("Password"),f=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1")},m(v,g){C(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].g.u),C(v,u,g),C(v,a,g),s(a,c),s(a,f),s(a,p),s(a,_),ne(_,t[3].g.p),h||(d=[le(o,"input",t[24]),le(_,"input",t[25])],h=!0)},p(v,g){g[0]&8&&o.value!==v[3].g.u&&ne(o,v[3].g.u),g[0]&8&&_.value!==v[3].g.p&&ne(_,v[3].g.p)},d(v){v&&w(e),v&&w(u),v&&w(a),h=!1,Ge(d)}}}function _p(t){let e,l=t[109]*100+"",n;return{c(){e=m("option"),n=T(l),e.__value=t[109]*100,e.value=e.__value},m(i,o){C(i,e,o),s(e,n)},p:_e,d(i){i&&w(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){C(o,e,u),C(o,l,u),ne(l,t[3].m.e.k),n||(i=le(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ne(l,o[3].m.e.k)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=T("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].m.e.a),u||(a=le(o,"input",t[36]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&ne(o,c[3].m.e.a)},d(c){c&&w(e),u=!1,a()}}}function rf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H;return{c(){e=m("div"),l=m("div"),n=T("Watt"),i=m("br"),o=b(),u=m("input"),a=b(),c=m("div"),f=T("Volt"),p=m("br"),_=b(),h=m("input"),d=b(),v=m("div"),g=T("Amp"),E=m("br"),$=b(),M=m("input"),P=b(),F=m("div"),A=T("kWh"),I=m("br"),D=b(),L=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(h,"name","mmv"),r(h,"type","number"),r(h,"min","0.00"),r(h,"max","1000"),r(h,"step","0.001"),r(h,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(M,"name","mma"),r(M,"type","number"),r(M,"min","0.00"),r(M,"max","1000"),r(M,"step","0.001"),r(M,"class","in-m tr w-full"),r(v,"class","w-1/4"),r(L,"name","mmc"),r(L,"type","number"),r(L,"min","0.00"),r(L,"max","1000"),r(L,"step","0.001"),r(L,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(K,G){C(K,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ne(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,p),s(c,_),s(c,h),ne(h,t[3].m.m.v),s(e,d),s(e,v),s(v,g),s(v,E),s(v,$),s(v,M),ne(M,t[3].m.m.a),s(e,P),s(e,F),s(F,A),s(F,I),s(F,D),s(F,L),ne(L,t[3].m.m.c),ie||(H=[le(u,"input",t[38]),le(h,"input",t[39]),le(M,"input",t[40]),le(L,"input",t[41])],ie=!0)},p(K,G){G[0]&8&&he(u.value)!==K[3].m.m.w&&ne(u,K[3].m.m.w),G[0]&8&&he(h.value)!==K[3].m.m.v&&ne(h,K[3].m.m.v),G[0]&8&&he(M.value)!==K[3].m.m.a&&ne(M,K[3].m.m.a),G[0]&8&&he(L.value)!==K[3].m.m.c&&ne(L,K[3].m.m.c)},d(K){K&&w(e),ie=!1,Ge(H)}}}function af(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function uf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W;return{c(){e=m("div"),l=T("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),c=T("Password"),f=m("br"),p=b(),_=m("input"),h=b(),d=m("div"),v=m("div"),g=T("Power saving"),E=m("br"),$=b(),M=m("select"),P=m("option"),P.textContent="Default",F=m("option"),F.textContent="Off",A=m("option"),A.textContent="Minimum",I=m("option"),I.textContent="Maximum",D=b(),L=m("div"),ie=T("Power"),H=m("br"),K=b(),G=m("div"),Y=m("input"),Q=b(),z=m("span"),z.textContent="dBm",Z=b(),V=m("div"),j=m("label"),ee=m("input"),ue=T(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1"),P.__value=255,P.value=P.__value,F.__value=0,F.value=F.__value,A.__value=1,A.value=A.__value,I.__value=2,I.value=I.__value,r(M,"name","wz"),r(M,"class","in-s"),t[3].w.z===void 0&&Ke(()=>t[45].call(M)),r(v,"class","w-1/2"),r(Y,"name","ww"),r(Y,"type","number"),r(Y,"min","0"),r(Y,"max","20.5"),r(Y,"step","0.5"),r(Y,"class","in-f tr w-full"),r(z,"class","in-post"),r(G,"class","flex"),r(L,"class","ml-2 w-1/2"),r(d,"class","my-1 flex"),r(ee,"type","checkbox"),r(ee,"name","wb"),ee.__value="true",ee.value=ee.__value,r(ee,"class","rounded mb-1"),r(V,"class","my-3")},m(U,ke){C(U,e,ke),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].w.s),C(U,u,ke),C(U,a,ke),s(a,c),s(a,f),s(a,p),s(a,_),ne(_,t[3].w.p),C(U,h,ke),C(U,d,ke),s(d,v),s(v,g),s(v,E),s(v,$),s(v,M),s(M,P),s(M,F),s(M,A),s(M,I),Se(M,t[3].w.z,!0),s(d,D),s(d,L),s(L,ie),s(L,H),s(L,K),s(L,G),s(G,Y),ne(Y,t[3].w.w),s(G,Q),s(G,z),C(U,Z,ke),C(U,V,ke),s(V,j),s(j,ee),ee.checked=t[3].w.b,s(j,ue),x||(W=[le(o,"input",t[43]),le(_,"input",t[44]),le(M,"change",t[45]),le(Y,"input",t[46]),le(ee,"change",t[47])],x=!0)},p(U,ke){ke[0]&8&&o.value!==U[3].w.s&&ne(o,U[3].w.s),ke[0]&8&&_.value!==U[3].w.p&&ne(_,U[3].w.p),ke[0]&8&&Se(M,U[3].w.z),ke[0]&8&&he(Y.value)!==U[3].w.w&&ne(Y,U[3].w.w),ke[0]&8&&(ee.checked=U[3].w.b)},d(U){U&&w(e),U&&w(u),U&&w(a),U&&w(h),U&&w(d),U&&w(Z),U&&w(V),x=!1,Ge(W)}}}function ff(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E;return{c(){e=m("div"),l=T("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),c=T("DNS"),f=m("br"),p=b(),_=m("div"),h=m("input"),d=b(),v=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(h,"name","nd1"),r(h,"type","text"),r(h,"class","in-f w-full"),r(v,"name","nd2"),r(v,"type","text"),r(v,"class","in-l w-full"),r(_,"class","flex"),r(a,"class","my-1")},m($,M){C($,e,M),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].n.g),C($,u,M),C($,a,M),s(a,c),s(a,f),s(a,p),s(a,_),s(_,h),ne(h,t[3].n.d1),s(_,d),s(_,v),ne(v,t[3].n.d2),g||(E=[le(o,"input",t[51]),le(h,"input",t[52]),le(v,"input",t[53])],g=!0)},p($,M){M[0]&8&&o.value!==$[3].n.g&&ne(o,$[3].n.g),M[0]&8&&h.value!==$[3].n.d1&&ne(h,$[3].n.d1),M[0]&8&&v.value!==$[3].n.d2&&ne(v,$[3].n.d2)},d($){$&&w(e),$&&w(u),$&&w(a),g=!1,Ge(E)}}}function cf(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=T(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){C(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[le(l,"change",t[57]),le(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&w(e),i=!1,Ge(o)}}}function mf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d;const v=[vp,dp],g=[];function E(D,L){return D[3].q.s.c?0:1}n=E(t),i=g[n]=v[n](t);const $=[kp,gp],M=[];function P(D,L){return D[3].q.s.r?0:1}a=P(t),c=M[a]=$[a](t);const F=[Mp,Cp],A=[];function I(D,L){return D[3].q.s.k?0:1}return _=I(t),h=A[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),c.c(),f=b(),p=m("span"),h.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(D,L){C(D,e,L),s(e,l),g[n].m(l,null),s(e,o),s(e,u),M[a].m(u,null),s(e,f),s(e,p),A[_].m(p,null),d=!0},p(D,L){let ie=n;n=E(D),n===ie?g[n].p(D,L):(Ie(),B(g[ie],1,1,()=>{g[ie]=null}),Oe(),i=g[n],i?i.p(D,L):(i=g[n]=v[n](D),i.c()),O(i,1),i.m(l,null));let H=a;a=P(D),a===H?M[a].p(D,L):(Ie(),B(M[H],1,1,()=>{M[H]=null}),Oe(),c=M[a],c?c.p(D,L):(c=M[a]=$[a](D),c.c()),O(c,1),c.m(u,null));let K=_;_=I(D),_===K?A[_].p(D,L):(Ie(),B(A[K],1,1,()=>{A[K]=null}),Oe(),h=A[_],h?h.p(D,L):(h=A[_]=F[_](D),h.c()),O(h,1),h.m(p,null))},i(D){d||(O(i),O(c),O(h),d=!0)},o(D){B(i),B(c),B(h),d=!1},d(D){D&&w(e),g[n].d(),M[a].d(),A[_].d()}}}function dp(t){let e,l;return e=new ol({props:{to:"/mqtt-ca",$$slots:{default:[hp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function vp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-ca",$$slots:{default:[bp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){C(f,e,p),se(l,e,null),C(f,n,p),C(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[11]),le(i,"keypress",t[11])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&w(e),oe(l),f&&w(n),f&&w(i),oe(o),a=!1,Ge(c)}}}function hp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function bp(t){let e;return{c(){e=T("CA OK")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function gp(t){let e,l;return e=new ol({props:{to:"/mqtt-cert",$$slots:{default:[wp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function kp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-cert",$$slots:{default:[yp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){C(f,e,p),se(l,e,null),C(f,n,p),C(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[12]),le(i,"keypress",t[12])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&w(e),oe(l),f&&w(n),f&&w(i),oe(o),a=!1,Ge(c)}}}function wp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function yp(t){let e;return{c(){e=T("Cert OK")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Cp(t){let e,l;return e=new ol({props:{to:"/mqtt-key",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Mp(t){let e,l,n,i,o,u,a,c;return l=new ol({props:{to:"/mqtt-key",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){C(f,e,p),se(l,e,null),C(f,n,p),C(f,i,p),se(o,i,null),u=!0,a||(c=[le(i,"click",t[13]),le(i,"keypress",t[13])],a=!0)},p(f,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){B(l.$$.fragment,f),B(o.$$.fragment,f),u=!1},d(f){f&&w(e),oe(l),f&&w(n),f&&w(i),oe(o),a=!1,Ge(c)}}}function Sp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Tp(t){let e;return{c(){e=T("Key OK")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function pf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),c=b(),f=m("div"),p=m("div"),_=T("Electricity IDX"),h=m("br"),d=b(),v=m("input"),g=b(),E=m("div"),$=T("Current IDX"),M=m("br"),P=b(),F=m("input"),A=b(),I=m("div"),D=T(`Voltage IDX: L1, L2 & L3 - `),L=m("div"),ie=m("input"),H=b(),K=m("input"),G=b(),Y=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(v,"name","oe"),r(v,"type","text"),r(v,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(E,"class","w-1/2"),r(f,"class","my-1 flex"),r(ie,"name","ou1"),r(ie,"type","text"),r(ie,"class","in-f tr w-1/3"),r(K,"name","ou2"),r(K,"type","text"),r(K,"class","in-m tr w-1/3"),r(Y,"name","ou3"),r(Y,"type","text"),r(Y,"class","in-l tr w-1/3"),r(L,"class","flex"),r(I,"class","my-1"),r(e,"class","cnt")},m(V,j){C(V,e,j),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(p,_),s(p,h),s(p,d),s(p,v),ne(v,t[3].o.e),s(f,g),s(f,E),s(E,$),s(E,M),s(E,P),s(E,F),ne(F,t[3].o.c),s(e,A),s(e,I),s(I,D),s(I,L),s(L,ie),ne(ie,t[3].o.u1),s(L,H),s(L,K),ne(K,t[3].o.u2),s(L,G),s(L,Y),ne(Y,t[3].o.u3),Q=!0,z||(Z=[le(v,"input",t[65]),le(F,"input",t[66]),le(ie,"input",t[67]),le(K,"input",t[68]),le(Y,"input",t[69])],z=!0)},p(V,j){j[0]&8&&v.value!==V[3].o.e&&ne(v,V[3].o.e),j[0]&8&&F.value!==V[3].o.c&&ne(F,V[3].o.c),j[0]&8&&ie.value!==V[3].o.u1&&ne(ie,V[3].o.u1),j[0]&8&&K.value!==V[3].o.u2&&ne(K,V[3].o.u2),j[0]&8&&Y.value!==V[3].o.u3&&ne(Y,V[3].o.u3)},i(V){Q||(O(o.$$.fragment,V),Q=!0)},o(V){B(o.$$.fragment,V),Q=!1},d(V){V&&w(e),oe(o),z=!1,Ge(Z)}}}function _f(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),c=b(),f=m("div"),p=T("Discovery topic prefix"),_=m("br"),h=b(),d=m("input"),v=b(),g=m("div"),E=T("Hostname for URL"),$=m("br"),M=b(),P=m("input"),A=b(),I=m("div"),D=T("Name tag"),L=m("br"),ie=b(),H=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(d,"name","ht"),r(d,"type","text"),r(d,"class","in-s"),r(d,"placeholder","homeassistant"),r(f,"class","my-1"),r(P,"name","hh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(H,"name","hn"),r(H,"type","text"),r(H,"class","in-s"),r(I,"class","my-1"),r(e,"class","cnt")},m(Q,z){C(Q,e,z),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(f,_),s(f,h),s(f,d),ne(d,t[3].h.t),s(e,v),s(e,g),s(g,E),s(g,$),s(g,M),s(g,P),ne(P,t[3].h.h),s(e,A),s(e,I),s(I,D),s(I,L),s(I,ie),s(I,H),ne(H,t[3].h.n),K=!0,G||(Y=[le(d,"input",t[70]),le(P,"input",t[71]),le(H,"input",t[72])],G=!0)},p(Q,z){z[0]&8&&d.value!==Q[3].h.t&&ne(d,Q[3].h.t),(!K||z[0]&8&&F!==(F=Q[3].g.h+".local"))&&r(P,"placeholder",F),z[0]&8&&P.value!==Q[3].h.h&&ne(P,Q[3].h.h),z[0]&8&&H.value!==Q[3].h.n&&ne(H,Q[3].h.n)},i(Q){K||(O(o.$$.fragment,Q),K=!0)},o(Q){B(o.$$.fragment,Q),K=!1},d(Q){Q&&w(e),oe(o),G=!1,Ge(Y)}}}function df(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue;o=new Bt({});let x=t[3].c.es&&vf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),c=b(),f=m("div"),p=m("label"),_=m("input"),h=T(" Enable cloud upload"),d=b(),v=m("div"),g=T("Client ID"),E=m("br"),$=b(),M=m("input"),A=b(),I=m("div"),D=T("Client secret"),L=m("br"),ie=b(),H=m("input"),G=b(),Y=m("div"),Q=m("label"),z=m("input"),Z=T(" Energy Speedometer"),V=b(),x&&x.c(),r(l,"class","text-sm"),r(i,"href",Ut("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","c"),a.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(f,"class","my-1"),r(M,"name","ci"),r(M,"type","text"),r(M,"class","in-s"),r(M,"pattern",P=t[3].c.e?"[A-Z0-9]{16}":".*"),M.required=F=t[3].c.e,r(v,"class","my-1"),r(H,"name","cs"),r(H,"type","text"),r(H,"class","in-s"),r(H,"pattern",K=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(I,"class","my-1"),r(z,"type","checkbox"),r(z,"class","rounded mb-1"),r(z,"name","ces"),z.__value="true",z.value=z.__value,r(Y,"class","my-1"),r(e,"class","cnt")},m(W,U){C(W,e,U),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,d),s(e,v),s(v,g),s(v,E),s(v,$),s(v,M),ne(M,t[3].c.i),s(e,A),s(e,I),s(I,D),s(I,L),s(I,ie),s(I,H),ne(H,t[3].c.s),s(e,G),s(e,Y),s(Y,Q),s(Q,z),z.checked=t[3].c.es,s(Q,Z),s(Y,V),x&&x.m(Y,null),j=!0,ee||(ue=[le(_,"change",t[73]),le(M,"input",t[74]),le(H,"input",t[75]),le(z,"change",t[76])],ee=!0)},p(W,U){U[0]&8&&(_.checked=W[3].c.e),(!j||U[0]&8&&P!==(P=W[3].c.e?"[A-Z0-9]{16}":".*"))&&r(M,"pattern",P),(!j||U[0]&8&&F!==(F=W[3].c.e))&&(M.required=F),U[0]&8&&M.value!==W[3].c.i&&ne(M,W[3].c.i),(!j||U[0]&8&&K!==(K=W[3].c.e&&W[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(H,"pattern",K),U[0]&8&&H.value!==W[3].c.s&&ne(H,W[3].c.s),U[0]&8&&(z.checked=W[3].c.es),W[3].c.es?x?(x.p(W,U),U[0]&8&&O(x,1)):(x=vf(W),x.c(),O(x,1),x.m(Y,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Oe())},i(W){j||(O(o.$$.fragment,W),O(x),j=!0)},o(W){B(o.$$.fragment,W),B(x),j=!1},d(W){W&&w(e),oe(o),x&&x.d(),ee=!1,Ge(ue)}}}function vf(t){let e,l,n=t[0].mac+"",i,o,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,h,d=t[0].mac&&t[0].meter.id&&hf(t);return{c(){e=m("div"),l=T("MAC: "),i=T(n),o=b(),u=m("div"),a=T("Meter ID: "),f=T(c),p=b(),d&&d.c(),_=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(v,g){C(v,e,g),s(e,l),s(e,i),C(v,o,g),C(v,u,g),s(u,a),s(u,f),C(v,p,g),d&&d.m(v,g),C(v,_,g),h=!0},p(v,g){(!h||g[0]&1)&&n!==(n=v[0].mac+"")&&X(i,n),(!h||g[0]&1)&&c!==(c=(v[0].meter.id?v[0].meter.id:"missing, required")+"")&&X(f,c),v[0].mac&&v[0].meter.id?d?(d.p(v,g),g[0]&1&&O(d,1)):(d=hf(v),d.c(),O(d,1),d.m(_.parentNode,_)):d&&(Ie(),B(d,1,1,()=>{d=null}),Oe())},i(v){h||(O(d),h=!0)},o(v){B(d),h=!1},d(v){v&&w(e),v&&w(o),v&&w(u),v&&w(p),d&&d.d(v),v&&w(_)}}}function hf(t){let e,l,n;return l=new fp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&w(e),oe(l)}}}function bf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P;o=new Bt({});let F={length:9},A=[];for(let I=0;I20&&yf(t),_=t[3].i.d.d>0&&Sf(t),h=t[0].chip=="esp8266"&&Tf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),re(o.$$.fragment),u=b(),p&&p.c(),a=b(),_&&_.c(),c=b(),h&&h.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(d,v){C(d,e,v),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,a),_&&_.m(e,null),s(e,c),h&&h.m(e,null),f=!0},p(d,v){d[0].board>20?p?(p.p(d,v),v[0]&1&&O(p,1)):(p=yf(d),p.c(),O(p,1),p.m(e,a)):p&&(Ie(),B(p,1,1,()=>{p=null}),Oe()),d[3].i.d.d>0?_?_.p(d,v):(_=Sf(d),_.c(),_.m(e,c)):_&&(_.d(1),_=null),d[0].chip=="esp8266"?h?h.p(d,v):(h=Tf(d),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(d){f||(O(o.$$.fragment,d),O(p),f=!0)},o(d){B(o.$$.fragment,d),B(p),f=!1},d(d){d&&w(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function yf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,S,k,y,N,R,J,te,fe,de,we,Ae,ae,Ce,Je,At,st,ht,lt,Et,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et;f=new fo({props:{chip:t[0].chip}}),E=new fo({props:{chip:t[0].chip}});let Ee=t[0].chip!="esp8266"&&Cf(t),Le=t[3].i.v.p>0&&Mf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=T("HAN RX"),u=m("br"),a=b(),c=m("select"),re(f.$$.fragment),p=b(),_=m("div"),h=T("HAN TX"),d=m("br"),v=b(),g=m("select"),re(E.$$.fragment),$=b(),M=m("div"),P=m("label"),F=m("input"),A=T(" pullup"),I=b(),D=m("div"),L=m("div"),ie=T("AP button"),H=m("br"),K=b(),G=m("input"),Y=b(),Q=m("div"),z=T("LED"),Z=m("br"),V=b(),j=m("div"),ee=m("input"),ue=b(),x=m("div"),W=m("label"),U=m("input"),ke=T(" inverted"),He=b(),Be=m("div"),We=T("RGB"),Ne=m("label"),ge=m("input"),Re=T(" inverted"),Me=m("br"),S=b(),k=m("div"),y=m("input"),N=b(),R=m("input"),J=b(),te=m("input"),fe=b(),de=m("div"),we=m("div"),Ae=T(`LED dis. GPIO - `),ae=m("input"),Ce=b(),Je=m("div"),At=T("Temperature"),st=m("br"),ht=b(),lt=m("input"),Et=b(),Ye=m("div"),Qt=T("Analog temp"),Ht=m("br"),bt=b(),ze=m("input"),xe=b(),Ee&&Ee.c(),Xe=b(),Le&&Le.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(c,"name","ihp"),r(c,"class","in-f w-full"),t[3].i.h.p===void 0&&Ke(()=>t[80].call(c)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ke(()=>t[81].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(P,"class","ml-2"),r(M,"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[6]),r(G,"class","in-f tr w-full"),r(L,"class","w-1/3"),r(ee,"name","ilp"),r(ee,"type","number"),r(ee,"min","0"),r(ee,"max",t[6]),r(ee,"class","in-l tr w-full"),r(j,"class","flex"),r(Q,"class","w-1/3"),r(U,"name","ili"),U.__value="true",U.value=U.__value,r(U,"type","checkbox"),r(U,"class","rounded mb-1"),r(W,"class","ml-4"),r(x,"class","w-1/3"),r(ge,"name","iri"),ge.__value="true",ge.value=ge.__value,r(ge,"type","checkbox"),r(ge,"class","rounded mb-1"),r(Ne,"class","ml-4"),r(y,"name","irr"),r(y,"type","number"),r(y,"min","0"),r(y,"max",t[6]),r(y,"class","in-f tr w-1/3"),r(R,"name","irg"),r(R,"type","number"),r(R,"min","0"),r(R,"max",t[6]),r(R,"class","in-m tr w-1/3"),r(te,"name","irb"),r(te,"type","number"),r(te,"min","0"),r(te,"max",t[6]),r(te,"class","in-l tr w-1/3"),r(k,"class","flex"),r(Be,"class","w-full"),r(ae,"name","idd"),r(ae,"type","number"),r(ae,"min","0"),r(ae,"max",t[6]),r(ae,"class","in-s tr"),r(we,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(lt,"name","itd"),r(lt,"type","number"),r(lt,"min","0"),r(lt,"max",t[6]),r(lt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(ze,"name","ita"),r(ze,"type","number"),r(ze,"min","0"),r(ze,"max",t[6]),r(ze,"class","in-l tr w-full"),r(Ye,"class","my-1 pr-1 w-1/3"),r(D,"class","flex flex-wrap")},m(pe,ce){C(pe,e,ce),C(pe,l,ce),C(pe,n,ce),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),se(f,c,null),Se(c,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,h),s(_,d),s(_,v),s(_,g),se(E,g,null),Se(g,t[3].i.h.t,!0),s(n,$),s(n,M),s(M,P),s(P,F),F.checked=t[3].i.h.u,s(P,A),C(pe,I,ce),C(pe,D,ce),s(D,L),s(L,ie),s(L,H),s(L,K),s(L,G),ne(G,t[3].i.a),s(D,Y),s(D,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,j),s(j,ee),ne(ee,t[3].i.l.p),s(D,ue),s(D,x),s(x,W),s(W,U),U.checked=t[3].i.l.i,s(W,ke),s(D,He),s(D,Be),s(Be,We),s(Be,Ne),s(Ne,ge),ge.checked=t[3].i.r.i,s(Ne,Re),s(Be,Me),s(Be,S),s(Be,k),s(k,y),ne(y,t[3].i.r.r),s(k,N),s(k,R),ne(R,t[3].i.r.g),s(k,J),s(k,te),ne(te,t[3].i.r.b),s(D,fe),s(D,de),s(de,we),s(we,Ae),s(we,ae),ne(ae,t[3].i.d.d),s(D,Ce),s(D,Je),s(Je,At),s(Je,st),s(Je,ht),s(Je,lt),ne(lt,t[3].i.t.d),s(D,Et),s(D,Ye),s(Ye,Qt),s(Ye,Ht),s(Ye,bt),s(Ye,ze),ne(ze,t[3].i.t.a),s(D,xe),Ee&&Ee.m(D,null),s(D,Xe),Le&&Le.m(D,null),Ue=!0,qe||(et=[le(c,"change",t[80]),le(g,"change",t[81]),le(F,"change",t[82]),le(G,"input",t[83]),le(ee,"input",t[84]),le(U,"change",t[85]),le(ge,"change",t[86]),le(y,"input",t[87]),le(R,"input",t[88]),le(te,"input",t[89]),le(ae,"input",t[90]),le(lt,"input",t[91]),le(ze,"input",t[92])],qe=!0)},p(pe,ce){const ye={};ce[0]&1&&(ye.chip=pe[0].chip),f.$set(ye),ce[0]&8&&Se(c,pe[3].i.h.p);const zl={};ce[0]&1&&(zl.chip=pe[0].chip),E.$set(zl),ce[0]&8&&Se(g,pe[3].i.h.t),ce[0]&8&&(F.checked=pe[3].i.h.u),(!Ue||ce[0]&64)&&r(G,"max",pe[6]),ce[0]&8&&he(G.value)!==pe[3].i.a&&ne(G,pe[3].i.a),(!Ue||ce[0]&64)&&r(ee,"max",pe[6]),ce[0]&8&&he(ee.value)!==pe[3].i.l.p&&ne(ee,pe[3].i.l.p),ce[0]&8&&(U.checked=pe[3].i.l.i),ce[0]&8&&(ge.checked=pe[3].i.r.i),(!Ue||ce[0]&64)&&r(y,"max",pe[6]),ce[0]&8&&he(y.value)!==pe[3].i.r.r&&ne(y,pe[3].i.r.r),(!Ue||ce[0]&64)&&r(R,"max",pe[6]),ce[0]&8&&he(R.value)!==pe[3].i.r.g&&ne(R,pe[3].i.r.g),(!Ue||ce[0]&64)&&r(te,"max",pe[6]),ce[0]&8&&he(te.value)!==pe[3].i.r.b&&ne(te,pe[3].i.r.b),(!Ue||ce[0]&64)&&r(ae,"max",pe[6]),ce[0]&8&&he(ae.value)!==pe[3].i.d.d&&ne(ae,pe[3].i.d.d),(!Ue||ce[0]&64)&&r(lt,"max",pe[6]),ce[0]&8&&he(lt.value)!==pe[3].i.t.d&&ne(lt,pe[3].i.t.d),(!Ue||ce[0]&64)&&r(ze,"max",pe[6]),ce[0]&8&&he(ze.value)!==pe[3].i.t.a&&ne(ze,pe[3].i.t.a),pe[0].chip!="esp8266"?Ee?Ee.p(pe,ce):(Ee=Cf(pe),Ee.c(),Ee.m(D,Xe)):Ee&&(Ee.d(1),Ee=null),pe[3].i.v.p>0?Le?Le.p(pe,ce):(Le=Mf(pe),Le.c(),Le.m(D,null)):Le&&(Le.d(1),Le=null)},i(pe){Ue||(O(f.$$.fragment,pe),O(E.$$.fragment,pe),Ue=!0)},o(pe){B(f.$$.fragment,pe),B(E.$$.fragment,pe),Ue=!1},d(pe){pe&&w(e),pe&&w(l),pe&&w(n),oe(f),oe(E),pe&&w(I),pe&&w(D),Ee&&Ee.d(),Le&&Le.d(),qe=!1,Ge(et)}}}function Cf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=T("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.p),u||(a=le(o,"input",t[93]),u=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&ne(o,c[3].i.v.p)},d(c){c&&w(e),u=!1,a()}}}function Mf(t){let e,l,n,i,o,u,a,c,f,p;return{c(){e=m("div"),l=T("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),a=b(),c=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,h){C(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ne(u,t[3].i.v.d.v),s(o,a),s(o,c),ne(c,t[3].i.v.d.g),f||(p=[le(u,"input",t[94]),le(c,"input",t[95])],f=!0)},p(_,h){h[0]&8&&he(u.value)!==_[3].i.v.d.v&&ne(u,_[3].i.v.d.v),h[0]&8&&he(c.value)!==_[3].i.v.d.g&&ne(c,_[3].i.v.d.g)},d(_){_&&w(e),f=!1,Ge(p)}}}function Sf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=T(`LED behaviour - `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&Ke(()=>t[96].call(n)),r(e,"class","my-1 w-full")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(n,i),s(n,o),Se(n,t[3].i.d.b,!0),u||(a=le(n,"change",t[96]),u=!0)},p(c,f){f[0]&8&&Se(n,c[3].i.d.b)},d(c){c&&w(e),u=!1,a()}}}function Tf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M=(t[0].board==2||t[0].board==100)&&$f(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=T("Vcc offset"),u=m("br"),a=b(),c=m("input"),f=b(),p=m("div"),_=T("Multiplier"),h=m("br"),d=b(),v=m("input"),g=b(),M&&M.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(v,"name","ivm"),r(v,"type","number"),r(v,"min","0.1"),r(v,"max","10"),r(v,"step","0.01"),r(v,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(P,F){C(P,e,F),C(P,l,F),C(P,n,F),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),ne(c,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,h),s(p,d),s(p,v),ne(v,t[3].i.v.m),s(n,g),M&&M.m(n,null),E||($=[le(c,"input",t[97]),le(v,"input",t[98])],E=!0)},p(P,F){F[0]&8&&he(c.value)!==P[3].i.v.o&&ne(c,P[3].i.v.o),F[0]&8&&he(v.value)!==P[3].i.v.m&&ne(v,P[3].i.v.m),P[0].board==2||P[0].board==100?M?M.p(P,F):(M=$f(P),M.c(),M.m(n,null)):M&&(M.d(1),M=null)},d(P){P&&w(e),P&&w(l),P&&w(n),M&&M.d(),E=!1,Ge($)}}}function $f(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=T("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.b),u||(a=le(o,"input",t[99]),u=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&ne(o,c[3].i.v.b)},d(c){c&&w(e),u=!1,a()}}}function Nf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$=t[3].d.t&&Af();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=T(" Enable telnet"),a=b(),$&&$.c(),c=b(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",h=m("option"),h.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&Ke(()=>t[102].call(p)),r(f,"class","my-1")},m(M,P){C(M,e,P),C(M,l,P),C(M,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),C(M,a,P),$&&$.m(M,P),C(M,c,P),C(M,f,P),s(f,p),s(p,_),s(p,h),s(p,d),s(p,v),Se(p,t[3].d.l,!0),g||(E=[le(o,"change",t[101]),le(p,"change",t[102])],g=!0)},p(M,P){P[0]&8&&(o.checked=M[3].d.t),M[3].d.t?$||($=Af(),$.c(),$.m(c.parentNode,c)):$&&($.d(1),$=null),P[0]&8&&Se(p,M[3].d.l)},d(M){M&&w(e),M&&w(l),M&&w(n),M&&w(a),$&&$.d(M),M&&w(c),M&&w(f),g=!1,Ge(E)}}}function Af(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function $p(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,S,k,y,N,R,J,te,fe,de,we,Ae,ae,Ce,Je,At,st,ht,lt,Et,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et,Ee,Le,pe,ce,ye,zl,hl,_n,Pt,Ei,Pi,Di,bl,Ii,Oi,Ri,Dt,Nl,Al,El,Li,Fi,je,dn,qi,Pl,Dl,Bi,Gl,Ze,mt,Vl,Il,Ui,Ol,ji,Wt,vn,hn,Ao,rl,Hi,Eo,Ts,Po,fi,Xt,Do,Io,Rl,al,Ll,Oo,Wi,Ro,dt,Fl,Lo,zi,bn,gn,kn,wn,Gi,Fo,It,Vi,qo,Kl,Bo,Uo,jo,ul,yn,Cn,Ho,Mn,Yl,Wo,zo,Go,Sn,Zt,Vo,Ki,Ko,Ql,Yo,Qo,Xo,Tn,Jt,Zo,Yi,Jo,$s,xo,Xl,Qi,xt,er,tr,lr,Ns,Xi,el,nr,ir,sr,Ot,Zi,or,$n,Nn,rr,ci,ar,Zl,ur,fr,cr,zt,An,En,mr,pr,pt,Ji,_r,Pn,Dn,dr,Jl,vr,hr,br,ql,fl,In,On,gr,Rt,xi,es,kr,Lt,Rn,ts,ls,wr,As,ns,is,tl,yr,Cr,mi,Mr,Bl,Sr,pi,ll,Tr,$r,Nr,ss,gl,Ar,tt,os,Er,Ln,Fn,Pr,_i,Dr,cl,Ir,Es,Or,Rr,qn,kl,Lr,nl,Fr,Ps,xl,qr,Br,Ur,wl,jr,en,Hr,Wr,zr,yl,Gr,Bn,Un,Vr,Kr,Yr,Cl,Qr,jn,Xr,Zr,Jr,gt,Hn,Wn,zn,Gn,Vn,Kn,xr,tn,ea,ta,la,Ml,na,Ds,Is,Os,Rs=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ls,ml,rs,ia,Yn,Qn,sa,di,oa,vi,ra,Fs,Ft,as,aa,Xn,Zn,ua,hi,fa,us,fs,il,ca,ma,pa,Ul,qs,Jn,_a,cs,xn,da,ms,Bs,ln,Us,nn,js,sn,Hs,on,Gt,Ws,va;a=new Bt({}),L=new tp({});let xc=["NOK","SEK","DKK","EUR"],bi=[];for(let q=0;q<4;q+=1)bi[q]=pp(mp(t,xc,q));let kt=t[3].p.e&&t[0].chip!="esp8266"&&lf(t),wt=t[3].g.s>0&&nf(t);Dl=new Bt({});let e0=[24,48,96,192,384,576,1152],gi=[];for(let q=0;q<7;q+=1)gi[q]=_p(cp(t,e0,q));let yt=t[3].m.e.e&&sf(t),Ct=t[3].m.e.e&&of(t),Mt=t[3].m.m.e&&rf(t);Nn=new Bt({});let qt=t[0].if&&t[0].if.eth&&af(),St=(t[3].n.c==1||t[3].n.c==2)&&uf(t);Dn=new Bt({}),Rn=new Zc({});let Tt=t[3].n.m=="static"&&ff(t);Fn=new Bt({});let $t=t[0].chip!="esp8266"&&cf(t),ot=t[3].q.s.e&&mf(t),rt=t[3].q.m==3&&pf(t),at=t[3].q.m==4&&_f(t),ut=t[3].c.es!=null&&df(t),ft=Rs&&bf(t);Qn=new Bt({});let ei=t[7],vt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&wf(t);Zn=new Bt({});let Nt=t[3].d.s&&Nf(t);return ln=new jt({props:{active:t[1],message:"Loading configuration"}}),nn=new jt({props:{active:t[2],message:"Saving configuration"}}),sn=new jt({props:{active:t[4],message:"Performing factory reset"}}),on=new jt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),re(a.$$.fragment),c=b(),f=m("input"),p=b(),_=m("div"),h=m("div"),d=m("div"),v=T("Hostname"),g=m("br"),E=b(),$=m("input"),M=b(),P=m("div"),F=T("Time zone"),A=m("br"),I=b(),D=m("select"),re(L.$$.fragment),ie=b(),H=m("input"),K=b(),G=m("div"),Y=m("div"),Q=m("div"),z=T("Price region"),Z=m("br"),V=b(),j=m("select"),ee=m("optgroup"),ue=m("option"),ue.textContent="NO1",x=m("option"),x.textContent="NO2",W=m("option"),W.textContent="NO3",U=m("option"),U.textContent="NO4",ke=m("option"),ke.textContent="NO5",He=m("optgroup"),Be=m("option"),Be.textContent="SE1",We=m("option"),We.textContent="SE2",Ne=m("option"),Ne.textContent="SE3",ge=m("option"),ge.textContent="SE4",Re=m("optgroup"),Me=m("option"),Me.textContent="DK1",S=m("option"),S.textContent="DK2",k=m("option"),k.textContent="Austria",y=m("option"),y.textContent="Belgium",N=m("option"),N.textContent="Czech Republic",R=m("option"),R.textContent="Estonia",J=m("option"),J.textContent="Finland",te=m("option"),te.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",we=m("option"),we.textContent="Latvia",Ae=m("option"),Ae.textContent="Lithuania",ae=m("option"),ae.textContent="Netherland",Ce=m("option"),Ce.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",At=b(),st=m("div"),ht=T("Currency"),lt=m("br"),Et=b(),Ye=m("select");for(let q=0;q<4;q+=1)bi[q].c();Qt=b(),Ht=m("div"),bt=m("div"),ze=m("div"),xe=T("Fixed price"),Xe=m("br"),Ue=b(),qe=m("input"),et=b(),Ee=m("div"),Le=T("Multiplier"),pe=m("br"),ce=b(),ye=m("input"),zl=b(),hl=m("div"),_n=m("label"),Pt=m("input"),Ei=T(" Enable price fetch from remote server"),Pi=b(),kt&&kt.c(),Di=b(),bl=m("div"),Ii=T("Security"),Oi=m("br"),Ri=b(),Dt=m("select"),Nl=m("option"),Nl.textContent="None",Al=m("option"),Al.textContent="Only configuration",El=m("option"),El.textContent="Everything",Li=b(),wt&&wt.c(),Fi=b(),je=m("div"),dn=m("strong"),dn.textContent="Meter",qi=b(),Pl=m("a"),re(Dl.$$.fragment),Bi=b(),Gl=m("input"),Ze=b(),mt=m("input"),Vl=b(),Il=m("div"),Ui=T("Communication"),Ol=m("br"),ji=b(),Wt=m("select"),vn=m("option"),vn.textContent="Passive (Push)",hn=m("option"),hn.textContent="Kamstrup (Pull)",Ao=b(),rl=m("div"),Hi=m("span"),Hi.textContent="Buffer size",Eo=b(),Ts=m("span"),Ts.textContent="Serial conf.",Po=b(),fi=m("label"),Xt=m("input"),Do=T(" inverted"),Io=b(),Rl=m("div"),al=m("select"),Ll=m("option"),Oo=T("Autodetect");for(let q=0;q<7;q+=1)gi[q].c();Ro=b(),dt=m("select"),Fl=m("option"),Lo=T("-"),bn=m("option"),bn.textContent="7N1",gn=m("option"),gn.textContent="8N1",kn=m("option"),kn.textContent="7E1",wn=m("option"),wn.textContent="8E1",Fo=b(),It=m("input"),qo=b(),Kl=m("div"),Bo=T("Voltage"),Uo=m("br"),jo=b(),ul=m("select"),yn=m("option"),yn.textContent="400V (TN)",Cn=m("option"),Cn.textContent="230V (IT/TT)",Ho=b(),Mn=m("div"),Yl=m("div"),Wo=T("Main fuse"),zo=m("br"),Go=b(),Sn=m("label"),Zt=m("input"),Vo=b(),Ki=m("span"),Ki.textContent="A",Ko=b(),Ql=m("div"),Yo=T("Production"),Qo=m("br"),Xo=b(),Tn=m("label"),Jt=m("input"),Zo=b(),Yi=m("span"),Yi.textContent="kWp",Jo=b(),$s=m("div"),xo=b(),Xl=m("div"),Qi=m("label"),xt=m("input"),er=T(" Meter is encrypted"),tr=b(),yt&&yt.c(),lr=b(),Ct&&Ct.c(),Ns=b(),Xi=m("label"),el=m("input"),nr=T(" Multipliers"),ir=b(),Mt&&Mt.c(),sr=b(),Ot=m("div"),Zi=m("strong"),Zi.textContent="Connection",or=b(),$n=m("a"),re(Nn.$$.fragment),rr=b(),ci=m("input"),ar=b(),Zl=m("div"),ur=T("Connection"),fr=m("br"),cr=b(),zt=m("select"),An=m("option"),An.textContent="WiFi",En=m("option"),En.textContent="Access point",qt&&qt.c(),mr=b(),St&&St.c(),pr=b(),pt=m("div"),Ji=m("strong"),Ji.textContent="Network",_r=b(),Pn=m("a"),re(Dn.$$.fragment),dr=b(),Jl=m("div"),vr=T("IP"),hr=m("br"),br=b(),ql=m("div"),fl=m("select"),In=m("option"),In.textContent="DHCP",On=m("option"),On.textContent="Static",gr=b(),Rt=m("input"),kr=b(),Lt=m("select"),re(Rn.$$.fragment),wr=b(),Tt&&Tt.c(),As=b(),ns=m("div"),is=m("label"),tl=m("input"),yr=T(" enable mDNS"),Cr=b(),mi=m("input"),Mr=b(),Bl=m("div"),Sr=T("NTP "),pi=m("label"),ll=m("input"),Tr=T(" obtain from DHCP"),$r=m("br"),Nr=b(),ss=m("div"),gl=m("input"),Ar=b(),tt=m("div"),os=m("strong"),os.textContent="MQTT",Er=b(),Ln=m("a"),re(Fn.$$.fragment),Pr=b(),_i=m("input"),Dr=b(),cl=m("div"),Ir=T(`Server - `),$t&&$t.c(),Es=b(),Or=m("br"),Rr=b(),qn=m("div"),kl=m("input"),Lr=b(),nl=m("input"),Fr=b(),ot&&ot.c(),Ps=b(),xl=m("div"),qr=T("Username"),Br=m("br"),Ur=b(),wl=m("input"),jr=b(),en=m("div"),Hr=T("Password"),Wr=m("br"),zr=b(),yl=m("input"),Gr=b(),Bn=m("div"),Un=m("div"),Vr=T("Client ID"),Kr=m("br"),Yr=b(),Cl=m("input"),Qr=b(),jn=m("div"),Xr=T("Payload"),Zr=m("br"),Jr=b(),gt=m("select"),Hn=m("option"),Hn.textContent="JSON",Wn=m("option"),Wn.textContent="Raw (minimal)",zn=m("option"),zn.textContent="Raw (full)",Gn=m("option"),Gn.textContent="Domoticz",Vn=m("option"),Vn.textContent="HomeAssistant",Kn=m("option"),Kn.textContent="HEX dump",xr=b(),tn=m("div"),ea=T("Publish topic"),ta=m("br"),la=b(),Ml=m("input"),na=b(),rt&&rt.c(),Ds=b(),at&&at.c(),Is=b(),ut&&ut.c(),Os=b(),ft&&ft.c(),Ls=b(),ml=m("div"),rs=m("strong"),rs.textContent="User interface",ia=b(),Yn=m("a"),re(Qn.$$.fragment),sa=b(),di=m("input"),oa=b(),vi=m("div");for(let q=0;qSave',Bs=b(),re(ln.$$.fragment),Us=b(),re(nn.$$.fragment),js=b(),re(sn.$$.fragment),Hs=b(),re(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",Ut("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(D,"name","gt"),r(D,"class","in-l w-full"),t[3].g.t===void 0&&Ke(()=>t[16].call(D)),r(h,"class","flex"),r(_,"class","my-1"),r(H,"type","hidden"),r(H,"name","p"),H.value="true",ue.__value="10YNO-1--------2",ue.value=ue.__value,x.__value="10YNO-2--------T",x.value=x.__value,W.__value="10YNO-3--------J",W.value=W.__value,U.__value="10YNO-4--------9",U.value=U.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,r(ee,"label","Norway"),Be.__value="10Y1001A1001A44P",Be.value=Be.__value,We.__value="10Y1001A1001A45N",We.value=We.__value,Ne.__value="10Y1001A1001A46L",Ne.value=Ne.__value,ge.__value="10Y1001A1001A47J",ge.value=ge.__value,r(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,S.__value="10YDK-2--------M",S.value=S.__value,r(Re,"label","Denmark"),k.__value="10YAT-APG------L",k.value=k.__value,y.__value="10YBE----------2",y.value=y.__value,N.__value="10YCZ-CEPS-----N",N.value=N.__value,R.__value="10Y1001A1001A39I",R.value=R.__value,J.__value="10YFI-1--------U",J.value=J.__value,te.__value="10YFR-RTE------C",te.value=te.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,we.__value="10YLV-1001A00074",we.value=we.__value,Ae.__value="10YLT-1001A0008Q",Ae.value=Ae.__value,ae.__value="10YNL----------L",ae.value=ae.__value,Ce.__value="10YPL-AREA-----S",Ce.value=Ce.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(j,"name","pr"),r(j,"class","in-f w-full"),t[3].p.r===void 0&&Ke(()=>t[17].call(j)),r(Q,"class","w-full"),r(Ye,"name","pc"),r(Ye,"class","in-l"),t[3].p.c===void 0&&Ke(()=>t[18].call(Ye)),r(Y,"class","flex"),r(G,"class","my-1"),r(qe,"name","pf"),r(qe,"type","number"),r(qe,"min","0.001"),r(qe,"max","65"),r(qe,"step","0.001"),r(qe,"class","in-f tr w-full"),r(ze,"class","w-1/2"),r(ye,"name","pm"),r(ye,"type","number"),r(ye,"min","0.001"),r(ye,"max","1000"),r(ye,"step","0.001"),r(ye,"class","in-l tr w-full"),r(Ee,"class","w-1/2"),r(bt,"class","flex"),r(Ht,"class","my-1"),r(Pt,"type","checkbox"),r(Pt,"name","pe"),Pt.__value="true",Pt.value=Pt.__value,r(Pt,"class","rounded mb-1"),r(hl,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,Al.__value=1,Al.value=Al.__value,El.__value=2,El.value=El.__value,r(Dt,"name","gs"),r(Dt,"class","in-s"),t[3].g.s===void 0&&Ke(()=>t[23].call(Dt)),r(bl,"class","my-1"),r(n,"class","cnt"),r(dn,"class","text-sm"),r(Pl,"href",Ut("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(Gl,"type","hidden"),r(Gl,"name","m"),Gl.value="true",r(mt,"type","hidden"),r(mt,"name","mo"),mt.value="1",vn.__value=0,vn.value=vn.__value,hn.__value=9,hn.value=hn.__value,r(Wt,"name","ma"),r(Wt,"class","in-s"),t[3].m.a===void 0&&Ke(()=>t[26].call(Wt)),r(Il,"class","my-1"),r(Hi,"class","float-right"),r(Xt,"name","mi"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(fi,"class","mt-2 ml-3 whitespace-nowrap"),Ll.__value=0,Ll.value=Ll.__value,Ll.disabled=Wi=t[3].m.b!=0,r(al,"name","mb"),r(al,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ke(()=>t[28].call(al)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=zi=t[3].m.b!=0,bn.__value=2,bn.value=bn.__value,gn.__value=3,gn.value=gn.__value,kn.__value=10,kn.value=kn.__value,wn.__value=11,wn.value=wn.__value,r(dt,"name","mp"),r(dt,"class","in-m"),dt.disabled=Gi=t[3].m.b==0,t[3].m.p===void 0&&Ke(()=>t[29].call(dt)),r(It,"name","ms"),r(It,"type","number"),r(It,"min",64),r(It,"max",Vi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(It,"step",64),r(It,"class","in-l tr w-1/2"),r(Rl,"class","flex w-full"),r(rl,"class","my-1"),yn.__value=2,yn.value=yn.__value,Cn.__value=1,Cn.value=Cn.__value,r(ul,"name","md"),r(ul,"class","in-s"),t[3].m.d===void 0&&Ke(()=>t[31].call(ul)),r(Kl,"class","my-1"),r(Zt,"name","mf"),r(Zt,"type","number"),r(Zt,"min","5"),r(Zt,"max","65535"),r(Zt,"class","in-f tr w-full"),r(Ki,"class","in-post"),r(Sn,"class","flex"),r(Yl,"class","mx-1"),r(Jt,"name","mr"),r(Jt,"type","number"),r(Jt,"min","0"),r(Jt,"max","65535"),r(Jt,"class","in-f tr w-full"),r(Yi,"class","in-post"),r(Tn,"class","flex"),r(Ql,"class","mx-1"),r(Mn,"class","my-1 flex"),r($s,"class","my-1"),r(xt,"type","checkbox"),r(xt,"name","me"),xt.__value="true",xt.value=xt.__value,r(xt,"class","rounded mb-1"),r(Xl,"class","my-1"),r(el,"type","checkbox"),r(el,"name","mm"),el.__value="true",el.value=el.__value,r(el,"class","rounded mb-1"),r(je,"class","cnt"),r(Zi,"class","text-sm"),r($n,"href",Ut("WiFi-configuration")),r($n,"target","_blank"),r($n,"class","float-right"),r(ci,"type","hidden"),r(ci,"name","w"),ci.value="true",An.__value=1,An.value=An.__value,En.__value=2,En.value=En.__value,r(zt,"name","nc"),r(zt,"class","in-s"),t[3].n.c===void 0&&Ke(()=>t[42].call(zt)),r(Zl,"class","my-1"),r(Ot,"class","cnt"),r(Ji,"class","text-sm"),r(Pn,"href",Ut("Network-configuration")),r(Pn,"target","_blank"),r(Pn,"class","float-right"),In.__value="dhcp",In.value=In.__value,On.__value="static",On.value=On.__value,r(fl,"name","nm"),r(fl,"class","in-f"),t[3].n.m===void 0&&Ke(()=>t[48].call(fl)),r(Rt,"name","ni"),r(Rt,"type","text"),r(Rt,"class","in-m w-full"),Rt.disabled=xi=t[3].n.m=="dhcp",Rt.required=es=t[3].n.m=="static",r(Lt,"name","ns"),r(Lt,"class","in-l"),Lt.disabled=ts=t[3].n.m=="dhcp",Lt.required=ls=t[3].n.m=="static",t[3].n.s===void 0&&Ke(()=>t[50].call(Lt)),r(ql,"class","flex"),r(Jl,"class","my-1"),r(tl,"name","nd"),tl.__value="true",tl.value=tl.__value,r(tl,"type","checkbox"),r(tl,"class","rounded mb-1"),r(ns,"class","my-1"),r(mi,"type","hidden"),r(mi,"name","ntp"),mi.value="true",r(ll,"name","ntpd"),ll.__value="true",ll.value=ll.__value,r(ll,"type","checkbox"),r(ll,"class","rounded mb-1"),r(pi,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(ss,"class","flex"),r(Bl,"class","my-1"),r(pt,"class","cnt"),r(os,"class","text-sm"),r(Ln,"href",Ut("MQTT-configuration")),r(Ln,"target","_blank"),r(Ln,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","q"),_i.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(nl,"name","qp"),r(nl,"type","number"),r(nl,"min","1024"),r(nl,"max","65535"),r(nl,"class","in-l tr w-1/4"),r(qn,"class","flex"),r(cl,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Hn.__value=0,Hn.value=Hn.__value,Wn.__value=1,Wn.value=Wn.__value,zn.__value=2,zn.value=zn.__value,Gn.__value=3,Gn.value=Gn.__value,Vn.__value=4,Vn.value=Vn.__value,Kn.__value=255,Kn.value=Kn.__value,r(gt,"name","qm"),r(gt,"class","in-l"),t[3].q.m===void 0&&Ke(()=>t[63].call(gt)),r(Bn,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(tt,"class","cnt"),r(rs,"class","text-sm"),r(Yn,"href",Ut("User-interface")),r(Yn,"target","_blank"),r(Yn,"class","float-right"),r(di,"type","hidden"),r(di,"name","u"),di.value="true",r(vi,"class","flex flex-wrap"),r(ml,"class","cnt"),r(as,"class","text-sm"),r(Xn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Xn,"target","_blank"),r(Xn,"class","float-right"),r(hi,"type","hidden"),r(hi,"name","d"),hi.value="true",r(il,"type","checkbox"),r(il,"name","ds"),il.__value="true",il.value=il.__value,r(il,"class","rounded mb-1"),r(us,"class","mt-3"),r(Ft,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Jn,"type","button"),r(Jn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(cs,"class","text-center"),r(ms,"class","text-right"),r(Ul,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(q,me){C(q,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(a,u,null),s(n,c),s(n,f),s(n,p),s(n,_),s(_,h),s(h,d),s(d,v),s(d,g),s(d,E),s(d,$),ne($,t[3].g.h),s(h,M),s(h,P),s(P,F),s(P,A),s(P,I),s(P,D),se(L,D,null),Se(D,t[3].g.t,!0),s(n,ie),s(n,H),s(n,K),s(n,G),s(G,Y),s(Y,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,j),s(j,ee),s(ee,ue),s(ee,x),s(ee,W),s(ee,U),s(ee,ke),s(j,He),s(He,Be),s(He,We),s(He,Ne),s(He,ge),s(j,Re),s(Re,Me),s(Re,S),s(j,k),s(j,y),s(j,N),s(j,R),s(j,J),s(j,te),s(j,fe),s(j,de),s(j,we),s(j,Ae),s(j,ae),s(j,Ce),s(j,Je),Se(j,t[3].p.r,!0),s(Y,At),s(Y,st),s(st,ht),s(st,lt),s(st,Et),s(st,Ye);for(let _t=0;_t<4;_t+=1)bi[_t]&&bi[_t].m(Ye,null);Se(Ye,t[3].p.c,!0),s(n,Qt),s(n,Ht),s(Ht,bt),s(bt,ze),s(ze,xe),s(ze,Xe),s(ze,Ue),s(ze,qe),ne(qe,t[3].p.f),s(bt,et),s(bt,Ee),s(Ee,Le),s(Ee,pe),s(Ee,ce),s(Ee,ye),ne(ye,t[3].p.m),s(n,zl),s(n,hl),s(hl,_n),s(_n,Pt),Pt.checked=t[3].p.e,s(_n,Ei),s(hl,Pi),kt&&kt.m(hl,null),s(n,Di),s(n,bl),s(bl,Ii),s(bl,Oi),s(bl,Ri),s(bl,Dt),s(Dt,Nl),s(Dt,Al),s(Dt,El),Se(Dt,t[3].g.s,!0),s(n,Li),wt&&wt.m(n,null),s(l,Fi),s(l,je),s(je,dn),s(je,qi),s(je,Pl),se(Dl,Pl,null),s(je,Bi),s(je,Gl),s(je,Ze),s(je,mt),s(je,Vl),s(je,Il),s(Il,Ui),s(Il,Ol),s(Il,ji),s(Il,Wt),s(Wt,vn),s(Wt,hn),Se(Wt,t[3].m.a,!0),s(je,Ao),s(je,rl),s(rl,Hi),s(rl,Eo),s(rl,Ts),s(rl,Po),s(rl,fi),s(fi,Xt),Xt.checked=t[3].m.i,s(fi,Do),s(rl,Io),s(rl,Rl),s(Rl,al),s(al,Ll),s(Ll,Oo);for(let _t=0;_t<7;_t+=1)gi[_t]&&gi[_t].m(al,null);Se(al,t[3].m.b,!0),s(Rl,Ro),s(Rl,dt),s(dt,Fl),s(Fl,Lo),s(dt,bn),s(dt,gn),s(dt,kn),s(dt,wn),Se(dt,t[3].m.p,!0),s(Rl,Fo),s(Rl,It),ne(It,t[3].m.s),s(je,qo),s(je,Kl),s(Kl,Bo),s(Kl,Uo),s(Kl,jo),s(Kl,ul),s(ul,yn),s(ul,Cn),Se(ul,t[3].m.d,!0),s(je,Ho),s(je,Mn),s(Mn,Yl),s(Yl,Wo),s(Yl,zo),s(Yl,Go),s(Yl,Sn),s(Sn,Zt),ne(Zt,t[3].m.f),s(Sn,Vo),s(Sn,Ki),s(Mn,Ko),s(Mn,Ql),s(Ql,Yo),s(Ql,Qo),s(Ql,Xo),s(Ql,Tn),s(Tn,Jt),ne(Jt,t[3].m.r),s(Tn,Zo),s(Tn,Yi),s(je,Jo),s(je,$s),s(je,xo),s(je,Xl),s(Xl,Qi),s(Qi,xt),xt.checked=t[3].m.e.e,s(Qi,er),s(Xl,tr),yt&&yt.m(Xl,null),s(je,lr),Ct&&Ct.m(je,null),s(je,Ns),s(je,Xi),s(Xi,el),el.checked=t[3].m.m.e,s(Xi,nr),s(je,ir),Mt&&Mt.m(je,null),s(l,sr),s(l,Ot),s(Ot,Zi),s(Ot,or),s(Ot,$n),se(Nn,$n,null),s(Ot,rr),s(Ot,ci),s(Ot,ar),s(Ot,Zl),s(Zl,ur),s(Zl,fr),s(Zl,cr),s(Zl,zt),s(zt,An),s(zt,En),qt&&qt.m(zt,null),Se(zt,t[3].n.c,!0),s(Ot,mr),St&&St.m(Ot,null),s(l,pr),s(l,pt),s(pt,Ji),s(pt,_r),s(pt,Pn),se(Dn,Pn,null),s(pt,dr),s(pt,Jl),s(Jl,vr),s(Jl,hr),s(Jl,br),s(Jl,ql),s(ql,fl),s(fl,In),s(fl,On),Se(fl,t[3].n.m,!0),s(ql,gr),s(ql,Rt),ne(Rt,t[3].n.i),s(ql,kr),s(ql,Lt),se(Rn,Lt,null),Se(Lt,t[3].n.s,!0),s(pt,wr),Tt&&Tt.m(pt,null),s(pt,As),s(pt,ns),s(ns,is),s(is,tl),tl.checked=t[3].n.d,s(is,yr),s(pt,Cr),s(pt,mi),s(pt,Mr),s(pt,Bl),s(Bl,Sr),s(Bl,pi),s(pi,ll),ll.checked=t[3].n.h,s(pi,Tr),s(Bl,$r),s(Bl,Nr),s(Bl,ss),s(ss,gl),ne(gl,t[3].n.n1),s(l,Ar),s(l,tt),s(tt,os),s(tt,Er),s(tt,Ln),se(Fn,Ln,null),s(tt,Pr),s(tt,_i),s(tt,Dr),s(tt,cl),s(cl,Ir),$t&&$t.m(cl,null),s(cl,Es),s(cl,Or),s(cl,Rr),s(cl,qn),s(qn,kl),ne(kl,t[3].q.h),s(qn,Lr),s(qn,nl),ne(nl,t[3].q.p),s(tt,Fr),ot&&ot.m(tt,null),s(tt,Ps),s(tt,xl),s(xl,qr),s(xl,Br),s(xl,Ur),s(xl,wl),ne(wl,t[3].q.u),s(tt,jr),s(tt,en),s(en,Hr),s(en,Wr),s(en,zr),s(en,yl),ne(yl,t[3].q.a),s(tt,Gr),s(tt,Bn),s(Bn,Un),s(Un,Vr),s(Un,Kr),s(Un,Yr),s(Un,Cl),ne(Cl,t[3].q.c),s(Bn,Qr),s(Bn,jn),s(jn,Xr),s(jn,Zr),s(jn,Jr),s(jn,gt),s(gt,Hn),s(gt,Wn),s(gt,zn),s(gt,Gn),s(gt,Vn),s(gt,Kn),Se(gt,t[3].q.m,!0),s(tt,xr),s(tt,tn),s(tn,ea),s(tn,ta),s(tn,la),s(tn,Ml),ne(Ml,t[3].q.b),s(l,na),rt&&rt.m(l,null),s(l,Ds),at&&at.m(l,null),s(l,Is),ut&&ut.m(l,null),s(l,Os),ft&&ft.m(l,null),s(l,Ls),s(l,ml),s(ml,rs),s(ml,ia),s(ml,Yn),se(Qn,Yn,null),s(ml,sa),s(ml,di),s(ml,oa),s(ml,vi);for(let _t=0;_t0?wt?wt.p(q,me):(wt=nf(q),wt.c(),wt.m(n,null)):wt&&(wt.d(1),wt=null),me[0]&8&&Se(Wt,q[3].m.a),me[0]&8&&(Xt.checked=q[3].m.i),(!Gt||me[0]&8&&Wi!==(Wi=q[3].m.b!=0))&&(Ll.disabled=Wi),me[0]&8&&Se(al,q[3].m.b),(!Gt||me[0]&8&&zi!==(zi=q[3].m.b!=0))&&(Fl.disabled=zi),(!Gt||me[0]&8&&Gi!==(Gi=q[3].m.b==0))&&(dt.disabled=Gi),me[0]&8&&Se(dt,q[3].m.p),(!Gt||me[0]&9&&Vi!==(Vi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&r(It,"max",Vi),me[0]&8&&he(It.value)!==q[3].m.s&&ne(It,q[3].m.s),me[0]&8&&Se(ul,q[3].m.d),me[0]&8&&he(Zt.value)!==q[3].m.f&&ne(Zt,q[3].m.f),me[0]&8&&he(Jt.value)!==q[3].m.r&&ne(Jt,q[3].m.r),me[0]&8&&(xt.checked=q[3].m.e.e),q[3].m.e.e?yt?yt.p(q,me):(yt=sf(q),yt.c(),yt.m(Xl,null)):yt&&(yt.d(1),yt=null),q[3].m.e.e?Ct?Ct.p(q,me):(Ct=of(q),Ct.c(),Ct.m(je,Ns)):Ct&&(Ct.d(1),Ct=null),me[0]&8&&(el.checked=q[3].m.m.e),q[3].m.m.e?Mt?Mt.p(q,me):(Mt=rf(q),Mt.c(),Mt.m(je,null)):Mt&&(Mt.d(1),Mt=null),q[0].if&&q[0].if.eth?qt||(qt=af(),qt.c(),qt.m(zt,null)):qt&&(qt.d(1),qt=null),me[0]&8&&Se(zt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?St?St.p(q,me):(St=uf(q),St.c(),St.m(Ot,null)):St&&(St.d(1),St=null),me[0]&8&&Se(fl,q[3].n.m),(!Gt||me[0]&8&&xi!==(xi=q[3].n.m=="dhcp"))&&(Rt.disabled=xi),(!Gt||me[0]&8&&es!==(es=q[3].n.m=="static"))&&(Rt.required=es),me[0]&8&&Rt.value!==q[3].n.i&&ne(Rt,q[3].n.i),(!Gt||me[0]&8&&ts!==(ts=q[3].n.m=="dhcp"))&&(Lt.disabled=ts),(!Gt||me[0]&8&&ls!==(ls=q[3].n.m=="static"))&&(Lt.required=ls),me[0]&8&&Se(Lt,q[3].n.s),q[3].n.m=="static"?Tt?Tt.p(q,me):(Tt=ff(q),Tt.c(),Tt.m(pt,As)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&(tl.checked=q[3].n.d),me[0]&8&&(ll.checked=q[3].n.h),me[0]&8&&gl.value!==q[3].n.n1&&ne(gl,q[3].n.n1),q[0].chip!="esp8266"?$t?$t.p(q,me):($t=cf(q),$t.c(),$t.m(cl,Es)):$t&&($t.d(1),$t=null),me[0]&8&&kl.value!==q[3].q.h&&ne(kl,q[3].q.h),me[0]&8&&he(nl.value)!==q[3].q.p&&ne(nl,q[3].q.p),q[3].q.s.e?ot?(ot.p(q,me),me[0]&8&&O(ot,1)):(ot=mf(q),ot.c(),O(ot,1),ot.m(tt,Ps)):ot&&(Ie(),B(ot,1,1,()=>{ot=null}),Oe()),me[0]&8&&wl.value!==q[3].q.u&&ne(wl,q[3].q.u),me[0]&8&&yl.value!==q[3].q.a&&ne(yl,q[3].q.a),me[0]&8&&Cl.value!==q[3].q.c&&ne(Cl,q[3].q.c),me[0]&8&&Se(gt,q[3].q.m),me[0]&8&&Ml.value!==q[3].q.b&&ne(Ml,q[3].q.b),q[3].q.m==3?rt?(rt.p(q,me),me[0]&8&&O(rt,1)):(rt=pf(q),rt.c(),O(rt,1),rt.m(l,Ds)):rt&&(Ie(),B(rt,1,1,()=>{rt=null}),Oe()),q[3].q.m==4?at?(at.p(q,me),me[0]&8&&O(at,1)):(at=_f(q),at.c(),O(at,1),at.m(l,Is)):at&&(Ie(),B(at,1,1,()=>{at=null}),Oe()),q[3].c.es!=null?ut?(ut.p(q,me),me[0]&8&&O(ut,1)):(ut=df(q),ut.c(),O(ut,1),ut.m(l,Os)):ut&&(Ie(),B(ut,1,1,()=>{ut=null}),Oe()),me[0]&8&&(Rs=q[3].p.r.startsWith("10YNO")||q[3].p.r=="10Y1001A1001A48H"),Rs?ft?(ft.p(q,me),me[0]&8&&O(ft,1)):(ft=bf(q),ft.c(),O(ft,1),ft.m(l,Ls)):ft&&(Ie(),B(ft,1,1,()=>{ft=null}),Oe()),me[0]&136){ei=q[7];let Vt;for(Vt=0;Vt20||q[0].chip=="esp8266"||q[3].i.d.d>0?ct?(ct.p(q,me),me[0]&9&&O(ct,1)):(ct=wf(q),ct.c(),O(ct,1),ct.m(l,Fs)):ct&&(Ie(),B(ct,1,1,()=>{ct=null}),Oe()),me[0]&8&&(il.checked=q[3].d.s),q[3].d.s?Nt?Nt.p(q,me):(Nt=Nf(q),Nt.c(),Nt.m(Ft,null)):Nt&&(Nt.d(1),Nt=null);const _t={};me[0]&2&&(_t.active=q[1]),ln.$set(_t);const ha={};me[0]&4&&(ha.active=q[2]),nn.$set(ha);const ba={};me[0]&16&&(ba.active=q[4]),sn.$set(ba);const ga={};me[0]&32&&(ga.active=q[5]),on.$set(ga)},i(q){Gt||(O(a.$$.fragment,q),O(L.$$.fragment,q),O(Dl.$$.fragment,q),O(Nn.$$.fragment,q),O(Dn.$$.fragment,q),O(Rn.$$.fragment,q),O(Fn.$$.fragment,q),O(ot),O(rt),O(at),O(ut),O(ft),O(Qn.$$.fragment,q),O(ct),O(Zn.$$.fragment,q),O(ln.$$.fragment,q),O(nn.$$.fragment,q),O(sn.$$.fragment,q),O(on.$$.fragment,q),Gt=!0)},o(q){B(a.$$.fragment,q),B(L.$$.fragment,q),B(Dl.$$.fragment,q),B(Nn.$$.fragment,q),B(Dn.$$.fragment,q),B(Rn.$$.fragment,q),B(Fn.$$.fragment,q),B(ot),B(rt),B(at),B(ut),B(ft),B(Qn.$$.fragment,q),B(ct),B(Zn.$$.fragment,q),B(ln.$$.fragment,q),B(nn.$$.fragment,q),B(sn.$$.fragment,q),B(on.$$.fragment,q),Gt=!1},d(q){q&&w(e),oe(a),oe(L),Kt(bi,q),kt&&kt.d(),wt&&wt.d(),oe(Dl),Kt(gi,q),yt&&yt.d(),Ct&&Ct.d(),Mt&&Mt.d(),oe(Nn),qt&&qt.d(),St&&St.d(),oe(Dn),oe(Rn),Tt&&Tt.d(),oe(Fn),$t&&$t.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),oe(Qn),Kt(vt,q),ct&&ct.d(),oe(Zn),Nt&&Nt.d(),q&&w(Bs),oe(ln,q),q&&w(Us),oe(nn,q),q&&w(js),oe(sn,q),q&&w(Hs),oe(on,q),Ws=!1,Ge(va)}}}async function Np(){await(await fetch("/reboot",{method:"POST"})).json()}function Ap(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"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"}],o=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};yi.subscribe(Ze=>{Ze.version&&(l(3,a=Ze),l(1,o=!1))}),Vm();let c=!1,f=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ze=new URLSearchParams;Ze.append("perform","true");let Vl=await(await fetch("/reset",{method:"POST",body:Ze})).json();l(4,c=!1),l(5,f=Vl.success)}}async function _(Ze){l(2,u=!0);const mt=new FormData(Ze.target),Vl=new URLSearchParams;for(let Ol of mt){const[ji,Wt]=Ol;Vl.append(ji,Wt)}let Ui=await(await fetch("/save",{method:"POST",body:Vl})).json();Yt.update(Ol=>(Ol.booting=Ui.reboot,Ol.ui=a.u,Ol)),l(2,u=!1),si("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(Ze=>(Ze.booting=!0,Ze)),Np())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.c=!1,mt)))}async function v(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.r=!1,mt)))}async function g(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.k=!1,mt)))}const E=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let $=44;function M(){a.g.h=this.value,l(3,a)}function P(){a.g.t=nt(this),l(3,a)}function F(){a.p.r=nt(this),l(3,a)}function A(){a.p.c=nt(this),l(3,a)}function I(){a.p.f=he(this.value),l(3,a)}function D(){a.p.m=he(this.value),l(3,a)}function L(){a.p.e=this.checked,l(3,a)}function ie(){a.p.t=this.value,l(3,a)}function H(){a.g.s=nt(this),l(3,a)}function K(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function Y(){a.m.a=nt(this),l(3,a)}function Q(){a.m.i=this.checked,l(3,a)}function z(){a.m.b=nt(this),l(3,a)}function Z(){a.m.p=nt(this),l(3,a)}function V(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=nt(this),l(3,a)}function ee(){a.m.f=he(this.value),l(3,a)}function ue(){a.m.r=he(this.value),l(3,a)}function x(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function U(){a.m.e.a=this.value,l(3,a)}function ke(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=he(this.value),l(3,a)}function Be(){a.m.m.v=he(this.value),l(3,a)}function We(){a.m.m.a=he(this.value),l(3,a)}function Ne(){a.m.m.c=he(this.value),l(3,a)}function ge(){a.n.c=nt(this),l(3,a)}function Re(){a.w.s=this.value,l(3,a)}function Me(){a.w.p=this.value,l(3,a)}function S(){a.w.z=nt(this),l(3,a)}function k(){a.w.w=he(this.value),l(3,a)}function y(){a.w.b=this.checked,l(3,a)}function N(){a.n.m=nt(this),l(3,a)}function R(){a.n.i=this.value,l(3,a)}function J(){a.n.s=nt(this),l(3,a)}function te(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function we(){a.n.d=this.checked,l(3,a)}function Ae(){a.n.h=this.checked,l(3,a)}function ae(){a.n.n1=this.value,l(3,a)}function Ce(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function At(){a.q.p=he(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function ht(){a.q.a=this.value,l(3,a)}function lt(){a.q.c=this.value,l(3,a)}function Et(){a.q.m=nt(this),l(3,a)}function Ye(){a.q.b=this.value,l(3,a)}function Qt(){a.o.e=this.value,l(3,a)}function Ht(){a.o.c=this.value,l(3,a)}function bt(){a.o.u1=this.value,l(3,a)}function ze(){a.o.u2=this.value,l(3,a)}function xe(){a.o.u3=this.value,l(3,a)}function Xe(){a.h.t=this.value,l(3,a)}function Ue(){a.h.h=this.value,l(3,a)}function qe(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function Ee(){a.c.i=this.value,l(3,a)}function Le(){a.c.s=this.value,l(3,a)}function pe(){a.c.es=this.checked,l(3,a)}function ce(Ze){a.t.t[Ze]=he(this.value),l(3,a)}function ye(){a.t.h=he(this.value),l(3,a)}function zl(Ze){a.u[Ze.key]=nt(this),l(3,a)}function hl(){a.i.h.p=nt(this),l(3,a)}function _n(){a.i.h.t=nt(this),l(3,a)}function Pt(){a.i.h.u=this.checked,l(3,a)}function Ei(){a.i.a=he(this.value),l(3,a)}function Pi(){a.i.l.p=he(this.value),l(3,a)}function Di(){a.i.l.i=this.checked,l(3,a)}function bl(){a.i.r.i=this.checked,l(3,a)}function Ii(){a.i.r.r=he(this.value),l(3,a)}function Oi(){a.i.r.g=he(this.value),l(3,a)}function Ri(){a.i.r.b=he(this.value),l(3,a)}function Dt(){a.i.d.d=he(this.value),l(3,a)}function Nl(){a.i.t.d=he(this.value),l(3,a)}function Al(){a.i.t.a=he(this.value),l(3,a)}function El(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Fi(){a.i.v.d.g=he(this.value),l(3,a)}function je(){a.i.d.b=nt(this),l(3,a)}function dn(){a.i.v.o=he(this.value),l(3,a)}function qi(){a.i.v.m=he(this.value),l(3,a)}function Pl(){a.i.v.b=he(this.value),l(3,a)}function Dl(){a.d.s=this.checked,l(3,a)}function Bi(){a.d.t=this.checked,l(3,a)}function Gl(){a.d.l=nt(this),l(3,a)}return t.$$set=Ze=>{"sysinfo"in Ze&&l(0,n=Ze.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,c,f,$,i,p,_,h,d,v,g,E,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,S,k,y,N,R,J,te,fe,de,we,Ae,ae,Ce,Je,At,st,ht,lt,Et,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et,Ee,Le,pe,ce,ye,zl,hl,_n,Pt,Ei,Pi,Di,bl,Ii,Oi,Ri,Dt,Nl,Al,El,Li,Fi,je,dn,qi,Pl,Dl,Bi,Gl]}class Ep extends De{constructor(e){super(),Pe(this,e,Ap,$p,$e,{sysinfo:0},null,[-1,-1,-1,-1])}}function Ef(t,e,l){const n=t.slice();return n[20]=e[l],n}function Pp(t){let e=ve(t[1].chip,t[1].board)+"",l;return{c(){l=T(e)},m(n,i){C(n,l,i)},p(n,i){i&2&&e!==(e=ve(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&w(l)}}}function Pf(t){let e,l,n=t[1].apmac+"",i,o,u,a,c,f,p,_,h,d=Fa(t[1])+"",v,g,E=t[1].boot_reason+"",$,M,P=t[1].ex_cause+"",F,A,I;const D=[Ip,Dp],L=[];function ie(H,K){return H[0].u>0?0:1}return c=ie(t),f=L[c]=D[c](t),{c(){e=m("div"),l=T("AP MAC: "),i=T(n),o=b(),u=m("div"),a=T(`Last boot: - `),f.c(),p=b(),_=m("div"),h=T("Reason: "),v=T(d),g=T(" ("),$=T(E),M=T("/"),F=T(P),A=T(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(H,K){C(H,e,K),s(e,l),s(e,i),C(H,o,K),C(H,u,K),s(u,a),L[c].m(u,null),C(H,p,K),C(H,_,K),s(_,h),s(_,v),s(_,g),s(_,$),s(_,M),s(_,F),s(_,A),I=!0},p(H,K){(!I||K&2)&&n!==(n=H[1].apmac+"")&&X(i,n);let G=c;c=ie(H),c===G?L[c].p(H,K):(Ie(),B(L[G],1,1,()=>{L[G]=null}),Oe(),f=L[c],f?f.p(H,K):(f=L[c]=D[c](H),f.c()),O(f,1),f.m(u,null)),(!I||K&2)&&d!==(d=Fa(H[1])+"")&&X(v,d),(!I||K&2)&&E!==(E=H[1].boot_reason+"")&&X($,E),(!I||K&2)&&P!==(P=H[1].ex_cause+"")&&X(F,P)},i(H){I||(O(f),I=!0)},o(H){B(f),I=!1},d(H){H&&w(e),H&&w(o),H&&w(u),L[c].d(),H&&w(p),H&&w(_)}}}function Dp(t){let e;return{c(){e=T("-")},m(l,n){C(l,e,n)},p:_e,i:_e,o:_e,d(l){l&&w(e)}}}function Ip(t){let e,l;return e=new Yc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Op(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){C(l,e,n)},p:_e,d(l){l&&w(e)}}}function Df(t){let e,l,n,i,o,u=ys(t[1].meter.mfg)+"",a,c,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,d,v,g,E=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=T("Manufacturer: "),a=T(u),c=b(),f=m("div"),p=T("Model: "),h=T(_),d=b(),v=m("div"),g=T("ID: "),$=T(E),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(v,"class","my-2"),r(e,"class","cnt")},m(M,P){C(M,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,p),s(f,h),s(e,d),s(e,v),s(v,g),s(v,$)},p(M,P){P&2&&u!==(u=ys(M[1].meter.mfg)+"")&&X(a,u),P&2&&_!==(_=(M[1].meter.model?M[1].meter.model:"unknown")+"")&&X(h,_),P&2&&E!==(E=(M[1].meter.id?M[1].meter.id:"unknown")+"")&&X($,E)},d(M){M&&w(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",a,c,f,p,_=t[1].net.mask+"",h,d,v,g,E=t[1].net.gw+"",$,M,P,F,A=t[1].net.dns1+"",I,D,L=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=T("IP: "),a=T(u),c=b(),f=m("div"),p=T("Mask: "),h=T(_),d=b(),v=m("div"),g=T("Gateway: "),$=T(E),M=b(),P=m("div"),F=T("DNS: "),I=T(A),D=b(),L&&L.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(v,"class","my-2"),r(P,"class","my-2"),r(e,"class","cnt")},m(ie,H){C(ie,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,p),s(f,h),s(e,d),s(e,v),s(v,g),s(v,$),s(e,M),s(e,P),s(P,F),s(P,I),s(P,D),L&&L.m(P,null)},p(ie,H){H&2&&u!==(u=ie[1].net.ip+"")&&X(a,u),H&2&&_!==(_=ie[1].net.mask+"")&&X(h,_),H&2&&E!==(E=ie[1].net.gw+"")&&X($,E),H&2&&A!==(A=ie[1].net.dns1+"")&&X(I,A),ie[1].net.dns2?L?L.p(ie,H):(L=Of(ie),L.c(),L.m(P,null)):L&&(L.d(1),L=null)},d(ie){ie&&w(e),L&&L.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=T("/ "),n=T(l)},m(i,o){C(i,e,o),C(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&w(e),i&&w(n)}}}function Rf(t){let e,l,n,i=t[1].upgrade.t+"",o,u,a=t[1].version+"",c,f,p=t[1].upgrade.x+"",_,h,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=T("Previous upgrade attempt ("),o=T(i),u=T(") does not match current version ("),c=T(a),f=T(") ["),_=T(p),h=T("/"),v=T(d),g=T("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(E,$){C(E,e,$),s(e,l),s(l,n),s(l,o),s(l,u),s(l,c),s(l,f),s(l,_),s(l,h),s(l,v),s(l,g)},p(E,$){$&2&&i!==(i=E[1].upgrade.t+"")&&X(o,i),$&2&&a!==(a=E[1].version+"")&&X(c,a),$&2&&p!==(p=E[1].upgrade.x+"")&&X(_,p),$&2&&d!==(d=E[1].upgrade.e+"")&&X(v,d)},d(E){E&&w(e)}}}function Lf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Ff(t),h=t[1].fwconsent===2&&qf();return{c(){e=m("div"),l=T(`Latest version: - `),n=m("a"),o=T(i),a=b(),_&&_.c(),c=b(),h&&h.c(),f=Ve(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(d,v){C(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),C(d,c,v),h&&h.m(d,v),C(d,f,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&X(o,i),(!p||v&4&&u!==(u=d[2].html_url))&&r(n,"href",u),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&O(_,1)):(_=Ff(d),_.c(),O(_,1),_.m(e,null)):_&&(Ie(),B(_,1,1,()=>{_=null}),Oe()),d[1].fwconsent===2?h||(h=qf(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(d){p||(O(_),p=!0)},o(d){B(_),p=!1},d(d){d&&w(e),_&&_.d(),d&&w(c),h&&h.d(d),d&&w(f)}}}function Ff(t){let e,l,n,i,o,u;return n=new Qc({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,c){C(a,e,c),s(e,l),se(n,l,null),i=!0,o||(u=le(l,"click",t[10]),o=!0)},p:_e,i(a){i||(O(n.$$.fragment,a),i=!0)},o(a){B(n.$$.fragment,a),i=!1},d(a){a&&w(e),oe(n),o=!1,u()}}}function qf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Bf(t){let e,l=Cs(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=T(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Cs(ve(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&w(e)}}}function Uf(t){let e,l,n,i,o,u;function a(p,_){return p[4].length==0?Lp:Rp}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),f.c(),nc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){C(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[le(n,"change",t[13]),le(l,"submit",t[15])],o=!0)},p(p,_){c===(c=a(p))&&f?f.p(p,_):(f.d(1),f=c(p),f&&(f.c(),f.m(l,null)))},d(p){p&&w(e),t[12](null),f.d(),o=!1,Ge(u)}}}function Rp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=T(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){C(o,l,u),C(o,n,u),C(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function Lp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){C(i,e,o),l||(n=le(e,"click",t[14]),l=!0)},p:_e,d(i){i&&w(e),l=!1,n()}}}function jf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g=t[9],E=[];for(let A=0;A Include Secrets
(SSID, PSK, passwords and tokens)',c=b(),$&&$.c(),f=b(),p=m("form"),_=m("input"),h=b(),F.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),nc(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(A,I){C(A,e,I),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D{N=null}),Oe());const At={};Ce&8388608&&(At.$$scope={dirty:Ce,ctx:ae}),ie.$set(At),ae[1].meter?R?R.p(ae,Ce):(R=Df(ae),R.c(),R.m(e,Y)):R&&(R.d(1),R=null),ae[1].net?J?J.p(ae,Ce):(J=If(ae),J.c(),J.m(e,Q)):J&&(J.d(1),J=null),(!S||Ce&2)&&ue!==(ue=ae[1].version+"")&&X(x,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?te?te.p(ae,Ce):(te=Rf(ae),te.c(),te.m(z,U)):te&&(te.d(1),te=null),ae[2]?fe?(fe.p(ae,Ce),Ce&4&&O(fe,1)):(fe=Lf(ae),fe.c(),O(fe,1),fe.m(z,ke)):fe&&(Ie(),B(fe,1,1,()=>{fe=null}),Oe()),Ce&3&&(He=(ae[1].security==0||ae[0].a)&&oi(ae[1].board)),He?de?de.p(ae,Ce):(de=Bf(ae),de.c(),de.m(z,Be)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?we?we.p(ae,Ce):(we=Uf(ae),we.c(),we.m(z,null)):we&&(we.d(1),we=null),ae[1].security==0||ae[0].a?Ae?Ae.p(ae,Ce):(Ae=jf(ae),Ae.c(),Ae.m(e,null)):Ae&&(Ae.d(1),Ae=null);const st={};Ce&32&&(st.active=ae[5]),ge.$set(st);const ht={};Ce&256&&(ht.active=ae[8]),Me.$set(ht)},i(ae){S||(O(E.$$.fragment,ae),O(N),O(ie.$$.fragment,ae),O(fe),O(ge.$$.fragment,ae),O(Me.$$.fragment,ae),S=!0)},o(ae){B(E.$$.fragment,ae),B(N),B(ie.$$.fragment,ae),B(fe),B(ge.$$.fragment,ae),B(Me.$$.fragment,ae),S=!1},d(ae){ae&&w(e),oe(E),N&&N.d(),oe(ie),R&&R.d(),J&&J.d(),te&&te.d(),fe&&fe.d(),de&&de.d(),we&&we.d(),Ae&&Ae.d(),ae&&w(Ne),oe(ge,ae),ae&&w(Re),oe(Me,ae),k=!1,y()}}}async function Up(){await(await fetch("/reboot",{method:"POST"})).json()}function jp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};To.subscribe(D=>{l(2,u=Kc(i.version,D)),u||l(2,u=D[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(D=>(D.upgrading=!0,D)),Vc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(D=>(D.booting=!0,D)),Up())};let f,p=[],_=!1,h,d=[],v=!1;yo();function g(D){ks[D?"unshift":"push"](()=>{f=D,l(3,f)})}function E(){p=this.files,l(4,p)}const $=()=>{f.click()},M=()=>l(5,_=!0);function P(D){ks[D?"unshift":"push"](()=>{h=D,l(6,h)})}function F(){d=this.files,l(7,d)}const A=()=>{h.click()},I=()=>l(8,v=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,u,f,p,_,h,d,v,o,a,c,g,E,$,M,P,F,A,I]}class Hp extends De{constructor(e){super(),Pe(this,e,jp,Bp,$e,{data:0,sysinfo:1})}}function zf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",a,c,f=ve(t[0],4)+"",p,_,h=ve(t[0],3)+"",d,v,g,E,$=ve(t[0],2)+"",M,P,F=ve(t[0],1)+"",A,I,D=ve(t[0],0)+"",L,ie,H,K,G=ve(t[0],101)+"",Y,Q,z=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),a=T(u),c=m("option"),p=T(f),_=m("option"),d=T(h),v=b(),g=m("optgroup"),E=m("option"),M=T($),P=m("option"),A=T(F),I=m("option"),L=T(D),ie=b(),H=m("optgroup"),K=m("option"),Y=T(G),Q=m("option"),Z=T(z),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),E.__value=2,E.value=E.__value,P.__value=1,P.value=P.__value,I.__value=0,I.value=I.__value,r(g,"label","Custom hardware"),K.__value=101,K.value=K.__value,Q.__value=100,Q.value=Q.__value,r(H,"label","Generic hardware")},m(V,j){C(V,e,j),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,d),C(V,v,j),C(V,g,j),s(g,E),s(E,M),s(g,P),s(P,A),s(g,I),s(I,L),C(V,ie,j),C(V,H,j),s(H,K),s(K,Y),s(H,Q),s(Q,Z)},p(V,j){j&1&&n!==(n=ve(V[0],7)+"")&&X(i,n),j&1&&u!==(u=ve(V[0],5)+"")&&X(a,u),j&1&&f!==(f=ve(V[0],4)+"")&&X(p,f),j&1&&h!==(h=ve(V[0],3)+"")&&X(d,h),j&1&&$!==($=ve(V[0],2)+"")&&X(M,$),j&1&&F!==(F=ve(V[0],1)+"")&&X(A,F),j&1&&D!==(D=ve(V[0],0)+"")&&X(L,D),j&1&&G!==(G=ve(V[0],101)+"")&&X(Y,G),j&1&&z!==(z=ve(V[0],100)+"")&&X(Z,z)},d(V){V&&w(e),V&&w(v),V&&w(g),V&&w(ie),V&&w(H)}}}function Gf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",a,c,f=ve(t[0],203)+"",p,_,h=ve(t[0],241)+"",d,v,g=ve(t[0],242)+"",E,$,M=ve(t[0],243)+"",P,F,A=ve(t[0],200)+"",I;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),a=T(u),c=m("option"),p=T(f),_=m("option"),d=T(h),v=m("option"),E=T(g),$=m("option"),P=T(M),F=m("option"),I=T(A),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=241,_.value=_.__value,v.__value=242,v.value=v.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(D,L){C(D,e,L),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),s(e,_),s(_,d),s(e,v),s(v,E),s(e,$),s($,P),s(e,F),s(F,I)},p(D,L){L&1&&n!==(n=ve(D[0],201)+"")&&X(i,n),L&1&&u!==(u=ve(D[0],202)+"")&&X(a,u),L&1&&f!==(f=ve(D[0],203)+"")&&X(p,f),L&1&&h!==(h=ve(D[0],241)+"")&&X(d,h),L&1&&g!==(g=ve(D[0],242)+"")&&X(E,g),L&1&&M!==(M=ve(D[0],243)+"")&&X(P,M),L&1&&A!==(A=ve(D[0],200)+"")&&X(I,A)},d(D){D&&w(e)}}}function Vf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",a,c,f=ve(t[0],5)+"",p,_,h,d,v=ve(t[0],51)+"",g,E,$=ve(t[0],50)+"",M;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=m("option"),a=T(u),c=m("option"),p=T(f),_=b(),h=m("optgroup"),d=m("option"),g=T(v),E=m("option"),M=T($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,E.__value=50,E.value=E.__value,r(h,"label","Generic hardware")},m(P,F){C(P,e,F),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,p),C(P,_,F),C(P,h,F),s(h,d),s(d,g),s(h,E),s(E,M)},p(P,F){F&1&&n!==(n=ve(P[0],7)+"")&&X(i,n),F&1&&u!==(u=ve(P[0],6)+"")&&X(a,u),F&1&&f!==(f=ve(P[0],5)+"")&&X(p,f),F&1&&v!==(v=ve(P[0],51)+"")&&X(g,v),F&1&&$!==($=ve(P[0],50)+"")&&X(M,$)},d(P){P&&w(e),P&&w(_),P&&w(h)}}}function Kf(t){let e,l,n=ve(t[0],8)+"",i,o,u,a,c=ve(t[0],71)+"",f,p,_=ve(t[0],70)+"",h;return{c(){e=m("optgroup"),l=m("option"),i=T(n),o=b(),u=m("optgroup"),a=m("option"),f=T(c),p=m("option"),h=T(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(d,v){C(d,e,v),s(e,l),s(l,i),C(d,o,v),C(d,u,v),s(u,a),s(a,f),s(u,p),s(p,h)},p(d,v){v&1&&n!==(n=ve(d[0],8)+"")&&X(i,n),v&1&&c!==(c=ve(d[0],71)+"")&&X(f,c),v&1&&_!==(_=ve(d[0],70)+"")&&X(h,_)},d(d){d&&w(e),d&&w(o),d&&w(u)}}}function Yf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=T(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){C(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&X(i,n)},d(o){o&&w(e)}}}function Wp(t){let e,l,n,i,o,u,a,c=t[0]=="esp8266"&&zf(t),f=t[0]=="esp32"&&Gf(t),p=t[0]=="esp32s2"&&Vf(t),_=t[0]=="esp32c3"&&Kf(t),h=t[0]=="esp32solo"&&Yf(t);return{c(){e=m("option"),l=b(),c&&c.c(),n=b(),f&&f.c(),i=b(),p&&p.c(),o=b(),_&&_.c(),u=b(),h&&h.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(d,v){C(d,e,v),C(d,l,v),c&&c.m(d,v),C(d,n,v),f&&f.m(d,v),C(d,i,v),p&&p.m(d,v),C(d,o,v),_&&_.m(d,v),C(d,u,v),h&&h.m(d,v),C(d,a,v)},p(d,[v]){d[0]=="esp8266"?c?c.p(d,v):(c=zf(d),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),d[0]=="esp32"?f?f.p(d,v):(f=Gf(d),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Vf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Kf(d),_.c(),_.m(u.parentNode,u)):_&&(_.d(1),_=null),d[0]=="esp32solo"?h?h.p(d,v):(h=Yf(d),h.c(),h.m(a.parentNode,a)):h&&(h.d(1),h=null)},i:_e,o:_e,d(d){d&&w(e),d&&w(l),c&&c.d(d),d&&w(n),f&&f.d(d),d&&w(i),p&&p.d(d),d&&w(o),_&&_.d(d),d&&w(u),h&&h.d(d),d&&w(a)}}}function zp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Gp extends De{constructor(e){super(),Pe(this,e,zp,Wp,$e,{chip:0})}}function Qf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Xf(t){let e,l,n,i,o,u,a;return u=new fo({props:{chip:t[0].chip}}),{c(){e=m("div"),l=T("HAN GPIO"),n=m("br"),i=b(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){C(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),a=!0},p(c,f){const p={};f&1&&(p.chip=c[0].chip),u.$set(p)},i(c){a||(O(u.$$.fragment,c),a=!0)},o(c){B(u.$$.fragment,c),a=!1},d(c){c&&w(e),oe(u)}}}function Vp(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q=t[0].usrcfg&&Qf();v=new Gp({props:{chip:t[0].chip}});let z=t[0].board&&t[0].board>20&&Xf(t);return H=new jt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",a=b(),Q&&Q.c(),c=b(),f=m("div"),p=T("Board type"),_=m("br"),h=b(),d=m("select"),re(v.$$.fragment),g=b(),z&&z.c(),E=b(),$=m("div"),M=m("label"),P=m("input"),F=T(" Clear all other configuration"),A=b(),I=m("div"),I.innerHTML='',D=b(),L=m("span"),L.textContent=" ",ie=b(),re(H.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(d,"name","vb"),r(d,"class","in-s"),t[0].board===void 0&&Ke(()=>t[4].call(d)),r(f,"class","my-3"),r(P,"type","checkbox"),r(P,"name","vr"),P.__value="true",P.value=P.__value,r(P,"class","rounded mb-1"),r($,"class","my-3"),r(I,"class","my-3"),r(L,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){C(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),Q&&Q.m(n,null),s(n,c),s(n,f),s(f,p),s(f,_),s(f,h),s(f,d),se(v,d,null),Se(d,t[0].board,!0),s(n,g),z&&z.m(n,null),s(n,E),s(n,$),s($,M),s(M,P),P.checked=t[2],s(M,F),s(n,A),s(n,I),s(n,D),s(n,L),C(Z,ie,V),se(H,Z,V),K=!0,G||(Y=[le(d,"change",t[4]),le(P,"change",t[5]),le(n,"submit",Ms(t[3]))],G=!0)},p(Z,[V]){Z[0].usrcfg?Q||(Q=Qf(),Q.c(),Q.m(n,c)):Q&&(Q.d(1),Q=null);const j={};V&1&&(j.chip=Z[0].chip),v.$set(j),V&1&&Se(d,Z[0].board),Z[0].board&&Z[0].board>20?z?(z.p(Z,V),V&1&&O(z,1)):(z=Xf(Z),z.c(),O(z,1),z.m(n,E)):z&&(Ie(),B(z,1,1,()=>{z=null}),Oe()),V&4&&(P.checked=Z[2]);const ee={};V&2&&(ee.active=Z[1]),H.$set(ee)},i(Z){K||(O(v.$$.fragment,Z),O(z),O(H.$$.fragment,Z),K=!0)},o(Z){B(v.$$.fragment,Z),B(z),B(H.$$.fragment,Z),K=!1},d(Z){Z&&w(e),Q&&Q.d(),oe(v),z&&z.d(),Z&&w(ie),oe(H,Z),G=!1,Ge(Y)}}}function Kp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const p=new FormData(f.target),_=new URLSearchParams;for(let v of p){const[g,E]=v;_.append(g,E)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Yt.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),si(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=nt(this),l(0,n)}function c(){u=this.checked,l(2,u),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,o,a,c]}class Yp extends De{constructor(e){super(),Pe(this,e,Kp,Vp,$e,{sysinfo:0})}}function Zf(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Jf(t){let e,l,n,i,o,u,a,c,f,p,_,h,d;return{c(){e=m("div"),l=T("SSID"),n=m("br"),i=b(),o=m("input"),a=b(),c=m("div"),f=T("PSK"),p=m("br"),_=b(),h=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(h,"name","sp"),r(h,"type","password"),r(h,"class","in-s"),r(h,"autocomplete","off"),h.required=d=t[2]==2,r(c,"class","my-3")},m(v,g){C(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),C(v,a,g),C(v,c,g),s(c,f),s(c,p),s(c,_),s(c,h)},p(v,g){g&4&&u!==(u=v[2]==1||v[2]==2)&&(o.required=u),g&4&&d!==(d=v[2]==2)&&(h.required=d)},d(v){v&&w(e),v&&w(a),v&&w(c)}}}function xf(t){let e,l,n,i,o,u,a,c;return a=new Zc({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),re(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,p){C(f,e,p),C(f,l,p),C(f,n,p),s(n,i),s(n,o),s(n,u),se(a,u,null),c=!0},p(f,p){(!c||p&2)&&(i.required=f[1]),(!c||p&2)&&(u.required=f[1])},i(f){c||(O(a.$$.fragment,f),c=!0)},o(f){B(a.$$.fragment,f),c=!1},d(f){f&&w(e),f&&w(l),f&&w(n),oe(a)}}}function ec(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
+(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function _e(){}function sl(t,e){for(const l in e)t[l]=e[l];return t}function tc(t){return t()}function wa(){return Object.create(null)}function Ge(t){t.forEach(tc)}function co(t){return typeof t=="function"}function $e(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ps;function Xs(t,e){return ps||(ps=document.createElement("a")),ps.href=e,t===ps.href}function t0(t){return Object.keys(t).length===0}function mo(t,...e){if(t==null)return _e;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function ri(t){let e;return mo(t,l=>e=l)(),e}function _l(t,e,l){t.$$.on_destroy.push(mo(e,l))}function po(t,e,l,n){if(t){const i=lc(t,e,l,n);return t[0](i)}}function lc(t,e,l,n){return t[1]&&n?sl(l.ctx.slice(),t[1](n(e))):l.ctx}function _o(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],l=t.ctx.length/32;for(let n=0;nt.removeEventListener(e,l,n)}function Ms(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 n0=["width","height"];function ai(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&&n0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function i0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function s0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function o0(t,e,l){~l0.indexOf(l)?s0(t,e):X(t,e)}function ne(t,e){t.value=e??""}function nc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Te(t,e,l){for(let n=0;n{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=le(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),y(n)}}function a0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function ya(t,e){return new t(e)}let Ti;function Ci(t){Ti=t}function Si(){if(!Ti)throw new Error("Function called outside component initialization");return Ti}function sc(t){Si().$$.on_mount.push(t)}function u0(t){Si().$$.on_destroy.push(t)}function f0(){const t=Si();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=a0(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Si().$$.context.set(t,e),e}function Hl(t){return Si().$$.context.get(t)}const ni=[],ks=[];let ii=[];const Ca=[],oc=Promise.resolve();let Zs=!1;function rc(){Zs||(Zs=!0,oc.then(ac))}function c0(){return rc(),oc}function Ke(t){ii.push(t)}const zs=new Set;let ti=0;function ac(){if(ti!==0)return;const t=Ti;do{try{for(;tit.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ii=e}const hs=new Set;let rn;function Ie(){rn={r:0,c:[],p:rn}}function Oe(){rn.r||Ge(rn.c),rn=rn.p}function O(t,e){t&&t.i&&(hs.delete(t),t.i(e))}function B(t,e,l,n){if(t&&t.o){if(hs.has(t))return;hs.add(t),rn.c.push(()=>{hs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function uc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const f in u)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in u)i[f]=1}for(const u in n)u in l||(l[u]=void 0);return l}function Ma(t){return typeof t=="object"&&t!==null?t:{}}function re(t){t&&t.c()}function se(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||Ke(()=>{const u=t.$$.on_mount.map(tc).filter(co);t.$$.on_destroy?t.$$.on_destroy.push(...u):Ge(u),t.$$.on_mount=[]}),o.forEach(Ke)}function oe(t,e){const l=t.$$;l.fragment!==null&&(p0(l.after_update),Ge(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function _0(t,e){t.$$.dirty[0]===-1&&(ni.push(t),rc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const v=d.length?d[0]:h;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&_0(t,_)),h}):[],c.update(),p=!0,Ge(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=i0(e.target);c.fragment&&c.fragment.l(_),_.forEach(y)}else c.fragment&&c.fragment.c();e.intro&&O(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),ac()}Ci(f)}class De{$destroy(){oe(this,1),this.$destroy=_e}$on(e,l){if(!co(l))return _e;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&&!t0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Ta=t=>typeof t>"u",fc=t=>typeof t=="function",cc=t=>typeof t=="number";function d0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function mc(){let t=0;return()=>t++}function v0(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function pc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const _c=(t,e)=>t?{}:{style:e},Js=t=>({"aria-hidden":"true",..._c(t,"display:none;")}),li=[];function dc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=_e){let l;const n=new Set;function i(a){if($e(t,a)&&(t=a,l)){const f=!li.length;for(const c of n)c[1](),li.push(c,t);if(f){for(let c=0;c{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function h0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return dc(l,u=>{let a=!1;const f=[];let c=0,p=_e;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,u);o?u(d):p=co(d)?d:_e},h=i.map((d,v)=>mo(d,g=>{f[v]=g,c&=~(1<{c|=1<`@@svnav-ctx__${t}`,xs=$i("LOCATION"),ui=$i("ROUTER"),vc=$i("ROUTE"),b0=$i("ROUTE_PARAMS"),g0=$i("FOCUS_ELEM"),hc=/^:(.+)/,ki=(t,e,l)=>t.substr(e,l),eo=(t,e)=>ki(t,0,e.length)===e,k0=t=>t==="",w0=t=>hc.test(t),bc=t=>t[0]==="*",y0=t=>t.replace(/\*.*$/,""),gc=t=>t.replace(/(^\/+|\/+$)/g,"");function vl(t,e=!1){const l=gc(t).split("/");return e?l.filter(Boolean):l}const Gs=(t,e)=>t+(e?`?${e}`:""),bo=t=>`/${gc(t)}`;function Ni(...t){const e=n=>vl(n,!0).join("/"),l=t.map(e).join("/");return bo(l)}const go=1,Ts=2,mn=3,C0=4,kc=5,M0=6,wc=7,T0=8,S0=9,yc=10,Cc=11,$0={[go]:"Link",[Ts]:"Route",[mn]:"Router",[C0]:"useFocus",[kc]:"useLocation",[M0]:"useMatch",[wc]:"useNavigate",[T0]:"useParams",[S0]:"useResolvable",[yc]:"useResolve",[Cc]:"navigate"},ko=t=>$0[t];function N0(t,e){let l;return t===Ts?l=e.path?`path="${e.path}"`:"default":t===go?l=`to="${e.to}"`:t===mn&&(l=`basepath="${e.basepath||""}"`),`<${ko(t)} ${l||""} />`}function E0(t,e,l,n){const i=l&&N0(n||t,l),o=i?` + +Occurred in: ${i}`:"",u=ko(t),a=fc(e)?e(u):e;return`<${u}> ${a}${o}`}const Mc=t=>(...e)=>t(E0(...e)),Tc=Mc(t=>{throw new Error(t)}),ws=Mc(console.warn),Sa=4,A0=3,P0=2,D0=1,I0=1;function O0(t,e){const l=t.default?0:vl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Sa,k0(i)?o+=I0:w0(i)?o+=P0:bc(i)?o-=Sa+D0:o+=A0,o},0);return{route:t,score:l,index:e}}function R0(t){return t.map(O0).sort((e,l)=>e.scorel.score?-1:e.index-l.index)}function Sc(t,e){let l,n;const[i]=e.split("?"),o=vl(i),u=o[0]==="",a=R0(t);for(let f=0,c=a.length;f({...p,params:h,uri:$});if(p.default){n=d(e);continue}const v=vl(p.fullPath),g=Math.max(o.length,v.length);let A=0;for(;A{c===".."?f.pop():c!=="."&&f.push(c)}),Gs(`/${f.join("/")}`,n)}function $a(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=vl(e,!0),a=vl(l,!0);for(;u.length;)u[0]!==a[0]&&Tc(mn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:Ni(...a),hash:n,search:i,state:o}}const Na=t=>t.length===1?"":t,wo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Na(ki(t,l)):"",u=i?ki(t,0,l):t,a=n?Na(ki(u,e)):"";return{pathname:(n?ki(u,0,e):u)||"/",search:a,hash:o}},F0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function q0(t,e,l){return Ni(l,L0(t,e))}function B0(t,e){const l=bo(y0(t)),n=vl(l,!0),i=vl(e,!0).slice(0,n.length),o=$c({fullPath:l},Ni(...i));return o&&o.uri}const Vs="POP",U0="PUSH",j0="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function H0(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=pc(t,"popstate",u);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,u){const{state:a={},replace:f=!1}=u||{};if(n=f?j0:U0,cc(o))u&&ws(Cc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const c={...a,_key:v0()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Ks(t),i()}}}function Ys(t,e){return{...wo(e),state:t}}function W0(t="/"){let e=0,l=[Ys(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(Ys(n,o))},replaceState(n,i,o){l[e]=Ys(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const z0=!!(!Wl&&window.document&&window.document.createElement),G0=!Wl&&window.location.origin==="null",Nc=H0(z0&&!G0?window:W0()),{navigate:si}=Nc;let Sl=null,Ec=!0;function V0(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;nSl.level||t.level===Sl.level&&V0(t.routerId,Sl.routerId))&&(Sl=t)}function Y0(){Sl=null}function Q0(){Ec=!1}function Ea(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=pc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function X0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Z0(t){return/^H[1-6]$/i.test(t.tagName)}function Aa(t,e=document){return e.querySelector(t)}function J0(t){let l=Aa(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!X0(l,t);){if(Z0(l))return l;const n=Aa("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function x0(t){Promise.resolve(ri(t.focusElement)).then(e=>{const l=e||J0(t.id);l||ws(mn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ts),!Ea(l)&&Ea(document.documentElement)})}const e1=(t,e,l)=>(n,i)=>c0().then(()=>{if(!Sl||Ec){Q0();return}if(n&&x0(Sl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:f,uri:c}=Sl.route,p=t.createAnnouncement({path:o,fullPath:u,meta:a,params:f,uri:c},ri(l));Promise.resolve(p).then(_=>{e.set(_)})}Y0()}),t1="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 l1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},_c(t[6],t1)],i={};for(let o=0;o`Navigated to ${x.uri}`,announcements:!0,...v},$=p,M=bo(p),P=Hl(xs),F=Hl(ui),E=!P,I=i1(),D=d&&!(F&&!F.manageFocus),L=it("");_l(t,L,x=>l(0,a=x));const ie=F?F.disableInlineStyles:g,H=it([]);_l(t,H,x=>l(20,u=x));const K=it(null);_l(t,K,x=>l(18,i=x));let G=!1;const Y=E?0:F.level+1,z=E?it((()=>$a(Wl?wo(_):h.location,M))()):P;_l(t,z,x=>l(17,n=x));const Z=it(n);_l(t,Z,x=>l(19,o=x));const V=e1(A,L,z),j=x=>W=>W.filter(U=>U.id!==x);function ee(x){if(Wl){if(G)return;const W=$c(x,n.pathname);if(W)return G=!0,W}else H.update(W=>{const U=j(x.id)(W);return U.push(x),U})}function ue(x){H.update(j(x))}return!E&&p!==Pa&&ws(mn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),E&&(sc(()=>h.listen(W=>{const U=$a(W.location,M);Z.set(n),z.set(U)})),Mi(xs,z)),Mi(ui,{activeRoute:K,registerRoute:ee,unregisterRoute:ue,manageFocus:D,level:Y,id:I,history:E?h:F.history,basepath:E?M:F.basepath,disableInlineStyles:ie}),t.$$set=x=>{"basepath"in x&&l(11,p=x.basepath),"url"in x&&l(12,_=x.url),"history"in x&&l(13,h=x.history),"primary"in x&&l(14,d=x.primary),"a11y"in x&&l(15,v=x.a11y),"disableInlineStyles"in x&&l(16,g=x.disableInlineStyles),"$$scope"in x&&l(21,c=x.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ws(mn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const x=Sc(u,n.pathname);K.set(x)}if(t.$$.dirty[0]&655360&&E){const x=!!n.hash,W=!x&&D,U=!x||n.pathname!==o.pathname;V(W,U)}t.$$.dirty[0]&262144&&D&&i&&i.primary&&K0({level:Y,routerId:I,route:i})},[a,A,E,I,D,L,ie,H,K,z,Z,p,_,h,d,v,g,n,i,o,u,c,f]}class o1 extends De{constructor(e){super(),Pe(this,e,s1,n1,$e,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Ac=o1;function Ei(t,e,l=ui,n=mn){Hl(l)||Tc(t,o=>`You cannot use ${o} outside of a ${ko(n)}.`,e)}const r1=t=>{const{subscribe:e}=Hl(t);return{subscribe:e}};function Pc(){return Ei(kc),r1(xs)}function Dc(){const{history:t}=Hl(ui);return t}function Ic(){const t=Hl(vc);return t?h0(t,e=>e.base):it("/")}function Oc(){Ei(yc);const t=Ic(),{basepath:e}=Hl(ui);return n=>q0(n,ri(t),e)}function a1(){Ei(wc);const t=Oc(),{navigate:e}=Dc();return(n,i)=>{const o=cc(n)?n:t(n);return e(o,i)}}const u1=t=>({params:t&16,location:t&8}),Da=t=>({params:Wl?ri(t[10]):t[4],location:t[3],navigate:t[11]});function Ia(t){let e,l;return e=new Ac({props:{primary:t[1],$$slots:{default:[m1]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function f1(t){let e;const l=t[18].default,n=po(l,t,t[19],Da);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&vo(n,l,i,i[19],e?_o(l,i[19],o,u1):ho(i[19]),Da)},i(i){e||(O(n,i),e=!0)},o(i){B(n,i),e=!1},d(i){n&&n.d(i)}}}function c1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Wl?ri(t[10]):t[4],t[12]];var o=t[0];function u(a){let f={};for(let c=0;c{oe(p,1)}),Oe()}o?(e=ya(o,u()),re(e.$$.fragment),O(e.$$.fragment,1),se(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&O(e.$$.fragment,a),n=!0)},o(a){e&&B(e.$$.fragment,a),n=!1},d(a){a&&y(l),e&&oe(e,a)}}}function m1(t){let e,l,n,i;const o=[c1,f1],u=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(f,c){u[e].m(f,c),C(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?u[e].p(f,c):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Oe(),l=u[e],l?l.p(f,c):(l=u[e]=o[e](f),l.c()),O(l,1),l.m(n.parentNode,n))},i(f){i||(O(l),i=!0)},o(f){B(l),i=!1},d(f){u[e].d(f),f&&y(n)}}}function p1(t){let e,l,n,i,o,u=[Js(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_{f=null}),Oe())},i(_){o||(O(f),o=!0)},o(_){B(f),o=!1},d(_){_&&y(e),_&&y(l),f&&f.d(_),_&&y(n),_&&y(i)}}}const _1=mc();function d1(t,e,l){let n;const i=["path","component","meta","primary"];let o=gs(e,i),u,a,f,c,{$$slots:p={},$$scope:_}=e,{path:h=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Ei(Ts,e);const A=_1(),{registerRoute:$,unregisterRoute:M,activeRoute:P,disableInlineStyles:F}=Hl(ui);_l(t,P,G=>l(16,u=G));const E=Ic();_l(t,E,G=>l(17,f=G));const I=Pc();_l(t,I,G=>l(3,a=G));const D=it(null);let L;const ie=it(),H=it({});_l(t,H,G=>l(4,c=G)),Mi(vc,ie),Mi(b0,H),Mi(g0,D);const K=a1();return Wl||u0(()=>M(A)),t.$$set=G=>{l(24,e=sl(sl({},e),bs(G))),l(12,o=gs(e,i)),"path"in G&&l(13,h=G.path),"component"in G&&l(0,d=G.component),"meta"in G&&l(14,v=G.meta),"primary"in G&&l(1,g=G.primary),"$$scope"in G&&l(19,_=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=h==="",Y=Ni(f,h),Q={id:A,path:h,meta:v,default:G,fullPath:G?"":Y,base:G?f:B0(Y,a.pathname),primary:g,focusElement:D};ie.set(Q),l(15,L=$(Q))}if(t.$$.dirty&98304&&l(2,n=!!(L||u&&u.id===A)),t.$$.dirty&98308&&n){const{params:G}=L||u;H.set(G)}},e=bs(e),[d,g,n,a,c,A,P,F,E,I,H,K,o,h,v,L,u,f,p,_]}class v1 extends De{constructor(e){super(),Pe(this,e,d1,p1,$e,{path:13,component:0,meta:14,primary:1})}}const Tl=v1;function h1(t){let e,l,n,i;const o=t[13].default,u=po(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;cl(11,_=D));const P=f0(),F=Oc(),{navigate:E}=Dc();function I(D){P("click",D),d0(D)&&(D.preventDefault(),E(n,{state:A,replace:u||g}))}return t.$$set=D=>{l(19,e=sl(sl({},e),bs(D))),l(18,p=gs(e,c)),"to"in D&&l(5,v=D.to),"replace"in D&&l(6,g=D.replace),"state"in D&&l(7,A=D.state),"getProps"in D&&l(8,$=D.getProps),"$$scope"in D&&l(12,d=D.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=F(v,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(u=wo(n)===F0(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(fc($)){const D=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...D}}return p})())},e=bs(e),[n,f,a,M,I,v,g,A,$,o,i,_,d,h]}class g1 extends De{constructor(e){super(),Pe(this,e,b1,h1,$e,{to:5,replace:6,state:7,getProps:8})}}const ol=g1;let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function k1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Rc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function w1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function ys(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 Fe(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ve(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"µ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"}}function Oa(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Ra(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function La(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function oi(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Qe(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function be(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function dl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Fa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function qa(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energy Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}async function $l(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let pl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Yt=it(pl);async function yo(){pl=await(await $l("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Yt.set(pl)}let ds=0,Ba=-127,Ua=null,y1={};const Lc=dc(y1,t=>{let e;async function l(){$l("/data.json").then(n=>n.json()).then(n=>{t(n),Ba!=n.t&&(Ba=n.t,setTimeout(jc,2e3)),Ua==null&&n.pe&&n.p!=null&&(Ua=n.p,qc()),pl.upgrading?window.location.reload():(!pl||!pl.chip||pl.booting||ds>1&&!oi(pl.board))&&(yo(),an&&clearTimeout(an),an=setTimeout(Mo,2e3),un&&clearTimeout(un),un=setTimeout(To,3e3));let i=5e3;if(oi(pl.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,oi(pl.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={},wi;const Co=it(lo);async function Fc(){let t=!1;Co.update(e=>{for(var l=0;l<36;l++){if(e[Fe(l)]==null){t=l<12;break}e[Fe(l)]=e[Fe(l+1)]}return e}),t?qc():wi=setTimeout(Fc,(60-new Date().getMinutes())*6e4)}async function qc(){wi&&(clearTimeout(wi),wi=0),lo=await(await $l("/energyprice.json")).json(),Co.set(lo),wi=setTimeout(Fc,(60-new Date().getMinutes())*6e4)}let no={},an;async function Mo(){an&&(clearTimeout(an),an=0),no=await(await $l("/dayplot.json")).json(),Bc.set(no),an=setTimeout(Mo,(60-new Date().getMinutes())*6e4+20)}const Bc=it(no,t=>(Mo(),function(){}));let io={},un;async function To(){un&&(clearTimeout(un),un=0),io=await(await $l("/monthplot.json")).json(),Uc.set(io),un=setTimeout(To,(24-new Date().getHours())*36e5+40)}const Uc=it(io,t=>(To(),function(){}));let so={};async function jc(){so=await(await $l("/temperature.json")).json(),Hc.set(so)}const Hc=it(so,t=>(jc(),function(){}));let oo={},vs;async function Wc(){vs&&(clearTimeout(vs),vs=0),oo=await(await $l("/tariff.json")).json(),zc.set(oo),vs=setTimeout(Wc,(60-new Date().getMinutes())*6e4+30)}const zc=it(oo,t=>function(){});let ro=[];const So=it(ro);async function C1(){ro=await(await $l("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),So.set(ro)}let ao={};async function M1(){ao=await(await $l("/realtime.json")).json(),Gc.set(ao)}const Gc=it(ao,t=>(M1(),function(){}));function Cs(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 Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let a,f,c;for(let p=0;po&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let $=c.tag_name.substring(1).split(".");parseInt($[0]);let M=parseInt($[1]);parseInt($[2]),g==M&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const T1="/github.svg";function ja(t){let e,l;function n(u,a){return u[1]>1?D1:u[1]>0?P1:u[2]>1?A1:u[2]>0?E1:u[3]>1?N1:u[3]>0?$1:S1}let i=n(t),o=i(t);return{c(){e=S(`Up + `),o.c(),l=Ve()},m(u,a){C(u,e,a),o.m(u,a),C(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&y(e),o.d(u),u&&y(l)}}}function S1(t){let e,l;return{c(){e=S(t[0]),l=S(" seconds")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&1&&X(e,n[0])},d(n){n&&y(e),n&&y(l)}}}function $1(t){let e,l;return{c(){e=S(t[3]),l=S(" minute")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function N1(t){let e,l;return{c(){e=S(t[3]),l=S(" minutes")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&8&&X(e,n[3])},d(n){n&&y(e),n&&y(l)}}}function E1(t){let e,l;return{c(){e=S(t[2]),l=S(" hour")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function A1(t){let e,l;return{c(){e=S(t[2]),l=S(" hours")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&4&&X(e,n[2])},d(n){n&&y(e),n&&y(l)}}}function P1(t){let e,l;return{c(){e=S(t[1]),l=S(" day")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function D1(t){let e,l;return{c(){e=S(t[1]),l=S(" days")},m(n,i){C(n,e,i),C(n,l,i)},p(n,i){i&2&&X(e,n[1])},d(n){n&&y(e),n&&y(l)}}}function I1(t){let e,l=t[0]&&ja(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&y(e)}}}function O1(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class R1 extends De{constructor(e){super(),Pe(this,e,O1,I1,$e,{epoch:0})}}function L1(t){let e,l,n;return{c(){e=m("span"),l=S(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){C(i,e,o),s(e,l)},p(i,[o]){o&4&&X(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:_e,o:_e,d(i){i&&y(e)}}}function F1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class fn extends De{constructor(e){super(),Pe(this,e,F1,L1,$e,{color:0,title:1,text:2})}}function q1(t){let e,l=`${Fe(t[0].getDate())}.${Fe(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=S(l),r(e,"class",t[1])},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Fe(i[0].getDate())}.${Fe(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Fe(i[0].getHours())}:${Fe(i[0].getMinutes())}`)&&X(n,l),o&2&&r(e,"class",i[1])},d(i){i&&y(e)}}}function B1(t){let e=`${Fe(t[0].getDate())}. ${to[t[0].getMonth()]} ${Fe(t[0].getHours())}:${Fe(t[0].getMinutes())}`,l;return{c(){l=S(e)},m(n,i){C(n,l,i)},p(n,i){i&1&&e!==(e=`${Fe(n[0].getDate())}. ${to[n[0].getMonth()]} ${Fe(n[0].getHours())}:${Fe(n[0].getMinutes())}`)&&X(l,e)},d(n){n&&y(l)}}}function U1(t){let e;function l(o,u){return o[2]?B1:q1}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),C(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:_e,o:_e,d(o){i.d(o),o&&y(e)}}}function j1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||dl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Yc extends De{constructor(e){super(),Pe(this,e,j1,U1,$e,{timestamp:0,fullTimeColor:1,offset:3})}}function H1(t){let e,l,n;return{c(){e=Se("svg"),l=Se("path"),n=Se("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){C(i,e,o),s(e,l),s(e,n)},p:_e,i:_e,o:_e,d(i){i&&y(e)}}}class W1 extends De{constructor(e){super(),Pe(this,e,null,H1,$e,{})}}function z1(t){let e,l;return{c(){e=Se("svg"),l=Se("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){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class G1 extends De{constructor(e){super(),Pe(this,e,null,z1,$e,{})}}function V1(t){let e,l;return{c(){e=Se("svg"),l=Se("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){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class Bt extends De{constructor(e){super(),Pe(this,e,null,V1,$e,{})}}function K1(t){let e,l;return{c(){e=Se("svg"),l=Se("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){C(n,e,i),s(e,l)},p:_e,i:_e,o:_e,d(n){n&&y(e)}}}class Qc extends De{constructor(e){super(),Pe(this,e,null,K1,$e,{})}}function Y1(t){let e,l,n=t[1].version+"",i;return{c(){e=S("AMS reader "),l=m("span"),i=S(n)},m(o,u){C(o,e,u),C(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&X(i,n)},d(o){o&&y(e),o&&y(l)}}}function Ha(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=S(l),i=S("°C"),r(e,"class","flex-none my-auto")},m(o,u){C(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&X(n,l)},d(o){o&&y(e)}}}function Wa(t){let e,l="HAN: "+Oa(t[0].he),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Oa(i[0].he))&&X(n,l)},d(i){i&&y(e)}}}function za(t){let e,l="MQTT: "+Ra(t[0].me),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Ra(i[0].me))&&X(n,l)},d(i){i&&y(e)}}}function Ga(t){let e,l="PriceAPI: "+La(t[0].ee),n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+La(i[0].ee))&&X(n,l)},d(i){i&&y(e)}}}function Va(t){let e,l,n,i,o,u;return l=new ol({props:{to:"/configuration",$$slots:{default:[Q1]},$$scope:{ctx:t}}}),o=new ol({props:{to:"/status",$$slots:{default:[X1]},$$scope:{ctx:t}}}),{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("div"),re(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,f){C(a,e,f),se(l,e,null),C(a,n,f),C(a,i,f),se(o,i,null),u=!0},i(a){u||(O(l.$$.fragment,a),O(o.$$.fragment,a),u=!0)},o(a){B(l.$$.fragment,a),B(o.$$.fragment,a),u=!1},d(a){a&&y(e),oe(l),a&&y(n),a&&y(i),oe(o)}}}function Q1(t){let e,l;return e=new W1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function X1(t){let e,l;return e=new G1({}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Ka(t){let e,l,n,i,o;const u=[J1,Z1],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(c,p){C(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Ie(),B(a[_],1,1,()=>{a[_]=null}),Oe(),n=a[l],n?n.p(c,p):(n=a[l]=u[l](c),n.c()),O(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&r(e,"title",i)},i(c){o||(O(n),o=!0)},o(c){B(n),o=!1},d(c){c&&y(e),a[l].d()}}}function Z1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=S("New version: "),i=S(n)},m(o,u){C(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&X(i,n)},i:_e,o:_e,d(o){o&&y(e)}}}function J1(t){let e,l,n,i=t[2].tag_name+"",o,u,a,f,c,p;return a=new Qc({}),{c(){e=m("button"),l=m("span"),n=S("New version: "),o=S(i),u=b(),re(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,h){C(_,e,h),s(e,l),s(l,n),s(l,o),s(e,u),se(a,e,null),f=!0,c||(p=le(e,"click",t[3]),c=!0)},p(_,h){(!f||h&4)&&i!==(i=_[2].tag_name+"")&&X(o,i)},i(_){f||(O(a.$$.fragment,_),f=!0)},o(_){B(a.$$.fragment,_),f=!1},d(_){_&&y(e),oe(a),c=!1,p()}}}function x1(t){let e,l,n,i,o,u,a,f,c,p,_,h,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We;i=new ol({props:{to:"/",$$slots:{default:[Y1]},$$scope:{ctx:t}}}),f=new R1({props:{epoch:t[0].u}});let Ne=t[0].t>-50&&Ha(t);M=new fn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:jl(t[1].booting?2:t[0].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:jl(t[1].booting?9:t[0].hm)}}),I=new fn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:jl(t[1].booting?9:t[0].wm)}}),L=new fn({props:{title:"MQTT",text:"MQTT",color:jl(t[1].booting?9:t[0].mm)}});let ge=(t[0].he<0||t[0].he>0)&&Wa(t),Re=t[0].me<0&&za(t),Me=(t[0].ee>0||t[0].ee<0)&&Ga(t);ue=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let T=t[1].vndcfg&&t[1].usrcfg&&Va(t);He=new Bt({});let k=t[1].fwconsent===1&&t[2]&&Ka(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),re(i.$$.fragment),o=b(),u=m("div"),a=m("div"),re(f.$$.fragment),c=b(),Ne&&Ne.c(),p=b(),_=m("div"),h=S("Free mem: "),v=S(d),g=S("kb"),A=b(),$=m("div"),re(M.$$.fragment),P=b(),re(F.$$.fragment),E=b(),re(I.$$.fragment),D=b(),re(L.$$.fragment),ie=b(),ge&&ge.c(),H=b(),Re&&Re.c(),K=b(),Me&&Me.c(),G=b(),Y=m("div"),Q=m("div"),z=m("a"),Z=m("img"),j=b(),ee=m("div"),re(ue.$$.fragment),x=b(),T&&T.c(),W=b(),U=m("div"),ke=m("a"),re(He.$$.fragment),Be=b(),k&&k.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r($,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(Z,"class","gh-logo"),Xs(Z.src,V=T1)||r(Z,"src",V),r(Z,"alt","GitHub repo"),r(z,"class","float-right"),r(z,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(z,"target","_blank"),r(z,"rel","noreferrer"),r(z,"aria-label","GitHub"),r(Q,"class","flex-none"),r(ee,"class","flex-none my-auto px-2"),r(ke,"href",Ut("")),r(ke,"target","_blank"),r(ke,"rel","noreferrer"),r(U,"class","flex-none px-1 mt-1"),r(U,"title","Documentation"),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","bg-violet-600 p-1 rounded-md mx-2")},m(w,N){C(w,e,N),s(e,l),s(l,n),se(i,n,null),s(l,o),s(l,u),s(u,a),se(f,a,null),s(u,c),Ne&&Ne.m(u,null),s(u,p),s(u,_),s(_,h),s(_,v),s(_,g),s(l,A),s(l,$),se(M,$,null),s($,P),se(F,$,null),s($,E),se(I,$,null),s($,D),se(L,$,null),s(l,ie),ge&&ge.m(l,null),s(l,H),Re&&Re.m(l,null),s(l,K),Me&&Me.m(l,null),s(l,G),s(l,Y),s(Y,Q),s(Q,z),s(z,Z),s(Y,j),s(Y,ee),se(ue,ee,null),s(Y,x),T&&T.m(Y,null),s(Y,W),s(Y,U),s(U,ke),se(He,ke,null),s(Y,Be),k&&k.m(Y,null),We=!0},p(w,[N]){const R={};N&18&&(R.$$scope={dirty:N,ctx:w}),i.$set(R);const J={};N&1&&(J.epoch=w[0].u),f.$set(J),w[0].t>-50?Ne?Ne.p(w,N):(Ne=Ha(w),Ne.c(),Ne.m(u,p)):Ne&&(Ne.d(1),Ne=null),(!We||N&1)&&d!==(d=(w[0].m?(w[0].m/1e3).toFixed(1):"-")+"")&&X(v,d);const te={};N&3&&(te.text=w[1].booting?"Booting":w[0].v>2?w[0].v.toFixed(2)+"V":"ESP"),N&3&&(te.color=jl(w[1].booting?2:w[0].em)),M.$set(te);const fe={};N&3&&(fe.color=jl(w[1].booting?9:w[0].hm)),F.$set(fe);const de={};N&1&&(de.text=w[0].r?w[0].r.toFixed(0)+"dBm":"WiFi"),N&3&&(de.color=jl(w[1].booting?9:w[0].wm)),I.$set(de);const we={};N&3&&(we.color=jl(w[1].booting?9:w[0].mm)),L.$set(we),w[0].he<0||w[0].he>0?ge?ge.p(w,N):(ge=Wa(w),ge.c(),ge.m(l,H)):ge&&(ge.d(1),ge=null),w[0].me<0?Re?Re.p(w,N):(Re=za(w),Re.c(),Re.m(l,K)):Re&&(Re.d(1),Re=null),w[0].ee>0||w[0].ee<0?Me?Me.p(w,N):(Me=Ga(w),Me.c(),Me.m(l,G)):Me&&(Me.d(1),Me=null);const Ee={};N&1&&(Ee.timestamp=w[0].c?new Date(w[0].c*1e3):new Date(0)),N&2&&(Ee.offset=w[1].clock_offset),ue.$set(Ee),w[1].vndcfg&&w[1].usrcfg?T?N&2&&O(T,1):(T=Va(w),T.c(),O(T,1),T.m(Y,W)):T&&(Ie(),B(T,1,1,()=>{T=null}),Oe()),w[1].fwconsent===1&&w[2]?k?(k.p(w,N),N&6&&O(k,1)):(k=Ka(w),k.c(),O(k,1),k.m(Y,null)):k&&(Ie(),B(k,1,1,()=>{k=null}),Oe())},i(w){We||(O(i.$$.fragment,w),O(f.$$.fragment,w),O(M.$$.fragment,w),O(F.$$.fragment,w),O(I.$$.fragment,w),O(L.$$.fragment,w),O(ue.$$.fragment,w),O(T),O(He.$$.fragment,w),O(k),We=!0)},o(w){B(i.$$.fragment,w),B(f.$$.fragment,w),B(M.$$.fragment,w),B(F.$$.fragment,w),B(I.$$.fragment,w),B(L.$$.fragment,w),B(ue.$$.fragment,w),B(T),B(He.$$.fragment,w),B(k),We=!1},d(w){w&&y(e),oe(i),oe(f),Ne&&Ne.d(),oe(M),oe(F),oe(I),oe(L),ge&&ge.d(),Re&&Re.d(),Me&&Me.d(),oe(ue),T&&T.d(),oe(He),k&&k.d()}}}function em(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!oi(i.board)||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(a=>(a.upgrading=!0,a)),Vc(o.tag_name))}return Yt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&C1()}),So.subscribe(a=>{l(2,o=Kc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class tm extends De{constructor(e){super(),Pe(this,e,em,x1,$e,{data:0})}}function lm(t){let e,l,n,i;return{c(){e=Se("svg"),l=Se("path"),n=Se("path"),r(l,"d",Qs(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=Qs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){C(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Qs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:_e,o:_e,d(o){o&&y(e)}}}function Ya(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 Qs(t,e,l,n,i){var o=Ya(t,e,l,i),u=Ya(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return f}function nm(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 im extends De{constructor(e){super(),Pe(this,e,nm,lm,$e,{pct:0,color:1})}}function Qa(t){let e,l,n,i,o,u,a,f;return{c(){e=m("br"),l=b(),n=m("span"),i=S(t[3]),o=b(),u=m("span"),a=S(t[4]),f=S("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(c,p){C(c,e,p),C(c,l,p),C(c,n,p),s(n,i),C(c,o,p),C(c,u,p),s(u,a),s(u,f)},p(c,p){p&8&&X(i,c[3]),p&16&&X(a,c[4])},d(c){c&&y(e),c&&y(l),c&&y(n),c&&y(o),c&&y(u)}}}function sm(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A;l=new im({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&Qa(t);return{c(){e=m("div"),re(l.$$.fragment),n=b(),i=m("span"),o=m("span"),u=S(t[2]),a=b(),f=m("br"),c=b(),p=m("span"),_=S(t[0]),h=b(),d=m("span"),v=S(t[1]),g=b(),$&&$.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(d,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(M,P){C(M,e,P),se(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,h),s(i,d),s(d,v),s(i,g),$&&$.m(i,null),A=!0},p(M,[P]){const F={};P&64&&(F.pct=M[6]),P&96&&(F.color=M[5](M[6])),l.$set(F),(!A||P&4)&&X(u,M[2]),(!A||P&1)&&X(_,M[0]),(!A||P&2)&&X(v,M[1]),M[3]?$?$.p(M,P):($=Qa(M),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(M){A||(O(l.$$.fragment,M),A=!0)},o(M){B(l.$$.fragment,M),A=!1},d(M){M&&y(e),oe(l),$&&$.d()}}}function om(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,u=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,u,a,f,c,p,i]}class Xc extends De{constructor(e){super(),Pe(this,e,om,sm,$e,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Xa(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Za(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function Ja(t,e,l){const n=t.slice();return n[13]=e[l],n}function xa(t){let e,l,n,i,o,u=t[0].title&&eu(t),a=t[0].y.ticks,f=[];for(let d=0;d20||t[11]%2==0)&&iu(t);return{c(){e=Se("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){C(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=iu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&y(e),n&&n.d()}}}function iu(t){let e,l=t[9].label+"",n,i;return{c(){e=Se("text"),n=S(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){C(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[9].label+"")&&X(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&y(e)}}}function su(t){let e=!isNaN(t[5](t[11])),l,n=e&&nu(t);return{c(){n&&n.c(),l=Ve()},m(i,o){n&&n.m(i,o),C(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=nu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&y(l)}}}function ou(t){let e,l,n=t[9].value!==void 0&&ru(t),i=t[9].value2>1e-4&&fu(t);return{c(){e=Se("g"),n&&n.c(),l=Se("g"),i&&i.c()},m(o,u){C(o,e,u),n&&n.m(e,null),C(o,l,u),i&&i.m(l,null)},p(o,u){o[9].value!==void 0?n?n.p(o,u):(n=ru(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,u):(i=fu(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),n&&n.d(),o&&y(l),i&&i.d()}}}function ru(t){let e,l,n,i,o,u,a,f=t[3]>15&&au(t);return{c(){e=Se("rect"),f&&f.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",u=t[9].color)},m(c,p){C(c,e,p),f&&f.m(c,p),C(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&r(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&r(e,"y",n),p&8&&i!==(i=c[3]-4)&&r(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&r(e,"height",o),p&1&&u!==(u=c[9].color)&&r(e,"fill",u),c[3]>15?f?f.p(c,p):(f=au(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&y(e),f&&f.d(c),c&&y(a)}}}function au(t){let e,l=t[9].label+"",n,i,o,u,a,f,c=t[9].title&&uu(t);return{c(){e=Se("text"),n=S(l),c&&c.c(),f=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]p[6](0)-p[7]?p[9].color:"white")&&r(e,"fill",u),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]15&&cu(t);return{c(){e=Se("rect"),f&&f.c(),a=Ve(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",u=t[9].color2?t[9].color2:t[9].color)},m(c,p){C(c,e,p),f&&f.m(c,p),C(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&r(e,"x",l),p&64&&n!==(n=c[6](0))&&r(e,"y",n),p&8&&i!==(i=c[3]-4)&&r(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&r(e,"height",o),p&1&&u!==(u=c[9].color2?c[9].color2:c[9].color)&&r(e,"fill",u),c[3]>15?f?f.p(c,p):(f=cu(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&y(e),f&&f.d(c),c&&y(a)}}}function cu(t){let e,l=t[9].label2+"",n,i,o,u,a,f=t[9].title2&&mu(t);return{c(){e=Se("text"),n=S(l),f&&f.c(),a=Ve(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)t[8].call(e))},m(i,o){C(i,e,o),n&&n.m(e,null),l=ic(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=xa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:_e,o:_e,d(i){i&&y(e),n&&n.d(),l()}}}let cn=30;function am(t,e,l){let{config:n}=e,i,o,u,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=h=>{"config"in h&&l(0,n=h.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let h=i-(n.padding.left+n.padding.right);l(3,u=h/n.points.length),l(7,p=un.y.max?g=n.padding.bottom:vc||g<0?0:g})}},[n,i,o,u,c,a,f,p,_]}class pn extends De{constructor(e){super(),Pe(this,e,am,rm,$e,{config:0})}}function um(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function fm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function f(c){return{label:be(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:k1(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,u=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:u===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:u===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:u===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:c},points:p})}},[a,n,i,o,u]}class cm extends De{constructor(e){super(),Pe(this,e,fm,um,$e,{u1:1,u2:2,u3:3,ds:4})}}function mm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function pm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(h){return{label:be(h)+"A",title:h.toFixed(1)+" A",value:isNaN(h)?0:h,color:Rc(h?h/c*100:0)}}return t.$$set=h=>{"u1"in h&&l(1,n=h.u1),"u2"in h&&l(2,i=h.u2),"u3"in h&&l(3,o=h.u3),"i1"in h&&l(4,u=h.i1),"i2"in h&&l(5,a=h.i2),"i3"in h&&l(6,f=h.i3),"max"in h&&l(7,c=h.max)},t.$$.update=()=>{if(t.$$.dirty&254){let h=[],d=[];n>0&&(h.push({label:"L1"}),d.push(_(u))),i>0&&(h.push({label:"L2"}),d.push(_(a))),o>0&&(h.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:h},points:d})}},[p,n,i,o,u,a,f,c]}class _m extends De{constructor(e){super(),Pe(this,e,pm,mm,$e,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function dm(t){let e,l,n,i,o,u,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,h,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",A,$,M,P,F,E,I,D=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",L,ie,H,K,G,Y,Q=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",z,Z;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=b(),i=m("div"),o=m("div"),o.textContent="Instant in",u=b(),a=m("div"),c=S(f),p=S(" VAr"),_=b(),h=m("div"),h.textContent="Instant out",d=b(),v=m("div"),A=S(g),$=S(" VAr"),M=b(),P=m("div"),F=m("div"),F.textContent="Total in",E=b(),I=m("div"),L=S(D),ie=S(" kVArh"),H=b(),K=m("div"),K.textContent="Total out",G=b(),Y=m("div"),z=S(Q),Z=S(" kVArh"),r(a,"class","text-right"),r(v,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(I,"class","text-right"),r(Y,"class","text-right"),r(P,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(V,j){C(V,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,c),s(a,p),s(i,_),s(i,h),s(i,d),s(i,v),s(v,A),s(v,$),s(e,M),s(e,P),s(P,F),s(P,E),s(P,I),s(I,L),s(I,ie),s(P,H),s(P,K),s(P,G),s(P,Y),s(Y,z),s(Y,Z)},p(V,[j]){j&1&&f!==(f=(typeof V[0]<"u"?V[0].toFixed(0):"-")+"")&&X(c,f),j&2&&g!==(g=(typeof V[1]<"u"?V[1].toFixed(0):"-")+"")&&X(A,g),j&4&&D!==(D=(typeof V[2]<"u"?V[2].toFixed(1):"-")+"")&&X(L,D),j&8&&Q!==(Q=(typeof V[3]<"u"?V[3].toFixed(1):"-")+"")&&X(z,Q)},i:_e,o:_e,d(V){V&&y(e)}}}function vm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class hm extends De{constructor(e){super(),Pe(this,e,vm,dm,$e,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function _u(t){let e;function l(o,u){return o[3]?gm:bm}let n=l(t),i=n(t);return{c(){i.c(),e=Ve()},m(o,u){i.m(o,u),C(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function bm(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",f,c,p,_,h,d,v=be(t[1].d.u,1)+"",g,A,$,M,P,F,E=be(t[1].m.u)+"",I,D,L,ie,H,K,G=be(t[0].last_month.u)+"",Y,Q,z,Z,V=t[4]&&du(t);return{c(){e=m("strong"),e.textContent="Consumption",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),f=S(a),c=S(" kWh"),p=b(),_=m("div"),_.textContent="Day",h=b(),d=m("div"),g=S(v),A=S(" kWh"),$=b(),M=m("div"),M.textContent="Month",P=b(),F=m("div"),I=S(E),D=S(" kWh"),L=b(),ie=m("div"),ie.textContent="Last month",H=b(),K=m("div"),Y=S(G),Q=S(" kWh"),z=b(),V&&V.c(),Z=Ve(),r(u,"class","text-right"),r(d,"class","text-right"),r(F,"class","text-right"),r(K,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(j,ee){C(j,e,ee),C(j,l,ee),C(j,n,ee),s(n,i),s(n,o),s(n,u),s(u,f),s(u,c),s(n,p),s(n,_),s(n,h),s(n,d),s(d,g),s(d,A),s(n,$),s(n,M),s(n,P),s(n,F),s(F,I),s(F,D),s(n,L),s(n,ie),s(n,H),s(n,K),s(K,Y),s(K,Q),C(j,z,ee),V&&V.m(j,ee),C(j,Z,ee)},p(j,ee){ee&2&&a!==(a=be(j[1].h.u,2)+"")&&X(f,a),ee&2&&v!==(v=be(j[1].d.u,1)+"")&&X(g,v),ee&2&&E!==(E=be(j[1].m.u)+"")&&X(I,E),ee&1&&G!==(G=be(j[0].last_month.u)+"")&&X(Y,G),j[4]?V?V.p(j,ee):(V=du(j),V.c(),V.m(Z.parentNode,Z)):V&&(V.d(1),V=null)},d(j){j&&y(e),j&&y(l),j&&y(n),j&&y(z),V&&V.d(j),j&&y(Z)}}}function gm(t){let e,l,n,i,o,u,a=be(t[1].h.u,2)+"",f,c,p,_,h,d,v,g=be(t[1].d.u,1)+"",A,$,M,P,F,E,I,D=be(t[1].m.u)+"",L,ie,H,K,G,Y,Q,z=be(t[0].last_month.u)+"",Z,V,j,ee,ue,x,W,U,ke,He,Be,We=be(t[1].h.p,2)+"",Ne,ge,Re,Me,T,k,w,N=be(t[1].d.p,1)+"",R,J,te,fe,de,we,Ee,ae=be(t[1].m.p)+"",Ce,Je,Et,st,ht,lt,At,Ye=be(t[0].last_month.p)+"",Qt,Ht,bt,ze,xe=t[4]&&vu(t),Xe=t[4]&&hu(t),Ue=t[4]&&bu(t),qe=t[4]&&gu(t),et=t[4]&&ku(t),Ae=t[4]&&wu(t),Le=t[4]&&yu(t),pe=t[4]&&Cu(t);return{c(){e=m("strong"),e.textContent="Import",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),f=S(a),c=S(" kWh"),p=b(),xe&&xe.c(),_=b(),h=m("div"),h.textContent="Day",d=b(),v=m("div"),A=S(g),$=S(" kWh"),M=b(),Xe&&Xe.c(),P=b(),F=m("div"),F.textContent="Month",E=b(),I=m("div"),L=S(D),ie=S(" kWh"),H=b(),Ue&&Ue.c(),K=b(),G=m("div"),G.textContent="Last mo.",Y=b(),Q=m("div"),Z=S(z),V=S(" kWh"),j=b(),qe&&qe.c(),ue=b(),x=m("strong"),x.textContent="Export",W=b(),U=m("div"),ke=m("div"),ke.textContent="Hour",He=b(),Be=m("div"),Ne=S(We),ge=S(" kWh"),Re=b(),et&&et.c(),Me=b(),T=m("div"),T.textContent="Day",k=b(),w=m("div"),R=S(N),J=S(" kWh"),te=b(),Ae&&Ae.c(),fe=b(),de=m("div"),de.textContent="Month",we=b(),Ee=m("div"),Ce=S(ae),Je=S(" kWh"),Et=b(),Le&&Le.c(),st=b(),ht=m("div"),ht.textContent="Last mo.",lt=b(),At=m("div"),Qt=S(Ye),Ht=S(" kWh"),bt=b(),pe&&pe.c(),r(u,"class","text-right"),r(v,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class",ee="grid grid-cols-"+t[5]+" mb-3"),r(Be,"class","text-right"),r(w,"class","text-right"),r(Ee,"class","text-right"),r(At,"class","text-right"),r(U,"class",ze="grid grid-cols-"+t[5])},m(ce,ye){C(ce,e,ye),C(ce,l,ye),C(ce,n,ye),s(n,i),s(n,o),s(n,u),s(u,f),s(u,c),s(n,p),xe&&xe.m(n,null),s(n,_),s(n,h),s(n,d),s(n,v),s(v,A),s(v,$),s(n,M),Xe&&Xe.m(n,null),s(n,P),s(n,F),s(n,E),s(n,I),s(I,L),s(I,ie),s(n,H),Ue&&Ue.m(n,null),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(n,j),qe&&qe.m(n,null),C(ce,ue,ye),C(ce,x,ye),C(ce,W,ye),C(ce,U,ye),s(U,ke),s(U,He),s(U,Be),s(Be,Ne),s(Be,ge),s(U,Re),et&&et.m(U,null),s(U,Me),s(U,T),s(U,k),s(U,w),s(w,R),s(w,J),s(U,te),Ae&&Ae.m(U,null),s(U,fe),s(U,de),s(U,we),s(U,Ee),s(Ee,Ce),s(Ee,Je),s(U,Et),Le&&Le.m(U,null),s(U,st),s(U,ht),s(U,lt),s(U,At),s(At,Qt),s(At,Ht),s(U,bt),pe&&pe.m(U,null)},p(ce,ye){ye&2&&a!==(a=be(ce[1].h.u,2)+"")&&X(f,a),ce[4]?xe?xe.p(ce,ye):(xe=vu(ce),xe.c(),xe.m(n,_)):xe&&(xe.d(1),xe=null),ye&2&&g!==(g=be(ce[1].d.u,1)+"")&&X(A,g),ce[4]?Xe?Xe.p(ce,ye):(Xe=hu(ce),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),ye&2&&D!==(D=be(ce[1].m.u)+"")&&X(L,D),ce[4]?Ue?Ue.p(ce,ye):(Ue=bu(ce),Ue.c(),Ue.m(n,K)):Ue&&(Ue.d(1),Ue=null),ye&1&&z!==(z=be(ce[0].last_month.u)+"")&&X(Z,z),ce[4]?qe?qe.p(ce,ye):(qe=gu(ce),qe.c(),qe.m(n,null)):qe&&(qe.d(1),qe=null),ye&32&&ee!==(ee="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",ee),ye&2&&We!==(We=be(ce[1].h.p,2)+"")&&X(Ne,We),ce[4]?et?et.p(ce,ye):(et=ku(ce),et.c(),et.m(U,Me)):et&&(et.d(1),et=null),ye&2&&N!==(N=be(ce[1].d.p,1)+"")&&X(R,N),ce[4]?Ae?Ae.p(ce,ye):(Ae=wu(ce),Ae.c(),Ae.m(U,fe)):Ae&&(Ae.d(1),Ae=null),ye&2&&ae!==(ae=be(ce[1].m.p)+"")&&X(Ce,ae),ce[4]?Le?Le.p(ce,ye):(Le=yu(ce),Le.c(),Le.m(U,st)):Le&&(Le.d(1),Le=null),ye&1&&Ye!==(Ye=be(ce[0].last_month.p)+"")&&X(Qt,Ye),ce[4]?pe?pe.p(ce,ye):(pe=Cu(ce),pe.c(),pe.m(U,null)):pe&&(pe.d(1),pe=null),ye&32&&ze!==(ze="grid grid-cols-"+ce[5])&&r(U,"class",ze)},d(ce){ce&&y(e),ce&&y(l),ce&&y(n),xe&&xe.d(),Xe&&Xe.d(),Ue&&Ue.d(),qe&&qe.d(),ce&&y(ue),ce&&y(x),ce&&y(W),ce&&y(U),et&&et.d(),Ae&&Ae.d(),Le&&Le.d(),pe&&pe.d()}}}function du(t){let e,l,n,i,o,u,a=be(t[1].h.c,2)+"",f,c,p,_,h,d,v,g=be(t[1].d.c,1)+"",A,$,M,P,F,E,I,D=be(t[1].m.c)+"",L,ie,H,K,G,Y,Q,z=be(t[0].last_month.c)+"",Z,V,j;return{c(){e=m("strong"),e.textContent="Cost",l=b(),n=m("div"),i=m("div"),i.textContent="Hour",o=b(),u=m("div"),f=S(a),c=b(),p=S(t[2]),_=b(),h=m("div"),h.textContent="Day",d=b(),v=m("div"),A=S(g),$=b(),M=S(t[2]),P=b(),F=m("div"),F.textContent="Month",E=b(),I=m("div"),L=S(D),ie=b(),H=S(t[2]),K=b(),G=m("div"),G.textContent="Last month",Y=b(),Q=m("div"),Z=S(z),V=b(),j=S(t[2]),r(u,"class","text-right"),r(v,"class","text-right"),r(I,"class","text-right"),r(Q,"class","text-right"),r(n,"class","grid grid-cols-2")},m(ee,ue){C(ee,e,ue),C(ee,l,ue),C(ee,n,ue),s(n,i),s(n,o),s(n,u),s(u,f),s(u,c),s(u,p),s(n,_),s(n,h),s(n,d),s(n,v),s(v,A),s(v,$),s(v,M),s(n,P),s(n,F),s(n,E),s(n,I),s(I,L),s(I,ie),s(I,H),s(n,K),s(n,G),s(n,Y),s(n,Q),s(Q,Z),s(Q,V),s(Q,j)},p(ee,ue){ue&2&&a!==(a=be(ee[1].h.c,2)+"")&&X(f,a),ue&4&&X(p,ee[2]),ue&2&&g!==(g=be(ee[1].d.c,1)+"")&&X(A,g),ue&4&&X(M,ee[2]),ue&2&&D!==(D=be(ee[1].m.c)+"")&&X(L,D),ue&4&&X(H,ee[2]),ue&1&&z!==(z=be(ee[0].last_month.c)+"")&&X(Z,z),ue&4&&X(j,ee[2])},d(ee){ee&&y(e),ee&&y(l),ee&&y(n)}}}function vu(t){let e,l=be(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.c,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function hu(t){let e,l=be(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.c,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function bu(t){let e,l=be(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function gu(t){let e,l=be(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.c)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function ku(t){let e,l=be(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].h.i,2)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function wu(t){let e,l=be(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].d.i,1)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function yu(t){let e,l=be(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=be(u[1].m.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function Cu(t){let e,l=be(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=S(l),i=b(),o=S(t[2]),r(e,"class","text-right")},m(u,a){C(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=be(u[0].last_month.i)+"")&&X(n,l),a&4&&X(o,u[2])},d(u){u&&y(e)}}}function km(t){let e,l,n,i,o,u,a=t[1]&&_u(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=b(),i=m("br"),o=m("br"),u=b(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=_u(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:_e,o:_e,d(f){f&&y(e),a&&a.d()}}}function wm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,u=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,f=a?3:2))},[n,i,o,u,a,f]}class ym extends De{constructor(e){super(),Pe(this,e,wm,km,$e,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Cm(t){let e,l,n=qa(t[0].source)+"",i,o,u,a;return u=new pn({props:{config:t[1]}}),{c(){e=m("a"),l=S("Provided by: "),i=S(n),o=b(),re(u.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,c){C(f,e,c),s(e,l),s(e,i),C(f,o,c),se(u,f,c),a=!0},p(f,[c]){(!a||c&1)&&n!==(n=qa(f[0].source)+"")&&X(i,n);const p={};c&2&&(p.config=f[1]),u.$set(p)},i(f){a||(O(u.$$.fragment,f),a=!0)},o(f){B(u.$$.fragment,f),a=!1},d(f){f&&y(e),f&&y(o),oe(u,f)}}}function Mm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=f=>{"json"in f&&l(0,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,h=0,d=[],v=[],g=[];l(4,a=l(3,u=0));let A=new Date;for(dl(A,i.clock_offset-(24+A.getHours()-A.getUTCHours())%24),p=c;p<24&&(_=n[Fe(h++)],_!=null);p++)v.push({label:Fe(A.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(A,1);for(p=0;p<24&&(_=n[Fe(h++)],_!=null);p++)v.push({label:Fe(A.getHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,u=Math.max(u,_*100)),dl(A,1);if(a>-100&&u<100){switch(f){case"NOK":case"SEK":case"DKK":f="øre";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,u*=100),p=0;p=0?E.toFixed(I):"",title:E>=0?E.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:E<0?E.toFixed(I):"",title2:E<0?E.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let M=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(M/4*-1,a));let E=Math.ceil(Math.abs(a)/M*4),I=a/E;for(p=1;p{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,u=0));let h=dl(new Date,-24),d=new Date().getUTCHours();for(dl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),f=d;f<24;f++){let $=n["i"+Fe(f)],M=n["e"+Fe(f)];$===void 0&&($=0),M===void 0&&(M=0),p.push({label:Fe(h.getHours())}),_.push({label:$.toFixed(1),title:$.toFixed(2)+" kWh",value:$*10,label2:M.toFixed(1),title2:M.toFixed(2)+" kWh",value2:M*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M*10)),l(3,u=Math.max(u,$*10)),dl(h,1)}for(f=0;f{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,u=0));let h=new Date,d=new Date;for(dl(h,i.clock_offset-(24+h.getHours()-h.getUTCHours())%24),dl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=h.getDate();f<=d.getDate();f++){let $=n["i"+Fe(f)],M=n["e"+Fe(f)];$===void 0&&($=0),M===void 0&&(M=0),p.push({label:Fe(f)}),_.push({label:$.toFixed($<10?1:0),title:$.toFixed(2)+" kWh",value:$,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M)),l(3,u=Math.max(u,$))}for(f=1;f{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var A=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:A.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,u=Math.min(u,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let h=o;u<0&&(h+=Math.abs(u));let d=h/4;for(a=0;a<5;a++)f=u+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,u]}class Om extends De{constructor(e){super(),Pe(this,e,Im,Dm,$e,{json:1})}}function Rm(t){let e,l;return e=new pn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}let Lm=0;function Fm(t,e,l){let n={},i=0,o;return zc.subscribe(u=>{l(2,o=u)}),Wc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u0?Fe(p.d)+"."+to[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(u=0;u=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:Lm,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class qm extends De{constructor(e){super(),Pe(this,e,Fm,Rm,$e,{})}}function Mu(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function Tu(t,e,l){const n=t.slice();return n[21]=e[l],n}function Su(t){let e,l,n,i,o,u=t[7],a=[];for(let p=0;pt[14].call(e))},m(c,p){C(c,e,p),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),f&&f.m(e,null),a=ic(e,t[14].bind(e))},p(c,[p]){p&1024&&X(i,c[10]),c[7]?f?f.p(c,p):(f=Su(c),f.c(),f.m(e,null)):f&&(f.d(1),f=null)},i:_e,o:_e,d(c){c&&y(e),f&&f.d(),a()}}}let Um=12;function jm(t,e,l){let n;Gc.subscribe(E=>{l(11,n=E)});let i,o=0;function u(){n.data.unshift(0),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)}Lc.subscribe(E=>{o>0?n.data&&E.u-o>=10&&(i&&clearTimeout(i),n.data.unshift(E.i-E.e),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)):o=E.u});let a,f,c,p,_,h,d,v,g,A,$,M,P;function F(){c=this.clientWidth,p=this.clientHeight,l(0,c),l(1,p)}return t.$$.update=()=>{if(t.$$.dirty&14847&&(l(2,_=parseInt(p)-50),l(3,h=c-35),l(9,M=h/n.size),l(13,f=0),l(12,a=0),n.data)){for(let I in n.data){let D=n.data[I];l(12,a=Math.max(Math.ceil(D/1e3)*1e3,a)),l(13,f=Math.min(Math.ceil(D/1e3)*1e3,f))}l(10,P=a>2500?"kW":"W"),l(7,A=[]);for(let I=f;I2500?(I/1e3).toFixed(1):I});l(8,$=[]);for(let I=f;I0||t[0].e>0}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function qu(t){let e,l,n;return l=new qm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){C(i,e,o),se(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Bu(t){let e,l,n;return l=new Hm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Uu(t){let e,l,n;return l=new Tm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function ju(t){let e,l,n;return l=new Nm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Hu(t){let e,l,n;return l=new Pm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Wu(t){let e,l,n;return l=new Om({props:{json:t[5]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function Wm(t){let e,l=Qe(t[1].ui.i,t[0].i),n,i=Qe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Qe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=Qe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=Qe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,h=Qe(t[1].ui.c,t[0].ea),d,v=Qe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,A=Qe(t[1].ui.l),$,M=Qe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),P,F=Qe(t[1].ui.d,t[3]),E,I=Qe(t[1].ui.m,t[4]),D,L=Qe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),ie,H=l&&Du(t),K=i&&Iu(t),G=u&&Ou(t),Y=f&&Ru(t),Q=p&&Lu(t),z=h&&Fu(t),Z=v&&qu(),V=A&&Bu(),j=M&&Uu(t),ee=F&&ju(t),ue=I&&Hu(t),x=L&&Wu(t);return{c(){e=m("div"),H&&H.c(),n=b(),K&&K.c(),o=b(),G&&G.c(),a=b(),Y&&Y.c(),c=b(),Q&&Q.c(),_=b(),z&&z.c(),d=b(),Z&&Z.c(),g=b(),V&&V.c(),$=b(),j&&j.c(),P=b(),ee&&ee.c(),E=b(),ue&&ue.c(),D=b(),x&&x.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(W,U){C(W,e,U),H&&H.m(e,null),s(e,n),K&&K.m(e,null),s(e,o),G&&G.m(e,null),s(e,a),Y&&Y.m(e,null),s(e,c),Q&&Q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),Z&&Z.m(e,null),s(e,g),V&&V.m(e,null),s(e,$),j&&j.m(e,null),s(e,P),ee&&ee.m(e,null),s(e,E),ue&&ue.m(e,null),s(e,D),x&&x.m(e,null),ie=!0},p(W,[U]){U&3&&(l=Qe(W[1].ui.i,W[0].i)),l?H?(H.p(W,U),U&3&&O(H,1)):(H=Du(W),H.c(),O(H,1),H.m(e,n)):H&&(Ie(),B(H,1,1,()=>{H=null}),Oe()),U&3&&(i=Qe(W[1].ui.e,W[0].om||W[0].e>0)),i?K?(K.p(W,U),U&3&&O(K,1)):(K=Iu(W),K.c(),O(K,1),K.m(e,o)):K&&(Ie(),B(K,1,1,()=>{K=null}),Oe()),U&3&&(u=Qe(W[1].ui.v,W[0].u1>100||W[0].u2>100||W[0].u3>100)),u?G?(G.p(W,U),U&3&&O(G,1)):(G=Ou(W),G.c(),O(G,1),G.m(e,a)):G&&(Ie(),B(G,1,1,()=>{G=null}),Oe()),U&3&&(f=Qe(W[1].ui.a,W[0].i1>.01||W[0].i2>.01||W[0].i3>.01)),f?Y?(Y.p(W,U),U&3&&O(Y,1)):(Y=Ru(W),Y.c(),O(Y,1),Y.m(e,c)):Y&&(Ie(),B(Y,1,1,()=>{Y=null}),Oe()),U&3&&(p=Qe(W[1].ui.r,W[0].ri>0||W[0].re>0||W[0].ric>0||W[0].rec>0)),p?Q?(Q.p(W,U),U&3&&O(Q,1)):(Q=Lu(W),Q.c(),O(Q,1),Q.m(e,_)):Q&&(Ie(),B(Q,1,1,()=>{Q=null}),Oe()),U&3&&(h=Qe(W[1].ui.c,W[0].ea)),h?z?(z.p(W,U),U&3&&O(z,1)):(z=Fu(W),z.c(),O(z,1),z.m(e,d)):z&&(Ie(),B(z,1,1,()=>{z=null}),Oe()),U&3&&(v=Qe(W[1].ui.t,W[0].pr&&(W[0].pr.startsWith("10YNO")||W[0].pr=="10Y1001A1001A48H"))),v?Z?U&3&&O(Z,1):(Z=qu(),Z.c(),O(Z,1),Z.m(e,g)):Z&&(Ie(),B(Z,1,1,()=>{Z=null}),Oe()),U&2&&(A=Qe(W[1].ui.l)),A?V?U&2&&O(V,1):(V=Bu(),V.c(),O(V,1),V.m(e,$)):V&&(Ie(),B(V,1,1,()=>{V=null}),Oe()),U&3&&(M=Qe(W[1].ui.p,W[0].pe&&!Number.isNaN(W[0].p))),M?j?(j.p(W,U),U&3&&O(j,1)):(j=Uu(W),j.c(),O(j,1),j.m(e,P)):j&&(Ie(),B(j,1,1,()=>{j=null}),Oe()),U&10&&(F=Qe(W[1].ui.d,W[3])),F?ee?(ee.p(W,U),U&10&&O(ee,1)):(ee=ju(W),ee.c(),O(ee,1),ee.m(e,E)):ee&&(Ie(),B(ee,1,1,()=>{ee=null}),Oe()),U&18&&(I=Qe(W[1].ui.m,W[4])),I?ue?(ue.p(W,U),U&18&&O(ue,1)):(ue=Hu(W),ue.c(),O(ue,1),ue.m(e,D)):ue&&(Ie(),B(ue,1,1,()=>{ue=null}),Oe()),U&35&&(L=Qe(W[1].ui.s,W[0].t&&W[0].t!=-127&&W[5].c>1)),L?x?(x.p(W,U),U&35&&O(x,1)):(x=Wu(W),x.c(),O(x,1),x.m(e,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Oe())},i(W){ie||(O(H),O(K),O(G),O(Y),O(Q),O(z),O(Z),O(V),O(j),O(ee),O(ue),O(x),ie=!0)},o(W){B(H),B(K),B(G),B(Y),B(Q),B(z),B(Z),B(V),B(j),B(ee),B(ue),B(x),ie=!1},d(W){W&&y(e),H&&H.d(),K&&K.d(),G&&G.d(),Y&&Y.d(),Q&&Q.d(),z&&z.d(),Z&&Z.d(),V&&V.d(),j&&j.d(),ee&&ee.d(),ue&&ue.d(),x&&x.d()}}}function zm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},f={};return Co.subscribe(c=>{l(2,o=c)}),Bc.subscribe(c=>{l(3,u=c)}),Uc.subscribe(c=>{l(4,a=c)}),Hc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,u,a,f]}class Gm extends De{constructor(e){super(),Pe(this,e,zm,Wm,$e,{data:0,sysinfo:1})}}let uo={};const yi=it(uo);async function Vm(){uo=await(await fetch("/configuration.json")).json(),yi.set(uo)}function zu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Km(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Ym(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Gu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Vu(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=b(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){C(i,e,o),C(i,l,o),C(i,n,o)},d(i){i&&y(e),i&&y(l),i&&y(n)}}}function Ku(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Yu(t){let e,l,n;return{c(){e=m("option"),l=S("GPIO"),n=S(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){C(i,e,o),s(e,l),s(e,n)},d(i){i&&y(e)}}}function Qu(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Yu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Yu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&y(e)}}}function Qm(t){let e,l,n,i,o;function u(v,g){return v[0]=="esp32c3"?Ym:Km}let a=u(t),f=a(t),c=t[0]=="esp8266"&&Gu(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Vu(),_=t[0]=="esp32s2"&&Ku(),h={length:t[1]+1},d=[];for(let v=0;v{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class fo extends De{constructor(e){super(),Pe(this,e,Xm,Qm,$e,{chip:0})}}function Xu(t){let e,l,n=t[1]&&Zu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){C(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Zu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&y(e),n&&n.d()}}}function Zu(t){let e,l;return{c(){e=m("div"),l=S(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){C(n,e,i),s(e,l)},p(n,i){i&2&&X(l,n[1])},d(n){n&&y(e)}}}function Zm(t){let e,l=t[0]&&Xu(t);return{c(){l&&l.c(),e=Ve()},m(n,i){l&&l.m(n,i),C(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Xu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:_e,o:_e,d(n){l&&l.d(n),n&&y(e)}}}function Jm(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 jt extends De{constructor(e){super(),Pe(this,e,Jm,Zm,$e,{active:0,message:1})}}function Ju(t,e,l){const n=t.slice();return n[1]=e[l],n}function xu(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=S("Europe/"),i=S(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){C(o,e,u),s(e,l),s(e,i)},p:_e,d(o){o&&y(e)}}}function xm(t){let e,l,n,i=t[0],o=[];for(let u=0;u>1&1,N=0;N0;k--)N[k]=N[k]?N[k-1]^E.EXPONENT[L._modN(E.LOG[N[k]]+T)]:N[k-1];N[0]=E.EXPONENT[L._modN(E.LOG[N[0]]+T)]}for(T=0;T<=w;T++)N[T]=E.LOG[N[T]]},_checkBadness:function(){var T,k,w,N,R,J=0,te=this._badness,fe=this.buffer,de=this.width;for(R=0;Rde*de;)ae-=de*de,Ee++;for(J+=Ee*L.N4,N=0;N=te-2&&(T=te-2,R>9&&T--);var fe=T;if(R>9){for(J[fe+2]=0,J[fe+3]=0;fe--;)k=J[fe],J[fe+3]|=255&k<<4,J[fe+2]=k>>4;J[2]|=255&T<<4,J[1]=T>>4,J[0]=64|T>>12}else{for(J[fe+1]=0,J[fe+2]=0;fe--;)k=J[fe],J[fe+2]|=255&k<<4,J[fe+1]=k>>4;J[1]|=255&T<<4,J[0]=64|T>>4}for(fe=T+3-(R<10);fe=5&&(w+=L.N1+N[k]-5);for(k=3;kT||N[k-3]*3>=N[k]*4||N[k+3]*3>=N[k]*4)&&(w+=L.N3);return w},_finish:function(){this._stringBuffer=this.buffer.slice();var T,k,w=0,N=3e4;for(k=0;k<8&&(this._applyMask(k),T=this._checkBadness(),T>=1)N&1&&(R[J-1-k+J*8]=1,k<6?R[8+J*k]=1:R[8+J*(k+1)]=1);for(k=0;k<7;k++,N>>=1)N&1&&(R[8+J*(J-7+k)]=1,k?R[6-k+J*8]=1:R[7+J*8]=1)},_interleaveBlocks:function(){var T,k,w=this._dataBlock,N=this._ecc,R=this._eccBlock,J=0,te=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,we=this._stringBuffer;for(T=0;T1)for(T=$.BLOCK[N],w=R-7;;){for(k=R-7;k>T-3&&(this._addAlignment(k,w),!(k6)for(T=D.BLOCK[J-7],k=17,w=0;w<6;w++)for(N=0;N<3;N++,k--)1&(k>11?J>>k-12:T>>k)?(R[5-w+te*(2-N+te-11)]=1,R[2-N+te-11+te*(5-w)]=1):(this._setMask(5-w,2-N+te-11),this._setMask(2-N+te-11,5-w))},_isMasked:function(T,k){var w=L._getMaskBit(T,k);return this._mask[w]===1},_pack:function(){var T,k,w,N=1,R=1,J=this.width,te=J-1,fe=J-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(k=0;kk&&(w=T,T=k,k=w),w=k,w+=k*k,w>>=1,w+=T,w},_modN:function(T){for(;T>=255;)T-=255,T=(T>>8)+(T&255);return T},N1:3,N2:3,N3:40,N4:10}),ie=L,H=d.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var T=this.element;T.width=T.height=this.qrious.size}}),K=H,G=_.extend(function(T,k,w,N){this.name=T,this.modifiable=!!k,this.defaultValue=w,this._valueTransformer=N},{transform:function(T){var k=this._valueTransformer;return typeof k=="function"?k(T,this):T}}),Y=G,Q=_.extend(null,{abs:function(T){return T!=null?Math.abs(T):null},hasOwn:function(T,k){return Object.prototype.hasOwnProperty.call(T,k)},noop:function(){},toUpperCase:function(T){return T!=null?T.toUpperCase():null}}),z=Q,Z=_.extend(function(T){this.options={},T.forEach(function(k){this.options[k.name]=k},this)},{exists:function(T){return this.options[T]!=null},get:function(T,k){return Z._get(this.options[T],k)},getAll:function(T){var k,w=this.options,N={};for(k in w)z.hasOwn(w,k)&&(N[k]=Z._get(w[k],T));return N},init:function(T,k,w){typeof w!="function"&&(w=z.noop);var N,R;for(N in this.options)z.hasOwn(this.options,N)&&(R=this.options[N],Z._set(R,R.defaultValue,k),Z._createAccessor(R,k,w));this._setAll(T,k,!0)},set:function(T,k,w){return this._set(T,k,w)},setAll:function(T,k){return this._setAll(T,k)},_set:function(T,k,w,N){var R=this.options[T];if(!R)throw new Error("Invalid option: "+T);if(!R.modifiable&&!N)throw new Error("Option cannot be modified: "+T);return Z._set(R,k,w)},_setAll:function(T,k,w){if(!T)return!1;var N,R=!1;for(N in T)z.hasOwn(T,N)&&this._set(N,T[N],k,w)&&(R=!0);return R}},{_createAccessor:function(T,k,w){var N={get:function(){return Z._get(T,k)}};T.modifiable&&(N.set=function(R){Z._set(T,R,k)&&w(R,T)}),Object.defineProperty(k,T.name,N)},_get:function(T,k){return k["_"+T.name]},_set:function(T,k,w){var N="_"+T.name,R=w[N],J=T.transform(k??T.defaultValue);return w[N]=J,J!==R}}),V=Z,j=_.extend(function(){this._services={}},{getService:function(T){var k=this._services[T];if(!k)throw new Error("Service is not being managed with name: "+T);return k},setService:function(T,k){if(this._services[T])throw new Error("Service is already managed with name: "+T);k&&(this._services[T]=k)}}),ee=j,ue=new V([new Y("background",!0,"white"),new Y("backgroundAlpha",!0,1,z.abs),new Y("element"),new Y("foreground",!0,"black"),new Y("foregroundAlpha",!0,1,z.abs),new Y("level",!0,"L",z.toUpperCase),new Y("mime",!0,"image/png"),new Y("padding",!0,null,z.abs),new Y("size",!0,100,z.abs),new Y("value",!0,"")]),x=new ee,W=_.extend(function(T){ue.init(T,this,this.update.bind(this));var k=ue.get("element",this),w=x.getService("element"),N=k&&w.isCanvas(k)?k:w.createCanvas(),R=k&&w.isImage(k)?k:w.createImage();this._canvasRenderer=new g(this,N,!0),this._imageRenderer=new K(this,R,R===k),this.update()},{get:function(){return ue.getAll(this)},set:function(T){ue.setAll(T,this)&&this.update()},toDataURL:function(T){return this.canvas.toDataURL(T||this.mime)},update:function(){var T=new ie({level:this.level,value:this.value});this._canvasRenderer.render(T),this._imageRenderer.render(T)}},{use:function(T){x.setService(T.getName(),T)}});Object.defineProperties(W.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var U=W,ke=U,He=_.extend({getName:function(){}}),Be=He,We=Be.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(T){},isImage:function(T){}}),Ne=We,ge=Ne.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(T){return T instanceof HTMLCanvasElement},isImage:function(T){return T instanceof HTMLImageElement}}),Re=ge;ke.use(new Re);var Me=ke;return Me})})(Jc);var op=Jc.exports;const rp=sp(op);function ap(t){let e,l;return{c(){e=m("img"),Xs(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){C(n,e,i)},p(n,[i]){i&4&&!Xs(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:_e,o:_e,d(n){n&&y(e)}}}function up(t,e,l){const n=new rp;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:f=""}=e,{padding:c=0}=e,{className:p="qrcode"}=e,_="";function h(){n.set({background:o,foreground:u,level:i,padding:c,size:a,value:f}),l(2,_=n.toDataURL("image/jpeg"))}return sc(()=>{h()}),t.$$set=d=>{"errorCorrection"in d&&l(3,i=d.errorCorrection),"background"in d&&l(4,o=d.background),"color"in d&&l(5,u=d.color),"size"in d&&l(6,a=d.size),"value"in d&&l(0,f=d.value),"padding"in d&&l(7,c=d.padding),"className"in d&&l(1,p=d.className)},t.$$.update=()=>{t.$$.dirty&1&&f&&h()},[f,p,_,i,o,u,a,c]}class fp extends De{constructor(e){super(),Pe(this,e,up,ap,$e,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function ef(t,e,l){const n=t.slice();return n[103]=e[l],n[104]=e,n[105]=l,n}function tf(t,e,l){const n=t.slice();return n[106]=e[l],n[107]=e,n[108]=l,n}function cp(t,e,l){const n=t.slice();return n[109]=e[l],n}function mp(t,e,l){const n=t.slice();return n[112]=e[l],n}function pp(t){let e,l;return{c(){e=m("option"),l=S(t[112]),e.__value=t[112],e.value=e.__value},m(n,i){C(n,e,i),s(e,l)},p:_e,d(n){n&&y(e)}}}function lf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){C(o,e,u),C(o,l,u),ne(l,t[3].p.t),n||(i=le(l,"input",t[22]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&ne(l,o[3].p.t)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function nf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d;return{c(){e=m("div"),l=S("Username"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),f=S("Password"),c=m("br"),p=b(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1")},m(v,g){C(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].g.u),C(v,u,g),C(v,a,g),s(a,f),s(a,c),s(a,p),s(a,_),ne(_,t[3].g.p),h||(d=[le(o,"input",t[24]),le(_,"input",t[25])],h=!0)},p(v,g){g[0]&8&&o.value!==v[3].g.u&&ne(o,v[3].g.u),g[0]&8&&_.value!==v[3].g.p&&ne(_,v[3].g.p)},d(v){v&&y(e),v&&y(u),v&&y(a),h=!1,Ge(d)}}}function _p(t){let e,l=t[109]*100+"",n;return{c(){e=m("option"),n=S(l),e.__value=t[109]*100,e.value=e.__value},m(i,o){C(i,e,o),s(e,n)},p:_e,d(i){i&&y(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){C(o,e,u),C(o,l,u),ne(l,t[3].m.e.k),n||(i=le(l,"input",t[35]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&ne(l,o[3].m.e.k)},d(o){o&&y(e),o&&y(l),n=!1,i()}}}function of(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Authentication key"),n=m("br"),i=b(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].m.e.a),u||(a=le(o,"input",t[36]),u=!0)},p(f,c){c[0]&8&&o.value!==f[3].m.e.a&&ne(o,f[3].m.e.a)},d(f){f&&y(e),u=!1,a()}}}function rf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H;return{c(){e=m("div"),l=m("div"),n=S("Watt"),i=m("br"),o=b(),u=m("input"),a=b(),f=m("div"),c=S("Volt"),p=m("br"),_=b(),h=m("input"),d=b(),v=m("div"),g=S("Amp"),A=m("br"),$=b(),M=m("input"),P=b(),F=m("div"),E=S("kWh"),I=m("br"),D=b(),L=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(h,"name","mmv"),r(h,"type","number"),r(h,"min","0.00"),r(h,"max","1000"),r(h,"step","0.001"),r(h,"class","in-m tr w-full"),r(f,"class","w-1/4"),r(M,"name","mma"),r(M,"type","number"),r(M,"min","0.00"),r(M,"max","1000"),r(M,"step","0.001"),r(M,"class","in-m tr w-full"),r(v,"class","w-1/4"),r(L,"name","mmc"),r(L,"type","number"),r(L,"min","0.00"),r(L,"max","1000"),r(L,"step","0.001"),r(L,"class","in-l tr w-full"),r(F,"class","w-1/4"),r(e,"class","flex my-1")},m(K,G){C(K,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),ne(u,t[3].m.m.w),s(e,a),s(e,f),s(f,c),s(f,p),s(f,_),s(f,h),ne(h,t[3].m.m.v),s(e,d),s(e,v),s(v,g),s(v,A),s(v,$),s(v,M),ne(M,t[3].m.m.a),s(e,P),s(e,F),s(F,E),s(F,I),s(F,D),s(F,L),ne(L,t[3].m.m.c),ie||(H=[le(u,"input",t[38]),le(h,"input",t[39]),le(M,"input",t[40]),le(L,"input",t[41])],ie=!0)},p(K,G){G[0]&8&&he(u.value)!==K[3].m.m.w&&ne(u,K[3].m.m.w),G[0]&8&&he(h.value)!==K[3].m.m.v&&ne(h,K[3].m.m.v),G[0]&8&&he(M.value)!==K[3].m.m.a&&ne(M,K[3].m.m.a),G[0]&8&&he(L.value)!==K[3].m.m.c&&ne(L,K[3].m.m.c)},d(K){K&&y(e),ie=!1,Ge(H)}}}function af(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function uf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W;return{c(){e=m("div"),l=S("SSID"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),f=S("Password"),c=m("br"),p=b(),_=m("input"),h=b(),d=m("div"),v=m("div"),g=S("Power saving"),A=m("br"),$=b(),M=m("select"),P=m("option"),P.textContent="Default",F=m("option"),F.textContent="Off",E=m("option"),E.textContent="Minimum",I=m("option"),I.textContent="Maximum",D=b(),L=m("div"),ie=S("Power"),H=m("br"),K=b(),G=m("div"),Y=m("input"),Q=b(),z=m("span"),z.textContent="dBm",Z=b(),V=m("div"),j=m("label"),ee=m("input"),ue=S(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","wp"),r(_,"type","password"),r(_,"class","in-s"),r(a,"class","my-1"),P.__value=255,P.value=P.__value,F.__value=0,F.value=F.__value,E.__value=1,E.value=E.__value,I.__value=2,I.value=I.__value,r(M,"name","wz"),r(M,"class","in-s"),t[3].w.z===void 0&&Ke(()=>t[45].call(M)),r(v,"class","w-1/2"),r(Y,"name","ww"),r(Y,"type","number"),r(Y,"min","0"),r(Y,"max","20.5"),r(Y,"step","0.5"),r(Y,"class","in-f tr w-full"),r(z,"class","in-post"),r(G,"class","flex"),r(L,"class","ml-2 w-1/2"),r(d,"class","my-1 flex"),r(ee,"type","checkbox"),r(ee,"name","wb"),ee.__value="true",ee.value=ee.__value,r(ee,"class","rounded mb-1"),r(V,"class","my-3")},m(U,ke){C(U,e,ke),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].w.s),C(U,u,ke),C(U,a,ke),s(a,f),s(a,c),s(a,p),s(a,_),ne(_,t[3].w.p),C(U,h,ke),C(U,d,ke),s(d,v),s(v,g),s(v,A),s(v,$),s(v,M),s(M,P),s(M,F),s(M,E),s(M,I),Te(M,t[3].w.z,!0),s(d,D),s(d,L),s(L,ie),s(L,H),s(L,K),s(L,G),s(G,Y),ne(Y,t[3].w.w),s(G,Q),s(G,z),C(U,Z,ke),C(U,V,ke),s(V,j),s(j,ee),ee.checked=t[3].w.b,s(j,ue),x||(W=[le(o,"input",t[43]),le(_,"input",t[44]),le(M,"change",t[45]),le(Y,"input",t[46]),le(ee,"change",t[47])],x=!0)},p(U,ke){ke[0]&8&&o.value!==U[3].w.s&&ne(o,U[3].w.s),ke[0]&8&&_.value!==U[3].w.p&&ne(_,U[3].w.p),ke[0]&8&&Te(M,U[3].w.z),ke[0]&8&&he(Y.value)!==U[3].w.w&&ne(Y,U[3].w.w),ke[0]&8&&(ee.checked=U[3].w.b)},d(U){U&&y(e),U&&y(u),U&&y(a),U&&y(h),U&&y(d),U&&y(Z),U&&y(V),x=!1,Ge(W)}}}function ff(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A;return{c(){e=m("div"),l=S("Gateway"),n=m("br"),i=b(),o=m("input"),u=b(),a=m("div"),f=S("DNS"),c=m("br"),p=b(),_=m("div"),h=m("input"),d=b(),v=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(h,"name","nd1"),r(h,"type","text"),r(h,"class","in-f w-full"),r(v,"name","nd2"),r(v,"type","text"),r(v,"class","in-l w-full"),r(_,"class","flex"),r(a,"class","my-1")},m($,M){C($,e,M),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].n.g),C($,u,M),C($,a,M),s(a,f),s(a,c),s(a,p),s(a,_),s(_,h),ne(h,t[3].n.d1),s(_,d),s(_,v),ne(v,t[3].n.d2),g||(A=[le(o,"input",t[51]),le(h,"input",t[52]),le(v,"input",t[53])],g=!0)},p($,M){M[0]&8&&o.value!==$[3].n.g&&ne(o,$[3].n.g),M[0]&8&&h.value!==$[3].n.d1&&ne(h,$[3].n.d1),M[0]&8&&v.value!==$[3].n.d2&&ne(v,$[3].n.d2)},d($){$&&y(e),$&&y(u),$&&y(a),g=!1,Ge(A)}}}function cf(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=S(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){C(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[le(l,"change",t[57]),le(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&y(e),i=!1,Ge(o)}}}function mf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d;const v=[vp,dp],g=[];function A(D,L){return D[3].q.s.c?0:1}n=A(t),i=g[n]=v[n](t);const $=[kp,gp],M=[];function P(D,L){return D[3].q.s.r?0:1}a=P(t),f=M[a]=$[a](t);const F=[Mp,Cp],E=[];function I(D,L){return D[3].q.s.k?0:1}return _=I(t),h=E[_]=F[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=b(),u=m("span"),f.c(),c=b(),p=m("span"),h.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(D,L){C(D,e,L),s(e,l),g[n].m(l,null),s(e,o),s(e,u),M[a].m(u,null),s(e,c),s(e,p),E[_].m(p,null),d=!0},p(D,L){let ie=n;n=A(D),n===ie?g[n].p(D,L):(Ie(),B(g[ie],1,1,()=>{g[ie]=null}),Oe(),i=g[n],i?i.p(D,L):(i=g[n]=v[n](D),i.c()),O(i,1),i.m(l,null));let H=a;a=P(D),a===H?M[a].p(D,L):(Ie(),B(M[H],1,1,()=>{M[H]=null}),Oe(),f=M[a],f?f.p(D,L):(f=M[a]=$[a](D),f.c()),O(f,1),f.m(u,null));let K=_;_=I(D),_===K?E[_].p(D,L):(Ie(),B(E[K],1,1,()=>{E[K]=null}),Oe(),h=E[_],h?h.p(D,L):(h=E[_]=F[_](D),h.c()),O(h,1),h.m(p,null))},i(D){d||(O(i),O(f),O(h),d=!0)},o(D){B(i),B(f),B(h),d=!1},d(D){D&&y(e),g[n].d(),M[a].d(),E[_].d()}}}function dp(t){let e,l;return e=new ol({props:{to:"/mqtt-ca",$$slots:{default:[hp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function vp(t){let e,l,n,i,o,u,a,f;return l=new ol({props:{to:"/mqtt-ca",$$slots:{default:[bp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(c,p){C(c,e,p),se(l,e,null),C(c,n,p),C(c,i,p),se(o,i,null),u=!0,a||(f=[le(i,"click",t[11]),le(i,"keypress",t[11])],a=!0)},p(c,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:c}),l.$set(_)},i(c){u||(O(l.$$.fragment,c),O(o.$$.fragment,c),u=!0)},o(c){B(l.$$.fragment,c),B(o.$$.fragment,c),u=!1},d(c){c&&y(e),oe(l),c&&y(n),c&&y(i),oe(o),a=!1,Ge(f)}}}function hp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function bp(t){let e;return{c(){e=S("CA OK")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function gp(t){let e,l;return e=new ol({props:{to:"/mqtt-cert",$$slots:{default:[wp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function kp(t){let e,l,n,i,o,u,a,f;return l=new ol({props:{to:"/mqtt-cert",$$slots:{default:[yp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(c,p){C(c,e,p),se(l,e,null),C(c,n,p),C(c,i,p),se(o,i,null),u=!0,a||(f=[le(i,"click",t[12]),le(i,"keypress",t[12])],a=!0)},p(c,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:c}),l.$set(_)},i(c){u||(O(l.$$.fragment,c),O(o.$$.fragment,c),u=!0)},o(c){B(l.$$.fragment,c),B(o.$$.fragment,c),u=!1},d(c){c&&y(e),oe(l),c&&y(n),c&&y(i),oe(o),a=!1,Ge(f)}}}function wp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function yp(t){let e;return{c(){e=S("Cert OK")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Cp(t){let e,l;return e=new ol({props:{to:"/mqtt-key",$$slots:{default:[Tp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i[3]&4194304&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Mp(t){let e,l,n,i,o,u,a,f;return l=new ol({props:{to:"/mqtt-key",$$slots:{default:[Sp]},$$scope:{ctx:t}}}),o=new $o({}),{c(){e=m("span"),re(l.$$.fragment),n=b(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(c,p){C(c,e,p),se(l,e,null),C(c,n,p),C(c,i,p),se(o,i,null),u=!0,a||(f=[le(i,"click",t[13]),le(i,"keypress",t[13])],a=!0)},p(c,p){const _={};p[3]&4194304&&(_.$$scope={dirty:p,ctx:c}),l.$set(_)},i(c){u||(O(l.$$.fragment,c),O(o.$$.fragment,c),u=!0)},o(c){B(l.$$.fragment,c),B(o.$$.fragment,c),u=!1},d(c){c&&y(e),oe(l),c&&y(n),c&&y(i),oe(o),a=!1,Ge(f)}}}function Tp(t){let e,l;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Sp(t){let e;return{c(){e=S("Key OK")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function pf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),f=b(),c=m("div"),p=m("div"),_=S("Electricity IDX"),h=m("br"),d=b(),v=m("input"),g=b(),A=m("div"),$=S("Current IDX"),M=m("br"),P=b(),F=m("input"),E=b(),I=m("div"),D=S(`Voltage IDX: L1, L2 & L3 + `),L=m("div"),ie=m("input"),H=b(),K=m("input"),G=b(),Y=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(v,"name","oe"),r(v,"type","text"),r(v,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(F,"name","oc"),r(F,"type","text"),r(F,"class","in-l tr w-full"),r(A,"class","w-1/2"),r(c,"class","my-1 flex"),r(ie,"name","ou1"),r(ie,"type","text"),r(ie,"class","in-f tr w-1/3"),r(K,"name","ou2"),r(K,"type","text"),r(K,"class","in-m tr w-1/3"),r(Y,"name","ou3"),r(Y,"type","text"),r(Y,"class","in-l tr w-1/3"),r(L,"class","flex"),r(I,"class","my-1"),r(e,"class","cnt")},m(V,j){C(V,e,j),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,h),s(p,d),s(p,v),ne(v,t[3].o.e),s(c,g),s(c,A),s(A,$),s(A,M),s(A,P),s(A,F),ne(F,t[3].o.c),s(e,E),s(e,I),s(I,D),s(I,L),s(L,ie),ne(ie,t[3].o.u1),s(L,H),s(L,K),ne(K,t[3].o.u2),s(L,G),s(L,Y),ne(Y,t[3].o.u3),Q=!0,z||(Z=[le(v,"input",t[65]),le(F,"input",t[66]),le(ie,"input",t[67]),le(K,"input",t[68]),le(Y,"input",t[69])],z=!0)},p(V,j){j[0]&8&&v.value!==V[3].o.e&&ne(v,V[3].o.e),j[0]&8&&F.value!==V[3].o.c&&ne(F,V[3].o.c),j[0]&8&&ie.value!==V[3].o.u1&&ne(ie,V[3].o.u1),j[0]&8&&K.value!==V[3].o.u2&&ne(K,V[3].o.u2),j[0]&8&&Y.value!==V[3].o.u3&&ne(Y,V[3].o.u3)},i(V){Q||(O(o.$$.fragment,V),Q=!0)},o(V){B(o.$$.fragment,V),Q=!1},d(V){V&&y(e),oe(o),z=!1,Ge(Z)}}}function _f(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y;return o=new Bt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),f=b(),c=m("div"),p=S("Discovery topic prefix"),_=m("br"),h=b(),d=m("input"),v=b(),g=m("div"),A=S("Hostname for URL"),$=m("br"),M=b(),P=m("input"),E=b(),I=m("div"),D=S("Name tag"),L=m("br"),ie=b(),H=m("input"),r(l,"class","text-sm"),r(i,"href",Ut("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(d,"name","ht"),r(d,"type","text"),r(d,"class","in-s"),r(d,"placeholder","homeassistant"),r(c,"class","my-1"),r(P,"name","hh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"placeholder",F=t[3].g.h+".local"),r(g,"class","my-1"),r(H,"name","hn"),r(H,"type","text"),r(H,"class","in-s"),r(I,"class","my-1"),r(e,"class","cnt")},m(Q,z){C(Q,e,z),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,h),s(c,d),ne(d,t[3].h.t),s(e,v),s(e,g),s(g,A),s(g,$),s(g,M),s(g,P),ne(P,t[3].h.h),s(e,E),s(e,I),s(I,D),s(I,L),s(I,ie),s(I,H),ne(H,t[3].h.n),K=!0,G||(Y=[le(d,"input",t[70]),le(P,"input",t[71]),le(H,"input",t[72])],G=!0)},p(Q,z){z[0]&8&&d.value!==Q[3].h.t&&ne(d,Q[3].h.t),(!K||z[0]&8&&F!==(F=Q[3].g.h+".local"))&&r(P,"placeholder",F),z[0]&8&&P.value!==Q[3].h.h&&ne(P,Q[3].h.h),z[0]&8&&H.value!==Q[3].h.n&&ne(H,Q[3].h.n)},i(Q){K||(O(o.$$.fragment,Q),K=!0)},o(Q){B(o.$$.fragment,Q),K=!1},d(Q){Q&&y(e),oe(o),G=!1,Ge(Y)}}}function df(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue;o=new Bt({});let x=t[3].c.es&&vf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=b(),i=m("a"),re(o.$$.fragment),u=b(),a=m("input"),f=b(),c=m("div"),p=m("label"),_=m("input"),h=S(" Enable cloud upload"),d=b(),v=m("div"),g=S("Client ID"),A=m("br"),$=b(),M=m("input"),E=b(),I=m("div"),D=S("Client secret"),L=m("br"),ie=b(),H=m("input"),G=b(),Y=m("div"),Q=m("label"),z=m("input"),Z=S(" Energy Speedometer"),V=b(),x&&x.c(),r(l,"class","text-sm"),r(i,"href",Ut("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","c"),a.value="true",r(_,"type","checkbox"),r(_,"name","ce"),_.__value="true",_.value=_.__value,r(_,"class","rounded mb-1"),r(c,"class","my-1"),r(M,"name","ci"),r(M,"type","text"),r(M,"class","in-s"),r(M,"pattern",P=t[3].c.e?"[A-Z0-9]{16}":".*"),M.required=F=t[3].c.e,r(v,"class","my-1"),r(H,"name","cs"),r(H,"type","text"),r(H,"class","in-s"),r(H,"pattern",K=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(I,"class","my-1"),r(z,"type","checkbox"),r(z,"class","rounded mb-1"),r(z,"name","ces"),z.__value="true",z.value=z.__value,r(Y,"class","my-1"),r(e,"class","cnt")},m(W,U){C(W,e,U),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,d),s(e,v),s(v,g),s(v,A),s(v,$),s(v,M),ne(M,t[3].c.i),s(e,E),s(e,I),s(I,D),s(I,L),s(I,ie),s(I,H),ne(H,t[3].c.s),s(e,G),s(e,Y),s(Y,Q),s(Q,z),z.checked=t[3].c.es,s(Q,Z),s(Y,V),x&&x.m(Y,null),j=!0,ee||(ue=[le(_,"change",t[73]),le(M,"input",t[74]),le(H,"input",t[75]),le(z,"change",t[76])],ee=!0)},p(W,U){U[0]&8&&(_.checked=W[3].c.e),(!j||U[0]&8&&P!==(P=W[3].c.e?"[A-Z0-9]{16}":".*"))&&r(M,"pattern",P),(!j||U[0]&8&&F!==(F=W[3].c.e))&&(M.required=F),U[0]&8&&M.value!==W[3].c.i&&ne(M,W[3].c.i),(!j||U[0]&8&&K!==(K=W[3].c.e&&W[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(H,"pattern",K),U[0]&8&&H.value!==W[3].c.s&&ne(H,W[3].c.s),U[0]&8&&(z.checked=W[3].c.es),W[3].c.es?x?(x.p(W,U),U[0]&8&&O(x,1)):(x=vf(W),x.c(),O(x,1),x.m(Y,null)):x&&(Ie(),B(x,1,1,()=>{x=null}),Oe())},i(W){j||(O(o.$$.fragment,W),O(x),j=!0)},o(W){B(o.$$.fragment,W),B(x),j=!1},d(W){W&&y(e),oe(o),x&&x.d(),ee=!1,Ge(ue)}}}function vf(t){let e,l,n=t[0].mac+"",i,o,u,a,f=(t[0].meter.id?t[0].meter.id:"missing, required")+"",c,p,_,h,d=t[0].mac&&t[0].meter.id&&hf(t);return{c(){e=m("div"),l=S("MAC: "),i=S(n),o=b(),u=m("div"),a=S("Meter ID: "),c=S(f),p=b(),d&&d.c(),_=Ve(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(v,g){C(v,e,g),s(e,l),s(e,i),C(v,o,g),C(v,u,g),s(u,a),s(u,c),C(v,p,g),d&&d.m(v,g),C(v,_,g),h=!0},p(v,g){(!h||g[0]&1)&&n!==(n=v[0].mac+"")&&X(i,n),(!h||g[0]&1)&&f!==(f=(v[0].meter.id?v[0].meter.id:"missing, required")+"")&&X(c,f),v[0].mac&&v[0].meter.id?d?(d.p(v,g),g[0]&1&&O(d,1)):(d=hf(v),d.c(),O(d,1),d.m(_.parentNode,_)):d&&(Ie(),B(d,1,1,()=>{d=null}),Oe())},i(v){h||(O(d),h=!0)},o(v){B(d),h=!1},d(v){v&&y(e),v&&y(o),v&&y(u),v&&y(p),d&&d.d(v),v&&y(_)}}}function hf(t){let e,l,n;return l=new fp({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){C(i,e,o),se(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){B(l.$$.fragment,i),n=!1},d(i){i&&y(e),oe(l)}}}function bf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P;o=new Bt({});let F={length:9},E=[];for(let I=0;I20&&yf(t),_=t[3].i.d.d>0&&Tf(t),h=t[0].chip=="esp8266"&&Sf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=b(),i=m("a"),re(o.$$.fragment),u=b(),p&&p.c(),a=b(),_&&_.c(),f=b(),h&&h.c(),r(l,"class","text-sm"),r(i,"href",Ut("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(d,v){C(d,e,v),s(e,l),s(e,n),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,a),_&&_.m(e,null),s(e,f),h&&h.m(e,null),c=!0},p(d,v){d[0].board>20?p?(p.p(d,v),v[0]&1&&O(p,1)):(p=yf(d),p.c(),O(p,1),p.m(e,a)):p&&(Ie(),B(p,1,1,()=>{p=null}),Oe()),d[3].i.d.d>0?_?_.p(d,v):(_=Tf(d),_.c(),_.m(e,f)):_&&(_.d(1),_=null),d[0].chip=="esp8266"?h?h.p(d,v):(h=Sf(d),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(d){c||(O(o.$$.fragment,d),O(p),c=!0)},o(d){B(o.$$.fragment,d),B(p),c=!1},d(d){d&&y(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function yf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,T,k,w,N,R,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et;c=new fo({props:{chip:t[0].chip}}),A=new fo({props:{chip:t[0].chip}});let Ae=t[0].chip!="esp8266"&&Cf(t),Le=t[3].i.v.p>0&&Mf(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=S("HAN RX"),u=m("br"),a=b(),f=m("select"),re(c.$$.fragment),p=b(),_=m("div"),h=S("HAN TX"),d=m("br"),v=b(),g=m("select"),re(A.$$.fragment),$=b(),M=m("div"),P=m("label"),F=m("input"),E=S(" pullup"),I=b(),D=m("div"),L=m("div"),ie=S("AP button"),H=m("br"),K=b(),G=m("input"),Y=b(),Q=m("div"),z=S("LED"),Z=m("br"),V=b(),j=m("div"),ee=m("input"),ue=b(),x=m("div"),W=m("label"),U=m("input"),ke=S(" inverted"),He=b(),Be=m("div"),We=S("RGB"),Ne=m("label"),ge=m("input"),Re=S(" inverted"),Me=m("br"),T=b(),k=m("div"),w=m("input"),N=b(),R=m("input"),J=b(),te=m("input"),fe=b(),de=m("div"),we=m("div"),Ee=S(`LED dis. GPIO + `),ae=m("input"),Ce=b(),Je=m("div"),Et=S("Temperature"),st=m("br"),ht=b(),lt=m("input"),At=b(),Ye=m("div"),Qt=S("Analog temp"),Ht=m("br"),bt=b(),ze=m("input"),xe=b(),Ae&&Ae.c(),Xe=b(),Le&&Le.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(f,"name","ihp"),r(f,"class","in-f w-full"),t[3].i.h.p===void 0&&Ke(()=>t[80].call(f)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ke(()=>t[81].call(g)),r(_,"class","w-1/3"),r(F,"name","ihu"),F.__value="true",F.value=F.__value,r(F,"type","checkbox"),r(F,"class","rounded mb-1"),r(P,"class","ml-2"),r(M,"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[6]),r(G,"class","in-f tr w-full"),r(L,"class","w-1/3"),r(ee,"name","ilp"),r(ee,"type","number"),r(ee,"min","0"),r(ee,"max",t[6]),r(ee,"class","in-l tr w-full"),r(j,"class","flex"),r(Q,"class","w-1/3"),r(U,"name","ili"),U.__value="true",U.value=U.__value,r(U,"type","checkbox"),r(U,"class","rounded mb-1"),r(W,"class","ml-4"),r(x,"class","w-1/3"),r(ge,"name","iri"),ge.__value="true",ge.value=ge.__value,r(ge,"type","checkbox"),r(ge,"class","rounded mb-1"),r(Ne,"class","ml-4"),r(w,"name","irr"),r(w,"type","number"),r(w,"min","0"),r(w,"max",t[6]),r(w,"class","in-f tr w-1/3"),r(R,"name","irg"),r(R,"type","number"),r(R,"min","0"),r(R,"max",t[6]),r(R,"class","in-m tr w-1/3"),r(te,"name","irb"),r(te,"type","number"),r(te,"min","0"),r(te,"max",t[6]),r(te,"class","in-l tr w-1/3"),r(k,"class","flex"),r(Be,"class","w-full"),r(ae,"name","idd"),r(ae,"type","number"),r(ae,"min","0"),r(ae,"max",t[6]),r(ae,"class","in-s tr"),r(we,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(lt,"name","itd"),r(lt,"type","number"),r(lt,"min","0"),r(lt,"max",t[6]),r(lt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(ze,"name","ita"),r(ze,"type","number"),r(ze,"min","0"),r(ze,"max",t[6]),r(ze,"class","in-l tr w-full"),r(Ye,"class","my-1 pr-1 w-1/3"),r(D,"class","flex flex-wrap")},m(pe,ce){C(pe,e,ce),C(pe,l,ce),C(pe,n,ce),s(n,i),s(i,o),s(i,u),s(i,a),s(i,f),se(c,f,null),Te(f,t[3].i.h.p,!0),s(n,p),s(n,_),s(_,h),s(_,d),s(_,v),s(_,g),se(A,g,null),Te(g,t[3].i.h.t,!0),s(n,$),s(n,M),s(M,P),s(P,F),F.checked=t[3].i.h.u,s(P,E),C(pe,I,ce),C(pe,D,ce),s(D,L),s(L,ie),s(L,H),s(L,K),s(L,G),ne(G,t[3].i.a),s(D,Y),s(D,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,j),s(j,ee),ne(ee,t[3].i.l.p),s(D,ue),s(D,x),s(x,W),s(W,U),U.checked=t[3].i.l.i,s(W,ke),s(D,He),s(D,Be),s(Be,We),s(Be,Ne),s(Ne,ge),ge.checked=t[3].i.r.i,s(Ne,Re),s(Be,Me),s(Be,T),s(Be,k),s(k,w),ne(w,t[3].i.r.r),s(k,N),s(k,R),ne(R,t[3].i.r.g),s(k,J),s(k,te),ne(te,t[3].i.r.b),s(D,fe),s(D,de),s(de,we),s(we,Ee),s(we,ae),ne(ae,t[3].i.d.d),s(D,Ce),s(D,Je),s(Je,Et),s(Je,st),s(Je,ht),s(Je,lt),ne(lt,t[3].i.t.d),s(D,At),s(D,Ye),s(Ye,Qt),s(Ye,Ht),s(Ye,bt),s(Ye,ze),ne(ze,t[3].i.t.a),s(D,xe),Ae&&Ae.m(D,null),s(D,Xe),Le&&Le.m(D,null),Ue=!0,qe||(et=[le(f,"change",t[80]),le(g,"change",t[81]),le(F,"change",t[82]),le(G,"input",t[83]),le(ee,"input",t[84]),le(U,"change",t[85]),le(ge,"change",t[86]),le(w,"input",t[87]),le(R,"input",t[88]),le(te,"input",t[89]),le(ae,"input",t[90]),le(lt,"input",t[91]),le(ze,"input",t[92])],qe=!0)},p(pe,ce){const ye={};ce[0]&1&&(ye.chip=pe[0].chip),c.$set(ye),ce[0]&8&&Te(f,pe[3].i.h.p);const zl={};ce[0]&1&&(zl.chip=pe[0].chip),A.$set(zl),ce[0]&8&&Te(g,pe[3].i.h.t),ce[0]&8&&(F.checked=pe[3].i.h.u),(!Ue||ce[0]&64)&&r(G,"max",pe[6]),ce[0]&8&&he(G.value)!==pe[3].i.a&&ne(G,pe[3].i.a),(!Ue||ce[0]&64)&&r(ee,"max",pe[6]),ce[0]&8&&he(ee.value)!==pe[3].i.l.p&&ne(ee,pe[3].i.l.p),ce[0]&8&&(U.checked=pe[3].i.l.i),ce[0]&8&&(ge.checked=pe[3].i.r.i),(!Ue||ce[0]&64)&&r(w,"max",pe[6]),ce[0]&8&&he(w.value)!==pe[3].i.r.r&&ne(w,pe[3].i.r.r),(!Ue||ce[0]&64)&&r(R,"max",pe[6]),ce[0]&8&&he(R.value)!==pe[3].i.r.g&&ne(R,pe[3].i.r.g),(!Ue||ce[0]&64)&&r(te,"max",pe[6]),ce[0]&8&&he(te.value)!==pe[3].i.r.b&&ne(te,pe[3].i.r.b),(!Ue||ce[0]&64)&&r(ae,"max",pe[6]),ce[0]&8&&he(ae.value)!==pe[3].i.d.d&&ne(ae,pe[3].i.d.d),(!Ue||ce[0]&64)&&r(lt,"max",pe[6]),ce[0]&8&&he(lt.value)!==pe[3].i.t.d&&ne(lt,pe[3].i.t.d),(!Ue||ce[0]&64)&&r(ze,"max",pe[6]),ce[0]&8&&he(ze.value)!==pe[3].i.t.a&&ne(ze,pe[3].i.t.a),pe[0].chip!="esp8266"?Ae?Ae.p(pe,ce):(Ae=Cf(pe),Ae.c(),Ae.m(D,Xe)):Ae&&(Ae.d(1),Ae=null),pe[3].i.v.p>0?Le?Le.p(pe,ce):(Le=Mf(pe),Le.c(),Le.m(D,null)):Le&&(Le.d(1),Le=null)},i(pe){Ue||(O(c.$$.fragment,pe),O(A.$$.fragment,pe),Ue=!0)},o(pe){B(c.$$.fragment,pe),B(A.$$.fragment,pe),Ue=!1},d(pe){pe&&y(e),pe&&y(l),pe&&y(n),oe(c),oe(A),pe&&y(I),pe&&y(D),Ae&&Ae.d(),Le&&Le.d(),qe=!1,Ge(et)}}}function Cf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Vcc"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.p),u||(a=le(o,"input",t[93]),u=!0)},p(f,c){c[0]&64&&r(o,"max",f[6]),c[0]&8&&he(o.value)!==f[3].i.v.p&&ne(o,f[3].i.v.p)},d(f){f&&y(e),u=!1,a()}}}function Mf(t){let e,l,n,i,o,u,a,f,c,p;return{c(){e=m("div"),l=S("Voltage divider"),n=m("br"),i=b(),o=m("div"),u=m("input"),a=b(),f=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(f,"name","ivdg"),r(f,"type","number"),r(f,"min","0"),r(f,"max","65535"),r(f,"class","in-l tr w-full"),r(f,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,h){C(_,e,h),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),ne(u,t[3].i.v.d.v),s(o,a),s(o,f),ne(f,t[3].i.v.d.g),c||(p=[le(u,"input",t[94]),le(f,"input",t[95])],c=!0)},p(_,h){h[0]&8&&he(u.value)!==_[3].i.v.d.v&&ne(u,_[3].i.v.d.v),h[0]&8&&he(f.value)!==_[3].i.v.d.g&&ne(f,_[3].i.v.d.g)},d(_){_&&y(e),c=!1,Ge(p)}}}function Tf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S(`LED behaviour + `),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&Ke(()=>t[96].call(n)),r(e,"class","my-1 w-full")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(n,i),s(n,o),Te(n,t[3].i.d.b,!0),u||(a=le(n,"change",t[96]),u=!0)},p(f,c){c[0]&8&&Te(n,f[3].i.d.b)},d(f){f&&y(e),u=!1,a()}}}function Sf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M=(t[0].board==2||t[0].board==100)&&$f(t);return{c(){e=m("input"),l=b(),n=m("div"),i=m("div"),o=S("Vcc offset"),u=m("br"),a=b(),f=m("input"),c=b(),p=m("div"),_=S("Multiplier"),h=m("br"),d=b(),v=m("input"),g=b(),M&&M.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(f,"name","ivo"),r(f,"type","number"),r(f,"min","0.0"),r(f,"max","3.5"),r(f,"step","0.01"),r(f,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(v,"name","ivm"),r(v,"type","number"),r(v,"min","0.1"),r(v,"max","10"),r(v,"step","0.01"),r(v,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(P,F){C(P,e,F),C(P,l,F),C(P,n,F),s(n,i),s(i,o),s(i,u),s(i,a),s(i,f),ne(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,h),s(p,d),s(p,v),ne(v,t[3].i.v.m),s(n,g),M&&M.m(n,null),A||($=[le(f,"input",t[97]),le(v,"input",t[98])],A=!0)},p(P,F){F[0]&8&&he(f.value)!==P[3].i.v.o&&ne(f,P[3].i.v.o),F[0]&8&&he(v.value)!==P[3].i.v.m&&ne(v,P[3].i.v.m),P[0].board==2||P[0].board==100?M?M.p(P,F):(M=$f(P),M.c(),M.m(n,null)):M&&(M.d(1),M=null)},d(P){P&&y(e),P&&y(l),P&&y(n),M&&M.d(),A=!1,Ge($)}}}function $f(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=S("Boot limit"),n=m("br"),i=b(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),ne(o,t[3].i.v.b),u||(a=le(o,"input",t[99]),u=!0)},p(f,c){c[0]&8&&he(o.value)!==f[3].i.v.b&&ne(o,f[3].i.v.b)},d(f){f&&y(e),u=!1,a()}}}function Nf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$=t[3].d.t&&Ef();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=b(),n=m("div"),i=m("label"),o=m("input"),u=S(" Enable telnet"),a=b(),$&&$.c(),f=b(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",h=m("option"),h.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&Ke(()=>t[102].call(p)),r(c,"class","my-1")},m(M,P){C(M,e,P),C(M,l,P),C(M,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),C(M,a,P),$&&$.m(M,P),C(M,f,P),C(M,c,P),s(c,p),s(p,_),s(p,h),s(p,d),s(p,v),Te(p,t[3].d.l,!0),g||(A=[le(o,"change",t[101]),le(p,"change",t[102])],g=!0)},p(M,P){P[0]&8&&(o.checked=M[3].d.t),M[3].d.t?$||($=Ef(),$.c(),$.m(f.parentNode,f)):$&&($.d(1),$=null),P[0]&8&&Te(p,M[3].d.l)},d(M){M&&y(e),M&&y(l),M&&y(n),M&&y(a),$&&$.d(M),M&&y(f),M&&y(c),g=!1,Ge(A)}}}function Ef(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function $p(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,T,k,w,N,R,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et,Ae,Le,pe,ce,ye,zl,hl,_n,Pt,Ai,Pi,Di,bl,Ii,Oi,Ri,Dt,Nl,El,Al,Li,Fi,je,dn,qi,Pl,Dl,Bi,Gl,Ze,mt,Vl,Il,Ui,Ol,ji,Wt,vn,hn,Eo,rl,Hi,Ao,Ss,Po,fi,Xt,Do,Io,Rl,al,Ll,Oo,Wi,Ro,dt,Fl,Lo,zi,bn,gn,kn,wn,Gi,Fo,It,Vi,qo,Kl,Bo,Uo,jo,ul,yn,Cn,Ho,Mn,Yl,Wo,zo,Go,Tn,Zt,Vo,Ki,Ko,Ql,Yo,Qo,Xo,Sn,Jt,Zo,Yi,Jo,$s,xo,Xl,Qi,xt,er,tr,lr,Ns,Xi,el,nr,ir,sr,Ot,Zi,or,$n,Nn,rr,ci,ar,Zl,ur,fr,cr,zt,En,An,mr,pr,pt,Ji,_r,Pn,Dn,dr,Jl,vr,hr,br,ql,fl,In,On,gr,Rt,xi,es,kr,Lt,Rn,ts,ls,wr,Es,ns,is,tl,yr,Cr,mi,Mr,Bl,Tr,pi,ll,Sr,$r,Nr,ss,gl,Er,tt,os,Ar,Ln,Fn,Pr,_i,Dr,cl,Ir,As,Or,Rr,qn,kl,Lr,nl,Fr,Ps,xl,qr,Br,Ur,wl,jr,en,Hr,Wr,zr,yl,Gr,Bn,Un,Vr,Kr,Yr,Cl,Qr,jn,Xr,Zr,Jr,gt,Hn,Wn,zn,Gn,Vn,Kn,xr,tn,ea,ta,la,Ml,na,Ds,Is,Os,Rs=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Ls,ml,rs,ia,Yn,Qn,sa,di,oa,vi,ra,Fs,Ft,as,aa,Xn,Zn,ua,hi,fa,us,fs,il,ca,ma,pa,Ul,qs,Jn,_a,cs,xn,da,ms,Bs,ln,Us,nn,js,sn,Hs,on,Gt,Ws,va;a=new Bt({}),L=new tp({});let xc=["NOK","SEK","DKK","EUR"],bi=[];for(let q=0;q<4;q+=1)bi[q]=pp(mp(t,xc,q));let kt=t[3].p.e&&t[0].chip!="esp8266"&&lf(t),wt=t[3].g.s>0&&nf(t);Dl=new Bt({});let e0=[24,48,96,192,384,576,1152],gi=[];for(let q=0;q<7;q+=1)gi[q]=_p(cp(t,e0,q));let yt=t[3].m.e.e&&sf(t),Ct=t[3].m.e.e&&of(t),Mt=t[3].m.m.e&&rf(t);Nn=new Bt({});let qt=t[0].if&&t[0].if.eth&&af(),Tt=(t[3].n.c==1||t[3].n.c==2)&&uf(t);Dn=new Bt({}),Rn=new Zc({});let St=t[3].n.m=="static"&&ff(t);Fn=new Bt({});let $t=t[0].chip!="esp8266"&&cf(t),ot=t[3].q.s.e&&mf(t),rt=t[3].q.m==3&&pf(t),at=t[3].q.m==4&&_f(t),ut=t[3].c.es!=null&&df(t),ft=Rs&&bf(t);Qn=new Bt({});let ei=t[7],vt=[];for(let q=0;q20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&wf(t);Zn=new Bt({});let Nt=t[3].d.s&&Nf(t);return ln=new jt({props:{active:t[1],message:"Loading configuration"}}),nn=new jt({props:{active:t[2],message:"Saving configuration"}}),sn=new jt({props:{active:t[4],message:"Performing factory reset"}}),on=new jt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=b(),u=m("a"),re(a.$$.fragment),f=b(),c=m("input"),p=b(),_=m("div"),h=m("div"),d=m("div"),v=S("Hostname"),g=m("br"),A=b(),$=m("input"),M=b(),P=m("div"),F=S("Time zone"),E=m("br"),I=b(),D=m("select"),re(L.$$.fragment),ie=b(),H=m("input"),K=b(),G=m("div"),Y=m("div"),Q=m("div"),z=S("Price region"),Z=m("br"),V=b(),j=m("select"),ee=m("optgroup"),ue=m("option"),ue.textContent="NO1",x=m("option"),x.textContent="NO2",W=m("option"),W.textContent="NO3",U=m("option"),U.textContent="NO4",ke=m("option"),ke.textContent="NO5",He=m("optgroup"),Be=m("option"),Be.textContent="SE1",We=m("option"),We.textContent="SE2",Ne=m("option"),Ne.textContent="SE3",ge=m("option"),ge.textContent="SE4",Re=m("optgroup"),Me=m("option"),Me.textContent="DK1",T=m("option"),T.textContent="DK2",k=m("option"),k.textContent="Austria",w=m("option"),w.textContent="Belgium",N=m("option"),N.textContent="Czech Republic",R=m("option"),R.textContent="Estonia",J=m("option"),J.textContent="Finland",te=m("option"),te.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",we=m("option"),we.textContent="Latvia",Ee=m("option"),Ee.textContent="Lithuania",ae=m("option"),ae.textContent="Netherland",Ce=m("option"),Ce.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",Et=b(),st=m("div"),ht=S("Currency"),lt=m("br"),At=b(),Ye=m("select");for(let q=0;q<4;q+=1)bi[q].c();Qt=b(),Ht=m("div"),bt=m("div"),ze=m("div"),xe=S("Fixed price"),Xe=m("br"),Ue=b(),qe=m("input"),et=b(),Ae=m("div"),Le=S("Multiplier"),pe=m("br"),ce=b(),ye=m("input"),zl=b(),hl=m("div"),_n=m("label"),Pt=m("input"),Ai=S(" Enable price fetch from remote server"),Pi=b(),kt&&kt.c(),Di=b(),bl=m("div"),Ii=S("Security"),Oi=m("br"),Ri=b(),Dt=m("select"),Nl=m("option"),Nl.textContent="None",El=m("option"),El.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Li=b(),wt&&wt.c(),Fi=b(),je=m("div"),dn=m("strong"),dn.textContent="Meter",qi=b(),Pl=m("a"),re(Dl.$$.fragment),Bi=b(),Gl=m("input"),Ze=b(),mt=m("input"),Vl=b(),Il=m("div"),Ui=S("Communication"),Ol=m("br"),ji=b(),Wt=m("select"),vn=m("option"),vn.textContent="Passive (Push)",hn=m("option"),hn.textContent="Kamstrup (Pull)",Eo=b(),rl=m("div"),Hi=m("span"),Hi.textContent="Buffer size",Ao=b(),Ss=m("span"),Ss.textContent="Serial conf.",Po=b(),fi=m("label"),Xt=m("input"),Do=S(" inverted"),Io=b(),Rl=m("div"),al=m("select"),Ll=m("option"),Oo=S("Autodetect");for(let q=0;q<7;q+=1)gi[q].c();Ro=b(),dt=m("select"),Fl=m("option"),Lo=S("-"),bn=m("option"),bn.textContent="7N1",gn=m("option"),gn.textContent="8N1",kn=m("option"),kn.textContent="7E1",wn=m("option"),wn.textContent="8E1",Fo=b(),It=m("input"),qo=b(),Kl=m("div"),Bo=S("Voltage"),Uo=m("br"),jo=b(),ul=m("select"),yn=m("option"),yn.textContent="400V (TN)",Cn=m("option"),Cn.textContent="230V (IT/TT)",Ho=b(),Mn=m("div"),Yl=m("div"),Wo=S("Main fuse"),zo=m("br"),Go=b(),Tn=m("label"),Zt=m("input"),Vo=b(),Ki=m("span"),Ki.textContent="A",Ko=b(),Ql=m("div"),Yo=S("Production"),Qo=m("br"),Xo=b(),Sn=m("label"),Jt=m("input"),Zo=b(),Yi=m("span"),Yi.textContent="kWp",Jo=b(),$s=m("div"),xo=b(),Xl=m("div"),Qi=m("label"),xt=m("input"),er=S(" Meter is encrypted"),tr=b(),yt&&yt.c(),lr=b(),Ct&&Ct.c(),Ns=b(),Xi=m("label"),el=m("input"),nr=S(" Multipliers"),ir=b(),Mt&&Mt.c(),sr=b(),Ot=m("div"),Zi=m("strong"),Zi.textContent="Connection",or=b(),$n=m("a"),re(Nn.$$.fragment),rr=b(),ci=m("input"),ar=b(),Zl=m("div"),ur=S("Connection"),fr=m("br"),cr=b(),zt=m("select"),En=m("option"),En.textContent="WiFi",An=m("option"),An.textContent="Access point",qt&&qt.c(),mr=b(),Tt&&Tt.c(),pr=b(),pt=m("div"),Ji=m("strong"),Ji.textContent="Network",_r=b(),Pn=m("a"),re(Dn.$$.fragment),dr=b(),Jl=m("div"),vr=S("IP"),hr=m("br"),br=b(),ql=m("div"),fl=m("select"),In=m("option"),In.textContent="DHCP",On=m("option"),On.textContent="Static",gr=b(),Rt=m("input"),kr=b(),Lt=m("select"),re(Rn.$$.fragment),wr=b(),St&&St.c(),Es=b(),ns=m("div"),is=m("label"),tl=m("input"),yr=S(" enable mDNS"),Cr=b(),mi=m("input"),Mr=b(),Bl=m("div"),Tr=S("NTP "),pi=m("label"),ll=m("input"),Sr=S(" obtain from DHCP"),$r=m("br"),Nr=b(),ss=m("div"),gl=m("input"),Er=b(),tt=m("div"),os=m("strong"),os.textContent="MQTT",Ar=b(),Ln=m("a"),re(Fn.$$.fragment),Pr=b(),_i=m("input"),Dr=b(),cl=m("div"),Ir=S(`Server + `),$t&&$t.c(),As=b(),Or=m("br"),Rr=b(),qn=m("div"),kl=m("input"),Lr=b(),nl=m("input"),Fr=b(),ot&&ot.c(),Ps=b(),xl=m("div"),qr=S("Username"),Br=m("br"),Ur=b(),wl=m("input"),jr=b(),en=m("div"),Hr=S("Password"),Wr=m("br"),zr=b(),yl=m("input"),Gr=b(),Bn=m("div"),Un=m("div"),Vr=S("Client ID"),Kr=m("br"),Yr=b(),Cl=m("input"),Qr=b(),jn=m("div"),Xr=S("Payload"),Zr=m("br"),Jr=b(),gt=m("select"),Hn=m("option"),Hn.textContent="JSON",Wn=m("option"),Wn.textContent="Raw (minimal)",zn=m("option"),zn.textContent="Raw (full)",Gn=m("option"),Gn.textContent="Domoticz",Vn=m("option"),Vn.textContent="HomeAssistant",Kn=m("option"),Kn.textContent="HEX dump",xr=b(),tn=m("div"),ea=S("Publish topic"),ta=m("br"),la=b(),Ml=m("input"),na=b(),rt&&rt.c(),Ds=b(),at&&at.c(),Is=b(),ut&&ut.c(),Os=b(),ft&&ft.c(),Ls=b(),ml=m("div"),rs=m("strong"),rs.textContent="User interface",ia=b(),Yn=m("a"),re(Qn.$$.fragment),sa=b(),di=m("input"),oa=b(),vi=m("div");for(let q=0;qSave',Bs=b(),re(ln.$$.fragment),Us=b(),re(nn.$$.fragment),js=b(),re(sn.$$.fragment),Hs=b(),re(on.$$.fragment),r(i,"class","text-sm"),r(u,"href",Ut("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(c,"type","hidden"),r(c,"name","g"),c.value="true",r($,"name","gh"),r($,"type","text"),r($,"class","in-f w-full"),r($,"pattern","[A-Za-z0-9-]+"),r(D,"name","gt"),r(D,"class","in-l w-full"),t[3].g.t===void 0&&Ke(()=>t[16].call(D)),r(h,"class","flex"),r(_,"class","my-1"),r(H,"type","hidden"),r(H,"name","p"),H.value="true",ue.__value="10YNO-1--------2",ue.value=ue.__value,x.__value="10YNO-2--------T",x.value=x.__value,W.__value="10YNO-3--------J",W.value=W.__value,U.__value="10YNO-4--------9",U.value=U.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,r(ee,"label","Norway"),Be.__value="10Y1001A1001A44P",Be.value=Be.__value,We.__value="10Y1001A1001A45N",We.value=We.__value,Ne.__value="10Y1001A1001A46L",Ne.value=Ne.__value,ge.__value="10Y1001A1001A47J",ge.value=ge.__value,r(He,"label","Sweden"),Me.__value="10YDK-1--------W",Me.value=Me.__value,T.__value="10YDK-2--------M",T.value=T.__value,r(Re,"label","Denmark"),k.__value="10YAT-APG------L",k.value=k.__value,w.__value="10YBE----------2",w.value=w.__value,N.__value="10YCZ-CEPS-----N",N.value=N.__value,R.__value="10Y1001A1001A39I",R.value=R.__value,J.__value="10YFI-1--------U",J.value=J.__value,te.__value="10YFR-RTE------C",te.value=te.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,we.__value="10YLV-1001A00074",we.value=we.__value,Ee.__value="10YLT-1001A0008Q",Ee.value=Ee.__value,ae.__value="10YNL----------L",ae.value=ae.__value,Ce.__value="10YPL-AREA-----S",Ce.value=Ce.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(j,"name","pr"),r(j,"class","in-f w-full"),t[3].p.r===void 0&&Ke(()=>t[17].call(j)),r(Q,"class","w-full"),r(Ye,"name","pc"),r(Ye,"class","in-l"),t[3].p.c===void 0&&Ke(()=>t[18].call(Ye)),r(Y,"class","flex"),r(G,"class","my-1"),r(qe,"name","pf"),r(qe,"type","number"),r(qe,"min","0.001"),r(qe,"max","65"),r(qe,"step","0.001"),r(qe,"class","in-f tr w-full"),r(ze,"class","w-1/2"),r(ye,"name","pm"),r(ye,"type","number"),r(ye,"min","0.001"),r(ye,"max","1000"),r(ye,"step","0.001"),r(ye,"class","in-l tr w-full"),r(Ae,"class","w-1/2"),r(bt,"class","flex"),r(Ht,"class","my-1"),r(Pt,"type","checkbox"),r(Pt,"name","pe"),Pt.__value="true",Pt.value=Pt.__value,r(Pt,"class","rounded mb-1"),r(hl,"class","my-1"),Nl.__value=0,Nl.value=Nl.__value,El.__value=1,El.value=El.__value,Al.__value=2,Al.value=Al.__value,r(Dt,"name","gs"),r(Dt,"class","in-s"),t[3].g.s===void 0&&Ke(()=>t[23].call(Dt)),r(bl,"class","my-1"),r(n,"class","cnt"),r(dn,"class","text-sm"),r(Pl,"href",Ut("Meter-configuration")),r(Pl,"target","_blank"),r(Pl,"class","float-right"),r(Gl,"type","hidden"),r(Gl,"name","m"),Gl.value="true",r(mt,"type","hidden"),r(mt,"name","mo"),mt.value="1",vn.__value=0,vn.value=vn.__value,hn.__value=9,hn.value=hn.__value,r(Wt,"name","ma"),r(Wt,"class","in-s"),t[3].m.a===void 0&&Ke(()=>t[26].call(Wt)),r(Il,"class","my-1"),r(Hi,"class","float-right"),r(Xt,"name","mi"),Xt.__value="true",Xt.value=Xt.__value,r(Xt,"type","checkbox"),r(Xt,"class","rounded mb-1"),r(fi,"class","mt-2 ml-3 whitespace-nowrap"),Ll.__value=0,Ll.value=Ll.__value,Ll.disabled=Wi=t[3].m.b!=0,r(al,"name","mb"),r(al,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ke(()=>t[28].call(al)),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=zi=t[3].m.b!=0,bn.__value=2,bn.value=bn.__value,gn.__value=3,gn.value=gn.__value,kn.__value=10,kn.value=kn.__value,wn.__value=11,wn.value=wn.__value,r(dt,"name","mp"),r(dt,"class","in-m"),dt.disabled=Gi=t[3].m.b==0,t[3].m.p===void 0&&Ke(()=>t[29].call(dt)),r(It,"name","ms"),r(It,"type","number"),r(It,"min",64),r(It,"max",Vi=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(It,"step",64),r(It,"class","in-l tr w-1/2"),r(Rl,"class","flex w-full"),r(rl,"class","my-1"),yn.__value=2,yn.value=yn.__value,Cn.__value=1,Cn.value=Cn.__value,r(ul,"name","md"),r(ul,"class","in-s"),t[3].m.d===void 0&&Ke(()=>t[31].call(ul)),r(Kl,"class","my-1"),r(Zt,"name","mf"),r(Zt,"type","number"),r(Zt,"min","5"),r(Zt,"max","65535"),r(Zt,"class","in-f tr w-full"),r(Ki,"class","in-post"),r(Tn,"class","flex"),r(Yl,"class","mx-1"),r(Jt,"name","mr"),r(Jt,"type","number"),r(Jt,"min","0"),r(Jt,"max","65535"),r(Jt,"class","in-f tr w-full"),r(Yi,"class","in-post"),r(Sn,"class","flex"),r(Ql,"class","mx-1"),r(Mn,"class","my-1 flex"),r($s,"class","my-1"),r(xt,"type","checkbox"),r(xt,"name","me"),xt.__value="true",xt.value=xt.__value,r(xt,"class","rounded mb-1"),r(Xl,"class","my-1"),r(el,"type","checkbox"),r(el,"name","mm"),el.__value="true",el.value=el.__value,r(el,"class","rounded mb-1"),r(je,"class","cnt"),r(Zi,"class","text-sm"),r($n,"href",Ut("WiFi-configuration")),r($n,"target","_blank"),r($n,"class","float-right"),r(ci,"type","hidden"),r(ci,"name","w"),ci.value="true",En.__value=1,En.value=En.__value,An.__value=2,An.value=An.__value,r(zt,"name","nc"),r(zt,"class","in-s"),t[3].n.c===void 0&&Ke(()=>t[42].call(zt)),r(Zl,"class","my-1"),r(Ot,"class","cnt"),r(Ji,"class","text-sm"),r(Pn,"href",Ut("Network-configuration")),r(Pn,"target","_blank"),r(Pn,"class","float-right"),In.__value="dhcp",In.value=In.__value,On.__value="static",On.value=On.__value,r(fl,"name","nm"),r(fl,"class","in-f"),t[3].n.m===void 0&&Ke(()=>t[48].call(fl)),r(Rt,"name","ni"),r(Rt,"type","text"),r(Rt,"class","in-m w-full"),Rt.disabled=xi=t[3].n.m=="dhcp",Rt.required=es=t[3].n.m=="static",r(Lt,"name","ns"),r(Lt,"class","in-l"),Lt.disabled=ts=t[3].n.m=="dhcp",Lt.required=ls=t[3].n.m=="static",t[3].n.s===void 0&&Ke(()=>t[50].call(Lt)),r(ql,"class","flex"),r(Jl,"class","my-1"),r(tl,"name","nd"),tl.__value="true",tl.value=tl.__value,r(tl,"type","checkbox"),r(tl,"class","rounded mb-1"),r(ns,"class","my-1"),r(mi,"type","hidden"),r(mi,"name","ntp"),mi.value="true",r(ll,"name","ntpd"),ll.__value="true",ll.value=ll.__value,r(ll,"type","checkbox"),r(ll,"class","rounded mb-1"),r(pi,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(ss,"class","flex"),r(Bl,"class","my-1"),r(pt,"class","cnt"),r(os,"class","text-sm"),r(Ln,"href",Ut("MQTT-configuration")),r(Ln,"target","_blank"),r(Ln,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","q"),_i.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(nl,"name","qp"),r(nl,"type","number"),r(nl,"min","1024"),r(nl,"max","65535"),r(nl,"class","in-l tr w-1/4"),r(qn,"class","flex"),r(cl,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(xl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(en,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),Hn.__value=0,Hn.value=Hn.__value,Wn.__value=1,Wn.value=Wn.__value,zn.__value=2,zn.value=zn.__value,Gn.__value=3,Gn.value=Gn.__value,Vn.__value=4,Vn.value=Vn.__value,Kn.__value=255,Kn.value=Kn.__value,r(gt,"name","qm"),r(gt,"class","in-l"),t[3].q.m===void 0&&Ke(()=>t[63].call(gt)),r(Bn,"class","my-1 flex"),r(Ml,"name","qb"),r(Ml,"type","text"),r(Ml,"class","in-s"),r(tn,"class","my-1"),r(tt,"class","cnt"),r(rs,"class","text-sm"),r(Yn,"href",Ut("User-interface")),r(Yn,"target","_blank"),r(Yn,"class","float-right"),r(di,"type","hidden"),r(di,"name","u"),di.value="true",r(vi,"class","flex flex-wrap"),r(ml,"class","cnt"),r(as,"class","text-sm"),r(Xn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Xn,"target","_blank"),r(Xn,"class","float-right"),r(hi,"type","hidden"),r(hi,"name","d"),hi.value="true",r(il,"type","checkbox"),r(il,"name","ds"),il.__value="true",il.value=il.__value,r(il,"class","rounded mb-1"),r(us,"class","mt-3"),r(Ft,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Jn,"type","button"),r(Jn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(xn,"type","button"),r(xn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(cs,"class","text-center"),r(ms,"class","text-right"),r(Ul,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(q,me){C(q,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),se(a,u,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,h),s(h,d),s(d,v),s(d,g),s(d,A),s(d,$),ne($,t[3].g.h),s(h,M),s(h,P),s(P,F),s(P,E),s(P,I),s(P,D),se(L,D,null),Te(D,t[3].g.t,!0),s(n,ie),s(n,H),s(n,K),s(n,G),s(G,Y),s(Y,Q),s(Q,z),s(Q,Z),s(Q,V),s(Q,j),s(j,ee),s(ee,ue),s(ee,x),s(ee,W),s(ee,U),s(ee,ke),s(j,He),s(He,Be),s(He,We),s(He,Ne),s(He,ge),s(j,Re),s(Re,Me),s(Re,T),s(j,k),s(j,w),s(j,N),s(j,R),s(j,J),s(j,te),s(j,fe),s(j,de),s(j,we),s(j,Ee),s(j,ae),s(j,Ce),s(j,Je),Te(j,t[3].p.r,!0),s(Y,Et),s(Y,st),s(st,ht),s(st,lt),s(st,At),s(st,Ye);for(let _t=0;_t<4;_t+=1)bi[_t]&&bi[_t].m(Ye,null);Te(Ye,t[3].p.c,!0),s(n,Qt),s(n,Ht),s(Ht,bt),s(bt,ze),s(ze,xe),s(ze,Xe),s(ze,Ue),s(ze,qe),ne(qe,t[3].p.f),s(bt,et),s(bt,Ae),s(Ae,Le),s(Ae,pe),s(Ae,ce),s(Ae,ye),ne(ye,t[3].p.m),s(n,zl),s(n,hl),s(hl,_n),s(_n,Pt),Pt.checked=t[3].p.e,s(_n,Ai),s(hl,Pi),kt&&kt.m(hl,null),s(n,Di),s(n,bl),s(bl,Ii),s(bl,Oi),s(bl,Ri),s(bl,Dt),s(Dt,Nl),s(Dt,El),s(Dt,Al),Te(Dt,t[3].g.s,!0),s(n,Li),wt&&wt.m(n,null),s(l,Fi),s(l,je),s(je,dn),s(je,qi),s(je,Pl),se(Dl,Pl,null),s(je,Bi),s(je,Gl),s(je,Ze),s(je,mt),s(je,Vl),s(je,Il),s(Il,Ui),s(Il,Ol),s(Il,ji),s(Il,Wt),s(Wt,vn),s(Wt,hn),Te(Wt,t[3].m.a,!0),s(je,Eo),s(je,rl),s(rl,Hi),s(rl,Ao),s(rl,Ss),s(rl,Po),s(rl,fi),s(fi,Xt),Xt.checked=t[3].m.i,s(fi,Do),s(rl,Io),s(rl,Rl),s(Rl,al),s(al,Ll),s(Ll,Oo);for(let _t=0;_t<7;_t+=1)gi[_t]&&gi[_t].m(al,null);Te(al,t[3].m.b,!0),s(Rl,Ro),s(Rl,dt),s(dt,Fl),s(Fl,Lo),s(dt,bn),s(dt,gn),s(dt,kn),s(dt,wn),Te(dt,t[3].m.p,!0),s(Rl,Fo),s(Rl,It),ne(It,t[3].m.s),s(je,qo),s(je,Kl),s(Kl,Bo),s(Kl,Uo),s(Kl,jo),s(Kl,ul),s(ul,yn),s(ul,Cn),Te(ul,t[3].m.d,!0),s(je,Ho),s(je,Mn),s(Mn,Yl),s(Yl,Wo),s(Yl,zo),s(Yl,Go),s(Yl,Tn),s(Tn,Zt),ne(Zt,t[3].m.f),s(Tn,Vo),s(Tn,Ki),s(Mn,Ko),s(Mn,Ql),s(Ql,Yo),s(Ql,Qo),s(Ql,Xo),s(Ql,Sn),s(Sn,Jt),ne(Jt,t[3].m.r),s(Sn,Zo),s(Sn,Yi),s(je,Jo),s(je,$s),s(je,xo),s(je,Xl),s(Xl,Qi),s(Qi,xt),xt.checked=t[3].m.e.e,s(Qi,er),s(Xl,tr),yt&&yt.m(Xl,null),s(je,lr),Ct&&Ct.m(je,null),s(je,Ns),s(je,Xi),s(Xi,el),el.checked=t[3].m.m.e,s(Xi,nr),s(je,ir),Mt&&Mt.m(je,null),s(l,sr),s(l,Ot),s(Ot,Zi),s(Ot,or),s(Ot,$n),se(Nn,$n,null),s(Ot,rr),s(Ot,ci),s(Ot,ar),s(Ot,Zl),s(Zl,ur),s(Zl,fr),s(Zl,cr),s(Zl,zt),s(zt,En),s(zt,An),qt&&qt.m(zt,null),Te(zt,t[3].n.c,!0),s(Ot,mr),Tt&&Tt.m(Ot,null),s(l,pr),s(l,pt),s(pt,Ji),s(pt,_r),s(pt,Pn),se(Dn,Pn,null),s(pt,dr),s(pt,Jl),s(Jl,vr),s(Jl,hr),s(Jl,br),s(Jl,ql),s(ql,fl),s(fl,In),s(fl,On),Te(fl,t[3].n.m,!0),s(ql,gr),s(ql,Rt),ne(Rt,t[3].n.i),s(ql,kr),s(ql,Lt),se(Rn,Lt,null),Te(Lt,t[3].n.s,!0),s(pt,wr),St&&St.m(pt,null),s(pt,Es),s(pt,ns),s(ns,is),s(is,tl),tl.checked=t[3].n.d,s(is,yr),s(pt,Cr),s(pt,mi),s(pt,Mr),s(pt,Bl),s(Bl,Tr),s(Bl,pi),s(pi,ll),ll.checked=t[3].n.h,s(pi,Sr),s(Bl,$r),s(Bl,Nr),s(Bl,ss),s(ss,gl),ne(gl,t[3].n.n1),s(l,Er),s(l,tt),s(tt,os),s(tt,Ar),s(tt,Ln),se(Fn,Ln,null),s(tt,Pr),s(tt,_i),s(tt,Dr),s(tt,cl),s(cl,Ir),$t&&$t.m(cl,null),s(cl,As),s(cl,Or),s(cl,Rr),s(cl,qn),s(qn,kl),ne(kl,t[3].q.h),s(qn,Lr),s(qn,nl),ne(nl,t[3].q.p),s(tt,Fr),ot&&ot.m(tt,null),s(tt,Ps),s(tt,xl),s(xl,qr),s(xl,Br),s(xl,Ur),s(xl,wl),ne(wl,t[3].q.u),s(tt,jr),s(tt,en),s(en,Hr),s(en,Wr),s(en,zr),s(en,yl),ne(yl,t[3].q.a),s(tt,Gr),s(tt,Bn),s(Bn,Un),s(Un,Vr),s(Un,Kr),s(Un,Yr),s(Un,Cl),ne(Cl,t[3].q.c),s(Bn,Qr),s(Bn,jn),s(jn,Xr),s(jn,Zr),s(jn,Jr),s(jn,gt),s(gt,Hn),s(gt,Wn),s(gt,zn),s(gt,Gn),s(gt,Vn),s(gt,Kn),Te(gt,t[3].q.m,!0),s(tt,xr),s(tt,tn),s(tn,ea),s(tn,ta),s(tn,la),s(tn,Ml),ne(Ml,t[3].q.b),s(l,na),rt&&rt.m(l,null),s(l,Ds),at&&at.m(l,null),s(l,Is),ut&&ut.m(l,null),s(l,Os),ft&&ft.m(l,null),s(l,Ls),s(l,ml),s(ml,rs),s(ml,ia),s(ml,Yn),se(Qn,Yn,null),s(ml,sa),s(ml,di),s(ml,oa),s(ml,vi);for(let _t=0;_t0?wt?wt.p(q,me):(wt=nf(q),wt.c(),wt.m(n,null)):wt&&(wt.d(1),wt=null),me[0]&8&&Te(Wt,q[3].m.a),me[0]&8&&(Xt.checked=q[3].m.i),(!Gt||me[0]&8&&Wi!==(Wi=q[3].m.b!=0))&&(Ll.disabled=Wi),me[0]&8&&Te(al,q[3].m.b),(!Gt||me[0]&8&&zi!==(zi=q[3].m.b!=0))&&(Fl.disabled=zi),(!Gt||me[0]&8&&Gi!==(Gi=q[3].m.b==0))&&(dt.disabled=Gi),me[0]&8&&Te(dt,q[3].m.p),(!Gt||me[0]&9&&Vi!==(Vi=q[0].chip=="esp8266"?q[3].i.h.p==3||q[3].i.h.p==113?512:128:4096))&&r(It,"max",Vi),me[0]&8&&he(It.value)!==q[3].m.s&&ne(It,q[3].m.s),me[0]&8&&Te(ul,q[3].m.d),me[0]&8&&he(Zt.value)!==q[3].m.f&&ne(Zt,q[3].m.f),me[0]&8&&he(Jt.value)!==q[3].m.r&&ne(Jt,q[3].m.r),me[0]&8&&(xt.checked=q[3].m.e.e),q[3].m.e.e?yt?yt.p(q,me):(yt=sf(q),yt.c(),yt.m(Xl,null)):yt&&(yt.d(1),yt=null),q[3].m.e.e?Ct?Ct.p(q,me):(Ct=of(q),Ct.c(),Ct.m(je,Ns)):Ct&&(Ct.d(1),Ct=null),me[0]&8&&(el.checked=q[3].m.m.e),q[3].m.m.e?Mt?Mt.p(q,me):(Mt=rf(q),Mt.c(),Mt.m(je,null)):Mt&&(Mt.d(1),Mt=null),q[0].if&&q[0].if.eth?qt||(qt=af(),qt.c(),qt.m(zt,null)):qt&&(qt.d(1),qt=null),me[0]&8&&Te(zt,q[3].n.c),q[3].n.c==1||q[3].n.c==2?Tt?Tt.p(q,me):(Tt=uf(q),Tt.c(),Tt.m(Ot,null)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&Te(fl,q[3].n.m),(!Gt||me[0]&8&&xi!==(xi=q[3].n.m=="dhcp"))&&(Rt.disabled=xi),(!Gt||me[0]&8&&es!==(es=q[3].n.m=="static"))&&(Rt.required=es),me[0]&8&&Rt.value!==q[3].n.i&&ne(Rt,q[3].n.i),(!Gt||me[0]&8&&ts!==(ts=q[3].n.m=="dhcp"))&&(Lt.disabled=ts),(!Gt||me[0]&8&&ls!==(ls=q[3].n.m=="static"))&&(Lt.required=ls),me[0]&8&&Te(Lt,q[3].n.s),q[3].n.m=="static"?St?St.p(q,me):(St=ff(q),St.c(),St.m(pt,Es)):St&&(St.d(1),St=null),me[0]&8&&(tl.checked=q[3].n.d),me[0]&8&&(ll.checked=q[3].n.h),me[0]&8&&gl.value!==q[3].n.n1&&ne(gl,q[3].n.n1),q[0].chip!="esp8266"?$t?$t.p(q,me):($t=cf(q),$t.c(),$t.m(cl,As)):$t&&($t.d(1),$t=null),me[0]&8&&kl.value!==q[3].q.h&&ne(kl,q[3].q.h),me[0]&8&&he(nl.value)!==q[3].q.p&&ne(nl,q[3].q.p),q[3].q.s.e?ot?(ot.p(q,me),me[0]&8&&O(ot,1)):(ot=mf(q),ot.c(),O(ot,1),ot.m(tt,Ps)):ot&&(Ie(),B(ot,1,1,()=>{ot=null}),Oe()),me[0]&8&&wl.value!==q[3].q.u&&ne(wl,q[3].q.u),me[0]&8&&yl.value!==q[3].q.a&&ne(yl,q[3].q.a),me[0]&8&&Cl.value!==q[3].q.c&&ne(Cl,q[3].q.c),me[0]&8&&Te(gt,q[3].q.m),me[0]&8&&Ml.value!==q[3].q.b&&ne(Ml,q[3].q.b),q[3].q.m==3?rt?(rt.p(q,me),me[0]&8&&O(rt,1)):(rt=pf(q),rt.c(),O(rt,1),rt.m(l,Ds)):rt&&(Ie(),B(rt,1,1,()=>{rt=null}),Oe()),q[3].q.m==4?at?(at.p(q,me),me[0]&8&&O(at,1)):(at=_f(q),at.c(),O(at,1),at.m(l,Is)):at&&(Ie(),B(at,1,1,()=>{at=null}),Oe()),q[3].c.es!=null?ut?(ut.p(q,me),me[0]&8&&O(ut,1)):(ut=df(q),ut.c(),O(ut,1),ut.m(l,Os)):ut&&(Ie(),B(ut,1,1,()=>{ut=null}),Oe()),me[0]&8&&(Rs=q[3].p.r.startsWith("10YNO")||q[3].p.r=="10Y1001A1001A48H"),Rs?ft?(ft.p(q,me),me[0]&8&&O(ft,1)):(ft=bf(q),ft.c(),O(ft,1),ft.m(l,Ls)):ft&&(Ie(),B(ft,1,1,()=>{ft=null}),Oe()),me[0]&136){ei=q[7];let Vt;for(Vt=0;Vt20||q[0].chip=="esp8266"||q[3].i.d.d>0?ct?(ct.p(q,me),me[0]&9&&O(ct,1)):(ct=wf(q),ct.c(),O(ct,1),ct.m(l,Fs)):ct&&(Ie(),B(ct,1,1,()=>{ct=null}),Oe()),me[0]&8&&(il.checked=q[3].d.s),q[3].d.s?Nt?Nt.p(q,me):(Nt=Nf(q),Nt.c(),Nt.m(Ft,null)):Nt&&(Nt.d(1),Nt=null);const _t={};me[0]&2&&(_t.active=q[1]),ln.$set(_t);const ha={};me[0]&4&&(ha.active=q[2]),nn.$set(ha);const ba={};me[0]&16&&(ba.active=q[4]),sn.$set(ba);const ga={};me[0]&32&&(ga.active=q[5]),on.$set(ga)},i(q){Gt||(O(a.$$.fragment,q),O(L.$$.fragment,q),O(Dl.$$.fragment,q),O(Nn.$$.fragment,q),O(Dn.$$.fragment,q),O(Rn.$$.fragment,q),O(Fn.$$.fragment,q),O(ot),O(rt),O(at),O(ut),O(ft),O(Qn.$$.fragment,q),O(ct),O(Zn.$$.fragment,q),O(ln.$$.fragment,q),O(nn.$$.fragment,q),O(sn.$$.fragment,q),O(on.$$.fragment,q),Gt=!0)},o(q){B(a.$$.fragment,q),B(L.$$.fragment,q),B(Dl.$$.fragment,q),B(Nn.$$.fragment,q),B(Dn.$$.fragment,q),B(Rn.$$.fragment,q),B(Fn.$$.fragment,q),B(ot),B(rt),B(at),B(ut),B(ft),B(Qn.$$.fragment,q),B(ct),B(Zn.$$.fragment,q),B(ln.$$.fragment,q),B(nn.$$.fragment,q),B(sn.$$.fragment,q),B(on.$$.fragment,q),Gt=!1},d(q){q&&y(e),oe(a),oe(L),Kt(bi,q),kt&&kt.d(),wt&&wt.d(),oe(Dl),Kt(gi,q),yt&&yt.d(),Ct&&Ct.d(),Mt&&Mt.d(),oe(Nn),qt&&qt.d(),Tt&&Tt.d(),oe(Dn),oe(Rn),St&&St.d(),oe(Fn),$t&&$t.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),oe(Qn),Kt(vt,q),ct&&ct.d(),oe(Zn),Nt&&Nt.d(),q&&y(Bs),oe(ln,q),q&&y(Us),oe(nn,q),q&&y(js),oe(sn,q),q&&y(Hs),oe(on,q),Ws=!1,Ge(va)}}}async function Np(){await(await fetch("/reboot",{method:"POST"})).json()}function Ep(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"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"}],o=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};yi.subscribe(Ze=>{Ze.version&&(l(3,a=Ze),l(1,o=!1))}),Vm();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Ze=new URLSearchParams;Ze.append("perform","true");let Vl=await(await fetch("/reset",{method:"POST",body:Ze})).json();l(4,f=!1),l(5,c=Vl.success)}}async function _(Ze){l(2,u=!0);const mt=new FormData(Ze.target),Vl=new URLSearchParams;for(let Ol of mt){const[ji,Wt]=Ol;Vl.append(ji,Wt)}let Ui=await(await fetch("/save",{method:"POST",body:Vl})).json();Yt.update(Ol=>(Ol.booting=Ui.reboot,Ol.ui=a.u,Ol)),l(2,u=!1),si("/")}const h=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(Ze=>(Ze.booting=!0,Ze)),Np())};async function d(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.c=!1,mt)))}async function v(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.r=!1,mt)))}async function g(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),yi.update(mt=>(mt.q.s.k=!1,mt)))}const A=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let $=44;function M(){a.g.h=this.value,l(3,a)}function P(){a.g.t=nt(this),l(3,a)}function F(){a.p.r=nt(this),l(3,a)}function E(){a.p.c=nt(this),l(3,a)}function I(){a.p.f=he(this.value),l(3,a)}function D(){a.p.m=he(this.value),l(3,a)}function L(){a.p.e=this.checked,l(3,a)}function ie(){a.p.t=this.value,l(3,a)}function H(){a.g.s=nt(this),l(3,a)}function K(){a.g.u=this.value,l(3,a)}function G(){a.g.p=this.value,l(3,a)}function Y(){a.m.a=nt(this),l(3,a)}function Q(){a.m.i=this.checked,l(3,a)}function z(){a.m.b=nt(this),l(3,a)}function Z(){a.m.p=nt(this),l(3,a)}function V(){a.m.s=he(this.value),l(3,a)}function j(){a.m.d=nt(this),l(3,a)}function ee(){a.m.f=he(this.value),l(3,a)}function ue(){a.m.r=he(this.value),l(3,a)}function x(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function U(){a.m.e.a=this.value,l(3,a)}function ke(){a.m.m.e=this.checked,l(3,a)}function He(){a.m.m.w=he(this.value),l(3,a)}function Be(){a.m.m.v=he(this.value),l(3,a)}function We(){a.m.m.a=he(this.value),l(3,a)}function Ne(){a.m.m.c=he(this.value),l(3,a)}function ge(){a.n.c=nt(this),l(3,a)}function Re(){a.w.s=this.value,l(3,a)}function Me(){a.w.p=this.value,l(3,a)}function T(){a.w.z=nt(this),l(3,a)}function k(){a.w.w=he(this.value),l(3,a)}function w(){a.w.b=this.checked,l(3,a)}function N(){a.n.m=nt(this),l(3,a)}function R(){a.n.i=this.value,l(3,a)}function J(){a.n.s=nt(this),l(3,a)}function te(){a.n.g=this.value,l(3,a)}function fe(){a.n.d1=this.value,l(3,a)}function de(){a.n.d2=this.value,l(3,a)}function we(){a.n.d=this.checked,l(3,a)}function Ee(){a.n.h=this.checked,l(3,a)}function ae(){a.n.n1=this.value,l(3,a)}function Ce(){a.q.s.e=this.checked,l(3,a)}function Je(){a.q.h=this.value,l(3,a)}function Et(){a.q.p=he(this.value),l(3,a)}function st(){a.q.u=this.value,l(3,a)}function ht(){a.q.a=this.value,l(3,a)}function lt(){a.q.c=this.value,l(3,a)}function At(){a.q.m=nt(this),l(3,a)}function Ye(){a.q.b=this.value,l(3,a)}function Qt(){a.o.e=this.value,l(3,a)}function Ht(){a.o.c=this.value,l(3,a)}function bt(){a.o.u1=this.value,l(3,a)}function ze(){a.o.u2=this.value,l(3,a)}function xe(){a.o.u3=this.value,l(3,a)}function Xe(){a.h.t=this.value,l(3,a)}function Ue(){a.h.h=this.value,l(3,a)}function qe(){a.h.n=this.value,l(3,a)}function et(){a.c.e=this.checked,l(3,a)}function Ae(){a.c.i=this.value,l(3,a)}function Le(){a.c.s=this.value,l(3,a)}function pe(){a.c.es=this.checked,l(3,a)}function ce(Ze){a.t.t[Ze]=he(this.value),l(3,a)}function ye(){a.t.h=he(this.value),l(3,a)}function zl(Ze){a.u[Ze.key]=nt(this),l(3,a)}function hl(){a.i.h.p=nt(this),l(3,a)}function _n(){a.i.h.t=nt(this),l(3,a)}function Pt(){a.i.h.u=this.checked,l(3,a)}function Ai(){a.i.a=he(this.value),l(3,a)}function Pi(){a.i.l.p=he(this.value),l(3,a)}function Di(){a.i.l.i=this.checked,l(3,a)}function bl(){a.i.r.i=this.checked,l(3,a)}function Ii(){a.i.r.r=he(this.value),l(3,a)}function Oi(){a.i.r.g=he(this.value),l(3,a)}function Ri(){a.i.r.b=he(this.value),l(3,a)}function Dt(){a.i.d.d=he(this.value),l(3,a)}function Nl(){a.i.t.d=he(this.value),l(3,a)}function El(){a.i.t.a=he(this.value),l(3,a)}function Al(){a.i.v.p=he(this.value),l(3,a)}function Li(){a.i.v.d.v=he(this.value),l(3,a)}function Fi(){a.i.v.d.g=he(this.value),l(3,a)}function je(){a.i.d.b=nt(this),l(3,a)}function dn(){a.i.v.o=he(this.value),l(3,a)}function qi(){a.i.v.m=he(this.value),l(3,a)}function Pl(){a.i.v.b=he(this.value),l(3,a)}function Dl(){a.d.s=this.checked,l(3,a)}function Bi(){a.d.t=this.checked,l(3,a)}function Gl(){a.d.l=nt(this),l(3,a)}return t.$$set=Ze=>{"sysinfo"in Ze&&l(0,n=Ze.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,$=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,f,c,$,i,p,_,h,d,v,g,A,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j,ee,ue,x,W,U,ke,He,Be,We,Ne,ge,Re,Me,T,k,w,N,R,J,te,fe,de,we,Ee,ae,Ce,Je,Et,st,ht,lt,At,Ye,Qt,Ht,bt,ze,xe,Xe,Ue,qe,et,Ae,Le,pe,ce,ye,zl,hl,_n,Pt,Ai,Pi,Di,bl,Ii,Oi,Ri,Dt,Nl,El,Al,Li,Fi,je,dn,qi,Pl,Dl,Bi,Gl]}class Ap extends De{constructor(e){super(),Pe(this,e,Ep,$p,$e,{sysinfo:0},null,[-1,-1,-1,-1])}}function Af(t,e,l){const n=t.slice();return n[20]=e[l],n}function Pp(t){let e=ve(t[1].chip,t[1].board)+"",l;return{c(){l=S(e)},m(n,i){C(n,l,i)},p(n,i){i&2&&e!==(e=ve(n[1].chip,n[1].board)+"")&&X(l,e)},d(n){n&&y(l)}}}function Pf(t){let e,l,n=t[1].apmac+"",i,o,u,a,f,c,p,_,h,d=Fa(t[1])+"",v,g,A=t[1].boot_reason+"",$,M,P=t[1].ex_cause+"",F,E,I;const D=[Ip,Dp],L=[];function ie(H,K){return H[0].u>0?0:1}return f=ie(t),c=L[f]=D[f](t),{c(){e=m("div"),l=S("AP MAC: "),i=S(n),o=b(),u=m("div"),a=S(`Last boot: + `),c.c(),p=b(),_=m("div"),h=S("Reason: "),v=S(d),g=S(" ("),$=S(A),M=S("/"),F=S(P),E=S(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(_,"class","my-2")},m(H,K){C(H,e,K),s(e,l),s(e,i),C(H,o,K),C(H,u,K),s(u,a),L[f].m(u,null),C(H,p,K),C(H,_,K),s(_,h),s(_,v),s(_,g),s(_,$),s(_,M),s(_,F),s(_,E),I=!0},p(H,K){(!I||K&2)&&n!==(n=H[1].apmac+"")&&X(i,n);let G=f;f=ie(H),f===G?L[f].p(H,K):(Ie(),B(L[G],1,1,()=>{L[G]=null}),Oe(),c=L[f],c?c.p(H,K):(c=L[f]=D[f](H),c.c()),O(c,1),c.m(u,null)),(!I||K&2)&&d!==(d=Fa(H[1])+"")&&X(v,d),(!I||K&2)&&A!==(A=H[1].boot_reason+"")&&X($,A),(!I||K&2)&&P!==(P=H[1].ex_cause+"")&&X(F,P)},i(H){I||(O(c),I=!0)},o(H){B(c),I=!1},d(H){H&&y(e),H&&y(o),H&&y(u),L[f].d(),H&&y(p),H&&y(_)}}}function Dp(t){let e;return{c(){e=S("-")},m(l,n){C(l,e,n)},p:_e,i:_e,o:_e,d(l){l&&y(e)}}}function Ip(t){let e,l;return e=new Yc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function Op(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){C(l,e,n)},p:_e,d(l){l&&y(e)}}}function Df(t){let e,l,n,i,o,u=ys(t[1].meter.mfg)+"",a,f,c,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,d,v,g,A=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=b(),i=m("div"),o=S("Manufacturer: "),a=S(u),f=b(),c=m("div"),p=S("Model: "),h=S(_),d=b(),v=m("div"),g=S("ID: "),$=S(A),r(l,"class","text-sm"),r(i,"class","my-2"),r(c,"class","my-2"),r(v,"class","my-2"),r(e,"class","cnt")},m(M,P){C(M,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,h),s(e,d),s(e,v),s(v,g),s(v,$)},p(M,P){P&2&&u!==(u=ys(M[1].meter.mfg)+"")&&X(a,u),P&2&&_!==(_=(M[1].meter.model?M[1].meter.model:"unknown")+"")&&X(h,_),P&2&&A!==(A=(M[1].meter.id?M[1].meter.id:"unknown")+"")&&X($,A)},d(M){M&&y(e)}}}function If(t){let e,l,n,i,o,u=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",h,d,v,g,A=t[1].net.gw+"",$,M,P,F,E=t[1].net.dns1+"",I,D,L=t[1].net.dns2&&Of(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=b(),i=m("div"),o=S("IP: "),a=S(u),f=b(),c=m("div"),p=S("Mask: "),h=S(_),d=b(),v=m("div"),g=S("Gateway: "),$=S(A),M=b(),P=m("div"),F=S("DNS: "),I=S(E),D=b(),L&&L.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(c,"class","my-2"),r(v,"class","my-2"),r(P,"class","my-2"),r(e,"class","cnt")},m(ie,H){C(ie,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,h),s(e,d),s(e,v),s(v,g),s(v,$),s(e,M),s(e,P),s(P,F),s(P,I),s(P,D),L&&L.m(P,null)},p(ie,H){H&2&&u!==(u=ie[1].net.ip+"")&&X(a,u),H&2&&_!==(_=ie[1].net.mask+"")&&X(h,_),H&2&&A!==(A=ie[1].net.gw+"")&&X($,A),H&2&&E!==(E=ie[1].net.dns1+"")&&X(I,E),ie[1].net.dns2?L?L.p(ie,H):(L=Of(ie),L.c(),L.m(P,null)):L&&(L.d(1),L=null)},d(ie){ie&&y(e),L&&L.d()}}}function Of(t){let e,l=t[1].net.dns2+"",n;return{c(){e=S("/ "),n=S(l)},m(i,o){C(i,e,o),C(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&X(n,l)},d(i){i&&y(e),i&&y(n)}}}function Rf(t){let e,l,n,i=t[1].upgrade.t+"",o,u,a=t[1].version+"",f,c,p=t[1].upgrade.x+"",_,h,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=S("Previous upgrade attempt ("),o=S(i),u=S(") does not match current version ("),f=S(a),c=S(") ["),_=S(p),h=S("/"),v=S(d),g=S("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(A,$){C(A,e,$),s(e,l),s(l,n),s(l,o),s(l,u),s(l,f),s(l,c),s(l,_),s(l,h),s(l,v),s(l,g)},p(A,$){$&2&&i!==(i=A[1].upgrade.t+"")&&X(o,i),$&2&&a!==(a=A[1].version+"")&&X(f,a),$&2&&p!==(p=A[1].upgrade.x+"")&&X(_,p),$&2&&d!==(d=A[1].upgrade.e+"")&&X(v,d)},d(A){A&&y(e)}}}function Lf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Ff(t),h=t[1].fwconsent===2&&qf();return{c(){e=m("div"),l=S(`Latest version: + `),n=m("a"),o=S(i),a=b(),_&&_.c(),f=b(),h&&h.c(),c=Ve(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(d,v){C(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),C(d,f,v),h&&h.m(d,v),C(d,c,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&X(o,i),(!p||v&4&&u!==(u=d[2].html_url))&&r(n,"href",u),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&O(_,1)):(_=Ff(d),_.c(),O(_,1),_.m(e,null)):_&&(Ie(),B(_,1,1,()=>{_=null}),Oe()),d[1].fwconsent===2?h||(h=qf(),h.c(),h.m(c.parentNode,c)):h&&(h.d(1),h=null)},i(d){p||(O(_),p=!0)},o(d){B(_),p=!1},d(d){d&&y(e),_&&_.d(),d&&y(f),h&&h.d(d),d&&y(c)}}}function Ff(t){let e,l,n,i,o,u;return n=new Qc({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,f){C(a,e,f),s(e,l),se(n,l,null),i=!0,o||(u=le(l,"click",t[10]),o=!0)},p:_e,i(a){i||(O(n.$$.fragment,a),i=!0)},o(a){B(n.$$.fragment,a),i=!1},d(a){a&&y(e),oe(n),o=!1,u()}}}function qf(t){let e;return{c(){e=m("div"),e.innerHTML='
You have disabled one-click firmware upgrade, link to self-upgrade is disabled
',r(e,"class","my-2")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Bf(t){let e,l=Cs(ve(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=S(l),r(e,"class","bd-red")},m(i,o){C(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Cs(ve(i[1].chip,i[1].board))+"")&&X(n,l)},d(i){i&&y(e)}}}function Uf(t){let e,l,n,i,o,u;function a(p,_){return p[4].length==0?Lp:Rp}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=b(),c.c(),nc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){C(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(u=[le(n,"change",t[13]),le(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&y(e),t[12](null),c.d(),o=!1,Ge(u)}}}function Rp(t){let e=t[4][0].name+"",l,n,i;return{c(){l=S(e),n=b(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){C(o,l,u),C(o,n,u),C(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&X(l,e)},d(o){o&&y(l),o&&y(n),o&&y(i)}}}function Lp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){C(i,e,o),l||(n=le(e,"click",t[14]),l=!0)},p:_e,d(i){i&&y(e),l=!1,n()}}}function jf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g=t[9],A=[];for(let E=0;E Include Secrets
(SSID, PSK, passwords and tokens)',f=b(),$&&$.c(),c=b(),p=m("form"),_=m("input"),h=b(),F.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),nc(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(E,I){C(E,e,I),s(e,l),s(e,n),s(e,i),s(i,o);for(let D=0;D{N=null}),Oe());const Et={};Ce&8388608&&(Et.$$scope={dirty:Ce,ctx:ae}),ie.$set(Et),ae[1].meter?R?R.p(ae,Ce):(R=Df(ae),R.c(),R.m(e,Y)):R&&(R.d(1),R=null),ae[1].net?J?J.p(ae,Ce):(J=If(ae),J.c(),J.m(e,Q)):J&&(J.d(1),J=null),(!T||Ce&2)&&ue!==(ue=ae[1].version+"")&&X(x,ue),ae[1].upgrade.t&&ae[1].upgrade.t!=ae[1].version?te?te.p(ae,Ce):(te=Rf(ae),te.c(),te.m(z,U)):te&&(te.d(1),te=null),ae[2]?fe?(fe.p(ae,Ce),Ce&4&&O(fe,1)):(fe=Lf(ae),fe.c(),O(fe,1),fe.m(z,ke)):fe&&(Ie(),B(fe,1,1,()=>{fe=null}),Oe()),Ce&3&&(He=(ae[1].security==0||ae[0].a)&&oi(ae[1].board)),He?de?de.p(ae,Ce):(de=Bf(ae),de.c(),de.m(z,Be)):de&&(de.d(1),de=null),ae[1].security==0||ae[0].a?we?we.p(ae,Ce):(we=Uf(ae),we.c(),we.m(z,null)):we&&(we.d(1),we=null),ae[1].security==0||ae[0].a?Ee?Ee.p(ae,Ce):(Ee=jf(ae),Ee.c(),Ee.m(e,null)):Ee&&(Ee.d(1),Ee=null);const st={};Ce&32&&(st.active=ae[5]),ge.$set(st);const ht={};Ce&256&&(ht.active=ae[8]),Me.$set(ht)},i(ae){T||(O(A.$$.fragment,ae),O(N),O(ie.$$.fragment,ae),O(fe),O(ge.$$.fragment,ae),O(Me.$$.fragment,ae),T=!0)},o(ae){B(A.$$.fragment,ae),B(N),B(ie.$$.fragment,ae),B(fe),B(ge.$$.fragment,ae),B(Me.$$.fragment,ae),T=!1},d(ae){ae&&y(e),oe(A),N&&N.d(),oe(ie),R&&R.d(),J&&J.d(),te&&te.d(),fe&&fe.d(),de&&de.d(),we&&we.d(),Ee&&Ee.d(),ae&&y(Ne),oe(ge,ae),ae&&y(Re),oe(Me,ae),k=!1,w()}}}async function Up(){await(await fetch("/reboot",{method:"POST"})).json()}function jp(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};So.subscribe(D=>{l(2,u=Kc(i.version,D)),u||l(2,u=D[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Cs(ve(i.chip,i.board))))&&(Yt.update(D=>(D.upgrading=!0,D)),Vc(u.tag_name))}const f=function(){confirm("Are you sure you want to reboot the device?")&&(Yt.update(D=>(D.booting=!0,D)),Up())};let c,p=[],_=!1,h,d=[],v=!1;yo();function g(D){ks[D?"unshift":"push"](()=>{c=D,l(3,c)})}function A(){p=this.files,l(4,p)}const $=()=>{c.click()},M=()=>l(5,_=!0);function P(D){ks[D?"unshift":"push"](()=>{h=D,l(6,h)})}function F(){d=this.files,l(7,d)}const E=()=>{h.click()},I=()=>l(8,v=!0);return t.$$set=D=>{"data"in D&&l(0,n=D.data),"sysinfo"in D&&l(1,i=D.sysinfo)},[n,i,u,c,p,_,h,d,v,o,a,f,g,A,$,M,P,F,E,I]}class Hp extends De{constructor(e){super(),Pe(this,e,jp,Bp,$e,{data:0,sysinfo:1})}}function zf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],5)+"",a,f,c=ve(t[0],4)+"",p,_,h=ve(t[0],3)+"",d,v,g,A,$=ve(t[0],2)+"",M,P,F=ve(t[0],1)+"",E,I,D=ve(t[0],0)+"",L,ie,H,K,G=ve(t[0],101)+"",Y,Q,z=ve(t[0],100)+"",Z;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),f=m("option"),p=S(c),_=m("option"),d=S(h),v=b(),g=m("optgroup"),A=m("option"),M=S($),P=m("option"),E=S(F),I=m("option"),L=S(D),ie=b(),H=m("optgroup"),K=m("option"),Y=S(G),Q=m("option"),Z=S(z),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),A.__value=2,A.value=A.__value,P.__value=1,P.value=P.__value,I.__value=0,I.value=I.__value,r(g,"label","Custom hardware"),K.__value=101,K.value=K.__value,Q.__value=100,Q.value=Q.__value,r(H,"label","Generic hardware")},m(V,j){C(V,e,j),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),C(V,v,j),C(V,g,j),s(g,A),s(A,M),s(g,P),s(P,E),s(g,I),s(I,L),C(V,ie,j),C(V,H,j),s(H,K),s(K,Y),s(H,Q),s(Q,Z)},p(V,j){j&1&&n!==(n=ve(V[0],7)+"")&&X(i,n),j&1&&u!==(u=ve(V[0],5)+"")&&X(a,u),j&1&&c!==(c=ve(V[0],4)+"")&&X(p,c),j&1&&h!==(h=ve(V[0],3)+"")&&X(d,h),j&1&&$!==($=ve(V[0],2)+"")&&X(M,$),j&1&&F!==(F=ve(V[0],1)+"")&&X(E,F),j&1&&D!==(D=ve(V[0],0)+"")&&X(L,D),j&1&&G!==(G=ve(V[0],101)+"")&&X(Y,G),j&1&&z!==(z=ve(V[0],100)+"")&&X(Z,z)},d(V){V&&y(e),V&&y(v),V&&y(g),V&&y(ie),V&&y(H)}}}function Gf(t){let e,l,n=ve(t[0],201)+"",i,o,u=ve(t[0],202)+"",a,f,c=ve(t[0],203)+"",p,_,h=ve(t[0],241)+"",d,v,g=ve(t[0],242)+"",A,$,M=ve(t[0],243)+"",P,F,E=ve(t[0],200)+"",I;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),f=m("option"),p=S(c),_=m("option"),d=S(h),v=m("option"),A=S(g),$=m("option"),P=S(M),F=m("option"),I=S(E),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=241,_.value=_.__value,v.__value=242,v.value=v.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,r(e,"label","Generic hardware")},m(D,L){C(D,e,L),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),s(e,v),s(v,A),s(e,$),s($,P),s(e,F),s(F,I)},p(D,L){L&1&&n!==(n=ve(D[0],201)+"")&&X(i,n),L&1&&u!==(u=ve(D[0],202)+"")&&X(a,u),L&1&&c!==(c=ve(D[0],203)+"")&&X(p,c),L&1&&h!==(h=ve(D[0],241)+"")&&X(d,h),L&1&&g!==(g=ve(D[0],242)+"")&&X(A,g),L&1&&M!==(M=ve(D[0],243)+"")&&X(P,M),L&1&&E!==(E=ve(D[0],200)+"")&&X(I,E)},d(D){D&&y(e)}}}function Vf(t){let e,l,n=ve(t[0],7)+"",i,o,u=ve(t[0],6)+"",a,f,c=ve(t[0],5)+"",p,_,h,d,v=ve(t[0],51)+"",g,A,$=ve(t[0],50)+"",M;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=m("option"),a=S(u),f=m("option"),p=S(c),_=b(),h=m("optgroup"),d=m("option"),g=S(v),A=m("option"),M=S($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,r(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,A.__value=50,A.value=A.__value,r(h,"label","Generic hardware")},m(P,F){C(P,e,F),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),C(P,_,F),C(P,h,F),s(h,d),s(d,g),s(h,A),s(A,M)},p(P,F){F&1&&n!==(n=ve(P[0],7)+"")&&X(i,n),F&1&&u!==(u=ve(P[0],6)+"")&&X(a,u),F&1&&c!==(c=ve(P[0],5)+"")&&X(p,c),F&1&&v!==(v=ve(P[0],51)+"")&&X(g,v),F&1&&$!==($=ve(P[0],50)+"")&&X(M,$)},d(P){P&&y(e),P&&y(_),P&&y(h)}}}function Kf(t){let e,l,n=ve(t[0],8)+"",i,o,u,a,f=ve(t[0],71)+"",c,p,_=ve(t[0],70)+"",h;return{c(){e=m("optgroup"),l=m("option"),i=S(n),o=b(),u=m("optgroup"),a=m("option"),c=S(f),p=m("option"),h=S(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,r(u,"label","Generic hardware")},m(d,v){C(d,e,v),s(e,l),s(l,i),C(d,o,v),C(d,u,v),s(u,a),s(a,c),s(u,p),s(p,h)},p(d,v){v&1&&n!==(n=ve(d[0],8)+"")&&X(i,n),v&1&&f!==(f=ve(d[0],71)+"")&&X(c,f),v&1&&_!==(_=ve(d[0],70)+"")&&X(h,_)},d(d){d&&y(e),d&&y(o),d&&y(u)}}}function Yf(t){let e,l,n=ve(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=S(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){C(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=ve(o[0],200)+"")&&X(i,n)},d(o){o&&y(e)}}}function Wp(t){let e,l,n,i,o,u,a,f=t[0]=="esp8266"&&zf(t),c=t[0]=="esp32"&&Gf(t),p=t[0]=="esp32s2"&&Vf(t),_=t[0]=="esp32c3"&&Kf(t),h=t[0]=="esp32solo"&&Yf(t);return{c(){e=m("option"),l=b(),f&&f.c(),n=b(),c&&c.c(),i=b(),p&&p.c(),o=b(),_&&_.c(),u=b(),h&&h.c(),a=Ve(),e.__value=-1,e.value=e.__value},m(d,v){C(d,e,v),C(d,l,v),f&&f.m(d,v),C(d,n,v),c&&c.m(d,v),C(d,i,v),p&&p.m(d,v),C(d,o,v),_&&_.m(d,v),C(d,u,v),h&&h.m(d,v),C(d,a,v)},p(d,[v]){d[0]=="esp8266"?f?f.p(d,v):(f=zf(d),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"?c?c.p(d,v):(c=Gf(d),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Vf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Kf(d),_.c(),_.m(u.parentNode,u)):_&&(_.d(1),_=null),d[0]=="esp32solo"?h?h.p(d,v):(h=Yf(d),h.c(),h.m(a.parentNode,a)):h&&(h.d(1),h=null)},i:_e,o:_e,d(d){d&&y(e),d&&y(l),f&&f.d(d),d&&y(n),c&&c.d(d),d&&y(i),p&&p.d(d),d&&y(o),_&&_.d(d),d&&y(u),h&&h.d(d),d&&y(a)}}}function zp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Gp extends De{constructor(e){super(),Pe(this,e,zp,Wp,$e,{chip:0})}}function Qf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Xf(t){let e,l,n,i,o,u,a;return u=new fo({props:{chip:t[0].chip}}),{c(){e=m("div"),l=S("HAN GPIO"),n=m("br"),i=b(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(f,c){C(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),se(u,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),u.$set(p)},i(f){a||(O(u.$$.fragment,f),a=!0)},o(f){B(u.$$.fragment,f),a=!1},d(f){f&&y(e),oe(u)}}}function Vp(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q=t[0].usrcfg&&Qf();v=new Gp({props:{chip:t[0].chip}});let z=t[0].board&&t[0].board>20&&Xf(t);return H=new jt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Initial configuration",a=b(),Q&&Q.c(),f=b(),c=m("div"),p=S("Board type"),_=m("br"),h=b(),d=m("select"),re(v.$$.fragment),g=b(),z&&z.c(),A=b(),$=m("div"),M=m("label"),P=m("input"),F=S(" Clear all other configuration"),E=b(),I=m("div"),I.innerHTML='',D=b(),L=m("span"),L.textContent=" ",ie=b(),re(H.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(d,"name","vb"),r(d,"class","in-s"),t[0].board===void 0&&Ke(()=>t[4].call(d)),r(c,"class","my-3"),r(P,"type","checkbox"),r(P,"name","vr"),P.__value="true",P.value=P.__value,r(P,"class","rounded mb-1"),r($,"class","my-3"),r(I,"class","my-3"),r(L,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,V){C(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),Q&&Q.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,h),s(c,d),se(v,d,null),Te(d,t[0].board,!0),s(n,g),z&&z.m(n,null),s(n,A),s(n,$),s($,M),s(M,P),P.checked=t[2],s(M,F),s(n,E),s(n,I),s(n,D),s(n,L),C(Z,ie,V),se(H,Z,V),K=!0,G||(Y=[le(d,"change",t[4]),le(P,"change",t[5]),le(n,"submit",Ms(t[3]))],G=!0)},p(Z,[V]){Z[0].usrcfg?Q||(Q=Qf(),Q.c(),Q.m(n,f)):Q&&(Q.d(1),Q=null);const j={};V&1&&(j.chip=Z[0].chip),v.$set(j),V&1&&Te(d,Z[0].board),Z[0].board&&Z[0].board>20?z?(z.p(Z,V),V&1&&O(z,1)):(z=Xf(Z),z.c(),O(z,1),z.m(n,A)):z&&(Ie(),B(z,1,1,()=>{z=null}),Oe()),V&4&&(P.checked=Z[2]);const ee={};V&2&&(ee.active=Z[1]),H.$set(ee)},i(Z){K||(O(v.$$.fragment,Z),O(z),O(H.$$.fragment,Z),K=!0)},o(Z){B(v.$$.fragment,Z),B(z),B(H.$$.fragment,Z),K=!1},d(Z){Z&&y(e),Q&&Q.d(),oe(v),z&&z.d(),Z&&y(ie),oe(H,Z),G=!1,Ge(Y)}}}function Kp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let v of p){const[g,A]=v;_.append(g,A)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Yt.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),si(n.usrcfg?"/":"/setup")}let u=!1;function a(){n.board=nt(this),l(0,n)}function f(){u=this.checked,l(2,u),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,u=!n.usrcfg)},[n,i,u,o,a,f]}class Yp extends De{constructor(e){super(),Pe(this,e,Kp,Vp,$e,{sysinfo:0})}}function Zf(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Jf(t){let e,l,n,i,o,u,a,f,c,p,_,h,d;return{c(){e=m("div"),l=S("SSID"),n=m("br"),i=b(),o=m("input"),a=b(),f=m("div"),c=S("PSK"),p=m("br"),_=b(),h=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(h,"name","sp"),r(h,"type","password"),r(h,"class","in-s"),r(h,"autocomplete","off"),h.required=d=t[2]==2,r(f,"class","my-3")},m(v,g){C(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),C(v,a,g),C(v,f,g),s(f,c),s(f,p),s(f,_),s(f,h)},p(v,g){g&4&&u!==(u=v[2]==1||v[2]==2)&&(o.required=u),g&4&&d!==(d=v[2]==2)&&(h.required=d)},d(v){v&&y(e),v&&y(a),v&&y(f)}}}function xf(t){let e,l,n,i,o,u,a,f;return a=new Zc({}),{c(){e=m("br"),l=b(),n=m("div"),i=m("input"),o=b(),u=m("select"),re(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(c,p){C(c,e,p),C(c,l,p),C(c,n,p),s(n,i),s(n,o),s(n,u),se(a,u,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(u.required=c[1])},i(c){f||(O(a.$$.fragment,c),f=!0)},o(c){B(a.$$.fragment,c),f=!1},d(c){c&&y(e),c&&y(l),c&&y(n),oe(a)}}}function ec(t){let e;return{c(){e=m("div"),e.innerHTML=`
Gateway
DNS
-
`,r(e,"class","my-3 flex")},m(l,n){C(l,e,n)},d(l){l&&w(e)}}}function Qp(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j=t[0].if&&t[0].if.eth&&Zf(),ee=(t[2]==1||t[2]==2)&&Jf(t),ue=t[1]&&xf(t),x=t[1]&&ec();return Q=new jt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Setup",a=b(),c=m("div"),f=T("Connection"),p=m("br"),_=b(),h=m("select"),d=m("option"),d.textContent="Connect to WiFi",v=m("option"),v.textContent="Standalone access point",j&&j.c(),g=b(),ee&&ee.c(),E=b(),$=m("div"),M=T(`Hostname - `),P=m("input"),F=b(),A=m("div"),I=m("label"),D=m("input"),L=T(" Static IP"),ie=b(),ue&&ue.c(),H=b(),x&&x.c(),K=b(),G=m("div"),G.innerHTML='',Y=b(),re(Q.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),d.__value=1,d.value=d.__value,v.__value=2,v.value=v.__value,r(h,"name","sc"),r(h,"class","in-s"),t[2]===void 0&&Ke(()=>t[5].call(h)),r(c,"class","my-3"),r(P,"name","sh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"maxlength","32"),r(P,"pattern","[a-z0-9_-]+"),r(P,"placeholder","Optional, ex.: ams-reader"),r(P,"autocomplete","off"),r(D,"type","checkbox"),r(D,"name","sm"),D.__value="static",D.value=D.__value,r(D,"class","rounded mb-1"),r(A,"class","my-3"),r(G,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(W,U){C(W,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(c,f),s(c,p),s(c,_),s(c,h),s(h,d),s(h,v),j&&j.m(h,null),Se(h,t[2],!0),s(n,g),ee&&ee.m(n,null),s(n,E),s(n,$),s($,M),s($,P),ne(P,t[0].hostname),s(n,F),s(n,A),s(A,I),s(I,D),D.checked=t[1],s(I,L),s(A,ie),ue&&ue.m(A,null),s(n,H),x&&x.m(n,null),s(n,K),s(n,G),C(W,Y,U),se(Q,W,U),z=!0,Z||(V=[le(h,"change",t[5]),le(P,"input",t[6]),le(D,"change",t[7]),le(n,"submit",Ms(t[4]))],Z=!0)},p(W,[U]){W[0].if&&W[0].if.eth?j||(j=Zf(),j.c(),j.m(h,null)):j&&(j.d(1),j=null),U&4&&Se(h,W[2]),W[2]==1||W[2]==2?ee?ee.p(W,U):(ee=Jf(W),ee.c(),ee.m(n,E)):ee&&(ee.d(1),ee=null),U&1&&P.value!==W[0].hostname&&ne(P,W[0].hostname),U&2&&(D.checked=W[1]),W[1]?ue?(ue.p(W,U),U&2&&O(ue,1)):(ue=xf(W),ue.c(),O(ue,1),ue.m(A,null)):ue&&(Ie(),B(ue,1,1,()=>{ue=null}),Oe()),W[1]?x||(x=ec(),x.c(),x.m(n,K)):x&&(x.d(1),x=null);const ke={};U&8&&(ke.active=W[3]),Q.$set(ke)},i(W){z||(O(ue),O(Q.$$.fragment,W),z=!0)},o(W){B(ue),B(Q.$$.fragment,W),z=!1},d(W){W&&w(e),j&&j.d(),ee&&ee.d(),ue&&ue.d(),x&&x.d(),W&&w(Y),oe(Q,W),Z=!1,Ge(V)}}}function Xp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,a=0;function c(){var d="";a++;var v=function(){setTimeout(c,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){v();return}d="http://"+n.net.ip}else n.hostname&&a%3==1?d="http://"+n.hostname:n.hostname&&a%3==2?d="http://"+n.hostname+".local":d="";console&&console.log("Trying url "+d),Yt.update(E=>(E.trying=d,E));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",v),g.addEventListener("error",v),g.addEventListener("timeout",v),g.addEventListener("load",function(E){window.location.href=d||"/"}),g.open("GET",d+"/is-alive",!0),g.send()}async function f(d){l(3,u=!0);const v=new FormData(d.target),g=new URLSearchParams;for(let M of v){const[P,F]=M;g.append(P,F)}let $=await(await fetch("/save",{method:"POST",body:g})).json();l(3,u=!1),Yt.update(M=>(M.hostname=v.get("sh"),M.usrcfg=$.success,M.booting=$.reboot,i&&(M.net.ip=v.get("si"),M.net.mask=v.get("su"),M.net.gw=v.get("sg"),M.net.dns1=v.get("sd")),setTimeout(c,5e3),M))}function p(){o=nt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function h(){i=this.checked,l(1,i)}return t.$$set=d=>{"sysinfo"in d&&l(0,n=d.sysinfo)},[n,i,o,u,f,p,_,h]}class Zp extends De{constructor(e){super(),Pe(this,e,Xp,Qp,$e,{sysinfo:0})}}function Jp(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$;return v=new jt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=T("Upload "),o=T(t[1]),u=b(),a=m("p"),a.textContent="Select a suitable file and click upload",c=b(),f=m("form"),p=m("input"),_=b(),h=m("div"),h.innerHTML='',d=b(),re(v.$$.fragment),r(a,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(h,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(M,P){C(M,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,a),s(l,c),s(l,f),s(f,p),s(f,_),s(f,h),C(M,d,P),se(v,M,P),g=!0,E||($=le(f,"submit",t[3]),E=!0)},p(M,[P]){(!g||P&2)&&X(o,M[1]),(!g||P&1)&&r(f,"action",M[0]);const F={};P&4&&(F.active=M[2]),v.$set(F)},i(M){g||(O(v.$$.fragment,M),g=!0)},o(M){B(v.$$.fragment,M),g=!1},d(M){M&&w(e),M&&w(d),oe(v,M),E=!1,$()}}}function xp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,u]}class No extends De{constructor(e){super(),Pe(this,e,xp,Jp,$e,{action:0,title:1})}}function e_(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F,A,I,D,L,ie,H,K,G,Y,Q,z;return G=new jt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=m("hr"),a=b(),c=m("div"),f=T("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=b(),h=m("a"),d=T("Read more"),v=m("br"),g=b(),E=m("label"),$=m("input"),P=T(" Yes"),F=m("label"),A=m("input"),D=T(" No"),L=m("br"),ie=b(),H=m("div"),H.innerHTML='',K=b(),re(G.$$.fragment),r(h,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r($,"type","radio"),r($,"name","sf"),$.value=1,$.checked=M=t[0].fwconsent===1,r($,"class","rounded m-2"),$.required=!0,r(A,"type","radio"),r(A,"name","sf"),A.value=2,A.checked=I=t[0].fwconsent===2,r(A,"class","rounded m-2"),A.required=!0,r(c,"class","my-3"),r(H,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,V){C(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(c,f),s(c,p),s(c,_),s(c,h),s(h,d),s(c,v),s(c,g),s(c,E),s(E,$),s(E,P),s(c,F),s(F,A),s(F,D),s(c,L),s(n,ie),s(n,H),C(Z,K,V),se(G,Z,V),Y=!0,Q||(z=le(n,"submit",Ms(t[2])),Q=!0)},p(Z,[V]){(!Y||V&1&&M!==(M=Z[0].fwconsent===1))&&($.checked=M),(!Y||V&1&&I!==(I=Z[0].fwconsent===2))&&(A.checked=I);const j={};V&2&&(j.active=Z[1]),G.$set(j)},i(Z){Y||(O(G.$$.fragment,Z),Y=!0)},o(Z){B(G.$$.fragment,Z),Y=!1},d(Z){Z&&w(e),Z&&w(K),oe(G,Z),Q=!1,z()}}}function t_(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let _ of a){const[h,d]=_;c.append(h,d)}let p=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Yt.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),si("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,o]}class l_ extends De{constructor(e){super(),Pe(this,e,t_,e_,$e,{sysinfo:0})}}function n_(t){let e,l;return e=new Gm({props:{data:t[1],sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function i_(t){let e,l;return e=new Ep({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function s_(t){let e,l;return e=new Hp({props:{sysinfo:t[0],data:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function o_(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function r_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function a_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function u_(t){let e,l;return e=new l_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function f_(t){let e,l;return e=new Zp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function c_(t){let e,l;return e=new Yp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function m_(t){let e,l,n,i,o,u,a,c,f,p,_,h,d,v,g,E,$,M,P,F;return e=new tm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[n_]},$$scope:{ctx:t}}}),o=new Sl({props:{path:"/configuration",$$slots:{default:[i_]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[s_]},$$scope:{ctx:t}}}),f=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[o_]},$$scope:{ctx:t}}}),_=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[r_]},$$scope:{ctx:t}}}),d=new Sl({props:{path:"/mqtt-key",$$slots:{default:[a_]},$$scope:{ctx:t}}}),g=new Sl({props:{path:"/consent",$$slots:{default:[u_]},$$scope:{ctx:t}}}),$=new Sl({props:{path:"/setup",$$slots:{default:[f_]},$$scope:{ctx:t}}}),P=new Sl({props:{path:"/vendor",$$slots:{default:[c_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment),l=b(),re(n.$$.fragment),i=b(),re(o.$$.fragment),u=b(),re(a.$$.fragment),c=b(),re(f.$$.fragment),p=b(),re(_.$$.fragment),h=b(),re(d.$$.fragment),v=b(),re(g.$$.fragment),E=b(),re($.$$.fragment),M=b(),re(P.$$.fragment)},m(A,I){se(e,A,I),C(A,l,I),se(n,A,I),C(A,i,I),se(o,A,I),C(A,u,I),se(a,A,I),C(A,c,I),se(f,A,I),C(A,p,I),se(_,A,I),C(A,h,I),se(d,A,I),C(A,v,I),se(g,A,I),C(A,E,I),se($,A,I),C(A,M,I),se(P,A,I),F=!0},p(A,I){const D={};I&2&&(D.data=A[1]),e.$set(D);const L={};I&7&&(L.$$scope={dirty:I,ctx:A}),n.$set(L);const ie={};I&5&&(ie.$$scope={dirty:I,ctx:A}),o.$set(ie);const H={};I&7&&(H.$$scope={dirty:I,ctx:A}),a.$set(H);const K={};I&4&&(K.$$scope={dirty:I,ctx:A}),f.$set(K);const G={};I&4&&(G.$$scope={dirty:I,ctx:A}),_.$set(G);const Y={};I&4&&(Y.$$scope={dirty:I,ctx:A}),d.$set(Y);const Q={};I&5&&(Q.$$scope={dirty:I,ctx:A}),g.$set(Q);const z={};I&5&&(z.$$scope={dirty:I,ctx:A}),$.$set(z);const Z={};I&5&&(Z.$$scope={dirty:I,ctx:A}),P.$set(Z)},i(A){F||(O(e.$$.fragment,A),O(n.$$.fragment,A),O(o.$$.fragment,A),O(a.$$.fragment,A),O(f.$$.fragment,A),O(_.$$.fragment,A),O(d.$$.fragment,A),O(g.$$.fragment,A),O($.$$.fragment,A),O(P.$$.fragment,A),F=!0)},o(A){B(e.$$.fragment,A),B(n.$$.fragment,A),B(o.$$.fragment,A),B(a.$$.fragment,A),B(f.$$.fragment,A),B(_.$$.fragment,A),B(d.$$.fragment,A),B(g.$$.fragment,A),B($.$$.fragment,A),B(P.$$.fragment,A),F=!1},d(A){oe(e,A),A&&w(l),oe(n,A),A&&w(i),oe(o,A),A&&w(u),oe(a,A),A&&w(c),oe(f,A),A&&w(p),oe(_,A),A&&w(h),oe(d,A),A&&w(v),oe(g,A),A&&w(E),oe($,A),A&&w(M),oe(P,A)}}}function p_(t){let e,l,n,i;const o=[v_,d_],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(c,f){u[e].m(c,f),C(c,n,f),i=!0},p(c,f){let p=e;e=a(c),e===p?u[e].p(c,f):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Oe(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),O(l,1),l.m(n.parentNode,n))},i(c){i||(O(l),i=!0)},o(c){B(l),i=!1},d(c){u[e].d(c),c&&w(n)}}}function __(t){let e,l;return e=new jt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function d_(t){let e,l;return e=new jt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function v_(t){let e,l;return e=new jt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function h_(t){let e,l,n,i,o,u,a;n=new Ec({props:{$$slots:{default:[m_]},$$scope:{ctx:t}}});const c=[__,p_],f=[];function p(_,h){return _[0].upgrading?0:_[0].booting?1:-1}return~(o=p(t))&&(u=f[o]=c[o](t)),{c(){e=T(`/** - * @copyright Utilitech AS 2023 - * License: Fair Source - * - */ - - - -`),l=m("div"),re(n.$$.fragment),i=b(),u&&u.c(),r(l,"class","container mx-auto m-3")},m(_,h){C(_,e,h),C(_,l,h),se(n,l,null),s(l,i),~o&&f[o].m(l,null),a=!0},p(_,[h]){const d={};h&7&&(d.$$scope={dirty:h,ctx:_}),n.$set(d);let v=o;o=p(_),o===v?~o&&f[o].p(_,h):(u&&(Ie(),B(f[v],1,1,()=>{f[v]=null}),Oe()),~o?(u=f[o],u?u.p(_,h):(u=f[o]=c[o](_),u.c()),O(u,1),u.m(l,null)):u=null)},i(_){a||(O(n.$$.fragment,_),O(u),a=!0)},o(_){B(n.$$.fragment,_),B(u),a=!1},d(_){_&&w(e),_&&w(l),oe(n),~o&&f[o].d()}}}function b_(t,e,l){let n={};Yt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?si("/vendor"):n.usrcfg===!1?si("/setup"):n.fwconsent===0&&si("/consent"),n.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):n.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let i={};return Lc.subscribe(o=>{l(1,i=o)}),[n,i]}class g_ extends De{constructor(e){super(),Pe(this,e,b_,h_,$e,{})}}new g_({target:document.getElementById("app")}); +
`,r(e,"class","my-3 flex")},m(l,n){C(l,e,n)},d(l){l&&y(e)}}}function Qp(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z,Z,V,j=t[0].if&&t[0].if.eth&&Zf(),ee=(t[2]==1||t[2]==2)&&Jf(t),ue=t[1]&&xf(t),x=t[1]&&ec();return Q=new jt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=b(),u=m("strong"),u.textContent="Setup",a=b(),f=m("div"),c=S("Connection"),p=m("br"),_=b(),h=m("select"),d=m("option"),d.textContent="Connect to WiFi",v=m("option"),v.textContent="Standalone access point",j&&j.c(),g=b(),ee&&ee.c(),A=b(),$=m("div"),M=S(`Hostname + `),P=m("input"),F=b(),E=m("div"),I=m("label"),D=m("input"),L=S(" Static IP"),ie=b(),ue&&ue.c(),H=b(),x&&x.c(),K=b(),G=m("div"),G.innerHTML='',Y=b(),re(Q.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),d.__value=1,d.value=d.__value,v.__value=2,v.value=v.__value,r(h,"name","sc"),r(h,"class","in-s"),t[2]===void 0&&Ke(()=>t[5].call(h)),r(f,"class","my-3"),r(P,"name","sh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"maxlength","32"),r(P,"pattern","[a-z0-9_-]+"),r(P,"placeholder","Optional, ex.: ams-reader"),r(P,"autocomplete","off"),r(D,"type","checkbox"),r(D,"name","sm"),D.__value="static",D.value=D.__value,r(D,"class","rounded mb-1"),r(E,"class","my-3"),r(G,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(W,U){C(W,e,U),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,h),s(h,d),s(h,v),j&&j.m(h,null),Te(h,t[2],!0),s(n,g),ee&&ee.m(n,null),s(n,A),s(n,$),s($,M),s($,P),ne(P,t[0].hostname),s(n,F),s(n,E),s(E,I),s(I,D),D.checked=t[1],s(I,L),s(E,ie),ue&&ue.m(E,null),s(n,H),x&&x.m(n,null),s(n,K),s(n,G),C(W,Y,U),se(Q,W,U),z=!0,Z||(V=[le(h,"change",t[5]),le(P,"input",t[6]),le(D,"change",t[7]),le(n,"submit",Ms(t[4]))],Z=!0)},p(W,[U]){W[0].if&&W[0].if.eth?j||(j=Zf(),j.c(),j.m(h,null)):j&&(j.d(1),j=null),U&4&&Te(h,W[2]),W[2]==1||W[2]==2?ee?ee.p(W,U):(ee=Jf(W),ee.c(),ee.m(n,A)):ee&&(ee.d(1),ee=null),U&1&&P.value!==W[0].hostname&&ne(P,W[0].hostname),U&2&&(D.checked=W[1]),W[1]?ue?(ue.p(W,U),U&2&&O(ue,1)):(ue=xf(W),ue.c(),O(ue,1),ue.m(E,null)):ue&&(Ie(),B(ue,1,1,()=>{ue=null}),Oe()),W[1]?x||(x=ec(),x.c(),x.m(n,K)):x&&(x.d(1),x=null);const ke={};U&8&&(ke.active=W[3]),Q.$set(ke)},i(W){z||(O(ue),O(Q.$$.fragment,W),z=!0)},o(W){B(ue),B(Q.$$.fragment,W),z=!1},d(W){W&&y(e),j&&j.d(),ee&&ee.d(),ue&&ue.d(),x&&x.d(),W&&y(Y),oe(Q,W),Z=!1,Ge(V)}}}function Xp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,a=0;function f(){var d="";a++;var v=function(){setTimeout(f,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){v();return}d="http://"+n.net.ip}else n.hostname&&a%3==1?d="http://"+n.hostname:n.hostname&&a%3==2?d="http://"+n.hostname+".local":d="";console&&console.log("Trying url "+d),Yt.update(A=>(A.trying=d,A));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",v),g.addEventListener("error",v),g.addEventListener("timeout",v),g.addEventListener("load",function(A){window.location.href=d||"/"}),g.open("GET",d+"/is-alive",!0),g.send()}async function c(d){l(3,u=!0);const v=new FormData(d.target),g=new URLSearchParams;for(let M of v){const[P,F]=M;g.append(P,F)}let $=await(await fetch("/save",{method:"POST",body:g})).json();l(3,u=!1),Yt.update(M=>(M.hostname=v.get("sh"),M.usrcfg=$.success,M.booting=$.reboot,i&&(M.net.ip=v.get("si"),M.net.mask=v.get("su"),M.net.gw=v.get("sg"),M.net.dns1=v.get("sd")),setTimeout(f,5e3),M))}function p(){o=nt(this),l(2,o)}function _(){n.hostname=this.value,l(0,n)}function h(){i=this.checked,l(1,i)}return t.$$set=d=>{"sysinfo"in d&&l(0,n=d.sysinfo)},[n,i,o,u,c,p,_,h]}class Zp extends De{constructor(e){super(),Pe(this,e,Xp,Qp,$e,{sysinfo:0})}}function Jp(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$;return v=new jt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=S("Upload "),o=S(t[1]),u=b(),a=m("p"),a.textContent="Select a suitable file and click upload",f=b(),c=m("form"),p=m("input"),_=b(),h=m("div"),h.innerHTML='',d=b(),re(v.$$.fragment),r(a,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(h,"class","w-full text-right mt-4"),r(c,"action",t[0]),r(c,"enctype","multipart/form-data"),r(c,"method","post"),r(c,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(M,P){C(M,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,h),C(M,d,P),se(v,M,P),g=!0,A||($=le(c,"submit",t[3]),A=!0)},p(M,[P]){(!g||P&2)&&X(o,M[1]),(!g||P&1)&&r(c,"action",M[0]);const F={};P&4&&(F.active=M[2]),v.$set(F)},i(M){g||(O(v.$$.fragment,M),g=!0)},o(M){B(v.$$.fragment,M),g=!1},d(M){M&&y(e),M&&y(d),oe(v,M),A=!1,$()}}}function xp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,u]}class No extends De{constructor(e){super(),Pe(this,e,xp,Jp,$e,{action:0,title:1})}}function e_(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F,E,I,D,L,ie,H,K,G,Y,Q,z;return G=new jt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=m("hr"),a=b(),f=m("div"),c=S("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=b(),h=m("a"),d=S("Read more"),v=m("br"),g=b(),A=m("label"),$=m("input"),P=S(" Yes"),F=m("label"),E=m("input"),D=S(" No"),L=m("br"),ie=b(),H=m("div"),H.innerHTML='',K=b(),re(G.$$.fragment),r(h,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),r(h,"target","_blank"),r(h,"class","text-blue-600 hover:text-blue-800"),r($,"type","radio"),r($,"name","sf"),$.value=1,$.checked=M=t[0].fwconsent===1,r($,"class","rounded m-2"),$.required=!0,r(E,"type","radio"),r(E,"name","sf"),E.value=2,E.checked=I=t[0].fwconsent===2,r(E,"class","rounded m-2"),E.required=!0,r(f,"class","my-3"),r(H,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,V){C(Z,e,V),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,h),s(h,d),s(f,v),s(f,g),s(f,A),s(A,$),s(A,P),s(f,F),s(F,E),s(F,D),s(f,L),s(n,ie),s(n,H),C(Z,K,V),se(G,Z,V),Y=!0,Q||(z=le(n,"submit",Ms(t[2])),Q=!0)},p(Z,[V]){(!Y||V&1&&M!==(M=Z[0].fwconsent===1))&&($.checked=M),(!Y||V&1&&I!==(I=Z[0].fwconsent===2))&&(E.checked=I);const j={};V&2&&(j.active=Z[1]),G.$set(j)},i(Z){Y||(O(G.$$.fragment,Z),Y=!0)},o(Z){B(G.$$.fragment,Z),Y=!1},d(Z){Z&&y(e),Z&&y(K),oe(G,Z),Q=!1,z()}}}function t_(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(u){l(1,i=!0);const a=new FormData(u.target),f=new URLSearchParams;for(let _ of a){const[h,d]=_;f.append(h,d)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),Yt.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),si("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,o]}class l_ extends De{constructor(e){super(),Pe(this,e,t_,e_,$e,{sysinfo:0})}}function n_(t){let e,l;return e=new Gm({props:{data:t[1],sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function i_(t){let e,l;return e=new Ap({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function s_(t){let e,l;return e=new Hp({props:{sysinfo:t[0],data:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function o_(t){let e,l;return e=new No({props:{title:"CA",action:"/mqtt-ca"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function r_(t){let e,l;return e=new No({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function a_(t){let e,l;return e=new No({props:{title:"private key",action:"/mqtt-key"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function u_(t){let e,l;return e=new l_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function f_(t){let e,l;return e=new Zp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function c_(t){let e,l;return e=new Yp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function m_(t){let e,l,n,i,o,u,a,f,c,p,_,h,d,v,g,A,$,M,P,F;return e=new tm({props:{data:t[1]}}),n=new Tl({props:{path:"/",$$slots:{default:[n_]},$$scope:{ctx:t}}}),o=new Tl({props:{path:"/configuration",$$slots:{default:[i_]},$$scope:{ctx:t}}}),a=new Tl({props:{path:"/status",$$slots:{default:[s_]},$$scope:{ctx:t}}}),c=new Tl({props:{path:"/mqtt-ca",$$slots:{default:[o_]},$$scope:{ctx:t}}}),_=new Tl({props:{path:"/mqtt-cert",$$slots:{default:[r_]},$$scope:{ctx:t}}}),d=new Tl({props:{path:"/mqtt-key",$$slots:{default:[a_]},$$scope:{ctx:t}}}),g=new Tl({props:{path:"/consent",$$slots:{default:[u_]},$$scope:{ctx:t}}}),$=new Tl({props:{path:"/setup",$$slots:{default:[f_]},$$scope:{ctx:t}}}),P=new Tl({props:{path:"/vendor",$$slots:{default:[c_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment),l=b(),re(n.$$.fragment),i=b(),re(o.$$.fragment),u=b(),re(a.$$.fragment),f=b(),re(c.$$.fragment),p=b(),re(_.$$.fragment),h=b(),re(d.$$.fragment),v=b(),re(g.$$.fragment),A=b(),re($.$$.fragment),M=b(),re(P.$$.fragment)},m(E,I){se(e,E,I),C(E,l,I),se(n,E,I),C(E,i,I),se(o,E,I),C(E,u,I),se(a,E,I),C(E,f,I),se(c,E,I),C(E,p,I),se(_,E,I),C(E,h,I),se(d,E,I),C(E,v,I),se(g,E,I),C(E,A,I),se($,E,I),C(E,M,I),se(P,E,I),F=!0},p(E,I){const D={};I&2&&(D.data=E[1]),e.$set(D);const L={};I&7&&(L.$$scope={dirty:I,ctx:E}),n.$set(L);const ie={};I&5&&(ie.$$scope={dirty:I,ctx:E}),o.$set(ie);const H={};I&7&&(H.$$scope={dirty:I,ctx:E}),a.$set(H);const K={};I&4&&(K.$$scope={dirty:I,ctx:E}),c.$set(K);const G={};I&4&&(G.$$scope={dirty:I,ctx:E}),_.$set(G);const Y={};I&4&&(Y.$$scope={dirty:I,ctx:E}),d.$set(Y);const Q={};I&5&&(Q.$$scope={dirty:I,ctx:E}),g.$set(Q);const z={};I&5&&(z.$$scope={dirty:I,ctx:E}),$.$set(z);const Z={};I&5&&(Z.$$scope={dirty:I,ctx:E}),P.$set(Z)},i(E){F||(O(e.$$.fragment,E),O(n.$$.fragment,E),O(o.$$.fragment,E),O(a.$$.fragment,E),O(c.$$.fragment,E),O(_.$$.fragment,E),O(d.$$.fragment,E),O(g.$$.fragment,E),O($.$$.fragment,E),O(P.$$.fragment,E),F=!0)},o(E){B(e.$$.fragment,E),B(n.$$.fragment,E),B(o.$$.fragment,E),B(a.$$.fragment,E),B(c.$$.fragment,E),B(_.$$.fragment,E),B(d.$$.fragment,E),B(g.$$.fragment,E),B($.$$.fragment,E),B(P.$$.fragment,E),F=!1},d(E){oe(e,E),E&&y(l),oe(n,E),E&&y(i),oe(o,E),E&&y(u),oe(a,E),E&&y(f),oe(c,E),E&&y(p),oe(_,E),E&&y(h),oe(d,E),E&&y(v),oe(g,E),E&&y(A),oe($,E),E&&y(M),oe(P,E)}}}function p_(t){let e,l,n,i;const o=[v_,d_],u=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ve()},m(f,c){u[e].m(f,c),C(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?u[e].p(f,c):(Ie(),B(u[p],1,1,()=>{u[p]=null}),Oe(),l=u[e],l?l.p(f,c):(l=u[e]=o[e](f),l.c()),O(l,1),l.m(n.parentNode,n))},i(f){i||(O(l),i=!0)},o(f){B(l),i=!1},d(f){u[e].d(f),f&&y(n)}}}function __(t){let e,l;return e=new jt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function d_(t){let e,l;return e=new jt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p:_e,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function v_(t){let e,l;return e=new jt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){re(e.$$.fragment)},m(n,i){se(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){B(e.$$.fragment,n),l=!1},d(n){oe(e,n)}}}function h_(t){let e,l,n,i,o,u;l=new Ac({props:{$$slots:{default:[m_]},$$scope:{ctx:t}}});const a=[__,p_],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),re(l.$$.fragment),n=b(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){C(p,e,_),se(l,e,null),s(e,n),~i&&f[i].m(e,null),u=!0},p(p,[_]){const h={};_&7&&(h.$$scope={dirty:_,ctx:p}),l.$set(h);let d=i;i=c(p),i===d?~i&&f[i].p(p,_):(o&&(Ie(),B(f[d],1,1,()=>{f[d]=null}),Oe()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),O(o,1),o.m(e,null)):o=null)},i(p){u||(O(l.$$.fragment,p),O(o),u=!0)},o(p){B(l.$$.fragment,p),B(o),u=!1},d(p){p&&y(e),oe(l),~i&&f[i].d()}}}function b_(t,e,l){let n={};Yt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?si("/vendor"):n.usrcfg===!1?si("/setup"):n.fwconsent===0&&si("/consent"),n.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):n.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),yo();let i={};return Lc.subscribe(o=>{l(1,i=o)}),[n,i]}class g_ extends De{constructor(e){super(),Pe(this,e,b_,h_,$e,{})}}new g_({target:document.getElementById("app")}); diff --git a/lib/SvelteUi/app/src/App.svelte b/lib/SvelteUi/app/src/App.svelte index b74b0c83..e4bf4cda 100644 --- a/lib/SvelteUi/app/src/App.svelte +++ b/lib/SvelteUi/app/src/App.svelte @@ -1,9 +1,3 @@ -/** - * @copyright Utilitech AS 2023 - * License: Fair Source - * - */ -