import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Plug, Check, X } from 'lucide-react';
import { formatDuration } from './utils';
import { ToolHeader, ToolHeaderSeparator, ToolHeaderMeta, ToolHeaderSuccess, ToolHeaderError, } from './shared';
export function LoadMcpToolsRenderer({ contentJson, toolDurationMs, isExpanded, onToggle, compact, }) {
    const result = (contentJson.result || {});
    const args = (contentJson.args || {});
    const timeStr = formatDuration(toolDurationMs);
    const requested = Array.isArray(args.tools) ? args.tools : [];
    const loaded = Array.isArray(result.loaded)
        ? result.loaded
        : [];
    const notFound = Array.isArray(result.notFound)
        ? result.notFound
        : [];
    const hasError = result.ok === false;
    const hasContent = loaded.length > 0 || notFound.length > 0;
    return (_jsxs("div", { className: "text-xs", children: [_jsxs(ToolHeader, { toolName: "load_mcp_tools", isExpanded: isExpanded, onToggle: onToggle, isError: hasError, colorVariant: "purple", canExpand: hasContent, children: [!compact && (_jsxs(_Fragment, { children: [_jsx(ToolHeaderSeparator, {}), _jsxs("span", { className: "text-foreground/60 font-mono text-[11px]", children: [requested.length, " tool", requested.length !== 1 ? 's' : ''] })] })), !hasError && !compact && (_jsxs(_Fragment, { children: [_jsx(ToolHeaderSeparator, {}), _jsxs(ToolHeaderSuccess, { children: [loaded.length, " loaded"] }), _jsx(ToolHeaderSeparator, {}), _jsx(ToolHeaderMeta, { children: timeStr })] })), hasError && !compact && (_jsxs(_Fragment, { children: [_jsx(ToolHeaderSeparator, {}), _jsx(ToolHeaderError, { children: "error" }), _jsx(ToolHeaderSeparator, {}), _jsx(ToolHeaderMeta, { children: timeStr })] }))] }), isExpanded && hasContent && (_jsxs("div", { className: "mt-1.5 ml-5 flex flex-col gap-1", children: [loaded.map((name) => (_jsxs("div", { className: "flex items-center gap-1.5 text-[11px]", children: [_jsx(Check, { className: "h-3 w-3 text-green-500" }), _jsx(Plug, { className: "h-3 w-3 text-purple-400" }), _jsx("span", { className: "font-mono text-foreground/70", children: name })] }, name))), notFound.map((name) => (_jsxs("div", { className: "flex items-center gap-1.5 text-[11px]", children: [_jsx(X, { className: "h-3 w-3 text-red-400" }), _jsx("span", { className: "font-mono text-foreground/40 line-through", children: name })] }, name)))] }))] }));
}
//# sourceMappingURL=LoadMcpToolsRenderer.js.map