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