"use strict";

exports.__esModule = true;
exports.default = void 0;
var _get2 = _interopRequireDefault(require("lodash/fp/get"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _inputSwitch = _interopRequireDefault(require("../../atom/input-switch"));
var _radioGroup = _interopRequireDefault(require("../../atom/radio-group"));
var _colors = require("../../variables/colors");
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); }
const ContentTypesToggler = (props, context) => {
  const {
    skin
  } = context;
  const {
    contentTypes
  } = props;
  if (!contentTypes) {
    return null;
  }
  const brand = (0, _get2.default)('common.brand', skin);
  const orange = (0, _get2.default)('common.orange', skin);
  const contentTypesColor = (0, _get2.default)('modified', contentTypes) ? orange : brand;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.contentTypeWrapper
  }, /*#__PURE__*/_react.default.createElement(_radioGroup.default, _extends({}, contentTypes, {
    style: {
      color: contentTypesColor
    },
    color: _colors.COLORS.cm_primary_blue
  })));
};
ContentTypesToggler.contextTypes = {
  skin: _provider.default.childContextTypes.skin
};
ContentTypesToggler.propTypes = process.env.NODE_ENV !== "production" ? {
  contentTypes: _propTypes.default.shape({
    ..._radioGroup.default.propTypes,
    modified: _propTypes.default.bool
  })
} : {};
const SetupSection = (props, context) => {
  const {
    translate
  } = context;
  const {
    title,
    display,
    contentTypes
  } = props;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.title
  }, title), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.settings
  }, /*#__PURE__*/_react.default.createElement(ContentTypesToggler, {
    contentTypes: contentTypes
  }), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.label
  }, translate('Show')), /*#__PURE__*/_react.default.createElement(_inputSwitch.default, display)));
};
SetupSection.contextTypes = {
  translate: _provider.default.childContextTypes.translate,
  skin: _provider.default.childContextTypes.skin
};
SetupSection.propTypes = process.env.NODE_ENV !== "production" ? {
  title: _propTypes.default.string.isRequired,
  onUp: _propTypes.default.func,
  onDown: _propTypes.default.func,
  display: _propTypes.default.shape(_inputSwitch.default.propTypes),
  contentTypes: ContentTypesToggler.propTypes.contentTypes
} : {};
var _default = exports.default = SetupSection;
//# sourceMappingURL=index.js.map