"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _ComponentContainer = require("../../../../Framework/ComponentContainer");
var _DesignAreaControlbox = _interopRequireDefault(require("../Components/DesignAreaControlbox"));
var _ServiceLocator = require("../../../ServiceLocator");
var _Selectors = require("../../../Reducers/DesignArea/Selectors");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var mapStateToProps = function mapStateToProps(state) {
  var _getSelectedDesignAre = (0, _Selectors.getSelectedDesignAreaProperties)(state),
    filteredDesignAreas = _getSelectedDesignAre.filteredDesignAreas,
    maxColorAmountSource = _getSelectedDesignAre.maxColorAmount,
    designProductionMethod = _getSelectedDesignAre.designProductionMethod,
    selectedDesignArea = _getSelectedDesignAre.selectedDesignArea;
  var hasDesign = (0, _Selectors.getDesignDataForFilteredDesignAreas)(state);
  var colorAmount = (0, _Selectors.getColors)(state).length;
  var maxColorAmount = parseInt(maxColorAmountSource);
  return {
    Component: _DesignAreaControlbox["default"],
    designAreas: filteredDesignAreas || [],
    designedAreas: hasDesign || {},
    valueProductionMethod: designProductionMethod,
    valueDesignArea: selectedDesignArea,
    colorAmount: colorAmount,
    maxColorAmount: maxColorAmount,
    hasAmountIndicatorWarning: Boolean(maxColorAmount && colorAmount > maxColorAmount),
    colorDisabled: (0, _Selectors.isColoringDisabled)(state),
    handleChangeDesignArea: function handleChangeDesignArea(_ref) {
      var value = _ref.target.value;
      return _ServiceLocator.Services.designData.selectDesignArea(value);
    },
    handleChangeProductionMethod: function handleChangeProductionMethod(_ref2) {
      var value = _ref2.target.value;
      _ServiceLocator.Services.designData.setDesignProductionMethod(value);
    }
  };
};
var _default = exports["default"] = (0, _ComponentContainer.containerConnect)(mapStateToProps);