import{u as a,l as e,a4 as s,$ as l,q as t,v as o,M as n,x as i,cj as r,bE as u,z as c}from"./utils-lib.js?v=20260328163632";import{B as p}from"./index91.js?v=20260328163632";import{bR as d,bS as m,bT as v}from"./site.js?v=20260328163632";import{g as j}from"./index63.js?v=20260328163632";import{b as x,B as f,au as g}from"./naive-ui.js?v=20260328163632";import{k as h,r as y,o as _,V as b,W as k,X as q,O as w,a3 as V,Y as R,N as A,j as B,Z as C}from"./base-lib.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index199.js?v=20260328163632";import"./index158.js?v=20260328163632";import"./ace.js?v=20260328163632";const N={class:"p-20px"},S={class:"flex justify-between"},U={class:"py-10px h-530px"},z=h({__name:"modules",setup(h){const{panel:z}=a(),E=y(""),H=y(!1),M=y(""),O=[{content:e("【安装位置】")+z.value.paths.soft+"/nodejs/"+j.value+"/nodejs/"+j.value+"/node_modules"},{content:e("【指定版本】如：sax@0.2.0 或 sax@latest")},{content:e("【从git地址安装】如：git://github.com/package/path.git")}],T=async()=>{if(!E.value)return n.error(e("请输入模块名称"));i({loading:e("正在安装模块..."),request:d({module:E.value,version:j.value}),message:!0,success:a=>{a.status&&(r(e("安装Node日志"),{name:"install_nodejs_"+u(j.value),onRefresh:Z}),E.value="",Z())}})},W=y({columns:[{title:e("模块名称"),key:"name"},{title:e("版本"),key:"version"},{title:e("许可"),key:"license"},{title:e("简介"),key:"description"},s([{onClick:async a=>{await c({title:e("卸载{0}模块",["[".concat(a.name,"]")]),content:e("卸载{0}模块后,可能影响项目正常运行,继续吗?",["[".concat(a.name,"]")]),type:"calc"}),i({loading:e("正在卸载模块..."),request:m({module:a.name,version:j.value}),message:!0,success:()=>{Z()}})},title:e("卸载")}])],data:[]}),[X,Y]=l(W),Z=()=>{i({loading:H,request:v({search:M.value,version:j.value}),success:a=>{W.value.data=Array.isArray(a.data)?a.data:[]}})};return _((()=>Z())),(a,s)=>{const l=x,n=f,i=g;return b(),k("div",N,[q("div",S,[w(i,{class:"!gap-10px"},{default:V((()=>[w(l,{value:R(E),"onUpdate:value":s[0]||(s[0]=a=>A(E)?E.value=a:null),class:"w-150px",placeholder:R(e)("模块名称")},null,8,["value","placeholder"]),w(n,{type:"primary",onClick:T},{default:V((()=>[B(C(R(e)("安装")),1)])),_:1})])),_:1}),w(i,{class:"!gap-10px"},{default:V((()=>[w(R(t),{modelValue:R(M),"onUpdate:modelValue":s[1]||(s[1]=a=>A(M)?M.value=a:null),placeholder:R(e)("请输入名称"),class:"!w-[180px]",onSearch:s[2]||(s[2]=()=>Z())},null,8,["modelValue","placeholder"]),w(R(p),{onRefresh:Z})])),_:1})]),q("div",U,[w(R(X),{loading:R(H),"max-height":460},null,8,["loading"])]),w(R(o),{class:"mt-10px",options:O})])}}});export{z as default};
