"use strict";

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

var _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.BasePoint = exports.ArrowPoint = exports.Arrow = void 0;

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

var _index = require("@material-ui/core/styles/index");

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

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

var _styles = require("../styles");

var _basePoint = require("./base-point");

var _arrowPoint = require("./arrow-point");

var _renderUi = require("../../../../render-ui");

var _arrow = _interopRequireDefault(require("./arrow"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

var opts = {
  bounds: function bounds(props, _ref) {
    var domain = _ref.domain,
        range = _ref.range;
    var x = props.x,
        y = props.y;
    var area = {
      left: x,
      top: y,
      bottom: y,
      right: x
    };
    return utils.bounds(area, domain, range);
  },
  anchorPoint: function anchorPoint(props) {
    var x = props.x,
        y = props.y;
    return {
      x: x,
      y: y
    };
  },
  fromDelta: function fromDelta(props, delta) {
    return utils.point(props).add(utils.point(delta));
  }
};

var styles = function styles() {
  return {
    point: {
      '& circle, & polygon': {
        cursor: 'pointer',
        fill: _renderUi.color.defaults.SECONDARY
      }
    },
    disabled: {
      '& circle, & polygon': _objectSpread({}, (0, _styles.disabled)())
    },
    correct: {
      '& circle, & polygon': _objectSpread({}, (0, _styles.correct)())
    },
    incorrect: {
      '& circle, & polygon': _objectSpread({}, (0, _styles.incorrect)())
    },
    missing: {
      '& circle, & polygon': _objectSpread({}, (0, _styles.missing)())
    }
  };
};

var BasePoint = (0, _index.withStyles)(styles)((0, _plot.gridDraggable)(opts)(_basePoint.RawBp));
exports.BasePoint = BasePoint;
var ArrowPoint = (0, _index.withStyles)(styles)((0, _plot.gridDraggable)(opts)(_arrowPoint.RawArrow));
exports.ArrowPoint = ArrowPoint;
var Arrow = (0, _index.withStyles)(styles)((0, _plot.gridDraggable)(opts)(_arrow["default"]));
exports.Arrow = Arrow;
//# sourceMappingURL=index.js.map