react-intl 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/dist/react-intl.js +960 -948
  2. package/dist/react-intl.js.map +1 -1
  3. package/dist/react-intl.min.js +1 -2
  4. package/dist/react-intl.min.js.map +1 -1
  5. package/lib/index.es.js +971 -970
  6. package/lib/index.js +971 -970
  7. package/locale-data/af.js +1 -1
  8. package/locale-data/agq.js +1 -1
  9. package/locale-data/ak.js +1 -1
  10. package/locale-data/am.js +1 -1
  11. package/locale-data/ar.js +1 -1
  12. package/locale-data/ars.js +1 -0
  13. package/locale-data/as.js +1 -1
  14. package/locale-data/asa.js +1 -1
  15. package/locale-data/ast.js +1 -1
  16. package/locale-data/az.js +1 -1
  17. package/locale-data/bas.js +1 -1
  18. package/locale-data/be.js +1 -1
  19. package/locale-data/bem.js +1 -1
  20. package/locale-data/bez.js +1 -1
  21. package/locale-data/bg.js +1 -1
  22. package/locale-data/bh.js +1 -1
  23. package/locale-data/bm.js +1 -1
  24. package/locale-data/bn.js +1 -1
  25. package/locale-data/bo.js +1 -1
  26. package/locale-data/br.js +1 -1
  27. package/locale-data/brx.js +1 -1
  28. package/locale-data/bs.js +1 -1
  29. package/locale-data/ca.js +1 -1
  30. package/locale-data/ce.js +1 -1
  31. package/locale-data/cgg.js +1 -1
  32. package/locale-data/chr.js +1 -1
  33. package/locale-data/ckb.js +1 -1
  34. package/locale-data/cs.js +1 -1
  35. package/locale-data/cu.js +1 -1
  36. package/locale-data/cy.js +1 -1
  37. package/locale-data/da.js +1 -1
  38. package/locale-data/dav.js +1 -1
  39. package/locale-data/de.js +1 -1
  40. package/locale-data/dje.js +1 -1
  41. package/locale-data/dsb.js +1 -1
  42. package/locale-data/dua.js +1 -1
  43. package/locale-data/dv.js +1 -1
  44. package/locale-data/dyo.js +1 -1
  45. package/locale-data/dz.js +1 -1
  46. package/locale-data/ebu.js +1 -1
  47. package/locale-data/ee.js +1 -1
  48. package/locale-data/el.js +1 -1
  49. package/locale-data/en.js +1 -1
  50. package/locale-data/eo.js +1 -1
  51. package/locale-data/es.js +1 -1
  52. package/locale-data/et.js +1 -1
  53. package/locale-data/eu.js +1 -1
  54. package/locale-data/ewo.js +1 -1
  55. package/locale-data/fa.js +1 -1
  56. package/locale-data/ff.js +1 -1
  57. package/locale-data/fi.js +1 -1
  58. package/locale-data/fil.js +1 -1
  59. package/locale-data/fo.js +1 -1
  60. package/locale-data/fr.js +1 -1
  61. package/locale-data/fur.js +1 -1
  62. package/locale-data/fy.js +1 -1
  63. package/locale-data/ga.js +1 -1
  64. package/locale-data/gd.js +1 -1
  65. package/locale-data/gl.js +1 -1
  66. package/locale-data/gsw.js +1 -1
  67. package/locale-data/gu.js +1 -1
  68. package/locale-data/guw.js +1 -1
  69. package/locale-data/guz.js +1 -1
  70. package/locale-data/gv.js +1 -1
  71. package/locale-data/ha.js +1 -1
  72. package/locale-data/haw.js +1 -1
  73. package/locale-data/he.js +1 -1
  74. package/locale-data/hi.js +1 -1
  75. package/locale-data/hr.js +1 -1
  76. package/locale-data/hsb.js +1 -1
  77. package/locale-data/hu.js +1 -1
  78. package/locale-data/hy.js +1 -1
  79. package/locale-data/id.js +1 -1
  80. package/locale-data/ig.js +1 -1
  81. package/locale-data/ii.js +1 -1
  82. package/locale-data/in.js +1 -1
  83. package/locale-data/index.js +1 -10
  84. package/locale-data/is.js +1 -1
  85. package/locale-data/it.js +1 -1
  86. package/locale-data/iu.js +1 -1
  87. package/locale-data/iw.js +1 -1
  88. package/locale-data/ja.js +1 -1
  89. package/locale-data/jbo.js +1 -1
  90. package/locale-data/jgo.js +1 -1
  91. package/locale-data/ji.js +1 -1
  92. package/locale-data/jmc.js +1 -1
  93. package/locale-data/jv.js +1 -1
  94. package/locale-data/jw.js +1 -1
  95. package/locale-data/ka.js +1 -1
  96. package/locale-data/kab.js +1 -1
  97. package/locale-data/kaj.js +1 -1
  98. package/locale-data/kam.js +1 -1
  99. package/locale-data/kcg.js +1 -1
  100. package/locale-data/kde.js +1 -1
  101. package/locale-data/kea.js +1 -1
  102. package/locale-data/khq.js +1 -1
  103. package/locale-data/ki.js +1 -1
  104. package/locale-data/kk.js +1 -1
  105. package/locale-data/kkj.js +1 -1
  106. package/locale-data/kl.js +1 -1
  107. package/locale-data/kln.js +1 -1
  108. package/locale-data/km.js +1 -1
  109. package/locale-data/kn.js +1 -1
  110. package/locale-data/ko.js +1 -1
  111. package/locale-data/kok.js +1 -1
  112. package/locale-data/ks.js +1 -1
  113. package/locale-data/ksb.js +1 -1
  114. package/locale-data/ksf.js +1 -1
  115. package/locale-data/ksh.js +1 -1
  116. package/locale-data/ku.js +1 -1
  117. package/locale-data/kw.js +1 -1
  118. package/locale-data/ky.js +1 -1
  119. package/locale-data/lag.js +1 -1
  120. package/locale-data/lb.js +1 -1
  121. package/locale-data/lg.js +1 -1
  122. package/locale-data/lkt.js +1 -1
  123. package/locale-data/ln.js +1 -1
  124. package/locale-data/lo.js +1 -1
  125. package/locale-data/lrc.js +1 -1
  126. package/locale-data/lt.js +1 -1
  127. package/locale-data/lu.js +1 -1
  128. package/locale-data/luo.js +1 -1
  129. package/locale-data/luy.js +1 -1
  130. package/locale-data/lv.js +1 -1
  131. package/locale-data/mas.js +1 -1
  132. package/locale-data/mer.js +1 -1
  133. package/locale-data/mfe.js +1 -1
  134. package/locale-data/mg.js +1 -1
  135. package/locale-data/mgh.js +1 -1
  136. package/locale-data/mgo.js +1 -1
  137. package/locale-data/mk.js +1 -1
  138. package/locale-data/ml.js +1 -1
  139. package/locale-data/mn.js +1 -1
  140. package/locale-data/mo.js +1 -1
  141. package/locale-data/mr.js +1 -1
  142. package/locale-data/ms.js +1 -1
  143. package/locale-data/mt.js +1 -1
  144. package/locale-data/mua.js +1 -1
  145. package/locale-data/my.js +1 -1
  146. package/locale-data/mzn.js +1 -1
  147. package/locale-data/nah.js +1 -1
  148. package/locale-data/naq.js +1 -1
  149. package/locale-data/nb.js +1 -1
  150. package/locale-data/nd.js +1 -1
  151. package/locale-data/nds.js +1 -0
  152. package/locale-data/ne.js +1 -1
  153. package/locale-data/nl.js +1 -1
  154. package/locale-data/nmg.js +1 -1
  155. package/locale-data/nn.js +1 -1
  156. package/locale-data/nnh.js +1 -1
  157. package/locale-data/no.js +1 -1
  158. package/locale-data/nqo.js +1 -1
  159. package/locale-data/nr.js +1 -1
  160. package/locale-data/nso.js +1 -1
  161. package/locale-data/nus.js +1 -1
  162. package/locale-data/ny.js +1 -1
  163. package/locale-data/nyn.js +1 -1
  164. package/locale-data/om.js +1 -1
  165. package/locale-data/or.js +1 -1
  166. package/locale-data/os.js +1 -1
  167. package/locale-data/pa.js +1 -1
  168. package/locale-data/pap.js +1 -1
  169. package/locale-data/pl.js +1 -1
  170. package/locale-data/prg.js +1 -1
  171. package/locale-data/ps.js +1 -1
  172. package/locale-data/pt.js +1 -1
  173. package/locale-data/qu.js +1 -1
  174. package/locale-data/rm.js +1 -1
  175. package/locale-data/rn.js +1 -1
  176. package/locale-data/ro.js +1 -1
  177. package/locale-data/rof.js +1 -1
  178. package/locale-data/ru.js +1 -1
  179. package/locale-data/rw.js +1 -1
  180. package/locale-data/rwk.js +1 -1
  181. package/locale-data/sah.js +1 -1
  182. package/locale-data/saq.js +1 -1
  183. package/locale-data/sbp.js +1 -1
  184. package/locale-data/sdh.js +1 -1
  185. package/locale-data/se.js +1 -1
  186. package/locale-data/seh.js +1 -1
  187. package/locale-data/ses.js +1 -1
  188. package/locale-data/sg.js +1 -1
  189. package/locale-data/sh.js +1 -1
  190. package/locale-data/shi.js +1 -1
  191. package/locale-data/si.js +1 -1
  192. package/locale-data/sk.js +1 -1
  193. package/locale-data/sl.js +1 -1
  194. package/locale-data/sma.js +1 -1
  195. package/locale-data/smi.js +1 -1
  196. package/locale-data/smj.js +1 -1
  197. package/locale-data/smn.js +1 -1
  198. package/locale-data/sms.js +1 -1
  199. package/locale-data/sn.js +1 -1
  200. package/locale-data/so.js +1 -1
  201. package/locale-data/sq.js +1 -1
  202. package/locale-data/sr.js +1 -1
  203. package/locale-data/ss.js +1 -1
  204. package/locale-data/ssy.js +1 -1
  205. package/locale-data/st.js +1 -1
  206. package/locale-data/sv.js +1 -1
  207. package/locale-data/sw.js +1 -1
  208. package/locale-data/syr.js +1 -1
  209. package/locale-data/ta.js +1 -1
  210. package/locale-data/te.js +1 -1
  211. package/locale-data/teo.js +1 -1
  212. package/locale-data/th.js +1 -1
  213. package/locale-data/ti.js +1 -1
  214. package/locale-data/tig.js +1 -1
  215. package/locale-data/tk.js +1 -1
  216. package/locale-data/tl.js +1 -1
  217. package/locale-data/tn.js +1 -1
  218. package/locale-data/to.js +1 -1
  219. package/locale-data/tr.js +1 -1
  220. package/locale-data/ts.js +1 -1
  221. package/locale-data/twq.js +1 -1
  222. package/locale-data/tzm.js +1 -1
  223. package/locale-data/ug.js +1 -1
  224. package/locale-data/uk.js +1 -1
  225. package/locale-data/ur.js +1 -1
  226. package/locale-data/uz.js +1 -1
  227. package/locale-data/vai.js +1 -1
  228. package/locale-data/ve.js +1 -1
  229. package/locale-data/vi.js +1 -1
  230. package/locale-data/vo.js +1 -1
  231. package/locale-data/vun.js +1 -1
  232. package/locale-data/wa.js +1 -1
  233. package/locale-data/wae.js +1 -1
  234. package/locale-data/wo.js +1 -1
  235. package/locale-data/xh.js +1 -1
  236. package/locale-data/xog.js +1 -1
  237. package/locale-data/yav.js +1 -1
  238. package/locale-data/yi.js +1 -1
  239. package/locale-data/yo.js +1 -1
  240. package/locale-data/yue.js +1 -0
  241. package/locale-data/zgh.js +1 -1
  242. package/locale-data/zh.js +1 -1
  243. package/locale-data/zu.js +1 -1
  244. package/package.json +11 -9
  245. package/src/components/date.js +47 -0
  246. package/src/components/html-message.js +88 -0
  247. package/src/components/message.js +137 -0
  248. package/src/components/number.js +47 -0
  249. package/src/components/plural.js +59 -0
  250. package/src/components/provider.js +177 -0
  251. package/src/components/relative.js +171 -0
  252. package/src/components/time.js +47 -0
  253. package/src/define-messages.js +11 -0
  254. package/src/en.js +2 -0
  255. package/src/format.js +276 -0
  256. package/src/index.js +12 -0
  257. package/src/inject.js +59 -0
  258. package/src/locale-data-registry.js +42 -0
  259. package/src/plural.js +28 -0
  260. package/src/react-intl.js +24 -0
  261. package/src/types.js +98 -0
  262. package/src/utils.js +103 -0
  263. package/yarn.lock +87 -59
package/lib/index.es.js CHANGED
@@ -19,7 +19,7 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
19
19
  t0 = Number(s[0]) == n,
20
20
  n10 = t0 && s[0].slice(-1),
21
21
  n100 = t0 && s[0].slice(-2);if (ord) return n10 == 1 && n100 != 11 ? "one" : n10 == 2 && n100 != 12 ? "two" : n10 == 3 && n100 != 13 ? "few" : "other";return n == 1 && v0 ? "one" : "other";
22
- }, "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" } } } } };
22
+ }, "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", "relative": { "0": "this hour" }, "relativeTime": { "future": { "one": "in {0} hour", "other": "in {0} hours" }, "past": { "one": "{0} hour ago", "other": "{0} hours ago" } } }, "minute": { "displayName": "minute", "relative": { "0": "this 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" } } } } };
23
23
 
24
24
  /*
25
25
  * Copyright 2015, Yahoo Inc.
@@ -28,36 +28,36 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
28
28
  */
29
29
 
30
30
  function addLocaleData() {
31
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
31
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
32
32
 
33
- var locales = Array.isArray(data) ? data : [data];
33
+ var locales = Array.isArray(data) ? data : [data];
34
34
 
35
- locales.forEach(function (localeData) {
36
- if (localeData && localeData.locale) {
37
- IntlMessageFormat.__addLocaleData(localeData);
38
- IntlRelativeFormat.__addLocaleData(localeData);
39
- }
40
- });
35
+ locales.forEach(function (localeData) {
36
+ if (localeData && localeData.locale) {
37
+ IntlMessageFormat.__addLocaleData(localeData);
38
+ IntlRelativeFormat.__addLocaleData(localeData);
39
+ }
40
+ });
41
41
  }
42
42
 
43
43
  function hasLocaleData(locale) {
44
- var localeParts = (locale || '').split('-');
44
+ var localeParts = (locale || '').split('-');
45
45
 
46
- while (localeParts.length > 0) {
47
- if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
48
- return true;
49
- }
50
-
51
- localeParts.pop();
46
+ while (localeParts.length > 0) {
47
+ if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
48
+ return true;
52
49
  }
53
50
 
54
- return false;
51
+ localeParts.pop();
52
+ }
53
+
54
+ return false;
55
55
  }
56
56
 
57
57
  function hasIMFAndIRFLocaleData(locale) {
58
- var normalizedLocale = locale && locale.toLowerCase();
58
+ var normalizedLocale = locale && locale.toLowerCase();
59
59
 
60
- return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
60
+ return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
61
61
  }
62
62
 
63
63
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
@@ -221,6 +221,7 @@ var object = PropTypes.object;
221
221
  var oneOf = PropTypes.oneOf;
222
222
  var shape = PropTypes.shape;
223
223
  var any = PropTypes.any;
224
+ var oneOfType = PropTypes.oneOfType;
224
225
 
225
226
  var localeMatcher = oneOf(['best fit', 'lookup']);
226
227
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -228,76 +229,76 @@ var numeric2digit = oneOf(['numeric', '2-digit']);
228
229
  var funcReq = func.isRequired;
229
230
 
230
231
  var intlConfigPropTypes = {
231
- locale: string,
232
- formats: object,
233
- messages: object,
234
- textComponent: any,
232
+ locale: string,
233
+ formats: object,
234
+ messages: object,
235
+ textComponent: any,
235
236
 
236
- defaultLocale: string,
237
- defaultFormats: object
237
+ defaultLocale: string,
238
+ defaultFormats: object
238
239
  };
239
240
 
240
241
  var intlFormatPropTypes = {
241
- formatDate: funcReq,
242
- formatTime: funcReq,
243
- formatRelative: funcReq,
244
- formatNumber: funcReq,
245
- formatPlural: funcReq,
246
- formatMessage: funcReq,
247
- formatHTMLMessage: funcReq
242
+ formatDate: funcReq,
243
+ formatTime: funcReq,
244
+ formatRelative: funcReq,
245
+ formatNumber: funcReq,
246
+ formatPlural: funcReq,
247
+ formatMessage: funcReq,
248
+ formatHTMLMessage: funcReq
248
249
  };
249
250
 
250
251
  var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
251
- formatters: object,
252
- now: funcReq
252
+ formatters: object,
253
+ now: funcReq
253
254
  }));
254
255
 
255
256
  var messageDescriptorPropTypes = {
256
- id: string.isRequired,
257
- description: string,
258
- defaultMessage: string
257
+ id: string.isRequired,
258
+ description: oneOfType([string, object]),
259
+ defaultMessage: string
259
260
  };
260
261
 
261
262
  var dateTimeFormatPropTypes = {
262
- localeMatcher: localeMatcher,
263
- formatMatcher: oneOf(['basic', 'best fit']),
264
-
265
- timeZone: string,
266
- hour12: bool,
267
-
268
- weekday: narrowShortLong,
269
- era: narrowShortLong,
270
- year: numeric2digit,
271
- month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
272
- day: numeric2digit,
273
- hour: numeric2digit,
274
- minute: numeric2digit,
275
- second: numeric2digit,
276
- timeZoneName: oneOf(['short', 'long'])
263
+ localeMatcher: localeMatcher,
264
+ formatMatcher: oneOf(['basic', 'best fit']),
265
+
266
+ timeZone: string,
267
+ hour12: bool,
268
+
269
+ weekday: narrowShortLong,
270
+ era: narrowShortLong,
271
+ year: numeric2digit,
272
+ month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
273
+ day: numeric2digit,
274
+ hour: numeric2digit,
275
+ minute: numeric2digit,
276
+ second: numeric2digit,
277
+ timeZoneName: oneOf(['short', 'long'])
277
278
  };
278
279
 
279
280
  var numberFormatPropTypes = {
280
- localeMatcher: localeMatcher,
281
-
282
- style: oneOf(['decimal', 'currency', 'percent']),
283
- currency: string,
284
- currencyDisplay: oneOf(['symbol', 'code', 'name']),
285
- useGrouping: bool,
286
-
287
- minimumIntegerDigits: number,
288
- minimumFractionDigits: number,
289
- maximumFractionDigits: number,
290
- minimumSignificantDigits: number,
291
- maximumSignificantDigits: number
281
+ localeMatcher: localeMatcher,
282
+
283
+ style: oneOf(['decimal', 'currency', 'percent']),
284
+ currency: string,
285
+ currencyDisplay: oneOf(['symbol', 'code', 'name']),
286
+ useGrouping: bool,
287
+
288
+ minimumIntegerDigits: number,
289
+ minimumFractionDigits: number,
290
+ maximumFractionDigits: number,
291
+ minimumSignificantDigits: number,
292
+ maximumSignificantDigits: number
292
293
  };
293
294
 
294
295
  var relativeFormatPropTypes = {
295
- style: oneOf(['best fit', 'numeric']),
296
- units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
296
+ style: oneOf(['best fit', 'numeric']),
297
+ units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
297
298
  };
298
299
 
299
300
  var pluralFormatPropTypes = {
300
- style: oneOf(['cardinal', 'ordinal'])
301
+ style: oneOf(['cardinal', 'ordinal'])
301
302
  };
302
303
 
303
304
  /*
@@ -314,82 +315,82 @@ file in the root directory of React's source tree.
314
315
  var intlConfigPropNames = Object.keys(intlConfigPropTypes);
315
316
 
316
317
  var ESCAPED_CHARS = {
317
- '&': '&',
318
- '>': '>',
319
- '<': '&lt;',
320
- '"': '&quot;',
321
- '\'': '&#x27;'
318
+ '&': '&amp;',
319
+ '>': '&gt;',
320
+ '<': '&lt;',
321
+ '"': '&quot;',
322
+ "'": '&#x27;'
322
323
  };
323
324
 
324
325
  var UNSAFE_CHARS_REGEX = /[&><"']/g;
325
326
 
326
327
  function escape(str) {
327
- return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
328
- return ESCAPED_CHARS[match];
329
- });
328
+ return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
329
+ return ESCAPED_CHARS[match];
330
+ });
330
331
  }
331
332
 
332
333
  function filterProps(props, whitelist) {
333
- var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
334
+ var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
334
335
 
335
- return whitelist.reduce(function (filtered, name) {
336
- if (props.hasOwnProperty(name)) {
337
- filtered[name] = props[name];
338
- } else if (defaults$$1.hasOwnProperty(name)) {
339
- filtered[name] = defaults$$1[name];
340
- }
336
+ return whitelist.reduce(function (filtered, name) {
337
+ if (props.hasOwnProperty(name)) {
338
+ filtered[name] = props[name];
339
+ } else if (defaults$$1.hasOwnProperty(name)) {
340
+ filtered[name] = defaults$$1[name];
341
+ }
341
342
 
342
- return filtered;
343
- }, {});
343
+ return filtered;
344
+ }, {});
344
345
  }
345
346
 
346
347
  function invariantIntlContext() {
347
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
348
- intl = _ref.intl;
348
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
349
+ intl = _ref.intl;
349
350
 
350
- invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
351
+ invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
351
352
  }
352
353
 
353
354
  function shallowEquals(objA, objB) {
354
- if (objA === objB) {
355
- return true;
356
- }
355
+ if (objA === objB) {
356
+ return true;
357
+ }
357
358
 
358
- if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
359
- return false;
360
- }
359
+ if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
360
+ return false;
361
+ }
361
362
 
362
- var keysA = Object.keys(objA);
363
- var keysB = Object.keys(objB);
363
+ var keysA = Object.keys(objA);
364
+ var keysB = Object.keys(objB);
364
365
 
365
- if (keysA.length !== keysB.length) {
366
- return false;
367
- }
366
+ if (keysA.length !== keysB.length) {
367
+ return false;
368
+ }
368
369
 
369
- // Test for A's keys different from B.
370
- var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
371
- for (var i = 0; i < keysA.length; i++) {
372
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
373
- return false;
374
- }
370
+ // Test for A's keys different from B.
371
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
372
+ for (var i = 0; i < keysA.length; i++) {
373
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
374
+ return false;
375
375
  }
376
+ }
376
377
 
377
- return true;
378
+ return true;
378
379
  }
379
380
 
380
381
  function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
381
- var props = _ref2.props,
382
- state = _ref2.state,
383
- _ref2$context = _ref2.context,
384
- context = _ref2$context === undefined ? {} : _ref2$context;
385
- var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
386
- var _context$intl = context.intl,
387
- intl = _context$intl === undefined ? {} : _context$intl;
388
- var _nextContext$intl = nextContext.intl,
389
- nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
390
-
391
-
392
- return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
382
+ var props = _ref2.props,
383
+ state = _ref2.state,
384
+ _ref2$context = _ref2.context,
385
+ context = _ref2$context === undefined ? {} : _ref2$context;
386
+ var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
387
+ var _context$intl = context.intl,
388
+ intl = _context$intl === undefined ? {} : _context$intl;
389
+ var _nextContext$intl = nextContext.intl,
390
+ nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
391
+
392
+
393
+ return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
393
394
  }
394
395
 
395
396
  /*
@@ -402,54 +403,54 @@ function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
402
403
  // https://github.com/rackt/react-redux
403
404
 
404
405
  function getDisplayName(Component$$1) {
405
- return Component$$1.displayName || Component$$1.name || 'Component';
406
+ return Component$$1.displayName || Component$$1.name || 'Component';
406
407
  }
407
408
 
408
409
  function injectIntl(WrappedComponent) {
409
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
410
- var _options$intlPropName = options.intlPropName,
411
- intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
412
- _options$withRef = options.withRef,
413
- withRef = _options$withRef === undefined ? false : _options$withRef;
410
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
411
+ var _options$intlPropName = options.intlPropName,
412
+ intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
413
+ _options$withRef = options.withRef,
414
+ withRef = _options$withRef === undefined ? false : _options$withRef;
414
415
 
415
- var InjectIntl = function (_Component) {
416
- inherits(InjectIntl, _Component);
416
+ var InjectIntl = function (_Component) {
417
+ inherits(InjectIntl, _Component);
417
418
 
418
- function InjectIntl(props, context) {
419
- classCallCheck(this, InjectIntl);
419
+ function InjectIntl(props, context) {
420
+ classCallCheck(this, InjectIntl);
420
421
 
421
- var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
422
+ var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
422
423
 
423
- invariantIntlContext(context);
424
- return _this;
425
- }
426
-
427
- createClass(InjectIntl, [{
428
- key: 'getWrappedInstance',
429
- value: function getWrappedInstance() {
430
- invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
431
-
432
- return this.refs.wrappedInstance;
433
- }
434
- }, {
435
- key: 'render',
436
- value: function render() {
437
- return React.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
438
- ref: withRef ? 'wrappedInstance' : null
439
- }));
440
- }
441
- }]);
442
- return InjectIntl;
443
- }(Component);
444
-
445
- InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
446
- InjectIntl.contextTypes = {
447
- intl: intlShape
448
- };
449
- InjectIntl.WrappedComponent = WrappedComponent;
424
+ invariantIntlContext(context);
425
+ return _this;
426
+ }
450
427
 
428
+ createClass(InjectIntl, [{
429
+ key: 'getWrappedInstance',
430
+ value: function getWrappedInstance() {
431
+ invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
451
432
 
433
+ return this.refs.wrappedInstance;
434
+ }
435
+ }, {
436
+ key: 'render',
437
+ value: function render() {
438
+ return React.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
439
+ ref: withRef ? 'wrappedInstance' : null
440
+ }));
441
+ }
442
+ }]);
452
443
  return InjectIntl;
444
+ }(Component);
445
+
446
+ InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
447
+ InjectIntl.contextTypes = {
448
+ intl: intlShape
449
+ };
450
+ InjectIntl.WrappedComponent = WrappedComponent;
451
+
452
+
453
+ return InjectIntl;
453
454
  }
454
455
 
455
456
  /*
@@ -473,25 +474,25 @@ function defineMessages(messageDescriptors) {
473
474
  // This is a "hack" until a proper `intl-pluralformat` package is created.
474
475
 
475
476
  function resolveLocale(locales) {
476
- // IntlMessageFormat#_resolveLocale() does not depend on `this`.
477
- return IntlMessageFormat.prototype._resolveLocale(locales);
477
+ // IntlMessageFormat#_resolveLocale() does not depend on `this`.
478
+ return IntlMessageFormat.prototype._resolveLocale(locales);
478
479
  }
479
480
 
480
481
  function findPluralFunction(locale) {
481
- // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
482
- return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
482
+ // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
483
+ return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
483
484
  }
484
485
 
485
486
  var IntlPluralFormat = function IntlPluralFormat(locales) {
486
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
487
- classCallCheck(this, IntlPluralFormat);
487
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
488
+ classCallCheck(this, IntlPluralFormat);
488
489
 
489
- var useOrdinal = options.style === 'ordinal';
490
- var pluralFn = findPluralFunction(resolveLocale(locales));
490
+ var useOrdinal = options.style === 'ordinal';
491
+ var pluralFn = findPluralFunction(resolveLocale(locales));
491
492
 
492
- this.format = function (value) {
493
- return pluralFn(value, useOrdinal);
494
- };
493
+ this.format = function (value) {
494
+ return pluralFn(value, useOrdinal);
495
+ };
495
496
  };
496
497
 
497
498
  /*
@@ -506,234 +507,234 @@ var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes);
506
507
  var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes);
507
508
 
508
509
  var RELATIVE_FORMAT_THRESHOLDS = {
509
- second: 60, // seconds to minute
510
- minute: 60, // minutes to hour
511
- hour: 24, // hours to day
512
- day: 30, // days to month
513
- month: 12 };
510
+ second: 60, // seconds to minute
511
+ minute: 60, // minutes to hour
512
+ hour: 24, // hours to day
513
+ day: 30, // days to month
514
+ month: 12 // months to year
515
+ };
514
516
 
515
517
  function updateRelativeFormatThresholds(newThresholds) {
516
- var thresholds = IntlRelativeFormat.thresholds;
517
- thresholds.second = newThresholds.second;
518
- thresholds.minute = newThresholds.minute;
519
- thresholds.hour = newThresholds.hour;
520
- thresholds.day = newThresholds.day;
521
- thresholds.month = newThresholds.month;
518
+ var thresholds = IntlRelativeFormat.thresholds;
519
+ thresholds.second = newThresholds.second;
520
+ thresholds.minute = newThresholds.minute;
521
+ thresholds.hour = newThresholds.hour;
522
+ thresholds.day = newThresholds.day;
523
+ thresholds.month = newThresholds.month;
522
524
  }
523
525
 
524
526
  function getNamedFormat(formats, type, name) {
525
- var format = formats && formats[type] && formats[type][name];
526
- if (format) {
527
- return format;
528
- }
527
+ var format = formats && formats[type] && formats[type][name];
528
+ if (format) {
529
+ return format;
530
+ }
529
531
 
530
- if (process.env.NODE_ENV !== 'production') {
531
- console.error('[React Intl] No ' + type + ' format named: ' + name);
532
- }
532
+ if (process.env.NODE_ENV !== 'production') {
533
+ console.error('[React Intl] No ' + type + ' format named: ' + name);
534
+ }
533
535
  }
534
536
 
535
537
  function formatDate(config, state, value) {
536
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
537
- var locale = config.locale,
538
- formats = config.formats;
539
- var format = options.format;
538
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
539
+ var locale = config.locale,
540
+ formats = config.formats;
541
+ var format = options.format;
540
542
 
541
543
 
542
- var date = new Date(value);
543
- var defaults$$1 = format && getNamedFormat(formats, 'date', format);
544
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
544
+ var date = new Date(value);
545
+ var defaults$$1 = format && getNamedFormat(formats, 'date', format);
546
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
545
547
 
546
- try {
547
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
548
- } catch (e) {
549
- if (process.env.NODE_ENV !== 'production') {
550
- console.error('[React Intl] Error formatting date.\n' + e);
551
- }
548
+ try {
549
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
550
+ } catch (e) {
551
+ if (process.env.NODE_ENV !== 'production') {
552
+ console.error('[React Intl] Error formatting date.\n' + e);
552
553
  }
554
+ }
553
555
 
554
- return String(date);
556
+ return String(date);
555
557
  }
556
558
 
557
559
  function formatTime(config, state, value) {
558
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
559
- var locale = config.locale,
560
- formats = config.formats;
561
- var format = options.format;
560
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
561
+ var locale = config.locale,
562
+ formats = config.formats;
563
+ var format = options.format;
562
564
 
563
565
 
564
- var date = new Date(value);
565
- var defaults$$1 = format && getNamedFormat(formats, 'time', format);
566
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
566
+ var date = new Date(value);
567
+ var defaults$$1 = format && getNamedFormat(formats, 'time', format);
568
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
567
569
 
568
- if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
569
- // Add default formatting options if hour, minute, or second isn't defined.
570
- filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
571
- }
570
+ if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
571
+ // Add default formatting options if hour, minute, or second isn't defined.
572
+ filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
573
+ }
572
574
 
573
- try {
574
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
575
- } catch (e) {
576
- if (process.env.NODE_ENV !== 'production') {
577
- console.error('[React Intl] Error formatting time.\n' + e);
578
- }
575
+ try {
576
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
577
+ } catch (e) {
578
+ if (process.env.NODE_ENV !== 'production') {
579
+ console.error('[React Intl] Error formatting time.\n' + e);
579
580
  }
581
+ }
580
582
 
581
- return String(date);
583
+ return String(date);
582
584
  }
583
585
 
584
586
  function formatRelative(config, state, value) {
585
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
586
- var locale = config.locale,
587
- formats = config.formats;
588
- var format = options.format;
587
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
588
+ var locale = config.locale,
589
+ formats = config.formats;
590
+ var format = options.format;
589
591
 
590
592
 
591
- var date = new Date(value);
592
- var now = new Date(options.now);
593
- var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
594
- var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
593
+ var date = new Date(value);
594
+ var now = new Date(options.now);
595
+ var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
596
+ var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
595
597
 
596
- // Capture the current threshold values, then temporarily override them with
597
- // specific values just for this render.
598
- var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
599
- updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
598
+ // Capture the current threshold values, then temporarily override them with
599
+ // specific values just for this render.
600
+ var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
601
+ updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
600
602
 
601
- try {
602
- return state.getRelativeFormat(locale, filteredOptions).format(date, {
603
- now: isFinite(now) ? now : state.now()
604
- });
605
- } catch (e) {
606
- if (process.env.NODE_ENV !== 'production') {
607
- console.error('[React Intl] Error formatting relative time.\n' + e);
608
- }
609
- } finally {
610
- updateRelativeFormatThresholds(oldThresholds);
603
+ try {
604
+ return state.getRelativeFormat(locale, filteredOptions).format(date, {
605
+ now: isFinite(now) ? now : state.now()
606
+ });
607
+ } catch (e) {
608
+ if (process.env.NODE_ENV !== 'production') {
609
+ console.error('[React Intl] Error formatting relative time.\n' + e);
611
610
  }
611
+ } finally {
612
+ updateRelativeFormatThresholds(oldThresholds);
613
+ }
612
614
 
613
- return String(date);
615
+ return String(date);
614
616
  }
615
617
 
616
618
  function formatNumber(config, state, value) {
617
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
618
- var locale = config.locale,
619
- formats = config.formats;
620
- var format = options.format;
619
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
620
+ var locale = config.locale,
621
+ formats = config.formats;
622
+ var format = options.format;
621
623
 
622
624
 
623
- var defaults$$1 = format && getNamedFormat(formats, 'number', format);
624
- var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
625
+ var defaults$$1 = format && getNamedFormat(formats, 'number', format);
626
+ var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
625
627
 
626
- try {
627
- return state.getNumberFormat(locale, filteredOptions).format(value);
628
- } catch (e) {
629
- if (process.env.NODE_ENV !== 'production') {
630
- console.error('[React Intl] Error formatting number.\n' + e);
631
- }
628
+ try {
629
+ return state.getNumberFormat(locale, filteredOptions).format(value);
630
+ } catch (e) {
631
+ if (process.env.NODE_ENV !== 'production') {
632
+ console.error('[React Intl] Error formatting number.\n' + e);
632
633
  }
634
+ }
633
635
 
634
- return String(value);
636
+ return String(value);
635
637
  }
636
638
 
637
639
  function formatPlural(config, state, value) {
638
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
639
- var locale = config.locale;
640
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
641
+ var locale = config.locale;
640
642
 
641
643
 
642
- var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
644
+ var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
643
645
 
644
- try {
645
- return state.getPluralFormat(locale, filteredOptions).format(value);
646
- } catch (e) {
647
- if (process.env.NODE_ENV !== 'production') {
648
- console.error('[React Intl] Error formatting plural.\n' + e);
649
- }
646
+ try {
647
+ return state.getPluralFormat(locale, filteredOptions).format(value);
648
+ } catch (e) {
649
+ if (process.env.NODE_ENV !== 'production') {
650
+ console.error('[React Intl] Error formatting plural.\n' + e);
650
651
  }
652
+ }
651
653
 
652
- return 'other';
654
+ return 'other';
653
655
  }
654
656
 
655
657
  function formatMessage(config, state) {
656
- var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
657
- var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
658
- var locale = config.locale,
659
- formats = config.formats,
660
- messages = config.messages,
661
- defaultLocale = config.defaultLocale,
662
- defaultFormats = config.defaultFormats;
663
- var id = messageDescriptor.id,
664
- defaultMessage = messageDescriptor.defaultMessage;
665
-
666
- // `id` is a required field of a Message Descriptor.
667
-
668
- invariant(id, '[React Intl] An `id` must be provided to format a message.');
669
-
670
- var message = messages && messages[id];
671
- var hasValues = Object.keys(values).length > 0;
672
-
673
- // Avoid expensive message formatting for simple messages without values. In
674
- // development messages will always be formatted in case of missing values.
675
- if (!hasValues && process.env.NODE_ENV === 'production') {
676
- return message || defaultMessage || id;
677
- }
678
-
679
- var formattedMessage = void 0;
658
+ var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
659
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
660
+ var locale = config.locale,
661
+ formats = config.formats,
662
+ messages = config.messages,
663
+ defaultLocale = config.defaultLocale,
664
+ defaultFormats = config.defaultFormats;
665
+ var id = messageDescriptor.id,
666
+ defaultMessage = messageDescriptor.defaultMessage;
667
+
668
+ // `id` is a required field of a Message Descriptor.
669
+
670
+ invariant(id, '[React Intl] An `id` must be provided to format a message.');
671
+
672
+ var message = messages && messages[id];
673
+ var hasValues = Object.keys(values).length > 0;
674
+
675
+ // Avoid expensive message formatting for simple messages without values. In
676
+ // development messages will always be formatted in case of missing values.
677
+ if (!hasValues && process.env.NODE_ENV === 'production') {
678
+ return message || defaultMessage || id;
679
+ }
680
680
 
681
- if (message) {
682
- try {
683
- var formatter = state.getMessageFormat(message, locale, formats);
681
+ var formattedMessage = void 0;
684
682
 
685
- formattedMessage = formatter.format(values);
686
- } catch (e) {
687
- if (process.env.NODE_ENV !== 'production') {
688
- console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
689
- }
690
- }
691
- } else {
692
- if (process.env.NODE_ENV !== 'production') {
693
- // This prevents warnings from littering the console in development
694
- // when no `messages` are passed into the <IntlProvider> for the
695
- // default locale, and a default message is in the source.
696
- if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
683
+ if (message) {
684
+ try {
685
+ var formatter = state.getMessageFormat(message, locale, formats);
697
686
 
698
- console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
699
- }
700
- }
687
+ formattedMessage = formatter.format(values);
688
+ } catch (e) {
689
+ if (process.env.NODE_ENV !== 'production') {
690
+ console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
691
+ }
701
692
  }
693
+ } else {
694
+ if (process.env.NODE_ENV !== 'production') {
695
+ // This prevents warnings from littering the console in development
696
+ // when no `messages` are passed into the <IntlProvider> for the
697
+ // default locale, and a default message is in the source.
698
+ if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
699
+ console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
700
+ }
701
+ }
702
+ }
702
703
 
703
- if (!formattedMessage && defaultMessage) {
704
- try {
705
- var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
704
+ if (!formattedMessage && defaultMessage) {
705
+ try {
706
+ var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
706
707
 
707
- formattedMessage = _formatter.format(values);
708
- } catch (e) {
709
- if (process.env.NODE_ENV !== 'production') {
710
- console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
711
- }
712
- }
708
+ formattedMessage = _formatter.format(values);
709
+ } catch (e) {
710
+ if (process.env.NODE_ENV !== 'production') {
711
+ console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
712
+ }
713
713
  }
714
+ }
714
715
 
715
- if (!formattedMessage) {
716
- if (process.env.NODE_ENV !== 'production') {
717
- console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
718
- }
716
+ if (!formattedMessage) {
717
+ if (process.env.NODE_ENV !== 'production') {
718
+ console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
719
719
  }
720
+ }
720
721
 
721
- return formattedMessage || message || defaultMessage || id;
722
+ return formattedMessage || message || defaultMessage || id;
722
723
  }
723
724
 
724
725
  function formatHTMLMessage(config, state, messageDescriptor) {
725
- var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
726
-
727
- // Process all the values before they are used when formatting the ICU
728
- // Message string. Since the formatted message might be injected via
729
- // `innerHTML`, all String-based values need to be HTML-escaped.
730
- var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
731
- var value = rawValues[name];
732
- escaped[name] = typeof value === 'string' ? escape(value) : value;
733
- return escaped;
734
- }, {});
735
-
736
- return formatMessage(config, state, messageDescriptor, escapedValues);
726
+ var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
727
+
728
+ // Process all the values before they are used when formatting the ICU
729
+ // Message string. Since the formatted message might be injected via
730
+ // `innerHTML`, all String-based values need to be HTML-escaped.
731
+ var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
732
+ var value = rawValues[name];
733
+ escaped[name] = typeof value === 'string' ? escape(value) : value;
734
+ return escaped;
735
+ }, {});
736
+
737
+ return formatMessage(config, state, messageDescriptor, escapedValues);
737
738
  }
738
739
 
739
740
 
@@ -760,170 +761,170 @@ var intlFormatPropNames = Object.keys(intlFormatPropTypes);
760
761
  // These are not a static property on the `IntlProvider` class so the intl
761
762
  // config values can be inherited from an <IntlProvider> ancestor.
762
763
  var defaultProps = {
763
- formats: {},
764
- messages: {},
765
- textComponent: 'span',
764
+ formats: {},
765
+ messages: {},
766
+ textComponent: 'span',
766
767
 
767
- defaultLocale: 'en',
768
- defaultFormats: {}
768
+ defaultLocale: 'en',
769
+ defaultFormats: {}
769
770
  };
770
771
 
771
772
  var IntlProvider = function (_Component) {
772
- inherits(IntlProvider, _Component);
773
-
774
- function IntlProvider(props) {
775
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
776
- classCallCheck(this, IntlProvider);
773
+ inherits(IntlProvider, _Component);
777
774
 
778
- var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
775
+ function IntlProvider(props) {
776
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
777
+ classCallCheck(this, IntlProvider);
779
778
 
780
- invariant(typeof Intl !== 'undefined', '[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.\n' + 'See: http://formatjs.io/guides/runtime-environments/');
779
+ var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
781
780
 
782
- var intlContext = context.intl;
781
+ invariant(typeof Intl !== 'undefined', '[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.\n' + 'See: http://formatjs.io/guides/runtime-environments/');
783
782
 
784
- // Used to stabilize time when performing an initial rendering so that
785
- // all relative times use the same reference "now" time.
783
+ var intlContext = context.intl;
786
784
 
787
- var initialNow = void 0;
788
- if (isFinite(props.initialNow)) {
789
- initialNow = Number(props.initialNow);
790
- } else {
791
- // When an `initialNow` isn't provided via `props`, look to see an
792
- // <IntlProvider> exists in the ancestry and call its `now()`
793
- // function to propagate its value for "now".
794
- initialNow = intlContext ? intlContext.now() : Date.now();
795
- }
785
+ // Used to stabilize time when performing an initial rendering so that
786
+ // all relative times use the same reference "now" time.
796
787
 
797
- // Creating `Intl*` formatters is expensive. If there's a parent
798
- // `<IntlProvider>`, then its formatters will be used. Otherwise, this
799
- // memoize the `Intl*` constructors and cache them for the lifecycle of
800
- // this IntlProvider instance.
801
-
802
- var _ref = intlContext || {},
803
- _ref$formatters = _ref.formatters,
804
- formatters = _ref$formatters === undefined ? {
805
- getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
806
- getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
807
- getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
808
- getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
809
- getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
810
- } : _ref$formatters;
811
-
812
- _this.state = _extends({}, formatters, {
813
-
814
- // Wrapper to provide stable "now" time for initial render.
815
- now: function now() {
816
- return _this._didDisplay ? Date.now() : initialNow;
817
- }
818
- });
819
- return _this;
788
+ var initialNow = void 0;
789
+ if (isFinite(props.initialNow)) {
790
+ initialNow = Number(props.initialNow);
791
+ } else {
792
+ // When an `initialNow` isn't provided via `props`, look to see an
793
+ // <IntlProvider> exists in the ancestry and call its `now()`
794
+ // function to propagate its value for "now".
795
+ initialNow = intlContext ? intlContext.now() : Date.now();
820
796
  }
821
797
 
822
- createClass(IntlProvider, [{
823
- key: 'getConfig',
824
- value: function getConfig() {
825
- var intlContext = this.context.intl;
826
-
827
- // Build a whitelisted config object from `props`, defaults, and
828
- // `context.intl`, if an <IntlProvider> exists in the ancestry.
829
-
830
- var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
831
-
832
- // Apply default props. This must be applied last after the props have
833
- // been resolved and inherited from any <IntlProvider> in the ancestry.
834
- // This matches how React resolves `defaultProps`.
835
- for (var propName in defaultProps) {
836
- if (config[propName] === undefined) {
837
- config[propName] = defaultProps[propName];
838
- }
839
- }
840
-
841
- if (!hasLocaleData(config.locale)) {
842
- var _config = config,
843
- locale = _config.locale,
844
- defaultLocale = _config.defaultLocale,
845
- defaultFormats = _config.defaultFormats;
846
-
847
-
848
- if (process.env.NODE_ENV !== 'production') {
849
- console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
850
- }
851
-
852
- // Since there's no registered locale data for `locale`, this will
853
- // fallback to the `defaultLocale` to make sure things can render.
854
- // The `messages` are overridden to the `defaultProps` empty object
855
- // to maintain referential equality across re-renders. It's assumed
856
- // each <FormattedMessage> contains a `defaultMessage` prop.
857
- config = _extends({}, config, {
858
- locale: defaultLocale,
859
- formats: defaultFormats,
860
- messages: defaultProps.messages
861
- });
862
- }
863
-
864
- return config;
865
- }
866
- }, {
867
- key: 'getBoundFormatFns',
868
- value: function getBoundFormatFns(config, state) {
869
- return intlFormatPropNames.reduce(function (boundFormatFns, name) {
870
- boundFormatFns[name] = format[name].bind(null, config, state);
871
- return boundFormatFns;
872
- }, {});
873
- }
874
- }, {
875
- key: 'getChildContext',
876
- value: function getChildContext() {
877
- var config = this.getConfig();
798
+ // Creating `Intl*` formatters is expensive. If there's a parent
799
+ // `<IntlProvider>`, then its formatters will be used. Otherwise, this
800
+ // memoize the `Intl*` constructors and cache them for the lifecycle of
801
+ // this IntlProvider instance.
802
+
803
+ var _ref = intlContext || {},
804
+ _ref$formatters = _ref.formatters,
805
+ formatters = _ref$formatters === undefined ? {
806
+ getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
807
+ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
808
+ getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
809
+ getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
810
+ getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
811
+ } : _ref$formatters;
812
+
813
+ _this.state = _extends({}, formatters, {
814
+
815
+ // Wrapper to provide stable "now" time for initial render.
816
+ now: function now() {
817
+ return _this._didDisplay ? Date.now() : initialNow;
818
+ }
819
+ });
820
+ return _this;
821
+ }
878
822
 
879
- // Bind intl factories and current config to the format functions.
880
- var boundFormatFns = this.getBoundFormatFns(config, this.state);
823
+ createClass(IntlProvider, [{
824
+ key: 'getConfig',
825
+ value: function getConfig() {
826
+ var intlContext = this.context.intl;
881
827
 
882
- var _state = this.state,
883
- now = _state.now,
884
- formatters = objectWithoutProperties(_state, ['now']);
828
+ // Build a whitelisted config object from `props`, defaults, and
829
+ // `context.intl`, if an <IntlProvider> exists in the ancestry.
885
830
 
831
+ var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
886
832
 
887
- return {
888
- intl: _extends({}, config, boundFormatFns, {
889
- formatters: formatters,
890
- now: now
891
- })
892
- };
833
+ // Apply default props. This must be applied last after the props have
834
+ // been resolved and inherited from any <IntlProvider> in the ancestry.
835
+ // This matches how React resolves `defaultProps`.
836
+ for (var propName in defaultProps) {
837
+ if (config[propName] === undefined) {
838
+ config[propName] = defaultProps[propName];
893
839
  }
894
- }, {
895
- key: 'shouldComponentUpdate',
896
- value: function shouldComponentUpdate() {
897
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
898
- next[_key] = arguments[_key];
899
- }
840
+ }
900
841
 
901
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
902
- }
903
- }, {
904
- key: 'componentDidMount',
905
- value: function componentDidMount() {
906
- this._didDisplay = true;
907
- }
908
- }, {
909
- key: 'render',
910
- value: function render() {
911
- return Children.only(this.props.children);
842
+ if (!hasLocaleData(config.locale)) {
843
+ var _config = config,
844
+ locale = _config.locale,
845
+ defaultLocale = _config.defaultLocale,
846
+ defaultFormats = _config.defaultFormats;
847
+
848
+
849
+ if (process.env.NODE_ENV !== 'production') {
850
+ console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
912
851
  }
913
- }]);
914
- return IntlProvider;
852
+
853
+ // Since there's no registered locale data for `locale`, this will
854
+ // fallback to the `defaultLocale` to make sure things can render.
855
+ // The `messages` are overridden to the `defaultProps` empty object
856
+ // to maintain referential equality across re-renders. It's assumed
857
+ // each <FormattedMessage> contains a `defaultMessage` prop.
858
+ config = _extends({}, config, {
859
+ locale: defaultLocale,
860
+ formats: defaultFormats,
861
+ messages: defaultProps.messages
862
+ });
863
+ }
864
+
865
+ return config;
866
+ }
867
+ }, {
868
+ key: 'getBoundFormatFns',
869
+ value: function getBoundFormatFns(config, state) {
870
+ return intlFormatPropNames.reduce(function (boundFormatFns, name) {
871
+ boundFormatFns[name] = format[name].bind(null, config, state);
872
+ return boundFormatFns;
873
+ }, {});
874
+ }
875
+ }, {
876
+ key: 'getChildContext',
877
+ value: function getChildContext() {
878
+ var config = this.getConfig();
879
+
880
+ // Bind intl factories and current config to the format functions.
881
+ var boundFormatFns = this.getBoundFormatFns(config, this.state);
882
+
883
+ var _state = this.state,
884
+ now = _state.now,
885
+ formatters = objectWithoutProperties(_state, ['now']);
886
+
887
+
888
+ return {
889
+ intl: _extends({}, config, boundFormatFns, {
890
+ formatters: formatters,
891
+ now: now
892
+ })
893
+ };
894
+ }
895
+ }, {
896
+ key: 'shouldComponentUpdate',
897
+ value: function shouldComponentUpdate() {
898
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
899
+ next[_key] = arguments[_key];
900
+ }
901
+
902
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
903
+ }
904
+ }, {
905
+ key: 'componentDidMount',
906
+ value: function componentDidMount() {
907
+ this._didDisplay = true;
908
+ }
909
+ }, {
910
+ key: 'render',
911
+ value: function render() {
912
+ return Children.only(this.props.children);
913
+ }
914
+ }]);
915
+ return IntlProvider;
915
916
  }(Component);
916
917
 
917
918
  IntlProvider.displayName = 'IntlProvider';
918
919
  IntlProvider.contextTypes = {
919
- intl: intlShape
920
+ intl: intlShape
920
921
  };
921
922
  IntlProvider.childContextTypes = {
922
- intl: intlShape.isRequired
923
+ intl: intlShape.isRequired
923
924
  };
924
925
  process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
925
- children: PropTypes.element.isRequired,
926
- initialNow: PropTypes.any
926
+ children: PropTypes.element.isRequired,
927
+ initialNow: PropTypes.any
927
928
  }) : void 0;
928
929
 
929
930
  /*
@@ -933,61 +934,61 @@ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, in
933
934
  */
934
935
 
935
936
  var FormattedDate = function (_Component) {
936
- inherits(FormattedDate, _Component);
937
+ inherits(FormattedDate, _Component);
938
+
939
+ function FormattedDate(props, context) {
940
+ classCallCheck(this, FormattedDate);
937
941
 
938
- function FormattedDate(props, context) {
939
- classCallCheck(this, FormattedDate);
942
+ var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
940
943
 
941
- var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
944
+ invariantIntlContext(context);
945
+ return _this;
946
+ }
942
947
 
943
- invariantIntlContext(context);
944
- return _this;
948
+ createClass(FormattedDate, [{
949
+ key: 'shouldComponentUpdate',
950
+ value: function shouldComponentUpdate() {
951
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
952
+ next[_key] = arguments[_key];
953
+ }
954
+
955
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
945
956
  }
957
+ }, {
958
+ key: 'render',
959
+ value: function render() {
960
+ var _context$intl = this.context.intl,
961
+ formatDate = _context$intl.formatDate,
962
+ Text = _context$intl.textComponent;
963
+ var _props = this.props,
964
+ value = _props.value,
965
+ children = _props.children;
946
966
 
947
- createClass(FormattedDate, [{
948
- key: 'shouldComponentUpdate',
949
- value: function shouldComponentUpdate() {
950
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
951
- next[_key] = arguments[_key];
952
- }
953
967
 
954
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
955
- }
956
- }, {
957
- key: 'render',
958
- value: function render() {
959
- var _context$intl = this.context.intl,
960
- formatDate = _context$intl.formatDate,
961
- Text = _context$intl.textComponent;
962
- var _props = this.props,
963
- value = _props.value,
964
- children = _props.children;
965
-
966
-
967
- var formattedDate = formatDate(value, this.props);
968
-
969
- if (typeof children === 'function') {
970
- return children(formattedDate);
971
- }
972
-
973
- return React.createElement(
974
- Text,
975
- null,
976
- formattedDate
977
- );
978
- }
979
- }]);
980
- return FormattedDate;
968
+ var formattedDate = formatDate(value, this.props);
969
+
970
+ if (typeof children === 'function') {
971
+ return children(formattedDate);
972
+ }
973
+
974
+ return React.createElement(
975
+ Text,
976
+ null,
977
+ formattedDate
978
+ );
979
+ }
980
+ }]);
981
+ return FormattedDate;
981
982
  }(Component);
982
983
 
983
984
  FormattedDate.displayName = 'FormattedDate';
984
985
  FormattedDate.contextTypes = {
985
- intl: intlShape
986
+ intl: intlShape
986
987
  };
987
988
  process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
988
- value: PropTypes.any.isRequired,
989
- format: PropTypes.string,
990
- children: PropTypes.func
989
+ value: PropTypes.any.isRequired,
990
+ format: PropTypes.string,
991
+ children: PropTypes.func
991
992
  }) : void 0;
992
993
 
993
994
  /*
@@ -997,61 +998,61 @@ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, d
997
998
  */
998
999
 
999
1000
  var FormattedTime = function (_Component) {
1000
- inherits(FormattedTime, _Component);
1001
+ inherits(FormattedTime, _Component);
1001
1002
 
1002
- function FormattedTime(props, context) {
1003
- classCallCheck(this, FormattedTime);
1003
+ function FormattedTime(props, context) {
1004
+ classCallCheck(this, FormattedTime);
1004
1005
 
1005
- var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1006
+ var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1006
1007
 
1007
- invariantIntlContext(context);
1008
- return _this;
1008
+ invariantIntlContext(context);
1009
+ return _this;
1010
+ }
1011
+
1012
+ createClass(FormattedTime, [{
1013
+ key: 'shouldComponentUpdate',
1014
+ value: function shouldComponentUpdate() {
1015
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1016
+ next[_key] = arguments[_key];
1017
+ }
1018
+
1019
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1009
1020
  }
1021
+ }, {
1022
+ key: 'render',
1023
+ value: function render() {
1024
+ var _context$intl = this.context.intl,
1025
+ formatTime = _context$intl.formatTime,
1026
+ Text = _context$intl.textComponent;
1027
+ var _props = this.props,
1028
+ value = _props.value,
1029
+ children = _props.children;
1010
1030
 
1011
- createClass(FormattedTime, [{
1012
- key: 'shouldComponentUpdate',
1013
- value: function shouldComponentUpdate() {
1014
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1015
- next[_key] = arguments[_key];
1016
- }
1017
1031
 
1018
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1019
- }
1020
- }, {
1021
- key: 'render',
1022
- value: function render() {
1023
- var _context$intl = this.context.intl,
1024
- formatTime = _context$intl.formatTime,
1025
- Text = _context$intl.textComponent;
1026
- var _props = this.props,
1027
- value = _props.value,
1028
- children = _props.children;
1029
-
1030
-
1031
- var formattedTime = formatTime(value, this.props);
1032
-
1033
- if (typeof children === 'function') {
1034
- return children(formattedTime);
1035
- }
1036
-
1037
- return React.createElement(
1038
- Text,
1039
- null,
1040
- formattedTime
1041
- );
1042
- }
1043
- }]);
1044
- return FormattedTime;
1032
+ var formattedTime = formatTime(value, this.props);
1033
+
1034
+ if (typeof children === 'function') {
1035
+ return children(formattedTime);
1036
+ }
1037
+
1038
+ return React.createElement(
1039
+ Text,
1040
+ null,
1041
+ formattedTime
1042
+ );
1043
+ }
1044
+ }]);
1045
+ return FormattedTime;
1045
1046
  }(Component);
1046
1047
 
1047
1048
  FormattedTime.displayName = 'FormattedTime';
1048
1049
  FormattedTime.contextTypes = {
1049
- intl: intlShape
1050
+ intl: intlShape
1050
1051
  };
1051
1052
  process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
1052
- value: PropTypes.any.isRequired,
1053
- format: PropTypes.string,
1054
- children: PropTypes.func
1053
+ value: PropTypes.any.isRequired,
1054
+ format: PropTypes.string,
1055
+ children: PropTypes.func
1055
1056
  }) : void 0;
1056
1057
 
1057
1058
  /*
@@ -1070,179 +1071,179 @@ var DAY = 1000 * 60 * 60 * 24;
1070
1071
  var MAX_TIMER_DELAY = 2147483647;
1071
1072
 
1072
1073
  function selectUnits(delta) {
1073
- var absDelta = Math.abs(delta);
1074
+ var absDelta = Math.abs(delta);
1074
1075
 
1075
- if (absDelta < MINUTE) {
1076
- return 'second';
1077
- }
1076
+ if (absDelta < MINUTE) {
1077
+ return 'second';
1078
+ }
1078
1079
 
1079
- if (absDelta < HOUR) {
1080
- return 'minute';
1081
- }
1080
+ if (absDelta < HOUR) {
1081
+ return 'minute';
1082
+ }
1082
1083
 
1083
- if (absDelta < DAY) {
1084
- return 'hour';
1085
- }
1084
+ if (absDelta < DAY) {
1085
+ return 'hour';
1086
+ }
1086
1087
 
1087
- // The maximum scheduled delay will be measured in days since the maximum
1088
- // timer delay is less than the number of milliseconds in 25 days.
1089
- return 'day';
1088
+ // The maximum scheduled delay will be measured in days since the maximum
1089
+ // timer delay is less than the number of milliseconds in 25 days.
1090
+ return 'day';
1090
1091
  }
1091
1092
 
1092
1093
  function getUnitDelay(units) {
1093
- switch (units) {
1094
- case 'second':
1095
- return SECOND;
1096
- case 'minute':
1097
- return MINUTE;
1098
- case 'hour':
1099
- return HOUR;
1100
- case 'day':
1101
- return DAY;
1102
- default:
1103
- return MAX_TIMER_DELAY;
1104
- }
1094
+ switch (units) {
1095
+ case 'second':
1096
+ return SECOND;
1097
+ case 'minute':
1098
+ return MINUTE;
1099
+ case 'hour':
1100
+ return HOUR;
1101
+ case 'day':
1102
+ return DAY;
1103
+ default:
1104
+ return MAX_TIMER_DELAY;
1105
+ }
1105
1106
  }
1106
1107
 
1107
1108
  function isSameDate(a, b) {
1108
- if (a === b) {
1109
- return true;
1110
- }
1109
+ if (a === b) {
1110
+ return true;
1111
+ }
1111
1112
 
1112
- var aTime = new Date(a).getTime();
1113
- var bTime = new Date(b).getTime();
1113
+ var aTime = new Date(a).getTime();
1114
+ var bTime = new Date(b).getTime();
1114
1115
 
1115
- return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1116
+ return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1116
1117
  }
1117
1118
 
1118
1119
  var FormattedRelative = function (_Component) {
1119
- inherits(FormattedRelative, _Component);
1120
+ inherits(FormattedRelative, _Component);
1120
1121
 
1121
- function FormattedRelative(props, context) {
1122
- classCallCheck(this, FormattedRelative);
1122
+ function FormattedRelative(props, context) {
1123
+ classCallCheck(this, FormattedRelative);
1123
1124
 
1124
- var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1125
+ var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1125
1126
 
1126
- invariantIntlContext(context);
1127
+ invariantIntlContext(context);
1127
1128
 
1128
- var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1129
+ var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1129
1130
 
1130
- // `now` is stored as state so that `render()` remains a function of
1131
- // props + state, instead of accessing `Date.now()` inside `render()`.
1132
- _this.state = { now: now };
1133
- return _this;
1134
- }
1131
+ // `now` is stored as state so that `render()` remains a function of
1132
+ // props + state, instead of accessing `Date.now()` inside `render()`.
1133
+ _this.state = { now: now };
1134
+ return _this;
1135
+ }
1135
1136
 
1136
- createClass(FormattedRelative, [{
1137
- key: 'scheduleNextUpdate',
1138
- value: function scheduleNextUpdate(props, state) {
1139
- var _this2 = this;
1137
+ createClass(FormattedRelative, [{
1138
+ key: 'scheduleNextUpdate',
1139
+ value: function scheduleNextUpdate(props, state) {
1140
+ var _this2 = this;
1140
1141
 
1141
- // Cancel and pending update because we're scheduling a new update.
1142
- clearTimeout(this._timer);
1142
+ // Cancel and pending update because we're scheduling a new update.
1143
+ clearTimeout(this._timer);
1143
1144
 
1144
- var value = props.value,
1145
- units = props.units,
1146
- updateInterval = props.updateInterval;
1145
+ var value = props.value,
1146
+ units = props.units,
1147
+ updateInterval = props.updateInterval;
1147
1148
 
1148
- var time = new Date(value).getTime();
1149
+ var time = new Date(value).getTime();
1149
1150
 
1150
- // If the `updateInterval` is falsy, including `0` or we don't have a
1151
- // valid date, then auto updates have been turned off, so we bail and
1152
- // skip scheduling an update.
1153
- if (!updateInterval || !isFinite(time)) {
1154
- return;
1155
- }
1151
+ // If the `updateInterval` is falsy, including `0` or we don't have a
1152
+ // valid date, then auto updates have been turned off, so we bail and
1153
+ // skip scheduling an update.
1154
+ if (!updateInterval || !isFinite(time)) {
1155
+ return;
1156
+ }
1156
1157
 
1157
- var delta = time - state.now;
1158
- var unitDelay = getUnitDelay(units || selectUnits(delta));
1159
- var unitRemainder = Math.abs(delta % unitDelay);
1158
+ var delta = time - state.now;
1159
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
1160
+ var unitRemainder = Math.abs(delta % unitDelay);
1160
1161
 
1161
- // We want the largest possible timer delay which will still display
1162
- // accurate information while reducing unnecessary re-renders. The delay
1163
- // should be until the next "interesting" moment, like a tick from
1164
- // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1165
- var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1162
+ // We want the largest possible timer delay which will still display
1163
+ // accurate information while reducing unnecessary re-renders. The delay
1164
+ // should be until the next "interesting" moment, like a tick from
1165
+ // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1166
+ var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1166
1167
 
1167
- this._timer = setTimeout(function () {
1168
- _this2.setState({ now: _this2.context.intl.now() });
1169
- }, delay);
1170
- }
1171
- }, {
1172
- key: 'componentDidMount',
1173
- value: function componentDidMount() {
1174
- this.scheduleNextUpdate(this.props, this.state);
1175
- }
1176
- }, {
1177
- key: 'componentWillReceiveProps',
1178
- value: function componentWillReceiveProps(_ref) {
1179
- var nextValue = _ref.value;
1180
-
1181
- // When the `props.value` date changes, `state.now` needs to be updated,
1182
- // and the next update can be rescheduled.
1183
- if (!isSameDate(nextValue, this.props.value)) {
1184
- this.setState({ now: this.context.intl.now() });
1185
- }
1186
- }
1187
- }, {
1188
- key: 'shouldComponentUpdate',
1189
- value: function shouldComponentUpdate() {
1190
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1191
- next[_key] = arguments[_key];
1192
- }
1168
+ this._timer = setTimeout(function () {
1169
+ _this2.setState({ now: _this2.context.intl.now() });
1170
+ }, delay);
1171
+ }
1172
+ }, {
1173
+ key: 'componentDidMount',
1174
+ value: function componentDidMount() {
1175
+ this.scheduleNextUpdate(this.props, this.state);
1176
+ }
1177
+ }, {
1178
+ key: 'componentWillReceiveProps',
1179
+ value: function componentWillReceiveProps(_ref) {
1180
+ var nextValue = _ref.value;
1181
+
1182
+ // When the `props.value` date changes, `state.now` needs to be updated,
1183
+ // and the next update can be rescheduled.
1184
+ if (!isSameDate(nextValue, this.props.value)) {
1185
+ this.setState({ now: this.context.intl.now() });
1186
+ }
1187
+ }
1188
+ }, {
1189
+ key: 'shouldComponentUpdate',
1190
+ value: function shouldComponentUpdate() {
1191
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1192
+ next[_key] = arguments[_key];
1193
+ }
1193
1194
 
1194
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1195
- }
1196
- }, {
1197
- key: 'componentWillUpdate',
1198
- value: function componentWillUpdate(nextProps, nextState) {
1199
- this.scheduleNextUpdate(nextProps, nextState);
1200
- }
1201
- }, {
1202
- key: 'componentWillUnmount',
1203
- value: function componentWillUnmount() {
1204
- clearTimeout(this._timer);
1205
- }
1206
- }, {
1207
- key: 'render',
1208
- value: function render() {
1209
- var _context$intl = this.context.intl,
1210
- formatRelative = _context$intl.formatRelative,
1211
- Text = _context$intl.textComponent;
1212
- var _props = this.props,
1213
- value = _props.value,
1214
- children = _props.children;
1215
-
1216
-
1217
- var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1218
-
1219
- if (typeof children === 'function') {
1220
- return children(formattedRelative);
1221
- }
1222
-
1223
- return React.createElement(
1224
- Text,
1225
- null,
1226
- formattedRelative
1227
- );
1228
- }
1229
- }]);
1230
- return FormattedRelative;
1195
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1196
+ }
1197
+ }, {
1198
+ key: 'componentWillUpdate',
1199
+ value: function componentWillUpdate(nextProps, nextState) {
1200
+ this.scheduleNextUpdate(nextProps, nextState);
1201
+ }
1202
+ }, {
1203
+ key: 'componentWillUnmount',
1204
+ value: function componentWillUnmount() {
1205
+ clearTimeout(this._timer);
1206
+ }
1207
+ }, {
1208
+ key: 'render',
1209
+ value: function render() {
1210
+ var _context$intl = this.context.intl,
1211
+ formatRelative = _context$intl.formatRelative,
1212
+ Text = _context$intl.textComponent;
1213
+ var _props = this.props,
1214
+ value = _props.value,
1215
+ children = _props.children;
1216
+
1217
+
1218
+ var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1219
+
1220
+ if (typeof children === 'function') {
1221
+ return children(formattedRelative);
1222
+ }
1223
+
1224
+ return React.createElement(
1225
+ Text,
1226
+ null,
1227
+ formattedRelative
1228
+ );
1229
+ }
1230
+ }]);
1231
+ return FormattedRelative;
1231
1232
  }(Component);
1232
1233
 
1233
1234
  FormattedRelative.displayName = 'FormattedRelative';
1234
1235
  FormattedRelative.contextTypes = {
1235
- intl: intlShape
1236
+ intl: intlShape
1236
1237
  };
1237
1238
  FormattedRelative.defaultProps = {
1238
- updateInterval: 1000 * 10
1239
+ updateInterval: 1000 * 10
1239
1240
  };
1240
1241
  process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
1241
- value: PropTypes.any.isRequired,
1242
- format: PropTypes.string,
1243
- updateInterval: PropTypes.number,
1244
- initialNow: PropTypes.any,
1245
- children: PropTypes.func
1242
+ value: PropTypes.any.isRequired,
1243
+ format: PropTypes.string,
1244
+ updateInterval: PropTypes.number,
1245
+ initialNow: PropTypes.any,
1246
+ children: PropTypes.func
1246
1247
  }) : void 0;
1247
1248
 
1248
1249
  /*
@@ -1252,61 +1253,61 @@ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({
1252
1253
  */
1253
1254
 
1254
1255
  var FormattedNumber = function (_Component) {
1255
- inherits(FormattedNumber, _Component);
1256
+ inherits(FormattedNumber, _Component);
1256
1257
 
1257
- function FormattedNumber(props, context) {
1258
- classCallCheck(this, FormattedNumber);
1258
+ function FormattedNumber(props, context) {
1259
+ classCallCheck(this, FormattedNumber);
1259
1260
 
1260
- var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1261
+ var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1261
1262
 
1262
- invariantIntlContext(context);
1263
- return _this;
1263
+ invariantIntlContext(context);
1264
+ return _this;
1265
+ }
1266
+
1267
+ createClass(FormattedNumber, [{
1268
+ key: 'shouldComponentUpdate',
1269
+ value: function shouldComponentUpdate() {
1270
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1271
+ next[_key] = arguments[_key];
1272
+ }
1273
+
1274
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1264
1275
  }
1276
+ }, {
1277
+ key: 'render',
1278
+ value: function render() {
1279
+ var _context$intl = this.context.intl,
1280
+ formatNumber = _context$intl.formatNumber,
1281
+ Text = _context$intl.textComponent;
1282
+ var _props = this.props,
1283
+ value = _props.value,
1284
+ children = _props.children;
1265
1285
 
1266
- createClass(FormattedNumber, [{
1267
- key: 'shouldComponentUpdate',
1268
- value: function shouldComponentUpdate() {
1269
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1270
- next[_key] = arguments[_key];
1271
- }
1272
1286
 
1273
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1274
- }
1275
- }, {
1276
- key: 'render',
1277
- value: function render() {
1278
- var _context$intl = this.context.intl,
1279
- formatNumber = _context$intl.formatNumber,
1280
- Text = _context$intl.textComponent;
1281
- var _props = this.props,
1282
- value = _props.value,
1283
- children = _props.children;
1284
-
1285
-
1286
- var formattedNumber = formatNumber(value, this.props);
1287
-
1288
- if (typeof children === 'function') {
1289
- return children(formattedNumber);
1290
- }
1291
-
1292
- return React.createElement(
1293
- Text,
1294
- null,
1295
- formattedNumber
1296
- );
1297
- }
1298
- }]);
1299
- return FormattedNumber;
1287
+ var formattedNumber = formatNumber(value, this.props);
1288
+
1289
+ if (typeof children === 'function') {
1290
+ return children(formattedNumber);
1291
+ }
1292
+
1293
+ return React.createElement(
1294
+ Text,
1295
+ null,
1296
+ formattedNumber
1297
+ );
1298
+ }
1299
+ }]);
1300
+ return FormattedNumber;
1300
1301
  }(Component);
1301
1302
 
1302
1303
  FormattedNumber.displayName = 'FormattedNumber';
1303
1304
  FormattedNumber.contextTypes = {
1304
- intl: intlShape
1305
+ intl: intlShape
1305
1306
  };
1306
1307
  process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
1307
- value: PropTypes.any.isRequired,
1308
- format: PropTypes.string,
1309
- children: PropTypes.func
1308
+ value: PropTypes.any.isRequired,
1309
+ format: PropTypes.string,
1310
+ children: PropTypes.func
1310
1311
  }) : void 0;
1311
1312
 
1312
1313
  /*
@@ -1316,73 +1317,73 @@ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({},
1316
1317
  */
1317
1318
 
1318
1319
  var FormattedPlural = function (_Component) {
1319
- inherits(FormattedPlural, _Component);
1320
+ inherits(FormattedPlural, _Component);
1320
1321
 
1321
- function FormattedPlural(props, context) {
1322
- classCallCheck(this, FormattedPlural);
1322
+ function FormattedPlural(props, context) {
1323
+ classCallCheck(this, FormattedPlural);
1323
1324
 
1324
- var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1325
+ var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1325
1326
 
1326
- invariantIntlContext(context);
1327
- return _this;
1328
- }
1327
+ invariantIntlContext(context);
1328
+ return _this;
1329
+ }
1329
1330
 
1330
- createClass(FormattedPlural, [{
1331
- key: 'shouldComponentUpdate',
1332
- value: function shouldComponentUpdate() {
1333
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1334
- next[_key] = arguments[_key];
1335
- }
1331
+ createClass(FormattedPlural, [{
1332
+ key: 'shouldComponentUpdate',
1333
+ value: function shouldComponentUpdate() {
1334
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1335
+ next[_key] = arguments[_key];
1336
+ }
1336
1337
 
1337
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1338
- }
1339
- }, {
1340
- key: 'render',
1341
- value: function render() {
1342
- var _context$intl = this.context.intl,
1343
- formatPlural = _context$intl.formatPlural,
1344
- Text = _context$intl.textComponent;
1345
- var _props = this.props,
1346
- value = _props.value,
1347
- other = _props.other,
1348
- children = _props.children;
1349
-
1350
-
1351
- var pluralCategory = formatPlural(value, this.props);
1352
- var formattedPlural = this.props[pluralCategory] || other;
1353
-
1354
- if (typeof children === 'function') {
1355
- return children(formattedPlural);
1356
- }
1357
-
1358
- return React.createElement(
1359
- Text,
1360
- null,
1361
- formattedPlural
1362
- );
1363
- }
1364
- }]);
1365
- return FormattedPlural;
1338
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1339
+ }
1340
+ }, {
1341
+ key: 'render',
1342
+ value: function render() {
1343
+ var _context$intl = this.context.intl,
1344
+ formatPlural = _context$intl.formatPlural,
1345
+ Text = _context$intl.textComponent;
1346
+ var _props = this.props,
1347
+ value = _props.value,
1348
+ other = _props.other,
1349
+ children = _props.children;
1350
+
1351
+
1352
+ var pluralCategory = formatPlural(value, this.props);
1353
+ var formattedPlural = this.props[pluralCategory] || other;
1354
+
1355
+ if (typeof children === 'function') {
1356
+ return children(formattedPlural);
1357
+ }
1358
+
1359
+ return React.createElement(
1360
+ Text,
1361
+ null,
1362
+ formattedPlural
1363
+ );
1364
+ }
1365
+ }]);
1366
+ return FormattedPlural;
1366
1367
  }(Component);
1367
1368
 
1368
1369
  FormattedPlural.displayName = 'FormattedPlural';
1369
1370
  FormattedPlural.contextTypes = {
1370
- intl: intlShape
1371
+ intl: intlShape
1371
1372
  };
1372
1373
  FormattedPlural.defaultProps = {
1373
- style: 'cardinal'
1374
+ style: 'cardinal'
1374
1375
  };
1375
1376
  process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
1376
- value: PropTypes.any.isRequired,
1377
+ value: PropTypes.any.isRequired,
1377
1378
 
1378
- other: PropTypes.node.isRequired,
1379
- zero: PropTypes.node,
1380
- one: PropTypes.node,
1381
- two: PropTypes.node,
1382
- few: PropTypes.node,
1383
- many: PropTypes.node,
1379
+ other: PropTypes.node.isRequired,
1380
+ zero: PropTypes.node,
1381
+ one: PropTypes.node,
1382
+ two: PropTypes.node,
1383
+ few: PropTypes.node,
1384
+ many: PropTypes.node,
1384
1385
 
1385
- children: PropTypes.func
1386
+ children: PropTypes.func
1386
1387
  }) : void 0;
1387
1388
 
1388
1389
  /*
@@ -1392,142 +1393,142 @@ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({},
1392
1393
  */
1393
1394
 
1394
1395
  var FormattedMessage = function (_Component) {
1395
- inherits(FormattedMessage, _Component);
1396
+ inherits(FormattedMessage, _Component);
1396
1397
 
1397
- function FormattedMessage(props, context) {
1398
- classCallCheck(this, FormattedMessage);
1398
+ function FormattedMessage(props, context) {
1399
+ classCallCheck(this, FormattedMessage);
1399
1400
 
1400
- var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1401
+ var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1401
1402
 
1402
- invariantIntlContext(context);
1403
- return _this;
1404
- }
1403
+ invariantIntlContext(context);
1404
+ return _this;
1405
+ }
1405
1406
 
1406
- createClass(FormattedMessage, [{
1407
- key: 'shouldComponentUpdate',
1408
- value: function shouldComponentUpdate(nextProps) {
1409
- var values = this.props.values;
1410
- var nextValues = nextProps.values;
1407
+ createClass(FormattedMessage, [{
1408
+ key: 'shouldComponentUpdate',
1409
+ value: function shouldComponentUpdate(nextProps) {
1410
+ var values = this.props.values;
1411
+ var nextValues = nextProps.values;
1411
1412
 
1412
1413
 
1413
- if (!shallowEquals(nextValues, values)) {
1414
- return true;
1415
- }
1414
+ if (!shallowEquals(nextValues, values)) {
1415
+ return true;
1416
+ }
1416
1417
 
1417
- // Since `values` has already been checked, we know they're not
1418
- // different, so the current `values` are carried over so the shallow
1419
- // equals comparison on the other props isn't affected by the `values`.
1420
- var nextPropsToCheck = _extends({}, nextProps, {
1421
- values: values
1422
- });
1418
+ // Since `values` has already been checked, we know they're not
1419
+ // different, so the current `values` are carried over so the shallow
1420
+ // equals comparison on the other props isn't affected by the `values`.
1421
+ var nextPropsToCheck = _extends({}, nextProps, {
1422
+ values: values
1423
+ });
1423
1424
 
1424
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1425
- next[_key - 1] = arguments[_key];
1426
- }
1425
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1426
+ next[_key - 1] = arguments[_key];
1427
+ }
1427
1428
 
1428
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1429
- }
1430
- }, {
1431
- key: 'render',
1432
- value: function render() {
1433
- var _context$intl = this.context.intl,
1434
- formatMessage = _context$intl.formatMessage,
1435
- Text = _context$intl.textComponent;
1436
- var _props = this.props,
1437
- id = _props.id,
1438
- description = _props.description,
1439
- defaultMessage = _props.defaultMessage,
1440
- values = _props.values,
1441
- _props$tagName = _props.tagName,
1442
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1443
- children = _props.children;
1444
-
1445
-
1446
- var tokenDelimiter = void 0;
1447
- var tokenizedValues = void 0;
1448
- var elements = void 0;
1449
-
1450
- var hasValues = values && Object.keys(values).length > 0;
1451
- if (hasValues) {
1452
- // Creates a token with a random UID that should not be guessable or
1453
- // conflict with other parts of the `message` string.
1454
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1455
-
1456
- var generateToken = function () {
1457
- var counter = 0;
1458
- return function () {
1459
- return 'ELEMENT-' + uid + '-' + (counter += 1);
1460
- };
1461
- }();
1462
-
1463
- // Splitting with a delimiter to support IE8. When using a regex
1464
- // with a capture group IE8 does not include the capture group in
1465
- // the resulting array.
1466
- tokenDelimiter = '@__' + uid + '__@';
1467
- tokenizedValues = {};
1468
- elements = {};
1469
-
1470
- // Iterates over the `props` to keep track of any React Element
1471
- // values so they can be represented by the `token` as a placeholder
1472
- // when the `message` is formatted. This allows the formatted
1473
- // message to then be broken-up into parts with references to the
1474
- // React Elements inserted back in.
1475
- Object.keys(values).forEach(function (name) {
1476
- var value = values[name];
1477
-
1478
- if (isValidElement(value)) {
1479
- var token = generateToken();
1480
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1481
- elements[token] = value;
1482
- } else {
1483
- tokenizedValues[name] = value;
1484
- }
1485
- });
1486
- }
1487
-
1488
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1489
- var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1490
-
1491
- var nodes = void 0;
1492
-
1493
- var hasElements = elements && Object.keys(elements).length > 0;
1494
- if (hasElements) {
1495
- // Split the message into parts so the React Element values captured
1496
- // above can be inserted back into the rendered message. This
1497
- // approach allows messages to render with React Elements while
1498
- // keeping React's virtual diffing working properly.
1499
- nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1500
- return !!part;
1501
- }).map(function (part) {
1502
- return elements[part] || part;
1503
- });
1504
- } else {
1505
- nodes = [formattedMessage];
1506
- }
1507
-
1508
- if (typeof children === 'function') {
1509
- return children.apply(undefined, toConsumableArray(nodes));
1510
- }
1511
-
1512
- // Needs to use `createElement()` instead of JSX, otherwise React will
1513
- // warn about a missing `key` prop with rich-text message formatting.
1514
- return createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1515
- }
1516
- }]);
1517
- return FormattedMessage;
1429
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1430
+ }
1431
+ }, {
1432
+ key: 'render',
1433
+ value: function render() {
1434
+ var _context$intl = this.context.intl,
1435
+ formatMessage = _context$intl.formatMessage,
1436
+ Text = _context$intl.textComponent;
1437
+ var _props = this.props,
1438
+ id = _props.id,
1439
+ description = _props.description,
1440
+ defaultMessage = _props.defaultMessage,
1441
+ values = _props.values,
1442
+ _props$tagName = _props.tagName,
1443
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1444
+ children = _props.children;
1445
+
1446
+
1447
+ var tokenDelimiter = void 0;
1448
+ var tokenizedValues = void 0;
1449
+ var elements = void 0;
1450
+
1451
+ var hasValues = values && Object.keys(values).length > 0;
1452
+ if (hasValues) {
1453
+ // Creates a token with a random UID that should not be guessable or
1454
+ // conflict with other parts of the `message` string.
1455
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1456
+
1457
+ var generateToken = function () {
1458
+ var counter = 0;
1459
+ return function () {
1460
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
1461
+ };
1462
+ }();
1463
+
1464
+ // Splitting with a delimiter to support IE8. When using a regex
1465
+ // with a capture group IE8 does not include the capture group in
1466
+ // the resulting array.
1467
+ tokenDelimiter = '@__' + uid + '__@';
1468
+ tokenizedValues = {};
1469
+ elements = {};
1470
+
1471
+ // Iterates over the `props` to keep track of any React Element
1472
+ // values so they can be represented by the `token` as a placeholder
1473
+ // when the `message` is formatted. This allows the formatted
1474
+ // message to then be broken-up into parts with references to the
1475
+ // React Elements inserted back in.
1476
+ Object.keys(values).forEach(function (name) {
1477
+ var value = values[name];
1478
+
1479
+ if (isValidElement(value)) {
1480
+ var token = generateToken();
1481
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1482
+ elements[token] = value;
1483
+ } else {
1484
+ tokenizedValues[name] = value;
1485
+ }
1486
+ });
1487
+ }
1488
+
1489
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1490
+ var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1491
+
1492
+ var nodes = void 0;
1493
+
1494
+ var hasElements = elements && Object.keys(elements).length > 0;
1495
+ if (hasElements) {
1496
+ // Split the message into parts so the React Element values captured
1497
+ // above can be inserted back into the rendered message. This
1498
+ // approach allows messages to render with React Elements while
1499
+ // keeping React's virtual diffing working properly.
1500
+ nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1501
+ return !!part;
1502
+ }).map(function (part) {
1503
+ return elements[part] || part;
1504
+ });
1505
+ } else {
1506
+ nodes = [formattedMessage];
1507
+ }
1508
+
1509
+ if (typeof children === 'function') {
1510
+ return children.apply(undefined, toConsumableArray(nodes));
1511
+ }
1512
+
1513
+ // Needs to use `createElement()` instead of JSX, otherwise React will
1514
+ // warn about a missing `key` prop with rich-text message formatting.
1515
+ return createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1516
+ }
1517
+ }]);
1518
+ return FormattedMessage;
1518
1519
  }(Component);
1519
1520
 
1520
1521
  FormattedMessage.displayName = 'FormattedMessage';
1521
1522
  FormattedMessage.contextTypes = {
1522
- intl: intlShape
1523
+ intl: intlShape
1523
1524
  };
1524
1525
  FormattedMessage.defaultProps = {
1525
- values: {}
1526
+ values: {}
1526
1527
  };
1527
1528
  process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1528
- values: PropTypes.object,
1529
- tagName: PropTypes.string,
1530
- children: PropTypes.func
1529
+ values: PropTypes.object,
1530
+ tagName: PropTypes.string,
1531
+ children: PropTypes.func
1531
1532
  }) : void 0;
1532
1533
 
1533
1534
  /*
@@ -1537,90 +1538,90 @@ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}
1537
1538
  */
1538
1539
 
1539
1540
  var FormattedHTMLMessage = function (_Component) {
1540
- inherits(FormattedHTMLMessage, _Component);
1541
+ inherits(FormattedHTMLMessage, _Component);
1541
1542
 
1542
- function FormattedHTMLMessage(props, context) {
1543
- classCallCheck(this, FormattedHTMLMessage);
1543
+ function FormattedHTMLMessage(props, context) {
1544
+ classCallCheck(this, FormattedHTMLMessage);
1544
1545
 
1545
- var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1546
+ var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1546
1547
 
1547
- invariantIntlContext(context);
1548
- return _this;
1549
- }
1548
+ invariantIntlContext(context);
1549
+ return _this;
1550
+ }
1550
1551
 
1551
- createClass(FormattedHTMLMessage, [{
1552
- key: 'shouldComponentUpdate',
1553
- value: function shouldComponentUpdate(nextProps) {
1554
- var values = this.props.values;
1555
- var nextValues = nextProps.values;
1552
+ createClass(FormattedHTMLMessage, [{
1553
+ key: 'shouldComponentUpdate',
1554
+ value: function shouldComponentUpdate(nextProps) {
1555
+ var values = this.props.values;
1556
+ var nextValues = nextProps.values;
1556
1557
 
1557
1558
 
1558
- if (!shallowEquals(nextValues, values)) {
1559
- return true;
1560
- }
1559
+ if (!shallowEquals(nextValues, values)) {
1560
+ return true;
1561
+ }
1561
1562
 
1562
- // Since `values` has already been checked, we know they're not
1563
- // different, so the current `values` are carried over so the shallow
1564
- // equals comparison on the other props isn't affected by the `values`.
1565
- var nextPropsToCheck = _extends({}, nextProps, {
1566
- values: values
1567
- });
1563
+ // Since `values` has already been checked, we know they're not
1564
+ // different, so the current `values` are carried over so the shallow
1565
+ // equals comparison on the other props isn't affected by the `values`.
1566
+ var nextPropsToCheck = _extends({}, nextProps, {
1567
+ values: values
1568
+ });
1568
1569
 
1569
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1570
- next[_key - 1] = arguments[_key];
1571
- }
1570
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1571
+ next[_key - 1] = arguments[_key];
1572
+ }
1572
1573
 
1573
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1574
- }
1575
- }, {
1576
- key: 'render',
1577
- value: function render() {
1578
- var _context$intl = this.context.intl,
1579
- formatHTMLMessage = _context$intl.formatHTMLMessage,
1580
- Text = _context$intl.textComponent;
1581
- var _props = this.props,
1582
- id = _props.id,
1583
- description = _props.description,
1584
- defaultMessage = _props.defaultMessage,
1585
- rawValues = _props.values,
1586
- _props$tagName = _props.tagName,
1587
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1588
- children = _props.children;
1589
-
1590
-
1591
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1592
- var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1593
-
1594
- if (typeof children === 'function') {
1595
- return children(formattedHTMLMessage);
1596
- }
1597
-
1598
- // Since the message presumably has HTML in it, we need to set
1599
- // `innerHTML` in order for it to be rendered and not escaped by React.
1600
- // To be safe, all string prop values were escaped when formatting the
1601
- // message. It is assumed that the message is not UGC, and came from the
1602
- // developer making it more like a template.
1603
- //
1604
- // Note: There's a perf impact of using this component since there's no
1605
- // way for React to do its virtual DOM diffing.
1606
- var html = { __html: formattedHTMLMessage };
1607
- return React.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1608
- }
1609
- }]);
1610
- return FormattedHTMLMessage;
1574
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1575
+ }
1576
+ }, {
1577
+ key: 'render',
1578
+ value: function render() {
1579
+ var _context$intl = this.context.intl,
1580
+ formatHTMLMessage = _context$intl.formatHTMLMessage,
1581
+ Text = _context$intl.textComponent;
1582
+ var _props = this.props,
1583
+ id = _props.id,
1584
+ description = _props.description,
1585
+ defaultMessage = _props.defaultMessage,
1586
+ rawValues = _props.values,
1587
+ _props$tagName = _props.tagName,
1588
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1589
+ children = _props.children;
1590
+
1591
+
1592
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1593
+ var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1594
+
1595
+ if (typeof children === 'function') {
1596
+ return children(formattedHTMLMessage);
1597
+ }
1598
+
1599
+ // Since the message presumably has HTML in it, we need to set
1600
+ // `innerHTML` in order for it to be rendered and not escaped by React.
1601
+ // To be safe, all string prop values were escaped when formatting the
1602
+ // message. It is assumed that the message is not UGC, and came from the
1603
+ // developer making it more like a template.
1604
+ //
1605
+ // Note: There's a perf impact of using this component since there's no
1606
+ // way for React to do its virtual DOM diffing.
1607
+ var html = { __html: formattedHTMLMessage };
1608
+ return React.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1609
+ }
1610
+ }]);
1611
+ return FormattedHTMLMessage;
1611
1612
  }(Component);
1612
1613
 
1613
1614
  FormattedHTMLMessage.displayName = 'FormattedHTMLMessage';
1614
1615
  FormattedHTMLMessage.contextTypes = {
1615
- intl: intlShape
1616
+ intl: intlShape
1616
1617
  };
1617
1618
  FormattedHTMLMessage.defaultProps = {
1618
- values: {}
1619
+ values: {}
1619
1620
  };
1620
1621
  process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1621
- values: PropTypes.object,
1622
- tagName: PropTypes.string,
1623
- children: PropTypes.func
1622
+ values: PropTypes.object,
1623
+ tagName: PropTypes.string,
1624
+ children: PropTypes.func
1624
1625
  }) : void 0;
1625
1626
 
1626
1627
  /*