mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
3 lines
135 KiB
JavaScript
3 lines
135 KiB
JavaScript
var app=function(){"use strict";function t(){}function e(t){return t()}function n(){return Object.create(null)}function i(t){t.forEach(e)}function s(t){return"function"==typeof t}function a(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function r(e,n,i){e.$$.on_destroy.push(function(e,...n){if(null==e)return t;const i=e.subscribe(...n);return i.unsubscribe?()=>i.unsubscribe():i}(n,i))}function o(t,e,n,i){if(t){const s=l(t,e,n,i);return t[0](s)}}function l(t,e,n,i){return t[1]&&i?function(t,e){for(const n in e)t[n]=e[n];return t}(n.ctx.slice(),t[1](i(e))):n.ctx}function c(t,e,n,i){if(t[2]&&i){const s=t[2](i(n));if(void 0===e.dirty)return s;if("object"==typeof s){const t=[],n=Math.max(e.dirty.length,s.length);for(let i=0;i<n;i+=1)t[i]=e.dirty[i]|s[i];return t}return e.dirty|s}return e.dirty}function u(t,e,n,i,s,a){if(s){const r=l(e,n,i,a);t.p(r,s)}}function d(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let t=0;t<n;t++)e[t]=-1;return e}return-1}function h(t,e){t.appendChild(e)}function p(t,e,n){t.insertBefore(e,n||null)}function f(t){t.parentNode.removeChild(t)}function g(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function m(t){return document.createElement(t)}function v(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function y(t){return document.createTextNode(t)}function b(){return y(" ")}function x(){return y("")}function w(t,e,n,i){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n,i)}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 P(t,e){for(let n=0;n<t.options.length;n+=1){const i=t.options[n];if(i.__value===e)return void(i.selected=!0)}t.selectedIndex=-1}function S(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}let T;function M(t){T=t}function L(){if(!T)throw new Error("Function called outside component initialization");return T}function C(t){L().$$.on_mount.push(t)}function _(t){return L().$$.context.get(t)}function N(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t.call(this,e)))}const D=[],E=[],z=[],H=[],j=Promise.resolve();let J=!1;function F(){J||(J=!0,j.then(q))}function W(){return F(),j}function R(t){z.push(t)}function I(t){H.push(t)}const B=new Set;let Y=0;function q(){const t=T;do{for(;Y<D.length;){const t=D[Y];Y++,M(t),U(t.$$)}for(M(null),D.length=0,Y=0;E.length;)E.pop()();for(let t=0;t<z.length;t+=1){const e=z[t];B.has(e)||(B.add(e),e())}z.length=0}while(D.length);for(;H.length;)H.pop()();J=!1,B.clear(),M(t)}function U(t){if(null!==t.fragment){t.update(),i(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(R)}}const V=new Set;let G;function X(){G={r:0,c:[],p:G}}function K(){G.r||i(G.c),G=G.p}function Z(t,e){t&&t.i&&(V.delete(t),t.i(e))}function Q(t,e,n,i){if(t&&t.o){if(V.has(t))return;V.add(t),G.c.push((()=>{V.delete(t),i&&(n&&t.d(1),i())})),t.o(e)}}function tt(t,e,n){const i=t.$$.props[e];void 0!==i&&(t.$$.bound[i]=n,n(t.$$.ctx[i]))}function et(t){t&&t.c()}function nt(t,n,a,r){const{fragment:o,on_mount:l,on_destroy:c,after_update:u}=t.$$;o&&o.m(n,a),r||R((()=>{const n=l.map(e).filter(s);c?c.push(...n):i(n),t.$$.on_mount=[]})),u.forEach(R)}function it(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function st(e,s,a,r,o,l,c,u=[-1]){const d=T;M(e);const h=e.$$={fragment:null,ctx:null,props:l,update:t,not_equal:o,bound:n(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s.context||(d?d.$$.context:[])),callbacks:n(),dirty:u,skip_bound:!1,root:s.target||d.$$.root};c&&c(h.root);let p=!1;if(h.ctx=a?a(e,s.props||{},((t,n,...i)=>{const s=i.length?i[0]:n;return h.ctx&&o(h.ctx[t],h.ctx[t]=s)&&(!h.skip_bound&&h.bound[t]&&h.bound[t](s),p&&function(t,e){-1===t.$$.dirty[0]&&(D.push(t),F(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}(e,t)),n})):[],h.update(),p=!0,i(h.before_update),h.fragment=!!r&&r(h.ctx),s.target){if(s.hydrate){const t=function(t){return Array.from(t.childNodes)}(s.target);h.fragment&&h.fragment.l(t),t.forEach(f)}else h.fragment&&h.fragment.c();s.intro&&Z(e.$$.fragment),nt(e,s.target,s.anchor,s.customElement),q()}M(d)}class at{$destroy(){it(this,1),this.$destroy=t}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const rt=[];function ot(e,n=t){let i;const s=new Set;function r(t){if(a(e,t)&&(e=t,i)){const t=!rt.length;for(const t of s)t[1](),rt.push(t,e);if(t){for(let t=0;t<rt.length;t+=2)rt[t][0](rt[t+1]);rt.length=0}}}return{set:r,update:function(t){r(t(e))},subscribe:function(a,o=t){const l=[a,o];return s.add(l),1===s.size&&(i=n(r)||t),a(e),()=>{s.delete(l),0===s.size&&(i(),i=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 i=t=>t.split("/").filter((t=>""!==t)),s=i(t);return"/"+(e?i(e):[]).map(((t,e)=>s[e])).join("/")+"/"+n}function ut(t,e,n,i){let s=[e,"data-"+e].reduce(((e,i)=>{let s=t.getAttribute(i);return n&&t.removeAttribute(i),null===s?e:s}),!1);return!i&&""===s||(s||i||!1)}function dt(t){let e=t.split("&").map((t=>t.split("="))).reduce(((t,e)=>{let n=e[0];if(!n)return t;let i=!(e.length>1)||e[e.length-1];return"string"==typeof i&&i.includes(",")&&(i=i.split(",")),void 0===t[n]?t[n]=[i]:t[n].push(i),t}),{});return Object.entries(e).reduce(((t,e)=>(t[e[0]]=e[1].length>1?e[1]:e[1][0],t)),{})}var ht,pt,ft={HISTORY:1,HASH:2,MEMORY:3,OFF:4,run:function(t,e,n,i){return 1===t?e&&e():2===t?n&&n():i&&i()},getDeafault:function(){return window&&"srcdoc"!==window.location.pathname?1:3}},gt=function(){let t,e=ft.getDeafault(),n=n=>t&&t(mt(e));function i(t){t&&(e=t),window.onhashchange=window.onpopstate=pt=null,e!==ft.OFF&&ft.run(e,(t=>window.onpopstate=n),(t=>window.onhashchange=n))&&n()}return{mode:t=>i(t),get:t=>mt(e),go(t,i){(function(t,e,n){let i=t=>history[n?"replaceState":"pushState"]({},"",t);ft.run(t,(t=>i(e)),(t=>i(`#${e}`)),(t=>pt=e))})(e,t,i),n()},start(e){t=e,i()},stop(){t=null,i(ft.OFF)}}}();function mt(t){let e=ht,n=ht=ft.run(t,(t=>window.location.pathname+window.location.search),(t=>String(window.location.hash.slice(1)||"/")),(t=>pt||"/")),i=n.match(/^([^?#]+)(?:\?([^#]+))?(?:\#(.+))?$/);return{url:n,from:e,path:i[1]||"",query:dt(i[2]||""),hash:i[3]||""}}function vt(t){let e=_("tinro");e&&(e.exact||e.fallback)&&function(t){throw new Error("[Tinro] "+t)}(`${t.fallback?"<Route fallback>":`<Route path="${t.path}">`} can't be inside ${e.fallback?"<Route fallback>":`<Route path="${e.path||"/"}"> with exact path`}`);let n=t.fallback?"fallbacks":"childs",i=ot({}),s={router:{},exact:!1,pattern:null,meta:{},parent:e,fallback:t.fallback,redirect:!1,firstmatch:!1,breadcrumb:null,matched:!1,childs:new Set,activeChilds:new Set,fallbacks:new Set,update(t){s.exact=!t.path.endsWith("/*"),s.pattern=lt(`${s.parent&&s.parent.pattern||""}${t.path}`),s.redirect=t.redirect,s.firstmatch=t.firstmatch,s.breadcrumb=t.breadcrumb,s.match()},register:()=>{if(s.parent)return s.parent[n].add(s),()=>{s.parent[n].delete(s),s.router.un&&s.router.un()}},show:()=>{t.onShow(),!s.fallback&&s.parent&&s.parent.activeChilds.add(s)},hide:()=>{t.onHide(),!s.fallback&&s.parent&&s.parent.activeChilds.delete(s)},match:async()=>{s.matched=!1;let{path:e,url:n,from:a,query:r}=s.router,o=function(t,e){t=lt(t,!0),e=lt(e,!0);let n=[],i={},s=!0,a=t.split("/").map((t=>t.startsWith(":")?(n.push(t.slice(1)),"([^\\/]+)"):t)).join("\\/"),r=e.match(new RegExp(`^${a}$`));return r||(s=!1,r=e.match(new RegExp(`^${a}`))),r?(n.forEach(((t,e)=>i[t]=r[e+1])),{exact:s,params:i,part:r[0].slice(0,-1)}):null}(s.pattern,e);if(!s.fallback&&o&&s.redirect&&(!s.exact||s.exact&&o.exact)){await W();let t=ct(e,s.parent&&s.parent.pattern,s.redirect);return bt.goto(t,!0)}if(s.meta=o&&{from:a,url:n,query:r,match:o.part,pattern:s.pattern,breadcrumbs:s.parent&&s.parent.meta&&s.parent.meta.breadcrumbs.slice()||[],params:o.params,subscribe:i.subscribe},s.breadcrumb&&s.meta&&s.meta.breadcrumbs.push({name:s.breadcrumb,path:o.part}),i.set(s.meta),!o||s.fallback||!(!s.exact||s.exact&&o.exact)||s.parent&&s.parent.firstmatch&&s.parent.matched?s.hide():(t.onMeta(s.meta),s.parent&&(s.parent.matched=!0),s.show()),await W(),o&&!s.fallback&&(s.childs.size>0&&0==s.activeChilds.size||0==s.childs.size&&s.fallbacks.size>0)){let t=s;for(;0==t.fallbacks.size;)if(t=t.parent,!t)return;t&&t.fallbacks.forEach((t=>{if(t.redirect){let e=ct("/",t.parent&&t.parent.pattern,t.redirect);bt.goto(e,!0)}else t.show()}))}}};return a="tinro",r=s,L().$$.context.set(a,r),C((()=>s.register())),s.router.un=bt.subscribe((t=>{s.router.path=t.path,s.router.url=t.url,s.router.query=t.query,s.router.from=t.from,null!==s.pattern&&s.match()})),s;var a,r}function yt(){return _("tinro").meta}var bt=function(){let{subscribe:t}=ot(gt.get(),(t=>{gt.start(t);let e=function(t){let e=e=>{let n=e.target.closest("a[href]"),i=n&&ut(n,"target",!1,"_self"),s=n&&ut(n,"tinro-ignore"),a=e.ctrlKey||e.metaKey||e.altKey||e.shiftKey;if("_self"==i&&!s&&!a&&n){let i=n.getAttribute("href").replace(/^\/#/,"");/^\/\/|^[a-zA-Z]+:/.test(i)||(e.preventDefault(),t(i.startsWith("/")?i: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 _("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,i=o(n,t,t[8],$t);return{c(){i&&i.c()},m(t,n){i&&i.m(t,n),e=!0},p(t,s){i&&i.p&&(!e||262&s)&&u(i,n,t,t[8],e?c(n,t[8],s,wt):d(t[8]),$t)},i(t){e||(Z(i,t),e=!0)},o(t){Q(i,t),e=!1},d(t){i&&i.d(t)}}}function Ot(t){let e,n,i=t[0]&&kt(t);return{c(){i&&i.c(),e=x()},m(t,s){i&&i.m(t,s),p(t,e,s),n=!0},p(t,[n]){t[0]?i?(i.p(t,n),1&n&&Z(i,1)):(i=kt(t),i.c(),Z(i,1),i.m(e.parentNode,e)):i&&(X(),Q(i,1,1,(()=>{i=null})),K())},i(t){n||(Z(i),n=!0)},o(t){Q(i),n=!1},d(t){i&&i.d(t),t&&f(e)}}}function At(t,e,n){let{$$slots:i={},$$scope:s}=e,{path:a="/*"}=e,{fallback:r=!1}=e,{redirect:o=!1}=e,{firstmatch:l=!1}=e,{breadcrumb:c=null}=e,u=!1,d={},h={};const p=vt({fallback:r,onShow(){n(0,u=!0)},onHide(){n(0,u=!1)},onMeta(t){n(2,h=t),n(1,d=h.params)}});return t.$$set=t=>{"path"in t&&n(3,a=t.path),"fallback"in t&&n(4,r=t.fallback),"redirect"in t&&n(5,o=t.redirect),"firstmatch"in t&&n(6,l=t.firstmatch),"breadcrumb"in t&&n(7,c=t.breadcrumb),"$$scope"in t&&n(8,s=t.$$scope)},t.$$.update=()=>{232&t.$$.dirty&&p.update({path:a,redirect:o,firstmatch:l,breadcrumb:c})},[u,d,h,a,r,o,l,c,s,i]}class Pt extends at{constructor(t){super(),st(this,t,At,Ot,a,{path:3,fallback:4,redirect:5,firstmatch:6,breadcrumb:7})}}function St(t){let e,n;return{c(){e=m("h1"),n=y(t[0]),$(e,"class","alm-hdr")},m(t,i){p(t,e,i),h(e,n)},p(t,e){1&e&&O(n,t[0])},d(t){t&&f(e)}}}function Tt(t){let e,n,i,s=t[0]&&St(t);const a=t[2].default,r=o(a,t,t[1],null);return{c(){e=m("div"),s&&s.c(),n=b(),r&&r.c(),$(e,"class","alm")},m(t,a){p(t,e,a),s&&s.m(e,null),h(e,n),r&&r.m(e,null),i=!0},p(t,[o]){t[0]?s?s.p(t,o):(s=St(t),s.c(),s.m(e,n)):s&&(s.d(1),s=null),r&&r.p&&(!i||2&o)&&u(r,a,t,t[1],i?c(a,t[1],o,null):d(t[1]),null)},i(t){i||(Z(r,t),i=!0)},o(t){Q(r,t),i=!1},d(t){t&&f(e),s&&s.d(),r&&r.d(t)}}}function Mt(t,e,n){let{$$slots:i={},$$scope:s}=e,{title:a}=e;return t.$$set=t=>{"title"in t&&n(0,a=t.title),"$$scope"in t&&n(1,s=t.$$scope)},[a,s,i]}class Lt extends at{constructor(t){super(),st(this,t,Mt,Tt,a,{title:0})}}function Ct(t){let e,n,i,s,a,r,o,l,c,u,d,g,v,x,k,A,P,S,T,M,L,C,_;return{c(){e=m("div"),n=m("div"),i=m("div"),s=b(),a=m("span"),a.textContent="",r=b(),o=m("div"),l=m("div"),c=m("div"),u=m("div"),d=m("h3"),g=y(t[1]),v=b(),x=m("div"),k=m("p"),A=y(t[2]),P=b(),S=m("div"),T=m("button"),T.textContent="Deactivate",M=b(),L=m("button"),L.textContent="Cancel",$(i,"class","fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"),$(i,"aria-hidden","true"),$(a,"class","hidden sm:inline-block sm:align-middle sm:h-screen"),$(a,"aria-hidden","true"),$(d,"class","text-lg leading-6 font-medium text-gray-900"),$(d,"id","modal-title"),$(k,"class","text-sm text-gray-500"),$(x,"class","mt-2"),$(u,"class","mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"),$(c,"class","sm:flex sm:items-start"),$(l,"class","bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"),$(T,"type","button"),$(T,"class","w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm"),$(L,"type","button"),$(L,"class","mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"),$(S,"class","bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse"),$(o,"class","inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"),$(n,"class","flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"),$(e,"class","fixed z-10 inset-0 overflow-y-auto"),$(e,"aria-labelledby","modal-title"),$(e,"role","dialog"),$(e,"aria-modal","true")},m(f,m){p(f,e,m),h(e,n),h(n,i),h(n,s),h(n,a),h(n,r),h(n,o),h(o,l),h(l,c),h(c,u),h(u,d),h(d,g),h(u,v),h(u,x),h(x,k),h(k,A),h(o,P),h(o,S),h(S,T),h(S,M),h(S,L),C||(_=w(L,"click",t[3]),C=!0)},p(t,e){2&e&&O(g,t[1]),4&e&&O(A,t[2])},d(t){t&&f(e),C=!1,_()}}}function _t(e){let n,i=e[0]&&Ct(e);return{c(){n=m("div"),i&&i.c(),$(n,"class","modal")},m(t,e){p(t,n,e),i&&i.m(n,null)},p(t,[e]){t[0]?i?i.p(t,e):(i=Ct(t),i.c(),i.m(n,null)):i&&(i.d(1),i=null)},i:t,o:t,d(t){t&&f(n),i&&i.d()}}}function Nt(t,e,n){let{show:i}=e,{header:s="header"}=e,{text:a="text"}=e;return t.$$set=t=>{"show"in t&&n(0,i=t.show),"header"in t&&n(1,s=t.header),"text"in t&&n(2,a=t.text)},[i,s,a,()=>n(0,i=!1)]}class Dt extends at{constructor(t){super(),st(this,t,Nt,_t,a,{show:0,header:1,text:2})}}function Et(t){let e,n;return{c(){e=m("h1"),n=y(t[0]),$(e,"class","crd-hdr")},m(t,i){p(t,e,i),h(e,n)},p(t,e){1&e&&O(n,t[0])},d(t){t&&f(e)}}}function zt(t){let e,n,i,s=t[0]&&Et(t);const a=t[2].default,r=o(a,t,t[1],null);return{c(){e=m("div"),s&&s.c(),n=b(),r&&r.c(),$(e,"class","crd")},m(t,a){p(t,e,a),s&&s.m(e,null),h(e,n),r&&r.m(e,null),i=!0},p(t,[o]){t[0]?s?s.p(t,o):(s=Et(t),s.c(),s.m(e,n)):s&&(s.d(1),s=null),r&&r.p&&(!i||2&o)&&u(r,a,t,t[1],i?c(a,t[1],o,null):d(t[1]),null)},i(t){i||(Z(r,t),i=!0)},o(t){Q(r,t),i=!1},d(t){t&&f(e),s&&s.d(),r&&r.d(t)}}}function Ht(t,e,n){let{$$slots:i={},$$scope:s}=e,{title:a}=e;return t.$$set=t=>{"title"in t&&n(0,a=t.title),"$$scope"in t&&n(1,s=t.$$scope)},[a,s,i]}class jt extends at{constructor(t){super(),st(this,t,Ht,zt,a,{title:0})}}function Jt(t){let e,n,s,a;return{c(){e=m("input"),$(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"step","0.1"),$(e,"type","number")},m(n,i){p(n,e,i),A(e,t[0].status),s||(a=[w(e,"change",t[3]),w(e,"input",t[4])],s=!0)},p(t,i){1&i&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&i&&k(e.value)!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),s=!1,i(a)}}}function Ft(t){let e,n,s,a;return{c(){e=m("input"),$(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","text")},m(n,i){p(n,e,i),A(e,t[0].status),s||(a=[w(e,"change",t[5]),w(e,"input",t[6])],s=!0)},p(t,i){1&i&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&i&&e.value!==t[0].status&&A(e,t[0].status)},d(t){t&&f(e),s=!1,i(a)}}}function Wt(t){let e,n,s,a;return{c(){e=m("input"),$(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","date")},m(n,i){p(n,e,i),A(e,t[0].status),s||(a=[w(e,"change",t[7]),w(e,"input",t[8])],s=!0)},p(t,i){1&i&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&i&&A(e,t[0].status)},d(t){t&&f(e),s=!1,i(a)}}}function Rt(t){let e,n,s,a;return{c(){e=m("input"),$(e,"class",n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500"),$(e,"type","time")},m(n,i){p(n,e,i),A(e,t[0].status),s||(a=[w(e,"change",t[9]),w(e,"input",t[10])],s=!0)},p(t,i){1&i&&n!==(n=1==t[0].send?"ipt-rnd text-right border-red-500":"ipt-rnd text-right focus:border-indigo-500")&&$(e,"class",n),1&i&&A(e,t[0].status)},d(t){t&&f(e),s=!1,i(a)}}}function It(e){let n,i,s,a,r,o,l,c,u,d=(e[0].descr?e[0].descr:"")+"",g="number"==e[0].type&&Jt(e),v="text"==e[0].type&&Ft(e),x="date"==e[0].type&&Wt(e),w="time"==e[0].type&&Rt(e);return{c(){n=m("div"),i=m("div"),s=m("label"),a=y(d),r=b(),o=m("div"),g&&g.c(),l=b(),v&&v.c(),c=b(),x&&x.c(),u=b(),w&&w.c(),$(s,"class","wgt-dscr-stl"),$(i,"class","wgt-dscr-w"),$(o,"class","wgt-w"),$(n,"class","crd-itm-psn")},m(t,e){p(t,n,e),h(n,i),h(i,s),h(s,a),h(n,r),h(n,o),g&&g.m(o,null),h(o,l),v&&v.m(o,null),h(o,c),x&&x.m(o,null),h(o,u),w&&w.m(o,null)},p(t,[e]){1&e&&d!==(d=(t[0].descr?t[0].descr:"")+"")&&O(a,d),"number"==t[0].type?g?g.p(t,e):(g=Jt(t),g.c(),g.m(o,l)):g&&(g.d(1),g=null),"text"==t[0].type?v?v.p(t,e):(v=Ft(t),v.c(),v.m(o,c)):v&&(v.d(1),v=null),"date"==t[0].type?x?x.p(t,e):(x=Wt(t),x.c(),x.m(o,u)):x&&(x.d(1),x=null),"time"==t[0].type?w?w.p(t,e):(w=Rt(t),w.c(),w.m(o,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 Bt(t,e,n){let{widget:i}=e,{wsPush:s=((t,e,n)=>{})}=e,{value:a}=e;a=a;return t.$$set=t=>{"widget"in t&&n(0,i=t.widget),"wsPush"in t&&n(1,s=t.wsPush),"value"in t&&n(2,a=t.value)},[i,s,a,()=>(n(0,i.send=!0,i),s(i.ws,i.topic,i.status)),function(){i.status=k(this.value),n(0,i)},()=>(n(0,i.send=!0,i),s(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)},()=>(n(0,i.send=!0,i),s(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)},()=>(n(0,i.send=!0,i),s(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)}]}class Yt extends at{constructor(t){super(),st(this,t,Bt,It,a,{widget:0,wsPush:1,value:2})}}function qt(e){let n,s,a,r,o,l,c,u,d,g,v,x,k,P,S,T,M,L,C=(e[0].descr?e[0].descr:"")+"";return{c(){n=m("div"),s=m("div"),a=m("label"),r=y(C),o=b(),l=m("div"),c=m("label"),u=m("div"),d=m("input"),v=b(),x=m("div"),k=b(),P=m("div"),$(a,"class","wgt-dscr-stl"),$(s,"class","wgt-dscr-w"),$(d,"id",g=e[0].topic),$(d,"type","checkbox"),$(d,"class","sr-only"),$(x,"class","block bg-gray-600 w-10 h-6 rounded-full"),$(P,"class",S="dot "+(1==e[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition"),$(u,"class","relative"),$(c,"for",T=e[0].topic),$(c,"class","items-center cursor-pointer"),$(l,"class","wgt-w"),$(n,"class","crd-itm-psn")},m(t,i){p(t,n,i),h(n,s),h(s,a),h(a,r),h(n,o),h(n,l),h(l,c),h(c,u),h(u,d),A(d,e[0].status),h(u,v),h(u,x),h(u,k),h(u,P),M||(L=[w(d,"change",e[3]),w(d,"change",e[4])],M=!0)},p(t,[e]){1&e&&C!==(C=(t[0].descr?t[0].descr:"")+"")&&O(r,C),1&e&&g!==(g=t[0].topic)&&$(d,"id",g),1&e&&A(d,t[0].status),1&e&&S!==(S="dot "+(1==t[0].send?"bg-red-400":"bg-white")+" absolute left-1 top-1 w-4 h-4 rounded-full transition")&&$(P,"class",S),1&e&&T!==(T=t[0].topic)&&$(c,"for",T)},i:t,o:t,d(t){t&&f(n),M=!1,i(L)}}}function Ut(t,e,n){let{widget:i}=e,{value:s}=e;s=s;let{wsPush:a=((t,e,n)=>{})}=e;return t.$$set=t=>{"widget"in t&&n(0,i=t.widget),"value"in t&&n(2,s=t.value),"wsPush"in t&&n(1,a=t.wsPush)},[i,a,s,()=>(n(0,i.send=!0,i),a(i.ws,i.topic,i.status)),function(){i.status=this.value,n(0,i)}]}class Vt extends at{constructor(t){super(),st(this,t,Ut,qt,a,{widget:0,value:2,wsPush:1})}}function Gt(e){let n,i,s,a,r,o,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"),i=m("div"),s=m("label"),a=y(x),r=b(),o=m("div"),l=m("label"),c=y(w),u=b(),d=m("label"),g=y(" "),v=y(k),$(s,"class","wgt-dscr-stl"),$(i,"class","wgt-dscr-w"),$(l,"class","wgt-adt-stl"),$(d,"class","wgt-adt-stl"),$(o,"class","wgt-w"),$(n,"class","crd-itm-psn")},m(t,e){p(t,n,e),h(n,i),h(i,s),h(s,a),h(n,r),h(n,o),h(o,l),h(l,c),h(o,u),h(o,d),h(d,g),h(d,v)},p(t,[e]){1&e&&x!==(x=(t[0].descr?t[0].descr:"")+"")&&O(a,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 Xt(t,e,n){let{widget:i}=e,{value:s}=e;return s=s,t.$$set=t=>{"widget"in t&&n(0,i=t.widget),"value"in t&&n(1,s=t.value)},[i,s]}class Kt extends at{constructor(t){super(),st(this,t,Xt,Gt,a,{widget:0,value:1})}}function Zt(t,e,n){const i=t.slice();return i[8]=e[n],i[10]=n,i}function Qt(t,e,n){const i=t.slice();return i[11]=e[n],i[12]=e,i[10]=n,i}function te(t){let e,n;return e=new jt({props:{title:"Ваша панель управления пуста, вначале добавьте новые элементы в конфигураторе!"}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function ee(t){let e,n,i,s,a="input"===t[11].widget&&ne(t),r="toggle"===t[11].widget&&ie(t),o="anydata"===t[11].widget&&se(t);return{c(){a&&a.c(),e=b(),r&&r.c(),n=b(),o&&o.c(),i=x()},m(t,l){a&&a.m(t,l),p(t,e,l),r&&r.m(t,l),p(t,n,l),o&&o.m(t,l),p(t,i,l),s=!0},p(t,s){"input"===t[11].widget?a?(a.p(t,s),1&s&&Z(a,1)):(a=ne(t),a.c(),Z(a,1),a.m(e.parentNode,e)):a&&(X(),Q(a,1,1,(()=>{a=null})),K()),"toggle"===t[11].widget?r?(r.p(t,s),1&s&&Z(r,1)):(r=ie(t),r.c(),Z(r,1),r.m(n.parentNode,n)):r&&(X(),Q(r,1,1,(()=>{r=null})),K()),"anydata"===t[11].widget?o?(o.p(t,s),1&s&&Z(o,1)):(o=se(t),o.c(),Z(o,1),o.m(i.parentNode,i)):o&&(X(),Q(o,1,1,(()=>{o=null})),K())},i(t){s||(Z(a),Z(r),Z(o),s=!0)},o(t){Q(a),Q(r),Q(o),s=!1},d(t){a&&a.d(t),t&&f(e),r&&r.d(t),t&&f(n),o&&o.d(t),t&&f(i)}}}function ne(t){let e,n,i;function s(e){t[4](e,t[11])}let a={widget:t[11],wsPush:t[3]};return void 0!==t[11].status&&(a.value=t[11].status),e=new Yt({props:a}),E.push((()=>tt(e,"value",s))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),i=!0},p(i,s){t=i;const a={};1&s&&(a.widget=t[11]),4&s&&(a.wsPush=t[3]),!n&&1&s&&(n=!0,a.value=t[11].status,I((()=>n=!1))),e.$set(a)},i(t){i||(Z(e.$$.fragment,t),i=!0)},o(t){Q(e.$$.fragment,t),i=!1},d(t){it(e,t)}}}function ie(t){let e,n,i;function s(e){t[6](e,t[11])}let a={widget:t[11],wsPush:t[5]};return void 0!==t[11].status&&(a.value=t[11].status),e=new Vt({props:a}),E.push((()=>tt(e,"value",s))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),i=!0},p(i,s){t=i;const a={};1&s&&(a.widget=t[11]),4&s&&(a.wsPush=t[5]),!n&&1&s&&(n=!0,a.value=t[11].status,I((()=>n=!1))),e.$set(a)},i(t){i||(Z(e.$$.fragment,t),i=!0)},o(t){Q(e.$$.fragment,t),i=!1},d(t){it(e,t)}}}function se(t){let e,n,i;function s(e){t[7](e,t[11])}let a={widget:t[11]};return void 0!==t[11].status&&(a.value=t[11].status),e=new Kt({props:a}),E.push((()=>tt(e,"value",s))),{c(){et(e.$$.fragment)},m(t,n){nt(e,t,n),i=!0},p(i,s){t=i;const a={};1&s&&(a.widget=t[11]),!n&&1&s&&(n=!0,a.value=t[11].status,I((()=>n=!1))),e.$set(a)},i(t){i||(Z(e.$$.fragment,t),i=!0)},o(t){Q(e.$$.fragment,t),i=!1},d(t){it(e,t)}}}function ae(t){let e,n,i=t[11].page===t[8].page&&ee(t);return{c(){i&&i.c(),e=x()},m(t,s){i&&i.m(t,s),p(t,e,s),n=!0},p(t,n){t[11].page===t[8].page?i?(i.p(t,n),3&n&&Z(i,1)):(i=ee(t),i.c(),Z(i,1),i.m(e.parentNode,e)):i&&(X(),Q(i,1,1,(()=>{i=null})),K())},i(t){n||(Z(i),n=!0)},o(t){Q(i),n=!1},d(t){i&&i.d(t),t&&f(e)}}}function re(t){let e,n,i=t[0],s=[];for(let e=0;e<i.length;e+=1)s[e]=ae(Qt(t,i,e));const a=t=>Q(s[t],1,1,(()=>{s[t]=null}));return{c(){for(let t=0;t<s.length;t+=1)s[t].c();e=b()},m(t,i){for(let e=0;e<s.length;e+=1)s[e].m(t,i);p(t,e,i),n=!0},p(t,n){if(7&n){let r;for(i=t[0],r=0;r<i.length;r+=1){const a=Qt(t,i,r);s[r]?(s[r].p(a,n),Z(s[r],1)):(s[r]=ae(a),s[r].c(),Z(s[r],1),s[r].m(e.parentNode,e))}for(X(),r=i.length;r<s.length;r+=1)a(r);K()}},i(t){if(!n){for(let t=0;t<i.length;t+=1)Z(s[t]);n=!0}},o(t){s=s.filter(Boolean);for(let t=0;t<s.length;t+=1)Q(s[t]);n=!1},d(t){g(s,t),t&&f(e)}}}function oe(t){let e,n;return e=new jt({props:{title:t[8].page,$$slots:{default:[re]},$$scope:{ctx:t}}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};2&n&&(i.title=t[8].page),8199&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function le(t){let e,n,i,s=t[0]===[]&&te(),a=t[1],r=[];for(let e=0;e<a.length;e+=1)r[e]=oe(Zt(t,a,e));const o=t=>Q(r[t],1,1,(()=>{r[t]=null}));return{c(){e=m("div"),s&&s.c(),n=b();for(let t=0;t<r.length;t+=1)r[t].c();$(e,"class","grd-3col1")},m(t,a){p(t,e,a),s&&s.m(e,null),h(e,n);for(let t=0;t<r.length;t+=1)r[t].m(e,null);i=!0},p(t,[i]){if(t[0]===[]?s?1&i&&Z(s,1):(s=te(),s.c(),Z(s,1),s.m(e,n)):s&&(X(),Q(s,1,1,(()=>{s=null})),K()),7&i){let n;for(a=t[1],n=0;n<a.length;n+=1){const s=Zt(t,a,n);r[n]?(r[n].p(s,i),Z(r[n],1)):(r[n]=oe(s),r[n].c(),Z(r[n],1),r[n].m(e,null))}for(X(),n=a.length;n<r.length;n+=1)o(n);K()}},i(t){if(!i){Z(s);for(let t=0;t<a.length;t+=1)Z(r[t]);i=!0}},o(t){Q(s),r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)Q(r[t]);i=!1},d(t){t&&f(e),s&&s.d(),g(r,t)}}}function ce(t,e,n){let{layoutJson:i}=e,{pages:s}=e,{wsPush:a=((t,e,n)=>{})}=e;return t.$$set=t=>{"layoutJson"in t&&n(0,i=t.layoutJson),"pages"in t&&n(1,s=t.pages),"wsPush"in t&&n(2,a=t.wsPush)},[i,s,a,(t,e,n)=>a(t,e,n),function(e,s){t.$$.not_equal(s.status,e)&&(s.status=e,n(0,i))},(t,e,n)=>a(t,e,n),function(e,s){t.$$.not_equal(s.status,e)&&(s.status=e,n(0,i))},function(e,s){t.$$.not_equal(s.status,e)&&(s.status=e,n(0,i))}]}class ue extends at{constructor(t){super(),st(this,t,ce,le,a,{layoutJson:0,pages:1,wsPush:2})}}function de(e){let n,i,a,r,o;return{c(){n=v("svg"),i=v("line"),a=v("line"),$(i,"x1","18"),$(i,"y1","6"),$(i,"x2","6"),$(i,"y2","18"),$(a,"x1","6"),$(a,"y1","6"),$(a,"x2","18"),$(a,"y2","18"),$(n,"class","h-6 w-6 text-red-400 cursor-pointer"),$(n,"viewBox","0 0 24 24"),$(n,"fill","none"),$(n,"stroke","currentColor"),$(n,"stroke-width","2"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,l){p(t,n,l),h(n,i),h(n,a),r||(o=w(n,"click",(function(){s(e[1](e[0]))&&e[1](e[0]).apply(this,arguments)})),r=!0)},p(t,[n]){e=t},i:t,o:t,d(t){t&&f(n),r=!1,o()}}}function he(t,e,n){let{i:i}=e,{click:s=(t=>{})}=e;return t.$$set=t=>{"i"in t&&n(0,i=t.i),"click"in t&&n(1,s=t.click)},[i,s]}class pe extends at{constructor(t){super(),st(this,t,he,de,a,{i:0,click:1})}}function fe(e){let n,i,a,r,o,l,c;return{c(){n=v("svg"),i=v("path"),a=v("circle"),r=v("circle"),o=v("circle"),$(i,"stroke","none"),$(i,"d","M0 0h24v24H0z"),$(a,"cx","5"),$(a,"cy","12"),$(a,"r","1"),$(r,"cx","12"),$(r,"cy","12"),$(r,"r","1"),$(o,"cx","19"),$(o,"cy","12"),$(o,"r","1"),$(n,"class","h-6 w-6 text-green-400 cursor-pointer"),$(n,"width","24"),$(n,"height","24"),$(n,"viewBox","0 0 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,u){p(t,n,u),h(n,i),h(n,a),h(n,r),h(n,o),l||(c=w(n,"click",(function(){s(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 ge(t,e,n){let{click:i=(()=>{})}=e;return t.$$set=t=>{"click"in t&&n(0,i=t.click)},[i]}class me extends at{constructor(t){super(),st(this,t,ge,fe,a,{click:0})}}function ve(t,e,n){const i=t.slice();return i[18]=e[n],i[19]=e,i[20]=n,i}function ye(t,e,n){const i=t.slice();return i[21]=e[n][0],i[22]=e[n][1],i[23]=e,i[24]=n,i}function be(t,e,n){const i=t.slice();return i[25]=e[n],i}function xe(t,e,n){const i=t.slice();return i[28]=e[n],i}function we(t){let e,n;return{c(){e=m("optgroup"),$(e,"label",n=t[28].header)},m(t,n){p(t,e,n)},p(t,i){4&i[0]&&n!==(n=t[28].header)&&$(e,"label",n)},d(t){t&&f(e)}}}function $e(t){let e,n,i,s,a=t[28].name+"";return{c(){e=m("option"),n=y(a),i=b(),e.__value=s=t[28].num,e.value=e.__value},m(t,s){p(t,e,s),h(e,n),h(e,i)},p(t,i){4&i[0]&&a!==(a=t[28].name+"")&&O(n,a),4&i[0]&&s!==(s=t[28].num)&&(e.__value=s,e.value=e.__value)},d(t){t&&f(e)}}}function ke(t){let e,n,i=t[28].header&&we(t),s=!t[28].header&&$e(t);return{c(){i&&i.c(),e=x(),s&&s.c(),n=x()},m(t,a){i&&i.m(t,a),p(t,e,a),s&&s.m(t,a),p(t,n,a)},p(t,a){t[28].header?i?i.p(t,a):(i=we(t),i.c(),i.m(e.parentNode,e)):i&&(i.d(1),i=null),t[28].header?s&&(s.d(1),s=null):s?s.p(t,a):(s=$e(t),s.c(),s.m(n.parentNode,n))},d(t){i&&i.d(t),t&&f(e),s&&s.d(t),t&&f(n)}}}function Oe(t){let e,n,i,s,a=t[25].label+"";return{c(){e=m("option"),n=y(a),i=b(),e.__value=s=t[25].name,e.value=e.__value},m(t,s){p(t,e,s),h(e,n),h(e,i)},p(t,i){2&i[0]&&a!==(a=t[25].label+"")&&O(n,a),2&i[0]&&s!==(s=t[25].name)&&(e.__value=s,e.value=e.__value)},d(t){t&&f(e)}}}function Ae(t){let e,n=Object.entries(t[18]),i=[];for(let e=0;e<n.length;e+=1)i[e]=Se(ye(t,n,e));return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=b()},m(t,n){for(let e=0;e<i.length;e+=1)i[e].m(t,n);p(t,e,n)},p(t,s){if(1&s[0]){let a;for(n=Object.entries(t[18]),a=0;a<n.length;a+=1){const r=ye(t,n,a);i[a]?i[a].p(r,s):(i[a]=Se(r),i[a].c(),i[a].m(e.parentNode,e))}for(;a<i.length;a+=1)i[a].d(1);i.length=n.length}},d(t){g(i,t),t&&f(e)}}}function Pe(t){let e,n,i,s,a,r,o,l,c,u,d,g,v,x,k,P=t[21]+"";function S(){t[16].call(v,t[21],t[19],t[20])}return{c(){e=m("tr"),n=m("td"),i=b(),s=m("td"),a=b(),r=m("td"),o=b(),l=m("td"),c=m("p"),u=y(P),d=b(),g=m("td"),v=m("input"),$(c,"class","txt-ita"),$(l,"class","tbl-bdy-sm text-right"),$(v,"class","ipt-sm w-full"),$(v,"type","text"),$(g,"class","tbl-bdy-sm text-center"),$(e,"class","txt-sz txt-pad")},m(f,m){p(f,e,m),h(e,n),h(e,i),h(e,s),h(e,a),h(e,r),h(e,o),h(e,l),h(l,c),h(c,u),h(e,d),h(e,g),h(g,v),A(v,t[18][t[21]]),x||(k=w(v,"input",S),x=!0)},p(e,n){t=e,1&n[0]&&P!==(P=t[21]+"")&&O(u,P),3&n[0]&&v.value!==t[18][t[21]]&&A(v,t[18][t[21]])},d(t){t&&f(e),x=!1,k()}}}function Se(t){let e,n="type"!=t[21]&&"subtype"!=t[21]&&"id"!=t[21]&&"widget"!=t[21]&&"page"!=t[21]&&"descr"!=t[21]&&Pe(t);return{c(){n&&n.c(),e=x()},m(t,i){n&&n.m(t,i),p(t,e,i)},p(t,i){"type"!=t[21]&&"subtype"!=t[21]&&"id"!=t[21]&&"widget"!=t[21]&&"page"!=t[21]&&"descr"!=t[21]?n?n.p(t,i):(n=Pe(t),n.c(),n.m(e.parentNode,e)):n&&(n.d(1),n=null)},d(t){n&&n.d(t),t&&f(e)}}}function Te(t){let e,n,s,a,r,o,l,c,u,d,v,k,S,T,M,L,C,_,N,D,E,z,H,j,J,F,W=t[18].subtype+"";function I(){t[10].call(o,t[19],t[20])}let B=t[1],Y=[];for(let e=0;e<B.length;e+=1)Y[e]=Oe(be(t,B,e));function q(){t[11].call(u,t[19],t[20])}function U(){t[12].call(k,t[19],t[20])}function V(){t[13].call(M,t[19],t[20])}_=new me({props:{click:t[14]}}),E=new pe({props:{i:t[20],click:t[15]}});let G=!t[5]&&Ae(t);return{c(){e=m("tr"),n=m("td"),s=y(W),a=b(),r=m("td"),o=m("input"),l=b(),c=m("td"),u=m("select");for(let t=0;t<Y.length;t+=1)Y[t].c();d=b(),v=m("td"),k=m("input"),S=b(),T=m("td"),M=m("input"),L=b(),C=m("td"),et(_.$$.fragment),N=b(),D=m("td"),et(E.$$.fragment),z=b(),G&&G.c(),H=x(),$(n,"class","tbl-bdy-lg"),$(o,"class","ipt-lg w-full"),$(o,"type","text"),$(r,"class","tbl-bdy-lg"),$(u,"class","ipt-lg w-full"),void 0===t[18].widget&&R(q),$(c,"class","tbl-bdy-lg"),$(k,"class","ipt-lg w-full"),$(k,"type","text"),$(v,"class","tbl-bdy-lg"),$(M,"class","ipt-lg w-full"),$(M,"type","text"),$(T,"class","tbl-bdy-lg"),$(C,"class","tbl-bdy-lg"),$(D,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad align-middle")},m(i,f){p(i,e,f),h(e,n),h(n,s),h(e,a),h(e,r),h(r,o),A(o,t[18].id),h(e,l),h(e,c),h(c,u);for(let t=0;t<Y.length;t+=1)Y[t].m(u,null);P(u,t[18].widget),h(e,d),h(e,v),h(v,k),A(k,t[18].page),h(e,S),h(e,T),h(T,M),A(M,t[18].descr),h(e,L),h(e,C),nt(_,C,null),h(e,N),h(e,D),nt(E,D,null),p(i,z,f),G&&G.m(i,f),p(i,H,f),j=!0,J||(F=[w(o,"input",I),w(u,"change",q),w(k,"input",U),w(M,"input",V)],J=!0)},p(e,n){if(t=e,(!j||1&n[0])&&W!==(W=t[18].subtype+"")&&O(s,W),3&n[0]&&o.value!==t[18].id&&A(o,t[18].id),2&n[0]){let e;for(B=t[1],e=0;e<B.length;e+=1){const i=be(t,B,e);Y[e]?Y[e].p(i,n):(Y[e]=Oe(i),Y[e].c(),Y[e].m(u,null))}for(;e<Y.length;e+=1)Y[e].d(1);Y.length=B.length}3&n[0]&&P(u,t[18].widget),3&n[0]&&k.value!==t[18].page&&A(k,t[18].page),3&n[0]&&M.value!==t[18].descr&&A(M,t[18].descr);const i={};32&n[0]&&(i.click=t[14]),_.$set(i),t[5]?G&&(G.d(1),G=null):G?G.p(t,n):(G=Ae(t),G.c(),G.m(H.parentNode,H))},i(t){j||(Z(_.$$.fragment,t),Z(E.$$.fragment,t),j=!0)},o(t){Q(_.$$.fragment,t),Q(E.$$.fragment,t),j=!1},d(t){t&&f(e),g(Y,t),it(_),it(E),t&&f(z),G&&G.d(t),t&&f(H),J=!1,i(F)}}}function Me(t){let e,n,s,a,r,o,l,c,u,d,v,y,x,k,O,A=t[2],S=[];for(let e=0;e<A.length;e+=1)S[e]=ke(xe(t,A,e));let T=t[0],M=[];for(let e=0;e<T.length;e+=1)M[e]=Te(ve(t,T,e));const L=t=>Q(M[t],1,1,(()=>{M[t]=null}));return{c(){e=m("div"),n=m("select");for(let t=0;t<S.length;t+=1)S[t].c();s=b(),a=m("select"),r=m("option"),r.textContent="Выберите пресет",o=b(),l=m("table"),c=m("thead"),c.innerHTML='<tr class="txt-sz txt-pad"><th class="tbl-hd">Тип</th> \n <th class="tbl-hd">Id</th> \n <th class="tbl-hd">Виджет</th> \n <th class="tbl-hd">Вкладка</th> \n <th class="tbl-hd">Название</th> \n <th class="tbl-hd w-7"></th> \n <th class="tbl-hd w-7"></th></tr>',u=b(),d=m("tbody");for(let t=0;t<M.length;t+=1)M[t].c();v=b(),y=m("button"),y.textContent="Сохранить",$(n,"class","slct-lg"),void 0===t[4]&&R((()=>t[8].call(n))),r.__value="Выберите пресет",r.value=r.__value,$(a,"class","slct-lg"),$(e,"class","grd-2col2"),$(c,"class","bg-gray-100"),$(d,"class","bg-white"),$(l,"class","tbl"),$(y,"class","btn-lg")},m(i,f){p(i,e,f),h(e,n);for(let t=0;t<S.length;t+=1)S[t].m(n,null);P(n,t[4]),h(e,s),h(e,a),h(a,r),p(i,o,f),p(i,l,f),h(l,c),h(l,u),h(l,d);for(let t=0;t<M.length;t+=1)M[t].m(d,null);p(i,v,f),p(i,y,f),x=!0,k||(O=[w(n,"change",t[8]),w(n,"change",t[9]),w(y,"click",t[17])],k=!0)},p(t,e){if(4&e[0]){let i;for(A=t[2],i=0;i<A.length;i+=1){const s=xe(t,A,i);S[i]?S[i].p(s,e):(S[i]=ke(s),S[i].c(),S[i].m(n,null))}for(;i<S.length;i+=1)S[i].d(1);S.length=A.length}if(20&e[0]&&P(n,t[4]),163&e[0]){let n;for(T=t[0],n=0;n<T.length;n+=1){const i=ve(t,T,n);M[n]?(M[n].p(i,e),Z(M[n],1)):(M[n]=Te(i),M[n].c(),Z(M[n],1),M[n].m(d,null))}for(X(),n=T.length;n<M.length;n+=1)L(n);K()}},i(t){if(!x){for(let t=0;t<T.length;t+=1)Z(M[t]);x=!0}},o(t){M=M.filter(Boolean);for(let t=0;t<M.length;t+=1)Q(M[t]);x=!1},d(t){t&&f(e),g(S,t),t&&f(o),t&&f(l),g(M,t),t&&f(v),t&&f(y),k=!1,i(O)}}}function Le(t){let e,n,i;return n=new jt({props:{$$slots:{default:[Me]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),$(e,"class","grd-1col1")},m(t,s){p(t,e,s),nt(n,e,null),i=!0},p(t,e){const i={};63&e[0]|1&e[1]&&(i.$$scope={dirty:e,ctx:t}),n.$set(i)},i(t){i||(Z(n.$$.fragment,t),i=!0)},o(t){Q(n.$$.fragment,t),i=!1},d(t){t&&f(e),it(n)}}}function Ce(t,e,n){let{configJson:i}=e,{widgetsJson:s}=e,{itemsJson:a}=e,r=0,{saveConfig:o=(()=>{})}=e,l=!0;function c(){for(let t=0;t<a.length;t++){let e=Object.assign({},a[t]);if(r===e.num){delete e.num,delete e.name,i.push(e),n(0,i),n(4,r=0),console.log("[i]","item added");break}}}function u(t){for(let e=0;e<i.length;e++)if(t===e){i.splice(e,1),n(0,i),console.log("[i]","item "+t+" deleted from config");break}}return t.$$set=t=>{"configJson"in t&&n(0,i=t.configJson),"widgetsJson"in t&&n(1,s=t.widgetsJson),"itemsJson"in t&&n(2,a=t.itemsJson),"saveConfig"in t&&n(3,o=t.saveConfig)},[i,s,a,o,r,l,c,u,function(){r=S(this),n(4,r),n(2,a)},()=>c(),function(t,e){t[e].id=this.value,n(0,i),n(1,s)},function(t,e){t[e].widget=S(this),n(0,i),n(1,s)},function(t,e){t[e].page=this.value,n(0,i),n(1,s)},function(t,e){t[e].descr=this.value,n(0,i),n(1,s)},()=>n(5,l=!l),t=>u(t),function(t,e,a){e[a][t]=this.value,n(0,i),n(1,s)},()=>o()]}class _e extends at{constructor(t){super(),st(this,t,Ce,Le,a,{configJson:0,widgetsJson:1,itemsJson:2,saveConfig:3},null,[-1,-1])}}function Ne(t,e,n){const i=t.slice();return i[17]=e[n][0],i[18]=e[n][1],i}function De(t){let e,n,i,s,a=t[18]+"";return{c(){e=m("option"),n=y(a),i=b(),e.__value=s=t[18],e.value=e.__value},m(t,s){p(t,e,s),h(e,n),h(e,i)},p(t,i){2&i&&a!==(a=t[18]+"")&&O(n,a),2&i&&s!==(s=t[18])&&(e.__value=s,e.value=e.__value)},d(t){t&&f(e)}}}function Ee(t){let e,n,i;return n=new Lt({props:{title:"Введен неправильный пароль"}}),{c(){e=m("div"),et(n.$$.fragment),$(e,"class","grd-1col1")},m(t,s){p(t,e,s),nt(n,e,null),i=!0},i(t){i||(Z(n.$$.fragment,t),i=!0)},o(t){Q(n.$$.fragment,t),i=!1},d(t){t&&f(e),it(n)}}}function ze(t){let e,n,s,a,r,o,l,c,u,d,v,y,x,k,O,S,T,M,L,C,_,N,D,E,z,H,j,J,F,W,I,B,Y,q,U,V=Object.entries(t[1]),G=[];for(let e=0;e<V.length;e+=1)G[e]=De(Ne(t,V,e));let tt=1===t[0].pass_status&&Ee();return{c(){e=m("div"),n=m("div"),n.innerHTML='<p class="wgt-dscr-stl">Название устройства</p>',s=b(),a=m("div"),r=m("input"),o=b(),l=m("div"),c=m("div"),c.innerHTML='<p class="wgt-dscr-stl">Точка доступа</p>',u=b(),d=m("div"),v=m("input"),y=b(),x=m("div"),k=m("div"),k.innerHTML='<p class="wgt-dscr-stl">Пароль точки доступа</p>',O=b(),S=m("div"),T=m("input"),M=b(),L=m("div"),C=m("div"),C.innerHTML='<p class="wgt-dscr-stl">Название wifi сети</p>',_=b(),N=m("div"),D=m("select");for(let t=0;t<G.length;t+=1)G[t].c();E=b(),z=m("div"),H=m("div"),H.innerHTML='<p class="wgt-dscr-stl">Пароль</p>',j=b(),J=m("div"),F=m("input"),W=b(),tt&&tt.c(),I=b(),B=m("button"),B.textContent="Сохранить и перезагрузить",$(n,"class","wgt-dscr-w"),$(r,"class","ipt-rnd text-left focus:border-indigo-500"),$(r,"type","text"),$(a,"class","wgt-w"),$(e,"class","crd-itm-psn"),$(c,"class","wgt-dscr-w"),$(v,"class","ipt-rnd text-left focus:border-indigo-500"),$(v,"type","text"),$(d,"class","wgt-w"),$(l,"class","crd-itm-psn"),$(k,"class","wgt-dscr-w"),$(T,"class","ipt-rnd text-left focus:border-indigo-500"),$(T,"type","text"),$(S,"class","wgt-w"),$(x,"class","crd-itm-psn"),$(C,"class","wgt-dscr-w"),$(D,"class","ipt-rnd text-left focus:border-indigo-500"),void 0===t[0].routerssid&&R((()=>t[7].call(D))),$(N,"class","wgt-w"),$(L,"class","crd-itm-psn"),$(H,"class","wgt-dscr-w"),$(F,"class","ipt-rnd text-left focus:border-indigo-500"),$(F,"type","text"),$(J,"class","wgt-w"),$(z,"class","crd-itm-psn"),$(B,"class","btn-lg")},m(i,f){p(i,e,f),h(e,n),h(e,s),h(e,a),h(a,r),A(r,t[0].name),p(i,o,f),p(i,l,f),h(l,c),h(l,u),h(l,d),h(d,v),A(v,t[0].apssid),p(i,y,f),p(i,x,f),h(x,k),h(x,O),h(x,S),h(S,T),A(T,t[0].appass),p(i,M,f),p(i,L,f),h(L,C),h(L,_),h(L,N),h(N,D);for(let t=0;t<G.length;t+=1)G[t].m(D,null);P(D,t[0].routerssid),p(i,E,f),p(i,z,f),h(z,H),h(z,j),h(z,J),h(J,F),A(F,t[0].routerpass),p(i,W,f),tt&&tt.m(i,f),p(i,I,f),p(i,B,f),Y=!0,q||(U=[w(r,"input",t[4]),w(v,"input",t[5]),w(T,"input",t[6]),w(D,"change",t[7]),w(D,"click",t[8]),w(F,"input",t[9]),w(B,"click",t[10])],q=!0)},p(t,e){if(3&e&&r.value!==t[0].name&&A(r,t[0].name),3&e&&v.value!==t[0].apssid&&A(v,t[0].apssid),3&e&&T.value!==t[0].appass&&A(T,t[0].appass),2&e){let n;for(V=Object.entries(t[1]),n=0;n<V.length;n+=1){const i=Ne(t,V,n);G[n]?G[n].p(i,e):(G[n]=De(i),G[n].c(),G[n].m(D,null))}for(;n<G.length;n+=1)G[n].d(1);G.length=V.length}3&e&&P(D,t[0].routerssid),3&e&&F.value!==t[0].routerpass&&A(F,t[0].routerpass),1===t[0].pass_status?tt?1&e&&Z(tt,1):(tt=Ee(),tt.c(),Z(tt,1),tt.m(I.parentNode,I)):tt&&(X(),Q(tt,1,1,(()=>{tt=null})),K())},i(t){Y||(Z(tt),Y=!0)},o(t){Q(tt),Y=!1},d(t){t&&f(e),t&&f(o),t&&f(l),t&&f(y),t&&f(x),t&&f(M),t&&f(L),g(G,t),t&&f(E),t&&f(z),t&&f(W),tt&&tt.d(t),t&&f(I),t&&f(B),q=!1,i(U)}}}function He(t){let e,n,s,a,r,o,l,c,u,d,g,v,y,x,k,O,P,S,T,M,L,C,_,N,D,E,z,H,j,J,F,W,R;return{c(){e=m("div"),n=m("div"),n.innerHTML='<p class="wgt-dscr-stl">Название сервера</p>',s=b(),a=m("div"),r=m("input"),o=b(),l=m("div"),c=m("div"),c.innerHTML='<p class="wgt-dscr-stl">Порт</p>',u=b(),d=m("div"),g=m("input"),v=b(),y=m("div"),x=m("div"),x.innerHTML='<p class="wgt-dscr-stl">Префикс</p>',k=b(),O=m("div"),P=m("input"),S=b(),T=m("div"),M=m("div"),M.innerHTML='<p class="wgt-dscr-stl">Имя пользователя</p>',L=b(),C=m("div"),_=m("input"),N=b(),D=m("div"),E=m("div"),E.innerHTML='<p class="wgt-dscr-stl">Пароль</p>',z=b(),H=m("div"),j=m("input"),J=b(),F=m("button"),F.textContent="Сохранить и проверить подключение",$(n,"class","wgt-dscr-w"),$(r,"class","ipt-rnd text-left focus:border-indigo-500"),$(r,"type","text"),$(a,"class","wgt-w"),$(e,"class","crd-itm-psn"),$(c,"class","wgt-dscr-w"),$(g,"class","ipt-rnd text-left focus:border-indigo-500"),$(g,"type","text"),$(d,"class","wgt-w"),$(l,"class","crd-itm-psn"),$(x,"class","wgt-dscr-w"),$(P,"class","ipt-rnd text-left focus:border-indigo-500"),$(P,"type","text"),$(O,"class","wgt-w"),$(y,"class","crd-itm-psn"),$(M,"class","wgt-dscr-w"),$(_,"class","ipt-rnd text-left focus:border-indigo-500"),$(_,"type","text"),$(C,"class","wgt-w"),$(T,"class","crd-itm-psn"),$(E,"class","wgt-dscr-w"),$(j,"class","ipt-rnd text-left focus:border-indigo-500"),$(j,"type","text"),$(H,"class","wgt-w"),$(D,"class","crd-itm-psn"),$(F,"class","btn-lg")},m(i,f){p(i,e,f),h(e,n),h(e,s),h(e,a),h(a,r),A(r,t[0].mqttServer),p(i,o,f),p(i,l,f),h(l,c),h(l,u),h(l,d),h(d,g),A(g,t[0].mqttPort),p(i,v,f),p(i,y,f),h(y,x),h(y,k),h(y,O),h(O,P),A(P,t[0].mqttPrefix),p(i,S,f),p(i,T,f),h(T,M),h(T,L),h(T,C),h(C,_),A(_,t[0].mqttUser),p(i,N,f),p(i,D,f),h(D,E),h(D,z),h(D,H),h(H,j),A(j,t[0].mqttPass),p(i,J,f),p(i,F,f),W||(R=[w(r,"input",t[11]),w(g,"input",t[12]),w(P,"input",t[13]),w(_,"input",t[14]),w(j,"input",t[15]),w(F,"click",t[16])],W=!0)},p(t,e){3&e&&r.value!==t[0].mqttServer&&A(r,t[0].mqttServer),3&e&&g.value!==t[0].mqttPort&&A(g,t[0].mqttPort),3&e&&P.value!==t[0].mqttPrefix&&A(P,t[0].mqttPrefix),3&e&&_.value!==t[0].mqttUser&&A(_,t[0].mqttUser),3&e&&j.value!==t[0].mqttPass&&A(j,t[0].mqttPass)},d(t){t&&f(e),t&&f(o),t&&f(l),t&&f(v),t&&f(y),t&&f(S),t&&f(T),t&&f(N),t&&f(D),t&&f(J),t&&f(F),W=!1,i(R)}}}function je(t){let e,n,i,s,a;return n=new jt({props:{title:"Подключение к WiFi роутеру",$$slots:{default:[ze]},$$scope:{ctx:t}}}),s=new jt({props:{title:"Подключение к MQTT брокеру",$$slots:{default:[He]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),i=b(),et(s.$$.fragment),$(e,"class","grd-2col1")},m(t,r){p(t,e,r),nt(n,e,null),h(e,i),nt(s,e,null),a=!0},p(t,[e]){const i={};2097167&e&&(i.$$scope={dirty:e,ctx:t}),n.$set(i);const a={};2097161&e&&(a.$$scope={dirty:e,ctx:t}),s.$set(a)},i(t){a||(Z(n.$$.fragment,t),Z(s.$$.fragment,t),a=!0)},o(t){Q(n.$$.fragment,t),Q(s.$$.fragment,t),a=!1},d(t){t&&f(e),it(n),it(s)}}}function Je(t,e,n){let{settingsJson:i}=e,{ssidJson:s}=e,{ssidDropdownClick:a=(()=>{})}=e,{saveSettings:r=(()=>{})}=e;return t.$$set=t=>{"settingsJson"in t&&n(0,i=t.settingsJson),"ssidJson"in t&&n(1,s=t.ssidJson),"ssidDropdownClick"in t&&n(2,a=t.ssidDropdownClick),"saveSettings"in t&&n(3,r=t.saveSettings)},[i,s,a,r,function(){i.name=this.value,n(0,i),n(1,s)},function(){i.apssid=this.value,n(0,i),n(1,s)},function(){i.appass=this.value,n(0,i),n(1,s)},function(){i.routerssid=S(this),n(0,i),n(1,s)},()=>a(),function(){i.routerpass=this.value,n(0,i),n(1,s)},()=>r(),function(){i.mqttServer=this.value,n(0,i),n(1,s)},function(){i.mqttPort=this.value,n(0,i),n(1,s)},function(){i.mqttPrefix=this.value,n(0,i),n(1,s)},function(){i.mqttUser=this.value,n(0,i),n(1,s)},function(){i.mqttPass=this.value,n(0,i),n(1,s)},()=>r()]}class Fe extends at{constructor(t){super(),st(this,t,Je,je,a,{settingsJson:0,ssidJson:1,ssidDropdownClick:2,saveSettings:3})}}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var We,Re=(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 i(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 s(t){var e=window.getComputedStyle(t),n=parseFloat(e.paddingLeft)+parseFloat(e.paddingRight);return t.clientWidth-n}function a(t,e,n){var i=document.createEvent("HTMLEvents");for(var s in i.initEvent(e,!0,!0),n)i[s]=n[s];return t.dispatchEvent(i)}function r(t){return t.titleHeight+t.margins.top+t.paddings.top}function o(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 i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];n||(n=i?t[0]:t[t.length-1]);var s=new Array(Math.abs(e)).fill(n);return i?s.concat(t):t.concat(s)}function h(t,e){return(t+"").length*e}function p(t,e){return{x:Math.sin(t*Zt)*e,y:Math.cos(t*Zt)*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,i=void 0;if(t instanceof Date)return new Date(t.getTime());if("object"!==(void 0===t?"undefined":jt(t))||null===t)return t;for(i in e=Array.isArray(t)?[]:{},t)n=t[i],e[i]=m(n);return e}function v(t,e){var n=void 0,i=void 0;return t<=e?(n=e-t,i=t):(n=t-e,i=e),[n,i]}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 i=Math.floor(n/3),s=Math.pow(10,n-3*i)*+(e/Math.pow(10,n)).toFixed(1);return Math.round(100*s)/100+" "+["","K","M","B","T"][i]}function w(t,e){for(var n=[],i=0;i<t.length;i++)n.push([t[i],e[i]]);var s=function(t,e){var n=e[0]-t[0],i=e[1]-t[1];return{length:Math.sqrt(Math.pow(n,2)+Math.pow(i,2)),angle:Math.atan2(i,n)}},a=function(t,e,n,i){var a=s(e||t,n||t),r=a.angle+(i?Math.PI:0),o=.2*a.length;return[t[0]+Math.cos(r)*o,t[1]+Math.sin(r)*o]};return function(t,e){return t.reduce((function(t,n,i,s){return 0===i?n[0]+","+n[1]:t+" "+e(n,i,s)}),"")}(n,(function(t,e,n){var i=a(n[e-1],n[e-2],t),s=a(t,n[e-1],n[e+1],!0);return"C "+i[0]+","+i[1]+" "+s[0]+","+s[1]+" "+t[0]+","+t[1]}))}function $(t){return t>255?255:t<0?0:t}function k(t,e){var n=ee(t),i=!1;"#"==n[0]&&(n=n.slice(1),i=!0);var s=parseInt(n,16),a=$((s>>16)+e),r=$((s>>8&255)+e);return(i?"#":"")+($((255&s)+e)|r<<8|a<<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 P(t,e){var n=document.createElementNS("http://www.w3.org/2000/svg",t);for(var i in e){var s=e[i];if("inside"===i)A(s).appendChild(n);else if("around"===i){var a=A(s);a.parentNode.insertBefore(n,a),n.appendChild(a)}else"styles"===i?"object"===(void 0===s?"undefined":jt(s))&&Object.keys(s).map((function(t){n.style[t]=s[t]})):("className"===i&&(i="class"),"innerHTML"===i?n.textContent=s:n.setAttribute(i,s))}return n}function S(t,e){return P("linearGradient",{inside:t,id:e,x1:0,x2:0,y1:0,y2:1})}function T(t,e,n,i){return P("stop",{inside:t,style:"stop-color: "+n,offset:e,"stop-opacity":i})}function M(t,e,n,i){return P("svg",{className:e,inside:t,width:n,height:i})}function L(t){return P("defs",{inside:t})}function C(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),P("g",n)}function _(t){return P("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 N(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=n.x+t.x,o=n.y+t.y,l=n.x+e.x,c=n.y+e.y;return"M"+n.x+" "+n.y+"\n\t\tL"+r+" "+o+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+l+" "+c+" z"}function D(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=n.x+t.x,o=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"+r+" "+o+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+l+" "+c+" z\n\t\tL"+r+" "+c+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+l+" "+u+" z"}function E(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return"M"+(n.x+t.x)+" "+(n.y+t.y)+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+(n.x+e.x)+" "+(n.y+e.y)}function z(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=n.x+t.x,o=n.y+t.y,l=n.x+e.x,c=2*i+o;return"M"+r+" "+o+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+l+" "+c+"\n\t\tM"+r+" "+c+"\n\t\tA "+i+" "+i+" 0 "+a+" "+(s?1:0)+"\n\t\t"+l+" "+(n.y+t.y)}function H(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i="path-fill-gradient-"+e+"-"+(n?"lighter":"default"),s=S(t,i),a=[1,.6,.2];return n&&(a=[.4,.2,0]),T(s,"0%",e,a[0]),T(s,"50%",e,a[1]),T(s,"100%",e,a[2]),i}function j(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Vt,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none";return P("rect",{className:"percentage-bar",x:t,y:e,width:n,height:i,fill:a,styles:{stroke:k(a,-25),"stroke-dasharray":"0, "+(i+n)+", "+n+", "+i,"stroke-width":s}})}function J(t,e,n,i,s){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},r={className:t,x:e,y:n,width:i,height:i,rx:s,fill:arguments.length>5&&void 0!==arguments[5]?arguments[5]:"none"};return Object.keys(a).map((function(t){r[t]=a[t]})),P("rect",r)}function F(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments[4];s=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(s,se):s;var a={className:"legend-bar",x:0,y:0,width:n,height:"2px",fill:i},r=P("text",{className:"legend-dataset-text",x:0,y:0,dy:2*ae+"px","font-size":1.2*ae+"px","text-anchor":"start",fill:oe,innerHTML:s}),o=P("g",{transform:"translate("+t+", "+e+")"});return o.appendChild(P("rect",a)),o.appendChild(r),o}function W(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",s=arguments[4];s=arguments.length>5&&void 0!==arguments[5]&&arguments[5]?b(s,se):s;var a={className:"legend-dot",cx:0,cy:0,r:n,fill:i},r=P("text",{className:"legend-dataset-text",x:0,y:0,dx:ae+"px",dy:ae/3+"px","font-size":1.2*ae+"px","text-anchor":"start",fill:oe,innerHTML:s}),o=P("g",{transform:"translate("+t+", "+e+")"});return o.appendChild(P("circle",a)),o.appendChild(r),o}function R(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=s.fontSize||ae;return P("text",{className:t,x:e,y:n,dy:(void 0!==s.dy?s.dy:a/2)+"px","font-size":a+"px",fill:s.fill||oe,"text-anchor":s.textAnchor||"start",innerHTML:i})}function I(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};s.stroke||(s.stroke=re);var a=P("line",{className:"line-vertical "+s.className,x1:0,x2:0,y1:n,y2:i,styles:{stroke:s.stroke}}),r=P("text",{x:0,y:n>i?n+ie:n-ie-ae,dy:ae+"px","font-size":ae+"px","text-anchor":"middle",innerHTML:e+""}),o=P("g",{transform:"translate("+t+", 0)"});return o.appendChild(a),o.appendChild(r),o}function B(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};s.stroke||(s.stroke=re),s.lineType||(s.lineType=""),s.shortenNumbers&&(e=x(e));var a=P("line",{className:"line-horizontal "+s.className+("dashed"===s.lineType?"dashed":""),x1:n,x2:i,y1:0,y2:0,styles:{stroke:s.stroke}}),r=P("text",{x:n<i?n-ie:n+ie,y:0,dy:ae/2-2+"px","font-size":ae+"px","text-anchor":n<i?"end":"start",innerHTML:e+""}),o=P("g",{transform:"translate(0, "+t+")","stroke-opacity":1});return 0!==r&&"0"!==r||(o.style.stroke="rgba(27, 31, 35, 0.6)"),o.appendChild(a),o.appendChild(r),o}function Y(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),i.pos||(i.pos="left"),i.offset||(i.offset=0),i.mode||(i.mode="span"),i.stroke||(i.stroke=re),i.className||(i.className="");var s=-1*ne,a="span"===i.mode?n+ne:0;return"tick"===i.mode&&"right"===i.pos&&(s=n+ne,a=n),B(t,e,s+=i.offset,a+=i.offset,{stroke:i.stroke,className:i.className,lineType:i.lineType,shortenNumbers:i.shortenNumbers})}function q(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};f(t)||(t=0),i.pos||(i.pos="bottom"),i.offset||(i.offset=0),i.mode||(i.mode="span"),i.stroke||(i.stroke=re),i.className||(i.className="");var s=n+ne,a="span"===i.mode?-1*ne:n;return"tick"===i.mode&&"top"===i.pos&&(s=-1*ne,a=0),I(t,e,s,a,{stroke:i.stroke,className:i.className,lineType:i.lineType})}function U(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};i.labelPos||(i.labelPos="right");var s=P("text",{className:"chart-label",x:"left"===i.labelPos?ie:n-h(e,5)-ie,y:0,dy:ae/-2+"px","font-size":ae+"px","text-anchor":"start",innerHTML:e+""}),a=B(t,"",0,n,{stroke:i.stroke||re,className:i.className||"",lineType:i.lineType});return a.appendChild(s),a}function V(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=t-e,r=P("rect",{className:"bar mini",styles:{fill:"rgba(228, 234, 239, 0.49)",stroke:re,"stroke-dasharray":n+", "+a},x:0,y:0,width:n,height:a});s.labelPos||(s.labelPos="right");var o=P("text",{className:"chart-label",x:"left"===s.labelPos?ie:n-h(i+"",4.5)-ie,y:0,dy:ae/-2+"px","font-size":ae+"px","text-anchor":"start",innerHTML:i+""}),l=P("g",{transform:"translate(0, "+e+")"});return l.appendChild(r),l.appendChild(o),l}function G(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},l=v(e,o.zeroLine),c=Bt(l,2),u=c[0],d=c[1];d-=r,0===u&&(u=o.minHeight,d-=o.minHeight),f(t)||(t=0),f(d)||(d=0),f(u,!0)||(u=0),f(n,!0)||(n=0);var h=P("rect",{className:"bar mini",style:"fill: "+i,"data-point-index":a,x:t,y:d,width:n,height:u});if((s+="")||s.length){h.setAttribute("y",0),h.setAttribute("x",0);var p=P("text",{className:"data-point-value",x:n/2,y:0,dy:ae/2*-1+"px","font-size":ae+"px","text-anchor":"middle",innerHTML:s}),g=P("g",{"data-point-index":a,transform:"translate("+t+", "+d+")"});return g.appendChild(h),g.appendChild(p),g}return h}function X(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=P("circle",{style:"fill: "+i,"data-point-index":a,cx:t,cy:e,r:n});if((s+="")||s.length){r.setAttribute("cy",0),r.setAttribute("cx",0);var o=P("text",{className:"data-point-value",x:0,y:0,dy:ae/2*-1-n+"px","font-size":ae+"px","text-anchor":"middle",innerHTML:s}),l=P("g",{"data-point-index":a,transform:"translate("+t+", "+e+")"});return l.appendChild(r),l.appendChild(o),l}return r}function K(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=e.map((function(e,n){return t[n]+","+e})).join("L");i.spline&&(a=w(t,e));var r=_("M"+a,"line-graph-path",n);if(i.heatline){var o=H(s.svgDefs,n);r.style.stroke="url(#"+o+")"}var l={path:r};if(i.regionFill){var c=H(s.svgDefs,n,!0),u="M"+t[0]+","+s.zeroLine+"L"+a+"L"+t.slice(-1)[0]+","+s.zeroLine;l.region=_(u,"region-fill","none","url(#"+c+")")}return l}function Z(t,e,n,i){var s="string"==typeof e?e:e.join(", ");return[t,{transform:n.join(", ")},i,fe,"translate",{transform:s}]}function Q(t,e,n){return Z(t,[n,0],[e,0],he)}function tt(t,e,n){return Z(t,[0,n],[0,e],he)}function et(t,e,n,i){var s=e-n,a=t.childNodes[0];return[[a,{height:s,"stroke-dasharray":a.getAttribute("width")+", "+s},he,fe],Z(t,[0,i],[0,n],he)]}function nt(t,e,n,i){var s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=v(n,(arguments.length>5&&void 0!==arguments[5]?arguments[5]:{}).zeroLine),r=Bt(a,2),o=r[0],l=r[1];return l-=s,"rect"!==t.nodeName?[[t.childNodes[0],{width:i,height:o},ue,fe],Z(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,l],he)]:[[t,{width:i,height:o,x:e,y:l},ue,fe]]}function it(t,e,n){return"circle"!==t.nodeName?[Z(t,t.getAttribute("transform").split("(")[1].slice(0,-1),[e,n],he)]:[[t,{cx:e,cy:n},ue,fe]]}function st(t,e,n,i,s){var a=[],r=n.map((function(t,n){return e[n]+","+t})).join("L");s&&(r=w(e,n));var o=[t.path,{d:"M"+r},de,fe];if(a.push(o),t.region){var l=e[0]+","+i+"L",c="L"+e.slice(-1)[0]+", "+i,u=[t.region,{d:"M"+l+r+c},de,fe];a.push(u)}return a}function at(t,e){return[t,{d:e},ue,fe]}function rt(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"linear",s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},r=t.cloneNode(!0),o=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=a[l]||t.getAttribute(l),d=e[l],h={attributeName:l,from:u,to:d,begin:"0s",dur:n/1e3+"s",values:u+";"+d,keySplines:ge[i],keyTimes:"0;1",calcMode:"spline",fill:"freeze"};for(var p in s&&(h.type=s),h)c.setAttribute(p,h[p]);r.appendChild(c),s?o.setAttribute(l,"translate("+d+")"):o.setAttribute(l,d)}return[r,o]}function ot(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=[],i=[];e.map((function(t){var e=t[0],s=e.parentNode,a=void 0,r=void 0;t[0]=e;var o=rt.apply(void 0,Yt(t)),l=Bt(o,2);a=l[0],r=l[1],n.push(r),i.push([a,s]),s&&s.replaceChild(a,e)}));var s=t.cloneNode(!0);return i.map((function(t,i){t[1]&&(t[1].replaceChild(n[i],t[0]),e[i][0]=n[i])})),s}function ct(t,e,n){if(0!==n.length){var i=lt(e,n);e.parentNode==t&&(t.removeChild(e),t.appendChild(i)),setTimeout((function(){i.parentNode==t&&(t.removeChild(i),t.appendChild(e))}),pe)}}function ut(t,e){var n=document.createElement("a");n.style="display: none";var i=new Blob(e,{type:"image/svg+xml; charset=utf-8"}),s=window.URL.createObjectURL(i);n.href=s,n.download=t,document.body.appendChild(n),n.click(),setTimeout((function(){document.body.removeChild(n),window.URL.revokeObjectURL(s)}),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 i=t.create("style",{innerHTML:me});n.insertBefore(i,n.firstChild);var s=t.create("div");return s.appendChild(n),s.innerHTML}function ht(t){var e=new Date(t);return e.setMinutes(e.getMinutes()-e.getTimezoneOffset()),e}function pt(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(ht(e)-ht(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 i=Object.keys(Ae).filter((function(e){return t.includes(e)})),s=Ae[i[0]];return Object.assign(s,{constants:e,getData:n}),new Oe(s)}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),i=Math.floor(e),s=n-i,a=s,r=1;s>5&&(s%2!=0&&(s=++n-i),a=s/2,r=2),s<=2&&(r=s/(a=4)),0===s&&(a=5,r=1);for(var o=[],l=0;l<=a;l++)o.push(i+r*l);return o}function At(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=kt(t),i=Bt(n,2),s=i[0],a=i[1],r=e?e/Math.pow(10,a):0,o=Ot(s=s.toFixed(6),r);return o.map((function(t){return t*Math.pow(10,a)}))}function Pt(t){function e(t,e){for(var n=At(t),i=n[1]-n[0],s=0,a=1;s<e;a++)s+=i,n.unshift(-1*s);return n}var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=Math.max.apply(Math,Yt(t)),s=Math.min.apply(Math,Yt(t)),a=[];if(i>=0&&s>=0)kt(i)[1],a=n?At(i,s):At(i);else if(i>0&&s<0){var r=Math.abs(s);i>=r?(kt(i)[1],a=e(i,r)):(kt(r)[1],a=e(r,i).reverse().map((function(t){return-1*t})))}else if(i<=0&&s<=0){var o=Math.abs(s),l=Math.abs(i);kt(o)[1],a=(a=n?At(o,l):At(o)).reverse().map((function(t){return-1*t}))}return a}function St(t){var e=Tt(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 Tt(t){return t[1]-t[0]}function Mt(t){return t[t.length-1]-t[0]}function Lt(t,e){return u(e.zeroLine-t*e.scaleMultiplier)}function Ct(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=e.reduce((function(e,n){return Math.abs(n-t)<Math.abs(e-t)?n:e}),[]);return n?e.indexOf(i):i}function _t(t,e){for(var n=Math.max.apply(Math,Yt(t)),i=1/(e-1),s=[],a=0;a<e;a++){var r=n*(i*a);s.push(r)}return s}function Nt(t,e){return e.filter((function(e){return e<t})).length}function Dt(t,e){t.labels=t.labels||[];var n=t.labels.length,i=t.datasets,s=new Array(n).fill(0);return i||(i=[{values:s}]),i.map((function(t){if(t.values){var i=t.values;i=(i=i.map((function(t){return isNaN(t)?0:t}))).length>n?i.slice(0,n):d(i,n-i.length,0),t.values=i}else t.values=s;t.chartType||(t.chartType=e)})),t.yRegions&&t.yRegions.map((function(t){if(t.end<t.start){var e=[t.end,t.start];t.start=e[0],t.end=e[1]}})),t}function Et(t){var e=t.labels.length,n=new Array(e).fill(0),i={labels:t.labels.slice(0,-1),datasets:t.datasets.map((function(t){return{name:"",values:n.slice(0,-1),chartType:t.chartType}}))};return t.yMarkers&&(i.yMarkers=[{value:0,label:""}]),t.yRegions&&(i.yRegions=[{start:0,end:0,label:""}]),i}function zt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t/e.length;i<=0&&(i=1);var s=i/Gt,a=void 0;if(n){var r=Math.max.apply(Math,Yt(e.map((function(t){return t.length}))));a=Math.ceil(r/s)}return e.map((function(t,e){return(t+="").length>s&&(n?e%a!=0&&(t=""):t=s-3>0?t.slice(0,s-3)+" ...":t.slice(0,s)+".."),t}))}function Ht(){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)):Ce[t]?new Ce[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 i=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css","top"===n&&i.firstChild?i.insertBefore(s,i.firstChild):i.appendChild(s),s.styleSheet?s.styleSheet.cssText=t:s.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 jt="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},Jt=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<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),Wt=function t(e,n,i){null===e&&(e=Function.prototype);var s=Object.getOwnPropertyDescriptor(e,n);if(void 0===s){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,n,i)}if("value"in s)return s.value;var r=s.get;return void 0!==r?r.call(i):void 0},Rt=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},It=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},Bt=function(){function t(t,e){var n=[],i=!0,s=!1,a=void 0;try{for(var r,o=t[Symbol.iterator]();!(i=(r=o.next()).done)&&(n.push(r.value),!e||n.length!==e);i=!0);}catch(t){s=!0,a=t}finally{try{!i&&o.return&&o.return()}finally{if(s)throw a}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),Yt=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)};t.create=function(e,n){var i=document.createElement(e);for(var s in n){var a=n[s];if("inside"===s)t(a).appendChild(i);else if("around"===s){var r=t(a);r.parentNode.insertBefore(i,r),i.appendChild(r)}else"styles"===s?"object"===(void 0===a?"undefined":jt(a))&&Object.keys(a).map((function(t){i.style[t]=a[t]})):s in i?i[s]=a:i.setAttribute(s,a)}return i};var qt={margins:{top:10,bottom:10,left:20,right:20},paddings:{top:20,bottom:40,left:30,right:10},baseHeight:240,titleHeight:20,legendHeight:30,titleFontSize:12},Ut=700,Vt=2,Gt=7,Xt=["light-blue","blue","violet","red","orange","yellow","green","light-green","purple","magenta","light-grey","dark-grey"],Kt={bar:Xt,line:Xt,pie:Xt,percentage:Xt,heatmap:["#ebedf0","#c6e48b","#7bc96f","#239a3b","#196127"],donut:Xt},Zt=Math.PI/180,Qt=function(){function e(t){var n=t.parent,i=void 0===n?null:n,s=t.colors,a=void 0===s?[]:s;Jt(this,e),this.parent=i,this.colors=a,this.titleName="",this.titleValue="",this.listValues=[],this.titleValueFirst=0,this.x=0,this.y=0,this.top=0,this.left=0,this.setup()}return Ft(e,[{key:"setup",value:function(){this.makeTooltip()}},{key:"refresh",value:function(){this.fill(),this.calcPosition()}},{key:"makeTooltip",value:function(){var e=this;this.container=t.create("div",{inside:this.parent,className:"graph-svg-tip comparison",innerHTML:'<span class="title"></span>\n\t\t\t\t<ul class="data-point-list"></ul>\n\t\t\t\t<div class="svg-pointer"></div>'}),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?"<strong>"+this.titleValue+"</strong>"+this.titleName:this.titleName+"<strong>"+this.titleValue+"</strong>",this.title.innerHTML=n,this.dataPointList.innerHTML="",this.listValues.map((function(n,i){var s=e.colors[i]||"black",a=0===n.formatted||n.formatted?n.formatted:n.value,r=t.create("li",{styles:{"border-top":"3px solid "+s},innerHTML:'<strong style="display: block;">'+(0===a||a?a:"")+"</strong>\n\t\t\t\t\t"+(n.title?n.title:"")});e.dataPointList.appendChild(r)}))}},{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 i="calc(50% + "+(this.left-e)+"px)";n.style.left=i,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]:{},i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;this.titleName=n.name,this.titleValue=n.value,this.listValues=i,this.x=t,this.y=e,this.titleValueFirst=n.valueFirst||0,this.index=s,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,ie=4,se=15,ae=10,re="#dadada",oe="#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(),i=t.getAttribute("r"),s=t.getAttribute("fill");return n.setAttribute("r",parseInt(i)+4),n.setAttribute("fill",s),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(),i=t.getAttribute("r"),s=t.getAttribute("fill");return n.setAttribute("r",parseInt(i)+4),n.setAttribute("fill",s),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 i=["x","y","width","height"];Object.values(t.attributes).filter((function(t){return i.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 i=["cx","cy"];Object.values(t.attributes).filter((function(t){return i.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 i=["cx","cy"];Object.values(t.attributes).filter((function(t){return i.includes(t.name)&&t.specified})).map((function(t){e.setAttribute(t.name,t.nodeValue)})),n&&e.setAttribute("transform",n)}},ue=350,de=350,he=ue,pe=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(Jt(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(qt));var i=this.measures;this.setMeasures(n),this.title.length||(i.titleHeight=0),this.config.showLegend||(i.legendHeight=0),this.argHeight=n.height||i.baseHeight,this.state={},this.options={},this.initTimeout=Ut,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 Qt({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],i=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),i&&(this.data=this.realData,setTimeout((function(){t.update(t.data)}),this.initTimeout)),this.renderLegend(),this.setupNavigation(i))}},{key:"calc",value:function(){}},{key:"updateWidth",value:function(){this.baseWidth=s(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=L(this.svg),this.title.length&&(this.titleEL=R("title",t.margins.left,t.margins.top,this.title,{fontSize:t.titleFontSize,fill:"#666666",dy:t.titleFontSize}));var e=r(t);this.drawArea=C(this.type+"-chart chart-draw-area","translate("+o(t)+", "+e+")"),this.config.showLegend&&(e+=this.height+t.paddings.bottom,this.legendArea=C("chart-legend","translate("+o(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(o(t),r(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 i=[];e.forEach((function(t){i=i.concat(t.update(n))})),i.length>0?(ct(this.container,this.svg,i),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){i(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 Jt(this,e),It(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n))}return Rt(e,t),Ft(e,[{key:"configure",value:function(t){Wt(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 i=this.data.labels.map((function(e,n){var i=0;return t.data.datasets.map((function(t){i+=t.values[n]})),[i,e]})).filter((function(t){return t[0]>=0})),s=i;if(i.length>n){i.sort((function(t,e){return e[0]-t[0]})),s=i.slice(0,n-1);var a=0;i.slice(n-1).map((function(t){a+=t[0]})),s.push([a,"Rest"]),this.colors[n-1]="grey"}e.labels=[],s.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,i=0;this.legendTotals.map((function(s,a){var r=150,o=Math.floor((t.width-c(t.measures))/r);t.legendTotals.length<o&&(r=t.width/t.legendTotals.length),n>o&&(n=0,i+=20);var l=r*n+5,u=t.config.truncateLegends?b(e.labels[a],r/10):e.labels[a],d=t.config.formatTooltipY?t.config.formatTooltipY(s):s,h=W(l,i,5,t.colors[a],u+": "+d,!1);t.legendArea.appendChild(h),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,i=void 0===n?"":n,s=e.layerTransform,a=void 0===s?"":s,r=e.constants,o=e.getData,l=e.makeElements,c=e.animateElements;Jt(this,t),this.layerTransform=a,this.constants=r,this.makeElements=l,this.getData=o,this.animateElements=c,this.store=[],this.labels=[],this.layerClass=i,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=C(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 i=_(e,"donut-path",t.colors[n],"none",t.strokeWidth);return i.style.transition="transform .3s;",i}))},animateElements:function(t){return this.store.map((function(e,n){return at(e,t.sliceStrings[n])}))}},pieSlices:{layerClass:"pie-slices",makeElements:function(t){return t.sliceStrings.map((function(e,n){var i=_(e,"pie-path","none",t.colors[n]);return i.style.transition="transform .3s;",i}))},animateElements:function(t){return this.store.map((function(e,n){return at(e,t.sliceStrings[n])}))}},percentageBars:{layerClass:"percentage-bars",makeElements:function(t){var e=this;return t.xPositions.map((function(n,i){return j(n,0,t.widths[i],e.constants.barHeight,e.constants.barDepth,t.colors[i])}))},animateElements:function(t){if(t)return[]}},yAxis:{layerClass:"y axis",makeElements:function(t){var e=this;return t.positions.map((function(n,i){return Y(n,t.labels[i],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,i=this.oldData.positions,s=this.oldData.labels,a=y(i,e),r=Bt(a,2);i=r[0],e=r[1];var o=y(s,n),l=Bt(o,2);return s=l[0],n=l[1],this.render({positions:i,labels:n}),this.store.map((function(t,n){return tt(t,e[n],i[n])}))}},xAxis:{layerClass:"x axis",makeElements:function(t){var e=this;return t.positions.map((function(n,i){return q(n,t.calcLabels[i],e.constants.height,{mode:e.constants.mode,pos:e.constants.pos})}))},animateElements:function(t){var e=t.positions,n=t.calcLabels,i=this.oldData.positions,s=this.oldData.calcLabels,a=y(i,e),r=Bt(a,2);i=r[0],e=r[1];var o=y(s,n),l=Bt(o,2);return s=l[0],n=l[1],this.render({positions:i,calcLabels:n}),this.store.map((function(t,n){return Q(t,e[n],i[n])}))}},yMarkers:{layerClass:"y-markers",makeElements:function(t){var e=this;return t.map((function(t){return U(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=Bt(e,2);this.oldData=n[0];var i=(t=n[1]).map((function(t){return t.position})),s=t.map((function(t){return t.label})),a=t.map((function(t){return t.options})),r=this.oldData.map((function(t){return t.position}));return this.render(r.map((function(t,e){return{position:r[e],label:s[e],options:a[e]}}))),this.store.map((function(t,e){return tt(t,i[e],r[e])}))}},yRegions:{layerClass:"y-regions",makeElements:function(t){var e=this;return t.map((function(t){return V(t.startPos,t.endPos,e.constants.width,t.label,{labelPos:t.options.labelPos})}))},animateElements:function(t){var e=y(this.oldData,t),n=Bt(e,2);this.oldData=n[0];var i=(t=n[1]).map((function(t){return t.endPos})),s=t.map((function(t){return t.label})),a=t.map((function(t){return t.startPos})),r=t.map((function(t){return t.options})),o=this.oldData.map((function(t){return t.endPos})),l=this.oldData.map((function(t){return t.startPos}));this.render(o.map((function(t,e){return{startPos:l[e],endPos:o[e],label:s[e],options:r[e]}})));var c=[];return this.store.map((function(t,e){c=c.concat(et(t,a[e],i[e],o[e]))})),c}},heatDomain:{layerClass:function(){return"heat-domain domain-"+this.constants.index},makeElements:function(t){var e=this,n=this.constants,i=n.index,s=n.colWidth,a=n.rowHeight,r=n.squareSize,o=n.radius,l=n.xTranslate,c=0;return this.serializedSubDomains=[],t.cols.map((function(t,n){1===n&&e.labels.push(R("domain-name",l,-12,yt(i,!0).toUpperCase(),{fontSize:9})),t.map((function(t,n){if(t.fill){var i={"data-date":t.yyyyMmDd,"data-value":t.dataValue,"data-day":n},s=J("day",l,c,r,o,t.fill,i);e.serializedSubDomains.push(s)}c+=a})),c=0,l+=s})),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,i){return G(t.xPositions[i],n,t.barWidth,e.color,t.labels[i],i,t.offsets[i],{zeroLine:t.zeroLine,barsWidth:t.barsWidth,minHeight:e.minHeight})})),this.units},animateElements:function(t){var e=t.xPositions,n=t.yPositions,i=t.offsets,s=t.labels,a=this.oldData.xPositions,r=this.oldData.yPositions,o=this.oldData.offsets,l=this.oldData.labels,c=y(a,e),u=Bt(c,2);a=u[0],e=u[1];var d=y(r,n),h=Bt(d,2);r=h[0],n=h[1];var p=y(o,i),f=Bt(p,2);o=f[0],i=f[1];var g=y(l,s),m=Bt(g,2);l=m[0],s=m[1],this.render({xPositions:a,yPositions:r,offsets:o,labels:s,zeroLine:this.oldData.zeroLine,barsWidth:this.oldData.barsWidth,barWidth:this.oldData.barWidth});var v=[];return this.store.map((function(s,a){v=v.concat(nt(s,e[a],n[a],t.barWidth,i[a],{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,i){return X(t.xPositions[i],n,t.radius,e.color,e.valuesOverPoints?t.values[i]:"",i)}))),Object.values(this.paths).concat(this.units)},animateElements:function(t){var e=t.xPositions,n=t.yPositions,i=t.values,s=this.oldData.xPositions,a=this.oldData.yPositions,r=this.oldData.values,o=y(s,e),l=Bt(o,2);s=l[0],e=l[1];var c=y(a,n),u=Bt(c,2);a=u[0],n=u[1];var d=y(r,i),h=Bt(d,2);r=h[0],i=h[1],this.render({xPositions:s,yPositions:a,values:i,zeroLine:this.oldData.zeroLine,radius:this.oldData.radius});var p=[];return Object.keys(this.paths).length&&(p=p.concat(st(this.paths,e,n,t.zeroLine,this.constants.spline))),this.units.length&&this.units.map((function(t,i){p=p.concat(it(t,e[i],n[i]))})),p}}},Pe=function(t){function n(t,e){Jt(this,n);var i=It(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.type="percentage",i.setup(),i}return Rt(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||Vt,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,Yt(t));return[t[0],e]})))}},{key:"calc",value:function(){var t=this;Wt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"calc",this).call(this);var e=this.state;e.xPositions=[],e.widths=[];var i=0;e.sliceTotals.map((function(n){var s=t.width*n/e.grandTotal;e.widths.push(s),e.xPositions.push(i),i+=s}))}},{key:"makeDataByIndex",value:function(){}},{key:"bindTooltip",value:function(){var t=this,n=this.state;this.container.addEventListener("mousemove",(function(i){var s=t.components.get("percentageBars").store,a=i.target;if(s.includes(a)){var r=s.indexOf(a),o=e(t.container),l=e(a),c=l.left-o.left+parseInt(a.getAttribute("width"))/2,u=l.top-o.top,d=(t.formattedLabels&&t.formattedLabels.length>0?t.formattedLabels[r]:t.state.labels[r])+": ",h=n.sliceTotals[r]/n.grandTotal;t.tip.setValues(c,u,{name:d,value:(100*h).toFixed(1)+"%"}),t.tip.showTip()}}))}}]),n}(ye),Se=function(t){function n(t,e){Jt(this,n);var i=It(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.type="pie",i.initTimeout=0,i.init=1,i.setup(),i}return Rt(n,t),Ft(n,[{key:"configure",value:function(t){Wt(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;Wt(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 i=this.radius,s=this.clockWise,a=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var r=180-this.config.startAngle;e.sliceTotals.map((function(n,o){var l=r,c=n/e.grandTotal*360,u=c>180?1:0,d=s?-c:c,h=r+=d,f=p(l,i),g=p(h,i),m=t.init&&a[o],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,s,u):N(v,y,t.center,t.radius,s,u);e.sliceStrings.push(b),e.slicesProperties.push({startPosition:f,endPosition:g,value:n,total:e.grandTotal,startAngle:l,endAngle:h,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,Yt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,i=p(t.startAngle+t.angle/2,e);return"translate3d("+i.x*n+"px,"+i.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,i,s){if(t){var a=this.colors[n];if(i){ot(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.fill=k(a,50);var r=e(this.svg),o=s.pageX-r.left+10,l=s.pageY-r.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(o,l,{name:c,value:u+"%"}),this.tip.showTip()}else ot(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.fill=a}}},{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,i=this.curActiveSliceIndex,s=this.curActiveSlice;if(n.includes(e)){var a=n.indexOf(e);this.hoverSlice(s,i,!1),this.curActiveSlice=e,this.curActiveSliceIndex=a,this.hoverSlice(e,a,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Te=function(t){function e(t,n){Jt(this,e);var i=It(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));i.type="heatmap",i.countLabel=n.countLabel||"";var s=["Sunday","Monday"],a=s.includes(n.startSubDomain)?n.startSubDomain:"Sunday";return i.startSubDomainIndex=s.indexOf(a),i.setup(),i}return Rt(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,i=this.discreteDomains?12:0;this.independentWidth=12*(gt(n.start,n.end)+i)+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 i=new Date(n*xe);e[pt(i)]=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=_t(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,i=e.domainConfigs.map((function(i,s){return["heatDomain",{index:i.index,colWidth:12,rowHeight:12,squareSize:10,radius:t.rawChartArgs.radius||0,xTranslate:12*e.domainConfigs.filter((function(t,e){return e<s})).map((function(t){return t.cols.length-n})).reduce((function(t,e){return t+e}),0)},function(){return e.domainConfigs[s]}.bind(t)]}));this.components=new Map(i.map((function(t,e){var n=$t.apply(void 0,Yt(t));return[t[0]+"-"+e,n]})));var s=0;ke.forEach((function(e,n){if([1,3,5].includes(n)){var i=R("subdomain-name",-6,s,e,{fontSize:10,dy:8,textAnchor:"end"});t.drawArea.appendChild(i)}s+=12}))}},{key:"update",value:function(t){t||console.error("No data to update."),this.data=this.prepareData(t),this.draw(),this.bindTooltip()}},{key:"bindTooltip",value:function(){var t=this;this.container.addEventListener("mousemove",(function(e){t.components.forEach((function(n){var i=n.store,s=e.target;if(i.includes(s)){var a=s.getAttribute("data-value"),r=s.getAttribute("data-date").split("-"),o=yt(parseInt(r[1])-1,!0),l=t.container.getBoundingClientRect(),c=s.getBoundingClientRect(),u=parseInt(e.target.getAttribute("width")),d=c.left-l.left+u/2,h=c.top-l.top,p=a+" "+t.countLabel,f=" on "+o+" "+r[0]+", "+r[2];t.tip.setValues(d,h,{name:f,value:p,valueFirst:1},[]),t.tip.showTip()}}))}))}},{key:"renderLegend",value:function(){var t=this;this.legendArea.textContent="";var e=0,n=this.rawChartArgs.radius||0,i=R("subdomain-name",e,12,"Less",{fontSize:11,dy:9});e=30,this.legendArea.appendChild(i),this.colors.slice(0,5).map((function(i,s){var a=J("heatmap-legend-unit",e+15*s,12,10,n,i);t.legendArea.appendChild(a)}));var s=R("subdomain-name",e+75+3,12,"More",{fontSize:11,dy:9});this.legendArea.appendChild(s)}},{key:"getDomains",value:function(){for(var t=this.state,e=[t.start.getMonth(),t.start.getFullYear()],n=e[0],i=e[1],s=[t.end.getMonth(),t.end.getFullYear()],a=s[0]-n+1+12*(s[1]-i),r=[],o=ft(t.start),l=0;l<a;l++){var c=t.end;if(!vt(o,t.end)){var u=[o.getMonth(),o.getFullYear()];c=bt(u[0],u[1])}r.push(this.getDomainConfig(o,c)),wt(c,1),o=c}return r}},{key:"getDomainConfig",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=[t.getMonth(),t.getFullYear()],i=n[0],s=n[1],a=xt(t),r={index:i,cols:[]};wt(e=ft(e)||bt(i,s),1);for(var o=gt(a,e),l=[],c=void 0,u=0;u<o;u++)c=this.getCol(a,i),l.push(c),wt(a=new Date(c[be-1].yyyyMmDd),1);return void 0!==c[be-1].dataValue&&(wt(a,1),l.push(this.getCol(a,i,!0))),r.cols=l,r}},{key:"getCol",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.state,s=ft(t),a=[],r=0;r<be;r++,wt(s,1)){var o={},l=s>=i.start&&s<=i.end;n||s.getMonth()!==e||!l?o.yyyyMmDd=pt(s):o=this.getSubDomainConfig(s),a.push(o)}return a}},{key:"getSubDomainConfig",value:function(t){var e=pt(t),n=this.data.dataPoints[e];return{yyyyMmDd:e,dataValue:n||0,fill:this.colors[Nt(n,this.state.distribution)]}}}]),e}(ve),Me=function(t){function n(t,e){Jt(this,n);var i=It(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.barOptions=e.barOptions||{},i.lineOptions=e.lineOptions||{},i.type=e.type||"line",i.init=1,i.setup(),i}return Rt(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){Wt(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=Pt(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"false"),n=this.height/Mt(e),i=Tt(e)*n,s=this.height-St(e)*i;this.state.yAxis={labels:e,positions:e.map((function(t){return s-t*n})),scaleMultiplier:n,zeroLine:s},this.calcDatasetPoints(),this.calcYExtremes(),this.calcYRegions()}},{key:"calcDatasetPoints",value:function(){var t=this.state,e=function(e){return e.map((function(e){return Lt(e,t.yAxis)}))};t.datasets=this.data.datasets.map((function(t,n){var i=t.values,s=t.cumulativeYs||[];return{name:t.name&&t.name.replace(/<|>|&/g,(function(t){return"&"==t?"&":"<"==t?"<":">"})),index:n,chartType:t.chartType,values:i,yPositions:e(i),cumulativeYs:s,cumulativeYPos:e(s)}}))}},{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){e<t.yExtremes[n]&&(t.yExtremes[n]=e)}))})))}},{key:"calcYRegions",value:function(){var t=this.state;this.data.yMarkers&&(this.state.yMarkers=this.data.yMarkers.map((function(e){return e.position=Lt(e.value,t.yAxis),e.options||(e.options={}),e}))),this.data.yRegions&&(this.state.yRegions=this.data.yRegions.map((function(e){return e.startPos=Lt(e.start,t.yAxis),e.endPos=Lt(e.end,t.yAxis),e.options||(e.options={}),e})))}},{key:"getAllYValues",value:function(){var t,e=this,n="values";if(this.barOptions.stacked){n="cumulativeYs";var i=new Array(this.state.datasetLength).fill(0);this.data.datasets.map((function(t,s){var a=e.data.datasets[s].values;t[n]=i=i.map((function(t,e){return t+a[e]}))}))}var s=this.data.datasets.map((function(t){return t[n]}));return this.data.yMarkers&&s.push(this.data.yMarkers.map((function(t){return t.value}))),this.data.yRegions&&this.data.yRegions.map((function(t){s.push([t.end,t.start])})),(t=[]).concat.apply(t,Yt(s))}},{key:"setupComponents",value:function(){var t=this,e=[["yAxis",{mode:this.config.yAxisMode,width:this.width,shortenNumbers:this.config.shortenYAxisNumbers},function(){return this.state.yAxis}.bind(this)],["xAxis",{mode:this.config.xAxisMode,height:this.height},function(){var t=this.state;return t.xAxis.calcLabels=zt(this.width,t.xAxis.labels,this.config.xIsSeries),t.xAxis}.bind(this)],["yRegions",{width:this.width,pos:"right"},function(){return this.state.yRegions}.bind(this)]],n=this.state.datasets.filter((function(t){return"bar"===t.chartType})),i=this.state.datasets.filter((function(t){return"line"===t.chartType})),s=n.map((function(e){var i=e.index;return["barGraph-"+e.index,{index:i,color:t.colors[i],stacked:t.barOptions.stacked,valuesOverPoints:t.config.valuesOverPoints,minHeight:0*t.height},function(){var t=this.state,e=t.datasets[i],s=this.barOptions.stacked,a=this.barOptions.spaceRatio||.5,r=t.unitWidth*(1-a),o=r/(s?1:n.length),l=t.xAxis.positions.map((function(t){return t-r/2}));s||(l=l.map((function(t){return t+o*i})));var c=new Array(t.datasetLength).fill("");this.config.valuesOverPoints&&(c=s&&e.index===t.datasets.length-1?e.cumulativeYs:e.values);var u=new Array(t.datasetLength).fill(0);return s&&(u=e.yPositions.map((function(t,n){return t-e.cumulativeYPos[n]}))),{xPositions:l,yPositions:e.yPositions,offsets:u,labels:c,zeroLine:t.yAxis.zeroLine,barsWidth:r,barWidth:o}}.bind(t)]})),a=i.map((function(e){var n=e.index;return["lineGraph-"+e.index,{index:n,color:t.colors[n],svgDefs:t.svgDefs,heatline:t.lineOptions.heatline,regionFill:t.lineOptions.regionFill,spline:t.lineOptions.spline,hideDots:t.lineOptions.hideDots,hideLine:t.lineOptions.hideLine,valuesOverPoints:t.config.valuesOverPoints},function(){var t=this.state,e=t.datasets[n],i=t.yAxis.positions[0]<t.yAxis.zeroLine?t.yAxis.positions[0]:t.yAxis.zeroLine;return{xPositions:t.xAxis.positions,yPositions:e.yPositions,values:e.values,zeroLine:i,radius:this.lineOptions.dotSize||4}}.bind(t)]})),r=[["yMarkers",{width:this.width,pos:"right"},function(){return this.state.yMarkers}.bind(this)]];e=e.concat(s,a,r);var o=["yMarkers","yRegions"];this.dataUnitComponents=[],this.components=new Map(e.filter((function(e){return!o.includes(e[0])||t.state[e[0]]})).map((function(e){var n=$t.apply(void 0,Yt(e));return(e[0].includes("lineGraph")||e[0].includes("barGraph"))&&t.dataUnitComponents.push(n),[e[0],n]})))}},{key:"makeDataByIndex",value:function(){var t=this;this.dataByIndex={};var e=this.state,n=this.config.formatTooltipX,i=this.config.formatTooltipY;e.xAxis.labels.map((function(s,a){var r=t.state.datasets.map((function(e,n){var s=e.values[a];return{title:e.name,value:s,yPos:e.yPositions[a],color:t.colors[n],formatted:i?i(s):s}}));t.dataByIndex[a]={label:s,formattedLabel:n?n(s):s,xPos:e.xAxis.positions[a],values:r,yExtreme:e.yExtremes[a]}}))}},{key:"bindTooltip",value:function(){var t=this;this.container.addEventListener("mousemove",(function(n){var i=t.measures,s=e(t.container),a=n.pageX-s.left-o(i),l=n.pageY-s.top;l<t.height+r(i)&&l>r(i)?t.mapTooltipXPosition(a):t.tip.hideTip()}))}},{key:"mapTooltipXPosition",value:function(t){var e=this.state;if(e.yExtremes){var n=Ct(t,e.xAxis.positions,!0);if(n>=0){var i=this.dataByIndex[n];this.tip.setValues(i.xPos+this.tip.offset.x,i.yExtreme+this.tip.offset.y,{name:i.formattedLabel,value:""},i.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 i=F(100*n,"0",100,t.colors[n],e.name,t.config.truncateLegends);t.legendArea.appendChild(i)})))}},{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,a(this.parent,"data-select",this.getDataPoint()))}},{key:"addDataPoint",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.state.datasetLength;Wt(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"addDataPoint",this).call(this,t,e,i),this.data.labels.splice(i,0,t),this.data.datasets.map((function(t,n){t.values.splice(i,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||(Wt(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),Le=function(t){function n(t,e){Jt(this,n);var i=It(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,t,e));return i.type="donut",i.initTimeout=0,i.init=1,i.setup(),i}return Rt(n,t),Ft(n,[{key:"configure",value:function(t){Wt(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;Wt(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 i=this.radius,s=this.clockWise,a=e.slicesProperties||[];e.sliceStrings=[],e.slicesProperties=[];var r=180-this.config.startAngle;e.sliceTotals.map((function(n,o){var l=r,c=n/e.grandTotal*360,u=c>180?1:0,d=s?-c:c,h=r+=d,f=p(l,i),g=p(h,i),m=t.init&&a[o],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?z(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:h,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,Yt(t));return[t[0],e]})))}},{key:"calTranslateByAngle",value:function(t){var e=this.radius,n=this.hoverRadio,i=p(t.startAngle+t.angle/2,e);return"translate3d("+i.x*n+"px,"+i.y*n+"px,0)"}},{key:"hoverSlice",value:function(t,n,i,s){if(t){var a=this.colors[n];if(i){ot(t,this.calTranslateByAngle(this.state.slicesProperties[n])),t.style.stroke=k(a,50);var r=e(this.svg),o=s.pageX-r.left+10,l=s.pageY-r.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(o,l,{name:c,value:u+"%"}),this.tip.showTip()}else ot(t,"translate3d(0,0,0)"),this.tip.hideTip(),t.style.stroke=a}}},{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,i=this.curActiveSliceIndex,s=this.curActiveSlice;if(n.includes(e)){var a=n.indexOf(e);this.hoverSlice(s,i,!1),this.curActiveSlice=e,this.curActiveSliceIndex=a,this.hoverSlice(e,a,!0,t)}else this.mouseLeave()}},{key:"mouseLeave",value:function(){this.hoverSlice(this.curActiveSlice,this.curActiveSliceIndex,!1)}}]),n}(ye),Ce={bar:Me,line:Me,percentage:Pe,heatmap:Te,pie:Se,donut:Le},_e=function t(e,n){return Jt(this,t),Ht(n.type,e,n)},Ne=Object.freeze({Chart:_e,PercentageChart:Pe,PieChart:Se,Heatmap:Te,AxisChart:Me}),De={NAME:"Frappe Charts",VERSION:"1.6.2"};return Object.assign({},De,Ne)}()}(We={exports:{}},We.exports),We.exports);function Ie(e){let n,i,s;return{c(){n=m("div")},m(t,a){p(t,n,a),e[18](n),i||(s=w(n,"data-select",e[17]),i=!0)},p:t,i:t,o:t,d(t){t&&f(n),e[18](null),i=!1,s()}}}function Be(t,e,n){let i,{data:s={labels:[],datasets:[{values:[]}],yMarkers:{},yRegions:[]}}=e,{title:a=""}=e,{type:r="line"}=e,{height:o=300}=e,{animate:l=!0}=e,{axisOptions:c={}}=e,{barOptions:u={}}=e,{lineOptions:d={}}=e,{tooltipOptions:h={}}=e,{colors:p=[]}=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 C((()=>{v=new Re.Chart(i,{data:s,title:a,type:r,height:o,animate:l,colors:p,axisOptions:c,barOptions:u,lineOptions:d,tooltipOptions:h,valuesOverPoints:f,isNavigable:g,maxSlices:m})})),function(t){L().$$.on_destroy.push(t)}((()=>{v=null})),t.$$set=t=>{"data"in t&&n(1,s=t.data),"title"in t&&n(2,a=t.title),"type"in t&&n(3,r=t.type),"height"in t&&n(4,o=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,h=t.tooltipOptions),"colors"in t&&n(10,p=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&&$(s)},[i,s,a,r,o,l,c,u,d,h,p,f,g,m,b,x,w,function(e){N.call(this,t,e)},function(t){E[t?"unshift":"push"]((()=>{i=t,n(0,i)}))}]}var Ye=class extends at{constructor(t){super(),st(this,t,Be,Ie,a,{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 qe(e){let n,i,s;return{c(){n=m("button"),n.textContent="Проверить",$(n,"class","btn-lg")},m(t,a){p(t,n,a),i||(s=w(n,"click",e[3]),i=!0)},p:t,d(t){t&&f(n),i=!1,s()}}}function Ue(e){let n,i;return n=new Ye({props:{data:e[0],type:"line"}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),i=!0},p:t,i(t){i||(Z(n.$$.fragment,t),i=!0)},o(t){Q(n.$$.fragment,t),i=!1},d(t){it(n,t)}}}function Ve(t){let e,n,i,s;return e=new Lt({props:{$$slots:{default:[qe]},$$scope:{ctx:t}}}),i=new Lt({props:{$$slots:{default:[Ue]},$$scope:{ctx:t}}}),{c(){et(e.$$.fragment),n=b(),et(i.$$.fragment)},m(t,a){nt(e,t,a),p(t,n,a),nt(i,t,a),s=!0},p(t,[n]){const s={};64&n&&(s.$$scope={dirty:n,ctx:t}),e.$set(s);const a={};64&n&&(a.$$scope={dirty:n,ctx:t}),i.$set(a)},i(t){s||(Z(e.$$.fragment,t),Z(i.$$.fragment,t),s=!0)},o(t){Q(e.$$.fragment,t),Q(i.$$.fragment,t),s=!1},d(t){it(e,t),t&&f(n),it(i,t)}}}function Ge(t){let e=[{ID:"1",description:"lorem"},{ID:"2",description:"impsum"}],n=[{ID:"2",description:"dolor"},{ID:"4",description:"enum"}];return[{labels:["Sun","Mon","Tues","Wed","Thurs","Fri","Sat"],datasets:[{values:[10,12,3,9,8,15,9]}]},e,n,()=>function(t,e){var n=new Set(t.map((t=>t.ID)));let i=[...t,...e.filter((t=>!n.has(t.ID)))];console.log(i)}(e,n)]}class Xe extends at{constructor(t){super(),st(this,t,Ge,Ve,a,{})}}function Ke(t,e,n){const i=t.slice();return i[1]=e[n],i[3]=n,i}function Ze(t){let e,n,i,s=t[1].msg+"";return{c(){e=m("div"),n=y(s),$(e,"class",i=t[1].msg.toString().includes("[E]")?"text-red-500":"text-black")},m(t,i){p(t,e,i),h(e,n)},p(t,a){1&a&&s!==(s=t[1].msg+"")&&O(n,s),1&a&&i!==(i=t[1].msg.toString().includes("[E]")?"text-red-500":"text-black")&&$(e,"class",i)},d(t){t&&f(e)}}}function Qe(t){let e,n=t[0],i=[];for(let e=0;e<n.length;e+=1)i[e]=Ze(Ke(t,n,e));return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=x()},m(t,n){for(let e=0;e<i.length;e+=1)i[e].m(t,n);p(t,e,n)},p(t,s){if(1&s){let a;for(n=t[0],a=0;a<n.length;a+=1){const r=Ke(t,n,a);i[a]?i[a].p(r,s):(i[a]=Ze(r),i[a].c(),i[a].m(e.parentNode,e))}for(;a<i.length;a+=1)i[a].d(1);i.length=n.length}},d(t){g(i,t),t&&f(e)}}}function tn(t){let e,n;return e=new jt({props:{title:"Лог",$$slots:{default:[Qe]},$$scope:{ctx:t}}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,[n]){const i={};17&n&&(i.$$scope={dirty:n,ctx:t}),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function en(t,e,n){let{coreMessages:i}=e;return t.$$set=t=>{"coreMessages"in t&&n(0,i=t.coreMessages)},[i]}class nn extends at{constructor(t){super(),st(this,t,en,tn,a,{coreMessages:0})}}function sn(t,e,n){const i=t.slice();return i[10]=e[n],i[12]=n,i}function an(t){let e,n,i,s,a,r,o,l,c,u,d,g,v,x,w,k,A,P,S,T=t[10].name+"",M=t[10].ip+"",L=t[10].id+"",C=t[10].status?"online":"offline";return P=new pe({props:{i:t[12],click:t[5]}}),{c(){e=m("tr"),n=m("td"),i=y(T),s=b(),a=m("td"),r=m("a"),o=y(M),c=b(),u=m("td"),d=y(L),g=b(),v=m("td"),x=y(C),k=b(),A=m("td"),et(P.$$.fragment),$(n,"class","tbl-bdy-lg ipt-lg w-full"),$(r,"href",l="http://"+t[10].ip),$(a,"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[10].status?"bg-green-50":"bg-red-50")),$(A,"class","tbl-bdy-lg"),$(e,"class","txt-sz txt-pad")},m(t,l){p(t,e,l),h(e,n),h(n,i),h(e,s),h(e,a),h(a,r),h(r,o),h(e,c),h(e,u),h(u,d),h(e,g),h(e,v),h(v,x),h(e,k),h(e,A),nt(P,A,null),S=!0},p(t,e){(!S||1&e)&&T!==(T=t[10].name+"")&&O(i,T),(!S||1&e)&&M!==(M=t[10].ip+"")&&O(o,M),(!S||1&e&&l!==(l="http://"+t[10].ip))&&$(r,"href",l),(!S||1&e)&&L!==(L=t[10].id+"")&&O(d,L),(!S||1&e)&&C!==(C=t[10].status?"online":"offline")&&O(x,C),(!S||1&e&&w!==(w="tbl-bdy-lg ipt-lg w-full "+(t[10].status?"bg-green-50":"bg-red-50")))&&$(v,"class",w)},i(t){S||(Z(P.$$.fragment,t),S=!0)},o(t){Q(P.$$.fragment,t),S=!1},d(t){t&&f(e),it(P)}}}function rn(t){let e,n,s,a,r,o,l,c,u,d,g,v,y;return{c(){e=m("tr"),n=m("td"),s=m("input"),a=b(),r=m("td"),o=m("input"),l=b(),c=m("td"),u=m("input"),d=b(),g=m("td"),$(s,"class","ipt-lg w-full"),$(s,"type","text"),$(n,"class","tbl-bdy-lg"),$(o,"class","ipt-lg w-full"),$(o,"type","text"),$(r,"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(i,f){p(i,e,f),h(e,n),h(n,s),A(s,t[2].name),h(e,a),h(e,r),h(r,o),A(o,t[2].ip),h(e,l),h(e,c),h(c,u),A(u,t[2].id),h(e,d),h(e,g),v||(y=[w(s,"input",t[6]),w(o,"input",t[7]),w(u,"input",t[8])],v=!0)},p(t,e){4&e&&s.value!==t[2].name&&A(s,t[2].name),4&e&&o.value!==t[2].ip&&A(o,t[2].ip),4&e&&u.value!==t[2].id&&A(u,t[2].id)},d(t){t&&f(e),v=!1,i(y)}}}function on(t){let e,n,i,s,a,r,o,l,c,u,d,v=t[1]?"Сохранить":"Добавить устройство",x=t[0],k=[];for(let e=0;e<x.length;e+=1)k[e]=an(sn(t,x,e));const A=t=>Q(k[t],1,1,(()=>{k[t]=null}));let P=t[1]&&rn(t);return{c(){e=m("table"),n=m("thead"),n.innerHTML='<tr class="txt-sz txt-pad"><th class="tbl-hd">Название устройства</th> \n <th class="tbl-hd">IP адрес</th> \n <th class="tbl-hd">Идентификатор</th> \n <th class="tbl-hd">Состояние</th> \n <th class="tbl-hd w-7"></th></tr>',i=b(),s=m("tbody");for(let t=0;t<k.length;t+=1)k[t].c();a=b(),P&&P.c(),r=b(),o=m("button"),l=y(v),$(n,"class","bg-gray-100"),$(s,"class","bg-white"),$(e,"class","tbl"),$(o,"class","btn-lg")},m(f,g){p(f,e,g),h(e,n),h(e,i),h(e,s);for(let t=0;t<k.length;t+=1)k[t].m(s,null);h(s,a),P&&P.m(s,null),p(f,r,g),p(f,o,g),h(o,l),c=!0,u||(d=w(o,"click",t[9]),u=!0)},p(t,e){if(17&e){let n;for(x=t[0],n=0;n<x.length;n+=1){const i=sn(t,x,n);k[n]?(k[n].p(i,e),Z(k[n],1)):(k[n]=an(i),k[n].c(),Z(k[n],1),k[n].m(s,a))}for(X(),n=x.length;n<k.length;n+=1)A(n);K()}t[1]?P?P.p(t,e):(P=rn(t),P.c(),P.m(s,null)):P&&(P.d(1),P=null),(!c||2&e)&&v!==(v=t[1]?"Сохранить":"Добавить устройство")&&O(l,v)},i(t){if(!c){for(let t=0;t<x.length;t+=1)Z(k[t]);c=!0}},o(t){k=k.filter(Boolean);for(let t=0;t<k.length;t+=1)Q(k[t]);c=!1},d(t){t&&f(e),g(k,t),P&&P.d(),t&&f(r),t&&f(o),u=!1,d()}}}function ln(t){let e;return{c(){e=m("p"),e.textContent="Список устройств будет обновляться автоматически. Подключенные к одному роутеру устройства будут появляться в списке в течении двух минут. Ручное добавление сделано в целях проверки для разработчика."},m(t,n){p(t,e,n)},d(t){t&&f(e)}}}function cn(t){let e,n,i,s,a;return n=new jt({props:{title:"Список устройств",$$slots:{default:[on]},$$scope:{ctx:t}}}),s=new Lt({props:{$$slots:{default:[ln]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),i=b(),et(s.$$.fragment),$(e,"class","grd-1col1")},m(t,r){p(t,e,r),nt(n,e,null),h(e,i),nt(s,e,null),a=!0},p(t,[e]){const i={};8207&e&&(i.$$scope={dirty:e,ctx:t}),n.$set(i);const a={};8192&e&&(a.$$scope={dirty:e,ctx:t}),s.$set(a)},i(t){a||(Z(n.$$.fragment,t),Z(s.$$.fragment,t),a=!0)},o(t){Q(n.$$.fragment,t),Q(s.$$.fragment,t),a=!1},d(t){t&&f(e),it(n),it(s)}}}function un(t,e,n){let{deviceList:i}=e,{showInput:s}=e,{newDevice:a={}}=e,{devListSave:r=(()=>{})}=e;function o(t){for(let e=0;e<i.length;e++)if(t===e){i.splice(e,1),n(0,i),console.log("[i]","item "+t+" deleted from dev list");break}}return t.$$set=t=>{"deviceList"in t&&n(0,i=t.deviceList),"showInput"in t&&n(1,s=t.showInput),"newDevice"in t&&n(2,a=t.newDevice),"devListSave"in t&&n(3,r=t.devListSave)},[i,s,a,r,o,t=>o(t),function(){a.name=this.value,n(2,a)},function(){a.ip=this.value,n(2,a)},function(){a.id=this.value,n(2,a)},()=>(n(1,s=!s),r())]}class dn extends at{constructor(t){super(),st(this,t,un,cn,a,{deviceList:0,showInput:1,newDevice:2,devListSave:3})}}function hn(t){let e,n,i,a;return{c(){e=m("textarea"),$(e,"rows","10"),$(e,"class","ipt-big w-full"),$(e,"id","text1"),e.value=n=t[3](JSON.stringify(t[1]))},m(n,r){p(n,e,r),i||(a=w(e,"input",(function(){s(t[0])&&t[0].apply(this,arguments)})),i=!0)},p(i,s){t=i,10&s&&n!==(n=t[3](JSON.stringify(t[1])))&&(e.value=n)},d(t){t&&f(e),i=!1,a()}}}function pn(t){let e,n,i,s,a,r;return i=new jt({props:{title:"Редактор JSON",$$slots:{default:[hn]},$$scope:{ctx:t}}}),{c(){e=m("button"),e.textContent="Toggle modal",n=b(),et(i.$$.fragment),$(e,"type","button")},m(o,l){p(o,e,l),p(o,n,l),nt(i,o,l),s=!0,a||(r=w(e,"click",t[4]),a=!0)},p(t,[e]){const n={};43&e&&(n.$$scope={dirty:e,ctx:t}),i.$set(n)},i(t){s||(Z(i.$$.fragment,t),s=!0)},o(t){Q(i.$$.fragment,t),s=!1},d(t){t&&f(e),t&&f(n),it(i,t),a=!1,r()}}}function fn(t,e,n){let{wigetsUpdate:i}=e,{layoutJson:s}=e,{showModal:a=(()=>{})}=e,{syntaxHighlight:r=(t=>{})}=e;return t.$$set=t=>{"wigetsUpdate"in t&&n(0,i=t.wigetsUpdate),"layoutJson"in t&&n(1,s=t.layoutJson),"showModal"in t&&n(2,a=t.showModal),"syntaxHighlight"in t&&n(3,r=t.syntaxHighlight)},[i,s,a,r,()=>a()]}class gn extends at{constructor(t){super(),st(this,t,fn,pn,a,{wigetsUpdate:0,layoutJson:1,showModal:2,syntaxHighlight:3})}}function mn(e){let n,i,s,a;return{c(){n=v("svg"),i=v("path"),s=v("path"),$(i,"stroke","none"),$(i,"d","M0 0h24v24H0z"),$(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",a="h-8 w-8 "+e[0]),$(n,"width","24"),$(n,"height","24"),$(n,"viewBox","0 0 24 24"),$(n,"stroke-width","2"),$(n,"stroke","currentColor"),$(n,"fill","none"),$(n,"stroke-linecap","round"),$(n,"stroke-linejoin","round")},m(t,e){p(t,n,e),h(n,i),h(n,s)},p(t,[e]){1&e&&a!==(a="h-8 w-8 "+t[0])&&$(n,"class",a)},i:t,o:t,d(t){t&&f(n)}}}function vn(t,e,n){let{color:i}=e;return t.$$set=t=>{"color"in t&&n(0,i=t.color)},[i]}class yn extends at{constructor(t){super(),st(this,t,vn,mn,a,{color:0})}}function bn(t,e,n){const i=t.slice();return i[85]=e[n],i}function xn(t){let e,n,i,s,a=t[85].name+"";return{c(){e=m("option"),n=y(a),i=b(),e.__value=s=t[85].ws,e.value=e.__value},m(t,s){p(t,e,s),h(e,n),h(e,i)},p(t,i){16384&i[0]&&a!==(a=t[85].name+"")&&O(n,a),16384&i[0]&&s!==(s=t[85].ws)&&(e.__value=s,e.value=e.__value)},d(t){t&&f(e)}}}function wn(t){let e,n,i,s,a,r,o,l,c,u,d,h;return e=new Pt({props:{path:"/",$$slots:{default:[kn]},$$scope:{ctx:t}}}),i=new Pt({props:{path:"/config",$$slots:{default:[On]},$$scope:{ctx:t}}}),a=new Pt({props:{path:"/connection",$$slots:{default:[An]},$$scope:{ctx:t}}}),o=new Pt({props:{path:"/utilities",$$slots:{default:[Pn]},$$scope:{ctx:t}}}),c=new Pt({props:{path:"/log",$$slots:{default:[Sn]},$$scope:{ctx:t}}}),d=new Pt({props:{path:"/about",$$slots:{default:[Tn]},$$scope:{ctx:t}}}),{c(){et(e.$$.fragment),n=b(),et(i.$$.fragment),s=b(),et(a.$$.fragment),r=b(),et(o.$$.fragment),l=b(),et(c.$$.fragment),u=b(),et(d.$$.fragment)},m(t,f){nt(e,t,f),p(t,n,f),nt(i,t,f),p(t,s,f),nt(a,t,f),p(t,r,f),nt(o,t,f),p(t,l,f),nt(c,t,f),p(t,u,f),nt(d,t,f),h=!0},p(t,n){const s={};136&n[0]|67108864&n[2]&&(s.$$scope={dirty:n,ctx:t}),e.$set(s);const r={};112&n[0]|67108864&n[2]&&(r.$$scope={dirty:n,ctx:t}),i.$set(r);const l={};768&n[0]|67108864&n[2]&&(l.$$scope={dirty:n,ctx:t}),a.$set(l);const u={};67108864&n[2]&&(u.$$scope={dirty:n,ctx:t}),o.$set(u);const h={};8192&n[0]|67108864&n[2]&&(h.$$scope={dirty:n,ctx:t}),c.$set(h);const p={};128&n[0]|67108864&n[2]&&(p.$$scope={dirty:n,ctx:t}),d.$set(p)},i(t){h||(Z(e.$$.fragment,t),Z(i.$$.fragment,t),Z(a.$$.fragment,t),Z(o.$$.fragment,t),Z(c.$$.fragment,t),Z(d.$$.fragment,t),h=!0)},o(t){Q(e.$$.fragment,t),Q(i.$$.fragment,t),Q(a.$$.fragment,t),Q(o.$$.fragment,t),Q(c.$$.fragment,t),Q(d.$$.fragment,t),h=!1},d(t){it(e,t),t&&f(n),it(i,t),t&&f(s),it(a,t),t&&f(r),it(o,t),t&&f(l),it(c,t),t&&f(u),it(d,t)}}}function $n(e){let n,i;return n=new Lt({props:{title:"Нет соединения"}}),{c(){et(n.$$.fragment)},m(t,e){nt(n,t,e),i=!0},p:t,i(t){i||(Z(n.$$.fragment,t),i=!0)},o(t){Q(n.$$.fragment,t),i=!1},d(t){it(n,t)}}}function kn(t){let e,n;return e=new ue({props:{layoutJson:t[7],pages:t[3],wsPush:t[29]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};128&n[0]&&(i.layoutJson=t[7]),8&n[0]&&(i.pages=t[3]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function On(t){let e,n;return e=new _e({props:{configJson:t[4],widgetsJson:t[5],itemsJson:t[6],saveConfig:t[30]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};16&n[0]&&(i.configJson=t[4]),32&n[0]&&(i.widgetsJson=t[5]),64&n[0]&&(i.itemsJson=t[6]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function An(t){let e,n;return e=new Fe({props:{settingsJson:t[8],ssidJson:t[9],ssidDropdownClick:t[31],saveSettings:t[32]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};256&n[0]&&(i.settingsJson=t[8]),512&n[0]&&(i.ssidJson=t[9]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function Pn(t){let e,n;return e=new Xe({}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function Sn(t){let e,n;return e=new nn({props:{coreMessages:t[13]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};8192&n[0]&&(i.coreMessages=t[13]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function Tn(t){let e,n;return e=new gn({props:{wigetsUpdate:t[18],layoutJson:t[7],showModal:t[33],syntaxHighlight:t[34]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};128&n[0]&&(i.layoutJson=t[7]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function Mn(t){let e,n;return e=new dn({props:{deviceList:t[14],showInput:Cn,devListSave:t[35],newDevice:t[12]}}),{c(){et(e.$$.fragment)},m(t,i){nt(e,t,i),n=!0},p(t,n){const i={};16384&n[0]&&(i.deviceList=t[14]),4096&n[0]&&(i.newDevice=t[12]),e.$set(i)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){Q(e.$$.fragment,t),n=!1},d(t){it(e,t)}}}function Ln(t){let e,n,s,a,r,o,l,c,u,d,v,y,x,k,O,A,S,T,M,L,C,_,N,D,E,z,H,j,J,F,W,I,B,Y,q,U,V,G,tt,st,at,rt,ot,lt,ct,ut,dt,ht,pt,ft,gt;n=new Dt({props:{show:t[2]}});let mt=t[14],vt=[];for(let e=0;e<mt.length;e+=1)vt[e]=xn(bn(t,mt,e));d=new yn({props:{color:!0===t[10]?"text-green-500":"text-red-500"}});const yt=[$n,wn],bt=[];function xt(t,e){return t[10]?1:0}return rt=xt(t),ot=bt[rt]=yt[rt](t),ct=new Pt({props:{path:"/list",$$slots:{default:[Mn]},$$scope:{ctx:t}}}),{c(){e=m("div"),et(n.$$.fragment),s=b(),a=m("header"),r=m("div"),o=m("div"),l=m("select");for(let t=0;t<vt.length;t+=1)vt[t].c();c=b(),u=m("div"),et(d.$$.fragment),v=b(),y=m("nav"),x=m("input"),k=b(),O=m("label"),O.innerHTML="<span></span>",A=b(),S=m("ul"),T=m("li"),M=m("a"),M.textContent="Управление",L=b(),C=m("li"),_=m("a"),_.textContent="Конфигуратор",N=b(),D=m("li"),E=m("a"),E.textContent="Подключение",z=b(),H=m("li"),j=m("a"),j.textContent="Утилиты",J=b(),F=m("li"),W=m("a"),W.textContent="Лог",I=b(),B=m("li"),Y=m("a"),Y.textContent="Устройства",q=b(),U=m("li"),V=m("a"),V.textContent="О проекте",G=b(),tt=m("main"),st=m("ul"),at=m("div"),ot.c(),lt=b(),et(ct.$$.fragment),dt=b(),ht=m("footer"),ht.innerHTML='<div class="flex justify-center content-center text-xxs text-gray-500">Developed by Dmitry Borisenko</div>',$(l,"class","border border-indigo-500 border-4"),void 0===t[11]&&R((()=>t[25].call(l))),$(o,"class","px-15 py-1 z-50 "),$(u,"class","pl-4 pr-4 py-1"),$(r,"class","flex content-center items-center justify-end"),$(a,"class","h-10 w-full bg-gray-100 overflow-auto shadow-md"),$(x,"id","menu__toggle"),$(x,"type","checkbox"),$(O,"class","menu__btn"),$(O,"for","menu__toggle"),$(M,"class","menu__item"),$(M,"href","/"),$(_,"class","menu__item"),$(_,"href","/config"),$(E,"class","menu__item"),$(E,"href","/connection"),$(j,"class","menu__item"),$(j,"href","/utilities"),$(W,"class","menu__item"),$(W,"href","/log"),$(Y,"class","menu__item"),$(Y,"href","/list"),$(V,"class","menu__item"),$(V,"href","/about"),$(S,"class","menu__box"),$(y,"class","flex"),$(at,"class","bg-cover pt-0 px-4"),$(st,"class","menu__main"),$(tt,"class",ut="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")),$(ht,"class","h-4 bg-gray-100 border-gray-200 shadow-lg"),$(e,"class","flex flex-col h-screen bg-gray-50")},m(i,f){p(i,e,f),nt(n,e,null),h(e,s),h(e,a),h(a,r),h(r,o),h(o,l);for(let t=0;t<vt.length;t+=1)vt[t].m(l,null);P(l,t[11]),h(r,c),h(r,u),nt(d,u,null),h(e,v),h(e,y),h(y,x),x.checked=t[0],h(y,k),h(y,O),h(y,A),h(y,S),h(S,T),h(T,M),h(S,L),h(S,C),h(C,_),h(S,N),h(S,D),h(D,E),h(S,z),h(S,H),h(H,j),h(S,J),h(S,F),h(F,W),h(S,I),h(S,B),h(B,Y),h(S,q),h(S,U),h(U,V),h(e,G),h(e,tt),h(tt,st),h(st,at),bt[rt].m(at,null),h(at,lt),nt(ct,at,null),h(e,dt),h(e,ht),pt=!0,ft||(gt=[w(l,"change",t[25]),w(l,"change",t[26]),w(x,"change",t[27]),w(x,"change",t[28])],ft=!0)},p(t,e){const i={};if(4&e[0]&&(i.show=t[2]),n.$set(i),16384&e[0]){let n;for(mt=t[14],n=0;n<mt.length;n+=1){const i=bn(t,mt,n);vt[n]?vt[n].p(i,e):(vt[n]=xn(i),vt[n].c(),vt[n].m(l,null))}for(;n<vt.length;n+=1)vt[n].d(1);vt.length=mt.length}18432&e[0]&&P(l,t[11]);const s={};1024&e[0]&&(s.color=!0===t[10]?"text-green-500":"text-red-500"),d.$set(s),1&e[0]&&(x.checked=t[0]);let a=rt;rt=xt(t),rt===a?bt[rt].p(t,e):(X(),Q(bt[a],1,1,(()=>{bt[a]=null})),K(),ot=bt[rt],ot?ot.p(t,e):(ot=bt[rt]=yt[rt](t),ot.c()),Z(ot,1),ot.m(at,lt));const r={};20480&e[0]|67108864&e[2]&&(r.$$scope={dirty:e,ctx:t}),ct.$set(r),(!pt||3&e[0]&&ut!==(ut="flex-1 overflow-y-auto p-0 "+(!0!==t[0]||t[1]?"ml-0":"ml-36")))&&$(tt,"class",ut)},i(t){pt||(Z(n.$$.fragment,t),Z(d.$$.fragment,t),Z(ot),Z(ct.$$.fragment,t),pt=!0)},o(t){Q(n.$$.fragment,t),Q(d.$$.fragment,t),Q(ot),Q(ct.$$.fragment,t),pt=!1},d(t){t&&f(e),it(n),g(vt,t),it(d),bt[rt].d(),it(ct),ft=!1,i(gt)}}}let Cn=!1;function _n(t,e,n){let i;r(t,bt,(t=>n(56,i=t))),bt.mode.hash();let s,a=!1,o=!1,l=document.location.hostname,c=!1,u=[],d=[],h=!1,p=[],f=!1,g=[],m=!1,v=[],y=!1,b={},x=!1,w={},$=[],k=!1,O=0,A=!0,P={},T=[];T=[{name:"--",id:"--",ip:l,status:!1}];let M=[];var L=function(){this.parts=[]};let _;L.prototype.append=function(t){this.parts.push(t),this.blob=void 0},L.prototype.getBlob=function(){return this.blob||(this.blob=new Blob(this.parts,{type:"binary"})),this.blob},L.prototype.clear=function(){this.parts=[]};var N=new L,D=new L,E=new L,z=new L,H=new L;function j(){void 0!==O&&G(O,_)}function J(){tt(O);let t=0;T.forEach((e=>{e.ws=t,e.status||(W(t),I(t)),t++})),n(14,T)}function F(t,e){T.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(14,T),tt(O),n(10,k=s.status)}function W(t){let e=R(t);"error"===e?console.log("[e]","device list wrong"):($[t]=new WebSocket("ws://"+e+":81"),$.binaryType="blob",console.log("[i]",e,"started connecting..."))}function R(t){let e="error";return T.forEach((n=>{t===n.ws&&(e=n.ip)})),e}function I(t){if($[t]){let e=R(t);console.log("[i]",e,"web socket events added"),$[t].addEventListener("open",(function(n){console.log("[i]",e,"completed connecting"),F(t,!0),j()})),$[t].addEventListener("message",(function(t){if("string"==typeof t.data){let r=t.data;if(r.includes("status")&&it(r)){let t=JSON.parse(r);!function(t){for(let e=0;e<v.length;e++){if(v[e].topic===t.topic){n(7,v[e].status=t.status,v);break}}}(t),K(),console.log("[i]","statusJson parced: ",t)}if(r.includes("params")&&it(r)){let t=JSON.parse(r);console.log("[i]","paramsJson parced: ",t)}if(r.includes("ssid")&&it(r)&&(n(9,w=JSON.parse(r)),delete w.ssid,n(9,w),console.log("[i]","ssidJson parced")),r.includes("devicelist")&&it(r)&&(M=JSON.parse(r),delete M.devicelist,M=M,n(14,(i=T,s=M,a=new Set(i.map((t=>t.ip))),T=[...i,...s.filter((t=>!a.has(t.ip)))])),n(14,T),Z(),J(),console.log("[i]","incDeviceList json parced",M)),"/st/config.json"===r&&(h=!0),"/end/config.json"===r){h=!1;var e=N.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;it(e)&&(n(4,d=JSON.parse(e)),n(4,d),console.log("[ii]","configJson parced!"))}}if("/st/widgets.json"===r&&(f=!0),"/end/widgets.json"===r){f=!1;e=D.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;it(e)&&(n(5,p=JSON.parse(e)),n(5,p),console.log("[ii]","widgetsJson parced!"))}}if("/st/items.json"===r&&(m=!0),"/end/items.json"===r){m=!1;e=E.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;it(e)&&(n(6,g=JSON.parse(e)),n(6,g),console.log("[ii]","itemsJson parced!"))}}if("/st/layout.json"===r&&(y=!0),"/end/layout.json"===r){y=!1;e=z.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;it(e)&&(n(7,v=JSON.parse(e)),n(7,v),K(),console.log("[ii]","layoutJson parced!"))}}if("/st/settings.json"===r&&(x=!0),"/end/settings.json"===r){x=!1;e=H.getBlob();let t=new FileReader;t.readAsText(e),t.onload=()=>{let e=t.result;it(e)&&(n(8,b=JSON.parse(e)),n(8,b),K(),function(){for(let t=0;t<T.length;t++){let e=T[t];if(e.ip===l){e.name=b.name,e.id=b.id,n(8,b);break}}}(),console.log("[ii]","settingsJson parced!"))}}}var i,s,a;t.data instanceof Blob&&(h&&N.append(t.data),f&&D.append(t.data),m&&E.append(t.data),y&&z.append(t.data),x&&H.append(t.data))})),$[t].addEventListener("close",(n=>{console.log("[e]",e,"connection closed"),F(t,!1)})),$[t].addEventListener("error",(function(n){console.log("[e]",e,"connection error"),F(t,!1)}))}else console.log("[e]","socket not exist")}function B(){G(O,"/tuoyal"+JSON.stringify(function(){let t=[];for(let e=0;e<d.length;e++){let n=Object.assign({},d[e]),i=n.widget,s=!0;for(let e=0;e<p.length;e++){if(i===p[e].name){let i=Object.assign({},p[e]);i.page=n.page,i.descr=n.descr,i.topic=b.root+"/"+n.id,t.push(i),s=!1;break}s=!0}s&&console.log("[e]","error, widget not found: "+i)}return console.log("[i] layout:",JSON.stringify(t)),t}())),G(O,"/gifnoc"+JSON.stringify(d)),q(),j()}function Y(){G(O,"/cennoc"+JSON.stringify(b)),q(),j()}function q(){n(4,d=[]),N.clear(),n(5,p=[]),D.clear(),n(6,g=[]),E.clear(),n(7,v=[]),z.clear(),n(8,b={}),H.clear(),console.log("[i]","all app data cleared")}function U(t,e,n){let i=e+" "+n;console.log("[i]","send to ws msg:",i),G(t,i)}function V(){setTimeout(V,3e4),console.log("[i]","----timer tick----"),A||T.forEach((t=>{!function(t){let e=!1;return T.forEach((n=>{t===n.ws&&(e=n.status)})),e}(t.ws)?(W(t.ws),I(t.ws)):G(t.ws,"tst")})),A=!1}function G(t,e){$[t]&&1===$[t].readyState?($[t].send(e),console.log("[i]",R(t),"msg send success",e)):console.log("[e]",R(t),"msg not send",e)}function X(){n(3,u=[]);Array.from(new Set(Array.from(v,(({page:t})=>t)))).forEach((function(t,e,i){n(3,u=[...u,JSON.parse(JSON.stringify({page:t}))])})),u.sort((function(t,e){return t.page<e.page?-1:t.page>e.page?1:0}))}function K(){X()}function Z(){tt(O),n(10,k=s.status)}function Q(){Z(),q(),j(),console.log("[i]","user selected device:",s.name),s.ip===l&&console.log("[i]","user selected original device",s.name)}function tt(t){for(let e=0;e<T.length;e++){let n=T[e];if(n.ws===t){s=n;break}}}function et(){void 0!==P.name&&void 0!==P.ip&&void 0!==P.id?(n(12,P.status=!1,P),T.push(P),n(14,T),n(12,P={}),Z(),J(),console.log("[i]","selected device:",s)):console.log("[e]","wrong data")}bt.subscribe((function(){q(),_=i.path.toString(),console.log("[i]","user on page:",_),j()}));const nt=t=>{try{t=JSON.stringify(JSON.parse(t),null,4)}catch(e){return t}return t=(t=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")).replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g,(function(t){return t}))};function it(t){try{JSON.parse(t)}catch(t){return console.log("[e]","json error"),!1}return!0}function st(){n(2,c=!c)}function at(){let t=screen.width;console.log("width",t),n(1,o=t<900)}function rt(){G(O,"/scan")}C((async()=>{console.log("[i]","mounted"),J(),V(),Z(),X()}));return[a,o,c,u,d,p,g,v,b,w,k,O,P,[],T,B,Y,U,K,Q,et,nt,st,at,rt,function(){O=S(this),n(11,O),n(14,T)},()=>Q(),function(){a=this.checked,n(0,a)},()=>at(),(t,e,n)=>U(t,e,n),()=>B(),()=>rt(),()=>Y(),()=>st(),t=>nt(t),()=>et()]}return new class extends at{constructor(t){super(),st(this,t,_n,Ln,a,{},null,[-1,-1,-1])}}({target:document.body,props:{name:"world"}})}();
|
||
//# sourceMappingURL=bundle.js.map
|