"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CreatorAlignTarget = void 0;
var _react = _interopRequireDefault(require("react"));
var _Containers = require("../Creator/Containers");
var _styles = require("@material-ui/core/styles");
var _reactRedux = require("react-redux");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var styles = function styles(theme) {
  var _withDesignViews, _root;
  return {
    root: (_root = {
      marginTop: 36
    }, _defineProperty(_root, theme.breakpoints.down('xs'), {
      maxHeight: 'calc(100% - 270px)'
    }), _defineProperty(_root, theme.breakpoints.up('sm'), _defineProperty({
      maxHeight: 'calc(100% - 58px)'
    }, theme.orientation.portrait, {
      maxHeight: 'calc(100% - 260px)'
    })), _defineProperty(_root, theme.breakpoints.up(theme.creator.viewSelectBreakpoint), {
      marginTop: 0
    }), _defineProperty(_root, theme.breakpoints.between(theme.creator.viewSelectBreakpoint, 'lg'), {
      maxHeight: 'calc(100% - 152px)'
    }), _defineProperty(_root, theme.breakpoints.up('lg'), {
      maxHeight: 'calc(100% - 154px)'
    }), _defineProperty(_root, '@media (min-aspect-ratio: 13/9) and (min-height: 280px) and (max-width: 950px)', {
      maxHeight: '100%'
    }), _defineProperty(_root, '&.withDesignViews', (_withDesignViews = {}, _defineProperty(_withDesignViews, theme.breakpoints.up('sm'), _defineProperty({
      maxHeight: 'calc(100% - 136px)'
    }, theme.orientation.portrait, {
      maxHeight: 'calc(100% - 260px)'
    })), _defineProperty(_withDesignViews, theme.breakpoints.between(theme.creator.viewSelectBreakpoint, 'lg'), {
      maxHeight: 'calc(100% - 156px)'
    }), _defineProperty(_withDesignViews, theme.breakpoints.up('lg'), {
      maxHeight: 'calc(100% - 196px)'
    }), _withDesignViews)), _root)
  };
};
var StyledAlignTargetContainer = (0, _styles.withStyles)(styles, {
  name: 'CreatorAlignTarget'
})(_Containers.AlignTargetContainer);
var CreatorAlignTarget = exports.CreatorAlignTarget = function CreatorAlignTarget(props) {
  var className = (0, _reactRedux.useSelector)(function (state) {
    var _state$designView;
    return ((_state$designView = state.designView) === null || _state$designView === void 0 ? void 0 : _state$designView.designViews.length) > 1;
  }) && 'withDesignViews';
  return /*#__PURE__*/_react["default"].createElement(StyledAlignTargetContainer, _extends({
    className: className
  }, props));
};