import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{b1 as e,eg as s,o as r,m as t}from"./page_layout.js?v=1753954525509";import{_ as l}from"./index.vue_vue_type_script_setup_true_lang2.js?v=1753954525509";import{k as o,P as n,$ as i,r as d,e as u,c as p,U as m,a1 as _,a2 as c,Q as b,W as v,X as f,j as x,a3 as g,N as h}from"./vue.js?v=1753954525509";import"./public.js?v=1753954525509";import{g as w}from"./index126.js?v=1753954525509";import{aq as j,cA as D,cG as y}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";import"./index96.js?v=1753954525509";import"./index127.js?v=1753954525509";import"./soft.js?v=1753954525509";const $={class:"w-240px"},U={class:"w-240px"},q={class:"w-240px"},k={class:"w-240px"},C={class:"ml-8px"},E=o({__name:"index",setup(o,{expose:E}){const{t:R}=n(),A=e(),{remoteList:G}=i(A),H=d(null),L=u({sid:G.value.length>0?G.value[0].id:null,name:"",db_user:"",password:"",active:!1,ssl:""}),N=p((()=>G.value.map((a=>({label:"".concat(a.ps," (").concat(a.db_host,")"),value:a.id}))))),P={name:{required:!0,message:R("Database.form.index_15"),trigger:["blur","change"]},db_user:{required:!0,message:R("Database.form.index_16"),trigger:["blur","change"]},password:{required:!0,message:R("Database.form.index_17"),trigger:["blur","change"]},sid:{trigger:"change",validator:(a,e)=>null!==e||new Error(R("Database.form.index_18"))}},Q=a=>{L.db_user=a},W=()=>{w()};return E({onConfirm:async()=>{var a;try{await(null==(a=H.value)?void 0:a.validate());const e=(()=>{const a=h(L),{sid:e}=a;if(null===e)throw t.error(R("Database.form.index_18")),new Error(R("Database.form.index_18"));return{...a,sid:e,ps:a.name}})();await s(A.type,e),A.setRefresh(!0)}catch(e){console.warn(e)}}}),(e,s)=>{const t=j,o=D,n=l,i=y,d=r,u=a;return m(),_(u,{ref_key:"formRef",ref:H,model:f(L),rules:P,class:"p-20px"},{default:c((()=>[b(o,{label:e.$t("Database.index_12"),path:"name"},{default:c((()=>[v("div",$,[b(t,{value:f(L).name,"onUpdate:value":[s[0]||(s[0]=a=>f(L).name=a),Q],placeholder:e.$t("Database.form.index_2"),"input-props":{name:"name"}},null,8,["value","placeholder"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.index_13"),path:"db_user"},{default:c((()=>[v("div",U,[b(t,{value:f(L).db_user,"onUpdate:value":s[1]||(s[1]=a=>f(L).db_user=a),placeholder:"Database user","input-props":{name:"user"}},null,8,["value"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.index_14"),path:"password"},{default:c((()=>[v("div",q,[b(n,{value:f(L).password,"onUpdate:value":s[2]||(s[2]=a=>f(L).password=a),"input-props":{name:"password"}},null,8,["value"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.form.index_9"),path:"sid"},{default:c((()=>[v("div",k,[b(i,{value:f(L).sid,"onUpdate:value":s[3]||(s[3]=a=>f(L).sid=a),class:"server-select",options:f(N)},null,8,["value","options"])]),v("div",C,[b(d,{onClick:W},{default:c((()=>[x(g(e.$t("Database.form.index_10")),1)])),_:1})])])),_:1},8,["label"])])),_:1},8,["model"])}}});export{E as default};
