const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/index231.js?v=1763625242172","js/page_layout.js?v=1763625242172","js/vue.js?v=1763625242172","js/__commonjsHelpers__.js?v=1763625242172","js/naive.js?v=1763625242172","js/common.js?v=1763625242172","js/public.js?v=1763625242172","css/public.css?v=1763625242172","css/page_layout.css?v=1763625242172","css/index97.css?v=1763625242172"])))=>i.map(i=>d[i]);
import{dN as t,dO as e,dP as a,g as s,dQ as i,dR as o,c as n,a as d}from"./page_layout.js?v=1763625242172";import{_ as l}from"./index.js?v=1763625242172";import{e as r,c as m,n as u,f as c,a as p,h as _,_ as f}from"./public.js?v=1763625242172";import{_ as h}from"./index.vue_vue_type_script_setup_true_lang5.js?v=1763625242172";import{dd as y,dS as C,aC as x}from"./naive.js?v=1763625242172";import{k as w,P as W,X as g,R as j,a2 as b,a3 as v,u as k,j as E,a4 as O,V as P,U as R,_ as V}from"./vue.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./index.vue_vue_type_script_setup_true_lang6.js?v=1763625242172";const B=w({__name:"index",setup(w){const B=V((()=>d((()=>import("./index231.js?v=1763625242172")),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])))),{t:L}=W(),S=t(),$=r("",{isEdit:!1,onRefresh:()=>{I()}}),A=()=>{$.data.isEdit=!1,$.data.row=void 0,$.title=L("Waf.Custom.index_4"),$.show=!0},{table:D,columns:N,setLoading:U}=m([{key:"name",title:L("Waf.Custom.index_6"),minWidth:160,ellipsis:{tooltip:!0}},{key:"servers",title:L("Waf.Custom.index_7"),width:"20%",minWidth:260,ellipsis:{tooltip:!0},render:({servers:t})=>S.getSiteName(t)},u({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:L("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:L("Waf.Custom.index_9"),width:"20%",minWidth:160,render:({root:t})=>S.getMatchCondition(t)},{key:"action",title:L("Waf.Custom.index_10"),width:"20%",minWidth:160,render:({action:t})=>{var e;return S.getExecuteAction(t.type,(null==(e=t.response)?void 0:e.type)||"")}},c({width:140,options:t=>[{label:L("Public.Btn.Copy"),onClick:()=>{z(t)}},{label:L("Public.Btn.Edit"),onClick:()=>{(t=>{$.data.isEdit=!0,$.data.row=t,$.title=L("Waf.Custom.index_5",[t.name]),$.show=!0})(t)}},{label:L("Public.Btn.Del"),onClick:()=>{H(t)}}]})]),z=t=>{p({title:L("Waf.Custom.index_11",[t.name]),content:L("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:{}})}}),I()}})},H=t=>{p({title:L("Waf.Custom.index_13",[t.name]),content:L("Waf.Custom.index_14"),onConfirm:async()=>{await i({id:t.id}),I()}})},I=async()=>{try{U(!0);const{message:t}=await o();n(t)&&t.rules&&(D.data=Object.entries(t.rules).map((([t,e])=>({...e,id:t}))))}finally{U(!1)}};return(async()=>{try{U(!0),await S.getConfig(),await I()}finally{U(!1)}})(),(t,e)=>{const a=x,s=_,i=h,o=f,n=l,d=C;return j(),b(d,{class:"p-16px"},{default:v((()=>[g(i,null,{toolsLeft:v((()=>[g(a,{type:"primary",onClick:A},{default:v((()=>[E(O(t.$t("Waf.Custom.index_1")),1)])),_:1})])),table:v((()=>[g(s,{loading:P(D).loading,data:P(D).data,columns:P(N)},null,8,["loading","data","columns"])])),_:1}),g(o,{class:"mt-20px"},{default:v((()=>[R("li",null,O(t.$t("Waf.Custom.index_2")),1),R("li",null,O(t.$t("Waf.Custom.index_3")),1)])),_:1}),g(n,{show:P($).show,"onUpdate:show":e[0]||(e[0]=t=>P($).show=t),title:P($).title,data:P($).data,width:800,"min-height":448,footer:!0,component:P(B)},null,8,["show","title","data","component"])])),_:1})}}});export{B as default};
