mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
3 lines
28 KiB
JavaScript
3 lines
28 KiB
JavaScript
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function r(t){t.forEach(e)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function o(t,e,n,r){if(t){const s=i(t,e,n,r);return t[0](s)}}function i(t,e,n,r){return t[1]&&r?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](r(e))):n.ctx}function c(t,e,n,r){if(t[2]&&r){const s=t[2](r(n));if(void 0===e.dirty)return s;if("object"==typeof s){const t=[],n=Math.max(e.dirty.length,s.length);for(let r=0;r<n;r+=1)t[r]=e.dirty[r]|s[r];return t}return e.dirty|s}return e.dirty}function u(t,e,n,r,s,a){if(s){const o=i(e,n,r,a);t.p(o,s)}}function l(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 d(t,e){t.appendChild(e)}function p(t,e,n){t.insertBefore(e,n||null)}function f(t){t.parentNode.removeChild(t)}function g(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function m(t){return document.createElement(t)}function $(t){return document.createTextNode(t)}function h(){return $(" ")}function w(){return $("")}function b(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function y(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function x(t){return""===t?null:+t}function v(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function _(t,e){t.value=null==e?"":e}let k;function S(t){k=t}function E(){if(!k)throw new Error("Function called outside component initialization");return k}function N(t){E().$$.on_mount.push(t)}function O(t){return E().$$.context.get(t)}const A=[],H=[],L=[],T=[],C=Promise.resolve();let M=!1;function W(){M||(M=!0,C.then(I))}function R(){return W(),C}function z(t){L.push(t)}function q(t){T.push(t)}let j=!1;const F=new Set;function I(){if(!j){j=!0;do{for(let t=0;t<A.length;t+=1){const e=A[t];S(e),J(e.$$)}for(S(null),A.length=0;H.length;)H.pop()();for(let t=0;t<L.length;t+=1){const e=L[t];F.has(e)||(F.add(e),e())}L.length=0}while(A.length);for(;T.length;)T.pop()();M=!1,j=!1,F.clear()}}function J(t){if(null!==t.fragment){t.update(),r(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(z)}}const B=new Set;let D;function Y(){D={r:0,c:[],p:D}}function K(){D.r||r(D.c),D=D.p}function P(t,e){t&&t.i&&(B.delete(t),t.i(e))}function Z(t,e,n,r){if(t&&t.o){if(B.has(t))return;B.add(t),D.c.push((()=>{B.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}}function Q(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function G(t){t&&t.c()}function U(t,n,a,o){const{fragment:i,on_mount:c,on_destroy:u,after_update:l}=t.$$;i&&i.m(n,a),o||z((()=>{const n=c.map(e).filter(s);u?u.push(...n):r(n),t.$$.on_mount=[]})),l.forEach(z)}function V(t,e){const n=t.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function X(e,s,a,o,i,c,u,l=[-1]){const d=k;S(e);const p=e.$$={fragment:null,ctx:null,props:c,update:t,not_equal:i,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(d?d.$$.context:s.context||[]),callbacks:n(),dirty:l,skip_bound:!1,root:s.target||d.$$.root};u&&u(p.root);let g=!1;if(p.ctx=a?a(e,s.props||{},((t,n,...r)=>{const s=r.length?r[0]:n;return p.ctx&&i(p.ctx[t],p.ctx[t]=s)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](s),g&&function(t,e){-1===t.$$.dirty[0]&&(A.push(t),W(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(e,t)),n})):[],p.update(),g=!0,r(p.before_update),p.fragment=!!o&&o(p.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);p.fragment&&p.fragment.l(t),t.forEach(f)}else p.fragment&&p.fragment.c();s.intro&&P(e.$$.fragment),U(e,s.target,s.anchor,s.customElement),I()}S(d)}class tt{$destroy(){V(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 et=[];function nt(e,n=t){let r;const s=new Set;function o(t){if(a(e,t)&&(e=t,r)){const t=!et.length;for(const t of s)t[1](),et.push(t,e);if(t){for(let t=0;t<et.length;t+=2)et[t][0](et[t+1]);et.length=0}}}return{set:o,update:function(t){o(t(e))},subscribe:function(a,i=t){const c=[a,i];return s.add(c),1===s.size&&(r=n(o)||t),a(e),()=>{s.delete(c),0===s.size&&(r(),r=null)}}}}function rt(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 st(t,e,n){if(""===n)return t;if("/"===n[0])return n;let r=t=>t.split("/").filter((t=>""!==t)),s=r(t);return"/"+(e?r(e):[]).map(((t,e)=>s[e])).join("/")+"/"+n}function at(t,e,n,r){let s=[e,"data-"+e].reduce(((e,r)=>{let s=t.getAttribute(r);return n&&t.removeAttribute(r),null===s?e:s}),!1);return!r&&""===s||(s||r||!1)}function ot(t){let e=t.split("&").map((t=>t.split("="))).reduce(((t,e)=>{let n=e[0];if(!n)return t;let r=!(e.length>1)||e[e.length-1];return"string"==typeof r&&r.includes(",")&&(r=r.split(",")),void 0===t[n]?t[n]=[r]:t[n].push(r),t}),{});return Object.entries(e).reduce(((t,e)=>(t[e[0]]=e[1].length>1?e[1]:e[1][0],t)),{})}var it,ct,ut={HISTORY:1,HASH:2,MEMORY:3,OFF:4,run:function(t,e,n,r){return 1===t?e&&e():2===t?n&&n():r&&r()},getDeafault:function(){return window&&"srcdoc"!==window.location.pathname?1:3}},lt=function(){let t,e=ut.getDeafault(),n=n=>t&&t(dt(e));function r(t){t&&(e=t),window.onhashchange=window.onpopstate=ct=null,e!==ut.OFF&&ut.run(e,(t=>window.onpopstate=n),(t=>window.onhashchange=n))&&n()}return{mode:t=>r(t),get:t=>dt(e),go(t,r){(function(t,e,n){let r=t=>history[n?"replaceState":"pushState"]({},"",t);ut.run(t,(t=>r(e)),(t=>r(`#${e}`)),(t=>ct=e))})(e,t,r),n()},start(e){t=e,r()},stop(){t=null,r(ut.OFF)}}}();function dt(t){let e=it,n=it=ut.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>ct||"/")),r=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:r[1]||"",query:ot(r[2]||""),hash:r[3]||""}}function pt(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",r=nt({}),s={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){s.exact=!t.path.endsWith("/*"),s.pattern=rt(`${s.parent&&s.parent.pattern||""}${t.path}`),s.redirect=t.redirect,s.firstmatch=t.firstmatch,s.breadcrumb=t.breadcrumb,s.match()},register:()=>{if(s.parent)return s.parent[n].add(s),()=>{s.parent[n].delete(s),s.router.un&&s.router.un()}},show:()=>{t.onShow(),!s.fallback&&s.parent&&s.parent.activeChilds.add(s)},hide:()=>{t.onHide(),!s.fallback&&s.parent&&s.parent.activeChilds.delete(s)},match:async()=>{s.matched=!1;let{path:e,url:n,from:a,query:o}=s.router,i=function(t,e){t=rt(t,!0),e=rt(e,!0);let n=[],r={},s=!0,a=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),o=e.match(new RegExp(`^${a}$`));return o||(s=!1,o=e.match(new RegExp(`^${a}`))),o?(n.forEach(((t,e)=>r[t]=o[e+1])),{exact:s,params:r,part:o[0].slice(0,-1)}):null}(s.pattern,e);if(!s.fallback&&i&&s.redirect&&(!s.exact||s.exact&&i.exact)){await R();let t=st(e,s.parent&&s.parent.pattern,s.redirect);return gt.goto(t,!0)}if(s.meta=i&&{from:a,url:n,query:o,match:i.part,pattern:s.pattern,breadcrumbs:s.parent&&s.parent.meta&&s.parent.meta.breadcrumbs.slice()||[],params:i.params,subscribe:r.subscribe},s.breadcrumb&&s.meta&&s.meta.breadcrumbs.push({name:s.breadcrumb,path:i.part}),r.set(s.meta),!i||s.fallback||!(!s.exact||s.exact&&i.exact)||s.parent&&s.parent.firstmatch&&s.parent.matched?s.hide():(t.onMeta(s.meta),s.parent&&(s.parent.matched=!0),s.show()),await R(),i&&!s.fallback&&(s.childs.size>0&&0==s.activeChilds.size||0==s.childs.size&&s.fallbacks.size>0)){let t=s;for(;0==t.fallbacks.size;)if(t=t.parent,!t)return;t&&t.fallbacks.forEach((t=>{if(t.redirect){let e=st("/",t.parent&&t.parent.pattern,t.redirect);gt.goto(e,!0)}else t.show()}))}}};return a="tinro",o=s,E().$$.context.set(a,o),N((()=>s.register())),s.router.un=gt.subscribe((t=>{s.router.path=t.path,s.router.url=t.url,s.router.query=t.query,s.router.from=t.from,null!==s.pattern&&s.match()})),s;var a,o}function ft(){return O("tinro").meta}var gt=function(){let{subscribe:t}=nt(lt.get(),(t=>{lt.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),r=n&&at(n,"target",!1,"_self"),s=n&&at(n,"tinro-ignore"),a=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==r&&!s&&!a&&n){let r=n.getAttribute("href").replace(/^\/#/,"");/^\/\/|^[a-zA-Z]+:/.test(r)||(e.preventDefault(),t(r.startsWith("/")?r:n.href.replace(window.location.origin,"")))}};return addEventListener("click",e),()=>removeEventListener("click",e)}(lt.go);return()=>{lt.stop(),e()}}));return{subscribe:t,goto:lt.go,params:mt,meta:ft,useHashNavigation:t=>lt.mode(t?ut.HASH:ut.HISTORY),mode:{hash:()=>lt.mode(ut.HASH),history:()=>lt.mode(ut.HISTORY),memory:()=>lt.mode(ut.MEMORY)}}}();function mt(){return O("tinro").meta.params}const $t=t=>({params:2&t,meta:4&t}),ht=t=>({params:t[1],meta:t[2]});function wt(t){let e;const n=t[9].default,r=o(n,t,t[8],ht);return{c(){r&&r.c()},m(t,n){r&&r.m(t,n),e=!0},p(t,s){r&&r.p&&(!e||262&s)&&u(r,n,t,t[8],e?c(n,t[8],s,$t):l(t[8]),ht)},i(t){e||(P(r,t),e=!0)},o(t){Z(r,t),e=!1},d(t){r&&r.d(t)}}}function bt(t){let e,n,r=t[0]&&wt(t);return{c(){r&&r.c(),e=w()},m(t,s){r&&r.m(t,s),p(t,e,s),n=!0},p(t,[n]){t[0]?r?(r.p(t,n),1&n&&P(r,1)):(r=wt(t),r.c(),P(r,1),r.m(e.parentNode,e)):r&&(Y(),Z(r,1,1,(()=>{r=null})),K())},i(t){n||(P(r),n=!0)},o(t){Z(r),n=!1},d(t){r&&r.d(t),t&&f(e)}}}function yt(t,e,n){let{$$slots:r={},$$scope:s}=e,{path:a="/*"}=e,{fallback:o=!1}=e,{redirect:i=!1}=e,{firstmatch:c=!1}=e,{breadcrumb:u=null}=e,l=!1,d={},p={};const f=pt({fallback:o,onShow(){n(0,l=!0)},onHide(){n(0,l=!1)},onMeta(t){n(2,p=t),n(1,d=p.params)}});return t.$$set=t=>{"path"in t&&n(3,a=t.path),"fallback"in t&&n(4,o=t.fallback),"redirect"in t&&n(5,i=t.redirect),"firstmatch"in t&&n(6,c=t.firstmatch),"breadcrumb"in t&&n(7,u=t.breadcrumb),"$$scope"in t&&n(8,s=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&f.update({path:a,redirect:i,firstmatch:c,breadcrumb:u})},[l,d,p,a,o,i,c,u,s,r]}class xt extends tt{constructor(t){super(),X(this,t,yt,bt,a,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function vt(t){let e,n,r,s,a;const i=t[2].default,g=o(i,t,t[1],null);return{c(){e=m("div"),n=m("h1"),r=$(t[0]),s=h(),g&&g.c(),y(n,"class","card-header"),y(e,"class","card")},m(t,o){p(t,e,o),d(e,n),d(n,r),d(e,s),g&&g.m(e,null),a=!0},p(t,[e]){(!a||1&e)&&v(r,t[0]),g&&g.p&&(!a||2&e)&&u(g,i,t,t[1],a?c(i,t[1],e,null):l(t[1]),null)},i(t){a||(P(g,t),a=!0)},o(t){Z(g,t),a=!1},d(t){t&&f(e),g&&g.d(t)}}}function _t(t,e,n){let{$$slots:r={},$$scope:s}=e,{title:a}=e;return t.$$set=t=>{"title"in t&&n(0,a=t.title),"$$scope"in t&&n(1,s=t.$$scope)},[a,s,r]}class kt extends tt{constructor(t){super(),X(this,t,_t,vt,a,{title:0})}}function St(t){let e,n,s,a;return{c(){e=m("input"),y(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),y(e,"step","0.1"),y(e,"type","number")},m(n,r){p(n,e,r),_(e,t[0].status),s||(a=[b(e,"change",t[1]),b(e,"input",t[2])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&y(e,"class",n),1&r&&x(e.value)!==t[0].status&&_(e,t[0].status)},d(t){t&&f(e),s=!1,r(a)}}}function Et(t){let e,n,s,a;return{c(){e=m("input"),y(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),y(e,"type","text")},m(n,r){p(n,e,r),_(e,t[0].status),s||(a=[b(e,"change",t[3]),b(e,"input",t[4])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&y(e,"class",n),1&r&&e.value!==t[0].status&&_(e,t[0].status)},d(t){t&&f(e),s=!1,r(a)}}}function Nt(t){let e,n,s,a;return{c(){e=m("input"),y(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),y(e,"type","date")},m(n,r){p(n,e,r),_(e,t[0].status),s||(a=[b(e,"change",t[5]),b(e,"input",t[6])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&y(e,"class",n),1&r&&_(e,t[0].status)},d(t){t&&f(e),s=!1,r(a)}}}function Ot(t){let e,n,s,a;return{c(){e=m("input"),y(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),y(e,"type","time")},m(n,r){p(n,e,r),_(e,t[0].status),s||(a=[b(e,"change",t[7]),b(e,"input",t[8])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&y(e,"class",n),1&r&&_(e,t[0].status)},d(t){t&&f(e),s=!1,r(a)}}}function At(e){let n,r,s,a,o,i,c,u,l,g=(e[0].descr?e[0].descr:"")+"",w="number"==e[0].type&&St(e),b="text"==e[0].type&&Et(e),x="date"==e[0].type&&Nt(e),_="time"==e[0].type&&Ot(e);return{c(){n=m("div"),r=m("div"),s=m("label"),a=$(g),o=h(),i=m("div"),w&&w.c(),c=h(),b&&b.c(),u=h(),x&&x.c(),l=h(),_&&_.c(),y(s,"class","widget-descr-style"),y(r,"class","widget-descr-width"),y(i,"class","widget-width"),y(n,"class","card-items-psn")},m(t,e){p(t,n,e),d(n,r),d(r,s),d(s,a),d(n,o),d(n,i),w&&w.m(i,null),d(i,c),b&&b.m(i,null),d(i,u),x&&x.m(i,null),d(i,l),_&&_.m(i,null)},p(t,[e]){1&e&&g!==(g=(t[0].descr?t[0].descr:"")+"")&&v(a,g),"number"==t[0].type?w?w.p(t,e):(w=St(t),w.c(),w.m(i,c)):w&&(w.d(1),w=null),"text"==t[0].type?b?b.p(t,e):(b=Et(t),b.c(),b.m(i,u)):b&&(b.d(1),b=null),"date"==t[0].type?x?x.p(t,e):(x=Nt(t),x.c(),x.m(i,l)):x&&(x.d(1),x=null),"time"==t[0].type?_?_.p(t,e):(_=Ot(t),_.c(),_.m(i,null)):_&&(_.d(1),_=null)},i:t,o:t,d(t){t&&f(n),w&&w.d(),b&&b.d(),x&&x.d(),_&&_.d()}}}function Ht(t,e,n){let{widget:r}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget)},[r,()=>(n(0,r.send=!0,r),ne(r.ws,r.topic,r.status)),function(){r.status=x(this.value),n(0,r)},()=>(n(0,r.send=!0,r),ne(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),ne(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),ne(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class Lt extends tt{constructor(t){super(),X(this,t,Ht,At,a,{widget:0})}}function Tt(e){let n,s,a,o,i,c,u,l,g,w,x,k,S,E,N,O,A,H,L=(e[0].descr?e[0].descr:"")+"";return{c(){n=m("div"),s=m("div"),a=m("label"),o=$(L),i=h(),c=m("div"),u=m("label"),l=m("div"),g=m("input"),x=h(),k=m("div"),S=h(),E=m("div"),y(a,"class","widget-descr-style"),y(s,"class","widget-descr-width"),y(g,"id",w=e[0].topic),y(g,"type","checkbox"),y(g,"class","sr-only"),y(k,"class","block bg-gray-600 w-10 h-6 rounded-full"),y(E,"class",N="dot "+(1==e[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition"),y(l,"class","relative"),y(u,"for",O=e[0].topic),y(u,"class","items-center cursor-pointer"),y(c,"class","widget-width"),y(n,"class","card-items-psn")},m(t,r){p(t,n,r),d(n,s),d(s,a),d(a,o),d(n,i),d(n,c),d(c,u),d(u,l),d(l,g),_(g,e[0].status),d(l,x),d(l,k),d(l,S),d(l,E),A||(H=[b(g,"change",e[1]),b(g,"change",e[2])],A=!0)},p(t,[e]){1&e&&L!==(L=(t[0].descr?t[0].descr:"")+"")&&v(o,L),1&e&&w!==(w=t[0].topic)&&y(g,"id",w),1&e&&_(g,t[0].status),1&e&&N!==(N="dot "+(1==t[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition")&&y(E,"class",N),1&e&&O!==(O=t[0].topic)&&y(u,"for",O)},i:t,o:t,d(t){t&&f(n),A=!1,r(H)}}}function Ct(t,e,n){let{widget:r}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget)},[r,()=>(n(0,r.send=!0,r),ne(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class Mt extends tt{constructor(t){super(),X(this,t,Ct,Tt,a,{widget:0})}}function Wt(e){let n,r,s,a,o,i,c,u,l,g,w,b,x=(e[0].descr?e[0].descr:"")+"",_=(e[0].status?e[0].status:"")+"",k=(e[0].after?e[0].after:"")+"";return{c(){n=m("div"),r=m("div"),s=m("label"),a=$(x),o=h(),i=m("div"),c=m("label"),u=$(_),l=h(),g=m("label"),w=$(" "),b=$(k),y(s,"class","widget-descr-style"),y(r,"class","widget-descr-width"),y(c,"class","widget-anydata-style"),y(g,"class","widget-anydata-style"),y(i,"class","widget-width"),y(n,"class","card-items-psn")},m(t,e){p(t,n,e),d(n,r),d(r,s),d(s,a),d(n,o),d(n,i),d(i,c),d(c,u),d(i,l),d(i,g),d(g,w),d(g,b)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&v(a,x),1&e&&_!==(_=(t[0].status?t[0].status:"")+"")&&v(u,_),1&e&&k!==(k=(t[0].after?t[0].after:"")+"")&&v(b,k)},i:t,o:t,d(t){t&&f(n)}}}function Rt(t,e,n){let{widget:r}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget)},[r]}class zt extends tt{constructor(t){super(),X(this,t,Rt,Wt,a,{widget:0})}}function qt(t,e,n){const r=t.slice();return r[16]=e[n],r[18]=n,r}function jt(t,e,n){const r=t.slice();return r[19]=e[n],r[18]=n,r}function Ft(t,e,n){const r=t.slice();return r[21]=e[n],r[22]=e,r[18]=n,r}function It(t){let e,n,r,s,a="input"===t[21].widget&&Jt(t),o="toggle"===t[21].widget&&Bt(t),i="anydata"===t[21].widget&&Dt(t);return{c(){a&&a.c(),e=h(),o&&o.c(),n=h(),i&&i.c(),r=w()},m(t,c){a&&a.m(t,c),p(t,e,c),o&&o.m(t,c),p(t,n,c),i&&i.m(t,c),p(t,r,c),s=!0},p(t,s){"input"===t[21].widget?a?(a.p(t,s),1&s&&P(a,1)):(a=Jt(t),a.c(),P(a,1),a.m(e.parentNode,e)):a&&(Y(),Z(a,1,1,(()=>{a=null})),K()),"toggle"===t[21].widget?o?(o.p(t,s),1&s&&P(o,1)):(o=Bt(t),o.c(),P(o,1),o.m(n.parentNode,n)):o&&(Y(),Z(o,1,1,(()=>{o=null})),K()),"anydata"===t[21].widget?i?(i.p(t,s),1&s&&P(i,1)):(i=Dt(t),i.c(),P(i,1),i.m(r.parentNode,r)):i&&(Y(),Z(i,1,1,(()=>{i=null})),K())},i(t){s||(P(a),P(o),P(i),s=!0)},o(t){Z(a),Z(o),Z(i),s=!1},d(t){a&&a.d(t),t&&f(e),o&&o.d(t),t&&f(n),i&&i.d(t),t&&f(r)}}}function Jt(t){let e,n,r;function s(e){t[5](e,t[21])}let a={widget:t[21]};return void 0!==t[21].status&&(a.value=t[21].status),e=new Lt({props:a}),H.push((()=>Q(e,"value",s))),{c(){G(e.$$.fragment)},m(t,n){U(e,t,n),r=!0},p(r,s){t=r;const a={};1&s&&(a.widget=t[21]),!n&&1&s&&(n=!0,a.value=t[21].status,q((()=>n=!1))),e.$set(a)},i(t){r||(P(e.$$.fragment,t),r=!0)},o(t){Z(e.$$.fragment,t),r=!1},d(t){V(e,t)}}}function Bt(t){let e,n,r;function s(e){t[6](e,t[21])}let a={widget:t[21]};return void 0!==t[21].status&&(a.value=t[21].status),e=new Mt({props:a}),H.push((()=>Q(e,"value",s))),{c(){G(e.$$.fragment)},m(t,n){U(e,t,n),r=!0},p(r,s){t=r;const a={};1&s&&(a.widget=t[21]),!n&&1&s&&(n=!0,a.value=t[21].status,q((()=>n=!1))),e.$set(a)},i(t){r||(P(e.$$.fragment,t),r=!0)},o(t){Z(e.$$.fragment,t),r=!1},d(t){V(e,t)}}}function Dt(t){let e,n,r;function s(e){t[7](e,t[21])}let a={widget:t[21]};return void 0!==t[21].status&&(a.value=t[21].status),e=new zt({props:a}),H.push((()=>Q(e,"value",s))),{c(){G(e.$$.fragment)},m(t,n){U(e,t,n),r=!0},p(r,s){t=r;const a={};1&s&&(a.widget=t[21]),!n&&1&s&&(n=!0,a.value=t[21].status,q((()=>n=!1))),e.$set(a)},i(t){r||(P(e.$$.fragment,t),r=!0)},o(t){Z(e.$$.fragment,t),r=!1},d(t){V(e,t)}}}function Yt(t){let e,n,r=t[21].page===t[19].page&&It(t);return{c(){r&&r.c(),e=w()},m(t,s){r&&r.m(t,s),p(t,e,s),n=!0},p(t,n){t[21].page===t[19].page?r?(r.p(t,n),3&n&&P(r,1)):(r=It(t),r.c(),P(r,1),r.m(e.parentNode,e)):r&&(Y(),Z(r,1,1,(()=>{r=null})),K())},i(t){n||(P(r),n=!0)},o(t){Z(r),n=!1},d(t){r&&r.d(t),t&&f(e)}}}function Kt(t){let e,n,r=t[0],s=[];for(let e=0;e<r.length;e+=1)s[e]=Yt(Ft(t,r,e));const a=t=>Z(s[t],1,1,(()=>{s[t]=null}));return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=w()},m(t,r){for(let e=0;e<s.length;e+=1)s[e].m(t,r);p(t,e,r),n=!0},p(t,n){if(3&n){let o;for(r=t[0],o=0;o<r.length;o+=1){const a=Ft(t,r,o);s[o]?(s[o].p(a,n),P(s[o],1)):(s[o]=Yt(a),s[o].c(),P(s[o],1),s[o].m(e.parentNode,e))}for(Y(),o=r.length;o<s.length;o+=1)a(o);K()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)P(s[t]);n=!0}},o(t){s=s.filter(Boolean);for(let t=0;t<s.length;t+=1)Z(s[t]);n=!1},d(t){g(s,t),t&&f(e)}}}function Pt(t){let e,n;return e=new kt({props:{title:t[19].page,$$slots:{default:[Kt]},$$scope:{ctx:t}}}),{c(){G(e.$$.fragment)},m(t,r){U(e,t,r),n=!0},p(t,n){const r={};2&n&&(r.title=t[19].page),8388611&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(P(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}function Zt(t){let e,n,r,s;return{c(){e=m("textarea"),y(e,"rows","10"),y(e,"class","json-input w-full"),y(e,"id","text1"),e.value=n=t[3](JSON.stringify(t[0]))},m(n,a){p(n,e,a),r||(s=b(e,"input",t[4]),r=!0)},p(t,r){1&r&&n!==(n=t[3](JSON.stringify(t[0])))&&(e.value=n)},d(t){t&&f(e),r=!1,s()}}}function Qt(t){let e,n,r,s,a=t[1],o=[];for(let e=0;e<a.length;e+=1)o[e]=Pt(jt(t,a,e));const i=t=>Z(o[t],1,1,(()=>{o[t]=null}));return r=new kt({props:{title:"Редактор JSON",$$slots:{default:[Zt]},$$scope:{ctx:t}}}),{c(){e=m("div");for(let t=0;t<o.length;t+=1)o[t].c();n=h(),G(r.$$.fragment),y(e,"class","cards-grid")},m(t,a){p(t,e,a);for(let t=0;t<o.length;t+=1)o[t].m(e,null);d(e,n),U(r,e,null),s=!0},p(t,s){if(3&s){let r;for(a=t[1],r=0;r<a.length;r+=1){const i=jt(t,a,r);o[r]?(o[r].p(i,s),P(o[r],1)):(o[r]=Pt(i),o[r].c(),P(o[r],1),o[r].m(e,n))}for(Y(),r=a.length;r<o.length;r+=1)i(r);K()}const c={};8388609&s&&(c.$$scope={dirty:s,ctx:t}),r.$set(c)},i(t){if(!s){for(let t=0;t<a.length;t+=1)P(o[t]);P(r.$$.fragment,t),s=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)Z(o[t]);Z(r.$$.fragment,t),s=!1},d(t){t&&f(e),g(o,t),V(r)}}}function Gt(e){let n,r,s;return r=new kt({props:{title:"Здесь будет конфигуратор"}}),{c(){n=m("div"),G(r.$$.fragment),y(n,"class","cards-grid-inline")},m(t,e){p(t,n,e),U(r,n,null),s=!0},p:t,i(t){s||(P(r.$$.fragment,t),s=!0)},o(t){Z(r.$$.fragment,t),s=!1},d(t){t&&f(n),V(r)}}}function Ut(e){let n,r,s,a,o;return r=new kt({props:{title:"Подключение к WiFi роутеру"}}),a=new kt({props:{title:"Подключение к MQTT брокеру"}}),{c(){n=m("div"),G(r.$$.fragment),s=h(),G(a.$$.fragment),y(n,"class","cards-grid")},m(t,e){p(t,n,e),U(r,n,null),d(n,s),U(a,n,null),o=!0},p:t,i(t){o||(P(r.$$.fragment,t),P(a.$$.fragment,t),o=!0)},o(t){Z(r.$$.fragment,t),Z(a.$$.fragment,t),o=!1},d(t){t&&f(n),V(r),V(a)}}}function Vt(t){let e,n,r=t[16].msg+"";return{c(){e=m("h2"),n=$(r)},m(t,r){p(t,e,r),d(e,n)},p(t,e){4&e&&r!==(r=t[16].msg+"")&&v(n,r)},d(t){t&&f(e)}}}function Xt(t){let e,n=t[2],r=[];for(let e=0;e<n.length;e+=1)r[e]=Vt(qt(t,n,e));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=w()},m(t,n){for(let e=0;e<r.length;e+=1)r[e].m(t,n);p(t,e,n)},p(t,s){if(4&s){let a;for(n=t[2],a=0;a<n.length;a+=1){const o=qt(t,n,a);r[a]?r[a].p(o,s):(r[a]=Vt(o),r[a].c(),r[a].m(e.parentNode,e))}for(;a<r.length;a+=1)r[a].d(1);r.length=n.length}},d(t){g(r,t),t&&f(e)}}}function te(t){let e,n;return e=new kt({props:{title:"Лог",$$slots:{default:[Xt]},$$scope:{ctx:t}}}),{c(){G(e.$$.fragment)},m(t,r){U(e,t,r),n=!0},p(t,n){const r={};8388612&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(P(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){V(e,t)}}}function ee(t){let e,n,r,s,a,o,i,c,u,l,g,$,w,b,x,v,_,k,S,E,N,O,A,H,L,T,C,M,W,R,z,q,j,F,I,J,B,D,Y,K;return W=new xt({props:{path:"/",$$slots:{default:[Qt]},$$scope:{ctx:t}}}),z=new xt({props:{path:"/config",$$slots:{default:[Gt]},$$scope:{ctx:t}}}),j=new xt({props:{path:"/connection",$$slots:{default:[Ut]},$$scope:{ctx:t}}}),I=new xt({props:{path:"/utilities"}}),B=new xt({props:{path:"/log",$$slots:{default:[te]},$$scope:{ctx:t}}}),Y=new xt({props:{path:"/about"}}),{c(){e=m("main"),n=m("div"),n.innerHTML='<b class="text-center"></b>',r=h(),s=m("input"),a=h(),o=m("label"),o.innerHTML="<span></span>",i=h(),c=m("ul"),u=m("li"),l=m("a"),l.textContent="Управление",g=h(),$=m("li"),w=m("a"),w.textContent="Конфигуратор",b=h(),x=m("li"),v=m("a"),v.textContent="Подключение",_=h(),k=m("li"),S=m("a"),S.textContent="Утилиты",E=h(),N=m("li"),O=m("a"),O.textContent="Лог",A=h(),H=m("li"),L=m("a"),L.textContent="О проекте",T=h(),C=m("ul"),M=m("div"),G(W.$$.fragment),R=h(),G(z.$$.fragment),q=h(),G(j.$$.fragment),F=h(),G(I.$$.fragment),J=h(),G(B.$$.fragment),D=h(),G(Y.$$.fragment),y(n,"class","fixed m-0 h-10 w-full bg-gray-100 shadow-md"),y(s,"id","menu__toggle"),y(s,"type","checkbox"),y(o,"class","menu__btn"),y(o,"for","menu__toggle"),y(l,"class","menu__item"),y(l,"href","/"),y(w,"class","menu__item"),y(w,"href","/config"),y(v,"class","menu__item"),y(v,"href","/connection"),y(S,"class","menu__item"),y(S,"href","/utilities"),y(O,"class","menu__item"),y(O,"href","/log"),y(L,"class","menu__item"),y(L,"href","/about"),y(c,"class","menu__box"),y(M,"class","bg-cover bg-gray-50 pt-8 px-4"),y(C,"class","menu__main")},m(t,f){p(t,e,f),d(e,n),d(e,r),d(e,s),d(e,a),d(e,o),d(e,i),d(e,c),d(c,u),d(u,l),d(c,g),d(c,$),d($,w),d(c,b),d(c,x),d(x,v),d(c,_),d(c,k),d(k,S),d(c,E),d(c,N),d(N,O),d(c,A),d(c,H),d(H,L),d(e,T),d(e,C),d(C,M),U(W,M,null),d(M,R),U(z,M,null),d(M,q),U(j,M,null),d(M,F),U(I,M,null),d(M,J),U(B,M,null),d(M,D),U(Y,M,null),K=!0},p(t,[e]){const n={};8388611&e&&(n.$$scope={dirty:e,ctx:t}),W.$set(n);const r={};8388608&e&&(r.$$scope={dirty:e,ctx:t}),z.$set(r);const s={};8388608&e&&(s.$$scope={dirty:e,ctx:t}),j.$set(s);const a={};8388612&e&&(a.$$scope={dirty:e,ctx:t}),B.$set(a)},i(t){K||(P(W.$$.fragment,t),P(z.$$.fragment,t),P(j.$$.fragment,t),P(I.$$.fragment,t),P(B.$$.fragment,t),P(Y.$$.fragment,t),K=!0)},o(t){Z(W.$$.fragment,t),Z(z.$$.fragment,t),Z(j.$$.fragment,t),Z(I.$$.fragment,t),Z(B.$$.fragment,t),Z(Y.$$.fragment,t),K=!1},d(t){t&&f(e),V(W),V(z),V(j),V(I),V(B),V(Y)}}}function ne(t,e,n){console.log(t,e,n)}function re(t,e,n){gt.mode.hash();let r=document.location.hostname,s=[];s=[{widget:"input",type:"date",status:"2021-10-17",page:"Inputs",order:"4",descr:"Switch on boiler date",topic:"/prefix/00000-00004/date1",ws:1},{widget:"input",type:"time",status:"12:00",page:"Inputs",order:"1",descr:"Switch on boiler time",topic:"/prefix/00000-00001/time",ws:1},{widget:"input",type:"number",status:"30.5",after:"°С",page:"Inputs",order:"2",descr:"Boiler temperature",topic:"/prefix/00000-00002/temp",ws:1},{widget:"input",type:"text",status:"Hello",page:"Inputs",order:"3",descr:"Message to be send",topic:"/prefix/00000-00003/text",ws:1},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn1",ws:1},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn2",ws:1},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn3",ws:1},{widget:"anydata",status:30.5,after:"°С",page:"Any data",order:"3",descr:"Temperature",topic:"/prefix/00000-00003/tmp10",ws:1},{widget:"anydata",status:1032,after:"mm",page:"Any data",order:"3",descr:"Pressure",topic:"/prefix/00000-00003/tmp10",ws:1},{widget:"anydata",status:50,after:"%",page:"Any data",order:"3",descr:"Level",topic:"/prefix/00000-00003/tmp10",ws:1},{widget:"anydata",status:"opened",page:"Any data",order:"3",descr:"Status",topic:"/prefix/00000-00003/tmp10",ws:1}];let a=[],o=[],i=[];const c=t=>{try{t=JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}return t=(t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(function(t){return t}))};function u(){n(1,o=[]);Array.from(new Set(Array.from(s,(({page:t})=>t)))).forEach((function(t,e,r){n(1,o=[...o,JSON.parse(JSON.stringify({page:t}))])})),o.sort((function(t,e){return t.page<e.page?-1:t.page>e.page?1:0}))}N((async()=>{console.log("mounted"),a[0]=new WebSocket("ws://"+r+"/ws"),a[0].addEventListener("open",(function(t){console.log("WS CONNECTED! "+r),a[0].send("HELLO")})),a[0].addEventListener("message",(function(t){console.log("NEW data packet "+r,t.data),l("test",t.data)})),a[0].addEventListener("close",(t=>{console.log("ws close "+r)})),a[0].addEventListener("error",(function(t){console.log(r+" WebSocket error: ",t)})),u()}));const l=(t,e)=>{const n=e.toString(),r=(new Date).getTime();d(t,n,r)},d=(t,e,r)=>{i.length>Number(10)&&n(2,i=i.slice(0)),n(2,i=[...i,{topic:t,msg:e,time:r,colored:c(e),closed:!0}]),i.sort((function(t,e){return t.closed=!0,t.time>e.time?-1:t.time<e.time?1:0}))};return[s,o,i,c,function(){n(0,s=JSON.parse(document.getElementById("text1").value)),u()},function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(0,s))},function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(0,s))},function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(0,s))}]}return new class extends tt{constructor(t){super(),X(this,t,re,ee,a,{})}}({target:document.body,props:{name:"world"}})}();
|
||
//# sourceMappingURL=bundle.js.map
|