import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import Typography from '../../Typography';
const MachineInstances = ({ getChildNodeComponent, parentNodeIndex, parentNodeData, verticalLineHeight, datasetHeight, curveHeights, itemRefs, datasetRef, isReadOnlyMode, hideNodeAtLast, }) => {
    return (_jsx(_Fragment, { children: parentNodeData?.machineInstances?.length === 0 ? (_jsx(_Fragment, { children: !isReadOnlyMode && (_jsxs(_Fragment, { children: [_jsx("div", { className: "ff-selectedMachines-connecting-line", children: _jsxs("div", { className: "ff-line", children: [_jsx("div", { className: "ff-left-icon ff-left-icon-aligned" }), _jsx("div", { className: "ff-right-icon" })] }) }), _jsx("div", { className: "ff-machine-instance ff-machine-env-button", children: getChildNodeComponent({
                            isButton: true,
                            parentNodeData,
                            parentNodeIndex,
                        }) })] })) })) : (parentNodeData?.machineInstances?.map((childNodeData, childNodeIndex) => {
            const isFirstLine = childNodeIndex === 0;
            return (_jsxs("div", { className: "ff-machine-instance-row", children: [_jsxs("div", { className: `ff-selectedMachines-connecting-line ${!isFirstLine ? 'ff-second-line' : ''}`, children: [_jsxs("div", { className: "ff-line", children: [_jsx("div", { className: `ff-left-icon ${isFirstLine ? 'ff-left-icon-aligned' : ''}` }), _jsx("div", { className: "ff-right-icon" })] }), isFirstLine && (_jsx("div", { className: "ff-vertical-line", style: { height: `${verticalLineHeight}px` } }))] }), _jsx("div", { className: "ff-machine-instance", children: childNodeData?.runLevelExecutionDataSets?.map((runLevelExecutionDataSet, runLevelExecutionDataSetIndex) => (_jsx("div", { className: "ff-run-level-execution-dataset", ref: runLevelExecutionDataSetIndex === 0
                                ? datasetRef
                                : null, children: _jsxs("div", { className: "ff-execution-item", ref: (element) => (itemRefs.current[runLevelExecutionDataSetIndex] =
                                    element), children: [_jsx("div", { className: "ff-curved-connector", style: { top: `${-datasetHeight}px` }, children: _jsxs("div", { className: `ff-curve ff-connector-${runLevelExecutionDataSetIndex}`, style: {
                                                height: `${curveHeights[runLevelExecutionDataSetIndex]}px`,
                                            }, children: [_jsx("div", { className: `ff-curve-right-icon ff-curve-right-icon-${runLevelExecutionDataSetIndex}` }), Number(childNodeData?.runScriptCount) ? (_jsx("div", { className: "ff-selectedMachines-connecting-line-text", children: _jsx(Typography, { fontSize: 8, fontWeight: "regular", children: `${![0, '0', null].includes(childNodeData.runScriptCount)
                                                            ? childNodeData.runScriptCount
                                                            : ''} Script${childNodeData.runScriptCount !== 1
                                                            ? 's'
                                                            : ''}` }) })) : (_jsx(_Fragment, {}))] }) }), _jsx("div", { className: "ff-run-data-box", children: getChildNodeComponent({
                                            isButton: false,
                                            childNodeData,
                                            childNodeIndex,
                                            runLevelExecutionDataSet,
                                            runLevelExecutionDataSetIndex,
                                            parentNodeData,
                                            parentNodeIndex,
                                        }) })] }) }, runLevelExecutionDataSet?.runLevelExecutionDataSetId))) }), childNodeIndex ===
                        parentNodeData?.machineInstances.length - 1 &&
                        !hideNodeAtLast && (_jsx(_Fragment, { children: !isReadOnlyMode && (_jsxs(_Fragment, { children: [_jsx("div", { className: "ff-selectedMachines-connecting-line ff-second-line", children: _jsxs("div", { className: "ff-line", children: [_jsx("div", { className: "ff-left-icon" }), _jsx("div", { className: "ff-right-icon" })] }) }), _jsx("div", { className: "ff-machine-instance ff-machine-env-button", children: getChildNodeComponent({
                                        isButton: true,
                                        parentNodeData,
                                        parentNodeIndex,
                                        childNodeIndex: childNodeIndex + 1,
                                    }) })] })) }))] }, childNodeIndex));
        })) }));
};
export default MachineInstances;
//# sourceMappingURL=MachineInstances.js.map