import{u as a,l as e,M as s,t as r,bc as l,ax as t,bd as o,x as n,be as i,X as c,bf as u}from"./utils-lib.js?v=20260328163632";import{r as p,c as v,O as d,j as y}from"./base-lib.js?v=20260328163632";const{plugin:m,panel:b,getGlobalInfo:h}=a(),g=p("phpService"),f=p(""),w=p([]);p(!1);const k=p(),x=v((()=>{const{protocol:a,port:e,host:s,dir_path:r}=m.value.phpmyadmin;return"".concat(a,"://").concat(s,":").concat(e,"/").concat(r)})),q=()=>{t("","root",m.value.mysql.root,x.value)},_=v((()=>[{content:d("span",null,[e("访问地址"),y("："),d("a",{class:"bt-link",target:"_blank",href:"javascript:;",onClick:q},[x.value])])}])),j=async a=>{if(g.value=a,"version"===g.value){const a=await o({status:1});w.value=a.data.map((a=>({label:a.title,value:a.tip_version})))}},K=()=>{n({loading:e("正在切换版本，请稍后..."),request:i({php_version:f.value}),message:!0,success:a=>{a.status&&window.location.reload()}})},P=p({formAttrs:{labelWidth:"84px"},formItems:[{label:e("授权账号"),ruleKey:"username",rules:[{required:!0,message:e("请输入授权账号"),trigger:"blur"}],children:[{type:"input",key:"username",attrs:{class:"!w-[210px]",placeholder:e("不修改请留空"),clearable:!0}}]},{label:e("授权密码"),ruleKey:"password",rules:[{required:!0,message:e("请输入授权密码"),trigger:"blur"}],children:[{type:"input",key:"password",attrs:{type:"password",class:"!w-[210px]",placeholder:e("不修改请留空"),clearable:!0}}]},{label:e("确认密码"),ruleKey:"confirmPass",rules:[{required:!0,message:e("请输入确认密码"),trigger:"blur"}],children:[{type:"input",key:"confirmPass",attrs:{type:"password",class:"!w-[210px]",placeholder:e("不修改请留空"),clearable:!0}}]},{label:" ",ruleKey:"save",children:[{type:"button",key:"save",attrs:{type:"primary",buttonText:e("保存"),onClick:async()=>{var a;if(await(null==(a=I.value)?void 0:a.validate()),C.value.password!==C.value.confirmPass)return void s.error(e("密码不一致"));const r=C.value;delete r.save,delete r.confirmPass,N({...r,siteName:"phpmyadmin"})}}}]}]}),[A,C,I]=r(P),N=async(a,r)=>{let t=s.load(e("正在保存，请稍候..."));try{const e=await l(a);s.request(e),null==r||r(e)}catch(o){}finally{t.close()}},G=async()=>{if(!c(k.value))return s.error(e("请填写正确的端口(1-65535之间的数字)"));n({loading:e("正在保存，请稍候..."),request:u({port:Number(k.value)}),message:!0,success:a=>{M()}})},M=async()=>{try{const{phpmyadmin:a}=await h();f.value=Array.isArray(null==a?void 0:a.php_version)?null==a?void 0:a.php_version[0]:null==a?void 0:a.php_version,k.value=a.port}catch(a){}};export{K as a,f as c,_ as h,M as i,j as o,k as p,G as s,g as t,w as v};
