Files
UtilitechAS.amsreader-firmware/lib/SvelteUi/app/dist/index.js
2023-09-10 20:51:21 +02:00

15 lines
179 KiB
JavaScript

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ne(){}function Jt(t,e){for(const l in e)t[l]=e[l];return t}function Gf(t){return t()}function Mr(){return Object.create(null)}function Ke(t){t.forEach(Gf)}function io(t){return typeof t=="function"}function $e(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let as;function qc(t,e){return as||(as=document.createElement("a")),as.href=e,t===as.href}function Hc(t){return Object.keys(t).length===0}function so(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function si(t){let e;return so(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(so(e,l))}function oo(t,e,l,n){if(t){const i=Bf(t,e,l,n);return t[0](i)}}function Bf(t,e,l,n){return t[1]&&n?Jt(l.ctx.slice(),t[1](n(e))):l.ctx}function uo(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a<r;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function ro(t,e,l,n,i,o){if(i){const r=Bf(e,l,n,o);t.p(r,i)}}function ao(t){if(t.ctx.length>32){const e=[],l=t.ctx.length/32;for(let n=0;n<l;n++)e[n]=-1;return e}return-1}function _s(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function ds(t,e){const l={};e=new Set(e);for(const n in t)!e.has(n)&&n[0]!=="$"&&(l[n]=t[n]);return l}const jc=["",!0,1,"true","contenteditable"];function s(t,e){t.appendChild(e)}function w(t,e,l){t.insertBefore(e,l||null)}function k(t){t.parentNode&&t.parentNode.removeChild(t)}function fl(t,e){for(let l=0;l<t.length;l+=1)t[l]&&t[l].d(e)}function m(t){return document.createElement(t)}function He(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function y(t){return document.createTextNode(t)}function h(){return y(" ")}function Ge(){return y("")}function K(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function ks(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const Wc=["width","height"];function oi(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set&&Wc.indexOf(n)===-1?t[n]=e[n]:u(t,n,e[n])}function fe(t){return t===""?null:+t}function Gc(t){return Array.from(t.childNodes)}function G(t,e){e=""+e,t.data!==e&&(t.data=e)}function Bc(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function zc(t,e,l){~jc.indexOf(l)?Bc(t,e):G(t,e)}function V(t,e){t.value=e==null?"":e}function zf(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Ue(t,e,l){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e){i.selected=!0;return}}(!l||e!==void 0)&&(t.selectedIndex=-1)}function _t(t){const e=t.querySelector(":checked");return e&&e.__value}let fs;function Yc(){if(fs===void 0){fs=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{fs=!0}}return fs}function Vc(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const n=m("iframe");n.setAttribute("style","display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;"),n.setAttribute("aria-hidden","true"),n.tabIndex=-1;const i=Yc();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=K(window,"message",r=>{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),k(n)}}function Kc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Nr(t,e){return new t(e)}let yi;function ki(t){yi=t}function Ci(){if(!yi)throw new Error("Function called outside component initialization");return yi}function Qc(t){Ci().$$.on_mount.push(t)}function Xc(t){Ci().$$.on_destroy.push(t)}function Zc(){const t=Ci();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Kc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Ci().$$.context.set(t,e),e}function Rl(t){return Ci().$$.context.get(t)}const ti=[],vs=[];let li=[];const Pr=[],Yf=Promise.resolve();let Ys=!1;function Vf(){Ys||(Ys=!0,Yf.then(Kf))}function Jc(){return Vf(),Yf}function tt(t){li.push(t)}const Hs=new Set;let xn=0;function Kf(){if(xn!==0)return;const t=yi;do{try{for(;xn<ti.length;){const e=ti[xn];xn++,ki(e),xc(e.$$)}}catch(e){throw ti.length=0,xn=0,e}for(ki(null),ti.length=0,xn=0;vs.length;)vs.pop()();for(let e=0;e<li.length;e+=1){const l=li[e];Hs.has(l)||(Hs.add(l),l())}li.length=0}while(ti.length);for(;Pr.length;)Pr.pop()();Ys=!1,Hs.clear(),ki(t)}function xc(t){if(t.fragment!==null){t.update(),Ke(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(tt)}}function e1(t){const e=[],l=[];li.forEach(n=>t.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),li=e}const ps=new Set;let tn;function Ae(){tn={r:0,c:[],p:tn}}function De(){tn.r||Ke(tn.c),tn=tn.p}function N(t,e){t&&t.i&&(ps.delete(t),t.i(e))}function D(t,e,l,n){if(t&&t.o){if(ps.has(t))return;ps.add(t),tn.c.push(()=>{ps.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function Qf(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Ar(t){return typeof t=="object"&&t!==null?t:{}}function Z(t){t&&t.c()}function Q(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||tt(()=>{const r=t.$$.on_mount.map(Gf).filter(io);t.$$.on_destroy?t.$$.on_destroy.push(...r):Ke(r),t.$$.on_mount=[]}),o.forEach(tt)}function X(t,e){const l=t.$$;l.fragment!==null&&(e1(l.after_update),Ke(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function t1(t,e){t.$$.dirty[0]===-1&&(ti.push(t),Vf(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Se(t,e,l,n,i,o,r,a=[-1]){const f=yi;ki(t);const c=t.$$={fragment:null,ctx:[],props:o,update:ne,not_equal:i,bound:Mr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:Mr(),dirty:a,skip_bound:!1,root:e.target||f.$$.root};r&&r(c.root);let p=!1;if(c.ctx=l?l(t,e.props||{},(_,b,...d)=>{const v=d.length?d[0]:b;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&t1(t,_)),b}):[],c.update(),p=!0,Ke(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Gc(e.target);c.fragment&&c.fragment.l(_),_.forEach(k)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),Q(t,e.target,e.anchor,e.customElement),Kf()}ki(f)}class Me{$destroy(){X(this,1),this.$destroy=ne}$on(e,l){if(!io(l))return ne;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Hc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Dr=t=>typeof t>"u",Xf=t=>typeof t=="function",Zf=t=>typeof t=="number";function l1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function Jf(){let t=0;return()=>t++}function n1(){return Math.random().toString(36).substring(2)}const Ll=typeof window>"u";function xf(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const ec=(t,e)=>t?{}:{style:e},Vs=t=>({"aria-hidden":"true",...ec(t,"display:none;")}),ei=[];function tc(t,e){return{subscribe:ut(t,e).subscribe}}function ut(t,e=ne){let l;const n=new Set;function i(a){if($e(t,a)&&(t=a,l)){const f=!ei.length;for(const c of n)c[1](),ei.push(c,t);if(f){for(let c=0;c<ei.length;c+=2)ei[c][0](ei[c+1]);ei.length=0}}}function o(a){i(a(t))}function r(a,f=ne){const c=[a,f];return n.add(c),n.size===1&&(l=e(i)||ne),a(t),()=>{n.delete(c),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function i1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return tc(l,r=>{let a=!1;const f=[];let c=0,p=ne;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,r);o?r(d):p=io(d)?d:ne},b=i.map((d,v)=>so(d,g=>{f[v]=g,c&=~(1<<v),a&&_()},()=>{c|=1<<v}));return a=!0,_(),function(){Ke(b),p(),a=!1}})}const $i=t=>`@@svnav-ctx__${t}`,Ks=$i("LOCATION"),ui=$i("ROUTER"),lc=$i("ROUTE"),s1=$i("ROUTE_PARAMS"),o1=$i("FOCUS_ELEM"),nc=/^:(.+)/,gi=(t,e,l)=>t.substr(e,l),Qs=(t,e)=>gi(t,0,e.length)===e,u1=t=>t==="",r1=t=>nc.test(t),ic=t=>t[0]==="*",a1=t=>t.replace(/\*.*$/,""),sc=t=>t.replace(/(^\/+|\/+$)/g,"");function cl(t,e=!1){const l=sc(t).split("/");return e?l.filter(Boolean):l}const js=(t,e)=>t+(e?`?${e}`:""),fo=t=>`/${sc(t)}`;function Ti(...t){const e=n=>cl(n,!0).join("/"),l=t.map(e).join("/");return fo(l)}const co=1,ws=2,on=3,f1=4,oc=5,c1=6,uc=7,m1=8,p1=9,rc=10,ac=11,_1={[co]:"Link",[ws]:"Route",[on]:"Router",[f1]:"useFocus",[oc]:"useLocation",[c1]:"useMatch",[uc]:"useNavigate",[m1]:"useParams",[p1]:"useResolvable",[rc]:"useResolve",[ac]:"navigate"},mo=t=>_1[t];function d1(t,e){let l;return t===ws?l=e.path?`path="${e.path}"`:"default":t===co?l=`to="${e.to}"`:t===on&&(l=`basepath="${e.basepath||""}"`),`<${mo(t)} ${l||""} />`}function v1(t,e,l,n){const i=l&&d1(n||t,l),o=i?`
Occurred in: ${i}`:"",r=mo(t),a=Xf(e)?e(r):e;return`<${r}> ${a}${o}`}const fc=t=>(...e)=>t(v1(...e)),cc=fc(t=>{throw new Error(t)}),hs=fc(console.warn),Er=4,h1=3,b1=2,g1=1,k1=1;function w1(t,e){const l=t.default?0:cl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Er,u1(i)?o+=k1:r1(i)?o+=b1:ic(i)?o-=Er+g1:o+=h1,o},0);return{route:t,score:l,index:e}}function y1(t){return t.map(w1).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function mc(t,e){let l,n;const[i]=e.split("?"),o=cl(i),r=o[0]==="",a=y1(t);for(let f=0,c=a.length;f<c;f++){const{route:p}=a[f];let _=!1;const b={},d=C=>({...p,params:b,uri:C});if(p.default){n=d(e);continue}const v=cl(p.fullPath),g=Math.max(o.length,v.length);let T=0;for(;T<g;T++){const C=v[T],$=o[T];if(!Dr(C)&&ic(C)){const E=C==="*"?"*":C.slice(1);b[E]=o.slice(T).map(decodeURIComponent).join("/");break}if(Dr($)){_=!0;break}const M=nc.exec(C);if(M&&!r){const E=decodeURIComponent($);b[M[1]]=E}else if(C!==$){_=!0;break}}if(!_){l=d(Ti(...o.slice(0,T)));break}}return l||n||null}function pc(t,e){return mc([t],e)}function C1(t,e){if(Qs(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=cl(l),r=cl(i);if(o[0]==="")return js(i,n);if(!Qs(o[0],".")){const c=r.concat(o).join("/");return js((i==="/"?"":"/")+c,n)}const a=r.concat(o),f=[];return a.forEach(c=>{c===".."?f.pop():c!=="."&&f.push(c)}),js(`/${f.join("/")}`,n)}function Ir(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=cl(e,!0),a=cl(l,!0);for(;r.length;)r[0]!==a[0]&&cc(on,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Ti(...a),hash:n,search:i,state:o}}const Fr=t=>t.length===1?"":t,po=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Fr(gi(t,l)):"",r=i?gi(t,0,l):t,a=n?Fr(gi(r,e)):"";return{pathname:(n?gi(r,0,e):r)||"/",search:a,hash:o}},$1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function T1(t,e,l){return Ti(l,C1(t,e))}function S1(t,e){const l=fo(a1(t)),n=cl(l,!0),i=cl(e,!0).slice(0,n.length),o=pc({fullPath:l},Ti(...i));return o&&o.uri}const Ws="POP",M1="PUSH",N1="REPLACE";function Gs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function P1(t){let e=[],l=Gs(t),n=Ws;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Gs(t),n=Ws,i([o])};i([o]);const a=xf(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?N1:M1,Zf(o))r&&hs(ac,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Ws,t.history.go(o);else{const c={...a,_key:n1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Gs(t),i()}}}function Bs(t,e){return{...po(e),state:t}}function A1(t="/"){let e=0,l=[Bs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Bs(n,o))},replaceState(n,i,o){l[e]=Bs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const D1=!!(!Ll&&window.document&&window.document.createElement),E1=!Ll&&window.location.origin==="null",_c=P1(D1&&!E1?window:A1()),{navigate:ni}=_c;let Tl=null,dc=!0;function I1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n<l.length;n++){const i=l[n],o=Number(i.dataset.svnavRouter);if(o===t)return!0;if(o===e)return!1}return!1}function F1(t){(!Tl||t.level>Tl.level||t.level===Tl.level&&I1(t.routerId,Tl.routerId))&&(Tl=t)}function R1(){Tl=null}function L1(){dc=!1}function Rr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=xf(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function U1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function O1(t){return/^H[1-6]$/i.test(t.tagName)}function Lr(t,e=document){return e.querySelector(t)}function q1(t){let l=Lr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!U1(l,t);){if(O1(l))return l;const n=Lr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function H1(t){Promise.resolve(si(t.focusElement)).then(e=>{const l=e||q1(t.id);l||hs(on,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,ws),!Rr(l)&&Rr(document.documentElement)})}const j1=(t,e,l)=>(n,i)=>Jc().then(()=>{if(!Tl||dc){L1();return}if(n&&H1(Tl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Tl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},si(l));Promise.resolve(p).then(_=>{e.set(_)})}R1()}),W1="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function G1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},ec(t[6],W1)],i={};for(let o=0;o<n.length;o+=1)i=Jt(i,n[o]);return{c(){e=m("div"),l=y(t[0]),oi(e,i)},m(o,r){w(o,e,r),s(e,l)},p(o,r){r[0]&1&&zc(l,o[0],i.contenteditable)},d(o){o&&k(e)}}}function B1(t){let e,l,n,i,o,r=[Vs(t[6]),{"data-svnav-router":t[3]}],a={};for(let _=0;_<r.length;_+=1)a=Jt(a,r[_]);const f=t[22].default,c=oo(f,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&G1(t);return{c(){e=m("div"),l=h(),c&&c.c(),n=h(),p&&p.c(),i=Ge(),oi(e,a)},m(_,b){w(_,e,b),w(_,l,b),c&&c.m(_,b),w(_,n,b),p&&p.m(_,b),w(_,i,b),o=!0},p(_,b){c&&c.p&&(!o||b[0]&2097152)&&ro(c,f,_,_[21],o?uo(f,_[21],b,null):ao(_[21]),null),_[2]&&_[4]&&_[1].announcements&&p.p(_,b)},i(_){o||(N(c,_),o=!0)},o(_){D(c,_),o=!1},d(_){_&&k(e),_&&k(l),c&&c.d(_),_&&k(n),p&&p.d(_),_&&k(i)}}}const z1=Jf(),Ur="/";function Y1(t,e,l){let n,i,o,r,a,{$$slots:f={},$$scope:c}=e,{basepath:p=Ur}=e,{url:_=null}=e,{history:b=_c}=e,{primary:d=!0}=e,{a11y:v={}}=e,{disableInlineStyles:g=!1}=e;const T={createAnnouncement:le=>`Navigated to ${le.uri}`,announcements:!0,...v},C=p,$=fo(p),M=Rl(Ks),E=Rl(ui),S=!M,A=z1(),I=d&&!(E&&!E.manageFocus),F=ut("");ul(t,F,le=>l(0,a=le));const Y=E?E.disableInlineStyles:g,U=ut([]);ul(t,U,le=>l(20,r=le));const H=ut(null);ul(t,H,le=>l(18,i=le));let q=!1;const z=S?0:E.level+1,R=S?ut((()=>Ir(Ll?po(_):b.location,$))()):M;ul(t,R,le=>l(17,n=le));const B=ut(n);ul(t,B,le=>l(19,o=le));const L=j1(T,F,R),j=le=>pe=>pe.filter(ie=>ie.id!==le);function W(le){if(Ll){if(q)return;const pe=pc(le,n.pathname);if(pe)return q=!0,pe}else U.update(pe=>{const ie=j(le.id)(pe);return ie.push(le),ie})}function ee(le){U.update(j(le))}return!S&&p!==Ur&&hs(on,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(Qc(()=>b.listen(pe=>{const ie=Ir(pe.location,$);B.set(n),R.set(ie)})),wi(Ks,R)),wi(ui,{activeRoute:H,registerRoute:W,unregisterRoute:ee,manageFocus:I,level:z,id:A,history:S?b:E.history,basepath:S?$:E.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==C&&hs(on,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=mc(r,n.pathname);H.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,pe=!le&&I,ie=!le||n.pathname!==o.pathname;L(pe,ie)}t.$$.dirty[0]&262144&&I&&i&&i.primary&&F1({level:z,routerId:A,route:i})},[a,T,S,A,I,F,Y,U,H,R,B,p,_,b,d,v,g,n,i,o,r,c,f]}class V1 extends Me{constructor(e){super(),Se(this,e,Y1,B1,$e,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const vc=V1;function Si(t,e,l=ui,n=on){Rl(l)||cc(t,o=>`You cannot use ${o} outside of a ${mo(n)}.`,e)}const K1=t=>{const{subscribe:e}=Rl(t);return{subscribe:e}};function hc(){return Si(oc),K1(Ks)}function bc(){const{history:t}=Rl(ui);return t}function gc(){const t=Rl(lc);return t?i1(t,e=>e.base):ut("/")}function kc(){Si(rc);const t=gc(),{basepath:e}=Rl(ui);return n=>T1(n,si(t),e)}function Q1(){Si(uc);const t=kc(),{navigate:e}=bc();return(n,i)=>{const o=Zf(n)?n:t(n);return e(o,i)}}const X1=t=>({params:t&16,location:t&8}),Or=t=>({params:Ll?si(t[10]):t[4],location:t[3],navigate:t[11]});function qr(t){let e,l;return e=new vc({props:{primary:t[1],$$slots:{default:[x1]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Z1(t){let e;const l=t[18].default,n=oo(l,t,t[19],Or);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&ro(n,l,i,i[19],e?uo(l,i[19],o,X1):ao(i[19]),Or)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function J1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ll?si(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c<i.length;c+=1)f=Jt(f,i[c]);return{props:f}}return o&&(e=Nr(o,r())),{c(){e&&Z(e.$$.fragment),l=Ge()},m(a,f){e&&Q(e,a,f),w(a,l,f),n=!0},p(a,f){const c=f&7192?Qf(i,[f&8&&{location:a[3]},f&2048&&{navigate:a[11]},f&1040&&Ar(Ll?si(a[10]):a[4]),f&4096&&Ar(a[12])]):{};if(f&1&&o!==(o=a[0])){if(e){Ae();const p=e;D(p.$$.fragment,1,0,()=>{X(p,1)}),De()}o?(e=Nr(o,r()),Z(e.$$.fragment),N(e.$$.fragment,1),Q(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&k(l),e&&X(e,a)}}}function x1(t){let e,l,n,i;const o=[J1,Z1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function em(t){let e,l,n,i,o,r=[Vs(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_<r.length;_+=1)a=Jt(a,r[_]);let f=t[2]&&qr(t),c=[Vs(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let _=0;_<c.length;_+=1)p=Jt(p,c[_]);return{c(){e=m("div"),l=h(),f&&f.c(),n=h(),i=m("div"),oi(e,a),oi(i,p)},m(_,b){w(_,e,b),w(_,l,b),f&&f.m(_,b),w(_,n,b),w(_,i,b),o=!0},p(_,[b]){_[2]?f?(f.p(_,b),b&4&&N(f,1)):(f=qr(_),f.c(),N(f,1),f.m(n.parentNode,n)):f&&(Ae(),D(f,1,1,()=>{f=null}),De())},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&k(e),_&&k(l),f&&f.d(_),_&&k(n),_&&k(i)}}}const tm=Jf();function lm(t,e,l){let n;const i=["path","component","meta","primary"];let o=ds(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Si(ws,e);const T=tm(),{registerRoute:C,unregisterRoute:$,activeRoute:M,disableInlineStyles:E}=Rl(ui);ul(t,M,q=>l(16,r=q));const S=gc();ul(t,S,q=>l(17,f=q));const A=hc();ul(t,A,q=>l(3,a=q));const I=ut(null);let F;const Y=ut(),U=ut({});ul(t,U,q=>l(4,c=q)),wi(lc,Y),wi(s1,U),wi(o1,I);const H=Q1();return Ll||Xc(()=>$(T)),t.$$set=q=>{l(24,e=Jt(Jt({},e),_s(q))),l(12,o=ds(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Ti(f,b),O={id:T,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:S1(z,a.pathname),primary:g,focusElement:I};Y.set(O),l(15,F=C(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===T)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=_s(e),[d,g,n,a,c,T,M,E,S,A,U,H,o,b,v,F,r,f,p,_]}class nm extends Me{constructor(e){super(),Se(this,e,lm,em,$e,{path:13,component:0,meta:14,primary:1})}}const $l=nm;function im(t){let e,l,n,i;const o=t[13].default,r=oo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;c<a.length;c+=1)f=Jt(f,a[c]);return{c(){e=m("a"),r&&r.c(),oi(e,f)},m(c,p){w(c,e,p),r&&r.m(e,null),l=!0,n||(i=K(e,"click",t[4]),n=!0)},p(c,[p]){r&&r.p&&(!l||p&4096)&&ro(r,o,c,c[12],l?uo(o,c[12],p,null):ao(c[12]),null),oi(e,f=Qf(a,[(!l||p&1)&&{href:c[0]},p&4&&c[2],p&2&&c[1]]))},i(c){l||(N(r,c),l=!0)},o(c){D(r,c),l=!1},d(c){c&&k(e),r&&r.d(c),n=!1,i()}}}function sm(t,e,l){let n,i,o,r,a,f;const c=["to","replace","state","getProps"];let p=ds(e,c),_,{$$slots:b={},$$scope:d}=e,{to:v}=e,{replace:g=!1}=e,{state:T={}}=e,{getProps:C=null}=e;Si(co,e);const $=hc();ul(t,$,I=>l(11,_=I));const M=Zc(),E=kc(),{navigate:S}=bc();function A(I){M("click",I),l1(I)&&(I.preventDefault(),S(n,{state:T,replace:r||g}))}return t.$$set=I=>{l(19,e=Jt(Jt({},e),_s(I))),l(18,p=ds(e,c)),"to"in I&&l(5,v=I.to),"replace"in I&&l(6,g=I.replace),"state"in I&&l(7,T=I.state),"getProps"in I&&l(8,C=I.getProps),"$$scope"in I&&l(12,d=I.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=E(v,_)),t.$$.dirty&2049&&l(10,i=Qs(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=po(n)===$1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(Xf(C)){const I=C({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...I}}return p})())},e=_s(e),[n,f,a,$,A,v,g,T,C,o,i,_,d,b]}class om extends Me{constructor(e){super(),Se(this,e,sm,im,$e,{to:5,replace:6,state:7,getProps:8})}}const Fl=om;let Xs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Il(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function um(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function wc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function rm(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function bs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function Le(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Hr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function jr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Wr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function ii(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ye(t,e){return t==1||t==2&&e}function Ut(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function me(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function rl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Gr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function Ul(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ol={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Ot=ut(ol);async function _o(){ol=await(await Ul("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ot.set(ol)}let cs=0,Br=-127,zr=null,am={};const fm=tc(am,t=>{let e;async function l(){Ul("/data.json").then(n=>n.json()).then(n=>{t(n),Br!=n.t&&(Br=n.t,setTimeout(Tc,2e3)),zr!=n.p&&n.pe&&(zr=n.p,setTimeout(cm,1e3)),ol.upgrading?window.location.reload():(!ol||!ol.chip||ol.booting||cs>1&&!ii(ol.board))&&(_o(),ln&&clearTimeout(ln),ln=setTimeout(vo,2e3),nn&&clearTimeout(nn),nn=setTimeout(ho,3e3));let i=5e3;if(ii(ol.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),cs=0}).catch(n=>{cs++,cs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ii(ol.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Zs={};const yc=ut(Zs);async function cm(){Zs=await(await Ul("/energyprice.json")).json(),yc.set(Zs)}let Js={},ln;async function vo(){ln&&(clearTimeout(ln),ln=0),Js=await(await Ul("/dayplot.json")).json(),Cc.set(Js);let e=new Date;ln=setTimeout(vo,(60-e.getMinutes())*6e4+20)}const Cc=ut(Js,t=>(vo(),function(){}));let xs={},nn;async function ho(){nn&&(clearTimeout(nn),nn=0),xs=await(await Ul("/monthplot.json")).json(),$c.set(xs);let e=new Date;nn=setTimeout(ho,(24-e.getHours())*36e5+40)}const $c=ut(xs,t=>(ho(),function(){}));let eo={};async function Tc(){eo=await(await Ul("/temperature.json")).json(),Sc.set(eo)}const Sc=ut(eo,t=>(Tc(),function(){}));let to={},ms;async function Mc(){ms&&(clearTimeout(ms),ms=0),to=await(await Ul("/tariff.json")).json(),Nc.set(to);let e=new Date;ms=setTimeout(Mc,(60-e.getMinutes())*6e4+30)}const Nc=ut(to,t=>function(){});let lo=[];const bo=ut(lo);async function mm(){lo=await(await Ul("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),bo.set(lo)}function gs(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Pc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Ac(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;p<r.length;p++){let _=r[p],d=_.tag_name.substring(1).split("."),v=parseInt(d[0]),g=parseInt(d[1]),T=parseInt(d[2]);if(v==n)g==i?T>o&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let C=c.tag_name.substring(1).split(".");parseInt(C[0]);let $=parseInt(C[1]);parseInt(C[2]),g==$&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const pm="/github.svg";function Yr(t){let e,l;function n(r,a){return r[1]>1?km:r[1]>0?gm:r[2]>1?bm:r[2]>0?hm:r[3]>1?vm:r[3]>0?dm:_m}let i=n(t),o=i(t);return{c(){e=y(`Up
`),o.c(),l=Ge()},m(r,a){w(r,e,a),o.m(r,a),w(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&k(e),o.d(r),r&&k(l)}}}function _m(t){let e,l;return{c(){e=y(t[0]),l=y(" seconds")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&1&&G(e,n[0])},d(n){n&&k(e),n&&k(l)}}}function dm(t){let e,l;return{c(){e=y(t[3]),l=y(" minute")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&k(e),n&&k(l)}}}function vm(t){let e,l;return{c(){e=y(t[3]),l=y(" minutes")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&8&&G(e,n[3])},d(n){n&&k(e),n&&k(l)}}}function hm(t){let e,l;return{c(){e=y(t[2]),l=y(" hour")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&k(e),n&&k(l)}}}function bm(t){let e,l;return{c(){e=y(t[2]),l=y(" hours")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&4&&G(e,n[2])},d(n){n&&k(e),n&&k(l)}}}function gm(t){let e,l;return{c(){e=y(t[1]),l=y(" day")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&k(e),n&&k(l)}}}function km(t){let e,l;return{c(){e=y(t[1]),l=y(" days")},m(n,i){w(n,e,i),w(n,l,i)},p(n,i){i&2&&G(e,n[1])},d(n){n&&k(e),n&&k(l)}}}function wm(t){let e,l=t[0]&&Yr(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Yr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&k(e)}}}function ym(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class Cm extends Me{constructor(e){super(),Se(this,e,ym,wm,$e,{epoch:0})}}function $m(t){let e,l,n;return{c(){e=m("span"),l=y(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){w(i,e,o),s(e,l)},p(i,[o]){o&4&&G(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&k(e)}}}function Tm(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class al extends Me{constructor(e){super(),Se(this,e,Tm,$m,$e,{color:0,title:1,text:2})}}function Sm(t){let e,l=`${Le(t[0].getDate())}.${Le(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=y(l),u(e,"class",t[1])},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Le(i[0].getDate())}.${Le(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Le(i[0].getHours())}:${Le(i[0].getMinutes())}`)&&G(n,l),o&2&&u(e,"class",i[1])},d(i){i&&k(e)}}}function Mm(t){let e=`${Le(t[0].getDate())}. ${Xs[t[0].getMonth()]} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,l;return{c(){l=y(e)},m(n,i){w(n,l,i)},p(n,i){i&1&&e!==(e=`${Le(n[0].getDate())}. ${Xs[n[0].getMonth()]} ${Le(n[0].getHours())}:${Le(n[0].getMinutes())}`)&&G(l,e)},d(n){n&&k(l)}}}function Nm(t){let e;function l(o,r){return o[2]?Mm:Sm}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),w(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&k(e)}}}function Pm(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||rl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,r,o]}class Dc extends Me{constructor(e){super(),Se(this,e,Pm,Nm,$e,{timestamp:0,fullTimeColor:1,offset:3})}}function Am(t){let e,l,n;return{c(){e=He("svg"),l=He("path"),n=He("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){w(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&k(e)}}}class Dm extends Me{constructor(e){super(),Se(this,e,null,Am,$e,{})}}function Em(t){let e,l;return{c(){e=He("svg"),l=He("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Im extends Me{constructor(e){super(),Se(this,e,null,Em,$e,{})}}function Fm(t){let e,l;return{c(){e=He("svg"),l=He("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Lt extends Me{constructor(e){super(),Se(this,e,null,Fm,$e,{})}}function Rm(t){let e,l;return{c(){e=He("svg"),l=He("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){w(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&k(e)}}}class Ec extends Me{constructor(e){super(),Se(this,e,null,Rm,$e,{})}}function Lm(t){let e,l,n=t[1].version+"",i;return{c(){e=y("AMS reader "),l=m("span"),i=y(n)},m(o,r){w(o,e,r),w(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&G(i,n)},d(o){o&&k(e),o&&k(l)}}}function Vr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=y(l),i=y("\xB0C"),u(e,"class","flex-none my-auto")},m(o,r){w(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&G(n,l)},d(o){o&&k(e)}}}function Kr(t){let e,l="HAN: "+Hr(t[0].he),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Hr(i[0].he))&&G(n,l)},d(i){i&&k(e)}}}function Qr(t){let e,l="MQTT: "+jr(t[0].me),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+jr(i[0].me))&&G(n,l)},d(i){i&&k(e)}}}function Xr(t){let e,l="PriceAPI: "+Wr(t[0].ee),n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Wr(i[0].ee))&&G(n,l)},d(i){i&&k(e)}}}function Zr(t){let e,l,n,i,o,r;return l=new Fl({props:{to:"/configuration",$$slots:{default:[Um]},$$scope:{ctx:t}}}),o=new Fl({props:{to:"/status",$$slots:{default:[Om]},$$scope:{ctx:t}}}),{c(){e=m("div"),Z(l.$$.fragment),n=h(),i=m("div"),Z(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){w(a,e,f),Q(l,e,null),w(a,n,f),w(a,i,f),Q(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){D(l.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&k(e),X(l),a&&k(n),a&&k(i),X(o)}}}function Um(t){let e,l;return e=new Dm({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Om(t){let e,l;return e=new Im({}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Jr(t){let e,l,n,i,o;const r=[Hm,qm],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){w(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Ae(),D(a[_],1,1,()=>{a[_]=null}),De(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){D(n),o=!1},d(c){c&&k(e),a[l].d()}}}function qm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=y("New version: "),i=y(n)},m(o,r){w(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&G(i,n)},i:ne,o:ne,d(o){o&&k(e)}}}function Hm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new Ec({}),{c(){e=m("button"),l=m("span"),n=y("New version: "),o=y(i),r=h(),Z(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,b){w(_,e,b),s(e,l),s(l,n),s(l,o),s(e,r),Q(a,e,null),f=!0,c||(p=K(e,"click",t[3]),c=!0)},p(_,b){(!f||b&4)&&i!==(i=_[2].tag_name+"")&&G(o,i)},i(_){f||(N(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&k(e),X(a),c=!1,p()}}}function jm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,ee,le,pe,ie,Te,je,Pe,We;i=new Fl({props:{to:"/",$$slots:{default:[Lm]},$$scope:{ctx:t}}}),f=new Cm({props:{epoch:t[0].u}});let be=t[0].t>-50&&Vr(t);$=new al({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Il(t[1].booting?2:t[0].em)}}),E=new al({props:{title:"HAN",text:"HAN",color:Il(t[1].booting?9:t[0].hm)}}),A=new al({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Il(t[1].booting?9:t[0].wm)}}),F=new al({props:{title:"MQTT",text:"MQTT",color:Il(t[1].booting?9:t[0].mm)}});let ke=(t[0].he<0||t[0].he>0)&&Kr(t),Ie=t[0].me<0&&Qr(t),ge=(t[0].ee>0||t[0].ee<0)&&Xr(t);ee=new Dc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let ae=t[1].vndcfg&&t[1].usrcfg&&Zr(t);je=new Lt({});let we=t[1].fwconsent===1&&t[2]&&Jr(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),a=m("div"),Z(f.$$.fragment),c=h(),be&&be.c(),p=h(),_=m("div"),b=y("Free mem: "),v=y(d),g=y("kb"),T=h(),C=m("div"),Z($.$$.fragment),M=h(),Z(E.$$.fragment),S=h(),Z(A.$$.fragment),I=h(),Z(F.$$.fragment),Y=h(),ke&&ke.c(),U=h(),Ie&&Ie.c(),H=h(),ge&&ge.c(),q=h(),z=m("div"),O=m("div"),R=m("a"),B=m("img"),j=h(),W=m("div"),Z(ee.$$.fragment),le=h(),ae&&ae.c(),pe=h(),ie=m("div"),Te=m("a"),Z(je.$$.fragment),Pe=h(),we&&we.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u(C,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(B,"class","gh-logo"),qc(B.src,L=pm)||u(B,"src",L),u(B,"alt","GitHub repo"),u(R,"class","float-right"),u(R,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(R,"target","_blank"),u(R,"rel","noreferrer"),u(R,"aria-label","GitHub"),u(O,"class","flex-none"),u(W,"class","flex-none my-auto px-2"),u(Te,"href",Ut("")),u(Te,"target","_blank"),u(Te,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(z,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(J,se){w(J,e,se),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,a),Q(f,a,null),s(r,c),be&&be.m(r,null),s(r,p),s(r,_),s(_,b),s(_,v),s(_,g),s(l,T),s(l,C),Q($,C,null),s(C,M),Q(E,C,null),s(C,S),Q(A,C,null),s(C,I),Q(F,C,null),s(l,Y),ke&&ke.m(l,null),s(l,U),Ie&&Ie.m(l,null),s(l,H),ge&&ge.m(l,null),s(l,q),s(l,z),s(z,O),s(O,R),s(R,B),s(z,j),s(z,W),Q(ee,W,null),s(z,le),ae&&ae.m(z,null),s(z,pe),s(z,ie),s(ie,Te),Q(je,Te,null),s(z,Pe),we&&we.m(z,null),We=!0},p(J,[se]){const Ee={};se&18&&(Ee.$$scope={dirty:se,ctx:J}),i.$set(Ee);const Fe={};se&1&&(Fe.epoch=J[0].u),f.$set(Fe),J[0].t>-50?be?be.p(J,se):(be=Vr(J),be.c(),be.m(r,p)):be&&(be.d(1),be=null),(!We||se&1)&&d!==(d=(J[0].m?(J[0].m/1e3).toFixed(1):"-")+"")&&G(v,d);const _e={};se&3&&(_e.text=J[1].booting?"Booting":J[0].v>2?J[0].v.toFixed(2)+"V":"ESP"),se&3&&(_e.color=Il(J[1].booting?2:J[0].em)),$.$set(_e);const ye={};se&3&&(ye.color=Il(J[1].booting?9:J[0].hm)),E.$set(ye);const Ne={};se&1&&(Ne.text=J[0].r?J[0].r.toFixed(0)+"dBm":"WiFi"),se&3&&(Ne.color=Il(J[1].booting?9:J[0].wm)),A.$set(Ne);const de={};se&3&&(de.color=Il(J[1].booting?9:J[0].mm)),F.$set(de),J[0].he<0||J[0].he>0?ke?ke.p(J,se):(ke=Kr(J),ke.c(),ke.m(l,U)):ke&&(ke.d(1),ke=null),J[0].me<0?Ie?Ie.p(J,se):(Ie=Qr(J),Ie.c(),Ie.m(l,H)):Ie&&(Ie.d(1),Ie=null),J[0].ee>0||J[0].ee<0?ge?ge.p(J,se):(ge=Xr(J),ge.c(),ge.m(l,q)):ge&&(ge.d(1),ge=null);const Ce={};se&1&&(Ce.timestamp=J[0].c?new Date(J[0].c*1e3):new Date(0)),se&2&&(Ce.offset=J[1].clock_offset),ee.$set(Ce),J[1].vndcfg&&J[1].usrcfg?ae?se&2&&N(ae,1):(ae=Zr(J),ae.c(),N(ae,1),ae.m(z,pe)):ae&&(Ae(),D(ae,1,1,()=>{ae=null}),De()),J[1].fwconsent===1&&J[2]?we?(we.p(J,se),se&6&&N(we,1)):(we=Jr(J),we.c(),N(we,1),we.m(z,null)):we&&(Ae(),D(we,1,1,()=>{we=null}),De())},i(J){We||(N(i.$$.fragment,J),N(f.$$.fragment,J),N($.$$.fragment,J),N(E.$$.fragment,J),N(A.$$.fragment,J),N(F.$$.fragment,J),N(ee.$$.fragment,J),N(ae),N(je.$$.fragment,J),N(we),We=!0)},o(J){D(i.$$.fragment,J),D(f.$$.fragment,J),D($.$$.fragment,J),D(E.$$.fragment,J),D(A.$$.fragment,J),D(F.$$.fragment,J),D(ee.$$.fragment,J),D(ae),D(je.$$.fragment,J),D(we),We=!1},d(J){J&&k(e),X(i),X(f),be&&be.d(),X($),X(E),X(A),X(F),ke&&ke.d(),Ie&&Ie.d(),ge&&ge.d(),X(ee),ae&&ae.d(),X(je),we&&we.d()}}}function Wm(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ii(i.board)||confirm(gs(ce(i.chip,i.board))))&&(Ot.update(a=>(a.upgrading=!0,a)),Pc(o.tag_name))}return Ot.subscribe(a=>{l(1,i=a),a.fwconsent===1&&mm()}),bo.subscribe(a=>{l(2,o=Ac(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class Gm extends Me{constructor(e){super(),Se(this,e,Wm,jm,$e,{data:0})}}function Bm(t){let e,l,n,i;return{c(){e=He("svg"),l=He("path"),n=He("path"),u(l,"d",zs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=zs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){w(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=zs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ne,o:ne,d(o){o&&k(e)}}}function xr(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function zs(t,e,l,n,i){var o=xr(t,e,l,i),r=xr(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function zm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Ym extends Me{constructor(e){super(),Se(this,e,zm,Bm,$e,{pct:0,color:1})}}function ea(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=h(),n=m("span"),i=y(t[3]),o=h(),r=m("span"),a=y(t[4]),f=y("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){w(c,e,p),w(c,l,p),w(c,n,p),s(n,i),w(c,o,p),w(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&G(i,c[3]),p&16&&G(a,c[4])},d(c){c&&k(e),c&&k(l),c&&k(n),c&&k(o),c&&k(r)}}}function Vm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T;l=new Ym({props:{pct:t[6],color:t[5](t[6])}});let C=t[3]&&ea(t);return{c(){e=m("div"),Z(l.$$.fragment),n=h(),i=m("span"),o=m("span"),r=y(t[2]),a=h(),f=m("br"),c=h(),p=m("span"),_=y(t[0]),b=h(),d=m("span"),v=y(t[1]),g=h(),C&&C.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(d,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m($,M){w($,e,M),Q(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,b),s(i,d),s(d,v),s(i,g),C&&C.m(i,null),T=!0},p($,[M]){const E={};M&64&&(E.pct=$[6]),M&96&&(E.color=$[5]($[6])),l.$set(E),(!T||M&4)&&G(r,$[2]),(!T||M&1)&&G(_,$[0]),(!T||M&2)&&G(v,$[1]),$[3]?C?C.p($,M):(C=ea($),C.c(),C.m(i,null)):C&&(C.d(1),C=null)},i($){T||(N(l.$$.fragment,$),T=!0)},o($){D(l.$$.fragment,$),T=!1},d($){$&&k(e),X(l),C&&C.d()}}}function Km(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class Ic extends Me{constructor(e){super(),Se(this,e,Km,Vm,$e,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function ta(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function la(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function na(t,e,l){const n=t.slice();return n[13]=e[l],n}function ia(t){let e,l,n,i,o,r=t[0].title&&sa(t),a=t[0].y.ticks,f=[];for(let d=0;d<a.length;d+=1)f[d]=ua(na(t,a,d));let c=t[0].x.ticks,p=[];for(let d=0;d<c.length;d+=1)p[d]=fa(la(t,c,d));let _=t[0].points,b=[];for(let d=0;d<_.length;d+=1)b[d]=ba(ta(t,_,d));return{c(){r&&r.c(),e=h(),l=He("svg"),n=He("g");for(let d=0;d<f.length;d+=1)f[d].c();i=He("g");for(let d=0;d<p.length;d+=1)p[d].c();o=He("g");for(let d=0;d<b.length;d+=1)b[d].c();u(n,"class","axis y-axis"),u(i,"class","axis x-axis"),u(o,"class","bars"),u(l,"height",t[4])},m(d,v){r&&r.m(d,v),w(d,e,v),w(d,l,v),s(l,n);for(let g=0;g<f.length;g+=1)f[g]&&f[g].m(n,null);s(l,i);for(let g=0;g<p.length;g+=1)p[g]&&p[g].m(i,null);s(l,o);for(let g=0;g<b.length;g+=1)b[g]&&b[g].m(o,null)},p(d,v){if(d[0].title?r?r.p(d,v):(r=sa(d),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),v&65){a=d[0].y.ticks;let g;for(g=0;g<a.length;g+=1){const T=na(d,a,g);f[g]?f[g].p(T,v):(f[g]=ua(T),f[g].c(),f[g].m(n,null))}for(;g<f.length;g+=1)f[g].d(1);f.length=a.length}if(v&57){c=d[0].x.ticks;let g;for(g=0;g<c.length;g+=1){const T=la(d,c,g);p[g]?p[g].p(T,v):(p[g]=fa(T),p[g].c(),p[g].m(i,null))}for(;g<p.length;g+=1)p[g].d(1);p.length=c.length}if(v&233){_=d[0].points;let g;for(g=0;g<_.length;g+=1){const T=ta(d,_,g);b[g]?b[g].p(T,v):(b[g]=ba(T),b[g].c(),b[g].m(o,null))}for(;g<b.length;g+=1)b[g].d(1);b.length=_.length}v&16&&u(l,"height",d[4])},d(d){r&&r.d(d),d&&k(e),d&&k(l),fl(f,d),fl(p,d),fl(b,d)}}}function sa(t){let e,l=t[0].title+"",n;return{c(){e=m("strong"),n=y(l),u(e,"class","text-sm")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&G(n,l)},d(i){i&&k(e)}}}function oa(t){let e,l,n,i=t[13].label+"",o,r,a,f;return{c(){e=He("g"),l=He("line"),n=He("text"),o=y(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",r=t[13].align=="right"?"85%":""),u(e,"class",a="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",f="translate(0, "+t[6](t[13].value)+")")},m(c,p){w(c,e,p),s(e,l),s(e,n),s(n,o)},p(c,p){p&1&&i!==(i=c[13].label+"")&&G(o,i),p&1&&r!==(r=c[13].align=="right"?"85%":"")&&u(n,"x",r),p&1&&a!==(a="tick tick-"+c[13].value+" tick-"+c[13].color)&&u(e,"class",a),p&65&&f!==(f="translate(0, "+c[6](c[13].value)+")")&&u(e,"transform",f)},d(c){c&&k(e)}}}function ua(t){let e=!isNaN(t[6](t[13].value)),l,n=e&&oa(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),w(i,l,o)},p(i,o){o&65&&(e=!isNaN(i[6](i[13].value))),e?n?n.p(i,o):(n=oa(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&k(l)}}}function ra(t){let e,l,n=(t[3]>20||t[11]%2==0)&&aa(t);return{c(){e=He("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){w(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=aa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&k(e),n&&n.d()}}}function aa(t){let e,l=t[9].label+"",n,i;return{c(){e=He("text"),n=y(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){w(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&G(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&k(e)}}}function fa(t){let e=!isNaN(t[5](t[11])),l,n=e&&ra(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),w(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=ra(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&k(l)}}}function ca(t){let e,l,n=t[9].value!==void 0&&ma(t),i=t[9].value2>1e-4&&da(t);return{c(){e=He("g"),n&&n.c(),l=He("g"),i&&i.c()},m(o,r){w(o,e,r),n&&n.m(e,null),w(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=ma(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=da(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&k(e),n&&n.d(),o&&k(l),i&&i.d()}}}function ma(t){let e,l,n,i,o,r,a,f=t[3]>15&&pa(t);return{c(){e=He("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(c,p){w(c,e,p),f&&f.m(c,p),w(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=pa(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&k(e),f&&f.d(c),c&&k(a)}}}function pa(t){let e,l=t[9].label+"",n,i,o,r,a,f,c=t[9].title&&_a(t);return{c(){e=He("text"),n=y(l),c&&c.c(),f=Ge(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]<sn?"left":"middle"),u(e,"fill",r=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]<sn?90:0)+")")},m(p,_){w(p,e,_),s(e,n),c&&c.m(p,_),w(p,f,_)},p(p,_){_&1&&l!==(l=p[9].label+"")&&G(n,l),_&8&&i!==(i=p[3]-4)&&u(e,"width",i),_&8&&o!==(o=p[3]<sn?"left":"middle")&&u(e,"text-anchor",o),_&193&&r!==(r=p[6](p[9].value)>p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",r),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]<sn?90:0)+")")&&u(e,"transform",a),p[9].title?c?c.p(p,_):(c=_a(p),c.c(),c.m(f.parentNode,f)):c&&(c.d(1),c=null)},d(p){p&&k(e),c&&c.d(p),p&&k(f)}}}function _a(t){let e,l=t[9].title+"",n;return{c(){e=He("title"),n=y(l)},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title+"")&&G(n,l)},d(i){i&&k(e)}}}function da(t){let e,l,n,i,o,r,a,f=t[3]>15&&va(t);return{c(){e=He("rect"),f&&f.c(),a=Ge(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(c,p){w(c,e,p),f&&f.m(c,p),w(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=va(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&k(e),f&&f.d(c),c&&k(a)}}}function va(t){let e,l=t[9].label2+"",n,i,o,r,a,f=t[9].title2&&ha(t);return{c(){e=He("text"),n=y(l),f&&f.c(),a=Ge(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[6](-t[9].value2)<t[6](0)+15?t[9].color:"white"),u(e,"transform",r="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](-t[9].value2)<t[6](0)+15?t[6](-t[9].value2)+15:t[6](-t[9].value2)-14)+") rotate("+(t[3]<sn?90:0)+")")},m(c,p){w(c,e,p),s(e,n),f&&f.m(c,p),w(c,a,p)},p(c,p){p&1&&l!==(l=c[9].label2+"")&&G(n,l),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](-c[9].value2)<c[6](0)+15?c[9].color:"white")&&u(e,"fill",o),p&105&&r!==(r="translate("+(c[5](c[11])+c[3]/2)+" "+(c[6](-c[9].value2)<c[6](0)+15?c[6](-c[9].value2)+15:c[6](-c[9].value2)-14)+") rotate("+(c[3]<sn?90:0)+")")&&u(e,"transform",r),c[9].title2?f?f.p(c,p):(f=ha(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&k(e),f&&f.d(c),c&&k(a)}}}function ha(t){let e,l=t[9].title2+"",n;return{c(){e=He("title"),n=y(l)},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title2+"")&&G(n,l)},d(i){i&&k(e)}}}function ba(t){let e=!isNaN(t[5](t[11]))&&!isNaN(t[6](t[9].value)),l,n=e&&ca(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),w(i,l,o)},p(i,o){o&97&&(e=!isNaN(i[5](i[11]))&&!isNaN(i[6](i[9].value))),e?n?n.p(i,o):(n=ca(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&k(l)}}}function Qm(t){let e,l,n=t[0].x.ticks&&t[0].points&&t[4]&&ia(t);return{c(){e=m("div"),n&&n.c(),u(e,"class","chart"),tt(()=>t[8].call(e))},m(i,o){w(i,e,o),n&&n.m(e,null),l=Vc(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=ia(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&k(e),n&&n.d(),l()}}}let sn=30;function Xm(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,r=b/n.points.length),l(7,p=r<sn?30:15);let d=(c-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(v){return v*r+n.padding.left}),l(6,f=function(v){let g=0;return v>n.y.max?g=n.padding.bottom:v<n.y.min?g=c-n.padding.bottom:g=c-n.padding.bottom-(v-n.y.min)*d,g>c||g<0?0:g})}},[n,i,o,r,c,a,f,p,_]}class un extends Me{constructor(e){super(),Se(this,e,Xm,Qm,$e,{config:0})}}function Zm(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Jm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:me(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:um(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:c},points:p})}},[a,n,i,o,r]}class xm extends Me{constructor(e){super(),Se(this,e,Jm,Zm,$e,{u1:1,u2:2,u3:3,ds:4})}}function ep(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function tp(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(b){return{label:me(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:wc(b?b/c*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,r=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,f=b.i3),"max"in b&&l(7,c=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],d=[];n>0&&(b.push({label:"L1"}),d.push(_(r))),i>0&&(b.push({label:"L2"}),d.push(_(a))),o>0&&(b.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:b},points:d})}},[p,n,i,o,r,a,f,c]}class lp extends Me{constructor(e){super(),Se(this,e,tp,ep,$e,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function np(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,b,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",T,C,$,M,E,S,A,I=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,Y,U,H,q,z,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",R,B;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",r=h(),a=m("div"),c=y(f),p=y(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",d=h(),v=m("div"),T=y(g),C=y(" VAr"),$=h(),M=m("div"),E=m("div"),E.textContent="Total in",S=h(),A=m("div"),F=y(I),Y=y(" kVArh"),U=h(),H=m("div"),H.textContent="Total out",q=h(),z=m("div"),R=y(O),B=y(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(z,"class","text-right"),u(M,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,j){w(L,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,b),s(i,d),s(i,v),s(v,T),s(v,C),s(e,$),s(e,M),s(M,E),s(M,S),s(M,A),s(A,F),s(A,Y),s(M,U),s(M,H),s(M,q),s(M,z),s(z,R),s(z,B)},p(L,[j]){j&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&G(c,f),j&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&G(T,g),j&4&&I!==(I=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&G(F,I),j&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&G(R,O)},i:ne,o:ne,d(L){L&&k(e)}}}function ip(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class sp extends Me{constructor(e){super(),Se(this,e,ip,np,$e,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function ga(t){let e;function l(o,r){return o[3]?up:op}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,r){i.m(o,r),w(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&k(e)}}}function op(t){let e,l,n,i,o,r,a=me(t[1].h.u,2)+"",f,c,p,_,b,d,v=me(t[1].d.u,1)+"",g,T,C,$,M,E,S=me(t[1].m.u)+"",A,I,F,Y,U,H,q=me(t[0].last_month.u)+"",z,O,R,B,L=t[4]&&ka(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=y(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),d=m("div"),g=y(v),T=y(" kWh"),C=h(),$=m("div"),$.textContent="Month",M=h(),E=m("div"),A=y(S),I=y(" kWh"),F=h(),Y=m("div"),Y.textContent="Last month",U=h(),H=m("div"),z=y(q),O=y(" kWh"),R=h(),L&&L.c(),B=Ge(),u(r,"class","text-right"),u(d,"class","text-right"),u(E,"class","text-right"),u(H,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(j,W){w(j,e,W),w(j,l,W),w(j,n,W),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,b),s(n,d),s(d,g),s(d,T),s(n,C),s(n,$),s(n,M),s(n,E),s(E,A),s(E,I),s(n,F),s(n,Y),s(n,U),s(n,H),s(H,z),s(H,O),w(j,R,W),L&&L.m(j,W),w(j,B,W)},p(j,W){W&2&&a!==(a=me(j[1].h.u,2)+"")&&G(f,a),W&2&&v!==(v=me(j[1].d.u,1)+"")&&G(g,v),W&2&&S!==(S=me(j[1].m.u)+"")&&G(A,S),W&1&&q!==(q=me(j[0].last_month.u)+"")&&G(z,q),j[4]?L?L.p(j,W):(L=ka(j),L.c(),L.m(B.parentNode,B)):L&&(L.d(1),L=null)},d(j){j&&k(e),j&&k(l),j&&k(n),j&&k(R),L&&L.d(j),j&&k(B)}}}function up(t){let e,l,n,i,o,r,a=me(t[1].h.u,2)+"",f,c,p,_,b,d,v,g=me(t[1].d.u,1)+"",T,C,$,M,E,S,A,I=me(t[1].m.u)+"",F,Y,U,H,q,z,O,R=me(t[0].last_month.u)+"",B,L,j,W,ee,le,pe,ie,Te,je,Pe,We=me(t[1].h.p,2)+"",be,ke,Ie,ge,ae,we,J,se=me(t[1].d.p,1)+"",Ee,Fe,_e,ye,Ne,de,Ce,x=me(t[1].m.p)+"",oe,Oe,ue,ve,dt,Ol,xt,ft=me(t[0].last_month.p)+"",Sl,ml,qt,vt,Qe=t[4]&&wa(t),Xe=t[4]&&ya(t),Ze=t[4]&&Ca(t),qe=t[4]&&$a(t),Je=t[4]&&Ta(t),Be=t[4]&&Sa(t),xe=t[4]&&Ma(t),et=t[4]&&Na(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=y(" kWh"),p=h(),Qe&&Qe.c(),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),T=y(g),C=y(" kWh"),$=h(),Xe&&Xe.c(),M=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=y(I),Y=y(" kWh"),U=h(),Ze&&Ze.c(),H=h(),q=m("div"),q.textContent="Last mo.",z=h(),O=m("div"),B=y(R),L=y(" kWh"),j=h(),qe&&qe.c(),ee=h(),le=m("strong"),le.textContent="Export",pe=h(),ie=m("div"),Te=m("div"),Te.textContent="Hour",je=h(),Pe=m("div"),be=y(We),ke=y(" kWh"),Ie=h(),Je&&Je.c(),ge=h(),ae=m("div"),ae.textContent="Day",we=h(),J=m("div"),Ee=y(se),Fe=y(" kWh"),_e=h(),Be&&Be.c(),ye=h(),Ne=m("div"),Ne.textContent="Month",de=h(),Ce=m("div"),oe=y(x),Oe=y(" kWh"),ue=h(),xe&&xe.c(),ve=h(),dt=m("div"),dt.textContent="Last mo.",Ol=h(),xt=m("div"),Sl=y(ft),ml=y(" kWh"),qt=h(),et&&et.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",W="grid grid-cols-"+t[5]+" mb-3"),u(Pe,"class","text-right"),u(J,"class","text-right"),u(Ce,"class","text-right"),u(xt,"class","text-right"),u(ie,"class",vt="grid grid-cols-"+t[5])},m(re,he){w(re,e,he),w(re,l,he),w(re,n,he),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Qe&&Qe.m(n,null),s(n,_),s(n,b),s(n,d),s(n,v),s(v,T),s(v,C),s(n,$),Xe&&Xe.m(n,null),s(n,M),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(n,U),Ze&&Ze.m(n,null),s(n,H),s(n,q),s(n,z),s(n,O),s(O,B),s(O,L),s(n,j),qe&&qe.m(n,null),w(re,ee,he),w(re,le,he),w(re,pe,he),w(re,ie,he),s(ie,Te),s(ie,je),s(ie,Pe),s(Pe,be),s(Pe,ke),s(ie,Ie),Je&&Je.m(ie,null),s(ie,ge),s(ie,ae),s(ie,we),s(ie,J),s(J,Ee),s(J,Fe),s(ie,_e),Be&&Be.m(ie,null),s(ie,ye),s(ie,Ne),s(ie,de),s(ie,Ce),s(Ce,oe),s(Ce,Oe),s(ie,ue),xe&&xe.m(ie,null),s(ie,ve),s(ie,dt),s(ie,Ol),s(ie,xt),s(xt,Sl),s(xt,ml),s(ie,qt),et&&et.m(ie,null)},p(re,he){he&2&&a!==(a=me(re[1].h.u,2)+"")&&G(f,a),re[4]?Qe?Qe.p(re,he):(Qe=wa(re),Qe.c(),Qe.m(n,_)):Qe&&(Qe.d(1),Qe=null),he&2&&g!==(g=me(re[1].d.u,1)+"")&&G(T,g),re[4]?Xe?Xe.p(re,he):(Xe=ya(re),Xe.c(),Xe.m(n,M)):Xe&&(Xe.d(1),Xe=null),he&2&&I!==(I=me(re[1].m.u)+"")&&G(F,I),re[4]?Ze?Ze.p(re,he):(Ze=Ca(re),Ze.c(),Ze.m(n,H)):Ze&&(Ze.d(1),Ze=null),he&1&&R!==(R=me(re[0].last_month.u)+"")&&G(B,R),re[4]?qe?qe.p(re,he):(qe=$a(re),qe.c(),qe.m(n,null)):qe&&(qe.d(1),qe=null),he&32&&W!==(W="grid grid-cols-"+re[5]+" mb-3")&&u(n,"class",W),he&2&&We!==(We=me(re[1].h.p,2)+"")&&G(be,We),re[4]?Je?Je.p(re,he):(Je=Ta(re),Je.c(),Je.m(ie,ge)):Je&&(Je.d(1),Je=null),he&2&&se!==(se=me(re[1].d.p,1)+"")&&G(Ee,se),re[4]?Be?Be.p(re,he):(Be=Sa(re),Be.c(),Be.m(ie,ye)):Be&&(Be.d(1),Be=null),he&2&&x!==(x=me(re[1].m.p)+"")&&G(oe,x),re[4]?xe?xe.p(re,he):(xe=Ma(re),xe.c(),xe.m(ie,ve)):xe&&(xe.d(1),xe=null),he&1&&ft!==(ft=me(re[0].last_month.p)+"")&&G(Sl,ft),re[4]?et?et.p(re,he):(et=Na(re),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),he&32&&vt!==(vt="grid grid-cols-"+re[5])&&u(ie,"class",vt)},d(re){re&&k(e),re&&k(l),re&&k(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),qe&&qe.d(),re&&k(ee),re&&k(le),re&&k(pe),re&&k(ie),Je&&Je.d(),Be&&Be.d(),xe&&xe.d(),et&&et.d()}}}function ka(t){let e,l,n,i,o,r,a=me(t[1].h.c,2)+"",f,c,p,_,b,d,v,g=me(t[1].d.c,1)+"",T,C,$,M,E,S,A,I=me(t[1].m.c)+"",F,Y,U,H,q,z,O,R=me(t[0].last_month.c)+"",B,L,j;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=y(a),c=h(),p=y(t[2]),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),T=y(g),C=h(),$=y(t[2]),M=h(),E=m("div"),E.textContent="Month",S=h(),A=m("div"),F=y(I),Y=h(),U=y(t[2]),H=h(),q=m("div"),q.textContent="Last month",z=h(),O=m("div"),B=y(R),L=h(),j=y(t[2]),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(W,ee){w(W,e,ee),w(W,l,ee),w(W,n,ee),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,b),s(n,d),s(n,v),s(v,T),s(v,C),s(v,$),s(n,M),s(n,E),s(n,S),s(n,A),s(A,F),s(A,Y),s(A,U),s(n,H),s(n,q),s(n,z),s(n,O),s(O,B),s(O,L),s(O,j)},p(W,ee){ee&2&&a!==(a=me(W[1].h.c,2)+"")&&G(f,a),ee&4&&G(p,W[2]),ee&2&&g!==(g=me(W[1].d.c,1)+"")&&G(T,g),ee&4&&G($,W[2]),ee&2&&I!==(I=me(W[1].m.c)+"")&&G(F,I),ee&4&&G(U,W[2]),ee&1&&R!==(R=me(W[0].last_month.c)+"")&&G(B,R),ee&4&&G(j,W[2])},d(W){W&&k(e),W&&k(l),W&&k(n)}}}function wa(t){let e,l=me(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].h.c,2)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function ya(t){let e,l=me(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].d.c,1)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Ca(t){let e,l=me(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].m.c)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function $a(t){let e,l=me(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=me(r[0].last_month.c)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Ta(t){let e,l=me(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].h.i,2)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Sa(t){let e,l=me(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].d.i,1)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Ma(t){let e,l=me(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=me(r[1].m.i)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function Na(t){let e,l=me(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=y(l),i=h(),o=y(t[2]),u(e,"class","text-right")},m(r,a){w(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=me(r[0].last_month.i)+"")&&G(n,l),a&4&&G(o,r[2])},d(r){r&&k(e)}}}function rp(t){let e,l,n,i,o,r,a=t[1]&&ga(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),r=h(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=ga(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&k(e),a&&a.d()}}}function ap(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class fp extends Me{constructor(e){super(),Se(this,e,ap,rp,$e,{sysinfo:0,data:1,currency:2,hasExport:3})}}function cp(t){let e,l,n,i;return n=new un({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),Z(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){w(o,e,r),w(o,l,r),Q(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){D(n.$$.fragment,o),i=!1},d(o){o&&k(e),o&&k(l),X(n,o)}}}function mp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,b=0,d=[],v=[],g=[];l(4,a=l(3,r=0));let T=new Date;for(rl(T,i.clock_offset),p=c;p<24&&(_=n[Le(b++)],_!=null);p++)v.push({label:Le(T.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),rl(T,1);for(p=0;p<24&&(_=n[Le(b++)],_!=null);p++)v.push({label:Le(T.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),rl(T,1);if(a>-100&&r<100){switch(f){case"NOK":case"SEK":case"DKK":f="\xF8re";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,r*=100),p=0;p<g.length;p++)g[p]*=100}let C=[];for(p=0;p<g.length;p++){_=g[p];let S=_*.01,A=Math.abs(_)<1e3?2:0;C.push({label:S>=0?S.toFixed(A):"",title:S>=0?S.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:S<0?S.toFixed(A):"",title2:S<0?S.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let $=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min($/4*-1,a));let S=Math.ceil(Math.abs(a)/$*4),A=a/S;for(p=1;p<S+1;p++){let I=A*p;d.push({value:I,label:(I/100).toFixed(2)})}}l(3,r=Math.max($/4,r));let M=Math.ceil(r/$*4),E=r/M;for(p=0;p<M+1;p++){let S=E*p;d.push({value:S,label:(S/100).toFixed(2)})}l(0,o={title:"Future energy price ("+f+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:d},x:{ticks:v},points:C})}},[o,n,i,r,a]}class pp extends Me{constructor(e){super(),Se(this,e,mp,cp,$e,{json:1,sysinfo:2})}}function _p(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function dp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=rl(new Date,-24),d=new Date().getUTCHours();for(rl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),f=d;f<24;f++){let C=n["i"+Le(f)],$=n["e"+Le(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Le(b.getHours())}),_.push({label:C.toFixed(1),title:C.toFixed(2)+" kWh",value:C*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,C*10)),rl(b,1)}for(f=0;f<d;f++){let C=n["i"+Le(f)],$=n["e"+Le(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Le(b.getHours())}),_.push({label:C.toFixed(1),title:C.toFixed(2)+" kWh",value:C*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,C*10)),rl(b,1)}l(4,a*=-1);let v=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(v/4*-1,a));let C=Math.ceil(Math.abs(a)/v*4),$=a/C;for(f=1;f<C+1;f++){let M=$*f;c.push({value:M,label:(M/10).toFixed(1)})}console.log(C)}l(3,r=Math.max(v/4,r));let g=Math.ceil(r/v*4),T=r/g;for(f=0;f<g+1;f++){let C=T*f;c.push({value:C,label:(C/10).toFixed(1)})}l(0,o={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:c},x:{ticks:p},points:_})}},[o,n,i,r,a]}class vp extends Me{constructor(e){super(),Se(this,e,dp,_p,$e,{json:1,sysinfo:2})}}function hp(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function bp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=new Date,d=new Date;for(rl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),rl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=b.getDate();f<=d.getDate();f++){let C=n["i"+Le(f)],$=n["e"+Le(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Le(f)}),_.push({label:C.toFixed(C<10?1:0),title:C.toFixed(2)+" kWh",value:C,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,C))}for(f=1;f<b.getDate();f++){let C=n["i"+Le(f)],$=n["e"+Le(f)];C===void 0&&(C=0),$===void 0&&($=0),p.push({label:Le(f)}),_.push({label:C.toFixed(C<10?1:0),title:C.toFixed(2)+" kWh",value:C,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,C))}l(4,a*=-1);let v=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(v/4*-1,a));let C=Math.ceil(Math.abs(a)/v*4),$=a/C;for(f=1;f<C+1;f++){let M=$*f;c.push({value:M,label:M.toFixed(0)})}}l(3,r=Math.max(v/4,r));let g=Math.ceil(r/v*4),T=r/g;for(f=0;f<g+1;f++){let C=T*f;c.push({value:C,label:C.toFixed(0)})}l(0,o={title:"Energy use last "+d.getDate()+" days (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:c},x:{ticks:p},points:_})}},[o,n,i,r,a]}class gp extends Me{constructor(e){super(),Se(this,e,bp,hp,$e,{json:1,sysinfo:2})}}function kp(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function wp(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"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 T=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:T.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let b=o;r<0&&(b+=Math.abs(r));let d=b/4;for(a=0;a<5;a++)f=r+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class yp extends Me{constructor(e){super(),Se(this,e,wp,kp,$e,{json:1})}}function Cp(t){let e,l;return e=new un({props:{config:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}let $p=0;function Tp(t,e,l){let n={},i=0,o;return Nc.subscribe(r=>{l(2,o=r)}),Mc(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r<o.p.length;r++){let p=o.p[r];c.push({label:p.v.toFixed(2),value:p.v,color:"#7c3aed"}),f.push({label:p.d>0?Le(p.d)+"."+Xs[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r<o.t.length;r++){let p=o.t[r];if(p>=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:$p,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class Sp extends Me{constructor(e){super(),Se(this,e,Tp,Cp,$e,{})}}function Pa(t){let e,l,n,i,o,r,a=(t[0].mt?bs(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,d,v;return i=new Ic({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:wc}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),f=y(a),c=h(),p=m("div"),b=y(_),d=y(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,T){w(g,e,T),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,b),s(p,d),v=!0},p(g,T){const C={};T&1&&(C.val=g[0].i?g[0].i:0),T&1&&(C.max=g[0].im?g[0].im:15e3),T&1&&(C.sub=g[0].p),T&1&&(C.subunit=g[0].pc),i.$set(C),(!v||T&1)&&a!==(a=(g[0].mt?bs(g[0].mt):"-")+"")&&G(f,a),(!v||T&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&G(b,_)},i(g){v||(N(i.$$.fragment,g),v=!0)},o(g){D(i.$$.fragment,g),v=!1},d(g){g&&k(e),X(i)}}}function Aa(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Ic({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:rm}}),{c(){e=m("div"),l=m("div"),n=m("div"),Z(i.$$.fragment),o=h(),r=m("div"),a=h(),f=m("div"),p=y(c),_=y(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(d,v){w(d,e,v),s(e,l),s(l,n),Q(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),b=!0},p(d,v){const g={};v&1&&(g.val=d[0].e?d[0].e:0),v&1&&(g.max=d[0].om?d[0].om*1e3:1e4),i.$set(g),(!b||v&1)&&c!==(c=(d[0].ec?d[0].ec.toFixed(1):"-")+"")&&G(p,c)},i(d){b||(N(i.$$.fragment,d),b=!0)},o(d){D(i.$$.fragment,d),b=!1},d(d){d&&k(e),X(i)}}}function Da(t){let e,l,n;return l=new xm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ea(t){let e,l,n;return l=new lp({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ia(t){let e,l,n;return l=new sp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Fa(t){let e,l,n;return l=new fp({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ra(t){let e,l,n;return l=new Sp({}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function La(t){let e,l,n;return l=new pp({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Ua(t){let e,l,n;return l=new vp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Oa(t){let e,l,n;return l=new gp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function qa(t){let e,l,n;return l=new yp({props:{json:t[5]}}),{c(){e=m("div"),Z(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){w(i,e,o),Q(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&k(e),X(l)}}}function Mp(t){let e,l=Ye(t[1].ui.i,t[0].i),n,i=Ye(t[1].ui.e,t[0].om||t[0].e>0),o,r=Ye(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=Ye(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=Ye(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=Ye(t[1].ui.c,t[0].ea),d,v=Ye(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,T=Ye(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,$=Ye(t[1].ui.d,t[3]),M,E=Ye(t[1].ui.m,t[4]),S,A=Ye(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),I,F=l&&Pa(t),Y=i&&Aa(t),U=r&&Da(t),H=f&&Ea(t),q=p&&Ia(t),z=b&&Fa(t),O=v&&Ra(),R=T&&La(t),B=$&&Ua(t),L=E&&Oa(t),j=A&&qa(t);return{c(){e=m("div"),F&&F.c(),n=h(),Y&&Y.c(),o=h(),U&&U.c(),a=h(),H&&H.c(),c=h(),q&&q.c(),_=h(),z&&z.c(),d=h(),O&&O.c(),g=h(),R&&R.c(),C=h(),B&&B.c(),M=h(),L&&L.c(),S=h(),j&&j.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(W,ee){w(W,e,ee),F&&F.m(e,null),s(e,n),Y&&Y.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),H&&H.m(e,null),s(e,c),q&&q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),O&&O.m(e,null),s(e,g),R&&R.m(e,null),s(e,C),B&&B.m(e,null),s(e,M),L&&L.m(e,null),s(e,S),j&&j.m(e,null),I=!0},p(W,[ee]){ee&3&&(l=Ye(W[1].ui.i,W[0].i)),l?F?(F.p(W,ee),ee&3&&N(F,1)):(F=Pa(W),F.c(),N(F,1),F.m(e,n)):F&&(Ae(),D(F,1,1,()=>{F=null}),De()),ee&3&&(i=Ye(W[1].ui.e,W[0].om||W[0].e>0)),i?Y?(Y.p(W,ee),ee&3&&N(Y,1)):(Y=Aa(W),Y.c(),N(Y,1),Y.m(e,o)):Y&&(Ae(),D(Y,1,1,()=>{Y=null}),De()),ee&3&&(r=Ye(W[1].ui.v,W[0].u1>100||W[0].u2>100||W[0].u3>100)),r?U?(U.p(W,ee),ee&3&&N(U,1)):(U=Da(W),U.c(),N(U,1),U.m(e,a)):U&&(Ae(),D(U,1,1,()=>{U=null}),De()),ee&3&&(f=Ye(W[1].ui.a,W[0].i1>.01||W[0].i2>.01||W[0].i3>.01)),f?H?(H.p(W,ee),ee&3&&N(H,1)):(H=Ea(W),H.c(),N(H,1),H.m(e,c)):H&&(Ae(),D(H,1,1,()=>{H=null}),De()),ee&3&&(p=Ye(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,ee),ee&3&&N(q,1)):(q=Ia(W),q.c(),N(q,1),q.m(e,_)):q&&(Ae(),D(q,1,1,()=>{q=null}),De()),ee&3&&(b=Ye(W[1].ui.c,W[0].ea)),b?z?(z.p(W,ee),ee&3&&N(z,1)):(z=Fa(W),z.c(),N(z,1),z.m(e,d)):z&&(Ae(),D(z,1,1,()=>{z=null}),De()),ee&3&&(v=Ye(W[1].ui.t,W[0].pr&&(W[0].pr.startsWith("10YNO")||W[0].pr=="10Y1001A1001A48H"))),v?O?ee&3&&N(O,1):(O=Ra(),O.c(),N(O,1),O.m(e,g)):O&&(Ae(),D(O,1,1,()=>{O=null}),De()),ee&3&&(T=Ye(W[1].ui.p,W[0].pe&&!Number.isNaN(W[0].p))),T?R?(R.p(W,ee),ee&3&&N(R,1)):(R=La(W),R.c(),N(R,1),R.m(e,C)):R&&(Ae(),D(R,1,1,()=>{R=null}),De()),ee&10&&($=Ye(W[1].ui.d,W[3])),$?B?(B.p(W,ee),ee&10&&N(B,1)):(B=Ua(W),B.c(),N(B,1),B.m(e,M)):B&&(Ae(),D(B,1,1,()=>{B=null}),De()),ee&18&&(E=Ye(W[1].ui.m,W[4])),E?L?(L.p(W,ee),ee&18&&N(L,1)):(L=Oa(W),L.c(),N(L,1),L.m(e,S)):L&&(Ae(),D(L,1,1,()=>{L=null}),De()),ee&35&&(A=Ye(W[1].ui.s,W[0].t&&W[0].t!=-127&&W[5].c>1)),A?j?(j.p(W,ee),ee&35&&N(j,1)):(j=qa(W),j.c(),N(j,1),j.m(e,null)):j&&(Ae(),D(j,1,1,()=>{j=null}),De())},i(W){I||(N(F),N(Y),N(U),N(H),N(q),N(z),N(O),N(R),N(B),N(L),N(j),I=!0)},o(W){D(F),D(Y),D(U),D(H),D(q),D(z),D(O),D(R),D(B),D(L),D(j),I=!1},d(W){W&&k(e),F&&F.d(),Y&&Y.d(),U&&U.d(),H&&H.d(),q&&q.d(),z&&z.d(),O&&O.d(),R&&R.d(),B&&B.d(),L&&L.d(),j&&j.d()}}}function Np(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return yc.subscribe(c=>{l(2,o=c)}),Cc.subscribe(c=>{l(3,r=c)}),$c.subscribe(c=>{l(4,a=c)}),Sc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Pp extends Me{constructor(e){super(),Se(this,e,Np,Mp,$e,{data:0,sysinfo:1})}}let no={};const Fc=ut(no);async function Ap(){no=await(await fetch("/configuration.json")).json(),Fc.set(no)}function Ha(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Dp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Ep(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function ja(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Wa(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){w(i,e,o),w(i,l,o),w(i,n,o)},d(i){i&&k(e),i&&k(l),i&&k(n)}}}function Ga(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Ba(t){let e,l,n;return{c(){e=m("option"),l=y("GPIO"),n=y(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){w(i,e,o),s(e,l),s(e,n)},d(i){i&&k(e)}}}function za(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Ba(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Ba(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&k(e)}}}function Ip(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?Ep:Dp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&ja(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Wa(),_=t[0]=="esp32s2"&&Ga(),b={length:t[1]+1},d=[];for(let v=0;v<b.length;v+=1)d[v]=za(Ha(t,b,v));return{c(){f.c(),e=h(),c&&c.c(),l=h(),p&&p.c(),n=h(),_&&_.c(),i=h();for(let v=0;v<d.length;v+=1)d[v].c();o=Ge()},m(v,g){f.m(v,g),w(v,e,g),c&&c.m(v,g),w(v,l,g),p&&p.m(v,g),w(v,n,g),_&&_.m(v,g),w(v,i,g);for(let T=0;T<d.length;T+=1)d[T]&&d[T].m(v,g);w(v,o,g)},p(v,[g]){if(a!==(a=r(v))&&(f.d(1),f=a(v),f&&(f.c(),f.m(e.parentNode,e))),v[0]=="esp8266"?c||(c=ja(),c.c(),c.m(l.parentNode,l)):c&&(c.d(1),c=null),v[0]=="esp32"||v[0]=="esp32solo"?p||(p=Wa(),p.c(),p.m(n.parentNode,n)):p&&(p.d(1),p=null),v[0]=="esp32s2"?_||(_=Ga(),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g&3){b={length:v[1]+1};let T;for(T=0;T<b.length;T+=1){const C=Ha(v,b,T);d[T]?d[T].p(C,g):(d[T]=za(C),d[T].c(),d[T].m(o.parentNode,o))}for(;T<d.length;T+=1)d[T].d(1);d.length=b.length}},i:ne,o:ne,d(v){f.d(v),v&&k(e),c&&c.d(v),v&&k(l),p&&p.d(v),v&&k(n),_&&_.d(v),v&&k(i),fl(d,v),v&&k(o)}}}function Fp(t,e,l){let{chip:n}=e,i=39;return t.$$set=o=>{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Rc extends Me{constructor(e){super(),Se(this,e,Fp,Ip,$e,{chip:0})}}function Ya(t){let e,l,n=t[1]&&Va(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){w(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Va(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&k(e),n&&n.d()}}}function Va(t){let e,l;return{c(){e=m("div"),l=y(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){w(n,e,i),s(e,l)},p(n,i){i&2&&G(l,n[1])},d(n){n&&k(e)}}}function Rp(t){let e,l=t[0]&&Ya(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),w(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ya(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&k(e)}}}function Lp(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class Dt extends Me{constructor(e){super(),Se(this,e,Lp,Rp,$e,{active:0,message:1})}}function Ka(t,e,l){const n=t.slice();return n[1]=e[l],n}function Qa(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=y("Europe/"),i=y(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){w(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&k(e)}}}function Up(t){let e,l,n,i=t[0],o=[];for(let r=0;r<i.length;r+=1)o[r]=Qa(Ka(t,i,r));return{c(){e=m("option"),e.textContent="GMT",l=h();for(let r=0;r<o.length;r+=1)o[r].c();n=Ge(),e.__value="GMT",e.value=e.__value},m(r,a){w(r,e,a),w(r,l,a);for(let f=0;f<o.length;f+=1)o[f]&&o[f].m(r,a);w(r,n,a)},p(r,[a]){if(a&1){i=r[0];let f;for(f=0;f<i.length;f+=1){const c=Ka(r,i,f);o[f]?o[f].p(c,a):(o[f]=Qa(c),o[f].c(),o[f].m(n.parentNode,n))}for(;f<o.length;f+=1)o[f].d(1);o.length=i.length}},i:ne,o:ne,d(r){r&&k(e),r&&k(l),fl(o,r),r&&k(n)}}}function Op(t){return[["Amsterdam","Athens","Belfast","Berlin","Bratislava","Brussels","Bucharest","Budapest","Copenhagen","Dublin","Helsinki","Lisbon","Ljubljana","London","Luxembourg","Madrid","Malta","Nicosia","Oslo","Paris","Prague","Riga","Rome","Sofia","Stockholm","Tallinn","Vienna","Vilnius","Warsaw","Zagreb","Zurich"]]}class qp extends Me{constructor(e){super(),Se(this,e,Op,Up,$e,{})}}function Hp(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v;return{c(){e=m("optgroup"),l=m("option"),l.textContent="/24",n=h(),i=m("optgroup"),o=m("option"),o.textContent="/25",r=m("option"),r.textContent="/26",a=m("option"),a.textContent="/27",f=m("option"),f.textContent="/28",c=m("option"),c.textContent="/29",p=h(),_=m("optgroup"),b=m("option"),b.textContent="/23",d=m("option"),d.textContent="/22",v=m("option"),v.textContent="/16",l.__value="255.255.255.0",l.value=l.__value,u(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,r.__value="255.255.255.192",r.value=r.__value,a.__value="255.255.255.224",a.value=a.__value,f.__value="255.255.255.240",f.value=f.__value,c.__value="255.255.255.248",c.value=c.__value,u(i,"label","Smaller subnets"),b.__value="255.255.254.0",b.value=b.__value,d.__value="255.255.252.0",d.value=d.__value,v.__value="255.255.0.0",v.value=v.__value,u(_,"label","Larger subnets")},m(g,T){w(g,e,T),s(e,l),w(g,n,T),w(g,i,T),s(i,o),s(i,r),s(i,a),s(i,f),s(i,c),w(g,p,T),w(g,_,T),s(_,b),s(_,d),s(_,v)},p:ne,i:ne,o:ne,d(g){g&&k(e),g&&k(n),g&&k(i),g&&k(p),g&&k(_)}}}class Lc extends Me{constructor(e){super(),Se(this,e,null,Hp,$e,{})}}function Xa(t,e,l){const n=t.slice();return n[91]=e[l],n[92]=e,n[93]=l,n}function Za(t,e,l){const n=t.slice();return n[94]=e[l],n[95]=e,n[96]=l,n}function jp(t,e,l){const n=t.slice();return n[97]=e[l],n}function Wp(t,e,l){const n=t.slice();return n[100]=e[l],n}function Gp(t){let e,l;return{c(){e=m("option"),l=y(t[100]),e.__value=t[100],e.value=e.__value},m(n,i){w(n,e,i),s(e,l)},p:ne,d(n){n&&k(e)}}}function Ja(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,r){w(o,e,r),w(o,l,r),V(l,t[3].p.t),n||(i=K(l,"input",t[19]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].p.t&&V(l,o[3].p.t)},d(o){o&&k(e),o&&k(l),n=!1,i()}}}function xa(t){let e,l,n,i,o,r,a,f,c,p,_,b,d;return{c(){e=m("div"),l=y("Username"),n=m("br"),i=h(),o=m("input"),r=h(),a=m("div"),f=y("Password"),c=m("br"),p=h(),_=m("input"),u(o,"name","gu"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(_,"name","gp"),u(_,"type","password"),u(_,"class","in-s"),u(a,"class","my-1")},m(v,g){w(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].g.u),w(v,r,g),w(v,a,g),s(a,f),s(a,c),s(a,p),s(a,_),V(_,t[3].g.p),b||(d=[K(o,"input",t[21]),K(_,"input",t[22])],b=!0)},p(v,g){g[0]&8&&o.value!==v[3].g.u&&V(o,v[3].g.u),g[0]&8&&_.value!==v[3].g.p&&V(_,v[3].g.p)},d(v){v&&k(e),v&&k(r),v&&k(a),b=!1,Ke(d)}}}function Bp(t){let e,l=t[97]*100+"",n;return{c(){e=m("option"),n=y(l),e.__value=t[97]*100,e.value=e.__value},m(i,o){w(i,e,o),s(e,n)},p:ne,d(i){i&&k(e)}}}function ef(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,r){w(o,e,r),w(o,l,r),V(l,t[3].m.e.k),n||(i=K(l,"input",t[31]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].m.e.k&&V(l,o[3].m.e.k)},d(o){o&&k(e),o&&k(l),n=!1,i()}}}function tf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=y("Authentication key"),n=m("br"),i=h(),o=m("input"),u(o,"name","mea"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].m.e.a),r||(a=K(o,"input",t[32]),r=!0)},p(f,c){c[0]&8&&o.value!==f[3].m.e.a&&V(o,f[3].m.e.a)},d(f){f&&k(e),r=!1,a()}}}function lf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U;return{c(){e=m("div"),l=m("div"),n=y("Watt"),i=m("br"),o=h(),r=m("input"),a=h(),f=m("div"),c=y("Volt"),p=m("br"),_=h(),b=m("input"),d=h(),v=m("div"),g=y("Amp"),T=m("br"),C=h(),$=m("input"),M=h(),E=m("div"),S=y("kWh"),A=m("br"),I=h(),F=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(f,"class","w-1/4"),u($,"name","mma"),u($,"type","number"),u($,"min","0.00"),u($,"max","1000"),u($,"step","0.001"),u($,"class","in-m tr w-full"),u(v,"class","w-1/4"),u(F,"name","mmc"),u(F,"type","number"),u(F,"min","0.00"),u(F,"max","1000"),u(F,"step","0.001"),u(F,"class","in-l tr w-full"),u(E,"class","w-1/4"),u(e,"class","flex my-1")},m(H,q){w(H,e,q),s(e,l),s(l,n),s(l,i),s(l,o),s(l,r),V(r,t[3].m.m.w),s(e,a),s(e,f),s(f,c),s(f,p),s(f,_),s(f,b),V(b,t[3].m.m.v),s(e,d),s(e,v),s(v,g),s(v,T),s(v,C),s(v,$),V($,t[3].m.m.a),s(e,M),s(e,E),s(E,S),s(E,A),s(E,I),s(E,F),V(F,t[3].m.m.c),Y||(U=[K(r,"input",t[34]),K(b,"input",t[35]),K($,"input",t[36]),K(F,"input",t[37])],Y=!0)},p(H,q){q[0]&8&&fe(r.value)!==H[3].m.m.w&&V(r,H[3].m.m.w),q[0]&8&&fe(b.value)!==H[3].m.m.v&&V(b,H[3].m.m.v),q[0]&8&&fe($.value)!==H[3].m.m.a&&V($,H[3].m.m.a),q[0]&8&&fe(F.value)!==H[3].m.m.c&&V(F,H[3].m.m.c)},d(H){H&&k(e),Y=!1,Ke(U)}}}function nf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T;return{c(){e=m("div"),l=y("Gateway"),n=m("br"),i=h(),o=m("input"),r=h(),a=m("div"),f=y("DNS"),c=m("br"),p=h(),_=m("div"),b=m("input"),d=h(),v=m("input"),u(o,"name","ng"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(v,"name","nd2"),u(v,"type","text"),u(v,"class","in-l w-full"),u(_,"class","flex"),u(a,"class","my-1")},m(C,$){w(C,e,$),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].n.g),w(C,r,$),w(C,a,$),s(a,f),s(a,c),s(a,p),s(a,_),s(_,b),V(b,t[3].n.d1),s(_,d),s(_,v),V(v,t[3].n.d2),g||(T=[K(o,"input",t[46]),K(b,"input",t[47]),K(v,"input",t[48])],g=!0)},p(C,$){$[0]&8&&o.value!==C[3].n.g&&V(o,C[3].n.g),$[0]&8&&b.value!==C[3].n.d1&&V(b,C[3].n.d1),$[0]&8&&v.value!==C[3].n.d2&&V(v,C[3].n.d2)},d(C){C&&k(e),C&&k(r),C&&k(a),g=!1,Ke(T)}}}function sf(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=y(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(r,a){w(r,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[K(l,"change",t[52]),K(l,"change",t[11])],i=!0)},p(r,a){a[0]&8&&(l.checked=r[3].q.s.e)},d(r){r&&k(e),i=!1,Ke(o)}}}function of(t){let e,l,n,i,o,r,a,f;return n=new Fl({props:{to:"/mqtt-ca",$$slots:{default:[Vp]},$$scope:{ctx:t}}}),o=new Fl({props:{to:"/mqtt-cert",$$slots:{default:[Xp]},$$scope:{ctx:t}}}),a=new Fl({props:{to:"/mqtt-key",$$slots:{default:[xp]},$$scope:{ctx:t}}}),{c(){e=m("div"),l=m("div"),Z(n.$$.fragment),i=h(),Z(o.$$.fragment),r=h(),Z(a.$$.fragment),u(e,"class","my-1")},m(c,p){w(c,e,p),s(e,l),Q(n,l,null),s(l,i),Q(o,l,null),s(l,r),Q(a,l,null),f=!0},p(c,p){const _={};p[0]&8|p[3]&1024&&(_.$$scope={dirty:p,ctx:c}),n.$set(_);const b={};p[0]&8|p[3]&1024&&(b.$$scope={dirty:p,ctx:c}),o.$set(b);const d={};p[0]&8|p[3]&1024&&(d.$$scope={dirty:p,ctx:c}),a.$set(d)},i(c){f||(N(n.$$.fragment,c),N(o.$$.fragment,c),N(a.$$.fragment,c),f=!0)},o(c){D(n.$$.fragment,c),D(o.$$.fragment,c),D(a.$$.fragment,c),f=!1},d(c){c&&k(e),X(n),X(o),X(a)}}}function zp(t){let e,l;return e=new al({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Yp(t){let e,l;return e=new al({props:{color:"green",text:"CA OK",title:"Click here to replace CA"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Vp(t){let e,l,n,i;const o=[Yp,zp],r=[];function a(f,c){return f[3].q.s.c?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function Kp(t){let e,l;return e=new al({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Qp(t){let e,l;return e=new al({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Xp(t){let e,l,n,i;const o=[Qp,Kp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function Zp(t){let e,l;return e=new al({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function Jp(t){let e,l;return e=new al({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function xp(t){let e,l,n,i;const o=[Jp,Zp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function uf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=m("div"),_=y("Electricity IDX"),b=m("br"),d=h(),v=m("input"),g=h(),T=m("div"),C=y("Current IDX"),$=m("br"),M=h(),E=m("input"),S=h(),A=m("div"),I=y(`Voltage IDX: L1, L2 & L3
`),F=m("div"),Y=m("input"),U=h(),H=m("input"),q=h(),z=m("input"),u(l,"class","text-sm"),u(i,"href",Ut("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(E,"name","oc"),u(E,"type","text"),u(E,"class","in-l tr w-full"),u(T,"class","w-1/2"),u(c,"class","my-1 flex"),u(Y,"name","ou1"),u(Y,"type","text"),u(Y,"class","in-f tr w-1/3"),u(H,"name","ou2"),u(H,"type","text"),u(H,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,j){w(L,e,j),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].o.e),s(c,g),s(c,T),s(T,C),s(T,$),s(T,M),s(T,E),V(E,t[3].o.c),s(e,S),s(e,A),s(A,I),s(A,F),s(F,Y),V(Y,t[3].o.u1),s(F,U),s(F,H),V(H,t[3].o.u2),s(F,q),s(F,z),V(z,t[3].o.u3),O=!0,R||(B=[K(v,"input",t[60]),K(E,"input",t[61]),K(Y,"input",t[62]),K(H,"input",t[63]),K(z,"input",t[64])],R=!0)},p(L,j){j[0]&8&&v.value!==L[3].o.e&&V(v,L[3].o.e),j[0]&8&&E.value!==L[3].o.c&&V(E,L[3].o.c),j[0]&8&&Y.value!==L[3].o.u1&&V(Y,L[3].o.u1),j[0]&8&&H.value!==L[3].o.u2&&V(H,L[3].o.u2),j[0]&8&&z.value!==L[3].o.u3&&V(z,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){D(o.$$.fragment,L),O=!1},d(L){L&&k(e),X(o),R=!1,Ke(B)}}}function rf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z;return o=new Lt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=y("Discovery topic prefix"),_=m("br"),b=h(),d=m("input"),v=h(),g=m("div"),T=y("Hostname for URL"),C=m("br"),$=h(),M=m("input"),S=h(),A=m("div"),I=y("Name tag"),F=m("br"),Y=h(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Ut("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(d,"name","ht"),u(d,"type","text"),u(d,"class","in-s"),u(d,"placeholder","homeassistant"),u(c,"class","my-1"),u(M,"name","hh"),u(M,"type","text"),u(M,"class","in-s"),u(M,"placeholder",E=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,R){w(O,e,R),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,b),s(c,d),V(d,t[3].h.t),s(e,v),s(e,g),s(g,T),s(g,C),s(g,$),s(g,M),V(M,t[3].h.h),s(e,S),s(e,A),s(A,I),s(A,F),s(A,Y),s(A,U),V(U,t[3].h.n),H=!0,q||(z=[K(d,"input",t[65]),K(M,"input",t[66]),K(U,"input",t[67])],q=!0)},p(O,R){R[0]&8&&d.value!==O[3].h.t&&V(d,O[3].h.t),(!H||R[0]&8&&E!==(E=O[3].g.h+".local"))&&u(M,"placeholder",E),R[0]&8&&M.value!==O[3].h.h&&V(M,O[3].h.h),R[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){H||(N(o.$$.fragment,O),H=!0)},o(O){D(o.$$.fragment,O),H=!1},d(O){O&&k(e),X(o),q=!1,Ke(z)}}}function af(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M;o=new Lt({});let E={length:9},S=[];for(let A=0;A<E.length;A+=1)S[A]=ff(Za(t,E,A));return{c(){e=m("div"),l=m("strong"),l.textContent="Tariff thresholds",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div");for(let A=0;A<S.length;A+=1)S[A].c();p=h(),_=m("label"),b=m("span"),b.textContent="Average of",d=h(),v=m("input"),g=h(),T=m("span"),T.textContent="hours",u(l,"class","text-sm"),u(i,"href",Ut("Threshold-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","t"),a.value="true",u(c,"class","flex flex-wrap my-1"),u(b,"class","in-pre"),u(v,"name","th"),u(v,"type","number"),u(v,"min","0"),u(v,"max","255"),u(v,"class","in-txt tr w-full"),u(T,"class","in-post"),u(_,"class","flex m-1"),u(e,"class","cnt")},m(A,I){w(A,e,I),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c);for(let F=0;F<S.length;F+=1)S[F]&&S[F].m(c,null);s(e,p),s(e,_),s(_,b),s(_,d),s(_,v),V(v,t[3].t.h),s(_,g),s(_,T),C=!0,$||(M=K(v,"input",t[69]),$=!0)},p(A,I){if(I[0]&8){E={length:9};let F;for(F=0;F<E.length;F+=1){const Y=Za(A,E,F);S[F]?S[F].p(Y,I):(S[F]=ff(Y),S[F].c(),S[F].m(c,null))}for(;F<S.length;F+=1)S[F].d(1);S.length=E.length}I[0]&8&&fe(v.value)!==A[3].t.h&&V(v,A[3].t.h)},i(A){C||(N(o.$$.fragment,A),C=!0)},o(A){D(o.$$.fragment,A),C=!1},d(A){A&&k(e),X(o),fl(S,A),$=!1,M()}}}function ff(t){let e,l,n=t[96]+1+"",i,o,r,a,f,c,p,_;function b(){t[68].call(r,t[96])}return{c(){e=m("label"),l=m("span"),i=y(n),o=h(),r=m("input"),a=h(),f=m("span"),f.textContent="kWh",c=h(),u(l,"class","in-pre"),u(r,"name","t"+t[96]),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-txt w-full"),u(f,"class","in-post"),u(e,"class","flex w-40 m-1")},m(d,v){w(d,e,v),s(e,l),s(l,i),s(e,o),s(e,r),V(r,t[3].t.t[t[96]]),s(e,a),s(e,f),s(e,c),p||(_=K(r,"input",b),p=!0)},p(d,v){t=d,v[0]&8&&fe(r.value)!==t[3].t.t[t[96]]&&V(r,t[3].t.t[t[96]])},d(d){d&&k(e),p=!1,_()}}}function cf(t){let e,l=t[91].name+"",n,i,o,r,a,f,c,p,_,b;function d(){t[70].call(r,t[91])}return{c(){e=m("div"),n=y(l),i=m("br"),o=h(),r=m("select"),a=m("option"),a.textContent="Hide",f=m("option"),f.textContent="Show",c=m("option"),c.textContent="Dynamic",p=h(),a.__value=0,a.value=a.__value,f.__value=1,f.value=f.__value,c.__value=2,c.value=c.__value,u(r,"name","u"+t[91].key),u(r,"class","in-s"),t[3].u[t[91].key]===void 0&&tt(d),u(e,"class","w-1/2")},m(v,g){w(v,e,g),s(e,n),s(e,i),s(e,o),s(e,r),s(r,a),s(r,f),s(r,c),Ue(r,t[3].u[t[91].key],!0),s(e,p),_||(b=K(r,"change",d),_=!0)},p(v,g){t=v,g[0]&136&&Ue(r,t[3].u[t[91].key])},d(v){v&&k(e),_=!1,b()}}}function mf(t){let e,l,n,i,o,r,a,f;o=new Lt({});let c=t[0].board>20&&pf(t),p=t[0].chip=="esp8266"&&vf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),Z(o.$$.fragment),r=h(),c&&c.c(),a=h(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Ut("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,b){w(_,e,b),s(e,l),s(e,n),s(e,i),Q(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,b){_[0].board>20?c?(c.p(_,b),b[0]&1&&N(c,1)):(c=pf(_),c.c(),N(c,1),c.m(e,a)):c&&(Ae(),D(c,1,1,()=>{c=null}),De()),_[0].chip=="esp8266"?p?p.p(_,b):(p=vf(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(N(o.$$.fragment,_),N(c),f=!0)},o(_){D(o.$$.fragment,_),D(c),f=!1},d(_){_&&k(e),X(o),c&&c.d(),p&&p.d()}}}function pf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,ee,le,pe,ie,Te,je,Pe,We,be,ke,Ie,ge,ae,we,J,se,Ee,Fe,_e,ye,Ne,de,Ce,x;b=new Rc({props:{chip:t[0].chip}});let oe=t[0].chip!="esp8266"&&_f(t),Oe=t[3].i.v.p>0&&df(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=y("HAN"),r=m("label"),a=m("input"),f=y(" pullup"),c=m("br"),p=h(),_=m("select"),Z(b.$$.fragment),d=h(),v=m("div"),g=y("AP button"),T=m("br"),C=h(),$=m("input"),M=h(),E=m("div"),S=y("LED"),A=m("label"),I=m("input"),F=y(" inv"),Y=m("br"),U=h(),H=m("div"),q=m("input"),z=h(),O=m("div"),R=y("RGB"),B=m("label"),L=m("input"),j=y(" inverted"),W=m("br"),ee=h(),le=m("div"),pe=m("input"),ie=h(),Te=m("input"),je=h(),Pe=m("input"),We=h(),be=m("div"),ke=y("Temperature"),Ie=m("br"),ge=h(),ae=m("input"),we=h(),J=m("div"),se=y("Analog temp"),Ee=m("br"),Fe=h(),_e=m("input"),ye=h(),oe&&oe.c(),Ne=h(),Oe&&Oe.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[72].call(_)),u(i,"class","w-1/3"),u($,"name","ia"),u($,"type","number"),u($,"min","0"),u($,"max",t[6]),u($,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(I,"name","ili"),I.__value="true",I.value=I.__value,u(I,"type","checkbox"),u(I,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(H,"class","flex"),u(E,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(B,"class","ml-4"),u(pe,"name","irr"),u(pe,"type","number"),u(pe,"min","0"),u(pe,"max",t[6]),u(pe,"class","in-f tr w-1/3"),u(Te,"name","irg"),u(Te,"type","number"),u(Te,"min","0"),u(Te,"max",t[6]),u(Te,"class","in-m tr w-1/3"),u(Pe,"name","irb"),u(Pe,"type","number"),u(Pe,"min","0"),u(Pe,"max",t[6]),u(Pe,"class","in-l tr w-1/3"),u(le,"class","flex"),u(O,"class","w-full"),u(ae,"name","itd"),u(ae,"type","number"),u(ae,"min","0"),u(ae,"max",t[6]),u(ae,"class","in-f tr w-full"),u(be,"class","my-1 w-1/3"),u(_e,"name","ita"),u(_e,"type","number"),u(_e,"min","0"),u(_e,"max",t[6]),u(_e,"class","in-l tr w-full"),u(J,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(ue,ve){w(ue,e,ve),w(ue,l,ve),w(ue,n,ve),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,p),s(i,_),Q(b,_,null),Ue(_,t[3].i.h.p,!0),s(n,d),s(n,v),s(v,g),s(v,T),s(v,C),s(v,$),V($,t[3].i.a),s(n,M),s(n,E),s(E,S),s(E,A),s(A,I),I.checked=t[3].i.l.i,s(A,F),s(E,Y),s(E,U),s(E,H),s(H,q),V(q,t[3].i.l.p),s(n,z),s(n,O),s(O,R),s(O,B),s(B,L),L.checked=t[3].i.r.i,s(B,j),s(O,W),s(O,ee),s(O,le),s(le,pe),V(pe,t[3].i.r.r),s(le,ie),s(le,Te),V(Te,t[3].i.r.g),s(le,je),s(le,Pe),V(Pe,t[3].i.r.b),s(n,We),s(n,be),s(be,ke),s(be,Ie),s(be,ge),s(be,ae),V(ae,t[3].i.t.d),s(n,we),s(n,J),s(J,se),s(J,Ee),s(J,Fe),s(J,_e),V(_e,t[3].i.t.a),s(n,ye),oe&&oe.m(n,null),s(n,Ne),Oe&&Oe.m(n,null),de=!0,Ce||(x=[K(a,"change",t[71]),K(_,"change",t[72]),K($,"input",t[73]),K(I,"change",t[74]),K(q,"input",t[75]),K(L,"change",t[76]),K(pe,"input",t[77]),K(Te,"input",t[78]),K(Pe,"input",t[79]),K(ae,"input",t[80]),K(_e,"input",t[81])],Ce=!0)},p(ue,ve){ve[0]&8&&(a.checked=ue[3].i.h.u);const dt={};ve[0]&1&&(dt.chip=ue[0].chip),b.$set(dt),ve[0]&8&&Ue(_,ue[3].i.h.p),(!de||ve[0]&64)&&u($,"max",ue[6]),ve[0]&8&&fe($.value)!==ue[3].i.a&&V($,ue[3].i.a),ve[0]&8&&(I.checked=ue[3].i.l.i),(!de||ve[0]&64)&&u(q,"max",ue[6]),ve[0]&8&&fe(q.value)!==ue[3].i.l.p&&V(q,ue[3].i.l.p),ve[0]&8&&(L.checked=ue[3].i.r.i),(!de||ve[0]&64)&&u(pe,"max",ue[6]),ve[0]&8&&fe(pe.value)!==ue[3].i.r.r&&V(pe,ue[3].i.r.r),(!de||ve[0]&64)&&u(Te,"max",ue[6]),ve[0]&8&&fe(Te.value)!==ue[3].i.r.g&&V(Te,ue[3].i.r.g),(!de||ve[0]&64)&&u(Pe,"max",ue[6]),ve[0]&8&&fe(Pe.value)!==ue[3].i.r.b&&V(Pe,ue[3].i.r.b),(!de||ve[0]&64)&&u(ae,"max",ue[6]),ve[0]&8&&fe(ae.value)!==ue[3].i.t.d&&V(ae,ue[3].i.t.d),(!de||ve[0]&64)&&u(_e,"max",ue[6]),ve[0]&8&&fe(_e.value)!==ue[3].i.t.a&&V(_e,ue[3].i.t.a),ue[0].chip!="esp8266"?oe?oe.p(ue,ve):(oe=_f(ue),oe.c(),oe.m(n,Ne)):oe&&(oe.d(1),oe=null),ue[3].i.v.p>0?Oe?Oe.p(ue,ve):(Oe=df(ue),Oe.c(),Oe.m(n,null)):Oe&&(Oe.d(1),Oe=null)},i(ue){de||(N(b.$$.fragment,ue),de=!0)},o(ue){D(b.$$.fragment,ue),de=!1},d(ue){ue&&k(e),ue&&k(l),ue&&k(n),X(b),oe&&oe.d(),Oe&&Oe.d(),Ce=!1,Ke(x)}}}function _f(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=y("Vcc"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[82]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&fe(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&k(e),r=!1,a()}}}function df(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=y("Voltage divider"),n=m("br"),i=h(),o=m("div"),r=m("input"),a=h(),f=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,b){w(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(p=[K(r,"input",t[83]),K(f,"input",t[84])],c=!0)},p(_,b){b[0]&8&&fe(r.value)!==_[3].i.v.d.v&&V(r,_[3].i.v.d.v),b[0]&8&&fe(f.value)!==_[3].i.v.d.g&&V(f,_[3].i.v.d.g)},d(_){_&&k(e),c=!1,Ke(p)}}}function vf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$=(t[0].board==2||t[0].board==100)&&hf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=y("Vcc offset"),r=m("br"),a=h(),f=m("input"),c=h(),p=m("div"),_=y("Multiplier"),b=m("br"),d=h(),v=m("input"),g=h(),$&&$.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(M,E){w(M,e,E),w(M,l,E),w(M,n,E),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].i.v.m),s(n,g),$&&$.m(n,null),T||(C=[K(f,"input",t[85]),K(v,"input",t[86])],T=!0)},p(M,E){E[0]&8&&fe(f.value)!==M[3].i.v.o&&V(f,M[3].i.v.o),E[0]&8&&fe(v.value)!==M[3].i.v.m&&V(v,M[3].i.v.m),M[0].board==2||M[0].board==100?$?$.p(M,E):($=hf(M),$.c(),$.m(n,null)):$&&($.d(1),$=null)},d(M){M&&k(e),M&&k(l),M&&k(n),$&&$.d(),T=!1,Ke(C)}}}function hf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=y("Boot limit"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[87]),r=!0)},p(f,c){c[0]&8&&fe(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&k(e),r=!1,a()}}}function bf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C=t[3].d.t&&gf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),r=y(" Enable telnet"),a=h(),C&&C.c(),f=h(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[90].call(p)),u(c,"class","my-1")},m($,M){w($,e,M),w($,l,M),w($,n,M),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),w($,a,M),C&&C.m($,M),w($,f,M),w($,c,M),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),Ue(p,t[3].d.l,!0),g||(T=[K(o,"change",t[89]),K(p,"change",t[90])],g=!0)},p($,M){M[0]&8&&(o.checked=$[3].d.t),$[3].d.t?C||(C=gf(),C.c(),C.m(f.parentNode,f)):C&&(C.d(1),C=null),M[0]&8&&Ue(p,$[3].d.l)},d($){$&&k(e),$&&k(l),$&&k(n),$&&k(a),C&&C.d($),$&&k(f),$&&k(c),g=!1,Ke(T)}}}function gf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function e0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,ee,le,pe,ie,Te,je,Pe,We,be,ke,Ie,ge,ae,we,J,se,Ee,Fe,_e,ye,Ne,de,Ce,x,oe,Oe,ue,ve,dt,Ol,xt,ft,Sl,ml,qt,vt,Qe,Xe,Ze,qe,Je,Be,xe,et,re,he,Mi,pl,rn,St,Ni,Pi,Ai,_l,Di,Ei,Ii,Mt,ze,dl,Ht,ys,Fi,Re,an,Ri,fn,cn,ko,ri,wo,el,Li,yo,Cs,Co,ai,jt,$o,To,Ml,tl,Nl,So,Ui,Mo,mt,Pl,No,Oi,mn,pn,_n,dn,qi,Po,Et,Ao,ql,Do,Eo,Io,ll,vn,hn,Fo,bn,Hl,Ro,Lo,Uo,gn,Wt,Oo,Hi,qo,jl,Ho,jo,Wo,kn,Gt,Go,ji,Bo,$s,zo,Wl,Wi,Bt,Yo,Vo,Ko,Ts,Gi,zt,Qo,Xo,Zo,ct,Bi,Jo,wn,yn,xo,fi,eu,Gl,tu,lu,nu,vl,iu,Bl,su,ou,uu,hl,ru,Cn,zl,au,fu,cu,It,$n,Tn,Sn,Mn,mu,Yl,pu,_u,du,Nn,Ft,vu,zi,hu,Yi,Vi,Yt,bu,gu,rt,Ki,ku,Pn,An,wu,Vl,yu,Cu,$u,Al,nl,Dn,En,Tu,Nt,Qi,Xi,Su,Pt,In,Zi,Ji,Mu,Ss,xi,es,Vt,Nu,Pu,ci,Au,Dl,Du,mi,Kt,Eu,Iu,Fu,ts,bl,Ru,Ve,ls,Lu,Fn,Rn,Uu,pi,Ou,il,qu,Ms,Hu,ju,Ln,gl,Wu,Qt,Gu,Ns,Kl,Bu,zu,Yu,kl,Vu,Ql,Ku,Qu,Xu,wl,Zu,Un,On,Ju,xu,er,yl,tr,qn,lr,nr,ir,ht,Hn,jn,Wn,Gn,Bn,zn,sr,Xl,or,ur,rr,Cl,ar,Ps,As,Ds=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Es,sl,ns,fr,Yn,Vn,cr,_i,mr,di,pr,Is,At,is,_r,Kn,Qn,dr,vi,vr,ss,os,Xt,hr,br,gr,El,Fs,Xn,kr,us,Zn,wr,rs,Rs,Zl,Ls,Jl,Us,xl,Os,en,Zt,qs,yr;a=new Lt({}),F=new qp({});let Uc=["NOK","SEK","DKK","EUR"],hi=[];for(let P=0;P<4;P+=1)hi[P]=Gp(Wp(t,Uc,P));let bt=t[3].p.e&&t[0].chip!="esp8266"&&Ja(t),gt=t[3].g.s>0&&xa(t);cn=new Lt({});let Oc=[24,48,96,192,384,576,1152],bi=[];for(let P=0;P<7;P+=1)bi[P]=Bp(jp(t,Oc,P));let kt=t[3].m.e.e&&ef(t),wt=t[3].m.e.e&&tf(t),yt=t[3].m.m.e&&lf(t);yn=new Lt({}),An=new Lt({}),In=new Lc({});let Ct=t[3].n.m=="static"&&nf(t);Rn=new Lt({});let $t=t[0].chip!="esp8266"&&sf(t),lt=t[3].q.s.e&&of(t),nt=t[3].q.m==3&&uf(t),it=t[3].q.m==4&&rf(t),st=Ds&&af(t);Vn=new Lt({});let Jn=t[7],pt=[];for(let P=0;P<Jn.length;P+=1)pt[P]=cf(Xa(t,Jn,P));let ot=(t[0].board>20||t[0].chip=="esp8266")&&mf(t);Qn=new Lt({});let Tt=t[3].d.s&&bf(t);return Zl=new Dt({props:{active:t[1],message:"Loading configuration"}}),Jl=new Dt({props:{active:t[2],message:"Saving configuration"}}),xl=new Dt({props:{active:t[4],message:"Performing factory reset"}}),en=new Dt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),r=m("a"),Z(a.$$.fragment),f=h(),c=m("input"),p=h(),_=m("div"),b=m("div"),d=m("div"),v=y("Hostname"),g=m("br"),T=h(),C=m("input"),$=h(),M=m("div"),E=y("Time zone"),S=m("br"),A=h(),I=m("select"),Z(F.$$.fragment),Y=h(),U=m("input"),H=h(),q=m("div"),z=m("div"),O=m("div"),R=y("Price region"),B=m("br"),L=h(),j=m("select"),W=m("optgroup"),ee=m("option"),ee.textContent="NO1",le=m("option"),le.textContent="NO2",pe=m("option"),pe.textContent="NO3",ie=m("option"),ie.textContent="NO4",Te=m("option"),Te.textContent="NO5",je=m("optgroup"),Pe=m("option"),Pe.textContent="SE1",We=m("option"),We.textContent="SE2",be=m("option"),be.textContent="SE3",ke=m("option"),ke.textContent="SE4",Ie=m("optgroup"),ge=m("option"),ge.textContent="DK1",ae=m("option"),ae.textContent="DK2",we=m("option"),we.textContent="Austria",J=m("option"),J.textContent="Belgium",se=m("option"),se.textContent="Czech Republic",Ee=m("option"),Ee.textContent="Estonia",Fe=m("option"),Fe.textContent="Finland",_e=m("option"),_e.textContent="France",ye=m("option"),ye.textContent="Germany",Ne=m("option"),Ne.textContent="Great Britain",de=m("option"),de.textContent="Latvia",Ce=m("option"),Ce.textContent="Lithuania",x=m("option"),x.textContent="Netherland",oe=m("option"),oe.textContent="Poland",Oe=m("option"),Oe.textContent="Switzerland",ue=h(),ve=m("div"),dt=y("Currency"),Ol=m("br"),xt=h(),ft=m("select");for(let P=0;P<4;P+=1)hi[P].c();Sl=h(),ml=m("div"),qt=m("div"),vt=m("div"),Qe=y("Fixed price"),Xe=m("br"),Ze=h(),qe=m("input"),Je=h(),Be=m("div"),xe=y("Multiplier"),et=m("br"),re=h(),he=m("input"),Mi=h(),pl=m("div"),rn=m("label"),St=m("input"),Ni=y(" Enable price fetch from remote server"),Pi=h(),bt&&bt.c(),Ai=h(),_l=m("div"),Di=y("Security"),Ei=m("br"),Ii=h(),Mt=m("select"),ze=m("option"),ze.textContent="None",dl=m("option"),dl.textContent="Only configuration",Ht=m("option"),Ht.textContent="Everything",ys=h(),gt&&gt.c(),Fi=h(),Re=m("div"),an=m("strong"),an.textContent="Meter",Ri=h(),fn=m("a"),Z(cn.$$.fragment),ko=h(),ri=m("input"),wo=h(),el=m("div"),Li=m("span"),Li.textContent="Buffer size",yo=h(),Cs=m("span"),Cs.textContent="Serial conf.",Co=h(),ai=m("label"),jt=m("input"),$o=y(" inverted"),To=h(),Ml=m("div"),tl=m("select"),Nl=m("option"),So=y("Autodetect");for(let P=0;P<7;P+=1)bi[P].c();Mo=h(),mt=m("select"),Pl=m("option"),No=y("-"),mn=m("option"),mn.textContent="7N1",pn=m("option"),pn.textContent="8N1",_n=m("option"),_n.textContent="7E1",dn=m("option"),dn.textContent="8E1",Po=h(),Et=m("input"),Ao=h(),ql=m("div"),Do=y("Voltage"),Eo=m("br"),Io=h(),ll=m("select"),vn=m("option"),vn.textContent="400V (TN)",hn=m("option"),hn.textContent="230V (IT/TT)",Fo=h(),bn=m("div"),Hl=m("div"),Ro=y("Main fuse"),Lo=m("br"),Uo=h(),gn=m("label"),Wt=m("input"),Oo=h(),Hi=m("span"),Hi.textContent="A",qo=h(),jl=m("div"),Ho=y("Production"),jo=m("br"),Wo=h(),kn=m("label"),Gt=m("input"),Go=h(),ji=m("span"),ji.textContent="kWp",Bo=h(),$s=m("div"),zo=h(),Wl=m("div"),Wi=m("label"),Bt=m("input"),Yo=y(" Meter is encrypted"),Vo=h(),kt&&kt.c(),Ko=h(),wt&&wt.c(),Ts=h(),Gi=m("label"),zt=m("input"),Qo=y(" Multipliers"),Xo=h(),yt&&yt.c(),Zo=h(),ct=m("div"),Bi=m("strong"),Bi.textContent="WiFi",Jo=h(),wn=m("a"),Z(yn.$$.fragment),xo=h(),fi=m("input"),eu=h(),Gl=m("div"),tu=y("SSID"),lu=m("br"),nu=h(),vl=m("input"),iu=h(),Bl=m("div"),su=y("Password"),ou=m("br"),uu=h(),hl=m("input"),ru=h(),Cn=m("div"),zl=m("div"),au=y("Power saving"),fu=m("br"),cu=h(),It=m("select"),$n=m("option"),$n.textContent="Default",Tn=m("option"),Tn.textContent="Off",Sn=m("option"),Sn.textContent="Minimum",Mn=m("option"),Mn.textContent="Maximum",mu=h(),Yl=m("div"),pu=y("Power"),_u=m("br"),du=h(),Nn=m("div"),Ft=m("input"),vu=h(),zi=m("span"),zi.textContent="dBm",hu=h(),Yi=m("div"),Vi=m("label"),Yt=m("input"),bu=y(" Auto reboot on connection problem"),gu=h(),rt=m("div"),Ki=m("strong"),Ki.textContent="Network",ku=h(),Pn=m("a"),Z(An.$$.fragment),wu=h(),Vl=m("div"),yu=y("IP"),Cu=m("br"),$u=h(),Al=m("div"),nl=m("select"),Dn=m("option"),Dn.textContent="DHCP",En=m("option"),En.textContent="Static",Tu=h(),Nt=m("input"),Su=h(),Pt=m("select"),Z(In.$$.fragment),Mu=h(),Ct&&Ct.c(),Ss=h(),xi=m("div"),es=m("label"),Vt=m("input"),Nu=y(" enable mDNS"),Pu=h(),ci=m("input"),Au=h(),Dl=m("div"),Du=y("NTP "),mi=m("label"),Kt=m("input"),Eu=y(" obtain from DHCP"),Iu=m("br"),Fu=h(),ts=m("div"),bl=m("input"),Ru=h(),Ve=m("div"),ls=m("strong"),ls.textContent="MQTT",Lu=h(),Fn=m("a"),Z(Rn.$$.fragment),Uu=h(),pi=m("input"),Ou=h(),il=m("div"),qu=y(`Server
`),$t&&$t.c(),Ms=h(),Hu=m("br"),ju=h(),Ln=m("div"),gl=m("input"),Wu=h(),Qt=m("input"),Gu=h(),lt&&lt.c(),Ns=h(),Kl=m("div"),Bu=y("Username"),zu=m("br"),Yu=h(),kl=m("input"),Vu=h(),Ql=m("div"),Ku=y("Password"),Qu=m("br"),Xu=h(),wl=m("input"),Zu=h(),Un=m("div"),On=m("div"),Ju=y("Client ID"),xu=m("br"),er=h(),yl=m("input"),tr=h(),qn=m("div"),lr=y("Payload"),nr=m("br"),ir=h(),ht=m("select"),Hn=m("option"),Hn.textContent="JSON",jn=m("option"),jn.textContent="Raw (minimal)",Wn=m("option"),Wn.textContent="Raw (full)",Gn=m("option"),Gn.textContent="Domoticz",Bn=m("option"),Bn.textContent="HomeAssistant",zn=m("option"),zn.textContent="HEX dump",sr=h(),Xl=m("div"),or=y("Publish topic"),ur=m("br"),rr=h(),Cl=m("input"),ar=h(),nt&&nt.c(),Ps=h(),it&&it.c(),As=h(),st&&st.c(),Es=h(),sl=m("div"),ns=m("strong"),ns.textContent="User interface",fr=h(),Yn=m("a"),Z(Vn.$$.fragment),cr=h(),_i=m("input"),mr=h(),di=m("div");for(let P=0;P<pt.length;P+=1)pt[P].c();pr=h(),ot&&ot.c(),Is=h(),At=m("div"),is=m("strong"),is.textContent="Debugging",_r=h(),Kn=m("a"),Z(Qn.$$.fragment),dr=h(),vi=m("input"),vr=h(),ss=m("div"),os=m("label"),Xt=m("input"),hr=y(" Enable debugging"),br=h(),Tt&&Tt.c(),gr=h(),El=m("div"),Fs=m("div"),Xn=m("button"),Xn.textContent="Factory reset",kr=h(),us=m("div"),Zn=m("button"),Zn.textContent="Reboot",wr=h(),rs=m("div"),rs.innerHTML='<button type="submit" class="btn-pri">Save</button>',Rs=h(),Z(Zl.$$.fragment),Ls=h(),Z(Jl.$$.fragment),Us=h(),Z(xl.$$.fragment),Os=h(),Z(en.$$.fragment),u(i,"class","text-sm"),u(r,"href",Ut("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u(C,"name","gh"),u(C,"type","text"),u(C,"class","in-f w-full"),u(C,"pattern","[A-Za-z0-9-]+"),u(I,"name","gt"),u(I,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[13].call(I)),u(b,"class","flex"),u(_,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",ee.__value="10YNO-1--------2",ee.value=ee.__value,le.__value="10YNO-2--------T",le.value=le.__value,pe.__value="10YNO-3--------J",pe.value=pe.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,Te.__value="10Y1001A1001A48H",Te.value=Te.__value,u(W,"label","Norway"),Pe.__value="10Y1001A1001A44P",Pe.value=Pe.__value,We.__value="10Y1001A1001A45N",We.value=We.__value,be.__value="10Y1001A1001A46L",be.value=be.__value,ke.__value="10Y1001A1001A47J",ke.value=ke.__value,u(je,"label","Sweden"),ge.__value="10YDK-1--------W",ge.value=ge.__value,ae.__value="10YDK-2--------M",ae.value=ae.__value,u(Ie,"label","Denmark"),we.__value="10YAT-APG------L",we.value=we.__value,J.__value="10YBE----------2",J.value=J.__value,se.__value="10YCZ-CEPS-----N",se.value=se.__value,Ee.__value="10Y1001A1001A39I",Ee.value=Ee.__value,Fe.__value="10YFI-1--------U",Fe.value=Fe.__value,_e.__value="10YFR-RTE------C",_e.value=_e.__value,ye.__value="10Y1001A1001A83F",ye.value=ye.__value,Ne.__value="10YGB----------A",Ne.value=Ne.__value,de.__value="10YLV-1001A00074",de.value=de.__value,Ce.__value="10YLT-1001A0008Q",Ce.value=Ce.__value,x.__value="10YNL----------L",x.value=x.__value,oe.__value="10YPL-AREA-----S",oe.value=oe.__value,Oe.__value="10YCH-SWISSGRIDZ",Oe.value=Oe.__value,u(j,"name","pr"),u(j,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[14].call(j)),u(O,"class","w-full"),u(ft,"name","pc"),u(ft,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[15].call(ft)),u(z,"class","flex"),u(q,"class","my-1"),u(qe,"name","pf"),u(qe,"type","number"),u(qe,"min","0.001"),u(qe,"max","65"),u(qe,"step","0.001"),u(qe,"class","in-f tr w-full"),u(vt,"class","w-1/2"),u(he,"name","pm"),u(he,"type","number"),u(he,"min","0.001"),u(he,"max","1000"),u(he,"step","0.001"),u(he,"class","in-l tr w-full"),u(Be,"class","w-1/2"),u(qt,"class","flex"),u(ml,"class","my-1"),u(St,"type","checkbox"),u(St,"name","pe"),St.__value="true",St.value=St.__value,u(St,"class","rounded mb-1"),u(pl,"class","my-1"),ze.__value=0,ze.value=ze.__value,dl.__value=1,dl.value=dl.__value,Ht.__value=2,Ht.value=Ht.__value,u(Mt,"name","gs"),u(Mt,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[20].call(Mt)),u(_l,"class","my-1"),u(n,"class","cnt"),u(an,"class","text-sm"),u(fn,"href",Ut("Meter-configuration")),u(fn,"target","_blank"),u(fn,"class","float-right"),u(ri,"type","hidden"),u(ri,"name","m"),ri.value="true",u(Li,"class","float-right"),u(jt,"name","mi"),jt.__value="true",jt.value=jt.__value,u(jt,"type","checkbox"),u(jt,"class","rounded mb-1"),u(ai,"class","mt-2 ml-3 whitespace-nowrap"),Nl.__value=0,Nl.value=Nl.__value,Nl.disabled=Ui=t[3].m.b!=0,u(tl,"name","mb"),u(tl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[24].call(tl)),Pl.__value=0,Pl.value=Pl.__value,Pl.disabled=Oi=t[3].m.b!=0,mn.__value=2,mn.value=mn.__value,pn.__value=3,pn.value=pn.__value,_n.__value=10,_n.value=_n.__value,dn.__value=11,dn.value=dn.__value,u(mt,"name","mp"),u(mt,"class","in-m"),mt.disabled=qi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[25].call(mt)),u(Et,"name","ms"),u(Et,"type","number"),u(Et,"min",64),u(Et,"max",4096),u(Et,"step",64),u(Et,"class","in-l tr w-1/2"),u(Ml,"class","flex w-full"),u(el,"class","my-1"),vn.__value=2,vn.value=vn.__value,hn.__value=1,hn.value=hn.__value,u(ll,"name","md"),u(ll,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[27].call(ll)),u(ql,"class","my-1"),u(Wt,"name","mf"),u(Wt,"type","number"),u(Wt,"min","5"),u(Wt,"max","65535"),u(Wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(gn,"class","flex"),u(Hl,"class","mx-1"),u(Gt,"name","mr"),u(Gt,"type","number"),u(Gt,"min","0"),u(Gt,"max","65535"),u(Gt,"class","in-f tr w-full"),u(ji,"class","in-post"),u(kn,"class","flex"),u(jl,"class","mx-1"),u(bn,"class","my-1 flex"),u($s,"class","my-1"),u(Bt,"type","checkbox"),u(Bt,"name","me"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(Wl,"class","my-1"),u(zt,"type","checkbox"),u(zt,"name","mm"),zt.__value="true",zt.value=zt.__value,u(zt,"class","rounded mb-1"),u(Re,"class","cnt"),u(Bi,"class","text-sm"),u(wn,"href",Ut("WiFi-configuration")),u(wn,"target","_blank"),u(wn,"class","float-right"),u(fi,"type","hidden"),u(fi,"name","w"),fi.value="true",u(vl,"name","ws"),u(vl,"type","text"),u(vl,"class","in-s"),u(Gl,"class","my-1"),u(hl,"name","wp"),u(hl,"type","password"),u(hl,"class","in-s"),u(Bl,"class","my-1"),$n.__value=255,$n.value=$n.__value,Tn.__value=0,Tn.value=Tn.__value,Sn.__value=1,Sn.value=Sn.__value,Mn.__value=2,Mn.value=Mn.__value,u(It,"name","wz"),u(It,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[40].call(It)),u(zl,"class","w-1/2"),u(Ft,"name","ww"),u(Ft,"type","number"),u(Ft,"min","0"),u(Ft,"max","20.5"),u(Ft,"step","0.5"),u(Ft,"class","in-f tr w-full"),u(zi,"class","in-post"),u(Nn,"class","flex"),u(Yl,"class","ml-2 w-1/2"),u(Cn,"class","my-1 flex"),u(Yt,"type","checkbox"),u(Yt,"name","wa"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"class","rounded mb-1"),u(Yi,"class","my-3"),u(ct,"class","cnt"),u(Ki,"class","text-sm"),u(Pn,"href",Ut("Network-configuration")),u(Pn,"target","_blank"),u(Pn,"class","float-right"),Dn.__value="dhcp",Dn.value=Dn.__value,En.__value="static",En.value=En.__value,u(nl,"name","nm"),u(nl,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[43].call(nl)),u(Nt,"name","ni"),u(Nt,"type","text"),u(Nt,"class","in-m w-full"),Nt.disabled=Qi=t[3].n.m=="dhcp",Nt.required=Xi=t[3].n.m=="static",u(Pt,"name","ns"),u(Pt,"class","in-l"),Pt.disabled=Zi=t[3].n.m=="dhcp",Pt.required=Ji=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[45].call(Pt)),u(Al,"class","flex"),u(Vl,"class","my-1"),u(Vt,"name","nd"),Vt.__value="true",Vt.value=Vt.__value,u(Vt,"type","checkbox"),u(Vt,"class","rounded mb-1"),u(xi,"class","my-1"),u(ci,"type","hidden"),u(ci,"name","ntp"),ci.value="true",u(Kt,"name","ntpd"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"type","checkbox"),u(Kt,"class","rounded mb-1"),u(mi,"class","ml-4"),u(bl,"name","ntph"),u(bl,"type","text"),u(bl,"class","in-s"),u(ts,"class","flex"),u(Dl,"class","my-1"),u(rt,"class","cnt"),u(ls,"class","text-sm"),u(Fn,"href",Ut("MQTT-configuration")),u(Fn,"target","_blank"),u(Fn,"class","float-right"),u(pi,"type","hidden"),u(pi,"name","q"),pi.value="true",u(gl,"name","qh"),u(gl,"type","text"),u(gl,"class","in-f w-3/4"),u(Qt,"name","qp"),u(Qt,"type","number"),u(Qt,"min","1024"),u(Qt,"max","65535"),u(Qt,"class","in-l tr w-1/4"),u(Ln,"class","flex"),u(il,"class","my-1"),u(kl,"name","qu"),u(kl,"type","text"),u(kl,"class","in-s"),u(Kl,"class","my-1"),u(wl,"name","qa"),u(wl,"type","password"),u(wl,"class","in-s"),u(Ql,"class","my-1"),u(yl,"name","qc"),u(yl,"type","text"),u(yl,"class","in-f w-full"),Hn.__value=0,Hn.value=Hn.__value,jn.__value=1,jn.value=jn.__value,Wn.__value=2,Wn.value=Wn.__value,Gn.__value=3,Gn.value=Gn.__value,Bn.__value=4,Bn.value=Bn.__value,zn.__value=255,zn.value=zn.__value,u(ht,"name","qm"),u(ht,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[58].call(ht)),u(Un,"class","my-1 flex"),u(Cl,"name","qb"),u(Cl,"type","text"),u(Cl,"class","in-s"),u(Xl,"class","my-1"),u(Ve,"class","cnt"),u(ns,"class","text-sm"),u(Yn,"href",Ut("User-interface")),u(Yn,"target","_blank"),u(Yn,"class","float-right"),u(_i,"type","hidden"),u(_i,"name","u"),_i.value="true",u(di,"class","flex flex-wrap"),u(sl,"class","cnt"),u(is,"class","text-sm"),u(Kn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Kn,"target","_blank"),u(Kn,"class","float-right"),u(vi,"type","hidden"),u(vi,"name","d"),vi.value="true",u(Xt,"type","checkbox"),u(Xt,"name","ds"),Xt.__value="true",Xt.value=Xt.__value,u(Xt,"class","rounded mb-1"),u(ss,"class","mt-3"),u(At,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(Xn,"type","button"),u(Xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(Zn,"type","button"),u(Zn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(us,"class","text-center"),u(rs,"class","text-right"),u(El,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(P,te){w(P,e,te),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),Q(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,b),s(b,d),s(d,v),s(d,g),s(d,T),s(d,C),V(C,t[3].g.h),s(b,$),s(b,M),s(M,E),s(M,S),s(M,A),s(M,I),Q(F,I,null),Ue(I,t[3].g.t,!0),s(n,Y),s(n,U),s(n,H),s(n,q),s(q,z),s(z,O),s(O,R),s(O,B),s(O,L),s(O,j),s(j,W),s(W,ee),s(W,le),s(W,pe),s(W,ie),s(W,Te),s(j,je),s(je,Pe),s(je,We),s(je,be),s(je,ke),s(j,Ie),s(Ie,ge),s(Ie,ae),s(j,we),s(j,J),s(j,se),s(j,Ee),s(j,Fe),s(j,_e),s(j,ye),s(j,Ne),s(j,de),s(j,Ce),s(j,x),s(j,oe),s(j,Oe),Ue(j,t[3].p.r,!0),s(z,ue),s(z,ve),s(ve,dt),s(ve,Ol),s(ve,xt),s(ve,ft);for(let at=0;at<4;at+=1)hi[at]&&hi[at].m(ft,null);Ue(ft,t[3].p.c,!0),s(n,Sl),s(n,ml),s(ml,qt),s(qt,vt),s(vt,Qe),s(vt,Xe),s(vt,Ze),s(vt,qe),V(qe,t[3].p.f),s(qt,Je),s(qt,Be),s(Be,xe),s(Be,et),s(Be,re),s(Be,he),V(he,t[3].p.m),s(n,Mi),s(n,pl),s(pl,rn),s(rn,St),St.checked=t[3].p.e,s(rn,Ni),s(pl,Pi),bt&&bt.m(pl,null),s(n,Ai),s(n,_l),s(_l,Di),s(_l,Ei),s(_l,Ii),s(_l,Mt),s(Mt,ze),s(Mt,dl),s(Mt,Ht),Ue(Mt,t[3].g.s,!0),s(n,ys),gt&&gt.m(n,null),s(l,Fi),s(l,Re),s(Re,an),s(Re,Ri),s(Re,fn),Q(cn,fn,null),s(Re,ko),s(Re,ri),s(Re,wo),s(Re,el),s(el,Li),s(el,yo),s(el,Cs),s(el,Co),s(el,ai),s(ai,jt),jt.checked=t[3].m.i,s(ai,$o),s(el,To),s(el,Ml),s(Ml,tl),s(tl,Nl),s(Nl,So);for(let at=0;at<7;at+=1)bi[at]&&bi[at].m(tl,null);Ue(tl,t[3].m.b,!0),s(Ml,Mo),s(Ml,mt),s(mt,Pl),s(Pl,No),s(mt,mn),s(mt,pn),s(mt,_n),s(mt,dn),Ue(mt,t[3].m.p,!0),s(Ml,Po),s(Ml,Et),V(Et,t[3].m.s),s(Re,Ao),s(Re,ql),s(ql,Do),s(ql,Eo),s(ql,Io),s(ql,ll),s(ll,vn),s(ll,hn),Ue(ll,t[3].m.d,!0),s(Re,Fo),s(Re,bn),s(bn,Hl),s(Hl,Ro),s(Hl,Lo),s(Hl,Uo),s(Hl,gn),s(gn,Wt),V(Wt,t[3].m.f),s(gn,Oo),s(gn,Hi),s(bn,qo),s(bn,jl),s(jl,Ho),s(jl,jo),s(jl,Wo),s(jl,kn),s(kn,Gt),V(Gt,t[3].m.r),s(kn,Go),s(kn,ji),s(Re,Bo),s(Re,$s),s(Re,zo),s(Re,Wl),s(Wl,Wi),s(Wi,Bt),Bt.checked=t[3].m.e.e,s(Wi,Yo),s(Wl,Vo),kt&&kt.m(Wl,null),s(Re,Ko),wt&&wt.m(Re,null),s(Re,Ts),s(Re,Gi),s(Gi,zt),zt.checked=t[3].m.m.e,s(Gi,Qo),s(Re,Xo),yt&&yt.m(Re,null),s(l,Zo),s(l,ct),s(ct,Bi),s(ct,Jo),s(ct,wn),Q(yn,wn,null),s(ct,xo),s(ct,fi),s(ct,eu),s(ct,Gl),s(Gl,tu),s(Gl,lu),s(Gl,nu),s(Gl,vl),V(vl,t[3].w.s),s(ct,iu),s(ct,Bl),s(Bl,su),s(Bl,ou),s(Bl,uu),s(Bl,hl),V(hl,t[3].w.p),s(ct,ru),s(ct,Cn),s(Cn,zl),s(zl,au),s(zl,fu),s(zl,cu),s(zl,It),s(It,$n),s(It,Tn),s(It,Sn),s(It,Mn),Ue(It,t[3].w.z,!0),s(Cn,mu),s(Cn,Yl),s(Yl,pu),s(Yl,_u),s(Yl,du),s(Yl,Nn),s(Nn,Ft),V(Ft,t[3].w.w),s(Nn,vu),s(Nn,zi),s(ct,hu),s(ct,Yi),s(Yi,Vi),s(Vi,Yt),Yt.checked=t[3].w.a,s(Vi,bu),s(l,gu),s(l,rt),s(rt,Ki),s(rt,ku),s(rt,Pn),Q(An,Pn,null),s(rt,wu),s(rt,Vl),s(Vl,yu),s(Vl,Cu),s(Vl,$u),s(Vl,Al),s(Al,nl),s(nl,Dn),s(nl,En),Ue(nl,t[3].n.m,!0),s(Al,Tu),s(Al,Nt),V(Nt,t[3].n.i),s(Al,Su),s(Al,Pt),Q(In,Pt,null),Ue(Pt,t[3].n.s,!0),s(rt,Mu),Ct&&Ct.m(rt,null),s(rt,Ss),s(rt,xi),s(xi,es),s(es,Vt),Vt.checked=t[3].n.d,s(es,Nu),s(rt,Pu),s(rt,ci),s(rt,Au),s(rt,Dl),s(Dl,Du),s(Dl,mi),s(mi,Kt),Kt.checked=t[3].n.h,s(mi,Eu),s(Dl,Iu),s(Dl,Fu),s(Dl,ts),s(ts,bl),V(bl,t[3].n.n1),s(l,Ru),s(l,Ve),s(Ve,ls),s(Ve,Lu),s(Ve,Fn),Q(Rn,Fn,null),s(Ve,Uu),s(Ve,pi),s(Ve,Ou),s(Ve,il),s(il,qu),$t&&$t.m(il,null),s(il,Ms),s(il,Hu),s(il,ju),s(il,Ln),s(Ln,gl),V(gl,t[3].q.h),s(Ln,Wu),s(Ln,Qt),V(Qt,t[3].q.p),s(Ve,Gu),lt&&lt.m(Ve,null),s(Ve,Ns),s(Ve,Kl),s(Kl,Bu),s(Kl,zu),s(Kl,Yu),s(Kl,kl),V(kl,t[3].q.u),s(Ve,Vu),s(Ve,Ql),s(Ql,Ku),s(Ql,Qu),s(Ql,Xu),s(Ql,wl),V(wl,t[3].q.a),s(Ve,Zu),s(Ve,Un),s(Un,On),s(On,Ju),s(On,xu),s(On,er),s(On,yl),V(yl,t[3].q.c),s(Un,tr),s(Un,qn),s(qn,lr),s(qn,nr),s(qn,ir),s(qn,ht),s(ht,Hn),s(ht,jn),s(ht,Wn),s(ht,Gn),s(ht,Bn),s(ht,zn),Ue(ht,t[3].q.m,!0),s(Ve,sr),s(Ve,Xl),s(Xl,or),s(Xl,ur),s(Xl,rr),s(Xl,Cl),V(Cl,t[3].q.b),s(l,ar),nt&&nt.m(l,null),s(l,Ps),it&&it.m(l,null),s(l,As),st&&st.m(l,null),s(l,Es),s(l,sl),s(sl,ns),s(sl,fr),s(sl,Yn),Q(Vn,Yn,null),s(sl,cr),s(sl,_i),s(sl,mr),s(sl,di);for(let at=0;at<pt.length;at+=1)pt[at]&&pt[at].m(di,null);s(l,pr),ot&&ot.m(l,null),s(l,Is),s(l,At),s(At,is),s(At,_r),s(At,Kn),Q(Qn,Kn,null),s(At,dr),s(At,vi),s(At,vr),s(At,ss),s(ss,os),s(os,Xt),Xt.checked=t[3].d.s,s(os,hr),s(At,br),Tt&&Tt.m(At,null),s(e,gr),s(e,El),s(El,Fs),s(Fs,Xn),s(El,kr),s(El,us),s(us,Zn),s(El,wr),s(El,rs),w(P,Rs,te),Q(Zl,P,te),w(P,Ls,te),Q(Jl,P,te),w(P,Us,te),Q(xl,P,te),w(P,Os,te),Q(en,P,te),Zt=!0,qs||(yr=[K(C,"input",t[12]),K(I,"change",t[13]),K(j,"change",t[14]),K(ft,"change",t[15]),K(qe,"input",t[16]),K(he,"input",t[17]),K(St,"change",t[18]),K(Mt,"change",t[20]),K(jt,"change",t[23]),K(tl,"change",t[24]),K(mt,"change",t[25]),K(Et,"input",t[26]),K(ll,"change",t[27]),K(Wt,"input",t[28]),K(Gt,"input",t[29]),K(Bt,"change",t[30]),K(zt,"change",t[33]),K(vl,"input",t[38]),K(hl,"input",t[39]),K(It,"change",t[40]),K(Ft,"input",t[41]),K(Yt,"change",t[42]),K(nl,"change",t[43]),K(Nt,"input",t[44]),K(Pt,"change",t[45]),K(Vt,"change",t[49]),K(Kt,"change",t[50]),K(bl,"input",t[51]),K(gl,"input",t[53]),K(Qt,"input",t[54]),K(kl,"input",t[55]),K(wl,"input",t[56]),K(yl,"input",t[57]),K(ht,"change",t[58]),K(Cl,"input",t[59]),K(Xt,"change",t[88]),K(Xn,"click",t[8]),K(Zn,"click",t[10]),K(e,"submit",ks(t[9]))],qs=!0)},p(P,te){if(te[0]&8&&C.value!==P[3].g.h&&V(C,P[3].g.h),te[0]&8&&Ue(I,P[3].g.t),te[0]&8&&Ue(j,P[3].p.r),te[0]&8&&Ue(ft,P[3].p.c),te[0]&8&&fe(qe.value)!==P[3].p.f&&V(qe,P[3].p.f),te[0]&8&&fe(he.value)!==P[3].p.m&&V(he,P[3].p.m),te[0]&8&&(St.checked=P[3].p.e),P[3].p.e&&P[0].chip!="esp8266"?bt?bt.p(P,te):(bt=Ja(P),bt.c(),bt.m(pl,null)):bt&&(bt.d(1),bt=null),te[0]&8&&Ue(Mt,P[3].g.s),P[3].g.s>0?gt?gt.p(P,te):(gt=xa(P),gt.c(),gt.m(n,null)):gt&&(gt.d(1),gt=null),te[0]&8&&(jt.checked=P[3].m.i),(!Zt||te[0]&8&&Ui!==(Ui=P[3].m.b!=0))&&(Nl.disabled=Ui),te[0]&8&&Ue(tl,P[3].m.b),(!Zt||te[0]&8&&Oi!==(Oi=P[3].m.b!=0))&&(Pl.disabled=Oi),(!Zt||te[0]&8&&qi!==(qi=P[3].m.b==0))&&(mt.disabled=qi),te[0]&8&&Ue(mt,P[3].m.p),te[0]&8&&fe(Et.value)!==P[3].m.s&&V(Et,P[3].m.s),te[0]&8&&Ue(ll,P[3].m.d),te[0]&8&&fe(Wt.value)!==P[3].m.f&&V(Wt,P[3].m.f),te[0]&8&&fe(Gt.value)!==P[3].m.r&&V(Gt,P[3].m.r),te[0]&8&&(Bt.checked=P[3].m.e.e),P[3].m.e.e?kt?kt.p(P,te):(kt=ef(P),kt.c(),kt.m(Wl,null)):kt&&(kt.d(1),kt=null),P[3].m.e.e?wt?wt.p(P,te):(wt=tf(P),wt.c(),wt.m(Re,Ts)):wt&&(wt.d(1),wt=null),te[0]&8&&(zt.checked=P[3].m.m.e),P[3].m.m.e?yt?yt.p(P,te):(yt=lf(P),yt.c(),yt.m(Re,null)):yt&&(yt.d(1),yt=null),te[0]&8&&vl.value!==P[3].w.s&&V(vl,P[3].w.s),te[0]&8&&hl.value!==P[3].w.p&&V(hl,P[3].w.p),te[0]&8&&Ue(It,P[3].w.z),te[0]&8&&fe(Ft.value)!==P[3].w.w&&V(Ft,P[3].w.w),te[0]&8&&(Yt.checked=P[3].w.a),te[0]&8&&Ue(nl,P[3].n.m),(!Zt||te[0]&8&&Qi!==(Qi=P[3].n.m=="dhcp"))&&(Nt.disabled=Qi),(!Zt||te[0]&8&&Xi!==(Xi=P[3].n.m=="static"))&&(Nt.required=Xi),te[0]&8&&Nt.value!==P[3].n.i&&V(Nt,P[3].n.i),(!Zt||te[0]&8&&Zi!==(Zi=P[3].n.m=="dhcp"))&&(Pt.disabled=Zi),(!Zt||te[0]&8&&Ji!==(Ji=P[3].n.m=="static"))&&(Pt.required=Ji),te[0]&8&&Ue(Pt,P[3].n.s),P[3].n.m=="static"?Ct?Ct.p(P,te):(Ct=nf(P),Ct.c(),Ct.m(rt,Ss)):Ct&&(Ct.d(1),Ct=null),te[0]&8&&(Vt.checked=P[3].n.d),te[0]&8&&(Kt.checked=P[3].n.h),te[0]&8&&bl.value!==P[3].n.n1&&V(bl,P[3].n.n1),P[0].chip!="esp8266"?$t?$t.p(P,te):($t=sf(P),$t.c(),$t.m(il,Ms)):$t&&($t.d(1),$t=null),te[0]&8&&gl.value!==P[3].q.h&&V(gl,P[3].q.h),te[0]&8&&fe(Qt.value)!==P[3].q.p&&V(Qt,P[3].q.p),P[3].q.s.e?lt?(lt.p(P,te),te[0]&8&&N(lt,1)):(lt=of(P),lt.c(),N(lt,1),lt.m(Ve,Ns)):lt&&(Ae(),D(lt,1,1,()=>{lt=null}),De()),te[0]&8&&kl.value!==P[3].q.u&&V(kl,P[3].q.u),te[0]&8&&wl.value!==P[3].q.a&&V(wl,P[3].q.a),te[0]&8&&yl.value!==P[3].q.c&&V(yl,P[3].q.c),te[0]&8&&Ue(ht,P[3].q.m),te[0]&8&&Cl.value!==P[3].q.b&&V(Cl,P[3].q.b),P[3].q.m==3?nt?(nt.p(P,te),te[0]&8&&N(nt,1)):(nt=uf(P),nt.c(),N(nt,1),nt.m(l,Ps)):nt&&(Ae(),D(nt,1,1,()=>{nt=null}),De()),P[3].q.m==4?it?(it.p(P,te),te[0]&8&&N(it,1)):(it=rf(P),it.c(),N(it,1),it.m(l,As)):it&&(Ae(),D(it,1,1,()=>{it=null}),De()),te[0]&8&&(Ds=P[3].p.r.startsWith("10YNO")||P[3].p.r=="10Y1001A1001A48H"),Ds?st?(st.p(P,te),te[0]&8&&N(st,1)):(st=af(P),st.c(),N(st,1),st.m(l,Es)):st&&(Ae(),D(st,1,1,()=>{st=null}),De()),te[0]&136){Jn=P[7];let Rt;for(Rt=0;Rt<Jn.length;Rt+=1){const Sr=Xa(P,Jn,Rt);pt[Rt]?pt[Rt].p(Sr,te):(pt[Rt]=cf(Sr),pt[Rt].c(),pt[Rt].m(di,null))}for(;Rt<pt.length;Rt+=1)pt[Rt].d(1);pt.length=Jn.length}P[0].board>20||P[0].chip=="esp8266"?ot?(ot.p(P,te),te[0]&1&&N(ot,1)):(ot=mf(P),ot.c(),N(ot,1),ot.m(l,Is)):ot&&(Ae(),D(ot,1,1,()=>{ot=null}),De()),te[0]&8&&(Xt.checked=P[3].d.s),P[3].d.s?Tt?Tt.p(P,te):(Tt=bf(P),Tt.c(),Tt.m(At,null)):Tt&&(Tt.d(1),Tt=null);const at={};te[0]&2&&(at.active=P[1]),Zl.$set(at);const Cr={};te[0]&4&&(Cr.active=P[2]),Jl.$set(Cr);const $r={};te[0]&16&&($r.active=P[4]),xl.$set($r);const Tr={};te[0]&32&&(Tr.active=P[5]),en.$set(Tr)},i(P){Zt||(N(a.$$.fragment,P),N(F.$$.fragment,P),N(cn.$$.fragment,P),N(yn.$$.fragment,P),N(An.$$.fragment,P),N(In.$$.fragment,P),N(Rn.$$.fragment,P),N(lt),N(nt),N(it),N(st),N(Vn.$$.fragment,P),N(ot),N(Qn.$$.fragment,P),N(Zl.$$.fragment,P),N(Jl.$$.fragment,P),N(xl.$$.fragment,P),N(en.$$.fragment,P),Zt=!0)},o(P){D(a.$$.fragment,P),D(F.$$.fragment,P),D(cn.$$.fragment,P),D(yn.$$.fragment,P),D(An.$$.fragment,P),D(In.$$.fragment,P),D(Rn.$$.fragment,P),D(lt),D(nt),D(it),D(st),D(Vn.$$.fragment,P),D(ot),D(Qn.$$.fragment,P),D(Zl.$$.fragment,P),D(Jl.$$.fragment,P),D(xl.$$.fragment,P),D(en.$$.fragment,P),Zt=!1},d(P){P&&k(e),X(a),X(F),fl(hi,P),bt&&bt.d(),gt&&gt.d(),X(cn),fl(bi,P),kt&&kt.d(),wt&&wt.d(),yt&&yt.d(),X(yn),X(An),X(In),Ct&&Ct.d(),X(Rn),$t&&$t.d(),lt&&lt.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),X(Vn),fl(pt,P),ot&&ot.d(),X(Qn),Tt&&Tt.d(),P&&k(Rs),X(Zl,P),P&&k(Ls),X(Jl,P),P&&k(Us),X(xl,P),P&&k(Os),X(en,P),qs=!1,Ke(yr)}}}async function t0(){await(await fetch("/reboot",{method:"POST"})).json()}function l0(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};Fc.subscribe(ze=>{ze.version&&(l(3,a=ze),l(1,o=!1))}),Ap();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const ze=new URLSearchParams;ze.append("perform","true");let Ht=await(await fetch("/reset",{method:"POST",body:ze})).json();l(4,f=!1),l(5,c=Ht.success)}}async function _(ze){l(2,r=!0);const dl=new FormData(ze.target),Ht=new URLSearchParams;for(let Re of dl){const[an,Ri]=Re;Ht.append(an,Ri)}let Fi=await(await fetch("/save",{method:"POST",body:Ht})).json();Ot.update(Re=>(Re.booting=Fi.reboot,Re.ui=a.u,Re)),l(2,r=!1),ni("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ot.update(ze=>(ze.booting=!0,ze)),t0())},d=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function T(){a.g.t=_t(this),l(3,a)}function C(){a.p.r=_t(this),l(3,a)}function $(){a.p.c=_t(this),l(3,a)}function M(){a.p.f=fe(this.value),l(3,a)}function E(){a.p.m=fe(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function I(){a.g.s=_t(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function Y(){a.g.p=this.value,l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function H(){a.m.b=_t(this),l(3,a)}function q(){a.m.p=_t(this),l(3,a)}function z(){a.m.s=fe(this.value),l(3,a)}function O(){a.m.d=_t(this),l(3,a)}function R(){a.m.f=fe(this.value),l(3,a)}function B(){a.m.r=fe(this.value),l(3,a)}function L(){a.m.e.e=this.checked,l(3,a)}function j(){a.m.e.k=this.value,l(3,a)}function W(){a.m.e.a=this.value,l(3,a)}function ee(){a.m.m.e=this.checked,l(3,a)}function le(){a.m.m.w=fe(this.value),l(3,a)}function pe(){a.m.m.v=fe(this.value),l(3,a)}function ie(){a.m.m.a=fe(this.value),l(3,a)}function Te(){a.m.m.c=fe(this.value),l(3,a)}function je(){a.w.s=this.value,l(3,a)}function Pe(){a.w.p=this.value,l(3,a)}function We(){a.w.z=_t(this),l(3,a)}function be(){a.w.w=fe(this.value),l(3,a)}function ke(){a.w.a=this.checked,l(3,a)}function Ie(){a.n.m=_t(this),l(3,a)}function ge(){a.n.i=this.value,l(3,a)}function ae(){a.n.s=_t(this),l(3,a)}function we(){a.n.g=this.value,l(3,a)}function J(){a.n.d1=this.value,l(3,a)}function se(){a.n.d2=this.value,l(3,a)}function Ee(){a.n.d=this.checked,l(3,a)}function Fe(){a.n.h=this.checked,l(3,a)}function _e(){a.n.n1=this.value,l(3,a)}function ye(){a.q.s.e=this.checked,l(3,a)}function Ne(){a.q.h=this.value,l(3,a)}function de(){a.q.p=fe(this.value),l(3,a)}function Ce(){a.q.u=this.value,l(3,a)}function x(){a.q.a=this.value,l(3,a)}function oe(){a.q.c=this.value,l(3,a)}function Oe(){a.q.m=_t(this),l(3,a)}function ue(){a.q.b=this.value,l(3,a)}function ve(){a.o.e=this.value,l(3,a)}function dt(){a.o.c=this.value,l(3,a)}function Ol(){a.o.u1=this.value,l(3,a)}function xt(){a.o.u2=this.value,l(3,a)}function ft(){a.o.u3=this.value,l(3,a)}function Sl(){a.h.t=this.value,l(3,a)}function ml(){a.h.h=this.value,l(3,a)}function qt(){a.h.n=this.value,l(3,a)}function vt(ze){a.t.t[ze]=fe(this.value),l(3,a)}function Qe(){a.t.h=fe(this.value),l(3,a)}function Xe(ze){a.u[ze.key]=_t(this),l(3,a)}function Ze(){a.i.h.u=this.checked,l(3,a)}function qe(){a.i.h.p=_t(this),l(3,a)}function Je(){a.i.a=fe(this.value),l(3,a)}function Be(){a.i.l.i=this.checked,l(3,a)}function xe(){a.i.l.p=fe(this.value),l(3,a)}function et(){a.i.r.i=this.checked,l(3,a)}function re(){a.i.r.r=fe(this.value),l(3,a)}function he(){a.i.r.g=fe(this.value),l(3,a)}function Mi(){a.i.r.b=fe(this.value),l(3,a)}function pl(){a.i.t.d=fe(this.value),l(3,a)}function rn(){a.i.t.a=fe(this.value),l(3,a)}function St(){a.i.v.p=fe(this.value),l(3,a)}function Ni(){a.i.v.d.v=fe(this.value),l(3,a)}function Pi(){a.i.v.d.g=fe(this.value),l(3,a)}function Ai(){a.i.v.o=fe(this.value),l(3,a)}function _l(){a.i.v.m=fe(this.value),l(3,a)}function Di(){a.i.v.b=fe(this.value),l(3,a)}function Ei(){a.d.s=this.checked,l(3,a)}function Ii(){a.d.t=this.checked,l(3,a)}function Mt(){a.d.l=_t(this),l(3,a)}return t.$$set=ze=>{"sysinfo"in ze&&l(0,n=ze.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,v,i,p,_,b,d,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,ee,le,pe,ie,Te,je,Pe,We,be,ke,Ie,ge,ae,we,J,se,Ee,Fe,_e,ye,Ne,de,Ce,x,oe,Oe,ue,ve,dt,Ol,xt,ft,Sl,ml,qt,vt,Qe,Xe,Ze,qe,Je,Be,xe,et,re,he,Mi,pl,rn,St,Ni,Pi,Ai,_l,Di,Ei,Ii,Mt]}class n0 extends Me{constructor(e){super(),Se(this,e,l0,e0,$e,{sysinfo:0},null,[-1,-1,-1,-1])}}function kf(t,e,l){const n=t.slice();return n[20]=e[l],n}function i0(t){let e=ce(t[1].chip,t[1].board)+"",l;return{c(){l=y(e)},m(n,i){w(n,l,i)},p(n,i){i&2&&e!==(e=ce(n[1].chip,n[1].board)+"")&&G(l,e)},d(n){n&&k(l)}}}function wf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,p,_,b,d=Gr(t[1])+"",v,g,T=t[1].boot_reason+"",C,$,M=t[1].ex_cause+"",E,S,A;const I=[o0,s0],F=[];function Y(U,H){return U[0].u>0?0:1}return f=Y(t),c=F[f]=I[f](t),{c(){e=m("div"),l=y("AP MAC: "),i=y(n),o=h(),r=m("div"),a=y(`Last boot:
`),c.c(),p=h(),_=m("div"),b=y("Reason: "),v=y(d),g=y(" ("),C=y(T),$=y("/"),E=y(M),S=y(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(_,"class","my-2")},m(U,H){w(U,e,H),s(e,l),s(e,i),w(U,o,H),w(U,r,H),s(r,a),F[f].m(r,null),w(U,p,H),w(U,_,H),s(_,b),s(_,v),s(_,g),s(_,C),s(_,$),s(_,E),s(_,S),A=!0},p(U,H){(!A||H&2)&&n!==(n=U[1].apmac+"")&&G(i,n);let q=f;f=Y(U),f===q?F[f].p(U,H):(Ae(),D(F[q],1,1,()=>{F[q]=null}),De(),c=F[f],c?c.p(U,H):(c=F[f]=I[f](U),c.c()),N(c,1),c.m(r,null)),(!A||H&2)&&d!==(d=Gr(U[1])+"")&&G(v,d),(!A||H&2)&&T!==(T=U[1].boot_reason+"")&&G(C,T),(!A||H&2)&&M!==(M=U[1].ex_cause+"")&&G(E,M)},i(U){A||(N(c),A=!0)},o(U){D(c),A=!1},d(U){U&&k(e),U&&k(o),U&&k(r),F[f].d(),U&&k(p),U&&k(_)}}}function s0(t){let e;return{c(){e=y("-")},m(l,n){w(l,e,n)},p:ne,i:ne,o:ne,d(l){l&&k(e)}}}function o0(t){let e,l;return e=new Dc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function u0(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){w(l,e,n)},p:ne,d(l){l&&k(e)}}}function yf(t){let e,l,n,i,o,r=bs(t[1].meter.mfg)+"",a,f,c,p,_=t[1].meter.model+"",b,d,v,g,T=t[1].meter.id+"",C;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=y("Manufacturer: "),a=y(r),f=h(),c=m("div"),p=y("Model: "),b=y(_),d=h(),v=m("div"),g=y("ID: "),C=y(T),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(e,"class","cnt")},m($,M){w($,e,M),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,C)},p($,M){M&2&&r!==(r=bs($[1].meter.mfg)+"")&&G(a,r),M&2&&_!==(_=$[1].meter.model+"")&&G(b,_),M&2&&T!==(T=$[1].meter.id+"")&&G(C,T)},d($){$&&k(e)}}}function Cf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",b,d,v,g,T=t[1].net.gw+"",C,$,M,E,S=t[1].net.dns1+"",A,I,F=t[1].net.dns2&&$f(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=y("IP: "),a=y(r),f=h(),c=m("div"),p=y("Mask: "),b=y(_),d=h(),v=m("div"),g=y("Gateway: "),C=y(T),$=h(),M=m("div"),E=y("DNS: "),A=y(S),I=h(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(M,"class","my-2"),u(e,"class","cnt")},m(Y,U){w(Y,e,U),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,C),s(e,$),s(e,M),s(M,E),s(M,A),s(M,I),F&&F.m(M,null)},p(Y,U){U&2&&r!==(r=Y[1].net.ip+"")&&G(a,r),U&2&&_!==(_=Y[1].net.mask+"")&&G(b,_),U&2&&T!==(T=Y[1].net.gw+"")&&G(C,T),U&2&&S!==(S=Y[1].net.dns1+"")&&G(A,S),Y[1].net.dns2?F?F.p(Y,U):(F=$f(Y),F.c(),F.m(M,null)):F&&(F.d(1),F=null)},d(Y){Y&&k(e),F&&F.d()}}}function $f(t){let e,l=t[1].net.dns2+"",n;return{c(){e=y("/ "),n=y(l)},m(i,o){w(i,e,o),w(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&G(n,l)},d(i){i&&k(e),i&&k(n)}}}function Tf(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",f,c,p=t[1].upgrade.x+"",_,b,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=y("Previous upgrade attempt ("),o=y(i),r=y(") does not match current version ("),f=y(a),c=y(") ["),_=y(p),b=y("/"),v=y(d),g=y("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(T,C){w(T,e,C),s(e,l),s(l,n),s(l,o),s(l,r),s(l,f),s(l,c),s(l,_),s(l,b),s(l,v),s(l,g)},p(T,C){C&2&&i!==(i=T[1].upgrade.t+"")&&G(o,i),C&2&&a!==(a=T[1].version+"")&&G(f,a),C&2&&p!==(p=T[1].upgrade.x+"")&&G(_,p),C&2&&d!==(d=T[1].upgrade.e+"")&&G(v,d)},d(T){T&&k(e)}}}function Sf(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Mf(t),b=t[1].fwconsent===2&&Nf();return{c(){e=m("div"),l=y(`Latest version:
`),n=m("a"),o=y(i),a=h(),_&&_.c(),f=h(),b&&b.c(),c=Ge(),u(n,"href",r=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(d,v){w(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),w(d,f,v),b&&b.m(d,v),w(d,c,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&G(o,i),(!p||v&4&&r!==(r=d[2].html_url))&&u(n,"href",r),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&N(_,1)):(_=Mf(d),_.c(),N(_,1),_.m(e,null)):_&&(Ae(),D(_,1,1,()=>{_=null}),De()),d[1].fwconsent===2?b||(b=Nf(),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i(d){p||(N(_),p=!0)},o(d){D(_),p=!1},d(d){d&&k(e),_&&_.d(),d&&k(f),b&&b.d(d),d&&k(c)}}}function Mf(t){let e,l,n,i,o,r;return n=new Ec({}),{c(){e=m("div"),l=m("button"),Z(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(a,f){w(a,e,f),s(e,l),Q(n,l,null),i=!0,o||(r=K(l,"click",t[10]),o=!0)},p:ne,i(a){i||(N(n.$$.fragment,a),i=!0)},o(a){D(n.$$.fragment,a),i=!1},d(a){a&&k(e),X(n),o=!1,r()}}}function Nf(t){let e;return{c(){e=m("div"),e.innerHTML='<div class="bd-yellow">You have disabled one-click firmware upgrade, link to self-upgrade is disabled</div>',u(e,"class","my-2")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Pf(t){let e,l=gs(ce(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=y(l),u(e,"class","bd-red")},m(i,o){w(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=gs(ce(i[1].chip,i[1].board))+"")&&G(n,l)},d(i){i&&k(e)}}}function Af(t){let e,l,n,i,o,r;function a(p,_){return p[4].length==0?a0:r0}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),c.c(),zf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){w(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(r=[K(n,"change",t[13]),K(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&k(e),t[12](null),c.d(),o=!1,Ke(r)}}}function r0(t){let e=t[4][0].name+"",l,n,i;return{c(){l=y(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,r){w(o,l,r),w(o,n,r),w(o,i,r)},p(o,r){r&16&&e!==(e=o[4][0].name+"")&&G(l,e)},d(o){o&&k(l),o&&k(n),o&&k(i)}}}function a0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){w(i,e,o),l||(n=K(e,"click",t[14]),l=!0)},p:ne,d(i){i&&k(e),l=!1,n()}}}function Df(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g=t[9],T=[];for(let S=0;S<g.length;S+=1)T[S]=Ef(kf(t,g,S));let C=t[7].length==0&&If();function $(S,A){return S[7].length==0?c0:f0}let M=$(t),E=M(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Backup & restore",n=h(),i=m("form"),o=m("div");for(let S=0;S<T.length;S+=1)T[S].c();r=h(),a=m("label"),a.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',f=h(),C&&C.c(),c=h(),p=m("form"),_=m("input"),b=h(),E.c(),u(l,"class","text-sm"),u(a,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),zf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(S,A){w(S,e,A),s(e,l),s(e,n),s(e,i),s(i,o);for(let I=0;I<T.length;I+=1)T[I]&&T[I].m(o,null);s(o,r),s(o,a),s(i,f),C&&C.m(i,null),s(e,c),s(e,p),s(p,_),t[16](_),s(p,b),E.m(p,null),d||(v=[K(_,"change",t[17]),K(p,"submit",t[19])],d=!0)},p(S,A){if(A&512){g=S[9];let I;for(I=0;I<g.length;I+=1){const F=kf(S,g,I);T[I]?T[I].p(F,A):(T[I]=Ef(F),T[I].c(),T[I].m(o,r))}for(;I<T.length;I+=1)T[I].d(1);T.length=g.length}S[7].length==0?C||(C=If(),C.c(),C.m(i,null)):C&&(C.d(1),C=null),M===(M=$(S))&&E?E.p(S,A):(E.d(1),E=M(S),E&&(E.c(),E.m(p,null)))},d(S){S&&k(e),fl(T,S),C&&C.d(),t[16](null),E.d(),d=!1,Ke(v)}}}function Ef(t){let e,l,n,i=t[20].name+"",o;return{c(){e=m("label"),l=m("input"),n=h(),o=y(i),u(l,"type","checkbox"),u(l,"class","rounded"),u(l,"name",t[20].key),l.value="true",l.checked=!0,u(e,"class","my-1 mx-3")},m(r,a){w(r,e,a),s(e,l),s(e,n),s(e,o)},p:ne,d(r){r&&k(e)}}}function If(t){let e;return{c(){e=m("button"),e.textContent="Download",u(e,"type","submit"),u(e,"class","btn-pri-sm float-right")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function f0(t){let e=t[7][0].name+"",l,n,i;return{c(){l=y(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm")},m(o,r){w(o,l,r),w(o,n,r),w(o,i,r)},p(o,r){r&128&&e!==(e=o[7][0].name+"")&&G(l,e)},d(o){o&&k(l),o&&k(n),o&&k(i)}}}function c0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select file...",u(e,"type","button"),u(e,"class","btn-pri-sm")},m(i,o){w(i,e,o),l||(n=K(e,"click",t[18]),l=!0)},p:ne,d(i){i&&k(e),l=!1,n()}}}function m0(t){let e,l,n,i,o,r,a=t[1].chip+"",f,c,p=t[1].cpu+"",_,b,d,v,g,T,C,$,M,E=t[1].mac+"",S,A,I,F,Y,U,H,q,z,O,R,B,L,j,W,ee=t[1].version+"",le,pe,ie,Te,je=(t[1].security==0||t[0].a)&&ii(t[1].board),Pe,We,be,ke,Ie,ge,ae,we,J;T=new Fl({props:{to:"/vendor",$$slots:{default:[i0]},$$scope:{ctx:t}}});let se=t[1].apmac&&t[1].apmac!=t[1].mac&&wf(t);Y=new Fl({props:{to:"/consent",$$slots:{default:[u0]},$$scope:{ctx:t}}});let Ee=t[1].meter&&yf(t),Fe=t[1].net&&Cf(t),_e=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&Tf(t),ye=t[2]&&Sf(t),Ne=je&&Pf(t),de=(t[1].security==0||t[0].a)&&Af(t),Ce=(t[1].security==0||t[0].a)&&Df(t);return ke=new Dt({props:{active:t[5],message:"Uploading firmware, please wait"}}),ge=new Dt({props:{active:t[8],message:"Uploading configuration, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),n.textContent="Device information",i=h(),o=m("div"),r=y("Chip: "),f=y(a),c=y(" ("),_=y(p),b=y("MHz)"),d=h(),v=m("div"),g=y("Device: "),Z(T.$$.fragment),C=h(),$=m("div"),M=y("MAC: "),S=y(E),A=h(),se&&se.c(),I=h(),F=m("div"),Z(Y.$$.fragment),U=h(),H=m("button"),H.textContent="Reboot",q=h(),Ee&&Ee.c(),z=h(),Fe&&Fe.c(),O=h(),R=m("div"),B=m("strong"),B.textContent="Firmware",L=h(),j=m("div"),W=y("Installed version: "),le=y(ee),pe=h(),_e&&_e.c(),ie=h(),ye&&ye.c(),Te=h(),Ne&&Ne.c(),Pe=h(),de&&de.c(),We=h(),Ce&&Ce.c(),be=h(),Z(ke.$$.fragment),Ie=h(),Z(ge.$$.fragment),u(n,"class","text-sm"),u(o,"class","my-2"),u(v,"class","my-2"),u($,"class","my-2"),u(H,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),u(F,"class","my-2"),u(l,"class","cnt"),u(B,"class","text-sm"),u(j,"class","my-2"),u(R,"class","cnt"),u(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(x,oe){w(x,e,oe),s(e,l),s(l,n),s(l,i),s(l,o),s(o,r),s(o,f),s(o,c),s(o,_),s(o,b),s(l,d),s(l,v),s(v,g),Q(T,v,null),s(l,C),s(l,$),s($,M),s($,S),s(l,A),se&&se.m(l,null),s(l,I),s(l,F),Q(Y,F,null),s(F,U),s(F,H),s(e,q),Ee&&Ee.m(e,null),s(e,z),Fe&&Fe.m(e,null),s(e,O),s(e,R),s(R,B),s(R,L),s(R,j),s(j,W),s(j,le),s(R,pe),_e&&_e.m(R,null),s(R,ie),ye&&ye.m(R,null),s(R,Te),Ne&&Ne.m(R,null),s(R,Pe),de&&de.m(R,null),s(e,We),Ce&&Ce.m(e,null),w(x,be,oe),Q(ke,x,oe),w(x,Ie,oe),Q(ge,x,oe),ae=!0,we||(J=K(H,"click",t[11]),we=!0)},p(x,[oe]){(!ae||oe&2)&&a!==(a=x[1].chip+"")&&G(f,a),(!ae||oe&2)&&p!==(p=x[1].cpu+"")&&G(_,p);const Oe={};oe&8388610&&(Oe.$$scope={dirty:oe,ctx:x}),T.$set(Oe),(!ae||oe&2)&&E!==(E=x[1].mac+"")&&G(S,E),x[1].apmac&&x[1].apmac!=x[1].mac?se?(se.p(x,oe),oe&2&&N(se,1)):(se=wf(x),se.c(),N(se,1),se.m(l,I)):se&&(Ae(),D(se,1,1,()=>{se=null}),De());const ue={};oe&8388608&&(ue.$$scope={dirty:oe,ctx:x}),Y.$set(ue),x[1].meter?Ee?Ee.p(x,oe):(Ee=yf(x),Ee.c(),Ee.m(e,z)):Ee&&(Ee.d(1),Ee=null),x[1].net?Fe?Fe.p(x,oe):(Fe=Cf(x),Fe.c(),Fe.m(e,O)):Fe&&(Fe.d(1),Fe=null),(!ae||oe&2)&&ee!==(ee=x[1].version+"")&&G(le,ee),x[1].upgrade.t&&x[1].upgrade.t!=x[1].version?_e?_e.p(x,oe):(_e=Tf(x),_e.c(),_e.m(R,ie)):_e&&(_e.d(1),_e=null),x[2]?ye?(ye.p(x,oe),oe&4&&N(ye,1)):(ye=Sf(x),ye.c(),N(ye,1),ye.m(R,Te)):ye&&(Ae(),D(ye,1,1,()=>{ye=null}),De()),oe&3&&(je=(x[1].security==0||x[0].a)&&ii(x[1].board)),je?Ne?Ne.p(x,oe):(Ne=Pf(x),Ne.c(),Ne.m(R,Pe)):Ne&&(Ne.d(1),Ne=null),x[1].security==0||x[0].a?de?de.p(x,oe):(de=Af(x),de.c(),de.m(R,null)):de&&(de.d(1),de=null),x[1].security==0||x[0].a?Ce?Ce.p(x,oe):(Ce=Df(x),Ce.c(),Ce.m(e,null)):Ce&&(Ce.d(1),Ce=null);const ve={};oe&32&&(ve.active=x[5]),ke.$set(ve);const dt={};oe&256&&(dt.active=x[8]),ge.$set(dt)},i(x){ae||(N(T.$$.fragment,x),N(se),N(Y.$$.fragment,x),N(ye),N(ke.$$.fragment,x),N(ge.$$.fragment,x),ae=!0)},o(x){D(T.$$.fragment,x),D(se),D(Y.$$.fragment,x),D(ye),D(ke.$$.fragment,x),D(ge.$$.fragment,x),ae=!1},d(x){x&&k(e),X(T),se&&se.d(),X(Y),Ee&&Ee.d(),Fe&&Fe.d(),_e&&_e.d(),ye&&ye.d(),Ne&&Ne.d(),de&&de.d(),Ce&&Ce.d(),x&&k(be),X(ke,x),x&&k(Ie),X(ge,x),we=!1,J()}}}async function p0(){await(await fetch("/reboot",{method:"POST"})).json()}function _0(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],r={};bo.subscribe(I=>{l(2,r=Ac(i.version,I)),r||l(2,r=I[0])});function a(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(gs(ce(i.chip,i.board))))&&(Ot.update(I=>(I.upgrading=!0,I)),Pc(r.tag_name))}const f=function(){confirm("Are you sure you want to reboot the device?")&&(Ot.update(I=>(I.booting=!0,I)),p0())};let c,p=[],_=!1,b,d=[],v=!1;_o();function g(I){vs[I?"unshift":"push"](()=>{c=I,l(3,c)})}function T(){p=this.files,l(4,p)}const C=()=>{c.click()},$=()=>l(5,_=!0);function M(I){vs[I?"unshift":"push"](()=>{b=I,l(6,b)})}function E(){d=this.files,l(7,d)}const S=()=>{b.click()},A=()=>l(8,v=!0);return t.$$set=I=>{"data"in I&&l(0,n=I.data),"sysinfo"in I&&l(1,i=I.sysinfo)},[n,i,r,c,p,_,b,d,v,o,a,f,g,T,C,$,M,E,S,A]}class d0 extends Me{constructor(e){super(),Se(this,e,_0,m0,$e,{data:0,sysinfo:1})}}function Ff(t){let e,l,n=ce(t[0],7)+"",i,o,r=ce(t[0],5)+"",a,f,c=ce(t[0],4)+"",p,_,b=ce(t[0],3)+"",d,v,g,T,C=ce(t[0],2)+"",$,M,E=ce(t[0],1)+"",S,A,I=ce(t[0],0)+"",F,Y,U,H,q=ce(t[0],101)+"",z,O,R=ce(t[0],100)+"",B;return{c(){e=m("optgroup"),l=m("option"),i=y(n),o=m("option"),a=y(r),f=m("option"),p=y(c),_=m("option"),d=y(b),v=h(),g=m("optgroup"),T=m("option"),$=y(C),M=m("option"),S=y(E),A=m("option"),F=y(I),Y=h(),U=m("optgroup"),H=m("option"),z=y(q),O=m("option"),B=y(R),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),T.__value=2,T.value=T.__value,M.__value=1,M.value=M.__value,A.__value=0,A.value=A.__value,u(g,"label","Custom hardware"),H.__value=101,H.value=H.__value,O.__value=100,O.value=O.__value,u(U,"label","Generic hardware")},m(L,j){w(L,e,j),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),w(L,v,j),w(L,g,j),s(g,T),s(T,$),s(g,M),s(M,S),s(g,A),s(A,F),w(L,Y,j),w(L,U,j),s(U,H),s(H,z),s(U,O),s(O,B)},p(L,j){j&1&&n!==(n=ce(L[0],7)+"")&&G(i,n),j&1&&r!==(r=ce(L[0],5)+"")&&G(a,r),j&1&&c!==(c=ce(L[0],4)+"")&&G(p,c),j&1&&b!==(b=ce(L[0],3)+"")&&G(d,b),j&1&&C!==(C=ce(L[0],2)+"")&&G($,C),j&1&&E!==(E=ce(L[0],1)+"")&&G(S,E),j&1&&I!==(I=ce(L[0],0)+"")&&G(F,I),j&1&&q!==(q=ce(L[0],101)+"")&&G(z,q),j&1&&R!==(R=ce(L[0],100)+"")&&G(B,R)},d(L){L&&k(e),L&&k(v),L&&k(g),L&&k(Y),L&&k(U)}}}function Rf(t){let e,l,n=ce(t[0],201)+"",i,o,r=ce(t[0],202)+"",a,f,c=ce(t[0],203)+"",p,_,b=ce(t[0],200)+"",d;return{c(){e=m("optgroup"),l=m("option"),i=y(n),o=m("option"),a=y(r),f=m("option"),p=y(c),_=m("option"),d=y(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(v,g){w(v,e,g),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d)},p(v,g){g&1&&n!==(n=ce(v[0],201)+"")&&G(i,n),g&1&&r!==(r=ce(v[0],202)+"")&&G(a,r),g&1&&c!==(c=ce(v[0],203)+"")&&G(p,c),g&1&&b!==(b=ce(v[0],200)+"")&&G(d,b)},d(v){v&&k(e)}}}function Lf(t){let e,l,n=ce(t[0],7)+"",i,o,r=ce(t[0],6)+"",a,f,c=ce(t[0],5)+"",p,_,b,d,v=ce(t[0],51)+"",g,T,C=ce(t[0],50)+"",$;return{c(){e=m("optgroup"),l=m("option"),i=y(n),o=m("option"),a=y(r),f=m("option"),p=y(c),_=h(),b=m("optgroup"),d=m("option"),g=y(v),T=m("option"),$=y(C),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,u(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,T.__value=50,T.value=T.__value,u(b,"label","Generic hardware")},m(M,E){w(M,e,E),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),w(M,_,E),w(M,b,E),s(b,d),s(d,g),s(b,T),s(T,$)},p(M,E){E&1&&n!==(n=ce(M[0],7)+"")&&G(i,n),E&1&&r!==(r=ce(M[0],6)+"")&&G(a,r),E&1&&c!==(c=ce(M[0],5)+"")&&G(p,c),E&1&&v!==(v=ce(M[0],51)+"")&&G(g,v),E&1&&C!==(C=ce(M[0],50)+"")&&G($,C)},d(M){M&&k(e),M&&k(_),M&&k(b)}}}function Uf(t){let e,l,n=ce(t[0],8)+"",i,o,r,a,f=ce(t[0],71)+"",c,p,_=ce(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=y(n),o=h(),r=m("optgroup"),a=m("option"),c=y(f),p=m("option"),b=y(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,u(r,"label","Generic hardware")},m(d,v){w(d,e,v),s(e,l),s(l,i),w(d,o,v),w(d,r,v),s(r,a),s(a,c),s(r,p),s(p,b)},p(d,v){v&1&&n!==(n=ce(d[0],8)+"")&&G(i,n),v&1&&f!==(f=ce(d[0],71)+"")&&G(c,f),v&1&&_!==(_=ce(d[0],70)+"")&&G(b,_)},d(d){d&&k(e),d&&k(o),d&&k(r)}}}function Of(t){let e,l,n=ce(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=y(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,r){w(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=ce(o[0],200)+"")&&G(i,n)},d(o){o&&k(e)}}}function v0(t){let e,l,n,i,o,r,a,f=t[0]=="esp8266"&&Ff(t),c=t[0]=="esp32"&&Rf(t),p=t[0]=="esp32s2"&&Lf(t),_=t[0]=="esp32c3"&&Uf(t),b=t[0]=="esp32solo"&&Of(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),c&&c.c(),i=h(),p&&p.c(),o=h(),_&&_.c(),r=h(),b&&b.c(),a=Ge(),e.__value=-1,e.value=e.__value},m(d,v){w(d,e,v),w(d,l,v),f&&f.m(d,v),w(d,n,v),c&&c.m(d,v),w(d,i,v),p&&p.m(d,v),w(d,o,v),_&&_.m(d,v),w(d,r,v),b&&b.m(d,v),w(d,a,v)},p(d,[v]){d[0]=="esp8266"?f?f.p(d,v):(f=Ff(d),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"?c?c.p(d,v):(c=Rf(d),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Lf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Uf(d),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),d[0]=="esp32solo"?b?b.p(d,v):(b=Of(d),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:ne,o:ne,d(d){d&&k(e),d&&k(l),f&&f.d(d),d&&k(n),c&&c.d(d),d&&k(i),p&&p.d(d),d&&k(o),_&&_.d(d),d&&k(r),b&&b.d(d),d&&k(a)}}}function h0(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class b0 extends Me{constructor(e){super(),Se(this,e,h0,v0,$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",u(e,"class","bd-red")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function Hf(t){let e,l,n,i,o,r,a;return r=new Rc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=y("HAN GPIO"),n=m("br"),i=h(),o=m("select"),Z(r.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){w(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),Q(r,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),r.$set(p)},i(f){a||(N(r.$$.fragment,f),a=!0)},o(f){D(r.$$.fragment,f),a=!1},d(f){f&&k(e),X(r)}}}function g0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O=t[0].usrcfg&&qf();v=new b0({props:{chip:t[0].chip}});let R=t[0].board&&t[0].board>20&&Hf(t);return U=new Dt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Initial configuration",a=h(),O&&O.c(),f=h(),c=m("div"),p=y("Board type"),_=m("br"),b=h(),d=m("select"),Z(v.$$.fragment),g=h(),R&&R.c(),T=h(),C=m("div"),$=m("label"),M=m("input"),E=y(" Clear all other configuration"),S=h(),A=m("div"),A.innerHTML='<button type="submit" class="btn-pri">Save</button>',I=h(),F=m("span"),F.textContent="\xA0",Y=h(),Z(U.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),t[0].board===void 0&&tt(()=>t[4].call(d)),u(c,"class","my-3"),u(M,"type","checkbox"),u(M,"name","vr"),M.__value="true",M.value=M.__value,u(M,"class","rounded mb-1"),u(C,"class","my-3"),u(A,"class","my-3"),u(F,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(B,L){w(B,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),O&&O.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,b),s(c,d),Q(v,d,null),Ue(d,t[0].board,!0),s(n,g),R&&R.m(n,null),s(n,T),s(n,C),s(C,$),s($,M),M.checked=t[2],s($,E),s(n,S),s(n,A),s(n,I),s(n,F),w(B,Y,L),Q(U,B,L),H=!0,q||(z=[K(d,"change",t[4]),K(M,"change",t[5]),K(n,"submit",ks(t[3]))],q=!0)},p(B,[L]){B[0].usrcfg?O||(O=qf(),O.c(),O.m(n,f)):O&&(O.d(1),O=null);const j={};L&1&&(j.chip=B[0].chip),v.$set(j),L&1&&Ue(d,B[0].board),B[0].board&&B[0].board>20?R?(R.p(B,L),L&1&&N(R,1)):(R=Hf(B),R.c(),N(R,1),R.m(n,T)):R&&(Ae(),D(R,1,1,()=>{R=null}),De()),L&4&&(M.checked=B[2]);const W={};L&2&&(W.active=B[1]),U.$set(W)},i(B){H||(N(v.$$.fragment,B),N(R),N(U.$$.fragment,B),H=!0)},o(B){D(v.$$.fragment,B),D(R),D(U.$$.fragment,B),H=!1},d(B){B&&k(e),O&&O.d(),X(v),R&&R.d(),B&&k(Y),X(U,B),q=!1,Ke(z)}}}function k0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let v of p){const[g,T]=v;_.append(g,T)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Ot.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),ni(n.usrcfg?"/":"/setup")}let r=!1;function a(){n.board=_t(this),l(0,n)}function f(){r=this.checked,l(2,r),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,f]}class w0 extends Me{constructor(e){super(),Se(this,e,k0,g0,$e,{sysinfo:0})}}function jf(t){let e,l,n,i,o,r,a,f;return a=new Lc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),r=m("select"),Z(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.required=t[1],u(n,"class","flex")},m(c,p){w(c,e,p),w(c,l,p),w(c,n,p),s(n,i),s(n,o),s(n,r),Q(a,r,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(r.required=c[1])},i(c){f||(N(a.$$.fragment,c),f=!0)},o(c){D(a.$$.fragment,c),f=!1},d(c){c&&k(e),c&&k(l),c&&k(n),X(a)}}}function Wf(t){let e;return{c(){e=m("div"),e.innerHTML=`<div>Gateway<br/>
<input name="sg" type="text" class="in-f w-full"/></div>
<div>DNS<br/>
<input name="sd" type="text" class="in-l w-full"/></div>`,u(e,"class","my-3 flex")},m(l,n){w(l,e,n)},d(l){l&&k(e)}}}function y0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z=t[1]&&jf(t),O=t[1]&&Wf();return Y=new Dt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Setup",a=h(),f=m("div"),f.innerHTML=`SSID<br/>
<input name="ss" type="text" class="in-s" required=""/>`,c=h(),p=m("div"),p.innerHTML=`PSK<br/>
<input name="sp" type="password" class="in-s" autocomplete="off"/>`,_=h(),b=m("div"),d=y(`Hostname
`),v=m("input"),g=h(),T=m("div"),C=m("label"),$=m("input"),M=y(" Static IP"),E=h(),z&&z.c(),S=h(),O&&O.c(),A=h(),I=m("div"),I.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=h(),Z(Y.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"class","text-sm"),u(f,"class","my-3"),u(p,"class","my-3"),u(v,"name","sh"),u(v,"type","text"),u(v,"class","in-s"),u(v,"maxlength","32"),u(v,"pattern","[a-z0-9_-]+"),u(v,"placeholder","Optional, ex.: ams-reader"),u(v,"autocomplete","off"),u($,"type","checkbox"),u($,"name","sm"),$.__value="static",$.value=$.__value,u($,"class","rounded mb-1"),u(T,"class","my-3"),u(I,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(R,B){w(R,e,B),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(n,c),s(n,p),s(n,_),s(n,b),s(b,d),s(b,v),V(v,t[0].hostname),s(n,g),s(n,T),s(T,C),s(C,$),$.checked=t[1],s(C,M),s(T,E),z&&z.m(T,null),s(n,S),O&&O.m(n,null),s(n,A),s(n,I),w(R,F,B),Q(Y,R,B),U=!0,H||(q=[K(v,"input",t[4]),K($,"change",t[5]),K(n,"submit",ks(t[3]))],H=!0)},p(R,[B]){B&1&&v.value!==R[0].hostname&&V(v,R[0].hostname),B&2&&($.checked=R[1]),R[1]?z?(z.p(R,B),B&2&&N(z,1)):(z=jf(R),z.c(),N(z,1),z.m(T,null)):z&&(Ae(),D(z,1,1,()=>{z=null}),De()),R[1]?O||(O=Wf(),O.c(),O.m(n,A)):O&&(O.d(1),O=null);const L={};B&4&&(L.active=R[2]),Y.$set(L)},i(R){U||(N(z),N(Y.$$.fragment,R),U=!0)},o(R){D(z),D(Y.$$.fragment,R),U=!1},d(R){R&&k(e),z&&z.d(),O&&O.d(),R&&k(F),X(Y,R),H=!1,Ke(q)}}}function C0(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){b();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Ot.update(v=>(v.trying=_,v));var d=new XMLHttpRequest;d.timeout=5e3,d.addEventListener("abort",b),d.addEventListener("error",b),d.addEventListener("timeout",b),d.addEventListener("load",function(v){window.location.href=_||"/"}),d.open("GET",_+"/is-alive",!0),d.send()}async function f(_){l(2,o=!0);const b=new FormData(_.target),d=new URLSearchParams;for(let T of b){const[C,$]=T;d.append(C,$)}let g=await(await fetch("/save",{method:"POST",body:d})).json();l(2,o=!1),Ot.update(T=>(T.hostname=b.get("sh"),T.usrcfg=g.success,T.booting=g.reboot,i&&(T.net.ip=b.get("si"),T.net.mask=b.get("su"),T.net.gw=b.get("sg"),T.net.dns1=b.get("sd")),setTimeout(a,5e3),T))}function c(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,f,c,p]}class $0 extends Me{constructor(e){super(),Se(this,e,C0,y0,$e,{sysinfo:0})}}function T0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C;return v=new Dt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=y("Upload "),o=y(t[1]),r=h(),a=m("p"),a.textContent="Select a suitable file and click upload",f=h(),c=m("form"),p=m("input"),_=h(),b=m("div"),b.innerHTML='<button type="submit" class="btn-pri">Upload</button>',d=h(),Z(v.$$.fragment),u(a,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(b,"class","w-full text-right mt-4"),u(c,"action",t[0]),u(c,"enctype","multipart/form-data"),u(c,"method","post"),u(c,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m($,M){w($,e,M),s(e,l),s(l,n),s(n,i),s(n,o),s(l,r),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,b),w($,d,M),Q(v,$,M),g=!0,T||(C=K(c,"submit",t[3]),T=!0)},p($,[M]){(!g||M&2)&&G(o,$[1]),(!g||M&1)&&u(c,"action",$[0]);const E={};M&4&&(E.active=$[2]),v.$set(E)},i($){g||(N(v.$$.fragment,$),g=!0)},o($){D(v.$$.fragment,$),g=!1},d($){$&&k(e),$&&k(d),X(v,$),T=!1,C()}}}function S0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}class go extends Me{constructor(e){super(),Se(this,e,S0,T0,$e,{action:0,title:1})}}function M0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E,S,A,I,F,Y,U,H,q,z,O,R;return q=new Dt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),r=m("hr"),a=h(),f=m("div"),c=y("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=h(),b=m("a"),d=y("Read more"),v=m("br"),g=h(),T=m("label"),C=m("input"),M=y(" Yes"),E=m("label"),S=m("input"),I=y(" No"),F=m("br"),Y=h(),U=m("div"),U.innerHTML='<button type="submit" class="btn-pri">Save</button>',H=h(),Z(q.$$.fragment),u(b,"href",Ut("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u(C,"type","radio"),u(C,"name","sf"),C.value=1,C.checked=$=t[0].fwconsent===1,u(C,"class","rounded m-2"),C.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=A=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(f,"class","my-3"),u(U,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(B,L){w(B,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,b),s(b,d),s(f,v),s(f,g),s(f,T),s(T,C),s(T,M),s(f,E),s(E,S),s(E,I),s(f,F),s(n,Y),s(n,U),w(B,H,L),Q(q,B,L),z=!0,O||(R=K(n,"submit",ks(t[2])),O=!0)},p(B,[L]){(!z||L&1&&$!==($=B[0].fwconsent===1))&&(C.checked=$),(!z||L&1&&A!==(A=B[0].fwconsent===2))&&(S.checked=A);const j={};L&2&&(j.active=B[1]),q.$set(j)},i(B){z||(N(q.$$.fragment,B),z=!0)},o(B){D(q.$$.fragment,B),z=!1},d(B){B&&k(e),B&&k(H),X(q,B),O=!1,R()}}}function N0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),f=new URLSearchParams;for(let _ of a){const[b,d]=_;f.append(b,d)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),Ot.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),ni("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.sysinfo)},[n,i,o]}class P0 extends Me{constructor(e){super(),Se(this,e,N0,M0,$e,{sysinfo:0})}}function A0(t){let e,l;return e=new Pp({props:{data:t[1],sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function D0(t){let e,l;return e=new n0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function E0(t){let e,l;return e=new d0({props:{sysinfo:t[0],data:t[1]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function I0(t){let e,l;return e=new go({props:{title:"CA",action:"/mqtt-ca"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function F0(t){let e,l;return e=new go({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function R0(t){let e,l;return e=new go({props:{title:"private key",action:"/mqtt-key"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function L0(t){let e,l;return e=new P0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function U0(t){let e,l;return e=new $0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function O0(t){let e,l;return e=new w0({props:{sysinfo:t[0]}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function q0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,T,C,$,M,E;return e=new Gm({props:{data:t[1]}}),n=new $l({props:{path:"/",$$slots:{default:[A0]},$$scope:{ctx:t}}}),o=new $l({props:{path:"/configuration",$$slots:{default:[D0]},$$scope:{ctx:t}}}),a=new $l({props:{path:"/status",$$slots:{default:[E0]},$$scope:{ctx:t}}}),c=new $l({props:{path:"/mqtt-ca",$$slots:{default:[I0]},$$scope:{ctx:t}}}),_=new $l({props:{path:"/mqtt-cert",$$slots:{default:[F0]},$$scope:{ctx:t}}}),d=new $l({props:{path:"/mqtt-key",$$slots:{default:[R0]},$$scope:{ctx:t}}}),g=new $l({props:{path:"/consent",$$slots:{default:[L0]},$$scope:{ctx:t}}}),C=new $l({props:{path:"/setup",$$slots:{default:[U0]},$$scope:{ctx:t}}}),M=new $l({props:{path:"/vendor",$$slots:{default:[O0]},$$scope:{ctx:t}}}),{c(){Z(e.$$.fragment),l=h(),Z(n.$$.fragment),i=h(),Z(o.$$.fragment),r=h(),Z(a.$$.fragment),f=h(),Z(c.$$.fragment),p=h(),Z(_.$$.fragment),b=h(),Z(d.$$.fragment),v=h(),Z(g.$$.fragment),T=h(),Z(C.$$.fragment),$=h(),Z(M.$$.fragment)},m(S,A){Q(e,S,A),w(S,l,A),Q(n,S,A),w(S,i,A),Q(o,S,A),w(S,r,A),Q(a,S,A),w(S,f,A),Q(c,S,A),w(S,p,A),Q(_,S,A),w(S,b,A),Q(d,S,A),w(S,v,A),Q(g,S,A),w(S,T,A),Q(C,S,A),w(S,$,A),Q(M,S,A),E=!0},p(S,A){const I={};A&2&&(I.data=S[1]),e.$set(I);const F={};A&7&&(F.$$scope={dirty:A,ctx:S}),n.$set(F);const Y={};A&5&&(Y.$$scope={dirty:A,ctx:S}),o.$set(Y);const U={};A&7&&(U.$$scope={dirty:A,ctx:S}),a.$set(U);const H={};A&4&&(H.$$scope={dirty:A,ctx:S}),c.$set(H);const q={};A&4&&(q.$$scope={dirty:A,ctx:S}),_.$set(q);const z={};A&4&&(z.$$scope={dirty:A,ctx:S}),d.$set(z);const O={};A&5&&(O.$$scope={dirty:A,ctx:S}),g.$set(O);const R={};A&5&&(R.$$scope={dirty:A,ctx:S}),C.$set(R);const B={};A&5&&(B.$$scope={dirty:A,ctx:S}),M.$set(B)},i(S){E||(N(e.$$.fragment,S),N(n.$$.fragment,S),N(o.$$.fragment,S),N(a.$$.fragment,S),N(c.$$.fragment,S),N(_.$$.fragment,S),N(d.$$.fragment,S),N(g.$$.fragment,S),N(C.$$.fragment,S),N(M.$$.fragment,S),E=!0)},o(S){D(e.$$.fragment,S),D(n.$$.fragment,S),D(o.$$.fragment,S),D(a.$$.fragment,S),D(c.$$.fragment,S),D(_.$$.fragment,S),D(d.$$.fragment,S),D(g.$$.fragment,S),D(C.$$.fragment,S),D(M.$$.fragment,S),E=!1},d(S){X(e,S),S&&k(l),X(n,S),S&&k(i),X(o,S),S&&k(r),X(a,S),S&&k(f),X(c,S),S&&k(p),X(_,S),S&&k(b),X(d,S),S&&k(v),X(g,S),S&&k(T),X(C,S),S&&k($),X(M,S)}}}function H0(t){let e,l,n,i;const o=[G0,W0],r=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=Ge()},m(f,c){r[e].m(f,c),w(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Ae(),D(r[p],1,1,()=>{r[p]=null}),De(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&k(n)}}}function j0(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function W0(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function G0(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){Z(e.$$.fragment)},m(n,i){Q(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){X(e,n)}}}function B0(t){let e,l,n,i,o,r;l=new vc({props:{$$slots:{default:[q0]},$$scope:{ctx:t}}});const a=[j0,H0],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),Z(l.$$.fragment),n=h(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){w(p,e,_),Q(l,e,null),s(e,n),~i&&f[i].m(e,null),r=!0},p(p,[_]){const b={};_&7&&(b.$$scope={dirty:_,ctx:p}),l.$set(b);let d=i;i=c(p),i===d?~i&&f[i].p(p,_):(o&&(Ae(),D(f[d],1,1,()=>{f[d]=null}),De()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),N(o,1),o.m(e,null)):o=null)},i(p){r||(N(l.$$.fragment,p),N(o),r=!0)},o(p){D(l.$$.fragment,p),D(o),r=!1},d(p){p&&k(e),X(l),~i&&f[i].d()}}}function z0(t,e,l){let n={};Ot.subscribe(o=>{l(0,n=o),n.vndcfg===!1?ni("/vendor"):n.usrcfg===!1?ni("/setup"):n.fwconsent===0&&ni("/consent")}),_o();let i={};return fm.subscribe(o=>{l(1,i=o)}),[n,i]}class Y0 extends Me{constructor(e){super(),Se(this,e,z0,B0,$e,{})}}new Y0({target:document.getElementById("app")});