"use strict";

exports.__esModule = true;
exports.switchEventUpdater = exports.SwitchInput = void 0;
var _react = _interopRequireDefault(require("react"));
var _styles = require("@material-ui/core/styles");
var _utils = require("../../../utils");
var _Switch = _interopRequireDefault(require("../../MaterialUI/Inputs/Switch"));
var _SwitchProps = _interopRequireDefault(require("../../MaterialUI/Inputs/SwitchProps"));
var _excluded = ["update", "value"];
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 switchEventUpdater = exports.switchEventUpdater = (0, _utils.memoize)(function (update) {
  return function (value) {
    return update(value);
  };
});
var useStyles = (0, _styles.makeStyles)({
  centerMiddleWrapper: {
    minHeight: 30,
    display: "flex",
    justifyContent: "center",
    alignItems: "center"
  }
});
var SwitchInput = exports.SwitchInput = function SwitchInput(_ref) {
  var update = _ref.update,
    value = _ref.value,
    props = _objectWithoutProperties(_ref, _excluded);
  var classes = useStyles();
  var switchProps = new _SwitchProps.default();
  switchProps.set(_SwitchProps.default.propNames.value, value);
  switchProps.set(_SwitchProps.default.propNames.onCaption, props.onCaption);
  switchProps.set(_SwitchProps.default.propNames.offCaption, props.offCaption);
  switchProps.set(_SwitchProps.default.propNames.disabled, props.disabled);
  switchProps.set(_SwitchProps.default.propNames.update, switchEventUpdater(update));
  return /*#__PURE__*/_react.default.createElement("div", {
    className: classes.centerMiddleWrapper
  }, /*#__PURE__*/_react.default.createElement(_Switch.default, {
    switchProps: switchProps
  }));
};
__signature__(SwitchInput, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(SwitchInput, "useStyles{classes}", function () {
  return [useStyles];
});
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(switchEventUpdater, "switchEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(SwitchInput, "SwitchInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.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(switchEventUpdater, "switchEventUpdater", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
  reactHotLoader.register(SwitchInput, "SwitchInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Toggles.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();