import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import _isEqual from "lodash/isEqual";
import { connect } from "../redux";
import { getElement } from "../selectors";
export default connect(function (state, props) {
  var element = getElement(state, props.elementId);

  if (props.withChildElements) {
    return {
      element: _objectSpread(_objectSpread({}, element), {}, {
        elements: element && element.elements.map(function (id) {
          return getElement(state, id);
        })
      })
    };
  }

  return {
    element: element
  };
}, null, null, {
  areStatePropsEqual: _isEqual
})(function (_ref) {
  var children = _ref.children,
      element = _ref.element;

  if (typeof children === "function") {
    return children(element);
  }

  return children;
});
//# sourceMappingURL=ConnectedElement.js.map