import{a4 as g,e as f}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{as as a,a3 as c,i as l}from"./index-BTglIPU2.js?v=1773287522785";const d=()=>a.post("/plugin?action=a&name=btwaf&s=get_customize_config_help"),x=()=>a.post("/plugin?action=a&name=btwaf&s=get_customize_list"),z=t=>a.post("/plugin?action=a&name=btwaf&s=set_status_customize_rule",t,{requestOptions:{loading:c.global.t("Waf.Api.custom_35"),successMessage:!0}}),S=t=>a.post("/plugin?action=a&name=btwaf&s=create_customize_rule",{infos:JSON.stringify(t)},{requestOptions:{loading:c.global.t("Waf.Api.custom_36"),successMessage:!0}}),h=t=>a.post("/plugin?action=a&name=btwaf&s=update_customize_rule",{id:t.id,infos:JSON.stringify(t.infos)},{requestOptions:{loading:c.global.t("Waf.Api.custom_37"),successMessage:!0}}),N=t=>a.post("/plugin?action=a&name=btwaf&s=remove_customize_rule",t,{requestOptions:{loading:c.global.t("Waf.Api.custom_38"),successMessage:!0}}),A=g("waf-custom-rule",()=>{const t=f({action:[],operators:{},options:[],sitemap:{}}),p=async()=>{const{message:e}=await d();l(e)&&(t.action=e.action,t.operators=e.operators,t.options=e.options,t.sitemap=e.sitemap)},m=()=>{t.action=[],t.operators={},t.options=[],t.sitemap={}},r=e=>{const s=t.options.find(n=>n.type===e);return s?s.text:"--"};return{config:t,getConfig:p,clearConfig:m,getSiteName:e=>e.map(s=>t.sitemap[s]||"--").join(", "),getConditionName:r,getMatchCondition:e=>{const s=[],n=o=>{for(let i=0;i<o.length;i++)if(o[i].type==="block")n(o[i].children);else if(o[i].type==="option"){const{option:u}=o[i];u&&s.push(u.type)}};return n(e.children),[...new Set(s)].map(o=>r(o)).join("，")},getExecuteAction:(e,s)=>{const n=t.action.find(o=>o.type===e);if(n){const o=n.response.find(i=>i.type===s);return o?"".concat(n.text," (").concat(o.text,")"):n.text}return"--"},getOperatorName:e=>t.operators[e]?t.operators[e].text:"--"}});export{S as a,h as e,x as g,N as r,z as s,A as u};
