import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{eE as s,eF as e,c as l,f as t}from"./page_layout.js?v=1753954525509";import{k as o,P as c,r as i,e as r,U as n,a1 as p,a2 as m,Q as d,W as u,X as _,al as f,N as v}from"./vue.js?v=1753954525509";import{cG as b,cA as x,aq as h,c5 as w}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";import"./public.js?v=1753954525509";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:k}=c(),R=i(null),U=r({dataAccess:"127.0.0.1",access:"127.0.0.1",ssl:""}),E=i([{label:k("Database.form.index_12"),value:"127.0.0.1"},{label:k("Database.form.index_13"),value:"%"},{label:k("Database.form.index_14"),value:"ip"}]),$={host:{trigger:["blur","change"],validator:()=>"ip"!==U.dataAccess||(""!==U.access.trim()||new Error(k("Database.form.index_19")))}},Q=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=R.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:R,model:_(U),rules:$,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),Q],class:"permission-select",options:_(E)},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};
