import{j as e,L as w}from"./vendor-react-CGAml-me.js";import{u as y}from"./useChannels-FFdljGck.js";import{u as S}from"./useSkills-CWMBRUcZ.js";import{u as $}from"./useCron-9V5IT7X8.js";import{u as B}from"./useSessions-CsyIjfGr.js";import{C as m,d as x,a as L,b as R}from"./card-C65ifeRR.js";import{S as g}from"./skeleton-Bewm4IiF.js";import{B as d}from"./badge-DpPviVrw.js";import{f as u}from"./index-BoGb7ncW.js";import{u as A}from"./vendor-i18n-DzUOdQ2j.js";import{R as D,W as E,e as J,M,l as T,o as W,r as q}from"./vendor-icons-JKgav82F.js";import"./vendor-query-BbgYCJYB.js";import"./vendor-radix-Hvp89ZoW.js";function Y(){const{t:a}=A(),{data:r,isLoading:c}=y(),{data:t,isLoading:b}=S(),{data:o,isLoading:h}=$(),{data:i,isLoading:p}=B(),f=(r==null?void 0:r.filter(s=>s.running).length)??0,j=(r==null?void 0:r.length)??0,v=(t==null?void 0:t.filter(s=>s.available&&s.enabled).length)??0,N=(o==null?void 0:o.filter(s=>s.enabled).length)??0,C=(i==null?void 0:i.length)??0,k=[{label:a("dashboard.channels"),value:c?null:`${f} / ${j}`,icon:D,sub:a("dashboard.running"),iconColor:"text-blue-500",iconBg:"bg-blue-50 dark:bg-blue-950/50"},{label:a("dashboard.skills"),value:b?null:`${v}`,icon:E,sub:a("dashboard.active"),iconColor:"text-sky-500",iconBg:"bg-sky-50 dark:bg-sky-950/50"},{label:a("dashboard.cronJobs"),value:h?null:`${N}`,icon:J,sub:a("dashboard.active"),iconColor:"text-amber-500",iconBg:"bg-amber-50 dark:bg-amber-950/50"},{label:a("dashboard.sessions"),value:p?null:`${C}`,icon:M,sub:a("dashboard.active"),iconColor:"text-emerald-500",iconBg:"bg-emerald-50 dark:bg-emerald-950/50"}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:k.map(s=>{const n=s.icon;return e.jsx(m,{className:"overflow-hidden",children:e.jsx(x,{className:"p-3 sm:p-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground leading-snug truncate",children:s.label}),s.value===null?e.jsx(g,{className:"mt-1.5 h-7 w-12"}):e.jsx("div",{className:"mt-1 text-xl font-bold tracking-tight sm:text-2xl",children:s.value}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:s.sub})]}),e.jsx("div",{className:u("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg",s.iconBg),children:e.jsx(n,{className:u("h-4 w-4",s.iconColor)})})]})})},s.label)})}),e.jsxs(m,{children:[e.jsxs(L,{className:"flex flex-row items-center justify-between px-3 py-2.5 sm:px-6 sm:pb-3",children:[e.jsx(R,{className:"text-sm sm:text-base",children:a("dashboard.channels")}),e.jsx(w,{to:"/channels",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:a("dashboard.manageChannels")})]}),e.jsx(x,{className:"px-3 pb-3 sm:px-6",children:c?e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[...Array(4)].map((s,n)=>e.jsx(g,{className:"h-16 w-full"},n))}):!r||r.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("common.noData")}):e.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:r.map(s=>{const n=s.running,l=!!s.error;return e.jsxs("div",{className:`rounded-lg border p-3 flex flex-col gap-2 transition-colors ${l?"border-destructive/40 bg-destructive/5":n?"border-green-500/30 bg-green-500/5":"border-border bg-muted/30"}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("span",{className:"font-mono text-sm font-semibold leading-tight break-all",children:a(`channels.names.${s.name}`,{defaultValue:s.name})}),l?e.jsx(T,{className:"h-4 w-4 text-destructive shrink-0 mt-0.5"}):n?e.jsx(W,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"}):e.jsx(q,{className:"h-4 w-4 text-muted-foreground shrink-0 mt-0.5"})]}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx(d,{variant:s.enabled?"default":"secondary",className:"text-xs px-1.5 py-0",children:s.enabled?a("channels.enabled"):a("channels.disabled")}),l?e.jsx(d,{variant:"destructive",className:"text-xs px-1.5 py-0",children:a("dashboard.error")}):e.jsx(d,{variant:n?"default":"secondary",className:`text-xs px-1.5 py-0 ${n?"bg-green-500 hover:bg-green-600 text-white":""}`,children:a(n?"dashboard.running":"dashboard.stopped")})]}),l&&e.jsx("p",{className:"text-xs text-destructive leading-tight line-clamp-2",children:s.error})]},s.name)})})})]})]})}export{Y as default};
