const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/index223.js?v=1753954525509","js/page_layout.js?v=1753954525509","js/vue.js?v=1753954525509","js/__commonjsHelpers__.js?v=1753954525509","js/naive.js?v=1753954525509","js/common.js?v=1753954525509","js/public.js?v=1753954525509","css/public.css?v=1753954525509","css/page_layout.css?v=1753954525509","css/index88.css?v=1753954525509"])))=>i.map(i=>d[i]);
import{c_ as t,d0 as e,d1 as a,g as s,d2 as i,d3 as o,c as n,a as l}from"./page_layout.js?v=1753954525509";import{_ as d}from"./index.js?v=1753954525509";import{e as r,b as c,o as m,h as u,d as _,f as p,_ as f}from"./public.js?v=1753954525509";import{_ as h}from"./index.vue_vue_type_script_setup_true_lang4.js?v=1753954525509";import{c0 as y,cD as C,ay as x}from"./naive.js?v=1753954525509";import{k as w,P as W,Q as g,U as b,a1 as j,a2 as v,u as k,j as E,a3 as O,X as P,W as B,_ as D}from"./vue.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";import"./index.vue_vue_type_script_setup_true_lang7.js?v=1753954525509";const L=w({__name:"index",setup(w){const L=D((()=>l((()=>import("./index223.js?v=1753954525509")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])))),{t:V}=W(),$=t(),A=r("",{isEdit:!1,onRefresh:()=>{M()}}),R=()=>{A.data.isEdit=!1,A.data.row=void 0,A.title=V("Waf.Custom.index_4"),A.show=!0},{table:S,columns:U,setLoading:z}=c([{key:"name",title:V("Waf.Custom.index_6"),minWidth:160,ellipsis:{tooltip:!0}},{key:"servers",title:V("Waf.Custom.index_7"),width:"20%",minWidth:260,ellipsis:{tooltip:!0},render:({servers:t})=>$.getSiteName(t)},m({width:"10%",minWidth:100,status:t=>({checkedValue:1,uncheckedValue:0,onClick:async a=>{await e({id:t.id,status:a}),t.status=a}})}),{key:"hit",title:V("Waf.Custom.index_8"),width:"10%",minWidth:100,render:({hit:t})=>{return g(y,{size:"small",type:t>0?"success":"default",bordered:!1},"function"==typeof(e=t)||"[object Object]"===Object.prototype.toString.call(e)&&!k(e)?t:{default:()=>[t]});var e}},{key:"root",title:V("Waf.Custom.index_9"),width:"20%",minWidth:160,render:({root:t})=>$.getMatchCondition(t)},{key:"action",title:V("Waf.Custom.index_10"),width:"20%",minWidth:160,render:({action:t})=>{var e;return $.getExecuteAction(t.type,(null==(e=t.response)?void 0:e.type)||"")}},u({width:140,options:t=>[{label:V("Public.Btn.Copy"),onClick:()=>{H(t)}},{label:V("Public.Btn.Edit"),onClick:()=>{(t=>{A.data.isEdit=!0,A.data.row=t,A.title=V("Waf.Custom.index_5",[t.name]),A.show=!0})(t)}},{label:V("Public.Btn.Del"),onClick:()=>{I(t)}}]})]),H=t=>{_({title:V("Waf.Custom.index_11",[t.name]),content:V("Waf.Custom.index_12"),onConfirm:async()=>{await a({name:"".concat(t.name,"_copy_").concat(s(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:{}})}}),M()}})},I=t=>{_({title:V("Waf.Custom.index_13",[t.name]),content:V("Waf.Custom.index_14"),onConfirm:async()=>{await i({id:t.id}),M()}})},M=async()=>{try{z(!0);const{message:t}=await o();n(t)&&t.rules&&(S.data=Object.entries(t.rules).map((([t,e])=>({...e,id:t}))))}finally{z(!1)}};return(async()=>{try{z(!0),await $.getConfig(),await M()}finally{z(!1)}})(),(t,e)=>{const a=x,s=p,i=h,o=f,n=d,l=C;return b(),j(l,{class:"p-16px"},{default:v((()=>[g(i,null,{toolsLeft:v((()=>[g(a,{type:"primary",onClick:R},{default:v((()=>[E(O(t.$t("Waf.Custom.index_1")),1)])),_:1})])),table:v((()=>[g(s,{loading:P(S).loading,data:P(S).data,columns:P(U)},null,8,["loading","data","columns"])])),_:1}),g(o,{class:"mt-20px"},{default:v((()=>[B("li",null,O(t.$t("Waf.Custom.index_2")),1),B("li",null,O(t.$t("Waf.Custom.index_3")),1)])),_:1}),g(n,{show:P(A).show,"onUpdate:show":e[0]||(e[0]=t=>P(A).show=t),title:P(A).title,data:P(A).data,width:800,"min-height":448,footer:!0,component:P(L)},null,8,["show","title","data","component"])])),_:1})}}});export{L as default};
