import{_ as $}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as I}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{k as P,R as j,r as f,$ as D,Z as E,_ as p,a0 as n,ai as A,X as N,S as u,a9 as i,j as m,aa as s}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{i as R,m as g,p as v,ht as U,h as V}from"./index-BTglIPU2.js?v=1773287522785";import{u as K}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as L}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{P as T,g as F,Q as G,R as M,S as O}from"./setting-DouXuJGW.js?v=1773287522785";import{_ as y}from"./index-CZps0rIN.js?v=1773287522785";import{b as Q,B as X,k as Z}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const q={class:"p-20px"},z={class:"flex mb-16px"},H={class:"flex-1 mr-16px"},J="body_intercept",dt=P({__name:"config",setup(Y){const{t:e}=j(),a=f(""),_=async()=>{if(a.value.trim()===""){g.error(e("Waf.Setting.config_176"));return}await G({text:a.value}),a.value="",l()},b=()=>{const t=f("");v({title:e("Waf.Setting.config_187"),width:440,footer:!0,content:()=>n("div",{class:"p-20px"},[n(y,{value:t.value,"onUpdate:value":o=>t.value=o,rows:14,placeholder:e("Waf.Setting.config_188")},null)]),onConfirm:async()=>{if(t.value.trim()==="")return g.error(e("Waf.Setting.config_179")),!1;await M({text:t.value}),l()}})},w=()=>{const t=f(r.data.map(o=>o.word).join("\n"));v({title:e("Waf.Setting.config_177"),width:440,footer:!0,content:()=>n("div",{class:"p-20px"},[n(y,{value:t.value,"onUpdate:value":o=>t.value=o,rows:14,readonly:!0},null)]),onConfirm:()=>(U(t.value,"".concat(J,".json")),!1)})},h=()=>{V({title:e("Waf.Setting.config_180"),content:e("Waf.Setting.config_181"),onConfirm:async()=>{await O(),l()}})},{table:r,columns:B,setLoading:d}=L([{key:"word",title:e("Waf.Setting.config_184")},K({width:80,options:t=>[{label:e("Public.Btn.Del"),onClick:async()=>{await T({text:t.word}),l()}}]})]),l=async()=>{try{d(!0);const{message:t}=await F();R(t)&&(r.data=t.body_intercept.map(o=>({word:o})))}finally{d(!1)}};return l(),(t,o)=>{const S=Q,c=X,x=I,C=Z,W=$;return D(),E("div",q,[p("div",z,[p("div",H,[n(S,{value:u(a),"onUpdate:value":o[0]||(o[0]=k=>N(a)?a.value=k:null),placeholder:t.$t("Waf.Setting.config_184"),onKeyup:A(_,["enter"])},null,8,["value","placeholder"])]),n(c,{type:"primary",onClick:_},{default:i(()=>[m(s(t.$t("Public.Btn.Add")),1)]),_:1})]),n(x,{"max-height":258,loading:u(r).loading,data:u(r).data,columns:u(B)},null,8,["loading","data","columns"]),n(C,{class:"mt-16px"},{default:i(()=>[n(c,{onClick:b},{default:i(()=>[m(s(t.$t("Public.Btn.Import")),1)]),_:1}),n(c,{onClick:w},{default:i(()=>[m(s(t.$t("Public.Btn.Export")),1)]),_:1}),n(c,{onClick:h},{default:i(()=>[m(s(t.$t("Public.Btn.Empty")),1)]),_:1})]),_:1}),n(W,{class:"mt-16px"},{default:i(()=>[p("li",null,s(t.$t("Waf.Setting.config_185")),1),p("li",null,s(t.$t("Waf.Setting.config_186")),1)]),_:1})])}}});export{dt as default};
