diff --git a/data_svelte/build/bundle.js b/data_svelte/build/bundle.js
index f6bbfddb..d3a6b6d7 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 s(t){t.forEach(e)}function i(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 a(t,e,n,s){if(t){const i=l(t,e,n,s);return t[0](i)}}function l(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 c(t,e,n,s){if(t[2]&&s){const i=t[2](s(n));if(void 0===e.dirty)return i;if("object"==typeof i){const t=[],n=Math.max(e.dirty.length,i.length);for(let s=0;s32){const e=[],n=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,n,s)}function $(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function k(t){return""===t?null:+t}function O(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function A(t,e){t.value=null==e?"":e}function L(t,e){for(let n=0;nt.call(this,e)))}const D=[],E=[],j=[],J=[],H=Promise.resolve();let z=!1;function F(){z||(z=!0,H.then(Y))}function q(){return F(),H}function W(t){j.push(t)}function R(t){J.push(t)}const I=new Set;let B=0;function Y(){const t=P;do{for(;B{U.delete(t),s&&(n&&t.d(1),s())})),t.o(e)}else s&&s()}function tt(t,e,n){const s=t.$$.props[e];void 0!==s&&(t.$$.bound[s]=n,n(t.$$.ctx[s]))}function et(t){t&&t.c()}function nt(t,n,r,o){const{fragment:a,on_mount:l,on_destroy:c,after_update:u}=t.$$;a&&a.m(n,r),o||W((()=>{const n=l.map(e).filter(i);c?c.push(...n):s(n),t.$$.on_mount=[]})),u.forEach(W)}function st(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 it(e,i,r,o,a,l,c,u=[-1]){const d=P;M(e);const p=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:a,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:i.target||d.$$.root};c&&c(p.root);let h=!1;if(p.ctx=r?r(e,i.props||{},((t,n,...s)=>{const i=s.length?s[0]:n;return p.ctx&&a(p.ctx[t],p.ctx[t]=i)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](i),h&&function(t,e){-1===t.$$.dirty[0]&&(D.push(t),F(),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 ot=[];function at(e,n=t){let s;const i=new Set;function o(t){if(r(e,t)&&(e=t,s)){const t=!ot.length;for(const t of i)t[1](),ot.push(t,e);if(t){for(let t=0;t{i.delete(l),0===i.size&&(s(),s=null)}}}}function lt(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 ct(t,e,n){if(""===n)return t;if("/"===n[0])return n;let s=t=>t.split("/").filter((t=>""!==t)),i=s(t);return"/"+(e?s(e):[]).map(((t,e)=>i[e])).join("/")+"/"+n}function ut(t,e,n,s){let i=[e,"data-"+e].reduce(((e,s)=>{let i=t.getAttribute(s);return n&&t.removeAttribute(s),null===i?e:i}),!1);return!s&&""===i||(i||s||!1)}function dt(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 pt,ht,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=ht=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=>ht=e))})(e,t,s),n()},start(e){t=e,s()},stop(){t=null,s(ft.OFF)}}}();function mt(t){let e=pt,n=pt=ft.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>ht||"/")),s=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:s[1]||"",query:dt(s[2]||""),hash:s[3]||""}}function vt(t){let e=N("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",s=at({}),i={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){i.exact=!t.path.endsWith("/*"),i.pattern=lt(`${i.parent&&i.parent.pattern||""}${t.path}`),i.redirect=t.redirect,i.firstmatch=t.firstmatch,i.breadcrumb=t.breadcrumb,i.match()},register:()=>{if(i.parent)return i.parent[n].add(i),()=>{i.parent[n].delete(i),i.router.un&&i.router.un()}},show:()=>{t.onShow(),!i.fallback&&i.parent&&i.parent.activeChilds.add(i)},hide:()=>{t.onHide(),!i.fallback&&i.parent&&i.parent.activeChilds.delete(i)},match:async()=>{i.matched=!1;let{path:e,url:n,from:r,query:o}=i.router,a=function(t,e){t=lt(t,!0),e=lt(e,!0);let n=[],s={},i=!0,r=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),o=e.match(new RegExp(`^${r}$`));return o||(i=!1,o=e.match(new RegExp(`^${r}`))),o?(n.forEach(((t,e)=>s[t]=o[e+1])),{exact:i,params:s,part:o[0].slice(0,-1)}):null}(i.pattern,e);if(!i.fallback&&a&&i.redirect&&(!i.exact||i.exact&&a.exact)){await q();let t=ct(e,i.parent&&i.parent.pattern,i.redirect);return bt.goto(t,!0)}if(i.meta=a&&{from:r,url:n,query:o,match:a.part,pattern:i.pattern,breadcrumbs:i.parent&&i.parent.meta&&i.parent.meta.breadcrumbs.slice()||[],params:a.params,subscribe:s.subscribe},i.breadcrumb&&i.meta&&i.meta.breadcrumbs.push({name:i.breadcrumb,path:a.part}),s.set(i.meta),!a||i.fallback||!(!i.exact||i.exact&&a.exact)||i.parent&&i.parent.firstmatch&&i.parent.matched?i.hide():(t.onMeta(i.meta),i.parent&&(i.parent.matched=!0),i.show()),await q(),a&&!i.fallback&&(i.childs.size>0&&0==i.activeChilds.size||0==i.childs.size&&i.fallbacks.size>0)){let t=i;for(;0==t.fallbacks.size;)if(t=t.parent,!t)return;t&&t.fallbacks.forEach((t=>{if(t.redirect){let e=ct("/",t.parent&&t.parent.pattern,t.redirect);bt.goto(e,!0)}else t.show()}))}}};return r="tinro",o=i,C().$$.context.set(r,o),S((()=>i.register())),i.router.un=bt.subscribe((t=>{i.router.path=t.path,i.router.url=t.url,i.router.query=t.query,i.router.from=t.from,null!==i.pattern&&i.match()})),i;var r,o}function yt(){return N("tinro").meta}var bt=function(){let{subscribe:t}=at(gt.get(),(t=>{gt.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),s=n&&ut(n,"target",!1,"_self"),i=n&&ut(n,"tinro-ignore"),r=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==s&&!i&&!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:xt,meta:yt,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 xt(){return N("tinro").meta.params}const wt=t=>({params:2&t,meta:4&t}),$t=t=>({params:t[1],meta:t[2]});function kt(t){let e;const n=t[9].default,s=a(n,t,t[8],$t);return{c(){s&&s.c()},m(t,n){s&&s.m(t,n),e=!0},p(t,i){s&&s.p&&(!e||262&i)&&u(s,n,t,t[8],e?c(n,t[8],i,wt):d(t[8]),$t)},i(t){e||(Q(s,t),e=!0)},o(t){Z(s,t),e=!1},d(t){s&&s.d(t)}}}function Ot(t){let e,n,s=t[0]&&kt(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,[n]){t[0]?s?(s.p(t,n),1&n&&Q(s,1)):(s=kt(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function At(t,e,n){let{$$slots:s={},$$scope:i}=e,{path:r="/*"}=e,{fallback:o=!1}=e,{redirect:a=!1}=e,{firstmatch:l=!1}=e,{breadcrumb:c=null}=e,u=!1,d={},p={};const h=vt({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,a=t.redirect),"firstmatch"in t&&n(6,l=t.firstmatch),"breadcrumb"in t&&n(7,c=t.breadcrumb),"$$scope"in t&&n(8,i=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&h.update({path:r,redirect:a,firstmatch:l,breadcrumb:c})},[u,d,p,r,o,a,l,c,i,s]}class Lt extends rt{constructor(t){super(),it(this,t,At,Ot,r,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function Tt(e){let n,s,r,o,a;return{c(){n=v("svg"),s=v("line"),r=v("line"),$(s,"x1","18"),$(s,"y1","6"),$(s,"x2","6"),$(s,"y2","18"),$(r,"x1","6"),$(r,"y1","6"),$(r,"x2","18"),$(r,"y2","18"),$(n,"class","h-6 w-6 text-red-400 cursor-pointer"),$(n,"viewBox","0 -2 24 24"),$(n,"fill","none"),$(n,"stroke","currentColor"),$(n,"stroke-width","2"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,l){h(t,n,l),p(n,s),p(n,r),o||(a=w(n,"click",(function(){i(e[0]())&&e[0]().apply(this,arguments)})),o=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&f(n),o=!1,a()}}}function Pt(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class Mt extends rt{constructor(t){super(),it(this,t,Pt,Tt,r,{click:0})}}function Ct(t){let e,n,s,i,r,o,a,l;return a=new Mt({props:{click:t[5]}}),{c(){e=m("div"),n=m("div"),s=m("h1"),i=y(t[0]),r=b(),o=m("div"),et(a.$$.fragment),$(s,"class","alm-hdr"),$(n,"class","w-11/12"),$(o,"class","flex justify-end w-1/12"),$(e,"class","flex items-center")},m(t,c){h(t,e,c),p(e,n),p(n,s),p(s,i),p(e,r),p(e,o),nt(a,o,null),l=!0},p(t,e){(!l||1&e)&&O(i,t[0]);const n={};4&e&&(n.click=t[5]),a.$set(n)},i(t){l||(Q(a.$$.fragment,t),l=!0)},o(t){Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(a)}}}function St(e){let n,s;return{c(){n=m("h1"),s=y(e[0]),$(n,"class","alm-hdr")},m(t,e){h(t,n,e),p(n,s)},p(t,e){1&e&&O(s,t[0])},i:t,o:t,d(t){t&&f(n)}}}function Nt(t){let e,n,s,i,r;const o=[St,Ct],l=[];function g(t,e){return t[0]&&!t[1]?0:t[0]&&t[1]?1:-1}~(n=g(t))&&(s=l[n]=o[n](t));const v=t[4].default,y=a(v,t,t[3],null);return{c(){e=m("div"),s&&s.c(),i=b(),y&&y.c(),$(e,"class","alm")},m(t,s){h(t,e,s),~n&&l[n].m(e,null),p(e,i),y&&y.m(e,null),r=!0},p(t,[a]){let p=n;n=g(t),n===p?~n&&l[n].p(t,a):(s&&(X(),Z(l[p],1,1,(()=>{l[p]=null})),K()),~n?(s=l[n],s?s.p(t,a):(s=l[n]=o[n](t),s.c()),Q(s,1),s.m(e,i)):s=null),y&&y.p&&(!r||8&a)&&u(y,v,t,t[3],r?c(v,t[3],a,null):d(t[3]),null)},i(t){r||(Q(s),Q(y,t),r=!0)},o(t){Z(s),Z(y,t),r=!1},d(t){t&&f(e),~n&&l[n].d(),y&&y.d(t)}}}function _t(t,e,n){let{$$slots:s={},$$scope:i}=e,{title:r=!1}=e,{cross:o=!1}=e,{close:a=(()=>{})}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"cross"in t&&n(1,o=t.cross),"close"in t&&n(2,a=t.close),"$$scope"in t&&n(3,i=t.$$scope)},[r,o,a,i,s,()=>a()]}class Dt extends rt{constructor(t){super(),it(this,t,_t,Nt,r,{title:0,cross:1,close:2})}}function Et(e){let n;return{c(){n=m("div"),n.innerHTML='',$(n,"class","fixed z-10 inset-0 overflow-y-auto"),$(n,"aria-labelledby","modal-title"),$(n,"role","dialog"),$(n,"aria-modal","true")},m(t,e){h(t,n,e)},p:t,i:t,o:t,d(t){t&&f(n)}}}class jt extends rt{constructor(t){super(),it(this,t,null,Et,r,{})}}function Jt(t){let e,n,s,i=t[0]&&Ht(t);const r=t[3].default,o=a(r,t,t[2],null);return{c(){e=m("div"),i&&i.c(),n=b(),o&&o.c(),$(e,"class","crd")},m(t,r){h(t,e,r),i&&i.m(e,null),p(e,n),o&&o.m(e,null),s=!0},p(t,a){t[0]?i?i.p(t,a):(i=Ht(t),i.c(),i.m(e,n)):i&&(i.d(1),i=null),o&&o.p&&(!s||4&a)&&u(o,r,t,t[2],s?c(r,t[2],a,null):d(t[2]),null)},i(t){s||(Q(o,t),s=!0)},o(t){Z(o,t),s=!1},d(t){t&&f(e),i&&i.d(),o&&o.d(t)}}}function Ht(t){let e,n;return{c(){e=m("h1"),n=y(t[0]),$(e,"class","crd-hdr")},m(t,s){h(t,e,s),p(e,n)},p(t,e){1&e&&O(n,t[0])},d(t){t&&f(e)}}}function zt(t){let e,n,s=t[1]&&Jt(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,[n]){t[1]?s?(s.p(t,n),2&n&&Q(s,1)):(s=Jt(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Ft(t,e,n){let{$$slots:s={},$$scope:i}=e,{title:r=!1}=e,{show:o=!0}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"show"in t&&n(1,o=t.show),"$$scope"in t&&n(2,i=t.$$scope)},[r,o,i,s]}class qt extends rt{constructor(t){super(),it(this,t,Ft,zt,r,{title:0,show:1})}}function Wt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"step","0.1"),$(e,"type","number")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[4]),w(e,"input",t[5])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&k(e.value)!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function Rt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","text")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[6]),w(e,"input",t[7])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&e.value!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function It(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","date")},m(n,s){h(n,e,s),A(e,t[2]),i||(r=[w(e,"change",t[8]),w(e,"input",t[9])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),4&s&&A(e,t[2])},d(t){t&&f(e),i=!1,s(r)}}}function Bt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","time")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[10]),w(e,"input",t[11])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function Yt(e){let n,s,i,r,o,a,l,c,u,d=(e[0].descr?e[0].descr:"")+"",g="number"==e[0].type&&Wt(e),v="text"==e[0].type&&Rt(e),x="date"==e[0].type&&It(e),w="time"==e[0].type&&Bt(e);return{c(){n=m("div"),s=m("div"),i=m("label"),r=y(d),o=b(),a=m("div"),g&&g.c(),l=b(),v&&v.c(),c=b(),x&&x.c(),u=b(),w&&w.c(),$(i,"class","wgt-dscr-stl"),$(s,"class","w-2/3"),$(a,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,e){h(t,n,e),p(n,s),p(s,i),p(i,r),p(n,o),p(n,a),g&&g.m(a,null),p(a,l),v&&v.m(a,null),p(a,c),x&&x.m(a,null),p(a,u),w&&w.m(a,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&O(r,d),"number"==t[0].type?g?g.p(t,e):(g=Wt(t),g.c(),g.m(a,l)):g&&(g.d(1),g=null),"text"==t[0].type?v?v.p(t,e):(v=Rt(t),v.c(),v.m(a,c)):v&&(v.d(1),v=null),"date"==t[0].type?x?x.p(t,e):(x=It(t),x.c(),x.m(a,u)):x&&(x.d(1),x=null),"time"==t[0].type?w?w.p(t,e):(w=Bt(t),w.c(),w.m(a,null)):w&&(w.d(1),w=null)},i:t,o:t,d(t){t&&f(n),g&&g.d(),v&&v.d(),x&&x.d(),w&&w.d()}}}function Vt(t,e,n){if(-1==t.indexOf(e))return"not found";t+=e;let s=0;do{if(s==n)return Ut(t,e);t=Gt(t,e),s++}while(0!=t.length);return"not found"}function Ut(t,e){let n=t.indexOf(e);return t.substring(0,n)}function Gt(t,e){let n=t.indexOf(e)+e.length;return t.substring(n)}function Xt(t,e,n){let s,{widget:i}=e,{wsPush:r=((t,e,n)=>{})}=e;function o(){n(0,i.status=Vt(s,"-",2)+"."+Vt(s,"-",1)+"."+Vt(s,"-",0),i),r(i.ws,i.topic,i.status)}return t.$$set=t=>{"widget"in t&&n(0,i=t.widget),"wsPush"in t&&n(1,r=t.wsPush)},t.$$.update=()=>{1&t.$$.dirty&&(i.status,function(){let t=i.status;n(2,s=Vt(t,".",2)+"-"+Vt(t,".",1)+"-"+Vt(t,".",0))}())},[i,r,s,o,()=>(n(0,i.sent=!0,i),r(i.ws,i.topic,i.status)),function(){i.status=k(this.value),n(0,i)},()=>(n(0,i.sent=!0,i),r(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)},()=>(n(0,i.sent=!0,i),o()),function(){s=this.value,n(2,s)},()=>(n(0,i.sent=!0,i),r(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)}]}class Kt extends rt{constructor(t){super(),it(this,t,Xt,Yt,r,{widget:0,wsPush:1})}}function Qt(e){let n,i,r,o,a,l,c,u,d,g,v,x=(e[0].descr?e[0].descr:"")+"",k=e[0].after+"";return{c(){n=m("label"),i=y(x),r=b(),o=y(e[1]),a=b(),l=y(k),c=b(),u=m("input"),$(n,"class","wgt-dscr-stl"),$(u,"class",d="form-range range-secondary w-full h-2 p-0 rounded-lg "+(e[0].sent?"bg-red-300":"bg-gray-300")+" focus:outline-none appearance-none"),$(u,"type","range"),$(u,"min","0"),$(u,"max","1024")},m(t,s){h(t,n,s),p(n,i),p(n,r),p(n,o),p(n,a),p(n,l),h(t,c,s),h(t,u,s),A(u,e[0].status),g||(v=[w(u,"change",e[3]),w(u,"input",e[3]),w(u,"change",e[4])],g=!0)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&O(i,x),2&e&&O(o,t[1]),1&e&&k!==(k=t[0].after+"")&&O(l,k),1&e&&d!==(d="form-range range-secondary w-full h-2 p-0 rounded-lg "+(t[0].sent?"bg-red-300":"bg-gray-300")+" focus:outline-none appearance-none")&&$(u,"class",d),1&e&&A(u,t[0].status)},i:t,o:t,d(t){t&&f(n),t&&f(c),t&&f(u),g=!1,s(v)}}}function Zt(t,e,n){let{widget:s}=e,{wsPush:i=((t,e,n)=>{})}=e,{val:r=0}=e;function o(){n(1,r=function(t,e,n,s,i){return Math.round((t-e)*(i-s)/(n-e)+s)}(s.status,0,1024,s.min,s.max))}return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"wsPush"in t&&n(2,i=t.wsPush),"val"in t&&n(1,r=t.val)},t.$$.update=()=>{1&t.$$.dirty&&(s.status,o())},[s,r,i,function(){s.status=k(this.value),n(0,s)},()=>(n(0,s.sent=!0,s),i(s.ws,s.topic,s.status))]}class te extends rt{constructor(t){super(),it(this,t,Zt,Qt,r,{widget:0,wsPush:2,val:1})}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var ee,ne,se=(ee=function(t,e){t.exports=function(){function t(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function e(t){var e=t.getBoundingClientRect();return{top:e.top+(document.documentElement.scrollTop||document.body.scrollTop),left:e.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}}function n(t){return null===t.offsetParent}function s(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function i(t){var e=window.getComputedStyle(t),n=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.clientWidth-n}function r(t,e,n){var s=document.createEvent("HTMLEvents");for(var i in s.initEvent(e,!0,!0),n)s[i]=n[i];return t.dispatchEvent(s)}function o(t){return t.titleHeight+t.margins.top+t.paddings.top}function a(t){return t.margins.left+t.paddings.left}function l(t){return t.margins.top+t.margins.bottom+t.paddings.top+t.paddings.bottom+t.titleHeight+t.legendHeight}function c(t){return t.margins.left+t.margins.right+t.paddings.left+t.paddings.right}function u(t){return parseFloat(t.toFixed(2))}function d(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n||(n=s?t[0]:t[t.length-1]);var i=new Array(Math.abs(e)).fill(n);return s?i.concat(t):t.concat(i)}function p(t,e){return(t+"").length*e}function h(t,e){return{x:Math.sin(t*Qt)*e,y:Math.cos(t*Qt)*e}}function f(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(Number.isNaN(t)||void 0===t||!Number.isFinite(t)||e&&t<0)}function g(t){return Number(Math.round(t+"e4")+"e-4")}function m(t){var e=void 0,n=void 0,s=void 0;if(t instanceof Date)return new Date(t.getTime());if("object"!==(void 0===t?"undefined":Ht(t))||null===t)return t;for(s in e=Array.isArray(t)?[]:{},t)n=t[s],e[s]=m(n);return e}function v(t,e){var n=void 0,s=void 0;return t<=e?(n=e-t,s=t):(n=t-e,s=e),[n,s]}function y(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-t.length;return n>0?t=d(t,n):e=d(e,n),[t,e]}function b(t,e){if(t)return t.length>e?t.slice(0,e-3)+"...":t}function x(t){var e=void 0;if("number"==typeof t)e=t;else if("string"==typeof t&&(e=Number(t),Number.isNaN(e)))return t;var n=Math.floor(Math.log10(Math.abs(e)));if(n<=2)return e;var s=Math.floor(n/3),i=Math.pow(10,n-3*s)*+(e/Math.pow(10,n)).toFixed(1);return Math.round(100*i)/100+" "+["","K","M","B","T"][s]}function w(t,e){for(var n=[],s=0;s255?255:t<0?0:t}function k(t,e){var n=ee(t),s=!1;"#"==n[0]&&(n=n.slice(1),s=!0);var i=parseInt(n,16),r=$((i>>16)+e),o=$((i>>8&255)+e);return(s?"#":"")+($((255&i)+e)|o<<8|r<<16).toString(16)}function O(t){var e=/(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i;return/(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i.test(t)||e.test(t)}function A(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function L(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg",t);for(var s in e){var i=e[s];if("inside"===s)A(i).appendChild(n);else if("around"===s){var r=A(i);r.parentNode.insertBefore(n,r),n.appendChild(r)}else"styles"===s?"object"===(void 0===i?"undefined":Ht(i))&&Object.keys(i).map((function(t){n.style[t]=i[t]})):("className"===s&&(s="class"),"innerHTML"===s?n.textContent=i:n.setAttribute(s,i))}return n}function T(t,e){return L("linearGradient",{inside:t,id:e,x1:0,x2:0,y1:0,y2:1})}function P(t,e,n,s){return L("stop",{inside:t,style:"stop-color: "+n,offset:e,"stop-opacity":s})}function M(t,e,n,s){return L("svg",{className:e,inside:t,width:n,height:s})}function C(t){return L("defs",{inside:t})}function S(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n={className:t,transform:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""};return e&&(n.inside=e),L("g",n)}function N(t){return L("path",{className:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",d:t,styles:{stroke:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"none",fill:arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none","stroke-width":arguments.length>4&&void 0!==arguments[4]?arguments[4]:2}})}function _(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=n.y+e.y;return"M"+n.x+" "+n.y+"\n\t\tL"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+" z"}function D(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=2*n.y,u=n.y+e.y;return"M"+n.x+" "+n.y+"\n\t\tL"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+" z\n\t\tL"+o+" "+c+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+u+" z"}function E(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return"M"+(n.x+t.x)+" "+(n.y+t.y)+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+(n.x+e.x)+" "+(n.y+e.y)}function j(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=2*s+a;return"M"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+"\n\t\tM"+o+" "+c+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+(n.y+t.y)}function J(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s="path-fill-gradient-"+e+"-"+(n?"lighter":"default"),i=T(t,s),r=[1,.6,.2];return n&&(r=[.4,.2,0]),P(i,"0%",e,r[0]),P(i,"50%",e,r[1]),P(i,"100%",e,r[2]),s}function H(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ut,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none";return L("rect",{className:"percentage-bar",x:t,y:e,width:n,height:s,fill:r,styles:{stroke:k(r,-25),"stroke-dasharray":"0, "+(s+n)+", "+n+", "+s,"stroke-width":i}})}function z(t,e,n,s,i){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},o={className:t,x:e,y:n,width:s,height:s,rx:i,fill:arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none"};return Object.keys(r).map((function(t){o[t]=r[t]})),L("rect",o)}function F(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",i=arguments[4];i=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(i,ie):i;var r={className:"legend-bar",x:0,y:0,width:n,height:"2px",fill:s},o=L("text",{className:"legend-dataset-text",x:0,y:0,dy:2*re+"px","font-size":1.2*re+"px","text-anchor":"start",fill:ae,innerHTML:i}),a=L("g",{transform:"translate("+t+", "+e+")"});return a.appendChild(L("rect",r)),a.appendChild(o),a}function q(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",i=arguments[4];i=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(i,ie):i;var r={className:"legend-dot",cx:0,cy:0,r:n,fill:s},o=L("text",{className:"legend-dataset-text",x:0,y:0,dx:re+"px",dy:re/3+"px","font-size":1.2*re+"px","text-anchor":"start",fill:ae,innerHTML:i}),a=L("g",{transform:"translate("+t+", "+e+")"});return a.appendChild(L("circle",r)),a.appendChild(o),a}function W(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=i.fontSize||re;return L("text",{className:t,x:e,y:n,dy:(void 0!==i.dy?i.dy:r/2)+"px","font-size":r+"px",fill:i.fill||ae,"text-anchor":i.textAnchor||"start",innerHTML:s})}function R(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};i.stroke||(i.stroke=oe);var r=L("line",{className:"line-vertical "+i.className,x1:0,x2:0,y1:n,y2:s,styles:{stroke:i.stroke}}),o=L("text",{x:0,y:n>s?n+se:n-se-re,dy:re+"px","font-size":re+"px","text-anchor":"middle",innerHTML:e+""}),a=L("g",{transform:"translate("+t+", 0)"});return a.appendChild(r),a.appendChild(o),a}function I(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};i.stroke||(i.stroke=oe),i.lineType||(i.lineType=""),i.shortenNumbers&&(e=x(e));var r=L("line",{className:"line-horizontal "+i.className+("dashed"===i.lineType?"dashed":""),x1:n,x2:s,y1:0,y2:0,styles:{stroke:i.stroke}}),o=L("text",{x:n3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),s.pos||(s.pos="left"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=oe),s.className||(s.className="");var i=-1*ne,r="span"===s.mode?n+ne:0;return"tick"===s.mode&&"right"===s.pos&&(i=n+ne,r=n),I(t,e,i+=s.offset,r+=s.offset,{stroke:s.stroke,className:s.className,lineType:s.lineType,shortenNumbers:s.shortenNumbers})}function Y(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),s.pos||(s.pos="bottom"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=oe),s.className||(s.className="");var i=n+ne,r="span"===s.mode?-1*ne:n;return"tick"===s.mode&&"top"===s.pos&&(i=-1*ne,r=0),R(t,e,i,r,{stroke:s.stroke,className:s.className,lineType:s.lineType})}function V(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s.labelPos||(s.labelPos="right");var i=L("text",{className:"chart-label",x:"left"===s.labelPos?se:n-p(e,5)-se,y:0,dy:re/-2+"px","font-size":re+"px","text-anchor":"start",innerHTML:e+""}),r=I(t,"",0,n,{stroke:s.stroke||oe,className:s.className||"",lineType:s.lineType});return r.appendChild(i),r}function U(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=t-e,o=L("rect",{className:"bar mini",styles:{fill:"rgba(228, 234, 239, 0.49)",stroke:oe,"stroke-dasharray":n+", "+r},x:0,y:0,width:n,height:r});i.labelPos||(i.labelPos="right");var a=L("text",{className:"chart-label",x:"left"===i.labelPos?se:n-p(s+"",4.5)-se,y:0,dy:re/-2+"px","font-size":re+"px","text-anchor":"start",innerHTML:s+""}),l=L("g",{transform:"translate(0, "+e+")"});return l.appendChild(o),l.appendChild(a),l}function G(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},l=v(e,a.zeroLine),c=It(l,2),u=c[0],d=c[1];d-=o,0===u&&(u=a.minHeight,d-=a.minHeight),f(t)||(t=0),f(d)||(d=0),f(u,!0)||(u=0),f(n,!0)||(n=0);var p=L("rect",{className:"bar mini",style:"fill: "+s,"data-point-index":r,x:t,y:d,width:n,height:u});if((i+="")||i.length){p.setAttribute("y",0),p.setAttribute("x",0);var h=L("text",{className:"data-point-value",x:n/2,y:0,dy:re/2*-1+"px","font-size":re+"px","text-anchor":"middle",innerHTML:i}),g=L("g",{"data-point-index":r,transform:"translate("+t+", "+d+")"});return g.appendChild(p),g.appendChild(h),g}return p}function X(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=L("circle",{style:"fill: "+s,"data-point-index":r,cx:t,cy:e,r:n});if((i+="")||i.length){o.setAttribute("cy",0),o.setAttribute("cx",0);var a=L("text",{className:"data-point-value",x:0,y:0,dy:re/2*-1-n+"px","font-size":re+"px","text-anchor":"middle",innerHTML:i}),l=L("g",{"data-point-index":r,transform:"translate("+t+", "+e+")"});return l.appendChild(o),l.appendChild(a),l}return o}function K(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=e.map((function(e,n){return t[n]+","+e})).join("L");s.spline&&(r=w(t,e));var o=N("M"+r,"line-graph-path",n);if(s.heatline){var a=J(i.svgDefs,n);o.style.stroke="url(#"+a+")"}var l={path:o};if(s.regionFill){var c=J(i.svgDefs,n,!0),u="M"+t[0]+","+i.zeroLine+"L"+r+"L"+t.slice(-1)[0]+","+i.zeroLine;l.region=N(u,"region-fill","none","url(#"+c+")")}return l}function Q(t,e,n,s){var i="string"==typeof e?e:e.join(", ");return[t,{transform:n.join(", ")},s,fe,"translate",{transform:i}]}function Z(t,e,n){return Q(t,[n,0],[e,0],pe)}function tt(t,e,n){return Q(t,[0,n],[0,e],pe)}function et(t,e,n,s){var i=e-n,r=t.childNodes[0];return[[r,{height:i,"stroke-dasharray":r.getAttribute("width")+", "+i},pe,fe],Q(t,[0,s],[0,n],pe)]}function nt(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=v(n,(arguments.length>5&&void 0!==arguments[5]?arguments[5]:{}).zeroLine),o=It(r,2),a=o[0],l=o[1];return l-=i,"rect"!==t.nodeName?[[t.childNodes[0],{width:s,height:a},ue,fe],Q(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,l],pe)]:[[t,{width:s,height:a,x:e,y:l},ue,fe]]}function st(t,e,n){return"circle"!==t.nodeName?[Q(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,n],pe)]:[[t,{cx:e,cy:n},ue,fe]]}function it(t,e,n,s,i){var r=[],o=n.map((function(t,n){return e[n]+","+t})).join("L");i&&(o=w(e,n));var a=[t.path,{d:"M"+o},de,fe];if(r.push(a),t.region){var l=e[0]+","+s+"L",c="L"+e.slice(-1)[0]+", "+s,u=[t.region,{d:"M"+l+o+c},de,fe];r.push(u)}return r}function rt(t,e){return[t,{d:e},ue,fe]}function ot(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"linear",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=t.cloneNode(!0),a=t.cloneNode(!0);for(var l in e){var c=void 0;c="transform"===l?document.createElementNS("http://www.w3.org/2000/svg","animateTransform"):document.createElementNS("http://www.w3.org/2000/svg","animate");var u=r[l]||t.getAttribute(l),d=e[l],p={attributeName:l,from:u,to:d,begin:"0s",dur:n/1e3+"s",values:u+";"+d,keySplines:ge[s],keyTimes:"0;1",calcMode:"spline",fill:"freeze"};for(var h in i&&(p.type=i),p)c.setAttribute(h,p[h]);o.appendChild(c),i?a.setAttribute(l,"translate("+d+")"):a.setAttribute(l,d)}return[o,a]}function at(t,e){t.style.transform=e,t.style.webkitTransform=e,t.style.msTransform=e,t.style.mozTransform=e,t.style.oTransform=e}function lt(t,e){var n=[],s=[];e.map((function(t){var e=t[0],i=e.parentNode,r=void 0,o=void 0;t[0]=e;var a=ot.apply(void 0,Bt(t)),l=It(a,2);r=l[0],o=l[1],n.push(o),s.push([r,i]),i&&i.replaceChild(r,e)}));var i=t.cloneNode(!0);return s.map((function(t,s){t[1]&&(t[1].replaceChild(n[s],t[0]),e[s][0]=n[s])})),i}function ct(t,e,n){if(0!==n.length){var s=lt(e,n);e.parentNode==t&&(t.removeChild(e),t.appendChild(s)),setTimeout((function(){s.parentNode==t&&(t.removeChild(s),t.appendChild(e))}),he)}}function ut(t,e){var n=document.createElement("a");n.style="display: none";var s=new Blob(e,{type:"image/svg+xml; charset=utf-8"}),i=window.URL.createObjectURL(s);n.href=i,n.download=t,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(i)}),300)}function dt(e){var n=e.cloneNode(!0);n.classList.add("chart-container"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");var s=t.create("style",{innerHTML:me});n.insertBefore(s,n.firstChild);var i=t.create("div");return i.appendChild(n),i.innerHTML}function pt(t){var e=new Date(t);return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e}function ht(t){var e=t.getDate(),n=t.getMonth()+1;return[t.getFullYear(),(n>9?"":"0")+n,(e>9?"":"0")+e].join("-")}function ft(t){return new Date(t.getTime())}function gt(t,e){var n=xt(t);return Math.ceil(mt(n,e)/be)}function mt(t,e){var n=we*xe;return(pt(e)-pt(t))/n}function vt(t,e){return t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}function yt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=$e[t];return e?n.slice(0,3):n}function bt(t,e){return new Date(e,t+1,0)}function xt(t){var e=ft(t),n=e.getDay();return 0!==n&&wt(e,-1*n),e}function wt(t,e){t.setDate(t.getDate()+e)}function $t(t,e,n){var s=Object.keys(Ae).filter((function(e){return t.includes(e)})),i=Ae[s[0]];return Object.assign(i,{constants:e,getData:n}),new Oe(i)}function kt(t){if(0===t)return[0,0];if(isNaN(t))return{mantissa:-6755399441055744,exponent:972};var e=t>0?1:-1;if(!isFinite(t))return{mantissa:4503599627370496*e,exponent:972};t=Math.abs(t);var n=Math.floor(Math.log10(t));return[e*(t/Math.pow(10,n)),n]}function Ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Math.ceil(t),s=Math.floor(e),i=n-s,r=i,o=1;i>5&&(i%2!=0&&(i=++n-s),r=i/2,o=2),i<=2&&(o=i/(r=4)),0===i&&(r=5,o=1);for(var a=[],l=0;l<=r;l++)a.push(s+o*l);return a}function At(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=kt(t),s=It(n,2),i=s[0],r=s[1],o=e?e/Math.pow(10,r):0,a=Ot(i=i.toFixed(6),o);return a.map((function(t){return t*Math.pow(10,r)}))}function Lt(t){function e(t,e){for(var n=At(t),s=n[1]-n[0],i=0,r=1;i1&&void 0!==arguments[1]&&arguments[1],s=Math.max.apply(Math,Bt(t)),i=Math.min.apply(Math,Bt(t)),r=[];if(s>=0&&i>=0)kt(s)[1],r=n?At(s,i):At(s);else if(s>0&&i<0){var o=Math.abs(i);s>=o?(kt(s)[1],r=e(s,o)):(kt(o)[1],r=e(o,s).reverse().map((function(t){return-1*t})))}else if(s<=0&&i<=0){var a=Math.abs(i),l=Math.abs(s);kt(a)[1],r=(r=n?At(a,l):At(a)).reverse().map((function(t){return-1*t}))}return r}function Tt(t){var e=Pt(t);return t.indexOf(0)>=0?t.indexOf(0):t[0]>0?-1*t[0]/e:-1*t[t.length-1]/e+(t.length-1)}function Pt(t){return t[1]-t[0]}function Mt(t){return t[t.length-1]-t[0]}function Ct(t,e){return u(e.zeroLine-t*e.scaleMultiplier)}function St(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e.reduce((function(e,n){return Math.abs(n-t)n?s.slice(0,n):d(s,n-s.length,0),t.values=s}else t.values=i;t.chartType||(t.chartType=e)})),t.yRegions&&t.yRegions.map((function(t){if(t.end1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=t/e.length;s<=0&&(s=1);var i=s/Gt,r=void 0;if(n){var o=Math.max.apply(Math,Bt(e.map((function(t){return t.length}))));r=Math.ceil(o/i)}return e.map((function(t,e){return(t+="").length>i&&(n?e%r!=0&&(t=""):t=i-3>0?t.slice(0,i-3)+" ...":t.slice(0,i)+".."),t}))}function Jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"line",e=arguments[1],n=arguments[2];return"axis-mixed"===t?(n.type="line",new Me(e,n)):Se[t]?new Se[t](e,n):void console.error("Undefined chart type: "+t)}!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&s.firstChild?s.insertBefore(i,s.firstChild):s.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}('.chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ol,.graph-svg-tip ul{padding-left:0;display:-webkit-box;display:-ms-flexbox;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:" ";border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}');var Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ft=function(){function t(t,e){for(var n=0;n\n\t\t\t\t\n\t\t\t\t'}),this.hideTip(),this.title=this.container.querySelector(".title"),this.dataPointList=this.container.querySelector(".data-point-list"),this.parent.addEventListener("mouseleave",(function(){e.hideTip()}))}},{key:"fill",value:function(){var e=this,n=void 0;this.index&&this.container.setAttribute("data-point-index",this.index),n=this.titleValueFirst?""+this.titleValue+""+this.titleName:this.titleName+""+this.titleValue+"",this.title.innerHTML=n,this.dataPointList.innerHTML="",this.listValues.map((function(n,s){var i=e.colors[s]||"black",r=0===n.formatted||n.formatted?n.formatted:n.value,o=t.create("li",{styles:{"border-top":"3px solid "+i},innerHTML:''+(0===r||r?r:"")+"\n\t\t\t\t\t"+(n.title?n.title:"")});e.dataPointList.appendChild(o)}))}},{key:"calcPosition",value:function(){var t=this.container.offsetWidth;this.top=this.y-this.container.offsetHeight-5,this.left=this.x-t/2;var e=this.parent.offsetWidth-t,n=this.container.querySelector(".svg-pointer");if(this.left<0)n.style.left="calc(50% - "+-1*this.left+"px)",this.left=0;else if(this.left>e){var s="calc(50% + "+(this.left-e)+"px)";n.style.left=s,this.left=e}else n.style.left="50%"}},{key:"setValues",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;this.titleName=n.name,this.titleValue=n.value,this.listValues=s,this.x=t,this.y=e,this.titleValueFirst=n.valueFirst||0,this.index=i,this.refresh()}},{key:"hideTip",value:function(){this.container.style.top="0px",this.container.style.left="0px",this.container.style.opacity="0"}},{key:"showTip",value:function(){this.container.style.top=this.top+"px",this.container.style.left=this.left+"px",this.container.style.opacity="1"}}]),e}(),te={"light-blue":"#7cd6fd",blue:"#5e64ff",violet:"#743ee2",red:"#ff5858",orange:"#ffa00a",yellow:"#feef72",green:"#28a745","light-green":"#98d85b",purple:"#b554ff",magenta:"#ffa3ef",black:"#36114C",grey:"#bdd3e6","light-grey":"#f0f4f7","dark-grey":"#b8c2cc"},ee=function(t){return/rgb[a]{0,1}\([\d, ]+\)/gim.test(t)?/\D+(\d*)\D+(\d*)\D+(\d*)/gim.exec(t).map((function(t,e){return 0!==e?Number(t).toString(16):"#"})).reduce((function(t,e){return""+t+e})):te[t]||t},ne=6,se=4,ie=15,re=10,oe="#dadada",ae="#555b51",le={bar:function(t){var e=void 0;"rect"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode();return n.style.fill="#000000",n.style.opacity="0.4",e&&n.setAttribute("transform",e),n},dot:function(t){var e=void 0;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode(),s=t.getAttribute("r"),i=t.getAttribute("fill");return n.setAttribute("r",parseInt(s)+4),n.setAttribute("fill",i),n.style.opacity="0.6",e&&n.setAttribute("transform",e),n},heat_square:function(t){var e=void 0;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode(),s=t.getAttribute("r"),i=t.getAttribute("fill");return n.setAttribute("r",parseInt(s)+4),n.setAttribute("fill",i),n.style.opacity="0.6",e&&n.setAttribute("transform",e),n}},ce={bar:function(t,e){var n=void 0;"rect"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["x","y","width","height"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)},dot:function(t,e){var n=void 0;"circle"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["cx","cy"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)},heat_square:function(t,e){var n=void 0;"circle"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["cx","cy"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)}},ue=350,de=350,pe=ue,he=250,fe="easein",ge={ease:"0.25 0.1 0.25 1",linear:"0 0 1 1",easein:"0.1 0.8 0.2 1",easeout:"0 0 0.58 1",easeinout:"0.42 0 0.58 1"},me=".chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans','Droid Sans','Helvetica Neue',sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ul{padding-left:0;display:flex}.graph-svg-tip ol{padding-left:0;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:' ';border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}",ve=function(){function e(t,n){if(zt(this,e),n=m(n),this.parent="string"==typeof t?document.querySelector(t):t,!(this.parent instanceof HTMLElement))throw new Error("No `parent` element to render on was provided.");this.rawChartArgs=n,this.title=n.title||"",this.type=n.type||"",this.realData=this.prepareData(n.data),this.data=this.prepareFirstData(this.realData),this.colors=this.validateColors(n.colors,this.type),this.config={showTooltip:1,showLegend:1,isNavigable:n.isNavigable||0,animate:void 0!==n.animate?n.animate:1,truncateLegends:n.truncateLegends||1},this.measures=JSON.parse(JSON.stringify(Yt));var s=this.measures;this.setMeasures(n),this.title.length||(s.titleHeight=0),this.config.showLegend||(s.legendHeight=0),this.argHeight=n.height||s.baseHeight,this.state={},this.options={},this.initTimeout=Vt,this.config.isNavigable&&(this.overlays=[]),this.configure(n)}return Ft(e,[{key:"prepareData",value:function(t){return t}},{key:"prepareFirstData",value:function(t){return t}},{key:"validateColors",value:function(t,e){var n=[];return(t=(t||[]).concat(Kt[e])).forEach((function(t){var e=ee(t);O(e)?n.push(e):console.warn('"'+t+'" is not a valid color.')})),n}},{key:"setMeasures",value:function(){}},{key:"configure",value:function(){var t=this,e=this.argHeight;this.baseHeight=e,this.height=e-l(this.measures),this.boundDrawFn=function(){return t.draw(!0)},ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.boundDrawFn),this.resizeObserver.observe(this.parent)),window.addEventListener("resize",this.boundDrawFn),window.addEventListener("orientationchange",this.boundDrawFn)}},{key:"destroy",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),window.removeEventListener("resize",this.boundDrawFn),window.removeEventListener("orientationchange",this.boundDrawFn)}},{key:"setup",value:function(){this.makeContainer(),this.updateWidth(),this.makeTooltip(),this.draw(!1,!0)}},{key:"makeContainer",value:function(){this.parent.innerHTML="";var e={inside:this.parent,className:"chart-container"};this.independentWidth&&(e.styles={width:this.independentWidth+"px"}),this.container=t.create("div",e)}},{key:"makeTooltip",value:function(){this.tip=new Zt({parent:this.container,colors:this.colors}),this.bindTooltip()}},{key:"bindTooltip",value:function(){}},{key:"draw",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&n(this.parent)||(this.updateWidth(),this.calc(e),this.makeChartArea(),this.setupComponents(),this.components.forEach((function(e){return e.setup(t.drawArea)})),this.render(this.components,!1),s&&(this.data=this.realData,setTimeout((function(){t.update(t.data)}),this.initTimeout)),this.renderLegend(),this.setupNavigation(s))}},{key:"calc",value:function(){}},{key:"updateWidth",value:function(){this.baseWidth=i(this.parent),this.width=this.baseWidth-c(this.measures)}},{key:"makeChartArea",value:function(){this.svg&&this.container.removeChild(this.svg);var t=this.measures;this.svg=M(this.container,"frappe-chart chart",this.baseWidth,this.baseHeight),this.svgDefs=C(this.svg),this.title.length&&(this.titleEL=W("title",t.margins.left,t.margins.top,this.title,{fontSize:t.titleFontSize,fill:"#666666",dy:t.titleFontSize}));var e=o(t);this.drawArea=S(this.type+"-chart chart-draw-area","translate("+a(t)+", "+e+")"),this.config.showLegend&&(e+=this.height+t.paddings.bottom,this.legendArea=S("chart-legend","translate("+a(t)+", "+e+")")),this.title.length&&this.svg.appendChild(this.titleEL),this.svg.appendChild(this.drawArea),this.config.showLegend&&this.svg.appendChild(this.legendArea),this.updateTipOffset(a(t),o(t))}},{key:"updateTipOffset",value:function(t,e){this.tip.offset={x:t,y:e}}},{key:"setupComponents",value:function(){this.components=new Map}},{key:"update",value:function(t){t||console.error("No data to update."),this.data=this.prepareData(t),this.calc(),this.render(this.components,this.config.animate),this.renderLegend()}},{key:"render",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.components,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.config.isNavigable&&this.overlays.map((function(t){return t.parentNode.removeChild(t)}));var s=[];e.forEach((function(t){s=s.concat(t.update(n))})),s.length>0?(ct(this.container,this.svg,s),setTimeout((function(){e.forEach((function(t){return t.make()})),t.updateNav()}),400)):(e.forEach((function(t){return t.make()})),this.updateNav())}},{key:"updateNav",value:function(){this.config.isNavigable&&(this.makeOverlay(),this.bindUnits())}},{key:"renderLegend",value:function(){}},{key:"setupNavigation",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.config.isNavigable&&e&&(this.bindOverlay(),this.keyActions={13:this.onEnterKey.bind(this),37:this.onLeftArrow.bind(this),38:this.onUpArrow.bind(this),39:this.onRightArrow.bind(this),40:this.onDownArrow.bind(this)},document.addEventListener("keydown",(function(e){s(t.container)&&(e=e||window.event,t.keyActions[e.keyCode]&&t.keyActions[e.keyCode]())})))}},{key:"makeOverlay",value:function(){}},{key:"updateOverlay",value:function(){}},{key:"bindOverlay",value:function(){}},{key:"bindUnits",value:function(){}},{key:"onLeftArrow",value:function(){}},{key:"onRightArrow",value:function(){}},{key:"onUpArrow",value:function(){}},{key:"onDownArrow",value:function(){}},{key:"onEnterKey",value:function(){}},{key:"addDataPoint",value:function(){}},{key:"removeDataPoint",value:function(){}},{key:"getDataPoint",value:function(){}},{key:"setCurrentDataPoint",value:function(){}},{key:"updateDataset",value:function(){}},{key:"export",value:function(){var t=dt(this.svg);ut(this.title||"Chart",[t])}}]),e}(),ye=function(t){function e(t,n){return zt(this,e),Rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n))}return Wt(e,t),Ft(e,[{key:"configure",value:function(t){qt(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"configure",this).call(this,t),this.config.formatTooltipY=(t.tooltipOptions||{}).formatTooltipY,this.config.maxSlices=t.maxSlices||20,this.config.maxLegendPoints=t.maxLegendPoints||20}},{key:"calc",value:function(){var t=this,e=this.state,n=this.config.maxSlices;e.sliceTotals=[];var s=this.data.labels.map((function(e,n){var s=0;return t.data.datasets.map((function(t){s+=t.values[n]})),[s,e]})).filter((function(t){return t[0]>=0})),i=s;if(s.length>n){s.sort((function(t,e){return e[0]-t[0]})),i=s.slice(0,n-1);var r=0;s.slice(n-1).map((function(t){r+=t[0]})),i.push([r,"Rest"]),this.colors[n-1]="grey"}e.labels=[],i.map((function(t){e.sliceTotals.push(g(t[0])),e.labels.push(t[1])})),e.grandTotal=e.sliceTotals.reduce((function(t,e){return t+e}),0),this.center={x:this.width/2,y:this.height/2}}},{key:"renderLegend",value:function(){var t=this,e=this.state;this.legendArea.textContent="",this.legendTotals=e.sliceTotals.slice(0,this.config.maxLegendPoints);var n=0,s=0;this.legendTotals.map((function(i,r){var o=150,a=Math.floor((t.width-c(t.measures))/o);t.legendTotals.lengtha&&(n=0,s+=20);var l=o*n+5,u=t.config.truncateLegends?b(e.labels[r],o/10):e.labels[r],d=t.config.formatTooltipY?t.config.formatTooltipY(i):i,p=q(l,s,5,t.colors[r],u+": "+d,!1);t.legendArea.appendChild(p),n++}))}}]),e}(ve),be=7,xe=1e3,we=86400,$e=["January","February","March","April","May","June","July","August","September","October","November","December"],ke=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Oe=function(){function t(e){var n=e.layerClass,s=void 0===n?"":n,i=e.layerTransform,r=void 0===i?"":i,o=e.constants,a=e.getData,l=e.makeElements,c=e.animateElements;zt(this,t),this.layerTransform=r,this.constants=o,this.makeElements=l,this.getData=a,this.animateElements=c,this.store=[],this.labels=[],this.layerClass=s,this.layerClass="function"==typeof this.layerClass?this.layerClass():this.layerClass,this.refresh()}return Ft(t,[{key:"refresh",value:function(t){this.data=t||this.getData()}},{key:"setup",value:function(t){this.layer=S(this.layerClass,this.layerTransform,t)}},{key:"make",value:function(){this.render(this.data),this.oldData=this.data}},{key:"render",value:function(t){var e=this;this.store=this.makeElements(t),this.layer.textContent="",this.store.forEach((function(t){e.layer.appendChild(t)})),this.labels.forEach((function(t){e.layer.appendChild(t)}))}},{key:"update",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.refresh();var e=[];return t&&(e=this.animateElements(this.data)||[]),e}}]),t}(),Ae={donutSlices:{layerClass:"donut-slices",makeElements:function(t){return t.sliceStrings.map((function(e,n){var s=N(e,"donut-path",t.colors[n],"none",t.strokeWidth);return s.style.transition="transform .3s;",s}))},animateElements:function(t){return this.store.map((function(e,n){return rt(e,t.sliceStrings[n])}))}},pieSlices:{layerClass:"pie-slices",makeElements:function(t){return t.sliceStrings.map((function(e,n){var s=N(e,"pie-path","none",t.colors[n]);return s.style.transition="transform .3s;",s}))},animateElements:function(t){return this.store.map((function(e,n){return rt(e,t.sliceStrings[n])}))}},percentageBars:{layerClass:"percentage-bars",makeElements:function(t){var e=this;return t.xPositions.map((function(n,s){return H(n,0,t.widths[s],e.constants.barHeight,e.constants.barDepth,t.colors[s])}))},animateElements:function(t){if(t)return[]}},yAxis:{layerClass:"y axis",makeElements:function(t){var e=this;return t.positions.map((function(n,s){return B(n,t.labels[s],e.constants.width,{mode:e.constants.mode,pos:e.constants.pos,shortenNumbers:e.constants.shortenNumbers})}))},animateElements:function(t){var e=t.positions,n=t.labels,s=this.oldData.positions,i=this.oldData.labels,r=y(s,e),o=It(r,2);s=o[0],e=o[1];var a=y(i,n),l=It(a,2);return i=l[0],n=l[1],this.render({positions:s,labels:n}),this.store.map((function(t,n){return tt(t,e[n],s[n])}))}},xAxis:{layerClass:"x axis",makeElements:function(t){var e=this;return t.positions.map((function(n,s){return Y(n,t.calcLabels[s],e.constants.height,{mode:e.constants.mode,pos:e.constants.pos})}))},animateElements:function(t){var e=t.positions,n=t.calcLabels,s=this.oldData.positions,i=this.oldData.calcLabels,r=y(s,e),o=It(r,2);s=o[0],e=o[1];var a=y(i,n),l=It(a,2);return i=l[0],n=l[1],this.render({positions:s,calcLabels:n}),this.store.map((function(t,n){return Z(t,e[n],s[n])}))}},yMarkers:{layerClass:"y-markers",makeElements:function(t){var e=this;return t.map((function(t){return V(t.position,t.label,e.constants.width,{labelPos:t.options.labelPos,mode:"span",lineType:"dashed"})}))},animateElements:function(t){var e=y(this.oldData,t),n=It(e,2);this.oldData=n[0];var s=(t=n[1]).map((function(t){return t.position})),i=t.map((function(t){return t.label})),r=t.map((function(t){return t.options})),o=this.oldData.map((function(t){return t.position}));return this.render(o.map((function(t,e){return{position:o[e],label:i[e],options:r[e]}}))),this.store.map((function(t,e){return tt(t,s[e],o[e])}))}},yRegions:{layerClass:"y-regions",makeElements:function(t){var e=this;return t.map((function(t){return U(t.startPos,t.endPos,e.constants.width,t.label,{labelPos:t.options.labelPos})}))},animateElements:function(t){var e=y(this.oldData,t),n=It(e,2);this.oldData=n[0];var s=(t=n[1]).map((function(t){return t.endPos})),i=t.map((function(t){return t.label})),r=t.map((function(t){return t.startPos})),o=t.map((function(t){return t.options})),a=this.oldData.map((function(t){return t.endPos})),l=this.oldData.map((function(t){return t.startPos}));this.render(a.map((function(t,e){return{startPos:l[e],endPos:a[e],label:i[e],options:o[e]}})));var c=[];return this.store.map((function(t,e){c=c.concat(et(t,r[e],s[e],a[e]))})),c}},heatDomain:{layerClass:function(){return"heat-domain domain-"+this.constants.index},makeElements:function(t){var e=this,n=this.constants,s=n.index,i=n.colWidth,r=n.rowHeight,o=n.squareSize,a=n.radius,l=n.xTranslate,c=0;return this.serializedSubDomains=[],t.cols.map((function(t,n){1===n&&e.labels.push(W("domain-name",l,-12,yt(s,!0).toUpperCase(),{fontSize:9})),t.map((function(t,n){if(t.fill){var s={"data-date":t.yyyyMmDd,"data-value":t.dataValue,"data-day":n},i=z("day",l,c,o,a,t.fill,s);e.serializedSubDomains.push(i)}c+=r})),c=0,l+=i})),this.serializedSubDomains},animateElements:function(t){if(t)return[]}},barGraph:{layerClass:function(){return"dataset-units dataset-bars dataset-"+this.constants.index},makeElements:function(t){var e=this.constants;return this.unitType="bar",this.units=t.yPositions.map((function(n,s){return G(t.xPositions[s],n,t.barWidth,e.color,t.labels[s],s,t.offsets[s],{zeroLine:t.zeroLine,barsWidth:t.barsWidth,minHeight:e.minHeight})})),this.units},animateElements:function(t){var e=t.xPositions,n=t.yPositions,s=t.offsets,i=t.labels,r=this.oldData.xPositions,o=this.oldData.yPositions,a=this.oldData.offsets,l=this.oldData.labels,c=y(r,e),u=It(c,2);r=u[0],e=u[1];var d=y(o,n),p=It(d,2);o=p[0],n=p[1];var h=y(a,s),f=It(h,2);a=f[0],s=f[1];var g=y(l,i),m=It(g,2);l=m[0],i=m[1],this.render({xPositions:r,yPositions:o,offsets:a,labels:i,zeroLine:this.oldData.zeroLine,barsWidth:this.oldData.barsWidth,barWidth:this.oldData.barWidth});var v=[];return this.store.map((function(i,r){v=v.concat(nt(i,e[r],n[r],t.barWidth,s[r],{zeroLine:t.zeroLine}))})),v}},lineGraph:{layerClass:function(){return"dataset-units dataset-line dataset-"+this.constants.index},makeElements:function(t){var e=this.constants;return this.unitType="dot",this.paths={},e.hideLine||(this.paths=K(t.xPositions,t.yPositions,e.color,{heatline:e.heatline,regionFill:e.regionFill,spline:e.spline},{svgDefs:e.svgDefs,zeroLine:t.zeroLine})),this.units=[],e.hideDots||(this.units=t.yPositions.map((function(n,s){return X(t.xPositions[s],n,t.radius,e.color,e.valuesOverPoints?t.values[s]:"",s)}))),Object.values(this.paths).concat(this.units)},animateElements:function(t){var e=t.xPositions,n=t.yPositions,s=t.values,i=this.oldData.xPositions,r=this.oldData.yPositions,o=this.oldData.values,a=y(i,e),l=It(a,2);i=l[0],e=l[1];var c=y(r,n),u=It(c,2);r=u[0],n=u[1];var d=y(o,s),p=It(d,2);o=p[0],s=p[1],this.render({xPositions:i,yPositions:r,values:s,zeroLine:this.oldData.zeroLine,radius:this.oldData.radius});var h=[];return Object.keys(this.paths).length&&(h=h.concat(it(this.paths,e,n,t.zeroLine,this.constants.spline))),this.units.length&&this.units.map((function(t,s){h=h.concat(st(t,e[s],n[s]))})),h}}},Le=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="percentage",s.setup(),s}return Wt(n,t),Ft(n,[{key:"setMeasures",value:function(t){var e=this.measures;this.barOptions=t.barOptions||{};var n=this.barOptions;n.height=n.height||20,n.depth=n.depth||Ut,e.paddings.right=30,e.legendHeight=60,e.baseHeight=8*(n.height+.5*n.depth)}},{key:"setupComponents",value:function(){var t=this.state,e=[["percentageBars",{barHeight:this.barOptions.height,barDepth:this.barOptions.depth},function(){return{xPositions:t.xPositions,widths:t.widths,colors:this.colors}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;e.xPositions=[],e.widths=[];var s=0;e.sliceTotals.map((function(n){var i=t.width*n/e.grandTotal;e.widths.push(i),e.xPositions.push(s),s+=i}))}},{key:"makeDataByIndex",value:function(){}},{key:"bindTooltip",value:function(){var t=this,n=this.state;this.container.addEventListener("mousemove",(function(s){var i=t.components.get("percentageBars").store,r=s.target;if(i.includes(r)){var o=i.indexOf(r),a=e(t.container),l=e(r),c=l.left-a.left+parseInt(r.getAttribute("width"))/2,u=l.top-a.top,d=(t.formattedLabels&&t.formattedLabels.length>0?t.formattedLabels[o]:t.state.labels[o])+": ",p=n.sliceTotals[o]/n.grandTotal;t.tip.setValues(c,u,{name:d,value:(100*p).toFixed(1)+"%"}),t.tip.showTip()}}))}}]),n}(ye),Te=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="pie",s.initTimeout=0,s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),this.mouseMove=this.mouseMove.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.hoverRadio=t.hoverRadio||.1,this.config.startAngle=t.startAngle||0,this.clockWise=t.clockWise||!1}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;this.radius=this.height>this.width?this.center.x:this.center.y;var s=this.radius,i=this.clockWise,r=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var o=180-this.config.startAngle;e.sliceTotals.map((function(n,a){var l=o,c=n/e.grandTotal*360,u=c>180?1:0,d=i?-c:c,p=o+=d,f=h(l,s),g=h(p,s),m=t.init&&r[a],v=void 0,y=void 0;t.init?(v=m?m.startPosition:f,y=m?m.endPosition:f):(v=f,y=g);var b=360===c?D(v,y,t.center,t.radius,i,u):_(v,y,t.center,t.radius,i,u);e.sliceStrings.push(b),e.slicesProperties.push({startPosition:f,endPosition:g,value:n,total:e.grandTotal,startAngle:l,endAngle:p,angle:d})})),this.init=0}},{key:"setupComponents",value:function(){var t=this.state,e=[["pieSlices",{},function(){return{sliceStrings:t.sliceStrings,colors:this.colors}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,s=h(t.startAngle+t.angle/2,e);return"translate3d("+s.x*n+"px,"+s.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,s,i){if(t){var r=this.colors[n];if(s){at(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.fill=k(r,50);var o=e(this.svg),a=i.pageX-o.left+10,l=i.pageY-o.top-10,c=(this.formatted_labels&&this.formatted_labels.length>0?this.formatted_labels[n]:this.state.labels[n])+": ",u=(100*this.state.sliceTotals[n]/this.state.grandTotal).toFixed(1);this.tip.setValues(a,l,{name:c,value:u+"%"}),this.tip.showTip()}else at(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.fill=r}}},{key:"bindTooltip",value:function(){this.container.addEventListener("mousemove",this.mouseMove),this.container.addEventListener("mouseleave",this.mouseLeave)}},{key:"mouseMove",value:function(t){var e=t.target,n=this.components.get("pieSlices").store,s=this.curActiveSliceIndex,i=this.curActiveSlice;if(n.includes(e)){var r=n.indexOf(e);this.hoverSlice(i,s,!1),this.curActiveSlice=e,this.curActiveSliceIndex=r,this.hoverSlice(e,r,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Pe=function(t){function e(t,n){zt(this,e);var s=Rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));s.type="heatmap",s.countLabel=n.countLabel||"";var i=["Sunday","Monday"],r=i.includes(n.startSubDomain)?n.startSubDomain:"Sunday";return s.startSubDomainIndex=i.indexOf(r),s.setup(),s}return Wt(e,t),Ft(e,[{key:"setMeasures",value:function(t){var e=this.measures;this.discreteDomains=0===t.discreteDomains?0:1,e.paddings.top=36,e.paddings.bottom=0,e.legendHeight=24,e.baseHeight=12*be+l(e);var n=this.data,s=this.discreteDomains?12:0;this.independentWidth=12*(gt(n.start,n.end)+s)+c(e)}},{key:"updateWidth",value:function(){var t=this.discreteDomains?12:0,e=this.state.noOfWeeks?this.state.noOfWeeks:52;this.baseWidth=12*(e+t)+c(this.measures)}},{key:"prepareData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data;if(t.start&&t.end&&t.start>t.end)throw new Error("Start date cannot be greater than end date.");if(t.start||(t.start=new Date,t.start.setFullYear(t.start.getFullYear()-1)),t.end||(t.end=new Date),t.dataPoints=t.dataPoints||{},parseInt(Object.keys(t.dataPoints)[0])>1e5){var e={};Object.keys(t.dataPoints).forEach((function(n){var s=new Date(n*xe);e[ht(s)]=t.dataPoints[n]})),t.dataPoints=e}return t}},{key:"calc",value:function(){var t=this.state;t.start=ft(this.data.start),t.end=ft(this.data.end),t.firstWeekStart=ft(t.start),t.noOfWeeks=gt(t.start,t.end),t.distribution=Nt(Object.values(this.data.dataPoints),5),t.domainConfigs=this.getDomains()}},{key:"setupComponents",value:function(){var t=this,e=this.state,n=this.discreteDomains?0:1,s=e.domainConfigs.map((function(s,i){return["heatDomain",{index:s.index,colWidth:12,rowHeight:12,squareSize:10,radius:t.rawChartArgs.radius||0,xTranslate:12*e.domainConfigs.filter((function(t,e){return e1&&void 0!==arguments[1]?arguments[1]:"",n=[t.getMonth(),t.getFullYear()],s=n[0],i=n[1],r=xt(t),o={index:s,cols:[]};wt(e=ft(e)||bt(s,i),1);for(var a=gt(r,e),l=[],c=void 0,u=0;u2&&void 0!==arguments[2]&&arguments[2],s=this.state,i=ft(t),r=[],o=0;o=s.start&&i<=s.end;n||i.getMonth()!==e||!l?a.yyyyMmDd=ht(i):a=this.getSubDomainConfig(i),r.push(a)}return r}},{key:"getSubDomainConfig",value:function(t){var e=ht(t),n=this.data.dataPoints[e];return{yyyyMmDd:e,dataValue:n||0,fill:this.colors[_t(n,this.state.distribution)]}}}]),e}(ve),Me=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.barOptions=e.barOptions||{},s.lineOptions=e.lineOptions||{},s.type=e.type||"line",s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"setMeasures",value:function(){this.data.datasets.length<=1&&(this.config.showLegend=0,this.measures.paddings.bottom=30)}},{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),t.axisOptions=t.axisOptions||{},t.tooltipOptions=t.tooltipOptions||{},this.config.xAxisMode=t.axisOptions.xAxisMode||"span",this.config.yAxisMode=t.axisOptions.yAxisMode||"span",this.config.xIsSeries=t.axisOptions.xIsSeries||0,this.config.shortenYAxisNumbers=t.axisOptions.shortenYAxisNumbers||0,this.config.formatTooltipX=t.tooltipOptions.formatTooltipX,this.config.formatTooltipY=t.tooltipOptions.formatTooltipY,this.config.valuesOverPoints=t.valuesOverPoints}},{key:"prepareData",value:function(){return Dt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data,this.type)}},{key:"prepareFirstData",value:function(){return Et(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data)}},{key:"calc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.calcXPositions(),t||this.calcYAxisParameters(this.getAllYValues(),"line"===this.type),this.makeDataByIndex()}},{key:"calcXPositions",value:function(){var t=this.state,e=this.data.labels;t.datasetLength=e.length,t.unitWidth=this.width/t.datasetLength,t.xOffset=t.unitWidth/2,t.xAxis={labels:e,positions:e.map((function(e,n){return u(t.xOffset+n*t.unitWidth)}))}}},{key:"calcYAxisParameters",value:function(t){var e=Lt(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"false"),n=this.height/Mt(e),s=Pt(e)*n,i=this.height-Tt(e)*s;this.state.yAxis={labels:e,positions:e.map((function(t){return i-t*n})),scaleMultiplier:n,zeroLine:i},this.calcDatasetPoints(),this.calcYExtremes(),this.calcYRegions()}},{key:"calcDatasetPoints",value:function(){var t=this.state,e=function(e){return e.map((function(e){return Ct(e,t.yAxis)}))};t.datasets=this.data.datasets.map((function(t,n){var s=t.values,i=t.cumulativeYs||[];return{name:t.name&&t.name.replace(/<|>|&/g,(function(t){return"&"==t?"&":"<"==t?"<":">"})),index:n,chartType:t.chartType,values:s,yPositions:e(s),cumulativeYs:i,cumulativeYPos:e(i)}}))}},{key:"calcYExtremes",value:function(){var t=this.state;this.barOptions.stacked?t.yExtremes=t.datasets[t.datasets.length-1].cumulativeYPos:(t.yExtremes=new Array(t.datasetLength).fill(9999),t.datasets.map((function(e){e.yPositions.map((function(e,n){eo(s)?t.mapTooltipXPosition(r):t.tip.hideTip()}))}},{key:"mapTooltipXPosition",value:function(t){var e=this.state;if(e.yExtremes){var n=St(t,e.xAxis.positions,!0);if(n>=0){var s=this.dataByIndex[n];this.tip.setValues(s.xPos+this.tip.offset.x,s.yExtreme+this.tip.offset.y,{name:s.formattedLabel,value:""},s.values,n),this.tip.showTip()}}}},{key:"renderLegend",value:function(){var t=this,e=this.data;e.datasets.length>1&&(this.legendArea.textContent="",e.datasets.map((function(e,n){var s=F(100*n,"0",100,t.colors[n],e.name,t.config.truncateLegends);t.legendArea.appendChild(s)})))}},{key:"makeOverlay",value:function(){var t=this;this.init?this.init=0:(this.overlayGuides&&this.overlayGuides.forEach((function(t){var e=t.overlay;e.parentNode.removeChild(e)})),this.overlayGuides=this.dataUnitComponents.map((function(t){return{type:t.unitType,overlay:void 0,units:t.units}})),void 0===this.state.currentIndex&&(this.state.currentIndex=this.state.datasetLength-1),this.overlayGuides.map((function(e){var n=e.units[t.state.currentIndex];e.overlay=le[e.type](n),t.drawArea.appendChild(e.overlay)})))}},{key:"updateOverlayGuides",value:function(){this.overlayGuides&&this.overlayGuides.forEach((function(t){var e=t.overlay;e.parentNode.removeChild(e)}))}},{key:"bindOverlay",value:function(){var t=this;this.parent.addEventListener("data-select",(function(){t.updateOverlay()}))}},{key:"bindUnits",value:function(){var t=this;this.dataUnitComponents.map((function(e){e.units.map((function(e){e.addEventListener("click",(function(){var n=e.getAttribute("data-point-index");t.setCurrentDataPoint(n)}))}))})),this.tip.container.addEventListener("click",(function(){var e=t.tip.container.getAttribute("data-point-index");t.setCurrentDataPoint(e)}))}},{key:"updateOverlay",value:function(){var t=this;this.overlayGuides.map((function(e){var n=e.units[t.state.currentIndex];ce[e.type](n,e.overlay)}))}},{key:"onLeftArrow",value:function(){this.setCurrentDataPoint(this.state.currentIndex-1)}},{key:"onRightArrow",value:function(){this.setCurrentDataPoint(this.state.currentIndex+1)}},{key:"getDataPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.currentIndex,e=this.state;return{index:t,label:e.xAxis.labels[t],values:e.datasets.map((function(e){return e.values[t]}))}}},{key:"setCurrentDataPoint",value:function(t){var e=this.state;(t=parseInt(t))<0&&(t=0),t>=e.xAxis.labels.length&&(t=e.xAxis.labels.length-1),t!==e.currentIndex&&(e.currentIndex=t,r(this.parent,"data-select",this.getDataPoint()))}},{key:"addDataPoint",value:function(t,e){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.state.datasetLength;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"addDataPoint",this).call(this,t,e,s),this.data.labels.splice(s,0,t),this.data.datasets.map((function(t,n){t.values.splice(s,0,e[n])})),this.update(this.data)}},{key:"removeDataPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.datasetLength-1;this.data.labels.length<=1||(qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"removeDataPoint",this).call(this,t),this.data.labels.splice(t,1),this.data.datasets.map((function(e){e.values.splice(t,1)})),this.update(this.data))}},{key:"updateDataset",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.data.datasets[e].values=t,this.update(this.data)}},{key:"updateDatasets",value:function(t){this.data.datasets.map((function(e,n){t[n]&&(e.values=t[n])})),this.update(this.data)}}]),n}(ve),Ce=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="donut",s.initTimeout=0,s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),this.mouseMove=this.mouseMove.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.hoverRadio=t.hoverRadio||.1,this.config.startAngle=t.startAngle||0,this.clockWise=t.clockWise||!1,this.strokeWidth=t.strokeWidth||30}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;this.radius=this.height>this.width?this.center.x-this.strokeWidth/2:this.center.y-this.strokeWidth/2;var s=this.radius,i=this.clockWise,r=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var o=180-this.config.startAngle;e.sliceTotals.map((function(n,a){var l=o,c=n/e.grandTotal*360,u=c>180?1:0,d=i?-c:c,p=o+=d,f=h(l,s),g=h(p,s),m=t.init&&r[a],v=void 0,y=void 0;t.init?(v=m?m.startPosition:f,y=m?m.endPosition:f):(v=f,y=g);var b=360===c?j(v,y,t.center,t.radius,t.clockWise,u):E(v,y,t.center,t.radius,t.clockWise,u);e.sliceStrings.push(b),e.slicesProperties.push({startPosition:f,endPosition:g,value:n,total:e.grandTotal,startAngle:l,endAngle:p,angle:d})})),this.init=0}},{key:"setupComponents",value:function(){var t=this.state,e=[["donutSlices",{},function(){return{sliceStrings:t.sliceStrings,colors:this.colors,strokeWidth:this.strokeWidth}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,s=h(t.startAngle+t.angle/2,e);return"translate3d("+s.x*n+"px,"+s.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,s,i){if(t){var r=this.colors[n];if(s){at(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.stroke=k(r,50);var o=e(this.svg),a=i.pageX-o.left+10,l=i.pageY-o.top-10,c=(this.formatted_labels&&this.formatted_labels.length>0?this.formatted_labels[n]:this.state.labels[n])+": ",u=(100*this.state.sliceTotals[n]/this.state.grandTotal).toFixed(1);this.tip.setValues(a,l,{name:c,value:u+"%"}),this.tip.showTip()}else at(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.stroke=r}}},{key:"bindTooltip",value:function(){this.container.addEventListener("mousemove",this.mouseMove),this.container.addEventListener("mouseleave",this.mouseLeave)}},{key:"mouseMove",value:function(t){var e=t.target,n=this.components.get("donutSlices").store,s=this.curActiveSliceIndex,i=this.curActiveSlice;if(n.includes(e)){var r=n.indexOf(e);this.hoverSlice(i,s,!1),this.curActiveSlice=e,this.curActiveSliceIndex=r,this.hoverSlice(e,r,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Se={bar:Me,line:Me,percentage:Le,heatmap:Pe,pie:Te,donut:Ce},Ne=function t(e,n){return zt(this,t),Jt(n.type,e,n)},_e=Object.freeze({Chart:Ne,PercentageChart:Le,PieChart:Te,Heatmap:Pe,AxisChart:Me}),De={NAME:"Frappe Charts",VERSION:"1.6.2"};return Object.assign({},De,_e)}()},ee(ne={exports:{}},ne.exports),ne.exports);function ie(e){let n,s,i;return{c(){n=m("div")},m(t,r){h(t,n,r),e[18](n),s||(i=w(n,"data-select",e[17]),s=!0)},p:t,i:t,o:t,d(t){t&&f(n),e[18](null),s=!1,i()}}}function re(t,e,n){let s,{data:i={labels:[],datasets:[{values:[]}],yMarkers:{},yRegions:[]}}=e,{title:r=""}=e,{type:o="line"}=e,{height:a=300}=e,{animate:l=!0}=e,{axisOptions:c={}}=e,{barOptions:u={}}=e,{lineOptions:d={}}=e,{tooltipOptions:p={}}=e,{colors:h=[]}=e,{valuesOverPoints:f=0}=e,{isNavigable:g=!1}=e,{maxSlices:m=3}=e,v=null;function y(t){return function(...e){if(v)return t(...e)}}const b=y(((t,e,n)=>v.addDataPoint(t,e,n))),x=y((t=>v.removeDataPoint(t))),w=y((()=>v.export())),$=y((t=>v.update(t)));return S((()=>{v=new se.Chart(s,{data:i,title:r,type:o,height:a,animate:l,colors:h,axisOptions:c,barOptions:u,lineOptions:d,tooltipOptions:p,valuesOverPoints:f,isNavigable:g,maxSlices:m})})),function(t){C().$$.on_destroy.push(t)}((()=>{v=null})),t.$$set=t=>{"data"in t&&n(1,i=t.data),"title"in t&&n(2,r=t.title),"type"in t&&n(3,o=t.type),"height"in t&&n(4,a=t.height),"animate"in t&&n(5,l=t.animate),"axisOptions"in t&&n(6,c=t.axisOptions),"barOptions"in t&&n(7,u=t.barOptions),"lineOptions"in t&&n(8,d=t.lineOptions),"tooltipOptions"in t&&n(9,p=t.tooltipOptions),"colors"in t&&n(10,h=t.colors),"valuesOverPoints"in t&&n(11,f=t.valuesOverPoints),"isNavigable"in t&&n(12,g=t.isNavigable),"maxSlices"in t&&n(13,m=t.maxSlices)},t.$$.update=()=>{2&t.$$.dirty&&$(i)},[s,i,r,o,a,l,c,u,d,p,h,f,g,m,b,x,w,function(e){_.call(this,t,e)},function(t){E[t?"unshift":"push"]((()=>{s=t,n(0,s)}))}]}var oe=class extends rt{constructor(t){super(),it(this,t,re,ie,r,{data:1,title:2,type:3,height:4,animate:5,axisOptions:6,barOptions:7,lineOptions:8,tooltipOptions:9,colors:10,valuesOverPoints:11,isNavigable:12,maxSlices:13,addDataPoint:14,removeDataPoint:15,exportChart:16})}get addDataPoint(){return this.$$.ctx[14]}get removeDataPoint(){return this.$$.ctx[15]}get exportChart(){return this.$$.ctx[16]}};function ae(t){let e,n,s,i,r,o,a=(t[0].descr?t[0].descr:"")+"";return r=new oe({props:{data:t[1],type:"line",lineOptions:t[2],axisOptions:t[3]}}),{c(){e=m("div"),n=m("label"),s=y(a),i=b(),et(r.$$.fragment),$(n,"class","inline-block italic align-top text-center text-gray-500 txt-sz"),$(e,"class","text-center")},m(t,a){h(t,e,a),p(e,n),p(n,s),h(t,i,a),nt(r,t,a),o=!0},p(t,[e]){(!o||1&e)&&a!==(a=(t[0].descr?t[0].descr:"")+"")&&O(s,a);const n={};2&e&&(n.data=t[1]),4&e&&(n.lineOptions=t[2]),r.$set(n)},i(t){o||(Q(r.$$.fragment,t),o=!0)},o(t){Z(r.$$.fragment,t),o=!1},d(t){t&&f(e),t&&f(i),st(r,t)}}}function le(t,e,n){S((async()=>{console.log("[i]","chart component mounted")}));let s,{widget:i}=e,r=[0,0],o=[0,0],a={labels:r,datasets:[{name:i.descr,values:o}]},l=[],c=[];function u(){if(i.status&&Array.isArray(i.status)){if(c!==i.status){console.log("[i]","collecting chart data to array, topic:",i.topic);let s=i.status;l=[...l,...s];for(let n=0;n{"widget"in t&&n(0,i=t.widget)},t.$$.update=()=>{1&t.$$.dirty&&(i.status,u())},[i,a,s,{xAxisMode:"tick",xIsSeries:!0}]}class ce extends rt{constructor(t){super(),it(this,t,le,ae,r,{widget:0})}}function ue(e){let n,i,r,o,a,l,c,u,d,g,v,x,k,A,L,T,P,M,C,S=(e[0].descr?e[0].descr:"")+"";return{c(){n=m("div"),i=m("div"),r=m("label"),o=y(S),a=b(),l=m("div"),c=m("label"),u=m("div"),d=m("input"),v=b(),x=m("div"),A=b(),L=m("div"),$(r,"class","wgt-dscr-stl"),$(i,"class","w-2/3"),$(d,"id",g=e[0].topic),$(d,"type","checkbox"),$(d,"class","sr-only"),$(x,"class",k="block "+(e[1]?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg"),$(L,"class",T="dot "+(e[0].sent?"bg-red-300":"bg-gray-100")+" absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg"),$(u,"class","relative"),$(c,"for",P=e[0].topic),$(c,"class","items-center cursor-pointer"),$(l,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,s){h(t,n,s),p(n,i),p(i,r),p(r,o),p(n,a),p(n,l),p(l,c),p(c,u),p(u,d),d.checked=e[1],p(u,v),p(u,x),p(u,A),p(u,L),M||(C=[w(d,"change",e[4]),w(d,"change",e[5])],M=!0)},p(t,[e]){1&e&&S!==(S=(t[0].descr?t[0].descr:"")+"")&&O(o,S),1&e&&g!==(g=t[0].topic)&&$(d,"id",g),2&e&&(d.checked=t[1]),2&e&&k!==(k="block "+(t[1]?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg")&&$(x,"class",k),1&e&&T!==(T="dot "+(t[0].sent?"bg-red-300":"bg-gray-100")+" absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg")&&$(L,"class",T),1&e&&P!==(P=t[0].topic)&&$(c,"for",P)},i:t,o:t,d(t){t&&f(n),M=!1,s(C)}}}function de(t,e,n){let{widget:s}=e,{toggleState:i=!1}=e,{wsPush:r=((t,e,n)=>{})}=e;function o(){n(0,s.sent=!0,s),n(0,s.status=i?"1":"0",s)}return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"toggleState"in t&&n(1,i=t.toggleState),"wsPush"in t&&n(2,r=t.wsPush)},t.$$.update=()=>{1&t.$$.dirty&&(s.status,"1"==s.status?n(1,i=!0):"0"==s.status&&n(1,i=!1))},[s,i,r,o,function(){i=this.checked,n(1,i)},()=>(o(),r(s.ws,s.topic,s.status))]}class pe extends rt{constructor(t){super(),it(this,t,de,ue,r,{widget:0,toggleState:1,wsPush:2})}}function he(e){let n,s,i,r,o,a,l,c,u,d,g,v,x=(e[0].descr?e[0].descr:"")+"",w=(e[0].status?e[0].status:"")+"",k=(e[0].after?e[0].after:"")+"";return{c(){n=m("div"),s=m("div"),i=m("label"),r=y(x),o=b(),a=m("div"),l=m("label"),c=y(w),u=b(),d=m("label"),g=y(" "),v=y(k),$(i,"class","wgt-dscr-stl"),$(s,"class","w-2/3"),$(l,"class","wgt-adt-stl"),$(d,"class","wgt-adt-stl"),$(a,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,e){h(t,n,e),p(n,s),p(s,i),p(i,r),p(n,o),p(n,a),p(a,l),p(l,c),p(a,u),p(a,d),p(d,g),p(d,v)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&O(r,x),1&e&&w!==(w=(t[0].status?t[0].status:"")+"")&&O(c,w),1&e&&k!==(k=(t[0].after?t[0].after:"")+"")&&O(v,k)},i:t,o:t,d(t){t&&f(n)}}}function fe(t,e,n){let{widget:s}=e,{value:i}=e;return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"value"in t&&n(1,i=t.value)},[s,i]}class ge extends rt{constructor(t){super(),it(this,t,fe,he,r,{widget:0,value:1})}}function me(t,e,n){const s=t.slice();return s[12]=e[n],s[14]=n,s}function ve(t,e,n){const s=t.slice();return s[15]=e[n],s[16]=e,s[17]=n,s}function ye(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function be(t){let e,n,s,i=!t[0]&&xe(),r=t[1],o=[];for(let e=0;eZ(o[t],1,1,(()=>{o[t]=null}));return{c(){e=m("div"),i&&i.c(),n=b();for(let t=0;t{i=null})),K()):i?1&s&&Q(i,1):(i=xe(),i.c(),Q(i,1),i.m(e,n)),11&s){let n;for(r=t[1],n=0;n{a=null})),K()),"toggle"===t[15].widget?l?(l.p(t,o),1&o&&Q(l,1)):(l=ke(t),l.c(),Q(l,1),l.m(n.parentNode,n)):l&&(X(),Z(l,1,1,(()=>{l=null})),K()),"anydata"===t[15].widget?c?(c.p(t,o),1&o&&Q(c,1)):(c=Oe(t),c.c(),Q(c,1),c.m(s.parentNode,s)):c&&(X(),Z(c,1,1,(()=>{c=null})),K()),"range"===t[15].widget?u?(u.p(t,o),1&o&&Q(u,1)):(u=Ae(t),u.c(),Q(u,1),u.m(i.parentNode,i)):u&&(X(),Z(u,1,1,(()=>{u=null})),K()),"chart"===t[15].widget?d?(d.p(t,o),1&o&&Q(d,1)):(d=Le(t),d.c(),Q(d,1),d.m(r.parentNode,r)):d&&(X(),Z(d,1,1,(()=>{d=null})),K())},i(t){o||(Q(a),Q(l),Q(c),Q(u),Q(d),o=!0)},o(t){Z(a),Z(l),Z(c),Z(u),Z(d),o=!1},d(t){a&&a.d(t),t&&f(e),l&&l.d(t),t&&f(n),c&&c.d(t),t&&f(s),u&&u.d(t),t&&f(i),d&&d.d(t),t&&f(r)}}}function $e(t){let e,n,s;function i(e){t[5](e,t[15])}let r={widget:t[15],wsPush:t[4]};return void 0!==t[15].status&&(r.value=t[15].status),e=new Kt({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[4]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function ke(t){let e,n,s;function i(e){t[7](e,t[15])}let r={widget:t[15],wsPush:t[6]};return void 0!==t[15].status&&(r.value=t[15].status),e=new pe({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[6]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Oe(t){let e,n,s;function i(e){t[8](e,t[15])}let r={widget:t[15]};return void 0!==t[15].status&&(r.value=t[15].status),e=new ge({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Ae(t){let e,n,s;function i(e){t[10](e,t[15])}let r={widget:t[15],wsPush:t[9]};return void 0!==t[15].status&&(r.value=t[15].status),e=new te({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[9]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Le(t){let e,n,s;function i(e){t[11](e,t[15])}let r={widget:t[15]};return void 0!==t[15].status&&(r.value=t[15].status),e=new ce({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Te(t){let e,n,s=t[15].page===t[12].page&&we(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,n){t[15].page===t[12].page?s?(s.p(t,n),3&n&&Q(s,1)):(s=we(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Pe(t){let e,n,s=t[0],i=[];for(let e=0;eZ(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Se(t,e,n){let{layoutJson:s}=e,{pages:i}=e,{show:r}=e,{wsPush:o=((t,e,n)=>{})}=e;return t.$$set=t=>{"layoutJson"in t&&n(0,s=t.layoutJson),"pages"in t&&n(1,i=t.pages),"show"in t&&n(2,r=t.show),"wsPush"in t&&n(3,o=t.wsPush)},[s,i,r,o,(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))}]}class Ne extends rt{constructor(t){super(),it(this,t,Se,Ce,r,{layoutJson:0,pages:1,show:2,wsPush:3})}}function _e(e){let n,s,r,o,a,l,c;return{c(){n=v("svg"),s=v("path"),r=v("circle"),o=v("circle"),a=v("circle"),$(s,"stroke","none"),$(s,"d","M0 0h24v24H0z"),$(r,"cx","5"),$(r,"cy","12"),$(r,"r","1"),$(o,"cx","12"),$(o,"cy","12"),$(o,"r","1"),$(a,"cx","19"),$(a,"cy","12"),$(a,"r","1"),$(n,"class","h-6 w-6 text-green-400 cursor-pointer"),$(n,"width","24"),$(n,"height","24"),$(n,"viewBox","0 -2 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,u){h(t,n,u),p(n,s),p(n,r),p(n,o),p(n,a),l||(c=w(n,"click",(function(){i(e[0]())&&e[0]().apply(this,arguments)})),l=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&f(n),l=!1,c()}}}function De(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class Ee extends rt{constructor(t){super(),it(this,t,De,_e,r,{click:0})}}function je(t,e,n){const s=t.slice();return s[26]=e[n],s[27]=e,s[28]=n,s}function Je(t,e,n){const s=t.slice();return s[29]=e[n][0],s[30]=e[n][1],s[31]=e,s[32]=n,s}function He(t,e,n){const s=t.slice();return s[33]=e[n],s}function ze(t,e,n){const s=t.slice();return s[36]=e[n],s}function Fe(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function qe(t){let e,n,s,i,r,o,a,l;return n=new qt({props:{title:"Конфигуратор",$$slots:{default:[Xe]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Сценарии",$$slots:{default:[Ke]},$$scope:{ctx:t}}}),a=new qt({props:{$$slots:{default:[Qe]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),o=m("div"),et(a.$$.fragment),$(e,"class","grd-2col1"),$(o,"class","grd-1col1")},m(t,c){h(t,e,c),nt(n,e,null),p(e,s),nt(i,e,null),h(t,r,c),h(t,o,c),nt(a,o,null),l=!0},p(t,e){const s={};782&e[0]|256&e[1]&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};1025&e[0]|256&e[1]&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const o={};224&e[0]|256&e[1]&&(o.$$scope={dirty:e,ctx:t}),a.$set(o)},i(t){l||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(a.$$.fragment,t),l=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(n),st(i),t&&f(r),t&&f(o),st(a)}}}function We(t){let e,n;return{c(){e=m("optgroup"),$(e,"label",n=t[36].header)},m(t,n){h(t,e,n)},p(t,s){8&s[0]&&n!==(n=t[36].header)&&$(e,"label",n)},d(t){t&&f(e)}}}function Re(t){let e,n,s,i,r=t[36].name+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[36].num,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){8&s[0]&&r!==(r=t[36].name+"")&&O(n,r),8&s[0]&&i!==(i=t[36].num)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Ie(t){let e,n,s=t[36].header&&We(t),i=!t[36].header&&Re(t);return{c(){s&&s.c(),e=x(),i&&i.c(),n=x()},m(t,r){s&&s.m(t,r),h(t,e,r),i&&i.m(t,r),h(t,n,r)},p(t,r){t[36].header?s?s.p(t,r):(s=We(t),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),t[36].header?i&&(i.d(1),i=null):i?i.p(t,r):(i=Re(t),i.c(),i.m(n.parentNode,n))},d(t){s&&s.d(t),t&&f(e),i&&i.d(t),t&&f(n)}}}function Be(t){let e,n,s,i,r=t[33].label+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[33].name,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){4&s[0]&&r!==(r=t[33].label+"")&&O(n,r),4&s[0]&&i!==(i=t[33].name)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Ye(t){let e,n=Object.entries(t[26]),s=[];for(let e=0;eZ(T[t],1,1,(()=>{T[t]=null}));return{c(){e=m("div"),n=m("select");for(let t=0;t| Тип | \n Id | \n Виджет | \n Вкладка | \n Название | \n | \n | ',u=b(),d=m("tbody");for(let t=0;tt[13].call(n))),o.__value="Выберите пресет",o.value=o.__value,$(r,"class","slct-lg"),$(e,"class","grd-2col2"),$(c,"class","bg-gray-100"),$(d,"class","bg-white"),$(l,"class","tbl")},m(s,f){h(s,e,f),p(e,n);for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function tn(t,e,n){let s,{configJson:i}=e,{widgetsJson:r}=e,{itemsJson:o}=e,{show:a}=e,{scenarioJson:l}=e,c=0,{saveConfig:u=(()=>{})}=e,{rebootEsp:d=(()=>{})}=e,{cleanLogs:p=(()=>{})}=e,h=!0;function f(){for(let t=0;t{"configJson"in t&&n(1,i=t.configJson),"widgetsJson"in t&&n(2,r=t.widgetsJson),"itemsJson"in t&&n(3,o=t.itemsJson),"show"in t&&n(4,a=t.show),"scenarioJson"in t&&n(0,l=t.scenarioJson),"saveConfig"in t&&n(5,u=t.saveConfig),"rebootEsp"in t&&n(6,d=t.rebootEsp),"cleanLogs"in t&&n(7,p=t.cleanLogs)},t.$$.update=()=>{1&t.$$.dirty[0]&&function(){let t=JSON.stringify(l);n(10,s=t.split("\\n").length)}()},[l,i,r,o,a,u,d,p,c,h,s,f,g,function(){c=T(this),n(8,c),n(3,o)},()=>f(),function(t,e){t[e].id=this.value,n(1,i),n(2,r)},function(t,e){t[e].widget=T(this),n(1,i),n(2,r)},function(t,e){t[e].page=this.value,n(1,i),n(2,r)},function(t,e){t[e].descr=this.value,n(1,i),n(2,r)},()=>n(9,h=!h),t=>g(t),function(t,e,s){e[s][t]=this.value,n(1,i),n(2,r)},function(){l.scen=this.value,n(0,l)},()=>(p(),u()),()=>d()]}class en extends rt{constructor(t){super(),it(this,t,tn,Ze,r,{configJson:1,widgetsJson:2,itemsJson:3,show:4,scenarioJson:0,saveConfig:5,rebootEsp:6,cleanLogs:7},null,[-1,-1])}}function nn(t,e,n){const s=t.slice();return s[23]=e[n][0],s[24]=e[n][1],s}function sn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function rn(t){let e,n,s,i,r,o,a,l;return n=new qt({props:{title:"Подключение к WiFi",$$slots:{default:[ln]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Подключение к MQTT",$$slots:{default:[hn]},$$scope:{ctx:t}}}),a=new qt({props:{$$slots:{default:[fn]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),o=m("div"),et(a.$$.fragment),$(e,"class","grd-2col1"),$(o,"class","grd-1col1")},m(t,c){h(t,e,c),nt(n,e,null),p(e,s),nt(i,e,null),h(t,r,c),h(t,o,c),nt(a,o,null),l=!0},p(t,e){const s={};134217783&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};134217795&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const o={};134217856&e&&(o.$$scope={dirty:e,ctx:t}),a.$set(o)},i(t){l||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(a.$$.fragment,t),l=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(n),st(i),t&&f(r),t&&f(o),st(a)}}}function on(t){let e,n,s,i,r=t[24]+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[24],e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){4&s&&r!==(r=t[24]+"")&&O(n,r),4&s&&i!==(i=t[24])&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function an(t){let e,n,s;return n=new Dt({props:{title:"Введен неправильный пароль"}}),{c(){e=m("div"),et(n.$$.fragment),$(e,"class","grd-1col1")},m(t,i){h(t,e,i),nt(n,e,null),s=!0},i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){t&&f(e),st(n)}}}function ln(t){let e,n,i,r,o,a,l,c,u,d,v,y,x,k,O,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,tt,et,nt,st,it=Object.entries(t[2]),rt=[];for(let e=0;eНазвание устройства
',i=b(),r=m("div"),o=m("input"),a=b(),l=m("div"),c=m("div"),c.innerHTML='Точка доступа
',u=b(),d=m("div"),v=m("input"),y=b(),x=m("div"),k=m("div"),k.innerHTML='Пароль точки доступа
',O=b(),T=m("div"),P=m("input"),M=b(),C=m("div"),S=m("div"),S.innerHTML='Название wifi сети
',N=b(),_=m("div"),D=m("select");for(let t=0;tПароль',H=b(),z=m("div"),F=m("input"),q=b(),R=m("div"),I=m("div"),I.innerHTML='Сервер обновления
',B=b(),Y=m("div"),V=m("input"),U=b(),ot&&ot.c(),G=b(),tt=m("button"),tt.textContent="Сохранить",$(n,"class","w-4/6"),$(o,"class","ipt-rnd text-left focus:border-indigo-500"),$(o,"type","text"),$(r,"class","flex justify-end w-3/6"),$(e,"class","crd-itm-psn"),$(c,"class","w-4/6"),$(v,"class","ipt-rnd text-left focus:border-indigo-500"),$(v,"type","text"),$(d,"class","flex justify-end w-3/6"),$(l,"class","crd-itm-psn"),$(k,"class","w-4/6"),$(P,"class","ipt-rnd text-left focus:border-indigo-500"),$(P,"type","text"),$(T,"class","flex justify-end w-3/6"),$(x,"class","crd-itm-psn"),$(S,"class","w-4/6"),$(D,"class","ipt-rnd text-left focus:border-indigo-500"),void 0===t[0].routerssid&&W((()=>t[11].call(D))),$(_,"class","flex justify-end w-3/6"),$(C,"class","crd-itm-psn"),$(J,"class","w-4/6"),$(F,"class","ipt-rnd text-left focus:border-indigo-500"),$(F,"type","text"),$(z,"class","flex justify-end w-3/6"),$(j,"class","crd-itm-psn"),$(I,"class","w-4/6"),$(V,"class","ipt-rnd text-left focus:border-indigo-500"),$(V,"type","text"),$(Y,"class","flex justify-end w-3/6"),$(R,"class","crd-itm-psn"),$(tt,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),A(o,t[0].name),h(s,a,f),h(s,l,f),p(l,c),p(l,u),p(l,d),p(d,v),A(v,t[0].apssid),h(s,y,f),h(s,x,f),p(x,k),p(x,O),p(x,T),p(T,P),A(P,t[0].appass),h(s,M,f),h(s,C,f),p(C,S),p(C,N),p(C,_),p(_,D);for(let t=0;t{ot=null})),K())},i(t){et||(Q(ot),et=!0)},o(t){Z(ot),et=!1},d(t){t&&f(e),t&&f(a),t&&f(l),t&&f(y),t&&f(x),t&&f(M),t&&f(C),g(rt,t),t&&f(E),t&&f(j),t&&f(q),t&&f(R),t&&f(U),ot&&ot.d(t),t&&f(G),t&&f(tt),nt=!1,s(st)}}}function cn(t){let e;return{c(){e=m("p"),e.textContent="Ошибка",$(e,"class","text-red-500 font-bold h-8 bg-red-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function un(t){let e;return{c(){e=m("p"),e.textContent="Ожидание",$(e,"class","text-blue-500 font-bold h-8 bg-blue-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function dn(t){let e;return{c(){e=m("p"),e.textContent="Подключение",$(e,"class","text-yellow-500 font-bold h-8 bg-yellow-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function pn(t){let e;return{c(){e=m("p"),e.textContent="Подключено",$(e,"class","text-green-500 font-bold h-8 bg-green-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function hn(t){let e,n,i,r,o,a,l,c,u,d,g,v,y,x,k,O,L,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,W,R,I,B,Y,V;function U(t,e){return"e5"===t[1].mqtt?pn:"e13"===t[1].mqtt?dn:void 0===t[1].mqtt?un:cn}let G=U(t),X=G(t);return{c(){e=m("div"),n=m("div"),n.innerHTML='Состояние подключения
',i=b(),r=m("div"),X.c(),o=b(),a=m("div"),l=m("div"),l.innerHTML='Название сервера
',c=b(),u=m("div"),d=m("input"),g=b(),v=m("div"),y=m("div"),y.innerHTML='Порт
',x=b(),k=m("div"),O=m("input"),L=b(),T=m("div"),P=m("div"),P.innerHTML='Префикс
',M=b(),C=m("div"),S=m("input"),N=b(),_=m("div"),D=m("div"),D.innerHTML='Имя пользователя
',E=b(),j=m("div"),J=m("input"),H=b(),z=m("div"),F=m("div"),F.innerHTML='Пароль
',q=b(),W=m("div"),R=m("input"),I=b(),B=m("button"),B.textContent="Сохранить",$(n,"class","w-4/6"),$(r,"class","flex justify-center w-3/6 align-baseline text-sm sm:text-sm md:text-base lg:text-base xl:text-base 2xl:text-base break-words"),$(e,"class","crd-itm-psn"),$(l,"class","w-4/6"),$(d,"class","ipt-rnd text-left focus:border-indigo-500"),$(d,"type","text"),$(u,"class","flex justify-end w-3/6"),$(a,"class","crd-itm-psn"),$(y,"class","w-4/6"),$(O,"class","ipt-rnd text-left focus:border-indigo-500"),$(O,"type","text"),$(k,"class","flex justify-end w-3/6"),$(v,"class","crd-itm-psn"),$(P,"class","w-4/6"),$(S,"class","ipt-rnd text-left focus:border-indigo-500"),$(S,"type","text"),$(C,"class","flex justify-end w-3/6"),$(T,"class","crd-itm-psn"),$(D,"class","w-4/6"),$(J,"class","ipt-rnd text-left focus:border-indigo-500"),$(J,"type","text"),$(j,"class","flex justify-end w-3/6"),$(_,"class","crd-itm-psn"),$(F,"class","w-4/6"),$(R,"class","ipt-rnd text-left focus:border-indigo-500"),$(R,"type","text"),$(W,"class","flex justify-end w-3/6"),$(z,"class","crd-itm-psn"),$(B,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),X.m(r,null),h(s,o,f),h(s,a,f),p(a,l),p(a,c),p(a,u),p(u,d),A(d,t[0].mqttServer),h(s,g,f),h(s,v,f),p(v,y),p(v,x),p(v,k),p(k,O),A(O,t[0].mqttPort),h(s,L,f),h(s,T,f),p(T,P),p(T,M),p(T,C),p(C,S),A(S,t[0].mqttPrefix),h(s,N,f),h(s,_,f),p(_,D),p(_,E),p(_,j),p(j,J),A(J,t[0].mqttUser),h(s,H,f),h(s,z,f),p(z,F),p(z,q),p(z,W),p(W,R),A(R,t[0].mqttPass),h(s,I,f),h(s,B,f),Y||(V=[w(d,"input",t[16]),w(O,"input",t[17]),w(S,"input",t[18]),w(J,"input",t[19]),w(R,"input",t[20]),w(B,"click",t[21])],Y=!0)},p(t,e){G!==(G=U(t))&&(X.d(1),X=G(t),X&&(X.c(),X.m(r,null))),5&e&&d.value!==t[0].mqttServer&&A(d,t[0].mqttServer),5&e&&O.value!==t[0].mqttPort&&A(O,t[0].mqttPort),5&e&&S.value!==t[0].mqttPrefix&&A(S,t[0].mqttPrefix),5&e&&J.value!==t[0].mqttUser&&A(J,t[0].mqttUser),5&e&&R.value!==t[0].mqttPass&&A(R,t[0].mqttPass)},d(t){t&&f(e),X.d(),t&&f(o),t&&f(a),t&&f(g),t&&f(v),t&&f(L),t&&f(T),t&&f(N),t&&f(_),t&&f(H),t&&f(z),t&&f(I),t&&f(B),Y=!1,s(V)}}}function fn(e){let n,s,i;return{c(){n=m("button"),n.textContent="Перезагрузить устройство",$(n,"class","btn-lg")},m(t,r){h(t,n,r),s||(i=w(n,"click",e[22]),s=!0)},p:t,d(t){t&&f(n),s=!1,i()}}}function gn(t){let e,n,s,i;const r=[rn,sn],o=[];function a(t,e){return t[3]?0:1}return e=a(t),n=o[e]=r[e](t),{c(){n.c(),s=x()},m(t,n){o[e].m(t,n),h(t,s,n),i=!0},p(t,[i]){let l=e;e=a(t),e===l?o[e].p(t,i):(X(),Z(o[l],1,1,(()=>{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function mn(t,e,n){let{settingsJson:s}=e,{errorsJson:i}=e,{ssidJson:r}=e,{show:o}=e,{ssidClick:a=(()=>{})}=e,{saveSett:l=(()=>{})}=e,{saveMqtt:c=(()=>{})}=e,{rebootEsp:u=(()=>{})}=e;return t.$$set=t=>{"settingsJson"in t&&n(0,s=t.settingsJson),"errorsJson"in t&&n(1,i=t.errorsJson),"ssidJson"in t&&n(2,r=t.ssidJson),"show"in t&&n(3,o=t.show),"ssidClick"in t&&n(4,a=t.ssidClick),"saveSett"in t&&n(5,l=t.saveSett),"saveMqtt"in t&&n(6,c=t.saveMqtt),"rebootEsp"in t&&n(7,u=t.rebootEsp)},[s,i,r,o,a,l,c,u,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=T(this),n(0,s),n(2,r)},()=>a(),function(){s.routerpass=this.value,n(0,s),n(2,r)},function(){s.serverip=this.value,n(0,s),n(2,r)},()=>l(),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(),()=>u()]}class vn extends rt{constructor(t){super(),it(this,t,mn,gn,r,{settingsJson:0,errorsJson:1,ssidJson:2,show:3,ssidClick:4,saveSett:5,saveMqtt:6,rebootEsp:7})}}function yn(t,e,n){const s=t.slice();return s[13]=e[n],s[15]=n,s}function bn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function xn(t){let e,n,s,i,r;return n=new qt({props:{title:"Список устройств",$$slots:{default:[kn]},$$scope:{ctx:t}}}),i=new Dt({props:{$$slots:{default:[On]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),$(e,"class","grd-1col1")},m(t,o){h(t,e,o),nt(n,e,null),p(e,s),nt(i,e,null),r=!0},p(t,e){const s={};65591&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};65536&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r)},i(t){r||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),r=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),r=!1},d(t){t&&f(e),st(n),st(i)}}}function wn(t){let e,n,s,i,r,o,a,l,c,u,d,g,v,x,w,k,A,L,T,P=t[13].name+"",M=t[13].ip+"",C=t[13].id+"",S=t[13].status?"online":"offline";return L=new Mt({props:{click:function(){return t[7](t[15])}}}),{c(){e=m("tr"),n=m("td"),s=y(P),i=b(),r=m("td"),o=m("a"),a=y(M),c=b(),u=m("td"),d=y(C),g=b(),v=m("td"),x=y(S),k=b(),A=m("td"),et(L.$$.fragment),$(n,"class","tbl-bdy-lg ipt-lg w-full"),$(o,"href",l="http://"+t[13].ip),$(r,"class","tbl-bdy-lg ipt-lg w-full"),$(u,"class","tbl-bdy-lg ipt-lg w-full"),$(v,"class",w="tbl-bdy-lg ipt-lg w-full "+(t[13].status?"bg-green-50":"bg-red-50")),$(A,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad")},m(t,l){h(t,e,l),p(e,n),p(n,s),p(e,i),p(e,r),p(r,o),p(o,a),p(e,c),p(e,u),p(u,d),p(e,g),p(e,v),p(v,x),p(e,k),p(e,A),nt(L,A,null),T=!0},p(e,n){t=e,(!T||1&n)&&P!==(P=t[13].name+"")&&O(s,P),(!T||1&n)&&M!==(M=t[13].ip+"")&&O(a,M),(!T||1&n&&l!==(l="http://"+t[13].ip))&&$(o,"href",l),(!T||1&n)&&C!==(C=t[13].id+"")&&O(d,C),(!T||1&n)&&S!==(S=t[13].status?"online":"offline")&&O(x,S),(!T||1&n&&w!==(w="tbl-bdy-lg ipt-lg w-full "+(t[13].status?"bg-green-50":"bg-red-50")))&&$(v,"class",w)},i(t){T||(Q(L.$$.fragment,t),T=!0)},o(t){Z(L.$$.fragment,t),T=!1},d(t){t&&f(e),st(L)}}}function $n(t){let e,n,i,r,o,a,l,c,u,d,g,v,y;return{c(){e=m("tr"),n=m("td"),i=m("input"),r=b(),o=m("td"),a=m("input"),l=b(),c=m("td"),u=m("input"),d=b(),g=m("td"),$(i,"class","ipt-lg w-full"),$(i,"type","text"),$(n,"class","tbl-bdy-lg"),$(a,"class","ipt-lg w-full"),$(a,"type","text"),$(o,"class","tbl-bdy-lg"),$(u,"class","ipt-lg w-full"),$(u,"type","text"),$(c,"class","tbl-bdy-lg"),$(g,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad")},m(s,f){h(s,e,f),p(e,n),p(n,i),A(i,t[2].name),p(e,r),p(e,o),p(o,a),A(a,t[2].ip),p(e,l),p(e,c),p(c,u),A(u,t[2].id),p(e,d),p(e,g),v||(y=[w(i,"input",t[8]),w(a,"input",t[9]),w(u,"input",t[10])],v=!0)},p(t,e){4&e&&i.value!==t[2].name&&A(i,t[2].name),4&e&&a.value!==t[2].ip&&A(a,t[2].ip),4&e&&u.value!==t[2].id&&A(u,t[2].id)},d(t){t&&f(e),v=!1,s(y)}}}function kn(t){let e,n,i,r,o,a,l,c,u,d,v,x,k,A,L=t[1]?"Сохранить":"Добавить устройство",T=t[0],P=[];for(let e=0;eZ(P[t],1,1,(()=>{P[t]=null}));let C=t[1]&&$n(t);return{c(){e=m("table"),n=m("thead"),n.innerHTML='| Название устройства | \n IP адрес | \n Идентификатор | \n Состояние | \n |
',i=b(),r=m("tbody");for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Ln(t,e,n){let{show:s}=e,{deviceList:i}=e,{showInput:r}=e,{newDevice:o={}}=e,{addDevInList:a=(()=>{})}=e,{sendToAllDevices:l=(t=>{})}=e;function c(t){for(let e=0;e{"show"in t&&n(3,s=t.show),"deviceList"in t&&n(0,i=t.deviceList),"showInput"in t&&n(1,r=t.showInput),"newDevice"in t&&n(2,o=t.newDevice),"addDevInList"in t&&n(4,a=t.addDevInList),"sendToAllDevices"in t&&n(5,l=t.sendToAllDevices)},[i,r,o,s,a,l,c,t=>c(t),function(){o.name=this.value,n(2,o)},function(){o.ip=this.value,n(2,o)},function(){o.id=this.value,n(2,o)},()=>(n(1,r=!r),a()),t=>l("/reboot|")]}class Tn extends rt{constructor(t){super(),it(this,t,Ln,An,r,{show:3,deviceList:0,showInput:1,newDevice:2,addDevInList:4,sendToAllDevices:5})}}function Pn(t,e,n){const s=t.slice();return s[22]=e[n][0],s[23]=e[n][1],s[25]=n,s}function Mn(t,e,n){const s=t.slice();return s[26]=e[n],s[25]=n,s}function Cn(t,e,n){const s=t.slice();return s[22]=e[n][0],s[23]=e[n][1],s}function Sn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function Nn(t){let e,n,s,i,r,o,a,l,c,u;return n=new qt({props:{title:"Системная информация",$$slots:{default:[qn]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Системные настройки",$$slots:{default:[Rn]},$$scope:{ctx:t}}}),o=new qt({props:{title:"Лог",class:"z-50",$$slots:{default:[Bn]},$$scope:{ctx:t}}}),c=new qt({props:{title:"Системные ошибки",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),et(o.$$.fragment),a=b(),l=m("div"),et(c.$$.fragment),$(e,"class","grd-3col1"),$(l,"class","grd-1col1")},m(t,d){h(t,e,d),nt(n,e,null),p(e,s),nt(i,e,null),p(e,r),nt(o,e,null),h(t,a,d),h(t,l,d),nt(c,l,null),u=!0},p(t,e){const s={};1073741913&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};1073742214&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const a={};1073741856&e&&(a.$$scope={dirty:e,ctx:t}),o.$set(a);const l={};1073742856&e&&(l.$$scope={dirty:e,ctx:t}),c.$set(l)},i(t){u||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(o.$$.fragment,t),Q(c.$$.fragment,t),u=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(o.$$.fragment,t),Z(c.$$.fragment,t),u=!1},d(t){t&&f(e),st(n),st(i),st(o),t&&f(a),t&&f(l),st(c)}}}function _n(t){let e,n,s,i,r=t[23]+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[23],e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){16&s&&r!==(r=t[23]+"")&&O(n,r),16&s&&i!==(i=t[23])&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Dn(t){let e;return{c(){e=m("p"),e.textContent="не подключено",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function En(t){let e;return{c(){e=m("p"),e.textContent="нет сигнала",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function jn(t){let e;return{c(){e=m("p"),e.textContent="очень низкий",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Jn(t){let e;return{c(){e=m("p"),e.textContent="низкий",$(e,"class","text-yellow-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Hn(t){let e;return{c(){e=m("p"),e.textContent="хороший",$(e,"class","text-yellow-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function zn(t){let e;return{c(){e=m("p"),e.textContent="очень хороший",$(e,"class","text-green-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Fn(t){let e;return{c(){e=m("p"),e.textContent="отличный",$(e,"class","text-green-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function qn(t){let e,n,i,r,o,a,l,c,u,d,v,x,k,A,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,X,K,Q,Z,tt,et,nt,st,it,rt,ot,at,lt,ct,ut,dt,pt,ht,ft,gt,mt,vt,yt,bt,xt,wt,$t,kt,Ot,At,Lt,Tt,Pt,Mt,Ct,St,Nt,_t,Dt,Et,jt,Jt,Ht,zt,Ft,qt,Wt,Rt,It=t[3].bn+"",Bt=t[3].bver+"",Yt=t[3].timenow+"",Vt=t[3].upt+"",Ut=t[3].uptm+"",Gt=t[3].uptw+"",Xt=t[3].heap+"",Kt=t[3].fl+"",Qt=t[3].rst+"",Zt=Object.entries(t[4]),te=[];for(let e=0;eНазвание прошивки',i=b(),r=m("div"),o=m("p"),a=y(It),l=b(),c=m("div"),u=m("div"),u.innerHTML='Доступные версии
',d=b(),v=m("div"),x=m("select");for(let t=0;tВерсия прошивки',P=b(),M=m("div"),C=m("p"),S=y(Bt),N=b(),_=m("div"),D=m("div"),D.innerHTML='Время на устройстве
',E=b(),j=m("div"),J=m("p"),H=y(Yt),z=b(),F=m("div"),q=m("div"),q.innerHTML='Uptime устройства
',R=b(),I=m("div"),B=m("p"),Y=y(Vt),V=b(),U=m("div"),G=m("div"),G.innerHTML='Uptime сессии mqtt
',X=b(),K=m("div"),Q=m("p"),Z=y(Ut),tt=b(),et=m("div"),nt=m("div"),nt.innerHTML='Uptime сессии wifi
',st=b(),it=m("div"),rt=m("p"),ot=y(Gt),at=b(),lt=m("div"),ct=m("div"),ct.innerHTML='Качество WiFi сигнала
',ut=b(),dt=m("div"),ee&&ee.c(),pt=b(),ne&&ne.c(),ht=b(),se&&se.c(),ft=b(),ie&&ie.c(),gt=b(),re&&re.c(),mt=b(),oe&&oe.c(),vt=b(),ae&&ae.c(),yt=b(),bt=m("div"),xt=m("div"),xt.innerHTML='Остаток RAM
',wt=b(),$t=m("div"),kt=m("p"),Ot=y(Xt),At=b(),Lt=m("div"),Tt=m("div"),Tt.innerHTML='Кол-во записей на flash
',Pt=b(),Mt=m("div"),Ct=m("p"),St=y(Kt),Nt=b(),_t=m("div"),Dt=m("div"),Dt.innerHTML='Причина перезагрузки
',Et=b(),jt=m("div"),Jt=m("p"),Ht=y(Qt),Ft=b(),qt=m("button"),qt.textContent="Обновить прошивку",$(n,"class","w-2/3"),$(o,"class","text-gray-500 font-bold text-sm text-center truncate"),$(r,"class","flex justify-center w-1/3"),$(e,"class","flex mb-2 h-6 items-center"),$(u,"class","w-2/3"),$(x,"class","border border-indigo-500 border-4 text-center"),void 0===t[0]&&W((()=>t[12].call(x))),$(v,"class","flex justify-center w-1/3"),$(c,"class","flex mb-2 h-6 items-center"),$(T,"class","w-2/3"),$(C,"class","text-gray-500 font-bold text-sm text-center truncate"),$(M,"class","flex justify-center w-1/3"),$(A,"class","flex mb-2 h-6 items-center"),$(D,"class","w-2/3"),$(J,"class","text-gray-500 font-bold text-sm text-center truncate"),$(j,"class","flex justify-center w-1/3"),$(_,"class","flex mb-2 h-6 items-center"),$(q,"class","w-2/3"),$(B,"class","text-gray-500 font-bold text-sm text-center truncate"),$(I,"class","flex justify-center w-1/3"),$(F,"class","flex mb-2 h-6 items-center"),$(G,"class","w-2/3"),$(Q,"class","text-gray-500 font-bold text-sm text-center truncate"),$(K,"class","flex justify-center w-1/3"),$(U,"class","flex mb-2 h-6 items-center"),$(nt,"class","w-2/3"),$(rt,"class","text-gray-500 font-bold text-sm text-center truncate"),$(it,"class","flex justify-center w-1/3"),$(et,"class","flex mb-2 h-6 items-center"),$(ct,"class","w-2/3"),$(dt,"class","flex justify-center w-1/3 text-xs sm:text-sm md:text-base lg:text-base xl:text-base 2xl:text-base break-words"),$(lt,"class","flex mb-2 h-6 items-center"),$(xt,"class","w-2/3"),$(kt,"class","text-green-500 font-bold text-center truncate"),$($t,"class","flex justify-center w-1/3 text-sm text-center"),$(bt,"class","flex mb-2 h-6 items-center"),$(Tt,"class","w-2/3"),$(Ct,"class","text-green-500 font-bold text-center truncate"),$(Mt,"class","flex justify-center w-1/3 text-sm"),$(Lt,"class","flex mb-2 h-6 items-center"),$(Dt,"class","w-2/3"),$(Jt,"class",zt=(t[3].rst.toString().includes("Watchdog")||t[3].rst.toString().includes("Exception")?"text-red-500":"text-green-500")+" font-bold text-center truncate"),$(jt,"class","flex justify-center w-1/3 text-sm"),$(_t,"class","flex mb-2 h-6 items-center"),$(qt,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),p(o,a),h(s,l,f),h(s,c,f),p(c,u),p(c,d),p(c,v),p(v,x);for(let t=0;tЧасовой пояс',i=b(),r=m("div"),o=m("input"),a=b(),l=m("div"),c=m("div"),c.innerHTML='Данные графиков
',u=b(),d=m("div"),g=m("button"),g.textContent="Очистить",v=b(),y=m("div"),O=m("div"),O.innerHTML='Включить лог
',L=b(),T=m("div"),P=m("label"),M=m("div"),C=m("input"),S=b(),N=m("div"),D=b(),E=m("div"),j=b(),F&&F.c(),J=x(),$(n,"class","w-2/3"),$(o,"class","ipt-rnd h-7 text-center focus:border-indigo-500"),$(o,"type","number"),$(r,"class","flex justify-center w-1/3"),$(e,"class","flex mb-2 h-6 items-center"),$(c,"class","w-2/3"),$(g,"class","btn-lg h-7"),$(d,"class","flex justify-center w-1/3"),$(l,"class","flex mb-2 h-6 items-center"),$(O,"class","w-2/3"),$(C,"id","log"),$(C,"type","checkbox"),$(C,"class","sr-only"),$(N,"class",_="block "+(t[1].log?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg"),$(E,"class","dot bg-gray-100 absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg"),$(M,"class","relative"),$(P,"for","log"),$(P,"class","items-center cursor-pointer"),$(T,"class","flex justify-center w-1/3"),$(y,"class","flex mb-2 h-6 items-center")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),A(o,t[1].timezone),h(s,a,f),h(s,l,f),p(l,c),p(l,u),p(l,d),p(d,g),h(s,v,f),h(s,y,f),p(y,O),p(y,L),p(y,T),p(T,P),p(P,M),p(M,C),C.checked=t[1].log,p(M,S),p(M,N),p(M,D),p(M,E),h(s,j,f),F&&F.m(s,f),h(s,J,f),H||(z=[w(o,"input",t[14]),w(o,"change",t[15]),w(g,"click",t[16]),w(C,"change",t[17]),w(C,"change",t[18])],H=!0)},p(t,e){2&e&&k(o.value)!==t[1].timezone&&A(o,t[1].timezone),2&e&&(C.checked=t[1].log),2&e&&_!==(_="block "+(t[1].log?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg")&&$(N,"class",_),t[2]?F?F.p(t,e):(F=Wn(t),F.c(),F.m(J.parentNode,J)):F&&(F.d(1),F=null)},d(t){t&&f(e),t&&f(a),t&&f(l),t&&f(v),t&&f(y),t&&f(j),F&&F.d(t),t&&f(J),H=!1,s(z)}}}function In(t){let e,n,s,i=t[26].msg+"";return{c(){e=m("div"),n=y(i),$(e,"class",s=t[26].msg.toString().includes("[E]")?"text-xs text-red-500":"text-xs text-black")},m(t,s){h(t,e,s),p(e,n)},p(t,r){32&r&&i!==(i=t[26].msg+"")&&O(n,i),32&r&&s!==(s=t[26].msg.toString().includes("[E]")?"text-xs text-red-500":"text-xs text-black")&&$(e,"class",s)},d(t){t&&f(e)}}}function Bn(t){let e,n=t[5],s=[];for(let e=0;e{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Xn(t){let e,n,s=Object.entries(t[3]),i=[];for(let e=0;eZ(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Qn(t,e,n){let{errorsJson:s}=e,{versionsList:i}=e,{choosingVersion:r}=e,{coreMessages:o}=e,{settingsJson:a}=e,{startUpdate:l=(()=>{})}=e,{saveSett:c=(()=>{})}=e,{cleanLogs:u=(()=>{})}=e,{show:d}=e,{paramsBeenChanged:p=!1}=e,{cancelAlarm:h=(t=>{})}=e;return t.$$set=t=>{"errorsJson"in t&&n(3,s=t.errorsJson),"versionsList"in t&&n(4,i=t.versionsList),"choosingVersion"in t&&n(0,r=t.choosingVersion),"coreMessages"in t&&n(5,o=t.coreMessages),"settingsJson"in t&&n(1,a=t.settingsJson),"startUpdate"in t&&n(6,l=t.startUpdate),"saveSett"in t&&n(7,c=t.saveSett),"cleanLogs"in t&&n(8,u=t.cleanLogs),"show"in t&&n(9,d=t.show),"paramsBeenChanged"in t&&n(2,p=t.paramsBeenChanged),"cancelAlarm"in t&&n(10,h=t.cancelAlarm)},[r,a,p,s,i,o,l,c,u,d,h,{mqtt:{e1:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Нет ответа от сервера",cancel:!1},e2:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Соединение было разорвано",cancel:!1},e3:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Ошибка соединения. Обычно возникает когда неверно указано название сервера MQTT",cancel:!1},e4:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Клиент был отключен",cancel:!1},e6:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Ошибка версии",cancel:!1},e7:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Отклонен идентификатор",cancel:!1},e8:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Не могу установить соединение",cancel:!1},e9:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Неправильное имя пользователя/пароль"},e10:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Не авторизован для подключения",cancel:!1},e11:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Название сервера пустое",cancel:!1},e12:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Имя пользователя или пароль пустые",cancel:!1},e13:{descr:"Mqtt",color:"text-red-500",txt:"Подключение в процессе",cancel:!1}},wse1:{1:{descr:"Ошибка веб сокетов",color:"text-red-500",txt:"Слишком много клиентов было открыто. Допускается не более четырех.",cancel:!0}},jse1:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Недостаточный размер буфера библиотеки Arduino Json. Устройство может вести себя непредсказуемо. Обратитесь к разработчику.",cancel:!0}},jse2:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Ошибка записи/чтения json.",cancel:!0,num:!0}},jse3:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Ошибка чтения json файла с виджетами",cancel:!0}}},function(){r=T(this),n(0,r),n(4,i)},()=>l(),function(){a.timezone=k(this.value),n(1,a)},()=>n(2,p=!0),()=>u(),function(){a.log=this.checked,n(1,a)},()=>n(2,p=!0),()=>(c(),n(2,p=!1)),t=>h(t)]}class Zn extends rt{constructor(t){super(),it(this,t,Qn,Kn,r,{errorsJson:3,versionsList:4,choosingVersion:0,coreMessages:5,settingsJson:1,startUpdate:6,saveSett:7,cleanLogs:8,show:9,paramsBeenChanged:2,cancelAlarm:10})}}function ts(e){let n,s,i,r;return{c(){n=v("svg"),s=v("path"),$(s,"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"),$(n,"class",i="h-8 w-8 "+e[0]),$(n,"width","8"),$(n,"height","8"),$(n,"viewBox",r=e[1]+" "+e[2]+" 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,e){h(t,n,e),p(n,s)},p(t,[e]){1&e&&i!==(i="h-8 w-8 "+t[0])&&$(n,"class",i),6&e&&r!==(r=t[1]+" "+t[2]+" 24 24")&&$(n,"viewBox",r)},i:t,o:t,d(t){t&&f(n)}}}function es(t,e,n){let{color:s}=e,{x:i=0}=e,{y:r=0}=e;return t.$$set=t=>{"color"in t&&n(0,s=t.color),"x"in t&&n(1,i=t.x),"y"in t&&n(2,r=t.y)},[s,i,r]}class ns extends rt{constructor(t){super(),it(this,t,es,ts,r,{color:0,x:1,y:2})}}function ss(t,e,n){const s=t.slice();return s[120]=e[n],s}function is(t){let e,n;return e=new jt({}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function rs(t){let e,n,s,i,r=t[120].name+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[120].ws,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){524288&s[0]&&r!==(r=t[120].name+"")&&O(n,r),524288&s[0]&&i!==(i=t[120].ws)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function os(t){let e,n,s,i,r,o,a,l,c,u,d,p;e=new Lt({props:{path:"/",$$slots:{default:[ls]},$$scope:{ctx:t}}}),s=new Lt({props:{path:"/config",$$slots:{default:[cs]},$$scope:{ctx:t}}}),r=new Lt({props:{path:"/connection",$$slots:{default:[us]},$$scope:{ctx:t}}}),a=new Lt({props:{path:"/list",$$slots:{default:[ds]},$$scope:{ctx:t}}}),c=new Lt({props:{path:"/system",$$slots:{default:[ps]},$$scope:{ctx:t}}});let g=fs;return{c(){et(e.$$.fragment),n=b(),et(s.$$.fragment),i=b(),et(r.$$.fragment),o=b(),et(a.$$.fragment),l=b(),et(c.$$.fragment),u=b(),d=x()},m(t,f){nt(e,t,f),h(t,n,f),nt(s,t,f),h(t,i,f),nt(r,t,f),h(t,o,f),nt(a,t,f),h(t,l,f),nt(c,t,f),h(t,u,f),h(t,d,f),p=!0},p(t,n){const i={};32792&n[0]|1073741824&n[3]&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};30752&n[0]|1073741824&n[3]&&(o.$$scope={dirty:n,ctx:t}),s.$set(o);const l={};458816&n[0]|1073741824&n[3]&&(l.$$scope={dirty:n,ctx:t}),r.$set(l);const u={};4718720&n[0]|1073741824&n[3]&&(u.$$scope={dirty:n,ctx:t}),a.$set(u);const d={};8587008&n[0]|1073741824&n[3]&&(d.$$scope={dirty:n,ctx:t}),c.$set(d)},i(t){p||(Q(e.$$.fragment,t),Q(s.$$.fragment,t),Q(r.$$.fragment,t),Q(a.$$.fragment,t),Q(c.$$.fragment,t),Q(g),p=!0)},o(t){Z(e.$$.fragment,t),Z(s.$$.fragment,t),Z(r.$$.fragment,t),Z(a.$$.fragment,t),Z(c.$$.fragment,t),Z(g),p=!1},d(t){st(e,t),t&&f(n),st(s,t),t&&f(i),st(r,t),t&&f(o),st(a,t),t&&f(l),st(c,t),t&&f(u),t&&f(d)}}}function as(e){let n,s;return n=new Dt({props:{title:"Нет соединения"}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function ls(t){let e,n;return e=new Ne({props:{show:t[4],layoutJson:t[15],pages:t[3],wsPush:t[41]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};16&n[0]&&(s.show=t[4]),32768&n[0]&&(s.layoutJson=t[15]),8&n[0]&&(s.pages=t[3]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function cs(t){let e,n;return e=new en({props:{show:t[5],configJson:t[11],widgetsJson:t[12],itemsJson:t[13],saveConfig:t[42],cleanLogs:t[43],rebootEsp:t[44],scenarioJson:t[14]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};32&n[0]&&(s.show=t[5]),2048&n[0]&&(s.configJson=t[11]),4096&n[0]&&(s.widgetsJson=t[12]),8192&n[0]&&(s.itemsJson=t[13]),16384&n[0]&&(s.scenarioJson=t[14]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function us(t){let e,n;return e=new vn({props:{show:t[6],rebootEsp:t[45],ssidClick:t[46],saveSett:t[47],saveMqtt:t[48],settingsJson:t[16],errorsJson:t[17],ssidJson:t[18]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};64&n[0]&&(s.show=t[6]),65536&n[0]&&(s.settingsJson=t[16]),131072&n[0]&&(s.errorsJson=t[17]),262144&n[0]&&(s.ssidJson=t[18]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ds(t){let e,n;return e=new Tn({props:{show:t[7],deviceList:t[19],showInput:gs,addDevInList:t[49],newDevice:t[22],sendToAllDevices:t[50]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};128&n[0]&&(s.show=t[7]),524288&n[0]&&(s.deviceList=t[19]),4194304&n[0]&&(s.newDevice=t[22]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ps(t){let e,n,s;function i(e){t[55](e)}let r={show:t[8],errorsJson:t[17],settingsJson:t[16],saveSett:t[51],cleanLogs:t[52],cancelAlarm:t[53],versionsList:t[9],startUpdate:t[54],coreMessages:t[23]};return void 0!==t[10]&&(r.choosingVersion=t[10]),e=new Zn({props:r}),E.push((()=>tt(e,"choosingVersion",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(t,s){const i={};256&s[0]&&(i.show=t[8]),131072&s[0]&&(i.errorsJson=t[17]),65536&s[0]&&(i.settingsJson=t[16]),512&s[0]&&(i.versionsList=t[9]),8388608&s[0]&&(i.coreMessages=t[23]),!n&&1024&s[0]&&(n=!0,i.choosingVersion=t[10],R((()=>n=!1))),e.$set(i)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function hs(t){let e,n,i,r,o,a,l,c,u,d,v,y,x,k,O,A,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,tt,it,rt,ot,at,lt=t[2]&&is(),ct=t[19],ut=[];for(let e=0;e",O=b(),A=m("ul"),T=m("li"),P=m("a"),P.textContent="Управление",M=b(),C=m("li"),S=m("a"),S.textContent="Конфигуратор",N=b(),_=m("li"),D=m("a"),D.textContent="Подключение",E=b(),j=m("li"),J=m("a"),J.textContent="Устройства",H=b(),z=m("li"),F=m("a"),F.textContent="Системные",q=b(),R=b(),I=m("main"),B=m("ul"),Y=m("div"),U.c(),tt=b(),it=m("footer"),it.innerHTML='Developed by Dmitry Borisenko
',$(a,"class","border border-indigo-500 border-4"),void 0===t[21]&&W((()=>t[37].call(a))),$(o,"class","px-15 py-1"),$(c,"class","pl-4 pr-4 py-1"),$(r,"class","flex content-center items-center justify-end"),$(i,"class","h-10 w-full bg-gray-100 overflow-auto shadow-md"),$(y,"class","w-0 h-0"),$(y,"id","menu__toggle"),$(y,"type","checkbox"),$(k,"class","menu__btn"),$(k,"for","menu__toggle"),$(P,"class","menu__item"),$(P,"href","/"),$(S,"class","menu__item"),$(S,"href","/config"),$(D,"class","menu__item"),$(D,"href","/connection"),$(J,"class","menu__item"),$(J,"href","/list"),$(F,"class","menu__item"),$(F,"href","/system"),$(A,"class","menu__box"),$(v,"class","flex"),$(Y,"class","bg-cover pt-0 px-4"),$(B,"class","menu__main"),$(I,"class",G="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")),$(it,"class","h-4 bg-gray-100 border-gray-200 shadow-lg"),$(e,"class","flex flex-col h-screen bg-gray-50")},m(s,f){h(s,e,f),lt&<.m(e,null),p(e,n),p(e,i),p(i,r),p(r,o),p(o,a);for(let t=0;t{lt=null})),K()),524288&s[0]){let e;for(ct=t[19],e=0;e{pt[r]=null})),K(),U=pt[V],U?U.p(t,s):(U=pt[V]=dt[V](t),U.c()),Q(U,1),U.m(Y,null)),(!rt||3&s[0]&&G!==(G="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")))&&$(I,"class",G)},i(t){rt||(Q(lt),Q(u.$$.fragment,t),Q(U),rt=!0)},o(t){Z(lt),Z(u.$$.fragment,t),Z(U),rt=!1},d(t){t&&f(e),lt&<.d(),g(ut,t),st(u),pt[V].d(),ot=!1,s(at)}}}let fs=!1,gs=!1;function ms(t,e){for(var n in e)t[n]=e[n];return t}function vs(t){try{JSON.parse(t)}catch(e){return console.log("[e]","json parce error: ",t),!1}return!0}function ys(t,e,n){let s;o(t,bt,(t=>n(85,s=t))),bt.mode.hash();let i=!1,r=!1,a=document.location.hostname,l=!0,c=!1;const u=void 0;let d,p=[],h=!1,f=!1,g=!1,m=!1,v=!1,y={},b=[],x=!1,w=!1,$=[],k=!1,O=!1,A=[],L=!1,P=!1,M={},C=!1,N=!1,_=[],D={},E=!1,j={},J=!1,H={},z=!1,F={},q=[],W=!1,R=[];R=[{name:"--",id:"--",ip:a,ws:0,status:!1}];let I,B=[],Y=!1,V=0,U=!0,G={},X=[];var K=function(){this.parts=[]};let Q;K.prototype.append=function(t){this.parts.push(t),this.blob=void 0},K.prototype.getBlob=function(){return this.blob||(this.blob=new Blob(this.parts,{type:"binary"})),this.blob},K.prototype.clear=function(){this.parts=[]};var Z=new K,tt=new K,et=new K,nt=new K,st=[];function it(){console.log("[i]","handle navigation"),Q=s.path.toString(),"/dev"!=Q&&vt(),Q+="|",console.log("[i]","user on page:",Q),"/|"===Q?kt(Q):rt()}function rt(){void 0!==V&&$t(V,Q)}function ot(){Pt(V);let t=0;R.forEach((e=>{e.ws=t,e.status||(lt(t),ut(t)),t++})),n(19,R)}function at(t,e){R.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(19,R),Pt(V),n(20,Y=I.status)}function lt(t){let e=ct(t);"error"===e?console.log("[e]","device list wrong"):(B[t]=new WebSocket("ws://"+e+":81"),B.binaryType="blob",console.log("[i]",e,t,"started connecting..."))}function ct(t){let e="error";return R.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function ut(t){if(B[t]){let e=ct(t);console.log("[i]",e,t,"web socket events added"),B[t].addEventListener("open",(function(n){console.log("[i]",e,t,"completed connecting"),at(t,!0),l&&$t(0,"/list|"),"/|"===Q?$t(t,Q):t===V&&rt()})),B[t].addEventListener("message",(function(e){if("string"==typeof e.data){let i=e.data;if(t===V){if(i.includes('devicelist":"')&&vs(i)&&(q=JSON.parse(i),l?(n(19,R=q),n(19,R[0].status=!0,R)):n(19,R=function(t,e){var n=new Set(t.map((t=>t.ip)));let s=[...t,...e.filter((t=>!n.has(t.ip)))];return s}(R,q)),l=!1,n(19,R),W=!0,console.log("✔","deviceList json parced"),dt(),Lt(),ot()),i.includes('ssid":"')&&vs(i)&&(n(18,H=JSON.parse(i)),n(18,H),console.log("✔","ssidJson parced"),z=!0,dt()),i.includes('errors":"')&&vs(i)&&(n(17,j=JSON.parse(i)),n(17,j),J=!0,console.log("✔","errorsJson json parced"),dt()),i.includes('settings":"')&&vs(i)&&(n(16,D=JSON.parse(i)),n(16,D),E=!0,console.log("✔","settingsJson json parced"),dt()),i.includes("/log|")&&(i=i.replace("/log|",""),console.log("",i),At(i)),"/st/scenario.json"===i&&(C=!0),"/end/scenario.json"===i){C=!1;var s=nt.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(14,M=JSON.parse(e)),n(14,M),N=!0,console.log("✔","scenarioJson parced",M),dt())}}if("/st/config.json"===i&&(x=!0),"/end/config.json"===i){x=!1;s=Z.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(11,b=JSON.parse(e)),n(11,b),w=!0,console.log("✔","configJson parced"),dt())}}if("/st/widgets.json"===i&&(k=!0),"/end/widgets.json"===i){k=!1;s=tt.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(12,$=JSON.parse(e)),n(12,$),O=!0,console.log("✔","widgetsJson parced"),dt())}}if("/st/items.json"===i&&(L=!0),"/end/items.json"===i){L=!1;s=et.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(13,A=JSON.parse(e)),n(13,A),P=!0,console.log("✔","itemsJson parced"),dt())}}}if("/end/layout.json"===i&&async function(t){var e=st[t].getBlob();let s=new FileReader;s.readAsText(e),s.onload=()=>{let e=JSON.parse(s.result);!function(t,e){for(const[n,s]of Object.entries(F))for(let i=0;i{console.log("[e]",e,"connection closed"),at(t,!1)})),B[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),at(t,!1)}))}else console.log("[e]","socket not exist")}async function dt(){"/|"===Q&&(yt(),console.log("✔","dashboard packet received"),n(4,h=!0)),"/config|"===Q&&P&&O&&w&&E&&N&&(yt(),console.log("✔✔","config data parced"),n(5,f=!0)),"/connection|"===Q&&z&&E&&J&&(yt(),console.log("✔✔","connection data parced"),n(6,g=!0)),"/list|"===Q&&W&&(yt(),console.log("✔✔","list data parced"),n(7,m=!0)),"/system|"===Q&&J&&E&&(yt(),async function(){try{let t=D.serverip+"/iotm/ver.json";console.log("url",t);let e=await fetch(t,{mode:"cors",method:"GET"});e.ok?(n(9,y=await e.json()),n(9,y=y[j.bn]),n(10,d=j.bver),console.log(JSON.stringify(y))):(n(10,d=void 0),console.log("error, versions list not received",e.statusText))}catch(t){n(10,d=void 0),console.log("error, versions list not received"),console.log(t)}}(),console.log("✔✔","system data parced"),n(8,v=!0))}function pt(){$t(V,"/tuoyal|"+JSON.stringify(function(){let t=[];for(let e=0;e5?(!function(t,e,n,s,i){for(let r=0;r5?$t(V,"/sgnittes|"+JSON.stringify(D)):window.alert("Ошибка"),vt(),$t(V,"/mqtt|")}bt.subscribe(it),S((async()=>{console.log("[i]","mounted"),Lt(),l=!0,ot(),wt(),Ot()}));let mt={};function vt(){n(11,b=[]),Z.clear(),n(12,$=[]),tt.clear(),n(13,A=[]),et.clear(),n(15,_=[]),st=[],n(14,M=""),nt.clear(),n(16,D={}),n(17,j={}),n(4,h=!1),n(5,f=!1),n(6,g=!1),n(7,m=!1),n(8,v=!1),yt(),console.log("[i]","all app data cleared")}function yt(){w=!1,O=!1,P=!1,E=!1,J=!1,z=!1,W=!1,N=!1,function(){for(let t=0;t{!function(t){let e=!1;return R.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(lt(t.ws),ut(t.ws)):$t(t.ws,"/tst|")})),U=!1)}function $t(t,e){B[t]&&1===B[t].readyState?(B[t].send(e),console.log("[i]",ct(t),t,"msg send success",e)):console.log("[e]",ct(t),t,"msg not send",e)}function kt(t){R.forEach((e=>{e.status&&$t(e.ws,t)}))}function Ot(){_.sort((function(t,e){return t.descre.descr?1:0})),n(3,p=[]);Array.from(new Set(Array.from(_,(({page:t})=>t)))).forEach((function(t,e,s){n(3,p=[...p,JSON.parse(JSON.stringify({page:t}))])})),p.sort((function(t,e){return t.pagee.page?1:0}))}mt={name:"inputDate",descr:"Выберите дату",widget:"input",size:"small",color:"orange",type:"date"};const At=t=>{X.length>=100&&X.shift(),n(23,X=[...X,{msg:t}]),X.sort((function(t,e){return t.time>e.time?-1:t.timeTt(),function(){i=this.checked,n(0,i)},()=>Ct(),(t,e,n)=>xt(t,e,n),()=>pt(),()=>ft(),()=>Nt(),()=>Nt(),()=>St(),()=>ht(),()=>gt(),()=>Mt(),t=>kt(t),()=>ht(),()=>ft(),t=>Dt(t),()=>Et(),function(t){d=t,n(10,d)}]}return new class extends rt{constructor(t){super(),it(this,t,ys,hs,r,{},null,[-1,-1,-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 s(t){t.forEach(e)}function i(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 a(t,e,n,s){if(t){const i=l(t,e,n,s);return t[0](i)}}function l(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 c(t,e,n,s){if(t[2]&&s){const i=t[2](s(n));if(void 0===e.dirty)return i;if("object"==typeof i){const t=[],n=Math.max(e.dirty.length,i.length);for(let s=0;s32){const e=[],n=t.ctx.length/32;for(let t=0;tt.removeEventListener(e,n,s)}function $(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function k(t){return""===t?null:+t}function O(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function A(t,e){t.value=null==e?"":e}function L(t,e){for(let n=0;nt.call(this,e)))}const D=[],E=[],j=[],J=[],H=Promise.resolve();let z=!1;function F(){z||(z=!0,H.then(Y))}function q(){return F(),H}function W(t){j.push(t)}function R(t){J.push(t)}const I=new Set;let B=0;function Y(){const t=P;do{for(;B{U.delete(t),s&&(n&&t.d(1),s())})),t.o(e)}else s&&s()}function tt(t,e,n){const s=t.$$.props[e];void 0!==s&&(t.$$.bound[s]=n,n(t.$$.ctx[s]))}function et(t){t&&t.c()}function nt(t,n,r,o){const{fragment:a,on_mount:l,on_destroy:c,after_update:u}=t.$$;a&&a.m(n,r),o||W((()=>{const n=l.map(e).filter(i);c?c.push(...n):s(n),t.$$.on_mount=[]})),u.forEach(W)}function st(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 it(e,i,r,o,a,l,c,u=[-1]){const d=P;M(e);const p=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:a,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(i.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:i.target||d.$$.root};c&&c(p.root);let h=!1;if(p.ctx=r?r(e,i.props||{},((t,n,...s)=>{const i=s.length?s[0]:n;return p.ctx&&a(p.ctx[t],p.ctx[t]=i)&&(!p.skip_bound&&p.bound[t]&&p.bound[t](i),h&&function(t,e){-1===t.$$.dirty[0]&&(D.push(t),F(),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 ot=[];function at(e,n=t){let s;const i=new Set;function o(t){if(r(e,t)&&(e=t,s)){const t=!ot.length;for(const t of i)t[1](),ot.push(t,e);if(t){for(let t=0;t{i.delete(l),0===i.size&&(s(),s=null)}}}}function lt(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 ct(t,e,n){if(""===n)return t;if("/"===n[0])return n;let s=t=>t.split("/").filter((t=>""!==t)),i=s(t);return"/"+(e?s(e):[]).map(((t,e)=>i[e])).join("/")+"/"+n}function ut(t,e,n,s){let i=[e,"data-"+e].reduce(((e,s)=>{let i=t.getAttribute(s);return n&&t.removeAttribute(s),null===i?e:i}),!1);return!s&&""===i||(i||s||!1)}function dt(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 pt,ht,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=ht=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=>ht=e))})(e,t,s),n()},start(e){t=e,s()},stop(){t=null,s(ft.OFF)}}}();function mt(t){let e=pt,n=pt=ft.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>ht||"/")),s=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:s[1]||"",query:dt(s[2]||""),hash:s[3]||""}}function vt(t){let e=N("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",s=at({}),i={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){i.exact=!t.path.endsWith("/*"),i.pattern=lt(`${i.parent&&i.parent.pattern||""}${t.path}`),i.redirect=t.redirect,i.firstmatch=t.firstmatch,i.breadcrumb=t.breadcrumb,i.match()},register:()=>{if(i.parent)return i.parent[n].add(i),()=>{i.parent[n].delete(i),i.router.un&&i.router.un()}},show:()=>{t.onShow(),!i.fallback&&i.parent&&i.parent.activeChilds.add(i)},hide:()=>{t.onHide(),!i.fallback&&i.parent&&i.parent.activeChilds.delete(i)},match:async()=>{i.matched=!1;let{path:e,url:n,from:r,query:o}=i.router,a=function(t,e){t=lt(t,!0),e=lt(e,!0);let n=[],s={},i=!0,r=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),o=e.match(new RegExp(`^${r}$`));return o||(i=!1,o=e.match(new RegExp(`^${r}`))),o?(n.forEach(((t,e)=>s[t]=o[e+1])),{exact:i,params:s,part:o[0].slice(0,-1)}):null}(i.pattern,e);if(!i.fallback&&a&&i.redirect&&(!i.exact||i.exact&&a.exact)){await q();let t=ct(e,i.parent&&i.parent.pattern,i.redirect);return bt.goto(t,!0)}if(i.meta=a&&{from:r,url:n,query:o,match:a.part,pattern:i.pattern,breadcrumbs:i.parent&&i.parent.meta&&i.parent.meta.breadcrumbs.slice()||[],params:a.params,subscribe:s.subscribe},i.breadcrumb&&i.meta&&i.meta.breadcrumbs.push({name:i.breadcrumb,path:a.part}),s.set(i.meta),!a||i.fallback||!(!i.exact||i.exact&&a.exact)||i.parent&&i.parent.firstmatch&&i.parent.matched?i.hide():(t.onMeta(i.meta),i.parent&&(i.parent.matched=!0),i.show()),await q(),a&&!i.fallback&&(i.childs.size>0&&0==i.activeChilds.size||0==i.childs.size&&i.fallbacks.size>0)){let t=i;for(;0==t.fallbacks.size;)if(t=t.parent,!t)return;t&&t.fallbacks.forEach((t=>{if(t.redirect){let e=ct("/",t.parent&&t.parent.pattern,t.redirect);bt.goto(e,!0)}else t.show()}))}}};return r="tinro",o=i,C().$$.context.set(r,o),S((()=>i.register())),i.router.un=bt.subscribe((t=>{i.router.path=t.path,i.router.url=t.url,i.router.query=t.query,i.router.from=t.from,null!==i.pattern&&i.match()})),i;var r,o}function yt(){return N("tinro").meta}var bt=function(){let{subscribe:t}=at(gt.get(),(t=>{gt.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),s=n&&ut(n,"target",!1,"_self"),i=n&&ut(n,"tinro-ignore"),r=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==s&&!i&&!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:xt,meta:yt,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 xt(){return N("tinro").meta.params}const wt=t=>({params:2&t,meta:4&t}),$t=t=>({params:t[1],meta:t[2]});function kt(t){let e;const n=t[9].default,s=a(n,t,t[8],$t);return{c(){s&&s.c()},m(t,n){s&&s.m(t,n),e=!0},p(t,i){s&&s.p&&(!e||262&i)&&u(s,n,t,t[8],e?c(n,t[8],i,wt):d(t[8]),$t)},i(t){e||(Q(s,t),e=!0)},o(t){Z(s,t),e=!1},d(t){s&&s.d(t)}}}function Ot(t){let e,n,s=t[0]&&kt(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,[n]){t[0]?s?(s.p(t,n),1&n&&Q(s,1)):(s=kt(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function At(t,e,n){let{$$slots:s={},$$scope:i}=e,{path:r="/*"}=e,{fallback:o=!1}=e,{redirect:a=!1}=e,{firstmatch:l=!1}=e,{breadcrumb:c=null}=e,u=!1,d={},p={};const h=vt({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,a=t.redirect),"firstmatch"in t&&n(6,l=t.firstmatch),"breadcrumb"in t&&n(7,c=t.breadcrumb),"$$scope"in t&&n(8,i=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&h.update({path:r,redirect:a,firstmatch:l,breadcrumb:c})},[u,d,p,r,o,a,l,c,i,s]}class Lt extends rt{constructor(t){super(),it(this,t,At,Ot,r,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function Tt(e){let n,s,r,o,a;return{c(){n=v("svg"),s=v("line"),r=v("line"),$(s,"x1","18"),$(s,"y1","6"),$(s,"x2","6"),$(s,"y2","18"),$(r,"x1","6"),$(r,"y1","6"),$(r,"x2","18"),$(r,"y2","18"),$(n,"class","h-6 w-6 text-red-400 cursor-pointer"),$(n,"viewBox","0 -2 24 24"),$(n,"fill","none"),$(n,"stroke","currentColor"),$(n,"stroke-width","2"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,l){h(t,n,l),p(n,s),p(n,r),o||(a=w(n,"click",(function(){i(e[0]())&&e[0]().apply(this,arguments)})),o=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&f(n),o=!1,a()}}}function Pt(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class Mt extends rt{constructor(t){super(),it(this,t,Pt,Tt,r,{click:0})}}function Ct(t){let e,n,s,i,r,o,a,l;return a=new Mt({props:{click:t[5]}}),{c(){e=m("div"),n=m("div"),s=m("h1"),i=y(t[0]),r=b(),o=m("div"),et(a.$$.fragment),$(s,"class","alm-hdr"),$(n,"class","w-11/12"),$(o,"class","flex justify-end w-1/12"),$(e,"class","flex items-center")},m(t,c){h(t,e,c),p(e,n),p(n,s),p(s,i),p(e,r),p(e,o),nt(a,o,null),l=!0},p(t,e){(!l||1&e)&&O(i,t[0]);const n={};4&e&&(n.click=t[5]),a.$set(n)},i(t){l||(Q(a.$$.fragment,t),l=!0)},o(t){Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(a)}}}function St(e){let n,s;return{c(){n=m("h1"),s=y(e[0]),$(n,"class","alm-hdr")},m(t,e){h(t,n,e),p(n,s)},p(t,e){1&e&&O(s,t[0])},i:t,o:t,d(t){t&&f(n)}}}function Nt(t){let e,n,s,i,r;const o=[St,Ct],l=[];function g(t,e){return t[0]&&!t[1]?0:t[0]&&t[1]?1:-1}~(n=g(t))&&(s=l[n]=o[n](t));const v=t[4].default,y=a(v,t,t[3],null);return{c(){e=m("div"),s&&s.c(),i=b(),y&&y.c(),$(e,"class","alm")},m(t,s){h(t,e,s),~n&&l[n].m(e,null),p(e,i),y&&y.m(e,null),r=!0},p(t,[a]){let p=n;n=g(t),n===p?~n&&l[n].p(t,a):(s&&(X(),Z(l[p],1,1,(()=>{l[p]=null})),K()),~n?(s=l[n],s?s.p(t,a):(s=l[n]=o[n](t),s.c()),Q(s,1),s.m(e,i)):s=null),y&&y.p&&(!r||8&a)&&u(y,v,t,t[3],r?c(v,t[3],a,null):d(t[3]),null)},i(t){r||(Q(s),Q(y,t),r=!0)},o(t){Z(s),Z(y,t),r=!1},d(t){t&&f(e),~n&&l[n].d(),y&&y.d(t)}}}function _t(t,e,n){let{$$slots:s={},$$scope:i}=e,{title:r=!1}=e,{cross:o=!1}=e,{close:a=(()=>{})}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"cross"in t&&n(1,o=t.cross),"close"in t&&n(2,a=t.close),"$$scope"in t&&n(3,i=t.$$scope)},[r,o,a,i,s,()=>a()]}class Dt extends rt{constructor(t){super(),it(this,t,_t,Nt,r,{title:0,cross:1,close:2})}}function Et(e){let n;return{c(){n=m("div"),n.innerHTML='',$(n,"class","fixed z-10 inset-0 overflow-y-auto"),$(n,"aria-labelledby","modal-title"),$(n,"role","dialog"),$(n,"aria-modal","true")},m(t,e){h(t,n,e)},p:t,i:t,o:t,d(t){t&&f(n)}}}class jt extends rt{constructor(t){super(),it(this,t,null,Et,r,{})}}function Jt(t){let e,n,s,i=t[0]&&Ht(t);const r=t[3].default,o=a(r,t,t[2],null);return{c(){e=m("div"),i&&i.c(),n=b(),o&&o.c(),$(e,"class","crd")},m(t,r){h(t,e,r),i&&i.m(e,null),p(e,n),o&&o.m(e,null),s=!0},p(t,a){t[0]?i?i.p(t,a):(i=Ht(t),i.c(),i.m(e,n)):i&&(i.d(1),i=null),o&&o.p&&(!s||4&a)&&u(o,r,t,t[2],s?c(r,t[2],a,null):d(t[2]),null)},i(t){s||(Q(o,t),s=!0)},o(t){Z(o,t),s=!1},d(t){t&&f(e),i&&i.d(),o&&o.d(t)}}}function Ht(t){let e,n;return{c(){e=m("h1"),n=y(t[0]),$(e,"class","crd-hdr")},m(t,s){h(t,e,s),p(e,n)},p(t,e){1&e&&O(n,t[0])},d(t){t&&f(e)}}}function zt(t){let e,n,s=t[1]&&Jt(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,[n]){t[1]?s?(s.p(t,n),2&n&&Q(s,1)):(s=Jt(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Ft(t,e,n){let{$$slots:s={},$$scope:i}=e,{title:r=!1}=e,{show:o=!0}=e;return t.$$set=t=>{"title"in t&&n(0,r=t.title),"show"in t&&n(1,o=t.show),"$$scope"in t&&n(2,i=t.$$scope)},[r,o,i,s]}class qt extends rt{constructor(t){super(),it(this,t,Ft,zt,r,{title:0,show:1})}}function Wt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"step","0.1"),$(e,"type","number")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[4]),w(e,"input",t[5])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&k(e.value)!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function Rt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","text")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[6]),w(e,"input",t[7])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&e.value!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function It(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","date")},m(n,s){h(n,e,s),A(e,t[2]),i||(r=[w(e,"change",t[8]),w(e,"input",t[9])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),4&s&&A(e,t[2])},d(t){t&&f(e),i=!1,s(r)}}}function Bt(t){let e,n,i,r;return{c(){e=m("input"),$(e,"class",n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","time")},m(n,s){h(n,e,s),A(e,t[0].status),i||(r=[w(e,"change",t[10]),w(e,"input",t[11])],i=!0)},p(t,s){1&s&&n!==(n=t[0].sent?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&s&&A(e,t[0].status)},d(t){t&&f(e),i=!1,s(r)}}}function Yt(e){let n,s,i,r,o,a,l,c,u,d=(e[0].descr?e[0].descr:"")+"",g="number"==e[0].type&&Wt(e),v="text"==e[0].type&&Rt(e),x="date"==e[0].type&&It(e),w="time"==e[0].type&&Bt(e);return{c(){n=m("div"),s=m("div"),i=m("label"),r=y(d),o=b(),a=m("div"),g&&g.c(),l=b(),v&&v.c(),c=b(),x&&x.c(),u=b(),w&&w.c(),$(i,"class","wgt-dscr-stl"),$(s,"class","w-2/3"),$(a,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,e){h(t,n,e),p(n,s),p(s,i),p(i,r),p(n,o),p(n,a),g&&g.m(a,null),p(a,l),v&&v.m(a,null),p(a,c),x&&x.m(a,null),p(a,u),w&&w.m(a,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&O(r,d),"number"==t[0].type?g?g.p(t,e):(g=Wt(t),g.c(),g.m(a,l)):g&&(g.d(1),g=null),"text"==t[0].type?v?v.p(t,e):(v=Rt(t),v.c(),v.m(a,c)):v&&(v.d(1),v=null),"date"==t[0].type?x?x.p(t,e):(x=It(t),x.c(),x.m(a,u)):x&&(x.d(1),x=null),"time"==t[0].type?w?w.p(t,e):(w=Bt(t),w.c(),w.m(a,null)):w&&(w.d(1),w=null)},i:t,o:t,d(t){t&&f(n),g&&g.d(),v&&v.d(),x&&x.d(),w&&w.d()}}}function Vt(t,e,n){t+=e;let s=0;do{if(s==n)return Ut(t,e);t=Gt(t,e),s++}while(0!=t.length);return"not found"}function Ut(t,e){let n=t.indexOf(e);return t.substring(0,n)}function Gt(t,e){let n=t.indexOf(e)+e.length;return t.substring(n)}function Xt(t,e,n){let{widget:s}=e,{wsPush:i=((t,e,n)=>{})}=e,r="";function o(){n(0,s.status=Vt(r,"-",2)+"."+Vt(r,"-",1)+"."+Vt(r,"-",0),s),i(s.ws,s.topic,s.status)}return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"wsPush"in t&&n(1,i=t.wsPush)},t.$$.update=()=>{1&t.$$.dirty&&(s.status,function(){let t=s.status;n(2,r=Vt(t,".",2)+"-"+Vt(t,".",1)+"-"+Vt(t,".",0))}())},[s,i,r,o,()=>(n(0,s.sent=!0,s),i(s.ws,s.topic,s.status)),function(){s.status=k(this.value),n(0,s)},()=>(n(0,s.sent=!0,s),i(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)},()=>(n(0,s.sent=!0,s),o()),function(){r=this.value,n(2,r)},()=>(n(0,s.sent=!0,s),i(s.ws,s.topic,s.status)),function(){s.status=this.value,n(0,s)}]}class Kt extends rt{constructor(t){super(),it(this,t,Xt,Yt,r,{widget:0,wsPush:1})}}function Qt(e){let n,i,r,o,a,l,c,u,d,g,v,x=(e[0].descr?e[0].descr:"")+"",k=e[0].after+"";return{c(){n=m("label"),i=y(x),r=b(),o=y(e[1]),a=b(),l=y(k),c=b(),u=m("input"),$(n,"class","wgt-dscr-stl"),$(u,"class",d="form-range range-secondary w-full h-2 p-0 rounded-lg "+(e[0].sent?"bg-red-300":"bg-gray-300")+" focus:outline-none appearance-none"),$(u,"type","range"),$(u,"min","0"),$(u,"max","1024")},m(t,s){h(t,n,s),p(n,i),p(n,r),p(n,o),p(n,a),p(n,l),h(t,c,s),h(t,u,s),A(u,e[0].status),g||(v=[w(u,"change",e[3]),w(u,"input",e[3]),w(u,"change",e[4])],g=!0)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&O(i,x),2&e&&O(o,t[1]),1&e&&k!==(k=t[0].after+"")&&O(l,k),1&e&&d!==(d="form-range range-secondary w-full h-2 p-0 rounded-lg "+(t[0].sent?"bg-red-300":"bg-gray-300")+" focus:outline-none appearance-none")&&$(u,"class",d),1&e&&A(u,t[0].status)},i:t,o:t,d(t){t&&f(n),t&&f(c),t&&f(u),g=!1,s(v)}}}function Zt(t,e,n){let{widget:s}=e,{wsPush:i=((t,e,n)=>{})}=e,{val:r=0}=e;function o(){n(1,r=function(t,e,n,s,i){return Math.round((t-e)*(i-s)/(n-e)+s)}(s.status,0,1024,s.min,s.max))}return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"wsPush"in t&&n(2,i=t.wsPush),"val"in t&&n(1,r=t.val)},t.$$.update=()=>{1&t.$$.dirty&&(s.status,o())},[s,r,i,function(){s.status=k(this.value),n(0,s)},()=>(n(0,s.sent=!0,s),i(s.ws,s.topic,s.status))]}class te extends rt{constructor(t){super(),it(this,t,Zt,Qt,r,{widget:0,wsPush:2,val:1})}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var ee,ne,se=(ee=function(t,e){t.exports=function(){function t(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function e(t){var e=t.getBoundingClientRect();return{top:e.top+(document.documentElement.scrollTop||document.body.scrollTop),left:e.left+(document.documentElement.scrollLeft||document.body.scrollLeft)}}function n(t){return null===t.offsetParent}function s(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function i(t){var e=window.getComputedStyle(t),n=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.clientWidth-n}function r(t,e,n){var s=document.createEvent("HTMLEvents");for(var i in s.initEvent(e,!0,!0),n)s[i]=n[i];return t.dispatchEvent(s)}function o(t){return t.titleHeight+t.margins.top+t.paddings.top}function a(t){return t.margins.left+t.paddings.left}function l(t){return t.margins.top+t.margins.bottom+t.paddings.top+t.paddings.bottom+t.titleHeight+t.legendHeight}function c(t){return t.margins.left+t.margins.right+t.paddings.left+t.paddings.right}function u(t){return parseFloat(t.toFixed(2))}function d(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n||(n=s?t[0]:t[t.length-1]);var i=new Array(Math.abs(e)).fill(n);return s?i.concat(t):t.concat(i)}function p(t,e){return(t+"").length*e}function h(t,e){return{x:Math.sin(t*Qt)*e,y:Math.cos(t*Qt)*e}}function f(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(Number.isNaN(t)||void 0===t||!Number.isFinite(t)||e&&t<0)}function g(t){return Number(Math.round(t+"e4")+"e-4")}function m(t){var e=void 0,n=void 0,s=void 0;if(t instanceof Date)return new Date(t.getTime());if("object"!==(void 0===t?"undefined":Ht(t))||null===t)return t;for(s in e=Array.isArray(t)?[]:{},t)n=t[s],e[s]=m(n);return e}function v(t,e){var n=void 0,s=void 0;return t<=e?(n=e-t,s=t):(n=t-e,s=e),[n,s]}function y(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-t.length;return n>0?t=d(t,n):e=d(e,n),[t,e]}function b(t,e){if(t)return t.length>e?t.slice(0,e-3)+"...":t}function x(t){var e=void 0;if("number"==typeof t)e=t;else if("string"==typeof t&&(e=Number(t),Number.isNaN(e)))return t;var n=Math.floor(Math.log10(Math.abs(e)));if(n<=2)return e;var s=Math.floor(n/3),i=Math.pow(10,n-3*s)*+(e/Math.pow(10,n)).toFixed(1);return Math.round(100*i)/100+" "+["","K","M","B","T"][s]}function w(t,e){for(var n=[],s=0;s255?255:t<0?0:t}function k(t,e){var n=ee(t),s=!1;"#"==n[0]&&(n=n.slice(1),s=!0);var i=parseInt(n,16),r=$((i>>16)+e),o=$((i>>8&255)+e);return(s?"#":"")+($((255&i)+e)|o<<8|r<<16).toString(16)}function O(t){var e=/(^\s*)(rgb|hsl)(a?)[(]\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*,\s*([\d.]+\s*%?)\s*(?:,\s*([\d.]+)\s*)?[)]$/i;return/(^\s*)(#)((?:[A-Fa-f0-9]{3}){1,2})$/i.test(t)||e.test(t)}function A(t,e){return"string"==typeof t?(e||document).querySelector(t):t||null}function L(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg",t);for(var s in e){var i=e[s];if("inside"===s)A(i).appendChild(n);else if("around"===s){var r=A(i);r.parentNode.insertBefore(n,r),n.appendChild(r)}else"styles"===s?"object"===(void 0===i?"undefined":Ht(i))&&Object.keys(i).map((function(t){n.style[t]=i[t]})):("className"===s&&(s="class"),"innerHTML"===s?n.textContent=i:n.setAttribute(s,i))}return n}function T(t,e){return L("linearGradient",{inside:t,id:e,x1:0,x2:0,y1:0,y2:1})}function P(t,e,n,s){return L("stop",{inside:t,style:"stop-color: "+n,offset:e,"stop-opacity":s})}function M(t,e,n,s){return L("svg",{className:e,inside:t,width:n,height:s})}function C(t){return L("defs",{inside:t})}function S(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n={className:t,transform:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""};return e&&(n.inside=e),L("g",n)}function N(t){return L("path",{className:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",d:t,styles:{stroke:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"none",fill:arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none","stroke-width":arguments.length>4&&void 0!==arguments[4]?arguments[4]:2}})}function _(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=n.y+e.y;return"M"+n.x+" "+n.y+"\n\t\tL"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+" z"}function D(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=2*n.y,u=n.y+e.y;return"M"+n.x+" "+n.y+"\n\t\tL"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+" z\n\t\tL"+o+" "+c+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+u+" z"}function E(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return"M"+(n.x+t.x)+" "+(n.y+t.y)+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+(n.x+e.x)+" "+(n.y+e.y)}function j(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=n.x+t.x,a=n.y+t.y,l=n.x+e.x,c=2*s+a;return"M"+o+" "+a+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+c+"\n\t\tM"+o+" "+c+"\n\t\tA "+s+" "+s+" 0 "+r+" "+(i?1:0)+"\n\t\t"+l+" "+(n.y+t.y)}function J(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s="path-fill-gradient-"+e+"-"+(n?"lighter":"default"),i=T(t,s),r=[1,.6,.2];return n&&(r=[.4,.2,0]),P(i,"0%",e,r[0]),P(i,"50%",e,r[1]),P(i,"100%",e,r[2]),s}function H(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Ut,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none";return L("rect",{className:"percentage-bar",x:t,y:e,width:n,height:s,fill:r,styles:{stroke:k(r,-25),"stroke-dasharray":"0, "+(s+n)+", "+n+", "+s,"stroke-width":i}})}function z(t,e,n,s,i){var r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},o={className:t,x:e,y:n,width:s,height:s,rx:i,fill:arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none"};return Object.keys(r).map((function(t){o[t]=r[t]})),L("rect",o)}function F(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",i=arguments[4];i=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(i,ie):i;var r={className:"legend-bar",x:0,y:0,width:n,height:"2px",fill:s},o=L("text",{className:"legend-dataset-text",x:0,y:0,dy:2*re+"px","font-size":1.2*re+"px","text-anchor":"start",fill:ae,innerHTML:i}),a=L("g",{transform:"translate("+t+", "+e+")"});return a.appendChild(L("rect",r)),a.appendChild(o),a}function q(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",i=arguments[4];i=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(i,ie):i;var r={className:"legend-dot",cx:0,cy:0,r:n,fill:s},o=L("text",{className:"legend-dataset-text",x:0,y:0,dx:re+"px",dy:re/3+"px","font-size":1.2*re+"px","text-anchor":"start",fill:ae,innerHTML:i}),a=L("g",{transform:"translate("+t+", "+e+")"});return a.appendChild(L("circle",r)),a.appendChild(o),a}function W(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=i.fontSize||re;return L("text",{className:t,x:e,y:n,dy:(void 0!==i.dy?i.dy:r/2)+"px","font-size":r+"px",fill:i.fill||ae,"text-anchor":i.textAnchor||"start",innerHTML:s})}function R(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};i.stroke||(i.stroke=oe);var r=L("line",{className:"line-vertical "+i.className,x1:0,x2:0,y1:n,y2:s,styles:{stroke:i.stroke}}),o=L("text",{x:0,y:n>s?n+se:n-se-re,dy:re+"px","font-size":re+"px","text-anchor":"middle",innerHTML:e+""}),a=L("g",{transform:"translate("+t+", 0)"});return a.appendChild(r),a.appendChild(o),a}function I(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};i.stroke||(i.stroke=oe),i.lineType||(i.lineType=""),i.shortenNumbers&&(e=x(e));var r=L("line",{className:"line-horizontal "+i.className+("dashed"===i.lineType?"dashed":""),x1:n,x2:s,y1:0,y2:0,styles:{stroke:i.stroke}}),o=L("text",{x:n3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),s.pos||(s.pos="left"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=oe),s.className||(s.className="");var i=-1*ne,r="span"===s.mode?n+ne:0;return"tick"===s.mode&&"right"===s.pos&&(i=n+ne,r=n),I(t,e,i+=s.offset,r+=s.offset,{stroke:s.stroke,className:s.className,lineType:s.lineType,shortenNumbers:s.shortenNumbers})}function Y(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),s.pos||(s.pos="bottom"),s.offset||(s.offset=0),s.mode||(s.mode="span"),s.stroke||(s.stroke=oe),s.className||(s.className="");var i=n+ne,r="span"===s.mode?-1*ne:n;return"tick"===s.mode&&"top"===s.pos&&(i=-1*ne,r=0),R(t,e,i,r,{stroke:s.stroke,className:s.className,lineType:s.lineType})}function V(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};s.labelPos||(s.labelPos="right");var i=L("text",{className:"chart-label",x:"left"===s.labelPos?se:n-p(e,5)-se,y:0,dy:re/-2+"px","font-size":re+"px","text-anchor":"start",innerHTML:e+""}),r=I(t,"",0,n,{stroke:s.stroke||oe,className:s.className||"",lineType:s.lineType});return r.appendChild(i),r}function U(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=t-e,o=L("rect",{className:"bar mini",styles:{fill:"rgba(228, 234, 239, 0.49)",stroke:oe,"stroke-dasharray":n+", "+r},x:0,y:0,width:n,height:r});i.labelPos||(i.labelPos="right");var a=L("text",{className:"chart-label",x:"left"===i.labelPos?se:n-p(s+"",4.5)-se,y:0,dy:re/-2+"px","font-size":re+"px","text-anchor":"start",innerHTML:s+""}),l=L("g",{transform:"translate(0, "+e+")"});return l.appendChild(o),l.appendChild(a),l}function G(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},l=v(e,a.zeroLine),c=It(l,2),u=c[0],d=c[1];d-=o,0===u&&(u=a.minHeight,d-=a.minHeight),f(t)||(t=0),f(d)||(d=0),f(u,!0)||(u=0),f(n,!0)||(n=0);var p=L("rect",{className:"bar mini",style:"fill: "+s,"data-point-index":r,x:t,y:d,width:n,height:u});if((i+="")||i.length){p.setAttribute("y",0),p.setAttribute("x",0);var h=L("text",{className:"data-point-value",x:n/2,y:0,dy:re/2*-1+"px","font-size":re+"px","text-anchor":"middle",innerHTML:i}),g=L("g",{"data-point-index":r,transform:"translate("+t+", "+d+")"});return g.appendChild(p),g.appendChild(h),g}return p}function X(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=L("circle",{style:"fill: "+s,"data-point-index":r,cx:t,cy:e,r:n});if((i+="")||i.length){o.setAttribute("cy",0),o.setAttribute("cx",0);var a=L("text",{className:"data-point-value",x:0,y:0,dy:re/2*-1-n+"px","font-size":re+"px","text-anchor":"middle",innerHTML:i}),l=L("g",{"data-point-index":r,transform:"translate("+t+", "+e+")"});return l.appendChild(o),l.appendChild(a),l}return o}function K(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},r=e.map((function(e,n){return t[n]+","+e})).join("L");s.spline&&(r=w(t,e));var o=N("M"+r,"line-graph-path",n);if(s.heatline){var a=J(i.svgDefs,n);o.style.stroke="url(#"+a+")"}var l={path:o};if(s.regionFill){var c=J(i.svgDefs,n,!0),u="M"+t[0]+","+i.zeroLine+"L"+r+"L"+t.slice(-1)[0]+","+i.zeroLine;l.region=N(u,"region-fill","none","url(#"+c+")")}return l}function Q(t,e,n,s){var i="string"==typeof e?e:e.join(", ");return[t,{transform:n.join(", ")},s,fe,"translate",{transform:i}]}function Z(t,e,n){return Q(t,[n,0],[e,0],pe)}function tt(t,e,n){return Q(t,[0,n],[0,e],pe)}function et(t,e,n,s){var i=e-n,r=t.childNodes[0];return[[r,{height:i,"stroke-dasharray":r.getAttribute("width")+", "+i},pe,fe],Q(t,[0,s],[0,n],pe)]}function nt(t,e,n,s){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=v(n,(arguments.length>5&&void 0!==arguments[5]?arguments[5]:{}).zeroLine),o=It(r,2),a=o[0],l=o[1];return l-=i,"rect"!==t.nodeName?[[t.childNodes[0],{width:s,height:a},ue,fe],Q(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,l],pe)]:[[t,{width:s,height:a,x:e,y:l},ue,fe]]}function st(t,e,n){return"circle"!==t.nodeName?[Q(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,n],pe)]:[[t,{cx:e,cy:n},ue,fe]]}function it(t,e,n,s,i){var r=[],o=n.map((function(t,n){return e[n]+","+t})).join("L");i&&(o=w(e,n));var a=[t.path,{d:"M"+o},de,fe];if(r.push(a),t.region){var l=e[0]+","+s+"L",c="L"+e.slice(-1)[0]+", "+s,u=[t.region,{d:"M"+l+o+c},de,fe];r.push(u)}return r}function rt(t,e){return[t,{d:e},ue,fe]}function ot(t,e,n){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"linear",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=t.cloneNode(!0),a=t.cloneNode(!0);for(var l in e){var c=void 0;c="transform"===l?document.createElementNS("http://www.w3.org/2000/svg","animateTransform"):document.createElementNS("http://www.w3.org/2000/svg","animate");var u=r[l]||t.getAttribute(l),d=e[l],p={attributeName:l,from:u,to:d,begin:"0s",dur:n/1e3+"s",values:u+";"+d,keySplines:ge[s],keyTimes:"0;1",calcMode:"spline",fill:"freeze"};for(var h in i&&(p.type=i),p)c.setAttribute(h,p[h]);o.appendChild(c),i?a.setAttribute(l,"translate("+d+")"):a.setAttribute(l,d)}return[o,a]}function at(t,e){t.style.transform=e,t.style.webkitTransform=e,t.style.msTransform=e,t.style.mozTransform=e,t.style.oTransform=e}function lt(t,e){var n=[],s=[];e.map((function(t){var e=t[0],i=e.parentNode,r=void 0,o=void 0;t[0]=e;var a=ot.apply(void 0,Bt(t)),l=It(a,2);r=l[0],o=l[1],n.push(o),s.push([r,i]),i&&i.replaceChild(r,e)}));var i=t.cloneNode(!0);return s.map((function(t,s){t[1]&&(t[1].replaceChild(n[s],t[0]),e[s][0]=n[s])})),i}function ct(t,e,n){if(0!==n.length){var s=lt(e,n);e.parentNode==t&&(t.removeChild(e),t.appendChild(s)),setTimeout((function(){s.parentNode==t&&(t.removeChild(s),t.appendChild(e))}),he)}}function ut(t,e){var n=document.createElement("a");n.style="display: none";var s=new Blob(e,{type:"image/svg+xml; charset=utf-8"}),i=window.URL.createObjectURL(s);n.href=i,n.download=t,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(i)}),300)}function dt(e){var n=e.cloneNode(!0);n.classList.add("chart-container"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink");var s=t.create("style",{innerHTML:me});n.insertBefore(s,n.firstChild);var i=t.create("div");return i.appendChild(n),i.innerHTML}function pt(t){var e=new Date(t);return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e}function ht(t){var e=t.getDate(),n=t.getMonth()+1;return[t.getFullYear(),(n>9?"":"0")+n,(e>9?"":"0")+e].join("-")}function ft(t){return new Date(t.getTime())}function gt(t,e){var n=xt(t);return Math.ceil(mt(n,e)/be)}function mt(t,e){var n=we*xe;return(pt(e)-pt(t))/n}function vt(t,e){return t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}function yt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=$e[t];return e?n.slice(0,3):n}function bt(t,e){return new Date(e,t+1,0)}function xt(t){var e=ft(t),n=e.getDay();return 0!==n&&wt(e,-1*n),e}function wt(t,e){t.setDate(t.getDate()+e)}function $t(t,e,n){var s=Object.keys(Ae).filter((function(e){return t.includes(e)})),i=Ae[s[0]];return Object.assign(i,{constants:e,getData:n}),new Oe(i)}function kt(t){if(0===t)return[0,0];if(isNaN(t))return{mantissa:-6755399441055744,exponent:972};var e=t>0?1:-1;if(!isFinite(t))return{mantissa:4503599627370496*e,exponent:972};t=Math.abs(t);var n=Math.floor(Math.log10(t));return[e*(t/Math.pow(10,n)),n]}function Ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Math.ceil(t),s=Math.floor(e),i=n-s,r=i,o=1;i>5&&(i%2!=0&&(i=++n-s),r=i/2,o=2),i<=2&&(o=i/(r=4)),0===i&&(r=5,o=1);for(var a=[],l=0;l<=r;l++)a.push(s+o*l);return a}function At(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=kt(t),s=It(n,2),i=s[0],r=s[1],o=e?e/Math.pow(10,r):0,a=Ot(i=i.toFixed(6),o);return a.map((function(t){return t*Math.pow(10,r)}))}function Lt(t){function e(t,e){for(var n=At(t),s=n[1]-n[0],i=0,r=1;i1&&void 0!==arguments[1]&&arguments[1],s=Math.max.apply(Math,Bt(t)),i=Math.min.apply(Math,Bt(t)),r=[];if(s>=0&&i>=0)kt(s)[1],r=n?At(s,i):At(s);else if(s>0&&i<0){var o=Math.abs(i);s>=o?(kt(s)[1],r=e(s,o)):(kt(o)[1],r=e(o,s).reverse().map((function(t){return-1*t})))}else if(s<=0&&i<=0){var a=Math.abs(i),l=Math.abs(s);kt(a)[1],r=(r=n?At(a,l):At(a)).reverse().map((function(t){return-1*t}))}return r}function Tt(t){var e=Pt(t);return t.indexOf(0)>=0?t.indexOf(0):t[0]>0?-1*t[0]/e:-1*t[t.length-1]/e+(t.length-1)}function Pt(t){return t[1]-t[0]}function Mt(t){return t[t.length-1]-t[0]}function Ct(t,e){return u(e.zeroLine-t*e.scaleMultiplier)}function St(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e.reduce((function(e,n){return Math.abs(n-t)n?s.slice(0,n):d(s,n-s.length,0),t.values=s}else t.values=i;t.chartType||(t.chartType=e)})),t.yRegions&&t.yRegions.map((function(t){if(t.end1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=t/e.length;s<=0&&(s=1);var i=s/Gt,r=void 0;if(n){var o=Math.max.apply(Math,Bt(e.map((function(t){return t.length}))));r=Math.ceil(o/i)}return e.map((function(t,e){return(t+="").length>i&&(n?e%r!=0&&(t=""):t=i-3>0?t.slice(0,i-3)+" ...":t.slice(0,i)+".."),t}))}function Jt(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"line",e=arguments[1],n=arguments[2];return"axis-mixed"===t?(n.type="line",new Me(e,n)):Se[t]?new Se[t](e,n):void console.error("Undefined chart type: "+t)}!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&s.firstChild?s.insertBefore(i,s.firstChild):s.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}('.chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ol,.graph-svg-tip ul{padding-left:0;display:-webkit-box;display:-ms-flexbox;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;-webkit-box-flex:1;-ms-flex:1;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:" ";border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}');var Ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zt=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},Ft=function(){function t(t,e){for(var n=0;n\n\t\t\t\t\n\t\t\t\t'}),this.hideTip(),this.title=this.container.querySelector(".title"),this.dataPointList=this.container.querySelector(".data-point-list"),this.parent.addEventListener("mouseleave",(function(){e.hideTip()}))}},{key:"fill",value:function(){var e=this,n=void 0;this.index&&this.container.setAttribute("data-point-index",this.index),n=this.titleValueFirst?""+this.titleValue+""+this.titleName:this.titleName+""+this.titleValue+"",this.title.innerHTML=n,this.dataPointList.innerHTML="",this.listValues.map((function(n,s){var i=e.colors[s]||"black",r=0===n.formatted||n.formatted?n.formatted:n.value,o=t.create("li",{styles:{"border-top":"3px solid "+i},innerHTML:''+(0===r||r?r:"")+"\n\t\t\t\t\t"+(n.title?n.title:"")});e.dataPointList.appendChild(o)}))}},{key:"calcPosition",value:function(){var t=this.container.offsetWidth;this.top=this.y-this.container.offsetHeight-5,this.left=this.x-t/2;var e=this.parent.offsetWidth-t,n=this.container.querySelector(".svg-pointer");if(this.left<0)n.style.left="calc(50% - "+-1*this.left+"px)",this.left=0;else if(this.left>e){var s="calc(50% + "+(this.left-e)+"px)";n.style.left=s,this.left=e}else n.style.left="50%"}},{key:"setValues",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;this.titleName=n.name,this.titleValue=n.value,this.listValues=s,this.x=t,this.y=e,this.titleValueFirst=n.valueFirst||0,this.index=i,this.refresh()}},{key:"hideTip",value:function(){this.container.style.top="0px",this.container.style.left="0px",this.container.style.opacity="0"}},{key:"showTip",value:function(){this.container.style.top=this.top+"px",this.container.style.left=this.left+"px",this.container.style.opacity="1"}}]),e}(),te={"light-blue":"#7cd6fd",blue:"#5e64ff",violet:"#743ee2",red:"#ff5858",orange:"#ffa00a",yellow:"#feef72",green:"#28a745","light-green":"#98d85b",purple:"#b554ff",magenta:"#ffa3ef",black:"#36114C",grey:"#bdd3e6","light-grey":"#f0f4f7","dark-grey":"#b8c2cc"},ee=function(t){return/rgb[a]{0,1}\([\d, ]+\)/gim.test(t)?/\D+(\d*)\D+(\d*)\D+(\d*)/gim.exec(t).map((function(t,e){return 0!==e?Number(t).toString(16):"#"})).reduce((function(t,e){return""+t+e})):te[t]||t},ne=6,se=4,ie=15,re=10,oe="#dadada",ae="#555b51",le={bar:function(t){var e=void 0;"rect"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode();return n.style.fill="#000000",n.style.opacity="0.4",e&&n.setAttribute("transform",e),n},dot:function(t){var e=void 0;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode(),s=t.getAttribute("r"),i=t.getAttribute("fill");return n.setAttribute("r",parseInt(s)+4),n.setAttribute("fill",i),n.style.opacity="0.6",e&&n.setAttribute("transform",e),n},heat_square:function(t){var e=void 0;"circle"!==t.nodeName&&(e=t.getAttribute("transform"),t=t.childNodes[0]);var n=t.cloneNode(),s=t.getAttribute("r"),i=t.getAttribute("fill");return n.setAttribute("r",parseInt(s)+4),n.setAttribute("fill",i),n.style.opacity="0.6",e&&n.setAttribute("transform",e),n}},ce={bar:function(t,e){var n=void 0;"rect"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["x","y","width","height"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)},dot:function(t,e){var n=void 0;"circle"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["cx","cy"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)},heat_square:function(t,e){var n=void 0;"circle"!==t.nodeName&&(n=t.getAttribute("transform"),t=t.childNodes[0]);var s=["cx","cy"];Object.values(t.attributes).filter((function(t){return s.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)}},ue=350,de=350,pe=ue,he=250,fe="easein",ge={ease:"0.25 0.1 0.25 1",linear:"0 0 1 1",easein:"0.1 0.8 0.2 1",easeout:"0 0 0.58 1",easeinout:"0.42 0 0.58 1"},me=".chart-container{position:relative;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','Roboto','Oxygen','Ubuntu','Cantarell','Fira Sans','Droid Sans','Helvetica Neue',sans-serif}.chart-container .axis,.chart-container .chart-label{fill:#555b51}.chart-container .axis line,.chart-container .chart-label line{stroke:#dadada}.chart-container .dataset-units circle{stroke:#fff;stroke-width:2}.chart-container .dataset-units path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container .dataset-path{stroke-width:2px}.chart-container .path-group path{fill:none;stroke-opacity:1;stroke-width:2px}.chart-container line.dashed{stroke-dasharray:5,3}.chart-container .axis-line .specific-value{text-anchor:start}.chart-container .axis-line .y-line{text-anchor:end}.chart-container .axis-line .x-line{text-anchor:middle}.chart-container .legend-dataset-text{fill:#6c7680;font-weight:600}.graph-svg-tip{position:absolute;z-index:99999;padding:10px;font-size:12px;color:#959da5;text-align:center;background:rgba(0,0,0,.8);border-radius:3px}.graph-svg-tip ul{padding-left:0;display:flex}.graph-svg-tip ol{padding-left:0;display:flex}.graph-svg-tip ul.data-point-list li{min-width:90px;flex:1;font-weight:600}.graph-svg-tip strong{color:#dfe2e5;font-weight:600}.graph-svg-tip .svg-pointer{position:absolute;height:5px;margin:0 0 0 -5px;content:' ';border:5px solid transparent;border-top-color:rgba(0,0,0,.8)}.graph-svg-tip.comparison{padding:0;text-align:left;pointer-events:none}.graph-svg-tip.comparison .title{display:block;padding:10px;margin:0;font-weight:600;line-height:1;pointer-events:none}.graph-svg-tip.comparison ul{margin:0;white-space:nowrap;list-style:none}.graph-svg-tip.comparison li{display:inline-block;padding:5px 10px}",ve=function(){function e(t,n){if(zt(this,e),n=m(n),this.parent="string"==typeof t?document.querySelector(t):t,!(this.parent instanceof HTMLElement))throw new Error("No `parent` element to render on was provided.");this.rawChartArgs=n,this.title=n.title||"",this.type=n.type||"",this.realData=this.prepareData(n.data),this.data=this.prepareFirstData(this.realData),this.colors=this.validateColors(n.colors,this.type),this.config={showTooltip:1,showLegend:1,isNavigable:n.isNavigable||0,animate:void 0!==n.animate?n.animate:1,truncateLegends:n.truncateLegends||1},this.measures=JSON.parse(JSON.stringify(Yt));var s=this.measures;this.setMeasures(n),this.title.length||(s.titleHeight=0),this.config.showLegend||(s.legendHeight=0),this.argHeight=n.height||s.baseHeight,this.state={},this.options={},this.initTimeout=Vt,this.config.isNavigable&&(this.overlays=[]),this.configure(n)}return Ft(e,[{key:"prepareData",value:function(t){return t}},{key:"prepareFirstData",value:function(t){return t}},{key:"validateColors",value:function(t,e){var n=[];return(t=(t||[]).concat(Kt[e])).forEach((function(t){var e=ee(t);O(e)?n.push(e):console.warn('"'+t+'" is not a valid color.')})),n}},{key:"setMeasures",value:function(){}},{key:"configure",value:function(){var t=this,e=this.argHeight;this.baseHeight=e,this.height=e-l(this.measures),this.boundDrawFn=function(){return t.draw(!0)},ResizeObserver&&(this.resizeObserver=new ResizeObserver(this.boundDrawFn),this.resizeObserver.observe(this.parent)),window.addEventListener("resize",this.boundDrawFn),window.addEventListener("orientationchange",this.boundDrawFn)}},{key:"destroy",value:function(){this.resizeObserver&&this.resizeObserver.disconnect(),window.removeEventListener("resize",this.boundDrawFn),window.removeEventListener("orientationchange",this.boundDrawFn)}},{key:"setup",value:function(){this.makeContainer(),this.updateWidth(),this.makeTooltip(),this.draw(!1,!0)}},{key:"makeContainer",value:function(){this.parent.innerHTML="";var e={inside:this.parent,className:"chart-container"};this.independentWidth&&(e.styles={width:this.independentWidth+"px"}),this.container=t.create("div",e)}},{key:"makeTooltip",value:function(){this.tip=new Zt({parent:this.container,colors:this.colors}),this.bindTooltip()}},{key:"bindTooltip",value:function(){}},{key:"draw",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e&&n(this.parent)||(this.updateWidth(),this.calc(e),this.makeChartArea(),this.setupComponents(),this.components.forEach((function(e){return e.setup(t.drawArea)})),this.render(this.components,!1),s&&(this.data=this.realData,setTimeout((function(){t.update(t.data)}),this.initTimeout)),this.renderLegend(),this.setupNavigation(s))}},{key:"calc",value:function(){}},{key:"updateWidth",value:function(){this.baseWidth=i(this.parent),this.width=this.baseWidth-c(this.measures)}},{key:"makeChartArea",value:function(){this.svg&&this.container.removeChild(this.svg);var t=this.measures;this.svg=M(this.container,"frappe-chart chart",this.baseWidth,this.baseHeight),this.svgDefs=C(this.svg),this.title.length&&(this.titleEL=W("title",t.margins.left,t.margins.top,this.title,{fontSize:t.titleFontSize,fill:"#666666",dy:t.titleFontSize}));var e=o(t);this.drawArea=S(this.type+"-chart chart-draw-area","translate("+a(t)+", "+e+")"),this.config.showLegend&&(e+=this.height+t.paddings.bottom,this.legendArea=S("chart-legend","translate("+a(t)+", "+e+")")),this.title.length&&this.svg.appendChild(this.titleEL),this.svg.appendChild(this.drawArea),this.config.showLegend&&this.svg.appendChild(this.legendArea),this.updateTipOffset(a(t),o(t))}},{key:"updateTipOffset",value:function(t,e){this.tip.offset={x:t,y:e}}},{key:"setupComponents",value:function(){this.components=new Map}},{key:"update",value:function(t){t||console.error("No data to update."),this.data=this.prepareData(t),this.calc(),this.render(this.components,this.config.animate),this.renderLegend()}},{key:"render",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.components,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.config.isNavigable&&this.overlays.map((function(t){return t.parentNode.removeChild(t)}));var s=[];e.forEach((function(t){s=s.concat(t.update(n))})),s.length>0?(ct(this.container,this.svg,s),setTimeout((function(){e.forEach((function(t){return t.make()})),t.updateNav()}),400)):(e.forEach((function(t){return t.make()})),this.updateNav())}},{key:"updateNav",value:function(){this.config.isNavigable&&(this.makeOverlay(),this.bindUnits())}},{key:"renderLegend",value:function(){}},{key:"setupNavigation",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.config.isNavigable&&e&&(this.bindOverlay(),this.keyActions={13:this.onEnterKey.bind(this),37:this.onLeftArrow.bind(this),38:this.onUpArrow.bind(this),39:this.onRightArrow.bind(this),40:this.onDownArrow.bind(this)},document.addEventListener("keydown",(function(e){s(t.container)&&(e=e||window.event,t.keyActions[e.keyCode]&&t.keyActions[e.keyCode]())})))}},{key:"makeOverlay",value:function(){}},{key:"updateOverlay",value:function(){}},{key:"bindOverlay",value:function(){}},{key:"bindUnits",value:function(){}},{key:"onLeftArrow",value:function(){}},{key:"onRightArrow",value:function(){}},{key:"onUpArrow",value:function(){}},{key:"onDownArrow",value:function(){}},{key:"onEnterKey",value:function(){}},{key:"addDataPoint",value:function(){}},{key:"removeDataPoint",value:function(){}},{key:"getDataPoint",value:function(){}},{key:"setCurrentDataPoint",value:function(){}},{key:"updateDataset",value:function(){}},{key:"export",value:function(){var t=dt(this.svg);ut(this.title||"Chart",[t])}}]),e}(),ye=function(t){function e(t,n){return zt(this,e),Rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n))}return Wt(e,t),Ft(e,[{key:"configure",value:function(t){qt(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"configure",this).call(this,t),this.config.formatTooltipY=(t.tooltipOptions||{}).formatTooltipY,this.config.maxSlices=t.maxSlices||20,this.config.maxLegendPoints=t.maxLegendPoints||20}},{key:"calc",value:function(){var t=this,e=this.state,n=this.config.maxSlices;e.sliceTotals=[];var s=this.data.labels.map((function(e,n){var s=0;return t.data.datasets.map((function(t){s+=t.values[n]})),[s,e]})).filter((function(t){return t[0]>=0})),i=s;if(s.length>n){s.sort((function(t,e){return e[0]-t[0]})),i=s.slice(0,n-1);var r=0;s.slice(n-1).map((function(t){r+=t[0]})),i.push([r,"Rest"]),this.colors[n-1]="grey"}e.labels=[],i.map((function(t){e.sliceTotals.push(g(t[0])),e.labels.push(t[1])})),e.grandTotal=e.sliceTotals.reduce((function(t,e){return t+e}),0),this.center={x:this.width/2,y:this.height/2}}},{key:"renderLegend",value:function(){var t=this,e=this.state;this.legendArea.textContent="",this.legendTotals=e.sliceTotals.slice(0,this.config.maxLegendPoints);var n=0,s=0;this.legendTotals.map((function(i,r){var o=150,a=Math.floor((t.width-c(t.measures))/o);t.legendTotals.lengtha&&(n=0,s+=20);var l=o*n+5,u=t.config.truncateLegends?b(e.labels[r],o/10):e.labels[r],d=t.config.formatTooltipY?t.config.formatTooltipY(i):i,p=q(l,s,5,t.colors[r],u+": "+d,!1);t.legendArea.appendChild(p),n++}))}}]),e}(ve),be=7,xe=1e3,we=86400,$e=["January","February","March","April","May","June","July","August","September","October","November","December"],ke=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Oe=function(){function t(e){var n=e.layerClass,s=void 0===n?"":n,i=e.layerTransform,r=void 0===i?"":i,o=e.constants,a=e.getData,l=e.makeElements,c=e.animateElements;zt(this,t),this.layerTransform=r,this.constants=o,this.makeElements=l,this.getData=a,this.animateElements=c,this.store=[],this.labels=[],this.layerClass=s,this.layerClass="function"==typeof this.layerClass?this.layerClass():this.layerClass,this.refresh()}return Ft(t,[{key:"refresh",value:function(t){this.data=t||this.getData()}},{key:"setup",value:function(t){this.layer=S(this.layerClass,this.layerTransform,t)}},{key:"make",value:function(){this.render(this.data),this.oldData=this.data}},{key:"render",value:function(t){var e=this;this.store=this.makeElements(t),this.layer.textContent="",this.store.forEach((function(t){e.layer.appendChild(t)})),this.labels.forEach((function(t){e.layer.appendChild(t)}))}},{key:"update",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.refresh();var e=[];return t&&(e=this.animateElements(this.data)||[]),e}}]),t}(),Ae={donutSlices:{layerClass:"donut-slices",makeElements:function(t){return t.sliceStrings.map((function(e,n){var s=N(e,"donut-path",t.colors[n],"none",t.strokeWidth);return s.style.transition="transform .3s;",s}))},animateElements:function(t){return this.store.map((function(e,n){return rt(e,t.sliceStrings[n])}))}},pieSlices:{layerClass:"pie-slices",makeElements:function(t){return t.sliceStrings.map((function(e,n){var s=N(e,"pie-path","none",t.colors[n]);return s.style.transition="transform .3s;",s}))},animateElements:function(t){return this.store.map((function(e,n){return rt(e,t.sliceStrings[n])}))}},percentageBars:{layerClass:"percentage-bars",makeElements:function(t){var e=this;return t.xPositions.map((function(n,s){return H(n,0,t.widths[s],e.constants.barHeight,e.constants.barDepth,t.colors[s])}))},animateElements:function(t){if(t)return[]}},yAxis:{layerClass:"y axis",makeElements:function(t){var e=this;return t.positions.map((function(n,s){return B(n,t.labels[s],e.constants.width,{mode:e.constants.mode,pos:e.constants.pos,shortenNumbers:e.constants.shortenNumbers})}))},animateElements:function(t){var e=t.positions,n=t.labels,s=this.oldData.positions,i=this.oldData.labels,r=y(s,e),o=It(r,2);s=o[0],e=o[1];var a=y(i,n),l=It(a,2);return i=l[0],n=l[1],this.render({positions:s,labels:n}),this.store.map((function(t,n){return tt(t,e[n],s[n])}))}},xAxis:{layerClass:"x axis",makeElements:function(t){var e=this;return t.positions.map((function(n,s){return Y(n,t.calcLabels[s],e.constants.height,{mode:e.constants.mode,pos:e.constants.pos})}))},animateElements:function(t){var e=t.positions,n=t.calcLabels,s=this.oldData.positions,i=this.oldData.calcLabels,r=y(s,e),o=It(r,2);s=o[0],e=o[1];var a=y(i,n),l=It(a,2);return i=l[0],n=l[1],this.render({positions:s,calcLabels:n}),this.store.map((function(t,n){return Z(t,e[n],s[n])}))}},yMarkers:{layerClass:"y-markers",makeElements:function(t){var e=this;return t.map((function(t){return V(t.position,t.label,e.constants.width,{labelPos:t.options.labelPos,mode:"span",lineType:"dashed"})}))},animateElements:function(t){var e=y(this.oldData,t),n=It(e,2);this.oldData=n[0];var s=(t=n[1]).map((function(t){return t.position})),i=t.map((function(t){return t.label})),r=t.map((function(t){return t.options})),o=this.oldData.map((function(t){return t.position}));return this.render(o.map((function(t,e){return{position:o[e],label:i[e],options:r[e]}}))),this.store.map((function(t,e){return tt(t,s[e],o[e])}))}},yRegions:{layerClass:"y-regions",makeElements:function(t){var e=this;return t.map((function(t){return U(t.startPos,t.endPos,e.constants.width,t.label,{labelPos:t.options.labelPos})}))},animateElements:function(t){var e=y(this.oldData,t),n=It(e,2);this.oldData=n[0];var s=(t=n[1]).map((function(t){return t.endPos})),i=t.map((function(t){return t.label})),r=t.map((function(t){return t.startPos})),o=t.map((function(t){return t.options})),a=this.oldData.map((function(t){return t.endPos})),l=this.oldData.map((function(t){return t.startPos}));this.render(a.map((function(t,e){return{startPos:l[e],endPos:a[e],label:i[e],options:o[e]}})));var c=[];return this.store.map((function(t,e){c=c.concat(et(t,r[e],s[e],a[e]))})),c}},heatDomain:{layerClass:function(){return"heat-domain domain-"+this.constants.index},makeElements:function(t){var e=this,n=this.constants,s=n.index,i=n.colWidth,r=n.rowHeight,o=n.squareSize,a=n.radius,l=n.xTranslate,c=0;return this.serializedSubDomains=[],t.cols.map((function(t,n){1===n&&e.labels.push(W("domain-name",l,-12,yt(s,!0).toUpperCase(),{fontSize:9})),t.map((function(t,n){if(t.fill){var s={"data-date":t.yyyyMmDd,"data-value":t.dataValue,"data-day":n},i=z("day",l,c,o,a,t.fill,s);e.serializedSubDomains.push(i)}c+=r})),c=0,l+=i})),this.serializedSubDomains},animateElements:function(t){if(t)return[]}},barGraph:{layerClass:function(){return"dataset-units dataset-bars dataset-"+this.constants.index},makeElements:function(t){var e=this.constants;return this.unitType="bar",this.units=t.yPositions.map((function(n,s){return G(t.xPositions[s],n,t.barWidth,e.color,t.labels[s],s,t.offsets[s],{zeroLine:t.zeroLine,barsWidth:t.barsWidth,minHeight:e.minHeight})})),this.units},animateElements:function(t){var e=t.xPositions,n=t.yPositions,s=t.offsets,i=t.labels,r=this.oldData.xPositions,o=this.oldData.yPositions,a=this.oldData.offsets,l=this.oldData.labels,c=y(r,e),u=It(c,2);r=u[0],e=u[1];var d=y(o,n),p=It(d,2);o=p[0],n=p[1];var h=y(a,s),f=It(h,2);a=f[0],s=f[1];var g=y(l,i),m=It(g,2);l=m[0],i=m[1],this.render({xPositions:r,yPositions:o,offsets:a,labels:i,zeroLine:this.oldData.zeroLine,barsWidth:this.oldData.barsWidth,barWidth:this.oldData.barWidth});var v=[];return this.store.map((function(i,r){v=v.concat(nt(i,e[r],n[r],t.barWidth,s[r],{zeroLine:t.zeroLine}))})),v}},lineGraph:{layerClass:function(){return"dataset-units dataset-line dataset-"+this.constants.index},makeElements:function(t){var e=this.constants;return this.unitType="dot",this.paths={},e.hideLine||(this.paths=K(t.xPositions,t.yPositions,e.color,{heatline:e.heatline,regionFill:e.regionFill,spline:e.spline},{svgDefs:e.svgDefs,zeroLine:t.zeroLine})),this.units=[],e.hideDots||(this.units=t.yPositions.map((function(n,s){return X(t.xPositions[s],n,t.radius,e.color,e.valuesOverPoints?t.values[s]:"",s)}))),Object.values(this.paths).concat(this.units)},animateElements:function(t){var e=t.xPositions,n=t.yPositions,s=t.values,i=this.oldData.xPositions,r=this.oldData.yPositions,o=this.oldData.values,a=y(i,e),l=It(a,2);i=l[0],e=l[1];var c=y(r,n),u=It(c,2);r=u[0],n=u[1];var d=y(o,s),p=It(d,2);o=p[0],s=p[1],this.render({xPositions:i,yPositions:r,values:s,zeroLine:this.oldData.zeroLine,radius:this.oldData.radius});var h=[];return Object.keys(this.paths).length&&(h=h.concat(it(this.paths,e,n,t.zeroLine,this.constants.spline))),this.units.length&&this.units.map((function(t,s){h=h.concat(st(t,e[s],n[s]))})),h}}},Le=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="percentage",s.setup(),s}return Wt(n,t),Ft(n,[{key:"setMeasures",value:function(t){var e=this.measures;this.barOptions=t.barOptions||{};var n=this.barOptions;n.height=n.height||20,n.depth=n.depth||Ut,e.paddings.right=30,e.legendHeight=60,e.baseHeight=8*(n.height+.5*n.depth)}},{key:"setupComponents",value:function(){var t=this.state,e=[["percentageBars",{barHeight:this.barOptions.height,barDepth:this.barOptions.depth},function(){return{xPositions:t.xPositions,widths:t.widths,colors:this.colors}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;e.xPositions=[],e.widths=[];var s=0;e.sliceTotals.map((function(n){var i=t.width*n/e.grandTotal;e.widths.push(i),e.xPositions.push(s),s+=i}))}},{key:"makeDataByIndex",value:function(){}},{key:"bindTooltip",value:function(){var t=this,n=this.state;this.container.addEventListener("mousemove",(function(s){var i=t.components.get("percentageBars").store,r=s.target;if(i.includes(r)){var o=i.indexOf(r),a=e(t.container),l=e(r),c=l.left-a.left+parseInt(r.getAttribute("width"))/2,u=l.top-a.top,d=(t.formattedLabels&&t.formattedLabels.length>0?t.formattedLabels[o]:t.state.labels[o])+": ",p=n.sliceTotals[o]/n.grandTotal;t.tip.setValues(c,u,{name:d,value:(100*p).toFixed(1)+"%"}),t.tip.showTip()}}))}}]),n}(ye),Te=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="pie",s.initTimeout=0,s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),this.mouseMove=this.mouseMove.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.hoverRadio=t.hoverRadio||.1,this.config.startAngle=t.startAngle||0,this.clockWise=t.clockWise||!1}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;this.radius=this.height>this.width?this.center.x:this.center.y;var s=this.radius,i=this.clockWise,r=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var o=180-this.config.startAngle;e.sliceTotals.map((function(n,a){var l=o,c=n/e.grandTotal*360,u=c>180?1:0,d=i?-c:c,p=o+=d,f=h(l,s),g=h(p,s),m=t.init&&r[a],v=void 0,y=void 0;t.init?(v=m?m.startPosition:f,y=m?m.endPosition:f):(v=f,y=g);var b=360===c?D(v,y,t.center,t.radius,i,u):_(v,y,t.center,t.radius,i,u);e.sliceStrings.push(b),e.slicesProperties.push({startPosition:f,endPosition:g,value:n,total:e.grandTotal,startAngle:l,endAngle:p,angle:d})})),this.init=0}},{key:"setupComponents",value:function(){var t=this.state,e=[["pieSlices",{},function(){return{sliceStrings:t.sliceStrings,colors:this.colors}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,s=h(t.startAngle+t.angle/2,e);return"translate3d("+s.x*n+"px,"+s.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,s,i){if(t){var r=this.colors[n];if(s){at(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.fill=k(r,50);var o=e(this.svg),a=i.pageX-o.left+10,l=i.pageY-o.top-10,c=(this.formatted_labels&&this.formatted_labels.length>0?this.formatted_labels[n]:this.state.labels[n])+": ",u=(100*this.state.sliceTotals[n]/this.state.grandTotal).toFixed(1);this.tip.setValues(a,l,{name:c,value:u+"%"}),this.tip.showTip()}else at(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.fill=r}}},{key:"bindTooltip",value:function(){this.container.addEventListener("mousemove",this.mouseMove),this.container.addEventListener("mouseleave",this.mouseLeave)}},{key:"mouseMove",value:function(t){var e=t.target,n=this.components.get("pieSlices").store,s=this.curActiveSliceIndex,i=this.curActiveSlice;if(n.includes(e)){var r=n.indexOf(e);this.hoverSlice(i,s,!1),this.curActiveSlice=e,this.curActiveSliceIndex=r,this.hoverSlice(e,r,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Pe=function(t){function e(t,n){zt(this,e);var s=Rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));s.type="heatmap",s.countLabel=n.countLabel||"";var i=["Sunday","Monday"],r=i.includes(n.startSubDomain)?n.startSubDomain:"Sunday";return s.startSubDomainIndex=i.indexOf(r),s.setup(),s}return Wt(e,t),Ft(e,[{key:"setMeasures",value:function(t){var e=this.measures;this.discreteDomains=0===t.discreteDomains?0:1,e.paddings.top=36,e.paddings.bottom=0,e.legendHeight=24,e.baseHeight=12*be+l(e);var n=this.data,s=this.discreteDomains?12:0;this.independentWidth=12*(gt(n.start,n.end)+s)+c(e)}},{key:"updateWidth",value:function(){var t=this.discreteDomains?12:0,e=this.state.noOfWeeks?this.state.noOfWeeks:52;this.baseWidth=12*(e+t)+c(this.measures)}},{key:"prepareData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data;if(t.start&&t.end&&t.start>t.end)throw new Error("Start date cannot be greater than end date.");if(t.start||(t.start=new Date,t.start.setFullYear(t.start.getFullYear()-1)),t.end||(t.end=new Date),t.dataPoints=t.dataPoints||{},parseInt(Object.keys(t.dataPoints)[0])>1e5){var e={};Object.keys(t.dataPoints).forEach((function(n){var s=new Date(n*xe);e[ht(s)]=t.dataPoints[n]})),t.dataPoints=e}return t}},{key:"calc",value:function(){var t=this.state;t.start=ft(this.data.start),t.end=ft(this.data.end),t.firstWeekStart=ft(t.start),t.noOfWeeks=gt(t.start,t.end),t.distribution=Nt(Object.values(this.data.dataPoints),5),t.domainConfigs=this.getDomains()}},{key:"setupComponents",value:function(){var t=this,e=this.state,n=this.discreteDomains?0:1,s=e.domainConfigs.map((function(s,i){return["heatDomain",{index:s.index,colWidth:12,rowHeight:12,squareSize:10,radius:t.rawChartArgs.radius||0,xTranslate:12*e.domainConfigs.filter((function(t,e){return e1&&void 0!==arguments[1]?arguments[1]:"",n=[t.getMonth(),t.getFullYear()],s=n[0],i=n[1],r=xt(t),o={index:s,cols:[]};wt(e=ft(e)||bt(s,i),1);for(var a=gt(r,e),l=[],c=void 0,u=0;u2&&void 0!==arguments[2]&&arguments[2],s=this.state,i=ft(t),r=[],o=0;o=s.start&&i<=s.end;n||i.getMonth()!==e||!l?a.yyyyMmDd=ht(i):a=this.getSubDomainConfig(i),r.push(a)}return r}},{key:"getSubDomainConfig",value:function(t){var e=ht(t),n=this.data.dataPoints[e];return{yyyyMmDd:e,dataValue:n||0,fill:this.colors[_t(n,this.state.distribution)]}}}]),e}(ve),Me=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.barOptions=e.barOptions||{},s.lineOptions=e.lineOptions||{},s.type=e.type||"line",s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"setMeasures",value:function(){this.data.datasets.length<=1&&(this.config.showLegend=0,this.measures.paddings.bottom=30)}},{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),t.axisOptions=t.axisOptions||{},t.tooltipOptions=t.tooltipOptions||{},this.config.xAxisMode=t.axisOptions.xAxisMode||"span",this.config.yAxisMode=t.axisOptions.yAxisMode||"span",this.config.xIsSeries=t.axisOptions.xIsSeries||0,this.config.shortenYAxisNumbers=t.axisOptions.shortenYAxisNumbers||0,this.config.formatTooltipX=t.tooltipOptions.formatTooltipX,this.config.formatTooltipY=t.tooltipOptions.formatTooltipY,this.config.valuesOverPoints=t.valuesOverPoints}},{key:"prepareData",value:function(){return Dt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data,this.type)}},{key:"prepareFirstData",value:function(){return Et(arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.data)}},{key:"calc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.calcXPositions(),t||this.calcYAxisParameters(this.getAllYValues(),"line"===this.type),this.makeDataByIndex()}},{key:"calcXPositions",value:function(){var t=this.state,e=this.data.labels;t.datasetLength=e.length,t.unitWidth=this.width/t.datasetLength,t.xOffset=t.unitWidth/2,t.xAxis={labels:e,positions:e.map((function(e,n){return u(t.xOffset+n*t.unitWidth)}))}}},{key:"calcYAxisParameters",value:function(t){var e=Lt(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"false"),n=this.height/Mt(e),s=Pt(e)*n,i=this.height-Tt(e)*s;this.state.yAxis={labels:e,positions:e.map((function(t){return i-t*n})),scaleMultiplier:n,zeroLine:i},this.calcDatasetPoints(),this.calcYExtremes(),this.calcYRegions()}},{key:"calcDatasetPoints",value:function(){var t=this.state,e=function(e){return e.map((function(e){return Ct(e,t.yAxis)}))};t.datasets=this.data.datasets.map((function(t,n){var s=t.values,i=t.cumulativeYs||[];return{name:t.name&&t.name.replace(/<|>|&/g,(function(t){return"&"==t?"&":"<"==t?"<":">"})),index:n,chartType:t.chartType,values:s,yPositions:e(s),cumulativeYs:i,cumulativeYPos:e(i)}}))}},{key:"calcYExtremes",value:function(){var t=this.state;this.barOptions.stacked?t.yExtremes=t.datasets[t.datasets.length-1].cumulativeYPos:(t.yExtremes=new Array(t.datasetLength).fill(9999),t.datasets.map((function(e){e.yPositions.map((function(e,n){eo(s)?t.mapTooltipXPosition(r):t.tip.hideTip()}))}},{key:"mapTooltipXPosition",value:function(t){var e=this.state;if(e.yExtremes){var n=St(t,e.xAxis.positions,!0);if(n>=0){var s=this.dataByIndex[n];this.tip.setValues(s.xPos+this.tip.offset.x,s.yExtreme+this.tip.offset.y,{name:s.formattedLabel,value:""},s.values,n),this.tip.showTip()}}}},{key:"renderLegend",value:function(){var t=this,e=this.data;e.datasets.length>1&&(this.legendArea.textContent="",e.datasets.map((function(e,n){var s=F(100*n,"0",100,t.colors[n],e.name,t.config.truncateLegends);t.legendArea.appendChild(s)})))}},{key:"makeOverlay",value:function(){var t=this;this.init?this.init=0:(this.overlayGuides&&this.overlayGuides.forEach((function(t){var e=t.overlay;e.parentNode.removeChild(e)})),this.overlayGuides=this.dataUnitComponents.map((function(t){return{type:t.unitType,overlay:void 0,units:t.units}})),void 0===this.state.currentIndex&&(this.state.currentIndex=this.state.datasetLength-1),this.overlayGuides.map((function(e){var n=e.units[t.state.currentIndex];e.overlay=le[e.type](n),t.drawArea.appendChild(e.overlay)})))}},{key:"updateOverlayGuides",value:function(){this.overlayGuides&&this.overlayGuides.forEach((function(t){var e=t.overlay;e.parentNode.removeChild(e)}))}},{key:"bindOverlay",value:function(){var t=this;this.parent.addEventListener("data-select",(function(){t.updateOverlay()}))}},{key:"bindUnits",value:function(){var t=this;this.dataUnitComponents.map((function(e){e.units.map((function(e){e.addEventListener("click",(function(){var n=e.getAttribute("data-point-index");t.setCurrentDataPoint(n)}))}))})),this.tip.container.addEventListener("click",(function(){var e=t.tip.container.getAttribute("data-point-index");t.setCurrentDataPoint(e)}))}},{key:"updateOverlay",value:function(){var t=this;this.overlayGuides.map((function(e){var n=e.units[t.state.currentIndex];ce[e.type](n,e.overlay)}))}},{key:"onLeftArrow",value:function(){this.setCurrentDataPoint(this.state.currentIndex-1)}},{key:"onRightArrow",value:function(){this.setCurrentDataPoint(this.state.currentIndex+1)}},{key:"getDataPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.currentIndex,e=this.state;return{index:t,label:e.xAxis.labels[t],values:e.datasets.map((function(e){return e.values[t]}))}}},{key:"setCurrentDataPoint",value:function(t){var e=this.state;(t=parseInt(t))<0&&(t=0),t>=e.xAxis.labels.length&&(t=e.xAxis.labels.length-1),t!==e.currentIndex&&(e.currentIndex=t,r(this.parent,"data-select",this.getDataPoint()))}},{key:"addDataPoint",value:function(t,e){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.state.datasetLength;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"addDataPoint",this).call(this,t,e,s),this.data.labels.splice(s,0,t),this.data.datasets.map((function(t,n){t.values.splice(s,0,e[n])})),this.update(this.data)}},{key:"removeDataPoint",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.state.datasetLength-1;this.data.labels.length<=1||(qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"removeDataPoint",this).call(this,t),this.data.labels.splice(t,1),this.data.datasets.map((function(e){e.values.splice(t,1)})),this.update(this.data))}},{key:"updateDataset",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.data.datasets[e].values=t,this.update(this.data)}},{key:"updateDatasets",value:function(t){this.data.datasets.map((function(e,n){t[n]&&(e.values=t[n])})),this.update(this.data)}}]),n}(ve),Ce=function(t){function n(t,e){zt(this,n);var s=Rt(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return s.type="donut",s.initTimeout=0,s.init=1,s.setup(),s}return Wt(n,t),Ft(n,[{key:"configure",value:function(t){qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"configure",this).call(this,t),this.mouseMove=this.mouseMove.bind(this),this.mouseLeave=this.mouseLeave.bind(this),this.hoverRadio=t.hoverRadio||.1,this.config.startAngle=t.startAngle||0,this.clockWise=t.clockWise||!1,this.strokeWidth=t.strokeWidth||30}},{key:"calc",value:function(){var t=this;qt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;this.radius=this.height>this.width?this.center.x-this.strokeWidth/2:this.center.y-this.strokeWidth/2;var s=this.radius,i=this.clockWise,r=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var o=180-this.config.startAngle;e.sliceTotals.map((function(n,a){var l=o,c=n/e.grandTotal*360,u=c>180?1:0,d=i?-c:c,p=o+=d,f=h(l,s),g=h(p,s),m=t.init&&r[a],v=void 0,y=void 0;t.init?(v=m?m.startPosition:f,y=m?m.endPosition:f):(v=f,y=g);var b=360===c?j(v,y,t.center,t.radius,t.clockWise,u):E(v,y,t.center,t.radius,t.clockWise,u);e.sliceStrings.push(b),e.slicesProperties.push({startPosition:f,endPosition:g,value:n,total:e.grandTotal,startAngle:l,endAngle:p,angle:d})})),this.init=0}},{key:"setupComponents",value:function(){var t=this.state,e=[["donutSlices",{},function(){return{sliceStrings:t.sliceStrings,colors:this.colors,strokeWidth:this.strokeWidth}}.bind(this)]];this.components=new Map(e.map((function(t){var e=$t.apply(void 0,Bt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,s=h(t.startAngle+t.angle/2,e);return"translate3d("+s.x*n+"px,"+s.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,s,i){if(t){var r=this.colors[n];if(s){at(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.stroke=k(r,50);var o=e(this.svg),a=i.pageX-o.left+10,l=i.pageY-o.top-10,c=(this.formatted_labels&&this.formatted_labels.length>0?this.formatted_labels[n]:this.state.labels[n])+": ",u=(100*this.state.sliceTotals[n]/this.state.grandTotal).toFixed(1);this.tip.setValues(a,l,{name:c,value:u+"%"}),this.tip.showTip()}else at(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.stroke=r}}},{key:"bindTooltip",value:function(){this.container.addEventListener("mousemove",this.mouseMove),this.container.addEventListener("mouseleave",this.mouseLeave)}},{key:"mouseMove",value:function(t){var e=t.target,n=this.components.get("donutSlices").store,s=this.curActiveSliceIndex,i=this.curActiveSlice;if(n.includes(e)){var r=n.indexOf(e);this.hoverSlice(i,s,!1),this.curActiveSlice=e,this.curActiveSliceIndex=r,this.hoverSlice(e,r,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Se={bar:Me,line:Me,percentage:Le,heatmap:Pe,pie:Te,donut:Ce},Ne=function t(e,n){return zt(this,t),Jt(n.type,e,n)},_e=Object.freeze({Chart:Ne,PercentageChart:Le,PieChart:Te,Heatmap:Pe,AxisChart:Me}),De={NAME:"Frappe Charts",VERSION:"1.6.2"};return Object.assign({},De,_e)}()},ee(ne={exports:{}},ne.exports),ne.exports);function ie(e){let n,s,i;return{c(){n=m("div")},m(t,r){h(t,n,r),e[18](n),s||(i=w(n,"data-select",e[17]),s=!0)},p:t,i:t,o:t,d(t){t&&f(n),e[18](null),s=!1,i()}}}function re(t,e,n){let s,{data:i={labels:[],datasets:[{values:[]}],yMarkers:{},yRegions:[]}}=e,{title:r=""}=e,{type:o="line"}=e,{height:a=300}=e,{animate:l=!0}=e,{axisOptions:c={}}=e,{barOptions:u={}}=e,{lineOptions:d={}}=e,{tooltipOptions:p={}}=e,{colors:h=[]}=e,{valuesOverPoints:f=0}=e,{isNavigable:g=!1}=e,{maxSlices:m=3}=e,v=null;function y(t){return function(...e){if(v)return t(...e)}}const b=y(((t,e,n)=>v.addDataPoint(t,e,n))),x=y((t=>v.removeDataPoint(t))),w=y((()=>v.export())),$=y((t=>v.update(t)));return S((()=>{v=new se.Chart(s,{data:i,title:r,type:o,height:a,animate:l,colors:h,axisOptions:c,barOptions:u,lineOptions:d,tooltipOptions:p,valuesOverPoints:f,isNavigable:g,maxSlices:m})})),function(t){C().$$.on_destroy.push(t)}((()=>{v=null})),t.$$set=t=>{"data"in t&&n(1,i=t.data),"title"in t&&n(2,r=t.title),"type"in t&&n(3,o=t.type),"height"in t&&n(4,a=t.height),"animate"in t&&n(5,l=t.animate),"axisOptions"in t&&n(6,c=t.axisOptions),"barOptions"in t&&n(7,u=t.barOptions),"lineOptions"in t&&n(8,d=t.lineOptions),"tooltipOptions"in t&&n(9,p=t.tooltipOptions),"colors"in t&&n(10,h=t.colors),"valuesOverPoints"in t&&n(11,f=t.valuesOverPoints),"isNavigable"in t&&n(12,g=t.isNavigable),"maxSlices"in t&&n(13,m=t.maxSlices)},t.$$.update=()=>{2&t.$$.dirty&&$(i)},[s,i,r,o,a,l,c,u,d,p,h,f,g,m,b,x,w,function(e){_.call(this,t,e)},function(t){E[t?"unshift":"push"]((()=>{s=t,n(0,s)}))}]}var oe=class extends rt{constructor(t){super(),it(this,t,re,ie,r,{data:1,title:2,type:3,height:4,animate:5,axisOptions:6,barOptions:7,lineOptions:8,tooltipOptions:9,colors:10,valuesOverPoints:11,isNavigable:12,maxSlices:13,addDataPoint:14,removeDataPoint:15,exportChart:16})}get addDataPoint(){return this.$$.ctx[14]}get removeDataPoint(){return this.$$.ctx[15]}get exportChart(){return this.$$.ctx[16]}};function ae(t){let e,n,s,i,r,o,a=(t[0].descr?t[0].descr:"")+"";return r=new oe({props:{data:t[1],type:"line",lineOptions:t[2],axisOptions:t[3]}}),{c(){e=m("div"),n=m("label"),s=y(a),i=b(),et(r.$$.fragment),$(n,"class","inline-block italic align-top text-center text-gray-500 txt-sz"),$(e,"class","text-center")},m(t,a){h(t,e,a),p(e,n),p(n,s),h(t,i,a),nt(r,t,a),o=!0},p(t,[e]){(!o||1&e)&&a!==(a=(t[0].descr?t[0].descr:"")+"")&&O(s,a);const n={};2&e&&(n.data=t[1]),4&e&&(n.lineOptions=t[2]),r.$set(n)},i(t){o||(Q(r.$$.fragment,t),o=!0)},o(t){Z(r.$$.fragment,t),o=!1},d(t){t&&f(e),t&&f(i),st(r,t)}}}function le(t,e,n){S((async()=>{console.log("[i]","chart component mounted")}));let s,{widget:i}=e,r=[0,0],o=[0,0],a={labels:r,datasets:[{name:i.descr,values:o}]},l=[],c=[];function u(){if(i.status&&Array.isArray(i.status)){if(c!==i.status){console.log("[i]","collecting chart data to array, topic:",i.topic);let s=i.status;l=[...l,...s];for(let n=0;n{"widget"in t&&n(0,i=t.widget)},t.$$.update=()=>{1&t.$$.dirty&&(i.status,u())},[i,a,s,{xAxisMode:"tick",xIsSeries:!0}]}class ce extends rt{constructor(t){super(),it(this,t,le,ae,r,{widget:0})}}function ue(e){let n,i,r,o,a,l,c,u,d,g,v,x,k,A,L,T,P,M,C,S=(e[0].descr?e[0].descr:"")+"";return{c(){n=m("div"),i=m("div"),r=m("label"),o=y(S),a=b(),l=m("div"),c=m("label"),u=m("div"),d=m("input"),v=b(),x=m("div"),A=b(),L=m("div"),$(r,"class","wgt-dscr-stl"),$(i,"class","w-2/3"),$(d,"id",g=e[0].topic),$(d,"type","checkbox"),$(d,"class","sr-only"),$(x,"class",k="block "+(e[1]?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg"),$(L,"class",T="dot "+(e[0].sent?"bg-red-300":"bg-gray-100")+" absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg"),$(u,"class","relative"),$(c,"for",P=e[0].topic),$(c,"class","items-center cursor-pointer"),$(l,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,s){h(t,n,s),p(n,i),p(i,r),p(r,o),p(n,a),p(n,l),p(l,c),p(c,u),p(u,d),d.checked=e[1],p(u,v),p(u,x),p(u,A),p(u,L),M||(C=[w(d,"change",e[4]),w(d,"change",e[5])],M=!0)},p(t,[e]){1&e&&S!==(S=(t[0].descr?t[0].descr:"")+"")&&O(o,S),1&e&&g!==(g=t[0].topic)&&$(d,"id",g),2&e&&(d.checked=t[1]),2&e&&k!==(k="block "+(t[1]?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg")&&$(x,"class",k),1&e&&T!==(T="dot "+(t[0].sent?"bg-red-300":"bg-gray-100")+" absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg")&&$(L,"class",T),1&e&&P!==(P=t[0].topic)&&$(c,"for",P)},i:t,o:t,d(t){t&&f(n),M=!1,s(C)}}}function de(t,e,n){let{widget:s}=e,{toggleState:i=!1}=e,{wsPush:r=((t,e,n)=>{})}=e;function o(){n(0,s.sent=!0,s),n(0,s.status=i?"1":"0",s)}return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"toggleState"in t&&n(1,i=t.toggleState),"wsPush"in t&&n(2,r=t.wsPush)},t.$$.update=()=>{1&t.$$.dirty&&(s.status,"1"==s.status?n(1,i=!0):"0"==s.status&&n(1,i=!1))},[s,i,r,o,function(){i=this.checked,n(1,i)},()=>(o(),r(s.ws,s.topic,s.status))]}class pe extends rt{constructor(t){super(),it(this,t,de,ue,r,{widget:0,toggleState:1,wsPush:2})}}function he(e){let n,s,i,r,o,a,l,c,u,d,g,v,x=(e[0].descr?e[0].descr:"")+"",w=(e[0].status?e[0].status:"")+"",k=(e[0].after?e[0].after:"")+"";return{c(){n=m("div"),s=m("div"),i=m("label"),r=y(x),o=b(),a=m("div"),l=m("label"),c=y(w),u=b(),d=m("label"),g=y(" "),v=y(k),$(i,"class","wgt-dscr-stl"),$(s,"class","w-2/3"),$(l,"class","wgt-adt-stl"),$(d,"class","wgt-adt-stl"),$(a,"class","flex justify-end w-1/3"),$(n,"class","crd-itm-psn")},m(t,e){h(t,n,e),p(n,s),p(s,i),p(i,r),p(n,o),p(n,a),p(a,l),p(l,c),p(a,u),p(a,d),p(d,g),p(d,v)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&O(r,x),1&e&&w!==(w=(t[0].status?t[0].status:"")+"")&&O(c,w),1&e&&k!==(k=(t[0].after?t[0].after:"")+"")&&O(v,k)},i:t,o:t,d(t){t&&f(n)}}}function fe(t,e,n){let{widget:s}=e,{value:i}=e;return t.$$set=t=>{"widget"in t&&n(0,s=t.widget),"value"in t&&n(1,i=t.value)},[s,i]}class ge extends rt{constructor(t){super(),it(this,t,fe,he,r,{widget:0,value:1})}}function me(t,e,n){const s=t.slice();return s[12]=e[n],s[14]=n,s}function ve(t,e,n){const s=t.slice();return s[15]=e[n],s[16]=e,s[17]=n,s}function ye(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function be(t){let e,n,s,i=!t[0]&&xe(),r=t[1],o=[];for(let e=0;eZ(o[t],1,1,(()=>{o[t]=null}));return{c(){e=m("div"),i&&i.c(),n=b();for(let t=0;t{i=null})),K()):i?1&s&&Q(i,1):(i=xe(),i.c(),Q(i,1),i.m(e,n)),11&s){let n;for(r=t[1],n=0;n{a=null})),K()),"toggle"===t[15].widget?l?(l.p(t,o),1&o&&Q(l,1)):(l=ke(t),l.c(),Q(l,1),l.m(n.parentNode,n)):l&&(X(),Z(l,1,1,(()=>{l=null})),K()),"anydata"===t[15].widget?c?(c.p(t,o),1&o&&Q(c,1)):(c=Oe(t),c.c(),Q(c,1),c.m(s.parentNode,s)):c&&(X(),Z(c,1,1,(()=>{c=null})),K()),"range"===t[15].widget?u?(u.p(t,o),1&o&&Q(u,1)):(u=Ae(t),u.c(),Q(u,1),u.m(i.parentNode,i)):u&&(X(),Z(u,1,1,(()=>{u=null})),K()),"chart"===t[15].widget?d?(d.p(t,o),1&o&&Q(d,1)):(d=Le(t),d.c(),Q(d,1),d.m(r.parentNode,r)):d&&(X(),Z(d,1,1,(()=>{d=null})),K())},i(t){o||(Q(a),Q(l),Q(c),Q(u),Q(d),o=!0)},o(t){Z(a),Z(l),Z(c),Z(u),Z(d),o=!1},d(t){a&&a.d(t),t&&f(e),l&&l.d(t),t&&f(n),c&&c.d(t),t&&f(s),u&&u.d(t),t&&f(i),d&&d.d(t),t&&f(r)}}}function $e(t){let e,n,s;function i(e){t[5](e,t[15])}let r={widget:t[15],wsPush:t[4]};return void 0!==t[15].status&&(r.value=t[15].status),e=new Kt({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[4]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function ke(t){let e,n,s;function i(e){t[7](e,t[15])}let r={widget:t[15],wsPush:t[6]};return void 0!==t[15].status&&(r.value=t[15].status),e=new pe({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[6]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Oe(t){let e,n,s;function i(e){t[8](e,t[15])}let r={widget:t[15]};return void 0!==t[15].status&&(r.value=t[15].status),e=new ge({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Ae(t){let e,n,s;function i(e){t[10](e,t[15])}let r={widget:t[15],wsPush:t[9]};return void 0!==t[15].status&&(r.value=t[15].status),e=new te({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),8&i&&(r.wsPush=t[9]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Le(t){let e,n,s;function i(e){t[11](e,t[15])}let r={widget:t[15]};return void 0!==t[15].status&&(r.value=t[15].status),e=new ce({props:r}),E.push((()=>tt(e,"value",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(s,i){t=s;const r={};1&i&&(r.widget=t[15]),!n&&1&i&&(n=!0,r.value=t[15].status,R((()=>n=!1))),e.$set(r)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function Te(t){let e,n,s=t[15].page===t[12].page&&we(t);return{c(){s&&s.c(),e=x()},m(t,i){s&&s.m(t,i),h(t,e,i),n=!0},p(t,n){t[15].page===t[12].page?s?(s.p(t,n),3&n&&Q(s,1)):(s=we(t),s.c(),Q(s,1),s.m(e.parentNode,e)):s&&(X(),Z(s,1,1,(()=>{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Pe(t){let e,n,s=t[0],i=[];for(let e=0;eZ(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Se(t,e,n){let{layoutJson:s}=e,{pages:i}=e,{show:r}=e,{wsPush:o=((t,e,n)=>{})}=e;return t.$$set=t=>{"layoutJson"in t&&n(0,s=t.layoutJson),"pages"in t&&n(1,i=t.pages),"show"in t&&n(2,r=t.show),"wsPush"in t&&n(3,o=t.wsPush)},[s,i,r,o,(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},(t,e,n)=>o(t,e,n),function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))},function(e,i){t.$$.not_equal(i.status,e)&&(i.status=e,n(0,s))}]}class Ne extends rt{constructor(t){super(),it(this,t,Se,Ce,r,{layoutJson:0,pages:1,show:2,wsPush:3})}}function _e(e){let n,s,r,o,a,l,c;return{c(){n=v("svg"),s=v("path"),r=v("circle"),o=v("circle"),a=v("circle"),$(s,"stroke","none"),$(s,"d","M0 0h24v24H0z"),$(r,"cx","5"),$(r,"cy","12"),$(r,"r","1"),$(o,"cx","12"),$(o,"cy","12"),$(o,"r","1"),$(a,"cx","19"),$(a,"cy","12"),$(a,"r","1"),$(n,"class","h-6 w-6 text-green-400 cursor-pointer"),$(n,"width","24"),$(n,"height","24"),$(n,"viewBox","0 -2 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,u){h(t,n,u),p(n,s),p(n,r),p(n,o),p(n,a),l||(c=w(n,"click",(function(){i(e[0]())&&e[0]().apply(this,arguments)})),l=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&f(n),l=!1,c()}}}function De(t,e,n){let{click:s=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,s=t.click)},[s]}class Ee extends rt{constructor(t){super(),it(this,t,De,_e,r,{click:0})}}function je(t,e,n){const s=t.slice();return s[26]=e[n],s[27]=e,s[28]=n,s}function Je(t,e,n){const s=t.slice();return s[29]=e[n][0],s[30]=e[n][1],s[31]=e,s[32]=n,s}function He(t,e,n){const s=t.slice();return s[33]=e[n],s}function ze(t,e,n){const s=t.slice();return s[36]=e[n],s}function Fe(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function qe(t){let e,n,s,i,r,o,a,l;return n=new qt({props:{title:"Конфигуратор",$$slots:{default:[Xe]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Сценарии",$$slots:{default:[Ke]},$$scope:{ctx:t}}}),a=new qt({props:{$$slots:{default:[Qe]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),o=m("div"),et(a.$$.fragment),$(e,"class","grd-2col1"),$(o,"class","grd-1col1")},m(t,c){h(t,e,c),nt(n,e,null),p(e,s),nt(i,e,null),h(t,r,c),h(t,o,c),nt(a,o,null),l=!0},p(t,e){const s={};782&e[0]|256&e[1]&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};1025&e[0]|256&e[1]&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const o={};224&e[0]|256&e[1]&&(o.$$scope={dirty:e,ctx:t}),a.$set(o)},i(t){l||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(a.$$.fragment,t),l=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(n),st(i),t&&f(r),t&&f(o),st(a)}}}function We(t){let e,n;return{c(){e=m("optgroup"),$(e,"label",n=t[36].header)},m(t,n){h(t,e,n)},p(t,s){8&s[0]&&n!==(n=t[36].header)&&$(e,"label",n)},d(t){t&&f(e)}}}function Re(t){let e,n,s,i,r=t[36].name+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[36].num,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){8&s[0]&&r!==(r=t[36].name+"")&&O(n,r),8&s[0]&&i!==(i=t[36].num)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Ie(t){let e,n,s=t[36].header&&We(t),i=!t[36].header&&Re(t);return{c(){s&&s.c(),e=x(),i&&i.c(),n=x()},m(t,r){s&&s.m(t,r),h(t,e,r),i&&i.m(t,r),h(t,n,r)},p(t,r){t[36].header?s?s.p(t,r):(s=We(t),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),t[36].header?i&&(i.d(1),i=null):i?i.p(t,r):(i=Re(t),i.c(),i.m(n.parentNode,n))},d(t){s&&s.d(t),t&&f(e),i&&i.d(t),t&&f(n)}}}function Be(t){let e,n,s,i,r=t[33].label+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[33].name,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){4&s[0]&&r!==(r=t[33].label+"")&&O(n,r),4&s[0]&&i!==(i=t[33].name)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Ye(t){let e,n=Object.entries(t[26]),s=[];for(let e=0;eZ(T[t],1,1,(()=>{T[t]=null}));return{c(){e=m("div"),n=m("select");for(let t=0;t| Тип | \n Id | \n Виджет | \n Вкладка | \n Название | \n | \n | ',u=b(),d=m("tbody");for(let t=0;tt[13].call(n))),o.__value="Выберите пресет",o.value=o.__value,$(r,"class","slct-lg"),$(e,"class","grd-2col2"),$(c,"class","bg-gray-100"),$(d,"class","bg-white"),$(l,"class","tbl")},m(s,f){h(s,e,f),p(e,n);for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function tn(t,e,n){let s,{configJson:i}=e,{widgetsJson:r}=e,{itemsJson:o}=e,{show:a}=e,{scenarioJson:l}=e,c=0,{saveConfig:u=(()=>{})}=e,{rebootEsp:d=(()=>{})}=e,{cleanLogs:p=(()=>{})}=e,h=!0;function f(){for(let t=0;t{"configJson"in t&&n(1,i=t.configJson),"widgetsJson"in t&&n(2,r=t.widgetsJson),"itemsJson"in t&&n(3,o=t.itemsJson),"show"in t&&n(4,a=t.show),"scenarioJson"in t&&n(0,l=t.scenarioJson),"saveConfig"in t&&n(5,u=t.saveConfig),"rebootEsp"in t&&n(6,d=t.rebootEsp),"cleanLogs"in t&&n(7,p=t.cleanLogs)},t.$$.update=()=>{1&t.$$.dirty[0]&&function(){let t=JSON.stringify(l);n(10,s=t.split("\\n").length)}()},[l,i,r,o,a,u,d,p,c,h,s,f,g,function(){c=T(this),n(8,c),n(3,o)},()=>f(),function(t,e){t[e].id=this.value,n(1,i),n(2,r)},function(t,e){t[e].widget=T(this),n(1,i),n(2,r)},function(t,e){t[e].page=this.value,n(1,i),n(2,r)},function(t,e){t[e].descr=this.value,n(1,i),n(2,r)},()=>n(9,h=!h),t=>g(t),function(t,e,s){e[s][t]=this.value,n(1,i),n(2,r)},function(){l.scen=this.value,n(0,l)},()=>(p(),u()),()=>d()]}class en extends rt{constructor(t){super(),it(this,t,tn,Ze,r,{configJson:1,widgetsJson:2,itemsJson:3,show:4,scenarioJson:0,saveConfig:5,rebootEsp:6,cleanLogs:7},null,[-1,-1])}}function nn(t,e,n){const s=t.slice();return s[23]=e[n][0],s[24]=e[n][1],s}function sn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function rn(t){let e,n,s,i,r,o,a,l;return n=new qt({props:{title:"Подключение к WiFi",$$slots:{default:[ln]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Подключение к MQTT",$$slots:{default:[hn]},$$scope:{ctx:t}}}),a=new qt({props:{$$slots:{default:[fn]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),o=m("div"),et(a.$$.fragment),$(e,"class","grd-2col1"),$(o,"class","grd-1col1")},m(t,c){h(t,e,c),nt(n,e,null),p(e,s),nt(i,e,null),h(t,r,c),h(t,o,c),nt(a,o,null),l=!0},p(t,e){const s={};134217783&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};134217795&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const o={};134217856&e&&(o.$$scope={dirty:e,ctx:t}),a.$set(o)},i(t){l||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(a.$$.fragment,t),l=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(a.$$.fragment,t),l=!1},d(t){t&&f(e),st(n),st(i),t&&f(r),t&&f(o),st(a)}}}function on(t){let e,n,s,i,r=t[24]+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[24],e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){4&s&&r!==(r=t[24]+"")&&O(n,r),4&s&&i!==(i=t[24])&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function an(t){let e,n,s;return n=new Dt({props:{title:"Введен неправильный пароль"}}),{c(){e=m("div"),et(n.$$.fragment),$(e,"class","grd-1col1")},m(t,i){h(t,e,i),nt(n,e,null),s=!0},i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){t&&f(e),st(n)}}}function ln(t){let e,n,i,r,o,a,l,c,u,d,v,y,x,k,O,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,tt,et,nt,st,it=Object.entries(t[2]),rt=[];for(let e=0;eНазвание устройства',i=b(),r=m("div"),o=m("input"),a=b(),l=m("div"),c=m("div"),c.innerHTML='Точка доступа
',u=b(),d=m("div"),v=m("input"),y=b(),x=m("div"),k=m("div"),k.innerHTML='Пароль точки доступа
',O=b(),T=m("div"),P=m("input"),M=b(),C=m("div"),S=m("div"),S.innerHTML='Название wifi сети
',N=b(),_=m("div"),D=m("select");for(let t=0;tПароль',H=b(),z=m("div"),F=m("input"),q=b(),R=m("div"),I=m("div"),I.innerHTML='Сервер обновления
',B=b(),Y=m("div"),V=m("input"),U=b(),ot&&ot.c(),G=b(),tt=m("button"),tt.textContent="Сохранить",$(n,"class","w-4/6"),$(o,"class","ipt-rnd text-left focus:border-indigo-500"),$(o,"type","text"),$(r,"class","flex justify-end w-3/6"),$(e,"class","crd-itm-psn"),$(c,"class","w-4/6"),$(v,"class","ipt-rnd text-left focus:border-indigo-500"),$(v,"type","text"),$(d,"class","flex justify-end w-3/6"),$(l,"class","crd-itm-psn"),$(k,"class","w-4/6"),$(P,"class","ipt-rnd text-left focus:border-indigo-500"),$(P,"type","text"),$(T,"class","flex justify-end w-3/6"),$(x,"class","crd-itm-psn"),$(S,"class","w-4/6"),$(D,"class","ipt-rnd text-left focus:border-indigo-500"),void 0===t[0].routerssid&&W((()=>t[11].call(D))),$(_,"class","flex justify-end w-3/6"),$(C,"class","crd-itm-psn"),$(J,"class","w-4/6"),$(F,"class","ipt-rnd text-left focus:border-indigo-500"),$(F,"type","text"),$(z,"class","flex justify-end w-3/6"),$(j,"class","crd-itm-psn"),$(I,"class","w-4/6"),$(V,"class","ipt-rnd text-left focus:border-indigo-500"),$(V,"type","text"),$(Y,"class","flex justify-end w-3/6"),$(R,"class","crd-itm-psn"),$(tt,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),A(o,t[0].name),h(s,a,f),h(s,l,f),p(l,c),p(l,u),p(l,d),p(d,v),A(v,t[0].apssid),h(s,y,f),h(s,x,f),p(x,k),p(x,O),p(x,T),p(T,P),A(P,t[0].appass),h(s,M,f),h(s,C,f),p(C,S),p(C,N),p(C,_),p(_,D);for(let t=0;t{ot=null})),K())},i(t){et||(Q(ot),et=!0)},o(t){Z(ot),et=!1},d(t){t&&f(e),t&&f(a),t&&f(l),t&&f(y),t&&f(x),t&&f(M),t&&f(C),g(rt,t),t&&f(E),t&&f(j),t&&f(q),t&&f(R),t&&f(U),ot&&ot.d(t),t&&f(G),t&&f(tt),nt=!1,s(st)}}}function cn(t){let e;return{c(){e=m("p"),e.textContent="Ошибка",$(e,"class","text-red-500 font-bold h-8 bg-red-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function un(t){let e;return{c(){e=m("p"),e.textContent="Ожидание",$(e,"class","text-blue-500 font-bold h-8 bg-blue-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function dn(t){let e;return{c(){e=m("p"),e.textContent="Подключение",$(e,"class","text-yellow-500 font-bold h-8 bg-yellow-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function pn(t){let e;return{c(){e=m("p"),e.textContent="Подключено",$(e,"class","text-green-500 font-bold h-8 bg-green-50 border-2 border-gray-200 rounded w-full text-center")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function hn(t){let e,n,i,r,o,a,l,c,u,d,g,v,y,x,k,O,L,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,W,R,I,B,Y,V;function U(t,e){return"e5"===t[1].mqtt?pn:"e13"===t[1].mqtt?dn:void 0===t[1].mqtt?un:cn}let G=U(t),X=G(t);return{c(){e=m("div"),n=m("div"),n.innerHTML='Состояние подключения
',i=b(),r=m("div"),X.c(),o=b(),a=m("div"),l=m("div"),l.innerHTML='Название сервера
',c=b(),u=m("div"),d=m("input"),g=b(),v=m("div"),y=m("div"),y.innerHTML='Порт
',x=b(),k=m("div"),O=m("input"),L=b(),T=m("div"),P=m("div"),P.innerHTML='Префикс
',M=b(),C=m("div"),S=m("input"),N=b(),_=m("div"),D=m("div"),D.innerHTML='Имя пользователя
',E=b(),j=m("div"),J=m("input"),H=b(),z=m("div"),F=m("div"),F.innerHTML='Пароль
',q=b(),W=m("div"),R=m("input"),I=b(),B=m("button"),B.textContent="Сохранить",$(n,"class","w-4/6"),$(r,"class","flex justify-center w-3/6 align-baseline text-sm sm:text-sm md:text-base lg:text-base xl:text-base 2xl:text-base break-words"),$(e,"class","crd-itm-psn"),$(l,"class","w-4/6"),$(d,"class","ipt-rnd text-left focus:border-indigo-500"),$(d,"type","text"),$(u,"class","flex justify-end w-3/6"),$(a,"class","crd-itm-psn"),$(y,"class","w-4/6"),$(O,"class","ipt-rnd text-left focus:border-indigo-500"),$(O,"type","text"),$(k,"class","flex justify-end w-3/6"),$(v,"class","crd-itm-psn"),$(P,"class","w-4/6"),$(S,"class","ipt-rnd text-left focus:border-indigo-500"),$(S,"type","text"),$(C,"class","flex justify-end w-3/6"),$(T,"class","crd-itm-psn"),$(D,"class","w-4/6"),$(J,"class","ipt-rnd text-left focus:border-indigo-500"),$(J,"type","text"),$(j,"class","flex justify-end w-3/6"),$(_,"class","crd-itm-psn"),$(F,"class","w-4/6"),$(R,"class","ipt-rnd text-left focus:border-indigo-500"),$(R,"type","text"),$(W,"class","flex justify-end w-3/6"),$(z,"class","crd-itm-psn"),$(B,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),X.m(r,null),h(s,o,f),h(s,a,f),p(a,l),p(a,c),p(a,u),p(u,d),A(d,t[0].mqttServer),h(s,g,f),h(s,v,f),p(v,y),p(v,x),p(v,k),p(k,O),A(O,t[0].mqttPort),h(s,L,f),h(s,T,f),p(T,P),p(T,M),p(T,C),p(C,S),A(S,t[0].mqttPrefix),h(s,N,f),h(s,_,f),p(_,D),p(_,E),p(_,j),p(j,J),A(J,t[0].mqttUser),h(s,H,f),h(s,z,f),p(z,F),p(z,q),p(z,W),p(W,R),A(R,t[0].mqttPass),h(s,I,f),h(s,B,f),Y||(V=[w(d,"input",t[16]),w(O,"input",t[17]),w(S,"input",t[18]),w(J,"input",t[19]),w(R,"input",t[20]),w(B,"click",t[21])],Y=!0)},p(t,e){G!==(G=U(t))&&(X.d(1),X=G(t),X&&(X.c(),X.m(r,null))),5&e&&d.value!==t[0].mqttServer&&A(d,t[0].mqttServer),5&e&&O.value!==t[0].mqttPort&&A(O,t[0].mqttPort),5&e&&S.value!==t[0].mqttPrefix&&A(S,t[0].mqttPrefix),5&e&&J.value!==t[0].mqttUser&&A(J,t[0].mqttUser),5&e&&R.value!==t[0].mqttPass&&A(R,t[0].mqttPass)},d(t){t&&f(e),X.d(),t&&f(o),t&&f(a),t&&f(g),t&&f(v),t&&f(L),t&&f(T),t&&f(N),t&&f(_),t&&f(H),t&&f(z),t&&f(I),t&&f(B),Y=!1,s(V)}}}function fn(e){let n,s,i;return{c(){n=m("button"),n.textContent="Перезагрузить устройство",$(n,"class","btn-lg")},m(t,r){h(t,n,r),s||(i=w(n,"click",e[22]),s=!0)},p:t,d(t){t&&f(n),s=!1,i()}}}function gn(t){let e,n,s,i;const r=[rn,sn],o=[];function a(t,e){return t[3]?0:1}return e=a(t),n=o[e]=r[e](t),{c(){n.c(),s=x()},m(t,n){o[e].m(t,n),h(t,s,n),i=!0},p(t,[i]){let l=e;e=a(t),e===l?o[e].p(t,i):(X(),Z(o[l],1,1,(()=>{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function mn(t,e,n){let{settingsJson:s}=e,{errorsJson:i}=e,{ssidJson:r}=e,{show:o}=e,{ssidClick:a=(()=>{})}=e,{saveSett:l=(()=>{})}=e,{saveMqtt:c=(()=>{})}=e,{rebootEsp:u=(()=>{})}=e;return t.$$set=t=>{"settingsJson"in t&&n(0,s=t.settingsJson),"errorsJson"in t&&n(1,i=t.errorsJson),"ssidJson"in t&&n(2,r=t.ssidJson),"show"in t&&n(3,o=t.show),"ssidClick"in t&&n(4,a=t.ssidClick),"saveSett"in t&&n(5,l=t.saveSett),"saveMqtt"in t&&n(6,c=t.saveMqtt),"rebootEsp"in t&&n(7,u=t.rebootEsp)},[s,i,r,o,a,l,c,u,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=T(this),n(0,s),n(2,r)},()=>a(),function(){s.routerpass=this.value,n(0,s),n(2,r)},function(){s.serverip=this.value,n(0,s),n(2,r)},()=>l(),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(),()=>u()]}class vn extends rt{constructor(t){super(),it(this,t,mn,gn,r,{settingsJson:0,errorsJson:1,ssidJson:2,show:3,ssidClick:4,saveSett:5,saveMqtt:6,rebootEsp:7})}}function yn(t,e,n){const s=t.slice();return s[13]=e[n],s[15]=n,s}function bn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function xn(t){let e,n,s,i,r;return n=new qt({props:{title:"Список устройств",$$slots:{default:[kn]},$$scope:{ctx:t}}}),i=new Dt({props:{$$slots:{default:[On]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),$(e,"class","grd-1col1")},m(t,o){h(t,e,o),nt(n,e,null),p(e,s),nt(i,e,null),r=!0},p(t,e){const s={};65591&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};65536&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r)},i(t){r||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),r=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),r=!1},d(t){t&&f(e),st(n),st(i)}}}function wn(t){let e,n,s,i,r,o,a,l,c,u,d,g,v,x,w,k,A,L,T,P=t[13].name+"",M=t[13].ip+"",C=t[13].id+"",S=t[13].status?"online":"offline";return L=new Mt({props:{click:function(){return t[7](t[15])}}}),{c(){e=m("tr"),n=m("td"),s=y(P),i=b(),r=m("td"),o=m("a"),a=y(M),c=b(),u=m("td"),d=y(C),g=b(),v=m("td"),x=y(S),k=b(),A=m("td"),et(L.$$.fragment),$(n,"class","tbl-bdy-lg ipt-lg w-full"),$(o,"href",l="http://"+t[13].ip),$(r,"class","tbl-bdy-lg ipt-lg w-full"),$(u,"class","tbl-bdy-lg ipt-lg w-full"),$(v,"class",w="tbl-bdy-lg ipt-lg w-full "+(t[13].status?"bg-green-50":"bg-red-50")),$(A,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad")},m(t,l){h(t,e,l),p(e,n),p(n,s),p(e,i),p(e,r),p(r,o),p(o,a),p(e,c),p(e,u),p(u,d),p(e,g),p(e,v),p(v,x),p(e,k),p(e,A),nt(L,A,null),T=!0},p(e,n){t=e,(!T||1&n)&&P!==(P=t[13].name+"")&&O(s,P),(!T||1&n)&&M!==(M=t[13].ip+"")&&O(a,M),(!T||1&n&&l!==(l="http://"+t[13].ip))&&$(o,"href",l),(!T||1&n)&&C!==(C=t[13].id+"")&&O(d,C),(!T||1&n)&&S!==(S=t[13].status?"online":"offline")&&O(x,S),(!T||1&n&&w!==(w="tbl-bdy-lg ipt-lg w-full "+(t[13].status?"bg-green-50":"bg-red-50")))&&$(v,"class",w)},i(t){T||(Q(L.$$.fragment,t),T=!0)},o(t){Z(L.$$.fragment,t),T=!1},d(t){t&&f(e),st(L)}}}function $n(t){let e,n,i,r,o,a,l,c,u,d,g,v,y;return{c(){e=m("tr"),n=m("td"),i=m("input"),r=b(),o=m("td"),a=m("input"),l=b(),c=m("td"),u=m("input"),d=b(),g=m("td"),$(i,"class","ipt-lg w-full"),$(i,"type","text"),$(n,"class","tbl-bdy-lg"),$(a,"class","ipt-lg w-full"),$(a,"type","text"),$(o,"class","tbl-bdy-lg"),$(u,"class","ipt-lg w-full"),$(u,"type","text"),$(c,"class","tbl-bdy-lg"),$(g,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad")},m(s,f){h(s,e,f),p(e,n),p(n,i),A(i,t[2].name),p(e,r),p(e,o),p(o,a),A(a,t[2].ip),p(e,l),p(e,c),p(c,u),A(u,t[2].id),p(e,d),p(e,g),v||(y=[w(i,"input",t[8]),w(a,"input",t[9]),w(u,"input",t[10])],v=!0)},p(t,e){4&e&&i.value!==t[2].name&&A(i,t[2].name),4&e&&a.value!==t[2].ip&&A(a,t[2].ip),4&e&&u.value!==t[2].id&&A(u,t[2].id)},d(t){t&&f(e),v=!1,s(y)}}}function kn(t){let e,n,i,r,o,a,l,c,u,d,v,x,k,A,L=t[1]?"Сохранить":"Добавить устройство",T=t[0],P=[];for(let e=0;eZ(P[t],1,1,(()=>{P[t]=null}));let C=t[1]&&$n(t);return{c(){e=m("table"),n=m("thead"),n.innerHTML='| Название устройства | \n IP адрес | \n Идентификатор | \n Состояние | \n |
',i=b(),r=m("tbody");for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Ln(t,e,n){let{show:s}=e,{deviceList:i}=e,{showInput:r}=e,{newDevice:o={}}=e,{addDevInList:a=(()=>{})}=e,{sendToAllDevices:l=(t=>{})}=e;function c(t){for(let e=0;e{"show"in t&&n(3,s=t.show),"deviceList"in t&&n(0,i=t.deviceList),"showInput"in t&&n(1,r=t.showInput),"newDevice"in t&&n(2,o=t.newDevice),"addDevInList"in t&&n(4,a=t.addDevInList),"sendToAllDevices"in t&&n(5,l=t.sendToAllDevices)},[i,r,o,s,a,l,c,t=>c(t),function(){o.name=this.value,n(2,o)},function(){o.ip=this.value,n(2,o)},function(){o.id=this.value,n(2,o)},()=>(n(1,r=!r),a()),t=>l("/reboot|")]}class Tn extends rt{constructor(t){super(),it(this,t,Ln,An,r,{show:3,deviceList:0,showInput:1,newDevice:2,addDevInList:4,sendToAllDevices:5})}}function Pn(t,e,n){const s=t.slice();return s[22]=e[n][0],s[23]=e[n][1],s[25]=n,s}function Mn(t,e,n){const s=t.slice();return s[26]=e[n],s[25]=n,s}function Cn(t,e,n){const s=t.slice();return s[22]=e[n][0],s[23]=e[n][1],s}function Sn(e){let n,s;return n=new Dt({props:{title:"Загрузка..."}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function Nn(t){let e,n,s,i,r,o,a,l,c,u;return n=new qt({props:{title:"Системная информация",$$slots:{default:[qn]},$$scope:{ctx:t}}}),i=new qt({props:{title:"Системные настройки",$$slots:{default:[Rn]},$$scope:{ctx:t}}}),o=new qt({props:{title:"Лог",class:"z-50",$$slots:{default:[Bn]},$$scope:{ctx:t}}}),c=new qt({props:{title:"Системные ошибки",$$slots:{default:[Xn]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),et(i.$$.fragment),r=b(),et(o.$$.fragment),a=b(),l=m("div"),et(c.$$.fragment),$(e,"class","grd-3col1"),$(l,"class","grd-1col1")},m(t,d){h(t,e,d),nt(n,e,null),p(e,s),nt(i,e,null),p(e,r),nt(o,e,null),h(t,a,d),h(t,l,d),nt(c,l,null),u=!0},p(t,e){const s={};1073741913&e&&(s.$$scope={dirty:e,ctx:t}),n.$set(s);const r={};1073742214&e&&(r.$$scope={dirty:e,ctx:t}),i.$set(r);const a={};1073741856&e&&(a.$$scope={dirty:e,ctx:t}),o.$set(a);const l={};1073742856&e&&(l.$$scope={dirty:e,ctx:t}),c.$set(l)},i(t){u||(Q(n.$$.fragment,t),Q(i.$$.fragment,t),Q(o.$$.fragment,t),Q(c.$$.fragment,t),u=!0)},o(t){Z(n.$$.fragment,t),Z(i.$$.fragment,t),Z(o.$$.fragment,t),Z(c.$$.fragment,t),u=!1},d(t){t&&f(e),st(n),st(i),st(o),t&&f(a),t&&f(l),st(c)}}}function _n(t){let e,n,s,i,r=t[23]+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[23],e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){16&s&&r!==(r=t[23]+"")&&O(n,r),16&s&&i!==(i=t[23])&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function Dn(t){let e;return{c(){e=m("p"),e.textContent="не подключено",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function En(t){let e;return{c(){e=m("p"),e.textContent="нет сигнала",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function jn(t){let e;return{c(){e=m("p"),e.textContent="очень низкий",$(e,"class","text-red-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Jn(t){let e;return{c(){e=m("p"),e.textContent="низкий",$(e,"class","text-yellow-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Hn(t){let e;return{c(){e=m("p"),e.textContent="хороший",$(e,"class","text-yellow-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function zn(t){let e;return{c(){e=m("p"),e.textContent="очень хороший",$(e,"class","text-green-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function Fn(t){let e;return{c(){e=m("p"),e.textContent="отличный",$(e,"class","text-green-500 font-bold text-sm text-center truncate")},m(t,n){h(t,e,n)},d(t){t&&f(e)}}}function qn(t){let e,n,i,r,o,a,l,c,u,d,v,x,k,A,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,X,K,Q,Z,tt,et,nt,st,it,rt,ot,at,lt,ct,ut,dt,pt,ht,ft,gt,mt,vt,yt,bt,xt,wt,$t,kt,Ot,At,Lt,Tt,Pt,Mt,Ct,St,Nt,_t,Dt,Et,jt,Jt,Ht,zt,Ft,qt,Wt,Rt,It=t[3].bn+"",Bt=t[3].bver+"",Yt=t[3].timenow+"",Vt=t[3].upt+"",Ut=t[3].uptm+"",Gt=t[3].uptw+"",Xt=t[3].heap+"",Kt=t[3].fl+"",Qt=t[3].rst+"",Zt=Object.entries(t[4]),te=[];for(let e=0;eНазвание прошивки',i=b(),r=m("div"),o=m("p"),a=y(It),l=b(),c=m("div"),u=m("div"),u.innerHTML='Доступные версии
',d=b(),v=m("div"),x=m("select");for(let t=0;tВерсия прошивки',P=b(),M=m("div"),C=m("p"),S=y(Bt),N=b(),_=m("div"),D=m("div"),D.innerHTML='Время на устройстве
',E=b(),j=m("div"),J=m("p"),H=y(Yt),z=b(),F=m("div"),q=m("div"),q.innerHTML='Uptime устройства
',R=b(),I=m("div"),B=m("p"),Y=y(Vt),V=b(),U=m("div"),G=m("div"),G.innerHTML='Uptime сессии mqtt
',X=b(),K=m("div"),Q=m("p"),Z=y(Ut),tt=b(),et=m("div"),nt=m("div"),nt.innerHTML='Uptime сессии wifi
',st=b(),it=m("div"),rt=m("p"),ot=y(Gt),at=b(),lt=m("div"),ct=m("div"),ct.innerHTML='Качество WiFi сигнала
',ut=b(),dt=m("div"),ee&&ee.c(),pt=b(),ne&&ne.c(),ht=b(),se&&se.c(),ft=b(),ie&&ie.c(),gt=b(),re&&re.c(),mt=b(),oe&&oe.c(),vt=b(),ae&&ae.c(),yt=b(),bt=m("div"),xt=m("div"),xt.innerHTML='Остаток RAM
',wt=b(),$t=m("div"),kt=m("p"),Ot=y(Xt),At=b(),Lt=m("div"),Tt=m("div"),Tt.innerHTML='Кол-во записей на flash
',Pt=b(),Mt=m("div"),Ct=m("p"),St=y(Kt),Nt=b(),_t=m("div"),Dt=m("div"),Dt.innerHTML='Причина перезагрузки
',Et=b(),jt=m("div"),Jt=m("p"),Ht=y(Qt),Ft=b(),qt=m("button"),qt.textContent="Обновить прошивку",$(n,"class","w-2/3"),$(o,"class","text-gray-500 font-bold text-sm text-center truncate"),$(r,"class","flex justify-center w-1/3"),$(e,"class","flex mb-2 h-6 items-center"),$(u,"class","w-2/3"),$(x,"class","border border-indigo-500 border-4 text-center"),void 0===t[0]&&W((()=>t[12].call(x))),$(v,"class","flex justify-center w-1/3"),$(c,"class","flex mb-2 h-6 items-center"),$(T,"class","w-2/3"),$(C,"class","text-gray-500 font-bold text-sm text-center truncate"),$(M,"class","flex justify-center w-1/3"),$(A,"class","flex mb-2 h-6 items-center"),$(D,"class","w-2/3"),$(J,"class","text-gray-500 font-bold text-sm text-center truncate"),$(j,"class","flex justify-center w-1/3"),$(_,"class","flex mb-2 h-6 items-center"),$(q,"class","w-2/3"),$(B,"class","text-gray-500 font-bold text-sm text-center truncate"),$(I,"class","flex justify-center w-1/3"),$(F,"class","flex mb-2 h-6 items-center"),$(G,"class","w-2/3"),$(Q,"class","text-gray-500 font-bold text-sm text-center truncate"),$(K,"class","flex justify-center w-1/3"),$(U,"class","flex mb-2 h-6 items-center"),$(nt,"class","w-2/3"),$(rt,"class","text-gray-500 font-bold text-sm text-center truncate"),$(it,"class","flex justify-center w-1/3"),$(et,"class","flex mb-2 h-6 items-center"),$(ct,"class","w-2/3"),$(dt,"class","flex justify-center w-1/3 text-xs sm:text-sm md:text-base lg:text-base xl:text-base 2xl:text-base break-words"),$(lt,"class","flex mb-2 h-6 items-center"),$(xt,"class","w-2/3"),$(kt,"class","text-green-500 font-bold text-center truncate"),$($t,"class","flex justify-center w-1/3 text-sm text-center"),$(bt,"class","flex mb-2 h-6 items-center"),$(Tt,"class","w-2/3"),$(Ct,"class","text-green-500 font-bold text-center truncate"),$(Mt,"class","flex justify-center w-1/3 text-sm"),$(Lt,"class","flex mb-2 h-6 items-center"),$(Dt,"class","w-2/3"),$(Jt,"class",zt=(t[3].rst.toString().includes("Watchdog")||t[3].rst.toString().includes("Exception")?"text-red-500":"text-green-500")+" font-bold text-center truncate"),$(jt,"class","flex justify-center w-1/3 text-sm"),$(_t,"class","flex mb-2 h-6 items-center"),$(qt,"class","btn-lg")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),p(o,a),h(s,l,f),h(s,c,f),p(c,u),p(c,d),p(c,v),p(v,x);for(let t=0;tЧасовой пояс',i=b(),r=m("div"),o=m("input"),a=b(),l=m("div"),c=m("div"),c.innerHTML='Данные графиков
',u=b(),d=m("div"),g=m("button"),g.textContent="Очистить",v=b(),y=m("div"),O=m("div"),O.innerHTML='Включить лог
',L=b(),T=m("div"),P=m("label"),M=m("div"),C=m("input"),S=b(),N=m("div"),D=b(),E=m("div"),j=b(),F&&F.c(),J=x(),$(n,"class","w-2/3"),$(o,"class","ipt-rnd h-7 text-center focus:border-indigo-500"),$(o,"type","number"),$(r,"class","flex justify-center w-1/3"),$(e,"class","flex mb-2 h-6 items-center"),$(c,"class","w-2/3"),$(g,"class","btn-lg h-7"),$(d,"class","flex justify-center w-1/3"),$(l,"class","flex mb-2 h-6 items-center"),$(O,"class","w-2/3"),$(C,"id","log"),$(C,"type","checkbox"),$(C,"class","sr-only"),$(N,"class",_="block "+(t[1].log?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg"),$(E,"class","dot bg-gray-100 absolute left-1 top-1 w-4 h-4 rounded-full transition shadow-lg"),$(M,"class","relative"),$(P,"for","log"),$(P,"class","items-center cursor-pointer"),$(T,"class","flex justify-center w-1/3"),$(y,"class","flex mb-2 h-6 items-center")},m(s,f){h(s,e,f),p(e,n),p(e,i),p(e,r),p(r,o),A(o,t[1].timezone),h(s,a,f),h(s,l,f),p(l,c),p(l,u),p(l,d),p(d,g),h(s,v,f),h(s,y,f),p(y,O),p(y,L),p(y,T),p(T,P),p(P,M),p(M,C),C.checked=t[1].log,p(M,S),p(M,N),p(M,D),p(M,E),h(s,j,f),F&&F.m(s,f),h(s,J,f),H||(z=[w(o,"input",t[14]),w(o,"change",t[15]),w(g,"click",t[16]),w(C,"change",t[17]),w(C,"change",t[18])],H=!0)},p(t,e){2&e&&k(o.value)!==t[1].timezone&&A(o,t[1].timezone),2&e&&(C.checked=t[1].log),2&e&&_!==(_="block "+(t[1].log?"bg-blue-600":"bg-gray-600")+" w-10 h-6 rounded-full shadow-lg")&&$(N,"class",_),t[2]?F?F.p(t,e):(F=Wn(t),F.c(),F.m(J.parentNode,J)):F&&(F.d(1),F=null)},d(t){t&&f(e),t&&f(a),t&&f(l),t&&f(v),t&&f(y),t&&f(j),F&&F.d(t),t&&f(J),H=!1,s(z)}}}function In(t){let e,n,s,i=t[26].msg+"";return{c(){e=m("div"),n=y(i),$(e,"class",s=t[26].msg.toString().includes("[E]")?"text-xs text-red-500":"text-xs text-black")},m(t,s){h(t,e,s),p(e,n)},p(t,r){32&r&&i!==(i=t[26].msg+"")&&O(n,i),32&r&&s!==(s=t[26].msg.toString().includes("[E]")?"text-xs text-red-500":"text-xs text-black")&&$(e,"class",s)},d(t){t&&f(e)}}}function Bn(t){let e,n=t[5],s=[];for(let e=0;e{s=null})),K())},i(t){n||(Q(s),n=!0)},o(t){Z(s),n=!1},d(t){s&&s.d(t),t&&f(e)}}}function Xn(t){let e,n,s=Object.entries(t[3]),i=[];for(let e=0;eZ(i[t],1,1,(()=>{i[t]=null}));return{c(){for(let t=0;t{o[l]=null})),K(),n=o[e],n?n.p(t,i):(n=o[e]=r[e](t),n.c()),Q(n,1),n.m(s.parentNode,s))},i(t){i||(Q(n),i=!0)},o(t){Z(n),i=!1},d(t){o[e].d(t),t&&f(s)}}}function Qn(t,e,n){let{errorsJson:s}=e,{versionsList:i}=e,{choosingVersion:r}=e,{coreMessages:o}=e,{settingsJson:a}=e,{startUpdate:l=(()=>{})}=e,{saveSett:c=(()=>{})}=e,{cleanLogs:u=(()=>{})}=e,{show:d}=e,{paramsBeenChanged:p=!1}=e,{cancelAlarm:h=(t=>{})}=e;return t.$$set=t=>{"errorsJson"in t&&n(3,s=t.errorsJson),"versionsList"in t&&n(4,i=t.versionsList),"choosingVersion"in t&&n(0,r=t.choosingVersion),"coreMessages"in t&&n(5,o=t.coreMessages),"settingsJson"in t&&n(1,a=t.settingsJson),"startUpdate"in t&&n(6,l=t.startUpdate),"saveSett"in t&&n(7,c=t.saveSett),"cleanLogs"in t&&n(8,u=t.cleanLogs),"show"in t&&n(9,d=t.show),"paramsBeenChanged"in t&&n(2,p=t.paramsBeenChanged),"cancelAlarm"in t&&n(10,h=t.cancelAlarm)},[r,a,p,s,i,o,l,c,u,d,h,{mqtt:{e1:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Нет ответа от сервера",cancel:!1},e2:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Соединение было разорвано",cancel:!1},e3:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Ошибка соединения. Обычно возникает когда неверно указано название сервера MQTT",cancel:!1},e4:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Клиент был отключен",cancel:!1},e6:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Ошибка версии",cancel:!1},e7:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Отклонен идентификатор",cancel:!1},e8:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Не могу установить соединение",cancel:!1},e9:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Неправильное имя пользователя/пароль"},e10:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Не авторизован для подключения",cancel:!1},e11:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Название сервера пустое",cancel:!1},e12:{descr:"Ошибка mqtt",color:"text-red-500",txt:"Имя пользователя или пароль пустые",cancel:!1},e13:{descr:"Mqtt",color:"text-red-500",txt:"Подключение в процессе",cancel:!1}},wse1:{1:{descr:"Ошибка веб сокетов",color:"text-red-500",txt:"Слишком много клиентов было открыто. Допускается не более четырех.",cancel:!0}},jse1:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Недостаточный размер буфера библиотеки Arduino Json. Устройство может вести себя непредсказуемо. Обратитесь к разработчику.",cancel:!0}},jse2:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Ошибка записи/чтения json.",cancel:!0,num:!0}},jse3:{1:{descr:"Ошибка json",color:"text-red-500",txt:"Ошибка чтения json файла с виджетами",cancel:!0}}},function(){r=T(this),n(0,r),n(4,i)},()=>l(),function(){a.timezone=k(this.value),n(1,a)},()=>n(2,p=!0),()=>u(),function(){a.log=this.checked,n(1,a)},()=>n(2,p=!0),()=>(c(),n(2,p=!1)),t=>h(t)]}class Zn extends rt{constructor(t){super(),it(this,t,Qn,Kn,r,{errorsJson:3,versionsList:4,choosingVersion:0,coreMessages:5,settingsJson:1,startUpdate:6,saveSett:7,cleanLogs:8,show:9,paramsBeenChanged:2,cancelAlarm:10})}}function ts(e){let n,s,i,r;return{c(){n=v("svg"),s=v("path"),$(s,"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"),$(n,"class",i="h-8 w-8 "+e[0]),$(n,"width","8"),$(n,"height","8"),$(n,"viewBox",r=e[1]+" "+e[2]+" 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,e){h(t,n,e),p(n,s)},p(t,[e]){1&e&&i!==(i="h-8 w-8 "+t[0])&&$(n,"class",i),6&e&&r!==(r=t[1]+" "+t[2]+" 24 24")&&$(n,"viewBox",r)},i:t,o:t,d(t){t&&f(n)}}}function es(t,e,n){let{color:s}=e,{x:i=0}=e,{y:r=0}=e;return t.$$set=t=>{"color"in t&&n(0,s=t.color),"x"in t&&n(1,i=t.x),"y"in t&&n(2,r=t.y)},[s,i,r]}class ns extends rt{constructor(t){super(),it(this,t,es,ts,r,{color:0,x:1,y:2})}}function ss(t,e,n){const s=t.slice();return s[119]=e[n],s}function is(t){let e,n;return e=new jt({}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function rs(t){let e,n,s,i,r=t[119].name+"";return{c(){e=m("option"),n=y(r),s=b(),e.__value=i=t[119].ws,e.value=e.__value},m(t,i){h(t,e,i),p(e,n),p(e,s)},p(t,s){524288&s[0]&&r!==(r=t[119].name+"")&&O(n,r),524288&s[0]&&i!==(i=t[119].ws)&&(e.__value=i,e.value=e.__value)},d(t){t&&f(e)}}}function os(t){let e,n,s,i,r,o,a,l,c,u,d,p;e=new Lt({props:{path:"/",$$slots:{default:[ls]},$$scope:{ctx:t}}}),s=new Lt({props:{path:"/config",$$slots:{default:[cs]},$$scope:{ctx:t}}}),r=new Lt({props:{path:"/connection",$$slots:{default:[us]},$$scope:{ctx:t}}}),a=new Lt({props:{path:"/list",$$slots:{default:[ds]},$$scope:{ctx:t}}}),c=new Lt({props:{path:"/system",$$slots:{default:[ps]},$$scope:{ctx:t}}});let g=fs;return{c(){et(e.$$.fragment),n=b(),et(s.$$.fragment),i=b(),et(r.$$.fragment),o=b(),et(a.$$.fragment),l=b(),et(c.$$.fragment),u=b(),d=x()},m(t,f){nt(e,t,f),h(t,n,f),nt(s,t,f),h(t,i,f),nt(r,t,f),h(t,o,f),nt(a,t,f),h(t,l,f),nt(c,t,f),h(t,u,f),h(t,d,f),p=!0},p(t,n){const i={};32792&n[0]|536870912&n[3]&&(i.$$scope={dirty:n,ctx:t}),e.$set(i);const o={};30752&n[0]|536870912&n[3]&&(o.$$scope={dirty:n,ctx:t}),s.$set(o);const l={};458816&n[0]|536870912&n[3]&&(l.$$scope={dirty:n,ctx:t}),r.$set(l);const u={};4718720&n[0]|536870912&n[3]&&(u.$$scope={dirty:n,ctx:t}),a.$set(u);const d={};8587008&n[0]|536870912&n[3]&&(d.$$scope={dirty:n,ctx:t}),c.$set(d)},i(t){p||(Q(e.$$.fragment,t),Q(s.$$.fragment,t),Q(r.$$.fragment,t),Q(a.$$.fragment,t),Q(c.$$.fragment,t),Q(g),p=!0)},o(t){Z(e.$$.fragment,t),Z(s.$$.fragment,t),Z(r.$$.fragment,t),Z(a.$$.fragment,t),Z(c.$$.fragment,t),Z(g),p=!1},d(t){st(e,t),t&&f(n),st(s,t),t&&f(i),st(r,t),t&&f(o),st(a,t),t&&f(l),st(c,t),t&&f(u),t&&f(d)}}}function as(e){let n,s;return n=new Dt({props:{title:"Нет соединения"}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),s=!0},p:t,i(t){s||(Q(n.$$.fragment,t),s=!0)},o(t){Z(n.$$.fragment,t),s=!1},d(t){st(n,t)}}}function ls(t){let e,n;return e=new Ne({props:{show:t[4],layoutJson:t[15],pages:t[3],wsPush:t[41]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};16&n[0]&&(s.show=t[4]),32768&n[0]&&(s.layoutJson=t[15]),8&n[0]&&(s.pages=t[3]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function cs(t){let e,n;return e=new en({props:{show:t[5],configJson:t[11],widgetsJson:t[12],itemsJson:t[13],saveConfig:t[42],cleanLogs:t[43],rebootEsp:t[44],scenarioJson:t[14]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};32&n[0]&&(s.show=t[5]),2048&n[0]&&(s.configJson=t[11]),4096&n[0]&&(s.widgetsJson=t[12]),8192&n[0]&&(s.itemsJson=t[13]),16384&n[0]&&(s.scenarioJson=t[14]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function us(t){let e,n;return e=new vn({props:{show:t[6],rebootEsp:t[45],ssidClick:t[46],saveSett:t[47],saveMqtt:t[48],settingsJson:t[16],errorsJson:t[17],ssidJson:t[18]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};64&n[0]&&(s.show=t[6]),65536&n[0]&&(s.settingsJson=t[16]),131072&n[0]&&(s.errorsJson=t[17]),262144&n[0]&&(s.ssidJson=t[18]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ds(t){let e,n;return e=new Tn({props:{show:t[7],deviceList:t[19],showInput:gs,addDevInList:t[49],newDevice:t[22],sendToAllDevices:t[50]}}),{c(){et(e.$$.fragment)},m(t,s){nt(e,t,s),n=!0},p(t,n){const s={};128&n[0]&&(s.show=t[7]),524288&n[0]&&(s.deviceList=t[19]),4194304&n[0]&&(s.newDevice=t[22]),e.$set(s)},i(t){n||(Q(e.$$.fragment,t),n=!0)},o(t){Z(e.$$.fragment,t),n=!1},d(t){st(e,t)}}}function ps(t){let e,n,s;function i(e){t[55](e)}let r={show:t[8],errorsJson:t[17],settingsJson:t[16],saveSett:t[51],cleanLogs:t[52],cancelAlarm:t[53],versionsList:t[9],startUpdate:t[54],coreMessages:t[23]};return void 0!==t[10]&&(r.choosingVersion=t[10]),e=new Zn({props:r}),E.push((()=>tt(e,"choosingVersion",i))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),s=!0},p(t,s){const i={};256&s[0]&&(i.show=t[8]),131072&s[0]&&(i.errorsJson=t[17]),65536&s[0]&&(i.settingsJson=t[16]),512&s[0]&&(i.versionsList=t[9]),8388608&s[0]&&(i.coreMessages=t[23]),!n&&1024&s[0]&&(n=!0,i.choosingVersion=t[10],R((()=>n=!1))),e.$set(i)},i(t){s||(Q(e.$$.fragment,t),s=!0)},o(t){Z(e.$$.fragment,t),s=!1},d(t){st(e,t)}}}function hs(t){let e,n,i,r,o,a,l,c,u,d,v,y,x,k,O,A,T,P,M,C,S,N,_,D,E,j,J,H,z,F,q,R,I,B,Y,V,U,G,tt,it,rt,ot,at,lt=t[2]&&is(),ct=t[19],ut=[];for(let e=0;e",O=b(),A=m("ul"),T=m("li"),P=m("a"),P.textContent="Управление",M=b(),C=m("li"),S=m("a"),S.textContent="Конфигуратор",N=b(),_=m("li"),D=m("a"),D.textContent="Подключение",E=b(),j=m("li"),J=m("a"),J.textContent="Устройства",H=b(),z=m("li"),F=m("a"),F.textContent="Системные",q=b(),R=b(),I=m("main"),B=m("ul"),Y=m("div"),U.c(),tt=b(),it=m("footer"),it.innerHTML='Developed by Dmitry Borisenko
',$(a,"class","border border-indigo-500 border-4"),void 0===t[21]&&W((()=>t[37].call(a))),$(o,"class","px-15 py-1"),$(c,"class","pl-4 pr-4 py-1"),$(r,"class","flex content-center items-center justify-end"),$(i,"class","h-10 w-full bg-gray-100 overflow-auto shadow-md"),$(y,"class","w-0 h-0"),$(y,"id","menu__toggle"),$(y,"type","checkbox"),$(k,"class","menu__btn"),$(k,"for","menu__toggle"),$(P,"class","menu__item"),$(P,"href","/"),$(S,"class","menu__item"),$(S,"href","/config"),$(D,"class","menu__item"),$(D,"href","/connection"),$(J,"class","menu__item"),$(J,"href","/list"),$(F,"class","menu__item"),$(F,"href","/system"),$(A,"class","menu__box"),$(v,"class","flex"),$(Y,"class","bg-cover pt-0 px-4"),$(B,"class","menu__main"),$(I,"class",G="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")),$(it,"class","h-4 bg-gray-100 border-gray-200 shadow-lg"),$(e,"class","flex flex-col h-screen bg-gray-50")},m(s,f){h(s,e,f),lt&<.m(e,null),p(e,n),p(e,i),p(i,r),p(r,o),p(o,a);for(let t=0;t{lt=null})),K()),524288&s[0]){let e;for(ct=t[19],e=0;e{pt[r]=null})),K(),U=pt[V],U?U.p(t,s):(U=pt[V]=dt[V](t),U.c()),Q(U,1),U.m(Y,null)),(!rt||3&s[0]&&G!==(G="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")))&&$(I,"class",G)},i(t){rt||(Q(lt),Q(u.$$.fragment,t),Q(U),rt=!0)},o(t){Z(lt),Z(u.$$.fragment,t),Z(U),rt=!1},d(t){t&&f(e),lt&<.d(),g(ut,t),st(u),pt[V].d(),ot=!1,s(at)}}}let fs=!1,gs=!1;function ms(t,e){for(var n in e)t[n]=e[n];return t}function vs(t){try{JSON.parse(t)}catch(e){return console.log("[e]","json parce error: ",t),!1}return!0}function ys(t,e,n){let s;o(t,bt,(t=>n(84,s=t))),bt.mode.hash();let i=!1,r=!1,a=document.location.hostname,l=!0,c=!1;const u=void 0;let d,p=[],h=!1,f=!1,g=!1,m=!1,v=!1,y={},b=[],x=!1,w=!1,$=[],k=!1,O=!1,A=[],L=!1,P=!1,M={},C=!1,N=!1,_=[],D={},E=!1,j={},J=!1,H={},z=!1,F={},q=[],W=!1,R=[];R=[{name:"--",id:"--",ip:a,ws:0,status:!1}];let I,B=[],Y=!1,V=0,U=!0,G={},X=[];var K=function(){this.parts=[]};let Q;K.prototype.append=function(t){this.parts.push(t),this.blob=void 0},K.prototype.getBlob=function(){return this.blob||(this.blob=new Blob(this.parts,{type:"binary"})),this.blob},K.prototype.clear=function(){this.parts=[]};var Z=new K,tt=new K,et=new K,nt=new K,st=[];function it(){console.log("[i]","handle navigation"),Q=s.path.toString(),"/dev"!=Q&&mt(),Q+="|",console.log("[i]","user on page:",Q),"/|"===Q?$t(Q):rt()}function rt(){void 0!==V&&wt(V,Q)}function ot(){Tt(V);let t=0;R.forEach((e=>{e.ws=t,e.status||(lt(t),ut(t)),t++})),n(19,R)}function at(t,e){R.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(19,R),Tt(V),n(20,Y=I.status)}function lt(t){let e=ct(t);"error"===e?console.log("[e]","device list wrong"):(B[t]=new WebSocket("ws://"+e+":81"),B.binaryType="blob",console.log("[i]",e,t,"started connecting..."))}function ct(t){let e="error";return R.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function ut(t){if(B[t]){let e=ct(t);console.log("[i]",e,t,"web socket events added"),B[t].addEventListener("open",(function(n){console.log("[i]",e,t,"completed connecting"),at(t,!0),l&&wt(0,"/list|"),"/|"===Q?wt(t,Q):t===V&&rt()})),B[t].addEventListener("message",(function(e){if("string"==typeof e.data){let i=e.data;if(t===V){if(i.includes('devicelist":"')&&vs(i)&&(q=JSON.parse(i),l?(n(19,R=q),n(19,R[0].status=!0,R)):n(19,R=function(t,e){var n=new Set(t.map((t=>t.ip)));let s=[...t,...e.filter((t=>!n.has(t.ip)))];return s}(R,q)),l=!1,n(19,R),W=!0,console.log("✔","deviceList json parced"),dt(),At(),ot()),i.includes('ssid":"')&&vs(i)&&(n(18,H=JSON.parse(i)),n(18,H),console.log("✔","ssidJson parced"),z=!0,dt()),i.includes('errors":"')&&vs(i)&&(n(17,j=JSON.parse(i)),n(17,j),J=!0,console.log("✔","errorsJson json parced"),dt()),i.includes('settings":"')&&vs(i)&&(n(16,D=JSON.parse(i)),n(16,D),E=!0,console.log("✔","settingsJson json parced"),dt()),i.includes("/log|")&&(i=i.replace("/log|",""),console.log("",i),Ot(i)),"/st/scenario.json"===i&&(C=!0),"/end/scenario.json"===i){C=!1;var s=nt.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(14,M=JSON.parse(e)),n(14,M),N=!0,console.log("✔","scenarioJson parced",M),dt())}}if("/st/config.json"===i&&(x=!0),"/end/config.json"===i){x=!1;s=Z.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(11,b=JSON.parse(e)),n(11,b),w=!0,console.log("✔","configJson parced"),dt())}}if("/st/widgets.json"===i&&(k=!0),"/end/widgets.json"===i){k=!1;s=tt.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(12,$=JSON.parse(e)),n(12,$),O=!0,console.log("✔","widgetsJson parced"),dt())}}if("/st/items.json"===i&&(L=!0),"/end/items.json"===i){L=!1;s=et.getBlob();let t=new FileReader;t.readAsText(s),t.onload=()=>{let e=t.result;vs(e)&&(n(13,A=JSON.parse(e)),n(13,A),P=!0,console.log("✔","itemsJson parced"),dt())}}}if(i.includes('"params":"')&&vs(i)&&(F={...F,...JSON.parse(i)},console.log("[i] paramsJson:",F),async function(t){var e=st[t].getBlob();let s=new FileReader;s.readAsText(e),s.onload=()=>{let e=JSON.parse(s.result);!function(t,e){for(const[n,s]of Object.entries(F))for(let i=0;i{console.log("[e]",e,"connection closed"),at(t,!1)})),B[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),at(t,!1)}))}else console.log("[e]","socket not exist")}async function dt(){"/|"===Q&&(vt(),console.log("✔","dashboard packet received"),n(4,h=!0)),"/config|"===Q&&P&&O&&w&&E&&N&&(vt(),console.log("✔✔","config data parced"),n(5,f=!0)),"/connection|"===Q&&z&&E&&J&&(vt(),console.log("✔✔","connection data parced"),n(6,g=!0)),"/list|"===Q&&W&&(vt(),console.log("✔✔","list data parced"),n(7,m=!0)),"/system|"===Q&&J&&E&&(vt(),async function(){try{let t=D.serverip+"/iotm/ver.json";console.log("url",t);let e=await fetch(t,{mode:"cors",method:"GET"});e.ok?(n(9,y=await e.json()),n(9,y=y[j.bn]),n(10,d=j.bver),console.log(JSON.stringify(y))):(n(10,d=void 0),console.log("error, versions list not received",e.statusText))}catch(t){n(10,d=void 0),console.log("error, versions list not received"),console.log(t)}}(),console.log("✔✔","system data parced"),n(8,v=!0))}function pt(){wt(V,"/tuoyal|"+JSON.stringify(function(){let t=[];for(let e=0;e5?(!function(t,e,n,s,i){for(let r=0;r5?wt(V,"/sgnittes|"+JSON.stringify(D)):window.alert("Ошибка"),mt(),wt(V,"/mqtt|")}function mt(){n(11,b=[]),Z.clear(),n(12,$=[]),tt.clear(),n(13,A=[]),et.clear(),n(15,_=[]),st=[],n(14,M=""),nt.clear(),n(16,D={}),n(17,j={}),n(4,h=!1),n(5,f=!1),n(6,g=!1),n(7,m=!1),n(8,v=!1),vt(),console.log("[i]","all app data cleared")}function vt(){w=!1,O=!1,P=!1,E=!1,J=!1,z=!1,W=!1,N=!1,function(){for(let t=0;t{!function(t){let e=!1;return R.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(lt(t.ws),ut(t.ws)):wt(t.ws,"/tst|")})),U=!1)}function wt(t,e){B[t]&&1===B[t].readyState?(B[t].send(e),console.log("[i]",ct(t),t,"msg send success",e)):console.log("[e]",ct(t),t,"msg not send",e)}function $t(t){R.forEach((e=>{e.status&&wt(e.ws,t)}))}function kt(){_.sort((function(t,e){return t.descre.descr?1:0})),n(3,p=[]);Array.from(new Set(Array.from(_,(({page:t})=>t)))).forEach((function(t,e,s){n(3,p=[...p,JSON.parse(JSON.stringify({page:t}))])})),p.sort((function(t,e){return t.pagee.page?1:0}))}bt.subscribe(it),S((async()=>{console.log("[i]","mounted"),At(),l=!0,ot(),xt(),kt()}));const Ot=t=>{X.length>=100&&X.shift(),n(23,X=[...X,{msg:t}]),X.sort((function(t,e){return t.time>e.time?-1:t.timeLt(),function(){i=this.checked,n(0,i)},()=>Mt(),(t,e,n)=>yt(t,e,n),()=>pt(),()=>ft(),()=>St(),()=>St(),()=>Ct(),()=>ht(),()=>gt(),()=>Pt(),t=>$t(t),()=>ht(),()=>ft(),t=>_t(t),()=>Dt(),function(t){d=t,n(10,d)}]}return new class extends rt{constructor(t){super(),it(this,t,ys,hs,r,{},null,[-1,-1,-1,-1])}}({target:document.body,props:{name:"world"}})}();
//# sourceMappingURL=bundle.js.map
diff --git a/data_svelte/index.html b/data_svelte/index.html
index a8364bae..276db147 100644
--- a/data_svelte/index.html
+++ b/data_svelte/index.html
@@ -4,7 +4,7 @@
- IoT Manager 4.2.5
+ IoT Manager 4.2.6
diff --git a/include/WsServer.h b/include/WsServer.h
index 52efdfec..2504f86f 100644
--- a/include/WsServer.h
+++ b/include/WsServer.h
@@ -15,7 +15,7 @@ extern void hexdump(const void* mem, uint32_t len, uint8_t cols);
void sendFileToWs(const char* filename, uint8_t num, size_t frameSize);
void publishStatusWs(const String& topic, const String& data);
-void publishChartWs(String& json);
+void publishChartWs(int num, String& json);
void periodicWsSend();
void sendStringToWs(const String& msg, uint8_t num, String name);
diff --git a/include/classes/IoTItem.h b/include/classes/IoTItem.h
index 6f0549f4..e4215c91 100644
--- a/include/classes/IoTItem.h
+++ b/include/classes/IoTItem.h
@@ -24,7 +24,8 @@ class IoTItem {
virtual void regEvent(float value, String consoleInfo);
String getSubtype();
- virtual void sendChart(int type);
+ virtual void sendChart();
+ virtual void setPublishType(int type, int num);
virtual void cleanData();
String getID();
diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp
index c5b869c8..7c81a68c 100644
--- a/src/MqttClient.cpp
+++ b/src/MqttClient.cpp
@@ -137,7 +137,8 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
//отправка данных графиков
for (std::list::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getSubtype() == "Loging") {
- (*it)->sendChart(1);
+ (*it)->setPublishType(1, -1);
+ (*it)->sendChart();
}
}
diff --git a/src/WsServer.cpp b/src/WsServer.cpp
index 4ec7b2f8..04953e57 100644
--- a/src/WsServer.cpp
+++ b/src/WsServer.cpp
@@ -59,10 +59,11 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
sendFileToWs("/layout.json", num, 1024);
String json = getParamsJson();
standWebSocket.sendTXT(num, json);
- //отправка данных графиков (нехватает передачи номера сокетов)
+ //отправка данных графиков только в выбранный сокет
for (std::list::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
if ((*it)->getSubtype() == "Loging") {
- (*it)->sendChart(2);
+ (*it)->setPublishType(2, num);
+ (*it)->sendChart();
}
}
}
@@ -240,7 +241,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
}
}
-//публикация статус сообщений
+//публикация статус сообщений (недостаток в том что делаем бродкаст всем клиентам поднятым в свелте!!!)
void publishStatusWs(const String& topic, const String& data) {
String path = mqttRootDevice + "/" + topic;
String json = "{}";
@@ -249,9 +250,15 @@ void publishStatusWs(const String& topic, const String& data) {
standWebSocket.broadcastTXT(json);
}
-//публикация статус сообщений уже готовых
-void publishChartWs(String& data) {
- standWebSocket.broadcastTXT(data);
+//публикация статус сообщений
+void publishChartWs(int num, String& data) {
+ if (num == -1) {
+ Serial.println("broadcastTXT");
+ standWebSocket.broadcastTXT(data);
+ } else {
+ Serial.println("sendTXT");
+ standWebSocket.sendTXT(num, data);
+ }
}
//данные которые мы отправляем в сокеты переодически
diff --git a/src/classes/IoTItem.cpp b/src/classes/IoTItem.cpp
index e23a5f3f..9dc5fce8 100644
--- a/src/classes/IoTItem.cpp
+++ b/src/classes/IoTItem.cpp
@@ -128,7 +128,9 @@ String IoTItem::getSubtype() {
return _subtype;
}
-void IoTItem::sendChart(int type) {}
+void IoTItem::sendChart() {}
+
+void IoTItem::setPublishType(int publishType, int wsNum){};
void IoTItem::cleanData() {}
diff --git a/src/modules/virtual/Logging/Loging.cpp b/src/modules/virtual/Logging/Loging.cpp
index 1bd579a3..f84c2dca 100644
--- a/src/modules/virtual/Logging/Loging.cpp
+++ b/src/modules/virtual/Logging/Loging.cpp
@@ -11,6 +11,9 @@ class Loging : public IoTItem {
String id;
String filesList = "";
+ int _publishType = -2;
+ int _wsNum = -1;
+
int points;
int keepdays;
@@ -137,7 +140,7 @@ class Loging : public IoTItem {
#endif
}
- void sendChart(int type) {
+ void sendChart() {
getFilesList();
int f = 0;
@@ -160,7 +163,7 @@ class Loging : public IoTItem {
unsigned long reqUnixTime = strDateToUnix(getItemValue(id + "-date"));
if (fileUnixTimeLocal > reqUnixTime && fileUnixTimeLocal < reqUnixTime + 86400) {
noData = false;
- createJson(buf, i, type);
+ createJson(buf, i);
SerialPrint("i", F("Loging"), String(f) + ")" + buf + ", " + String(i) + ", " + getDateTimeDotFormatedFromUnix(fileUnixTimeLocal) + ", sent");
} else {
SerialPrint("i", F("Loging"), String(f) + ")" + buf + ", " + String(i) + ", " + getDateTimeDotFormatedFromUnix(fileUnixTimeLocal) + ", skipped");
@@ -173,7 +176,7 @@ class Loging : public IoTItem {
if (noData) {
SerialPrint("i", F("Loging"), "clear chart");
String cleanJson = createEmtyJson();
- publishJson(cleanJson, type);
+ publishJson(cleanJson);
}
}
@@ -191,7 +194,7 @@ class Loging : public IoTItem {
}
}
- void createJson(String file, int &i, int type) {
+ void createJson(String file, int &i) {
File configFile = FileFS.open(file, "r");
if (!configFile) {
SerialPrint("E", F("Loging"), "'" + id + "' open file error");
@@ -223,17 +226,26 @@ class Loging : public IoTItem {
oneSingleJson = "{\"maxCount\":" + String(calculateMaxCount()) + ",\"topic\":\"" + topic + "\",\"status\":[" + oneSingleJson + "]}";
oneSingleJson.replace("},]}", "}]}");
- publishJson(oneSingleJson, type);
+ publishJson(oneSingleJson);
}
- void publishJson(String &oneSingleJson, int type) {
- if (type == 1) {
+ // publishType 1 - в mqtt, 2 - в ws, 3 - mqtt и ws
+ // wsNum = -1 => broadcast
+ void setPublishType(int publishType, int wsNum) {
+ _publishType = publishType;
+ _wsNum = wsNum;
+ }
+
+ void publishJson(String &oneSingleJson) {
+ if (_publishType == 1) {
publishChartMqtt(id, oneSingleJson);
- } else if (type == 2) {
- publishChartWs(oneSingleJson);
- } else if (type == 3) {
+ } else if (_publishType == 2) {
+ publishChartWs(_wsNum, oneSingleJson);
+ } else if (_publishType == 3) {
publishChartMqtt(id, oneSingleJson);
- publishChartWs(oneSingleJson);
+ publishChartWs(_wsNum, oneSingleJson);
+ } else {
+ SerialPrint("E", F("Loging"), "wrong publishType");
}
}
@@ -256,7 +268,7 @@ class Loging : public IoTItem {
generateEvent(_id, value);
publishStatusMqtt(_id, value);
String json = createSingleJson(_id, value);
- publishChartWs(json);
+ publishChartWs(-1, json);
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
}
@@ -308,7 +320,8 @@ class Date : public IoTItem {
if ((*it)->getSubtype() == "Loging") {
//отправляем только свои данные
if ((*it)->getID() == selectToMarker(id, "-")) {
- (*it)->sendChart(3);
+ (*it)->setPublishType(3, -1);
+ (*it)->sendChart();
}
}
}