"use client";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { memo, useCallback } from "react";
const BRANCHING_KINDS = new Set(["switch_case", "human_input"]);
/**
 * Advanced tab — flow control and raw task metadata.
 *
 * Shows the `flow.then` directive (hidden for branching kinds whose routing
 * is managed by the Configure tab's specialized editors).
 *
 * @since T10 (Inspector Panel Refactor)
 */
export const AdvancedTab = memo(function AdvancedTab({ node, otherTaskNames, kindString, onUpdateFlow, }) {
    const isBranching = BRANCHING_KINDS.has(kindString);
    const currentFlow = node.flow?.then ?? "";
    const handleFlowChange = useCallback((e) => {
        onUpdateFlow(node.id, e.target.value || undefined);
    }, [node.id, onUpdateFlow]);
    return (_jsxs("div", { className: "flex flex-col gap-4 px-3 py-3", children: [!isBranching && (_jsxs("section", { className: "flex flex-col gap-1.5", children: [_jsx("h4", { className: "text-[11px] font-semibold uppercase tracking-wide text-[var(--stgm-muted-foreground,#737373)]", children: "Flow control" }), _jsx("p", { className: "text-[10px] leading-tight text-[var(--stgm-muted-foreground,#737373)]", children: "Override the default sequential execution order." }), _jsxs("select", { value: currentFlow, onChange: handleFlowChange, className: "w-full rounded-md border border-[var(--stgm-border,#d4d4d8)] bg-[var(--stgm-background,#fff)] px-2 py-1.5 text-xs text-[var(--stgm-foreground,#1a1a2e)] focus:outline-none focus:ring-1 focus:ring-[var(--stgm-ring,#3b82f6)]", children: [_jsx("option", { value: "", children: "Next (implicit sequential)" }), _jsx("option", { value: "end", children: "End workflow" }), otherTaskNames.map((name) => (_jsx("option", { value: name, children: name }, name)))] })] })), isBranching && (_jsx("p", { className: "text-xs text-[var(--stgm-muted-foreground,#737373)]", children: "Flow routing for this task is managed through its branch configuration in the Configure tab." })), _jsxs("section", { className: "flex flex-col gap-1.5", children: [_jsx("h4", { className: "text-[11px] font-semibold uppercase tracking-wide text-[var(--stgm-muted-foreground,#737373)]", children: "Task metadata" }), _jsxs("div", { className: "flex flex-col gap-1 text-[11px]", children: [_jsx(MetadataRow, { label: "ID", value: node.id }), _jsx(MetadataRow, { label: "Kind", value: kindString }), _jsx(MetadataRow, { label: "Category", value: node.category }), node.export?.as && _jsx(MetadataRow, { label: "Exports as", value: node.export.as }), node.flow?.then && _jsx(MetadataRow, { label: "Then", value: node.flow.then })] })] })] }));
});
function MetadataRow({ label, value }) {
    return (_jsxs("div", { className: "flex items-baseline gap-2", children: [_jsxs("span", { className: "shrink-0 text-[var(--stgm-muted-foreground,#737373)]", children: [label, ":"] }), _jsx("span", { className: "min-w-0 break-all font-mono text-[var(--stgm-foreground,#1a1a2e)]", children: value })] }));
}
//# sourceMappingURL=AdvancedTab.js.map