import isNumber from "lodash/isNumber";
import { getRangeAngles } from "@teselagen/range-utils";
import PositionAnnotationOnCircle from "./PositionAnnotationOnCircle";
import React from "react";
import draggableClassnames from "../constants/draggableClassnames";
import pureNoFunc from "../utils/pureNoFunc";
import { getSelectionMessage } from "../utils/editorUtils";
function Caret(_ref) {
  var caretPosition = _ref.caretPosition,
    sequenceLength = _ref.sequenceLength,
    className = _ref.className,
    onClick = _ref.onClick,
    isSelection = _ref.isSelection,
    innerRadius = _ref.innerRadius,
    outerRadius = _ref.outerRadius,
    isProtein = _ref.isProtein,
    selectionMessage = _ref.selectionMessage;
  var _getRangeAngles = getRangeAngles({
      start: caretPosition,
      end: caretPosition
    }, sequenceLength || 1),
    startAngle = _getRangeAngles.startAngle,
    endAngle = _getRangeAngles.endAngle;
  if (!isNumber(startAngle)) {
    console.error("we've got a problem!");
  }
  var _PositionAnnotationOn = PositionAnnotationOnCircle({
      sAngle: startAngle,
      eAngle: endAngle,
      height: 0
    }),
    transform = _PositionAnnotationOn.transform;
  return /*#__PURE__*/React.createElement("g", {
    onClick: onClick,
    transform: transform,
    className: className + " veCaret " + draggableClassnames.caret
  }, /*#__PURE__*/React.createElement("title", null, selectionMessage || getSelectionMessage({
    caretPosition: caretPosition,
    isProtein: isProtein,
    sequenceLength: sequenceLength
  })), /*#__PURE__*/React.createElement("line", {
    strokeWidth: "1.5px",
    x1: 0,
    y1: -innerRadius,
    x2: 0,
    y2: -outerRadius
    // stroke="black"
  }), isSelection ? /*#__PURE__*/React.createElement("polygon", {
    className: "vePolygonCaretHandle",
    fill: "black",
    points: "0," + (-outerRadius + 2) + " 5," + (-outerRadius - 10) + " -5," + (-outerRadius - 10)
  }) : null);
}
export default pureNoFunc(Caret);