Files
UtilitechAS.amsreader-firmware/lib/SvelteUi/app/dist/index.js
2023-11-03 19:57:17 +01:00

15 lines
204 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function l(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=l(i);fetch(i.href,o)}})();function fe(){}function xt(t,e){for(const l in e)t[l]=e[l];return t}function ic(t){return t()}function Ba(){return Object.create(null)}function ze(t){t.forEach(ic)}function _o(t){return typeof t=="function"}function Ae(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let bs;function to(t,e){return bs||(bs=document.createElement("a")),bs.href=e,t===bs.href}function l0(t){return Object.keys(t).length===0}function vo(t,...e){if(t==null)return fe;const l=t.subscribe(...e);return l.unsubscribe?()=>l.unsubscribe():l}function fi(t){let e;return vo(t,l=>e=l)(),e}function ul(t,e,l){t.$$.on_destroy.push(vo(e,l))}function ho(t,e,l,n){if(t){const i=sc(t,e,l,n);return t[0](i)}}function sc(t,e,l,n){return t[1]&&n?xt(l.ctx.slice(),t[1](n(e))):l.ctx}function bo(t,e,l,n){if(t[2]&&n){const i=t[2](n(l));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],a=Math.max(e.dirty.length,i.length);for(let u=0;u<a;u+=1)o[u]=e.dirty[u]|i[u];return o}return e.dirty|i}return e.dirty}function go(t,e,l,n,i,o){if(i){const a=sc(e,l,n,o);t.p(a,i)}}function ko(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 Cs(t){const e={};for(const l in t)l[0]!=="$"&&(e[l]=t[l]);return e}function Ms(t,e){const l={};e=new Set(e);for(const n in t)!e.has(n)&&n[0]!=="$"&&(l[n]=t[n]);return l}const n0=["",!0,1,"true","contenteditable"];function s(t,e){t.appendChild(e)}function M(t,e,l){t.insertBefore(e,l||null)}function C(t){t.parentNode&&t.parentNode.removeChild(t)}function cl(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 Fe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function $(t){return document.createTextNode(t)}function h(){return $(" ")}function Ge(){return $("")}function ee(t,e,l,n){return t.addEventListener(e,l,n),()=>t.removeEventListener(e,l,n)}function As(t){return function(e){return e.preventDefault(),t.call(this,e)}}function r(t,e,l){l==null?t.removeAttribute(e):t.getAttribute(e)!==l&&t.setAttribute(e,l)}const i0=["width","height"];function ci(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&&i0.indexOf(n)===-1?t[n]=e[n]:r(t,n,e[n])}function he(t){return t===""?null:+t}function s0(t){return Array.from(t.childNodes)}function Z(t,e){e=""+e,t.data!==e&&(t.data=e)}function o0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function r0(t,e,l){~n0.indexOf(l)?o0(t,e):Z(t,e)}function te(t,e){t.value=e??""}function oc(t,e,l,n){l==null?t.style.removeProperty(e):t.style.setProperty(e,l,n?"important":"")}function qe(t,e,l){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e){i.selected=!0;return}}(!l||e!==void 0)&&(t.selectedIndex=-1)}function dt(t){const e=t.querySelector(":checked");return e&&e.__value}let gs;function a0(){if(gs===void 0){gs=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{gs=!0}}return gs}function u0(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=a0();let o;return i?(n.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=ee(window,"message",a=>{a.source===n.contentWindow&&e()})):(n.src="about:blank",n.onload=()=>{o=ee(n.contentWindow,"resize",e),e()}),s(t,n),()=>{(i||o&&n.contentWindow)&&o(),C(n)}}function f0(t,e,{bubbles:l=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,l,n,e),i}function Ua(t,e){return new t(e)}let Ni;function Ti(t){Ni=t}function Ai(){if(!Ni)throw new Error("Function called outside component initialization");return Ni}function rc(t){Ai().$$.on_mount.push(t)}function c0(t){Ai().$$.on_destroy.push(t)}function m0(){const t=Ai();return(e,l,{cancelable:n=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=f0(e,l,{cancelable:n});return i.slice().forEach(a=>{a.call(t,o)}),!o.defaultPrevented}return!0}}function Si(t,e){return Ai().$$.context.set(t,e),e}function Bl(t){return Ai().$$.context.get(t)}const oi=[],$s=[];let ri=[];const ja=[],ac=Promise.resolve();let lo=!1;function uc(){lo||(lo=!0,ac.then(fc))}function p0(){return uc(),ac}function et(t){ri.push(t)}const Qs=new Set;let ii=0;function fc(){if(ii!==0)return;const t=Ni;do{try{for(;ii<oi.length;){const e=oi[ii];ii++,Ti(e),_0(e.$$)}}catch(e){throw oi.length=0,ii=0,e}for(Ti(null),oi.length=0,ii=0;$s.length;)$s.pop()();for(let e=0;e<ri.length;e+=1){const l=ri[e];Qs.has(l)||(Qs.add(l),l())}ri.length=0}while(oi.length);for(;ja.length;)ja.pop()();lo=!1,Qs.clear(),Ti(t)}function _0(t){if(t.fragment!==null){t.update(),ze(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(et)}}function d0(t){const e=[],l=[];ri.forEach(n=>t.indexOf(n)===-1?e.push(n):l.push(n)),l.forEach(n=>n()),ri=e}const ys=new Set;let un;function De(){un={r:0,c:[],p:un}}function Ie(){un.r||ze(un.c),un=un.p}function D(t,e){t&&t.i&&(ys.delete(t),t.i(e))}function q(t,e,l,n){if(t&&t.o){if(ys.has(t))return;ys.add(t),un.c.push(()=>{ys.delete(t),n&&(l&&t.d(1),n())}),t.o(e)}else n&&n()}function cc(t,e){const l={},n={},i={$$scope:1};let o=t.length;for(;o--;){const a=t[o],u=e[o];if(u){for(const c in a)c in u||(n[c]=1);for(const c in u)i[c]||(l[c]=u[c],i[c]=1);t[o]=u}else for(const c in a)i[c]=1}for(const a in n)a in l||(l[a]=void 0);return l}function Ha(t){return typeof t=="object"&&t!==null?t:{}}function ie(t){t&&t.c()}function le(t,e,l,n){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,l),n||et(()=>{const a=t.$$.on_mount.map(ic).filter(_o);t.$$.on_destroy?t.$$.on_destroy.push(...a):ze(a),t.$$.on_mount=[]}),o.forEach(et)}function ne(t,e){const l=t.$$;l.fragment!==null&&(d0(l.after_update),ze(l.on_destroy),l.fragment&&l.fragment.d(e),l.on_destroy=l.fragment=null,l.ctx=[])}function v0(t,e){t.$$.dirty[0]===-1&&(oi.push(t),uc(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function Pe(t,e,l,n,i,o,a,u=[-1]){const c=Ni;Ti(t);const f=t.$$={fragment:null,ctx:[],props:o,update:fe,not_equal:i,bound:Ba(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Ba(),dirty:u,skip_bound:!1,root:e.target||c.$$.root};a&&a(f.root);let p=!1;if(f.ctx=l?l(t,e.props||{},(_,b,...v)=>{const d=v.length?v[0]:b;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&v0(t,_)),b}):[],f.update(),p=!0,ze(f.before_update),f.fragment=n?n(f.ctx):!1,e.target){if(e.hydrate){const _=s0(e.target);f.fragment&&f.fragment.l(_),_.forEach(C)}else f.fragment&&f.fragment.c();e.intro&&D(t.$$.fragment),le(t,e.target,e.anchor,e.customElement),fc()}Ti(c)}class Ee{$destroy(){ne(this,1),this.$destroy=fe}$on(e,l){if(!_o(l))return fe;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&&!l0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Wa=t=>typeof t>"u",mc=t=>typeof t=="function",pc=t=>typeof t=="number";function h0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function _c(){let t=0;return()=>t++}function b0(){return Math.random().toString(36).substring(2)}const Ul=typeof window>"u";function dc(t,e,l){return t.addEventListener(e,l),()=>t.removeEventListener(e,l)}const vc=(t,e)=>t?{}:{style:e},no=t=>({"aria-hidden":"true",...vc(t,"display:none;")}),si=[];function hc(t,e){return{subscribe:at(t,e).subscribe}}function at(t,e=fe){let l;const n=new Set;function i(u){if(Ae(t,u)&&(t=u,l)){const c=!si.length;for(const f of n)f[1](),si.push(f,t);if(c){for(let f=0;f<si.length;f+=2)si[f][0](si[f+1]);si.length=0}}}function o(u){i(u(t))}function a(u,c=fe){const f=[u,c];return n.add(f),n.size===1&&(l=e(i)||fe),u(t),()=>{n.delete(f),n.size===0&&l&&(l(),l=null)}}return{set:i,update:o,subscribe:a}}function g0(t,e,l){const n=!Array.isArray(t),i=n?[t]:t,o=e.length<2;return hc(l,a=>{let u=!1;const c=[];let f=0,p=fe;const _=()=>{if(f)return;p();const v=e(n?c[0]:c,a);o?a(v):p=_o(v)?v:fe},b=i.map((v,d)=>vo(v,k=>{c[d]=k,f&=~(1<<d),u&&_()},()=>{f|=1<<d}));return u=!0,_(),function(){ze(b),p(),u=!1}})}const Pi=t=>`@@svnav-ctx__${t}`,io=Pi("LOCATION"),mi=Pi("ROUTER"),bc=Pi("ROUTE"),k0=Pi("ROUTE_PARAMS"),w0=Pi("FOCUS_ELEM"),gc=/^:(.+)/,Ci=(t,e,l)=>t.substr(e,l),so=(t,e)=>Ci(t,0,e.length)===e,y0=t=>t==="",C0=t=>gc.test(t),kc=t=>t[0]==="*",M0=t=>t.replace(/\*.*$/,""),wc=t=>t.replace(/(^\/+|\/+$)/g,"");function ml(t,e=!1){const l=wc(t).split("/");return e?l.filter(Boolean):l}const Xs=(t,e)=>t+(e?`?${e}`:""),wo=t=>`/${wc(t)}`;function Ei(...t){const e=n=>ml(n,!0).join("/"),l=t.map(e).join("/");return wo(l)}const yo=1,Ps=2,_n=3,$0=4,yc=5,T0=6,Cc=7,S0=8,N0=9,Mc=10,$c=11,A0={[yo]:"Link",[Ps]:"Route",[_n]:"Router",[$0]:"useFocus",[yc]:"useLocation",[T0]:"useMatch",[Cc]:"useNavigate",[S0]:"useParams",[N0]:"useResolvable",[Mc]:"useResolve",[$c]:"navigate"},Co=t=>A0[t];function P0(t,e){let l;return t===Ps?l=e.path?`path="${e.path}"`:"default":t===yo?l=`to="${e.to}"`:t===_n&&(l=`basepath="${e.basepath||""}"`),`<${Co(t)} ${l||""} />`}function E0(t,e,l,n){const i=l&&P0(n||t,l),o=i?`
Occurred in: ${i}`:"",a=Co(t),u=mc(e)?e(a):e;return`<${a}> ${u}${o}`}const Tc=t=>(...e)=>t(E0(...e)),Sc=Tc(t=>{throw new Error(t)}),Ts=Tc(console.warn),za=4,D0=3,I0=2,O0=1,R0=1;function L0(t,e){const l=t.default?0:ml(t.fullPath).reduce((n,i)=>{let o=n;return o+=za,y0(i)?o+=R0:C0(i)?o+=I0:kc(i)?o-=za+O0:o+=D0,o},0);return{route:t,score:l,index:e}}function F0(t){return t.map(L0).sort((e,l)=>e.score<l.score?1:e.score>l.score?-1:e.index-l.index)}function Nc(t,e){let l,n;const[i]=e.split("?"),o=ml(i),a=o[0]==="",u=F0(t);for(let c=0,f=u.length;c<f;c++){const{route:p}=u[c];let _=!1;const b={},v=S=>({...p,params:b,uri:S});if(p.default){n=v(e);continue}const d=ml(p.fullPath),k=Math.max(o.length,d.length);let A=0;for(;A<k;A++){const S=d[A],T=o[A];if(!Wa(S)&&kc(S)){const B=S==="*"?"*":S.slice(1);b[B]=o.slice(A).map(decodeURIComponent).join("/");break}if(Wa(T)){_=!0;break}const E=gc.exec(S);if(E&&!a){const B=decodeURIComponent(T);b[E[1]]=B}else if(S!==T){_=!0;break}}if(!_){l=v(Ei(...o.slice(0,A)));break}}return l||n||null}function Ac(t,e){return Nc([t],e)}function q0(t,e){if(so(t,"/"))return t;const[l,n]=t.split("?"),[i]=e.split("?"),o=ml(l),a=ml(i);if(o[0]==="")return Xs(i,n);if(!so(o[0],".")){const f=a.concat(o).join("/");return Xs((i==="/"?"":"/")+f,n)}const u=a.concat(o),c=[];return u.forEach(f=>{f===".."?c.pop():f!=="."&&c.push(f)}),Xs(`/${c.join("/")}`,n)}function Ga(t,e){const{pathname:l,hash:n="",search:i="",state:o}=t,a=ml(e,!0),u=ml(l,!0);for(;a.length;)a[0]!==u[0]&&Sc(_n,`Invalid state: All locations must begin with the basepath "${e}", found "${l}"`),a.shift(),u.shift();return{pathname:Ei(...u),hash:n,search:i,state:o}}const Va=t=>t.length===1?"":t,Mo=t=>{const e=t.indexOf("?"),l=t.indexOf("#"),n=e!==-1,i=l!==-1,o=i?Va(Ci(t,l)):"",a=i?Ci(t,0,l):t,u=n?Va(Ci(a,e)):"";return{pathname:(n?Ci(a,0,e):a)||"/",search:u,hash:o}},B0=t=>{const{pathname:e,search:l,hash:n}=t;return e+l+n};function U0(t,e,l){return Ei(l,q0(t,e))}function j0(t,e){const l=wo(M0(t)),n=ml(l,!0),i=ml(e,!0).slice(0,n.length),o=Ac({fullPath:l},Ei(...i));return o&&o.uri}const Zs="POP",H0="PUSH",W0="REPLACE";function Js(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function z0(t){let e=[],l=Js(t),n=Zs;const i=(o=e)=>o.forEach(a=>a({location:l,action:n}));return{get location(){return l},listen(o){e.push(o);const a=()=>{l=Js(t),n=Zs,i([o])};i([o]);const u=dc(t,"popstate",a);return()=>{u(),e=e.filter(c=>c!==o)}},navigate(o,a){const{state:u={},replace:c=!1}=a||{};if(n=c?W0:H0,pc(o))a&&Ts($c,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),n=Zs,t.history.go(o);else{const f={...u,_key:b0()};try{t.history[c?"replaceState":"pushState"](f,"",o)}catch{t.location[c?"replace":"assign"](o)}}l=Js(t),i()}}}function xs(t,e){return{...Mo(e),state:t}}function G0(t="/"){let e=0,l=[xs(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(xs(n,o))},replaceState(n,i,o){l[e]=xs(n,o)},go(n){const i=e+n;i<0||i>l.length-1||(e=i)}}}}const V0=!!(!Ul&&window.document&&window.document.createElement),K0=!Ul&&window.location.origin==="null",Pc=z0(V0&&!K0?window:G0()),{navigate:ai}=Pc;let $l=null,Ec=!0;function Y0(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 Q0(t){(!$l||t.level>$l.level||t.level===$l.level&&Y0(t.routerId,$l.routerId))&&($l=t)}function X0(){$l=null}function Z0(){Ec=!1}function Ka(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let l;l=dc(t,"blur",()=>{t.removeAttribute(e),l()})}return t.focus(),document.activeElement===t}catch{return!1}}function J0(t,e){return Number(t.dataset.svnavRouteEnd)===e}function x0(t){return/^H[1-6]$/i.test(t.tagName)}function Ya(t,e=document){return e.querySelector(t)}function e1(t){let l=Ya(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!J0(l,t);){if(x0(l))return l;const n=Ya("h1,h2,h3,h4,h5,h6",l);if(n)return n;l=l.nextElementSibling}return null}function t1(t){Promise.resolve(fi(t.focusElement)).then(e=>{const l=e||e1(t.id);l||Ts(_n,`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,Ps),!Ka(l)&&Ka(document.documentElement)})}const l1=(t,e,l)=>(n,i)=>p0().then(()=>{if(!$l||Ec){Z0();return}if(n&&t1($l.route),t.announcements&&i){const{path:o,fullPath:a,meta:u,params:c,uri:f}=$l.route,p=t.createAnnouncement({path:o,fullPath:a,meta:u,params:c,uri:f},fi(l));Promise.resolve(p).then(_=>{e.set(_)})}X0()}),n1="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 i1(t){let e,l,n=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},vc(t[6],n1)],i={};for(let o=0;o<n.length;o+=1)i=xt(i,n[o]);return{c(){e=m("div"),l=$(t[0]),ci(e,i)},m(o,a){M(o,e,a),s(e,l)},p(o,a){a[0]&1&&r0(l,o[0],i.contenteditable)},d(o){o&&C(e)}}}function s1(t){let e,l,n,i,o,a=[no(t[6]),{"data-svnav-router":t[3]}],u={};for(let _=0;_<a.length;_+=1)u=xt(u,a[_]);const c=t[22].default,f=ho(c,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&i1(t);return{c(){e=m("div"),l=h(),f&&f.c(),n=h(),p&&p.c(),i=Ge(),ci(e,u)},m(_,b){M(_,e,b),M(_,l,b),f&&f.m(_,b),M(_,n,b),p&&p.m(_,b),M(_,i,b),o=!0},p(_,b){f&&f.p&&(!o||b[0]&2097152)&&go(f,c,_,_[21],o?bo(c,_[21],b,null):ko(_[21]),null),_[2]&&_[4]&&_[1].announcements&&p.p(_,b)},i(_){o||(D(f,_),o=!0)},o(_){q(f,_),o=!1},d(_){_&&C(e),_&&C(l),f&&f.d(_),_&&C(n),p&&p.d(_),_&&C(i)}}}const o1=_c(),Qa="/";function r1(t,e,l){let n,i,o,a,u,{$$slots:c={},$$scope:f}=e,{basepath:p=Qa}=e,{url:_=null}=e,{history:b=Pc}=e,{primary:v=!0}=e,{a11y:d={}}=e,{disableInlineStyles:k=!1}=e;const A={createAnnouncement:ue=>`Navigated to ${ue.uri}`,announcements:!0,...d},S=p,T=wo(p),E=Bl(io),B=Bl(mi),P=!E,R=o1(),L=v&&!(B&&!B.manageFocus),F=at("");ul(t,F,ue=>l(0,u=ue));const x=B?B.disableInlineStyles:k,j=at([]);ul(t,j,ue=>l(20,a=ue));const z=at(null);ul(t,z,ue=>l(18,i=ue));let G=!1;const V=P?0:B.level+1,U=P?at((()=>Ga(Ul?Mo(_):b.location,T))()):E;ul(t,U,ue=>l(17,n=ue));const K=at(n);ul(t,K,ue=>l(19,o=ue));const H=l1(A,F,U),Y=ue=>we=>we.filter(me=>me.id!==ue);function X(ue){if(Ul){if(G)return;const we=Ac(ue,n.pathname);if(we)return G=!0,we}else j.update(we=>{const me=Y(ue.id)(we);return me.push(ue),me})}function re(ue){j.update(Y(ue))}return!P&&p!==Qa&&Ts(_n,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),P&&(rc(()=>b.listen(we=>{const me=Ga(we.location,T);K.set(n),U.set(me)})),Si(io,U)),Si(mi,{activeRoute:z,registerRoute:X,unregisterRoute:re,manageFocus:L,level:V,id:R,history:P?b:B.history,basepath:P?T:B.basepath,disableInlineStyles:x}),t.$$set=ue=>{"basepath"in ue&&l(11,p=ue.basepath),"url"in ue&&l(12,_=ue.url),"history"in ue&&l(13,b=ue.history),"primary"in ue&&l(14,v=ue.primary),"a11y"in ue&&l(15,d=ue.a11y),"disableInlineStyles"in ue&&l(16,k=ue.disableInlineStyles),"$$scope"in ue&&l(21,f=ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==S&&Ts(_n,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ue=Nc(a,n.pathname);z.set(ue)}if(t.$$.dirty[0]&655360&&P){const ue=!!n.hash,we=!ue&&L,me=!ue||n.pathname!==o.pathname;H(we,me)}t.$$.dirty[0]&262144&&L&&i&&i.primary&&Q0({level:V,routerId:R,route:i})},[u,A,P,R,L,F,x,j,z,U,K,p,_,b,v,d,k,n,i,o,a,f,c]}class a1 extends Ee{constructor(e){super(),Pe(this,e,r1,s1,Ae,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const Dc=a1;function Di(t,e,l=mi,n=_n){Bl(l)||Sc(t,o=>`You cannot use ${o} outside of a ${Co(n)}.`,e)}const u1=t=>{const{subscribe:e}=Bl(t);return{subscribe:e}};function Ic(){return Di(yc),u1(io)}function Oc(){const{history:t}=Bl(mi);return t}function Rc(){const t=Bl(bc);return t?g0(t,e=>e.base):at("/")}function Lc(){Di(Mc);const t=Rc(),{basepath:e}=Bl(mi);return n=>U0(n,fi(t),e)}function f1(){Di(Cc);const t=Lc(),{navigate:e}=Oc();return(n,i)=>{const o=pc(n)?n:t(n);return e(o,i)}}const c1=t=>({params:t&16,location:t&8}),Xa=t=>({params:Ul?fi(t[10]):t[4],location:t[3],navigate:t[11]});function Za(t){let e,l;return e=new Dc({props:{primary:t[1],$$slots:{default:[_1]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(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||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function m1(t){let e;const l=t[18].default,n=ho(l,t,t[19],Xa);return{c(){n&&n.c()},m(i,o){n&&n.m(i,o),e=!0},p(i,o){n&&n.p&&(!e||o&524312)&&go(n,l,i,i[19],e?bo(l,i[19],o,c1):ko(i[19]),Xa)},i(i){e||(D(n,i),e=!0)},o(i){q(n,i),e=!1},d(i){n&&n.d(i)}}}function p1(t){let e,l,n;const i=[{location:t[3]},{navigate:t[11]},Ul?fi(t[10]):t[4],t[12]];var o=t[0];function a(u){let c={};for(let f=0;f<i.length;f+=1)c=xt(c,i[f]);return{props:c}}return o&&(e=Ua(o,a())),{c(){e&&ie(e.$$.fragment),l=Ge()},m(u,c){e&&le(e,u,c),M(u,l,c),n=!0},p(u,c){const f=c&7192?cc(i,[c&8&&{location:u[3]},c&2048&&{navigate:u[11]},c&1040&&Ha(Ul?fi(u[10]):u[4]),c&4096&&Ha(u[12])]):{};if(c&1&&o!==(o=u[0])){if(e){De();const p=e;q(p.$$.fragment,1,0,()=>{ne(p,1)}),Ie()}o?(e=Ua(o,a()),ie(e.$$.fragment),D(e.$$.fragment,1),le(e,l.parentNode,l)):e=null}else o&&e.$set(f)},i(u){n||(e&&D(e.$$.fragment,u),n=!0)},o(u){e&&q(e.$$.fragment,u),n=!1},d(u){u&&C(l),e&&ne(e,u)}}}function _1(t){let e,l,n,i;const o=[p1,m1],a=[];function u(c,f){return c[0]!==null?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ge()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let p=e;e=u(c),e===p?a[e].p(c,f):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function d1(t){let e,l,n,i,o,a=[no(t[7]),{"data-svnav-route-start":t[5]}],u={};for(let _=0;_<a.length;_+=1)u=xt(u,a[_]);let c=t[2]&&Za(t),f=[no(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let _=0;_<f.length;_+=1)p=xt(p,f[_]);return{c(){e=m("div"),l=h(),c&&c.c(),n=h(),i=m("div"),ci(e,u),ci(i,p)},m(_,b){M(_,e,b),M(_,l,b),c&&c.m(_,b),M(_,n,b),M(_,i,b),o=!0},p(_,[b]){_[2]?c?(c.p(_,b),b&4&&D(c,1)):(c=Za(_),c.c(),D(c,1),c.m(n.parentNode,n)):c&&(De(),q(c,1,1,()=>{c=null}),Ie())},i(_){o||(D(c),o=!0)},o(_){q(c),o=!1},d(_){_&&C(e),_&&C(l),c&&c.d(_),_&&C(n),_&&C(i)}}}const v1=_c();function h1(t,e,l){let n;const i=["path","component","meta","primary"];let o=Ms(e,i),a,u,c,f,{$$slots:p={},$$scope:_}=e,{path:b=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:k=!0}=e;Di(Ps,e);const A=v1(),{registerRoute:S,unregisterRoute:T,activeRoute:E,disableInlineStyles:B}=Bl(mi);ul(t,E,G=>l(16,a=G));const P=Rc();ul(t,P,G=>l(17,c=G));const R=Ic();ul(t,R,G=>l(3,u=G));const L=at(null);let F;const x=at(),j=at({});ul(t,j,G=>l(4,f=G)),Si(bc,x),Si(k0,j),Si(w0,L);const z=f1();return Ul||c0(()=>T(A)),t.$$set=G=>{l(24,e=xt(xt({},e),Cs(G))),l(12,o=Ms(e,i)),"path"in G&&l(13,b=G.path),"component"in G&&l(0,v=G.component),"meta"in G&&l(14,d=G.meta),"primary"in G&&l(1,k=G.primary),"$$scope"in G&&l(19,_=G.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const G=b==="",V=Ei(c,b),W={id:A,path:b,meta:d,default:G,fullPath:G?"":V,base:G?c:j0(V,u.pathname),primary:k,focusElement:L};x.set(W),l(15,F=S(W))}if(t.$$.dirty&98304&&l(2,n=!!(F||a&&a.id===A)),t.$$.dirty&98308&&n){const{params:G}=F||a;j.set(G)}},e=Cs(e),[v,k,n,u,f,A,E,B,P,R,j,z,o,b,d,F,a,c,p,_]}class b1 extends Ee{constructor(e){super(),Pe(this,e,h1,d1,Ae,{path:13,component:0,meta:14,primary:1})}}const Ml=b1;function g1(t){let e,l,n,i;const o=t[13].default,a=ho(o,t,t[12],null);let u=[{href:t[0]},t[2],t[1]],c={};for(let f=0;f<u.length;f+=1)c=xt(c,u[f]);return{c(){e=m("a"),a&&a.c(),ci(e,c)},m(f,p){M(f,e,p),a&&a.m(e,null),l=!0,n||(i=ee(e,"click",t[4]),n=!0)},p(f,[p]){a&&a.p&&(!l||p&4096)&&go(a,o,f,f[12],l?bo(o,f[12],p,null):ko(f[12]),null),ci(e,c=cc(u,[(!l||p&1)&&{href:f[0]},p&4&&f[2],p&2&&f[1]]))},i(f){l||(D(a,f),l=!0)},o(f){q(a,f),l=!1},d(f){f&&C(e),a&&a.d(f),n=!1,i()}}}function k1(t,e,l){let n,i,o,a,u,c;const f=["to","replace","state","getProps"];let p=Ms(e,f),_,{$$slots:b={},$$scope:v}=e,{to:d}=e,{replace:k=!1}=e,{state:A={}}=e,{getProps:S=null}=e;Di(yo,e);const T=Ic();ul(t,T,L=>l(11,_=L));const E=m0(),B=Lc(),{navigate:P}=Oc();function R(L){E("click",L),h0(L)&&(L.preventDefault(),P(n,{state:A,replace:a||k}))}return t.$$set=L=>{l(19,e=xt(xt({},e),Cs(L))),l(18,p=Ms(e,f)),"to"in L&&l(5,d=L.to),"replace"in L&&l(6,k=L.replace),"state"in L&&l(7,A=L.state),"getProps"in L&&l(8,S=L.getProps),"$$scope"in L&&l(12,v=L.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&l(0,n=B(d,_)),t.$$.dirty&2049&&l(10,i=so(_.pathname,n)),t.$$.dirty&2049&&l(9,o=n===_.pathname),t.$$.dirty&2049&&(a=Mo(n)===B0(_)),t.$$.dirty&512&&l(2,u=o?{"aria-current":"page"}:{}),l(1,c=(()=>{if(mc(S)){const L=S({location:_,href:n,isPartiallyCurrent:i,isCurrent:o});return{...p,...L}}return p})())},e=Cs(e),[n,c,u,T,R,d,k,A,S,o,i,_,v,b]}class w1 extends Ee{constructor(e){super(),Pe(this,e,k1,g1,Ae,{to:5,replace:6,state:7,getProps:8})}}const el=w1;let oo=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ql(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function y1(t){return t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function Fc(t){return t>90?"#d90000":t>85?"#e32100":t>80?"#ffb800":t>75?"#dcd800":"#32d900"}function C1(t){return t>75?"#32d900":t>50?"#77d900":t>25?"#94d900":"#dcd800"}function Ss(t){switch(t){case 1:return"Aidon";case 2:return"Kaifa";case 3:return"Kamstrup";case 8:return"Iskra";case 9:return"Landis+Gyr";case 10:return"Sagemcom";default:return"Unknown"}}function Le(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function be(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"µHAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1"}}function Ja(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 xa(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 eu(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 ui(t){switch(t){case 2:case 4:case 7:return!0}return!1}function Ve(t,e){return t==1||t==2&&e}function qt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function ge(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 tu(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 al={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 Bt=at(al);async function $o(){al=await(await jl("/sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Bt.set(al)}let ks=0,lu=-127,nu=null,M1={};const $1=hc(M1,t=>{let e;async function l(){jl("/data.json").then(n=>n.json()).then(n=>{t(n),lu!=n.t&&(lu=n.t,setTimeout(Hc,2e3)),nu==null&&n.pe&&n.p!=null&&(nu=n.p,Bc()),al.upgrading?window.location.reload():(!al||!al.chip||al.booting||ks>1&&!ui(al.board))&&($o(),fn&&clearTimeout(fn),fn=setTimeout(So,2e3),cn&&clearTimeout(cn),cn=setTimeout(No,3e3));let i=5e3;if(ui(al.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),ks=0}).catch(n=>{ks++,ks>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(l,15e3)):e=setTimeout(l,ui(al.board)?1e4:5e3)})}return l(),function(){clearTimeout(e)}});let ro={},Mi;const To=at(ro);async function qc(){let t=!1;To.update(e=>{for(var l=0;l<36;l++){if(e[Le(l)]==null){t=l<12;break}e[Le(l)]=e[Le(l+1)]}return e}),t?Bc():Mi=setTimeout(qc,(60-new Date().getMinutes())*6e4)}async function Bc(){Mi&&(clearTimeout(Mi),Mi=0),ro=await(await jl("/energyprice.json")).json(),To.set(ro),Mi=setTimeout(qc,(60-new Date().getMinutes())*6e4)}let ao={},fn;async function So(){fn&&(clearTimeout(fn),fn=0),ao=await(await jl("/dayplot.json")).json(),Uc.set(ao),fn=setTimeout(So,(60-new Date().getMinutes())*6e4+20)}const Uc=at(ao,t=>(So(),function(){}));let uo={},cn;async function No(){cn&&(clearTimeout(cn),cn=0),uo=await(await jl("/monthplot.json")).json(),jc.set(uo),cn=setTimeout(No,(24-new Date().getHours())*36e5+40)}const jc=at(uo,t=>(No(),function(){}));let fo={};async function Hc(){fo=await(await jl("/temperature.json")).json(),Wc.set(fo)}const Wc=at(fo,t=>(Hc(),function(){}));let co={},ws;async function zc(){ws&&(clearTimeout(ws),ws=0),co=await(await jl("/tariff.json")).json(),Gc.set(co),ws=setTimeout(zc,(60-new Date().getMinutes())*6e4+30)}const Gc=at(co,t=>function(){});let mo=[];const Ao=at(mo);async function T1(){mo=await(await jl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Ao.set(mo)}function Ns(t){return"WARNING: "+t+" must be connected to an external power supply during firmware upgrade. Failure to do so may cause power-down during upload resulting in non-functioning unit."}async function Vc(t){await(await fetch("/upgrade?expected_version="+t,{method:"POST"})).json()}function Kc(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let l=t.substring(1).split("."),n=parseInt(l[0]),i=parseInt(l[1]),o=parseInt(l[2]),a=[...e];a.reverse();let u,c,f;for(let p=0;p<a.length;p++){let _=a[p],v=_.tag_name.substring(1).split("."),d=parseInt(v[0]),k=parseInt(v[1]),A=parseInt(v[2]);if(d==n)k==i?A>o&&(u=_):k==i+1&&(c=_);else if(d==n+1)if(f){let S=f.tag_name.substring(1).split(".");parseInt(S[0]);let T=parseInt(S[1]);parseInt(S[2]),k==T&&(f=_)}else f=_}return c||f||u||!1}else return e[0]}const S1="/github.svg";function iu(t){let e,l;function n(a,u){return a[1]>1?O1:a[1]>0?I1:a[2]>1?D1:a[2]>0?E1:a[3]>1?P1:a[3]>0?A1:N1}let i=n(t),o=i(t);return{c(){e=$(`Up
`),o.c(),l=Ge()},m(a,u){M(a,e,u),o.m(a,u),M(a,l,u)},p(a,u){i===(i=n(a))&&o?o.p(a,u):(o.d(1),o=i(a),o&&(o.c(),o.m(l.parentNode,l)))},d(a){a&&C(e),o.d(a),a&&C(l)}}}function N1(t){let e,l;return{c(){e=$(t[0]),l=$(" seconds")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&1&&Z(e,n[0])},d(n){n&&C(e),n&&C(l)}}}function A1(t){let e,l;return{c(){e=$(t[3]),l=$(" minute")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function P1(t){let e,l;return{c(){e=$(t[3]),l=$(" minutes")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&8&&Z(e,n[3])},d(n){n&&C(e),n&&C(l)}}}function E1(t){let e,l;return{c(){e=$(t[2]),l=$(" hour")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function D1(t){let e,l;return{c(){e=$(t[2]),l=$(" hours")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&4&&Z(e,n[2])},d(n){n&&C(e),n&&C(l)}}}function I1(t){let e,l;return{c(){e=$(t[1]),l=$(" day")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function O1(t){let e,l;return{c(){e=$(t[1]),l=$(" days")},m(n,i){M(n,e,i),M(n,l,i)},p(n,i){i&2&&Z(e,n[1])},d(n){n&&C(e),n&&C(l)}}}function R1(t){let e,l=t[0]&&iu(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=iu(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function L1(t,e,l){let{epoch:n}=e,i=0,o=0,a=0;return t.$$set=u=>{"epoch"in u&&l(0,n=u.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(l(1,i=Math.floor(n/86400)),l(2,o=Math.floor(n/3600)),l(3,a=Math.floor(n/60)))},[n,i,o,a]}class F1 extends Ee{constructor(e){super(),Pe(this,e,L1,R1,Ae,{epoch:0})}}function q1(t){let e,l,n;return{c(){e=m("span"),l=$(t[2]),r(e,"title",t[1]),r(e,"class",n="bd-"+t[0])},m(i,o){M(i,e,o),s(e,l)},p(i,[o]){o&4&&Z(l,i[2]),o&2&&r(e,"title",i[1]),o&1&&n!==(n="bd-"+i[0])&&r(e,"class",n)},i:fe,o:fe,d(i){i&&C(e)}}}function B1(t,e,l){let{color:n}=e,{title:i}=e,{text:o}=e;return t.$$set=a=>{"color"in a&&l(0,n=a.color),"title"in a&&l(1,i=a.title),"text"in a&&l(2,o=a.text)},[n,i,o]}class mn extends Ee{constructor(e){super(),Pe(this,e,B1,q1,Ae,{color:0,title:1,text:2})}}function U1(t){let e,l=`${Le(t[0].getDate())}.${Le(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,n;return{c(){e=m("span"),n=$(l),r(e,"class",t[1])},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=`${Le(i[0].getDate())}.${Le(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Le(i[0].getHours())}:${Le(i[0].getMinutes())}`)&&Z(n,l),o&2&&r(e,"class",i[1])},d(i){i&&C(e)}}}function j1(t){let e=`${Le(t[0].getDate())}. ${oo[t[0].getMonth()]} ${Le(t[0].getHours())}:${Le(t[0].getMinutes())}`,l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&1&&e!==(e=`${Le(n[0].getDate())}. ${oo[n[0].getMonth()]} ${Le(n[0].getHours())}:${Le(n[0].getMinutes())}`)&&Z(l,e)},d(n){n&&C(l)}}}function H1(t){let e;function l(o,a){return o[2]?j1:U1}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,a){i.m(o,a),M(o,e,a)},p(o,[a]){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},i:fe,o:fe,d(o){i.d(o),o&&C(e)}}}function W1(t,e,l){let{timestamp:n}=e,{fullTimeColor:i}=e,{offset:o}=e,a;return t.$$set=u=>{"timestamp"in u&&l(0,n=u.timestamp),"fullTimeColor"in u&&l(1,i=u.fullTimeColor),"offset"in u&&l(3,o=u.offset)},t.$$.update=()=>{t.$$.dirty&9&&(l(2,a=Math.abs(new Date().getTime()-n.getTime())<3e5),isNaN(o)||fl(n,o-(24+n.getHours()-n.getUTCHours())%24))},[n,i,a,o]}class Yc extends Ee{constructor(e){super(),Pe(this,e,W1,H1,Ae,{timestamp:0,fullTimeColor:1,offset:3})}}function z1(t){let e,l,n;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M10.343 3.94c.09-.542.56-.94 1.11-.94h1.093c.55 0 1.02.398 1.11.94l.149.894c.07.424.384.764.78.93.398.164.855.142 1.205-.108l.737-.527a1.125 1.125 0 011.45.12l.773.774c.39.389.44 1.002.12 1.45l-.527.737c-.25.35-.272.806-.107 1.204.165.397.505.71.93.78l.893.15c.543.09.94.56.94 1.109v1.094c0 .55-.397 1.02-.94 1.11l-.893.149c-.425.07-.765.383-.93.78-.165.398-.143.854.107 1.204l.527.738c.32.447.269 1.06-.12 1.45l-.774.773a1.125 1.125 0 01-1.449.12l-.738-.527c-.35-.25-.806-.272-1.203-.107-.397.165-.71.505-.781.929l-.149.894c-.09.542-.56.94-1.11.94h-1.094c-.55 0-1.019-.398-1.11-.94l-.148-.894c-.071-.424-.384-.764-.781-.93-.398-.164-.854-.142-1.204.108l-.738.527c-.447.32-1.06.269-1.45-.12l-.773-.774a1.125 1.125 0 01-.12-1.45l.527-.737c.25-.35.273-.806.108-1.204-.165-.397-.505-.71-.93-.78l-.894-.15c-.542-.09-.94-.56-.94-1.109v-1.094c0-.55.398-1.02.94-1.11l.894-.149c.424-.07.765-.383.93-.78.165-.398.143-.854-.107-1.204l-.527-.738a1.125 1.125 0 01.12-1.45l.773-.773a1.125 1.125 0 011.45-.12l.737.527c.35.25.807.272 1.204.107.397-.165.71-.505.78-.929l.15-.894z"),r(n,"stroke-linecap","round"),r(n,"stroke-linejoin","round"),r(n,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,l),s(e,n)},p:fe,i:fe,o:fe,d(i){i&&C(e)}}}class G1 extends Ee{constructor(e){super(),Pe(this,e,null,z1,Ae,{})}}function V1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class K1 extends Ee{constructor(e){super(),Pe(this,e,null,V1,Ae,{})}}function Y1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9 5.25h.008v.008H12v-.008z"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Ft extends Ee{constructor(e){super(),Pe(this,e,null,Y1,Ae,{})}}function Q1(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15M9 12l3 3m0 0l3-3m-3 3V2.25"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-6 h-6")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Qc extends Ee{constructor(e){super(),Pe(this,e,null,Q1,Ae,{})}}function X1(t){let e,l,n=t[1].version+"",i;return{c(){e=$("AMS reader "),l=m("span"),i=$(n)},m(o,a){M(o,e,a),M(o,l,a),s(l,i)},p(o,a){a&2&&n!==(n=o[1].version+"")&&Z(i,n)},d(o){o&&C(e),o&&C(l)}}}function su(t){let e,l=(t[0].t>-50?t[0].t.toFixed(1):"-")+"",n,i;return{c(){e=m("div"),n=$(l),i=$("°C"),r(e,"class","flex-none my-auto")},m(o,a){M(o,e,a),s(e,n),s(e,i)},p(o,a){a&1&&l!==(l=(o[0].t>-50?o[0].t.toFixed(1):"-")+"")&&Z(n,l)},d(o){o&&C(e)}}}function ou(t){let e,l="HAN: "+Ja(t[0].he),n;return{c(){e=m("div"),n=$(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="HAN: "+Ja(i[0].he))&&Z(n,l)},d(i){i&&C(e)}}}function ru(t){let e,l="MQTT: "+xa(t[0].me),n;return{c(){e=m("div"),n=$(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="MQTT: "+xa(i[0].me))&&Z(n,l)},d(i){i&&C(e)}}}function au(t){let e,l="PriceAPI: "+eu(t[0].ee),n;return{c(){e=m("div"),n=$(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l="PriceAPI: "+eu(i[0].ee))&&Z(n,l)},d(i){i&&C(e)}}}function uu(t){let e,l,n,i,o,a;return l=new el({props:{to:"/configuration",$$slots:{default:[Z1]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[J1]},$$scope:{ctx:t}}}),{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("div"),ie(o.$$.fragment),r(e,"class","flex-none px-1 mt-1"),r(e,"title","Configuration"),r(i,"class","flex-none px-1 mt-1"),r(i,"title","Device information")},m(u,c){M(u,e,c),le(l,e,null),M(u,n,c),M(u,i,c),le(o,i,null),a=!0},i(u){a||(D(l.$$.fragment,u),D(o.$$.fragment,u),a=!0)},o(u){q(l.$$.fragment,u),q(o.$$.fragment,u),a=!1},d(u){u&&C(e),ne(l),u&&C(n),u&&C(i),ne(o)}}}function Z1(t){let e,l;return e=new G1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function J1(t){let e,l;return e=new K1({}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function fu(t){let e,l,n,i,o;const a=[em,x1],u=[];function c(f,p){return f[1].security==0||f[0].a?0:1}return l=c(t),n=u[l]=a[l](t),{c(){e=m("div"),n.c(),r(e,"class","flex-none mr-3 text-yellow-500"),r(e,"title",i="New version: "+t[2].tag_name)},m(f,p){M(f,e,p),u[l].m(e,null),o=!0},p(f,p){let _=l;l=c(f),l===_?u[l].p(f,p):(De(),q(u[_],1,1,()=>{u[_]=null}),Ie(),n=u[l],n?n.p(f,p):(n=u[l]=a[l](f),n.c()),D(n,1),n.m(e,null)),(!o||p&4&&i!==(i="New version: "+f[2].tag_name))&&r(e,"title",i)},i(f){o||(D(n),o=!0)},o(f){q(n),o=!1},d(f){f&&C(e),u[l].d()}}}function x1(t){let e,l,n=t[2].tag_name+"",i;return{c(){e=m("span"),l=$("New version: "),i=$(n)},m(o,a){M(o,e,a),s(e,l),s(e,i)},p(o,a){a&4&&n!==(n=o[2].tag_name+"")&&Z(i,n)},i:fe,o:fe,d(o){o&&C(e)}}}function em(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,p;return u=new Qc({}),{c(){e=m("button"),l=m("span"),n=$("New version: "),o=$(i),a=h(),ie(u.$$.fragment),r(l,"class","mt-1"),r(e,"class","flex")},m(_,b){M(_,e,b),s(e,l),s(l,n),s(l,o),s(e,a),le(u,e,null),c=!0,f||(p=ee(e,"click",t[3]),f=!0)},p(_,b){(!c||b&4)&&i!==(i=_[2].tag_name+"")&&Z(o,i)},i(_){c||(D(u.$$.fragment,_),c=!0)},o(_){q(u.$$.fragment,_),c=!1},d(_){_&&C(e),ne(u),f=!1,p()}}}function tm(t){let e,l,n,i,o,a,u,c,f,p,_,b,v=(t[0].m?(t[0].m/1e3).toFixed(1):"-")+"",d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,we,me,Se,je,Oe,He;i=new el({props:{to:"/",$$slots:{default:[X1]},$$scope:{ctx:t}}}),c=new F1({props:{epoch:t[0].u}});let ye=t[0].t>-50&&su(t);T=new mn({props:{title:"ESP",text:t[1].booting?"Booting":t[0].v>2?t[0].v.toFixed(2)+"V":"ESP",color:ql(t[1].booting?2:t[0].em)}}),B=new mn({props:{title:"HAN",text:"HAN",color:ql(t[1].booting?9:t[0].hm)}}),R=new mn({props:{title:"WiFi",text:t[0].r?t[0].r.toFixed(0)+"dBm":"WiFi",color:ql(t[1].booting?9:t[0].wm)}}),F=new mn({props:{title:"MQTT",text:"MQTT",color:ql(t[1].booting?9:t[0].mm)}});let Ne=(t[0].he<0||t[0].he>0)&&ou(t),Re=t[0].me<0&&ru(t),$e=(t[0].ee>0||t[0].ee<0)&&au(t);re=new Yc({props:{timestamp:t[0].c?new Date(t[0].c*1e3):new Date(0),offset:t[1].clock_offset,fullTimeColor:"text-red-500"}});let y=t[1].vndcfg&&t[1].usrcfg&&uu(t);je=new Ft({});let g=t[1].fwconsent===1&&t[2]&&fu(t);return{c(){e=m("nav"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=m("div"),ie(c.$$.fragment),f=h(),ye&&ye.c(),p=h(),_=m("div"),b=$("Free mem: "),d=$(v),k=$("kb"),A=h(),S=m("div"),ie(T.$$.fragment),E=h(),ie(B.$$.fragment),P=h(),ie(R.$$.fragment),L=h(),ie(F.$$.fragment),x=h(),Ne&&Ne.c(),j=h(),Re&&Re.c(),z=h(),$e&&$e.c(),G=h(),V=m("div"),W=m("div"),U=m("a"),K=m("img"),Y=h(),X=m("div"),ie(re.$$.fragment),ue=h(),y&&y.c(),we=h(),me=m("div"),Se=m("a"),ie(je.$$.fragment),Oe=h(),g&&g.c(),r(n,"class","flex text-lg text-gray-100 p-2"),r(u,"class","flex-none my-auto"),r(_,"class","flex-none my-auto"),r(a,"class","flex-none my-auto p-2 flex space-x-4"),r(S,"class","flex-auto flex-wrap my-auto justify-center p-2"),r(K,"class","gh-logo"),to(K.src,H=S1)||r(K,"src",H),r(K,"alt","GitHub repo"),r(U,"class","float-right"),r(U,"href","https://github.com/UtilitechAS/amsreader-firmware"),r(U,"target","_blank"),r(U,"rel","noreferrer"),r(U,"aria-label","GitHub"),r(W,"class","flex-none"),r(X,"class","flex-none my-auto px-2"),r(Se,"href",qt("")),r(Se,"target","_blank"),r(Se,"rel","noreferrer"),r(me,"class","flex-none px-1 mt-1"),r(me,"title","Documentation"),r(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),r(l,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),r(e,"class","bg-violet-600 p-1 rounded-md mx-2")},m(w,N){M(w,e,N),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,u),le(c,u,null),s(a,f),ye&&ye.m(a,null),s(a,p),s(a,_),s(_,b),s(_,d),s(_,k),s(l,A),s(l,S),le(T,S,null),s(S,E),le(B,S,null),s(S,P),le(R,S,null),s(S,L),le(F,S,null),s(l,x),Ne&&Ne.m(l,null),s(l,j),Re&&Re.m(l,null),s(l,z),$e&&$e.m(l,null),s(l,G),s(l,V),s(V,W),s(W,U),s(U,K),s(V,Y),s(V,X),le(re,X,null),s(V,ue),y&&y.m(V,null),s(V,we),s(V,me),s(me,Se),le(je,Se,null),s(V,Oe),g&&g.m(V,null),He=!0},p(w,[N]){const I={};N&18&&(I.$$scope={dirty:N,ctx:w}),i.$set(I);const Q={};N&1&&(Q.epoch=w[0].u),c.$set(Q),w[0].t>-50?ye?ye.p(w,N):(ye=su(w),ye.c(),ye.m(a,p)):ye&&(ye.d(1),ye=null),(!He||N&1)&&v!==(v=(w[0].m?(w[0].m/1e3).toFixed(1):"-")+"")&&Z(d,v);const J={};N&3&&(J.text=w[1].booting?"Booting":w[0].v>2?w[0].v.toFixed(2)+"V":"ESP"),N&3&&(J.color=ql(w[1].booting?2:w[0].em)),T.$set(J);const se={};N&3&&(se.color=ql(w[1].booting?9:w[0].hm)),B.$set(se);const ce={};N&1&&(ce.text=w[0].r?w[0].r.toFixed(0)+"dBm":"WiFi"),N&3&&(ce.color=ql(w[1].booting?9:w[0].wm)),R.$set(ce);const ve={};N&3&&(ve.color=ql(w[1].booting?9:w[0].mm)),F.$set(ve),w[0].he<0||w[0].he>0?Ne?Ne.p(w,N):(Ne=ou(w),Ne.c(),Ne.m(l,j)):Ne&&(Ne.d(1),Ne=null),w[0].me<0?Re?Re.p(w,N):(Re=ru(w),Re.c(),Re.m(l,z)):Re&&(Re.d(1),Re=null),w[0].ee>0||w[0].ee<0?$e?$e.p(w,N):($e=au(w),$e.c(),$e.m(l,G)):$e&&($e.d(1),$e=null);const Te={};N&1&&(Te.timestamp=w[0].c?new Date(w[0].c*1e3):new Date(0)),N&2&&(Te.offset=w[1].clock_offset),re.$set(Te),w[1].vndcfg&&w[1].usrcfg?y?N&2&&D(y,1):(y=uu(w),y.c(),D(y,1),y.m(V,we)):y&&(De(),q(y,1,1,()=>{y=null}),Ie()),w[1].fwconsent===1&&w[2]?g?(g.p(w,N),N&6&&D(g,1)):(g=fu(w),g.c(),D(g,1),g.m(V,null)):g&&(De(),q(g,1,1,()=>{g=null}),Ie())},i(w){He||(D(i.$$.fragment,w),D(c.$$.fragment,w),D(T.$$.fragment,w),D(B.$$.fragment,w),D(R.$$.fragment,w),D(F.$$.fragment,w),D(re.$$.fragment,w),D(y),D(je.$$.fragment,w),D(g),He=!0)},o(w){q(i.$$.fragment,w),q(c.$$.fragment,w),q(T.$$.fragment,w),q(B.$$.fragment,w),q(R.$$.fragment,w),q(F.$$.fragment,w),q(re.$$.fragment,w),q(y),q(je.$$.fragment,w),q(g),He=!1},d(w){w&&C(e),ne(i),ne(c),ye&&ye.d(),ne(T),ne(B),ne(R),ne(F),Ne&&Ne.d(),Re&&Re.d(),$e&&$e.d(),ne(re),y&&y.d(),ne(je),g&&g.d()}}}function lm(t,e,l){let{data:n={}}=e,i={},o={};function a(){confirm("Do you want to upgrade this device to "+o.tag_name+"?")&&(!ui(i.board)||confirm(Ns(be(i.chip,i.board))))&&(Bt.update(u=>(u.upgrading=!0,u)),Vc(o.tag_name))}return Bt.subscribe(u=>{l(1,i=u),u.fwconsent===1&&T1()}),Ao.subscribe(u=>{l(2,o=Kc(i.version,u))}),t.$$set=u=>{"data"in u&&l(0,n=u.data)},[n,i,o,a]}class nm extends Ee{constructor(e){super(),Pe(this,e,lm,tm,Ae,{data:0})}}function im(t){let e,l,n,i;return{c(){e=Fe("svg"),l=Fe("path"),n=Fe("path"),r(l,"d",eo(150,150,115,210,510)),r(l,"stroke","#eee"),r(l,"fill","none"),r(l,"stroke-width","55"),r(n,"d",i=eo(150,150,115,210,210+300*t[0]/100)),r(n,"stroke",t[1]),r(n,"fill","none"),r(n,"stroke-width","55"),r(e,"viewBox","0 0 300 300"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"height","100%")},m(o,a){M(o,e,a),s(e,l),s(e,n)},p(o,[a]){a&1&&i!==(i=eo(150,150,115,210,210+300*o[0]/100))&&r(n,"d",i),a&2&&r(n,"stroke",o[1])},i:fe,o:fe,d(o){o&&C(e)}}}function cu(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 eo(t,e,l,n,i){var o=cu(t,e,l,i),a=cu(t,e,l,n),u=i-n<=180?"0":"1",c=["M",o.x,o.y,"A",l,l,0,u,0,a.x,a.y].join(" ");return c}function sm(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 om extends Ee{constructor(e){super(),Pe(this,e,sm,im,Ae,{pct:0,color:1})}}function mu(t){let e,l,n,i,o,a,u,c;return{c(){e=m("br"),l=h(),n=m("span"),i=$(t[3]),o=h(),a=m("span"),u=$(t[4]),c=$("/kWh"),r(n,"class","pl-sub"),r(a,"class","pl-snt")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),M(f,o,p),M(f,a,p),s(a,u),s(a,c)},p(f,p){p&8&&Z(i,f[3]),p&16&&Z(u,f[4])},d(f){f&&C(e),f&&C(l),f&&C(n),f&&C(o),f&&C(a)}}}function rm(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A;l=new om({props:{pct:t[6],color:t[5](t[6])}});let S=t[3]&&mu(t);return{c(){e=m("div"),ie(l.$$.fragment),n=h(),i=m("span"),o=m("span"),a=$(t[2]),u=h(),c=m("br"),f=h(),p=m("span"),_=$(t[0]),b=h(),v=m("span"),d=$(t[1]),k=h(),S&&S.c(),r(o,"class","pl-lab"),r(p,"class","pl-val"),r(v,"class","pl-unt"),r(i,"class","pl-ov"),r(e,"class","pl-root")},m(T,E){M(T,e,E),le(l,e,null),s(e,n),s(e,i),s(i,o),s(o,a),s(i,u),s(i,c),s(i,f),s(i,p),s(p,_),s(i,b),s(i,v),s(v,d),s(i,k),S&&S.m(i,null),A=!0},p(T,[E]){const B={};E&64&&(B.pct=T[6]),E&96&&(B.color=T[5](T[6])),l.$set(B),(!A||E&4)&&Z(a,T[2]),(!A||E&1)&&Z(_,T[0]),(!A||E&2)&&Z(d,T[1]),T[3]?S?S.p(T,E):(S=mu(T),S.c(),S.m(i,null)):S&&(S.d(1),S=null)},i(T){A||(D(l.$$.fragment,T),A=!0)},o(T){q(l.$$.fragment,T),A=!1},d(T){T&&C(e),ne(l),S&&S.d()}}}function am(t,e,l){let{val:n}=e,{max:i}=e,{unit:o}=e,{label:a}=e,{sub:u=""}=e,{subunit:c=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&l(0,n=_.val),"max"in _&&l(7,i=_.max),"unit"in _&&l(1,o=_.unit),"label"in _&&l(2,a=_.label),"sub"in _&&l(3,u=_.sub),"subunit"in _&&l(4,c=_.subunit),"colorFn"in _&&l(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&l(6,p=Math.min(n,i)/i*100)},[n,o,a,u,c,f,p,i]}class Xc extends Ee{constructor(e){super(),Pe(this,e,am,rm,Ae,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function pu(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function _u(t,e,l){const n=t.slice();return n[9]=e[l],n[11]=l,n}function du(t,e,l){const n=t.slice();return n[13]=e[l],n}function vu(t){let e,l,n,i,o,a=t[0].title&&hu(t),u=t[0].y.ticks,c=[];for(let v=0;v<u.length;v+=1)c[v]=gu(du(t,u,v));let f=t[0].x.ticks,p=[];for(let v=0;v<f.length;v+=1)p[v]=yu(_u(t,f,v));let _=t[0].points,b=[];for(let v=0;v<_.length;v+=1)b[v]=Pu(pu(t,_,v));return{c(){a&&a.c(),e=h(),l=Fe("svg"),n=Fe("g");for(let v=0;v<c.length;v+=1)c[v].c();i=Fe("g");for(let v=0;v<p.length;v+=1)p[v].c();o=Fe("g");for(let v=0;v<b.length;v+=1)b[v].c();r(n,"class","axis y-axis"),r(i,"class","axis x-axis"),r(o,"class","bars"),r(l,"height",t[4])},m(v,d){a&&a.m(v,d),M(v,e,d),M(v,l,d),s(l,n);for(let k=0;k<c.length;k+=1)c[k]&&c[k].m(n,null);s(l,i);for(let k=0;k<p.length;k+=1)p[k]&&p[k].m(i,null);s(l,o);for(let k=0;k<b.length;k+=1)b[k]&&b[k].m(o,null)},p(v,d){if(v[0].title?a?a.p(v,d):(a=hu(v),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),d&65){u=v[0].y.ticks;let k;for(k=0;k<u.length;k+=1){const A=du(v,u,k);c[k]?c[k].p(A,d):(c[k]=gu(A),c[k].c(),c[k].m(n,null))}for(;k<c.length;k+=1)c[k].d(1);c.length=u.length}if(d&57){f=v[0].x.ticks;let k;for(k=0;k<f.length;k+=1){const A=_u(v,f,k);p[k]?p[k].p(A,d):(p[k]=yu(A),p[k].c(),p[k].m(i,null))}for(;k<p.length;k+=1)p[k].d(1);p.length=f.length}if(d&233){_=v[0].points;let k;for(k=0;k<_.length;k+=1){const A=pu(v,_,k);b[k]?b[k].p(A,d):(b[k]=Pu(A),b[k].c(),b[k].m(o,null))}for(;k<b.length;k+=1)b[k].d(1);b.length=_.length}d&16&&r(l,"height",v[4])},d(v){a&&a.d(v),v&&C(e),v&&C(l),cl(c,v),cl(p,v),cl(b,v)}}}function hu(t){let e,l=t[0].title+"",n;return{c(){e=m("strong"),n=$(l),r(e,"class","text-sm")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[0].title+"")&&Z(n,l)},d(i){i&&C(e)}}}function bu(t){let e,l,n,i=t[13].label+"",o,a,u,c;return{c(){e=Fe("g"),l=Fe("line"),n=Fe("text"),o=$(i),r(l,"x2","100%"),r(n,"y","-4"),r(n,"x",a=t[13].align=="right"?"85%":""),r(e,"class",u="tick tick-"+t[13].value+" tick-"+t[13].color),r(e,"transform",c="translate(0, "+t[6](t[13].value)+")")},m(f,p){M(f,e,p),s(e,l),s(e,n),s(n,o)},p(f,p){p&1&&i!==(i=f[13].label+"")&&Z(o,i),p&1&&a!==(a=f[13].align=="right"?"85%":"")&&r(n,"x",a),p&1&&u!==(u="tick tick-"+f[13].value+" tick-"+f[13].color)&&r(e,"class",u),p&65&&c!==(c="translate(0, "+f[6](f[13].value)+")")&&r(e,"transform",c)},d(f){f&&C(e)}}}function gu(t){let e=!isNaN(t[6](t[13].value)),l,n=e&&bu(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&65&&(e=!isNaN(i[6](i[13].value))),e?n?n.p(i,o):(n=bu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function ku(t){let e,l,n=(t[3]>20||t[11]%2==0)&&wu(t);return{c(){e=Fe("g"),n&&n.c(),r(e,"class","tick"),r(e,"transform",l="translate("+t[5](t[11])+","+t[4]+")")},m(i,o){M(i,e,o),n&&n.m(e,null)},p(i,o){i[3]>20||i[11]%2==0?n?n.p(i,o):(n=wu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o&48&&l!==(l="translate("+i[5](i[11])+","+i[4]+")")&&r(e,"transform",l)},d(i){i&&C(e),n&&n.d()}}}function wu(t){let e,l=t[9].label+"",n,i;return{c(){e=Fe("text"),n=$(l),r(e,"x",i=t[3]/2),r(e,"y","-4")},m(o,a){M(o,e,a),s(e,n)},p(o,a){a&1&&l!==(l=o[9].label+"")&&Z(n,l),a&8&&i!==(i=o[3]/2)&&r(e,"x",i)},d(o){o&&C(e)}}}function yu(t){let e=!isNaN(t[5](t[11])),l,n=e&&ku(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),M(i,l,o)},p(i,o){o&32&&(e=!isNaN(i[5](i[11]))),e?n?n.p(i,o):(n=ku(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function Cu(t){let e,l,n=t[9].value!==void 0&&Mu(t),i=t[9].value2>1e-4&&Su(t);return{c(){e=Fe("g"),n&&n.c(),l=Fe("g"),i&&i.c()},m(o,a){M(o,e,a),n&&n.m(e,null),M(o,l,a),i&&i.m(l,null)},p(o,a){o[9].value!==void 0?n?n.p(o,a):(n=Mu(o),n.c(),n.m(e,null)):n&&(n.d(1),n=null),o[9].value2>1e-4?i?i.p(o,a):(i=Su(o),i.c(),i.m(l,null)):i&&(i.d(1),i=null)},d(o){o&&C(e),n&&n.d(),o&&C(l),i&&i.d()}}}function Mu(t){let e,l,n,i,o,a,u,c=t[3]>15&&$u(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ge(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](t[9].value)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](Math.min(t[0].y.min,0)+t[9].value)),r(e,"fill",a=t[9].color)},m(f,p){M(f,e,p),c&&c.m(f,p),M(f,u,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),p&65&&n!==(n=f[6](f[9].value))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](Math.min(f[0].y.min,0)+f[9].value))&&r(e,"height",o),p&1&&a!==(a=f[9].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,p):(c=$u(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function $u(t){let e,l=t[9].label+"",n,i,o,a,u,c,f=t[9].title&&Tu(t);return{c(){e=Fe("text"),n=$(l),f&&f.c(),c=Ge(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor",o=t[3]<pn?"left":"middle"),r(e,"fill",a=t[6](t[9].value)>t[6](0)-t[7]?t[9].color:"white"),r(e,"transform",u="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]<pn?90:0)+")")},m(p,_){M(p,e,_),s(e,n),f&&f.m(p,_),M(p,c,_)},p(p,_){_&1&&l!==(l=p[9].label+"")&&Z(n,l),_&8&&i!==(i=p[3]-4)&&r(e,"width",i),_&8&&o!==(o=p[3]<pn?"left":"middle")&&r(e,"text-anchor",o),_&193&&a!==(a=p[6](p[9].value)>p[6](0)-p[7]?p[9].color:"white")&&r(e,"fill",a),_&233&&u!==(u="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]<pn?90:0)+")")&&r(e,"transform",u),p[9].title?f?f.p(p,_):(f=Tu(p),f.c(),f.m(c.parentNode,c)):f&&(f.d(1),f=null)},d(p){p&&C(e),f&&f.d(p),p&&C(c)}}}function Tu(t){let e,l=t[9].title+"",n;return{c(){e=Fe("title"),n=$(l)},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title+"")&&Z(n,l)},d(i){i&&C(e)}}}function Su(t){let e,l,n,i,o,a,u,c=t[3]>15&&Nu(t);return{c(){e=Fe("rect"),c&&c.c(),u=Ge(),r(e,"x",l=t[5](t[11])+2),r(e,"y",n=t[6](0)),r(e,"width",i=t[3]-4),r(e,"height",o=t[6](t[0].y.min)-t[6](t[0].y.min+t[9].value2)),r(e,"fill",a=t[9].color2?t[9].color2:t[9].color)},m(f,p){M(f,e,p),c&&c.m(f,p),M(f,u,p)},p(f,p){p&32&&l!==(l=f[5](f[11])+2)&&r(e,"x",l),p&64&&n!==(n=f[6](0))&&r(e,"y",n),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&65&&o!==(o=f[6](f[0].y.min)-f[6](f[0].y.min+f[9].value2))&&r(e,"height",o),p&1&&a!==(a=f[9].color2?f[9].color2:f[9].color)&&r(e,"fill",a),f[3]>15?c?c.p(f,p):(c=Nu(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function Nu(t){let e,l=t[9].label2+"",n,i,o,a,u,c=t[9].title2&&Au(t);return{c(){e=Fe("text"),n=$(l),c&&c.c(),u=Ge(),r(e,"width",i=t[3]-4),r(e,"dominant-baseline","middle"),r(e,"text-anchor","middle"),r(e,"fill",o=t[6](-t[9].value2)<t[6](0)+15?t[9].color2?t[9].color2:t[9].color:"white"),r(e,"transform",a="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]<pn?90:0)+")")},m(f,p){M(f,e,p),s(e,n),c&&c.m(f,p),M(f,u,p)},p(f,p){p&1&&l!==(l=f[9].label2+"")&&Z(n,l),p&8&&i!==(i=f[3]-4)&&r(e,"width",i),p&65&&o!==(o=f[6](-f[9].value2)<f[6](0)+15?f[9].color2?f[9].color2:f[9].color:"white")&&r(e,"fill",o),p&105&&a!==(a="translate("+(f[5](f[11])+f[3]/2)+" "+(f[6](-f[9].value2)<f[6](0)+15?f[6](-f[9].value2)+15:f[6](-f[9].value2)-14)+") rotate("+(f[3]<pn?90:0)+")")&&r(e,"transform",a),f[9].title2?c?c.p(f,p):(c=Au(f),c.c(),c.m(u.parentNode,u)):c&&(c.d(1),c=null)},d(f){f&&C(e),c&&c.d(f),f&&C(u)}}}function Au(t){let e,l=t[9].title2+"",n;return{c(){e=Fe("title"),n=$(l)},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&1&&l!==(l=i[9].title2+"")&&Z(n,l)},d(i){i&&C(e)}}}function Pu(t){let e=!isNaN(t[5](t[11]))&&!isNaN(t[6](t[9].value)),l,n=e&&Cu(t);return{c(){n&&n.c(),l=Ge()},m(i,o){n&&n.m(i,o),M(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=Cu(i),n.c(),n.m(l.parentNode,l)):n&&(n.d(1),n=null)},d(i){n&&n.d(i),i&&C(l)}}}function um(t){let e,l,n=t[0].x.ticks&&t[0].points&&t[4]&&vu(t);return{c(){e=m("div"),n&&n.c(),r(e,"class","chart"),et(()=>t[8].call(e))},m(i,o){M(i,e,o),n&&n.m(e,null),l=u0(e,t[8].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?n?n.p(i,o):(n=vu(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:fe,o:fe,d(i){i&&C(e),n&&n.d(),l()}}}let pn=30;function fm(t,e,l){let{config:n}=e,i,o,a,u,c,f,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,f=o-(n.title?20:0));let b=i-(n.padding.left+n.padding.right);l(3,a=b/n.points.length),l(7,p=a<pn?30:15);let v=(f-n.padding.top-n.padding.bottom)/(n.y.max-n.y.min);l(5,u=function(d){return d*a+n.padding.left}),l(6,c=function(d){let k=0;return d>n.y.max?k=n.padding.bottom:d<n.y.min?k=f-n.padding.bottom:k=f-n.padding.bottom-(d-n.y.min)*v,k>f||k<0?0:k})}},[n,i,o,a,f,u,c,p,_]}class dn extends Ee{constructor(e){super(),Pe(this,e,fm,um,Ae,{config:0})}}function cm(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function mm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{ds:a}=e,u={};function c(f){return{label:ge(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:y1(f||0)}}return t.$$set=f=>{"u1"in f&&l(1,n=f.u1),"u2"in f&&l(2,i=f.u2),"u3"in f&&l(3,o=f.u3),"ds"in f&&l(4,a=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];n>0&&(f.push({label:a===1?"L1-L2":"L1"}),p.push(c(n))),i>0&&(f.push({label:a===1?"L1-L3":"L2"}),p.push(c(i))),o>0&&(f.push({label:a===1?"L2-L3":"L3"}),p.push(c(o))),l(0,u={padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[u,n,i,o,a]}class pm extends Ee{constructor(e){super(),Pe(this,e,mm,cm,Ae,{u1:1,u2:2,u3:3,ds:4})}}function _m(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function dm(t,e,l){let{u1:n}=e,{u2:i}=e,{u3:o}=e,{i1:a}=e,{i2:u}=e,{i3:c}=e,{max:f}=e,p={};function _(b){return{label:ge(b)+"A",title:b.toFixed(1)+" A",value:isNaN(b)?0:b,color:Fc(b?b/f*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,a=b.i1),"i2"in b&&l(5,u=b.i2),"i3"in b&&l(6,c=b.i3),"max"in b&&l(7,f=b.max)},t.$$.update=()=>{if(t.$$.dirty&254){let b=[],v=[];n>0&&(b.push({label:"L1"}),v.push(_(a))),i>0&&(b.push({label:"L2"}),v.push(_(u))),o>0&&(b.push({label:"L3"}),v.push(_(c))),l(0,p={padding:{top:20,right:15,bottom:20,left:35},y:{min:0,max:f,ticks:[{value:0,label:"0%"},{value:f/4,label:"25%"},{value:f/2,label:"50%"},{value:f/4*3,label:"75%"},{value:f,label:"100%"}]},x:{ticks:b},points:v})}},[p,n,i,o,a,u,c,f]}class vm extends Ee{constructor(e){super(),Pe(this,e,dm,_m,Ae,{u1:1,u2:2,u3:3,i1:4,i2:5,i3:6,max:7})}}function hm(t){let e,l,n,i,o,a,u,c=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,b,v,d,k=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",A,S,T,E,B,P,R,L=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",F,x,j,z,G,V,W=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",U,K;return{c(){e=m("div"),l=m("strong"),l.textContent="Reactive",n=h(),i=m("div"),o=m("div"),o.textContent="Instant in",a=h(),u=m("div"),f=$(c),p=$(" VAr"),_=h(),b=m("div"),b.textContent="Instant out",v=h(),d=m("div"),A=$(k),S=$(" VAr"),T=h(),E=m("div"),B=m("div"),B.textContent="Total in",P=h(),R=m("div"),F=$(L),x=$(" kVArh"),j=h(),z=m("div"),z.textContent="Total out",G=h(),V=m("div"),U=$(W),K=$(" kVArh"),r(u,"class","text-right"),r(d,"class","text-right"),r(i,"class","grid grid-cols-2 mt-4"),r(R,"class","text-right"),r(V,"class","text-right"),r(E,"class","grid grid-cols-2 mt-4"),r(e,"class","mx-2 text-sm")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),s(i,o),s(i,a),s(i,u),s(u,f),s(u,p),s(i,_),s(i,b),s(i,v),s(i,d),s(d,A),s(d,S),s(e,T),s(e,E),s(E,B),s(E,P),s(E,R),s(R,F),s(R,x),s(E,j),s(E,z),s(E,G),s(E,V),s(V,U),s(V,K)},p(H,[Y]){Y&1&&c!==(c=(typeof H[0]<"u"?H[0].toFixed(0):"-")+"")&&Z(f,c),Y&2&&k!==(k=(typeof H[1]<"u"?H[1].toFixed(0):"-")+"")&&Z(A,k),Y&4&&L!==(L=(typeof H[2]<"u"?H[2].toFixed(1):"-")+"")&&Z(F,L),Y&8&&W!==(W=(typeof H[3]<"u"?H[3].toFixed(1):"-")+"")&&Z(U,W)},i:fe,o:fe,d(H){H&&C(e)}}}function bm(t,e,l){let{importInstant:n}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:a}=e;return t.$$set=u=>{"importInstant"in u&&l(0,n=u.importInstant),"exportInstant"in u&&l(1,i=u.exportInstant),"importTotal"in u&&l(2,o=u.importTotal),"exportTotal"in u&&l(3,a=u.exportTotal)},[n,i,o,a]}class gm extends Ee{constructor(e){super(),Pe(this,e,bm,hm,Ae,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function Eu(t){let e;function l(o,a){return o[3]?wm:km}let n=l(t),i=n(t);return{c(){i.c(),e=Ge()},m(o,a){i.m(o,a),M(o,e,a)},p(o,a){n===(n=l(o))&&i?i.p(o,a):(i.d(1),i=n(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&C(e)}}}function km(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,p,_,b,v,d=ge(t[1].d.u,1)+"",k,A,S,T,E,B,P=ge(t[1].m.u)+"",R,L,F,x,j,z,G=ge(t[0].last_month.u)+"",V,W,U,K,H=t[4]&&Du(t);return{c(){e=m("strong"),e.textContent="Consumption",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=$(u),f=$(" kWh"),p=h(),_=m("div"),_.textContent="Day",b=h(),v=m("div"),k=$(d),A=$(" kWh"),S=h(),T=m("div"),T.textContent="Month",E=h(),B=m("div"),R=$(P),L=$(" kWh"),F=h(),x=m("div"),x.textContent="Last month",j=h(),z=m("div"),V=$(G),W=$(" kWh"),U=h(),H&&H.c(),K=Ge(),r(a,"class","text-right"),r(v,"class","text-right"),r(B,"class","text-right"),r(z,"class","text-right"),r(n,"class","grid grid-cols-2 mb-3")},m(Y,X){M(Y,e,X),M(Y,l,X),M(Y,n,X),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,p),s(n,_),s(n,b),s(n,v),s(v,k),s(v,A),s(n,S),s(n,T),s(n,E),s(n,B),s(B,R),s(B,L),s(n,F),s(n,x),s(n,j),s(n,z),s(z,V),s(z,W),M(Y,U,X),H&&H.m(Y,X),M(Y,K,X)},p(Y,X){X&2&&u!==(u=ge(Y[1].h.u,2)+"")&&Z(c,u),X&2&&d!==(d=ge(Y[1].d.u,1)+"")&&Z(k,d),X&2&&P!==(P=ge(Y[1].m.u)+"")&&Z(R,P),X&1&&G!==(G=ge(Y[0].last_month.u)+"")&&Z(V,G),Y[4]?H?H.p(Y,X):(H=Du(Y),H.c(),H.m(K.parentNode,K)):H&&(H.d(1),H=null)},d(Y){Y&&C(e),Y&&C(l),Y&&C(n),Y&&C(U),H&&H.d(Y),Y&&C(K)}}}function wm(t){let e,l,n,i,o,a,u=ge(t[1].h.u,2)+"",c,f,p,_,b,v,d,k=ge(t[1].d.u,1)+"",A,S,T,E,B,P,R,L=ge(t[1].m.u)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.u)+"",K,H,Y,X,re,ue,we,me,Se,je,Oe,He=ge(t[1].h.p,2)+"",ye,Ne,Re,$e,y,g,w,N=ge(t[1].d.p,1)+"",I,Q,J,se,ce,ve,Te,oe=ge(t[1].m.p)+"",pe,Be,_e,Ce,vt,Hl,tl,ct=ge(t[0].last_month.p)+"",Tl,pl,Ut,ht,Ye=t[4]&&Iu(t),Qe=t[4]&&Ou(t),Xe=t[4]&&Ru(t),Ue=t[4]&&Lu(t),Ze=t[4]&&Fu(t),We=t[4]&&qu(t),Je=t[4]&&Bu(t),xe=t[4]&&Uu(t);return{c(){e=m("strong"),e.textContent="Import",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=$(u),f=$(" kWh"),p=h(),Ye&&Ye.c(),_=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),A=$(k),S=$(" kWh"),T=h(),Qe&&Qe.c(),E=h(),B=m("div"),B.textContent="Month",P=h(),R=m("div"),F=$(L),x=$(" kWh"),j=h(),Xe&&Xe.c(),z=h(),G=m("div"),G.textContent="Last mo.",V=h(),W=m("div"),K=$(U),H=$(" kWh"),Y=h(),Ue&&Ue.c(),re=h(),ue=m("strong"),ue.textContent="Export",we=h(),me=m("div"),Se=m("div"),Se.textContent="Hour",je=h(),Oe=m("div"),ye=$(He),Ne=$(" kWh"),Re=h(),Ze&&Ze.c(),$e=h(),y=m("div"),y.textContent="Day",g=h(),w=m("div"),I=$(N),Q=$(" kWh"),J=h(),We&&We.c(),se=h(),ce=m("div"),ce.textContent="Month",ve=h(),Te=m("div"),pe=$(oe),Be=$(" kWh"),_e=h(),Je&&Je.c(),Ce=h(),vt=m("div"),vt.textContent="Last mo.",Hl=h(),tl=m("div"),Tl=$(ct),pl=$(" kWh"),Ut=h(),xe&&xe.c(),r(a,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(W,"class","text-right"),r(n,"class",X="grid grid-cols-"+t[5]+" mb-3"),r(Oe,"class","text-right"),r(w,"class","text-right"),r(Te,"class","text-right"),r(tl,"class","text-right"),r(me,"class",ht="grid grid-cols-"+t[5])},m(de,Me){M(de,e,Me),M(de,l,Me),M(de,n,Me),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(n,p),Ye&&Ye.m(n,null),s(n,_),s(n,b),s(n,v),s(n,d),s(d,A),s(d,S),s(n,T),Qe&&Qe.m(n,null),s(n,E),s(n,B),s(n,P),s(n,R),s(R,F),s(R,x),s(n,j),Xe&&Xe.m(n,null),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(n,Y),Ue&&Ue.m(n,null),M(de,re,Me),M(de,ue,Me),M(de,we,Me),M(de,me,Me),s(me,Se),s(me,je),s(me,Oe),s(Oe,ye),s(Oe,Ne),s(me,Re),Ze&&Ze.m(me,null),s(me,$e),s(me,y),s(me,g),s(me,w),s(w,I),s(w,Q),s(me,J),We&&We.m(me,null),s(me,se),s(me,ce),s(me,ve),s(me,Te),s(Te,pe),s(Te,Be),s(me,_e),Je&&Je.m(me,null),s(me,Ce),s(me,vt),s(me,Hl),s(me,tl),s(tl,Tl),s(tl,pl),s(me,Ut),xe&&xe.m(me,null)},p(de,Me){Me&2&&u!==(u=ge(de[1].h.u,2)+"")&&Z(c,u),de[4]?Ye?Ye.p(de,Me):(Ye=Iu(de),Ye.c(),Ye.m(n,_)):Ye&&(Ye.d(1),Ye=null),Me&2&&k!==(k=ge(de[1].d.u,1)+"")&&Z(A,k),de[4]?Qe?Qe.p(de,Me):(Qe=Ou(de),Qe.c(),Qe.m(n,E)):Qe&&(Qe.d(1),Qe=null),Me&2&&L!==(L=ge(de[1].m.u)+"")&&Z(F,L),de[4]?Xe?Xe.p(de,Me):(Xe=Ru(de),Xe.c(),Xe.m(n,z)):Xe&&(Xe.d(1),Xe=null),Me&1&&U!==(U=ge(de[0].last_month.u)+"")&&Z(K,U),de[4]?Ue?Ue.p(de,Me):(Ue=Lu(de),Ue.c(),Ue.m(n,null)):Ue&&(Ue.d(1),Ue=null),Me&32&&X!==(X="grid grid-cols-"+de[5]+" mb-3")&&r(n,"class",X),Me&2&&He!==(He=ge(de[1].h.p,2)+"")&&Z(ye,He),de[4]?Ze?Ze.p(de,Me):(Ze=Fu(de),Ze.c(),Ze.m(me,$e)):Ze&&(Ze.d(1),Ze=null),Me&2&&N!==(N=ge(de[1].d.p,1)+"")&&Z(I,N),de[4]?We?We.p(de,Me):(We=qu(de),We.c(),We.m(me,se)):We&&(We.d(1),We=null),Me&2&&oe!==(oe=ge(de[1].m.p)+"")&&Z(pe,oe),de[4]?Je?Je.p(de,Me):(Je=Bu(de),Je.c(),Je.m(me,Ce)):Je&&(Je.d(1),Je=null),Me&1&&ct!==(ct=ge(de[0].last_month.p)+"")&&Z(Tl,ct),de[4]?xe?xe.p(de,Me):(xe=Uu(de),xe.c(),xe.m(me,null)):xe&&(xe.d(1),xe=null),Me&32&&ht!==(ht="grid grid-cols-"+de[5])&&r(me,"class",ht)},d(de){de&&C(e),de&&C(l),de&&C(n),Ye&&Ye.d(),Qe&&Qe.d(),Xe&&Xe.d(),Ue&&Ue.d(),de&&C(re),de&&C(ue),de&&C(we),de&&C(me),Ze&&Ze.d(),We&&We.d(),Je&&Je.d(),xe&&xe.d()}}}function Du(t){let e,l,n,i,o,a,u=ge(t[1].h.c,2)+"",c,f,p,_,b,v,d,k=ge(t[1].d.c,1)+"",A,S,T,E,B,P,R,L=ge(t[1].m.c)+"",F,x,j,z,G,V,W,U=ge(t[0].last_month.c)+"",K,H,Y;return{c(){e=m("strong"),e.textContent="Cost",l=h(),n=m("div"),i=m("div"),i.textContent="Hour",o=h(),a=m("div"),c=$(u),f=h(),p=$(t[2]),_=h(),b=m("div"),b.textContent="Day",v=h(),d=m("div"),A=$(k),S=h(),T=$(t[2]),E=h(),B=m("div"),B.textContent="Month",P=h(),R=m("div"),F=$(L),x=h(),j=$(t[2]),z=h(),G=m("div"),G.textContent="Last month",V=h(),W=m("div"),K=$(U),H=h(),Y=$(t[2]),r(a,"class","text-right"),r(d,"class","text-right"),r(R,"class","text-right"),r(W,"class","text-right"),r(n,"class","grid grid-cols-2")},m(X,re){M(X,e,re),M(X,l,re),M(X,n,re),s(n,i),s(n,o),s(n,a),s(a,c),s(a,f),s(a,p),s(n,_),s(n,b),s(n,v),s(n,d),s(d,A),s(d,S),s(d,T),s(n,E),s(n,B),s(n,P),s(n,R),s(R,F),s(R,x),s(R,j),s(n,z),s(n,G),s(n,V),s(n,W),s(W,K),s(W,H),s(W,Y)},p(X,re){re&2&&u!==(u=ge(X[1].h.c,2)+"")&&Z(c,u),re&4&&Z(p,X[2]),re&2&&k!==(k=ge(X[1].d.c,1)+"")&&Z(A,k),re&4&&Z(T,X[2]),re&2&&L!==(L=ge(X[1].m.c)+"")&&Z(F,L),re&4&&Z(j,X[2]),re&1&&U!==(U=ge(X[0].last_month.c)+"")&&Z(K,U),re&4&&Z(Y,X[2])},d(X){X&&C(e),X&&C(l),X&&C(n)}}}function Iu(t){let e,l=ge(t[1].h.c,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.c,2)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Ou(t){let e,l=ge(t[1].d.c,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.c,1)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Ru(t){let e,l=ge(t[1].m.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.c)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Lu(t){let e,l=ge(t[0].last_month.c)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.c)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Fu(t){let e,l=ge(t[1].h.i,2)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].h.i,2)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function qu(t){let e,l=ge(t[1].d.i,1)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].d.i,1)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Bu(t){let e,l=ge(t[1].m.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&2&&l!==(l=ge(a[1].m.i)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function Uu(t){let e,l=ge(t[0].last_month.i)+"",n,i,o;return{c(){e=m("div"),n=$(l),i=h(),o=$(t[2]),r(e,"class","text-right")},m(a,u){M(a,e,u),s(e,n),s(e,i),s(e,o)},p(a,u){u&1&&l!==(l=ge(a[0].last_month.i)+"")&&Z(n,l),u&4&&Z(o,a[2])},d(a){a&&C(e)}}}function ym(t){let e,l,n,i,o,a,u=t[1]&&Eu(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Real time calculation",n=h(),i=m("br"),o=m("br"),a=h(),u&&u.c(),r(e,"class","mx-2 text-sm")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),u&&u.m(e,null)},p(c,[f]){c[1]?u?u.p(c,f):(u=Eu(c),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i:fe,o:fe,d(c){c&&C(e),u&&u.d()}}}function Cm(t,e,l){let{sysinfo:n}=e,{data:i}=e,{currency:o}=e,{hasExport:a}=e,u=!1,c=3;return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo),"data"in f&&l(1,i=f.data),"currency"in f&&l(2,o=f.currency),"hasExport"in f&&l(3,a=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(l(4,u=i&&i.h&&(Math.abs(i.h.c)>.01||Math.abs(i.d.c)>.01||Math.abs(i.m.c)>.01||Math.abs(i.h.i)>.01||Math.abs(i.d.i)>.01||Math.abs(i.m.i)>.01)),l(5,c=u?3:2))},[n,i,o,a,u,c]}class Mm extends Ee{constructor(e){super(),Pe(this,e,Cm,ym,Ae,{sysinfo:0,data:1,currency:2,hasExport:3})}}function $m(t){let e,l,n,i;return n=new dn({props:{config:t[0]}}),{c(){e=m("a"),e.textContent="Provided by ENTSO-E",l=h(),ie(n.$$.fragment),r(e,"href","https://transparency.entsoe.eu/"),r(e,"target","_blank"),r(e,"class","text-xs float-right z-40")},m(o,a){M(o,e,a),M(o,l,a),le(n,o,a),i=!0},p(o,[a]){const u={};a&1&&(u.config=o[0]),n.$set(u)},i(o){i||(D(n.$$.fragment,o),i=!0)},o(o){q(n.$$.fragment,o),i=!1},d(o){o&&C(e),o&&C(l),ne(n,o)}}}function Tm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=n.currency,f=new Date().getUTCHours(),p=0,_=0,b=0,v=[],d=[],k=[];l(4,u=l(3,a=0));let A=new Date;for(fl(A,i.clock_offset-(24+A.getHours()-A.getUTCHours())%24),p=f;p<24&&(_=n[Le(b++)],_!=null);p++)d.push({label:Le(A.getHours())}),k.push(_*100),l(4,u=Math.min(u,_*100)),l(3,a=Math.max(a,_*100)),fl(A,1);for(p=0;p<24&&(_=n[Le(b++)],_!=null);p++)d.push({label:Le(A.getHours())}),k.push(_*100),l(4,u=Math.min(u,_*100)),l(3,a=Math.max(a,_*100)),fl(A,1);if(u>-100&&a<100){switch(c){case"NOK":case"SEK":case"DKK":c="øre";break;case"EUR":c="cent";break;default:c=c+"/100"}for(l(4,u*=100),l(3,a*=100),p=0;p<k.length;p++)k[p]*=100}let S=[];for(p=0;p<k.length;p++){_=k[p];let P=_*.01,R=Math.abs(_)<1e3?2:0;S.push({label:P>=0?P.toFixed(R):"",title:P>=0?P.toFixed(2)+" "+c:"",value:_>=0?Math.abs(_):0,label2:P<0?P.toFixed(R):"",title2:P<0?P.toFixed(2)+" "+c:"",value2:_<0?Math.abs(_):0,color:"#7c3aed"})}let T=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(T/4*-1,u));let P=Math.ceil(Math.abs(u)/T*4),R=u/P;for(p=1;p<P+1;p++){let L=R*p;v.push({value:L,label:(L/100).toFixed(2)})}}l(3,a=Math.max(T/4,a));let E=Math.ceil(a/T*4),B=a/E;for(p=0;p<E+1;p++){let P=B*p;v.push({value:P,label:(P/100).toFixed(2)})}l(0,o={title:"Future energy price ("+c+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:a,ticks:v},x:{ticks:d},points:S})}},[o,n,i,a,u]}class Sm extends Ee{constructor(e){super(),Pe(this,e,Tm,$m,Ae,{json:1,sysinfo:2})}}function Nm(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Am(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,u=l(3,a=0));let b=fl(new Date,-24),v=new Date().getUTCHours();for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),c=v;c<24;c++){let S=n["i"+Le(c)],T=n["e"+Le(c)];S===void 0&&(S=0),T===void 0&&(T=0),p.push({label:Le(b.getHours())}),_.push({label:S.toFixed(1),title:S.toFixed(2)+" kWh",value:S*10,label2:T.toFixed(1),title2:T.toFixed(2)+" kWh",value2:T*10,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,T*10)),l(3,a=Math.max(a,S*10)),fl(b,1)}for(c=0;c<v;c++){let S=n["i"+Le(c)],T=n["e"+Le(c)];S===void 0&&(S=0),T===void 0&&(T=0),p.push({label:Le(b.getHours())}),_.push({label:S.toFixed(1),title:S.toFixed(2)+" kWh",value:S*10,label2:T.toFixed(1),title2:T.toFixed(2)+" kWh",value2:T*10,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,T*10)),l(3,a=Math.max(a,S*10)),fl(b,1)}l(4,u*=-1);let d=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(d/4*-1,u));let S=Math.ceil(Math.abs(u)/d*4),T=u/S;for(c=1;c<S+1;c++){let E=T*c;f.push({value:E,label:(E/10).toFixed(1)})}}l(3,a=Math.max(d/4,a));let k=Math.ceil(a/d*4),A=a/k;for(c=0;c<k+1;c++){let S=A*c;f.push({value:S,label:(S/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:u,max:a,ticks:f},x:{ticks:p},points:_})}},[o,n,i,a,u]}class Pm extends Ee{constructor(e){super(),Pe(this,e,Am,Nm,Ae,{json:1,sysinfo:2})}}function Em(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Dm(t,e,l){let{json:n}=e,{sysinfo:i}=e,o={},a,u;return t.$$set=c=>{"json"in c&&l(1,n=c.json),"sysinfo"in c&&l(2,i=c.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let c=0,f=[],p=[],_=[];l(4,u=l(3,a=0));let b=new Date,v=new Date;for(fl(b,i.clock_offset-(24+b.getHours()-b.getUTCHours())%24),fl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),v.setDate(0),c=b.getDate();c<=v.getDate();c++){let S=n["i"+Le(c)],T=n["e"+Le(c)];S===void 0&&(S=0),T===void 0&&(T=0),p.push({label:Le(c)}),_.push({label:S.toFixed(S<10?1:0),title:S.toFixed(2)+" kWh",value:S,label2:T.toFixed(T<10?1:0),title2:T.toFixed(2)+" kWh",value2:T,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,T)),l(3,a=Math.max(a,S))}for(c=1;c<b.getDate();c++){let S=n["i"+Le(c)],T=n["e"+Le(c)];S===void 0&&(S=0),T===void 0&&(T=0),p.push({label:Le(c)}),_.push({label:S.toFixed(S<10?1:0),title:S.toFixed(2)+" kWh",value:S,label2:T.toFixed(T<10?1:0),title2:T.toFixed(2)+" kWh",value2:T,color:"#7c3aed",color2:"#37829E"}),l(4,u=Math.max(u,T)),l(3,a=Math.max(a,S))}l(4,u*=-1);let d=Math.max(a,Math.abs(u));if(u<0){l(4,u=Math.min(d/4*-1,u));let S=Math.ceil(Math.abs(u)/d*4),T=u/S;for(c=1;c<S+1;c++){let E=T*c;f.push({value:E,label:E.toFixed(0)})}}l(3,a=Math.max(d/4,a));let k=Math.ceil(a/d*4),A=a/k;for(c=0;c<k+1;c++){let S=A*c;f.push({value:S,label:S.toFixed(0)})}l(0,o={title:"Energy use last "+v.getDate()+" days (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:u,max:a,ticks:f},x:{ticks:p},points:_})}},[o,n,i,a,u]}class Im extends Ee{constructor(e){super(),Pe(this,e,Dm,Em,Ae,{json:1,sysinfo:2})}}function Om(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Rm(t,e,l){let{json:n}=e,i={},o=0,a=0;return t.$$set=u=>{"json"in u&&l(1,n=u.json)},t.$$.update=()=>{if(t.$$.dirty&14){let u=0,c=0,f=[],p=[],_=[];n.s&&n.s.forEach((d,k)=>{var A=d.n?d.n:d.a;c=d.v,c==-127&&(c=0),p.push({label:A.slice(-4)}),_.push({label:c.toFixed(1),value:c,color:"#7c3aed"}),l(3,a=Math.min(a,c)),l(2,o=Math.max(o,c))}),l(2,o=Math.ceil(o)),l(3,a=Math.floor(a));let b=o;a<0&&(b+=Math.abs(a));let v=b/4;for(u=0;u<5;u++)c=a+v*u,f.push({value:c,label:c.toFixed(1)});l(0,i={title:"Temperature sensors (°C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:a,max:o,ticks:f},x:{ticks:p},points:_})}},[i,n,o,a]}class Lm extends Ee{constructor(e){super(),Pe(this,e,Rm,Om,Ae,{json:1})}}function Fm(t){let e,l;return e=new dn({props:{config:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,[i]){const o={};i&1&&(o.config=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}let qm=0;function Bm(t,e,l){let n={},i=0,o;return Gc.subscribe(a=>{l(2,o=a)}),zc(),t.$$.update=()=>{if(t.$$.dirty&6){let a=0,u=[],c=[],f=[];if(u.push({value:0,label:0}),o&&o.p)for(a=0;a<o.p.length;a++){let p=o.p[a];f.push({label:p.v.toFixed(2),value:p.v,color:"#7c3aed"}),c.push({label:p.d>0?Le(p.d)+"."+oo[new Date().getMonth()]:"-"}),l(1,i=Math.max(i,p.v))}if(o&&o.t){for(a=0;a<o.t.length;a++){let p=o.t[a];if(p>=i)break;u.push({value:p,label:p})}u.push({label:o.m.toFixed(1),align:"right",color:"green",value:o.m})}o&&o.c&&(u.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:qm,max:i,ticks:u},x:{ticks:c},points:f})}},[n,i,o]}class Um extends Ee{constructor(e){super(),Pe(this,e,Bm,Fm,Ae,{})}}function ju(t){let e,l,n,i,o,a,u=(t[0].mt?Ss(t[0].mt):"-")+"",c,f,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",b,v,d;return i=new Xc({props:{val:t[0].i?t[0].i:0,max:t[0].im?t[0].im:15e3,unit:"W",label:"Import",sub:t[0].p,subunit:t[0].pc,colorFn:Fc}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),c=$(u),f=h(),p=m("div"),b=$(_),v=$(" kWh"),r(n,"class","col-span-2"),r(p,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(k,A){M(k,e,A),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(a,c),s(l,f),s(l,p),s(p,b),s(p,v),d=!0},p(k,A){const S={};A&1&&(S.val=k[0].i?k[0].i:0),A&1&&(S.max=k[0].im?k[0].im:15e3),A&1&&(S.sub=k[0].p),A&1&&(S.subunit=k[0].pc),i.$set(S),(!d||A&1)&&u!==(u=(k[0].mt?Ss(k[0].mt):"-")+"")&&Z(c,u),(!d||A&1)&&_!==(_=(k[0].ic?k[0].ic.toFixed(1):"-")+"")&&Z(b,_)},i(k){d||(D(i.$$.fragment,k),d=!0)},o(k){q(i.$$.fragment,k),d=!1},d(k){k&&C(e),ne(i)}}}function Hu(t){let e,l,n,i,o,a,u,c,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,b;return i=new Xc({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:C1}}),{c(){e=m("div"),l=m("div"),n=m("div"),ie(i.$$.fragment),o=h(),a=m("div"),u=h(),c=m("div"),p=$(f),_=$(" kWh"),r(n,"class","col-span-2"),r(c,"class","text-right"),r(l,"class","grid grid-cols-2"),r(e,"class","cnt")},m(v,d){M(v,e,d),s(e,l),s(l,n),le(i,n,null),s(l,o),s(l,a),s(l,u),s(l,c),s(c,p),s(c,_),b=!0},p(v,d){const k={};d&1&&(k.val=v[0].e?v[0].e:0),d&1&&(k.max=v[0].om?v[0].om*1e3:1e4),i.$set(k),(!b||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&Z(p,f)},i(v){b||(D(i.$$.fragment,v),b=!0)},o(v){q(i.$$.fragment,v),b=!1},d(v){v&&C(e),ne(i)}}}function Wu(t){let e,l,n;return l=new pm({props:{u1:t[0].u1,u2:t[0].u2,u3:t[0].u3,ds:t[0].ds}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.ds=i[0].ds),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function zu(t){let e,l,n;return l=new vm({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"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.u1=i[0].u1),o&1&&(a.u2=i[0].u2),o&1&&(a.u3=i[0].u3),o&1&&(a.i1=i[0].i1),o&1&&(a.i2=i[0].i2),o&1&&(a.i3=i[0].i3),o&1&&(a.max=i[0].mf?i[0].mf:32),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Gu(t){let e,l,n;return l=new gm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&1&&(a.importInstant=i[0].ri),o&1&&(a.exportInstant=i[0].re),o&1&&(a.importTotal=i[0].ric),o&1&&(a.exportTotal=i[0].rec),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Vu(t){let e,l,n;return l=new Mm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&2&&(a.sysinfo=i[1]),o&1&&(a.data=i[0].ea),o&1&&(a.currency=i[0].pc),o&1&&(a.hasExport=i[0].om>0||i[0].e>0),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Ku(t){let e,l,n;return l=new Um({}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt h-64")},m(i,o){M(i,e,o),le(l,e,null),n=!0},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Yu(t){let e,l,n;return l=new Sm({props:{json:t[2],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&4&&(a.json=i[2]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Qu(t){let e,l,n;return l=new Pm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&8&&(a.json=i[3]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Xu(t){let e,l,n;return l=new Im({props:{json:t[4],sysinfo:t[1]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&16&&(a.json=i[4]),o&2&&(a.sysinfo=i[1]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Zu(t){let e,l,n;return l=new Lm({props:{json:t[5]}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","cnt gwf")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o&32&&(a.json=i[5]),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function jm(t){let e,l=Ve(t[1].ui.i,t[0].i),n,i=Ve(t[1].ui.e,t[0].om||t[0].e>0),o,a=Ve(t[1].ui.v,t[0].u1>100||t[0].u2>100||t[0].u3>100),u,c=Ve(t[1].ui.a,t[0].i1>.01||t[0].i2>.01||t[0].i3>.01),f,p=Ve(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),_,b=Ve(t[1].ui.c,t[0].ea),v,d=Ve(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr=="10Y1001A1001A48H")),k,A=Ve(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),S,T=Ve(t[1].ui.d,t[3]),E,B=Ve(t[1].ui.m,t[4]),P,R=Ve(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),L,F=l&&ju(t),x=i&&Hu(t),j=a&&Wu(t),z=c&&zu(t),G=p&&Gu(t),V=b&&Vu(t),W=d&&Ku(),U=A&&Yu(t),K=T&&Qu(t),H=B&&Xu(t),Y=R&&Zu(t);return{c(){e=m("div"),F&&F.c(),n=h(),x&&x.c(),o=h(),j&&j.c(),u=h(),z&&z.c(),f=h(),G&&G.c(),_=h(),V&&V.c(),v=h(),W&&W.c(),k=h(),U&&U.c(),S=h(),K&&K.c(),E=h(),H&&H.c(),P=h(),Y&&Y.c(),r(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(X,re){M(X,e,re),F&&F.m(e,null),s(e,n),x&&x.m(e,null),s(e,o),j&&j.m(e,null),s(e,u),z&&z.m(e,null),s(e,f),G&&G.m(e,null),s(e,_),V&&V.m(e,null),s(e,v),W&&W.m(e,null),s(e,k),U&&U.m(e,null),s(e,S),K&&K.m(e,null),s(e,E),H&&H.m(e,null),s(e,P),Y&&Y.m(e,null),L=!0},p(X,[re]){re&3&&(l=Ve(X[1].ui.i,X[0].i)),l?F?(F.p(X,re),re&3&&D(F,1)):(F=ju(X),F.c(),D(F,1),F.m(e,n)):F&&(De(),q(F,1,1,()=>{F=null}),Ie()),re&3&&(i=Ve(X[1].ui.e,X[0].om||X[0].e>0)),i?x?(x.p(X,re),re&3&&D(x,1)):(x=Hu(X),x.c(),D(x,1),x.m(e,o)):x&&(De(),q(x,1,1,()=>{x=null}),Ie()),re&3&&(a=Ve(X[1].ui.v,X[0].u1>100||X[0].u2>100||X[0].u3>100)),a?j?(j.p(X,re),re&3&&D(j,1)):(j=Wu(X),j.c(),D(j,1),j.m(e,u)):j&&(De(),q(j,1,1,()=>{j=null}),Ie()),re&3&&(c=Ve(X[1].ui.a,X[0].i1>.01||X[0].i2>.01||X[0].i3>.01)),c?z?(z.p(X,re),re&3&&D(z,1)):(z=zu(X),z.c(),D(z,1),z.m(e,f)):z&&(De(),q(z,1,1,()=>{z=null}),Ie()),re&3&&(p=Ve(X[1].ui.r,X[0].ri>0||X[0].re>0||X[0].ric>0||X[0].rec>0)),p?G?(G.p(X,re),re&3&&D(G,1)):(G=Gu(X),G.c(),D(G,1),G.m(e,_)):G&&(De(),q(G,1,1,()=>{G=null}),Ie()),re&3&&(b=Ve(X[1].ui.c,X[0].ea)),b?V?(V.p(X,re),re&3&&D(V,1)):(V=Vu(X),V.c(),D(V,1),V.m(e,v)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),re&3&&(d=Ve(X[1].ui.t,X[0].pr&&(X[0].pr.startsWith("10YNO")||X[0].pr=="10Y1001A1001A48H"))),d?W?re&3&&D(W,1):(W=Ku(),W.c(),D(W,1),W.m(e,k)):W&&(De(),q(W,1,1,()=>{W=null}),Ie()),re&3&&(A=Ve(X[1].ui.p,X[0].pe&&!Number.isNaN(X[0].p))),A?U?(U.p(X,re),re&3&&D(U,1)):(U=Yu(X),U.c(),D(U,1),U.m(e,S)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),re&10&&(T=Ve(X[1].ui.d,X[3])),T?K?(K.p(X,re),re&10&&D(K,1)):(K=Qu(X),K.c(),D(K,1),K.m(e,E)):K&&(De(),q(K,1,1,()=>{K=null}),Ie()),re&18&&(B=Ve(X[1].ui.m,X[4])),B?H?(H.p(X,re),re&18&&D(H,1)):(H=Xu(X),H.c(),D(H,1),H.m(e,P)):H&&(De(),q(H,1,1,()=>{H=null}),Ie()),re&35&&(R=Ve(X[1].ui.s,X[0].t&&X[0].t!=-127&&X[5].c>1)),R?Y?(Y.p(X,re),re&35&&D(Y,1)):(Y=Zu(X),Y.c(),D(Y,1),Y.m(e,null)):Y&&(De(),q(Y,1,1,()=>{Y=null}),Ie())},i(X){L||(D(F),D(x),D(j),D(z),D(G),D(V),D(W),D(U),D(K),D(H),D(Y),L=!0)},o(X){q(F),q(x),q(j),q(z),q(G),q(V),q(W),q(U),q(K),q(H),q(Y),L=!1},d(X){X&&C(e),F&&F.d(),x&&x.d(),j&&j.d(),z&&z.d(),G&&G.d(),V&&V.d(),W&&W.d(),U&&U.d(),K&&K.d(),H&&H.d(),Y&&Y.d()}}}function Hm(t,e,l){let{data:n={}}=e,{sysinfo:i={}}=e,o={},a={},u={},c={};return To.subscribe(f=>{l(2,o=f)}),Uc.subscribe(f=>{l(3,a=f)}),jc.subscribe(f=>{l(4,u=f)}),Wc.subscribe(f=>{l(5,c=f)}),t.$$set=f=>{"data"in f&&l(0,n=f.data),"sysinfo"in f&&l(1,i=f.sysinfo)},[n,i,o,a,u,c]}class Wm extends Ee{constructor(e){super(),Pe(this,e,Hm,jm,Ae,{data:0,sysinfo:1})}}let po={};const $i=at(po);async function zm(){po=await(await fetch("/configuration.json")).json(),$i.set(po)}function Ju(t,e,l){const n=t.slice();return n[2]=e[l],n[4]=l,n}function Gm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Vm(t){let e;return{c(){e=m("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function xu(t){let e;return{c(){e=m("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function ef(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){M(i,e,o),M(i,l,o),M(i,n,o)},d(i){i&&C(e),i&&C(l),i&&C(n)}}}function tf(t){let e;return{c(){e=m("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function lf(t){let e,l,n;return{c(){e=m("option"),l=$("GPIO"),n=$(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,l),s(e,n)},d(i){i&&C(e)}}}function nf(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))&&lf(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),M(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=lf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},d(n){l&&l.d(n),n&&C(e)}}}function Km(t){let e,l,n,i,o;function a(d,k){return d[0]=="esp32c3"?Vm:Gm}let u=a(t),c=u(t),f=t[0]=="esp8266"&&xu(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&ef(),_=t[0]=="esp32s2"&&tf(),b={length:t[1]+1},v=[];for(let d=0;d<b.length;d+=1)v[d]=nf(Ju(t,b,d));return{c(){c.c(),e=h(),f&&f.c(),l=h(),p&&p.c(),n=h(),_&&_.c(),i=h();for(let d=0;d<v.length;d+=1)v[d].c();o=Ge()},m(d,k){c.m(d,k),M(d,e,k),f&&f.m(d,k),M(d,l,k),p&&p.m(d,k),M(d,n,k),_&&_.m(d,k),M(d,i,k);for(let A=0;A<v.length;A+=1)v[A]&&v[A].m(d,k);M(d,o,k)},p(d,[k]){if(u!==(u=a(d))&&(c.d(1),c=u(d),c&&(c.c(),c.m(e.parentNode,e))),d[0]=="esp8266"?f||(f=xu(),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),d[0]=="esp32"||d[0]=="esp32solo"?p||(p=ef(),p.c(),p.m(n.parentNode,n)):p&&(p.d(1),p=null),d[0]=="esp32s2"?_||(_=tf(),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),k&3){b={length:d[1]+1};let A;for(A=0;A<b.length;A+=1){const S=Ju(d,b,A);v[A]?v[A].p(S,k):(v[A]=nf(S),v[A].c(),v[A].m(o.parentNode,o))}for(;A<v.length;A+=1)v[A].d(1);v.length=b.length}},i:fe,o:fe,d(d){c.d(d),d&&C(e),f&&f.d(d),d&&C(l),p&&p.d(d),d&&C(n),_&&_.d(d),d&&C(i),cl(v,d),d&&C(o)}}}function Ym(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 Zc extends Ee{constructor(e){super(),Pe(this,e,Ym,Km,Ae,{chip:0})}}function sf(t){let e,l,n=t[1]&&of(t);return{c(){e=m("div"),l=m("div"),n&&n.c(),r(l,"class","fixed inset-0 bg-gray-500 bg-opacity-50 flex items-center justify-center"),r(e,"class","z-50"),r(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,l),n&&n.m(l,null)},p(i,o){i[1]?n?n.p(i,o):(n=of(i),n.c(),n.m(l,null)):n&&(n.d(1),n=null)},d(i){i&&C(e),n&&n.d()}}}function of(t){let e,l;return{c(){e=m("div"),l=$(t[1]),r(e,"class","bg-white m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 w-96")},m(n,i){M(n,e,i),s(e,l)},p(n,i){i&2&&Z(l,n[1])},d(n){n&&C(e)}}}function Qm(t){let e,l=t[0]&&sf(t);return{c(){l&&l.c(),e=Ge()},m(n,i){l&&l.m(n,i),M(n,e,i)},p(n,[i]){n[0]?l?l.p(n,i):(l=sf(n),l.c(),l.m(e.parentNode,e)):l&&(l.d(1),l=null)},i:fe,o:fe,d(n){l&&l.d(n),n&&C(e)}}}function Xm(t,e,l){let{active:n}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&l(0,n=o.active),"message"in o&&l(1,i=o.message)},[n,i]}class Dt extends Ee{constructor(e){super(),Pe(this,e,Xm,Qm,Ae,{active:0,message:1})}}function rf(t,e,l){const n=t.slice();return n[1]=e[l],n}function af(t){let e,l,n=t[1]+"",i;return{c(){e=m("option"),l=$("Europe/"),i=$(n),e.__value="Europe/"+t[1],e.value=e.__value},m(o,a){M(o,e,a),s(e,l),s(e,i)},p:fe,d(o){o&&C(e)}}}function Zm(t){let e,l,n,i=t[0],o=[];for(let a=0;a<i.length;a+=1)o[a]=af(rf(t,i,a));return{c(){e=m("option"),e.textContent="GMT",l=h();for(let a=0;a<o.length;a+=1)o[a].c();n=Ge(),e.__value="GMT",e.value=e.__value},m(a,u){M(a,e,u),M(a,l,u);for(let c=0;c<o.length;c+=1)o[c]&&o[c].m(a,u);M(a,n,u)},p(a,[u]){if(u&1){i=a[0];let c;for(c=0;c<i.length;c+=1){const f=rf(a,i,c);o[c]?o[c].p(f,u):(o[c]=af(f),o[c].c(),o[c].m(n.parentNode,n))}for(;c<o.length;c+=1)o[c].d(1);o.length=i.length}},i:fe,o:fe,d(a){a&&C(e),a&&C(l),cl(o,a),a&&C(n)}}}function Jm(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 xm extends Ee{constructor(e){super(),Pe(this,e,Jm,Zm,Ae,{})}}function ep(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d;return{c(){e=m("optgroup"),l=m("option"),l.textContent="/24",n=h(),i=m("optgroup"),o=m("option"),o.textContent="/25",a=m("option"),a.textContent="/26",u=m("option"),u.textContent="/27",c=m("option"),c.textContent="/28",f=m("option"),f.textContent="/29",p=h(),_=m("optgroup"),b=m("option"),b.textContent="/23",v=m("option"),v.textContent="/22",d=m("option"),d.textContent="/16",l.__value="255.255.255.0",l.value=l.__value,r(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,a.__value="255.255.255.192",a.value=a.__value,u.__value="255.255.255.224",u.value=u.__value,c.__value="255.255.255.240",c.value=c.__value,f.__value="255.255.255.248",f.value=f.__value,r(i,"label","Smaller subnets"),b.__value="255.255.254.0",b.value=b.__value,v.__value="255.255.252.0",v.value=v.__value,d.__value="255.255.0.0",d.value=d.__value,r(_,"label","Larger subnets")},m(k,A){M(k,e,A),s(e,l),M(k,n,A),M(k,i,A),s(i,o),s(i,a),s(i,u),s(i,c),s(i,f),M(k,p,A),M(k,_,A),s(_,b),s(_,v),s(_,d)},p:fe,i:fe,o:fe,d(k){k&&C(e),k&&C(n),k&&C(i),k&&C(p),k&&C(_)}}}class Jc extends Ee{constructor(e){super(),Pe(this,e,null,ep,Ae,{})}}function tp(t){let e,l;return{c(){e=Fe("svg"),l=Fe("path"),r(l,"stroke-linecap","round"),r(l,"stroke-linejoin","round"),r(l,"d","M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"),r(e,"xmlns","http://www.w3.org/2000/svg"),r(e,"fill","none"),r(e,"viewBox","0 0 24 24"),r(e,"stroke-width","1.5"),r(e,"stroke","currentColor"),r(e,"class","w-4 h-4")},m(n,i){M(n,e,i),s(e,l)},p:fe,i:fe,o:fe,d(n){n&&C(e)}}}class Po extends Ee{constructor(e){super(),Pe(this,e,null,tp,Ae,{})}}var lp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function np(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xc={exports:{}};(function(t,e){(function(l,n){t.exports=n()})(lp,function(){var l=function(){},n=Object.prototype.hasOwnProperty,i=Array.prototype.slice;function o(y,g){var w;return typeof Object.create=="function"?w=Object.create(y):(l.prototype=y,w=new l,l.prototype=null),g&&u(!0,w,g),w}function a(y,g,w,N){var I=this;return typeof y!="string"&&(N=w,w=g,g=y,y=null),typeof g!="function"&&(N=w,w=g,g=function(){return I.apply(this,arguments)}),u(!1,g,I,N),g.prototype=o(I.prototype,w),g.prototype.constructor=g,g.class_=y||I.class_,g.super_=I,g}function u(y,g,w){w=i.call(arguments,2);for(var N,I,Q=0,J=w.length;Q<J;Q++){I=w[Q];for(N in I)(!y||n.call(I,N))&&(g[N]=I[N])}}var c=a;function f(){}f.class_="Nevis",f.super_=Object,f.extend=c;var p=f,_=p,b=_.extend(function(y,g,w){this.qrious=y,this.element=g,this.element.qrious=y,this.enabled=!!w},{draw:function(y){},getElement:function(){return this.enabled||(this.enabled=!0,this.render()),this.element},getModuleSize:function(y){var g=this.qrious,w=g.padding||0,N=Math.floor((g.size-w*2)/y.width);return Math.max(1,N)},render:function(y){this.enabled&&(this.resize(),this.reset(),this.draw(y))},reset:function(){},resize:function(){}}),v=b,d=v.extend({draw:function(y){var g,w,N=this.qrious,I=this.getModuleSize(y),Q=parseInt((this.element.width-y.width*I)/2),J=this.element.getContext("2d");for(J.fillStyle=N.foreground,J.globalAlpha=N.foregroundAlpha,g=0;g<y.width;g++)for(w=0;w<y.width;w++)y.buffer[w*y.width+g]&&J.fillRect(I*g+Q,I*w+Q,I,I)},reset:function(){var y=this.qrious,g=this.element.getContext("2d"),w=y.size;g.lineWidth=1,g.clearRect(0,0,w,w),g.fillStyle=y.background,g.globalAlpha=y.backgroundAlpha,g.fillRect(0,0,w,w)},resize:function(){var y=this.element;y.width=y.height=this.qrious.size}}),k=d,A=_.extend(null,{BLOCK:[0,11,15,19,23,27,31,16,18,20,22,24,26,28,20,22,24,24,26,28,28,22,24,24,26,26,28,28,24,24,26,26,26,28,28,24,26,26,26,28,28]}),S=A,T=_.extend(null,{BLOCKS:[1,0,19,7,1,0,16,10,1,0,13,13,1,0,9,17,1,0,34,10,1,0,28,16,1,0,22,22,1,0,16,28,1,0,55,15,1,0,44,26,2,0,17,18,2,0,13,22,1,0,80,20,2,0,32,18,2,0,24,26,4,0,9,16,1,0,108,26,2,0,43,24,2,2,15,18,2,2,11,22,2,0,68,18,4,0,27,16,4,0,19,24,4,0,15,28,2,0,78,20,4,0,31,18,2,4,14,18,4,1,13,26,2,0,97,24,2,2,38,22,4,2,18,22,4,2,14,26,2,0,116,30,3,2,36,22,4,4,16,20,4,4,12,24,2,2,68,18,4,1,43,26,6,2,19,24,6,2,15,28,4,0,81,20,1,4,50,30,4,4,22,28,3,8,12,24,2,2,92,24,6,2,36,22,4,6,20,26,7,4,14,28,4,0,107,26,8,1,37,22,8,4,20,24,12,4,11,22,3,1,115,30,4,5,40,24,11,5,16,20,11,5,12,24,5,1,87,22,5,5,41,24,5,7,24,30,11,7,12,24,5,1,98,24,7,3,45,28,15,2,19,24,3,13,15,30,1,5,107,28,10,1,46,28,1,15,22,28,2,17,14,28,5,1,120,30,9,4,43,26,17,1,22,28,2,19,14,28,3,4,113,28,3,11,44,26,17,4,21,26,9,16,13,26,3,5,107,28,3,13,41,26,15,5,24,30,15,10,15,28,4,4,116,28,17,0,42,26,17,6,22,28,19,6,16,30,2,7,111,28,17,0,46,28,7,16,24,30,34,0,13,24,4,5,121,30,4,14,47,28,11,14,24,30,16,14,15,30,6,4,117,30,6,14,45,28,11,16,24,30,30,2,16,30,8,4,106,26,8,13,47,28,7,22,24,30,22,13,15,30,10,2,114,28,19,4,46,28,28,6,22,28,33,4,16,30,8,4,122,30,22,3,45,28,8,26,23,30,12,28,15,30,3,10,117,30,3,23,45,28,4,31,24,30,11,31,15,30,7,7,116,30,21,7,45,28,1,37,23,30,19,26,15,30,5,10,115,30,19,10,47,28,15,25,24,30,23,25,15,30,13,3,115,30,2,29,46,28,42,1,24,30,23,28,15,30,17,0,115,30,10,23,46,28,10,35,24,30,19,35,15,30,17,1,115,30,14,21,46,28,29,19,24,30,11,46,15,30,13,6,115,30,14,23,46,28,44,7,24,30,59,1,16,30,12,7,121,30,12,26,47,28,39,14,24,30,22,41,15,30,6,14,121,30,6,34,47,28,46,10,24,30,2,64,15,30,17,4,122,30,29,14,46,28,49,10,24,30,24,46,15,30,4,18,122,30,13,32,46,28,48,14,24,30,42,32,15,30,20,4,117,30,40,7,47,28,43,22,24,30,10,67,15,30,19,6,118,30,18,31,47,28,34,34,24,30,20,61,15,30],FINAL_FORMAT:[30660,29427,32170,30877,26159,25368,27713,26998,21522,20773,24188,23371,17913,16590,20375,19104,13663,12392,16177,14854,9396,8579,11994,11245,5769,5054,7399,6608,1890,597,3340,2107],LEVELS:{L:1,M:2,Q:3,H:4}}),E=T,B=_.extend(null,{EXPONENT:[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],LOG:[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175]}),P=B,R=_.extend(null,{BLOCK:[3220,1468,2713,1235,3062,1890,2119,1549,2344,2936,1117,2583,1330,2470,1667,2249,2028,3780,481,4011,142,3098,831,3445,592,2517,1776,2234,1951,2827,1070,2660,1345,3177]}),L=R,F=_.extend(function(y){var g,w,N,I,Q,J=y.value.length;for(this._badness=[],this._level=E.LEVELS[y.level],this._polynomial=[],this._value=y.value,this._version=0,this._stringBuffer=[];this._version<40&&(this._version++,N=(this._level-1)*4+(this._version-1)*16,I=E.BLOCKS[N++],Q=E.BLOCKS[N++],g=E.BLOCKS[N++],w=E.BLOCKS[N],N=g*(I+Q)+Q-3+(this._version<=9),!(J<=N)););this._dataBlock=g,this._eccBlock=w,this._neccBlock1=I,this._neccBlock2=Q;var se=this.width=17+4*this._version;this.buffer=F._createArray(se*se),this._ecc=F._createArray(g+(g+w)*(I+Q)+Q),this._mask=F._createArray((se*(se+1)+1)/2),this._insertFinders(),this._insertAlignments(),this.buffer[8+se*(se-8)]=1,this._insertTimingGap(),this._reverseMask(),this._insertTimingRowAndColumn(),this._insertVersion(),this._syncMask(),this._convertBitStream(J),this._calculatePolynomial(),this._appendEccToData(),this._interleaveBlocks(),this._pack(),this._finish()},{_addAlignment:function(y,g){var w,N=this.buffer,I=this.width;for(N[y+I*g]=1,w=-2;w<2;w++)N[y+w+I*(g-2)]=1,N[y-2+I*(g+w+1)]=1,N[y+2+I*(g+w)]=1,N[y+w+1+I*(g+2)]=1;for(w=0;w<2;w++)this._setMask(y-1,g+w),this._setMask(y+1,g-w),this._setMask(y-w,g-1),this._setMask(y+w,g+1)},_appendData:function(y,g,w,N){var I,Q,J,se=this._polynomial,ce=this._stringBuffer;for(Q=0;Q<N;Q++)ce[w+Q]=0;for(Q=0;Q<g;Q++){if(I=P.LOG[ce[y+Q]^ce[w]],I!==255)for(J=1;J<N;J++)ce[w+J-1]=ce[w+J]^P.EXPONENT[F._modN(I+se[N-J])];else for(J=w;J<w+N;J++)ce[J]=ce[J+1];ce[w+N-1]=I===255?0:P.EXPONENT[F._modN(I+se[0])]}},_appendEccToData:function(){var y,g=0,w=this._dataBlock,N=this._calculateMaxLength(),I=this._eccBlock;for(y=0;y<this._neccBlock1;y++)this._appendData(g,w,N,I),g+=w,N+=I;for(y=0;y<this._neccBlock2;y++)this._appendData(g,w+1,N,I),g+=w+1,N+=I},_applyMask:function(y){var g,w,N,I,Q=this.buffer,J=this.width;switch(y){case 0:for(I=0;I<J;I++)for(N=0;N<J;N++)!(N+I&1)&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 1:for(I=0;I<J;I++)for(N=0;N<J;N++)!(I&1)&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 2:for(I=0;I<J;I++)for(g=0,N=0;N<J;N++,g++)g===3&&(g=0),!g&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 3:for(w=0,I=0;I<J;I++,w++)for(w===3&&(w=0),g=w,N=0;N<J;N++,g++)g===3&&(g=0),!g&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 4:for(I=0;I<J;I++)for(g=0,w=I>>1&1,N=0;N<J;N++,g++)g===3&&(g=0,w=!w),!w&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 5:for(w=0,I=0;I<J;I++,w++)for(w===3&&(w=0),g=0,N=0;N<J;N++,g++)g===3&&(g=0),!((N&I&1)+!(!g|!w))&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 6:for(w=0,I=0;I<J;I++,w++)for(w===3&&(w=0),g=0,N=0;N<J;N++,g++)g===3&&(g=0),!((N&I&1)+(g&&g===w)&1)&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break;case 7:for(w=0,I=0;I<J;I++,w++)for(w===3&&(w=0),g=0,N=0;N<J;N++,g++)g===3&&(g=0),!((g&&g===w)+(N+I&1)&1)&&!this._isMasked(N,I)&&(Q[N+I*J]^=1);break}},_calculateMaxLength:function(){return this._dataBlock*(this._neccBlock1+this._neccBlock2)+this._neccBlock2},_calculatePolynomial:function(){var y,g,w=this._eccBlock,N=this._polynomial;for(N[0]=1,y=0;y<w;y++){for(N[y+1]=1,g=y;g>0;g--)N[g]=N[g]?N[g-1]^P.EXPONENT[F._modN(P.LOG[N[g]]+y)]:N[g-1];N[0]=P.EXPONENT[F._modN(P.LOG[N[0]]+y)]}for(y=0;y<=w;y++)N[y]=P.LOG[N[y]]},_checkBadness:function(){var y,g,w,N,I,Q=0,J=this._badness,se=this.buffer,ce=this.width;for(I=0;I<ce-1;I++)for(N=0;N<ce-1;N++)(se[N+ce*I]&&se[N+1+ce*I]&&se[N+ce*(I+1)]&&se[N+1+ce*(I+1)]||!(se[N+ce*I]||se[N+1+ce*I]||se[N+ce*(I+1)]||se[N+1+ce*(I+1)]))&&(Q+=F.N2);var ve=0;for(I=0;I<ce;I++){for(w=0,J[0]=0,y=0,N=0;N<ce;N++)g=se[N+ce*I],y===g?J[w]++:J[++w]=1,y=g,ve+=y?1:-1;Q+=this._getBadness(w)}ve<0&&(ve=-ve);var Te=0,oe=ve;for(oe+=oe<<2,oe<<=1;oe>ce*ce;)oe-=ce*ce,Te++;for(Q+=Te*F.N4,N=0;N<ce;N++){for(w=0,J[0]=0,y=0,I=0;I<ce;I++)g=se[N+ce*I],y===g?J[w]++:J[++w]=1,y=g;Q+=this._getBadness(w)}return Q},_convertBitStream:function(y){var g,w,N=this._ecc,I=this._version;for(w=0;w<y;w++)N[w]=this._value.charCodeAt(w);var Q=this._stringBuffer=N.slice(),J=this._calculateMaxLength();y>=J-2&&(y=J-2,I>9&&y--);var se=y;if(I>9){for(Q[se+2]=0,Q[se+3]=0;se--;)g=Q[se],Q[se+3]|=255&g<<4,Q[se+2]=g>>4;Q[2]|=255&y<<4,Q[1]=y>>4,Q[0]=64|y>>12}else{for(Q[se+1]=0,Q[se+2]=0;se--;)g=Q[se],Q[se+2]|=255&g<<4,Q[se+1]=g>>4;Q[1]|=255&y<<4,Q[0]=64|y>>4}for(se=y+3-(I<10);se<J;)Q[se++]=236,Q[se++]=17},_getBadness:function(y){var g,w=0,N=this._badness;for(g=0;g<=y;g++)N[g]>=5&&(w+=F.N1+N[g]-5);for(g=3;g<y-1;g+=2)N[g-2]===N[g+2]&&N[g+2]===N[g-1]&&N[g-1]===N[g+1]&&N[g-1]*3===N[g]&&(N[g-3]===0||g+3>y||N[g-3]*3>=N[g]*4||N[g+3]*3>=N[g]*4)&&(w+=F.N3);return w},_finish:function(){this._stringBuffer=this.buffer.slice();var y,g,w=0,N=3e4;for(g=0;g<8&&(this._applyMask(g),y=this._checkBadness(),y<N&&(N=y,w=g),w!==7);g++)this.buffer=this._stringBuffer.slice();w!==g&&this._applyMask(w),N=E.FINAL_FORMAT[w+(this._level-1<<3)];var I=this.buffer,Q=this.width;for(g=0;g<8;g++,N>>=1)N&1&&(I[Q-1-g+Q*8]=1,g<6?I[8+Q*g]=1:I[8+Q*(g+1)]=1);for(g=0;g<7;g++,N>>=1)N&1&&(I[8+Q*(Q-7+g)]=1,g?I[6-g+Q*8]=1:I[7+Q*8]=1)},_interleaveBlocks:function(){var y,g,w=this._dataBlock,N=this._ecc,I=this._eccBlock,Q=0,J=this._calculateMaxLength(),se=this._neccBlock1,ce=this._neccBlock2,ve=this._stringBuffer;for(y=0;y<w;y++){for(g=0;g<se;g++)N[Q++]=ve[y+g*w];for(g=0;g<ce;g++)N[Q++]=ve[se*w+y+g*(w+1)]}for(g=0;g<ce;g++)N[Q++]=ve[se*w+y+g*(w+1)];for(y=0;y<I;y++)for(g=0;g<se+ce;g++)N[Q++]=ve[J+y+g*I];this._stringBuffer=N},_insertAlignments:function(){var y,g,w,N=this._version,I=this.width;if(N>1)for(y=S.BLOCK[N],w=I-7;;){for(g=I-7;g>y-3&&(this._addAlignment(g,w),!(g<y));)g-=y;if(w<=y+9)break;w-=y,this._addAlignment(6,w),this._addAlignment(w,6)}},_insertFinders:function(){var y,g,w,N,I=this.buffer,Q=this.width;for(y=0;y<3;y++){for(g=0,N=0,y===1&&(g=Q-7),y===2&&(N=Q-7),I[N+3+Q*(g+3)]=1,w=0;w<6;w++)I[N+w+Q*g]=1,I[N+Q*(g+w+1)]=1,I[N+6+Q*(g+w)]=1,I[N+w+1+Q*(g+6)]=1;for(w=1;w<5;w++)this._setMask(N+w,g+1),this._setMask(N+1,g+w+1),this._setMask(N+5,g+w),this._setMask(N+w+1,g+5);for(w=2;w<4;w++)I[N+w+Q*(g+2)]=1,I[N+2+Q*(g+w+1)]=1,I[N+4+Q*(g+w)]=1,I[N+w+1+Q*(g+4)]=1}},_insertTimingGap:function(){var y,g,w=this.width;for(g=0;g<7;g++)this._setMask(7,g),this._setMask(w-8,g),this._setMask(7,g+w-7);for(y=0;y<8;y++)this._setMask(y,7),this._setMask(y+w-8,7),this._setMask(y,w-8)},_insertTimingRowAndColumn:function(){var y,g=this.buffer,w=this.width;for(y=0;y<w-14;y++)y&1?(this._setMask(8+y,6),this._setMask(6,8+y)):(g[8+y+w*6]=1,g[6+w*(8+y)]=1)},_insertVersion:function(){var y,g,w,N,I=this.buffer,Q=this._version,J=this.width;if(Q>6)for(y=L.BLOCK[Q-7],g=17,w=0;w<6;w++)for(N=0;N<3;N++,g--)1&(g>11?Q>>g-12:y>>g)?(I[5-w+J*(2-N+J-11)]=1,I[2-N+J-11+J*(5-w)]=1):(this._setMask(5-w,2-N+J-11),this._setMask(2-N+J-11,5-w))},_isMasked:function(y,g){var w=F._getMaskBit(y,g);return this._mask[w]===1},_pack:function(){var y,g,w,N=1,I=1,Q=this.width,J=Q-1,se=Q-1,ce=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(g=0;g<ce;g++)for(y=this._stringBuffer[g],w=0;w<8;w++,y<<=1){128&y&&(this.buffer[J+Q*se]=1);do I?J--:(J++,N?se!==0?se--:(J-=2,N=!N,J===6&&(J--,se=9)):se!==Q-1?se++:(J-=2,N=!N,J===6&&(J--,se-=8))),I=!I;while(this._isMasked(J,se))}},_reverseMask:function(){var y,g,w=this.width;for(y=0;y<9;y++)this._setMask(y,8);for(y=0;y<8;y++)this._setMask(y+w-8,8),this._setMask(8,y);for(g=0;g<7;g++)this._setMask(8,g+w-7)},_setMask:function(y,g){var w=F._getMaskBit(y,g);this._mask[w]=1},_syncMask:function(){var y,g,w=this.width;for(g=0;g<w;g++)for(y=0;y<=g;y++)this.buffer[y+w*g]&&this._setMask(y,g)}},{_createArray:function(y){var g,w=[];for(g=0;g<y;g++)w[g]=0;return w},_getMaskBit:function(y,g){var w;return y>g&&(w=y,y=g,g=w),w=g,w+=g*g,w>>=1,w+=y,w},_modN:function(y){for(;y>=255;)y-=255,y=(y>>8)+(y&255);return y},N1:3,N2:3,N3:40,N4:10}),x=F,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var y=this.element;y.width=y.height=this.qrious.size}}),z=j,G=_.extend(function(y,g,w,N){this.name=y,this.modifiable=!!g,this.defaultValue=w,this._valueTransformer=N},{transform:function(y){var g=this._valueTransformer;return typeof g=="function"?g(y,this):y}}),V=G,W=_.extend(null,{abs:function(y){return y!=null?Math.abs(y):null},hasOwn:function(y,g){return Object.prototype.hasOwnProperty.call(y,g)},noop:function(){},toUpperCase:function(y){return y!=null?y.toUpperCase():null}}),U=W,K=_.extend(function(y){this.options={},y.forEach(function(g){this.options[g.name]=g},this)},{exists:function(y){return this.options[y]!=null},get:function(y,g){return K._get(this.options[y],g)},getAll:function(y){var g,w=this.options,N={};for(g in w)U.hasOwn(w,g)&&(N[g]=K._get(w[g],y));return N},init:function(y,g,w){typeof w!="function"&&(w=U.noop);var N,I;for(N in this.options)U.hasOwn(this.options,N)&&(I=this.options[N],K._set(I,I.defaultValue,g),K._createAccessor(I,g,w));this._setAll(y,g,!0)},set:function(y,g,w){return this._set(y,g,w)},setAll:function(y,g){return this._setAll(y,g)},_set:function(y,g,w,N){var I=this.options[y];if(!I)throw new Error("Invalid option: "+y);if(!I.modifiable&&!N)throw new Error("Option cannot be modified: "+y);return K._set(I,g,w)},_setAll:function(y,g,w){if(!y)return!1;var N,I=!1;for(N in y)U.hasOwn(y,N)&&this._set(N,y[N],g,w)&&(I=!0);return I}},{_createAccessor:function(y,g,w){var N={get:function(){return K._get(y,g)}};y.modifiable&&(N.set=function(I){K._set(y,I,g)&&w(I,y)}),Object.defineProperty(g,y.name,N)},_get:function(y,g){return g["_"+y.name]},_set:function(y,g,w){var N="_"+y.name,I=w[N],Q=y.transform(g??y.defaultValue);return w[N]=Q,Q!==I}}),H=K,Y=_.extend(function(){this._services={}},{getService:function(y){var g=this._services[y];if(!g)throw new Error("Service is not being managed with name: "+y);return g},setService:function(y,g){if(this._services[y])throw new Error("Service is already managed with name: "+y);g&&(this._services[y]=g)}}),X=Y,re=new H([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,U.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,U.abs),new V("level",!0,"L",U.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,U.abs),new V("size",!0,100,U.abs),new V("value",!0,"")]),ue=new X,we=_.extend(function(y){re.init(y,this,this.update.bind(this));var g=re.get("element",this),w=ue.getService("element"),N=g&&w.isCanvas(g)?g:w.createCanvas(),I=g&&w.isImage(g)?g:w.createImage();this._canvasRenderer=new k(this,N,!0),this._imageRenderer=new z(this,I,I===g),this.update()},{get:function(){return re.getAll(this)},set:function(y){re.setAll(y,this)&&this.update()},toDataURL:function(y){return this.canvas.toDataURL(y||this.mime)},update:function(){var y=new x({level:this.level,value:this.value});this._canvasRenderer.render(y),this._imageRenderer.render(y)}},{use:function(y){ue.setService(y.getName(),y)}});Object.defineProperties(we.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var me=we,Se=me,je=_.extend({getName:function(){}}),Oe=je,He=Oe.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(y){},isImage:function(y){}}),ye=He,Ne=ye.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(y){return y instanceof HTMLCanvasElement},isImage:function(y){return y instanceof HTMLImageElement}}),Re=Ne;Se.use(new Re);var $e=Se;return $e})})(xc);var ip=xc.exports;const sp=np(ip);function op(t){let e,l;return{c(){e=m("img"),to(e.src,l=t[2])||r(e,"src",l),r(e,"alt",t[0]),r(e,"class",t[1])},m(n,i){M(n,e,i)},p(n,[i]){i&4&&!to(e.src,l=n[2])&&r(e,"src",l),i&1&&r(e,"alt",n[0]),i&2&&r(e,"class",n[1])},i:fe,o:fe,d(n){n&&C(e)}}}function rp(t,e,l){const n=new sp;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:a="#000"}=e,{size:u="200"}=e,{value:c=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function b(){n.set({background:o,foreground:a,level:i,padding:f,size:u,value:c}),l(2,_=n.toDataURL("image/jpeg"))}return rc(()=>{b()}),t.$$set=v=>{"errorCorrection"in v&&l(3,i=v.errorCorrection),"background"in v&&l(4,o=v.background),"color"in v&&l(5,a=v.color),"size"in v&&l(6,u=v.size),"value"in v&&l(0,c=v.value),"padding"in v&&l(7,f=v.padding),"className"in v&&l(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&c&&b()},[c,p,_,i,o,a,u,f]}class ap extends Ee{constructor(e){super(),Pe(this,e,rp,op,Ae,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function uf(t,e,l){const n=t.slice();return n[96]=e[l],n[97]=e,n[98]=l,n}function ff(t,e,l){const n=t.slice();return n[99]=e[l],n[100]=e,n[101]=l,n}function up(t,e,l){const n=t.slice();return n[102]=e[l],n}function fp(t,e,l){const n=t.slice();return n[105]=e[l],n}function cp(t){let e,l;return{c(){e=m("option"),l=$(t[105]),e.__value=t[105],e.value=e.__value},m(n,i){M(n,e,i),s(e,l)},p:fe,d(n){n&&C(e)}}}function cf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","pt"),r(l,"type","text"),r(l,"class","in-s"),r(l,"placeholder","ENTSO-E API key, optional, read docs")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].p.t),n||(i=ee(l,"input",t[22]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].p.t&&te(l,o[3].p.t)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function mf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v;return{c(){e=m("div"),l=$("Username"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=$("Password"),f=m("br"),p=h(),_=m("input"),r(o,"name","gu"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(_,"name","gp"),r(_,"type","password"),r(_,"class","in-s"),r(u,"class","my-1")},m(d,k){M(d,e,k),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].g.u),M(d,a,k),M(d,u,k),s(u,c),s(u,f),s(u,p),s(u,_),te(_,t[3].g.p),b||(v=[ee(o,"input",t[24]),ee(_,"input",t[25])],b=!0)},p(d,k){k[0]&8&&o.value!==d[3].g.u&&te(o,d[3].g.u),k[0]&8&&_.value!==d[3].g.p&&te(_,d[3].g.p)},d(d){d&&C(e),d&&C(a),d&&C(u),b=!1,ze(v)}}}function mp(t){let e,l=t[102]*100+"",n;return{c(){e=m("option"),n=$(l),e.__value=t[102]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,n)},p:fe,d(i){i&&C(e)}}}function pf(t){let e,l,n,i;return{c(){e=m("br"),l=m("input"),r(l,"name","mek"),r(l,"type","text"),r(l,"class","in-s")},m(o,a){M(o,e,a),M(o,l,a),te(l,t[3].m.e.k),n||(i=ee(l,"input",t[34]),n=!0)},p(o,a){a[0]&8&&l.value!==o[3].m.e.k&&te(l,o[3].m.e.k)},d(o){o&&C(e),o&&C(l),n=!1,i()}}}function _f(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=$("Authentication key"),n=m("br"),i=h(),o=m("input"),r(o,"name","mea"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].m.e.a),a||(u=ee(o,"input",t[35]),a=!0)},p(c,f){f[0]&8&&o.value!==c[3].m.e.a&&te(o,c[3].m.e.a)},d(c){c&&C(e),a=!1,u()}}}function df(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j;return{c(){e=m("div"),l=m("div"),n=$("Watt"),i=m("br"),o=h(),a=m("input"),u=h(),c=m("div"),f=$("Volt"),p=m("br"),_=h(),b=m("input"),v=h(),d=m("div"),k=$("Amp"),A=m("br"),S=h(),T=m("input"),E=h(),B=m("div"),P=$("kWh"),R=m("br"),L=h(),F=m("input"),r(a,"name","mmw"),r(a,"type","number"),r(a,"min","0.00"),r(a,"max","1000"),r(a,"step","0.001"),r(a,"class","in-f tr w-full"),r(l,"class","w-1/4"),r(b,"name","mmv"),r(b,"type","number"),r(b,"min","0.00"),r(b,"max","1000"),r(b,"step","0.001"),r(b,"class","in-m tr w-full"),r(c,"class","w-1/4"),r(T,"name","mma"),r(T,"type","number"),r(T,"min","0.00"),r(T,"max","1000"),r(T,"step","0.001"),r(T,"class","in-m tr w-full"),r(d,"class","w-1/4"),r(F,"name","mmc"),r(F,"type","number"),r(F,"min","0.00"),r(F,"max","1000"),r(F,"step","0.001"),r(F,"class","in-l tr w-full"),r(B,"class","w-1/4"),r(e,"class","flex my-1")},m(z,G){M(z,e,G),s(e,l),s(l,n),s(l,i),s(l,o),s(l,a),te(a,t[3].m.m.w),s(e,u),s(e,c),s(c,f),s(c,p),s(c,_),s(c,b),te(b,t[3].m.m.v),s(e,v),s(e,d),s(d,k),s(d,A),s(d,S),s(d,T),te(T,t[3].m.m.a),s(e,E),s(e,B),s(B,P),s(B,R),s(B,L),s(B,F),te(F,t[3].m.m.c),x||(j=[ee(a,"input",t[37]),ee(b,"input",t[38]),ee(T,"input",t[39]),ee(F,"input",t[40])],x=!0)},p(z,G){G[0]&8&&he(a.value)!==z[3].m.m.w&&te(a,z[3].m.m.w),G[0]&8&&he(b.value)!==z[3].m.m.v&&te(b,z[3].m.m.v),G[0]&8&&he(T.value)!==z[3].m.m.a&&te(T,z[3].m.m.a),G[0]&8&&he(F.value)!==z[3].m.m.c&&te(F,z[3].m.m.c)},d(z){z&&C(e),x=!1,ze(j)}}}function vf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A;return{c(){e=m("div"),l=$("Gateway"),n=m("br"),i=h(),o=m("input"),a=h(),u=m("div"),c=$("DNS"),f=m("br"),p=h(),_=m("div"),b=m("input"),v=h(),d=m("input"),r(o,"name","ng"),r(o,"type","text"),r(o,"class","in-s"),r(e,"class","my-1"),r(b,"name","nd1"),r(b,"type","text"),r(b,"class","in-f w-full"),r(d,"name","nd2"),r(d,"type","text"),r(d,"class","in-l w-full"),r(_,"class","flex"),r(u,"class","my-1")},m(S,T){M(S,e,T),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].n.g),M(S,a,T),M(S,u,T),s(u,c),s(u,f),s(u,p),s(u,_),s(_,b),te(b,t[3].n.d1),s(_,v),s(_,d),te(d,t[3].n.d2),k||(A=[ee(o,"input",t[50]),ee(b,"input",t[51]),ee(d,"input",t[52])],k=!0)},p(S,T){T[0]&8&&o.value!==S[3].n.g&&te(o,S[3].n.g),T[0]&8&&b.value!==S[3].n.d1&&te(b,S[3].n.d1),T[0]&8&&d.value!==S[3].n.d2&&te(d,S[3].n.d2)},d(S){S&&C(e),S&&C(a),S&&C(u),k=!1,ze(A)}}}function hf(t){let e,l,n,i,o;return{c(){e=m("label"),l=m("input"),n=$(" SSL"),r(l,"type","checkbox"),r(l,"name","qs"),l.__value="true",l.value=l.__value,r(l,"class","rounded mb-1"),r(e,"class","float-right mr-3")},m(a,u){M(a,e,u),s(e,l),l.checked=t[3].q.s.e,s(e,n),i||(o=[ee(l,"change",t[56]),ee(l,"change",t[14])],i=!0)},p(a,u){u[0]&8&&(l.checked=a[3].q.s.e)},d(a){a&&C(e),i=!1,ze(o)}}}function bf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v;const d=[_p,pp],k=[];function A(L,F){return L[3].q.s.c?0:1}n=A(t),i=k[n]=d[n](t);const S=[bp,hp],T=[];function E(L,F){return L[3].q.s.r?0:1}u=E(t),c=T[u]=S[u](t);const B=[yp,wp],P=[];function R(L,F){return L[3].q.s.k?0:1}return _=R(t),b=P[_]=B[_](t),{c(){e=m("div"),l=m("span"),i.c(),o=h(),a=m("span"),c.c(),f=h(),p=m("span"),b.c(),r(l,"class","flex pr-2"),r(a,"class","flex pr-2"),r(p,"class","flex pr-2"),r(e,"class","my-1 flex")},m(L,F){M(L,e,F),s(e,l),k[n].m(l,null),s(e,o),s(e,a),T[u].m(a,null),s(e,f),s(e,p),P[_].m(p,null),v=!0},p(L,F){let x=n;n=A(L),n===x?k[n].p(L,F):(De(),q(k[x],1,1,()=>{k[x]=null}),Ie(),i=k[n],i?i.p(L,F):(i=k[n]=d[n](L),i.c()),D(i,1),i.m(l,null));let j=u;u=E(L),u===j?T[u].p(L,F):(De(),q(T[j],1,1,()=>{T[j]=null}),Ie(),c=T[u],c?c.p(L,F):(c=T[u]=S[u](L),c.c()),D(c,1),c.m(a,null));let z=_;_=R(L),_===z?P[_].p(L,F):(De(),q(P[z],1,1,()=>{P[z]=null}),Ie(),b=P[_],b?b.p(L,F):(b=P[_]=B[_](L),b.c()),D(b,1),b.m(p,null))},i(L){v||(D(i),D(c),D(b),v=!0)},o(L){q(i),q(c),q(b),v=!1},d(L){L&&C(e),k[n].d(),T[u].d(),P[_].d()}}}function pp(t){let e,l;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[dp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&32768&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function _p(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-ca",$$slots:{default:[vp]},$$scope:{ctx:t}}}),o=new Po({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),le(l,e,null),M(f,n,p),M(f,i,p),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[11]),ee(i,"keypress",t[11])],u=!0)},p(f,p){const _={};p[3]&32768&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function dp(t){let e,l;return e=new mn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function vp(t){let e;return{c(){e=$("CA OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function hp(t){let e,l;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[gp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&32768&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function bp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-cert",$$slots:{default:[kp]},$$scope:{ctx:t}}}),o=new Po({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),le(l,e,null),M(f,n,p),M(f,i,p),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[12]),ee(i,"keypress",t[12])],u=!0)},p(f,p){const _={};p[3]&32768&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function gp(t){let e,l;return e=new mn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function kp(t){let e;return{c(){e=$("Cert OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function wp(t){let e,l;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[Cp]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i[3]&32768&&(o.$$scope={dirty:i,ctx:n}),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function yp(t){let e,l,n,i,o,a,u,c;return l=new el({props:{to:"/mqtt-key",$$slots:{default:[Mp]},$$scope:{ctx:t}}}),o=new Po({}),{c(){e=m("span"),ie(l.$$.fragment),n=h(),i=m("span"),ie(o.$$.fragment),r(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),r(i,"class","rounded-r-md bg-red-500 text-red-100 text-xs px-2.5 py-1")},m(f,p){M(f,e,p),le(l,e,null),M(f,n,p),M(f,i,p),le(o,i,null),a=!0,u||(c=[ee(i,"click",t[13]),ee(i,"keypress",t[13])],u=!0)},p(f,p){const _={};p[3]&32768&&(_.$$scope={dirty:p,ctx:f}),l.$set(_)},i(f){a||(D(l.$$.fragment,f),D(o.$$.fragment,f),a=!0)},o(f){q(l.$$.fragment,f),q(o.$$.fragment,f),a=!1},d(f){f&&C(e),ne(l),f&&C(n),f&&C(i),ne(o),u=!1,ze(c)}}}function Cp(t){let e,l;return e=new mn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Mp(t){let e;return{c(){e=$("Key OK")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function gf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W,U,K;return o=new Ft({}),{c(){e=m("div"),l=m("strong"),l.textContent="Domoticz",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),p=m("div"),_=$("Electricity IDX"),b=m("br"),v=h(),d=m("input"),k=h(),A=m("div"),S=$("Current IDX"),T=m("br"),E=h(),B=m("input"),P=h(),R=m("div"),L=$(`Voltage IDX: L1, L2 & L3
`),F=m("div"),x=m("input"),j=h(),z=m("input"),G=h(),V=m("input"),r(l,"class","text-sm"),r(i,"href",qt("MQTT-configuration#domoticz")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","o"),u.value="true",r(d,"name","oe"),r(d,"type","text"),r(d,"class","in-f tr w-full"),r(p,"class","w-1/2"),r(B,"name","oc"),r(B,"type","text"),r(B,"class","in-l tr w-full"),r(A,"class","w-1/2"),r(f,"class","my-1 flex"),r(x,"name","ou1"),r(x,"type","text"),r(x,"class","in-f tr w-1/3"),r(z,"name","ou2"),r(z,"type","text"),r(z,"class","in-m tr w-1/3"),r(V,"name","ou3"),r(V,"type","text"),r(V,"class","in-l tr w-1/3"),r(F,"class","flex"),r(R,"class","my-1"),r(e,"class","cnt")},m(H,Y){M(H,e,Y),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,p),s(p,_),s(p,b),s(p,v),s(p,d),te(d,t[3].o.e),s(f,k),s(f,A),s(A,S),s(A,T),s(A,E),s(A,B),te(B,t[3].o.c),s(e,P),s(e,R),s(R,L),s(R,F),s(F,x),te(x,t[3].o.u1),s(F,j),s(F,z),te(z,t[3].o.u2),s(F,G),s(F,V),te(V,t[3].o.u3),W=!0,U||(K=[ee(d,"input",t[64]),ee(B,"input",t[65]),ee(x,"input",t[66]),ee(z,"input",t[67]),ee(V,"input",t[68])],U=!0)},p(H,Y){Y[0]&8&&d.value!==H[3].o.e&&te(d,H[3].o.e),Y[0]&8&&B.value!==H[3].o.c&&te(B,H[3].o.c),Y[0]&8&&x.value!==H[3].o.u1&&te(x,H[3].o.u1),Y[0]&8&&z.value!==H[3].o.u2&&te(z,H[3].o.u2),Y[0]&8&&V.value!==H[3].o.u3&&te(V,H[3].o.u3)},i(H){W||(D(o.$$.fragment,H),W=!0)},o(H){q(o.$$.fragment,H),W=!1},d(H){H&&C(e),ne(o),U=!1,ze(K)}}}function kf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V;return o=new Ft({}),{c(){e=m("div"),l=m("strong"),l.textContent="Home-Assistant",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div"),p=$("Discovery topic prefix"),_=m("br"),b=h(),v=m("input"),d=h(),k=m("div"),A=$("Hostname for URL"),S=m("br"),T=h(),E=m("input"),P=h(),R=m("div"),L=$("Name tag"),F=m("br"),x=h(),j=m("input"),r(l,"class","text-sm"),r(i,"href",qt("MQTT-configuration#home-assistant")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","h"),u.value="true",r(v,"name","ht"),r(v,"type","text"),r(v,"class","in-s"),r(v,"placeholder","homeassistant"),r(f,"class","my-1"),r(E,"name","hh"),r(E,"type","text"),r(E,"class","in-s"),r(E,"placeholder",B=t[3].g.h+".local"),r(k,"class","my-1"),r(j,"name","hn"),r(j,"type","text"),r(j,"class","in-s"),r(R,"class","my-1"),r(e,"class","cnt")},m(W,U){M(W,e,U),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f),s(f,p),s(f,_),s(f,b),s(f,v),te(v,t[3].h.t),s(e,d),s(e,k),s(k,A),s(k,S),s(k,T),s(k,E),te(E,t[3].h.h),s(e,P),s(e,R),s(R,L),s(R,F),s(R,x),s(R,j),te(j,t[3].h.n),z=!0,G||(V=[ee(v,"input",t[69]),ee(E,"input",t[70]),ee(j,"input",t[71])],G=!0)},p(W,U){U[0]&8&&v.value!==W[3].h.t&&te(v,W[3].h.t),(!z||U[0]&8&&B!==(B=W[3].g.h+".local"))&&r(E,"placeholder",B),U[0]&8&&E.value!==W[3].h.h&&te(E,W[3].h.h),U[0]&8&&j.value!==W[3].h.n&&te(j,W[3].h.n)},i(W){z||(D(o.$$.fragment,W),z=!0)},o(W){q(o.$$.fragment,W),z=!1},d(W){W&&C(e),ne(o),G=!1,ze(V)}}}function wf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d=t[3].c.es&&yf(t);return{c(){e=m("div"),l=m("input"),n=h(),i=m("strong"),i.textContent="Cloud connections",o=h(),a=m("div"),u=m("label"),c=m("input"),f=$(" Energy Speedometer"),p=h(),d&&d.c(),r(l,"type","hidden"),r(l,"name","c"),l.value="true",r(i,"class","text-sm"),r(c,"type","checkbox"),r(c,"class","rounded mb-1"),r(c,"name","ces"),c.__value="true",c.value=c.__value,r(a,"class","my-1"),r(e,"class","cnt")},m(k,A){M(k,e,A),s(e,l),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),s(u,c),c.checked=t[3].c.es,s(u,f),s(a,p),d&&d.m(a,null),_=!0,b||(v=ee(c,"change",t[72]),b=!0)},p(k,A){A[0]&8&&(c.checked=k[3].c.es),k[3].c.es?d?(d.p(k,A),A[0]&8&&D(d,1)):(d=yf(k),d.c(),D(d,1),d.m(a,null)):d&&(De(),q(d,1,1,()=>{d=null}),Ie())},i(k){_||(D(d),_=!0)},o(k){q(d),_=!1},d(k){k&&C(e),d&&d.d(),b=!1,v()}}}function yf(t){let e,l,n=t[0].mac+"",i,o,a,u,c=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,b,v=t[0].mac&&t[0].meter.id&&Cf(t);return{c(){e=m("div"),l=$("MAC: "),i=$(n),o=h(),a=m("div"),u=$("Meter ID: "),f=$(c),p=h(),v&&v.c(),_=Ge(),r(e,"class","pl-5"),r(a,"class","pl-5")},m(d,k){M(d,e,k),s(e,l),s(e,i),M(d,o,k),M(d,a,k),s(a,u),s(a,f),M(d,p,k),v&&v.m(d,k),M(d,_,k),b=!0},p(d,k){(!b||k[0]&1)&&n!==(n=d[0].mac+"")&&Z(i,n),(!b||k[0]&1)&&c!==(c=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&Z(f,c),d[0].mac&&d[0].meter.id?v?(v.p(d,k),k[0]&1&&D(v,1)):(v=Cf(d),v.c(),D(v,1),v.m(_.parentNode,_)):v&&(De(),q(v,1,1,()=>{v=null}),Ie())},i(d){b||(D(v),b=!0)},o(d){q(v),b=!1},d(d){d&&C(e),d&&C(o),d&&C(a),d&&C(p),v&&v.d(d),d&&C(_)}}}function Cf(t){let e,l,n;return l=new ap({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=m("div"),ie(l.$$.fragment),r(e,"class","pl-2")},m(i,o){M(i,e,o),le(l,e,null),n=!0},p(i,o){const a={};o[0]&1&&(a.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),l.$set(a)},i(i){n||(D(l.$$.fragment,i),n=!0)},o(i){q(l.$$.fragment,i),n=!1},d(i){i&&C(e),ne(l)}}}function Mf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E;o=new Ft({});let B={length:9},P=[];for(let R=0;R<B.length;R+=1)P[R]=$f(ff(t,B,R));return{c(){e=m("div"),l=m("strong"),l.textContent="Tariff thresholds",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),u=m("input"),c=h(),f=m("div");for(let R=0;R<P.length;R+=1)P[R].c();p=h(),_=m("label"),b=m("span"),b.textContent="Average of",v=h(),d=m("input"),k=h(),A=m("span"),A.textContent="hours",r(l,"class","text-sm"),r(i,"href",qt("Threshold-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(u,"type","hidden"),r(u,"name","t"),u.value="true",r(f,"class","flex flex-wrap my-1"),r(b,"class","in-pre"),r(d,"name","th"),r(d,"type","number"),r(d,"min","0"),r(d,"max","255"),r(d,"class","in-txt tr w-full"),r(A,"class","in-post"),r(_,"class","flex m-1"),r(e,"class","cnt")},m(R,L){M(R,e,L),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),s(e,u),s(e,c),s(e,f);for(let F=0;F<P.length;F+=1)P[F]&&P[F].m(f,null);s(e,p),s(e,_),s(_,b),s(_,v),s(_,d),te(d,t[3].t.h),s(_,k),s(_,A),S=!0,T||(E=ee(d,"input",t[74]),T=!0)},p(R,L){if(L[0]&8){B={length:9};let F;for(F=0;F<B.length;F+=1){const x=ff(R,B,F);P[F]?P[F].p(x,L):(P[F]=$f(x),P[F].c(),P[F].m(f,null))}for(;F<P.length;F+=1)P[F].d(1);P.length=B.length}L[0]&8&&he(d.value)!==R[3].t.h&&te(d,R[3].t.h)},i(R){S||(D(o.$$.fragment,R),S=!0)},o(R){q(o.$$.fragment,R),S=!1},d(R){R&&C(e),ne(o),cl(P,R),T=!1,E()}}}function $f(t){let e,l,n=t[101]+1+"",i,o,a,u,c,f,p,_;function b(){t[73].call(a,t[101])}return{c(){e=m("label"),l=m("span"),i=$(n),o=h(),a=m("input"),u=h(),c=m("span"),c.textContent="kWh",f=h(),r(l,"class","in-pre"),r(a,"name","t"+t[101]),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-txt w-full"),r(c,"class","in-post"),r(e,"class","flex w-40 m-1")},m(v,d){M(v,e,d),s(e,l),s(l,i),s(e,o),s(e,a),te(a,t[3].t.t[t[101]]),s(e,u),s(e,c),s(e,f),p||(_=ee(a,"input",b),p=!0)},p(v,d){t=v,d[0]&8&&he(a.value)!==t[3].t.t[t[101]]&&te(a,t[3].t.t[t[101]])},d(v){v&&C(e),p=!1,_()}}}function Tf(t){let e,l=t[96].name+"",n,i,o,a,u,c,f,p,_,b;function v(){t[75].call(a,t[96])}return{c(){e=m("div"),n=$(l),i=m("br"),o=h(),a=m("select"),u=m("option"),u.textContent="Hide",c=m("option"),c.textContent="Show",f=m("option"),f.textContent="Dynamic",p=h(),u.__value=0,u.value=u.__value,c.__value=1,c.value=c.__value,f.__value=2,f.value=f.__value,r(a,"name","u"+t[96].key),r(a,"class","in-s"),t[3].u[t[96].key]===void 0&&et(v),r(e,"class","w-1/2")},m(d,k){M(d,e,k),s(e,n),s(e,i),s(e,o),s(e,a),s(a,u),s(a,c),s(a,f),qe(a,t[3].u[t[96].key],!0),s(e,p),_||(b=ee(a,"change",v),_=!0)},p(d,k){t=d,k[0]&136&&qe(a,t[3].u[t[96].key])},d(d){d&&C(e),_=!1,b()}}}function Sf(t){let e,l,n,i,o,a,u,c;o=new Ft({});let f=t[0].board>20&&Nf(t),p=t[0].chip=="esp8266"&&Ef(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Hardware",n=h(),i=m("a"),ie(o.$$.fragment),a=h(),f&&f.c(),u=h(),p&&p.c(),r(l,"class","text-sm"),r(i,"href",qt("GPIO-configuration")),r(i,"target","_blank"),r(i,"class","float-right"),r(e,"class","cnt")},m(_,b){M(_,e,b),s(e,l),s(e,n),s(e,i),le(o,i,null),s(e,a),f&&f.m(e,null),s(e,u),p&&p.m(e,null),c=!0},p(_,b){_[0].board>20?f?(f.p(_,b),b[0]&1&&D(f,1)):(f=Nf(_),f.c(),D(f,1),f.m(e,u)):f&&(De(),q(f,1,1,()=>{f=null}),Ie()),_[0].chip=="esp8266"?p?p.p(_,b):(p=Ef(_),p.c(),p.m(e,null)):p&&(p.d(1),p=null)},i(_){c||(D(o.$$.fragment,_),D(f),c=!0)},o(_){q(o.$$.fragment,_),q(f),c=!1},d(_){_&&C(e),ne(o),f&&f.d(),p&&p.d()}}}function Nf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,we,me,Se,je,Oe,He,ye,Ne,Re,$e,y,g,w,N,I,Q,J,se,ce,ve,Te,oe;b=new Zc({props:{chip:t[0].chip}});let pe=t[0].chip!="esp8266"&&Af(t),Be=t[3].i.v.p>0&&Pf(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=$("HAN"),a=m("label"),u=m("input"),c=$(" pullup"),f=m("br"),p=h(),_=m("select"),ie(b.$$.fragment),v=h(),d=m("div"),k=$("AP button"),A=m("br"),S=h(),T=m("input"),E=h(),B=m("div"),P=$("LED"),R=m("label"),L=m("input"),F=$(" inv"),x=m("br"),j=h(),z=m("div"),G=m("input"),V=h(),W=m("div"),U=$("RGB"),K=m("label"),H=m("input"),Y=$(" inverted"),X=m("br"),re=h(),ue=m("div"),we=m("input"),me=h(),Se=m("input"),je=h(),Oe=m("input"),He=h(),ye=m("div"),Ne=$("Temperature"),Re=m("br"),$e=h(),y=m("input"),g=h(),w=m("div"),N=$("Analog temp"),I=m("br"),Q=h(),J=m("input"),se=h(),pe&&pe.c(),ce=h(),Be&&Be.c(),r(e,"type","hidden"),r(e,"name","i"),e.value="true",r(u,"name","ihu"),u.__value="true",u.value=u.__value,r(u,"type","checkbox"),r(u,"class","rounded mb-1"),r(a,"class","ml-2"),r(_,"name","ihp"),r(_,"class","in-f w-full"),t[3].i.h.p===void 0&&et(()=>t[77].call(_)),r(i,"class","w-1/3"),r(T,"name","ia"),r(T,"type","number"),r(T,"min","0"),r(T,"max",t[6]),r(T,"class","in-m tr w-full"),r(d,"class","w-1/3"),r(L,"name","ili"),L.__value="true",L.value=L.__value,r(L,"type","checkbox"),r(L,"class","rounded mb-1"),r(R,"class","ml-4"),r(G,"name","ilp"),r(G,"type","number"),r(G,"min","0"),r(G,"max",t[6]),r(G,"class","in-l tr w-full"),r(z,"class","flex"),r(B,"class","w-1/3"),r(H,"name","iri"),H.__value="true",H.value=H.__value,r(H,"type","checkbox"),r(H,"class","rounded mb-1"),r(K,"class","ml-4"),r(we,"name","irr"),r(we,"type","number"),r(we,"min","0"),r(we,"max",t[6]),r(we,"class","in-f tr w-1/3"),r(Se,"name","irg"),r(Se,"type","number"),r(Se,"min","0"),r(Se,"max",t[6]),r(Se,"class","in-m tr w-1/3"),r(Oe,"name","irb"),r(Oe,"type","number"),r(Oe,"min","0"),r(Oe,"max",t[6]),r(Oe,"class","in-l tr w-1/3"),r(ue,"class","flex"),r(W,"class","w-full"),r(y,"name","itd"),r(y,"type","number"),r(y,"min","0"),r(y,"max",t[6]),r(y,"class","in-f tr w-full"),r(ye,"class","my-1 w-1/3"),r(J,"name","ita"),r(J,"type","number"),r(J,"min","0"),r(J,"max",t[6]),r(J,"class","in-l tr w-full"),r(w,"class","my-1 pr-1 w-1/3"),r(n,"class","flex flex-wrap")},m(_e,Ce){M(_e,e,Ce),M(_e,l,Ce),M(_e,n,Ce),s(n,i),s(i,o),s(i,a),s(a,u),u.checked=t[3].i.h.u,s(a,c),s(i,f),s(i,p),s(i,_),le(b,_,null),qe(_,t[3].i.h.p,!0),s(n,v),s(n,d),s(d,k),s(d,A),s(d,S),s(d,T),te(T,t[3].i.a),s(n,E),s(n,B),s(B,P),s(B,R),s(R,L),L.checked=t[3].i.l.i,s(R,F),s(B,x),s(B,j),s(B,z),s(z,G),te(G,t[3].i.l.p),s(n,V),s(n,W),s(W,U),s(W,K),s(K,H),H.checked=t[3].i.r.i,s(K,Y),s(W,X),s(W,re),s(W,ue),s(ue,we),te(we,t[3].i.r.r),s(ue,me),s(ue,Se),te(Se,t[3].i.r.g),s(ue,je),s(ue,Oe),te(Oe,t[3].i.r.b),s(n,He),s(n,ye),s(ye,Ne),s(ye,Re),s(ye,$e),s(ye,y),te(y,t[3].i.t.d),s(n,g),s(n,w),s(w,N),s(w,I),s(w,Q),s(w,J),te(J,t[3].i.t.a),s(n,se),pe&&pe.m(n,null),s(n,ce),Be&&Be.m(n,null),ve=!0,Te||(oe=[ee(u,"change",t[76]),ee(_,"change",t[77]),ee(T,"input",t[78]),ee(L,"change",t[79]),ee(G,"input",t[80]),ee(H,"change",t[81]),ee(we,"input",t[82]),ee(Se,"input",t[83]),ee(Oe,"input",t[84]),ee(y,"input",t[85]),ee(J,"input",t[86])],Te=!0)},p(_e,Ce){Ce[0]&8&&(u.checked=_e[3].i.h.u);const vt={};Ce[0]&1&&(vt.chip=_e[0].chip),b.$set(vt),Ce[0]&8&&qe(_,_e[3].i.h.p),(!ve||Ce[0]&64)&&r(T,"max",_e[6]),Ce[0]&8&&he(T.value)!==_e[3].i.a&&te(T,_e[3].i.a),Ce[0]&8&&(L.checked=_e[3].i.l.i),(!ve||Ce[0]&64)&&r(G,"max",_e[6]),Ce[0]&8&&he(G.value)!==_e[3].i.l.p&&te(G,_e[3].i.l.p),Ce[0]&8&&(H.checked=_e[3].i.r.i),(!ve||Ce[0]&64)&&r(we,"max",_e[6]),Ce[0]&8&&he(we.value)!==_e[3].i.r.r&&te(we,_e[3].i.r.r),(!ve||Ce[0]&64)&&r(Se,"max",_e[6]),Ce[0]&8&&he(Se.value)!==_e[3].i.r.g&&te(Se,_e[3].i.r.g),(!ve||Ce[0]&64)&&r(Oe,"max",_e[6]),Ce[0]&8&&he(Oe.value)!==_e[3].i.r.b&&te(Oe,_e[3].i.r.b),(!ve||Ce[0]&64)&&r(y,"max",_e[6]),Ce[0]&8&&he(y.value)!==_e[3].i.t.d&&te(y,_e[3].i.t.d),(!ve||Ce[0]&64)&&r(J,"max",_e[6]),Ce[0]&8&&he(J.value)!==_e[3].i.t.a&&te(J,_e[3].i.t.a),_e[0].chip!="esp8266"?pe?pe.p(_e,Ce):(pe=Af(_e),pe.c(),pe.m(n,ce)):pe&&(pe.d(1),pe=null),_e[3].i.v.p>0?Be?Be.p(_e,Ce):(Be=Pf(_e),Be.c(),Be.m(n,null)):Be&&(Be.d(1),Be=null)},i(_e){ve||(D(b.$$.fragment,_e),ve=!0)},o(_e){q(b.$$.fragment,_e),ve=!1},d(_e){_e&&C(e),_e&&C(l),_e&&C(n),ne(b),pe&&pe.d(),Be&&Be.d(),Te=!1,ze(oe)}}}function Af(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=$("Vcc"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivp"),r(o,"type","number"),r(o,"min","0"),r(o,"max",t[6]),r(o,"class","in-s tr w-full"),r(e,"class","my-1 pl-1 w-1/3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.p),a||(u=ee(o,"input",t[87]),a=!0)},p(c,f){f[0]&64&&r(o,"max",c[6]),f[0]&8&&he(o.value)!==c[3].i.v.p&&te(o,c[3].i.v.p)},d(c){c&&C(e),a=!1,u()}}}function Pf(t){let e,l,n,i,o,a,u,c,f,p;return{c(){e=m("div"),l=$("Voltage divider"),n=m("br"),i=h(),o=m("div"),a=m("input"),u=h(),c=m("input"),r(a,"name","ivdv"),r(a,"type","number"),r(a,"min","0"),r(a,"max","65535"),r(a,"class","in-f tr w-full"),r(a,"placeholder","VCC"),r(c,"name","ivdg"),r(c,"type","number"),r(c,"min","0"),r(c,"max","65535"),r(c,"class","in-l tr w-full"),r(c,"placeholder","GND"),r(o,"class","flex"),r(e,"class","my-1")},m(_,b){M(_,e,b),s(e,l),s(e,n),s(e,i),s(e,o),s(o,a),te(a,t[3].i.v.d.v),s(o,u),s(o,c),te(c,t[3].i.v.d.g),f||(p=[ee(a,"input",t[88]),ee(c,"input",t[89])],f=!0)},p(_,b){b[0]&8&&he(a.value)!==_[3].i.v.d.v&&te(a,_[3].i.v.d.v),b[0]&8&&he(c.value)!==_[3].i.v.d.g&&te(c,_[3].i.v.d.g)},d(_){_&&C(e),f=!1,ze(p)}}}function Ef(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T=(t[0].board==2||t[0].board==100)&&Df(t);return{c(){e=m("input"),l=h(),n=m("div"),i=m("div"),o=$("Vcc offset"),a=m("br"),u=h(),c=m("input"),f=h(),p=m("div"),_=$("Multiplier"),b=m("br"),v=h(),d=m("input"),k=h(),T&&T.c(),r(e,"type","hidden"),r(e,"name","iv"),e.value="true",r(c,"name","ivo"),r(c,"type","number"),r(c,"min","0.0"),r(c,"max","3.5"),r(c,"step","0.01"),r(c,"class","in-f tr w-full"),r(i,"class","w-1/3"),r(d,"name","ivm"),r(d,"type","number"),r(d,"min","0.1"),r(d,"max","10"),r(d,"step","0.01"),r(d,"class","in-l tr w-full"),r(p,"class","w-1/3 pr-1"),r(n,"class","my-1 flex flex-wrap")},m(E,B){M(E,e,B),M(E,l,B),M(E,n,B),s(n,i),s(i,o),s(i,a),s(i,u),s(i,c),te(c,t[3].i.v.o),s(n,f),s(n,p),s(p,_),s(p,b),s(p,v),s(p,d),te(d,t[3].i.v.m),s(n,k),T&&T.m(n,null),A||(S=[ee(c,"input",t[90]),ee(d,"input",t[91])],A=!0)},p(E,B){B[0]&8&&he(c.value)!==E[3].i.v.o&&te(c,E[3].i.v.o),B[0]&8&&he(d.value)!==E[3].i.v.m&&te(d,E[3].i.v.m),E[0].board==2||E[0].board==100?T?T.p(E,B):(T=Df(E),T.c(),T.m(n,null)):T&&(T.d(1),T=null)},d(E){E&&C(e),E&&C(l),E&&C(n),T&&T.d(),A=!1,ze(S)}}}function Df(t){let e,l,n,i,o,a,u;return{c(){e=m("div"),l=$("Boot limit"),n=m("br"),i=h(),o=m("input"),r(o,"name","ivb"),r(o,"type","number"),r(o,"min","2.5"),r(o,"max","3.5"),r(o,"step","0.1"),r(o,"class","in-s tr w-full"),r(e,"class","w-1/3 pl-1")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),te(o,t[3].i.v.b),a||(u=ee(o,"input",t[92]),a=!0)},p(c,f){f[0]&8&&he(o.value)!==c[3].i.v.b&&te(o,c[3].i.v.b)},d(c){c&&C(e),a=!1,u()}}}function If(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S=t[3].d.t&&Of();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"),a=$(" Enable telnet"),u=h(),S&&S.c(),c=h(),f=m("div"),p=m("select"),_=m("option"),_.textContent="Verbose",b=m("option"),b.textContent="Debug",v=m("option"),v.textContent="Info",d=m("option"),d.textContent="Warning",r(e,"class","bd-red"),r(o,"type","checkbox"),r(o,"name","dt"),o.__value="true",o.value=o.__value,r(o,"class","rounded mb-1"),r(n,"class","my-1"),_.__value=1,_.value=_.__value,b.__value=2,b.value=b.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,r(p,"name","dl"),r(p,"class","in-s"),t[3].d.l===void 0&&et(()=>t[95].call(p)),r(f,"class","my-1")},m(T,E){M(T,e,E),M(T,l,E),M(T,n,E),s(n,i),s(i,o),o.checked=t[3].d.t,s(i,a),M(T,u,E),S&&S.m(T,E),M(T,c,E),M(T,f,E),s(f,p),s(p,_),s(p,b),s(p,v),s(p,d),qe(p,t[3].d.l,!0),k||(A=[ee(o,"change",t[94]),ee(p,"change",t[95])],k=!0)},p(T,E){E[0]&8&&(o.checked=T[3].d.t),T[3].d.t?S||(S=Of(),S.c(),S.m(c.parentNode,c)):S&&(S.d(1),S=null),E[0]&8&&qe(p,T[3].d.l)},d(T){T&&C(e),T&&C(l),T&&C(n),T&&C(u),S&&S.d(T),T&&C(c),T&&C(f),k=!1,ze(A)}}}function Of(t){let e;return{c(){e=m("div"),e.textContent="Telnet is unsafe and should be off when not in use",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function $p(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,we,me,Se,je,Oe,He,ye,Ne,Re,$e,y,g,w,N,I,Q,J,se,ce,ve,Te,oe,pe,Be,_e,Ce,vt,Hl,tl,ct,Tl,pl,Ut,ht,Ye,Qe,Xe,Ue,Ze,We,Je,xe,de,Me,Ii,_l,vn,St,Oi,Ri,Li,dl,Fi,qi,Bi,Nt,Sl,Nl,Al,Ui,ji,ke,mt,Wl,zl,Pl,El,Gl,Hi,ll,Wi,Do,Es,Io,pi,jt,Oo,Ro,Dl,nl,Il,Lo,zi,Fo,pt,Ol,qo,Gi,hn,bn,gn,kn,Vi,Bo,It,Uo,Vl,jo,Ho,Wo,il,wn,yn,zo,Cn,Kl,Go,Vo,Ko,Mn,Ht,Yo,Ki,Qo,Yl,Xo,Zo,Jo,$n,Wt,xo,Yi,er,Ds,tr,Ql,Qi,zt,lr,nr,ir,Is,Xi,Gt,sr,or,rr,tt,Zi,ar,Tn,Sn,ur,_i,fr,Xl,cr,mr,pr,vl,_r,Zl,dr,vr,hr,hl,br,Nn,Jl,gr,kr,wr,Ot,An,Pn,En,Dn,yr,xl,Cr,Mr,$r,In,Rt,Tr,Ji,Sr,xi,es,Vt,Nr,Ar,ts,ls,Kt,Pr,Er,ut,ns,Dr,On,Rn,Ir,en,Or,Rr,Lr,Rl,sl,Ln,Fn,Fr,At,is,ss,qr,Pt,qn,os,rs,Br,Os,as,us,Yt,Ur,jr,di,Hr,Ll,Wr,vi,Qt,zr,Gr,Vr,fs,bl,Kr,Ke,cs,Yr,Bn,Un,Qr,hi,Xr,ol,Zr,Rs,Jr,xr,jn,gl,ea,Xt,ta,Ls,tn,la,na,ia,kl,sa,ln,oa,ra,aa,wl,ua,Hn,Wn,fa,ca,ma,yl,pa,zn,_a,da,va,bt,Gn,Vn,Kn,Yn,Qn,Xn,ha,nn,ba,ga,ka,Cl,wa,Fs,qs,Bs,Us=t[3].p.r.startsWith("10YNO")||t[3].p.r=="10Y1001A1001A48H",js,rl,ms,ya,Zn,Jn,Ca,bi,Ma,gi,$a,Hs,Et,ps,Ta,xn,ei,Sa,ki,Na,_s,ds,Zt,Aa,Pa,Ea,Fl,Ws,ti,Da,vs,li,Ia,hs,zs,sn,Gs,on,Vs,rn,Ks,an,Jt,Ys,Oa;u=new Ft({}),F=new xm({});let e0=["NOK","SEK","DKK","EUR"],wi=[];for(let O=0;O<4;O+=1)wi[O]=cp(fp(t,e0,O));let gt=t[3].p.e&&t[0].chip!="esp8266"&&cf(t),kt=t[3].g.s>0&&mf(t);Pl=new Ft({});let t0=[24,48,96,192,384,576,1152],yi=[];for(let O=0;O<7;O+=1)yi[O]=mp(up(t,t0,O));let wt=t[3].m.e.e&&pf(t),yt=t[3].m.e.e&&_f(t),Ct=t[3].m.m.e&&df(t);Sn=new Ft({}),Rn=new Ft({}),qn=new Jc({});let Mt=t[3].n.m=="static"&&vf(t);Un=new Ft({});let $t=t[0].chip!="esp8266"&&hf(t),lt=t[3].q.s.e&&bf(t),nt=t[3].q.m==3&&gf(t),it=t[3].q.m==4&&kf(t),st=t[3].c.es!=null&&wf(t),ot=Us&&Mf(t);Jn=new Ft({});let ni=t[7],_t=[];for(let O=0;O<ni.length;O+=1)_t[O]=Tf(uf(t,ni,O));let rt=(t[0].board>20||t[0].chip=="esp8266")&&Sf(t);ei=new Ft({});let Tt=t[3].d.s&&If(t);return sn=new Dt({props:{active:t[1],message:"Loading configuration"}}),on=new Dt({props:{active:t[2],message:"Saving configuration"}}),rn=new Dt({props:{active:t[4],message:"Performing factory reset"}}),an=new Dt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=m("form"),l=m("div"),n=m("div"),i=m("strong"),i.textContent="General",o=h(),a=m("a"),ie(u.$$.fragment),c=h(),f=m("input"),p=h(),_=m("div"),b=m("div"),v=m("div"),d=$("Hostname"),k=m("br"),A=h(),S=m("input"),T=h(),E=m("div"),B=$("Time zone"),P=m("br"),R=h(),L=m("select"),ie(F.$$.fragment),x=h(),j=m("input"),z=h(),G=m("div"),V=m("div"),W=m("div"),U=$("Price region"),K=m("br"),H=h(),Y=m("select"),X=m("optgroup"),re=m("option"),re.textContent="NO1",ue=m("option"),ue.textContent="NO2",we=m("option"),we.textContent="NO3",me=m("option"),me.textContent="NO4",Se=m("option"),Se.textContent="NO5",je=m("optgroup"),Oe=m("option"),Oe.textContent="SE1",He=m("option"),He.textContent="SE2",ye=m("option"),ye.textContent="SE3",Ne=m("option"),Ne.textContent="SE4",Re=m("optgroup"),$e=m("option"),$e.textContent="DK1",y=m("option"),y.textContent="DK2",g=m("option"),g.textContent="Austria",w=m("option"),w.textContent="Belgium",N=m("option"),N.textContent="Czech Republic",I=m("option"),I.textContent="Estonia",Q=m("option"),Q.textContent="Finland",J=m("option"),J.textContent="France",se=m("option"),se.textContent="Germany",ce=m("option"),ce.textContent="Great Britain",ve=m("option"),ve.textContent="Latvia",Te=m("option"),Te.textContent="Lithuania",oe=m("option"),oe.textContent="Netherland",pe=m("option"),pe.textContent="Poland",Be=m("option"),Be.textContent="Switzerland",_e=h(),Ce=m("div"),vt=$("Currency"),Hl=m("br"),tl=h(),ct=m("select");for(let O=0;O<4;O+=1)wi[O].c();Tl=h(),pl=m("div"),Ut=m("div"),ht=m("div"),Ye=$("Fixed price"),Qe=m("br"),Xe=h(),Ue=m("input"),Ze=h(),We=m("div"),Je=$("Multiplier"),xe=m("br"),de=h(),Me=m("input"),Ii=h(),_l=m("div"),vn=m("label"),St=m("input"),Oi=$(" Enable price fetch from remote server"),Ri=h(),gt&&gt.c(),Li=h(),dl=m("div"),Fi=$("Security"),qi=m("br"),Bi=h(),Nt=m("select"),Sl=m("option"),Sl.textContent="None",Nl=m("option"),Nl.textContent="Only configuration",Al=m("option"),Al.textContent="Everything",Ui=h(),kt&&kt.c(),ji=h(),ke=m("div"),mt=m("strong"),mt.textContent="Meter",Wl=h(),zl=m("a"),ie(Pl.$$.fragment),El=h(),Gl=m("input"),Hi=h(),ll=m("div"),Wi=m("span"),Wi.textContent="Buffer size",Do=h(),Es=m("span"),Es.textContent="Serial conf.",Io=h(),pi=m("label"),jt=m("input"),Oo=$(" inverted"),Ro=h(),Dl=m("div"),nl=m("select"),Il=m("option"),Lo=$("Autodetect");for(let O=0;O<7;O+=1)yi[O].c();Fo=h(),pt=m("select"),Ol=m("option"),qo=$("-"),hn=m("option"),hn.textContent="7N1",bn=m("option"),bn.textContent="8N1",gn=m("option"),gn.textContent="7E1",kn=m("option"),kn.textContent="8E1",Bo=h(),It=m("input"),Uo=h(),Vl=m("div"),jo=$("Voltage"),Ho=m("br"),Wo=h(),il=m("select"),wn=m("option"),wn.textContent="400V (TN)",yn=m("option"),yn.textContent="230V (IT/TT)",zo=h(),Cn=m("div"),Kl=m("div"),Go=$("Main fuse"),Vo=m("br"),Ko=h(),Mn=m("label"),Ht=m("input"),Yo=h(),Ki=m("span"),Ki.textContent="A",Qo=h(),Yl=m("div"),Xo=$("Production"),Zo=m("br"),Jo=h(),$n=m("label"),Wt=m("input"),xo=h(),Yi=m("span"),Yi.textContent="kWp",er=h(),Ds=m("div"),tr=h(),Ql=m("div"),Qi=m("label"),zt=m("input"),lr=$(" Meter is encrypted"),nr=h(),wt&&wt.c(),ir=h(),yt&&yt.c(),Is=h(),Xi=m("label"),Gt=m("input"),sr=$(" Multipliers"),or=h(),Ct&&Ct.c(),rr=h(),tt=m("div"),Zi=m("strong"),Zi.textContent="WiFi",ar=h(),Tn=m("a"),ie(Sn.$$.fragment),ur=h(),_i=m("input"),fr=h(),Xl=m("div"),cr=$("SSID"),mr=m("br"),pr=h(),vl=m("input"),_r=h(),Zl=m("div"),dr=$("Password"),vr=m("br"),hr=h(),hl=m("input"),br=h(),Nn=m("div"),Jl=m("div"),gr=$("Power saving"),kr=m("br"),wr=h(),Ot=m("select"),An=m("option"),An.textContent="Default",Pn=m("option"),Pn.textContent="Off",En=m("option"),En.textContent="Minimum",Dn=m("option"),Dn.textContent="Maximum",yr=h(),xl=m("div"),Cr=$("Power"),Mr=m("br"),$r=h(),In=m("div"),Rt=m("input"),Tr=h(),Ji=m("span"),Ji.textContent="dBm",Sr=h(),xi=m("div"),es=m("label"),Vt=m("input"),Nr=$(" Auto reboot on connection problem"),Ar=h(),ts=m("div"),ls=m("label"),Kt=m("input"),Pr=$(" Allow 802.11b legacy rates"),Er=h(),ut=m("div"),ns=m("strong"),ns.textContent="Network",Dr=h(),On=m("a"),ie(Rn.$$.fragment),Ir=h(),en=m("div"),Or=$("IP"),Rr=m("br"),Lr=h(),Rl=m("div"),sl=m("select"),Ln=m("option"),Ln.textContent="DHCP",Fn=m("option"),Fn.textContent="Static",Fr=h(),At=m("input"),qr=h(),Pt=m("select"),ie(qn.$$.fragment),Br=h(),Mt&&Mt.c(),Os=h(),as=m("div"),us=m("label"),Yt=m("input"),Ur=$(" enable mDNS"),jr=h(),di=m("input"),Hr=h(),Ll=m("div"),Wr=$("NTP "),vi=m("label"),Qt=m("input"),zr=$(" obtain from DHCP"),Gr=m("br"),Vr=h(),fs=m("div"),bl=m("input"),Kr=h(),Ke=m("div"),cs=m("strong"),cs.textContent="MQTT",Yr=h(),Bn=m("a"),ie(Un.$$.fragment),Qr=h(),hi=m("input"),Xr=h(),ol=m("div"),Zr=$(`Server
`),$t&&$t.c(),Rs=h(),Jr=m("br"),xr=h(),jn=m("div"),gl=m("input"),ea=h(),Xt=m("input"),ta=h(),lt&&lt.c(),Ls=h(),tn=m("div"),la=$("Username"),na=m("br"),ia=h(),kl=m("input"),sa=h(),ln=m("div"),oa=$("Password"),ra=m("br"),aa=h(),wl=m("input"),ua=h(),Hn=m("div"),Wn=m("div"),fa=$("Client ID"),ca=m("br"),ma=h(),yl=m("input"),pa=h(),zn=m("div"),_a=$("Payload"),da=m("br"),va=h(),bt=m("select"),Gn=m("option"),Gn.textContent="JSON",Vn=m("option"),Vn.textContent="Raw (minimal)",Kn=m("option"),Kn.textContent="Raw (full)",Yn=m("option"),Yn.textContent="Domoticz",Qn=m("option"),Qn.textContent="HomeAssistant",Xn=m("option"),Xn.textContent="HEX dump",ha=h(),nn=m("div"),ba=$("Publish topic"),ga=m("br"),ka=h(),Cl=m("input"),wa=h(),nt&&nt.c(),Fs=h(),it&&it.c(),qs=h(),st&&st.c(),Bs=h(),ot&&ot.c(),js=h(),rl=m("div"),ms=m("strong"),ms.textContent="User interface",ya=h(),Zn=m("a"),ie(Jn.$$.fragment),Ca=h(),bi=m("input"),Ma=h(),gi=m("div");for(let O=0;O<_t.length;O+=1)_t[O].c();$a=h(),rt&&rt.c(),Hs=h(),Et=m("div"),ps=m("strong"),ps.textContent="Debugging",Ta=h(),xn=m("a"),ie(ei.$$.fragment),Sa=h(),ki=m("input"),Na=h(),_s=m("div"),ds=m("label"),Zt=m("input"),Aa=$(" Enable debugging"),Pa=h(),Tt&&Tt.c(),Ea=h(),Fl=m("div"),Ws=m("div"),ti=m("button"),ti.textContent="Factory reset",Da=h(),vs=m("div"),li=m("button"),li.textContent="Reboot",Ia=h(),hs=m("div"),hs.innerHTML='<button type="submit" class="btn-pri">Save</button>',zs=h(),ie(sn.$$.fragment),Gs=h(),ie(on.$$.fragment),Vs=h(),ie(rn.$$.fragment),Ks=h(),ie(an.$$.fragment),r(i,"class","text-sm"),r(a,"href",qt("General-configuration")),r(a,"target","_blank"),r(a,"class","float-right"),r(f,"type","hidden"),r(f,"name","g"),f.value="true",r(S,"name","gh"),r(S,"type","text"),r(S,"class","in-f w-full"),r(S,"pattern","[A-Za-z0-9-]+"),r(L,"name","gt"),r(L,"class","in-l w-full"),t[3].g.t===void 0&&et(()=>t[16].call(L)),r(b,"class","flex"),r(_,"class","my-1"),r(j,"type","hidden"),r(j,"name","p"),j.value="true",re.__value="10YNO-1--------2",re.value=re.__value,ue.__value="10YNO-2--------T",ue.value=ue.__value,we.__value="10YNO-3--------J",we.value=we.__value,me.__value="10YNO-4--------9",me.value=me.__value,Se.__value="10Y1001A1001A48H",Se.value=Se.__value,r(X,"label","Norway"),Oe.__value="10Y1001A1001A44P",Oe.value=Oe.__value,He.__value="10Y1001A1001A45N",He.value=He.__value,ye.__value="10Y1001A1001A46L",ye.value=ye.__value,Ne.__value="10Y1001A1001A47J",Ne.value=Ne.__value,r(je,"label","Sweden"),$e.__value="10YDK-1--------W",$e.value=$e.__value,y.__value="10YDK-2--------M",y.value=y.__value,r(Re,"label","Denmark"),g.__value="10YAT-APG------L",g.value=g.__value,w.__value="10YBE----------2",w.value=w.__value,N.__value="10YCZ-CEPS-----N",N.value=N.__value,I.__value="10Y1001A1001A39I",I.value=I.__value,Q.__value="10YFI-1--------U",Q.value=Q.__value,J.__value="10YFR-RTE------C",J.value=J.__value,se.__value="10Y1001A1001A83F",se.value=se.__value,ce.__value="10YGB----------A",ce.value=ce.__value,ve.__value="10YLV-1001A00074",ve.value=ve.__value,Te.__value="10YLT-1001A0008Q",Te.value=Te.__value,oe.__value="10YNL----------L",oe.value=oe.__value,pe.__value="10YPL-AREA-----S",pe.value=pe.__value,Be.__value="10YCH-SWISSGRIDZ",Be.value=Be.__value,r(Y,"name","pr"),r(Y,"class","in-f w-full"),t[3].p.r===void 0&&et(()=>t[17].call(Y)),r(W,"class","w-full"),r(ct,"name","pc"),r(ct,"class","in-l"),t[3].p.c===void 0&&et(()=>t[18].call(ct)),r(V,"class","flex"),r(G,"class","my-1"),r(Ue,"name","pf"),r(Ue,"type","number"),r(Ue,"min","0.001"),r(Ue,"max","65"),r(Ue,"step","0.001"),r(Ue,"class","in-f tr w-full"),r(ht,"class","w-1/2"),r(Me,"name","pm"),r(Me,"type","number"),r(Me,"min","0.001"),r(Me,"max","1000"),r(Me,"step","0.001"),r(Me,"class","in-l tr w-full"),r(We,"class","w-1/2"),r(Ut,"class","flex"),r(pl,"class","my-1"),r(St,"type","checkbox"),r(St,"name","pe"),St.__value="true",St.value=St.__value,r(St,"class","rounded mb-1"),r(_l,"class","my-1"),Sl.__value=0,Sl.value=Sl.__value,Nl.__value=1,Nl.value=Nl.__value,Al.__value=2,Al.value=Al.__value,r(Nt,"name","gs"),r(Nt,"class","in-s"),t[3].g.s===void 0&&et(()=>t[23].call(Nt)),r(dl,"class","my-1"),r(n,"class","cnt"),r(mt,"class","text-sm"),r(zl,"href",qt("Meter-configuration")),r(zl,"target","_blank"),r(zl,"class","float-right"),r(Gl,"type","hidden"),r(Gl,"name","m"),Gl.value="true",r(Wi,"class","float-right"),r(jt,"name","mi"),jt.__value="true",jt.value=jt.__value,r(jt,"type","checkbox"),r(jt,"class","rounded mb-1"),r(pi,"class","mt-2 ml-3 whitespace-nowrap"),Il.__value=0,Il.value=Il.__value,Il.disabled=zi=t[3].m.b!=0,r(nl,"name","mb"),r(nl,"class","in-f tr w-1/2"),t[3].m.b===void 0&&et(()=>t[27].call(nl)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Gi=t[3].m.b!=0,hn.__value=2,hn.value=hn.__value,bn.__value=3,bn.value=bn.__value,gn.__value=10,gn.value=gn.__value,kn.__value=11,kn.value=kn.__value,r(pt,"name","mp"),r(pt,"class","in-m"),pt.disabled=Vi=t[3].m.b==0,t[3].m.p===void 0&&et(()=>t[28].call(pt)),r(It,"name","ms"),r(It,"type","number"),r(It,"min",64),r(It,"max",4096),r(It,"step",64),r(It,"class","in-l tr w-1/2"),r(Dl,"class","flex w-full"),r(ll,"class","my-1"),wn.__value=2,wn.value=wn.__value,yn.__value=1,yn.value=yn.__value,r(il,"name","md"),r(il,"class","in-s"),t[3].m.d===void 0&&et(()=>t[30].call(il)),r(Vl,"class","my-1"),r(Ht,"name","mf"),r(Ht,"type","number"),r(Ht,"min","5"),r(Ht,"max","65535"),r(Ht,"class","in-f tr w-full"),r(Ki,"class","in-post"),r(Mn,"class","flex"),r(Kl,"class","mx-1"),r(Wt,"name","mr"),r(Wt,"type","number"),r(Wt,"min","0"),r(Wt,"max","65535"),r(Wt,"class","in-f tr w-full"),r(Yi,"class","in-post"),r($n,"class","flex"),r(Yl,"class","mx-1"),r(Cn,"class","my-1 flex"),r(Ds,"class","my-1"),r(zt,"type","checkbox"),r(zt,"name","me"),zt.__value="true",zt.value=zt.__value,r(zt,"class","rounded mb-1"),r(Ql,"class","my-1"),r(Gt,"type","checkbox"),r(Gt,"name","mm"),Gt.__value="true",Gt.value=Gt.__value,r(Gt,"class","rounded mb-1"),r(ke,"class","cnt"),r(Zi,"class","text-sm"),r(Tn,"href",qt("WiFi-configuration")),r(Tn,"target","_blank"),r(Tn,"class","float-right"),r(_i,"type","hidden"),r(_i,"name","w"),_i.value="true",r(vl,"name","ws"),r(vl,"type","text"),r(vl,"class","in-s"),r(Xl,"class","my-1"),r(hl,"name","wp"),r(hl,"type","password"),r(hl,"class","in-s"),r(Zl,"class","my-1"),An.__value=255,An.value=An.__value,Pn.__value=0,Pn.value=Pn.__value,En.__value=1,En.value=En.__value,Dn.__value=2,Dn.value=Dn.__value,r(Ot,"name","wz"),r(Ot,"class","in-s"),t[3].w.z===void 0&&et(()=>t[43].call(Ot)),r(Jl,"class","w-1/2"),r(Rt,"name","ww"),r(Rt,"type","number"),r(Rt,"min","0"),r(Rt,"max","20.5"),r(Rt,"step","0.5"),r(Rt,"class","in-f tr w-full"),r(Ji,"class","in-post"),r(In,"class","flex"),r(xl,"class","ml-2 w-1/2"),r(Nn,"class","my-1 flex"),r(Vt,"type","checkbox"),r(Vt,"name","wa"),Vt.__value="true",Vt.value=Vt.__value,r(Vt,"class","rounded mb-1"),r(xi,"class","my-3"),r(Kt,"type","checkbox"),r(Kt,"name","wb"),Kt.__value="true",Kt.value=Kt.__value,r(Kt,"class","rounded mb-1"),r(ts,"class","my-3"),r(tt,"class","cnt"),r(ns,"class","text-sm"),r(On,"href",qt("Network-configuration")),r(On,"target","_blank"),r(On,"class","float-right"),Ln.__value="dhcp",Ln.value=Ln.__value,Fn.__value="static",Fn.value=Fn.__value,r(sl,"name","nm"),r(sl,"class","in-f"),t[3].n.m===void 0&&et(()=>t[47].call(sl)),r(At,"name","ni"),r(At,"type","text"),r(At,"class","in-m w-full"),At.disabled=is=t[3].n.m=="dhcp",At.required=ss=t[3].n.m=="static",r(Pt,"name","ns"),r(Pt,"class","in-l"),Pt.disabled=os=t[3].n.m=="dhcp",Pt.required=rs=t[3].n.m=="static",t[3].n.s===void 0&&et(()=>t[49].call(Pt)),r(Rl,"class","flex"),r(en,"class","my-1"),r(Yt,"name","nd"),Yt.__value="true",Yt.value=Yt.__value,r(Yt,"type","checkbox"),r(Yt,"class","rounded mb-1"),r(as,"class","my-1"),r(di,"type","hidden"),r(di,"name","ntp"),di.value="true",r(Qt,"name","ntpd"),Qt.__value="true",Qt.value=Qt.__value,r(Qt,"type","checkbox"),r(Qt,"class","rounded mb-1"),r(vi,"class","ml-4"),r(bl,"name","ntph"),r(bl,"type","text"),r(bl,"class","in-s"),r(fs,"class","flex"),r(Ll,"class","my-1"),r(ut,"class","cnt"),r(cs,"class","text-sm"),r(Bn,"href",qt("MQTT-configuration")),r(Bn,"target","_blank"),r(Bn,"class","float-right"),r(hi,"type","hidden"),r(hi,"name","q"),hi.value="true",r(gl,"name","qh"),r(gl,"type","text"),r(gl,"class","in-f w-3/4"),r(Xt,"name","qp"),r(Xt,"type","number"),r(Xt,"min","1024"),r(Xt,"max","65535"),r(Xt,"class","in-l tr w-1/4"),r(jn,"class","flex"),r(ol,"class","my-1"),r(kl,"name","qu"),r(kl,"type","text"),r(kl,"class","in-s"),r(tn,"class","my-1"),r(wl,"name","qa"),r(wl,"type","password"),r(wl,"class","in-s"),r(ln,"class","my-1"),r(yl,"name","qc"),r(yl,"type","text"),r(yl,"class","in-f w-full"),Gn.__value=0,Gn.value=Gn.__value,Vn.__value=1,Vn.value=Vn.__value,Kn.__value=2,Kn.value=Kn.__value,Yn.__value=3,Yn.value=Yn.__value,Qn.__value=4,Qn.value=Qn.__value,Xn.__value=255,Xn.value=Xn.__value,r(bt,"name","qm"),r(bt,"class","in-l"),t[3].q.m===void 0&&et(()=>t[62].call(bt)),r(Hn,"class","my-1 flex"),r(Cl,"name","qb"),r(Cl,"type","text"),r(Cl,"class","in-s"),r(nn,"class","my-1"),r(Ke,"class","cnt"),r(ms,"class","text-sm"),r(Zn,"href",qt("User-interface")),r(Zn,"target","_blank"),r(Zn,"class","float-right"),r(bi,"type","hidden"),r(bi,"name","u"),bi.value="true",r(gi,"class","flex flex-wrap"),r(rl,"class","cnt"),r(ps,"class","text-sm"),r(xn,"href","https://amsleser.no/blog/post/24-telnet-debug"),r(xn,"target","_blank"),r(xn,"class","float-right"),r(ki,"type","hidden"),r(ki,"name","d"),ki.value="true",r(Zt,"type","checkbox"),r(Zt,"name","ds"),Zt.__value="true",Zt.value=Zt.__value,r(Zt,"class","rounded mb-1"),r(_s,"class","mt-3"),r(Et,"class","cnt"),r(l,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),r(ti,"type","button"),r(ti,"class","py-2 px-4 rounded bg-red-500 text-white ml-2"),r(li,"type","button"),r(li,"class","py-2 px-4 rounded bg-yellow-500 text-white"),r(vs,"class","text-center"),r(hs,"class","text-right"),r(Fl,"class","grid grid-cols-3"),r(e,"autocomplete","off")},m(O,ae){M(O,e,ae),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),le(u,a,null),s(n,c),s(n,f),s(n,p),s(n,_),s(_,b),s(b,v),s(v,d),s(v,k),s(v,A),s(v,S),te(S,t[3].g.h),s(b,T),s(b,E),s(E,B),s(E,P),s(E,R),s(E,L),le(F,L,null),qe(L,t[3].g.t,!0),s(n,x),s(n,j),s(n,z),s(n,G),s(G,V),s(V,W),s(W,U),s(W,K),s(W,H),s(W,Y),s(Y,X),s(X,re),s(X,ue),s(X,we),s(X,me),s(X,Se),s(Y,je),s(je,Oe),s(je,He),s(je,ye),s(je,Ne),s(Y,Re),s(Re,$e),s(Re,y),s(Y,g),s(Y,w),s(Y,N),s(Y,I),s(Y,Q),s(Y,J),s(Y,se),s(Y,ce),s(Y,ve),s(Y,Te),s(Y,oe),s(Y,pe),s(Y,Be),qe(Y,t[3].p.r,!0),s(V,_e),s(V,Ce),s(Ce,vt),s(Ce,Hl),s(Ce,tl),s(Ce,ct);for(let ft=0;ft<4;ft+=1)wi[ft]&&wi[ft].m(ct,null);qe(ct,t[3].p.c,!0),s(n,Tl),s(n,pl),s(pl,Ut),s(Ut,ht),s(ht,Ye),s(ht,Qe),s(ht,Xe),s(ht,Ue),te(Ue,t[3].p.f),s(Ut,Ze),s(Ut,We),s(We,Je),s(We,xe),s(We,de),s(We,Me),te(Me,t[3].p.m),s(n,Ii),s(n,_l),s(_l,vn),s(vn,St),St.checked=t[3].p.e,s(vn,Oi),s(_l,Ri),gt&&gt.m(_l,null),s(n,Li),s(n,dl),s(dl,Fi),s(dl,qi),s(dl,Bi),s(dl,Nt),s(Nt,Sl),s(Nt,Nl),s(Nt,Al),qe(Nt,t[3].g.s,!0),s(n,Ui),kt&&kt.m(n,null),s(l,ji),s(l,ke),s(ke,mt),s(ke,Wl),s(ke,zl),le(Pl,zl,null),s(ke,El),s(ke,Gl),s(ke,Hi),s(ke,ll),s(ll,Wi),s(ll,Do),s(ll,Es),s(ll,Io),s(ll,pi),s(pi,jt),jt.checked=t[3].m.i,s(pi,Oo),s(ll,Ro),s(ll,Dl),s(Dl,nl),s(nl,Il),s(Il,Lo);for(let ft=0;ft<7;ft+=1)yi[ft]&&yi[ft].m(nl,null);qe(nl,t[3].m.b,!0),s(Dl,Fo),s(Dl,pt),s(pt,Ol),s(Ol,qo),s(pt,hn),s(pt,bn),s(pt,gn),s(pt,kn),qe(pt,t[3].m.p,!0),s(Dl,Bo),s(Dl,It),te(It,t[3].m.s),s(ke,Uo),s(ke,Vl),s(Vl,jo),s(Vl,Ho),s(Vl,Wo),s(Vl,il),s(il,wn),s(il,yn),qe(il,t[3].m.d,!0),s(ke,zo),s(ke,Cn),s(Cn,Kl),s(Kl,Go),s(Kl,Vo),s(Kl,Ko),s(Kl,Mn),s(Mn,Ht),te(Ht,t[3].m.f),s(Mn,Yo),s(Mn,Ki),s(Cn,Qo),s(Cn,Yl),s(Yl,Xo),s(Yl,Zo),s(Yl,Jo),s(Yl,$n),s($n,Wt),te(Wt,t[3].m.r),s($n,xo),s($n,Yi),s(ke,er),s(ke,Ds),s(ke,tr),s(ke,Ql),s(Ql,Qi),s(Qi,zt),zt.checked=t[3].m.e.e,s(Qi,lr),s(Ql,nr),wt&&wt.m(Ql,null),s(ke,ir),yt&&yt.m(ke,null),s(ke,Is),s(ke,Xi),s(Xi,Gt),Gt.checked=t[3].m.m.e,s(Xi,sr),s(ke,or),Ct&&Ct.m(ke,null),s(l,rr),s(l,tt),s(tt,Zi),s(tt,ar),s(tt,Tn),le(Sn,Tn,null),s(tt,ur),s(tt,_i),s(tt,fr),s(tt,Xl),s(Xl,cr),s(Xl,mr),s(Xl,pr),s(Xl,vl),te(vl,t[3].w.s),s(tt,_r),s(tt,Zl),s(Zl,dr),s(Zl,vr),s(Zl,hr),s(Zl,hl),te(hl,t[3].w.p),s(tt,br),s(tt,Nn),s(Nn,Jl),s(Jl,gr),s(Jl,kr),s(Jl,wr),s(Jl,Ot),s(Ot,An),s(Ot,Pn),s(Ot,En),s(Ot,Dn),qe(Ot,t[3].w.z,!0),s(Nn,yr),s(Nn,xl),s(xl,Cr),s(xl,Mr),s(xl,$r),s(xl,In),s(In,Rt),te(Rt,t[3].w.w),s(In,Tr),s(In,Ji),s(tt,Sr),s(tt,xi),s(xi,es),s(es,Vt),Vt.checked=t[3].w.a,s(es,Nr),s(tt,Ar),s(tt,ts),s(ts,ls),s(ls,Kt),Kt.checked=t[3].w.b,s(ls,Pr),s(l,Er),s(l,ut),s(ut,ns),s(ut,Dr),s(ut,On),le(Rn,On,null),s(ut,Ir),s(ut,en),s(en,Or),s(en,Rr),s(en,Lr),s(en,Rl),s(Rl,sl),s(sl,Ln),s(sl,Fn),qe(sl,t[3].n.m,!0),s(Rl,Fr),s(Rl,At),te(At,t[3].n.i),s(Rl,qr),s(Rl,Pt),le(qn,Pt,null),qe(Pt,t[3].n.s,!0),s(ut,Br),Mt&&Mt.m(ut,null),s(ut,Os),s(ut,as),s(as,us),s(us,Yt),Yt.checked=t[3].n.d,s(us,Ur),s(ut,jr),s(ut,di),s(ut,Hr),s(ut,Ll),s(Ll,Wr),s(Ll,vi),s(vi,Qt),Qt.checked=t[3].n.h,s(vi,zr),s(Ll,Gr),s(Ll,Vr),s(Ll,fs),s(fs,bl),te(bl,t[3].n.n1),s(l,Kr),s(l,Ke),s(Ke,cs),s(Ke,Yr),s(Ke,Bn),le(Un,Bn,null),s(Ke,Qr),s(Ke,hi),s(Ke,Xr),s(Ke,ol),s(ol,Zr),$t&&$t.m(ol,null),s(ol,Rs),s(ol,Jr),s(ol,xr),s(ol,jn),s(jn,gl),te(gl,t[3].q.h),s(jn,ea),s(jn,Xt),te(Xt,t[3].q.p),s(Ke,ta),lt&&lt.m(Ke,null),s(Ke,Ls),s(Ke,tn),s(tn,la),s(tn,na),s(tn,ia),s(tn,kl),te(kl,t[3].q.u),s(Ke,sa),s(Ke,ln),s(ln,oa),s(ln,ra),s(ln,aa),s(ln,wl),te(wl,t[3].q.a),s(Ke,ua),s(Ke,Hn),s(Hn,Wn),s(Wn,fa),s(Wn,ca),s(Wn,ma),s(Wn,yl),te(yl,t[3].q.c),s(Hn,pa),s(Hn,zn),s(zn,_a),s(zn,da),s(zn,va),s(zn,bt),s(bt,Gn),s(bt,Vn),s(bt,Kn),s(bt,Yn),s(bt,Qn),s(bt,Xn),qe(bt,t[3].q.m,!0),s(Ke,ha),s(Ke,nn),s(nn,ba),s(nn,ga),s(nn,ka),s(nn,Cl),te(Cl,t[3].q.b),s(l,wa),nt&&nt.m(l,null),s(l,Fs),it&&it.m(l,null),s(l,qs),st&&st.m(l,null),s(l,Bs),ot&&ot.m(l,null),s(l,js),s(l,rl),s(rl,ms),s(rl,ya),s(rl,Zn),le(Jn,Zn,null),s(rl,Ca),s(rl,bi),s(rl,Ma),s(rl,gi);for(let ft=0;ft<_t.length;ft+=1)_t[ft]&&_t[ft].m(gi,null);s(l,$a),rt&&rt.m(l,null),s(l,Hs),s(l,Et),s(Et,ps),s(Et,Ta),s(Et,xn),le(ei,xn,null),s(Et,Sa),s(Et,ki),s(Et,Na),s(Et,_s),s(_s,ds),s(ds,Zt),Zt.checked=t[3].d.s,s(ds,Aa),s(Et,Pa),Tt&&Tt.m(Et,null),s(e,Ea),s(e,Fl),s(Fl,Ws),s(Ws,ti),s(Fl,Da),s(Fl,vs),s(vs,li),s(Fl,Ia),s(Fl,hs),M(O,zs,ae),le(sn,O,ae),M(O,Gs,ae),le(on,O,ae),M(O,Vs,ae),le(rn,O,ae),M(O,Ks,ae),le(an,O,ae),Jt=!0,Ys||(Oa=[ee(S,"input",t[15]),ee(L,"change",t[16]),ee(Y,"change",t[17]),ee(ct,"change",t[18]),ee(Ue,"input",t[19]),ee(Me,"input",t[20]),ee(St,"change",t[21]),ee(Nt,"change",t[23]),ee(jt,"change",t[26]),ee(nl,"change",t[27]),ee(pt,"change",t[28]),ee(It,"input",t[29]),ee(il,"change",t[30]),ee(Ht,"input",t[31]),ee(Wt,"input",t[32]),ee(zt,"change",t[33]),ee(Gt,"change",t[36]),ee(vl,"input",t[41]),ee(hl,"input",t[42]),ee(Ot,"change",t[43]),ee(Rt,"input",t[44]),ee(Vt,"change",t[45]),ee(Kt,"change",t[46]),ee(sl,"change",t[47]),ee(At,"input",t[48]),ee(Pt,"change",t[49]),ee(Yt,"change",t[53]),ee(Qt,"change",t[54]),ee(bl,"input",t[55]),ee(gl,"input",t[57]),ee(Xt,"input",t[58]),ee(kl,"input",t[59]),ee(wl,"input",t[60]),ee(yl,"input",t[61]),ee(bt,"change",t[62]),ee(Cl,"input",t[63]),ee(Zt,"change",t[93]),ee(ti,"click",t[8]),ee(li,"click",t[10]),ee(e,"submit",As(t[9]))],Ys=!0)},p(O,ae){if(ae[0]&8&&S.value!==O[3].g.h&&te(S,O[3].g.h),ae[0]&8&&qe(L,O[3].g.t),ae[0]&8&&qe(Y,O[3].p.r),ae[0]&8&&qe(ct,O[3].p.c),ae[0]&8&&he(Ue.value)!==O[3].p.f&&te(Ue,O[3].p.f),ae[0]&8&&he(Me.value)!==O[3].p.m&&te(Me,O[3].p.m),ae[0]&8&&(St.checked=O[3].p.e),O[3].p.e&&O[0].chip!="esp8266"?gt?gt.p(O,ae):(gt=cf(O),gt.c(),gt.m(_l,null)):gt&&(gt.d(1),gt=null),ae[0]&8&&qe(Nt,O[3].g.s),O[3].g.s>0?kt?kt.p(O,ae):(kt=mf(O),kt.c(),kt.m(n,null)):kt&&(kt.d(1),kt=null),ae[0]&8&&(jt.checked=O[3].m.i),(!Jt||ae[0]&8&&zi!==(zi=O[3].m.b!=0))&&(Il.disabled=zi),ae[0]&8&&qe(nl,O[3].m.b),(!Jt||ae[0]&8&&Gi!==(Gi=O[3].m.b!=0))&&(Ol.disabled=Gi),(!Jt||ae[0]&8&&Vi!==(Vi=O[3].m.b==0))&&(pt.disabled=Vi),ae[0]&8&&qe(pt,O[3].m.p),ae[0]&8&&he(It.value)!==O[3].m.s&&te(It,O[3].m.s),ae[0]&8&&qe(il,O[3].m.d),ae[0]&8&&he(Ht.value)!==O[3].m.f&&te(Ht,O[3].m.f),ae[0]&8&&he(Wt.value)!==O[3].m.r&&te(Wt,O[3].m.r),ae[0]&8&&(zt.checked=O[3].m.e.e),O[3].m.e.e?wt?wt.p(O,ae):(wt=pf(O),wt.c(),wt.m(Ql,null)):wt&&(wt.d(1),wt=null),O[3].m.e.e?yt?yt.p(O,ae):(yt=_f(O),yt.c(),yt.m(ke,Is)):yt&&(yt.d(1),yt=null),ae[0]&8&&(Gt.checked=O[3].m.m.e),O[3].m.m.e?Ct?Ct.p(O,ae):(Ct=df(O),Ct.c(),Ct.m(ke,null)):Ct&&(Ct.d(1),Ct=null),ae[0]&8&&vl.value!==O[3].w.s&&te(vl,O[3].w.s),ae[0]&8&&hl.value!==O[3].w.p&&te(hl,O[3].w.p),ae[0]&8&&qe(Ot,O[3].w.z),ae[0]&8&&he(Rt.value)!==O[3].w.w&&te(Rt,O[3].w.w),ae[0]&8&&(Vt.checked=O[3].w.a),ae[0]&8&&(Kt.checked=O[3].w.b),ae[0]&8&&qe(sl,O[3].n.m),(!Jt||ae[0]&8&&is!==(is=O[3].n.m=="dhcp"))&&(At.disabled=is),(!Jt||ae[0]&8&&ss!==(ss=O[3].n.m=="static"))&&(At.required=ss),ae[0]&8&&At.value!==O[3].n.i&&te(At,O[3].n.i),(!Jt||ae[0]&8&&os!==(os=O[3].n.m=="dhcp"))&&(Pt.disabled=os),(!Jt||ae[0]&8&&rs!==(rs=O[3].n.m=="static"))&&(Pt.required=rs),ae[0]&8&&qe(Pt,O[3].n.s),O[3].n.m=="static"?Mt?Mt.p(O,ae):(Mt=vf(O),Mt.c(),Mt.m(ut,Os)):Mt&&(Mt.d(1),Mt=null),ae[0]&8&&(Yt.checked=O[3].n.d),ae[0]&8&&(Qt.checked=O[3].n.h),ae[0]&8&&bl.value!==O[3].n.n1&&te(bl,O[3].n.n1),O[0].chip!="esp8266"?$t?$t.p(O,ae):($t=hf(O),$t.c(),$t.m(ol,Rs)):$t&&($t.d(1),$t=null),ae[0]&8&&gl.value!==O[3].q.h&&te(gl,O[3].q.h),ae[0]&8&&he(Xt.value)!==O[3].q.p&&te(Xt,O[3].q.p),O[3].q.s.e?lt?(lt.p(O,ae),ae[0]&8&&D(lt,1)):(lt=bf(O),lt.c(),D(lt,1),lt.m(Ke,Ls)):lt&&(De(),q(lt,1,1,()=>{lt=null}),Ie()),ae[0]&8&&kl.value!==O[3].q.u&&te(kl,O[3].q.u),ae[0]&8&&wl.value!==O[3].q.a&&te(wl,O[3].q.a),ae[0]&8&&yl.value!==O[3].q.c&&te(yl,O[3].q.c),ae[0]&8&&qe(bt,O[3].q.m),ae[0]&8&&Cl.value!==O[3].q.b&&te(Cl,O[3].q.b),O[3].q.m==3?nt?(nt.p(O,ae),ae[0]&8&&D(nt,1)):(nt=gf(O),nt.c(),D(nt,1),nt.m(l,Fs)):nt&&(De(),q(nt,1,1,()=>{nt=null}),Ie()),O[3].q.m==4?it?(it.p(O,ae),ae[0]&8&&D(it,1)):(it=kf(O),it.c(),D(it,1),it.m(l,qs)):it&&(De(),q(it,1,1,()=>{it=null}),Ie()),O[3].c.es!=null?st?(st.p(O,ae),ae[0]&8&&D(st,1)):(st=wf(O),st.c(),D(st,1),st.m(l,Bs)):st&&(De(),q(st,1,1,()=>{st=null}),Ie()),ae[0]&8&&(Us=O[3].p.r.startsWith("10YNO")||O[3].p.r=="10Y1001A1001A48H"),Us?ot?(ot.p(O,ae),ae[0]&8&&D(ot,1)):(ot=Mf(O),ot.c(),D(ot,1),ot.m(l,js)):ot&&(De(),q(ot,1,1,()=>{ot=null}),Ie()),ae[0]&136){ni=O[7];let Lt;for(Lt=0;Lt<ni.length;Lt+=1){const qa=uf(O,ni,Lt);_t[Lt]?_t[Lt].p(qa,ae):(_t[Lt]=Tf(qa),_t[Lt].c(),_t[Lt].m(gi,null))}for(;Lt<_t.length;Lt+=1)_t[Lt].d(1);_t.length=ni.length}O[0].board>20||O[0].chip=="esp8266"?rt?(rt.p(O,ae),ae[0]&1&&D(rt,1)):(rt=Sf(O),rt.c(),D(rt,1),rt.m(l,Hs)):rt&&(De(),q(rt,1,1,()=>{rt=null}),Ie()),ae[0]&8&&(Zt.checked=O[3].d.s),O[3].d.s?Tt?Tt.p(O,ae):(Tt=If(O),Tt.c(),Tt.m(Et,null)):Tt&&(Tt.d(1),Tt=null);const ft={};ae[0]&2&&(ft.active=O[1]),sn.$set(ft);const Ra={};ae[0]&4&&(Ra.active=O[2]),on.$set(Ra);const La={};ae[0]&16&&(La.active=O[4]),rn.$set(La);const Fa={};ae[0]&32&&(Fa.active=O[5]),an.$set(Fa)},i(O){Jt||(D(u.$$.fragment,O),D(F.$$.fragment,O),D(Pl.$$.fragment,O),D(Sn.$$.fragment,O),D(Rn.$$.fragment,O),D(qn.$$.fragment,O),D(Un.$$.fragment,O),D(lt),D(nt),D(it),D(st),D(ot),D(Jn.$$.fragment,O),D(rt),D(ei.$$.fragment,O),D(sn.$$.fragment,O),D(on.$$.fragment,O),D(rn.$$.fragment,O),D(an.$$.fragment,O),Jt=!0)},o(O){q(u.$$.fragment,O),q(F.$$.fragment,O),q(Pl.$$.fragment,O),q(Sn.$$.fragment,O),q(Rn.$$.fragment,O),q(qn.$$.fragment,O),q(Un.$$.fragment,O),q(lt),q(nt),q(it),q(st),q(ot),q(Jn.$$.fragment,O),q(rt),q(ei.$$.fragment,O),q(sn.$$.fragment,O),q(on.$$.fragment,O),q(rn.$$.fragment,O),q(an.$$.fragment,O),Jt=!1},d(O){O&&C(e),ne(u),ne(F),cl(wi,O),gt&&gt.d(),kt&&kt.d(),ne(Pl),cl(yi,O),wt&&wt.d(),yt&&yt.d(),Ct&&Ct.d(),ne(Sn),ne(Rn),ne(qn),Mt&&Mt.d(),ne(Un),$t&&$t.d(),lt&&lt.d(),nt&&nt.d(),it&&it.d(),st&&st.d(),ot&&ot.d(),ne(Jn),cl(_t,O),rt&&rt.d(),ne(ei),Tt&&Tt.d(),O&&C(zs),ne(sn,O),O&&C(Gs),ne(on,O),O&&C(Vs),ne(rn,O),O&&C(Ks),ne(an,O),Ys=!1,ze(Oa)}}}async function Tp(){await(await fetch("/reboot",{method:"POST"})).json()}function Sp(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,a=!1,u={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:""},c:{es:null}};$i.subscribe(ke=>{ke.version&&(l(3,u=ke),l(1,o=!1))}),zm();let c=!1,f=!1;async function p(){if(confirm("Are you sure you want to factory reset the device?")){l(4,c=!0);const ke=new URLSearchParams;ke.append("perform","true");let Wl=await(await fetch("/reset",{method:"POST",body:ke})).json();l(4,c=!1),l(5,f=Wl.success)}}async function _(ke){l(2,a=!0);const mt=new FormData(ke.target),Wl=new URLSearchParams;for(let El of mt){const[Gl,Hi]=El;Wl.append(Gl,Hi)}let Pl=await(await fetch("/save",{method:"POST",body:Wl})).json();Bt.update(El=>(El.booting=Pl.reboot,El.ui=u.u,El)),l(2,a=!1),ai("/")}const b=function(){confirm("Are you sure you want to reboot the device?")&&(Bt.update(ke=>(ke.booting=!0,ke)),Tp())};async function v(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("/mqtt-ca",{method:"POST"})).text(),$i.update(mt=>(mt.q.s.c=!1,mt)))}async function d(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("/mqtt-cert",{method:"POST"})).text(),$i.update(mt=>(mt.q.s.r=!1,mt)))}async function k(){confirm("Are you sure you want to delete key?")&&(await(await fetch("/mqtt-key",{method:"POST"})).text(),$i.update(mt=>(mt.q.s.k=!1,mt)))}const A=function(){u.q.s.e?u.q.p==1883&&l(3,u.q.p=8883,u):u.q.p==8883&&l(3,u.q.p=1883,u)};let S=44;function T(){u.g.h=this.value,l(3,u)}function E(){u.g.t=dt(this),l(3,u)}function B(){u.p.r=dt(this),l(3,u)}function P(){u.p.c=dt(this),l(3,u)}function R(){u.p.f=he(this.value),l(3,u)}function L(){u.p.m=he(this.value),l(3,u)}function F(){u.p.e=this.checked,l(3,u)}function x(){u.p.t=this.value,l(3,u)}function j(){u.g.s=dt(this),l(3,u)}function z(){u.g.u=this.value,l(3,u)}function G(){u.g.p=this.value,l(3,u)}function V(){u.m.i=this.checked,l(3,u)}function W(){u.m.b=dt(this),l(3,u)}function U(){u.m.p=dt(this),l(3,u)}function K(){u.m.s=he(this.value),l(3,u)}function H(){u.m.d=dt(this),l(3,u)}function Y(){u.m.f=he(this.value),l(3,u)}function X(){u.m.r=he(this.value),l(3,u)}function re(){u.m.e.e=this.checked,l(3,u)}function ue(){u.m.e.k=this.value,l(3,u)}function we(){u.m.e.a=this.value,l(3,u)}function me(){u.m.m.e=this.checked,l(3,u)}function Se(){u.m.m.w=he(this.value),l(3,u)}function je(){u.m.m.v=he(this.value),l(3,u)}function Oe(){u.m.m.a=he(this.value),l(3,u)}function He(){u.m.m.c=he(this.value),l(3,u)}function ye(){u.w.s=this.value,l(3,u)}function Ne(){u.w.p=this.value,l(3,u)}function Re(){u.w.z=dt(this),l(3,u)}function $e(){u.w.w=he(this.value),l(3,u)}function y(){u.w.a=this.checked,l(3,u)}function g(){u.w.b=this.checked,l(3,u)}function w(){u.n.m=dt(this),l(3,u)}function N(){u.n.i=this.value,l(3,u)}function I(){u.n.s=dt(this),l(3,u)}function Q(){u.n.g=this.value,l(3,u)}function J(){u.n.d1=this.value,l(3,u)}function se(){u.n.d2=this.value,l(3,u)}function ce(){u.n.d=this.checked,l(3,u)}function ve(){u.n.h=this.checked,l(3,u)}function Te(){u.n.n1=this.value,l(3,u)}function oe(){u.q.s.e=this.checked,l(3,u)}function pe(){u.q.h=this.value,l(3,u)}function Be(){u.q.p=he(this.value),l(3,u)}function _e(){u.q.u=this.value,l(3,u)}function Ce(){u.q.a=this.value,l(3,u)}function vt(){u.q.c=this.value,l(3,u)}function Hl(){u.q.m=dt(this),l(3,u)}function tl(){u.q.b=this.value,l(3,u)}function ct(){u.o.e=this.value,l(3,u)}function Tl(){u.o.c=this.value,l(3,u)}function pl(){u.o.u1=this.value,l(3,u)}function Ut(){u.o.u2=this.value,l(3,u)}function ht(){u.o.u3=this.value,l(3,u)}function Ye(){u.h.t=this.value,l(3,u)}function Qe(){u.h.h=this.value,l(3,u)}function Xe(){u.h.n=this.value,l(3,u)}function Ue(){u.c.es=this.checked,l(3,u)}function Ze(ke){u.t.t[ke]=he(this.value),l(3,u)}function We(){u.t.h=he(this.value),l(3,u)}function Je(ke){u.u[ke.key]=dt(this),l(3,u)}function xe(){u.i.h.u=this.checked,l(3,u)}function de(){u.i.h.p=dt(this),l(3,u)}function Me(){u.i.a=he(this.value),l(3,u)}function Ii(){u.i.l.i=this.checked,l(3,u)}function _l(){u.i.l.p=he(this.value),l(3,u)}function vn(){u.i.r.i=this.checked,l(3,u)}function St(){u.i.r.r=he(this.value),l(3,u)}function Oi(){u.i.r.g=he(this.value),l(3,u)}function Ri(){u.i.r.b=he(this.value),l(3,u)}function Li(){u.i.t.d=he(this.value),l(3,u)}function dl(){u.i.t.a=he(this.value),l(3,u)}function Fi(){u.i.v.p=he(this.value),l(3,u)}function qi(){u.i.v.d.v=he(this.value),l(3,u)}function Bi(){u.i.v.d.g=he(this.value),l(3,u)}function Nt(){u.i.v.o=he(this.value),l(3,u)}function Sl(){u.i.v.m=he(this.value),l(3,u)}function Nl(){u.i.v.b=he(this.value),l(3,u)}function Al(){u.d.s=this.checked,l(3,u)}function Ui(){u.d.t=this.checked,l(3,u)}function ji(){u.d.l=dt(this),l(3,u)}return t.$$set=ke=>{"sysinfo"in ke&&l(0,n=ke.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&l(6,S=n.chip=="esp8266"?16:n.chip=="esp32s2"?44:39)},[n,o,a,u,c,f,S,i,p,_,b,v,d,k,A,T,E,B,P,R,L,F,x,j,z,G,V,W,U,K,H,Y,X,re,ue,we,me,Se,je,Oe,He,ye,Ne,Re,$e,y,g,w,N,I,Q,J,se,ce,ve,Te,oe,pe,Be,_e,Ce,vt,Hl,tl,ct,Tl,pl,Ut,ht,Ye,Qe,Xe,Ue,Ze,We,Je,xe,de,Me,Ii,_l,vn,St,Oi,Ri,Li,dl,Fi,qi,Bi,Nt,Sl,Nl,Al,Ui,ji]}class Np extends Ee{constructor(e){super(),Pe(this,e,Sp,$p,Ae,{sysinfo:0},null,[-1,-1,-1,-1])}}function Rf(t,e,l){const n=t.slice();return n[20]=e[l],n}function Ap(t){let e=be(t[1].chip,t[1].board)+"",l;return{c(){l=$(e)},m(n,i){M(n,l,i)},p(n,i){i&2&&e!==(e=be(n[1].chip,n[1].board)+"")&&Z(l,e)},d(n){n&&C(l)}}}function Lf(t){let e,l,n=t[1].apmac+"",i,o,a,u,c,f,p,_,b,v=tu(t[1])+"",d,k,A=t[1].boot_reason+"",S,T,E=t[1].ex_cause+"",B,P,R;const L=[Ep,Pp],F=[];function x(j,z){return j[0].u>0?0:1}return c=x(t),f=F[c]=L[c](t),{c(){e=m("div"),l=$("AP MAC: "),i=$(n),o=h(),a=m("div"),u=$(`Last boot:
`),f.c(),p=h(),_=m("div"),b=$("Reason: "),d=$(v),k=$(" ("),S=$(A),T=$("/"),B=$(E),P=$(")"),r(e,"class","my-2"),r(a,"class","my-2"),r(_,"class","my-2")},m(j,z){M(j,e,z),s(e,l),s(e,i),M(j,o,z),M(j,a,z),s(a,u),F[c].m(a,null),M(j,p,z),M(j,_,z),s(_,b),s(_,d),s(_,k),s(_,S),s(_,T),s(_,B),s(_,P),R=!0},p(j,z){(!R||z&2)&&n!==(n=j[1].apmac+"")&&Z(i,n);let G=c;c=x(j),c===G?F[c].p(j,z):(De(),q(F[G],1,1,()=>{F[G]=null}),Ie(),f=F[c],f?f.p(j,z):(f=F[c]=L[c](j),f.c()),D(f,1),f.m(a,null)),(!R||z&2)&&v!==(v=tu(j[1])+"")&&Z(d,v),(!R||z&2)&&A!==(A=j[1].boot_reason+"")&&Z(S,A),(!R||z&2)&&E!==(E=j[1].ex_cause+"")&&Z(B,E)},i(j){R||(D(f),R=!0)},o(j){q(f),R=!1},d(j){j&&C(e),j&&C(o),j&&C(a),F[c].d(),j&&C(p),j&&C(_)}}}function Pp(t){let e;return{c(){e=$("-")},m(l,n){M(l,e,n)},p:fe,i:fe,o:fe,d(l){l&&C(e)}}}function Ep(t){let e,l;return e=new Yc({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ie(e.$$.fragment)},m(n,i){le(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||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function Dp(t){let e;return{c(){e=m("span"),e.textContent="Update consents",r(e,"class","btn-pri-sm")},m(l,n){M(l,e,n)},p:fe,d(l){l&&C(e)}}}function Ff(t){let e,l,n,i,o,a=Ss(t[1].meter.mfg)+"",u,c,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",b,v,d,k,A=(t[1].meter.id?t[1].meter.id:"unknown")+"",S;return{c(){e=m("div"),l=m("strong"),l.textContent="Meter",n=h(),i=m("div"),o=$("Manufacturer: "),u=$(a),c=h(),f=m("div"),p=$("Model: "),b=$(_),v=h(),d=m("div"),k=$("ID: "),S=$(A),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(e,"class","cnt")},m(T,E){M(T,e,E),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,p),s(f,b),s(e,v),s(e,d),s(d,k),s(d,S)},p(T,E){E&2&&a!==(a=Ss(T[1].meter.mfg)+"")&&Z(u,a),E&2&&_!==(_=(T[1].meter.model?T[1].meter.model:"unknown")+"")&&Z(b,_),E&2&&A!==(A=(T[1].meter.id?T[1].meter.id:"unknown")+"")&&Z(S,A)},d(T){T&&C(e)}}}function qf(t){let e,l,n,i,o,a=t[1].net.ip+"",u,c,f,p,_=t[1].net.mask+"",b,v,d,k,A=t[1].net.gw+"",S,T,E,B,P=t[1].net.dns1+"",R,L,F=t[1].net.dns2&&Bf(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Network",n=h(),i=m("div"),o=$("IP: "),u=$(a),c=h(),f=m("div"),p=$("Mask: "),b=$(_),v=h(),d=m("div"),k=$("Gateway: "),S=$(A),T=h(),E=m("div"),B=$("DNS: "),R=$(P),L=h(),F&&F.c(),r(l,"class","text-sm"),r(i,"class","my-2"),r(f,"class","my-2"),r(d,"class","my-2"),r(E,"class","my-2"),r(e,"class","cnt")},m(x,j){M(x,e,j),s(e,l),s(e,n),s(e,i),s(i,o),s(i,u),s(e,c),s(e,f),s(f,p),s(f,b),s(e,v),s(e,d),s(d,k),s(d,S),s(e,T),s(e,E),s(E,B),s(E,R),s(E,L),F&&F.m(E,null)},p(x,j){j&2&&a!==(a=x[1].net.ip+"")&&Z(u,a),j&2&&_!==(_=x[1].net.mask+"")&&Z(b,_),j&2&&A!==(A=x[1].net.gw+"")&&Z(S,A),j&2&&P!==(P=x[1].net.dns1+"")&&Z(R,P),x[1].net.dns2?F?F.p(x,j):(F=Bf(x),F.c(),F.m(E,null)):F&&(F.d(1),F=null)},d(x){x&&C(e),F&&F.d()}}}function Bf(t){let e,l=t[1].net.dns2+"",n;return{c(){e=$("/ "),n=$(l)},m(i,o){M(i,e,o),M(i,n,o)},p(i,o){o&2&&l!==(l=i[1].net.dns2+"")&&Z(n,l)},d(i){i&&C(e),i&&C(n)}}}function Uf(t){let e,l,n,i=t[1].upgrade.t+"",o,a,u=t[1].version+"",c,f,p=t[1].upgrade.x+"",_,b,v=t[1].upgrade.e+"",d,k;return{c(){e=m("div"),l=m("div"),n=$("Previous upgrade attempt ("),o=$(i),a=$(") does not match current version ("),c=$(u),f=$(") ["),_=$(p),b=$("/"),d=$(v),k=$("]"),r(l,"class","bd-yellow"),r(e,"class","my-2")},m(A,S){M(A,e,S),s(e,l),s(l,n),s(l,o),s(l,a),s(l,c),s(l,f),s(l,_),s(l,b),s(l,d),s(l,k)},p(A,S){S&2&&i!==(i=A[1].upgrade.t+"")&&Z(o,i),S&2&&u!==(u=A[1].version+"")&&Z(c,u),S&2&&p!==(p=A[1].upgrade.x+"")&&Z(_,p),S&2&&v!==(v=A[1].upgrade.e+"")&&Z(d,v)},d(A){A&&C(e)}}}function jf(t){let e,l,n,i=t[2].tag_name+"",o,a,u,c,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[2]&&t[2].tag_name!=t[1].version&&Hf(t),b=t[1].fwconsent===2&&Wf();return{c(){e=m("div"),l=$(`Latest version:
`),n=m("a"),o=$(i),u=h(),_&&_.c(),c=h(),b&&b.c(),f=Ge(),r(n,"href",a=t[2].html_url),r(n,"class","ml-2 text-blue-600 hover:text-blue-800"),r(n,"target","_blank"),r(n,"rel","noreferrer"),r(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,l),s(e,n),s(n,o),s(e,u),_&&_.m(e,null),M(v,c,d),b&&b.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&4)&&i!==(i=v[2].tag_name+"")&&Z(o,i),(!p||d&4&&a!==(a=v[2].html_url))&&r(n,"href",a),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[2]&&v[2].tag_name!=v[1].version?_?(_.p(v,d),d&7&&D(_,1)):(_=Hf(v),_.c(),D(_,1),_.m(e,null)):_&&(De(),q(_,1,1,()=>{_=null}),Ie()),v[1].fwconsent===2?b||(b=Wf(),b.c(),b.m(f.parentNode,f)):b&&(b.d(1),b=null)},i(v){p||(D(_),p=!0)},o(v){q(_),p=!1},d(v){v&&C(e),_&&_.d(),v&&C(c),b&&b.d(v),v&&C(f)}}}function Hf(t){let e,l,n,i,o,a;return n=new Qc({}),{c(){e=m("div"),l=m("button"),ie(n.$$.fragment),r(e,"class","flex-none ml-2 text-green-500"),r(e,"title","Install this version")},m(u,c){M(u,e,c),s(e,l),le(n,l,null),i=!0,o||(a=ee(l,"click",t[10]),o=!0)},p:fe,i(u){i||(D(n.$$.fragment,u),i=!0)},o(u){q(n.$$.fragment,u),i=!1},d(u){u&&C(e),ne(n),o=!1,a()}}}function Wf(t){let e;return{c(){e=m("div"),e.innerHTML='<div class="bd-yellow">You have disabled one-click firmware upgrade, link to self-upgrade is disabled</div>',r(e,"class","my-2")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function zf(t){let e,l=Ns(be(t[1].chip,t[1].board))+"",n;return{c(){e=m("div"),n=$(l),r(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,n)},p(i,o){o&2&&l!==(l=Ns(be(i[1].chip,i[1].board))+"")&&Z(n,l)},d(i){i&&C(e)}}}function Gf(t){let e,l,n,i,o,a;function u(p,_){return p[4].length==0?Op:Ip}let c=u(t),f=c(t);return{c(){e=m("div"),l=m("form"),n=m("input"),i=h(),f.c(),oc(n,"display","none"),r(n,"name","file"),r(n,"type","file"),r(n,"accept",".bin"),r(l,"action","/firmware"),r(l,"enctype","multipart/form-data"),r(l,"method","post"),r(l,"autocomplete","off"),r(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,l),s(l,n),t[12](n),s(l,i),f.m(l,null),o||(a=[ee(n,"change",t[13]),ee(l,"submit",t[15])],o=!0)},p(p,_){c===(c=u(p))&&f?f.p(p,_):(f.d(1),f=c(p),f&&(f.c(),f.m(l,null)))},d(p){p&&C(e),t[12](null),f.d(),o=!1,ze(a)}}}function Ip(t){let e=t[4][0].name+"",l,n,i;return{c(){l=$(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm float-right")},m(o,a){M(o,l,a),M(o,n,a),M(o,i,a)},p(o,a){a&16&&e!==(e=o[4][0].name+"")&&Z(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Op(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select firmware file for upgrade",r(e,"type","button"),r(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[14]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Vf(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k=t[9],A=[];for(let P=0;P<k.length;P+=1)A[P]=Kf(Rf(t,k,P));let S=t[7].length==0&&Yf();function T(P,R){return P[7].length==0?Lp:Rp}let E=T(t),B=E(t);return{c(){e=m("div"),l=m("strong"),l.textContent="Backup & restore",n=h(),i=m("form"),o=m("div");for(let P=0;P<A.length;P+=1)A[P].c();a=h(),u=m("label"),u.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',c=h(),S&&S.c(),f=h(),p=m("form"),_=m("input"),b=h(),B.c(),r(l,"class","text-sm"),r(u,"class","my-1 mx-3 col-span-2"),r(o,"class","grid grid-cols-2"),r(i,"method","get"),r(i,"action","/configfile.cfg"),r(i,"autocomplete","off"),oc(_,"display","none"),r(_,"name","file"),r(_,"type","file"),r(_,"accept",".cfg"),r(p,"action","/configfile"),r(p,"enctype","multipart/form-data"),r(p,"method","post"),r(p,"autocomplete","off"),r(e,"class","cnt")},m(P,R){M(P,e,R),s(e,l),s(e,n),s(e,i),s(i,o);for(let L=0;L<A.length;L+=1)A[L]&&A[L].m(o,null);s(o,a),s(o,u),s(i,c),S&&S.m(i,null),s(e,f),s(e,p),s(p,_),t[16](_),s(p,b),B.m(p,null),v||(d=[ee(_,"change",t[17]),ee(p,"submit",t[19])],v=!0)},p(P,R){if(R&512){k=P[9];let L;for(L=0;L<k.length;L+=1){const F=Rf(P,k,L);A[L]?A[L].p(F,R):(A[L]=Kf(F),A[L].c(),A[L].m(o,a))}for(;L<A.length;L+=1)A[L].d(1);A.length=k.length}P[7].length==0?S||(S=Yf(),S.c(),S.m(i,null)):S&&(S.d(1),S=null),E===(E=T(P))&&B?B.p(P,R):(B.d(1),B=E(P),B&&(B.c(),B.m(p,null)))},d(P){P&&C(e),cl(A,P),S&&S.d(),t[16](null),B.d(),v=!1,ze(d)}}}function Kf(t){let e,l,n,i=t[20].name+"",o;return{c(){e=m("label"),l=m("input"),n=h(),o=$(i),r(l,"type","checkbox"),r(l,"class","rounded"),r(l,"name",t[20].key),l.value="true",l.checked=!0,r(e,"class","my-1 mx-3")},m(a,u){M(a,e,u),s(e,l),s(e,n),s(e,o)},p:fe,d(a){a&&C(e)}}}function Yf(t){let e;return{c(){e=m("button"),e.textContent="Download",r(e,"type","submit"),r(e,"class","btn-pri-sm float-right")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Rp(t){let e=t[7][0].name+"",l,n,i;return{c(){l=$(e),n=h(),i=m("button"),i.textContent="Upload",r(i,"type","submit"),r(i,"class","btn-pri-sm")},m(o,a){M(o,l,a),M(o,n,a),M(o,i,a)},p(o,a){a&128&&e!==(e=o[7][0].name+"")&&Z(l,e)},d(o){o&&C(l),o&&C(n),o&&C(i)}}}function Lp(t){let e,l,n;return{c(){e=m("button"),e.textContent="Select file...",r(e,"type","button"),r(e,"class","btn-pri-sm")},m(i,o){M(i,e,o),l||(n=ee(e,"click",t[18]),l=!0)},p:fe,d(i){i&&C(e),l=!1,n()}}}function Fp(t){let e,l,n,i,o,a,u=t[1].chip+"",c,f,p=t[1].cpu+"",_,b,v,d,k,A,S,T,E,B=t[1].mac+"",P,R,L,F,x,j,z,G,V,W,U,K,H,Y,X,re=t[1].version+"",ue,we,me,Se,je=(t[1].security==0||t[0].a)&&ui(t[1].board),Oe,He,ye,Ne,Re,$e,y,g,w;A=new el({props:{to:"/vendor",$$slots:{default:[Ap]},$$scope:{ctx:t}}});let N=t[1].apmac&&t[1].apmac!=t[1].mac&&Lf(t);x=new el({props:{to:"/consent",$$slots:{default:[Dp]},$$scope:{ctx:t}}});let I=t[1].meter&&Ff(t),Q=t[1].net&&qf(t),J=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&Uf(t),se=t[2]&&jf(t),ce=je&&zf(t),ve=(t[1].security==0||t[0].a)&&Gf(t),Te=(t[1].security==0||t[0].a)&&Vf(t);return Ne=new Dt({props:{active:t[5],message:"Uploading firmware, please wait"}}),$e=new Dt({props:{active:t[8],message:"Uploading configuration, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),n.textContent="Device information",i=h(),o=m("div"),a=$("Chip: "),c=$(u),f=$(" ("),_=$(p),b=$("MHz)"),v=h(),d=m("div"),k=$("Device: "),ie(A.$$.fragment),S=h(),T=m("div"),E=$("MAC: "),P=$(B),R=h(),N&&N.c(),L=h(),F=m("div"),ie(x.$$.fragment),j=h(),z=m("button"),z.textContent="Reboot",G=h(),I&&I.c(),V=h(),Q&&Q.c(),W=h(),U=m("div"),K=m("strong"),K.textContent="Firmware",H=h(),Y=m("div"),X=$("Installed version: "),ue=$(re),we=h(),J&&J.c(),me=h(),se&&se.c(),Se=h(),ce&&ce.c(),Oe=h(),ve&&ve.c(),He=h(),Te&&Te.c(),ye=h(),ie(Ne.$$.fragment),Re=h(),ie($e.$$.fragment),r(n,"class","text-sm"),r(o,"class","my-2"),r(d,"class","my-2"),r(T,"class","my-2"),r(z,"class","text-xs py-1 px-2 rounded bg-yellow-500 text-white mr-3 float-right"),r(F,"class","my-2"),r(l,"class","cnt"),r(K,"class","text-sm"),r(Y,"class","my-2"),r(U,"class","cnt"),r(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(oe,pe){M(oe,e,pe),s(e,l),s(l,n),s(l,i),s(l,o),s(o,a),s(o,c),s(o,f),s(o,_),s(o,b),s(l,v),s(l,d),s(d,k),le(A,d,null),s(l,S),s(l,T),s(T,E),s(T,P),s(l,R),N&&N.m(l,null),s(l,L),s(l,F),le(x,F,null),s(F,j),s(F,z),s(e,G),I&&I.m(e,null),s(e,V),Q&&Q.m(e,null),s(e,W),s(e,U),s(U,K),s(U,H),s(U,Y),s(Y,X),s(Y,ue),s(U,we),J&&J.m(U,null),s(U,me),se&&se.m(U,null),s(U,Se),ce&&ce.m(U,null),s(U,Oe),ve&&ve.m(U,null),s(e,He),Te&&Te.m(e,null),M(oe,ye,pe),le(Ne,oe,pe),M(oe,Re,pe),le($e,oe,pe),y=!0,g||(w=ee(z,"click",t[11]),g=!0)},p(oe,[pe]){(!y||pe&2)&&u!==(u=oe[1].chip+"")&&Z(c,u),(!y||pe&2)&&p!==(p=oe[1].cpu+"")&&Z(_,p);const Be={};pe&8388610&&(Be.$$scope={dirty:pe,ctx:oe}),A.$set(Be),(!y||pe&2)&&B!==(B=oe[1].mac+"")&&Z(P,B),oe[1].apmac&&oe[1].apmac!=oe[1].mac?N?(N.p(oe,pe),pe&2&&D(N,1)):(N=Lf(oe),N.c(),D(N,1),N.m(l,L)):N&&(De(),q(N,1,1,()=>{N=null}),Ie());const _e={};pe&8388608&&(_e.$$scope={dirty:pe,ctx:oe}),x.$set(_e),oe[1].meter?I?I.p(oe,pe):(I=Ff(oe),I.c(),I.m(e,V)):I&&(I.d(1),I=null),oe[1].net?Q?Q.p(oe,pe):(Q=qf(oe),Q.c(),Q.m(e,W)):Q&&(Q.d(1),Q=null),(!y||pe&2)&&re!==(re=oe[1].version+"")&&Z(ue,re),oe[1].upgrade.t&&oe[1].upgrade.t!=oe[1].version?J?J.p(oe,pe):(J=Uf(oe),J.c(),J.m(U,me)):J&&(J.d(1),J=null),oe[2]?se?(se.p(oe,pe),pe&4&&D(se,1)):(se=jf(oe),se.c(),D(se,1),se.m(U,Se)):se&&(De(),q(se,1,1,()=>{se=null}),Ie()),pe&3&&(je=(oe[1].security==0||oe[0].a)&&ui(oe[1].board)),je?ce?ce.p(oe,pe):(ce=zf(oe),ce.c(),ce.m(U,Oe)):ce&&(ce.d(1),ce=null),oe[1].security==0||oe[0].a?ve?ve.p(oe,pe):(ve=Gf(oe),ve.c(),ve.m(U,null)):ve&&(ve.d(1),ve=null),oe[1].security==0||oe[0].a?Te?Te.p(oe,pe):(Te=Vf(oe),Te.c(),Te.m(e,null)):Te&&(Te.d(1),Te=null);const Ce={};pe&32&&(Ce.active=oe[5]),Ne.$set(Ce);const vt={};pe&256&&(vt.active=oe[8]),$e.$set(vt)},i(oe){y||(D(A.$$.fragment,oe),D(N),D(x.$$.fragment,oe),D(se),D(Ne.$$.fragment,oe),D($e.$$.fragment,oe),y=!0)},o(oe){q(A.$$.fragment,oe),q(N),q(x.$$.fragment,oe),q(se),q(Ne.$$.fragment,oe),q($e.$$.fragment,oe),y=!1},d(oe){oe&&C(e),ne(A),N&&N.d(),ne(x),I&&I.d(),Q&&Q.d(),J&&J.d(),se&&se.d(),ce&&ce.d(),ve&&ve.d(),Te&&Te.d(),oe&&C(ye),ne(Ne,oe),oe&&C(Re),ne($e,oe),g=!1,w()}}}async function qp(){await(await fetch("/reboot",{method:"POST"})).json()}function Bp(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"}],a={};Ao.subscribe(L=>{l(2,a=Kc(i.version,L)),a||l(2,a=L[0])});function u(){confirm("Do you want to upgrade this device to "+a.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ns(be(i.chip,i.board))))&&(Bt.update(L=>(L.upgrading=!0,L)),Vc(a.tag_name))}const c=function(){confirm("Are you sure you want to reboot the device?")&&(Bt.update(L=>(L.booting=!0,L)),qp())};let f,p=[],_=!1,b,v=[],d=!1;$o();function k(L){$s[L?"unshift":"push"](()=>{f=L,l(3,f)})}function A(){p=this.files,l(4,p)}const S=()=>{f.click()},T=()=>l(5,_=!0);function E(L){$s[L?"unshift":"push"](()=>{b=L,l(6,b)})}function B(){v=this.files,l(7,v)}const P=()=>{b.click()},R=()=>l(8,d=!0);return t.$$set=L=>{"data"in L&&l(0,n=L.data),"sysinfo"in L&&l(1,i=L.sysinfo)},[n,i,a,f,p,_,b,v,d,o,u,c,k,A,S,T,E,B,P,R]}class Up extends Ee{constructor(e){super(),Pe(this,e,Bp,Fp,Ae,{data:0,sysinfo:1})}}function Qf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],5)+"",u,c,f=be(t[0],4)+"",p,_,b=be(t[0],3)+"",v,d,k,A,S=be(t[0],2)+"",T,E,B=be(t[0],1)+"",P,R,L=be(t[0],0)+"",F,x,j,z,G=be(t[0],101)+"",V,W,U=be(t[0],100)+"",K;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),u=$(a),c=m("option"),p=$(f),_=m("option"),v=$(b),d=h(),k=m("optgroup"),A=m("option"),T=$(S),E=m("option"),P=$(B),R=m("option"),F=$(L),x=h(),j=m("optgroup"),z=m("option"),V=$(G),W=m("option"),K=$(U),l.__value=7,l.value=l.__value,o.__value=5,o.value=o.__value,c.__value=4,c.value=c.__value,_.__value=3,_.value=_.__value,r(e,"label","amsleser.no"),A.__value=2,A.value=A.__value,E.__value=1,E.value=E.__value,R.__value=0,R.value=R.__value,r(k,"label","Custom hardware"),z.__value=101,z.value=z.__value,W.__value=100,W.value=W.__value,r(j,"label","Generic hardware")},m(H,Y){M(H,e,Y),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,p),s(e,_),s(_,v),M(H,d,Y),M(H,k,Y),s(k,A),s(A,T),s(k,E),s(E,P),s(k,R),s(R,F),M(H,x,Y),M(H,j,Y),s(j,z),s(z,V),s(j,W),s(W,K)},p(H,Y){Y&1&&n!==(n=be(H[0],7)+"")&&Z(i,n),Y&1&&a!==(a=be(H[0],5)+"")&&Z(u,a),Y&1&&f!==(f=be(H[0],4)+"")&&Z(p,f),Y&1&&b!==(b=be(H[0],3)+"")&&Z(v,b),Y&1&&S!==(S=be(H[0],2)+"")&&Z(T,S),Y&1&&B!==(B=be(H[0],1)+"")&&Z(P,B),Y&1&&L!==(L=be(H[0],0)+"")&&Z(F,L),Y&1&&G!==(G=be(H[0],101)+"")&&Z(V,G),Y&1&&U!==(U=be(H[0],100)+"")&&Z(K,U)},d(H){H&&C(e),H&&C(d),H&&C(k),H&&C(x),H&&C(j)}}}function Xf(t){let e,l,n=be(t[0],201)+"",i,o,a=be(t[0],202)+"",u,c,f=be(t[0],203)+"",p,_,b=be(t[0],200)+"",v;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),u=$(a),c=m("option"),p=$(f),_=m("option"),v=$(b),l.__value=201,l.value=l.__value,o.__value=202,o.value=o.__value,c.__value=203,c.value=c.__value,_.__value=200,_.value=_.__value,r(e,"label","Generic hardware")},m(d,k){M(d,e,k),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,p),s(e,_),s(_,v)},p(d,k){k&1&&n!==(n=be(d[0],201)+"")&&Z(i,n),k&1&&a!==(a=be(d[0],202)+"")&&Z(u,a),k&1&&f!==(f=be(d[0],203)+"")&&Z(p,f),k&1&&b!==(b=be(d[0],200)+"")&&Z(v,b)},d(d){d&&C(e)}}}function Zf(t){let e,l,n=be(t[0],7)+"",i,o,a=be(t[0],6)+"",u,c,f=be(t[0],5)+"",p,_,b,v,d=be(t[0],51)+"",k,A,S=be(t[0],50)+"",T;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=m("option"),u=$(a),c=m("option"),p=$(f),_=h(),b=m("optgroup"),v=m("option"),k=$(d),A=m("option"),T=$(S),l.__value=7,l.value=l.__value,o.__value=6,o.value=o.__value,c.__value=5,c.value=c.__value,r(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,A.__value=50,A.value=A.__value,r(b,"label","Generic hardware")},m(E,B){M(E,e,B),s(e,l),s(l,i),s(e,o),s(o,u),s(e,c),s(c,p),M(E,_,B),M(E,b,B),s(b,v),s(v,k),s(b,A),s(A,T)},p(E,B){B&1&&n!==(n=be(E[0],7)+"")&&Z(i,n),B&1&&a!==(a=be(E[0],6)+"")&&Z(u,a),B&1&&f!==(f=be(E[0],5)+"")&&Z(p,f),B&1&&d!==(d=be(E[0],51)+"")&&Z(k,d),B&1&&S!==(S=be(E[0],50)+"")&&Z(T,S)},d(E){E&&C(e),E&&C(_),E&&C(b)}}}function Jf(t){let e,l,n=be(t[0],8)+"",i,o,a,u,c=be(t[0],71)+"",f,p,_=be(t[0],70)+"",b;return{c(){e=m("optgroup"),l=m("option"),i=$(n),o=h(),a=m("optgroup"),u=m("option"),f=$(c),p=m("option"),b=$(_),l.__value=8,l.value=l.__value,r(e,"label","Custom hardware"),u.__value=71,u.value=u.__value,p.__value=70,p.value=p.__value,r(a,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,l),s(l,i),M(v,o,d),M(v,a,d),s(a,u),s(u,f),s(a,p),s(p,b)},p(v,d){d&1&&n!==(n=be(v[0],8)+"")&&Z(i,n),d&1&&c!==(c=be(v[0],71)+"")&&Z(f,c),d&1&&_!==(_=be(v[0],70)+"")&&Z(b,_)},d(v){v&&C(e),v&&C(o),v&&C(a)}}}function xf(t){let e,l,n=be(t[0],200)+"",i;return{c(){e=m("optgroup"),l=m("option"),i=$(n),l.__value=200,l.value=l.__value,r(e,"label","Generic hardware")},m(o,a){M(o,e,a),s(e,l),s(l,i)},p(o,a){a&1&&n!==(n=be(o[0],200)+"")&&Z(i,n)},d(o){o&&C(e)}}}function jp(t){let e,l,n,i,o,a,u,c=t[0]=="esp8266"&&Qf(t),f=t[0]=="esp32"&&Xf(t),p=t[0]=="esp32s2"&&Zf(t),_=t[0]=="esp32c3"&&Jf(t),b=t[0]=="esp32solo"&&xf(t);return{c(){e=m("option"),l=h(),c&&c.c(),n=h(),f&&f.c(),i=h(),p&&p.c(),o=h(),_&&_.c(),a=h(),b&&b.c(),u=Ge(),e.__value=-1,e.value=e.__value},m(v,d){M(v,e,d),M(v,l,d),c&&c.m(v,d),M(v,n,d),f&&f.m(v,d),M(v,i,d),p&&p.m(v,d),M(v,o,d),_&&_.m(v,d),M(v,a,d),b&&b.m(v,d),M(v,u,d)},p(v,[d]){v[0]=="esp8266"?c?c.p(v,d):(c=Qf(v),c.c(),c.m(n.parentNode,n)):c&&(c.d(1),c=null),v[0]=="esp32"?f?f.p(v,d):(f=Xf(v),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null),v[0]=="esp32s2"?p?p.p(v,d):(p=Zf(v),p.c(),p.m(o.parentNode,o)):p&&(p.d(1),p=null),v[0]=="esp32c3"?_?_.p(v,d):(_=Jf(v),_.c(),_.m(a.parentNode,a)):_&&(_.d(1),_=null),v[0]=="esp32solo"?b?b.p(v,d):(b=xf(v),b.c(),b.m(u.parentNode,u)):b&&(b.d(1),b=null)},i:fe,o:fe,d(v){v&&C(e),v&&C(l),c&&c.d(v),v&&C(n),f&&f.d(v),v&&C(i),p&&p.d(v),v&&C(o),_&&_.d(v),v&&C(a),b&&b.d(v),v&&C(u)}}}function Hp(t,e,l){let{chip:n}=e;return t.$$set=i=>{"chip"in i&&l(0,n=i.chip)},[n]}class Wp extends Ee{constructor(e){super(),Pe(this,e,Hp,jp,Ae,{chip:0})}}function ec(t){let e;return{c(){e=m("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",r(e,"class","bd-red")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function tc(t){let e,l,n,i,o,a,u;return a=new Zc({props:{chip:t[0].chip}}),{c(){e=m("div"),l=$("HAN GPIO"),n=m("br"),i=h(),o=m("select"),ie(a.$$.fragment),r(o,"name","vh"),r(o,"class","in-s"),r(e,"class","my-3")},m(c,f){M(c,e,f),s(e,l),s(e,n),s(e,i),s(e,o),le(a,o,null),u=!0},p(c,f){const p={};f&1&&(p.chip=c[0].chip),a.$set(p)},i(c){u||(D(a.$$.fragment,c),u=!0)},o(c){q(a.$$.fragment,c),u=!1},d(c){c&&C(e),ne(a)}}}function zp(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W=t[0].usrcfg&&ec();d=new Wp({props:{chip:t[0].chip}});let U=t[0].board&&t[0].board>20&&tc(t);return j=new Dt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Initial configuration",u=h(),W&&W.c(),c=h(),f=m("div"),p=$("Board type"),_=m("br"),b=h(),v=m("select"),ie(d.$$.fragment),k=h(),U&&U.c(),A=h(),S=m("div"),T=m("label"),E=m("input"),B=$(" Clear all other configuration"),P=h(),R=m("div"),R.innerHTML='<button type="submit" class="btn-pri">Save</button>',L=h(),F=m("span"),F.textContent=" ",x=h(),ie(j.$$.fragment),r(i,"type","hidden"),r(i,"name","v"),i.value="true",r(a,"class","text-sm"),r(v,"name","vb"),r(v,"class","in-s"),t[0].board===void 0&&et(()=>t[4].call(v)),r(f,"class","my-3"),r(E,"type","checkbox"),r(E,"name","vr"),E.__value="true",E.value=E.__value,r(E,"class","rounded mb-1"),r(S,"class","my-3"),r(R,"class","my-3"),r(F,"class","clear-both"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),W&&W.m(n,null),s(n,c),s(n,f),s(f,p),s(f,_),s(f,b),s(f,v),le(d,v,null),qe(v,t[0].board,!0),s(n,k),U&&U.m(n,null),s(n,A),s(n,S),s(S,T),s(T,E),E.checked=t[2],s(T,B),s(n,P),s(n,R),s(n,L),s(n,F),M(K,x,H),le(j,K,H),z=!0,G||(V=[ee(v,"change",t[4]),ee(E,"change",t[5]),ee(n,"submit",As(t[3]))],G=!0)},p(K,[H]){K[0].usrcfg?W||(W=ec(),W.c(),W.m(n,c)):W&&(W.d(1),W=null);const Y={};H&1&&(Y.chip=K[0].chip),d.$set(Y),H&1&&qe(v,K[0].board),K[0].board&&K[0].board>20?U?(U.p(K,H),H&1&&D(U,1)):(U=tc(K),U.c(),D(U,1),U.m(n,A)):U&&(De(),q(U,1,1,()=>{U=null}),Ie()),H&4&&(E.checked=K[2]);const X={};H&2&&(X.active=K[1]),j.$set(X)},i(K){z||(D(d.$$.fragment,K),D(U),D(j.$$.fragment,K),z=!0)},o(K){q(d.$$.fragment,K),q(U),q(j.$$.fragment,K),z=!1},d(K){K&&C(e),W&&W.d(),ne(d),U&&U.d(),K&&C(x),ne(j,K),G=!1,ze(V)}}}function Gp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(f){l(1,i=!0);const p=new FormData(f.target),_=new URLSearchParams;for(let d of p){const[k,A]=d;_.append(k,A)}let v=await(await fetch("/save",{method:"POST",body:_})).json();l(1,i=!1),Bt.update(d=>(d.vndcfg=v.success,d.booting=v.reboot,d)),ai(n.usrcfg?"/":"/setup")}let a=!1;function u(){n.board=dt(this),l(0,n)}function c(){a=this.checked,l(2,a),l(0,n)}return t.$$set=f=>{"sysinfo"in f&&l(0,n=f.sysinfo)},t.$$.update=()=>{t.$$.dirty&1&&l(2,a=!n.usrcfg)},[n,i,a,o,u,c]}class Vp extends Ee{constructor(e){super(),Pe(this,e,Gp,zp,Ae,{sysinfo:0})}}function lc(t){let e,l,n,i,o,a,u,c;return u=new Jc({}),{c(){e=m("br"),l=h(),n=m("div"),i=m("input"),o=h(),a=m("select"),ie(u.$$.fragment),r(i,"name","si"),r(i,"type","text"),r(i,"class","in-f w-full"),i.required=t[1],r(a,"name","su"),r(a,"class","in-l"),a.required=t[1],r(n,"class","flex")},m(f,p){M(f,e,p),M(f,l,p),M(f,n,p),s(n,i),s(n,o),s(n,a),le(u,a,null),c=!0},p(f,p){(!c||p&2)&&(i.required=f[1]),(!c||p&2)&&(a.required=f[1])},i(f){c||(D(u.$$.fragment,f),c=!0)},o(f){q(u.$$.fragment,f),c=!1},d(f){f&&C(e),f&&C(l),f&&C(n),ne(u)}}}function nc(t){let e;return{c(){e=m("div"),e.innerHTML=`<div>Gateway<br/>
<input name="sg" type="text" class="in-f w-full"/></div>
<div>DNS<br/>
<input name="sd" type="text" class="in-l w-full"/></div>`,r(e,"class","my-3 flex")},m(l,n){M(l,e,n)},d(l){l&&C(e)}}}function Kp(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V=t[1]&&lc(t),W=t[1]&&nc();return x=new Dt({props:{active:t[2],message:"Saving your configuration to the device"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("input"),o=h(),a=m("strong"),a.textContent="Setup",u=h(),c=m("div"),c.innerHTML=`SSID<br/>
<input name="ss" type="text" class="in-s" required=""/>`,f=h(),p=m("div"),p.innerHTML=`PSK<br/>
<input name="sp" type="password" class="in-s" autocomplete="off"/>`,_=h(),b=m("div"),v=$(`Hostname
`),d=m("input"),k=h(),A=m("div"),S=m("label"),T=m("input"),E=$(" Static IP"),B=h(),V&&V.c(),P=h(),W&&W.c(),R=h(),L=m("div"),L.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=h(),ie(x.$$.fragment),r(i,"type","hidden"),r(i,"name","s"),i.value="true",r(a,"class","text-sm"),r(c,"class","my-3"),r(p,"class","my-3"),r(d,"name","sh"),r(d,"type","text"),r(d,"class","in-s"),r(d,"maxlength","32"),r(d,"pattern","[a-z0-9_-]+"),r(d,"placeholder","Optional, ex.: ams-reader"),r(d,"autocomplete","off"),r(T,"type","checkbox"),r(T,"name","sm"),T.__value="static",T.value=T.__value,r(T,"class","rounded mb-1"),r(A,"class","my-3"),r(L,"class","my-3"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(U,K){M(U,e,K),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(n,f),s(n,p),s(n,_),s(n,b),s(b,v),s(b,d),te(d,t[0].hostname),s(n,k),s(n,A),s(A,S),s(S,T),T.checked=t[1],s(S,E),s(A,B),V&&V.m(A,null),s(n,P),W&&W.m(n,null),s(n,R),s(n,L),M(U,F,K),le(x,U,K),j=!0,z||(G=[ee(d,"input",t[4]),ee(T,"change",t[5]),ee(n,"submit",As(t[3]))],z=!0)},p(U,[K]){K&1&&d.value!==U[0].hostname&&te(d,U[0].hostname),K&2&&(T.checked=U[1]),U[1]?V?(V.p(U,K),K&2&&D(V,1)):(V=lc(U),V.c(),D(V,1),V.m(A,null)):V&&(De(),q(V,1,1,()=>{V=null}),Ie()),U[1]?W||(W=nc(),W.c(),W.m(n,R)):W&&(W.d(1),W=null);const H={};K&4&&(H.active=U[2]),x.$set(H)},i(U){j||(D(V),D(x.$$.fragment,U),j=!0)},o(U){q(V),q(x.$$.fragment,U),j=!1},d(U){U&&C(e),V&&V.d(),W&&W.d(),U&&C(F),ne(x,U),z=!1,ze(G)}}}function Yp(t,e,l){let{sysinfo:n={}}=e,i=!1,o=!1,a=0;function u(){var _="";a++;var b=function(){setTimeout(u,1e3)};if(n.net.ip&&a%3==0){if(!n.net.ip){b();return}_="http://"+n.net.ip}else n.hostname&&a%3==1?_="http://"+n.hostname:n.hostname&&a%3==2?_="http://"+n.hostname+".local":_="";console&&console.log("Trying url "+_),Bt.update(d=>(d.trying=_,d));var v=new XMLHttpRequest;v.timeout=5e3,v.addEventListener("abort",b),v.addEventListener("error",b),v.addEventListener("timeout",b),v.addEventListener("load",function(d){window.location.href=_||"/"}),v.open("GET",_+"/is-alive",!0),v.send()}async function c(_){l(2,o=!0);const b=new FormData(_.target),v=new URLSearchParams;for(let A of b){const[S,T]=A;v.append(S,T)}let k=await(await fetch("/save",{method:"POST",body:v})).json();l(2,o=!1),Bt.update(A=>(A.hostname=b.get("sh"),A.usrcfg=k.success,A.booting=k.reboot,i&&(A.net.ip=b.get("si"),A.net.mask=b.get("su"),A.net.gw=b.get("sg"),A.net.dns1=b.get("sd")),setTimeout(u,5e3),A))}function f(){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,c,f,p]}class Qp extends Ee{constructor(e){super(),Pe(this,e,Yp,Kp,Ae,{sysinfo:0})}}function Xp(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S;return d=new Dt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=m("div"),l=m("div"),n=m("strong"),i=$("Upload "),o=$(t[1]),a=h(),u=m("p"),u.textContent="Select a suitable file and click upload",c=h(),f=m("form"),p=m("input"),_=h(),b=m("div"),b.innerHTML='<button type="submit" class="btn-pri">Upload</button>',v=h(),ie(d.$$.fragment),r(u,"class","mb-4"),r(p,"name","file"),r(p,"type","file"),r(b,"class","w-full text-right mt-4"),r(f,"action",t[0]),r(f,"enctype","multipart/form-data"),r(f,"method","post"),r(f,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(T,E){M(T,e,E),s(e,l),s(l,n),s(n,i),s(n,o),s(l,a),s(l,u),s(l,c),s(l,f),s(f,p),s(f,_),s(f,b),M(T,v,E),le(d,T,E),k=!0,A||(S=ee(f,"submit",t[3]),A=!0)},p(T,[E]){(!k||E&2)&&Z(o,T[1]),(!k||E&1)&&r(f,"action",T[0]);const B={};E&4&&(B.active=T[2]),d.$set(B)},i(T){k||(D(d.$$.fragment,T),k=!0)},o(T){q(d.$$.fragment,T),k=!1},d(T){T&&C(e),T&&C(v),ne(d,T),A=!1,S()}}}function Zp(t,e,l){let{action:n}=e,{title:i}=e,o=!1;const a=()=>l(2,o=!0);return t.$$set=u=>{"action"in u&&l(0,n=u.action),"title"in u&&l(1,i=u.title)},[n,i,o,a]}class Eo extends Ee{constructor(e){super(),Pe(this,e,Zp,Xp,Ae,{action:0,title:1})}}function Jp(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B,P,R,L,F,x,j,z,G,V,W,U;return G=new Dt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=m("div"),l=m("div"),n=m("form"),i=m("div"),i.textContent="Various permissions we need to do stuff:",o=h(),a=m("hr"),u=h(),c=m("div"),f=$("Enable one-click upgrade? (implies data collection)"),p=m("br"),_=h(),b=m("a"),v=$("Read more"),d=m("br"),k=h(),A=m("label"),S=m("input"),E=$(" Yes"),B=m("label"),P=m("input"),L=$(" No"),F=m("br"),x=h(),j=m("div"),j.innerHTML='<button type="submit" class="btn-pri">Save</button>',z=h(),ie(G.$$.fragment),r(b,"href",qt("Data-collection-on-one-click-firmware-upgrade")),r(b,"target","_blank"),r(b,"class","text-blue-600 hover:text-blue-800"),r(S,"type","radio"),r(S,"name","sf"),S.value=1,S.checked=T=t[0].fwconsent===1,r(S,"class","rounded m-2"),S.required=!0,r(P,"type","radio"),r(P,"name","sf"),P.value=2,P.checked=R=t[0].fwconsent===2,r(P,"class","rounded m-2"),P.required=!0,r(c,"class","my-3"),r(j,"class","my-3"),r(n,"autocomplete","off"),r(l,"class","cnt"),r(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(K,H){M(K,e,H),s(e,l),s(l,n),s(n,i),s(n,o),s(n,a),s(n,u),s(n,c),s(c,f),s(c,p),s(c,_),s(c,b),s(b,v),s(c,d),s(c,k),s(c,A),s(A,S),s(A,E),s(c,B),s(B,P),s(B,L),s(c,F),s(n,x),s(n,j),M(K,z,H),le(G,K,H),V=!0,W||(U=ee(n,"submit",As(t[2])),W=!0)},p(K,[H]){(!V||H&1&&T!==(T=K[0].fwconsent===1))&&(S.checked=T),(!V||H&1&&R!==(R=K[0].fwconsent===2))&&(P.checked=R);const Y={};H&2&&(Y.active=K[1]),G.$set(Y)},i(K){V||(D(G.$$.fragment,K),V=!0)},o(K){q(G.$$.fragment,K),V=!1},d(K){K&&C(e),K&&C(z),ne(G,K),W=!1,U()}}}function xp(t,e,l){let{sysinfo:n={}}=e,i=!1;async function o(a){l(1,i=!0);const u=new FormData(a.target),c=new URLSearchParams;for(let _ of u){const[b,v]=_;c.append(b,v)}let p=await(await fetch("/save",{method:"POST",body:c})).json();l(1,i=!1),Bt.update(_=>(_.fwconsent=u.sf===!0?1:u.sf===!1?2:0,_.booting=p.reboot,_)),ai("/")}return t.$$set=a=>{"sysinfo"in a&&l(0,n=a.sysinfo)},[n,i,o]}class e_ extends Ee{constructor(e){super(),Pe(this,e,xp,Jp,Ae,{sysinfo:0})}}function t_(t){let e,l;return e=new Wm({props:{data:t[1],sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(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||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function l_(t){let e,l;return e=new Np({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function n_(t){let e,l;return e=new Up({props:{sysinfo:t[0],data:t[1]}}),{c(){ie(e.$$.fragment)},m(n,i){le(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||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function i_(t){let e,l;return e=new Eo({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function s_(t){let e,l;return e=new Eo({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function o_(t){let e,l;return e=new Eo({props:{title:"private key",action:"/mqtt-key"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function r_(t){let e,l;return e=new e_({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function a_(t){let e,l;return e=new Qp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function u_(t){let e,l;return e=new Vp({props:{sysinfo:t[0]}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p(n,i){const o={};i&1&&(o.sysinfo=n[0]),e.$set(o)},i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function f_(t){let e,l,n,i,o,a,u,c,f,p,_,b,v,d,k,A,S,T,E,B;return e=new nm({props:{data:t[1]}}),n=new Ml({props:{path:"/",$$slots:{default:[t_]},$$scope:{ctx:t}}}),o=new Ml({props:{path:"/configuration",$$slots:{default:[l_]},$$scope:{ctx:t}}}),u=new Ml({props:{path:"/status",$$slots:{default:[n_]},$$scope:{ctx:t}}}),f=new Ml({props:{path:"/mqtt-ca",$$slots:{default:[i_]},$$scope:{ctx:t}}}),_=new Ml({props:{path:"/mqtt-cert",$$slots:{default:[s_]},$$scope:{ctx:t}}}),v=new Ml({props:{path:"/mqtt-key",$$slots:{default:[o_]},$$scope:{ctx:t}}}),k=new Ml({props:{path:"/consent",$$slots:{default:[r_]},$$scope:{ctx:t}}}),S=new Ml({props:{path:"/setup",$$slots:{default:[a_]},$$scope:{ctx:t}}}),E=new Ml({props:{path:"/vendor",$$slots:{default:[u_]},$$scope:{ctx:t}}}),{c(){ie(e.$$.fragment),l=h(),ie(n.$$.fragment),i=h(),ie(o.$$.fragment),a=h(),ie(u.$$.fragment),c=h(),ie(f.$$.fragment),p=h(),ie(_.$$.fragment),b=h(),ie(v.$$.fragment),d=h(),ie(k.$$.fragment),A=h(),ie(S.$$.fragment),T=h(),ie(E.$$.fragment)},m(P,R){le(e,P,R),M(P,l,R),le(n,P,R),M(P,i,R),le(o,P,R),M(P,a,R),le(u,P,R),M(P,c,R),le(f,P,R),M(P,p,R),le(_,P,R),M(P,b,R),le(v,P,R),M(P,d,R),le(k,P,R),M(P,A,R),le(S,P,R),M(P,T,R),le(E,P,R),B=!0},p(P,R){const L={};R&2&&(L.data=P[1]),e.$set(L);const F={};R&7&&(F.$$scope={dirty:R,ctx:P}),n.$set(F);const x={};R&5&&(x.$$scope={dirty:R,ctx:P}),o.$set(x);const j={};R&7&&(j.$$scope={dirty:R,ctx:P}),u.$set(j);const z={};R&4&&(z.$$scope={dirty:R,ctx:P}),f.$set(z);const G={};R&4&&(G.$$scope={dirty:R,ctx:P}),_.$set(G);const V={};R&4&&(V.$$scope={dirty:R,ctx:P}),v.$set(V);const W={};R&5&&(W.$$scope={dirty:R,ctx:P}),k.$set(W);const U={};R&5&&(U.$$scope={dirty:R,ctx:P}),S.$set(U);const K={};R&5&&(K.$$scope={dirty:R,ctx:P}),E.$set(K)},i(P){B||(D(e.$$.fragment,P),D(n.$$.fragment,P),D(o.$$.fragment,P),D(u.$$.fragment,P),D(f.$$.fragment,P),D(_.$$.fragment,P),D(v.$$.fragment,P),D(k.$$.fragment,P),D(S.$$.fragment,P),D(E.$$.fragment,P),B=!0)},o(P){q(e.$$.fragment,P),q(n.$$.fragment,P),q(o.$$.fragment,P),q(u.$$.fragment,P),q(f.$$.fragment,P),q(_.$$.fragment,P),q(v.$$.fragment,P),q(k.$$.fragment,P),q(S.$$.fragment,P),q(E.$$.fragment,P),B=!1},d(P){ne(e,P),P&&C(l),ne(n,P),P&&C(i),ne(o,P),P&&C(a),ne(u,P),P&&C(c),ne(f,P),P&&C(p),ne(_,P),P&&C(b),ne(v,P),P&&C(d),ne(k,P),P&&C(A),ne(S,P),P&&C(T),ne(E,P)}}}function c_(t){let e,l,n,i;const o=[__,p_],a=[];function u(c,f){return c[0].trying?0:1}return e=u(t),l=a[e]=o[e](t),{c(){l.c(),n=Ge()},m(c,f){a[e].m(c,f),M(c,n,f),i=!0},p(c,f){let p=e;e=u(c),e===p?a[e].p(c,f):(De(),q(a[p],1,1,()=>{a[p]=null}),Ie(),l=a[e],l?l.p(c,f):(l=a[e]=o[e](c),l.c()),D(l,1),l.m(n.parentNode,n))},i(c){i||(D(l),i=!0)},o(c){q(l),i=!1},d(c){a[e].d(c),c&&C(n)}}}function m_(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function p_(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ie(e.$$.fragment)},m(n,i){le(e,n,i),l=!0},p:fe,i(n){l||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function __(t){let e,l;return e=new Dt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[0].trying}}),{c(){ie(e.$$.fragment)},m(n,i){le(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||(D(e.$$.fragment,n),l=!0)},o(n){q(e.$$.fragment,n),l=!1},d(n){ne(e,n)}}}function d_(t){let e,l,n,i,o,a;l=new Dc({props:{$$slots:{default:[f_]},$$scope:{ctx:t}}});const u=[m_,c_],c=[];function f(p,_){return p[0].upgrading?0:p[0].booting?1:-1}return~(i=f(t))&&(o=c[i]=u[i](t)),{c(){e=m("div"),ie(l.$$.fragment),n=h(),o&&o.c(),r(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),le(l,e,null),s(e,n),~i&&c[i].m(e,null),a=!0},p(p,[_]){const b={};_&7&&(b.$$scope={dirty:_,ctx:p}),l.$set(b);let v=i;i=f(p),i===v?~i&&c[i].p(p,_):(o&&(De(),q(c[v],1,1,()=>{c[v]=null}),Ie()),~i?(o=c[i],o?o.p(p,_):(o=c[i]=u[i](p),o.c()),D(o,1),o.m(e,null)):o=null)},i(p){a||(D(l.$$.fragment,p),D(o),a=!0)},o(p){q(l.$$.fragment,p),q(o),a=!1},d(p){p&&C(e),ne(l),~i&&c[i].d()}}}function v_(t,e,l){let n={};Bt.subscribe(o=>{l(0,n=o),n.vndcfg===!1?ai("/vendor"):n.usrcfg===!1?ai("/setup"):n.fwconsent===0&&ai("/consent")}),$o();let i={};return $1.subscribe(o=>{l(1,i=o)}),[n,i]}class h_ extends Ee{constructor(e){super(),Pe(this,e,v_,d_,Ae,{})}}new h_({target:document.getElementById("app")});