"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _pureNoFunc = _interopRequireDefault(require("../../utils/pureNoFunc"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// import PropTypes from "prop-types";

function AASliver(props) {
  var forward = props.forward,
    aminoAcidIndex = props.aminoAcidIndex,
    _props$showAAColors = props.showAAColors,
    showAAColors = _props$showAAColors === void 0 ? true : _props$showAAColors,
    onClick = props.onClick,
    onContextMenu = props.onContextMenu,
    width = props.width,
    height = props.height,
    isFiller = props.isFiller,
    isTruncatedStart = props.isTruncatedStart,
    isTruncatedEnd = props.isTruncatedEnd,
    relativeAAPositionInTranslation = props.relativeAAPositionInTranslation,
    title = props.title,
    color = props.color,
    showAminoAcidNumbers = props.showAminoAcidNumbers,
    letter = props.letter;
  if (letter === "-") {
    return null;
  }
  var dirX1 = 1 / Math.sqrt(26);
  var dirY1 = 5 * dirX1;
  var dirX2 = 16 / Math.sqrt(2756);
  var dirY2 = 50 / Math.sqrt(2756);
  var roundedCorner = 15;
  var path = "";
  path = isFiller ? "25,0 49,0 60,50 49,100 25,100 38,50 25,0" : isTruncatedStart ? // ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0"
  "M " + roundedCorner / 3 + ", 0\n                  L " + (50 - roundedCorner / 3) + ", 0\n                  Q 50 0 " + (50 + roundedCorner * dirX1) + " " + roundedCorner * dirY1 + "\n                  L " + (60 - roundedCorner * dirX1) + ", " + (50 - roundedCorner * dirY1) + "\n                  Q 60 50 " + (60 - roundedCorner * dirX1) + " " + (50 + roundedCorner * dirY1) + "\n                  L " + (50 + roundedCorner * dirX1) + ", " + (100 - roundedCorner * dirY1) + "\n                  Q 50 100 " + (50 - roundedCorner) + " 100\n                  L " + roundedCorner / 3 + ", 100\n                  Q 0 100 " + roundedCorner * dirX2 + " " + (100 - roundedCorner * dirY2) + "\n                  L " + (16 - roundedCorner * dirX2) + ", " + (50 + roundedCorner * dirY2) + "\n                  Q 16 50 " + (16 - roundedCorner * dirX2) + " " + (50 - roundedCorner * dirY2) + "\n                  L " + roundedCorner * dirX2 + ", " + roundedCorner * dirY2 + "\n                  Q 0 0 " + roundedCorner / 3 + " 0\n                  z" : isTruncatedEnd ? // ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0"
  "M " + (24 + roundedCorner / 3) + ", 0\n                  L " + (74 - roundedCorner / 3) + ", 0\n                  Q 74 0 " + (74 + roundedCorner * dirX1) + " " + roundedCorner * dirY1 + "\n                  L " + (84 - roundedCorner * dirX1) + ", " + (50 - roundedCorner * dirY1) + "\n                  Q 84 50 " + (84 - roundedCorner * dirX1) + " " + (50 + roundedCorner * dirY1) + "\n                  L " + (74 + roundedCorner * dirX1) + ", " + (100 - roundedCorner * dirY1) + "\n                  Q 74 100 " + (74 - roundedCorner) + " 100\n                  L " + (24 + roundedCorner / 3) + ", 100\n                  Q 24 100 " + (24 + roundedCorner * dirX2) + " " + (100 - roundedCorner * dirY2) + "\n                  L " + (40 - roundedCorner * dirX2) + ", " + (50 + roundedCorner * dirY2) + "\n                  Q 40 50 " + (40 - roundedCorner * dirX2) + ", " + (50 - roundedCorner * dirY2) + "\n                  L " + (24 + roundedCorner * dirX2) + ", " + roundedCorner * dirY2 + "\n                  Q 24 0 " + (24 + roundedCorner / 3) + " 0\n                  z" : "M " + roundedCorner / 3 + ", 0\n                  L " + (74 - roundedCorner / 3) + ", 0\n                  Q 74 0 " + (74 + roundedCorner * dirX1) + " " + roundedCorner * dirY1 + "\n                  L " + (84 - roundedCorner * dirX1) + ", " + (50 - roundedCorner * dirY1) + "\n                  Q 84 50 " + (84 - roundedCorner * dirX1) + " " + (50 + roundedCorner * dirY1) + "\n                  L " + (74 + roundedCorner * dirX1) + ", " + (100 - roundedCorner * dirY1) + "\n                  Q 74 100 " + (74 - roundedCorner / 3) + " 100\n                  L " + roundedCorner / 3 + ", 100\n                  Q 0 100 " + roundedCorner * dirX2 + " " + (100 - roundedCorner * dirY2) + "\n                  L " + (16 - roundedCorner * dirX2) + ", " + (50 + roundedCorner * dirY2) + "\n                  Q 16 50 " + (16 - roundedCorner * dirX2) + ", " + (50 - roundedCorner * dirY2) + "\n                  L " + roundedCorner * dirX2 + ", " + roundedCorner * dirY2 + "\n                  Q 0 0 " + roundedCorner / 3 + " 0\n                  z";
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("g", {
    onClick: onClick,
    onContextMenu: onContextMenu,
    transform: "scale(" + width / 100 * 1.25 + ", " + height / 100 + ") translate(" + ((forward ? -20 : -50) + (relativeAAPositionInTranslation - 1) * 100 / 1.25) + ",0)"
  }, /*#__PURE__*/_react["default"].createElement("title", null, title), showAAColors && (isFiller ? /*#__PURE__*/_react["default"].createElement("polyline", {
    className: letter,
    transform: forward ? "scale(3,1)" : "translate(300,0) scale(-3,1) ",
    points: isFiller ? "25,0 49,0 60,50 49,100 25,100 38,50 25,0" : isTruncatedStart ? "0,0 50,0 60,50 50,100 00,100 16,50 0,0" : isTruncatedEnd ? "24,0 74,0 84,50 74,100 24,100 40,50 24,0" : "0,0 74,0 85,50 74,100 0,100 16,50 0,0",
    strokeWidth: "5",
    fill: color || "gray"
  }) : /*#__PURE__*/_react["default"].createElement("path", {
    className: letter,
    transform: forward ? "scale(3,1)" : "translate(300,0) scale(-3,1) ",
    d: path,
    strokeWidth: "5",
    fill: color || "gray"
  })), !isFiller && /*#__PURE__*/_react["default"].createElement("text", {
    fontSize: 25,
    stroke: "black",
    strokeWidth: 2,
    transform: "scale(" + 3 / width * 10 + ",3) translate(" + (forward ? 45 : 55) * width / 10 + ",21)",
    x: "0",
    y: "4",
    style: {
      textAnchor: "middle"
    }
  }, letter), showAminoAcidNumbers && (aminoAcidIndex + 1) % 5 === 0 && /*#__PURE__*/_react["default"].createElement("text", {
    fontSize: 25,
    stroke: "black",
    strokeWidth: 2,
    transform: "scale(" + 3 / width * 10 + ",3) translate(" + (forward ? 45 : 55) * width / 10 + ",51)",
    x: "0",
    y: "4",
    style: {
      textAnchor: "middle"
    }
  }, aminoAcidIndex + 1)));
}
var _default = (0, _pureNoFunc["default"])(AASliver);
exports["default"] = _default;
module.exports = exports.default;