import { jsx } from "react/jsx-runtime";
import { EDGE_CONSTANTS } from "../constants.js";
const { ARROW_SIZE, ARROW_HALF_ANGLE } = EDGE_CONSTANTS;
const ARROW_TRANSITION = 'fill 0.2s ease, opacity 0.2s ease';
function EdgeArrow({ target, angle, offset, color, opacity = 1 }) {
    const tipX = target.x;
    const tipY = target.y;
    const leftX = tipX - ARROW_SIZE * Math.cos(angle - ARROW_HALF_ANGLE);
    const leftY = tipY - ARROW_SIZE * Math.sin(angle - ARROW_HALF_ANGLE);
    const rightX = tipX - ARROW_SIZE * Math.cos(angle + ARROW_HALF_ANGLE);
    const rightY = tipY - ARROW_SIZE * Math.sin(angle + ARROW_HALF_ANGLE);
    return /*#__PURE__*/ jsx("polygon", {
        points: `${tipX},${tipY} ${leftX},${leftY} ${rightX},${rightY}`,
        fill: color,
        style: {
            pointerEvents: 'none',
            opacity,
            transition: ARROW_TRANSITION,
            transform: `translate(${offset.x}px, ${offset.y}px)`
        }
    });
}
export { EdgeArrow };
