mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-05-02 14:30:57 +00:00
16 lines
237 KiB
JavaScript
16 lines
237 KiB
JavaScript
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))l(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&l(u)}).observe(document,{childList:!0,subtree:!0});function n(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 l(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function be(){}function cl(t,e){for(const n in e)t[n]=e[n];return t}function A1(t){return t()}function Sr(){return Object.create(null)}function lt(t){t.forEach(A1)}function _o(t){return typeof t=="function"}function Be(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let ps;function ks(t,e){return ps||(ps=document.createElement("a")),ps.href=e,t===ps.href}function E0(t){return Object.keys(t).length===0}function po(t,...e){if(t==null)return be;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function ii(t){let e;return po(t,n=>e=n)(),e}function kl(t,e,n){t.$$.on_destroy.push(po(e,n))}function ho(t,e,n,l){if(t){const i=$1(t,e,n,l);return t[0](i)}}function $1(t,e,n,l){return t[1]&&l?cl(n.ctx.slice(),t[1](l(e))):n.ctx}function vo(t,e,n,l){if(t[2]&&l){const i=t[2](l(n));if(e.dirty===void 0)return i;if(typeof i=="object"){const o=[],u=Math.max(e.dirty.length,i.length);for(let m=0;m<u;m+=1)o[m]=e.dirty[m]|i[m];return o}return e.dirty|i}return e.dirty}function bo(t,e,n,l,i,o){if(i){const u=$1(e,n,l,o);t.p(u,i)}}function go(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let l=0;l<n;l++)e[l]=-1;return e}return-1}function ws(t){const e={};for(const n in t)n[0]!=="$"&&(e[n]=t[n]);return e}function Cs(t,e){const n={};e=new Set(e);for(const l in t)!e.has(l)&&l[0]!=="$"&&(n[l]=t[l]);return n}const P0=["",!0,1,"true","contenteditable"];function s(t,e){t.appendChild(e)}function M(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode&&t.parentNode.removeChild(t)}function mt(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function c(t){return document.createElement(t)}function je(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function E(t){return document.createTextNode(t)}function b(){return E(" ")}function it(){return E("")}function Q(t,e,n,l){return t.addEventListener(e,n,l),()=>t.removeEventListener(e,n,l)}function ai(t){return function(e){return e.preventDefault(),t.call(this,e)}}function a(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const A0=["width","height"];function si(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const l in e)e[l]==null?t.removeAttribute(l):l==="style"?t.style.cssText=e[l]:l==="__value"?t.value=t[l]=e[l]:n[l]&&n[l].set&&A0.indexOf(l)===-1?t[l]=e[l]:a(t,l,e[l])}function Se(t){return t===""?null:+t}function $0(t){return Array.from(t.childNodes)}function X(t,e){e=""+e,t.data!==e&&(t.data=e)}function D0(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function L0(t,e,n){~P0.indexOf(n)?D0(t,e):X(t,e)}function ue(t,e){t.value=e==null?"":e}function Ci(t,e,n,l){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,l?"important":"")}function Te(t,e,n){for(let l=0;l<t.options.length;l+=1){const i=t.options[l];if(i.__value===e){i.selected=!0;return}}(!n||e!==void 0)&&(t.selectedIndex=-1)}function ot(t){const e=t.querySelector(":checked");return e&&e.__value}let ds;function I0(){if(ds===void 0){ds=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{ds=!0}}return ds}function ko(t,e){getComputedStyle(t).position==="static"&&(t.style.position="relative");const l=c("iframe");l.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;"),l.setAttribute("aria-hidden","true"),l.tabIndex=-1;const i=I0();let o;return i?(l.src="data:text/html,<script>onresize=function(){parent.postMessage(0,'*')}<\/script>",o=Q(window,"message",u=>{u.source===l.contentWindow&&e()})):(l.src="about:blank",l.onload=()=>{o=Q(l.contentWindow,"resize",e),e()}),s(t,l),()=>{(i||o&&l.contentWindow)&&o(),y(l)}}function R0(t,e,{bubbles:n=!1,cancelable:l=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n,l,e),i}function Tr(t,e){return new t(e)}let Si;function yi(t){Si=t}function Pi(){if(!Si)throw new Error("Function called outside component initialization");return Si}function D1(t){Pi().$$.on_mount.push(t)}function F0(t){Pi().$$.on_destroy.push(t)}function O0(){const t=Pi();return(e,n,{cancelable:l=!1}={})=>{const i=t.$$.callbacks[e];if(i){const o=R0(e,n,{cancelable:l});return i.slice().forEach(u=>{u.call(t,o)}),!o.defaultPrevented}return!0}}function Mi(t,e){return Pi().$$.context.set(t,e),e}function Hl(t){return Pi().$$.context.get(t)}const ti=[],ys=[];let li=[];const Nr=[],L1=Promise.resolve();let xs=!1;function I1(){xs||(xs=!0,L1.then(R1))}function q0(){return I1(),L1}function Ze(t){li.push(t)}const Ks=new Set;let xn=0;function R1(){if(xn!==0)return;const t=Si;do{try{for(;xn<ti.length;){const e=ti[xn];xn++,yi(e),B0(e.$$)}}catch(e){throw ti.length=0,xn=0,e}for(yi(null),ti.length=0,xn=0;ys.length;)ys.pop()();for(let e=0;e<li.length;e+=1){const n=li[e];Ks.has(n)||(Ks.add(n),n())}li.length=0}while(ti.length);for(;Nr.length;)Nr.pop()();xs=!1,Ks.clear(),yi(t)}function B0(t){if(t.fragment!==null){t.update(),lt(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Ze)}}function U0(t){const e=[],n=[];li.forEach(l=>t.indexOf(l)===-1?e.push(l):n.push(l)),n.forEach(l=>l()),li=e}const gs=new Set;let an;function $e(){an={r:0,c:[],p:an}}function De(){an.r||lt(an.c),an=an.p}function L(t,e){t&&t.i&&(gs.delete(t),t.i(e))}function q(t,e,n,l){if(t&&t.o){if(gs.has(t))return;gs.add(t),an.c.push(()=>{gs.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function F1(t,e){const n={},l={},i={$$scope:1};let o=t.length;for(;o--;){const u=t[o],m=e[o];if(m){for(const r in u)r in m||(l[r]=1);for(const r in m)i[r]||(n[r]=m[r],i[r]=1);t[o]=m}else for(const r in u)i[r]=1}for(const u in l)u in n||(n[u]=void 0);return n}function Er(t){return typeof t=="object"&&t!==null?t:{}}function ae(t){t&&t.c()}function se(t,e,n,l){const{fragment:i,after_update:o}=t.$$;i&&i.m(e,n),l||Ze(()=>{const u=t.$$.on_mount.map(A1).filter(_o);t.$$.on_destroy?t.$$.on_destroy.push(...u):lt(u),t.$$.on_mount=[]}),o.forEach(Ze)}function oe(t,e){const n=t.$$;n.fragment!==null&&(U0(n.after_update),lt(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function j0(t,e){t.$$.dirty[0]===-1&&(ti.push(t),I1(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function He(t,e,n,l,i,o,u,m=[-1]){const r=Si;yi(t);const f=t.$$={fragment:null,ctx:[],props:o,update:be,not_equal:i,bound:Sr(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(r?r.$$.context:[])),callbacks:Sr(),dirty:m,skip_bound:!1,root:e.target||r.$$.root};u&&u(f.root);let p=!1;if(f.ctx=n?n(t,e.props||{},(_,h,...v)=>{const d=v.length?v[0]:h;return f.ctx&&i(f.ctx[_],f.ctx[_]=d)&&(!f.skip_bound&&f.bound[_]&&f.bound[_](d),p&&j0(t,_)),h}):[],f.update(),p=!0,lt(f.before_update),f.fragment=l?l(f.ctx):!1,e.target){if(e.hydrate){const _=$0(e.target);f.fragment&&f.fragment.l(_),_.forEach(y)}else f.fragment&&f.fragment.c();e.intro&&L(t.$$.fragment),se(t,e.target,e.anchor,e.customElement),R1()}yi(r)}class We{$destroy(){oe(this,1),this.$destroy=be}$on(e,n){if(!_o(n))return be;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const i=l.indexOf(n);i!==-1&&l.splice(i,1)}}$set(e){this.$$set&&!E0(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Pr=t=>typeof t>"u",O1=t=>typeof t=="function",q1=t=>typeof t=="number";function H0(t){return!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function B1(){let t=0;return()=>t++}function W0(){return Math.random().toString(36).substring(2)}const Wl=typeof window>"u";function U1(t,e,n){return t.addEventListener(e,n),()=>t.removeEventListener(e,n)}const j1=(t,e)=>t?{}:{style:e},eo=t=>({"aria-hidden":"true",...j1(t,"display:none;")}),ei=[];function H1(t,e){return{subscribe:ht(t,e).subscribe}}function ht(t,e=be){let n;const l=new Set;function i(m){if(Be(t,m)&&(t=m,n)){const r=!ei.length;for(const f of l)f[1](),ei.push(f,t);if(r){for(let f=0;f<ei.length;f+=2)ei[f][0](ei[f+1]);ei.length=0}}}function o(m){i(m(t))}function u(m,r=be){const f=[m,r];return l.add(f),l.size===1&&(n=e(i)||be),m(t),()=>{l.delete(f),l.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:u}}function z0(t,e,n){const l=!Array.isArray(t),i=l?[t]:t,o=e.length<2;return H1(n,u=>{let m=!1;const r=[];let f=0,p=be;const _=()=>{if(f)return;p();const v=e(l?r[0]:r,u);o?u(v):p=_o(v)?v:be},h=i.map((v,d)=>po(v,g=>{r[d]=g,f&=~(1<<d),m&&_()},()=>{f|=1<<d}));return m=!0,_(),function(){lt(h),p(),m=!1}})}const Ai=t=>`@@svnav-ctx__${t}`,to=Ai("LOCATION"),oi=Ai("ROUTER"),W1=Ai("ROUTE"),G0=Ai("ROUTE_PARAMS"),V0=Ai("FOCUS_ELEM"),z1=/^:(.+)/,gi=(t,e,n)=>t.substr(e,n),lo=(t,e)=>gi(t,0,e.length)===e,K0=t=>t==="",Y0=t=>z1.test(t),G1=t=>t[0]==="*",Q0=t=>t.replace(/\*.*$/,""),V1=t=>t.replace(/(^\/+|\/+$)/g,"");function Cl(t,e=!1){const n=V1(t).split("/");return e?n.filter(Boolean):n}const Ys=(t,e)=>t+(e?`?${e}`:""),wo=t=>`/${V1(t)}`;function $i(...t){const e=l=>Cl(l,!0).join("/"),n=t.map(e).join("/");return wo(n)}const Co=1,Ns=2,_n=3,X0=4,K1=5,Z0=6,Y1=7,J0=8,x0=9,Q1=10,X1=11,ec={[Co]:"Link",[Ns]:"Route",[_n]:"Router",[X0]:"useFocus",[K1]:"useLocation",[Z0]:"useMatch",[Y1]:"useNavigate",[J0]:"useParams",[x0]:"useResolvable",[Q1]:"useResolve",[X1]:"navigate"},yo=t=>ec[t];function tc(t,e){let n;return t===Ns?n=e.path?`path="${e.path}"`:"default":t===Co?n=`to="${e.to}"`:t===_n&&(n=`basepath="${e.basepath||""}"`),`<${yo(t)} ${n||""} />`}function lc(t,e,n,l){const i=n&&tc(l||t,n),o=i?`
|
|
|
|
Occurred in: ${i}`:"",u=yo(t),m=O1(e)?e(u):e;return`<${u}> ${m}${o}`}const Z1=t=>(...e)=>t(lc(...e)),J1=Z1(t=>{throw new Error(t)}),Ms=Z1(console.warn),Ar=4,nc=3,ic=2,sc=1,oc=1;function ac(t,e){const n=t.default?0:Cl(t.fullPath).reduce((l,i)=>{let o=l;return o+=Ar,K0(i)?o+=oc:Y0(i)?o+=ic:G1(i)?o-=Ar+sc:o+=nc,o},0);return{route:t,score:n,index:e}}function rc(t){return t.map(ac).sort((e,n)=>e.score<n.score?1:e.score>n.score?-1:e.index-n.index)}function x1(t,e){let n,l;const[i]=e.split("?"),o=Cl(i),u=o[0]==="",m=rc(t);for(let r=0,f=m.length;r<f;r++){const{route:p}=m[r];let _=!1;const h={},v=$=>({...p,params:h,uri:$});if(p.default){l=v(e);continue}const d=Cl(p.fullPath),g=Math.max(o.length,d.length);let k=0;for(;k<g;k++){const $=d[k],N=o[k];if(!Pr($)&&G1($)){const F=$==="*"?"*":$.slice(1);h[F]=o.slice(k).map(decodeURIComponent).join("/");break}if(Pr(N)){_=!0;break}const A=z1.exec($);if(A&&!u){const F=decodeURIComponent(N);h[A[1]]=F}else if($!==N){_=!0;break}}if(!_){n=v($i(...o.slice(0,k)));break}}return n||l||null}function e0(t,e){return x1([t],e)}function uc(t,e){if(lo(t,"/"))return t;const[n,l]=t.split("?"),[i]=e.split("?"),o=Cl(n),u=Cl(i);if(o[0]==="")return Ys(i,l);if(!lo(o[0],".")){const f=u.concat(o).join("/");return Ys((i==="/"?"":"/")+f,l)}const m=u.concat(o),r=[];return m.forEach(f=>{f===".."?r.pop():f!=="."&&r.push(f)}),Ys(`/${r.join("/")}`,l)}function $r(t,e){const{pathname:n,hash:l="",search:i="",state:o}=t,u=Cl(e,!0),m=Cl(n,!0);for(;u.length;)u[0]!==m[0]&&J1(_n,`Invalid state: All locations must begin with the basepath "${e}", found "${n}"`),u.shift(),m.shift();return{pathname:$i(...m),hash:l,search:i,state:o}}const Dr=t=>t.length===1?"":t,Mo=t=>{const e=t.indexOf("?"),n=t.indexOf("#"),l=e!==-1,i=n!==-1,o=i?Dr(gi(t,n)):"",u=i?gi(t,0,n):t,m=l?Dr(gi(u,e)):"";return{pathname:(l?gi(u,0,e):u)||"/",search:m,hash:o}},fc=t=>{const{pathname:e,search:n,hash:l}=t;return e+n+l};function cc(t,e,n){return $i(n,uc(t,e))}function mc(t,e){const n=wo(Q0(t)),l=Cl(n,!0),i=Cl(e,!0).slice(0,l.length),o=e0({fullPath:n},$i(...i));return o&&o.uri}const Qs="POP",_c="PUSH",pc="REPLACE";function Xs(t){return{...t.location,pathname:encodeURI(decodeURI(t.location.pathname)),state:t.history.state,_key:t.history.state&&t.history.state._key||"initial"}}function dc(t){let e=[],n=Xs(t),l=Qs;const i=(o=e)=>o.forEach(u=>u({location:n,action:l}));return{get location(){return n},listen(o){e.push(o);const u=()=>{n=Xs(t),l=Qs,i([o])};i([o]);const m=U1(t,"popstate",u);return()=>{m(),e=e.filter(r=>r!==o)}},navigate(o,u){const{state:m={},replace:r=!1}=u||{};if(l=r?pc:_c,q1(o))u&&Ms(X1,"Navigation options (state or replace) are not supported, when passing a number as the first argument to navigate. They are ignored."),l=Qs,t.history.go(o);else{const f={...m,_key:W0()};try{t.history[r?"replaceState":"pushState"](f,"",o)}catch{t.location[r?"replace":"assign"](o)}}n=Xs(t),i()}}}function Zs(t,e){return{...Mo(e),state:t}}function hc(t="/"){let e=0,n=[Zs(null,t)];return{get entries(){return n},get location(){return n[e]},addEventListener(){},removeEventListener(){},history:{get state(){return n[e].state},pushState(l,i,o){e++,n=n.slice(0,e),n.push(Zs(l,o))},replaceState(l,i,o){n[e]=Zs(l,o)},go(l){const i=e+l;i<0||i>n.length-1||(e=i)}}}}const vc=!!(!Wl&&window.document&&window.document.createElement),bc=!Wl&&window.location.origin==="null",t0=dc(vc&&!bc?window:hc()),{navigate:mn}=t0;let $l=null,l0=!0;function gc(t,e){const n=document.querySelectorAll("[data-svnav-router]");for(let l=0;l<n.length;l++){const i=n[l],o=Number(i.dataset.svnavRouter);if(o===t)return!0;if(o===e)return!1}return!1}function kc(t){(!$l||t.level>$l.level||t.level===$l.level&&gc(t.routerId,$l.routerId))&&($l=t)}function wc(){$l=null}function Cc(){l0=!1}function Lr(t){if(!t)return!1;const e="tabindex";try{if(!t.hasAttribute(e)){t.setAttribute(e,"-1");let n;n=U1(t,"blur",()=>{t.removeAttribute(e),n()})}return t.focus(),document.activeElement===t}catch{return!1}}function yc(t,e){return Number(t.dataset.svnavRouteEnd)===e}function Mc(t){return/^H[1-6]$/i.test(t.tagName)}function Ir(t,e=document){return e.querySelector(t)}function Sc(t){let n=Ir(`[data-svnav-route-start="${t}"]`).nextElementSibling;for(;!yc(n,t);){if(Mc(n))return n;const l=Ir("h1,h2,h3,h4,h5,h6",n);if(l)return l;n=n.nextElementSibling}return null}function Tc(t){Promise.resolve(ii(t.focusElement)).then(e=>{const n=e||Sc(t.id);n||Ms(_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,Ns),!Lr(n)&&Lr(document.documentElement)})}const Nc=(t,e,n)=>(l,i)=>q0().then(()=>{if(!$l||l0){Cc();return}if(l&&Tc($l.route),t.announcements&&i){const{path:o,fullPath:u,meta:m,params:r,uri:f}=$l.route,p=t.createAnnouncement({path:o,fullPath:u,meta:m,params:r,uri:f},ii(n));Promise.resolve(p).then(_=>{e.set(_)})}wc()}),Ec="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 Pc(t){let e,n,l=[{role:"status"},{"aria-atomic":"true"},{"aria-live":"polite"},{"data-svnav-announcer":""},j1(t[6],Ec)],i={};for(let o=0;o<l.length;o+=1)i=cl(i,l[o]);return{c(){e=c("div"),n=E(t[0]),si(e,i)},m(o,u){M(o,e,u),s(e,n)},p(o,u){u[0]&1&&L0(n,o[0],i.contenteditable)},d(o){o&&y(e)}}}function Ac(t){let e,n,l,i,o,u=[eo(t[6]),{"data-svnav-router":t[3]}],m={};for(let _=0;_<u.length;_+=1)m=cl(m,u[_]);const r=t[22].default,f=ho(r,t,t[21],null);let p=t[2]&&t[4]&&t[1].announcements&&Pc(t);return{c(){e=c("div"),n=b(),f&&f.c(),l=b(),p&&p.c(),i=it(),si(e,m)},m(_,h){M(_,e,h),M(_,n,h),f&&f.m(_,h),M(_,l,h),p&&p.m(_,h),M(_,i,h),o=!0},p(_,h){f&&f.p&&(!o||h[0]&2097152)&&bo(f,r,_,_[21],o?vo(r,_[21],h,null):go(_[21]),null),_[2]&&_[4]&&_[1].announcements&&p.p(_,h)},i(_){o||(L(f,_),o=!0)},o(_){q(f,_),o=!1},d(_){_&&y(e),_&&y(n),f&&f.d(_),_&&y(l),p&&p.d(_),_&&y(i)}}}const $c=B1(),Rr="/";function Dc(t,e,n){let l,i,o,u,m,{$$slots:r={},$$scope:f}=e,{basepath:p=Rr}=e,{url:_=null}=e,{history:h=t0}=e,{primary:v=!0}=e,{a11y:d={}}=e,{disableInlineStyles:g=!1}=e;const k={createAnnouncement:ie=>`Navigated to ${ie.uri}`,announcements:!0,...d},$=p,N=wo(p),A=Hl(to),F=Hl(oi),I=!A,R=$c(),C=v&&!(F&&!F.manageFocus),P=ht("");kl(t,P,ie=>n(0,m=ie));const ne=F?F.disableInlineStyles:g,j=ht([]);kl(t,j,ie=>n(20,u=ie));const B=ht(null);kl(t,B,ie=>n(18,i=ie));let H=!1;const V=I?0:F.level+1,K=I?ht((()=>$r(Wl?Mo(_):h.location,N))()):A;kl(t,K,ie=>n(17,l=ie));const Z=ht(l);kl(t,Z,ie=>n(19,o=ie));const z=Nc(k,P,K),W=ie=>me=>me.filter(Y=>Y.id!==ie);function x(ie){if(Wl){if(H)return;const me=e0(ie,l.pathname);if(me)return H=!0,me}else j.update(me=>{const Y=W(ie.id)(me);return Y.push(ie),Y})}function _e(ie){j.update(W(ie))}return!I&&p!==Rr&&Ms(_n,'Only top-level Routers can have a "basepath" prop. It is ignored.',{basepath:p}),I&&(D1(()=>h.listen(me=>{const Y=$r(me.location,N);Z.set(l),K.set(Y)})),Mi(to,K)),Mi(oi,{activeRoute:B,registerRoute:x,unregisterRoute:_e,manageFocus:C,level:V,id:R,history:I?h:F.history,basepath:I?N:F.basepath,disableInlineStyles:ne}),t.$$set=ie=>{"basepath"in ie&&n(11,p=ie.basepath),"url"in ie&&n(12,_=ie.url),"history"in ie&&n(13,h=ie.history),"primary"in ie&&n(14,v=ie.primary),"a11y"in ie&&n(15,d=ie.a11y),"disableInlineStyles"in ie&&n(16,g=ie.disableInlineStyles),"$$scope"in ie&&n(21,f=ie.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&2048&&p!==$&&Ms(_n,'You cannot change the "basepath" prop. It is ignored.'),t.$$.dirty[0]&1179648){const ie=x1(u,l.pathname);B.set(ie)}if(t.$$.dirty[0]&655360&&I){const ie=!!l.hash,me=!ie&&C,Y=!ie||l.pathname!==o.pathname;z(me,Y)}t.$$.dirty[0]&262144&&C&&i&&i.primary&&kc({level:V,routerId:R,route:i})},[m,k,I,R,C,P,ne,j,B,K,Z,p,_,h,v,d,g,l,i,o,u,f,r]}class Lc extends We{constructor(e){super(),He(this,e,Dc,Ac,Be,{basepath:11,url:12,history:13,primary:14,a11y:15,disableInlineStyles:16},null,[-1,-1])}}const n0=Lc;function Di(t,e,n=oi,l=_n){Hl(n)||J1(t,o=>`You cannot use ${o} outside of a ${yo(l)}.`,e)}const Ic=t=>{const{subscribe:e}=Hl(t);return{subscribe:e}};function i0(){return Di(K1),Ic(to)}function s0(){const{history:t}=Hl(oi);return t}function o0(){const t=Hl(W1);return t?z0(t,e=>e.base):ht("/")}function a0(){Di(Q1);const t=o0(),{basepath:e}=Hl(oi);return l=>cc(l,ii(t),e)}function Rc(){Di(Y1);const t=a0(),{navigate:e}=s0();return(l,i)=>{const o=q1(l)?l:t(l);return e(o,i)}}const Fc=t=>({params:t&16,location:t&8}),Fr=t=>({params:Wl?ii(t[10]):t[4],location:t[3],navigate:t[11]});function Or(t){let e,n;return e=new n0({props:{primary:t[1],$$slots:{default:[Bc]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.primary=l[1]),i&528409&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Oc(t){let e;const n=t[18].default,l=ho(n,t,t[19],Fr);return{c(){l&&l.c()},m(i,o){l&&l.m(i,o),e=!0},p(i,o){l&&l.p&&(!e||o&524312)&&bo(l,n,i,i[19],e?vo(n,i[19],o,Fc):go(i[19]),Fr)},i(i){e||(L(l,i),e=!0)},o(i){q(l,i),e=!1},d(i){l&&l.d(i)}}}function qc(t){let e,n,l;const i=[{location:t[3]},{navigate:t[11]},Wl?ii(t[10]):t[4],t[12]];var o=t[0];function u(m){let r={};for(let f=0;f<i.length;f+=1)r=cl(r,i[f]);return{props:r}}return o&&(e=Tr(o,u())),{c(){e&&ae(e.$$.fragment),n=it()},m(m,r){e&&se(e,m,r),M(m,n,r),l=!0},p(m,r){const f=r&7192?F1(i,[r&8&&{location:m[3]},r&2048&&{navigate:m[11]},r&1040&&Er(Wl?ii(m[10]):m[4]),r&4096&&Er(m[12])]):{};if(r&1&&o!==(o=m[0])){if(e){$e();const p=e;q(p.$$.fragment,1,0,()=>{oe(p,1)}),De()}o?(e=Tr(o,u()),ae(e.$$.fragment),L(e.$$.fragment,1),se(e,n.parentNode,n)):e=null}else o&&e.$set(f)},i(m){l||(e&&L(e.$$.fragment,m),l=!0)},o(m){e&&q(e.$$.fragment,m),l=!1},d(m){m&&y(n),e&&oe(e,m)}}}function Bc(t){let e,n,l,i;const o=[qc,Oc],u=[];function m(r,f){return r[0]!==null?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function Uc(t){let e,n,l,i,o,u=[eo(t[7]),{"data-svnav-route-start":t[5]}],m={};for(let _=0;_<u.length;_+=1)m=cl(m,u[_]);let r=t[2]&&Or(t),f=[eo(t[7]),{"data-svnav-route-end":t[5]}],p={};for(let _=0;_<f.length;_+=1)p=cl(p,f[_]);return{c(){e=c("div"),n=b(),r&&r.c(),l=b(),i=c("div"),si(e,m),si(i,p)},m(_,h){M(_,e,h),M(_,n,h),r&&r.m(_,h),M(_,l,h),M(_,i,h),o=!0},p(_,[h]){_[2]?r?(r.p(_,h),h&4&&L(r,1)):(r=Or(_),r.c(),L(r,1),r.m(l.parentNode,l)):r&&($e(),q(r,1,1,()=>{r=null}),De())},i(_){o||(L(r),o=!0)},o(_){q(r),o=!1},d(_){_&&y(e),_&&y(n),r&&r.d(_),_&&y(l),_&&y(i)}}}const jc=B1();function Hc(t,e,n){let l;const i=["path","component","meta","primary"];let o=Cs(e,i),u,m,r,f,{$$slots:p={},$$scope:_}=e,{path:h=""}=e,{component:v=null}=e,{meta:d={}}=e,{primary:g=!0}=e;Di(Ns,e);const k=jc(),{registerRoute:$,unregisterRoute:N,activeRoute:A,disableInlineStyles:F}=Hl(oi);kl(t,A,H=>n(16,u=H));const I=o0();kl(t,I,H=>n(17,r=H));const R=i0();kl(t,R,H=>n(3,m=H));const C=ht(null);let P;const ne=ht(),j=ht({});kl(t,j,H=>n(4,f=H)),Mi(W1,ne),Mi(G0,j),Mi(V0,C);const B=Rc();return Wl||F0(()=>N(k)),t.$$set=H=>{n(24,e=cl(cl({},e),ws(H))),n(12,o=Cs(e,i)),"path"in H&&n(13,h=H.path),"component"in H&&n(0,v=H.component),"meta"in H&&n(14,d=H.meta),"primary"in H&&n(1,g=H.primary),"$$scope"in H&&n(19,_=H.$$scope)},t.$$.update=()=>{if(t.$$.dirty&155658){const H=h==="",V=$i(r,h),G={id:k,path:h,meta:d,default:H,fullPath:H?"":V,base:H?r:mc(V,m.pathname),primary:g,focusElement:C};ne.set(G),n(15,P=$(G))}if(t.$$.dirty&98304&&n(2,l=!!(P||u&&u.id===k)),t.$$.dirty&98308&&l){const{params:H}=P||u;j.set(H)}},e=ws(e),[v,g,l,m,f,k,A,F,I,R,j,B,o,h,d,P,u,r,p,_]}class Wc extends We{constructor(e){super(),He(this,e,Hc,Uc,Be,{path:13,component:0,meta:14,primary:1})}}const bl=Wc;function zc(t){let e,n,l,i;const o=t[13].default,u=ho(o,t,t[12],null);let m=[{href:t[0]},t[2],t[1]],r={};for(let f=0;f<m.length;f+=1)r=cl(r,m[f]);return{c(){e=c("a"),u&&u.c(),si(e,r)},m(f,p){M(f,e,p),u&&u.m(e,null),n=!0,l||(i=Q(e,"click",t[4]),l=!0)},p(f,[p]){u&&u.p&&(!n||p&4096)&&bo(u,o,f,f[12],n?vo(o,f[12],p,null):go(f[12]),null),si(e,r=F1(m,[(!n||p&1)&&{href:f[0]},p&4&&f[2],p&2&&f[1]]))},i(f){n||(L(u,f),n=!0)},o(f){q(u,f),n=!1},d(f){f&&y(e),u&&u.d(f),l=!1,i()}}}function Gc(t,e,n){let l,i,o,u,m,r;const f=["to","replace","state","getProps"];let p=Cs(e,f),_,{$$slots:h={},$$scope:v}=e,{to:d}=e,{replace:g=!1}=e,{state:k={}}=e,{getProps:$=null}=e;Di(Co,e);const N=i0();kl(t,N,C=>n(11,_=C));const A=O0(),F=a0(),{navigate:I}=s0();function R(C){A("click",C),H0(C)&&(C.preventDefault(),I(l,{state:k,replace:u||g}))}return t.$$set=C=>{n(19,e=cl(cl({},e),ws(C))),n(18,p=Cs(e,f)),"to"in C&&n(5,d=C.to),"replace"in C&&n(6,g=C.replace),"state"in C&&n(7,k=C.state),"getProps"in C&&n(8,$=C.getProps),"$$scope"in C&&n(12,v=C.$$scope)},t.$$.update=()=>{t.$$.dirty&2080&&n(0,l=F(d,_)),t.$$.dirty&2049&&n(10,i=lo(_.pathname,l)),t.$$.dirty&2049&&n(9,o=l===_.pathname),t.$$.dirty&2049&&(u=Mo(l)===fc(_)),t.$$.dirty&512&&n(2,m=o?{"aria-current":"page"}:{}),n(1,r=(()=>{if(O1($)){const C=$({location:_,href:l,isPartiallyCurrent:i,isCurrent:o});return{...p,...C}}return p})())},e=ws(e),[l,r,m,N,R,d,g,k,$,o,i,_,v,h]}class Vc extends We{constructor(e){super(),He(this,e,Gc,zc,Be,{to:5,replace:6,state:7,getProps:8})}}const el=Vc;let Ti=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function jl(t){return t===1?"green":t===2?"yellow":t===3?"red":"gray"}function Kc(t,e){return e?t>218&&t<242?"#32c000":t>212&&t<248?"#b1c000":t>208&&t<252?"#ffa000":"#d90000":t>218&&t<242?"#32d900":t>212&&t<248?"#b1d900":t>208&&t<252?"#ffb800":"#d90000"}function So(t,e){let n;return e?t>90?n="#d90000":t>85?n="#e31000":t>80?n="#ffa900":t>75?n="#dcc300":n="#32c500":t>90?n="#d90000":t>85?n="#e32100":t>80?n="#ffb800":t>75?n="#dcd800":n="#32d900",n}function Ni(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 Ye(t){for(t=t.toString();t.length<2;)t="0"+t;return t}function Ce(t,e){switch(e){case 5:switch(t){case"esp8266":return"Pow-K (GPIO12)";case"esp32s2":return"Pow-K+"}case 7:switch(t){case"esp8266":return"Pow-U (GPIO12)";case"esp32s2":return"Pow-U+"}case 6:return"Pow-P1";case 51:return"Wemos S2 mini";case 50:return"Generic ESP32-S2";case 201:return"Wemos LOLIN D32";case 202:return"Adafruit HUZZAH32";case 203:return"DevKitC";case 241:return"LilyGO T-ETH-POE";case 242:return"M5 PoESP32";case 243:return"WT32-ETH01";case 200:return"Generic ESP32";case 2:return"HAN Reader 2.0 by Max Spencer";case 0:return"Custom hardware by Roar Fredriksen";case 1:return"Kamstrup module by Egil Opsahl";case 8:return"\xB5HAN mosquito by dbeinder";case 3:return"Pow-K (UART0)";case 4:return"Pow-U (UART0)";case 101:return"Wemos D1 mini";case 100:return"Generic ESP8266";case 70:return"Generic ESP32-C3";case 71:return"ESP32-C3-DevKitM-1";case 80:return"Generic ESP32-S3"}}function qr(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 Br(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 Ur(t){switch(t){case 400:return"Unrecognized data in request";case 401:case 403:return"Unauthorized, check API key";case 404:return"Price unavailable, not found";case 425:return"Server says its too early";case 429:return"Exceeded API rate limit";case 500:return"Internal server error";case-1:return"Connection error";case-2:return"Incomplete data received";case-3:return"Invalid data, tag missing";case-51:return"Authentication failed";case-52:return"Decryption failed";case-53:return"Encryption key invalid"}return t<0?"Unspecified error "+t:""}function jr(t){switch(t){case 255:return"Unable to start upgrade";case-1:return"Connection refused";case-2:return"Failed to send headers";case-3:return"Failed to send payload";case-4:return"Not connected";case-5:return"Connection lost";case-6:return"No stream";case-7:return"Not a HTTP server";case-8:return"Not enough memory";case-9:return"Encoding error";case-10:return"Stream write";case-11:return"Read timeout"}return"Unknown "+t}function ni(t){switch(t){case 2:case 4:case 7:return!0}return!1}function tt(t,e){return t==1||t==2&&e}function Wt(t){return"https://github.com/UtilitechAS/amsreader-firmware/wiki/"+t}function Ne(t,e){return isNaN(t)?"-":(isNaN(e)&&(e=t<1?2:t<10?1:0),t.toFixed(e))}function wl(t,e){return t.setTime(t.getTime()+e*36e5),t}function Hr(t){if(t.chip=="esp8266")switch(t.boot_reason){case 0:return"Normal";case 1:return"WDT reset";case 2:return"Exception reset";case 3:return"Soft WDT reset";case 4:return"Software restart";case 5:return"Deep sleep";case 6:return"External reset";default:return"Unknown (8266)"}else switch(t.boot_reason){case 1:return"Vbat power on reset";case 3:return"Software reset";case 4:return"WDT reset";case 5:return"Deep sleep";case 6:return"SLC reset";case 7:return"Timer Group0 WDT reset";case 8:return"Timer Group1 WDT reset";case 9:return"RTC WDT reset";case 10:return"Instrusion test reset CPU";case 11:return"Time Group reset CPU";case 12:return"Software reset CPU";case 13:return"RTC WTD reset CPU";case 14:return"PRO CPU";case 15:return"Brownout";case 16:return"RTC reset";default:return"Unknown"}}function Wr(t){return t=="EOE"?"ENTSO-E":t=="HKS"?"hvakosterstrommen.no":t=="EDS"?"Energi Data Service":t=="MIX"?"Mixed sources":"Unknown ("+t+")"}function zr(t){return t=="EOE"?"https://transparency.entsoe.eu/-E":t=="HKS"?"https://www.hvakosterstrommen.no/":t=="EDS"?"https://www.energidataservice.dk/":"#"}let hs=0;function Ei(t,e){var n="";hs++;var l=function(){setTimeout(Ei,1e3,t,e)};if(t.net.ip&&hs%3==0){if(!t.net.ip){l();return}n="http://"+t.net.ip}else t.hostname&&hs%3==1?n="http://"+t.hostname:t.hostname&&hs%3==2?n="http://"+t.hostname+".local":n="";console&&console.log("Trying url "+n),e&&e(n);var i=new XMLHttpRequest;i.timeout=5e3,i.addEventListener("abort",l),i.addEventListener("error",l),i.addEventListener("timeout",l),i.addEventListener("load",function(o){window.location.href=n||"/"}),i.open("GET",n+"/is-alive",!0),i.send()}async function Dl(t,e={}){const{timeout:n=8e3}=e,l=new AbortController,i=setTimeout(()=>l.abort(),n),o=await fetch(t,{...e,signal:l.signal});return clearTimeout(i),o}let gl={version:"",chip:"",mac:null,apmac:null,vndcfg:null,usrcfg:null,fwconsent:null,booting:!1,upgrading:!1,ui:{},security:0,boot_reason:0,upgrade:{x:-1,e:0,f:null,t:null},trying:null,if:{eth:!1}};const Tt=ht(gl);async function To(){gl=await(await Dl("sysinfo.json?t="+Math.floor(Date.now()/1e3))).json(),Tt.set(gl)}let vs=0,Gr=-127,Vr=null,Yc={};const r0=H1(Yc,t=>{let e;async function n(){Dl("data.json").then(l=>l.json()).then(l=>{t(l),Gr!=l.t&&(Gr=l.t,setTimeout(_0,2e3)),Vr==null&&l.pe&&l.p!=null&&(Vr=l.p,f0()),gl.upgrading?window.location.reload():(!gl||!gl.chip||gl.booting||vs>1&&!ni(gl.board))&&(To(),rn&&clearTimeout(rn),rn=setTimeout(Eo,2e3),un&&clearTimeout(un),un=setTimeout(Po,3e3));let i=5e3;if(ni(gl.board)&&l.v>2.5){let o=3.3-Math.min(3.3,l.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(n,i),vs=0}).catch(l=>{vs++,vs>3?(t({em:3,hm:0,wm:0,mm:0}),e=setTimeout(n,15e3)):e=setTimeout(n,ni(gl.board)?1e4:5e3)})}return n(),function(){clearTimeout(e)}});let no={},ki;const No=ht(no);async function u0(){let t=!1;if(No.update(e=>{for(var n=0;n<36;n++){if(e[Ye(n)]==null){t=n<12;break}e[Ye(n)]=e[Ye(n+1)]}return e}),t)f0();else{let e=new Date;ki=setTimeout(u0,(60-e.getMinutes())*6e4)}}async function f0(){ki&&(clearTimeout(ki),ki=0),no=await(await Dl("energyprice.json")).json(),No.set(no);let e=new Date;ki=setTimeout(u0,(60-e.getMinutes())*6e4)}let io={},rn;async function Eo(){rn&&(clearTimeout(rn),rn=0),io=await(await Dl("dayplot.json")).json(),c0.set(io);let e=new Date;rn=setTimeout(Eo,(60-e.getMinutes())*6e4+20)}const c0=ht(io,t=>(Eo(),function(){}));let so={},un;async function Po(){un&&(clearTimeout(un),un=0),so=await(await Dl("monthplot.json")).json(),m0.set(so);let e=new Date;un=setTimeout(Po,(24-e.getHours())*36e5+40)}const m0=ht(so,t=>(Po(),function(){}));let oo={};async function _0(){oo=await(await Dl("temperature.json")).json(),p0.set(oo)}const p0=ht(oo,t=>(_0(),function(){}));let ao={},bs;async function d0(){bs&&(clearTimeout(bs),bs=0),ao=await(await Dl("tariff.json")).json(),h0.set(ao);let e=new Date;bs=setTimeout(d0,(60-e.getMinutes())*6e4+30)}const h0=ht(ao,t=>function(){});let ro=[];const Ao=ht(ro);async function Qc(){ro=await(await Dl("https://api.github.com/repos/UtilitechAS/amsreader-firmware/releases")).json(),Ao.set(ro)}let uo={};async function Xc(){uo=await(await Dl("realtime.json")).json(),v0.set(uo)}const v0=ht(uo,t=>(Xc(),function(){}));function Ts(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 b0(t){await(await fetch("upgrade?expected_version="+t,{method:"POST"})).json()}function g0(t,e){if(/^v\d{1,2}\.\d{1,2}\.\d{1,2}$/.test(t)){let n=t.substring(1).split("."),l=parseInt(n[0]),i=parseInt(n[1]),o=parseInt(n[2]),u=[...e];u.reverse();let m,r,f;for(let p=0;p<u.length;p++){let _=u[p],v=_.tag_name.substring(1).split("."),d=parseInt(v[0]),g=parseInt(v[1]),k=parseInt(v[2]);if(d==l)g==i?k>o&&(m=_):g==i+1&&(r=_);else if(d==l+1)if(f){let $=f.tag_name.substring(1).split(".");parseInt($[0]);let N=parseInt($[1]);parseInt($[2]),g==N&&(f=_)}else f=_}return r||f||m||!1}else return e[0]}const Kr="/github.svg";function Yr(t){let e,n;function l(u,m){return u[1]>1?nm:u[1]>0?lm:u[2]>1?tm:u[2]>0?em:u[3]>1?xc:u[3]>0?Jc:Zc}let i=l(t),o=i(t);return{c(){e=E(`Up
|
|
`),o.c(),n=it()},m(u,m){M(u,e,m),o.m(u,m),M(u,n,m)},p(u,m){i===(i=l(u))&&o?o.p(u,m):(o.d(1),o=i(u),o&&(o.c(),o.m(n.parentNode,n)))},d(u){u&&y(e),o.d(u),u&&y(n)}}}function Zc(t){let e,n;return{c(){e=E(t[0]),n=E(" seconds")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&1&&X(e,l[0])},d(l){l&&y(e),l&&y(n)}}}function Jc(t){let e,n;return{c(){e=E(t[3]),n=E(" minute")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function xc(t){let e,n;return{c(){e=E(t[3]),n=E(" minutes")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&8&&X(e,l[3])},d(l){l&&y(e),l&&y(n)}}}function em(t){let e,n;return{c(){e=E(t[2]),n=E(" hour")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function tm(t){let e,n;return{c(){e=E(t[2]),n=E(" hours")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&4&&X(e,l[2])},d(l){l&&y(e),l&&y(n)}}}function lm(t){let e,n;return{c(){e=E(t[1]),n=E(" day")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function nm(t){let e,n;return{c(){e=E(t[1]),n=E(" days")},m(l,i){M(l,e,i),M(l,n,i)},p(l,i){i&2&&X(e,l[1])},d(l){l&&y(e),l&&y(n)}}}function im(t){let e,n=t[0]&&Yr(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=Yr(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function sm(t,e,n){let{epoch:l}=e,i=0,o=0,u=0;return t.$$set=m=>{"epoch"in m&&n(0,l=m.epoch)},t.$$.update=()=>{t.$$.dirty&1&&(n(1,i=Math.floor(l/86400)),n(2,o=Math.floor(l/3600)),n(3,u=Math.floor(l/60)))},[l,i,o,u]}class om extends We{constructor(e){super(),He(this,e,sm,im,Be,{epoch:0})}}function am(t){let e,n,l;return{c(){e=c("span"),n=E(t[2]),a(e,"title",t[1]),a(e,"class",l="bd-"+t[0])},m(i,o){M(i,e,o),s(e,n)},p(i,[o]){o&4&&X(n,i[2]),o&2&&a(e,"title",i[1]),o&1&&l!==(l="bd-"+i[0])&&a(e,"class",l)},i:be,o:be,d(i){i&&y(e)}}}function rm(t,e,n){let{color:l}=e,{title:i}=e,{text:o}=e;return t.$$set=u=>{"color"in u&&n(0,l=u.color),"title"in u&&n(1,i=u.title),"text"in u&&n(2,o=u.text)},[l,i,o]}class fn extends We{constructor(e){super(),He(this,e,rm,am,Be,{color:0,title:1,text:2})}}function um(t){let e,n=`${Ye(t[0].getDate())}.${Ye(t[0].getMonth()+1)}.${t[0].getFullYear()} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,l;return{c(){e=c("span"),l=E(n),a(e,"class",t[1])},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&1&&n!==(n=`${Ye(i[0].getDate())}.${Ye(i[0].getMonth()+1)}.${i[0].getFullYear()} ${Ye(i[0].getHours())}:${Ye(i[0].getMinutes())}`)&&X(l,n),o&2&&a(e,"class",i[1])},d(i){i&&y(e)}}}function fm(t){let e=`${Ye(t[0].getDate())}. ${Ti[t[0].getMonth()]} ${Ye(t[0].getHours())}:${Ye(t[0].getMinutes())}`,n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&1&&e!==(e=`${Ye(l[0].getDate())}. ${Ti[l[0].getMonth()]} ${Ye(l[0].getHours())}:${Ye(l[0].getMinutes())}`)&&X(n,e)},d(l){l&&y(n)}}}function cm(t){let e;function n(o,u){return o[2]?fm:um}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,[u]){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},i:be,o:be,d(o){i.d(o),o&&y(e)}}}function mm(t,e,n){let{timestamp:l}=e,{fullTimeColor:i}=e,{offset:o}=e,u;return t.$$set=m=>{"timestamp"in m&&n(0,l=m.timestamp),"fullTimeColor"in m&&n(1,i=m.fullTimeColor),"offset"in m&&n(3,o=m.offset)},t.$$.update=()=>{t.$$.dirty&9&&(n(2,u=Math.abs(new Date().getTime()-l.getTime())<3e5),isNaN(o)||wl(l,o-(24+l.getHours()-l.getUTCHours())%24))},[l,i,u,o]}class k0 extends We{constructor(e){super(),He(this,e,mm,cm,Be,{timestamp:0,fullTimeColor:1,offset:3})}}function _m(t){let e,n,l;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(l,"stroke-linecap","round"),a(l,"stroke-linejoin","round"),a(l,"d","M15 12a3 3 0 11-6 0 3 3 0 016 0z"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(i,o){M(i,e,o),s(e,n),s(e,l)},p:be,i:be,o:be,d(i){i&&y(e)}}}class pm extends We{constructor(e){super(),He(this,e,null,_m,Be,{})}}function dm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class hm extends We{constructor(e){super(),He(this,e,null,dm,Be,{})}}function vm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class Ht extends We{constructor(e){super(),He(this,e,null,vm,Be,{})}}function bm(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-6 h-6")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class w0 extends We{constructor(e){super(),He(this,e,null,bm,Be,{})}}function gm(t){let e,n,l=t[2].version+"",i;return{c(){e=E("AMS reader "),n=c("span"),i=E(l)},m(o,u){M(o,e,u),M(o,n,u),s(n,i)},p(o,u){u&4&&l!==(l=o[2].version+"")&&X(i,l)},d(o){o&&y(e),o&&y(n)}}}function Qr(t){let e,n=(t[1].t>-50?t[1].t.toFixed(1):"-")+"",l,i;return{c(){e=c("div"),l=E(n),i=E("\xB0C"),a(e,"class","flex-none my-auto")},m(o,u){M(o,e,u),s(e,l),s(e,i)},p(o,u){u&2&&n!==(n=(o[1].t>-50?o[1].t.toFixed(1):"-")+"")&&X(l,n)},d(o){o&&y(e)}}}function Xr(t){let e,n="HAN: "+qr(t[1].he),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="HAN: "+qr(i[1].he))&&X(l,n)},d(i){i&&y(e)}}}function Zr(t){let e,n="MQTT: "+Br(t[1].me),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="MQTT: "+Br(i[1].me))&&X(l,n)},d(i){i&&y(e)}}}function Jr(t){let e,n="Price service: "+Ur(t[1].ee),l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n="Price service: "+Ur(i[1].ee))&&X(l,n)},d(i){i&&y(e)}}}function xr(t){let e,n,l,i,o,u;return n=new el({props:{to:"/configuration",$$slots:{default:[km]},$$scope:{ctx:t}}}),o=new el({props:{to:"/status",$$slots:{default:[wm]},$$scope:{ctx:t}}}),{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("div"),ae(o.$$.fragment),a(e,"class","flex-none px-1 mt-1"),a(e,"title","Configuration"),a(i,"class","flex-none px-1 mt-1"),a(i,"title","Device information")},m(m,r){M(m,e,r),se(n,e,null),M(m,l,r),M(m,i,r),se(o,i,null),u=!0},i(m){u||(L(n.$$.fragment,m),L(o.$$.fragment,m),u=!0)},o(m){q(n.$$.fragment,m),q(o.$$.fragment,m),u=!1},d(m){m&&y(e),oe(n),m&&y(l),m&&y(i),oe(o)}}}function km(t){let e,n;return e=new pm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function wm(t){let e,n;return e=new hm({}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function eu(t){let e,n,l,i,o;const u=[ym,Cm],m=[];function r(f,p){return f[2].security==0||f[1].a?0:1}return n=r(t),l=m[n]=u[n](t),{c(){e=c("div"),l.c(),a(e,"class","flex-none mr-3 text-yellow-500"),a(e,"title",i="New version: "+t[3].tag_name)},m(f,p){M(f,e,p),m[n].m(e,null),o=!0},p(f,p){let _=n;n=r(f),n===_?m[n].p(f,p):($e(),q(m[_],1,1,()=>{m[_]=null}),De(),l=m[n],l?l.p(f,p):(l=m[n]=u[n](f),l.c()),L(l,1),l.m(e,null)),(!o||p&8&&i!==(i="New version: "+f[3].tag_name))&&a(e,"title",i)},i(f){o||(L(l),o=!0)},o(f){q(l),o=!1},d(f){f&&y(e),m[n].d()}}}function Cm(t){let e,n,l=t[3].tag_name+"",i;return{c(){e=c("span"),n=E("New version: "),i=E(l)},m(o,u){M(o,e,u),s(e,n),s(e,i)},p(o,u){u&8&&l!==(l=o[3].tag_name+"")&&X(i,l)},i:be,o:be,d(o){o&&y(e)}}}function ym(t){let e,n,l,i=t[3].tag_name+"",o,u,m,r,f,p;return m=new w0({}),{c(){e=c("button"),n=c("span"),l=E("New version: "),o=E(i),u=b(),ae(m.$$.fragment),a(n,"class","mt-1"),a(e,"class","flex")},m(_,h){M(_,e,h),s(e,n),s(n,l),s(n,o),s(e,u),se(m,e,null),r=!0,f||(p=Q(e,"click",t[4]),f=!0)},p(_,h){(!r||h&8)&&i!==(i=_[3].tag_name+"")&&X(o,i)},i(_){r||(L(m.$$.fragment,_),r=!0)},o(_){q(m.$$.fragment,_),r=!1},d(_){_&&y(e),oe(m),f=!1,p()}}}function Mm(t){let e,n,l,i,o,u,m,r,f,p,_,h,v=(t[1].m?(t[1].m/1e3).toFixed(1):"-")+"",d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me;i=new el({props:{to:"/",$$slots:{default:[gm]},$$scope:{ctx:t}}}),r=new om({props:{epoch:t[1].u}});let te=t[1].t>-50&&Qr(t);N=new fn({props:{title:"ESP",text:t[2].booting?"Booting":t[1].v>2?t[1].v.toFixed(2)+"V":"ESP",color:jl(t[2].booting?2:t[1].em)}}),F=new fn({props:{title:"HAN",text:"HAN",color:jl(t[2].booting?9:t[1].hm)}}),R=new fn({props:{title:"WiFi",text:t[1].r?t[1].r.toFixed(0)+"dBm":"WiFi",color:jl(t[2].booting?9:t[1].wm)}}),P=new fn({props:{title:"MQTT",text:"MQTT",color:jl(t[2].booting?9:t[1].mm)}});let fe=(t[1].he<0||t[1].he>0)&&Xr(t),Oe=t[1].me<0&&Zr(t),Ie=(t[1].ee>0||t[1].ee<0)&&Jr(t);_e=new k0({props:{timestamp:t[1].c?new Date(t[1].c*1e3):new Date(0),offset:t[2].clock_offset,fullTimeColor:"text-red-500"}});let T=t[2].vndcfg&&t[2].usrcfg&&xr(t);Ee=new Ht({});let w=t[2].fwconsent===1&&t[3]&&eu(t);return{c(){e=c("nav"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=c("div"),ae(r.$$.fragment),f=b(),te&&te.c(),p=b(),_=c("div"),h=E("Free mem: "),d=E(v),g=E("kb"),k=b(),$=c("div"),ae(N.$$.fragment),A=b(),ae(F.$$.fragment),I=b(),ae(R.$$.fragment),C=b(),ae(P.$$.fragment),ne=b(),fe&&fe.c(),j=b(),Oe&&Oe.c(),B=b(),Ie&&Ie.c(),H=b(),V=c("div"),G=c("div"),K=c("a"),Z=c("img"),W=b(),x=c("div"),ae(_e.$$.fragment),ie=b(),T&&T.c(),me=b(),Y=c("div"),ke=c("a"),ae(Ee.$$.fragment),we=b(),w&&w.c(),a(l,"class","flex text-lg text-gray-100 p-2"),a(m,"class","flex-none my-auto"),a(_,"class","flex-none my-auto"),a(u,"class","flex-none my-auto p-2 flex space-x-4"),a($,"class","flex-auto flex-wrap my-auto justify-center p-2"),a(Z,"class","gh-logo"),ks(Z.src,z=t[0]+Kr)||a(Z,"src",z),a(Z,"alt","GitHub repo"),a(K,"class","float-right"),a(K,"href","https://github.com/UtilitechAS/amsreader-firmware"),a(K,"target","_blank"),a(K,"rel","noreferrer"),a(K,"aria-label","GitHub"),a(G,"class","flex-none"),a(x,"class","flex-none my-auto px-2"),a(ke,"href",Wt("")),a(ke,"target","_blank"),a(ke,"rel","noreferrer"),a(Y,"class","flex-none px-1 mt-1"),a(Y,"title","Documentation"),a(V,"class","flex-auto p-2 flex flex-row-reverse flex-wrap"),a(n,"class","flex flex-wrap space-x-4 text-sm text-gray-300"),a(e,"class","hdr")},m(S,D){M(S,e,D),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,m),se(r,m,null),s(u,f),te&&te.m(u,null),s(u,p),s(u,_),s(_,h),s(_,d),s(_,g),s(n,k),s(n,$),se(N,$,null),s($,A),se(F,$,null),s($,I),se(R,$,null),s($,C),se(P,$,null),s(n,ne),fe&&fe.m(n,null),s(n,j),Oe&&Oe.m(n,null),s(n,B),Ie&&Ie.m(n,null),s(n,H),s(n,V),s(V,G),s(G,K),s(K,Z),s(V,W),s(V,x),se(_e,x,null),s(V,ie),T&&T.m(V,null),s(V,me),s(V,Y),s(Y,ke),se(Ee,ke,null),s(V,we),w&&w.m(V,null),Me=!0},p(S,[D]){const O={};D&36&&(O.$$scope={dirty:D,ctx:S}),i.$set(O);const J={};D&2&&(J.epoch=S[1].u),r.$set(J),S[1].t>-50?te?te.p(S,D):(te=Qr(S),te.c(),te.m(u,p)):te&&(te.d(1),te=null),(!Me||D&2)&&v!==(v=(S[1].m?(S[1].m/1e3).toFixed(1):"-")+"")&&X(d,v);const le={};D&6&&(le.text=S[2].booting?"Booting":S[1].v>2?S[1].v.toFixed(2)+"V":"ESP"),D&6&&(le.color=jl(S[2].booting?2:S[1].em)),N.$set(le);const pe={};D&6&&(pe.color=jl(S[2].booting?9:S[1].hm)),F.$set(pe);const ge={};D&2&&(ge.text=S[1].r?S[1].r.toFixed(0)+"dBm":"WiFi"),D&6&&(ge.color=jl(S[2].booting?9:S[1].wm)),R.$set(ge);const Ae={};D&6&&(Ae.color=jl(S[2].booting?9:S[1].mm)),P.$set(Ae),S[1].he<0||S[1].he>0?fe?fe.p(S,D):(fe=Xr(S),fe.c(),fe.m(n,j)):fe&&(fe.d(1),fe=null),S[1].me<0?Oe?Oe.p(S,D):(Oe=Zr(S),Oe.c(),Oe.m(n,B)):Oe&&(Oe.d(1),Oe=null),S[1].ee>0||S[1].ee<0?Ie?Ie.p(S,D):(Ie=Jr(S),Ie.c(),Ie.m(n,H)):Ie&&(Ie.d(1),Ie=null),(!Me||D&1&&!ks(Z.src,z=S[0]+Kr))&&a(Z,"src",z);const Fe={};D&2&&(Fe.timestamp=S[1].c?new Date(S[1].c*1e3):new Date(0)),D&4&&(Fe.offset=S[2].clock_offset),_e.$set(Fe),S[2].vndcfg&&S[2].usrcfg?T?D&4&&L(T,1):(T=xr(S),T.c(),L(T,1),T.m(V,me)):T&&($e(),q(T,1,1,()=>{T=null}),De()),S[2].fwconsent===1&&S[3]?w?(w.p(S,D),D&12&&L(w,1)):(w=eu(S),w.c(),L(w,1),w.m(V,null)):w&&($e(),q(w,1,1,()=>{w=null}),De())},i(S){Me||(L(i.$$.fragment,S),L(r.$$.fragment,S),L(N.$$.fragment,S),L(F.$$.fragment,S),L(R.$$.fragment,S),L(P.$$.fragment,S),L(_e.$$.fragment,S),L(T),L(Ee.$$.fragment,S),L(w),Me=!0)},o(S){q(i.$$.fragment,S),q(r.$$.fragment,S),q(N.$$.fragment,S),q(F.$$.fragment,S),q(R.$$.fragment,S),q(P.$$.fragment,S),q(_e.$$.fragment,S),q(T),q(Ee.$$.fragment,S),q(w),Me=!1},d(S){S&&y(e),oe(i),oe(r),te&&te.d(),oe(N),oe(F),oe(R),oe(P),fe&&fe.d(),Oe&&Oe.d(),Ie&&Ie.d(),oe(_e),T&&T.d(),oe(Ee),w&&w.d()}}}function Sm(t,e,n){let{basepath:l="/"}=e,{data:i={}}=e,o={},u={};function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(!ni(o.board)||confirm(Ts(Ce(o.chip,o.board))))&&(Tt.update(r=>(r.upgrading=!0,r)),b0(u.tag_name))}return Tt.subscribe(r=>{n(2,o=r),r.fwconsent===1&&Qc()}),Ao.subscribe(r=>{n(3,u=g0(o.version,r))}),t.$$set=r=>{"basepath"in r&&n(0,l=r.basepath),"data"in r&&n(1,i=r.data)},[l,i,o,u,m]}class Tm extends We{constructor(e){super(),He(this,e,Sm,Mm,Be,{basepath:0,data:1})}}function Nm(t){let e,n,l,i;return{c(){e=je("svg"),n=je("path"),l=je("path"),a(n,"d",Js(150,150,115,210,510)),a(n,"stroke","rgba(128, 128, 128, 0.15)"),a(n,"fill","none"),a(n,"stroke-width","55"),a(l,"d",i=Js(150,150,115,210,210+300*t[0]/100)),a(l,"stroke",t[1]),a(l,"fill","none"),a(l,"stroke-width","55"),a(e,"viewBox","0 0 300 300"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"height","100%")},m(o,u){M(o,e,u),s(e,n),s(e,l)},p(o,[u]){u&1&&i!==(i=Js(150,150,115,210,210+300*o[0]/100))&&a(l,"d",i),u&2&&a(l,"stroke",o[1])},i:be,o:be,d(o){o&&y(e)}}}function tu(t,e,n,l){var i=(l-90)*Math.PI/180;return{x:t+n*Math.cos(i),y:e+n*Math.sin(i)}}function Js(t,e,n,l,i){var o=tu(t,e,n,i),u=tu(t,e,n,l),m=i-l<=180?"0":"1",r=["M",o.x,o.y,"A",n,n,0,m,0,u.x,u.y].join(" ");return r}function Em(t,e,n){let{pct:l=0}=e,{color:i="red"}=e;return t.$$set=o=>{"pct"in o&&n(0,l=o.pct),"color"in o&&n(1,i=o.color)},[l,i]}class Pm extends We{constructor(e){super(),He(this,e,Em,Nm,Be,{pct:0,color:1})}}function lu(t){let e,n,l,i,o,u,m,r;return{c(){e=c("br"),n=b(),l=c("span"),i=E(t[3]),o=b(),u=c("span"),m=E(t[4]),r=E("/kWh"),a(l,"class","pl-sub"),a(u,"class","pl-snt")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),M(f,o,p),M(f,u,p),s(u,m),s(u,r)},p(f,p){p&8&&X(i,f[3]),p&16&&X(m,f[4])},d(f){f&&y(e),f&&y(n),f&&y(l),f&&y(o),f&&y(u)}}}function Am(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k;n=new Pm({props:{pct:t[6],color:t[5](t[6],document.documentElement.classList.contains("dark"))}});let $=t[3]&&lu(t);return{c(){e=c("div"),ae(n.$$.fragment),l=b(),i=c("span"),o=c("span"),u=E(t[2]),m=b(),r=c("br"),f=b(),p=c("span"),_=E(t[0]),h=b(),v=c("span"),d=E(t[1]),g=b(),$&&$.c(),a(o,"class","pl-lab"),a(p,"class","pl-val"),a(v,"class","pl-unt"),a(i,"class","pl-ov"),a(e,"class","pl-root")},m(N,A){M(N,e,A),se(n,e,null),s(e,l),s(e,i),s(i,o),s(o,u),s(i,m),s(i,r),s(i,f),s(i,p),s(p,_),s(i,h),s(i,v),s(v,d),s(i,g),$&&$.m(i,null),k=!0},p(N,[A]){const F={};A&64&&(F.pct=N[6]),A&96&&(F.color=N[5](N[6],document.documentElement.classList.contains("dark"))),n.$set(F),(!k||A&4)&&X(u,N[2]),(!k||A&1)&&X(_,N[0]),(!k||A&2)&&X(d,N[1]),N[3]?$?$.p(N,A):($=lu(N),$.c(),$.m(i,null)):$&&($.d(1),$=null)},i(N){k||(L(n.$$.fragment,N),k=!0)},o(N){q(n.$$.fragment,N),k=!1},d(N){N&&y(e),oe(n),$&&$.d()}}}function $m(t,e,n){let{val:l}=e,{max:i}=e,{unit:o}=e,{label:u}=e,{sub:m=""}=e,{subunit:r=""}=e,{colorFn:f}=e,p=0;return t.$$set=_=>{"val"in _&&n(0,l=_.val),"max"in _&&n(7,i=_.max),"unit"in _&&n(1,o=_.unit),"label"in _&&n(2,u=_.label),"sub"in _&&n(3,m=_.sub),"subunit"in _&&n(4,r=_.subunit),"colorFn"in _&&n(5,f=_.colorFn)},t.$$.update=()=>{t.$$.dirty&129&&n(6,p=Math.min(l,i)/i*100)},[l,o,u,m,r,f,p,i]}class C0 extends We{constructor(e){super(),He(this,e,$m,Am,Be,{val:0,max:7,unit:1,label:2,sub:3,subunit:4,colorFn:5})}}function nu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function iu(t,e,n){const l=t.slice();return l[11]=e[n],l[13]=n,l}function su(t,e,n){const l=t.slice();return l[15]=e[n],l}function ou(t){let e,n,l,i,o,u,m=t[0].title&&au(t),r=t[0].y.ticks,f=[];for(let d=0;d<r.length;d+=1)f[d]=uu(su(t,r,d));let p=t[0].x.ticks,_=[];for(let d=0;d<p.length;d+=1)_[d]=mu(iu(t,p,d));let h=t[0].points,v=[];for(let d=0;d<h.length;d+=1)v[d]=ku(nu(t,h,d));return{c(){m&&m.c(),e=b(),n=je("svg"),l=je("g");for(let d=0;d<f.length;d+=1)f[d].c();i=je("g");for(let d=0;d<_.length;d+=1)_[d].c();o=je("g");for(let d=0;d<v.length;d+=1)v[d].c();a(l,"class","axis y-axis"),a(i,"class","axis x-axis"),a(o,"class","bars"),a(n,"xmlns","http://www.w3.org/2000/svg"),a(n,"viewBox",u="0 0 "+t[1]+" "+t[4])},m(d,g){m&&m.m(d,g),M(d,e,g),M(d,n,g),s(n,l);for(let k=0;k<f.length;k+=1)f[k]&&f[k].m(l,null);s(n,i);for(let k=0;k<_.length;k+=1)_[k]&&_[k].m(i,null);s(n,o);for(let k=0;k<v.length;k+=1)v[k]&&v[k].m(o,null)},p(d,g){if(d[0].title?m?m.p(d,g):(m=au(d),m.c(),m.m(e.parentNode,e)):m&&(m.d(1),m=null),g&129){r=d[0].y.ticks;let k;for(k=0;k<r.length;k+=1){const $=su(d,r,k);f[k]?f[k].p($,g):(f[k]=uu($),f[k].c(),f[k].m(l,null))}for(;k<f.length;k+=1)f[k].d(1);f.length=r.length}if(g&89){p=d[0].x.ticks;let k;for(k=0;k<p.length;k+=1){const $=iu(d,p,k);_[k]?_[k].p($,g):(_[k]=mu($),_[k].c(),_[k].m(i,null))}for(;k<_.length;k+=1)_[k].d(1);_.length=p.length}if(g&457){h=d[0].points;let k;for(k=0;k<h.length;k+=1){const $=nu(d,h,k);v[k]?v[k].p($,g):(v[k]=ku($),v[k].c(),v[k].m(o,null))}for(;k<v.length;k+=1)v[k].d(1);v.length=h.length}g&18&&u!==(u="0 0 "+d[1]+" "+d[4])&&a(n,"viewBox",u)},d(d){m&&m.d(d),d&&y(e),d&&y(n),mt(f,d),mt(_,d),mt(v,d)}}}function au(t){let e,n=t[0].title+"",l,i;return{c(){e=c("div"),l=E(n),a(e,"class","text-sm font-bold"),Ze(()=>t[9].call(e))},m(o,u){M(o,e,u),s(e,l),i=ko(e,t[9].bind(e))},p(o,u){u&1&&n!==(n=o[0].title+"")&&X(l,n)},d(o){o&&y(e),i()}}}function ru(t){let e,n,l,i=t[15].label+"",o,u,m,r;return{c(){e=je("g"),n=je("line"),l=je("text"),o=E(i),a(n,"x2","100%"),a(l,"y","-4"),a(l,"x",u=t[15].align=="right"?"85%":""),a(e,"class",m="tick tick-"+t[15].value+" tick-"+t[15].color),a(e,"transform",r="translate(0, "+t[7](t[15].value)+")")},m(f,p){M(f,e,p),s(e,n),s(e,l),s(l,o)},p(f,p){p&1&&i!==(i=f[15].label+"")&&X(o,i),p&1&&u!==(u=f[15].align=="right"?"85%":"")&&a(l,"x",u),p&1&&m!==(m="tick tick-"+f[15].value+" tick-"+f[15].color)&&a(e,"class",m),p&129&&r!==(r="translate(0, "+f[7](f[15].value)+")")&&a(e,"transform",r)},d(f){f&&y(e)}}}function uu(t){let e=!isNaN(t[7](t[15].value)),n,l=e&&ru(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&129&&(e=!isNaN(i[7](i[15].value))),e?l?l.p(i,o):(l=ru(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function fu(t){let e,n,l=(t[3]>20||t[13]%2==0)&&cu(t);return{c(){e=je("g"),l&&l.c(),a(e,"class","tick"),a(e,"transform",n="translate("+t[6](t[13])+","+t[4]+")")},m(i,o){M(i,e,o),l&&l.m(e,null)},p(i,o){i[3]>20||i[13]%2==0?l?l.p(i,o):(l=cu(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o&80&&n!==(n="translate("+i[6](i[13])+","+i[4]+")")&&a(e,"transform",n)},d(i){i&&y(e),l&&l.d()}}}function cu(t){let e,n=t[11].label+"",l,i;return{c(){e=je("text"),l=E(n),a(e,"x",i=t[3]/2),a(e,"y","-4")},m(o,u){M(o,e,u),s(e,l)},p(o,u){u&1&&n!==(n=o[11].label+"")&&X(l,n),u&8&&i!==(i=o[3]/2)&&a(e,"x",i)},d(o){o&&y(e)}}}function mu(t){let e=!isNaN(t[6](t[13])),n,l=e&&fu(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&64&&(e=!isNaN(i[6](i[13]))),e?l?l.p(i,o):(l=fu(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function _u(t){let e,n,l=t[11].value!==void 0&&pu(t),i=t[11].value2>1e-4&&vu(t);return{c(){e=je("g"),l&&l.c(),n=je("g"),i&&i.c()},m(o,u){M(o,e,u),l&&l.m(e,null),M(o,n,u),i&&i.m(n,null)},p(o,u){o[11].value!==void 0?l?l.p(o,u):(l=pu(o),l.c(),l.m(e,null)):l&&(l.d(1),l=null),o[11].value2>1e-4?i?i.p(o,u):(i=vu(o),i.c(),i.m(n,null)):i&&(i.d(1),i=null)},d(o){o&&y(e),l&&l.d(),o&&y(n),i&&i.d()}}}function pu(t){let e,n,l,i,o,u,m,r=t[3]>15&&du(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](t[11].value)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](Math.min(t[0].y.min,0)+t[11].value)),a(e,"fill",u=t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&129&&l!==(l=f[7](f[11].value))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](Math.min(f[0].y.min,0)+f[11].value))&&a(e,"height",o),p&1&&u!==(u=f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=du(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function du(t){let e,n=t[11].label+"",l,i,o,u,m,r,f=t[11].title&&hu(t);return{c(){e=je("text"),l=E(n),f&&f.c(),r=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor",o=t[3]<cn||t[11].labelAngle?"left":"middle"),a(e,"fill",u=t[7](t[11].value)>t[7](0)-t[8]?t[11].color:"white"),a(e,"transform",m="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](t[11].value)>t[7](0)-t[8]?t[7](t[11].value)-t[8]:t[7](t[11].value)+10)+") rotate("+(t[11].labelAngle?t[11].labelAngle:t[3]<cn?90:0)+")")},m(p,_){M(p,e,_),s(e,l),f&&f.m(p,_),M(p,r,_)},p(p,_){_&1&&n!==(n=p[11].label+"")&&X(l,n),_&8&&i!==(i=p[3]-4)&&a(e,"width",i),_&9&&o!==(o=p[3]<cn||p[11].labelAngle?"left":"middle")&&a(e,"text-anchor",o),_&385&&u!==(u=p[7](p[11].value)>p[7](0)-p[8]?p[11].color:"white")&&a(e,"fill",u),_&457&&m!==(m="translate("+(p[6](p[13])+p[3]/2)+" "+(p[7](p[11].value)>p[7](0)-p[8]?p[7](p[11].value)-p[8]:p[7](p[11].value)+10)+") rotate("+(p[11].labelAngle?p[11].labelAngle:p[3]<cn?90:0)+")")&&a(e,"transform",m),p[11].title?f?f.p(p,_):(f=hu(p),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},d(p){p&&y(e),f&&f.d(p),p&&y(r)}}}function hu(t){let e,n=t[11].title+"",l;return{c(){e=je("title"),l=E(n)},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&1&&n!==(n=i[11].title+"")&&X(l,n)},d(i){i&&y(e)}}}function vu(t){let e,n,l,i,o,u,m,r=t[3]>15&&bu(t);return{c(){e=je("rect"),r&&r.c(),m=it(),a(e,"x",n=t[6](t[13])+2),a(e,"y",l=t[7](0)),a(e,"width",i=t[3]-4),a(e,"height",o=t[7](t[0].y.min)-t[7](t[0].y.min+t[11].value2)),a(e,"fill",u=t[11].color2?t[11].color2:t[11].color)},m(f,p){M(f,e,p),r&&r.m(f,p),M(f,m,p)},p(f,p){p&64&&n!==(n=f[6](f[13])+2)&&a(e,"x",n),p&128&&l!==(l=f[7](0))&&a(e,"y",l),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](f[0].y.min)-f[7](f[0].y.min+f[11].value2))&&a(e,"height",o),p&1&&u!==(u=f[11].color2?f[11].color2:f[11].color)&&a(e,"fill",u),f[3]>15?r?r.p(f,p):(r=bu(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function bu(t){let e,n=t[11].label2+"",l,i,o,u,m,r=t[11].title2&&gu(t);return{c(){e=je("text"),l=E(n),r&&r.c(),m=it(),a(e,"width",i=t[3]-4),a(e,"dominant-baseline","middle"),a(e,"text-anchor","middle"),a(e,"fill",o=t[7](-t[11].value2)<t[7](0)+15?t[11].color2?t[11].color2:t[11].color:"white"),a(e,"transform",u="translate("+(t[6](t[13])+t[3]/2)+" "+(t[7](-t[11].value2)<t[7](0)+15?t[7](-t[11].value2)+15:t[7](-t[11].value2)-14)+") rotate("+(t[3]<cn?90:0)+")")},m(f,p){M(f,e,p),s(e,l),r&&r.m(f,p),M(f,m,p)},p(f,p){p&1&&n!==(n=f[11].label2+"")&&X(l,n),p&8&&i!==(i=f[3]-4)&&a(e,"width",i),p&129&&o!==(o=f[7](-f[11].value2)<f[7](0)+15?f[11].color2?f[11].color2:f[11].color:"white")&&a(e,"fill",o),p&201&&u!==(u="translate("+(f[6](f[13])+f[3]/2)+" "+(f[7](-f[11].value2)<f[7](0)+15?f[7](-f[11].value2)+15:f[7](-f[11].value2)-14)+") rotate("+(f[3]<cn?90:0)+")")&&a(e,"transform",u),f[11].title2?r?r.p(f,p):(r=gu(f),r.c(),r.m(m.parentNode,m)):r&&(r.d(1),r=null)},d(f){f&&y(e),r&&r.d(f),f&&y(m)}}}function gu(t){let e,n=t[11].title2+"",l;return{c(){e=je("title"),l=E(n)},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&1&&n!==(n=i[11].title2+"")&&X(l,n)},d(i){i&&y(e)}}}function ku(t){let e=!isNaN(t[6](t[13]))&&!isNaN(t[7](t[11].value)),n,l=e&&_u(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&193&&(e=!isNaN(i[6](i[13]))&&!isNaN(i[7](i[11].value))),e?l?l.p(i,o):(l=_u(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function Dm(t){let e,n,l=t[0].x.ticks&&t[0].points&&t[4]&&ou(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","chart"),Ze(()=>t[10].call(e))},m(i,o){M(i,e,o),l&&l.m(e,null),n=ko(e,t[10].bind(e))},p(i,[o]){i[0].x.ticks&&i[0].points&&i[4]?l?l.p(i,o):(l=ou(i),l.c(),l.m(e,null)):l&&(l.d(1),l=null)},i:be,o:be,d(i){i&&y(e),l&&l.d(),n()}}}let cn=30;function Lm(t,e,n){let{config:l}=e,i,o,u,m,r,f,p,_=0;function h(){_=this.clientHeight,n(5,_)}function v(){i=this.clientWidth,o=this.clientHeight,n(1,i),n(2,o)}return t.$$set=d=>{"config"in d&&n(0,l=d.config)},t.$$.update=()=>{if(t.$$.dirty&63){n(4,f=o-_);let d=i-(l.padding.left+l.padding.right);n(3,u=d/l.points.length),n(8,p=u<cn?30:15);let g=(f-l.padding.top-l.padding.bottom)/(l.y.max-l.y.min);n(6,m=function(k){return k*u+l.padding.left}),n(7,r=function(k){let $=0;return k>l.y.max?$=l.padding.bottom:k<l.y.min?$=f-l.padding.bottom:$=f-l.padding.bottom-(k-l.y.min)*g,$>f||$<0?0:$})}},[l,i,o,u,f,_,m,r,p,h,v]}class pn extends We{constructor(e){super(),He(this,e,Lm,Dm,Be,{config:0})}}function Im(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rm(t,e,n){let{u1:l}=e,{u2:i}=e,{u3:o}=e,{ds:u}=e,m={};function r(f){return{label:Ne(f)+"V",title:f.toFixed(1)+" V",value:isNaN(f)?0:f,color:Kc(f||0,document.documentElement.classList.contains("dark"))}}return t.$$set=f=>{"u1"in f&&n(1,l=f.u1),"u2"in f&&n(2,i=f.u2),"u3"in f&&n(3,o=f.u3),"ds"in f&&n(4,u=f.ds)},t.$$.update=()=>{if(t.$$.dirty&30){let f=[],p=[];l>0&&(f.push({label:u===1?"L1-L2":"L1"}),p.push(r(l))),i>0&&(f.push({label:u===1?"L1-L3":"L2"}),p.push(r(i))),o>0&&(f.push({label:u===1?"L2-L3":"L3"}),p.push(r(o))),n(0,m={title:"Voltage",padding:{top:20,right:15,bottom:20,left:35},y:{min:200,max:260,ticks:[{value:207,label:"-10%"},{value:230,label:"230v"},{value:253,label:"+10%"}]},x:{ticks:f},points:p})}},[m,l,i,o,u]}class Fm extends We{constructor(e){super(),He(this,e,Rm,Im,Be,{u1:1,u2:2,u3:3,ds:4})}}function Om(t){let e,n,l,i,o,u,m,r=(typeof t[0]<"u"?t[0].toFixed(0):"-")+"",f,p,_,h,v,d,g=(typeof t[1]<"u"?t[1].toFixed(0):"-")+"",k,$,N,A,F,I,R,C=(typeof t[2]<"u"?t[2].toFixed(1):"-")+"",P,ne,j,B,H,V,G=(typeof t[3]<"u"?t[3].toFixed(1):"-")+"",K,Z;return{c(){e=c("div"),n=c("strong"),n.textContent="Reactive",l=b(),i=c("div"),o=c("div"),o.textContent="Instant in",u=b(),m=c("div"),f=E(r),p=E(" VAr"),_=b(),h=c("div"),h.textContent="Instant out",v=b(),d=c("div"),k=E(g),$=E(" VAr"),N=b(),A=c("div"),F=c("div"),F.textContent="Total in",I=b(),R=c("div"),P=E(C),ne=E(" kVArh"),j=b(),B=c("div"),B.textContent="Total out",H=b(),V=c("div"),K=E(G),Z=E(" kVArh"),a(m,"class","text-right"),a(d,"class","text-right"),a(i,"class","grid grid-cols-2 mt-4"),a(R,"class","text-right"),a(V,"class","text-right"),a(A,"class","grid grid-cols-2 mt-4"),a(e,"class","mx-2 text-sm")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),s(i,o),s(i,u),s(i,m),s(m,f),s(m,p),s(i,_),s(i,h),s(i,v),s(i,d),s(d,k),s(d,$),s(e,N),s(e,A),s(A,F),s(A,I),s(A,R),s(R,P),s(R,ne),s(A,j),s(A,B),s(A,H),s(A,V),s(V,K),s(V,Z)},p(z,[W]){W&1&&r!==(r=(typeof z[0]<"u"?z[0].toFixed(0):"-")+"")&&X(f,r),W&2&&g!==(g=(typeof z[1]<"u"?z[1].toFixed(0):"-")+"")&&X(k,g),W&4&&C!==(C=(typeof z[2]<"u"?z[2].toFixed(1):"-")+"")&&X(P,C),W&8&&G!==(G=(typeof z[3]<"u"?z[3].toFixed(1):"-")+"")&&X(K,G)},i:be,o:be,d(z){z&&y(e)}}}function qm(t,e,n){let{importInstant:l}=e,{exportInstant:i}=e,{importTotal:o}=e,{exportTotal:u}=e;return t.$$set=m=>{"importInstant"in m&&n(0,l=m.importInstant),"exportInstant"in m&&n(1,i=m.exportInstant),"importTotal"in m&&n(2,o=m.importTotal),"exportTotal"in m&&n(3,u=m.exportTotal)},[l,i,o,u]}class Bm extends We{constructor(e){super(),He(this,e,qm,Om,Be,{importInstant:0,exportInstant:1,importTotal:2,exportTotal:3})}}function wu(t){let e;function n(o,u){return o[3]?jm:Um}let l=n(t),i=l(t);return{c(){i.c(),e=it()},m(o,u){i.m(o,u),M(o,e,u)},p(o,u){l===(l=n(o))&&i?i.p(o,u):(i.d(1),i=l(o),i&&(i.c(),i.m(e.parentNode,e)))},d(o){i.d(o),o&&y(e)}}}function Um(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,h,v,d=Ne(t[1].d.u,1)+"",g,k,$,N,A,F,I=Ne(t[1].m.u)+"",R,C,P,ne,j,B,H=Ne(t[0].last_month.u)+"",V,G,K,Z,z=t[4]&&Cu(t);return{c(){e=c("strong"),e.textContent="Consumption",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),_=c("div"),_.textContent="Day",h=b(),v=c("div"),g=E(d),k=E(" kWh"),$=b(),N=c("div"),N.textContent="Month",A=b(),F=c("div"),R=E(I),C=E(" kWh"),P=b(),ne=c("div"),ne.textContent="Last month",j=b(),B=c("div"),V=E(H),G=E(" kWh"),K=b(),z&&z.c(),Z=it(),a(u,"class","text-right"),a(v,"class","text-right"),a(F,"class","text-right"),a(B,"class","text-right"),a(l,"class","grid grid-cols-2 mb-3")},m(W,x){M(W,e,x),M(W,n,x),M(W,l,x),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),s(l,_),s(l,h),s(l,v),s(v,g),s(v,k),s(l,$),s(l,N),s(l,A),s(l,F),s(F,R),s(F,C),s(l,P),s(l,ne),s(l,j),s(l,B),s(B,V),s(B,G),M(W,K,x),z&&z.m(W,x),M(W,Z,x)},p(W,x){x&2&&m!==(m=Ne(W[1].h.u,2)+"")&&X(r,m),x&2&&d!==(d=Ne(W[1].d.u,1)+"")&&X(g,d),x&2&&I!==(I=Ne(W[1].m.u)+"")&&X(R,I),x&1&&H!==(H=Ne(W[0].last_month.u)+"")&&X(V,H),W[4]?z?z.p(W,x):(z=Cu(W),z.c(),z.m(Z.parentNode,Z)):z&&(z.d(1),z=null)},d(W){W&&y(e),W&&y(n),W&&y(l),W&&y(K),z&&z.d(W),W&&y(Z)}}}function jm(t){let e,n,l,i,o,u,m=Ne(t[1].h.u,2)+"",r,f,p,_,h,v,d,g=Ne(t[1].d.u,1)+"",k,$,N,A,F,I,R,C=Ne(t[1].m.u)+"",P,ne,j,B,H,V,G,K=Ne(t[0].last_month.u)+"",Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me=Ne(t[1].h.p,2)+"",te,fe,Oe,Ie,T,w,S,D=Ne(t[1].d.p,1)+"",O,J,le,pe,ge,Ae,Fe,ce=Ne(t[1].m.p)+"",Pe,ze,_t,Ke,ut,Ge,pt,Ue=Ne(t[0].last_month.p)+"",At,dt,vt,xe,Re=t[4]&&yu(t),et=t[4]&&Mu(t),Le=t[4]&&Su(t),Je=t[4]&&Tu(t),at=t[4]&&Nu(t),qe=t[4]&&Eu(t),ye=t[4]&&Pu(t),ve=t[4]&&Au(t);return{c(){e=c("strong"),e.textContent="Import",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=E(" kWh"),p=b(),Re&&Re.c(),_=b(),h=c("div"),h.textContent="Day",v=b(),d=c("div"),k=E(g),$=E(" kWh"),N=b(),et&&et.c(),A=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),P=E(C),ne=E(" kWh"),j=b(),Le&&Le.c(),B=b(),H=c("div"),H.textContent="Last mo.",V=b(),G=c("div"),Z=E(K),z=E(" kWh"),W=b(),Je&&Je.c(),_e=b(),ie=c("strong"),ie.textContent="Export",me=b(),Y=c("div"),ke=c("div"),ke.textContent="Hour",Ee=b(),we=c("div"),te=E(Me),fe=E(" kWh"),Oe=b(),at&&at.c(),Ie=b(),T=c("div"),T.textContent="Day",w=b(),S=c("div"),O=E(D),J=E(" kWh"),le=b(),qe&&qe.c(),pe=b(),ge=c("div"),ge.textContent="Month",Ae=b(),Fe=c("div"),Pe=E(ce),ze=E(" kWh"),_t=b(),ye&&ye.c(),Ke=b(),ut=c("div"),ut.textContent="Last mo.",Ge=b(),pt=c("div"),At=E(Ue),dt=E(" kWh"),vt=b(),ve&&ve.c(),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(G,"class","text-right"),a(l,"class",x="grid grid-cols-"+t[5]+" mb-3"),a(we,"class","text-right"),a(S,"class","text-right"),a(Fe,"class","text-right"),a(pt,"class","text-right"),a(Y,"class",xe="grid grid-cols-"+t[5])},m(de,Ve){M(de,e,Ve),M(de,n,Ve),M(de,l,Ve),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(l,p),Re&&Re.m(l,null),s(l,_),s(l,h),s(l,v),s(l,d),s(d,k),s(d,$),s(l,N),et&&et.m(l,null),s(l,A),s(l,F),s(l,I),s(l,R),s(R,P),s(R,ne),s(l,j),Le&&Le.m(l,null),s(l,B),s(l,H),s(l,V),s(l,G),s(G,Z),s(G,z),s(l,W),Je&&Je.m(l,null),M(de,_e,Ve),M(de,ie,Ve),M(de,me,Ve),M(de,Y,Ve),s(Y,ke),s(Y,Ee),s(Y,we),s(we,te),s(we,fe),s(Y,Oe),at&&at.m(Y,null),s(Y,Ie),s(Y,T),s(Y,w),s(Y,S),s(S,O),s(S,J),s(Y,le),qe&&qe.m(Y,null),s(Y,pe),s(Y,ge),s(Y,Ae),s(Y,Fe),s(Fe,Pe),s(Fe,ze),s(Y,_t),ye&&ye.m(Y,null),s(Y,Ke),s(Y,ut),s(Y,Ge),s(Y,pt),s(pt,At),s(pt,dt),s(Y,vt),ve&&ve.m(Y,null)},p(de,Ve){Ve&2&&m!==(m=Ne(de[1].h.u,2)+"")&&X(r,m),de[4]?Re?Re.p(de,Ve):(Re=yu(de),Re.c(),Re.m(l,_)):Re&&(Re.d(1),Re=null),Ve&2&&g!==(g=Ne(de[1].d.u,1)+"")&&X(k,g),de[4]?et?et.p(de,Ve):(et=Mu(de),et.c(),et.m(l,A)):et&&(et.d(1),et=null),Ve&2&&C!==(C=Ne(de[1].m.u)+"")&&X(P,C),de[4]?Le?Le.p(de,Ve):(Le=Su(de),Le.c(),Le.m(l,B)):Le&&(Le.d(1),Le=null),Ve&1&&K!==(K=Ne(de[0].last_month.u)+"")&&X(Z,K),de[4]?Je?Je.p(de,Ve):(Je=Tu(de),Je.c(),Je.m(l,null)):Je&&(Je.d(1),Je=null),Ve&32&&x!==(x="grid grid-cols-"+de[5]+" mb-3")&&a(l,"class",x),Ve&2&&Me!==(Me=Ne(de[1].h.p,2)+"")&&X(te,Me),de[4]?at?at.p(de,Ve):(at=Nu(de),at.c(),at.m(Y,Ie)):at&&(at.d(1),at=null),Ve&2&&D!==(D=Ne(de[1].d.p,1)+"")&&X(O,D),de[4]?qe?qe.p(de,Ve):(qe=Eu(de),qe.c(),qe.m(Y,pe)):qe&&(qe.d(1),qe=null),Ve&2&&ce!==(ce=Ne(de[1].m.p)+"")&&X(Pe,ce),de[4]?ye?ye.p(de,Ve):(ye=Pu(de),ye.c(),ye.m(Y,Ke)):ye&&(ye.d(1),ye=null),Ve&1&&Ue!==(Ue=Ne(de[0].last_month.p)+"")&&X(At,Ue),de[4]?ve?ve.p(de,Ve):(ve=Au(de),ve.c(),ve.m(Y,null)):ve&&(ve.d(1),ve=null),Ve&32&&xe!==(xe="grid grid-cols-"+de[5])&&a(Y,"class",xe)},d(de){de&&y(e),de&&y(n),de&&y(l),Re&&Re.d(),et&&et.d(),Le&&Le.d(),Je&&Je.d(),de&&y(_e),de&&y(ie),de&&y(me),de&&y(Y),at&&at.d(),qe&&qe.d(),ye&&ye.d(),ve&&ve.d()}}}function Cu(t){let e,n,l,i,o,u,m=Ne(t[1].h.c,2)+"",r,f,p,_,h,v,d,g=Ne(t[1].d.c,1)+"",k,$,N,A,F,I,R,C=Ne(t[1].m.c)+"",P,ne,j,B,H,V,G,K=Ne(t[0].last_month.c)+"",Z,z,W;return{c(){e=c("strong"),e.textContent="Cost",n=b(),l=c("div"),i=c("div"),i.textContent="Hour",o=b(),u=c("div"),r=E(m),f=b(),p=E(t[2]),_=b(),h=c("div"),h.textContent="Day",v=b(),d=c("div"),k=E(g),$=b(),N=E(t[2]),A=b(),F=c("div"),F.textContent="Month",I=b(),R=c("div"),P=E(C),ne=b(),j=E(t[2]),B=b(),H=c("div"),H.textContent="Last month",V=b(),G=c("div"),Z=E(K),z=b(),W=E(t[2]),a(u,"class","text-right"),a(d,"class","text-right"),a(R,"class","text-right"),a(G,"class","text-right"),a(l,"class","grid grid-cols-2")},m(x,_e){M(x,e,_e),M(x,n,_e),M(x,l,_e),s(l,i),s(l,o),s(l,u),s(u,r),s(u,f),s(u,p),s(l,_),s(l,h),s(l,v),s(l,d),s(d,k),s(d,$),s(d,N),s(l,A),s(l,F),s(l,I),s(l,R),s(R,P),s(R,ne),s(R,j),s(l,B),s(l,H),s(l,V),s(l,G),s(G,Z),s(G,z),s(G,W)},p(x,_e){_e&2&&m!==(m=Ne(x[1].h.c,2)+"")&&X(r,m),_e&4&&X(p,x[2]),_e&2&&g!==(g=Ne(x[1].d.c,1)+"")&&X(k,g),_e&4&&X(N,x[2]),_e&2&&C!==(C=Ne(x[1].m.c)+"")&&X(P,C),_e&4&&X(j,x[2]),_e&1&&K!==(K=Ne(x[0].last_month.c)+"")&&X(Z,K),_e&4&&X(W,x[2])},d(x){x&&y(e),x&&y(n),x&&y(l)}}}function yu(t){let e,n=Ne(t[1].h.c,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.c,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Mu(t){let e,n=Ne(t[1].d.c,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.c,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Su(t){let e,n=Ne(t[1].m.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Tu(t){let e,n=Ne(t[0].last_month.c)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.c)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Nu(t){let e,n=Ne(t[1].h.i,2)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].h.i,2)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Eu(t){let e,n=Ne(t[1].d.i,1)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].d.i,1)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Pu(t){let e,n=Ne(t[1].m.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&2&&n!==(n=Ne(u[1].m.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Au(t){let e,n=Ne(t[0].last_month.i)+"",l,i,o;return{c(){e=c("div"),l=E(n),i=b(),o=E(t[2]),a(e,"class","text-right")},m(u,m){M(u,e,m),s(e,l),s(e,i),s(e,o)},p(u,m){m&1&&n!==(n=Ne(u[0].last_month.i)+"")&&X(l,n),m&4&&X(o,u[2])},d(u){u&&y(e)}}}function Hm(t){let e,n,l,i,o,u,m=t[1]&&wu(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Real time calculation",l=b(),i=c("br"),o=c("br"),u=b(),m&&m.c(),a(e,"class","mx-2 text-sm")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),s(e,u),m&&m.m(e,null)},p(r,[f]){r[1]?m?m.p(r,f):(m=wu(r),m.c(),m.m(e,null)):m&&(m.d(1),m=null)},i:be,o:be,d(r){r&&y(e),m&&m.d()}}}function Wm(t,e,n){let{sysinfo:l}=e,{data:i}=e,{currency:o}=e,{hasExport:u}=e,m=!1,r=3;return t.$$set=f=>{"sysinfo"in f&&n(0,l=f.sysinfo),"data"in f&&n(1,i=f.data),"currency"in f&&n(2,o=f.currency),"hasExport"in f&&n(3,u=f.hasExport)},t.$$.update=()=>{t.$$.dirty&18&&(n(4,m=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)),n(5,r=m?3:2))},[l,i,o,u,m,r]}class zm extends We{constructor(e){super(),He(this,e,Wm,Hm,Be,{sysinfo:0,data:1,currency:2,hasExport:3})}}function Gm(t){let e,n,l=Wr(t[0].source)+"",i,o,u,m,r;return m=new pn({props:{config:t[1]}}),{c(){e=c("a"),n=E("Provided by: "),i=E(l),u=b(),ae(m.$$.fragment),a(e,"href",o=zr(t[0].source)),a(e,"target","_blank"),a(e,"class","text-xs float-right z-40")},m(f,p){M(f,e,p),s(e,n),s(e,i),M(f,u,p),se(m,f,p),r=!0},p(f,[p]){(!r||p&1)&&l!==(l=Wr(f[0].source)+"")&&X(i,l),(!r||p&1&&o!==(o=zr(f[0].source)))&&a(e,"href",o);const _={};p&2&&(_.config=f[1]),m.$set(_)},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(u),oe(m,f)}}}function Vm(t,e,n){let{json:l}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&n(0,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&29){let f=l.currency,p=new Date().getUTCHours(),_=0,h=0,v=0,d=[],g=[],k=[];n(4,m=n(3,u=0));let $=new Date;for(wl($,i.clock_offset-(24+$.getHours()-$.getUTCHours())%24),_=p;_<24&&(h=l[Ye(v++)],h!=null);_++)g.push({label:Ye($.getHours())}),k.push(h*100),n(4,m=Math.min(m,h*100)),n(3,u=Math.max(u,h*100)),wl($,1);for(_=0;_<24&&(h=l[Ye(v++)],h!=null);_++)g.push({label:Ye($.getHours())}),k.push(h*100),n(4,m=Math.min(m,h*100)),n(3,u=Math.max(u,h*100)),wl($,1);if(m>-100&&u<100){switch(f){case"NOK":case"DKK":f="\xF8re";break;case"SEK":f="\xF6re";break;case"EUR":f="cent";break;case"CHF":f="rp.";break;default:f=f+"/100"}for(n(4,m*=100),n(3,u*=100),_=0;_<k.length;_++)k[_]*=100}let N=[];for(_=0;_<k.length;_++){h=k[_];let R=h*.01,C=Math.abs(h)<1e3?2:0;N.push({label:R>=0?R.toFixed(C):"",title:R>=0?R.toFixed(2)+" "+f:"",value:h>=0?Math.abs(h):0,label2:R<0?R.toFixed(C):"",title2:R<0?R.toFixed(2)+" "+f:"",value2:h<0?Math.abs(h):0,color:r?"#5c2da5":"#7c3aed"})}let A=Math.max(u,Math.abs(m));if(m<0){n(4,m=Math.min(A/4*-1,m));let R=Math.ceil(Math.abs(m)/A*4),C=m/R;for(_=1;_<R+1;_++){let P=C*_;d.push({value:P,label:(P/100).toFixed(2)})}}n(3,u=Math.max(A/4,u));let F=Math.ceil(u/A*4),I=u/F;for(_=0;_<F+1;_++){let R=I*_;d.push({value:R,label:(R/100).toFixed(2)})}n(1,o={title:"Future energy price ("+f+")",padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:d},x:{ticks:g},points:N})}},[l,o,i,u,m]}class Km extends We{constructor(e){super(),He(this,e,Vm,Gm,Be,{json:0,sysinfo:2})}}function Ym(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Qm(t,e,n){let{json:l}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];n(4,m=n(3,u=0));let v=wl(new Date,-24),d=new Date().getUTCHours();for(wl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),f=d;f<24;f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(v.getHours())}),h.push({label:N.toFixed(1),title:N.toFixed(2)+" kWh",value:N*10,label2:A.toFixed(1),title2:A.toFixed(2)+" kWh",value2:A*10,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A*10)),n(3,u=Math.max(u,N*10)),wl(v,1)}for(f=0;f<d;f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(v.getHours())}),h.push({label:N.toFixed(1),title:N.toFixed(2)+" kWh",value:N*10,label2:A.toFixed(1),title2:A.toFixed(2)+" kWh",value2:A*10,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A*10)),n(3,u=Math.max(u,N*10)),wl(v,1)}n(4,m*=-1);let g=Math.max(u,Math.abs(m));if(m<0){n(4,m=Math.min(g/4*-1,m));let N=Math.ceil(Math.abs(m)/g*4),A=m/N;for(f=1;f<N+1;f++){let F=A*f;p.push({value:F,label:(F/10).toFixed(1)})}}n(3,u=Math.max(g/4,u));let k=Math.ceil(u/g*4),$=u/k;for(f=0;f<k+1;f++){let N=$*f;p.push({value:N,label:(N/10).toFixed(1)})}n(0,o={title:"Energy use last 24 hours (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:h})}},[o,l,i,u,m]}class Xm extends We{constructor(e){super(),He(this,e,Qm,Ym,Be,{json:1,sysinfo:2})}}function Zm(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Jm(t,e,n){let{json:l}=e,{sysinfo:i}=e,o={},u,m,r=document.documentElement.classList.contains("dark");return t.$$set=f=>{"json"in f&&n(1,l=f.json),"sysinfo"in f&&n(2,i=f.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&30){let f=0,p=[],_=[],h=[];n(4,m=n(3,u=0));let v=new Date,d=new Date;for(wl(v,i.clock_offset-(24+v.getHours()-v.getUTCHours())%24),wl(d,i.clock_offset-(24+d.getHours()-d.getUTCHours())%24),d.setDate(0),f=v.getDate();f<=d.getDate();f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(f)}),h.push({label:N.toFixed(N<10?1:0),title:N.toFixed(2)+" kWh",value:N,label2:A.toFixed(A<10?1:0),title2:A.toFixed(2)+" kWh",value2:A,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A)),n(3,u=Math.max(u,N))}for(f=1;f<v.getDate();f++){let N=l["i"+Ye(f)],A=l["e"+Ye(f)];N===void 0&&(N=0),A===void 0&&(A=0),_.push({label:Ye(f)}),h.push({label:N.toFixed(N<10?1:0),title:N.toFixed(2)+" kWh",value:N,label2:A.toFixed(A<10?1:0),title2:A.toFixed(2)+" kWh",value2:A,color:r?"#5c2da5":"#7c3aed",color2:r?"#27728e":"#37829e"}),n(4,m=Math.max(m,A)),n(3,u=Math.max(u,N))}n(4,m*=-1);let g=Math.max(u,Math.abs(m));if(m<0){n(4,m=Math.min(g/4*-1,m));let N=Math.ceil(Math.abs(m)/g*4),A=m/N;for(f=1;f<N+1;f++){let F=A*f;p.push({value:F,label:F.toFixed(0)})}}n(3,u=Math.max(g/4,u));let k=Math.ceil(u/g*4),$=u/k;for(f=0;f<k+1;f++){let N=$*f;p.push({value:N,label:N.toFixed(0)})}n(0,o={title:"Energy use last "+d.getDate()+" days (kWh)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:h})}},[o,l,i,u,m]}class xm extends We{constructor(e){super(),He(this,e,Jm,Zm,Be,{json:1,sysinfo:2})}}function e_(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function t_(t,e,n){let{json:l}=e,i=document.documentElement.classList.contains("dark"),o={},u=0,m=0;return t.$$set=r=>{"json"in r&&n(1,l=r.json)},t.$$.update=()=>{if(t.$$.dirty&14){let r=0,f=0,p=[],_=[],h=[];l.s&&l.s.forEach((g,k)=>{var $=g.n?g.n:g.a;f=g.v,f==-127&&(f=0),_.push({label:$.slice(-4)}),h.push({label:f.toFixed(1),value:f,color:i?"#5c2da5":"#7c3aed"}),n(3,m=Math.min(m,f)),n(2,u=Math.max(u,f))}),n(2,u=Math.ceil(u)),n(3,m=Math.floor(m));let v=u;m<0&&(v+=Math.abs(m));let d=v/4;for(r=0;r<5;r++)f=m+d*r,p.push({value:f,label:f.toFixed(1)});n(0,o={title:"Temperature sensors (\xB0C)",height:226,width:1520,padding:{top:20,right:15,bottom:20,left:35},y:{min:m,max:u,ticks:p},x:{ticks:_},points:h})}},[o,l,u,m]}class l_ extends We{constructor(e){super(),He(this,e,t_,e_,Be,{json:1})}}function n_(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}let i_=0;function s_(t,e,n){let l=document.documentElement.classList.contains("dark"),i={},o=0,u;return h0.subscribe(m=>{n(2,u=m)}),d0(),t.$$.update=()=>{if(t.$$.dirty&6){let m=0,r=[],f=[],p=[];if(r.push({value:0,label:0}),u&&u.p)for(m=0;m<u.p.length;m++){let _=u.p[m];p.push({label:_.v.toFixed(2),value:_.v,color:l?"#5c2da5":"#7c3aed"}),f.push({label:_.d>0?Ye(_.d)+"."+Ti[new Date().getMonth()]:"-"}),n(1,o=Math.max(o,_.v))}if(u&&u.t){for(m=0;m<u.t.length;m++){let _=u.t[m];if(_>=o)break;r.push({value:_,label:_})}r.push({label:u.m.toFixed(1),align:"right",color:"green",value:u.m})}u&&u.c&&(r.push({label:u.c.toFixed(0),color:"orange",value:u.c}),n(1,o=Math.max(o,u.c))),n(1,o=Math.ceil(o)),n(0,i={title:"Tariff peaks",padding:{top:20,right:35,bottom:20,left:35},y:{min:i_,max:o,ticks:r},x:{ticks:f},points:p})}},[i,o,u]}class o_ extends We{constructor(e){super(),He(this,e,s_,n_,Be,{})}}function $u(t,e,n){const l=t.slice();return l[20]=e[n],l[22]=n,l}function Du(t,e,n){const l=t.slice();return l[23]=e[n],l}function Lu(t){let e,n,l,i,o,u=t[7],m=[];for(let p=0;p<u.length;p+=1)m[p]=Ru(Du(t,u,p));let r=t[8],f=[];for(let p=0;p<r.length;p+=1)f[p]=qu($u(t,r,p));return{c(){e=je("svg"),n=je("g");for(let p=0;p<m.length;p+=1)m[p].c();l=je("g");for(let p=0;p<f.length;p+=1)f[p].c();i=je("polyline"),a(n,"class","axis y-axis"),a(l,"class","axis x-axis"),a(i,"opacity","0.9"),a(i,"fill",t[11]?"#5c2da5":"#7c3aed"),a(i,"stroke",t[11]?"#5c2da5":"#7c3aed"),a(i,"stroke-width","1"),a(i,"points",t[4]),a(e,"viewBox",o="0 0 "+t[3]+" "+t[2]),a(e,"height","100%")},m(p,_){M(p,e,_),s(e,n);for(let h=0;h<m.length;h+=1)m[h]&&m[h].m(n,null);s(e,l);for(let h=0;h<f.length;h+=1)f[h]&&f[h].m(l,null);s(e,i)},p(p,_){if(_&160){u=p[7];let h;for(h=0;h<u.length;h+=1){const v=Du(p,u,h);m[h]?m[h].p(v,_):(m[h]=Ru(v),m[h].c(),m[h].m(n,null))}for(;h<m.length;h+=1)m[h].d(1);m.length=u.length}if(_&836){r=p[8];let h;for(h=0;h<r.length;h+=1){const v=$u(p,r,h);f[h]?f[h].p(v,_):(f[h]=qu(v),f[h].c(),f[h].m(l,null))}for(;h<f.length;h+=1)f[h].d(1);f.length=r.length}_&16&&a(i,"points",p[4]),_&12&&o!==(o="0 0 "+p[3]+" "+p[2])&&a(e,"viewBox",o)},d(p){p&&y(e),mt(m,p),mt(f,p)}}}function Iu(t){let e,n,l,i=t[23].label+"",o,u,m;return{c(){e=je("g"),n=je("line"),l=je("text"),o=E(i),a(n,"x2","100%"),a(l,"y","-4"),a(e,"class",u="tick tick-"+t[23].value),a(e,"transform",m="translate(0, "+t[5](t[23].value)+")")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(l,o)},p(r,f){f&128&&i!==(i=r[23].label+"")&&X(o,i),f&128&&u!==(u="tick tick-"+r[23].value)&&a(e,"class",u),f&160&&m!==(m="translate(0, "+r[5](r[23].value)+")")&&a(e,"transform",m)},d(r){r&&y(e)}}}function Ru(t){let e=!isNaN(t[5](t[23].value)),n,l=e&&Iu(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&160&&(e=!isNaN(i[5](i[23].value))),e?l?l.p(i,o):(l=Iu(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function Fu(t){let e=t[22]%Math.round(6/t[9])==0,n,l=e&&Ou(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&512&&(e=i[22]%Math.round(6/i[9])==0),e?l?l.p(i,o):(l=Ou(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function Ou(t){let e,n,l=t[20].label+"",i,o,u;return{c(){e=je("g"),n=je("text"),i=E(l),a(n,"x",o=t[9]/2),a(n,"y","-4"),a(e,"class","tick"),a(e,"transform",u="translate("+(40+t[6](t[20].value))+","+t[2]+")")},m(m,r){M(m,e,r),s(e,n),s(n,i)},p(m,r){r&256&&l!==(l=m[20].label+"")&&X(i,l),r&512&&o!==(o=m[9]/2)&&a(n,"x",o),r&324&&u!==(u="translate("+(40+m[6](m[20].value))+","+m[2]+")")&&a(e,"transform",u)},d(m){m&&y(e)}}}function qu(t){let e=!isNaN(t[6](t[20].value)),n,l=e&&Fu(t);return{c(){l&&l.c(),n=it()},m(i,o){l&&l.m(i,o),M(i,n,o)},p(i,o){o&320&&(e=!isNaN(i[6](i[20].value))),e?l?l.p(i,o):(l=Fu(i),l.c(),l.m(n.parentNode,n)):l&&(l.d(1),l=null)},d(i){l&&l.d(i),i&&y(n)}}}function a_(t){let e,n,l,i,o,u,m,r=t[7]&&Lu(t);return{c(){e=c("div"),n=c("strong"),l=E("Realtime ("),i=E(t[10]),o=E(")"),u=b(),r&&r.c(),a(n,"class","text-sm"),a(e,"class","chart"),Ze(()=>t[15].call(e))},m(f,p){M(f,e,p),s(e,n),s(n,l),s(n,i),s(n,o),s(e,u),r&&r.m(e,null),m=ko(e,t[15].bind(e))},p(f,[p]){p&1024&&X(i,f[10]),f[7]?r?r.p(f,p):(r=Lu(f),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},i:be,o:be,d(f){f&&y(e),r&&r.d(),m()}}}let r_=12;function u_(t,e,n){let l=document.documentElement.classList.contains("dark"),i;v0.subscribe(C=>{n(12,i=C)});let o,u=0,m=0;function r(){o&&clearTimeout(o),o=setTimeout(r,1e4),i.data.unshift(m),n(12,i.data=i.data.slice(0,i.size),i),u+=10}r0.subscribe(C=>{u==0&&(o&&clearTimeout(o),o=setTimeout(r,1e4)),m=C.i-C.e,u=C.u});let f,p,_,h,v,d,g,k,$,N,A,F,I;function R(){_=this.clientWidth,h=this.clientHeight,n(0,_),n(1,h)}return t.$$.update=()=>{if(t.$$.dirty&29183&&(n(2,v=parseInt(h)-50),n(3,d=_-35),n(9,F=d/i.size),n(14,p=0),n(13,f=0),i.data)){for(let P in i.data){let ne=i.data[P];n(13,f=Math.max(Math.ceil(ne/1e3)*1e3,f)),n(14,p=Math.min(Math.ceil(ne/1e3)*1e3,p))}n(10,I=f>2500?"kW":"W"),n(7,N=[]);for(let P=p;P<f;P+=f/5)N.push({value:P,label:f>2500?(P/1e3).toFixed(1):P});n(8,A=[]);for(let P=p;P<i.size;P+=i.size/r_)A.push({value:P,label:"-"+Math.round((i.size-P)/6)+" min"});n(5,k=function(P){return Math.ceil(v-P/f*v)-25}),n(6,$=function(P){return 30+Math.ceil(P/i.size*(d-35))});let C=i.size;n(4,g=$(i.size)+","+k(0)+" "+$(1)+","+k(0));for(let P in i.data){if(C<0)break;let ne=i.data[P];n(4,g=$(C--)+","+k(ne)+" "+g)}}},[_,h,v,d,g,k,$,N,A,F,I,l,i,f,p,R]}class f_ extends We{constructor(e){super(),He(this,e,u_,a_,Be,{})}}function c_(t){let e,n;return e=new pn({props:{config:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,[i]){const o={};i&1&&(o.config=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function m_(t,e,n){let{title:l}=e,{unit:i=""}=e,{l1:o=!1}=e,{l2:u=!1}=e,{l2x:m=!1}=e,{l3:r=!1}=e,{l1i:f=0}=e,{l2i:p=0}=e,{l3i:_=0}=e,{l1e:h=0}=e,{l2e:v=0}=e,{l3e:d=0}=e,{maxImport:g=0}=e,{maxExport:k=0}=e,{importColorFn:$}=e,{exportColorFn:N}=e,A={};function F(I,R){return{label:Ne(I>900?I/1e3:I)+(I>900?"k":"")+i,title:I.toFixed(2)+" "+i,value:isNaN(I)?0:I,color:$(I?I/g*100:0,document.documentElement.classList.contains("dark")),label2:Ne(R>900?R/1e3:R)+(R>900?"k":"")+i,title2:R.toFixed(2)+" "+i,value2:isNaN(R)?0:R,color2:N(R?R/k*100:0)}}return t.$$set=I=>{"title"in I&&n(1,l=I.title),"unit"in I&&n(2,i=I.unit),"l1"in I&&n(3,o=I.l1),"l2"in I&&n(4,u=I.l2),"l2x"in I&&n(5,m=I.l2x),"l3"in I&&n(6,r=I.l3),"l1i"in I&&n(7,f=I.l1i),"l2i"in I&&n(8,p=I.l2i),"l3i"in I&&n(9,_=I.l3i),"l1e"in I&&n(10,h=I.l1e),"l2e"in I&&n(11,v=I.l2e),"l3e"in I&&n(12,d=I.l3e),"maxImport"in I&&n(13,g=I.maxImport),"maxExport"in I&&n(14,k=I.maxExport),"importColorFn"in I&&n(15,$=I.importColorFn),"exportColorFn"in I&&n(16,N=I.exportColorFn)},t.$$.update=()=>{if(t.$$.dirty&32762){let I=[],R=[];o&&(I.push({label:"L1"}),R.push(F(f,h))),u&&(m?(I.push({label:"L2"}),R.push({label:"Not available",labelAngle:-90,title:"L2 current is not reported by your meter",value:0,color:"#7c3aedcc"})):(I.push({label:"L2"}),R.push(F(p,v)))),r&&(I.push({label:"L3"}),R.push(F(_,d)));let C=[];k&&(C.push({value:-k,label:"-100%"}),C.push({value:-k/4*3,label:"-75%"}),C.push({value:-k/2,label:"-50%"}),C.push({value:-k/4,label:"-25%"})),C.push({value:0,label:"0%"}),g&&(C.push({value:g/4,label:"25%"}),C.push({value:g/2,label:"50%"}),C.push({value:g/4*3,label:"75%"}),C.push({value:g,label:"100%"})),n(0,A={title:l,padding:{top:20,right:15,bottom:20,left:35},y:{min:-k,max:g,ticks:C},x:{ticks:I},points:R})}},[A,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N]}class $o extends We{constructor(e){super(),He(this,e,m_,c_,Be,{title:1,unit:2,l1:3,l2:4,l2x:5,l3:6,l1i:7,l2i:8,l3i:9,l1e:10,l2e:11,l3e:12,maxImport:13,maxExport:14,importColorFn:15,exportColorFn:16})}}function Bu(t){let e,n,l,i,o,u,m=(t[0].mt?Ss(t[0].mt):"-")+"",r,f,p,_=(t[0].ic?t[0].ic.toFixed(1):"-")+"",h,v,d;return i=new C0({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:So}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),r=E(m),f=b(),p=c("div"),h=E(_),v=E(" kWh"),a(l,"class","col-span-2"),a(p,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(g,k){M(g,e,k),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(u,r),s(n,f),s(n,p),s(p,h),s(p,v),d=!0},p(g,k){const $={};k&1&&($.val=g[0].i?g[0].i:0),k&1&&($.max=g[0].im?g[0].im:15e3),k&1&&($.sub=g[0].p),k&1&&($.subunit=g[0].pc),i.$set($),(!d||k&1)&&m!==(m=(g[0].mt?Ss(g[0].mt):"-")+"")&&X(r,m),(!d||k&1)&&_!==(_=(g[0].ic?g[0].ic.toFixed(1):"-")+"")&&X(h,_)},i(g){d||(L(i.$$.fragment,g),d=!0)},o(g){q(i.$$.fragment,g),d=!1},d(g){g&&y(e),oe(i)}}}function Uu(t){let e,n,l,i,o,u,m,r,f=(t[0].ec?t[0].ec.toFixed(1):"-")+"",p,_,h;return i=new C0({props:{val:t[0].e?t[0].e:0,max:t[0].om?t[0].om*1e3:1e4,unit:"W",label:"Export",colorFn:Ni}}),{c(){e=c("div"),n=c("div"),l=c("div"),ae(i.$$.fragment),o=b(),u=c("div"),m=b(),r=c("div"),p=E(f),_=E(" kWh"),a(l,"class","col-span-2"),a(r,"class","text-right"),a(n,"class","grid grid-cols-2"),a(e,"class","cnt")},m(v,d){M(v,e,d),s(e,n),s(n,l),se(i,l,null),s(n,o),s(n,u),s(n,m),s(n,r),s(r,p),s(r,_),h=!0},p(v,d){const g={};d&1&&(g.val=v[0].e?v[0].e:0),d&1&&(g.max=v[0].om?v[0].om*1e3:1e4),i.$set(g),(!h||d&1)&&f!==(f=(v[0].ec?v[0].ec.toFixed(1):"-")+"")&&X(p,f)},i(v){h||(L(i.$$.fragment,v),h=!0)},o(v){q(i.$$.fragment,v),h=!1},d(v){v&&y(e),oe(i)}}}function ju(t){let e,n,l=t[0].l1&&Hu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Hu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Hu(t){let e,n;return e=new Fm({props:{u1:t[0].l1.u,u2:t[0].l2.u,u3:t[0].l3.u,ds:t[0].ds}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.u1=l[0].l1.u),i&1&&(o.u2=l[0].l2.u),i&1&&(o.u3=l[0].l3.u),i&1&&(o.ds=l[0].ds),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Wu(t){let e,n,l=t[0].l1&&zu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=zu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function zu(t){let e,n;return e=new $o({props:{title:"Amperage",unit:"A",importColorFn:So,exportColorFn:Ni,maxImport:t[0].mf,maxExport:t[0].om?t[0].om/230:0,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l2x:t[0].i2e,l1i:Math.max(t[0].l1.i,0),l2i:Math.max(t[0].l2.i,0),l3i:Math.max(t[0].l3.i,0),l1e:Math.min(t[0].l1.i*-1,0),l2e:Math.min(t[0].l2.i*-1,0),l3e:Math.min(t[0].l3.i*-1,0)}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=l[0].mf),i&1&&(o.maxExport=l[0].om?l[0].om/230:0),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l2x=l[0].i2e),i&1&&(o.l1i=Math.max(l[0].l1.i,0)),i&1&&(o.l2i=Math.max(l[0].l2.i,0)),i&1&&(o.l3i=Math.max(l[0].l3.i,0)),i&1&&(o.l1e=Math.min(l[0].l1.i*-1,0)),i&1&&(o.l2e=Math.min(l[0].l2.i*-1,0)),i&1&&(o.l3e=Math.min(l[0].l3.i*-1,0)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Gu(t){let e,n,l=t[0].l1&&Vu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Vu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Vu(t){let e,n;return e=new $o({props:{title:"Phase power",unit:"W",importColorFn:So,exportColorFn:Ni,maxImport:(t[0].mf?t[0].mf:32)*230,maxExport:t[0].om,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.p,l1e:t[0].l1.q,l2i:t[0].l2.p,l2e:t[0].l2.q,l3i:t[0].l3.p,l3e:t[0].l3.q}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.maxImport=(l[0].mf?l[0].mf:32)*230),i&1&&(o.maxExport=l[0].om),i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.p),i&1&&(o.l1e=l[0].l1.q),i&1&&(o.l2i=l[0].l2.p),i&1&&(o.l2e=l[0].l2.q),i&1&&(o.l3i=l[0].l3.p),i&1&&(o.l3e=l[0].l3.q),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Ku(t){let e,n,l=t[0].l1&&Yu(t);return{c(){e=c("div"),l&&l.c(),a(e,"class","cnt")},m(i,o){M(i,e,o),l&&l.m(e,null),n=!0},p(i,o){i[0].l1?l?(l.p(i,o),o&1&&L(l,1)):(l=Yu(i),l.c(),L(l,1),l.m(e,null)):l&&($e(),q(l,1,1,()=>{l=null}),De())},i(i){n||(L(l),n=!0)},o(i){q(l),n=!1},d(i){i&&y(e),l&&l.d()}}}function Yu(t){let e,n;return e=new $o({props:{title:"Power factor",importColorFn:Ni,exportColorFn:Ni,maxImport:1,l1:t[0].l1&&t[0].l1.u>100,l2:t[0].l2&&t[0].l2.u>100,l3:t[0].l3&&t[0].l3.u>100,l1i:t[0].l1.f,l2i:t[0].l2.f,l3i:t[0].l3.f}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.l1=l[0].l1&&l[0].l1.u>100),i&1&&(o.l2=l[0].l2&&l[0].l2.u>100),i&1&&(o.l3=l[0].l3&&l[0].l3.u>100),i&1&&(o.l1i=l[0].l1.f),i&1&&(o.l2i=l[0].l2.f),i&1&&(o.l3i=l[0].l3.f),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Qu(t){let e,n,l;return n=new Bm({props:{importInstant:t[0].ri,exportInstant:t[0].re,importTotal:t[0].ric,exportTotal:t[0].rec}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&1&&(u.importInstant=i[0].ri),o&1&&(u.exportInstant=i[0].re),o&1&&(u.importTotal=i[0].ric),o&1&&(u.exportTotal=i[0].rec),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Xu(t){let e,n,l;return n=new zm({props:{sysinfo:t[1],data:t[0].ea,currency:t[0].pc,hasExport:t[0].om>0||t[0].e>0}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&2&&(u.sysinfo=i[1]),o&1&&(u.data=i[0].ea),o&1&&(u.currency=i[0].pc),o&1&&(u.hasExport=i[0].om>0||i[0].e>0),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Zu(t){let e,n,l;return n=new o_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt h-64")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function Ju(t){let e,n,l;return n=new f_({}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function xu(t){let e,n,l;return n=new Km({props:{json:t[2],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&4&&(u.json=i[2]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function ef(t){let e,n,l;return n=new Xm({props:{json:t[3],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&8&&(u.json=i[3]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function tf(t){let e,n,l;return n=new xm({props:{json:t[4],sysinfo:t[1]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&16&&(u.json=i[4]),o&2&&(u.sysinfo=i[1]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function lf(t){let e,n,l;return n=new l_({props:{json:t[5]}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","cnt gwf")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o&32&&(u.json=i[5]),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function __(t){let e,n=tt(t[1].ui.i,t[0].i),l,i=tt(t[1].ui.e,t[0].om||t[0].e>0),o,u=tt(t[1].ui.v,t[0].l1&&(t[0].l1.u>100||t[0].l2.u>100||t[0].l3.u>100)),m,r=tt(t[1].ui.a,t[0].l1&&(t[0].l1.i>.01||t[0].l2.i>.01||t[0].l3.i>.01)),f,p=tt(t[1].ui.h,t[0].l1&&(t[0].l1.p>.01||t[0].l2.p>.01||t[0].l3.p>.01||t[0].l1.q>.01||t[0].l2.q>.01||t[0].l3.q>.01)),_,h=tt(t[1].ui.f,t[0].l1&&(t[0].l1.f>.01||t[0].l2.f>.01||t[0].l3.f>.01)),v,d=tt(t[1].ui.r,t[0].ri>0||t[0].re>0||t[0].ric>0||t[0].rec>0),g,k=tt(t[1].ui.c,t[0].ea),$,N=tt(t[1].ui.t,t[0].pr&&(t[0].pr.startsWith("10YNO")||t[0].pr.startsWith("10Y1001A1001A4"))),A,F=tt(t[1].ui.l),I,R=tt(t[1].ui.p,t[0].pe&&!Number.isNaN(t[0].p)),C,P=tt(t[1].ui.d,t[3]),ne,j=tt(t[1].ui.m,t[4]),B,H=tt(t[1].ui.s,t[0].t&&t[0].t!=-127&&t[5].c>1),V,G=n&&Bu(t),K=i&&Uu(t),Z=u&&ju(t),z=r&&Wu(t),W=p&&Gu(t),x=h&&Ku(t),_e=d&&Qu(t),ie=k&&Xu(t),me=N&&Zu(),Y=F&&Ju(),ke=R&&xu(t),Ee=P&&ef(t),we=j&&tf(t),Me=H&&lf(t);return{c(){e=c("div"),G&&G.c(),l=b(),K&&K.c(),o=b(),Z&&Z.c(),m=b(),z&&z.c(),f=b(),W&&W.c(),_=b(),x&&x.c(),v=b(),_e&&_e.c(),g=b(),ie&&ie.c(),$=b(),me&&me.c(),A=b(),Y&&Y.c(),I=b(),ke&&ke.c(),C=b(),Ee&&Ee.c(),ne=b(),we&&we.c(),B=b(),Me&&Me.c(),a(e,"class","grid 2xl:grid-cols-6 xl:grid-cols-5 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2")},m(te,fe){M(te,e,fe),G&&G.m(e,null),s(e,l),K&&K.m(e,null),s(e,o),Z&&Z.m(e,null),s(e,m),z&&z.m(e,null),s(e,f),W&&W.m(e,null),s(e,_),x&&x.m(e,null),s(e,v),_e&&_e.m(e,null),s(e,g),ie&&ie.m(e,null),s(e,$),me&&me.m(e,null),s(e,A),Y&&Y.m(e,null),s(e,I),ke&&ke.m(e,null),s(e,C),Ee&&Ee.m(e,null),s(e,ne),we&&we.m(e,null),s(e,B),Me&&Me.m(e,null),V=!0},p(te,[fe]){fe&3&&(n=tt(te[1].ui.i,te[0].i)),n?G?(G.p(te,fe),fe&3&&L(G,1)):(G=Bu(te),G.c(),L(G,1),G.m(e,l)):G&&($e(),q(G,1,1,()=>{G=null}),De()),fe&3&&(i=tt(te[1].ui.e,te[0].om||te[0].e>0)),i?K?(K.p(te,fe),fe&3&&L(K,1)):(K=Uu(te),K.c(),L(K,1),K.m(e,o)):K&&($e(),q(K,1,1,()=>{K=null}),De()),fe&3&&(u=tt(te[1].ui.v,te[0].l1&&(te[0].l1.u>100||te[0].l2.u>100||te[0].l3.u>100))),u?Z?(Z.p(te,fe),fe&3&&L(Z,1)):(Z=ju(te),Z.c(),L(Z,1),Z.m(e,m)):Z&&($e(),q(Z,1,1,()=>{Z=null}),De()),fe&3&&(r=tt(te[1].ui.a,te[0].l1&&(te[0].l1.i>.01||te[0].l2.i>.01||te[0].l3.i>.01))),r?z?(z.p(te,fe),fe&3&&L(z,1)):(z=Wu(te),z.c(),L(z,1),z.m(e,f)):z&&($e(),q(z,1,1,()=>{z=null}),De()),fe&3&&(p=tt(te[1].ui.h,te[0].l1&&(te[0].l1.p>.01||te[0].l2.p>.01||te[0].l3.p>.01||te[0].l1.q>.01||te[0].l2.q>.01||te[0].l3.q>.01))),p?W?(W.p(te,fe),fe&3&&L(W,1)):(W=Gu(te),W.c(),L(W,1),W.m(e,_)):W&&($e(),q(W,1,1,()=>{W=null}),De()),fe&3&&(h=tt(te[1].ui.f,te[0].l1&&(te[0].l1.f>.01||te[0].l2.f>.01||te[0].l3.f>.01))),h?x?(x.p(te,fe),fe&3&&L(x,1)):(x=Ku(te),x.c(),L(x,1),x.m(e,v)):x&&($e(),q(x,1,1,()=>{x=null}),De()),fe&3&&(d=tt(te[1].ui.r,te[0].ri>0||te[0].re>0||te[0].ric>0||te[0].rec>0)),d?_e?(_e.p(te,fe),fe&3&&L(_e,1)):(_e=Qu(te),_e.c(),L(_e,1),_e.m(e,g)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),fe&3&&(k=tt(te[1].ui.c,te[0].ea)),k?ie?(ie.p(te,fe),fe&3&&L(ie,1)):(ie=Xu(te),ie.c(),L(ie,1),ie.m(e,$)):ie&&($e(),q(ie,1,1,()=>{ie=null}),De()),fe&3&&(N=tt(te[1].ui.t,te[0].pr&&(te[0].pr.startsWith("10YNO")||te[0].pr.startsWith("10Y1001A1001A4")))),N?me?fe&3&&L(me,1):(me=Zu(),me.c(),L(me,1),me.m(e,A)):me&&($e(),q(me,1,1,()=>{me=null}),De()),fe&2&&(F=tt(te[1].ui.l)),F?Y?fe&2&&L(Y,1):(Y=Ju(),Y.c(),L(Y,1),Y.m(e,I)):Y&&($e(),q(Y,1,1,()=>{Y=null}),De()),fe&3&&(R=tt(te[1].ui.p,te[0].pe&&!Number.isNaN(te[0].p))),R?ke?(ke.p(te,fe),fe&3&&L(ke,1)):(ke=xu(te),ke.c(),L(ke,1),ke.m(e,C)):ke&&($e(),q(ke,1,1,()=>{ke=null}),De()),fe&10&&(P=tt(te[1].ui.d,te[3])),P?Ee?(Ee.p(te,fe),fe&10&&L(Ee,1)):(Ee=ef(te),Ee.c(),L(Ee,1),Ee.m(e,ne)):Ee&&($e(),q(Ee,1,1,()=>{Ee=null}),De()),fe&18&&(j=tt(te[1].ui.m,te[4])),j?we?(we.p(te,fe),fe&18&&L(we,1)):(we=tf(te),we.c(),L(we,1),we.m(e,B)):we&&($e(),q(we,1,1,()=>{we=null}),De()),fe&35&&(H=tt(te[1].ui.s,te[0].t&&te[0].t!=-127&&te[5].c>1)),H?Me?(Me.p(te,fe),fe&35&&L(Me,1)):(Me=lf(te),Me.c(),L(Me,1),Me.m(e,null)):Me&&($e(),q(Me,1,1,()=>{Me=null}),De())},i(te){V||(L(G),L(K),L(Z),L(z),L(W),L(x),L(_e),L(ie),L(me),L(Y),L(ke),L(Ee),L(we),L(Me),V=!0)},o(te){q(G),q(K),q(Z),q(z),q(W),q(x),q(_e),q(ie),q(me),q(Y),q(ke),q(Ee),q(we),q(Me),V=!1},d(te){te&&y(e),G&&G.d(),K&&K.d(),Z&&Z.d(),z&&z.d(),W&&W.d(),x&&x.d(),_e&&_e.d(),ie&&ie.d(),me&&me.d(),Y&&Y.d(),ke&&ke.d(),Ee&&Ee.d(),we&&we.d(),Me&&Me.d()}}}function p_(t,e,n){let{data:l={}}=e,{sysinfo:i={}}=e,o={},u={},m={},r={};return No.subscribe(f=>{n(2,o=f)}),c0.subscribe(f=>{n(3,u=f)}),m0.subscribe(f=>{n(4,m=f)}),p0.subscribe(f=>{n(5,r=f)}),t.$$set=f=>{"data"in f&&n(0,l=f.data),"sysinfo"in f&&n(1,i=f.sysinfo)},[l,i,o,u,m,r]}class d_ extends We{constructor(e){super(),He(this,e,p_,__,Be,{data:0,sysinfo:1})}}let fo={};const wi=ht(fo);async function h_(){fo=await(await fetch("configuration.json")).json(),wi.set(fo)}let co={};const y0=ht(co);async function v_(){co=await(await fetch("priceconfig.json")).json(),y0.set(co)}function nf(t,e,n){const l=t.slice();return l[2]=e[n],l[4]=n,l}function b_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function g_(t){let e;return{c(){e=c("option"),e.textContent="UART0",e.__value=20,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function sf(t){let e;return{c(){e=c("option"),e.textContent="UART2",e.__value=113,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function of(t){let e,n,l;return{c(){e=c("option"),e.textContent="UART1",n=b(),l=c("option"),l.textContent="UART2",e.__value=9,e.value=e.__value,l.__value=16,l.value=l.__value},m(i,o){M(i,e,o),M(i,n,o),M(i,l,o)},d(i){i&&y(e),i&&y(n),i&&y(l)}}}function af(t){let e;return{c(){e=c("option"),e.textContent="UART1",e.__value=18,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function rf(t){let e,n,l;return{c(){e=c("option"),n=E("GPIO"),l=E(t[4]),e.__value=t[4],e.value=e.__value},m(i,o){M(i,e,o),s(e,n),s(e,l)},d(i){i&&y(e)}}}function uf(t){let e,n=t[4]>1&&!(t[0]=="esp32"&&(t[4]==9||t[4]==16))&&!((t[0]=="esp32s2"||t[0]=="esp32s3")&&t[4]==18)&&!(t[0]=="esp8266"&&(t[4]==3||t[4]==113))&&rf(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,i){l[4]>1&&!(l[0]=="esp32"&&(l[4]==9||l[4]==16))&&!((l[0]=="esp32s2"||l[0]=="esp32s3")&&l[4]==18)&&!(l[0]=="esp8266"&&(l[4]==3||l[4]==113))?n||(n=rf(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(l){n&&n.d(l),l&&y(e)}}}function k_(t){let e,n,l,i,o;function u(d,g){return d[0]=="esp32c3"?g_:b_}let m=u(t),r=m(t),f=t[0]=="esp8266"&&sf(),p=(t[0]=="esp32"||t[0]=="esp32solo")&&of(),_=(t[0]=="esp32s2"||t[0]=="esp32s3")&&af(),h={length:t[1]+1},v=[];for(let d=0;d<h.length;d+=1)v[d]=uf(nf(t,h,d));return{c(){r.c(),e=b(),f&&f.c(),n=b(),p&&p.c(),l=b(),_&&_.c(),i=b();for(let d=0;d<v.length;d+=1)v[d].c();o=it()},m(d,g){r.m(d,g),M(d,e,g),f&&f.m(d,g),M(d,n,g),p&&p.m(d,g),M(d,l,g),_&&_.m(d,g),M(d,i,g);for(let k=0;k<v.length;k+=1)v[k]&&v[k].m(d,g);M(d,o,g)},p(d,[g]){if(m!==(m=u(d))&&(r.d(1),r=m(d),r&&(r.c(),r.m(e.parentNode,e))),d[0]=="esp8266"?f||(f=sf(),f.c(),f.m(n.parentNode,n)):f&&(f.d(1),f=null),d[0]=="esp32"||d[0]=="esp32solo"?p||(p=of(),p.c(),p.m(l.parentNode,l)):p&&(p.d(1),p=null),d[0]=="esp32s2"||d[0]=="esp32s3"?_||(_=af(),_.c(),_.m(i.parentNode,i)):_&&(_.d(1),_=null),g&3){h={length:d[1]+1};let k;for(k=0;k<h.length;k+=1){const $=nf(d,h,k);v[k]?v[k].p($,g):(v[k]=uf($),v[k].c(),v[k].m(o.parentNode,o))}for(;k<v.length;k+=1)v[k].d(1);v.length=h.length}},i:be,o:be,d(d){r.d(d),d&&y(e),f&&f.d(d),d&&y(n),p&&p.d(d),d&&y(l),_&&_.d(d),d&&y(i),mt(v,d),d&&y(o)}}}function w_(t,e,n){let{chip:l}=e,i=39;return t.$$set=o=>{"chip"in o&&n(0,l=o.chip)},t.$$.update=()=>{if(t.$$.dirty&1)switch(l){case"esp8266":n(1,i=16);break;case"esp32s2":n(1,i=44);break;case"esp32s3":n(1,i=46);break;case"esp32c3":n(1,i=19);break}},[l,i]}class mo extends We{constructor(e){super(),He(this,e,w_,k_,Be,{chip:0})}}function ff(t){let e,n,l=t[1]&&cf(t);return{c(){e=c("div"),n=c("div"),l&&l.c(),a(n,"class","fixed inset-0 bg-gray-500 dark:bg-gray-900 bg-opacity-50 dark:bg-opacity-80 flex items-center justify-center"),a(e,"class","z-50"),a(e,"aria-modal","true")},m(i,o){M(i,e,o),s(e,n),l&&l.m(n,null)},p(i,o){i[1]?l?l.p(i,o):(l=cf(i),l.c(),l.m(n,null)):l&&(l.d(1),l=null)},d(i){i&&y(e),l&&l.d()}}}function cf(t){let e,n;return{c(){e=c("div"),n=E(t[1]),a(e,"class","bg-white dark:bg-gray-600 m-2 p-3 rounded-md shadow-lg pb-4 text-gray-700 dark:text-white w-96")},m(l,i){M(l,e,i),s(e,n)},p(l,i){i&2&&X(n,l[1])},d(l){l&&y(e)}}}function C_(t){let e,n=t[0]&&ff(t);return{c(){n&&n.c(),e=it()},m(l,i){n&&n.m(l,i),M(l,e,i)},p(l,[i]){l[0]?n?n.p(l,i):(n=ff(l),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},i:be,o:be,d(l){n&&n.d(l),l&&y(e)}}}function y_(t,e,n){let{active:l}=e,{message:i}=e;return t.$$set=o=>{"active"in o&&n(0,l=o.active),"message"in o&&n(1,i=o.message)},[l,i]}class Pt extends We{constructor(e){super(),He(this,e,y_,C_,Be,{active:0,message:1})}}function mf(t,e,n){const l=t.slice();return l[1]=e[n],l}function _f(t){let e,n,l=t[1]+"",i;return{c(){e=c("option"),n=E("Europe/"),i=E(l),e.__value="Europe/"+t[1],e.value=e.__value},m(o,u){M(o,e,u),s(e,n),s(e,i)},p:be,d(o){o&&y(e)}}}function M_(t){let e,n,l,i=t[0],o=[];for(let u=0;u<i.length;u+=1)o[u]=_f(mf(t,i,u));return{c(){e=c("option"),e.textContent="GMT",n=b();for(let u=0;u<o.length;u+=1)o[u].c();l=it(),e.__value="GMT",e.value=e.__value},m(u,m){M(u,e,m),M(u,n,m);for(let r=0;r<o.length;r+=1)o[r]&&o[r].m(u,m);M(u,l,m)},p(u,[m]){if(m&1){i=u[0];let r;for(r=0;r<i.length;r+=1){const f=mf(u,i,r);o[r]?o[r].p(f,m):(o[r]=_f(f),o[r].c(),o[r].m(l.parentNode,l))}for(;r<o.length;r+=1)o[r].d(1);o.length=i.length}},i:be,o:be,d(u){u&&y(e),u&&y(n),mt(o,u),u&&y(l)}}}function S_(t){return[["Amsterdam","Athens","Belfast","Berlin","Bratislava","Brussels","Bucharest","Budapest","Copenhagen","Dublin","Helsinki","Lisbon","Ljubljana","London","Luxembourg","Madrid","Malta","Nicosia","Oslo","Paris","Prague","Riga","Rome","Sofia","Stockholm","Tallinn","Vienna","Vilnius","Warsaw","Zagreb","Zurich"]]}class T_ extends We{constructor(e){super(),He(this,e,S_,M_,Be,{})}}function N_(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d;return{c(){e=c("optgroup"),n=c("option"),n.textContent="/24",l=b(),i=c("optgroup"),o=c("option"),o.textContent="/25",u=c("option"),u.textContent="/26",m=c("option"),m.textContent="/27",r=c("option"),r.textContent="/28",f=c("option"),f.textContent="/29",p=b(),_=c("optgroup"),h=c("option"),h.textContent="/23",v=c("option"),v.textContent="/22",d=c("option"),d.textContent="/16",n.__value="255.255.255.0",n.value=n.__value,a(e,"label","Most common is /24 (255.255.255.0)"),o.__value="255.255.255.128",o.value=o.__value,u.__value="255.255.255.192",u.value=u.__value,m.__value="255.255.255.224",m.value=m.__value,r.__value="255.255.255.240",r.value=r.__value,f.__value="255.255.255.248",f.value=f.__value,a(i,"label","Smaller subnets"),h.__value="255.255.254.0",h.value=h.__value,v.__value="255.255.252.0",v.value=v.__value,d.__value="255.255.0.0",d.value=d.__value,a(_,"label","Larger subnets")},m(g,k){M(g,e,k),s(e,n),M(g,l,k),M(g,i,k),s(i,o),s(i,u),s(i,m),s(i,r),s(i,f),M(g,p,k),M(g,_,k),s(_,h),s(_,v),s(_,d)},p:be,i:be,o:be,d(g){g&&y(e),g&&y(l),g&&y(i),g&&y(p),g&&y(_)}}}class M0 extends We{constructor(e){super(),He(this,e,null,N_,Be,{})}}function E_(t){let e,n;return{c(){e=je("svg"),n=je("path"),a(n,"stroke-linecap","round"),a(n,"stroke-linejoin","round"),a(n,"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"),a(e,"xmlns","http://www.w3.org/2000/svg"),a(e,"fill","none"),a(e,"viewBox","0 0 24 24"),a(e,"stroke-width","1.5"),a(e,"stroke","currentColor"),a(e,"class","w-4 h-4")},m(l,i){M(l,e,i),s(e,n)},p:be,i:be,o:be,d(l){l&&y(e)}}}class Es extends We{constructor(e){super(),He(this,e,null,E_,Be,{})}}var P_=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},S0={exports:{}};(function(t,e){(function(n,l){t.exports=l()})(P_,function(){var n=function(){},l=Object.prototype.hasOwnProperty,i=Array.prototype.slice;function o(T,w){var S;return typeof Object.create=="function"?S=Object.create(T):(n.prototype=T,S=new n,n.prototype=null),w&&m(!0,S,w),S}function u(T,w,S,D){var O=this;return typeof T!="string"&&(D=S,S=w,w=T,T=null),typeof w!="function"&&(D=S,S=w,w=function(){return O.apply(this,arguments)}),m(!1,w,O,D),w.prototype=o(O.prototype,S),w.prototype.constructor=w,w.class_=T||O.class_,w.super_=O,w}function m(T,w,S){S=i.call(arguments,2);for(var D,O,J=0,le=S.length;J<le;J++){O=S[J];for(D in O)(!T||l.call(O,D))&&(w[D]=O[D])}}var r=u;function f(){}f.class_="Nevis",f.super_=Object,f.extend=r;var p=f,_=p,h=_.extend(function(T,w,S){this.qrious=T,this.element=w,this.element.qrious=T,this.enabled=Boolean(S)},{draw:function(T){},getElement:function(){return this.enabled||(this.enabled=!0,this.render()),this.element},getModuleSize:function(T){var w=this.qrious,S=w.padding||0,D=Math.floor((w.size-S*2)/T.width);return Math.max(1,D)},render:function(T){this.enabled&&(this.resize(),this.reset(),this.draw(T))},reset:function(){},resize:function(){}}),v=h,d=v.extend({draw:function(T){var w,S,D=this.qrious,O=this.getModuleSize(T),J=parseInt((this.element.width-T.width*O)/2),le=this.element.getContext("2d");for(le.fillStyle=D.foreground,le.globalAlpha=D.foregroundAlpha,w=0;w<T.width;w++)for(S=0;S<T.width;S++)T.buffer[S*T.width+w]&&le.fillRect(O*w+J,O*S+J,O,O)},reset:function(){var T=this.qrious,w=this.element.getContext("2d"),S=T.size;w.lineWidth=1,w.clearRect(0,0,S,S),w.fillStyle=T.background,w.globalAlpha=T.backgroundAlpha,w.fillRect(0,0,S,S)},resize:function(){var T=this.element;T.width=T.height=this.qrious.size}}),g=d,k=_.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]}),$=k,N=_.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}}),A=N,F=_.extend(null,{EXPONENT:[1,2,4,8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143,3,6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140,5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141,7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138,9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,0],LOG:[255,0,1,25,2,50,26,198,3,223,51,238,27,104,199,75,4,100,224,14,52,141,239,129,28,193,105,248,200,8,76,113,5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154,9,120,77,228,114,166,6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87,7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175]}),I=F,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]}),C=R,P=_.extend(function(T){var w,S,D,O,J,le=T.value.length;for(this._badness=[],this._level=A.LEVELS[T.level],this._polynomial=[],this._value=T.value,this._version=0,this._stringBuffer=[];this._version<40&&(this._version++,D=(this._level-1)*4+(this._version-1)*16,O=A.BLOCKS[D++],J=A.BLOCKS[D++],w=A.BLOCKS[D++],S=A.BLOCKS[D],D=w*(O+J)+J-3+(this._version<=9),!(le<=D)););this._dataBlock=w,this._eccBlock=S,this._neccBlock1=O,this._neccBlock2=J;var pe=this.width=17+4*this._version;this.buffer=P._createArray(pe*pe),this._ecc=P._createArray(w+(w+S)*(O+J)+J),this._mask=P._createArray((pe*(pe+1)+1)/2),this._insertFinders(),this._insertAlignments(),this.buffer[8+pe*(pe-8)]=1,this._insertTimingGap(),this._reverseMask(),this._insertTimingRowAndColumn(),this._insertVersion(),this._syncMask(),this._convertBitStream(le),this._calculatePolynomial(),this._appendEccToData(),this._interleaveBlocks(),this._pack(),this._finish()},{_addAlignment:function(T,w){var S,D=this.buffer,O=this.width;for(D[T+O*w]=1,S=-2;S<2;S++)D[T+S+O*(w-2)]=1,D[T-2+O*(w+S+1)]=1,D[T+2+O*(w+S)]=1,D[T+S+1+O*(w+2)]=1;for(S=0;S<2;S++)this._setMask(T-1,w+S),this._setMask(T+1,w-S),this._setMask(T-S,w-1),this._setMask(T+S,w+1)},_appendData:function(T,w,S,D){var O,J,le,pe=this._polynomial,ge=this._stringBuffer;for(J=0;J<D;J++)ge[S+J]=0;for(J=0;J<w;J++){if(O=I.LOG[ge[T+J]^ge[S]],O!==255)for(le=1;le<D;le++)ge[S+le-1]=ge[S+le]^I.EXPONENT[P._modN(O+pe[D-le])];else for(le=S;le<S+D;le++)ge[le]=ge[le+1];ge[S+D-1]=O===255?0:I.EXPONENT[P._modN(O+pe[0])]}},_appendEccToData:function(){var T,w=0,S=this._dataBlock,D=this._calculateMaxLength(),O=this._eccBlock;for(T=0;T<this._neccBlock1;T++)this._appendData(w,S,D,O),w+=S,D+=O;for(T=0;T<this._neccBlock2;T++)this._appendData(w,S+1,D,O),w+=S+1,D+=O},_applyMask:function(T){var w,S,D,O,J=this.buffer,le=this.width;switch(T){case 0:for(O=0;O<le;O++)for(D=0;D<le;D++)!(D+O&1)&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 1:for(O=0;O<le;O++)for(D=0;D<le;D++)!(O&1)&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 2:for(O=0;O<le;O++)for(w=0,D=0;D<le;D++,w++)w===3&&(w=0),!w&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 3:for(S=0,O=0;O<le;O++,S++)for(S===3&&(S=0),w=S,D=0;D<le;D++,w++)w===3&&(w=0),!w&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 4:for(O=0;O<le;O++)for(w=0,S=O>>1&1,D=0;D<le;D++,w++)w===3&&(w=0,S=!S),!S&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 5:for(S=0,O=0;O<le;O++,S++)for(S===3&&(S=0),w=0,D=0;D<le;D++,w++)w===3&&(w=0),!((D&O&1)+!(!w|!S))&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 6:for(S=0,O=0;O<le;O++,S++)for(S===3&&(S=0),w=0,D=0;D<le;D++,w++)w===3&&(w=0),!((D&O&1)+(w&&w===S)&1)&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break;case 7:for(S=0,O=0;O<le;O++,S++)for(S===3&&(S=0),w=0,D=0;D<le;D++,w++)w===3&&(w=0),!((w&&w===S)+(D+O&1)&1)&&!this._isMasked(D,O)&&(J[D+O*le]^=1);break}},_calculateMaxLength:function(){return this._dataBlock*(this._neccBlock1+this._neccBlock2)+this._neccBlock2},_calculatePolynomial:function(){var T,w,S=this._eccBlock,D=this._polynomial;for(D[0]=1,T=0;T<S;T++){for(D[T+1]=1,w=T;w>0;w--)D[w]=D[w]?D[w-1]^I.EXPONENT[P._modN(I.LOG[D[w]]+T)]:D[w-1];D[0]=I.EXPONENT[P._modN(I.LOG[D[0]]+T)]}for(T=0;T<=S;T++)D[T]=I.LOG[D[T]]},_checkBadness:function(){var T,w,S,D,O,J=0,le=this._badness,pe=this.buffer,ge=this.width;for(O=0;O<ge-1;O++)for(D=0;D<ge-1;D++)(pe[D+ge*O]&&pe[D+1+ge*O]&&pe[D+ge*(O+1)]&&pe[D+1+ge*(O+1)]||!(pe[D+ge*O]||pe[D+1+ge*O]||pe[D+ge*(O+1)]||pe[D+1+ge*(O+1)]))&&(J+=P.N2);var Ae=0;for(O=0;O<ge;O++){for(S=0,le[0]=0,T=0,D=0;D<ge;D++)w=pe[D+ge*O],T===w?le[S]++:le[++S]=1,T=w,Ae+=T?1:-1;J+=this._getBadness(S)}Ae<0&&(Ae=-Ae);var Fe=0,ce=Ae;for(ce+=ce<<2,ce<<=1;ce>ge*ge;)ce-=ge*ge,Fe++;for(J+=Fe*P.N4,D=0;D<ge;D++){for(S=0,le[0]=0,T=0,O=0;O<ge;O++)w=pe[D+ge*O],T===w?le[S]++:le[++S]=1,T=w;J+=this._getBadness(S)}return J},_convertBitStream:function(T){var w,S,D=this._ecc,O=this._version;for(S=0;S<T;S++)D[S]=this._value.charCodeAt(S);var J=this._stringBuffer=D.slice(),le=this._calculateMaxLength();T>=le-2&&(T=le-2,O>9&&T--);var pe=T;if(O>9){for(J[pe+2]=0,J[pe+3]=0;pe--;)w=J[pe],J[pe+3]|=255&w<<4,J[pe+2]=w>>4;J[2]|=255&T<<4,J[1]=T>>4,J[0]=64|T>>12}else{for(J[pe+1]=0,J[pe+2]=0;pe--;)w=J[pe],J[pe+2]|=255&w<<4,J[pe+1]=w>>4;J[1]|=255&T<<4,J[0]=64|T>>4}for(pe=T+3-(O<10);pe<le;)J[pe++]=236,J[pe++]=17},_getBadness:function(T){var w,S=0,D=this._badness;for(w=0;w<=T;w++)D[w]>=5&&(S+=P.N1+D[w]-5);for(w=3;w<T-1;w+=2)D[w-2]===D[w+2]&&D[w+2]===D[w-1]&&D[w-1]===D[w+1]&&D[w-1]*3===D[w]&&(D[w-3]===0||w+3>T||D[w-3]*3>=D[w]*4||D[w+3]*3>=D[w]*4)&&(S+=P.N3);return S},_finish:function(){this._stringBuffer=this.buffer.slice();var T,w,S=0,D=3e4;for(w=0;w<8&&(this._applyMask(w),T=this._checkBadness(),T<D&&(D=T,S=w),S!==7);w++)this.buffer=this._stringBuffer.slice();S!==w&&this._applyMask(S),D=A.FINAL_FORMAT[S+(this._level-1<<3)];var O=this.buffer,J=this.width;for(w=0;w<8;w++,D>>=1)D&1&&(O[J-1-w+J*8]=1,w<6?O[8+J*w]=1:O[8+J*(w+1)]=1);for(w=0;w<7;w++,D>>=1)D&1&&(O[8+J*(J-7+w)]=1,w?O[6-w+J*8]=1:O[7+J*8]=1)},_interleaveBlocks:function(){var T,w,S=this._dataBlock,D=this._ecc,O=this._eccBlock,J=0,le=this._calculateMaxLength(),pe=this._neccBlock1,ge=this._neccBlock2,Ae=this._stringBuffer;for(T=0;T<S;T++){for(w=0;w<pe;w++)D[J++]=Ae[T+w*S];for(w=0;w<ge;w++)D[J++]=Ae[pe*S+T+w*(S+1)]}for(w=0;w<ge;w++)D[J++]=Ae[pe*S+T+w*(S+1)];for(T=0;T<O;T++)for(w=0;w<pe+ge;w++)D[J++]=Ae[le+T+w*O];this._stringBuffer=D},_insertAlignments:function(){var T,w,S,D=this._version,O=this.width;if(D>1)for(T=$.BLOCK[D],S=O-7;;){for(w=O-7;w>T-3&&(this._addAlignment(w,S),!(w<T));)w-=T;if(S<=T+9)break;S-=T,this._addAlignment(6,S),this._addAlignment(S,6)}},_insertFinders:function(){var T,w,S,D,O=this.buffer,J=this.width;for(T=0;T<3;T++){for(w=0,D=0,T===1&&(w=J-7),T===2&&(D=J-7),O[D+3+J*(w+3)]=1,S=0;S<6;S++)O[D+S+J*w]=1,O[D+J*(w+S+1)]=1,O[D+6+J*(w+S)]=1,O[D+S+1+J*(w+6)]=1;for(S=1;S<5;S++)this._setMask(D+S,w+1),this._setMask(D+1,w+S+1),this._setMask(D+5,w+S),this._setMask(D+S+1,w+5);for(S=2;S<4;S++)O[D+S+J*(w+2)]=1,O[D+2+J*(w+S+1)]=1,O[D+4+J*(w+S)]=1,O[D+S+1+J*(w+4)]=1}},_insertTimingGap:function(){var T,w,S=this.width;for(w=0;w<7;w++)this._setMask(7,w),this._setMask(S-8,w),this._setMask(7,w+S-7);for(T=0;T<8;T++)this._setMask(T,7),this._setMask(T+S-8,7),this._setMask(T,S-8)},_insertTimingRowAndColumn:function(){var T,w=this.buffer,S=this.width;for(T=0;T<S-14;T++)T&1?(this._setMask(8+T,6),this._setMask(6,8+T)):(w[8+T+S*6]=1,w[6+S*(8+T)]=1)},_insertVersion:function(){var T,w,S,D,O=this.buffer,J=this._version,le=this.width;if(J>6)for(T=C.BLOCK[J-7],w=17,S=0;S<6;S++)for(D=0;D<3;D++,w--)1&(w>11?J>>w-12:T>>w)?(O[5-S+le*(2-D+le-11)]=1,O[2-D+le-11+le*(5-S)]=1):(this._setMask(5-S,2-D+le-11),this._setMask(2-D+le-11,5-S))},_isMasked:function(T,w){var S=P._getMaskBit(T,w);return this._mask[S]===1},_pack:function(){var T,w,S,D=1,O=1,J=this.width,le=J-1,pe=J-1,ge=(this._dataBlock+this._eccBlock)*(this._neccBlock1+this._neccBlock2)+this._neccBlock2;for(w=0;w<ge;w++)for(T=this._stringBuffer[w],S=0;S<8;S++,T<<=1){128&T&&(this.buffer[le+J*pe]=1);do O?le--:(le++,D?pe!==0?pe--:(le-=2,D=!D,le===6&&(le--,pe=9)):pe!==J-1?pe++:(le-=2,D=!D,le===6&&(le--,pe-=8))),O=!O;while(this._isMasked(le,pe))}},_reverseMask:function(){var T,w,S=this.width;for(T=0;T<9;T++)this._setMask(T,8);for(T=0;T<8;T++)this._setMask(T+S-8,8),this._setMask(8,T);for(w=0;w<7;w++)this._setMask(8,w+S-7)},_setMask:function(T,w){var S=P._getMaskBit(T,w);this._mask[S]=1},_syncMask:function(){var T,w,S=this.width;for(w=0;w<S;w++)for(T=0;T<=w;T++)this.buffer[T+S*w]&&this._setMask(T,w)}},{_createArray:function(T){var w,S=[];for(w=0;w<T;w++)S[w]=0;return S},_getMaskBit:function(T,w){var S;return T>w&&(S=T,T=w,w=S),S=w,S+=w*w,S>>=1,S+=T,S},_modN:function(T){for(;T>=255;)T-=255,T=(T>>8)+(T&255);return T},N1:3,N2:3,N3:40,N4:10}),ne=P,j=v.extend({draw:function(){this.element.src=this.qrious.toDataURL()},reset:function(){this.element.src=""},resize:function(){var T=this.element;T.width=T.height=this.qrious.size}}),B=j,H=_.extend(function(T,w,S,D){this.name=T,this.modifiable=Boolean(w),this.defaultValue=S,this._valueTransformer=D},{transform:function(T){var w=this._valueTransformer;return typeof w=="function"?w(T,this):T}}),V=H,G=_.extend(null,{abs:function(T){return T!=null?Math.abs(T):null},hasOwn:function(T,w){return Object.prototype.hasOwnProperty.call(T,w)},noop:function(){},toUpperCase:function(T){return T!=null?T.toUpperCase():null}}),K=G,Z=_.extend(function(T){this.options={},T.forEach(function(w){this.options[w.name]=w},this)},{exists:function(T){return this.options[T]!=null},get:function(T,w){return Z._get(this.options[T],w)},getAll:function(T){var w,S=this.options,D={};for(w in S)K.hasOwn(S,w)&&(D[w]=Z._get(S[w],T));return D},init:function(T,w,S){typeof S!="function"&&(S=K.noop);var D,O;for(D in this.options)K.hasOwn(this.options,D)&&(O=this.options[D],Z._set(O,O.defaultValue,w),Z._createAccessor(O,w,S));this._setAll(T,w,!0)},set:function(T,w,S){return this._set(T,w,S)},setAll:function(T,w){return this._setAll(T,w)},_set:function(T,w,S,D){var O=this.options[T];if(!O)throw new Error("Invalid option: "+T);if(!O.modifiable&&!D)throw new Error("Option cannot be modified: "+T);return Z._set(O,w,S)},_setAll:function(T,w,S){if(!T)return!1;var D,O=!1;for(D in T)K.hasOwn(T,D)&&this._set(D,T[D],w,S)&&(O=!0);return O}},{_createAccessor:function(T,w,S){var D={get:function(){return Z._get(T,w)}};T.modifiable&&(D.set=function(O){Z._set(T,O,w)&&S(O,T)}),Object.defineProperty(w,T.name,D)},_get:function(T,w){return w["_"+T.name]},_set:function(T,w,S){var D="_"+T.name,O=S[D],J=T.transform(w!=null?w:T.defaultValue);return S[D]=J,J!==O}}),z=Z,W=_.extend(function(){this._services={}},{getService:function(T){var w=this._services[T];if(!w)throw new Error("Service is not being managed with name: "+T);return w},setService:function(T,w){if(this._services[T])throw new Error("Service is already managed with name: "+T);w&&(this._services[T]=w)}}),x=W,_e=new z([new V("background",!0,"white"),new V("backgroundAlpha",!0,1,K.abs),new V("element"),new V("foreground",!0,"black"),new V("foregroundAlpha",!0,1,K.abs),new V("level",!0,"L",K.toUpperCase),new V("mime",!0,"image/png"),new V("padding",!0,null,K.abs),new V("size",!0,100,K.abs),new V("value",!0,"")]),ie=new x,me=_.extend(function(T){_e.init(T,this,this.update.bind(this));var w=_e.get("element",this),S=ie.getService("element"),D=w&&S.isCanvas(w)?w:S.createCanvas(),O=w&&S.isImage(w)?w:S.createImage();this._canvasRenderer=new g(this,D,!0),this._imageRenderer=new B(this,O,O===w),this.update()},{get:function(){return _e.getAll(this)},set:function(T){_e.setAll(T,this)&&this.update()},toDataURL:function(T){return this.canvas.toDataURL(T||this.mime)},update:function(){var T=new ne({level:this.level,value:this.value});this._canvasRenderer.render(T),this._imageRenderer.render(T)}},{use:function(T){ie.setService(T.getName(),T)}});Object.defineProperties(me.prototype,{canvas:{get:function(){return this._canvasRenderer.getElement()}},image:{get:function(){return this._imageRenderer.getElement()}}});var Y=me,ke=Y,Ee=_.extend({getName:function(){}}),we=Ee,Me=we.extend({createCanvas:function(){},createImage:function(){},getName:function(){return"element"},isCanvas:function(T){},isImage:function(T){}}),te=Me,fe=te.extend({createCanvas:function(){return document.createElement("canvas")},createImage:function(){return document.createElement("img")},isCanvas:function(T){return T instanceof HTMLCanvasElement},isImage:function(T){return T instanceof HTMLImageElement}}),Oe=fe;ke.use(new Oe);var Ie=ke;return Ie})})(S0);const A_=S0.exports;function $_(t){let e,n;return{c(){e=c("img"),ks(e.src,n=t[2])||a(e,"src",n),a(e,"alt",t[0]),a(e,"class",t[1])},m(l,i){M(l,e,i)},p(l,[i]){i&4&&!ks(e.src,n=l[2])&&a(e,"src",n),i&1&&a(e,"alt",l[0]),i&2&&a(e,"class",l[1])},i:be,o:be,d(l){l&&y(e)}}}function D_(t,e,n){const l=new A_;let{errorCorrection:i="L"}=e,{background:o="#fff"}=e,{color:u="#000"}=e,{size:m="200"}=e,{value:r=""}=e,{padding:f=0}=e,{className:p="qrcode"}=e,_="";function h(){l.set({background:o,foreground:u,level:i,padding:f,size:m,value:r}),n(2,_=l.toDataURL("image/jpeg"))}return D1(()=>{h()}),t.$$set=v=>{"errorCorrection"in v&&n(3,i=v.errorCorrection),"background"in v&&n(4,o=v.background),"color"in v&&n(5,u=v.color),"size"in v&&n(6,m=v.size),"value"in v&&n(0,r=v.value),"padding"in v&&n(7,f=v.padding),"className"in v&&n(1,p=v.className)},t.$$.update=()=>{t.$$.dirty&1&&r&&h()},[r,p,_,i,o,u,m,f]}class L_ extends We{constructor(e){super(),He(this,e,D_,$_,Be,{errorCorrection:3,background:4,color:5,size:6,value:0,padding:7,className:1})}}function pf(t,e,n){const l=t.slice();return l[102]=e[n],l[103]=e,l[104]=n,l}function df(t,e,n){const l=t.slice();return l[105]=e[n],l[106]=e,l[107]=n,l}function I_(t,e,n){const l=t.slice();return l[108]=e[n],l}function R_(t,e,n){const l=t.slice();return l[111]=e[n],l}function F_(t){let e,n;return{c(){e=c("option"),n=E(t[111]),e.__value=t[111],e.value=e.__value},m(l,i){M(l,e,i),s(e,n)},p:be,d(l){l&&y(e)}}}function O_(t){let e;return{c(){e=E("Configure price")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function hf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","pt"),a(n,"type","text"),a(n,"class","in-s"),a(n,"placeholder","ENTSO-E API key, optional, read docs")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].p.t),l||(i=Q(n,"input",t[21]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].p.t&&ue(n,o[3].p.t)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function vf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;return{c(){e=c("div"),n=E("Username"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),a(o,"name","gu"),a(o,"type","text"),a(o,"class","in-s"),a(o,"maxlength","36"),a(e,"class","my-1"),a(_,"name","gp"),a(_,"type","password"),a(_,"class","in-s"),a(_,"maxlength","36"),a(m,"class","my-1")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].g.u),M(d,u,g),M(d,m,g),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].g.p),h||(v=[Q(o,"input",t[23]),Q(_,"input",t[24])],h=!0)},p(d,g){g[0]&8&&o.value!==d[3].g.u&&ue(o,d[3].g.u),g[0]&8&&_.value!==d[3].g.p&&ue(_,d[3].g.p)},d(d){d&&y(e),d&&y(u),d&&y(m),h=!1,lt(v)}}}function q_(t){let e,n=t[108]*100+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[108]*100,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function bf(t){let e,n,l,i;return{c(){e=c("br"),n=c("input"),a(n,"name","mek"),a(n,"type","text"),a(n,"class","in-s")},m(o,u){M(o,e,u),M(o,n,u),ue(n,t[3].m.e.k),l||(i=Q(n,"input",t[35]),l=!0)},p(o,u){u[0]&8&&n.value!==o[3].m.e.k&&ue(n,o[3].m.e.k)},d(o){o&&y(e),o&&y(n),l=!1,i()}}}function gf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Authentication key"),l=c("br"),i=b(),o=c("input"),a(o,"name","mea"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].m.e.a),u||(m=Q(o,"input",t[36]),u=!0)},p(r,f){f[0]&8&&o.value!==r[3].m.e.a&&ue(o,r[3].m.e.a)},d(r){r&&y(e),u=!1,m()}}}function kf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j;return{c(){e=c("div"),n=c("div"),l=E("Watt"),i=c("br"),o=b(),u=c("input"),m=b(),r=c("div"),f=E("Volt"),p=c("br"),_=b(),h=c("input"),v=b(),d=c("div"),g=E("Amp"),k=c("br"),$=b(),N=c("input"),A=b(),F=c("div"),I=E("kWh"),R=c("br"),C=b(),P=c("input"),a(u,"name","mmw"),a(u,"type","number"),a(u,"min","0.00"),a(u,"max","1000"),a(u,"step","0.001"),a(u,"class","in-f tr w-full"),a(n,"class","w-1/4"),a(h,"name","mmv"),a(h,"type","number"),a(h,"min","0.00"),a(h,"max","1000"),a(h,"step","0.001"),a(h,"class","in-m tr w-full"),a(r,"class","w-1/4"),a(N,"name","mma"),a(N,"type","number"),a(N,"min","0.00"),a(N,"max","1000"),a(N,"step","0.001"),a(N,"class","in-m tr w-full"),a(d,"class","w-1/4"),a(P,"name","mmc"),a(P,"type","number"),a(P,"min","0.00"),a(P,"max","1000"),a(P,"step","0.001"),a(P,"class","in-l tr w-full"),a(F,"class","w-1/4"),a(e,"class","flex my-1")},m(B,H){M(B,e,H),s(e,n),s(n,l),s(n,i),s(n,o),s(n,u),ue(u,t[3].m.m.w),s(e,m),s(e,r),s(r,f),s(r,p),s(r,_),s(r,h),ue(h,t[3].m.m.v),s(e,v),s(e,d),s(d,g),s(d,k),s(d,$),s(d,N),ue(N,t[3].m.m.a),s(e,A),s(e,F),s(F,I),s(F,R),s(F,C),s(F,P),ue(P,t[3].m.m.c),ne||(j=[Q(u,"input",t[38]),Q(h,"input",t[39]),Q(N,"input",t[40]),Q(P,"input",t[41])],ne=!0)},p(B,H){H[0]&8&&Se(u.value)!==B[3].m.m.w&&ue(u,B[3].m.m.w),H[0]&8&&Se(h.value)!==B[3].m.m.v&&ue(h,B[3].m.m.v),H[0]&8&&Se(N.value)!==B[3].m.m.a&&ue(N,B[3].m.m.a),H[0]&8&&Se(P.value)!==B[3].m.m.c&&ue(P,B[3].m.m.c)},d(B){B&&y(e),ne=!1,lt(j)}}}function wf(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Cf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("Password"),f=c("br"),p=b(),_=c("input"),h=b(),v=c("div"),d=c("div"),g=E("Power saving"),k=c("br"),$=b(),N=c("select"),A=c("option"),A.textContent="Default",F=c("option"),F.textContent="Off",I=c("option"),I.textContent="Minimum",R=c("option"),R.textContent="Maximum",C=b(),P=c("div"),ne=E("Power"),j=c("br"),B=b(),H=c("div"),V=c("input"),G=b(),K=c("span"),K.textContent="dBm",Z=b(),z=c("div"),W=c("label"),x=c("input"),_e=E(" Allow 802.11b legacy rates"),a(o,"name","ws"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(_,"name","wp"),a(_,"type","password"),a(_,"class","in-s"),a(m,"class","my-1"),A.__value=255,A.value=A.__value,F.__value=0,F.value=F.__value,I.__value=1,I.value=I.__value,R.__value=2,R.value=R.__value,a(N,"name","wz"),a(N,"class","in-s"),t[3].w.z===void 0&&Ze(()=>t[45].call(N)),a(d,"class","w-1/2"),a(V,"name","ww"),a(V,"type","number"),a(V,"min","0"),a(V,"max","20.5"),a(V,"step","0.5"),a(V,"class","in-f tr w-full"),a(K,"class","in-post"),a(H,"class","flex"),a(P,"class","ml-2 w-1/2"),a(v,"class","my-1 flex"),a(x,"type","checkbox"),a(x,"name","wb"),x.__value="true",x.value=x.__value,a(x,"class","rounded mb-1"),a(z,"class","my-3")},m(Y,ke){M(Y,e,ke),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].w.s),M(Y,u,ke),M(Y,m,ke),s(m,r),s(m,f),s(m,p),s(m,_),ue(_,t[3].w.p),M(Y,h,ke),M(Y,v,ke),s(v,d),s(d,g),s(d,k),s(d,$),s(d,N),s(N,A),s(N,F),s(N,I),s(N,R),Te(N,t[3].w.z,!0),s(v,C),s(v,P),s(P,ne),s(P,j),s(P,B),s(P,H),s(H,V),ue(V,t[3].w.w),s(H,G),s(H,K),M(Y,Z,ke),M(Y,z,ke),s(z,W),s(W,x),x.checked=t[3].w.b,s(W,_e),ie||(me=[Q(o,"input",t[43]),Q(_,"input",t[44]),Q(N,"change",t[45]),Q(V,"input",t[46]),Q(x,"change",t[47])],ie=!0)},p(Y,ke){ke[0]&8&&o.value!==Y[3].w.s&&ue(o,Y[3].w.s),ke[0]&8&&_.value!==Y[3].w.p&&ue(_,Y[3].w.p),ke[0]&8&&Te(N,Y[3].w.z),ke[0]&8&&Se(V.value)!==Y[3].w.w&&ue(V,Y[3].w.w),ke[0]&8&&(x.checked=Y[3].w.b)},d(Y){Y&&y(e),Y&&y(u),Y&&y(m),Y&&y(h),Y&&y(v),Y&&y(Z),Y&&y(z),ie=!1,lt(me)}}}function yf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k;return{c(){e=c("div"),n=E("Gateway"),l=c("br"),i=b(),o=c("input"),u=b(),m=c("div"),r=E("DNS"),f=c("br"),p=b(),_=c("div"),h=c("input"),v=b(),d=c("input"),a(o,"name","ng"),a(o,"type","text"),a(o,"class","in-s"),a(e,"class","my-1"),a(h,"name","nd1"),a(h,"type","text"),a(h,"class","in-f w-full"),a(d,"name","nd2"),a(d,"type","text"),a(d,"class","in-l w-full"),a(_,"class","flex"),a(m,"class","my-1")},m($,N){M($,e,N),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].n.g),M($,u,N),M($,m,N),s(m,r),s(m,f),s(m,p),s(m,_),s(_,h),ue(h,t[3].n.d1),s(_,v),s(_,d),ue(d,t[3].n.d2),g||(k=[Q(o,"input",t[51]),Q(h,"input",t[52]),Q(d,"input",t[53])],g=!0)},p($,N){N[0]&8&&o.value!==$[3].n.g&&ue(o,$[3].n.g),N[0]&8&&h.value!==$[3].n.d1&&ue(h,$[3].n.d1),N[0]&8&&d.value!==$[3].n.d2&&ue(d,$[3].n.d2)},d($){$&&y(e),$&&y(u),$&&y(m),g=!1,lt(k)}}}function Mf(t){let e,n,l,i,o;return{c(){e=c("label"),n=c("input"),l=E(" SSL"),a(n,"type","checkbox"),a(n,"name","qs"),n.__value="true",n.value=n.__value,a(n,"class","rounded mb-1"),a(e,"class","float-right mr-3")},m(u,m){M(u,e,m),s(e,n),n.checked=t[3].q.s.e,s(e,l),i||(o=[Q(n,"change",t[57]),Q(n,"change",t[14])],i=!0)},p(u,m){m[0]&8&&(n.checked=u[3].q.s.e)},d(u){u&&y(e),i=!1,lt(o)}}}function Sf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;const d=[U_,B_],g=[];function k(C,P){return C[3].q.s.c?0:1}l=k(t),i=g[l]=d[l](t);const $=[z_,W_],N=[];function A(C,P){return C[3].q.s.r?0:1}m=A(t),r=N[m]=$[m](t);const F=[Y_,K_],I=[];function R(C,P){return C[3].q.s.k?0:1}return _=R(t),h=I[_]=F[_](t),{c(){e=c("div"),n=c("span"),i.c(),o=b(),u=c("span"),r.c(),f=b(),p=c("span"),h.c(),a(n,"class","flex pr-2"),a(u,"class","flex pr-2"),a(p,"class","flex pr-2"),a(e,"class","my-1 flex")},m(C,P){M(C,e,P),s(e,n),g[l].m(n,null),s(e,o),s(e,u),N[m].m(u,null),s(e,f),s(e,p),I[_].m(p,null),v=!0},p(C,P){let ne=l;l=k(C),l===ne?g[l].p(C,P):($e(),q(g[ne],1,1,()=>{g[ne]=null}),De(),i=g[l],i?i.p(C,P):(i=g[l]=d[l](C),i.c()),L(i,1),i.m(n,null));let j=m;m=A(C),m===j?N[m].p(C,P):($e(),q(N[j],1,1,()=>{N[j]=null}),De(),r=N[m],r?r.p(C,P):(r=N[m]=$[m](C),r.c()),L(r,1),r.m(u,null));let B=_;_=R(C),_===B?I[_].p(C,P):($e(),q(I[B],1,1,()=>{I[B]=null}),De(),h=I[_],h?h.p(C,P):(h=I[_]=F[_](C),h.c()),L(h,1),h.m(p,null))},i(C){v||(L(i),L(r),L(h),v=!0)},o(C){q(i),q(r),q(h),v=!1},d(C){C&&y(e),g[l].d(),N[m].d(),I[_].d()}}}function B_(t){let e,n;return e=new el({props:{to:"/mqtt-ca",$$slots:{default:[j_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function U_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-ca",$$slots:{default:[H_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(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),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[11]),Q(i,"keypress",t[11])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function j_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload CA",title:"Click here to upload CA"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function H_(t){let e;return{c(){e=E("CA OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function W_(t){let e,n;return e=new el({props:{to:"/mqtt-cert",$$slots:{default:[G_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function z_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-cert",$$slots:{default:[V_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(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),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[12]),Q(i,"keypress",t[12])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function G_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload cert",title:"Click here to upload certificate"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function V_(t){let e;return{c(){e=E("Cert OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function K_(t){let e,n;return e=new el({props:{to:"/mqtt-key",$$slots:{default:[Q_]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i[3]&2097152&&(o.$$scope={dirty:i,ctx:l}),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Y_(t){let e,n,l,i,o,u,m,r;return n=new el({props:{to:"/mqtt-key",$$slots:{default:[X_]},$$scope:{ctx:t}}}),o=new Es({}),{c(){e=c("span"),ae(n.$$.fragment),l=b(),i=c("span"),ae(o.$$.fragment),a(e,"class","rounded-l-md bg-green-500 text-green-100 text-xs font-semibold px-2.5 py-1"),a(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),se(n,e,null),M(f,l,p),M(f,i,p),se(o,i,null),u=!0,m||(r=[Q(i,"click",t[13]),Q(i,"keypress",t[13])],m=!0)},p(f,p){const _={};p[3]&2097152&&(_.$$scope={dirty:p,ctx:f}),n.$set(_)},i(f){u||(L(n.$$.fragment,f),L(o.$$.fragment,f),u=!0)},o(f){q(n.$$.fragment,f),q(o.$$.fragment,f),u=!1},d(f){f&&y(e),oe(n),f&&y(l),f&&y(i),oe(o),m=!1,lt(r)}}}function Q_(t){let e,n;return e=new fn({props:{color:"blue",text:"Upload key",title:"Click here to upload key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function X_(t){let e;return{c(){e=E("Key OK")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Tf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z;return o=new Ht({}),{c(){e=c("div"),n=c("strong"),n.textContent="Domoticz",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("div"),_=E("Electricity IDX"),h=c("br"),v=b(),d=c("input"),g=b(),k=c("div"),$=E("Current IDX"),N=c("br"),A=b(),F=c("input"),I=b(),R=c("div"),C=E(`Voltage IDX: L1, L2 & L3
|
|
`),P=c("div"),ne=c("input"),j=b(),B=c("input"),H=b(),V=c("input"),a(n,"class","text-sm"),a(i,"href",Wt("MQTT-configuration#domoticz")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","o"),m.value="true",a(d,"name","oe"),a(d,"type","text"),a(d,"class","in-f tr w-full"),a(p,"class","w-1/2"),a(F,"name","oc"),a(F,"type","text"),a(F,"class","in-l tr w-full"),a(k,"class","w-1/2"),a(f,"class","my-1 flex"),a(ne,"name","ou1"),a(ne,"type","text"),a(ne,"class","in-f tr w-1/3"),a(B,"name","ou2"),a(B,"type","text"),a(B,"class","in-m tr w-1/3"),a(V,"name","ou3"),a(V,"type","text"),a(V,"class","in-l tr w-1/3"),a(P,"class","flex"),a(R,"class","my-1"),a(e,"class","cnt")},m(z,W){M(z,e,W),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),ue(d,t[3].o.e),s(f,g),s(f,k),s(k,$),s(k,N),s(k,A),s(k,F),ue(F,t[3].o.c),s(e,I),s(e,R),s(R,C),s(R,P),s(P,ne),ue(ne,t[3].o.u1),s(P,j),s(P,B),ue(B,t[3].o.u2),s(P,H),s(P,V),ue(V,t[3].o.u3),G=!0,K||(Z=[Q(d,"input",t[65]),Q(F,"input",t[66]),Q(ne,"input",t[67]),Q(B,"input",t[68]),Q(V,"input",t[69])],K=!0)},p(z,W){W[0]&8&&d.value!==z[3].o.e&&ue(d,z[3].o.e),W[0]&8&&F.value!==z[3].o.c&&ue(F,z[3].o.c),W[0]&8&&ne.value!==z[3].o.u1&&ue(ne,z[3].o.u1),W[0]&8&&B.value!==z[3].o.u2&&ue(B,z[3].o.u2),W[0]&8&&V.value!==z[3].o.u3&&ue(V,z[3].o.u3)},i(z){G||(L(o.$$.fragment,z),G=!0)},o(z){q(o.$$.fragment,z),G=!1},d(z){z&&y(e),oe(o),K=!1,lt(Z)}}}function Nf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V;return o=new Ht({}),{c(){e=c("div"),n=c("strong"),n.textContent="Home-Assistant",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=E("Discovery topic prefix"),_=c("br"),h=b(),v=c("input"),d=b(),g=c("div"),k=E("Hostname for URL"),$=c("br"),N=b(),A=c("input"),I=b(),R=c("div"),C=E("Name tag"),P=c("br"),ne=b(),j=c("input"),a(n,"class","text-sm"),a(i,"href",Wt("MQTT-configuration#home-assistant")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","h"),m.value="true",a(v,"name","ht"),a(v,"type","text"),a(v,"class","in-s"),a(v,"placeholder","homeassistant"),a(f,"class","my-1"),a(A,"name","hh"),a(A,"type","text"),a(A,"class","in-s"),a(A,"placeholder",F=t[3].g.h+".local"),a(g,"class","my-1"),a(j,"name","hn"),a(j,"type","text"),a(j,"class","in-s"),a(R,"class","my-1"),a(e,"class","cnt")},m(G,K){M(G,e,K),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),s(f,h),s(f,v),ue(v,t[3].h.t),s(e,d),s(e,g),s(g,k),s(g,$),s(g,N),s(g,A),ue(A,t[3].h.h),s(e,I),s(e,R),s(R,C),s(R,P),s(R,ne),s(R,j),ue(j,t[3].h.n),B=!0,H||(V=[Q(v,"input",t[70]),Q(A,"input",t[71]),Q(j,"input",t[72])],H=!0)},p(G,K){K[0]&8&&v.value!==G[3].h.t&&ue(v,G[3].h.t),(!B||K[0]&8&&F!==(F=G[3].g.h+".local"))&&a(A,"placeholder",F),K[0]&8&&A.value!==G[3].h.h&&ue(A,G[3].h.h),K[0]&8&&j.value!==G[3].h.n&&ue(j,G[3].h.n)},i(G){B||(L(o.$$.fragment,G),B=!0)},o(G){q(o.$$.fragment,G),B=!1},d(G){G&&y(e),oe(o),H=!1,lt(V)}}}function Ef(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I;o=new Ht({});let R=t[3].c.es&&Pf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Cloud connections",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div"),p=c("label"),_=c("input"),h=E(" AMSreader cloud"),v=b(),d=c("div"),g=c("label"),k=c("input"),$=E(" Energy Speedometer"),N=b(),R&&R.c(),a(n,"class","text-sm"),a(i,"href",Wt("Cloud")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","c"),m.value="true",a(_,"type","checkbox"),a(_,"name","ce"),_.__value="true",_.value=_.__value,a(_,"class","rounded mb-1"),a(f,"class","my-1"),a(k,"type","checkbox"),a(k,"class","rounded mb-1"),a(k,"name","ces"),k.__value="true",k.value=k.__value,a(d,"class","my-1"),a(e,"class","cnt")},m(C,P){M(C,e,P),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(p,_),_.checked=t[3].c.e,s(p,h),s(e,v),s(e,d),s(d,g),s(g,k),k.checked=t[3].c.es,s(g,$),s(d,N),R&&R.m(d,null),A=!0,F||(I=[Q(_,"change",t[73]),Q(k,"change",t[74])],F=!0)},p(C,P){P[0]&8&&(_.checked=C[3].c.e),P[0]&8&&(k.checked=C[3].c.es),C[3].c.es?R?(R.p(C,P),P[0]&8&&L(R,1)):(R=Pf(C),R.c(),L(R,1),R.m(d,null)):R&&($e(),q(R,1,1,()=>{R=null}),De())},i(C){A||(L(o.$$.fragment,C),L(R),A=!0)},o(C){q(o.$$.fragment,C),q(R),A=!1},d(C){C&&y(e),oe(o),R&&R.d(),F=!1,lt(I)}}}function Pf(t){let e,n,l=t[0].mac+"",i,o,u,m,r=(t[0].meter.id?t[0].meter.id:"missing, required")+"",f,p,_,h,v=t[0].mac&&t[0].meter.id&&Af(t);return{c(){e=c("div"),n=E("MAC: "),i=E(l),o=b(),u=c("div"),m=E("Meter ID: "),f=E(r),p=b(),v&&v.c(),_=it(),a(e,"class","pl-5"),a(u,"class","pl-5")},m(d,g){M(d,e,g),s(e,n),s(e,i),M(d,o,g),M(d,u,g),s(u,m),s(u,f),M(d,p,g),v&&v.m(d,g),M(d,_,g),h=!0},p(d,g){(!h||g[0]&1)&&l!==(l=d[0].mac+"")&&X(i,l),(!h||g[0]&1)&&r!==(r=(d[0].meter.id?d[0].meter.id:"missing, required")+"")&&X(f,r),d[0].mac&&d[0].meter.id?v?(v.p(d,g),g[0]&1&&L(v,1)):(v=Af(d),v.c(),L(v,1),v.m(_.parentNode,_)):v&&($e(),q(v,1,1,()=>{v=null}),De())},i(d){h||(L(v),h=!0)},o(d){q(v),h=!1},d(d){d&&y(e),d&&y(o),d&&y(u),d&&y(p),v&&v.d(d),d&&y(_)}}}function Af(t){let e,n,l;return n=new L_({props:{value:'{"mac":"'+t[0].mac+'","meter":"'+t[0].meter.id+'"}'}}),{c(){e=c("div"),ae(n.$$.fragment),a(e,"class","pl-2")},m(i,o){M(i,e,o),se(n,e,null),l=!0},p(i,o){const u={};o[0]&1&&(u.value='{"mac":"'+i[0].mac+'","meter":"'+i[0].meter.id+'"}'),n.$set(u)},i(i){l||(L(n.$$.fragment,i),l=!0)},o(i){q(n.$$.fragment,i),l=!1},d(i){i&&y(e),oe(n)}}}function $f(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A;o=new Ht({});let F={length:9},I=[];for(let R=0;R<F.length;R+=1)I[R]=Df(df(t,F,R));return{c(){e=c("div"),n=c("strong"),n.textContent="Tariff thresholds",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("input"),r=b(),f=c("div");for(let R=0;R<I.length;R+=1)I[R].c();p=b(),_=c("label"),h=c("span"),h.textContent="Average of",v=b(),d=c("input"),g=b(),k=c("span"),k.textContent="hours",a(n,"class","text-sm"),a(i,"href",Wt("Threshold-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"type","hidden"),a(m,"name","t"),m.value="true",a(f,"class","flex flex-wrap my-1"),a(h,"class","in-pre"),a(d,"name","th"),a(d,"type","number"),a(d,"min","0"),a(d,"max","255"),a(d,"class","in-txt tr w-full"),a(k,"class","in-post"),a(_,"class","flex m-1"),a(e,"class","cnt")},m(R,C){M(R,e,C),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f);for(let P=0;P<I.length;P+=1)I[P]&&I[P].m(f,null);s(e,p),s(e,_),s(_,h),s(_,v),s(_,d),ue(d,t[3].t.h),s(_,g),s(_,k),$=!0,N||(A=Q(d,"input",t[76]),N=!0)},p(R,C){if(C[0]&8){F={length:9};let P;for(P=0;P<F.length;P+=1){const ne=df(R,F,P);I[P]?I[P].p(ne,C):(I[P]=Df(ne),I[P].c(),I[P].m(f,null))}for(;P<I.length;P+=1)I[P].d(1);I.length=F.length}C[0]&8&&Se(d.value)!==R[3].t.h&&ue(d,R[3].t.h)},i(R){$||(L(o.$$.fragment,R),$=!0)},o(R){q(o.$$.fragment,R),$=!1},d(R){R&&y(e),oe(o),mt(I,R),N=!1,A()}}}function Df(t){let e,n,l=t[107]+1+"",i,o,u,m,r,f,p,_;function h(){t[75].call(u,t[107])}return{c(){e=c("label"),n=c("span"),i=E(l),o=b(),u=c("input"),m=b(),r=c("span"),r.textContent="kWh",f=b(),a(n,"class","in-pre"),a(u,"name","t"+t[107]),a(u,"type","number"),a(u,"min","0"),a(u,"max","65535"),a(u,"class","in-txt w-full"),a(r,"class","in-post"),a(e,"class","flex w-40 m-1")},m(v,d){M(v,e,d),s(e,n),s(n,i),s(e,o),s(e,u),ue(u,t[3].t.t[t[107]]),s(e,m),s(e,r),s(e,f),p||(_=Q(u,"input",h),p=!0)},p(v,d){t=v,d[0]&8&&Se(u.value)!==t[3].t.t[t[107]]&&ue(u,t[3].t.t[t[107]])},d(v){v&&y(e),p=!1,_()}}}function Lf(t){let e,n=t[102].name+"",l,i,o,u,m,r,f,p,_,h;function v(){t[77].call(u,t[102])}return{c(){e=c("div"),l=E(n),i=c("br"),o=b(),u=c("select"),m=c("option"),m.textContent="Disable",r=c("option"),r.textContent="Enable",f=c("option"),f.textContent="Auto",p=b(),m.__value=0,m.value=m.__value,r.__value=1,r.value=r.__value,f.__value=2,f.value=f.__value,a(u,"name","u"+t[102].key),a(u,"class","in-s"),t[3].u[t[102].key]===void 0&&Ze(v),a(e,"class","w-1/2")},m(d,g){M(d,e,g),s(e,l),s(e,i),s(e,o),s(e,u),s(u,m),s(u,r),s(u,f),Te(u,t[3].u[t[102].key],!0),s(e,p),_||(h=Q(u,"change",v),_=!0)},p(d,g){t=d,g[0]&136&&Te(u,t[3].u[t[102].key])},d(d){d&&y(e),_=!1,h()}}}function If(t){let e,n,l,i,o,u,m,r,f;o=new Ht({});let p=t[0].board>20&&Rf(t),_=t[3].i.d.d>0&&qf(t),h=t[0].chip=="esp8266"&&Bf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Hardware",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),p&&p.c(),m=b(),_&&_.c(),r=b(),h&&h.c(),a(n,"class","text-sm"),a(i,"href",Wt("GPIO-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(e,"class","cnt")},m(v,d){M(v,e,d),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),p&&p.m(e,null),s(e,m),_&&_.m(e,null),s(e,r),h&&h.m(e,null),f=!0},p(v,d){v[0].board>20?p?(p.p(v,d),d[0]&1&&L(p,1)):(p=Rf(v),p.c(),L(p,1),p.m(e,m)):p&&($e(),q(p,1,1,()=>{p=null}),De()),v[3].i.d.d>0?_?_.p(v,d):(_=qf(v),_.c(),_.m(e,r)):_&&(_.d(1),_=null),v[0].chip=="esp8266"?h?h.p(v,d):(h=Bf(v),h.c(),h.m(e,null)):h&&(h.d(1),h=null)},i(v){f||(L(o.$$.fragment,v),L(p),f=!0)},o(v){q(o.$$.fragment,v),q(p),f=!1},d(v){v&&y(e),oe(o),p&&p.d(),_&&_.d(),h&&h.d()}}}function Rf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at;f=new mo({props:{chip:t[0].chip}}),k=new mo({props:{chip:t[0].chip}});let qe=t[0].chip!="esp8266"&&Ff(t),ye=t[3].i.v.p>0&&Of(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("HAN RX"),u=c("br"),m=b(),r=c("select"),ae(f.$$.fragment),p=b(),_=c("div"),h=E("HAN TX"),v=c("br"),d=b(),g=c("select"),ae(k.$$.fragment),$=b(),N=c("div"),A=c("label"),F=c("input"),I=E(" pullup"),R=b(),C=c("div"),P=c("div"),ne=E("AP button"),j=c("br"),B=b(),H=c("input"),V=b(),G=c("div"),K=E("LED"),Z=c("br"),z=b(),W=c("div"),x=c("input"),_e=b(),ie=c("div"),me=c("label"),Y=c("input"),ke=E(" inverted"),Ee=b(),we=c("div"),Me=E("RGB"),te=c("label"),fe=c("input"),Oe=E(" inverted"),Ie=c("br"),T=b(),w=c("div"),S=c("input"),D=b(),O=c("input"),J=b(),le=c("input"),pe=b(),ge=c("div"),Ae=c("div"),Fe=E(`LED dis. GPIO
|
|
`),ce=c("input"),Pe=b(),ze=c("div"),_t=E("Temperature"),Ke=c("br"),ut=b(),Ge=c("input"),pt=b(),Ue=c("div"),At=E("Analog temp"),dt=c("br"),vt=b(),xe=c("input"),Re=b(),qe&&qe.c(),et=b(),ye&&ye.c(),a(e,"type","hidden"),a(e,"name","i"),e.value="true",a(r,"name","ihp"),a(r,"class","in-f w-full"),t[3].i.h.p===void 0&&Ze(()=>t[78].call(r)),a(i,"class","w-1/3"),a(g,"name","iht"),a(g,"class","in-l w-full"),t[3].i.h.t===void 0&&Ze(()=>t[79].call(g)),a(_,"class","w-1/3"),a(F,"name","ihu"),F.__value="true",F.value=F.__value,a(F,"type","checkbox"),a(F,"class","rounded mb-1"),a(A,"class","ml-2"),a(N,"class","w-1/3"),a(l,"class","flex flex-wrap"),a(H,"name","ia"),a(H,"type","number"),a(H,"min","0"),a(H,"max",t[6]),a(H,"class","in-f tr w-full"),a(P,"class","w-1/3"),a(x,"name","ilp"),a(x,"type","number"),a(x,"min","0"),a(x,"max",t[6]),a(x,"class","in-l tr w-full"),a(W,"class","flex"),a(G,"class","w-1/3"),a(Y,"name","ili"),Y.__value="true",Y.value=Y.__value,a(Y,"type","checkbox"),a(Y,"class","rounded mb-1"),a(me,"class","ml-4"),a(ie,"class","w-1/3"),a(fe,"name","iri"),fe.__value="true",fe.value=fe.__value,a(fe,"type","checkbox"),a(fe,"class","rounded mb-1"),a(te,"class","ml-4"),a(S,"name","irr"),a(S,"type","number"),a(S,"min","0"),a(S,"max",t[6]),a(S,"class","in-f tr w-1/3"),a(O,"name","irg"),a(O,"type","number"),a(O,"min","0"),a(O,"max",t[6]),a(O,"class","in-m tr w-1/3"),a(le,"name","irb"),a(le,"type","number"),a(le,"min","0"),a(le,"max",t[6]),a(le,"class","in-l tr w-1/3"),a(w,"class","flex"),a(we,"class","w-full"),a(ce,"name","idd"),a(ce,"type","number"),a(ce,"min","0"),a(ce,"max",t[6]),a(ce,"class","in-s tr"),a(Ae,"class","my-1 pr-1 w-1/3"),a(ge,"class","w-full"),a(Ge,"name","itd"),a(Ge,"type","number"),a(Ge,"min","0"),a(Ge,"max",t[6]),a(Ge,"class","in-f tr w-full"),a(ze,"class","my-1 w-1/3"),a(xe,"name","ita"),a(xe,"type","number"),a(xe,"min","0"),a(xe,"max",t[6]),a(xe,"class","in-l tr w-full"),a(Ue,"class","my-1 pr-1 w-1/3"),a(C,"class","flex flex-wrap")},m(ve,de){M(ve,e,de),M(ve,n,de),M(ve,l,de),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),se(f,r,null),Te(r,t[3].i.h.p,!0),s(l,p),s(l,_),s(_,h),s(_,v),s(_,d),s(_,g),se(k,g,null),Te(g,t[3].i.h.t,!0),s(l,$),s(l,N),s(N,A),s(A,F),F.checked=t[3].i.h.u,s(A,I),M(ve,R,de),M(ve,C,de),s(C,P),s(P,ne),s(P,j),s(P,B),s(P,H),ue(H,t[3].i.a),s(C,V),s(C,G),s(G,K),s(G,Z),s(G,z),s(G,W),s(W,x),ue(x,t[3].i.l.p),s(C,_e),s(C,ie),s(ie,me),s(me,Y),Y.checked=t[3].i.l.i,s(me,ke),s(C,Ee),s(C,we),s(we,Me),s(we,te),s(te,fe),fe.checked=t[3].i.r.i,s(te,Oe),s(we,Ie),s(we,T),s(we,w),s(w,S),ue(S,t[3].i.r.r),s(w,D),s(w,O),ue(O,t[3].i.r.g),s(w,J),s(w,le),ue(le,t[3].i.r.b),s(C,pe),s(C,ge),s(ge,Ae),s(Ae,Fe),s(Ae,ce),ue(ce,t[3].i.d.d),s(C,Pe),s(C,ze),s(ze,_t),s(ze,Ke),s(ze,ut),s(ze,Ge),ue(Ge,t[3].i.t.d),s(C,pt),s(C,Ue),s(Ue,At),s(Ue,dt),s(Ue,vt),s(Ue,xe),ue(xe,t[3].i.t.a),s(C,Re),qe&&qe.m(C,null),s(C,et),ye&&ye.m(C,null),Le=!0,Je||(at=[Q(r,"change",t[78]),Q(g,"change",t[79]),Q(F,"change",t[80]),Q(H,"input",t[81]),Q(x,"input",t[82]),Q(Y,"change",t[83]),Q(fe,"change",t[84]),Q(S,"input",t[85]),Q(O,"input",t[86]),Q(le,"input",t[87]),Q(ce,"input",t[88]),Q(Ge,"input",t[89]),Q(xe,"input",t[90])],Je=!0)},p(ve,de){const Ve={};de[0]&1&&(Ve.chip=ve[0].chip),f.$set(Ve),de[0]&8&&Te(r,ve[3].i.h.p);const re={};de[0]&1&&(re.chip=ve[0].chip),k.$set(re),de[0]&8&&Te(g,ve[3].i.h.t),de[0]&8&&(F.checked=ve[3].i.h.u),(!Le||de[0]&64)&&a(H,"max",ve[6]),de[0]&8&&Se(H.value)!==ve[3].i.a&&ue(H,ve[3].i.a),(!Le||de[0]&64)&&a(x,"max",ve[6]),de[0]&8&&Se(x.value)!==ve[3].i.l.p&&ue(x,ve[3].i.l.p),de[0]&8&&(Y.checked=ve[3].i.l.i),de[0]&8&&(fe.checked=ve[3].i.r.i),(!Le||de[0]&64)&&a(S,"max",ve[6]),de[0]&8&&Se(S.value)!==ve[3].i.r.r&&ue(S,ve[3].i.r.r),(!Le||de[0]&64)&&a(O,"max",ve[6]),de[0]&8&&Se(O.value)!==ve[3].i.r.g&&ue(O,ve[3].i.r.g),(!Le||de[0]&64)&&a(le,"max",ve[6]),de[0]&8&&Se(le.value)!==ve[3].i.r.b&&ue(le,ve[3].i.r.b),(!Le||de[0]&64)&&a(ce,"max",ve[6]),de[0]&8&&Se(ce.value)!==ve[3].i.d.d&&ue(ce,ve[3].i.d.d),(!Le||de[0]&64)&&a(Ge,"max",ve[6]),de[0]&8&&Se(Ge.value)!==ve[3].i.t.d&&ue(Ge,ve[3].i.t.d),(!Le||de[0]&64)&&a(xe,"max",ve[6]),de[0]&8&&Se(xe.value)!==ve[3].i.t.a&&ue(xe,ve[3].i.t.a),ve[0].chip!="esp8266"?qe?qe.p(ve,de):(qe=Ff(ve),qe.c(),qe.m(C,et)):qe&&(qe.d(1),qe=null),ve[3].i.v.p>0?ye?ye.p(ve,de):(ye=Of(ve),ye.c(),ye.m(C,null)):ye&&(ye.d(1),ye=null)},i(ve){Le||(L(f.$$.fragment,ve),L(k.$$.fragment,ve),Le=!0)},o(ve){q(f.$$.fragment,ve),q(k.$$.fragment,ve),Le=!1},d(ve){ve&&y(e),ve&&y(n),ve&&y(l),oe(f),oe(k),ve&&y(R),ve&&y(C),qe&&qe.d(),ye&&ye.d(),Je=!1,lt(at)}}}function Ff(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Vcc"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivp"),a(o,"type","number"),a(o,"min","0"),a(o,"max",t[6]),a(o,"class","in-s tr w-full"),a(e,"class","my-1 pl-1 w-1/3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.p),u||(m=Q(o,"input",t[91]),u=!0)},p(r,f){f[0]&64&&a(o,"max",r[6]),f[0]&8&&Se(o.value)!==r[3].i.v.p&&ue(o,r[3].i.v.p)},d(r){r&&y(e),u=!1,m()}}}function Of(t){let e,n,l,i,o,u,m,r,f,p;return{c(){e=c("div"),n=E("Voltage divider"),l=c("br"),i=b(),o=c("div"),u=c("input"),m=b(),r=c("input"),a(u,"name","ivdv"),a(u,"type","number"),a(u,"min","0"),a(u,"max","65535"),a(u,"class","in-f tr w-full"),a(u,"placeholder","VCC"),a(r,"name","ivdg"),a(r,"type","number"),a(r,"min","0"),a(r,"max","65535"),a(r,"class","in-l tr w-full"),a(r,"placeholder","GND"),a(o,"class","flex"),a(e,"class","my-1")},m(_,h){M(_,e,h),s(e,n),s(e,l),s(e,i),s(e,o),s(o,u),ue(u,t[3].i.v.d.v),s(o,m),s(o,r),ue(r,t[3].i.v.d.g),f||(p=[Q(u,"input",t[92]),Q(r,"input",t[93])],f=!0)},p(_,h){h[0]&8&&Se(u.value)!==_[3].i.v.d.v&&ue(u,_[3].i.v.d.v),h[0]&8&&Se(r.value)!==_[3].i.v.d.g&&ue(r,_[3].i.v.d.g)},d(_){_&&y(e),f=!1,lt(p)}}}function qf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E(`LED behaviour
|
|
`),l=c("select"),i=c("option"),i.textContent="Enabled",o=c("option"),o.textContent="Disabled",i.__value=0,i.value=i.__value,o.__value=1,o.value=o.__value,a(l,"name","idb"),a(l,"class","in-s"),t[3].i.d.b===void 0&&Ze(()=>t[94].call(l)),a(e,"class","my-1 w-full")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(l,i),s(l,o),Te(l,t[3].i.d.b,!0),u||(m=Q(l,"change",t[94]),u=!0)},p(r,f){f[0]&8&&Te(l,r[3].i.d.b)},d(r){r&&y(e),u=!1,m()}}}function Bf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N=(t[0].board==2||t[0].board==100)&&Uf(t);return{c(){e=c("input"),n=b(),l=c("div"),i=c("div"),o=E("Vcc offset"),u=c("br"),m=b(),r=c("input"),f=b(),p=c("div"),_=E("Multiplier"),h=c("br"),v=b(),d=c("input"),g=b(),N&&N.c(),a(e,"type","hidden"),a(e,"name","iv"),e.value="true",a(r,"name","ivo"),a(r,"type","number"),a(r,"min","0.0"),a(r,"max","3.5"),a(r,"step","0.01"),a(r,"class","in-f tr w-full"),a(i,"class","w-1/3"),a(d,"name","ivm"),a(d,"type","number"),a(d,"min","0.1"),a(d,"max","10"),a(d,"step","0.01"),a(d,"class","in-l tr w-full"),a(p,"class","w-1/3 pr-1"),a(l,"class","my-1 flex flex-wrap")},m(A,F){M(A,e,F),M(A,n,F),M(A,l,F),s(l,i),s(i,o),s(i,u),s(i,m),s(i,r),ue(r,t[3].i.v.o),s(l,f),s(l,p),s(p,_),s(p,h),s(p,v),s(p,d),ue(d,t[3].i.v.m),s(l,g),N&&N.m(l,null),k||($=[Q(r,"input",t[95]),Q(d,"input",t[96])],k=!0)},p(A,F){F[0]&8&&Se(r.value)!==A[3].i.v.o&&ue(r,A[3].i.v.o),F[0]&8&&Se(d.value)!==A[3].i.v.m&&ue(d,A[3].i.v.m),A[0].board==2||A[0].board==100?N?N.p(A,F):(N=Uf(A),N.c(),N.m(l,null)):N&&(N.d(1),N=null)},d(A){A&&y(e),A&&y(n),A&&y(l),N&&N.d(),k=!1,lt($)}}}function Uf(t){let e,n,l,i,o,u,m;return{c(){e=c("div"),n=E("Boot limit"),l=c("br"),i=b(),o=c("input"),a(o,"name","ivb"),a(o,"type","number"),a(o,"min","2.5"),a(o,"max","3.5"),a(o,"step","0.1"),a(o,"class","in-s tr w-full"),a(e,"class","w-1/3 pl-1")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),ue(o,t[3].i.v.b),u||(m=Q(o,"input",t[97]),u=!0)},p(r,f){f[0]&8&&Se(o.value)!==r[3].i.v.b&&ue(o,r[3].i.v.b)},d(r){r&&y(e),u=!1,m()}}}function jf(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$=t[3].d.t&&Hf();return{c(){e=c("div"),e.textContent="Debug can cause sudden reboots. Do not leave on!",n=b(),l=c("div"),i=c("label"),o=c("input"),u=E(" Enable telnet"),m=b(),$&&$.c(),r=b(),f=c("div"),p=c("select"),_=c("option"),_.textContent="Verbose",h=c("option"),h.textContent="Debug",v=c("option"),v.textContent="Info",d=c("option"),d.textContent="Warning",a(e,"class","bd-red"),a(o,"type","checkbox"),a(o,"name","dt"),o.__value="true",o.value=o.__value,a(o,"class","rounded mb-1"),a(l,"class","my-1"),_.__value=1,_.value=_.__value,h.__value=2,h.value=h.__value,v.__value=3,v.value=v.__value,d.__value=4,d.value=d.__value,a(p,"name","dl"),a(p,"class","in-s"),t[3].d.l===void 0&&Ze(()=>t[100].call(p)),a(f,"class","my-1")},m(N,A){M(N,e,A),M(N,n,A),M(N,l,A),s(l,i),s(i,o),o.checked=t[3].d.t,s(i,u),M(N,m,A),$&&$.m(N,A),M(N,r,A),M(N,f,A),s(f,p),s(p,_),s(p,h),s(p,v),s(p,d),Te(p,t[3].d.l,!0),g||(k=[Q(o,"change",t[99]),Q(p,"change",t[100])],g=!0)},p(N,A){A[0]&8&&(o.checked=N[3].d.t),N[3].d.t?$||($=Hf(),$.c(),$.m(r.parentNode,r)):$&&($.d(1),$=null),A[0]&8&&Te(p,N[3].d.l)},d(N){N&&y(e),N&&y(n),N&&y(l),N&&y(m),$&&$.d(N),N&&y(r),N&&y(f),g=!1,lt(k)}}}function Hf(t){let e;return{c(){e=c("div"),e.textContent="Telnet is unsafe and should be off when not in use",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Z_(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,Li,ri,yl,Ii,Ri,Fi,$t,Oi,Xe,dn,qi,Ll,Il,Bi,zl,Ui,Gl,ji,Ml,nt,rt,Vl,tl,ml,ft,Hi,Xt,Wi,Lo,Ps,Io,ui,ll,Ro,Fo,Rl,_l,Fl,Oo,zi,qo,Nt,Ol,Bo,Gi,hn,vn,bn,gn,Vi,Uo,zt,Ki,jo,Kl,Ho,Wo,zo,pl,kn,wn,Go,Cn,Yl,Vo,Ko,Yo,yn,nl,Qo,Yi,Xo,Ql,Zo,Jo,xo,Mn,il,ea,Qi,ta,As,la,Xl,Xi,sl,na,ia,sa,$s,Zi,ol,oa,aa,ra,Gt,Ji,ua,Sn,Tn,fa,fi,ca,Zl,ma,_a,pa,Zt,Nn,En,da,ha,Mt,xi,va,Pn,An,ba,Jl,ga,ka,wa,ql,dl,$n,Dn,Ca,Vt,es,ts,ya,Kt,Ln,ls,ns,Ma,Ds,is,ss,al,Sa,Ta,ci,Na,Bl,Ea,mi,rl,Pa,Aa,$a,os,Sl,Da,ct,as,La,In,Rn,Ia,_i,Ra,hl,Fa,Ls,Oa,qa,Fn,Tl,Ba,ul,Ua,Is,xl,ja,Ha,Wa,Nl,za,en,Ga,Va,Ka,El,Ya,On,qn,Qa,Xa,Za,Pl,Ja,Bn,xa,er,tr,Dt,Un,jn,Hn,Wn,zn,Gn,lr,tn,nr,ir,sr,Al,or,Rs,Fs,Os,qs=t[3].p.r.startsWith("10YNO")||t[3].p.r.startsWith("10Y1001A1001A4"),Bs,vl,rs,ar,Vn,Kn,rr,pi,ur,di,fr,Us,Yt,us,cr,Yn,Qn,mr,hi,_r,fs,cs,fl,pr,dr,hr,Ul,js,Xn,vr,ms,Zn,br,_s,Hs,ln,Ws,nn,zs,sn,Gs,on,Jt,Vs,gr;m=new Ht({}),P=new T_({});let T0=["NOK","SEK","DKK","EUR","CHF"],vi=[];for(let U=0;U<5;U+=1)vi[U]=F_(R_(t,T0,U));vt=new el({props:{to:"/priceconfig",class:"text-blue-600 hover:text-blue-800",$$slots:{default:[O_]},$$scope:{ctx:t}}});let Lt=t[3].p.e&&t[0].chip!="esp8266"&&hf(t),It=t[3].g.s>0&&vf(t);Il=new Ht({});let N0=[24,48,96,192,384,576,1152],bi=[];for(let U=0;U<7;U+=1)bi[U]=q_(I_(t,N0,U));let Rt=t[3].m.e.e&&bf(t),Ft=t[3].m.e.e&&gf(t),Ot=t[3].m.m.e&&kf(t);Tn=new Ht({});let Qt=t[0].if&&t[0].if.eth&&wf(),qt=(t[3].n.c==1||t[3].n.c==2)&&Cf(t);An=new Ht({}),Ln=new M0({});let Bt=t[3].n.m=="static"&&yf(t);Rn=new Ht({});let Ut=t[0].chip!="esp8266"&&Mf(t),bt=t[3].q.s.e&&Sf(t),gt=t[3].q.m==3&&Tf(t),kt=t[3].q.m==4&&Nf(t),wt=t[3].c.es!=null&&Ef(t),Ct=qs&&$f(t);Kn=new Ht({});let Jn=t[7],Et=[];for(let U=0;U<Jn.length;U+=1)Et[U]=Lf(pf(t,Jn,U));let yt=(t[0].board>20||t[0].chip=="esp8266"||t[3].i.d.d>0)&&If(t);Qn=new Ht({});let jt=t[3].d.s&&jf(t);return ln=new Pt({props:{active:t[1],message:"Loading configuration"}}),nn=new Pt({props:{active:t[2],message:"Saving configuration"}}),sn=new Pt({props:{active:t[4],message:"Performing factory reset"}}),on=new Pt({props:{active:t[5],message:"Device have been factory reset and switched to AP mode"}}),{c(){e=c("form"),n=c("div"),l=c("div"),i=c("strong"),i.textContent="General",o=b(),u=c("a"),ae(m.$$.fragment),r=b(),f=c("input"),p=b(),_=c("div"),h=c("div"),v=c("div"),d=E("Hostname"),g=c("br"),k=b(),$=c("input"),N=b(),A=c("div"),F=E("Time zone"),I=c("br"),R=b(),C=c("select"),ae(P.$$.fragment),ne=b(),j=c("input"),B=b(),H=c("div"),V=c("div"),G=c("div"),K=E("Price region"),Z=c("br"),z=b(),W=c("select"),x=c("optgroup"),_e=c("option"),_e.textContent="NO1",ie=c("option"),ie.textContent="NO2",me=c("option"),me.textContent="NO3",Y=c("option"),Y.textContent="NO4",ke=c("option"),ke.textContent="NO5",Ee=c("optgroup"),we=c("option"),we.textContent="SE1",Me=c("option"),Me.textContent="SE2",te=c("option"),te.textContent="SE3",fe=c("option"),fe.textContent="SE4",Oe=c("optgroup"),Ie=c("option"),Ie.textContent="DK1",T=c("option"),T.textContent="DK2",w=c("option"),w.textContent="Austria",S=c("option"),S.textContent="Belgium",D=c("option"),D.textContent="Czech Republic",O=c("option"),O.textContent="Estonia",J=c("option"),J.textContent="Finland",le=c("option"),le.textContent="France",pe=c("option"),pe.textContent="Germany",ge=c("option"),ge.textContent="Great Britain",Ae=c("option"),Ae.textContent="Latvia",Fe=c("option"),Fe.textContent="Lithuania",ce=c("option"),ce.textContent="Netherland",Pe=c("option"),Pe.textContent="Poland",ze=c("option"),ze.textContent="Switzerland",_t=b(),Ke=c("div"),ut=E("Currency"),Ge=c("br"),pt=b(),Ue=c("select");for(let U=0;U<5;U+=1)vi[U].c();At=b(),dt=c("div"),ae(vt.$$.fragment),xe=b(),Re=c("div"),et=c("label"),Le=c("input"),Je=E(" Enable price fetch from remote server"),at=b(),Lt&&Lt.c(),qe=b(),ye=c("div"),ve=E("Security"),de=c("br"),Ve=b(),re=c("select"),Qe=c("option"),Qe.textContent="None",ee=c("option"),ee.textContent="Only configuration",st=c("option"),st.textContent="Everything",Li=b(),It&&It.c(),ri=b(),yl=c("div"),Ii=E("Context"),Ri=c("br"),Fi=b(),$t=c("input"),Oi=b(),Xe=c("div"),dn=c("strong"),dn.textContent="Meter",qi=b(),Ll=c("a"),ae(Il.$$.fragment),Bi=b(),zl=c("input"),Ui=b(),Gl=c("input"),ji=b(),Ml=c("div"),nt=E("Communication"),rt=c("br"),Vl=b(),tl=c("select"),ml=c("option"),ml.textContent="Passive (Push)",ft=c("option"),ft.textContent="Kamstrup (Pull)",Hi=b(),Xt=c("div"),Wi=c("span"),Wi.textContent="Buffer size",Lo=b(),Ps=c("span"),Ps.textContent="Serial conf.",Io=b(),ui=c("label"),ll=c("input"),Ro=E(" inverted"),Fo=b(),Rl=c("div"),_l=c("select"),Fl=c("option"),Oo=E("Autodetect");for(let U=0;U<7;U+=1)bi[U].c();qo=b(),Nt=c("select"),Ol=c("option"),Bo=E("-"),hn=c("option"),hn.textContent="7N1",vn=c("option"),vn.textContent="8N1",bn=c("option"),bn.textContent="7E1",gn=c("option"),gn.textContent="8E1",Uo=b(),zt=c("input"),jo=b(),Kl=c("div"),Ho=E("Voltage"),Wo=c("br"),zo=b(),pl=c("select"),kn=c("option"),kn.textContent="400V (TN)",wn=c("option"),wn.textContent="230V (IT/TT)",Go=b(),Cn=c("div"),Yl=c("div"),Vo=E("Main fuse"),Ko=c("br"),Yo=b(),yn=c("label"),nl=c("input"),Qo=b(),Yi=c("span"),Yi.textContent="A",Xo=b(),Ql=c("div"),Zo=E("Production"),Jo=c("br"),xo=b(),Mn=c("label"),il=c("input"),ea=b(),Qi=c("span"),Qi.textContent="kWp",ta=b(),As=c("div"),la=b(),Xl=c("div"),Xi=c("label"),sl=c("input"),na=E(" Meter is encrypted"),ia=b(),Rt&&Rt.c(),sa=b(),Ft&&Ft.c(),$s=b(),Zi=c("label"),ol=c("input"),oa=E(" Multipliers"),aa=b(),Ot&&Ot.c(),ra=b(),Gt=c("div"),Ji=c("strong"),Ji.textContent="Connection",ua=b(),Sn=c("a"),ae(Tn.$$.fragment),fa=b(),fi=c("input"),ca=b(),Zl=c("div"),ma=E("Connection"),_a=c("br"),pa=b(),Zt=c("select"),Nn=c("option"),Nn.textContent="WiFi",En=c("option"),En.textContent="Access point",Qt&&Qt.c(),da=b(),qt&&qt.c(),ha=b(),Mt=c("div"),xi=c("strong"),xi.textContent="Network",va=b(),Pn=c("a"),ae(An.$$.fragment),ba=b(),Jl=c("div"),ga=E("IP"),ka=c("br"),wa=b(),ql=c("div"),dl=c("select"),$n=c("option"),$n.textContent="DHCP",Dn=c("option"),Dn.textContent="Static",Ca=b(),Vt=c("input"),ya=b(),Kt=c("select"),ae(Ln.$$.fragment),Ma=b(),Bt&&Bt.c(),Ds=b(),is=c("div"),ss=c("label"),al=c("input"),Sa=E(" enable mDNS"),Ta=b(),ci=c("input"),Na=b(),Bl=c("div"),Ea=E("NTP "),mi=c("label"),rl=c("input"),Pa=E(" obtain from DHCP"),Aa=c("br"),$a=b(),os=c("div"),Sl=c("input"),Da=b(),ct=c("div"),as=c("strong"),as.textContent="MQTT",La=b(),In=c("a"),ae(Rn.$$.fragment),Ia=b(),_i=c("input"),Ra=b(),hl=c("div"),Fa=E(`Server
|
|
`),Ut&&Ut.c(),Ls=b(),Oa=c("br"),qa=b(),Fn=c("div"),Tl=c("input"),Ba=b(),ul=c("input"),Ua=b(),bt&&bt.c(),Is=b(),xl=c("div"),ja=E("Username"),Ha=c("br"),Wa=b(),Nl=c("input"),za=b(),en=c("div"),Ga=E("Password"),Va=c("br"),Ka=b(),El=c("input"),Ya=b(),On=c("div"),qn=c("div"),Qa=E("Client ID"),Xa=c("br"),Za=b(),Pl=c("input"),Ja=b(),Bn=c("div"),xa=E("Payload"),er=c("br"),tr=b(),Dt=c("select"),Un=c("option"),Un.textContent="JSON",jn=c("option"),jn.textContent="Raw (minimal)",Hn=c("option"),Hn.textContent="Raw (full)",Wn=c("option"),Wn.textContent="Domoticz",zn=c("option"),zn.textContent="HomeAssistant",Gn=c("option"),Gn.textContent="HEX dump",lr=b(),tn=c("div"),nr=E("Publish topic"),ir=c("br"),sr=b(),Al=c("input"),or=b(),gt&>.c(),Rs=b(),kt&&kt.c(),Fs=b(),wt&&wt.c(),Os=b(),Ct&&Ct.c(),Bs=b(),vl=c("div"),rs=c("strong"),rs.textContent="User interface",ar=b(),Vn=c("a"),ae(Kn.$$.fragment),rr=b(),pi=c("input"),ur=b(),di=c("div");for(let U=0;U<Et.length;U+=1)Et[U].c();fr=b(),yt&&yt.c(),Us=b(),Yt=c("div"),us=c("strong"),us.textContent="Debugging",cr=b(),Yn=c("a"),ae(Qn.$$.fragment),mr=b(),hi=c("input"),_r=b(),fs=c("div"),cs=c("label"),fl=c("input"),pr=E(" Enable debugging"),dr=b(),jt&&jt.c(),hr=b(),Ul=c("div"),js=c("div"),Xn=c("button"),Xn.textContent="Factory reset",vr=b(),ms=c("div"),Zn=c("button"),Zn.textContent="Reboot",br=b(),_s=c("div"),_s.innerHTML='<button type="submit" class="btn-pri">Save</button>',Hs=b(),ae(ln.$$.fragment),Ws=b(),ae(nn.$$.fragment),zs=b(),ae(sn.$$.fragment),Gs=b(),ae(on.$$.fragment),a(i,"class","text-sm"),a(u,"href",Wt("General-configuration")),a(u,"target","_blank"),a(u,"class","float-right"),a(f,"type","hidden"),a(f,"name","g"),f.value="true",a($,"name","gh"),a($,"type","text"),a($,"class","in-f w-full"),a($,"pattern","[A-Za-z0-9-]+"),a(C,"name","gt"),a(C,"class","in-l w-full"),t[3].g.t===void 0&&Ze(()=>t[17].call(C)),a(h,"class","flex"),a(_,"class","my-1"),a(j,"type","hidden"),a(j,"name","p"),j.value="true",_e.__value="10YNO-1--------2",_e.value=_e.__value,ie.__value="10YNO-2--------T",ie.value=ie.__value,me.__value="10YNO-3--------J",me.value=me.__value,Y.__value="10YNO-4--------9",Y.value=Y.__value,ke.__value="10Y1001A1001A48H",ke.value=ke.__value,a(x,"label","Norway"),we.__value="10Y1001A1001A44P",we.value=we.__value,Me.__value="10Y1001A1001A45N",Me.value=Me.__value,te.__value="10Y1001A1001A46L",te.value=te.__value,fe.__value="10Y1001A1001A47J",fe.value=fe.__value,a(Ee,"label","Sweden"),Ie.__value="10YDK-1--------W",Ie.value=Ie.__value,T.__value="10YDK-2--------M",T.value=T.__value,a(Oe,"label","Denmark"),w.__value="10YAT-APG------L",w.value=w.__value,S.__value="10YBE----------2",S.value=S.__value,D.__value="10YCZ-CEPS-----N",D.value=D.__value,O.__value="10Y1001A1001A39I",O.value=O.__value,J.__value="10YFI-1--------U",J.value=J.__value,le.__value="10YFR-RTE------C",le.value=le.__value,pe.__value="10Y1001A1001A83F",pe.value=pe.__value,ge.__value="10YGB----------A",ge.value=ge.__value,Ae.__value="10YLV-1001A00074",Ae.value=Ae.__value,Fe.__value="10YLT-1001A0008Q",Fe.value=Fe.__value,ce.__value="10YNL----------L",ce.value=ce.__value,Pe.__value="10YPL-AREA-----S",Pe.value=Pe.__value,ze.__value="10YCH-SWISSGRIDZ",ze.value=ze.__value,a(W,"name","pr"),a(W,"class","in-f w-full"),t[3].p.r===void 0&&Ze(()=>t[18].call(W)),a(G,"class","w-full"),a(Ue,"name","pc"),a(Ue,"class","in-l"),t[3].p.c===void 0&&Ze(()=>t[19].call(Ue)),a(V,"class","flex"),a(H,"class","my-1"),a(dt,"class","my-1"),a(Le,"type","checkbox"),a(Le,"name","pe"),Le.__value="true",Le.value=Le.__value,a(Le,"class","rounded mb-1"),a(Re,"class","my-1"),Qe.__value=0,Qe.value=Qe.__value,ee.__value=1,ee.value=ee.__value,st.__value=2,st.value=st.__value,a(re,"name","gs"),a(re,"class","in-s"),t[3].g.s===void 0&&Ze(()=>t[22].call(re)),a(ye,"class","my-1"),a($t,"name","gc"),a($t,"type","text"),a($t,"pattern","[A-Za-z0-9]+"),a($t,"placeholder","[root]"),a($t,"class","in-s"),a($t,"maxlength","36"),a(yl,"class","my-1"),a(l,"class","cnt"),a(dn,"class","text-sm"),a(Ll,"href",Wt("Meter-configuration")),a(Ll,"target","_blank"),a(Ll,"class","float-right"),a(zl,"type","hidden"),a(zl,"name","m"),zl.value="true",a(Gl,"type","hidden"),a(Gl,"name","mo"),Gl.value="1",ml.__value=0,ml.value=ml.__value,ft.__value=9,ft.value=ft.__value,a(tl,"name","ma"),a(tl,"class","in-s"),t[3].m.a===void 0&&Ze(()=>t[26].call(tl)),a(Ml,"class","my-1"),a(Wi,"class","float-right"),a(ll,"name","mi"),ll.__value="true",ll.value=ll.__value,a(ll,"type","checkbox"),a(ll,"class","rounded mb-1"),a(ui,"class","mt-2 ml-3 whitespace-nowrap"),Fl.__value=0,Fl.value=Fl.__value,Fl.disabled=zi=t[3].m.b!=0,a(_l,"name","mb"),a(_l,"class","in-f tr w-1/2"),t[3].m.b===void 0&&Ze(()=>t[28].call(_l)),Ol.__value=0,Ol.value=Ol.__value,Ol.disabled=Gi=t[3].m.b!=0,hn.__value=2,hn.value=hn.__value,vn.__value=3,vn.value=vn.__value,bn.__value=10,bn.value=bn.__value,gn.__value=11,gn.value=gn.__value,a(Nt,"name","mp"),a(Nt,"class","in-m"),Nt.disabled=Vi=t[3].m.b==0,t[3].m.p===void 0&&Ze(()=>t[29].call(Nt)),a(zt,"name","ms"),a(zt,"type","number"),a(zt,"min",64),a(zt,"max",Ki=t[0].chip=="esp8266"?t[3].i.h.p==3||t[3].i.h.p==113?512:128:4096),a(zt,"step",64),a(zt,"class","in-l tr w-1/2"),a(Rl,"class","flex w-full"),a(Xt,"class","my-1"),kn.__value=2,kn.value=kn.__value,wn.__value=1,wn.value=wn.__value,a(pl,"name","md"),a(pl,"class","in-s"),t[3].m.d===void 0&&Ze(()=>t[31].call(pl)),a(Kl,"class","my-1"),a(nl,"name","mf"),a(nl,"type","number"),a(nl,"min","5"),a(nl,"max","65535"),a(nl,"class","in-f tr w-full"),a(Yi,"class","in-post"),a(yn,"class","flex"),a(Yl,"class","mx-1"),a(il,"name","mr"),a(il,"type","number"),a(il,"min","0"),a(il,"max","65535"),a(il,"class","in-f tr w-full"),a(Qi,"class","in-post"),a(Mn,"class","flex"),a(Ql,"class","mx-1"),a(Cn,"class","my-1 flex"),a(As,"class","my-1"),a(sl,"type","checkbox"),a(sl,"name","me"),sl.__value="true",sl.value=sl.__value,a(sl,"class","rounded mb-1"),a(Xl,"class","my-1"),a(ol,"type","checkbox"),a(ol,"name","mm"),ol.__value="true",ol.value=ol.__value,a(ol,"class","rounded mb-1"),a(Xe,"class","cnt"),a(Ji,"class","text-sm"),a(Sn,"href",Wt("WiFi-configuration")),a(Sn,"target","_blank"),a(Sn,"class","float-right"),a(fi,"type","hidden"),a(fi,"name","w"),fi.value="true",Nn.__value=1,Nn.value=Nn.__value,En.__value=2,En.value=En.__value,a(Zt,"name","nc"),a(Zt,"class","in-s"),t[3].n.c===void 0&&Ze(()=>t[42].call(Zt)),a(Zl,"class","my-1"),a(Gt,"class","cnt"),a(xi,"class","text-sm"),a(Pn,"href",Wt("Network-configuration")),a(Pn,"target","_blank"),a(Pn,"class","float-right"),$n.__value="dhcp",$n.value=$n.__value,Dn.__value="static",Dn.value=Dn.__value,a(dl,"name","nm"),a(dl,"class","in-f"),t[3].n.m===void 0&&Ze(()=>t[48].call(dl)),a(Vt,"name","ni"),a(Vt,"type","text"),a(Vt,"class","in-m w-full"),Vt.disabled=es=t[3].n.m=="dhcp",Vt.required=ts=t[3].n.m=="static",a(Kt,"name","ns"),a(Kt,"class","in-l"),Kt.disabled=ls=t[3].n.m=="dhcp",Kt.required=ns=t[3].n.m=="static",t[3].n.s===void 0&&Ze(()=>t[50].call(Kt)),a(ql,"class","flex"),a(Jl,"class","my-1"),a(al,"name","nd"),al.__value="true",al.value=al.__value,a(al,"type","checkbox"),a(al,"class","rounded mb-1"),a(is,"class","my-1"),a(ci,"type","hidden"),a(ci,"name","ntp"),ci.value="true",a(rl,"name","ntpd"),rl.__value="true",rl.value=rl.__value,a(rl,"type","checkbox"),a(rl,"class","rounded mb-1"),a(mi,"class","ml-4"),a(Sl,"name","ntph"),a(Sl,"type","text"),a(Sl,"class","in-s"),a(os,"class","flex"),a(Bl,"class","my-1"),a(Mt,"class","cnt"),a(as,"class","text-sm"),a(In,"href",Wt("MQTT-configuration")),a(In,"target","_blank"),a(In,"class","float-right"),a(_i,"type","hidden"),a(_i,"name","q"),_i.value="true",a(Tl,"name","qh"),a(Tl,"type","text"),a(Tl,"class","in-f w-3/4"),a(ul,"name","qp"),a(ul,"type","number"),a(ul,"min","1024"),a(ul,"max","65535"),a(ul,"class","in-l tr w-1/4"),a(Fn,"class","flex"),a(hl,"class","my-1"),a(Nl,"name","qu"),a(Nl,"type","text"),a(Nl,"class","in-s"),a(xl,"class","my-1"),a(El,"name","qa"),a(El,"type","password"),a(El,"class","in-s"),a(en,"class","my-1"),a(Pl,"name","qc"),a(Pl,"type","text"),a(Pl,"class","in-f w-full"),Un.__value=0,Un.value=Un.__value,jn.__value=1,jn.value=jn.__value,Hn.__value=2,Hn.value=Hn.__value,Wn.__value=3,Wn.value=Wn.__value,zn.__value=4,zn.value=zn.__value,Gn.__value=255,Gn.value=Gn.__value,a(Dt,"name","qm"),a(Dt,"class","in-l"),t[3].q.m===void 0&&Ze(()=>t[63].call(Dt)),a(On,"class","my-1 flex"),a(Al,"name","qb"),a(Al,"type","text"),a(Al,"class","in-s"),a(tn,"class","my-1"),a(ct,"class","cnt"),a(rs,"class","text-sm"),a(Vn,"href",Wt("User-interface")),a(Vn,"target","_blank"),a(Vn,"class","float-right"),a(pi,"type","hidden"),a(pi,"name","u"),pi.value="true",a(di,"class","flex flex-wrap"),a(vl,"class","cnt"),a(us,"class","text-sm"),a(Yn,"href","https://amsleser.no/blog/post/24-telnet-debug"),a(Yn,"target","_blank"),a(Yn,"class","float-right"),a(hi,"type","hidden"),a(hi,"name","d"),hi.value="true",a(fl,"type","checkbox"),a(fl,"name","ds"),fl.__value="true",fl.value=fl.__value,a(fl,"class","rounded mb-1"),a(fs,"class","mt-3"),a(Yt,"class","cnt"),a(n,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2"),a(Xn,"type","button"),a(Xn,"class","btn-red"),a(Zn,"type","button"),a(Zn,"class","btn-yellow"),a(ms,"class","text-center"),a(_s,"class","text-right"),a(Ul,"class","grid grid-cols-3 mt-3"),a(e,"autocomplete","off")},m(U,he){M(U,e,he),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),se(m,u,null),s(l,r),s(l,f),s(l,p),s(l,_),s(_,h),s(h,v),s(v,d),s(v,g),s(v,k),s(v,$),ue($,t[3].g.h),s(h,N),s(h,A),s(A,F),s(A,I),s(A,R),s(A,C),se(P,C,null),Te(C,t[3].g.t,!0),s(l,ne),s(l,j),s(l,B),s(l,H),s(H,V),s(V,G),s(G,K),s(G,Z),s(G,z),s(G,W),s(W,x),s(x,_e),s(x,ie),s(x,me),s(x,Y),s(x,ke),s(W,Ee),s(Ee,we),s(Ee,Me),s(Ee,te),s(Ee,fe),s(W,Oe),s(Oe,Ie),s(Oe,T),s(W,w),s(W,S),s(W,D),s(W,O),s(W,J),s(W,le),s(W,pe),s(W,ge),s(W,Ae),s(W,Fe),s(W,ce),s(W,Pe),s(W,ze),Te(W,t[3].p.r,!0),s(V,_t),s(V,Ke),s(Ke,ut),s(Ke,Ge),s(Ke,pt),s(Ke,Ue);for(let St=0;St<5;St+=1)vi[St]&&vi[St].m(Ue,null);Te(Ue,t[3].p.c,!0),s(l,At),s(l,dt),se(vt,dt,null),s(l,xe),s(l,Re),s(Re,et),s(et,Le),Le.checked=t[3].p.e,s(et,Je),s(Re,at),Lt&&Lt.m(Re,null),s(l,qe),s(l,ye),s(ye,ve),s(ye,de),s(ye,Ve),s(ye,re),s(re,Qe),s(re,ee),s(re,st),Te(re,t[3].g.s,!0),s(l,Li),It&&It.m(l,null),s(l,ri),s(l,yl),s(yl,Ii),s(yl,Ri),s(yl,Fi),s(yl,$t),ue($t,t[3].g.c),s(n,Oi),s(n,Xe),s(Xe,dn),s(Xe,qi),s(Xe,Ll),se(Il,Ll,null),s(Xe,Bi),s(Xe,zl),s(Xe,Ui),s(Xe,Gl),s(Xe,ji),s(Xe,Ml),s(Ml,nt),s(Ml,rt),s(Ml,Vl),s(Ml,tl),s(tl,ml),s(tl,ft),Te(tl,t[3].m.a,!0),s(Xe,Hi),s(Xe,Xt),s(Xt,Wi),s(Xt,Lo),s(Xt,Ps),s(Xt,Io),s(Xt,ui),s(ui,ll),ll.checked=t[3].m.i,s(ui,Ro),s(Xt,Fo),s(Xt,Rl),s(Rl,_l),s(_l,Fl),s(Fl,Oo);for(let St=0;St<7;St+=1)bi[St]&&bi[St].m(_l,null);Te(_l,t[3].m.b,!0),s(Rl,qo),s(Rl,Nt),s(Nt,Ol),s(Ol,Bo),s(Nt,hn),s(Nt,vn),s(Nt,bn),s(Nt,gn),Te(Nt,t[3].m.p,!0),s(Rl,Uo),s(Rl,zt),ue(zt,t[3].m.s),s(Xe,jo),s(Xe,Kl),s(Kl,Ho),s(Kl,Wo),s(Kl,zo),s(Kl,pl),s(pl,kn),s(pl,wn),Te(pl,t[3].m.d,!0),s(Xe,Go),s(Xe,Cn),s(Cn,Yl),s(Yl,Vo),s(Yl,Ko),s(Yl,Yo),s(Yl,yn),s(yn,nl),ue(nl,t[3].m.f),s(yn,Qo),s(yn,Yi),s(Cn,Xo),s(Cn,Ql),s(Ql,Zo),s(Ql,Jo),s(Ql,xo),s(Ql,Mn),s(Mn,il),ue(il,t[3].m.r),s(Mn,ea),s(Mn,Qi),s(Xe,ta),s(Xe,As),s(Xe,la),s(Xe,Xl),s(Xl,Xi),s(Xi,sl),sl.checked=t[3].m.e.e,s(Xi,na),s(Xl,ia),Rt&&Rt.m(Xl,null),s(Xe,sa),Ft&&Ft.m(Xe,null),s(Xe,$s),s(Xe,Zi),s(Zi,ol),ol.checked=t[3].m.m.e,s(Zi,oa),s(Xe,aa),Ot&&Ot.m(Xe,null),s(n,ra),s(n,Gt),s(Gt,Ji),s(Gt,ua),s(Gt,Sn),se(Tn,Sn,null),s(Gt,fa),s(Gt,fi),s(Gt,ca),s(Gt,Zl),s(Zl,ma),s(Zl,_a),s(Zl,pa),s(Zl,Zt),s(Zt,Nn),s(Zt,En),Qt&&Qt.m(Zt,null),Te(Zt,t[3].n.c,!0),s(Gt,da),qt&&qt.m(Gt,null),s(n,ha),s(n,Mt),s(Mt,xi),s(Mt,va),s(Mt,Pn),se(An,Pn,null),s(Mt,ba),s(Mt,Jl),s(Jl,ga),s(Jl,ka),s(Jl,wa),s(Jl,ql),s(ql,dl),s(dl,$n),s(dl,Dn),Te(dl,t[3].n.m,!0),s(ql,Ca),s(ql,Vt),ue(Vt,t[3].n.i),s(ql,ya),s(ql,Kt),se(Ln,Kt,null),Te(Kt,t[3].n.s,!0),s(Mt,Ma),Bt&&Bt.m(Mt,null),s(Mt,Ds),s(Mt,is),s(is,ss),s(ss,al),al.checked=t[3].n.d,s(ss,Sa),s(Mt,Ta),s(Mt,ci),s(Mt,Na),s(Mt,Bl),s(Bl,Ea),s(Bl,mi),s(mi,rl),rl.checked=t[3].n.h,s(mi,Pa),s(Bl,Aa),s(Bl,$a),s(Bl,os),s(os,Sl),ue(Sl,t[3].n.n1),s(n,Da),s(n,ct),s(ct,as),s(ct,La),s(ct,In),se(Rn,In,null),s(ct,Ia),s(ct,_i),s(ct,Ra),s(ct,hl),s(hl,Fa),Ut&&Ut.m(hl,null),s(hl,Ls),s(hl,Oa),s(hl,qa),s(hl,Fn),s(Fn,Tl),ue(Tl,t[3].q.h),s(Fn,Ba),s(Fn,ul),ue(ul,t[3].q.p),s(ct,Ua),bt&&bt.m(ct,null),s(ct,Is),s(ct,xl),s(xl,ja),s(xl,Ha),s(xl,Wa),s(xl,Nl),ue(Nl,t[3].q.u),s(ct,za),s(ct,en),s(en,Ga),s(en,Va),s(en,Ka),s(en,El),ue(El,t[3].q.a),s(ct,Ya),s(ct,On),s(On,qn),s(qn,Qa),s(qn,Xa),s(qn,Za),s(qn,Pl),ue(Pl,t[3].q.c),s(On,Ja),s(On,Bn),s(Bn,xa),s(Bn,er),s(Bn,tr),s(Bn,Dt),s(Dt,Un),s(Dt,jn),s(Dt,Hn),s(Dt,Wn),s(Dt,zn),s(Dt,Gn),Te(Dt,t[3].q.m,!0),s(ct,lr),s(ct,tn),s(tn,nr),s(tn,ir),s(tn,sr),s(tn,Al),ue(Al,t[3].q.b),s(n,or),gt&>.m(n,null),s(n,Rs),kt&&kt.m(n,null),s(n,Fs),wt&&wt.m(n,null),s(n,Os),Ct&&Ct.m(n,null),s(n,Bs),s(n,vl),s(vl,rs),s(vl,ar),s(vl,Vn),se(Kn,Vn,null),s(vl,rr),s(vl,pi),s(vl,ur),s(vl,di);for(let St=0;St<Et.length;St+=1)Et[St]&&Et[St].m(di,null);s(n,fr),yt&&yt.m(n,null),s(n,Us),s(n,Yt),s(Yt,us),s(Yt,cr),s(Yt,Yn),se(Qn,Yn,null),s(Yt,mr),s(Yt,hi),s(Yt,_r),s(Yt,fs),s(fs,cs),s(cs,fl),fl.checked=t[3].d.s,s(cs,pr),s(Yt,dr),jt&&jt.m(Yt,null),s(e,hr),s(e,Ul),s(Ul,js),s(js,Xn),s(Ul,vr),s(Ul,ms),s(ms,Zn),s(Ul,br),s(Ul,_s),M(U,Hs,he),se(ln,U,he),M(U,Ws,he),se(nn,U,he),M(U,zs,he),se(sn,U,he),M(U,Gs,he),se(on,U,he),Jt=!0,Vs||(gr=[Q($,"input",t[16]),Q(C,"change",t[17]),Q(W,"change",t[18]),Q(Ue,"change",t[19]),Q(Le,"change",t[20]),Q(re,"change",t[22]),Q($t,"input",t[25]),Q(tl,"change",t[26]),Q(ll,"change",t[27]),Q(_l,"change",t[28]),Q(Nt,"change",t[29]),Q(zt,"input",t[30]),Q(pl,"change",t[31]),Q(nl,"input",t[32]),Q(il,"input",t[33]),Q(sl,"change",t[34]),Q(ol,"change",t[37]),Q(Zt,"change",t[42]),Q(dl,"change",t[48]),Q(Vt,"input",t[49]),Q(Kt,"change",t[50]),Q(al,"change",t[54]),Q(rl,"change",t[55]),Q(Sl,"input",t[56]),Q(Tl,"input",t[58]),Q(ul,"input",t[59]),Q(Nl,"input",t[60]),Q(El,"input",t[61]),Q(Pl,"input",t[62]),Q(Dt,"change",t[63]),Q(Al,"input",t[64]),Q(fl,"change",t[98]),Q(Xn,"click",t[8]),Q(Zn,"click",t[10]),Q(e,"submit",ai(t[9]))],Vs=!0)},p(U,he){he[0]&8&&$.value!==U[3].g.h&&ue($,U[3].g.h),he[0]&8&&Te(C,U[3].g.t),he[0]&8&&Te(W,U[3].p.r),he[0]&8&&Te(Ue,U[3].p.c);const St={};if(he[3]&2097152&&(St.$$scope={dirty:he,ctx:U}),vt.$set(St),he[0]&8&&(Le.checked=U[3].p.e),U[3].p.e&&U[0].chip!="esp8266"?Lt?Lt.p(U,he):(Lt=hf(U),Lt.c(),Lt.m(Re,null)):Lt&&(Lt.d(1),Lt=null),he[0]&8&&Te(re,U[3].g.s),U[3].g.s>0?It?It.p(U,he):(It=vf(U),It.c(),It.m(l,ri)):It&&(It.d(1),It=null),he[0]&8&&$t.value!==U[3].g.c&&ue($t,U[3].g.c),he[0]&8&&Te(tl,U[3].m.a),he[0]&8&&(ll.checked=U[3].m.i),(!Jt||he[0]&8&&zi!==(zi=U[3].m.b!=0))&&(Fl.disabled=zi),he[0]&8&&Te(_l,U[3].m.b),(!Jt||he[0]&8&&Gi!==(Gi=U[3].m.b!=0))&&(Ol.disabled=Gi),(!Jt||he[0]&8&&Vi!==(Vi=U[3].m.b==0))&&(Nt.disabled=Vi),he[0]&8&&Te(Nt,U[3].m.p),(!Jt||he[0]&9&&Ki!==(Ki=U[0].chip=="esp8266"?U[3].i.h.p==3||U[3].i.h.p==113?512:128:4096))&&a(zt,"max",Ki),he[0]&8&&Se(zt.value)!==U[3].m.s&&ue(zt,U[3].m.s),he[0]&8&&Te(pl,U[3].m.d),he[0]&8&&Se(nl.value)!==U[3].m.f&&ue(nl,U[3].m.f),he[0]&8&&Se(il.value)!==U[3].m.r&&ue(il,U[3].m.r),he[0]&8&&(sl.checked=U[3].m.e.e),U[3].m.e.e?Rt?Rt.p(U,he):(Rt=bf(U),Rt.c(),Rt.m(Xl,null)):Rt&&(Rt.d(1),Rt=null),U[3].m.e.e?Ft?Ft.p(U,he):(Ft=gf(U),Ft.c(),Ft.m(Xe,$s)):Ft&&(Ft.d(1),Ft=null),he[0]&8&&(ol.checked=U[3].m.m.e),U[3].m.m.e?Ot?Ot.p(U,he):(Ot=kf(U),Ot.c(),Ot.m(Xe,null)):Ot&&(Ot.d(1),Ot=null),U[0].if&&U[0].if.eth?Qt||(Qt=wf(),Qt.c(),Qt.m(Zt,null)):Qt&&(Qt.d(1),Qt=null),he[0]&8&&Te(Zt,U[3].n.c),U[3].n.c==1||U[3].n.c==2?qt?qt.p(U,he):(qt=Cf(U),qt.c(),qt.m(Gt,null)):qt&&(qt.d(1),qt=null),he[0]&8&&Te(dl,U[3].n.m),(!Jt||he[0]&8&&es!==(es=U[3].n.m=="dhcp"))&&(Vt.disabled=es),(!Jt||he[0]&8&&ts!==(ts=U[3].n.m=="static"))&&(Vt.required=ts),he[0]&8&&Vt.value!==U[3].n.i&&ue(Vt,U[3].n.i),(!Jt||he[0]&8&&ls!==(ls=U[3].n.m=="dhcp"))&&(Kt.disabled=ls),(!Jt||he[0]&8&&ns!==(ns=U[3].n.m=="static"))&&(Kt.required=ns),he[0]&8&&Te(Kt,U[3].n.s),U[3].n.m=="static"?Bt?Bt.p(U,he):(Bt=yf(U),Bt.c(),Bt.m(Mt,Ds)):Bt&&(Bt.d(1),Bt=null),he[0]&8&&(al.checked=U[3].n.d),he[0]&8&&(rl.checked=U[3].n.h),he[0]&8&&Sl.value!==U[3].n.n1&&ue(Sl,U[3].n.n1),U[0].chip!="esp8266"?Ut?Ut.p(U,he):(Ut=Mf(U),Ut.c(),Ut.m(hl,Ls)):Ut&&(Ut.d(1),Ut=null),he[0]&8&&Tl.value!==U[3].q.h&&ue(Tl,U[3].q.h),he[0]&8&&Se(ul.value)!==U[3].q.p&&ue(ul,U[3].q.p),U[3].q.s.e?bt?(bt.p(U,he),he[0]&8&&L(bt,1)):(bt=Sf(U),bt.c(),L(bt,1),bt.m(ct,Is)):bt&&($e(),q(bt,1,1,()=>{bt=null}),De()),he[0]&8&&Nl.value!==U[3].q.u&&ue(Nl,U[3].q.u),he[0]&8&&El.value!==U[3].q.a&&ue(El,U[3].q.a),he[0]&8&&Pl.value!==U[3].q.c&&ue(Pl,U[3].q.c),he[0]&8&&Te(Dt,U[3].q.m),he[0]&8&&Al.value!==U[3].q.b&&ue(Al,U[3].q.b),U[3].q.m==3?gt?(gt.p(U,he),he[0]&8&&L(gt,1)):(gt=Tf(U),gt.c(),L(gt,1),gt.m(n,Rs)):gt&&($e(),q(gt,1,1,()=>{gt=null}),De()),U[3].q.m==4?kt?(kt.p(U,he),he[0]&8&&L(kt,1)):(kt=Nf(U),kt.c(),L(kt,1),kt.m(n,Fs)):kt&&($e(),q(kt,1,1,()=>{kt=null}),De()),U[3].c.es!=null?wt?(wt.p(U,he),he[0]&8&&L(wt,1)):(wt=Ef(U),wt.c(),L(wt,1),wt.m(n,Os)):wt&&($e(),q(wt,1,1,()=>{wt=null}),De()),he[0]&8&&(qs=U[3].p.r.startsWith("10YNO")||U[3].p.r.startsWith("10Y1001A1001A4")),qs?Ct?(Ct.p(U,he),he[0]&8&&L(Ct,1)):(Ct=$f(U),Ct.c(),L(Ct,1),Ct.m(n,Bs)):Ct&&($e(),q(Ct,1,1,()=>{Ct=null}),De()),he[0]&136){Jn=U[7];let xt;for(xt=0;xt<Jn.length;xt+=1){const Mr=pf(U,Jn,xt);Et[xt]?Et[xt].p(Mr,he):(Et[xt]=Lf(Mr),Et[xt].c(),Et[xt].m(di,null))}for(;xt<Et.length;xt+=1)Et[xt].d(1);Et.length=Jn.length}U[0].board>20||U[0].chip=="esp8266"||U[3].i.d.d>0?yt?(yt.p(U,he),he[0]&9&&L(yt,1)):(yt=If(U),yt.c(),L(yt,1),yt.m(n,Us)):yt&&($e(),q(yt,1,1,()=>{yt=null}),De()),he[0]&8&&(fl.checked=U[3].d.s),U[3].d.s?jt?jt.p(U,he):(jt=jf(U),jt.c(),jt.m(Yt,null)):jt&&(jt.d(1),jt=null);const kr={};he[0]&2&&(kr.active=U[1]),ln.$set(kr);const wr={};he[0]&4&&(wr.active=U[2]),nn.$set(wr);const Cr={};he[0]&16&&(Cr.active=U[4]),sn.$set(Cr);const yr={};he[0]&32&&(yr.active=U[5]),on.$set(yr)},i(U){Jt||(L(m.$$.fragment,U),L(P.$$.fragment,U),L(vt.$$.fragment,U),L(Il.$$.fragment,U),L(Tn.$$.fragment,U),L(An.$$.fragment,U),L(Ln.$$.fragment,U),L(Rn.$$.fragment,U),L(bt),L(gt),L(kt),L(wt),L(Ct),L(Kn.$$.fragment,U),L(yt),L(Qn.$$.fragment,U),L(ln.$$.fragment,U),L(nn.$$.fragment,U),L(sn.$$.fragment,U),L(on.$$.fragment,U),Jt=!0)},o(U){q(m.$$.fragment,U),q(P.$$.fragment,U),q(vt.$$.fragment,U),q(Il.$$.fragment,U),q(Tn.$$.fragment,U),q(An.$$.fragment,U),q(Ln.$$.fragment,U),q(Rn.$$.fragment,U),q(bt),q(gt),q(kt),q(wt),q(Ct),q(Kn.$$.fragment,U),q(yt),q(Qn.$$.fragment,U),q(ln.$$.fragment,U),q(nn.$$.fragment,U),q(sn.$$.fragment,U),q(on.$$.fragment,U),Jt=!1},d(U){U&&y(e),oe(m),oe(P),mt(vi,U),oe(vt),Lt&&Lt.d(),It&&It.d(),oe(Il),mt(bi,U),Rt&&Rt.d(),Ft&&Ft.d(),Ot&&Ot.d(),oe(Tn),Qt&&Qt.d(),qt&&qt.d(),oe(An),oe(Ln),Bt&&Bt.d(),oe(Rn),Ut&&Ut.d(),bt&&bt.d(),gt&>.d(),kt&&kt.d(),wt&&wt.d(),Ct&&Ct.d(),oe(Kn),mt(Et,U),yt&&yt.d(),oe(Qn),jt&&jt.d(),U&&y(Hs),oe(ln,U),U&&y(Ws),oe(nn,U),U&&y(zs),oe(sn,U),U&&y(Gs),oe(on,U),Vs=!1,lt(gr)}}}async function J_(){await(await fetch("reboot",{method:"POST"})).json()}function x_(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=[{name:"Import gauge",key:"i"},{name:"Export gauge",key:"e"},{name:"Voltage",key:"v"},{name:"Amperage",key:"a"},{name:"Per phase",key:"h"},{name:"Power factor",key:"f"},{name:"Reactive",key:"r"},{name:"Realtime",key:"c"},{name:"Peaks",key:"t"},{name:"Realtime plot",key:"l"},{name:"Price",key:"p"},{name:"Day plot",key:"d"},{name:"Month plot",key:"m"},{name:"Temperature plot",key:"s"},{name:"Dark mode",key:"k"}],u=!0,m=!1,r={g:{t:"",h:"",s:0,u:"",p:""},m:{b:2400,p:11,i:!1,d:0,f:0,r:0,e:{e:!1,k:"",a:""},m:{e:!1,w:!1,v:!1,a:!1,c:!1}},w:{s:"",p:"",w:0,z:255,a:!0,b:!0},n:{m:"",i:"",s:"",g:"",d1:"",d2:"",d:!1,n1:"",n2:"",h:!1},q:{h:"",p:1883,u:"",a:"",b:"",s:{e:!1,c:!1,r:!0,k:!1}},o:{e:"",c:"",u1:"",u2:"",u3:""},t:{t:[0,0,0,0,0,0,0,0,0,0],h:1},p:{e:!1,t:"",r:"",c:"",m:1,f:null},d:{s:!1,t:!1,l:5},u:{i:0,e:0,v:0,a:0,r:0,c:0,t:0,p:0,d:0,m:0,s:0},i:{h:{p:null,u:!0},a:null,l:{p:null,i:!1},r:{r:null,g:null,b:null,i:!1},d:{d:null,b:0},t:{d:null,a:null},v:{p:null,d:{v:null,g:null},o:null,m:null,b:null}},h:{t:"",h:"",n:""},c:{e:!1,i:null,es:null}};wi.subscribe(nt=>{nt.version&&(n(3,r=nt),n(1,u=!1))}),h_();let f=!1,p=!1;async function _(){if(confirm("Are you sure you want to factory reset the device?")){n(4,f=!0);const nt=new URLSearchParams;nt.append("perform","true");let Vl=await(await fetch("reset",{method:"POST",body:nt})).json();n(4,f=!1),n(5,p=Vl.success)}}function h(nt){Tt.update(rt=>(rt.trying=nt,rt))}async function v(nt){n(2,m=!0);const rt=new FormData(nt.target),Vl=new URLSearchParams;for(let ft of rt){const[Hi,Xt]=ft;Vl.append(Hi,Xt)}let ml=await(await fetch("save",{method:"POST",body:Vl})).json();Tt.update(ft=>(ft.hostname=rt.get("gh"),ft.usrcfg=ml.success,ft.booting=ml.reboot,rt.get("nm")=="static"&&(ft.net.ip=rt.get("ni"),ft.net.mask=rt.get("nu"),ft.net.gw=rt.get("ng"),ft.net.dns1=rt.get("nd")),setTimeout(Ei,5e3,i,h),ft)),Tt.update(ft=>(ft.booting=ml.reboot,ft.ui=r.u,ft)),n(2,m=!1),mn(l)}const d=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(nt=>(nt.booting=!0,nt)),J_())};async function g(){confirm("Are you sure you want to delete CA?")&&(await(await fetch("mqtt-ca",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.c=!1,rt)))}async function k(){confirm("Are you sure you want to delete cert?")&&(await(await fetch("mqtt-cert",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.r=!1,rt)))}async function $(){confirm("Are you sure you want to delete key?")&&(await(await fetch("mqtt-key",{method:"POST"})).text(),wi.update(rt=>(rt.q.s.k=!1,rt)))}const N=function(){r.q.s.e?r.q.p==1883&&n(3,r.q.p=8883,r):r.q.p==8883&&n(3,r.q.p=1883,r)};let A=44;function F(){r.g.h=this.value,n(3,r)}function I(){r.g.t=ot(this),n(3,r)}function R(){r.p.r=ot(this),n(3,r)}function C(){r.p.c=ot(this),n(3,r)}function P(){r.p.e=this.checked,n(3,r)}function ne(){r.p.t=this.value,n(3,r)}function j(){r.g.s=ot(this),n(3,r)}function B(){r.g.u=this.value,n(3,r)}function H(){r.g.p=this.value,n(3,r)}function V(){r.g.c=this.value,n(3,r)}function G(){r.m.a=ot(this),n(3,r)}function K(){r.m.i=this.checked,n(3,r)}function Z(){r.m.b=ot(this),n(3,r)}function z(){r.m.p=ot(this),n(3,r)}function W(){r.m.s=Se(this.value),n(3,r)}function x(){r.m.d=ot(this),n(3,r)}function _e(){r.m.f=Se(this.value),n(3,r)}function ie(){r.m.r=Se(this.value),n(3,r)}function me(){r.m.e.e=this.checked,n(3,r)}function Y(){r.m.e.k=this.value,n(3,r)}function ke(){r.m.e.a=this.value,n(3,r)}function Ee(){r.m.m.e=this.checked,n(3,r)}function we(){r.m.m.w=Se(this.value),n(3,r)}function Me(){r.m.m.v=Se(this.value),n(3,r)}function te(){r.m.m.a=Se(this.value),n(3,r)}function fe(){r.m.m.c=Se(this.value),n(3,r)}function Oe(){r.n.c=ot(this),n(3,r)}function Ie(){r.w.s=this.value,n(3,r)}function T(){r.w.p=this.value,n(3,r)}function w(){r.w.z=ot(this),n(3,r)}function S(){r.w.w=Se(this.value),n(3,r)}function D(){r.w.b=this.checked,n(3,r)}function O(){r.n.m=ot(this),n(3,r)}function J(){r.n.i=this.value,n(3,r)}function le(){r.n.s=ot(this),n(3,r)}function pe(){r.n.g=this.value,n(3,r)}function ge(){r.n.d1=this.value,n(3,r)}function Ae(){r.n.d2=this.value,n(3,r)}function Fe(){r.n.d=this.checked,n(3,r)}function ce(){r.n.h=this.checked,n(3,r)}function Pe(){r.n.n1=this.value,n(3,r)}function ze(){r.q.s.e=this.checked,n(3,r)}function _t(){r.q.h=this.value,n(3,r)}function Ke(){r.q.p=Se(this.value),n(3,r)}function ut(){r.q.u=this.value,n(3,r)}function Ge(){r.q.a=this.value,n(3,r)}function pt(){r.q.c=this.value,n(3,r)}function Ue(){r.q.m=ot(this),n(3,r)}function At(){r.q.b=this.value,n(3,r)}function dt(){r.o.e=this.value,n(3,r)}function vt(){r.o.c=this.value,n(3,r)}function xe(){r.o.u1=this.value,n(3,r)}function Re(){r.o.u2=this.value,n(3,r)}function et(){r.o.u3=this.value,n(3,r)}function Le(){r.h.t=this.value,n(3,r)}function Je(){r.h.h=this.value,n(3,r)}function at(){r.h.n=this.value,n(3,r)}function qe(){r.c.e=this.checked,n(3,r)}function ye(){r.c.es=this.checked,n(3,r)}function ve(nt){r.t.t[nt]=Se(this.value),n(3,r)}function de(){r.t.h=Se(this.value),n(3,r)}function Ve(nt){r.u[nt.key]=ot(this),n(3,r)}function re(){r.i.h.p=ot(this),n(3,r)}function Qe(){r.i.h.t=ot(this),n(3,r)}function ee(){r.i.h.u=this.checked,n(3,r)}function st(){r.i.a=Se(this.value),n(3,r)}function Li(){r.i.l.p=Se(this.value),n(3,r)}function ri(){r.i.l.i=this.checked,n(3,r)}function yl(){r.i.r.i=this.checked,n(3,r)}function Ii(){r.i.r.r=Se(this.value),n(3,r)}function Ri(){r.i.r.g=Se(this.value),n(3,r)}function Fi(){r.i.r.b=Se(this.value),n(3,r)}function $t(){r.i.d.d=Se(this.value),n(3,r)}function Oi(){r.i.t.d=Se(this.value),n(3,r)}function Xe(){r.i.t.a=Se(this.value),n(3,r)}function dn(){r.i.v.p=Se(this.value),n(3,r)}function qi(){r.i.v.d.v=Se(this.value),n(3,r)}function Ll(){r.i.v.d.g=Se(this.value),n(3,r)}function Il(){r.i.d.b=ot(this),n(3,r)}function Bi(){r.i.v.o=Se(this.value),n(3,r)}function zl(){r.i.v.m=Se(this.value),n(3,r)}function Ui(){r.i.v.b=Se(this.value),n(3,r)}function Gl(){r.d.s=this.checked,n(3,r)}function ji(){r.d.t=this.checked,n(3,r)}function Ml(){r.d.l=ot(this),n(3,r)}return t.$$set=nt=>{"basepath"in nt&&n(15,l=nt.basepath),"sysinfo"in nt&&n(0,i=nt.sysinfo)},t.$$.update=()=>{t.$$.dirty[0]&1&&n(6,A=i.chip=="esp8266"?16:i.chip=="esp32s2"?44:39)},[i,u,m,r,f,p,A,o,_,v,d,g,k,$,N,l,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe,ge,Ae,Fe,ce,Pe,ze,_t,Ke,ut,Ge,pt,Ue,At,dt,vt,xe,Re,et,Le,Je,at,qe,ye,ve,de,Ve,re,Qe,ee,st,Li,ri,yl,Ii,Ri,Fi,$t,Oi,Xe,dn,qi,Ll,Il,Bi,zl,Ui,Gl,ji,Ml]}class ep extends We{constructor(e){super(),He(this,e,x_,Z_,Be,{basepath:15,sysinfo:0},null,[-1,-1,-1,-1])}}function Wf(t,e,n){const l=t.slice();return l[21]=e[n],l}function tp(t){let e=Ce(t[1].chip,t[1].board)+"",n;return{c(){n=E(e)},m(l,i){M(l,n,i)},p(l,i){i&2&&e!==(e=Ce(l[1].chip,l[1].board)+"")&&X(n,e)},d(l){l&&y(n)}}}function zf(t){let e,n,l=t[1].apmac+"",i,o,u,m,r,f,p,_,h,v=Hr(t[1])+"",d,g,k=t[1].boot_reason+"",$,N,A=t[1].ex_cause+"",F,I,R;const C=[np,lp],P=[];function ne(j,B){return j[0].u>0?0:1}return r=ne(t),f=P[r]=C[r](t),{c(){e=c("div"),n=E("AP MAC: "),i=E(l),o=b(),u=c("div"),m=E(`Last boot:
|
|
`),f.c(),p=b(),_=c("div"),h=E("Reason: "),d=E(v),g=E(" ("),$=E(k),N=E("/"),F=E(A),I=E(")"),a(e,"class","my-2"),a(u,"class","my-2"),a(_,"class","my-2")},m(j,B){M(j,e,B),s(e,n),s(e,i),M(j,o,B),M(j,u,B),s(u,m),P[r].m(u,null),M(j,p,B),M(j,_,B),s(_,h),s(_,d),s(_,g),s(_,$),s(_,N),s(_,F),s(_,I),R=!0},p(j,B){(!R||B&2)&&l!==(l=j[1].apmac+"")&&X(i,l);let H=r;r=ne(j),r===H?P[r].p(j,B):($e(),q(P[H],1,1,()=>{P[H]=null}),De(),f=P[r],f?f.p(j,B):(f=P[r]=C[r](j),f.c()),L(f,1),f.m(u,null)),(!R||B&2)&&v!==(v=Hr(j[1])+"")&&X(d,v),(!R||B&2)&&k!==(k=j[1].boot_reason+"")&&X($,k),(!R||B&2)&&A!==(A=j[1].ex_cause+"")&&X(F,A)},i(j){R||(L(f),R=!0)},o(j){q(f),R=!1},d(j){j&&y(e),j&&y(o),j&&y(u),P[r].d(),j&&y(p),j&&y(_)}}}function lp(t){let e;return{c(){e=E("-")},m(n,l){M(n,e,l)},p:be,i:be,o:be,d(n){n&&y(e)}}}function np(t){let e,n;return e=new k0({props:{timestamp:new Date(new Date().getTime()-t[0].u*1e3),fullTimeColor:""}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.timestamp=new Date(new Date().getTime()-l[0].u*1e3)),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function ip(t){let e;return{c(){e=c("span"),e.textContent="Update consents",a(e,"class","btn-pri-sm")},m(n,l){M(n,e,l)},p:be,d(n){n&&y(e)}}}function Gf(t){let e,n,l,i,o,u=Ss(t[1].meter.mfg)+"",m,r,f,p,_=(t[1].meter.model?t[1].meter.model:"unknown")+"",h,v,d,g,k=(t[1].meter.id?t[1].meter.id:"unknown")+"",$;return{c(){e=c("div"),n=c("strong"),n.textContent="Meter",l=b(),i=c("div"),o=E("Manufacturer: "),m=E(u),r=b(),f=c("div"),p=E("Model: "),h=E(_),v=b(),d=c("div"),g=E("ID: "),$=E(k),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(e,"class","cnt")},m(N,A){M(N,e,A),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,$)},p(N,A){A&2&&u!==(u=Ss(N[1].meter.mfg)+"")&&X(m,u),A&2&&_!==(_=(N[1].meter.model?N[1].meter.model:"unknown")+"")&&X(h,_),A&2&&k!==(k=(N[1].meter.id?N[1].meter.id:"unknown")+"")&&X($,k)},d(N){N&&y(e)}}}function Vf(t){let e,n,l,i,o,u=t[1].net.ip+"",m,r,f,p,_=t[1].net.mask+"",h,v,d,g,k=t[1].net.gw+"",$,N,A,F,I=t[1].net.dns1+"",R,C,P=t[1].net.dns2&&Kf(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Network",l=b(),i=c("div"),o=E("IP: "),m=E(u),r=b(),f=c("div"),p=E("Mask: "),h=E(_),v=b(),d=c("div"),g=E("Gateway: "),$=E(k),N=b(),A=c("div"),F=E("DNS: "),R=E(I),C=b(),P&&P.c(),a(n,"class","text-sm"),a(i,"class","my-2"),a(f,"class","my-2"),a(d,"class","my-2"),a(A,"class","my-2"),a(e,"class","cnt")},m(ne,j){M(ne,e,j),s(e,n),s(e,l),s(e,i),s(i,o),s(i,m),s(e,r),s(e,f),s(f,p),s(f,h),s(e,v),s(e,d),s(d,g),s(d,$),s(e,N),s(e,A),s(A,F),s(A,R),s(A,C),P&&P.m(A,null)},p(ne,j){j&2&&u!==(u=ne[1].net.ip+"")&&X(m,u),j&2&&_!==(_=ne[1].net.mask+"")&&X(h,_),j&2&&k!==(k=ne[1].net.gw+"")&&X($,k),j&2&&I!==(I=ne[1].net.dns1+"")&&X(R,I),ne[1].net.dns2?P?P.p(ne,j):(P=Kf(ne),P.c(),P.m(A,null)):P&&(P.d(1),P=null)},d(ne){ne&&y(e),P&&P.d()}}}function Kf(t){let e,n=t[1].net.dns2+"",l;return{c(){e=E("/ "),l=E(n)},m(i,o){M(i,e,o),M(i,l,o)},p(i,o){o&2&&n!==(n=i[1].net.dns2+"")&&X(l,n)},d(i){i&&y(e),i&&y(l)}}}function Yf(t){let e,n,l,i=t[1].upgrade.f+"",o,u,m=t[1].upgrade.t+"",r,f,p=jr(t[1].upgrade.e)+"",_;return{c(){e=c("div"),n=c("div"),l=E("Previous upgrade attempt from "),o=E(i),u=E(" to "),r=E(m),f=E(" failed. "),_=E(p),a(n,"class","bd-yellow"),a(e,"class","my-2")},m(h,v){M(h,e,v),s(e,n),s(n,l),s(n,o),s(n,u),s(n,r),s(n,f),s(n,_)},p(h,v){v&2&&i!==(i=h[1].upgrade.f+"")&&X(o,i),v&2&&m!==(m=h[1].upgrade.t+"")&&X(r,m),v&2&&p!==(p=jr(h[1].upgrade.e)+"")&&X(_,p)},d(h){h&&y(e)}}}function Qf(t){let e,n,l,i=t[3].tag_name+"",o,u,m,r,f,p,_=(t[1].security==0||t[0].a)&&t[1].fwconsent===1&&t[3]&&t[3].tag_name!=t[1].version&&Xf(t),h=t[1].fwconsent===2&&Zf();return{c(){e=c("div"),n=E(`Latest version:
|
|
`),l=c("a"),o=E(i),m=b(),_&&_.c(),r=b(),h&&h.c(),f=it(),a(l,"href",u=t[3].html_url),a(l,"class","ml-2 text-blue-600 hover:text-blue-800"),a(l,"target","_blank"),a(l,"rel","noreferrer"),a(e,"class","my-2 flex")},m(v,d){M(v,e,d),s(e,n),s(e,l),s(l,o),s(e,m),_&&_.m(e,null),M(v,r,d),h&&h.m(v,d),M(v,f,d),p=!0},p(v,d){(!p||d&8)&&i!==(i=v[3].tag_name+"")&&X(o,i),(!p||d&8&&u!==(u=v[3].html_url))&&a(l,"href",u),(v[1].security==0||v[0].a)&&v[1].fwconsent===1&&v[3]&&v[3].tag_name!=v[1].version?_?(_.p(v,d),d&11&&L(_,1)):(_=Xf(v),_.c(),L(_,1),_.m(e,null)):_&&($e(),q(_,1,1,()=>{_=null}),De()),v[1].fwconsent===2?h||(h=Zf(),h.c(),h.m(f.parentNode,f)):h&&(h.d(1),h=null)},i(v){p||(L(_),p=!0)},o(v){q(_),p=!1},d(v){v&&y(e),_&&_.d(),v&&y(r),h&&h.d(v),v&&y(f)}}}function Xf(t){let e,n,l,i,o,u;return l=new w0({}),{c(){e=c("div"),n=c("button"),ae(l.$$.fragment),a(e,"class","flex-none ml-2 text-green-500"),a(e,"title","Install this version")},m(m,r){M(m,e,r),s(e,n),se(l,n,null),i=!0,o||(u=Q(n,"click",t[10]),o=!0)},p:be,i(m){i||(L(l.$$.fragment,m),i=!0)},o(m){q(l.$$.fragment,m),i=!1},d(m){m&&y(e),oe(l),o=!1,u()}}}function Zf(t){let e;return{c(){e=c("div"),e.innerHTML='<div class="bd-yellow">You have disabled one-click firmware upgrade, link to self-upgrade is disabled</div>',a(e,"class","my-2")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function Jf(t){let e,n=Ts(Ce(t[1].chip,t[1].board))+"",l;return{c(){e=c("div"),l=E(n),a(e,"class","bd-red")},m(i,o){M(i,e,o),s(e,l)},p(i,o){o&2&&n!==(n=Ts(Ce(i[1].chip,i[1].board))+"")&&X(l,n)},d(i){i&&y(e)}}}function xf(t){let e,n,l,i,o,u;function m(p,_){return p[5].length==0?op:sp}let r=m(t),f=r(t);return{c(){e=c("div"),n=c("form"),l=c("input"),i=b(),f.c(),Ci(l,"display","none"),a(l,"name","file"),a(l,"type","file"),a(l,"accept",".bin"),a(n,"action","/firmware"),a(n,"enctype","multipart/form-data"),a(n,"method","post"),a(n,"autocomplete","off"),a(e,"class","my-2 flex")},m(p,_){M(p,e,_),s(e,n),s(n,l),t[13](l),s(n,i),f.m(n,null),o||(u=[Q(l,"change",t[14]),Q(n,"submit",t[16])],o=!0)},p(p,_){r===(r=m(p))&&f?f.p(p,_):(f.d(1),f=r(p),f&&(f.c(),f.m(n,null)))},d(p){p&&y(e),t[13](null),f.d(),o=!1,lt(u)}}}function sp(t){let e=t[5][0].name+"",n,l,i;return{c(){n=E(e),l=b(),i=c("button"),i.textContent="Upload",a(i,"type","submit"),a(i,"class","btn-pri-sm float-right")},m(o,u){M(o,n,u),M(o,l,u),M(o,i,u)},p(o,u){u&32&&e!==(e=o[5][0].name+"")&&X(n,e)},d(o){o&&y(n),o&&y(l),o&&y(i)}}}function op(t){let e,n,l;return{c(){e=c("button"),e.textContent="Select firmware file for upgrade",a(e,"type","button"),a(e,"class","btn-pri-sm float-right")},m(i,o){M(i,e,o),n||(l=Q(e,"click",t[15]),n=!0)},p:be,d(i){i&&y(e),n=!1,l()}}}function e1(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g=t[9],k=[];for(let I=0;I<g.length;I+=1)k[I]=t1(Wf(t,g,I));let $=t[2].length==0&&l1();function N(I,R){return I[2].length==0?rp:ap}let A=N(t),F=A(t);return{c(){e=c("div"),n=c("strong"),n.textContent="Backup & restore",l=b(),i=c("form"),o=c("div");for(let I=0;I<k.length;I+=1)k[I].c();u=b(),m=c("label"),m.innerHTML='<input type="checkbox" class="rounded" name="ic" value="true"/> Include Secrets<br/><small>(SSID, PSK, passwords and tokens)</small>',r=b(),$&&$.c(),f=b(),p=c("form"),_=c("input"),h=b(),F.c(),a(n,"class","text-sm"),a(m,"class","my-1 mx-3 col-span-2"),a(o,"class","grid grid-cols-2"),a(i,"method","get"),a(i,"action","/configfile.cfg"),a(i,"autocomplete","off"),Ci(_,"display","none"),a(_,"name","file"),a(_,"type","file"),a(_,"accept",".cfg"),a(p,"autocomplete","off"),a(e,"class","cnt")},m(I,R){M(I,e,R),s(e,n),s(e,l),s(e,i),s(i,o);for(let C=0;C<k.length;C+=1)k[C]&&k[C].m(o,null);s(o,u),s(o,m),s(i,r),$&&$.m(i,null),s(e,f),s(e,p),s(p,_),t[17](_),s(p,h),F.m(p,null),v||(d=[Q(_,"change",t[18]),Q(p,"submit",ai(t[12]))],v=!0)},p(I,R){if(R&512){g=I[9];let C;for(C=0;C<g.length;C+=1){const P=Wf(I,g,C);k[C]?k[C].p(P,R):(k[C]=t1(P),k[C].c(),k[C].m(o,u))}for(;C<k.length;C+=1)k[C].d(1);k.length=g.length}I[2].length==0?$||($=l1(),$.c(),$.m(i,null)):$&&($.d(1),$=null),A===(A=N(I))&&F?F.p(I,R):(F.d(1),F=A(I),F&&(F.c(),F.m(p,null)))},d(I){I&&y(e),mt(k,I),$&&$.d(),t[17](null),F.d(),v=!1,lt(d)}}}function t1(t){let e,n,l,i=t[21].name+"",o;return{c(){e=c("label"),n=c("input"),l=b(),o=E(i),a(n,"type","checkbox"),a(n,"class","rounded"),a(n,"name",t[21].key),n.value="true",n.checked=!0,a(e,"class","my-1 mx-3")},m(u,m){M(u,e,m),s(e,n),s(e,l),s(e,o)},p:be,d(u){u&&y(e)}}}function l1(t){let e;return{c(){e=c("button"),e.textContent="Download",a(e,"type","submit"),a(e,"class","btn-pri-sm float-right")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function ap(t){let e=t[2][0].name+"",n,l,i;return{c(){n=E(e),l=b(),i=c("button"),i.textContent="Upload",a(i,"type","submit"),a(i,"class","btn-pri-sm")},m(o,u){M(o,n,u),M(o,l,u),M(o,i,u)},p(o,u){u&4&&e!==(e=o[2][0].name+"")&&X(n,e)},d(o){o&&y(n),o&&y(l),o&&y(i)}}}function rp(t){let e,n,l;return{c(){e=c("button"),e.textContent="Select file...",a(e,"type","button"),a(e,"class","btn-pri-sm")},m(i,o){M(i,e,o),n||(l=Q(e,"click",t[19]),n=!0)},p:be,d(i){i&&y(e),n=!1,l()}}}function up(t){let e,n,l,i,o,u,m=t[1].chip+"",r,f,p=t[1].cpu+"",_,h,v,d,g,k,$,N,A,F=t[1].mac+"",I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e=t[1].version+"",ie,me,Y,ke,Ee=(t[1].security==0||t[0].a)&&ni(t[1].board),we,Me,te,fe,Oe,Ie,T,w,S;k=new el({props:{to:"/vendor",$$slots:{default:[tp]},$$scope:{ctx:t}}});let D=t[1].apmac&&t[1].apmac!=t[1].mac&&zf(t);ne=new el({props:{to:"/consent",$$slots:{default:[ip]},$$scope:{ctx:t}}});let O=t[1].meter&&Gf(t),J=t[1].net&&Vf(t),le=t[1].upgrade.t&&t[1].upgrade.t!=t[1].version&&Yf(t),pe=t[3]&&Qf(t),ge=Ee&&Jf(t),Ae=(t[1].security==0||t[0].a)&&xf(t),Fe=(t[1].security==0||t[0].a)&&e1(t);return fe=new Pt({props:{active:t[6],message:"Uploading firmware, please wait"}}),Ie=new Pt({props:{active:t[8],message:"Uploading configuration, please wait"}}),{c(){e=c("div"),n=c("div"),l=c("strong"),l.textContent="Device information",i=b(),o=c("div"),u=E("Chip: "),r=E(m),f=E(" ("),_=E(p),h=E("MHz)"),v=b(),d=c("div"),g=E("Device: "),ae(k.$$.fragment),$=b(),N=c("div"),A=E("MAC: "),I=E(F),R=b(),D&&D.c(),C=b(),P=c("div"),ae(ne.$$.fragment),j=b(),B=c("button"),B.textContent="Reboot",H=b(),O&&O.c(),V=b(),J&&J.c(),G=b(),K=c("div"),Z=c("strong"),Z.textContent="Firmware",z=b(),W=c("div"),x=E("Installed version: "),ie=E(_e),me=b(),le&&le.c(),Y=b(),pe&&pe.c(),ke=b(),ge&&ge.c(),we=b(),Ae&&Ae.c(),Me=b(),Fe&&Fe.c(),te=b(),ae(fe.$$.fragment),Oe=b(),ae(Ie.$$.fragment),a(l,"class","text-sm"),a(o,"class","my-2"),a(d,"class","my-2"),a(N,"class","my-2"),a(B,"class","btn-yellow-sm float-right"),a(P,"class","my-2"),a(n,"class","cnt"),a(Z,"class","text-sm"),a(W,"class","my-2"),a(K,"class","cnt"),a(e,"class","grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2")},m(ce,Pe){M(ce,e,Pe),s(e,n),s(n,l),s(n,i),s(n,o),s(o,u),s(o,r),s(o,f),s(o,_),s(o,h),s(n,v),s(n,d),s(d,g),se(k,d,null),s(n,$),s(n,N),s(N,A),s(N,I),s(n,R),D&&D.m(n,null),s(n,C),s(n,P),se(ne,P,null),s(P,j),s(P,B),s(e,H),O&&O.m(e,null),s(e,V),J&&J.m(e,null),s(e,G),s(e,K),s(K,Z),s(K,z),s(K,W),s(W,x),s(W,ie),s(K,me),le&&le.m(K,null),s(K,Y),pe&&pe.m(K,null),s(K,ke),ge&&ge.m(K,null),s(K,we),Ae&&Ae.m(K,null),s(e,Me),Fe&&Fe.m(e,null),M(ce,te,Pe),se(fe,ce,Pe),M(ce,Oe,Pe),se(Ie,ce,Pe),T=!0,w||(S=Q(B,"click",t[11]),w=!0)},p(ce,[Pe]){(!T||Pe&2)&&m!==(m=ce[1].chip+"")&&X(r,m),(!T||Pe&2)&&p!==(p=ce[1].cpu+"")&&X(_,p);const ze={};Pe&16777218&&(ze.$$scope={dirty:Pe,ctx:ce}),k.$set(ze),(!T||Pe&2)&&F!==(F=ce[1].mac+"")&&X(I,F),ce[1].apmac&&ce[1].apmac!=ce[1].mac?D?(D.p(ce,Pe),Pe&2&&L(D,1)):(D=zf(ce),D.c(),L(D,1),D.m(n,C)):D&&($e(),q(D,1,1,()=>{D=null}),De());const _t={};Pe&16777216&&(_t.$$scope={dirty:Pe,ctx:ce}),ne.$set(_t),ce[1].meter?O?O.p(ce,Pe):(O=Gf(ce),O.c(),O.m(e,V)):O&&(O.d(1),O=null),ce[1].net?J?J.p(ce,Pe):(J=Vf(ce),J.c(),J.m(e,G)):J&&(J.d(1),J=null),(!T||Pe&2)&&_e!==(_e=ce[1].version+"")&&X(ie,_e),ce[1].upgrade.t&&ce[1].upgrade.t!=ce[1].version?le?le.p(ce,Pe):(le=Yf(ce),le.c(),le.m(K,Y)):le&&(le.d(1),le=null),ce[3]?pe?(pe.p(ce,Pe),Pe&8&&L(pe,1)):(pe=Qf(ce),pe.c(),L(pe,1),pe.m(K,ke)):pe&&($e(),q(pe,1,1,()=>{pe=null}),De()),Pe&3&&(Ee=(ce[1].security==0||ce[0].a)&&ni(ce[1].board)),Ee?ge?ge.p(ce,Pe):(ge=Jf(ce),ge.c(),ge.m(K,we)):ge&&(ge.d(1),ge=null),ce[1].security==0||ce[0].a?Ae?Ae.p(ce,Pe):(Ae=xf(ce),Ae.c(),Ae.m(K,null)):Ae&&(Ae.d(1),Ae=null),ce[1].security==0||ce[0].a?Fe?Fe.p(ce,Pe):(Fe=e1(ce),Fe.c(),Fe.m(e,null)):Fe&&(Fe.d(1),Fe=null);const Ke={};Pe&64&&(Ke.active=ce[6]),fe.$set(Ke);const ut={};Pe&256&&(ut.active=ce[8]),Ie.$set(ut)},i(ce){T||(L(k.$$.fragment,ce),L(D),L(ne.$$.fragment,ce),L(pe),L(fe.$$.fragment,ce),L(Ie.$$.fragment,ce),T=!0)},o(ce){q(k.$$.fragment,ce),q(D),q(ne.$$.fragment,ce),q(pe),q(fe.$$.fragment,ce),q(Ie.$$.fragment,ce),T=!1},d(ce){ce&&y(e),oe(k),D&&D.d(),oe(ne),O&&O.d(),J&&J.d(),le&&le.d(),pe&&pe.d(),ge&&ge.d(),Ae&&Ae.d(),Fe&&Fe.d(),ce&&y(te),oe(fe,ce),ce&&y(Oe),oe(Ie,ce),w=!1,S()}}}async function fp(){await(await fetch("reboot",{method:"POST"})).json()}function cp(t,e,n){let{data:l}=e,{sysinfo:i}=e,o=[{name:"WiFi",key:"iw"},{name:"MQTT",key:"im"},{name:"Web",key:"ie"},{name:"Meter",key:"it"},{name:"Thresholds",key:"ih"},{name:"GPIO",key:"ig"},{name:"NTP",key:"in"},{name:"Price API",key:"is"}],u={};Ao.subscribe(P=>{n(3,u=g0(i.version,P)),u||n(3,u=P[0])});function m(){confirm("Do you want to upgrade this device to "+u.tag_name+"?")&&(i.board!=2&&i.board!=4&&i.board!=7||confirm(Ts(Ce(i.chip,i.board))))&&(Tt.update(P=>(P.upgrading=!0,P)),b0(u.tag_name))}const r=function(){confirm("Are you sure you want to reboot the device?")&&(Tt.update(P=>(P.booting=!0,P)),fp())};let f,p=[],_=!1,h,v=[],d=!1;To();let g={hostname:"",ip:""};function k(P){n(8,d=!0);const ne=new FormData;ne.append("file",v[0]),fetch("/configfile",{method:"POST",body:ne}).then(j=>j.json()).then(j=>{Tt.update(B=>(console.log("updating sysinfo with: ",g),g&&g.hostname&&(B.hostname=g.hostname),B.booting=j.reboot,g&&g.ip&&(B.net.ip=g.ip),setTimeout(Ei,5e3,i),B))}).catch(j=>{console.error("Error:",j),setTimeout(Ei,5e3,i)})}function $(P){ys[P?"unshift":"push"](()=>{f=P,n(4,f)})}function N(){p=this.files,n(5,p)}const A=()=>{f.click()},F=()=>n(6,_=!0);function I(P){ys[P?"unshift":"push"](()=>{h=P,n(7,h)})}function R(){v=this.files,n(2,v)}const C=()=>{h.click()};return t.$$set=P=>{"data"in P&&n(0,l=P.data),"sysinfo"in P&&n(1,i=P.sysinfo)},t.$$.update=()=>{if(t.$$.dirty&4&&v.length==1){let P=v[0],ne=new FileReader,j=B=>{let H=B.target.result.split(`
|
|
`);for(let V in H){let G=H[V];G.startsWith("hostname ")?g.hostname=G.split(" ")[1]:G.startsWith("ip ")&&(g.ip=G.split(" ")[1])}};ne.onload=j,ne.readAsText(P)}},[l,i,v,u,f,p,_,h,d,o,m,r,k,$,N,A,F,I,R,C]}class mp extends We{constructor(e){super(),He(this,e,cp,up,Be,{data:0,sysinfo:1})}}function n1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],5)+"",m,r,f=Ce(t[0],4)+"",p,_,h=Ce(t[0],3)+"",v,d,g,k,$=Ce(t[0],2)+"",N,A,F=Ce(t[0],1)+"",I,R,C=Ce(t[0],0)+"",P,ne,j,B,H=Ce(t[0],101)+"",V,G,K=Ce(t[0],100)+"",Z;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),v=E(h),d=b(),g=c("optgroup"),k=c("option"),N=E($),A=c("option"),I=E(F),R=c("option"),P=E(C),ne=b(),j=c("optgroup"),B=c("option"),V=E(H),G=c("option"),Z=E(K),n.__value=7,n.value=n.__value,o.__value=5,o.value=o.__value,r.__value=4,r.value=r.__value,_.__value=3,_.value=_.__value,a(e,"label","amsleser.no"),k.__value=2,k.value=k.__value,A.__value=1,A.value=A.__value,R.__value=0,R.value=R.__value,a(g,"label","Custom hardware"),B.__value=101,B.value=B.__value,G.__value=100,G.value=G.__value,a(j,"label","Generic hardware")},m(z,W){M(z,e,W),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,v),M(z,d,W),M(z,g,W),s(g,k),s(k,N),s(g,A),s(A,I),s(g,R),s(R,P),M(z,ne,W),M(z,j,W),s(j,B),s(B,V),s(j,G),s(G,Z)},p(z,W){W&1&&l!==(l=Ce(z[0],7)+"")&&X(i,l),W&1&&u!==(u=Ce(z[0],5)+"")&&X(m,u),W&1&&f!==(f=Ce(z[0],4)+"")&&X(p,f),W&1&&h!==(h=Ce(z[0],3)+"")&&X(v,h),W&1&&$!==($=Ce(z[0],2)+"")&&X(N,$),W&1&&F!==(F=Ce(z[0],1)+"")&&X(I,F),W&1&&C!==(C=Ce(z[0],0)+"")&&X(P,C),W&1&&H!==(H=Ce(z[0],101)+"")&&X(V,H),W&1&&K!==(K=Ce(z[0],100)+"")&&X(Z,K)},d(z){z&&y(e),z&&y(d),z&&y(g),z&&y(ne),z&&y(j)}}}function i1(t){let e,n,l=Ce(t[0],201)+"",i,o,u=Ce(t[0],202)+"",m,r,f=Ce(t[0],203)+"",p,_,h=Ce(t[0],241)+"",v,d,g=Ce(t[0],242)+"",k,$,N=Ce(t[0],243)+"",A,F,I=Ce(t[0],200)+"",R;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=c("option"),v=E(h),d=c("option"),k=E(g),$=c("option"),A=E(N),F=c("option"),R=E(I),n.__value=201,n.value=n.__value,o.__value=202,o.value=o.__value,r.__value=203,r.value=r.__value,_.__value=241,_.value=_.__value,d.__value=242,d.value=d.__value,$.__value=243,$.value=$.__value,F.__value=200,F.value=F.__value,a(e,"label","Generic hardware")},m(C,P){M(C,e,P),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),s(e,_),s(_,v),s(e,d),s(d,k),s(e,$),s($,A),s(e,F),s(F,R)},p(C,P){P&1&&l!==(l=Ce(C[0],201)+"")&&X(i,l),P&1&&u!==(u=Ce(C[0],202)+"")&&X(m,u),P&1&&f!==(f=Ce(C[0],203)+"")&&X(p,f),P&1&&h!==(h=Ce(C[0],241)+"")&&X(v,h),P&1&&g!==(g=Ce(C[0],242)+"")&&X(k,g),P&1&&N!==(N=Ce(C[0],243)+"")&&X(A,N),P&1&&I!==(I=Ce(C[0],200)+"")&&X(R,I)},d(C){C&&y(e)}}}function s1(t){let e,n,l=Ce(t[0],7)+"",i,o,u=Ce(t[0],6)+"",m,r,f=Ce(t[0],5)+"",p,_,h,v,d=Ce(t[0],51)+"",g,k,$=Ce(t[0],50)+"",N;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=c("option"),m=E(u),r=c("option"),p=E(f),_=b(),h=c("optgroup"),v=c("option"),g=E(d),k=c("option"),N=E($),n.__value=7,n.value=n.__value,o.__value=6,o.value=o.__value,r.__value=5,r.value=r.__value,a(e,"label","amsleser.no"),v.__value=51,v.value=v.__value,k.__value=50,k.value=k.__value,a(h,"label","Generic hardware")},m(A,F){M(A,e,F),s(e,n),s(n,i),s(e,o),s(o,m),s(e,r),s(r,p),M(A,_,F),M(A,h,F),s(h,v),s(v,g),s(h,k),s(k,N)},p(A,F){F&1&&l!==(l=Ce(A[0],7)+"")&&X(i,l),F&1&&u!==(u=Ce(A[0],6)+"")&&X(m,u),F&1&&f!==(f=Ce(A[0],5)+"")&&X(p,f),F&1&&d!==(d=Ce(A[0],51)+"")&&X(g,d),F&1&&$!==($=Ce(A[0],50)+"")&&X(N,$)},d(A){A&&y(e),A&&y(_),A&&y(h)}}}function o1(t){let e,n,l=Ce(t[0],8)+"",i,o,u,m,r=Ce(t[0],71)+"",f,p,_=Ce(t[0],70)+"",h;return{c(){e=c("optgroup"),n=c("option"),i=E(l),o=b(),u=c("optgroup"),m=c("option"),f=E(r),p=c("option"),h=E(_),n.__value=8,n.value=n.__value,a(e,"label","Custom hardware"),m.__value=71,m.value=m.__value,p.__value=70,p.value=p.__value,a(u,"label","Generic hardware")},m(v,d){M(v,e,d),s(e,n),s(n,i),M(v,o,d),M(v,u,d),s(u,m),s(m,f),s(u,p),s(p,h)},p(v,d){d&1&&l!==(l=Ce(v[0],8)+"")&&X(i,l),d&1&&r!==(r=Ce(v[0],71)+"")&&X(f,r),d&1&&_!==(_=Ce(v[0],70)+"")&&X(h,_)},d(v){v&&y(e),v&&y(o),v&&y(u)}}}function a1(t){let e,n,l=Ce(t[0],200)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=200,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],200)+"")&&X(i,l)},d(o){o&&y(e)}}}function r1(t){let e,n,l=Ce(t[0],80)+"",i;return{c(){e=c("optgroup"),n=c("option"),i=E(l),n.__value=80,n.value=n.__value,a(e,"label","Generic hardware")},m(o,u){M(o,e,u),s(e,n),s(n,i)},p(o,u){u&1&&l!==(l=Ce(o[0],80)+"")&&X(i,l)},d(o){o&&y(e)}}}function _p(t){let e,n,l,i,o,u,m,r,f=t[0]=="esp8266"&&n1(t),p=t[0]=="esp32"&&i1(t),_=t[0]=="esp32s2"&&s1(t),h=t[0]=="esp32c3"&&o1(t),v=t[0]=="esp32solo"&&a1(t),d=t[0]=="esp32s3"&&r1(t);return{c(){e=c("option"),n=b(),f&&f.c(),l=b(),p&&p.c(),i=b(),_&&_.c(),o=b(),h&&h.c(),u=b(),v&&v.c(),m=b(),d&&d.c(),r=it(),e.__value=-1,e.value=e.__value},m(g,k){M(g,e,k),M(g,n,k),f&&f.m(g,k),M(g,l,k),p&&p.m(g,k),M(g,i,k),_&&_.m(g,k),M(g,o,k),h&&h.m(g,k),M(g,u,k),v&&v.m(g,k),M(g,m,k),d&&d.m(g,k),M(g,r,k)},p(g,[k]){g[0]=="esp8266"?f?f.p(g,k):(f=n1(g),f.c(),f.m(l.parentNode,l)):f&&(f.d(1),f=null),g[0]=="esp32"?p?p.p(g,k):(p=i1(g),p.c(),p.m(i.parentNode,i)):p&&(p.d(1),p=null),g[0]=="esp32s2"?_?_.p(g,k):(_=s1(g),_.c(),_.m(o.parentNode,o)):_&&(_.d(1),_=null),g[0]=="esp32c3"?h?h.p(g,k):(h=o1(g),h.c(),h.m(u.parentNode,u)):h&&(h.d(1),h=null),g[0]=="esp32solo"?v?v.p(g,k):(v=a1(g),v.c(),v.m(m.parentNode,m)):v&&(v.d(1),v=null),g[0]=="esp32s3"?d?d.p(g,k):(d=r1(g),d.c(),d.m(r.parentNode,r)):d&&(d.d(1),d=null)},i:be,o:be,d(g){g&&y(e),g&&y(n),f&&f.d(g),g&&y(l),p&&p.d(g),g&&y(i),_&&_.d(g),g&&y(o),h&&h.d(g),g&&y(u),v&&v.d(g),g&&y(m),d&&d.d(g),g&&y(r)}}}function pp(t,e,n){let{chip:l}=e;return t.$$set=i=>{"chip"in i&&n(0,l=i.chip)},[l]}class dp extends We{constructor(e){super(),He(this,e,pp,_p,Be,{chip:0})}}function u1(t){let e;return{c(){e=c("div"),e.textContent="WARNING: Changing this configuration will affect basic configuration of your device. Only make changes here if instructed by vendor",a(e,"class","bd-red")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function f1(t){let e,n,l,i,o,u,m;return u=new mo({props:{chip:t[0].chip}}),{c(){e=c("div"),n=E("HAN GPIO"),l=c("br"),i=b(),o=c("select"),ae(u.$$.fragment),a(o,"name","vh"),a(o,"class","in-s"),a(e,"class","my-3")},m(r,f){M(r,e,f),s(e,n),s(e,l),s(e,i),s(e,o),se(u,o,null),m=!0},p(r,f){const p={};f&1&&(p.chip=r[0].chip),u.$set(p)},i(r){m||(L(u.$$.fragment,r),m=!0)},o(r){q(u.$$.fragment,r),m=!1},d(r){r&&y(e),oe(u)}}}function hp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G=t[0].usrcfg&&u1();d=new dp({props:{chip:t[0].chip}});let K=t[0].board&&t[0].board>20&&f1(t);return j=new Pt({props:{active:t[1],message:"Saving device configuration"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Initial configuration",m=b(),G&&G.c(),r=b(),f=c("div"),p=E("Board type"),_=c("br"),h=b(),v=c("select"),ae(d.$$.fragment),g=b(),K&&K.c(),k=b(),$=c("div"),N=c("label"),A=c("input"),F=E(" Clear all other configuration"),I=b(),R=c("div"),R.innerHTML='<button type="submit" class="btn-pri">Save</button>',C=b(),P=c("span"),P.textContent="\xA0",ne=b(),ae(j.$$.fragment),a(i,"type","hidden"),a(i,"name","v"),i.value="true",a(u,"class","text-sm"),a(v,"name","vb"),a(v,"class","in-s"),t[0].board===void 0&&Ze(()=>t[5].call(v)),a(f,"class","my-3"),a(A,"type","checkbox"),a(A,"name","vr"),A.__value="true",A.value=A.__value,a(A,"class","rounded mb-1"),a($,"class","my-3"),a(R,"class","my-3"),a(P,"class","clear-both"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),G&&G.m(l,null),s(l,r),s(l,f),s(f,p),s(f,_),s(f,h),s(f,v),se(d,v,null),Te(v,t[0].board,!0),s(l,g),K&&K.m(l,null),s(l,k),s(l,$),s($,N),s(N,A),A.checked=t[2],s(N,F),s(l,I),s(l,R),s(l,C),s(l,P),M(Z,ne,z),se(j,Z,z),B=!0,H||(V=[Q(v,"change",t[5]),Q(A,"change",t[6]),Q(l,"submit",ai(t[3]))],H=!0)},p(Z,[z]){Z[0].usrcfg?G||(G=u1(),G.c(),G.m(l,r)):G&&(G.d(1),G=null);const W={};z&1&&(W.chip=Z[0].chip),d.$set(W),z&1&&Te(v,Z[0].board),Z[0].board&&Z[0].board>20?K?(K.p(Z,z),z&1&&L(K,1)):(K=f1(Z),K.c(),L(K,1),K.m(l,k)):K&&($e(),q(K,1,1,()=>{K=null}),De()),z&4&&(A.checked=Z[2]);const x={};z&2&&(x.active=Z[1]),j.$set(x)},i(Z){B||(L(d.$$.fragment,Z),L(K),L(j.$$.fragment,Z),B=!0)},o(Z){q(d.$$.fragment,Z),q(K),q(j.$$.fragment,Z),B=!1},d(Z){Z&&y(e),G&&G.d(),oe(d),K&&K.d(),Z&&y(ne),oe(j,Z),H=!1,lt(V)}}}function vp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(p){n(1,o=!0);const _=new FormData(p.target),h=new URLSearchParams;for(let g of _){const[k,$]=g;h.append(k,$)}let d=await(await fetch("save",{method:"POST",body:h})).json();n(1,o=!1),Tt.update(g=>(g.vndcfg=d.success,g.booting=d.reboot,g.if.eth=g.boardType>240&&g.boardType<250,g)),mn(l+(i.usrcfg?"/":"/setup"))}let m=!1;Tt.subscribe(p=>{n(0,i=p),p.fwconsent===1&&n(2,m=!i.usrcfg)});function r(){i.board=ot(this),n(0,i)}function f(){m=this.checked,n(2,m)}return t.$$set=p=>{"basepath"in p&&n(4,l=p.basepath),"sysinfo"in p&&n(0,i=p.sysinfo)},[i,o,m,u,l,r,f]}class bp extends We{constructor(e){super(),He(this,e,vp,hp,Be,{basepath:4,sysinfo:0})}}function c1(t){let e;return{c(){e=c("option"),e.textContent="Ethernet",e.__value=3,e.value=e.__value},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function m1(t){let e,n,l,i,o,u,m,r,f,p,_,h,v;return{c(){e=c("div"),n=E("SSID"),l=c("br"),i=b(),o=c("input"),m=b(),r=c("div"),f=E("PSK"),p=c("br"),_=b(),h=c("input"),a(o,"name","ss"),a(o,"type","text"),a(o,"class","in-s"),o.required=u=t[2]==1||t[2]==2,a(e,"class","my-3"),a(h,"name","sp"),a(h,"type","password"),a(h,"class","in-s"),a(h,"autocomplete","off"),h.required=v=t[2]==2,a(r,"class","my-3")},m(d,g){M(d,e,g),s(e,n),s(e,l),s(e,i),s(e,o),M(d,m,g),M(d,r,g),s(r,f),s(r,p),s(r,_),s(r,h)},p(d,g){g&4&&u!==(u=d[2]==1||d[2]==2)&&(o.required=u),g&4&&v!==(v=d[2]==2)&&(h.required=v)},d(d){d&&y(e),d&&y(m),d&&y(r)}}}function _1(t){let e,n,l,i,o,u,m,r;return m=new M0({}),{c(){e=c("br"),n=b(),l=c("div"),i=c("input"),o=b(),u=c("select"),ae(m.$$.fragment),a(i,"name","si"),a(i,"type","text"),a(i,"class","in-f w-full"),i.required=t[1],a(u,"name","su"),a(u,"class","in-l"),u.required=t[1],a(l,"class","flex")},m(f,p){M(f,e,p),M(f,n,p),M(f,l,p),s(l,i),s(l,o),s(l,u),se(m,u,null),r=!0},p(f,p){(!r||p&2)&&(i.required=f[1]),(!r||p&2)&&(u.required=f[1])},i(f){r||(L(m.$$.fragment,f),r=!0)},o(f){q(m.$$.fragment,f),r=!1},d(f){f&&y(e),f&&y(n),f&&y(l),oe(m)}}}function p1(t){let e;return{c(){e=c("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>`,a(e,"class","my-3 flex")},m(n,l){M(n,e,l)},d(n){n&&y(e)}}}function gp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W=t[0].if&&t[0].if.eth&&c1(),x=(t[2]==1||t[2]==2)&&m1(t),_e=t[1]&&_1(t),ie=t[1]&&p1();return G=new Pt({props:{active:t[3],message:"Saving your configuration to the device"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("input"),o=b(),u=c("strong"),u.textContent="Setup",m=b(),r=c("div"),f=E("Connection"),p=c("br"),_=b(),h=c("select"),v=c("option"),v.textContent="Connect to WiFi",d=c("option"),d.textContent="Standalone access point",W&&W.c(),g=b(),x&&x.c(),k=b(),$=c("div"),N=E(`Hostname
|
|
`),A=c("input"),F=b(),I=c("div"),R=c("label"),C=c("input"),P=E(" Static IP"),ne=b(),_e&&_e.c(),j=b(),ie&&ie.c(),B=b(),H=c("div"),H.innerHTML='<button type="submit" class="btn-pri">Save</button>',V=b(),ae(G.$$.fragment),a(i,"type","hidden"),a(i,"name","s"),i.value="true",a(u,"class","text-sm"),v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,a(h,"name","sc"),a(h,"class","in-s"),t[2]===void 0&&Ze(()=>t[5].call(h)),a(r,"class","my-3"),a(A,"name","sh"),a(A,"type","text"),a(A,"class","in-s"),a(A,"maxlength","32"),a(A,"pattern","[a-z0-9_-]+"),a(A,"placeholder","Optional, ex.: ams-reader"),a(A,"autocomplete","off"),a(C,"type","checkbox"),a(C,"name","sm"),C.__value="static",C.value=C.__value,a(C,"class","rounded mb-1"),a(I,"class","my-3"),a(H,"class","my-3"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2")},m(me,Y){M(me,e,Y),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,h),s(h,v),s(h,d),W&&W.m(h,null),Te(h,t[2],!0),s(l,g),x&&x.m(l,null),s(l,k),s(l,$),s($,N),s($,A),ue(A,t[0].hostname),s(l,F),s(l,I),s(I,R),s(R,C),C.checked=t[1],s(R,P),s(I,ne),_e&&_e.m(I,null),s(l,j),ie&&ie.m(l,null),s(l,B),s(l,H),M(me,V,Y),se(G,me,Y),K=!0,Z||(z=[Q(h,"change",t[5]),Q(A,"input",t[6]),Q(C,"change",t[7]),Q(l,"submit",ai(t[4]))],Z=!0)},p(me,[Y]){me[0].if&&me[0].if.eth?W||(W=c1(),W.c(),W.m(h,null)):W&&(W.d(1),W=null),Y&4&&Te(h,me[2]),me[2]==1||me[2]==2?x?x.p(me,Y):(x=m1(me),x.c(),x.m(l,k)):x&&(x.d(1),x=null),Y&1&&A.value!==me[0].hostname&&ue(A,me[0].hostname),Y&2&&(C.checked=me[1]),me[1]?_e?(_e.p(me,Y),Y&2&&L(_e,1)):(_e=_1(me),_e.c(),L(_e,1),_e.m(I,null)):_e&&($e(),q(_e,1,1,()=>{_e=null}),De()),me[1]?ie||(ie=p1(),ie.c(),ie.m(l,B)):ie&&(ie.d(1),ie=null);const ke={};Y&8&&(ke.active=me[3]),G.$set(ke)},i(me){K||(L(_e),L(G.$$.fragment,me),K=!0)},o(me){q(_e),q(G.$$.fragment,me),K=!1},d(me){me&&y(e),W&&W.d(),x&&x.d(),_e&&_e.d(),ie&&ie.d(),me&&y(V),oe(G,me),Z=!1,lt(z)}}}function kp(t,e,n){let{sysinfo:l={}}=e,i=!1,o=1,u=!1;function m(h){Tt.update(v=>(v.trying=h,v))}async function r(h){n(3,u=!0);const v=new FormData(h.target),d=new URLSearchParams;for(let $ of v){const[N,A]=$;d.append(N,A)}let k=await(await fetch("save",{method:"POST",body:d})).json();n(3,u=!1),Tt.update($=>($.hostname=v.get("sh"),$.usrcfg=k.success,$.booting=k.reboot,i&&($.net.ip=v.get("si"),$.net.mask=v.get("su"),$.net.gw=v.get("sg"),$.net.dns1=v.get("sd")),k.reboot&&setTimeout(Ei,5e3,l,m),$))}function f(){o=ot(this),n(2,o)}function p(){l.hostname=this.value,n(0,l)}function _(){i=this.checked,n(1,i)}return t.$$set=h=>{"sysinfo"in h&&n(0,l=h.sysinfo)},[l,i,o,u,r,f,p,_]}class wp extends We{constructor(e){super(),He(this,e,kp,gp,Be,{sysinfo:0})}}function Cp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$;return d=new Pt({props:{active:t[2],message:"Uploading file, please wait"}}),{c(){e=c("div"),n=c("div"),l=c("strong"),i=E("Upload "),o=E(t[1]),u=b(),m=c("p"),m.textContent="Select a suitable file and click upload",r=b(),f=c("form"),p=c("input"),_=b(),h=c("div"),h.innerHTML='<button type="submit" class="btn-pri">Upload</button>',v=b(),ae(d.$$.fragment),a(m,"class","mb-4"),a(p,"name","file"),a(p,"type","file"),a(h,"class","w-full text-right mt-4"),a(f,"action",t[0]),a(f,"enctype","multipart/form-data"),a(f,"method","post"),a(f,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-4 lg:grid-cols-2 md:grid-cols-2")},m(N,A){M(N,e,A),s(e,n),s(n,l),s(l,i),s(l,o),s(n,u),s(n,m),s(n,r),s(n,f),s(f,p),s(f,_),s(f,h),M(N,v,A),se(d,N,A),g=!0,k||($=Q(f,"submit",t[3]),k=!0)},p(N,[A]){(!g||A&2)&&X(o,N[1]),(!g||A&1)&&a(f,"action",N[0]);const F={};A&4&&(F.active=N[2]),d.$set(F)},i(N){g||(L(d.$$.fragment,N),g=!0)},o(N){q(d.$$.fragment,N),g=!1},d(N){N&&y(e),N&&y(v),oe(d,N),k=!1,$()}}}function yp(t,e,n){let{action:l}=e,{title:i}=e,o=!1;const u=()=>n(2,o=!0);return t.$$set=m=>{"action"in m&&n(0,l=m.action),"title"in m&&n(1,i=m.title)},[l,i,o,u]}class Do extends We{constructor(e){super(),He(this,e,yp,Cp,Be,{action:0,title:1})}}function Mp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K;return H=new Pt({props:{active:t[1],message:"Saving preferences"}}),{c(){e=c("div"),n=c("div"),l=c("form"),i=c("div"),i.textContent="Various permissions we need to do stuff:",o=b(),u=c("hr"),m=b(),r=c("div"),f=E("Enable one-click upgrade? (implies data collection)"),p=c("br"),_=b(),h=c("a"),v=E("Read more"),d=c("br"),g=b(),k=c("label"),$=c("input"),A=E(" Yes"),F=c("label"),I=c("input"),C=E(" No"),P=c("br"),ne=b(),j=c("div"),j.innerHTML='<button type="submit" class="btn-pri">Save</button>',B=b(),ae(H.$$.fragment),a(h,"href",Wt("Data-collection-on-one-click-firmware-upgrade")),a(h,"target","_blank"),a(h,"class","text-blue-600 hover:text-blue-800"),a($,"type","radio"),a($,"name","sf"),$.value=1,$.checked=N=t[0].fwconsent===1,a($,"class","rounded m-2"),$.required=!0,a(I,"type","radio"),a(I,"name","sf"),I.value=2,I.checked=R=t[0].fwconsent===2,a(I,"class","rounded m-2"),I.required=!0,a(r,"class","my-3"),a(j,"class","my-3"),a(l,"autocomplete","off"),a(n,"class","cnt"),a(e,"class","grid xl:grid-cols-3 lg:grid-cols-2")},m(Z,z){M(Z,e,z),s(e,n),s(n,l),s(l,i),s(l,o),s(l,u),s(l,m),s(l,r),s(r,f),s(r,p),s(r,_),s(r,h),s(h,v),s(r,d),s(r,g),s(r,k),s(k,$),s(k,A),s(r,F),s(F,I),s(F,C),s(r,P),s(l,ne),s(l,j),M(Z,B,z),se(H,Z,z),V=!0,G||(K=Q(l,"submit",ai(t[2])),G=!0)},p(Z,[z]){(!V||z&1&&N!==(N=Z[0].fwconsent===1))&&($.checked=N),(!V||z&1&&R!==(R=Z[0].fwconsent===2))&&(I.checked=R);const W={};z&2&&(W.active=Z[1]),H.$set(W)},i(Z){V||(L(H.$$.fragment,Z),V=!0)},o(Z){q(H.$$.fragment,Z),V=!1},d(Z){Z&&y(e),Z&&y(B),oe(H,Z),G=!1,K()}}}function Sp(t,e,n){let{basepath:l="/"}=e,{sysinfo:i={}}=e,o=!1;async function u(m){n(1,o=!0);const r=new FormData(m.target),f=new URLSearchParams;for(let h of r){const[v,d]=h;f.append(v,d)}let _=await(await fetch("save",{method:"POST",body:f})).json();n(1,o=!1),Tt.update(h=>(h.fwconsent=r.sf===!0?1:r.sf===!1?2:0,h.booting=_.reboot,h)),mn(l)}return t.$$set=m=>{"basepath"in m&&n(3,l=m.basepath),"sysinfo"in m&&n(0,i=m.sysinfo)},[i,o,u,l]}class Tp extends We{constructor(e){super(),He(this,e,Sp,Mp,Be,{basepath:3,sysinfo:0})}}function d1(t,e,n){const l=t.slice();return l[23]=e[n],l[24]=e,l[25]=n,l}function h1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Np(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function v1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function Ep(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function b1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function g1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function k1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function w1(t,e,n){const l=t.slice();return l[26]=e[n],l[28]=n,l}function C1(t){let e,n,l=t[0].o,i=[];for(let u=0;u<l.length;u+=1)i[u]=P1(d1(t,l,u));const o=u=>q(i[u],1,1,()=>{i[u]=null});return{c(){for(let u=0;u<i.length;u+=1)i[u].c();e=it()},m(u,m){for(let r=0;r<i.length;r+=1)i[r]&&i[r].m(u,m);M(u,e,m),n=!0},p(u,m){if(m[0]&169){l=u[0].o;let r;for(r=0;r<l.length;r+=1){const f=d1(u,l,r);i[r]?(i[r].p(f,m),L(i[r],1)):(i[r]=P1(f),i[r].c(),L(i[r],1),i[r].m(e.parentNode,e))}for($e(),r=l.length;r<i.length;r+=1)o(r);De()}},i(u){if(!n){for(let m=0;m<l.length;m+=1)L(i[m]);n=!0}},o(u){i=i.filter(Boolean);for(let m=0;m<i.length;m+=1)q(i[m]);n=!1},d(u){mt(i,u),u&&y(e)}}}function y1(t){let e,n=t[3][t[28]]+"",l,i,o,u;function m(){return t[13](t[23],t[28],t[24],t[25])}return{c(){e=c("span"),l=E(n),a(e,"class",i=t[23].a.includes(t[28])?"bd-on":"bd-off")},m(r,f){M(r,e,f),s(e,l),o||(u=Q(e,"click",m),o=!0)},p(r,f){t=r,f[0]&1&&i!==(i=t[23].a.includes(t[28])?"bd-on":"bd-off")&&a(e,"class",i)},d(r){r&&y(e),o=!1,u()}}}function M1(t){let e,n=t[28].toString().padStart(2,"0")+"",l,i,o,u;function m(){return t[14](t[23],t[28],t[24],t[25])}return{c(){e=c("span"),l=E(n),a(e,"class",i=t[23].h.includes(t[28])?"bd-on":"bd-off")},m(r,f){M(r,e,f),s(e,l),o||(u=Q(e,"click",m),o=!0)},p(r,f){t=r,f[0]&1&&i!==(i=t[23].h.includes(t[28])?"bd-on":"bd-off")&&a(e,"class",i)},d(r){r&&y(e),o=!1,u()}}}function S1(t){let e,n=(t[28]+8).toString().padStart(2,"0")+"",l,i,o,u;function m(){return t[15](t[23],t[28],t[24],t[25])}return{c(){e=c("span"),l=E(n),a(e,"class",i=t[23].h.includes(t[28]+8)?"bd-on":"bd-off")},m(r,f){M(r,e,f),s(e,l),o||(u=Q(e,"click",m),o=!0)},p(r,f){t=r,f[0]&1&&i!==(i=t[23].h.includes(t[28]+8)?"bd-on":"bd-off")&&a(e,"class",i)},d(r){r&&y(e),o=!1,u()}}}function T1(t){let e,n=(t[28]+16).toString().padStart(2,"0")+"",l,i,o,u;function m(){return t[16](t[23],t[28],t[24],t[25])}return{c(){e=c("span"),l=E(n),a(e,"class",i=t[23].h.includes(t[28]+16)?"bd-on":"bd-off")},m(r,f){M(r,e,f),s(e,l),o||(u=Q(e,"click",m),o=!0)},p(r,f){t=r,f[0]&1&&i!==(i=t[23].h.includes(t[28]+16)?"bd-on":"bd-off")&&a(e,"class",i)},d(r){r&&y(e),o=!1,u()}}}function Pp(t){let e,n=t[28]+1+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[28]+1,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function N1(t){let e,n=Ti[t[28]]+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[28]+1,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function Ap(t){let e,n=t[28]+1+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[28]+1,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function E1(t){let e,n=Ti[t[28]]+"",l;return{c(){e=c("option"),l=E(n),e.__value=t[28]+1,e.value=e.__value},m(i,o){M(i,e,o),s(e,l)},p:be,d(i){i&&y(e)}}}function P1(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j,B,H,V,G,K,Z,z,W,x,_e,ie,me,Y,ke,Ee,we,Me,te,fe,Oe,Ie,T,w,S,D,O,J,le,pe;function ge(){t[9].call(l,t[24],t[25])}function Ae(){t[10].call(u,t[24],t[25])}function Fe(){t[11].call(_,t[24],t[25])}function ce(){t[12].call(k,t[24],t[25])}let Pe={length:7},ze=[];for(let re=0;re<Pe.length;re+=1)ze[re]=y1(w1(t,Pe,re));let _t={length:8},Ke=[];for(let re=0;re<_t.length;re+=1)Ke[re]=M1(k1(t,_t,re));let ut={length:8},Ge=[];for(let re=0;re<ut.length;re+=1)Ge[re]=S1(g1(t,ut,re));let pt={length:8},Ue=[];for(let re=0;re<pt.length;re+=1)Ue[re]=T1(b1(t,pt,re));let At={length:31},dt=[];for(let re=0;re<At.length;re+=1)dt[re]=Pp(Ep(t,At,re));function vt(){t[17].call(W,t[24],t[25])}let xe={length:12},Re=[];for(let re=0;re<xe.length;re+=1)Re[re]=N1(v1(t,xe,re));function et(){t[18].call(ie,t[24],t[25])}let Le={length:31},Je=[];for(let re=0;re<Le.length;re+=1)Je[re]=Ap(Np(t,Le,re));function at(){t[19].call(we,t[24],t[25])}let qe={length:12},ye=[];for(let re=0;re<qe.length;re+=1)ye[re]=E1(h1(t,qe,re));function ve(){t[20].call(fe,t[24],t[25])}S=new Es({});function de(){return t[21](t[25])}function Ve(){return t[22](t[25])}return{c(){e=c("div"),n=c("div"),l=c("input"),i=b(),o=c("div"),u=c("select"),m=c("option"),m.textContent="Import",r=c("option"),r.textContent="Export",f=c("option"),f.textContent="Both",p=b(),_=c("select"),h=c("option"),h.textContent="Fixed",v=c("option"),v.textContent="+",d=c("option"),d.textContent="%",g=b(),k=c("input"),$=b(),N=c("div"),A=c("span"),A.textContent="Days:",F=b(),I=c("div");for(let re=0;re<ze.length;re+=1)ze[re].c();R=b(),C=c("div"),P=c("span"),P.textContent="Hours:",ne=b(),j=c("div"),B=c("div");for(let re=0;re<Ke.length;re+=1)Ke[re].c();H=b(),V=c("div");for(let re=0;re<Ge.length;re+=1)Ge[re].c();G=b(),K=c("div");for(let re=0;re<Ue.length;re+=1)Ue[re].c();Z=b(),z=c("div"),W=c("select"),x=c("option"),x.textContent="-";for(let re=0;re<dt.length;re+=1)dt[re].c();_e=b(),ie=c("select"),me=c("option"),me.textContent="-";for(let re=0;re<Re.length;re+=1)Re[re].c();Y=b(),ke=c("input"),Ee=b(),we=c("select"),Me=c("option"),Me.textContent="-";for(let re=0;re<Je.length;re+=1)Je[re].c();te=b(),fe=c("select"),Oe=c("option"),Oe.textContent="-";for(let re=0;re<ye.length;re+=1)ye[re].c();Ie=b(),T=c("div"),w=c("span"),ae(S.$$.fragment),D=b(),O=c("hr"),a(l,"name","n"),a(l,"type","text"),a(l,"class","in-s"),a(n,"class","mr-3"),m.__value=1,m.value=m.__value,r.__value=2,r.value=r.__value,f.__value=3,f.value=f.__value,a(u,"name","rd"),a(u,"class","in-f"),t[23].d===void 0&&Ze(Ae),h.__value=0,h.value=h.__value,v.__value=1,v.value=v.__value,d.__value=2,d.value=d.__value,a(_,"name","rt"),a(_,"class","in-m"),t[23].t===void 0&&Ze(Fe),a(k,"name","rv"),a(k,"type","number"),a(k,"class","in-l tr"),Ci(k,"width","100px"),a(k,"min","0.0001"),a(k,"max","99.9999"),a(k,"step","0.0001"),a(o,"class","flex mr-3"),a(A,"class","mr-2"),a(N,"class","flex flex-wrap mr-3"),a(P,"class","mr-2"),a(C,"class","flex flex-wrap mr-3"),x.__value=0,x.value=x.__value,a(W,"name","rsm"),a(W,"class","in-f"),t[23].s.m===void 0&&Ze(vt),me.__value=0,me.value=me.__value,a(ie,"name","rsd"),a(ie,"class","in-m"),t[23].s.d===void 0&&Ze(et),a(ke,"class","in-m"),ke.disabled=!0,ke.value="to",Ci(ke,"width","20px"),Ci(ke,"color","#888"),Me.__value=0,Me.value=Me.__value,a(we,"name","rem"),a(we,"class","in-m"),t[23].e.m===void 0&&Ze(at),Oe.__value=0,Oe.value=Oe.__value,a(fe,"name","red"),a(fe,"class","in-l"),t[23].e.d===void 0&&Ze(ve),a(z,"class","flex flex-wrap mr-3"),a(w,"class","text-red-500 text-xs"),a(T,"class","mt-1.5 ml-3"),a(e,"class","flex flex-wrap"),a(O,"class","m-3")},m(re,Qe){M(re,e,Qe),s(e,n),s(n,l),ue(l,t[23].n),s(e,i),s(e,o),s(o,u),s(u,m),s(u,r),s(u,f),Te(u,t[23].d,!0),s(o,p),s(o,_),s(_,h),s(_,v),s(_,d),Te(_,t[23].t,!0),s(o,g),s(o,k),ue(k,t[23].v),s(e,$),s(e,N),s(N,A),s(N,F),s(N,I);for(let ee=0;ee<ze.length;ee+=1)ze[ee]&&ze[ee].m(I,null);s(e,R),s(e,C),s(C,P),s(C,ne),s(C,j),s(j,B);for(let ee=0;ee<Ke.length;ee+=1)Ke[ee]&&Ke[ee].m(B,null);s(j,H),s(j,V);for(let ee=0;ee<Ge.length;ee+=1)Ge[ee]&&Ge[ee].m(V,null);s(j,G),s(j,K);for(let ee=0;ee<Ue.length;ee+=1)Ue[ee]&&Ue[ee].m(K,null);s(e,Z),s(e,z),s(z,W),s(W,x);for(let ee=0;ee<dt.length;ee+=1)dt[ee]&&dt[ee].m(W,null);Te(W,t[23].s.m,!0),s(z,_e),s(z,ie),s(ie,me);for(let ee=0;ee<Re.length;ee+=1)Re[ee]&&Re[ee].m(ie,null);Te(ie,t[23].s.d,!0),s(z,Y),s(z,ke),s(z,Ee),s(z,we),s(we,Me);for(let ee=0;ee<Je.length;ee+=1)Je[ee]&&Je[ee].m(we,null);Te(we,t[23].e.m,!0),s(z,te),s(z,fe),s(fe,Oe);for(let ee=0;ee<ye.length;ee+=1)ye[ee]&&ye[ee].m(fe,null);Te(fe,t[23].e.d,!0),s(e,Ie),s(e,T),s(T,w),se(S,w,null),M(re,D,Qe),M(re,O,Qe),J=!0,le||(pe=[Q(l,"input",ge),Q(u,"change",Ae),Q(_,"change",Fe),Q(k,"input",ce),Q(W,"change",vt),Q(ie,"change",et),Q(we,"change",at),Q(fe,"change",ve),Q(w,"click",de),Q(w,"keypress",Ve)],le=!0)},p(re,Qe){if(t=re,Qe[0]&1&&l.value!==t[23].n&&ue(l,t[23].n),Qe[0]&1&&Te(u,t[23].d),Qe[0]&1&&Te(_,t[23].t),Qe[0]&1&&Se(k.value)!==t[23].v&&ue(k,t[23].v),Qe[0]&41){Pe={length:7};let ee;for(ee=0;ee<Pe.length;ee+=1){const st=w1(t,Pe,ee);ze[ee]?ze[ee].p(st,Qe):(ze[ee]=y1(st),ze[ee].c(),ze[ee].m(I,null))}for(;ee<ze.length;ee+=1)ze[ee].d(1);ze.length=Pe.length}if(Qe[0]&33){_t={length:8};let ee;for(ee=0;ee<_t.length;ee+=1){const st=k1(t,_t,ee);Ke[ee]?Ke[ee].p(st,Qe):(Ke[ee]=M1(st),Ke[ee].c(),Ke[ee].m(B,null))}for(;ee<Ke.length;ee+=1)Ke[ee].d(1);Ke.length=_t.length}if(Qe[0]&33){ut={length:8};let ee;for(ee=0;ee<ut.length;ee+=1){const st=g1(t,ut,ee);Ge[ee]?Ge[ee].p(st,Qe):(Ge[ee]=S1(st),Ge[ee].c(),Ge[ee].m(V,null))}for(;ee<Ge.length;ee+=1)Ge[ee].d(1);Ge.length=ut.length}if(Qe[0]&33){pt={length:8};let ee;for(ee=0;ee<pt.length;ee+=1){const st=b1(t,pt,ee);Ue[ee]?Ue[ee].p(st,Qe):(Ue[ee]=T1(st),Ue[ee].c(),Ue[ee].m(K,null))}for(;ee<Ue.length;ee+=1)Ue[ee].d(1);Ue.length=pt.length}if(Qe[0]&1&&Te(W,t[23].s.m),Qe&0){xe={length:12};let ee;for(ee=0;ee<xe.length;ee+=1){const st=v1(t,xe,ee);Re[ee]?Re[ee].p(st,Qe):(Re[ee]=N1(st),Re[ee].c(),Re[ee].m(ie,null))}for(;ee<Re.length;ee+=1)Re[ee].d(1);Re.length=xe.length}if(Qe[0]&1&&Te(ie,t[23].s.d),Qe[0]&1&&Te(we,t[23].e.m),Qe&0){qe={length:12};let ee;for(ee=0;ee<qe.length;ee+=1){const st=h1(t,qe,ee);ye[ee]?ye[ee].p(st,Qe):(ye[ee]=E1(st),ye[ee].c(),ye[ee].m(fe,null))}for(;ee<ye.length;ee+=1)ye[ee].d(1);ye.length=qe.length}Qe[0]&1&&Te(fe,t[23].e.d)},i(re){J||(L(S.$$.fragment,re),J=!0)},o(re){q(S.$$.fragment,re),J=!1},d(re){re&&y(e),mt(ze,re),mt(Ke,re),mt(Ge,re),mt(Ue,re),mt(dt,re),mt(Re,re),mt(Je,re),mt(ye,re),oe(S),re&&y(D),re&&y(O),le=!1,lt(pe)}}}function $p(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R,C,P,ne,j;o=new Ht({});let B=t[0].o&&C1(t);return I=new Pt({props:{active:t[1],message:"Loading configuration"}}),C=new Pt({props:{active:t[2],message:"Saving configuration"}}),{c(){e=c("div"),n=c("strong"),n.textContent="Price configuration",l=b(),i=c("a"),ae(o.$$.fragment),u=b(),m=c("hr"),r=b(),f=c("form"),p=c("input"),_=b(),B&&B.c(),h=b(),v=c("div"),d=c("div"),g=c("button"),g.textContent="Add",k=b(),$=c("div"),N=b(),A=c("div"),A.innerHTML='<button type="submit" class="btn-pri">Save</button>',F=b(),ae(I.$$.fragment),R=b(),ae(C.$$.fragment),a(n,"class","text-sm"),a(i,"href",Wt("Price-configuration")),a(i,"target","_blank"),a(i,"class","float-right"),a(m,"class","m-3"),a(p,"type","hidden"),a(p,"name","r"),p.value="true",a(g,"type","button"),a(g,"class","btn-pri"),a($,"class","text-center"),a(A,"class","text-right"),a(v,"class","grid grid-cols-3"),a(f,"autocomplete","off"),a(e,"class","cnt")},m(H,V){M(H,e,V),s(e,n),s(e,l),s(e,i),se(o,i,null),s(e,u),s(e,m),s(e,r),s(e,f),s(f,p),s(f,_),B&&B.m(f,null),s(f,h),s(f,v),s(v,d),s(d,g),s(v,k),s(v,$),s(v,N),s(v,A),M(H,F,V),se(I,H,V),M(H,R,V),se(C,H,V),P=!0,ne||(j=[Q(g,"click",t[6]),Q(f,"submit",ai(t[4]))],ne=!0)},p(H,V){H[0].o?B?(B.p(H,V),V[0]&1&&L(B,1)):(B=C1(H),B.c(),L(B,1),B.m(f,h)):B&&($e(),q(B,1,1,()=>{B=null}),De());const G={};V[0]&2&&(G.active=H[1]),I.$set(G);const K={};V[0]&4&&(K.active=H[2]),C.$set(K)},i(H){P||(L(o.$$.fragment,H),L(B),L(I.$$.fragment,H),L(C.$$.fragment,H),P=!0)},o(H){q(o.$$.fragment,H),q(B),q(I.$$.fragment,H),q(C.$$.fragment,H),P=!1},d(H){H&&y(e),oe(o),B&&B.d(),H&&y(F),oe(I,H),H&&y(R),oe(C,H),ne=!1,lt(j)}}}function Dp(t,e,n){let{basepath:l="/"}=e,i=["mo","tu","we","th","fr","sa","su"],o={},u=!0,m=!1;y0.subscribe(j=>{j.o&&(n(0,o=j),n(1,u=!1))}),v_();async function r(j){n(2,m=!0);const B=new URLSearchParams;B.append("r","true"),B.append("rc",o.o.length),o.o.forEach(function(V,G){B.append("rt"+G,V.t),B.append("rn"+G,V.n),B.append("rd"+G,V.d),B.append("ra"+G,V.a),B.append("rh"+G,V.h),B.append("rv"+G,V.v),B.append("rsm"+G,V.s.m),B.append("rsd"+G,V.s.d),B.append("rem"+G,V.e.m),B.append("red"+G,V.e.d)}),await(await fetch("save",{method:"POST",body:B})).json(),n(2,m=!1),mn(l+"configuration")}let f=function(j,B){return j.includes(B)?j=j.filter(function(H){return H!==B}):j.push(B),j},p=function(){let j=o.o;j.push({t:1,n:"",d:3,a:[0,1,2,3,4,5,6,7],h:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23],v:.001,s:{m:0,d:0},e:{m:0,d:0}}),n(0,o.o=j,o)},_=function(j){let B=o.o;B.splice(j,1),n(0,o.o=B,o)};function h(j,B){j[B].n=this.value,n(0,o)}function v(j,B){j[B].d=ot(this),n(0,o)}function d(j,B){j[B].t=ot(this),n(0,o)}function g(j,B){j[B].v=Se(this.value),n(0,o)}const k=(j,B,H,V)=>n(0,H[V].a=f(j.a,B),o),$=(j,B,H,V)=>n(0,H[V].h=f(j.h,B),o),N=(j,B,H,V)=>n(0,H[V].h=f(j.h,B+8),o),A=(j,B,H,V)=>n(0,H[V].h=f(j.h,B+16),o);function F(j,B){j[B].s.m=ot(this),n(0,o)}function I(j,B){j[B].s.d=ot(this),n(0,o)}function R(j,B){j[B].e.m=ot(this),n(0,o)}function C(j,B){j[B].e.d=ot(this),n(0,o)}const P=j=>_(j),ne=j=>_(j);return t.$$set=j=>{"basepath"in j&&n(8,l=j.basepath)},[o,u,m,i,r,f,p,_,l,h,v,d,g,k,$,N,A,F,I,R,C,P,ne]}class Lp extends We{constructor(e){super(),He(this,e,Dp,$p,Be,{basepath:8},null,[-1,-1])}}function Ip(t){let e,n;return e=new d_({props:{data:t[2],sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&4&&(o.data=l[2]),i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Rp(t){let e,n;return e=new ep({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Fp(t){let e,n;return e=new Lp({props:{basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Op(t){let e,n;return e=new mp({props:{sysinfo:t[1],data:t[2]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&4&&(o.data=l[2]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function qp(t){let e,n;return e=new Do({props:{title:"CA",action:"/mqtt-ca"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Bp(t){let e,n;return e=new Do({props:{title:"certificate",action:"/mqtt-cert"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Up(t){let e,n;return e=new Do({props:{title:"private key",action:"/mqtt-key"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function jp(t){let e,n;return e=new Tp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Hp(t){let e,n;return e=new wp({props:{sysinfo:t[1]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Wp(t){let e,n;return e=new bp({props:{sysinfo:t[1],basepath:t[0]}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.sysinfo=l[1]),i&1&&(o.basepath=l[0]),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function zp(t){let e,n,l,i,o,u,m,r,f,p,_,h,v,d,g,k,$,N,A,F,I,R;return e=new Tm({props:{data:t[2],basepath:t[0]}}),l=new bl({props:{path:"/",$$slots:{default:[Ip]},$$scope:{ctx:t}}}),o=new bl({props:{path:"/configuration",$$slots:{default:[Rp]},$$scope:{ctx:t}}}),m=new bl({props:{path:"/priceconfig",$$slots:{default:[Fp]},$$scope:{ctx:t}}}),f=new bl({props:{path:"/status",$$slots:{default:[Op]},$$scope:{ctx:t}}}),_=new bl({props:{path:"/mqtt-ca",$$slots:{default:[qp]},$$scope:{ctx:t}}}),v=new bl({props:{path:"/mqtt-cert",$$slots:{default:[Bp]},$$scope:{ctx:t}}}),g=new bl({props:{path:"/mqtt-key",$$slots:{default:[Up]},$$scope:{ctx:t}}}),$=new bl({props:{path:"/consent",$$slots:{default:[jp]},$$scope:{ctx:t}}}),A=new bl({props:{path:"/setup",$$slots:{default:[Hp]},$$scope:{ctx:t}}}),I=new bl({props:{path:"/vendor",$$slots:{default:[Wp]},$$scope:{ctx:t}}}),{c(){ae(e.$$.fragment),n=b(),ae(l.$$.fragment),i=b(),ae(o.$$.fragment),u=b(),ae(m.$$.fragment),r=b(),ae(f.$$.fragment),p=b(),ae(_.$$.fragment),h=b(),ae(v.$$.fragment),d=b(),ae(g.$$.fragment),k=b(),ae($.$$.fragment),N=b(),ae(A.$$.fragment),F=b(),ae(I.$$.fragment)},m(C,P){se(e,C,P),M(C,n,P),se(l,C,P),M(C,i,P),se(o,C,P),M(C,u,P),se(m,C,P),M(C,r,P),se(f,C,P),M(C,p,P),se(_,C,P),M(C,h,P),se(v,C,P),M(C,d,P),se(g,C,P),M(C,k,P),se($,C,P),M(C,N,P),se(A,C,P),M(C,F,P),se(I,C,P),R=!0},p(C,P){const ne={};P&4&&(ne.data=C[2]),P&1&&(ne.basepath=C[0]),e.$set(ne);const j={};P&14&&(j.$$scope={dirty:P,ctx:C}),l.$set(j);const B={};P&11&&(B.$$scope={dirty:P,ctx:C}),o.$set(B);const H={};P&9&&(H.$$scope={dirty:P,ctx:C}),m.$set(H);const V={};P&14&&(V.$$scope={dirty:P,ctx:C}),f.$set(V);const G={};P&8&&(G.$$scope={dirty:P,ctx:C}),_.$set(G);const K={};P&8&&(K.$$scope={dirty:P,ctx:C}),v.$set(K);const Z={};P&8&&(Z.$$scope={dirty:P,ctx:C}),g.$set(Z);const z={};P&11&&(z.$$scope={dirty:P,ctx:C}),$.$set(z);const W={};P&10&&(W.$$scope={dirty:P,ctx:C}),A.$set(W);const x={};P&11&&(x.$$scope={dirty:P,ctx:C}),I.$set(x)},i(C){R||(L(e.$$.fragment,C),L(l.$$.fragment,C),L(o.$$.fragment,C),L(m.$$.fragment,C),L(f.$$.fragment,C),L(_.$$.fragment,C),L(v.$$.fragment,C),L(g.$$.fragment,C),L($.$$.fragment,C),L(A.$$.fragment,C),L(I.$$.fragment,C),R=!0)},o(C){q(e.$$.fragment,C),q(l.$$.fragment,C),q(o.$$.fragment,C),q(m.$$.fragment,C),q(f.$$.fragment,C),q(_.$$.fragment,C),q(v.$$.fragment,C),q(g.$$.fragment,C),q($.$$.fragment,C),q(A.$$.fragment,C),q(I.$$.fragment,C),R=!1},d(C){oe(e,C),C&&y(n),oe(l,C),C&&y(i),oe(o,C),C&&y(u),oe(m,C),C&&y(r),oe(f,C),C&&y(p),oe(_,C),C&&y(h),oe(v,C),C&&y(d),oe(g,C),C&&y(k),oe($,C),C&&y(N),oe(A,C),C&&y(F),oe(I,C)}}}function Gp(t){let e,n,l,i;const o=[Yp,Kp],u=[];function m(r,f){return r[1].trying?0:1}return e=m(t),n=u[e]=o[e](t),{c(){n.c(),l=it()},m(r,f){u[e].m(r,f),M(r,l,f),i=!0},p(r,f){let p=e;e=m(r),e===p?u[e].p(r,f):($e(),q(u[p],1,1,()=>{u[p]=null}),De(),n=u[e],n?n.p(r,f):(n=u[e]=o[e](r),n.c()),L(n,1),n.m(l.parentNode,l))},i(r){i||(L(n),i=!0)},o(r){q(n),i=!1},d(r){u[e].d(r),r&&y(l)}}}function Vp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is upgrading, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Kp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is booting, please wait"}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p:be,i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Yp(t){let e,n;return e=new Pt({props:{active:"true",message:"Device is booting, please wait. Trying to reach it on "+t[1].trying}}),{c(){ae(e.$$.fragment)},m(l,i){se(e,l,i),n=!0},p(l,i){const o={};i&2&&(o.message="Device is booting, please wait. Trying to reach it on "+l[1].trying),e.$set(o)},i(l){n||(L(e.$$.fragment,l),n=!0)},o(l){q(e.$$.fragment,l),n=!1},d(l){oe(e,l)}}}function Qp(t){let e,n,l,i,o,u;n=new n0({props:{basepath:t[0],$$slots:{default:[zp]},$$scope:{ctx:t}}});const m=[Vp,Gp],r=[];function f(p,_){return p[1].upgrading?0:p[1].booting?1:-1}return~(i=f(t))&&(o=r[i]=m[i](t)),{c(){e=c("div"),ae(n.$$.fragment),l=b(),o&&o.c(),a(e,"class","container mx-auto m-3")},m(p,_){M(p,e,_),se(n,e,null),s(e,l),~i&&r[i].m(e,null),u=!0},p(p,[_]){const h={};_&1&&(h.basepath=p[0]),_&15&&(h.$$scope={dirty:_,ctx:p}),n.$set(h);let v=i;i=f(p),i===v?~i&&r[i].p(p,_):(o&&($e(),q(r[v],1,1,()=>{r[v]=null}),De()),~i?(o=r[i],o?o.p(p,_):(o=r[i]=m[i](p),o.c()),L(o,1),o.m(e,null)):o=null)},i(p){u||(L(n.$$.fragment,p),L(o),u=!0)},o(p){q(n.$$.fragment,p),q(o),u=!1},d(p){p&&y(e),oe(n),~i&&r[i].d()}}}function Xp(t,e,n){let l=document.getElementsByTagName("base")[0].getAttribute("href");l||(l="/");let i={};Tt.subscribe(u=>{n(1,i=u),i.vndcfg===!1?mn(l+"vendor"):i.usrcfg===!1?mn(l+"setup"):i.fwconsent===0&&mn(l+"consent"),i.ui.k===1?(console.log("dark"),document.documentElement.classList.add("dark")):i.ui.k===0?(console.log("light"),document.documentElement.classList.remove("dark")):window.matchMedia("(prefers-color-scheme: dark)").matches?(console.log("dark auto"),document.documentElement.classList.add("dark")):(console.log("light auto"),document.documentElement.classList.remove("dark"))}),To();let o={};return r0.subscribe(u=>{n(2,o=u)}),[l,i,o]}class Zp extends We{constructor(e){super(),He(this,e,Xp,Qp,Be,{})}}new Zp({target:document.getElementById("app")});
|