'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _extends2 = require('babel-runtime/helpers/extends');

var _extends3 = _interopRequireDefault(_extends2);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

exports['default'] = function (componentName, defaultLocale) {
    return function (Component) {
        var ComponentWithStatics = Component;
        return _a = function (_Component) {
            (0, _inherits3['default'])(_a, _Component);

            function _a() {
                (0, _classCallCheck3['default'])(this, _a);
                return (0, _possibleConstructorReturn3['default'])(this, (_a.__proto__ || Object.getPrototypeOf(_a)).apply(this, arguments));
            }

            (0, _createClass3['default'])(_a, [{
                key: 'getLocale',
                value: function getLocale() {
                    var antLocale = this.context.antLocale;

                    var localeFromContext = antLocale && antLocale[componentName];
                    var localeFromProps = this.props.locale || {};
                    return (0, _extends3['default'])({}, defaultLocale, localeFromContext || {}, localeFromProps);
                }
            }]);
            return _a;
        }(Component), _a.propTypes = ComponentWithStatics.propTypes, _a.defaultProps = ComponentWithStatics.defaultProps, _a.contextTypes = (0, _extends3['default'])({}, ComponentWithStatics.context || {}, { antLocale: _propTypes2['default'].object }), _a;
        var _a;
    };
};

module.exports = exports['default'];