import{q as b,V as z,f as L,h as M,i as N,W as y,O,o as q,P as E,X as V,m as d,l as n,S as w,Y as x,j as S,n as g,Z as j,t as s}from"./index-Cl9Gy4vs.js";var H=s("<span class=text-text-invert-weak>v"),I=s('<span class="flex items-center gap-2"><span>'),P=s('<div><div class="flex flex-col items-start min-w-0 w-full"><div class="flex flex-row items-center gap-2 min-w-0 w-full"><span>'),U=s("<span>v"),X=s('<div class="flex flex-row gap-3"><span>'),Y=s("<span class=text-text-weak>"),Z=s("<span class=text-text-weaker>"),p=s("<span class=text-text-weak>••••••••"),A=s("<div>");function D(e){const h=L(),[$,R]=M(!1);let l,i;const C=N(()=>y(e.conn)),_=()=>{const a=l?l.scrollWidth>l.clientWidth:!1,c=i?i.scrollWidth>i.clientWidth:!1;R(a||c)};O(()=>{C(),e.conn.http.url,e.status?.version,queueMicrotask(_)}),q(()=>{if(_(),typeof ResizeObserver!="function")return;const a=new ResizeObserver(_);l&&a.observe(l),i&&a.observe(i),E(()=>a.disconnect())});const W=()=>(()=>{var a=I(),c=a.firstChild;return n(c,()=>y(e.conn,!0)),n(a,d(w,{get when(){return e.status?.version},get children(){var u=H();return u.firstChild,n(u,()=>e.status?.version,null),u}}),null),a})(),T=V(()=>e.badge);return d(j,{class:"flex-1 min-w-0",get value(){return W()},contentStyle:{"max-width":"none","white-space":"nowrap"},placement:"top-start",get inactive(){return g(()=>!$())()&&!e.conn.displayName},get children(){var a=P(),c=a.firstChild,u=c.firstChild,f=u.firstChild,k=l;return typeof k=="function"?S(k,f):l=f,n(f,C),n(u,d(w,{get when(){return T()},get fallback(){return d(w,{get when(){return e.status?.version},get children(){var t=U();t.firstChild;var r=i;return typeof r=="function"?S(r,t):i=t,n(t,()=>e.status?.version,null),b(()=>x(t,`${e.versionClass??"text-text-weak text-14-regular truncate"} min-w-0`)),t}})},children:t=>t()}),null),n(c,d(w,{get when(){return g(()=>!!(e.showCredentials&&e.conn.type==="http"))()&&e.conn},children:t=>(()=>{var r=X(),m=r.firstChild;return n(m,(()=>{var o=g(()=>!!t().http.username);return()=>o()?(()=>{var v=Y();return n(v,()=>t().http.username),v})():(()=>{var v=Z();return n(v,()=>h.t("server.row.noUsername")),v})()})()),n(r,(()=>{var o=g(()=>!!t().http.password);return()=>o()&&p()})(),null),r})()}),null),n(a,()=>e.children,null),b(t=>{var r=e.class,m=!!e.dimmed,o=`${e.nameClass??"truncate"} min-w-0`;return r!==t.e&&x(a,t.e=r),m!==t.t&&a.classList.toggle("opacity-50",t.t=m),o!==t.a&&x(f,t.a=o),t},{e:void 0,t:void 0,a:void 0}),a}})}function F(e){return(()=>{var h=A();return b($=>z(h,{"size-1.5 rounded-full shrink-0":!0,"bg-icon-success-base":e.health?.healthy===!0,"bg-icon-critical-base":e.health?.healthy===!1,"bg-border-weak-base":e.health===void 0},$)),h})()}export{F as S,D as a};
