const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/index-DiJQ42Fa.js?v=1773287522785","js/index-BTglIPU2.js?v=1773287522785","js/vue-core-DJjvd5ZC.js?v=1773287522785","js/prismjs-BZPoR7_J.js?v=1773287522785","css/prismjs-D-3FhBe_.css?v=1773287522785","js/naive-ui--dJnpVcV.js?v=1773287522785","css/index-DEM1fxGq.css?v=1773287522785","js/copy-D-wIKr0q.js?v=1773287522785","js/custom-W85Jyu3e.js?v=1773287522785","css/index-DOf9IerQ.css?v=1773287522785"])))=>i.map(i=>d[i]);
import{v as S,h as p,k as $,i as j,x as v,P as V}from"./index-BTglIPU2.js?v=1773287522785";import{_ as D}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as O}from"./index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785";import{_ as P}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{u as A}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{a as L,u as N}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as z,s as M,a as T,r as I,g as F}from"./custom-W85Jyu3e.js?v=1773287522785";import{o as U,B as q,a2 as G}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{k as H,R as J,a0 as a,$ as K,a8 as Q,a9 as i,S as s,j as X,aa as _,_ as f,a3 as Y,u as Z}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-B7YvCBmY.js?v=1773287522785";import"./data-BVsViUMm.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";function tt(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Object]"&&!Z(l)}const ht=H({__name:"index",setup(l){const C=Y(()=>V(()=>import("./index-DiJQ42Fa.js?v=1773287522785"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),{t:e}=J(),m=z(),o=S("",{isEdit:!1,onRefresh:()=>{r()}}),y=()=>{o.data.isEdit=!1,o.data.row=void 0,o.title=e("Waf.Custom.index_4"),o.show=!0},h=t=>{o.data.isEdit=!0,o.data.row=t,o.title=e("Waf.Custom.index_5",[t.name]),o.show=!0},{table:d,columns:b,setLoading:u}=A([{key:"name",title:e("Waf.Custom.index_6"),minWidth:160,ellipsis:{tooltip:!0}},{key:"servers",title:e("Waf.Custom.index_7"),width:"20%",minWidth:260,ellipsis:{tooltip:!0},render:({servers:t})=>m.getSiteName(t)},L({width:"10%",minWidth:100,status:t=>({checkedValue:1,uncheckedValue:0,onClick:async n=>{await M({id:t.id,status:n}),t.status=n}})}),{key:"hit",title:e("Waf.Custom.index_8"),width:"10%",minWidth:100,render:({hit:t})=>a(U,{size:"small",type:t>0?"success":"default",bordered:!1},tt(t)?t:{default:()=>[t]})},{key:"root",title:e("Waf.Custom.index_9"),width:"20%",minWidth:160,render:({root:t})=>m.getMatchCondition(t)},{key:"action",title:e("Waf.Custom.index_10"),width:"20%",minWidth:160,render:({action:t})=>{var n;return m.getExecuteAction(t.type,((n=t.response)==null?void 0:n.type)||"")}},N({width:140,options:t=>[{label:e("Public.Btn.Copy"),onClick:()=>{g(t)}},{label:e("Public.Btn.Edit"),onClick:()=>{h(t)}},{label:e("Public.Btn.Del"),onClick:()=>{W(t)}}]})]),g=t=>{p({title:e("Waf.Custom.index_11",[t.name]),content:e("Waf.Custom.index_12"),onConfirm:async()=>{await T({name:"".concat(t.name,"_copy_").concat($(6)),servers:t.servers?t.servers:[],status:1,is_global:0,priority:0,root:t.root,action:{type:t.action.type,response:Object.assign({},t.action.response,{headers:{}})}}),r()}})},W=t=>{p({title:e("Waf.Custom.index_13",[t.name]),content:e("Waf.Custom.index_14"),onConfirm:async()=>{await I({id:t.id}),r()}})},r=async()=>{try{u(!0);const{message:t}=await F();j(t)&&t.rules&&(d.data=Object.entries(t.rules).map(([n,c])=>({...c,id:n})))}finally{u(!1)}};return(async()=>{try{u(!0),await m.getConfig(),await r()}finally{u(!1)}})(),(t,n)=>{const c=q,x=P,k=O,w=D,R=v,B=G;return K(),Q(B,{class:"p-16px"},{default:i(()=>[a(k,null,{toolsLeft:i(()=>[a(c,{type:"primary",onClick:y},{default:i(()=>[X(_(t.$t("Waf.Custom.index_1")),1)]),_:1})]),table:i(()=>[a(x,{loading:s(d).loading,data:s(d).data,columns:s(b)},null,8,["loading","data","columns"])]),_:1}),a(w,{class:"mt-20px"},{default:i(()=>[f("li",null,_(t.$t("Waf.Custom.index_2")),1),f("li",null,_(t.$t("Waf.Custom.index_3")),1)]),_:1}),a(R,{show:s(o).show,"onUpdate:show":n[0]||(n[0]=E=>s(o).show=E),title:s(o).title,data:s(o).data,width:800,"min-height":448,footer:!0,component:s(C)},null,8,["show","title","data","component"])]),_:1})}}});export{ht as default};
