import{c as s}from"./_plugin-vue_export-helper-63b51ba4.js";import{N as l}from"./Navbar-4fa05ff0.js";const r=s({components:{Navbar:l},data(){return{closeAppPressed:!1,closeAppStatus:null,unpairAllPressed:!1,unpairAllStatus:null,restartPressed:!1,logs:"Loading...",logFilter:null,logInterval:null}},computed:{actualLogs(){if(!this.logFilter)return this.logs;let t=this.logs.split(`
`);return t=t.filter(e=>e.indexOf(this.logFilter)!=-1),t.join(`
`)}},created(){this.logInterval=setInterval(()=>{this.refreshLogs()},5e3),this.refreshLogs()},beforeDestroy(){clearInterval(this.logInterval)},methods:{refreshLogs(){fetch("/api/logs").then(t=>t.text()).then(t=>{this.logs=t})},closeApp(){this.closeAppPressed=!0,fetch("/api/apps/close",{method:"POST"}).then(t=>t.json()).then(t=>{this.closeAppPressed=!1,this.closeAppStatus=t.status.toString()==="true",setTimeout(()=>{this.closeAppStatus=null},5e3)})},unpairAll(){this.unpairAllPressed=!0,fetch("/api/clients/unpair",{method:"POST"}).then(t=>t.json()).then(t=>{this.unpairAllPressed=!1,this.unpairAllStatus=t.status.toString()==="true",setTimeout(()=>{this.unpairAllStatus=null},5e3)})},copyLogs(){navigator.clipboard.writeText(this.actualLogs)},restart(){this.restartPressed=!0,setTimeout(()=>{this.restartPressed=!1},5e3),fetch("/api/restart",{method:"POST"})}}});r.mount("#app");
