import{u as e,n as a,Q as t,P as s,W as r,O as o,l as n,ah as l,p as i,_ as p}from"./utils-lib.js?v=1761009159";import{_ as d}from"./index105.js?v=1761009159";import{_ as c}from"./index114.js?v=1761009159";import{c as m,r as u,o as _,e as f,C as y,q as g,H as v,v as w,x as h,y as b,N as I,B as P,D as j,Q as x,I as A,G as S}from"./base-lib.js?v=1761009159";import{_ as k}from"./index133.js?v=1761009159";import{z as q,A as C,B as E}from"./firewall.js?v=1761009159";import{p as F}from"./validator.js?v=1761009159";import{u as O,r as T,e as V,b as D,f as H}from"./useMethod6.js?v=1761009159";import{a as L}from"./column.js?v=1761009159";import{_ as N}from"./index.vue_vue_type_script_setup_true_lang11.js?v=1761009159";import{g as R}from"./useStore5.js?v=1761009159";import{_ as U}from"./index.vue_vue_type_script_setup_true_lang12.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1761009159";const z={class:"min-h-[30rem]"},B=p(m({__name:"index",setup(p){const{payment:m}=e(),{refs:{systemTabActive:B,firewallInfo:J}}=R(),Q=u(null),G=u([]),M=u(""),W=u(0),Z=u(!1),K=_({p:1,row:20}),X=(e,s)=>{a({title:e?"修改IP规则":"添加IP规则",area:44,component:()=>t(()=>import("./add-ip-rules.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),showFooter:!0,compData:{...s,isEdit:e,refreshFn:Y}})},Y=async e=>{"ip"===B.value&&(e&&(D.value=e),await s({loading:Z,request:q({chain:D.value||"ALL",...K,query:M.value}),data:{data:[Array,G],page:r(W)}}))},$=(e,a)=>{const t={operation:a,address:e.Address,strategy:e.Strategy,chain:e.Chain,family:e.Family,zone:e.Zone};return"remove"===a&&(t.stype=e.stype),t},ee=[{label:"删除",value:"delete",event:async(e,a)=>{await H(e,a,async(e,a)=>{const t=$(e,"remove");return await E(t)},{label:"IP地址",prop:"Address"},Y)}}],ae=[L(),{label:"IP地址",prop:"Address",width:120},{label:"IP归属地",render:e=>"ltd"!=m.value.authType?f("span",{class:"bt-link",onClick:()=>F({sourceId:116})},[y("点击查看")]):f("span",null,[(e.area.continent||"")+(e.area.info||"--")])},...O({changePolicy:async e=>{const a="accept"!==e.Strategy;await i({icon:"warning-filled",title:(a?"放行":"禁止")+"IP规则策略【"+e.Address+"】",content:"修改IP策略为“".concat(a?"放行":"禁止","”，设置后该IP将").concat(a?"恢复正常访问":"禁止访问服务器","，是否继续操作？")});const t={old_data:JSON.stringify(e),new_data:JSON.stringify({...$({...e,Strategy:a?"accept":"drop"},"add"),brief:e.brief})};await s({loading:"正在修改IP规则策略，请稍后...",request:C(t),message:!0,success:()=>Y()})},change:Y}),{label:"备注",prop:"brief"},{label:"时间",prop:"addtime",renderHeader:()=>T("时间","-- : 表示面板数据库中未记录创建时间，规则从系统中直接读取，忽略即可")},{label:"过期时间",prop:"expiry_date",width:160,render:e=>e.expiry_date?f("span",null,[e.expiry_date]):f("span",null,[y("--")])},V({editEvent:e=>X(!0,e),deleteEvent:async e=>{await i({icon:"warning-filled",title:"删除端口规则【"+e.Address+"】",content:"删除选中的规则后，该IP将使用默认放行的方式，是否继续操作？"}),await s({loading:"正在删除IP规则，请稍后...",request:E($(e,"remove")),message:!0,success:()=>Y()})}})];return g(()=>Y()),(e,a)=>{const t=k,s=S,r=o,i=n,p=l,m=c,u=d,_=v("bt-loading");return w(),h("div",z,[b(J).init_status?j("",!0):(w(),I(t,{key:0,width:"38rem"},{content:P(()=>[f(U)]),_:1})),f(u,null,{"header-left":P(()=>[f(s,{type:"primary",onClick:a[0]||(a[0]=e=>X())},{default:P(()=>a[6]||(a[6]=[y("添加IP规则",-1)])),_:1,__:[6]}),f(N,{type:"ip",refreshFn:Y})]),"header-right":P(()=>[f(r,{class:"!w-[32rem]",modelValue:b(M),"onUpdate:modelValue":a[1]||(a[1]=e=>x(M)?M.value=e:null),onSearch:a[2]||(a[2]=e=>Y()),placeholder:"请输入IP地址/备注"},null,8,["modelValue"])]),content:P(()=>[A(f(i,{ref_key:"ipTableRef",ref:Q,column:ae,data:b(G),description:"IP列表为空"},null,8,["data"]),[[_,b(Z)],[_,"正在加载IP列表，请稍后...","title"]])]),"footer-left":P(()=>[f(p,{"table-ref":b(Q),options:ee},null,8,["table-ref"])]),"footer-right":P(()=>[f(m,{ref:"ipRulesPager",total:b(W),page:b(K).p,"onUpdate:page":a[3]||(a[3]=e=>b(K).p=e),row:b(K).row,"onUpdate:row":a[4]||(a[4]=e=>b(K).row=e),onChange:a[5]||(a[5]=e=>Y()),name:"ip"},null,8,["total","page","row"])]),_:1})])}}}),[["__scopeId","data-v-e139b88c"]]);export{B as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
