"use strict";

exports.__esModule = true;
exports.selectEventUpdater = exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _Select = _interopRequireDefault(require("../../MaterialUI/Inputs/Select"));
var _utils = require("../../../utils");
var _SelectProps = _interopRequireDefault(require("../../MaterialUI/Inputs/SelectProps"));
var _excluded = ["value", "options", "update"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var selectEventUpdater = exports.selectEventUpdater = (0, _utils.memoize)(function (update) {
  return function (value) {
    return update(value);
  };
});
var Selector = function Selector(_ref) {
  var value = _ref.value,
    options = _ref.options,
    update = _ref.update,
    props = _objectWithoutProperties(_ref, _excluded);
  var selectProps = new _SelectProps.default();
  selectProps.set(_SelectProps.default.propNames.value, value);
  selectProps.set(_SelectProps.default.propNames.onClose, props.onBlur);
  selectProps.set(_SelectProps.default.propNames.disabled, props.disabled);
  selectProps.set(_SelectProps.default.propNames.update, selectEventUpdater(update));
  var hasError = props.required && !value ? true : false;
  selectProps.set(_SelectProps.default.propNames.error, hasError);
  return /*#__PURE__*/_react.default.createElement(_Select.default, {
    options: options,
    selectProps: selectProps
  });
};
var _default = Selector;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(selectEventUpdater, "selectEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
  reactHotLoader.register(Selector, "Selector", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(selectEventUpdater, "selectEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
  reactHotLoader.register(Selector, "Selector", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/Form/Inputs/Selector.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();