import{_ as e}from"./index119.js?v=1761009159";import{F as a,b as s}from"./utils-lib.js?v=1761009159";import{c as t,w as o,r as c,q as l,aF as m,v as n,x as r,e as i,y as u}from"./base-lib.js?v=1761009159";import{getLines as p}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const v={class:"flex-wrap"},d=t({__name:"log",props:{compData:{default:()=>({type:"scan",endMsg:"扫描结束",logPath:"",successMsg:"修复成功",isClear:!1,completeEvent:null,failMsg:""})}},emits:["close"],setup(t,{expose:d,emit:g}){const f=t,D=s();o(()=>f.compData,e=>{y.value=!0,j()});const M=g,x=c("获取中..."),y=c(!0),_=c(null),j=async()=>{try{const e=await p({num:20,filename:f.compData.logPath});if(x.value!==e.msg&&(x.value=e.msg),""!==f.compData.failMsg&&-1!==e.msg.indexOf(f.compData.failMsg))return y.value=!1,f.compData.completeEvent?(w(),void f.compData.completeEvent(!1,()=>{M("close")})):(D.error("失败"),void w());if(-1!==e.msg.indexOf(f.compData.endMsg))return y.value=!1,f.compData.completeEvent?(f.compData.completeEvent(!0,()=>{M("close")}),void w()):("repair"===f.compData.type?(M("close"),D.msg({dangerouslyUseHTMLString:!0,message:"修复完成，请按 Ctrl+F5 刷新缓存，或等待2s自动刷新！",type:"success",duration:2e3}),setTimeout(()=>{a(),window.location.reload()},2e3)):"scan"===f.compData.type?D.success("扫描已结束"):(D.success(f.compData.successMsg),M("close")),void w());-1===e.msg.indexOf(f.compData.endMsg)&&y.value&&(_.value=setTimeout(function(){j()},1500)),e.status||(D.request(e),y.value=!1)}catch(e){y.value&&j()}},w=()=>{_.value&&clearTimeout(_.value)};return l(()=>{j()}),m(()=>{w()}),d({onCancel:()=>{f.compData.isClear&&clearTimeout(_.value)}}),(a,s)=>{const t=e;return n(),r("div",v,[i(t,{class:"h-[40rem] !rounded-none",content:u(x)},null,8,["content"])])}}});export{d as default};
