import{_ as b}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{k as h,R as g,a6 as w,r as y,e as D,c as R,$,Z as k,a0 as i,a9 as _,_ as C,S as a}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{gs as B,m as E}from"./index-BTglIPU2.js?v=1773287522785";import{u as N}from"./index-B5d4M70B.js?v=1773287522785";import{a1 as S,a6 as V}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const q={class:"px-20px pt-24px pb-8px"},I={class:"w-260px"},z=h({__name:"index",setup(L,{expose:p}){const{t:n}=g(),r=N(),{remoteList:l}=w(r),c=y(null),t=D({sid:l.value.length>0?l.value[0].id:null}),m=R(()=>l.value.map(e=>({label:"".concat(e.ps||e.db_host," (").concat(e.db_host,")"),value:e.id}))),u={sid:{trigger:"change",validator:(s,e)=>e===null?new Error(n("Database.tools.index_63")):!0}},d=()=>{const{sid:s}=t;if(s===null)throw E.error(n("Database.tools.index_64")),new Error(n("Database.tools.index_64"));return{sid:s}};return p({onConfirm:async({hide:s})=>{var e;try{await((e=c.value)==null?void 0:e.validate());const o=d();await B(r.type,o),r.setRefresh(!0),s()}catch(o){console.error(o)}}}),(s,e)=>{const o=V,f=S,v=b;return $(),k("div",q,[i(v,{ref_key:"formRef",ref:c,model:a(t),rules:u},{default:_(()=>[i(f,{label:s.$t("Database.tools.index_76"),path:"sid"},{default:_(()=>[C("div",I,[i(o,{value:a(t).sid,"onUpdate:value":e[0]||(e[0]=x=>a(t).sid=x),class:"server-select",options:a(m)},null,8,["value","options"])])]),_:1},8,["label"])]),_:1},8,["model"])])}}});export{z as default};
