import{c as n}from"./_plugin-vue_export-helper-63b51ba4.js";import{N as r}from"./Navbar-4fa05ff0.js";import{R as l}from"./ResourceCard-85906521.js";console.log("Hello, Sunshine!");let o=n({components:{Navbar:r,ResourceCard:l},data(){return{version:null,githubVersion:null,nightlyData:null,loading:!0,logs:null}},async created(){try{this.version=(await fetch("/api/config").then(t=>t.json())).version,this.githubVersion=await fetch("https://api.github.com/repos/LizardByte/Sunshine/releases/latest").then(t=>t.json()),this.buildVersionIsNightly&&(this.nightlyData=(await fetch("https://api.github.com/repos/LizardByte/Sunshine/actions/workflows/CI.yml/runs?branch=nightly&event=push&exclude_pull_requests=true&per_page=1").then(t=>t.json())).workflow_runs[0])}catch{}try{this.logs=await fetch("/api/logs").then(t=>t.text())}catch(t){console.error(t)}this.loading=!1},computed:{stableBuildAvailable(){if(!this.githubVersion||!this.version)return!1;let t=this.githubVersion.name;if(t.indexOf("v")===0&&(t=t.substring(1)),this.buildVersionIsNightly||this.buildVersionIsDirty){const i=this.version.split(".").slice(0,3).join(".");return this.githubVersion.tag_name.substring(1)>i}return t!==this.version},nightlyBuildAvailable(){var i;if(!this.nightlyData||this.buildVersionIsStable||this.buildVersionIsDirty)return!1;let t=(i=this.version)==null?void 0:i.split(".").pop();return this.nightlyData.head_sha.indexOf(t)!==0},buildVersionIsDirty(){var t;return((t=this.version)==null?void 0:t.split(".").length)===5&&this.version.indexOf("dirty")!==-1},buildVersionIsNightly(){var t;return((t=this.version)==null?void 0:t.split(".").length)===4},buildVersionIsStable(){var t;return((t=this.version)==null?void 0:t.split(".").length)===3},fancyLogs(){if(!this.logs)return[];let t=/(\[\d{4}:\d{2}:\d{2}:\d{2}:\d{2}:\d{2}\]):\s/g,i=this.logs.split(t).splice(1),s=[];for(let e=0;e<i.length;e+=2)s.push({timestamp:i[e],level:i[e+1].split(":")[0],value:i[e+1]});return s}}});o.mount("#app");
