import{_ as e}from"./index105.js?v=1761009159";import{u as a,c8 as l,M as t,P as s,p as r,k as n,l as i,$ as d,_ as o}from"./utils-lib.js?v=1761009159";import{c as u,V as m,r as p,b7 as c,aD as I,q as y,H as P,v as f,x as _,e as w,B as b,y as x,z as h,I as V,J as g,C as j,aC as v,aE as U,G as k}from"./base-lib.js?v=1761009159";import{at as C,au as q,av as H,aw as L,ax as R,ay as A}from"./firewall.js?v=1761009159";import{u as z}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const B={class:"flex w-full p-[2rem]"},D={class:"w-[86%] flex-1"},E={class:"flex items-center"},G={class:"flex items-center"},J=o(u({__name:"index",setup(o){a();const u=m(!1),J=p([]),M=p([]),N=c({type:"url",url:"",startIP:"",endIP:"",urlHelp:[{content:"例子1: bt.cn/admin/admin.php?system=abc 添加地址: ^/admin/admin.php"},{content:"例子2: bt.cn/admin/1 1 为可变 1-99 添加地址为: ^/admin/[1-99]"}],ipHelp:[{content:"添加某个IP：起始IP为192.168.10.6 结束IP为192.168.10.6"},{content:"添加IP段：起始IP为192.168.1.1 结束IP为192.168.1.254"}]}),T=e=>{N.type=e.paneName,K()},$=async()=>{switch(N.type){case"url":if(!N.url)return t.error("请输入URL地址");await s({loading:"正在添加，请稍后...",request:q({url_rule:N.url}),message:!0}),N.url="";break;case"ip":if(!l(N.startIP)||!l(N.endIP))return t.error("IP地址格式不正确");await s({loading:"正在添加，请稍后...",request:C({start_ip:N.startIP,end_ip:N.endIP}),message:!0}),N.startIP="",N.endIP=""}K()},F=async()=>{await r({title:"清空白名单",content:"是否清空白名单？",icon:"warning-filled"}),await s({loading:"正在清空，请稍后...",request:H({type:N.type+"_white"}),message:!0,success:e=>{e.status&&K()}})},K=async()=>{await s({loading:u,request:L(),data:{ip_white:[Array,J],url_white:[Array,M]}})},O=async(e,a)=>{const l="url"===N.type;l?a-=1:a=J.value.findIndex(a=>a.at(0)===e.at(0)&&a.at(1)===e.at(1)),await s({loading:"正在删除，请稍后...",request:l?R({index:a}):A({index:a}),message:!0,success:e=>{e.status&&K()}})},Q=[{label:"起始IP",render:e=>I("span",e[0])},{label:"结束IP",render:e=>I("span",e[1])},z([{onClick:O,title:"删除"}])],S=[{label:"URL",render:e=>I("span",e)},z([{onClick:O,title:"删除"}])];return y(()=>K()),(a,l)=>{const t=v,s=U,r=n,o=k,m=i,p=d,c=e,I=P("bt-loading");return f(),_("div",B,[w(s,{"tab-position":"left",modelValue:x(N).type,"onUpdate:modelValue":l[0]||(l[0]=e=>x(N).type=e),onTabClick:T,class:"w-[8%] mr-[2.4rem]"},{default:b(()=>[w(t,{label:"URL白名单",name:"url"}),w(t,{label:"IP白名单",name:"ip"})]),_:1},8,["modelValue"]),h("div",D,[w(c,{class:"flex-1"},{"header-left":b(()=>[V(h("div",E,[w(r,{modelValue:x(N).url,"onUpdate:modelValue":l[1]||(l[1]=e=>x(N).url=e),width:"30rem",placeholder:"URL地址，例如：/admin/update"},null,8,["modelValue"])],512),[[g,"url"===x(N).type]]),V(h("div",G,[w(r,{modelValue:x(N).startIP,"onUpdate:modelValue":l[2]||(l[2]=e=>x(N).startIP=e),width:"25rem",placeholder:"起始IP地址"},null,8,["modelValue"]),w(r,{modelValue:x(N).endIP,"onUpdate:modelValue":l[3]||(l[3]=e=>x(N).endIP=e),class:"ml-[0.8rem]",width:"25rem",placeholder:"结束IP地址"},null,8,["modelValue"])],512),[[g,"ip"===x(N).type]]),w(o,{type:"primary",title:"添加",onClick:$,class:"ml-[0.8rem]"},{default:b(()=>l[4]||(l[4]=[j(" 添加 ",-1)])),_:1,__:[4]}),w(o,{onClick:F},{default:b(()=>l[5]||(l[5]=[j("清空",-1)])),_:1,__:[5]})]),content:b(()=>[V(w(m,{column:"url"===x(N).type?S:Q,data:"url"===x(N).type?x(M):x(J)},null,8,["column","data"]),[[I,x(u)],[I,"正在加载列表，请稍后...","title"]])]),"footer-left":b(()=>[w(p,{"list-style":"disc",options:"ip"===x(N).type?x(N).ipHelp:x(N).urlHelp,class:"mt-[2rem] ml-[2rem]"},null,8,["options"])]),_:1})])])}}}),[["__scopeId","data-v-dba09103"]]);export{J as default};
