/** All portal pages in display order */
export const NAV_ITEMS = [
    { key: 'dashboard', label: 'Dashboard', filename: 'index.html', icon: '📋' },
    { key: 'proposal', label: 'Proposal', filename: 'proposal.html', icon: '📝' },
    {
        key: 'executive-summary',
        label: 'Executive Summary',
        filename: 'executive-summary.html',
        icon: '📊',
    },
    { key: 'roadmap', label: 'Roadmap', filename: 'roadmap.html', icon: '🗺️' },
    { key: 'analytics', label: 'Analytics', filename: 'analytics.html', icon: '📈' },
    { key: 'risks', label: 'Risks', filename: 'risks.html', icon: '⚠️' },
    { key: 'decisions', label: 'Decisions', filename: 'decisions.html', icon: '🏛️' },
    { key: 'architecture', label: 'Architecture', filename: 'architecture.html', icon: '🔧' },
    { key: 'changelog', label: 'Changelog', filename: 'changelog.html', icon: '📝' },
];
const NAVBAR_CSS = `
  .planu-nav {
    background: var(--planu-primary, #1a1a2e);
    color: white;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 16px;
    height: 52px;
    position: relative;
    margin-bottom: 24px;
    border-radius: 8px;
    font-size: 0.85rem;
  }
  .planu-nav-brand {
    font-weight: 700;
    font-size: 1rem;
    color: white;
    text-decoration: none;
    white-space: nowrap;
    margin-right: 16px;
    flex-shrink: 0;
  }
  .planu-nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow: hidden;
  }
  .planu-nav-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-size: 0.82rem;
  }
  .planu-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
  }
  .planu-nav-link.active {
    background: var(--planu-accent, #e94560);
    color: white;
    font-weight: 600;
  }
  .planu-nav-link.unavailable {
    color: rgba(255,255,255,0.3);
    cursor: default;
    pointer-events: none;
  }
  .planu-nav-toggle { display: none; }
  .planu-nav-hamburger {
    display: none;
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    margin-left: auto;
  }
  @media (max-width: 768px) {
    .planu-nav { flex-wrap: wrap; height: auto; padding: 8px 16px; }
    .planu-nav-hamburger { display: block; }
    .planu-nav-links {
      display: none;
      flex-direction: column;
      align-items: flex-start;
      width: 100%;
      padding: 8px 0;
      gap: 4px;
    }
    .planu-nav-toggle:checked ~ .planu-nav-links { display: flex; }
    .planu-nav-link { width: 100%; padding: 8px 12px; }
  }
  @media print { .planu-nav { display: none !important; } }`;
function getNavbarCss() {
    return NAVBAR_CSS;
}
function escapeHtml(str) {
    return str
        .replace(/&/g, '&amp;')
        .replace(/</g, '&lt;')
        .replace(/>/g, '&gt;')
        .replace(/"/g, '&quot;');
}
/**
 * Build a horizontal portal navbar.
 *
 * @param activePage - Key of the current page (e.g. 'dashboard', 'executive-summary').
 * @param basePath - Relative path prefix to reach planu/ root (e.g. '' for index.html,
 *                   '../../' for per-spec reports inside planu/specs/SPEC-XXX/).
 * @param availablePages - List of page keys that exist on disk. Pages not in this list
 *                         are rendered greyed-out and non-clickable. Defaults to all pages.
 */
export function buildNavbar(activePage, basePath, availablePages) {
    const available = availablePages ?? NAV_ITEMS.map((n) => n.key);
    // Dashboard is always available — it's the index.html that calls this function
    const alwaysAvailable = new Set(['dashboard', ...available]);
    const navId = `planu-nav-toggle-${Math.random().toString(36).slice(2, 8)}`;
    const links = NAV_ITEMS.map((item) => {
        const isActive = item.key === activePage;
        const isAvailable = alwaysAvailable.has(item.key);
        if (!isAvailable) {
            return `<span class="planu-nav-link unavailable" title="${escapeHtml(item.label)} (not generated yet)">${item.icon} ${escapeHtml(item.label)}</span>`;
        }
        const href = `${basePath}${escapeHtml(item.filename)}`;
        const activeClass = isActive ? ' active' : '';
        return `<a href="${href}" class="planu-nav-link${activeClass}">${item.icon} ${escapeHtml(item.label)}</a>`;
    }).join('\n    ');
    return `<style>${getNavbarCss()}</style>
<nav class="planu-nav" role="navigation" aria-label="Planu portal">
  <a href="${basePath}index.html" class="planu-nav-brand">📋 Planu</a>
  <input type="checkbox" class="planu-nav-toggle" id="${escapeHtml(navId)}" hidden>
  <label for="${escapeHtml(navId)}" class="planu-nav-hamburger" aria-label="Toggle navigation">☰</label>
  <div class="planu-nav-links">
    ${links}
  </div>
</nav>`;
}
//# sourceMappingURL=portal-navbar.js.map