import{a as e,n as t}from"./lit-xS7RrYW6.js";import{R as n,s as r}from"./index-Bt8RaTD0.js";var i=!1;function a(r){let a=!i;return e`
    <section class="card">
      <div class="row" style="justify-content: space-between;">
        <div>
          <div class="card-title">${`已连接的实例`}</div>
          <div class="card-sub">${`来自 Gateway 和客户端的在线信标。`}</div>
        </div>
        <div class="row" style="gap: 8px;">
          <button
            class="btn btn--icon ${a?``:`active`}"
            @click=${()=>{i=!i,r.onRefresh()}}
            title=${a?`显示主机和 IP`:`隐藏主机和 IP`}
            aria-label=${`切换主机可见性`}
            aria-pressed=${!a}
            style="width: 36px; height: 36px;"
          >
            ${a?n.eyeOff:n.eye}
          </button>
          <button class="btn" ?disabled=${r.loading} @click=${r.onRefresh}>
            ${r.loading?`加载中…`:`刷新`}
          </button>
        </div>
      </div>
      ${r.lastError?e`<div class="callout danger" style="margin-top: 12px;">${r.lastError}</div>`:t}
      ${r.statusMessage?e`<div class="callout" style="margin-top: 12px;">${r.statusMessage}</div>`:t}
      <div class="list" style="margin-top: 16px;">
        ${r.entries.length===0?e` <div class="muted">${`尚未报告任何实例。`}</div> `:r.entries.map(e=>o(e,a))}
      </div>
    </section>
  `}function o(n,i){let a=n.lastInputSeconds==null?`不适用`:`${String(n.lastInputSeconds)} 秒前`,o=n.mode??`unknown`,s=n.host??`unknown host`,c=n.ip??null,l=Array.isArray(n.roles)?n.roles.filter(Boolean):[],u=Array.isArray(n.scopes)?n.scopes.filter(Boolean):[],d=u.length>0?u.length>3?`${u.length} scopes`:`scopes: ${u.join(`, `)}`:null;return e`
    <div class="list-item">
      <div class="list-main">
        <div class="list-title">
          <span class="${i?`redacted`:``}">${s}</span>
        </div>
        <div class="list-sub">
          ${c?e`<span class="${i?`redacted`:``}">${c}</span> `:t}${o}
          ${n.version??``}
        </div>
        <div class="chip-row">
          <span class="chip">${o}</span>
          ${l.map(t=>e`<span class="chip">${t}</span>`)}
          ${d?e`<span class="chip">${d}</span>`:t}
          ${n.platform?e`<span class="chip">${n.platform}</span>`:t}
          ${n.deviceFamily?e`<span class="chip">${n.deviceFamily}</span>`:t}
          ${n.modelIdentifier?e`<span class="chip">${n.modelIdentifier}</span>`:t}
          ${n.version?e`<span class="chip">${n.version}</span>`:t}
        </div>
      </div>
      <div class="list-meta">
        <div>${r(n)}</div>
        <div class="muted">${`上次输入 ${a}`}</div>
        <div class="muted">${`原因 ${n.reason??``}`}</div>
      </div>
    </div>
  `}export{a as renderInstances};
//# sourceMappingURL=instances-DMsJU5eM.js.map