"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_moment=require("moment"),moment=_interopRequireWildcard(_moment),_locale=require("../modal/locale");function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function setMomentLocale(e){e&&e.locale?moment.locale(e.locale):moment.locale("zh-cn")}var LocaleProvider=function(e){function t(){return(0,_classCallCheck3.default)(this,t),(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"getChildContext",value:function(){return{antLocale:(0,_extends3.default)({},this.props.locale,{exist:!0})}}},{key:"componentWillMount",value:function(){setMomentLocale(this.props.locale),this.componentDidUpdate()}},{key:"componentWillReceiveProps",value:function(e){this.props.locale!==e.locale&&setMomentLocale(e.locale)}},{key:"componentDidUpdate",value:function(){var e=this.props.locale;(0,_locale.changeConfirmLocale)(e&&e.Modal)}},{key:"componentWillUnmount",value:function(){(0,_locale.changeConfirmLocale)()}},{key:"render",value:function(){return React.Children.only(this.props.children)}}]),t}(React.Component);(exports.default=LocaleProvider).propTypes={locale:PropTypes.object},LocaleProvider.defaultProps={locale:{}},LocaleProvider.childContextTypes={antLocale:PropTypes.object},module.exports=exports.default;