react-intl
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -1,3 +0,3 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.ReactIntl=e.ReactIntl||{},e.React)}(this,function(e,t){"use strict";function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e){var t,r,n,o,a=Array.prototype.slice.call(arguments,1);for(t=0,r=a.length;r>t;t+=1)if(n=a[t])for(o in n)H.call(n,o)&&(e[o]=n[o]);return e}function o(e,t,r){this.locales=e,this.formats=t,this.pluralFn=r}function a(e){this.id=e}function i(e,t,r,n,o){this.id=e,this.useOrdinal=t,this.offset=r,this.options=n,this.pluralFn=o}function s(e,t,r,n){this.id=e,this.offset=t,this.numberFormat=r,this.string=n}function l(e,t){this.id=e,this.options=t}function u(e,t,r){var n="string"==typeof e?u.__parse(e):e;if(!n||"messageFormatPattern"!==n.type)throw new TypeError("A message must be provided as a String or AST.");r=this._mergeFormats(u.formats,r),V(this,"_locale",{value:this._resolveLocale(t)});var o=this._findPluralRuleFunction(this._locale),a=this._compilePattern(n,t,r,o),i=this;this.format=function(e){return i._format(a,e)}}function c(e){return 400*e/146097}function p(e,t){e=+e,t=+t;var r=J(t-e),n=J(r/1e3),o=J(n/60),a=J(o/60),i=J(a/24),s=J(i/7),l=c(i),u=J(12*l),p=J(l);return{millisecond:r,second:n,minute:o,hour:a,day:i,week:s,month:u,year:p}}function f(e,t){t=t||{},te(e)&&(e=e.concat()),X(this,"_locale",{value:this._resolveLocale(e)}),X(this,"_options",{value:{style:this._resolveStyle(t.style),units:this._isValidUnits(t.units)&&t.units}}),X(this,"_locales",{value:e}),X(this,"_fields",{value:this._findFields(this._locale)}),X(this,"_messages",{value:Y(null)});var r=this;this.format=function(e,t){return r._format(e,t)}}function d(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=Array.isArray(e)?e:[e];t.forEach(function(e){e&&e.locale&&(u.__addLocaleData(e),f.__addLocaleData(e))})}function h(e){for(var t=(e||"").split("-");t.length>0;){if(m(t.join("-")))return!0;t.pop()}return!1}function m(e){var t=e&&e.toLowerCase();return!(!u.__localeData__[t]||!f.__localeData__[t])}function y(e){return(""+e).replace(Pe,function(e){return Ce[e]})}function v(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return t.reduce(function(t,n){return e.hasOwnProperty(n)?t[n]=e[n]:r.hasOwnProperty(n)&&(t[n]=r[n]),t},{})}function g(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.intl;Fe(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}function b(e,t){if(e===t)return!0;if("object"!==("undefined"==typeof e?"undefined":U["typeof"](e))||null===e||"object"!==("undefined"==typeof t?"undefined":U["typeof"](t))||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),a=0;a<r.length;a++)if(!o(r[a])||e[r[a]]!==t[r[a]])return!1;return!0}function _(e,t,r){var n=e.props,o=e.state,a=e.context,i=void 0===a?{}:a,s=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],l=i.intl,u=void 0===l?{}:l,c=s.intl,p=void 0===c?{}:c;return!b(t,n)||!b(r,o)||!b(v(p,Te),v(u,Te))}function w(e){return e.displayName||e.name||"Component"}function F(e){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?!1:a,s=function(t){function r(e,t){U.classCallCheck(this,r);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return U.inherits(r,t),U.createClass(r,[{key:"getWrappedInstance",value:function(){return Fe(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 q.createElement(e,U["extends"]({},this.props,U.defineProperty({},o,this.context.intl),{ref:i?"wrappedInstance":null}))}}]),r}(t.Component);return s.displayName="InjectIntl("+w(e)+")",s.contextTypes={intl:me},s.WrappedComponent=e,s}function T(e){return e}function C(e){return u.prototype._resolveLocale(e)}function P(e){return u.prototype._findPluralRuleFunction(e)}function x(e){var t=Ae(null);return function(){var r=Array.prototype.slice.call(arguments),n=O(r),o=n&&t[n];return o||(o=new(Oe.apply(e,[null].concat(r))),n&&(t[n]=o)),o}}function O(e){if("undefined"!=typeof JSON){var t,r,n,o=[];for(t=0,r=e.length;r>t;t+=1)n=e[t],n&&"object"===("undefined"==typeof n?"undefined":U["typeof"](n))?o.push(R(n)):o.push(n);return JSON.stringify(o)}}function R(e){var t,r,n,o,a=[],i=[];for(t in e)e.hasOwnProperty(t)&&i.push(t);var s=i.sort();for(r=0,n=s.length;n>r;r+=1)t=s[r],o={},o[t]=e[t],a[r]=o;return a}function j(e,t,r){var n=e&&e[t]&&e[t][r];return n?n:void 0}function N(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=i&&j(a,"date",i),u=v(n,ke,l);try{return t.getDateTimeFormat(o,u).format(s)}catch(c){}return String(s)}function A(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=i&&j(a,"time",i),u=v(n,ke,l);0===Object.keys(u).length&&(u={hour:"numeric",minute:"numeric"});try{return t.getDateTimeFormat(o,u).format(s)}catch(c){}return String(s)}function k(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=new Date(n.now),u=i&&j(a,"relative",i),c=v(n,Ee,u),p=U["extends"]({},f.thresholds);Object.assign(f.thresholds,{second:60,minute:60,hour:24,day:30,month:12});try{return t.getRelativeFormat(o,c).format(s,{now:isFinite(l)?l:t.now()})}catch(d){}finally{Object.assign(f.thresholds,p)}return String(s)}function M(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=i&&j(a,"number",i),l=v(n,Me,s);try{return t.getNumberFormat(o,l).format(r)}catch(u){}return String(r)}function E(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=v(n,De);try{return t.getPluralFormat(o,a).format(r)}catch(i){}return"other"}function D(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=e.messages,s=e.defaultLocale,l=e.defaultFormats,u=r.id,c=r.defaultMessage;Fe(u,"[React Intl] An `id` must be provided to format a message.");var p=i&&i[u],f=Object.keys(n).length>0;if(!f)return p||c||u;var d=void 0;if(p)try{var h=t.getMessageFormat(p,o,a);d=h.format(n)}catch(m){}if(!d&&c)try{var y=t.getMessageFormat(c,s,l);d=y.format(n)}catch(m){}return d||p||c||u}function L(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=Object.keys(n).reduce(function(e,t){var r=n[t];return e[t]="string"==typeof r?y(r):r,e},{});return D(e,t,r,o)}function I(e){var t=Math.abs(e);return Ve>t?"second":Ze>t?"minute":Be>t?"hour":"day"}function S(e){switch(e){case"second":return We;case"minute":return Ve;case"hour":return Ze;case"day":return Be;default:return ze}}var q="default"in t?t["default"]:t,U={};U["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},U.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},U.createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),U.defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},U["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},U.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},U.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},U.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)};var G={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}},H=Object.prototype.hasOwnProperty,W=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),V=(!W&&!Object.prototype.__defineGetter__,W?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!H.call(e,t)||"value"in r)&&(e[t]=r.value)}),Z=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)H.call(t,o)&&V(n,o,t[o]);return n};o.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},o.prototype.compileMessage=function(e){if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var t,r,n,o=e.elements,a=[];for(t=0,r=o.length;r>t;t+=1)switch(n=o[t],n.type){case"messageTextElement":a.push(this.compileMessageText(n));break;case"argumentElement":a.push(this.compileArgument(n));break;default:throw new Error("Message element does not have a valid type")}return a},o.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new s(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},o.prototype.compileArgument=function(e){var t=e.format;if(!t)return new a(e.id);var r,n=this.formats,o=this.locales,s=this.pluralFn;switch(t.type){case"numberFormat":return r=n.number[t.style],{id:e.id,format:new Intl.NumberFormat(o,r).format};case"dateFormat":return r=n.date[t.style],{id:e.id,format:new Intl.DateTimeFormat(o,r).format};case"timeFormat":return r=n.time[t.style],{id:e.id,format:new Intl.DateTimeFormat(o,r).format};case"pluralFormat":return r=this.compileOptions(e),new i(e.id,t.ordinal,t.offset,r,s);case"selectFormat":return r=this.compileOptions(e),new l(e.id,r);default:throw new Error("Message element does not have a valid format type")}},o.prototype.compileOptions=function(e){var t=e.format,r=t.options,n={};this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===t.type?e:null;var o,a,i;for(o=0,a=r.length;a>o;o+=1)i=r[o],n[i.selector]=this.compileMessage(i.value);return this.currentPlural=this.pluralStack.pop(),n},a.prototype.format=function(e){return e?"string"==typeof e?e:String(e):""},i.prototype.getOption=function(e){var t=this.options,r=t["="+e]||t[this.pluralFn(e-this.offset,this.useOrdinal)];return r||t.other},s.prototype.format=function(e){var t=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+t).replace(/\\#/g,"#")},l.prototype.getOption=function(e){var t=this.options;return t[e]||t.other};var B=function(){function e(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function t(e,t,r,n,o,a){this.message=e,this.expected=t,this.found=r,this.offset=n,this.line=o,this.column=a,this.name="SyntaxError"}function r(e){function r(t){function r(t,r,n){var o,a;for(o=r;n>o;o++)a=e.charAt(o),"\n"===a?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}return $e!==t&&($e>t&&($e=0,Ke={line:1,column:1,seenCR:!1}),r(Ke,$e,t),$e=t),Ke}function n(e){Qe>ze||(ze>Qe&&(Qe=ze,Xe=[]),Xe.push(e))}function o(n,o,a){function i(e){var t=1;for(e.sort(function(e,t){return e.description<t.description?-1:e.description>t.description?1:0});t<e.length;)e[t-1]===e[t]?e.splice(t,1):t++}function s(e,t){function r(e){function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+t(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+t(e)}).replace(/[\u0180-\u0FFF]/g,function(e){return"\\u0"+t(e)}).replace(/[\u1080-\uFFFF]/g,function(e){return"\\u"+t(e)})}var n,o,a,i=new Array(e.length);for(a=0;a<e.length;a++)i[a]=e[a].description;return n=e.length>1?i.slice(0,-1).join(", ")+" or "+i[e.length-1]:i[0],o=t?'"'+r(t)+'"':"end of input","Expected "+n+" but "+o+" found."}var l=r(a),u=a<e.length?e.charAt(a):null;return null!==o&&i(o),new t(null!==n?n:s(o,u),o,u,a,l.line,l.column)}function a(){var e;return e=i()}function i(){var e,t,r;for(e=ze,t=[],r=s();r!==N;)t.push(r),r=s();return t!==N&&(Je=e,t=M(t)),e=t}function s(){var e;return e=u(),e===N&&(e=p()),e}function l(){var t,r,n,o,a,i;if(t=ze,r=[],n=ze,o=F(),o!==N?(a=O(),a!==N?(i=F(),i!==N?(o=[o,a,i],n=o):(ze=n,n=E)):(ze=n,n=E)):(ze=n,n=E),n!==N)for(;n!==N;)r.push(n),n=ze,o=F(),o!==N?(a=O(),a!==N?(i=F(),i!==N?(o=[o,a,i],n=o):(ze=n,n=E)):(ze=n,n=E)):(ze=n,n=E);else r=E;return r!==N&&(Je=t,r=D(r)),t=r,t===N&&(t=ze,r=w(),r!==N&&(r=e.substring(t,ze)),t=r),t}function u(){var e,t;return e=ze,t=l(),t!==N&&(Je=e,t=L(t)),e=t}function c(){var t,r,o;if(t=P(),t===N){if(t=ze,r=[],I.test(e.charAt(ze))?(o=e.charAt(ze),ze++):(o=N,0===Ye&&n(S)),o!==N)for(;o!==N;)r.push(o),I.test(e.charAt(ze))?(o=e.charAt(ze),ze++):(o=N,0===Ye&&n(S));else r=E;r!==N&&(r=e.substring(t,ze)),t=r}return t}function p(){var t,r,o,a,i,s,l,u,p;return t=ze,123===e.charCodeAt(ze)?(r=q,ze++):(r=N,0===Ye&&n(U)),r!==N?(o=F(),o!==N?(a=c(),a!==N?(i=F(),i!==N?(s=ze,44===e.charCodeAt(ze)?(l=H,ze++):(l=N,0===Ye&&n(W)),l!==N?(u=F(),u!==N?(p=f(),p!==N?(l=[l,u,p],s=l):(ze=s,s=E)):(ze=s,s=E)):(ze=s,s=E),s===N&&(s=G),s!==N?(l=F(),l!==N?(125===e.charCodeAt(ze)?(u=V,ze++):(u=N,0===Ye&&n(Z)),u!==N?(Je=t,r=B(a,s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function f(){var e;return e=d(),e===N&&(e=h(),e===N&&(e=m(),e===N&&(e=y()))),e}function d(){var t,r,o,a,i,s,l;return t=ze,e.substr(ze,6)===z?(r=z,ze+=6):(r=N,0===Ye&&n(J)),r===N&&(e.substr(ze,4)===$?(r=$,ze+=4):(r=N,0===Ye&&n(K)),r===N&&(e.substr(ze,4)===Q?(r=Q,ze+=4):(r=N,0===Ye&&n(X)))),r!==N?(o=F(),o!==N?(a=ze,44===e.charCodeAt(ze)?(i=H,ze++):(i=N,0===Ye&&n(W)),i!==N?(s=F(),s!==N?(l=O(),l!==N?(i=[i,s,l],a=i):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E),a===N&&(a=G),a!==N?(Je=t,r=Y(r,a),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function h(){var t,r,o,a,i,s;return t=ze,e.substr(ze,6)===ee?(r=ee,ze+=6):(r=N,0===Ye&&n(te)),r!==N?(o=F(),o!==N?(44===e.charCodeAt(ze)?(a=H,ze++):(a=N,0===Ye&&n(W)),a!==N?(i=F(),i!==N?(s=_(),s!==N?(Je=t,r=re(s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function m(){var t,r,o,a,i,s;return t=ze,e.substr(ze,13)===ne?(r=ne,ze+=13):(r=N,0===Ye&&n(oe)),r!==N?(o=F(),o!==N?(44===e.charCodeAt(ze)?(a=H,ze++):(a=N,0===Ye&&n(W)),a!==N?(i=F(),i!==N?(s=_(),s!==N?(Je=t,r=ae(s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function y(){var t,r,o,a,i,s,l;if(t=ze,e.substr(ze,6)===ie?(r=ie,ze+=6):(r=N,0===Ye&&n(se)),r!==N)if(o=F(),o!==N)if(44===e.charCodeAt(ze)?(a=H,ze++):(a=N,0===Ye&&n(W)),a!==N)if(i=F(),i!==N){if(s=[],l=g(),l!==N)for(;l!==N;)s.push(l),l=g();else s=E;s!==N?(Je=t,r=le(s),t=r):(ze=t,t=E)}else ze=t,t=E;else ze=t,t=E;else ze=t,t=E;else ze=t,t=E;return t}function v(){var t,r,o,a;return t=ze,r=ze,61===e.charCodeAt(ze)?(o=ue,ze++):(o=N,0===Ye&&n(ce)),o!==N?(a=P(),a!==N?(o=[o,a],r=o):(ze=r,r=E)):(ze=r,r=E),r!==N&&(r=e.substring(t,ze)),t=r,t===N&&(t=O()),t}function g(){var t,r,o,a,s,l,u,c,p;return t=ze,r=F(),r!==N?(o=v(),o!==N?(a=F(),a!==N?(123===e.charCodeAt(ze)?(s=q,ze++):(s=N,0===Ye&&n(U)),s!==N?(l=F(),l!==N?(u=i(),u!==N?(c=F(),c!==N?(125===e.charCodeAt(ze)?(p=V,ze++):(p=N,0===Ye&&n(Z)),p!==N?(Je=t,r=pe(o,u),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function b(){var t,r,o,a;return t=ze,e.substr(ze,7)===fe?(r=fe,ze+=7):(r=N,0===Ye&&n(de)),r!==N?(o=F(),o!==N?(a=P(),a!==N?(Je=t,r=he(a),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function _(){var e,t,r,n,o;if(e=ze,t=b(),t===N&&(t=G),t!==N)if(r=F(),r!==N){if(n=[],o=g(),o!==N)for(;o!==N;)n.push(o),o=g();else n=E;n!==N?(Je=e,t=me(t,n),e=t):(ze=e,e=E)}else ze=e,e=E;else ze=e,e=E;return e}function w(){var t,r;if(Ye++,t=[],ve.test(e.charAt(ze))?(r=e.charAt(ze),ze++):(r=N,0===Ye&&n(ge)),r!==N)for(;r!==N;)t.push(r),ve.test(e.charAt(ze))?(r=e.charAt(ze),ze++):(r=N,0===Ye&&n(ge));else t=E;return Ye--,t===N&&(r=N,0===Ye&&n(ye)),t}function F(){var t,r,o;for(Ye++,t=ze,r=[],o=w();o!==N;)r.push(o),o=w();return r!==N&&(r=e.substring(t,ze)),t=r,Ye--,t===N&&(r=N,0===Ye&&n(be)),t}function T(){var t;return _e.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(we)),t}function C(){var t;return Fe.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(Te)),t}function P(){var t,r,o,a,i,s;if(t=ze,48===e.charCodeAt(ze)?(r=Ce,ze++):(r=N,0===Ye&&n(Pe)),r===N){if(r=ze,o=ze,xe.test(e.charAt(ze))?(a=e.charAt(ze),ze++):(a=N,0===Ye&&n(Oe)),a!==N){for(i=[],s=T();s!==N;)i.push(s),s=T();i!==N?(a=[a,i],o=a):(ze=o,o=E)}else ze=o,o=E;o!==N&&(o=e.substring(r,ze)),r=o}return r!==N&&(Je=t,r=Re(r)),t=r}function x(){var t,r,o,a,i,s,l,u;return je.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(Ne)),t===N&&(t=ze,e.substr(ze,2)===Ae?(r=Ae,ze+=2):(r=N,0===Ye&&n(ke)),r!==N&&(Je=t,r=Me()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ee?(r=Ee,ze+=2):(r=N,0===Ye&&n(De)),r!==N&&(Je=t,r=Le()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ie?(r=Ie,ze+=2):(r=N,0===Ye&&n(Se)),r!==N&&(Je=t,r=qe()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ue?(r=Ue,ze+=2):(r=N,0===Ye&&n(Ge)),r!==N&&(Je=t,r=He()),t=r,t===N&&(t=ze,e.substr(ze,2)===We?(r=We,ze+=2):(r=N,0===Ye&&n(Ve)),r!==N?(o=ze,a=ze,i=C(),i!==N?(s=C(),s!==N?(l=C(),l!==N?(u=C(),u!==N?(i=[i,s,l,u],a=i):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E),a!==N&&(a=e.substring(o,ze)),o=a,o!==N?(Je=t,r=Ze(o),t=r):(ze=t,t=E)):(ze=t,t=E)))))),t}function O(){var e,t,r;if(e=ze,t=[],r=x(),r!==N)for(;r!==N;)t.push(r),r=x();else t=E;return t!==N&&(Je=e,t=Be(t)),e=t}var R,j=arguments.length>1?arguments[1]:{},N={},A={start:a},k=a,M=function(e){return{type:"messageFormatPattern",elements:e}},E=N,D=function(e){var t,r,n,o,a,i="";for(t=0,n=e.length;n>t;t+=1)for(o=e[t],r=0,a=o.length;a>r;r+=1)i+=o[r];return i},L=function(e){return{type:"messageTextElement",value:e}},I=/^[^ \t\n\r,.+={}#]/,S={type:"class",value:"[^ \\t\\n\\r,.+={}#]",description:"[^ \\t\\n\\r,.+={}#]"},q="{",U={type:"literal",value:"{",description:'"{"'},G=null,H=",",W={type:"literal",value:",",description:'","'},V="}",Z={type:"literal",value:"}",description:'"}"'},B=function(e,t){return{type:"argumentElement",id:e,format:t&&t[2]}},z="number",J={type:"literal",value:"number",description:'"number"'},$="date",K={type:"literal",value:"date",description:'"date"'},Q="time",X={type:"literal",value:"time",description:'"time"'},Y=function(e,t){return{type:e+"Format",style:t&&t[2]}},ee="plural",te={type:"literal",value:"plural",description:'"plural"'},re=function(e){return{type:e.type,ordinal:!1,offset:e.offset||0,options:e.options}},ne="selectordinal",oe={type:"literal",value:"selectordinal",description:'"selectordinal"'},ae=function(e){return{type:e.type,ordinal:!0,offset:e.offset||0,options:e.options}},ie="select",se={type:"literal",value:"select",description:'"select"'},le=function(e){return{type:"selectFormat",options:e}},ue="=",ce={type:"literal",value:"=",description:'"="'},pe=function(e,t){return{type:"optionalFormatPattern",selector:e,value:t}},fe="offset:",de={type:"literal",value:"offset:",description:'"offset:"'},he=function(e){return e},me=function(e,t){return{type:"pluralFormat",offset:e,options:t}},ye={type:"other",description:"whitespace"},ve=/^[ \t\n\r]/,ge={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},be={type:"other",description:"optionalWhitespace"},_e=/^[0-9]/,we={type:"class",value:"[0-9]",description:"[0-9]"},Fe=/^[0-9a-f]/i,Te={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},Ce="0",Pe={type:"literal",value:"0",description:'"0"'},xe=/^[1-9]/,Oe={type:"class",value:"[1-9]",description:"[1-9]"},Re=function(e){return parseInt(e,10)},je=/^[^{}\\\0-\x1F \t\n\r]/,Ne={type:"class",value:"[^{}\\\\\\0-\\x1F \\t\\n\\r]",description:"[^{}\\\\\\0-\\x1F \\t\\n\\r]"},Ae="\\\\",ke={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},Me=function(){return"\\"},Ee="\\#",De={type:"literal",value:"\\#",description:'"\\\\#"'},Le=function(){return"\\#"},Ie="\\{",Se={type:"literal",value:"\\{",description:'"\\\\{"'},qe=function(){return"{"},Ue="\\}",Ge={type:"literal",value:"\\}",description:'"\\\\}"'},He=function(){return"}"},We="\\u",Ve={type:"literal",value:"\\u",description:'"\\\\u"'},Ze=function(e){return String.fromCharCode(parseInt(e,16))},Be=function(e){return e.join("")},ze=0,Je=0,$e=0,Ke={line:1,column:1,seenCR:!1},Qe=0,Xe=[],Ye=0;if("startRule"in j){if(!(j.startRule in A))throw new Error("Can't start parsing from rule \""+j.startRule+'".');k=A[j.startRule]}if(R=k(),R!==N&&ze===e.length)return R;throw R!==N&&ze<e.length&&n({type:"end",description:"end of input"}),o(null,Xe,Qe)}return e(t,Error),{SyntaxError:t,parse:r}}();V(u,"formats",{enumerable:!0,value:{number:{currency:{style:"currency"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}}),V(u,"__localeData__",{value:Z(null)}),V(u,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlMessageFormat is missing a `locale` property");u.__localeData__[e.locale.toLowerCase()]=e}}),V(u,"__parse",{value:B.parse}),V(u,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),u.prototype.resolvedOptions=function(){return{locale:this._locale}},u.prototype._compilePattern=function(e,t,r,n){var a=new o(t,r,n);return a.compile(e)},u.prototype._findPluralRuleFunction=function(e){for(var t=u.__localeData__,r=t[e.toLowerCase()];r;){if(r.pluralRuleFunction)return r.pluralRuleFunction;r=r.parentLocale&&t[r.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlMessageFormat is missing a `pluralRuleFunction` for :"+e)},u.prototype._format=function(e,t){var r,n,o,a,i,s="";for(r=0,n=e.length;n>r;r+=1)if(o=e[r],"string"!=typeof o){if(a=o.id,!t||!H.call(t,a))throw new Error("A value must be provided for: "+a);i=t[a],s+=o.options?this._format(o.getOption(i),t):o.format(i)}else s+=o;return s},u.prototype._mergeFormats=function(e,t){var r,o,a={};for(r in e)H.call(e,r)&&(a[r]=o=Z(e[r]),t&&H.call(t,r)&&n(o,t[r]));return a},u.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(u.defaultLocale);var t,r,n,o,a=u.__localeData__;for(t=0,r=e.length;r>t;t+=1)for(n=e[t].toLowerCase().split("-");n.length;){if(o=a[n.join("-")])return o.locale;n.pop()}var i=e.pop();throw new Error("No locale data has been added to IntlMessageFormat for: "+e.join(", ")+", or the default locale: "+i)};var z={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"}};u.__addLocaleData(z),u.defaultLocale="en";var J=Math.round,$=Object.prototype.hasOwnProperty,K=Object.prototype.toString,Q=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),X=(!Q&&!Object.prototype.__defineGetter__,Q?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!$.call(e,t)||"value"in r)&&(e[t]=r.value)}),Y=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)$.call(t,o)&&X(n,o,t[o]);return n},ee=Array.prototype.indexOf||function(e,t){var r=this;if(!r.length)return-1;for(var n=t||0,o=r.length;o>n;n++)if(r[n]===e)return n;return-1},te=Array.isArray||function(e){return"[object Array]"===K.call(e)},re=Date.now||function(){return(new Date).getTime()},ne=["second","minute","hour","day","month","year"],oe=["best fit","numeric"];X(f,"__localeData__",{value:Y(null)}),X(f,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlRelativeFormat is missing a `locale` property value");f.__localeData__[e.locale.toLowerCase()]=e,u.__addLocaleData(e)}}),X(f,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),X(f,"thresholds",{enumerable:!0,value:{second:45,minute:45,hour:22,day:26,month:11}}),f.prototype.resolvedOptions=function(){return{locale:this._locale,style:this._options.style,units:this._options.units}},f.prototype._compileMessage=function(e){var t,r=this._locales,n=(this._locale,this._fields[e]),o=n.relativeTime,a="",i="";for(t in o.future)o.future.hasOwnProperty(t)&&(a+=" "+t+" {"+o.future[t].replace("{0}","#")+"}");for(t in o.past)o.past.hasOwnProperty(t)&&(i+=" "+t+" {"+o.past[t].replace("{0}","#")+"}");var s="{when, select, future {{0, plural, "+a+"}}past {{0, plural, "+i+"}}}";return new u(s,r)},f.prototype._getMessage=function(e){var t=this._messages;return t[e]||(t[e]=this._compileMessage(e)),t[e]},f.prototype._getRelativeUnits=function(e,t){var r=this._fields[t];return r.relative?r.relative[e]:void 0},f.prototype._findFields=function(e){for(var t=f.__localeData__,r=t[e.toLowerCase()];r;){if(r.fields)return r.fields;r=r.parentLocale&&t[r.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlRelativeFormat is missing `fields` for :"+e)},f.prototype._format=function(e,t){var r=t&&void 0!==t.now?t.now:re();if(void 0===e&&(e=r),!isFinite(r))throw new RangeError("The `now` option provided to IntlRelativeFormat#format() is not in valid range.");if(!isFinite(e))throw new RangeError("The date value provided to IntlRelativeFormat#format() is not in valid range.");var n=p(r,e),o=this._options.units||this._selectUnits(n),a=n[o];if("numeric"!==this._options.style){var i=this._getRelativeUnits(a,o);if(i)return i}return this._getMessage(o).format({0:Math.abs(a),when:0>a?"past":"future"})},f.prototype._isValidUnits=function(e){if(!e||ee.call(ne,e)>=0)return!0;if("string"==typeof e){var t=/s$/.test(e)&&e.substr(0,e.length-1);if(t&&ee.call(ne,t)>=0)throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, did you mean: '+t)}throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, it must be one of: "'+ne.join('", "')+'"')},f.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(f.defaultLocale);var t,r,n,o,a=f.__localeData__;for(t=0,r=e.length;r>t;t+=1)for(n=e[t].toLowerCase().split("-");n.length;){if(o=a[n.join("-")])return o.locale;n.pop()}var i=e.pop();throw new Error("No locale data has been added to IntlRelativeFormat for: "+e.join(", ")+", or the default locale: "+i)},f.prototype._resolveStyle=function(e){if(!e)return oe[0];if(ee.call(oe,e)>=0)return e;throw new Error('"'+e+'" is not a valid IntlRelativeFormat `style` value, it must be one of: "'+oe.join('", "')+'"')},f.prototype._selectUnits=function(e){var t,r,n;for(t=0,r=ne.length;r>t&&(n=ne[t],!(Math.abs(e[n])<f.thresholds[n]));t+=1);return n};var ae={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}};f.__addLocaleData(ae),f.defaultLocale="en";var ie=t.PropTypes.bool,se=t.PropTypes.number,le=t.PropTypes.string,ue=t.PropTypes.func,ce=t.PropTypes.object,pe=t.PropTypes.oneOf,fe=t.PropTypes.shape,de={locale:le,formats:ce,messages:ce,defaultLocale:le,defaultFormats:ce},he={formatDate:ue.isRequired,formatTime:ue.isRequired,formatRelative:ue.isRequired,formatNumber:ue.isRequired,formatPlural:ue.isRequired,formatMessage:ue.isRequired,formatHTMLMessage:ue.isRequired},me=fe(U["extends"]({},de,he,{now:ue.isRequired})),ye={id:le.isRequired,description:le,defaultMessage:le},ve={localeMatcher:pe(["best fit","lookup"]),formatMatcher:pe(["basic","best fit"]),timeZone:le,hour12:ie,weekday:pe(["narrow","short","long"]),era:pe(["narrow","short","long"]),year:pe(["numeric","2-digit"]),month:pe(["numeric","2-digit","narrow","short","long"]),day:pe(["numeric","2-digit"]),hour:pe(["numeric","2-digit"]),minute:pe(["numeric","2-digit"]),second:pe(["numeric","2-digit"]),timeZoneName:pe(["short","long"])},ge={localeMatcher:pe(["best fit","lookup"]),style:pe(["decimal","currency","percent"]),currency:le,currencyDisplay:pe(["symbol","code","name"]),useGrouping:ie,minimumIntegerDigits:se,minimumFractionDigits:se,maximumFractionDigits:se,minimumSignificantDigits:se,maximumSignificantDigits:se},be={style:pe(["best fit","numeric"]),units:pe(["second","minute","hour","day","month","year"])},_e={style:pe(["cardinal","ordinal"])},we=r(function(e){var t="production",r=function(e,r,n,o,a,i,s,l){if("production"!==t&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{ | ||
var c=[n,o,a,i,s,l],p=0;u=new Error(r.replace(/%s/g,function(){return c[p++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r}),Fe=we&&"object"==typeof we&&"default"in we?we["default"]:we,Te=Object.keys(de),Ce={"&":"&",">":">","<":"<",'"':""","'":"'"},Pe=/[&><"']/g,xe=function Ye(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];U.classCallCheck(this,Ye);var r="ordinal"===t.style,n=P(C(e));this.format=function(e){return n(e,r)}},Oe=Function.prototype.bind||function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),r=this,n=function(){},o=function(){return r.apply(this instanceof n?this:e,t.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(n.prototype=this.prototype),o.prototype=new n,o},Re=Object.prototype.hasOwnProperty,je=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),Ne=(!je&&!Object.prototype.__defineGetter__,je?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!Re.call(e,t)||"value"in r)&&(e[t]=r.value)}),Ae=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)Re.call(t,o)&&Ne(n,o,t[o]);return n},ke=Object.keys(ve),Me=Object.keys(ge),Ee=Object.keys(be),De=Object.keys(_e),Le=Object.freeze({formatDate:N,formatTime:A,formatRelative:k,formatNumber:M,formatPlural:E,formatMessage:D,formatHTMLMessage:L}),Ie=Object.keys(de),Se=Object.keys(he),qe={formats:{},messages:{},defaultLocale:"en",defaultFormats:{}},Ue=function(e){function r(e,t){U.classCallCheck(this,r);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));Fe("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=void 0;return o=isFinite(e.initialNow)?Number(e.initialNow):t.intl?t.intl.now():Date.now(),n.state={getDateTimeFormat:x(Intl.DateTimeFormat),getNumberFormat:x(Intl.NumberFormat),getMessageFormat:x(u),getRelativeFormat:x(f),getPluralFormat:x(xe),now:function(){return n._didDisplay?Date.now():o}},n}return U.inherits(r,e),U.createClass(r,[{key:"getConfig",value:function(){var e=this.context.intl,t=void 0===e?{}:e,r=U["extends"]({},qe,v(this.props,Ie,t));if(!h(r.locale)){var n=r,o=(n.locale,n.defaultLocale),a=n.defaultFormats;r=U["extends"]({},r,{locale:o,formats:a,messages:qe.messages})}return r}},{key:"getBoundFormatFns",value:function(e,t){return Se.reduce(function(r,n){return r[n]=Le[n].bind(null,e,t),r},{})}},{key:"getChildContext",value:function(){var e=this.getConfig(),t=this.getBoundFormatFns(e,this.state);return{intl:U["extends"]({},e,t,{now:this.state.now})}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"componentDidMount",value:function(){this._didDisplay=!0}},{key:"render",value:function(){return t.Children.only(this.props.children)}}]),r}(t.Component);Ue.displayName="IntlProvider",Ue.contextTypes={intl:me},Ue.childContextTypes={intl:me.isRequired},Ue.propTypes=U["extends"]({},de,{children:t.PropTypes.element.isRequired,initialNow:t.PropTypes.any});var Ge=function(e){function t(e,r){U.classCallCheck(this,t);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return U.inherits(t,e),U.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatDate,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):q.createElement("span",null,o)}}]),t}(t.Component);Ge.displayName="FormattedDate",Ge.contextTypes={intl:me},Ge.propTypes=U["extends"]({},ve,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var He=function(e){function t(e,r){U.classCallCheck(this,t);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return U.inherits(t,e),U.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatTime,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):q.createElement("span",null,o)}}]),t}(t.Component);He.displayName="FormattedTime",He.contextTypes={intl:me},He.propTypes=U["extends"]({},ve,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var We=1e3,Ve=6e4,Ze=36e5,Be=864e5,ze=2147483647,Je=function(e){function t(e,r){U.classCallCheck(this,t);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));g(r);var o=isFinite(e.initialNow)?Number(e.initialNow):r.intl.now();return n.state={now:o},n}return U.inherits(t,e),U.createClass(t,[{key:"scheduleNextUpdate",value:function(e,t){var r=this,n=e.updateInterval;if(n){var o=new Date(e.value).getTime(),a=o-t.now,i=e.units||I(a),s=S(i),l=Math.abs(a%s),u=0>a?Math.max(n,s-l):Math.max(n,l);clearTimeout(this._timer),this._timer=setTimeout(function(){r.setState({now:r.context.intl.now()})},u)}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"componentWillUpdate",value:function(e,t){this.scheduleNextUpdate(e,t)}},{key:"componentDidMount",value:function(){this.scheduleNextUpdate(this.props,this.state)}},{key:"componentWillUnmount",value:function(){clearTimeout(this._timer)}},{key:"render",value:function(){var e=this.context.intl.formatRelative,t=this.props,r=t.value,n=t.children,o=e(r,U["extends"]({},this.props,this.state));return"function"==typeof n?n(o):q.createElement("span",null,o)}}]),t}(t.Component);Je.displayName="FormattedRelative",Je.contextTypes={intl:me},Je.propTypes=U["extends"]({},be,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,updateInterval:t.PropTypes.number,initialNow:t.PropTypes.any,children:t.PropTypes.func}),Je.defaultProps={updateInterval:1e4};var $e=function(e){function t(e,r){U.classCallCheck(this,t);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return U.inherits(t,e),U.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatNumber,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):q.createElement("span",null,o)}}]),t}(t.Component);$e.displayName="FormattedNumber",$e.contextTypes={intl:me},$e.propTypes=U["extends"]({},ge,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var Ke=function(e){function t(e,r){U.classCallCheck(this,t);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return U.inherits(t,e),U.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatPlural,t=this.props,r=t.value,n=t.other,o=t.children,a=e(r,this.props),i=this.props[a]||n;return"function"==typeof o?o(i):q.createElement("span",null,i)}}]),t}(t.Component);Ke.displayName="FormattedPlural",Ke.contextTypes={intl:me},Ke.propTypes=U["extends"]({},_e,{value:t.PropTypes.any.isRequired,other:t.PropTypes.node.isRequired,zero:t.PropTypes.node,one:t.PropTypes.node,two:t.PropTypes.node,few:t.PropTypes.node,many:t.PropTypes.node,children:t.PropTypes.func}),Ke.defaultProps={style:"cardinal"};var Qe=function(e){function r(e,t){U.classCallCheck(this,r);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return U.inherits(r,e),U.createClass(r,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values,r=e.values;if(!b(r,t))return!0;for(var n=U["extends"]({},e,{values:t}),o=arguments.length,a=Array(o>1?o-1:0),i=1;o>i;i++)a[i-1]=arguments[i];return _.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl.formatMessage,r=this.props,n=r.id,o=r.description,a=r.defaultMessage,i=r.values,s=r.tagName,l=r.children,u=void 0,c=void 0,p=void 0,f=i&&Object.keys(i).length>0;f&&!function(){var e=Math.floor(1099511627776*Math.random()).toString(16),r=function(){var t=0;return function(){return"@__ELEMENT-"+e+"-"+(t+=1)+"__@"}}();u=new RegExp("(@__ELEMENT-"+e+"-\\d+__@)","g"),c={},p={},Object.keys(i).forEach(function(e){var n=i[e];if(t.isValidElement(n)){var o=r();c[e]=o,p[o]=n}else c[e]=n})}();var d={id:n,description:o,defaultMessage:a},h=e(d,c||i),m=void 0,y=p&&Object.keys(p).length>0;return m=y?h.split(u).filter(function(e){return!!e}).map(function(e){return p[e]||e}):[h],"function"==typeof l?l.apply(void 0,U.toConsumableArray(m)):t.createElement.apply(void 0,[s,null].concat(U.toConsumableArray(m)))}}]),r}(t.Component);Qe.displayName="FormattedMessage",Qe.contextTypes={intl:me},Qe.propTypes=U["extends"]({},ye,{values:t.PropTypes.object,tagName:t.PropTypes.string,children:t.PropTypes.func}),Qe.defaultProps={values:{},tagName:"span"};var Xe=function(e){function r(e,t){U.classCallCheck(this,r);var n=U.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return U.inherits(r,e),U.createClass(r,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values,r=e.values;if(!b(r,t))return!0;for(var n=U["extends"]({},e,{values:t}),o=arguments.length,a=Array(o>1?o-1:0),i=1;o>i;i++)a[i-1]=arguments[i];return _.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl.formatHTMLMessage,r=this.props,n=r.id,o=r.description,a=r.defaultMessage,i=r.values,s=r.tagName,l=r.children,u={id:n,description:o,defaultMessage:a},c=e(u,i);return"function"==typeof l?l(c):t.createElement(s,{dangerouslySetInnerHTML:{__html:c}})}}]),r}(t.Component);Xe.displayName="FormattedHTMLMessage",Xe.contextTypes={intl:me},Xe.propTypes=U["extends"]({},ye,{values:t.PropTypes.object,tagName:t.PropTypes.string,children:t.PropTypes.func}),Xe.defaultProps={values:{},tagName:"span"},d(G),e.addLocaleData=d,e.intlShape=me,e.injectIntl=F,e.defineMessages=T,e.IntlProvider=Ue,e.FormattedDate=Ge,e.FormattedTime=He,e.FormattedRelative=Je,e.FormattedNumber=$e,e.FormattedPlural=Ke,e.FormattedMessage=Qe,e.FormattedHTMLMessage=Xe}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t(e.ReactIntl=e.ReactIntl||{},e.React)}(this,function(e,t){"use strict";function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}function n(e){var t,r,n,o,a=Array.prototype.slice.call(arguments,1);for(t=0,r=a.length;r>t;t+=1)if(n=a[t])for(o in n)H.call(n,o)&&(e[o]=n[o]);return e}function o(e,t,r){this.locales=e,this.formats=t,this.pluralFn=r}function a(e){this.id=e}function i(e,t,r,n,o){this.id=e,this.useOrdinal=t,this.offset=r,this.options=n,this.pluralFn=o}function s(e,t,r,n){this.id=e,this.offset=t,this.numberFormat=r,this.string=n}function l(e,t){this.id=e,this.options=t}function u(e,t,r){var n="string"==typeof e?u.__parse(e):e;if(!n||"messageFormatPattern"!==n.type)throw new TypeError("A message must be provided as a String or AST.");r=this._mergeFormats(u.formats,r),Z(this,"_locale",{value:this._resolveLocale(t)});var o=this._findPluralRuleFunction(this._locale),a=this._compilePattern(n,t,r,o),i=this;this.format=function(e){return i._format(a,e)}}function c(e){return 400*e/146097}function p(e,t){e=+e,t=+t;var r=$(t-e),n=$(r/1e3),o=$(n/60),a=$(o/60),i=$(a/24),s=$(i/7),l=c(i),u=$(12*l),p=$(l);return{millisecond:r,second:n,minute:o,hour:a,day:i,week:s,month:u,year:p}}function f(e,t){t=t||{},re(e)&&(e=e.concat()),Y(this,"_locale",{value:this._resolveLocale(e)}),Y(this,"_options",{value:{style:this._resolveStyle(t.style),units:this._isValidUnits(t.units)&&t.units}}),Y(this,"_locales",{value:e}),Y(this,"_fields",{value:this._findFields(this._locale)}),Y(this,"_messages",{value:ee(null)});var r=this;this.format=function(e,t){return r._format(e,t)}}function d(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=Array.isArray(e)?e:[e];t.forEach(function(e){e&&e.locale&&(u.__addLocaleData(e),f.__addLocaleData(e))})}function h(e){for(var t=(e||"").split("-");t.length>0;){if(m(t.join("-")))return!0;t.pop()}return!1}function m(e){var t=e&&e.toLowerCase();return!(!u.__localeData__[t]||!f.__localeData__[t])}function y(e){return(""+e).replace(xe,function(e){return Ce[e]})}function v(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return t.reduce(function(t,n){return e.hasOwnProperty(n)?t[n]=e[n]:r.hasOwnProperty(n)&&(t[n]=r[n]),t},{})}function g(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.intl;Te(t,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}function b(e,t){if(e===t)return!0;if("object"!==("undefined"==typeof e?"undefined":G["typeof"](e))||null===e||"object"!==("undefined"==typeof t?"undefined":G["typeof"](t))||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),a=0;a<r.length;a++)if(!o(r[a])||e[r[a]]!==t[r[a]])return!1;return!0}function _(e,t,r){var n=e.props,o=e.state,a=e.context,i=void 0===a?{}:a,s=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],l=i.intl,u=void 0===l?{}:l,c=s.intl,p=void 0===c?{}:c;return!b(t,n)||!b(r,o)||!(p===u||b(v(p,Pe),v(u,Pe)))}function w(e){return e.displayName||e.name||"Component"}function F(e){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?!1:a,s=function(t){function r(e,t){G.classCallCheck(this,r);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return G.inherits(r,t),G.createClass(r,[{key:"getWrappedInstance",value:function(){return Te(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(e,G["extends"]({},this.props,G.defineProperty({},o,this.context.intl),{ref:i?"wrappedInstance":null}))}}]),r}(t.Component);return s.displayName="InjectIntl("+w(e)+")",s.contextTypes={intl:ye},s.WrappedComponent=e,s}function T(e){return e}function P(e){return u.prototype._resolveLocale(e)}function C(e){return u.prototype._findPluralRuleFunction(e)}function x(e){var t=ke(null);return function(){var r=Array.prototype.slice.call(arguments),n=O(r),o=n&&t[n];return o||(o=new(je.apply(e,[null].concat(r))),n&&(t[n]=o)),o}}function O(e){if("undefined"!=typeof JSON){var t,r,n,o=[];for(t=0,r=e.length;r>t;t+=1)n=e[t],n&&"object"===("undefined"==typeof n?"undefined":G["typeof"](n))?o.push(j(n)):o.push(n);return JSON.stringify(o)}}function j(e){var t,r,n,o,a=[],i=[];for(t in e)e.hasOwnProperty(t)&&i.push(t);var s=i.sort();for(r=0,n=s.length;n>r;r+=1)t=s[r],o={},o[t]=e[t],a[r]=o;return a}function R(e){var t=f.thresholds;t.second=e.second,t.minute=e.minute,t.hour=e.hour,t.day=e.day,t.month=e.month}function N(e,t,r){var n=e&&e[t]&&e[t][r];return n?n:void 0}function A(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=i&&N(a,"date",i),u=v(n,Me,l);try{return t.getDateTimeFormat(o,u).format(s)}catch(c){}return String(s)}function k(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=i&&N(a,"time",i),u=v(n,Me,l);0===Object.keys(u).length&&(u={hour:"numeric",minute:"numeric"});try{return t.getDateTimeFormat(o,u).format(s)}catch(c){}return String(s)}function M(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=new Date(r),l=new Date(n.now),u=i&&N(a,"relative",i),c=v(n,De,u),p=G["extends"]({},f.thresholds);R(Ie);try{return t.getRelativeFormat(o,c).format(s,{now:isFinite(l)?l:t.now()})}catch(d){}finally{R(p)}return String(s)}function E(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=n.format,s=i&&N(a,"number",i),l=v(n,Ee,s);try{return t.getNumberFormat(o,l).format(r)}catch(u){}return String(r)}function D(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=v(n,Le);try{return t.getPluralFormat(o,a).format(r)}catch(i){}return"other"}function L(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=e.locale,a=e.formats,i=e.messages,s=e.defaultLocale,l=e.defaultFormats,u=r.id,c=r.defaultMessage;Te(u,"[React Intl] An `id` must be provided to format a message.");var p=i&&i[u],f=Object.keys(n).length>0;if(!f)return p||c||u;var d=void 0;if(p)try{var h=t.getMessageFormat(p,o,a);d=h.format(n)}catch(m){}if(!d&&c)try{var y=t.getMessageFormat(c,s,l);d=y.format(n)}catch(m){}return d||p||c||u}function I(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],o=Object.keys(n).reduce(function(e,t){var r=n[t];return e[t]="string"==typeof r?y(r):r,e},{});return L(e,t,r,o)}function S(e){var t=Math.abs(e);return Be>t?"second":ze>t?"minute":Je>t?"hour":"day"}function q(e){switch(e){case"second":return Ze;case"minute":return Be;case"hour":return ze;case"day":return Je;default:return $e}}var U="default"in t?t["default"]:t,G={};G["typeof"]="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},G.classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},G.createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),G.defineProperty=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},G["extends"]=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},G.inherits=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},G.objectWithoutProperties=function(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},G.possibleConstructorReturn=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},G.toConsumableArray=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)};var W={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}},H=Object.prototype.hasOwnProperty,V=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),Z=(!V&&!Object.prototype.__defineGetter__,V?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!H.call(e,t)||"value"in r)&&(e[t]=r.value)}),B=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)H.call(t,o)&&Z(n,o,t[o]);return n};o.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},o.prototype.compileMessage=function(e){if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var t,r,n,o=e.elements,a=[];for(t=0,r=o.length;r>t;t+=1)switch(n=o[t],n.type){case"messageTextElement":a.push(this.compileMessageText(n));break;case"argumentElement":a.push(this.compileArgument(n));break;default:throw new Error("Message element does not have a valid type")}return a},o.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new s(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},o.prototype.compileArgument=function(e){var t=e.format;if(!t)return new a(e.id);var r,n=this.formats,o=this.locales,s=this.pluralFn;switch(t.type){case"numberFormat":return r=n.number[t.style],{id:e.id,format:new Intl.NumberFormat(o,r).format};case"dateFormat":return r=n.date[t.style],{id:e.id,format:new Intl.DateTimeFormat(o,r).format};case"timeFormat":return r=n.time[t.style],{id:e.id,format:new Intl.DateTimeFormat(o,r).format};case"pluralFormat":return r=this.compileOptions(e),new i(e.id,t.ordinal,t.offset,r,s);case"selectFormat":return r=this.compileOptions(e),new l(e.id,r);default:throw new Error("Message element does not have a valid format type")}},o.prototype.compileOptions=function(e){var t=e.format,r=t.options,n={};this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===t.type?e:null;var o,a,i;for(o=0,a=r.length;a>o;o+=1)i=r[o],n[i.selector]=this.compileMessage(i.value);return this.currentPlural=this.pluralStack.pop(),n},a.prototype.format=function(e){return e?"string"==typeof e?e:String(e):""},i.prototype.getOption=function(e){var t=this.options,r=t["="+e]||t[this.pluralFn(e-this.offset,this.useOrdinal)];return r||t.other},s.prototype.format=function(e){var t=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+t).replace(/\\#/g,"#")},l.prototype.getOption=function(e){var t=this.options;return t[e]||t.other};var z=function(){function e(e,t){function r(){this.constructor=e}r.prototype=t.prototype,e.prototype=new r}function t(e,t,r,n,o,a){this.message=e,this.expected=t,this.found=r,this.offset=n,this.line=o,this.column=a,this.name="SyntaxError"}function r(e){function r(t){function r(t,r,n){var o,a;for(o=r;n>o;o++)a=e.charAt(o),"\n"===a?(t.seenCR||t.line++,t.column=1,t.seenCR=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(t.line++,t.column=1,t.seenCR=!0):(t.column++,t.seenCR=!1)}return $e!==t&&($e>t&&($e=0,Ke={line:1,column:1,seenCR:!1}),r(Ke,$e,t),$e=t),Ke}function n(e){Qe>ze||(ze>Qe&&(Qe=ze,Xe=[]),Xe.push(e))}function o(n,o,a){function i(e){var t=1;for(e.sort(function(e,t){return e.description<t.description?-1:e.description>t.description?1:0});t<e.length;)e[t-1]===e[t]?e.splice(t,1):t++}function s(e,t){function r(e){function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+t(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+t(e)}).replace(/[\u0180-\u0FFF]/g,function(e){return"\\u0"+t(e)}).replace(/[\u1080-\uFFFF]/g,function(e){return"\\u"+t(e)})}var n,o,a,i=new Array(e.length);for(a=0;a<e.length;a++)i[a]=e[a].description;return n=e.length>1?i.slice(0,-1).join(", ")+" or "+i[e.length-1]:i[0],o=t?'"'+r(t)+'"':"end of input","Expected "+n+" but "+o+" found."}var l=r(a),u=a<e.length?e.charAt(a):null;return null!==o&&i(o),new t(null!==n?n:s(o,u),o,u,a,l.line,l.column)}function a(){var e;return e=i()}function i(){var e,t,r;for(e=ze,t=[],r=s();r!==N;)t.push(r),r=s();return t!==N&&(Je=e,t=M(t)),e=t}function s(){var e;return e=u(),e===N&&(e=p()),e}function l(){var t,r,n,o,a,i;if(t=ze,r=[],n=ze,o=F(),o!==N?(a=O(),a!==N?(i=F(),i!==N?(o=[o,a,i],n=o):(ze=n,n=E)):(ze=n,n=E)):(ze=n,n=E),n!==N)for(;n!==N;)r.push(n),n=ze,o=F(),o!==N?(a=O(),a!==N?(i=F(),i!==N?(o=[o,a,i],n=o):(ze=n,n=E)):(ze=n,n=E)):(ze=n,n=E);else r=E;return r!==N&&(Je=t,r=D(r)),t=r,t===N&&(t=ze,r=w(),r!==N&&(r=e.substring(t,ze)),t=r),t}function u(){var e,t;return e=ze,t=l(),t!==N&&(Je=e,t=L(t)),e=t}function c(){var t,r,o;if(t=C(),t===N){if(t=ze,r=[],I.test(e.charAt(ze))?(o=e.charAt(ze),ze++):(o=N,0===Ye&&n(S)),o!==N)for(;o!==N;)r.push(o),I.test(e.charAt(ze))?(o=e.charAt(ze),ze++):(o=N,0===Ye&&n(S));else r=E;r!==N&&(r=e.substring(t,ze)),t=r}return t}function p(){var t,r,o,a,i,s,l,u,p;return t=ze,123===e.charCodeAt(ze)?(r=q,ze++):(r=N,0===Ye&&n(U)),r!==N?(o=F(),o!==N?(a=c(),a!==N?(i=F(),i!==N?(s=ze,44===e.charCodeAt(ze)?(l=W,ze++):(l=N,0===Ye&&n(H)),l!==N?(u=F(),u!==N?(p=f(),p!==N?(l=[l,u,p],s=l):(ze=s,s=E)):(ze=s,s=E)):(ze=s,s=E),s===N&&(s=G),s!==N?(l=F(),l!==N?(125===e.charCodeAt(ze)?(u=V,ze++):(u=N,0===Ye&&n(Z)),u!==N?(Je=t,r=B(a,s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function f(){var e;return e=d(),e===N&&(e=h(),e===N&&(e=m(),e===N&&(e=y()))),e}function d(){var t,r,o,a,i,s,l;return t=ze,e.substr(ze,6)===z?(r=z,ze+=6):(r=N,0===Ye&&n(J)),r===N&&(e.substr(ze,4)===$?(r=$,ze+=4):(r=N,0===Ye&&n(K)),r===N&&(e.substr(ze,4)===Q?(r=Q,ze+=4):(r=N,0===Ye&&n(X)))),r!==N?(o=F(),o!==N?(a=ze,44===e.charCodeAt(ze)?(i=W,ze++):(i=N,0===Ye&&n(H)),i!==N?(s=F(),s!==N?(l=O(),l!==N?(i=[i,s,l],a=i):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E),a===N&&(a=G),a!==N?(Je=t,r=Y(r,a),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function h(){var t,r,o,a,i,s;return t=ze,e.substr(ze,6)===ee?(r=ee,ze+=6):(r=N,0===Ye&&n(te)),r!==N?(o=F(),o!==N?(44===e.charCodeAt(ze)?(a=W,ze++):(a=N,0===Ye&&n(H)),a!==N?(i=F(),i!==N?(s=_(),s!==N?(Je=t,r=re(s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function m(){var t,r,o,a,i,s;return t=ze,e.substr(ze,13)===ne?(r=ne,ze+=13):(r=N,0===Ye&&n(oe)),r!==N?(o=F(),o!==N?(44===e.charCodeAt(ze)?(a=W,ze++):(a=N,0===Ye&&n(H)),a!==N?(i=F(),i!==N?(s=_(),s!==N?(Je=t,r=ae(s),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function y(){var t,r,o,a,i,s,l;if(t=ze,e.substr(ze,6)===ie?(r=ie,ze+=6):(r=N,0===Ye&&n(se)),r!==N)if(o=F(),o!==N)if(44===e.charCodeAt(ze)?(a=W,ze++):(a=N,0===Ye&&n(H)),a!==N)if(i=F(),i!==N){if(s=[],l=g(),l!==N)for(;l!==N;)s.push(l),l=g();else s=E;s!==N?(Je=t,r=le(s),t=r):(ze=t,t=E)}else ze=t,t=E;else ze=t,t=E;else ze=t,t=E;else ze=t,t=E;return t}function v(){var t,r,o,a;return t=ze,r=ze,61===e.charCodeAt(ze)?(o=ue,ze++):(o=N,0===Ye&&n(ce)),o!==N?(a=C(),a!==N?(o=[o,a],r=o):(ze=r,r=E)):(ze=r,r=E),r!==N&&(r=e.substring(t,ze)),t=r,t===N&&(t=O()),t}function g(){var t,r,o,a,s,l,u,c,p;return t=ze,r=F(),r!==N?(o=v(),o!==N?(a=F(),a!==N?(123===e.charCodeAt(ze)?(s=q,ze++):(s=N,0===Ye&&n(U)),s!==N?(l=F(),l!==N?(u=i(),u!==N?(c=F(),c!==N?(125===e.charCodeAt(ze)?(p=V,ze++):(p=N,0===Ye&&n(Z)),p!==N?(Je=t,r=pe(o,u),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function b(){var t,r,o,a;return t=ze,e.substr(ze,7)===fe?(r=fe,ze+=7):(r=N,0===Ye&&n(de)),r!==N?(o=F(),o!==N?(a=C(),a!==N?(Je=t,r=he(a),t=r):(ze=t,t=E)):(ze=t,t=E)):(ze=t,t=E),t}function _(){var e,t,r,n,o;if(e=ze,t=b(),t===N&&(t=G),t!==N)if(r=F(),r!==N){if(n=[],o=g(),o!==N)for(;o!==N;)n.push(o),o=g();else n=E;n!==N?(Je=e,t=me(t,n),e=t):(ze=e,e=E)}else ze=e,e=E;else ze=e,e=E;return e}function w(){var t,r;if(Ye++,t=[],ve.test(e.charAt(ze))?(r=e.charAt(ze),ze++):(r=N,0===Ye&&n(ge)),r!==N)for(;r!==N;)t.push(r),ve.test(e.charAt(ze))?(r=e.charAt(ze),ze++):(r=N,0===Ye&&n(ge));else t=E;return Ye--,t===N&&(r=N,0===Ye&&n(ye)),t}function F(){var t,r,o;for(Ye++,t=ze,r=[],o=w();o!==N;)r.push(o),o=w();return r!==N&&(r=e.substring(t,ze)),t=r,Ye--,t===N&&(r=N,0===Ye&&n(be)),t}function T(){var t;return _e.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(we)),t}function P(){var t;return Fe.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(Te)),t}function C(){var t,r,o,a,i,s;if(t=ze,48===e.charCodeAt(ze)?(r=Pe,ze++):(r=N,0===Ye&&n(Ce)),r===N){if(r=ze,o=ze,xe.test(e.charAt(ze))?(a=e.charAt(ze),ze++):(a=N,0===Ye&&n(Oe)),a!==N){for(i=[],s=T();s!==N;)i.push(s),s=T();i!==N?(a=[a,i],o=a):(ze=o,o=E)}else ze=o,o=E;o!==N&&(o=e.substring(r,ze)),r=o}return r!==N&&(Je=t,r=je(r)),t=r}function x(){var t,r,o,a,i,s,l,u;return Re.test(e.charAt(ze))?(t=e.charAt(ze),ze++):(t=N,0===Ye&&n(Ne)),t===N&&(t=ze,e.substr(ze,2)===Ae?(r=Ae,ze+=2):(r=N,0===Ye&&n(ke)),r!==N&&(Je=t,r=Me()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ee?(r=Ee,ze+=2):(r=N,0===Ye&&n(De)),r!==N&&(Je=t,r=Le()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ie?(r=Ie,ze+=2):(r=N,0===Ye&&n(Se)),r!==N&&(Je=t,r=qe()),t=r,t===N&&(t=ze,e.substr(ze,2)===Ue?(r=Ue,ze+=2):(r=N,0===Ye&&n(Ge)),r!==N&&(Je=t,r=We()),t=r,t===N&&(t=ze,e.substr(ze,2)===He?(r=He,ze+=2):(r=N,0===Ye&&n(Ve)),r!==N?(o=ze,a=ze,i=P(),i!==N?(s=P(),s!==N?(l=P(),l!==N?(u=P(),u!==N?(i=[i,s,l,u],a=i):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E)):(ze=a,a=E),a!==N&&(a=e.substring(o,ze)),o=a,o!==N?(Je=t,r=Ze(o),t=r):(ze=t,t=E)):(ze=t,t=E)))))),t}function O(){var e,t,r;if(e=ze,t=[],r=x(),r!==N)for(;r!==N;)t.push(r),r=x();else t=E;return t!==N&&(Je=e,t=Be(t)),e=t}var j,R=arguments.length>1?arguments[1]:{},N={},A={start:a},k=a,M=function(e){return{type:"messageFormatPattern",elements:e}},E=N,D=function(e){var t,r,n,o,a,i="";for(t=0,n=e.length;n>t;t+=1)for(o=e[t],r=0,a=o.length;a>r;r+=1)i+=o[r];return i},L=function(e){return{type:"messageTextElement",value:e}},I=/^[^ \t\n\r,.+={}#]/,S={type:"class",value:"[^ \\t\\n\\r,.+={}#]",description:"[^ \\t\\n\\r,.+={}#]"},q="{",U={type:"literal",value:"{",description:'"{"'},G=null,W=",",H={type:"literal",value:",",description:'","'},V="}",Z={type:"literal",value:"}",description:'"}"'},B=function(e,t){return{type:"argumentElement",id:e,format:t&&t[2]}},z="number",J={type:"literal",value:"number",description:'"number"'},$="date",K={type:"literal",value:"date",description:'"date"'},Q="time",X={type:"literal",value:"time",description:'"time"'},Y=function(e,t){return{type:e+"Format",style:t&&t[2]}},ee="plural",te={type:"literal",value:"plural",description:'"plural"'},re=function(e){return{type:e.type,ordinal:!1,offset:e.offset||0,options:e.options}},ne="selectordinal",oe={type:"literal",value:"selectordinal",description:'"selectordinal"'},ae=function(e){return{type:e.type,ordinal:!0,offset:e.offset||0,options:e.options}},ie="select",se={type:"literal",value:"select",description:'"select"'},le=function(e){return{type:"selectFormat",options:e}},ue="=",ce={type:"literal",value:"=",description:'"="'},pe=function(e,t){return{type:"optionalFormatPattern",selector:e,value:t}},fe="offset:",de={type:"literal",value:"offset:",description:'"offset:"'},he=function(e){return e},me=function(e,t){return{type:"pluralFormat",offset:e,options:t}},ye={type:"other",description:"whitespace"},ve=/^[ \t\n\r]/,ge={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},be={type:"other",description:"optionalWhitespace"},_e=/^[0-9]/,we={type:"class",value:"[0-9]",description:"[0-9]"},Fe=/^[0-9a-f]/i,Te={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},Pe="0",Ce={type:"literal",value:"0",description:'"0"'},xe=/^[1-9]/,Oe={type:"class",value:"[1-9]",description:"[1-9]"},je=function(e){return parseInt(e,10)},Re=/^[^{}\\\0-\x1F \t\n\r]/,Ne={type:"class",value:"[^{}\\\\\\0-\\x1F \\t\\n\\r]",description:"[^{}\\\\\\0-\\x1F \\t\\n\\r]"},Ae="\\\\",ke={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},Me=function(){return"\\"},Ee="\\#",De={type:"literal",value:"\\#",description:'"\\\\#"'},Le=function(){return"\\#"},Ie="\\{",Se={type:"literal",value:"\\{",description:'"\\\\{"'},qe=function(){return"{"},Ue="\\}",Ge={type:"literal",value:"\\}",description:'"\\\\}"'},We=function(){return"}"},He="\\u",Ve={type:"literal",value:"\\u",description:'"\\\\u"'},Ze=function(e){return String.fromCharCode(parseInt(e,16))},Be=function(e){return e.join("")},ze=0,Je=0,$e=0,Ke={line:1,column:1,seenCR:!1},Qe=0,Xe=[],Ye=0;if("startRule"in R){if(!(R.startRule in A))throw new Error("Can't start parsing from rule \""+R.startRule+'".');k=A[R.startRule]}if(j=k(),j!==N&&ze===e.length)return j;throw j!==N&&ze<e.length&&n({type:"end",description:"end of input"}),o(null,Xe,Qe)}return e(t,Error),{SyntaxError:t,parse:r}}();Z(u,"formats",{enumerable:!0,value:{number:{currency:{style:"currency"},percent:{style:"percent"}},date:{"short":{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},"long":{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{"short":{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},"long":{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}}),Z(u,"__localeData__",{value:B(null)}),Z(u,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlMessageFormat is missing a `locale` property");u.__localeData__[e.locale.toLowerCase()]=e}}),Z(u,"__parse",{value:z.parse}),Z(u,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),u.prototype.resolvedOptions=function(){return{locale:this._locale}},u.prototype._compilePattern=function(e,t,r,n){var a=new o(t,r,n);return a.compile(e)},u.prototype._findPluralRuleFunction=function(e){for(var t=u.__localeData__,r=t[e.toLowerCase()];r;){if(r.pluralRuleFunction)return r.pluralRuleFunction;r=r.parentLocale&&t[r.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlMessageFormat is missing a `pluralRuleFunction` for :"+e)},u.prototype._format=function(e,t){var r,n,o,a,i,s="";for(r=0,n=e.length;n>r;r+=1)if(o=e[r],"string"!=typeof o){if(a=o.id,!t||!H.call(t,a))throw new Error("A value must be provided for: "+a);i=t[a],s+=o.options?this._format(o.getOption(i),t):o.format(i)}else s+=o;return s},u.prototype._mergeFormats=function(e,t){var r,o,a={};for(r in e)H.call(e,r)&&(a[r]=o=B(e[r]),t&&H.call(t,r)&&n(o,t[r]));return a},u.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(u.defaultLocale);var t,r,n,o,a=u.__localeData__;for(t=0,r=e.length;r>t;t+=1)for(n=e[t].toLowerCase().split("-");n.length;){if(o=a[n.join("-")])return o.locale;n.pop()}var i=e.pop();throw new Error("No locale data has been added to IntlMessageFormat for: "+e.join(", ")+", or the default locale: "+i)};var J={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"}};u.__addLocaleData(J),u.defaultLocale="en";var $=Math.round,K=Object.prototype.hasOwnProperty,Q=Object.prototype.toString,X=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),Y=(!X&&!Object.prototype.__defineGetter__,X?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!K.call(e,t)||"value"in r)&&(e[t]=r.value)}),ee=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)K.call(t,o)&&Y(n,o,t[o]);return n},te=Array.prototype.indexOf||function(e,t){var r=this;if(!r.length)return-1;for(var n=t||0,o=r.length;o>n;n++)if(r[n]===e)return n;return-1},re=Array.isArray||function(e){return"[object Array]"===Q.call(e)},ne=Date.now||function(){return(new Date).getTime()},oe=["second","minute","hour","day","month","year"],ae=["best fit","numeric"];Y(f,"__localeData__",{value:ee(null)}),Y(f,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlRelativeFormat is missing a `locale` property value");f.__localeData__[e.locale.toLowerCase()]=e,u.__addLocaleData(e)}}),Y(f,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),Y(f,"thresholds",{enumerable:!0,value:{second:45,minute:45,hour:22,day:26,month:11}}),f.prototype.resolvedOptions=function(){return{locale:this._locale,style:this._options.style,units:this._options.units}},f.prototype._compileMessage=function(e){var t,r=this._locales,n=(this._locale,this._fields[e]),o=n.relativeTime,a="",i="";for(t in o.future)o.future.hasOwnProperty(t)&&(a+=" "+t+" {"+o.future[t].replace("{0}","#")+"}");for(t in o.past)o.past.hasOwnProperty(t)&&(i+=" "+t+" {"+o.past[t].replace("{0}","#")+"}");var s="{when, select, future {{0, plural, "+a+"}}past {{0, plural, "+i+"}}}";return new u(s,r)},f.prototype._getMessage=function(e){var t=this._messages;return t[e]||(t[e]=this._compileMessage(e)),t[e]},f.prototype._getRelativeUnits=function(e,t){var r=this._fields[t];return r.relative?r.relative[e]:void 0},f.prototype._findFields=function(e){for(var t=f.__localeData__,r=t[e.toLowerCase()];r;){if(r.fields)return r.fields;r=r.parentLocale&&t[r.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlRelativeFormat is missing `fields` for :"+e)},f.prototype._format=function(e,t){var r=t&&void 0!==t.now?t.now:ne();if(void 0===e&&(e=r),!isFinite(r))throw new RangeError("The `now` option provided to IntlRelativeFormat#format() is not in valid range.");if(!isFinite(e))throw new RangeError("The date value provided to IntlRelativeFormat#format() is not in valid range.");var n=p(r,e),o=this._options.units||this._selectUnits(n),a=n[o];if("numeric"!==this._options.style){var i=this._getRelativeUnits(a,o);if(i)return i}return this._getMessage(o).format({0:Math.abs(a),when:0>a?"past":"future"})},f.prototype._isValidUnits=function(e){if(!e||te.call(oe,e)>=0)return!0;if("string"==typeof e){var t=/s$/.test(e)&&e.substr(0,e.length-1);if(t&&te.call(oe,t)>=0)throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, did you mean: '+t)}throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, it must be one of: "'+oe.join('", "')+'"')},f.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(f.defaultLocale);var t,r,n,o,a=f.__localeData__;for(t=0,r=e.length;r>t;t+=1)for(n=e[t].toLowerCase().split("-");n.length;){if(o=a[n.join("-")])return o.locale;n.pop()}var i=e.pop();throw new Error("No locale data has been added to IntlRelativeFormat for: "+e.join(", ")+", or the default locale: "+i)},f.prototype._resolveStyle=function(e){if(!e)return ae[0];if(te.call(ae,e)>=0)return e;throw new Error('"'+e+'" is not a valid IntlRelativeFormat `style` value, it must be one of: "'+ae.join('", "')+'"')},f.prototype._selectUnits=function(e){var t,r,n;for(t=0,r=oe.length;r>t&&(n=oe[t],!(Math.abs(e[n])<f.thresholds[n]));t+=1);return n};var ie={locale:"en",pluralRuleFunction:function(e,t){var r=String(e).split("."),n=!r[1],o=Number(r[0])==e,a=o&&r[0].slice(-1),i=o&&r[0].slice(-2);return t?1==a&&11!=i?"one":2==a&&12!=i?"two":3==a&&13!=i?"few":"other":1==e&&n?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}};f.__addLocaleData(ie),f.defaultLocale="en";var se=t.PropTypes.bool,le=t.PropTypes.number,ue=t.PropTypes.string,ce=t.PropTypes.func,pe=t.PropTypes.object,fe=t.PropTypes.oneOf,de=t.PropTypes.shape,he={locale:ue,formats:pe,messages:pe,defaultLocale:ue,defaultFormats:pe},me={formatDate:ce.isRequired,formatTime:ce.isRequired,formatRelative:ce.isRequired,formatNumber:ce.isRequired,formatPlural:ce.isRequired,formatMessage:ce.isRequired,formatHTMLMessage:ce.isRequired},ye=de(G["extends"]({},he,me,{formatters:pe,now:ce.isRequired})),ve={id:ue.isRequired,description:ue,defaultMessage:ue},ge={localeMatcher:fe(["best fit","lookup"]),formatMatcher:fe(["basic","best fit"]),timeZone:ue,hour12:se,weekday:fe(["narrow","short","long"]),era:fe(["narrow","short","long"]),year:fe(["numeric","2-digit"]),month:fe(["numeric","2-digit","narrow","short","long"]),day:fe(["numeric","2-digit"]),hour:fe(["numeric","2-digit"]),minute:fe(["numeric","2-digit"]),second:fe(["numeric","2-digit"]),timeZoneName:fe(["short","long"])},be={localeMatcher:fe(["best fit","lookup"]),style:fe(["decimal","currency","percent"]),currency:ue,currencyDisplay:fe(["symbol","code","name"]),useGrouping:se,minimumIntegerDigits:le,minimumFractionDigits:le,maximumFractionDigits:le,minimumSignificantDigits:le,maximumSignificantDigits:le},_e={style:fe(["best fit","numeric"]),units:fe(["second","minute","hour","day","month","year"])},we={style:fe(["cardinal","ordinal"]) | ||
},Fe=r(function(e){var t="production",r=function(e,r,n,o,a,i,s,l){if("production"!==t&&void 0===r)throw new Error("invariant requires an error message argument");if(!e){var u;if(void 0===r)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,o,a,i,s,l],p=0;u=new Error(r.replace(/%s/g,function(){return c[p++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r}),Te=Fe&&"object"==typeof Fe&&"default"in Fe?Fe["default"]:Fe,Pe=Object.keys(he),Ce={"&":"&",">":">","<":"<",'"':""","'":"'"},xe=/[&><"']/g,Oe=function tt(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];G.classCallCheck(this,tt);var r="ordinal"===t.style,n=C(P(e));this.format=function(e){return n(e,r)}},je=Function.prototype.bind||function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),r=this,n=function(){},o=function(){return r.apply(this instanceof n?this:e,t.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(n.prototype=this.prototype),o.prototype=new n,o},Re=Object.prototype.hasOwnProperty,Ne=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),Ae=(!Ne&&!Object.prototype.__defineGetter__,Ne?Object.defineProperty:function(e,t,r){"get"in r&&e.__defineGetter__?e.__defineGetter__(t,r.get):(!Re.call(e,t)||"value"in r)&&(e[t]=r.value)}),ke=Object.create||function(e,t){function r(){}var n,o;r.prototype=e,n=new r;for(o in t)Re.call(t,o)&&Ae(n,o,t[o]);return n},Me=Object.keys(ge),Ee=Object.keys(be),De=Object.keys(_e),Le=Object.keys(we),Ie={second:60,minute:60,hour:24,day:30,month:12},Se=Object.freeze({formatDate:A,formatTime:k,formatRelative:M,formatNumber:E,formatPlural:D,formatMessage:L,formatHTMLMessage:I}),qe=Object.keys(he),Ue=Object.keys(me),Ge={formats:{},messages:{},defaultLocale:"en",defaultFormats:{}},We=function(e){function r(e,t){G.classCallCheck(this,r);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));Te("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=t.intl,a=void 0;a=isFinite(e.initialNow)?Number(e.initialNow):o?o.now():Date.now();var i=o||{},s=i.formatters,l=void 0===s?{getDateTimeFormat:x(Intl.DateTimeFormat),getNumberFormat:x(Intl.NumberFormat),getMessageFormat:x(u),getRelativeFormat:x(f),getPluralFormat:x(Oe)}:s;return n.state=G["extends"]({},l,{now:function(){return n._didDisplay?Date.now():a}}),n}return G.inherits(r,e),G.createClass(r,[{key:"getConfig",value:function(){var e=this.context.intl,t=G["extends"]({},Ge,v(this.props,qe,e));if(!h(t.locale)){var r=t,n=(r.locale,r.defaultLocale),o=r.defaultFormats;t=G["extends"]({},t,{locale:n,formats:o,messages:Ge.messages})}return t}},{key:"getBoundFormatFns",value:function(e,t){return Ue.reduce(function(r,n){return r[n]=Se[n].bind(null,e,t),r},{})}},{key:"getChildContext",value:function(){var e=this.getConfig(),t=this.getBoundFormatFns(e,this.state),r=this.state,n=r.now,o=G.objectWithoutProperties(r,["now"]);return{intl:G["extends"]({},e,t,{formatters:o,now:n})}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"componentDidMount",value:function(){this._didDisplay=!0}},{key:"render",value:function(){return t.Children.only(this.props.children)}}]),r}(t.Component);We.displayName="IntlProvider",We.contextTypes={intl:ye},We.childContextTypes={intl:ye.isRequired},We.propTypes=G["extends"]({},he,{children:t.PropTypes.element.isRequired,initialNow:t.PropTypes.any});var He=function(e){function t(e,r){G.classCallCheck(this,t);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return G.inherits(t,e),G.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatDate,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):U.createElement("span",null,o)}}]),t}(t.Component);He.displayName="FormattedDate",He.contextTypes={intl:ye},He.propTypes=G["extends"]({},ge,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var Ve=function(e){function t(e,r){G.classCallCheck(this,t);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return G.inherits(t,e),G.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatTime,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):U.createElement("span",null,o)}}]),t}(t.Component);Ve.displayName="FormattedTime",Ve.contextTypes={intl:ye},Ve.propTypes=G["extends"]({},ge,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var Ze=1e3,Be=6e4,ze=36e5,Je=864e5,$e=2147483647,Ke=function(e){function t(e,r){G.classCallCheck(this,t);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));g(r);var o=isFinite(e.initialNow)?Number(e.initialNow):r.intl.now();return n.state={now:o},n}return G.inherits(t,e),G.createClass(t,[{key:"scheduleNextUpdate",value:function(e,t){var r=this,n=e.updateInterval;if(n){var o=new Date(e.value).getTime(),a=o-t.now,i=e.units||S(a),s=q(i),l=Math.abs(a%s),u=0>a?Math.max(n,s-l):Math.max(n,l);clearTimeout(this._timer),this._timer=setTimeout(function(){r.setState({now:r.context.intl.now()})},u)}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"componentWillUpdate",value:function(e,t){this.scheduleNextUpdate(e,t)}},{key:"componentDidMount",value:function(){this.scheduleNextUpdate(this.props,this.state)}},{key:"componentWillUnmount",value:function(){clearTimeout(this._timer)}},{key:"render",value:function(){var e=this.context.intl.formatRelative,t=this.props,r=t.value,n=t.children,o=e(r,G["extends"]({},this.props,this.state));return"function"==typeof n?n(o):U.createElement("span",null,o)}}]),t}(t.Component);Ke.displayName="FormattedRelative",Ke.contextTypes={intl:ye},Ke.propTypes=G["extends"]({},_e,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,updateInterval:t.PropTypes.number,initialNow:t.PropTypes.any,children:t.PropTypes.func}),Ke.defaultProps={updateInterval:1e4};var Qe=function(e){function t(e,r){G.classCallCheck(this,t);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return G.inherits(t,e),G.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatNumber,t=this.props,r=t.value,n=t.children,o=e(r,this.props);return"function"==typeof n?n(o):U.createElement("span",null,o)}}]),t}(t.Component);Qe.displayName="FormattedNumber",Qe.contextTypes={intl:ye},Qe.propTypes=G["extends"]({},be,{value:t.PropTypes.any.isRequired,format:t.PropTypes.string,children:t.PropTypes.func});var Xe=function(e){function t(e,r){G.classCallCheck(this,t);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,e,r));return g(r),n}return G.inherits(t,e),G.createClass(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return _.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl.formatPlural,t=this.props,r=t.value,n=t.other,o=t.children,a=e(r,this.props),i=this.props[a]||n;return"function"==typeof o?o(i):U.createElement("span",null,i)}}]),t}(t.Component);Xe.displayName="FormattedPlural",Xe.contextTypes={intl:ye},Xe.propTypes=G["extends"]({},we,{value:t.PropTypes.any.isRequired,other:t.PropTypes.node.isRequired,zero:t.PropTypes.node,one:t.PropTypes.node,two:t.PropTypes.node,few:t.PropTypes.node,many:t.PropTypes.node,children:t.PropTypes.func}),Xe.defaultProps={style:"cardinal"};var Ye=function(e){function r(e,t){G.classCallCheck(this,r);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return G.inherits(r,e),G.createClass(r,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values,r=e.values;if(!b(r,t))return!0;for(var n=G["extends"]({},e,{values:t}),o=arguments.length,a=Array(o>1?o-1:0),i=1;o>i;i++)a[i-1]=arguments[i];return _.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl.formatMessage,r=this.props,n=r.id,o=r.description,a=r.defaultMessage,i=r.values,s=r.tagName,l=r.children,u=void 0,c=void 0,p=void 0,f=i&&Object.keys(i).length>0;f&&!function(){var e=Math.floor(1099511627776*Math.random()).toString(16),r=function(){var t=0;return function(){return"@__ELEMENT-"+e+"-"+(t+=1)+"__@"}}();u=new RegExp("(@__ELEMENT-"+e+"-\\d+__@)","g"),c={},p={},Object.keys(i).forEach(function(e){var n=i[e];if(t.isValidElement(n)){var o=r();c[e]=o,p[o]=n}else c[e]=n})}();var d={id:n,description:o,defaultMessage:a},h=e(d,c||i),m=void 0,y=p&&Object.keys(p).length>0;return m=y?h.split(u).filter(function(e){return!!e}).map(function(e){return p[e]||e}):[h],"function"==typeof l?l.apply(void 0,G.toConsumableArray(m)):t.createElement.apply(void 0,[s,null].concat(G.toConsumableArray(m)))}}]),r}(t.Component);Ye.displayName="FormattedMessage",Ye.contextTypes={intl:ye},Ye.propTypes=G["extends"]({},ve,{values:t.PropTypes.object,tagName:t.PropTypes.string,children:t.PropTypes.func}),Ye.defaultProps={values:{},tagName:"span"};var et=function(e){function r(e,t){G.classCallCheck(this,r);var n=G.possibleConstructorReturn(this,Object.getPrototypeOf(r).call(this,e,t));return g(t),n}return G.inherits(r,e),G.createClass(r,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values,r=e.values;if(!b(r,t))return!0;for(var n=G["extends"]({},e,{values:t}),o=arguments.length,a=Array(o>1?o-1:0),i=1;o>i;i++)a[i-1]=arguments[i];return _.apply(void 0,[this,n].concat(a))}},{key:"render",value:function(){var e=this.context.intl.formatHTMLMessage,r=this.props,n=r.id,o=r.description,a=r.defaultMessage,i=r.values,s=r.tagName,l=r.children,u={id:n,description:o,defaultMessage:a},c=e(u,i);return"function"==typeof l?l(c):t.createElement(s,{dangerouslySetInnerHTML:{__html:c}})}}]),r}(t.Component);et.displayName="FormattedHTMLMessage",et.contextTypes={intl:ye},et.propTypes=G["extends"]({},ve,{values:t.PropTypes.object,tagName:t.PropTypes.string,children:t.PropTypes.func}),et.defaultProps={values:{},tagName:"span"},d(W),e.addLocaleData=d,e.intlShape=ye,e.injectIntl=F,e.defineMessages=T,e.IntlProvider=We,e.FormattedDate=He,e.FormattedTime=Ve,e.FormattedRelative=Ke,e.FormattedNumber=Qe,e.FormattedPlural=Xe,e.FormattedMessage=Ye,e.FormattedHTMLMessage=et}); | ||
//# sourceMappingURL=react-intl.min.js.map |
@@ -90,2 +90,14 @@ /* | ||
babelHelpers.objectWithoutProperties = function (obj, keys) { | ||
var target = {}; | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
} | ||
return target; | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
@@ -182,2 +194,3 @@ if (!self) { | ||
var intlShape = shape(babelHelpers['extends']({}, intlConfigPropTypes, intlFormatPropTypes, { | ||
formatters: object, | ||
now: func.isRequired | ||
@@ -252,8 +265,8 @@ })); | ||
function filterProps(obj, whitelist) { | ||
function filterProps(props, whitelist) { | ||
var defaults = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
return whitelist.reduce(function (filtered, name) { | ||
if (obj.hasOwnProperty(name)) { | ||
filtered[name] = obj[name]; | ||
if (props.hasOwnProperty(name)) { | ||
filtered[name] = props[name]; | ||
} else if (defaults.hasOwnProperty(name)) { | ||
@@ -314,3 +327,3 @@ filtered[name] = defaults[name]; | ||
return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)); | ||
return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames))); | ||
} | ||
@@ -409,2 +422,19 @@ | ||
var RELATIVE_FORMAT_THRESHOLDS = { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour: 24, // hours to day | ||
day: 30, // days to month | ||
month: 12 }; | ||
// months to year | ||
function updateRelativeFormatThresholds(newThresholds) { | ||
var thresholds = IntlRelativeFormat.thresholds; | ||
thresholds.second = newThresholds.second; | ||
thresholds.minute = newThresholds.minute; | ||
thresholds.hour = newThresholds.hour; | ||
thresholds.day = newThresholds.day; | ||
thresholds.month = newThresholds.month; | ||
} | ||
function getNamedFormat(formats, type, name) { | ||
@@ -488,11 +518,5 @@ var format = formats && formats[type] && formats[type][name]; | ||
// specific values just for this render. | ||
var thresholds = babelHelpers['extends']({}, IntlRelativeFormat.thresholds); | ||
Object.assign(IntlRelativeFormat.thresholds, { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour: 24, // hours to day | ||
day: 30, // days to month | ||
month: 12 }); | ||
var oldThresholds = babelHelpers['extends']({}, IntlRelativeFormat.thresholds); | ||
updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS); | ||
// months to year | ||
try { | ||
@@ -507,3 +531,3 @@ return state.getRelativeFormat(locale, filteredOptions).format(date, { | ||
} finally { | ||
Object.assign(IntlRelativeFormat.thresholds, thresholds); | ||
updateRelativeFormatThresholds(oldThresholds); | ||
} | ||
@@ -670,4 +694,7 @@ | ||
var intlContext = context.intl; | ||
// Used to stabilize time when performing an initial rendering so that | ||
// all relative times use the same reference "now" time. | ||
var initialNow = void 0; | ||
@@ -680,9 +707,14 @@ if (isFinite(props.initialNow)) { | ||
// function to propagate its value for "now". | ||
initialNow = context.intl ? context.intl.now() : Date.now(); | ||
initialNow = intlContext ? intlContext.now() : Date.now(); | ||
} | ||
_this.state = { | ||
// Creating `Intl*` formatters is expensive so these format caches | ||
// memoize the `Intl*` constructors and have the same lifecycle as | ||
// this IntlProvider instance. | ||
// Creating `Intl*` formatters is expensive. If there's a parent | ||
// `<IntlProvider>`, then its formatters will be used. Otherwise, this | ||
// memoize the `Intl*` constructors and cache them for the lifecycle of | ||
// this IntlProvider instance. | ||
var _ref = intlContext || {}; | ||
var _ref$formatters = _ref.formatters; | ||
var formatters = _ref$formatters === undefined ? { | ||
getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat), | ||
@@ -692,4 +724,8 @@ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat), | ||
getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat), | ||
getPluralFormat: memoizeIntlConstructor(IntlPluralFormat), | ||
getPluralFormat: memoizeIntlConstructor(IntlPluralFormat) | ||
} : _ref$formatters; | ||
_this.state = babelHelpers['extends']({}, formatters, { | ||
// Wrapper to provide stable "now" time for initial render. | ||
@@ -699,3 +735,3 @@ now: function now() { | ||
} | ||
}; | ||
}); | ||
return _this; | ||
@@ -707,4 +743,3 @@ } | ||
value: function getConfig() { | ||
var _context$intl = this.context.intl; | ||
var intlContext = _context$intl === undefined ? {} : _context$intl; | ||
var intlContext = this.context.intl; | ||
@@ -757,5 +792,11 @@ // Build a whitelisted config object from `props`, defaults, and | ||
var _state = this.state; | ||
var now = _state.now; | ||
var formatters = babelHelpers.objectWithoutProperties(_state, ['now']); | ||
return { | ||
intl: babelHelpers['extends']({}, config, boundFormatFns, { | ||
now: this.state.now | ||
formatters: formatters, | ||
now: now | ||
}) | ||
@@ -762,0 +803,0 @@ }; |
@@ -95,2 +95,14 @@ /* | ||
babelHelpers.objectWithoutProperties = function (obj, keys) { | ||
var target = {}; | ||
for (var i in obj) { | ||
if (keys.indexOf(i) >= 0) continue; | ||
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; | ||
target[i] = obj[i]; | ||
} | ||
return target; | ||
}; | ||
babelHelpers.possibleConstructorReturn = function (self, call) { | ||
@@ -187,2 +199,3 @@ if (!self) { | ||
var intlShape = shape(babelHelpers['extends']({}, intlConfigPropTypes, intlFormatPropTypes, { | ||
formatters: object, | ||
now: func.isRequired | ||
@@ -257,8 +270,8 @@ })); | ||
function filterProps(obj, whitelist) { | ||
function filterProps(props, whitelist) { | ||
var defaults = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; | ||
return whitelist.reduce(function (filtered, name) { | ||
if (obj.hasOwnProperty(name)) { | ||
filtered[name] = obj[name]; | ||
if (props.hasOwnProperty(name)) { | ||
filtered[name] = props[name]; | ||
} else if (defaults.hasOwnProperty(name)) { | ||
@@ -319,3 +332,3 @@ filtered[name] = defaults[name]; | ||
return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)); | ||
return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames))); | ||
} | ||
@@ -414,2 +427,19 @@ | ||
var RELATIVE_FORMAT_THRESHOLDS = { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour: 24, // hours to day | ||
day: 30, // days to month | ||
month: 12 }; | ||
// months to year | ||
function updateRelativeFormatThresholds(newThresholds) { | ||
var thresholds = IntlRelativeFormat.thresholds; | ||
thresholds.second = newThresholds.second; | ||
thresholds.minute = newThresholds.minute; | ||
thresholds.hour = newThresholds.hour; | ||
thresholds.day = newThresholds.day; | ||
thresholds.month = newThresholds.month; | ||
} | ||
function getNamedFormat(formats, type, name) { | ||
@@ -493,11 +523,5 @@ var format = formats && formats[type] && formats[type][name]; | ||
// specific values just for this render. | ||
var thresholds = babelHelpers['extends']({}, IntlRelativeFormat.thresholds); | ||
Object.assign(IntlRelativeFormat.thresholds, { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour: 24, // hours to day | ||
day: 30, // days to month | ||
month: 12 }); | ||
var oldThresholds = babelHelpers['extends']({}, IntlRelativeFormat.thresholds); | ||
updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS); | ||
// months to year | ||
try { | ||
@@ -512,3 +536,3 @@ return state.getRelativeFormat(locale, filteredOptions).format(date, { | ||
} finally { | ||
Object.assign(IntlRelativeFormat.thresholds, thresholds); | ||
updateRelativeFormatThresholds(oldThresholds); | ||
} | ||
@@ -675,4 +699,7 @@ | ||
var intlContext = context.intl; | ||
// Used to stabilize time when performing an initial rendering so that | ||
// all relative times use the same reference "now" time. | ||
var initialNow = void 0; | ||
@@ -685,9 +712,14 @@ if (isFinite(props.initialNow)) { | ||
// function to propagate its value for "now". | ||
initialNow = context.intl ? context.intl.now() : Date.now(); | ||
initialNow = intlContext ? intlContext.now() : Date.now(); | ||
} | ||
_this.state = { | ||
// Creating `Intl*` formatters is expensive so these format caches | ||
// memoize the `Intl*` constructors and have the same lifecycle as | ||
// this IntlProvider instance. | ||
// Creating `Intl*` formatters is expensive. If there's a parent | ||
// `<IntlProvider>`, then its formatters will be used. Otherwise, this | ||
// memoize the `Intl*` constructors and cache them for the lifecycle of | ||
// this IntlProvider instance. | ||
var _ref = intlContext || {}; | ||
var _ref$formatters = _ref.formatters; | ||
var formatters = _ref$formatters === undefined ? { | ||
getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat), | ||
@@ -697,4 +729,8 @@ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat), | ||
getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat), | ||
getPluralFormat: memoizeIntlConstructor(IntlPluralFormat), | ||
getPluralFormat: memoizeIntlConstructor(IntlPluralFormat) | ||
} : _ref$formatters; | ||
_this.state = babelHelpers['extends']({}, formatters, { | ||
// Wrapper to provide stable "now" time for initial render. | ||
@@ -704,3 +740,3 @@ now: function now() { | ||
} | ||
}; | ||
}); | ||
return _this; | ||
@@ -712,4 +748,3 @@ } | ||
value: function getConfig() { | ||
var _context$intl = this.context.intl; | ||
var intlContext = _context$intl === undefined ? {} : _context$intl; | ||
var intlContext = this.context.intl; | ||
@@ -762,5 +797,11 @@ // Build a whitelisted config object from `props`, defaults, and | ||
var _state = this.state; | ||
var now = _state.now; | ||
var formatters = babelHelpers.objectWithoutProperties(_state, ['now']); | ||
return { | ||
intl: babelHelpers['extends']({}, config, boundFormatFns, { | ||
now: this.state.now | ||
formatters: formatters, | ||
now: now | ||
}) | ||
@@ -767,0 +808,0 @@ }; |
{ | ||
"name": "react-intl", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.", | ||
@@ -79,5 +79,5 @@ "keywords": [ | ||
"mocha": "^2.2.5", | ||
"react": "^0.14.2", | ||
"react-addons-test-utils": "^0.14.3", | ||
"react-dom": "^0.14.2", | ||
"react": "^15.0.0", | ||
"react-addons-test-utils": "^15.0.0", | ||
"react-dom": "^15.0.0", | ||
"react-router": "^2.0.0", | ||
@@ -105,3 +105,3 @@ "rimraf": "^2.4.2", | ||
"react:14": "npm run react:clean && npm i react@^0.14 react-dom@^0.14 react-addons-test-utils@^0.14", | ||
"react:15": "npm run react:clean && npm i react@^15.0.0-rc.1 react-dom@^15.0.0-rc.1 react-addons-test-utils@^15.0.0-rc.1", | ||
"react:15": "npm run react:clean && npm i react@^15 react-dom@^15 react-addons-test-utils@^15", | ||
"lint": "eslint .", | ||
@@ -108,0 +108,0 @@ "test": "mocha --compilers js:babel-register --require babel-polyfill --require intl --recursive test/unit/ test/functional/", |
@@ -1,3 +0,3 @@ | ||
[React Intl][] | ||
============== | ||
React Intl | ||
========== | ||
@@ -94,3 +94,2 @@ Internationalize [React][] apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations. | ||
[React Intl]: http://formatjs.io/react/ | ||
[npm]: https://www.npmjs.org/package/react-intl | ||
@@ -109,4 +108,3 @@ [npm-badge]: https://img.shields.io/npm/v/react-intl.svg?style=flat-square | ||
[v1-docs]: http://formatjs.io/react/v1/ | ||
[ICU Message syntax]: http://formatjs.io/guide/#messageformat-syntax | ||
[CONTRIBUTING]: https://github.com/yahoo/react-intl/blob/master/CONTRIBUTING.md | ||
[LICENSE file]: https://github.com/yahoo/react-intl/blob/master/LICENSE.md |
@@ -41,2 +41,4 @@ /* | ||
const {intl: intlContext} = context; | ||
// Used to stabilize time when performing an initial rendering so that | ||
@@ -51,9 +53,10 @@ // all relative times use the same reference "now" time. | ||
// function to propagate its value for "now". | ||
initialNow = context.intl ? context.intl.now() : Date.now(); | ||
initialNow = intlContext ? intlContext.now() : Date.now(); | ||
} | ||
this.state = { | ||
// Creating `Intl*` formatters is expensive so these format caches | ||
// memoize the `Intl*` constructors and have the same lifecycle as | ||
// this IntlProvider instance. | ||
// Creating `Intl*` formatters is expensive. If there's a parent | ||
// `<IntlProvider>`, then its formatters will be used. Otherwise, this | ||
// memoize the `Intl*` constructors and cache them for the lifecycle of | ||
// this IntlProvider instance. | ||
const {formatters = { | ||
getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat), | ||
@@ -64,3 +67,7 @@ getNumberFormat : memoizeIntlConstructor(Intl.NumberFormat), | ||
getPluralFormat : memoizeIntlConstructor(IntlPluralFormat), | ||
}} = (intlContext || {}); | ||
this.state = { | ||
...formatters, | ||
// Wrapper to provide stable "now" time for initial render. | ||
@@ -74,3 +81,3 @@ now: () => { | ||
getConfig() { | ||
const {intl: intlContext = {}} = this.context; | ||
const {intl: intlContext} = this.context; | ||
@@ -125,4 +132,6 @@ // Build a whitelisted config object from `props`, defaults, and | ||
// Bind intl factories and current config to the format functions. | ||
let boundFormatFns = this.getBoundFormatFns(config, this.state); | ||
const boundFormatFns = this.getBoundFormatFns(config, this.state); | ||
const {now, ...formatters} = this.state; | ||
return { | ||
@@ -132,3 +141,4 @@ intl: { | ||
...boundFormatFns, | ||
now: this.state.now, | ||
formatters, | ||
now, | ||
}, | ||
@@ -135,0 +145,0 @@ }; |
@@ -27,2 +27,21 @@ /* | ||
const RELATIVE_FORMAT_THRESHOLDS = { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour : 24, // hours to day | ||
day : 30, // days to month | ||
month : 12, // months to year | ||
}; | ||
function updateRelativeFormatThresholds(newThresholds) { | ||
const {thresholds} = IntlRelativeFormat; | ||
({ | ||
second: thresholds.second, | ||
minute: thresholds.minute, | ||
hour : thresholds.hour, | ||
day : thresholds.day, | ||
month : thresholds.month, | ||
} = newThresholds); | ||
} | ||
function getNamedFormat(formats, type, name) { | ||
@@ -103,10 +122,4 @@ let format = formats && formats[type] && formats[type][name]; | ||
// specific values just for this render. | ||
const thresholds = {...IntlRelativeFormat.thresholds}; | ||
Object.assign(IntlRelativeFormat.thresholds, { | ||
second: 60, // seconds to minute | ||
minute: 60, // minutes to hour | ||
hour : 24, // hours to day | ||
day : 30, // days to month | ||
month : 12, // months to year | ||
}); | ||
const oldThresholds = {...IntlRelativeFormat.thresholds}; | ||
updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS); | ||
@@ -124,3 +137,3 @@ try { | ||
} finally { | ||
Object.assign(IntlRelativeFormat.thresholds, thresholds); | ||
updateRelativeFormatThresholds(oldThresholds); | ||
} | ||
@@ -127,0 +140,0 @@ |
@@ -33,2 +33,3 @@ /* | ||
...intlFormatPropTypes, | ||
formatters: object, | ||
now: func.isRequired, | ||
@@ -35,0 +36,0 @@ }); |
@@ -32,6 +32,6 @@ | ||
export function filterProps(obj, whitelist, defaults = {}) { | ||
export function filterProps(props, whitelist, defaults = {}) { | ||
return whitelist.reduce((filtered, name) => { | ||
if (obj.hasOwnProperty(name)) { | ||
filtered[name] = obj[name]; | ||
if (props.hasOwnProperty(name)) { | ||
filtered[name] = props[name]; | ||
} else if (defaults.hasOwnProperty(name)) { | ||
@@ -90,7 +90,7 @@ filtered[name] = defaults[name]; | ||
!shallowEquals(nextState, state) || | ||
!shallowEquals( | ||
!(nextIntl === intl || shallowEquals( | ||
filterProps(nextIntl, intlConfigPropNames), | ||
filterProps(intl, intlConfigPropNames) | ||
) | ||
)) | ||
); | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2092070
494
11184
109