import{b as a,h as e,f as t,_ as l,u as i}from"./public.js?v=1753954525509";import{e as s,w as n}from"./page_layout.js?v=1753954525509";import{B as r,C as o,D as u}from"./setting.js?v=1753954525509";import{_ as p}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{k as c,ab as f,ac as m,c as d,U as v,V as g,W as _,a3 as y,H as h,X as b,F as S,O as C,P,r as W,e as w,Q as x,a2 as j,j as E}from"./vue.js?v=1753954525509";import{cG as k,aq as O,cA as R,ay as A}from"./naive.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";const T={class:"param-list"},U=["onClick"],L=s(c({__name:"param",props:{value:{default:()=>[]},valueModifiers:{}},emits:f(["change"],["update:value"]),setup(a,{emit:e}){const t=e,l=m(a,"value"),i=["POST","GET","PUT","OPTIONS","HEAD","DELETE","TRACE","PATCH","MOVE","COPY","LINK","UNLINK","WRAPPED","PROPFIND","PROPPATCH","MKCOL","CONNECT","SRARCH"],s=d((()=>i.length===l.value.length)),n=()=>{l.value=[],s.value||(l.value=i.map((a=>a))),t("change")};return(a,e)=>(v(),g("div",T,[_("div",{class:h(["param-item",{active:b(s)}]),onClick:n},y(a.$t("Public.SelectAll")),3),(v(),g(S,null,C(i,(a=>{return _("div",{key:a,class:h(["param-item",{active:(e=a,l.value.includes(e))}]),onClick:e=>(a=>{const e=l.value.indexOf(a);-1===e?l.value.push(a):l.value.splice(e,1),t("change")})(a)},y(a),11,U);var e})),64))]))}}),[["__scopeId","data-v-d6f769f3"]]),N={class:"p-20px"},D={class:"w-100px mr-8px"},H={class:"w-220px"},I={class:"w-328px"},$=c({__name:"form",props:{isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(a,{expose:e,emit:t}){const l=t,{t:i}=P(),s=W(null),n=W(null),o=w({type:"refuse",url:"",param:[]}),u=[{label:i("Waf.Setting.config_111"),value:"refuse"},{label:i("Waf.Setting.config_110"),value:"accept"}],c={url:{trigger:["blur","input"],validator:()=>""!==o.url.trim()||new Error(i("Waf.Setting.config_55"))},param:{validator:()=>0!==o.param.length||new Error(i("Waf.Setting.config_112"))}},f=()=>{var a;null==(a=n.value)||a.restoreValidation()};return e({onConfirm:async()=>{var a;await(null==(a=s.value)?void 0:a.validate()),await r({type:o.type,url:o.url,param:o.param.join(",")}),l("refresh")}}),(a,e)=>{const t=k,l=O,i=R,r=p;return v(),g("div",N,[x(r,{ref_key:"formRef",ref:s,model:b(o),rules:c},{default:j((()=>[x(i,{label:a.$t("Waf.Setting.config_73"),path:"url"},{default:j((()=>[_("div",D,[x(t,{value:b(o).type,"onUpdate:value":e[0]||(e[0]=a=>b(o).type=a),options:u},null,8,["value"])]),_("div",H,[x(l,{value:b(o).url,"onUpdate:value":e[1]||(e[1]=a=>b(o).url=a),placeholder:"URL"},null,8,["value"])])])),_:1},8,["label"]),x(i,{ref_key:"paramItemRef",ref:n,label:a.$t("Waf.Setting.config_65"),path:"param"},{default:j((()=>[_("div",I,[x(L,{value:b(o).param,"onUpdate:value":e[2]||(e[2]=a=>b(o).param=a),onChange:f},null,8,["value"])])])),_:1},8,["label"])])),_:1},8,["model"])])}}}),B={class:"p-20px"},K={class:"flex mb-16px"},M=c({__name:"config",setup(s){const{t:r}=P(),p=async()=>{var a;a={title:r("Waf.Setting.config_64"),data:{isEdit:!1}},i({title:a.title,width:550,footer:!0,data:{...a.data,onRefresh:()=>{d()}},component:$})},{table:c,columns:f,setLoading:m}=a([{key:"url",title:"URL",ellipsis:{tooltip:!0}},{key:"type",title:r("Waf.Setting.config_73"),width:80,ellipsis:{tooltip:!0},render:a=>"refuse"===a.type?r("Waf.Setting.config_111"):r("Waf.Setting.config_110")},{key:"mode",title:r("Waf.Setting.config_93"),width:216,ellipsis:{tooltip:!0},render:a=>Object.entries(a.mode).map((([,a])=>a)).join(", ")},e({width:60,options:a=>[{label:r("Public.Btn.Del"),onClick:async()=>{await o({url:a.url}),d()}}]})]),d=async()=>{try{m(!0);const{message:a}=await u();c.data=n(a)?a:[]}finally{m(!1)}};return d(),(a,e)=>{const i=A,s=t,n=l;return v(),g("div",B,[_("div",K,[x(i,{type:"primary",onClick:p},{default:j((()=>[E(y(a.$t("Public.Btn.Add")),1)])),_:1})]),x(s,{"max-height":270,loading:b(c).loading,data:b(c).data,columns:b(f)},null,8,["loading","data","columns"]),x(n,{class:"mt-12px"},{default:j((()=>[_("li",null,y(a.$t("Waf.Setting.config_108")),1),_("li",null,y(a.$t("Waf.Setting.config_109")),1)])),_:1})])}}});export{M as default};
