import{c as a,f as e,h as t,_ as l,u as i}from"./public.js?v=1763625242172";import{p as s,x as n}from"./page_layout.js?v=1763625242172";import{B as r,C as o,D as u}from"./setting.js?v=1763625242172";import{_ as p}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{k as c,ad as f,ae as d,c as m,R as v,S as g,U as _,a4 as y,H as h,V as S,F as C,O as P,P as b,r as x,e as W,X as j,a3 as w,j as E}from"./vue.js?v=1763625242172";import{dV as k,au as O,dP as R,aC as T}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const A={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=d(a,"value"),i=["POST","GET","PUT","OPTIONS","HEAD","DELETE","TRACE","PATCH","MOVE","COPY","LINK","UNLINK","WRAPPED","PROPFIND","PROPPATCH","MKCOL","CONNECT","SRARCH"],s=m((()=>i.length===l.value.length)),n=()=>{l.value=[],s.value||(l.value=i.map((a=>a))),t("change")};return(a,e)=>(v(),g("div",A,[_("div",{class:h(["param-item",{active:S(s)}]),onClick:n},y(a.$t("Public.SelectAll")),3),(v(),g(C,null,P(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}=b(),s=x(null),n=x(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,[j(r,{ref_key:"formRef",ref:s,model:S(o),rules:c},{default:w((()=>[j(i,{label:a.$t("Waf.Setting.config_73"),path:"url"},{default:w((()=>[_("div",D,[j(t,{value:S(o).type,"onUpdate:value":e[0]||(e[0]=a=>S(o).type=a),options:u},null,8,["value"])]),_("div",H,[j(l,{value:S(o).url,"onUpdate:value":e[1]||(e[1]=a=>S(o).url=a),placeholder:"URL"},null,8,["value"])])])),_:1},8,["label"]),j(i,{ref_key:"paramItemRef",ref:n,label:a.$t("Waf.Setting.config_65"),path:"param"},{default:w((()=>[_("div",I,[j(L,{value:S(o).param,"onUpdate:value":e[2]||(e[2]=a=>S(o).param=a),onChange:f},null,8,["value"])])])),_:1},8,["label"])])),_:1},8,["model"])])}}}),B={class:"p-20px"},V={class:"flex mb-16px"},K=c({__name:"config",setup(s){const{t:r}=b(),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:()=>{m()}},component:$})},{table:c,columns:f,setLoading:d}=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}),m()}}]})]),m=async()=>{try{d(!0);const{message:a}=await u();c.data=n(a)?a:[]}finally{d(!1)}};return m(),(a,e)=>{const i=T,s=t,n=l;return v(),g("div",B,[_("div",V,[j(i,{type:"primary",onClick:p},{default:w((()=>[E(y(a.$t("Public.Btn.Add")),1)])),_:1})]),j(s,{"max-height":270,loading:S(c).loading,data:S(c).data,columns:S(f)},null,8,["loading","data","columns"]),j(n,{class:"mt-12px"},{default:w((()=>[_("li",null,y(a.$t("Waf.Setting.config_108")),1),_("li",null,y(a.$t("Waf.Setting.config_109")),1)])),_:1})])}}});export{K as default};
