import{c as a,f as t,u as n,a as e,h as o,_ as l}from"./public.js?v=1763625242172";import{k as i,P as s,r as c,R as r,S as u,U as f,X as d,V as p,aj as m,ak as g,a3 as _,j as v,a4 as x}from"./vue.js?v=1763625242172";import{c as y,m as w,hc as j}from"./page_layout.js?v=1763625242172";import{P as S,g as b,Q as W,R as h,S as C}from"./setting.js?v=1763625242172";import{_ as k}from"./index99.js?v=1763625242172";import{au as P,aC as $,d9 as B}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const U={class:"p-20px"},E={class:"flex mb-16px"},R={class:"flex-1 mr-16px"},A=i({__name:"config",setup(i){const{t:A}=s(),D=c(""),H=async()=>{""!==D.value.trim()?(await W({text:D.value}),D.value="",q()):w.error(A("Waf.Setting.config_176"))},I=()=>{const a=c("");n({title:A("Waf.Setting.config_187"),width:440,footer:!0,content:()=>d("div",{class:"p-20px"},[d(k,{value:a.value,"onUpdate:value":t=>a.value=t,rows:14,placeholder:A("Waf.Setting.config_188")},null)]),onConfirm:async()=>{if(""===a.value.trim())return w.error(A("Waf.Setting.config_179")),!1;await h({text:a.value}),q()}})},K=()=>{const a=c(Q.data.map((a=>a.word)).join("\n"));n({title:A("Waf.Setting.config_177"),width:440,footer:!0,content:()=>d("div",{class:"p-20px"},[d(k,{value:a.value,"onUpdate:value":t=>a.value=t,rows:14,readonly:!0},null)]),onConfirm:()=>(j(a.value,"".concat("body_intercept",".json")),!1)})},L=()=>{e({title:A("Waf.Setting.config_180"),content:A("Waf.Setting.config_181"),onConfirm:async()=>{await C(),q()}})},{table:Q,columns:V,setLoading:X}=a([{key:"word",title:A("Waf.Setting.config_184")},t({width:80,options:a=>[{label:A("Public.Btn.Del"),onClick:async()=>{await S({text:a.word}),q()}}]})]),q=async()=>{try{X(!0);const{message:a}=await b();y(a)&&(Q.data=a.body_intercept.map((a=>({word:a}))))}finally{X(!1)}};return q(),(a,t)=>{const n=P,e=$,i=o,s=B,c=l;return r(),u("div",U,[f("div",E,[f("div",R,[d(n,{value:p(D),"onUpdate:value":t[0]||(t[0]=a=>m(D)?D.value=a:null),placeholder:a.$t("Waf.Setting.config_184"),onKeyup:g(H,["enter"])},null,8,["value","placeholder"])]),d(e,{type:"primary",onClick:H},{default:_((()=>[v(x(a.$t("Public.Btn.Add")),1)])),_:1})]),d(i,{"max-height":258,loading:p(Q).loading,data:p(Q).data,columns:p(V)},null,8,["loading","data","columns"]),d(s,{class:"mt-16px"},{default:_((()=>[d(e,{onClick:I},{default:_((()=>[v(x(a.$t("Public.Btn.Import")),1)])),_:1}),d(e,{onClick:K},{default:_((()=>[v(x(a.$t("Public.Btn.Export")),1)])),_:1}),d(e,{onClick:L},{default:_((()=>[v(x(a.$t("Public.Btn.Empty")),1)])),_:1})])),_:1}),d(c,{class:"mt-16px"},{default:_((()=>[f("li",null,x(a.$t("Waf.Setting.config_185")),1),f("li",null,x(a.$t("Waf.Setting.config_186")),1)])),_:1})])}}});export{A as default};
