{"ast":null,"code":"\"use strict\";\n\nvar _classCallCheck = require(\"@babel/runtime-corejs2/helpers/classCallCheck\");\n\nvar _possibleConstructorReturn = require(\"@babel/runtime-corejs2/helpers/possibleConstructorReturn\");\n\nvar _getPrototypeOf = require(\"@babel/runtime-corejs2/helpers/getPrototypeOf\");\n\nvar _assertThisInitialized = require(\"@babel/runtime-corejs2/helpers/assertThisInitialized\");\n\nvar _createClass = require(\"@babel/runtime-corejs2/helpers/createClass\");\n\nvar _inherits = require(\"@babel/runtime-corejs2/helpers/inherits\");\n\nvar _toConsumableArray = require(\"@babel/runtime-corejs2/helpers/toConsumableArray\");\n\nvar _Set = require(\"@babel/runtime-corejs2/core-js/set\");\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs2/core-js/object/define-property\");\n\n_Object$defineProperty(exports, \"__esModule\", {\n  value: true\n});\n\nvar react_1 = require(\"react\");\n\nvar isServer = false;\n\nexports[\"default\"] = function () {\n  var mountedInstances = new _Set();\n  var state;\n\n  function emitChange(component) {\n    state = component.props.reduceComponentsToState(_toConsumableArray(mountedInstances), component.props);\n\n    if (component.props.handleStateChange) {\n      component.props.handleStateChange(state);\n    }\n  }\n\n  return (\n    /*#__PURE__*/\n    function (_react_1$Component) {\n      _inherits(_class, _react_1$Component);\n\n      _createClass(_class, null, [{\n        key: \"rewind\",\n        // Used when server rendering\n        value: function rewind() {\n          var recordedState = state;\n          state = undefined;\n          mountedInstances.clear();\n          return recordedState;\n        }\n      }]);\n\n      function _class(props) {\n        var _this;\n\n        _classCallCheck(this, _class);\n\n        _this = _possibleConstructorReturn(this, _getPrototypeOf(_class).call(this, props));\n\n        if (isServer) {\n          mountedInstances.add(_assertThisInitialized(_this));\n          emitChange(_assertThisInitialized(_this));\n        }\n\n        return _this;\n      }\n\n      _createClass(_class, [{\n        key: \"componentDidMount\",\n        value: function componentDidMount() {\n          mountedInstances.add(this);\n          emitChange(this);\n        }\n      }, {\n        key: \"componentDidUpdate\",\n        value: function componentDidUpdate() {\n          emitChange(this);\n        }\n      }, {\n        key: \"componentWillUnmount\",\n        value: function componentWillUnmount() {\n          mountedInstances[\"delete\"](this);\n          emitChange(this);\n        }\n      }, {\n        key: \"render\",\n        value: function render() {\n          return null;\n        }\n      }]);\n\n      return _class;\n    }(react_1.Component)\n  );\n};","map":null,"metadata":{},"sourceType":"script"}