import{l as a,aD as e,a4 as s,$ as t,z as o,x as l,M as n,a2 as r,A as i,a7 as p}from"./utils-lib.js?v=20260328163632";import{B as m}from"./index91.js?v=20260328163632";import{B as u}from"./index199.js?v=20260328163632";import{bv as c,bw as d,bx as h}from"./site.js?v=20260328163632";import{a as f,g as _,p as j}from"./index37.js?v=20260328163632";import{B as v,j as x,au as y}from"./naive-ui.js?v=20260328163632";import{k as g,r as b,O as k,w as P,o as w,J as A,V,_ as C,a3 as q,Y as B,j as H,Z as O,N as R}from"./base-lib.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./useMethod4.js?v=20260328163632";import"./store4.js?v=20260328163632";const T=g({__name:"index",setup(g){const T=b(""),D=b([]),E=b({columns:[{title:a("名称"),key:"name"},{title:a("Python版本"),key:"version_title"},e({title:a("环境路径"),key:"path"}),s([{title:a("终端"),onClick:a=>f({env:["PATH="+a.path,"PATH="+a.path+"\\Scripts"],path:a.path})},{render:e=>k("span",{class:"bt-danger",onClick:()=>z(e)},[a("卸载")])}])],data:[]}),[I,M]=t(E),U=()=>{i({title:a("安装Python环境"),area:500,component:()=>p((()=>import("./install-version.js?v=20260328163632")),[],import.meta.url),showFooter:!0})},z=async({name:e})=>{await o({icon:"warning-filled",title:a("卸载Python环境"),content:a("卸载Python环境{0}，确定要卸载吗？",[e])}),l({request:c({name:e}),message:!0,success:()=>{_()}})};P((()=>j.value),(a=>{E.value.data=a}));const F=e=>{l({loading:a("正在设置pip源，请稍后..."),request:h({url:e}),message:!0,success:()=>{J()}})},J=(e=!1)=>{l({request:d({force:e}),success:s=>{var t;const{list:o,source_url:l}=s.data;D.value=Array.isArray(o)?o.map((a=>({...a,label:a.name+" ("+a.speed+" ms)",value:a.url}))):[],T.value=(null==(t=o.find((a=>-1!==a.url.indexOf(l))))?void 0:t.url)||l||"",e&&n.success(a("pip源，刷新成功"))}})};return w((()=>{_(),J()})),A((()=>{E.value.data=[]})),(e,s)=>{const t=v,o=x,l=y;return V(),C(B(r),{class:"p-20px"},{"header-left":q((()=>[k(l,{align:"center",class:"gap-10px"},{default:q((()=>[k(t,{type:"primary",onClick:U},{default:q((()=>[H(O(B(a)("安装Python环境")),1)])),_:1}),k(B(u),{modelValue:B(T),"onUpdate:modelValue":s[0]||(s[0]=a=>R(T)?T.value=a:null),options:B(D),"consistent-menu-width":!1,onIconClick:s[1]||(s[1]=a=>J(!0)),"onUpdate:value":F,placeholder:B(a)("请选择pip源"),class:"max-w-300px",icon:"icon-refresh"},{prefix:q((()=>[k(o,null,{default:q((()=>[H(O(B(a)("pip源")),1)])),_:1})])),_:1},8,["modelValue","options","placeholder"])])),_:1})])),"header-right":q((()=>[k(B(m),{onRefresh:B(_)},null,8,["onRefresh"])])),content:q((()=>[k(B(I),{"max-height":500})])),_:1})}}});export{T as default};
