Files
IoTManager/data_svelte/build/bundle.js
2022-02-09 21:55:17 +01:00

3 lines
71 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function s(t){t.forEach(e)}function l(t){return"function"==typeof t}function r(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function o(e,n,s){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const s=e.subscribe(...n);return s.unsubscribe?()=>s.unsubscribe():s}(n,s))}function c(t,e,n,s){if(t){const l=i(t,e,n,s);return t[0](l)}}function i(t,e,n,s){return t[1]&&s?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](s(e))):n.ctx}function a(t,e,n,s){if(t[2]&&s){const l=t[2](s(n));if(void 0===e.dirty)return l;if("object"==typeof l){const t=[],n=Math.max(e.dirty.length,l.length);for(let s=0;s<n;s+=1)t[s]=e.dirty[s]|l[s];return t}return e.dirty|l}return e.dirty}function u(t,e,n,s,l,r){if(l){const o=i(e,n,s,r);t.p(o,l)}}function d(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let t=0;t<n;t++)e[t]=-1;return e}return-1}function p(t,e){t.appendChild(e)}function f(t,e,n){t.insertBefore(e,n||null)}function g(t){t.parentNode.removeChild(t)}function m(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function $(t){return document.createElement(t)}function h(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function w(t){return document.createTextNode(t)}function b(){return w(" ")}function v(){return w("")}function x(t,e,n,s){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n,s)}function y(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function k(t){return""===t?null:+t}function _(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function J(t,e){t.value=null==e?"":e}function j(t,e){for(let n=0;n<t.options.length;n+=1){const s=t.options[n];if(s.__value===e)return void(s.selected=!0)}t.selectedIndex=-1}function S(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let C;function L(t){C=t}function E(){if(!C)throw new Error("Function called outside component initialization");return C}function T(t){E().$$.on_mount.push(t)}function O(t){return E().$$.context.get(t)}const H=[],N=[],M=[],P=[],q=Promise.resolve();let A=!1;function B(){A||(A=!0,q.then(I))}function z(){return B(),q}function D(t){M.push(t)}function F(t){P.push(t)}const R=new Set;let W=0;function I(){const t=C;do{for(;W<H.length;){const t=H[W];W++,L(t),Y(t.$$)}for(L(null),H.length=0,W=0;N.length;)N.pop()();for(let t=0;t<M.length;t+=1){const e=M[t];R.has(e)||(R.add(e),e())}M.length=0}while(H.length);for(;P.length;)P.pop()();A=!1,R.clear(),L(t)}function Y(t){if(null!==t.fragment){t.update(),s(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(D)}}const K=new Set;let U;function Q(){U={r:0,c:[],p:U}}function Z(){U.r||s(U.c),U=U.p}function G(t,e){t&&t.i&&(K.delete(t),t.i(e))}function V(t,e,n,s){if(t&&t.o){if(K.has(t))return;K.add(t),U.c.push((()=>{K.delete(t),s&&(n&&t.d(1),s())})),t.o(e)}}function X(t,e,n){const s=t.$$.props[e];void 0!==s&&(t.$$.bound[s]=n,n(t.$$.ctx[s]))}function tt(t){t&&t.c()}function et(t,n,r,o){const{fragment:c,on_mount:i,on_destroy:a,after_update:u}=t.$$;c&&c.m(n,r),o||D((()=>{const n=i.map(e).filter(l);a?a.push(...n):s(n),t.$$.on_mount=[]})),u.forEach(D)}function nt(t,e){const n=t.$$;null!==n.fragment&&(s(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function st(e,l,r,o,c,i,a,u=[-1]){const d=C;L(e);const p=e.$$={fragment:null,ctx:null,props:i,update:t,not_equal:c,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(l.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:l.target||d.$$.root};a&&a(p.root);let f=!1;if(p.ctx=r?r(e,l.props||{},((t,n,...s)=>{const l=s.length?s[0]:n;return p.ctx&&c(p.ctx[t],p.ctx[t]=l)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](l),f&&function(t,e){-1===t.$$.dirty[0]&&(H.push(t),B(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(e,t)),n})):[],p.update(),f=!0,s(p.before_update),p.fragment=!!o&&o(p.ctx),l.target){if(l.hydrate){const t=function(t){return Array.from(t.childNodes)}(l.target);p.fragment&&p.fragment.l(t),t.forEach(g)}else p.fragment&&p.fragment.c();l.intro&&G(e.$$.fragment),et(e,l.target,l.anchor,l.customElement),I()}L(d)}class lt{$destroy(){nt(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const rt=[];function ot(e,n=t){let s;const l=new Set;function o(t){if(r(e,t)&&(e=t,s)){const t=!rt.length;for(const t of l)t[1](),rt.push(t,e);if(t){for(let t=0;t<rt.length;t+=2)rt[t][0](rt[t+1]);rt.length=0}}}return{set:o,update:function(t){o(t(e))},subscribe:function(r,c=t){const i=[r,c];return l.add(i),1===l.size&&(s=n(o)||t),r(e),()=>{l.delete(i),0===l.size&&(s(),s=null)}}}}function ct(t,e=!1){return(t=t.slice(t.startsWith("/#")?2:0,t.endsWith("/*")?-2:void 0)).startsWith("/")||(t="/"+t),"/"===t&&(t=""),e&&!t.endsWith("/")&&(t+="/"),t}function it(t,e,n){if(""===n)return t;if("/"===n[0])return n;let s=t=>t.split("/").filter((t=>""!==t)),l=s(t);return"/"+(e?s(e):[]).map(((t,e)=>l[e])).join("/")+"/"+n}function at(t,e,n,s){let l=[e,"data-"+e].reduce(((e,s)=>{let l=t.getAttribute(s);return n&&t.removeAttribute(s),null===l?e:l}),!1);return!s&&""===l||(l||s||!1)}function ut(t){let e=t.split("&").map((t=>t.split("="))).reduce(((t,e)=>{let n=e[0];if(!n)return t;let s=!(e.length>1)||e[e.length-1];return"string"==typeof s&&s.includes(",")&&(s=s.split(",")),void 0===t[n]?t[n]=[s]:t[n].push(s),t}),{});return Object.entries(e).reduce(((t,e)=>(t[e[0]]=e[1].length>1?e[1]:e[1][0],t)),{})}var dt,pt,ft={HISTORY:1,HASH:2,MEMORY:3,OFF:4,run:function(t,e,n,s){return 1===t?e&&e():2===t?n&&n():s&&s()},getDeafault:function(){return window&&"srcdoc"!==window.location.pathname?1:3}},gt=function(){let t,e=ft.getDeafault(),n=n=>t&&t(mt(e));function s(t){t&&(e=t),window.onhashchange=window.onpopstate=pt=null,e!==ft.OFF&&ft.run(e,(t=>window.onpopstate=n),(t=>window.onhashchange=n))&&n()}return{mode:t=>s(t),get:t=>mt(e),go(t,s){(function(t,e,n){let s=t=>history[n?"replaceState":"pushState"]({},"",t);ft.run(t,(t=>s(e)),(t=>s(`#${e}`)),(t=>pt=e))})(e,t,s),n()},start(e){t=e,s()},stop(){t=null,s(ft.OFF)}}}();function mt(t){let e=dt,n=dt=ft.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>pt||"/")),s=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:s[1]||"",query:ut(s[2]||""),hash:s[3]||""}}function $t(t){let e=O("tinro");e&&(e.exact||e.fallback)&&function(t){throw new Error("[Tinro] "+t)}(`${t.fallback?"<Route fallback>":`<Route path="${t.path}">`} can't be inside ${e.fallback?"<Route fallback>":`<Route path="${e.path||"/"}"> with exact path`}`);let n=t.fallback?"fallbacks":"childs",s=ot({}),l={router:{},exact:!1,pattern:null,meta:{},parent:e,fallback:t.fallback,redirect:!1,firstmatch:!1,breadcrumb:null,matched:!1,childs:new Set,activeChilds:new Set,fallbacks:new Set,update(t){l.exact=!t.path.endsWith("/*"),l.pattern=ct(`${l.parent&&l.parent.pattern||""}${t.path}`),l.redirect=t.redirect,l.firstmatch=t.firstmatch,l.breadcrumb=t.breadcrumb,l.match()},register:()=>{if(l.parent)return l.parent[n].add(l),()=>{l.parent[n].delete(l),l.router.un&&l.router.un()}},show:()=>{t.onShow(),!l.fallback&&l.parent&&l.parent.activeChilds.add(l)},hide:()=>{t.onHide(),!l.fallback&&l.parent&&l.parent.activeChilds.delete(l)},match:async()=>{l.matched=!1;let{path:e,url:n,from:r,query:o}=l.router,c=function(t,e){t=ct(t,!0),e=ct(e,!0);let n=[],s={},l=!0,r=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),o=e.match(new RegExp(`^${r}$`));return o||(l=!1,o=e.match(new RegExp(`^${r}`))),o?(n.forEach(((t,e)=>s[t]=o[e+1])),{exact:l,params:s,part:o[0].slice(0,-1)}):null}(l.pattern,e);if(!l.fallback&&c&&l.redirect&&(!l.exact||l.exact&&c.exact)){await z();let t=it(e,l.parent&&l.parent.pattern,l.redirect);return wt.goto(t,!0)}if(l.meta=c&&{from:r,url:n,query:o,match:c.part,pattern:l.pattern,breadcrumbs:l.parent&&l.parent.meta&&l.parent.meta.breadcrumbs.slice()||[],params:c.params,subscribe:s.subscribe},l.breadcrumb&&l.meta&&l.meta.breadcrumbs.push({name:l.breadcrumb,path:c.part}),s.set(l.meta),!c||l.fallback||!(!l.exact||l.exact&&c.exact)||l.parent&&l.parent.firstmatch&&l.parent.matched?l.hide():(t.onMeta(l.meta),l.parent&&(l.parent.matched=!0),l.show()),await z(),c&&!l.fallback&&(l.childs.size>0&&0==l.activeChilds.size||0==l.childs.size&&l.fallbacks.size>0)){let t=l;for(;0==t.fallbacks.size;)if(t=t.parent,!t)return;t&&t.fallbacks.forEach((t=>{if(t.redirect){let e=it("/",t.parent&&t.parent.pattern,t.redirect);wt.goto(e,!0)}else t.show()}))}}};return r="tinro",o=l,E().$$.context.set(r,o),T((()=>l.register())),l.router.un=wt.subscribe((t=>{l.router.path=t.path,l.router.url=t.url,l.router.query=t.query,l.router.from=t.from,null!==l.pattern&&l.match()})),l;var r,o}function ht(){return O("tinro").meta}var wt=function(){let{subscribe:t}=ot(gt.get(),(t=>{gt.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),s=n&&at(n,"target",!1,"_self"),l=n&&at(n,"tinro-ignore"),r=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==s&&!l&&!r&&n){let s=n.getAttribute("href").replace(/^\/#/,"");/^\/\/|^[a-zA-Z]+:/.test(s)||(e.preventDefault(),t(s.startsWith("/")?s:n.href.replace(window.location.origin,"")))}};return addEventListener("click",e),()=>removeEventListener("click",e)}(gt.go);return()=>{gt.stop(),e()}}));return{subscribe:t,goto:gt.go,params:bt,meta:ht,useHashNavigation:t=>gt.mode(t?ft.HASH:ft.HISTORY),mode:{hash:()=>gt.mode(ft.HASH),history:()=>gt.mode(ft.HISTORY),memory:()=>gt.mode(ft.MEMORY)}}}();function bt(){return O("tinro").meta.params}const vt=t=>({params:2&t,meta:4&t}),xt=t=>({params:t[1],meta:t[2]});function yt(t){let e;const n=t[9].default,s=c(n,t,t[8],xt);return{c(){s&&s.c()},m(t,n){s&&s.m(t,n),e=!0},p(t,l){s&&s.p&&(!e||262&l)&&u(s,n,t,t[8],e?a(n,t[8],l,vt):d(t[8]),xt)},i(t){e||(G(s,t),e=!0)},o(t){V(s,t),e=!1},d(t){s&&s.d(t)}}}function kt(t){let e,n,s=t[0]&&yt(t);return{c(){s&&s.c(),e=v()},m(t,l){s&&s.m(t,l),f(t,e,l),n=!0},p(t,[n]){t[0]?s?(s.p(t,n),1&n&&G(s,1)):(s=yt(t),s.c(),G(s,1),s.m(e.parentNode,e)):s&&(Q(),V(s,1,1,(()=>{s=null})),Z())},i(t){n||(G(s),n=!0)},o(t){V(s),n=!1},d(t){s&&s.d(t),t&&g(e)}}}function _t(t,e,n){let{$$slots:s={},$$scope:l}=e,{path:r="/*"}=e,{fallback:o=!1}=e,{redirect:c=!1}=e,{firstmatch:i=!1}=e,{breadcrumb:a=null}=e,u=!1,d={},p={};const f=$t({fallback:o,onShow(){n(0,u=!0)},onHide(){n(0,u=!1)},onMeta(t){n(2,p=t),n(1,d=p.params)}});return t.$$set=t=>{"path"in t&&n(3,r=t.path),"fallback"in t&&n(4,o=t.fallback),"redirect"in t&&n(5,c=t.redirect),"firstmatch"in t&&n(6,i=t.firstmatch),"breadcrumb"in t&&n(7,a=t.breadcrumb),"$$scope"in t&&n(8,l=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&f.update({path:r,redirect:c,firstmatch:i,breadcrumb:a})},[u,d,p,r,o,c,i,a,l,s]}class Jt extends lt{constructor(t){super(),st(this,t,_t,kt,r,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function jt(e){let n,s,r,o,c;return{c(){n=h("svg"),s=h("line"),r=h("line"),y(s,"x1","18"),y(s,"y1","6"),y(s,"x2","6"),y(s,"y2","18"),y(r,"x1","6"),y(r,"y1","6"),y(r,"x2","18"),y(r,"y2","18"),y(n,"class","h-6 w-6 text-red-400 cursor-pointer"),y(n,"viewBox","0 0 24 24"),y(n,"fill","none"),y(n,"stroke","currentColor"),y(n,"stroke-width","2"),y(n,"stroke-linecap","round"),y(n,"stroke-linejoin","round")},m(t,i){f(t,n,i),p(n,s),p(n,r),o||(c=x(n,"click",(function(){l(e[0]())&&e[0]().apply(this,arguments)})),o=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&g(n),o=!1,c()}}}function St(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class Ct extends lt{constructor(t){super(),st(this,t,St,jt,r,{click:0})}}function Lt(t){let e,n,s,l,r,o,c,i=t[1]&&Et(t);return{c(){e=$("div"),n=$("div"),s=$("h1"),l=w(t[0]),r=b(),o=$("div"),i&&i.c(),y(s,"class","alm-hdr"),y(n,"class","w-11/12"),y(o,"class","flex justify-end w-1/12"),y(e,"class","flex items-center")},m(t,a){f(t,e,a),p(e,n),p(n,s),p(s,l),p(e,r),p(e,o),i&&i.m(o,null),c=!0},p(t,e){(!c||1&e)&&_(l,t[0]),t[1]?i?(i.p(t,e),2&e&&G(i,1)):(i=Et(t),i.c(),G(i,1),i.m(o,null)):i&&(Q(),V(i,1,1,(()=>{i=null})),Z())},i(t){c||(G(i),c=!0)},o(t){V(i),c=!1},d(t){t&&g(e),i&&i.d()}}}function Et(t){let e,n;return e=new Ct({props:{click:t[5]}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};4&n&&(s.click=t[5]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function Tt(t){let e,n,s,l=t[0]&&Lt(t);const r=t[4].default,o=c(r,t,t[3],null);return{c(){e=$("div"),l&&l.c(),n=b(),o&&o.c(),y(e,"class","alm")},m(t,r){f(t,e,r),l&&l.m(e,null),p(e,n),o&&o.m(e,null),s=!0},p(t,[c]){t[0]?l?(l.p(t,c),1&c&&G(l,1)):(l=Lt(t),l.c(),G(l,1),l.m(e,n)):l&&(Q(),V(l,1,1,(()=>{l=null})),Z()),o&&o.p&&(!s||8&c)&&u(o,r,t,t[3],s?a(r,t[3],c,null):d(t[3]),null)},i(t){s||(G(l),G(o,t),s=!0)},o(t){V(l),V(o,t),s=!1},d(t){t&&g(e),l&&l.d(),o&&o.d(t)}}}function Ot(t,e,n){let{$$slots:s={},$$scope:l}=e,{title:r}=e,{showCloseBtn:o=!0}=e,{close:c=(()=>{})}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"showCloseBtn"in t&&n(1,o=t.showCloseBtn),"close"in t&&n(2,c=t.close),"$$scope"in t&&n(3,l=t.$$scope)},[r,o,c,l,s,()=>c()]}class Ht extends lt{constructor(t){super(),st(this,t,Ot,Tt,r,{title:0,showCloseBtn:1,close:2})}}function Nt(e){let n;return{c(){n=$("div"),n.innerHTML='<div class="fixed inset-0 bg-gray-200 bg-opacity-75 transition-opacity" aria-hidden="true"></div> \n <div class="flex h-screen justify-center items-center"><div class="m-auto"><div style="border-top-color:transparent" class="w-20 h-20 border-4 border-blue-400 border-solid rounded-full animate-spin"></div></div></div>',y(n,"class","z-50")},m(t,e){f(t,n,e)},p:t,i:t,o:t,d(t){t&&g(n)}}}class Mt extends lt{constructor(t){super(),st(this,t,null,Nt,r,{})}}function Pt(t){let e,n;return{c(){e=$("h1"),n=w(t[0]),y(e,"class","crd-hdr")},m(t,s){f(t,e,s),p(e,n)},p(t,e){1&e&&_(n,t[0])},d(t){t&&g(e)}}}function qt(t){let e,n,s,l=t[0]&&Pt(t);const r=t[2].default,o=c(r,t,t[1],null);return{c(){e=$("div"),l&&l.c(),n=b(),o&&o.c(),y(e,"class","crd")},m(t,r){f(t,e,r),l&&l.m(e,null),p(e,n),o&&o.m(e,null),s=!0},p(t,[c]){t[0]?l?l.p(t,c):(l=Pt(t),l.c(),l.m(e,n)):l&&(l.d(1),l=null),o&&o.p&&(!s||2&c)&&u(o,r,t,t[1],s?a(r,t[1],c,null):d(t[1]),null)},i(t){s||(G(o,t),s=!0)},o(t){V(o,t),s=!1},d(t){t&&g(e),l&&l.d(),o&&o.d(t)}}}function At(t,e,n){let{$$slots:s={},$$scope:l}=e,{title:r}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"$$scope"in t&&n(1,l=t.$$scope)},[r,l,s]}class Bt extends lt{constructor(t){super(),st(this,t,At,qt,r,{title:0})}}function zt(t){let e,n,l,r;return{c(){e=$("input"),y(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),y(e,"step","0.1"),y(e,"type","number")},m(n,s){f(n,e,s),J(e,t[0].status),l||(r=[x(e,"change",t[3]),x(e,"input",t[4])],l=!0)},p(t,s){1&s&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&y(e,"class",n),1&s&&k(e.value)!==t[0].status&&J(e,t[0].status)},d(t){t&&g(e),l=!1,s(r)}}}function Dt(t){let e,n,l,r;return{c(){e=$("input"),y(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),y(e,"type","text")},m(n,s){f(n,e,s),J(e,t[0].status),l||(r=[x(e,"change",t[5]),x(e,"input",t[6])],l=!0)},p(t,s){1&s&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&y(e,"class",n),1&s&&e.value!==t[0].status&&J(e,t[0].status)},d(t){t&&g(e),l=!1,s(r)}}}function Ft(t){let e,n,l,r;return{c(){e=$("input"),y(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),y(e,"type","date")},m(n,s){f(n,e,s),J(e,t[0].status),l||(r=[x(e,"change",t[7]),x(e,"input",t[8])],l=!0)},p(t,s){1&s&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&y(e,"class",n),1&s&&J(e,t[0].status)},d(t){t&&g(e),l=!1,s(r)}}}function Rt(t){let e,n,l,r;return{c(){e=$("input"),y(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),y(e,"type","time")},m(n,s){f(n,e,s),J(e,t[0].status),l||(r=[x(e,"change",t[9]),x(e,"input",t[10])],l=!0)},p(t,s){1&s&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&y(e,"class",n),1&s&&J(e,t[0].status)},d(t){t&&g(e),l=!1,s(r)}}}function Wt(e){let n,s,l,r,o,c,i,a,u,d=(e[0].descr?e[0].descr:"")+"",m="number"==e[0].type&&zt(e),h="text"==e[0].type&&Dt(e),v="date"==e[0].type&&Ft(e),x="time"==e[0].type&&Rt(e);return{c(){n=$("div"),s=$("div"),l=$("label"),r=w(d),o=b(),c=$("div"),m&&m.c(),i=b(),h&&h.c(),a=b(),v&&v.c(),u=b(),x&&x.c(),y(l,"class","wgt-dscr-stl"),y(s,"class","wgt-dscr-w"),y(c,"class","wgt-w"),y(n,"class","crd-itm-psn")},m(t,e){f(t,n,e),p(n,s),p(s,l),p(l,r),p(n,o),p(n,c),m&&m.m(c,null),p(c,i),h&&h.m(c,null),p(c,a),v&&v.m(c,null),p(c,u),x&&x.m(c,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&_(r,d),"number"==t[0].type?m?m.p(t,e):(m=zt(t),m.c(),m.m(c,i)):m&&(m.d(1),m=null),"text"==t[0].type?h?h.p(t,e):(h=Dt(t),h.c(),h.m(c,a)):h&&(h.d(1),h=null),"date"==t[0].type?v?v.p(t,e):(v=Ft(t),v.c(),v.m(c,u)):v&&(v.d(1),v=null),"time"==t[0].type?x?x.p(t,e):(x=Rt(t),x.c(),x.m(c,null)):x&&(x.d(1),x=null)},i:t,o:t,d(t){t&&g(n),m&&m.d(),h&&h.d(),v&&v.d(),x&&x.d()}}}function It(t,e,n){let{widget:s}=e,{wsPush:l=((t,e,n)=>{})}=e,{value:r}=e;r=r;return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"wsPush"in t&&n(1,l=t.wsPush),"value"in t&&n(2,r=t.value)},[s,l,r,()=>(n(0,s.send=!0,s),l(s.ws,s.topic,s.status)),function(){s.status=k(this.value),n(0,s)},()=>(n(0,s.send=!0,s),l(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)},()=>(n(0,s.send=!0,s),l(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)},()=>(n(0,s.send=!0,s),l(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)}]}class Yt extends lt{constructor(t){super(),st(this,t,It,Wt,r,{widget:0,wsPush:1,value:2})}}function Kt(e){let n,l,r,o,c,i,a,u,d,m,h,v,k,j,S,C,L,E,T=(e[0].descr?e[0].descr:"")+"";return{c(){n=$("div"),l=$("div"),r=$("label"),o=w(T),c=b(),i=$("div"),a=$("label"),u=$("div"),d=$("input"),h=b(),v=$("div"),k=b(),j=$("div"),y(r,"class","wgt-dscr-stl"),y(l,"class","wgt-dscr-w"),y(d,"id",m=e[0].topic),y(d,"type","checkbox"),y(d,"class","sr-only"),y(v,"class","block bg-gray-600 w-10 h-6 rounded-full"),y(j,"class",S="dot "+(1==e[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition"),y(u,"class","relative"),y(a,"for",C=e[0].topic),y(a,"class","items-center cursor-pointer"),y(i,"class","wgt-w"),y(n,"class","crd-itm-psn")},m(t,s){f(t,n,s),p(n,l),p(l,r),p(r,o),p(n,c),p(n,i),p(i,a),p(a,u),p(u,d),J(d,e[0].status),p(u,h),p(u,v),p(u,k),p(u,j),L||(E=[x(d,"change",e[3]),x(d,"change",e[4])],L=!0)},p(t,[e]){1&e&&T!==(T=(t[0].descr?t[0].descr:"")+"")&&_(o,T),1&e&&m!==(m=t[0].topic)&&y(d,"id",m),1&e&&J(d,t[0].status),1&e&&S!==(S="dot "+(1==t[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition")&&y(j,"class",S),1&e&&C!==(C=t[0].topic)&&y(a,"for",C)},i:t,o:t,d(t){t&&g(n),L=!1,s(E)}}}function Ut(t,e,n){let{widget:s}=e,{value:l}=e;l=l;let{wsPush:r=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"value"in t&&n(2,l=t.value),"wsPush"in t&&n(1,r=t.wsPush)},[s,r,l,()=>(n(0,s.send=!0,s),r(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)}]}class Qt extends lt{constructor(t){super(),st(this,t,Ut,Kt,r,{widget:0,value:2,wsPush:1})}}function Zt(e){let n,s,l,r,o,c,i,a,u,d,m,h,v=(e[0].descr?e[0].descr:"")+"",x=(e[0].status?e[0].status:"")+"",k=(e[0].after?e[0].after:"")+"";return{c(){n=$("div"),s=$("div"),l=$("label"),r=w(v),o=b(),c=$("div"),i=$("label"),a=w(x),u=b(),d=$("label"),m=w(" "),h=w(k),y(l,"class","wgt-dscr-stl"),y(s,"class","wgt-dscr-w"),y(i,"class","wgt-adt-stl"),y(d,"class","wgt-adt-stl"),y(c,"class","wgt-w"),y(n,"class","crd-itm-psn")},m(t,e){f(t,n,e),p(n,s),p(s,l),p(l,r),p(n,o),p(n,c),p(c,i),p(i,a),p(c,u),p(c,d),p(d,m),p(d,h)},p(t,[e]){1&e&&v!==(v=(t[0].descr?t[0].descr:"")+"")&&_(r,v),1&e&&x!==(x=(t[0].status?t[0].status:"")+"")&&_(a,x),1&e&&k!==(k=(t[0].after?t[0].after:"")+"")&&_(h,k)},i:t,o:t,d(t){t&&g(n)}}}function Gt(t,e,n){let{widget:s}=e,{value:l}=e;return l=l,t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"value"in t&&n(1,l=t.value)},[s,l]}class Vt extends lt{constructor(t){super(),st(this,t,Gt,Zt,r,{widget:0,value:1})}}function Xt(t,e,n){const s=t.slice();return s[8]=e[n],s[10]=n,s}function te(t,e,n){const s=t.slice();return s[11]=e[n],s[12]=e,s[10]=n,s}function ee(t){let e,n;return e=new Bt({props:{title:"Ваша панель управления пуста, вначале добавьте новые элементы в конфигураторе!"}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function ne(t){let e,n,s,l,r="input"===t[11].widget&&se(t),o="toggle"===t[11].widget&&le(t),c="anydata"===t[11].widget&&re(t);return{c(){r&&r.c(),e=b(),o&&o.c(),n=b(),c&&c.c(),s=v()},m(t,i){r&&r.m(t,i),f(t,e,i),o&&o.m(t,i),f(t,n,i),c&&c.m(t,i),f(t,s,i),l=!0},p(t,l){"input"===t[11].widget?r?(r.p(t,l),1&l&&G(r,1)):(r=se(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(Q(),V(r,1,1,(()=>{r=null})),Z()),"toggle"===t[11].widget?o?(o.p(t,l),1&l&&G(o,1)):(o=le(t),o.c(),G(o,1),o.m(n.parentNode,n)):o&&(Q(),V(o,1,1,(()=>{o=null})),Z()),"anydata"===t[11].widget?c?(c.p(t,l),1&l&&G(c,1)):(c=re(t),c.c(),G(c,1),c.m(s.parentNode,s)):c&&(Q(),V(c,1,1,(()=>{c=null})),Z())},i(t){l||(G(r),G(o),G(c),l=!0)},o(t){V(r),V(o),V(c),l=!1},d(t){r&&r.d(t),t&&g(e),o&&o.d(t),t&&g(n),c&&c.d(t),t&&g(s)}}}function se(t){let e,n,s;function l(e){t[4](e,t[11])}let r={widget:t[11],wsPush:t[3]};return void 0!==t[11].status&&(r.value=t[11].status),e=new Yt({props:r}),N.push((()=>X(e,"value",l))),{c(){tt(e.$$.fragment)},m(t,n){et(e,t,n),s=!0},p(s,l){t=s;const r={};1&l&&(r.widget=t[11]),4&l&&(r.wsPush=t[3]),!n&&1&l&&(n=!0,r.value=t[11].status,F((()=>n=!1))),e.$set(r)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){V(e.$$.fragment,t),s=!1},d(t){nt(e,t)}}}function le(t){let e,n,s;function l(e){t[6](e,t[11])}let r={widget:t[11],wsPush:t[5]};return void 0!==t[11].status&&(r.value=t[11].status),e=new Qt({props:r}),N.push((()=>X(e,"value",l))),{c(){tt(e.$$.fragment)},m(t,n){et(e,t,n),s=!0},p(s,l){t=s;const r={};1&l&&(r.widget=t[11]),4&l&&(r.wsPush=t[5]),!n&&1&l&&(n=!0,r.value=t[11].status,F((()=>n=!1))),e.$set(r)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){V(e.$$.fragment,t),s=!1},d(t){nt(e,t)}}}function re(t){let e,n,s;function l(e){t[7](e,t[11])}let r={widget:t[11]};return void 0!==t[11].status&&(r.value=t[11].status),e=new Vt({props:r}),N.push((()=>X(e,"value",l))),{c(){tt(e.$$.fragment)},m(t,n){et(e,t,n),s=!0},p(s,l){t=s;const r={};1&l&&(r.widget=t[11]),!n&&1&l&&(n=!0,r.value=t[11].status,F((()=>n=!1))),e.$set(r)},i(t){s||(G(e.$$.fragment,t),s=!0)},o(t){V(e.$$.fragment,t),s=!1},d(t){nt(e,t)}}}function oe(t){let e,n,s=t[11].page===t[8].page&&ne(t);return{c(){s&&s.c(),e=v()},m(t,l){s&&s.m(t,l),f(t,e,l),n=!0},p(t,n){t[11].page===t[8].page?s?(s.p(t,n),3&n&&G(s,1)):(s=ne(t),s.c(),G(s,1),s.m(e.parentNode,e)):s&&(Q(),V(s,1,1,(()=>{s=null})),Z())},i(t){n||(G(s),n=!0)},o(t){V(s),n=!1},d(t){s&&s.d(t),t&&g(e)}}}function ce(t){let e,n,s=t[0],l=[];for(let e=0;e<s.length;e+=1)l[e]=oe(te(t,s,e));const r=t=>V(l[t],1,1,(()=>{l[t]=null}));return{c(){for(let t=0;t<l.length;t+=1)l[t].c();e=b()},m(t,s){for(let e=0;e<l.length;e+=1)l[e].m(t,s);f(t,e,s),n=!0},p(t,n){if(7&n){let o;for(s=t[0],o=0;o<s.length;o+=1){const r=te(t,s,o);l[o]?(l[o].p(r,n),G(l[o],1)):(l[o]=oe(r),l[o].c(),G(l[o],1),l[o].m(e.parentNode,e))}for(Q(),o=s.length;o<l.length;o+=1)r(o);Z()}},i(t){if(!n){for(let t=0;t<s.length;t+=1)G(l[t]);n=!0}},o(t){l=l.filter(Boolean);for(let t=0;t<l.length;t+=1)V(l[t]);n=!1},d(t){m(l,t),t&&g(e)}}}function ie(t){let e,n;return e=new Bt({props:{title:t[8].page,$$slots:{default:[ce]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};2&n&&(s.title=t[8].page),8199&n&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function ae(t){let e,n,s,l=t[0]===[]&&ee(),r=t[1],o=[];for(let e=0;e<r.length;e+=1)o[e]=ie(Xt(t,r,e));const c=t=>V(o[t],1,1,(()=>{o[t]=null}));return{c(){e=$("div"),l&&l.c(),n=b();for(let t=0;t<o.length;t+=1)o[t].c();y(e,"class","grd-3col1")},m(t,r){f(t,e,r),l&&l.m(e,null),p(e,n);for(let t=0;t<o.length;t+=1)o[t].m(e,null);s=!0},p(t,[s]){if(t[0]===[]?l?1&s&&G(l,1):(l=ee(),l.c(),G(l,1),l.m(e,n)):l&&(Q(),V(l,1,1,(()=>{l=null})),Z()),7&s){let n;for(r=t[1],n=0;n<r.length;n+=1){const l=Xt(t,r,n);o[n]?(o[n].p(l,s),G(o[n],1)):(o[n]=ie(l),o[n].c(),G(o[n],1),o[n].m(e,null))}for(Q(),n=r.length;n<o.length;n+=1)c(n);Z()}},i(t){if(!s){G(l);for(let t=0;t<r.length;t+=1)G(o[t]);s=!0}},o(t){V(l),o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)V(o[t]);s=!1},d(t){t&&g(e),l&&l.d(),m(o,t)}}}function ue(t,e,n){let{layoutJson:s}=e,{pages:l}=e,{wsPush:r=((t,e,n)=>{})}=e;return t.$$set=t=>{"layoutJson"in t&&n(0,s=t.layoutJson),"pages"in t&&n(1,l=t.pages),"wsPush"in t&&n(2,r=t.wsPush)},[s,l,r,(t,e,n)=>r(t,e,n),function(e,l){t.$$.not_equal(l.status,e)&&(l.status=e,n(0,s))},(t,e,n)=>r(t,e,n),function(e,l){t.$$.not_equal(l.status,e)&&(l.status=e,n(0,s))},function(e,l){t.$$.not_equal(l.status,e)&&(l.status=e,n(0,s))}]}class de extends lt{constructor(t){super(),st(this,t,ue,ae,r,{layoutJson:0,pages:1,wsPush:2})}}function pe(e){let n,s,r,o,c,i,a;return{c(){n=h("svg"),s=h("path"),r=h("circle"),o=h("circle"),c=h("circle"),y(s,"stroke","none"),y(s,"d","M0 0h24v24H0z"),y(r,"cx","5"),y(r,"cy","12"),y(r,"r","1"),y(o,"cx","12"),y(o,"cy","12"),y(o,"r","1"),y(c,"cx","19"),y(c,"cy","12"),y(c,"r","1"),y(n,"class","h-6 w-6 text-green-400 cursor-pointer"),y(n,"width","24"),y(n,"height","24"),y(n,"viewBox","0 0 24 24"),y(n,"stroke-width","2"),y(n,"stroke","currentColor"),y(n,"fill","none"),y(n,"stroke-linecap","round"),y(n,"stroke-linejoin","round")},m(t,u){f(t,n,u),p(n,s),p(n,r),p(n,o),p(n,c),i||(a=x(n,"click",(function(){l(e[0]())&&e[0]().apply(this,arguments)})),i=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&g(n),i=!1,a()}}}function fe(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class ge extends lt{constructor(t){super(),st(this,t,fe,pe,r,{click:0})}}function me(t,e,n){const s=t.slice();return s[18]=e[n],s[19]=e,s[20]=n,s}function $e(t,e,n){const s=t.slice();return s[21]=e[n][0],s[22]=e[n][1],s[23]=e,s[24]=n,s}function he(t,e,n){const s=t.slice();return s[25]=e[n],s}function we(t,e,n){const s=t.slice();return s[28]=e[n],s}function be(t){let e,n;return{c(){e=$("optgroup"),y(e,"label",n=t[28].header)},m(t,n){f(t,e,n)},p(t,s){4&s[0]&&n!==(n=t[28].header)&&y(e,"label",n)},d(t){t&&g(e)}}}function ve(t){let e,n,s,l,r=t[28].name+"";return{c(){e=$("option"),n=w(r),s=b(),e.__value=l=t[28].num,e.value=e.__value},m(t,l){f(t,e,l),p(e,n),p(e,s)},p(t,s){4&s[0]&&r!==(r=t[28].name+"")&&_(n,r),4&s[0]&&l!==(l=t[28].num)&&(e.__value=l,e.value=e.__value)},d(t){t&&g(e)}}}function xe(t){let e,n,s=t[28].header&&be(t),l=!t[28].header&&ve(t);return{c(){s&&s.c(),e=v(),l&&l.c(),n=v()},m(t,r){s&&s.m(t,r),f(t,e,r),l&&l.m(t,r),f(t,n,r)},p(t,r){t[28].header?s?s.p(t,r):(s=be(t),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),t[28].header?l&&(l.d(1),l=null):l?l.p(t,r):(l=ve(t),l.c(),l.m(n.parentNode,n))},d(t){s&&s.d(t),t&&g(e),l&&l.d(t),t&&g(n)}}}function ye(t){let e,n,s,l,r=t[25].label+"";return{c(){e=$("option"),n=w(r),s=b(),e.__value=l=t[25].name,e.value=e.__value},m(t,l){f(t,e,l),p(e,n),p(e,s)},p(t,s){2&s[0]&&r!==(r=t[25].label+"")&&_(n,r),2&s[0]&&l!==(l=t[25].name)&&(e.__value=l,e.value=e.__value)},d(t){t&&g(e)}}}function ke(t){let e,n=Object.entries(t[18]),s=[];for(let e=0;e<n.length;e+=1)s[e]=Je($e(t,n,e));return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=b()},m(t,n){for(let e=0;e<s.length;e+=1)s[e].m(t,n);f(t,e,n)},p(t,l){if(1&l[0]){let r;for(n=Object.entries(t[18]),r=0;r<n.length;r+=1){const o=$e(t,n,r);s[r]?s[r].p(o,l):(s[r]=Je(o),s[r].c(),s[r].m(e.parentNode,e))}for(;r<s.length;r+=1)s[r].d(1);s.length=n.length}},d(t){m(s,t),t&&g(e)}}}function _e(t){let e,n,s,l,r,o,c,i,a,u,d,m,h,v,k,j=t[21]+"";function S(){t[16].call(h,t[21],t[19],t[20])}return{c(){e=$("tr"),n=$("td"),s=b(),l=$("td"),r=b(),o=$("td"),c=b(),i=$("td"),a=$("p"),u=w(j),d=b(),m=$("td"),h=$("input"),y(a,"class","txt-ita"),y(i,"class","tbl-bdy-sm text-right"),y(h,"class","ipt-sm w-full"),y(h,"type","text"),y(m,"class","tbl-bdy-sm text-center"),y(e,"class","txt-sz txt-pad")},m(g,$){f(g,e,$),p(e,n),p(e,s),p(e,l),p(e,r),p(e,o),p(e,c),p(e,i),p(i,a),p(a,u),p(e,d),p(e,m),p(m,h),J(h,t[18][t[21]]),v||(k=x(h,"input",S),v=!0)},p(e,n){t=e,1&n[0]&&j!==(j=t[21]+"")&&_(u,j),3&n[0]&&h.value!==t[18][t[21]]&&J(h,t[18][t[21]])},d(t){t&&g(e),v=!1,k()}}}function Je(t){let e,n="type"!=t[21]&&"subtype"!=t[21]&&"id"!=t[21]&&"widget"!=t[21]&&"page"!=t[21]&&"descr"!=t[21]&&_e(t);return{c(){n&&n.c(),e=v()},m(t,s){n&&n.m(t,s),f(t,e,s)},p(t,s){"type"!=t[21]&&"subtype"!=t[21]&&"id"!=t[21]&&"widget"!=t[21]&&"page"!=t[21]&&"descr"!=t[21]?n?n.p(t,s):(n=_e(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&g(e)}}}function je(t){let e,n,l,r,o,c,i,a,u,d,h,k,S,C,L,E,T,O,H,N,M,P,q,A,B,z,F=t[18].subtype+"";function R(){t[10].call(c,t[19],t[20])}let W=t[1],I=[];for(let e=0;e<W.length;e+=1)I[e]=ye(he(t,W,e));function Y(){t[11].call(u,t[19],t[20])}function K(){t[12].call(k,t[19],t[20])}function U(){t[13].call(L,t[19],t[20])}O=new ge({props:{click:t[14]}}),M=new Ct({props:{click:function(){return t[15](t[20])}}});let Q=!t[5]&&ke(t);return{c(){e=$("tr"),n=$("td"),l=w(F),r=b(),o=$("td"),c=$("input"),i=b(),a=$("td"),u=$("select");for(let t=0;t<I.length;t+=1)I[t].c();d=b(),h=$("td"),k=$("input"),S=b(),C=$("td"),L=$("input"),E=b(),T=$("td"),tt(O.$$.fragment),H=b(),N=$("td"),tt(M.$$.fragment),P=b(),Q&&Q.c(),q=v(),y(n,"class","tbl-bdy-lg"),y(c,"class","ipt-lg w-full"),y(c,"type","text"),y(o,"class","tbl-bdy-lg"),y(u,"class","ipt-lg w-full"),void 0===t[18].widget&&D(Y),y(a,"class","tbl-bdy-lg"),y(k,"class","ipt-lg w-full"),y(k,"type","text"),y(h,"class","tbl-bdy-lg"),y(L,"class","ipt-lg w-full"),y(L,"type","text"),y(C,"class","tbl-bdy-lg"),y(T,"class","tbl-bdy-lg"),y(N,"class","tbl-bdy-lg"),y(e,"class","txt-sz txt-pad align-middle")},m(s,g){f(s,e,g),p(e,n),p(n,l),p(e,r),p(e,o),p(o,c),J(c,t[18].id),p(e,i),p(e,a),p(a,u);for(let t=0;t<I.length;t+=1)I[t].m(u,null);j(u,t[18].widget),p(e,d),p(e,h),p(h,k),J(k,t[18].page),p(e,S),p(e,C),p(C,L),J(L,t[18].descr),p(e,E),p(e,T),et(O,T,null),p(e,H),p(e,N),et(M,N,null),f(s,P,g),Q&&Q.m(s,g),f(s,q,g),A=!0,B||(z=[x(c,"input",R),x(u,"change",Y),x(k,"input",K),x(L,"input",U)],B=!0)},p(e,n){if(t=e,(!A||1&n[0])&&F!==(F=t[18].subtype+"")&&_(l,F),3&n[0]&&c.value!==t[18].id&&J(c,t[18].id),2&n[0]){let e;for(W=t[1],e=0;e<W.length;e+=1){const s=he(t,W,e);I[e]?I[e].p(s,n):(I[e]=ye(s),I[e].c(),I[e].m(u,null))}for(;e<I.length;e+=1)I[e].d(1);I.length=W.length}3&n[0]&&j(u,t[18].widget),3&n[0]&&k.value!==t[18].page&&J(k,t[18].page),3&n[0]&&L.value!==t[18].descr&&J(L,t[18].descr);const s={};32&n[0]&&(s.click=t[14]),O.$set(s),t[5]?Q&&(Q.d(1),Q=null):Q?Q.p(t,n):(Q=ke(t),Q.c(),Q.m(q.parentNode,q))},i(t){A||(G(O.$$.fragment,t),G(M.$$.fragment,t),A=!0)},o(t){V(O.$$.fragment,t),V(M.$$.fragment,t),A=!1},d(t){t&&g(e),m(I,t),nt(O),nt(M),t&&g(P),Q&&Q.d(t),t&&g(q),B=!1,s(z)}}}function Se(t){let e,n,l,r,o,c,i,a,u,d,h,w,v,k,_,J=t[2],S=[];for(let e=0;e<J.length;e+=1)S[e]=xe(we(t,J,e));let C=t[0],L=[];for(let e=0;e<C.length;e+=1)L[e]=je(me(t,C,e));const E=t=>V(L[t],1,1,(()=>{L[t]=null}));return{c(){e=$("div"),n=$("select");for(let t=0;t<S.length;t+=1)S[t].c();l=b(),r=$("select"),o=$("option"),o.textContent="Выберите пресет",c=b(),i=$("table"),a=$("thead"),a.innerHTML='<tr class="txt-sz txt-pad"><th class="tbl-hd">Тип</th> \n <th class="tbl-hd">Id</th> \n <th class="tbl-hd">Виджет</th> \n <th class="tbl-hd">Вкладка</th> \n <th class="tbl-hd">Название</th> \n <th class="tbl-hd w-7"></th> \n <th class="tbl-hd w-7"></th></tr>',u=b(),d=$("tbody");for(let t=0;t<L.length;t+=1)L[t].c();h=b(),w=$("button"),w.textContent="Сохранить",y(n,"class","slct-lg"),void 0===t[4]&&D((()=>t[8].call(n))),o.__value="Выберите пресет",o.value=o.__value,y(r,"class","slct-lg"),y(e,"class","grd-2col2"),y(a,"class","bg-gray-100"),y(d,"class","bg-white"),y(i,"class","tbl"),y(w,"class","btn-lg")},m(s,g){f(s,e,g),p(e,n);for(let t=0;t<S.length;t+=1)S[t].m(n,null);j(n,t[4]),p(e,l),p(e,r),p(r,o),f(s,c,g),f(s,i,g),p(i,a),p(i,u),p(i,d);for(let t=0;t<L.length;t+=1)L[t].m(d,null);f(s,h,g),f(s,w,g),v=!0,k||(_=[x(n,"change",t[8]),x(n,"change",t[9]),x(w,"click",t[17])],k=!0)},p(t,e){if(4&e[0]){let s;for(J=t[2],s=0;s<J.length;s+=1){const l=we(t,J,s);S[s]?S[s].p(l,e):(S[s]=xe(l),S[s].c(),S[s].m(n,null))}for(;s<S.length;s+=1)S[s].d(1);S.length=J.length}if(20&e[0]&&j(n,t[4]),163&e[0]){let n;for(C=t[0],n=0;n<C.length;n+=1){const s=me(t,C,n);L[n]?(L[n].p(s,e),G(L[n],1)):(L[n]=je(s),L[n].c(),G(L[n],1),L[n].m(d,null))}for(Q(),n=C.length;n<L.length;n+=1)E(n);Z()}},i(t){if(!v){for(let t=0;t<C.length;t+=1)G(L[t]);v=!0}},o(t){L=L.filter(Boolean);for(let t=0;t<L.length;t+=1)V(L[t]);v=!1},d(t){t&&g(e),m(S,t),t&&g(c),t&&g(i),m(L,t),t&&g(h),t&&g(w),k=!1,s(_)}}}function Ce(t){let e,n,s;return n=new Bt({props:{$$slots:{default:[Se]},$$scope:{ctx:t}}}),{c(){e=$("div"),tt(n.$$.fragment),y(e,"class","grd-1col1")},m(t,l){f(t,e,l),et(n,e,null),s=!0},p(t,e){const s={};63&e[0]|1&e[1]&&(s.$$scope={dirty:e,ctx:t}),n.$set(s)},i(t){s||(G(n.$$.fragment,t),s=!0)},o(t){V(n.$$.fragment,t),s=!1},d(t){t&&g(e),nt(n)}}}function Le(t,e,n){let{configJson:s}=e,{widgetsJson:l}=e,{itemsJson:r}=e,o=0,{saveConfig:c=(()=>{})}=e,i=!0;function a(){for(let t=0;t<r.length;t++){let e=Object.assign({},r[t]);if(o===e.num){delete e.num,delete e.name,s.push(e),n(0,s),n(4,o=0),console.log("[i]","item added");break}}}function u(t){for(let e=0;e<s.length;e++)if(t===e){s.splice(e,1),n(0,s),console.log("[i]","item "+t+" deleted from config");break}}return t.$$set=t=>{"configJson"in t&&n(0,s=t.configJson),"widgetsJson"in t&&n(1,l=t.widgetsJson),"itemsJson"in t&&n(2,r=t.itemsJson),"saveConfig"in t&&n(3,c=t.saveConfig)},[s,l,r,c,o,i,a,u,function(){o=S(this),n(4,o),n(2,r)},()=>a(),function(t,e){t[e].id=this.value,n(0,s),n(1,l)},function(t,e){t[e].widget=S(this),n(0,s),n(1,l)},function(t,e){t[e].page=this.value,n(0,s),n(1,l)},function(t,e){t[e].descr=this.value,n(0,s),n(1,l)},()=>n(5,i=!i),t=>u(t),function(t,e,r){e[r][t]=this.value,n(0,s),n(1,l)},()=>c()]}class Ee extends lt{constructor(t){super(),st(this,t,Le,Ce,r,{configJson:0,widgetsJson:1,itemsJson:2,saveConfig:3},null,[-1,-1])}}function Te(t,e,n){const s=t.slice();return s[20]=e[n][0],s[21]=e[n][1],s}function Oe(t){let e,n,s,l,r=t[21]+"";return{c(){e=$("option"),n=w(r),s=b(),e.__value=l=t[21],e.value=e.__value},m(t,l){f(t,e,l),p(e,n),p(e,s)},p(t,s){4&s&&r!==(r=t[21]+"")&&_(n,r),4&s&&l!==(l=t[21])&&(e.__value=l,e.value=e.__value)},d(t){t&&g(e)}}}function He(t){let e,n,s;return n=new Ht({props:{title:"Введен неправильный пароль"}}),{c(){e=$("div"),tt(n.$$.fragment),y(e,"class","grd-1col1")},m(t,l){f(t,e,l),et(n,e,null),s=!0},i(t){s||(G(n.$$.fragment,t),s=!0)},o(t){V(n.$$.fragment,t),s=!1},d(t){t&&g(e),nt(n)}}}function Ne(t){let e,n,l,r,o,c,i,a,u,d,h,w,v,k,_,S,C,L,E,T,O,H,N,M,P,q,A,B,z,F,R,W,I,Y,K,U=Object.entries(t[2]),X=[];for(let e=0;e<U.length;e+=1)X[e]=Oe(Te(t,U,e));let tt=1===t[1].passer&&He();return{c(){e=$("div"),n=$("div"),n.innerHTML='<p class="wgt-dscr-stl">Название устройства</p>',l=b(),r=$("div"),o=$("input"),c=b(),i=$("div"),a=$("div"),a.innerHTML='<p class="wgt-dscr-stl">Точка доступа</p>',u=b(),d=$("div"),h=$("input"),w=b(),v=$("div"),k=$("div"),k.innerHTML='<p class="wgt-dscr-stl">Пароль точки доступа</p>',_=b(),S=$("div"),C=$("input"),L=b(),E=$("div"),T=$("div"),T.innerHTML='<p class="wgt-dscr-stl">Название wifi сети</p>',O=b(),H=$("div"),N=$("select");for(let t=0;t<X.length;t+=1)X[t].c();M=b(),P=$("div"),q=$("div"),q.innerHTML='<p class="wgt-dscr-stl">Пароль</p>',A=b(),B=$("div"),z=$("input"),F=b(),tt&&tt.c(),R=b(),W=$("button"),W.textContent="Сохранить",y(n,"class","wgt-dscr-w"),y(o,"class","ipt-rnd text-left focus:border-indigo-500"),y(o,"type","text"),y(r,"class","wgt-w"),y(e,"class","crd-itm-psn"),y(a,"class","wgt-dscr-w"),y(h,"class","ipt-rnd text-left focus:border-indigo-500"),y(h,"type","text"),y(d,"class","wgt-w"),y(i,"class","crd-itm-psn"),y(k,"class","wgt-dscr-w"),y(C,"class","ipt-rnd text-left focus:border-indigo-500"),y(C,"type","text"),y(S,"class","wgt-w"),y(v,"class","crd-itm-psn"),y(T,"class","wgt-dscr-w"),y(N,"class","ipt-rnd text-left focus:border-indigo-500"),void 0===t[0].routerssid&&D((()=>t[9].call(N))),y(H,"class","wgt-w"),y(E,"class","crd-itm-psn"),y(q,"class","wgt-dscr-w"),y(z,"class","ipt-rnd text-left focus:border-indigo-500"),y(z,"type","text"),y(B,"class","wgt-w"),y(P,"class","crd-itm-psn"),y(W,"class","btn-lg")},m(s,g){f(s,e,g),p(e,n),p(e,l),p(e,r),p(r,o),J(o,t[0].name),f(s,c,g),f(s,i,g),p(i,a),p(i,u),p(i,d),p(d,h),J(h,t[0].apssid),f(s,w,g),f(s,v,g),p(v,k),p(v,_),p(v,S),p(S,C),J(C,t[0].appass),f(s,L,g),f(s,E,g),p(E,T),p(E,O),p(E,H),p(H,N);for(let t=0;t<X.length;t+=1)X[t].m(N,null);j(N,t[0].routerssid),f(s,M,g),f(s,P,g),p(P,q),p(P,A),p(P,B),p(B,z),J(z,t[0].routerpass),f(s,F,g),tt&&tt.m(s,g),f(s,R,g),f(s,W,g),I=!0,Y||(K=[x(o,"input",t[6]),x(h,"input",t[7]),x(C,"input",t[8]),x(N,"change",t[9]),x(N,"click",t[10]),x(z,"input",t[11]),x(W,"click",t[12])],Y=!0)},p(t,e){if(5&e&&o.value!==t[0].name&&J(o,t[0].name),5&e&&h.value!==t[0].apssid&&J(h,t[0].apssid),5&e&&C.value!==t[0].appass&&J(C,t[0].appass),4&e){let n;for(U=Object.entries(t[2]),n=0;n<U.length;n+=1){const s=Te(t,U,n);X[n]?X[n].p(s,e):(X[n]=Oe(s),X[n].c(),X[n].m(N,null))}for(;n<X.length;n+=1)X[n].d(1);X.length=U.length}5&e&&j(N,t[0].routerssid),5&e&&z.value!==t[0].routerpass&&J(z,t[0].routerpass),1===t[1].passer?tt?2&e&&G(tt,1):(tt=He(),tt.c(),G(tt,1),tt.m(R.parentNode,R)):tt&&(Q(),V(tt,1,1,(()=>{tt=null})),Z())},i(t){I||(G(tt),I=!0)},o(t){V(tt),I=!1},d(t){t&&g(e),t&&g(c),t&&g(i),t&&g(w),t&&g(v),t&&g(L),t&&g(E),m(X,t),t&&g(M),t&&g(P),t&&g(F),tt&&tt.d(t),t&&g(R),t&&g(W),Y=!1,s(K)}}}function Me(t){let e,n,l,r,o,c,i,a,u,d,m,h,w,v,k,_,j,S,C,L,E,T,O,H,N,M,P,q,A,B,z,D,F;return{c(){e=$("div"),n=$("div"),n.innerHTML='<p class="wgt-dscr-stl">Название сервера</p>',l=b(),r=$("div"),o=$("input"),c=b(),i=$("div"),a=$("div"),a.innerHTML='<p class="wgt-dscr-stl">Порт</p>',u=b(),d=$("div"),m=$("input"),h=b(),w=$("div"),v=$("div"),v.innerHTML='<p class="wgt-dscr-stl">Префикс</p>',k=b(),_=$("div"),j=$("input"),S=b(),C=$("div"),L=$("div"),L.innerHTML='<p class="wgt-dscr-stl">Имя пользователя</p>',E=b(),T=$("div"),O=$("input"),H=b(),N=$("div"),M=$("div"),M.innerHTML='<p class="wgt-dscr-stl">Пароль</p>',P=b(),q=$("div"),A=$("input"),B=b(),z=$("button"),z.textContent="Сохранить и проверить подключение",y(n,"class","wgt-dscr-w"),y(o,"class","ipt-rnd text-left focus:border-indigo-500"),y(o,"type","text"),y(r,"class","wgt-w"),y(e,"class","crd-itm-psn"),y(a,"class","wgt-dscr-w"),y(m,"class","ipt-rnd text-left focus:border-indigo-500"),y(m,"type","text"),y(d,"class","wgt-w"),y(i,"class","crd-itm-psn"),y(v,"class","wgt-dscr-w"),y(j,"class","ipt-rnd text-left focus:border-indigo-500"),y(j,"type","text"),y(_,"class","wgt-w"),y(w,"class","crd-itm-psn"),y(L,"class","wgt-dscr-w"),y(O,"class","ipt-rnd text-left focus:border-indigo-500"),y(O,"type","text"),y(T,"class","wgt-w"),y(C,"class","crd-itm-psn"),y(M,"class","wgt-dscr-w"),y(A,"class","ipt-rnd text-left focus:border-indigo-500"),y(A,"type","text"),y(q,"class","wgt-w"),y(N,"class","crd-itm-psn"),y(z,"class","btn-lg")},m(s,g){f(s,e,g),p(e,n),p(e,l),p(e,r),p(r,o),J(o,t[0].mqttServer),f(s,c,g),f(s,i,g),p(i,a),p(i,u),p(i,d),p(d,m),J(m,t[0].mqttPort),f(s,h,g),f(s,w,g),p(w,v),p(w,k),p(w,_),p(_,j),J(j,t[0].mqttPrefix),f(s,S,g),f(s,C,g),p(C,L),p(C,E),p(C,T),p(T,O),J(O,t[0].mqttUser),f(s,H,g),f(s,N,g),p(N,M),p(N,P),p(N,q),p(q,A),J(A,t[0].mqttPass),f(s,B,g),f(s,z,g),D||(F=[x(o,"input",t[13]),x(m,"input",t[14]),x(j,"input",t[15]),x(O,"input",t[16]),x(A,"input",t[17]),x(z,"click",t[18])],D=!0)},p(t,e){5&e&&o.value!==t[0].mqttServer&&J(o,t[0].mqttServer),5&e&&m.value!==t[0].mqttPort&&J(m,t[0].mqttPort),5&e&&j.value!==t[0].mqttPrefix&&J(j,t[0].mqttPrefix),5&e&&O.value!==t[0].mqttUser&&J(O,t[0].mqttUser),5&e&&A.value!==t[0].mqttPass&&J(A,t[0].mqttPass)},d(t){t&&g(e),t&&g(c),t&&g(i),t&&g(h),t&&g(w),t&&g(S),t&&g(C),t&&g(H),t&&g(N),t&&g(B),t&&g(z),D=!1,s(F)}}}function Pe(e){let n,s,l;return{c(){n=$("button"),n.textContent="Перезагрузить устройство",y(n,"class","btn-lg")},m(t,r){f(t,n,r),s||(l=x(n,"click",e[19]),s=!0)},p:t,d(t){t&&g(n),s=!1,l()}}}function qe(t){let e,n,s,l,r,o,c,i;return n=new Bt({props:{title:"Подключение к WiFi роутеру",$$slots:{default:[Ne]},$$scope:{ctx:t}}}),l=new Bt({props:{title:"Подключение к MQTT брокеру",$$slots:{default:[Me]},$$scope:{ctx:t}}}),c=new Bt({props:{$$slots:{default:[Pe]},$$scope:{ctx:t}}}),{c(){e=$("div"),tt(n.$$.fragment),s=b(),tt(l.$$.fragment),r=b(),o=$("div"),tt(c.$$.fragment),y(e,"class","grd-2col1"),y(o,"class","grd-1col1")},m(t,a){f(t,e,a),et(n,e,null),p(e,s),et(l,e,null),f(t,r,a),f(t,o,a),et(c,o,null),i=!0},p(t,[e]){const s={};16777247&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};16777233&e&&(r.$$scope={dirty:e,ctx:t}),l.$set(r);const o={};16777248&e&&(o.$$scope={dirty:e,ctx:t}),c.$set(o)},i(t){i||(G(n.$$.fragment,t),G(l.$$.fragment,t),G(c.$$.fragment,t),i=!0)},o(t){V(n.$$.fragment,t),V(l.$$.fragment,t),V(c.$$.fragment,t),i=!1},d(t){t&&g(e),nt(n),nt(l),t&&g(r),t&&g(o),nt(c)}}}function Ae(t,e,n){let{settingsJson:s}=e,{errorsJson:l}=e,{ssidJson:r}=e,{ssidDropdownClick:o=(()=>{})}=e,{saveSettings:c=(()=>{})}=e,{rebootEsp:i=(()=>{})}=e;return t.$$set=t=>{"settingsJson"in t&&n(0,s=t.settingsJson),"errorsJson"in t&&n(1,l=t.errorsJson),"ssidJson"in t&&n(2,r=t.ssidJson),"ssidDropdownClick"in t&&n(3,o=t.ssidDropdownClick),"saveSettings"in t&&n(4,c=t.saveSettings),"rebootEsp"in t&&n(5,i=t.rebootEsp)},[s,l,r,o,c,i,function(){s.name=this.value,n(0,s),n(2,r)},function(){s.apssid=this.value,n(0,s),n(2,r)},function(){s.appass=this.value,n(0,s),n(2,r)},function(){s.routerssid=S(this),n(0,s),n(2,r)},()=>o(),function(){s.routerpass=this.value,n(0,s),n(2,r)},()=>c(),function(){s.mqttServer=this.value,n(0,s),n(2,r)},function(){s.mqttPort=this.value,n(0,s),n(2,r)},function(){s.mqttPrefix=this.value,n(0,s),n(2,r)},function(){s.mqttUser=this.value,n(0,s),n(2,r)},function(){s.mqttPass=this.value,n(0,s),n(2,r)},()=>c(),()=>i()]}class Be extends lt{constructor(t){super(),st(this,t,Ae,qe,r,{settingsJson:0,errorsJson:1,ssidJson:2,ssidDropdownClick:3,saveSettings:4,rebootEsp:5})}}function ze(t,e,n){const s=t.slice();return s[10]=e[n],s[12]=n,s}function De(t){let e,n,s,l,r,o,c,i,a,u,d,m,h,v,x,k,J,j,S,C=t[10].name+"",L=t[10].ip+"",E=t[10].id+"",T=t[10].status?"online":"offline";return j=new Ct({props:{click:function(){return t[5](t[12])}}}),{c(){e=$("tr"),n=$("td"),s=w(C),l=b(),r=$("td"),o=$("a"),c=w(L),a=b(),u=$("td"),d=w(E),m=b(),h=$("td"),v=w(T),k=b(),J=$("td"),tt(j.$$.fragment),y(n,"class","tbl-bdy-lg ipt-lg w-full"),y(o,"href",i="http://"+t[10].ip),y(r,"class","tbl-bdy-lg ipt-lg w-full"),y(u,"class","tbl-bdy-lg ipt-lg w-full"),y(h,"class",x="tbl-bdy-lg ipt-lg w-full "+(t[10].status?"bg-green-50":"bg-red-50")),y(J,"class","tbl-bdy-lg"),y(e,"class","txt-sz txt-pad")},m(t,i){f(t,e,i),p(e,n),p(n,s),p(e,l),p(e,r),p(r,o),p(o,c),p(e,a),p(e,u),p(u,d),p(e,m),p(e,h),p(h,v),p(e,k),p(e,J),et(j,J,null),S=!0},p(e,n){t=e,(!S||1&n)&&C!==(C=t[10].name+"")&&_(s,C),(!S||1&n)&&L!==(L=t[10].ip+"")&&_(c,L),(!S||1&n&&i!==(i="http://"+t[10].ip))&&y(o,"href",i),(!S||1&n)&&E!==(E=t[10].id+"")&&_(d,E),(!S||1&n)&&T!==(T=t[10].status?"online":"offline")&&_(v,T),(!S||1&n&&x!==(x="tbl-bdy-lg ipt-lg w-full "+(t[10].status?"bg-green-50":"bg-red-50")))&&y(h,"class",x)},i(t){S||(G(j.$$.fragment,t),S=!0)},o(t){V(j.$$.fragment,t),S=!1},d(t){t&&g(e),nt(j)}}}function Fe(t){let e,n,l,r,o,c,i,a,u,d,m,h,w;return{c(){e=$("tr"),n=$("td"),l=$("input"),r=b(),o=$("td"),c=$("input"),i=b(),a=$("td"),u=$("input"),d=b(),m=$("td"),y(l,"class","ipt-lg w-full"),y(l,"type","text"),y(n,"class","tbl-bdy-lg"),y(c,"class","ipt-lg w-full"),y(c,"type","text"),y(o,"class","tbl-bdy-lg"),y(u,"class","ipt-lg w-full"),y(u,"type","text"),y(a,"class","tbl-bdy-lg"),y(m,"class","tbl-bdy-lg"),y(e,"class","txt-sz txt-pad")},m(s,g){f(s,e,g),p(e,n),p(n,l),J(l,t[2].name),p(e,r),p(e,o),p(o,c),J(c,t[2].ip),p(e,i),p(e,a),p(a,u),J(u,t[2].id),p(e,d),p(e,m),h||(w=[x(l,"input",t[6]),x(c,"input",t[7]),x(u,"input",t[8])],h=!0)},p(t,e){4&e&&l.value!==t[2].name&&J(l,t[2].name),4&e&&c.value!==t[2].ip&&J(c,t[2].ip),4&e&&u.value!==t[2].id&&J(u,t[2].id)},d(t){t&&g(e),h=!1,s(w)}}}function Re(t){let e,n,s,l,r,o,c,i,a,u,d,h=t[1]?"Сохранить":"Добавить устройство",v=t[0],k=[];for(let e=0;e<v.length;e+=1)k[e]=De(ze(t,v,e));const J=t=>V(k[t],1,1,(()=>{k[t]=null}));let j=t[1]&&Fe(t);return{c(){e=$("table"),n=$("thead"),n.innerHTML='<tr class="txt-sz txt-pad"><th class="tbl-hd">Название устройства</th> \n <th class="tbl-hd">IP адрес</th> \n <th class="tbl-hd">Идентификатор</th> \n <th class="tbl-hd">Состояние</th> \n <th class="tbl-hd w-7"></th></tr>',s=b(),l=$("tbody");for(let t=0;t<k.length;t+=1)k[t].c();r=b(),j&&j.c(),o=b(),c=$("button"),i=w(h),y(n,"class","bg-gray-100"),y(l,"class","bg-white"),y(e,"class","tbl"),y(c,"class","btn-lg")},m(g,m){f(g,e,m),p(e,n),p(e,s),p(e,l);for(let t=0;t<k.length;t+=1)k[t].m(l,null);p(l,r),j&&j.m(l,null),f(g,o,m),f(g,c,m),p(c,i),a=!0,u||(d=x(c,"click",t[9]),u=!0)},p(t,e){if(17&e){let n;for(v=t[0],n=0;n<v.length;n+=1){const s=ze(t,v,n);k[n]?(k[n].p(s,e),G(k[n],1)):(k[n]=De(s),k[n].c(),G(k[n],1),k[n].m(l,r))}for(Q(),n=v.length;n<k.length;n+=1)J(n);Z()}t[1]?j?j.p(t,e):(j=Fe(t),j.c(),j.m(l,null)):j&&(j.d(1),j=null),(!a||2&e)&&h!==(h=t[1]?"Сохранить":"Добавить устройство")&&_(i,h)},i(t){if(!a){for(let t=0;t<v.length;t+=1)G(k[t]);a=!0}},o(t){k=k.filter(Boolean);for(let t=0;t<k.length;t+=1)V(k[t]);a=!1},d(t){t&&g(e),m(k,t),j&&j.d(),t&&g(o),t&&g(c),u=!1,d()}}}function We(t){let e;return{c(){e=$("p"),e.textContent="Список устройств будет обновляться автоматически. Подключенные к одному роутеру устройства будут появляться в списке в течении двух минут. Ручное добавление сделано в целях проверки для разработчика."},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Ie(t){let e,n,s,l,r;return n=new Bt({props:{title:"Список устройств",$$slots:{default:[Re]},$$scope:{ctx:t}}}),l=new Ht({props:{$$slots:{default:[We]},$$scope:{ctx:t}}}),{c(){e=$("div"),tt(n.$$.fragment),s=b(),tt(l.$$.fragment),y(e,"class","grd-1col1")},m(t,o){f(t,e,o),et(n,e,null),p(e,s),et(l,e,null),r=!0},p(t,[e]){const s={};8207&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};8192&e&&(r.$$scope={dirty:e,ctx:t}),l.$set(r)},i(t){r||(G(n.$$.fragment,t),G(l.$$.fragment,t),r=!0)},o(t){V(n.$$.fragment,t),V(l.$$.fragment,t),r=!1},d(t){t&&g(e),nt(n),nt(l)}}}function Ye(t,e,n){let{deviceList:s}=e,{showInput:l}=e,{newDevice:r={}}=e,{devListSave:o=(()=>{})}=e;function c(t){for(let e=0;e<s.length;e++)if(t===e){s.splice(e,1),n(0,s),console.log("[i]","item "+t+" deleted from dev list");break}}return t.$$set=t=>{"deviceList"in t&&n(0,s=t.deviceList),"showInput"in t&&n(1,l=t.showInput),"newDevice"in t&&n(2,r=t.newDevice),"devListSave"in t&&n(3,o=t.devListSave)},[s,l,r,o,c,t=>c(t),function(){r.name=this.value,n(2,r)},function(){r.ip=this.value,n(2,r)},function(){r.id=this.value,n(2,r)},()=>(n(1,l=!l),o())]}class Ke extends lt{constructor(t){super(),st(this,t,Ye,Ie,r,{deviceList:0,showInput:1,newDevice:2,devListSave:3})}}function Ue(t){let e;return{c(){e=$("p"),e.textContent="не подключено",y(e,"class","text-red-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Qe(t){let e;return{c(){e=$("p"),e.textContent="нет сигнала",y(e,"class","text-red-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Ze(t){let e;return{c(){e=$("p"),e.textContent="очень низкий",y(e,"class","text-red-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Ge(t){let e;return{c(){e=$("p"),e.textContent="низкий",y(e,"class","text-yellow-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Ve(t){let e;return{c(){e=$("p"),e.textContent="хороший",y(e,"class","text-yellow-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function Xe(t){let e;return{c(){e=$("p"),e.textContent="очень хороший",y(e,"class","text-green-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function tn(t){let e;return{c(){e=$("p"),e.textContent="отличный",y(e,"class","text-green-500 font-bold")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function en(t){let e,n,s,l,r,o,c,i,a,u,d,m,h,v,x,k,J,j,S,C,L,E,T,O,H,N,M,P,q,A,B,z,D,F,R,W,I,Y,K=t[1].bver+"",U=t[1].upt+"",Q=t[1].heap+"",Z=0===t[1].rssi&&Ue(),G=1===t[1].rssi&&Qe(),V=2===t[1].rssi&&Ze(),X=3===t[1].rssi&&Ge(),tt=4===t[1].rssi&&Ve(),et=5===t[1].rssi&&Xe(),nt=6===t[1].rssi&&tn();return{c(){e=$("div"),n=$("div"),n.innerHTML='<p class="wgt-dscr-stl">Версия прошивки</p>',s=b(),l=$("div"),r=$("p"),o=w(K),c=b(),i=$("div"),a=$("div"),a.innerHTML='<p class="wgt-dscr-stl">Версия файловой системы</p>',u=b(),d=$("div"),m=$("p"),h=w(t[0]),v=b(),x=$("div"),k=$("div"),k.innerHTML='<p class="wgt-dscr-stl">Время работы устройства</p>',J=b(),j=$("div"),S=$("p"),C=w(U),L=b(),E=$("div"),T=$("div"),T.innerHTML='<p class="wgt-dscr-stl">Качество WiFi сигнала</p>',O=b(),H=$("div"),Z&&Z.c(),N=b(),G&&G.c(),M=b(),V&&V.c(),P=b(),X&&X.c(),q=b(),tt&&tt.c(),A=b(),et&&et.c(),B=b(),nt&&nt.c(),z=b(),D=$("div"),F=$("div"),F.innerHTML='<p class="wgt-dscr-stl">Остаток оперативной памяти</p>',R=b(),W=$("div"),I=$("p"),Y=w(Q),y(n,"class","w-3/4"),y(r,"class","text-gray-500 font-bold"),y(l,"class","flex justify-center w-1/4"),y(e,"class","crd-itm-psn"),y(a,"class","w-3/4"),y(m,"class","text-gray-500 font-bold"),y(d,"class","flex justify-center w-1/4"),y(i,"class","crd-itm-psn"),y(k,"class","w-3/4"),y(S,"class","text-gray-500 font-bold"),y(j,"class","flex justify-center w-1/4"),y(x,"class","crd-itm-psn"),y(T,"class","w-3/4"),y(H,"class","flex justify-center w-1/4 text-xs sm:text-sm md:text-base lg:text-base xl:text-base 2xl:text-base break-words"),y(E,"class","crd-itm-psn"),y(F,"class","w-3/4"),y(I,"class","text-green-500 font-bold"),y(W,"class","flex justify-center w-1/4"),y(D,"class","crd-itm-psn")},m(t,g){f(t,e,g),p(e,n),p(e,s),p(e,l),p(l,r),p(r,o),f(t,c,g),f(t,i,g),p(i,a),p(i,u),p(i,d),p(d,m),p(m,h),f(t,v,g),f(t,x,g),p(x,k),p(x,J),p(x,j),p(j,S),p(S,C),f(t,L,g),f(t,E,g),p(E,T),p(E,O),p(E,H),Z&&Z.m(H,null),p(H,N),G&&G.m(H,null),p(H,M),V&&V.m(H,null),p(H,P),X&&X.m(H,null),p(H,q),tt&&tt.m(H,null),p(H,A),et&&et.m(H,null),p(H,B),nt&&nt.m(H,null),f(t,z,g),f(t,D,g),p(D,F),p(D,R),p(D,W),p(W,I),p(I,Y)},p(t,e){2&e&&K!==(K=t[1].bver+"")&&_(o,K),1&e&&_(h,t[0]),2&e&&U!==(U=t[1].upt+"")&&_(C,U),0===t[1].rssi?Z||(Z=Ue(),Z.c(),Z.m(H,N)):Z&&(Z.d(1),Z=null),1===t[1].rssi?G||(G=Qe(),G.c(),G.m(H,M)):G&&(G.d(1),G=null),2===t[1].rssi?V||(V=Ze(),V.c(),V.m(H,P)):V&&(V.d(1),V=null),3===t[1].rssi?X||(X=Ge(),X.c(),X.m(H,q)):X&&(X.d(1),X=null),4===t[1].rssi?tt||(tt=Ve(),tt.c(),tt.m(H,A)):tt&&(tt.d(1),tt=null),5===t[1].rssi?et||(et=Xe(),et.c(),et.m(H,B)):et&&(et.d(1),et=null),6===t[1].rssi?nt||(nt=tn(),nt.c(),nt.m(H,null)):nt&&(nt.d(1),nt=null),2&e&&Q!==(Q=t[1].heap+"")&&_(Y,Q)},d(t){t&&g(e),t&&g(c),t&&g(i),t&&g(v),t&&g(x),t&&g(L),t&&g(E),Z&&Z.d(),G&&G.d(),V&&V.d(),X&&X.d(),tt&&tt.d(),et&&et.d(),nt&&nt.d(),t&&g(z),t&&g(D)}}}function nn(t){let e,n;return e=new Ht({props:{title:"Ошибка web sockets",close:t[4],$$slots:{default:[sn]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};8&n&&(s.close=t[4]),256&n&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function sn(t){let e;return{c(){e=$("p"),e.textContent="Слишком много клиентов было открыто. Допускается не более четырех.",y(e,"class","break-words text-center")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function ln(t){let e,n;return e=new Ht({props:{title:"Ошибка json",close:t[5],$$slots:{default:[rn]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};8&n&&(s.close=t[5]),256&n&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function rn(t){let e;return{c(){e=$("p"),e.textContent="Недостаточный размер буфера библиотеки Arduino Json. Устройство может вести себя непредсказуемо. Обратитесь к разработчику",y(e,"class","break-words text-center")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function on(t){let e,n;return e=new Ht({props:{title:"Ошибка json",close:t[6],$$slots:{default:[cn]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};8&n&&(s.close=t[6]),258&n&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function cn(t){let e,n,s,l,r=t[1].jserr+"";return{c(){e=$("p"),n=w("Ошибка записи/чтения json. Устройство может вести себя непредсказуемо. Количество ошибок: "),s=w(r),l=w(". Обратитесь к разработчику."),y(e,"class","break-words text-center")},m(t,r){f(t,e,r),p(e,n),p(e,s),p(e,l)},p(t,e){2&e&&r!==(r=t[1].jserr+"")&&_(s,r)},d(t){t&&g(e)}}}function an(t){let e,n;return e=new Ht({props:{title:"Ошибка версии",$$slots:{default:[un]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function un(t){let e;return{c(){e=$("p"),e.textContent="Версия файловой системы не совпадает с версией прошивки. Вероятно произошла ошибка во время обновления устройства по воздуху.",y(e,"class","break-words text-center")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function dn(t){let e,n;return e=new Ht({props:{title:"WiFi",$$slots:{default:[pn]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function pn(t){let e;return{c(){e=$("p"),e.textContent="Уровень сигнала WiFi предельно низкий, веб интерфейс может работать со сбоями и потерей данных, рекомендуется переместить устройство ближе к роутеру",y(e,"class","break-words text-center")},m(t,n){f(t,e,n)},d(t){t&&g(e)}}}function fn(t){let e,n,s,l,r,o,c=1===t[1].wscle&&nn(t),i=1===t[1].jsbuf&&ln(t),a=t[1].jserr>0&&on(t),u=t[1].bver!=t[0]&&an(t),d=t[1].rssi<3&&t[1].rssi>0&&dn(t);return{c(){e=$("div"),c&&c.c(),n=b(),i&&i.c(),s=b(),a&&a.c(),l=b(),u&&u.c(),r=b(),d&&d.c(),y(e,"class","grd-2col1")},m(t,g){f(t,e,g),c&&c.m(e,null),p(e,n),i&&i.m(e,null),p(e,s),a&&a.m(e,null),p(e,l),u&&u.m(e,null),p(e,r),d&&d.m(e,null),o=!0},p(t,o){1===t[1].wscle?c?(c.p(t,o),2&o&&G(c,1)):(c=nn(t),c.c(),G(c,1),c.m(e,n)):c&&(Q(),V(c,1,1,(()=>{c=null})),Z()),1===t[1].jsbuf?i?(i.p(t,o),2&o&&G(i,1)):(i=ln(t),i.c(),G(i,1),i.m(e,s)):i&&(Q(),V(i,1,1,(()=>{i=null})),Z()),t[1].jserr>0?a?(a.p(t,o),2&o&&G(a,1)):(a=on(t),a.c(),G(a,1),a.m(e,l)):a&&(Q(),V(a,1,1,(()=>{a=null})),Z()),t[1].bver!=t[0]?u?3&o&&G(u,1):(u=an(t),u.c(),G(u,1),u.m(e,r)):u&&(Q(),V(u,1,1,(()=>{u=null})),Z()),t[1].rssi<3&&t[1].rssi>0?d?2&o&&G(d,1):(d=dn(t),d.c(),G(d,1),d.m(e,null)):d&&(Q(),V(d,1,1,(()=>{d=null})),Z())},i(t){o||(G(c),G(i),G(a),G(u),G(d),o=!0)},o(t){V(c),V(i),V(a),V(u),V(d),o=!1},d(t){t&&g(e),c&&c.d(),i&&i.d(),a&&a.d(),u&&u.d(),d&&d.d()}}}function gn(e){let n,s,l;return{c(){n=$("button"),n.textContent="Перезагрузить устройство",y(n,"class","btn-lg")},m(t,r){f(t,n,r),s||(l=x(n,"click",e[7]),s=!0)},p:t,d(t){t&&g(n),s=!1,l()}}}function mn(t){let e,n,s,l,r,o,c,i;return n=new Bt({props:{title:"Системная информация",$$slots:{default:[en]},$$scope:{ctx:t}}}),l=new Bt({props:{title:"Системные ошибки",$$slots:{default:[fn]},$$scope:{ctx:t}}}),c=new Bt({props:{$$slots:{default:[gn]},$$scope:{ctx:t}}}),{c(){e=$("div"),tt(n.$$.fragment),s=b(),tt(l.$$.fragment),r=b(),o=$("div"),tt(c.$$.fragment),y(e,"class","grd-2col1"),y(o,"class","grd-1col1")},m(t,a){f(t,e,a),et(n,e,null),p(e,s),et(l,e,null),f(t,r,a),f(t,o,a),et(c,o,null),i=!0},p(t,[e]){const s={};259&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};267&e&&(r.$$scope={dirty:e,ctx:t}),l.$set(r);const o={};260&e&&(o.$$scope={dirty:e,ctx:t}),c.$set(o)},i(t){i||(G(n.$$.fragment,t),G(l.$$.fragment,t),G(c.$$.fragment,t),i=!0)},o(t){V(n.$$.fragment,t),V(l.$$.fragment,t),V(c.$$.fragment,t),i=!1},d(t){t&&g(e),nt(n),nt(l),t&&g(r),t&&g(o),nt(c)}}}function $n(t,e,n){let{version:s}=e,{errorsJson:l}=e,{rebootEsp:r=(()=>{})}=e,{cancelAlarm:o=(t=>{})}=e;return t.$$set=t=>{"version"in t&&n(0,s=t.version),"errorsJson"in t&&n(1,l=t.errorsJson),"rebootEsp"in t&&n(2,r=t.rebootEsp),"cancelAlarm"in t&&n(3,o=t.cancelAlarm)},[s,l,r,o,()=>o("wscle"),()=>o("jsbuf"),()=>o("jserr"),()=>r()]}class hn extends lt{constructor(t){super(),st(this,t,$n,mn,r,{version:0,errorsJson:1,rebootEsp:2,cancelAlarm:3})}}function wn(e){let n,s,l,r;return{c(){n=h("svg"),s=h("path"),l=h("path"),y(s,"stroke","none"),y(s,"d","M0 0h24v24H0z"),y(l,"d","M7 18a4.6 4.4 0 0 1 0 -9h0a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-12"),y(n,"class",r="h-8 w-8 "+e[0]),y(n,"width","24"),y(n,"height","24"),y(n,"viewBox","0 0 24 24"),y(n,"stroke-width","2"),y(n,"stroke","currentColor"),y(n,"fill","none"),y(n,"stroke-linecap","round"),y(n,"stroke-linejoin","round")},m(t,e){f(t,n,e),p(n,s),p(n,l)},p(t,[e]){1&e&&r!==(r="h-8 w-8 "+t[0])&&y(n,"class",r)},i:t,o:t,d(t){t&&g(n)}}}function bn(t,e,n){let{color:s}=e;return t.$$set=t=>{"color"in t&&n(0,s=t.color)},[s]}class vn extends lt{constructor(t){super(),st(this,t,bn,wn,r,{color:0})}}function xn(t,e,n){const s=t.slice();return s[93]=e[n],s}function yn(t){let e,n;return e=new Mt({}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function kn(t){let e,n,s,l,r=t[93].name+"";return{c(){e=$("option"),n=w(r),s=b(),e.__value=l=t[93].ws,e.value=e.__value},m(t,l){f(t,e,l),p(e,n),p(e,s)},p(t,s){8192&s[0]&&r!==(r=t[93].name+"")&&_(n,r),8192&s[0]&&l!==(l=t[93].ws)&&(e.__value=l,e.value=e.__value)},d(t){t&&g(e)}}}function _n(t){let e,n,s,l,r,o,c,i;return e=new Jt({props:{path:"/",$$slots:{default:[jn]},$$scope:{ctx:t}}}),s=new Jt({props:{path:"/config",$$slots:{default:[Sn]},$$scope:{ctx:t}}}),r=new Jt({props:{path:"/connection",$$slots:{default:[Cn]},$$scope:{ctx:t}}}),c=new Jt({props:{path:"/system",$$slots:{default:[Ln]},$$scope:{ctx:t}}}),{c(){tt(e.$$.fragment),n=b(),tt(s.$$.fragment),l=b(),tt(r.$$.fragment),o=b(),tt(c.$$.fragment)},m(t,a){et(e,t,a),f(t,n,a),et(s,t,a),f(t,l,a),et(r,t,a),f(t,o,a),et(c,t,a),i=!0},p(t,n){const l={};68&n[0]|8&n[3]&&(l.$$scope={dirty:n,ctx:t}),e.$set(l);const o={};56&n[0]|8&n[3]&&(o.$$scope={dirty:n,ctx:t}),s.$set(o);const i={};896&n[0]|8&n[3]&&(i.$$scope={dirty:n,ctx:t}),r.$set(i);const a={};384&n[0]|8&n[3]&&(a.$$scope={dirty:n,ctx:t}),c.$set(a)},i(t){i||(G(e.$$.fragment,t),G(s.$$.fragment,t),G(r.$$.fragment,t),G(c.$$.fragment,t),i=!0)},o(t){V(e.$$.fragment,t),V(s.$$.fragment,t),V(r.$$.fragment,t),V(c.$$.fragment,t),i=!1},d(t){nt(e,t),t&&g(n),nt(s,t),t&&g(l),nt(r,t),t&&g(o),nt(c,t)}}}function Jn(e){let n,s;return n=new Ht({props:{title:"Нет соединения"}}),{c(){tt(n.$$.fragment)},m(t,e){et(n,t,e),s=!0},p:t,i(t){s||(G(n.$$.fragment,t),s=!0)},o(t){V(n.$$.fragment,t),s=!1},d(t){nt(n,t)}}}function jn(t){let e,n;return e=new de({props:{layoutJson:t[6],pages:t[2],wsPush:t[28]}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};64&n[0]&&(s.layoutJson=t[6]),4&n[0]&&(s.pages=t[2]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function Sn(t){let e,n;return e=new Ee({props:{configJson:t[3],widgetsJson:t[4],itemsJson:t[5],saveConfig:t[29]}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};8&n[0]&&(s.configJson=t[3]),16&n[0]&&(s.widgetsJson=t[4]),32&n[0]&&(s.itemsJson=t[5]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function Cn(t){let e,n;return e=new Be({props:{settingsJson:t[7],errorsJson:t[8],ssidJson:t[9],rebootEsp:t[30],ssidDropdownClick:t[31],saveSettings:t[32]}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};128&n[0]&&(s.settingsJson=t[7]),256&n[0]&&(s.errorsJson=t[8]),512&n[0]&&(s.ssidJson=t[9]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function Ln(t){let e,n;return e=new hn({props:{settingsJson:t[7],errorsJson:t[8],rebootEsp:t[33],cancelAlarm:t[34],version:On}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};128&n[0]&&(s.settingsJson=t[7]),256&n[0]&&(s.errorsJson=t[8]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function En(t){let e,n;return e=new Ke({props:{deviceList:t[13],showInput:Hn,devListSave:t[35],newDevice:t[12]}}),{c(){tt(e.$$.fragment)},m(t,s){et(e,t,s),n=!0},p(t,n){const s={};8192&n[0]&&(s.deviceList=t[13]),4096&n[0]&&(s.newDevice=t[12]),e.$set(s)},i(t){n||(G(e.$$.fragment,t),n=!0)},o(t){V(e.$$.fragment,t),n=!1},d(t){nt(e,t)}}}function Tn(t){let e,n,l,r,o,c,i,a,u,d,h,w,v,k,_,J,S,C,L,E,T,O,H,N,M,P,q,A,B,z,F,R,W,I,Y,K,U,X,st,lt,rt,ot,ct,it,at=t[14]&&yn(),ut=t[13],dt=[];for(let e=0;e<ut.length;e+=1)dt[e]=kn(xn(t,ut,e));u=new vn({props:{color:!0===t[10]?"text-green-500":"text-red-500"}});const pt=[Jn,_n],ft=[];function gt(t,e){return t[10]?1:0}return Y=gt(t),K=ft[Y]=pt[Y](t),X=new Jt({props:{path:"/list",$$slots:{default:[En]},$$scope:{ctx:t}}}),{c(){e=$("div"),at&&at.c(),n=b(),l=$("header"),r=$("div"),o=$("div"),c=$("select");for(let t=0;t<dt.length;t+=1)dt[t].c();i=b(),a=$("div"),tt(u.$$.fragment),d=b(),h=$("nav"),w=$("input"),v=b(),k=$("label"),k.innerHTML="<span></span>",_=b(),J=$("ul"),S=$("li"),C=$("a"),C.textContent="Управление",L=b(),E=$("li"),T=$("a"),T.textContent="Конфигуратор",O=b(),H=$("li"),N=$("a"),N.textContent="Подключение",M=b(),P=$("li"),q=$("a"),q.textContent="Устройства",A=b(),B=$("li"),z=$("a"),z.textContent="Системные",F=b(),R=$("main"),W=$("ul"),I=$("div"),K.c(),U=b(),tt(X.$$.fragment),lt=b(),rt=$("footer"),rt.innerHTML='<div class="flex justify-center content-center text-xxs text-gray-500">Developed by Dmitry Borisenko</div>',y(c,"class","border border-indigo-500 border-4"),void 0===t[11]&&D((()=>t[24].call(c))),y(o,"class","px-15 py-1"),y(a,"class","pl-4 pr-4 py-1"),y(r,"class","flex content-center items-center justify-end"),y(l,"class","h-10 w-full bg-gray-100 overflow-auto shadow-md"),y(w,"id","menu__toggle"),y(w,"type","checkbox"),y(k,"class","menu__btn"),y(k,"for","menu__toggle"),y(C,"class","menu__item"),y(C,"href","/"),y(T,"class","menu__item"),y(T,"href","/config"),y(N,"class","menu__item"),y(N,"href","/connection"),y(q,"class","menu__item"),y(q,"href","/list"),y(z,"class","menu__item"),y(z,"href","/system"),y(J,"class","menu__box"),y(h,"class","flex"),y(I,"class","bg-cover pt-0 px-4"),y(W,"class","menu__main"),y(R,"class",st="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")),y(rt,"class","h-4 bg-gray-100 border-gray-200 shadow-lg"),y(e,"class","flex flex-col h-screen bg-gray-50")},m(s,g){f(s,e,g),at&&at.m(e,null),p(e,n),p(e,l),p(l,r),p(r,o),p(o,c);for(let t=0;t<dt.length;t+=1)dt[t].m(c,null);j(c,t[11]),p(r,i),p(r,a),et(u,a,null),p(e,d),p(e,h),p(h,w),w.checked=t[0],p(h,v),p(h,k),p(h,_),p(h,J),p(J,S),p(S,C),p(J,L),p(J,E),p(E,T),p(J,O),p(J,H),p(H,N),p(J,M),p(J,P),p(P,q),p(J,A),p(J,B),p(B,z),p(e,F),p(e,R),p(R,W),p(W,I),ft[Y].m(I,null),p(I,U),et(X,I,null),p(e,lt),p(e,rt),ot=!0,ct||(it=[x(c,"change",t[24]),x(c,"change",t[25]),x(w,"change",t[26]),x(w,"change",t[27])],ct=!0)},p(t,s){if(t[14]?at?16384&s[0]&&G(at,1):(at=yn(),at.c(),G(at,1),at.m(e,n)):at&&(Q(),V(at,1,1,(()=>{at=null})),Z()),8192&s[0]){let e;for(ut=t[13],e=0;e<ut.length;e+=1){const n=xn(t,ut,e);dt[e]?dt[e].p(n,s):(dt[e]=kn(n),dt[e].c(),dt[e].m(c,null))}for(;e<dt.length;e+=1)dt[e].d(1);dt.length=ut.length}10240&s[0]&&j(c,t[11]);const l={};1024&s[0]&&(l.color=!0===t[10]?"text-green-500":"text-red-500"),u.$set(l),1&s[0]&&(w.checked=t[0]);let r=Y;Y=gt(t),Y===r?ft[Y].p(t,s):(Q(),V(ft[r],1,1,(()=>{ft[r]=null})),Z(),K=ft[Y],K?K.p(t,s):(K=ft[Y]=pt[Y](t),K.c()),G(K,1),K.m(I,U));const o={};12288&s[0]|8&s[3]&&(o.$$scope={dirty:s,ctx:t}),X.$set(o),(!ot||3&s[0]&&st!==(st="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")))&&y(R,"class",st)},i(t){ot||(G(at),G(u.$$.fragment,t),G(K),G(X.$$.fragment,t),ot=!0)},o(t){V(at),V(u.$$.fragment,t),V(K),V(X.$$.fragment,t),ot=!1},d(t){t&&g(e),at&&at.d(),m(dt,t),nt(u),ft[Y].d(),nt(X),ct=!1,s(it)}}}let On=401,Hn=!1;function Nn(t,e,n){let s;o(t,wt,(t=>n(60,s=t))),wt.mode.hash();let l,r=!1,c=!1,i=document.location.hostname,a=[],u=[],d=!1,p=[],f=!1,g=[],m=!1,$=[],h=!1,w={},b=!1,v={},x={},y=[],k=!1,_=0,J=!0,j={},C=[];C=[{name:"--",id:"--",ip:i,status:!1}];let L=[];var E=function(){this.parts=[]};let O;E.prototype.append=function(t){this.parts.push(t),this.blob=void 0},E.prototype.getBlob=function(){return this.blob||(this.blob=new Blob(this.parts,{type:"binary"})),this.blob},E.prototype.clear=function(){this.parts=[]};var H=new E,N=new E,M=new E,P=new E,q=new E;function A(){void 0!==_&&(Q(_,O),Q(_,"/all|"))}function B(){tt(_);let t=0;C.forEach((e=>{e.ws=t,e.status||(D(t),R(t)),t++})),n(13,C)}function z(t,e){C.forEach((n=>{n.ws===t&&(n.status=e,n.status?console.log("[i]",n.ip,"status online"):console.log("[i]",n.ip,"status offline"))})),n(13,C),tt(_),n(10,k=l.status)}function D(t){let e=F(t);"error"===e?console.log("[e]","device list wrong"):(y[t]=new WebSocket("ws://"+e+":81"),y.binaryType="blob",console.log("[i]",e,"started connecting..."))}function F(t){let e="error";return C.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function R(t){if(y[t]){let e=F(t);console.log("[i]",e,"web socket events added"),y[t].addEventListener("open",(function(n){console.log("[i]",e,"completed connecting"),z(t,!0),A()})),y[t].addEventListener("message",(function(t){if("string"==typeof t.data){let o=t.data;if(o.includes("status")&&nt(o)){!function(t){for(let e=0;e<$.length;e++){if($[e].topic===t.topic){n(6,$[e].status=t.status,$);break}}}(JSON.parse(o)),G(),console.log("✔","statusJson parced")}if(o.includes("params")&&nt(o)&&(JSON.parse(o),console.log("✔","paramsJson parced")),o.includes("ssid")&&nt(o)&&(n(9,x=JSON.parse(o)),n(9,x),console.log("✔","ssidJson parced")),o.includes("devicelist")&&nt(o)&&(L=JSON.parse(o),L=L,n(13,(s=C,l=L,r=new Set(s.map((t=>t.ip))),C=[...s,...l.filter((t=>!r.has(t.ip)))])),n(13,C),V(),B(),console.log("✔","incDeviceList json parced")),o.includes("errors")&&nt(o)&&(n(8,v=JSON.parse(o)),n(8,v),console.log("✔","errorsJson json parced")),"/st/config.json"===o&&(d=!0),"/end/config.json"===o){d=!1;var e=H.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;nt(e)&&(n(3,u=JSON.parse(e)),n(3,u),console.log("✔","configJson parced"))}}if("/st/widgets.json"===o&&(f=!0),"/end/widgets.json"===o){f=!1;e=N.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;nt(e)&&(n(4,p=JSON.parse(e)),n(4,p),console.log("✔","widgetsJson parced"))}}if("/st/items.json"===o&&(m=!0),"/end/items.json"===o){m=!1;e=M.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;nt(e)&&(n(5,g=JSON.parse(e)),n(5,g),console.log("✔","itemsJson parced"))}}if("/st/layout.json"===o&&(h=!0),"/end/layout.json"===o){h=!1;e=P.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;nt(e)&&(n(6,$=JSON.parse(e)),n(6,$),G(),console.log("✔","layoutJson parced"))}}if("/st/settings.json"===o&&(b=!0),"/end/settings.json"===o){b=!1;e=q.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;nt(e)&&(n(7,w=JSON.parse(e)),n(7,w),G(),function(){for(let t=0;t<C.length;t++){let e=C[t];if(e.ip===i){e.name=w.name,e.id=w.id,n(7,w);break}}}(),console.log("✔","settingsJson parced"))}}}var s,l,r;t.data instanceof Blob&&(d&&H.append(t.data),f&&N.append(t.data),m&&M.append(t.data),h&&P.append(t.data),b&&q.append(t.data))})),y[t].addEventListener("close",(n=>{console.log("[e]",e,"connection closed"),z(t,!1)})),y[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),z(t,!1)}))}else console.log("[e]","socket not exist")}function W(){Q(_,"/tuoyal|"+JSON.stringify(function(){let t=[];for(let e=0;e<u.length;e++){let n=Object.assign({},u[e]),s=n.widget,l=!0;for(let e=0;e<p.length;e++){if(s===p[e].name){let s=Object.assign({},p[e]);s.page=n.page,s.descr=n.descr,s.topic=w.root+"/"+n.id,t.push(s),l=!1;break}l=!0}l&&console.log("[e]","error, widget not found: "+s)}return console.log("[i] layout:",JSON.stringify(t)),t}())),Q(_,"/gifnoc|"+JSON.stringify(u)),Y(),A()}function I(){console.log("[i]",w),Q(_,"/sgnittes|"+JSON.stringify(w)),Y(),A()}function Y(){n(3,u=[]),H.clear(),n(4,p=[]),N.clear(),n(5,g=[]),M.clear(),n(6,$=[]),P.clear(),n(7,w={}),q.clear(),n(8,v={}),console.log("[i]","all app data cleared")}function K(t,e,n){let s=e+" "+n;console.log("[i]","send to ws msg:",s),Q(t,s)}function U(){setTimeout(U,3e4),console.log("[i]","----timer tick----"),J||C.forEach((t=>{!function(t){let e=!1;return C.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(D(t.ws),R(t.ws)):Q(t.ws,"/tst|")})),J=!1}function Q(t,e){y[t]&&1===y[t].readyState?(y[t].send(e),console.log("[i]",F(t),"msg send success",e)):console.log("[e]",F(t),"msg not send",e)}function Z(){n(2,a=[]);Array.from(new Set(Array.from($,(({page:t})=>t)))).forEach((function(t,e,s){n(2,a=[...a,JSON.parse(JSON.stringify({page:t}))])})),a.sort((function(t,e){return t.page<e.page?-1:t.page>e.page?1:0}))}function G(){Z(),n(6,$)}function V(){tt(_),n(10,k=l.status)}function X(){V(),Y(),A(),console.log("[i]","user selected device:",l.name),l.ip===i&&console.log("[i]","user selected original device",l.name)}function tt(t){for(let e=0;e<C.length;e++){let n=C[e];if(n.ws===t){l=n;break}}}function et(){void 0!==j.name&&void 0!==j.ip&&void 0!==j.id?(n(12,j.status=!1,j),C.push(j),n(13,C),n(12,j={}),V(),B(),console.log("[i]","selected device:",l)):console.log("[e]","wrong data")}function nt(t){try{JSON.parse(t)}catch(t){return console.log("[e]","json error"),!1}return!0}function st(){let t=screen.width;console.log("width",t),n(1,c=t<900)}function lt(){Q(_,"/scan|")}wt.subscribe((function(){Y(),O=s.path.toString(),O+="|",console.log("[i]","user on page:",O),A()}));let rt=!1;const ot=void 0;function ct(){console.log("[i]","reboot..."),Q(_,"/reboot|"),n(14,rt=!0),ot=setTimeout(it,2e4)}function it(){clearTimeout(ot),B(),n(14,rt=!1)}function at(t){console.log("[x]",t),"wscle"===t&&(n(8,v.wscle=0,v),Q(_,'/rorre|{"wscle":0}')),"jsbuf"===t&&(n(8,v.jsbuf=0,v),Q(_,'/rorre|{"jsbuf":0}')),"jserr"===t&&(n(8,v.jserr=0,v),Q(_,'/rorre|{"jserr":0}'))}T((async()=>{console.log("[i]","mounted"),B(),U(),V(),Z()}));return[r,c,a,u,p,g,$,w,v,x,k,_,j,C,rt,W,I,K,X,et,st,lt,ct,at,function(){_=S(this),n(11,_),n(13,C)},()=>X(),function(){r=this.checked,n(0,r)},()=>st(),(t,e,n)=>K(t,e,n),()=>W(),()=>ct(),()=>lt(),()=>I(),()=>ct(),t=>at(t),()=>et()]}return new class extends lt{constructor(t){super(),st(this,t,Nn,Tn,r,{},null,[-1,-1,-1,-1])}}({target:document.body,props:{name:"world"}})}();
//# sourceMappingURL=bundle.js.map