import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * SplitView — Two-pane layout that adapts to terminal width.
 * Side-by-side at ≥80 cols, stacked vertically below that.
 */
import { Box } from 'ink';
import { useStdoutDimensions } from '../hooks/useStdoutDimensions.js';
const STACK_THRESHOLD = 80;
export const SplitView = ({ left, right, gap = 2 }) => {
    const [columns] = useStdoutDimensions();
    const stacked = columns < STACK_THRESHOLD;
    if (stacked) {
        return (_jsxs(Box, { flexDirection: "column", flexGrow: 1, gap: 1, children: [_jsx(Box, { flexDirection: "column", children: right }), _jsx(Box, { flexDirection: "column", children: left })] }));
    }
    return (_jsxs(Box, { flexDirection: "row", flexGrow: 1, gap: gap, children: [_jsx(Box, { width: "50%", flexDirection: "column", overflow: "hidden", children: left }), _jsx(Box, { width: "50%", flexDirection: "column", overflow: "hidden", children: right })] }));
};
