import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{fz as s,fA as e,c as l,h as t}from"./page_layout.js?v=1763625242172";import{k as o,P as c,r as i,e as r,R as n,a2 as p,a3 as m,X as d,U as u,V as _,an as f,N as v}from"./vue.js?v=1763625242172";import{dV as b,dP as x,au as h,dj as w}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./public.js?v=1763625242172";const j={class:"w-280px"},y={class:"w-280px"},A=o({__name:"index",props:{row:{}},setup(o,{expose:A}){const D=o,{row:g}=D,{t:R}=c(),k=i(null),U=r({dataAccess:"127.0.0.1",access:"127.0.0.1",ssl:""}),$=i([{label:R("Database.form.index_12"),value:"127.0.0.1"},{label:R("Database.form.index_13"),value:"%"},{label:R("Database.form.index_14"),value:"ip"}]),E={host:{trigger:["blur","change"],validator:()=>"ip"!==U.dataAccess||(""!==U.access.trim()||new Error(R("Database.form.index_19")))}},z=a=>{U.access="ip"===a?"":a};return(async()=>{const{message:a}=await e({name:g.name});l(a)&&("127.0.0.1"!==a.permission&&"%"!==a.permission?(U.dataAccess="ip",U.access=a.permission.split(",").join("\n")):(U.dataAccess=a.permission,U.access=a.permission),U.ssl=t(a.ssl)?a.ssl:"")})(),A({onConfirm:async({hide:a})=>{var e;try{await(null==(e=k.value)?void 0:e.validate());const l={...v(U),name:g.username,access:"ip"===U.dataAccess?U.access.trim().split("\n").join(","):U.access};await s(v(l)),a()}catch(l){console.error(l)}}}),(s,e)=>{const l=b,t=x,o=h,c=w,i=a;return n(),p(i,{ref_key:"formRef",ref:k,model:_(U),rules:E,class:"px-20px py-24px"},{default:m((()=>[d(t,{label:s.$t("Database.form.index_6"),path:"listen_ip"},{default:m((()=>[u("div",j,[d(l,{value:_(U).dataAccess,"onUpdate:value":[e[0]||(e[0]=a=>_(U).dataAccess=a),z],class:"permission-select",options:_($)},null,8,["value","options"])])])),_:1},8,["label"]),"ip"===_(U).dataAccess?(n(),p(t,{key:0,label:s.$t("Database.form.index_7"),path:"host"},{default:m((()=>[u("div",y,[d(o,{value:_(U).access,"onUpdate:value":e[1]||(e[1]=a=>_(U).access=a),type:"textarea",autosize:{minRows:3,maxRows:3},"input-props":{name:"address"},placeholder:s.$t("Database.form.index_8")},null,8,["value","placeholder"])])])),_:1},8,["label"])):f("",!0),d(t,{label:s.$t("Database.form.index_11"),"show-feedback":!1},{default:m((()=>[d(c,{value:_(U).ssl,"onUpdate:value":e[2]||(e[2]=a=>_(U).ssl=a),class:"ssl-switch","checked-value":"REQUIRE SSL"},null,8,["value"])])),_:1},8,["label"])])),_:1},8,["model"])}}});export{A as default};
