import{_ as j}from"./nbadge-eref2ecd.js";import{_ as F}from"./ncode-block.vue-h2q9yyre.js";import{_ as q}from"./ncheckbox.vue-hffyw21f.js";import{a6 as A,ah as L,ai as Q,aj as W,Z as E,Q as G,q as O,_ as Y,M as Z,ak as z,A as H,Y as J,W as K,a3 as X,al as ee}from"./cbulnwf4.js";import{q as te,k as V,O as _,a0 as p,F as $,S as ae,a2 as o,Q as w,v as s,a7 as M,R as ne,a1 as u,P as v,a8 as c,u as oe}from"./vendor/json-editor-vue-huf8dypo.js";const se={key:0},le={p4:"",flex:"~ col gap-1"},re={class:"text-lg font-medium leading-6"},ue={flex:"~ gap-3",mt2:"","justify-end":""},_e=te({__name:"NpmVersionCheck",props:{packageName:{},options:{},showVersion:{type:Boolean,default:!0}},setup(l){const a=l,t=A(),{info:n,update:i,state:g,processId:y,restart:m}=L(a.packageName,a.options),k=V(!0),N=V(!0),D=Q(),x=W(),S=E();async function C(){const r=await i(async e=>x.start(e));Z("npm:update",{packageName:a.packageName,oldVersion:n.value?.current}),r&&N.value&&D.value.push({id:r,message:`${a.packageName} has been updated. Do you want to restart the Nuxt server now?`}),r&&k.value&&(S.value=r,t.push("/modules/terminals"))}return(r,e)=>{const b=j,U=F,h=q,R=O,P=Y,T=G;return p(),_($,null,[ae(r.$slots,"default",{id:s(y),info:s(n),update:C,state:s(g),restart:s(m)},()=>[s(n)&&r.showVersion?(p(),_("code",se,M(`v${s(n).current}`),1)):w("",!0),s(n)?.latest?(p(),_($,{key:1},[s(n).needsUpdate?(p(),_("button",{key:0,onClick:e[0]||(e[0]=f=>C())},[o(b,{n:"green",title:"updates available",textContent:"updates available"})])):(p(),ne(b,{key:1,n:"gray",title:"latest",textContent:"latest"}))],64)):w("",!0)]),o(s(x),null,{default:u(({resolve:f,args:I})=>[o(T,{"model-value":!0,onClose:d=>f(!1)},{default:u(()=>[v("div",le,[v("h3",re," Update "+M(a.packageName)+"? ",1),e[8]||(e[8]=v("p",{op50:""}," The following command will be executed in your terminal: ",-1)),o(U,{code:I[0],lang:"bash",my3:"",px4:"",py2:"",border:"~ base rounded",lines:!1},null,8,["code"]),o(h,{modelValue:k.value,"onUpdate:modelValue":e[1]||(e[1]=d=>k.value=d),n:"primary"},{default:u(()=>e[3]||(e[3]=[c(" Navigate to terminal ")])),_:1},8,["modelValue"]),o(h,{modelValue:N.value,"onUpdate:modelValue":e[2]||(e[2]=d=>N.value=d),n:"primary"},{default:u(()=>e[4]||(e[4]=[c(" Restart Nuxt server after update ")])),_:1},8,["modelValue"]),v("div",ue,[o(R,{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=>f(!1)},{default:u(()=>e[6]||(e[6]=[c(" Cancel ")])),_:2},1032,["onClick"]),o(P,{n:"solid primary",onClick:d=>f(!0)},{default:u(()=>e[7]||(e[7]=[c(" Update ")])),_:2},1032,["onClick"])])])]),_:2},1032,["onClose"])]),_:1})],64)}}}),B=["pages","meta","components","imports","nuxt-config-schema","@nuxt/devtools","@nuxt/telemetry"];function ie(){return ee("getModulesList",async()=>(await $fetch("https://api.nuxt.com/modules?version=3")).modules.filter(a=>!B.includes(a.npm)&&a.compatibility.nuxt.includes(">=3")))}function ve(){return z("installed-modules",()=>{const l=H(),a=ie();return oe(()=>(l.value?._installedModules||[]).map(t=>{if(!t.entryPath)return;const n=!!(t.entryPath&&J(t.entryPath)),i=t.meta?.name?t.meta?.name:t.entryPath?n?K(t.entryPath):l.value?.rootDir?X(t.entryPath,l.value?.rootDir).path:void 0:void 0,g=!!l.value?.modules?.includes(i),y=a.value?.find(m=>m.npm===i)||a.value?.find(m=>m.name===i);return{name:i,isPackageModule:n,isUninstallable:g,info:y,...t}}).filter(t=>t&&(!t.name||!B.includes(t.name))))})}export{_e as _,ie as a,ve as u};
