"use strict";
var __webpack_require__ = {};
(()=>{
    __webpack_require__.d = (exports1, definition)=>{
        for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
            enumerable: true,
            get: definition[key]
        });
    };
})();
(()=>{
    __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
    __webpack_require__.r = (exports1)=>{
        if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
            value: 'Module'
        });
        Object.defineProperty(exports1, '__esModule', {
            value: true
        });
    };
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
    StageNodeEventDrivenTaskGroups: ()=>StageNodeEventDrivenTaskGroups
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const external_EventDrivenTask_cjs_namespaceObject = require("./EventDrivenTask.cjs");
const external_StageNode_styles_cjs_namespaceObject = require("./StageNode.styles.cjs");
const StageNodeEventDrivenTaskGroupsInner = ({ props, eventDrivenTasks, isReadOnly, selectedTaskId, marginTop, handleTaskClick, generateReplaceTaskMenuItemForTask, generateDeleteTaskMenuItemForTask })=>{
    const { execution, onTaskGroupModification, onReplaceTaskFromToolbox, loadingTaskIds } = props;
    const getEventDrivenContextMenuItems = (0, external_react_namespaceObject.useCallback)((taskId)=>{
        const items = [];
        const replaceTaskMenuItem = generateReplaceTaskMenuItemForTask(taskId, false);
        if (replaceTaskMenuItem) items.push(replaceTaskMenuItem);
        const deleteTaskMenuItem = generateDeleteTaskMenuItemForTask(taskId);
        if (deleteTaskMenuItem) items.push(deleteTaskMenuItem);
        return items;
    }, [
        generateReplaceTaskMenuItemForTask,
        generateDeleteTaskMenuItemForTask
    ]);
    if (0 === eventDrivenTasks.length) return null;
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_StageNode_styles_cjs_namespaceObject.StageAdditionalTasksSection, {
        style: {
            marginTop
        },
        children: [
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_styles_cjs_namespaceObject.StageAdditionalTasksHeaderSection, {
                children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
                    className: "text-xs font-bold text-foreground-muted",
                    children: "Event-driven tasks"
                })
            }),
            /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_StageNode_styles_cjs_namespaceObject.StageTaskList, {
                children: eventDrivenTasks.map(({ task })=>{
                    const taskExecution = execution?.taskStatus?.[task.id];
                    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_EventDrivenTask_cjs_namespaceObject.EventDrivenTaskItem, {
                        task: task,
                        taskExecution: taskExecution,
                        isSelected: selectedTaskId === task.id,
                        onTaskClick: handleTaskClick,
                        isTaskLoading: loadingTaskIds?.has(task.id),
                        ...(onTaskGroupModification || onReplaceTaskFromToolbox) && !isReadOnly && {
                            getContextMenuItems: ()=>getEventDrivenContextMenuItems(task.id)
                        }
                    }, task.id);
                })
            })
        ]
    });
};
const StageNodeEventDrivenTaskGroups = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(StageNodeEventDrivenTaskGroupsInner);
exports.StageNodeEventDrivenTaskGroups = __webpack_exports__.StageNodeEventDrivenTaskGroups;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "StageNodeEventDrivenTaskGroups"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
