"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
var _rangeUtils = require("@teselagen/range-utils");
var _PositionAnnotationOnCircle = _interopRequireDefault(require("./PositionAnnotationOnCircle"));
var _react = _interopRequireDefault(require("react"));
var _draggableClassnames = _interopRequireDefault(require("../constants/draggableClassnames"));
var _pureNoFunc = _interopRequireDefault(require("../utils/pureNoFunc"));
var _editorUtils = require("../utils/editorUtils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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 = (0, _rangeUtils.getRangeAngles)({
      start: caretPosition,
      end: caretPosition
    }, sequenceLength || 1),
    startAngle = _getRangeAngles.startAngle,
    endAngle = _getRangeAngles.endAngle;
  if (!(0, _isNumber["default"])(startAngle)) {
    console.error("we've got a problem!");
  }
  var _PositionAnnotationOn = (0, _PositionAnnotationOnCircle["default"])({
      sAngle: startAngle,
      eAngle: endAngle,
      height: 0
    }),
    transform = _PositionAnnotationOn.transform;
  return /*#__PURE__*/_react["default"].createElement("g", {
    onClick: onClick,
    transform: transform,
    className: className + " veCaret " + _draggableClassnames["default"].caret
  }, /*#__PURE__*/_react["default"].createElement("title", null, selectionMessage || (0, _editorUtils.getSelectionMessage)({
    caretPosition: caretPosition,
    isProtein: isProtein,
    sequenceLength: sequenceLength
  })), /*#__PURE__*/_react["default"].createElement("line", {
    strokeWidth: "1.5px",
    x1: 0,
    y1: -innerRadius,
    x2: 0,
    y2: -outerRadius
    // stroke="black"
  }), isSelection ? /*#__PURE__*/_react["default"].createElement("polygon", {
    className: "vePolygonCaretHandle",
    fill: "black",
    points: "0," + (-outerRadius + 2) + " 5," + (-outerRadius - 10) + " -5," + (-outerRadius - 10)
  }) : null);
}
var _default = (0, _pureNoFunc["default"])(Caret);
exports["default"] = _default;
module.exports = exports.default;