import{r as e}from"./rolldown-runtime-BM3Ffeng.js";import{A as t,D as n,E as r,I as i,N as a,P as o,Tt as s,Xt as c,Z as l,et as u,ht as d,it as f,k as p,nt as m,qt as h,x as g}from"./vue-vendor-DMUmTARL.js";import{$t as _,Qt as v,fs as y,ri as b,xn as x}from"./icons-vendor-Buq6V-Ga.js";import{f as S}from"./admin-setting-DI6F8jmk.js";import{t as C}from"./dns-mYcFIhlo.js";var w={id:`dns`,class:`rounded-zf-lg border border-border-light bg-surface p-5 sm:p-6`},ee={class:`mb-4 flex items-center justify-between`},T={class:`flex items-center gap-2 text-sm font-semibold text-primary`},E={key:0,class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},D={class:`grid grid-cols-2 gap-3 sm:grid-cols-4`},O={class:`rounded-zf-md border border-border-light p-4`},k={class:`flex items-center gap-1.5 text-xs text-secondary`},A={class:`mt-1.5 text-sm font-semibold text-regular`},j={class:`rounded-zf-md border border-border-light p-4`},M={class:`flex items-center gap-1.5 text-xs text-secondary`},N=[`title`],P={class:`rounded-zf-md border border-border-light p-4`},F={class:`flex items-center gap-1.5 text-xs text-secondary`},I={class:`mt-1.5 text-sm font-semibold text-regular`},L={class:`rounded-zf-md border border-border-light p-4`},R={class:`flex items-center gap-1.5 text-xs text-secondary`},z={class:`mt-1.5 flex items-center gap-1.5`},B=[`title`],V={key:0,class:`mt-3 flex items-center gap-1 text-xs text-placeholder`},H=i({__name:`DnsStatusSection`,setup(e,{expose:i}){let H=s(null),U=s(!0),W=async()=>{U.value=!0;try{H.value=C((await S())?.data)}catch(e){console.error(`获取 DNS 状态失败:`,e)}finally{U.value=!1}},G=r(()=>H.value?.dnsMode===`custom`?`自定义 DNS`:`系统 DNS`),K=r(()=>H.value?.customDnsServer||`系统默认`),q=r(()=>H.value?.lastCheckStatus??null),J=r(()=>{switch(q.value){case`success`:return`正常`;case`warn`:return`告警`;case`fail`:return`异常`;default:return`未检测`}}),Y=r(()=>{switch(q.value){case`success`:return`bg-success-soft text-success`;case`warn`:return`bg-warning-soft text-warning`;case`fail`:return`bg-danger-soft text-danger`;default:return`bg-page text-secondary`}}),X=r(()=>{switch(q.value){case`success`:return`text-success`;case`warn`:return`text-warning`;case`fail`:return`text-danger`;default:return`text-regular`}}),Z=r(()=>{switch(q.value){case`success`:return`bg-success`;case`warn`:return`bg-warning`;case`fail`:return`bg-danger`;default:return`bg-border`}}),Q=r(()=>{let e=H.value?.lastCheckTime;return e?new Date(e).toLocaleString():`尚未检测`}),$=r(()=>H.value?.lastCheckMessage||``);return i({refresh:W}),l(W),(e,r)=>{let i=f(`router-link`),s=v,l=_,S=b,C=x,W=y;return u(),t(`section`,w,[n(`div`,ee,[n(`div`,null,[n(`h2`,T,[r[0]||=a(` DNS 情况 `,-1),n(`span`,{class:h([`flex items-center gap-1 rounded-zf-sm px-1.5 py-0.5 text-xs font-medium`,Y.value])},[n(`span`,{class:h([`h-1.5 w-1.5 rounded-full`,Z.value])},null,2),a(` `+c(J.value),1)],2)]),r[1]||=n(`p`,{class:`mt-0.5 text-xs text-placeholder`},`解析模式与最近一次检测结果`,-1)]),o(i,{to:`/admin/dns-setting`,class:`text-xs font-medium text-zp hover:underline`},{default:d(()=>[...r[2]||=[a(` 设置 → `,-1)]]),_:1})]),U.value&&!H.value?(u(),t(`div`,E,[(u(),t(g,null,m(4,e=>n(`div`,{key:`dns-skeleton-${e}`,class:`h-[5.5rem] animate-pulse rounded-zf-md border border-border-light bg-zf-hover`})),64))])):(u(),t(g,{key:1},[n(`div`,D,[n(`div`,O,[n(`div`,k,[o(s,{class:`h-3.5 w-3.5 text-placeholder`}),r[3]||=a(` 模式 `,-1)]),n(`div`,A,c(G.value),1)]),n(`div`,j,[n(`div`,M,[o(l,{class:`h-3.5 w-3.5 text-placeholder`}),r[4]||=a(` Server `,-1)]),n(`div`,{class:`mt-1.5 truncate text-sm font-semibold text-regular`,title:K.value},c(K.value),9,N)]),n(`div`,P,[n(`div`,F,[o(S,{class:`h-3.5 w-3.5 text-placeholder`}),r[5]||=a(` 最近检测 `,-1)]),n(`div`,I,c(Q.value),1)]),n(`div`,L,[n(`div`,R,[o(C,{class:`h-3.5 w-3.5 text-placeholder`}),r[6]||=a(` 检测状态 `,-1)]),n(`div`,z,[n(`span`,{class:h([`h-1.5 w-1.5 rounded-full`,Z.value])},null,2),n(`span`,{class:h([`text-sm font-semibold`,X.value])},c(J.value),3)]),$.value?(u(),t(`div`,{key:0,class:`mt-0.5 truncate text-xs text-placeholder`,title:$.value},c($.value),9,B)):p(``,!0)])]),q.value?p(``,!0):(u(),t(`p`,V,[o(W,{class:`h-3.5 w-3.5 shrink-0`}),r[8]||=a(` 尚未进行 DNS 检测，可前往 `,-1),o(i,{to:`/admin/dns-setting`,class:`font-medium text-zp hover:underline`},{default:d(()=>[...r[7]||=[a(` DNS 设置 `,-1)]]),_:1}),r[9]||=a(` 手动检测 `,-1)]))],64))])}}}),U=e({default:()=>W}),W=H;export{U as n,W as t};