import{c as e,r as a,p as s,n as r,aD as l,x as n,q as t,M as i,A as u,y as o,z as v,e as c,B as m,C as p,D as f,ax as d,aY as g}from"./base-lib.js?v=1761009159";import{fk as y,K as b,fz as w,fA as _,_ as h}from"./utils-lib.js?v=1761009159";const x={class:"text-[1.3rem]"},k=["innerHTML"],M=h(e({__name:"version-compare",setup(e){const h=a(!1),M=a(!1),A=a(!1),{version:V,cloudVersionInfo:j,getInfo:C,getCloudVersionInfo:I}=y(),T=()=>{j.value&&j.value.version&&""!==j.value.version.trim()?h.value=!((e,a)=>{const{versionArr:s,cloudVersionArr:r}=_(e,a);for(let l=0;l<s.length;l++){const e=s[l],a=r[l];if(e>a)return!0;if(e<a)return!1}return!0})(V.value,j.value.version):h.value=!1},q=()=>{b({loading:"更新中...",request:w(),message:!0,success:async()=>{await C(),await I(),T()}})};return s((async()=>{T(),await r(),setTimeout((()=>{(async()=>{if(!A.value&&!M.value){M.value=!0;try{await I(),A.value||T()}catch(e){A.value||(h.value=!1)}finally{A.value||(M.value=!1)}}})()}),100)})),l((()=>{A.value=!0})),(e,a)=>{const s=f,r=d,l=g;return n(h)?(t(),i(l,{key:0,type:"warning",class:"!mb-[1.2rem] !p-[1.2rem]",closable:!1,"show-icon":""},{title:u((()=>{var e,l,f;return[o("span",x,[o("span",null," 提示：有一个新版本（"+v(null==(e=n(j))?void 0:e.version)+"）可更新，更新时间："+v(null==(l=n(j))?void 0:l.uptime),1),c(s,{class:"!ml-[1.2rem]",type:"primary",onClick:q},{default:u((()=>a[0]||(a[0]=[m("立即更新")]))),_:1}),(null==(f=n(j))?void 0:f.updateMsg)?(t(),i(r,{key:0,placement:"bottom-start",width:"200",trigger:"hover"},{default:u((()=>{var e;return[o("div",{class:"update-details",innerHTML:null==(e=n(j))?void 0:e.updateMsg},null,8,k)]})),reference:u((()=>a[1]||(a[1]=[o("span",{class:"!ml-[1.2rem] bt-link text-[12px]"},"详情",-1)]))),_:1})):p("v-if",!0)])]})),_:1})):p("v-if",!0)}}}),[["__file","/Users/chudong/project/linux-10/src/views/vhost/public/version-compare.vue"]]);export{M as V};
