import{d as m,r as u,i as _,_ as k,a,c as s,t as r,e as l,b as t,q as f,u as y}from"./index-b1308428.js";const S=m({setup(){const e=u(_("updateStore")),o=u(_("websocket")),c=u(!1),i=u(!1);return{updateStore:e,attemptingUpdate:c,checkingUpdate:i,updateHasInfo:p=>(p.update&&p.update.completed&&setTimeout(()=>e.value={},4e3),!!(p.error||p.update)),checkUpdate:()=>{i.value=!0,o.value.send(JSON.stringify({type:"updater",updater:"check"}))},attemptUpdate:()=>{o.value.send(JSON.stringify({type:"updater",updater:"update"})),c.value=!0,setTimeout(()=>{window.location.replace("/")},5e3)}}}});const d=e=>(f("data-v-4eaf52ae"),e=e(),y(),e),U={key:0,class:"update-btn-container"},N={key:0},b={key:1,class:"dot-loading"},g=d(()=>t("div",{className:"dot dot1"},null,-1)),I=d(()=>t("div",{className:"dot dot2"},null,-1)),w=d(()=>t("div",{className:"dot dot3"},null,-1)),C=d(()=>t("div",{className:"dot dot4"},null,-1)),$=[g,I,w,C],B={key:1,class:"update-btn ready-btn",style:{cursor:"default"}},H={key:2,class:"update-btn failed-btn"},F={key:1,class:"update-btn-container"},J={key:0},T={key:1,class:"dot-loading"},V=d(()=>t("div",{className:"dot dot1"},null,-1)),q=d(()=>t("div",{className:"dot dot2"},null,-1)),D=d(()=>t("div",{className:"dot dot3"},null,-1)),E=d(()=>t("div",{className:"dot dot4"},null,-1)),z=[V,q,D,E];function A(e,o,c,i,v,h){return e.updateHasInfo(e.updateStore)?(a(),s("div",U,[e.updateStore.update&&!e.updateStore.update.completed?(a(),s("div",{key:0,class:"update-btn ready-btn",onClick:o[0]||(o[0]=(...n)=>e.attemptUpdate&&e.attemptUpdate(...n))},[e.attemptingUpdate?(a(),s("span",b,$)):(a(),s("span",N,"Update to v"+r(e.updateStore.update.version),1))])):l("",!0),e.updateStore.update&&e.updateStore.update.completed?(a(),s("div",B,[t("span",null,"🎉 Updated to v"+r(e.updateStore.update.version)+" 🎉",1)])):l("",!0),e.updateStore.error?(a(),s("div",H,[t("span",null,r(e.updateStore.error),1)])):l("",!0)])):(a(),s("div",F,[t("div",{class:"update-btn check-btn",onClick:o[1]||(o[1]=(...n)=>e.checkUpdate&&e.checkUpdate(...n))},[e.checkingUpdate?(a(),s("span",T,z)):(a(),s("span",J,"Check for updates"))])]))}const K=k(S,[["render",A],["__scopeId","data-v-4eaf52ae"]]);export{K as default};
