diff --git a/webclient/dist/js/main.js b/webclient/dist/js/main.js index 12f8a89..bcb6aaa 100644 --- a/webclient/dist/js/main.js +++ b/webclient/dist/js/main.js @@ -1,4 +1,4 @@ -(()=>{var Y=Object.defineProperty;var A=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var H=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))W.call(e,t)&&H(r,t,e[t]);if(A)for(var t of A(e))G.call(e,t)&&H(r,t,e[t]);return r};var N=(r,e,t)=>new Promise((s,i)=>{var a=o=>{try{c(t.next(o))}catch(u){i(u)}},n=o=>{try{c(t.throw(o))}catch(u){i(u)}},c=o=>o.done?s(o.value):Promise.resolve(o.value).then(a,n);c((t=t.apply(r,e)).next())});var v,y;function K(){v.dataset.navState="displayed",v.classList.remove("state-off"),v.classList.add("state-on"),y.classList.add("a-show")}function R(){v.dataset.navState="hidden",v.classList.remove("state-on"),v.classList.add("state-off"),y.classList.add("a-hide"),y.classList.remove("a-show"),setTimeout(()=>{y.classList.remove("a-hide")},300)}function M(){console.log("HUD init"),v=document.querySelector(".hud .nav-toggle"),y=document.querySelector(".hud .navigation"),v.addEventListener("click",r=>{r.currentTarget.dataset.navState!="displayed"?K():R()})}var w=class{constructor(e,t,s){this.screens={},this.routesMap={},this.currentScreen=null,this.eventsHandlers={switch:[]},this.screensContainer=document.querySelector(e),this.loader=document.querySelector(t),this.errorScreen=document.querySelector(s),console.log("Screens Init")}add(e,t){if(typeof t!="object")return console.error("Screens: screens must be object");if(typeof(t==null?void 0:t.alias)=="undefined")return console.error("Screens: undefined alias");if(typeof(t==null?void 0:t.renderer)!="function")return console.error("Screens: renderer must be function");this.screens[t.alias]=g({route:e},t),this.routesMap[e]=t.alias}switch(e){var s;if(this.runSwitchHandlers(e),this.hideErrorScreen(),this.showLoader(),(s=this.currentScreen)==null||s.DOMObject.remove(),typeof this.screens[e]=="undefined"){console.error(`Screens: "${e}" not found`);return}this.currentScreen=this.screens[e];let t=document.createElement("div");t.classList.add("screen"),t.id=e,t.dataset.alias=e,t.innerHTML=this.currentScreen.renderer(),this.currentScreen.DOMObject=t,this.screensContainer.append(this.currentScreen.DOMObject),this.currentScreen.initer(this)}routing(){setInterval(()=>{let e=document.location.hash.split("#!")[1];if(typeof e=="undefined"||e=="")return;let t=typeof this.routesMap[e]=="undefined"?"not-found-screen":this.routesMap[e];(!this.currentScreen||this.currentScreen.alias!=t)&&this.switch(t)},50)}ready(){this.currentScreen!=null&&(this.currentScreen.DOMObject||(this.currentScreen.DOMObject=document.getElementsById(this.currentScreen.alias)),this.hideLoader(),this.currentScreen.DOMObject.classList.add("a-show"))}error(e,t){var s;(s=this.currentScreen)==null||s.DOMObject.remove(),this.errorScreen.querySelector(".error-title").innerHTML=e,this.errorScreen.querySelector(".error-text").innerHTML=t,this.showErrorScreen()}hideLoader(){this.loader.classList.remove("a-show")}showLoader(){this.loader.classList.add("a-show")}showErrorScreen(){this.errorScreen.classList.add("a-show")}hideErrorScreen(){this.errorScreen.classList.remove("a-show")}getScreens(){return this.screens}getRoutesMap(){return this.routesMap}onSwitch(e){this.eventsHandlers.switch.push(e)}runSwitchHandlers(e){for(let t of this.eventsHandlers.switch)t(this,e)}};function Q(r,e,t,s){return` +(()=>{var Y=Object.defineProperty;var D=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var A=(r,e,t)=>e in r?Y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e)=>{for(var t in e||(e={}))W.call(e,t)&&A(r,t,e[t]);if(D)for(var t of D(e))G.call(e,t)&&A(r,t,e[t]);return r};var N=(r,e,t)=>new Promise((s,i)=>{var a=o=>{try{c(t.next(o))}catch(d){i(d)}},n=o=>{try{c(t.throw(o))}catch(d){i(d)}},c=o=>o.done?s(o.value):Promise.resolve(o.value).then(a,n);c((t=t.apply(r,e)).next())});var v,S;function K(){v.dataset.navState="displayed",v.classList.remove("state-off"),v.classList.add("state-on"),S.classList.add("a-show")}function R(){v.dataset.navState="hidden",v.classList.remove("state-on"),v.classList.add("state-off"),S.classList.add("a-hide"),S.classList.remove("a-show"),setTimeout(()=>{S.classList.remove("a-hide")},300)}function M(){console.log("HUD init"),v=document.querySelector(".hud .nav-toggle"),S=document.querySelector(".hud .navigation"),v.addEventListener("click",r=>{r.currentTarget.dataset.navState!="displayed"?K():R()})}var w=class{constructor(e,t,s){this.screens={},this.routesMap={},this.currentScreen=null,this.eventsHandlers={switch:[],reload:[]},this.screensContainer=document.querySelector(e),this.loader=document.querySelector(t),this.errorScreen=document.querySelector(s),console.log("Screens Init")}add(e,t){if(typeof t!="object")return console.error("Screens: screens must be object");if(typeof(t==null?void 0:t.alias)=="undefined")return console.error("Screens: undefined alias");if(typeof(t==null?void 0:t.renderer)!="function")return console.error("Screens: renderer must be function");this.screens[t.alias]=g({route:e},t),this.routesMap[e]=t.alias}switch(e){var s;if(this.runSwitchHandlers(e),this.hideErrorScreen(),this.showLoader(),(s=this.currentScreen)==null||s.DOMObject.remove(),typeof this.screens[e]=="undefined"){console.error(`Screens: "${e}" not found`);return}this.currentScreen=this.screens[e];let t=document.createElement("div");t.classList.add("screen"),t.id=e,t.dataset.alias=e,t.innerHTML=this.currentScreen.renderer(),this.currentScreen.DOMObject=t,this.screensContainer.append(this.currentScreen.DOMObject),this.currentScreen.initer(this)}reload(){this.currentScreen&&(this.runReloadHandlers(alias),this.switch(this.currentScreen.alias))}routing(){setInterval(()=>{let e=document.location.hash.split("#!")[1];if(typeof e=="undefined"||e=="")return;let t=typeof this.routesMap[e]=="undefined"?"not-found-screen":this.routesMap[e];(!this.currentScreen||this.currentScreen.alias!=t)&&this.switch(t)},50)}ready(){this.currentScreen!=null&&(this.currentScreen.DOMObject||(this.currentScreen.DOMObject=document.getElementsById(this.currentScreen.alias)),this.hideLoader(),this.currentScreen.DOMObject.classList.add("a-show"))}error(e,t){var s;(s=this.currentScreen)==null||s.DOMObject.remove(),this.errorScreen.querySelector(".error-title").innerHTML=e,this.errorScreen.querySelector(".error-text").innerHTML=t,this.showErrorScreen()}hideLoader(){this.loader.classList.remove("a-show")}showLoader(){this.loader.classList.add("a-show")}showErrorScreen(){this.errorScreen.classList.add("a-show")}hideErrorScreen(){this.errorScreen.classList.remove("a-show")}getScreens(){return this.screens}getRoutesMap(){return this.routesMap}onSwitch(e){this.eventsHandlers.switch.push(e)}onReaload(e){this.eventsHandlers.reload.push(e)}runSwitchHandlers(e){for(let t of this.eventsHandlers.switch)t(this,e)}runReloadHandlers(e){for(let t of this.eventsHandlers.reload)t(this,e)}};function Q(r,e,t,s){return`