react-intl 2.2.1 → 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 (262) hide show
  1. package/CONTRIBUTING.md +20 -0
  2. package/dist/react-intl.js +1017 -1475
  3. package/dist/react-intl.js.map +1 -1
  4. package/dist/react-intl.min.js +1 -2
  5. package/dist/react-intl.min.js.map +1 -1
  6. package/lib/index.es.js +983 -1428
  7. package/lib/index.js +990 -1435
  8. package/locale-data/af.js +1 -1
  9. package/locale-data/agq.js +1 -1
  10. package/locale-data/ak.js +1 -1
  11. package/locale-data/am.js +1 -1
  12. package/locale-data/ar.js +1 -1
  13. package/locale-data/ars.js +1 -0
  14. package/locale-data/as.js +1 -1
  15. package/locale-data/asa.js +1 -1
  16. package/locale-data/ast.js +1 -1
  17. package/locale-data/az.js +1 -1
  18. package/locale-data/bas.js +1 -1
  19. package/locale-data/be.js +1 -1
  20. package/locale-data/bem.js +1 -1
  21. package/locale-data/bez.js +1 -1
  22. package/locale-data/bg.js +1 -1
  23. package/locale-data/bh.js +1 -1
  24. package/locale-data/bm.js +1 -1
  25. package/locale-data/bn.js +1 -1
  26. package/locale-data/bo.js +1 -1
  27. package/locale-data/br.js +1 -1
  28. package/locale-data/brx.js +1 -1
  29. package/locale-data/bs.js +1 -1
  30. package/locale-data/ca.js +1 -1
  31. package/locale-data/ce.js +1 -1
  32. package/locale-data/cgg.js +1 -1
  33. package/locale-data/chr.js +1 -1
  34. package/locale-data/ckb.js +1 -1
  35. package/locale-data/cs.js +1 -1
  36. package/locale-data/cu.js +1 -1
  37. package/locale-data/cy.js +1 -1
  38. package/locale-data/da.js +1 -1
  39. package/locale-data/dav.js +1 -1
  40. package/locale-data/de.js +1 -1
  41. package/locale-data/dje.js +1 -1
  42. package/locale-data/dsb.js +1 -1
  43. package/locale-data/dua.js +1 -1
  44. package/locale-data/dv.js +1 -1
  45. package/locale-data/dyo.js +1 -1
  46. package/locale-data/dz.js +1 -1
  47. package/locale-data/ebu.js +1 -1
  48. package/locale-data/ee.js +1 -1
  49. package/locale-data/el.js +1 -1
  50. package/locale-data/en.js +1 -1
  51. package/locale-data/eo.js +1 -1
  52. package/locale-data/es.js +1 -1
  53. package/locale-data/et.js +1 -1
  54. package/locale-data/eu.js +1 -1
  55. package/locale-data/ewo.js +1 -1
  56. package/locale-data/fa.js +1 -1
  57. package/locale-data/ff.js +1 -1
  58. package/locale-data/fi.js +1 -1
  59. package/locale-data/fil.js +1 -1
  60. package/locale-data/fo.js +1 -1
  61. package/locale-data/fr.js +1 -1
  62. package/locale-data/fur.js +1 -1
  63. package/locale-data/fy.js +1 -1
  64. package/locale-data/ga.js +1 -1
  65. package/locale-data/gd.js +1 -1
  66. package/locale-data/gl.js +1 -1
  67. package/locale-data/gsw.js +1 -1
  68. package/locale-data/gu.js +1 -1
  69. package/locale-data/guw.js +1 -1
  70. package/locale-data/guz.js +1 -1
  71. package/locale-data/gv.js +1 -1
  72. package/locale-data/ha.js +1 -1
  73. package/locale-data/haw.js +1 -1
  74. package/locale-data/he.js +1 -1
  75. package/locale-data/hi.js +1 -1
  76. package/locale-data/hr.js +1 -1
  77. package/locale-data/hsb.js +1 -1
  78. package/locale-data/hu.js +1 -1
  79. package/locale-data/hy.js +1 -1
  80. package/locale-data/id.js +1 -1
  81. package/locale-data/ig.js +1 -1
  82. package/locale-data/ii.js +1 -1
  83. package/locale-data/in.js +1 -1
  84. package/locale-data/index.js +1 -10
  85. package/locale-data/is.js +1 -1
  86. package/locale-data/it.js +1 -1
  87. package/locale-data/iu.js +1 -1
  88. package/locale-data/iw.js +1 -1
  89. package/locale-data/ja.js +1 -1
  90. package/locale-data/jbo.js +1 -1
  91. package/locale-data/jgo.js +1 -1
  92. package/locale-data/ji.js +1 -1
  93. package/locale-data/jmc.js +1 -1
  94. package/locale-data/jv.js +1 -1
  95. package/locale-data/jw.js +1 -1
  96. package/locale-data/ka.js +1 -1
  97. package/locale-data/kab.js +1 -1
  98. package/locale-data/kaj.js +1 -1
  99. package/locale-data/kam.js +1 -1
  100. package/locale-data/kcg.js +1 -1
  101. package/locale-data/kde.js +1 -1
  102. package/locale-data/kea.js +1 -1
  103. package/locale-data/khq.js +1 -1
  104. package/locale-data/ki.js +1 -1
  105. package/locale-data/kk.js +1 -1
  106. package/locale-data/kkj.js +1 -1
  107. package/locale-data/kl.js +1 -1
  108. package/locale-data/kln.js +1 -1
  109. package/locale-data/km.js +1 -1
  110. package/locale-data/kn.js +1 -1
  111. package/locale-data/ko.js +1 -1
  112. package/locale-data/kok.js +1 -1
  113. package/locale-data/ks.js +1 -1
  114. package/locale-data/ksb.js +1 -1
  115. package/locale-data/ksf.js +1 -1
  116. package/locale-data/ksh.js +1 -1
  117. package/locale-data/ku.js +1 -1
  118. package/locale-data/kw.js +1 -1
  119. package/locale-data/ky.js +1 -1
  120. package/locale-data/lag.js +1 -1
  121. package/locale-data/lb.js +1 -1
  122. package/locale-data/lg.js +1 -1
  123. package/locale-data/lkt.js +1 -1
  124. package/locale-data/ln.js +1 -1
  125. package/locale-data/lo.js +1 -1
  126. package/locale-data/lrc.js +1 -1
  127. package/locale-data/lt.js +1 -1
  128. package/locale-data/lu.js +1 -1
  129. package/locale-data/luo.js +1 -1
  130. package/locale-data/luy.js +1 -1
  131. package/locale-data/lv.js +1 -1
  132. package/locale-data/mas.js +1 -1
  133. package/locale-data/mer.js +1 -1
  134. package/locale-data/mfe.js +1 -1
  135. package/locale-data/mg.js +1 -1
  136. package/locale-data/mgh.js +1 -1
  137. package/locale-data/mgo.js +1 -1
  138. package/locale-data/mk.js +1 -1
  139. package/locale-data/ml.js +1 -1
  140. package/locale-data/mn.js +1 -1
  141. package/locale-data/mo.js +1 -1
  142. package/locale-data/mr.js +1 -1
  143. package/locale-data/ms.js +1 -1
  144. package/locale-data/mt.js +1 -1
  145. package/locale-data/mua.js +1 -1
  146. package/locale-data/my.js +1 -1
  147. package/locale-data/mzn.js +1 -1
  148. package/locale-data/nah.js +1 -1
  149. package/locale-data/naq.js +1 -1
  150. package/locale-data/nb.js +1 -1
  151. package/locale-data/nd.js +1 -1
  152. package/locale-data/nds.js +1 -0
  153. package/locale-data/ne.js +1 -1
  154. package/locale-data/nl.js +1 -1
  155. package/locale-data/nmg.js +1 -1
  156. package/locale-data/nn.js +1 -1
  157. package/locale-data/nnh.js +1 -1
  158. package/locale-data/no.js +1 -1
  159. package/locale-data/nqo.js +1 -1
  160. package/locale-data/nr.js +1 -1
  161. package/locale-data/nso.js +1 -1
  162. package/locale-data/nus.js +1 -1
  163. package/locale-data/ny.js +1 -1
  164. package/locale-data/nyn.js +1 -1
  165. package/locale-data/om.js +1 -1
  166. package/locale-data/or.js +1 -1
  167. package/locale-data/os.js +1 -1
  168. package/locale-data/pa.js +1 -1
  169. package/locale-data/pap.js +1 -1
  170. package/locale-data/pl.js +1 -1
  171. package/locale-data/prg.js +1 -1
  172. package/locale-data/ps.js +1 -1
  173. package/locale-data/pt.js +1 -1
  174. package/locale-data/qu.js +1 -1
  175. package/locale-data/rm.js +1 -1
  176. package/locale-data/rn.js +1 -1
  177. package/locale-data/ro.js +1 -1
  178. package/locale-data/rof.js +1 -1
  179. package/locale-data/ru.js +1 -1
  180. package/locale-data/rw.js +1 -1
  181. package/locale-data/rwk.js +1 -1
  182. package/locale-data/sah.js +1 -1
  183. package/locale-data/saq.js +1 -1
  184. package/locale-data/sbp.js +1 -1
  185. package/locale-data/sdh.js +1 -1
  186. package/locale-data/se.js +1 -1
  187. package/locale-data/seh.js +1 -1
  188. package/locale-data/ses.js +1 -1
  189. package/locale-data/sg.js +1 -1
  190. package/locale-data/sh.js +1 -1
  191. package/locale-data/shi.js +1 -1
  192. package/locale-data/si.js +1 -1
  193. package/locale-data/sk.js +1 -1
  194. package/locale-data/sl.js +1 -1
  195. package/locale-data/sma.js +1 -1
  196. package/locale-data/smi.js +1 -1
  197. package/locale-data/smj.js +1 -1
  198. package/locale-data/smn.js +1 -1
  199. package/locale-data/sms.js +1 -1
  200. package/locale-data/sn.js +1 -1
  201. package/locale-data/so.js +1 -1
  202. package/locale-data/sq.js +1 -1
  203. package/locale-data/sr.js +1 -1
  204. package/locale-data/ss.js +1 -1
  205. package/locale-data/ssy.js +1 -1
  206. package/locale-data/st.js +1 -1
  207. package/locale-data/sv.js +1 -1
  208. package/locale-data/sw.js +1 -1
  209. package/locale-data/syr.js +1 -1
  210. package/locale-data/ta.js +1 -1
  211. package/locale-data/te.js +1 -1
  212. package/locale-data/teo.js +1 -1
  213. package/locale-data/th.js +1 -1
  214. package/locale-data/ti.js +1 -1
  215. package/locale-data/tig.js +1 -1
  216. package/locale-data/tk.js +1 -1
  217. package/locale-data/tl.js +1 -1
  218. package/locale-data/tn.js +1 -1
  219. package/locale-data/to.js +1 -1
  220. package/locale-data/tr.js +1 -1
  221. package/locale-data/ts.js +1 -1
  222. package/locale-data/twq.js +1 -1
  223. package/locale-data/tzm.js +1 -1
  224. package/locale-data/ug.js +1 -1
  225. package/locale-data/uk.js +1 -1
  226. package/locale-data/ur.js +1 -1
  227. package/locale-data/uz.js +1 -1
  228. package/locale-data/vai.js +1 -1
  229. package/locale-data/ve.js +1 -1
  230. package/locale-data/vi.js +1 -1
  231. package/locale-data/vo.js +1 -1
  232. package/locale-data/vun.js +1 -1
  233. package/locale-data/wa.js +1 -1
  234. package/locale-data/wae.js +1 -1
  235. package/locale-data/wo.js +1 -1
  236. package/locale-data/xh.js +1 -1
  237. package/locale-data/xog.js +1 -1
  238. package/locale-data/yav.js +1 -1
  239. package/locale-data/yi.js +1 -1
  240. package/locale-data/yo.js +1 -1
  241. package/locale-data/yue.js +1 -0
  242. package/locale-data/zgh.js +1 -1
  243. package/locale-data/zh.js +1 -1
  244. package/locale-data/zu.js +1 -1
  245. package/package.json +33 -27
  246. package/src/components/date.js +30 -29
  247. package/src/components/html-message.js +63 -62
  248. package/src/components/message.js +117 -114
  249. package/src/components/number.js +30 -29
  250. package/src/components/plural.js +37 -36
  251. package/src/components/provider.js +135 -134
  252. package/src/components/relative.js +128 -120
  253. package/src/components/time.js +30 -29
  254. package/src/define-messages.js +3 -3
  255. package/src/en.js +1 -1
  256. package/src/format.js +209 -208
  257. package/src/inject.js +38 -40
  258. package/src/locale-data-registry.js +21 -21
  259. package/src/plural.js +9 -9
  260. package/src/types.js +58 -48
  261. package/src/utils.js +65 -55
  262. package/yarn.lock +4832 -0
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2016, Yahoo Inc.
2
+ * Copyright 2017, Yahoo Inc.
3
3
  * Copyrights licensed under the New BSD License.
4
4
  * See the accompanying LICENSE file for terms.
5
5
  */
@@ -13,6 +13,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
13
13
  var allLocaleData = _interopDefault(require('../locale-data/index.js'));
14
14
  var IntlMessageFormat = _interopDefault(require('intl-messageformat'));
15
15
  var IntlRelativeFormat = _interopDefault(require('intl-relativeformat'));
16
+ var PropTypes = _interopDefault(require('prop-types'));
16
17
  var React = require('react');
17
18
  var React__default = _interopDefault(React);
18
19
  var invariant = _interopDefault(require('invariant'));
@@ -25,7 +26,7 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
25
26
  t0 = Number(s[0]) == n,
26
27
  n10 = t0 && s[0].slice(-1),
27
28
  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";
28
- }, "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" } } } } };
29
+ }, "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" } } } } };
29
30
 
30
31
  /*
31
32
  * Copyright 2015, Yahoo Inc.
@@ -34,36 +35,36 @@ var defaultLocaleData = { "locale": "en", "pluralRuleFunction": function pluralR
34
35
  */
35
36
 
36
37
  function addLocaleData() {
37
- var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
38
39
 
39
- var locales = Array.isArray(data) ? data : [data];
40
+ var locales = Array.isArray(data) ? data : [data];
40
41
 
41
- locales.forEach(function (localeData) {
42
- if (localeData && localeData.locale) {
43
- IntlMessageFormat.__addLocaleData(localeData);
44
- IntlRelativeFormat.__addLocaleData(localeData);
45
- }
46
- });
42
+ locales.forEach(function (localeData) {
43
+ if (localeData && localeData.locale) {
44
+ IntlMessageFormat.__addLocaleData(localeData);
45
+ IntlRelativeFormat.__addLocaleData(localeData);
46
+ }
47
+ });
47
48
  }
48
49
 
49
50
  function hasLocaleData(locale) {
50
- var localeParts = (locale || '').split('-');
51
+ var localeParts = (locale || '').split('-');
51
52
 
52
- while (localeParts.length > 0) {
53
- if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
54
- return true;
55
- }
56
-
57
- localeParts.pop();
53
+ while (localeParts.length > 0) {
54
+ if (hasIMFAndIRFLocaleData(localeParts.join('-'))) {
55
+ return true;
58
56
  }
59
57
 
60
- return false;
58
+ localeParts.pop();
59
+ }
60
+
61
+ return false;
61
62
  }
62
63
 
63
64
  function hasIMFAndIRFLocaleData(locale) {
64
- var normalizedLocale = locale && locale.toLowerCase();
65
+ var normalizedLocale = locale && locale.toLowerCase();
65
66
 
66
- return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
67
+ return !!(IntlMessageFormat.__localeData__[normalizedLocale] && IntlRelativeFormat.__localeData__[normalizedLocale]);
67
68
  }
68
69
 
69
70
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
@@ -72,257 +73,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
72
73
  return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
73
74
  };
74
75
 
75
- var jsx = function () {
76
- var REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
77
- return function createRawReactElement(type, props, key, children) {
78
- var defaultProps = type && type.defaultProps;
79
- var childrenLength = arguments.length - 3;
80
-
81
- if (!props && childrenLength !== 0) {
82
- props = {};
83
- }
84
-
85
- if (props && defaultProps) {
86
- for (var propName in defaultProps) {
87
- if (props[propName] === void 0) {
88
- props[propName] = defaultProps[propName];
89
- }
90
- }
91
- } else if (!props) {
92
- props = defaultProps || {};
93
- }
94
-
95
- if (childrenLength === 1) {
96
- props.children = children;
97
- } else if (childrenLength > 1) {
98
- var childArray = Array(childrenLength);
99
-
100
- for (var i = 0; i < childrenLength; i++) {
101
- childArray[i] = arguments[i + 3];
102
- }
103
-
104
- props.children = childArray;
105
- }
106
-
107
- return {
108
- $$typeof: REACT_ELEMENT_TYPE,
109
- type: type,
110
- key: key === undefined ? null : '' + key,
111
- ref: null,
112
- props: props,
113
- _owner: null
114
- };
115
- };
116
- }();
117
-
118
- var asyncIterator = function (iterable) {
119
- if (typeof Symbol === "function") {
120
- if (Symbol.asyncIterator) {
121
- var method = iterable[Symbol.asyncIterator];
122
- if (method != null) return method.call(iterable);
123
- }
124
-
125
- if (Symbol.iterator) {
126
- return iterable[Symbol.iterator]();
127
- }
128
- }
129
-
130
- throw new TypeError("Object is not async iterable");
131
- };
132
-
133
- var asyncGenerator = function () {
134
- function AwaitValue(value) {
135
- this.value = value;
136
- }
137
-
138
- function AsyncGenerator(gen) {
139
- var front, back;
140
-
141
- function send(key, arg) {
142
- return new Promise(function (resolve, reject) {
143
- var request = {
144
- key: key,
145
- arg: arg,
146
- resolve: resolve,
147
- reject: reject,
148
- next: null
149
- };
150
-
151
- if (back) {
152
- back = back.next = request;
153
- } else {
154
- front = back = request;
155
- resume(key, arg);
156
- }
157
- });
158
- }
159
-
160
- function resume(key, arg) {
161
- try {
162
- var result = gen[key](arg);
163
- var value = result.value;
164
-
165
- if (value instanceof AwaitValue) {
166
- Promise.resolve(value.value).then(function (arg) {
167
- resume("next", arg);
168
- }, function (arg) {
169
- resume("throw", arg);
170
- });
171
- } else {
172
- settle(result.done ? "return" : "normal", result.value);
173
- }
174
- } catch (err) {
175
- settle("throw", err);
176
- }
177
- }
178
-
179
- function settle(type, value) {
180
- switch (type) {
181
- case "return":
182
- front.resolve({
183
- value: value,
184
- done: true
185
- });
186
- break;
187
-
188
- case "throw":
189
- front.reject(value);
190
- break;
191
-
192
- default:
193
- front.resolve({
194
- value: value,
195
- done: false
196
- });
197
- break;
198
- }
199
-
200
- front = front.next;
201
-
202
- if (front) {
203
- resume(front.key, front.arg);
204
- } else {
205
- back = null;
206
- }
207
- }
208
-
209
- this._invoke = send;
210
-
211
- if (typeof gen.return !== "function") {
212
- this.return = undefined;
213
- }
214
- }
215
-
216
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
217
- AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
218
- return this;
219
- };
220
- }
221
-
222
- AsyncGenerator.prototype.next = function (arg) {
223
- return this._invoke("next", arg);
224
- };
225
-
226
- AsyncGenerator.prototype.throw = function (arg) {
227
- return this._invoke("throw", arg);
228
- };
229
-
230
- AsyncGenerator.prototype.return = function (arg) {
231
- return this._invoke("return", arg);
232
- };
233
-
234
- return {
235
- wrap: function (fn) {
236
- return function () {
237
- return new AsyncGenerator(fn.apply(this, arguments));
238
- };
239
- },
240
- await: function (value) {
241
- return new AwaitValue(value);
242
- }
243
- };
244
- }();
245
-
246
- var asyncGeneratorDelegate = function (inner, awaitWrap) {
247
- var iter = {},
248
- waiting = false;
249
76
 
250
- function pump(key, value) {
251
- waiting = true;
252
- value = new Promise(function (resolve) {
253
- resolve(inner[key](value));
254
- });
255
- return {
256
- done: false,
257
- value: awaitWrap(value)
258
- };
259
- }
260
77
 
261
-
262
78
 
263
- if (typeof Symbol === "function" && Symbol.iterator) {
264
- iter[Symbol.iterator] = function () {
265
- return this;
266
- };
267
- }
268
79
 
269
- iter.next = function (value) {
270
- if (waiting) {
271
- waiting = false;
272
- return value;
273
- }
274
80
 
275
- return pump("next", value);
276
- };
277
81
 
278
- if (typeof inner.throw === "function") {
279
- iter.throw = function (value) {
280
- if (waiting) {
281
- waiting = false;
282
- throw value;
283
- }
284
-
285
- return pump("throw", value);
286
- };
287
- }
288
-
289
- if (typeof inner.return === "function") {
290
- iter.return = function (value) {
291
- return pump("return", value);
292
- };
293
- }
294
-
295
- return iter;
296
- };
297
82
 
298
- var asyncToGenerator = function (fn) {
299
- return function () {
300
- var gen = fn.apply(this, arguments);
301
- return new Promise(function (resolve, reject) {
302
- function step(key, arg) {
303
- try {
304
- var info = gen[key](arg);
305
- var value = info.value;
306
- } catch (error) {
307
- reject(error);
308
- return;
309
- }
310
83
 
311
- if (info.done) {
312
- resolve(value);
313
- } else {
314
- return Promise.resolve(value).then(function (value) {
315
- step("next", value);
316
- }, function (err) {
317
- step("throw", err);
318
- });
319
- }
320
- }
321
84
 
322
- return step("next");
323
- });
324
- };
325
- };
326
85
 
327
86
  var classCallCheck = function (instance, Constructor) {
328
87
  if (!(instance instanceof Constructor)) {
@@ -348,31 +107,9 @@ var createClass = function () {
348
107
  };
349
108
  }();
350
109
 
351
- var defineEnumerableProperties = function (obj, descs) {
352
- for (var key in descs) {
353
- var desc = descs[key];
354
- desc.configurable = desc.enumerable = true;
355
- if ("value" in desc) desc.writable = true;
356
- Object.defineProperty(obj, key, desc);
357
- }
358
110
 
359
- return obj;
360
- };
361
-
362
- var defaults = function (obj, defaults) {
363
- var keys = Object.getOwnPropertyNames(defaults);
364
111
 
365
- for (var i = 0; i < keys.length; i++) {
366
- var key = keys[i];
367
- var value = Object.getOwnPropertyDescriptor(defaults, key);
368
-
369
- if (value && value.configurable && obj[key] === undefined) {
370
- Object.defineProperty(obj, key, value);
371
- }
372
- }
373
112
 
374
- return obj;
375
- };
376
113
 
377
114
  var defineProperty = function (obj, key, value) {
378
115
  if (key in obj) {
@@ -403,30 +140,7 @@ var _extends = Object.assign || function (target) {
403
140
  return target;
404
141
  };
405
142
 
406
- var get = function get(object, property, receiver) {
407
- if (object === null) object = Function.prototype;
408
- var desc = Object.getOwnPropertyDescriptor(object, property);
409
143
 
410
- if (desc === undefined) {
411
- var parent = Object.getPrototypeOf(object);
412
-
413
- if (parent === null) {
414
- return undefined;
415
- } else {
416
- return get(parent, property, receiver);
417
- }
418
- } else if ("value" in desc) {
419
- return desc.value;
420
- } else {
421
- var getter = desc.get;
422
-
423
- if (getter === undefined) {
424
- return undefined;
425
- }
426
-
427
- return getter.call(receiver);
428
- }
429
- };
430
144
 
431
145
  var inherits = function (subClass, superClass) {
432
146
  if (typeof superClass !== "function" && superClass !== null) {
@@ -444,46 +158,13 @@ var inherits = function (subClass, superClass) {
444
158
  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
445
159
  };
446
160
 
447
- var _instanceof = function (left, right) {
448
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
449
- return right[Symbol.hasInstance](left);
450
- } else {
451
- return left instanceof right;
452
- }
453
- };
454
161
 
455
- var interopRequireDefault = function (obj) {
456
- return obj && obj.__esModule ? obj : {
457
- default: obj
458
- };
459
- };
460
162
 
461
- var interopRequireWildcard = function (obj) {
462
- if (obj && obj.__esModule) {
463
- return obj;
464
- } else {
465
- var newObj = {};
466
163
 
467
- if (obj != null) {
468
- for (var key in obj) {
469
- if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];
470
- }
471
- }
472
164
 
473
- newObj.default = obj;
474
- return newObj;
475
- }
476
- };
477
165
 
478
- var newArrowCheck = function (innerThis, boundThis) {
479
- if (innerThis !== boundThis) {
480
- throw new TypeError("Cannot instantiate an arrow function");
481
- }
482
- };
483
166
 
484
- var objectDestructuringEmpty = function (obj) {
485
- if (obj == null) throw new TypeError("Cannot destructure undefined");
486
- };
167
+
487
168
 
488
169
  var objectWithoutProperties = function (obj, keys) {
489
170
  var target = {};
@@ -505,112 +186,23 @@ var possibleConstructorReturn = function (self, call) {
505
186
  return call && (typeof call === "object" || typeof call === "function") ? call : self;
506
187
  };
507
188
 
508
- var selfGlobal = typeof global === "undefined" ? self : global;
509
-
510
- var set = function set(object, property, value, receiver) {
511
- var desc = Object.getOwnPropertyDescriptor(object, property);
512
189
 
513
- if (desc === undefined) {
514
- var parent = Object.getPrototypeOf(object);
515
190
 
516
- if (parent !== null) {
517
- set(parent, property, value, receiver);
518
- }
519
- } else if ("value" in desc && desc.writable) {
520
- desc.value = value;
521
- } else {
522
- var setter = desc.set;
523
191
 
524
- if (setter !== undefined) {
525
- setter.call(receiver, value);
526
- }
527
- }
528
192
 
529
- return value;
530
- };
531
193
 
532
- var slicedToArray = function () {
533
- function sliceIterator(arr, i) {
534
- var _arr = [];
535
- var _n = true;
536
- var _d = false;
537
- var _e = undefined;
538
194
 
539
- try {
540
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
541
- _arr.push(_s.value);
542
195
 
543
- if (i && _arr.length === i) break;
544
- }
545
- } catch (err) {
546
- _d = true;
547
- _e = err;
548
- } finally {
549
- try {
550
- if (!_n && _i["return"]) _i["return"]();
551
- } finally {
552
- if (_d) throw _e;
553
- }
554
- }
555
-
556
- return _arr;
557
- }
558
196
 
559
- return function (arr, i) {
560
- if (Array.isArray(arr)) {
561
- return arr;
562
- } else if (Symbol.iterator in Object(arr)) {
563
- return sliceIterator(arr, i);
564
- } else {
565
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
566
- }
567
- };
568
- }();
569
197
 
570
- var slicedToArrayLoose = function (arr, i) {
571
- if (Array.isArray(arr)) {
572
- return arr;
573
- } else if (Symbol.iterator in Object(arr)) {
574
- var _arr = [];
575
198
 
576
- for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
577
- _arr.push(_step.value);
578
199
 
579
- if (i && _arr.length === i) break;
580
- }
581
200
 
582
- return _arr;
583
- } else {
584
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
585
- }
586
- };
587
201
 
588
- var taggedTemplateLiteral = function (strings, raw) {
589
- return Object.freeze(Object.defineProperties(strings, {
590
- raw: {
591
- value: Object.freeze(raw)
592
- }
593
- }));
594
- };
595
202
 
596
- var taggedTemplateLiteralLoose = function (strings, raw) {
597
- strings.raw = raw;
598
- return strings;
599
- };
600
203
 
601
- var temporalRef = function (val, name, undef) {
602
- if (val === undef) {
603
- throw new ReferenceError(name + " is not defined - temporal dead zone");
604
- } else {
605
- return val;
606
- }
607
- };
608
204
 
609
- var temporalUndefined = {};
610
205
 
611
- var toArray = function (arr) {
612
- return Array.isArray(arr) ? arr : Array.from(arr);
613
- };
614
206
 
615
207
  var toConsumableArray = function (arr) {
616
208
  if (Array.isArray(arr)) {
@@ -622,56 +214,21 @@ var toConsumableArray = function (arr) {
622
214
  }
623
215
  };
624
216
 
625
-
626
-
627
- var babelHelpers$1 = Object.freeze({
628
- jsx: jsx,
629
- asyncIterator: asyncIterator,
630
- asyncGenerator: asyncGenerator,
631
- asyncGeneratorDelegate: asyncGeneratorDelegate,
632
- asyncToGenerator: asyncToGenerator,
633
- classCallCheck: classCallCheck,
634
- createClass: createClass,
635
- defineEnumerableProperties: defineEnumerableProperties,
636
- defaults: defaults,
637
- defineProperty: defineProperty,
638
- get: get,
639
- inherits: inherits,
640
- interopRequireDefault: interopRequireDefault,
641
- interopRequireWildcard: interopRequireWildcard,
642
- newArrowCheck: newArrowCheck,
643
- objectDestructuringEmpty: objectDestructuringEmpty,
644
- objectWithoutProperties: objectWithoutProperties,
645
- possibleConstructorReturn: possibleConstructorReturn,
646
- selfGlobal: selfGlobal,
647
- set: set,
648
- slicedToArray: slicedToArray,
649
- slicedToArrayLoose: slicedToArrayLoose,
650
- taggedTemplateLiteral: taggedTemplateLiteral,
651
- taggedTemplateLiteralLoose: taggedTemplateLiteralLoose,
652
- temporalRef: temporalRef,
653
- temporalUndefined: temporalUndefined,
654
- toArray: toArray,
655
- toConsumableArray: toConsumableArray,
656
- typeof: _typeof,
657
- extends: _extends,
658
- instanceof: _instanceof
659
- });
660
-
661
217
  /*
662
218
  * Copyright 2015, Yahoo Inc.
663
219
  * Copyrights licensed under the New BSD License.
664
220
  * See the accompanying LICENSE file for terms.
665
221
  */
666
222
 
667
- var bool = React.PropTypes.bool;
668
- var number = React.PropTypes.number;
669
- var string = React.PropTypes.string;
670
- var func = React.PropTypes.func;
671
- var object = React.PropTypes.object;
672
- var oneOf = React.PropTypes.oneOf;
673
- var shape = React.PropTypes.shape;
674
- var any = React.PropTypes.any;
223
+ var bool = PropTypes.bool;
224
+ var number = PropTypes.number;
225
+ var string = PropTypes.string;
226
+ var func = PropTypes.func;
227
+ var object = PropTypes.object;
228
+ var oneOf = PropTypes.oneOf;
229
+ var shape = PropTypes.shape;
230
+ var any = PropTypes.any;
231
+ var oneOfType = PropTypes.oneOfType;
675
232
 
676
233
  var localeMatcher = oneOf(['best fit', 'lookup']);
677
234
  var narrowShortLong = oneOf(['narrow', 'short', 'long']);
@@ -679,76 +236,76 @@ var numeric2digit = oneOf(['numeric', '2-digit']);
679
236
  var funcReq = func.isRequired;
680
237
 
681
238
  var intlConfigPropTypes = {
682
- locale: string,
683
- formats: object,
684
- messages: object,
685
- textComponent: any,
239
+ locale: string,
240
+ formats: object,
241
+ messages: object,
242
+ textComponent: any,
686
243
 
687
- defaultLocale: string,
688
- defaultFormats: object
244
+ defaultLocale: string,
245
+ defaultFormats: object
689
246
  };
690
247
 
691
248
  var intlFormatPropTypes = {
692
- formatDate: funcReq,
693
- formatTime: funcReq,
694
- formatRelative: funcReq,
695
- formatNumber: funcReq,
696
- formatPlural: funcReq,
697
- formatMessage: funcReq,
698
- formatHTMLMessage: funcReq
249
+ formatDate: funcReq,
250
+ formatTime: funcReq,
251
+ formatRelative: funcReq,
252
+ formatNumber: funcReq,
253
+ formatPlural: funcReq,
254
+ formatMessage: funcReq,
255
+ formatHTMLMessage: funcReq
699
256
  };
700
257
 
701
- var intlShape = shape(babelHelpers$1['extends']({}, intlConfigPropTypes, intlFormatPropTypes, {
702
- formatters: object,
703
- now: funcReq
258
+ var intlShape = shape(_extends({}, intlConfigPropTypes, intlFormatPropTypes, {
259
+ formatters: object,
260
+ now: funcReq
704
261
  }));
705
262
 
706
263
  var messageDescriptorPropTypes = {
707
- id: string.isRequired,
708
- description: string,
709
- defaultMessage: string
264
+ id: string.isRequired,
265
+ description: oneOfType([string, object]),
266
+ defaultMessage: string
710
267
  };
711
268
 
712
269
  var dateTimeFormatPropTypes = {
713
- localeMatcher: localeMatcher,
714
- formatMatcher: oneOf(['basic', 'best fit']),
715
-
716
- timeZone: string,
717
- hour12: bool,
718
-
719
- weekday: narrowShortLong,
720
- era: narrowShortLong,
721
- year: numeric2digit,
722
- month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
723
- day: numeric2digit,
724
- hour: numeric2digit,
725
- minute: numeric2digit,
726
- second: numeric2digit,
727
- timeZoneName: oneOf(['short', 'long'])
270
+ localeMatcher: localeMatcher,
271
+ formatMatcher: oneOf(['basic', 'best fit']),
272
+
273
+ timeZone: string,
274
+ hour12: bool,
275
+
276
+ weekday: narrowShortLong,
277
+ era: narrowShortLong,
278
+ year: numeric2digit,
279
+ month: oneOf(['numeric', '2-digit', 'narrow', 'short', 'long']),
280
+ day: numeric2digit,
281
+ hour: numeric2digit,
282
+ minute: numeric2digit,
283
+ second: numeric2digit,
284
+ timeZoneName: oneOf(['short', 'long'])
728
285
  };
729
286
 
730
287
  var numberFormatPropTypes = {
731
- localeMatcher: localeMatcher,
732
-
733
- style: oneOf(['decimal', 'currency', 'percent']),
734
- currency: string,
735
- currencyDisplay: oneOf(['symbol', 'code', 'name']),
736
- useGrouping: bool,
737
-
738
- minimumIntegerDigits: number,
739
- minimumFractionDigits: number,
740
- maximumFractionDigits: number,
741
- minimumSignificantDigits: number,
742
- maximumSignificantDigits: number
288
+ localeMatcher: localeMatcher,
289
+
290
+ style: oneOf(['decimal', 'currency', 'percent']),
291
+ currency: string,
292
+ currencyDisplay: oneOf(['symbol', 'code', 'name']),
293
+ useGrouping: bool,
294
+
295
+ minimumIntegerDigits: number,
296
+ minimumFractionDigits: number,
297
+ maximumFractionDigits: number,
298
+ minimumSignificantDigits: number,
299
+ maximumSignificantDigits: number
743
300
  };
744
301
 
745
302
  var relativeFormatPropTypes = {
746
- style: oneOf(['best fit', 'numeric']),
747
- units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
303
+ style: oneOf(['best fit', 'numeric']),
304
+ units: oneOf(['second', 'minute', 'hour', 'day', 'month', 'year'])
748
305
  };
749
306
 
750
307
  var pluralFormatPropTypes = {
751
- style: oneOf(['cardinal', 'ordinal'])
308
+ style: oneOf(['cardinal', 'ordinal'])
752
309
  };
753
310
 
754
311
  /*
@@ -765,82 +322,82 @@ file in the root directory of React's source tree.
765
322
  var intlConfigPropNames = Object.keys(intlConfigPropTypes);
766
323
 
767
324
  var ESCAPED_CHARS = {
768
- '&': '&amp;',
769
- '>': '&gt;',
770
- '<': '&lt;',
771
- '"': '&quot;',
772
- '\'': '&#x27;'
325
+ '&': '&amp;',
326
+ '>': '&gt;',
327
+ '<': '&lt;',
328
+ '"': '&quot;',
329
+ "'": '&#x27;'
773
330
  };
774
331
 
775
332
  var UNSAFE_CHARS_REGEX = /[&><"']/g;
776
333
 
777
334
  function escape(str) {
778
- return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
779
- return ESCAPED_CHARS[match];
780
- });
335
+ return ('' + str).replace(UNSAFE_CHARS_REGEX, function (match) {
336
+ return ESCAPED_CHARS[match];
337
+ });
781
338
  }
782
339
 
783
340
  function filterProps(props, whitelist) {
784
- var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
341
+ var defaults$$1 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
785
342
 
786
- return whitelist.reduce(function (filtered, name) {
787
- if (props.hasOwnProperty(name)) {
788
- filtered[name] = props[name];
789
- } else if (defaults$$1.hasOwnProperty(name)) {
790
- filtered[name] = defaults$$1[name];
791
- }
343
+ return whitelist.reduce(function (filtered, name) {
344
+ if (props.hasOwnProperty(name)) {
345
+ filtered[name] = props[name];
346
+ } else if (defaults$$1.hasOwnProperty(name)) {
347
+ filtered[name] = defaults$$1[name];
348
+ }
792
349
 
793
- return filtered;
794
- }, {});
350
+ return filtered;
351
+ }, {});
795
352
  }
796
353
 
797
354
  function invariantIntlContext() {
798
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
799
- intl = _ref.intl;
355
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
356
+ intl = _ref.intl;
800
357
 
801
- invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
358
+ invariant(intl, '[React Intl] Could not find required `intl` object. ' + '<IntlProvider> needs to exist in the component ancestry.');
802
359
  }
803
360
 
804
361
  function shallowEquals(objA, objB) {
805
- if (objA === objB) {
806
- return true;
807
- }
362
+ if (objA === objB) {
363
+ return true;
364
+ }
808
365
 
809
- if ((typeof objA === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : babelHelpers$1['typeof'](objB)) !== 'object' || objB === null) {
810
- return false;
811
- }
366
+ if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
367
+ return false;
368
+ }
812
369
 
813
- var keysA = Object.keys(objA);
814
- var keysB = Object.keys(objB);
370
+ var keysA = Object.keys(objA);
371
+ var keysB = Object.keys(objB);
815
372
 
816
- if (keysA.length !== keysB.length) {
817
- return false;
818
- }
373
+ if (keysA.length !== keysB.length) {
374
+ return false;
375
+ }
819
376
 
820
- // Test for A's keys different from B.
821
- var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
822
- for (var i = 0; i < keysA.length; i++) {
823
- if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
824
- return false;
825
- }
377
+ // Test for A's keys different from B.
378
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
379
+ for (var i = 0; i < keysA.length; i++) {
380
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
381
+ return false;
826
382
  }
383
+ }
827
384
 
828
- return true;
385
+ return true;
829
386
  }
830
387
 
831
388
  function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
832
- var props = _ref2.props,
833
- state = _ref2.state,
834
- _ref2$context = _ref2.context,
835
- context = _ref2$context === undefined ? {} : _ref2$context;
836
- var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
837
- var _context$intl = context.intl,
838
- intl = _context$intl === undefined ? {} : _context$intl;
839
- var _nextContext$intl = nextContext.intl,
840
- nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
841
-
842
-
843
- return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
389
+ var props = _ref2.props,
390
+ state = _ref2.state,
391
+ _ref2$context = _ref2.context,
392
+ context = _ref2$context === undefined ? {} : _ref2$context;
393
+ var nextContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
394
+ var _context$intl = context.intl,
395
+ intl = _context$intl === undefined ? {} : _context$intl;
396
+ var _nextContext$intl = nextContext.intl,
397
+ nextIntl = _nextContext$intl === undefined ? {} : _nextContext$intl;
398
+
399
+
400
+ return !shallowEquals(nextProps, props) || !shallowEquals(nextState, state) || !(nextIntl === intl || shallowEquals(filterProps(nextIntl, intlConfigPropNames), filterProps(intl, intlConfigPropNames)));
844
401
  }
845
402
 
846
403
  /*
@@ -853,54 +410,54 @@ function shouldIntlComponentUpdate(_ref2, nextProps, nextState) {
853
410
  // https://github.com/rackt/react-redux
854
411
 
855
412
  function getDisplayName(Component$$1) {
856
- return Component$$1.displayName || Component$$1.name || 'Component';
413
+ return Component$$1.displayName || Component$$1.name || 'Component';
857
414
  }
858
415
 
859
416
  function injectIntl(WrappedComponent) {
860
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
861
- var _options$intlPropName = options.intlPropName,
862
- intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
863
- _options$withRef = options.withRef,
864
- withRef = _options$withRef === undefined ? false : _options$withRef;
865
-
866
- var InjectIntl = function (_Component) {
867
- inherits(InjectIntl, _Component);
417
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
418
+ var _options$intlPropName = options.intlPropName,
419
+ intlPropName = _options$intlPropName === undefined ? 'intl' : _options$intlPropName,
420
+ _options$withRef = options.withRef,
421
+ withRef = _options$withRef === undefined ? false : _options$withRef;
868
422
 
869
- function InjectIntl(props, context) {
870
- classCallCheck(this, InjectIntl);
423
+ var InjectIntl = function (_Component) {
424
+ inherits(InjectIntl, _Component);
871
425
 
872
- var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
426
+ function InjectIntl(props, context) {
427
+ classCallCheck(this, InjectIntl);
873
428
 
874
- invariantIntlContext(context);
875
- return _this;
876
- }
429
+ var _this = possibleConstructorReturn(this, (InjectIntl.__proto__ || Object.getPrototypeOf(InjectIntl)).call(this, props, context));
877
430
 
878
- createClass(InjectIntl, [{
879
- key: 'getWrappedInstance',
880
- value: function getWrappedInstance() {
881
- invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
882
-
883
- return this.refs.wrappedInstance;
884
- }
885
- }, {
886
- key: 'render',
887
- value: function render() {
888
- return React__default.createElement(WrappedComponent, babelHelpers$1['extends']({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
889
- ref: withRef ? 'wrappedInstance' : null
890
- }));
891
- }
892
- }]);
893
- return InjectIntl;
894
- }(React.Component);
895
-
896
- InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
897
- InjectIntl.contextTypes = {
898
- intl: intlShape
899
- };
900
- InjectIntl.WrappedComponent = WrappedComponent;
431
+ invariantIntlContext(context);
432
+ return _this;
433
+ }
901
434
 
435
+ createClass(InjectIntl, [{
436
+ key: 'getWrappedInstance',
437
+ value: function getWrappedInstance() {
438
+ invariant(withRef, '[React Intl] To access the wrapped instance, ' + 'the `{withRef: true}` option must be set when calling: ' + '`injectIntl()`');
902
439
 
440
+ return this.refs.wrappedInstance;
441
+ }
442
+ }, {
443
+ key: 'render',
444
+ value: function render() {
445
+ return React__default.createElement(WrappedComponent, _extends({}, this.props, defineProperty({}, intlPropName, this.context.intl), {
446
+ ref: withRef ? 'wrappedInstance' : null
447
+ }));
448
+ }
449
+ }]);
903
450
  return InjectIntl;
451
+ }(React.Component);
452
+
453
+ InjectIntl.displayName = 'InjectIntl(' + getDisplayName(WrappedComponent) + ')';
454
+ InjectIntl.contextTypes = {
455
+ intl: intlShape
456
+ };
457
+ InjectIntl.WrappedComponent = WrappedComponent;
458
+
459
+
460
+ return InjectIntl;
904
461
  }
905
462
 
906
463
  /*
@@ -924,25 +481,25 @@ function defineMessages(messageDescriptors) {
924
481
  // This is a "hack" until a proper `intl-pluralformat` package is created.
925
482
 
926
483
  function resolveLocale(locales) {
927
- // IntlMessageFormat#_resolveLocale() does not depend on `this`.
928
- return IntlMessageFormat.prototype._resolveLocale(locales);
484
+ // IntlMessageFormat#_resolveLocale() does not depend on `this`.
485
+ return IntlMessageFormat.prototype._resolveLocale(locales);
929
486
  }
930
487
 
931
488
  function findPluralFunction(locale) {
932
- // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
933
- return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
489
+ // IntlMessageFormat#_findPluralFunction() does not depend on `this`.
490
+ return IntlMessageFormat.prototype._findPluralRuleFunction(locale);
934
491
  }
935
492
 
936
493
  var IntlPluralFormat = function IntlPluralFormat(locales) {
937
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
938
- classCallCheck(this, IntlPluralFormat);
494
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
495
+ classCallCheck(this, IntlPluralFormat);
939
496
 
940
- var useOrdinal = options.style === 'ordinal';
941
- var pluralFn = findPluralFunction(resolveLocale(locales));
497
+ var useOrdinal = options.style === 'ordinal';
498
+ var pluralFn = findPluralFunction(resolveLocale(locales));
942
499
 
943
- this.format = function (value) {
944
- return pluralFn(value, useOrdinal);
945
- };
500
+ this.format = function (value) {
501
+ return pluralFn(value, useOrdinal);
502
+ };
946
503
  };
947
504
 
948
505
  /*
@@ -957,234 +514,234 @@ var RELATIVE_FORMAT_OPTIONS = Object.keys(relativeFormatPropTypes);
957
514
  var PLURAL_FORMAT_OPTIONS = Object.keys(pluralFormatPropTypes);
958
515
 
959
516
  var RELATIVE_FORMAT_THRESHOLDS = {
960
- second: 60, // seconds to minute
961
- minute: 60, // minutes to hour
962
- hour: 24, // hours to day
963
- day: 30, // days to month
964
- month: 12 };
517
+ second: 60, // seconds to minute
518
+ minute: 60, // minutes to hour
519
+ hour: 24, // hours to day
520
+ day: 30, // days to month
521
+ month: 12 // months to year
522
+ };
965
523
 
966
524
  function updateRelativeFormatThresholds(newThresholds) {
967
- var thresholds = IntlRelativeFormat.thresholds;
968
- thresholds.second = newThresholds.second;
969
- thresholds.minute = newThresholds.minute;
970
- thresholds.hour = newThresholds.hour;
971
- thresholds.day = newThresholds.day;
972
- thresholds.month = newThresholds.month;
525
+ var thresholds = IntlRelativeFormat.thresholds;
526
+ thresholds.second = newThresholds.second;
527
+ thresholds.minute = newThresholds.minute;
528
+ thresholds.hour = newThresholds.hour;
529
+ thresholds.day = newThresholds.day;
530
+ thresholds.month = newThresholds.month;
973
531
  }
974
532
 
975
533
  function getNamedFormat(formats, type, name) {
976
- var format = formats && formats[type] && formats[type][name];
977
- if (format) {
978
- return format;
979
- }
534
+ var format = formats && formats[type] && formats[type][name];
535
+ if (format) {
536
+ return format;
537
+ }
980
538
 
981
- if (process.env.NODE_ENV !== 'production') {
982
- console.error('[React Intl] No ' + type + ' format named: ' + name);
983
- }
539
+ if (process.env.NODE_ENV !== 'production') {
540
+ console.error('[React Intl] No ' + type + ' format named: ' + name);
541
+ }
984
542
  }
985
543
 
986
544
  function formatDate(config, state, value) {
987
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
988
- var locale = config.locale,
989
- formats = config.formats;
990
- var format = options.format;
545
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
546
+ var locale = config.locale,
547
+ formats = config.formats;
548
+ var format = options.format;
991
549
 
992
550
 
993
- var date = new Date(value);
994
- var defaults$$1 = format && getNamedFormat(formats, 'date', format);
995
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
551
+ var date = new Date(value);
552
+ var defaults$$1 = format && getNamedFormat(formats, 'date', format);
553
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
996
554
 
997
- try {
998
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
999
- } catch (e) {
1000
- if (process.env.NODE_ENV !== 'production') {
1001
- console.error('[React Intl] Error formatting date.\n' + e);
1002
- }
555
+ try {
556
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
557
+ } catch (e) {
558
+ if (process.env.NODE_ENV !== 'production') {
559
+ console.error('[React Intl] Error formatting date.\n' + e);
1003
560
  }
561
+ }
1004
562
 
1005
- return String(date);
563
+ return String(date);
1006
564
  }
1007
565
 
1008
566
  function formatTime(config, state, value) {
1009
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1010
- var locale = config.locale,
1011
- formats = config.formats;
1012
- var format = options.format;
567
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
568
+ var locale = config.locale,
569
+ formats = config.formats;
570
+ var format = options.format;
1013
571
 
1014
572
 
1015
- var date = new Date(value);
1016
- var defaults$$1 = format && getNamedFormat(formats, 'time', format);
1017
- var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
573
+ var date = new Date(value);
574
+ var defaults$$1 = format && getNamedFormat(formats, 'time', format);
575
+ var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults$$1);
1018
576
 
1019
- if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
1020
- // Add default formatting options if hour, minute, or second isn't defined.
1021
- filteredOptions = babelHelpers$1['extends']({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
1022
- }
577
+ if (!filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second) {
578
+ // Add default formatting options if hour, minute, or second isn't defined.
579
+ filteredOptions = _extends({}, filteredOptions, { hour: 'numeric', minute: 'numeric' });
580
+ }
1023
581
 
1024
- try {
1025
- return state.getDateTimeFormat(locale, filteredOptions).format(date);
1026
- } catch (e) {
1027
- if (process.env.NODE_ENV !== 'production') {
1028
- console.error('[React Intl] Error formatting time.\n' + e);
1029
- }
582
+ try {
583
+ return state.getDateTimeFormat(locale, filteredOptions).format(date);
584
+ } catch (e) {
585
+ if (process.env.NODE_ENV !== 'production') {
586
+ console.error('[React Intl] Error formatting time.\n' + e);
1030
587
  }
588
+ }
1031
589
 
1032
- return String(date);
590
+ return String(date);
1033
591
  }
1034
592
 
1035
593
  function formatRelative(config, state, value) {
1036
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1037
- var locale = config.locale,
1038
- formats = config.formats;
1039
- var format = options.format;
594
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
595
+ var locale = config.locale,
596
+ formats = config.formats;
597
+ var format = options.format;
1040
598
 
1041
599
 
1042
- var date = new Date(value);
1043
- var now = new Date(options.now);
1044
- var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
1045
- var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
600
+ var date = new Date(value);
601
+ var now = new Date(options.now);
602
+ var defaults$$1 = format && getNamedFormat(formats, 'relative', format);
603
+ var filteredOptions = filterProps(options, RELATIVE_FORMAT_OPTIONS, defaults$$1);
1046
604
 
1047
- // Capture the current threshold values, then temporarily override them with
1048
- // specific values just for this render.
1049
- var oldThresholds = babelHelpers$1['extends']({}, IntlRelativeFormat.thresholds);
1050
- updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
605
+ // Capture the current threshold values, then temporarily override them with
606
+ // specific values just for this render.
607
+ var oldThresholds = _extends({}, IntlRelativeFormat.thresholds);
608
+ updateRelativeFormatThresholds(RELATIVE_FORMAT_THRESHOLDS);
1051
609
 
1052
- try {
1053
- return state.getRelativeFormat(locale, filteredOptions).format(date, {
1054
- now: isFinite(now) ? now : state.now()
1055
- });
1056
- } catch (e) {
1057
- if (process.env.NODE_ENV !== 'production') {
1058
- console.error('[React Intl] Error formatting relative time.\n' + e);
1059
- }
1060
- } finally {
1061
- updateRelativeFormatThresholds(oldThresholds);
610
+ try {
611
+ return state.getRelativeFormat(locale, filteredOptions).format(date, {
612
+ now: isFinite(now) ? now : state.now()
613
+ });
614
+ } catch (e) {
615
+ if (process.env.NODE_ENV !== 'production') {
616
+ console.error('[React Intl] Error formatting relative time.\n' + e);
1062
617
  }
618
+ } finally {
619
+ updateRelativeFormatThresholds(oldThresholds);
620
+ }
1063
621
 
1064
- return String(date);
622
+ return String(date);
1065
623
  }
1066
624
 
1067
625
  function formatNumber(config, state, value) {
1068
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1069
- var locale = config.locale,
1070
- formats = config.formats;
1071
- var format = options.format;
626
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
627
+ var locale = config.locale,
628
+ formats = config.formats;
629
+ var format = options.format;
1072
630
 
1073
631
 
1074
- var defaults$$1 = format && getNamedFormat(formats, 'number', format);
1075
- var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
632
+ var defaults$$1 = format && getNamedFormat(formats, 'number', format);
633
+ var filteredOptions = filterProps(options, NUMBER_FORMAT_OPTIONS, defaults$$1);
1076
634
 
1077
- try {
1078
- return state.getNumberFormat(locale, filteredOptions).format(value);
1079
- } catch (e) {
1080
- if (process.env.NODE_ENV !== 'production') {
1081
- console.error('[React Intl] Error formatting number.\n' + e);
1082
- }
635
+ try {
636
+ return state.getNumberFormat(locale, filteredOptions).format(value);
637
+ } catch (e) {
638
+ if (process.env.NODE_ENV !== 'production') {
639
+ console.error('[React Intl] Error formatting number.\n' + e);
1083
640
  }
641
+ }
1084
642
 
1085
- return String(value);
643
+ return String(value);
1086
644
  }
1087
645
 
1088
646
  function formatPlural(config, state, value) {
1089
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1090
- var locale = config.locale;
647
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
648
+ var locale = config.locale;
1091
649
 
1092
650
 
1093
- var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
651
+ var filteredOptions = filterProps(options, PLURAL_FORMAT_OPTIONS);
1094
652
 
1095
- try {
1096
- return state.getPluralFormat(locale, filteredOptions).format(value);
1097
- } catch (e) {
1098
- if (process.env.NODE_ENV !== 'production') {
1099
- console.error('[React Intl] Error formatting plural.\n' + e);
1100
- }
653
+ try {
654
+ return state.getPluralFormat(locale, filteredOptions).format(value);
655
+ } catch (e) {
656
+ if (process.env.NODE_ENV !== 'production') {
657
+ console.error('[React Intl] Error formatting plural.\n' + e);
1101
658
  }
659
+ }
1102
660
 
1103
- return 'other';
661
+ return 'other';
1104
662
  }
1105
663
 
1106
664
  function formatMessage(config, state) {
1107
- var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1108
- var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1109
- var locale = config.locale,
1110
- formats = config.formats,
1111
- messages = config.messages,
1112
- defaultLocale = config.defaultLocale,
1113
- defaultFormats = config.defaultFormats;
1114
- var id = messageDescriptor.id,
1115
- defaultMessage = messageDescriptor.defaultMessage;
1116
-
1117
- // `id` is a required field of a Message Descriptor.
1118
-
1119
- invariant(id, '[React Intl] An `id` must be provided to format a message.');
1120
-
1121
- var message = messages && messages[id];
1122
- var hasValues = Object.keys(values).length > 0;
1123
-
1124
- // Avoid expensive message formatting for simple messages without values. In
1125
- // development messages will always be formatted in case of missing values.
1126
- if (!hasValues && process.env.NODE_ENV === 'production') {
1127
- return message || defaultMessage || id;
1128
- }
1129
-
1130
- var formattedMessage = void 0;
665
+ var messageDescriptor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
666
+ var values = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
667
+ var locale = config.locale,
668
+ formats = config.formats,
669
+ messages = config.messages,
670
+ defaultLocale = config.defaultLocale,
671
+ defaultFormats = config.defaultFormats;
672
+ var id = messageDescriptor.id,
673
+ defaultMessage = messageDescriptor.defaultMessage;
674
+
675
+ // `id` is a required field of a Message Descriptor.
676
+
677
+ invariant(id, '[React Intl] An `id` must be provided to format a message.');
678
+
679
+ var message = messages && messages[id];
680
+ var hasValues = Object.keys(values).length > 0;
681
+
682
+ // Avoid expensive message formatting for simple messages without values. In
683
+ // development messages will always be formatted in case of missing values.
684
+ if (!hasValues && process.env.NODE_ENV === 'production') {
685
+ return message || defaultMessage || id;
686
+ }
1131
687
 
1132
- if (message) {
1133
- try {
1134
- var formatter = state.getMessageFormat(message, locale, formats);
688
+ var formattedMessage = void 0;
1135
689
 
1136
- formattedMessage = formatter.format(values);
1137
- } catch (e) {
1138
- if (process.env.NODE_ENV !== 'production') {
1139
- console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
1140
- }
1141
- }
1142
- } else {
1143
- if (process.env.NODE_ENV !== 'production') {
1144
- // This prevents warnings from littering the console in development
1145
- // when no `messages` are passed into the <IntlProvider> for the
1146
- // default locale, and a default message is in the source.
1147
- if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
690
+ if (message) {
691
+ try {
692
+ var formatter = state.getMessageFormat(message, locale, formats);
1148
693
 
1149
- console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
1150
- }
1151
- }
694
+ formattedMessage = formatter.format(values);
695
+ } catch (e) {
696
+ if (process.env.NODE_ENV !== 'production') {
697
+ console.error('[React Intl] Error formatting message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : '') + ('\n' + e));
698
+ }
699
+ }
700
+ } else {
701
+ if (process.env.NODE_ENV !== 'production') {
702
+ // This prevents warnings from littering the console in development
703
+ // when no `messages` are passed into the <IntlProvider> for the
704
+ // default locale, and a default message is in the source.
705
+ if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
706
+ console.error('[React Intl] Missing message: "' + id + '" for locale: "' + locale + '"' + (defaultMessage ? ', using default message as fallback.' : ''));
707
+ }
1152
708
  }
709
+ }
1153
710
 
1154
- if (!formattedMessage && defaultMessage) {
1155
- try {
1156
- var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
711
+ if (!formattedMessage && defaultMessage) {
712
+ try {
713
+ var _formatter = state.getMessageFormat(defaultMessage, defaultLocale, defaultFormats);
1157
714
 
1158
- formattedMessage = _formatter.format(values);
1159
- } catch (e) {
1160
- if (process.env.NODE_ENV !== 'production') {
1161
- console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
1162
- }
1163
- }
715
+ formattedMessage = _formatter.format(values);
716
+ } catch (e) {
717
+ if (process.env.NODE_ENV !== 'production') {
718
+ console.error('[React Intl] Error formatting the default message for: "' + id + '"' + ('\n' + e));
719
+ }
1164
720
  }
721
+ }
1165
722
 
1166
- if (!formattedMessage) {
1167
- if (process.env.NODE_ENV !== 'production') {
1168
- console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
1169
- }
723
+ if (!formattedMessage) {
724
+ if (process.env.NODE_ENV !== 'production') {
725
+ console.error('[React Intl] Cannot format message: "' + id + '", ' + ('using message ' + (message || defaultMessage ? 'source' : 'id') + ' as fallback.'));
1170
726
  }
727
+ }
1171
728
 
1172
- return formattedMessage || message || defaultMessage || id;
729
+ return formattedMessage || message || defaultMessage || id;
1173
730
  }
1174
731
 
1175
732
  function formatHTMLMessage(config, state, messageDescriptor) {
1176
- var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
1177
-
1178
- // Process all the values before they are used when formatting the ICU
1179
- // Message string. Since the formatted message might be injected via
1180
- // `innerHTML`, all String-based values need to be HTML-escaped.
1181
- var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
1182
- var value = rawValues[name];
1183
- escaped[name] = typeof value === 'string' ? escape(value) : value;
1184
- return escaped;
1185
- }, {});
1186
-
1187
- return formatMessage(config, state, messageDescriptor, escapedValues);
733
+ var rawValues = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
734
+
735
+ // Process all the values before they are used when formatting the ICU
736
+ // Message string. Since the formatted message might be injected via
737
+ // `innerHTML`, all String-based values need to be HTML-escaped.
738
+ var escapedValues = Object.keys(rawValues).reduce(function (escaped, name) {
739
+ var value = rawValues[name];
740
+ escaped[name] = typeof value === 'string' ? escape(value) : value;
741
+ return escaped;
742
+ }, {});
743
+
744
+ return formatMessage(config, state, messageDescriptor, escapedValues);
1188
745
  }
1189
746
 
1190
747
 
@@ -1211,170 +768,170 @@ var intlFormatPropNames = Object.keys(intlFormatPropTypes);
1211
768
  // These are not a static property on the `IntlProvider` class so the intl
1212
769
  // config values can be inherited from an <IntlProvider> ancestor.
1213
770
  var defaultProps = {
1214
- formats: {},
1215
- messages: {},
1216
- textComponent: 'span',
771
+ formats: {},
772
+ messages: {},
773
+ textComponent: 'span',
1217
774
 
1218
- defaultLocale: 'en',
1219
- defaultFormats: {}
775
+ defaultLocale: 'en',
776
+ defaultFormats: {}
1220
777
  };
1221
778
 
1222
779
  var IntlProvider = function (_Component) {
1223
- inherits(IntlProvider, _Component);
1224
-
1225
- function IntlProvider(props) {
1226
- var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1227
- classCallCheck(this, IntlProvider);
780
+ inherits(IntlProvider, _Component);
1228
781
 
1229
- var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
782
+ function IntlProvider(props) {
783
+ var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
784
+ classCallCheck(this, IntlProvider);
1230
785
 
1231
- 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/');
786
+ var _this = possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props, context));
1232
787
 
1233
- var intlContext = context.intl;
788
+ 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/');
1234
789
 
1235
- // Used to stabilize time when performing an initial rendering so that
1236
- // all relative times use the same reference "now" time.
790
+ var intlContext = context.intl;
1237
791
 
1238
- var initialNow = void 0;
1239
- if (isFinite(props.initialNow)) {
1240
- initialNow = Number(props.initialNow);
1241
- } else {
1242
- // When an `initialNow` isn't provided via `props`, look to see an
1243
- // <IntlProvider> exists in the ancestry and call its `now()`
1244
- // function to propagate its value for "now".
1245
- initialNow = intlContext ? intlContext.now() : Date.now();
1246
- }
792
+ // Used to stabilize time when performing an initial rendering so that
793
+ // all relative times use the same reference "now" time.
1247
794
 
1248
- // Creating `Intl*` formatters is expensive. If there's a parent
1249
- // `<IntlProvider>`, then its formatters will be used. Otherwise, this
1250
- // memoize the `Intl*` constructors and cache them for the lifecycle of
1251
- // this IntlProvider instance.
1252
-
1253
- var _ref = intlContext || {},
1254
- _ref$formatters = _ref.formatters,
1255
- formatters = _ref$formatters === undefined ? {
1256
- getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
1257
- getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
1258
- getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
1259
- getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
1260
- getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
1261
- } : _ref$formatters;
1262
-
1263
- _this.state = babelHelpers$1['extends']({}, formatters, {
1264
-
1265
- // Wrapper to provide stable "now" time for initial render.
1266
- now: function now() {
1267
- return _this._didDisplay ? Date.now() : initialNow;
1268
- }
1269
- });
1270
- return _this;
795
+ var initialNow = void 0;
796
+ if (isFinite(props.initialNow)) {
797
+ initialNow = Number(props.initialNow);
798
+ } else {
799
+ // When an `initialNow` isn't provided via `props`, look to see an
800
+ // <IntlProvider> exists in the ancestry and call its `now()`
801
+ // function to propagate its value for "now".
802
+ initialNow = intlContext ? intlContext.now() : Date.now();
1271
803
  }
1272
804
 
1273
- createClass(IntlProvider, [{
1274
- key: 'getConfig',
1275
- value: function getConfig() {
1276
- var intlContext = this.context.intl;
1277
-
1278
- // Build a whitelisted config object from `props`, defaults, and
1279
- // `context.intl`, if an <IntlProvider> exists in the ancestry.
1280
-
1281
- var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
1282
-
1283
- // Apply default props. This must be applied last after the props have
1284
- // been resolved and inherited from any <IntlProvider> in the ancestry.
1285
- // This matches how React resolves `defaultProps`.
1286
- for (var propName in defaultProps) {
1287
- if (config[propName] === undefined) {
1288
- config[propName] = defaultProps[propName];
1289
- }
1290
- }
1291
-
1292
- if (!hasLocaleData(config.locale)) {
1293
- var _config = config,
1294
- locale = _config.locale,
1295
- defaultLocale = _config.defaultLocale,
1296
- defaultFormats = _config.defaultFormats;
1297
-
1298
-
1299
- if (process.env.NODE_ENV !== 'production') {
1300
- console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
1301
- }
1302
-
1303
- // Since there's no registered locale data for `locale`, this will
1304
- // fallback to the `defaultLocale` to make sure things can render.
1305
- // The `messages` are overridden to the `defaultProps` empty object
1306
- // to maintain referential equality across re-renders. It's assumed
1307
- // each <FormattedMessage> contains a `defaultMessage` prop.
1308
- config = babelHelpers$1['extends']({}, config, {
1309
- locale: defaultLocale,
1310
- formats: defaultFormats,
1311
- messages: defaultProps.messages
1312
- });
1313
- }
1314
-
1315
- return config;
1316
- }
1317
- }, {
1318
- key: 'getBoundFormatFns',
1319
- value: function getBoundFormatFns(config, state) {
1320
- return intlFormatPropNames.reduce(function (boundFormatFns, name) {
1321
- boundFormatFns[name] = format[name].bind(null, config, state);
1322
- return boundFormatFns;
1323
- }, {});
1324
- }
1325
- }, {
1326
- key: 'getChildContext',
1327
- value: function getChildContext() {
1328
- var config = this.getConfig();
805
+ // Creating `Intl*` formatters is expensive. If there's a parent
806
+ // `<IntlProvider>`, then its formatters will be used. Otherwise, this
807
+ // memoize the `Intl*` constructors and cache them for the lifecycle of
808
+ // this IntlProvider instance.
809
+
810
+ var _ref = intlContext || {},
811
+ _ref$formatters = _ref.formatters,
812
+ formatters = _ref$formatters === undefined ? {
813
+ getDateTimeFormat: memoizeIntlConstructor(Intl.DateTimeFormat),
814
+ getNumberFormat: memoizeIntlConstructor(Intl.NumberFormat),
815
+ getMessageFormat: memoizeIntlConstructor(IntlMessageFormat),
816
+ getRelativeFormat: memoizeIntlConstructor(IntlRelativeFormat),
817
+ getPluralFormat: memoizeIntlConstructor(IntlPluralFormat)
818
+ } : _ref$formatters;
819
+
820
+ _this.state = _extends({}, formatters, {
821
+
822
+ // Wrapper to provide stable "now" time for initial render.
823
+ now: function now() {
824
+ return _this._didDisplay ? Date.now() : initialNow;
825
+ }
826
+ });
827
+ return _this;
828
+ }
1329
829
 
1330
- // Bind intl factories and current config to the format functions.
1331
- var boundFormatFns = this.getBoundFormatFns(config, this.state);
830
+ createClass(IntlProvider, [{
831
+ key: 'getConfig',
832
+ value: function getConfig() {
833
+ var intlContext = this.context.intl;
1332
834
 
1333
- var _state = this.state,
1334
- now = _state.now,
1335
- formatters = objectWithoutProperties(_state, ['now']);
835
+ // Build a whitelisted config object from `props`, defaults, and
836
+ // `context.intl`, if an <IntlProvider> exists in the ancestry.
1336
837
 
838
+ var config = filterProps(this.props, intlConfigPropNames$1, intlContext);
1337
839
 
1338
- return {
1339
- intl: babelHelpers$1['extends']({}, config, boundFormatFns, {
1340
- formatters: formatters,
1341
- now: now
1342
- })
1343
- };
840
+ // Apply default props. This must be applied last after the props have
841
+ // been resolved and inherited from any <IntlProvider> in the ancestry.
842
+ // This matches how React resolves `defaultProps`.
843
+ for (var propName in defaultProps) {
844
+ if (config[propName] === undefined) {
845
+ config[propName] = defaultProps[propName];
1344
846
  }
1345
- }, {
1346
- key: 'shouldComponentUpdate',
1347
- value: function shouldComponentUpdate() {
1348
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1349
- next[_key] = arguments[_key];
1350
- }
847
+ }
1351
848
 
1352
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1353
- }
1354
- }, {
1355
- key: 'componentDidMount',
1356
- value: function componentDidMount() {
1357
- this._didDisplay = true;
1358
- }
1359
- }, {
1360
- key: 'render',
1361
- value: function render() {
1362
- return React.Children.only(this.props.children);
849
+ if (!hasLocaleData(config.locale)) {
850
+ var _config = config,
851
+ locale = _config.locale,
852
+ defaultLocale = _config.defaultLocale,
853
+ defaultFormats = _config.defaultFormats;
854
+
855
+
856
+ if (process.env.NODE_ENV !== 'production') {
857
+ console.error('[React Intl] Missing locale data for locale: "' + locale + '". ' + ('Using default locale: "' + defaultLocale + '" as fallback.'));
1363
858
  }
1364
- }]);
1365
- return IntlProvider;
859
+
860
+ // Since there's no registered locale data for `locale`, this will
861
+ // fallback to the `defaultLocale` to make sure things can render.
862
+ // The `messages` are overridden to the `defaultProps` empty object
863
+ // to maintain referential equality across re-renders. It's assumed
864
+ // each <FormattedMessage> contains a `defaultMessage` prop.
865
+ config = _extends({}, config, {
866
+ locale: defaultLocale,
867
+ formats: defaultFormats,
868
+ messages: defaultProps.messages
869
+ });
870
+ }
871
+
872
+ return config;
873
+ }
874
+ }, {
875
+ key: 'getBoundFormatFns',
876
+ value: function getBoundFormatFns(config, state) {
877
+ return intlFormatPropNames.reduce(function (boundFormatFns, name) {
878
+ boundFormatFns[name] = format[name].bind(null, config, state);
879
+ return boundFormatFns;
880
+ }, {});
881
+ }
882
+ }, {
883
+ key: 'getChildContext',
884
+ value: function getChildContext() {
885
+ var config = this.getConfig();
886
+
887
+ // Bind intl factories and current config to the format functions.
888
+ var boundFormatFns = this.getBoundFormatFns(config, this.state);
889
+
890
+ var _state = this.state,
891
+ now = _state.now,
892
+ formatters = objectWithoutProperties(_state, ['now']);
893
+
894
+
895
+ return {
896
+ intl: _extends({}, config, boundFormatFns, {
897
+ formatters: formatters,
898
+ now: now
899
+ })
900
+ };
901
+ }
902
+ }, {
903
+ key: 'shouldComponentUpdate',
904
+ value: function shouldComponentUpdate() {
905
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
906
+ next[_key] = arguments[_key];
907
+ }
908
+
909
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
910
+ }
911
+ }, {
912
+ key: 'componentDidMount',
913
+ value: function componentDidMount() {
914
+ this._didDisplay = true;
915
+ }
916
+ }, {
917
+ key: 'render',
918
+ value: function render() {
919
+ return React.Children.only(this.props.children);
920
+ }
921
+ }]);
922
+ return IntlProvider;
1366
923
  }(React.Component);
1367
924
 
1368
925
  IntlProvider.displayName = 'IntlProvider';
1369
926
  IntlProvider.contextTypes = {
1370
- intl: intlShape
927
+ intl: intlShape
1371
928
  };
1372
929
  IntlProvider.childContextTypes = {
1373
- intl: intlShape.isRequired
930
+ intl: intlShape.isRequired
1374
931
  };
1375
- process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = babelHelpers$1['extends']({}, intlConfigPropTypes, {
1376
- children: React.PropTypes.element.isRequired,
1377
- initialNow: React.PropTypes.any
932
+ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = _extends({}, intlConfigPropTypes, {
933
+ children: PropTypes.element.isRequired,
934
+ initialNow: PropTypes.any
1378
935
  }) : void 0;
1379
936
 
1380
937
  /*
@@ -1384,61 +941,61 @@ process.env.NODE_ENV !== "production" ? IntlProvider.propTypes = babelHelpers$1[
1384
941
  */
1385
942
 
1386
943
  var FormattedDate = function (_Component) {
1387
- inherits(FormattedDate, _Component);
944
+ inherits(FormattedDate, _Component);
1388
945
 
1389
- function FormattedDate(props, context) {
1390
- classCallCheck(this, FormattedDate);
946
+ function FormattedDate(props, context) {
947
+ classCallCheck(this, FormattedDate);
1391
948
 
1392
- var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
949
+ var _this = possibleConstructorReturn(this, (FormattedDate.__proto__ || Object.getPrototypeOf(FormattedDate)).call(this, props, context));
1393
950
 
1394
- invariantIntlContext(context);
1395
- return _this;
951
+ invariantIntlContext(context);
952
+ return _this;
953
+ }
954
+
955
+ createClass(FormattedDate, [{
956
+ key: 'shouldComponentUpdate',
957
+ value: function shouldComponentUpdate() {
958
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
959
+ next[_key] = arguments[_key];
960
+ }
961
+
962
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1396
963
  }
964
+ }, {
965
+ key: 'render',
966
+ value: function render() {
967
+ var _context$intl = this.context.intl,
968
+ formatDate = _context$intl.formatDate,
969
+ Text = _context$intl.textComponent;
970
+ var _props = this.props,
971
+ value = _props.value,
972
+ children = _props.children;
1397
973
 
1398
- createClass(FormattedDate, [{
1399
- key: 'shouldComponentUpdate',
1400
- value: function shouldComponentUpdate() {
1401
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1402
- next[_key] = arguments[_key];
1403
- }
1404
974
 
1405
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1406
- }
1407
- }, {
1408
- key: 'render',
1409
- value: function render() {
1410
- var _context$intl = this.context.intl,
1411
- formatDate = _context$intl.formatDate,
1412
- Text = _context$intl.textComponent;
1413
- var _props = this.props,
1414
- value = _props.value,
1415
- children = _props.children;
1416
-
1417
-
1418
- var formattedDate = formatDate(value, this.props);
1419
-
1420
- if (typeof children === 'function') {
1421
- return children(formattedDate);
1422
- }
1423
-
1424
- return React__default.createElement(
1425
- Text,
1426
- null,
1427
- formattedDate
1428
- );
1429
- }
1430
- }]);
1431
- return FormattedDate;
975
+ var formattedDate = formatDate(value, this.props);
976
+
977
+ if (typeof children === 'function') {
978
+ return children(formattedDate);
979
+ }
980
+
981
+ return React__default.createElement(
982
+ Text,
983
+ null,
984
+ formattedDate
985
+ );
986
+ }
987
+ }]);
988
+ return FormattedDate;
1432
989
  }(React.Component);
1433
990
 
1434
991
  FormattedDate.displayName = 'FormattedDate';
1435
992
  FormattedDate.contextTypes = {
1436
- intl: intlShape
993
+ intl: intlShape
1437
994
  };
1438
- process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1439
- value: React.PropTypes.any.isRequired,
1440
- format: React.PropTypes.string,
1441
- children: React.PropTypes.func
995
+ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = _extends({}, dateTimeFormatPropTypes, {
996
+ value: PropTypes.any.isRequired,
997
+ format: PropTypes.string,
998
+ children: PropTypes.func
1442
999
  }) : void 0;
1443
1000
 
1444
1001
  /*
@@ -1448,61 +1005,61 @@ process.env.NODE_ENV !== "production" ? FormattedDate.propTypes = babelHelpers$1
1448
1005
  */
1449
1006
 
1450
1007
  var FormattedTime = function (_Component) {
1451
- inherits(FormattedTime, _Component);
1008
+ inherits(FormattedTime, _Component);
1452
1009
 
1453
- function FormattedTime(props, context) {
1454
- classCallCheck(this, FormattedTime);
1010
+ function FormattedTime(props, context) {
1011
+ classCallCheck(this, FormattedTime);
1455
1012
 
1456
- var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1013
+ var _this = possibleConstructorReturn(this, (FormattedTime.__proto__ || Object.getPrototypeOf(FormattedTime)).call(this, props, context));
1457
1014
 
1458
- invariantIntlContext(context);
1459
- return _this;
1015
+ invariantIntlContext(context);
1016
+ return _this;
1017
+ }
1018
+
1019
+ createClass(FormattedTime, [{
1020
+ key: 'shouldComponentUpdate',
1021
+ value: function shouldComponentUpdate() {
1022
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1023
+ next[_key] = arguments[_key];
1024
+ }
1025
+
1026
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1460
1027
  }
1028
+ }, {
1029
+ key: 'render',
1030
+ value: function render() {
1031
+ var _context$intl = this.context.intl,
1032
+ formatTime = _context$intl.formatTime,
1033
+ Text = _context$intl.textComponent;
1034
+ var _props = this.props,
1035
+ value = _props.value,
1036
+ children = _props.children;
1461
1037
 
1462
- createClass(FormattedTime, [{
1463
- key: 'shouldComponentUpdate',
1464
- value: function shouldComponentUpdate() {
1465
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1466
- next[_key] = arguments[_key];
1467
- }
1468
1038
 
1469
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1470
- }
1471
- }, {
1472
- key: 'render',
1473
- value: function render() {
1474
- var _context$intl = this.context.intl,
1475
- formatTime = _context$intl.formatTime,
1476
- Text = _context$intl.textComponent;
1477
- var _props = this.props,
1478
- value = _props.value,
1479
- children = _props.children;
1480
-
1481
-
1482
- var formattedTime = formatTime(value, this.props);
1483
-
1484
- if (typeof children === 'function') {
1485
- return children(formattedTime);
1486
- }
1487
-
1488
- return React__default.createElement(
1489
- Text,
1490
- null,
1491
- formattedTime
1492
- );
1493
- }
1494
- }]);
1495
- return FormattedTime;
1039
+ var formattedTime = formatTime(value, this.props);
1040
+
1041
+ if (typeof children === 'function') {
1042
+ return children(formattedTime);
1043
+ }
1044
+
1045
+ return React__default.createElement(
1046
+ Text,
1047
+ null,
1048
+ formattedTime
1049
+ );
1050
+ }
1051
+ }]);
1052
+ return FormattedTime;
1496
1053
  }(React.Component);
1497
1054
 
1498
1055
  FormattedTime.displayName = 'FormattedTime';
1499
1056
  FormattedTime.contextTypes = {
1500
- intl: intlShape
1057
+ intl: intlShape
1501
1058
  };
1502
- process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = babelHelpers$1['extends']({}, dateTimeFormatPropTypes, {
1503
- value: React.PropTypes.any.isRequired,
1504
- format: React.PropTypes.string,
1505
- children: React.PropTypes.func
1059
+ process.env.NODE_ENV !== "production" ? FormattedTime.propTypes = _extends({}, dateTimeFormatPropTypes, {
1060
+ value: PropTypes.any.isRequired,
1061
+ format: PropTypes.string,
1062
+ children: PropTypes.func
1506
1063
  }) : void 0;
1507
1064
 
1508
1065
  /*
@@ -1521,177 +1078,179 @@ var DAY = 1000 * 60 * 60 * 24;
1521
1078
  var MAX_TIMER_DELAY = 2147483647;
1522
1079
 
1523
1080
  function selectUnits(delta) {
1524
- var absDelta = Math.abs(delta);
1081
+ var absDelta = Math.abs(delta);
1525
1082
 
1526
- if (absDelta < MINUTE) {
1527
- return 'second';
1528
- }
1083
+ if (absDelta < MINUTE) {
1084
+ return 'second';
1085
+ }
1529
1086
 
1530
- if (absDelta < HOUR) {
1531
- return 'minute';
1532
- }
1087
+ if (absDelta < HOUR) {
1088
+ return 'minute';
1089
+ }
1533
1090
 
1534
- if (absDelta < DAY) {
1535
- return 'hour';
1536
- }
1091
+ if (absDelta < DAY) {
1092
+ return 'hour';
1093
+ }
1537
1094
 
1538
- // The maximum scheduled delay will be measured in days since the maximum
1539
- // timer delay is less than the number of milliseconds in 25 days.
1540
- return 'day';
1095
+ // The maximum scheduled delay will be measured in days since the maximum
1096
+ // timer delay is less than the number of milliseconds in 25 days.
1097
+ return 'day';
1541
1098
  }
1542
1099
 
1543
1100
  function getUnitDelay(units) {
1544
- switch (units) {
1545
- case 'second':
1546
- return SECOND;
1547
- case 'minute':
1548
- return MINUTE;
1549
- case 'hour':
1550
- return HOUR;
1551
- case 'day':
1552
- return DAY;
1553
- default:
1554
- return MAX_TIMER_DELAY;
1555
- }
1101
+ switch (units) {
1102
+ case 'second':
1103
+ return SECOND;
1104
+ case 'minute':
1105
+ return MINUTE;
1106
+ case 'hour':
1107
+ return HOUR;
1108
+ case 'day':
1109
+ return DAY;
1110
+ default:
1111
+ return MAX_TIMER_DELAY;
1112
+ }
1556
1113
  }
1557
1114
 
1558
1115
  function isSameDate(a, b) {
1559
- if (a === b) {
1560
- return true;
1561
- }
1116
+ if (a === b) {
1117
+ return true;
1118
+ }
1562
1119
 
1563
- var aTime = new Date(a).getTime();
1564
- var bTime = new Date(b).getTime();
1120
+ var aTime = new Date(a).getTime();
1121
+ var bTime = new Date(b).getTime();
1565
1122
 
1566
- return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1123
+ return isFinite(aTime) && isFinite(bTime) && aTime === bTime;
1567
1124
  }
1568
1125
 
1569
1126
  var FormattedRelative = function (_Component) {
1570
- inherits(FormattedRelative, _Component);
1127
+ inherits(FormattedRelative, _Component);
1571
1128
 
1572
- function FormattedRelative(props, context) {
1573
- classCallCheck(this, FormattedRelative);
1129
+ function FormattedRelative(props, context) {
1130
+ classCallCheck(this, FormattedRelative);
1574
1131
 
1575
- var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1132
+ var _this = possibleConstructorReturn(this, (FormattedRelative.__proto__ || Object.getPrototypeOf(FormattedRelative)).call(this, props, context));
1576
1133
 
1577
- invariantIntlContext(context);
1134
+ invariantIntlContext(context);
1578
1135
 
1579
- var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1136
+ var now = isFinite(props.initialNow) ? Number(props.initialNow) : context.intl.now();
1580
1137
 
1581
- // `now` is stored as state so that `render()` remains a function of
1582
- // props + state, instead of accessing `Date.now()` inside `render()`.
1583
- _this.state = { now: now };
1584
- return _this;
1585
- }
1138
+ // `now` is stored as state so that `render()` remains a function of
1139
+ // props + state, instead of accessing `Date.now()` inside `render()`.
1140
+ _this.state = { now: now };
1141
+ return _this;
1142
+ }
1586
1143
 
1587
- createClass(FormattedRelative, [{
1588
- key: 'scheduleNextUpdate',
1589
- value: function scheduleNextUpdate(props, state) {
1590
- var _this2 = this;
1144
+ createClass(FormattedRelative, [{
1145
+ key: 'scheduleNextUpdate',
1146
+ value: function scheduleNextUpdate(props, state) {
1147
+ var _this2 = this;
1591
1148
 
1592
- var updateInterval = props.updateInterval;
1149
+ // Cancel and pending update because we're scheduling a new update.
1150
+ clearTimeout(this._timer);
1593
1151
 
1594
- // If the `updateInterval` is falsy, including `0`, then auto updates
1595
- // have been turned off, so we bail and skip scheduling an update.
1152
+ var value = props.value,
1153
+ units = props.units,
1154
+ updateInterval = props.updateInterval;
1596
1155
 
1597
- if (!updateInterval) {
1598
- return;
1599
- }
1156
+ var time = new Date(value).getTime();
1600
1157
 
1601
- var time = new Date(props.value).getTime();
1602
- var delta = time - state.now;
1603
- var units = props.units || selectUnits(delta);
1158
+ // If the `updateInterval` is falsy, including `0` or we don't have a
1159
+ // valid date, then auto updates have been turned off, so we bail and
1160
+ // skip scheduling an update.
1161
+ if (!updateInterval || !isFinite(time)) {
1162
+ return;
1163
+ }
1604
1164
 
1605
- var unitDelay = getUnitDelay(units);
1606
- var unitRemainder = Math.abs(delta % unitDelay);
1165
+ var delta = time - state.now;
1166
+ var unitDelay = getUnitDelay(units || selectUnits(delta));
1167
+ var unitRemainder = Math.abs(delta % unitDelay);
1607
1168
 
1608
- // We want the largest possible timer delay which will still display
1609
- // accurate information while reducing unnecessary re-renders. The delay
1610
- // should be until the next "interesting" moment, like a tick from
1611
- // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1612
- var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1169
+ // We want the largest possible timer delay which will still display
1170
+ // accurate information while reducing unnecessary re-renders. The delay
1171
+ // should be until the next "interesting" moment, like a tick from
1172
+ // "1 minute ago" to "2 minutes ago" when the delta is 120,000ms.
1173
+ var delay = delta < 0 ? Math.max(updateInterval, unitDelay - unitRemainder) : Math.max(updateInterval, unitRemainder);
1613
1174
 
1614
- clearTimeout(this._timer);
1175
+ this._timer = setTimeout(function () {
1176
+ _this2.setState({ now: _this2.context.intl.now() });
1177
+ }, delay);
1178
+ }
1179
+ }, {
1180
+ key: 'componentDidMount',
1181
+ value: function componentDidMount() {
1182
+ this.scheduleNextUpdate(this.props, this.state);
1183
+ }
1184
+ }, {
1185
+ key: 'componentWillReceiveProps',
1186
+ value: function componentWillReceiveProps(_ref) {
1187
+ var nextValue = _ref.value;
1188
+
1189
+ // When the `props.value` date changes, `state.now` needs to be updated,
1190
+ // and the next update can be rescheduled.
1191
+ if (!isSameDate(nextValue, this.props.value)) {
1192
+ this.setState({ now: this.context.intl.now() });
1193
+ }
1194
+ }
1195
+ }, {
1196
+ key: 'shouldComponentUpdate',
1197
+ value: function shouldComponentUpdate() {
1198
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1199
+ next[_key] = arguments[_key];
1200
+ }
1615
1201
 
1616
- this._timer = setTimeout(function () {
1617
- _this2.setState({ now: _this2.context.intl.now() });
1618
- }, delay);
1619
- }
1620
- }, {
1621
- key: 'componentDidMount',
1622
- value: function componentDidMount() {
1623
- this.scheduleNextUpdate(this.props, this.state);
1624
- }
1625
- }, {
1626
- key: 'componentWillReceiveProps',
1627
- value: function componentWillReceiveProps(_ref) {
1628
- var nextValue = _ref.value;
1629
-
1630
- // When the `props.value` date changes, `state.now` needs to be updated,
1631
- // and the next update can be rescheduled.
1632
- if (!isSameDate(nextValue, this.props.value)) {
1633
- this.setState({ now: this.context.intl.now() });
1634
- }
1635
- }
1636
- }, {
1637
- key: 'shouldComponentUpdate',
1638
- value: function shouldComponentUpdate() {
1639
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1640
- next[_key] = arguments[_key];
1641
- }
1202
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1203
+ }
1204
+ }, {
1205
+ key: 'componentWillUpdate',
1206
+ value: function componentWillUpdate(nextProps, nextState) {
1207
+ this.scheduleNextUpdate(nextProps, nextState);
1208
+ }
1209
+ }, {
1210
+ key: 'componentWillUnmount',
1211
+ value: function componentWillUnmount() {
1212
+ clearTimeout(this._timer);
1213
+ }
1214
+ }, {
1215
+ key: 'render',
1216
+ value: function render() {
1217
+ var _context$intl = this.context.intl,
1218
+ formatRelative = _context$intl.formatRelative,
1219
+ Text = _context$intl.textComponent;
1220
+ var _props = this.props,
1221
+ value = _props.value,
1222
+ children = _props.children;
1642
1223
 
1643
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1644
- }
1645
- }, {
1646
- key: 'componentWillUpdate',
1647
- value: function componentWillUpdate(nextProps, nextState) {
1648
- this.scheduleNextUpdate(nextProps, nextState);
1649
- }
1650
- }, {
1651
- key: 'componentWillUnmount',
1652
- value: function componentWillUnmount() {
1653
- clearTimeout(this._timer);
1654
- }
1655
- }, {
1656
- key: 'render',
1657
- value: function render() {
1658
- var _context$intl = this.context.intl,
1659
- formatRelative = _context$intl.formatRelative,
1660
- Text = _context$intl.textComponent;
1661
- var _props = this.props,
1662
- value = _props.value,
1663
- children = _props.children;
1664
-
1665
-
1666
- var formattedRelative = formatRelative(value, babelHelpers$1['extends']({}, this.props, this.state));
1667
-
1668
- if (typeof children === 'function') {
1669
- return children(formattedRelative);
1670
- }
1671
-
1672
- return React__default.createElement(
1673
- Text,
1674
- null,
1675
- formattedRelative
1676
- );
1677
- }
1678
- }]);
1679
- return FormattedRelative;
1224
+
1225
+ var formattedRelative = formatRelative(value, _extends({}, this.props, this.state));
1226
+
1227
+ if (typeof children === 'function') {
1228
+ return children(formattedRelative);
1229
+ }
1230
+
1231
+ return React__default.createElement(
1232
+ Text,
1233
+ null,
1234
+ formattedRelative
1235
+ );
1236
+ }
1237
+ }]);
1238
+ return FormattedRelative;
1680
1239
  }(React.Component);
1681
1240
 
1682
1241
  FormattedRelative.displayName = 'FormattedRelative';
1683
1242
  FormattedRelative.contextTypes = {
1684
- intl: intlShape
1243
+ intl: intlShape
1685
1244
  };
1686
1245
  FormattedRelative.defaultProps = {
1687
- updateInterval: 1000 * 10
1246
+ updateInterval: 1000 * 10
1688
1247
  };
1689
- process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = babelHelpers$1['extends']({}, relativeFormatPropTypes, {
1690
- value: React.PropTypes.any.isRequired,
1691
- format: React.PropTypes.string,
1692
- updateInterval: React.PropTypes.number,
1693
- initialNow: React.PropTypes.any,
1694
- children: React.PropTypes.func
1248
+ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = _extends({}, relativeFormatPropTypes, {
1249
+ value: PropTypes.any.isRequired,
1250
+ format: PropTypes.string,
1251
+ updateInterval: PropTypes.number,
1252
+ initialNow: PropTypes.any,
1253
+ children: PropTypes.func
1695
1254
  }) : void 0;
1696
1255
 
1697
1256
  /*
@@ -1701,61 +1260,61 @@ process.env.NODE_ENV !== "production" ? FormattedRelative.propTypes = babelHelpe
1701
1260
  */
1702
1261
 
1703
1262
  var FormattedNumber = function (_Component) {
1704
- inherits(FormattedNumber, _Component);
1263
+ inherits(FormattedNumber, _Component);
1705
1264
 
1706
- function FormattedNumber(props, context) {
1707
- classCallCheck(this, FormattedNumber);
1265
+ function FormattedNumber(props, context) {
1266
+ classCallCheck(this, FormattedNumber);
1708
1267
 
1709
- var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1268
+ var _this = possibleConstructorReturn(this, (FormattedNumber.__proto__ || Object.getPrototypeOf(FormattedNumber)).call(this, props, context));
1269
+
1270
+ invariantIntlContext(context);
1271
+ return _this;
1272
+ }
1710
1273
 
1711
- invariantIntlContext(context);
1712
- return _this;
1274
+ createClass(FormattedNumber, [{
1275
+ key: 'shouldComponentUpdate',
1276
+ value: function shouldComponentUpdate() {
1277
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1278
+ next[_key] = arguments[_key];
1279
+ }
1280
+
1281
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1713
1282
  }
1283
+ }, {
1284
+ key: 'render',
1285
+ value: function render() {
1286
+ var _context$intl = this.context.intl,
1287
+ formatNumber = _context$intl.formatNumber,
1288
+ Text = _context$intl.textComponent;
1289
+ var _props = this.props,
1290
+ value = _props.value,
1291
+ children = _props.children;
1714
1292
 
1715
- createClass(FormattedNumber, [{
1716
- key: 'shouldComponentUpdate',
1717
- value: function shouldComponentUpdate() {
1718
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1719
- next[_key] = arguments[_key];
1720
- }
1721
1293
 
1722
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1723
- }
1724
- }, {
1725
- key: 'render',
1726
- value: function render() {
1727
- var _context$intl = this.context.intl,
1728
- formatNumber = _context$intl.formatNumber,
1729
- Text = _context$intl.textComponent;
1730
- var _props = this.props,
1731
- value = _props.value,
1732
- children = _props.children;
1733
-
1734
-
1735
- var formattedNumber = formatNumber(value, this.props);
1736
-
1737
- if (typeof children === 'function') {
1738
- return children(formattedNumber);
1739
- }
1740
-
1741
- return React__default.createElement(
1742
- Text,
1743
- null,
1744
- formattedNumber
1745
- );
1746
- }
1747
- }]);
1748
- return FormattedNumber;
1294
+ var formattedNumber = formatNumber(value, this.props);
1295
+
1296
+ if (typeof children === 'function') {
1297
+ return children(formattedNumber);
1298
+ }
1299
+
1300
+ return React__default.createElement(
1301
+ Text,
1302
+ null,
1303
+ formattedNumber
1304
+ );
1305
+ }
1306
+ }]);
1307
+ return FormattedNumber;
1749
1308
  }(React.Component);
1750
1309
 
1751
1310
  FormattedNumber.displayName = 'FormattedNumber';
1752
1311
  FormattedNumber.contextTypes = {
1753
- intl: intlShape
1312
+ intl: intlShape
1754
1313
  };
1755
- process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = babelHelpers$1['extends']({}, numberFormatPropTypes, {
1756
- value: React.PropTypes.any.isRequired,
1757
- format: React.PropTypes.string,
1758
- children: React.PropTypes.func
1314
+ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = _extends({}, numberFormatPropTypes, {
1315
+ value: PropTypes.any.isRequired,
1316
+ format: PropTypes.string,
1317
+ children: PropTypes.func
1759
1318
  }) : void 0;
1760
1319
 
1761
1320
  /*
@@ -1765,73 +1324,73 @@ process.env.NODE_ENV !== "production" ? FormattedNumber.propTypes = babelHelpers
1765
1324
  */
1766
1325
 
1767
1326
  var FormattedPlural = function (_Component) {
1768
- inherits(FormattedPlural, _Component);
1327
+ inherits(FormattedPlural, _Component);
1769
1328
 
1770
- function FormattedPlural(props, context) {
1771
- classCallCheck(this, FormattedPlural);
1329
+ function FormattedPlural(props, context) {
1330
+ classCallCheck(this, FormattedPlural);
1772
1331
 
1773
- var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1332
+ var _this = possibleConstructorReturn(this, (FormattedPlural.__proto__ || Object.getPrototypeOf(FormattedPlural)).call(this, props, context));
1774
1333
 
1775
- invariantIntlContext(context);
1776
- return _this;
1777
- }
1334
+ invariantIntlContext(context);
1335
+ return _this;
1336
+ }
1778
1337
 
1779
- createClass(FormattedPlural, [{
1780
- key: 'shouldComponentUpdate',
1781
- value: function shouldComponentUpdate() {
1782
- for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1783
- next[_key] = arguments[_key];
1784
- }
1338
+ createClass(FormattedPlural, [{
1339
+ key: 'shouldComponentUpdate',
1340
+ value: function shouldComponentUpdate() {
1341
+ for (var _len = arguments.length, next = Array(_len), _key = 0; _key < _len; _key++) {
1342
+ next[_key] = arguments[_key];
1343
+ }
1785
1344
 
1786
- return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1787
- }
1788
- }, {
1789
- key: 'render',
1790
- value: function render() {
1791
- var _context$intl = this.context.intl,
1792
- formatPlural = _context$intl.formatPlural,
1793
- Text = _context$intl.textComponent;
1794
- var _props = this.props,
1795
- value = _props.value,
1796
- other = _props.other,
1797
- children = _props.children;
1798
-
1799
-
1800
- var pluralCategory = formatPlural(value, this.props);
1801
- var formattedPlural = this.props[pluralCategory] || other;
1802
-
1803
- if (typeof children === 'function') {
1804
- return children(formattedPlural);
1805
- }
1806
-
1807
- return React__default.createElement(
1808
- Text,
1809
- null,
1810
- formattedPlural
1811
- );
1812
- }
1813
- }]);
1814
- return FormattedPlural;
1345
+ return shouldIntlComponentUpdate.apply(undefined, [this].concat(next));
1346
+ }
1347
+ }, {
1348
+ key: 'render',
1349
+ value: function render() {
1350
+ var _context$intl = this.context.intl,
1351
+ formatPlural = _context$intl.formatPlural,
1352
+ Text = _context$intl.textComponent;
1353
+ var _props = this.props,
1354
+ value = _props.value,
1355
+ other = _props.other,
1356
+ children = _props.children;
1357
+
1358
+
1359
+ var pluralCategory = formatPlural(value, this.props);
1360
+ var formattedPlural = this.props[pluralCategory] || other;
1361
+
1362
+ if (typeof children === 'function') {
1363
+ return children(formattedPlural);
1364
+ }
1365
+
1366
+ return React__default.createElement(
1367
+ Text,
1368
+ null,
1369
+ formattedPlural
1370
+ );
1371
+ }
1372
+ }]);
1373
+ return FormattedPlural;
1815
1374
  }(React.Component);
1816
1375
 
1817
1376
  FormattedPlural.displayName = 'FormattedPlural';
1818
1377
  FormattedPlural.contextTypes = {
1819
- intl: intlShape
1378
+ intl: intlShape
1820
1379
  };
1821
1380
  FormattedPlural.defaultProps = {
1822
- style: 'cardinal'
1381
+ style: 'cardinal'
1823
1382
  };
1824
- process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = babelHelpers$1['extends']({}, pluralFormatPropTypes, {
1825
- value: React.PropTypes.any.isRequired,
1383
+ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = _extends({}, pluralFormatPropTypes, {
1384
+ value: PropTypes.any.isRequired,
1826
1385
 
1827
- other: React.PropTypes.node.isRequired,
1828
- zero: React.PropTypes.node,
1829
- one: React.PropTypes.node,
1830
- two: React.PropTypes.node,
1831
- few: React.PropTypes.node,
1832
- many: React.PropTypes.node,
1386
+ other: PropTypes.node.isRequired,
1387
+ zero: PropTypes.node,
1388
+ one: PropTypes.node,
1389
+ two: PropTypes.node,
1390
+ few: PropTypes.node,
1391
+ many: PropTypes.node,
1833
1392
 
1834
- children: React.PropTypes.func
1393
+ children: PropTypes.func
1835
1394
  }) : void 0;
1836
1395
 
1837
1396
  /*
@@ -1841,146 +1400,142 @@ process.env.NODE_ENV !== "production" ? FormattedPlural.propTypes = babelHelpers
1841
1400
  */
1842
1401
 
1843
1402
  var FormattedMessage = function (_Component) {
1844
- inherits(FormattedMessage, _Component);
1403
+ inherits(FormattedMessage, _Component);
1845
1404
 
1846
- function FormattedMessage(props, context) {
1847
- classCallCheck(this, FormattedMessage);
1405
+ function FormattedMessage(props, context) {
1406
+ classCallCheck(this, FormattedMessage);
1848
1407
 
1849
- var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1408
+ var _this = possibleConstructorReturn(this, (FormattedMessage.__proto__ || Object.getPrototypeOf(FormattedMessage)).call(this, props, context));
1850
1409
 
1851
- invariantIntlContext(context);
1852
- return _this;
1853
- }
1410
+ invariantIntlContext(context);
1411
+ return _this;
1412
+ }
1854
1413
 
1855
- createClass(FormattedMessage, [{
1856
- key: 'shouldComponentUpdate',
1857
- value: function shouldComponentUpdate(nextProps) {
1858
- var values = this.props.values;
1859
- var nextValues = nextProps.values;
1414
+ createClass(FormattedMessage, [{
1415
+ key: 'shouldComponentUpdate',
1416
+ value: function shouldComponentUpdate(nextProps) {
1417
+ var values = this.props.values;
1418
+ var nextValues = nextProps.values;
1860
1419
 
1861
1420
 
1862
- if (!shallowEquals(nextValues, values)) {
1863
- return true;
1864
- }
1421
+ if (!shallowEquals(nextValues, values)) {
1422
+ return true;
1423
+ }
1865
1424
 
1866
- // Since `values` has already been checked, we know they're not
1867
- // different, so the current `values` are carried over so the shallow
1868
- // equals comparison on the other props isn't affected by the `values`.
1869
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
1870
- values: values
1871
- });
1425
+ // Since `values` has already been checked, we know they're not
1426
+ // different, so the current `values` are carried over so the shallow
1427
+ // equals comparison on the other props isn't affected by the `values`.
1428
+ var nextPropsToCheck = _extends({}, nextProps, {
1429
+ values: values
1430
+ });
1872
1431
 
1873
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1874
- next[_key - 1] = arguments[_key];
1875
- }
1432
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1433
+ next[_key - 1] = arguments[_key];
1434
+ }
1876
1435
 
1877
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1878
- }
1879
- }, {
1880
- key: 'render',
1881
- value: function render() {
1882
- var _context$intl = this.context.intl,
1883
- formatMessage = _context$intl.formatMessage,
1884
- Text = _context$intl.textComponent;
1885
- var _props = this.props,
1886
- id = _props.id,
1887
- description = _props.description,
1888
- defaultMessage = _props.defaultMessage,
1889
- values = _props.values,
1890
- _props$tagName = _props.tagName,
1891
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1892
- children = _props.children;
1893
-
1894
-
1895
- var tokenDelimiter = void 0;
1896
- var tokenizedValues = void 0;
1897
- var elements = void 0;
1898
-
1899
- var hasValues = values && Object.keys(values).length > 0;
1900
- if (hasValues) {
1901
- (function () {
1902
- // Creates a token with a random UID that should not be guessable or
1903
- // conflict with other parts of the `message` string.
1904
- var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1905
-
1906
- var generateToken = function () {
1907
- var counter = 0;
1908
- return function () {
1909
- return 'ELEMENT-' + uid + '-' + (counter += 1);
1910
- };
1911
- }();
1912
-
1913
- // Splitting with a delimiter to support IE8. When using a regex
1914
- // with a capture group IE8 does not include the capture group in
1915
- // the resulting array.
1916
- tokenDelimiter = '@__' + uid + '__@';
1917
- tokenizedValues = {};
1918
- elements = {};
1919
-
1920
- // Iterates over the `props` to keep track of any React Element
1921
- // values so they can be represented by the `token` as a placeholder
1922
- // when the `message` is formatted. This allows the formatted
1923
- // message to then be broken-up into parts with references to the
1924
- // React Elements inserted back in.
1925
- Object.keys(values).forEach(function (name) {
1926
- var value = values[name];
1927
-
1928
- if (React.isValidElement(value)) {
1929
- var token = generateToken();
1930
- tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1931
- elements[token] = value;
1932
- } else {
1933
- tokenizedValues[name] = value;
1934
- }
1935
- });
1936
- })();
1937
- }
1938
-
1939
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1940
- var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1941
-
1942
- var nodes = void 0;
1943
-
1944
- var hasElements = elements && Object.keys(elements).length > 0;
1945
- if (hasElements) {
1946
- // Split the message into parts so the React Element values captured
1947
- // above can be inserted back into the rendered message. This
1948
- // approach allows messages to render with React Elements while
1949
- // keeping React's virtual diffing working properly.
1950
- nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1951
- return !!part;
1952
- }).map(function (part) {
1953
- return elements[part] || part;
1954
- });
1955
- } else {
1956
- nodes = [formattedMessage];
1957
- }
1958
-
1959
- if (typeof children === 'function') {
1960
- return children.apply(undefined, toConsumableArray(nodes));
1961
- }
1962
-
1963
- return React__default.createElement(
1964
- Component$$1,
1965
- null,
1966
- nodes
1967
- );
1968
- }
1969
- }]);
1970
- return FormattedMessage;
1436
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1437
+ }
1438
+ }, {
1439
+ key: 'render',
1440
+ value: function render() {
1441
+ var _context$intl = this.context.intl,
1442
+ formatMessage = _context$intl.formatMessage,
1443
+ Text = _context$intl.textComponent;
1444
+ var _props = this.props,
1445
+ id = _props.id,
1446
+ description = _props.description,
1447
+ defaultMessage = _props.defaultMessage,
1448
+ values = _props.values,
1449
+ _props$tagName = _props.tagName,
1450
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1451
+ children = _props.children;
1452
+
1453
+
1454
+ var tokenDelimiter = void 0;
1455
+ var tokenizedValues = void 0;
1456
+ var elements = void 0;
1457
+
1458
+ var hasValues = values && Object.keys(values).length > 0;
1459
+ if (hasValues) {
1460
+ // Creates a token with a random UID that should not be guessable or
1461
+ // conflict with other parts of the `message` string.
1462
+ var uid = Math.floor(Math.random() * 0x10000000000).toString(16);
1463
+
1464
+ var generateToken = function () {
1465
+ var counter = 0;
1466
+ return function () {
1467
+ return 'ELEMENT-' + uid + '-' + (counter += 1);
1468
+ };
1469
+ }();
1470
+
1471
+ // Splitting with a delimiter to support IE8. When using a regex
1472
+ // with a capture group IE8 does not include the capture group in
1473
+ // the resulting array.
1474
+ tokenDelimiter = '@__' + uid + '__@';
1475
+ tokenizedValues = {};
1476
+ elements = {};
1477
+
1478
+ // Iterates over the `props` to keep track of any React Element
1479
+ // values so they can be represented by the `token` as a placeholder
1480
+ // when the `message` is formatted. This allows the formatted
1481
+ // message to then be broken-up into parts with references to the
1482
+ // React Elements inserted back in.
1483
+ Object.keys(values).forEach(function (name) {
1484
+ var value = values[name];
1485
+
1486
+ if (React.isValidElement(value)) {
1487
+ var token = generateToken();
1488
+ tokenizedValues[name] = tokenDelimiter + token + tokenDelimiter;
1489
+ elements[token] = value;
1490
+ } else {
1491
+ tokenizedValues[name] = value;
1492
+ }
1493
+ });
1494
+ }
1495
+
1496
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1497
+ var formattedMessage = formatMessage(descriptor, tokenizedValues || values);
1498
+
1499
+ var nodes = void 0;
1500
+
1501
+ var hasElements = elements && Object.keys(elements).length > 0;
1502
+ if (hasElements) {
1503
+ // Split the message into parts so the React Element values captured
1504
+ // above can be inserted back into the rendered message. This
1505
+ // approach allows messages to render with React Elements while
1506
+ // keeping React's virtual diffing working properly.
1507
+ nodes = formattedMessage.split(tokenDelimiter).filter(function (part) {
1508
+ return !!part;
1509
+ }).map(function (part) {
1510
+ return elements[part] || part;
1511
+ });
1512
+ } else {
1513
+ nodes = [formattedMessage];
1514
+ }
1515
+
1516
+ if (typeof children === 'function') {
1517
+ return children.apply(undefined, toConsumableArray(nodes));
1518
+ }
1519
+
1520
+ // Needs to use `createElement()` instead of JSX, otherwise React will
1521
+ // warn about a missing `key` prop with rich-text message formatting.
1522
+ return React.createElement.apply(undefined, [Component$$1, null].concat(toConsumableArray(nodes)));
1523
+ }
1524
+ }]);
1525
+ return FormattedMessage;
1971
1526
  }(React.Component);
1972
1527
 
1973
1528
  FormattedMessage.displayName = 'FormattedMessage';
1974
1529
  FormattedMessage.contextTypes = {
1975
- intl: intlShape
1530
+ intl: intlShape
1976
1531
  };
1977
1532
  FormattedMessage.defaultProps = {
1978
- values: {}
1533
+ values: {}
1979
1534
  };
1980
- process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
1981
- values: React.PropTypes.object,
1982
- tagName: React.PropTypes.string,
1983
- children: React.PropTypes.func
1535
+ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1536
+ values: PropTypes.object,
1537
+ tagName: PropTypes.string,
1538
+ children: PropTypes.func
1984
1539
  }) : void 0;
1985
1540
 
1986
1541
  /*
@@ -1990,90 +1545,90 @@ process.env.NODE_ENV !== "production" ? FormattedMessage.propTypes = babelHelper
1990
1545
  */
1991
1546
 
1992
1547
  var FormattedHTMLMessage = function (_Component) {
1993
- inherits(FormattedHTMLMessage, _Component);
1548
+ inherits(FormattedHTMLMessage, _Component);
1994
1549
 
1995
- function FormattedHTMLMessage(props, context) {
1996
- classCallCheck(this, FormattedHTMLMessage);
1550
+ function FormattedHTMLMessage(props, context) {
1551
+ classCallCheck(this, FormattedHTMLMessage);
1997
1552
 
1998
- var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1553
+ var _this = possibleConstructorReturn(this, (FormattedHTMLMessage.__proto__ || Object.getPrototypeOf(FormattedHTMLMessage)).call(this, props, context));
1999
1554
 
2000
- invariantIntlContext(context);
2001
- return _this;
2002
- }
1555
+ invariantIntlContext(context);
1556
+ return _this;
1557
+ }
2003
1558
 
2004
- createClass(FormattedHTMLMessage, [{
2005
- key: 'shouldComponentUpdate',
2006
- value: function shouldComponentUpdate(nextProps) {
2007
- var values = this.props.values;
2008
- var nextValues = nextProps.values;
1559
+ createClass(FormattedHTMLMessage, [{
1560
+ key: 'shouldComponentUpdate',
1561
+ value: function shouldComponentUpdate(nextProps) {
1562
+ var values = this.props.values;
1563
+ var nextValues = nextProps.values;
2009
1564
 
2010
1565
 
2011
- if (!shallowEquals(nextValues, values)) {
2012
- return true;
2013
- }
1566
+ if (!shallowEquals(nextValues, values)) {
1567
+ return true;
1568
+ }
2014
1569
 
2015
- // Since `values` has already been checked, we know they're not
2016
- // different, so the current `values` are carried over so the shallow
2017
- // equals comparison on the other props isn't affected by the `values`.
2018
- var nextPropsToCheck = babelHelpers$1['extends']({}, nextProps, {
2019
- values: values
2020
- });
1570
+ // Since `values` has already been checked, we know they're not
1571
+ // different, so the current `values` are carried over so the shallow
1572
+ // equals comparison on the other props isn't affected by the `values`.
1573
+ var nextPropsToCheck = _extends({}, nextProps, {
1574
+ values: values
1575
+ });
2021
1576
 
2022
- for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2023
- next[_key - 1] = arguments[_key];
2024
- }
1577
+ for (var _len = arguments.length, next = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1578
+ next[_key - 1] = arguments[_key];
1579
+ }
2025
1580
 
2026
- return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
2027
- }
2028
- }, {
2029
- key: 'render',
2030
- value: function render() {
2031
- var _context$intl = this.context.intl,
2032
- formatHTMLMessage = _context$intl.formatHTMLMessage,
2033
- Text = _context$intl.textComponent;
2034
- var _props = this.props,
2035
- id = _props.id,
2036
- description = _props.description,
2037
- defaultMessage = _props.defaultMessage,
2038
- rawValues = _props.values,
2039
- _props$tagName = _props.tagName,
2040
- Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
2041
- children = _props.children;
2042
-
2043
-
2044
- var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
2045
- var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
2046
-
2047
- if (typeof children === 'function') {
2048
- return children(formattedHTMLMessage);
2049
- }
2050
-
2051
- // Since the message presumably has HTML in it, we need to set
2052
- // `innerHTML` in order for it to be rendered and not escaped by React.
2053
- // To be safe, all string prop values were escaped when formatting the
2054
- // message. It is assumed that the message is not UGC, and came from the
2055
- // developer making it more like a template.
2056
- //
2057
- // Note: There's a perf impact of using this component since there's no
2058
- // way for React to do its virtual DOM diffing.
2059
- var html = { __html: formattedHTMLMessage };
2060
- return React__default.createElement(Component$$1, { dangerouslySetInnerHTML: html });
2061
- }
2062
- }]);
2063
- return FormattedHTMLMessage;
1581
+ return shouldIntlComponentUpdate.apply(undefined, [this, nextPropsToCheck].concat(next));
1582
+ }
1583
+ }, {
1584
+ key: 'render',
1585
+ value: function render() {
1586
+ var _context$intl = this.context.intl,
1587
+ formatHTMLMessage = _context$intl.formatHTMLMessage,
1588
+ Text = _context$intl.textComponent;
1589
+ var _props = this.props,
1590
+ id = _props.id,
1591
+ description = _props.description,
1592
+ defaultMessage = _props.defaultMessage,
1593
+ rawValues = _props.values,
1594
+ _props$tagName = _props.tagName,
1595
+ Component$$1 = _props$tagName === undefined ? Text : _props$tagName,
1596
+ children = _props.children;
1597
+
1598
+
1599
+ var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
1600
+ var formattedHTMLMessage = formatHTMLMessage(descriptor, rawValues);
1601
+
1602
+ if (typeof children === 'function') {
1603
+ return children(formattedHTMLMessage);
1604
+ }
1605
+
1606
+ // Since the message presumably has HTML in it, we need to set
1607
+ // `innerHTML` in order for it to be rendered and not escaped by React.
1608
+ // To be safe, all string prop values were escaped when formatting the
1609
+ // message. It is assumed that the message is not UGC, and came from the
1610
+ // developer making it more like a template.
1611
+ //
1612
+ // Note: There's a perf impact of using this component since there's no
1613
+ // way for React to do its virtual DOM diffing.
1614
+ var html = { __html: formattedHTMLMessage };
1615
+ return React__default.createElement(Component$$1, { dangerouslySetInnerHTML: html });
1616
+ }
1617
+ }]);
1618
+ return FormattedHTMLMessage;
2064
1619
  }(React.Component);
2065
1620
 
2066
1621
  FormattedHTMLMessage.displayName = 'FormattedHTMLMessage';
2067
1622
  FormattedHTMLMessage.contextTypes = {
2068
- intl: intlShape
1623
+ intl: intlShape
2069
1624
  };
2070
1625
  FormattedHTMLMessage.defaultProps = {
2071
- values: {}
1626
+ values: {}
2072
1627
  };
2073
- process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = babelHelpers$1['extends']({}, messageDescriptorPropTypes, {
2074
- values: React.PropTypes.object,
2075
- tagName: React.PropTypes.string,
2076
- children: React.PropTypes.func
1628
+ process.env.NODE_ENV !== "production" ? FormattedHTMLMessage.propTypes = _extends({}, messageDescriptorPropTypes, {
1629
+ values: PropTypes.object,
1630
+ tagName: PropTypes.string,
1631
+ children: PropTypes.func
2077
1632
  }) : void 0;
2078
1633
 
2079
1634
  /*