import{i as e,n as t}from"./lit-Cl9PTnWs.js";import{r as n}from"./i18n-Ber8EPgj.js";import{i as r,n as i,r as a,t as o}from"./skills-shared-LpxcIiNt.js";function s(t){return t.loading?e`<div class="page-loader">${n(`common.loading`)}</div>`:t.error?e`<div class="callout danger">${t.error}</div>`:e`
    <section class="stack">
      <div class="skills-header">
        <h3>${n(`tabs.skills`)}</h3>
        <button class="btn" @click=${t.onRefresh}>Refresh</button>
      </div>

      <div class="skills-layout">
        <div class="skills-panel">
          ${c(t)}
        </div>
        <div class="skills-panel">
          ${u(t)}
        </div>
      </div>
    </section>
  `}function c(t){let n=t.installed?.skills??[];if(n.length===0)return e`
      <div class="card">
        <h4>Installed Skills</h4>
        <p class="text-muted">No skills installed yet.</p>
      </div>
    `;let i=r(n);return e`
    <div class="card">
      <h4>Installed Skills <span class="text-muted">(${n.length})</span></h4>
      <div class="stack" style="margin-top: 8px;">
        ${i.map(n=>e`
            <div class="skills-group">
              <div class="skills-group-label">${n.label} <span class="text-muted">(${n.skills.length})</span></div>
              <div class="skills-card-grid">
                ${n.skills.map(e=>l(e,t))}
              </div>
            </div>
          `)}
      </div>
    </div>
  `}function l(n,r){let s=o(n),c=i(n),l=r.actionSlug===n.name&&r.updating;return e`
    <div class="skills-entry">
      <div class="skills-entry-header">
        <span class="skills-entry-name">
          ${n.emoji?e`${n.emoji} `:t}${n.name}
        </span>
        <span class="pill ${n.eligible?`pill-ok`:`pill-warn`}">
          ${n.eligible?`enabled`:`disabled`}
        </span>
      </div>
      ${n.description?e`<div class="skills-entry-desc">${n.description}</div>`:t}
      ${a({skill:n,showBundledBadge:n.bundled})}
      ${s.length>0?e`
            <div class="callout warn" style="margin-top: 6px;">
              Missing: ${s.join(`, `)}
            </div>
          `:t}
      ${c.length>0?e`
            <div class="text-muted" style="margin-top: 4px; font-size: 12px;">
              ${c.join(`, `)}
            </div>
          `:t}
      <div class="skills-entry-actions">
        ${n.source===`kaijibot-managed`?e`
              <button
                class="btn"
                ?disabled=${l}
                @click=${()=>r.onUpdate(n.name)}
              >
                ${l?`Updating…`:`Update`}
              </button>
            `:t}
      </div>
    </div>
  `}function u(n){return e`
    <div class="card">
      <h4>ClawHub Search</h4>
      <div class="skills-search-bar">
        <input
          type="text"
          placeholder="Search skills on ClawHub…"
          .value=${n.searchQuery}
          @input=${e=>{let t=e.target.value;n.onSearch(t)}}
        />
      </div>
      ${n.searchQuery&&n.searchResults.length===0?e`<p class="text-muted" style="margin-top: 8px;">No results found.</p>`:t}
      ${n.searchResults.length>0?e`
            <div class="stack" style="margin-top: 12px;">
              ${n.searchResults.map(e=>d(e,n))}
            </div>
          `:t}
    </div>
  `}function d(n,r){let i=r.actionSlug===n.slug&&r.installing;return e`
    <div class="skills-entry">
      <div class="skills-entry-header">
        <span class="skills-entry-name">${n.displayName}</span>
        ${n.version?e`<span class="pill">${n.version}</span>`:t}
      </div>
      ${n.summary?e`<div class="skills-entry-desc">${n.summary}</div>`:t}
      <div class="skills-entry-meta">
        ${n.score?e`<span class="text-muted">Score: ${n.score.toFixed(2)}</span>`:t}
      </div>
      <div class="skills-entry-actions">
        <button
          class="btn primary"
          ?disabled=${i}
          @click=${()=>r.onInstall(n.slug)}
        >
          ${i?`Installing…`:`Install`}
        </button>
        <button
          class="btn"
          @click=${()=>r.onDetail(n.slug)}
        >
          Details
        </button>
      </div>
    </div>
  `}export{s as renderSkillsManager};
//# sourceMappingURL=skills-manager-DN6714Tu.js.map