import _inheritsLoose from "@babel/runtime/helpers/esm/inheritsLoose";
import React from 'react';
import { isNonNullable } from "../../../../lib/utils";
import { cx } from "../../../../lib/theming/Emotion";
import { ThemeContext } from "../../../../lib/theming/ThemeContext";
import { jsStyles } from "../MobilePopupHeader.styles";
export var MobilePopupHeader = /*#__PURE__*/function (_React$Component) {
  function MobilePopupHeader() {
    return _React$Component.apply(this, arguments) || this;
  }
  _inheritsLoose(MobilePopupHeader, _React$Component);
  var _proto = MobilePopupHeader.prototype;
  _proto.render = function render() {
    var _this = this;
    return /*#__PURE__*/(
      React.createElement(ThemeContext.Consumer, null, function (theme) {
        _this.theme = theme;
        return _this.renderMain();
      })
    );
  };
  _proto.renderMain = function renderMain() {
    var _cx, _cx2;
    var _this$props = this.props,
      caption = _this$props.caption,
      children = _this$props.children;
    return /*#__PURE__*/(
      React.createElement("div", {
        className: cx((_cx = {}, _cx[jsStyles.root(this.theme)] = true, _cx[jsStyles.rootWithoutContent()] = !caption && !children, _cx))
      }, /*#__PURE__*/

      React.createElement("div", {
        className: jsStyles.container()
      }, caption && /*#__PURE__*/
      React.createElement("div", {
        className: cx((_cx2 = {}, _cx2[jsStyles.caption(this.theme)] = true, _cx2[jsStyles.captionWithChildren()] = isNonNullable(children), _cx2))
      }, caption), /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.createElement("div", null, children)))
    );
  };
  return MobilePopupHeader;
}(React.Component);
MobilePopupHeader.__KONTUR_REACT_UI__ = 'MobileMenuHeader';
MobilePopupHeader.displayName = 'MobileMenuHeader';