import{_ as F}from"./nbadge-j8xt52su.js";import{_ as W}from"./ncode-block.vue-c2t0anp9.js";import{_ as j}from"./ncheckbox.vue-ioifqy12.js";import{m as L,as as A,at as E,k as G,o as Q,s as X,x as q,f as z,y as H,au as J,I as K,W as O,X as Y,av as Z,ar as ee}from"./nqd95jrf.js";import{k as te,b as P,Q as p,S as _,V as ae,u as s,a5 as $,W as w,F as M,a0 as o,M as ne,$ as u,U as g,a6 as c,l as se}from"./vendor/json-editor-vue-fw81xiot.js";const oe={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=L(),{info:n,update:i,state:v,processId:y,restart:m}=A(a.packageName,a.options),k=P(!0),N=P(!0),U=E(),x=G(),D=Q();async function C(){const r=await i(async e=>x.start(e));X("npm:update",{packageName:a.packageName,oldVersion:n.value?.current}),r&&N.value&&U.value.push({id:r,message:`${a.packageName} has been updated. Do you want to restart the Nuxt server now?`}),r&&k.value&&(D.value=r,t.push("/modules/terminals"))}return(r,e)=>{const b=F,S=W,h=j,I=q,V=z,T=H;return p(),_(M,null,[ae(r.$slots,"default",{id:s(y),info:s(n),update:C,state:s(v),restart:s(m)},()=>[s(n)&&r.showVersion?(p(),_("code",oe,$(`v${s(n).current}`),1)):w("",!0),s(n)?.latest?(p(),_(M,{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:R})=>[o(T,{"model-value":!0,onClose:d=>f(!1)},{default:u(()=>[g("div",le,[g("h3",re," Update "+$(a.packageName)+"? ",1),e[8]||(e[8]=g("p",{op50:""}," The following command will be executed in your terminal: ",-1)),o(S,{code:R[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"]),g("div",ue,[o(I,{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(V,{onClick:d=>f(!1)},{default:u(()=>e[6]||(e[6]=[c(" Cancel ")])),_:2},1032,["onClick"]),o(V,{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 ge(){return J("installed-modules",()=>{const l=K(),a=ie();return se(()=>(l.value?._installedModules||[]).map(t=>{if(!t.entryPath)return;const n=!!(t.entryPath&&O(t.entryPath)),i=t.meta?.name?t.meta?.name:t.entryPath?n?Y(t.entryPath):l.value?.rootDir?Z(t.entryPath,l.value?.rootDir).path:void 0:void 0,v=!!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:v,info:y,...t}}).filter(t=>t&&(!t.name||!B.includes(t.name))))})}export{_e as _,ie as a,ge as u};
