function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from "react";
import classnames from "classnames";
// import pure from "../../utils/pureNoFunc";
import "./style.css";
import { getSelectionMessage } from "../../utils/editorUtils";
// import draggableClassnames from "../../constants/draggableClassnames";

function Caret(props) {
  var charWidth = props.charWidth,
    row = props.row,
    sequenceLength = props.sequenceLength,
    caretPosition = props.caretPosition,
    isProtein = props.isProtein,
    onClick = props.onClick,
    isDraggable = props.isDraggable,
    _props$leftMargin = props.leftMargin,
    leftMargin = _props$leftMargin === void 0 ? 0 : _props$leftMargin,
    onRightClick = props.onRightClick,
    style = props.style,
    selectionMessage = props.selectionMessage,
    _props$className = props.className,
    className = _props$className === void 0 ? "" : _props$className;
  if (row.start <= caretPosition && row.end + 1 >= caretPosition || row.end === sequenceLength - 1 && row.end < caretPosition) {
    //the second logical operator catches the special case where we're at the very end of the sequence..
    var cursorEl = /*#__PURE__*/React.createElement("div", {
      onClick: onClick,
      onContextMenu: onRightClick ? function (e) {
        onRightClick(e);
      } : undefined,
      title: selectionMessage || getSelectionMessage({
        caretPosition: caretPosition,
        isProtein: isProtein,
        sequenceLength: sequenceLength
      }),
      className: classnames({
        notClickable: !isDraggable
      }, "veCaret", "veRowViewCaret", className),
      style: _extends({
        left: leftMargin + (caretPosition - row.start) * charWidth - 2
      }, style)
    });
    return cursorEl;
  } else {
    return null;
  }
}
export default Caret;
// export default pure(Caret);