import{c as a,f as t,h as n,_ as e,u as o,a as l}from"./public.js?v=1764233927359";import{k as i,P as s,r as c,R as r,V as u,S as f,W as d,aj as p,ak as m,U as g,a3 as _,j as v,a4 as x}from"./vue.js?v=1764233927359";import{d as y,m as w,he as j}from"./page_layout.js?v=1764233927359";import{P as S,g as W,Q as b,R as h,S as C}from"./setting.js?v=1764233927359";import{_ as k}from"./index99.js?v=1764233927359";import{au as P,aC as $,da as B}from"./naive.js?v=1764233927359";import"./common.js?v=1764233927359";import"./__commonjsHelpers__.js?v=1764233927359";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 b({text:D.value}),D.value="",z()):w.error(A("Waf.Setting.config_176"))},I=()=>{const a=c("");o({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}),z()}})},K=()=>{const a=c(Q.data.map(a=>a.word).join("\n"));o({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=()=>{l({title:A("Waf.Setting.config_180"),content:A("Waf.Setting.config_181"),onConfirm:async()=>{await C(),z()}})},{table:Q,columns:V,setLoading:q}=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}),z()}}]})]),z=async()=>{try{q(!0);const{message:a}=await W();y(a)&&(Q.data=a.body_intercept.map(a=>({word:a})))}finally{q(!1)}};return z(),(a,t)=>{const o=P,l=$,i=n,s=B,c=e;return u(),r("div",U,[f("div",E,[f("div",R,[d(o,{value:g(D),"onUpdate:value":t[0]||(t[0]=a=>m(D)?D.value=a:null),placeholder:a.$t("Waf.Setting.config_184"),onKeyup:p(H,["enter"])},null,8,["value","placeholder"])]),d(l,{type:"primary",onClick:H},{default:_(()=>[v(x(a.$t("Public.Btn.Add")),1)]),_:1})]),d(i,{"max-height":258,loading:g(Q).loading,data:g(Q).data,columns:g(V)},null,8,["loading","data","columns"]),d(s,{class:"mt-16px"},{default:_(()=>[d(l,{onClick:I},{default:_(()=>[v(x(a.$t("Public.Btn.Import")),1)]),_:1}),d(l,{onClick:K},{default:_(()=>[v(x(a.$t("Public.Btn.Export")),1)]),_:1}),d(l,{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};
