"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

var _plot = require("../../../../plot");

var _arrowHead = require("../arrow-head");

var _utils = require("../../../utils");

var _excluded = ["classes", "angle", "className", "x", "y", "disabled", "correctness", "graphProps"];

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var Arrow = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(Arrow, _React$Component);

  var _super = _createSuper(Arrow);

  function Arrow() {
    (0, _classCallCheck2["default"])(this, Arrow);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(Arrow, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          classes = _this$props.classes,
          angle = _this$props.angle,
          className = _this$props.className,
          x = _this$props.x,
          y = _this$props.y,
          disabled = _this$props.disabled,
          correctness = _this$props.correctness,
          graphProps = _this$props.graphProps,
          rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
      var size = (0, _utils.thinnerShapesNeeded)(graphProps) ? 12 : 14;
      var scale = graphProps.scale;
      var scaledX = scale.x(x);
      var scaledY = scale.y(y);
      var transform = "rotate(".concat(-angle, ", ").concat(scaledX, ",").concat(scaledY, ")");
      var points = "".concat(scaledX, ",").concat(scaledY, "\n        ").concat(scaledX - size, ",").concat(scaledY - size / 2, "\n        ").concat(scaledX - size, ", ").concat(scaledY + size / 2);
      return /*#__PURE__*/_react["default"].createElement("g", (0, _extends2["default"])({
        className: (0, _classnames["default"])(classes.point, disabled && classes.disabled, classes[correctness], className)
      }, rest), /*#__PURE__*/_react["default"].createElement(_arrowHead.ArrowHead, {
        size: size,
        transform: transform,
        points: points
      }));
    }
  }]);
  return Arrow;
}(_react["default"].Component);

exports["default"] = Arrow;
(0, _defineProperty2["default"])(Arrow, "propTypes", {
  classes: _propTypes["default"].object,
  className: _propTypes["default"].string,
  correctness: _propTypes["default"].string,
  disabled: _propTypes["default"].bool,
  x: _propTypes["default"].number.isRequired,
  y: _propTypes["default"].number.isRequired,
  angle: _propTypes["default"].number.isRequired,
  graphProps: _plot.types.GraphPropsType.isRequired
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64, 