/* * ReactIntl v2.2.3 * * Copyright 2017, Yahoo Inc. * Copyrights licensed under the New BSD License. * See the accompanying LICENSE file for terms. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.ReactIntl=t.ReactIntl||{},t.React)}(this,function(t,e){"use strict";function r(t){var e,r,n,o,a=Array.prototype.slice.call(arguments,1);for(e=0,r=a.length;e0&&void 0!==arguments[0]?arguments[0]:[],e=Array.isArray(t)?t:[t];e.forEach(function(t){t&&t.locale&&(u.__addLocaleData(t),c.__addLocaleData(t))})}function p(t){for(var e=(t||"").split("-");e.length>0;){if(h(e.join("-")))return!0;e.pop()}return!1}function h(t){var e=t&&t.toLowerCase();return!(!u.__localeData__[e]||!c.__localeData__[e])}function m(t){return(""+t).replace(Ut,function(t){return St[t]})}function d(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.reduce(function(e,n){return t.hasOwnProperty(n)?e[n]=t[n]:r.hasOwnProperty(n)&&(e[n]=r[n]),e},{})}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.intl;Lt(e,"[React Intl] Could not find required `intl` object. needs to exist in the component ancestry.")}function v(t,e){if(t===e)return!0;if("object"!==("undefined"==typeof t?"undefined":it(t))||null===t||"object"!==("undefined"==typeof e?"undefined":it(e))||null===e)return!1;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(e),a=0;a3&&void 0!==arguments[3]?arguments[3]:{},u=i.intl,s=void 0===u?{}:u,c=l.intl,f=void 0===c?{}:c;return!v(e,n)||!v(r,o)||!(f===s||v(d(f,It),d(s,It)))}function _(t){return t.displayName||t.name||"Component"}function b(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.intlPropName,o=void 0===n?"intl":n,a=r.withRef,i=void 0!==a&&a,l=function(e){function r(t,e){lt(this,r);var n=ht(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,e));return y(e),n}return ft(r,e),ut(r,[{key:"getWrappedInstance",value:function(){return Lt(i,"[React Intl] To access the wrapped instance, the `{withRef: true}` option must be set when calling: `injectIntl()`"),this.refs.wrappedInstance}},{key:"render",value:function(){return U.createElement(t,ct({},this.props,st({},o,this.context.intl),{ref:i?"wrappedInstance":null}))}}]),r}(e.Component);return l.displayName="InjectIntl("+_(t)+")",l.contextTypes={intl:At},l.WrappedComponent=t,l}function w(t){return t}function F(t){return u.prototype._resolveLocale(t)}function O(t){return u.prototype._findPluralRuleFunction(t)}function x(t){var e=Zt(null);return function(){var r=Array.prototype.slice.call(arguments),n=P(r),o=n&&e[n];return o||(o=new(qt.apply(t,[null].concat(r))),n&&(e[n]=o)),o}}function P(t){if("undefined"!=typeof JSON){var e,r,n,o=[];for(e=0,r=t.length;e3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=t.formats,i=n.format,l=new Date(r),u=i&&C(a,"date",i),s=d(n,Bt,u);try{return e.getDateTimeFormat(o,s).format(l)}catch(t){}return String(l)}function N(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=t.formats,i=n.format,l=new Date(r),u=i&&C(a,"time",i),s=d(n,Bt,u);s.hour||s.minute||s.second||(s=ct({},s,{hour:"numeric",minute:"numeric"}));try{return e.getDateTimeFormat(o,s).format(l)}catch(t){}return String(l)}function M(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=t.formats,i=n.format,l=new Date(r),u=new Date(n.now),s=i&&C(a,"relative",i),f=d(n,$t,s),p=ct({},c.thresholds);j(Kt);try{return e.getRelativeFormat(o,f).format(l,{now:isFinite(u)?u:e.now()})}catch(t){}finally{j(p)}return String(l)}function R(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=t.formats,i=n.format,l=i&&C(a,"number",i),u=d(n,Jt,l);try{return e.getNumberFormat(o,u).format(r)}catch(t){}return String(r)}function k(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=d(n,zt);try{return e.getPluralFormat(o,a).format(r)}catch(t){}return"other"}function D(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=t.locale,a=t.formats,i=t.messages,l=t.defaultLocale,u=t.defaultFormats,s=r.id,c=r.defaultMessage;Lt(s,"[React Intl] An `id` must be provided to format a message.");var f=i&&i[s],p=Object.keys(n).length>0;if(!p)return f||c||s;var h=void 0;if(f)try{var m=e.getMessageFormat(f,o,a);h=m.format(n)}catch(t){}if(!h&&c)try{var d=e.getMessageFormat(c,l,u);h=d.format(n)}catch(t){}return h||f||c||s}function E(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=Object.keys(n).reduce(function(t,e){var r=n[e];return t[e]="string"==typeof r?m(r):r,t},{});return D(t,e,r,o)}function L(t){var e=Math.abs(t);return ee&&(zt=0,Kt={line:1,column:1,seenCR:!1}),r(Kt,zt,e),zt=e),Kt}function n(t){JtQt&&(Qt=Jt,Xt=[]),Xt.push(t))}function o(n,o,a){function i(t){var e=1;for(t.sort(function(t,e){return t.descriptione.description?1:0});e1?i.slice(0,-1).join(", ")+" or "+i[t.length-1]:i[0],o=e?'"'+r(e)+'"':"end of input","Expected "+n+" but "+o+" found."}var u=r(a),s=a1?arguments[1]:{},N={},M={start:a},R=a,k=function(t){return{type:"messageFormatPattern",elements:t}},D=N,E=function(t){var e,r,n,o,a,i="";for(e=0,n=t.length;e=0)return!0;if("string"==typeof t){var e=/s$/.test(t)&&t.substr(0,t.length-1);if(e&&tt.call(nt,e)>=0)throw new Error('"'+t+'" is not a valid IntlRelativeFormat `units` value, did you mean: '+e)}throw new Error('"'+t+'" is not a valid IntlRelativeFormat `units` value, it must be one of: "'+nt.join('", "')+'"')},c.prototype._resolveLocale=function(t){"string"==typeof t&&(t=[t]),t=(t||[]).concat(c.defaultLocale);var e,r,n,o,a=c.__localeData__;for(e=0,r=t.length;e=0)return t;throw new Error('"'+t+'" is not a valid IntlRelativeFormat `style` value, it must be one of: "'+ot.join('", "')+'"')},c.prototype._selectUnits=function(t){var e,r,n;for(e=0,r=nt.length;e=0||Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},ht=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},mt=function(t){if(Array.isArray(t)){for(var e=0,r=Array(t.length);e":">","<":"<",'"':""","'":"'"},Ut=/[&><"']/g,Gt=function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt(this,t);var n="ordinal"===r.style,o=O(F(e));this.format=function(t){return o(t,n)}},qt=Function.prototype.bind||function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),r=this,n=function(){},o=function(){return r.apply(this instanceof n?this:t,e.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(n.prototype=this.prototype),o.prototype=new n,o},Ht=Object.prototype.hasOwnProperty,Wt=function(){try{return!!Object.defineProperty({},"a",{})}catch(t){return!1}}(),Vt=Wt?Object.defineProperty:function(t,e,r){"get"in r&&t.__defineGetter__?t.__defineGetter__(e,r.get):(!Ht.call(t,e)||"value"in r)&&(t[e]=r.value)},Zt=Object.create||function(t,e){function r(){}var n,o;r.prototype=t,n=new r;for(o in e)Ht.call(e,o)&&Vt(n,o,e[o]);return n},Bt=Object.keys(Nt),Jt=Object.keys(Mt),$t=Object.keys(Rt),zt=Object.keys(kt),Kt={second:60,minute:60,hour:24,day:30,month:12},Qt=Object.freeze({formatDate:A,formatTime:N,formatRelative:M,formatNumber:R,formatPlural:k,formatMessage:D,formatHTMLMessage:E}),Xt=Object.keys(jt),Yt=Object.keys(Ct),te={formats:{},messages:{},textComponent:"span",defaultLocale:"en",defaultFormats:{}},ee=function(t){function r(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt(this,r);var n=ht(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,t,e));Lt("undefined"!=typeof Intl,"[React Intl] The `Intl` APIs must be available in the runtime, and do not appear to be built-in. An `Intl` polyfill should be loaded.\nSee: http://formatjs.io/guides/runtime-environments/");var o=e.intl,a=void 0;a=isFinite(t.initialNow)?Number(t.initialNow):o?o.now():Date.now();var i=o||{},l=i.formatters,s=void 0===l?{getDateTimeFormat:x(Intl.DateTimeFormat),getNumberFormat:x(Intl.NumberFormat),getMessageFormat:x(u),getRelativeFormat:x(c),getPluralFormat:x(Gt)}:l;return n.state=ct({},s,{now:function(){return n._didDisplay?Date.now():a}}),n}return ft(r,t),ut(r,[{key:"getConfig",value:function(){var t=this.context.intl,e=d(this.props,Xt,t);for(var r in te)void 0===e[r]&&(e[r]=te[r]);if(!p(e.locale)){var n=e,o=(n.locale,n.defaultLocale),a=n.defaultFormats;e=ct({},e,{locale:o,formats:a,messages:te.messages})}return e}},{key:"getBoundFormatFns",value:function(t,e){return Yt.reduce(function(r,n){return r[n]=Qt[n].bind(null,t,e),r},{})}},{key:"getChildContext",value:function(){var t=this.getConfig(),e=this.getBoundFormatFns(t,this.state),r=this.state,n=r.now,o=pt(r,["now"]);return{intl:ct({},t,e,{formatters:o,now:n})}}},{key:"shouldComponentUpdate",value:function(){for(var t=arguments.length,e=Array(t),r=0;r1?o-1:0),i=1;i0;d&&!function(){var t=Math.floor(1099511627776*Math.random()).toString(16),r=function(){var e=0;return function(){return"ELEMENT-"+t+"-"+(e+=1)}}();p="@__"+t+"__@",h={},m={},Object.keys(u).forEach(function(t){var n=u[t];if(e.isValidElement(n)){var o=r();h[t]=p+o+p,m[o]=n}else h[t]=n})}();var y={id:a,description:i,defaultMessage:l},v=r(y,h||u),g=void 0,_=m&&Object.keys(m).length>0;return g=_?v.split(p).filter(function(t){return!!t}).map(function(t){return m[t]||t}):[v],"function"==typeof f?f.apply(void 0,mt(g)):e.createElement.apply(void 0,[c,null].concat(mt(g)))}}]),r}(e.Component);pe.displayName="FormattedMessage",pe.contextTypes={intl:At},pe.defaultProps={values:{}};var he=function(t){function e(t,r){lt(this,e);var n=ht(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,r));return y(r),n}return ft(e,t),ut(e,[{key:"shouldComponentUpdate",value:function(t){var e=this.props.values,r=t.values;if(!v(r,e))return!0;for(var n=ct({},t,{values:e}),o=arguments.length,a=Array(o>1?o-1:0),i=1;i