import{c as a,g as e,q as l,a6 as s,I as t,y as r,v as u,x as n,e as o,ai as i,C as d,n as p,ah as m,al as c,ak as v,T as b,bu as f,i as x}from"./base-lib.js?v=1761009159";import{K as j,$ as w}from"./utils-lib.js?v=1761009159";import{f as g,a as h,e as y,b as _,h as D,c as V,r as k,i as H,g as q,d as C,m as E}from"./index59.js?v=1761009159";import{o as M,h as O,j as U,b as z}from"./form-item.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./useMethod7.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./site.js?v=1761009159";import"./index105.js?v=1761009159";import"./useMethod6.js?v=1761009159";import"./firewall.js?v=1761009159";import"./useStore5.js?v=1761009159";import"./useMethod9.js?v=1761009159";const F={class:"py-[1rem] px-[3rem]"};const S="!w-[300px]",B=a({__name:"index",props:{compData:{type:Object,default:()=>({})}},setup(a,{expose:B}){const I=a,{isEdit:K,row:T}=I.compData,$=e(()=>0===g.value?[{content:'<span class="text-dangerDark">全部：捕获当前域名下，所有邮件（包括不存在的邮箱的邮件）</span>',isHtml:!0},{content:'<span class="text-dangerDark">不存在：捕获当前域名下，不存在的邮箱的邮件</span>',isHtml:!0},{content:'<span class="text-dangerDark">前缀：捕获当前域名下，以指定字符串的开头的邮箱（邮箱可以不存在）的邮件</span>',isHtml:!0},{content:'<span class="text-dangerDark">后缀：捕获当前域名下，邮箱地址@以前的部分以指定字符串的结尾的邮箱（邮箱可以不存在）的邮件</span>',isHtml:!0},{content:'<span class="text-dangerDark">包含：捕获当前域名下，邮箱地址@以前的部分包含指定字符串的邮箱（邮箱可以不存在）的邮件</span>',isHtml:!0}]:[{content:'<span class="text-dangerDark">转发示例：配置bt.cn转发到btmail.cn，则：a@bt.cn->a@btmail.cn、b@bt.cn->b@btmail.cn、...</span>',isHtml:!0}]),A=[{label:"前缀",value:"prefix"},{label:"后缀",value:"suffix"},{label:"包含",value:"contain"},{label:"全部",value:"all"},{label:"不存在",value:"none"}],G=a=>[O(" ",()=>o(m,{disabled:K,modelValue:a.value.type,"onUpdate:modelValue":e=>a.value.type=e,onChange:e=>{a.value.rule_str="",a.value.rule="all",p(()=>{N.value&&N.value.clearValidate(),N.value&&N.value.validateField("receiver")})}},{default:()=>[o(i,{value:"mail",size:"default"},{default:()=>[d("邮箱")]}),o(i,{class:"ml-[6rem]",value:"wildcard",size:"default"},{default:()=>[d("通配符")]})]}),"type"),U("域名","domain",C.value,{attrs:{class:S,disabled:K,onChange:e=>{a.value.rule_str="",q(e)}},rules:[{required:!0,message:"请选择域名"}]}),"mail"===a.value.type?U("邮箱","rule_str",E.value,{attrs:{class:S,disabled:!a.value.domain||K,placeholder:"请先选择域名，再选择邮箱"},rules:[{validator:(e,l,s)=>{if("mail"===a.value.type)l?s():s(new Error("请选择邮箱"));else{if("none"===a.value.rule||"all"===a.value.rule)return void s();l?s():s(new Error("请输入规则内容"))}}}]}):O("规则",()=>{let e;const l="none"===a.value.rule||"all"===a.value.rule;return o("div",{class:"flex items-center"},[o(c,{disabled:K,modelValue:a.value.rule,"onUpdate:modelValue":e=>a.value.rule=e,onChange:e=>{"none"!==e&&"all"!==e||(a.value.rule_str="",p(()=>{N.value&&N.value.clearValidate("rule_str")}))},placeholder:"选择规则",class:"!w-[100px]"},(s=e=A.map(a=>o(v,{label:a.label,value:a.value},null)),"function"==typeof s||"[object Object]"===Object.prototype.toString.call(s)&&!x(s)?e:{default:()=>[e]})),o(b,{modelValue:a.value.rule_str,"onUpdate:modelValue":e=>a.value.rule_str=e,disabled:l||K,placeholder:"输入规则",class:"!w-[190px] ml-[10px]"},null)]);var s},"rule_str",{rules:[{validator:(e,l,s)=>{"none"!==a.value.rule&&"all"!==a.value.rule?l?s():s(new Error("请输入规则内容")):s()}}]}),z("接收者","receiver",{attrs:{placeholder:"输入需要转发的邮箱",type:"textarea",rows:4,class:S},rules:[{required:!0,message:"请输入需要转发的邮箱",validator:(a,e,l)=>{e?l():l(new Error("请输入需要转发的邮箱"))}}]})],{BtForm:J,submit:L,ref:N}=j({data:()=>h.value,options:a=>e(()=>[...0===g.value?G(a):[U("域名","domain",C.value,{attrs:{class:S,disabled:K},rules:[{required:!0,message:"请选择域名"}]}),z("接收域名","receiver",{attrs:{placeholder:"输入需要接收的域名",class:S},rules:[{required:!0,message:"请输入需要接收的域名"}]})],M("状态","status",{attrs:{class:"!w-[50px]"}})]),submit:async(a,e)=>{let l;return await e(),l=K?await y(a.value,T.address):await _(a.value),l}});return l(async()=>{K?D(T):await V()}),s(()=>{k()}),B({onConfirm:async()=>await L()}),(a,e)=>{const l=w,s=f;return t((u(),n("div",F,[o(r(J)),o(l,{options:r($)},null,8,["options"])])),[[s,r(H)]])}}});export{B as default};
