import{_ as e}from"./index133.js?v=1761009159";import{K as r,bq as a,k as t}from"./utils-lib.js?v=1761009159";import{c as l,g as s,e as i,U as u,C as m,G as o,v as p,x as n,y as d,F as v,N as c,B as b,A as y,D as g,z as f,K as x}from"./base-lib.js?v=1761009159";import{u as h,S as w}from"./useStore4.js?v=1761009159";import{i as _,h as k,p as V,a as j,o as C,m as E,b as I}from"./useController15.js?v=1761009159";const U={key:1,class:"bg-light flex items-center justify-center min-h-[60rem]"},q={class:"bg-lighter px-[48px] py-[16px] text-default flex"},B=l({__name:"index",setup(l,{expose:B}){const{isBindExtranet:N,siteInfo:K}=h(),{jumpTabEvent:P}=w(),{BtForm:F,submit:S}=r({data:_,options:e=>s(()=>{var r;return[{type:"custom",render:()=>i(a,{label:"是否启用"},{default:()=>[i(u,{modelValue:e.value.value,"onUpdate:modelValue":r=>e.value.value=r,onChange:r=>k(r,e.value)},{default:()=>[m("启用流量控制")]})]})},{type:"select",label:"限制方案",key:"type",options:V.value,attrs:{style:"width: 24rem;",onChange:r=>{const{perserver:a,perip:t,limit_rate:l}=V.value[r].items;e.value.perserver=a,e.value.perip=t,e.value.limit_rate=l}}},{type:"custom",render:()=>i(a,{label:"并发限制",prop:"perserver"},{default:()=>[i(t,{modelValue:e.value.perserver,"onUpdate:modelValue":r=>e.value.perserver=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("div",{class:"text-tertiary text-small"},[m("* 限制当前站点最大并发数")])]}),rules:{perserver:[{required:!0,message:"请输入并发限制",trigger:"blur"},{validator:(e,r,a)=>{r>65535&&a(new Error("不能大于65535")),Number.isInteger(1*r)?a():a(new Error("输入必须为整数"))}}]}},{type:"custom",render:()=>i(a,{label:"单IP限制",prop:"perip"},{default:()=>[i(t,{modelValue:e.value.perip,"onUpdate:modelValue":r=>e.value.perip=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("span",{class:"text-tertiary text-small"},[m("* 限制单个IP访问最大并发数")])]}),rules:{perip:[{required:!0,message:"请输入单IP限制",trigger:"blur"},{validator:(e,r,a)=>{r>65535&&a(new Error("不能大于65535")),Number.isInteger(1*r)?a():a(new Error("输入必须为整数"))}}]}},{type:"custom",render:()=>i(a,{label:"流量限制",prop:"limit_rate"},{default:()=>[i(t,{modelValue:e.value.limit_rate,"onUpdate:modelValue":r=>e.value.limit_rate=r,type:"number",width:"24rem",class:"mr-1rem"},null),i("span",{class:"text-tertiary text-small"},[m("* 限制每个请求的流量上限（单位：KB）")])]}),rules:{limit_rate:[{required:!0,message:"请输入流量限制",trigger:"blur"},{validator:(e,r,a)=>{Number.isInteger(1*r)?a():a(new Error("输入必须为整数"))}}]}},...(null==(r=K.value)?void 0:r.id)&&!j.value?[{type:"custom",render:()=>i(a,{label:" "},{default:()=>[i(o,{type:"primary",onClick:S},{default:()=>[e.value.value?"保存":"保存并启用"]})]})}]:[]]}),submit:async(e,r)=>(await r(),await C(e.value))});return B({onConfirm:S}),(r,a)=>{const t=e;return p(),n("div",{class:x(["h-full",{"p-2rem":d(j)}])},[d(N)?(p(),n(v,{key:0},[d(E)?(p(),c(t,{key:0,width:"36rem"},{content:b(()=>[m(y(d(I)),1)]),_:1})):g("",!0),i(d(F))],64)):(p(),n("div",U,[f("div",q,[a[1]||(a[1]=m(" 请开启 ",-1)),f("span",{class:"mx-[.4rem] bt-link",onClick:a[0]||(a[0]=e=>d(P)("mapping"))}," 外网映射 "),a[2]||(a[2]=m(" 后查看流量限制 ",-1))])]))],2)}}});export{B as _};
