import{_ as F}from"./DUdsNlI7.js";import{_ as L}from"./Ciyi0QpJ.js";import{_ as A}from"./C6dnZmu6.js";import{d as E,P as G,bc as W,r as V,bd as Y,N as Z,R as q,o as m,m as g,aa as z,f as a,t as $,p as w,F as B,i as n,h as H,j as u,k as h,l as M,v as p,V as J,Y as K,_ as O,Z as Q,be as X,ab as ee,a as te,as as ae,at as se,bf as ne,bb as oe}from"./CCqMIw4K.js";const le={key:0},re={p4:"",flex:"~ col gap-1"},ue={class:"text-lg font-medium leading-6"},ie=h("p",{op50:""}," The following command will be executed in your terminal: ",-1),ce={flex:"~ gap-3",mt2:"","justify-end":""},ve=E({__name:"NpmVersionCheck",props:{packageName:{},options:{},showVersion:{type:Boolean,default:!0}},setup(l){const t=l,e=G(),{info:s,update:i,state:y,processId:k,restart:d}=W(t.packageName,t.options),f=V(!0),_=V(!0),R=Y(),b=Z(),U=q();async function N(){const r=await i(async o=>b.start(o));J("npm:update",{packageName:t.packageName,oldVersion:s.value?.current}),r&&_.value&&R.value.push({id:r,message:`${t.packageName} has been updated. Do you want to restart the Nuxt server now?`}),r&&f.value&&(U.value=r,e.push("/modules/terminals"))}return(r,o)=>{const C=F,S=L,x=A,T=K,P=O,I=Q;return m(),g(B,null,[z(r.$slots,"default",{id:a(k),info:a(s),update:N,state:a(y),restart:a(d)},()=>[a(s)&&r.showVersion?(m(),g("code",le,$(`v${a(s).current}`),1)):w("",!0),a(s)?.latest?(m(),g(B,{key:1},[a(s).needsUpdate?(m(),g("button",{key:0,onClick:o[0]||(o[0]=v=>N())},[n(C,{n:"green",title:"updates available",textContent:"updates available"})])):(m(),H(C,{key:1,n:"gray",title:"latest",textContent:"latest"}))],64)):w("",!0)]),n(a(b),null,{default:u(({resolve:v,args:j})=>[n(I,{"model-value":!0,onClose:c=>v(!1)},{default:u(()=>[h("div",re,[h("h3",ue," Update "+$(t.packageName)+"? ",1),ie,n(S,{code:j[0],lang:"bash",my3:"",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),n(x,{modelValue:a(f),"onUpdate:modelValue":o[1]||(o[1]=c=>M(f)?f.value=c:null),n:"primary"},{default:u(()=>[p(" Navigate to terminal ")]),_:1},8,["modelValue"]),n(x,{modelValue:a(_),"onUpdate:modelValue":o[2]||(o[2]=c=>M(_)?_.value=c:null),n:"primary"},{default:u(()=>[p(" Restart Nuxt server after update ")]),_:1},8,["modelValue"]),h("div",ce,[n(T,{n:"sm amber","flex-auto":"",icon:"i-carbon-data-backup"},{default:u(()=>[p(" Please make sure to backup your project first. ")]),_:1}),n(P,{onClick:c=>v(!1)},{default:u(()=>[p(" Cancel ")]),_:2},1032,["onClick"]),n(P,{n:"solid primary",onClick:c=>v(!0)},{default:u(()=>[p(" Update ")]),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1})],64)}}}),D=["pages","meta","components","imports","nuxt-config-schema","@nuxt/devtools","@nuxt/telemetry"];function de(){return oe("getModulesList",async()=>(await $fetch("https://api.nuxt.com/modules?version=3")).modules.filter(t=>!D.includes(t.npm)&&t.compatibility.nuxt.includes("^3")))}function ge(){return X("installed-modules",()=>{const l=ee(),t=de();return te(()=>(l.value?._installedModules||[]).map(e=>{if(!e.entryPath)return;const s=e.entryPath&&ae(e.entryPath),i=e.meta?.name?e.meta?.name:e.entryPath?s?se(e.entryPath):l.value?.rootDir?ne(e.entryPath,l.value?.rootDir).path:void 0:void 0,y=l.value?.modules?.includes(i),k=t.value?.find(d=>d.npm===i)||t.value?.find(d=>d.name===i);return{name:i,isPackageModule:s,isUninstallable:y,info:k,...e}}).filter(e=>e&&(!e.name||!D.includes(e.name))))})}export{ve as _,de as a,ge as u};
