import{aK as a,P as e,$ as s}from"./utils-lib.js?v=1761009159";import{c as l,r as t,q as u,H as n,I as o,y as m,v as i,x as c,z as r,e as v,B as d,F as p,b0 as f,Q as _,C as y,al as b,G as j,N as x,ak as k}from"./base-lib.js?v=1761009159";import{getDefaultSite as g,setDefaultSite as w}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const V={class:"p-[20px]"},h=l({__name:"defalut-site",setup(l){const h=t(!1),q=t([{name:"默认站点",value:"default"},{name:"自定义站点",value:"custom"}]),C=t("default"),H=async()=>{const a={name:"未设置默认站点"===C.value?"0":C.value};h.value=!0,await e({loading:"正在设置默认站点，请稍后...",request:w(a),message:!0}),h.value=!1};return u(()=>{(async()=>{h.value=!0;try{const{data:a}=await g();C.value=a.defaultSite,a.defaultSite||(C.value="未设置默认站点"),q.value=a.sites,q.value.unshift({name:"未设置默认站点",value:"未设置默认站点"})}catch(e){a(e)}finally{h.value=!1}})()}),(a,e)=>{const l=k,t=b,u=j,g=s,w=n("bt-loading");return o((i(),c("div",V,[e[2]||(e[2]=r("span",{class:"mr-[12px]"},"默认站点",-1)),v(t,{modelValue:m(C),"onUpdate:modelValue":e[0]||(e[0]=a=>_(C)?C.value=a:null),class:"!w-[32rem]"},{default:d(()=>[(i(!0),c(p,null,f(m(q),(a,e)=>(i(),x(l,{key:e,label:a.name,value:a.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),v(u,{type:"primary",onClick:H,class:"!my-[20px] !block"},{default:d(()=>e[1]||(e[1]=[y("保存",-1)])),_:1,__:[1]}),v(g,{options:[{content:"设置默认站点后,所有未绑定的域名和IP都被定向到默认站点"},{content:"可有效防止恶意解析"}]})])),[[w,m(h)]])}}});export{h as default};
