Files
UtilitechAS.amsreader-firmware/lib/SvelteUi/app/dist/index.js
2023-07-05 23:49:53 +02:00

15 lines
179 KiB
JavaScript

(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const r of o.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerpolicy&&(o.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?o.credentials="include":i.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function ne(){}function Jt(t,e){for(const l in e)t[l]=e[l];return t}function Qf(t){return t()}function Er(){return Object.create(null)}function Ve(t){t.forEach(Qf)}function Xf(t){return typeof t=="function"}function ke(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ms;function Bc(t,e){return ms||(ms=document.createElement("a")),ms.href=e,t===ms.href}function zc(t){return Object.keys(t).length===0}function ao(t,...e){if(t==null)return ne;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function oi(t){let e;return ao(t,l=>e=l)(),e}function rl(t,e,l){t.$$.on_destroy.push(ao(e,l))}function fo(t,e,l,n){if(t){const i=Zf(t,e,l,n);return t[0](i)}}function Zf(t,e,l,n){return t[1]&&n?Jt(l.ctx.slice(),t[1](n(e))):l.ctx}function co(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],r=Math.max(e.dirty.length,i.length);for(let a=0;a<r;a+=1)o[a]=e.dirty[a]|i[a];return o}return e.dirty|i}return e.dirty}function mo(t,e,l,n,i,o){if(i){const r=Zf(e,l,n,o);t.p(r,i)}}function po(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 gs(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function ks(t,e){const l={};e=new Set(e);for(const n in t)!e.has(n)&&n[0]!=="$"&&(l[n]=t[n]);return l}function s(t,e){t.appendChild(e)}function y(t,e,l){t.insertBefore(e,l||null)}function w(t){t.parentNode.removeChild(t)}function ml(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 Oe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function C(t){return document.createTextNode(t)}function h(){return C(" ")}function We(){return C("")}function K(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function Ts(t){return function(e){return e.preventDefault(),t.call(this,e)}}function u(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}function al(t,e){const l=Object.getOwnPropertyDescriptors(t.__proto__);for(const n in e)e[n]==null?t.removeAttribute(n):n==="style"?t.style.cssText=e[n]:n==="__value"?t.value=t[n]=e[n]:l[n]&&l[n].set?t[n]=e[n]:u(t,n,e[n])}function ae(t){return t===""?null:+t}function Yc(t){return Array.from(t.childNodes)}function B(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function V(t,e){t.value=e==null?"":e}function Jf(t,e,l,n){l===null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function Re(t,e){for(let l=0;l<t.options.length;l+=1){const n=t.options[l];if(n.__value===e){n.selected=!0;return}}t.selectedIndex=-1}function mt(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let ps;function Vc(){if(ps===void 0){ps=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{ps=!0}}return ps}function Kc(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=Vc();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=K(window,"message",r=>{r.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=K(n.contentWindow,"resize",e)}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),w(n)}}function Qc(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}let yi;function ki(t){yi=t}function Ci(){if(!yi)throw new Error("Function called outside component initialization");return yi}function Xc(t){Ci().$$.on_mount.push(t)}function Zc(t){Ci().$$.on_destroy.push(t)}function Jc(){const t=Ci();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=Qc(e,l,{cancelable:n});return i.slice().forEach(r=>{r.call(t,o)}),!o.defaultPrevented}return!0}}function wi(t,e){return Ci().$$.context.set(t,e),e}function ql(t){return Ci().$$.context.get(t)}const bi=[],ws=[],hs=[],Fr=[],xf=Promise.resolve();let Zs=!1;function ec(){Zs||(Zs=!0,xf.then(tc))}function xc(){return ec(),xf}function tt(t){hs.push(t)}const zs=new Set;let _s=0;function tc(){const t=yi;do{for(;_s<bi.length;){const e=bi[_s];_s++,ki(e),e1(e.$$)}for(ki(null),bi.length=0,_s=0;ws.length;)ws.pop()();for(let e=0;e<hs.length;e+=1){const l=hs[e];zs.has(l)||(zs.add(l),l())}hs.length=0}while(bi.length);for(;Fr.length;)Fr.pop()();Zs=!1,zs.clear(),ki(t)}function e1(t){if(t.fragment!==null){t.update(),Ve(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(tt)}}const bs=new Set;let un;function Te(){un={r:0,c:[],p:un}}function Se(){un.r||Ve(un.c),un=un.p}function N(t,e){t&&t.i&&(bs.delete(t),t.i(e))}function D(t,e,l,n){if(t&&t.o){if(bs.has(t))return;bs.add(t),un.c.push(()=>{bs.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function ui(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const r=t[o],a=e[o];if(a){for(const f in r)f in a||(n[f]=1);for(const f in a)i[f]||(l[f]=a[f],i[f]=1);t[o]=a}else for(const f in r)i[f]=1}for(const r in n)r in l||(l[r]=void 0);return l}function Rr(t){return typeof t=="object"&&t!==null?t:{}}function J(t){t&&t.c()}function X(t,e,l,n){const{fragment:i,on_mount:o,on_destroy:r,after_update:a}=t.$$;i&&i.m(e,l),n||tt(()=>{const f=o.map(Qf).filter(Xf);r?r.push(...f):Ve(f),t.$$.on_mount=[]}),a.forEach(tt)}function Z(t,e){const l=t.$$;l.fragment!==null&&(Ve(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function t1(t,e){t.$$.dirty[0]===-1&&(bi.push(t),ec(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function ye(t,e,l,n,i,o,r,a=[-1]){const f=yi;ki(t);const c=t.$$={fragment:null,ctx:null,props:o,update:ne,not_equal:i,bound:Er(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:Er(),dirty:a,skip_bound:!1,root:e.target||f.$$.root};r&&r(c.root);let p=!1;if(c.ctx=l?l(t,e.props||{},(_,b,...d)=>{const v=d.length?d[0]:b;return c.ctx&&i(c.ctx[_],c.ctx[_]=v)&&(!c.skip_bound&&c.bound[_]&&c.bound[_](v),p&&t1(t,_)),b}):[],c.update(),p=!0,Ve(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const _=Yc(e.target);c.fragment&&c.fragment.l(_),_.forEach(w)}else c.fragment&&c.fragment.c();e.intro&&N(t.$$.fragment),X(t,e.target,e.anchor,e.customElement),tc()}ki(f)}class Ce{$destroy(){Z(this,1),this.$destroy=ne}$on(e,l){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(l),()=>{const i=n.indexOf(l);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!zc(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Lr=t=>typeof t>"u",lc=t=>typeof t=="function",nc=t=>typeof t=="number";function l1(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ic(){let t=0;return()=>t++}function n1(){return Math.random().toString(36).substring(2)}const Hl=typeof window>"u";function sc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const Js=(t,e)=>t?{}:{style:e},ni=t=>({"aria-hidden":"true",...Js(t,"display:none;")}),li=[];function oc(t,e){return{subscribe:rt(t,e).subscribe}}function rt(t,e=ne){let l;const n=new Set;function i(a){if(ke(t,a)&&(t=a,l)){const f=!li.length;for(const c of n)c[1](),li.push(c,t);if(f){for(let c=0;c<li.length;c+=2)li[c][0](li[c+1]);li.length=0}}}function o(a){i(a(t))}function r(a,f=ne){const c=[a,f];return n.add(c),n.size===1&&(l=e(i)||ne),a(t),()=>{n.delete(c),n.size===0&&(l(),l=null)}}return{set:i,update:o,subscribe:r}}function i1(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return oc(l,r=>{let a=!1;const f=[];let c=0,p=ne;const _=()=>{if(c)return;p();const d=e(n?f[0]:f,r);o?r(d):p=Xf(d)?d:ne},b=i.map((d,v)=>ao(d,g=>{f[v]=g,c&=~(1<<v),a&&_()},()=>{c|=1<<v}));return a=!0,_(),function(){Ve(b),p()}})}const $i=t=>`@@svnav-ctx__${t}`,xs=$i("LOCATION"),ri=$i("ROUTER"),uc=$i("ROUTE"),s1=$i("ROUTE_PARAMS"),o1=$i("FOCUS_ELEM"),rc=/^:(.+)/,gi=(t,e,l)=>t.substr(e,l),eo=(t,e)=>gi(t,0,e.length)===e,u1=t=>t==="",r1=t=>rc.test(t),ac=t=>t[0]==="*",a1=t=>t.replace(/\*.*$/,""),fc=t=>t.replace(/(^\/+|\/+$)/g,"");function pl(t,e=!1){const l=fc(t).split("/");return e?l.filter(Boolean):l}const Ys=(t,e)=>t+(e?`?${e}`:""),_o=t=>`/${fc(t)}`;function Ti(...t){const e=n=>pl(n,!0).join("/"),l=t.map(e).join("/");return _o(l)}const vo=1,Ss=2,cn=3,f1=4,cc=5,c1=6,mc=7,m1=8,p1=9,pc=10,_c=11,_1={[vo]:"Link",[Ss]:"Route",[cn]:"Router",[f1]:"useFocus",[cc]:"useLocation",[c1]:"useMatch",[mc]:"useNavigate",[m1]:"useParams",[p1]:"useResolvable",[pc]:"useResolve",[_c]:"navigate"},ho=t=>_1[t];function d1(t,e){let l;return t===Ss?l=e.path?`path="${e.path}"`:"default":t===vo?l=`to="${e.to}"`:t===cn&&(l=`basepath="${e.basepath||""}"`),`<${ho(t)} ${l||""} />`}function v1(t,e,l,n){const i=l&&d1(n||t,l),o=i?`
Occurred in: ${i}`:"",r=ho(t),a=lc(e)?e(r):e;return`<${r}> ${a}${o}`}const dc=t=>(...e)=>t(v1(...e)),vc=dc(t=>{throw new Error(t)}),ys=dc(console.warn),Ur=4,h1=3,b1=2,g1=1,k1=1;function w1(t,e){const l=t.default?0:pl(t.fullPath).reduce((n,i)=>{let o=n;return o+=Ur,u1(i)?o+=k1:r1(i)?o+=b1:ac(i)?o-=Ur+g1:o+=h1,o},0);return{route:t,score:l,index:e}}function y1(t){return t.map(w1).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function hc(t,e){let l,n;const[i]=e.split("?"),o=pl(i),r=o[0]==="",a=y1(t);for(let f=0,c=a.length;f<c;f++){const{route:p}=a[f];let _=!1;const b={},d=$=>({...p,params:b,uri:$});if(p.default){n=d(e);continue}const v=pl(p.fullPath),g=Math.max(o.length,v.length);let k=0;for(;k<g;k++){const $=v[k],T=o[k];if(!Lr($)&&ac($)){const I=$==="*"?"*":$.slice(1);b[I]=o.slice(k).map(decodeURIComponent).join("/");break}if(Lr(T)){_=!0;break}const P=rc.exec($);if(P&&!r){const I=decodeURIComponent(T);b[P[1]]=I}else if($!==T){_=!0;break}}if(!_){l=d(Ti(...o.slice(0,k)));break}}return l||n||null}function bc(t,e){return hc([t],e)}function C1(t,e){if(eo(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=pl(l),r=pl(i);if(o[0]==="")return Ys(i,n);if(!eo(o[0],".")){const c=r.concat(o).join("/");return Ys((i==="/"?"":"/")+c,n)}const a=r.concat(o),f=[];return a.forEach(c=>{c===".."?f.pop():c!=="."&&f.push(c)}),Ys(`/${f.join("/")}`,n)}function Or(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,r=pl(e,!0),a=pl(l,!0);for(;r.length;)r[0]!==a[0]&&vc(cn,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),r.shift(),a.shift();return{pathname:Ti(...a),hash:n,search:i,state:o}}const qr=t=>t.length===1?"":t,bo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?qr(gi(t,l)):"",r=i?gi(t,0,l):t,a=n?qr(gi(r,e)):"";return{pathname:(n?gi(r,0,e):r)||"/",search:a,hash:o}},$1=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function T1(t,e,l){return Ti(l,C1(t,e))}function S1(t,e){const l=_o(a1(t)),n=pl(l,!0),i=pl(e,!0).slice(0,n.length),o=bc({fullPath:l},Ti(...i));return o&&o.uri}const Vs="POP",P1="PUSH",N1="REPLACE";function Ks(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function M1(t){let e=[],l=Ks(t),n=Vs;const i=(o=e)=>o.forEach(r=>r({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const r=()=>{l=Ks(t),n=Vs,i([o])};i([o]);const a=sc(t,"popstate",r);return()=>{a(),e=e.filter(f=>f!==o)}},navigate(o,r){const{state:a={},replace:f=!1}=r||{};if(n=f?N1:P1,nc(o))r&&ys(_c,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Vs,t.history.go(o);else{const c={...a,_key:n1()};try{t.history[f?"replaceState":"pushState"](c,"",o)}catch{t.location[f?"replace":"assign"](o)}}l=Ks(t),i()}}}function Qs(t,e){return{...bo(e),state:t}}function A1(t="/"){let e=0,l=[Qs(null,t)];return{get entries(){return l},get location(){return l[e]},addEventListener(){},removeEventListener(){},history:{get state(){return l[e].state},pushState(n,i,o){e++,l=l.slice(0,e),l.push(Qs(n,o))},replaceState(n,i,o){l[e]=Qs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const D1=!!(!Hl&&window.document&&window.document.createElement),I1=!Hl&&window.location.origin==="null",gc=M1(D1&&!I1?window:A1()),{navigate:ii}=gc;let Pl=null,kc=!0;function E1(t,e){const l=document.querySelectorAll("[data-svnav-router]");for(let n=0;n<l.length;n++){const i=l[n],o=Number(i.dataset.svnavRouter);if(o===t)return!0;if(o===e)return!1}return!1}function F1(t){(!Pl||t.level>Pl.level||t.level===Pl.level&&E1(t.routerId,Pl.routerId))&&(Pl=t)}function R1(){Pl=null}function L1(){kc=!1}function Hr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=sc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function U1(t,e){return Number(t.dataset.svnavRouteEnd)===e}function O1(t){return/^H[1-6]$/i.test(t.tagName)}function jr(t,e=document){return e.querySelector(t)}function q1(t){let l=jr(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!U1(l,t);){if(O1(l))return l;const n=jr("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function H1(t){Promise.resolve(oi(t.focusElement)).then(e=>{const l=e||q1(t.id);l||ys(cn,`Could not find an element to focus. You should always render a header for accessibility reasons, or set a custom focus element via the "useFocus" hook. If you don't want this Route or Router to manage focus, pass "primary={false}" to it.`,t,Ss),!Hr(l)&&Hr(document.documentElement)})}const j1=(t,e,l)=>(n,i)=>xc().then(()=>{if(!Pl||kc){L1();return}if(n&&H1(Pl.route),t.announcements&&i){const{path:o,fullPath:r,meta:a,params:f,uri:c}=Pl.route,p=t.createAnnouncement({path:o,fullPath:r,meta:a,params:f,uri:c},oi(l));Promise.resolve(p).then(_=>{e.set(_)})}R1()}),Wr="position:fixed;top:-1px;left:0;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;";function W1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Js(t[6],Wr)],i={};for(let o=0;o<n.length;o+=1)i=Jt(i,n[o]);return{c(){e=m("div"),l=C(t[0]),al(e,i)},m(o,r){y(o,e,r),s(e,l)},p(o,r){r[0]&1&&B(l,o[0]),al(e,i=ui(n,[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},Js(o[6],Wr)]))},d(o){o&&w(e)}}}function G1(t){let e,l,n,i,o,r=[ni(t[6]),{"data-svnav-router":t[3]}],a={};for(let _=0;_<r.length;_+=1)a=Jt(a,r[_]);const f=t[22].default,c=fo(f,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&W1(t);return{c(){e=m("div"),l=h(),c&&c.c(),n=h(),p&&p.c(),i=We(),al(e,a)},m(_,b){y(_,e,b),y(_,l,b),c&&c.m(_,b),y(_,n,b),p&&p.m(_,b),y(_,i,b),o=!0},p(_,b){al(e,a=ui(r,[ni(_[6]),{"data-svnav-router":_[3]}])),c&&c.p&&(!o||b[0]&2097152)&&mo(c,f,_,_[21],o?co(f,_[21],b,null):po(_[21]),null),_[2]&&_[4]&&_[1].announcements&&p.p(_,b)},i(_){o||(N(c,_),o=!0)},o(_){D(c,_),o=!1},d(_){_&&w(e),_&&w(l),c&&c.d(_),_&&w(n),p&&p.d(_),_&&w(i)}}}const B1=ic(),Gr="/";function z1(t,e,l){let n,i,o,r,a,{$$slots:f={},$$scope:c}=e,{basepath:p=Gr}=e,{url:_=null}=e,{history:b=gc}=e,{primary:d=!0}=e,{a11y:v={}}=e,{disableInlineStyles:g=!1}=e;const k={createAnnouncement:le=>`Navigated to ${le.uri}`,announcements:!0,...v},$=p,T=_o(p),P=ql(xs),I=ql(ri),S=!P,A=B1(),E=d&&!(I&&!I.manageFocus),F=rt("");rl(t,F,le=>l(0,a=le));const Y=I?I.disableInlineStyles:g,U=rt([]);rl(t,U,le=>l(20,r=le));const R=rt(null);rl(t,R,le=>l(18,i=le));let q=!1;const z=S?0:I.level+1,H=S?rt((()=>Or(Hl?bo(_):b.location,T))()):P;rl(t,H,le=>l(17,n=le));const G=rt(n);rl(t,G,le=>l(19,o=le));const L=j1(k,F,H),W=le=>de=>de.filter(ie=>ie.id!==le);function j(le){if(Hl){if(q)return;const de=bc(le,n.pathname);if(de)return q=!0,de}else U.update(de=>{const ie=W(le.id)(de);return ie.push(le),ie})}function te(le){U.update(W(le))}return!S&&p!==Gr&&ys(cn,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),S&&(Xc(()=>b.listen(de=>{const ie=Or(de.location,T);G.set(n),H.set(ie)})),wi(xs,H)),wi(ri,{activeRoute:R,registerRoute:j,unregisterRoute:te,manageFocus:E,level:z,id:A,history:S?b:I.history,basepath:S?T:I.basepath,disableInlineStyles:Y}),t.$$set=le=>{"basepath"in le&&l(11,p=le.basepath),"url"in le&&l(12,_=le.url),"history"in le&&l(13,b=le.history),"primary"in le&&l(14,d=le.primary),"a11y"in le&&l(15,v=le.a11y),"disableInlineStyles"in le&&l(16,g=le.disableInlineStyles),"$$scope"in le&&l(21,c=le.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&ys(cn,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const le=hc(r,n.pathname);R.set(le)}if(t.$$.dirty[0]&655360&&S){const le=!!n.hash,de=!le&&E,ie=!le||n.pathname!==o.pathname;L(de,ie)}t.$$.dirty[0]&262144&&E&&i&&i.primary&&F1({level:z,routerId:A,route:i})},[a,k,S,A,E,F,Y,U,R,H,G,p,_,b,d,v,g,n,i,o,r,c,f]}class wc extends Ce{constructor(e){super(),ye(this,e,z1,G1,ke,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}function Si(t,e,l=ri,n=cn){ql(l)||vc(t,o=>`You cannot use ${o} outside of a ${ho(n)}.`,e)}const Y1=t=>{const{subscribe:e}=ql(t);return{subscribe:e}};function yc(){return Si(cc),Y1(xs)}function Cc(){const{history:t}=ql(ri);return t}function $c(){const t=ql(uc);return t?i1(t,e=>e.base):rt("/")}function Tc(){Si(pc);const t=$c(),{basepath:e}=ql(ri);return n=>T1(n,oi(t),e)}function V1(){Si(mc);const t=Tc(),{navigate:e}=Cc();return(n,i)=>{const o=nc(n)?n:t(n);return e(o,i)}}const K1=t=>({params:t&16,location:t&8}),Br=t=>({params:Hl?oi(t[10]):t[4],location:t[3],navigate:t[11]});function zr(t){let e,l;return e=new wc({props:{primary:t[1],$$slots:{default:[Z1]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.primary=n[1]),i&528409&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Q1(t){let e;const l=t[18].default,n=fo(l,t,t[19],Br);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&mo(n,l,i,i[19],e?co(l,i[19],o,K1):po(i[19]),Br)},i(i){e||(N(n,i),e=!0)},o(i){D(n,i),e=!1},d(i){n&&n.d(i)}}}function X1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Hl?oi(t[10]):t[4],t[12]];var o=t[0];function r(a){let f={};for(let c=0;c<i.length;c+=1)f=Jt(f,i[c]);return{props:f}}return o&&(e=new o(r())),{c(){e&&J(e.$$.fragment),l=We()},m(a,f){e&&X(e,a,f),y(a,l,f),n=!0},p(a,f){const c=f&7192?ui(i,[f&8&&{location:a[3]},f&2048&&{navigate:a[11]},f&1040&&Rr(Hl?oi(a[10]):a[4]),f&4096&&Rr(a[12])]):{};if(o!==(o=a[0])){if(e){Te();const p=e;D(p.$$.fragment,1,0,()=>{Z(p,1)}),Se()}o?(e=new o(r()),J(e.$$.fragment),N(e.$$.fragment,1),X(e,l.parentNode,l)):e=null}else o&&e.$set(c)},i(a){n||(e&&N(e.$$.fragment,a),n=!0)},o(a){e&&D(e.$$.fragment,a),n=!1},d(a){a&&w(l),e&&Z(e,a)}}}function Z1(t){let e,l,n,i;const o=[X1,Q1],r=[];function a(f,c){return f[0]!==null?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function J1(t){let e,l,n,i,o,r=[ni(t[7]),{"data-svnav-route-start":t[5]}],a={};for(let _=0;_<r.length;_+=1)a=Jt(a,r[_]);let f=t[2]&&zr(t),c=[ni(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let _=0;_<c.length;_+=1)p=Jt(p,c[_]);return{c(){e=m("div"),l=h(),f&&f.c(),n=h(),i=m("div"),al(e,a),al(i,p)},m(_,b){y(_,e,b),y(_,l,b),f&&f.m(_,b),y(_,n,b),y(_,i,b),o=!0},p(_,[b]){al(e,a=ui(r,[ni(_[7]),{"data-svnav-route-start":_[5]}])),_[2]?f?(f.p(_,b),b&4&&N(f,1)):(f=zr(_),f.c(),N(f,1),f.m(n.parentNode,n)):f&&(Te(),D(f,1,1,()=>{f=null}),Se()),al(i,p=ui(c,[ni(_[7]),{"data-svnav-route-end":_[5]}]))},i(_){o||(N(f),o=!0)},o(_){D(f),o=!1},d(_){_&&w(e),_&&w(l),f&&f.d(_),_&&w(n),_&&w(i)}}}const x1=ic();function em(t,e,l){let n;const i=["path","component","meta","primary"];let o=ks(e,i),r,a,f,c,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:d=null}=e,{meta:v={}}=e,{primary:g=!0}=e;Si(Ss,e);const k=x1(),{registerRoute:$,unregisterRoute:T,activeRoute:P,disableInlineStyles:I}=ql(ri);rl(t,P,q=>l(16,r=q));const S=$c();rl(t,S,q=>l(17,f=q));const A=yc();rl(t,A,q=>l(3,a=q));const E=rt(null);let F;const Y=rt(),U=rt({});rl(t,U,q=>l(4,c=q)),wi(uc,Y),wi(s1,U),wi(o1,E);const R=V1();return Hl||Zc(()=>T(k)),t.$$set=q=>{l(24,e=Jt(Jt({},e),gs(q))),l(12,o=ks(e,i)),"path"in q&&l(13,b=q.path),"component"in q&&l(0,d=q.component),"meta"in q&&l(14,v=q.meta),"primary"in q&&l(1,g=q.primary),"$$scope"in q&&l(19,_=q.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const q=b==="",z=Ti(f,b),O={id:k,path:b,meta:v,default:q,fullPath:q?"":z,base:q?f:S1(z,a.pathname),primary:g,focusElement:E};Y.set(O),l(15,F=$(O))}if(t.$$.dirty&98304&&l(2,n=!!(F||r&&r.id===k)),t.$$.dirty&98308&&n){const{params:q}=F||r;U.set(q)}},e=gs(e),[d,g,n,a,c,k,P,I,S,A,U,R,o,b,v,F,r,f,p,_]}class Sl extends Ce{constructor(e){super(),ye(this,e,em,J1,ke,{path:13,component:0,meta:14,primary:1})}}function tm(t){let e,l,n,i;const o=t[13].default,r=fo(o,t,t[12],null);let a=[{href:t[0]},t[2],t[1]],f={};for(let c=0;c<a.length;c+=1)f=Jt(f,a[c]);return{c(){e=m("a"),r&&r.c(),al(e,f)},m(c,p){y(c,e,p),r&&r.m(e,null),l=!0,n||(i=K(e,"click",t[4]),n=!0)},p(c,[p]){r&&r.p&&(!l||p&4096)&&mo(r,o,c,c[12],l?co(o,c[12],p,null):po(c[12]),null),al(e,f=ui(a,[(!l||p&1)&&{href:c[0]},p&4&&c[2],p&2&&c[1]]))},i(c){l||(N(r,c),l=!0)},o(c){D(r,c),l=!1},d(c){c&&w(e),r&&r.d(c),n=!1,i()}}}function lm(t,e,l){let n,i,o,r,a,f;const c=["to","replace","state","getProps"];let p=ks(e,c),_,{$$slots:b={},$$scope:d}=e,{to:v}=e,{replace:g=!1}=e,{state:k={}}=e,{getProps:$=null}=e;Si(vo,e);const T=yc();rl(t,T,E=>l(11,_=E));const P=Jc(),I=Tc(),{navigate:S}=Cc();function A(E){P("click",E),l1(E)&&(E.preventDefault(),S(n,{state:k,replace:r||g}))}return t.$$set=E=>{l(19,e=Jt(Jt({},e),gs(E))),l(18,p=ks(e,c)),"to"in E&&l(5,v=E.to),"replace"in E&&l(6,g=E.replace),"state"in E&&l(7,k=E.state),"getProps"in E&&l(8,$=E.getProps),"$$scope"in E&&l(12,d=E.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=I(v,_)),t.$$.dirty&2049&&l(10,i=eo(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(r=bo(n)===$1(_)),t.$$.dirty&512&&l(2,a=o?{"aria-current":"page"}:{}),l(1,f=(()=>{if(lc($)){const E=$({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...E}}return p})())},e=gs(e),[n,f,a,T,A,v,g,k,$,o,i,_,d,b]}class Ol extends Ce{constructor(e){super(),ye(this,e,lm,tm,ke,{to:5,replace:6,state:7,getProps:8})}}let to=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ul(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function nm(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Sc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function im(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Cs(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return""}}function De(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function fe(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Yr(t){switch(t){case-1:return"Parse error";case-2:return"Incomplete data received";case-3:return"Payload boundry flag missing";case-4:return"Header checksum error";case-5:return"Footer checksum error";case-9:return"Unknown data received, check meter config";case-41:return"Frame length not equal";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid";case 90:return"No HAN data received for at least 30s";case 91:return"Serial break";case 92:return"Serial buffer full";case 93:return"Serial FIFO overflow";case 94:return"Serial frame error";case 95:return"Serial parity error";case 96:return"RX error";case 98:return"Exception in code, debugging necessary";case 99:return"Autodetection failed"}return t<0?"Unspecified error "+t:""}function Vr(t){switch(t){case-3:return"Connection failed";case-4:return"Network timeout";case-10:return"Connection denied";case-11:return"Failed to subscribe";case-13:return"Connection lost"}return t<0?"Unspecified error "+t:""}function Kr(t){switch(t){case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function si(t){switch(t){case 2:case 4:case 7:return!0}return!1}function ze(t,e){return t==1||t==2&&e}function Lt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ce(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<10?1:0),t.toFixed(e))}function fl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Qr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}async function jl(t,e={}){const{timeout:l=8e3}=e,n=new AbortController,i=setTimeout(()=>n.abort(),l),o=await fetch(t,{...e,signal:n.signal});return clearTimeout(i),o}let ul={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null};const Ut=rt(ul);async function go(){ul=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Ut.set(ul)}let ds=0,Xr=-127,Zr=null,sm={};const om=oc(sm,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),Xr!=n.t&&(Xr=n.t,setTimeout(Ac,2e3)),Zr!=n.p&&n.pe&&(Zr=n.p,setTimeout(um,1e3)),ul.upgrading?window.location.reload():(!ul||!ul.chip||ul.booting||ds>1&&!si(ul.board))&&(go(),rn&&clearTimeout(rn),rn=setTimeout(ko,2e3),an&&clearTimeout(an),an=setTimeout(wo,3e3));let i=5e3;if(si(ul.board)&&n.v>2.5){let o=3.3-Math.min(3.3,n.v);o>0&&(i=Math.max(o,.1)*10*5e3)}i>5e3&&console.log("Scheduling next data fetch in "+i+"ms"),e&&clearTimeout(e),e=setTimeout(l,i),ds=0}).catch(n=>{ds++,ds>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,si(ul.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let lo={};const Pc=rt(lo);async function um(){lo=await(await jl("/energyprice.json")).json(),Pc.set(lo)}let no={},rn;async function ko(){rn&&(clearTimeout(rn),rn=0),no=await(await jl("/dayplot.json")).json(),Nc.set(no);let e=new Date;rn=setTimeout(ko,(60-e.getMinutes())*6e4+20)}const Nc=rt(no,t=>(ko(),function(){}));let io={},an;async function wo(){an&&(clearTimeout(an),an=0),io=await(await jl("/monthplot.json")).json(),Mc.set(io);let e=new Date;an=setTimeout(wo,(24-e.getHours())*36e5+40)}const Mc=rt(io,t=>(wo(),function(){}));let so={};async function Ac(){so=await(await jl("/temperature.json")).json(),Dc.set(so)}const Dc=rt(so,t=>(Ac(),function(){}));let oo={},vs;async function Ic(){vs&&(clearTimeout(vs),vs=0),oo=await(await jl("/tariff.json")).json(),Ec.set(oo);let e=new Date;vs=setTimeout(Ic,(60-e.getMinutes())*6e4+30)}const Ec=rt(oo,t=>function(){});let uo=[];const yo=rt(uo);async function rm(){uo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),yo.set(uo)}function $s(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Fc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Rc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),r=[...e];r.reverse();let a,f,c;for(let p=0;p<r.length;p++){let _=r[p],d=_.tag_name.substring(1).split("."),v=parseInt(d[0]),g=parseInt(d[1]),k=parseInt(d[2]);if(v==n)g==i?k>o&&(a=_):g==i+1&&(f=_);else if(v==n+1)if(c){let $=c.tag_name.substring(1).split(".");parseInt($[0]);let T=parseInt($[1]);parseInt($[2]),g==T&&(c=_)}else c=_}return f||c||a||!1}else return e[0]}const am="/github.svg";function Jr(t){let e,l;function n(r,a){return r[1]>1?vm:r[1]>0?dm:r[2]>1?_m:r[2]>0?pm:r[3]>1?mm:r[3]>0?cm:fm}let i=n(t),o=i(t);return{c(){e=C(`Up
`),o.c(),l=We()},m(r,a){y(r,e,a),o.m(r,a),y(r,l,a)},p(r,a){i===(i=n(r))&&o?o.p(r,a):(o.d(1),o=i(r),o&&(o.c(),o.m(l.parentNode,l)))},d(r){r&&w(e),o.d(r),r&&w(l)}}}function fm(t){let e,l;return{c(){e=C(t[0]),l=C(" seconds")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&1&&B(e,n[0])},d(n){n&&w(e),n&&w(l)}}}function cm(t){let e,l;return{c(){e=C(t[3]),l=C(" minute")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function mm(t){let e,l;return{c(){e=C(t[3]),l=C(" minutes")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&8&&B(e,n[3])},d(n){n&&w(e),n&&w(l)}}}function pm(t){let e,l;return{c(){e=C(t[2]),l=C(" hour")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function _m(t){let e,l;return{c(){e=C(t[2]),l=C(" hours")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&4&&B(e,n[2])},d(n){n&&w(e),n&&w(l)}}}function dm(t){let e,l;return{c(){e=C(t[1]),l=C(" day")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function vm(t){let e,l;return{c(){e=C(t[1]),l=C(" days")},m(n,i){y(n,e,i),y(n,l,i)},p(n,i){i&2&&B(e,n[1])},d(n){n&&w(e),n&&w(l)}}}function hm(t){let e,l=t[0]&&Jr(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Jr(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function bm(t,e,l){let{epoch:n}=e,i=0,o=0,r=0;return t.$$set=a=>{"epoch"in a&&l(0,n=a.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,r=Math.floor(n/60)))},[n,i,o,r]}class gm extends Ce{constructor(e){super(),ye(this,e,bm,hm,ke,{epoch:0})}}function km(t){let e,l,n;return{c(){e=m("span"),l=C(t[2]),u(e,"title",t[1]),u(e,"class",n="bd-"+t[0])},m(i,o){y(i,e,o),s(e,l)},p(i,[o]){o&4&&B(l,i[2]),o&2&&u(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&u(e,"class",n)},i:ne,o:ne,d(i){i&&w(e)}}}function wm(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=r=>{"color"in r&&l(0,n=r.color),"title"in r&&l(1,i=r.title),"text"in r&&l(2,o=r.text)},[n,i,o]}class cl extends Ce{constructor(e){super(),ye(this,e,wm,km,ke,{color:0,title:1,text:2})}}function ym(t){let e,l=`${De(t[0].getDate())}.${De(t[0].getMonth()+1)}.${t[0].getFullYear()} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=C(l),u(e,"class",t[1])},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${De(i[0].getDate())}.${De(i[0].getMonth()+1)}.${i[0].getFullYear()} ${De(i[0].getHours())}:${De(i[0].getMinutes())}`)&&B(n,l),o&2&&u(e,"class",i[1])},d(i){i&&w(e)}}}function Cm(t){let e=`${De(t[0].getDate())}. ${to[t[0].getMonth()]} ${De(t[0].getHours())}:${De(t[0].getMinutes())}`,l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&1&&e!==(e=`${De(n[0].getDate())}. ${to[n[0].getMonth()]} ${De(n[0].getHours())}:${De(n[0].getMinutes())}`)&&B(l,e)},d(n){n&&w(l)}}}function $m(t){let e;function l(o,r){return o[2]?Cm:ym}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,[r]){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:ne,o:ne,d(o){i.d(o),o&&w(e)}}}function Tm(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,r;return t.$$set=a=>{"timestamp"in a&&l(0,n=a.timestamp),"fullTimeColor"in a&&l(1,i=a.fullTimeColor),"offset"in a&&l(3,o=a.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,r=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(n.getHours()-n.getUTCHours())%24))},[n,i,r,o]}class Lc extends Ce{constructor(e){super(),ye(this,e,Tm,$m,ke,{timestamp:0,fullTimeColor:1,offset:3})}}function Sm(t){let e,l,n;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),u(n,"stroke-linecap","round"),u(n,"stroke-linejoin","round"),u(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(i,o){y(i,e,o),s(e,l),s(e,n)},p:ne,i:ne,o:ne,d(i){i&&w(e)}}}class Pm extends Ce{constructor(e){super(),ye(this,e,null,Sm,ke,{})}}function Nm(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Mm extends Ce{constructor(e){super(),ye(this,e,null,Nm,ke,{})}}function Am(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Rt extends Ce{constructor(e){super(),ye(this,e,null,Am,ke,{})}}function Dm(t){let e,l;return{c(){e=Oe("svg"),l=Oe("path"),u(l,"stroke-linecap","round"),u(l,"stroke-linejoin","round"),u(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"fill","none"),u(e,"viewBox","0 0 24 24"),u(e,"stroke-width","1.5"),u(e,"stroke","currentColor"),u(e,"class","w-6 h-6")},m(n,i){y(n,e,i),s(e,l)},p:ne,i:ne,o:ne,d(n){n&&w(e)}}}class Uc extends Ce{constructor(e){super(),ye(this,e,null,Dm,ke,{})}}function Im(t){let e,l,n=t[1].version+"",i;return{c(){e=C("AMS reader "),l=m("span"),i=C(n)},m(o,r){y(o,e,r),y(o,l,r),s(l,i)},p(o,r){r&2&&n!==(n=o[1].version+"")&&B(i,n)},d(o){o&&w(e),o&&w(l)}}}function xr(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=C(l),i=C("\xB0C"),u(e,"class","flex-none my-auto")},m(o,r){y(o,e,r),s(e,n),s(e,i)},p(o,r){r&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&B(n,l)},d(o){o&&w(e)}}}function ea(t){let e,l="HAN: "+Yr(t[0].he),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Yr(i[0].he))&&B(n,l)},d(i){i&&w(e)}}}function ta(t){let e,l="MQTT: "+Vr(t[0].me),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+Vr(i[0].me))&&B(n,l)},d(i){i&&w(e)}}}function la(t){let e,l="PriceAPI: "+Kr(t[0].ee),n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+Kr(i[0].ee))&&B(n,l)},d(i){i&&w(e)}}}function na(t){let e,l,n,i,o,r;return l=new Ol({props:{to:"/configuration",$$slots:{default:[Em]},$$scope:{ctx:t}}}),o=new Ol({props:{to:"/status",$$slots:{default:[Fm]},$$scope:{ctx:t}}}),{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("div"),J(o.$$.fragment),u(e,"class","flex-none px-1 mt-1"),u(e,"title","Configuration"),u(i,"class","flex-none px-1 mt-1"),u(i,"title","Device information")},m(a,f){y(a,e,f),X(l,e,null),y(a,n,f),y(a,i,f),X(o,i,null),r=!0},i(a){r||(N(l.$$.fragment,a),N(o.$$.fragment,a),r=!0)},o(a){D(l.$$.fragment,a),D(o.$$.fragment,a),r=!1},d(a){a&&w(e),Z(l),a&&w(n),a&&w(i),Z(o)}}}function Em(t){let e,l;return e=new Pm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Fm(t){let e,l;return e=new Mm({}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function ia(t){let e,l,n,i,o;const r=[Lm,Rm],a=[];function f(c,p){return c[1].security==0||c[0].a?0:1}return l=f(t),n=a[l]=r[l](t),{c(){e=m("div"),n.c(),u(e,"class","flex-none mr-3 text-yellow-500"),u(e,"title",i="New version: "+t[2].tag_name)},m(c,p){y(c,e,p),a[l].m(e,null),o=!0},p(c,p){let _=l;l=f(c),l===_?a[l].p(c,p):(Te(),D(a[_],1,1,()=>{a[_]=null}),Se(),n=a[l],n?n.p(c,p):(n=a[l]=r[l](c),n.c()),N(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+c[2].tag_name))&&u(e,"title",i)},i(c){o||(N(n),o=!0)},o(c){D(n),o=!1},d(c){c&&w(e),a[l].d()}}}function Rm(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=C("New version: "),i=C(n)},m(o,r){y(o,e,r),s(e,l),s(e,i)},p(o,r){r&4&&n!==(n=o[2].tag_name+"")&&B(i,n)},i:ne,o:ne,d(o){o&&w(e)}}}function Lm(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p;return a=new Uc({}),{c(){e=m("button"),l=m("span"),n=C("New version: "),o=C(i),r=h(),J(a.$$.fragment),u(l,"class","mt-1"),u(e,"class","flex")},m(_,b){y(_,e,b),s(e,l),s(l,n),s(l,o),s(e,r),X(a,e,null),f=!0,c||(p=K(e,"click",t[3]),c=!0)},p(_,b){(!f||b&4)&&i!==(i=_[2].tag_name+"")&&B(o,i)},i(_){f||(N(a.$$.fragment,_),f=!0)},o(_){D(a.$$.fragment,_),f=!1},d(_){_&&w(e),Z(a),c=!1,p()}}}function Um(t){let e,l,n,i,o,r,a,f,c,p,_,b,d=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee;i=new Ol({props:{to:"/",$$slots:{default:[Im]},$$scope:{ctx:t}}}),f=new gm({props:{epoch:t[0].u}});let ve=t[0].t>-50&&xr(t);T=new cl({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:Ul(t[1].booting?2:t[0].em)}}),I=new cl({props:{title:"HAN",text:"HAN",color:Ul(t[1].booting?9:t[0].hm)}}),A=new cl({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:Ul(t[1].booting?9:t[0].wm)}}),F=new cl({props:{title:"MQTT",text:"MQTT",color:Ul(t[1].booting?9:t[0].mm)}});let Pe=(t[0].he<0||t[0].he>0)&&ea(t),Ae=t[0].me<0&&ta(t),me=(t[0].ee>0||t[0].ee<0)&&la(t);te=new Lc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let se=t[1].vndcfg&&t[1].usrcfg&&na(t);Ie=new Rt({});let pe=t[1].fwconsent===1&&t[2]&&ia(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=m("div"),J(f.$$.fragment),c=h(),ve&&ve.c(),p=h(),_=m("div"),b=C("Free mem: "),v=C(d),g=C("kb"),k=h(),$=m("div"),J(T.$$.fragment),P=h(),J(I.$$.fragment),S=h(),J(A.$$.fragment),E=h(),J(F.$$.fragment),Y=h(),Pe&&Pe.c(),U=h(),Ae&&Ae.c(),R=h(),me&&me.c(),q=h(),z=m("div"),O=m("div"),H=m("a"),G=m("img"),W=h(),j=m("div"),J(te.$$.fragment),le=h(),se&&se.c(),de=h(),ie=m("div"),we=m("a"),J(Ie.$$.fragment),$e=h(),pe&&pe.c(),u(n,"class","flex text-lg text-gray-100 p-2"),u(a,"class","flex-none my-auto"),u(_,"class","flex-none my-auto"),u(r,"class","flex-none my-auto p-2 flex space-x-4"),u($,"class","flex-auto flex-wrap my-auto justify-center p-2"),u(G,"class","gh-logo"),Bc(G.src,L=am)||u(G,"src",L),u(G,"alt","GitHub repo"),u(H,"class","float-right"),u(H,"href","https://github.com/UtilitechAS/amsreader-firmware"),u(H,"target","_blank"),u(H,"rel","noreferrer"),u(H,"aria-label","GitHub"),u(O,"class","flex-none"),u(j,"class","flex-none my-auto px-2"),u(we,"href",Lt("")),u(we,"target","_blank"),u(we,"rel","noreferrer"),u(ie,"class","flex-none px-1 mt-1"),u(ie,"title","Documentation"),u(z,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),u(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),u(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(Q,oe){y(Q,e,oe),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,a),X(f,a,null),s(r,c),ve&&ve.m(r,null),s(r,p),s(r,_),s(_,b),s(_,v),s(_,g),s(l,k),s(l,$),X(T,$,null),s($,P),X(I,$,null),s($,S),X(A,$,null),s($,E),X(F,$,null),s(l,Y),Pe&&Pe.m(l,null),s(l,U),Ae&&Ae.m(l,null),s(l,R),me&&me.m(l,null),s(l,q),s(l,z),s(z,O),s(O,H),s(H,G),s(z,W),s(z,j),X(te,j,null),s(z,le),se&&se.m(z,null),s(z,de),s(z,ie),s(ie,we),X(Ie,we,null),s(z,$e),pe&&pe.m(z,null),Ee=!0},p(Q,[oe]){const Ne={};oe&18&&(Ne.$$scope={dirty:oe,ctx:Q}),i.$set(Ne);const Me={};oe&1&&(Me.epoch=Q[0].u),f.$set(Me),Q[0].t>-50?ve?ve.p(Q,oe):(ve=xr(Q),ve.c(),ve.m(r,p)):ve&&(ve.d(1),ve=null),(!Ee||oe&1)&&d!==(d=(Q[0].m?(Q[0].m/1e3).toFixed(1):"-")+"")&&B(v,d);const he={};oe&3&&(he.text=Q[1].booting?"Booting":Q[0].v>2?Q[0].v.toFixed(2)+"V":"ESP"),oe&3&&(he.color=Ul(Q[1].booting?2:Q[0].em)),T.$set(he);const x={};oe&3&&(x.color=Ul(Q[1].booting?9:Q[0].hm)),I.$set(x);const _e={};oe&1&&(_e.text=Q[0].r?Q[0].r.toFixed(0)+"dBm":"WiFi"),oe&3&&(_e.color=Ul(Q[1].booting?9:Q[0].wm)),A.$set(_e);const Le={};oe&3&&(Le.color=Ul(Q[1].booting?9:Q[0].mm)),F.$set(Le),Q[0].he<0||Q[0].he>0?Pe?Pe.p(Q,oe):(Pe=ea(Q),Pe.c(),Pe.m(l,U)):Pe&&(Pe.d(1),Pe=null),Q[0].me<0?Ae?Ae.p(Q,oe):(Ae=ta(Q),Ae.c(),Ae.m(l,R)):Ae&&(Ae.d(1),Ae=null),Q[0].ee>0||Q[0].ee<0?me?me.p(Q,oe):(me=la(Q),me.c(),me.m(l,q)):me&&(me.d(1),me=null);const je={};oe&1&&(je.timestamp=Q[0].c?new Date(Q[0].c*1e3):new Date(0)),oe&2&&(je.offset=Q[1].clock_offset),te.$set(je),Q[1].vndcfg&&Q[1].usrcfg?se?oe&2&&N(se,1):(se=na(Q),se.c(),N(se,1),se.m(z,de)):se&&(Te(),D(se,1,1,()=>{se=null}),Se()),Q[1].fwconsent===1&&Q[2]?pe?(pe.p(Q,oe),oe&6&&N(pe,1)):(pe=ia(Q),pe.c(),N(pe,1),pe.m(z,null)):pe&&(Te(),D(pe,1,1,()=>{pe=null}),Se())},i(Q){Ee||(N(i.$$.fragment,Q),N(f.$$.fragment,Q),N(T.$$.fragment,Q),N(I.$$.fragment,Q),N(A.$$.fragment,Q),N(F.$$.fragment,Q),N(te.$$.fragment,Q),N(se),N(Ie.$$.fragment,Q),N(pe),Ee=!0)},o(Q){D(i.$$.fragment,Q),D(f.$$.fragment,Q),D(T.$$.fragment,Q),D(I.$$.fragment,Q),D(A.$$.fragment,Q),D(F.$$.fragment,Q),D(te.$$.fragment,Q),D(se),D(Ie.$$.fragment,Q),D(pe),Ee=!1},d(Q){Q&&w(e),Z(i),Z(f),ve&&ve.d(),Z(T),Z(I),Z(A),Z(F),Pe&&Pe.d(),Ae&&Ae.d(),me&&me.d(),Z(te),se&&se.d(),Z(Ie),pe&&pe.d()}}}function Om(t,e,l){let{data:n={}}=e,i={},o={};function r(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!si(i.board)||confirm($s(fe(i.chip,i.board))))&&(Ut.update(a=>(a.upgrading=!0,a)),Fc(o.tag_name))}return Ut.subscribe(a=>{l(1,i=a),a.fwconsent===1&&rm()}),yo.subscribe(a=>{l(2,o=Rc(i.version,a))}),t.$$set=a=>{"data"in a&&l(0,n=a.data)},[n,i,o,r]}class qm extends Ce{constructor(e){super(),ye(this,e,Om,Um,ke,{data:0})}}function Hm(t){let e,l,n,i;return{c(){e=Oe("svg"),l=Oe("path"),n=Oe("path"),u(l,"d",Xs(150,150,115,210,510)),u(l,"stroke","#eee"),u(l,"fill","none"),u(l,"stroke-width","55"),u(n,"d",i=Xs(150,150,115,210,210+300*t[0]/100)),u(n,"stroke",t[1]),u(n,"fill","none"),u(n,"stroke-width","55"),u(e,"viewBox","0 0 300 300"),u(e,"xmlns","http://www.w3.org/2000/svg"),u(e,"height","100%")},m(o,r){y(o,e,r),s(e,l),s(e,n)},p(o,[r]){r&1&&i!==(i=Xs(150,150,115,210,210+300*o[0]/100))&&u(n,"d",i),r&2&&u(n,"stroke",o[1])},i:ne,o:ne,d(o){o&&w(e)}}}function sa(t,e,l,n){var i=(n-90)*Math.PI/180;return{x:t+l*Math.cos(i),y:e+l*Math.sin(i)}}function Xs(t,e,l,n,i){var o=sa(t,e,l,i),r=sa(t,e,l,n),a=i-n<=180?"0":"1",f=["M",o.x,o.y,"A",l,l,0,a,0,r.x,r.y].join(" ");return f}function jm(t,e,l){let{pct:n=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&l(0,n=o.pct),"color"in o&&l(1,i=o.color)},[n,i]}class Wm extends Ce{constructor(e){super(),ye(this,e,jm,Hm,ke,{pct:0,color:1})}}function oa(t){let e,l,n,i,o,r,a,f;return{c(){e=m("br"),l=h(),n=m("span"),i=C(t[3]),o=h(),r=m("span"),a=C(t[4]),f=C("/kWh"),u(n,"class","pl-sub"),u(r,"class","pl-snt")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),y(c,o,p),y(c,r,p),s(r,a),s(r,f)},p(c,p){p&8&&B(i,c[3]),p&16&&B(a,c[4])},d(c){c&&w(e),c&&w(l),c&&w(n),c&&w(o),c&&w(r)}}}function Gm(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k;l=new Wm({props:{pct:t[6],color:t[5](t[6])}});let $=t[3]&&oa(t);return{c(){e=m("div"),J(l.$$.fragment),n=h(),i=m("span"),o=m("span"),r=C(t[2]),a=h(),f=m("br"),c=h(),p=m("span"),_=C(t[0]),b=h(),d=m("span"),v=C(t[1]),g=h(),$&&$.c(),u(o,"class","pl-lab"),u(p,"class","pl-val"),u(d,"class","pl-unt"),u(i,"class","pl-ov"),u(e,"class","pl-root")},m(T,P){y(T,e,P),X(l,e,null),s(e,n),s(e,i),s(i,o),s(o,r),s(i,a),s(i,f),s(i,c),s(i,p),s(p,_),s(i,b),s(i,d),s(d,v),s(i,g),$&&$.m(i,null),k=!0},p(T,[P]){const I={};P&64&&(I.pct=T[6]),P&96&&(I.color=T[5](T[6])),l.$set(I),(!k||P&4)&&B(r,T[2]),(!k||P&1)&&B(_,T[0]),(!k||P&2)&&B(v,T[1]),T[3]?$?$.p(T,P):($=oa(T),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(T){k||(N(l.$$.fragment,T),k=!0)},o(T){D(l.$$.fragment,T),k=!1},d(T){T&&w(e),Z(l),$&&$.d()}}}function Bm(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:r}=e,{sub:a=""}=e,{subunit:f=""}=e,{colorFn:c}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,r=_.label),"sub"in _&&l(3,a=_.sub),"subunit"in _&&l(4,f=_.subunit),"colorFn"in _&&l(5,c=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,r,a,f,c,p,i]}class Oc extends Ce{constructor(e){super(),ye(this,e,Bm,Gm,ke,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function ua(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function ra(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function aa(t,e,l){const n=t.slice();return n[13]=e[l],n}function fa(t){let e,l,n,i,o,r=t[0].title&&ca(t),a=t[0].y.ticks,f=[];for(let d=0;d<a.length;d+=1)f[d]=pa(aa(t,a,d));let c=t[0].x.ticks,p=[];for(let d=0;d<c.length;d+=1)p[d]=va(ra(t,c,d));let _=t[0].points,b=[];for(let d=0;d<_.length;d+=1)b[d]=$a(ua(t,_,d));return{c(){r&&r.c(),e=h(),l=Oe("svg"),n=Oe("g");for(let d=0;d<f.length;d+=1)f[d].c();i=Oe("g");for(let d=0;d<p.length;d+=1)p[d].c();o=Oe("g");for(let d=0;d<b.length;d+=1)b[d].c();u(n,"class","axis y-axis"),u(i,"class","axis x-axis"),u(o,"class","bars"),u(l,"height",t[4])},m(d,v){r&&r.m(d,v),y(d,e,v),y(d,l,v),s(l,n);for(let g=0;g<f.length;g+=1)f[g].m(n,null);s(l,i);for(let g=0;g<p.length;g+=1)p[g].m(i,null);s(l,o);for(let g=0;g<b.length;g+=1)b[g].m(o,null)},p(d,v){if(d[0].title?r?r.p(d,v):(r=ca(d),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null),v&65){a=d[0].y.ticks;let g;for(g=0;g<a.length;g+=1){const k=aa(d,a,g);f[g]?f[g].p(k,v):(f[g]=pa(k),f[g].c(),f[g].m(n,null))}for(;g<f.length;g+=1)f[g].d(1);f.length=a.length}if(v&57){c=d[0].x.ticks;let g;for(g=0;g<c.length;g+=1){const k=ra(d,c,g);p[g]?p[g].p(k,v):(p[g]=va(k),p[g].c(),p[g].m(i,null))}for(;g<p.length;g+=1)p[g].d(1);p.length=c.length}if(v&233){_=d[0].points;let g;for(g=0;g<_.length;g+=1){const k=ua(d,_,g);b[g]?b[g].p(k,v):(b[g]=$a(k),b[g].c(),b[g].m(o,null))}for(;g<b.length;g+=1)b[g].d(1);b.length=_.length}v&16&&u(l,"height",d[4])},d(d){r&&r.d(d),d&&w(e),d&&w(l),ml(f,d),ml(p,d),ml(b,d)}}}function ca(t){let e,l=t[0].title+"",n;return{c(){e=m("strong"),n=C(l),u(e,"class","text-sm")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&B(n,l)},d(i){i&&w(e)}}}function ma(t){let e,l,n,i=t[13].label+"",o,r,a,f;return{c(){e=Oe("g"),l=Oe("line"),n=Oe("text"),o=C(i),u(l,"x2","100%"),u(n,"y","-4"),u(n,"x",r=t[13].align=="right"?"85%":""),u(e,"class",a="tick tick-"+t[13].value+" tick-"+t[13].color),u(e,"transform",f="translate(0, "+t[6](t[13].value)+")")},m(c,p){y(c,e,p),s(e,l),s(e,n),s(n,o)},p(c,p){p&1&&i!==(i=c[13].label+"")&&B(o,i),p&1&&r!==(r=c[13].align=="right"?"85%":"")&&u(n,"x",r),p&1&&a!==(a="tick tick-"+c[13].value+" tick-"+c[13].color)&&u(e,"class",a),p&65&&f!==(f="translate(0, "+c[6](c[13].value)+")")&&u(e,"transform",f)},d(c){c&&w(e)}}}function pa(t){let e=!isNaN(t[6](t[13].value)),l,n=e&&ma(t);return{c(){n&&n.c(),l=We()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&65&&(e=!isNaN(i[6](i[13].value))),e?n?n.p(i,o):(n=ma(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function _a(t){let e,l,n=(t[3]>20||t[11]%2==0)&&da(t);return{c(){e=Oe("g"),n&&n.c(),u(e,"class","tick"),u(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){y(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=da(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&u(e,"transform",l)},d(i){i&&w(e),n&&n.d()}}}function da(t){let e,l=t[9].label+"",n,i;return{c(){e=Oe("text"),n=C(l),u(e,"x",i=t[3]/2),u(e,"y","-4")},m(o,r){y(o,e,r),s(e,n)},p(o,r){r&1&&l!==(l=o[9].label+"")&&B(n,l),r&8&&i!==(i=o[3]/2)&&u(e,"x",i)},d(o){o&&w(e)}}}function va(t){let e=!isNaN(t[5](t[11])),l,n=e&&_a(t);return{c(){n&&n.c(),l=We()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=_a(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function ha(t){let e,l,n=t[9].value!==void 0&&ba(t),i=t[9].value2>1e-4&&wa(t);return{c(){e=Oe("g"),n&&n.c(),l=Oe("g"),i&&i.c()},m(o,r){y(o,e,r),n&&n.m(e,null),y(o,l,r),i&&i.m(l,null)},p(o,r){o[9].value!==void 0?n?n.p(o,r):(n=ba(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,r):(i=wa(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&w(e),n&&n.d(),o&&w(l),i&&i.d()}}}function ba(t){let e,l,n,i,o,r,a,f=t[3]>15&&ga(t);return{c(){e=Oe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](t[9].value)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&65&&n!==(n=c[6](c[9].value))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](Math.min(c[0].y.min,0)+c[9].value))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=ga(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ga(t){let e,l=t[9].label+"",n,i,o,r,a,f,c=t[9].title&&ka(t);return{c(){e=Oe("text"),n=C(l),c&&c.c(),f=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor",o=t[3]<fn?"left":"middle"),u(e,"fill",r=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),u(e,"transform",a="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](t[9].value)>t[6](0)-t[7]?t[6](t[9].value)-t[7]:t[6](t[9].value)+10)+") rotate("+(t[3]<fn?90:0)+")")},m(p,_){y(p,e,_),s(e,n),c&&c.m(p,_),y(p,f,_)},p(p,_){_&1&&l!==(l=p[9].label+"")&&B(n,l),_&8&&i!==(i=p[3]-4)&&u(e,"width",i),_&8&&o!==(o=p[3]<fn?"left":"middle")&&u(e,"text-anchor",o),_&193&&r!==(r=p[6](p[9].value)>p[6](0)-p[7]?p[9].color:"white")&&u(e,"fill",r),_&233&&a!==(a="translate("+(p[5](p[11])+p[3]/2)+" "+(p[6](p[9].value)>p[6](0)-p[7]?p[6](p[9].value)-p[7]:p[6](p[9].value)+10)+") rotate("+(p[3]<fn?90:0)+")")&&u(e,"transform",a),p[9].title?c?c.p(p,_):(c=ka(p),c.c(),c.m(f.parentNode,f)):c&&(c.d(1),c=null)},d(p){p&&w(e),c&&c.d(p),p&&w(f)}}}function ka(t){let e,l=t[9].title+"",n;return{c(){e=Oe("title"),n=C(l)},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title+"")&&B(n,l)},d(i){i&&w(e)}}}function wa(t){let e,l,n,i,o,r,a,f=t[3]>15&&ya(t);return{c(){e=Oe("rect"),f&&f.c(),a=We(),u(e,"x",l=t[5](t[11])+2),u(e,"y",n=t[6](0)),u(e,"width",i=t[3]-4),u(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),u(e,"fill",r=t[9].color)},m(c,p){y(c,e,p),f&&f.m(c,p),y(c,a,p)},p(c,p){p&32&&l!==(l=c[5](c[11])+2)&&u(e,"x",l),p&64&&n!==(n=c[6](0))&&u(e,"y",n),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](c[0].y.min)-c[6](c[0].y.min+c[9].value2))&&u(e,"height",o),p&1&&r!==(r=c[9].color)&&u(e,"fill",r),c[3]>15?f?f.p(c,p):(f=ya(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function ya(t){let e,l=t[9].label2+"",n,i,o,r,a,f=t[9].title2&&Ca(t);return{c(){e=Oe("text"),n=C(l),f&&f.c(),a=We(),u(e,"width",i=t[3]-4),u(e,"dominant-baseline","middle"),u(e,"text-anchor","middle"),u(e,"fill",o=t[6](-t[9].value2)<t[6](0)+15?t[9].color:"white"),u(e,"transform",r="translate("+(t[5](t[11])+t[3]/2)+" "+(t[6](-t[9].value2)<t[6](0)+15?t[6](-t[9].value2)+15:t[6](-t[9].value2)-14)+") rotate("+(t[3]<fn?90:0)+")")},m(c,p){y(c,e,p),s(e,n),f&&f.m(c,p),y(c,a,p)},p(c,p){p&1&&l!==(l=c[9].label2+"")&&B(n,l),p&8&&i!==(i=c[3]-4)&&u(e,"width",i),p&65&&o!==(o=c[6](-c[9].value2)<c[6](0)+15?c[9].color:"white")&&u(e,"fill",o),p&105&&r!==(r="translate("+(c[5](c[11])+c[3]/2)+" "+(c[6](-c[9].value2)<c[6](0)+15?c[6](-c[9].value2)+15:c[6](-c[9].value2)-14)+") rotate("+(c[3]<fn?90:0)+")")&&u(e,"transform",r),c[9].title2?f?f.p(c,p):(f=Ca(c),f.c(),f.m(a.parentNode,a)):f&&(f.d(1),f=null)},d(c){c&&w(e),f&&f.d(c),c&&w(a)}}}function Ca(t){let e,l=t[9].title2+"",n;return{c(){e=Oe("title"),n=C(l)},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title2+"")&&B(n,l)},d(i){i&&w(e)}}}function $a(t){let e=!isNaN(t[5](t[11]))&&!isNaN(t[6](t[9].value)),l,n=e&&ha(t);return{c(){n&&n.c(),l=We()},m(i,o){n&&n.m(i,o),y(i,l,o)},p(i,o){o&97&&(e=!isNaN(i[5](i[11]))&&!isNaN(i[6](i[9].value))),e?n?n.p(i,o):(n=ha(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&w(l)}}}function zm(t){let e,l,n=t[0].x.ticks&&t[0].points&&t[4]&&fa(t);return{c(){e=m("div"),n&&n.c(),u(e,"class","chart"),tt(()=>t[8].call(e))},m(i,o){y(i,e,o),n&&n.m(e,null),l=Kc(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=fa(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ne,o:ne,d(i){i&&w(e),n&&n.d(),l()}}}let fn=30;function Ym(t,e,l){let{config:n}=e,i,o,r,a,f,c,p;function _(){i=this.clientWidth,o=this.clientHeight,l(1,i),l(2,o)}return t.$$set=b=>{"config"in b&&l(0,n=b.config)},t.$$.update=()=>{if(t.$$.dirty&31){l(4,c=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,r=b/n.points.length),l(7,p=r<fn?30:15);let d=(c-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,a=function(v){return v*r+n.padding.left}),l(6,f=function(v){let g=0;return v>n.y.max?g=n.padding.bottom:v<n.y.min?g=c-n.padding.bottom:g=c-n.padding.bottom-(v-n.y.min)*d,g>c||g<0?0:g})}},[n,i,o,r,c,a,f,p,_]}class mn extends Ce{constructor(e){super(),ye(this,e,Ym,zm,ke,{config:0})}}function Vm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Km(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:r}=e,a={};function f(c){return{label:ce(c)+"V",title:c.toFixed(1)+" V",value:isNaN(c)?0:c,color:nm(c||0)}}return t.$$set=c=>{"u1"in c&&l(1,n=c.u1),"u2"in c&&l(2,i=c.u2),"u3"in c&&l(3,o=c.u3),"ds"in c&&l(4,r=c.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let c=[],p=[];n>0&&(c.push({label:r===1?"L1-L2":"L1"}),p.push(f(n))),i>0&&(c.push({label:r===1?"L1-L3":"L2"}),p.push(f(i))),o>0&&(c.push({label:r===1?"L2-L3":"L3"}),p.push(f(o))),l(0,a={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:c},points:p})}},[a,n,i,o,r]}class Qm extends Ce{constructor(e){super(),ye(this,e,Km,Vm,ke,{u1:1,u2:2,u3:3,ds:4})}}function Xm(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Zm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:r}=e,{i2:a}=e,{i3:f}=e,{max:c}=e,p={};function _(b){return{label:ce(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Sc(b?b/c*100:0)}}return t.$$set=b=>{"u1"in b&&l(1,n=b.u1),"u2"in b&&l(2,i=b.u2),"u3"in b&&l(3,o=b.u3),"i1"in b&&l(4,r=b.i1),"i2"in b&&l(5,a=b.i2),"i3"in b&&l(6,f=b.i3),"max"in b&&l(7,c=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],d=[];n>0&&(b.push({label:"L1"}),d.push(_(r))),i>0&&(b.push({label:"L2"}),d.push(_(a))),o>0&&(b.push({label:"L3"}),d.push(_(f))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:c,ticks:[{value:0,label:"0%"},{value:c/4,label:"25%"},{value:c/2,label:"50%"},{value:c/4*3,label:"75%"},{value:c,label:"100%"}]},x:{ticks:b},points:d})}},[p,n,i,o,r,a,f,c]}class Jm extends Ce{constructor(e){super(),ye(this,e,Zm,Xm,ke,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function xm(t){let e,l,n,i,o,r,a,f=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",c,p,_,b,d,v,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,$,T,P,I,S,A,E=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,Y,U,R,q,z,O=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",H,G;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",r=h(),a=m("div"),c=C(f),p=C(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",d=h(),v=m("div"),k=C(g),$=C(" VAr"),T=h(),P=m("div"),I=m("div"),I.textContent="Total in",S=h(),A=m("div"),F=C(E),Y=C(" kVArh"),U=h(),R=m("div"),R.textContent="Total out",q=h(),z=m("div"),H=C(O),G=C(" kVArh"),u(a,"class","text-right"),u(v,"class","text-right"),u(i,"class","grid grid-cols-2 mt-4"),u(A,"class","text-right"),u(z,"class","text-right"),u(P,"class","grid grid-cols-2 mt-4"),u(e,"class","mx-2 text-sm")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),s(i,o),s(i,r),s(i,a),s(a,c),s(a,p),s(i,_),s(i,b),s(i,d),s(i,v),s(v,k),s(v,$),s(e,T),s(e,P),s(P,I),s(P,S),s(P,A),s(A,F),s(A,Y),s(P,U),s(P,R),s(P,q),s(P,z),s(z,H),s(z,G)},p(L,[W]){W&1&&f!==(f=(typeof L[0]<"u"?L[0].toFixed(0):"-")+"")&&B(c,f),W&2&&g!==(g=(typeof L[1]<"u"?L[1].toFixed(0):"-")+"")&&B(k,g),W&4&&E!==(E=(typeof L[2]<"u"?L[2].toFixed(1):"-")+"")&&B(F,E),W&8&&O!==(O=(typeof L[3]<"u"?L[3].toFixed(1):"-")+"")&&B(H,O)},i:ne,o:ne,d(L){L&&w(e)}}}function ep(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:r}=e;return t.$$set=a=>{"importInstant"in a&&l(0,n=a.importInstant),"exportInstant"in a&&l(1,i=a.exportInstant),"importTotal"in a&&l(2,o=a.importTotal),"exportTotal"in a&&l(3,r=a.exportTotal)},[n,i,o,r]}class tp extends Ce{constructor(e){super(),ye(this,e,ep,xm,ke,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Ta(t){let e;function l(o,r){return o[3]?np:lp}let n=l(t),i=n(t);return{c(){i.c(),e=We()},m(o,r){i.m(o,r),y(o,e,r)},p(o,r){n===(n=l(o))&&i?i.p(o,r):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&w(e)}}}function lp(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v=ce(t[1].d.u,1)+"",g,k,$,T,P,I,S=ce(t[1].m.u)+"",A,E,F,Y,U,R,q=ce(t[0].last_month.u)+"",z,O,H,G,L=t[4]&&Sa(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),d=m("div"),g=C(v),k=C(" kWh"),$=h(),T=m("div"),T.textContent="Month",P=h(),I=m("div"),A=C(S),E=C(" kWh"),F=h(),Y=m("div"),Y.textContent="Last month",U=h(),R=m("div"),z=C(q),O=C(" kWh"),H=h(),L&&L.c(),G=We(),u(r,"class","text-right"),u(d,"class","text-right"),u(I,"class","text-right"),u(R,"class","text-right"),u(n,"class","grid grid-cols-2 mb-3")},m(W,j){y(W,e,j),y(W,l,j),y(W,n,j),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),s(n,_),s(n,b),s(n,d),s(d,g),s(d,k),s(n,$),s(n,T),s(n,P),s(n,I),s(I,A),s(I,E),s(n,F),s(n,Y),s(n,U),s(n,R),s(R,z),s(R,O),y(W,H,j),L&&L.m(W,j),y(W,G,j)},p(W,j){j&2&&a!==(a=ce(W[1].h.u,2)+"")&&B(f,a),j&2&&v!==(v=ce(W[1].d.u,1)+"")&&B(g,v),j&2&&S!==(S=ce(W[1].m.u)+"")&&B(A,S),j&1&&q!==(q=ce(W[0].last_month.u)+"")&&B(z,q),W[4]?L?L.p(W,j):(L=Sa(W),L.c(),L.m(G.parentNode,G)):L&&(L.d(1),L=null)},d(W){W&&w(e),W&&w(l),W&&w(n),W&&w(H),L&&L.d(W),W&&w(G)}}}function np(t){let e,l,n,i,o,r,a=ce(t[1].h.u,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.u,1)+"",k,$,T,P,I,S,A,E=ce(t[1].m.u)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.u)+"",G,L,W,j,te,le,de,ie,we,Ie,$e,Ee=ce(t[1].h.p,2)+"",ve,Pe,Ae,me,se,pe,Q,oe=ce(t[1].d.p,1)+"",Ne,Me,he,x,_e,Le,je,Ke=ce(t[1].m.p)+"",Fe,He,re,ge,Ot,Wl,xt,ft=ce(t[0].last_month.p)+"",Nl,_l,qt,pt,Qe=t[4]&&Pa(t),Xe=t[4]&&Na(t),Ze=t[4]&&Ma(t),Ue=t[4]&&Aa(t),Je=t[4]&&Da(t),Ge=t[4]&&Ia(t),xe=t[4]&&Ea(t),et=t[4]&&Fa(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=C(" kWh"),p=h(),Qe&&Qe.c(),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=C(" kWh"),T=h(),Xe&&Xe.c(),P=h(),I=m("div"),I.textContent="Month",S=h(),A=m("div"),F=C(E),Y=C(" kWh"),U=h(),Ze&&Ze.c(),R=h(),q=m("div"),q.textContent="Last mo.",z=h(),O=m("div"),G=C(H),L=C(" kWh"),W=h(),Ue&&Ue.c(),te=h(),le=m("strong"),le.textContent="Export",de=h(),ie=m("div"),we=m("div"),we.textContent="Hour",Ie=h(),$e=m("div"),ve=C(Ee),Pe=C(" kWh"),Ae=h(),Je&&Je.c(),me=h(),se=m("div"),se.textContent="Day",pe=h(),Q=m("div"),Ne=C(oe),Me=C(" kWh"),he=h(),Ge&&Ge.c(),x=h(),_e=m("div"),_e.textContent="Month",Le=h(),je=m("div"),Fe=C(Ke),He=C(" kWh"),re=h(),xe&&xe.c(),ge=h(),Ot=m("div"),Ot.textContent="Last mo.",Wl=h(),xt=m("div"),Nl=C(ft),_l=C(" kWh"),qt=h(),et&&et.c(),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class",j="grid grid-cols-"+t[5]+" mb-3"),u($e,"class","text-right"),u(Q,"class","text-right"),u(je,"class","text-right"),u(xt,"class","text-right"),u(ie,"class",pt="grid grid-cols-"+t[5])},m(ue,be){y(ue,e,be),y(ue,l,be),y(ue,n,be),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(n,p),Qe&&Qe.m(n,null),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(n,T),Xe&&Xe.m(n,null),s(n,P),s(n,I),s(n,S),s(n,A),s(A,F),s(A,Y),s(n,U),Ze&&Ze.m(n,null),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(n,W),Ue&&Ue.m(n,null),y(ue,te,be),y(ue,le,be),y(ue,de,be),y(ue,ie,be),s(ie,we),s(ie,Ie),s(ie,$e),s($e,ve),s($e,Pe),s(ie,Ae),Je&&Je.m(ie,null),s(ie,me),s(ie,se),s(ie,pe),s(ie,Q),s(Q,Ne),s(Q,Me),s(ie,he),Ge&&Ge.m(ie,null),s(ie,x),s(ie,_e),s(ie,Le),s(ie,je),s(je,Fe),s(je,He),s(ie,re),xe&&xe.m(ie,null),s(ie,ge),s(ie,Ot),s(ie,Wl),s(ie,xt),s(xt,Nl),s(xt,_l),s(ie,qt),et&&et.m(ie,null)},p(ue,be){be&2&&a!==(a=ce(ue[1].h.u,2)+"")&&B(f,a),ue[4]?Qe?Qe.p(ue,be):(Qe=Pa(ue),Qe.c(),Qe.m(n,_)):Qe&&(Qe.d(1),Qe=null),be&2&&g!==(g=ce(ue[1].d.u,1)+"")&&B(k,g),ue[4]?Xe?Xe.p(ue,be):(Xe=Na(ue),Xe.c(),Xe.m(n,P)):Xe&&(Xe.d(1),Xe=null),be&2&&E!==(E=ce(ue[1].m.u)+"")&&B(F,E),ue[4]?Ze?Ze.p(ue,be):(Ze=Ma(ue),Ze.c(),Ze.m(n,R)):Ze&&(Ze.d(1),Ze=null),be&1&&H!==(H=ce(ue[0].last_month.u)+"")&&B(G,H),ue[4]?Ue?Ue.p(ue,be):(Ue=Aa(ue),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),be&32&&j!==(j="grid grid-cols-"+ue[5]+" mb-3")&&u(n,"class",j),be&2&&Ee!==(Ee=ce(ue[1].h.p,2)+"")&&B(ve,Ee),ue[4]?Je?Je.p(ue,be):(Je=Da(ue),Je.c(),Je.m(ie,me)):Je&&(Je.d(1),Je=null),be&2&&oe!==(oe=ce(ue[1].d.p,1)+"")&&B(Ne,oe),ue[4]?Ge?Ge.p(ue,be):(Ge=Ia(ue),Ge.c(),Ge.m(ie,x)):Ge&&(Ge.d(1),Ge=null),be&2&&Ke!==(Ke=ce(ue[1].m.p)+"")&&B(Fe,Ke),ue[4]?xe?xe.p(ue,be):(xe=Ea(ue),xe.c(),xe.m(ie,ge)):xe&&(xe.d(1),xe=null),be&1&&ft!==(ft=ce(ue[0].last_month.p)+"")&&B(Nl,ft),ue[4]?et?et.p(ue,be):(et=Fa(ue),et.c(),et.m(ie,null)):et&&(et.d(1),et=null),be&32&&pt!==(pt="grid grid-cols-"+ue[5])&&u(ie,"class",pt)},d(ue){ue&&w(e),ue&&w(l),ue&&w(n),Qe&&Qe.d(),Xe&&Xe.d(),Ze&&Ze.d(),Ue&&Ue.d(),ue&&w(te),ue&&w(le),ue&&w(de),ue&&w(ie),Je&&Je.d(),Ge&&Ge.d(),xe&&xe.d(),et&&et.d()}}}function Sa(t){let e,l,n,i,o,r,a=ce(t[1].h.c,2)+"",f,c,p,_,b,d,v,g=ce(t[1].d.c,1)+"",k,$,T,P,I,S,A,E=ce(t[1].m.c)+"",F,Y,U,R,q,z,O,H=ce(t[0].last_month.c)+"",G,L,W;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),r=m("div"),f=C(a),c=h(),p=C(t[2]),_=h(),b=m("div"),b.textContent="Day",d=h(),v=m("div"),k=C(g),$=h(),T=C(t[2]),P=h(),I=m("div"),I.textContent="Month",S=h(),A=m("div"),F=C(E),Y=h(),U=C(t[2]),R=h(),q=m("div"),q.textContent="Last month",z=h(),O=m("div"),G=C(H),L=h(),W=C(t[2]),u(r,"class","text-right"),u(v,"class","text-right"),u(A,"class","text-right"),u(O,"class","text-right"),u(n,"class","grid grid-cols-2")},m(j,te){y(j,e,te),y(j,l,te),y(j,n,te),s(n,i),s(n,o),s(n,r),s(r,f),s(r,c),s(r,p),s(n,_),s(n,b),s(n,d),s(n,v),s(v,k),s(v,$),s(v,T),s(n,P),s(n,I),s(n,S),s(n,A),s(A,F),s(A,Y),s(A,U),s(n,R),s(n,q),s(n,z),s(n,O),s(O,G),s(O,L),s(O,W)},p(j,te){te&2&&a!==(a=ce(j[1].h.c,2)+"")&&B(f,a),te&4&&B(p,j[2]),te&2&&g!==(g=ce(j[1].d.c,1)+"")&&B(k,g),te&4&&B(T,j[2]),te&2&&E!==(E=ce(j[1].m.c)+"")&&B(F,E),te&4&&B(U,j[2]),te&1&&H!==(H=ce(j[0].last_month.c)+"")&&B(G,H),te&4&&B(W,j[2])},d(j){j&&w(e),j&&w(l),j&&w(n)}}}function Pa(t){let e,l=ce(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.c,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Na(t){let e,l=ce(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.c,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ma(t){let e,l=ce(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Aa(t){let e,l=ce(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.c)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Da(t){let e,l=ce(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].h.i,2)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ia(t){let e,l=ce(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].d.i,1)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Ea(t){let e,l=ce(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&2&&l!==(l=ce(r[1].m.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function Fa(t){let e,l=ce(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=C(l),i=h(),o=C(t[2]),u(e,"class","text-right")},m(r,a){y(r,e,a),s(e,n),s(e,i),s(e,o)},p(r,a){a&1&&l!==(l=ce(r[0].last_month.i)+"")&&B(n,l),a&4&&B(o,r[2])},d(r){r&&w(e)}}}function ip(t){let e,l,n,i,o,r,a=t[1]&&Ta(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),r=h(),a&&a.c(),u(e,"class","mx-2 text-sm")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),s(e,r),a&&a.m(e,null)},p(f,[c]){f[1]?a?a.p(f,c):(a=Ta(f),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},i:ne,o:ne,d(f){f&&w(e),a&&a.d()}}}function sp(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:r}=e,a=!1,f=3;return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo),"data"in c&&l(1,i=c.data),"currency"in c&&l(2,o=c.currency),"hasExport"in c&&l(3,r=c.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,a=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,f=a?3:2))},[n,i,o,r,a,f]}class op extends Ce{constructor(e){super(),ye(this,e,sp,ip,ke,{sysinfo:0,data:1,currency:2,hasExport:3})}}function up(t){let e,l,n,i;return n=new mn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),J(n.$$.fragment),u(e,"href","https://transparency.entsoe.eu/"),u(e,"target","_blank"),u(e,"class","text-xs float-right z-40")},m(o,r){y(o,e,r),y(o,l,r),X(n,o,r),i=!0},p(o,[r]){const a={};r&1&&(a.config=o[0]),n.$set(a)},i(o){i||(N(n.$$.fragment,o),i=!0)},o(o){D(n.$$.fragment,o),i=!1},d(o){o&&w(e),o&&w(l),Z(n,o)}}}function rp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=n.currency,c=new Date().getUTCHours(),p=0,_=0,b=0,d=[],v=[],g=[];l(4,a=l(3,r=0));let k=new Date;for(fl(k,i.clock_offset),p=c;p<24&&(_=n[De(b++)],_!=null);p++)v.push({label:De(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),fl(k,1);for(p=0;p<24&&(_=n[De(b++)],_!=null);p++)v.push({label:De(k.getUTCHours())}),g.push(_*100),l(4,a=Math.min(a,_*100)),l(3,r=Math.max(r,_*100)),fl(k,1);if(a>-100&&r<100){switch(f){case"NOK":case"SEK":case"DKK":f="\xF8re";break;case"EUR":f="cent";break;default:f=f+"/100"}for(l(4,a*=100),l(3,r*=100),p=0;p<g.length;p++)g[p]*=100}let $=[];for(p=0;p<g.length;p++){_=g[p];let S=_*.01,A=Math.abs(_)<1e3?2:0;$.push({label:S>=0?S.toFixed(A):"",title:S>=0?S.toFixed(2)+" "+f:"",value:_>=0?Math.abs(_):0,label2:S<0?S.toFixed(A):"",title2:S<0?S.toFixed(2)+" "+f:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let T=Math.max(r,Math.abs(a));if(a<0){l(4,a=Math.min(T/4*-1,a));let S=Math.ceil(Math.abs(a)/T*4),A=a/S;for(p=1;p<S+1;p++){let E=A*p;d.push({value:E,label:(E/100).toFixed(2)})}}l(3,r=Math.max(T/4,r));let P=Math.ceil(r/T*4),I=r/P;for(p=0;p<P+1;p++){let S=I*p;d.push({value:S,label:(S/100).toFixed(2)})}l(0,o={title:"Future energy price ("+f+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:d},x:{ticks:v},points:$})}},[o,n,i,r,a]}class ap extends Ce{constructor(e){super(),ye(this,e,rp,up,ke,{json:1,sysinfo:2})}}function fp(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function cp(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=fl(new Date,-24),d=new Date().getUTCHours();for(fl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),f=d;f<24;f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(b.getHours())}),_.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,k*10)),fl(b,1)}for(f=0;f<d;f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(b.getHours())}),_.push({label:k.toFixed(1),title:k.toFixed(2)+" kWh",value:k*10,label2:$.toFixed(1),title2:$.toFixed(2)+" kWh",value2:$*10,color:"#7c3aed"}),l(4,a=Math.max(a,$*10)),l(3,r=Math.max(r,k*10)),fl(b,1)}let v=Math.ceil(Math.max(a,r));if(l(3,r=v),l(4,a=a==0?0:v*-1),a<0){let k=a/4;for(f=1;f<5;f++){let $=k*f;c.push({value:$,label:($/10).toFixed(1)})}}let g=r/4;for(f=0;f<5;f++){let k=g*f;c.push({value:k,label:(k/10).toFixed(1)})}l(0,o={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:c},x:{ticks:p},points:_})}},[o,n,i,r,a]}class mp extends Ce{constructor(e){super(),ye(this,e,cp,fp,ke,{json:1,sysinfo:2})}}function pp(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function _p(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},r,a;return t.$$set=f=>{"json"in f&&l(1,n=f.json),"sysinfo"in f&&l(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,c=[],p=[],_=[];l(4,a=l(3,r=0));let b=new Date,d=new Date;for(fl(b,i.clock_offset-(b.getHours()-b.getUTCHours())%24),fl(d,i.clock_offset-(d.getHours()-d.getUTCHours())%24),d.setDate(0),f=b.getDate();f<=d.getDate();f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(f)}),_.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,k))}for(f=1;f<b.getDate();f++){let k=n["i"+De(f)],$=n["e"+De(f)];k===void 0&&(k=0),$===void 0&&($=0),p.push({label:De(f)}),_.push({label:k.toFixed(k<10?1:0),title:k.toFixed(2)+" kWh",value:k,label2:$.toFixed($<10?1:0),title2:$.toFixed(2)+" kWh",value2:$,color:"#7c3aed"}),l(4,a=Math.max(a,$)),l(3,r=Math.max(r,k))}let v=Math.ceil(Math.max(a,r)/10)*10;if(l(3,r=v),l(4,a=a==0?0:v*-1),a<0){let k=a/4;for(f=0;f<5;f++){let $=k*f;c.push({value:$,label:$.toFixed(0)})}}let g=r/4;for(f=0;f<5;f++){let k=g*f;c.push({value:k,label:k.toFixed(0)})}l(0,o={title:"Energy use last "+d.getDate()+" days (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:r,ticks:c},x:{ticks:p},points:_})}},[o,n,i,r,a]}class dp extends Ce{constructor(e){super(),ye(this,e,_p,pp,ke,{json:1,sysinfo:2})}}function vp(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function hp(t,e,l){let{json:n}=e,i={},o=0,r=0;return t.$$set=a=>{"json"in a&&l(1,n=a.json)},t.$$.update=()=>{if(t.$$.dirty&14){let a=0,f=0,c=[],p=[],_=[];n.s&&n.s.forEach((v,g)=>{var k=v.n?v.n:v.a;f=v.v,f==-127&&(f=0),p.push({label:k.slice(-4)}),_.push({label:f.toFixed(1),value:f,color:"#7c3aed"}),l(3,r=Math.min(r,f)),l(2,o=Math.max(o,f))}),l(2,o=Math.ceil(o)),l(3,r=Math.floor(r));let b=o;r<0&&(b+=Math.abs(r));let d=b/4;for(a=0;a<5;a++)f=r+d*a,c.push({value:f,label:f.toFixed(1)});l(0,i={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:r,max:o,ticks:c},x:{ticks:p},points:_})}},[i,n,o,r]}class bp extends Ce{constructor(e){super(),ye(this,e,hp,vp,ke,{json:1})}}function gp(t){let e,l;return e=new mn({props:{config:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}let kp=0;function wp(t,e,l){let n={},i=0,o;return Ec.subscribe(r=>{l(2,o=r)}),Ic(),t.$$.update=()=>{if(t.$$.dirty&6){let r=0,a=[],f=[],c=[];if(a.push({value:0,label:0}),o&&o.p)for(r=0;r<o.p.length;r++){let p=o.p[r];c.push({label:p.v.toFixed(2),value:p.v,color:"#7c3aed"}),f.push({label:p.d>0?De(p.d)+"."+to[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(r=0;r<o.t.length;r++){let p=o.t[r];if(p>=i)break;a.push({value:p,label:p})}a.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(a.push({label:o.c.toFixed(0),color:"orange",value:o.c}),l(1,i=Math.max(i,o.c))),l(1,i=Math.ceil(i)),l(0,n={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:kp,max:i,ticks:a},x:{ticks:f},points:c})}},[n,i,o]}class yp extends Ce{constructor(e){super(),ye(this,e,wp,gp,ke,{})}}function Ra(t){let e,l,n,i,o,r,a=(t[0].mt?Cs(t[0].mt):"-")+"",f,c,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,d,v;return i=new Oc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Sc}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),f=C(a),c=h(),p=m("div"),b=C(_),d=C(" kWh"),u(n,"class","col-span-2"),u(p,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(g,k){y(g,e,k),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(r,f),s(l,c),s(l,p),s(p,b),s(p,d),v=!0},p(g,k){const $={};k&1&&($.val=g[0].i?g[0].i:0),k&1&&($.max=g[0].im?g[0].im:15e3),k&1&&($.sub=g[0].p),k&1&&($.subunit=g[0].pc),i.$set($),(!v||k&1)&&a!==(a=(g[0].mt?Cs(g[0].mt):"-")+"")&&B(f,a),(!v||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&B(b,_)},i(g){v||(N(i.$$.fragment,g),v=!0)},o(g){D(i.$$.fragment,g),v=!1},d(g){g&&w(e),Z(i)}}}function La(t){let e,l,n,i,o,r,a,f,c=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Oc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:im}}),{c(){e=m("div"),l=m("div"),n=m("div"),J(i.$$.fragment),o=h(),r=m("div"),a=h(),f=m("div"),p=C(c),_=C(" kWh"),u(n,"class","col-span-2"),u(f,"class","text-right"),u(l,"class","grid grid-cols-2"),u(e,"class","cnt")},m(d,v){y(d,e,v),s(e,l),s(l,n),X(i,n,null),s(l,o),s(l,r),s(l,a),s(l,f),s(f,p),s(f,_),b=!0},p(d,v){const g={};v&1&&(g.val=d[0].e?d[0].e:0),v&1&&(g.max=d[0].om?d[0].om*1e3:1e4),i.$set(g),(!b||v&1)&&c!==(c=(d[0].ec?d[0].ec.toFixed(1):"-")+"")&&B(p,c)},i(d){b||(N(i.$$.fragment,d),b=!0)},o(d){D(i.$$.fragment,d),b=!1},d(d){d&&w(e),Z(i)}}}function Ua(t){let e,l,n;return l=new Qm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.ds=i[0].ds),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Oa(t){let e,l,n;return l=new Jm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,i1:t[0].i1,i2:t[0].i2,i3:t[0].i3,max:t[0].mf?t[0].mf:32}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.u1=i[0].u1),o&1&&(r.u2=i[0].u2),o&1&&(r.u3=i[0].u3),o&1&&(r.i1=i[0].i1),o&1&&(r.i2=i[0].i2),o&1&&(r.i3=i[0].i3),o&1&&(r.max=i[0].mf?i[0].mf:32),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function qa(t){let e,l,n;return l=new tp({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&1&&(r.importInstant=i[0].ri),o&1&&(r.exportInstant=i[0].re),o&1&&(r.importTotal=i[0].ric),o&1&&(r.exportTotal=i[0].rec),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ha(t){let e,l,n;return l=new op({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&2&&(r.sysinfo=i[1]),o&1&&(r.data=i[0].ea),o&1&&(r.currency=i[0].pc),o&1&&(r.hasExport=i[0].om>0||i[0].e>0),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function ja(t){let e,l,n;return l=new yp({}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt h-64")},m(i,o){y(i,e,o),X(l,e,null),n=!0},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Wa(t){let e,l,n;return l=new ap({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&4&&(r.json=i[2]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ga(t){let e,l,n;return l=new mp({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&8&&(r.json=i[3]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Ba(t){let e,l,n;return l=new dp({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&16&&(r.json=i[4]),o&2&&(r.sysinfo=i[1]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function za(t){let e,l,n;return l=new bp({props:{json:t[5]}}),{c(){e=m("div"),J(l.$$.fragment),u(e,"class","cnt gwf")},m(i,o){y(i,e,o),X(l,e,null),n=!0},p(i,o){const r={};o&32&&(r.json=i[5]),l.$set(r)},i(i){n||(N(l.$$.fragment,i),n=!0)},o(i){D(l.$$.fragment,i),n=!1},d(i){i&&w(e),Z(l)}}}function Cp(t){let e,l=ze(t[1].ui.i,t[0].i),n,i=ze(t[1].ui.e,t[0].om||t[0].e>0),o,r=ze(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),a,f=ze(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),c,p=ze(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=ze(t[1].ui.c,t[0].ea),d,v=ze(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),g,k=ze(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),$,T=ze(t[1].ui.d,t[3]),P,I=ze(t[1].ui.m,t[4]),S,A=ze(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),E,F=l&&Ra(t),Y=i&&La(t),U=r&&Ua(t),R=f&&Oa(t),q=p&&qa(t),z=b&&Ha(t),O=v&&ja(),H=k&&Wa(t),G=T&&Ga(t),L=I&&Ba(t),W=A&&za(t);return{c(){e=m("div"),F&&F.c(),n=h(),Y&&Y.c(),o=h(),U&&U.c(),a=h(),R&&R.c(),c=h(),q&&q.c(),_=h(),z&&z.c(),d=h(),O&&O.c(),g=h(),H&&H.c(),$=h(),G&&G.c(),P=h(),L&&L.c(),S=h(),W&&W.c(),u(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(j,te){y(j,e,te),F&&F.m(e,null),s(e,n),Y&&Y.m(e,null),s(e,o),U&&U.m(e,null),s(e,a),R&&R.m(e,null),s(e,c),q&&q.m(e,null),s(e,_),z&&z.m(e,null),s(e,d),O&&O.m(e,null),s(e,g),H&&H.m(e,null),s(e,$),G&&G.m(e,null),s(e,P),L&&L.m(e,null),s(e,S),W&&W.m(e,null),E=!0},p(j,[te]){te&3&&(l=ze(j[1].ui.i,j[0].i)),l?F?(F.p(j,te),te&3&&N(F,1)):(F=Ra(j),F.c(),N(F,1),F.m(e,n)):F&&(Te(),D(F,1,1,()=>{F=null}),Se()),te&3&&(i=ze(j[1].ui.e,j[0].om||j[0].e>0)),i?Y?(Y.p(j,te),te&3&&N(Y,1)):(Y=La(j),Y.c(),N(Y,1),Y.m(e,o)):Y&&(Te(),D(Y,1,1,()=>{Y=null}),Se()),te&3&&(r=ze(j[1].ui.v,j[0].u1>100||j[0].u2>100||j[0].u3>100)),r?U?(U.p(j,te),te&3&&N(U,1)):(U=Ua(j),U.c(),N(U,1),U.m(e,a)):U&&(Te(),D(U,1,1,()=>{U=null}),Se()),te&3&&(f=ze(j[1].ui.a,j[0].i1>.01||j[0].i2>.01||j[0].i3>.01)),f?R?(R.p(j,te),te&3&&N(R,1)):(R=Oa(j),R.c(),N(R,1),R.m(e,c)):R&&(Te(),D(R,1,1,()=>{R=null}),Se()),te&3&&(p=ze(j[1].ui.r,j[0].ri>0||j[0].re>0||j[0].ric>0||j[0].rec>0)),p?q?(q.p(j,te),te&3&&N(q,1)):(q=qa(j),q.c(),N(q,1),q.m(e,_)):q&&(Te(),D(q,1,1,()=>{q=null}),Se()),te&3&&(b=ze(j[1].ui.c,j[0].ea)),b?z?(z.p(j,te),te&3&&N(z,1)):(z=Ha(j),z.c(),N(z,1),z.m(e,d)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),te&3&&(v=ze(j[1].ui.t,j[0].pr&&(j[0].pr.startsWith("10YNO")||j[0].pr=="10Y1001A1001A48H"))),v?O?te&3&&N(O,1):(O=ja(),O.c(),N(O,1),O.m(e,g)):O&&(Te(),D(O,1,1,()=>{O=null}),Se()),te&3&&(k=ze(j[1].ui.p,j[0].pe&&!Number.isNaN(j[0].p))),k?H?(H.p(j,te),te&3&&N(H,1)):(H=Wa(j),H.c(),N(H,1),H.m(e,$)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),te&10&&(T=ze(j[1].ui.d,j[3])),T?G?(G.p(j,te),te&10&&N(G,1)):(G=Ga(j),G.c(),N(G,1),G.m(e,P)):G&&(Te(),D(G,1,1,()=>{G=null}),Se()),te&18&&(I=ze(j[1].ui.m,j[4])),I?L?(L.p(j,te),te&18&&N(L,1)):(L=Ba(j),L.c(),N(L,1),L.m(e,S)):L&&(Te(),D(L,1,1,()=>{L=null}),Se()),te&35&&(A=ze(j[1].ui.s,j[0].t&&j[0].t!=-127&&j[5].c>1)),A?W?(W.p(j,te),te&35&&N(W,1)):(W=za(j),W.c(),N(W,1),W.m(e,null)):W&&(Te(),D(W,1,1,()=>{W=null}),Se())},i(j){E||(N(F),N(Y),N(U),N(R),N(q),N(z),N(O),N(H),N(G),N(L),N(W),E=!0)},o(j){D(F),D(Y),D(U),D(R),D(q),D(z),D(O),D(H),D(G),D(L),D(W),E=!1},d(j){j&&w(e),F&&F.d(),Y&&Y.d(),U&&U.d(),R&&R.d(),q&&q.d(),z&&z.d(),O&&O.d(),H&&H.d(),G&&G.d(),L&&L.d(),W&&W.d()}}}function $p(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},r={},a={},f={};return Pc.subscribe(c=>{l(2,o=c)}),Nc.subscribe(c=>{l(3,r=c)}),Mc.subscribe(c=>{l(4,a=c)}),Dc.subscribe(c=>{l(5,f=c)}),t.$$set=c=>{"data"in c&&l(0,n=c.data),"sysinfo"in c&&l(1,i=c.sysinfo)},[n,i,o,r,a,f]}class Tp extends Ce{constructor(e){super(),ye(this,e,$p,Cp,ke,{data:0,sysinfo:1})}}let ro={};const qc=rt(ro);async function Sp(){ro=await(await fetch("/configuration.json")).json(),qc.set(ro)}function Ya(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Pp(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Np(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Va(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Ka(t){let e,l,n;return{c(){e=m("option"),e.textContent="UART1",l=h(),n=m("option"),n.textContent="UART2",e.__value=9,e.value=e.__value,n.__value=16,n.value=n.__value},m(i,o){y(i,e,o),y(i,l,o),y(i,n,o)},d(i){i&&w(e),i&&w(l),i&&w(n)}}}function Qa(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Xa(t){let e,l,n;return{c(){e=m("option"),l=C("GPIO"),n=C(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){y(i,e,o),s(e,l),s(e,n)},d(i){i&&w(e)}}}function Za(t){let e,l=t[4]>3&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!(t[0]=="esp32s2"&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&Xa(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,i){n[4]>3&&!(n[0]=="esp32"&&(n[4]==9||n[4]==16))&&!(n[0]=="esp32s2"&&n[4]==18)&&!(n[0]=="esp8266"&&(n[4]==3||n[4]==113))?l||(l=Xa(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&w(e)}}}function Mp(t){let e,l,n,i,o;function r(v,g){return v[0]=="esp32c3"?Np:Pp}let a=r(t),f=a(t),c=t[0]=="esp8266"&&Va(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&Ka(),_=t[0]=="esp32s2"&&Qa(),b={length:t[1]+1},d=[];for(let v=0;v<b.length;v+=1)d[v]=Za(Ya(t,b,v));return{c(){f.c(),e=h(),c&&c.c(),l=h(),p&&p.c(),n=h(),_&&_.c(),i=h();for(let v=0;v<d.length;v+=1)d[v].c();o=We()},m(v,g){f.m(v,g),y(v,e,g),c&&c.m(v,g),y(v,l,g),p&&p.m(v,g),y(v,n,g),_&&_.m(v,g),y(v,i,g);for(let k=0;k<d.length;k+=1)d[k].m(v,g);y(v,o,g)},p(v,[g]){if(a!==(a=r(v))&&(f.d(1),f=a(v),f&&(f.c(),f.m(e.parentNode,e))),v[0]=="esp8266"?c||(c=Va(),c.c(),c.m(l.parentNode,l)):c&&(c.d(1),c=null),v[0]=="esp32"||v[0]=="esp32solo"?p||(p=Ka(),p.c(),p.m(n.parentNode,n)):p&&(p.d(1),p=null),v[0]=="esp32s2"?_||(_=Qa(),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g&3){b={length:v[1]+1};let k;for(k=0;k<b.length;k+=1){const $=Ya(v,b,k);d[k]?d[k].p($,g):(d[k]=Za($),d[k].c(),d[k].m(o.parentNode,o))}for(;k<d.length;k+=1)d[k].d(1);d.length=b.length}},i:ne,o:ne,d(v){f.d(v),v&&w(e),c&&c.d(v),v&&w(l),p&&p.d(v),v&&w(n),_&&_.d(v),v&&w(i),ml(d,v),v&&w(o)}}}function Ap(t,e,l){let{chip:n}=e,i=39;return t.$$set=o=>{"chip"in o&&l(0,n=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(n){case"esp8266":l(1,i=16);break;case"esp32s2":l(1,i=44);break;case"esp32c3":l(1,i=19);break}},[n,i]}class Hc extends Ce{constructor(e){super(),ye(this,e,Ap,Mp,ke,{chip:0})}}function Ja(t){let e,l,n=t[1]&&xa(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),u(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),u(e,"class","z-50"),u(e,"aria-modal","true")},m(i,o){y(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=xa(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&w(e),n&&n.d()}}}function xa(t){let e,l;return{c(){e=m("div"),l=C(t[1]),u(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){y(n,e,i),s(e,l)},p(n,i){i&2&&B(l,n[1])},d(n){n&&w(e)}}}function Dp(t){let e,l=t[0]&&Ja(t);return{c(){l&&l.c(),e=We()},m(n,i){l&&l.m(n,i),y(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=Ja(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:ne,o:ne,d(n){l&&l.d(n),n&&w(e)}}}function Ip(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class At extends Ce{constructor(e){super(),ye(this,e,Ip,Dp,ke,{active:0,message:1})}}function ef(t,e,l){const n=t.slice();return n[1]=e[l],n}function tf(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=C("Europe/"),i=C(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,r){y(o,e,r),s(e,l),s(e,i)},p:ne,d(o){o&&w(e)}}}function Ep(t){let e,l,n,i=t[0],o=[];for(let r=0;r<i.length;r+=1)o[r]=tf(ef(t,i,r));return{c(){e=m("option"),e.textContent="GMT",l=h();for(let r=0;r<o.length;r+=1)o[r].c();n=We(),e.__value="GMT",e.value=e.__value},m(r,a){y(r,e,a),y(r,l,a);for(let f=0;f<o.length;f+=1)o[f].m(r,a);y(r,n,a)},p(r,[a]){if(a&1){i=r[0];let f;for(f=0;f<i.length;f+=1){const c=ef(r,i,f);o[f]?o[f].p(c,a):(o[f]=tf(c),o[f].c(),o[f].m(n.parentNode,n))}for(;f<o.length;f+=1)o[f].d(1);o.length=i.length}},i:ne,o:ne,d(r){r&&w(e),r&&w(l),ml(o,r),r&&w(n)}}}function Fp(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 Rp extends Ce{constructor(e){super(),ye(this,e,Fp,Ep,ke,{})}}function Lp(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v;return{c(){e=m("optgroup"),l=m("option"),l.textContent="/24",n=h(),i=m("optgroup"),o=m("option"),o.textContent="/25",r=m("option"),r.textContent="/26",a=m("option"),a.textContent="/27",f=m("option"),f.textContent="/28",c=m("option"),c.textContent="/29",p=h(),_=m("optgroup"),b=m("option"),b.textContent="/23",d=m("option"),d.textContent="/22",v=m("option"),v.textContent="/16",l.__value="255.255.255.0",l.value=l.__value,u(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,r.__value="255.255.255.192",r.value=r.__value,a.__value="255.255.255.224",a.value=a.__value,f.__value="255.255.255.240",f.value=f.__value,c.__value="255.255.255.248",c.value=c.__value,u(i,"label","Smaller subnets"),b.__value="255.255.254.0",b.value=b.__value,d.__value="255.255.252.0",d.value=d.__value,v.__value="255.255.0.0",v.value=v.__value,u(_,"label","Larger subnets")},m(g,k){y(g,e,k),s(e,l),y(g,n,k),y(g,i,k),s(i,o),s(i,r),s(i,a),s(i,f),s(i,c),y(g,p,k),y(g,_,k),s(_,b),s(_,d),s(_,v)},p:ne,i:ne,o:ne,d(g){g&&w(e),g&&w(n),g&&w(i),g&&w(p),g&&w(_)}}}class jc extends Ce{constructor(e){super(),ye(this,e,null,Lp,ke,{})}}function lf(t,e,l){const n=t.slice();return n[92]=e[l],n[93]=e,n[94]=l,n}function nf(t,e,l){const n=t.slice();return n[95]=e[l],n[96]=e,n[97]=l,n}function Up(t,e,l){const n=t.slice();return n[98]=e[l],n}function Op(t,e,l){const n=t.slice();return n[101]=e[l],n}function qp(t){let e,l;return{c(){e=m("option"),l=C(t[101]),e.__value=t[101],e.value=e.__value},m(n,i){y(n,e,i),s(e,l)},p:ne,d(n){n&&w(e)}}}function sf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","pt"),u(l,"type","text"),u(l,"class","in-s"),u(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,r){y(o,e,r),y(o,l,r),V(l,t[3].p.t),n||(i=K(l,"input",t[19]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].p.t&&V(l,o[3].p.t)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function of(t){let e,l,n,i,o,r,a,f,c,p,_,b,d;return{c(){e=m("div"),l=C("Username"),n=m("br"),i=h(),o=m("input"),r=h(),a=m("div"),f=C("Password"),c=m("br"),p=h(),_=m("input"),u(o,"name","gu"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(_,"name","gp"),u(_,"type","password"),u(_,"class","in-s"),u(a,"class","my-1")},m(v,g){y(v,e,g),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].g.u),y(v,r,g),y(v,a,g),s(a,f),s(a,c),s(a,p),s(a,_),V(_,t[3].g.p),b||(d=[K(o,"input",t[21]),K(_,"input",t[22])],b=!0)},p(v,g){g[0]&8&&o.value!==v[3].g.u&&V(o,v[3].g.u),g[0]&8&&_.value!==v[3].g.p&&V(_,v[3].g.p)},d(v){v&&w(e),v&&w(r),v&&w(a),b=!1,Ve(d)}}}function Hp(t){let e,l=t[98]*100+"",n;return{c(){e=m("option"),n=C(l),e.__value=t[98]*100,e.value=e.__value},m(i,o){y(i,e,o),s(e,n)},p:ne,d(i){i&&w(e)}}}function uf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),u(l,"name","mek"),u(l,"type","text"),u(l,"class","in-s")},m(o,r){y(o,e,r),y(o,l,r),V(l,t[3].m.e.k),n||(i=K(l,"input",t[31]),n=!0)},p(o,r){r[0]&8&&l.value!==o[3].m.e.k&&V(l,o[3].m.e.k)},d(o){o&&w(e),o&&w(l),n=!1,i()}}}function rf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Authentication key"),n=m("br"),i=h(),o=m("input"),u(o,"name","mea"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].m.e.a),r||(a=K(o,"input",t[32]),r=!0)},p(f,c){c[0]&8&&o.value!==f[3].m.e.a&&V(o,f[3].m.e.a)},d(f){f&&w(e),r=!1,a()}}}function af(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U;return{c(){e=m("div"),l=m("div"),n=C("Watt"),i=m("br"),o=h(),r=m("input"),a=h(),f=m("div"),c=C("Volt"),p=m("br"),_=h(),b=m("input"),d=h(),v=m("div"),g=C("Amp"),k=m("br"),$=h(),T=m("input"),P=h(),I=m("div"),S=C("kWh"),A=m("br"),E=h(),F=m("input"),u(r,"name","mmw"),u(r,"type","number"),u(r,"min","0.00"),u(r,"max","1000"),u(r,"step","0.001"),u(r,"class","in-f tr w-full"),u(l,"class","w-1/4"),u(b,"name","mmv"),u(b,"type","number"),u(b,"min","0.00"),u(b,"max","1000"),u(b,"step","0.001"),u(b,"class","in-m tr w-full"),u(f,"class","w-1/4"),u(T,"name","mma"),u(T,"type","number"),u(T,"min","0.00"),u(T,"max","1000"),u(T,"step","0.001"),u(T,"class","in-m tr w-full"),u(v,"class","w-1/4"),u(F,"name","mmc"),u(F,"type","number"),u(F,"min","0.00"),u(F,"max","1000"),u(F,"step","0.001"),u(F,"class","in-l tr w-full"),u(I,"class","w-1/4"),u(e,"class","flex my-1")},m(R,q){y(R,e,q),s(e,l),s(l,n),s(l,i),s(l,o),s(l,r),V(r,t[3].m.m.w),s(e,a),s(e,f),s(f,c),s(f,p),s(f,_),s(f,b),V(b,t[3].m.m.v),s(e,d),s(e,v),s(v,g),s(v,k),s(v,$),s(v,T),V(T,t[3].m.m.a),s(e,P),s(e,I),s(I,S),s(I,A),s(I,E),s(I,F),V(F,t[3].m.m.c),Y||(U=[K(r,"input",t[34]),K(b,"input",t[35]),K(T,"input",t[36]),K(F,"input",t[37])],Y=!0)},p(R,q){q[0]&8&&ae(r.value)!==R[3].m.m.w&&V(r,R[3].m.m.w),q[0]&8&&ae(b.value)!==R[3].m.m.v&&V(b,R[3].m.m.v),q[0]&8&&ae(T.value)!==R[3].m.m.a&&V(T,R[3].m.m.a),q[0]&8&&ae(F.value)!==R[3].m.m.c&&V(F,R[3].m.m.c)},d(R){R&&w(e),Y=!1,Ve(U)}}}function ff(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k;return{c(){e=m("div"),l=C("Gateway"),n=m("br"),i=h(),o=m("input"),r=h(),a=m("div"),f=C("DNS"),c=m("br"),p=h(),_=m("div"),b=m("input"),d=h(),v=m("input"),u(o,"name","ng"),u(o,"type","text"),u(o,"class","in-s"),u(e,"class","my-1"),u(b,"name","nd1"),u(b,"type","text"),u(b,"class","in-f w-full"),u(v,"name","nd2"),u(v,"type","text"),u(v,"class","in-l w-full"),u(_,"class","flex"),u(a,"class","my-1")},m($,T){y($,e,T),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].n.g),y($,r,T),y($,a,T),s(a,f),s(a,c),s(a,p),s(a,_),s(_,b),V(b,t[3].n.d1),s(_,d),s(_,v),V(v,t[3].n.d2),g||(k=[K(o,"input",t[47]),K(b,"input",t[48]),K(v,"input",t[49])],g=!0)},p($,T){T[0]&8&&o.value!==$[3].n.g&&V(o,$[3].n.g),T[0]&8&&b.value!==$[3].n.d1&&V(b,$[3].n.d1),T[0]&8&&v.value!==$[3].n.d2&&V(v,$[3].n.d2)},d($){$&&w(e),$&&w(r),$&&w(a),g=!1,Ve(k)}}}function cf(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=C(" SSL"),u(l,"type","checkbox"),u(l,"name","qs"),l.__value="true",l.value=l.__value,u(l,"class","rounded mb-1"),u(e,"class","float-right mr-3")},m(r,a){y(r,e,a),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[K(l,"change",t[53]),K(l,"change",t[11])],i=!0)},p(r,a){a[0]&8&&(l.checked=r[3].q.s.e)},d(r){r&&w(e),i=!1,Ve(o)}}}function mf(t){let e,l,n,i,o,r,a,f;return n=new Ol({props:{to:"/mqtt-ca",$$slots:{default:[Gp]},$$scope:{ctx:t}}}),o=new Ol({props:{to:"/mqtt-cert",$$slots:{default:[Yp]},$$scope:{ctx:t}}}),a=new Ol({props:{to:"/mqtt-key",$$slots:{default:[Qp]},$$scope:{ctx:t}}}),{c(){e=m("div"),l=m("div"),J(n.$$.fragment),i=h(),J(o.$$.fragment),r=h(),J(a.$$.fragment),u(e,"class","my-1")},m(c,p){y(c,e,p),s(e,l),X(n,l,null),s(l,i),X(o,l,null),s(l,r),X(a,l,null),f=!0},p(c,p){const _={};p[0]&8|p[3]&2048&&(_.$$scope={dirty:p,ctx:c}),n.$set(_);const b={};p[0]&8|p[3]&2048&&(b.$$scope={dirty:p,ctx:c}),o.$set(b);const d={};p[0]&8|p[3]&2048&&(d.$$scope={dirty:p,ctx:c}),a.$set(d)},i(c){f||(N(n.$$.fragment,c),N(o.$$.fragment,c),N(a.$$.fragment,c),f=!0)},o(c){D(n.$$.fragment,c),D(o.$$.fragment,c),D(a.$$.fragment,c),f=!1},d(c){c&&w(e),Z(n),Z(o),Z(a)}}}function jp(t){let e,l;return e=new cl({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Wp(t){let e,l;return e=new cl({props:{color:"green",text:"CA OK",title:"Click here to replace CA"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Gp(t){let e,l,n,i;const o=[Wp,jp],r=[];function a(f,c){return f[3].q.s.c?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Bp(t){let e,l;return e=new cl({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function zp(t){let e,l;return e=new cl({props:{color:"green",text:"Cert OK",title:"Click here to replace certificate"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Yp(t){let e,l,n,i;const o=[zp,Bp],r=[];function a(f,c){return f[3].q.s.r?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function Vp(t){let e,l;return e=new cl({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Kp(t){let e,l;return e=new cl({props:{color:"green",text:"Key OK",title:"Click here to replace key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function Qp(t){let e,l,n,i;const o=[Kp,Vp],r=[];function a(f,c){return f[3].q.s.k?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e!==p&&(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l||(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function pf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=m("div"),_=C("Electricity IDX"),b=m("br"),d=h(),v=m("input"),g=h(),k=m("div"),$=C("Current IDX"),T=m("br"),P=h(),I=m("input"),S=h(),A=m("div"),E=C(`Voltage IDX: L1, L2 & L3\r
`),F=m("div"),Y=m("input"),U=h(),R=m("input"),q=h(),z=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#domoticz")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","o"),a.value="true",u(v,"name","oe"),u(v,"type","text"),u(v,"class","in-f tr w-full"),u(p,"class","w-1/2"),u(I,"name","oc"),u(I,"type","text"),u(I,"class","in-l tr w-full"),u(k,"class","w-1/2"),u(c,"class","my-1 flex"),u(Y,"name","ou1"),u(Y,"type","text"),u(Y,"class","in-f tr w-1/3"),u(R,"name","ou2"),u(R,"type","text"),u(R,"class","in-m tr w-1/3"),u(z,"name","ou3"),u(z,"type","text"),u(z,"class","in-l tr w-1/3"),u(F,"class","flex"),u(A,"class","my-1"),u(e,"class","cnt")},m(L,W){y(L,e,W),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].o.e),s(c,g),s(c,k),s(k,$),s(k,T),s(k,P),s(k,I),V(I,t[3].o.c),s(e,S),s(e,A),s(A,E),s(A,F),s(F,Y),V(Y,t[3].o.u1),s(F,U),s(F,R),V(R,t[3].o.u2),s(F,q),s(F,z),V(z,t[3].o.u3),O=!0,H||(G=[K(v,"input",t[61]),K(I,"input",t[62]),K(Y,"input",t[63]),K(R,"input",t[64]),K(z,"input",t[65])],H=!0)},p(L,W){W[0]&8&&v.value!==L[3].o.e&&V(v,L[3].o.e),W[0]&8&&I.value!==L[3].o.c&&V(I,L[3].o.c),W[0]&8&&Y.value!==L[3].o.u1&&V(Y,L[3].o.u1),W[0]&8&&R.value!==L[3].o.u2&&V(R,L[3].o.u2),W[0]&8&&z.value!==L[3].o.u3&&V(z,L[3].o.u3)},i(L){O||(N(o.$$.fragment,L),O=!0)},o(L){D(o.$$.fragment,L),O=!1},d(L){L&&w(e),Z(o),H=!1,Ve(G)}}}function _f(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z;return o=new Rt({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div"),p=C("Discovery topic prefix"),_=m("br"),b=h(),d=m("input"),v=h(),g=m("div"),k=C("Hostname for URL"),$=m("br"),T=h(),P=m("input"),S=h(),A=m("div"),E=C("Name tag"),F=m("br"),Y=h(),U=m("input"),u(l,"class","text-sm"),u(i,"href",Lt("MQTT-configuration#home-assistant")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","h"),a.value="true",u(d,"name","ht"),u(d,"type","text"),u(d,"class","in-s"),u(d,"placeholder","homeassistant"),u(c,"class","my-1"),u(P,"name","hh"),u(P,"type","text"),u(P,"class","in-s"),u(P,"placeholder",I=t[3].g.h+".local"),u(g,"class","my-1"),u(U,"name","hn"),u(U,"type","text"),u(U,"class","in-s"),u(A,"class","my-1"),u(e,"class","cnt")},m(O,H){y(O,e,H),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c),s(c,p),s(c,_),s(c,b),s(c,d),V(d,t[3].h.t),s(e,v),s(e,g),s(g,k),s(g,$),s(g,T),s(g,P),V(P,t[3].h.h),s(e,S),s(e,A),s(A,E),s(A,F),s(A,Y),s(A,U),V(U,t[3].h.n),R=!0,q||(z=[K(d,"input",t[66]),K(P,"input",t[67]),K(U,"input",t[68])],q=!0)},p(O,H){H[0]&8&&d.value!==O[3].h.t&&V(d,O[3].h.t),(!R||H[0]&8&&I!==(I=O[3].g.h+".local"))&&u(P,"placeholder",I),H[0]&8&&P.value!==O[3].h.h&&V(P,O[3].h.h),H[0]&8&&U.value!==O[3].h.n&&V(U,O[3].h.n)},i(O){R||(N(o.$$.fragment,O),R=!0)},o(O){D(o.$$.fragment,O),R=!1},d(O){O&&w(e),Z(o),q=!1,Ve(z)}}}function df(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P;o=new Rt({});let I={length:9},S=[];for(let A=0;A<I.length;A+=1)S[A]=vf(nf(t,I,A));return{c(){e=m("div"),l=m("strong"),l.textContent="Tariff thresholds",n=h(),i=m("a"),J(o.$$.fragment),r=h(),a=m("input"),f=h(),c=m("div");for(let A=0;A<S.length;A+=1)S[A].c();p=h(),_=m("label"),b=m("span"),b.textContent="Average of",d=h(),v=m("input"),g=h(),k=m("span"),k.textContent="hours",u(l,"class","text-sm"),u(i,"href",Lt("Threshold-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(a,"type","hidden"),u(a,"name","t"),a.value="true",u(c,"class","flex flex-wrap my-1"),u(b,"class","in-pre"),u(v,"name","th"),u(v,"type","number"),u(v,"min","0"),u(v,"max","255"),u(v,"class","in-txt tr w-full"),u(k,"class","in-post"),u(_,"class","flex m-1"),u(e,"class","cnt")},m(A,E){y(A,e,E),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),s(e,a),s(e,f),s(e,c);for(let F=0;F<S.length;F+=1)S[F].m(c,null);s(e,p),s(e,_),s(_,b),s(_,d),s(_,v),V(v,t[3].t.h),s(_,g),s(_,k),$=!0,T||(P=K(v,"input",t[70]),T=!0)},p(A,E){if(E[0]&8){I={length:9};let F;for(F=0;F<I.length;F+=1){const Y=nf(A,I,F);S[F]?S[F].p(Y,E):(S[F]=vf(Y),S[F].c(),S[F].m(c,null))}for(;F<S.length;F+=1)S[F].d(1);S.length=I.length}E[0]&8&&ae(v.value)!==A[3].t.h&&V(v,A[3].t.h)},i(A){$||(N(o.$$.fragment,A),$=!0)},o(A){D(o.$$.fragment,A),$=!1},d(A){A&&w(e),Z(o),ml(S,A),T=!1,P()}}}function vf(t){let e,l,n=t[97]+1+"",i,o,r,a,f,c,p,_;function b(){t[69].call(r,t[97])}return{c(){e=m("label"),l=m("span"),i=C(n),o=h(),r=m("input"),a=h(),f=m("span"),f.textContent="kWh",c=h(),u(l,"class","in-pre"),u(r,"name","t"+t[97]),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-txt w-full"),u(f,"class","in-post"),u(e,"class","flex w-40 m-1")},m(d,v){y(d,e,v),s(e,l),s(l,i),s(e,o),s(e,r),V(r,t[3].t.t[t[97]]),s(e,a),s(e,f),s(e,c),p||(_=K(r,"input",b),p=!0)},p(d,v){t=d,v[0]&8&&ae(r.value)!==t[3].t.t[t[97]]&&V(r,t[3].t.t[t[97]])},d(d){d&&w(e),p=!1,_()}}}function hf(t){let e,l=t[92].name+"",n,i,o,r,a,f,c,p,_,b;function d(){t[71].call(r,t[92])}return{c(){e=m("div"),n=C(l),i=m("br"),o=h(),r=m("select"),a=m("option"),a.textContent="Hide",f=m("option"),f.textContent="Show",c=m("option"),c.textContent="Dynamic",p=h(),a.__value=0,a.value=a.__value,f.__value=1,f.value=f.__value,c.__value=2,c.value=c.__value,u(r,"name","u"+t[92].key),u(r,"class","in-s"),t[3].u[t[92].key]===void 0&&tt(d),u(e,"class","w-1/2")},m(v,g){y(v,e,g),s(e,n),s(e,i),s(e,o),s(e,r),s(r,a),s(r,f),s(r,c),Re(r,t[3].u[t[92].key]),s(e,p),_||(b=K(r,"change",d),_=!0)},p(v,g){t=v,g[0]&136&&Re(r,t[3].u[t[92].key])},d(v){v&&w(e),_=!1,b()}}}function bf(t){let e,l,n,i,o,r,a,f;o=new Rt({});let c=t[0].board>20&&gf(t),p=t[0].chip=="esp8266"&&yf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),J(o.$$.fragment),r=h(),c&&c.c(),a=h(),p&&p.c(),u(l,"class","text-sm"),u(i,"href",Lt("GPIO-configuration")),u(i,"target","_blank"),u(i,"class","float-right"),u(e,"class","cnt")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),X(o,i,null),s(e,r),c&&c.m(e,null),s(e,a),p&&p.m(e,null),f=!0},p(_,b){_[0].board>20?c?(c.p(_,b),b[0]&1&&N(c,1)):(c=gf(_),c.c(),N(c,1),c.m(e,a)):c&&(Te(),D(c,1,1,()=>{c=null}),Se()),_[0].chip=="esp8266"?p?p.p(_,b):(p=yf(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){f||(N(o.$$.fragment,_),N(c),f=!0)},o(_){D(o.$$.fragment,_),D(c),f=!1},d(_){_&&w(e),Z(o),c&&c.d(),p&&p.d()}}}function gf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke;b=new Hc({props:{chip:t[0].chip}});let Fe=t[0].chip!="esp8266"&&kf(t),He=t[3].i.v.p>0&&wf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("HAN"),r=m("label"),a=m("input"),f=C(" pullup"),c=m("br"),p=h(),_=m("select"),J(b.$$.fragment),d=h(),v=m("div"),g=C("AP button"),k=m("br"),$=h(),T=m("input"),P=h(),I=m("div"),S=C("LED"),A=m("label"),E=m("input"),F=C(" inv"),Y=m("br"),U=h(),R=m("div"),q=m("input"),z=h(),O=m("div"),H=C("RGB"),G=m("label"),L=m("input"),W=C(" inverted"),j=m("br"),te=h(),le=m("div"),de=m("input"),ie=h(),we=m("input"),Ie=h(),$e=m("input"),Ee=h(),ve=m("div"),Pe=C("Temperature"),Ae=m("br"),me=h(),se=m("input"),pe=h(),Q=m("div"),oe=C("Analog temp"),Ne=m("br"),Me=h(),he=m("input"),x=h(),Fe&&Fe.c(),_e=h(),He&&He.c(),u(e,"type","hidden"),u(e,"name","i"),e.value="true",u(a,"name","ihu"),a.__value="true",a.value=a.__value,u(a,"type","checkbox"),u(a,"class","rounded mb-1"),u(r,"class","ml-2"),u(_,"name","ihp"),u(_,"class","in-f w-full"),t[3].i.h.p===void 0&&tt(()=>t[73].call(_)),u(i,"class","w-1/3"),u(T,"name","ia"),u(T,"type","number"),u(T,"min","0"),u(T,"max",t[6]),u(T,"class","in-m tr w-full"),u(v,"class","w-1/3"),u(E,"name","ili"),E.__value="true",E.value=E.__value,u(E,"type","checkbox"),u(E,"class","rounded mb-1"),u(A,"class","ml-4"),u(q,"name","ilp"),u(q,"type","number"),u(q,"min","0"),u(q,"max",t[6]),u(q,"class","in-l tr w-full"),u(R,"class","flex"),u(I,"class","w-1/3"),u(L,"name","iri"),L.__value="true",L.value=L.__value,u(L,"type","checkbox"),u(L,"class","rounded mb-1"),u(G,"class","ml-4"),u(de,"name","irr"),u(de,"type","number"),u(de,"min","0"),u(de,"max",t[6]),u(de,"class","in-f tr w-1/3"),u(we,"name","irg"),u(we,"type","number"),u(we,"min","0"),u(we,"max",t[6]),u(we,"class","in-m tr w-1/3"),u($e,"name","irb"),u($e,"type","number"),u($e,"min","0"),u($e,"max",t[6]),u($e,"class","in-l tr w-1/3"),u(le,"class","flex"),u(O,"class","w-full"),u(se,"name","itd"),u(se,"type","number"),u(se,"min","0"),u(se,"max",t[6]),u(se,"class","in-f tr w-full"),u(ve,"class","my-1 w-1/3"),u(he,"name","ita"),u(he,"type","number"),u(he,"min","0"),u(he,"max",t[6]),u(he,"class","in-l tr w-full"),u(Q,"class","my-1 pr-1 w-1/3"),u(n,"class","flex flex-wrap")},m(re,ge){y(re,e,ge),y(re,l,ge),y(re,n,ge),s(n,i),s(i,o),s(i,r),s(r,a),a.checked=t[3].i.h.u,s(r,f),s(i,c),s(i,p),s(i,_),X(b,_,null),Re(_,t[3].i.h.p),s(n,d),s(n,v),s(v,g),s(v,k),s(v,$),s(v,T),V(T,t[3].i.a),s(n,P),s(n,I),s(I,S),s(I,A),s(A,E),E.checked=t[3].i.l.i,s(A,F),s(I,Y),s(I,U),s(I,R),s(R,q),V(q,t[3].i.l.p),s(n,z),s(n,O),s(O,H),s(O,G),s(G,L),L.checked=t[3].i.r.i,s(G,W),s(O,j),s(O,te),s(O,le),s(le,de),V(de,t[3].i.r.r),s(le,ie),s(le,we),V(we,t[3].i.r.g),s(le,Ie),s(le,$e),V($e,t[3].i.r.b),s(n,Ee),s(n,ve),s(ve,Pe),s(ve,Ae),s(ve,me),s(ve,se),V(se,t[3].i.t.d),s(n,pe),s(n,Q),s(Q,oe),s(Q,Ne),s(Q,Me),s(Q,he),V(he,t[3].i.t.a),s(n,x),Fe&&Fe.m(n,null),s(n,_e),He&&He.m(n,null),Le=!0,je||(Ke=[K(a,"change",t[72]),K(_,"change",t[73]),K(T,"input",t[74]),K(E,"change",t[75]),K(q,"input",t[76]),K(L,"change",t[77]),K(de,"input",t[78]),K(we,"input",t[79]),K($e,"input",t[80]),K(se,"input",t[81]),K(he,"input",t[82])],je=!0)},p(re,ge){ge[0]&8&&(a.checked=re[3].i.h.u);const Ot={};ge[0]&1&&(Ot.chip=re[0].chip),b.$set(Ot),ge[0]&8&&Re(_,re[3].i.h.p),(!Le||ge[0]&64)&&u(T,"max",re[6]),ge[0]&8&&ae(T.value)!==re[3].i.a&&V(T,re[3].i.a),ge[0]&8&&(E.checked=re[3].i.l.i),(!Le||ge[0]&64)&&u(q,"max",re[6]),ge[0]&8&&ae(q.value)!==re[3].i.l.p&&V(q,re[3].i.l.p),ge[0]&8&&(L.checked=re[3].i.r.i),(!Le||ge[0]&64)&&u(de,"max",re[6]),ge[0]&8&&ae(de.value)!==re[3].i.r.r&&V(de,re[3].i.r.r),(!Le||ge[0]&64)&&u(we,"max",re[6]),ge[0]&8&&ae(we.value)!==re[3].i.r.g&&V(we,re[3].i.r.g),(!Le||ge[0]&64)&&u($e,"max",re[6]),ge[0]&8&&ae($e.value)!==re[3].i.r.b&&V($e,re[3].i.r.b),(!Le||ge[0]&64)&&u(se,"max",re[6]),ge[0]&8&&ae(se.value)!==re[3].i.t.d&&V(se,re[3].i.t.d),(!Le||ge[0]&64)&&u(he,"max",re[6]),ge[0]&8&&ae(he.value)!==re[3].i.t.a&&V(he,re[3].i.t.a),re[0].chip!="esp8266"?Fe?Fe.p(re,ge):(Fe=kf(re),Fe.c(),Fe.m(n,_e)):Fe&&(Fe.d(1),Fe=null),re[3].i.v.p>0?He?He.p(re,ge):(He=wf(re),He.c(),He.m(n,null)):He&&(He.d(1),He=null)},i(re){Le||(N(b.$$.fragment,re),Le=!0)},o(re){D(b.$$.fragment,re),Le=!1},d(re){re&&w(e),re&&w(l),re&&w(n),Z(b),Fe&&Fe.d(),He&&He.d(),je=!1,Ve(Ke)}}}function kf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Vcc"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivp"),u(o,"type","number"),u(o,"min","0"),u(o,"max",t[6]),u(o,"class","in-s tr w-full"),u(e,"class","my-1 pl-1 w-1/3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.p),r||(a=K(o,"input",t[83]),r=!0)},p(f,c){c[0]&64&&u(o,"max",f[6]),c[0]&8&&ae(o.value)!==f[3].i.v.p&&V(o,f[3].i.v.p)},d(f){f&&w(e),r=!1,a()}}}function wf(t){let e,l,n,i,o,r,a,f,c,p;return{c(){e=m("div"),l=C("Voltage divider"),n=m("br"),i=h(),o=m("div"),r=m("input"),a=h(),f=m("input"),u(r,"name","ivdv"),u(r,"type","number"),u(r,"min","0"),u(r,"max","65535"),u(r,"class","in-f tr w-full"),u(r,"placeholder","VCC"),u(f,"name","ivdg"),u(f,"type","number"),u(f,"min","0"),u(f,"max","65535"),u(f,"class","in-l tr w-full"),u(f,"placeholder","GND"),u(o,"class","flex"),u(e,"class","my-1")},m(_,b){y(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,r),V(r,t[3].i.v.d.v),s(o,a),s(o,f),V(f,t[3].i.v.d.g),c||(p=[K(r,"input",t[84]),K(f,"input",t[85])],c=!0)},p(_,b){b[0]&8&&ae(r.value)!==_[3].i.v.d.v&&V(r,_[3].i.v.d.v),b[0]&8&&ae(f.value)!==_[3].i.v.d.g&&V(f,_[3].i.v.d.g)},d(_){_&&w(e),c=!1,Ve(p)}}}function yf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T=(t[0].board==2||t[0].board==100)&&Cf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=C("Vcc offset"),r=m("br"),a=h(),f=m("input"),c=h(),p=m("div"),_=C("Multiplier"),b=m("br"),d=h(),v=m("input"),g=h(),T&&T.c(),u(e,"type","hidden"),u(e,"name","iv"),e.value="true",u(f,"name","ivo"),u(f,"type","number"),u(f,"min","0.0"),u(f,"max","3.5"),u(f,"step","0.01"),u(f,"class","in-f tr w-full"),u(i,"class","w-1/3"),u(v,"name","ivm"),u(v,"type","number"),u(v,"min","0.1"),u(v,"max","10"),u(v,"step","0.01"),u(v,"class","in-l tr w-full"),u(p,"class","w-1/3 pr-1"),u(n,"class","my-1 flex flex-wrap")},m(P,I){y(P,e,I),y(P,l,I),y(P,n,I),s(n,i),s(i,o),s(i,r),s(i,a),s(i,f),V(f,t[3].i.v.o),s(n,c),s(n,p),s(p,_),s(p,b),s(p,d),s(p,v),V(v,t[3].i.v.m),s(n,g),T&&T.m(n,null),k||($=[K(f,"input",t[86]),K(v,"input",t[87])],k=!0)},p(P,I){I[0]&8&&ae(f.value)!==P[3].i.v.o&&V(f,P[3].i.v.o),I[0]&8&&ae(v.value)!==P[3].i.v.m&&V(v,P[3].i.v.m),P[0].board==2||P[0].board==100?T?T.p(P,I):(T=Cf(P),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(P){P&&w(e),P&&w(l),P&&w(n),T&&T.d(),k=!1,Ve($)}}}function Cf(t){let e,l,n,i,o,r,a;return{c(){e=m("div"),l=C("Boot limit"),n=m("br"),i=h(),o=m("input"),u(o,"name","ivb"),u(o,"type","number"),u(o,"min","2.5"),u(o,"max","3.5"),u(o,"step","0.1"),u(o,"class","in-s tr w-full"),u(e,"class","w-1/3 pl-1")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),V(o,t[3].i.v.b),r||(a=K(o,"input",t[88]),r=!0)},p(f,c){c[0]&8&&ae(o.value)!==f[3].i.v.b&&V(o,f[3].i.v.b)},d(f){f&&w(e),r=!1,a()}}}function $f(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$=t[3].d.t&&Tf();return{c(){e=m("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",l=h(),n=m("div"),i=m("label"),o=m("input"),r=C(" Enable telnet"),a=h(),$&&$.c(),f=h(),c=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",d=m("option"),d.textContent="Info",v=m("option"),v.textContent="Warning",u(e,"class","bd-red"),u(o,"type","checkbox"),u(o,"name","dt"),o.__value="true",o.value=o.__value,u(o,"class","rounded mb-1"),u(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,d.__value=3,d.value=d.__value,v.__value=4,v.value=v.__value,u(p,"name","dl"),u(p,"class","in-s"),t[3].d.l===void 0&&tt(()=>t[91].call(p)),u(c,"class","my-1")},m(T,P){y(T,e,P),y(T,l,P),y(T,n,P),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,r),y(T,a,P),$&&$.m(T,P),y(T,f,P),y(T,c,P),s(c,p),s(p,_),s(p,b),s(p,d),s(p,v),Re(p,t[3].d.l),g||(k=[K(o,"change",t[90]),K(p,"change",t[91])],g=!0)},p(T,P){P[0]&8&&(o.checked=T[3].d.t),T[3].d.t?$||($=Tf(),$.c(),$.m(f.parentNode,f)):$&&($.d(1),$=null),P[0]&8&&Re(p,T[3].d.l)},d(T){T&&w(e),T&&w(l),T&&w(n),T&&w(a),$&&$.d(T),T&&w(f),T&&w(c),g=!1,Ve(k)}}}function Tf(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Xp(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke,Fe,He,re,ge,Ot,Wl,xt,ft,Nl,_l,qt,pt,Qe,Xe,Ze,Ue,Je,Ge,xe,et,ue,be,Pi,dl,pn,Tt,Ni,Mi,Ai,vl,Di,Ii,Ei,St,Ml,Be,hl,Gl,Ps,qe,el,Fi,Al,_n,$o,ai,To,tl,Ri,So,Ns,Po,fi,Ht,No,Mo,Dl,ll,Il,Ao,Li,Do,ct,El,Io,Ui,dn,vn,hn,bn,Oi,Eo,Dt,Fo,Bl,Ro,Lo,Uo,nl,gn,kn,Oo,wn,zl,qo,Ho,jo,yn,jt,Wo,qi,Go,Yl,Bo,zo,Yo,Cn,Wt,Vo,Hi,Ko,Ms,Qo,Vl,ji,Gt,Xo,Zo,Jo,As,Wi,Bt,xo,eu,tu,lt,Gi,lu,$n,Tn,nu,ci,iu,Kl,su,ou,uu,bl,ru,Ql,au,fu,cu,gl,mu,Sn,Xl,pu,_u,du,It,Pn,Nn,Mn,An,vu,Zl,hu,bu,gu,Dn,Et,ku,Bi,wu,zi,Yi,zt,yu,Cu,Vi,Ki,Yt,$u,Tu,at,Qi,Su,In,En,Pu,Jl,Nu,Mu,Au,Fl,il,Fn,Rn,Du,Pt,Xi,Zi,Iu,Nt,Ln,Ji,xi,Eu,Ds,es,ts,Vt,Fu,Ru,mi,Lu,Rl,Uu,pi,Kt,Ou,qu,Hu,ls,kl,ju,Ye,ns,Wu,Un,On,Gu,_i,Bu,sl,zu,Is,Yu,Vu,qn,wl,Ku,Qt,Qu,Es,xl,Xu,Zu,Ju,yl,xu,en,er,tr,lr,Cl,nr,Hn,jn,ir,sr,or,$l,ur,Wn,rr,ar,fr,_t,Gn,Bn,zn,Yn,Vn,Kn,cr,tn,mr,pr,_r,Tl,dr,Fs,Rs,Ls=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",Us,ol,is,vr,Qn,Xn,hr,di,br,vi,gr,Os,Mt,ss,kr,Zn,Jn,wr,hi,yr,os,us,Xt,Cr,$r,Tr,Ll,qs,xn,Sr,rs,ei,Pr,as,Hs,ln,js,nn,Ws,sn,Gs,on,Zt,Bs,Nr;a=new Rt({}),F=new Rp({});let Wc=["NOK","SEK","DKK","EUR"],fs=[];for(let M=0;M<4;M+=1)fs[M]=qp(Op(t,Wc,M));let dt=t[3].p.e&&t[0].chip!="esp8266"&&sf(t),vt=t[3].g.s>0&&of(t);_n=new Rt({});let Gc=[24,48,96,192,384,576,1152],cs=[];for(let M=0;M<7;M+=1)cs[M]=Hp(Up(t,Gc,M));let ht=t[3].m.e.e&&uf(t),bt=t[3].m.e.e&&rf(t),gt=t[3].m.m.e&&af(t);Tn=new Rt({}),En=new Rt({}),Ln=new jc({});let kt=t[3].n.m=="static"&&ff(t);On=new Rt({});let wt=t[0].chip!="esp8266"&&cf(t),nt=t[3].q.s.e&&mf(t),it=t[3].q.m==3&&pf(t),st=t[3].q.m==4&&_f(t),ot=Ls&&df(t);Xn=new Rt({});let ti=t[7],yt=[];for(let M=0;M<ti.length;M+=1)yt[M]=hf(lf(t,ti,M));let ut=(t[0].board>20||t[0].chip=="esp8266")&&bf(t);Jn=new Rt({});let Ct=t[3].d.s&&$f(t);return ln=new At({props:{active:t[1],message:"Loading configuration"}}),nn=new At({props:{active:t[2],message:"Saving configuration"}}),sn=new At({props:{active:t[4],message:"Performing factory reset"}}),on=new At({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),r=m("a"),J(a.$$.fragment),f=h(),c=m("input"),p=h(),_=m("div"),b=m("div"),d=m("div"),v=C("Hostname"),g=m("br"),k=h(),$=m("input"),T=h(),P=m("div"),I=C("Time zone"),S=m("br"),A=h(),E=m("select"),J(F.$$.fragment),Y=h(),U=m("input"),R=h(),q=m("div"),z=m("div"),O=m("div"),H=C("Price region"),G=m("br"),L=h(),W=m("select"),j=m("optgroup"),te=m("option"),te.textContent="NO1",le=m("option"),le.textContent="NO2",de=m("option"),de.textContent="NO3",ie=m("option"),ie.textContent="NO4",we=m("option"),we.textContent="NO5",Ie=m("optgroup"),$e=m("option"),$e.textContent="SE1",Ee=m("option"),Ee.textContent="SE2",ve=m("option"),ve.textContent="SE3",Pe=m("option"),Pe.textContent="SE4",Ae=m("optgroup"),me=m("option"),me.textContent="DK1",se=m("option"),se.textContent="DK2",pe=m("option"),pe.textContent="Austria",Q=m("option"),Q.textContent="Belgium",oe=m("option"),oe.textContent="Czech Republic",Ne=m("option"),Ne.textContent="Estonia",Me=m("option"),Me.textContent="Finland",he=m("option"),he.textContent="France",x=m("option"),x.textContent="Germany",_e=m("option"),_e.textContent="Great Britain",Le=m("option"),Le.textContent="Latvia",je=m("option"),je.textContent="Lithuania",Ke=m("option"),Ke.textContent="Netherland",Fe=m("option"),Fe.textContent="Poland",He=m("option"),He.textContent="Switzerland",re=h(),ge=m("div"),Ot=C("Currency"),Wl=m("br"),xt=h(),ft=m("select");for(let M=0;M<4;M+=1)fs[M].c();Nl=h(),_l=m("div"),qt=m("div"),pt=m("div"),Qe=C("Fixed price"),Xe=m("br"),Ze=h(),Ue=m("input"),Je=h(),Ge=m("div"),xe=C("Multiplier"),et=m("br"),ue=h(),be=m("input"),Pi=h(),dl=m("div"),pn=m("label"),Tt=m("input"),Ni=C(" Enable price fetch from remote server"),Mi=h(),dt&&dt.c(),Ai=h(),vl=m("div"),Di=C("Security"),Ii=m("br"),Ei=h(),St=m("select"),Ml=m("option"),Ml.textContent="None",Be=m("option"),Be.textContent="Only configuration",hl=m("option"),hl.textContent="Everything",Gl=h(),vt&&vt.c(),Ps=h(),qe=m("div"),el=m("strong"),el.textContent="Meter",Fi=h(),Al=m("a"),J(_n.$$.fragment),$o=h(),ai=m("input"),To=h(),tl=m("div"),Ri=m("span"),Ri.textContent="Buffer size",So=h(),Ns=m("span"),Ns.textContent="Serial conf.",Po=h(),fi=m("label"),Ht=m("input"),No=C(" inverted"),Mo=h(),Dl=m("div"),ll=m("select"),Il=m("option"),Ao=C("Autodetect");for(let M=0;M<7;M+=1)cs[M].c();Do=h(),ct=m("select"),El=m("option"),Io=C("-"),dn=m("option"),dn.textContent="7N1",vn=m("option"),vn.textContent="8N1",hn=m("option"),hn.textContent="7E1",bn=m("option"),bn.textContent="8E1",Eo=h(),Dt=m("input"),Fo=h(),Bl=m("div"),Ro=C("Voltage"),Lo=m("br"),Uo=h(),nl=m("select"),gn=m("option"),gn.textContent="400V (TN)",kn=m("option"),kn.textContent="230V (IT/TT)",Oo=h(),wn=m("div"),zl=m("div"),qo=C("Main fuse"),Ho=m("br"),jo=h(),yn=m("label"),jt=m("input"),Wo=h(),qi=m("span"),qi.textContent="A",Go=h(),Yl=m("div"),Bo=C("Production"),zo=m("br"),Yo=h(),Cn=m("label"),Wt=m("input"),Vo=h(),Hi=m("span"),Hi.textContent="kWp",Ko=h(),Ms=m("div"),Qo=h(),Vl=m("div"),ji=m("label"),Gt=m("input"),Xo=C(" Meter is encrypted"),Zo=h(),ht&&ht.c(),Jo=h(),bt&&bt.c(),As=h(),Wi=m("label"),Bt=m("input"),xo=C(" Multipliers"),eu=h(),gt&&gt.c(),tu=h(),lt=m("div"),Gi=m("strong"),Gi.textContent="WiFi",lu=h(),$n=m("a"),J(Tn.$$.fragment),nu=h(),ci=m("input"),iu=h(),Kl=m("div"),su=C("SSID"),ou=m("br"),uu=h(),bl=m("input"),ru=h(),Ql=m("div"),au=C("Password"),fu=m("br"),cu=h(),gl=m("input"),mu=h(),Sn=m("div"),Xl=m("div"),pu=C("Power saving"),_u=m("br"),du=h(),It=m("select"),Pn=m("option"),Pn.textContent="Default",Nn=m("option"),Nn.textContent="Off",Mn=m("option"),Mn.textContent="Minimum",An=m("option"),An.textContent="Maximum",vu=h(),Zl=m("div"),hu=C("Power"),bu=m("br"),gu=h(),Dn=m("div"),Et=m("input"),ku=h(),Bi=m("span"),Bi.textContent="dBm",wu=h(),zi=m("div"),Yi=m("label"),zt=m("input"),yu=C(" Auto reboot on connection problem"),Cu=h(),Vi=m("div"),Ki=m("label"),Yt=m("input"),$u=C(" Allow 802.11b legacy rates"),Tu=h(),at=m("div"),Qi=m("strong"),Qi.textContent="Network",Su=h(),In=m("a"),J(En.$$.fragment),Pu=h(),Jl=m("div"),Nu=C("IP"),Mu=m("br"),Au=h(),Fl=m("div"),il=m("select"),Fn=m("option"),Fn.textContent="DHCP",Rn=m("option"),Rn.textContent="Static",Du=h(),Pt=m("input"),Iu=h(),Nt=m("select"),J(Ln.$$.fragment),Eu=h(),kt&&kt.c(),Ds=h(),es=m("div"),ts=m("label"),Vt=m("input"),Fu=C(" enable mDNS"),Ru=h(),mi=m("input"),Lu=h(),Rl=m("div"),Uu=C("NTP "),pi=m("label"),Kt=m("input"),Ou=C(" obtain from DHCP"),qu=m("br"),Hu=h(),ls=m("div"),kl=m("input"),ju=h(),Ye=m("div"),ns=m("strong"),ns.textContent="MQTT",Wu=h(),Un=m("a"),J(On.$$.fragment),Gu=h(),_i=m("input"),Bu=h(),sl=m("div"),zu=C(`Server\r
`),wt&&wt.c(),Is=h(),Yu=m("br"),Vu=h(),qn=m("div"),wl=m("input"),Ku=h(),Qt=m("input"),Qu=h(),nt&&nt.c(),Es=h(),xl=m("div"),Xu=C("Username"),Zu=m("br"),Ju=h(),yl=m("input"),xu=h(),en=m("div"),er=C("Password"),tr=m("br"),lr=h(),Cl=m("input"),nr=h(),Hn=m("div"),jn=m("div"),ir=C("Client ID"),sr=m("br"),or=h(),$l=m("input"),ur=h(),Wn=m("div"),rr=C("Payload"),ar=m("br"),fr=h(),_t=m("select"),Gn=m("option"),Gn.textContent="JSON",Bn=m("option"),Bn.textContent="Raw (minimal)",zn=m("option"),zn.textContent="Raw (full)",Yn=m("option"),Yn.textContent="Domoticz",Vn=m("option"),Vn.textContent="HomeAssistant",Kn=m("option"),Kn.textContent="HEX dump",cr=h(),tn=m("div"),mr=C("Publish topic"),pr=m("br"),_r=h(),Tl=m("input"),dr=h(),it&&it.c(),Fs=h(),st&&st.c(),Rs=h(),ot&&ot.c(),Us=h(),ol=m("div"),is=m("strong"),is.textContent="User interface",vr=h(),Qn=m("a"),J(Xn.$$.fragment),hr=h(),di=m("input"),br=h(),vi=m("div");for(let M=0;M<yt.length;M+=1)yt[M].c();gr=h(),ut&&ut.c(),Os=h(),Mt=m("div"),ss=m("strong"),ss.textContent="Debugging",kr=h(),Zn=m("a"),J(Jn.$$.fragment),wr=h(),hi=m("input"),yr=h(),os=m("div"),us=m("label"),Xt=m("input"),Cr=C(" Enable debugging"),$r=h(),Ct&&Ct.c(),Tr=h(),Ll=m("div"),qs=m("div"),xn=m("button"),xn.textContent="Factory reset",Sr=h(),rs=m("div"),ei=m("button"),ei.textContent="Reboot",Pr=h(),as=m("div"),as.innerHTML='<button type="submit" class="btn-pri">Save</button>',Hs=h(),J(ln.$$.fragment),js=h(),J(nn.$$.fragment),Ws=h(),J(sn.$$.fragment),Gs=h(),J(on.$$.fragment),u(i,"class","text-sm"),u(r,"href",Lt("General-configuration")),u(r,"target","_blank"),u(r,"class","float-right"),u(c,"type","hidden"),u(c,"name","g"),c.value="true",u($,"name","gh"),u($,"type","text"),u($,"class","in-f w-full"),u($,"pattern","[A-Za-z0-9-]+"),u(E,"name","gt"),u(E,"class","in-l w-full"),t[3].g.t===void 0&&tt(()=>t[13].call(E)),u(b,"class","flex"),u(_,"class","my-1"),u(U,"type","hidden"),u(U,"name","p"),U.value="true",te.__value="10YNO-1--------2",te.value=te.__value,le.__value="10YNO-2--------T",le.value=le.__value,de.__value="10YNO-3--------J",de.value=de.__value,ie.__value="10YNO-4--------9",ie.value=ie.__value,we.__value="10Y1001A1001A48H",we.value=we.__value,u(j,"label","Norway"),$e.__value="10Y1001A1001A44P",$e.value=$e.__value,Ee.__value="10Y1001A1001A45N",Ee.value=Ee.__value,ve.__value="10Y1001A1001A46L",ve.value=ve.__value,Pe.__value="10Y1001A1001A47J",Pe.value=Pe.__value,u(Ie,"label","Sweden"),me.__value="10YDK-1--------W",me.value=me.__value,se.__value="10YDK-2--------M",se.value=se.__value,u(Ae,"label","Denmark"),pe.__value="10YAT-APG------L",pe.value=pe.__value,Q.__value="10YBE----------2",Q.value=Q.__value,oe.__value="10YCZ-CEPS-----N",oe.value=oe.__value,Ne.__value="10Y1001A1001A39I",Ne.value=Ne.__value,Me.__value="10YFI-1--------U",Me.value=Me.__value,he.__value="10YFR-RTE------C",he.value=he.__value,x.__value="10Y1001A1001A83F",x.value=x.__value,_e.__value="10YGB----------A",_e.value=_e.__value,Le.__value="10YLV-1001A00074",Le.value=Le.__value,je.__value="10YLT-1001A0008Q",je.value=je.__value,Ke.__value="10YNL----------L",Ke.value=Ke.__value,Fe.__value="10YPL-AREA-----S",Fe.value=Fe.__value,He.__value="10YCH-SWISSGRIDZ",He.value=He.__value,u(W,"name","pr"),u(W,"class","in-f w-full"),t[3].p.r===void 0&&tt(()=>t[14].call(W)),u(O,"class","w-full"),u(ft,"name","pc"),u(ft,"class","in-l"),t[3].p.c===void 0&&tt(()=>t[15].call(ft)),u(z,"class","flex"),u(q,"class","my-1"),u(Ue,"name","pf"),u(Ue,"type","number"),u(Ue,"min","0.001"),u(Ue,"max","65"),u(Ue,"step","0.001"),u(Ue,"class","in-f tr w-full"),u(pt,"class","w-1/2"),u(be,"name","pm"),u(be,"type","number"),u(be,"min","0.001"),u(be,"max","1000"),u(be,"step","0.001"),u(be,"class","in-l tr w-full"),u(Ge,"class","w-1/2"),u(qt,"class","flex"),u(_l,"class","my-1"),u(Tt,"type","checkbox"),u(Tt,"name","pe"),Tt.__value="true",Tt.value=Tt.__value,u(Tt,"class","rounded mb-1"),u(dl,"class","my-1"),Ml.__value=0,Ml.value=Ml.__value,Be.__value=1,Be.value=Be.__value,hl.__value=2,hl.value=hl.__value,u(St,"name","gs"),u(St,"class","in-s"),t[3].g.s===void 0&&tt(()=>t[20].call(St)),u(vl,"class","my-1"),u(n,"class","cnt"),u(el,"class","text-sm"),u(Al,"href",Lt("Meter-configuration")),u(Al,"target","_blank"),u(Al,"class","float-right"),u(ai,"type","hidden"),u(ai,"name","m"),ai.value="true",u(Ri,"class","float-right"),u(Ht,"name","mi"),Ht.__value="true",Ht.value=Ht.__value,u(Ht,"type","checkbox"),u(Ht,"class","rounded mb-1"),u(fi,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=Li=t[3].m.b!=0,u(ll,"name","mb"),u(ll,"class","in-f tr w-1/2"),t[3].m.b===void 0&&tt(()=>t[24].call(ll)),El.__value=0,El.value=El.__value,El.disabled=Ui=t[3].m.b!=0,dn.__value=2,dn.value=dn.__value,vn.__value=3,vn.value=vn.__value,hn.__value=10,hn.value=hn.__value,bn.__value=11,bn.value=bn.__value,u(ct,"name","mp"),u(ct,"class","in-m"),ct.disabled=Oi=t[3].m.b==0,t[3].m.p===void 0&&tt(()=>t[25].call(ct)),u(Dt,"name","ms"),u(Dt,"type","number"),u(Dt,"min",64),u(Dt,"max",4096),u(Dt,"step",64),u(Dt,"class","in-l tr w-1/2"),u(Dl,"class","flex w-full"),u(tl,"class","my-1"),gn.__value=2,gn.value=gn.__value,kn.__value=1,kn.value=kn.__value,u(nl,"name","md"),u(nl,"class","in-s"),t[3].m.d===void 0&&tt(()=>t[27].call(nl)),u(Bl,"class","my-1"),u(jt,"name","mf"),u(jt,"type","number"),u(jt,"min","5"),u(jt,"max","65535"),u(jt,"class","in-f tr w-full"),u(qi,"class","in-post"),u(yn,"class","flex"),u(zl,"class","mx-1"),u(Wt,"name","mr"),u(Wt,"type","number"),u(Wt,"min","0"),u(Wt,"max","65535"),u(Wt,"class","in-f tr w-full"),u(Hi,"class","in-post"),u(Cn,"class","flex"),u(Yl,"class","mx-1"),u(wn,"class","my-1 flex"),u(Ms,"class","my-1"),u(Gt,"type","checkbox"),u(Gt,"name","me"),Gt.__value="true",Gt.value=Gt.__value,u(Gt,"class","rounded mb-1"),u(Vl,"class","my-1"),u(Bt,"type","checkbox"),u(Bt,"name","mm"),Bt.__value="true",Bt.value=Bt.__value,u(Bt,"class","rounded mb-1"),u(qe,"class","cnt"),u(Gi,"class","text-sm"),u($n,"href",Lt("WiFi-configuration")),u($n,"target","_blank"),u($n,"class","float-right"),u(ci,"type","hidden"),u(ci,"name","w"),ci.value="true",u(bl,"name","ws"),u(bl,"type","text"),u(bl,"class","in-s"),u(Kl,"class","my-1"),u(gl,"name","wp"),u(gl,"type","password"),u(gl,"class","in-s"),u(Ql,"class","my-1"),Pn.__value=255,Pn.value=Pn.__value,Nn.__value=0,Nn.value=Nn.__value,Mn.__value=1,Mn.value=Mn.__value,An.__value=2,An.value=An.__value,u(It,"name","wz"),u(It,"class","in-s"),t[3].w.z===void 0&&tt(()=>t[40].call(It)),u(Xl,"class","w-1/2"),u(Et,"name","ww"),u(Et,"type","number"),u(Et,"min","0"),u(Et,"max","20.5"),u(Et,"step","0.5"),u(Et,"class","in-f tr w-full"),u(Bi,"class","in-post"),u(Dn,"class","flex"),u(Zl,"class","ml-2 w-1/2"),u(Sn,"class","my-1 flex"),u(zt,"type","checkbox"),u(zt,"name","wa"),zt.__value="true",zt.value=zt.__value,u(zt,"class","rounded mb-1"),u(zi,"class","my-3"),u(Yt,"type","checkbox"),u(Yt,"name","wb"),Yt.__value="true",Yt.value=Yt.__value,u(Yt,"class","rounded mb-1"),u(Vi,"class","my-3"),u(lt,"class","cnt"),u(Qi,"class","text-sm"),u(In,"href",Lt("Network-configuration")),u(In,"target","_blank"),u(In,"class","float-right"),Fn.__value="dhcp",Fn.value=Fn.__value,Rn.__value="static",Rn.value=Rn.__value,u(il,"name","nm"),u(il,"class","in-f"),t[3].n.m===void 0&&tt(()=>t[44].call(il)),u(Pt,"name","ni"),u(Pt,"type","text"),u(Pt,"class","in-m w-full"),Pt.disabled=Xi=t[3].n.m=="dhcp",Pt.required=Zi=t[3].n.m=="static",u(Nt,"name","ns"),u(Nt,"class","in-l"),Nt.disabled=Ji=t[3].n.m=="dhcp",Nt.required=xi=t[3].n.m=="static",t[3].n.s===void 0&&tt(()=>t[46].call(Nt)),u(Fl,"class","flex"),u(Jl,"class","my-1"),u(Vt,"name","nd"),Vt.__value="true",Vt.value=Vt.__value,u(Vt,"type","checkbox"),u(Vt,"class","rounded mb-1"),u(es,"class","my-1"),u(mi,"type","hidden"),u(mi,"name","ntp"),mi.value="true",u(Kt,"name","ntpd"),Kt.__value="true",Kt.value=Kt.__value,u(Kt,"type","checkbox"),u(Kt,"class","rounded mb-1"),u(pi,"class","ml-4"),u(kl,"name","ntph"),u(kl,"type","text"),u(kl,"class","in-s"),u(ls,"class","flex"),u(Rl,"class","my-1"),u(at,"class","cnt"),u(ns,"class","text-sm"),u(Un,"href",Lt("MQTT-configuration")),u(Un,"target","_blank"),u(Un,"class","float-right"),u(_i,"type","hidden"),u(_i,"name","q"),_i.value="true",u(wl,"name","qh"),u(wl,"type","text"),u(wl,"class","in-f w-3/4"),u(Qt,"name","qp"),u(Qt,"type","number"),u(Qt,"min","1024"),u(Qt,"max","65535"),u(Qt,"class","in-l tr w-1/4"),u(qn,"class","flex"),u(sl,"class","my-1"),u(yl,"name","qu"),u(yl,"type","text"),u(yl,"class","in-s"),u(xl,"class","my-1"),u(Cl,"name","qa"),u(Cl,"type","password"),u(Cl,"class","in-s"),u(en,"class","my-1"),u($l,"name","qc"),u($l,"type","text"),u($l,"class","in-f w-full"),Gn.__value=0,Gn.value=Gn.__value,Bn.__value=1,Bn.value=Bn.__value,zn.__value=2,zn.value=zn.__value,Yn.__value=3,Yn.value=Yn.__value,Vn.__value=4,Vn.value=Vn.__value,Kn.__value=255,Kn.value=Kn.__value,u(_t,"name","qm"),u(_t,"class","in-l"),t[3].q.m===void 0&&tt(()=>t[59].call(_t)),u(Hn,"class","my-1 flex"),u(Tl,"name","qb"),u(Tl,"type","text"),u(Tl,"class","in-s"),u(tn,"class","my-1"),u(Ye,"class","cnt"),u(is,"class","text-sm"),u(Qn,"href",Lt("User-interface")),u(Qn,"target","_blank"),u(Qn,"class","float-right"),u(di,"type","hidden"),u(di,"name","u"),di.value="true",u(vi,"class","flex flex-wrap"),u(ol,"class","cnt"),u(ss,"class","text-sm"),u(Zn,"href","https://amsleser.no/blog/post/24-telnet-debug"),u(Zn,"target","_blank"),u(Zn,"class","float-right"),u(hi,"type","hidden"),u(hi,"name","d"),hi.value="true",u(Xt,"type","checkbox"),u(Xt,"name","ds"),Xt.__value="true",Xt.value=Xt.__value,u(Xt,"class","rounded mb-1"),u(os,"class","mt-3"),u(Mt,"class","cnt"),u(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),u(xn,"type","button"),u(xn,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),u(ei,"type","button"),u(ei,"class","py-2 px-4 rounded bg-yellow-500 text-white"),u(rs,"class","text-center"),u(as,"class","text-right"),u(Ll,"class","grid grid-cols-3"),u(e,"autocomplete","off")},m(M,ee){y(M,e,ee),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),X(a,r,null),s(n,f),s(n,c),s(n,p),s(n,_),s(_,b),s(b,d),s(d,v),s(d,g),s(d,k),s(d,$),V($,t[3].g.h),s(b,T),s(b,P),s(P,I),s(P,S),s(P,A),s(P,E),X(F,E,null),Re(E,t[3].g.t),s(n,Y),s(n,U),s(n,R),s(n,q),s(q,z),s(z,O),s(O,H),s(O,G),s(O,L),s(O,W),s(W,j),s(j,te),s(j,le),s(j,de),s(j,ie),s(j,we),s(W,Ie),s(Ie,$e),s(Ie,Ee),s(Ie,ve),s(Ie,Pe),s(W,Ae),s(Ae,me),s(Ae,se),s(W,pe),s(W,Q),s(W,oe),s(W,Ne),s(W,Me),s(W,he),s(W,x),s(W,_e),s(W,Le),s(W,je),s(W,Ke),s(W,Fe),s(W,He),Re(W,t[3].p.r),s(z,re),s(z,ge),s(ge,Ot),s(ge,Wl),s(ge,xt),s(ge,ft);for(let $t=0;$t<4;$t+=1)fs[$t].m(ft,null);Re(ft,t[3].p.c),s(n,Nl),s(n,_l),s(_l,qt),s(qt,pt),s(pt,Qe),s(pt,Xe),s(pt,Ze),s(pt,Ue),V(Ue,t[3].p.f),s(qt,Je),s(qt,Ge),s(Ge,xe),s(Ge,et),s(Ge,ue),s(Ge,be),V(be,t[3].p.m),s(n,Pi),s(n,dl),s(dl,pn),s(pn,Tt),Tt.checked=t[3].p.e,s(pn,Ni),s(dl,Mi),dt&&dt.m(dl,null),s(n,Ai),s(n,vl),s(vl,Di),s(vl,Ii),s(vl,Ei),s(vl,St),s(St,Ml),s(St,Be),s(St,hl),Re(St,t[3].g.s),s(n,Gl),vt&&vt.m(n,null),s(l,Ps),s(l,qe),s(qe,el),s(qe,Fi),s(qe,Al),X(_n,Al,null),s(qe,$o),s(qe,ai),s(qe,To),s(qe,tl),s(tl,Ri),s(tl,So),s(tl,Ns),s(tl,Po),s(tl,fi),s(fi,Ht),Ht.checked=t[3].m.i,s(fi,No),s(tl,Mo),s(tl,Dl),s(Dl,ll),s(ll,Il),s(Il,Ao);for(let $t=0;$t<7;$t+=1)cs[$t].m(ll,null);Re(ll,t[3].m.b),s(Dl,Do),s(Dl,ct),s(ct,El),s(El,Io),s(ct,dn),s(ct,vn),s(ct,hn),s(ct,bn),Re(ct,t[3].m.p),s(Dl,Eo),s(Dl,Dt),V(Dt,t[3].m.s),s(qe,Fo),s(qe,Bl),s(Bl,Ro),s(Bl,Lo),s(Bl,Uo),s(Bl,nl),s(nl,gn),s(nl,kn),Re(nl,t[3].m.d),s(qe,Oo),s(qe,wn),s(wn,zl),s(zl,qo),s(zl,Ho),s(zl,jo),s(zl,yn),s(yn,jt),V(jt,t[3].m.f),s(yn,Wo),s(yn,qi),s(wn,Go),s(wn,Yl),s(Yl,Bo),s(Yl,zo),s(Yl,Yo),s(Yl,Cn),s(Cn,Wt),V(Wt,t[3].m.r),s(Cn,Vo),s(Cn,Hi),s(qe,Ko),s(qe,Ms),s(qe,Qo),s(qe,Vl),s(Vl,ji),s(ji,Gt),Gt.checked=t[3].m.e.e,s(ji,Xo),s(Vl,Zo),ht&&ht.m(Vl,null),s(qe,Jo),bt&&bt.m(qe,null),s(qe,As),s(qe,Wi),s(Wi,Bt),Bt.checked=t[3].m.m.e,s(Wi,xo),s(qe,eu),gt&&gt.m(qe,null),s(l,tu),s(l,lt),s(lt,Gi),s(lt,lu),s(lt,$n),X(Tn,$n,null),s(lt,nu),s(lt,ci),s(lt,iu),s(lt,Kl),s(Kl,su),s(Kl,ou),s(Kl,uu),s(Kl,bl),V(bl,t[3].w.s),s(lt,ru),s(lt,Ql),s(Ql,au),s(Ql,fu),s(Ql,cu),s(Ql,gl),V(gl,t[3].w.p),s(lt,mu),s(lt,Sn),s(Sn,Xl),s(Xl,pu),s(Xl,_u),s(Xl,du),s(Xl,It),s(It,Pn),s(It,Nn),s(It,Mn),s(It,An),Re(It,t[3].w.z),s(Sn,vu),s(Sn,Zl),s(Zl,hu),s(Zl,bu),s(Zl,gu),s(Zl,Dn),s(Dn,Et),V(Et,t[3].w.w),s(Dn,ku),s(Dn,Bi),s(lt,wu),s(lt,zi),s(zi,Yi),s(Yi,zt),zt.checked=t[3].w.a,s(Yi,yu),s(lt,Cu),s(lt,Vi),s(Vi,Ki),s(Ki,Yt),Yt.checked=t[3].w.b,s(Ki,$u),s(l,Tu),s(l,at),s(at,Qi),s(at,Su),s(at,In),X(En,In,null),s(at,Pu),s(at,Jl),s(Jl,Nu),s(Jl,Mu),s(Jl,Au),s(Jl,Fl),s(Fl,il),s(il,Fn),s(il,Rn),Re(il,t[3].n.m),s(Fl,Du),s(Fl,Pt),V(Pt,t[3].n.i),s(Fl,Iu),s(Fl,Nt),X(Ln,Nt,null),Re(Nt,t[3].n.s),s(at,Eu),kt&&kt.m(at,null),s(at,Ds),s(at,es),s(es,ts),s(ts,Vt),Vt.checked=t[3].n.d,s(ts,Fu),s(at,Ru),s(at,mi),s(at,Lu),s(at,Rl),s(Rl,Uu),s(Rl,pi),s(pi,Kt),Kt.checked=t[3].n.h,s(pi,Ou),s(Rl,qu),s(Rl,Hu),s(Rl,ls),s(ls,kl),V(kl,t[3].n.n1),s(l,ju),s(l,Ye),s(Ye,ns),s(Ye,Wu),s(Ye,Un),X(On,Un,null),s(Ye,Gu),s(Ye,_i),s(Ye,Bu),s(Ye,sl),s(sl,zu),wt&&wt.m(sl,null),s(sl,Is),s(sl,Yu),s(sl,Vu),s(sl,qn),s(qn,wl),V(wl,t[3].q.h),s(qn,Ku),s(qn,Qt),V(Qt,t[3].q.p),s(Ye,Qu),nt&&nt.m(Ye,null),s(Ye,Es),s(Ye,xl),s(xl,Xu),s(xl,Zu),s(xl,Ju),s(xl,yl),V(yl,t[3].q.u),s(Ye,xu),s(Ye,en),s(en,er),s(en,tr),s(en,lr),s(en,Cl),V(Cl,t[3].q.a),s(Ye,nr),s(Ye,Hn),s(Hn,jn),s(jn,ir),s(jn,sr),s(jn,or),s(jn,$l),V($l,t[3].q.c),s(Hn,ur),s(Hn,Wn),s(Wn,rr),s(Wn,ar),s(Wn,fr),s(Wn,_t),s(_t,Gn),s(_t,Bn),s(_t,zn),s(_t,Yn),s(_t,Vn),s(_t,Kn),Re(_t,t[3].q.m),s(Ye,cr),s(Ye,tn),s(tn,mr),s(tn,pr),s(tn,_r),s(tn,Tl),V(Tl,t[3].q.b),s(l,dr),it&&it.m(l,null),s(l,Fs),st&&st.m(l,null),s(l,Rs),ot&&ot.m(l,null),s(l,Us),s(l,ol),s(ol,is),s(ol,vr),s(ol,Qn),X(Xn,Qn,null),s(ol,hr),s(ol,di),s(ol,br),s(ol,vi);for(let $t=0;$t<yt.length;$t+=1)yt[$t].m(vi,null);s(l,gr),ut&&ut.m(l,null),s(l,Os),s(l,Mt),s(Mt,ss),s(Mt,kr),s(Mt,Zn),X(Jn,Zn,null),s(Mt,wr),s(Mt,hi),s(Mt,yr),s(Mt,os),s(os,us),s(us,Xt),Xt.checked=t[3].d.s,s(us,Cr),s(Mt,$r),Ct&&Ct.m(Mt,null),s(e,Tr),s(e,Ll),s(Ll,qs),s(qs,xn),s(Ll,Sr),s(Ll,rs),s(rs,ei),s(Ll,Pr),s(Ll,as),y(M,Hs,ee),X(ln,M,ee),y(M,js,ee),X(nn,M,ee),y(M,Ws,ee),X(sn,M,ee),y(M,Gs,ee),X(on,M,ee),Zt=!0,Bs||(Nr=[K($,"input",t[12]),K(E,"change",t[13]),K(W,"change",t[14]),K(ft,"change",t[15]),K(Ue,"input",t[16]),K(be,"input",t[17]),K(Tt,"change",t[18]),K(St,"change",t[20]),K(Ht,"change",t[23]),K(ll,"change",t[24]),K(ct,"change",t[25]),K(Dt,"input",t[26]),K(nl,"change",t[27]),K(jt,"input",t[28]),K(Wt,"input",t[29]),K(Gt,"change",t[30]),K(Bt,"change",t[33]),K(bl,"input",t[38]),K(gl,"input",t[39]),K(It,"change",t[40]),K(Et,"input",t[41]),K(zt,"change",t[42]),K(Yt,"change",t[43]),K(il,"change",t[44]),K(Pt,"input",t[45]),K(Nt,"change",t[46]),K(Vt,"change",t[50]),K(Kt,"change",t[51]),K(kl,"input",t[52]),K(wl,"input",t[54]),K(Qt,"input",t[55]),K(yl,"input",t[56]),K(Cl,"input",t[57]),K($l,"input",t[58]),K(_t,"change",t[59]),K(Tl,"input",t[60]),K(Xt,"change",t[89]),K(xn,"click",t[8]),K(ei,"click",t[10]),K(e,"submit",Ts(t[9]))],Bs=!0)},p(M,ee){if(ee[0]&8&&$.value!==M[3].g.h&&V($,M[3].g.h),ee[0]&8&&Re(E,M[3].g.t),ee[0]&8&&Re(W,M[3].p.r),ee[0]&8&&Re(ft,M[3].p.c),ee[0]&8&&ae(Ue.value)!==M[3].p.f&&V(Ue,M[3].p.f),ee[0]&8&&ae(be.value)!==M[3].p.m&&V(be,M[3].p.m),ee[0]&8&&(Tt.checked=M[3].p.e),M[3].p.e&&M[0].chip!="esp8266"?dt?dt.p(M,ee):(dt=sf(M),dt.c(),dt.m(dl,null)):dt&&(dt.d(1),dt=null),ee[0]&8&&Re(St,M[3].g.s),M[3].g.s>0?vt?vt.p(M,ee):(vt=of(M),vt.c(),vt.m(n,null)):vt&&(vt.d(1),vt=null),ee[0]&8&&(Ht.checked=M[3].m.i),(!Zt||ee[0]&8&&Li!==(Li=M[3].m.b!=0))&&(Il.disabled=Li),ee[0]&8&&Re(ll,M[3].m.b),(!Zt||ee[0]&8&&Ui!==(Ui=M[3].m.b!=0))&&(El.disabled=Ui),(!Zt||ee[0]&8&&Oi!==(Oi=M[3].m.b==0))&&(ct.disabled=Oi),ee[0]&8&&Re(ct,M[3].m.p),ee[0]&8&&ae(Dt.value)!==M[3].m.s&&V(Dt,M[3].m.s),ee[0]&8&&Re(nl,M[3].m.d),ee[0]&8&&ae(jt.value)!==M[3].m.f&&V(jt,M[3].m.f),ee[0]&8&&ae(Wt.value)!==M[3].m.r&&V(Wt,M[3].m.r),ee[0]&8&&(Gt.checked=M[3].m.e.e),M[3].m.e.e?ht?ht.p(M,ee):(ht=uf(M),ht.c(),ht.m(Vl,null)):ht&&(ht.d(1),ht=null),M[3].m.e.e?bt?bt.p(M,ee):(bt=rf(M),bt.c(),bt.m(qe,As)):bt&&(bt.d(1),bt=null),ee[0]&8&&(Bt.checked=M[3].m.m.e),M[3].m.m.e?gt?gt.p(M,ee):(gt=af(M),gt.c(),gt.m(qe,null)):gt&&(gt.d(1),gt=null),ee[0]&8&&bl.value!==M[3].w.s&&V(bl,M[3].w.s),ee[0]&8&&gl.value!==M[3].w.p&&V(gl,M[3].w.p),ee[0]&8&&Re(It,M[3].w.z),ee[0]&8&&ae(Et.value)!==M[3].w.w&&V(Et,M[3].w.w),ee[0]&8&&(zt.checked=M[3].w.a),ee[0]&8&&(Yt.checked=M[3].w.b),ee[0]&8&&Re(il,M[3].n.m),(!Zt||ee[0]&8&&Xi!==(Xi=M[3].n.m=="dhcp"))&&(Pt.disabled=Xi),(!Zt||ee[0]&8&&Zi!==(Zi=M[3].n.m=="static"))&&(Pt.required=Zi),ee[0]&8&&Pt.value!==M[3].n.i&&V(Pt,M[3].n.i),(!Zt||ee[0]&8&&Ji!==(Ji=M[3].n.m=="dhcp"))&&(Nt.disabled=Ji),(!Zt||ee[0]&8&&xi!==(xi=M[3].n.m=="static"))&&(Nt.required=xi),ee[0]&8&&Re(Nt,M[3].n.s),M[3].n.m=="static"?kt?kt.p(M,ee):(kt=ff(M),kt.c(),kt.m(at,Ds)):kt&&(kt.d(1),kt=null),ee[0]&8&&(Vt.checked=M[3].n.d),ee[0]&8&&(Kt.checked=M[3].n.h),ee[0]&8&&kl.value!==M[3].n.n1&&V(kl,M[3].n.n1),M[0].chip!="esp8266"?wt?wt.p(M,ee):(wt=cf(M),wt.c(),wt.m(sl,Is)):wt&&(wt.d(1),wt=null),ee[0]&8&&wl.value!==M[3].q.h&&V(wl,M[3].q.h),ee[0]&8&&ae(Qt.value)!==M[3].q.p&&V(Qt,M[3].q.p),M[3].q.s.e?nt?(nt.p(M,ee),ee[0]&8&&N(nt,1)):(nt=mf(M),nt.c(),N(nt,1),nt.m(Ye,Es)):nt&&(Te(),D(nt,1,1,()=>{nt=null}),Se()),ee[0]&8&&yl.value!==M[3].q.u&&V(yl,M[3].q.u),ee[0]&8&&Cl.value!==M[3].q.a&&V(Cl,M[3].q.a),ee[0]&8&&$l.value!==M[3].q.c&&V($l,M[3].q.c),ee[0]&8&&Re(_t,M[3].q.m),ee[0]&8&&Tl.value!==M[3].q.b&&V(Tl,M[3].q.b),M[3].q.m==3?it?(it.p(M,ee),ee[0]&8&&N(it,1)):(it=pf(M),it.c(),N(it,1),it.m(l,Fs)):it&&(Te(),D(it,1,1,()=>{it=null}),Se()),M[3].q.m==4?st?(st.p(M,ee),ee[0]&8&&N(st,1)):(st=_f(M),st.c(),N(st,1),st.m(l,Rs)):st&&(Te(),D(st,1,1,()=>{st=null}),Se()),ee[0]&8&&(Ls=M[3].p.r.startsWith("10YNO")||M[3].p.r=="10Y1001A1001A48H"),Ls?ot?(ot.p(M,ee),ee[0]&8&&N(ot,1)):(ot=df(M),ot.c(),N(ot,1),ot.m(l,Us)):ot&&(Te(),D(ot,1,1,()=>{ot=null}),Se()),ee[0]&136){ti=M[7];let Ft;for(Ft=0;Ft<ti.length;Ft+=1){const Ir=lf(M,ti,Ft);yt[Ft]?yt[Ft].p(Ir,ee):(yt[Ft]=hf(Ir),yt[Ft].c(),yt[Ft].m(vi,null))}for(;Ft<yt.length;Ft+=1)yt[Ft].d(1);yt.length=ti.length}M[0].board>20||M[0].chip=="esp8266"?ut?(ut.p(M,ee),ee[0]&1&&N(ut,1)):(ut=bf(M),ut.c(),N(ut,1),ut.m(l,Os)):ut&&(Te(),D(ut,1,1,()=>{ut=null}),Se()),ee[0]&8&&(Xt.checked=M[3].d.s),M[3].d.s?Ct?Ct.p(M,ee):(Ct=$f(M),Ct.c(),Ct.m(Mt,null)):Ct&&(Ct.d(1),Ct=null);const $t={};ee[0]&2&&($t.active=M[1]),ln.$set($t);const Mr={};ee[0]&4&&(Mr.active=M[2]),nn.$set(Mr);const Ar={};ee[0]&16&&(Ar.active=M[4]),sn.$set(Ar);const Dr={};ee[0]&32&&(Dr.active=M[5]),on.$set(Dr)},i(M){Zt||(N(a.$$.fragment,M),N(F.$$.fragment,M),N(_n.$$.fragment,M),N(Tn.$$.fragment,M),N(En.$$.fragment,M),N(Ln.$$.fragment,M),N(On.$$.fragment,M),N(nt),N(it),N(st),N(ot),N(Xn.$$.fragment,M),N(ut),N(Jn.$$.fragment,M),N(ln.$$.fragment,M),N(nn.$$.fragment,M),N(sn.$$.fragment,M),N(on.$$.fragment,M),Zt=!0)},o(M){D(a.$$.fragment,M),D(F.$$.fragment,M),D(_n.$$.fragment,M),D(Tn.$$.fragment,M),D(En.$$.fragment,M),D(Ln.$$.fragment,M),D(On.$$.fragment,M),D(nt),D(it),D(st),D(ot),D(Xn.$$.fragment,M),D(ut),D(Jn.$$.fragment,M),D(ln.$$.fragment,M),D(nn.$$.fragment,M),D(sn.$$.fragment,M),D(on.$$.fragment,M),Zt=!1},d(M){M&&w(e),Z(a),Z(F),ml(fs,M),dt&&dt.d(),vt&&vt.d(),Z(_n),ml(cs,M),ht&&ht.d(),bt&&bt.d(),gt&&gt.d(),Z(Tn),Z(En),Z(Ln),kt&&kt.d(),Z(On),wt&&wt.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),Z(Xn),ml(yt,M),ut&&ut.d(),Z(Jn),Ct&&Ct.d(),M&&w(Hs),Z(ln,M),M&&w(js),Z(nn,M),M&&w(Ws),Z(sn,M),M&&w(Gs),Z(on,M),Bs=!1,Ve(Nr)}}}async function Zp(){await(await fetch("/reboot",{method:"POST"})).json()}function Jp(t,e,l){let{sysinfo:n={}}=e,i=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"}],o=!0,r=!1,a={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""}};qc.subscribe(Be=>{Be.version&&(l(3,a=Be),l(1,o=!1))}),Sp();let f=!1,c=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,f=!0);const Be=new URLSearchParams;Be.append("perform","true");let Gl=await(await fetch("/reset",{method:"POST",body:Be})).json();l(4,f=!1),l(5,c=Gl.success)}}async function _(Be){l(2,r=!0);const hl=new FormData(Be.target),Gl=new URLSearchParams;for(let el of hl){const[Fi,Al]=el;Gl.append(Fi,Al)}let qe=await(await fetch("/save",{method:"POST",body:Gl})).json();Ut.update(el=>(el.booting=qe.reboot,el.ui=a.u,el)),l(2,r=!1),ii("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(Be=>(Be.booting=!0,Be)),Zp())},d=function(){a.q.s.e?a.q.p==1883&&l(3,a.q.p=8883,a):a.q.p==8883&&l(3,a.q.p=1883,a)};let v=44;function g(){a.g.h=this.value,l(3,a)}function k(){a.g.t=mt(this),l(3,a)}function $(){a.p.r=mt(this),l(3,a)}function T(){a.p.c=mt(this),l(3,a)}function P(){a.p.f=ae(this.value),l(3,a)}function I(){a.p.m=ae(this.value),l(3,a)}function S(){a.p.e=this.checked,l(3,a)}function A(){a.p.t=this.value,l(3,a)}function E(){a.g.s=mt(this),l(3,a)}function F(){a.g.u=this.value,l(3,a)}function Y(){a.g.p=this.value,l(3,a)}function U(){a.m.i=this.checked,l(3,a)}function R(){a.m.b=mt(this),l(3,a)}function q(){a.m.p=mt(this),l(3,a)}function z(){a.m.s=ae(this.value),l(3,a)}function O(){a.m.d=mt(this),l(3,a)}function H(){a.m.f=ae(this.value),l(3,a)}function G(){a.m.r=ae(this.value),l(3,a)}function L(){a.m.e.e=this.checked,l(3,a)}function W(){a.m.e.k=this.value,l(3,a)}function j(){a.m.e.a=this.value,l(3,a)}function te(){a.m.m.e=this.checked,l(3,a)}function le(){a.m.m.w=ae(this.value),l(3,a)}function de(){a.m.m.v=ae(this.value),l(3,a)}function ie(){a.m.m.a=ae(this.value),l(3,a)}function we(){a.m.m.c=ae(this.value),l(3,a)}function Ie(){a.w.s=this.value,l(3,a)}function $e(){a.w.p=this.value,l(3,a)}function Ee(){a.w.z=mt(this),l(3,a)}function ve(){a.w.w=ae(this.value),l(3,a)}function Pe(){a.w.a=this.checked,l(3,a)}function Ae(){a.w.b=this.checked,l(3,a)}function me(){a.n.m=mt(this),l(3,a)}function se(){a.n.i=this.value,l(3,a)}function pe(){a.n.s=mt(this),l(3,a)}function Q(){a.n.g=this.value,l(3,a)}function oe(){a.n.d1=this.value,l(3,a)}function Ne(){a.n.d2=this.value,l(3,a)}function Me(){a.n.d=this.checked,l(3,a)}function he(){a.n.h=this.checked,l(3,a)}function x(){a.n.n1=this.value,l(3,a)}function _e(){a.q.s.e=this.checked,l(3,a)}function Le(){a.q.h=this.value,l(3,a)}function je(){a.q.p=ae(this.value),l(3,a)}function Ke(){a.q.u=this.value,l(3,a)}function Fe(){a.q.a=this.value,l(3,a)}function He(){a.q.c=this.value,l(3,a)}function re(){a.q.m=mt(this),l(3,a)}function ge(){a.q.b=this.value,l(3,a)}function Ot(){a.o.e=this.value,l(3,a)}function Wl(){a.o.c=this.value,l(3,a)}function xt(){a.o.u1=this.value,l(3,a)}function ft(){a.o.u2=this.value,l(3,a)}function Nl(){a.o.u3=this.value,l(3,a)}function _l(){a.h.t=this.value,l(3,a)}function qt(){a.h.h=this.value,l(3,a)}function pt(){a.h.n=this.value,l(3,a)}function Qe(Be){a.t.t[Be]=ae(this.value),l(3,a)}function Xe(){a.t.h=ae(this.value),l(3,a)}function Ze(Be){a.u[Be.key]=mt(this),l(3,a)}function Ue(){a.i.h.u=this.checked,l(3,a)}function Je(){a.i.h.p=mt(this),l(3,a)}function Ge(){a.i.a=ae(this.value),l(3,a)}function xe(){a.i.l.i=this.checked,l(3,a)}function et(){a.i.l.p=ae(this.value),l(3,a)}function ue(){a.i.r.i=this.checked,l(3,a)}function be(){a.i.r.r=ae(this.value),l(3,a)}function Pi(){a.i.r.g=ae(this.value),l(3,a)}function dl(){a.i.r.b=ae(this.value),l(3,a)}function pn(){a.i.t.d=ae(this.value),l(3,a)}function Tt(){a.i.t.a=ae(this.value),l(3,a)}function Ni(){a.i.v.p=ae(this.value),l(3,a)}function Mi(){a.i.v.d.v=ae(this.value),l(3,a)}function Ai(){a.i.v.d.g=ae(this.value),l(3,a)}function vl(){a.i.v.o=ae(this.value),l(3,a)}function Di(){a.i.v.m=ae(this.value),l(3,a)}function Ii(){a.i.v.b=ae(this.value),l(3,a)}function Ei(){a.d.s=this.checked,l(3,a)}function St(){a.d.t=this.checked,l(3,a)}function Ml(){a.d.l=mt(this),l(3,a)}return t.$$set=Be=>{"sysinfo"in Be&&l(0,n=Be.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,v=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,r,a,f,c,v,i,p,_,b,d,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G,L,W,j,te,le,de,ie,we,Ie,$e,Ee,ve,Pe,Ae,me,se,pe,Q,oe,Ne,Me,he,x,_e,Le,je,Ke,Fe,He,re,ge,Ot,Wl,xt,ft,Nl,_l,qt,pt,Qe,Xe,Ze,Ue,Je,Ge,xe,et,ue,be,Pi,dl,pn,Tt,Ni,Mi,Ai,vl,Di,Ii,Ei,St,Ml]}class xp extends Ce{constructor(e){super(),ye(this,e,Jp,Xp,ke,{sysinfo:0},null,[-1,-1,-1,-1])}}function Sf(t,e,l){const n=t.slice();return n[20]=e[l],n}function e0(t){let e=fe(t[1].chip,t[1].board)+"",l;return{c(){l=C(e)},m(n,i){y(n,l,i)},p(n,i){i&2&&e!==(e=fe(n[1].chip,n[1].board)+"")&&B(l,e)},d(n){n&&w(l)}}}function Pf(t){let e,l,n=t[1].apmac+"",i,o,r,a,f,c,p,_,b,d=Qr(t[1])+"",v,g,k=t[1].boot_reason+"",$,T,P=t[1].ex_cause+"",I,S,A;const E=[l0,t0],F=[];function Y(U,R){return U[0].u>0?0:1}return f=Y(t),c=F[f]=E[f](t),{c(){e=m("div"),l=C("AP MAC: "),i=C(n),o=h(),r=m("div"),a=C(`Last boot:\r
`),c.c(),p=h(),_=m("div"),b=C("Reason: "),v=C(d),g=C(" ("),$=C(k),T=C("/"),I=C(P),S=C(")"),u(e,"class","my-2"),u(r,"class","my-2"),u(_,"class","my-2")},m(U,R){y(U,e,R),s(e,l),s(e,i),y(U,o,R),y(U,r,R),s(r,a),F[f].m(r,null),y(U,p,R),y(U,_,R),s(_,b),s(_,v),s(_,g),s(_,$),s(_,T),s(_,I),s(_,S),A=!0},p(U,R){(!A||R&2)&&n!==(n=U[1].apmac+"")&&B(i,n);let q=f;f=Y(U),f===q?F[f].p(U,R):(Te(),D(F[q],1,1,()=>{F[q]=null}),Se(),c=F[f],c?c.p(U,R):(c=F[f]=E[f](U),c.c()),N(c,1),c.m(r,null)),(!A||R&2)&&d!==(d=Qr(U[1])+"")&&B(v,d),(!A||R&2)&&k!==(k=U[1].boot_reason+"")&&B($,k),(!A||R&2)&&P!==(P=U[1].ex_cause+"")&&B(I,P)},i(U){A||(N(c),A=!0)},o(U){D(c),A=!1},d(U){U&&w(e),U&&w(o),U&&w(r),F[f].d(),U&&w(p),U&&w(_)}}}function t0(t){let e;return{c(){e=C("-")},m(l,n){y(l,e,n)},p:ne,i:ne,o:ne,d(l){l&&w(e)}}}function l0(t){let e,l;return e=new Lc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-n[0].u*1e3)),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function n0(t){let e;return{c(){e=m("span"),e.textContent="Update consents",u(e,"class","btn-pri-sm")},m(l,n){y(l,e,n)},p:ne,d(l){l&&w(e)}}}function Nf(t){let e,l,n,i,o,r=Cs(t[1].meter.mfg)+"",a,f,c,p,_=t[1].meter.model+"",b,d,v,g,k=t[1].meter.id+"",$;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=C("Manufacturer: "),a=C(r),f=h(),c=m("div"),p=C("Model: "),b=C(_),d=h(),v=m("div"),g=C("ID: "),$=C(k),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(e,"class","cnt")},m(T,P){y(T,e,P),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$)},p(T,P){P&2&&r!==(r=Cs(T[1].meter.mfg)+"")&&B(a,r),P&2&&_!==(_=T[1].meter.model+"")&&B(b,_),P&2&&k!==(k=T[1].meter.id+"")&&B($,k)},d(T){T&&w(e)}}}function Mf(t){let e,l,n,i,o,r=t[1].net.ip+"",a,f,c,p,_=t[1].net.mask+"",b,d,v,g,k=t[1].net.gw+"",$,T,P,I,S=t[1].net.dns1+"",A,E,F=t[1].net.dns2&&Af(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=C("IP: "),a=C(r),f=h(),c=m("div"),p=C("Mask: "),b=C(_),d=h(),v=m("div"),g=C("Gateway: "),$=C(k),T=h(),P=m("div"),I=C("DNS: "),A=C(S),E=h(),F&&F.c(),u(l,"class","text-sm"),u(i,"class","my-2"),u(c,"class","my-2"),u(v,"class","my-2"),u(P,"class","my-2"),u(e,"class","cnt")},m(Y,U){y(Y,e,U),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(e,f),s(e,c),s(c,p),s(c,b),s(e,d),s(e,v),s(v,g),s(v,$),s(e,T),s(e,P),s(P,I),s(P,A),s(P,E),F&&F.m(P,null)},p(Y,U){U&2&&r!==(r=Y[1].net.ip+"")&&B(a,r),U&2&&_!==(_=Y[1].net.mask+"")&&B(b,_),U&2&&k!==(k=Y[1].net.gw+"")&&B($,k),U&2&&S!==(S=Y[1].net.dns1+"")&&B(A,S),Y[1].net.dns2?F?F.p(Y,U):(F=Af(Y),F.c(),F.m(P,null)):F&&(F.d(1),F=null)},d(Y){Y&&w(e),F&&F.d()}}}function Af(t){let e,l=t[1].net.dns2+"",n;return{c(){e=C("/ "),n=C(l)},m(i,o){y(i,e,o),y(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&B(n,l)},d(i){i&&w(e),i&&w(n)}}}function Df(t){let e,l,n,i=t[1].upgrade.t+"",o,r,a=t[1].version+"",f,c,p=t[1].upgrade.x+"",_,b,d=t[1].upgrade.e+"",v,g;return{c(){e=m("div"),l=m("div"),n=C("Previous upgrade attempt ("),o=C(i),r=C(") does not match current version ("),f=C(a),c=C(") ["),_=C(p),b=C("/"),v=C(d),g=C("]"),u(l,"class","bd-yellow"),u(e,"class","my-2")},m(k,$){y(k,e,$),s(e,l),s(l,n),s(l,o),s(l,r),s(l,f),s(l,c),s(l,_),s(l,b),s(l,v),s(l,g)},p(k,$){$&2&&i!==(i=k[1].upgrade.t+"")&&B(o,i),$&2&&a!==(a=k[1].version+"")&&B(f,a),$&2&&p!==(p=k[1].upgrade.x+"")&&B(_,p),$&2&&d!==(d=k[1].upgrade.e+"")&&B(v,d)},d(k){k&&w(e)}}}function If(t){let e,l,n,i=t[2].tag_name+"",o,r,a,f,c,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Ef(t),b=t[1].fwconsent===2&&Ff();return{c(){e=m("div"),l=C(`Latest version: \r
`),n=m("a"),o=C(i),a=h(),_&&_.c(),f=h(),b&&b.c(),c=We(),u(n,"href",r=t[2].html_url),u(n,"class","ml-2 text-blue-600 hover:text-blue-800"),u(n,"target","_blank"),u(n,"rel","noreferrer"),u(e,"class","my-2 flex")},m(d,v){y(d,e,v),s(e,l),s(e,n),s(n,o),s(e,a),_&&_.m(e,null),y(d,f,v),b&&b.m(d,v),y(d,c,v),p=!0},p(d,v){(!p||v&4)&&i!==(i=d[2].tag_name+"")&&B(o,i),(!p||v&4&&r!==(r=d[2].html_url))&&u(n,"href",r),(d[1].security==0||d[0].a)&&d[1].fwconsent===1&&d[2]&&d[2].tag_name!=d[1].version?_?(_.p(d,v),v&7&&N(_,1)):(_=Ef(d),_.c(),N(_,1),_.m(e,null)):_&&(Te(),D(_,1,1,()=>{_=null}),Se()),d[1].fwconsent===2?b||(b=Ff(),b.c(),b.m(c.parentNode,c)):b&&(b.d(1),b=null)},i(d){p||(N(_),p=!0)},o(d){D(_),p=!1},d(d){d&&w(e),_&&_.d(),d&&w(f),b&&b.d(d),d&&w(c)}}}function Ef(t){let e,l,n,i,o,r;return n=new Uc({}),{c(){e=m("div"),l=m("button"),J(n.$$.fragment),u(e,"class","flex-none ml-2 text-green-500"),u(e,"title","Install this version")},m(a,f){y(a,e,f),s(e,l),X(n,l,null),i=!0,o||(r=K(l,"click",t[10]),o=!0)},p:ne,i(a){i||(N(n.$$.fragment,a),i=!0)},o(a){D(n.$$.fragment,a),i=!1},d(a){a&&w(e),Z(n),o=!1,r()}}}function Ff(t){let e;return{c(){e=m("div"),e.innerHTML='<div class="bd-yellow">You have disabled one-click firmware upgrade, link to self-upgrade is disabled</div>',u(e,"class","my-2")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Rf(t){let e,l=$s(fe(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=C(l),u(e,"class","bd-red")},m(i,o){y(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=$s(fe(i[1].chip,i[1].board))+"")&&B(n,l)},d(i){i&&w(e)}}}function Lf(t){let e,l,n,i,o,r;function a(p,_){return p[4].length==0?s0:i0}let f=a(t),c=f(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),c.c(),Jf(n,"display","none"),u(n,"name","file"),u(n,"type","file"),u(n,"accept",".bin"),u(l,"action","/firmware"),u(l,"enctype","multipart/form-data"),u(l,"method","post"),u(l,"autocomplete","off"),u(e,"class","my-2 flex")},m(p,_){y(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),c.m(l,null),o||(r=[K(n,"change",t[13]),K(l,"submit",t[15])],o=!0)},p(p,_){f===(f=a(p))&&c?c.p(p,_):(c.d(1),c=f(p),c&&(c.c(),c.m(l,null)))},d(p){p&&w(e),t[12](null),c.d(),o=!1,Ve(r)}}}function i0(t){let e=t[4][0].name+"",l,n,i;return{c(){l=C(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm float-right")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&16&&e!==(e=o[4][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function s0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",u(e,"type","button"),u(e,"class","btn-pri-sm float-right")},m(i,o){y(i,e,o),l||(n=K(e,"click",t[14]),l=!0)},p:ne,d(i){i&&w(e),l=!1,n()}}}function Uf(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g=t[9],k=[];for(let S=0;S<g.length;S+=1)k[S]=Of(Sf(t,g,S));let $=t[7].length==0&&qf();function T(S,A){return S[7].length==0?u0:o0}let P=T(t),I=P(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Backup & restore",n=h(),i=m("form"),o=m("div");for(let S=0;S<k.length;S+=1)k[S].c();r=h(),a=m("label"),a.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',f=h(),$&&$.c(),c=h(),p=m("form"),_=m("input"),b=h(),I.c(),u(l,"class","text-sm"),u(a,"class","my-1 mx-3 col-span-2"),u(o,"class","grid grid-cols-2"),u(i,"method","get"),u(i,"action","/configfile.cfg"),u(i,"autocomplete","off"),Jf(_,"display","none"),u(_,"name","file"),u(_,"type","file"),u(_,"accept",".cfg"),u(p,"action","/configfile"),u(p,"enctype","multipart/form-data"),u(p,"method","post"),u(p,"autocomplete","off"),u(e,"class","cnt")},m(S,A){y(S,e,A),s(e,l),s(e,n),s(e,i),s(i,o);for(let E=0;E<k.length;E+=1)k[E].m(o,null);s(o,r),s(o,a),s(i,f),$&&$.m(i,null),s(e,c),s(e,p),s(p,_),t[16](_),s(p,b),I.m(p,null),d||(v=[K(_,"change",t[17]),K(p,"submit",t[19])],d=!0)},p(S,A){if(A&512){g=S[9];let E;for(E=0;E<g.length;E+=1){const F=Sf(S,g,E);k[E]?k[E].p(F,A):(k[E]=Of(F),k[E].c(),k[E].m(o,r))}for(;E<k.length;E+=1)k[E].d(1);k.length=g.length}S[7].length==0?$||($=qf(),$.c(),$.m(i,null)):$&&($.d(1),$=null),P===(P=T(S))&&I?I.p(S,A):(I.d(1),I=P(S),I&&(I.c(),I.m(p,null)))},d(S){S&&w(e),ml(k,S),$&&$.d(),t[16](null),I.d(),d=!1,Ve(v)}}}function Of(t){let e,l,n,i=t[20].name+"",o;return{c(){e=m("label"),l=m("input"),n=h(),o=C(i),u(l,"type","checkbox"),u(l,"class","rounded"),u(l,"name",t[20].key),l.value="true",l.checked=!0,u(e,"class","my-1 mx-3")},m(r,a){y(r,e,a),s(e,l),s(e,n),s(e,o)},p:ne,d(r){r&&w(e)}}}function qf(t){let e;return{c(){e=m("button"),e.textContent="Download",u(e,"type","submit"),u(e,"class","btn-pri-sm float-right")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function o0(t){let e=t[7][0].name+"",l,n,i;return{c(){l=C(e),n=h(),i=m("button"),i.textContent="Upload",u(i,"type","submit"),u(i,"class","btn-pri-sm")},m(o,r){y(o,l,r),y(o,n,r),y(o,i,r)},p(o,r){r&128&&e!==(e=o[7][0].name+"")&&B(l,e)},d(o){o&&w(l),o&&w(n),o&&w(i)}}}function u0(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select file...",u(e,"type","button"),u(e,"class","btn-pri-sm")},m(i,o){y(i,e,o),l||(n=K(e,"click",t[18]),l=!0)},p:ne,d(i){i&&w(e),l=!1,n()}}}function r0(t){let e,l,n,i,o,r,a=t[1].chip+"",f,c,p,_,b,d,v,g,k=t[1].mac+"",$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H,G=t[1].version+"",L,W,j,te,le=(t[1].security==0||t[0].a)&&si(t[1].board),de,ie,we,Ie,$e,Ee,ve,Pe,Ae;b=new Ol({props:{to:"/vendor",$$slots:{default:[e0]},$$scope:{ctx:t}}});let me=t[1].apmac&&t[1].apmac!=t[1].mac&&Pf(t);S=new Ol({props:{to:"/consent",$$slots:{default:[n0]},$$scope:{ctx:t}}});let se=t[1].meter&&Nf(t),pe=t[1].net&&Mf(t),Q=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&Df(t),oe=t[2]&&If(t),Ne=le&&Rf(t),Me=(t[1].security==0||t[0].a)&&Lf(t),he=(t[1].security==0||t[0].a)&&Uf(t);return Ie=new At({props:{active:t[5],message:"Uploading firmware, please wait"}}),Ee=new At({props:{active:t[8],message:"Uploading configuration, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),n.textContent="Device information",i=h(),o=m("div"),r=C("Chip: "),f=C(a),c=h(),p=m("div"),_=C("Device: "),J(b.$$.fragment),d=h(),v=m("div"),g=C("MAC: "),$=C(k),T=h(),me&&me.c(),P=h(),I=m("div"),J(S.$$.fragment),A=h(),E=m("button"),E.textContent="Reboot",F=h(),se&&se.c(),Y=h(),pe&&pe.c(),U=h(),R=m("div"),q=m("strong"),q.textContent="Firmware",z=h(),O=m("div"),H=C("Installed version: "),L=C(G),W=h(),Q&&Q.c(),j=h(),oe&&oe.c(),te=h(),Ne&&Ne.c(),de=h(),Me&&Me.c(),ie=h(),he&&he.c(),we=h(),J(Ie.$$.fragment),$e=h(),J(Ee.$$.fragment),u(n,"class","text-sm"),u(o,"class","my-2"),u(p,"class","my-2"),u(v,"class","my-2"),u(E,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),u(I,"class","my-2"),u(l,"class","cnt"),u(q,"class","text-sm"),u(O,"class","my-2"),u(R,"class","cnt"),u(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(x,_e){y(x,e,_e),s(e,l),s(l,n),s(l,i),s(l,o),s(o,r),s(o,f),s(l,c),s(l,p),s(p,_),X(b,p,null),s(l,d),s(l,v),s(v,g),s(v,$),s(l,T),me&&me.m(l,null),s(l,P),s(l,I),X(S,I,null),s(I,A),s(I,E),s(e,F),se&&se.m(e,null),s(e,Y),pe&&pe.m(e,null),s(e,U),s(e,R),s(R,q),s(R,z),s(R,O),s(O,H),s(O,L),s(R,W),Q&&Q.m(R,null),s(R,j),oe&&oe.m(R,null),s(R,te),Ne&&Ne.m(R,null),s(R,de),Me&&Me.m(R,null),s(e,ie),he&&he.m(e,null),y(x,we,_e),X(Ie,x,_e),y(x,$e,_e),X(Ee,x,_e),ve=!0,Pe||(Ae=K(E,"click",t[11]),Pe=!0)},p(x,[_e]){(!ve||_e&2)&&a!==(a=x[1].chip+"")&&B(f,a);const Le={};_e&8388610&&(Le.$$scope={dirty:_e,ctx:x}),b.$set(Le),(!ve||_e&2)&&k!==(k=x[1].mac+"")&&B($,k),x[1].apmac&&x[1].apmac!=x[1].mac?me?(me.p(x,_e),_e&2&&N(me,1)):(me=Pf(x),me.c(),N(me,1),me.m(l,P)):me&&(Te(),D(me,1,1,()=>{me=null}),Se());const je={};_e&8388608&&(je.$$scope={dirty:_e,ctx:x}),S.$set(je),x[1].meter?se?se.p(x,_e):(se=Nf(x),se.c(),se.m(e,Y)):se&&(se.d(1),se=null),x[1].net?pe?pe.p(x,_e):(pe=Mf(x),pe.c(),pe.m(e,U)):pe&&(pe.d(1),pe=null),(!ve||_e&2)&&G!==(G=x[1].version+"")&&B(L,G),x[1].upgrade.t&&x[1].upgrade.t!=x[1].version?Q?Q.p(x,_e):(Q=Df(x),Q.c(),Q.m(R,j)):Q&&(Q.d(1),Q=null),x[2]?oe?(oe.p(x,_e),_e&4&&N(oe,1)):(oe=If(x),oe.c(),N(oe,1),oe.m(R,te)):oe&&(Te(),D(oe,1,1,()=>{oe=null}),Se()),_e&3&&(le=(x[1].security==0||x[0].a)&&si(x[1].board)),le?Ne?Ne.p(x,_e):(Ne=Rf(x),Ne.c(),Ne.m(R,de)):Ne&&(Ne.d(1),Ne=null),x[1].security==0||x[0].a?Me?Me.p(x,_e):(Me=Lf(x),Me.c(),Me.m(R,null)):Me&&(Me.d(1),Me=null),x[1].security==0||x[0].a?he?he.p(x,_e):(he=Uf(x),he.c(),he.m(e,null)):he&&(he.d(1),he=null);const Ke={};_e&32&&(Ke.active=x[5]),Ie.$set(Ke);const Fe={};_e&256&&(Fe.active=x[8]),Ee.$set(Fe)},i(x){ve||(N(b.$$.fragment,x),N(me),N(S.$$.fragment,x),N(oe),N(Ie.$$.fragment,x),N(Ee.$$.fragment,x),ve=!0)},o(x){D(b.$$.fragment,x),D(me),D(S.$$.fragment,x),D(oe),D(Ie.$$.fragment,x),D(Ee.$$.fragment,x),ve=!1},d(x){x&&w(e),Z(b),me&&me.d(),Z(S),se&&se.d(),pe&&pe.d(),Q&&Q.d(),oe&&oe.d(),Ne&&Ne.d(),Me&&Me.d(),he&&he.d(),x&&w(we),Z(Ie,x),x&&w($e),Z(Ee,x),Pe=!1,Ae()}}}async function a0(){await(await fetch("/reboot",{method:"POST"})).json()}function f0(t,e,l){let{data:n}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],r={};yo.subscribe(E=>{l(2,r=Rc(i.version,E)),r||l(2,r=E[0])});function a(){confirm("Do you want to upgrade this device to "+r.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm($s(fe(i.chip,i.board))))&&(Ut.update(E=>(E.upgrading=!0,E)),Fc(r.tag_name))}const f=function(){confirm("Are you sure you want to reboot the device?")&&(Ut.update(E=>(E.booting=!0,E)),a0())};let c,p=[],_=!1,b,d=[],v=!1;go();function g(E){ws[E?"unshift":"push"](()=>{c=E,l(3,c)})}function k(){p=this.files,l(4,p)}const $=()=>{c.click()},T=()=>l(5,_=!0);function P(E){ws[E?"unshift":"push"](()=>{b=E,l(6,b)})}function I(){d=this.files,l(7,d)}const S=()=>{b.click()},A=()=>l(8,v=!0);return t.$$set=E=>{"data"in E&&l(0,n=E.data),"sysinfo"in E&&l(1,i=E.sysinfo)},[n,i,r,c,p,_,b,d,v,o,a,f,g,k,$,T,P,I,S,A]}class c0 extends Ce{constructor(e){super(),ye(this,e,f0,r0,ke,{data:0,sysinfo:1})}}function Hf(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],5)+"",a,f,c=fe(t[0],4)+"",p,_,b=fe(t[0],3)+"",d,v,g,k,$=fe(t[0],2)+"",T,P,I=fe(t[0],1)+"",S,A,E=fe(t[0],0)+"",F,Y,U,R,q=fe(t[0],101)+"",z,O,H=fe(t[0],100)+"",G;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),v=h(),g=m("optgroup"),k=m("option"),T=C($),P=m("option"),S=C(I),A=m("option"),F=C(E),Y=h(),U=m("optgroup"),R=m("option"),z=C(q),O=m("option"),G=C(H),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,f.__value=4,f.value=f.__value,_.__value=3,_.value=_.__value,u(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,P.__value=1,P.value=P.__value,A.__value=0,A.value=A.__value,u(g,"label","Custom hardware"),R.__value=101,R.value=R.__value,O.__value=100,O.value=O.__value,u(U,"label","Generic hardware")},m(L,W){y(L,e,W),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d),y(L,v,W),y(L,g,W),s(g,k),s(k,T),s(g,P),s(P,S),s(g,A),s(A,F),y(L,Y,W),y(L,U,W),s(U,R),s(R,z),s(U,O),s(O,G)},p(L,W){W&1&&n!==(n=fe(L[0],7)+"")&&B(i,n),W&1&&r!==(r=fe(L[0],5)+"")&&B(a,r),W&1&&c!==(c=fe(L[0],4)+"")&&B(p,c),W&1&&b!==(b=fe(L[0],3)+"")&&B(d,b),W&1&&$!==($=fe(L[0],2)+"")&&B(T,$),W&1&&I!==(I=fe(L[0],1)+"")&&B(S,I),W&1&&E!==(E=fe(L[0],0)+"")&&B(F,E),W&1&&q!==(q=fe(L[0],101)+"")&&B(z,q),W&1&&H!==(H=fe(L[0],100)+"")&&B(G,H)},d(L){L&&w(e),L&&w(v),L&&w(g),L&&w(Y),L&&w(U)}}}function jf(t){let e,l,n=fe(t[0],201)+"",i,o,r=fe(t[0],202)+"",a,f,c=fe(t[0],203)+"",p,_,b=fe(t[0],200)+"",d;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=m("option"),d=C(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,f.__value=203,f.value=f.__value,_.__value=200,_.value=_.__value,u(e,"label","Generic hardware")},m(v,g){y(v,e,g),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),s(e,_),s(_,d)},p(v,g){g&1&&n!==(n=fe(v[0],201)+"")&&B(i,n),g&1&&r!==(r=fe(v[0],202)+"")&&B(a,r),g&1&&c!==(c=fe(v[0],203)+"")&&B(p,c),g&1&&b!==(b=fe(v[0],200)+"")&&B(d,b)},d(v){v&&w(e)}}}function Wf(t){let e,l,n=fe(t[0],7)+"",i,o,r=fe(t[0],6)+"",a,f,c=fe(t[0],5)+"",p,_,b,d,v=fe(t[0],51)+"",g,k,$=fe(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=m("option"),a=C(r),f=m("option"),p=C(c),_=h(),b=m("optgroup"),d=m("option"),g=C(v),k=m("option"),T=C($),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,f.__value=5,f.value=f.__value,u(e,"label","amsleser.no"),d.__value=51,d.value=d.__value,k.__value=50,k.value=k.__value,u(b,"label","Generic hardware")},m(P,I){y(P,e,I),s(e,l),s(l,i),s(e,o),s(o,a),s(e,f),s(f,p),y(P,_,I),y(P,b,I),s(b,d),s(d,g),s(b,k),s(k,T)},p(P,I){I&1&&n!==(n=fe(P[0],7)+"")&&B(i,n),I&1&&r!==(r=fe(P[0],6)+"")&&B(a,r),I&1&&c!==(c=fe(P[0],5)+"")&&B(p,c),I&1&&v!==(v=fe(P[0],51)+"")&&B(g,v),I&1&&$!==($=fe(P[0],50)+"")&&B(T,$)},d(P){P&&w(e),P&&w(_),P&&w(b)}}}function Gf(t){let e,l,n=fe(t[0],8)+"",i,o,r,a,f=fe(t[0],71)+"",c,p,_=fe(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=C(n),o=h(),r=m("optgroup"),a=m("option"),c=C(f),p=m("option"),b=C(_),l.__value=8,l.value=l.__value,u(e,"label","Custom hardware"),a.__value=71,a.value=a.__value,p.__value=70,p.value=p.__value,u(r,"label","Generic hardware")},m(d,v){y(d,e,v),s(e,l),s(l,i),y(d,o,v),y(d,r,v),s(r,a),s(a,c),s(r,p),s(p,b)},p(d,v){v&1&&n!==(n=fe(d[0],8)+"")&&B(i,n),v&1&&f!==(f=fe(d[0],71)+"")&&B(c,f),v&1&&_!==(_=fe(d[0],70)+"")&&B(b,_)},d(d){d&&w(e),d&&w(o),d&&w(r)}}}function Bf(t){let e,l,n=fe(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=C(n),l.__value=200,l.value=l.__value,u(e,"label","Generic hardware")},m(o,r){y(o,e,r),s(e,l),s(l,i)},p(o,r){r&1&&n!==(n=fe(o[0],200)+"")&&B(i,n)},d(o){o&&w(e)}}}function m0(t){let e,l,n,i,o,r,a,f=t[0]=="esp8266"&&Hf(t),c=t[0]=="esp32"&&jf(t),p=t[0]=="esp32s2"&&Wf(t),_=t[0]=="esp32c3"&&Gf(t),b=t[0]=="esp32solo"&&Bf(t);return{c(){e=m("option"),l=h(),f&&f.c(),n=h(),c&&c.c(),i=h(),p&&p.c(),o=h(),_&&_.c(),r=h(),b&&b.c(),a=We(),e.__value=-1,e.value=e.__value},m(d,v){y(d,e,v),y(d,l,v),f&&f.m(d,v),y(d,n,v),c&&c.m(d,v),y(d,i,v),p&&p.m(d,v),y(d,o,v),_&&_.m(d,v),y(d,r,v),b&&b.m(d,v),y(d,a,v)},p(d,[v]){d[0]=="esp8266"?f?f.p(d,v):(f=Hf(d),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"?c?c.p(d,v):(c=jf(d),c.c(),c.m(i.parentNode,i)):c&&(c.d(1),c=null),d[0]=="esp32s2"?p?p.p(d,v):(p=Wf(d),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),d[0]=="esp32c3"?_?_.p(d,v):(_=Gf(d),_.c(),_.m(r.parentNode,r)):_&&(_.d(1),_=null),d[0]=="esp32solo"?b?b.p(d,v):(b=Bf(d),b.c(),b.m(a.parentNode,a)):b&&(b.d(1),b=null)},i:ne,o:ne,d(d){d&&w(e),d&&w(l),f&&f.d(d),d&&w(n),c&&c.d(d),d&&w(i),p&&p.d(d),d&&w(o),_&&_.d(d),d&&w(r),b&&b.d(d),d&&w(a)}}}function p0(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class _0 extends Ce{constructor(e){super(),ye(this,e,p0,m0,ke,{chip:0})}}function zf(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",u(e,"class","bd-red")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function Yf(t){let e,l,n,i,o,r,a;return r=new Hc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=C("HAN GPIO"),n=m("br"),i=h(),o=m("select"),J(r.$$.fragment),u(o,"name","vh"),u(o,"class","in-s"),u(e,"class","my-3")},m(f,c){y(f,e,c),s(e,l),s(e,n),s(e,i),s(e,o),X(r,o,null),a=!0},p(f,c){const p={};c&1&&(p.chip=f[0].chip),r.$set(p)},i(f){a||(N(r.$$.fragment,f),a=!0)},o(f){D(r.$$.fragment,f),a=!1},d(f){f&&w(e),Z(r)}}}function d0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O=t[0].usrcfg&&zf();v=new _0({props:{chip:t[0].chip}});let H=t[0].board&&t[0].board>20&&Yf(t);return U=new At({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Initial configuration",a=h(),O&&O.c(),f=h(),c=m("div"),p=C("Board type"),_=m("br"),b=h(),d=m("select"),J(v.$$.fragment),g=h(),H&&H.c(),k=h(),$=m("div"),T=m("label"),P=m("input"),I=C(" Clear all other configuration"),S=h(),A=m("div"),A.innerHTML='<button type="submit" class="btn-pri">Save</button>',E=h(),F=m("span"),F.textContent="\xA0",Y=h(),J(U.$$.fragment),u(i,"type","hidden"),u(i,"name","v"),i.value="true",u(r,"class","text-sm"),u(d,"name","vb"),u(d,"class","in-s"),t[0].board===void 0&&tt(()=>t[4].call(d)),u(c,"class","my-3"),u(P,"type","checkbox"),u(P,"name","vr"),P.__value="true",P.value=P.__value,u(P,"class","rounded mb-1"),u($,"class","my-3"),u(A,"class","my-3"),u(F,"class","clear-both"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),O&&O.m(n,null),s(n,f),s(n,c),s(c,p),s(c,_),s(c,b),s(c,d),X(v,d,null),Re(d,t[0].board),s(n,g),H&&H.m(n,null),s(n,k),s(n,$),s($,T),s(T,P),P.checked=t[2],s(T,I),s(n,S),s(n,A),s(n,E),s(n,F),y(G,Y,L),X(U,G,L),R=!0,q||(z=[K(d,"change",t[4]),K(P,"change",t[5]),K(n,"submit",Ts(t[3]))],q=!0)},p(G,[L]){G[0].usrcfg?O||(O=zf(),O.c(),O.m(n,f)):O&&(O.d(1),O=null);const W={};L&1&&(W.chip=G[0].chip),v.$set(W),L&1&&Re(d,G[0].board),G[0].board&&G[0].board>20?H?(H.p(G,L),L&1&&N(H,1)):(H=Yf(G),H.c(),N(H,1),H.m(n,k)):H&&(Te(),D(H,1,1,()=>{H=null}),Se()),L&4&&(P.checked=G[2]);const j={};L&2&&(j.active=G[1]),U.$set(j)},i(G){R||(N(v.$$.fragment,G),N(H),N(U.$$.fragment,G),R=!0)},o(G){D(v.$$.fragment,G),D(H),D(U.$$.fragment,G),R=!1},d(G){G&&w(e),O&&O.d(),Z(v),H&&H.d(),G&&w(Y),Z(U,G),q=!1,Ve(z)}}}function v0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(c){l(1,i=!0);const p=new FormData(c.target),_=new URLSearchParams;for(let v of p){const[g,k]=v;_.append(g,k)}let d=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Ut.update(v=>(v.vndcfg=d.success,v.booting=d.reboot,v)),ii(n.usrcfg?"/":"/setup")}let r=!1;function a(){n.board=mt(this),l(0,n)}function f(){r=this.checked,l(2,r),l(0,n)}return t.$$set=c=>{"sysinfo"in c&&l(0,n=c.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,r=!n.usrcfg)},[n,i,r,o,a,f]}class h0 extends Ce{constructor(e){super(),ye(this,e,v0,d0,ke,{sysinfo:0})}}function Vf(t){let e,l,n,i,o,r,a,f;return a=new jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),r=m("select"),J(a.$$.fragment),u(i,"name","si"),u(i,"type","text"),u(i,"class","in-f w-full"),i.required=t[1],u(r,"name","su"),u(r,"class","in-l"),r.required=t[1],u(n,"class","flex")},m(c,p){y(c,e,p),y(c,l,p),y(c,n,p),s(n,i),s(n,o),s(n,r),X(a,r,null),f=!0},p(c,p){(!f||p&2)&&(i.required=c[1]),(!f||p&2)&&(r.required=c[1])},i(c){f||(N(a.$$.fragment,c),f=!0)},o(c){D(a.$$.fragment,c),f=!1},d(c){c&&w(e),c&&w(l),c&&w(n),Z(a)}}}function Kf(t){let e;return{c(){e=m("div"),e.innerHTML=`<div>Gateway<br/>
<input name="sg" type="text" class="in-f w-full"/></div>
<div>DNS<br/>
<input name="sd" type="text" class="in-l w-full"/></div>`,u(e,"class","my-3 flex")},m(l,n){y(l,e,n)},d(l){l&&w(e)}}}function b0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z=t[1]&&Vf(t),O=t[1]&&Kf();return Y=new At({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),r=m("strong"),r.textContent="Setup",a=h(),f=m("div"),f.innerHTML=`SSID<br/>
<input name="ss" type="text" class="in-s" required=""/>`,c=h(),p=m("div"),p.innerHTML=`PSK<br/>
<input name="sp" type="password" class="in-s" autocomplete="off"/>`,_=h(),b=m("div"),d=C(`Hostname
`),v=m("input"),g=h(),k=m("div"),$=m("label"),T=m("input"),P=C(" Static IP"),I=h(),z&&z.c(),S=h(),O&&O.c(),A=h(),E=m("div"),E.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=h(),J(Y.$$.fragment),u(i,"type","hidden"),u(i,"name","s"),i.value="true",u(r,"class","text-sm"),u(f,"class","my-3"),u(p,"class","my-3"),u(v,"name","sh"),u(v,"type","text"),u(v,"class","in-s"),u(v,"maxlength","32"),u(v,"pattern","[a-z0-9_-]+"),u(v,"placeholder","Optional, ex.: ams-reader"),u(v,"autocomplete","off"),u(T,"type","checkbox"),u(T,"name","sm"),T.__value="static",T.value=T.__value,u(T,"class","rounded mb-1"),u(k,"class","my-3"),u(E,"class","my-3"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(H,G){y(H,e,G),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(n,c),s(n,p),s(n,_),s(n,b),s(b,d),s(b,v),V(v,t[0].hostname),s(n,g),s(n,k),s(k,$),s($,T),T.checked=t[1],s($,P),s(k,I),z&&z.m(k,null),s(n,S),O&&O.m(n,null),s(n,A),s(n,E),y(H,F,G),X(Y,H,G),U=!0,R||(q=[K(v,"input",t[4]),K(T,"change",t[5]),K(n,"submit",Ts(t[3]))],R=!0)},p(H,[G]){G&1&&v.value!==H[0].hostname&&V(v,H[0].hostname),G&2&&(T.checked=H[1]),H[1]?z?(z.p(H,G),G&2&&N(z,1)):(z=Vf(H),z.c(),N(z,1),z.m(k,null)):z&&(Te(),D(z,1,1,()=>{z=null}),Se()),H[1]?O||(O=Kf(),O.c(),O.m(n,A)):O&&(O.d(1),O=null);const L={};G&4&&(L.active=H[2]),Y.$set(L)},i(H){U||(N(z),N(Y.$$.fragment,H),U=!0)},o(H){D(z),D(Y.$$.fragment,H),U=!1},d(H){H&&w(e),z&&z.d(),O&&O.d(),H&&w(F),Z(Y,H),R=!1,Ve(q)}}}function g0(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,r=0;function a(){var _="";r++;var b=function(){setTimeout(a,1e3)};if(n.net.ip&&r%3==0){if(!n.net.ip){b();return}_="http://"+n.net.ip}else n.hostname&&r%3==1?_="http://"+n.hostname:n.hostname&&r%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Ut.update(v=>(v.trying=_,v));var d=new XMLHttpRequest;d.timeout=5e3,d.addEventListener("abort",b),d.addEventListener("error",b),d.addEventListener("timeout",b),d.addEventListener("load",function(v){window.location.href=_||"/"}),d.open("GET",_+"/is-alive",!0),d.send()}async function f(_){l(2,o=!0);const b=new FormData(_.target),d=new URLSearchParams;for(let k of b){const[$,T]=k;d.append($,T)}let g=await(await fetch("/save",{method:"POST",body:d})).json();l(2,o=!1),Ut.update(k=>(k.hostname=b.get("sh"),k.usrcfg=g.success,k.booting=g.reboot,i&&(k.net.ip=b.get("si"),k.net.mask=b.get("su"),k.net.gw=b.get("sg"),k.net.dns1=b.get("sd")),setTimeout(a,5e3),k))}function c(){n.hostname=this.value,l(0,n)}function p(){i=this.checked,l(1,i)}return t.$$set=_=>{"sysinfo"in _&&l(0,n=_.sysinfo)},[n,i,o,f,c,p]}class k0 extends Ce{constructor(e){super(),ye(this,e,g0,b0,ke,{sysinfo:0})}}function w0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$;return v=new At({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=C("Upload "),o=C(t[1]),r=h(),a=m("p"),a.textContent="Select a suitable file and click upload",f=h(),c=m("form"),p=m("input"),_=h(),b=m("div"),b.innerHTML='<button type="submit" class="btn-pri">Upload</button>',d=h(),J(v.$$.fragment),u(a,"class","mb-4"),u(p,"name","file"),u(p,"type","file"),u(b,"class","w-full text-right mt-4"),u(c,"action",t[0]),u(c,"enctype","multipart/form-data"),u(c,"method","post"),u(c,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,P){y(T,e,P),s(e,l),s(l,n),s(n,i),s(n,o),s(l,r),s(l,a),s(l,f),s(l,c),s(c,p),s(c,_),s(c,b),y(T,d,P),X(v,T,P),g=!0,k||($=K(c,"submit",t[3]),k=!0)},p(T,[P]){(!g||P&2)&&B(o,T[1]),(!g||P&1)&&u(c,"action",T[0]);const I={};P&4&&(I.active=T[2]),v.$set(I)},i(T){g||(N(v.$$.fragment,T),g=!0)},o(T){D(v.$$.fragment,T),g=!1},d(T){T&&w(e),T&&w(d),Z(v,T),k=!1,$()}}}function y0(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const r=()=>l(2,o=!0);return t.$$set=a=>{"action"in a&&l(0,n=a.action),"title"in a&&l(1,i=a.title)},[n,i,o,r]}class Co extends Ce{constructor(e){super(),ye(this,e,y0,w0,ke,{action:0,title:1})}}function C0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I,S,A,E,F,Y,U,R,q,z,O,H;return q=new At({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),r=m("hr"),a=h(),f=m("div"),c=C("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=h(),b=m("a"),d=C("Read more"),v=m("br"),g=h(),k=m("label"),$=m("input"),P=C(" Yes"),I=m("label"),S=m("input"),E=C(" No"),F=m("br"),Y=h(),U=m("div"),U.innerHTML='<button type="submit" class="btn-pri">Save</button>',R=h(),J(q.$$.fragment),u(b,"href",Lt("Data-collection-on-one-click-firmware-upgrade")),u(b,"target","_blank"),u(b,"class","text-blue-600 hover:text-blue-800"),u($,"type","radio"),u($,"name","sf"),$.value=1,$.checked=T=t[0].fwconsent===1,u($,"class","rounded m-2"),$.required=!0,u(S,"type","radio"),u(S,"name","sf"),S.value=2,S.checked=A=t[0].fwconsent===2,u(S,"class","rounded m-2"),S.required=!0,u(f,"class","my-3"),u(U,"class","my-3"),u(n,"autocomplete","off"),u(l,"class","cnt"),u(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(G,L){y(G,e,L),s(e,l),s(l,n),s(n,i),s(n,o),s(n,r),s(n,a),s(n,f),s(f,c),s(f,p),s(f,_),s(f,b),s(b,d),s(f,v),s(f,g),s(f,k),s(k,$),s(k,P),s(f,I),s(I,S),s(I,E),s(f,F),s(n,Y),s(n,U),y(G,R,L),X(q,G,L),z=!0,O||(H=K(n,"submit",Ts(t[2])),O=!0)},p(G,[L]){(!z||L&1&&T!==(T=G[0].fwconsent===1))&&($.checked=T),(!z||L&1&&A!==(A=G[0].fwconsent===2))&&(S.checked=A);const W={};L&2&&(W.active=G[1]),q.$set(W)},i(G){z||(N(q.$$.fragment,G),z=!0)},o(G){D(q.$$.fragment,G),z=!1},d(G){G&&w(e),G&&w(R),Z(q,G),O=!1,H()}}}function $0(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(r){l(1,i=!0);const a=new FormData(r.target),f=new URLSearchParams;for(let _ of a){const[b,d]=_;f.append(b,d)}let p=await(await fetch("/save",{method:"POST",body:f})).json();l(1,i=!1),Ut.update(_=>(_.fwconsent=a.sf===!0?1:a.sf===!1?2:0,_.booting=p.reboot,_)),ii("/")}return t.$$set=r=>{"sysinfo"in r&&l(0,n=r.sysinfo)},[n,i,o]}class T0 extends Ce{constructor(e){super(),ye(this,e,$0,C0,ke,{sysinfo:0})}}function S0(t){let e,l;return e=new Tp({props:{data:t[1],sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&2&&(o.data=n[1]),i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function P0(t){let e,l;return e=new xp({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function N0(t){let e,l;return e=new c0({props:{sysinfo:t[0],data:t[1]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),i&2&&(o.data=n[1]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function M0(t){let e,l;return e=new Co({props:{title:"CA",action:"/mqtt-ca"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function A0(t){let e,l;return e=new Co({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function D0(t){let e,l;return e=new Co({props:{title:"private key",action:"/mqtt-key"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function I0(t){let e,l;return e=new T0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function E0(t){let e,l;return e=new k0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function F0(t){let e,l;return e=new h0({props:{sysinfo:t[0]}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function R0(t){let e,l,n,i,o,r,a,f,c,p,_,b,d,v,g,k,$,T,P,I;return e=new qm({props:{data:t[1]}}),n=new Sl({props:{path:"/",$$slots:{default:[S0]},$$scope:{ctx:t}}}),o=new Sl({props:{path:"/configuration",$$slots:{default:[P0]},$$scope:{ctx:t}}}),a=new Sl({props:{path:"/status",$$slots:{default:[N0]},$$scope:{ctx:t}}}),c=new Sl({props:{path:"/mqtt-ca",$$slots:{default:[M0]},$$scope:{ctx:t}}}),_=new Sl({props:{path:"/mqtt-cert",$$slots:{default:[A0]},$$scope:{ctx:t}}}),d=new Sl({props:{path:"/mqtt-key",$$slots:{default:[D0]},$$scope:{ctx:t}}}),g=new Sl({props:{path:"/consent",$$slots:{default:[I0]},$$scope:{ctx:t}}}),$=new Sl({props:{path:"/setup",$$slots:{default:[E0]},$$scope:{ctx:t}}}),P=new Sl({props:{path:"/vendor",$$slots:{default:[F0]},$$scope:{ctx:t}}}),{c(){J(e.$$.fragment),l=h(),J(n.$$.fragment),i=h(),J(o.$$.fragment),r=h(),J(a.$$.fragment),f=h(),J(c.$$.fragment),p=h(),J(_.$$.fragment),b=h(),J(d.$$.fragment),v=h(),J(g.$$.fragment),k=h(),J($.$$.fragment),T=h(),J(P.$$.fragment)},m(S,A){X(e,S,A),y(S,l,A),X(n,S,A),y(S,i,A),X(o,S,A),y(S,r,A),X(a,S,A),y(S,f,A),X(c,S,A),y(S,p,A),X(_,S,A),y(S,b,A),X(d,S,A),y(S,v,A),X(g,S,A),y(S,k,A),X($,S,A),y(S,T,A),X(P,S,A),I=!0},p(S,A){const E={};A&2&&(E.data=S[1]),e.$set(E);const F={};A&7&&(F.$$scope={dirty:A,ctx:S}),n.$set(F);const Y={};A&5&&(Y.$$scope={dirty:A,ctx:S}),o.$set(Y);const U={};A&7&&(U.$$scope={dirty:A,ctx:S}),a.$set(U);const R={};A&4&&(R.$$scope={dirty:A,ctx:S}),c.$set(R);const q={};A&4&&(q.$$scope={dirty:A,ctx:S}),_.$set(q);const z={};A&4&&(z.$$scope={dirty:A,ctx:S}),d.$set(z);const O={};A&5&&(O.$$scope={dirty:A,ctx:S}),g.$set(O);const H={};A&5&&(H.$$scope={dirty:A,ctx:S}),$.$set(H);const G={};A&5&&(G.$$scope={dirty:A,ctx:S}),P.$set(G)},i(S){I||(N(e.$$.fragment,S),N(n.$$.fragment,S),N(o.$$.fragment,S),N(a.$$.fragment,S),N(c.$$.fragment,S),N(_.$$.fragment,S),N(d.$$.fragment,S),N(g.$$.fragment,S),N($.$$.fragment,S),N(P.$$.fragment,S),I=!0)},o(S){D(e.$$.fragment,S),D(n.$$.fragment,S),D(o.$$.fragment,S),D(a.$$.fragment,S),D(c.$$.fragment,S),D(_.$$.fragment,S),D(d.$$.fragment,S),D(g.$$.fragment,S),D($.$$.fragment,S),D(P.$$.fragment,S),I=!1},d(S){Z(e,S),S&&w(l),Z(n,S),S&&w(i),Z(o,S),S&&w(r),Z(a,S),S&&w(f),Z(c,S),S&&w(p),Z(_,S),S&&w(b),Z(d,S),S&&w(v),Z(g,S),S&&w(k),Z($,S),S&&w(T),Z(P,S)}}}function L0(t){let e,l,n,i;const o=[q0,O0],r=[];function a(f,c){return f[0].trying?0:1}return e=a(t),l=r[e]=o[e](t),{c(){l.c(),n=We()},m(f,c){r[e].m(f,c),y(f,n,c),i=!0},p(f,c){let p=e;e=a(f),e===p?r[e].p(f,c):(Te(),D(r[p],1,1,()=>{r[p]=null}),Se(),l=r[e],l?l.p(f,c):(l=r[e]=o[e](f),l.c()),N(l,1),l.m(n.parentNode,n))},i(f){i||(N(l),i=!0)},o(f){D(l),i=!1},d(f){r[e].d(f),f&&w(n)}}}function U0(t){let e,l;return e=new At({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function O0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait"}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p:ne,i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function q0(t){let e,l;return e=new At({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){J(e.$$.fragment)},m(n,i){X(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.message="Device is booting, please wait. Trying to reach it on "+n[0].trying),e.$set(o)},i(n){l||(N(e.$$.fragment,n),l=!0)},o(n){D(e.$$.fragment,n),l=!1},d(n){Z(e,n)}}}function H0(t){let e,l,n,i,o,r;l=new wc({props:{$$slots:{default:[R0]},$$scope:{ctx:t}}});const a=[U0,L0],f=[];function c(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=c(t))&&(o=f[i]=a[i](t)),{c(){e=m("div"),J(l.$$.fragment),n=h(),o&&o.c(),u(e,"class","container mx-auto m-3")},m(p,_){y(p,e,_),X(l,e,null),s(e,n),~i&&f[i].m(e,null),r=!0},p(p,[_]){const b={};_&7&&(b.$$scope={dirty:_,ctx:p}),l.$set(b);let d=i;i=c(p),i===d?~i&&f[i].p(p,_):(o&&(Te(),D(f[d],1,1,()=>{f[d]=null}),Se()),~i?(o=f[i],o?o.p(p,_):(o=f[i]=a[i](p),o.c()),N(o,1),o.m(e,null)):o=null)},i(p){r||(N(l.$$.fragment,p),N(o),r=!0)},o(p){D(l.$$.fragment,p),D(o),r=!1},d(p){p&&w(e),Z(l),~i&&f[i].d()}}}function j0(t,e,l){let n={};Ut.subscribe(o=>{l(0,n=o),n.vndcfg===!1?ii("/vendor"):n.usrcfg===!1?ii("/setup"):n.fwconsent===0&&ii("/consent")}),go();let i={};return om.subscribe(o=>{l(1,i=o)}),[n,i]}class W0 extends Ce{constructor(e){super(),ye(this,e,j0,H0,ke,{})}}new W0({target:document.getElementById("app")});