function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

import { Component } from 'react';
import PropTypes from 'prop-types';
import getLocaleValue from './../locale';

var ConfigProvider = /*#__PURE__*/function (_Component) {
  _inheritsLoose(ConfigProvider, _Component);

  function ConfigProvider() {
    return _Component.apply(this, arguments) || this;
  }

  var _proto = ConfigProvider.prototype;

  _proto.getChildContext = function getChildContext() {
    var _this$props = this.props,
        _this$props$locale = _this$props.locale,
        locale = _this$props$locale === void 0 ? {} : _this$props$locale,
        portal = _this$props.portal,
        onChange = _this$props.onChange;
    var data = null;
    data = locale;
    if (data) window.localeData = data;
    return {
      locale: function locale() {
        return getLocaleValue.apply(void 0, arguments);
      },
      portal: portal,
      onChange: onChange
    };
  };

  _proto.render = function render() {
    return this.props.children;
  };

  return ConfigProvider;
}(Component);

_defineProperty(ConfigProvider, "childContextTypes", {
  locale: PropTypes.object,
  portal: PropTypes.object,
  onChange: PropTypes.func
});

export { ConfigProvider as default };
ConfigProvider.propTypes = process.env.NODE_ENV !== "production" ? {
  locale: PropTypes.object,
  portal: PropTypes.object,
  onChange: PropTypes.func,
  children: PropTypes.any
} : {};