'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState } from 'react';
import { ChevronDown, GitFork, Plus } from 'lucide-react';
import { cn } from '../../../lib/utils.js';
export function RepoGroup({ repoName, featureCount, children, defaultOpen = true, onAddFeature, }) {
    const [open, setOpen] = useState(defaultOpen);
    return (_jsxs("div", { "data-testid": "repo-group", className: "group/repo mb-1", children: [_jsxs("div", { className: "flex items-center", children: [_jsxs("button", { type: "button", onClick: () => setOpen(!open), className: cn('text-sidebar-foreground hover:bg-sidebar-accent flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-xs font-semibold', 'transition-colors duration-100'), "aria-expanded": open, children: [_jsx(ChevronDown, { className: cn('text-muted-foreground h-3.5 w-3.5 shrink-0 transition-transform duration-200', !open && '-rotate-90') }), _jsx(GitFork, { className: "text-muted-foreground h-3.5 w-3.5 shrink-0" }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: repoName }), _jsx("span", { "aria-label": `${featureCount} features`, className: "bg-sidebar-accent text-sidebar-accent-foreground ml-auto inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full px-1 text-[0.6rem] font-medium tabular-nums", role: "img", children: featureCount })] }), onAddFeature ? (_jsx("button", { type: "button", "data-testid": "repo-add-feature", onClick: (e) => {
                            e.stopPropagation();
                            onAddFeature();
                        }, className: cn('text-muted-foreground hover:text-sidebar-foreground hover:bg-sidebar-accent mr-2 shrink-0 rounded-md p-1 opacity-0 transition-all duration-100 group-hover/repo:opacity-100', 'focus-visible:ring-ring focus-visible:opacity-100 focus-visible:ring-1 focus-visible:outline-none'), "aria-label": `Add feature to ${repoName}`, children: _jsx(Plus, { className: "h-3.5 w-3.5" }) })) : null] }), open ? _jsx("div", { className: "pl-2", children: children }) : null] }));
}
