1import{u as $,a as U,m as C,r as _,n as f,j as e,U as I,E as N,o as P}from"./index-Dknl3VNf.js";const S=95;function D(t,r){return t>=r?"bg-[var(--green)]":t>=S?"bg-[var(--amber)]":"bg-[var(--red)]"}function k(t,r){return t>=r?"text-[var(--green)]":t>=S?"text-[var(--amber)]":"text-[var(--red)]"}const A={"text-[var(--green)]":"var(--green)","text-[var(--blue)]":"var(--blue)","text-[var(--amber)]":"var(--amber)","text-[var(--red)]":"var(--red)"};function y({label:t,value:r,sub:i,colorClass:p,valueSize:c="26px",mono:n=!0}){const s=A[p]??"var(--border)";return e.jsxs("div",{className:"relative bg-[var(--bg1)] border border-[var(--border)] rounded-lg overflow-hidden",style:{padding:"14px 16px"},children:[e.jsx("span",{className:"absolute top-0 left-0 right-0 h-px",style:{background:s}}),e.jsx("div",{className:"mono text-[9px] text-[var(--text2)] uppercase",style:{letterSpacing:"0.1em",marginBottom:"6px"},children:t}),e.jsx("div",{className:`font-semibold leading-none ${p} ${n?"mono":""}`,style:{fontSize:c,marginBottom:"4px"},children:r}),i&&e.jsx("div",{className:"mono text-[10px] text-[var(--text2)]",children:i})]})}function M({service:t,sla:r,t:i}){const n=t.uptime30d??0,s=t.uptime30d!=null&&!f(t),v=Math.max(95,n),o=s?Math.round((v-95)/5*100):0,h=Math.round((r-95)/5*100),m=s&&t.uptimeWindowDays!=null,d=s?D(n,r):"bg-[var(--bg3)]",u=s?k(n,r):"text-[var(--text2)]";return e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"w-28 shrink-0 truncate text-xs text-[var(--text1)]",children:t.name}),e.jsxs("div",{className:"flex-1 relative bg-[var(--bg3)] rounded-full h-2",children:[e.jsx("div",{className:`h-2 rounded-full ${d}`,style:{width:`${o}%`}}),e.jsx("div",{className:"absolute top-[-2px] bottom-[-2px] w-px bg-[var(--text2)] opacity-60",style:{left:`${h}%`},"aria-hidden":"true"})]}),e.jsx("span",{className:`w-16 shrink-0 text-right text-xs mono font-medium ${u}`,title:s?void 0:i(P(t)?"uptime.noOfficial.tooltip":"uptime.unavailable.tooltip"),children:s?`${n.toFixed(2)}%`:i("uptime.unavailable.short")}),e.jsx("span",{className:`w-8 shrink-0 text-right text-[9px] mono ${m?"text-[var(--amber)]":"text-[var(--text2)]"}`,title:m?i("uptime.partialWindow.tooltip").replace("{d}",String(t.uptimeWindowDays)):t.uptimeSource==="official"?i("uptime.sub.official"):t.uptimeSource==="platform_avg"?i("uptime.sub.platform_avg"):void 0,children:s?m?`${t.uptimeWindowDays}d`:t.uptimeSource==="official"?"off":t.uptimeSource==="platform_avg"?"avg":"":""})]})}function O(){const{t,lang:r}=$(),{services:i,loading:p,error:c,refresh:n}=U(),{settings:s}=C(),v=s.sla,o=(i??[]).filter(a=>s.enabledServices.includes(a.id)),h=a=>a.uptime30d!=null&&!f(a),m=_.useMemo(()=>[...o].sort((a,l)=>{const b=f(a)?null:a.uptime30d,j=f(l)?null:l.uptime30d;return b==null&&j==null?0:b==null?1:j==null?-1:j-b}),[o]);if(p&&o.length===0)return e.jsx(I,{});if(!p&&o.length===0&&c)return e.jsx(N,{type:"offline",onAction:n});if(c)return e.jsx(N,{type:"error",onAction:()=>window.location.reload()});if(o.length===0)return e.jsx(N,{type:"neutral"});const d=o.filter(h),u=d.length>0,g=u?d.reduce((a,l)=>l.uptime30d>a.uptime30d?l:a):null,x=u?d.reduce((a,l)=>l.uptime30d<a.uptime30d?l:a):null,w=u?(d.reduce((a,l)=>a+l.uptime30d,0)/d.length).toFixed(2):"â";return e.jsxs("div",{className:"flex flex-col",style:{gap:"20px"},children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"mono text-[10px] text-[var(--text2)] uppercase flex items-center gap-2",style:{letterSpacing:"0.1em"},children:[e.jsx("span",{className:"text-[var(--green)] font-semibold",children:"//"}),t("nav.uptime")]}),e.jsx("span",{className:"mono text-[10px] text-[var(--text2)] flex items-center gap-2 flex-wrap justify-end",children:u?e.jsxs(e.Fragment,{children:[e.jsxs("span",{title:t("uptime.sub.official"),children:[e.jsx("span",{className:"text-[var(--text1)]",children:"off"})," ",t("uptime.legend.official")]}),e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("span",{title:t("uptime.sub.platform_avg"),children:[e.jsx("span",{className:"text-[var(--text1)]",children:"avg"})," ",t("uptime.legend.platform")]})]}):t("uptime.collecting")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3",style:{gap:"10px"}
1,children:[e.jsx(y,{label:t("uptime.stable"),value:g?g.name:t("uptime.collecting"),sub:g?`${g.uptime30d.toFixed(2)}% ${t("overview.card.uptime")}`:"",colorClass:"text-[var(--green)]",valueSize:"18px"}),e.jsx(y,{label:t("uptime.average"),value:u?`${w}%`:"â",sub:t("overview.stats.uptime.sub"),colorClass:"text-[var(--blue)]"}),e.jsx(y,{label:t("uptime.issues"),value:x?`${x.name} (${(x.incidents??[]).length})`:t("uptime.collecting"),sub:x?`${x.uptime30d.toFixed(2)}% ${t("overview.card.uptime")}`:"",colorClass:"text-[var(--red)]",valueSize:"18px"})]}),e.jsxs("section",{className:"bg-[var(--bg1)] border border-[var(--border)] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)]",style:{padding:"12px 16px"},children:[e.jsxs("div",{className:"mono text-[10px] text-[var(--text1)] uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx("span",{className:"rounded-full shrink-0",style:{width:"5px",height:"5px",background:"var(--teal)"}}),t("uptime.rankings")]}),e.jsxs("span",{className:"mono text-[9px] text-[var(--text2)]",children:["â ",v,"% ",t("uptime.sla.label")]})]}),e.jsx("div",{style:{padding:"16px"},children:e.jsx("div",{className:"flex flex-col gap-3",children:m.map(a=>e.jsx(M,{service:a,sla:v,t},a.id))})})]})]})}export{O 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.