"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__, {
    StaticEdge: ()=>StaticEdge
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const react_cjs_namespaceObject = require("../../../xyflow/react.cjs");
const external_react_namespaceObject = require("react");
const BaseCanvas_constants_cjs_namespaceObject = require("../../BaseCanvas/BaseCanvas.constants.cjs");
const agent_flow_store_cjs_namespaceObject = require("../store/agent-flow-store.cjs");
const StaticEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, source, target, hasError = false, hasSuccess = false, hasRunning = false, isCurrentBreakpoint = false, isSuggestion = false, suggestionType })=>{
    const { nodes } = (0, agent_flow_store_cjs_namespaceObject.useAgentFlowStore)();
    const sourceNode = (0, external_react_namespaceObject.useMemo)(()=>nodes.find((node)=>node.id === source), [
        nodes,
        source
    ]);
    const targetNode = (0, external_react_namespaceObject.useMemo)(()=>nodes.find((node)=>node.id === target), [
        nodes,
        target
    ]);
    const isConnectedToSelectedResource = (0, external_react_namespaceObject.useMemo)(()=>sourceNode?.type === 'resource' && sourceNode?.selected || targetNode?.type === 'resource' && targetNode?.selected, [
        sourceNode,
        targetNode
    ]);
    const strokeColor = (0, external_react_namespaceObject.useMemo)(()=>{
        if (isSuggestion) {
            if ('add' === suggestionType) return 'var(--canvas-success-icon)';
            if ('update' === suggestionType) return 'var(--canvas-warning-icon)';
            if ('delete' === suggestionType) return 'var(--canvas-error-icon)';
        }
        if (hasError) return 'var(--canvas-error-icon)';
        if (isCurrentBreakpoint) return 'var(--canvas-warning-icon)';
        if (hasSuccess) return 'var(--canvas-success-icon)';
        if (hasRunning) return 'var(--canvas-primary)';
        return isConnectedToSelectedResource ? 'var(--canvas-primary)' : 'var(--canvas-border)';
    }, [
        hasError,
        isCurrentBreakpoint,
        hasSuccess,
        hasRunning,
        isConnectedToSelectedResource,
        isSuggestion,
        suggestionType
    ]);
    const strokeWidth = (0, external_react_namespaceObject.useMemo)(()=>isConnectedToSelectedResource ? BaseCanvas_constants_cjs_namespaceObject.EDGE_STYLES.selectedStrokeWidth : 2, [
        isConnectedToSelectedResource
    ]);
    const [edgePath] = (0, react_cjs_namespaceObject.getSmoothStepPath)({
        sourceX,
        sourceY,
        sourcePosition,
        targetX,
        targetY,
        targetPosition,
        borderRadius: 20
    });
    return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.BaseEdge, {
        id: id,
        path: edgePath,
        type: "smoothstep",
        style: {
            stroke: strokeColor,
            strokeWidth,
            strokeDasharray: '5 5'
        }
    });
};
exports.StaticEdge = __webpack_exports__.StaticEdge;
for(var __rspack_i in __webpack_exports__)if (-1 === [
    "StaticEdge"
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
Object.defineProperty(exports, '__esModule', {
    value: true
});
