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