Files
UtilitechAS.amsreader-firmware/lib/SvelteUi/app/dist/index.js
Gunnar Skjold fffd95dcf2 Price config
2023-12-25 14:47:28 +01:00

15 lines
226 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 u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&n(u)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function pe(){}function ol(t,e){for(const l in e)t[l]=e[l];return t}function oc(t){return t()}function pa(){return Object.create(null)}function ze(t){t.forEach(oc)}function so(t){return typeof t=="function"}function Ee(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let rs;function Ws(t,e){return rs||(rs=document.createElement("a")),rs.href=e,t===rs.href}function s1(t){return Object.keys(t).length===0}function oo(t,...e){if(t==null)return pe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function li(t){let e;return oo(t,l=>e=l)(),e}function pl(t,e,l){t.$$.on_destroy.push(oo(e,l))}function ro(t,e,l,n){if(t){const i=rc(t,e,l,n);return t[0](i)}}function rc(t,e,l,n){return t[1]&&n?ol(l.ctx.slice(),t[1](n(e))):l.ctx}function ao(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let a=0;a<u;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function uo(t,e,l,n,i,o){if(i){const u=rc(e,l,n,o);t.p(u,i)}}function fo(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 ms(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function _s(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 o1=["",!0,1,"true","contenteditable"];function s(t,e){t.appendChild(e)}function S(t,e,l){t.insertBefore(e,l||null)}function $(t){t.parentNode&&t.parentNode.removeChild(t)}function dt(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 De(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function E(t){return document.createTextNode(t)}function h(){return E(" ")}function Ke(){return E("")}function te(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function wi(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const r1=["width","height"];function ni(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&&r1.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function ge(t){return t===""?null:+t}function a1(t){return Array.from(t.childNodes)}function J(t,e){e=""+e,t.data!==e&&(t.data=e)}function u1(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function f1(t,e,l){~o1.indexOf(l)?u1(t,e):J(t,e)}function oe(t,e){t.value=e==null?"":e}function co(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function $e(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 tt(t){const e=t.querySelector(":checked");return e&&e.__value}let as;function c1(){if(as===void 0){as=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{as=!0}}return as}function mo(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=c1();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=te(window,"message",u=>{u.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=te(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),$(n)}}function m1(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function da(t,e){return new t(e)}let ki;function bi(t){ki=t}function yi(){if(!ki)throw new Error("Function called outside component initialization");return ki}function ac(t){yi().$$.on_mount.push(t)}function _1(t){yi().$$.on_destroy.push(t)}function p1(){const t=yi();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=m1(e,l,{cancelable:n});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function gi(t,e){return yi().$$.context.set(t,e),e}function Ul(t){return yi().$$.context.get(t)}const xn=[],ps=[];let ei=[];const va=[],uc=Promise.resolve();let zs=!1;function fc(){zs||(zs=!0,uc.then(cc))}function d1(){return fc(),uc}function We(t){ei.push(t)}const Fs=new Set;let Zn=0;function cc(){if(Zn!==0)return;const t=ki;do{try{for(;Zn<xn.length;){const e=xn[Zn];Zn++,bi(e),v1(e.$$)}}catch(e){throw xn.length=0,Zn=0,e}for(bi(null),xn.length=0,Zn=0;ps.length;)ps.pop()();for(let e=0;e<ei.length;e+=1){const l=ei[e];Fs.has(l)||(Fs.add(l),l())}ei.length=0}while(xn.length);for(;va.length;)va.pop()();zs=!1,Fs.clear(),bi(t)}function v1(t){if(t.fragment!==null){t.update(),ze(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(We)}}function h1(t){const e=[],l=[];ei.forEach(n=>t.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ei=e}const cs=new Set;let sn;function Ae(){sn={r:0,c:[],p:sn}}function Pe(){sn.r||ze(sn.c),sn=sn.p}function O(t,e){t&&t.i&&(cs.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(cs.has(t))return;cs.add(t),sn.c.push(()=>{cs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function mc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],a=e[o];if(a){for(const c in u)c in a||(n[c]=1);for(const c in a)i[c]||(l[c]=a[c],i[c]=1);t[o]=a}else for(const c in u)i[c]=1}for(const u in n)u in l||(l[u]=void 0);return l}function ha(t){return typeof t=="object"&&t!==null?t:{}}function re(t){t&&t.c()}function ie(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||We(()=>{const u=t.$$.on_mount.map(oc).filter(so);t.$$.on_destroy?t.$$.on_destroy.push(...u):ze(u),t.$$.on_mount=[]}),o.forEach(We)}function se(t,e){const l=t.$$;l.fragment!==null&&(h1(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function b1(t,e){t.$$.dirty[0]===-1&&(xn.push(t),fc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Re(t,e,l,n,i,o,u,a=[-1]){const c=ki;bi(t);const f=t.$$={fragment:null,ctx:[],props:o,update:pe,not_equal:i,bound:pa(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:pa(),dirty:a,skip_bound:!1,root:e.target||c.$$.root};u&&u(f.root);let _=!1;if(f.ctx=l?l(t,e.props||{},(p,b,...v)=>{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[p],f.ctx[p]=d)&&(!f.skip_bound&&f.bound[p]&&f.bound[p](d),_&&b1(t,p)),b}):[],f.update(),_=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const p=a1(e.target);f.fragment&&f.fragment.l(p),p.forEach($)}else f.fragment&&f.fragment.c();e.intro&&O(t.$$.fragment),ie(t,e.target,e.anchor,e.customElement),cc()}bi(c)}class Ie{$destroy(){se(this,1),this.$destroy=pe}$on(e,l){if(!so(l))return pe;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&&!s1(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ba=t=>typeof t>"u",_c=t=>typeof t=="function",pc=t=>typeof t=="number";function g1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function dc(){let t=0;return()=>t++}function k1(){return Math.random().toString(36).substring(2)}const jl=typeof window>"u";function vc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const hc=(t,e)=>t?{}:{style:e},Gs=t=>({"aria-hidden":"true",...hc(t,"display:none;")}),Jn=[];function bc(t,e){return{subscribe:it(t,e).subscribe}}function it(t,e=pe){let l;const n=new Set;function i(a){if(Ee(t,a)&&(t=a,l)){const c=!Jn.length;for(const f of n)f[1](),Jn.push(f,t);if(c){for(let f=0;f<Jn.length;f+=2)Jn[f][0](Jn[f+1]);Jn.length=0}}}function o(a){i(a(t))}function u(a,c=pe){const f=[a,c];return n.add(f),n.size===1&&(l=e(i)||pe),a(t),()=>{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:u}}function w1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return bc(l,u=>{let a=!1;const c=[];let f=0,_=pe;const p=()=>{if(f)return;_();const v=e(n?c[0]:c,u);o?u(v):_=so(v)?v:pe},b=i.map((v,d)=>oo(v,g=>{c[d]=g,f&=~(1<<d),a&&p()},()=>{f|=1<<d}));return a=!0,p(),function(){ze(b),_(),a=!1}})}const Ci=t=>`@@svnav-ctx__${t}`,Vs=Ci("LOCATION"),ii=Ci("ROUTER"),gc=Ci("ROUTE"),y1=Ci("ROUTE_PARAMS"),C1=Ci("FOCUS_ELEM"),kc=/^:(.+)/,di=(t,e,l)=>t.substr(e,l),Ks=(t,e)=>di(t,0,e.length)===e,$1=t=>t==="",S1=t=>kc.test(t),wc=t=>t[0]==="*",M1=t=>t.replace(/\*.*$/,""),yc=t=>t.replace(/(^\/+|\/+$)/g,"");function vl(t,e=!1){const l=yc(t).split("/");return e?l.filter(Boolean):l}const qs=(t,e)=>t+(e?`?${e}`:""),_o=t=>`/${yc(t)}`;function $i(...t){const e=n=>vl(n,!0).join("/"),l=t.map(e).join("/");return _o(l)}const po=1,bs=2,cn=3,T1=4,Cc=5,N1=6,$c=7,E1=8,A1=9,Sc=10,Mc=11,P1={[po]:"Link",[bs]:"Route",[cn]:"Router",[T1]:"useFocus",[Cc]:"useLocation",[N1]:"useMatch",[$c]:"useNavigate",[E1]:"useParams",[A1]:"useResolvable",[Sc]:"useResolve",[Mc]:"navigate"},vo=t=>P1[t];function D1(t,e){let l;return t===bs?l=e.path?`path="${e.path}"`:"default":t===po?l=`to="${e.to}"`:t===cn&&(l=`basepath="${e.basepath||""}"`),`<${vo(t)} ${l||""} />`}function R1(t,e,l,n){const i=l&&D1(n||t,l),o=i?`
Occurred in: ${i}`:"",u=vo(t),a=_c(e)?e(u):e;return`<${u}> ${a}${o}`}const Tc=t=>(...e)=>t(R1(...e)),Nc=Tc(t=>{throw new Error(t)}),ds=Tc(console.warn),ga=4,I1=3,L1=2,O1=1,F1=1;function q1(t,e){const l=t.default?0:vl(t.fullPath).reduce((n,i)=>{let o=n;return o+=ga,$1(i)?o+=F1:S1(i)?o+=L1:wc(i)?o-=ga+O1:o+=I1,o},0);return{route:t,score:l,index:e}}function B1(t){return t.map(q1).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function Ec(t,e){let l,n;const[i]=e.split("?"),o=vl(i),u=o[0]==="",a=B1(t);for(let c=0,f=a.length;c<f;c++){const{route:_}=a[c];let p=!1;const b={},v=T=>({..._,params:b,uri:T});if(_.default){n=v(e);continue}const d=vl(_.fullPath),g=Math.max(o.length,d.length);let w=0;for(;w<g;w++){const T=d[w],M=o[w];if(!ba(T)&&wc(T)){const L=T==="*"?"*":T.slice(1);b[L]=o.slice(w).map(decodeURIComponent).join("/");break}if(ba(M)){p=!0;break}const P=kc.exec(T);if(P&&!u){const L=decodeURIComponent(M);b[P[1]]=L}else if(T!==M){p=!0;break}}if(!p){l=v($i(...o.slice(0,w)));break}}return l||n||null}function Ac(t,e){return Ec([t],e)}function U1(t,e){if(Ks(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=vl(l),u=vl(i);if(o[0]==="")return qs(i,n);if(!Ks(o[0],".")){const f=u.concat(o).join("/");return qs((i==="/"?"":"/")+f,n)}const a=u.concat(o),c=[];return a.forEach(f=>{f===".."?c.pop():f!=="."&&c.push(f)}),qs(`/${c.join("/")}`,n)}function ka(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,u=vl(e,!0),a=vl(l,!0);for(;u.length;)u[0]!==a[0]&&Nc(cn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),u.shift(),a.shift();return{pathname:$i(...a),hash:n,search:i,state:o}}const wa=t=>t.length===1?"":t,ho=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?wa(di(t,l)):"",u=i?di(t,0,l):t,a=n?wa(di(u,e)):"";return{pathname:(n?di(u,0,e):u)||"/",search:a,hash:o}},j1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function H1(t,e,l){return $i(l,U1(t,e))}function W1(t,e){const l=_o(M1(t)),n=vl(l,!0),i=vl(e,!0).slice(0,n.length),o=Ac({fullPath:l},$i(...i));return o&&o.uri}const Bs="POP",z1="PUSH",G1="REPLACE";function Us(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function V1(t){let e=[],l=Us(t),n=Bs;const i=(o=e)=>o.forEach(u=>u({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const u=()=>{l=Us(t),n=Bs,i([o])};i([o]);const a=vc(t,"popstate",u);return()=>{a(),e=e.filter(c=>c!==o)}},navigate(o,u){const{state:a={},replace:c=!1}=u||{};if(n=c?G1:z1,pc(o))u&&ds(Mc,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Bs,t.history.go(o);else{const f={...a,_key:k1()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Us(t),i()}}}function js(t,e){return{...ho(e),state:t}}function K1(t="/"){let e=0,l=[js(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(js(n,o))},replaceState(n,i,o){l[e]=js(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const Y1=!!(!jl&&window.document&&window.document.createElement),Q1=!jl&&window.location.origin==="null",Pc=V1(Y1&&!Q1?window:K1()),{navigate:fn}=Pc;let Sl=null,Dc=!0;function X1(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 Z1(t){(!Sl||t.level>Sl.level||t.level===Sl.level&&X1(t.routerId,Sl.routerId))&&(Sl=t)}function J1(){Sl=null}function x1(){Dc=!1}function ya(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=vc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function e0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function t0(t){return/^H[1-6]$/i.test(t.tagName)}function Ca(t,e=document){return e.querySelector(t)}function l0(t){let l=Ca(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!e0(l,t);){if(t0(l))return l;const n=Ca("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function n0(t){Promise.resolve(li(t.focusElement)).then(e=>{const l=e||l0(t.id);l||ds(cn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,bs),!ya(l)&&ya(document.documentElement)})}const i0=(t,e,l)=>(n,i)=>d1().then(()=>{if(!Sl||Dc){x1();return}if(n&&n0(Sl.route),t.announcements&&i){const{path:o,fullPath:u,meta:a,params:c,uri:f}=Sl.route,_=t.createAnnouncement({path:o,fullPath:u,meta:a,params:c,uri:f},li(l));Promise.resolve(_).then(p=>{e.set(p)})}J1()}),s0="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 o0(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},hc(t[6],s0)],i={};for(let o=0;o<n.length;o+=1)i=ol(i,n[o]);return{c(){e=m("div"),l=E(t[0]),ni(e,i)},m(o,u){S(o,e,u),s(e,l)},p(o,u){u[0]&1&&f1(l,o[0],i.contenteditable)},d(o){o&&$(e)}}}function r0(t){let e,l,n,i,o,u=[Gs(t[6]),{"data-svnav-router":t[3]}],a={};for(let p=0;p<u.length;p+=1)a=ol(a,u[p]);const c=t[22].default,f=ro(c,t,t[21],null);let _=t[2]&&t[4]&&t[1].announcements&&o0(t);return{c(){e=m("div"),l=h(),f&&f.c(),n=h(),_&&_.c(),i=Ke(),ni(e,a)},m(p,b){S(p,e,b),S(p,l,b),f&&f.m(p,b),S(p,n,b),_&&_.m(p,b),S(p,i,b),o=!0},p(p,b){f&&f.p&&(!o||b[0]&2097152)&&uo(f,c,p,p[21],o?ao(c,p[21],b,null):fo(p[21]),null),p[2]&&p[4]&&p[1].announcements&&_.p(p,b)},i(p){o||(O(f,p),o=!0)},o(p){q(f,p),o=!1},d(p){p&&$(e),p&&$(l),f&&f.d(p),p&&$(n),_&&_.d(p),p&&$(i)}}}const a0=dc(),$a="/";function u0(t,e,l){let n,i,o,u,a,{$$slots:c={},$$scope:f}=e,{basepath:_=$a}=e,{url:p=null}=e,{history:b=Pc}=e,{primary:v=!0}=e,{a11y:d={}}=e,{disableInlineStyles:g=!1}=e;const w={createAnnouncement:ee=>`Navigated to ${ee.uri}`,announcements:!0,...d},T=_,M=_o(_),P=Ul(Vs),L=Ul(ii),I=!P,F=a0(),C=v&&!(L&&!L.manageFocus),R=it("");pl(t,R,ee=>l(0,a=ee));const ne=L?L.disableInlineStyles:g,H=it([]);pl(t,H,ee=>l(20,u=ee));const z=it(null);pl(t,z,ee=>l(18,i=ee));let U=!1;const K=I?0:L.level+1,G=I?it((()=>ka(jl?ho(p):b.location,M))()):P;pl(t,G,ee=>l(17,n=ee));const X=it(n);pl(t,X,ee=>l(19,o=ee));const Y=i0(w,R,G),j=ee=>V=>V.filter(W=>W.id!==ee);function x(ee){if(jl){if(U)return;const V=Ac(ee,n.pathname);if(V)return U=!0,V}else H.update(V=>{const W=j(ee.id)(V);return W.push(ee),W})}function ae(ee){H.update(j(ee))}return!I&&_!==$a&&ds(cn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:_}),I&&(ac(()=>b.listen(V=>{const W=ka(V.location,M);X.set(n),G.set(W)})),gi(Vs,G)),gi(ii,{activeRoute:z,registerRoute:x,unregisterRoute:ae,manageFocus:C,level:K,id:F,history:I?b:L.history,basepath:I?M:L.basepath,disableInlineStyles:ne}),t.$$set=ee=>{"basepath"in ee&&l(11,_=ee.basepath),"url"in ee&&l(12,p=ee.url),"history"in ee&&l(13,b=ee.history),"primary"in ee&&l(14,v=ee.primary),"a11y"in ee&&l(15,d=ee.a11y),"disableInlineStyles"in ee&&l(16,g=ee.disableInlineStyles),"$$scope"in ee&&l(21,f=ee.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&_!==T&&ds(cn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ee=Ec(u,n.pathname);z.set(ee)}if(t.$$.dirty[0]&655360&&I){const ee=!!n.hash,V=!ee&&C,W=!ee||n.pathname!==o.pathname;Y(V,W)}t.$$.dirty[0]&262144&&C&&i&&i.primary&&Z1({level:K,routerId:F,route:i})},[a,w,I,F,C,R,ne,H,z,G,X,_,p,b,v,d,g,n,i,o,u,f,c]}class f0 extends Ie{constructor(e){super(),Re(this,e,u0,r0,Ee,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Rc=f0;function Si(t,e,l=ii,n=cn){Ul(l)||Nc(t,o=>`You cannot use ${o} outside of a ${vo(n)}.`,e)}const c0=t=>{const{subscribe:e}=Ul(t);return{subscribe:e}};function Ic(){return Si(Cc),c0(Vs)}function Lc(){const{history:t}=Ul(ii);return t}function Oc(){const t=Ul(gc);return t?w1(t,e=>e.base):it("/")}function Fc(){Si(Sc);const t=Oc(),{basepath:e}=Ul(ii);return n=>H1(n,li(t),e)}function m0(){Si($c);const t=Fc(),{navigate:e}=Lc();return(n,i)=>{const o=pc(n)?n:t(n);return e(o,i)}}const _0=t=>({params:t&16,location:t&8}),Sa=t=>({params:jl?li(t[10]):t[4],location:t[3],navigate:t[11]});function Ma(t){let e,l;return e=new Rc({props:{primary:t[1],$$slots:{default:[v0]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function p0(t){let e;const l=t[18].default,n=ro(l,t,t[19],Sa);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&uo(n,l,i,i[19],e?ao(l,i[19],o,_0):fo(i[19]),Sa)},i(i){e||(O(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function d0(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},jl?li(t[10]):t[4],t[12]];var o=t[0];function u(a){let c={};for(let f=0;f<i.length;f+=1)c=ol(c,i[f]);return{props:c}}return o&&(e=da(o,u())),{c(){e&&re(e.$$.fragment),l=Ke()},m(a,c){e&&ie(e,a,c),S(a,l,c),n=!0},p(a,c){const f=c&7192?mc(i,[c&8&&{location:a[3]},c&2048&&{navigate:a[11]},c&1040&&ha(jl?li(a[10]):a[4]),c&4096&&ha(a[12])]):{};if(c&1&&o!==(o=a[0])){if(e){Ae();const _=e;q(_.$$.fragment,1,0,()=>{se(_,1)}),Pe()}o?(e=da(o,u()),re(e.$$.fragment),O(e.$$.fragment,1),ie(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(a){n||(e&&O(e.$$.fragment,a),n=!0)},o(a){e&&q(e.$$.fragment,a),n=!1},d(a){a&&$(l),e&&se(e,a)}}}function v0(t){let e,l,n,i;const o=[d0,p0],u=[];function a(c,f){return c[0]!==null?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(c,f){u[e].m(c,f),S(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(Ae(),q(u[_],1,1,()=>{u[_]=null}),Pe(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),O(l,1),l.m(n.parentNode,n))},i(c){i||(O(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&$(n)}}}function h0(t){let e,l,n,i,o,u=[Gs(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let p=0;p<u.length;p+=1)a=ol(a,u[p]);let c=t[2]&&Ma(t),f=[Gs(t[7]),{"data-svnav-route-end":t[5]}],_={};for(let p=0;p<f.length;p+=1)_=ol(_,f[p]);return{c(){e=m("div"),l=h(),c&&c.c(),n=h(),i=m("div"),ni(e,a),ni(i,_)},m(p,b){S(p,e,b),S(p,l,b),c&&c.m(p,b),S(p,n,b),S(p,i,b),o=!0},p(p,[b]){p[2]?c?(c.p(p,b),b&4&&O(c,1)):(c=Ma(p),c.c(),O(c,1),c.m(n.parentNode,n)):c&&(Ae(),q(c,1,1,()=>{c=null}),Pe())},i(p){o||(O(c),o=!0)},o(p){q(c),o=!1},d(p){p&&$(e),p&&$(l),c&&c.d(p),p&&$(n),p&&$(i)}}}const b0=dc();function g0(t,e,l){let n;const i=["path","component","meta","primary"];let o=_s(e,i),u,a,c,f,{$$slots:_={},$$scope:p}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Si(bs,e);const w=b0(),{registerRoute:T,unregisterRoute:M,activeRoute:P,disableInlineStyles:L}=Ul(ii);pl(t,P,U=>l(16,u=U));const I=Oc();pl(t,I,U=>l(17,c=U));const F=Ic();pl(t,F,U=>l(3,a=U));const C=it(null);let R;const ne=it(),H=it({});pl(t,H,U=>l(4,f=U)),gi(gc,ne),gi(y1,H),gi(C1,C);const z=m0();return jl||_1(()=>M(w)),t.$$set=U=>{l(24,e=ol(ol({},e),ms(U))),l(12,o=_s(e,i)),"path"in U&&l(13,b=U.path),"component"in U&&l(0,v=U.component),"meta"in U&&l(14,d=U.meta),"primary"in U&&l(1,g=U.primary),"$$scope"in U&&l(19,p=U.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const U=b==="",K=$i(c,b),Q={id:w,path:b,meta:d,default:U,fullPath:U?"":K,base:U?c:W1(K,a.pathname),primary:g,focusElement:C};ne.set(Q),l(15,R=T(Q))}if(t.$$.dirty&98304&&l(2,n=!!(R||u&&u.id===w)),t.$$.dirty&98308&&n){const{params:U}=R||u;H.set(U)}},e=ms(e),[v,g,n,a,f,w,P,L,I,F,H,z,o,b,d,R,u,c,_,p]}class k0 extends Ie{constructor(e){super(),Re(this,e,g0,h0,Ee,{path:13,component:0,meta:14,primary:1})}}const ml=k0;function w0(t){let e,l,n,i;const o=t[13].default,u=ro(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],c={};for(let f=0;f<a.length;f+=1)c=ol(c,a[f]);return{c(){e=m("a"),u&&u.c(),ni(e,c)},m(f,_){S(f,e,_),u&&u.m(e,null),l=!0,n||(i=te(e,"click",t[4]),n=!0)},p(f,[_]){u&&u.p&&(!l||_&4096)&&uo(u,o,f,f[12],l?ao(o,f[12],_,null):fo(f[12]),null),ni(e,c=mc(a,[(!l||_&1)&&{href:f[0]},_&4&&f[2],_&2&&f[1]]))},i(f){l||(O(u,f),l=!0)},o(f){q(u,f),l=!1},d(f){f&&$(e),u&&u.d(f),n=!1,i()}}}function y0(t,e,l){let n,i,o,u,a,c;const f=["to","replace","state","getProps"];let _=_s(e,f),p,{$$slots:b={},$$scope:v}=e,{to:d}=e,{replace:g=!1}=e,{state:w={}}=e,{getProps:T=null}=e;Si(po,e);const M=Ic();pl(t,M,C=>l(11,p=C));const P=p1(),L=Fc(),{navigate:I}=Lc();function F(C){P("click",C),g1(C)&&(C.preventDefault(),I(n,{state:w,replace:u||g}))}return t.$$set=C=>{l(19,e=ol(ol({},e),ms(C))),l(18,_=_s(e,f)),"to"in C&&l(5,d=C.to),"replace"in C&&l(6,g=C.replace),"state"in C&&l(7,w=C.state),"getProps"in C&&l(8,T=C.getProps),"$$scope"in C&&l(12,v=C.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=L(d,p)),t.$$.dirty&2049&&l(10,i=Ks(p.pathname,n)),t.$$.dirty&2049&&l(9,o=n===p.pathname),t.$$.dirty&2049&&(u=ho(n)===j1(p)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(_c(T)){const C=T({location:p,href:n,isPartiallyCurrent:i,isCurrent:o});return{..._,...C}}return _})())},e=ms(e),[n,c,a,M,F,d,g,w,T,o,i,p,v,b]}class C0 extends Ie{constructor(e){super(),Re(this,e,y0,w0,Ee,{to:5,replace:6,state:7,getProps:8})}}const Qt=C0;let Ys=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Bl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function $0(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function qc(t){let e;return t>90?e="#d90000":t>85?e="#e32100":t>80?e="#ffb800":t>75?e="#dcd800":e="#32d900",e}function S0(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function vs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Ue(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function he(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function Ta(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 Na(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 Ea(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function Aa(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function ti(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Xe(t,e){return t==1||t==2&&e}function It(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ke(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function dl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Pa(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Da(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function Ra(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}async function Ml(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 _l={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const Wt=it(_l);async function bo(){_l=await(await Ml("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Wt.set(_l)}let us=0,Ia=-127,La=null,M0={};const Bc=bc(M0,t=>{let e;async function l(){Ml("/data.json").then(n=>n.json()).then(n=>{t(n),Ia!=n.t&&(Ia=n.t,setTimeout(zc,2e3)),La==null&&n.pe&&n.p!=null&&(La=n.p,jc()),_l.upgrading?window.location.reload():(!_l||!_l.chip||_l.booting||us>1&&!ti(_l.board))&&(bo(),on&&clearTimeout(on),on=setTimeout(ko,2e3),rn&&clearTimeout(rn),rn=setTimeout(wo,3e3));let i=5e3;if(ti(_l.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),us=0}).catch(n=>{us++,us>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ti(_l.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let Qs={},vi;const go=it(Qs);async function Uc(){let t=!1;if(go.update(e=>{for(var l=0;l<36;l++){if(e[Ue(l)]==null){t=l<12;break}e[Ue(l)]=e[Ue(l+1)]}return e}),t)jc();else{let e=new Date;vi=setTimeout(Uc,(60-e.getMinutes())*6e4)}}async function jc(){vi&&(clearTimeout(vi),vi=0),Qs=await(await Ml("/energyprice.json")).json(),go.set(Qs);let e=new Date;vi=setTimeout(Uc,(60-e.getMinutes())*6e4)}let Xs={},on;async function ko(){on&&(clearTimeout(on),on=0),Xs=await(await Ml("/dayplot.json")).json(),Hc.set(Xs);let e=new Date;on=setTimeout(ko,(60-e.getMinutes())*6e4+20)}const Hc=it(Xs,t=>(ko(),function(){}));let Zs={},rn;async function wo(){rn&&(clearTimeout(rn),rn=0),Zs=await(await Ml("/monthplot.json")).json(),Wc.set(Zs);let e=new Date;rn=setTimeout(wo,(24-e.getHours())*36e5+40)}const Wc=it(Zs,t=>(wo(),function(){}));let Js={};async function zc(){Js=await(await Ml("/temperature.json")).json(),Gc.set(Js)}const Gc=it(Js,t=>(zc(),function(){}));let xs={},fs;async function Vc(){fs&&(clearTimeout(fs),fs=0),xs=await(await Ml("/tariff.json")).json(),Kc.set(xs);let e=new Date;fs=setTimeout(Vc,(60-e.getMinutes())*6e4+30)}const Kc=it(xs,t=>function(){});let eo=[];const yo=it(eo);async function T0(){eo=await(await Ml("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),yo.set(eo)}let to={};async function N0(){to=await(await Ml("/realtime.json")).json(),Yc.set(to)}const Yc=it(to,t=>(N0(),function(){}));function hs(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 Qc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Xc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),u=[...e];u.reverse();let a,c,f;for(let _=0;_<u.length;_++){let p=u[_],v=p.tag_name.substring(1).split("."),d=parseInt(v[0]),g=parseInt(v[1]),w=parseInt(v[2]);if(d==n)g==i?w>o&&(a=p):g==i+1&&(c=p);else if(d==n+1)if(f){let T=f.tag_name.substring(1).split(".");parseInt(T[0]);let M=parseInt(T[1]);parseInt(T[2]),g==M&&(f=p)}else f=p}return c||f||a||!1}else return e[0]}const E0="/github.svg";function Oa(t){let e,l;function n(u,a){return u[1]>1?O0:u[1]>0?L0:u[2]>1?I0:u[2]>0?R0:u[3]>1?D0:u[3]>0?P0:A0}let i=n(t),o=i(t);return{c(){e=E(`Up
`),o.c(),l=Ke()},m(u,a){S(u,e,a),o.m(u,a),S(u,l,a)},p(u,a){i===(i=n(u))&&o?o.p(u,a):(o.d(1),o=i(u),o&&(o.c(),o.m(l.parentNode,l)))},d(u){u&&$(e),o.d(u),u&&$(l)}}}function A0(t){let e,l;return{c(){e=E(t[0]),l=E(" seconds")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&1&&J(e,n[0])},d(n){n&&$(e),n&&$(l)}}}function P0(t){let e,l;return{c(){e=E(t[3]),l=E(" minute")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&$(e),n&&$(l)}}}function D0(t){let e,l;return{c(){e=E(t[3]),l=E(" minutes")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&8&&J(e,n[3])},d(n){n&&$(e),n&&$(l)}}}function R0(t){let e,l;return{c(){e=E(t[2]),l=E(" hour")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&$(e),n&&$(l)}}}function I0(t){let e,l;return{c(){e=E(t[2]),l=E(" hours")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&4&&J(e,n[2])},d(n){n&&$(e),n&&$(l)}}}function L0(t){let e,l;return{c(){e=E(t[1]),l=E(" day")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&$(e),n&&$(l)}}}function O0(t){let e,l;return{c(){e=E(t[1]),l=E(" days")},m(n,i){S(n,e,i),S(n,l,i)},p(n,i){i&2&&J(e,n[1])},d(n){n&&$(e),n&&$(l)}}}function F0(t){let e,l=t[0]&&Oa(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Oa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&$(e)}}}function q0(t,e,l){let{epoch:n}=e,i=0,o=0,u=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,u=Math.floor(n/60)))},[n,i,o,u]}class B0 extends Ie{constructor(e){super(),Re(this,e,q0,F0,Ee,{epoch:0})}}function U0(t){let e,l,n;return{c(){e=m("span"),l=E(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){S(i,e,o),s(e,l)},p(i,[o]){o&4&&J(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:pe,o:pe,d(i){i&&$(e)}}}function j0(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&l(0,n=u.color),"title"in u&&l(1,i=u.title),"text"in u&&l(2,o=u.text)},[n,i,o]}class an extends Ie{constructor(e){super(),Re(this,e,j0,U0,Ee,{color:0,title:1,text:2})}}function H0(t){let e,l=`${Ue(t[0].getDate())}.${Ue(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=E(l),r(e,"class",t[1])},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Ue(i[0].getDate())}.${Ue(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ue(i[0].getHours())}:${Ue(i[0].getMinutes())}`)&&J(n,l),o&2&&r(e,"class",i[1])},d(i){i&&$(e)}}}function W0(t){let e=`${Ue(t[0].getDate())}. ${Ys[t[0].getMonth()]} ${Ue(t[0].getHours())}:${Ue(t[0].getMinutes())}`,l;return{c(){l=E(e)},m(n,i){S(n,l,i)},p(n,i){i&1&&e!==(e=`${Ue(n[0].getDate())}. ${Ys[n[0].getMonth()]} ${Ue(n[0].getHours())}:${Ue(n[0].getMinutes())}`)&&J(l,e)},d(n){n&&$(l)}}}function z0(t){let e;function l(o,u){return o[2]?W0:H0}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),S(o,e,u)},p(o,[u]){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:pe,o:pe,d(o){i.d(o),o&&$(e)}}}function G0(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,u=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||dl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,u,o]}class Zc extends Ie{constructor(e){super(),Re(this,e,G0,z0,Ee,{timestamp:0,fullTimeColor:1,offset:3})}}function V0(t){let e,l,n;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){S(i,e,o),s(e,l),s(e,n)},p:pe,i:pe,o:pe,d(i){i&&$(e)}}}class K0 extends Ie{constructor(e){super(),Re(this,e,null,V0,Ee,{})}}function Y0(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&$(e)}}}class Q0 extends Ie{constructor(e){super(),Re(this,e,null,Y0,Ee,{})}}function X0(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&$(e)}}}class Rt extends Ie{constructor(e){super(),Re(this,e,null,X0,Ee,{})}}function Z0(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){S(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&$(e)}}}class Jc extends Ie{constructor(e){super(),Re(this,e,null,Z0,Ee,{})}}function J0(t){let e,l,n=t[1].version+"",i;return{c(){e=E("AMS reader "),l=m("span"),i=E(n)},m(o,u){S(o,e,u),S(o,l,u),s(l,i)},p(o,u){u&2&&n!==(n=o[1].version+"")&&J(i,n)},d(o){o&&$(e),o&&$(l)}}}function Fa(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=E(l),i=E("\xB0C"),r(e,"class","flex-none my-auto")},m(o,u){S(o,e,u),s(e,n),s(e,i)},p(o,u){u&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&J(n,l)},d(o){o&&$(e)}}}function qa(t){let e,l="HAN: "+Ta(t[0].he),n;return{c(){e=m("div"),n=E(l),r(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ta(i[0].he))&&J(n,l)},d(i){i&&$(e)}}}function Ba(t){let e,l="MQTT: "+Na(t[0].me),n;return{c(){e=m("div"),n=E(l),r(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Na(i[0].me))&&J(n,l)},d(i){i&&$(e)}}}function Ua(t){let e,l="Price service: "+Ea(t[0].ee),n;return{c(){e=m("div"),n=E(l),r(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="Price service: "+Ea(i[0].ee))&&J(n,l)},d(i){i&&$(e)}}}function ja(t){let e,l,n,i,o,u;return l=new Qt({props:{to:"/configuration",$$slots:{default:[x0]},$$scope:{ctx:t}}}),o=new Qt({props:{to:"/status",$$slots:{default:[em]},$$scope:{ctx:t}}}),{c(){e=m("div"),re(l.$$.fragment),n=h(),i=m("div"),re(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(a,c){S(a,e,c),ie(l,e,null),S(a,n,c),S(a,i,c),ie(o,i,null),u=!0},i(a){u||(O(l.$$.fragment,a),O(o.$$.fragment,a),u=!0)},o(a){q(l.$$.fragment,a),q(o.$$.fragment,a),u=!1},d(a){a&&$(e),se(l),a&&$(n),a&&$(i),se(o)}}}function x0(t){let e,l;return e=new K0({}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function em(t){let e,l;return e=new Q0({}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Ha(t){let e,l,n,i,o;const u=[lm,tm],a=[];function c(f,_){return f[1].security==0||f[0].a?0:1}return l=c(t),n=a[l]=u[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,_){S(f,e,_),a[l].m(e,null),o=!0},p(f,_){let p=l;l=c(f),l===p?a[l].p(f,_):(Ae(),q(a[p],1,1,()=>{a[p]=null}),Pe(),n=a[l],n?n.p(f,_):(n=a[l]=u[l](f),n.c()),O(n,1),n.m(e,null)),(!o||_&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(O(n),o=!0)},o(f){q(n),o=!1},d(f){f&&$(e),a[l].d()}}}function tm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=E("New version: "),i=E(n)},m(o,u){S(o,e,u),s(e,l),s(e,i)},p(o,u){u&4&&n!==(n=o[2].tag_name+"")&&J(i,n)},i:pe,o:pe,d(o){o&&$(e)}}}function lm(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_;return a=new Jc({}),{c(){e=m("button"),l=m("span"),n=E("New version: "),o=E(i),u=h(),re(a.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(p,b){S(p,e,b),s(e,l),s(l,n),s(l,o),s(e,u),ie(a,e,null),c=!0,f||(_=te(e,"click",t[3]),f=!0)},p(p,b){(!c||b&4)&&i!==(i=p[2].tag_name+"")&&J(o,i)},i(p){c||(O(a.$$.fragment,p),c=!0)},o(p){q(a.$$.fragment,p),c=!1},d(p){p&&$(e),se(a),f=!1,_()}}}function nm(t){let e,l,n,i,o,u,a,c,f,_,p,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee,V,W,we,He,Le,Se;i=new Qt({props:{to:"/",$$slots:{default:[J0]},$$scope:{ctx:t}}}),c=new B0({props:{epoch:t[0].u}});let ye=t[0].t>-50&&Fa(t);M=new an({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Bl(t[1].booting?2:t[0].em)}}),L=new an({props:{title:"HAN",text:"HAN",color:Bl(t[1].booting?9:t[0].hm)}}),F=new an({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Bl(t[1].booting?9:t[0].wm)}}),R=new an({props:{title:"MQTT",text:"MQTT",color:Bl(t[1].booting?9:t[0].mm)}});let ve=(t[0].he<0||t[0].he>0)&&qa(t),Te=t[0].me<0&&Ba(t),be=(t[0].ee>0||t[0].ee<0)&&Ua(t);ae=new Zc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let N=t[1].vndcfg&&t[1].usrcfg&&ja(t);He=new Rt({});let y=t[1].fwconsent===1&&t[2]&&Ha(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),re(i.$$.fragment),o=h(),u=m("div"),a=m("div"),re(c.$$.fragment),f=h(),ye&&ye.c(),_=h(),p=m("div"),b=E("Free mem: "),d=E(v),g=E("kb"),w=h(),T=m("div"),re(M.$$.fragment),P=h(),re(L.$$.fragment),I=h(),re(F.$$.fragment),C=h(),re(R.$$.fragment),ne=h(),ve&&ve.c(),H=h(),Te&&Te.c(),z=h(),be&&be.c(),U=h(),K=m("div"),Q=m("div"),G=m("a"),X=m("img"),j=h(),x=m("div"),re(ae.$$.fragment),ee=h(),N&&N.c(),V=h(),W=m("div"),we=m("a"),re(He.$$.fragment),Le=h(),y&&y.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(a,"class","flex-none my-auto"),r(p,"class","flex-none my-auto"),r(u,"class","flex-none my-auto p-2 flex space-x-4"),r(T,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(X,"class","gh-logo"),Ws(X.src,Y=E0)||r(X,"src",Y),r(X,"alt","GitHub repo"),r(G,"class","float-right"),r(G,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(G,"target","_blank"),r(G,"rel","noreferrer"),r(G,"aria-label","GitHub"),r(Q,"class","flex-none"),r(x,"class","flex-none my-auto px-2"),r(we,"href",It("")),r(we,"target","_blank"),r(we,"rel","noreferrer"),r(W,"class","flex-none px-1 mt-1"),r(W,"title","Documentation"),r(K,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(k,A){S(k,e,A),s(e,l),s(l,n),ie(i,n,null),s(l,o),s(l,u),s(u,a),ie(c,a,null),s(u,f),ye&&ye.m(u,null),s(u,_),s(u,p),s(p,b),s(p,d),s(p,g),s(l,w),s(l,T),ie(M,T,null),s(T,P),ie(L,T,null),s(T,I),ie(F,T,null),s(T,C),ie(R,T,null),s(l,ne),ve&&ve.m(l,null),s(l,H),Te&&Te.m(l,null),s(l,z),be&&be.m(l,null),s(l,U),s(l,K),s(K,Q),s(Q,G),s(G,X),s(K,j),s(K,x),ie(ae,x,null),s(K,ee),N&&N.m(K,null),s(K,V),s(K,W),s(W,we),ie(He,we,null),s(K,Le),y&&y.m(K,null),Se=!0},p(k,[A]){const D={};A&18&&(D.$$scope={dirty:A,ctx:k}),i.$set(D);const Z={};A&1&&(Z.epoch=k[0].u),c.$set(Z),k[0].t>-50?ye?ye.p(k,A):(ye=Fa(k),ye.c(),ye.m(u,_)):ye&&(ye.d(1),ye=null),(!Se||A&1)&&v!==(v=(k[0].m?(k[0].m/1e3).toFixed(1):"-")+"")&&J(d,v);const le={};A&3&&(le.text=k[1].booting?"Booting":k[0].v>2?k[0].v.toFixed(2)+"V":"ESP"),A&3&&(le.color=Bl(k[1].booting?2:k[0].em)),M.$set(le);const fe={};A&3&&(fe.color=Bl(k[1].booting?9:k[0].hm)),L.$set(fe);const de={};A&1&&(de.text=k[0].r?k[0].r.toFixed(0)+"dBm":"WiFi"),A&3&&(de.color=Bl(k[1].booting?9:k[0].wm)),F.$set(de);const Ce={};A&3&&(Ce.color=Bl(k[1].booting?9:k[0].mm)),R.$set(Ce),k[0].he<0||k[0].he>0?ve?ve.p(k,A):(ve=qa(k),ve.c(),ve.m(l,H)):ve&&(ve.d(1),ve=null),k[0].me<0?Te?Te.p(k,A):(Te=Ba(k),Te.c(),Te.m(l,z)):Te&&(Te.d(1),Te=null),k[0].ee>0||k[0].ee<0?be?be.p(k,A):(be=Ua(k),be.c(),be.m(l,U)):be&&(be.d(1),be=null);const Oe={};A&1&&(Oe.timestamp=k[0].c?new Date(k[0].c*1e3):new Date(0)),A&2&&(Oe.offset=k[1].clock_offset),ae.$set(Oe),k[1].vndcfg&&k[1].usrcfg?N?A&2&&O(N,1):(N=ja(k),N.c(),O(N,1),N.m(K,V)):N&&(Ae(),q(N,1,1,()=>{N=null}),Pe()),k[1].fwconsent===1&&k[2]?y?(y.p(k,A),A&6&&O(y,1)):(y=Ha(k),y.c(),O(y,1),y.m(K,null)):y&&(Ae(),q(y,1,1,()=>{y=null}),Pe())},i(k){Se||(O(i.$$.fragment,k),O(c.$$.fragment,k),O(M.$$.fragment,k),O(L.$$.fragment,k),O(F.$$.fragment,k),O(R.$$.fragment,k),O(ae.$$.fragment,k),O(N),O(He.$$.fragment,k),O(y),Se=!0)},o(k){q(i.$$.fragment,k),q(c.$$.fragment,k),q(M.$$.fragment,k),q(L.$$.fragment,k),q(F.$$.fragment,k),q(R.$$.fragment,k),q(ae.$$.fragment,k),q(N),q(He.$$.fragment,k),q(y),Se=!1},d(k){k&&$(e),se(i),se(c),ye&&ye.d(),se(M),se(L),se(F),se(R),ve&&ve.d(),Te&&Te.d(),be&&be.d(),se(ae),N&&N.d(),se(He),y&&y.d()}}}function im(t,e,l){let{data:n={}}=e,i={},o={};function u(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ti(i.board)||confirm(hs(he(i.chip,i.board))))&&(Wt.update(a=>(a.upgrading=!0,a)),Qc(o.tag_name))}return Wt.subscribe(a=>{l(1,i=a),a.fwconsent===1&&T0()}),yo.subscribe(a=>{l(2,o=Xc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,u]}class sm extends Ie{constructor(e){super(),Re(this,e,im,nm,Ee,{data:0})}}function om(t){let e,l,n,i;return{c(){e=De("svg"),l=De("path"),n=De("path"),r(l,"d",Hs(150,150,115,210,510)),r(l,"stroke","rgba(128, 128, 128, 0.15)"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=Hs(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,u){S(o,e,u),s(e,l),s(e,n)},p(o,[u]){u&1&&i!==(i=Hs(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),u&2&&r(n,"stroke",o[1])},i:pe,o:pe,d(o){o&&$(e)}}}function Wa(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 Hs(t,e,l,n,i){var o=Wa(t,e,l,i),u=Wa(t,e,l,n),a=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,a,0,u.x,u.y].join(" ");return c}function rm(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 am extends Ie{constructor(e){super(),Re(this,e,rm,om,Ee,{pct:0,color:1})}}function za(t){let e,l,n,i,o,u,a,c;return{c(){e=m("br"),l=h(),n=m("span"),i=E(t[3]),o=h(),u=m("span"),a=E(t[4]),c=E("/kWh"),r(n,"class","pl-sub"),r(u,"class","pl-snt")},m(f,_){S(f,e,_),S(f,l,_),S(f,n,_),s(n,i),S(f,o,_),S(f,u,_),s(u,a),s(u,c)},p(f,_){_&8&&J(i,f[3]),_&16&&J(a,f[4])},d(f){f&&$(e),f&&$(l),f&&$(n),f&&$(o),f&&$(u)}}}function um(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w;l=new am({props:{pct:t[6],color:t[5](t[6])}});let T=t[3]&&za(t);return{c(){e=m("div"),re(l.$$.fragment),n=h(),i=m("span"),o=m("span"),u=E(t[2]),a=h(),c=m("br"),f=h(),_=m("span"),p=E(t[0]),b=h(),v=m("span"),d=E(t[1]),g=h(),T&&T.c(),r(o,"class","pl-lab"),r(_,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(M,P){S(M,e,P),ie(l,e,null),s(e,n),s(e,i),s(i,o),s(o,u),s(i,a),s(i,c),s(i,f),s(i,_),s(_,p),s(i,b),s(i,v),s(v,d),s(i,g),T&&T.m(i,null),w=!0},p(M,[P]){const L={};P&64&&(L.pct=M[6]),P&96&&(L.color=M[5](M[6])),l.$set(L),(!w||P&4)&&J(u,M[2]),(!w||P&1)&&J(p,M[0]),(!w||P&2)&&J(d,M[1]),M[3]?T?T.p(M,P):(T=za(M),T.c(),T.m(i,null)):T&&(T.d(1),T=null)},i(M){w||(O(l.$$.fragment,M),w=!0)},o(M){q(l.$$.fragment,M),w=!1},d(M){M&&$(e),se(l),T&&T.d()}}}function fm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:a=""}=e,{subunit:c=""}=e,{colorFn:f}=e,_=0;return t.$$set=p=>{"val"in p&&l(0,n=p.val),"max"in p&&l(7,i=p.max),"unit"in p&&l(1,o=p.unit),"label"in p&&l(2,u=p.label),"sub"in p&&l(3,a=p.sub),"subunit"in p&&l(4,c=p.subunit),"colorFn"in p&&l(5,f=p.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,_=Math.min(n,i)/i*100)},[n,o,u,a,c,f,_,i]}class xc extends Ie{constructor(e){super(),Re(this,e,fm,um,Ee,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function Ga(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Va(t,e,l){const n=t.slice();return n[11]=e[l],n[13]=l,n}function Ka(t,e,l){const n=t.slice();return n[15]=e[l],n}function Ya(t){let e,l,n,i,o,u,a=t[0].title&&Qa(t),c=t[0].y.ticks,f=[];for(let d=0;d<c.length;d+=1)f[d]=Za(Ka(t,c,d));let _=t[0].x.ticks,p=[];for(let d=0;d<_.length;d+=1)p[d]=eu(Va(t,_,d));let b=t[0].points,v=[];for(let d=0;d<b.length;d+=1)v[d]=au(Ga(t,b,d));return{c(){a&&a.c(),e=h(),l=De("svg"),n=De("g");for(let d=0;d<f.length;d+=1)f[d].c();i=De("g");for(let d=0;d<p.length;d+=1)p[d].c();o=De("g");for(let d=0;d<v.length;d+=1)v[d].c();r(n,"class","axis y-axis"),r(i,"class","axis x-axis"),r(o,"class","bars"),r(l,"xmlns","http://www.w3.org/2000/svg"),r(l,"viewBox",u="0 0 "+t[1]+" "+t[4])},m(d,g){a&&a.m(d,g),S(d,e,g),S(d,l,g),s(l,n);for(let w=0;w<f.length;w+=1)f[w]&&f[w].m(n,null);s(l,i);for(let w=0;w<p.length;w+=1)p[w]&&p[w].m(i,null);s(l,o);for(let w=0;w<v.length;w+=1)v[w]&&v[w].m(o,null)},p(d,g){if(d[0].title?a?a.p(d,g):(a=Qa(d),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),g&129){c=d[0].y.ticks;let w;for(w=0;w<c.length;w+=1){const T=Ka(d,c,w);f[w]?f[w].p(T,g):(f[w]=Za(T),f[w].c(),f[w].m(n,null))}for(;w<f.length;w+=1)f[w].d(1);f.length=c.length}if(g&89){_=d[0].x.ticks;let w;for(w=0;w<_.length;w+=1){const T=Va(d,_,w);p[w]?p[w].p(T,g):(p[w]=eu(T),p[w].c(),p[w].m(i,null))}for(;w<p.length;w+=1)p[w].d(1);p.length=_.length}if(g&457){b=d[0].points;let w;for(w=0;w<b.length;w+=1){const T=Ga(d,b,w);v[w]?v[w].p(T,g):(v[w]=au(T),v[w].c(),v[w].m(o,null))}for(;w<v.length;w+=1)v[w].d(1);v.length=b.length}g&18&&u!==(u="0 0 "+d[1]+" "+d[4])&&r(l,"viewBox",u)},d(d){a&&a.d(d),d&&$(e),d&&$(l),dt(f,d),dt(p,d),dt(v,d)}}}function Qa(t){let e,l=t[0].title+"",n,i;return{c(){e=m("div"),n=E(l),r(e,"class","text-sm font-bold"),We(()=>t[9].call(e))},m(o,u){S(o,e,u),s(e,n),i=mo(e,t[9].bind(e))},p(o,u){u&1&&l!==(l=o[0].title+"")&&J(n,l)},d(o){o&&$(e),i()}}}function Xa(t){let e,l,n,i=t[15].label+"",o,u,a,c;return{c(){e=De("g"),l=De("line"),n=De("text"),o=E(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",u=t[15].align=="right"?"85%":""),r(e,"class",a="tick tick-"+t[15].value+" tick-"+t[15].color),r(e,"transform",c="translate(0, "+t[7](t[15].value)+")")},m(f,_){S(f,e,_),s(e,l),s(e,n),s(n,o)},p(f,_){_&1&&i!==(i=f[15].label+"")&&J(o,i),_&1&&u!==(u=f[15].align=="right"?"85%":"")&&r(n,"x",u),_&1&&a!==(a="tick tick-"+f[15].value+" tick-"+f[15].color)&&r(e,"class",a),_&129&&c!==(c="translate(0, "+f[7](f[15].value)+")")&&r(e,"transform",c)},d(f){f&&$(e)}}}function Za(t){let e=!isNaN(t[7](t[15].value)),l,n=e&&Xa(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?n?n.p(i,o):(n=Xa(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function Ja(t){let e,l,n=(t[3]>20||t[13]%2==0)&&xa(t);return{c(){e=De("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){S(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?n?n.p(i,o):(n=xa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&80&&l!==(l="translate("+i[6](i[13])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&$(e),n&&n.d()}}}function xa(t){let e,l=t[11].label+"",n,i;return{c(){e=De("text"),n=E(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,u){S(o,e,u),s(e,n)},p(o,u){u&1&&l!==(l=o[11].label+"")&&J(n,l),u&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&$(e)}}}function eu(t){let e=!isNaN(t[6](t[13])),l,n=e&&Ja(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?n?n.p(i,o):(n=Ja(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function tu(t){let e,l,n=t[11].value!==void 0&&lu(t),i=t[11].value2>1e-4&&su(t);return{c(){e=De("g"),n&&n.c(),l=De("g"),i&&i.c()},m(o,u){S(o,e,u),n&&n.m(e,null),S(o,l,u),i&&i.m(l,null)},p(o,u){o[11].value!==void 0?n?n.p(o,u):(n=lu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[11].value2>1e-4?i?i.p(o,u):(i=su(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&$(e),n&&n.d(),o&&$(l),i&&i.d()}}}function lu(t){let e,l,n,i,o,u,a,c=t[3]>15&&nu(t);return{c(){e=De("rect"),c&&c.c(),a=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](t[11].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),r(e,"fill",u=t[11].color)},m(f,_){S(f,e,_),c&&c.m(f,_),S(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&129&&n!==(n=f[7](f[11].value))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&r(e,"height",o),_&1&&u!==(u=f[11].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=nu(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&$(e),c&&c.d(f),f&&$(a)}}}function nu(t){let e,l=t[11].label+"",n,i,o,u,a,c,f=t[11].title&&iu(t);return{c(){e=De("text"),n=E(l),f&&f.c(),c=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]<un||t[11].labelAngle?"left":"middle"),r(e,"fill",u=t[7](t[11].value)>t[7](0)-t[8]?t[11].color:"white"),r(e,"transform",a="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]<un?90:0)+")")},m(_,p){S(_,e,p),s(e,n),f&&f.m(_,p),S(_,c,p)},p(_,p){p&1&&l!==(l=_[11].label+"")&&J(n,l),p&8&&i!==(i=_[3]-4)&&r(e,"width",i),p&9&&o!==(o=_[3]<un||_[11].labelAngle?"left":"middle")&&r(e,"text-anchor",o),p&385&&u!==(u=_[7](_[11].value)>_[7](0)-_[8]?_[11].color:"white")&&r(e,"fill",u),p&457&&a!==(a="translate("+(_[6](_[13])+_[3]/2)+" "+(_[7](_[11].value)>_[7](0)-_[8]?_[7](_[11].value)-_[8]:_[7](_[11].value)+10)+") rotate("+(_[11].labelAngle?_[11].labelAngle:_[3]<un?90:0)+")")&&r(e,"transform",a),_[11].title?f?f.p(_,p):(f=iu(_),f.c(),f.m(c.parentNode,c)):f&&(f.d(1),f=null)},d(_){_&&$(e),f&&f.d(_),_&&$(c)}}}function iu(t){let e,l=t[11].title+"",n;return{c(){e=De("title"),n=E(l)},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[11].title+"")&&J(n,l)},d(i){i&&$(e)}}}function su(t){let e,l,n,i,o,u,a,c=t[3]>15&&ou(t);return{c(){e=De("rect"),c&&c.c(),a=Ke(),r(e,"x",l=t[6](t[13])+2),r(e,"y",n=t[7](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),r(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,_){S(f,e,_),c&&c.m(f,_),S(f,a,_)},p(f,_){_&64&&l!==(l=f[6](f[13])+2)&&r(e,"x",l),_&128&&n!==(n=f[7](0))&&r(e,"y",n),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&r(e,"height",o),_&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&r(e,"fill",u),f[3]>15?c?c.p(f,_):(c=ou(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&$(e),c&&c.d(f),f&&$(a)}}}function ou(t){let e,l=t[11].label2+"",n,i,o,u,a,c=t[11].title2&&ru(t);return{c(){e=De("text"),n=E(l),c&&c.c(),a=Ke(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[7](-t[11].value2)<t[7](0)+15?t[11].color2?t[11].color2:t[11].color:"white"),r(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](-t[11].value2)<t[7](0)+15?t[7](-t[11].value2)+15:t[7](-t[11].value2)-14)+") rotate("+(t[3]<un?90:0)+")")},m(f,_){S(f,e,_),s(e,n),c&&c.m(f,_),S(f,a,_)},p(f,_){_&1&&l!==(l=f[11].label2+"")&&J(n,l),_&8&&i!==(i=f[3]-4)&&r(e,"width",i),_&129&&o!==(o=f[7](-f[11].value2)<f[7](0)+15?f[11].color2?f[11].color2:f[11].color:"white")&&r(e,"fill",o),_&201&&u!==(u="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](-f[11].value2)<f[7](0)+15?f[7](-f[11].value2)+15:f[7](-f[11].value2)-14)+") rotate("+(f[3]<un?90:0)+")")&&r(e,"transform",u),f[11].title2?c?c.p(f,_):(c=ru(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){f&&$(e),c&&c.d(f),f&&$(a)}}}function ru(t){let e,l=t[11].title2+"",n;return{c(){e=De("title"),n=E(l)},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[11].title2+"")&&J(n,l)},d(i){i&&$(e)}}}function au(t){let e=!isNaN(t[6](t[13]))&&!isNaN(t[7](t[11].value)),l,n=e&&tu(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&193&&(e=!isNaN(i[6](i[13]))&&!isNaN(i[7](i[11].value))),e?n?n.p(i,o):(n=tu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function cm(t){let e,l,n=t[0].x.ticks&&t[0].points&&t[4]&&Ya(t);return{c(){e=m("div"),n&&n.c(),r(e,"class","chart"),We(()=>t[10].call(e))},m(i,o){S(i,e,o),n&&n.m(e,null),l=mo(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=Ya(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:pe,o:pe,d(i){i&&$(e),n&&n.d(),l()}}}let un=30;function mm(t,e,l){let{config:n}=e,i,o,u,a,c,f,_,p=0;function b(){p=this.clientHeight,l(5,p)}function v(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=d=>{"config"in d&&l(0,n=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){l(4,f=o-p);let d=i-(n.padding.left+n.padding.right);l(3,u=d/n.points.length),l(8,_=u<un?30:15);let g=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(6,a=function(w){return w*u+n.padding.left}),l(7,c=function(w){let T=0;return w>n.y.max?T=n.padding.bottom:w<n.y.min?T=f-n.padding.bottom:T=f-n.padding.bottom-(w-n.y.min)*g,T>f||T<0?0:T})}},[n,i,o,u,f,p,a,c,_,b,v]}class mn extends Ie{constructor(e){super(),Re(this,e,mm,cm,Ee,{config:0})}}function _m(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function pm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,a={};function c(f){return{label:ke(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:$0(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],_=[];n>0&&(f.push({label:u===1?"L1-L2":"L1"}),_.push(c(n))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),_.push(c(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),_.push(c(o))),l(0,a={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:_})}},[a,n,i,o,u]}class dm extends Ie{constructor(e){super(),Re(this,e,pm,_m,Ee,{u1:1,u2:2,u3:3,ds:4})}}function vm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function hm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:u}=e,{i2:a}=e,{i2e:c}=e,{i3:f}=e,{max:_}=e,p={};function b(v){return{label:ke(v)+"A",title:v.toFixed(1)+" A",value:isNaN(v)?0:v,color:qc(v?v/_*100:0)}}return t.$$set=v=>{"u1"in v&&l(1,n=v.u1),"u2"in v&&l(2,i=v.u2),"u3"in v&&l(3,o=v.u3),"i1"in v&&l(4,u=v.i1),"i2"in v&&l(5,a=v.i2),"i2e"in v&&l(6,c=v.i2e),"i3"in v&&l(7,f=v.i3),"max"in v&&l(8,_=v.max)},t.$$.update=()=>{if(t.$$.dirty&510){let v=[],d=[];n>0&&(v.push({label:"L1"}),d.push(b(u))),i>0&&(c?(v.push({label:"L2"}),d.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(v.push({label:"L2"}),d.push(b(a)))),o>0&&(v.push({label:"L3"}),d.push(b(f))),l(0,p={title:"Amperage",padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:_,ticks:[{value:0,label:"0%"},{value:_/4,label:"25%"},{value:_/2,label:"50%"},{value:_/4*3,label:"75%"},{value:_,label:"100%"}]},x:{ticks:v},points:d})}},[p,n,i,o,u,a,c,f,_]}class bm extends Ie{constructor(e){super(),Re(this,e,hm,vm,Ee,{u1:1,u2:2,u3:3,i1:4,i2:5,i2e:6,i3:7,max:8})}}function gm(t){let e,l,n,i,o,u,a,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,_,p,b,v,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",w,T,M,P,L,I,F,C=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",R,ne,H,z,U,K,Q=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",G,X;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",u=h(),a=m("div"),f=E(c),_=E(" VAr"),p=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),w=E(g),T=E(" VAr"),M=h(),P=m("div"),L=m("div"),L.textContent="Total in",I=h(),F=m("div"),R=E(C),ne=E(" kVArh"),H=h(),z=m("div"),z.textContent="Total out",U=h(),K=m("div"),G=E(Q),X=E(" kVArh"),r(a,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(F,"class","text-right"),r(K,"class","text-right"),r(P,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(Y,j){S(Y,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(i,a),s(a,f),s(a,_),s(i,p),s(i,b),s(i,v),s(i,d),s(d,w),s(d,T),s(e,M),s(e,P),s(P,L),s(P,I),s(P,F),s(F,R),s(F,ne),s(P,H),s(P,z),s(P,U),s(P,K),s(K,G),s(K,X)},p(Y,[j]){j&1&&c!==(c=(typeof Y[0]<"u"?Y[0].toFixed(0):"-")+"")&&J(f,c),j&2&&g!==(g=(typeof Y[1]<"u"?Y[1].toFixed(0):"-")+"")&&J(w,g),j&4&&C!==(C=(typeof Y[2]<"u"?Y[2].toFixed(1):"-")+"")&&J(R,C),j&8&&Q!==(Q=(typeof Y[3]<"u"?Y[3].toFixed(1):"-")+"")&&J(G,Q)},i:pe,o:pe,d(Y){Y&&$(e)}}}function km(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,u=a.exportTotal)},[n,i,o,u]}class wm extends Ie{constructor(e){super(),Re(this,e,km,gm,Ee,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function uu(t){let e;function l(o,u){return o[3]?Cm:ym}let n=l(t),i=n(t);return{c(){i.c(),e=Ke()},m(o,u){i.m(o,u),S(o,e,u)},p(o,u){n===(n=l(o))&&i?i.p(o,u):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&$(e)}}}function ym(t){let e,l,n,i,o,u,a=ke(t[1].h.u,2)+"",c,f,_,p,b,v,d=ke(t[1].d.u,1)+"",g,w,T,M,P,L,I=ke(t[1].m.u)+"",F,C,R,ne,H,z,U=ke(t[0].last_month.u)+"",K,Q,G,X,Y=t[4]&&fu(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=E(a),f=E(" kWh"),_=h(),p=m("div"),p.textContent="Day",b=h(),v=m("div"),g=E(d),w=E(" kWh"),T=h(),M=m("div"),M.textContent="Month",P=h(),L=m("div"),F=E(I),C=E(" kWh"),R=h(),ne=m("div"),ne.textContent="Last month",H=h(),z=m("div"),K=E(U),Q=E(" kWh"),G=h(),Y&&Y.c(),X=Ke(),r(u,"class","text-right"),r(v,"class","text-right"),r(L,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(j,x){S(j,e,x),S(j,l,x),S(j,n,x),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),s(n,p),s(n,b),s(n,v),s(v,g),s(v,w),s(n,T),s(n,M),s(n,P),s(n,L),s(L,F),s(L,C),s(n,R),s(n,ne),s(n,H),s(n,z),s(z,K),s(z,Q),S(j,G,x),Y&&Y.m(j,x),S(j,X,x)},p(j,x){x&2&&a!==(a=ke(j[1].h.u,2)+"")&&J(c,a),x&2&&d!==(d=ke(j[1].d.u,1)+"")&&J(g,d),x&2&&I!==(I=ke(j[1].m.u)+"")&&J(F,I),x&1&&U!==(U=ke(j[0].last_month.u)+"")&&J(K,U),j[4]?Y?Y.p(j,x):(Y=fu(j),Y.c(),Y.m(X.parentNode,X)):Y&&(Y.d(1),Y=null)},d(j){j&&$(e),j&&$(l),j&&$(n),j&&$(G),Y&&Y.d(j),j&&$(X)}}}function Cm(t){let e,l,n,i,o,u,a=ke(t[1].h.u,2)+"",c,f,_,p,b,v,d,g=ke(t[1].d.u,1)+"",w,T,M,P,L,I,F,C=ke(t[1].m.u)+"",R,ne,H,z,U,K,Q,G=ke(t[0].last_month.u)+"",X,Y,j,x,ae,ee,V,W,we,He,Le,Se=ke(t[1].h.p,2)+"",ye,ve,Te,be,N,y,k,A=ke(t[1].d.p,1)+"",D,Z,le,fe,de,Ce,Oe,ue=ke(t[1].m.p)+"",Me,Je,Lt,st,wt,nt,Ot,Qe=ke(t[0].last_month.p)+"",Xt,zt,vt,xe,Ge=t[4]&&cu(t),Ye=t[4]&&mu(t),Ne=t[4]&&_u(t),Ze=t[4]&&pu(t),et=t[4]&&du(t),qe=t[4]&&vu(t),Fe=t[4]&&hu(t),_e=t[4]&&bu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=E(a),f=E(" kWh"),_=h(),Ge&&Ge.c(),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=E(g),T=E(" kWh"),M=h(),Ye&&Ye.c(),P=h(),L=m("div"),L.textContent="Month",I=h(),F=m("div"),R=E(C),ne=E(" kWh"),H=h(),Ne&&Ne.c(),z=h(),U=m("div"),U.textContent="Last mo.",K=h(),Q=m("div"),X=E(G),Y=E(" kWh"),j=h(),Ze&&Ze.c(),ae=h(),ee=m("strong"),ee.textContent="Export",V=h(),W=m("div"),we=m("div"),we.textContent="Hour",He=h(),Le=m("div"),ye=E(Se),ve=E(" kWh"),Te=h(),et&&et.c(),be=h(),N=m("div"),N.textContent="Day",y=h(),k=m("div"),D=E(A),Z=E(" kWh"),le=h(),qe&&qe.c(),fe=h(),de=m("div"),de.textContent="Month",Ce=h(),Oe=m("div"),Me=E(ue),Je=E(" kWh"),Lt=h(),Fe&&Fe.c(),st=h(),wt=m("div"),wt.textContent="Last mo.",nt=h(),Ot=m("div"),Xt=E(Qe),zt=E(" kWh"),vt=h(),_e&&_e.c(),r(u,"class","text-right"),r(d,"class","text-right"),r(F,"class","text-right"),r(Q,"class","text-right"),r(n,"class",x="grid grid-cols-"+t[5]+" mb-3"),r(Le,"class","text-right"),r(k,"class","text-right"),r(Oe,"class","text-right"),r(Ot,"class","text-right"),r(W,"class",xe="grid grid-cols-"+t[5])},m(ce,Be){S(ce,e,Be),S(ce,l,Be),S(ce,n,Be),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(n,_),Ge&&Ge.m(n,null),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,T),s(n,M),Ye&&Ye.m(n,null),s(n,P),s(n,L),s(n,I),s(n,F),s(F,R),s(F,ne),s(n,H),Ne&&Ne.m(n,null),s(n,z),s(n,U),s(n,K),s(n,Q),s(Q,X),s(Q,Y),s(n,j),Ze&&Ze.m(n,null),S(ce,ae,Be),S(ce,ee,Be),S(ce,V,Be),S(ce,W,Be),s(W,we),s(W,He),s(W,Le),s(Le,ye),s(Le,ve),s(W,Te),et&&et.m(W,null),s(W,be),s(W,N),s(W,y),s(W,k),s(k,D),s(k,Z),s(W,le),qe&&qe.m(W,null),s(W,fe),s(W,de),s(W,Ce),s(W,Oe),s(Oe,Me),s(Oe,Je),s(W,Lt),Fe&&Fe.m(W,null),s(W,st),s(W,wt),s(W,nt),s(W,Ot),s(Ot,Xt),s(Ot,zt),s(W,vt),_e&&_e.m(W,null)},p(ce,Be){Be&2&&a!==(a=ke(ce[1].h.u,2)+"")&&J(c,a),ce[4]?Ge?Ge.p(ce,Be):(Ge=cu(ce),Ge.c(),Ge.m(n,p)):Ge&&(Ge.d(1),Ge=null),Be&2&&g!==(g=ke(ce[1].d.u,1)+"")&&J(w,g),ce[4]?Ye?Ye.p(ce,Be):(Ye=mu(ce),Ye.c(),Ye.m(n,P)):Ye&&(Ye.d(1),Ye=null),Be&2&&C!==(C=ke(ce[1].m.u)+"")&&J(R,C),ce[4]?Ne?Ne.p(ce,Be):(Ne=_u(ce),Ne.c(),Ne.m(n,z)):Ne&&(Ne.d(1),Ne=null),Be&1&&G!==(G=ke(ce[0].last_month.u)+"")&&J(X,G),ce[4]?Ze?Ze.p(ce,Be):(Ze=pu(ce),Ze.c(),Ze.m(n,null)):Ze&&(Ze.d(1),Ze=null),Be&32&&x!==(x="grid grid-cols-"+ce[5]+" mb-3")&&r(n,"class",x),Be&2&&Se!==(Se=ke(ce[1].h.p,2)+"")&&J(ye,Se),ce[4]?et?et.p(ce,Be):(et=du(ce),et.c(),et.m(W,be)):et&&(et.d(1),et=null),Be&2&&A!==(A=ke(ce[1].d.p,1)+"")&&J(D,A),ce[4]?qe?qe.p(ce,Be):(qe=vu(ce),qe.c(),qe.m(W,fe)):qe&&(qe.d(1),qe=null),Be&2&&ue!==(ue=ke(ce[1].m.p)+"")&&J(Me,ue),ce[4]?Fe?Fe.p(ce,Be):(Fe=hu(ce),Fe.c(),Fe.m(W,st)):Fe&&(Fe.d(1),Fe=null),Be&1&&Qe!==(Qe=ke(ce[0].last_month.p)+"")&&J(Xt,Qe),ce[4]?_e?_e.p(ce,Be):(_e=bu(ce),_e.c(),_e.m(W,null)):_e&&(_e.d(1),_e=null),Be&32&&xe!==(xe="grid grid-cols-"+ce[5])&&r(W,"class",xe)},d(ce){ce&&$(e),ce&&$(l),ce&&$(n),Ge&&Ge.d(),Ye&&Ye.d(),Ne&&Ne.d(),Ze&&Ze.d(),ce&&$(ae),ce&&$(ee),ce&&$(V),ce&&$(W),et&&et.d(),qe&&qe.d(),Fe&&Fe.d(),_e&&_e.d()}}}function fu(t){let e,l,n,i,o,u,a=ke(t[1].h.c,2)+"",c,f,_,p,b,v,d,g=ke(t[1].d.c,1)+"",w,T,M,P,L,I,F,C=ke(t[1].m.c)+"",R,ne,H,z,U,K,Q,G=ke(t[0].last_month.c)+"",X,Y,j;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),u=m("div"),c=E(a),f=h(),_=E(t[2]),p=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),w=E(g),T=h(),M=E(t[2]),P=h(),L=m("div"),L.textContent="Month",I=h(),F=m("div"),R=E(C),ne=h(),H=E(t[2]),z=h(),U=m("div"),U.textContent="Last month",K=h(),Q=m("div"),X=E(G),Y=h(),j=E(t[2]),r(u,"class","text-right"),r(d,"class","text-right"),r(F,"class","text-right"),r(Q,"class","text-right"),r(n,"class","grid grid-cols-2")},m(x,ae){S(x,e,ae),S(x,l,ae),S(x,n,ae),s(n,i),s(n,o),s(n,u),s(u,c),s(u,f),s(u,_),s(n,p),s(n,b),s(n,v),s(n,d),s(d,w),s(d,T),s(d,M),s(n,P),s(n,L),s(n,I),s(n,F),s(F,R),s(F,ne),s(F,H),s(n,z),s(n,U),s(n,K),s(n,Q),s(Q,X),s(Q,Y),s(Q,j)},p(x,ae){ae&2&&a!==(a=ke(x[1].h.c,2)+"")&&J(c,a),ae&4&&J(_,x[2]),ae&2&&g!==(g=ke(x[1].d.c,1)+"")&&J(w,g),ae&4&&J(M,x[2]),ae&2&&C!==(C=ke(x[1].m.c)+"")&&J(R,C),ae&4&&J(H,x[2]),ae&1&&G!==(G=ke(x[0].last_month.c)+"")&&J(X,G),ae&4&&J(j,x[2])},d(x){x&&$(e),x&&$(l),x&&$(n)}}}function cu(t){let e,l=ke(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].h.c,2)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function mu(t){let e,l=ke(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].d.c,1)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function _u(t){let e,l=ke(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].m.c)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function pu(t){let e,l=ke(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ke(u[0].last_month.c)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function du(t){let e,l=ke(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].h.i,2)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function vu(t){let e,l=ke(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].d.i,1)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function hu(t){let e,l=ke(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&2&&l!==(l=ke(u[1].m.i)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function bu(t){let e,l=ke(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=E(l),i=h(),o=E(t[2]),r(e,"class","text-right")},m(u,a){S(u,e,a),s(e,n),s(e,i),s(e,o)},p(u,a){a&1&&l!==(l=ke(u[0].last_month.i)+"")&&J(n,l),a&4&&J(o,u[2])},d(u){u&&$(e)}}}function $m(t){let e,l,n,i,o,u,a=t[1]&&uu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),u=h(),a&&a.c(),r(e,"class","mx-2 text-sm")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,u),a&&a.m(e,null)},p(c,[f]){c[1]?a?a.p(c,f):(a=uu(c),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:pe,o:pe,d(c){c&&$(e),a&&a.d()}}}function Sm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,a=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=a?3:2))},[n,i,o,u,a,c]}class Mm extends Ie{constructor(e){super(),Re(this,e,Sm,$m,Ee,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Tm(t){let e,l,n=Da(t[0].source)+"",i,o,u,a,c;return a=new mn({props:{config:t[1]}}),{c(){e=m("a"),l=E("Provided by: "),i=E(n),u=h(),re(a.$$.fragment),r(e,"href",o=Ra(t[0].source)),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(f,_){S(f,e,_),s(e,l),s(e,i),S(f,u,_),ie(a,f,_),c=!0},p(f,[_]){(!c||_&1)&&n!==(n=Da(f[0].source)+"")&&J(i,n),(!c||_&1&&o!==(o=Ra(f[0].source)))&&r(e,"href",o);const p={};_&2&&(p.config=f[1]),a.$set(p)},i(f){c||(O(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&$(e),f&&$(u),se(a,f)}}}function Nm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(0,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let c=n.currency,f=new Date().getUTCHours(),_=0,p=0,b=0,v=[],d=[],g=[];l(4,a=l(3,u=0));let w=new Date;for(dl(w,i.clock_offset-(24+w.getHours()-w.getUTCHours())%24),_=f;_<24&&(p=n[Ue(b++)],p!=null);_++)d.push({label:Ue(w.getHours())}),g.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),dl(w,1);for(_=0;_<24&&(p=n[Ue(b++)],p!=null);_++)d.push({label:Ue(w.getHours())}),g.push(p*100),l(4,a=Math.min(a,p*100)),l(3,u=Math.max(u,p*100)),dl(w,1);if(a>-100&&u<100){switch(c){case"NOK":case"DKK":c="\xF8re";break;case"SEK":c="\xF6re";break;case"EUR":c="cent";break;case"CHF":c="rp.";break;default:c=c+"/100"}for(l(4,a*=100),l(3,u*=100),_=0;_<g.length;_++)g[_]*=100}let T=[];for(_=0;_<g.length;_++){p=g[_];let I=p*.01,F=Math.abs(p)<1e3?2:0;T.push({label:I>=0?I.toFixed(F):"",title:I>=0?I.toFixed(2)+" "+c:"",value:p>=0?Math.abs(p):0,label2:I<0?I.toFixed(F):"",title2:I<0?I.toFixed(2)+" "+c:"",value2:p<0?Math.abs(p):0,color:"#7c3aed"})}let M=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(M/4*-1,a));let I=Math.ceil(Math.abs(a)/M*4),F=a/I;for(_=1;_<I+1;_++){let C=F*_;v.push({value:C,label:(C/100).toFixed(2)})}}l(3,u=Math.max(M/4,u));let P=Math.ceil(u/M*4),L=u/P;for(_=0;_<P+1;_++){let I=L*_;v.push({value:I,label:(I/100).toFixed(2)})}l(1,o={title:"Future energy price ("+c+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:u,ticks:v},x:{ticks:d},points:T})}},[n,o,i,u,a]}class Em extends Ie{constructor(e){super(),Re(this,e,Nm,Tm,Ee,{json:0,sysinfo:2})}}function Am(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Pm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=dl(new Date,-24),v=new Date().getUTCHours();for(dl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let T=n["i"+Ue(c)],M=n["e"+Ue(c)];T===void 0&&(T=0),M===void 0&&(M=0),_.push({label:Ue(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:M.toFixed(1),title2:M.toFixed(2)+" kWh",value2:M*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M*10)),l(3,u=Math.max(u,T*10)),dl(b,1)}for(c=0;c<v;c++){let T=n["i"+Ue(c)],M=n["e"+Ue(c)];T===void 0&&(T=0),M===void 0&&(M=0),_.push({label:Ue(b.getHours())}),p.push({label:T.toFixed(1),title:T.toFixed(2)+" kWh",value:T*10,label2:M.toFixed(1),title2:M.toFixed(2)+" kWh",value2:M*10,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M*10)),l(3,u=Math.max(u,T*10)),dl(b,1)}l(4,a*=-1);let d=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(d/4*-1,a));let T=Math.ceil(Math.abs(a)/d*4),M=a/T;for(c=1;c<T+1;c++){let P=M*c;f.push({value:P,label:(P/10).toFixed(1)})}}l(3,u=Math.max(d/4,u));let g=Math.ceil(u/d*4),w=u/g;for(c=0;c<g+1;c++){let T=w*c;f.push({value:T,label:(T/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:u,ticks:f},x:{ticks:_},points:p})}},[o,n,i,u,a]}class Dm extends Ie{constructor(e){super(),Re(this,e,Pm,Am,Ee,{json:1,sysinfo:2})}}function Rm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Im(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},u,a;return t.$$set=c=>{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],_=[],p=[];l(4,a=l(3,u=0));let b=new Date,v=new Date;for(dl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),dl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let T=n["i"+Ue(c)],M=n["e"+Ue(c)];T===void 0&&(T=0),M===void 0&&(M=0),_.push({label:Ue(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M)),l(3,u=Math.max(u,T))}for(c=1;c<b.getDate();c++){let T=n["i"+Ue(c)],M=n["e"+Ue(c)];T===void 0&&(T=0),M===void 0&&(M=0),_.push({label:Ue(c)}),p.push({label:T.toFixed(T<10?1:0),title:T.toFixed(2)+" kWh",value:T,label2:M.toFixed(M<10?1:0),title2:M.toFixed(2)+" kWh",value2:M,color:"#7c3aed",color2:"#37829E"}),l(4,a=Math.max(a,M)),l(3,u=Math.max(u,T))}l(4,a*=-1);let d=Math.max(u,Math.abs(a));if(a<0){l(4,a=Math.min(d/4*-1,a));let T=Math.ceil(Math.abs(a)/d*4),M=a/T;for(c=1;c<T+1;c++){let P=M*c;f.push({value:P,label:P.toFixed(0)})}}l(3,u=Math.max(d/4,u));let g=Math.ceil(u/d*4),w=u/g;for(c=0;c<g+1;c++){let T=w*c;f.push({value:T,label:T.toFixed(0)})}l(0,o={title:"Energy use last "+v.getDate()+" days (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:u,ticks:f},x:{ticks:_},points:p})}},[o,n,i,u,a]}class Lm extends Ie{constructor(e){super(),Re(this,e,Im,Rm,Ee,{json:1,sysinfo:2})}}function Om(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Fm(t,e,l){let{json:n}=e,i={},o=0,u=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,c=0,f=[],_=[],p=[];n.s&&n.s.forEach((d,g)=>{var w=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),_.push({label:w.slice(-4)}),p.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,u=Math.min(u,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,u=Math.floor(u));let b=o;u<0&&(b+=Math.abs(u));let v=b/4;for(a=0;a<5;a++)c=u+v*a,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:o,ticks:f},x:{ticks:_},points:p})}},[i,n,o,u]}class qm extends Ie{constructor(e){super(),Re(this,e,Fm,Om,Ee,{json:1})}}function Bm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}let Um=0;function jm(t,e,l){let n={},i=0,o;return Kc.subscribe(u=>{l(2,o=u)}),Vc(),t.$$.update=()=>{if(t.$$.dirty&6){let u=0,a=[],c=[],f=[];if(a.push({value:0,label:0}),o&&o.p)for(u=0;u<o.p.length;u++){let _=o.p[u];f.push({label:_.v.toFixed(2),value:_.v,color:"#7c3aed"}),c.push({label:_.d>0?Ue(_.d)+"."+Ys[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,_.v))}if(o&&o.t){for(u=0;u<o.t.length;u++){let _=o.t[u];if(_>=i)break;a.push({value:_,label:_})}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:Um,max:i,ticks:a},x:{ticks:c},points:f})}},[n,i,o]}class Hm extends Ie{constructor(e){super(),Re(this,e,jm,Bm,Ee,{})}}function gu(t,e,l){const n=t.slice();return n[18]=e[l],n[20]=l,n}function ku(t,e,l){const n=t.slice();return n[21]=e[l],n}function wu(t){let e,l,n,i,o,u=t[7],a=[];for(let _=0;_<u.length;_+=1)a[_]=Cu(ku(t,u,_));let c=t[8],f=[];for(let _=0;_<c.length;_+=1)f[_]=Mu(gu(t,c,_));return{c(){e=De("svg"),l=De("g");for(let _=0;_<a.length;_+=1)a[_].c();n=De("g");for(let _=0;_<f.length;_+=1)f[_].c();i=De("polyline"),r(l,"class","axis y-axis"),r(n,"class","axis x-axis"),r(i,"opacity","0.9"),r(i,"fill","#7c3aed"),r(i,"stroke","#7c3aed"),r(i,"stroke-width","1"),r(i,"points",t[4]),r(e,"viewBox",o="0 0 "+t[3]+" "+t[2]),r(e,"height","100%")},m(_,p){S(_,e,p),s(e,l);for(let b=0;b<a.length;b+=1)a[b]&&a[b].m(l,null);s(e,n);for(let b=0;b<f.length;b+=1)f[b]&&f[b].m(n,null);s(e,i)},p(_,p){if(p&160){u=_[7];let b;for(b=0;b<u.length;b+=1){const v=ku(_,u,b);a[b]?a[b].p(v,p):(a[b]=Cu(v),a[b].c(),a[b].m(l,null))}for(;b<a.length;b+=1)a[b].d(1);a.length=u.length}if(p&836){c=_[8];let b;for(b=0;b<c.length;b+=1){const v=gu(_,c,b);f[b]?f[b].p(v,p):(f[b]=Mu(v),f[b].c(),f[b].m(n,null))}for(;b<f.length;b+=1)f[b].d(1);f.length=c.length}p&16&&r(i,"points",_[4]),p&12&&o!==(o="0 0 "+_[3]+" "+_[2])&&r(e,"viewBox",o)},d(_){_&&$(e),dt(a,_),dt(f,_)}}}function yu(t){let e,l,n,i=t[21].label+"",o,u,a;return{c(){e=De("g"),l=De("line"),n=De("text"),o=E(i),r(l,"x2","100%"),r(n,"y","-4"),r(e,"class",u="tick tick-"+t[21].value),r(e,"transform",a="translate(0, "+t[5](t[21].value)+")")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(n,o)},p(c,f){f&128&&i!==(i=c[21].label+"")&&J(o,i),f&128&&u!==(u="tick tick-"+c[21].value)&&r(e,"class",u),f&160&&a!==(a="translate(0, "+c[5](c[21].value)+")")&&r(e,"transform",a)},d(c){c&&$(e)}}}function Cu(t){let e=!isNaN(t[5](t[21].value)),l,n=e&&yu(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&160&&(e=!isNaN(i[5](i[21].value))),e?n?n.p(i,o):(n=yu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function $u(t){let e=t[20]%Math.round(6/t[9])==0,l,n=e&&Su(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&512&&(e=i[20]%Math.round(6/i[9])==0),e?n?n.p(i,o):(n=Su(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function Su(t){let e,l,n=t[18].label+"",i,o,u;return{c(){e=De("g"),l=De("text"),i=E(n),r(l,"x",o=t[9]/2),r(l,"y","-4"),r(e,"class","tick"),r(e,"transform",u="translate("+(40+t[6](t[18].value))+","+t[2]+")")},m(a,c){S(a,e,c),s(e,l),s(l,i)},p(a,c){c&256&&n!==(n=a[18].label+"")&&J(i,n),c&512&&o!==(o=a[9]/2)&&r(l,"x",o),c&324&&u!==(u="translate("+(40+a[6](a[18].value))+","+a[2]+")")&&r(e,"transform",u)},d(a){a&&$(e)}}}function Mu(t){let e=!isNaN(t[6](t[18].value)),l,n=e&&$u(t);return{c(){n&&n.c(),l=Ke()},m(i,o){n&&n.m(i,o),S(i,l,o)},p(i,o){o&320&&(e=!isNaN(i[6](i[18].value))),e?n?n.p(i,o):(n=$u(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&$(l)}}}function Wm(t){let e,l,n,i,o,u,a,c=t[7]&&wu(t);return{c(){e=m("div"),l=m("strong"),n=E("Realtime ("),i=E(t[10]),o=E(")"),u=h(),c&&c.c(),r(l,"class","text-sm"),r(e,"class","chart"),We(()=>t[14].call(e))},m(f,_){S(f,e,_),s(e,l),s(l,n),s(l,i),s(l,o),s(e,u),c&&c.m(e,null),a=mo(e,t[14].bind(e))},p(f,[_]){_&1024&&J(i,f[10]),f[7]?c?c.p(f,_):(c=wu(f),c.c(),c.m(e,null)):c&&(c.d(1),c=null)},i:pe,o:pe,d(f){f&&$(e),c&&c.d(),a()}}}let zm=12;function Gm(t,e,l){let n;Yc.subscribe(I=>{l(11,n=I)});let i,o=0;function u(){n.data.unshift(0),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)}Bc.subscribe(I=>{o>0?n.data&&I.u-o>=10&&(i&&clearTimeout(i),n.data.unshift(I.i-I.e),l(11,n.data=n.data.slice(0,n.size),n),o+=10,i=setTimeout(u,1e4)):o=I.u});let a,c,f,_,p,b,v,d,g,w,T,M,P;function L(){f=this.clientWidth,_=this.clientHeight,l(0,f),l(1,_)}return t.$$.update=()=>{if(t.$$.dirty&14847&&(l(2,p=parseInt(_)-50),l(3,b=f-35),l(9,M=b/n.size),l(13,c=0),l(12,a=0),n.data)){for(let F in n.data){let C=n.data[F];l(12,a=Math.max(Math.ceil(C/1e3)*1e3,a)),l(13,c=Math.min(Math.ceil(C/1e3)*1e3,c))}l(10,P=a>2500?"kW":"W"),l(7,w=[]);for(let F=c;F<a;F+=a/5)w.push({value:F,label:a>2500?(F/1e3).toFixed(1):F});l(8,T=[]);for(let F=c;F<n.size;F+=n.size/zm)T.push({value:F,label:"-"+Math.round((n.size-F)/6)+" min"});l(5,d=function(F){return Math.ceil(p-F/a*p)-25}),l(6,g=function(F){return 30+Math.ceil(F/n.size*(b-35))});let I=n.size;l(4,v=g(n.size)+","+d(0)+" "+g(1)+","+d(0));for(let F in n.data){if(I<0)break;let C=n.data[F];C!=0&&l(4,v=g(I--)+","+d(C)+" "+v)}}},[f,_,p,b,v,d,g,w,T,M,P,n,a,c,L]}class Vm extends Ie{constructor(e){super(),Re(this,e,Gm,Wm,Ee,{})}}function Tu(t){let e,l,n,i,o,u,a=(t[0].mt?vs(t[0].mt):"-")+"",c,f,_,p=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new xc({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:qc}}),{c(){e=m("div"),l=m("div"),n=m("div"),re(i.$$.fragment),o=h(),u=m("div"),c=E(a),f=h(),_=m("div"),b=E(p),v=E(" kWh"),r(n,"class","col-span-2"),r(_,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(g,w){S(g,e,w),s(e,l),s(l,n),ie(i,n,null),s(l,o),s(l,u),s(u,c),s(l,f),s(l,_),s(_,b),s(_,v),d=!0},p(g,w){const T={};w&1&&(T.val=g[0].i?g[0].i:0),w&1&&(T.max=g[0].im?g[0].im:15e3),w&1&&(T.sub=g[0].p),w&1&&(T.subunit=g[0].pc),i.$set(T),(!d||w&1)&&a!==(a=(g[0].mt?vs(g[0].mt):"-")+"")&&J(c,a),(!d||w&1)&&p!==(p=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&J(b,p)},i(g){d||(O(i.$$.fragment,g),d=!0)},o(g){q(i.$$.fragment,g),d=!1},d(g){g&&$(e),se(i)}}}function Nu(t){let e,l,n,i,o,u,a,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",_,p,b;return i=new xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:S0}}),{c(){e=m("div"),l=m("div"),n=m("div"),re(i.$$.fragment),o=h(),u=m("div"),a=h(),c=m("div"),_=E(f),p=E(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){S(v,e,d),s(e,l),s(l,n),ie(i,n,null),s(l,o),s(l,u),s(l,a),s(l,c),s(c,_),s(c,p),b=!0},p(v,d){const g={};d&1&&(g.val=v[0].e?v[0].e:0),d&1&&(g.max=v[0].om?v[0].om*1e3:1e4),i.$set(g),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&J(_,f)},i(v){b||(O(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&$(e),se(i)}}}function Eu(t){let e,l,n;return l=new dm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.ds=i[0].ds),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Au(t){let e,l,n;return l=new bm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i2e:t[0].i2e,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.u1=i[0].u1),o&1&&(u.u2=i[0].u2),o&1&&(u.u3=i[0].u3),o&1&&(u.i1=i[0].i1),o&1&&(u.i2=i[0].i2),o&1&&(u.i2e=i[0].i2e),o&1&&(u.i3=i[0].i3),o&1&&(u.max=i[0].mf?i[0].mf:32),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Pu(t){let e,l,n;return l=new wm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Du(t){let e,l,n;return l=new Mm({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"),re(l.$$.fragment),r(e,"class","cnt")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Ru(t){let e,l,n;return l=new Hm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Iu(t){let e,l,n;return l=new Vm({}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Lu(t){let e,l,n;return l=new Em({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Ou(t){let e,l,n;return l=new Dm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Fu(t){let e,l,n;return l=new Lm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function qu(t){let e,l,n;return l=new qm({props:{json:t[5]}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o&32&&(u.json=i[5]),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function Km(t){let e,l=Xe(t[1].ui.i,t[0].i),n,i=Xe(t[1].ui.e,t[0].om||t[0].e>0),o,u=Xe(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,c=Xe(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,_=Xe(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),p,b=Xe(t[1].ui.c,t[0].ea),v,d=Xe(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),g,w=Xe(t[1].ui.l),T,M=Xe(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),P,L=Xe(t[1].ui.d,t[3]),I,F=Xe(t[1].ui.m,t[4]),C,R=Xe(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),ne,H=l&&Tu(t),z=i&&Nu(t),U=u&&Eu(t),K=c&&Au(t),Q=_&&Pu(t),G=b&&Du(t),X=d&&Ru(),Y=w&&Iu(),j=M&&Lu(t),x=L&&Ou(t),ae=F&&Fu(t),ee=R&&qu(t);return{c(){e=m("div"),H&&H.c(),n=h(),z&&z.c(),o=h(),U&&U.c(),a=h(),K&&K.c(),f=h(),Q&&Q.c(),p=h(),G&&G.c(),v=h(),X&&X.c(),g=h(),Y&&Y.c(),T=h(),j&&j.c(),P=h(),x&&x.c(),I=h(),ae&&ae.c(),C=h(),ee&&ee.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(V,W){S(V,e,W),H&&H.m(e,null),s(e,n),z&&z.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),K&&K.m(e,null),s(e,f),Q&&Q.m(e,null),s(e,p),G&&G.m(e,null),s(e,v),X&&X.m(e,null),s(e,g),Y&&Y.m(e,null),s(e,T),j&&j.m(e,null),s(e,P),x&&x.m(e,null),s(e,I),ae&&ae.m(e,null),s(e,C),ee&&ee.m(e,null),ne=!0},p(V,[W]){W&3&&(l=Xe(V[1].ui.i,V[0].i)),l?H?(H.p(V,W),W&3&&O(H,1)):(H=Tu(V),H.c(),O(H,1),H.m(e,n)):H&&(Ae(),q(H,1,1,()=>{H=null}),Pe()),W&3&&(i=Xe(V[1].ui.e,V[0].om||V[0].e>0)),i?z?(z.p(V,W),W&3&&O(z,1)):(z=Nu(V),z.c(),O(z,1),z.m(e,o)):z&&(Ae(),q(z,1,1,()=>{z=null}),Pe()),W&3&&(u=Xe(V[1].ui.v,V[0].u1>100||V[0].u2>100||V[0].u3>100)),u?U?(U.p(V,W),W&3&&O(U,1)):(U=Eu(V),U.c(),O(U,1),U.m(e,a)):U&&(Ae(),q(U,1,1,()=>{U=null}),Pe()),W&3&&(c=Xe(V[1].ui.a,V[0].i1>.01||V[0].i2>.01||V[0].i3>.01)),c?K?(K.p(V,W),W&3&&O(K,1)):(K=Au(V),K.c(),O(K,1),K.m(e,f)):K&&(Ae(),q(K,1,1,()=>{K=null}),Pe()),W&3&&(_=Xe(V[1].ui.r,V[0].ri>0||V[0].re>0||V[0].ric>0||V[0].rec>0)),_?Q?(Q.p(V,W),W&3&&O(Q,1)):(Q=Pu(V),Q.c(),O(Q,1),Q.m(e,p)):Q&&(Ae(),q(Q,1,1,()=>{Q=null}),Pe()),W&3&&(b=Xe(V[1].ui.c,V[0].ea)),b?G?(G.p(V,W),W&3&&O(G,1)):(G=Du(V),G.c(),O(G,1),G.m(e,v)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),W&3&&(d=Xe(V[1].ui.t,V[0].pr&&(V[0].pr.startsWith("10YNO")||V[0].pr.startsWith("10Y1001A1001A4")))),d?X?W&3&&O(X,1):(X=Ru(),X.c(),O(X,1),X.m(e,g)):X&&(Ae(),q(X,1,1,()=>{X=null}),Pe()),W&2&&(w=Xe(V[1].ui.l)),w?Y?W&2&&O(Y,1):(Y=Iu(),Y.c(),O(Y,1),Y.m(e,T)):Y&&(Ae(),q(Y,1,1,()=>{Y=null}),Pe()),W&3&&(M=Xe(V[1].ui.p,V[0].pe&&!Number.isNaN(V[0].p))),M?j?(j.p(V,W),W&3&&O(j,1)):(j=Lu(V),j.c(),O(j,1),j.m(e,P)):j&&(Ae(),q(j,1,1,()=>{j=null}),Pe()),W&10&&(L=Xe(V[1].ui.d,V[3])),L?x?(x.p(V,W),W&10&&O(x,1)):(x=Ou(V),x.c(),O(x,1),x.m(e,I)):x&&(Ae(),q(x,1,1,()=>{x=null}),Pe()),W&18&&(F=Xe(V[1].ui.m,V[4])),F?ae?(ae.p(V,W),W&18&&O(ae,1)):(ae=Fu(V),ae.c(),O(ae,1),ae.m(e,C)):ae&&(Ae(),q(ae,1,1,()=>{ae=null}),Pe()),W&35&&(R=Xe(V[1].ui.s,V[0].t&&V[0].t!=-127&&V[5].c>1)),R?ee?(ee.p(V,W),W&35&&O(ee,1)):(ee=qu(V),ee.c(),O(ee,1),ee.m(e,null)):ee&&(Ae(),q(ee,1,1,()=>{ee=null}),Pe())},i(V){ne||(O(H),O(z),O(U),O(K),O(Q),O(G),O(X),O(Y),O(j),O(x),O(ae),O(ee),ne=!0)},o(V){q(H),q(z),q(U),q(K),q(Q),q(G),q(X),q(Y),q(j),q(x),q(ae),q(ee),ne=!1},d(V){V&&$(e),H&&H.d(),z&&z.d(),U&&U.d(),K&&K.d(),Q&&Q.d(),G&&G.d(),X&&X.d(),Y&&Y.d(),j&&j.d(),x&&x.d(),ae&&ae.d(),ee&&ee.d()}}}function Ym(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},u={},a={},c={};return go.subscribe(f=>{l(2,o=f)}),Hc.subscribe(f=>{l(3,u=f)}),Wc.subscribe(f=>{l(4,a=f)}),Gc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,u,a,c]}class Qm extends Ie{constructor(e){super(),Re(this,e,Ym,Km,Ee,{data:0,sysinfo:1})}}let lo={};const hi=it(lo);async function Xm(){lo=await(await fetch("/configuration.json")).json(),hi.set(lo)}let no={};const e1=it(no);async function Zm(){no=await(await fetch("/priceconfig.json")).json(),e1.set(no)}function Bu(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Jm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function xm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function Uu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function ju(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){S(i,e,o),S(i,l,o),S(i,n,o)},d(i){i&&$(e),i&&$(l),i&&$(n)}}}function Hu(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function Wu(t){let e,l,n;return{c(){e=m("option"),l=E("GPIO"),n=E(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){S(i,e,o),s(e,l),s(e,n)},d(i){i&&$(e)}}}function zu(t){let e,l=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Wu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,i){n[4]>1&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!((n[0]=="esp32s2"||n[0]=="esp32s3")&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Wu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&$(e)}}}function e_(t){let e,l,n,i,o;function u(d,g){return d[0]=="esp32c3"?xm:Jm}let a=u(t),c=a(t),f=t[0]=="esp8266"&&Uu(),_=(t[0]=="esp32"||t[0]=="esp32solo")&&ju(),p=(t[0]=="esp32s2"||t[0]=="esp32s3")&&Hu(),b={length:t[1]+1},v=[];for(let d=0;d<b.length;d+=1)v[d]=zu(Bu(t,b,d));return{c(){c.c(),e=h(),f&&f.c(),l=h(),_&&_.c(),n=h(),p&&p.c(),i=h();for(let d=0;d<v.length;d+=1)v[d].c();o=Ke()},m(d,g){c.m(d,g),S(d,e,g),f&&f.m(d,g),S(d,l,g),_&&_.m(d,g),S(d,n,g),p&&p.m(d,g),S(d,i,g);for(let w=0;w<v.length;w+=1)v[w]&&v[w].m(d,g);S(d,o,g)},p(d,[g]){if(a!==(a=u(d))&&(c.d(1),c=a(d),c&&(c.c(),c.m(e.parentNode,e))),d[0]=="esp8266"?f||(f=Uu(),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),d[0]=="esp32"||d[0]=="esp32solo"?_||(_=ju(),_.c(),_.m(n.parentNode,n)):_&&(_.d(1),_=null),d[0]=="esp32s2"||d[0]=="esp32s3"?p||(p=Hu(),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g&3){b={length:d[1]+1};let w;for(w=0;w<b.length;w+=1){const T=Bu(d,b,w);v[w]?v[w].p(T,g):(v[w]=zu(T),v[w].c(),v[w].m(o.parentNode,o))}for(;w<v.length;w+=1)v[w].d(1);v.length=b.length}},i:pe,o:pe,d(d){c.d(d),d&&$(e),f&&f.d(d),d&&$(l),_&&_.d(d),d&&$(n),p&&p.d(d),d&&$(i),dt(v,d),d&&$(o)}}}function t_(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"esp32s3":l(1,i=46);break;case"esp32c3":l(1,i=19);break}},[n,i]}class io extends Ie{constructor(e){super(),Re(this,e,t_,e_,Ee,{chip:0})}}function Gu(t){let e,l,n=t[1]&&Vu(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){S(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=Vu(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&$(e),n&&n.d()}}}function Vu(t){let e,l;return{c(){e=m("div"),l=E(t[1]),r(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(n,i){S(n,e,i),s(e,l)},p(n,i){i&2&&J(l,n[1])},d(n){n&&$(e)}}}function l_(t){let e,l=t[0]&&Gu(t);return{c(){l&&l.c(),e=Ke()},m(n,i){l&&l.m(n,i),S(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Gu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:pe,o:pe,d(n){l&&l.d(n),n&&$(e)}}}function n_(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 kt extends Ie{constructor(e){super(),Re(this,e,n_,l_,Ee,{active:0,message:1})}}function Ku(t,e,l){const n=t.slice();return n[1]=e[l],n}function Yu(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=E("Europe/"),i=E(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){S(o,e,u),s(e,l),s(e,i)},p:pe,d(o){o&&$(e)}}}function i_(t){let e,l,n,i=t[0],o=[];for(let u=0;u<i.length;u+=1)o[u]=Yu(Ku(t,i,u));return{c(){e=m("option"),e.textContent="GMT",l=h();for(let u=0;u<o.length;u+=1)o[u].c();n=Ke(),e.__value="GMT",e.value=e.__value},m(u,a){S(u,e,a),S(u,l,a);for(let c=0;c<o.length;c+=1)o[c]&&o[c].m(u,a);S(u,n,a)},p(u,[a]){if(a&1){i=u[0];let c;for(c=0;c<i.length;c+=1){const f=Ku(u,i,c);o[c]?o[c].p(f,a):(o[c]=Yu(f),o[c].c(),o[c].m(n.parentNode,n))}for(;c<o.length;c+=1)o[c].d(1);o.length=i.length}},i:pe,o:pe,d(u){u&&$(e),u&&$(l),dt(o,u),u&&$(n)}}}function s_(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 o_ extends Ie{constructor(e){super(),Re(this,e,s_,i_,Ee,{})}}function r_(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d;return{c(){e=m("optgroup"),l=m("option"),l.textContent="/24",n=h(),i=m("optgroup"),o=m("option"),o.textContent="/25",u=m("option"),u.textContent="/26",a=m("option"),a.textContent="/27",c=m("option"),c.textContent="/28",f=m("option"),f.textContent="/29",_=h(),p=m("optgroup"),b=m("option"),b.textContent="/23",v=m("option"),v.textContent="/22",d=m("option"),d.textContent="/16",l.__value="255.255.255.0",l.value=l.__value,r(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,u.__value="255.255.255.192",u.value=u.__value,a.__value="255.255.255.224",a.value=a.__value,c.__value="255.255.255.240",c.value=c.__value,f.__value="255.255.255.248",f.value=f.__value,r(i,"label","Smaller subnets"),b.__value="255.255.254.0",b.value=b.__value,v.__value="255.255.252.0",v.value=v.__value,d.__value="255.255.0.0",d.value=d.__value,r(p,"label","Larger subnets")},m(g,w){S(g,e,w),s(e,l),S(g,n,w),S(g,i,w),s(i,o),s(i,u),s(i,a),s(i,c),s(i,f),S(g,_,w),S(g,p,w),s(p,b),s(p,v),s(p,d)},p:pe,i:pe,o:pe,d(g){g&&$(e),g&&$(n),g&&$(i),g&&$(_),g&&$(p)}}}class t1 extends Ie{constructor(e){super(),Re(this,e,null,r_,Ee,{})}}function a_(t){let e,l;return{c(){e=De("svg"),l=De("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-4 h-4")},m(n,i){S(n,e,i),s(e,l)},p:pe,i:pe,o:pe,d(n){n&&$(e)}}}class gs extends Ie{constructor(e){super(),Re(this,e,null,a_,Ee,{})}}var u_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},l1={exports:{}};(function(t,e){(function(l,n){t.exports=n()})(u_,function(){var l=function(){},n=Object.prototype.hasOwnProperty,i=Array.prototype.slice;function o(N,y){var k;return typeof Object.create=="function"?k=Object.create(N):(l.prototype=N,k=new l,l.prototype=null),y&&a(!0,k,y),k}function u(N,y,k,A){var D=this;return typeof N!="string"&&(A=k,k=y,y=N,N=null),typeof y!="function"&&(A=k,k=y,y=function(){return D.apply(this,arguments)}),a(!1,y,D,A),y.prototype=o(D.prototype,k),y.prototype.constructor=y,y.class_=N||D.class_,y.super_=D,y}function a(N,y,k){k=i.call(arguments,2);for(var A,D,Z=0,le=k.length;Z<le;Z++){D=k[Z];for(A in D)(!N||n.call(D,A))&&(y[A]=D[A])}}var c=u;function f(){}f.class_="Nevis",f.super_=Object,f.extend=c;var _=f,p=_,b=p.extend(function(N,y,k){this.qrious=N,this.element=y,this.element.qrious=N,this.enabled=Boolean(k)},{draw:function(N){},getElement:function(){return this.enabled||(this.enabled=!0,this.render()),this.element},getModuleSize:function(N){var y=this.qrious,k=y.padding||0,A=Math.floor((y.size-k*2)/N.width);return Math.max(1,A)},render:function(N){this.enabled&&(this.resize(),this.reset(),this.draw(N))},reset:function(){},resize:function(){}}),v=b,d=v.extend({draw:function(N){var y,k,A=this.qrious,D=this.getModuleSize(N),Z=parseInt((this.element.width-N.width*D)/2),le=this.element.getContext("2d");for(le.fillStyle=A.foreground,le.globalAlpha=A.foregroundAlpha,y=0;y<N.width;y++)for(k=0;k<N.width;k++)N.buffer[k*N.width+y]&&le.fillRect(D*y+Z,D*k+Z,D,D)},reset:function(){var N=this.qrious,y=this.element.getContext("2d"),k=N.size;y.lineWidth=1,y.clearRect(0,0,k,k),y.fillStyle=N.background,y.globalAlpha=N.backgroundAlpha,y.fillRect(0,0,k,k)},resize:function(){var N=this.element;N.width=N.height=this.qrious.size}}),g=d,w=p.extend(null,{BLOCK:[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28]}),T=w,M=p.extend(null,{BLOCKS:[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],FINAL_FORMAT:[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],LEVELS:{L:1,M:2,Q:3,H:4}}),P=M,L=p.extend(null,{EXPONENT:[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],LOG:[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175]}),I=L,F=p.extend(null,{BLOCK:[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177]}),C=F,R=p.extend(function(N){var y,k,A,D,Z,le=N.value.length;for(this._badness=[],this._level=P.LEVELS[N.level],this._polynomial=[],this._value=N.value,this._version=0,this._stringBuffer=[];this._version<40&&(this._version++,A=(this._level-1)*4+(this._version-1)*16,D=P.BLOCKS[A++],Z=P.BLOCKS[A++],y=P.BLOCKS[A++],k=P.BLOCKS[A],A=y*(D+Z)+Z-3+(this._version<=9),!(le<=A)););this._dataBlock=y,this._eccBlock=k,this._neccBlock1=D,this._neccBlock2=Z;var fe=this.width=17+4*this._version;this.buffer=R._createArray(fe*fe),this._ecc=R._createArray(y+(y+k)*(D+Z)+Z),this._mask=R._createArray((fe*(fe+1)+1)/2),this._insertFinders(),this._insertAlignments(),this.buffer[8+fe*(fe-8)]=1,this._insertTimingGap(),this._reverseMask(),this._insertTimingRowAndColumn(),this._insertVersion(),this._syncMask(),this._convertBitStream(le),this._calculatePolynomial(),this._appendEccToData(),this._interleaveBlocks(),this._pack(),this._finish()},{_addAlignment:function(N,y){var k,A=this.buffer,D=this.width;for(A[N+D*y]=1,k=-2;k<2;k++)A[N+k+D*(y-2)]=1,A[N-2+D*(y+k+1)]=1,A[N+2+D*(y+k)]=1,A[N+k+1+D*(y+2)]=1;for(k=0;k<2;k++)this._setMask(N-1,y+k),this._setMask(N+1,y-k),this._setMask(N-k,y-1),this._setMask(N+k,y+1)},_appendData:function(N,y,k,A){var D,Z,le,fe=this._polynomial,de=this._stringBuffer;for(Z=0;Z<A;Z++)de[k+Z]=0;for(Z=0;Z<y;Z++){if(D=I.LOG[de[N+Z]^de[k]],D!==255)for(le=1;le<A;le++)de[k+le-1]=de[k+le]^I.EXPONENT[R._modN(D+fe[A-le])];else for(le=k;le<k+A;le++)de[le]=de[le+1];de[k+A-1]=D===255?0:I.EXPONENT[R._modN(D+fe[0])]}},_appendEccToData:function(){var N,y=0,k=this._dataBlock,A=this._calculateMaxLength(),D=this._eccBlock;for(N=0;N<this._neccBlock1;N++)this._appendData(y,k,A,D),y+=k,A+=D;for(N=0;N<this._neccBlock2;N++)this._appendData(y,k+1,A,D),y+=k+1,A+=D},_applyMask:function(N){var y,k,A,D,Z=this.buffer,le=this.width;switch(N){case 0:for(D=0;D<le;D++)for(A=0;A<le;A++)!(A+D&1)&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 1:for(D=0;D<le;D++)for(A=0;A<le;A++)!(D&1)&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 2:for(D=0;D<le;D++)for(y=0,A=0;A<le;A++,y++)y===3&&(y=0),!y&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 3:for(k=0,D=0;D<le;D++,k++)for(k===3&&(k=0),y=k,A=0;A<le;A++,y++)y===3&&(y=0),!y&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 4:for(D=0;D<le;D++)for(y=0,k=D>>1&1,A=0;A<le;A++,y++)y===3&&(y=0,k=!k),!k&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 5:for(k=0,D=0;D<le;D++,k++)for(k===3&&(k=0),y=0,A=0;A<le;A++,y++)y===3&&(y=0),!((A&D&1)+!(!y|!k))&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 6:for(k=0,D=0;D<le;D++,k++)for(k===3&&(k=0),y=0,A=0;A<le;A++,y++)y===3&&(y=0),!((A&D&1)+(y&&y===k)&1)&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break;case 7:for(k=0,D=0;D<le;D++,k++)for(k===3&&(k=0),y=0,A=0;A<le;A++,y++)y===3&&(y=0),!((y&&y===k)+(A+D&1)&1)&&!this._isMasked(A,D)&&(Z[A+D*le]^=1);break}},_calculateMaxLength:function(){return this._dataBlock*(this._neccBlock1+this._neccBlock2)+this._neccBlock2},_calculatePolynomial:function(){var N,y,k=this._eccBlock,A=this._polynomial;for(A[0]=1,N=0;N<k;N++){for(A[N+1]=1,y=N;y>0;y--)A[y]=A[y]?A[y-1]^I.EXPONENT[R._modN(I.LOG[A[y]]+N)]:A[y-1];A[0]=I.EXPONENT[R._modN(I.LOG[A[0]]+N)]}for(N=0;N<=k;N++)A[N]=I.LOG[A[N]]},_checkBadness:function(){var N,y,k,A,D,Z=0,le=this._badness,fe=this.buffer,de=this.width;for(D=0;D<de-1;D++)for(A=0;A<de-1;A++)(fe[A+de*D]&&fe[A+1+de*D]&&fe[A+de*(D+1)]&&fe[A+1+de*(D+1)]||!(fe[A+de*D]||fe[A+1+de*D]||fe[A+de*(D+1)]||fe[A+1+de*(D+1)]))&&(Z+=R.N2);var Ce=0;for(D=0;D<de;D++){for(k=0,le[0]=0,N=0,A=0;A<de;A++)y=fe[A+de*D],N===y?le[k]++:le[++k]=1,N=y,Ce+=N?1:-1;Z+=this._getBadness(k)}Ce<0&&(Ce=-Ce);var Oe=0,ue=Ce;for(ue+=ue<<2,ue<<=1;ue>de*de;)ue-=de*de,Oe++;for(Z+=Oe*R.N4,A=0;A<de;A++){for(k=0,le[0]=0,N=0,D=0;D<de;D++)y=fe[A+de*D],N===y?le[k]++:le[++k]=1,N=y;Z+=this._getBadness(k)}return Z},_convertBitStream:function(N){var y,k,A=this._ecc,D=this._version;for(k=0;k<N;k++)A[k]=this._value.charCodeAt(k);var Z=this._stringBuffer=A.slice(),le=this._calculateMaxLength();N>=le-2&&(N=le-2,D>9&&N--);var fe=N;if(D>9){for(Z[fe+2]=0,Z[fe+3]=0;fe--;)y=Z[fe],Z[fe+3]|=255&y<<4,Z[fe+2]=y>>4;Z[2]|=255&N<<4,Z[1]=N>>4,Z[0]=64|N>>12}else{for(Z[fe+1]=0,Z[fe+2]=0;fe--;)y=Z[fe],Z[fe+2]|=255&y<<4,Z[fe+1]=y>>4;Z[1]|=255&N<<4,Z[0]=64|N>>4}for(fe=N+3-(D<10);fe<le;)Z[fe++]=236,Z[fe++]=17},_getBadness:function(N){var y,k=0,A=this._badness;for(y=0;y<=N;y++)A[y]>=5&&(k+=R.N1+A[y]-5);for(y=3;y<N-1;y+=2)A[y-2]===A[y+2]&&A[y+2]===A[y-1]&&A[y-1]===A[y+1]&&A[y-1]*3===A[y]&&(A[y-3]===0||y+3>N||A[y-3]*3>=A[y]*4||A[y+3]*3>=A[y]*4)&&(k+=R.N3);return k},_finish:function(){this._stringBuffer=this.buffer.slice();var N,y,k=0,A=3e4;for(y=0;y<8&&(this._applyMask(y),N=this._checkBadness(),N<A&&(A=N,k=y),k!==7);y++)this.buffer=this._stringBuffer.slice();k!==y&&this._applyMask(k),A=P.FINAL_FORMAT[k+(this._level-1<<3)];var D=this.buffer,Z=this.width;for(y=0;y<8;y++,A>>=1)A&1&&(D[Z-1-y+Z*8]=1,y<6?D[8+Z*y]=1:D[8+Z*(y+1)]=1);for(y=0;y<7;y++,A>>=1)A&1&&(D[8+Z*(Z-7+y)]=1,y?D[6-y+Z*8]=1:D[7+Z*8]=1)},_interleaveBlocks:function(){var N,y,k=this._dataBlock,A=this._ecc,D=this._eccBlock,Z=0,le=this._calculateMaxLength(),fe=this._neccBlock1,de=this._neccBlock2,Ce=this._stringBuffer;for(N=0;N<k;N++){for(y=0;y<fe;y++)A[Z++]=Ce[N+y*k];for(y=0;y<de;y++)A[Z++]=Ce[fe*k+N+y*(k+1)]}for(y=0;y<de;y++)A[Z++]=Ce[fe*k+N+y*(k+1)];for(N=0;N<D;N++)for(y=0;y<fe+de;y++)A[Z++]=Ce[le+N+y*D];this._stringBuffer=A},_insertAlignments:function(){var N,y,k,A=this._version,D=this.width;if(A>1)for(N=T.BLOCK[A],k=D-7;;){for(y=D-7;y>N-3&&(this._addAlignment(y,k),!(y<N));)y-=N;if(k<=N+9)break;k-=N,this._addAlignment(6,k),this._addAlignment(k,6)}},_insertFinders:function(){var N,y,k,A,D=this.buffer,Z=this.width;for(N=0;N<3;N++){for(y=0,A=0,N===1&&(y=Z-7),N===2&&(A=Z-7),D[A+3+Z*(y+3)]=1,k=0;k<6;k++)D[A+k+Z*y]=1,D[A+Z*(y+k+1)]=1,D[A+6+Z*(y+k)]=1,D[A+k+1+Z*(y+6)]=1;for(k=1;k<5;k++)this._setMask(A+k,y+1),this._setMask(A+1,y+k+1),this._setMask(A+5,y+k),this._setMask(A+k+1,y+5);for(k=2;k<4;k++)D[A+k+Z*(y+2)]=1,D[A+2+Z*(y+k+1)]=1,D[A+4+Z*(y+k)]=1,D[A+k+1+Z*(y+4)]=1}},_insertTimingGap:function(){var N,y,k=this.width;for(y=0;y<7;y++)this._setMask(7,y),this._setMask(k-8,y),this._setMask(7,y+k-7);for(N=0;N<8;N++)this._setMask(N,7),this._setMask(N+k-8,7),this._setMask(N,k-8)},_insertTimingRowAndColumn:function(){var N,y=this.buffer,k=this.width;for(N=0;N<k-14;N++)N&1?(this._setMask(8+N,6),this._setMask(6,8+N)):(y[8+N+k*6]=1,y[6+k*(8+N)]=1)},_insertVersion:function(){var N,y,k,A,D=this.buffer,Z=this._version,le=this.width;if(Z>6)for(N=C.BLOCK[Z-7],y=17,k=0;k<6;k++)for(A=0;A<3;A++,y--)1&(y>11?Z>>y-12:N>>y)?(D[5-k+le*(2-A+le-11)]=1,D[2-A+le-11+le*(5-k)]=1):(this._setMask(5-k,2-A+le-11),this._setMask(2-A+le-11,5-k))},_isMasked:function(N,y){var k=R._getMaskBit(N,y);return this._mask[k]===1},_pack:function(){var N,y,k,A=1,D=1,Z=this.width,le=Z-1,fe=Z-1,de=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(y=0;y<de;y++)for(N=this._stringBuffer[y],k=0;k<8;k++,N<<=1){128&N&&(this.buffer[le+Z*fe]=1);do D?le--:(le++,A?fe!==0?fe--:(le-=2,A=!A,le===6&&(le--,fe=9)):fe!==Z-1?fe++:(le-=2,A=!A,le===6&&(le--,fe-=8))),D=!D;while(this._isMasked(le,fe))}},_reverseMask:function(){var N,y,k=this.width;for(N=0;N<9;N++)this._setMask(N,8);for(N=0;N<8;N++)this._setMask(N+k-8,8),this._setMask(8,N);for(y=0;y<7;y++)this._setMask(8,y+k-7)},_setMask:function(N,y){var k=R._getMaskBit(N,y);this._mask[k]=1},_syncMask:function(){var N,y,k=this.width;for(y=0;y<k;y++)for(N=0;N<=y;N++)this.buffer[N+k*y]&&this._setMask(N,y)}},{_createArray:function(N){var y,k=[];for(y=0;y<N;y++)k[y]=0;return k},_getMaskBit:function(N,y){var k;return N>y&&(k=N,N=y,y=k),k=y,k+=y*y,k>>=1,k+=N,k},_modN:function(N){for(;N>=255;)N-=255,N=(N>>8)+(N&255);return N},N1:3,N2:3,N3:40,N4:10}),ne=R,H=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var N=this.element;N.width=N.height=this.qrious.size}}),z=H,U=p.extend(function(N,y,k,A){this.name=N,this.modifiable=Boolean(y),this.defaultValue=k,this._valueTransformer=A},{transform:function(N){var y=this._valueTransformer;return typeof y=="function"?y(N,this):N}}),K=U,Q=p.extend(null,{abs:function(N){return N!=null?Math.abs(N):null},hasOwn:function(N,y){return Object.prototype.hasOwnProperty.call(N,y)},noop:function(){},toUpperCase:function(N){return N!=null?N.toUpperCase():null}}),G=Q,X=p.extend(function(N){this.options={},N.forEach(function(y){this.options[y.name]=y},this)},{exists:function(N){return this.options[N]!=null},get:function(N,y){return X._get(this.options[N],y)},getAll:function(N){var y,k=this.options,A={};for(y in k)G.hasOwn(k,y)&&(A[y]=X._get(k[y],N));return A},init:function(N,y,k){typeof k!="function"&&(k=G.noop);var A,D;for(A in this.options)G.hasOwn(this.options,A)&&(D=this.options[A],X._set(D,D.defaultValue,y),X._createAccessor(D,y,k));this._setAll(N,y,!0)},set:function(N,y,k){return this._set(N,y,k)},setAll:function(N,y){return this._setAll(N,y)},_set:function(N,y,k,A){var D=this.options[N];if(!D)throw new Error("Invalid option: "+N);if(!D.modifiable&&!A)throw new Error("Option cannot be modified: "+N);return X._set(D,y,k)},_setAll:function(N,y,k){if(!N)return!1;var A,D=!1;for(A in N)G.hasOwn(N,A)&&this._set(A,N[A],y,k)&&(D=!0);return D}},{_createAccessor:function(N,y,k){var A={get:function(){return X._get(N,y)}};N.modifiable&&(A.set=function(D){X._set(N,D,y)&&k(D,N)}),Object.defineProperty(y,N.name,A)},_get:function(N,y){return y["_"+N.name]},_set:function(N,y,k){var A="_"+N.name,D=k[A],Z=N.transform(y!=null?y:N.defaultValue);return k[A]=Z,Z!==D}}),Y=X,j=p.extend(function(){this._services={}},{getService:function(N){var y=this._services[N];if(!y)throw new Error("Service is not being managed with name: "+N);return y},setService:function(N,y){if(this._services[N])throw new Error("Service is already managed with name: "+N);y&&(this._services[N]=y)}}),x=j,ae=new Y([new K("background",!0,"white"),new K("backgroundAlpha",!0,1,G.abs),new K("element"),new K("foreground",!0,"black"),new K("foregroundAlpha",!0,1,G.abs),new K("level",!0,"L",G.toUpperCase),new K("mime",!0,"image/png"),new K("padding",!0,null,G.abs),new K("size",!0,100,G.abs),new K("value",!0,"")]),ee=new x,V=p.extend(function(N){ae.init(N,this,this.update.bind(this));var y=ae.get("element",this),k=ee.getService("element"),A=y&&k.isCanvas(y)?y:k.createCanvas(),D=y&&k.isImage(y)?y:k.createImage();this._canvasRenderer=new g(this,A,!0),this._imageRenderer=new z(this,D,D===y),this.update()},{get:function(){return ae.getAll(this)},set:function(N){ae.setAll(N,this)&&this.update()},toDataURL:function(N){return this.canvas.toDataURL(N||this.mime)},update:function(){var N=new ne({level:this.level,value:this.value});this._canvasRenderer.render(N),this._imageRenderer.render(N)}},{use:function(N){ee.setService(N.getName(),N)}});Object.defineProperties(V.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var W=V,we=W,He=p.extend({getName:function(){}}),Le=He,Se=Le.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(N){},isImage:function(N){}}),ye=Se,ve=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(N){return N instanceof HTMLCanvasElement},isImage:function(N){return N instanceof HTMLImageElement}}),Te=ve;we.use(new Te);var be=we;return be})})(l1);const f_=l1.exports;function c_(t){let e,l;return{c(){e=m("img"),Ws(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){S(n,e,i)},p(n,[i]){i&4&&!Ws(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:pe,o:pe,d(n){n&&$(e)}}}function m_(t,e,l){const n=new f_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:a="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:_="qrcode"}=e,p="";function b(){n.set({background:o,foreground:u,level:i,padding:f,size:a,value:c}),l(2,p=n.toDataURL("image/jpeg"))}return ac(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,u=v.color),"size"in v&&l(6,a=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,_=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,_,p,i,o,u,a,f]}class __ extends Ie{constructor(e){super(),Re(this,e,m_,c_,Ee,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function Qu(t,e,l){const n=t.slice();return n[101]=e[l],n[102]=e,n[103]=l,n}function Xu(t,e,l){const n=t.slice();return n[104]=e[l],n[105]=e,n[106]=l,n}function p_(t,e,l){const n=t.slice();return n[107]=e[l],n}function d_(t,e,l){const n=t.slice();return n[110]=e[l],n}function v_(t){let e,l;return{c(){e=m("option"),l=E(t[110]),e.__value=t[110],e.value=e.__value},m(n,i){S(n,e,i),s(e,l)},p:pe,d(n){n&&$(e)}}}function h_(t){let e;return{c(){e=E("Configure price")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function Zu(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){S(o,e,u),S(o,l,u),oe(l,t[3].p.t),n||(i=te(l,"input",t[20]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].p.t&&oe(l,o[3].p.t)},d(o){o&&$(e),o&&$(l),n=!1,i()}}}function Ju(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=E("Username"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=E("Password"),f=m("br"),_=h(),p=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","gp"),r(p,"type","password"),r(p,"class","in-s"),r(a,"class","my-1")},m(d,g){S(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].g.u),S(d,u,g),S(d,a,g),s(a,c),s(a,f),s(a,_),s(a,p),oe(p,t[3].g.p),b||(v=[te(o,"input",t[22]),te(p,"input",t[23])],b=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&oe(o,d[3].g.u),g[0]&8&&p.value!==d[3].g.p&&oe(p,d[3].g.p)},d(d){d&&$(e),d&&$(u),d&&$(a),b=!1,ze(v)}}}function b_(t){let e,l=t[107]*100+"",n;return{c(){e=m("option"),n=E(l),e.__value=t[107]*100,e.value=e.__value},m(i,o){S(i,e,o),s(e,n)},p:pe,d(i){i&&$(e)}}}function xu(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,u){S(o,e,u),S(o,l,u),oe(l,t[3].m.e.k),n||(i=te(l,"input",t[33]),n=!0)},p(o,u){u[0]&8&&l.value!==o[3].m.e.k&&oe(l,o[3].m.e.k)},d(o){o&&$(e),o&&$(l),n=!1,i()}}}function ef(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=E("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].m.e.a),u||(a=te(o,"input",t[34]),u=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&oe(o,c[3].m.e.a)},d(c){c&&$(e),u=!1,a()}}}function tf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H;return{c(){e=m("div"),l=m("div"),n=E("Watt"),i=m("br"),o=h(),u=m("input"),a=h(),c=m("div"),f=E("Volt"),_=m("br"),p=h(),b=m("input"),v=h(),d=m("div"),g=E("Amp"),w=m("br"),T=h(),M=m("input"),P=h(),L=m("div"),I=E("kWh"),F=m("br"),C=h(),R=m("input"),r(u,"name","mmw"),r(u,"type","number"),r(u,"min","0.00"),r(u,"max","1000"),r(u,"step","0.001"),r(u,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(M,"name","mma"),r(M,"type","number"),r(M,"min","0.00"),r(M,"max","1000"),r(M,"step","0.001"),r(M,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(R,"name","mmc"),r(R,"type","number"),r(R,"min","0.00"),r(R,"max","1000"),r(R,"step","0.001"),r(R,"class","in-l tr w-full"),r(L,"class","w-1/4"),r(e,"class","flex my-1")},m(z,U){S(z,e,U),s(e,l),s(l,n),s(l,i),s(l,o),s(l,u),oe(u,t[3].m.m.w),s(e,a),s(e,c),s(c,f),s(c,_),s(c,p),s(c,b),oe(b,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,w),s(d,T),s(d,M),oe(M,t[3].m.m.a),s(e,P),s(e,L),s(L,I),s(L,F),s(L,C),s(L,R),oe(R,t[3].m.m.c),ne||(H=[te(u,"input",t[36]),te(b,"input",t[37]),te(M,"input",t[38]),te(R,"input",t[39])],ne=!0)},p(z,U){U[0]&8&&ge(u.value)!==z[3].m.m.w&&oe(u,z[3].m.m.w),U[0]&8&&ge(b.value)!==z[3].m.m.v&&oe(b,z[3].m.m.v),U[0]&8&&ge(M.value)!==z[3].m.m.a&&oe(M,z[3].m.m.a),U[0]&8&&ge(R.value)!==z[3].m.m.c&&oe(R,z[3].m.m.c)},d(z){z&&$(e),ne=!1,ze(H)}}}function lf(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function nf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee,V;return{c(){e=m("div"),l=E("SSID"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=E("Password"),f=m("br"),_=h(),p=m("input"),b=h(),v=m("div"),d=m("div"),g=E("Power saving"),w=m("br"),T=h(),M=m("select"),P=m("option"),P.textContent="Default",L=m("option"),L.textContent="Off",I=m("option"),I.textContent="Minimum",F=m("option"),F.textContent="Maximum",C=h(),R=m("div"),ne=E("Power"),H=m("br"),z=h(),U=m("div"),K=m("input"),Q=h(),G=m("span"),G.textContent="dBm",X=h(),Y=m("div"),j=m("label"),x=m("input"),ae=E(" Allow 802.11b legacy rates"),r(o,"name","ws"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(p,"name","wp"),r(p,"type","password"),r(p,"class","in-s"),r(a,"class","my-1"),P.__value=255,P.value=P.__value,L.__value=0,L.value=L.__value,I.__value=1,I.value=I.__value,F.__value=2,F.value=F.__value,r(M,"name","wz"),r(M,"class","in-s"),t[3].w.z===void 0&&We(()=>t[43].call(M)),r(d,"class","w-1/2"),r(K,"name","ww"),r(K,"type","number"),r(K,"min","0"),r(K,"max","20.5"),r(K,"step","0.5"),r(K,"class","in-f tr w-full"),r(G,"class","in-post"),r(U,"class","flex"),r(R,"class","ml-2 w-1/2"),r(v,"class","my-1 flex"),r(x,"type","checkbox"),r(x,"name","wb"),x.__value="true",x.value=x.__value,r(x,"class","rounded mb-1"),r(Y,"class","my-3")},m(W,we){S(W,e,we),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].w.s),S(W,u,we),S(W,a,we),s(a,c),s(a,f),s(a,_),s(a,p),oe(p,t[3].w.p),S(W,b,we),S(W,v,we),s(v,d),s(d,g),s(d,w),s(d,T),s(d,M),s(M,P),s(M,L),s(M,I),s(M,F),$e(M,t[3].w.z,!0),s(v,C),s(v,R),s(R,ne),s(R,H),s(R,z),s(R,U),s(U,K),oe(K,t[3].w.w),s(U,Q),s(U,G),S(W,X,we),S(W,Y,we),s(Y,j),s(j,x),x.checked=t[3].w.b,s(j,ae),ee||(V=[te(o,"input",t[41]),te(p,"input",t[42]),te(M,"change",t[43]),te(K,"input",t[44]),te(x,"change",t[45])],ee=!0)},p(W,we){we[0]&8&&o.value!==W[3].w.s&&oe(o,W[3].w.s),we[0]&8&&p.value!==W[3].w.p&&oe(p,W[3].w.p),we[0]&8&&$e(M,W[3].w.z),we[0]&8&&ge(K.value)!==W[3].w.w&&oe(K,W[3].w.w),we[0]&8&&(x.checked=W[3].w.b)},d(W){W&&$(e),W&&$(u),W&&$(a),W&&$(b),W&&$(v),W&&$(X),W&&$(Y),ee=!1,ze(V)}}}function sf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w;return{c(){e=m("div"),l=E("Gateway"),n=m("br"),i=h(),o=m("input"),u=h(),a=m("div"),c=E("DNS"),f=m("br"),_=h(),p=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(p,"class","flex"),r(a,"class","my-1")},m(T,M){S(T,e,M),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].n.g),S(T,u,M),S(T,a,M),s(a,c),s(a,f),s(a,_),s(a,p),s(p,b),oe(b,t[3].n.d1),s(p,v),s(p,d),oe(d,t[3].n.d2),g||(w=[te(o,"input",t[49]),te(b,"input",t[50]),te(d,"input",t[51])],g=!0)},p(T,M){M[0]&8&&o.value!==T[3].n.g&&oe(o,T[3].n.g),M[0]&8&&b.value!==T[3].n.d1&&oe(b,T[3].n.d1),M[0]&8&&d.value!==T[3].n.d2&&oe(d,T[3].n.d2)},d(T){T&&$(e),T&&$(u),T&&$(a),g=!1,ze(w)}}}function of(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=E(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(u,a){S(u,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[te(l,"change",t[55]),te(l,"change",t[14])],i=!0)},p(u,a){a[0]&8&&(l.checked=u[3].q.s.e)},d(u){u&&$(e),i=!1,ze(o)}}}function rf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;const d=[k_,g_],g=[];function w(C,R){return C[3].q.s.c?0:1}n=w(t),i=g[n]=d[n](t);const T=[$_,C_],M=[];function P(C,R){return C[3].q.s.r?0:1}a=P(t),c=M[a]=T[a](t);const L=[N_,T_],I=[];function F(C,R){return C[3].q.s.k?0:1}return p=F(t),b=I[p]=L[p](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),u=m("span"),c.c(),f=h(),_=m("span"),b.c(),r(l,"class","flex pr-2"),r(u,"class","flex pr-2"),r(_,"class","flex pr-2"),r(e,"class","my-1 flex")},m(C,R){S(C,e,R),s(e,l),g[n].m(l,null),s(e,o),s(e,u),M[a].m(u,null),s(e,f),s(e,_),I[p].m(_,null),v=!0},p(C,R){let ne=n;n=w(C),n===ne?g[n].p(C,R):(Ae(),q(g[ne],1,1,()=>{g[ne]=null}),Pe(),i=g[n],i?i.p(C,R):(i=g[n]=d[n](C),i.c()),O(i,1),i.m(l,null));let H=a;a=P(C),a===H?M[a].p(C,R):(Ae(),q(M[H],1,1,()=>{M[H]=null}),Pe(),c=M[a],c?c.p(C,R):(c=M[a]=T[a](C),c.c()),O(c,1),c.m(u,null));let z=p;p=F(C),p===z?I[p].p(C,R):(Ae(),q(I[z],1,1,()=>{I[z]=null}),Pe(),b=I[p],b?b.p(C,R):(b=I[p]=L[p](C),b.c()),O(b,1),b.m(_,null))},i(C){v||(O(i),O(c),O(b),v=!0)},o(C){q(i),q(c),q(b),v=!1},d(C){C&&$(e),g[n].d(),M[a].d(),I[p].d()}}}function g_(t){let e,l;return e=new Qt({props:{to:"/mqtt-ca",$$slots:{default:[w_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function k_(t){let e,l,n,i,o,u,a,c;return l=new Qt({props:{to:"/mqtt-ca",$$slots:{default:[y_]},$$scope:{ctx:t}}}),o=new gs({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){S(f,e,_),ie(l,e,null),S(f,n,_),S(f,i,_),ie(o,i,null),u=!0,a||(c=[te(i,"click",t[11]),te(i,"keypress",t[11])],a=!0)},p(f,_){const p={};_[3]&1048576&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&$(e),se(l),f&&$(n),f&&$(i),se(o),a=!1,ze(c)}}}function w_(t){let e,l;return e=new an({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function y_(t){let e;return{c(){e=E("CA OK")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function C_(t){let e,l;return e=new Qt({props:{to:"/mqtt-cert",$$slots:{default:[S_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function $_(t){let e,l,n,i,o,u,a,c;return l=new Qt({props:{to:"/mqtt-cert",$$slots:{default:[M_]},$$scope:{ctx:t}}}),o=new gs({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){S(f,e,_),ie(l,e,null),S(f,n,_),S(f,i,_),ie(o,i,null),u=!0,a||(c=[te(i,"click",t[12]),te(i,"keypress",t[12])],a=!0)},p(f,_){const p={};_[3]&1048576&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&$(e),se(l),f&&$(n),f&&$(i),se(o),a=!1,ze(c)}}}function S_(t){let e,l;return e=new an({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function M_(t){let e;return{c(){e=E("Cert OK")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function T_(t){let e,l;return e=new Qt({props:{to:"/mqtt-key",$$slots:{default:[E_]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i[3]&1048576&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function N_(t){let e,l,n,i,o,u,a,c;return l=new Qt({props:{to:"/mqtt-key",$$slots:{default:[A_]},$$scope:{ctx:t}}}),o=new gs({}),{c(){e=m("span"),re(l.$$.fragment),n=h(),i=m("span"),re(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,_){S(f,e,_),ie(l,e,null),S(f,n,_),S(f,i,_),ie(o,i,null),u=!0,a||(c=[te(i,"click",t[13]),te(i,"keypress",t[13])],a=!0)},p(f,_){const p={};_[3]&1048576&&(p.$$scope={dirty:_,ctx:f}),l.$set(p)},i(f){u||(O(l.$$.fragment,f),O(o.$$.fragment,f),u=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&$(e),se(l),f&&$(n),f&&$(i),se(o),a=!1,ze(c)}}}function E_(t){let e,l;return e=new an({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function A_(t){let e;return{c(){e=E("Key OK")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function af(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("div"),p=E("Electricity IDX"),b=m("br"),v=h(),d=m("input"),g=h(),w=m("div"),T=E("Current IDX"),M=m("br"),P=h(),L=m("input"),I=h(),F=m("div"),C=E(`Voltage IDX: L1, L2 & L3
`),R=m("div"),ne=m("input"),H=h(),z=m("input"),U=h(),K=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","o"),a.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(_,"class","w-1/2"),r(L,"name","oc"),r(L,"type","text"),r(L,"class","in-l tr w-full"),r(w,"class","w-1/2"),r(f,"class","my-1 flex"),r(ne,"name","ou1"),r(ne,"type","text"),r(ne,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(K,"name","ou3"),r(K,"type","text"),r(K,"class","in-l tr w-1/3"),r(R,"class","flex"),r(F,"class","my-1"),r(e,"class","cnt")},m(Y,j){S(Y,e,j),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),oe(d,t[3].o.e),s(f,g),s(f,w),s(w,T),s(w,M),s(w,P),s(w,L),oe(L,t[3].o.c),s(e,I),s(e,F),s(F,C),s(F,R),s(R,ne),oe(ne,t[3].o.u1),s(R,H),s(R,z),oe(z,t[3].o.u2),s(R,U),s(R,K),oe(K,t[3].o.u3),Q=!0,G||(X=[te(d,"input",t[63]),te(L,"input",t[64]),te(ne,"input",t[65]),te(z,"input",t[66]),te(K,"input",t[67])],G=!0)},p(Y,j){j[0]&8&&d.value!==Y[3].o.e&&oe(d,Y[3].o.e),j[0]&8&&L.value!==Y[3].o.c&&oe(L,Y[3].o.c),j[0]&8&&ne.value!==Y[3].o.u1&&oe(ne,Y[3].o.u1),j[0]&8&&z.value!==Y[3].o.u2&&oe(z,Y[3].o.u2),j[0]&8&&K.value!==Y[3].o.u3&&oe(K,Y[3].o.u3)},i(Y){Q||(O(o.$$.fragment,Y),Q=!0)},o(Y){q(o.$$.fragment,Y),Q=!1},d(Y){Y&&$(e),se(o),G=!1,ze(X)}}}function uf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=E("Discovery topic prefix"),p=m("br"),b=h(),v=m("input"),d=h(),g=m("div"),w=E("Hostname for URL"),T=m("br"),M=h(),P=m("input"),I=h(),F=m("div"),C=E("Name tag"),R=m("br"),ne=h(),H=m("input"),r(l,"class","text-sm"),r(i,"href",It("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","h"),a.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(P,"name","hh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"placeholder",L=t[3].g.h+".local"),r(g,"class","my-1"),r(H,"name","hn"),r(H,"type","text"),r(H,"class","in-s"),r(F,"class","my-1"),r(e,"class","cnt")},m(Q,G){S(Q,e,G),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),s(f,b),s(f,v),oe(v,t[3].h.t),s(e,d),s(e,g),s(g,w),s(g,T),s(g,M),s(g,P),oe(P,t[3].h.h),s(e,I),s(e,F),s(F,C),s(F,R),s(F,ne),s(F,H),oe(H,t[3].h.n),z=!0,U||(K=[te(v,"input",t[68]),te(P,"input",t[69]),te(H,"input",t[70])],U=!0)},p(Q,G){G[0]&8&&v.value!==Q[3].h.t&&oe(v,Q[3].h.t),(!z||G[0]&8&&L!==(L=Q[3].g.h+".local"))&&r(P,"placeholder",L),G[0]&8&&P.value!==Q[3].h.h&&oe(P,Q[3].h.h),G[0]&8&&H.value!==Q[3].h.n&&oe(H,Q[3].h.n)},i(Q){z||(O(o.$$.fragment,Q),z=!0)},o(Q){q(o.$$.fragment,Q),z=!1},d(Q){Q&&$(e),se(o),U=!1,ze(K)}}}function ff(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae;o=new Rt({});let ee=t[3].c.es&&cf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Cloud connections",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div"),_=m("label"),p=m("input"),b=E(" Enable cloud upload"),v=h(),d=m("div"),g=E("Client ID"),w=m("br"),T=h(),M=m("input"),I=h(),F=m("div"),C=E("Client secret"),R=m("br"),ne=h(),H=m("input"),U=h(),K=m("div"),Q=m("label"),G=m("input"),X=E(" Energy Speedometer"),Y=h(),ee&&ee.c(),r(l,"class","text-sm"),r(i,"href",It("Cloud")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","c"),a.value="true",r(p,"type","checkbox"),r(p,"name","ce"),p.__value="true",p.value=p.__value,r(p,"class","rounded mb-1"),r(f,"class","my-1"),r(M,"name","ci"),r(M,"type","text"),r(M,"class","in-s"),r(M,"pattern",P=t[3].c.e?"[A-Z0-9]{16}":".*"),M.required=L=t[3].c.e,r(d,"class","my-1"),r(H,"name","cs"),r(H,"type","text"),r(H,"class","in-s"),r(H,"pattern",z=t[3].c.e&&t[3].c.s!="***"?"[A-Z0-9]{16}":".*"),r(F,"class","my-1"),r(G,"type","checkbox"),r(G,"class","rounded mb-1"),r(G,"name","ces"),G.__value="true",G.value=G.__value,r(K,"class","my-1"),r(e,"class","cnt")},m(V,W){S(V,e,W),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(_,p),p.checked=t[3].c.e,s(_,b),s(e,v),s(e,d),s(d,g),s(d,w),s(d,T),s(d,M),oe(M,t[3].c.i),s(e,I),s(e,F),s(F,C),s(F,R),s(F,ne),s(F,H),oe(H,t[3].c.s),s(e,U),s(e,K),s(K,Q),s(Q,G),G.checked=t[3].c.es,s(Q,X),s(K,Y),ee&&ee.m(K,null),j=!0,x||(ae=[te(p,"change",t[71]),te(M,"input",t[72]),te(H,"input",t[73]),te(G,"change",t[74])],x=!0)},p(V,W){W[0]&8&&(p.checked=V[3].c.e),(!j||W[0]&8&&P!==(P=V[3].c.e?"[A-Z0-9]{16}":".*"))&&r(M,"pattern",P),(!j||W[0]&8&&L!==(L=V[3].c.e))&&(M.required=L),W[0]&8&&M.value!==V[3].c.i&&oe(M,V[3].c.i),(!j||W[0]&8&&z!==(z=V[3].c.e&&V[3].c.s!="***"?"[A-Z0-9]{16}":".*"))&&r(H,"pattern",z),W[0]&8&&H.value!==V[3].c.s&&oe(H,V[3].c.s),W[0]&8&&(G.checked=V[3].c.es),V[3].c.es?ee?(ee.p(V,W),W[0]&8&&O(ee,1)):(ee=cf(V),ee.c(),O(ee,1),ee.m(K,null)):ee&&(Ae(),q(ee,1,1,()=>{ee=null}),Pe())},i(V){j||(O(o.$$.fragment,V),O(ee),j=!0)},o(V){q(o.$$.fragment,V),q(ee),j=!1},d(V){V&&$(e),se(o),ee&&ee.d(),x=!1,ze(ae)}}}function cf(t){let e,l,n=t[0].mac+"",i,o,u,a,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,_,p,b,v=t[0].mac&&t[0].meter.id&&mf(t);return{c(){e=m("div"),l=E("MAC: "),i=E(n),o=h(),u=m("div"),a=E("Meter ID: "),f=E(c),_=h(),v&&v.c(),p=Ke(),r(e,"class","pl-5"),r(u,"class","pl-5")},m(d,g){S(d,e,g),s(e,l),s(e,i),S(d,o,g),S(d,u,g),s(u,a),s(u,f),S(d,_,g),v&&v.m(d,g),S(d,p,g),b=!0},p(d,g){(!b||g[0]&1)&&n!==(n=d[0].mac+"")&&J(i,n),(!b||g[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&J(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&O(v,1)):(v=mf(d),v.c(),O(v,1),v.m(p.parentNode,p)):v&&(Ae(),q(v,1,1,()=>{v=null}),Pe())},i(d){b||(O(v),b=!0)},o(d){q(v),b=!1},d(d){d&&$(e),d&&$(o),d&&$(u),d&&$(_),v&&v.d(d),d&&$(p)}}}function mf(t){let e,l,n;return l=new __({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),re(l.$$.fragment),r(e,"class","pl-2")},m(i,o){S(i,e,o),ie(l,e,null),n=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(u)},i(i){n||(O(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&$(e),se(l)}}}function _f(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P;o=new Rt({});let L={length:9},I=[];for(let F=0;F<L.length;F+=1)I[F]=pf(Xu(t,L,F));return{c(){e=m("div"),l=m("strong"),l.textContent="Tariff thresholds",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("input"),c=h(),f=m("div");for(let F=0;F<I.length;F+=1)I[F].c();_=h(),p=m("label"),b=m("span"),b.textContent="Average of",v=h(),d=m("input"),g=h(),w=m("span"),w.textContent="hours",r(l,"class","text-sm"),r(i,"href",It("Threshold-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"type","hidden"),r(a,"name","t"),a.value="true",r(f,"class","flex flex-wrap my-1"),r(b,"class","in-pre"),r(d,"name","th"),r(d,"type","number"),r(d,"min","0"),r(d,"max","255"),r(d,"class","in-txt tr w-full"),r(w,"class","in-post"),r(p,"class","flex m-1"),r(e,"class","cnt")},m(F,C){S(F,e,C),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f);for(let R=0;R<I.length;R+=1)I[R]&&I[R].m(f,null);s(e,_),s(e,p),s(p,b),s(p,v),s(p,d),oe(d,t[3].t.h),s(p,g),s(p,w),T=!0,M||(P=te(d,"input",t[76]),M=!0)},p(F,C){if(C[0]&8){L={length:9};let R;for(R=0;R<L.length;R+=1){const ne=Xu(F,L,R);I[R]?I[R].p(ne,C):(I[R]=pf(ne),I[R].c(),I[R].m(f,null))}for(;R<I.length;R+=1)I[R].d(1);I.length=L.length}C[0]&8&&ge(d.value)!==F[3].t.h&&oe(d,F[3].t.h)},i(F){T||(O(o.$$.fragment,F),T=!0)},o(F){q(o.$$.fragment,F),T=!1},d(F){F&&$(e),se(o),dt(I,F),M=!1,P()}}}function pf(t){let e,l,n=t[106]+1+"",i,o,u,a,c,f,_,p;function b(){t[75].call(u,t[106])}return{c(){e=m("label"),l=m("span"),i=E(n),o=h(),u=m("input"),a=h(),c=m("span"),c.textContent="kWh",f=h(),r(l,"class","in-pre"),r(u,"name","t"+t[106]),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-txt w-full"),r(c,"class","in-post"),r(e,"class","flex w-40 m-1")},m(v,d){S(v,e,d),s(e,l),s(l,i),s(e,o),s(e,u),oe(u,t[3].t.t[t[106]]),s(e,a),s(e,c),s(e,f),_||(p=te(u,"input",b),_=!0)},p(v,d){t=v,d[0]&8&&ge(u.value)!==t[3].t.t[t[106]]&&oe(u,t[3].t.t[t[106]])},d(v){v&&$(e),_=!1,p()}}}function df(t){let e,l=t[101].name+"",n,i,o,u,a,c,f,_,p,b;function v(){t[77].call(u,t[101])}return{c(){e=m("div"),n=E(l),i=m("br"),o=h(),u=m("select"),a=m("option"),a.textContent="Disable",c=m("option"),c.textContent="Enable",f=m("option"),f.textContent="Auto",_=h(),a.__value=0,a.value=a.__value,c.__value=1,c.value=c.__value,f.__value=2,f.value=f.__value,r(u,"name","u"+t[101].key),r(u,"class","in-s"),t[3].u[t[101].key]===void 0&&We(v),r(e,"class","w-1/2")},m(d,g){S(d,e,g),s(e,n),s(e,i),s(e,o),s(e,u),s(u,a),s(u,c),s(u,f),$e(u,t[3].u[t[101].key],!0),s(e,_),p||(b=te(u,"change",v),p=!0)},p(d,g){t=d,g[0]&136&&$e(u,t[3].u[t[101].key])},d(d){d&&$(e),p=!1,b()}}}function vf(t){let e,l,n,i,o,u,a,c,f;o=new Rt({});let _=t[0].board>20&&hf(t),p=t[3].i.d.d>0&&kf(t),b=t[0].chip=="esp8266"&&wf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),re(o.$$.fragment),u=h(),_&&_.c(),a=h(),p&&p.c(),c=h(),b&&b.c(),r(l,"class","text-sm"),r(i,"href",It("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(v,d){S(v,e,d),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),_&&_.m(e,null),s(e,a),p&&p.m(e,null),s(e,c),b&&b.m(e,null),f=!0},p(v,d){v[0].board>20?_?(_.p(v,d),d[0]&1&&O(_,1)):(_=hf(v),_.c(),O(_,1),_.m(e,a)):_&&(Ae(),q(_,1,1,()=>{_=null}),Pe()),v[3].i.d.d>0?p?p.p(v,d):(p=kf(v),p.c(),p.m(e,c)):p&&(p.d(1),p=null),v[0].chip=="esp8266"?b?b.p(v,d):(b=wf(v),b.c(),b.m(e,null)):b&&(b.d(1),b=null)},i(v){f||(O(o.$$.fragment,v),O(_),f=!0)},o(v){q(o.$$.fragment,v),q(_),f=!1},d(v){v&&$(e),se(o),_&&_.d(),p&&p.d(),b&&b.d()}}}function hf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee,V,W,we,He,Le,Se,ye,ve,Te,be,N,y,k,A,D,Z,le,fe,de,Ce,Oe,ue,Me,Je,Lt,st,wt,nt,Ot,Qe,Xt,zt,vt,xe,Ge,Ye,Ne,Ze,et;f=new io({props:{chip:t[0].chip}}),w=new io({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&bf(t),Fe=t[3].i.v.p>0&&gf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=E("HAN RX"),u=m("br"),a=h(),c=m("select"),re(f.$$.fragment),_=h(),p=m("div"),b=E("HAN TX"),v=m("br"),d=h(),g=m("select"),re(w.$$.fragment),T=h(),M=m("div"),P=m("label"),L=m("input"),I=E(" pullup"),F=h(),C=m("div"),R=m("div"),ne=E("AP button"),H=m("br"),z=h(),U=m("input"),K=h(),Q=m("div"),G=E("LED"),X=m("br"),Y=h(),j=m("div"),x=m("input"),ae=h(),ee=m("div"),V=m("label"),W=m("input"),we=E(" inverted"),He=h(),Le=m("div"),Se=E("RGB"),ye=m("label"),ve=m("input"),Te=E(" inverted"),be=m("br"),N=h(),y=m("div"),k=m("input"),A=h(),D=m("input"),Z=h(),le=m("input"),fe=h(),de=m("div"),Ce=m("div"),Oe=E(`LED dis. GPIO
`),ue=m("input"),Me=h(),Je=m("div"),Lt=E("Temperature"),st=m("br"),wt=h(),nt=m("input"),Ot=h(),Qe=m("div"),Xt=E("Analog temp"),zt=m("br"),vt=h(),xe=m("input"),Ge=h(),qe&&qe.c(),Ye=h(),Fe&&Fe.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(c,"name","ihp"),r(c,"class","in-f w-full"),t[3].i.h.p===void 0&&We(()=>t[78].call(c)),r(i,"class","w-1/3"),r(g,"name","iht"),r(g,"class","in-l w-full"),t[3].i.h.t===void 0&&We(()=>t[79].call(g)),r(p,"class","w-1/3"),r(L,"name","ihu"),L.__value="true",L.value=L.__value,r(L,"type","checkbox"),r(L,"class","rounded mb-1"),r(P,"class","ml-2"),r(M,"class","w-1/3"),r(n,"class","flex flex-wrap"),r(U,"name","ia"),r(U,"type","number"),r(U,"min","0"),r(U,"max",t[6]),r(U,"class","in-f tr w-full"),r(R,"class","w-1/3"),r(x,"name","ilp"),r(x,"type","number"),r(x,"min","0"),r(x,"max",t[6]),r(x,"class","in-l tr w-full"),r(j,"class","flex"),r(Q,"class","w-1/3"),r(W,"name","ili"),W.__value="true",W.value=W.__value,r(W,"type","checkbox"),r(W,"class","rounded mb-1"),r(V,"class","ml-4"),r(ee,"class","w-1/3"),r(ve,"name","iri"),ve.__value="true",ve.value=ve.__value,r(ve,"type","checkbox"),r(ve,"class","rounded mb-1"),r(ye,"class","ml-4"),r(k,"name","irr"),r(k,"type","number"),r(k,"min","0"),r(k,"max",t[6]),r(k,"class","in-f tr w-1/3"),r(D,"name","irg"),r(D,"type","number"),r(D,"min","0"),r(D,"max",t[6]),r(D,"class","in-m tr w-1/3"),r(le,"name","irb"),r(le,"type","number"),r(le,"min","0"),r(le,"max",t[6]),r(le,"class","in-l tr w-1/3"),r(y,"class","flex"),r(Le,"class","w-full"),r(ue,"name","idd"),r(ue,"type","number"),r(ue,"min","0"),r(ue,"max",t[6]),r(ue,"class","in-s tr"),r(Ce,"class","my-1 pr-1 w-1/3"),r(de,"class","w-full"),r(nt,"name","itd"),r(nt,"type","number"),r(nt,"min","0"),r(nt,"max",t[6]),r(nt,"class","in-f tr w-full"),r(Je,"class","my-1 w-1/3"),r(xe,"name","ita"),r(xe,"type","number"),r(xe,"min","0"),r(xe,"max",t[6]),r(xe,"class","in-l tr w-full"),r(Qe,"class","my-1 pr-1 w-1/3"),r(C,"class","flex flex-wrap")},m(_e,ce){S(_e,e,ce),S(_e,l,ce),S(_e,n,ce),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),ie(f,c,null),$e(c,t[3].i.h.p,!0),s(n,_),s(n,p),s(p,b),s(p,v),s(p,d),s(p,g),ie(w,g,null),$e(g,t[3].i.h.t,!0),s(n,T),s(n,M),s(M,P),s(P,L),L.checked=t[3].i.h.u,s(P,I),S(_e,F,ce),S(_e,C,ce),s(C,R),s(R,ne),s(R,H),s(R,z),s(R,U),oe(U,t[3].i.a),s(C,K),s(C,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),oe(x,t[3].i.l.p),s(C,ae),s(C,ee),s(ee,V),s(V,W),W.checked=t[3].i.l.i,s(V,we),s(C,He),s(C,Le),s(Le,Se),s(Le,ye),s(ye,ve),ve.checked=t[3].i.r.i,s(ye,Te),s(Le,be),s(Le,N),s(Le,y),s(y,k),oe(k,t[3].i.r.r),s(y,A),s(y,D),oe(D,t[3].i.r.g),s(y,Z),s(y,le),oe(le,t[3].i.r.b),s(C,fe),s(C,de),s(de,Ce),s(Ce,Oe),s(Ce,ue),oe(ue,t[3].i.d.d),s(C,Me),s(C,Je),s(Je,Lt),s(Je,st),s(Je,wt),s(Je,nt),oe(nt,t[3].i.t.d),s(C,Ot),s(C,Qe),s(Qe,Xt),s(Qe,zt),s(Qe,vt),s(Qe,xe),oe(xe,t[3].i.t.a),s(C,Ge),qe&&qe.m(C,null),s(C,Ye),Fe&&Fe.m(C,null),Ne=!0,Ze||(et=[te(c,"change",t[78]),te(g,"change",t[79]),te(L,"change",t[80]),te(U,"input",t[81]),te(x,"input",t[82]),te(W,"change",t[83]),te(ve,"change",t[84]),te(k,"input",t[85]),te(D,"input",t[86]),te(le,"input",t[87]),te(ue,"input",t[88]),te(nt,"input",t[89]),te(xe,"input",t[90])],Ze=!0)},p(_e,ce){const Be={};ce[0]&1&&(Be.chip=_e[0].chip),f.$set(Be),ce[0]&8&&$e(c,_e[3].i.h.p);const pt={};ce[0]&1&&(pt.chip=_e[0].chip),w.$set(pt),ce[0]&8&&$e(g,_e[3].i.h.t),ce[0]&8&&(L.checked=_e[3].i.h.u),(!Ne||ce[0]&64)&&r(U,"max",_e[6]),ce[0]&8&&ge(U.value)!==_e[3].i.a&&oe(U,_e[3].i.a),(!Ne||ce[0]&64)&&r(x,"max",_e[6]),ce[0]&8&&ge(x.value)!==_e[3].i.l.p&&oe(x,_e[3].i.l.p),ce[0]&8&&(W.checked=_e[3].i.l.i),ce[0]&8&&(ve.checked=_e[3].i.r.i),(!Ne||ce[0]&64)&&r(k,"max",_e[6]),ce[0]&8&&ge(k.value)!==_e[3].i.r.r&&oe(k,_e[3].i.r.r),(!Ne||ce[0]&64)&&r(D,"max",_e[6]),ce[0]&8&&ge(D.value)!==_e[3].i.r.g&&oe(D,_e[3].i.r.g),(!Ne||ce[0]&64)&&r(le,"max",_e[6]),ce[0]&8&&ge(le.value)!==_e[3].i.r.b&&oe(le,_e[3].i.r.b),(!Ne||ce[0]&64)&&r(ue,"max",_e[6]),ce[0]&8&&ge(ue.value)!==_e[3].i.d.d&&oe(ue,_e[3].i.d.d),(!Ne||ce[0]&64)&&r(nt,"max",_e[6]),ce[0]&8&&ge(nt.value)!==_e[3].i.t.d&&oe(nt,_e[3].i.t.d),(!Ne||ce[0]&64)&&r(xe,"max",_e[6]),ce[0]&8&&ge(xe.value)!==_e[3].i.t.a&&oe(xe,_e[3].i.t.a),_e[0].chip!="esp8266"?qe?qe.p(_e,ce):(qe=bf(_e),qe.c(),qe.m(C,Ye)):qe&&(qe.d(1),qe=null),_e[3].i.v.p>0?Fe?Fe.p(_e,ce):(Fe=gf(_e),Fe.c(),Fe.m(C,null)):Fe&&(Fe.d(1),Fe=null)},i(_e){Ne||(O(f.$$.fragment,_e),O(w.$$.fragment,_e),Ne=!0)},o(_e){q(f.$$.fragment,_e),q(w.$$.fragment,_e),Ne=!1},d(_e){_e&&$(e),_e&&$(l),_e&&$(n),se(f),se(w),_e&&$(F),_e&&$(C),qe&&qe.d(),Fe&&Fe.d(),Ze=!1,ze(et)}}}function bf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=E("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.p),u||(a=te(o,"input",t[91]),u=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&ge(o.value)!==c[3].i.v.p&&oe(o,c[3].i.v.p)},d(c){c&&$(e),u=!1,a()}}}function gf(t){let e,l,n,i,o,u,a,c,f,_;return{c(){e=m("div"),l=E("Voltage divider"),n=m("br"),i=h(),o=m("div"),u=m("input"),a=h(),c=m("input"),r(u,"name","ivdv"),r(u,"type","number"),r(u,"min","0"),r(u,"max","65535"),r(u,"class","in-f tr w-full"),r(u,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(p,b){S(p,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,u),oe(u,t[3].i.v.d.v),s(o,a),s(o,c),oe(c,t[3].i.v.d.g),f||(_=[te(u,"input",t[92]),te(c,"input",t[93])],f=!0)},p(p,b){b[0]&8&&ge(u.value)!==p[3].i.v.d.v&&oe(u,p[3].i.v.d.v),b[0]&8&&ge(c.value)!==p[3].i.v.d.g&&oe(c,p[3].i.v.d.g)},d(p){p&&$(e),f=!1,ze(_)}}}function kf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=E(`LED behaviour
`),n=m("select"),i=m("option"),i.textContent="Enabled",o=m("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,r(n,"name","idb"),r(n,"class","in-s"),t[3].i.d.b===void 0&&We(()=>t[94].call(n)),r(e,"class","my-1 w-full")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(n,i),s(n,o),$e(n,t[3].i.d.b,!0),u||(a=te(n,"change",t[94]),u=!0)},p(c,f){f[0]&8&&$e(n,c[3].i.d.b)},d(c){c&&$(e),u=!1,a()}}}function wf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M=(t[0].board==2||t[0].board==100)&&yf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=E("Vcc offset"),u=m("br"),a=h(),c=m("input"),f=h(),_=m("div"),p=E("Multiplier"),b=m("br"),v=h(),d=m("input"),g=h(),M&&M.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(_,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(P,L){S(P,e,L),S(P,l,L),S(P,n,L),s(n,i),s(i,o),s(i,u),s(i,a),s(i,c),oe(c,t[3].i.v.o),s(n,f),s(n,_),s(_,p),s(_,b),s(_,v),s(_,d),oe(d,t[3].i.v.m),s(n,g),M&&M.m(n,null),w||(T=[te(c,"input",t[95]),te(d,"input",t[96])],w=!0)},p(P,L){L[0]&8&&ge(c.value)!==P[3].i.v.o&&oe(c,P[3].i.v.o),L[0]&8&&ge(d.value)!==P[3].i.v.m&&oe(d,P[3].i.v.m),P[0].board==2||P[0].board==100?M?M.p(P,L):(M=yf(P),M.c(),M.m(n,null)):M&&(M.d(1),M=null)},d(P){P&&$(e),P&&$(l),P&&$(n),M&&M.d(),w=!1,ze(T)}}}function yf(t){let e,l,n,i,o,u,a;return{c(){e=m("div"),l=E("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),oe(o,t[3].i.v.b),u||(a=te(o,"input",t[97]),u=!0)},p(c,f){f[0]&8&&ge(o.value)!==c[3].i.v.b&&oe(o,c[3].i.v.b)},d(c){c&&$(e),u=!1,a()}}}function Cf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T=t[3].d.t&&$f();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"),u=E(" Enable telnet"),a=h(),T&&T.c(),c=h(),f=m("div"),_=m("select"),p=m("option"),p.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),p.__value=1,p.value=p.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(_,"name","dl"),r(_,"class","in-s"),t[3].d.l===void 0&&We(()=>t[100].call(_)),r(f,"class","my-1")},m(M,P){S(M,e,P),S(M,l,P),S(M,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,u),S(M,a,P),T&&T.m(M,P),S(M,c,P),S(M,f,P),s(f,_),s(_,p),s(_,b),s(_,v),s(_,d),$e(_,t[3].d.l,!0),g||(w=[te(o,"change",t[99]),te(_,"change",t[100])],g=!0)},p(M,P){P[0]&8&&(o.checked=M[3].d.t),M[3].d.t?T||(T=$f(),T.c(),T.m(c.parentNode,c)):T&&(T.d(1),T=null),P[0]&8&&$e(_,M[3].d.l)},d(M){M&&$(e),M&&$(l),M&&$(n),M&&$(a),T&&T.d(M),M&&$(c),M&&$(f),g=!1,ze(w)}}}function $f(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function P_(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee,V,W,we,He,Le,Se,ye,ve,Te,be,N,y,k,A,D,Z,le,fe,de,Ce,Oe,ue,Me,Je,Lt,st,wt,nt,Ot,Qe,Xt,zt,vt,xe,Ge,Ye,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Tl,Nl,El,Mi,Ti,je,_n,Ni,Al,Pl,Ei,Hl,Ai,Wl,Pi,hl,Di,Ri,Ii,Gt,Dl,Ve,yt,ht,si,Li,bl,Oi,zl,Zt,$o,So,Rl,rl,Il,Mo,Fi,To,bt,Ll,No,qi,pn,dn,vn,hn,Bi,Eo,Ft,Ui,Ao,Gl,Po,Do,Ro,al,bn,gn,Io,kn,Vl,Lo,Oo,Fo,wn,Jt,qo,ji,Bo,Kl,Uo,jo,Ho,yn,xt,Wo,Hi,zo,ks,Go,Yl,Wi,el,Vo,Ko,Yo,ws,zi,tl,Qo,Xo,Zo,qt,Gi,Jo,Cn,$n,xo,oi,er,Ql,tr,lr,nr,Vt,Sn,Mn,ir,sr,mt,Vi,or,Tn,Nn,rr,Xl,ar,ur,fr,Ol,ul,En,An,cr,Bt,Ki,Yi,mr,Ut,Pn,Qi,Xi,_r,ys,Zi,Ji,ll,pr,dr,ri,vr,Fl,hr,ai,nl,br,gr,kr,xi,gl,wr,lt,es,yr,Dn,Rn,Cr,ui,$r,fl,Sr,Cs,Mr,Tr,In,kl,Nr,il,Er,$s,Zl,Ar,Pr,Dr,wl,Rr,Jl,Ir,Lr,Or,yl,Fr,Ln,On,qr,Br,Ur,Cl,jr,Fn,Hr,Wr,zr,Ct,qn,Bn,Un,jn,Hn,Wn,Gr,xl,Vr,Kr,Yr,$l,Qr,Ss,Ms,Ts,Ns=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Es,cl,ts,Xr,zn,Gn,Zr,fi,Jr,ci,xr,As,jt,ls,ea,Vn,Kn,ta,mi,la,ns,is,sl,na,ia,sa,ql,Ps,Yn,oa,ss,Qn,ra,os,Ds,en,Rs,tn,Is,ln,Ls,nn,Kt,Os,aa;a=new Rt({}),R=new o_({});let n1=["NOK","SEK","DKK","EUR","CHF"],_i=[];for(let B=0;B<5;B+=1)_i[B]=v_(d_(t,n1,B));vt=new Qt({props:{to:"/priceconfig",$$slots:{default:[h_]},$$scope:{ctx:t}}});let $t=t[3].p.e&&t[0].chip!="esp8266"&&Zu(t),St=t[3].g.s>0&&Ju(t);Pl=new Rt({});let i1=[24,48,96,192,384,576,1152],pi=[];for(let B=0;B<7;B+=1)pi[B]=b_(p_(t,i1,B));let Mt=t[3].m.e.e&&xu(t),Tt=t[3].m.e.e&&ef(t),Nt=t[3].m.m.e&&tf(t);$n=new Rt({});let Ht=t[0].if&&t[0].if.eth&&lf(),Et=(t[3].n.c==1||t[3].n.c==2)&&nf(t);Nn=new Rt({}),Pn=new t1({});let At=t[3].n.m=="static"&&sf(t);Rn=new Rt({});let Pt=t[0].chip!="esp8266"&&of(t),ot=t[3].q.s.e&&rf(t),rt=t[3].q.m==3&&af(t),at=t[3].q.m==4&&uf(t),ut=t[3].c.es!=null&&ff(t),ft=Ns&&_f(t);Gn=new Rt({});let Xn=t[7],gt=[];for(let B=0;B<Xn.length;B+=1)gt[B]=df(Qu(t,Xn,B));let ct=(t[0].board>20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&vf(t);Kn=new Rt({});let Dt=t[3].d.s&&Cf(t);return en=new kt({props:{active:t[1],message:"Loading configuration"}}),tn=new kt({props:{active:t[2],message:"Saving configuration"}}),ln=new kt({props:{active:t[4],message:"Performing factory reset"}}),nn=new kt({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(),u=m("a"),re(a.$$.fragment),c=h(),f=m("input"),_=h(),p=m("div"),b=m("div"),v=m("div"),d=E("Hostname"),g=m("br"),w=h(),T=m("input"),M=h(),P=m("div"),L=E("Time zone"),I=m("br"),F=h(),C=m("select"),re(R.$$.fragment),ne=h(),H=m("input"),z=h(),U=m("div"),K=m("div"),Q=m("div"),G=E("Price region"),X=m("br"),Y=h(),j=m("select"),x=m("optgroup"),ae=m("option"),ae.textContent="NO1",ee=m("option"),ee.textContent="NO2",V=m("option"),V.textContent="NO3",W=m("option"),W.textContent="NO4",we=m("option"),we.textContent="NO5",He=m("optgroup"),Le=m("option"),Le.textContent="SE1",Se=m("option"),Se.textContent="SE2",ye=m("option"),ye.textContent="SE3",ve=m("option"),ve.textContent="SE4",Te=m("optgroup"),be=m("option"),be.textContent="DK1",N=m("option"),N.textContent="DK2",y=m("option"),y.textContent="Austria",k=m("option"),k.textContent="Belgium",A=m("option"),A.textContent="Czech Republic",D=m("option"),D.textContent="Estonia",Z=m("option"),Z.textContent="Finland",le=m("option"),le.textContent="France",fe=m("option"),fe.textContent="Germany",de=m("option"),de.textContent="Great Britain",Ce=m("option"),Ce.textContent="Latvia",Oe=m("option"),Oe.textContent="Lithuania",ue=m("option"),ue.textContent="Netherland",Me=m("option"),Me.textContent="Poland",Je=m("option"),Je.textContent="Switzerland",Lt=h(),st=m("div"),wt=E("Currency"),nt=m("br"),Ot=h(),Qe=m("select");for(let B=0;B<5;B+=1)_i[B].c();Xt=h(),zt=m("div"),re(vt.$$.fragment),xe=h(),Ge=m("div"),Ye=m("label"),Ne=m("input"),Ze=E(" Enable price fetch from remote server"),et=h(),$t&&$t.c(),qe=h(),Fe=m("div"),_e=E("Security"),ce=m("br"),Be=h(),pt=m("select"),Tl=m("option"),Tl.textContent="None",Nl=m("option"),Nl.textContent="Only configuration",El=m("option"),El.textContent="Everything",Mi=h(),St&&St.c(),Ti=h(),je=m("div"),_n=m("strong"),_n.textContent="Meter",Ni=h(),Al=m("a"),re(Pl.$$.fragment),Ei=h(),Hl=m("input"),Ai=h(),Wl=m("input"),Pi=h(),hl=m("div"),Di=E("Communication"),Ri=m("br"),Ii=h(),Gt=m("select"),Dl=m("option"),Dl.textContent="Passive (Push)",Ve=m("option"),Ve.textContent="Kamstrup (Pull)",yt=h(),ht=m("div"),si=m("span"),si.textContent="Buffer size",Li=h(),bl=m("span"),bl.textContent="Serial conf.",Oi=h(),zl=m("label"),Zt=m("input"),$o=E(" inverted"),So=h(),Rl=m("div"),rl=m("select"),Il=m("option"),Mo=E("Autodetect");for(let B=0;B<7;B+=1)pi[B].c();To=h(),bt=m("select"),Ll=m("option"),No=E("-"),pn=m("option"),pn.textContent="7N1",dn=m("option"),dn.textContent="8N1",vn=m("option"),vn.textContent="7E1",hn=m("option"),hn.textContent="8E1",Eo=h(),Ft=m("input"),Ao=h(),Gl=m("div"),Po=E("Voltage"),Do=m("br"),Ro=h(),al=m("select"),bn=m("option"),bn.textContent="400V (TN)",gn=m("option"),gn.textContent="230V (IT/TT)",Io=h(),kn=m("div"),Vl=m("div"),Lo=E("Main fuse"),Oo=m("br"),Fo=h(),wn=m("label"),Jt=m("input"),qo=h(),ji=m("span"),ji.textContent="A",Bo=h(),Kl=m("div"),Uo=E("Production"),jo=m("br"),Ho=h(),yn=m("label"),xt=m("input"),Wo=h(),Hi=m("span"),Hi.textContent="kWp",zo=h(),ks=m("div"),Go=h(),Yl=m("div"),Wi=m("label"),el=m("input"),Vo=E(" Meter is encrypted"),Ko=h(),Mt&&Mt.c(),Yo=h(),Tt&&Tt.c(),ws=h(),zi=m("label"),tl=m("input"),Qo=E(" Multipliers"),Xo=h(),Nt&&Nt.c(),Zo=h(),qt=m("div"),Gi=m("strong"),Gi.textContent="Connection",Jo=h(),Cn=m("a"),re($n.$$.fragment),xo=h(),oi=m("input"),er=h(),Ql=m("div"),tr=E("Connection"),lr=m("br"),nr=h(),Vt=m("select"),Sn=m("option"),Sn.textContent="WiFi",Mn=m("option"),Mn.textContent="Access point",Ht&&Ht.c(),ir=h(),Et&&Et.c(),sr=h(),mt=m("div"),Vi=m("strong"),Vi.textContent="Network",or=h(),Tn=m("a"),re(Nn.$$.fragment),rr=h(),Xl=m("div"),ar=E("IP"),ur=m("br"),fr=h(),Ol=m("div"),ul=m("select"),En=m("option"),En.textContent="DHCP",An=m("option"),An.textContent="Static",cr=h(),Bt=m("input"),mr=h(),Ut=m("select"),re(Pn.$$.fragment),_r=h(),At&&At.c(),ys=h(),Zi=m("div"),Ji=m("label"),ll=m("input"),pr=E(" enable mDNS"),dr=h(),ri=m("input"),vr=h(),Fl=m("div"),hr=E("NTP "),ai=m("label"),nl=m("input"),br=E(" obtain from DHCP"),gr=m("br"),kr=h(),xi=m("div"),gl=m("input"),wr=h(),lt=m("div"),es=m("strong"),es.textContent="MQTT",yr=h(),Dn=m("a"),re(Rn.$$.fragment),Cr=h(),ui=m("input"),$r=h(),fl=m("div"),Sr=E(`Server
`),Pt&&Pt.c(),Cs=h(),Mr=m("br"),Tr=h(),In=m("div"),kl=m("input"),Nr=h(),il=m("input"),Er=h(),ot&&ot.c(),$s=h(),Zl=m("div"),Ar=E("Username"),Pr=m("br"),Dr=h(),wl=m("input"),Rr=h(),Jl=m("div"),Ir=E("Password"),Lr=m("br"),Or=h(),yl=m("input"),Fr=h(),Ln=m("div"),On=m("div"),qr=E("Client ID"),Br=m("br"),Ur=h(),Cl=m("input"),jr=h(),Fn=m("div"),Hr=E("Payload"),Wr=m("br"),zr=h(),Ct=m("select"),qn=m("option"),qn.textContent="JSON",Bn=m("option"),Bn.textContent="Raw (minimal)",Un=m("option"),Un.textContent="Raw (full)",jn=m("option"),jn.textContent="Domoticz",Hn=m("option"),Hn.textContent="HomeAssistant",Wn=m("option"),Wn.textContent="HEX dump",Gr=h(),xl=m("div"),Vr=E("Publish topic"),Kr=m("br"),Yr=h(),$l=m("input"),Qr=h(),rt&&rt.c(),Ss=h(),at&&at.c(),Ms=h(),ut&&ut.c(),Ts=h(),ft&&ft.c(),Es=h(),cl=m("div"),ts=m("strong"),ts.textContent="User interface",Xr=h(),zn=m("a"),re(Gn.$$.fragment),Zr=h(),fi=m("input"),Jr=h(),ci=m("div");for(let B=0;B<gt.length;B+=1)gt[B].c();xr=h(),ct&&ct.c(),As=h(),jt=m("div"),ls=m("strong"),ls.textContent="Debugging",ea=h(),Vn=m("a"),re(Kn.$$.fragment),ta=h(),mi=m("input"),la=h(),ns=m("div"),is=m("label"),sl=m("input"),na=E(" Enable debugging"),ia=h(),Dt&&Dt.c(),sa=h(),ql=m("div"),Ps=m("div"),Yn=m("button"),Yn.textContent="Factory reset",oa=h(),ss=m("div"),Qn=m("button"),Qn.textContent="Reboot",ra=h(),os=m("div"),os.innerHTML='<button type="submit" class="btn-pri">Save</button>',Ds=h(),re(en.$$.fragment),Rs=h(),re(tn.$$.fragment),Is=h(),re(ln.$$.fragment),Ls=h(),re(nn.$$.fragment),r(i,"class","text-sm"),r(u,"href",It("General-configuration")),r(u,"target","_blank"),r(u,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(T,"name","gh"),r(T,"type","text"),r(T,"class","in-f w-full"),r(T,"pattern","[A-Za-z0-9-]+"),r(C,"name","gt"),r(C,"class","in-l w-full"),t[3].g.t===void 0&&We(()=>t[16].call(C)),r(b,"class","flex"),r(p,"class","my-1"),r(H,"type","hidden"),r(H,"name","p"),H.value="true",ae.__value="10YNO-1--------2",ae.value=ae.__value,ee.__value="10YNO-2--------T",ee.value=ee.__value,V.__value="10YNO-3--------J",V.value=V.__value,W.__value="10YNO-4--------9",W.value=W.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,r(x,"label","Norway"),Le.__value="10Y1001A1001A44P",Le.value=Le.__value,Se.__value="10Y1001A1001A45N",Se.value=Se.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,ve.__value="10Y1001A1001A47J",ve.value=ve.__value,r(He,"label","Sweden"),be.__value="10YDK-1--------W",be.value=be.__value,N.__value="10YDK-2--------M",N.value=N.__value,r(Te,"label","Denmark"),y.__value="10YAT-APG------L",y.value=y.__value,k.__value="10YBE----------2",k.value=k.__value,A.__value="10YCZ-CEPS-----N",A.value=A.__value,D.__value="10Y1001A1001A39I",D.value=D.__value,Z.__value="10YFI-1--------U",Z.value=Z.__value,le.__value="10YFR-RTE------C",le.value=le.__value,fe.__value="10Y1001A1001A83F",fe.value=fe.__value,de.__value="10YGB----------A",de.value=de.__value,Ce.__value="10YLV-1001A00074",Ce.value=Ce.__value,Oe.__value="10YLT-1001A0008Q",Oe.value=Oe.__value,ue.__value="10YNL----------L",ue.value=ue.__value,Me.__value="10YPL-AREA-----S",Me.value=Me.__value,Je.__value="10YCH-SWISSGRIDZ",Je.value=Je.__value,r(j,"name","pr"),r(j,"class","in-f w-full"),t[3].p.r===void 0&&We(()=>t[17].call(j)),r(Q,"class","w-full"),r(Qe,"name","pc"),r(Qe,"class","in-l"),t[3].p.c===void 0&&We(()=>t[18].call(Qe)),r(K,"class","flex"),r(U,"class","my-1"),r(zt,"class","my-1"),r(Ne,"type","checkbox"),r(Ne,"name","pe"),Ne.__value="true",Ne.value=Ne.__value,r(Ne,"class","rounded mb-1"),r(Ge,"class","my-1"),Tl.__value=0,Tl.value=Tl.__value,Nl.__value=1,Nl.value=Nl.__value,El.__value=2,El.value=El.__value,r(pt,"name","gs"),r(pt,"class","in-s"),t[3].g.s===void 0&&We(()=>t[21].call(pt)),r(Fe,"class","my-1"),r(n,"class","cnt"),r(_n,"class","text-sm"),r(Al,"href",It("Meter-configuration")),r(Al,"target","_blank"),r(Al,"class","float-right"),r(Hl,"type","hidden"),r(Hl,"name","m"),Hl.value="true",r(Wl,"type","hidden"),r(Wl,"name","mo"),Wl.value="1",Dl.__value=0,Dl.value=Dl.__value,Ve.__value=9,Ve.value=Ve.__value,r(Gt,"name","ma"),r(Gt,"class","in-s"),t[3].m.a===void 0&&We(()=>t[24].call(Gt)),r(hl,"class","my-1"),r(si,"class","float-right"),r(Zt,"name","mi"),Zt.__value="true",Zt.value=Zt.__value,r(Zt,"type","checkbox"),r(Zt,"class","rounded mb-1"),r(zl,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Fi=t[3].m.b!=0,r(rl,"name","mb"),r(rl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&We(()=>t[26].call(rl)),Ll.__value=0,Ll.value=Ll.__value,Ll.disabled=qi=t[3].m.b!=0,pn.__value=2,pn.value=pn.__value,dn.__value=3,dn.value=dn.__value,vn.__value=10,vn.value=vn.__value,hn.__value=11,hn.value=hn.__value,r(bt,"name","mp"),r(bt,"class","in-m"),bt.disabled=Bi=t[3].m.b==0,t[3].m.p===void 0&&We(()=>t[27].call(bt)),r(Ft,"name","ms"),r(Ft,"type","number"),r(Ft,"min",64),r(Ft,"max",Ui=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),r(Ft,"step",64),r(Ft,"class","in-l tr w-1/2"),r(Rl,"class","flex w-full"),r(ht,"class","my-1"),bn.__value=2,bn.value=bn.__value,gn.__value=1,gn.value=gn.__value,r(al,"name","md"),r(al,"class","in-s"),t[3].m.d===void 0&&We(()=>t[29].call(al)),r(Gl,"class","my-1"),r(Jt,"name","mf"),r(Jt,"type","number"),r(Jt,"min","5"),r(Jt,"max","65535"),r(Jt,"class","in-f tr w-full"),r(ji,"class","in-post"),r(wn,"class","flex"),r(Vl,"class","mx-1"),r(xt,"name","mr"),r(xt,"type","number"),r(xt,"min","0"),r(xt,"max","65535"),r(xt,"class","in-f tr w-full"),r(Hi,"class","in-post"),r(yn,"class","flex"),r(Kl,"class","mx-1"),r(kn,"class","my-1 flex"),r(ks,"class","my-1"),r(el,"type","checkbox"),r(el,"name","me"),el.__value="true",el.value=el.__value,r(el,"class","rounded mb-1"),r(Yl,"class","my-1"),r(tl,"type","checkbox"),r(tl,"name","mm"),tl.__value="true",tl.value=tl.__value,r(tl,"class","rounded mb-1"),r(je,"class","cnt"),r(Gi,"class","text-sm"),r(Cn,"href",It("WiFi-configuration")),r(Cn,"target","_blank"),r(Cn,"class","float-right"),r(oi,"type","hidden"),r(oi,"name","w"),oi.value="true",Sn.__value=1,Sn.value=Sn.__value,Mn.__value=2,Mn.value=Mn.__value,r(Vt,"name","nc"),r(Vt,"class","in-s"),t[3].n.c===void 0&&We(()=>t[40].call(Vt)),r(Ql,"class","my-1"),r(qt,"class","cnt"),r(Vi,"class","text-sm"),r(Tn,"href",It("Network-configuration")),r(Tn,"target","_blank"),r(Tn,"class","float-right"),En.__value="dhcp",En.value=En.__value,An.__value="static",An.value=An.__value,r(ul,"name","nm"),r(ul,"class","in-f"),t[3].n.m===void 0&&We(()=>t[46].call(ul)),r(Bt,"name","ni"),r(Bt,"type","text"),r(Bt,"class","in-m w-full"),Bt.disabled=Ki=t[3].n.m=="dhcp",Bt.required=Yi=t[3].n.m=="static",r(Ut,"name","ns"),r(Ut,"class","in-l"),Ut.disabled=Qi=t[3].n.m=="dhcp",Ut.required=Xi=t[3].n.m=="static",t[3].n.s===void 0&&We(()=>t[48].call(Ut)),r(Ol,"class","flex"),r(Xl,"class","my-1"),r(ll,"name","nd"),ll.__value="true",ll.value=ll.__value,r(ll,"type","checkbox"),r(ll,"class","rounded mb-1"),r(Zi,"class","my-1"),r(ri,"type","hidden"),r(ri,"name","ntp"),ri.value="true",r(nl,"name","ntpd"),nl.__value="true",nl.value=nl.__value,r(nl,"type","checkbox"),r(nl,"class","rounded mb-1"),r(ai,"class","ml-4"),r(gl,"name","ntph"),r(gl,"type","text"),r(gl,"class","in-s"),r(xi,"class","flex"),r(Fl,"class","my-1"),r(mt,"class","cnt"),r(es,"class","text-sm"),r(Dn,"href",It("MQTT-configuration")),r(Dn,"target","_blank"),r(Dn,"class","float-right"),r(ui,"type","hidden"),r(ui,"name","q"),ui.value="true",r(kl,"name","qh"),r(kl,"type","text"),r(kl,"class","in-f w-3/4"),r(il,"name","qp"),r(il,"type","number"),r(il,"min","1024"),r(il,"max","65535"),r(il,"class","in-l tr w-1/4"),r(In,"class","flex"),r(fl,"class","my-1"),r(wl,"name","qu"),r(wl,"type","text"),r(wl,"class","in-s"),r(Zl,"class","my-1"),r(yl,"name","qa"),r(yl,"type","password"),r(yl,"class","in-s"),r(Jl,"class","my-1"),r(Cl,"name","qc"),r(Cl,"type","text"),r(Cl,"class","in-f w-full"),qn.__value=0,qn.value=qn.__value,Bn.__value=1,Bn.value=Bn.__value,Un.__value=2,Un.value=Un.__value,jn.__value=3,jn.value=jn.__value,Hn.__value=4,Hn.value=Hn.__value,Wn.__value=255,Wn.value=Wn.__value,r(Ct,"name","qm"),r(Ct,"class","in-l"),t[3].q.m===void 0&&We(()=>t[61].call(Ct)),r(Ln,"class","my-1 flex"),r($l,"name","qb"),r($l,"type","text"),r($l,"class","in-s"),r(xl,"class","my-1"),r(lt,"class","cnt"),r(ts,"class","text-sm"),r(zn,"href",It("User-interface")),r(zn,"target","_blank"),r(zn,"class","float-right"),r(fi,"type","hidden"),r(fi,"name","u"),fi.value="true",r(ci,"class","flex flex-wrap"),r(cl,"class","cnt"),r(ls,"class","text-sm"),r(Vn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(Vn,"target","_blank"),r(Vn,"class","float-right"),r(mi,"type","hidden"),r(mi,"name","d"),mi.value="true",r(sl,"type","checkbox"),r(sl,"name","ds"),sl.__value="true",sl.value=sl.__value,r(sl,"class","rounded mb-1"),r(ns,"class","mt-3"),r(jt,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(Yn,"type","button"),r(Yn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(Qn,"type","button"),r(Qn,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(ss,"class","text-center"),r(os,"class","text-right"),r(ql,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(B,me){S(B,e,me),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),ie(a,u,null),s(n,c),s(n,f),s(n,_),s(n,p),s(p,b),s(b,v),s(v,d),s(v,g),s(v,w),s(v,T),oe(T,t[3].g.h),s(b,M),s(b,P),s(P,L),s(P,I),s(P,F),s(P,C),ie(R,C,null),$e(C,t[3].g.t,!0),s(n,ne),s(n,H),s(n,z),s(n,U),s(U,K),s(K,Q),s(Q,G),s(Q,X),s(Q,Y),s(Q,j),s(j,x),s(x,ae),s(x,ee),s(x,V),s(x,W),s(x,we),s(j,He),s(He,Le),s(He,Se),s(He,ye),s(He,ve),s(j,Te),s(Te,be),s(Te,N),s(j,y),s(j,k),s(j,A),s(j,D),s(j,Z),s(j,le),s(j,fe),s(j,de),s(j,Ce),s(j,Oe),s(j,ue),s(j,Me),s(j,Je),$e(j,t[3].p.r,!0),s(K,Lt),s(K,st),s(st,wt),s(st,nt),s(st,Ot),s(st,Qe);for(let _t=0;_t<5;_t+=1)_i[_t]&&_i[_t].m(Qe,null);$e(Qe,t[3].p.c,!0),s(n,Xt),s(n,zt),ie(vt,zt,null),s(n,xe),s(n,Ge),s(Ge,Ye),s(Ye,Ne),Ne.checked=t[3].p.e,s(Ye,Ze),s(Ge,et),$t&&$t.m(Ge,null),s(n,qe),s(n,Fe),s(Fe,_e),s(Fe,ce),s(Fe,Be),s(Fe,pt),s(pt,Tl),s(pt,Nl),s(pt,El),$e(pt,t[3].g.s,!0),s(n,Mi),St&&St.m(n,null),s(l,Ti),s(l,je),s(je,_n),s(je,Ni),s(je,Al),ie(Pl,Al,null),s(je,Ei),s(je,Hl),s(je,Ai),s(je,Wl),s(je,Pi),s(je,hl),s(hl,Di),s(hl,Ri),s(hl,Ii),s(hl,Gt),s(Gt,Dl),s(Gt,Ve),$e(Gt,t[3].m.a,!0),s(je,yt),s(je,ht),s(ht,si),s(ht,Li),s(ht,bl),s(ht,Oi),s(ht,zl),s(zl,Zt),Zt.checked=t[3].m.i,s(zl,$o),s(ht,So),s(ht,Rl),s(Rl,rl),s(rl,Il),s(Il,Mo);for(let _t=0;_t<7;_t+=1)pi[_t]&&pi[_t].m(rl,null);$e(rl,t[3].m.b,!0),s(Rl,To),s(Rl,bt),s(bt,Ll),s(Ll,No),s(bt,pn),s(bt,dn),s(bt,vn),s(bt,hn),$e(bt,t[3].m.p,!0),s(Rl,Eo),s(Rl,Ft),oe(Ft,t[3].m.s),s(je,Ao),s(je,Gl),s(Gl,Po),s(Gl,Do),s(Gl,Ro),s(Gl,al),s(al,bn),s(al,gn),$e(al,t[3].m.d,!0),s(je,Io),s(je,kn),s(kn,Vl),s(Vl,Lo),s(Vl,Oo),s(Vl,Fo),s(Vl,wn),s(wn,Jt),oe(Jt,t[3].m.f),s(wn,qo),s(wn,ji),s(kn,Bo),s(kn,Kl),s(Kl,Uo),s(Kl,jo),s(Kl,Ho),s(Kl,yn),s(yn,xt),oe(xt,t[3].m.r),s(yn,Wo),s(yn,Hi),s(je,zo),s(je,ks),s(je,Go),s(je,Yl),s(Yl,Wi),s(Wi,el),el.checked=t[3].m.e.e,s(Wi,Vo),s(Yl,Ko),Mt&&Mt.m(Yl,null),s(je,Yo),Tt&&Tt.m(je,null),s(je,ws),s(je,zi),s(zi,tl),tl.checked=t[3].m.m.e,s(zi,Qo),s(je,Xo),Nt&&Nt.m(je,null),s(l,Zo),s(l,qt),s(qt,Gi),s(qt,Jo),s(qt,Cn),ie($n,Cn,null),s(qt,xo),s(qt,oi),s(qt,er),s(qt,Ql),s(Ql,tr),s(Ql,lr),s(Ql,nr),s(Ql,Vt),s(Vt,Sn),s(Vt,Mn),Ht&&Ht.m(Vt,null),$e(Vt,t[3].n.c,!0),s(qt,ir),Et&&Et.m(qt,null),s(l,sr),s(l,mt),s(mt,Vi),s(mt,or),s(mt,Tn),ie(Nn,Tn,null),s(mt,rr),s(mt,Xl),s(Xl,ar),s(Xl,ur),s(Xl,fr),s(Xl,Ol),s(Ol,ul),s(ul,En),s(ul,An),$e(ul,t[3].n.m,!0),s(Ol,cr),s(Ol,Bt),oe(Bt,t[3].n.i),s(Ol,mr),s(Ol,Ut),ie(Pn,Ut,null),$e(Ut,t[3].n.s,!0),s(mt,_r),At&&At.m(mt,null),s(mt,ys),s(mt,Zi),s(Zi,Ji),s(Ji,ll),ll.checked=t[3].n.d,s(Ji,pr),s(mt,dr),s(mt,ri),s(mt,vr),s(mt,Fl),s(Fl,hr),s(Fl,ai),s(ai,nl),nl.checked=t[3].n.h,s(ai,br),s(Fl,gr),s(Fl,kr),s(Fl,xi),s(xi,gl),oe(gl,t[3].n.n1),s(l,wr),s(l,lt),s(lt,es),s(lt,yr),s(lt,Dn),ie(Rn,Dn,null),s(lt,Cr),s(lt,ui),s(lt,$r),s(lt,fl),s(fl,Sr),Pt&&Pt.m(fl,null),s(fl,Cs),s(fl,Mr),s(fl,Tr),s(fl,In),s(In,kl),oe(kl,t[3].q.h),s(In,Nr),s(In,il),oe(il,t[3].q.p),s(lt,Er),ot&&ot.m(lt,null),s(lt,$s),s(lt,Zl),s(Zl,Ar),s(Zl,Pr),s(Zl,Dr),s(Zl,wl),oe(wl,t[3].q.u),s(lt,Rr),s(lt,Jl),s(Jl,Ir),s(Jl,Lr),s(Jl,Or),s(Jl,yl),oe(yl,t[3].q.a),s(lt,Fr),s(lt,Ln),s(Ln,On),s(On,qr),s(On,Br),s(On,Ur),s(On,Cl),oe(Cl,t[3].q.c),s(Ln,jr),s(Ln,Fn),s(Fn,Hr),s(Fn,Wr),s(Fn,zr),s(Fn,Ct),s(Ct,qn),s(Ct,Bn),s(Ct,Un),s(Ct,jn),s(Ct,Hn),s(Ct,Wn),$e(Ct,t[3].q.m,!0),s(lt,Gr),s(lt,xl),s(xl,Vr),s(xl,Kr),s(xl,Yr),s(xl,$l),oe($l,t[3].q.b),s(l,Qr),rt&&rt.m(l,null),s(l,Ss),at&&at.m(l,null),s(l,Ms),ut&&ut.m(l,null),s(l,Ts),ft&&ft.m(l,null),s(l,Es),s(l,cl),s(cl,ts),s(cl,Xr),s(cl,zn),ie(Gn,zn,null),s(cl,Zr),s(cl,fi),s(cl,Jr),s(cl,ci);for(let _t=0;_t<gt.length;_t+=1)gt[_t]&&gt[_t].m(ci,null);s(l,xr),ct&&ct.m(l,null),s(l,As),s(l,jt),s(jt,ls),s(jt,ea),s(jt,Vn),ie(Kn,Vn,null),s(jt,ta),s(jt,mi),s(jt,la),s(jt,ns),s(ns,is),s(is,sl),sl.checked=t[3].d.s,s(is,na),s(jt,ia),Dt&&Dt.m(jt,null),s(e,sa),s(e,ql),s(ql,Ps),s(Ps,Yn),s(ql,oa),s(ql,ss),s(ss,Qn),s(ql,ra),s(ql,os),S(B,Ds,me),ie(en,B,me),S(B,Rs,me),ie(tn,B,me),S(B,Is,me),ie(ln,B,me),S(B,Ls,me),ie(nn,B,me),Kt=!0,Os||(aa=[te(T,"input",t[15]),te(C,"change",t[16]),te(j,"change",t[17]),te(Qe,"change",t[18]),te(Ne,"change",t[19]),te(pt,"change",t[21]),te(Gt,"change",t[24]),te(Zt,"change",t[25]),te(rl,"change",t[26]),te(bt,"change",t[27]),te(Ft,"input",t[28]),te(al,"change",t[29]),te(Jt,"input",t[30]),te(xt,"input",t[31]),te(el,"change",t[32]),te(tl,"change",t[35]),te(Vt,"change",t[40]),te(ul,"change",t[46]),te(Bt,"input",t[47]),te(Ut,"change",t[48]),te(ll,"change",t[52]),te(nl,"change",t[53]),te(gl,"input",t[54]),te(kl,"input",t[56]),te(il,"input",t[57]),te(wl,"input",t[58]),te(yl,"input",t[59]),te(Cl,"input",t[60]),te(Ct,"change",t[61]),te($l,"input",t[62]),te(sl,"change",t[98]),te(Yn,"click",t[8]),te(Qn,"click",t[10]),te(e,"submit",wi(t[9]))],Os=!0)},p(B,me){me[0]&8&&T.value!==B[3].g.h&&oe(T,B[3].g.h),me[0]&8&&$e(C,B[3].g.t),me[0]&8&&$e(j,B[3].p.r),me[0]&8&&$e(Qe,B[3].p.c);const _t={};if(me[3]&1048576&&(_t.$$scope={dirty:me,ctx:B}),vt.$set(_t),me[0]&8&&(Ne.checked=B[3].p.e),B[3].p.e&&B[0].chip!="esp8266"?$t?$t.p(B,me):($t=Zu(B),$t.c(),$t.m(Ge,null)):$t&&($t.d(1),$t=null),me[0]&8&&$e(pt,B[3].g.s),B[3].g.s>0?St?St.p(B,me):(St=Ju(B),St.c(),St.m(n,null)):St&&(St.d(1),St=null),me[0]&8&&$e(Gt,B[3].m.a),me[0]&8&&(Zt.checked=B[3].m.i),(!Kt||me[0]&8&&Fi!==(Fi=B[3].m.b!=0))&&(Il.disabled=Fi),me[0]&8&&$e(rl,B[3].m.b),(!Kt||me[0]&8&&qi!==(qi=B[3].m.b!=0))&&(Ll.disabled=qi),(!Kt||me[0]&8&&Bi!==(Bi=B[3].m.b==0))&&(bt.disabled=Bi),me[0]&8&&$e(bt,B[3].m.p),(!Kt||me[0]&9&&Ui!==(Ui=B[0].chip=="esp8266"?B[3].i.h.p==3||B[3].i.h.p==113?512:128:4096))&&r(Ft,"max",Ui),me[0]&8&&ge(Ft.value)!==B[3].m.s&&oe(Ft,B[3].m.s),me[0]&8&&$e(al,B[3].m.d),me[0]&8&&ge(Jt.value)!==B[3].m.f&&oe(Jt,B[3].m.f),me[0]&8&&ge(xt.value)!==B[3].m.r&&oe(xt,B[3].m.r),me[0]&8&&(el.checked=B[3].m.e.e),B[3].m.e.e?Mt?Mt.p(B,me):(Mt=xu(B),Mt.c(),Mt.m(Yl,null)):Mt&&(Mt.d(1),Mt=null),B[3].m.e.e?Tt?Tt.p(B,me):(Tt=ef(B),Tt.c(),Tt.m(je,ws)):Tt&&(Tt.d(1),Tt=null),me[0]&8&&(tl.checked=B[3].m.m.e),B[3].m.m.e?Nt?Nt.p(B,me):(Nt=tf(B),Nt.c(),Nt.m(je,null)):Nt&&(Nt.d(1),Nt=null),B[0].if&&B[0].if.eth?Ht||(Ht=lf(),Ht.c(),Ht.m(Vt,null)):Ht&&(Ht.d(1),Ht=null),me[0]&8&&$e(Vt,B[3].n.c),B[3].n.c==1||B[3].n.c==2?Et?Et.p(B,me):(Et=nf(B),Et.c(),Et.m(qt,null)):Et&&(Et.d(1),Et=null),me[0]&8&&$e(ul,B[3].n.m),(!Kt||me[0]&8&&Ki!==(Ki=B[3].n.m=="dhcp"))&&(Bt.disabled=Ki),(!Kt||me[0]&8&&Yi!==(Yi=B[3].n.m=="static"))&&(Bt.required=Yi),me[0]&8&&Bt.value!==B[3].n.i&&oe(Bt,B[3].n.i),(!Kt||me[0]&8&&Qi!==(Qi=B[3].n.m=="dhcp"))&&(Ut.disabled=Qi),(!Kt||me[0]&8&&Xi!==(Xi=B[3].n.m=="static"))&&(Ut.required=Xi),me[0]&8&&$e(Ut,B[3].n.s),B[3].n.m=="static"?At?At.p(B,me):(At=sf(B),At.c(),At.m(mt,ys)):At&&(At.d(1),At=null),me[0]&8&&(ll.checked=B[3].n.d),me[0]&8&&(nl.checked=B[3].n.h),me[0]&8&&gl.value!==B[3].n.n1&&oe(gl,B[3].n.n1),B[0].chip!="esp8266"?Pt?Pt.p(B,me):(Pt=of(B),Pt.c(),Pt.m(fl,Cs)):Pt&&(Pt.d(1),Pt=null),me[0]&8&&kl.value!==B[3].q.h&&oe(kl,B[3].q.h),me[0]&8&&ge(il.value)!==B[3].q.p&&oe(il,B[3].q.p),B[3].q.s.e?ot?(ot.p(B,me),me[0]&8&&O(ot,1)):(ot=rf(B),ot.c(),O(ot,1),ot.m(lt,$s)):ot&&(Ae(),q(ot,1,1,()=>{ot=null}),Pe()),me[0]&8&&wl.value!==B[3].q.u&&oe(wl,B[3].q.u),me[0]&8&&yl.value!==B[3].q.a&&oe(yl,B[3].q.a),me[0]&8&&Cl.value!==B[3].q.c&&oe(Cl,B[3].q.c),me[0]&8&&$e(Ct,B[3].q.m),me[0]&8&&$l.value!==B[3].q.b&&oe($l,B[3].q.b),B[3].q.m==3?rt?(rt.p(B,me),me[0]&8&&O(rt,1)):(rt=af(B),rt.c(),O(rt,1),rt.m(l,Ss)):rt&&(Ae(),q(rt,1,1,()=>{rt=null}),Pe()),B[3].q.m==4?at?(at.p(B,me),me[0]&8&&O(at,1)):(at=uf(B),at.c(),O(at,1),at.m(l,Ms)):at&&(Ae(),q(at,1,1,()=>{at=null}),Pe()),B[3].c.es!=null?ut?(ut.p(B,me),me[0]&8&&O(ut,1)):(ut=ff(B),ut.c(),O(ut,1),ut.m(l,Ts)):ut&&(Ae(),q(ut,1,1,()=>{ut=null}),Pe()),me[0]&8&&(Ns=B[3].p.r.startsWith("10YNO")||B[3].p.r.startsWith("10Y1001A1001A4")),Ns?ft?(ft.p(B,me),me[0]&8&&O(ft,1)):(ft=_f(B),ft.c(),O(ft,1),ft.m(l,Es)):ft&&(Ae(),q(ft,1,1,()=>{ft=null}),Pe()),me[0]&136){Xn=B[7];let Yt;for(Yt=0;Yt<Xn.length;Yt+=1){const _a=Qu(B,Xn,Yt);gt[Yt]?gt[Yt].p(_a,me):(gt[Yt]=df(_a),gt[Yt].c(),gt[Yt].m(ci,null))}for(;Yt<gt.length;Yt+=1)gt[Yt].d(1);gt.length=Xn.length}B[0].board>20||B[0].chip=="esp8266"||B[3].i.d.d>0?ct?(ct.p(B,me),me[0]&9&&O(ct,1)):(ct=vf(B),ct.c(),O(ct,1),ct.m(l,As)):ct&&(Ae(),q(ct,1,1,()=>{ct=null}),Pe()),me[0]&8&&(sl.checked=B[3].d.s),B[3].d.s?Dt?Dt.p(B,me):(Dt=Cf(B),Dt.c(),Dt.m(jt,null)):Dt&&(Dt.d(1),Dt=null);const ua={};me[0]&2&&(ua.active=B[1]),en.$set(ua);const fa={};me[0]&4&&(fa.active=B[2]),tn.$set(fa);const ca={};me[0]&16&&(ca.active=B[4]),ln.$set(ca);const ma={};me[0]&32&&(ma.active=B[5]),nn.$set(ma)},i(B){Kt||(O(a.$$.fragment,B),O(R.$$.fragment,B),O(vt.$$.fragment,B),O(Pl.$$.fragment,B),O($n.$$.fragment,B),O(Nn.$$.fragment,B),O(Pn.$$.fragment,B),O(Rn.$$.fragment,B),O(ot),O(rt),O(at),O(ut),O(ft),O(Gn.$$.fragment,B),O(ct),O(Kn.$$.fragment,B),O(en.$$.fragment,B),O(tn.$$.fragment,B),O(ln.$$.fragment,B),O(nn.$$.fragment,B),Kt=!0)},o(B){q(a.$$.fragment,B),q(R.$$.fragment,B),q(vt.$$.fragment,B),q(Pl.$$.fragment,B),q($n.$$.fragment,B),q(Nn.$$.fragment,B),q(Pn.$$.fragment,B),q(Rn.$$.fragment,B),q(ot),q(rt),q(at),q(ut),q(ft),q(Gn.$$.fragment,B),q(ct),q(Kn.$$.fragment,B),q(en.$$.fragment,B),q(tn.$$.fragment,B),q(ln.$$.fragment,B),q(nn.$$.fragment,B),Kt=!1},d(B){B&&$(e),se(a),se(R),dt(_i,B),se(vt),$t&&$t.d(),St&&St.d(),se(Pl),dt(pi,B),Mt&&Mt.d(),Tt&&Tt.d(),Nt&&Nt.d(),se($n),Ht&&Ht.d(),Et&&Et.d(),se(Nn),se(Pn),At&&At.d(),se(Rn),Pt&&Pt.d(),ot&&ot.d(),rt&&rt.d(),at&&at.d(),ut&&ut.d(),ft&&ft.d(),se(Gn),dt(gt,B),ct&&ct.d(),se(Kn),Dt&&Dt.d(),B&&$(Ds),se(en,B),B&&$(Rs),se(tn,B),B&&$(Is),se(ln,B),B&&$(Ls),se(nn,B),Os=!1,ze(aa)}}}async function D_(){await(await fetch("/reboot",{method:"POST"})).json()}function R_(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],o=!0,u=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,s:null,es:null}};hi.subscribe(Ve=>{Ve.version&&(l(3,a=Ve),l(1,o=!1))}),Xm();let c=!1,f=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const Ve=new URLSearchParams;Ve.append("perform","true");let ht=await(await fetch("/reset",{method:"POST",body:Ve})).json();l(4,c=!1),l(5,f=ht.success)}}async function p(Ve){l(2,u=!0);const yt=new FormData(Ve.target),ht=new URLSearchParams;for(let bl of yt){const[Oi,zl]=bl;ht.append(Oi,zl)}let Li=await(await fetch("/save",{method:"POST",body:ht})).json();Wt.update(bl=>(bl.booting=Li.reboot,bl.ui=a.u,bl)),l(2,u=!1),fn("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(Ve=>(Ve.booting=!0,Ve)),D_())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),hi.update(yt=>(yt.q.s.c=!1,yt)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),hi.update(yt=>(yt.q.s.r=!1,yt)))}async function g(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),hi.update(yt=>(yt.q.s.k=!1,yt)))}const w=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 T=44;function M(){a.g.h=this.value,l(3,a)}function P(){a.g.t=tt(this),l(3,a)}function L(){a.p.r=tt(this),l(3,a)}function I(){a.p.c=tt(this),l(3,a)}function F(){a.p.e=this.checked,l(3,a)}function C(){a.p.t=this.value,l(3,a)}function R(){a.g.s=tt(this),l(3,a)}function ne(){a.g.u=this.value,l(3,a)}function H(){a.g.p=this.value,l(3,a)}function z(){a.m.a=tt(this),l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function K(){a.m.b=tt(this),l(3,a)}function Q(){a.m.p=tt(this),l(3,a)}function G(){a.m.s=ge(this.value),l(3,a)}function X(){a.m.d=tt(this),l(3,a)}function Y(){a.m.f=ge(this.value),l(3,a)}function j(){a.m.r=ge(this.value),l(3,a)}function x(){a.m.e.e=this.checked,l(3,a)}function ae(){a.m.e.k=this.value,l(3,a)}function ee(){a.m.e.a=this.value,l(3,a)}function V(){a.m.m.e=this.checked,l(3,a)}function W(){a.m.m.w=ge(this.value),l(3,a)}function we(){a.m.m.v=ge(this.value),l(3,a)}function He(){a.m.m.a=ge(this.value),l(3,a)}function Le(){a.m.m.c=ge(this.value),l(3,a)}function Se(){a.n.c=tt(this),l(3,a)}function ye(){a.w.s=this.value,l(3,a)}function ve(){a.w.p=this.value,l(3,a)}function Te(){a.w.z=tt(this),l(3,a)}function be(){a.w.w=ge(this.value),l(3,a)}function N(){a.w.b=this.checked,l(3,a)}function y(){a.n.m=tt(this),l(3,a)}function k(){a.n.i=this.value,l(3,a)}function A(){a.n.s=tt(this),l(3,a)}function D(){a.n.g=this.value,l(3,a)}function Z(){a.n.d1=this.value,l(3,a)}function le(){a.n.d2=this.value,l(3,a)}function fe(){a.n.d=this.checked,l(3,a)}function de(){a.n.h=this.checked,l(3,a)}function Ce(){a.n.n1=this.value,l(3,a)}function Oe(){a.q.s.e=this.checked,l(3,a)}function ue(){a.q.h=this.value,l(3,a)}function Me(){a.q.p=ge(this.value),l(3,a)}function Je(){a.q.u=this.value,l(3,a)}function Lt(){a.q.a=this.value,l(3,a)}function st(){a.q.c=this.value,l(3,a)}function wt(){a.q.m=tt(this),l(3,a)}function nt(){a.q.b=this.value,l(3,a)}function Ot(){a.o.e=this.value,l(3,a)}function Qe(){a.o.c=this.value,l(3,a)}function Xt(){a.o.u1=this.value,l(3,a)}function zt(){a.o.u2=this.value,l(3,a)}function vt(){a.o.u3=this.value,l(3,a)}function xe(){a.h.t=this.value,l(3,a)}function Ge(){a.h.h=this.value,l(3,a)}function Ye(){a.h.n=this.value,l(3,a)}function Ne(){a.c.e=this.checked,l(3,a)}function Ze(){a.c.i=this.value,l(3,a)}function et(){a.c.s=this.value,l(3,a)}function qe(){a.c.es=this.checked,l(3,a)}function Fe(Ve){a.t.t[Ve]=ge(this.value),l(3,a)}function _e(){a.t.h=ge(this.value),l(3,a)}function ce(Ve){a.u[Ve.key]=tt(this),l(3,a)}function Be(){a.i.h.p=tt(this),l(3,a)}function pt(){a.i.h.t=tt(this),l(3,a)}function Tl(){a.i.h.u=this.checked,l(3,a)}function Nl(){a.i.a=ge(this.value),l(3,a)}function El(){a.i.l.p=ge(this.value),l(3,a)}function Mi(){a.i.l.i=this.checked,l(3,a)}function Ti(){a.i.r.i=this.checked,l(3,a)}function je(){a.i.r.r=ge(this.value),l(3,a)}function _n(){a.i.r.g=ge(this.value),l(3,a)}function Ni(){a.i.r.b=ge(this.value),l(3,a)}function Al(){a.i.d.d=ge(this.value),l(3,a)}function Pl(){a.i.t.d=ge(this.value),l(3,a)}function Ei(){a.i.t.a=ge(this.value),l(3,a)}function Hl(){a.i.v.p=ge(this.value),l(3,a)}function Ai(){a.i.v.d.v=ge(this.value),l(3,a)}function Wl(){a.i.v.d.g=ge(this.value),l(3,a)}function Pi(){a.i.d.b=tt(this),l(3,a)}function hl(){a.i.v.o=ge(this.value),l(3,a)}function Di(){a.i.v.m=ge(this.value),l(3,a)}function Ri(){a.i.v.b=ge(this.value),l(3,a)}function Ii(){a.d.s=this.checked,l(3,a)}function Gt(){a.d.t=this.checked,l(3,a)}function Dl(){a.d.l=tt(this),l(3,a)}return t.$$set=Ve=>{"sysinfo"in Ve&&l(0,n=Ve.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,T=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,u,a,c,f,T,i,_,p,b,v,d,g,w,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee,V,W,we,He,Le,Se,ye,ve,Te,be,N,y,k,A,D,Z,le,fe,de,Ce,Oe,ue,Me,Je,Lt,st,wt,nt,Ot,Qe,Xt,zt,vt,xe,Ge,Ye,Ne,Ze,et,qe,Fe,_e,ce,Be,pt,Tl,Nl,El,Mi,Ti,je,_n,Ni,Al,Pl,Ei,Hl,Ai,Wl,Pi,hl,Di,Ri,Ii,Gt,Dl]}class I_ extends Ie{constructor(e){super(),Re(this,e,R_,P_,Ee,{sysinfo:0},null,[-1,-1,-1,-1])}}function Sf(t,e,l){const n=t.slice();return n[20]=e[l],n}function L_(t){let e=he(t[1].chip,t[1].board)+"",l;return{c(){l=E(e)},m(n,i){S(n,l,i)},p(n,i){i&2&&e!==(e=he(n[1].chip,n[1].board)+"")&&J(l,e)},d(n){n&&$(l)}}}function Mf(t){let e,l,n=t[1].apmac+"",i,o,u,a,c,f,_,p,b,v=Pa(t[1])+"",d,g,w=t[1].boot_reason+"",T,M,P=t[1].ex_cause+"",L,I,F;const C=[F_,O_],R=[];function ne(H,z){return H[0].u>0?0:1}return c=ne(t),f=R[c]=C[c](t),{c(){e=m("div"),l=E("AP MAC: "),i=E(n),o=h(),u=m("div"),a=E(`Last boot:
`),f.c(),_=h(),p=m("div"),b=E("Reason: "),d=E(v),g=E(" ("),T=E(w),M=E("/"),L=E(P),I=E(")"),r(e,"class","my-2"),r(u,"class","my-2"),r(p,"class","my-2")},m(H,z){S(H,e,z),s(e,l),s(e,i),S(H,o,z),S(H,u,z),s(u,a),R[c].m(u,null),S(H,_,z),S(H,p,z),s(p,b),s(p,d),s(p,g),s(p,T),s(p,M),s(p,L),s(p,I),F=!0},p(H,z){(!F||z&2)&&n!==(n=H[1].apmac+"")&&J(i,n);let U=c;c=ne(H),c===U?R[c].p(H,z):(Ae(),q(R[U],1,1,()=>{R[U]=null}),Pe(),f=R[c],f?f.p(H,z):(f=R[c]=C[c](H),f.c()),O(f,1),f.m(u,null)),(!F||z&2)&&v!==(v=Pa(H[1])+"")&&J(d,v),(!F||z&2)&&w!==(w=H[1].boot_reason+"")&&J(T,w),(!F||z&2)&&P!==(P=H[1].ex_cause+"")&&J(L,P)},i(H){F||(O(f),F=!0)},o(H){q(f),F=!1},d(H){H&&$(e),H&&$(o),H&&$(u),R[c].d(),H&&$(_),H&&$(p)}}}function O_(t){let e;return{c(){e=E("-")},m(l,n){S(l,e,n)},p:pe,i:pe,o:pe,d(l){l&&$(e)}}}function F_(t){let e,l;return e=new Zc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function q_(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){S(l,e,n)},p:pe,d(l){l&&$(e)}}}function Tf(t){let e,l,n,i,o,u=vs(t[1].meter.mfg)+"",a,c,f,_,p=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,g,w=(t[1].meter.id?t[1].meter.id:"unknown")+"",T;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=E("Manufacturer: "),a=E(u),c=h(),f=m("div"),_=E("Model: "),b=E(p),v=h(),d=m("div"),g=E("ID: "),T=E(w),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(M,P){S(M,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,g),s(d,T)},p(M,P){P&2&&u!==(u=vs(M[1].meter.mfg)+"")&&J(a,u),P&2&&p!==(p=(M[1].meter.model?M[1].meter.model:"unknown")+"")&&J(b,p),P&2&&w!==(w=(M[1].meter.id?M[1].meter.id:"unknown")+"")&&J(T,w)},d(M){M&&$(e)}}}function Nf(t){let e,l,n,i,o,u=t[1].net.ip+"",a,c,f,_,p=t[1].net.mask+"",b,v,d,g,w=t[1].net.gw+"",T,M,P,L,I=t[1].net.dns1+"",F,C,R=t[1].net.dns2&&Ef(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=E("IP: "),a=E(u),c=h(),f=m("div"),_=E("Mask: "),b=E(p),v=h(),d=m("div"),g=E("Gateway: "),T=E(w),M=h(),P=m("div"),L=E("DNS: "),F=E(I),C=h(),R&&R.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(P,"class","my-2"),r(e,"class","cnt")},m(ne,H){S(ne,e,H),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,c),s(e,f),s(f,_),s(f,b),s(e,v),s(e,d),s(d,g),s(d,T),s(e,M),s(e,P),s(P,L),s(P,F),s(P,C),R&&R.m(P,null)},p(ne,H){H&2&&u!==(u=ne[1].net.ip+"")&&J(a,u),H&2&&p!==(p=ne[1].net.mask+"")&&J(b,p),H&2&&w!==(w=ne[1].net.gw+"")&&J(T,w),H&2&&I!==(I=ne[1].net.dns1+"")&&J(F,I),ne[1].net.dns2?R?R.p(ne,H):(R=Ef(ne),R.c(),R.m(P,null)):R&&(R.d(1),R=null)},d(ne){ne&&$(e),R&&R.d()}}}function Ef(t){let e,l=t[1].net.dns2+"",n;return{c(){e=E("/ "),n=E(l)},m(i,o){S(i,e,o),S(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&J(n,l)},d(i){i&&$(e),i&&$(n)}}}function Af(t){let e,l,n,i=t[1].upgrade.f+"",o,u,a=t[1].upgrade.t+"",c,f,_=Aa(t[1].upgrade.e)+"",p;return{c(){e=m("div"),l=m("div"),n=E("Previous upgrade attempt from "),o=E(i),u=E(" to "),c=E(a),f=E(" failed. "),p=E(_),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(b,v){S(b,e,v),s(e,l),s(l,n),s(l,o),s(l,u),s(l,c),s(l,f),s(l,p)},p(b,v){v&2&&i!==(i=b[1].upgrade.f+"")&&J(o,i),v&2&&a!==(a=b[1].upgrade.t+"")&&J(c,a),v&2&&_!==(_=Aa(b[1].upgrade.e)+"")&&J(p,_)},d(b){b&&$(e)}}}function Pf(t){let e,l,n,i=t[2].tag_name+"",o,u,a,c,f,_,p=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Df(t),b=t[1].fwconsent===2&&Rf();return{c(){e=m("div"),l=E(`Latest version:
`),n=m("a"),o=E(i),a=h(),p&&p.c(),c=h(),b&&b.c(),f=Ke(),r(n,"href",u=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){S(v,e,d),s(e,l),s(e,n),s(n,o),s(e,a),p&&p.m(e,null),S(v,c,d),b&&b.m(v,d),S(v,f,d),_=!0},p(v,d){(!_||d&4)&&i!==(i=v[2].tag_name+"")&&J(o,i),(!_||d&4&&u!==(u=v[2].html_url))&&r(n,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?p?(p.p(v,d),d&7&&O(p,1)):(p=Df(v),p.c(),O(p,1),p.m(e,null)):p&&(Ae(),q(p,1,1,()=>{p=null}),Pe()),v[1].fwconsent===2?b||(b=Rf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){_||(O(p),_=!0)},o(v){q(p),_=!1},d(v){v&&$(e),p&&p.d(),v&&$(c),b&&b.d(v),v&&$(f)}}}function Df(t){let e,l,n,i,o,u;return n=new Jc({}),{c(){e=m("div"),l=m("button"),re(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(a,c){S(a,e,c),s(e,l),ie(n,l,null),i=!0,o||(u=te(l,"click",t[10]),o=!0)},p:pe,i(a){i||(O(n.$$.fragment,a),i=!0)},o(a){q(n.$$.fragment,a),i=!1},d(a){a&&$(e),se(n),o=!1,u()}}}function Rf(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>',r(e,"class","my-2")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function If(t){let e,l=hs(he(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=E(l),r(e,"class","bd-red")},m(i,o){S(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=hs(he(i[1].chip,i[1].board))+"")&&J(n,l)},d(i){i&&$(e)}}}function Lf(t){let e,l,n,i,o,u;function a(_,p){return _[4].length==0?U_:B_}let c=a(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),co(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(_,p){S(_,e,p),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(u=[te(n,"change",t[13]),te(l,"submit",t[15])],o=!0)},p(_,p){c===(c=a(_))&&f?f.p(_,p):(f.d(1),f=c(_),f&&(f.c(),f.m(l,null)))},d(_){_&&$(e),t[12](null),f.d(),o=!1,ze(u)}}}function B_(t){let e=t[4][0].name+"",l,n,i;return{c(){l=E(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,u){S(o,l,u),S(o,n,u),S(o,i,u)},p(o,u){u&16&&e!==(e=o[4][0].name+"")&&J(l,e)},d(o){o&&$(l),o&&$(n),o&&$(i)}}}function U_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){S(i,e,o),l||(n=te(e,"click",t[14]),l=!0)},p:pe,d(i){i&&$(e),l=!1,n()}}}function Of(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g=t[9],w=[];for(let I=0;I<g.length;I+=1)w[I]=Ff(Sf(t,g,I));let T=t[7].length==0&&qf();function M(I,F){return I[7].length==0?H_:j_}let P=M(t),L=P(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Backup & restore",n=h(),i=m("form"),o=m("div");for(let I=0;I<w.length;I+=1)w[I].c();u=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>',c=h(),T&&T.c(),f=h(),_=m("form"),p=m("input"),b=h(),L.c(),r(l,"class","text-sm"),r(a,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),co(p,"display","none"),r(p,"name","file"),r(p,"type","file"),r(p,"accept",".cfg"),r(_,"action","/configfile"),r(_,"enctype","multipart/form-data"),r(_,"method","post"),r(_,"autocomplete","off"),r(e,"class","cnt")},m(I,F){S(I,e,F),s(e,l),s(e,n),s(e,i),s(i,o);for(let C=0;C<w.length;C+=1)w[C]&&w[C].m(o,null);s(o,u),s(o,a),s(i,c),T&&T.m(i,null),s(e,f),s(e,_),s(_,p),t[16](p),s(_,b),L.m(_,null),v||(d=[te(p,"change",t[17]),te(_,"submit",t[19])],v=!0)},p(I,F){if(F&512){g=I[9];let C;for(C=0;C<g.length;C+=1){const R=Sf(I,g,C);w[C]?w[C].p(R,F):(w[C]=Ff(R),w[C].c(),w[C].m(o,u))}for(;C<w.length;C+=1)w[C].d(1);w.length=g.length}I[7].length==0?T||(T=qf(),T.c(),T.m(i,null)):T&&(T.d(1),T=null),P===(P=M(I))&&L?L.p(I,F):(L.d(1),L=P(I),L&&(L.c(),L.m(_,null)))},d(I){I&&$(e),dt(w,I),T&&T.d(),t[16](null),L.d(),v=!1,ze(d)}}}function Ff(t){let e,l,n,i=t[20].name+"",o;return{c(){e=m("label"),l=m("input"),n=h(),o=E(i),r(l,"type","checkbox"),r(l,"class","rounded"),r(l,"name",t[20].key),l.value="true",l.checked=!0,r(e,"class","my-1 mx-3")},m(u,a){S(u,e,a),s(e,l),s(e,n),s(e,o)},p:pe,d(u){u&&$(e)}}}function qf(t){let e;return{c(){e=m("button"),e.textContent="Download",r(e,"type","submit"),r(e,"class","btn-pri-sm float-right")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function j_(t){let e=t[7][0].name+"",l,n,i;return{c(){l=E(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm")},m(o,u){S(o,l,u),S(o,n,u),S(o,i,u)},p(o,u){u&128&&e!==(e=o[7][0].name+"")&&J(l,e)},d(o){o&&$(l),o&&$(n),o&&$(i)}}}function H_(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select file...",r(e,"type","button"),r(e,"class","btn-pri-sm")},m(i,o){S(i,e,o),l||(n=te(e,"click",t[18]),l=!0)},p:pe,d(i){i&&$(e),l=!1,n()}}}function W_(t){let e,l,n,i,o,u,a=t[1].chip+"",c,f,_=t[1].cpu+"",p,b,v,d,g,w,T,M,P,L=t[1].mac+"",I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae=t[1].version+"",ee,V,W,we,He=(t[1].security==0||t[0].a)&&ti(t[1].board),Le,Se,ye,ve,Te,be,N,y,k;w=new Qt({props:{to:"/vendor",$$slots:{default:[L_]},$$scope:{ctx:t}}});let A=t[1].apmac&&t[1].apmac!=t[1].mac&&Mf(t);ne=new Qt({props:{to:"/consent",$$slots:{default:[q_]},$$scope:{ctx:t}}});let D=t[1].meter&&Tf(t),Z=t[1].net&&Nf(t),le=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&Af(t),fe=t[2]&&Pf(t),de=He&&If(t),Ce=(t[1].security==0||t[0].a)&&Lf(t),Oe=(t[1].security==0||t[0].a)&&Of(t);return ve=new kt({props:{active:t[5],message:"Uploading firmware, please wait"}}),be=new kt({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"),u=E("Chip: "),c=E(a),f=E(" ("),p=E(_),b=E("MHz)"),v=h(),d=m("div"),g=E("Device: "),re(w.$$.fragment),T=h(),M=m("div"),P=E("MAC: "),I=E(L),F=h(),A&&A.c(),C=h(),R=m("div"),re(ne.$$.fragment),H=h(),z=m("button"),z.textContent="Reboot",U=h(),D&&D.c(),K=h(),Z&&Z.c(),Q=h(),G=m("div"),X=m("strong"),X.textContent="Firmware",Y=h(),j=m("div"),x=E("Installed version: "),ee=E(ae),V=h(),le&&le.c(),W=h(),fe&&fe.c(),we=h(),de&&de.c(),Le=h(),Ce&&Ce.c(),Se=h(),Oe&&Oe.c(),ye=h(),re(ve.$$.fragment),Te=h(),re(be.$$.fragment),r(n,"class","text-sm"),r(o,"class","my-2"),r(d,"class","my-2"),r(M,"class","my-2"),r(z,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),r(R,"class","my-2"),r(l,"class","cnt"),r(X,"class","text-sm"),r(j,"class","my-2"),r(G,"class","cnt"),r(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(ue,Me){S(ue,e,Me),s(e,l),s(l,n),s(l,i),s(l,o),s(o,u),s(o,c),s(o,f),s(o,p),s(o,b),s(l,v),s(l,d),s(d,g),ie(w,d,null),s(l,T),s(l,M),s(M,P),s(M,I),s(l,F),A&&A.m(l,null),s(l,C),s(l,R),ie(ne,R,null),s(R,H),s(R,z),s(e,U),D&&D.m(e,null),s(e,K),Z&&Z.m(e,null),s(e,Q),s(e,G),s(G,X),s(G,Y),s(G,j),s(j,x),s(j,ee),s(G,V),le&&le.m(G,null),s(G,W),fe&&fe.m(G,null),s(G,we),de&&de.m(G,null),s(G,Le),Ce&&Ce.m(G,null),s(e,Se),Oe&&Oe.m(e,null),S(ue,ye,Me),ie(ve,ue,Me),S(ue,Te,Me),ie(be,ue,Me),N=!0,y||(k=te(z,"click",t[11]),y=!0)},p(ue,[Me]){(!N||Me&2)&&a!==(a=ue[1].chip+"")&&J(c,a),(!N||Me&2)&&_!==(_=ue[1].cpu+"")&&J(p,_);const Je={};Me&8388610&&(Je.$$scope={dirty:Me,ctx:ue}),w.$set(Je),(!N||Me&2)&&L!==(L=ue[1].mac+"")&&J(I,L),ue[1].apmac&&ue[1].apmac!=ue[1].mac?A?(A.p(ue,Me),Me&2&&O(A,1)):(A=Mf(ue),A.c(),O(A,1),A.m(l,C)):A&&(Ae(),q(A,1,1,()=>{A=null}),Pe());const Lt={};Me&8388608&&(Lt.$$scope={dirty:Me,ctx:ue}),ne.$set(Lt),ue[1].meter?D?D.p(ue,Me):(D=Tf(ue),D.c(),D.m(e,K)):D&&(D.d(1),D=null),ue[1].net?Z?Z.p(ue,Me):(Z=Nf(ue),Z.c(),Z.m(e,Q)):Z&&(Z.d(1),Z=null),(!N||Me&2)&&ae!==(ae=ue[1].version+"")&&J(ee,ae),ue[1].upgrade.t&&ue[1].upgrade.t!=ue[1].version?le?le.p(ue,Me):(le=Af(ue),le.c(),le.m(G,W)):le&&(le.d(1),le=null),ue[2]?fe?(fe.p(ue,Me),Me&4&&O(fe,1)):(fe=Pf(ue),fe.c(),O(fe,1),fe.m(G,we)):fe&&(Ae(),q(fe,1,1,()=>{fe=null}),Pe()),Me&3&&(He=(ue[1].security==0||ue[0].a)&&ti(ue[1].board)),He?de?de.p(ue,Me):(de=If(ue),de.c(),de.m(G,Le)):de&&(de.d(1),de=null),ue[1].security==0||ue[0].a?Ce?Ce.p(ue,Me):(Ce=Lf(ue),Ce.c(),Ce.m(G,null)):Ce&&(Ce.d(1),Ce=null),ue[1].security==0||ue[0].a?Oe?Oe.p(ue,Me):(Oe=Of(ue),Oe.c(),Oe.m(e,null)):Oe&&(Oe.d(1),Oe=null);const st={};Me&32&&(st.active=ue[5]),ve.$set(st);const wt={};Me&256&&(wt.active=ue[8]),be.$set(wt)},i(ue){N||(O(w.$$.fragment,ue),O(A),O(ne.$$.fragment,ue),O(fe),O(ve.$$.fragment,ue),O(be.$$.fragment,ue),N=!0)},o(ue){q(w.$$.fragment,ue),q(A),q(ne.$$.fragment,ue),q(fe),q(ve.$$.fragment,ue),q(be.$$.fragment,ue),N=!1},d(ue){ue&&$(e),se(w),A&&A.d(),se(ne),D&&D.d(),Z&&Z.d(),le&&le.d(),fe&&fe.d(),de&&de.d(),Ce&&Ce.d(),Oe&&Oe.d(),ue&&$(ye),se(ve,ue),ue&&$(Te),se(be,ue),y=!1,k()}}}async function z_(){await(await fetch("/reboot",{method:"POST"})).json()}function G_(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};yo.subscribe(C=>{l(2,u=Xc(i.version,C)),u||l(2,u=C[0])});function a(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(hs(he(i.chip,i.board))))&&(Wt.update(C=>(C.upgrading=!0,C)),Qc(u.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Wt.update(C=>(C.booting=!0,C)),z_())};let f,_=[],p=!1,b,v=[],d=!1;bo();function g(C){ps[C?"unshift":"push"](()=>{f=C,l(3,f)})}function w(){_=this.files,l(4,_)}const T=()=>{f.click()},M=()=>l(5,p=!0);function P(C){ps[C?"unshift":"push"](()=>{b=C,l(6,b)})}function L(){v=this.files,l(7,v)}const I=()=>{b.click()},F=()=>l(8,d=!0);return t.$$set=C=>{"data"in C&&l(0,n=C.data),"sysinfo"in C&&l(1,i=C.sysinfo)},[n,i,u,f,_,p,b,v,d,o,a,c,g,w,T,M,P,L,I,F]}class V_ extends Ie{constructor(e){super(),Re(this,e,G_,W_,Ee,{data:0,sysinfo:1})}}function Bf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],5)+"",a,c,f=he(t[0],4)+"",_,p,b=he(t[0],3)+"",v,d,g,w,T=he(t[0],2)+"",M,P,L=he(t[0],1)+"",I,F,C=he(t[0],0)+"",R,ne,H,z,U=he(t[0],101)+"",K,Q,G=he(t[0],100)+"",X;return{c(){e=m("optgroup"),l=m("option"),i=E(n),o=m("option"),a=E(u),c=m("option"),_=E(f),p=m("option"),v=E(b),d=h(),g=m("optgroup"),w=m("option"),M=E(T),P=m("option"),I=E(L),F=m("option"),R=E(C),ne=h(),H=m("optgroup"),z=m("option"),K=E(U),Q=m("option"),X=E(G),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,p.__value=3,p.value=p.__value,r(e,"label","amsleser.no"),w.__value=2,w.value=w.__value,P.__value=1,P.value=P.__value,F.__value=0,F.value=F.__value,r(g,"label","Custom hardware"),z.__value=101,z.value=z.__value,Q.__value=100,Q.value=Q.__value,r(H,"label","Generic hardware")},m(Y,j){S(Y,e,j),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),s(e,p),s(p,v),S(Y,d,j),S(Y,g,j),s(g,w),s(w,M),s(g,P),s(P,I),s(g,F),s(F,R),S(Y,ne,j),S(Y,H,j),s(H,z),s(z,K),s(H,Q),s(Q,X)},p(Y,j){j&1&&n!==(n=he(Y[0],7)+"")&&J(i,n),j&1&&u!==(u=he(Y[0],5)+"")&&J(a,u),j&1&&f!==(f=he(Y[0],4)+"")&&J(_,f),j&1&&b!==(b=he(Y[0],3)+"")&&J(v,b),j&1&&T!==(T=he(Y[0],2)+"")&&J(M,T),j&1&&L!==(L=he(Y[0],1)+"")&&J(I,L),j&1&&C!==(C=he(Y[0],0)+"")&&J(R,C),j&1&&U!==(U=he(Y[0],101)+"")&&J(K,U),j&1&&G!==(G=he(Y[0],100)+"")&&J(X,G)},d(Y){Y&&$(e),Y&&$(d),Y&&$(g),Y&&$(ne),Y&&$(H)}}}function Uf(t){let e,l,n=he(t[0],201)+"",i,o,u=he(t[0],202)+"",a,c,f=he(t[0],203)+"",_,p,b=he(t[0],241)+"",v,d,g=he(t[0],242)+"",w,T,M=he(t[0],243)+"",P,L,I=he(t[0],200)+"",F;return{c(){e=m("optgroup"),l=m("option"),i=E(n),o=m("option"),a=E(u),c=m("option"),_=E(f),p=m("option"),v=E(b),d=m("option"),w=E(g),T=m("option"),P=E(M),L=m("option"),F=E(I),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,p.__value=241,p.value=p.__value,d.__value=242,d.value=d.__value,T.__value=243,T.value=T.__value,L.__value=200,L.value=L.__value,r(e,"label","Generic hardware")},m(C,R){S(C,e,R),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),s(e,p),s(p,v),s(e,d),s(d,w),s(e,T),s(T,P),s(e,L),s(L,F)},p(C,R){R&1&&n!==(n=he(C[0],201)+"")&&J(i,n),R&1&&u!==(u=he(C[0],202)+"")&&J(a,u),R&1&&f!==(f=he(C[0],203)+"")&&J(_,f),R&1&&b!==(b=he(C[0],241)+"")&&J(v,b),R&1&&g!==(g=he(C[0],242)+"")&&J(w,g),R&1&&M!==(M=he(C[0],243)+"")&&J(P,M),R&1&&I!==(I=he(C[0],200)+"")&&J(F,I)},d(C){C&&$(e)}}}function jf(t){let e,l,n=he(t[0],7)+"",i,o,u=he(t[0],6)+"",a,c,f=he(t[0],5)+"",_,p,b,v,d=he(t[0],51)+"",g,w,T=he(t[0],50)+"",M;return{c(){e=m("optgroup"),l=m("option"),i=E(n),o=m("option"),a=E(u),c=m("option"),_=E(f),p=h(),b=m("optgroup"),v=m("option"),g=E(d),w=m("option"),M=E(T),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,w.__value=50,w.value=w.__value,r(b,"label","Generic hardware")},m(P,L){S(P,e,L),s(e,l),s(l,i),s(e,o),s(o,a),s(e,c),s(c,_),S(P,p,L),S(P,b,L),s(b,v),s(v,g),s(b,w),s(w,M)},p(P,L){L&1&&n!==(n=he(P[0],7)+"")&&J(i,n),L&1&&u!==(u=he(P[0],6)+"")&&J(a,u),L&1&&f!==(f=he(P[0],5)+"")&&J(_,f),L&1&&d!==(d=he(P[0],51)+"")&&J(g,d),L&1&&T!==(T=he(P[0],50)+"")&&J(M,T)},d(P){P&&$(e),P&&$(p),P&&$(b)}}}function Hf(t){let e,l,n=he(t[0],8)+"",i,o,u,a,c=he(t[0],71)+"",f,_,p=he(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=E(n),o=h(),u=m("optgroup"),a=m("option"),f=E(c),_=m("option"),b=E(p),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,_.__value=70,_.value=_.__value,r(u,"label","Generic hardware")},m(v,d){S(v,e,d),s(e,l),s(l,i),S(v,o,d),S(v,u,d),s(u,a),s(a,f),s(u,_),s(_,b)},p(v,d){d&1&&n!==(n=he(v[0],8)+"")&&J(i,n),d&1&&c!==(c=he(v[0],71)+"")&&J(f,c),d&1&&p!==(p=he(v[0],70)+"")&&J(b,p)},d(v){v&&$(e),v&&$(o),v&&$(u)}}}function Wf(t){let e,l,n=he(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=E(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){S(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],200)+"")&&J(i,n)},d(o){o&&$(e)}}}function zf(t){let e,l,n=he(t[0],80)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=E(n),l.__value=80,l.value=l.__value,r(e,"label","Generic hardware")},m(o,u){S(o,e,u),s(e,l),s(l,i)},p(o,u){u&1&&n!==(n=he(o[0],80)+"")&&J(i,n)},d(o){o&&$(e)}}}function K_(t){let e,l,n,i,o,u,a,c,f=t[0]=="esp8266"&&Bf(t),_=t[0]=="esp32"&&Uf(t),p=t[0]=="esp32s2"&&jf(t),b=t[0]=="esp32c3"&&Hf(t),v=t[0]=="esp32solo"&&Wf(t),d=t[0]=="esp32s3"&&zf(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),_&&_.c(),i=h(),p&&p.c(),o=h(),b&&b.c(),u=h(),v&&v.c(),a=h(),d&&d.c(),c=Ke(),e.__value=-1,e.value=e.__value},m(g,w){S(g,e,w),S(g,l,w),f&&f.m(g,w),S(g,n,w),_&&_.m(g,w),S(g,i,w),p&&p.m(g,w),S(g,o,w),b&&b.m(g,w),S(g,u,w),v&&v.m(g,w),S(g,a,w),d&&d.m(g,w),S(g,c,w)},p(g,[w]){g[0]=="esp8266"?f?f.p(g,w):(f=Bf(g),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),g[0]=="esp32"?_?_.p(g,w):(_=Uf(g),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g[0]=="esp32s2"?p?p.p(g,w):(p=jf(g),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),g[0]=="esp32c3"?b?b.p(g,w):(b=Hf(g),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null),g[0]=="esp32solo"?v?v.p(g,w):(v=Wf(g),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,w):(d=zf(g),d.c(),d.m(c.parentNode,c)):d&&(d.d(1),d=null)},i:pe,o:pe,d(g){g&&$(e),g&&$(l),f&&f.d(g),g&&$(n),_&&_.d(g),g&&$(i),p&&p.d(g),g&&$(o),b&&b.d(g),g&&$(u),v&&v.d(g),g&&$(a),d&&d.d(g),g&&$(c)}}}function Y_(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Q_ extends Ie{constructor(e){super(),Re(this,e,Y_,K_,Ee,{chip:0})}}function Gf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function Vf(t){let e,l,n,i,o,u,a;return u=new io({props:{chip:t[0].chip}}),{c(){e=m("div"),l=E("HAN GPIO"),n=m("br"),i=h(),o=m("select"),re(u.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){S(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),ie(u,o,null),a=!0},p(c,f){const _={};f&1&&(_.chip=c[0].chip),u.$set(_)},i(c){a||(O(u.$$.fragment,c),a=!0)},o(c){q(u.$$.fragment,c),a=!1},d(c){c&&$(e),se(u)}}}function X_(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q=t[0].usrcfg&&Gf();d=new Q_({props:{chip:t[0].chip}});let G=t[0].board&&t[0].board>20&&Vf(t);return H=new kt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Initial configuration",a=h(),Q&&Q.c(),c=h(),f=m("div"),_=E("Board type"),p=m("br"),b=h(),v=m("select"),re(d.$$.fragment),g=h(),G&&G.c(),w=h(),T=m("div"),M=m("label"),P=m("input"),L=E(" Clear all other configuration"),I=h(),F=m("div"),F.innerHTML='<button type="submit" class="btn-pri">Save</button>',C=h(),R=m("span"),R.textContent="\xA0",ne=h(),re(H.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(u,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&We(()=>t[4].call(v)),r(f,"class","my-3"),r(P,"type","checkbox"),r(P,"name","vr"),P.__value="true",P.value=P.__value,r(P,"class","rounded mb-1"),r(T,"class","my-3"),r(F,"class","my-3"),r(R,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(X,Y){S(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),Q&&Q.m(n,null),s(n,c),s(n,f),s(f,_),s(f,p),s(f,b),s(f,v),ie(d,v,null),$e(v,t[0].board,!0),s(n,g),G&&G.m(n,null),s(n,w),s(n,T),s(T,M),s(M,P),P.checked=t[2],s(M,L),s(n,I),s(n,F),s(n,C),s(n,R),S(X,ne,Y),ie(H,X,Y),z=!0,U||(K=[te(v,"change",t[4]),te(P,"change",t[5]),te(n,"submit",wi(t[3]))],U=!0)},p(X,[Y]){X[0].usrcfg?Q||(Q=Gf(),Q.c(),Q.m(n,c)):Q&&(Q.d(1),Q=null);const j={};Y&1&&(j.chip=X[0].chip),d.$set(j),Y&1&&$e(v,X[0].board),X[0].board&&X[0].board>20?G?(G.p(X,Y),Y&1&&O(G,1)):(G=Vf(X),G.c(),O(G,1),G.m(n,w)):G&&(Ae(),q(G,1,1,()=>{G=null}),Pe()),Y&4&&(P.checked=X[2]);const x={};Y&2&&(x.active=X[1]),H.$set(x)},i(X){z||(O(d.$$.fragment,X),O(G),O(H.$$.fragment,X),z=!0)},o(X){q(d.$$.fragment,X),q(G),q(H.$$.fragment,X),z=!1},d(X){X&&$(e),Q&&Q.d(),se(d),G&&G.d(),X&&$(ne),se(H,X),U=!1,ze(K)}}}function Z_(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const _=new FormData(f.target),p=new URLSearchParams;for(let d of _){const[g,w]=d;p.append(g,w)}let v=await(await fetch("/save",{method:"POST",body:p})).json();l(1,i=!1),Wt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d.if.eth=d.boardType>240&&d.boardType<250,d)),fn(n.usrcfg?"/":"/setup")}let u=!1;Wt.subscribe(f=>{l(0,n=f),f.fwconsent===1&&l(2,u=!n.usrcfg)});function a(){n.board=tt(this),l(0,n)}function c(){u=this.checked,l(2,u)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},[n,i,u,o,a,c]}class J_ extends Ie{constructor(e){super(),Re(this,e,Z_,X_,Ee,{sysinfo:0})}}function Kf(t){let e;return{c(){e=m("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function Yf(t){let e,l,n,i,o,u,a,c,f,_,p,b,v;return{c(){e=m("div"),l=E("SSID"),n=m("br"),i=h(),o=m("input"),a=h(),c=m("div"),f=E("PSK"),_=m("br"),p=h(),b=m("input"),r(o,"name","ss"),r(o,"type","text"),r(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,r(e,"class","my-3"),r(b,"name","sp"),r(b,"type","password"),r(b,"class","in-s"),r(b,"autocomplete","off"),b.required=v=t[2]==2,r(c,"class","my-3")},m(d,g){S(d,e,g),s(e,l),s(e,n),s(e,i),s(e,o),S(d,a,g),S(d,c,g),s(c,f),s(c,_),s(c,p),s(c,b)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(b.required=v)},d(d){d&&$(e),d&&$(a),d&&$(c)}}}function Qf(t){let e,l,n,i,o,u,a,c;return a=new t1({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),u=m("select"),re(a.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(u,"name","su"),r(u,"class","in-l"),u.required=t[1],r(n,"class","flex")},m(f,_){S(f,e,_),S(f,l,_),S(f,n,_),s(n,i),s(n,o),s(n,u),ie(a,u,null),c=!0},p(f,_){(!c||_&2)&&(i.required=f[1]),(!c||_&2)&&(u.required=f[1])},i(f){c||(O(a.$$.fragment,f),c=!0)},o(f){q(a.$$.fragment,f),c=!1},d(f){f&&$(e),f&&$(l),f&&$(n),se(a)}}}function Xf(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>`,r(e,"class","my-3 flex")},m(l,n){S(l,e,n)},d(l){l&&$(e)}}}function x_(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j=t[0].if&&t[0].if.eth&&Kf(),x=(t[2]==1||t[2]==2)&&Yf(t),ae=t[1]&&Qf(t),ee=t[1]&&Xf();return Q=new kt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),u=m("strong"),u.textContent="Setup",a=h(),c=m("div"),f=E("Connection"),_=m("br"),p=h(),b=m("select"),v=m("option"),v.textContent="Connect to WiFi",d=m("option"),d.textContent="Standalone access point",j&&j.c(),g=h(),x&&x.c(),w=h(),T=m("div"),M=E(`Hostname
`),P=m("input"),L=h(),I=m("div"),F=m("label"),C=m("input"),R=E(" Static IP"),ne=h(),ae&&ae.c(),H=h(),ee&&ee.c(),z=h(),U=m("div"),U.innerHTML='<button type="submit" class="btn-pri">Save</button>',K=h(),re(Q.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(u,"class","text-sm"),v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,r(b,"name","sc"),r(b,"class","in-s"),t[2]===void 0&&We(()=>t[5].call(b)),r(c,"class","my-3"),r(P,"name","sh"),r(P,"type","text"),r(P,"class","in-s"),r(P,"maxlength","32"),r(P,"pattern","[a-z0-9_-]+"),r(P,"placeholder","Optional, ex.: ams-reader"),r(P,"autocomplete","off"),r(C,"type","checkbox"),r(C,"name","sm"),C.__value="static",C.value=C.__value,r(C,"class","rounded mb-1"),r(I,"class","my-3"),r(U,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(V,W){S(V,e,W),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(b,d),j&&j.m(b,null),$e(b,t[2],!0),s(n,g),x&&x.m(n,null),s(n,w),s(n,T),s(T,M),s(T,P),oe(P,t[0].hostname),s(n,L),s(n,I),s(I,F),s(F,C),C.checked=t[1],s(F,R),s(I,ne),ae&&ae.m(I,null),s(n,H),ee&&ee.m(n,null),s(n,z),s(n,U),S(V,K,W),ie(Q,V,W),G=!0,X||(Y=[te(b,"change",t[5]),te(P,"input",t[6]),te(C,"change",t[7]),te(n,"submit",wi(t[4]))],X=!0)},p(V,[W]){V[0].if&&V[0].if.eth?j||(j=Kf(),j.c(),j.m(b,null)):j&&(j.d(1),j=null),W&4&&$e(b,V[2]),V[2]==1||V[2]==2?x?x.p(V,W):(x=Yf(V),x.c(),x.m(n,w)):x&&(x.d(1),x=null),W&1&&P.value!==V[0].hostname&&oe(P,V[0].hostname),W&2&&(C.checked=V[1]),V[1]?ae?(ae.p(V,W),W&2&&O(ae,1)):(ae=Qf(V),ae.c(),O(ae,1),ae.m(I,null)):ae&&(Ae(),q(ae,1,1,()=>{ae=null}),Pe()),V[1]?ee||(ee=Xf(),ee.c(),ee.m(n,z)):ee&&(ee.d(1),ee=null);const we={};W&8&&(we.active=V[3]),Q.$set(we)},i(V){G||(O(ae),O(Q.$$.fragment,V),G=!0)},o(V){q(ae),q(Q.$$.fragment,V),G=!1},d(V){V&&$(e),j&&j.d(),x&&x.d(),ae&&ae.d(),ee&&ee.d(),V&&$(K),se(Q,V),X=!1,ze(Y)}}}function ep(t,e,l){let{sysinfo:n={}}=e,i=!1,o=1,u=!1,a=0;function c(){var v="";a++;var d=function(){setTimeout(c,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){d();return}v="http://"+n.net.ip}else n.hostname&&a%3==1?v="http://"+n.hostname:n.hostname&&a%3==2?v="http://"+n.hostname+".local":v="";console&&console.log("Trying url "+v),Wt.update(w=>(w.trying=v,w));var g=new XMLHttpRequest;g.timeout=5e3,g.addEventListener("abort",d),g.addEventListener("error",d),g.addEventListener("timeout",d),g.addEventListener("load",function(w){window.location.href=v||"/"}),g.open("GET",v+"/is-alive",!0),g.send()}async function f(v){l(3,u=!0);const d=new FormData(v.target),g=new URLSearchParams;for(let M of d){const[P,L]=M;g.append(P,L)}let T=await(await fetch("/save",{method:"POST",body:g})).json();l(3,u=!1),Wt.update(M=>(M.hostname=d.get("sh"),M.usrcfg=T.success,M.booting=T.reboot,i&&(M.net.ip=d.get("si"),M.net.mask=d.get("su"),M.net.gw=d.get("sg"),M.net.dns1=d.get("sd")),setTimeout(c,5e3),M))}function _(){o=tt(this),l(2,o)}function p(){n.hostname=this.value,l(0,n)}function b(){i=this.checked,l(1,i)}return t.$$set=v=>{"sysinfo"in v&&l(0,n=v.sysinfo)},[n,i,o,u,f,_,p,b]}class tp extends Ie{constructor(e){super(),Re(this,e,ep,x_,Ee,{sysinfo:0})}}function lp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T;return d=new kt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=E("Upload "),o=E(t[1]),u=h(),a=m("p"),a.textContent="Select a suitable file and click upload",c=h(),f=m("form"),_=m("input"),p=h(),b=m("div"),b.innerHTML='<button type="submit" class="btn-pri">Upload</button>',v=h(),re(d.$$.fragment),r(a,"class","mb-4"),r(_,"name","file"),r(_,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(M,P){S(M,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,u),s(l,a),s(l,c),s(l,f),s(f,_),s(f,p),s(f,b),S(M,v,P),ie(d,M,P),g=!0,w||(T=te(f,"submit",t[3]),w=!0)},p(M,[P]){(!g||P&2)&&J(o,M[1]),(!g||P&1)&&r(f,"action",M[0]);const L={};P&4&&(L.active=M[2]),d.$set(L)},i(M){g||(O(d.$$.fragment,M),g=!0)},o(M){q(d.$$.fragment,M),g=!1},d(M){M&&$(e),M&&$(v),se(d,M),w=!1,T()}}}function np(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const u=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,u]}class Co extends Ie{constructor(e){super(),Re(this,e,np,lp,Ee,{action:0,title:1})}}function ip(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G;return U=new kt({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(),u=m("hr"),a=h(),c=m("div"),f=E("Enable one-click upgrade? (implies data collection)"),_=m("br"),p=h(),b=m("a"),v=E("Read more"),d=m("br"),g=h(),w=m("label"),T=m("input"),P=E(" Yes"),L=m("label"),I=m("input"),C=E(" No"),R=m("br"),ne=h(),H=m("div"),H.innerHTML='<button type="submit" class="btn-pri">Save</button>',z=h(),re(U.$$.fragment),r(b,"href",It("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r(T,"type","radio"),r(T,"name","sf"),T.value=1,T.checked=M=t[0].fwconsent===1,r(T,"class","rounded m-2"),T.required=!0,r(I,"type","radio"),r(I,"name","sf"),I.value=2,I.checked=F=t[0].fwconsent===2,r(I,"class","rounded m-2"),I.required=!0,r(c,"class","my-3"),r(H,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(X,Y){S(X,e,Y),s(e,l),s(l,n),s(n,i),s(n,o),s(n,u),s(n,a),s(n,c),s(c,f),s(c,_),s(c,p),s(c,b),s(b,v),s(c,d),s(c,g),s(c,w),s(w,T),s(w,P),s(c,L),s(L,I),s(L,C),s(c,R),s(n,ne),s(n,H),S(X,z,Y),ie(U,X,Y),K=!0,Q||(G=te(n,"submit",wi(t[2])),Q=!0)},p(X,[Y]){(!K||Y&1&&M!==(M=X[0].fwconsent===1))&&(T.checked=M),(!K||Y&1&&F!==(F=X[0].fwconsent===2))&&(I.checked=F);const j={};Y&2&&(j.active=X[1]),U.$set(j)},i(X){K||(O(U.$$.fragment,X),K=!0)},o(X){q(U.$$.fragment,X),K=!1},d(X){X&&$(e),X&&$(z),se(U,X),Q=!1,G()}}}function sp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(u){l(1,i=!0);const a=new FormData(u.target),c=new URLSearchParams;for(let p of a){const[b,v]=p;c.append(b,v)}let _=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Wt.update(p=>(p.fwconsent=a.sf===!0?1:a.sf===!1?2:0,p.booting=_.reboot,p)),fn("/")}return t.$$set=u=>{"sysinfo"in u&&l(0,n=u.sysinfo)},[n,i,o]}class op extends Ie{constructor(e){super(),Re(this,e,sp,ip,Ee,{sysinfo:0})}}function Zf(t,e,l){const n=t.slice();return n[17]=e[l],n[18]=e,n[19]=l,n}function Jf(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function xf(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function ec(t,e,l){const n=t.slice();return n[20]=e[l],n[22]=l,n}function tc(t){let e,l,n=t[0].o,i=[];for(let u=0;u<n.length;u+=1)i[u]=sc(Zf(t,n,u));const o=u=>q(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;u<i.length;u+=1)i[u].c();e=Ke()},m(u,a){for(let c=0;c<i.length;c+=1)i[c]&&i[c].m(u,a);S(u,e,a),l=!0},p(u,a){if(a&169){n=u[0].o;let c;for(c=0;c<n.length;c+=1){const f=Zf(u,n,c);i[c]?(i[c].p(f,a),O(i[c],1)):(i[c]=sc(f),i[c].c(),O(i[c],1),i[c].m(e.parentNode,e))}for(Ae(),c=n.length;c<i.length;c+=1)o(c);Pe()}},i(u){if(!l){for(let a=0;a<n.length;a+=1)O(i[a]);l=!0}},o(u){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)q(i[a]);l=!1},d(u){dt(i,u),u&&$(e)}}}function lc(t){let e,l=t[3][t[22]]+"",n,i,o,u;function a(){return t[12](t[17],t[22],t[18],t[19])}return{c(){e=m("span"),n=E(l),r(e,"class",i=t[17].a.includes(t[22])?"bd-on":"bd-off")},m(c,f){S(c,e,f),s(e,n),o||(u=te(e,"click",a),o=!0)},p(c,f){t=c,f&1&&i!==(i=t[17].a.includes(t[22])?"bd-on":"bd-off")&&r(e,"class",i)},d(c){c&&$(e),o=!1,u()}}}function nc(t){let e,l=t[22].toString().padStart(2,"0")+"",n,i,o,u;function a(){return t[13](t[17],t[22],t[18],t[19])}return{c(){e=m("span"),n=E(l),r(e,"class",i=t[17].h.includes(t[22])?"bd-on":"bd-off")},m(c,f){S(c,e,f),s(e,n),o||(u=te(e,"click",a),o=!0)},p(c,f){t=c,f&1&&i!==(i=t[17].h.includes(t[22])?"bd-on":"bd-off")&&r(e,"class",i)},d(c){c&&$(e),o=!1,u()}}}function ic(t){let e,l=(t[22]+12).toString().padStart(2,"0")+"",n,i,o,u;function a(){return t[14](t[17],t[22],t[18],t[19])}return{c(){e=m("span"),n=E(l),r(e,"class",i=t[17].h.includes(t[22]+12)?"bd-on":"bd-off")},m(c,f){S(c,e,f),s(e,n),o||(u=te(e,"click",a),o=!0)},p(c,f){t=c,f&1&&i!==(i=t[17].h.includes(t[22]+12)?"bd-on":"bd-off")&&r(e,"class",i)},d(c){c&&$(e),o=!1,u()}}}function sc(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H,z,U,K,Q,G,X,Y,j,x,ae,ee;function V(){t[8].call(n,t[18],t[19])}function W(){t[9].call(u,t[18],t[19])}function we(){t[10].call(p,t[18],t[19])}function He(){t[11].call(w,t[18],t[19])}let Le={length:7},Se=[];for(let k=0;k<Le.length;k+=1)Se[k]=lc(ec(t,Le,k));let ye={length:12},ve=[];for(let k=0;k<ye.length;k+=1)ve[k]=nc(xf(t,ye,k));let Te={length:12},be=[];for(let k=0;k<Te.length;k+=1)be[k]=ic(Jf(t,Te,k));X=new gs({});function N(){return t[15](t[19])}function y(){return t[16](t[19])}return{c(){e=m("div"),l=m("div"),n=m("input"),i=h(),o=m("div"),u=m("select"),a=m("option"),a.textContent="Import",c=m("option"),c.textContent="Export",f=m("option"),f.textContent="Both",_=h(),p=m("select"),b=m("option"),b.textContent="Fixed",v=m("option"),v.textContent="+",d=m("option"),d.textContent="%",g=h(),w=m("input"),T=h(),M=m("div"),P=m("span"),P.textContent="Days:",L=h(),I=m("div");for(let k=0;k<Se.length;k+=1)Se[k].c();F=h(),C=m("div"),R=m("span"),R.textContent="Hours:",ne=h(),H=m("div");for(let k=0;k<ve.length;k+=1)ve[k].c();z=h(),U=m("div");for(let k=0;k<be.length;k+=1)be[k].c();K=h(),Q=m("div"),G=m("span"),re(X.$$.fragment),Y=h(),j=m("hr"),r(n,"name","n"),r(n,"type","text"),r(n,"class","in-s"),r(l,"class","mr-3"),a.__value=1,a.value=a.__value,c.__value=2,c.value=c.__value,f.__value=3,f.value=f.__value,r(u,"name","rd"),r(u,"class","in-f"),t[17].d===void 0&&We(W),b.__value=0,b.value=b.__value,v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,r(p,"name","rt"),r(p,"class","in-m"),t[17].t===void 0&&We(we),r(w,"name","rv"),r(w,"type","number"),r(w,"class","in-l tr"),co(w,"width","100px"),r(w,"min","0.01"),r(w,"max","65.53"),r(w,"step","0.01"),r(o,"class","flex mr-3"),r(P,"class","mr-2"),r(M,"class","flex flex-wrap mr-3"),r(R,"class","mr-2"),r(C,"class","flex flex-wrap"),r(G,"class","text-red-500 text-xs"),r(Q,"class","mt-1.5 ml-3"),r(e,"class","flex flex-wrap"),r(j,"class","m-3")},m(k,A){S(k,e,A),s(e,l),s(l,n),oe(n,t[17].n),s(e,i),s(e,o),s(o,u),s(u,a),s(u,c),s(u,f),$e(u,t[17].d,!0),s(o,_),s(o,p),s(p,b),s(p,v),s(p,d),$e(p,t[17].t,!0),s(o,g),s(o,w),oe(w,t[17].v),s(e,T),s(e,M),s(M,P),s(M,L),s(M,I);for(let D=0;D<Se.length;D+=1)Se[D]&&Se[D].m(I,null);s(e,F),s(e,C),s(C,R),s(C,ne),s(C,H);for(let D=0;D<ve.length;D+=1)ve[D]&&ve[D].m(H,null);s(C,z),s(C,U);for(let D=0;D<be.length;D+=1)be[D]&&be[D].m(U,null);s(e,K),s(e,Q),s(Q,G),ie(X,G,null),S(k,Y,A),S(k,j,A),x=!0,ae||(ee=[te(n,"input",V),te(u,"change",W),te(p,"change",we),te(w,"input",He),te(G,"click",N),te(G,"keypress",y)],ae=!0)},p(k,A){if(t=k,A&1&&n.value!==t[17].n&&oe(n,t[17].n),A&1&&$e(u,t[17].d),A&1&&$e(p,t[17].t),A&1&&ge(w.value)!==t[17].v&&oe(w,t[17].v),A&41){Le={length:7};let D;for(D=0;D<Le.length;D+=1){const Z=ec(t,Le,D);Se[D]?Se[D].p(Z,A):(Se[D]=lc(Z),Se[D].c(),Se[D].m(I,null))}for(;D<Se.length;D+=1)Se[D].d(1);Se.length=Le.length}if(A&33){ye={length:12};let D;for(D=0;D<ye.length;D+=1){const Z=xf(t,ye,D);ve[D]?ve[D].p(Z,A):(ve[D]=nc(Z),ve[D].c(),ve[D].m(H,null))}for(;D<ve.length;D+=1)ve[D].d(1);ve.length=ye.length}if(A&33){Te={length:12};let D;for(D=0;D<Te.length;D+=1){const Z=Jf(t,Te,D);be[D]?be[D].p(Z,A):(be[D]=ic(Z),be[D].c(),be[D].m(U,null))}for(;D<be.length;D+=1)be[D].d(1);be.length=Te.length}},i(k){x||(O(X.$$.fragment,k),x=!0)},o(k){q(X.$$.fragment,k),x=!1},d(k){k&&$(e),dt(Se,k),dt(ve,k),dt(be,k),se(X),k&&$(Y),k&&$(j),ae=!1,ze(ee)}}}function rp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F,C,R,ne,H;o=new Rt({});let z=t[0].o&&tc(t);return I=new kt({props:{active:t[1],message:"Loading configuration"}}),C=new kt({props:{active:t[2],message:"Saving configuration"}}),{c(){e=m("div"),l=m("strong"),l.textContent="Price configuration",n=h(),i=m("a"),re(o.$$.fragment),u=h(),a=m("hr"),c=h(),f=m("form"),_=m("input"),p=h(),z&&z.c(),b=h(),v=m("div"),d=m("div"),g=m("button"),g.textContent="Add",w=h(),T=m("div"),M=h(),P=m("div"),P.innerHTML='<button type="submit" class="btn-pri">Save</button>',L=h(),re(I.$$.fragment),F=h(),re(C.$$.fragment),r(l,"class","text-sm"),r(i,"href",It("Price-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(a,"class","m-3"),r(_,"type","hidden"),r(_,"name","r"),_.value="true",r(g,"type","button"),r(g,"class","btn-pri"),r(T,"class","text-center"),r(P,"class","text-right"),r(v,"class","grid grid-cols-3"),r(f,"autocomplete","off"),r(e,"class","cnt")},m(U,K){S(U,e,K),s(e,l),s(e,n),s(e,i),ie(o,i,null),s(e,u),s(e,a),s(e,c),s(e,f),s(f,_),s(f,p),z&&z.m(f,null),s(f,b),s(f,v),s(v,d),s(d,g),s(v,w),s(v,T),s(v,M),s(v,P),S(U,L,K),ie(I,U,K),S(U,F,K),ie(C,U,K),R=!0,ne||(H=[te(g,"click",t[6]),te(f,"submit",wi(t[4]))],ne=!0)},p(U,[K]){U[0].o?z?(z.p(U,K),K&1&&O(z,1)):(z=tc(U),z.c(),O(z,1),z.m(f,b)):z&&(Ae(),q(z,1,1,()=>{z=null}),Pe());const Q={};K&2&&(Q.active=U[1]),I.$set(Q);const G={};K&4&&(G.active=U[2]),C.$set(G)},i(U){R||(O(o.$$.fragment,U),O(z),O(I.$$.fragment,U),O(C.$$.fragment,U),R=!0)},o(U){q(o.$$.fragment,U),q(z),q(I.$$.fragment,U),q(C.$$.fragment,U),R=!1},d(U){U&&$(e),se(o),z&&z.d(),U&&$(L),se(I,U),U&&$(F),se(C,U),ne=!1,ze(H)}}}function ap(t,e,l){let n=["mo","tu","we","th","fr","sa","su"],i={},o=!0,u=!1;e1.subscribe(L=>{L.o&&(l(0,i=L),l(1,o=!1))}),Zm();async function a(L){l(2,u=!0);const I=new URLSearchParams;I.append("r","true"),I.append("rc",i.o.length),i.o.forEach(function(C,R){I.append("rt"+R,C.t),I.append("rn"+R,C.n),I.append("rd"+R,C.d),I.append("ra"+R,C.a),I.append("rh"+R,C.h),I.append("rv"+R,C.v)}),await(await fetch("/save",{method:"POST",body:I})).json(),l(2,u=!1),fn("/configuration")}let c=function(L,I){return L.includes(I)?L=L.filter(function(F){return F!==I}):L.push(I),L},f=function(){let L=i.o;L.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.01}),l(0,i.o=L,i)},_=function(L){let I=i.o;I.splice(L,1),l(0,i.o=I,i)};function p(L,I){L[I].n=this.value,l(0,i)}function b(L,I){L[I].d=tt(this),l(0,i)}function v(L,I){L[I].t=tt(this),l(0,i)}function d(L,I){L[I].v=ge(this.value),l(0,i)}return[i,o,u,n,a,c,f,_,p,b,v,d,(L,I,F,C)=>l(0,F[C].a=c(L.a,I),i),(L,I,F,C)=>l(0,F[C].h=c(L.h,I),i),(L,I,F,C)=>l(0,F[C].h=c(L.h,I+12),i),L=>_(L),L=>_(L)]}class up extends Ie{constructor(e){super(),Re(this,e,ap,rp,Ee,{})}}function fp(t){let e,l;return e=new Qm({props:{data:t[1],sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function cp(t){let e,l;return e=new I_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function mp(t){let e,l;return e=new up({}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function _p(t){let e,l;return e=new V_({props:{sysinfo:t[0],data:t[1]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function pp(t){let e,l;return e=new Co({props:{title:"CA",action:"/mqtt-ca"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function dp(t){let e,l;return e=new Co({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function vp(t){let e,l;return e=new Co({props:{title:"private key",action:"/mqtt-key"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function hp(t){let e,l;return e=new op({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function bp(t){let e,l;return e=new tp({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function gp(t){let e,l;return e=new J_({props:{sysinfo:t[0]}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function kp(t){let e,l,n,i,o,u,a,c,f,_,p,b,v,d,g,w,T,M,P,L,I,F;return e=new sm({props:{data:t[1]}}),n=new ml({props:{path:"/",$$slots:{default:[fp]},$$scope:{ctx:t}}}),o=new ml({props:{path:"/configuration",$$slots:{default:[cp]},$$scope:{ctx:t}}}),a=new ml({props:{path:"/priceconfig",$$slots:{default:[mp]},$$scope:{ctx:t}}}),f=new ml({props:{path:"/status",$$slots:{default:[_p]},$$scope:{ctx:t}}}),p=new ml({props:{path:"/mqtt-ca",$$slots:{default:[pp]},$$scope:{ctx:t}}}),v=new ml({props:{path:"/mqtt-cert",$$slots:{default:[dp]},$$scope:{ctx:t}}}),g=new ml({props:{path:"/mqtt-key",$$slots:{default:[vp]},$$scope:{ctx:t}}}),T=new ml({props:{path:"/consent",$$slots:{default:[hp]},$$scope:{ctx:t}}}),P=new ml({props:{path:"/setup",$$slots:{default:[bp]},$$scope:{ctx:t}}}),I=new ml({props:{path:"/vendor",$$slots:{default:[gp]},$$scope:{ctx:t}}}),{c(){re(e.$$.fragment),l=h(),re(n.$$.fragment),i=h(),re(o.$$.fragment),u=h(),re(a.$$.fragment),c=h(),re(f.$$.fragment),_=h(),re(p.$$.fragment),b=h(),re(v.$$.fragment),d=h(),re(g.$$.fragment),w=h(),re(T.$$.fragment),M=h(),re(P.$$.fragment),L=h(),re(I.$$.fragment)},m(C,R){ie(e,C,R),S(C,l,R),ie(n,C,R),S(C,i,R),ie(o,C,R),S(C,u,R),ie(a,C,R),S(C,c,R),ie(f,C,R),S(C,_,R),ie(p,C,R),S(C,b,R),ie(v,C,R),S(C,d,R),ie(g,C,R),S(C,w,R),ie(T,C,R),S(C,M,R),ie(P,C,R),S(C,L,R),ie(I,C,R),F=!0},p(C,R){const ne={};R&2&&(ne.data=C[1]),e.$set(ne);const H={};R&7&&(H.$$scope={dirty:R,ctx:C}),n.$set(H);const z={};R&5&&(z.$$scope={dirty:R,ctx:C}),o.$set(z);const U={};R&4&&(U.$$scope={dirty:R,ctx:C}),a.$set(U);const K={};R&7&&(K.$$scope={dirty:R,ctx:C}),f.$set(K);const Q={};R&4&&(Q.$$scope={dirty:R,ctx:C}),p.$set(Q);const G={};R&4&&(G.$$scope={dirty:R,ctx:C}),v.$set(G);const X={};R&4&&(X.$$scope={dirty:R,ctx:C}),g.$set(X);const Y={};R&5&&(Y.$$scope={dirty:R,ctx:C}),T.$set(Y);const j={};R&5&&(j.$$scope={dirty:R,ctx:C}),P.$set(j);const x={};R&5&&(x.$$scope={dirty:R,ctx:C}),I.$set(x)},i(C){F||(O(e.$$.fragment,C),O(n.$$.fragment,C),O(o.$$.fragment,C),O(a.$$.fragment,C),O(f.$$.fragment,C),O(p.$$.fragment,C),O(v.$$.fragment,C),O(g.$$.fragment,C),O(T.$$.fragment,C),O(P.$$.fragment,C),O(I.$$.fragment,C),F=!0)},o(C){q(e.$$.fragment,C),q(n.$$.fragment,C),q(o.$$.fragment,C),q(a.$$.fragment,C),q(f.$$.fragment,C),q(p.$$.fragment,C),q(v.$$.fragment,C),q(g.$$.fragment,C),q(T.$$.fragment,C),q(P.$$.fragment,C),q(I.$$.fragment,C),F=!1},d(C){se(e,C),C&&$(l),se(n,C),C&&$(i),se(o,C),C&&$(u),se(a,C),C&&$(c),se(f,C),C&&$(_),se(p,C),C&&$(b),se(v,C),C&&$(d),se(g,C),C&&$(w),se(T,C),C&&$(M),se(P,C),C&&$(L),se(I,C)}}}function wp(t){let e,l,n,i;const o=[$p,Cp],u=[];function a(c,f){return c[0].trying?0:1}return e=a(t),l=u[e]=o[e](t),{c(){l.c(),n=Ke()},m(c,f){u[e].m(c,f),S(c,n,f),i=!0},p(c,f){let _=e;e=a(c),e===_?u[e].p(c,f):(Ae(),q(u[_],1,1,()=>{u[_]=null}),Pe(),l=u[e],l?l.p(c,f):(l=u[e]=o[e](c),l.c()),O(l,1),l.m(n.parentNode,n))},i(c){i||(O(l),i=!0)},o(c){q(l),i=!1},d(c){u[e].d(c),c&&$(n)}}}function yp(t){let e,l;return e=new kt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Cp(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p:pe,i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function $p(t){let e,l;return e=new kt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){re(e.$$.fragment)},m(n,i){ie(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(O(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){se(e,n)}}}function Sp(t){let e,l,n,i,o,u;l=new Rc({props:{$$slots:{default:[kp]},$$scope:{ctx:t}}});const a=[yp,wp],c=[];function f(_,p){return _[0].upgrading?0:_[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=a[i](t)),{c(){e=m("div"),re(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(_,p){S(_,e,p),ie(l,e,null),s(e,n),~i&&c[i].m(e,null),u=!0},p(_,[p]){const b={};p&7&&(b.$$scope={dirty:p,ctx:_}),l.$set(b);let v=i;i=f(_),i===v?~i&&c[i].p(_,p):(o&&(Ae(),q(c[v],1,1,()=>{c[v]=null}),Pe()),~i?(o=c[i],o?o.p(_,p):(o=c[i]=a[i](_),o.c()),O(o,1),o.m(e,null)):o=null)},i(_){u||(O(l.$$.fragment,_),O(o),u=!0)},o(_){q(l.$$.fragment,_),q(o),u=!1},d(_){_&&$(e),se(l),~i&&c[i].d()}}}function Mp(t,e,l){let n={};Wt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?fn("/vendor"):n.usrcfg===!1?fn("/setup"):n.fwconsent===0&&fn("/consent"),n.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):n.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),bo();let i={};return Bc.subscribe(o=>{l(1,i=o)}),[n,i]}class Tp extends Ie{constructor(e){super(),Re(this,e,Mp,Sp,Ee,{})}}new Tp({target:document.getElementById("app")});