1import{cg as P,d0 as z,cF as F,cH as M,c6 as i,c3 as t,c$ as s,cX as n,c5 as E,cd as B,cx as h,bG as U,cc as A,c4 as O,bV as W,bW as H,f as $,cQ as G,cO as y,c1 as J,cJ as r}from"./vendor-vue-C3df0gLH.js";import{s as Q}from"./vendor-BAp2x3JD.js";import"./vendor-charts-BofaT7g3.js";const X={class:"h-full bg-gray-50 p-6 relative"},q={class:"absolute top-6 left-6 z-20 hidden md:block"},Y={key:0,href:"/",class:"cursor-pointer transition-transform duration-200 hover:scale-105 flex items-center gap-2"},Z=["src","alt"],tt={class:"text-2xl font-bold"},et={class:"max-w-3xl mx-auto pt-16 md:pt-24"},st={key:0,class:"flex items-center justify-center pb-12 relative z-10 md:hidden"},at={href:"/",class:"cursor-pointer transition-transform duration-200 hover:scale-105 flex items-center gap-2"},nt=["src","alt"],ot={class:"text-2xl font-bold"},lt={class:"flex items-center justify-between mb-8"},rt={class:"text-2xl font-bold text-gray-800"},ct={class:"text-gray-500 text-sm mt-1"},it=["disabled"],ut={class:"bg-white border border-gray-200 rounded-xl p-6 mb-6 shadow-sm"},dt={class:"flex items-center justify-between"},ht={class:"flex items-center gap-4"},mt={class:"text-xl font-semibold text-gray-800"},ft={class:"text-gray-500 text-sm"},gt={class:"text-gray-400 ml-2"},wt={class:"text-right"},yt={class:"text-gray-500 text-sm"},xt={class:"mt-4 pt-4 border-t border-gray-100 flex items-center justify-between"},_t={class:"text-gray-500 text-sm"},pt={key:0,class:"text-gray-400 text-sm"},vt={key:1,class:"text-gray-700 text-sm font-mono"},bt={key:2,href:"https://ip.me",target:"_blank",class:"text-blue-500 text-sm hover:underline"},kt={class:"space-y-3"},St={class:"flex items-center justify-between"},Ct={class:"flex items-center gap-3"},Tt={class:"text-gray-800 font-medium"},It={class:"text-gray-400 text-xs font-mono truncate max-w-md"},Et={class:"flex items-center gap-6 text-right"},At={class:"text-gray-400 text-xs"},Ot={class:"mt-6 rounded-2xl border border-gray-200/80 bg-white/85 p-4 shadow-sm supports-[backdrop-filter]:bg-white/75"},jt={class:"text-sm text-gray-600"},Kt={class:"mt-3 flex flex-wrap items-center gap-x-5 gap-y-2 text-sm"},Nt={class:"flex items-center gap-2"},Rt={class:"text-gray-700"},Dt={class:"text-gray-400"},Vt={class:"flex items-center gap-2"},Lt={class:"text-gray-700"},Pt={class:"text-gray-400"},zt={class:"flex items-center gap-2"},Ft={class:"text-gray-700"},Mt={class:"text-gray-400"},Bt=5*60*1e3,Gt=P({__name:"NetworkStatus",setup(Ut){const{t:a}=z(),x="/daren360-favicon.png",g=y([{nameKey:"networkStatus.endpointMainApi",url:"https://api.ailingtu.com",status:"pending",latency:null,lastChecked:null,type:"api"},{nameKey:"networkStatus.endpointClientApp",url:"https://app.ailingtu.com",status:"pending",latency:null,lastChecked:null,type:"website"},{nameKey:"networkStatus.endpointOfficialSite",url:"https://www.ailingtu.com",status:"pending",latency:null,lastChecked:null,type:"website"},{nameKey:"networkStatus.endpointFileUpload",url:"https://static.ailingtu.com",status:"pending",latency:null,lastChecked:null,type:"website"}]),m=y(!1),C=y(null);let _=null;const T=()=>{k(),_=window.setInterval(v,Bt)},k=()=>{_&&(clearInterval(_),_=null)},I=()=>{document.hidden?k():(v(),T())},p=y(null),S=y(!1),j=async()=>{S.value=!0;try{const o=await(await fetch("https://api.ipify.org?format=json")).json();p.value=o.ip}catch{p.value=null}finally{S.value=!1}},K=async e=>{var l;const o=performance.now();try{const c=await Q.get(e.url,{timeout:1e4,validateStatus:()=>!0}),u=performance.now(),d=Math.round(u-o);e.latency=d,e.lastChecked=new Date;const b=c.status;b>=200&&b<300||b===401||b===403?e.status=d>2e3?"slow":"online":e.status="offline"}catch(c){const u=performance.now(),d=Math.round(u-o);e.lastChecked=new Date,c.code==="ECONNABORTED"||(l=c.message)!=null&&l.includes("timeout")?(e.status="slow",e.latency=d):(e.status="offline",e.latency=null)}},N=async e=>{const o=performance.now();try{const l=new AbortController,c=setTimeout(()=>l.abort(),1e4);await fetch(e.url,{method:"HEAD",mode:"no-cors",cache:"no-store",signal:l.signal}),clearTimeout(c);const u=performance.now(),d=Math.round(u-o);e.latency=d,e.lastChecked=new Date,e.status=d>2e3?"slow":"online"}catch(l){const c=performance.now(),u=Math.round(c-o);
1e.lastChecked=new Date,l.name==="AbortError"?(e.status="slow",e.latency=u):(e.status="offline",e.latency=null)}},R=async e=>{e.status="pending",e.type==="api"?await K(e):await N(e)},v=async()=>{m.value||(m.value=!0,await Promise.all(g.value.map(e=>R(e))),C.value=new Date,m.value=!1)},f=e=>{switch(e){case"online":return{color:"text-green-500",bg:"bg-green-500/10",textKey:"networkStatus.statusOnline",icon:"check"};case"offline":return{color:"text-red-500",bg:"bg-red-500/10",textKey:"networkStatus.statusOffline",icon:"x"};case"slow":return{color:"text-yellow-500",bg:"bg-yellow-500/10",textKey:"networkStatus.statusSlow",icon:"alert"};default:return{color:"text-gray-400",bg:"bg-gray-500/10",textKey:"networkStatus.statusPending",icon:"loading"}}},D=e=>e===null?"-":e>=1e4?">10s":e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`,V=e=>e?e.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}):"-",L=J(()=>{switch(w()){case"online":return a("networkStatus.allServicesNormal");case"offline":return a("networkStatus.someServicesOffline");case"slow":return a("networkStatus.someServicesSlow");default:return a("networkStatus.detectingStatus")}}),w=()=>{const e=g.value.map(o=>o.status);return e.every(o=>o==="pending")?"pending":e.some(o=>o==="offline")?"offline":e.some(o=>o==="slow")?"slow":e.every(o=>o==="online")?"online":"pending"};return F(()=>{v(),j(),T(),document.addEventListener("visibilitychange",I)}),M(()=>{k(),document.removeEventListener("visibilitychange",I)}),(e,o)=>(r(),i("div",X,[t("div",q,[s(x)?(r(),i("a",Y,[t("img",{src:s(x),alt:s(a)("logo.name"),class:"h-12 w-auto object-contain"},null,8,Z),t("span",tt,n(s(a)("logo.name")),1)])):E("",!0)]),t("div",et,[s(x)?(r(),i("div",st,[t("a",at,[t("img",{src:s(x),alt:s(a)("logo.name"),class:"h-16 w-auto object-contain"},null,8,nt),t("span",ot,n(s(a)("logo.name")),1)])])):E("",!0),t("div",lt,[t("div",null,[t("h1",rt,n(s(a)("networkStatus.title")),1),t("p",ct,n(s(a)("networkStatus.subtitle")),1)]),t("button",{onClick:v,disabled:m.value,class:"flex items-center gap-2 px-4 py-2 bg-blue-500 border border-blue-500 rounded-lg text-white hover:bg-blue-600 transition-colors disabled:opacity-50 disabled:cursor-not-allowed shadow-sm"},[B(s(U),{size:"18",class:h({"animate-spin":m.value})},null,8,["class"]),A(" "+n(m.value?s(a)("networkStatus.checking"):s(a)("networkStatus.refresh")),1)],8,it)]),t("div",ut,[t("div",dt,[t("div",ht,[t("div",{class:h(["w-16 h-16 rounded-full flex items-center justify-center",f(w()).bg])},[w()!=="offline"?(r(),O(s(W),{key:0,size:"32",class:h(f(w()).color)},null,8,["class"])):(r(),O(s(H),{key:1,size:"32",class:"text-red-500"}))],2),t("div",null,[t("h2",mt,n(L.value),1),t("p",ft,[A(n(s(a)("networkStatus.lastCheck"))+": "+n(V(C.value))+" ",1),t("span",gt,"ï¼"+n(s(a)("networkStatus.autoRefreshInterval"))+"ï¼",1)])])]),t("div",wt,[t("div",{class:h(["text-3xl font-bold",f(w()).color])},n(g.value.filter(l=>l.status==="online").length)+"/"+n(g.value.length),3),t("div",yt,n(s(a)("networkStatus.servicesOnline")),1)])]),t("div",xt,[t("span",_t,n(s(a)("networkStatus.currentIP")),1),S.value?(r(),i("span",pt,n(s(a)("networkStatus.fetchingIP")),1)):p.value?(r(),i("span",vt,n(p.value),1)):(r(),i("a",bt,n(s(a)("networkStatus.clickToView")),1))])]),t("div",kt,[(r(!0),i($,null,G(g.value,l=>(r(),i("div",{key:l.url,class:"bg-white border border-gray-200 rounded-xl p-4 hover:border-gray-300 hover:shadow-sm transition-all"},[t("div",St,[t("div",Ct,[t("div",{class:h(["w-3 h-3 rounded-full",l.status==="online"?"bg-green-500 shadow-md shadow-green-500/30":l.status==="offline"?"bg-red-500 shadow-md shadow-red-500/30":l.status==="slow"?"bg-yellow-500 shadow-md shadow-yellow-500/30":"bg-gray-400 animate-pulse"])},null,2),t("div",null,[t("h3",Tt,n(s(a)(l.nameKey)),1),t("p",It,n(l.url),1)])]),t("div",Et,[t("div",null,[t("div",{class:h(["text-lg font-semibold",l.latency===null?"text-gray-400":l.latency<500?"text-green-500":l.latency<2e3?"text-yellow-500":"text-red-500"])},n(D(l.latency)),3),t("div",At,n(s(a)("networkStatus.latency")),1)]),t("div",{class:h(["px-3 py-1 rounded-full text-sm font-medium",f(l.status).bg,f(l.status).color])},n(s(a)(f(l.status).textKey)),3)])])]))),128))]),t("div",Ot,[t("p",jt,n(s(a)("networkStatus.networkTip")),1),t("div",Kt,[t("div",Nt,[o[0]||(o[0]=t("div",{class:"h-2.5 w-2.5 rounded-full bg-green-500"},null,-1)),t("span",Rt,n(s(a)("networkStatus.statusOnline")),1),t("span",Dt,"("+n(s(a)("networkStatus.lessThan2s"))+")",1)]),t("div",Vt,[o[1]||(o[1]=t("div",{class:"h-2.5 w-2.5 rounded-full bg-yellow-500"}
1,null,-1)),t("span",Lt,n(s(a)("networkStatus.statusSlow")),1),t("span",Pt,"("+n(s(a)("networkStatus.moreThan2s"))+")",1)]),t("div",zt,[o[2]||(o[2]=t("div",{class:"h-2.5 w-2.5 rounded-full bg-red-500"},null,-1)),t("span",Ft,n(s(a)("networkStatus.statusOffline")),1),t("span",Mt,"("+n(s(a)("networkStatus.cannotConnect"))+")",1)])])])])]))}});export{Gt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.