From dbe11162e5102fb904feca3681c591b2177fc035 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Fri, 24 Dec 2021 01:26:50 +0100 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=87=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=208266=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_svelte/build/bundle.js | 2 +- include/Global.h | 6 +++++- include/StandWebServer.h | 3 +++ src/Global.cpp | 1 + src/StandWebServer.cpp | 17 ++++++++++++++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/data_svelte/build/bundle.js b/data_svelte/build/bundle.js index ab6ec331..8c51a125 100644 --- a/data_svelte/build/bundle.js +++ b/data_svelte/build/bundle.js @@ -1,2 +1,2 @@ -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 o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function l(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;r32){const e=[],n=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,n,r)}function v(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function _(t){return""===t?null:+t}function k(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function S(t,e){t.value=null==e?"":e}function E(t,e){for(let n=0;n{K.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}}function V(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function X(t){t&&t.c()}function tt(t,n,o,a){const{fragment:l,on_mount:i,on_destroy:c,after_update:u}=t.$$;l&&l.m(n,o),a||q((()=>{const n=i.map(e).filter(s);c?c.push(...n):r(n),t.$$.on_mount=[]})),u.forEach(q)}function et(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 nt(e,s,o,a,l,i,c,u=[-1]){const d=P;N(e);const p=e.$$={fragment:null,ctx:null,props:i,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:s.target||d.$$.root};c&&c(p.root);let f=!1;if(p.ctx=o?o(e,s.props||{},((t,n,...r)=>{const s=r.length?r[0]:n;return p.ctx&&l(p.ctx[t],p.ctx[t]=s)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](s),f&&function(t,e){-1===t.$$.dirty[0]&&(C.push(t),R(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{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 st=[];function ot(e,n=t){let r;const s=new Set;function a(t){if(o(e,t)&&(e=t,r)){const t=!st.length;for(const t of s)t[1](),st.push(t,e);if(t){for(let t=0;t{s.delete(i),0===s.size&&(r(),r=null)}}}}function at(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 lt(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 it(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 ct(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 ut,dt,pt={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}},ft=function(){let t,e=pt.getDeafault(),n=n=>t&&t(gt(e));function r(t){t&&(e=t),window.onhashchange=window.onpopstate=dt=null,e!==pt.OFF&&pt.run(e,(t=>window.onpopstate=n),(t=>window.onhashchange=n))&&n()}return{mode:t=>r(t),get:t=>gt(e),go(t,r){(function(t,e,n){let r=t=>history[n?"replaceState":"pushState"]({},"",t);pt.run(t,(t=>r(e)),(t=>r(`#${e}`)),(t=>dt=e))})(e,t,r),n()},start(e){t=e,r()},stop(){t=null,r(pt.OFF)}}}();function gt(t){let e=ut,n=ut=pt.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>dt||"/")),r=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:r[1]||"",query:ct(r[2]||""),hash:r[3]||""}}function mt(t){let e=H("tinro");e&&(e.exact||e.fallback)&&function(t){throw new Error("[Tinro] "+t)}(`${t.fallback?"":``} can't be inside ${e.fallback?"":` with exact path`}`);let n=t.fallback?"fallbacks":"childs",r=ot({}),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=at(`${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:o,query:a}=s.router,l=function(t,e){t=at(t,!0),e=at(e,!0);let n=[],r={},s=!0,o=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),a=e.match(new RegExp(`^${o}$`));return a||(s=!1,a=e.match(new RegExp(`^${o}`))),a?(n.forEach(((t,e)=>r[t]=a[e+1])),{exact:s,params:r,part:a[0].slice(0,-1)}):null}(s.pattern,e);if(!s.fallback&&l&&s.redirect&&(!s.exact||s.exact&&l.exact)){await j();let t=lt(e,s.parent&&s.parent.pattern,s.redirect);return $t.goto(t,!0)}if(s.meta=l&&{from:o,url:n,query:a,match:l.part,pattern:s.pattern,breadcrumbs:s.parent&&s.parent.meta&&s.parent.meta.breadcrumbs.slice()||[],params:l.params,subscribe:r.subscribe},s.breadcrumb&&s.meta&&s.meta.breadcrumbs.push({name:s.breadcrumb,path:l.part}),r.set(s.meta),!l||s.fallback||!(!s.exact||s.exact&&l.exact)||s.parent&&s.parent.firstmatch&&s.parent.matched?s.hide():(t.onMeta(s.meta),s.parent&&(s.parent.matched=!0),s.show()),await j(),l&&!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=lt("/",t.parent&&t.parent.pattern,t.redirect);$t.goto(e,!0)}else t.show()}))}}};return o="tinro",a=s,O().$$.context.set(o,a),A((()=>s.register())),s.router.un=$t.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 o,a}function ht(){return H("tinro").meta}var $t=function(){let{subscribe:t}=ot(ft.get(),(t=>{ft.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),r=n&&it(n,"target",!1,"_self"),s=n&&it(n,"tinro-ignore"),o=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==r&&!s&&!o&&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)}(ft.go);return()=>{ft.stop(),e()}}));return{subscribe:t,goto:ft.go,params:bt,meta:ht,useHashNavigation:t=>ft.mode(t?pt.HASH:pt.HISTORY),mode:{hash:()=>ft.mode(pt.HASH),history:()=>ft.mode(pt.HISTORY),memory:()=>ft.mode(pt.MEMORY)}}}();function bt(){return H("tinro").meta.params}const wt=t=>({params:2&t,meta:4&t}),yt=t=>({params:t[1],meta:t[2]});function xt(t){let e;const n=t[9].default,r=l(n,t,t[8],yt);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,wt):d(t[8]),yt)},i(t){e||(G(r,t),e=!0)},o(t){U(r,t),e=!1},d(t){r&&r.d(t)}}}function vt(t){let e,n,r=t[0]&&xt(t);return{c(){r&&r.c(),e=y()},m(t,s){r&&r.m(t,s),f(t,e,s),n=!0},p(t,[n]){t[0]?r?(r.p(t,n),1&n&&G(r,1)):(r=xt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(Z(),U(r,1,1,(()=>{r=null})),Q())},i(t){n||(G(r),n=!0)},o(t){U(r),n=!1},d(t){r&&r.d(t),t&&g(e)}}}function _t(t,e,n){let{$$slots:r={},$$scope:s}=e,{path:o="/*"}=e,{fallback:a=!1}=e,{redirect:l=!1}=e,{firstmatch:i=!1}=e,{breadcrumb:c=null}=e,u=!1,d={},p={};const f=mt({fallback:a,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,o=t.path),"fallback"in t&&n(4,a=t.fallback),"redirect"in t&&n(5,l=t.redirect),"firstmatch"in t&&n(6,i=t.firstmatch),"breadcrumb"in t&&n(7,c=t.breadcrumb),"$$scope"in t&&n(8,s=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&f.update({path:o,redirect:l,firstmatch:i,breadcrumb:c})},[u,d,p,o,a,l,i,c,s,r]}class kt extends rt{constructor(t){super(),nt(this,t,_t,vt,o,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function St(t){let e,n,r,s,o;const a=t[2].default,i=l(a,t,t[1],null);return{c(){e=h("div"),n=h("h1"),r=b(t[0]),s=w(),i&&i.c(),v(n,"class","card-header"),v(e,"class","card")},m(t,a){f(t,e,a),p(e,n),p(n,r),p(e,s),i&&i.m(e,null),o=!0},p(t,[e]){(!o||1&e)&&k(r,t[0]),i&&i.p&&(!o||2&e)&&u(i,a,t,t[1],o?c(a,t[1],e,null):d(t[1]),null)},i(t){o||(G(i,t),o=!0)},o(t){U(i,t),o=!1},d(t){t&&g(e),i&&i.d(t)}}}function Et(t,e,n){let{$$slots:r={},$$scope:s}=e,{title:o}=e;return t.$$set=t=>{"title"in t&&n(0,o=t.title),"$$scope"in t&&n(1,s=t.$$scope)},[o,s,r]}class Pt extends rt{constructor(t){super(),nt(this,t,Et,St,o,{title:0})}}function Nt(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"step","0.1"),v(e,"type","number")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[2]),x(e,"input",t[3])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&_(e.value)!==t[0].status&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ot(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","text")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[4]),x(e,"input",t[5])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&e.value!==t[0].status&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function At(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","date")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[6]),x(e,"input",t[7])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ht(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","time")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[8]),x(e,"input",t[9])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ct(e){let n,r,s,o,a,l,i,c,u,d=(e[0].descr?e[0].descr:"")+"",m="number"==e[0].type&&Nt(e),$="text"==e[0].type&&Ot(e),y="date"==e[0].type&&At(e),x="time"==e[0].type&&Ht(e);return{c(){n=h("div"),r=h("div"),s=h("label"),o=b(d),a=w(),l=h("div"),m&&m.c(),i=w(),$&&$.c(),c=w(),y&&y.c(),u=w(),x&&x.c(),v(s,"class","widget-descr-style"),v(r,"class","widget-descr-width"),v(l,"class","widget-width"),v(n,"class","card-items-psn")},m(t,e){f(t,n,e),p(n,r),p(r,s),p(s,o),p(n,a),p(n,l),m&&m.m(l,null),p(l,i),$&&$.m(l,null),p(l,c),y&&y.m(l,null),p(l,u),x&&x.m(l,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&k(o,d),"number"==t[0].type?m?m.p(t,e):(m=Nt(t),m.c(),m.m(l,i)):m&&(m.d(1),m=null),"text"==t[0].type?$?$.p(t,e):($=Ot(t),$.c(),$.m(l,c)):$&&($.d(1),$=null),"date"==t[0].type?y?y.p(t,e):(y=At(t),y.c(),y.m(l,u)):y&&(y.d(1),y=null),"time"==t[0].type?x?x.p(t,e):(x=Ht(t),x.c(),x.m(l,null)):x&&(x.d(1),x=null)},i:t,o:t,d(t){t&&g(n),m&&m.d(),$&&$.d(),y&&y.d(),x&&x.d()}}}function Tt(t,e,n){let{widget:r}=e,{wsPushProp:s=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget),"wsPushProp"in t&&n(1,s=t.wsPushProp)},[r,s,()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=_(this.value),n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class Lt extends rt{constructor(t){super(),nt(this,t,Tt,Ct,o,{widget:0,wsPushProp:1})}}function Mt(e){let n,s,o,a,l,i,c,u,d,m,$,y,_,E,P,N,O,A,H=(e[0].descr?e[0].descr:"")+"";return{c(){n=h("div"),s=h("div"),o=h("label"),a=b(H),l=w(),i=h("div"),c=h("label"),u=h("div"),d=h("input"),$=w(),y=h("div"),_=w(),E=h("div"),v(o,"class","widget-descr-style"),v(s,"class","widget-descr-width"),v(d,"id",m=e[0].topic),v(d,"type","checkbox"),v(d,"class","sr-only"),v(y,"class","block bg-gray-600 w-10 h-6 rounded-full"),v(E,"class",P="dot "+(1==e[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition"),v(u,"class","relative"),v(c,"for",N=e[0].topic),v(c,"class","items-center cursor-pointer"),v(i,"class","widget-width"),v(n,"class","card-items-psn")},m(t,r){f(t,n,r),p(n,s),p(s,o),p(o,a),p(n,l),p(n,i),p(i,c),p(c,u),p(u,d),S(d,e[0].status),p(u,$),p(u,y),p(u,_),p(u,E),O||(A=[x(d,"change",e[2]),x(d,"change",e[3])],O=!0)},p(t,[e]){1&e&&H!==(H=(t[0].descr?t[0].descr:"")+"")&&k(a,H),1&e&&m!==(m=t[0].topic)&&v(d,"id",m),1&e&&S(d,t[0].status),1&e&&P!==(P="dot "+(1==t[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition")&&v(E,"class",P),1&e&&N!==(N=t[0].topic)&&v(c,"for",N)},i:t,o:t,d(t){t&&g(n),O=!1,r(A)}}}function zt(t,e,n){let{widget:r}=e,{wsPushProp:s=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget),"wsPushProp"in t&&n(1,s=t.wsPushProp)},[r,s,()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class It extends rt{constructor(t){super(),nt(this,t,zt,Mt,o,{widget:0,wsPushProp:1})}}function Rt(e){let n,r,s,o,a,l,i,c,u,d,m,$,y=(e[0].descr?e[0].descr:"")+"",x=(e[0].status?e[0].status:"")+"",_=(e[0].after?e[0].after:"")+"";return{c(){n=h("div"),r=h("div"),s=h("label"),o=b(y),a=w(),l=h("div"),i=h("label"),c=b(x),u=w(),d=h("label"),m=b(" "),$=b(_),v(s,"class","widget-descr-style"),v(r,"class","widget-descr-width"),v(i,"class","widget-anydata-style"),v(d,"class","widget-anydata-style"),v(l,"class","widget-width"),v(n,"class","card-items-psn")},m(t,e){f(t,n,e),p(n,r),p(r,s),p(s,o),p(n,a),p(n,l),p(l,i),p(i,c),p(l,u),p(l,d),p(d,m),p(d,$)},p(t,[e]){1&e&&y!==(y=(t[0].descr?t[0].descr:"")+"")&&k(o,y),1&e&&x!==(x=(t[0].status?t[0].status:"")+"")&&k(c,x),1&e&&_!==(_=(t[0].after?t[0].after:"")+"")&&k($,_)},i:t,o:t,d(t){t&&g(n)}}}function jt(t,e,n){let{widget:r}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget)},[r]}class qt extends rt{constructor(t){super(),nt(this,t,jt,Rt,o,{widget:0})}}function Wt(t,e,n){const r=t.slice();return r[44]=e[n],r}function Ft(t,e,n){const r=t.slice();return r[47]=e[n],r[49]=n,r}function Jt(t,e,n){const r=t.slice();return r[50]=e[n],r}function Bt(t,e,n){const r=t.slice();return r[53]=e[n],r[49]=n,r}function Yt(t,e,n){const r=t.slice();return r[55]=e[n],r[56]=e,r[49]=n,r}function Kt(t,e,n){const r=t.slice();return r[44]=e[n],r}function Dt(t){let e,n,r,s,o=t[44].name+"";return{c(){e=h("option"),n=b(o),r=w(),e.__value=s=t[44],e.value=e.__value},m(t,s){f(t,e,s),p(e,n),p(e,r)},p(t,r){64&r[0]&&o!==(o=t[44].name+"")&&k(n,o),64&r[0]&&s!==(s=t[44])&&(e.__value=s,e.value=e.__value)},d(t){t&&g(e)}}}function Zt(t){let e,n,r,s,o="input"===t[55].widget&&Qt(t),a="toggle"===t[55].widget&&Gt(t),l="anydata"===t[55].widget&&Ut(t);return{c(){o&&o.c(),e=w(),a&&a.c(),n=w(),l&&l.c(),r=y()},m(t,i){o&&o.m(t,i),f(t,e,i),a&&a.m(t,i),f(t,n,i),l&&l.m(t,i),f(t,r,i),s=!0},p(t,s){"input"===t[55].widget?o?(o.p(t,s),2&s[0]&&G(o,1)):(o=Qt(t),o.c(),G(o,1),o.m(e.parentNode,e)):o&&(Z(),U(o,1,1,(()=>{o=null})),Q()),"toggle"===t[55].widget?a?(a.p(t,s),2&s[0]&&G(a,1)):(a=Gt(t),a.c(),G(a,1),a.m(n.parentNode,n)):a&&(Z(),U(a,1,1,(()=>{a=null})),Q()),"anydata"===t[55].widget?l?(l.p(t,s),2&s[0]&&G(l,1)):(l=Ut(t),l.c(),G(l,1),l.m(r.parentNode,r)):l&&(Z(),U(l,1,1,(()=>{l=null})),Q())},i(t){s||(G(o),G(a),G(l),s=!0)},o(t){U(o),U(a),U(l),s=!1},d(t){o&&o.d(t),t&&g(e),a&&a.d(t),t&&g(n),l&&l.d(t),t&&g(r)}}}function Qt(t){let e,n,r;function s(e){t[17](e,t[55])}let o={widget:t[55],wsPushProp:t[16]};return void 0!==t[55].status&&(o.value=t[55].status),e=new Lt({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Gt(t){let e,n,r;function s(e){t[19](e,t[55])}let o={widget:t[55],wsPushProp:t[18]};return void 0!==t[55].status&&(o.value=t[55].status),e=new It({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Ut(t){let e,n,r;function s(e){t[20](e,t[55])}let o={widget:t[55]};return void 0!==t[55].status&&(o.value=t[55].status),e=new qt({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Vt(t){let e,n,r=t[55].page===t[53].page&&Zt(t);return{c(){r&&r.c(),e=y()},m(t,s){r&&r.m(t,s),f(t,e,s),n=!0},p(t,n){t[55].page===t[53].page?r?(r.p(t,n),6&n[0]&&G(r,1)):(r=Zt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(Z(),U(r,1,1,(()=>{r=null})),Q())},i(t){n||(G(r),n=!0)},o(t){U(r),n=!1},d(t){r&&r.d(t),t&&g(e)}}}function Xt(t){let e,n,r=t[1],s=[];for(let e=0;eU(s[t],1,1,(()=>{s[t]=null}));return{c(){for(let t=0;tU(a[t],1,1,(()=>{a[t]=null}));return r=new Pt({props:{title:"Редактор JSON",$$slots:{default:[ee]},$$scope:{ctx:t}}}),{c(){e=h("div");for(let t=0;tТип \n Подтип \n Id \n 4',r=w(),s=h("tbody");for(let t=0;tНазвание устройства \n IP адрес \n Идентификатор \n Состояние',r=w(),s=h("tbody");for(let t=0;t",P=w(),N=h("ul"),O=h("li"),A=h("a"),A.textContent="Управление",H=w(),C=h("li"),T=h("a"),T.textContent="Конфигуратор",L=w(),M=h("li"),z=h("a"),z.textContent="Подключение",I=w(),R=h("li"),j=h("a"),j.textContent="Утилиты",W=w(),F=h("li"),J=h("a"),J.textContent="Лог",B=w(),Y=h("li"),K=h("a"),K.textContent="Устройства",D=w(),Z=h("li"),Q=h("a"),Q.textContent="О проекте",V=w(),nt=h("ul"),rt=h("div"),X(st.$$.fragment),ot=w(),X(at.$$.fragment),lt=w(),X(it.$$.fragment),ct=w(),X(ut.$$.fragment),dt=w(),X(pt.$$.fragment),ft=w(),X(gt.$$.fragment),mt=w(),X(ht.$$.fragment),void 0===t[5]&&q((()=>t[14].call(a))),v(o,"class","px-15 py-2"),v(u,"stroke","none"),v(u,"d","M0 0h24v24H0z"),v(d,"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"),v(c,"class",b="h-8 w-8 "+(!0===t[4]?"text-green-500":"text-red-500")),v(c,"width","24"),v(c,"height","24"),v(c,"viewBox","0 0 24 24"),v(c,"stroke-width","2"),v(c,"stroke","currentColor"),v(c,"fill","none"),v(c,"stroke-linecap","round"),v(c,"stroke-linejoin","round"),v(i,"class","px-10 py-1"),v(s,"class","flex justify-end content-center"),v(n,"class","fixed m-0 h-10 w-full bg-gray-100 shadow-md"),v(_,"id","menu__toggle"),v(_,"type","checkbox"),v(S,"class","menu__btn"),v(S,"for","menu__toggle"),v(A,"class","menu__item"),v(A,"href","/"),v(T,"class","menu__item"),v(T,"href","/config"),v(z,"class","menu__item"),v(z,"href","/connection"),v(j,"class","menu__item"),v(j,"href","/utilities"),v(J,"class","menu__item"),v(J,"href","/log"),v(K,"class","menu__item"),v(K,"href","/list"),v(Q,"class","menu__item"),v(Q,"href","/about"),v(N,"class","menu__box"),v(rt,"class","bg-cover bg-gray-50 pt-8 px-4"),v(nt,"class","menu__main")},m(r,g){f(r,e,g),p(e,n),p(n,s),p(s,o),p(o,a);for(let t=0;tn(29,r=t))),$t.mode.hash();let s=document.location.hostname,o=!1,l=[],i=[];l=[{widget:"input",type:"date",status:"2021-10-17",page:"Inputs",order:"4",descr:"Switch on boiler date",topic:"/prefix/00000-00004/date1",ws:0},{widget:"input",type:"time",status:"12:00",page:"Inputs",order:"1",descr:"Switch on boiler time",topic:"/prefix/00000-00001/time",ws:0},{widget:"input",type:"number",status:"30.5",after:"°С",page:"Inputs",order:"2",descr:"Boiler temperature",topic:"/prefix/00000-00002/temp",ws:0},{widget:"input",type:"text",status:"Hello",page:"Inputs",order:"3",descr:"Message to be send",topic:"/prefix/00000-00003/text",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn1",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn2",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn3",ws:0},{widget:"anydata",status:30.5,after:"°С",page:"Any data",order:"3",descr:"Temperature",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:1032,after:"mm",page:"Any data",order:"3",descr:"Pressure",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:50,after:"%",page:"Any data",order:"3",descr:"Level",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:"opened",page:"Any data",order:"3",descr:"Status",topic:"/prefix/00000-00003/tmp10",ws:0}];let c,u,d=[],p=[],f=!1,g={},m=[],h=!0,$={};function b(){let t=0;m.forEach((e=>{e.ws=t,e.status||(y(t),v(t)),t++})),n(6,m),n(4,f=g.status)}function w(t,e){m.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(6,m),n(4,f=g.status)}function y(t){let e=x(t);"error"===e?console.log("[e]","device list wrong"):(p[t]=new WebSocket("ws://"+e+"/ws"),console.log("[i]",e,"started connecting..."))}function x(t){let e="error";return m.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function v(t){if(p[t]){let e=x(t);console.log("[i]",e,"web socket events added"),p[t].addEventListener("open",(function(n){console.log("[i]",e,"completed connecting"),w(t,!0),O()})),p[t].addEventListener("message",(function(t){let e=t.data.toString();console.log("[i]","data:",e)})),p[t].addEventListener("close",(n=>{console.log("[e]",e,"connection closed"),w(t,!1)})),p[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),w(t,!1)}))}else console.log("[e]","socket not exist")}function _(t,e,n){let r=e+" "+n;console.log("[i]","send to ws msg:",r),S(t,r)}function k(){setTimeout(k,1e4),console.log("[i]","----timer tick----"),h||m.forEach((t=>{!function(t){let e=!1;return m.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(y(t.ws),v(t.ws)):S(t.ws,"tst")})),h=!1}function S(t,e){p[t]&&1===p[t].readyState?(p[t].send(e),console.log("[i]",x(t),"msg send success",e)):console.log("[e]",x(t),"msg not send",e)}function E(){n(2,i=[]);Array.from(new Set(Array.from(l,(({page:t})=>t)))).forEach((function(t,e,r){n(2,i=[...i,JSON.parse(JSON.stringify({page:t}))])})),i.sort((function(t,e){return t.pagee.page?1:0}))}function P(){n(4,f=g.status),c=g.ws,console.log("[i]","user selected device:",g.name),g.ip===s&&console.log("[i]","user selected original device",g.name)}function N(){o||(void 0!==$.name&&void 0!==$.ip&&void 0!==$.id?(n(7,$.status=!1,$),m.push($),n(6,m),n(7,$={}),b(),console.log("[i]","selected device:",g)):console.log("[e]","wrong data"))}function O(){void 0!==c&&S(c,u)}m=[{name:"Устройство 1",id:"987654321",ip:"192.168.88.235",status:!1}],$t.subscribe((function(){n(3,d=[]),u=r.path.toString(),console.log("[i]","user on page:",u),O()}));A((async()=>{console.log("[i]","mounted"),b(),k(),n(4,f=g.status),P(),E()}));return[o,l,i,d,f,g,m,$,[],_,function(){n(1,l=JSON.parse(document.getElementById("text1").value)),E()},P,N,t=>{try{t=JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}return t=(t=t.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(){g=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(5,g),n(6,m)},()=>P(),(t,e,n)=>_(t,e,n),function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},(t,e,n)=>_(t,e,n),function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},function(){$.name=this.value,n(7,$)},function(){$.ip=this.value,n(7,$)},function(){$.id=this.value,n(7,$)},()=>(n(0,o=!o),N())]}return new class extends rt{constructor(t){super(),nt(this,t,me,ge,o,{},null,[-1,-1])}}({target:document.body,props:{name:"world"}})}(); +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 o(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function a(e,n,r){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const r=e.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function l(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;r32){const e=[],n=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,n,r)}function v(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function _(t){return""===t?null:+t}function k(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function S(t,e){t.value=null==e?"":e}function E(t,e){for(let n=0;n{K.delete(t),r&&(n&&t.d(1),r())})),t.o(e)}}function V(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function X(t){t&&t.c()}function tt(t,n,o,a){const{fragment:l,on_mount:i,on_destroy:c,after_update:u}=t.$$;l&&l.m(n,o),a||q((()=>{const n=i.map(e).filter(s);c?c.push(...n):r(n),t.$$.on_mount=[]})),u.forEach(q)}function et(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 nt(e,s,o,a,l,i,c,u=[-1]){const d=P;N(e);const p=e.$$={fragment:null,ctx:null,props:i,update:t,not_equal:l,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:s.target||d.$$.root};c&&c(p.root);let f=!1;if(p.ctx=o?o(e,s.props||{},((t,n,...r)=>{const s=r.length?r[0]:n;return p.ctx&&l(p.ctx[t],p.ctx[t]=s)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](s),f&&function(t,e){-1===t.$$.dirty[0]&&(C.push(t),R(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{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 st=[];function ot(e,n=t){let r;const s=new Set;function a(t){if(o(e,t)&&(e=t,r)){const t=!st.length;for(const t of s)t[1](),st.push(t,e);if(t){for(let t=0;t{s.delete(i),0===s.size&&(r(),r=null)}}}}function at(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 lt(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 it(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 ct(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 ut,dt,pt={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}},ft=function(){let t,e=pt.getDeafault(),n=n=>t&&t(gt(e));function r(t){t&&(e=t),window.onhashchange=window.onpopstate=dt=null,e!==pt.OFF&&pt.run(e,(t=>window.onpopstate=n),(t=>window.onhashchange=n))&&n()}return{mode:t=>r(t),get:t=>gt(e),go(t,r){(function(t,e,n){let r=t=>history[n?"replaceState":"pushState"]({},"",t);pt.run(t,(t=>r(e)),(t=>r(`#${e}`)),(t=>dt=e))})(e,t,r),n()},start(e){t=e,r()},stop(){t=null,r(pt.OFF)}}}();function gt(t){let e=ut,n=ut=pt.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>dt||"/")),r=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:r[1]||"",query:ct(r[2]||""),hash:r[3]||""}}function mt(t){let e=H("tinro");e&&(e.exact||e.fallback)&&function(t){throw new Error("[Tinro] "+t)}(`${t.fallback?"":``} can't be inside ${e.fallback?"":` with exact path`}`);let n=t.fallback?"fallbacks":"childs",r=ot({}),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=at(`${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:o,query:a}=s.router,l=function(t,e){t=at(t,!0),e=at(e,!0);let n=[],r={},s=!0,o=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),a=e.match(new RegExp(`^${o}$`));return a||(s=!1,a=e.match(new RegExp(`^${o}`))),a?(n.forEach(((t,e)=>r[t]=a[e+1])),{exact:s,params:r,part:a[0].slice(0,-1)}):null}(s.pattern,e);if(!s.fallback&&l&&s.redirect&&(!s.exact||s.exact&&l.exact)){await j();let t=lt(e,s.parent&&s.parent.pattern,s.redirect);return $t.goto(t,!0)}if(s.meta=l&&{from:o,url:n,query:a,match:l.part,pattern:s.pattern,breadcrumbs:s.parent&&s.parent.meta&&s.parent.meta.breadcrumbs.slice()||[],params:l.params,subscribe:r.subscribe},s.breadcrumb&&s.meta&&s.meta.breadcrumbs.push({name:s.breadcrumb,path:l.part}),r.set(s.meta),!l||s.fallback||!(!s.exact||s.exact&&l.exact)||s.parent&&s.parent.firstmatch&&s.parent.matched?s.hide():(t.onMeta(s.meta),s.parent&&(s.parent.matched=!0),s.show()),await j(),l&&!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=lt("/",t.parent&&t.parent.pattern,t.redirect);$t.goto(e,!0)}else t.show()}))}}};return o="tinro",a=s,O().$$.context.set(o,a),A((()=>s.register())),s.router.un=$t.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 o,a}function ht(){return H("tinro").meta}var $t=function(){let{subscribe:t}=ot(ft.get(),(t=>{ft.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),r=n&&it(n,"target",!1,"_self"),s=n&&it(n,"tinro-ignore"),o=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==r&&!s&&!o&&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)}(ft.go);return()=>{ft.stop(),e()}}));return{subscribe:t,goto:ft.go,params:bt,meta:ht,useHashNavigation:t=>ft.mode(t?pt.HASH:pt.HISTORY),mode:{hash:()=>ft.mode(pt.HASH),history:()=>ft.mode(pt.HISTORY),memory:()=>ft.mode(pt.MEMORY)}}}();function bt(){return H("tinro").meta.params}const wt=t=>({params:2&t,meta:4&t}),yt=t=>({params:t[1],meta:t[2]});function xt(t){let e;const n=t[9].default,r=l(n,t,t[8],yt);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,wt):d(t[8]),yt)},i(t){e||(G(r,t),e=!0)},o(t){U(r,t),e=!1},d(t){r&&r.d(t)}}}function vt(t){let e,n,r=t[0]&&xt(t);return{c(){r&&r.c(),e=y()},m(t,s){r&&r.m(t,s),f(t,e,s),n=!0},p(t,[n]){t[0]?r?(r.p(t,n),1&n&&G(r,1)):(r=xt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(Z(),U(r,1,1,(()=>{r=null})),Q())},i(t){n||(G(r),n=!0)},o(t){U(r),n=!1},d(t){r&&r.d(t),t&&g(e)}}}function _t(t,e,n){let{$$slots:r={},$$scope:s}=e,{path:o="/*"}=e,{fallback:a=!1}=e,{redirect:l=!1}=e,{firstmatch:i=!1}=e,{breadcrumb:c=null}=e,u=!1,d={},p={};const f=mt({fallback:a,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,o=t.path),"fallback"in t&&n(4,a=t.fallback),"redirect"in t&&n(5,l=t.redirect),"firstmatch"in t&&n(6,i=t.firstmatch),"breadcrumb"in t&&n(7,c=t.breadcrumb),"$$scope"in t&&n(8,s=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&f.update({path:o,redirect:l,firstmatch:i,breadcrumb:c})},[u,d,p,o,a,l,i,c,s,r]}class kt extends rt{constructor(t){super(),nt(this,t,_t,vt,o,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function St(t){let e,n,r,s,o;const a=t[2].default,i=l(a,t,t[1],null);return{c(){e=h("div"),n=h("h1"),r=b(t[0]),s=w(),i&&i.c(),v(n,"class","card-header"),v(e,"class","card")},m(t,a){f(t,e,a),p(e,n),p(n,r),p(e,s),i&&i.m(e,null),o=!0},p(t,[e]){(!o||1&e)&&k(r,t[0]),i&&i.p&&(!o||2&e)&&u(i,a,t,t[1],o?c(a,t[1],e,null):d(t[1]),null)},i(t){o||(G(i,t),o=!0)},o(t){U(i,t),o=!1},d(t){t&&g(e),i&&i.d(t)}}}function Et(t,e,n){let{$$slots:r={},$$scope:s}=e,{title:o}=e;return t.$$set=t=>{"title"in t&&n(0,o=t.title),"$$scope"in t&&n(1,s=t.$$scope)},[o,s,r]}class Pt extends rt{constructor(t){super(),nt(this,t,Et,St,o,{title:0})}}function Nt(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"step","0.1"),v(e,"type","number")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[2]),x(e,"input",t[3])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&_(e.value)!==t[0].status&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ot(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","text")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[4]),x(e,"input",t[5])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&e.value!==t[0].status&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function At(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","date")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[6]),x(e,"input",t[7])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ht(t){let e,n,s,o;return{c(){e=h("input"),v(e,"class",n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500"),v(e,"type","time")},m(n,r){f(n,e,r),S(e,t[0].status),s||(o=[x(e,"change",t[8]),x(e,"input",t[9])],s=!0)},p(t,r){1&r&&n!==(n=1==t[0].send?"widget-input border-red-500":"widget-input focus:border-indigo-500")&&v(e,"class",n),1&r&&S(e,t[0].status)},d(t){t&&g(e),s=!1,r(o)}}}function Ct(e){let n,r,s,o,a,l,i,c,u,d=(e[0].descr?e[0].descr:"")+"",m="number"==e[0].type&&Nt(e),$="text"==e[0].type&&Ot(e),y="date"==e[0].type&&At(e),x="time"==e[0].type&&Ht(e);return{c(){n=h("div"),r=h("div"),s=h("label"),o=b(d),a=w(),l=h("div"),m&&m.c(),i=w(),$&&$.c(),c=w(),y&&y.c(),u=w(),x&&x.c(),v(s,"class","widget-descr-style"),v(r,"class","widget-descr-width"),v(l,"class","widget-width"),v(n,"class","card-items-psn")},m(t,e){f(t,n,e),p(n,r),p(r,s),p(s,o),p(n,a),p(n,l),m&&m.m(l,null),p(l,i),$&&$.m(l,null),p(l,c),y&&y.m(l,null),p(l,u),x&&x.m(l,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&k(o,d),"number"==t[0].type?m?m.p(t,e):(m=Nt(t),m.c(),m.m(l,i)):m&&(m.d(1),m=null),"text"==t[0].type?$?$.p(t,e):($=Ot(t),$.c(),$.m(l,c)):$&&($.d(1),$=null),"date"==t[0].type?y?y.p(t,e):(y=At(t),y.c(),y.m(l,u)):y&&(y.d(1),y=null),"time"==t[0].type?x?x.p(t,e):(x=Ht(t),x.c(),x.m(l,null)):x&&(x.d(1),x=null)},i:t,o:t,d(t){t&&g(n),m&&m.d(),$&&$.d(),y&&y.d(),x&&x.d()}}}function Tt(t,e,n){let{widget:r}=e,{wsPushProp:s=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget),"wsPushProp"in t&&n(1,s=t.wsPushProp)},[r,s,()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=_(this.value),n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)},()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class Lt extends rt{constructor(t){super(),nt(this,t,Tt,Ct,o,{widget:0,wsPushProp:1})}}function Mt(e){let n,s,o,a,l,i,c,u,d,m,$,y,_,E,P,N,O,A,H=(e[0].descr?e[0].descr:"")+"";return{c(){n=h("div"),s=h("div"),o=h("label"),a=b(H),l=w(),i=h("div"),c=h("label"),u=h("div"),d=h("input"),$=w(),y=h("div"),_=w(),E=h("div"),v(o,"class","widget-descr-style"),v(s,"class","widget-descr-width"),v(d,"id",m=e[0].topic),v(d,"type","checkbox"),v(d,"class","sr-only"),v(y,"class","block bg-gray-600 w-10 h-6 rounded-full"),v(E,"class",P="dot "+(1==e[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition"),v(u,"class","relative"),v(c,"for",N=e[0].topic),v(c,"class","items-center cursor-pointer"),v(i,"class","widget-width"),v(n,"class","card-items-psn")},m(t,r){f(t,n,r),p(n,s),p(s,o),p(o,a),p(n,l),p(n,i),p(i,c),p(c,u),p(u,d),S(d,e[0].status),p(u,$),p(u,y),p(u,_),p(u,E),O||(A=[x(d,"change",e[2]),x(d,"change",e[3])],O=!0)},p(t,[e]){1&e&&H!==(H=(t[0].descr?t[0].descr:"")+"")&&k(a,H),1&e&&m!==(m=t[0].topic)&&v(d,"id",m),1&e&&S(d,t[0].status),1&e&&P!==(P="dot "+(1==t[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition")&&v(E,"class",P),1&e&&N!==(N=t[0].topic)&&v(c,"for",N)},i:t,o:t,d(t){t&&g(n),O=!1,r(A)}}}function zt(t,e,n){let{widget:r}=e,{wsPushProp:s=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget),"wsPushProp"in t&&n(1,s=t.wsPushProp)},[r,s,()=>(n(0,r.send=!0,r),s(r.ws,r.topic,r.status)),function(){r.status=this.value,n(0,r)}]}class It extends rt{constructor(t){super(),nt(this,t,zt,Mt,o,{widget:0,wsPushProp:1})}}function Rt(e){let n,r,s,o,a,l,i,c,u,d,m,$,y=(e[0].descr?e[0].descr:"")+"",x=(e[0].status?e[0].status:"")+"",_=(e[0].after?e[0].after:"")+"";return{c(){n=h("div"),r=h("div"),s=h("label"),o=b(y),a=w(),l=h("div"),i=h("label"),c=b(x),u=w(),d=h("label"),m=b(" "),$=b(_),v(s,"class","widget-descr-style"),v(r,"class","widget-descr-width"),v(i,"class","widget-anydata-style"),v(d,"class","widget-anydata-style"),v(l,"class","widget-width"),v(n,"class","card-items-psn")},m(t,e){f(t,n,e),p(n,r),p(r,s),p(s,o),p(n,a),p(n,l),p(l,i),p(i,c),p(l,u),p(l,d),p(d,m),p(d,$)},p(t,[e]){1&e&&y!==(y=(t[0].descr?t[0].descr:"")+"")&&k(o,y),1&e&&x!==(x=(t[0].status?t[0].status:"")+"")&&k(c,x),1&e&&_!==(_=(t[0].after?t[0].after:"")+"")&&k($,_)},i:t,o:t,d(t){t&&g(n)}}}function jt(t,e,n){let{widget:r}=e;return t.$$set=t=>{"widget"in t&&n(0,r=t.widget)},[r]}class qt extends rt{constructor(t){super(),nt(this,t,jt,Rt,o,{widget:0})}}function Wt(t,e,n){const r=t.slice();return r[44]=e[n],r}function Ft(t,e,n){const r=t.slice();return r[47]=e[n],r[49]=n,r}function Jt(t,e,n){const r=t.slice();return r[50]=e[n],r}function Bt(t,e,n){const r=t.slice();return r[53]=e[n],r[49]=n,r}function Yt(t,e,n){const r=t.slice();return r[55]=e[n],r[56]=e,r[49]=n,r}function Kt(t,e,n){const r=t.slice();return r[44]=e[n],r}function Dt(t){let e,n,r,s,o=t[44].name+"";return{c(){e=h("option"),n=b(o),r=w(),e.__value=s=t[44],e.value=e.__value},m(t,s){f(t,e,s),p(e,n),p(e,r)},p(t,r){64&r[0]&&o!==(o=t[44].name+"")&&k(n,o),64&r[0]&&s!==(s=t[44])&&(e.__value=s,e.value=e.__value)},d(t){t&&g(e)}}}function Zt(t){let e,n,r,s,o="input"===t[55].widget&&Qt(t),a="toggle"===t[55].widget&&Gt(t),l="anydata"===t[55].widget&&Ut(t);return{c(){o&&o.c(),e=w(),a&&a.c(),n=w(),l&&l.c(),r=y()},m(t,i){o&&o.m(t,i),f(t,e,i),a&&a.m(t,i),f(t,n,i),l&&l.m(t,i),f(t,r,i),s=!0},p(t,s){"input"===t[55].widget?o?(o.p(t,s),2&s[0]&&G(o,1)):(o=Qt(t),o.c(),G(o,1),o.m(e.parentNode,e)):o&&(Z(),U(o,1,1,(()=>{o=null})),Q()),"toggle"===t[55].widget?a?(a.p(t,s),2&s[0]&&G(a,1)):(a=Gt(t),a.c(),G(a,1),a.m(n.parentNode,n)):a&&(Z(),U(a,1,1,(()=>{a=null})),Q()),"anydata"===t[55].widget?l?(l.p(t,s),2&s[0]&&G(l,1)):(l=Ut(t),l.c(),G(l,1),l.m(r.parentNode,r)):l&&(Z(),U(l,1,1,(()=>{l=null})),Q())},i(t){s||(G(o),G(a),G(l),s=!0)},o(t){U(o),U(a),U(l),s=!1},d(t){o&&o.d(t),t&&g(e),a&&a.d(t),t&&g(n),l&&l.d(t),t&&g(r)}}}function Qt(t){let e,n,r;function s(e){t[17](e,t[55])}let o={widget:t[55],wsPushProp:t[16]};return void 0!==t[55].status&&(o.value=t[55].status),e=new Lt({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Gt(t){let e,n,r;function s(e){t[19](e,t[55])}let o={widget:t[55],wsPushProp:t[18]};return void 0!==t[55].status&&(o.value=t[55].status),e=new It({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Ut(t){let e,n,r;function s(e){t[20](e,t[55])}let o={widget:t[55]};return void 0!==t[55].status&&(o.value=t[55].status),e=new qt({props:o}),T.push((()=>V(e,"value",s))),{c(){X(e.$$.fragment)},m(t,n){tt(e,t,n),r=!0},p(r,s){t=r;const o={};2&s[0]&&(o.widget=t[55]),!n&&2&s[0]&&(n=!0,o.value=t[55].status,W((()=>n=!1))),e.$set(o)},i(t){r||(G(e.$$.fragment,t),r=!0)},o(t){U(e.$$.fragment,t),r=!1},d(t){et(e,t)}}}function Vt(t){let e,n,r=t[55].page===t[53].page&&Zt(t);return{c(){r&&r.c(),e=y()},m(t,s){r&&r.m(t,s),f(t,e,s),n=!0},p(t,n){t[55].page===t[53].page?r?(r.p(t,n),6&n[0]&&G(r,1)):(r=Zt(t),r.c(),G(r,1),r.m(e.parentNode,e)):r&&(Z(),U(r,1,1,(()=>{r=null})),Q())},i(t){n||(G(r),n=!0)},o(t){U(r),n=!1},d(t){r&&r.d(t),t&&g(e)}}}function Xt(t){let e,n,r=t[1],s=[];for(let e=0;eU(s[t],1,1,(()=>{s[t]=null}));return{c(){for(let t=0;tU(a[t],1,1,(()=>{a[t]=null}));return r=new Pt({props:{title:"Редактор JSON",$$slots:{default:[ee]},$$scope:{ctx:t}}}),{c(){e=h("div");for(let t=0;tТип \n Подтип \n Id \n 4',r=w(),s=h("tbody");for(let t=0;tНазвание устройства \n IP адрес \n Идентификатор \n Состояние',r=w(),s=h("tbody");for(let t=0;t",P=w(),N=h("ul"),O=h("li"),A=h("a"),A.textContent="Управление",H=w(),C=h("li"),T=h("a"),T.textContent="Конфигуратор",L=w(),M=h("li"),z=h("a"),z.textContent="Подключение",I=w(),R=h("li"),j=h("a"),j.textContent="Утилиты",W=w(),F=h("li"),J=h("a"),J.textContent="Лог",B=w(),Y=h("li"),K=h("a"),K.textContent="Устройства",D=w(),Z=h("li"),Q=h("a"),Q.textContent="О проекте",V=w(),nt=h("ul"),rt=h("div"),X(st.$$.fragment),ot=w(),X(at.$$.fragment),lt=w(),X(it.$$.fragment),ct=w(),X(ut.$$.fragment),dt=w(),X(pt.$$.fragment),ft=w(),X(gt.$$.fragment),mt=w(),X(ht.$$.fragment),void 0===t[5]&&q((()=>t[14].call(a))),v(o,"class","px-15 py-2"),v(u,"stroke","none"),v(u,"d","M0 0h24v24H0z"),v(d,"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"),v(c,"class",b="h-8 w-8 "+(!0===t[4]?"text-green-500":"text-red-500")),v(c,"width","24"),v(c,"height","24"),v(c,"viewBox","0 0 24 24"),v(c,"stroke-width","2"),v(c,"stroke","currentColor"),v(c,"fill","none"),v(c,"stroke-linecap","round"),v(c,"stroke-linejoin","round"),v(i,"class","px-10 py-1"),v(s,"class","flex justify-end content-center"),v(n,"class","fixed m-0 h-10 w-full bg-gray-100 shadow-md"),v(_,"id","menu__toggle"),v(_,"type","checkbox"),v(S,"class","menu__btn"),v(S,"for","menu__toggle"),v(A,"class","menu__item"),v(A,"href","/"),v(T,"class","menu__item"),v(T,"href","/config"),v(z,"class","menu__item"),v(z,"href","/connection"),v(j,"class","menu__item"),v(j,"href","/utilities"),v(J,"class","menu__item"),v(J,"href","/log"),v(K,"class","menu__item"),v(K,"href","/list"),v(Q,"class","menu__item"),v(Q,"href","/about"),v(N,"class","menu__box"),v(rt,"class","bg-cover bg-gray-50 pt-8 px-4"),v(nt,"class","menu__main")},m(r,g){f(r,e,g),p(e,n),p(n,s),p(s,o),p(o,a);for(let t=0;tn(29,r=t))),$t.mode.hash();let s=document.location.hostname,o=!1,l=[],i=[];l=[{widget:"input",type:"date",status:"2021-10-17",page:"Inputs",order:"4",descr:"Switch on boiler date",topic:"/prefix/00000-00004/date1",ws:0},{widget:"input",type:"time",status:"12:00",page:"Inputs",order:"1",descr:"Switch on boiler time",topic:"/prefix/00000-00001/time",ws:0},{widget:"input",type:"number",status:"30.5",after:"°С",page:"Inputs",order:"2",descr:"Boiler temperature",topic:"/prefix/00000-00002/temp",ws:0},{widget:"input",type:"text",status:"Hello",page:"Inputs",order:"3",descr:"Message to be send",topic:"/prefix/00000-00003/text",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn1",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn2",ws:0},{widget:"toggle",status:0,page:"Toggles",order:"3",descr:"Light in my room",topic:"/prefix/00000-00003/btn3",ws:0},{widget:"anydata",status:30.5,after:"°С",page:"Any data",order:"3",descr:"Temperature",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:1032,after:"mm",page:"Any data",order:"3",descr:"Pressure",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:50,after:"%",page:"Any data",order:"3",descr:"Level",topic:"/prefix/00000-00003/tmp10",ws:0},{widget:"anydata",status:"opened",page:"Any data",order:"3",descr:"Status",topic:"/prefix/00000-00003/tmp10",ws:0}];let c,u,d=[],p=[],f=!1,g={},m=[],h=!0,$={};function b(){let t=0;m.forEach((e=>{e.ws=t,e.status||(y(t),v(t)),t++})),n(6,m),n(4,f=g.status)}function w(t,e){m.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(6,m),n(4,f=g.status)}function y(t){let e=x(t);"error"===e?console.log("[e]","device list wrong"):(p[t]=new WebSocket("ws://"+e+":81"),console.log("[i]",e,"started connecting..."))}function x(t){let e="error";return m.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function v(t){if(p[t]){let e=x(t);console.log("[i]",e,"web socket events added"),p[t].addEventListener("open",(function(n){console.log("[i]",e,"completed connecting"),w(t,!0),O()})),p[t].addEventListener("message",(function(t){let e=t.data.toString();console.log("[i]","data:",e)})),p[t].addEventListener("close",(n=>{console.log("[e]",e,"connection closed"),w(t,!1)})),p[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),w(t,!1)}))}else console.log("[e]","socket not exist")}function _(t,e,n){let r=e+" "+n;console.log("[i]","send to ws msg:",r),S(t,r)}function k(){setTimeout(k,6e4),console.log("[i]","----timer tick----"),h||m.forEach((t=>{!function(t){let e=!1;return m.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(y(t.ws),v(t.ws)):S(t.ws,"tst")})),h=!1}function S(t,e){p[t]&&1===p[t].readyState?(p[t].send(e),console.log("[i]",x(t),"msg send success",e)):console.log("[e]",x(t),"msg not send",e)}function E(){n(2,i=[]);Array.from(new Set(Array.from(l,(({page:t})=>t)))).forEach((function(t,e,r){n(2,i=[...i,JSON.parse(JSON.stringify({page:t}))])})),i.sort((function(t,e){return t.pagee.page?1:0}))}function P(){n(4,f=g.status),c=g.ws,console.log("[i]","user selected device:",g.name),g.ip===s&&console.log("[i]","user selected original device",g.name)}function N(){o||(void 0!==$.name&&void 0!==$.ip&&void 0!==$.id?(n(7,$.status=!1,$),m.push($),n(6,m),n(7,$={}),b(),console.log("[i]","selected device:",g)):console.log("[e]","wrong data"))}function O(){void 0!==c&&S(c,u)}m=[{name:"Устройство 1",id:"987654321",ip:"192.168.88.235",status:!1}],$t.subscribe((function(){n(3,d=[]),u=r.path.toString(),console.log("[i]","user on page:",u),O()}));A((async()=>{console.log("[i]","mounted"),b(),k(),n(4,f=g.status),P(),E()}));return[o,l,i,d,f,g,m,$,[],_,function(){n(1,l=JSON.parse(document.getElementById("text1").value)),E()},P,N,t=>{try{t=JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}return t=(t=t.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(){g=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(5,g),n(6,m)},()=>P(),(t,e,n)=>_(t,e,n),function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},(t,e,n)=>_(t,e,n),function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},function(e,r){t.$$.not_equal(r.status,e)&&(r.status=e,n(1,l))},function(){$.name=this.value,n(7,$)},function(){$.ip=this.value,n(7,$)},function(){$.id=this.value,n(7,$)},()=>(n(0,o=!o),N())]}return new class extends rt{constructor(t){super(),nt(this,t,me,ge,o,{},null,[-1,-1])}}({target:document.body,props:{name:"world"}})}(); //# sourceMappingURL=bundle.js.map diff --git a/include/Global.h b/include/Global.h index 7e2d1555..cc6e5fc3 100644 --- a/include/Global.h +++ b/include/Global.h @@ -8,9 +8,10 @@ #include #ifdef ESP32 -#include +#include "WiFi.h" #include #include + #endif #ifdef ESP8266 @@ -34,8 +35,10 @@ #ifdef STANDARD_WEB_SOCKETS #include +#ifdef ESP8266 #include #endif +#endif #include @@ -49,6 +52,7 @@ **********************************************************************************************************************/ extern TickerScheduler ts; +extern WiFiClient espClient; #ifdef ASYNC_WEB_SERVER extern AsyncWebServer server; #endif diff --git a/include/StandWebServer.h b/include/StandWebServer.h index 4f8faadd..9ff24627 100644 --- a/include/StandWebServer.h +++ b/include/StandWebServer.h @@ -19,4 +19,7 @@ extern void handleFileList(); #ifdef STANDARD_WEB_SOCKETS extern void standWebSocketsInit(); extern void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length); +#ifdef ESP32 +extern void hexdump(const void* mem, uint32_t len, uint8_t cols); +#endif #endif \ No newline at end of file diff --git a/src/Global.cpp b/src/Global.cpp index b1810de2..b43c1978 100644 --- a/src/Global.cpp +++ b/src/Global.cpp @@ -5,6 +5,7 @@ **********************************************************************************************************************/ TickerScheduler ts(MYTEST + 1); +WiFiClient espClient; #ifdef ASYNC_WEB_SERVER AsyncWebServer server(80); #endif diff --git a/src/StandWebServer.cpp b/src/StandWebServer.cpp index bec4cbf9..7e1906c5 100644 --- a/src/StandWebServer.cpp +++ b/src/StandWebServer.cpp @@ -224,7 +224,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) case WStype_BIN: { Serial.printf("[%u] get binary length: %u\n", num, length); - hexdump(payload, length); + //hexdump(payload, length); // send message to client // standWebSocket.sendBIN(num, payload, length); @@ -232,4 +232,19 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) } } +#ifdef ESP32 +void hexdump(const void* mem, uint32_t len, uint8_t cols = 16) { + const uint8_t* src = (const uint8_t*)mem; + Serial.printf("\n[HEXDUMP] Address: 0x%08X len: 0x%X (%d)", (ptrdiff_t)src, len, len); + for (uint32_t i = 0; i < len; i++) { + if (i % cols == 0) { + Serial.printf("\n[0x%08X] 0x%08X: ", (ptrdiff_t)src, i); + } + Serial.printf("%02X ", *src); + src++; + } + Serial.printf("\n"); +} +#endif + #endif